blun-king-cli 9.1.602 → 9.1.604
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/CHANGELOG.md +118 -99
- package/LIESMICH.txt +74 -57
- package/README.md +119 -76
- package/bin/agentspine-king-goal-inbox.mjs +127 -127
- package/bin/agentspine-king-goal-intake.mjs +106 -106
- package/bin/agentspine-king-host-runner.mjs +109 -109
- package/bin/agentspine-king-snapshot-policy.cjs +80 -80
- package/bin/agentspine-king-status-policy.mjs +226 -226
- package/bin/agentspine-king-worker-host.mjs +160 -160
- package/bin/core-bootstrap.js +77 -77
- package/bin/launcher-mode.js +93 -93
- package/bin/launcher-restart-policy.cjs +131 -131
- package/bin/launcher-runtime.js +491 -491
- package/bin/managed-node.js +186 -186
- package/bin/managed-plugin-selection.cjs +115 -115
- package/bin/native-module-repair.js +201 -201
- package/bin/node-runtime.js +34 -34
- package/bin/node-version.js +49 -49
- package/bin/plugin-bootstrap.js +162 -162
- package/bin/private-paths.js +1606 -1606
- package/bin/runtime-exit-ledger.cjs +144 -144
- package/bin/runtime-exit-ledger.d.cts +23 -23
- package/bin/standard-tools-bootstrap.js +272 -272
- package/bin/turn-thinking-policy.cjs +82 -82
- package/bin/update-copy.js +200 -200
- package/bin/update-lease.js +597 -597
- package/bin/update-notice.js +1568 -1568
- package/bin/verify-agent-behavior.cjs +122 -122
- package/bin/verify-agent-components.cjs +104 -104
- package/bin/verify-bundled-agent-sources.cjs +98 -76
- package/bin/windows-node-crash-dump.cjs +289 -289
- package/blun.mjs +8041 -6407
- package/codebase-index/codebase_index.py +470 -470
- package/dist-web/assets/{CodeBlockNode-CXnTLMNr.js → CodeBlockNode-TKKkJX8L.js} +1 -1
- package/dist-web/assets/{CodeBlockShell.vue_vue_type_style_index_0_lang-CCF8Ntnq.js → CodeBlockShell.vue_vue_type_style_index_0_lang-CUj2Ds5x.js} +1 -1
- package/dist-web/assets/DesignSystemView-DwK1aQMo.js +12 -0
- package/dist-web/assets/DesignSystemView-szjTj7ns.css +1 -0
- package/dist-web/assets/{Tooltip-CFQEzqC-.js → Tooltip-CTWv7WCU.js} +1 -1
- package/dist-web/assets/{abnfDiagram-N423BO3Z-Z1APZG5m.js → abnfDiagram-N423BO3Z-DA8V8Zjh.js} +1 -1
- package/dist-web/assets/{arc-C4VyWloT.js → arc-YtddKbdY.js} +1 -1
- package/dist-web/assets/{architectureDiagram-T3A2C74G-DpddbUcM.js → architectureDiagram-T3A2C74G-CGEiObmo.js} +1 -1
- package/dist-web/assets/{blockDiagram-VBNYF7ZC-BqccOSMr.js → blockDiagram-VBNYF7ZC-Bd5Vt50e.js} +1 -1
- package/dist-web/assets/{c4Diagram-5PPSVZJV-OHAcJrTy.js → c4Diagram-5PPSVZJV-D2ApPM54.js} +1 -1
- package/dist-web/assets/channel-BnluexuN.js +1 -0
- package/dist-web/assets/{chunk-2GRJ4B5K-DqJHs8Fw.js → chunk-2GRJ4B5K-BDcIEZSl.js} +1 -1
- package/dist-web/assets/{chunk-2Q5K7J3B-B1nCd91o.js → chunk-2Q5K7J3B-6aSabCX7.js} +1 -1
- package/dist-web/assets/{chunk-5RXB4S5H-neG70kZx.js → chunk-5RXB4S5H-BFRQvIJS.js} +1 -1
- package/dist-web/assets/{chunk-5VM5RSS4-l7biGqeH.js → chunk-5VM5RSS4-ChAa-DNY.js} +1 -1
- package/dist-web/assets/{chunk-6Q2QTUOP-BO-F11Gs.js → chunk-6Q2QTUOP-BIfrb2Jc.js} +1 -1
- package/dist-web/assets/{chunk-GF5L2VYU-BtC69fw0.js → chunk-GF5L2VYU-BR0gvtWI.js} +1 -1
- package/dist-web/assets/{chunk-JWPE2WC7-DIOubEqr.js → chunk-JWPE2WC7-BgXKsx5E.js} +1 -1
- package/dist-web/assets/{chunk-KBJHAD2P-DDUeH_Ba.js → chunk-KBJHAD2P-I8mrZhpz.js} +1 -1
- package/dist-web/assets/{chunk-RYQCIY6F-B9gFMVbS.js → chunk-RYQCIY6F-BMPaem92.js} +1 -1
- package/dist-web/assets/{chunk-XXDRQBXY-Bn1Xz6TQ.js → chunk-XXDRQBXY-COy0J-0j.js} +1 -1
- package/dist-web/assets/classDiagram-JCYQIIEL-BliFdSD9.js +1 -0
- package/dist-web/assets/classDiagram-v2-OCEON4UE-BliFdSD9.js +1 -0
- package/dist-web/assets/{cose-bilkent-JH36ORCC-DqigO3T4.js → cose-bilkent-JH36ORCC-MosTTRdo.js} +1 -1
- package/dist-web/assets/{cynefin-VYW2F7L2-rpD93tQ-.js → cynefin-VYW2F7L2-5tjPgrkP.js} +1 -1
- package/dist-web/assets/{cynefinDiagram-MW4NZA55-DbTqnkVJ.js → cynefinDiagram-MW4NZA55-CbDcdInR.js} +1 -1
- package/dist-web/assets/{dagre-VZM6K2ZE-DcM8aEVY.js → dagre-VZM6K2ZE-YaBom1ZH.js} +1 -1
- package/dist-web/assets/{diagram-7IWD3JNH-UymgsBNa.js → diagram-7IWD3JNH-Da4m-Hgz.js} +1 -1
- package/dist-web/assets/{diagram-B4RE2ZJO-BiYu5WPF.js → diagram-B4RE2ZJO-CAUUegxg.js} +1 -1
- package/dist-web/assets/{diagram-LBJQPF4R-BD3kkgOO.js → diagram-LBJQPF4R-o21mWKG4.js} +1 -1
- package/dist-web/assets/{diagram-Q27KOJAE-D1mYQ_cI.js → diagram-Q27KOJAE-BA3z3sXf.js} +1 -1
- package/dist-web/assets/{diagram-UB23O5K3-BtX8u6HG.js → diagram-UB23O5K3-CGRdSSDK.js} +1 -1
- package/dist-web/assets/{ebnfDiagram-BXEA7PRR-CBAnFkRF.js → ebnfDiagram-BXEA7PRR-Bw-iU9FP.js} +1 -1
- package/dist-web/assets/{erDiagram-JOGREHBK-3vKcWsxm.js → erDiagram-JOGREHBK-BwM1yiR0.js} +1 -1
- package/dist-web/assets/{flowDiagram-UKHOOZJN-D9wBbHm2.js → flowDiagram-UKHOOZJN-z05eOR1Q.js} +1 -1
- package/dist-web/assets/{ganttDiagram-PKOTCBZU-Cd_dViF-.js → ganttDiagram-PKOTCBZU-BMUubNTl.js} +1 -1
- package/dist-web/assets/{gitGraphDiagram-DS77QQ5N-BiEEtTo7.js → gitGraphDiagram-DS77QQ5N-Dccbi1wU.js} +1 -1
- package/dist-web/assets/{index-DdEakFJM.js → index-BBbC5LRF.js} +1 -1
- package/dist-web/assets/{index-BmKj7CB1.css → index-C9eDH3u-.css} +1 -1
- package/dist-web/assets/{index-Ba1OvLjf.js → index-D48p0M2S.js} +2 -2
- package/dist-web/assets/{index-CiPA8Kex.js → index-h0KEOmkU.js} +14 -14
- package/dist-web/assets/{index10-CNr4U-Nw.js → index10-Qbuw1N6u.js} +1 -1
- package/dist-web/assets/{index11-Dto_yZNz.js → index11-g8v025wN.js} +1 -1
- package/dist-web/assets/{index5-B2PldaO2.js → index5-BYNcV8BY.js} +1 -1
- package/dist-web/assets/{index6-CBdZmmyx.js → index6-BetANtnV.js} +1 -1
- package/dist-web/assets/{index7-Dz9oCsUF.js → index7-BcPbgCKN.js} +1 -1
- package/dist-web/assets/{index8-B6k25jtU.js → index8-B1lp-RvF.js} +2 -2
- package/dist-web/assets/{infoDiagram-6WML65LV-D4ph2sIH.js → infoDiagram-6WML65LV-BF_pbUnN.js} +1 -1
- package/dist-web/assets/{ishikawaDiagram-WSZJBQD7-DjKjbMm9.js → ishikawaDiagram-WSZJBQD7-Dedv4urS.js} +1 -1
- package/dist-web/assets/{journeyDiagram-NVQOT4AX-DttHDfPQ.js → journeyDiagram-NVQOT4AX-B1Ex3b6o.js} +1 -1
- package/dist-web/assets/{kanban-definition-27J2QSJJ-C5gB-W0d.js → kanban-definition-27J2QSJJ-BtCGliBH.js} +1 -1
- package/dist-web/assets/{linear-BRGe4-d6.js → linear-ByItc8Qr.js} +1 -1
- package/dist-web/assets/{mermaid.core-D-9Sx1No.js → mermaid.core-B1M2O7nN.js} +4 -4
- package/dist-web/assets/{mindmap-definition-FAOFIHXS-Cg_hoVIq.js → mindmap-definition-FAOFIHXS-D0UHKUyj.js} +1 -1
- package/dist-web/assets/{pegDiagram-VL7TDLO6-CSX9hitD.js → pegDiagram-VL7TDLO6-D7zYCVmG.js} +1 -1
- package/dist-web/assets/{pieDiagram-7S7Q4E2Y-0L0mxahZ.js → pieDiagram-7S7Q4E2Y-Bd0i9CHa.js} +1 -1
- package/dist-web/assets/{quadrantDiagram-CIZ2JOQS-U483z0er.js → quadrantDiagram-CIZ2JOQS-MG-Ug47d.js} +1 -1
- package/dist-web/assets/{railroadDiagram-AXF67PYL-D80a2_DJ.js → railroadDiagram-AXF67PYL-AZdl90Gj.js} +1 -1
- package/dist-web/assets/{requirementDiagram-LRYGKXZP-CeyHfq8t.js → requirementDiagram-LRYGKXZP-DjplF9kt.js} +1 -1
- package/dist-web/assets/{sankeyDiagram-W5VNT64P-CCISkkrR.js → sankeyDiagram-W5VNT64P-Bi9Zgfjs.js} +1 -1
- package/dist-web/assets/{sequenceDiagram-SI44F4Z6-jQfm2XS7.js → sequenceDiagram-SI44F4Z6-ChEpdCvb.js} +1 -1
- package/dist-web/assets/{sizeCapture-X5ZJPWSS-lRZsmCoS.js → sizeCapture-X5ZJPWSS-B5RFUdaa.js} +1 -1
- package/dist-web/assets/{stateDiagram-OKZ733FA-ClCgTdUm.js → stateDiagram-OKZ733FA-BkRblSKp.js} +1 -1
- package/dist-web/assets/stateDiagram-v2-UEYNNEHI-fVkQcACW.js +1 -0
- package/dist-web/assets/{swimlanes-SLNWSIFB-BCdOUN05.js → swimlanes-SLNWSIFB-DLXH6Zhc.js} +2 -2
- package/dist-web/assets/swimlanesDiagram-ULZ7WXOC-Bg-BiZJQ.js +8 -0
- package/dist-web/assets/{timeline-definition-Z64GVDOM-DpWutSKa.js → timeline-definition-Z64GVDOM-C_N88siO.js} +1 -1
- package/dist-web/assets/{vennDiagram-T6HMQDX7-DVC5JVsc.js → vennDiagram-T6HMQDX7-DMsnvDt0.js} +1 -1
- package/dist-web/assets/{vue.runtime.esm-bundler-BwwRtQwQ.js → vue.runtime.esm-bundler-B-3uIy85.js} +1 -1
- package/dist-web/assets/{wardleyDiagram-T6FBY63Y-BK2mrq7L.js → wardleyDiagram-T6FBY63Y-C9SJIPzq.js} +1 -1
- package/dist-web/assets/{xychartDiagram-ELKLHX3M-DUJu9F7-.js → xychartDiagram-ELKLHX3M-DZLWA6Go.js} +1 -1
- package/dist-web/index.html +32 -32
- package/dist-web/vis/index.html.gz +0 -0
- package/package.json +1 -1
- package/scripts/fix-node-pty-perms.js +53 -53
- package/standard-skills/blun-app-design-system/SKILL.md +30 -30
- package/standard-skills/blun-app-design-system/provenance.json +17 -17
- package/standard-skills/blun-app-design-system/references/tokens.md +48 -48
- package/standard-skills/blun-app-design-system/scripts/check-blun-design.mjs +49 -49
- package/telegram-plugin/blun.plugin.json +20 -20
- package/telegram-plugin/commands/access.md +37 -37
- package/telegram-plugin/dist/bridge.mjs +117 -100
- package/telegram-plugin/dist/mcp-server.mjs +185 -161
- package/worker-host.mjs +1458 -1022
- package/dist-web/assets/DesignSystemView-6HgAUEmC.css +0 -1
- package/dist-web/assets/DesignSystemView-BbMOu-XO.js +0 -12
- package/dist-web/assets/channel-B2VOQOI-.js +0 -1
- package/dist-web/assets/classDiagram-JCYQIIEL-BA1TjAxj.js +0 -1
- package/dist-web/assets/classDiagram-v2-OCEON4UE-BA1TjAxj.js +0 -1
- package/dist-web/assets/stateDiagram-v2-UEYNNEHI-fi_lrTAx.js +0 -1
- package/dist-web/assets/swimlanesDiagram-ULZ7WXOC-BUd_uYK3.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemView-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemView-DwK1aQMo.js","assets/DesignSystemView-szjTj7ns.css","assets/mhchem-DtR62fUK.js","assets/katex-DnlPpQZa.js","assets/CodeBlockNode-TKKkJX8L.js","assets/safeRaf-DGuzXxDK.js","assets/CodeBlockShell.vue_vue_type_style_index_0_lang-CUj2Ds5x.js","assets/index8-B1lp-RvF.js","assets/index11-g8v025wN.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();/**
|
|
3
3
|
* @vue/shared v3.5.35
|
|
4
4
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
@@ -35,8 +35,8 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemVie
|
|
|
35
35
|
* vue-i18n v11.4.5
|
|
36
36
|
* (c) 2026 kazuya kawaguchi
|
|
37
37
|
* Released under the MIT License.
|
|
38
|
-
*/const qN="11.4.5";function jN(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(Pl().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(Pl().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Pl().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Pl().__INTLIFY_PROD_DEVTOOLS__=!1)}const Qs={UNEXPECTED_RETURN_TYPE:uN,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function po(e,...t){return fh(e,null,void 0)}const Uv=tl("__translateVNode"),qv=tl("__datetimeParts"),jv=tl("__numberParts"),pA=tl("__setPluralRules"),hA=tl("__injectWithOption"),Ra=tl("__dispose");function Pu(e){if(!en(e)||$i(e))return e;for(const t in e)if(Zo(e,t))if(!t.includes("."))en(e[t])&&Pu(e[t]);else{const n=t.split("."),s=n.length-1;let o=e,i=!1;for(let r=0;r<s;r++){if(n[r]==="__proto__")throw new Error(`unsafe key: ${n[r]}`);if(n[r]in o||(o[n[r]]=vn()),!en(o[n[r]])){i=!0;break}o=o[n[r]]}if(i||($i(o)?sA.includes(n[s])||delete e[t]:(o[n[s]]=e[t],delete e[t])),!$i(o)){const r=o[n[s]];en(r)&&Pu(r)}}return e}function k0(e,t){const{messages:n,__i18n:s,messageResolver:o,flatJson:i}=t,r=jt(n)?n:Yn(s)?vn():{[e]:vn()};if(Yn(s)&&s.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:a,resource:c}=l;a?(r[a]=r[a]||vn(),Cf(c,r[a])):Cf(c,r)}else pt(l)&&Cf(JSON.parse(l),r)}),o==null&&i)for(const l in r)Zo(r,l)&&Pu(r[l]);return r}function mA(e){return e.type}function gA(e,t,n){let s=en(t.messages)?t.messages:vn();"__i18nGlobal"in n&&(s=k0(e.locale.value,{messages:s,__i18n:n.__i18nGlobal}));const o=Object.keys(s);o.length&&o.forEach(i=>{e.mergeLocaleMessage(i,s[i])});{if(en(t.datetimeFormats)){const i=Object.keys(t.datetimeFormats);i.length&&i.forEach(r=>{e.mergeDateTimeFormat(r,t.datetimeFormats[r])})}if(en(t.numberFormats)){const i=Object.keys(t.numberFormats);i.length&&i.forEach(r=>{e.mergeNumberFormat(r,t.numberFormats[r])})}}}function d_(e){return oe(zr,null,e,0)}function Ru(){return Ls()}const f_="__INTLIFY_META__",p_=()=>[],VN=()=>!1;let h_=0;function m_(e){return((t,n,s,o)=>e(n,s,Ru()||void 0,o))}const KN=()=>{const e=Ru();let t=null;return e&&(t=mA(e)[f_])?{[f_]:t}:null};function dp(e={}){const{__root:t,__injectWithOption:n}=e,s=t===void 0,o=e.flatJson,i=cp?Z:Ql;let r=Jt(e.inheritLocale)?e.inheritLocale:!0;const l=i(t&&r?t.locale.value:pt(e.locale)?e.locale:Ou),a=i(t&&r?t.fallbackLocale.value:pt(e.fallbackLocale)||Yn(e.fallbackLocale)||jt(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:l.value),c=i(k0(l.value,e)),u=i(jt(e.datetimeFormats)?e.datetimeFormats:{[l.value]:{}}),d=i(jt(e.numberFormats)?e.numberFormats:{[l.value]:{}});let p=t?t.missingWarn:Jt(e.missingWarn)||lc(e.missingWarn)?e.missingWarn:!0,h=t?t.fallbackWarn:Jt(e.fallbackWarn)||lc(e.fallbackWarn)?e.fallbackWarn:!0,f=t?t.fallbackRoot:Jt(e.fallbackRoot)?e.fallbackRoot:!0,m=!!e.fallbackFormat,b=Pn(e.missing)?e.missing:null,_=Pn(e.missing)?m_(e.missing):null,g=Pn(e.postTranslation)?e.postTranslation:null,v=t?t.warnHtmlMessage:Jt(e.warnHtmlMessage)?e.warnHtmlMessage:!0,y=!!e.escapeParameter;const A=t?t.modifiers:jt(e.modifiers)?e.modifiers:{};let O=e.pluralRules||t&&t.pluralRules,$;$=(()=>{s&&s_(null);const ae={version:qN,locale:l.value,fallbackLocale:a.value,messages:c.value,modifiers:A,pluralRules:O,missing:_===null?void 0:_,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:!0,postTranslation:g===null?void 0:g,warnHtmlMessage:v,escapeParameter:y,messageResolver:e.messageResolver,messageCompiler:e.messageCompiler,__meta:{framework:"vue"}};ae.datetimeFormats=u.value,ae.numberFormats=d.value,ae.__datetimeFormatters=jt($)?$.__datetimeFormatters:void 0,ae.__numberFormatters=jt($)?$.__numberFormatters:void 0;const Te=IN(ae);return s&&s_(Te),Te})(),jc($,l.value,a.value);function E(){return[l.value,a.value,c.value,u.value,d.value]}const M=F({get:()=>l.value,set:ae=>{$.locale=ae,l.value=ae}}),L=F({get:()=>a.value,set:ae=>{$.fallbackLocale=ae,a.value=ae,jc($,l.value,ae)}}),S=F(()=>c.value),I=F(()=>u.value),P=F(()=>d.value);function D(){return Pn(g)?g:null}function W(ae){g=ae,$.postTranslation=ae}function z(){return b}function q(ae){ae!==null&&(_=m_(ae)),b=ae,$.missing=_}const Q=(ae,Te,Ve,tt,bt,kt)=>{E();let Tt;try{__INTLIFY_PROD_DEVTOOLS__,s||($.fallbackContext=t?EN():void 0),Tt=ae($)}finally{__INTLIFY_PROD_DEVTOOLS__,s||($.fallbackContext=void 0)}if(Ve!=="translate exists"&&rs(Tt)&&Tt===ph||Ve==="translate exists"&&!Tt){const[Pt,mt]=Te();return t&&f?tt(t):bt(Pt)}else{if(kt(Tt))return Tt;throw po(Qs.UNEXPECTED_RETURN_TYPE)}};function X(...ae){return Q(Te=>Reflect.apply(u_,null,[Te,...ae]),()=>zv(...ae),"translate",Te=>Reflect.apply(Te.t,Te,[...ae]),Te=>Te,Te=>pt(Te))}function fe(...ae){const[Te,Ve,tt]=ae;if(tt&&!en(tt))throw po(Qs.INVALID_ARGUMENT);return X(Te,Ve,as({resolvedMessage:!0},tt||{}))}function ye(...ae){return Q(Te=>Reflect.apply(i_,null,[Te,...ae]),()=>Hv(...ae),"datetime format",Te=>Reflect.apply(Te.d,Te,[...ae]),()=>up,Te=>pt(Te)||Yn(Te))}function Me(...ae){return Q(Te=>Reflect.apply(l_,null,[Te,...ae]),()=>Wv(...ae),"number format",Te=>Reflect.apply(Te.n,Te,[...ae]),()=>up,Te=>pt(Te)||Yn(Te))}function we(ae){return ae.map(Te=>pt(Te)||rs(Te)||Jt(Te)?d_(String(Te)):Te)}const Ue={normalize:we,interpolate:ae=>ae,type:"vnode"};function Fe(...ae){return Q(Te=>{let Ve;const tt=Te;try{tt.processor=Ue,Ve=Reflect.apply(u_,null,[tt,...ae])}finally{tt.processor=null}return Ve},()=>zv(...ae),"translate",Te=>Te[Uv](...ae),Te=>[d_(Te)],Te=>Yn(Te))}function rt(...ae){return Q(Te=>Reflect.apply(l_,null,[Te,...ae]),()=>Wv(...ae),"number format",Te=>Te[jv](...ae),p_,Te=>pt(Te)||Yn(Te))}function le(...ae){return Q(Te=>Reflect.apply(i_,null,[Te,...ae]),()=>Hv(...ae),"datetime format",Te=>Te[qv](...ae),p_,Te=>pt(Te)||Yn(Te))}function U(ae){O=ae,$.pluralRules=O}function G(ae,Te){return Q(()=>{if(!ae)return!1;const Ve=pt(Te)?Te:l.value,tt=pt(Te)?[Ve]:Fv($,a.value,Ve);for(let bt=0;bt<tt.length;bt++){const kt=J(tt[bt]);let Tt=$.messageResolver(kt,ae);if(Tt===null&&(Tt=kt[ae]),$i(Tt)||Go(Tt)||pt(Tt))return!0}return!1},()=>[ae],"translate exists",Ve=>Reflect.apply(Ve.te,Ve,[ae,Te]),VN,Ve=>Jt(Ve))}function ne(ae){let Te=null;const Ve=Fv($,a.value,l.value);for(let tt=0;tt<Ve.length;tt++){const bt=c.value[Ve[tt]]||{},kt=$.messageResolver(bt,ae);if(kt!=null){Te=kt;break}}return Te}function H(ae){const Te=ne(ae);return Te??(t?t.tm(ae)||{}:{})}function J(ae){return c.value[ae]||{}}function ce(ae,Te){if(o){const Ve={[ae]:Te};for(const tt in Ve)Zo(Ve,tt)&&Pu(Ve[tt]);Te=Ve[ae]}c.value[ae]=Te,$.messages=c.value}function te(ae,Te){c.value[ae]=c.value[ae]||{};const Ve={[ae]:Te};if(o)for(const tt in Ve)Zo(Ve,tt)&&Pu(Ve[tt]);Te=Ve[ae],Cf(Te,c.value[ae]),$.messages=c.value}function ue(ae){return u.value[ae]||{}}function j(ae,Te){u.value[ae]=Te,$.datetimeFormats=u.value,r_($,ae,Te)}function Y(ae,Te){u.value[ae]=as(u.value[ae]||{},Te),$.datetimeFormats=u.value,r_($,ae,Te)}function re(ae){return d.value[ae]||{}}function ge(ae,Te){d.value[ae]=Te,$.numberFormats=d.value,a_($,ae,Te)}function Ae(ae,Te){d.value[ae]=as(d.value[ae]||{},Te),$.numberFormats=d.value,a_($,ae,Te)}h_++,t&&cp&&(Ke(t.locale,ae=>{r&&(l.value=ae,$.locale=ae,jc($,l.value,a.value))}),Ke(t.fallbackLocale,ae=>{r&&(a.value=ae,$.fallbackLocale=ae,jc($,l.value,a.value))}));const Ie={id:h_,locale:M,fallbackLocale:L,get inheritLocale(){return r},set inheritLocale(ae){r=ae,ae&&t&&(l.value=t.locale.value,a.value=t.fallbackLocale.value,jc($,l.value,a.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:S,get modifiers(){return A},get pluralRules(){return O||{}},get isGlobal(){return s},get missingWarn(){return p},set missingWarn(ae){p=ae,$.missingWarn=p},get fallbackWarn(){return h},set fallbackWarn(ae){h=ae,$.fallbackWarn=h},get fallbackRoot(){return f},set fallbackRoot(ae){f=ae},get fallbackFormat(){return m},set fallbackFormat(ae){m=ae,$.fallbackFormat=m},get warnHtmlMessage(){return v},set warnHtmlMessage(ae){v=ae,$.warnHtmlMessage=ae},get escapeParameter(){return y},set escapeParameter(ae){y=ae,$.escapeParameter=ae},t:X,getLocaleMessage:J,setLocaleMessage:ce,mergeLocaleMessage:te,getPostTranslationHandler:D,setPostTranslationHandler:W,getMissingHandler:z,setMissingHandler:q,[pA]:U};return Ie.datetimeFormats=I,Ie.numberFormats=P,Ie.rt=fe,Ie.te=G,Ie.tm=H,Ie.d=ye,Ie.n=Me,Ie.getDateTimeFormat=ue,Ie.setDateTimeFormat=j,Ie.mergeDateTimeFormat=Y,Ie.getNumberFormat=re,Ie.setNumberFormat=ge,Ie.mergeNumberFormat=Ae,Ie[hA]=n,Ie[Uv]=Fe,Ie[qv]=le,Ie[jv]=rt,Ie}function GN(e){const t=pt(e.locale)?e.locale:Ou,n=pt(e.fallbackLocale)||Yn(e.fallbackLocale)||jt(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:t,s=Pn(e.missing)?e.missing:void 0,o=Jt(e.silentTranslationWarn)||lc(e.silentTranslationWarn)?!e.silentTranslationWarn:!0,i=Jt(e.silentFallbackWarn)||lc(e.silentFallbackWarn)?!e.silentFallbackWarn:!0,r=Jt(e.fallbackRoot)?e.fallbackRoot:!0,l=!!e.formatFallbackMessages,a=jt(e.modifiers)?e.modifiers:{},c=e.pluralizationRules,u=Pn(e.postTranslation)?e.postTranslation:void 0,d=pt(e.warnHtmlInMessage)?e.warnHtmlInMessage!=="off":!0,p=!!e.escapeParameterHtml,h=Jt(e.sync)?e.sync:!0;let f=e.messages;if(jt(e.sharedMessages)){const A=e.sharedMessages;f=Object.keys(A).reduce(($,k)=>{const E=$[k]||($[k]={});return as(E,A[k]),$},f||{})}const{__i18n:m,__root:b,__injectWithOption:_}=e,g=e.datetimeFormats,v=e.numberFormats,y=e.flatJson;return{locale:t,fallbackLocale:n,messages:f,flatJson:y,datetimeFormats:g,numberFormats:v,missing:s,missingWarn:o,fallbackWarn:i,fallbackRoot:r,fallbackFormat:l,modifiers:a,pluralRules:c,postTranslation:u,warnHtmlMessage:d,escapeParameter:p,messageResolver:e.messageResolver,inheritLocale:h,__i18n:m,__root:b,__injectWithOption:_}}function Vv(e={}){const t=dp(GN(e)),{__extender:n}=e,s={id:t.id,get locale(){return t.locale.value},set locale(o){t.locale.value=o},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(o){t.fallbackLocale.value=o},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get missing(){return t.getMissingHandler()},set missing(o){t.setMissingHandler(o)},get silentTranslationWarn(){return Jt(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(o){t.missingWarn=Jt(o)?!o:o},get silentFallbackWarn(){return Jt(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(o){t.fallbackWarn=Jt(o)?!o:o},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(o){t.fallbackFormat=o},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(o){t.setPostTranslationHandler(o)},get sync(){return t.inheritLocale},set sync(o){t.inheritLocale=o},get warnHtmlInMessage(){return t.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){t.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(o){t.escapeParameter=o},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t(...o){return Reflect.apply(t.t,t,[...o])},rt(...o){return Reflect.apply(t.rt,t,[...o])},te(o,i){return t.te(o,i)},tm(o){return t.tm(o)},getLocaleMessage(o){return t.getLocaleMessage(o)},setLocaleMessage(o,i){t.setLocaleMessage(o,i)},mergeLocaleMessage(o,i){t.mergeLocaleMessage(o,i)},d(...o){return Reflect.apply(t.d,t,[...o])},getDateTimeFormat(o){return t.getDateTimeFormat(o)},setDateTimeFormat(o,i){t.setDateTimeFormat(o,i)},mergeDateTimeFormat(o,i){t.mergeDateTimeFormat(o,i)},n(...o){return Reflect.apply(t.n,t,[...o])},getNumberFormat(o){return t.getNumberFormat(o)},setNumberFormat(o,i){t.setNumberFormat(o,i)},mergeNumberFormat(o,i){t.mergeNumberFormat(o,i)}};return s.__extender=n,s}function YN(e,t,n){return{beforeCreate(){const s=Ru();if(!s)throw po(Qs.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const i=o.i18n;if(o.__i18n&&(i.__i18n=o.__i18n),i.__root=t,this===this.$root)this.$i18n=g_(e,i);else{i.__injectWithOption=!0,i.__extender=n.__vueI18nExtend,this.$i18n=Vv(i);const r=this.$i18n;r.__extender&&(r.__disposer=r.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=g_(e,o);else{this.$i18n=Vv({__i18n:o.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:t});const i=this.$i18n;i.__extender&&(i.__disposer=i.__extender(this.$i18n))}else this.$i18n=e;o.__i18nGlobal&&gA(t,o,o),this.$t=(...i)=>this.$i18n.t(...i),this.$rt=(...i)=>this.$i18n.rt(...i),this.$te=(i,r)=>this.$i18n.te(i,r),this.$d=(...i)=>this.$i18n.d(...i),this.$n=(...i)=>this.$i18n.n(...i),this.$tm=i=>this.$i18n.tm(i),n.__setInstance(s,this.$i18n)},mounted(){},unmounted(){const s=Ru();if(!s)throw po(Qs.UNEXPECTED_ERROR);const o=this.$i18n;delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),n.__deleteInstance(s),delete this.$i18n}}}function g_(e,t){e.locale=t.locale||e.locale,e.fallbackLocale=t.fallbackLocale||e.fallbackLocale,e.missing=t.missing||e.missing,e.silentTranslationWarn=t.silentTranslationWarn||e.silentFallbackWarn,e.silentFallbackWarn=t.silentFallbackWarn||e.silentFallbackWarn,e.formatFallbackMessages=t.formatFallbackMessages||e.formatFallbackMessages,e.postTranslation=t.postTranslation||e.postTranslation,e.warnHtmlInMessage=t.warnHtmlInMessage||e.warnHtmlInMessage,e.escapeParameterHtml=t.escapeParameterHtml||e.escapeParameterHtml,e.sync=t.sync||e.sync,e.__composer[pA](t.pluralizationRules||e.pluralizationRules);const n=k0(e.locale,{messages:t.messages,__i18n:t.__i18n});return Object.keys(n).forEach(s=>e.mergeLocaleMessage(s,n[s])),t.datetimeFormats&&Object.keys(t.datetimeFormats).forEach(s=>e.mergeDateTimeFormat(s,t.datetimeFormats[s])),t.numberFormats&&Object.keys(t.numberFormats).forEach(s=>e.mergeNumberFormat(s,t.numberFormats[s])),e}const b0={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>e==="parent"||e==="global",default:"parent"},i18n:{type:Object}};function XN({slots:e},t){return t.length===1&&t[0]==="default"?(e.default?e.default():[]).reduce((s,o)=>[...s,...o.type===Le?o.children:[o]],[]):t.reduce((n,s)=>{const o=e[s];return o&&(n[s]=o()),n},vn())}function vA(){return Le}const QN=je({name:"i18n-t",props:as({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>rs(e)||!isNaN(e)}},b0),setup(e,t){const{slots:n,attrs:s}=t,o=e.i18n||It({useScope:e.scope,__useComponent:!0});return()=>{const i=()=>{const a=Object.keys(n).filter(d=>d[0]!=="_"),c=vn();e.locale&&(c.locale=e.locale),e.plural!==void 0&&(c.plural=pt(e.plural)?+e.plural:e.plural);const u=XN(t,a);return o[Uv](e.keypath,u,c)},r=as(vn(),s),l=pt(e.tag)||en(e.tag)?e.tag:vA();return en(l)?cn(l,r,{default:i}):cn(l,r,i())}}}),v_=QN;function ZN(e){return Yn(e)&&!pt(e[0])}function yA(e,t,n,s){const{slots:o,attrs:i}=t;return()=>{const r=()=>{const c={part:!0};let u=vn();e.locale&&(c.locale=e.locale),pt(e.format)?c.key=e.format:en(e.format)&&(pt(e.format.key)&&(c.key=e.format.key),u=Object.keys(e.format).reduce((h,f)=>n.includes(f)?as(vn(),h,{[f]:e.format[f]}):h,vn()));const d=s(e.value,c,u);let p=[c.key];return Yn(d)?p=d.map((h,f)=>{const m=o[h.type],b=m?m({[h.type]:h.value,index:f,parts:d}):[h.value];return ZN(b)&&(b[0].key=`${h.type}-${f}`),b}):pt(d)&&(p=[d]),p},l=as(vn(),i),a=pt(e.tag)||en(e.tag)?e.tag:vA();return en(a)?cn(a,l,{default:r}):cn(a,l,r())}}const JN=je({name:"i18n-n",props:as({value:{type:Number,required:!0},format:{type:[String,Object]}},b0),setup(e,t){const n=e.i18n||It({useScope:e.scope,__useComponent:!0});return yA(e,t,uA,(...s)=>n[jv](...s))}}),y_=JN;function e5(e,t){const n=e;if(e.mode==="composition")return n.__getInstance(t)||e.global;{const s=n.__getInstance(t);return s!=null?s.__composer:e.global.__composer}}function t5(e){const t=r=>{const{instance:l,value:a}=r;if(!l||!l.$)throw po(Qs.UNEXPECTED_ERROR);const c=e5(e,l.$),u=k_(a);return[Reflect.apply(c.t,c,[...b_(u)]),c]};return{created:(r,l)=>{const[a,c]=t(l);cp&&(r.__i18nWatcher=Ke(c.locale,()=>{l.instance&&l.instance.$forceUpdate()})),r.__composer=c,r.textContent=a},unmounted:r=>{cp&&r.__i18nWatcher&&(r.__i18nWatcher(),r.__i18nWatcher=void 0,delete r.__i18nWatcher),r.__composer&&(r.__composer=void 0,delete r.__composer)},beforeUpdate:(r,{value:l})=>{if(r.__composer){const a=r.__composer,c=k_(l);r.textContent=Reflect.apply(a.t,a,[...b_(c)])}},getSSRProps:r=>{const[l]=t(r);return{textContent:l}}}}function k_(e){if(pt(e))return{path:e};if(jt(e)){if(!("path"in e))throw po(Qs.REQUIRED_VALUE,"path");return e}else throw po(Qs.INVALID_VALUE)}function b_(e){const{path:t,locale:n,args:s,choice:o,plural:i}=e,r={},l=s||{};return pt(n)&&(r.locale=n),rs(o)&&(r.plural=o),rs(i)&&(r.plural=i),[t,l,r]}function n5(e,t,...n){const s=jt(n[0])?n[0]:{};(Jt(s.globalInstall)?s.globalInstall:!0)&&([v_.name,"I18nT"].forEach(i=>e.component(i,v_)),[y_.name,"I18nN"].forEach(i=>e.component(i,y_)),[S_.name,"I18nD"].forEach(i=>e.component(i,S_))),e.directive("t",t5(t))}const s5=tl("global-vue-i18n");function o5(e={}){const t=__VUE_I18N_LEGACY_API__&&Jt(e.legacy)?e.legacy:__VUE_I18N_LEGACY_API__,n=Jt(e.globalInjection)?e.globalInjection:!0,s=new Map,[o,i]=i5(e,t),r=tl("");function l(d){return s.get(d)||null}function a(d,p){s.set(d,p)}function c(d){s.delete(d)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},async install(d,...p){if(d.__VUE_I18N_SYMBOL__=r,d.provide(d.__VUE_I18N_SYMBOL__,u),jt(p[0])){const m=p[0];u.__composerExtend=m.__composerExtend,u.__vueI18nExtend=m.__vueI18nExtend}let h=null;!t&&n&&(h=f5(d,u.global)),__VUE_I18N_FULL_INSTALL__&&n5(d,u,...p),__VUE_I18N_LEGACY_API__&&t&&d.mixin(YN(i,i.__composer,u));const f=d.unmount;d.unmount=()=>{h&&h(),u.dispose(),f()}},get global(){return i},dispose(){o.stop()},__instances:s,__getInstance:l,__setInstance:a,__deleteInstance:c};return u}function It(e={}){const t=Ru();if(t==null)throw po(Qs.MUST_BE_CALL_SETUP_TOP);if(!t.isCE&&t.appContext.app!=null&&!t.appContext.app.__VUE_I18N_SYMBOL__)throw po(Qs.NOT_INSTALLED);const n=r5(t),s=a5(n),o=mA(t),i=l5(e,o);if(i==="global")return gA(s,e,o),s;if(i==="parent"){let a=__(n,t,e.__useComponent);return a==null&&(a=s),a}if(i==="isolated"){if(n.mode!=="composition")throw po(Qs.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);const a=n,c=as({},e),u=__(n,t);c.__root=u||s;const d=dp(c);return a.__composerExtend&&(d[Ra]=a.__composerExtend(d)),V1()&&K1(()=>{const h=d[Ra];h&&(h(),delete d[Ra])}),d}const r=n;let l=r.__getInstance(t);if(l==null){const a=as({},e);"__i18n"in o&&(a.__i18n=o.__i18n),s&&(a.__root=s),l=dp(a),r.__composerExtend&&(l[Ra]=r.__composerExtend(l)),u5(r,t,l),r.__setInstance(t,l)}return l}function i5(e,t){const n=$E(),s=__VUE_I18N_LEGACY_API__&&t?n.run(()=>Vv(e)):n.run(()=>dp(e));if(s==null)throw po(Qs.UNEXPECTED_ERROR);return[n,s]}function r5(e){const t=Ut(e.isCE?s5:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw po(e.isCE?Qs.NOT_INSTALLED_WITH_PROVIDE:Qs.UNEXPECTED_ERROR);return t}function l5(e,t){return dh(e)?"__i18n"in t?"local":"global":e.useScope?e.useScope:"local"}function a5(e){return e.mode==="composition"?e.global:e.global.__composer}function __(e,t,n=!1){let s=null;const o=t.root;let i=c5(t,n);for(;i!=null;){const r=e;if(e.mode==="composition")s=r.__getInstance(i);else if(__VUE_I18N_LEGACY_API__){const l=r.__getInstance(i);l!=null&&(s=l.__composer,n&&s&&!s[hA]&&(s=null))}if(s!=null||o===i)break;i=i.parent}return s}function c5(e,t=!1){return e==null?null:t&&e.vnode.ctx||e.parent}function u5(e,t,n){hn(()=>{},t),kn(()=>{const s=n;e.__deleteInstance(t);const o=s[Ra];o&&(o(),delete s[Ra])},t)}const d5=["locale","fallbackLocale","availableLocales"],w_=["t","rt","d","n","tm","te"];function f5(e,t){const n=Object.create(null);return d5.forEach(o=>{const i=Object.getOwnPropertyDescriptor(t,o);if(!i)throw po(Qs.UNEXPECTED_ERROR);const r=es(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,o,r)}),e.config.globalProperties.$i18n=n,w_.forEach(o=>{const i=Object.getOwnPropertyDescriptor(t,o);if(!i||!i.value)throw po(Qs.UNEXPECTED_ERROR);Object.defineProperty(e.config.globalProperties,`$${o}`,i)}),()=>{delete e.config.globalProperties.$i18n,w_.forEach(o=>{delete e.config.globalProperties[`$${o}`]})}}const p5=je({name:"i18n-d",props:as({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},b0),setup(e,t){const n=e.i18n||It({useScope:e.scope,__useComponent:!0});return yA(e,t,cA,(...s)=>n[qv](...s))}}),S_=p5;jN();CN(iN);xN(_N);AN(Fv);if(__INTLIFY_PROD_DEVTOOLS__){const e=Pl();e.__INTLIFY__=!0,rN(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const h5="modulepreload",m5=function(e){return"/"+e},C_={},Xs=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let r=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");o=r(n.map(c=>{if(c=m5(c),c in C_)return;C_[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":h5,u||(p.as="script"),p.crossOrigin="",p.href=c,a&&p.setAttribute("nonce",a),document.head.appendChild(p),u)return new Promise((h,f)=>{p.addEventListener("load",h),p.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return o.then(r=>{for(const l of r||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Et={permission:"king-web.permission",activeWorkspace:"blun-active-workspace",thinking:"king-web.thinking",planMode:"king-web.plan-mode",swarmMode:"king-web.swarm-mode",goalMode:"king-web.goal-mode",uiFontSize:"king-web.ui-font-size",starredModels:"king-web.starred-models",unread:"king-web.unread",onboarded:"king-web.onboarded",accent:"king-web.accent",colorScheme:"king-web.color-scheme",hiddenWorkspaces:"king-web.hidden-workspaces",collapsedWorkspaces:"king-web.collapsed-workspaces",showWorkspacePaths:"king-web.show-workspace-paths",workspaceOrder:"king-web.workspace-order",workspaceNameOverrides:"king-web.workspace-name-overrides",workspaceSort:"king-web.workspace-sort",conversationToc:"king-web.beta-toc",notifyOnComplete:"king-web.notify-on-complete",notifyOnQuestion:"king-web.notify-on-question",soundOnComplete:"king-web.sound-on-complete",inputHistory:"king-web.input-history",locale:"blun-locale",clientId:"king-web.client-id",debug:"king-web.debug",openInLastTarget:"king-web.open-in.last-target",sidebarCollapsed:"king-web.sidebar-collapsed",sidebarWidth:"king-web.sidebar-width",codeFont:"king-web.code-font",contentAlign:"king-web.content-align",theme:"king-web.theme"};function x_(e){return`king-web.draft.${e&&e.length>0?e:"__new__"}`}function Qn(e){try{return globalThis.localStorage.getItem(e)}catch{return null}}function ts(e,t){try{globalThis.localStorage.setItem(e,t)}catch{}}function cc(e){try{globalThis.localStorage.removeItem(e)}catch{}}function od(e){const t=Qn(e);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}function yc(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}function _0(){const e=Qn(Et.unread);if(!e)return{};try{const t=JSON.parse(e);if(!t||typeof t!="object")return{};const n={};for(const[s,o]of Object.entries(t))o===!0&&(n[s]=!0);return n}catch{return{}}}function w0(e){const n={..._0()};for(const[s,o]of Object.entries(e))o?n[s]=!0:delete n[s];ts(Et.unread,JSON.stringify(n))}function g5(){const e=od(Et.collapsedWorkspaces);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function sg(e){yc(Et.collapsedWorkspaces,Array.from(e))}function v5(){return od(Et.showWorkspacePaths)===!0}function y5(e){yc(Et.showWorkspacePaths,e)}function k5(){const e=od(Et.workspaceOrder);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function kA(e){yc(Et.workspaceOrder,Array.from(e))}function Zd(){const e=od(Et.workspaceNameOverrides);if(!e||typeof e!="object")return{};const t={};for(const[n,s]of Object.entries(e))typeof s=="string"&&(t[n]=s);return t}function A_(e){yc(Et.workspaceNameOverrides,e)}function b5(){return Qn(Et.workspaceSort)}function bA(e){ts(Et.workspaceSort,e)}const T_=Et.clientId,_5="blun-web",w5="web";function S5(){return{serverHttpUrl:x5(),clientId:E5(),clientName:_5,clientVersion:I5(),clientUiMode:w5}}function C5(){return typeof window<"u"&&window.location?.origin?window.location.origin:"http://127.0.0.1:58627"}function x5(e){const t=C5(),n=new URL(t);return n.pathname=n.pathname.replace(/\/v1\/?$/,"").replace(/\/$/,""),n.search="",n.hash="",n.toString().replace(/\/$/,"")}function A5(e){return e.replace(/^https?:\/\//,"").replace(/\/$/,"")}function T5(){const e=typeof window<"u"&&window.location?.origin?window.location.origin:"";return A5(e)}function cu(e,t){return`${e}/api/v1${t.startsWith("/")?t:`/${t}`}`}function M5(e,t){const n=new URL(`${e}/api/v1/ws`);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.searchParams.set("client_id",t),n.toString()}function E5(){const e=Qn(T_);if(e)return e;const t=`web_${globalThis.crypto?.randomUUID?.()||Math.random().toString(36).slice(2)}`;return ts(T_,t),t}function I5(){return"0.1.2".trim()?"0.1.2":"0.0.0-dev"}async function zs(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return $5(e)}function $5(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}function N5(e,t){if(e.length===0)return null;const n=new Set(e),s=t.filter(i=>n.has(i)),o=e.filter(i=>!t.includes(i));return o.length===0&&s.length===t.length?null:[...o,...s]}function L5(e,t){const n=new Map(t.map((s,o)=>[s,o]));return e.toSorted((s,o)=>(n.get(s.id)??-1)-(n.get(o.id)??-1))}function O5(e,t,n,s="before"){const o=e.indexOf(t),i=e.indexOf(n);if(o===-1||i===-1||o===i)return e;const r=[...e];r.splice(o,1);const l=o<i?i-1:i,a=s==="before"?l:l+1;return r.splice(a,0,t),r}function P5(e,t){return e.toSorted((n,s)=>(t.get(s.id)??Number.NEGATIVE_INFINITY)-(t.get(n.id)??Number.NEGATIVE_INFINITY))}const R5={"&":"&","<":"<",">":">",'"':""","'":"'"};function M_(e){return e.replace(/[&<>"']/g,t=>R5[t]??t)}function D5(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B5(e,t,n=40){const s=e.replace(/\s+/g," ").trim();if(s.length===0)return"";const o=t.trim();if(o.length===0)return E_(s,n*2);const i=s.toLowerCase().indexOf(o.toLowerCase());if(i<0)return E_(s,n*2);const r=Math.max(0,i-n),l=Math.min(s.length,i+o.length+n),a=r>0,c=l<s.length;return`${a?"…":""}${s.slice(r,l)}${c?"…":""}`}function E_(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function og(e,t){const n=M_(e),s=t.trim();if(s.length===0)return n;const o=new RegExp(D5(M_(s)),"gi");return n.replace(o,i=>`<mark>${i}</mark>`)}const Ea=Z(0),F5=["type","disabled","aria-label"],H5=je({__name:"IconButton",props:{size:{default:"md"},disabled:{type:Boolean},label:{},type:{default:"button"}},setup(e,{expose:t}){const n=Z();return t({el:n}),(s,o)=>(w(),N("button",{ref_key:"el",ref:n,class:Re(["ui-icon-button",`ui-icon-button--${e.size}`]),type:e.type,disabled:e.disabled,"aria-label":e.label},[Cn(s.$slots,"default",{},void 0,!0)],10,F5))}}),ut=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},gn=ut(H5,[["__scopeId","data-v-7f663277"]]),W5=Object.freeze({left:0,top:0,width:16,height:16}),_A=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),wA=Object.freeze({...W5,..._A}),she=Object.freeze({...wA,body:"",hidden:!1}),z5=Object.freeze({width:null,height:null}),U5=Object.freeze({...z5,..._A}),q5=/(-?[0-9.]*[0-9]+[0-9.]*)/g,j5=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function I_(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const s=e.split(q5);if(s===null||!s.length)return e;const o=[];let i=s.shift(),r=j5.test(i);for(;;){if(r){const l=parseFloat(i);isNaN(l)?o.push(i):o.push(Math.ceil(l*t*n)/n)}else o.push(i);if(i=s.shift(),i===void 0)return o.join("");r=!r}}function V5(e,t="defs"){let n="";const s=e.indexOf("<"+t);for(;s>=0;){const o=e.indexOf(">",s),i=e.indexOf("</"+t);if(o===-1||i===-1)break;const r=e.indexOf(">",i);if(r===-1)break;n+=e.slice(o+1,i).trim(),e=e.slice(0,s).trim()+e.slice(r+1)}return{defs:n,content:e}}function K5(e,t){return e?"<defs>"+e+"</defs>"+t:t}function G5(e,t,n){const s=V5(e);return K5(s.defs,t+s.content+n)}const Y5=e=>e==="unset"||e==="undefined"||e==="none";function X5(e,t){const n={...wA,...e},s={...U5,...t},o={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,s].forEach(m=>{const b=[],_=m.hFlip,g=m.vFlip;let v=m.rotate;_?g?v+=2:(b.push("translate("+(o.width+o.left).toString()+" "+(0-o.top).toString()+")"),b.push("scale(-1 1)"),o.top=o.left=0):g&&(b.push("translate("+(0-o.left).toString()+" "+(o.height+o.top).toString()+")"),b.push("scale(1 -1)"),o.top=o.left=0);let y;switch(v<0&&(v-=Math.floor(v/4)*4),v=v%4,v){case 1:y=o.height/2+o.top,b.unshift("rotate(90 "+y.toString()+" "+y.toString()+")");break;case 2:b.unshift("rotate(180 "+(o.width/2+o.left).toString()+" "+(o.height/2+o.top).toString()+")");break;case 3:y=o.width/2+o.left,b.unshift("rotate(-90 "+y.toString()+" "+y.toString()+")");break}v%2===1&&(o.left!==o.top&&(y=o.left,o.left=o.top,o.top=y),o.width!==o.height&&(y=o.width,o.width=o.height,o.height=y)),b.length&&(i=G5(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const r=s.width,l=s.height,a=o.width,c=o.height;let u,d;r===null?(d=l===null?"1em":l==="auto"?c:l,u=I_(d,a/c)):(u=r==="auto"?a:r,d=l===null?I_(u,c/a):l==="auto"?c:l);const p={},h=(m,b)=>{Y5(b)||(p[m]=b.toString())};h("width",u),h("height",d);const f=[o.left,o.top,a,c];return p.viewBox=f.join(" "),{attributes:p,viewBox:f,body:i}}const SA={plus:{body:'<path fill="currentColor" d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/>',width:24,height:24},"chat-new":{body:'<path fill="currentColor" d="M14 3v2H4v13.385L5.763 17H20v-7h2v8a1 1 0 0 1-1 1H6.455L2 22.5V4a1 1 0 0 1 1-1zm5 0V0h2v3h3v2h-3v3h-2V5h-3V3z"/>',width:24,height:24},close:{body:'<path fill="currentColor" d="m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z"/>',width:24,height:24},check:{body:'<path fill="currentColor" d="m10 15.17l9.192-9.191l1.414 1.414L10 17.999l-6.364-6.364l1.414-1.414z"/>',width:24,height:24},search:{body:'<path fill="currentColor" d="m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975z"/>',width:24,height:24},copy:{body:'<path fill="currentColor" d="M7 6V3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-3v3c0 .552-.45 1-1.007 1H4.007A1 1 0 0 1 3 21l.003-14c0-.552.45-1 1.006-1zM5.002 8L5 20h10V8zM9 6h8v10h2V4H9z"/>',width:24,height:24},link:{body:'<path fill="currentColor" d="m13.06 8.111l1.415 1.414a7 7 0 0 1 0 9.9l-.354.353a7 7 0 1 1-9.9-9.9l1.415 1.415a5 5 0 1 0 7.071 7.071l.354-.354a5 5 0 0 0 0-7.07l-1.415-1.415zm6.718 6.01l-1.414-1.414a5 5 0 0 0-7.071-7.07l-.354.353a5 5 0 0 0 0 7.07l1.415 1.415l-1.415 1.414l-1.414-1.414a7 7 0 0 1 0-9.9l.354-.353a7 7 0 1 1 9.9 9.9"/>',width:24,height:24},"external-link":{body:'<path fill="currentColor" d="M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"/>',width:24,height:24},download:{body:'<path fill="currentColor" d="M3 19h18v2H3zm10-5.828L19.071 7.1l1.414 1.414L12 17L3.515 8.515L4.929 7.1L11 13.173V2h2z"/>',width:24,height:24},undo:{body:'<path fill="currentColor" d="m5.828 7l2.536 2.535L6.95 10.95L2 6l4.95-4.95l1.414 1.415L5.828 5H13a8 8 0 1 1 0 16H4v-2h9a6 6 0 0 0 0-12z"/>',width:24,height:24},send:{body:'<path fill="currentColor" d="M13 7.828V20h-2V7.828l-5.364 5.364l-1.414-1.414L12 4l7.778 7.778l-1.414 1.414z"/>',width:24,height:24},image:{body:'<path fill="currentColor" d="M2.992 21A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993zM20 15V5H4v14L14 9zm0 2.828l-6-6L6.828 19H20zM8 11a2 2 0 1 1 0-4a2 2 0 0 1 0 4"/>',width:24,height:24},settings:{body:'<path fill="currentColor" d="M3.34 17a10 10 0 0 1-.979-2.326a3 3 0 0 0 .003-5.347a10 10 0 0 1 2.5-4.337a3 3 0 0 0 4.632-2.674a10 10 0 0 1 5.007.003a3 3 0 0 0 4.632 2.671a10.06 10.06 0 0 1 2.503 4.336a3 3 0 0 0-.002 5.347a10 10 0 0 1-2.501 4.337a3 3 0 0 0-4.632 2.674a10 10 0 0 1-5.007-.002a3 3 0 0 0-4.631-2.672A10 10 0 0 1 3.339 17m5.66.196a5 5 0 0 1 2.25 2.77q.75.07 1.499.002a5 5 0 0 1 2.25-2.772a5 5 0 0 1 3.526-.564q.435-.614.748-1.298A5 5 0 0 1 18 12c0-1.26.47-2.437 1.273-3.334a8 8 0 0 0-.75-1.298A5 5 0 0 1 15 6.804a5 5 0 0 1-2.25-2.77q-.75-.071-1.5-.001A5 5 0 0 1 9 6.804a5 5 0 0 1-3.526.564q-.436.614-.747 1.298A5 5 0 0 1 6 12c0 1.26-.471 2.437-1.273 3.334a8 8 0 0 0 .75 1.298A5 5 0 0 1 9 17.196M12 15a3 3 0 1 1 0-6a3 3 0 0 1 0 6m0-2a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/>',width:24,height:24},sliders:{body:'<path fill="currentColor" d="M6.17 18a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2v-2zm6-7a3.001 3.001 0 0 1 5.66 0H22v2h-4.17a3.001 3.001 0 0 1-5.66 0H2v-2zm-6-7a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2V4zM9 6a1 1 0 1 0 0-2a1 1 0 0 0 0 2m6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/>',width:24,height:24},"log-in":{body:'<path fill="currentColor" d="M4 15h2v5h12V4H6v5H4V3a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm6-4V8l5 4l-5 4v-3H2v-2z"/>',width:24,height:24},"chevron-down":{body:'<path fill="currentColor" d="m12 13.171l4.95-4.95l1.414 1.415L12 16L5.636 9.636L7.05 8.222z"/>',width:24,height:24},"chevron-right":{body:'<path fill="currentColor" d="m13.172 12l-4.95-4.95l1.414-1.413L16 12l-6.364 6.364l-1.414-1.415z"/>',width:24,height:24},"arrow-up":{body:'<path fill="currentColor" d="M13 7.828V20h-2V7.828l-5.364 5.364l-1.414-1.414L12 4l7.778 7.778l-1.414 1.414z"/>',width:24,height:24},"arrow-down":{body:'<path fill="currentColor" d="m13 16.172l5.364-5.364l1.414 1.414L12 20l-7.778-7.778l1.414-1.414L11 16.172V4h2z"/>',width:24,height:24},"arrow-right":{body:'<path fill="currentColor" d="m16.172 11l-5.364-5.364l1.414-1.414L20 12l-7.778 7.778l-1.414-1.414L16.172 13H4v-2z"/>',width:24,height:24},minus:{body:'<path fill="currentColor" d="M5 11v2h14v-2z"/>',width:24,height:24},"panel-collapse":{body:'<path fill="currentColor" d="m15.071 4.929l1.414 1.414L11.83 11H21v2h-9.17l4.656 4.657l-1.414 1.414L8.001 12zm-11.07 14.07V5h2v14z"/>',width:24,height:24},"panel-expand":{body:'<path fill="currentColor" d="m17.172 11l-4.657-4.657l1.414-1.414L21 12l-7.071 7.071l-1.414-1.414L17.172 13H8v-2zM4 19V5h2v14z"/>',width:24,height:24},expand:{body:'<path fill="currentColor" d="M17.586 5H14V3h7v7h-2V6.414l-4.293 4.293l-1.414-1.414zM3 14h2v3.586l4.293-4.293l1.414 1.414L6.414 19H10v2H3z"/>',width:24,height:24},collapse:{body:'<path fill="currentColor" d="M15 4h-2v7h7V9h-3.586l4.293-4.293l-1.414-1.414L15 7.586zM4 15h3.586l-4.293 4.293l1.414 1.414L9 16.414V20h2v-7H4z"/>',width:24,height:24},list:{body:'<path fill="currentColor" d="M8 4h13v2H8zM4.5 6.5a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 7a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 6.9a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3M8 11h13v2H8zm0 7h13v2H8z"/>',width:24,height:24},sort:{body:'<path fill="currentColor" d="M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"/>',width:24,height:24},grip:{body:'<path fill="currentColor" d="M8.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m0 6.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0M15.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"/>',width:24,height:24},folder:{body:'<path fill="currentColor" d="M3 21a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414l2 2H20a1 1 0 0 1 1 1v3h-2V7h-7.414l-2-2H4v11.998L5.5 11h17l-2.31 9.243a1 1 0 0 1-.97.757zm16.938-8H7.062l-1.5 6h12.876z"/>',width:24,height:24},"folder-closed":{body:'<path fill="currentColor" d="M4 5v14h16V7h-8.414l-2-2zm8.414 0H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"/>',width:24,height:24},"folder-plus":{body:'<path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414zM4 5v14h16V7h-8.414l-2-2zm7 7V9h2v3h3v2h-3v3h-2v-3H8v-2z"/>',width:24,height:24},"folder-solid":{body:'<path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"/>',width:24,height:24},file:{body:'<path fill="currentColor" d="M9 2.003V2h10.998C20.55 2 21 2.455 21 2.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8zM5.83 8H9V4.83zM11 4v5a1 1 0 0 1-1 1H5v10h14V4z"/>',width:24,height:24},"file-text":{body:'<path fill="currentColor" d="M21 8v12.993A1 1 0 0 1 20.007 22H3.993A.993.993 0 0 1 3 21.008V2.992C3 2.455 3.449 2 4.002 2h10.995zm-2 1h-5V4H5v16h14zM8 7h3v2H8zm0 4h8v2H8zm0 4h8v2H8z"/>',width:24,height:24},"file-plus":{body:'<path fill="currentColor" d="M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"/>',width:24,height:24},"file-off":{body:'<path fill="currentColor" d="M9 2.003V2h10.998C20.55 2 21 2.455 21 2.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8zM5.83 8H9V4.83zM11 4v5a1 1 0 0 1-1 1H5v10h14V4z"/>',width:24,height:24},"image-off":{body:'<path fill="currentColor" d="M2.992 21A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993zM20 15V5H4v14L14 9zm0 2.828l-6-6L6.828 19H20zM8 11a2 2 0 1 1 0-4a2 2 0 0 1 0 4"/>',width:24,height:24},code:{body:'<path fill="currentColor" d="m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"/>',width:24,height:24},terminal:{body:'<path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m1 2v14h16V5zm8 10h6v2h-6zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243l-1.415-1.415z"/>',width:24,height:24},pencil:{body:'<path fill="currentColor" d="m15.728 9.576l-1.414-1.414L5 17.476v1.414h1.414zm1.414-1.414l1.414-1.414l-1.414-1.414l-1.414 1.414zm-9.9 12.728H3v-4.243L16.435 3.212a1 1 0 0 1 1.414 0l2.829 2.829a1 1 0 0 1 0 1.414z"/>',width:24,height:24},glob:{body:'<path fill="currentColor" d="M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"/>',width:24,height:24},globe:{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.01 8.01 0 0 0 5.648 6.667M10.03 13c.151 2.439.848 4.73 1.97 6.752A15.9 15.9 0 0 0 13.97 13zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.01 8.01 0 0 0 19.938 13M4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333A8.01 8.01 0 0 0 4.062 11m5.969 0h3.938A15.9 15.9 0 0 0 12 4.248A15.9 15.9 0 0 0 10.03 11m4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.01 8.01 0 0 0-5.648-6.667"/>',width:24,height:24},"check-list":{body:'<path fill="currentColor" d="M8 4h13v2H8zm-5-.5h3v3H3zm0 7h3v3H3zm0 7h3v3H3zM8 11h13v2H8zm0 7h13v2H8z"/>',width:24,height:24},bolt:{body:'<path fill="currentColor" d="M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"/>',width:24,height:24},"git-pull-request":{body:'<path fill="currentColor" d="M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/>',width:24,height:24},message:{body:'<path fill="currentColor" d="M6.455 19L2 22.5V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1zm-.692-2H20V5H4v13.385zM8 10h8v2H8z"/>',width:24,height:24},mail:{body:'<path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m17 4.238l-7.928 7.1L4 7.216V19h16zM4.511 5l7.55 6.662L19.502 5z"/>',width:24,height:24},user:{body:'<path fill="currentColor" d="M4 22a8 8 0 1 1 16 0h-2a6 6 0 0 0-12 0zm8-9c-3.315 0-6-2.685-6-6s2.685-6 6-6s6 2.685 6 6s-2.685 6-6 6m0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4s-4 1.79-4 4s1.79 4 4 4"/>',width:24,height:24},info:{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16M11 7h2v2h-2zm0 4h2v6h-2z"/>',width:24,height:24},"help-circle":{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-1-5h2v2h-2zm2-1.645V14h-2v-1.5a1 1 0 0 1 1-1a1.5 1.5 0 1 0-1.471-1.794l-1.962-.393A3.501 3.501 0 1 1 13 13.355"/>',width:24,height:24},"alert-triangle":{body:'<path fill="currentColor" d="m12.866 3l9.526 16.5a1 1 0 0 1-.866 1.5H2.474a1 1 0 0 1-.866-1.5L11.134 3a1 1 0 0 1 1.732 0m-8.66 16h15.588L12 5.5zM11 16h2v2h-2zm0-7h2v5h-2z"/>',width:24,height:24},clock:{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m1-8h4v2h-6V7h2z"/>',width:24,height:24},sparkles:{body:'<path fill="currentColor" d="M14 4.438A2.437 2.437 0 0 0 16.438 2h1.125A2.437 2.437 0 0 0 20 4.438v1.125A2.437 2.437 0 0 0 17.563 8h-1.125A2.437 2.437 0 0 0 14 5.563zM1 11a6 6 0 0 0 6-6h2a6 6 0 0 0 6 6v2a6 6 0 0 0-6 6H7a6 6 0 0 0-6-6zm3.876 1A8.04 8.04 0 0 1 8 15.124A8.04 8.04 0 0 1 11.124 12A8.04 8.04 0 0 1 8 8.876A8.04 8.04 0 0 1 4.876 12m12.374 2A3.25 3.25 0 0 1 14 17.25v1.5A3.25 3.25 0 0 1 17.25 22h1.5A3.25 3.25 0 0 1 22 18.75v-1.5A3.25 3.25 0 0 1 18.75 14z"/>',width:24,height:24},play:{body:'<path fill="currentColor" d="M19.376 12.416L8.777 19.482A.5.5 0 0 1 8 19.066V4.934a.5.5 0 0 1 .777-.416l10.599 7.066a.5.5 0 0 1 0 .832"/>',width:24,height:24},stop:{body:'<path fill="currentColor" d="M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1"/>',width:24,height:24},star:{body:'<path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"/>',width:24,height:24},"star-outline":{body:'<path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"/>',width:24,height:24},"dots-horizontal":{body:'<path fill="currentColor" d="M4.5 10.5c-.825 0-1.5.675-1.5 1.5s.675 1.5 1.5 1.5S6 12.825 6 12s-.675-1.5-1.5-1.5m15 0c-.825 0-1.5.675-1.5 1.5s.675 1.5 1.5 1.5S21 12.825 21 12s-.675-1.5-1.5-1.5m-7.5 0c-.825 0-1.5.675-1.5 1.5s.675 1.5 1.5 1.5s1.5-.675 1.5-1.5s-.675-1.5-1.5-1.5"/>',width:24,height:24}},CA={sm:14,md:16,lg:20};function Q5(e){return`0 0 ${e.width??24} ${e.height??24}`}const Z5=Object.fromEntries(Object.entries(SA).map(([e,t])=>[e,{body:t.body,viewBox:Q5(t),fill:!0}]));function J5(e){return Z5[e]}function Ia(e,t="md"){const n=CA[t],s=X5(SA[e],{width:n,height:n}),o=s.attributes.viewBox;return`<svg class="kw-icon" width="${n}" height="${n}" viewBox="${o}" fill="currentColor" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">${s.body}</svg>`}const eL=["width","height","viewBox","aria-label","aria-hidden","innerHTML"],tL=["width","height","viewBox","aria-label","aria-hidden","innerHTML"],Je=je({__name:"Icon",props:{name:{},size:{default:"md"},label:{}},setup(e){const t=e,n=F(()=>J5(t.name)),s=F(()=>CA[t.size]),o=F(()=>n.value.viewBox??"0 0 16 16");return(i,r)=>n.value.fill?(w(),N("svg",{key:0,class:"kw-icon",width:s.value,height:s.value,viewBox:o.value,fill:"currentColor","aria-label":e.label,"aria-hidden":e.label?void 0:!0,xmlns:"http://www.w3.org/2000/svg",innerHTML:n.value.body},null,8,eL)):(w(),N("svg",{key:1,class:"kw-icon",width:s.value,height:s.value,viewBox:o.value,fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-label":e.label,"aria-hidden":e.label?void 0:!0,xmlns:"http://www.w3.org/2000/svg",innerHTML:n.value.body},null,8,tL))}}),nL={key:0,class:"ui-dialog__head"},sL={class:"ui-dialog__titles"},oL={key:0,class:"ui-dialog__title"},iL={key:1,class:"ui-dialog__desc"},rL={class:"ui-dialog__body"},lL={key:1,class:"ui-dialog__foot"},aL='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',cL=je({__name:"Dialog",props:{open:{type:Boolean},title:{},description:{},closeOnOverlay:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},size:{default:"md"},height:{default:"auto"},padded:{type:Boolean,default:!0}},emits:["update:open","close"],setup(e,{emit:t}){const n=e,s=t,o=Z(null);let i=null;function r(){s("update:open",!1),s("close")}function l(){return o.value?Array.from(o.value.querySelectorAll(aL)):[]}function a(u){if(!n.open)return;if(u.key==="Escape"&&n.closeOnEsc){u.preventDefault(),r();return}if(u.key!=="Tab")return;const d=l(),p=d[0],h=d[d.length-1];if(!p||!h){u.preventDefault(),o.value?.focus();return}const f=document.activeElement;u.shiftKey&&f===p?(u.preventDefault(),h.focus()):!u.shiftKey&&f===h&&(u.preventDefault(),p.focus())}function c(u){n.closeOnOverlay&&u.target===u.currentTarget&&r()}return Ke(()=>n.open,async u=>{u?(Ea.value+=1,i=document.activeElement,await ht(),(l()[0]??o.value)?.focus()):(Ea.value=Math.max(0,Ea.value-1),i instanceof HTMLElement&&(i.focus(),i=null))},{immediate:!0}),typeof window<"u"&&window.addEventListener("keydown",a),ls(()=>{typeof window<"u"&&window.removeEventListener("keydown",a),n.open&&(Ea.value=Math.max(0,Ea.value-1))}),(u,d)=>(w(),ve(lh,{to:"body"},[e.open?(w(),N("div",{key:0,class:"ui-dialog__overlay",onMousedown:c},[T("div",{ref_key:"panel",ref:o,class:Re(["ui-dialog",[`ui-dialog--${e.size}`,{"ui-dialog--flush":!e.padded,"ui-dialog--fixed-height":e.height==="fixed"}]]),role:"dialog","aria-modal":"true",tabindex:"-1"},[e.title||u.$slots.head?(w(),N("div",nL,[Cn(u.$slots,"head",{},()=>[T("div",sL,[e.title?(w(),N("div",oL,R(e.title),1)):ie("",!0),e.description?(w(),N("div",iL,R(e.description),1)):ie("",!0)])],!0),oe(gn,{class:"ui-dialog__close",size:"sm",label:"Close",onClick:r},{default:_e(()=>[oe(Je,{name:"close",size:"md"})]),_:1})])):ie("",!0),T("div",rL,[Cn(u.$slots,"default",{},void 0,!0)]),u.$slots.foot?(w(),N("div",lL,[Cn(u.$slots,"foot",{},void 0,!0)])):ie("",!0)],2)],32)):ie("",!0)]))}}),ar=ut(cL,[["__scopeId","data-v-ff901247"]]),uL={class:"sd-head"},dL=["placeholder","aria-label"],fL=["aria-selected","onClick","onMousemove"],pL={class:"sd-meta"},hL=["innerHTML"],mL={class:"sd-time"},gL=["innerHTML"],vL=["innerHTML"],yL={key:1,class:"sd-empty"},kL={class:"sd-hint"},bL=200,_L=je({__name:"SearchSessionsDialog",props:{sessions:{},activeId:{}},emits:["select","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z(!0),r=Z(""),l=Z(null),a=Z(null),c=F(()=>{const _=r.value.trim().toLowerCase(),g=[];for(const v of s.sessions){const y=v.title??"",A=v.lastPrompt??"",O=v.workspaceName??"",$=_.length>0&&y.toLowerCase().includes(_),k=_.length>0&&A.toLowerCase().includes(_),E=_.length>0&&O.toLowerCase().includes(_);if(!(_.length>0&&!$&&!k&&!E)&&(g.push({session:v,inTitle:$,inWorkspace:E,snippetText:A?B5(A,r.value):""}),g.length>=bL))break}return g}),u=Z(0);Ke(r,()=>{u.value=0});function d(_){const g=c.value.length;return g===0?0:Math.max(0,Math.min(g-1,_))}async function p(){await ht(),a.value?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}function h(_){u.value=d(u.value+_),p()}function f(_){o("select",_),o("close")}function m(){const _=c.value[u.value];_&&f(_.session.id)}function b(_){_.key==="ArrowDown"?(_.preventDefault(),h(1)):_.key==="ArrowUp"?(_.preventDefault(),h(-1)):_.key==="Enter"&&(_.preventDefault(),m())}return hn(()=>{l.value?.focus()}),(_,g)=>(w(),ve(ar,{open:i.value,"onUpdate:open":g[1]||(g[1]=v=>i.value=v),size:"lg",height:"fixed",padded:!1,onClose:g[2]||(g[2]=v=>o("close"))},{head:_e(()=>[T("div",uL,[oe(Je,{class:"sd-search-icon",name:"search",size:"md"}),Mn(T("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":g[0]||(g[0]=v=>r.value=v),class:"sd-input",type:"text",placeholder:x(n)("sidebar.searchPlaceholder"),"aria-label":x(n)("sidebar.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:b},null,40,dL),[[ko,r.value]])])]),foot:_e(()=>[T("span",kL,R(x(n)("sidebar.searchHint")),1)]),default:_e(()=>[T("div",{ref_key:"listRef",ref:a,class:"sd-list",role:"listbox"},[c.value.length>0?(w(!0),N(Le,{key:0},nt(c.value,(v,y)=>(w(),N("button",{key:v.session.id,class:Re(["sd-row",{on:y===u.value,active:v.session.id===e.activeId}]),role:"option","aria-selected":y===u.value,onClick:A=>f(v.session.id),onMousemove:A=>u.value=y},[T("span",pL,[oe(Je,{class:"sd-folder",name:"folder-closed",size:"sm"}),T("span",{class:"sd-ws",innerHTML:x(og)(v.session.workspaceName??v.session.workspaceId??"",v.inWorkspace?r.value:"")},null,8,hL),T("span",mL,R(v.session.time),1)]),T("span",{class:"sd-title",innerHTML:x(og)(v.session.title,v.inTitle?r.value:"")},null,8,gL),v.snippetText?(w(),N("span",{key:0,class:"sd-snippet",innerHTML:x(og)(v.snippetText,r.value)},null,8,vL)):ie("",!0)],42,fL))),128)):(w(),N("div",yL,R(x(n)("sidebar.searchNoResults")),1))],512)]),_:1},8,["open"]))}}),wL=ut(_L,[["__scopeId","data-v-3d40bf5d"]]),SL=["aria-label"],CL=je({__name:"Spinner",props:{size:{default:"md"},label:{default:"Loading"}},setup(e){return(t,n)=>(w(),N("span",{class:Re(["ui-spinner",`ui-spinner--${e.size}`]),role:"status","aria-label":e.label},[...n[0]||(n[0]=[T("svg",{class:"ui-spinner__svg",viewBox:"0 0 24 24","aria-hidden":"true"},[T("circle",{class:"ui-spinner__track",cx:"12",cy:"12",r:"9"}),T("circle",{class:"ui-spinner__arc",cx:"12",cy:"12",r:"9"})],-1)])],10,SL))}}),ni=ut(CL,[["__scopeId","data-v-5ec07fd2"]]),xL={key:0,class:"ui-badge__dot","aria-hidden":"true"},AL=je({__name:"Badge",props:{variant:{default:"neutral"},size:{default:"md"},dot:{type:Boolean}},setup(e){return(t,n)=>(w(),N("span",{class:Re(["ui-badge",[`ui-badge--${e.variant}`,`ui-badge--${e.size}`]])},[e.dot?(w(),N("span",xL)):ie("",!0),Cn(t.$slots,"default",{},void 0,!0)],2))}}),Is=ut(AL,[["__scopeId","data-v-13972d72"]]),Du=Z(null);function xA(e){const t=Du.value;t&&(Du.value=null,t.resolve(e))}function TL(e){return Du.value&&xA(!1),new Promise(t=>{Du.value={...e,resolve:t}})}function ol(){return{current:Du,confirm:TL,settle:xA}}const ML=je({__name:"Menu",setup(e,{expose:t}){const n=Z();return t({el:n}),(s,o)=>(w(),N("div",{ref_key:"el",ref:n,class:"ui-menu",role:"menu"},[Cn(s.$slots,"default",{},void 0,!0)],512))}}),Wl=ut(ML,[["__scopeId","data-v-3197b239"]]),EL={key:0,class:"ui-menu-sep",role:"separator"},IL=["disabled"],$L=je({__name:"MenuItem",props:{active:{type:Boolean},danger:{type:Boolean},disabled:{type:Boolean},separator:{type:Boolean},size:{default:"md"}},emits:["click"],setup(e){return(t,n)=>e.separator?(w(),N("div",EL)):(w(),N("button",{key:1,class:Re(["ui-menu-item",[`ui-menu-item--${e.size}`,{"is-active":e.active,"is-danger":e.danger}]]),type:"button",role:"menuitem",disabled:e.disabled,onClick:n[0]||(n[0]=s=>t.$emit("click",s))},[Cn(t.$slots,"default",{},void 0,!0)],10,IL))}}),fn=ut($L,[["__scopeId","data-v-55ca4d76"]]),kr=6,br=8,NL=150,LL=je({__name:"Tooltip",props:{text:{},placement:{default:"top"},maxWidth:{default:280},maxLines:{default:6}},setup(e){const t=e,n=Z(),s=Z(),o=Z(!1),i=Z(!1),r=Z({maxWidth:`${t.maxWidth}px`});let l,a=null,c;function u(){const m=s.value;if(!a||!m)return;const b=a.getBoundingClientRect(),_=m.offsetWidth,g=m.offsetHeight,v=window.innerWidth,y=window.innerHeight;let A=t.placement;A==="top"&&b.top-kr-g<br?A="bottom":A==="bottom"&&b.bottom+kr+g>y-br?A="top":A==="left"&&b.left-kr-_<br?A="right":A==="right"&&b.right+kr+_>v-br&&(A="left");let O=0,$=0;A==="top"?(O=b.top-kr-g,$=b.left+b.width/2-_/2):A==="bottom"?(O=b.bottom+kr,$=b.left+b.width/2-_/2):A==="left"?(O=b.top+b.height/2-g/2,$=b.left-kr-_):(O=b.top+b.height/2-g/2,$=b.right+kr),$=Math.min(Math.max($,br),v-br-_),O=Math.min(Math.max(O,br),y-br-g),r.value={maxWidth:`${t.maxWidth}px`,top:`${Math.round(O)}px`,left:`${Math.round($)}px`}}function d(){t.text&&(window.clearTimeout(l),l=window.setTimeout(()=>{o.value=!0,i.value=!1,ht(()=>{u(),i.value=!0})},NL))}function p(){window.clearTimeout(l),o.value=!1,i.value=!1}function h(){o.value&&p()}function f(m){m!==a&&(a&&(a.removeEventListener("mouseenter",d),a.removeEventListener("mouseleave",p),a.removeEventListener("focusin",d),a.removeEventListener("focusout",p)),a=m,a&&(a.addEventListener("mouseenter",d),a.addEventListener("mouseleave",p),a.addEventListener("focusin",d),a.addEventListener("focusout",p)))}return hn(()=>{const m=n.value??null;f(m?.firstElementChild??m),m&&(c=new MutationObserver(()=>{const b=m.firstElementChild??null;b!==a&&(p(),f(b??m))}),c.observe(m,{childList:!0})),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h)}),ls(()=>{window.clearTimeout(l),c?.disconnect(),f(null),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}),(m,b)=>(w(),N(Le,null,[T("span",{ref_key:"trigger",ref:n,class:"ui-tip"},[Cn(m.$slots,"default",{},void 0,!0)],512),(w(),ve(lh,{to:"body"},[Mn(T("div",{ref_key:"bubble",ref:s,class:Re(["ui-tip__bubble",{positioned:i.value}]),style:Gt([r.value,{"--tip-lines":e.maxLines}]),role:"tooltip"},R(e.text),7),[[Qo,o.value]])]))],64))}}),Ht=ut(LL,[["__scopeId","data-v-f28510a8"]]),OL={class:"row"},PL={class:"lead","aria-hidden":"true"},RL={key:1,class:"unread-dot"},DL={class:"left"},BL=["onKeydown"],FL={class:"act"},HL={class:"ts"},WL={class:"menu-time"},zL=je({__name:"SessionRow",props:{session:{},active:{type:Boolean},approvalCount:{default:0},questionCount:{default:0},unread:{type:Boolean,default:!1}},emits:["select","rename","archive","fork"],setup(e,{expose:t,emit:n}){const{t:s}=It(),{confirm:o}=ol(),i=e,r=n;function l(S){const I=new Date(S);if(Number.isNaN(I.getTime()))return S;const P=D=>String(D).padStart(2,"0");return`${I.getFullYear()}-${P(I.getMonth()+1)}-${P(I.getDate())} ${P(I.getHours())}:${P(I.getMinutes())}`}const a=F(()=>i.session.updatedAt?l(i.session.updatedAt):i.session.time),c=Z(!1),u=Z(null),d=Z(null),p=Z({});function h(S){const I=S.target;d.value?.el?.contains(I)||u.value?.el?.contains(I)||b()}function f(){const S=u.value?.el;if(!S)return;const I=d.value?.el,P=S.getBoundingClientRect(),D=4,W=8,z=I?.offsetHeight??0,q=I?.offsetWidth??0;let Q=P.bottom+D;Q+z>window.innerHeight-W&&(Q=Math.max(W,P.top-z-D));let X=P.right-q;X<W&&(X=W),p.value={top:`${Math.round(Q)}px`,left:`${Math.round(X)}px`}}async function m(S){if(S.stopPropagation(),c.value){b();return}c.value=!0,setTimeout(()=>document.addEventListener("mousedown",h),0),window.addEventListener("resize",b),await ht(),f()}function b(){c.value=!1,document.removeEventListener("mousedown",h),window.removeEventListener("resize",b)}kn(()=>{document.removeEventListener("mousedown",h),window.removeEventListener("resize",b)});const _=Z(!1),g=Z(""),v=Z(null);async function y(){b(),_.value=!0,g.value=i.session.title,await ht();try{v.value?.focus(),v.value?.select()}catch{}}function A(){const S=g.value.trim();S&&r("rename",i.session.id,S),_.value=!1}function O(){_.value=!1}const $=Z(!1),k=Z(!1);async function E(){const S=await zs(i.session.id);$.value=S,k.value=!S,setTimeout(()=>{$.value=!1,k.value=!1,b()},1500)}function M(){b(),r("fork",i.session.id)}async function L(){b(),await o({title:s("sidebar.archive"),message:s("sidebar.archiveConfirm"),variant:"danger"})&&r("archive",i.session.id)}return t({closeMenu:b}),(S,I)=>(w(),N("div",{class:Re(["se",{on:e.active}]),onClick:I[4]||(I[4]=P=>r("select",e.session.id))},[T("div",OL,[T("span",PL,[e.session.busy?(w(),ve(ni,{key:0,size:"sm"})):e.unread?(w(),N("span",RL)):ie("",!0)]),T("div",DL,[_.value?Mn((w(),N("input",{key:0,ref_key:"renameInputRef",ref:v,"onUpdate:modelValue":I[0]||(I[0]=P=>g.value=P),class:"rename-input",onClick:I[1]||(I[1]=vt(()=>{},["stop"])),onKeydown:[di(vt(A,["stop"]),["enter"]),di(vt(O,["stop"]),["esc"])],onBlur:A},null,40,BL)),[[ko,g.value]]):(w(),N("span",{key:1,class:"t",onDblclick:vt(y,["stop"])},R(e.session.title),33))]),oe(Ht,{text:x(s)("workspace.awaitingAnswerTitle")},{default:_e(()=>[!_.value&&(e.questionCount>0||e.session.status==="awaitingQuestion")?(w(),ve(Is,{key:0,variant:"info",size:"sm"},{default:_e(()=>[qe(R(x(s)("workspace.awaitingAnswer")),1)]),_:1})):ie("",!0)]),_:1},8,["text"]),oe(Ht,{text:x(s)("workspace.awaitingPermissionTitle")},{default:_e(()=>[!_.value&&(e.approvalCount>0||e.session.status==="awaitingApproval")?(w(),ve(Is,{key:0,variant:"warning",size:"sm"},{default:_e(()=>[qe(R(x(s)("workspace.awaitingPermission")),1)]),_:1})):ie("",!0)]),_:1},8,["text"]),oe(Ht,{text:x(s)("workspace.abortedTitle")},{default:_e(()=>[!_.value&&e.session.status==="aborted"?(w(),ve(Is,{key:0,variant:"danger",size:"sm"},{default:_e(()=>[qe(R(x(s)("workspace.aborted")),1)]),_:1})):ie("",!0)]),_:1},8,["text"]),T("span",FL,[T("span",HL,R(e.session.time),1),_.value?ie("",!0):(w(),ve(gn,{key:0,ref_key:"kebabRef",ref:u,class:Re(["kebab",{open:c.value}]),size:"sm",label:x(s)("sidebar.options"),onClick:I[2]||(I[2]=vt(P=>m(P),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"sm"})]),_:1},8,["class","label"]))])]),(w(),ve(lh,{to:"body"},[c.value?(w(),ve(Wl,{key:0,ref_key:"menuRef",ref:d,class:"menu",style:Gt(p.value),onClick:I[3]||(I[3]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{danger:k.value,onClick:E},{default:_e(()=>[qe(R(k.value?x(s)("sidebar.copyFailed"):$.value?x(s)("sidebar.copied"):x(s)("sidebar.copySessionId")),1)]),_:1},8,["danger"]),oe(fn,{separator:""}),oe(fn,{onClick:y},{default:_e(()=>[qe(R(x(s)("sidebar.rename")),1)]),_:1}),oe(fn,{onClick:M},{default:_e(()=>[qe(R(x(s)("sidebar.fork")),1)]),_:1}),oe(fn,{danger:"",onClick:L},{default:_e(()=>[qe(R(x(s)("sidebar.archive")),1)]),_:1}),oe(fn,{separator:""}),T("div",WL,R(a.value),1)]),_:1},8,["style"])):ie("",!0)]))],2))}}),UL=ut(zL,[["__scopeId","data-v-c08c0c63"]]),qL={class:"gh-top"},jL={key:2,class:"gh-name"},VL={class:"gh-path"},KL=["inert"],GL=["disabled"],YL={class:"show-more-label"},XL={class:"show-more-label"},QL={key:2,class:"group-empty"},ZL=je({__name:"WorkspaceGroup",props:{group:{},activeWorkspaceId:{},activeId:{},renamingId:{},renameValue:{},renameInputRef:{},pendingBySession:{},unreadBySession:{},wsMenuOpenId:{},dragging:{type:Boolean},showPath:{type:Boolean},isCollapsed:{type:Function},isExpanded:{type:Function}},emits:["groupClick","groupContextmenu","toggleWsMenu","createInWorkspace","selectSession","renameSession","archiveSession","forkSession","loadMore","toggleExpand","confirmRename","cancelRename","updateRenameValue","wsDragstart","wsDragend"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=F({get:()=>s.renameValue,set:p=>o("updateRenameValue",p)}),r=F(()=>{if(s.isExpanded(s.group.workspace.id))return s.group.sessions;const p=s.group.sessions.slice(0,s.group.initialCount);if(s.activeId&&!p.some(h=>h.id===s.activeId)){const h=s.group.sessions.find(f=>f.id===s.activeId);if(h)return[...p,h]}return p}),l=F(()=>s.group.sessions.length>s.group.initialCount);function a(){return Math.max(0,s.group.workspace.sessionCount-s.group.sessions.length)}function c(){return s.group.sessions.length-s.group.initialCount}function u(p){s.renameInputRef.value=p instanceof HTMLInputElement?p:null}function d(p){p.dataTransfer&&(p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",s.group.workspace.id),o("wsDragstart",s.group.workspace.id))}return(p,h)=>(w(),N("div",{class:Re(["group",{dragging:e.dragging}])},[T("div",{class:Re(["gh",{on:e.group.workspace.id===e.activeWorkspaceId,collapsed:e.isCollapsed(e.group.workspace.id),"show-path":e.showPath}]),draggable:"true",onClick:h[7]||(h[7]=vt(f=>o("groupClick",e.group.workspace.id,f),["stop"])),onContextmenu:h[8]||(h[8]=f=>o("groupContextmenu",e.group.workspace,f)),onDragstart:d,onDragend:h[9]||(h[9]=f=>o("wsDragend"))},[T("div",qL,[e.isCollapsed(e.group.workspace.id)?(w(),ve(Je,{key:0,class:"gh-folder",name:"folder-closed",size:"sm"})):(w(),ve(Je,{key:1,class:"gh-folder",name:"folder",size:"sm"})),e.renamingId!==e.group.workspace.id?(w(),N("span",jL,R(e.group.workspace.name),1)):Mn((w(),N("input",{key:3,ref:u,"onUpdate:modelValue":h[0]||(h[0]=f=>i.value=f),class:"gh-rename",type:"text",onKeydown:[h[1]||(h[1]=di(f=>o("confirmRename"),["enter"])),h[2]||(h[2]=di(f=>o("cancelRename"),["esc"]))],onBlur:h[3]||(h[3]=f=>o("cancelRename")),onClick:h[4]||(h[4]=vt(()=>{},["stop"]))},null,544)),[[ko,i.value]]),oe(gn,{class:Re(["gh-more",{open:e.wsMenuOpenId===e.group.workspace.id}]),size:"sm",label:x(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":e.wsMenuOpenId===e.group.workspace.id,onClick:h[5]||(h[5]=vt(f=>o("toggleWsMenu",e.group.workspace,f),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"sm"})]),_:1},8,["class","label","aria-expanded"]),oe(gn,{class:"gh-add",size:"sm",label:x(n)("workspace.newInGroup"),onClick:h[6]||(h[6]=vt(f=>o("createInWorkspace",e.group.workspace.id),["stop"]))},{default:_e(()=>[oe(Je,{name:"chat-new"})]),_:1},8,["label"])]),oe(Ht,{text:e.group.workspace.root},{default:_e(()=>[T("div",VL,R(e.group.workspace.shortPath||e.group.workspace.root),1)]),_:1},8,["text"])],34),T("div",{class:Re(["group-sessions",{collapsed:e.isCollapsed(e.group.workspace.id)}]),inert:e.isCollapsed(e.group.workspace.id)},[(w(!0),N(Le,null,nt(r.value,f=>(w(),ve(UL,{key:f.id,session:f,active:f.id===e.activeId,"approval-count":e.pendingBySession[f.id]?.approvals??0,"question-count":e.pendingBySession[f.id]?.questions??0,unread:e.unreadBySession[f.id]??!1,onSelect:h[10]||(h[10]=m=>o("selectSession",m)),onRename:h[11]||(h[11]=(m,b)=>o("renameSession",m,b)),onArchive:h[12]||(h[12]=m=>o("archiveSession",m)),onFork:h[13]||(h[13]=m=>o("forkSession",m))},null,8,["session","active","approval-count","question-count","unread"]))),128)),e.group.hasMore||e.group.loadingMore?(w(),N("button",{key:0,class:"show-more",disabled:e.group.loadingMore,onClick:h[14]||(h[14]=vt(f=>o("loadMore",e.group.workspace.id),["stop"]))},[h[16]||(h[16]=T("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),T("span",YL,R(e.group.loadingMore?x(n)("sidebar.loadingMore"):x(n)("sidebar.showMore",{count:a()})),1)],8,GL)):ie("",!0),l.value?(w(),N("button",{key:1,class:"show-more",onClick:h[15]||(h[15]=vt(f=>o("toggleExpand",e.group.workspace.id),["stop"]))},[h[17]||(h[17]=T("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),T("span",XL,R(e.isExpanded(e.group.workspace.id)?x(n)("sidebar.showLess"):x(n)("sidebar.showAll",{count:c()})),1)])):ie("",!0),e.group.sessions.length===0?(w(),N("div",QL,R(x(n)("sidebar.noSessions")),1)):ie("",!0)],10,KL)],2))}}),JL=ut(ZL,[["__scopeId","data-v-cc26d012"]]),e8="blun_desktop",t8="platform",$_="king-desktop",N_="king-desktop-platform";function n8(){let e=!1,t=null;try{const n=new URLSearchParams(window.location.search);n.has(e8)?(sessionStorage.setItem($_,"1"),e=!0):e=e||sessionStorage.getItem($_)==="1";const s=n.get(t8);s?(sessionStorage.setItem(N_,s),t=s):t=sessionStorage.getItem(N_)}catch{}return{isDesktop:e,platform:t}}const Kv=n8(),s8=Kv.isDesktop,AA=Kv.isDesktop&&Kv.platform==="darwin",o8=["aria-label"],i8=je({__name:"InternalBuildBanner",setup(e){const{t}=It(),n=s8;return(s,o)=>x(n)?(w(),N("span",{key:0,class:"internal-build-tag",role:"note","aria-label":x(t)("app.internalBuildBanner")},[o[0]||(o[0]=T("svg",{viewBox:"0 0 16 16",width:"11",height:"11",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[T("path",{d:"M8 2 14 13H2L8 2Z"}),T("path",{d:"M8 6v3.5"}),T("path",{d:"M8 11.5h.01"})],-1)),T("span",null,R(x(t)("app.internalBuildBanner")),1)],8,o8)):ie("",!0)}}),r8=ut(i8,[["__scopeId","data-v-7ae42bde"]]),l8={class:"ch"},a8={class:"ch-brand"},c8={class:"ch-name"},u8={key:0,class:"ch-endpoint"},d8={class:"search-input"},f8={key:0,class:"empty"},p8={class:"side-section-label"},h8={class:"side-section-title"},m8={class:"side-section-actions"},g8=["onDragover","onDrop"],v8={class:"section-menu-check"},y8={class:"section-menu-check"},k8={class:"section-menu-check"},b8=1e3,_8=je({__name:"Sidebar",props:{activeWorkspace:{default:null},activeWorkspaceId:{default:null},sessions:{},groups:{},activeId:{},workspaceSortMode:{},attentionBySession:{default:()=>({})},pendingBySession:{default:()=>({})},unreadBySession:{default:()=>({})},colWidth:{default:220}},emits:["select","create","createInWorkspace","selectWorkspace","addWorkspace","rename","archive","fork","renameWorkspace","deleteWorkspace","reorderWorkspaces","setWorkspaceSortMode","loadMoreSessions","loadAllSessions","openSettings","collapse"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=!1,i="",r=e,l=t,a=Z(!1);function c(){l("loadAllSessions"),a.value=!0}function u(Ge){(Ge.metaKey||Ge.ctrlKey)&&Ge.key.toLowerCase()==="k"&&(Ge.preventDefault(),c())}hn(()=>window.addEventListener("keydown",u)),ls(()=>window.removeEventListener("keydown",u));const d=Z(!1);function p(Ge){d.value=Ge.target.scrollTop>0}const h=Z(new Set(g5()));function f(Ge){return h.value.has(Ge)}function m(Ge){const Ye=new Set(h.value);Ye.has(Ge)?Ye.delete(Ge):Ye.add(Ge),h.value=Ye,sg(Ye)}function b(){const Ge=new Set(r.groups.map(Ye=>Ye.workspace.id));h.value=Ge,sg(Ge)}function _(){const Ge=new Set;h.value=Ge,sg(Ge)}const g=F(()=>r.groups.length>0&&r.groups.every(Ge=>h.value.has(Ge.workspace.id))),v=Z(new Set);function y(Ge){return v.value.has(Ge)}function A(Ge){const Ye=new Set(v.value);Ye.has(Ge)?Ye.delete(Ge):Ye.add(Ge),v.value=Ye}function O(Ge){if(!v.value.has(Ge)){const Ye=new Set(v.value);Ye.add(Ge),v.value=Ye}l("loadMoreSessions",Ge)}const $=Z(v5());function k(){$.value=!$.value,y5($.value)}const E=Z(null),M=Z(null);function L(Ge){E.value=Ge}function S(){E.value=null,M.value=null}function I(Ge){const Ye=Ge.currentTarget.getBoundingClientRect();return Ge.clientY<Ye.top+Ye.height/2?"before":"after"}function P(Ge,Ye){E.value===null||E.value===Ye||(Ge.preventDefault(),Ge.dataTransfer&&(Ge.dataTransfer.dropEffect="move"),M.value={id:Ye,position:I(Ge)})}function D(Ge){const Ye=E.value,Ct=M.value?.id===Ge?M.value.position:"before";if(M.value=null,E.value=null,!Ye||Ye===Ge)return;const $t=O5(r.groups.map(mn=>mn.workspace.id),Ye,Ge,Ct);l("reorderWorkspaces",$t)}function W(Ge,Ye){Ye.target.closest(".gh-more, .gh-add")||m(Ge)}function z(Ge){l("select",Ge)}const q=Z(null),Q=Z(""),X=Z(null);function fe(){return X}function ye(Ge,Ye){q.value=Ge,Q.value=Ye,ht().then(()=>X.value?.focus())}function Me(){const Ge=q.value,Ye=Q.value.trim();Ge&&Ye&&l("renameWorkspace",Ge,Ye),q.value=null}function we(){q.value=null}function ze(Ge){Q.value=Ge}const Ue=Z(!1),Fe=Z(null),rt=Z({}),le=Z(null);function U(Ge){le.value?.el&&!le.value.el.contains(Ge.target)&&ne()}function G(Ge,Ye){Ye.preventDefault(),Ye.stopPropagation(),Fe.value=Ge,rt.value={top:`${Ye.clientY}px`,left:`${Ye.clientX}px`},Ue.value=!0,document.addEventListener("mousedown",U,!0)}function ne(){Ue.value=!1,document.removeEventListener("mousedown",U,!0),Fe.value=null}function H(){Fe.value&&zs(Fe.value.root),ne()}function J(){Fe.value&&ye(Fe.value.id,Fe.value.name),ne()}async function ce(){const Ge=Fe.value;Ge&&(ne(),await s({title:n("sidebar.removeWorkspace"),message:n("workspace.removeWorkspaceConfirm",{name:Ge.name}),variant:"danger"})&&l("deleteWorkspace",Ge.id))}const te=Z(null),ue=Z(null),j=Z({}),Y=Z(null);function re(Ge){const Ye=Ge.target;Ye.closest(".gh-more")||Ye.closest(".ws-menu")||Ae()}async function ge(Ge,Ye){if(te.value===Ge.id){Ae();return}const Ct=Ye.currentTarget;ue.value=Ge,te.value=Ge.id,document.addEventListener("mousedown",re),window.addEventListener("resize",Ae),await ht();const $t=Y.value?.el,mn=Ct.getBoundingClientRect(),Nn=4,tn=8,Ln=$t?.offsetHeight??0,Zn=$t?.offsetWidth??0;let Mt=mn.bottom+Nn;Mt+Ln>window.innerHeight-tn&&(Mt=Math.max(tn,mn.top-Ln-Nn));let us=mn.right-Zn;us<tn&&(us=tn),j.value={top:`${Math.round(Mt)}px`,left:`${Math.round(us)}px`}}function Ae(){te.value=null,ue.value=null,document.removeEventListener("mousedown",re),window.removeEventListener("resize",Ae)}function Ie(Ge){zs(Ge.root),Ae()}function ae(Ge){ye(Ge.id,Ge.name),Ae()}async function Te(Ge){Ae(),await s({title:n("sidebar.removeWorkspace"),message:n("workspace.removeWorkspaceConfirm",{name:Ge.name}),variant:"danger"})&&l("deleteWorkspace",Ge.id)}const Ve=Z(!1),tt=Z({}),bt=Z(null);function kt(Ge){const Ye=Ge.target;Ye.closest(".side-section-kebab")||Ye.closest(".section-menu")||Pt()}async function Tt(Ge){if(Ve.value){Pt();return}const Ye=Ge.currentTarget;Ve.value=!0,document.addEventListener("mousedown",kt),window.addEventListener("resize",Pt),await ht();const Ct=bt.value?.el,$t=Ye.getBoundingClientRect(),mn=4,Nn=8,tn=Ct?.offsetHeight??0,Ln=Ct?.offsetWidth??0;let Zn=$t.bottom+mn;Zn+tn>window.innerHeight-Nn&&(Zn=Math.max(Nn,$t.top-tn-mn));let Mt=$t.right-Ln;Mt<Nn&&(Mt=Nn),tt.value={top:`${Math.round(Zn)}px`,left:`${Math.round(Mt)}px`}}function Pt(){Ve.value=!1,document.removeEventListener("mousedown",kt),window.removeEventListener("resize",Pt)}function mt(Ge){l("setWorkspaceSortMode",Ge),Pt()}function Yt(){k(),Pt()}ls(()=>{document.removeEventListener("mousedown",U,!0),document.removeEventListener("mousedown",re),document.removeEventListener("mousedown",kt),window.removeEventListener("resize",Ae),window.removeEventListener("resize",Pt)});const Rn=Z(null);let Dn;function Ft(){const Ge=Rn.value;Ge&&(Ge.classList.remove("blink-now"),Ge.getBoundingClientRect(),Ge.classList.add("blink-now"),clearTimeout(Dn),Dn=setTimeout(()=>Ge.classList.remove("blink-now"),300))}const bn=ui(()=>Xs(()=>import("./DesignSystemView-BbMOu-XO.js"),__vite__mapDeps([0,1]))),Vn=Z(!1);let st,In=!1;function _n(Ge){In=!1,clearTimeout(st),Ge.currentTarget.setPointerCapture?.(Ge.pointerId),st=setTimeout(()=>{In=!0,Vn.value=!0},b8)}function Kn(Ge){clearTimeout(st);const Ye=Ge.currentTarget;Ye.hasPointerCapture?.(Ge.pointerId)&&Ye.releasePointerCapture(Ge.pointerId)}function $n(){if(In){In=!1;return}Ft()}return ls(()=>{clearTimeout(st)}),(Ge,Ye)=>(w(),N(Le,null,[T("aside",{class:Re(["side",{"macos-desktop":x(AA)}])},[T("div",{class:"col",style:Gt({width:e.colWidth+"px"})},[T("div",l8,[T("div",a8,[(w(),N("svg",{ref_key:"logoRef",ref:Rn,class:Re(["ch-logo",{"is-dev":x(o)}]),viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BLUN King",onClick:$n,onPointerdown:_n,onPointerup:Kn,onPointercancel:Kn},[...Ye[21]||(Ye[21]=[c0('<defs data-v-f80f56a6><mask id="blunEyes" maskUnits="userSpaceOnUse" data-v-f80f56a6><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-f80f56a6></rect><g class="ch-eyes" fill="#000" data-v-f80f56a6><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-f80f56a6></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-f80f56a6></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#blunEyes)" data-v-f80f56a6></rect>',2)])],34)),T("span",c8,[Ye[22]||(Ye[22]=qe("BLUN King",-1)),x(o)?(w(),N("span",u8," · "+R(x(i)),1)):ie("",!0)]),oe(r8)]),oe(gn,{size:"sm",label:x(n)("sidebar.collapseSidebar"),onClick:Ye[0]||(Ye[0]=vt(Ct=>l("collapse"),["stop"]))},{default:_e(()=>[oe(Je,{name:"panel-collapse"})]),_:1},8,["label"]),oe(gn,{size:"sm",label:x(n)("settings.title"),onClick:Ye[1]||(Ye[1]=vt(Ct=>l("openSettings"),["stop"]))},{default:_e(()=>[oe(Je,{name:"settings"})]),_:1},8,["label"])]),T("button",{class:"search",type:"button",onClick:c},[oe(Je,{class:"search-icon",name:"search"}),T("span",d8,R(x(n)("sidebar.searchShortcut")),1)]),T("div",{class:Re(["btn-wrap",{"btn-wrap--scrolled":d.value}])},[T("button",{class:"btn-new-chat",type:"button",onClick:Ye[2]||(Ye[2]=vt(Ct=>l("create"),["stop"]))},[oe(Je,{name:"chat-new"}),T("span",null,R(x(n)("sidebar.newChat")),1)]),ie("",!0)],2),T("div",{class:"sessions",onScroll:p},[e.groups.length===0?(w(),N("div",f8,R(x(n)("workspace.noWorkspace")),1)):(w(),N(Le,{key:1},[T("div",p8,[T("span",h8,R(x(n)("sidebar.workspaces")),1),T("div",m8,[oe(gn,{class:"side-section-toggle",size:"sm",label:g.value?x(n)("sidebar.expandAll"):x(n)("sidebar.collapseAll"),onClick:Ye[4]||(Ye[4]=vt(Ct=>g.value?_():b(),["stop"]))},{default:_e(()=>[g.value?(w(),ve(Je,{key:0,name:"expand"})):(w(),ve(Je,{key:1,name:"collapse"}))]),_:1},8,["label"]),oe(gn,{class:"side-section-toggle side-section-kebab",size:"sm",label:x(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":Ve.value,onClick:Ye[5]||(Ye[5]=vt(Ct=>Tt(Ct),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal"})]),_:1},8,["label","aria-expanded"])])]),(w(!0),N(Le,null,nt(e.groups,Ct=>(w(),N("div",{key:Ct.workspace.id,class:Re(["ws-drop-target",{"drop-before":M.value?.id===Ct.workspace.id&&M.value.position==="before","drop-after":M.value?.id===Ct.workspace.id&&M.value.position==="after"}]),onDragover:$t=>P($t,Ct.workspace.id),onDrop:$t=>D(Ct.workspace.id)},[oe(JL,{group:Ct,"active-workspace-id":e.activeWorkspaceId,"active-id":e.activeId,"renaming-id":q.value,"rename-value":Q.value,"rename-input-ref":fe(),"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,"ws-menu-open-id":te.value,dragging:E.value===Ct.workspace.id,"is-collapsed":f,"is-expanded":y,"show-path":$.value,onGroupClick:W,onGroupContextmenu:G,onToggleWsMenu:ge,onCreateInWorkspace:Ye[6]||(Ye[6]=$t=>l("createInWorkspace",$t)),onSelectSession:z,onRenameSession:Ye[7]||(Ye[7]=($t,mn)=>l("rename",$t,mn)),onArchiveSession:Ye[8]||(Ye[8]=$t=>l("archive",$t)),onForkSession:Ye[9]||(Ye[9]=$t=>l("fork",$t)),onLoadMore:O,onToggleExpand:A,onConfirmRename:Me,onCancelRename:we,onUpdateRenameValue:ze,onWsDragstart:L,onWsDragend:S},null,8,["group","active-workspace-id","active-id","renaming-id","rename-value","rename-input-ref","pending-by-session","unread-by-session","ws-menu-open-id","dragging","show-path"])],42,g8))),128))],64))],32)],4),Ue.value?(w(),ve(Wl,{key:0,ref_key:"ghMenuRef",ref:le,class:"gh-menu",style:Gt(rt.value),onClick:Ye[10]||(Ye[10]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:H},{default:_e(()=>[qe(R(x(n)("sidebar.copyPath")),1)]),_:1}),oe(fn,{onClick:J},{default:_e(()=>[qe(R(x(n)("sidebar.rename")),1)]),_:1}),oe(fn,{danger:"",onClick:ce},{default:_e(()=>[qe(R(x(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ie("",!0),te.value!==null&&ue.value?(w(),ve(Wl,{key:1,ref_key:"wsMenuRef",ref:Y,class:"ws-menu",style:Gt(j.value),onClick:Ye[14]||(Ye[14]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:Ye[11]||(Ye[11]=Ct=>Ie(ue.value))},{default:_e(()=>[qe(R(x(n)("sidebar.copyPath")),1)]),_:1}),oe(fn,{separator:""}),oe(fn,{onClick:Ye[12]||(Ye[12]=Ct=>ae(ue.value))},{default:_e(()=>[qe(R(x(n)("sidebar.rename")),1)]),_:1}),oe(fn,{separator:""}),oe(fn,{danger:"",onClick:Ye[13]||(Ye[13]=Ct=>Te(ue.value))},{default:_e(()=>[qe(R(x(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ie("",!0),Ve.value?(w(),ve(Wl,{key:2,ref_key:"sectionMenuRef",ref:bt,class:"section-menu",style:Gt(tt.value),onClick:Ye[18]||(Ye[18]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:Ye[15]||(Ye[15]=Ct=>mt("manual"))},{default:_e(()=>[T("span",v8,[e.workspaceSortMode==="manual"?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),qe(" "+R(x(n)("sidebar.sortManual")),1)]),_:1}),oe(fn,{onClick:Ye[16]||(Ye[16]=Ct=>mt("recent"))},{default:_e(()=>[T("span",y8,[e.workspaceSortMode==="recent"?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),qe(" "+R(x(n)("sidebar.sortRecent")),1)]),_:1}),oe(fn,{separator:""}),oe(fn,{onClick:Ye[17]||(Ye[17]=Ct=>Yt())},{default:_e(()=>[T("span",k8,[$.value?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),qe(" "+R(x(n)("sidebar.showWorkspacePaths")),1)]),_:1})]),_:1},8,["style"])):ie("",!0),a.value?(w(),ve(wL,{key:3,sessions:e.sessions,"active-id":e.activeId,onSelect:z,onClose:Ye[19]||(Ye[19]=Ct=>a.value=!1)},null,8,["sessions","active-id"])):ie("",!0)],2),(w(),ve(lh,{to:"body"},[Vn.value?(w(),ve(x(bn),{key:0,onClose:Ye[20]||(Ye[20]=Ct=>Vn.value=!1)})):ie("",!0)]))],64))}}),w8=ut(_8,[["__scopeId","data-v-f80f56a6"]]);function S8(e){try{const t=Qn(e);if(t===null)return null;const n=Number(t);return Number.isFinite(n)?n:null}catch{return null}}function C8(e,t){try{ts(e,String(t))}catch{}}function x8(e){const{storageKey:t,defaultWidth:n,min:s,max:o,reverse:i=!1}=e;function r(_){return Number.isFinite(_)?Math.min(RC(o),Math.max(s,Math.round(_))):n}const l=Z(r(S8(t)??n)),a=Z(!1);function c(_){const g=r(_);l.value=g,C8(t,g)}let u=0,d=0,p=null,h=-1;function f(_){if(!a.value)return;const g=_.clientX-u;c(d+(i?-g:g))}function m(){if(a.value){if(a.value=!1,typeof document<"u"&&(document.body.style.userSelect="",document.body.style.cursor=""),p){try{p.releasePointerCapture(h)}catch{}p.removeEventListener("pointermove",f),p.removeEventListener("pointerup",m),p.removeEventListener("pointercancel",m)}p=null,h=-1}}function b(_){_.preventDefault(),a.value=!0,u=_.clientX,d=r(l.value),p=_.currentTarget,h=_.pointerId,typeof document<"u"&&(document.body.style.userSelect="none",document.body.style.cursor="col-resize");try{p.setPointerCapture(h)}catch{}p.addEventListener("pointermove",f),p.addEventListener("pointerup",m),p.addEventListener("pointercancel",m)}return ls(m),{width:l,dragging:a,clamp:r,setWidth:c,onPointerDown:b}}const A8=["aria-label"],T8=je({__name:"ResizeHandle",props:{storageKey:{},defaultWidth:{},min:{},max:{},reverse:{type:Boolean},ariaLabel:{}},emits:["update:width","update:dragging"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),{width:i,dragging:r,onPointerDown:l}=x8({storageKey:n.storageKey,defaultWidth:n.defaultWidth,min:n.min,max:()=>n.max,reverse:n.reverse});return s("update:width",i.value),Ke(i,a=>s("update:width",a)),Ke(r,a=>s("update:dragging",a)),(a,c)=>(w(),N("div",{class:Re(["rh",{dragging:x(r)}]),role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel??x(o)("layout.resizeHandleAria"),onPointerdown:c[0]||(c[0]=(...u)=>x(l)&&x(l)(...u))},[...c[1]||(c[1]=[T("span",{class:"rh-bar","aria-hidden":"true"},null,-1)])],42,A8))}}),L_=ut(T8,[["__scopeId","data-v-7cdd3468"]]),M8={preview:"Preview",confirm:"Confirm",cancel:"Cancel"},E8={authBannerMessage:"Not signed in · Sign in to BLUN King to start a conversation",authBannerLogin:"Sign in",authPageTitle:"Sign in to BLUN King",authPageMessage:"Connect your BLUN King account before starting or continuing conversations.",authPageLogin:"Sign in",connecting:"Connecting…",internalBuildBanner:"Internal testing only"},I8={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"Workspaces",sortWorkspaces:"Sort workspaces",sortManual:"Manual",sortRecent:"Last edited",collapseAll:"Collapse all workspaces",expandAll:"Expand all workspaces",showWorkspacePaths:"Show workspace paths",newSession:"New Session",newChat:"New Chat",newWorkspace:"New Workspace",emptyState:"No sessions yet · click New Session to start",archiveConfirm:"Archive session?",options:"Options",rename:"Rename",copyPath:"Copy path",copySessionId:"Copy session ID",copied:"Copied ✓",copyFailed:"Copy failed",archive:"Archive",fork:"Fork session",delete:"Delete",removeWorkspace:"Remove workspace",brand:"BLUN King",signedIn:"Signed in",signOut:"Sign out",notSignedIn:"Not signed in",signIn:"Sign in",language:"Language",daemon:"Daemon",noSessions:"No conversations yet",showMore:"Load more ({count})",showLess:"Show less",showAll:"Show all ({count})",loadingMore:"Loading…",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",searchPlaceholder:"Search sessions",searchShortcut:"Search sessions (⌘K)",searchHint:"↑↓ navigate · ↵ open · Esc close",searchNoResults:"No matching sessions"},$8={switcherTitle:"Switch workspace",switchTooltip:"Switch workspace",eyebrow:"Workspace",branchLabel:"branch: {branch}",noBranch:"no branch",sessionCount:"{count} session | {count} sessions",allWorkspaces:"All workspaces",currentWorkspace:"Current workspace only",addWorkspace:"Add workspace…",noWorkspace:"No workspace",deleteHasSessions:"This workspace still has sessions — archive them before deleting it",removeWorkspaceConfirm:'Remove workspace "{name}"?',swarmEnableConfirm:"Enable swarm mode? The agent will run multiple sub-agents in parallel.",goalStartConfirm:'Start goal: "{objective}"? The agent will run autonomously toward it.',scopeCurrent:"this workspace",scopeAll:"all workspaces",newInGroup:"New session in this workspace",addTitle:"Add workspace",pathLabel:"Path",pathPlaceholder:"/absolute/path/to/project",recentLabel:"Recent folders",add:"Add",cancel:"Cancel",addHint:"Paste an absolute folder path, or pick a recent one.",addFailed:"Couldn't open this folder. Check the path and try again.",openThisFolder:"Open this folder",up:"Up",browsing:"Browsing…",filterPlaceholder:"Filter subfolders…",searchPlaceholder:"Fuzzy-search under this folder…",searching:"Searching…",pasteToggle:"Enter an absolute path",noFilterMatch:"No subfolders match “{q}”",noSubfolders:"No subfolders here",gitTag:"git",browseHint:'Click a folder to enter it, then "Open this folder" to add it as a workspace.',attentionTitle:"{count} item needs your attention | {count} items need your attention",awaitingAnswer:"Answer",awaitingAnswerTitle:"A question is waiting for your answer",awaitingPermission:"Approve",awaitingPermissionTitle:"An action is waiting for your approval",aborted:"Stopped",abortedTitle:"This session was interrupted before finishing"},N8={jumpToLatestAria:"Jump to latest message",toc:"Conversation outline",newMessages:"Latest messages",loading:"Loading…",emptyWorkspaceHint:"Send in {name}",switchWorkspace:"Switch workspace",addWorkspace:"New workspace",moreWorkspaces:"More workspaces ({count})",compacting:"Compacting context…",compactedPlain:"Context compacted",compactedAuto:"Context auto-compacted",compactedTokens:" ({before} → {after} tokens)",viewSummary:"View summary",summaryTitle:"Compaction summary",manuallyAborted:"Manually stopped",activatedSkill:"Activated skill: {name}",undo:"Undo",undoTooltip:"Undoing the conversation will not roll back code changes",undoConfirm:"Undo last message?",yesterday:"Yesterday",loadOlder:"Load earlier messages",loadingOlder:"Loading earlier messages…"},L8={connectionConnected:"Connected",connectionConnecting:"Connecting…",connectionDisconnected:"Disconnected",ctxTooltip:"Used {used} / {max} tokens ({pct}%)",modelLabel:"Model",permissionManual:"Manual",permissionAuto:"Auto",permissionYolo:"YOLO",permissionManualDesc:"Ask for approval on every tool action",permissionAutoDesc:"Fully autonomous — agent decides everything without asking",permissionYoloDesc:"Auto-approve tool actions, but agent may still ask questions",planLabel:"Plan",planOn:"on",planOff:"off",planTooltip:"Toggle plan mode (research before editing)",modesLabel:"Mode",goalLabel:"Goal",swarmLabel:"Swarm",modeOff:"Off",goalPlaceholder:"What should the agent achieve?",goalStart:"Start",goalPause:"Pause",goalResume:"Resume",goalCancel:"Cancel",modeNotSupported:"Not supported",thinkingLabel:"thinking",thinkingTooltip:"Toggle thinking mode",starredModels:"Starred",moreModels:"More models…",statusPanelTitle:"Session status",statusPanelClose:"Close",statusModel:"Model",statusThinking:"Thinking",statusPermission:"Permission",statusPlanMode:"Plan mode",statusSwarmMode:"Swarm mode",swarmOn:"on",swarmOff:"off",statusContext:"Context",statusCost:"Cost",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"Running…",activityAwaitingApproval:"Awaiting approval",activityAwaitingQuestion:"Awaiting answer",interrupt:"Interrupt",runningShort:"in progress"},O8={placeholder:"Type a message…",send:"Send ↵",queueLabel:"Queue",placeholderRunning:"Press Enter to queue · Ctrl+S to inject into the running turn",queueAutoDrain:"sends automatically when the current turn ends",queueNext:"Up next",queueDragTitle:"Drag to reorder",editQueued:"Edit (load back into the input)",queuedImageOnly:"image ×{n}",queuedHasImage:"Contains {n} image(s) — remove only, not editable",remove:"Remove",removeNamed:"Remove {name}",uploading:"Uploading",uploadFailed:"Upload failed",attachImage:"Attach image",previewAttachment:"Preview {name}",interrupt:"Interrupt",interruptTitle:"Interrupt current operation",expandTitle:"Expand input for multi-line editing",collapseTitle:"Collapse input",emptyConversationTitle:"BLUN King",emptyConversation:"No messages yet — type below to start the conversation",quickStartPlaceholder:"Type a message to start a new conversation…",thinkingSuffix:" · thinking",thinkingSuffixEffort:" · thinking: {level}"},P8={title:"Sign in to BLUN King",close:"Close (Esc)",starting:"Starting authorization flow…",lead:"Click the button below to authorize in a new browser tab.",authorizeInBrowser:"Authorize in browser",orDivider:"or",fallbackPrefix:"On another device? Open ",fallbackSuffix:" and enter the device code:",copy:"Copy",copied:"Copied",waitingAuth:"Waiting for authorization",waitingAutoClose:"Waiting for authorization, signs in automatically…",success:"Authorized",successHint:"Loading, will close automatically…",expiredTitle:"Authorization code expired",expiredHint:"Please restart the authorization flow",retry:"Retry",closeBtn:"Close",errorTitle:"The current daemon does not support login yet",errorHint:"Please upgrade blun and try again"},R8={dialogLabel:"Manage providers",title:"Provider management",close:"Close (Esc)",loading:"Loading providers…",unavailable:"The daemon does not support provider management yet",empty:"No providers yet",status:{connected:"Connected",error:"Error",unconfigured:"Not configured"},keySet:"key set",keyNotSet:"key not set",modelCount:"{count} models",confirmDelete:"Confirm delete?",refresh:"Refresh",delete:"Delete",refreshTitle:"Refresh {type}",deleteTitle:"Delete {type}",loginBlun:"Sign in to Blun",enterApiKey:"Enter API Key",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"Default model",baseUrlPlaceholder:"https://… (optional)",optional:"Optional",apiKeyRequired:"API Key cannot be empty",add:"Add",escClose:"Esc to close"},D8={dialogLabel:"Switch model",title:"Switch model",close:"Close (Esc)",allTab:"All",providerTabs:"Model providers",searchPlaceholder:"Search models or providers…",loading:"Loading models…",unavailable:"The daemon does not support model listing yet",contextSuffix:"{size}k ctx",emptyNoModels:"The daemon offers no selectable models",emptyNoMatch:"No matching models",starTitle:"Add to favorites",unstarTitle:"Remove from favorites",footerHint:"↑↓ Navigate · Enter Select · Esc Close"},B8={justNow:"just now"},F8={title:{shell:"Run command?",diff:"Apply changes?",file:"Write file?",fileop:"File operation?",url:"Fetch URL?",search:"Search?",invocation:"Invoke?",todo:"Update todo?",plan_review:"Ready to build with this plan?",generic:"Approve action?"},subagentBadge:"sub agent · {name}",required:"APPROVAL REQUIRED",danger:"Danger: {detail}",searchQueryLabel:"query",searchScope:"scope: {scope}",feedbackPlaceholder:"Explain why you are rejecting… (Enter to submit, Esc to cancel)",feedbackHint:"Enter to submit · Esc to cancel",approve:"Approve",approveSession:"Approve for session",reject:"Reject",feedback:"+Feedback",approvePlan:"Approve plan",revise:"Revise",rejectAndExit:"Reject and Exit"},H8={title:"Question",step:"Q{current}/{total}",back:"‹ Back",nextQuestion:"Next question ›",otherDefault:"Other…",submit:"Submit",dismiss:"Dismiss",minimize:"Minimize",expand:"Expand"},W8={tag:"tasks",summary:"{run} running · {done} done",stop:"stop",defaultDescription:"Background task",dockTasks:"Background tasks",dockBash:"Bash",dockSubagent:"Sub Agent",dockTodos:"Todos",running:"running",closePanel:"Close panel",timingRunning:"Running · {time}",timingDone:"Done · {sec}s",emptyTasks:"No background tasks running",emptyBash:"No bash tasks running",emptySubagent:"No sub agent tasks running",emptyTodo:"No todos yet",openTab:"Open the tasks tab",openDetail:"Open",collapse:"Collapse",expand:"Expand"},z8={panelTitle:"Thinking",close:"Close"},U8={title:"Changes",branch:"branch",aheadTitle:"ahead of remote",behindTitle:"behind remote",changeCount:"{count} changes",empty:"No git changes / not provided by daemon",clean:"Working tree clean, no changes",back:"Back",loading:"Loading diff…",noDiff:"No line changes for this file",list:"List",tree:"Tree",close:"Close"},q8={},j8={empty:"Select a file on the left to preview",loading:"Loading…",lineCount:"{count} lines",copy:"Copy",copied:"Copied",copyPath:"Copy path",openInEditor:"Open",reveal:"Reveal",download:"Download",close:"Close",search:"Search",prevMatch:"Previous match",nextMatch:"Next match",htmlMode:"HTML preview mode",markdownMode:"Markdown preview mode",preview:"Preview",source:"Source",imageFit:"Image sizing",fit:"Fit",actual:"Actual",pdfNoPreview:"This PDF cannot be embedded here. Download it to view.",imageNoPreview:"Image file · {mime} · {size} · preview unavailable",binaryNoPreview:"Binary file · {mime} · {size} bytes · preview unavailable",unknownType:"unknown type",copyCode:"Copy code",enlargeImage:"Enlarge image",errors:{emptyPath:"File path is empty",unsupportedPath:"URLs and remote paths cannot be previewed",outsideWorkspace:"Only files inside the current workspace can be previewed",isDirectory:"Select a file instead of a directory",loadFailed:"Unable to read this file"}},V8={searching:"Searching…",noMatch:"No matches"},K8={dismiss:"Close",errorLabel:"Error",noteLabel:"Note",details:{cause:"Cause",code:"Error code",connection:"Connection",contentType:"Content type",details:"Server details",duration:"Duration",endpoint:"Endpoint",errorName:"Error type",message:"Message",operation:"Operation",phase:"Failure phase",request:"Request",requestId:"Request ID",responsePreview:"Response preview",sessionId:"Session ID",stack:"Stack",status:"HTTP status",timeout:"Timeout",timestamp:"Time"},daemonApiTitle:"Blun daemon returned an error",daemonNetworkMessage:"Web did not receive a response from the local service. Check that Blun daemon is still running, or refresh the page.",daemonNetworkTitle:"Cannot connect to Blun daemon",diagnostics:"Diagnostics",hideDetails:"Hide details",operationFailedMessage:"The last operation did not finish. Try again later.",operationFailedTitle:"Operation failed",sessionSnapshotMessage:"Web could not load the current conversation. Check that Blun daemon is still running, or refresh the page.",sessionSnapshotTitle:"Cannot load current conversation",showDetails:"Show details",copyDetails:"Copy diagnostics",copied:"Copied",wsTitle:"Realtime connection error",goal:{alreadyExists:"This session already has an active goal. Cancel it before starting a new one.",notFound:"No goal to act on — it may have already finished or been cancelled.",statusInvalid:"The current goal state does not allow this action.",notResumable:"This goal cannot be resumed (it may be cancelled or completed).",objectiveTooLong:"The objective is too long. Please shorten it and try again."}},G8={help:{desc:"Show the list of available commands"},new:{desc:"Create a new session"},clear:{desc:"Clear and start a new session"},model:{desc:"Switch model"},provider:{desc:"Manage providers (add / remove / refresh)"},login:{desc:"Sign in to Blun in the browser"},permission:{desc:"Switch approval mode (manual / auto / yolo)"},plan:{desc:"Toggle plan mode on/off"},swarm:{desc:"Toggle swarm mode; /swarm <task> runs a task in swarm"},goal:{desc:"Create/control a goal: /goal <objective>, /goal pause|resume|cancel"},btw:{desc:"Side chat: /btw <question> asks a forked side session"},yolo:{desc:"Auto-approve everything (yolo mode)"},auto:{desc:"Auto-approve safe edits/reads"},thinking:{desc:"Set the thinking level"},compact:{desc:"Compact the conversation history"},fork:{desc:"Fork this session into a new one"},undoNotImplemented:"/undo isn't supported by the daemon yet",status:{desc:"View session status"},undo:{desc:"Undo the last message"}},Y8={label:{read:"Read",bash:"Run",edit:"Edit",write:"Write",grep:"Search",glob:"Find",ls:"List",web_fetch:"Fetch",search:"Search",todo:"Todo",task:"Task"},chip:{lines:"{count} lines",results:"{count} results",edited:"edited",created:"created",todos:"{count} items"},group:{title:"{count} tool call | {count} tool calls",running:"running",error:"failed",done:"done"}},X8={resizeHandleAria:"Resize sidebar width",resizePreviewAria:"Resize preview panel width",detailPanelAria:"Detail panel"},Q8={openSwitcher:"Switch session / workspace",openSettings:"Session settings",settingsTitle:"Session settings",groupSession:"Current session",groupApp:"App preferences",sheetLabel:"Sheet",closeSheet:"Close",tapToCycle:"tap to cycle",running:"running",idle:"idle",sessionCount:"{n} sessions",newSession:"New session",permManualSub:"confirm every tool",permAutoSub:"auto-approve edits",permYoloSub:"auto-approve all",planModeSub:"Plan mode",swarmModeSub:"Swarm mode"},Z8={colorSchemeLabel:"Light/Dark",light:"Moon Bright",dark:"Moon Dark",system:"System",accentLabel:"Accent",accentBlue:"Blue",accentBlack:"Black"},J8={preview:"预览",confirm:"确认",cancel:"取消"},eO={authBannerMessage:"未登录 · 需要登录 BLUN King 才能开始对话",authBannerLogin:"登录",authPageTitle:"登录 BLUN King",authPageMessage:"先连接 BLUN King 账号,然后再开始或继续对话。",authPageLogin:"登录",connecting:"连接中…",internalBuildBanner:"仅供内部测试"},tO={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"工作区",sortWorkspaces:"工作区排序",sortManual:"手动排序",sortRecent:"按最后编辑时间",collapseAll:"折叠全部工作区",expandAll:"展开全部工作区",showWorkspacePaths:"显示工作区路径",newSession:"新建会话",newChat:"新建对话",newWorkspace:"新建工作区",emptyState:"还没有会话 · 点击 新建会话 开始",archiveConfirm:"归档会话?",options:"选项",rename:"重命名",copyPath:"复制路径",copySessionId:"复制 Session ID",copied:"已复制 ✓",copyFailed:"复制失败",archive:"归档",fork:"分叉会话",delete:"删除",removeWorkspace:"移除工作区",brand:"BLUN King",signedIn:"已登录",signOut:"退出登录",notSignedIn:"未登录",signIn:"登录",language:"语言",daemon:"后台",noSessions:"暂无对话",showMore:"加载更多 ({count})",showLess:"收起",showAll:"展开 ({count})",loadingMore:"加载中…",collapseSidebar:"收起侧边栏",expandSidebar:"展开侧边栏",searchPlaceholder:"搜索会话",searchShortcut:"搜索会话 (⌘K)",searchHint:"↑↓ 选择 · ↵ 打开 · Esc 关闭",searchNoResults:"没有匹配的会话"},nO={switcherTitle:"切换工作区",switchTooltip:"切换工作区",eyebrow:"工作区",branchLabel:"分支: {branch}",noBranch:"无分支",sessionCount:"{count} 个会话",allWorkspaces:"全部工作区",currentWorkspace:"仅当前工作区",addWorkspace:"添加工作区…",noWorkspace:"暂无工作区",deleteHasSessions:"工作区内还有会话,请先归档这些会话再删除",removeWorkspaceConfirm:"移除工作区「{name}」?",swarmEnableConfirm:"启用 swarm 模式?Agent 将并行运行多个子 agent。",goalStartConfirm:"启动 goal:「{objective}」?Agent 将自主执行。",scopeCurrent:"当前工作区",scopeAll:"全部工作区",newInGroup:"在此工作区新建会话",addTitle:"添加工作区",pathLabel:"路径",pathPlaceholder:"/项目的绝对路径",recentLabel:"最近的文件夹",add:"添加",cancel:"取消",addHint:"粘贴一个绝对路径,或从最近用过的文件夹中选择。",addFailed:"无法打开此文件夹,请检查路径后重试。",openThisFolder:"打开此文件夹",up:"上一级",browsing:"加载中…",filterPlaceholder:"过滤子文件夹…",searchPlaceholder:"在此目录下模糊搜索…",searching:"搜索中…",pasteToggle:"直接输入绝对路径",noFilterMatch:"没有匹配「{q}」的子文件夹",noSubfolders:"此处没有子文件夹",gitTag:"git",browseHint:'点击文件夹进入,再点"打开此文件夹"将其添加为工作区。',attentionTitle:"{count} 项待处理",awaitingAnswer:"待回答",awaitingAnswerTitle:"有提问等待你回答",awaitingPermission:"待授权",awaitingPermissionTitle:"有操作等待你授权",aborted:"已中断",abortedTitle:"此会话在完成前被中断"},sO={jumpToLatestAria:"跳到最新消息",toc:"对话目录",newMessages:"最新消息",loading:"加载中…",emptyWorkspaceHint:"在 {name} 中发送",switchWorkspace:"切换工作区",addWorkspace:"添加工作区",moreWorkspaces:"更多工作区 ({count})",compacting:"正在压缩上下文…",compactedPlain:"上下文已压缩",compactedAuto:"已自动压缩上下文",compactedTokens:"({before} → {after} tokens)",viewSummary:"查看摘要",summaryTitle:"压缩摘要",manuallyAborted:"您已手动终止",activatedSkill:"已激活技能: {name}",undo:"撤销",undoTooltip:"撤销对话不会回滚代码",undoConfirm:"撤销上一条消息?",yesterday:"昨天",loadOlder:"加载更早的消息",loadingOlder:"正在加载更早的消息…"},oO={connectionConnected:"已连接",connectionConnecting:"连接中…",connectionDisconnected:"未连接",ctxTooltip:"使用 {used} / {max} tokens ({pct}%)",modelLabel:"模型",permissionManual:"逐条确认",permissionAuto:"完全自主",permissionYolo:"自动通过",permissionManualDesc:"每个工具操作都需要你手动确认",permissionAutoDesc:"完全自主运行,agent 自己做决定,不再询问",permissionYoloDesc:"自动批准工具操作,但遇到关键问题仍会询问",planLabel:"计划",planOn:"开",planOff:"关",planTooltip:"切换计划模式(先调研再修改)",modesLabel:"模式",goalLabel:"目标",swarmLabel:"Swarm",modeOff:"未启用",goalPlaceholder:"让 Agent 完成什么目标?",goalStart:"开始",goalPause:"暂停",goalResume:"继续",goalCancel:"取消",modeNotSupported:"暂不支持",thinkingLabel:"思考",thinkingTooltip:"切换思考模式",starredModels:"收藏",moreModels:"更多模型…",statusPanelTitle:"会话状态",statusPanelClose:"关闭",statusModel:"模型",statusThinking:"思考强度",statusPermission:"权限",statusPlanMode:"计划模式",statusSwarmMode:"Swarm 模式",swarmOn:"开",swarmOff:"关",statusContext:"上下文",statusCost:"花费",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"运行中…",activityAwaitingApproval:"等待批准",activityAwaitingQuestion:"等待回答",interrupt:"中断",runningShort:"进行中"},iO={placeholder:"输入消息…",send:"发送 ↵",queueLabel:"队列",placeholderRunning:"输入会加入队列 · Ctrl+S 立即插入运行中的回合",queueAutoDrain:"当前回合结束后自动逐条发送",queueNext:"下一条",queueDragTitle:"拖拽排序",editQueued:"编辑(载入到输入框)",queuedImageOnly:"图片 ×{n}",queuedHasImage:"包含 {n} 张图片 — 只能移除,不能编辑",remove:"移除",removeNamed:"移除 {name}",uploading:"上传中",uploadFailed:"上传失败",attachImage:"附加图片",previewAttachment:"预览 {name}",interrupt:"中断",interruptTitle:"中断当前操作",expandTitle:"展开输入框进行多行编辑",collapseTitle:"收起输入框",emptyConversationTitle:"BLUN King",emptyConversation:"还没有消息 —— 在下方输入开始对话",quickStartPlaceholder:"输入消息开始新对话…",thinkingSuffix:" · thinking",thinkingSuffixEffort:" · thinking: {level}"},rO={title:"登录 BLUN King",close:"关闭 (Esc)",starting:"正在启动授权流程…",lead:"点击下方按钮,在新标签页中完成授权。",authorizeInBrowser:"在浏览器中授权",orDivider:"或者",fallbackPrefix:"换个设备?在浏览器打开 ",fallbackSuffix:" 输入设备码:",copy:"复制",copied:"已复制",waitingAuth:"等待授权",waitingAutoClose:"等待授权,完成后自动登录…",success:"已授权",successHint:"正在加载,稍后自动关闭…",expiredTitle:"授权码已过期",expiredHint:"请重新开始授权流程",retry:"重试",closeBtn:"关闭",errorTitle:"当前 daemon 暂不支持登录",errorHint:"请升级 blun 后重试"},lO={dialogLabel:"管理提供商",title:"提供商管理",close:"关闭 (Esc)",loading:"加载提供商中…",unavailable:"daemon 暂不支持提供商管理",empty:"暂无提供商",status:{connected:"已连接",error:"错误",unconfigured:"未配置"},keySet:"key 已设置",keyNotSet:"未设置 key",modelCount:"{count} 个模型",confirmDelete:"确认删除?",refresh:"刷新",delete:"删除",refreshTitle:"刷新 {type}",deleteTitle:"删除 {type}",loginBlun:"登录 Blun",enterApiKey:"填写 API Key",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"默认模型",baseUrlPlaceholder:"https://… (可选)",optional:"可选",apiKeyRequired:"API Key 不能为空",add:"添加",escClose:"Esc 关闭"},aO={dialogLabel:"切换模型",title:"切换模型",close:"关闭 (Esc)",allTab:"全部",providerTabs:"模型提供商",searchPlaceholder:"搜索模型或提供商…",loading:"加载模型中…",unavailable:"daemon 暂不支持模型列表",contextSuffix:"{size}k ctx",emptyNoModels:"daemon 未提供可选模型",emptyNoMatch:"无匹配模型",starTitle:"添加到收藏",unstarTitle:"取消收藏",footerHint:"↑↓ 导航 · Enter 选择 · Esc 关闭"},cO={justNow:"刚刚"},uO={title:{shell:"运行命令?",diff:"应用修改?",file:"写入文件?",fileop:"文件操作?",url:"抓取 URL?",search:"搜索?",invocation:"调用?",todo:"更新 todo?",plan_review:"按这份 plan 开始实现?",generic:"批准操作?"},subagentBadge:"子 agent · {name}",required:"APPROVAL REQUIRED",danger:"危险: {detail}",searchQueryLabel:"查询",searchScope:"范围:{scope}",feedbackPlaceholder:"说明拒绝原因… (Enter 提交, Esc 取消)",feedbackHint:"Enter 提交 · Esc 取消",approve:"批准",approveSession:"本会话内批准",reject:"拒绝",feedback:"+反馈",approvePlan:"批准 plan",revise:"修改",rejectAndExit:"拒绝并退出"},dO={title:"提问",step:"Q{current}/{total}",back:"‹ 返回",nextQuestion:"下一题 ›",otherDefault:"其他…",submit:"提交",dismiss:"放弃",minimize:"最小化",expand:"展开"},fO={tag:"任务",summary:"{run} 运行中 · {done} 完成",stop:"stop",defaultDescription:"后台任务",dockTasks:"后台任务",dockBash:"后台 Bash",dockSubagent:"子 Agent",dockTodos:"待办",running:"运行中",closePanel:"关闭面板",timingRunning:"运行中 · {time}",timingDone:"完成 · {sec}s",emptyTasks:"暂无后台任务",emptyBash:"暂无后台 Bash 任务",emptySubagent:"暂无子 Agent 任务",emptyTodo:"暂无待办事项",openTab:"查看全部后台任务",openDetail:"查看",collapse:"折叠",expand:"展开"},pO={panelTitle:"思考过程",close:"关闭"},hO={title:"改动",branch:"分支",aheadTitle:"领先远程",behindTitle:"落后远程",changeCount:"{count} 改动",empty:"无 git 改动 / daemon 未提供",clean:"工作区干净,无改动",back:"返回",loading:"正在加载 diff…",noDiff:"该文件没有行级改动",list:"列表",tree:"树形",close:"关闭"},mO={},gO={empty:"选择左侧文件预览",loading:"加载中…",lineCount:"{count} 行",copy:"复制",copied:"已复制",copyPath:"复制路径",openInEditor:"打开",reveal:"显示",download:"下载",close:"关闭",search:"搜索",prevMatch:"上一个匹配",nextMatch:"下一个匹配",htmlMode:"HTML 预览模式",markdownMode:"Markdown 预览模式",preview:"预览",source:"源码",imageFit:"图片缩放",fit:"适应",actual:"原始",pdfNoPreview:"无法内嵌预览此 PDF,可以下载后查看",imageNoPreview:"图片文件 · {mime} · {size} · 暂不预览",binaryNoPreview:"二进制文件 · {mime} · {size} 字节 · 暂不预览",unknownType:"未知类型",copyCode:"复制代码",enlargeImage:"放大图片",errors:{emptyPath:"文件路径为空",unsupportedPath:"不支持预览 URL 或远程路径",outsideWorkspace:"只能预览当前 workspace 内的文件",isDirectory:"请选择具体文件,而不是目录",loadFailed:"无法读取这个文件"}},vO={searching:"搜索中…",noMatch:"无匹配"},yO={dismiss:"关闭",errorLabel:"错误",noteLabel:"提示",details:{cause:"底层原因",code:"错误码",connection:"连接状态",contentType:"响应类型",details:"服务端详情",duration:"耗时",endpoint:"请求地址",errorName:"错误类型",message:"错误信息",operation:"操作",phase:"失败阶段",request:"请求",requestId:"Request ID",responsePreview:"响应预览",sessionId:"Session ID",stack:"堆栈",status:"HTTP 状态",timeout:"超时设置",timestamp:"时间"},daemonApiTitle:"Blun daemon 返回错误",daemonNetworkMessage:"Web 没有拿到本地服务的响应。请确认 Blun daemon 仍在运行,或刷新页面重试。",daemonNetworkTitle:"无法连接到 Blun daemon",diagnostics:"诊断信息",hideDetails:"收起详情",operationFailedMessage:"刚才的操作没有完成,请稍后重试。",operationFailedTitle:"操作失败",sessionSnapshotMessage:"Web 没能加载当前会话内容。请确认 Blun daemon 仍在运行,或刷新页面重试。",sessionSnapshotTitle:"无法加载当前会话内容",showDetails:"查看详情",copyDetails:"复制诊断信息",copied:"已复制",wsTitle:"实时连接出错",goal:{alreadyExists:"当前会话已有一个进行中的目标,请先取消它再创建新目标。",notFound:"没有找到可操作的目标,可能它已经结束或被取消。",statusInvalid:"当前目标状态不支持这个操作。",notResumable:"这个目标无法恢复(可能已取消或已完成)。",objectiveTooLong:"目标描述太长了,请精简后重试。"}},kO={help:{desc:"显示可用命令列表"},new:{desc:"创建新会话"},clear:{desc:"清空并新建会话"},model:{desc:"切换模型"},provider:{desc:"管理提供商 (添加/删除/刷新)"},login:{desc:"在浏览器中登录 Blun"},permission:{desc:"切换审批模式 (manual/auto/yolo)"},plan:{desc:"切换计划模式 开/关"},swarm:{desc:"切换 swarm 模式;/swarm <任务> 直接在 swarm 下执行"},goal:{desc:"创建/控制目标:/goal <目标>、/goal pause|resume|cancel"},btw:{desc:"侧边聊天:/btw <问题> 向 fork 的侧边会话提问"},yolo:{desc:"自动批准一切 (yolo 模式)"},auto:{desc:"自动批准安全的读写"},thinking:{desc:"设置思考强度"},compact:{desc:"压缩会话历史"},fork:{desc:"把当前会话 fork 出一个新会话"},undoNotImplemented:"daemon 尚未支持 /undo",status:{desc:"查看会话状态"},undo:{desc:"撤销上一条消息"}},bO={label:{read:"读取",bash:"运行",edit:"编辑",write:"写入",grep:"搜索",glob:"查找",ls:"列目录",web_fetch:"抓取",search:"搜索",todo:"待办",task:"任务"},chip:{lines:"{count} 行",results:"{count} 结果",edited:"已编辑",created:"已创建",todos:"{count} 项"},group:{title:"{count} 个工具调用",running:"运行中",error:"有失败",done:"已完成"}},_O={resizeHandleAria:"调整侧栏宽度",resizePreviewAria:"调整预览面板宽度",detailPanelAria:"详情面板"},wO={openSwitcher:"切换会话 / 工作区",openSettings:"会话设置",settingsTitle:"会话设置",groupSession:"当前会话",groupApp:"应用偏好",sheetLabel:"面板",closeSheet:"关闭",tapToCycle:"点击切换",running:"运行中",idle:"空闲",sessionCount:"{n} 个会话",newSession:"新建会话",permManualSub:"每个工具都确认",permAutoSub:"自动批准编辑",permYoloSub:"全部自动批准",planModeSub:"计划模式",swarmModeSub:"Swarm 模式"},SO={colorSchemeLabel:"明暗",light:"月之亮面",dark:"月之暗面",system:"跟随系统",accentLabel:"主题色",accentBlue:"蓝色",accentBlack:"黑色"},CO={title:"Welcome to Blun Web",subtitle:"Pick a few preferences — you can change them anytime in Settings.",languageLabel:"Language",start:"Get started",skip:"Skip",reopen:"Preferences / onboarding"},xO={title:"欢迎来使用 Blun Web",subtitle:"来选择一些你的偏好 —— 之后也可以在设置里随时修改。",languageLabel:"语言",start:"开始使用",skip:"跳过",reopen:"偏好 / 引导"},AO={title:"Settings",close:"Close (Esc)",tabs:{general:"General",agent:"Agent",account:"Account",advanced:"Advanced"},appearance:"Appearance",notifications:"Notifications",notifyOnComplete:"Notify when a turn completes",notifyOnQuestion:"Notify when a question needs an answer",soundOnComplete:"Play a sound when a turn completes or needs an answer",notifyDenied:"Blocked in browser settings",notifyBody:"Finished a turn",notifyQuestionBody:"A question is waiting for your answer",account:"Account",uiFontSize:"Font size",agentDefaults:"Agent defaults",providers:"Providers",providersHint:"Add, remove, or refresh providers",manageProviders:"Manage",saving:"Saving",defaultModel:"Default model",defaultModelHint:"New sessions prefer this model",noDefaultModel:"No default model",defaultPermission:"Default permission",defaultPermissionHint:"Only affects newly-created sessions",defaultThinking:"Thinking by default",defaultThinkingHint:"Whether new sessions start with thinking enabled",defaultPlanMode:"Plan mode by default",defaultPlanModeHint:"Whether new sessions start in plan mode",mergeSkills:"Merge all available skills",mergeSkillsHint:"Show project, plugin, and user skills together",telemetry:"Improve product with usage data",telemetryHint:"When on, we collect anonymous interaction data (such as clicks, interruptions, and feature usage) to improve the product experience. You can turn it off at any time.",telemetryRestartHint:"Takes effect after restarting the service.",credentialReady:"Credential configured",credentialMissing:"Missing credential",configUnavailable:"The server did not return config yet. These settings are unavailable.",advanced:"Advanced",build:"Build",serverVersion:"Server version",exportLog:"Troubleshooting log",logHint:"Enable with ?debug=1 to capture",exportLogBtn:"Export log",conversationToc:"Show conversation outline",conversationTocHint:"Show a clickable outline in the right margin to jump between messages"},TO={title:"设置",close:"关闭 (Esc)",tabs:{general:"通用",agent:"Agent",account:"账户",advanced:"高级"},appearance:"外观",notifications:"通知",notifyOnComplete:"会话完成时通知",notifyOnQuestion:"待回答时通知",soundOnComplete:"会话完成或待回答时播放提示音",notifyDenied:"已在浏览器设置中被阻止",notifyBody:"已完成一轮",notifyQuestionBody:"有提问等待你回答",account:"账户",uiFontSize:"字体大小",agentDefaults:"Agent 默认值",providers:"提供商",providersHint:"添加、删除或刷新提供商",manageProviders:"管理",saving:"保存中",defaultModel:"默认模型",defaultModelHint:"新会话会优先使用这个模型",noDefaultModel:"未设置默认模型",defaultPermission:"默认权限",defaultPermissionHint:"只影响之后新建的会话",defaultThinking:"默认开启思考",defaultThinkingHint:"新会话默认是否开启 thinking",defaultPlanMode:"默认计划模式",defaultPlanModeHint:"新会话默认进入 plan mode",mergeSkills:"合并所有可用 Skills",mergeSkillsHint:"让项目、插件和用户 Skills 一起出现在可用列表中",telemetry:"使用数据改进产品",telemetryHint:"开启后,我们会收集您的匿名交互数据(如点击、打断、功能使用等),用于改进产品体验。您可以随时关闭。",telemetryRestartHint:"更改后需重启服务生效。",credentialReady:"凭据已配置",credentialMissing:"缺少凭据",configUnavailable:"当前服务端没有返回 config,设置项暂不可用。",advanced:"高级",build:"构建",serverVersion:"服务端版本",exportLog:"故障排查日志",logHint:"加 ?debug=1 开启采集",exportLogBtn:"导出日志",conversationToc:"显示对话目录",conversationTocHint:"在右侧显示可点击跳转的对话目录"},MO={openInEditor:"Open in editor",openInEditorShort:"Open",chooseOpenApp:"Choose application",copyAll:"Copy all as Markdown",copyFinalSummary:"Copy final summary",copied:"Copied",copyPath:"Copy path",changed:"{n} changed",gitTooltip:"Open Files > Changed",detached:"detached",openPr:"Open pull request",options:"Options",copySessionId:"Copy Session ID",renameSession:"Rename",forkSession:"Fork session",archiveSession:"Archive"},EO={openInEditor:"在编辑器中打开",openInEditorShort:"打开",chooseOpenApp:"选择应用",copyAll:"复制全部对话为 Markdown",copyFinalSummary:"仅复制最终总结",copied:"已复制",copyPath:"复制路径",changed:"{n} 处改动",gitTooltip:"打开「文件 > 改动」",detached:"游离",openPr:"打开 Pull Request",options:"选项",copySessionId:"复制 Session ID",renameSession:"重命名",forkSession:"分叉会话",archiveSession:"归档"},IO={title:"Side chat",subtitle:"forked from this session",empty:"Ask a quick question on the side — it shares this session’s context.",placeholder:"Ask the side chat…",send:"Send"},$O={title:"侧边聊天",subtitle:"从当前会话 fork",empty:"在侧边随手问一句 —— 它共享当前会话的上下文。",placeholder:"问问侧边聊天…",send:"发送"},NO={en:{common:M8,app:E8,sidebar:I8,workspace:$8,conversation:N8,status:L8,composer:O8,login:P8,providers:R8,model:D8,sessions:B8,approval:F8,question:H8,tasks:W8,thinking:z8,diff:U8,fileTree:q8,filePreview:j8,mention:V8,warnings:K8,commands:G8,tools:Y8,layout:X8,mobile:Q8,theme:Z8,onboarding:CO,settings:AO,header:MO,sideChat:IO},zh:{common:J8,app:eO,sidebar:tO,workspace:nO,conversation:sO,status:oO,composer:iO,login:rO,providers:lO,model:aO,sessions:cO,approval:uO,question:dO,tasks:fO,thinking:pO,diff:hO,fileTree:mO,filePreview:gO,mention:vO,warnings:yO,commands:kO,tools:bO,layout:_O,mobile:wO,theme:SO,onboarding:xO,settings:TO,header:EO,sideChat:$O}},TA=[{code:"en",label:"English"},{code:"zh",label:"中文"}];function LO(){const e=Qn(Et.locale);return e==="en"||e==="zh"?e:globalThis.navigator?.language?.toLowerCase().startsWith("zh")?"zh":"en"}const Un=o5({legacy:!1,locale:LO(),fallbackLocale:"en",messages:NO});function MA(e){Un.global.locale.value=e,ts(Et.locale,e)}const Xa=Un.global.t,OO={read:"tools.label.read",bash:"tools.label.bash",edit:"tools.label.edit",multi_edit:"tools.label.edit",write:"tools.label.write",grep:"tools.label.grep",glob:"tools.label.glob",ls:"tools.label.ls",web_fetch:"tools.label.web_fetch",search:"tools.label.search",todo:"tools.label.todo",task:"tools.label.task"},PO={multiedit:"multi_edit",multiedits:"multi_edit",shell:"bash",run:"bash",exec:"bash",ripgrep:"grep",rg:"grep",find:"glob",fetch:"web_fetch",webfetch:"web_fetch",url_fetch:"web_fetch",urlfetch:"web_fetch",list:"ls",listdir:"ls",list_dir:"ls",todowrite:"todo",todo_write:"todo",todoread:"todo",todolist:"todo",todo_list:"todo",agent:"task",subagent:"task",websearch:"search",web_search:"search"};function Zl(e){const t=(e??"").trim().toLowerCase().replace(/[\s-]+/g,"_");return PO[t]??t}function id(e){const t=OO[Zl(e)];return t?Xa(t):e}const RO={read:"file-text",bash:"terminal",edit:"pencil",multi_edit:"pencil",write:"file-plus",grep:"search",search:"search",glob:"glob",ls:"folder",web_fetch:"globe",todo:"check-list",task:"sparkles"};function S0(e){const t=Zl(e);let n=RO[t];return!n&&(e??"").trim().toLowerCase().includes("skill")&&(n="bolt"),n?Ia(n,"sm"):""}const EA=80;function DO(e,t=EA){const n=e.trim();return n.length>t?n.slice(0,t-1)+"…":n}function BO(e,t){const n=e.trim();return!!(n===""||n==="{}"||n==="[]"||n==="null"||t&&Object.keys(t).length===0)}function FO(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function sn(e){return typeof e=="string"&&e.length>0?e:void 0}function Sl(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function HO(e){try{const t=new URL(e),n=t.pathname.split("/").filter(Boolean)[0];return n?`${t.host}/${n}`:t.host}catch{return e.replace(/^https?:\/\//,"")}}function ig(e){return sn(e.path)??sn(e.file_path)??sn(e.filePath)??sn(e.filename)}const WO=64;function Bu(e,t,n=!1){const s=(o,i=EA)=>n?o.trim():DO(o,i);try{const o=FO(t);if(!n&&BO(t,o))return"";const i=()=>s(t.replace(/^·\s*/,""));if(!o)return i();switch(Zl(e)){case"read":{const r=ig(o);if(!r)return i();const l=Sl(o.offset)??Sl(o.line_start)??Sl(o.start_line),a=Sl(o.limit)??Sl(o.length),c=Sl(o.line_end)??Sl(o.end_line)??(l!==void 0&&a!==void 0?l+a:void 0);return s(l!==void 0&&c!==void 0?`${r}:${l}-${c}`:l!==void 0?`${r}:${l}`:r)}case"write":{const r=ig(o);return r?s(`${r} ${Xa("tools.chip.created")}`):i()}case"edit":case"multi_edit":{const r=ig(o);return r?s(r):i()}case"bash":{const r=sn(o.command)??sn(o.cmd)??sn(o.script);return r?s(r,WO):i()}case"grep":case"search":{const r=sn(o.pattern)??sn(o.query)??sn(o.regex),l=sn(o.path)??sn(o.glob)??sn(o.include);return r&&l?s(`${r} in ${l}`):r?s(r):i()}case"glob":{const r=sn(o.pattern)??sn(o.glob)??sn(o.query),l=sn(o.path)??sn(o.cwd);return r&&l?s(`${r} in ${l}`):r?s(r):sn(o.path)?s(sn(o.path)):i()}case"ls":{const r=sn(o.path)??sn(o.dir)??sn(o.directory)??sn(o.cwd);return r?s(r):i()}case"web_fetch":{const r=sn(o.url)??sn(o.uri);return r?s(HO(r)):i()}case"todo":case"task":{const r=sn(o.description)??sn(o.title)??sn(o.prompt)??sn(o.name)??sn(o.subagent_type);if(r)return s(r);const l=Array.isArray(o.todos)?o.todos:Array.isArray(o.items)?o.items:void 0;return l?s(Xa("tools.chip.todos",{count:l.length})):i()}default:return i()}}catch{return t}}function zO(e){try{switch(Zl(e.name)){case"bash":return e.timing?e.timing:"";case"read":{if(e.output&&e.output.length>0){const t=e.output.length;return Xa("tools.chip.lines",{count:t})}return""}case"edit":case"multi_edit":case"write":{if(e.output){for(const n of e.output){const s=n.match(/\+(\d+).*[-−](\d+)/);if(s)return`+${s[1]} −${s[2]}`}const t=e.output.find(n=>/\d+/.test(n));if(t){const n=t.match(/\+(\d+)/),s=t.match(/[-−](\d+)/);if(n||s)return`${n?`+${n[1]}`:""} ${s?`−${s[1]}`:""}`.trim()}if(e.status!=="error")return Xa("tools.chip.edited")}return""}case"grep":case"search":return e.output&&e.output.length>0?Xa("tools.chip.results",{count:e.output.length}):"";default:return""}}catch{return""}}const UO=je({__name:"StatusDot",props:{status:{}},setup(e){const t=e;function n(o){switch(o){case"ok":case"done":case"completed":case"success":return"ok";case"error":case"failed":case"danger":return"error";case"running":case"working":case"in_progress":case"active":return"running";case"suspended":return"suspended";default:return"idle"}}const s=F(()=>n(t.status));return(o,i)=>(w(),N("span",{class:Re(["kw-dot",`kw-dot--${s.value}`]),"aria-hidden":"true"},null,2))}}),Fu=ut(UO,[["__scopeId","data-v-ed5cc9c3"]]),qO=["innerHTML"],jO={class:"a"},VO={key:0,class:"p"},KO={class:"rt"},GO=["aria-label"],YO={key:0,class:"tm"},XO=["inert"],QO={class:"bb-pad"},ZO=je({__name:"ToolRow",props:{status:{},icon:{default:""},name:{},arg:{default:""},time:{default:""},open:{type:Boolean,default:!1},expandable:{type:Boolean,default:!1},stacked:{type:Boolean,default:!1},stackPosition:{default:"single"}},emits:["toggle"],setup(e){return(t,n)=>(w(),N("div",{class:Re(["box",{open:e.open,stacked:e.stacked,err:e.status==="error","stack-first":e.stackPosition==="first","stack-middle":e.stackPosition==="middle","stack-last":e.stackPosition==="last"}])},[T("div",{class:"bh",onClick:n[0]||(n[0]=s=>t.$emit("toggle"))},[e.icon?(w(),N("span",{key:0,class:"gl",innerHTML:e.icon,"aria-hidden":"true"},null,8,qO)):ie("",!0),T("span",jO,R(e.name),1),oe(Ht,{text:e.arg},{default:_e(()=>[e.arg?(w(),N("span",VO,R(e.arg),1)):ie("",!0)]),_:1},8,["text"]),T("span",KO,[T("span",{class:Re(["status",e.status]),role:"status","aria-label":e.status},[e.status==="ok"?(w(),ve(Je,{key:0,name:"check",size:"sm"})):e.status==="error"?(w(),ve(Je,{key:1,name:"close",size:"sm"})):e.status==="suspended"?(w(),ve(Fu,{key:2,status:"suspended"})):(w(),ve(Fu,{key:3,status:"running"}))],10,GO),Cn(t.$slots,"trailing"),e.time?(w(),N("span",YO,R(e.time),1)):ie("",!0)]),e.expandable?(w(),ve(Je,{key:1,class:"car",name:e.open?"chevron-down":"chevron-right",size:"sm"},null,8,["name"])):ie("",!0)]),T("div",{class:Re(["bb",{open:e.open}]),inert:!e.open},[T("div",QO,[Cn(t.$slots,"default")])],10,XO)],2))}}),C0=ut(ZO,[["__scopeId","data-v-9eb13415"]]),JO={key:0,class:"at-type"},eP={key:1,class:"at-task"},tP={key:2,class:"bb-code"},nP=je({__name:"AgentTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff","openAgent"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(_){if(!_)return{};try{const g=JSON.parse(_);return{description:typeof g.description=="string"?g.description:void 0,subagentType:typeof g.subagent_type=="string"?g.subagent_type:void 0,prompt:typeof g.prompt=="string"?g.prompt:void 0}}catch{return{}}}const r=F(()=>i(s.tool.arg)),l=F(()=>!!s.tool.output&&s.tool.output.length>0),a=F(()=>!!r.value.prompt||!!r.value.subagentType||l.value),c=Z(s.tool.defaultExpanded===!0&&a.value),u=F(()=>s.tool.status),d=F(()=>id(s.tool.name)),p=F(()=>S0(s.tool.name)),h=F(()=>r.value.description||r.value.subagentType||""),f=Ut("resolveAgentTaskId"),m=F(()=>f?f(s.tool.id)!==void 0:!0);function b(){a.value&&(c.value=!c.value)}return Ke(()=>[s.tool.defaultExpanded,s.tool.output?.length,s.tool.status],()=>{s.tool.defaultExpanded===!0&&a.value&&(c.value=!0)}),(_,g)=>(w(),ve(C0,{status:u.value,icon:p.value,name:d.value,arg:c.value?"":h.value,time:e.tool.timing,open:c.value,expandable:a.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:b},{trailing:_e(()=>[m.value?(w(),N("button",{key:0,type:"button",class:"at-open",onClick:g[0]||(g[0]=vt(v=>o("openAgent",e.tool.id),["stop"]))},R(x(n)("tasks.openDetail")),1)):ie("",!0)]),default:_e(()=>[r.value.subagentType?(w(),N("div",JO,R(r.value.subagentType),1)):ie("",!0),r.value.prompt?(w(),N("div",eP,R(r.value.prompt),1)):ie("",!0),l.value?(w(),N("div",tP,[(w(!0),N(Le,null,nt(e.tool.output??[],(v,y)=>(w(),N("div",{key:y},R(v),1))),128))])):ie("",!0)]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),sP=ut(nP,[["__scopeId","data-v-a9aa31ca"]]),oP=1e6,O_=5e3;function P_(e){if(e==="")return[];const t=e.split(`
|
|
39
|
-
`);return t.at(-1)===""&&t.pop(),t}function iP(e,t){const n=P_(e),s=P_(t),o=n.length,i=s.length;if(o===0&&i===0)return[];if(o>O_||i>O_||(o+1)*(i+1)>oP)return null;const r=Array.from({length:o+1},()=>Array.from({length:i+1},()=>0));for(let h=1;h<=o;h++)for(let f=1;f<=i;f++)r[h][f]=n[h-1]===s[f-1]?r[h-1][f-1]+1:Math.max(r[h-1][f],r[h][f-1]);const l=[];let a=o,c=i;for(;a>0||c>0;)a>0&&c>0&&n[a-1]===s[c-1]?(l.push({type:"context",text:n[a-1]}),a--,c--):c>0&&(a===0||r[a][c-1]>=r[a-1][c])?(l.push({type:"add",text:s[c-1]}),c--):(l.push({type:"del",text:n[a-1]}),a--);l.reverse();const u=[];let d=1,p=1;for(const h of l)h.type==="context"?(u.push({type:"context",text:h.text,oldNo:d,newNo:p}),d++,p++):h.type==="add"?(u.push({type:"add",text:h.text,newNo:p}),p++):(u.push({type:"del",text:h.text,oldNo:d}),d++);return u}function rP(e){let t=0,n=0;for(const s of e)s.type==="add"?t++:s.type==="del"&&n++;return{added:t,removed:n}}function IA(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function $A(e){const t=Zl(e.name);if(t!=="edit"&&t!=="write")return null;const n=IA(e.arg);if(!n)return null;if(t==="edit"){if(n.replace_all===!0)return null;const s=typeof n.old_string=="string"?n.old_string:void 0,o=typeof n.new_string=="string"?n.new_string:void 0;return s===void 0||o===void 0?null:iP(s,o)}return null}function lP(e){const t=IA(e);return t&&typeof t.path=="string"?t.path:void 0}function aP(e,t){for(const n of e){const s=n.tools?.find(o=>o.id===t);if(s)return s}}const cP={key:0,class:"chip"},uP={key:0,class:"bb-summary"},dP={class:"bb-code"},fP={key:0,class:"bb-empty"},pP=je({__name:"EditTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff"],setup(e,{emit:t}){const n=e,s=t,o=F(()=>n.tool.status),i=F(()=>id(n.tool.name)),r=F(()=>S0(n.tool.name)),l=F(()=>Bu(n.tool.name,n.tool.arg)),a=F(()=>Bu(n.tool.name,n.tool.arg,!0)),c=F(()=>$A(n.tool)),u=F(()=>{const m=c.value;if(m&&n.tool.status!=="error"){const{added:b,removed:_}=rP(m);if(b||_)return`+${b} −${_}`}return""}),d=F(()=>!!n.tool.output&&n.tool.output.length>0),p=Z(!1),h=F(()=>d.value&&!n.toolDiffPanel);function f(){if(n.toolDiffPanel){s("openToolDiff",n.tool.id);return}d.value&&(p.value=!p.value)}return(m,b)=>(w(),ve(C0,{status:o.value,icon:r.value,name:i.value,arg:p.value?"":l.value,time:e.tool.timing,open:p.value,expandable:h.value||e.toolDiffPanel,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:f},{trailing:_e(()=>[u.value?(w(),N("span",cP,R(u.value),1)):ie("",!0)]),default:_e(()=>[a.value?(w(),N("div",uP,R(a.value),1)):ie("",!0),T("div",dP,[d.value?ie("",!0):(w(),N("div",fP,"Waiting for output…")),(w(!0),N(Le,null,nt(e.tool.output??[],(_,g)=>(w(),N("div",{key:g},R(_),1))),128))])]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),hP=ut(pP,[["__scopeId","data-v-
|
|
38
|
+
*/const qN="11.4.5";function jN(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(Pl().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(Pl().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Pl().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Pl().__INTLIFY_PROD_DEVTOOLS__=!1)}const Qs={UNEXPECTED_RETURN_TYPE:uN,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function po(e,...t){return fh(e,null,void 0)}const Uv=tl("__translateVNode"),qv=tl("__datetimeParts"),jv=tl("__numberParts"),pA=tl("__setPluralRules"),hA=tl("__injectWithOption"),Ra=tl("__dispose");function Pu(e){if(!en(e)||$i(e))return e;for(const t in e)if(Zo(e,t))if(!t.includes("."))en(e[t])&&Pu(e[t]);else{const n=t.split("."),s=n.length-1;let o=e,i=!1;for(let r=0;r<s;r++){if(n[r]==="__proto__")throw new Error(`unsafe key: ${n[r]}`);if(n[r]in o||(o[n[r]]=vn()),!en(o[n[r]])){i=!0;break}o=o[n[r]]}if(i||($i(o)?sA.includes(n[s])||delete e[t]:(o[n[s]]=e[t],delete e[t])),!$i(o)){const r=o[n[s]];en(r)&&Pu(r)}}return e}function k0(e,t){const{messages:n,__i18n:s,messageResolver:o,flatJson:i}=t,r=jt(n)?n:Yn(s)?vn():{[e]:vn()};if(Yn(s)&&s.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:a,resource:c}=l;a?(r[a]=r[a]||vn(),Cf(c,r[a])):Cf(c,r)}else pt(l)&&Cf(JSON.parse(l),r)}),o==null&&i)for(const l in r)Zo(r,l)&&Pu(r[l]);return r}function mA(e){return e.type}function gA(e,t,n){let s=en(t.messages)?t.messages:vn();"__i18nGlobal"in n&&(s=k0(e.locale.value,{messages:s,__i18n:n.__i18nGlobal}));const o=Object.keys(s);o.length&&o.forEach(i=>{e.mergeLocaleMessage(i,s[i])});{if(en(t.datetimeFormats)){const i=Object.keys(t.datetimeFormats);i.length&&i.forEach(r=>{e.mergeDateTimeFormat(r,t.datetimeFormats[r])})}if(en(t.numberFormats)){const i=Object.keys(t.numberFormats);i.length&&i.forEach(r=>{e.mergeNumberFormat(r,t.numberFormats[r])})}}}function d_(e){return oe(zr,null,e,0)}function Ru(){return Ls()}const f_="__INTLIFY_META__",p_=()=>[],VN=()=>!1;let h_=0;function m_(e){return((t,n,s,o)=>e(n,s,Ru()||void 0,o))}const KN=()=>{const e=Ru();let t=null;return e&&(t=mA(e)[f_])?{[f_]:t}:null};function dp(e={}){const{__root:t,__injectWithOption:n}=e,s=t===void 0,o=e.flatJson,i=cp?Z:Ql;let r=Jt(e.inheritLocale)?e.inheritLocale:!0;const l=i(t&&r?t.locale.value:pt(e.locale)?e.locale:Ou),a=i(t&&r?t.fallbackLocale.value:pt(e.fallbackLocale)||Yn(e.fallbackLocale)||jt(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:l.value),c=i(k0(l.value,e)),u=i(jt(e.datetimeFormats)?e.datetimeFormats:{[l.value]:{}}),d=i(jt(e.numberFormats)?e.numberFormats:{[l.value]:{}});let p=t?t.missingWarn:Jt(e.missingWarn)||lc(e.missingWarn)?e.missingWarn:!0,h=t?t.fallbackWarn:Jt(e.fallbackWarn)||lc(e.fallbackWarn)?e.fallbackWarn:!0,f=t?t.fallbackRoot:Jt(e.fallbackRoot)?e.fallbackRoot:!0,m=!!e.fallbackFormat,b=Pn(e.missing)?e.missing:null,_=Pn(e.missing)?m_(e.missing):null,g=Pn(e.postTranslation)?e.postTranslation:null,v=t?t.warnHtmlMessage:Jt(e.warnHtmlMessage)?e.warnHtmlMessage:!0,y=!!e.escapeParameter;const A=t?t.modifiers:jt(e.modifiers)?e.modifiers:{};let O=e.pluralRules||t&&t.pluralRules,$;$=(()=>{s&&s_(null);const ae={version:qN,locale:l.value,fallbackLocale:a.value,messages:c.value,modifiers:A,pluralRules:O,missing:_===null?void 0:_,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:!0,postTranslation:g===null?void 0:g,warnHtmlMessage:v,escapeParameter:y,messageResolver:e.messageResolver,messageCompiler:e.messageCompiler,__meta:{framework:"vue"}};ae.datetimeFormats=u.value,ae.numberFormats=d.value,ae.__datetimeFormatters=jt($)?$.__datetimeFormatters:void 0,ae.__numberFormatters=jt($)?$.__numberFormatters:void 0;const Te=IN(ae);return s&&s_(Te),Te})(),jc($,l.value,a.value);function E(){return[l.value,a.value,c.value,u.value,d.value]}const M=F({get:()=>l.value,set:ae=>{$.locale=ae,l.value=ae}}),L=F({get:()=>a.value,set:ae=>{$.fallbackLocale=ae,a.value=ae,jc($,l.value,ae)}}),S=F(()=>c.value),I=F(()=>u.value),P=F(()=>d.value);function D(){return Pn(g)?g:null}function W(ae){g=ae,$.postTranslation=ae}function z(){return b}function q(ae){ae!==null&&(_=m_(ae)),b=ae,$.missing=_}const Q=(ae,Te,Ve,tt,bt,kt)=>{E();let Tt;try{__INTLIFY_PROD_DEVTOOLS__,s||($.fallbackContext=t?EN():void 0),Tt=ae($)}finally{__INTLIFY_PROD_DEVTOOLS__,s||($.fallbackContext=void 0)}if(Ve!=="translate exists"&&rs(Tt)&&Tt===ph||Ve==="translate exists"&&!Tt){const[Pt,mt]=Te();return t&&f?tt(t):bt(Pt)}else{if(kt(Tt))return Tt;throw po(Qs.UNEXPECTED_RETURN_TYPE)}};function X(...ae){return Q(Te=>Reflect.apply(u_,null,[Te,...ae]),()=>zv(...ae),"translate",Te=>Reflect.apply(Te.t,Te,[...ae]),Te=>Te,Te=>pt(Te))}function fe(...ae){const[Te,Ve,tt]=ae;if(tt&&!en(tt))throw po(Qs.INVALID_ARGUMENT);return X(Te,Ve,as({resolvedMessage:!0},tt||{}))}function ye(...ae){return Q(Te=>Reflect.apply(i_,null,[Te,...ae]),()=>Hv(...ae),"datetime format",Te=>Reflect.apply(Te.d,Te,[...ae]),()=>up,Te=>pt(Te)||Yn(Te))}function Me(...ae){return Q(Te=>Reflect.apply(l_,null,[Te,...ae]),()=>Wv(...ae),"number format",Te=>Reflect.apply(Te.n,Te,[...ae]),()=>up,Te=>pt(Te)||Yn(Te))}function we(ae){return ae.map(Te=>pt(Te)||rs(Te)||Jt(Te)?d_(String(Te)):Te)}const Ue={normalize:we,interpolate:ae=>ae,type:"vnode"};function Fe(...ae){return Q(Te=>{let Ve;const tt=Te;try{tt.processor=Ue,Ve=Reflect.apply(u_,null,[tt,...ae])}finally{tt.processor=null}return Ve},()=>zv(...ae),"translate",Te=>Te[Uv](...ae),Te=>[d_(Te)],Te=>Yn(Te))}function rt(...ae){return Q(Te=>Reflect.apply(l_,null,[Te,...ae]),()=>Wv(...ae),"number format",Te=>Te[jv](...ae),p_,Te=>pt(Te)||Yn(Te))}function le(...ae){return Q(Te=>Reflect.apply(i_,null,[Te,...ae]),()=>Hv(...ae),"datetime format",Te=>Te[qv](...ae),p_,Te=>pt(Te)||Yn(Te))}function U(ae){O=ae,$.pluralRules=O}function G(ae,Te){return Q(()=>{if(!ae)return!1;const Ve=pt(Te)?Te:l.value,tt=pt(Te)?[Ve]:Fv($,a.value,Ve);for(let bt=0;bt<tt.length;bt++){const kt=J(tt[bt]);let Tt=$.messageResolver(kt,ae);if(Tt===null&&(Tt=kt[ae]),$i(Tt)||Go(Tt)||pt(Tt))return!0}return!1},()=>[ae],"translate exists",Ve=>Reflect.apply(Ve.te,Ve,[ae,Te]),VN,Ve=>Jt(Ve))}function ne(ae){let Te=null;const Ve=Fv($,a.value,l.value);for(let tt=0;tt<Ve.length;tt++){const bt=c.value[Ve[tt]]||{},kt=$.messageResolver(bt,ae);if(kt!=null){Te=kt;break}}return Te}function H(ae){const Te=ne(ae);return Te??(t?t.tm(ae)||{}:{})}function J(ae){return c.value[ae]||{}}function ce(ae,Te){if(o){const Ve={[ae]:Te};for(const tt in Ve)Zo(Ve,tt)&&Pu(Ve[tt]);Te=Ve[ae]}c.value[ae]=Te,$.messages=c.value}function te(ae,Te){c.value[ae]=c.value[ae]||{};const Ve={[ae]:Te};if(o)for(const tt in Ve)Zo(Ve,tt)&&Pu(Ve[tt]);Te=Ve[ae],Cf(Te,c.value[ae]),$.messages=c.value}function ue(ae){return u.value[ae]||{}}function j(ae,Te){u.value[ae]=Te,$.datetimeFormats=u.value,r_($,ae,Te)}function Y(ae,Te){u.value[ae]=as(u.value[ae]||{},Te),$.datetimeFormats=u.value,r_($,ae,Te)}function re(ae){return d.value[ae]||{}}function ge(ae,Te){d.value[ae]=Te,$.numberFormats=d.value,a_($,ae,Te)}function Ae(ae,Te){d.value[ae]=as(d.value[ae]||{},Te),$.numberFormats=d.value,a_($,ae,Te)}h_++,t&&cp&&(Ke(t.locale,ae=>{r&&(l.value=ae,$.locale=ae,jc($,l.value,a.value))}),Ke(t.fallbackLocale,ae=>{r&&(a.value=ae,$.fallbackLocale=ae,jc($,l.value,a.value))}));const Ie={id:h_,locale:M,fallbackLocale:L,get inheritLocale(){return r},set inheritLocale(ae){r=ae,ae&&t&&(l.value=t.locale.value,a.value=t.fallbackLocale.value,jc($,l.value,a.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:S,get modifiers(){return A},get pluralRules(){return O||{}},get isGlobal(){return s},get missingWarn(){return p},set missingWarn(ae){p=ae,$.missingWarn=p},get fallbackWarn(){return h},set fallbackWarn(ae){h=ae,$.fallbackWarn=h},get fallbackRoot(){return f},set fallbackRoot(ae){f=ae},get fallbackFormat(){return m},set fallbackFormat(ae){m=ae,$.fallbackFormat=m},get warnHtmlMessage(){return v},set warnHtmlMessage(ae){v=ae,$.warnHtmlMessage=ae},get escapeParameter(){return y},set escapeParameter(ae){y=ae,$.escapeParameter=ae},t:X,getLocaleMessage:J,setLocaleMessage:ce,mergeLocaleMessage:te,getPostTranslationHandler:D,setPostTranslationHandler:W,getMissingHandler:z,setMissingHandler:q,[pA]:U};return Ie.datetimeFormats=I,Ie.numberFormats=P,Ie.rt=fe,Ie.te=G,Ie.tm=H,Ie.d=ye,Ie.n=Me,Ie.getDateTimeFormat=ue,Ie.setDateTimeFormat=j,Ie.mergeDateTimeFormat=Y,Ie.getNumberFormat=re,Ie.setNumberFormat=ge,Ie.mergeNumberFormat=Ae,Ie[hA]=n,Ie[Uv]=Fe,Ie[qv]=le,Ie[jv]=rt,Ie}function GN(e){const t=pt(e.locale)?e.locale:Ou,n=pt(e.fallbackLocale)||Yn(e.fallbackLocale)||jt(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:t,s=Pn(e.missing)?e.missing:void 0,o=Jt(e.silentTranslationWarn)||lc(e.silentTranslationWarn)?!e.silentTranslationWarn:!0,i=Jt(e.silentFallbackWarn)||lc(e.silentFallbackWarn)?!e.silentFallbackWarn:!0,r=Jt(e.fallbackRoot)?e.fallbackRoot:!0,l=!!e.formatFallbackMessages,a=jt(e.modifiers)?e.modifiers:{},c=e.pluralizationRules,u=Pn(e.postTranslation)?e.postTranslation:void 0,d=pt(e.warnHtmlInMessage)?e.warnHtmlInMessage!=="off":!0,p=!!e.escapeParameterHtml,h=Jt(e.sync)?e.sync:!0;let f=e.messages;if(jt(e.sharedMessages)){const A=e.sharedMessages;f=Object.keys(A).reduce(($,k)=>{const E=$[k]||($[k]={});return as(E,A[k]),$},f||{})}const{__i18n:m,__root:b,__injectWithOption:_}=e,g=e.datetimeFormats,v=e.numberFormats,y=e.flatJson;return{locale:t,fallbackLocale:n,messages:f,flatJson:y,datetimeFormats:g,numberFormats:v,missing:s,missingWarn:o,fallbackWarn:i,fallbackRoot:r,fallbackFormat:l,modifiers:a,pluralRules:c,postTranslation:u,warnHtmlMessage:d,escapeParameter:p,messageResolver:e.messageResolver,inheritLocale:h,__i18n:m,__root:b,__injectWithOption:_}}function Vv(e={}){const t=dp(GN(e)),{__extender:n}=e,s={id:t.id,get locale(){return t.locale.value},set locale(o){t.locale.value=o},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(o){t.fallbackLocale.value=o},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get missing(){return t.getMissingHandler()},set missing(o){t.setMissingHandler(o)},get silentTranslationWarn(){return Jt(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(o){t.missingWarn=Jt(o)?!o:o},get silentFallbackWarn(){return Jt(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(o){t.fallbackWarn=Jt(o)?!o:o},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(o){t.fallbackFormat=o},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(o){t.setPostTranslationHandler(o)},get sync(){return t.inheritLocale},set sync(o){t.inheritLocale=o},get warnHtmlInMessage(){return t.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){t.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(o){t.escapeParameter=o},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t(...o){return Reflect.apply(t.t,t,[...o])},rt(...o){return Reflect.apply(t.rt,t,[...o])},te(o,i){return t.te(o,i)},tm(o){return t.tm(o)},getLocaleMessage(o){return t.getLocaleMessage(o)},setLocaleMessage(o,i){t.setLocaleMessage(o,i)},mergeLocaleMessage(o,i){t.mergeLocaleMessage(o,i)},d(...o){return Reflect.apply(t.d,t,[...o])},getDateTimeFormat(o){return t.getDateTimeFormat(o)},setDateTimeFormat(o,i){t.setDateTimeFormat(o,i)},mergeDateTimeFormat(o,i){t.mergeDateTimeFormat(o,i)},n(...o){return Reflect.apply(t.n,t,[...o])},getNumberFormat(o){return t.getNumberFormat(o)},setNumberFormat(o,i){t.setNumberFormat(o,i)},mergeNumberFormat(o,i){t.mergeNumberFormat(o,i)}};return s.__extender=n,s}function YN(e,t,n){return{beforeCreate(){const s=Ru();if(!s)throw po(Qs.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const i=o.i18n;if(o.__i18n&&(i.__i18n=o.__i18n),i.__root=t,this===this.$root)this.$i18n=g_(e,i);else{i.__injectWithOption=!0,i.__extender=n.__vueI18nExtend,this.$i18n=Vv(i);const r=this.$i18n;r.__extender&&(r.__disposer=r.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=g_(e,o);else{this.$i18n=Vv({__i18n:o.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:t});const i=this.$i18n;i.__extender&&(i.__disposer=i.__extender(this.$i18n))}else this.$i18n=e;o.__i18nGlobal&&gA(t,o,o),this.$t=(...i)=>this.$i18n.t(...i),this.$rt=(...i)=>this.$i18n.rt(...i),this.$te=(i,r)=>this.$i18n.te(i,r),this.$d=(...i)=>this.$i18n.d(...i),this.$n=(...i)=>this.$i18n.n(...i),this.$tm=i=>this.$i18n.tm(i),n.__setInstance(s,this.$i18n)},mounted(){},unmounted(){const s=Ru();if(!s)throw po(Qs.UNEXPECTED_ERROR);const o=this.$i18n;delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),n.__deleteInstance(s),delete this.$i18n}}}function g_(e,t){e.locale=t.locale||e.locale,e.fallbackLocale=t.fallbackLocale||e.fallbackLocale,e.missing=t.missing||e.missing,e.silentTranslationWarn=t.silentTranslationWarn||e.silentFallbackWarn,e.silentFallbackWarn=t.silentFallbackWarn||e.silentFallbackWarn,e.formatFallbackMessages=t.formatFallbackMessages||e.formatFallbackMessages,e.postTranslation=t.postTranslation||e.postTranslation,e.warnHtmlInMessage=t.warnHtmlInMessage||e.warnHtmlInMessage,e.escapeParameterHtml=t.escapeParameterHtml||e.escapeParameterHtml,e.sync=t.sync||e.sync,e.__composer[pA](t.pluralizationRules||e.pluralizationRules);const n=k0(e.locale,{messages:t.messages,__i18n:t.__i18n});return Object.keys(n).forEach(s=>e.mergeLocaleMessage(s,n[s])),t.datetimeFormats&&Object.keys(t.datetimeFormats).forEach(s=>e.mergeDateTimeFormat(s,t.datetimeFormats[s])),t.numberFormats&&Object.keys(t.numberFormats).forEach(s=>e.mergeNumberFormat(s,t.numberFormats[s])),e}const b0={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>e==="parent"||e==="global",default:"parent"},i18n:{type:Object}};function XN({slots:e},t){return t.length===1&&t[0]==="default"?(e.default?e.default():[]).reduce((s,o)=>[...s,...o.type===Le?o.children:[o]],[]):t.reduce((n,s)=>{const o=e[s];return o&&(n[s]=o()),n},vn())}function vA(){return Le}const QN=je({name:"i18n-t",props:as({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>rs(e)||!isNaN(e)}},b0),setup(e,t){const{slots:n,attrs:s}=t,o=e.i18n||It({useScope:e.scope,__useComponent:!0});return()=>{const i=()=>{const a=Object.keys(n).filter(d=>d[0]!=="_"),c=vn();e.locale&&(c.locale=e.locale),e.plural!==void 0&&(c.plural=pt(e.plural)?+e.plural:e.plural);const u=XN(t,a);return o[Uv](e.keypath,u,c)},r=as(vn(),s),l=pt(e.tag)||en(e.tag)?e.tag:vA();return en(l)?cn(l,r,{default:i}):cn(l,r,i())}}}),v_=QN;function ZN(e){return Yn(e)&&!pt(e[0])}function yA(e,t,n,s){const{slots:o,attrs:i}=t;return()=>{const r=()=>{const c={part:!0};let u=vn();e.locale&&(c.locale=e.locale),pt(e.format)?c.key=e.format:en(e.format)&&(pt(e.format.key)&&(c.key=e.format.key),u=Object.keys(e.format).reduce((h,f)=>n.includes(f)?as(vn(),h,{[f]:e.format[f]}):h,vn()));const d=s(e.value,c,u);let p=[c.key];return Yn(d)?p=d.map((h,f)=>{const m=o[h.type],b=m?m({[h.type]:h.value,index:f,parts:d}):[h.value];return ZN(b)&&(b[0].key=`${h.type}-${f}`),b}):pt(d)&&(p=[d]),p},l=as(vn(),i),a=pt(e.tag)||en(e.tag)?e.tag:vA();return en(a)?cn(a,l,{default:r}):cn(a,l,r())}}const JN=je({name:"i18n-n",props:as({value:{type:Number,required:!0},format:{type:[String,Object]}},b0),setup(e,t){const n=e.i18n||It({useScope:e.scope,__useComponent:!0});return yA(e,t,uA,(...s)=>n[jv](...s))}}),y_=JN;function e5(e,t){const n=e;if(e.mode==="composition")return n.__getInstance(t)||e.global;{const s=n.__getInstance(t);return s!=null?s.__composer:e.global.__composer}}function t5(e){const t=r=>{const{instance:l,value:a}=r;if(!l||!l.$)throw po(Qs.UNEXPECTED_ERROR);const c=e5(e,l.$),u=k_(a);return[Reflect.apply(c.t,c,[...b_(u)]),c]};return{created:(r,l)=>{const[a,c]=t(l);cp&&(r.__i18nWatcher=Ke(c.locale,()=>{l.instance&&l.instance.$forceUpdate()})),r.__composer=c,r.textContent=a},unmounted:r=>{cp&&r.__i18nWatcher&&(r.__i18nWatcher(),r.__i18nWatcher=void 0,delete r.__i18nWatcher),r.__composer&&(r.__composer=void 0,delete r.__composer)},beforeUpdate:(r,{value:l})=>{if(r.__composer){const a=r.__composer,c=k_(l);r.textContent=Reflect.apply(a.t,a,[...b_(c)])}},getSSRProps:r=>{const[l]=t(r);return{textContent:l}}}}function k_(e){if(pt(e))return{path:e};if(jt(e)){if(!("path"in e))throw po(Qs.REQUIRED_VALUE,"path");return e}else throw po(Qs.INVALID_VALUE)}function b_(e){const{path:t,locale:n,args:s,choice:o,plural:i}=e,r={},l=s||{};return pt(n)&&(r.locale=n),rs(o)&&(r.plural=o),rs(i)&&(r.plural=i),[t,l,r]}function n5(e,t,...n){const s=jt(n[0])?n[0]:{};(Jt(s.globalInstall)?s.globalInstall:!0)&&([v_.name,"I18nT"].forEach(i=>e.component(i,v_)),[y_.name,"I18nN"].forEach(i=>e.component(i,y_)),[S_.name,"I18nD"].forEach(i=>e.component(i,S_))),e.directive("t",t5(t))}const s5=tl("global-vue-i18n");function o5(e={}){const t=__VUE_I18N_LEGACY_API__&&Jt(e.legacy)?e.legacy:__VUE_I18N_LEGACY_API__,n=Jt(e.globalInjection)?e.globalInjection:!0,s=new Map,[o,i]=i5(e,t),r=tl("");function l(d){return s.get(d)||null}function a(d,p){s.set(d,p)}function c(d){s.delete(d)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},async install(d,...p){if(d.__VUE_I18N_SYMBOL__=r,d.provide(d.__VUE_I18N_SYMBOL__,u),jt(p[0])){const m=p[0];u.__composerExtend=m.__composerExtend,u.__vueI18nExtend=m.__vueI18nExtend}let h=null;!t&&n&&(h=f5(d,u.global)),__VUE_I18N_FULL_INSTALL__&&n5(d,u,...p),__VUE_I18N_LEGACY_API__&&t&&d.mixin(YN(i,i.__composer,u));const f=d.unmount;d.unmount=()=>{h&&h(),u.dispose(),f()}},get global(){return i},dispose(){o.stop()},__instances:s,__getInstance:l,__setInstance:a,__deleteInstance:c};return u}function It(e={}){const t=Ru();if(t==null)throw po(Qs.MUST_BE_CALL_SETUP_TOP);if(!t.isCE&&t.appContext.app!=null&&!t.appContext.app.__VUE_I18N_SYMBOL__)throw po(Qs.NOT_INSTALLED);const n=r5(t),s=a5(n),o=mA(t),i=l5(e,o);if(i==="global")return gA(s,e,o),s;if(i==="parent"){let a=__(n,t,e.__useComponent);return a==null&&(a=s),a}if(i==="isolated"){if(n.mode!=="composition")throw po(Qs.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);const a=n,c=as({},e),u=__(n,t);c.__root=u||s;const d=dp(c);return a.__composerExtend&&(d[Ra]=a.__composerExtend(d)),V1()&&K1(()=>{const h=d[Ra];h&&(h(),delete d[Ra])}),d}const r=n;let l=r.__getInstance(t);if(l==null){const a=as({},e);"__i18n"in o&&(a.__i18n=o.__i18n),s&&(a.__root=s),l=dp(a),r.__composerExtend&&(l[Ra]=r.__composerExtend(l)),u5(r,t,l),r.__setInstance(t,l)}return l}function i5(e,t){const n=$E(),s=__VUE_I18N_LEGACY_API__&&t?n.run(()=>Vv(e)):n.run(()=>dp(e));if(s==null)throw po(Qs.UNEXPECTED_ERROR);return[n,s]}function r5(e){const t=Ut(e.isCE?s5:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw po(e.isCE?Qs.NOT_INSTALLED_WITH_PROVIDE:Qs.UNEXPECTED_ERROR);return t}function l5(e,t){return dh(e)?"__i18n"in t?"local":"global":e.useScope?e.useScope:"local"}function a5(e){return e.mode==="composition"?e.global:e.global.__composer}function __(e,t,n=!1){let s=null;const o=t.root;let i=c5(t,n);for(;i!=null;){const r=e;if(e.mode==="composition")s=r.__getInstance(i);else if(__VUE_I18N_LEGACY_API__){const l=r.__getInstance(i);l!=null&&(s=l.__composer,n&&s&&!s[hA]&&(s=null))}if(s!=null||o===i)break;i=i.parent}return s}function c5(e,t=!1){return e==null?null:t&&e.vnode.ctx||e.parent}function u5(e,t,n){hn(()=>{},t),kn(()=>{const s=n;e.__deleteInstance(t);const o=s[Ra];o&&(o(),delete s[Ra])},t)}const d5=["locale","fallbackLocale","availableLocales"],w_=["t","rt","d","n","tm","te"];function f5(e,t){const n=Object.create(null);return d5.forEach(o=>{const i=Object.getOwnPropertyDescriptor(t,o);if(!i)throw po(Qs.UNEXPECTED_ERROR);const r=es(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,o,r)}),e.config.globalProperties.$i18n=n,w_.forEach(o=>{const i=Object.getOwnPropertyDescriptor(t,o);if(!i||!i.value)throw po(Qs.UNEXPECTED_ERROR);Object.defineProperty(e.config.globalProperties,`$${o}`,i)}),()=>{delete e.config.globalProperties.$i18n,w_.forEach(o=>{delete e.config.globalProperties[`$${o}`]})}}const p5=je({name:"i18n-d",props:as({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},b0),setup(e,t){const n=e.i18n||It({useScope:e.scope,__useComponent:!0});return yA(e,t,cA,(...s)=>n[qv](...s))}}),S_=p5;jN();CN(iN);xN(_N);AN(Fv);if(__INTLIFY_PROD_DEVTOOLS__){const e=Pl();e.__INTLIFY__=!0,rN(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const h5="modulepreload",m5=function(e){return"/"+e},C_={},Xs=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let r=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");o=r(n.map(c=>{if(c=m5(c),c in C_)return;C_[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":h5,u||(p.as="script"),p.crossOrigin="",p.href=c,a&&p.setAttribute("nonce",a),document.head.appendChild(p),u)return new Promise((h,f)=>{p.addEventListener("load",h),p.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return o.then(r=>{for(const l of r||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Et={permission:"king-web.permission",activeWorkspace:"blun-active-workspace",thinking:"king-web.thinking",planMode:"king-web.plan-mode",swarmMode:"king-web.swarm-mode",goalMode:"king-web.goal-mode",uiFontSize:"king-web.ui-font-size",starredModels:"king-web.starred-models",unread:"king-web.unread",onboarded:"king-web.onboarded",accent:"king-web.accent",colorScheme:"king-web.color-scheme",hiddenWorkspaces:"king-web.hidden-workspaces",collapsedWorkspaces:"king-web.collapsed-workspaces",showWorkspacePaths:"king-web.show-workspace-paths",workspaceOrder:"king-web.workspace-order",workspaceNameOverrides:"king-web.workspace-name-overrides",workspaceSort:"king-web.workspace-sort",conversationToc:"king-web.beta-toc",notifyOnComplete:"king-web.notify-on-complete",notifyOnQuestion:"king-web.notify-on-question",soundOnComplete:"king-web.sound-on-complete",inputHistory:"king-web.input-history",locale:"blun-locale",clientId:"king-web.client-id",debug:"king-web.debug",openInLastTarget:"king-web.open-in.last-target",sidebarCollapsed:"king-web.sidebar-collapsed",sidebarWidth:"king-web.sidebar-width",codeFont:"king-web.code-font",contentAlign:"king-web.content-align",theme:"king-web.theme"};function x_(e){return`king-web.draft.${e&&e.length>0?e:"__new__"}`}function Qn(e){try{return globalThis.localStorage.getItem(e)}catch{return null}}function ts(e,t){try{globalThis.localStorage.setItem(e,t)}catch{}}function cc(e){try{globalThis.localStorage.removeItem(e)}catch{}}function od(e){const t=Qn(e);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}function yc(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}function _0(){const e=Qn(Et.unread);if(!e)return{};try{const t=JSON.parse(e);if(!t||typeof t!="object")return{};const n={};for(const[s,o]of Object.entries(t))o===!0&&(n[s]=!0);return n}catch{return{}}}function w0(e){const n={..._0()};for(const[s,o]of Object.entries(e))o?n[s]=!0:delete n[s];ts(Et.unread,JSON.stringify(n))}function g5(){const e=od(Et.collapsedWorkspaces);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function sg(e){yc(Et.collapsedWorkspaces,Array.from(e))}function v5(){return od(Et.showWorkspacePaths)===!0}function y5(e){yc(Et.showWorkspacePaths,e)}function k5(){const e=od(Et.workspaceOrder);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function kA(e){yc(Et.workspaceOrder,Array.from(e))}function Zd(){const e=od(Et.workspaceNameOverrides);if(!e||typeof e!="object")return{};const t={};for(const[n,s]of Object.entries(e))typeof s=="string"&&(t[n]=s);return t}function A_(e){yc(Et.workspaceNameOverrides,e)}function b5(){return Qn(Et.workspaceSort)}function bA(e){ts(Et.workspaceSort,e)}const T_=Et.clientId,_5="blun-web",w5="web";function S5(){return{serverHttpUrl:x5(),clientId:E5(),clientName:_5,clientVersion:I5(),clientUiMode:w5}}function C5(){return typeof window<"u"&&window.location?.origin?window.location.origin:"http://127.0.0.1:58627"}function x5(e){const t=C5(),n=new URL(t);return n.pathname=n.pathname.replace(/\/v1\/?$/,"").replace(/\/$/,""),n.search="",n.hash="",n.toString().replace(/\/$/,"")}function A5(e){return e.replace(/^https?:\/\//,"").replace(/\/$/,"")}function T5(){const e=typeof window<"u"&&window.location?.origin?window.location.origin:"";return A5(e)}function cu(e,t){return`${e}/api/v1${t.startsWith("/")?t:`/${t}`}`}function M5(e,t){const n=new URL(`${e}/api/v1/ws`);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.searchParams.set("client_id",t),n.toString()}function E5(){const e=Qn(T_);if(e)return e;const t=`web_${globalThis.crypto?.randomUUID?.()||Math.random().toString(36).slice(2)}`;return ts(T_,t),t}function I5(){return"0.1.2".trim()?"0.1.2":"0.0.0-dev"}async function zs(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return $5(e)}function $5(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}function N5(e,t){if(e.length===0)return null;const n=new Set(e),s=t.filter(i=>n.has(i)),o=e.filter(i=>!t.includes(i));return o.length===0&&s.length===t.length?null:[...o,...s]}function L5(e,t){const n=new Map(t.map((s,o)=>[s,o]));return e.toSorted((s,o)=>(n.get(s.id)??-1)-(n.get(o.id)??-1))}function O5(e,t,n,s="before"){const o=e.indexOf(t),i=e.indexOf(n);if(o===-1||i===-1||o===i)return e;const r=[...e];r.splice(o,1);const l=o<i?i-1:i,a=s==="before"?l:l+1;return r.splice(a,0,t),r}function P5(e,t){return e.toSorted((n,s)=>(t.get(s.id)??Number.NEGATIVE_INFINITY)-(t.get(n.id)??Number.NEGATIVE_INFINITY))}const R5={"&":"&","<":"<",">":">",'"':""","'":"'"};function M_(e){return e.replace(/[&<>"']/g,t=>R5[t]??t)}function D5(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B5(e,t,n=40){const s=e.replace(/\s+/g," ").trim();if(s.length===0)return"";const o=t.trim();if(o.length===0)return E_(s,n*2);const i=s.toLowerCase().indexOf(o.toLowerCase());if(i<0)return E_(s,n*2);const r=Math.max(0,i-n),l=Math.min(s.length,i+o.length+n),a=r>0,c=l<s.length;return`${a?"…":""}${s.slice(r,l)}${c?"…":""}`}function E_(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function og(e,t){const n=M_(e),s=t.trim();if(s.length===0)return n;const o=new RegExp(D5(M_(s)),"gi");return n.replace(o,i=>`<mark>${i}</mark>`)}const Ea=Z(0),F5=["type","disabled","aria-label"],H5=je({__name:"IconButton",props:{size:{default:"md"},disabled:{type:Boolean},label:{},type:{default:"button"}},setup(e,{expose:t}){const n=Z();return t({el:n}),(s,o)=>(w(),N("button",{ref_key:"el",ref:n,class:Re(["ui-icon-button",`ui-icon-button--${e.size}`]),type:e.type,disabled:e.disabled,"aria-label":e.label},[Cn(s.$slots,"default",{},void 0,!0)],10,F5))}}),ut=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},gn=ut(H5,[["__scopeId","data-v-d7a3286c"]]),W5=Object.freeze({left:0,top:0,width:16,height:16}),_A=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),wA=Object.freeze({...W5,..._A}),she=Object.freeze({...wA,body:"",hidden:!1}),z5=Object.freeze({width:null,height:null}),U5=Object.freeze({...z5,..._A}),q5=/(-?[0-9.]*[0-9]+[0-9.]*)/g,j5=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function I_(e,t,n){if(t===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*t*n)/n;if(typeof e!="string")return e;const s=e.split(q5);if(s===null||!s.length)return e;const o=[];let i=s.shift(),r=j5.test(i);for(;;){if(r){const l=parseFloat(i);isNaN(l)?o.push(i):o.push(Math.ceil(l*t*n)/n)}else o.push(i);if(i=s.shift(),i===void 0)return o.join("");r=!r}}function V5(e,t="defs"){let n="";const s=e.indexOf("<"+t);for(;s>=0;){const o=e.indexOf(">",s),i=e.indexOf("</"+t);if(o===-1||i===-1)break;const r=e.indexOf(">",i);if(r===-1)break;n+=e.slice(o+1,i).trim(),e=e.slice(0,s).trim()+e.slice(r+1)}return{defs:n,content:e}}function K5(e,t){return e?"<defs>"+e+"</defs>"+t:t}function G5(e,t,n){const s=V5(e);return K5(s.defs,t+s.content+n)}const Y5=e=>e==="unset"||e==="undefined"||e==="none";function X5(e,t){const n={...wA,...e},s={...U5,...t},o={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,s].forEach(m=>{const b=[],_=m.hFlip,g=m.vFlip;let v=m.rotate;_?g?v+=2:(b.push("translate("+(o.width+o.left).toString()+" "+(0-o.top).toString()+")"),b.push("scale(-1 1)"),o.top=o.left=0):g&&(b.push("translate("+(0-o.left).toString()+" "+(o.height+o.top).toString()+")"),b.push("scale(1 -1)"),o.top=o.left=0);let y;switch(v<0&&(v-=Math.floor(v/4)*4),v=v%4,v){case 1:y=o.height/2+o.top,b.unshift("rotate(90 "+y.toString()+" "+y.toString()+")");break;case 2:b.unshift("rotate(180 "+(o.width/2+o.left).toString()+" "+(o.height/2+o.top).toString()+")");break;case 3:y=o.width/2+o.left,b.unshift("rotate(-90 "+y.toString()+" "+y.toString()+")");break}v%2===1&&(o.left!==o.top&&(y=o.left,o.left=o.top,o.top=y),o.width!==o.height&&(y=o.width,o.width=o.height,o.height=y)),b.length&&(i=G5(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const r=s.width,l=s.height,a=o.width,c=o.height;let u,d;r===null?(d=l===null?"1em":l==="auto"?c:l,u=I_(d,a/c)):(u=r==="auto"?a:r,d=l===null?I_(u,c/a):l==="auto"?c:l);const p={},h=(m,b)=>{Y5(b)||(p[m]=b.toString())};h("width",u),h("height",d);const f=[o.left,o.top,a,c];return p.viewBox=f.join(" "),{attributes:p,viewBox:f,body:i}}const SA={plus:{body:'<path fill="currentColor" d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/>',width:24,height:24},"chat-new":{body:'<path fill="currentColor" d="M14 3v2H4v13.385L5.763 17H20v-7h2v8a1 1 0 0 1-1 1H6.455L2 22.5V4a1 1 0 0 1 1-1zm5 0V0h2v3h3v2h-3v3h-2V5h-3V3z"/>',width:24,height:24},close:{body:'<path fill="currentColor" d="m12 10.587l4.95-4.95l1.414 1.414l-4.95 4.95l4.95 4.95l-1.415 1.414l-4.95-4.95l-4.949 4.95l-1.414-1.415l4.95-4.95l-4.95-4.95L7.05 5.638z"/>',width:24,height:24},check:{body:'<path fill="currentColor" d="m10 15.17l9.192-9.191l1.414 1.414L10 17.999l-6.364-6.364l1.414-1.414z"/>',width:24,height:24},search:{body:'<path fill="currentColor" d="m18.031 16.617l4.283 4.282l-1.415 1.415l-4.282-4.283A8.96 8.96 0 0 1 11 20c-4.968 0-9-4.032-9-9s4.032-9 9-9s9 4.032 9 9a8.96 8.96 0 0 1-1.969 5.617m-2.006-.742A6.98 6.98 0 0 0 18 11c0-3.867-3.133-7-7-7s-7 3.133-7 7s3.133 7 7 7a6.98 6.98 0 0 0 4.875-1.975z"/>',width:24,height:24},copy:{body:'<path fill="currentColor" d="M7 6V3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-3v3c0 .552-.45 1-1.007 1H4.007A1 1 0 0 1 3 21l.003-14c0-.552.45-1 1.006-1zM5.002 8L5 20h10V8zM9 6h8v10h2V4H9z"/>',width:24,height:24},link:{body:'<path fill="currentColor" d="m13.06 8.111l1.415 1.414a7 7 0 0 1 0 9.9l-.354.353a7 7 0 1 1-9.9-9.9l1.415 1.415a5 5 0 1 0 7.071 7.071l.354-.354a5 5 0 0 0 0-7.07l-1.415-1.415zm6.718 6.01l-1.414-1.414a5 5 0 0 0-7.071-7.07l-.354.353a5 5 0 0 0 0 7.07l1.415 1.415l-1.415 1.414l-1.414-1.414a7 7 0 0 1 0-9.9l.354-.353a7 7 0 1 1 9.9 9.9"/>',width:24,height:24},"external-link":{body:'<path fill="currentColor" d="M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"/>',width:24,height:24},download:{body:'<path fill="currentColor" d="M3 19h18v2H3zm10-5.828L19.071 7.1l1.414 1.414L12 17L3.515 8.515L4.929 7.1L11 13.173V2h2z"/>',width:24,height:24},undo:{body:'<path fill="currentColor" d="m5.828 7l2.536 2.535L6.95 10.95L2 6l4.95-4.95l1.414 1.415L5.828 5H13a8 8 0 1 1 0 16H4v-2h9a6 6 0 0 0 0-12z"/>',width:24,height:24},send:{body:'<path fill="currentColor" d="M13 7.828V20h-2V7.828l-5.364 5.364l-1.414-1.414L12 4l7.778 7.778l-1.414 1.414z"/>',width:24,height:24},image:{body:'<path fill="currentColor" d="M2.992 21A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993zM20 15V5H4v14L14 9zm0 2.828l-6-6L6.828 19H20zM8 11a2 2 0 1 1 0-4a2 2 0 0 1 0 4"/>',width:24,height:24},settings:{body:'<path fill="currentColor" d="M3.34 17a10 10 0 0 1-.979-2.326a3 3 0 0 0 .003-5.347a10 10 0 0 1 2.5-4.337a3 3 0 0 0 4.632-2.674a10 10 0 0 1 5.007.003a3 3 0 0 0 4.632 2.671a10.06 10.06 0 0 1 2.503 4.336a3 3 0 0 0-.002 5.347a10 10 0 0 1-2.501 4.337a3 3 0 0 0-4.632 2.674a10 10 0 0 1-5.007-.002a3 3 0 0 0-4.631-2.672A10 10 0 0 1 3.339 17m5.66.196a5 5 0 0 1 2.25 2.77q.75.07 1.499.002a5 5 0 0 1 2.25-2.772a5 5 0 0 1 3.526-.564q.435-.614.748-1.298A5 5 0 0 1 18 12c0-1.26.47-2.437 1.273-3.334a8 8 0 0 0-.75-1.298A5 5 0 0 1 15 6.804a5 5 0 0 1-2.25-2.77q-.75-.071-1.5-.001A5 5 0 0 1 9 6.804a5 5 0 0 1-3.526.564q-.436.614-.747 1.298A5 5 0 0 1 6 12c0 1.26-.471 2.437-1.273 3.334a8 8 0 0 0 .75 1.298A5 5 0 0 1 9 17.196M12 15a3 3 0 1 1 0-6a3 3 0 0 1 0 6m0-2a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/>',width:24,height:24},sliders:{body:'<path fill="currentColor" d="M6.17 18a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2v-2zm6-7a3.001 3.001 0 0 1 5.66 0H22v2h-4.17a3.001 3.001 0 0 1-5.66 0H2v-2zm-6-7a3.001 3.001 0 0 1 5.66 0H22v2H11.83a3.001 3.001 0 0 1-5.66 0H2V4zM9 6a1 1 0 1 0 0-2a1 1 0 0 0 0 2m6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/>',width:24,height:24},"log-in":{body:'<path fill="currentColor" d="M4 15h2v5h12V4H6v5H4V3a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm6-4V8l5 4l-5 4v-3H2v-2z"/>',width:24,height:24},"chevron-down":{body:'<path fill="currentColor" d="m12 13.171l4.95-4.95l1.414 1.415L12 16L5.636 9.636L7.05 8.222z"/>',width:24,height:24},"chevron-right":{body:'<path fill="currentColor" d="m13.172 12l-4.95-4.95l1.414-1.413L16 12l-6.364 6.364l-1.414-1.415z"/>',width:24,height:24},"arrow-up":{body:'<path fill="currentColor" d="M13 7.828V20h-2V7.828l-5.364 5.364l-1.414-1.414L12 4l7.778 7.778l-1.414 1.414z"/>',width:24,height:24},"arrow-down":{body:'<path fill="currentColor" d="m13 16.172l5.364-5.364l1.414 1.414L12 20l-7.778-7.778l1.414-1.414L11 16.172V4h2z"/>',width:24,height:24},"arrow-right":{body:'<path fill="currentColor" d="m16.172 11l-5.364-5.364l1.414-1.414L20 12l-7.778 7.778l-1.414-1.414L16.172 13H4v-2z"/>',width:24,height:24},minus:{body:'<path fill="currentColor" d="M5 11v2h14v-2z"/>',width:24,height:24},"panel-collapse":{body:'<path fill="currentColor" d="m15.071 4.929l1.414 1.414L11.83 11H21v2h-9.17l4.656 4.657l-1.414 1.414L8.001 12zm-11.07 14.07V5h2v14z"/>',width:24,height:24},"panel-expand":{body:'<path fill="currentColor" d="m17.172 11l-4.657-4.657l1.414-1.414L21 12l-7.071 7.071l-1.414-1.414L17.172 13H8v-2zM4 19V5h2v14z"/>',width:24,height:24},expand:{body:'<path fill="currentColor" d="M17.586 5H14V3h7v7h-2V6.414l-4.293 4.293l-1.414-1.414zM3 14h2v3.586l4.293-4.293l1.414 1.414L6.414 19H10v2H3z"/>',width:24,height:24},collapse:{body:'<path fill="currentColor" d="M15 4h-2v7h7V9h-3.586l4.293-4.293l-1.414-1.414L15 7.586zM4 15h3.586l-4.293 4.293l1.414 1.414L9 16.414V20h2v-7H4z"/>',width:24,height:24},list:{body:'<path fill="currentColor" d="M8 4h13v2H8zM4.5 6.5a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 7a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 6.9a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3M8 11h13v2H8zm0 7h13v2H8z"/>',width:24,height:24},sort:{body:'<path fill="currentColor" d="M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"/>',width:24,height:24},grip:{body:'<path fill="currentColor" d="M8.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m0 6.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0M15.5 7a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"/>',width:24,height:24},folder:{body:'<path fill="currentColor" d="M3 21a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414l2 2H20a1 1 0 0 1 1 1v3h-2V7h-7.414l-2-2H4v11.998L5.5 11h17l-2.31 9.243a1 1 0 0 1-.97.757zm16.938-8H7.062l-1.5 6h12.876z"/>',width:24,height:24},"folder-closed":{body:'<path fill="currentColor" d="M4 5v14h16V7h-8.414l-2-2zm8.414 0H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"/>',width:24,height:24},"folder-plus":{body:'<path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414zM4 5v14h16V7h-8.414l-2-2zm7 7V9h2v3h3v2h-3v3h-2v-3H8v-2z"/>',width:24,height:24},"folder-solid":{body:'<path fill="currentColor" d="M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"/>',width:24,height:24},file:{body:'<path fill="currentColor" d="M9 2.003V2h10.998C20.55 2 21 2.455 21 2.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8zM5.83 8H9V4.83zM11 4v5a1 1 0 0 1-1 1H5v10h14V4z"/>',width:24,height:24},"file-text":{body:'<path fill="currentColor" d="M21 8v12.993A1 1 0 0 1 20.007 22H3.993A.993.993 0 0 1 3 21.008V2.992C3 2.455 3.449 2 4.002 2h10.995zm-2 1h-5V4H5v16h14zM8 7h3v2H8zm0 4h8v2H8zm0 4h8v2H8z"/>',width:24,height:24},"file-plus":{body:'<path fill="currentColor" d="M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"/>',width:24,height:24},"file-off":{body:'<path fill="currentColor" d="M9 2.003V2h10.998C20.55 2 21 2.455 21 2.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 20.993V8zM5.83 8H9V4.83zM11 4v5a1 1 0 0 1-1 1H5v10h14V4z"/>',width:24,height:24},"image-off":{body:'<path fill="currentColor" d="M2.992 21A.993.993 0 0 1 2 20.007V3.993A1 1 0 0 1 2.992 3h18.016c.548 0 .992.445.992.993v16.014a1 1 0 0 1-.992.993zM20 15V5H4v14L14 9zm0 2.828l-6-6L6.828 19H20zM8 11a2 2 0 1 1 0-4a2 2 0 0 1 0 4"/>',width:24,height:24},code:{body:'<path fill="currentColor" d="m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"/>',width:24,height:24},terminal:{body:'<path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m1 2v14h16V5zm8 10h6v2h-6zm-3.333-3L5.838 9.172l1.415-1.415L11.495 12l-4.242 4.243l-1.415-1.415z"/>',width:24,height:24},pencil:{body:'<path fill="currentColor" d="m15.728 9.576l-1.414-1.414L5 17.476v1.414h1.414zm1.414-1.414l1.414-1.414l-1.414-1.414l-1.414 1.414zm-9.9 12.728H3v-4.243L16.435 3.212a1 1 0 0 1 1.414 0l2.829 2.829a1 1 0 0 1 0 1.414z"/>',width:24,height:24},glob:{body:'<path fill="currentColor" d="M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"/>',width:24,height:24},globe:{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.01 8.01 0 0 0 5.648 6.667M10.03 13c.151 2.439.848 4.73 1.97 6.752A15.9 15.9 0 0 0 13.97 13zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.01 8.01 0 0 0 19.938 13M4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333A8.01 8.01 0 0 0 4.062 11m5.969 0h3.938A15.9 15.9 0 0 0 12 4.248A15.9 15.9 0 0 0 10.03 11m4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.01 8.01 0 0 0-5.648-6.667"/>',width:24,height:24},"check-list":{body:'<path fill="currentColor" d="M8 4h13v2H8zm-5-.5h3v3H3zm0 7h3v3H3zm0 7h3v3H3zM8 11h13v2H8zm0 7h13v2H8z"/>',width:24,height:24},bolt:{body:'<path fill="currentColor" d="M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"/>',width:24,height:24},"git-pull-request":{body:'<path fill="currentColor" d="M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"/>',width:24,height:24},message:{body:'<path fill="currentColor" d="M6.455 19L2 22.5V4a1 1 0 0 1 1-1h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1zm-.692-2H20V5H4v13.385zM8 10h8v2H8z"/>',width:24,height:24},mail:{body:'<path fill="currentColor" d="M3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1m17 4.238l-7.928 7.1L4 7.216V19h16zM4.511 5l7.55 6.662L19.502 5z"/>',width:24,height:24},user:{body:'<path fill="currentColor" d="M4 22a8 8 0 1 1 16 0h-2a6 6 0 0 0-12 0zm8-9c-3.315 0-6-2.685-6-6s2.685-6 6-6s6 2.685 6 6s-2.685 6-6 6m0-2c2.21 0 4-1.79 4-4s-1.79-4-4-4s-4 1.79-4 4s1.79 4 4 4"/>',width:24,height:24},info:{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16M11 7h2v2h-2zm0 4h2v6h-2z"/>',width:24,height:24},"help-circle":{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-1-5h2v2h-2zm2-1.645V14h-2v-1.5a1 1 0 0 1 1-1a1.5 1.5 0 1 0-1.471-1.794l-1.962-.393A3.501 3.501 0 1 1 13 13.355"/>',width:24,height:24},"alert-triangle":{body:'<path fill="currentColor" d="m12.866 3l9.526 16.5a1 1 0 0 1-.866 1.5H2.474a1 1 0 0 1-.866-1.5L11.134 3a1 1 0 0 1 1.732 0m-8.66 16h15.588L12 5.5zM11 16h2v2h-2zm0-7h2v5h-2z"/>',width:24,height:24},clock:{body:'<path fill="currentColor" d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m1-8h4v2h-6V7h2z"/>',width:24,height:24},sparkles:{body:'<path fill="currentColor" d="M14 4.438A2.437 2.437 0 0 0 16.438 2h1.125A2.437 2.437 0 0 0 20 4.438v1.125A2.437 2.437 0 0 0 17.563 8h-1.125A2.437 2.437 0 0 0 14 5.563zM1 11a6 6 0 0 0 6-6h2a6 6 0 0 0 6 6v2a6 6 0 0 0-6 6H7a6 6 0 0 0-6-6zm3.876 1A8.04 8.04 0 0 1 8 15.124A8.04 8.04 0 0 1 11.124 12A8.04 8.04 0 0 1 8 8.876A8.04 8.04 0 0 1 4.876 12m12.374 2A3.25 3.25 0 0 1 14 17.25v1.5A3.25 3.25 0 0 1 17.25 22h1.5A3.25 3.25 0 0 1 22 18.75v-1.5A3.25 3.25 0 0 1 18.75 14z"/>',width:24,height:24},play:{body:'<path fill="currentColor" d="M19.376 12.416L8.777 19.482A.5.5 0 0 1 8 19.066V4.934a.5.5 0 0 1 .777-.416l10.599 7.066a.5.5 0 0 1 0 .832"/>',width:24,height:24},stop:{body:'<path fill="currentColor" d="M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1"/>',width:24,height:24},star:{body:'<path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"/>',width:24,height:24},"star-outline":{body:'<path fill="currentColor" d="m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"/>',width:24,height:24},"dots-horizontal":{body:'<path fill="currentColor" d="M4.5 10.5c-.825 0-1.5.675-1.5 1.5s.675 1.5 1.5 1.5S6 12.825 6 12s-.675-1.5-1.5-1.5m15 0c-.825 0-1.5.675-1.5 1.5s.675 1.5 1.5 1.5S21 12.825 21 12s-.675-1.5-1.5-1.5m-7.5 0c-.825 0-1.5.675-1.5 1.5s.675 1.5 1.5 1.5s1.5-.675 1.5-1.5s-.675-1.5-1.5-1.5"/>',width:24,height:24}},CA={sm:14,md:16,lg:20};function Q5(e){return`0 0 ${e.width??24} ${e.height??24}`}const Z5=Object.fromEntries(Object.entries(SA).map(([e,t])=>[e,{body:t.body,viewBox:Q5(t),fill:!0}]));function J5(e){return Z5[e]}function Ia(e,t="md"){const n=CA[t],s=X5(SA[e],{width:n,height:n}),o=s.attributes.viewBox;return`<svg class="kw-icon" width="${n}" height="${n}" viewBox="${o}" fill="currentColor" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">${s.body}</svg>`}const e8=["width","height","viewBox","aria-label","aria-hidden","innerHTML"],t8=["width","height","viewBox","aria-label","aria-hidden","innerHTML"],Je=je({__name:"Icon",props:{name:{},size:{default:"md"},label:{}},setup(e){const t=e,n=F(()=>J5(t.name)),s=F(()=>CA[t.size]),o=F(()=>n.value.viewBox??"0 0 16 16");return(i,r)=>n.value.fill?(w(),N("svg",{key:0,class:"kw-icon",width:s.value,height:s.value,viewBox:o.value,fill:"currentColor","aria-label":e.label,"aria-hidden":e.label?void 0:!0,xmlns:"http://www.w3.org/2000/svg",innerHTML:n.value.body},null,8,e8)):(w(),N("svg",{key:1,class:"kw-icon",width:s.value,height:s.value,viewBox:o.value,fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round","aria-label":e.label,"aria-hidden":e.label?void 0:!0,xmlns:"http://www.w3.org/2000/svg",innerHTML:n.value.body},null,8,t8))}}),n8={key:0,class:"ui-dialog__head"},s8={class:"ui-dialog__titles"},o8={key:0,class:"ui-dialog__title"},i8={key:1,class:"ui-dialog__desc"},r8={class:"ui-dialog__body"},l8={key:1,class:"ui-dialog__foot"},a8='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',c8=je({__name:"Dialog",props:{open:{type:Boolean},title:{},description:{},closeOnOverlay:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},size:{default:"md"},height:{default:"auto"},padded:{type:Boolean,default:!0}},emits:["update:open","close"],setup(e,{emit:t}){const n=e,s=t,o=Z(null);let i=null;function r(){s("update:open",!1),s("close")}function l(){return o.value?Array.from(o.value.querySelectorAll(a8)):[]}function a(u){if(!n.open)return;if(u.key==="Escape"&&n.closeOnEsc){u.preventDefault(),r();return}if(u.key!=="Tab")return;const d=l(),p=d[0],h=d[d.length-1];if(!p||!h){u.preventDefault(),o.value?.focus();return}const f=document.activeElement;u.shiftKey&&f===p?(u.preventDefault(),h.focus()):!u.shiftKey&&f===h&&(u.preventDefault(),p.focus())}function c(u){n.closeOnOverlay&&u.target===u.currentTarget&&r()}return Ke(()=>n.open,async u=>{u?(Ea.value+=1,i=document.activeElement,await ht(),(l()[0]??o.value)?.focus()):(Ea.value=Math.max(0,Ea.value-1),i instanceof HTMLElement&&(i.focus(),i=null))},{immediate:!0}),typeof window<"u"&&window.addEventListener("keydown",a),ls(()=>{typeof window<"u"&&window.removeEventListener("keydown",a),n.open&&(Ea.value=Math.max(0,Ea.value-1))}),(u,d)=>(w(),ve(lh,{to:"body"},[e.open?(w(),N("div",{key:0,class:"ui-dialog__overlay",onMousedown:c},[T("div",{ref_key:"panel",ref:o,class:Re(["ui-dialog",[`ui-dialog--${e.size}`,{"ui-dialog--flush":!e.padded,"ui-dialog--fixed-height":e.height==="fixed"}]]),role:"dialog","aria-modal":"true",tabindex:"-1"},[e.title||u.$slots.head?(w(),N("div",n8,[Cn(u.$slots,"head",{},()=>[T("div",s8,[e.title?(w(),N("div",o8,R(e.title),1)):ie("",!0),e.description?(w(),N("div",i8,R(e.description),1)):ie("",!0)])],!0),oe(gn,{class:"ui-dialog__close",size:"sm",label:"Close",onClick:r},{default:_e(()=>[oe(Je,{name:"close",size:"md"})]),_:1})])):ie("",!0),T("div",r8,[Cn(u.$slots,"default",{},void 0,!0)]),u.$slots.foot?(w(),N("div",l8,[Cn(u.$slots,"foot",{},void 0,!0)])):ie("",!0)],2)],32)):ie("",!0)]))}}),ar=ut(c8,[["__scopeId","data-v-711d4641"]]),u8={class:"sd-head"},d8=["placeholder","aria-label"],f8=["aria-selected","onClick","onMousemove"],p8={class:"sd-meta"},h8=["innerHTML"],m8={class:"sd-time"},g8=["innerHTML"],v8=["innerHTML"],y8={key:1,class:"sd-empty"},k8={class:"sd-hint"},b8=200,_8=je({__name:"SearchSessionsDialog",props:{sessions:{},activeId:{}},emits:["select","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z(!0),r=Z(""),l=Z(null),a=Z(null),c=F(()=>{const _=r.value.trim().toLowerCase(),g=[];for(const v of s.sessions){const y=v.title??"",A=v.lastPrompt??"",O=v.workspaceName??"",$=_.length>0&&y.toLowerCase().includes(_),k=_.length>0&&A.toLowerCase().includes(_),E=_.length>0&&O.toLowerCase().includes(_);if(!(_.length>0&&!$&&!k&&!E)&&(g.push({session:v,inTitle:$,inWorkspace:E,snippetText:A?B5(A,r.value):""}),g.length>=b8))break}return g}),u=Z(0);Ke(r,()=>{u.value=0});function d(_){const g=c.value.length;return g===0?0:Math.max(0,Math.min(g-1,_))}async function p(){await ht(),a.value?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}function h(_){u.value=d(u.value+_),p()}function f(_){o("select",_),o("close")}function m(){const _=c.value[u.value];_&&f(_.session.id)}function b(_){_.key==="ArrowDown"?(_.preventDefault(),h(1)):_.key==="ArrowUp"?(_.preventDefault(),h(-1)):_.key==="Enter"&&(_.preventDefault(),m())}return hn(()=>{l.value?.focus()}),(_,g)=>(w(),ve(ar,{open:i.value,"onUpdate:open":g[1]||(g[1]=v=>i.value=v),size:"lg",height:"fixed",padded:!1,onClose:g[2]||(g[2]=v=>o("close"))},{head:_e(()=>[T("div",u8,[oe(Je,{class:"sd-search-icon",name:"search",size:"md"}),Mn(T("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":g[0]||(g[0]=v=>r.value=v),class:"sd-input",type:"text",placeholder:x(n)("sidebar.searchPlaceholder"),"aria-label":x(n)("sidebar.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:b},null,40,d8),[[ko,r.value]])])]),foot:_e(()=>[T("span",k8,R(x(n)("sidebar.searchHint")),1)]),default:_e(()=>[T("div",{ref_key:"listRef",ref:a,class:"sd-list",role:"listbox"},[c.value.length>0?(w(!0),N(Le,{key:0},nt(c.value,(v,y)=>(w(),N("button",{key:v.session.id,class:Re(["sd-row",{on:y===u.value,active:v.session.id===e.activeId}]),role:"option","aria-selected":y===u.value,onClick:A=>f(v.session.id),onMousemove:A=>u.value=y},[T("span",p8,[oe(Je,{class:"sd-folder",name:"folder-closed",size:"sm"}),T("span",{class:"sd-ws",innerHTML:x(og)(v.session.workspaceName??v.session.workspaceId??"",v.inWorkspace?r.value:"")},null,8,h8),T("span",m8,R(v.session.time),1)]),T("span",{class:"sd-title",innerHTML:x(og)(v.session.title,v.inTitle?r.value:"")},null,8,g8),v.snippetText?(w(),N("span",{key:0,class:"sd-snippet",innerHTML:x(og)(v.snippetText,r.value)},null,8,v8)):ie("",!0)],42,f8))),128)):(w(),N("div",y8,R(x(n)("sidebar.searchNoResults")),1))],512)]),_:1},8,["open"]))}}),w8=ut(_8,[["__scopeId","data-v-a7cb130a"]]),S8=["aria-label"],C8=je({__name:"Spinner",props:{size:{default:"md"},label:{default:"Loading"}},setup(e){return(t,n)=>(w(),N("span",{class:Re(["ui-spinner",`ui-spinner--${e.size}`]),role:"status","aria-label":e.label},[...n[0]||(n[0]=[T("svg",{class:"ui-spinner__svg",viewBox:"0 0 24 24","aria-hidden":"true"},[T("circle",{class:"ui-spinner__track",cx:"12",cy:"12",r:"9"}),T("circle",{class:"ui-spinner__arc",cx:"12",cy:"12",r:"9"})],-1)])],10,S8))}}),ni=ut(C8,[["__scopeId","data-v-28680c63"]]),x8={key:0,class:"ui-badge__dot","aria-hidden":"true"},A8=je({__name:"Badge",props:{variant:{default:"neutral"},size:{default:"md"},dot:{type:Boolean}},setup(e){return(t,n)=>(w(),N("span",{class:Re(["ui-badge",[`ui-badge--${e.variant}`,`ui-badge--${e.size}`]])},[e.dot?(w(),N("span",x8)):ie("",!0),Cn(t.$slots,"default",{},void 0,!0)],2))}}),Is=ut(A8,[["__scopeId","data-v-35b44a94"]]),Du=Z(null);function xA(e){const t=Du.value;t&&(Du.value=null,t.resolve(e))}function T8(e){return Du.value&&xA(!1),new Promise(t=>{Du.value={...e,resolve:t}})}function ol(){return{current:Du,confirm:T8,settle:xA}}const M8=je({__name:"Menu",setup(e,{expose:t}){const n=Z();return t({el:n}),(s,o)=>(w(),N("div",{ref_key:"el",ref:n,class:"ui-menu",role:"menu"},[Cn(s.$slots,"default",{},void 0,!0)],512))}}),Wl=ut(M8,[["__scopeId","data-v-6acb3676"]]),E8={key:0,class:"ui-menu-sep",role:"separator"},I8=["disabled"],$8=je({__name:"MenuItem",props:{active:{type:Boolean},danger:{type:Boolean},disabled:{type:Boolean},separator:{type:Boolean},size:{default:"md"}},emits:["click"],setup(e){return(t,n)=>e.separator?(w(),N("div",E8)):(w(),N("button",{key:1,class:Re(["ui-menu-item",[`ui-menu-item--${e.size}`,{"is-active":e.active,"is-danger":e.danger}]]),type:"button",role:"menuitem",disabled:e.disabled,onClick:n[0]||(n[0]=s=>t.$emit("click",s))},[Cn(t.$slots,"default",{},void 0,!0)],10,I8))}}),fn=ut($8,[["__scopeId","data-v-ad741c5c"]]),kr=6,br=8,N8=150,L8=je({__name:"Tooltip",props:{text:{},placement:{default:"top"},maxWidth:{default:280},maxLines:{default:6}},setup(e){const t=e,n=Z(),s=Z(),o=Z(!1),i=Z(!1),r=Z({maxWidth:`${t.maxWidth}px`});let l,a=null,c;function u(){const m=s.value;if(!a||!m)return;const b=a.getBoundingClientRect(),_=m.offsetWidth,g=m.offsetHeight,v=window.innerWidth,y=window.innerHeight;let A=t.placement;A==="top"&&b.top-kr-g<br?A="bottom":A==="bottom"&&b.bottom+kr+g>y-br?A="top":A==="left"&&b.left-kr-_<br?A="right":A==="right"&&b.right+kr+_>v-br&&(A="left");let O=0,$=0;A==="top"?(O=b.top-kr-g,$=b.left+b.width/2-_/2):A==="bottom"?(O=b.bottom+kr,$=b.left+b.width/2-_/2):A==="left"?(O=b.top+b.height/2-g/2,$=b.left-kr-_):(O=b.top+b.height/2-g/2,$=b.right+kr),$=Math.min(Math.max($,br),v-br-_),O=Math.min(Math.max(O,br),y-br-g),r.value={maxWidth:`${t.maxWidth}px`,top:`${Math.round(O)}px`,left:`${Math.round($)}px`}}function d(){t.text&&(window.clearTimeout(l),l=window.setTimeout(()=>{o.value=!0,i.value=!1,ht(()=>{u(),i.value=!0})},N8))}function p(){window.clearTimeout(l),o.value=!1,i.value=!1}function h(){o.value&&p()}function f(m){m!==a&&(a&&(a.removeEventListener("mouseenter",d),a.removeEventListener("mouseleave",p),a.removeEventListener("focusin",d),a.removeEventListener("focusout",p)),a=m,a&&(a.addEventListener("mouseenter",d),a.addEventListener("mouseleave",p),a.addEventListener("focusin",d),a.addEventListener("focusout",p)))}return hn(()=>{const m=n.value??null;f(m?.firstElementChild??m),m&&(c=new MutationObserver(()=>{const b=m.firstElementChild??null;b!==a&&(p(),f(b??m))}),c.observe(m,{childList:!0})),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h)}),ls(()=>{window.clearTimeout(l),c?.disconnect(),f(null),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}),(m,b)=>(w(),N(Le,null,[T("span",{ref_key:"trigger",ref:n,class:"ui-tip"},[Cn(m.$slots,"default",{},void 0,!0)],512),(w(),ve(lh,{to:"body"},[Mn(T("div",{ref_key:"bubble",ref:s,class:Re(["ui-tip__bubble",{positioned:i.value}]),style:Gt([r.value,{"--tip-lines":e.maxLines}]),role:"tooltip"},R(e.text),7),[[Qo,o.value]])]))],64))}}),Ht=ut(L8,[["__scopeId","data-v-58d47a0a"]]),O8={class:"row"},P8={class:"lead","aria-hidden":"true"},R8={key:1,class:"unread-dot"},D8={class:"left"},B8=["onKeydown"],F8={class:"act"},H8={class:"ts"},W8={class:"menu-time"},z8=je({__name:"SessionRow",props:{session:{},active:{type:Boolean},approvalCount:{default:0},questionCount:{default:0},unread:{type:Boolean,default:!1}},emits:["select","rename","archive","fork"],setup(e,{expose:t,emit:n}){const{t:s}=It(),{confirm:o}=ol(),i=e,r=n;function l(S){const I=new Date(S);if(Number.isNaN(I.getTime()))return S;const P=D=>String(D).padStart(2,"0");return`${I.getFullYear()}-${P(I.getMonth()+1)}-${P(I.getDate())} ${P(I.getHours())}:${P(I.getMinutes())}`}const a=F(()=>i.session.updatedAt?l(i.session.updatedAt):i.session.time),c=Z(!1),u=Z(null),d=Z(null),p=Z({});function h(S){const I=S.target;d.value?.el?.contains(I)||u.value?.el?.contains(I)||b()}function f(){const S=u.value?.el;if(!S)return;const I=d.value?.el,P=S.getBoundingClientRect(),D=4,W=8,z=I?.offsetHeight??0,q=I?.offsetWidth??0;let Q=P.bottom+D;Q+z>window.innerHeight-W&&(Q=Math.max(W,P.top-z-D));let X=P.right-q;X<W&&(X=W),p.value={top:`${Math.round(Q)}px`,left:`${Math.round(X)}px`}}async function m(S){if(S.stopPropagation(),c.value){b();return}c.value=!0,setTimeout(()=>document.addEventListener("mousedown",h),0),window.addEventListener("resize",b),await ht(),f()}function b(){c.value=!1,document.removeEventListener("mousedown",h),window.removeEventListener("resize",b)}kn(()=>{document.removeEventListener("mousedown",h),window.removeEventListener("resize",b)});const _=Z(!1),g=Z(""),v=Z(null);async function y(){b(),_.value=!0,g.value=i.session.title,await ht();try{v.value?.focus(),v.value?.select()}catch{}}function A(){const S=g.value.trim();S&&r("rename",i.session.id,S),_.value=!1}function O(){_.value=!1}const $=Z(!1),k=Z(!1);async function E(){const S=await zs(i.session.id);$.value=S,k.value=!S,setTimeout(()=>{$.value=!1,k.value=!1,b()},1500)}function M(){b(),r("fork",i.session.id)}async function L(){b(),await o({title:s("sidebar.archive"),message:s("sidebar.archiveConfirm"),variant:"danger"})&&r("archive",i.session.id)}return t({closeMenu:b}),(S,I)=>(w(),N("div",{class:Re(["se",{on:e.active}]),onClick:I[4]||(I[4]=P=>r("select",e.session.id))},[T("div",O8,[T("span",P8,[e.session.busy?(w(),ve(ni,{key:0,size:"sm"})):e.unread?(w(),N("span",R8)):ie("",!0)]),T("div",D8,[_.value?Mn((w(),N("input",{key:0,ref_key:"renameInputRef",ref:v,"onUpdate:modelValue":I[0]||(I[0]=P=>g.value=P),class:"rename-input",onClick:I[1]||(I[1]=vt(()=>{},["stop"])),onKeydown:[di(vt(A,["stop"]),["enter"]),di(vt(O,["stop"]),["esc"])],onBlur:A},null,40,B8)),[[ko,g.value]]):(w(),N("span",{key:1,class:"t",onDblclick:vt(y,["stop"])},R(e.session.title),33))]),oe(Ht,{text:x(s)("workspace.awaitingAnswerTitle")},{default:_e(()=>[!_.value&&(e.questionCount>0||e.session.status==="awaitingQuestion")?(w(),ve(Is,{key:0,variant:"info",size:"sm"},{default:_e(()=>[qe(R(x(s)("workspace.awaitingAnswer")),1)]),_:1})):ie("",!0)]),_:1},8,["text"]),oe(Ht,{text:x(s)("workspace.awaitingPermissionTitle")},{default:_e(()=>[!_.value&&(e.approvalCount>0||e.session.status==="awaitingApproval")?(w(),ve(Is,{key:0,variant:"warning",size:"sm"},{default:_e(()=>[qe(R(x(s)("workspace.awaitingPermission")),1)]),_:1})):ie("",!0)]),_:1},8,["text"]),oe(Ht,{text:x(s)("workspace.abortedTitle")},{default:_e(()=>[!_.value&&e.session.status==="aborted"?(w(),ve(Is,{key:0,variant:"danger",size:"sm"},{default:_e(()=>[qe(R(x(s)("workspace.aborted")),1)]),_:1})):ie("",!0)]),_:1},8,["text"]),T("span",F8,[T("span",H8,R(e.session.time),1),_.value?ie("",!0):(w(),ve(gn,{key:0,ref_key:"kebabRef",ref:u,class:Re(["kebab",{open:c.value}]),size:"sm",label:x(s)("sidebar.options"),onClick:I[2]||(I[2]=vt(P=>m(P),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"sm"})]),_:1},8,["class","label"]))])]),(w(),ve(lh,{to:"body"},[c.value?(w(),ve(Wl,{key:0,ref_key:"menuRef",ref:d,class:"menu",style:Gt(p.value),onClick:I[3]||(I[3]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{danger:k.value,onClick:E},{default:_e(()=>[qe(R(k.value?x(s)("sidebar.copyFailed"):$.value?x(s)("sidebar.copied"):x(s)("sidebar.copySessionId")),1)]),_:1},8,["danger"]),oe(fn,{separator:""}),oe(fn,{onClick:y},{default:_e(()=>[qe(R(x(s)("sidebar.rename")),1)]),_:1}),oe(fn,{onClick:M},{default:_e(()=>[qe(R(x(s)("sidebar.fork")),1)]),_:1}),oe(fn,{danger:"",onClick:L},{default:_e(()=>[qe(R(x(s)("sidebar.archive")),1)]),_:1}),oe(fn,{separator:""}),T("div",W8,R(a.value),1)]),_:1},8,["style"])):ie("",!0)]))],2))}}),U8=ut(z8,[["__scopeId","data-v-9c7a681c"]]),q8={class:"gh-top"},j8={key:2,class:"gh-name"},V8={class:"gh-path"},K8=["inert"],G8=["disabled"],Y8={class:"show-more-label"},X8={class:"show-more-label"},Q8={key:2,class:"group-empty"},Z8=je({__name:"WorkspaceGroup",props:{group:{},activeWorkspaceId:{},activeId:{},renamingId:{},renameValue:{},renameInputRef:{},pendingBySession:{},unreadBySession:{},wsMenuOpenId:{},dragging:{type:Boolean},showPath:{type:Boolean},isCollapsed:{type:Function},isExpanded:{type:Function}},emits:["groupClick","groupContextmenu","toggleWsMenu","createInWorkspace","selectSession","renameSession","archiveSession","forkSession","loadMore","toggleExpand","confirmRename","cancelRename","updateRenameValue","wsDragstart","wsDragend"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=F({get:()=>s.renameValue,set:p=>o("updateRenameValue",p)}),r=F(()=>{if(s.isExpanded(s.group.workspace.id))return s.group.sessions;const p=s.group.sessions.slice(0,s.group.initialCount);if(s.activeId&&!p.some(h=>h.id===s.activeId)){const h=s.group.sessions.find(f=>f.id===s.activeId);if(h)return[...p,h]}return p}),l=F(()=>s.group.sessions.length>s.group.initialCount);function a(){return Math.max(0,s.group.workspace.sessionCount-s.group.sessions.length)}function c(){return s.group.sessions.length-s.group.initialCount}function u(p){s.renameInputRef.value=p instanceof HTMLInputElement?p:null}function d(p){p.dataTransfer&&(p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",s.group.workspace.id),o("wsDragstart",s.group.workspace.id))}return(p,h)=>(w(),N("div",{class:Re(["group",{dragging:e.dragging}])},[T("div",{class:Re(["gh",{on:e.group.workspace.id===e.activeWorkspaceId,collapsed:e.isCollapsed(e.group.workspace.id),"show-path":e.showPath}]),draggable:"true",onClick:h[7]||(h[7]=vt(f=>o("groupClick",e.group.workspace.id,f),["stop"])),onContextmenu:h[8]||(h[8]=f=>o("groupContextmenu",e.group.workspace,f)),onDragstart:d,onDragend:h[9]||(h[9]=f=>o("wsDragend"))},[T("div",q8,[e.isCollapsed(e.group.workspace.id)?(w(),ve(Je,{key:0,class:"gh-folder",name:"folder-closed",size:"sm"})):(w(),ve(Je,{key:1,class:"gh-folder",name:"folder",size:"sm"})),e.renamingId!==e.group.workspace.id?(w(),N("span",j8,R(e.group.workspace.name),1)):Mn((w(),N("input",{key:3,ref:u,"onUpdate:modelValue":h[0]||(h[0]=f=>i.value=f),class:"gh-rename",type:"text",onKeydown:[h[1]||(h[1]=di(f=>o("confirmRename"),["enter"])),h[2]||(h[2]=di(f=>o("cancelRename"),["esc"]))],onBlur:h[3]||(h[3]=f=>o("cancelRename")),onClick:h[4]||(h[4]=vt(()=>{},["stop"]))},null,544)),[[ko,i.value]]),oe(gn,{class:Re(["gh-more",{open:e.wsMenuOpenId===e.group.workspace.id}]),size:"sm",label:x(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":e.wsMenuOpenId===e.group.workspace.id,onClick:h[5]||(h[5]=vt(f=>o("toggleWsMenu",e.group.workspace,f),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"sm"})]),_:1},8,["class","label","aria-expanded"]),oe(gn,{class:"gh-add",size:"sm",label:x(n)("workspace.newInGroup"),onClick:h[6]||(h[6]=vt(f=>o("createInWorkspace",e.group.workspace.id),["stop"]))},{default:_e(()=>[oe(Je,{name:"chat-new"})]),_:1},8,["label"])]),oe(Ht,{text:e.group.workspace.root},{default:_e(()=>[T("div",V8,R(e.group.workspace.shortPath||e.group.workspace.root),1)]),_:1},8,["text"])],34),T("div",{class:Re(["group-sessions",{collapsed:e.isCollapsed(e.group.workspace.id)}]),inert:e.isCollapsed(e.group.workspace.id)},[(w(!0),N(Le,null,nt(r.value,f=>(w(),ve(U8,{key:f.id,session:f,active:f.id===e.activeId,"approval-count":e.pendingBySession[f.id]?.approvals??0,"question-count":e.pendingBySession[f.id]?.questions??0,unread:e.unreadBySession[f.id]??!1,onSelect:h[10]||(h[10]=m=>o("selectSession",m)),onRename:h[11]||(h[11]=(m,b)=>o("renameSession",m,b)),onArchive:h[12]||(h[12]=m=>o("archiveSession",m)),onFork:h[13]||(h[13]=m=>o("forkSession",m))},null,8,["session","active","approval-count","question-count","unread"]))),128)),e.group.hasMore||e.group.loadingMore?(w(),N("button",{key:0,class:"show-more",disabled:e.group.loadingMore,onClick:h[14]||(h[14]=vt(f=>o("loadMore",e.group.workspace.id),["stop"]))},[h[16]||(h[16]=T("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),T("span",Y8,R(e.group.loadingMore?x(n)("sidebar.loadingMore"):x(n)("sidebar.showMore",{count:a()})),1)],8,G8)):ie("",!0),l.value?(w(),N("button",{key:1,class:"show-more",onClick:h[15]||(h[15]=vt(f=>o("toggleExpand",e.group.workspace.id),["stop"]))},[h[17]||(h[17]=T("span",{class:"show-more-lead","aria-hidden":"true"},null,-1)),T("span",X8,R(e.isExpanded(e.group.workspace.id)?x(n)("sidebar.showLess"):x(n)("sidebar.showAll",{count:c()})),1)])):ie("",!0),e.group.sessions.length===0?(w(),N("div",Q8,R(x(n)("sidebar.noSessions")),1)):ie("",!0)],10,K8)],2))}}),J8=ut(Z8,[["__scopeId","data-v-e33fe64d"]]),eL="blun_desktop",tL="platform",$_="king-desktop",N_="king-desktop-platform";function nL(){let e=!1,t=null;try{const n=new URLSearchParams(window.location.search);n.has(eL)?(sessionStorage.setItem($_,"1"),e=!0):e=e||sessionStorage.getItem($_)==="1";const s=n.get(tL);s?(sessionStorage.setItem(N_,s),t=s):t=sessionStorage.getItem(N_)}catch{}return{isDesktop:e,platform:t}}const Kv=nL(),sL=Kv.isDesktop,AA=Kv.isDesktop&&Kv.platform==="darwin",oL=["aria-label"],iL=je({__name:"InternalBuildBanner",setup(e){const{t}=It(),n=sL;return(s,o)=>x(n)?(w(),N("span",{key:0,class:"internal-build-tag",role:"note","aria-label":x(t)("app.internalBuildBanner")},[o[0]||(o[0]=T("svg",{viewBox:"0 0 16 16",width:"11",height:"11",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[T("path",{d:"M8 2 14 13H2L8 2Z"}),T("path",{d:"M8 6v3.5"}),T("path",{d:"M8 11.5h.01"})],-1)),T("span",null,R(x(t)("app.internalBuildBanner")),1)],8,oL)):ie("",!0)}}),rL=ut(iL,[["__scopeId","data-v-19e33520"]]),lL={class:"ch"},aL={class:"ch-brand"},cL={class:"ch-name"},uL={key:0,class:"ch-endpoint"},dL={class:"search-input"},fL={key:0,class:"empty"},pL={class:"side-section-label"},hL={class:"side-section-title"},mL={class:"side-section-actions"},gL=["onDragover","onDrop"],vL={class:"section-menu-check"},yL={class:"section-menu-check"},kL={class:"section-menu-check"},bL=1e3,_L=je({__name:"Sidebar",props:{activeWorkspace:{default:null},activeWorkspaceId:{default:null},sessions:{},groups:{},activeId:{},workspaceSortMode:{},attentionBySession:{default:()=>({})},pendingBySession:{default:()=>({})},unreadBySession:{default:()=>({})},colWidth:{default:220}},emits:["select","create","createInWorkspace","selectWorkspace","addWorkspace","rename","archive","fork","renameWorkspace","deleteWorkspace","reorderWorkspaces","setWorkspaceSortMode","loadMoreSessions","loadAllSessions","openSettings","collapse"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=!1,i="",r=e,l=t,a=Z(!1);function c(){l("loadAllSessions"),a.value=!0}function u(Ge){(Ge.metaKey||Ge.ctrlKey)&&Ge.key.toLowerCase()==="k"&&(Ge.preventDefault(),c())}hn(()=>window.addEventListener("keydown",u)),ls(()=>window.removeEventListener("keydown",u));const d=Z(!1);function p(Ge){d.value=Ge.target.scrollTop>0}const h=Z(new Set(g5()));function f(Ge){return h.value.has(Ge)}function m(Ge){const Ye=new Set(h.value);Ye.has(Ge)?Ye.delete(Ge):Ye.add(Ge),h.value=Ye,sg(Ye)}function b(){const Ge=new Set(r.groups.map(Ye=>Ye.workspace.id));h.value=Ge,sg(Ge)}function _(){const Ge=new Set;h.value=Ge,sg(Ge)}const g=F(()=>r.groups.length>0&&r.groups.every(Ge=>h.value.has(Ge.workspace.id))),v=Z(new Set);function y(Ge){return v.value.has(Ge)}function A(Ge){const Ye=new Set(v.value);Ye.has(Ge)?Ye.delete(Ge):Ye.add(Ge),v.value=Ye}function O(Ge){if(!v.value.has(Ge)){const Ye=new Set(v.value);Ye.add(Ge),v.value=Ye}l("loadMoreSessions",Ge)}const $=Z(v5());function k(){$.value=!$.value,y5($.value)}const E=Z(null),M=Z(null);function L(Ge){E.value=Ge}function S(){E.value=null,M.value=null}function I(Ge){const Ye=Ge.currentTarget.getBoundingClientRect();return Ge.clientY<Ye.top+Ye.height/2?"before":"after"}function P(Ge,Ye){E.value===null||E.value===Ye||(Ge.preventDefault(),Ge.dataTransfer&&(Ge.dataTransfer.dropEffect="move"),M.value={id:Ye,position:I(Ge)})}function D(Ge){const Ye=E.value,Ct=M.value?.id===Ge?M.value.position:"before";if(M.value=null,E.value=null,!Ye||Ye===Ge)return;const $t=O5(r.groups.map(mn=>mn.workspace.id),Ye,Ge,Ct);l("reorderWorkspaces",$t)}function W(Ge,Ye){Ye.target.closest(".gh-more, .gh-add")||m(Ge)}function z(Ge){l("select",Ge)}const q=Z(null),Q=Z(""),X=Z(null);function fe(){return X}function ye(Ge,Ye){q.value=Ge,Q.value=Ye,ht().then(()=>X.value?.focus())}function Me(){const Ge=q.value,Ye=Q.value.trim();Ge&&Ye&&l("renameWorkspace",Ge,Ye),q.value=null}function we(){q.value=null}function ze(Ge){Q.value=Ge}const Ue=Z(!1),Fe=Z(null),rt=Z({}),le=Z(null);function U(Ge){le.value?.el&&!le.value.el.contains(Ge.target)&&ne()}function G(Ge,Ye){Ye.preventDefault(),Ye.stopPropagation(),Fe.value=Ge,rt.value={top:`${Ye.clientY}px`,left:`${Ye.clientX}px`},Ue.value=!0,document.addEventListener("mousedown",U,!0)}function ne(){Ue.value=!1,document.removeEventListener("mousedown",U,!0),Fe.value=null}function H(){Fe.value&&zs(Fe.value.root),ne()}function J(){Fe.value&&ye(Fe.value.id,Fe.value.name),ne()}async function ce(){const Ge=Fe.value;Ge&&(ne(),await s({title:n("sidebar.removeWorkspace"),message:n("workspace.removeWorkspaceConfirm",{name:Ge.name}),variant:"danger"})&&l("deleteWorkspace",Ge.id))}const te=Z(null),ue=Z(null),j=Z({}),Y=Z(null);function re(Ge){const Ye=Ge.target;Ye.closest(".gh-more")||Ye.closest(".ws-menu")||Ae()}async function ge(Ge,Ye){if(te.value===Ge.id){Ae();return}const Ct=Ye.currentTarget;ue.value=Ge,te.value=Ge.id,document.addEventListener("mousedown",re),window.addEventListener("resize",Ae),await ht();const $t=Y.value?.el,mn=Ct.getBoundingClientRect(),Nn=4,tn=8,Ln=$t?.offsetHeight??0,Zn=$t?.offsetWidth??0;let Mt=mn.bottom+Nn;Mt+Ln>window.innerHeight-tn&&(Mt=Math.max(tn,mn.top-Ln-Nn));let us=mn.right-Zn;us<tn&&(us=tn),j.value={top:`${Math.round(Mt)}px`,left:`${Math.round(us)}px`}}function Ae(){te.value=null,ue.value=null,document.removeEventListener("mousedown",re),window.removeEventListener("resize",Ae)}function Ie(Ge){zs(Ge.root),Ae()}function ae(Ge){ye(Ge.id,Ge.name),Ae()}async function Te(Ge){Ae(),await s({title:n("sidebar.removeWorkspace"),message:n("workspace.removeWorkspaceConfirm",{name:Ge.name}),variant:"danger"})&&l("deleteWorkspace",Ge.id)}const Ve=Z(!1),tt=Z({}),bt=Z(null);function kt(Ge){const Ye=Ge.target;Ye.closest(".side-section-kebab")||Ye.closest(".section-menu")||Pt()}async function Tt(Ge){if(Ve.value){Pt();return}const Ye=Ge.currentTarget;Ve.value=!0,document.addEventListener("mousedown",kt),window.addEventListener("resize",Pt),await ht();const Ct=bt.value?.el,$t=Ye.getBoundingClientRect(),mn=4,Nn=8,tn=Ct?.offsetHeight??0,Ln=Ct?.offsetWidth??0;let Zn=$t.bottom+mn;Zn+tn>window.innerHeight-Nn&&(Zn=Math.max(Nn,$t.top-tn-mn));let Mt=$t.right-Ln;Mt<Nn&&(Mt=Nn),tt.value={top:`${Math.round(Zn)}px`,left:`${Math.round(Mt)}px`}}function Pt(){Ve.value=!1,document.removeEventListener("mousedown",kt),window.removeEventListener("resize",Pt)}function mt(Ge){l("setWorkspaceSortMode",Ge),Pt()}function Yt(){k(),Pt()}ls(()=>{document.removeEventListener("mousedown",U,!0),document.removeEventListener("mousedown",re),document.removeEventListener("mousedown",kt),window.removeEventListener("resize",Ae),window.removeEventListener("resize",Pt)});const Rn=Z(null);let Dn;function Ft(){const Ge=Rn.value;Ge&&(Ge.classList.remove("blink-now"),Ge.getBoundingClientRect(),Ge.classList.add("blink-now"),clearTimeout(Dn),Dn=setTimeout(()=>Ge.classList.remove("blink-now"),300))}const bn=ui(()=>Xs(()=>import("./DesignSystemView-DwK1aQMo.js"),__vite__mapDeps([0,1]))),Vn=Z(!1);let st,In=!1;function _n(Ge){In=!1,clearTimeout(st),Ge.currentTarget.setPointerCapture?.(Ge.pointerId),st=setTimeout(()=>{In=!0,Vn.value=!0},bL)}function Kn(Ge){clearTimeout(st);const Ye=Ge.currentTarget;Ye.hasPointerCapture?.(Ge.pointerId)&&Ye.releasePointerCapture(Ge.pointerId)}function $n(){if(In){In=!1;return}Ft()}return ls(()=>{clearTimeout(st)}),(Ge,Ye)=>(w(),N(Le,null,[T("aside",{class:Re(["side",{"macos-desktop":x(AA)}])},[T("div",{class:"col",style:Gt({width:e.colWidth+"px"})},[T("div",lL,[T("div",aL,[(w(),N("svg",{ref_key:"logoRef",ref:Rn,class:Re(["ch-logo",{"is-dev":x(o)}]),viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BLUN King",onClick:$n,onPointerdown:_n,onPointerup:Kn,onPointercancel:Kn},[...Ye[21]||(Ye[21]=[c0('<defs data-v-2ced47c2><mask id="blunEyes" maskUnits="userSpaceOnUse" data-v-2ced47c2><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-2ced47c2></rect><g class="ch-eyes" fill="#000" data-v-2ced47c2><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-2ced47c2></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-2ced47c2></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#blunEyes)" data-v-2ced47c2></rect>',2)])],34)),T("span",cL,[Ye[22]||(Ye[22]=qe("BLUN King",-1)),x(o)?(w(),N("span",uL," · "+R(x(i)),1)):ie("",!0)]),oe(rL)]),oe(gn,{size:"sm",label:x(n)("sidebar.collapseSidebar"),onClick:Ye[0]||(Ye[0]=vt(Ct=>l("collapse"),["stop"]))},{default:_e(()=>[oe(Je,{name:"panel-collapse"})]),_:1},8,["label"]),oe(gn,{size:"sm",label:x(n)("settings.title"),onClick:Ye[1]||(Ye[1]=vt(Ct=>l("openSettings"),["stop"]))},{default:_e(()=>[oe(Je,{name:"settings"})]),_:1},8,["label"])]),T("button",{class:"search",type:"button",onClick:c},[oe(Je,{class:"search-icon",name:"search"}),T("span",dL,R(x(n)("sidebar.searchShortcut")),1)]),T("div",{class:Re(["btn-wrap",{"btn-wrap--scrolled":d.value}])},[T("button",{class:"btn-new-chat",type:"button",onClick:Ye[2]||(Ye[2]=vt(Ct=>l("create"),["stop"]))},[oe(Je,{name:"chat-new"}),T("span",null,R(x(n)("sidebar.newChat")),1)]),ie("",!0)],2),T("div",{class:"sessions",onScroll:p},[e.groups.length===0?(w(),N("div",fL,R(x(n)("workspace.noWorkspace")),1)):(w(),N(Le,{key:1},[T("div",pL,[T("span",hL,R(x(n)("sidebar.workspaces")),1),T("div",mL,[oe(gn,{class:"side-section-toggle",size:"sm",label:g.value?x(n)("sidebar.expandAll"):x(n)("sidebar.collapseAll"),onClick:Ye[4]||(Ye[4]=vt(Ct=>g.value?_():b(),["stop"]))},{default:_e(()=>[g.value?(w(),ve(Je,{key:0,name:"expand"})):(w(),ve(Je,{key:1,name:"collapse"}))]),_:1},8,["label"]),oe(gn,{class:"side-section-toggle side-section-kebab",size:"sm",label:x(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":Ve.value,onClick:Ye[5]||(Ye[5]=vt(Ct=>Tt(Ct),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal"})]),_:1},8,["label","aria-expanded"])])]),(w(!0),N(Le,null,nt(e.groups,Ct=>(w(),N("div",{key:Ct.workspace.id,class:Re(["ws-drop-target",{"drop-before":M.value?.id===Ct.workspace.id&&M.value.position==="before","drop-after":M.value?.id===Ct.workspace.id&&M.value.position==="after"}]),onDragover:$t=>P($t,Ct.workspace.id),onDrop:$t=>D(Ct.workspace.id)},[oe(J8,{group:Ct,"active-workspace-id":e.activeWorkspaceId,"active-id":e.activeId,"renaming-id":q.value,"rename-value":Q.value,"rename-input-ref":fe(),"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,"ws-menu-open-id":te.value,dragging:E.value===Ct.workspace.id,"is-collapsed":f,"is-expanded":y,"show-path":$.value,onGroupClick:W,onGroupContextmenu:G,onToggleWsMenu:ge,onCreateInWorkspace:Ye[6]||(Ye[6]=$t=>l("createInWorkspace",$t)),onSelectSession:z,onRenameSession:Ye[7]||(Ye[7]=($t,mn)=>l("rename",$t,mn)),onArchiveSession:Ye[8]||(Ye[8]=$t=>l("archive",$t)),onForkSession:Ye[9]||(Ye[9]=$t=>l("fork",$t)),onLoadMore:O,onToggleExpand:A,onConfirmRename:Me,onCancelRename:we,onUpdateRenameValue:ze,onWsDragstart:L,onWsDragend:S},null,8,["group","active-workspace-id","active-id","renaming-id","rename-value","rename-input-ref","pending-by-session","unread-by-session","ws-menu-open-id","dragging","show-path"])],42,gL))),128))],64))],32)],4),Ue.value?(w(),ve(Wl,{key:0,ref_key:"ghMenuRef",ref:le,class:"gh-menu",style:Gt(rt.value),onClick:Ye[10]||(Ye[10]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:H},{default:_e(()=>[qe(R(x(n)("sidebar.copyPath")),1)]),_:1}),oe(fn,{onClick:J},{default:_e(()=>[qe(R(x(n)("sidebar.rename")),1)]),_:1}),oe(fn,{danger:"",onClick:ce},{default:_e(()=>[qe(R(x(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ie("",!0),te.value!==null&&ue.value?(w(),ve(Wl,{key:1,ref_key:"wsMenuRef",ref:Y,class:"ws-menu",style:Gt(j.value),onClick:Ye[14]||(Ye[14]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:Ye[11]||(Ye[11]=Ct=>Ie(ue.value))},{default:_e(()=>[qe(R(x(n)("sidebar.copyPath")),1)]),_:1}),oe(fn,{separator:""}),oe(fn,{onClick:Ye[12]||(Ye[12]=Ct=>ae(ue.value))},{default:_e(()=>[qe(R(x(n)("sidebar.rename")),1)]),_:1}),oe(fn,{separator:""}),oe(fn,{danger:"",onClick:Ye[13]||(Ye[13]=Ct=>Te(ue.value))},{default:_e(()=>[qe(R(x(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ie("",!0),Ve.value?(w(),ve(Wl,{key:2,ref_key:"sectionMenuRef",ref:bt,class:"section-menu",style:Gt(tt.value),onClick:Ye[18]||(Ye[18]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:Ye[15]||(Ye[15]=Ct=>mt("manual"))},{default:_e(()=>[T("span",vL,[e.workspaceSortMode==="manual"?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),qe(" "+R(x(n)("sidebar.sortManual")),1)]),_:1}),oe(fn,{onClick:Ye[16]||(Ye[16]=Ct=>mt("recent"))},{default:_e(()=>[T("span",yL,[e.workspaceSortMode==="recent"?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),qe(" "+R(x(n)("sidebar.sortRecent")),1)]),_:1}),oe(fn,{separator:""}),oe(fn,{onClick:Ye[17]||(Ye[17]=Ct=>Yt())},{default:_e(()=>[T("span",kL,[$.value?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),qe(" "+R(x(n)("sidebar.showWorkspacePaths")),1)]),_:1})]),_:1},8,["style"])):ie("",!0),a.value?(w(),ve(w8,{key:3,sessions:e.sessions,"active-id":e.activeId,onSelect:z,onClose:Ye[19]||(Ye[19]=Ct=>a.value=!1)},null,8,["sessions","active-id"])):ie("",!0)],2),(w(),ve(lh,{to:"body"},[Vn.value?(w(),ve(x(bn),{key:0,onClose:Ye[20]||(Ye[20]=Ct=>Vn.value=!1)})):ie("",!0)]))],64))}}),wL=ut(_L,[["__scopeId","data-v-2ced47c2"]]);function SL(e){try{const t=Qn(e);if(t===null)return null;const n=Number(t);return Number.isFinite(n)?n:null}catch{return null}}function CL(e,t){try{ts(e,String(t))}catch{}}function xL(e){const{storageKey:t,defaultWidth:n,min:s,max:o,reverse:i=!1}=e;function r(_){return Number.isFinite(_)?Math.min(RC(o),Math.max(s,Math.round(_))):n}const l=Z(r(SL(t)??n)),a=Z(!1);function c(_){const g=r(_);l.value=g,CL(t,g)}let u=0,d=0,p=null,h=-1;function f(_){if(!a.value)return;const g=_.clientX-u;c(d+(i?-g:g))}function m(){if(a.value){if(a.value=!1,typeof document<"u"&&(document.body.style.userSelect="",document.body.style.cursor=""),p){try{p.releasePointerCapture(h)}catch{}p.removeEventListener("pointermove",f),p.removeEventListener("pointerup",m),p.removeEventListener("pointercancel",m)}p=null,h=-1}}function b(_){_.preventDefault(),a.value=!0,u=_.clientX,d=r(l.value),p=_.currentTarget,h=_.pointerId,typeof document<"u"&&(document.body.style.userSelect="none",document.body.style.cursor="col-resize");try{p.setPointerCapture(h)}catch{}p.addEventListener("pointermove",f),p.addEventListener("pointerup",m),p.addEventListener("pointercancel",m)}return ls(m),{width:l,dragging:a,clamp:r,setWidth:c,onPointerDown:b}}const AL=["aria-label"],TL=je({__name:"ResizeHandle",props:{storageKey:{},defaultWidth:{},min:{},max:{},reverse:{type:Boolean},ariaLabel:{}},emits:["update:width","update:dragging"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),{width:i,dragging:r,onPointerDown:l}=xL({storageKey:n.storageKey,defaultWidth:n.defaultWidth,min:n.min,max:()=>n.max,reverse:n.reverse});return s("update:width",i.value),Ke(i,a=>s("update:width",a)),Ke(r,a=>s("update:dragging",a)),(a,c)=>(w(),N("div",{class:Re(["rh",{dragging:x(r)}]),role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel??x(o)("layout.resizeHandleAria"),onPointerdown:c[0]||(c[0]=(...u)=>x(l)&&x(l)(...u))},[...c[1]||(c[1]=[T("span",{class:"rh-bar","aria-hidden":"true"},null,-1)])],42,AL))}}),L_=ut(TL,[["__scopeId","data-v-6e315812"]]),ML={preview:"Preview",confirm:"Confirm",cancel:"Cancel"},EL={authBannerMessage:"Not signed in · Sign in to BLUN King to start a conversation",authBannerLogin:"Sign in",authPageTitle:"Sign in to BLUN King",authPageMessage:"Connect your BLUN King account before starting or continuing conversations.",authPageLogin:"Sign in",connecting:"Connecting…",internalBuildBanner:"Internal testing only"},IL={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"Workspaces",sortWorkspaces:"Sort workspaces",sortManual:"Manual",sortRecent:"Last edited",collapseAll:"Collapse all workspaces",expandAll:"Expand all workspaces",showWorkspacePaths:"Show workspace paths",newSession:"New Session",newChat:"New Chat",newWorkspace:"New Workspace",emptyState:"No sessions yet · click New Session to start",archiveConfirm:"Archive session?",options:"Options",rename:"Rename",copyPath:"Copy path",copySessionId:"Copy session ID",copied:"Copied ✓",copyFailed:"Copy failed",archive:"Archive",fork:"Fork session",delete:"Delete",removeWorkspace:"Remove workspace",brand:"BLUN King",signedIn:"Signed in",signOut:"Sign out",notSignedIn:"Not signed in",signIn:"Sign in",language:"Language",daemon:"Daemon",noSessions:"No conversations yet",showMore:"Load more ({count})",showLess:"Show less",showAll:"Show all ({count})",loadingMore:"Loading…",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",searchPlaceholder:"Search sessions",searchShortcut:"Search sessions (⌘K)",searchHint:"↑↓ navigate · ↵ open · Esc close",searchNoResults:"No matching sessions"},$L={switcherTitle:"Switch workspace",switchTooltip:"Switch workspace",eyebrow:"Workspace",branchLabel:"branch: {branch}",noBranch:"no branch",sessionCount:"{count} session | {count} sessions",allWorkspaces:"All workspaces",currentWorkspace:"Current workspace only",addWorkspace:"Add workspace…",noWorkspace:"No workspace",deleteHasSessions:"This workspace still has sessions — archive them before deleting it",removeWorkspaceConfirm:'Remove workspace "{name}"?',swarmEnableConfirm:"Enable swarm mode? The agent will run multiple sub-agents in parallel.",goalStartConfirm:'Start goal: "{objective}"? The agent will run autonomously toward it.',scopeCurrent:"this workspace",scopeAll:"all workspaces",newInGroup:"New session in this workspace",addTitle:"Add workspace",pathLabel:"Path",pathPlaceholder:"/absolute/path/to/project",recentLabel:"Recent folders",add:"Add",cancel:"Cancel",addHint:"Paste an absolute folder path, or pick a recent one.",addFailed:"Couldn't open this folder. Check the path and try again.",openThisFolder:"Open this folder",up:"Up",browsing:"Browsing…",filterPlaceholder:"Filter subfolders…",searchPlaceholder:"Fuzzy-search under this folder…",searching:"Searching…",pasteToggle:"Enter an absolute path",noFilterMatch:"No subfolders match “{q}”",noSubfolders:"No subfolders here",gitTag:"git",browseHint:'Click a folder to enter it, then "Open this folder" to add it as a workspace.',attentionTitle:"{count} item needs your attention | {count} items need your attention",awaitingAnswer:"Answer",awaitingAnswerTitle:"A question is waiting for your answer",awaitingPermission:"Approve",awaitingPermissionTitle:"An action is waiting for your approval",aborted:"Stopped",abortedTitle:"This session was interrupted before finishing"},NL={jumpToLatestAria:"Jump to latest message",toc:"Conversation outline",newMessages:"Latest messages",loading:"Loading…",emptyWorkspaceHint:"Send in {name}",switchWorkspace:"Switch workspace",addWorkspace:"New workspace",moreWorkspaces:"More workspaces ({count})",compacting:"Compacting context…",compactedPlain:"Context compacted",compactedAuto:"Context auto-compacted",compactedTokens:" ({before} → {after} tokens)",viewSummary:"View summary",summaryTitle:"Compaction summary",manuallyAborted:"Manually stopped",activatedSkill:"Activated skill: {name}",undo:"Undo",undoTooltip:"Undoing the conversation will not roll back code changes",undoConfirm:"Undo last message?",yesterday:"Yesterday",loadOlder:"Load earlier messages",loadingOlder:"Loading earlier messages…"},LL={connectionConnected:"Connected",connectionConnecting:"Connecting…",connectionDisconnected:"Disconnected",ctxTooltip:"Used {used} / {max} tokens ({pct}%)",modelLabel:"Model",permissionManual:"Manual",permissionAuto:"Auto",permissionYolo:"YOLO",permissionManualDesc:"Ask for approval on every tool action",permissionAutoDesc:"Fully autonomous — agent decides everything without asking",permissionYoloDesc:"Auto-approve tool actions, but agent may still ask questions",planLabel:"Plan",planOn:"on",planOff:"off",planTooltip:"Toggle plan mode (research before editing)",modesLabel:"Mode",goalLabel:"Goal",swarmLabel:"Swarm",modeOff:"Off",goalPlaceholder:"What should the agent achieve?",goalStart:"Start",goalPause:"Pause",goalResume:"Resume",goalCancel:"Cancel",modeNotSupported:"Not supported",thinkingLabel:"thinking",thinkingTooltip:"Toggle thinking mode",starredModels:"Starred",moreModels:"More models…",statusPanelTitle:"Session status",statusPanelClose:"Close",statusModel:"Model",statusThinking:"Thinking",statusPermission:"Permission",statusPlanMode:"Plan mode",statusSwarmMode:"Swarm mode",swarmOn:"on",swarmOff:"off",statusContext:"Context",statusCost:"Cost",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"Running…",activityAwaitingApproval:"Awaiting approval",activityAwaitingQuestion:"Awaiting answer",interrupt:"Interrupt",runningShort:"in progress"},OL={placeholder:"Type a message…",send:"Send ↵",queueLabel:"Queue",placeholderRunning:"Press Enter to queue · Ctrl+S to inject into the running turn",queueAutoDrain:"sends automatically when the current turn ends",queueNext:"Up next",queueDragTitle:"Drag to reorder",editQueued:"Edit (load back into the input)",queuedImageOnly:"image ×{n}",queuedHasImage:"Contains {n} image(s) — remove only, not editable",remove:"Remove",removeNamed:"Remove {name}",uploading:"Uploading",uploadFailed:"Upload failed",attachImage:"Attach image",previewAttachment:"Preview {name}",interrupt:"Interrupt",interruptTitle:"Interrupt current operation",expandTitle:"Expand input for multi-line editing",collapseTitle:"Collapse input",emptyConversationTitle:"BLUN King",emptyConversation:"No messages yet — type below to start the conversation",quickStartPlaceholder:"Type a message to start a new conversation…",thinkingSuffix:" · thinking",thinkingSuffixEffort:" · thinking: {level}"},PL={title:"Sign in to BLUN King",close:"Close (Esc)",starting:"Starting authorization flow…",lead:"Click the button below to authorize in a new browser tab.",authorizeInBrowser:"Authorize in browser",orDivider:"or",fallbackPrefix:"On another device? Open ",fallbackSuffix:" and enter the device code:",copy:"Copy",copied:"Copied",waitingAuth:"Waiting for authorization",waitingAutoClose:"Waiting for authorization, signs in automatically…",success:"Authorized",successHint:"Loading, will close automatically…",expiredTitle:"Authorization code expired",expiredHint:"Please restart the authorization flow",retry:"Retry",closeBtn:"Close",errorTitle:"The current daemon does not support login yet",errorHint:"Please upgrade blun and try again"},RL={dialogLabel:"Manage providers",title:"Provider management",close:"Close (Esc)",loading:"Loading providers…",unavailable:"The daemon does not support provider management yet",empty:"No providers yet",status:{connected:"Connected",error:"Error",unconfigured:"Not configured"},keySet:"key set",keyNotSet:"key not set",modelCount:"{count} models",confirmDelete:"Confirm delete?",refresh:"Refresh",delete:"Delete",refreshTitle:"Refresh {type}",deleteTitle:"Delete {type}",loginBlun:"Sign in to Blun",enterApiKey:"Enter API Key",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"Default model",baseUrlPlaceholder:"https://… (optional)",optional:"Optional",apiKeyRequired:"API Key cannot be empty",add:"Add",escClose:"Esc to close"},DL={dialogLabel:"Switch model",title:"Switch model",close:"Close (Esc)",allTab:"All",providerTabs:"Model providers",searchPlaceholder:"Search models or providers…",loading:"Loading models…",unavailable:"The daemon does not support model listing yet",contextSuffix:"{size}k ctx",emptyNoModels:"The daemon offers no selectable models",emptyNoMatch:"No matching models",starTitle:"Add to favorites",unstarTitle:"Remove from favorites",footerHint:"↑↓ Navigate · Enter Select · Esc Close"},BL={justNow:"just now"},FL={title:{shell:"Run command?",diff:"Apply changes?",file:"Write file?",fileop:"File operation?",url:"Fetch URL?",search:"Search?",invocation:"Invoke?",todo:"Update todo?",plan_review:"Ready to build with this plan?",generic:"Approve action?"},subagentBadge:"sub agent · {name}",required:"APPROVAL REQUIRED",danger:"Danger: {detail}",searchQueryLabel:"query",searchScope:"scope: {scope}",feedbackPlaceholder:"Explain why you are rejecting… (Enter to submit, Esc to cancel)",feedbackHint:"Enter to submit · Esc to cancel",approve:"Approve",approveSession:"Approve for session",reject:"Reject",feedback:"+Feedback",approvePlan:"Approve plan",revise:"Revise",rejectAndExit:"Reject and Exit"},HL={title:"Question",step:"Q{current}/{total}",back:"‹ Back",nextQuestion:"Next question ›",otherDefault:"Other…",submit:"Submit",dismiss:"Dismiss",minimize:"Minimize",expand:"Expand"},WL={tag:"tasks",summary:"{run} running · {done} done",stop:"stop",defaultDescription:"Background task",dockTasks:"Background tasks",dockBash:"Bash",dockSubagent:"Sub Agent",dockTodos:"Todos",running:"running",closePanel:"Close panel",timingRunning:"Running · {time}",timingDone:"Done · {sec}s",emptyTasks:"No background tasks running",emptyBash:"No bash tasks running",emptySubagent:"No sub agent tasks running",emptyTodo:"No todos yet",openTab:"Open the tasks tab",openDetail:"Open",collapse:"Collapse",expand:"Expand"},zL={panelTitle:"Thinking",close:"Close"},UL={title:"Changes",branch:"branch",aheadTitle:"ahead of remote",behindTitle:"behind remote",changeCount:"{count} changes",empty:"No git changes / not provided by daemon",clean:"Working tree clean, no changes",back:"Back",loading:"Loading diff…",noDiff:"No line changes for this file",list:"List",tree:"Tree",close:"Close"},qL={},jL={empty:"Select a file on the left to preview",loading:"Loading…",lineCount:"{count} lines",copy:"Copy",copied:"Copied",copyPath:"Copy path",openInEditor:"Open",reveal:"Reveal",download:"Download",close:"Close",search:"Search",prevMatch:"Previous match",nextMatch:"Next match",htmlMode:"HTML preview mode",markdownMode:"Markdown preview mode",preview:"Preview",source:"Source",imageFit:"Image sizing",fit:"Fit",actual:"Actual",pdfNoPreview:"This PDF cannot be embedded here. Download it to view.",imageNoPreview:"Image file · {mime} · {size} · preview unavailable",binaryNoPreview:"Binary file · {mime} · {size} bytes · preview unavailable",unknownType:"unknown type",copyCode:"Copy code",enlargeImage:"Enlarge image",errors:{emptyPath:"File path is empty",unsupportedPath:"URLs and remote paths cannot be previewed",outsideWorkspace:"Only files inside the current workspace can be previewed",isDirectory:"Select a file instead of a directory",loadFailed:"Unable to read this file"}},VL={searching:"Searching…",noMatch:"No matches"},KL={dismiss:"Close",errorLabel:"Error",noteLabel:"Note",details:{cause:"Cause",code:"Error code",connection:"Connection",contentType:"Content type",details:"Server details",duration:"Duration",endpoint:"Endpoint",errorName:"Error type",message:"Message",operation:"Operation",phase:"Failure phase",request:"Request",requestId:"Request ID",responsePreview:"Response preview",sessionId:"Session ID",stack:"Stack",status:"HTTP status",timeout:"Timeout",timestamp:"Time"},daemonApiTitle:"Blun daemon returned an error",daemonNetworkMessage:"Web did not receive a response from the local service. Check that Blun daemon is still running, or refresh the page.",daemonNetworkTitle:"Cannot connect to Blun daemon",diagnostics:"Diagnostics",hideDetails:"Hide details",operationFailedMessage:"The last operation did not finish. Try again later.",operationFailedTitle:"Operation failed",sessionSnapshotMessage:"Web could not load the current conversation. Check that Blun daemon is still running, or refresh the page.",sessionSnapshotTitle:"Cannot load current conversation",showDetails:"Show details",copyDetails:"Copy diagnostics",copied:"Copied",wsTitle:"Realtime connection error",goal:{alreadyExists:"This session already has an active goal. Cancel it before starting a new one.",notFound:"No goal to act on — it may have already finished or been cancelled.",statusInvalid:"The current goal state does not allow this action.",notResumable:"This goal cannot be resumed (it may be cancelled or completed).",objectiveTooLong:"The objective is too long. Please shorten it and try again."}},GL={help:{desc:"Show the list of available commands"},new:{desc:"Create a new session"},clear:{desc:"Clear and start a new session"},model:{desc:"Switch model"},provider:{desc:"Manage providers (add / remove / refresh)"},login:{desc:"Sign in to Blun in the browser"},permission:{desc:"Switch approval mode (manual / auto / yolo)"},plan:{desc:"Toggle plan mode on/off"},swarm:{desc:"Toggle swarm mode; /swarm <task> runs a task in swarm"},goal:{desc:"Create/control a goal: /goal <objective>, /goal pause|resume|cancel"},btw:{desc:"Side chat: /btw <question> asks a forked side session"},yolo:{desc:"Auto-approve everything (yolo mode)"},auto:{desc:"Auto-approve safe edits/reads"},thinking:{desc:"Set the thinking level"},compact:{desc:"Compact the conversation history"},fork:{desc:"Fork this session into a new one"},undoNotImplemented:"/undo isn't supported by the daemon yet",status:{desc:"View session status"},undo:{desc:"Undo the last message"}},YL={label:{read:"Read",bash:"Run",edit:"Edit",write:"Write",grep:"Search",glob:"Find",ls:"List",web_fetch:"Fetch",search:"Search",todo:"Todo",task:"Task"},chip:{lines:"{count} lines",results:"{count} results",edited:"edited",created:"created",todos:"{count} items"},group:{title:"{count} tool call | {count} tool calls",running:"running",error:"failed",done:"done"}},XL={resizeHandleAria:"Resize sidebar width",resizePreviewAria:"Resize preview panel width",detailPanelAria:"Detail panel"},QL={openSwitcher:"Switch session / workspace",openSettings:"Session settings",settingsTitle:"Session settings",groupSession:"Current session",groupApp:"App preferences",sheetLabel:"Sheet",closeSheet:"Close",tapToCycle:"tap to cycle",running:"running",idle:"idle",sessionCount:"{n} sessions",newSession:"New session",permManualSub:"confirm every tool",permAutoSub:"auto-approve edits",permYoloSub:"auto-approve all",planModeSub:"Plan mode",swarmModeSub:"Swarm mode"},ZL={colorSchemeLabel:"Light/Dark",light:"Moon Bright",dark:"Moon Dark",system:"System",accentLabel:"Accent",accentBlue:"Blue",accentBlack:"Black"},JL={preview:"预览",confirm:"确认",cancel:"取消"},eO={authBannerMessage:"未登录 · 需要登录 BLUN King 才能开始对话",authBannerLogin:"登录",authPageTitle:"登录 BLUN King",authPageMessage:"先连接 BLUN King 账号,然后再开始或继续对话。",authPageLogin:"登录",connecting:"连接中…",internalBuildBanner:"仅供内部测试"},tO={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"工作区",sortWorkspaces:"工作区排序",sortManual:"手动排序",sortRecent:"按最后编辑时间",collapseAll:"折叠全部工作区",expandAll:"展开全部工作区",showWorkspacePaths:"显示工作区路径",newSession:"新建会话",newChat:"新建对话",newWorkspace:"新建工作区",emptyState:"还没有会话 · 点击 新建会话 开始",archiveConfirm:"归档会话?",options:"选项",rename:"重命名",copyPath:"复制路径",copySessionId:"复制 Session ID",copied:"已复制 ✓",copyFailed:"复制失败",archive:"归档",fork:"分叉会话",delete:"删除",removeWorkspace:"移除工作区",brand:"BLUN King",signedIn:"已登录",signOut:"退出登录",notSignedIn:"未登录",signIn:"登录",language:"语言",daemon:"后台",noSessions:"暂无对话",showMore:"加载更多 ({count})",showLess:"收起",showAll:"展开 ({count})",loadingMore:"加载中…",collapseSidebar:"收起侧边栏",expandSidebar:"展开侧边栏",searchPlaceholder:"搜索会话",searchShortcut:"搜索会话 (⌘K)",searchHint:"↑↓ 选择 · ↵ 打开 · Esc 关闭",searchNoResults:"没有匹配的会话"},nO={switcherTitle:"切换工作区",switchTooltip:"切换工作区",eyebrow:"工作区",branchLabel:"分支: {branch}",noBranch:"无分支",sessionCount:"{count} 个会话",allWorkspaces:"全部工作区",currentWorkspace:"仅当前工作区",addWorkspace:"添加工作区…",noWorkspace:"暂无工作区",deleteHasSessions:"工作区内还有会话,请先归档这些会话再删除",removeWorkspaceConfirm:"移除工作区「{name}」?",swarmEnableConfirm:"启用 swarm 模式?Agent 将并行运行多个子 agent。",goalStartConfirm:"启动 goal:「{objective}」?Agent 将自主执行。",scopeCurrent:"当前工作区",scopeAll:"全部工作区",newInGroup:"在此工作区新建会话",addTitle:"添加工作区",pathLabel:"路径",pathPlaceholder:"/项目的绝对路径",recentLabel:"最近的文件夹",add:"添加",cancel:"取消",addHint:"粘贴一个绝对路径,或从最近用过的文件夹中选择。",addFailed:"无法打开此文件夹,请检查路径后重试。",openThisFolder:"打开此文件夹",up:"上一级",browsing:"加载中…",filterPlaceholder:"过滤子文件夹…",searchPlaceholder:"在此目录下模糊搜索…",searching:"搜索中…",pasteToggle:"直接输入绝对路径",noFilterMatch:"没有匹配「{q}」的子文件夹",noSubfolders:"此处没有子文件夹",gitTag:"git",browseHint:'点击文件夹进入,再点"打开此文件夹"将其添加为工作区。',attentionTitle:"{count} 项待处理",awaitingAnswer:"待回答",awaitingAnswerTitle:"有提问等待你回答",awaitingPermission:"待授权",awaitingPermissionTitle:"有操作等待你授权",aborted:"已中断",abortedTitle:"此会话在完成前被中断"},sO={jumpToLatestAria:"跳到最新消息",toc:"对话目录",newMessages:"最新消息",loading:"加载中…",emptyWorkspaceHint:"在 {name} 中发送",switchWorkspace:"切换工作区",addWorkspace:"添加工作区",moreWorkspaces:"更多工作区 ({count})",compacting:"正在压缩上下文…",compactedPlain:"上下文已压缩",compactedAuto:"已自动压缩上下文",compactedTokens:"({before} → {after} tokens)",viewSummary:"查看摘要",summaryTitle:"压缩摘要",manuallyAborted:"您已手动终止",activatedSkill:"已激活技能: {name}",undo:"撤销",undoTooltip:"撤销对话不会回滚代码",undoConfirm:"撤销上一条消息?",yesterday:"昨天",loadOlder:"加载更早的消息",loadingOlder:"正在加载更早的消息…"},oO={connectionConnected:"已连接",connectionConnecting:"连接中…",connectionDisconnected:"未连接",ctxTooltip:"使用 {used} / {max} tokens ({pct}%)",modelLabel:"模型",permissionManual:"逐条确认",permissionAuto:"完全自主",permissionYolo:"自动通过",permissionManualDesc:"每个工具操作都需要你手动确认",permissionAutoDesc:"完全自主运行,agent 自己做决定,不再询问",permissionYoloDesc:"自动批准工具操作,但遇到关键问题仍会询问",planLabel:"计划",planOn:"开",planOff:"关",planTooltip:"切换计划模式(先调研再修改)",modesLabel:"模式",goalLabel:"目标",swarmLabel:"Swarm",modeOff:"未启用",goalPlaceholder:"让 Agent 完成什么目标?",goalStart:"开始",goalPause:"暂停",goalResume:"继续",goalCancel:"取消",modeNotSupported:"暂不支持",thinkingLabel:"思考",thinkingTooltip:"切换思考模式",starredModels:"收藏",moreModels:"更多模型…",statusPanelTitle:"会话状态",statusPanelClose:"关闭",statusModel:"模型",statusThinking:"思考强度",statusPermission:"权限",statusPlanMode:"计划模式",statusSwarmMode:"Swarm 模式",swarmOn:"开",swarmOff:"关",statusContext:"上下文",statusCost:"花费",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"运行中…",activityAwaitingApproval:"等待批准",activityAwaitingQuestion:"等待回答",interrupt:"中断",runningShort:"进行中"},iO={placeholder:"输入消息…",send:"发送 ↵",queueLabel:"队列",placeholderRunning:"输入会加入队列 · Ctrl+S 立即插入运行中的回合",queueAutoDrain:"当前回合结束后自动逐条发送",queueNext:"下一条",queueDragTitle:"拖拽排序",editQueued:"编辑(载入到输入框)",queuedImageOnly:"图片 ×{n}",queuedHasImage:"包含 {n} 张图片 — 只能移除,不能编辑",remove:"移除",removeNamed:"移除 {name}",uploading:"上传中",uploadFailed:"上传失败",attachImage:"附加图片",previewAttachment:"预览 {name}",interrupt:"中断",interruptTitle:"中断当前操作",expandTitle:"展开输入框进行多行编辑",collapseTitle:"收起输入框",emptyConversationTitle:"BLUN King",emptyConversation:"还没有消息 —— 在下方输入开始对话",quickStartPlaceholder:"输入消息开始新对话…",thinkingSuffix:" · thinking",thinkingSuffixEffort:" · thinking: {level}"},rO={title:"登录 BLUN King",close:"关闭 (Esc)",starting:"正在启动授权流程…",lead:"点击下方按钮,在新标签页中完成授权。",authorizeInBrowser:"在浏览器中授权",orDivider:"或者",fallbackPrefix:"换个设备?在浏览器打开 ",fallbackSuffix:" 输入设备码:",copy:"复制",copied:"已复制",waitingAuth:"等待授权",waitingAutoClose:"等待授权,完成后自动登录…",success:"已授权",successHint:"正在加载,稍后自动关闭…",expiredTitle:"授权码已过期",expiredHint:"请重新开始授权流程",retry:"重试",closeBtn:"关闭",errorTitle:"当前 daemon 暂不支持登录",errorHint:"请升级 blun 后重试"},lO={dialogLabel:"管理提供商",title:"提供商管理",close:"关闭 (Esc)",loading:"加载提供商中…",unavailable:"daemon 暂不支持提供商管理",empty:"暂无提供商",status:{connected:"已连接",error:"错误",unconfigured:"未配置"},keySet:"key 已设置",keyNotSet:"未设置 key",modelCount:"{count} 个模型",confirmDelete:"确认删除?",refresh:"刷新",delete:"删除",refreshTitle:"刷新 {type}",deleteTitle:"删除 {type}",loginBlun:"登录 Blun",enterApiKey:"填写 API Key",fieldApiKey:"API Key",fieldBaseUrl:"Base URL",fieldDefaultModel:"默认模型",baseUrlPlaceholder:"https://… (可选)",optional:"可选",apiKeyRequired:"API Key 不能为空",add:"添加",escClose:"Esc 关闭"},aO={dialogLabel:"切换模型",title:"切换模型",close:"关闭 (Esc)",allTab:"全部",providerTabs:"模型提供商",searchPlaceholder:"搜索模型或提供商…",loading:"加载模型中…",unavailable:"daemon 暂不支持模型列表",contextSuffix:"{size}k ctx",emptyNoModels:"daemon 未提供可选模型",emptyNoMatch:"无匹配模型",starTitle:"添加到收藏",unstarTitle:"取消收藏",footerHint:"↑↓ 导航 · Enter 选择 · Esc 关闭"},cO={justNow:"刚刚"},uO={title:{shell:"运行命令?",diff:"应用修改?",file:"写入文件?",fileop:"文件操作?",url:"抓取 URL?",search:"搜索?",invocation:"调用?",todo:"更新 todo?",plan_review:"按这份 plan 开始实现?",generic:"批准操作?"},subagentBadge:"子 agent · {name}",required:"APPROVAL REQUIRED",danger:"危险: {detail}",searchQueryLabel:"查询",searchScope:"范围:{scope}",feedbackPlaceholder:"说明拒绝原因… (Enter 提交, Esc 取消)",feedbackHint:"Enter 提交 · Esc 取消",approve:"批准",approveSession:"本会话内批准",reject:"拒绝",feedback:"+反馈",approvePlan:"批准 plan",revise:"修改",rejectAndExit:"拒绝并退出"},dO={title:"提问",step:"Q{current}/{total}",back:"‹ 返回",nextQuestion:"下一题 ›",otherDefault:"其他…",submit:"提交",dismiss:"放弃",minimize:"最小化",expand:"展开"},fO={tag:"任务",summary:"{run} 运行中 · {done} 完成",stop:"stop",defaultDescription:"后台任务",dockTasks:"后台任务",dockBash:"后台 Bash",dockSubagent:"子 Agent",dockTodos:"待办",running:"运行中",closePanel:"关闭面板",timingRunning:"运行中 · {time}",timingDone:"完成 · {sec}s",emptyTasks:"暂无后台任务",emptyBash:"暂无后台 Bash 任务",emptySubagent:"暂无子 Agent 任务",emptyTodo:"暂无待办事项",openTab:"查看全部后台任务",openDetail:"查看",collapse:"折叠",expand:"展开"},pO={panelTitle:"思考过程",close:"关闭"},hO={title:"改动",branch:"分支",aheadTitle:"领先远程",behindTitle:"落后远程",changeCount:"{count} 改动",empty:"无 git 改动 / daemon 未提供",clean:"工作区干净,无改动",back:"返回",loading:"正在加载 diff…",noDiff:"该文件没有行级改动",list:"列表",tree:"树形",close:"关闭"},mO={},gO={empty:"选择左侧文件预览",loading:"加载中…",lineCount:"{count} 行",copy:"复制",copied:"已复制",copyPath:"复制路径",openInEditor:"打开",reveal:"显示",download:"下载",close:"关闭",search:"搜索",prevMatch:"上一个匹配",nextMatch:"下一个匹配",htmlMode:"HTML 预览模式",markdownMode:"Markdown 预览模式",preview:"预览",source:"源码",imageFit:"图片缩放",fit:"适应",actual:"原始",pdfNoPreview:"无法内嵌预览此 PDF,可以下载后查看",imageNoPreview:"图片文件 · {mime} · {size} · 暂不预览",binaryNoPreview:"二进制文件 · {mime} · {size} 字节 · 暂不预览",unknownType:"未知类型",copyCode:"复制代码",enlargeImage:"放大图片",errors:{emptyPath:"文件路径为空",unsupportedPath:"不支持预览 URL 或远程路径",outsideWorkspace:"只能预览当前 workspace 内的文件",isDirectory:"请选择具体文件,而不是目录",loadFailed:"无法读取这个文件"}},vO={searching:"搜索中…",noMatch:"无匹配"},yO={dismiss:"关闭",errorLabel:"错误",noteLabel:"提示",details:{cause:"底层原因",code:"错误码",connection:"连接状态",contentType:"响应类型",details:"服务端详情",duration:"耗时",endpoint:"请求地址",errorName:"错误类型",message:"错误信息",operation:"操作",phase:"失败阶段",request:"请求",requestId:"Request ID",responsePreview:"响应预览",sessionId:"Session ID",stack:"堆栈",status:"HTTP 状态",timeout:"超时设置",timestamp:"时间"},daemonApiTitle:"Blun daemon 返回错误",daemonNetworkMessage:"Web 没有拿到本地服务的响应。请确认 Blun daemon 仍在运行,或刷新页面重试。",daemonNetworkTitle:"无法连接到 Blun daemon",diagnostics:"诊断信息",hideDetails:"收起详情",operationFailedMessage:"刚才的操作没有完成,请稍后重试。",operationFailedTitle:"操作失败",sessionSnapshotMessage:"Web 没能加载当前会话内容。请确认 Blun daemon 仍在运行,或刷新页面重试。",sessionSnapshotTitle:"无法加载当前会话内容",showDetails:"查看详情",copyDetails:"复制诊断信息",copied:"已复制",wsTitle:"实时连接出错",goal:{alreadyExists:"当前会话已有一个进行中的目标,请先取消它再创建新目标。",notFound:"没有找到可操作的目标,可能它已经结束或被取消。",statusInvalid:"当前目标状态不支持这个操作。",notResumable:"这个目标无法恢复(可能已取消或已完成)。",objectiveTooLong:"目标描述太长了,请精简后重试。"}},kO={help:{desc:"显示可用命令列表"},new:{desc:"创建新会话"},clear:{desc:"清空并新建会话"},model:{desc:"切换模型"},provider:{desc:"管理提供商 (添加/删除/刷新)"},login:{desc:"在浏览器中登录 Blun"},permission:{desc:"切换审批模式 (manual/auto/yolo)"},plan:{desc:"切换计划模式 开/关"},swarm:{desc:"切换 swarm 模式;/swarm <任务> 直接在 swarm 下执行"},goal:{desc:"创建/控制目标:/goal <目标>、/goal pause|resume|cancel"},btw:{desc:"侧边聊天:/btw <问题> 向 fork 的侧边会话提问"},yolo:{desc:"自动批准一切 (yolo 模式)"},auto:{desc:"自动批准安全的读写"},thinking:{desc:"设置思考强度"},compact:{desc:"压缩会话历史"},fork:{desc:"把当前会话 fork 出一个新会话"},undoNotImplemented:"daemon 尚未支持 /undo",status:{desc:"查看会话状态"},undo:{desc:"撤销上一条消息"}},bO={label:{read:"读取",bash:"运行",edit:"编辑",write:"写入",grep:"搜索",glob:"查找",ls:"列目录",web_fetch:"抓取",search:"搜索",todo:"待办",task:"任务"},chip:{lines:"{count} 行",results:"{count} 结果",edited:"已编辑",created:"已创建",todos:"{count} 项"},group:{title:"{count} 个工具调用",running:"运行中",error:"有失败",done:"已完成"}},_O={resizeHandleAria:"调整侧栏宽度",resizePreviewAria:"调整预览面板宽度",detailPanelAria:"详情面板"},wO={openSwitcher:"切换会话 / 工作区",openSettings:"会话设置",settingsTitle:"会话设置",groupSession:"当前会话",groupApp:"应用偏好",sheetLabel:"面板",closeSheet:"关闭",tapToCycle:"点击切换",running:"运行中",idle:"空闲",sessionCount:"{n} 个会话",newSession:"新建会话",permManualSub:"每个工具都确认",permAutoSub:"自动批准编辑",permYoloSub:"全部自动批准",planModeSub:"计划模式",swarmModeSub:"Swarm 模式"},SO={colorSchemeLabel:"明暗",light:"月之亮面",dark:"月之暗面",system:"跟随系统",accentLabel:"主题色",accentBlue:"蓝色",accentBlack:"黑色"},CO={title:"Welcome to Blun Web",subtitle:"Pick a few preferences — you can change them anytime in Settings.",languageLabel:"Language",start:"Get started",skip:"Skip",reopen:"Preferences / onboarding"},xO={title:"欢迎来使用 Blun Web",subtitle:"来选择一些你的偏好 —— 之后也可以在设置里随时修改。",languageLabel:"语言",start:"开始使用",skip:"跳过",reopen:"偏好 / 引导"},AO={title:"Settings",close:"Close (Esc)",tabs:{general:"General",agent:"Agent",account:"Account",advanced:"Advanced"},appearance:"Appearance",notifications:"Notifications",notifyOnComplete:"Notify when a turn completes",notifyOnQuestion:"Notify when a question needs an answer",soundOnComplete:"Play a sound when a turn completes or needs an answer",notifyDenied:"Blocked in browser settings",notifyBody:"Finished a turn",notifyQuestionBody:"A question is waiting for your answer",account:"Account",uiFontSize:"Font size",agentDefaults:"Agent defaults",providers:"Providers",providersHint:"Add, remove, or refresh providers",manageProviders:"Manage",saving:"Saving",defaultModel:"Default model",defaultModelHint:"New sessions prefer this model",noDefaultModel:"No default model",defaultPermission:"Default permission",defaultPermissionHint:"Only affects newly-created sessions",defaultThinking:"Thinking by default",defaultThinkingHint:"Whether new sessions start with thinking enabled",defaultPlanMode:"Plan mode by default",defaultPlanModeHint:"Whether new sessions start in plan mode",mergeSkills:"Merge all available skills",mergeSkillsHint:"Show project, plugin, and user skills together",telemetry:"Improve product with usage data",telemetryHint:"When on, we collect anonymous interaction data (such as clicks, interruptions, and feature usage) to improve the product experience. You can turn it off at any time.",telemetryRestartHint:"Takes effect after restarting the service.",credentialReady:"Credential configured",credentialMissing:"Missing credential",configUnavailable:"The server did not return config yet. These settings are unavailable.",advanced:"Advanced",build:"Build",serverVersion:"Server version",exportLog:"Troubleshooting log",logHint:"Enable with ?debug=1 to capture",exportLogBtn:"Export log",conversationToc:"Show conversation outline",conversationTocHint:"Show a clickable outline in the right margin to jump between messages"},TO={title:"设置",close:"关闭 (Esc)",tabs:{general:"通用",agent:"Agent",account:"账户",advanced:"高级"},appearance:"外观",notifications:"通知",notifyOnComplete:"会话完成时通知",notifyOnQuestion:"待回答时通知",soundOnComplete:"会话完成或待回答时播放提示音",notifyDenied:"已在浏览器设置中被阻止",notifyBody:"已完成一轮",notifyQuestionBody:"有提问等待你回答",account:"账户",uiFontSize:"字体大小",agentDefaults:"Agent 默认值",providers:"提供商",providersHint:"添加、删除或刷新提供商",manageProviders:"管理",saving:"保存中",defaultModel:"默认模型",defaultModelHint:"新会话会优先使用这个模型",noDefaultModel:"未设置默认模型",defaultPermission:"默认权限",defaultPermissionHint:"只影响之后新建的会话",defaultThinking:"默认开启思考",defaultThinkingHint:"新会话默认是否开启 thinking",defaultPlanMode:"默认计划模式",defaultPlanModeHint:"新会话默认进入 plan mode",mergeSkills:"合并所有可用 Skills",mergeSkillsHint:"让项目、插件和用户 Skills 一起出现在可用列表中",telemetry:"使用数据改进产品",telemetryHint:"开启后,我们会收集您的匿名交互数据(如点击、打断、功能使用等),用于改进产品体验。您可以随时关闭。",telemetryRestartHint:"更改后需重启服务生效。",credentialReady:"凭据已配置",credentialMissing:"缺少凭据",configUnavailable:"当前服务端没有返回 config,设置项暂不可用。",advanced:"高级",build:"构建",serverVersion:"服务端版本",exportLog:"故障排查日志",logHint:"加 ?debug=1 开启采集",exportLogBtn:"导出日志",conversationToc:"显示对话目录",conversationTocHint:"在右侧显示可点击跳转的对话目录"},MO={openInEditor:"Open in editor",openInEditorShort:"Open",chooseOpenApp:"Choose application",copyAll:"Copy all as Markdown",copyFinalSummary:"Copy final summary",copied:"Copied",copyPath:"Copy path",changed:"{n} changed",gitTooltip:"Open Files > Changed",detached:"detached",openPr:"Open pull request",options:"Options",copySessionId:"Copy Session ID",renameSession:"Rename",forkSession:"Fork session",archiveSession:"Archive"},EO={openInEditor:"在编辑器中打开",openInEditorShort:"打开",chooseOpenApp:"选择应用",copyAll:"复制全部对话为 Markdown",copyFinalSummary:"仅复制最终总结",copied:"已复制",copyPath:"复制路径",changed:"{n} 处改动",gitTooltip:"打开「文件 > 改动」",detached:"游离",openPr:"打开 Pull Request",options:"选项",copySessionId:"复制 Session ID",renameSession:"重命名",forkSession:"分叉会话",archiveSession:"归档"},IO={title:"Side chat",subtitle:"forked from this session",empty:"Ask a quick question on the side — it shares this session’s context.",placeholder:"Ask the side chat…",send:"Send"},$O={title:"侧边聊天",subtitle:"从当前会话 fork",empty:"在侧边随手问一句 —— 它共享当前会话的上下文。",placeholder:"问问侧边聊天…",send:"发送"},NO={en:{common:ML,app:EL,sidebar:IL,workspace:$L,conversation:NL,status:LL,composer:OL,login:PL,providers:RL,model:DL,sessions:BL,approval:FL,question:HL,tasks:WL,thinking:zL,diff:UL,fileTree:qL,filePreview:jL,mention:VL,warnings:KL,commands:GL,tools:YL,layout:XL,mobile:QL,theme:ZL,onboarding:CO,settings:AO,header:MO,sideChat:IO},zh:{common:JL,app:eO,sidebar:tO,workspace:nO,conversation:sO,status:oO,composer:iO,login:rO,providers:lO,model:aO,sessions:cO,approval:uO,question:dO,tasks:fO,thinking:pO,diff:hO,fileTree:mO,filePreview:gO,mention:vO,warnings:yO,commands:kO,tools:bO,layout:_O,mobile:wO,theme:SO,onboarding:xO,settings:TO,header:EO,sideChat:$O}},TA=[{code:"en",label:"English"},{code:"zh",label:"中文"}];function LO(){const e=Qn(Et.locale);return e==="en"||e==="zh"?e:globalThis.navigator?.language?.toLowerCase().startsWith("zh")?"zh":"en"}const Un=o5({legacy:!1,locale:LO(),fallbackLocale:"en",messages:NO});function MA(e){Un.global.locale.value=e,ts(Et.locale,e)}const Xa=Un.global.t,OO={read:"tools.label.read",bash:"tools.label.bash",edit:"tools.label.edit",multi_edit:"tools.label.edit",write:"tools.label.write",grep:"tools.label.grep",glob:"tools.label.glob",ls:"tools.label.ls",web_fetch:"tools.label.web_fetch",search:"tools.label.search",todo:"tools.label.todo",task:"tools.label.task"},PO={multiedit:"multi_edit",multiedits:"multi_edit",shell:"bash",run:"bash",exec:"bash",ripgrep:"grep",rg:"grep",find:"glob",fetch:"web_fetch",webfetch:"web_fetch",url_fetch:"web_fetch",urlfetch:"web_fetch",list:"ls",listdir:"ls",list_dir:"ls",todowrite:"todo",todo_write:"todo",todoread:"todo",todolist:"todo",todo_list:"todo",agent:"task",subagent:"task",websearch:"search",web_search:"search"};function Zl(e){const t=(e??"").trim().toLowerCase().replace(/[\s-]+/g,"_");return PO[t]??t}function id(e){const t=OO[Zl(e)];return t?Xa(t):e}const RO={read:"file-text",bash:"terminal",edit:"pencil",multi_edit:"pencil",write:"file-plus",grep:"search",search:"search",glob:"glob",ls:"folder",web_fetch:"globe",todo:"check-list",task:"sparkles"};function S0(e){const t=Zl(e);let n=RO[t];return!n&&(e??"").trim().toLowerCase().includes("skill")&&(n="bolt"),n?Ia(n,"sm"):""}const EA=80;function DO(e,t=EA){const n=e.trim();return n.length>t?n.slice(0,t-1)+"…":n}function BO(e,t){const n=e.trim();return!!(n===""||n==="{}"||n==="[]"||n==="null"||t&&Object.keys(t).length===0)}function FO(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function sn(e){return typeof e=="string"&&e.length>0?e:void 0}function Sl(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function HO(e){try{const t=new URL(e),n=t.pathname.split("/").filter(Boolean)[0];return n?`${t.host}/${n}`:t.host}catch{return e.replace(/^https?:\/\//,"")}}function ig(e){return sn(e.path)??sn(e.file_path)??sn(e.filePath)??sn(e.filename)}const WO=64;function Bu(e,t,n=!1){const s=(o,i=EA)=>n?o.trim():DO(o,i);try{const o=FO(t);if(!n&&BO(t,o))return"";const i=()=>s(t.replace(/^·\s*/,""));if(!o)return i();switch(Zl(e)){case"read":{const r=ig(o);if(!r)return i();const l=Sl(o.offset)??Sl(o.line_start)??Sl(o.start_line),a=Sl(o.limit)??Sl(o.length),c=Sl(o.line_end)??Sl(o.end_line)??(l!==void 0&&a!==void 0?l+a:void 0);return s(l!==void 0&&c!==void 0?`${r}:${l}-${c}`:l!==void 0?`${r}:${l}`:r)}case"write":{const r=ig(o);return r?s(`${r} ${Xa("tools.chip.created")}`):i()}case"edit":case"multi_edit":{const r=ig(o);return r?s(r):i()}case"bash":{const r=sn(o.command)??sn(o.cmd)??sn(o.script);return r?s(r,WO):i()}case"grep":case"search":{const r=sn(o.pattern)??sn(o.query)??sn(o.regex),l=sn(o.path)??sn(o.glob)??sn(o.include);return r&&l?s(`${r} in ${l}`):r?s(r):i()}case"glob":{const r=sn(o.pattern)??sn(o.glob)??sn(o.query),l=sn(o.path)??sn(o.cwd);return r&&l?s(`${r} in ${l}`):r?s(r):sn(o.path)?s(sn(o.path)):i()}case"ls":{const r=sn(o.path)??sn(o.dir)??sn(o.directory)??sn(o.cwd);return r?s(r):i()}case"web_fetch":{const r=sn(o.url)??sn(o.uri);return r?s(HO(r)):i()}case"todo":case"task":{const r=sn(o.description)??sn(o.title)??sn(o.prompt)??sn(o.name)??sn(o.subagent_type);if(r)return s(r);const l=Array.isArray(o.todos)?o.todos:Array.isArray(o.items)?o.items:void 0;return l?s(Xa("tools.chip.todos",{count:l.length})):i()}default:return i()}}catch{return t}}function zO(e){try{switch(Zl(e.name)){case"bash":return e.timing?e.timing:"";case"read":{if(e.output&&e.output.length>0){const t=e.output.length;return Xa("tools.chip.lines",{count:t})}return""}case"edit":case"multi_edit":case"write":{if(e.output){for(const n of e.output){const s=n.match(/\+(\d+).*[-−](\d+)/);if(s)return`+${s[1]} −${s[2]}`}const t=e.output.find(n=>/\d+/.test(n));if(t){const n=t.match(/\+(\d+)/),s=t.match(/[-−](\d+)/);if(n||s)return`${n?`+${n[1]}`:""} ${s?`−${s[1]}`:""}`.trim()}if(e.status!=="error")return Xa("tools.chip.edited")}return""}case"grep":case"search":return e.output&&e.output.length>0?Xa("tools.chip.results",{count:e.output.length}):"";default:return""}}catch{return""}}const UO=je({__name:"StatusDot",props:{status:{}},setup(e){const t=e;function n(o){switch(o){case"ok":case"done":case"completed":case"success":return"ok";case"error":case"failed":case"danger":return"error";case"running":case"working":case"in_progress":case"active":return"running";case"suspended":return"suspended";default:return"idle"}}const s=F(()=>n(t.status));return(o,i)=>(w(),N("span",{class:Re(["kw-dot",`kw-dot--${s.value}`]),"aria-hidden":"true"},null,2))}}),Fu=ut(UO,[["__scopeId","data-v-f1411658"]]),qO=["innerHTML"],jO={class:"a"},VO={key:0,class:"p"},KO={class:"rt"},GO=["aria-label"],YO={key:0,class:"tm"},XO=["inert"],QO={class:"bb-pad"},ZO=je({__name:"ToolRow",props:{status:{},icon:{default:""},name:{},arg:{default:""},time:{default:""},open:{type:Boolean,default:!1},expandable:{type:Boolean,default:!1},stacked:{type:Boolean,default:!1},stackPosition:{default:"single"}},emits:["toggle"],setup(e){return(t,n)=>(w(),N("div",{class:Re(["box",{open:e.open,stacked:e.stacked,err:e.status==="error","stack-first":e.stackPosition==="first","stack-middle":e.stackPosition==="middle","stack-last":e.stackPosition==="last"}])},[T("div",{class:"bh",onClick:n[0]||(n[0]=s=>t.$emit("toggle"))},[e.icon?(w(),N("span",{key:0,class:"gl",innerHTML:e.icon,"aria-hidden":"true"},null,8,qO)):ie("",!0),T("span",jO,R(e.name),1),oe(Ht,{text:e.arg},{default:_e(()=>[e.arg?(w(),N("span",VO,R(e.arg),1)):ie("",!0)]),_:1},8,["text"]),T("span",KO,[T("span",{class:Re(["status",e.status]),role:"status","aria-label":e.status},[e.status==="ok"?(w(),ve(Je,{key:0,name:"check",size:"sm"})):e.status==="error"?(w(),ve(Je,{key:1,name:"close",size:"sm"})):e.status==="suspended"?(w(),ve(Fu,{key:2,status:"suspended"})):(w(),ve(Fu,{key:3,status:"running"}))],10,GO),Cn(t.$slots,"trailing"),e.time?(w(),N("span",YO,R(e.time),1)):ie("",!0)]),e.expandable?(w(),ve(Je,{key:1,class:"car",name:e.open?"chevron-down":"chevron-right",size:"sm"},null,8,["name"])):ie("",!0)]),T("div",{class:Re(["bb",{open:e.open}]),inert:!e.open},[T("div",QO,[Cn(t.$slots,"default")])],10,XO)],2))}}),C0=ut(ZO,[["__scopeId","data-v-ef9e030b"]]),JO={key:0,class:"at-type"},eP={key:1,class:"at-task"},tP={key:2,class:"bb-code"},nP=je({__name:"AgentTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff","openAgent"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(_){if(!_)return{};try{const g=JSON.parse(_);return{description:typeof g.description=="string"?g.description:void 0,subagentType:typeof g.subagent_type=="string"?g.subagent_type:void 0,prompt:typeof g.prompt=="string"?g.prompt:void 0}}catch{return{}}}const r=F(()=>i(s.tool.arg)),l=F(()=>!!s.tool.output&&s.tool.output.length>0),a=F(()=>!!r.value.prompt||!!r.value.subagentType||l.value),c=Z(s.tool.defaultExpanded===!0&&a.value),u=F(()=>s.tool.status),d=F(()=>id(s.tool.name)),p=F(()=>S0(s.tool.name)),h=F(()=>r.value.description||r.value.subagentType||""),f=Ut("resolveAgentTaskId"),m=F(()=>f?f(s.tool.id)!==void 0:!0);function b(){a.value&&(c.value=!c.value)}return Ke(()=>[s.tool.defaultExpanded,s.tool.output?.length,s.tool.status],()=>{s.tool.defaultExpanded===!0&&a.value&&(c.value=!0)}),(_,g)=>(w(),ve(C0,{status:u.value,icon:p.value,name:d.value,arg:c.value?"":h.value,time:e.tool.timing,open:c.value,expandable:a.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:b},{trailing:_e(()=>[m.value?(w(),N("button",{key:0,type:"button",class:"at-open",onClick:g[0]||(g[0]=vt(v=>o("openAgent",e.tool.id),["stop"]))},R(x(n)("tasks.openDetail")),1)):ie("",!0)]),default:_e(()=>[r.value.subagentType?(w(),N("div",JO,R(r.value.subagentType),1)):ie("",!0),r.value.prompt?(w(),N("div",eP,R(r.value.prompt),1)):ie("",!0),l.value?(w(),N("div",tP,[(w(!0),N(Le,null,nt(e.tool.output??[],(v,y)=>(w(),N("div",{key:y},R(v),1))),128))])):ie("",!0)]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),sP=ut(nP,[["__scopeId","data-v-1fb1d5ca"]]),oP=1e6,O_=5e3;function P_(e){if(e==="")return[];const t=e.split(`
|
|
39
|
+
`);return t.at(-1)===""&&t.pop(),t}function iP(e,t){const n=P_(e),s=P_(t),o=n.length,i=s.length;if(o===0&&i===0)return[];if(o>O_||i>O_||(o+1)*(i+1)>oP)return null;const r=Array.from({length:o+1},()=>Array.from({length:i+1},()=>0));for(let h=1;h<=o;h++)for(let f=1;f<=i;f++)r[h][f]=n[h-1]===s[f-1]?r[h-1][f-1]+1:Math.max(r[h-1][f],r[h][f-1]);const l=[];let a=o,c=i;for(;a>0||c>0;)a>0&&c>0&&n[a-1]===s[c-1]?(l.push({type:"context",text:n[a-1]}),a--,c--):c>0&&(a===0||r[a][c-1]>=r[a-1][c])?(l.push({type:"add",text:s[c-1]}),c--):(l.push({type:"del",text:n[a-1]}),a--);l.reverse();const u=[];let d=1,p=1;for(const h of l)h.type==="context"?(u.push({type:"context",text:h.text,oldNo:d,newNo:p}),d++,p++):h.type==="add"?(u.push({type:"add",text:h.text,newNo:p}),p++):(u.push({type:"del",text:h.text,oldNo:d}),d++);return u}function rP(e){let t=0,n=0;for(const s of e)s.type==="add"?t++:s.type==="del"&&n++;return{added:t,removed:n}}function IA(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function $A(e){const t=Zl(e.name);if(t!=="edit"&&t!=="write")return null;const n=IA(e.arg);if(!n)return null;if(t==="edit"){if(n.replace_all===!0)return null;const s=typeof n.old_string=="string"?n.old_string:void 0,o=typeof n.new_string=="string"?n.new_string:void 0;return s===void 0||o===void 0?null:iP(s,o)}return null}function lP(e){const t=IA(e);return t&&typeof t.path=="string"?t.path:void 0}function aP(e,t){for(const n of e){const s=n.tools?.find(o=>o.id===t);if(s)return s}}const cP={key:0,class:"chip"},uP={key:0,class:"bb-summary"},dP={class:"bb-code"},fP={key:0,class:"bb-empty"},pP=je({__name:"EditTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff"],setup(e,{emit:t}){const n=e,s=t,o=F(()=>n.tool.status),i=F(()=>id(n.tool.name)),r=F(()=>S0(n.tool.name)),l=F(()=>Bu(n.tool.name,n.tool.arg)),a=F(()=>Bu(n.tool.name,n.tool.arg,!0)),c=F(()=>$A(n.tool)),u=F(()=>{const m=c.value;if(m&&n.tool.status!=="error"){const{added:b,removed:_}=rP(m);if(b||_)return`+${b} −${_}`}return""}),d=F(()=>!!n.tool.output&&n.tool.output.length>0),p=Z(!1),h=F(()=>d.value&&!n.toolDiffPanel);function f(){if(n.toolDiffPanel){s("openToolDiff",n.tool.id);return}d.value&&(p.value=!p.value)}return(m,b)=>(w(),ve(C0,{status:o.value,icon:r.value,name:i.value,arg:p.value?"":l.value,time:e.tool.timing,open:p.value,expandable:h.value||e.toolDiffPanel,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:f},{trailing:_e(()=>[u.value?(w(),N("span",cP,R(u.value),1)):ie("",!0)]),default:_e(()=>[a.value?(w(),N("div",uP,R(a.value),1)):ie("",!0),T("div",dP,[d.value?ie("",!0):(w(),N("div",fP,"Waiting for output…")),(w(!0),N(Le,null,nt(e.tool.output??[],(_,g)=>(w(),N("div",{key:g},R(_),1))),128))])]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),hP=ut(pP,[["__scopeId","data-v-c2c4b4d6"]]),mP={key:0,class:"chip"},gP={key:0,class:"bb-summary"},vP={class:"bb-code"},yP={key:0,class:"bb-empty"},kP=je({__name:"GenericTool",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff"],setup(e){const t=e,n=F(()=>t.tool.status==="running"&&/^bash$/i.test(t.tool.name)),s=F(()=>!!t.tool.output&&t.tool.output.length>0),o=F(()=>s.value||n.value),i=Z(t.tool.defaultExpanded===!0&&o.value),r=F(()=>t.tool.status),l=F(()=>id(t.tool.name)),a=F(()=>S0(t.tool.name)),c=F(()=>Bu(t.tool.name,t.tool.arg)),u=F(()=>Bu(t.tool.name,t.tool.arg,!0)),d=F(()=>zO({name:t.tool.name,arg:t.tool.arg,output:t.tool.output,timing:t.tool.timing,status:t.tool.status}));function p(){o.value&&(i.value=!i.value)}return Ke(()=>[t.tool.defaultExpanded,t.tool.output?.length,t.tool.status,t.tool.name],()=>{t.tool.defaultExpanded===!0&&o.value&&(i.value=!0)}),(h,f)=>(w(),ve(C0,{status:r.value,icon:a.value,name:l.value,arg:i.value?"":c.value,time:e.tool.name!=="bash"?e.tool.timing:"",open:i.value,expandable:o.value,stacked:e.stackPosition!=="single","stack-position":e.stackPosition,onToggle:p},{trailing:_e(()=>[d.value?(w(),N("span",mP,R(d.value),1)):ie("",!0)]),default:_e(()=>[u.value?(w(),N("div",gP,R(u.value),1)):ie("",!0),T("div",vP,[s.value?ie("",!0):(w(),N("div",yP,"Waiting for output…")),(w(!0),N(Le,null,nt(e.tool.output??[],(m,b)=>(w(),N("div",{key:b},R(m),1))),128))])]),_:1},8,["status","icon","name","arg","time","open","expandable","stacked","stack-position"]))}}),bP=ut(kP,[["__scopeId","data-v-1c000361"]]),_P={class:"media-title"},wP=["src","alt"],SP=["src"],CP=["src"],xP=je({__name:"MediaTool",props:{tool:{},mobile:{type:Boolean,default:!1}},emits:["openMedia"],setup(e,{emit:t}){const n=e,s=t,o=F(()=>n.tool.status==="ok"?n.tool.media:void 0);function i(c){return c.split(/[\\/]+/).pop()||c}function r(c){return c<1024?`${c} B`:c<1024*1024?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`}const l=F(()=>{const c=o.value;if(!c)return"";const u=[c.path?i(c.path):n.tool.name];return c.mimeType&&u.push(c.mimeType),c.bytes!==void 0&&u.push(r(c.bytes)),c.dimensions&&u.push(c.dimensions),u.join(" · ")});function a(){const c=o.value;c?.kind==="image"&&s("openMedia",c)}return(c,u)=>o.value?(w(),N("div",{key:0,class:Re(["media-tool",{mob:e.mobile}])},[oe(Ht,{text:o.value.path||l.value},{default:_e(()=>[T("div",_P,R(l.value),1)]),_:1},8,["text"]),o.value.kind==="image"?(w(),ve(Ht,{key:0,text:o.value.path||l.value},{default:_e(()=>[T("button",{type:"button",class:"media-image-button",onClick:a},[T("img",{class:"media-image",src:o.value.url,alt:o.value.path?i(o.value.path):l.value,loading:"lazy"},null,8,wP)])]),_:1},8,["text"])):o.value.kind==="video"?(w(),N("video",{key:1,class:"media-video",src:o.value.url,controls:"",preload:"metadata"},null,8,SP)):(w(),N("audio",{key:2,class:"media-audio",src:o.value.url,controls:""},null,8,CP))],2)):ie("",!0)}}),AP=ut(xP,[["__scopeId","data-v-b06a5571"]]);function TP(e){if(e.media&&e.status==="ok")return AP;const t=Zl(e.name);return t==="edit"||t==="write"||t==="multi_edit"?hP:t==="task"?sP:bP}const NA=je({__name:"ToolCall",props:{tool:{},mobile:{type:Boolean,default:!1},stackPosition:{default:"single"},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff","openAgent"],setup(e,{emit:t}){const n=e,s=t,o=F(()=>TP(n.tool));return(i,r)=>(w(),ve(Hs(o.value),{tool:e.tool,mobile:e.mobile,"stack-position":e.stackPosition,"tool-diff-panel":e.toolDiffPanel,onOpenMedia:r[0]||(r[0]=l=>s("openMedia",l)),onOpenFile:r[1]||(r[1]=l=>s("openFile",l)),onOpenToolDiff:r[2]||(r[2]=l=>s("openToolDiff",l)),onOpenAgent:r[3]||(r[3]=l=>s("openAgent",l))},null,40,["tool","mobile","stack-position","tool-diff-panel"]))}});function R_(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function MP(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),n=(e%6e4/1e3).toFixed(1);return`${t}m${n}s`}function hh(e){if(e.blocks)return e.blocks;const t=[];e.thinking&&t.push({kind:"thinking",thinking:e.thinking}),e.text&&t.push({kind:"text",text:e.text});for(const n of e.tools??[])t.push({kind:"tool",tool:n});return t}function EP(e){return!(e.tool.status==="ok"&&e.tool.media)}function IP(e,t){return t<=1?"single":e===0?"first":e===t-1?"last":"middle"}function $P(e){const t=hh(e),n=[];let s=[];const o=()=>{if(s.length===1){const[i]=s;i&&n.push({kind:"tool",tool:i.tool,sourceIndex:i.sourceIndex})}else s.length>1&&n.push({kind:"tool-stack",tools:s});s=[]};return t.forEach((i,r)=>{if(i.kind==="tool"){if(EP(i)){s.push({tool:i.tool,sourceIndex:r});return}o(),n.push({kind:"tool",tool:i.tool,sourceIndex:r});return}o(),i.kind==="thinking"?n.push({kind:"thinking",thinking:i.thinking,sourceIndex:r}):i.kind==="text"&&n.push({kind:"text",text:i.text,sourceIndex:r})}),o(),n}function NP(e){return hh(e).flatMap(t=>t.kind==="text"&&t.text?[t.text]:[]).join(`
|
|
40
40
|
|
|
41
41
|
`)}function LP(e){const t=[];for(const n of hh(e))if(n.kind==="thinking"&&n.thinking)t.push(`> **Thinking**
|
|
42
42
|
> ${n.thinking.split(`
|
|
@@ -47,7 +47,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DesignSystemVie
|
|
|
47
47
|
${s}
|
|
48
48
|
\`\`\``)}return t.join(`
|
|
49
49
|
|
|
50
|
-
`)}function LA(e){return e.tool.id||`tool-${e.sourceIndex}`}function OP(e,t){return e.kind==="tool-stack"?`tool-stack-${e.tools[0]?.sourceIndex??t}`:e.kind==="tool"?LA({tool:e.tool,sourceIndex:e.sourceIndex}):`${e.kind}-${e.sourceIndex}`}const PP=["aria-expanded"],RP={class:"tg-title"},DP={class:"tg-meta"},BP={class:"tool-group-body"},FP=je({__name:"ToolGroup",props:{tools:{},mobile:{type:Boolean,default:!1},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff","openAgent"],setup(e,{emit:t}){const n=e,s=t,o=Z(!0),i=F(()=>n.tools.length),r=F(()=>n.tools.some(u=>u.tool.status==="running")?"running":n.tools.some(u=>u.tool.status==="error")?"error":"done"),{t:l}=It(),a=F(()=>{switch(r.value){case"running":return l("tools.group.running");case"error":return l("tools.group.error");default:return l("tools.group.done")}});function c(){o.value=!o.value}return(u,d)=>(w(),N("div",{class:Re(["tool-group",{open:o.value}])},[T("button",{class:"tool-group-head",type:"button","aria-expanded":o.value,onClick:c},[oe(Fu,{status:r.value},null,8,["status"]),oe(Je,{class:"tg-ic",name:"list",size:"sm"}),T("span",RP,R(x(l)("tools.group.title",i.value)),1),T("span",DP,"· "+R(a.value),1),oe(Je,{class:"tg-car",name:"chevron-right",size:"sm"})],8,PP),Mn(T("div",BP,[(w(!0),N(Le,null,nt(e.tools,(p,h)=>(w(),ve(NA,{key:x(LA)(p),tool:p.tool,mobile:e.mobile,"stack-position":x(IP)(h,e.tools.length),"tool-diff-panel":e.toolDiffPanel,onOpenMedia:d[0]||(d[0]=f=>s("openMedia",f)),onOpenFile:d[1]||(d[1]=f=>s("openFile",f)),onOpenToolDiff:d[2]||(d[2]=f=>s("openToolDiff",f)),onOpenAgent:d[3]||(d[3]=f=>s("openAgent",f))},null,8,["tool","mobile","stack-position","tool-diff-panel"]))),128))],512),[[Qo,o.value]])],2))}}),HP=ut(FP,[["__scopeId","data-v-
|
|
50
|
+
`)}function LA(e){return e.tool.id||`tool-${e.sourceIndex}`}function OP(e,t){return e.kind==="tool-stack"?`tool-stack-${e.tools[0]?.sourceIndex??t}`:e.kind==="tool"?LA({tool:e.tool,sourceIndex:e.sourceIndex}):`${e.kind}-${e.sourceIndex}`}const PP=["aria-expanded"],RP={class:"tg-title"},DP={class:"tg-meta"},BP={class:"tool-group-body"},FP=je({__name:"ToolGroup",props:{tools:{},mobile:{type:Boolean,default:!1},toolDiffPanel:{type:Boolean,default:!1}},emits:["openMedia","openFile","openToolDiff","openAgent"],setup(e,{emit:t}){const n=e,s=t,o=Z(!0),i=F(()=>n.tools.length),r=F(()=>n.tools.some(u=>u.tool.status==="running")?"running":n.tools.some(u=>u.tool.status==="error")?"error":"done"),{t:l}=It(),a=F(()=>{switch(r.value){case"running":return l("tools.group.running");case"error":return l("tools.group.error");default:return l("tools.group.done")}});function c(){o.value=!o.value}return(u,d)=>(w(),N("div",{class:Re(["tool-group",{open:o.value}])},[T("button",{class:"tool-group-head",type:"button","aria-expanded":o.value,onClick:c},[oe(Fu,{status:r.value},null,8,["status"]),oe(Je,{class:"tg-ic",name:"list",size:"sm"}),T("span",RP,R(x(l)("tools.group.title",i.value)),1),T("span",DP,"· "+R(a.value),1),oe(Je,{class:"tg-car",name:"chevron-right",size:"sm"})],8,PP),Mn(T("div",BP,[(w(!0),N(Le,null,nt(e.tools,(p,h)=>(w(),ve(NA,{key:x(LA)(p),tool:p.tool,mobile:e.mobile,"stack-position":x(IP)(h,e.tools.length),"tool-diff-panel":e.toolDiffPanel,onOpenMedia:d[0]||(d[0]=f=>s("openMedia",f)),onOpenFile:d[1]||(d[1]=f=>s("openFile",f)),onOpenToolDiff:d[2]||(d[2]=f=>s("openToolDiff",f)),onOpenAgent:d[3]||(d[3]=f=>s("openAgent",f))},null,8,["tool","mobile","stack-position","tool-diff-panel"]))),128))],512),[[Qo,o.value]])],2))}}),HP=ut(FP,[["__scopeId","data-v-e559f6c9"]]);var WP=Object.create,x0=Object.defineProperty,zP=Object.getOwnPropertyDescriptor,OA=Object.getOwnPropertyNames,UP=Object.getPrototypeOf,qP=Object.prototype.hasOwnProperty,PA=(e,t)=>function(){return t||(0,e[OA(e)[0]])((t={exports:{}}).exports,t),t.exports},RA=e=>{let t={};for(var n in e)x0(t,n,{get:e[n],enumerable:!0});return t},jP=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=OA(t),i=0,r=o.length,l;i<r;i++)l=o[i],!qP.call(e,l)&&l!==n&&x0(e,l,{get:(a=>t[a]).bind(null,l),enumerable:!(s=zP(t,l))||s.enumerable});return e},DA=(e,t,n)=>(n=e!=null?WP(UP(e)):{},jP(x0(n,"default",{value:e,enumerable:!0}),e));function VP(e,t,n,s){const o=Number(e[t].meta.id+1).toString();let i="";return typeof s.docId=="string"&&(i=`-${s.docId}-`),i+o}function KP(e,t){let n=Number(e[t].meta.id+1).toString();return e[t].meta.subId>0&&(n+=`:${e[t].meta.subId}`),`[${n}]`}function GP(e,t,n,s,o){const i=o.rules.footnote_anchor_name(e,t,n,s,o),r=o.rules.footnote_caption(e,t,n,s,o);let l=i;return e[t].meta.subId>0&&(l+=`:${e[t].meta.subId}`),`<sup class="footnote-ref"><a href="#fn${i}" id="fnref${l}">${r}</a></sup>`}function YP(e,t,n){return(n.xhtmlOut?`<hr class="footnotes-sep" />
|
|
51
51
|
`:`<hr class="footnotes-sep">
|
|
52
52
|
`)+`<section class="footnotes">
|
|
53
53
|
<ol class="footnotes-list">
|
|
@@ -233,7 +233,7 @@ ${v}`);u+=$}else u+=O;u+=_,d=h?p+1:e.length}return u}function Xz(e,t){if(!e||!t.
|
|
|
233
233
|
<button class="copy-button" data-code="${_}">${A}</button>
|
|
234
234
|
</div>
|
|
235
235
|
<div class="code-editor"></div>
|
|
236
|
-
</div>`};const a=/^\[(\d+)\]/,c=/^\[([^\]\n]+)\]/,u=p=>{if(!p.startsWith("["))return!1;const h=c.exec(p);if(!h)return p!=="["&&!/^\[\d+$/.test(p);const f=String(h[1]??"");return p.slice(h[0].length).startsWith("(")?!1:!/^\d+$/.test(f)},d=(p,h)=>{const f=p;if(f.src[f.pos]!=="[")return!1;const m=a.exec(f.src.slice(f.pos));if(!m)return!1;const b=f.src.slice(Math.max(0,f.pos-120),f.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(b))return!1;const _=f.src.slice(f.pos+m[0].length);if(_.startsWith("](")||_.startsWith("(")||u(_))return!1;if(!h){const g=m[1],v=f.push("reference","span",0);v.content=g,v.markup=m[0],v.raw=m[0]}return f.pos+=m[0].length,!0};return n.inline.ruler.before("escape","reference",d),n.renderer.rules.reference=(p,h)=>{const m=String(p[h].content??"");return`<span class="reference-link" data-reference-id="${m}" role="button" tabindex="0" title="Click to view reference">${m}</span>`},n}function xU({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function OM({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:s,streamRenderVersionChanged:o=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return s?n.streamedDelta&&i===e?o?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:xU({nextContent:e,previousContent:t??i,typewriterEnabled:s}):{settledContent:e,streamedDelta:"",appended:!1}}const I2=new WeakMap;function AU(e){let t=I2.get(e);return t||(t={inFlight:new Map,completed:new Set,registeredAllLangs:!1,registeredThemes:[],registeredLangs:[],tail:Promise.resolve()},I2.set(e,t)),t}function $2(e,t){if(!t?.length)return[...e];const n=[...e],s=new Set(n);for(const o of t)s.has(o)||(s.add(o),n.push(o));return n}function ey(e){return!!(e.themes?.length||e.langs?.length)}function PM(e,t){if(!t?.length)return!0;const n=new Set(e);return t.every(s=>n.has(s))}function TU(e,t){return!t?.length||e.registeredAllLangs?!0:PM(e.registeredLangs,t)}function Ig(e,t){return ey(t)&&PM(e.registeredThemes,t.themes)&&TU(e,t.langs)}function MU(e,t){if(!ey(t))return t;const n=$2(e.registeredThemes,t.themes),s=e.registeredAllLangs?[]:$2(e.registeredLangs,t.langs);return{...n.length?{themes:n}:{},...s.length?{langs:s}:{}}}const EU={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function IU(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function RM(e){const t=IU(e);return EU[t]??t}function DM(e){if(!Array.isArray(e))return;const t=e.filter(s=>typeof s=="string").map(s=>RM(s)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function BM(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const s of e){if(typeof s!="string")continue;const o=s.trim();!o||n.has(o)||(n.add(o),t.push(o))}return t.length>0?t:void 0}function $U(e){return BM(e)?.join("\0")??""}function FM(e,t){const n=BM(e),s=DM(t);return{...n?.length?{themes:n}:{},...s?.length?{langs:s}:{}}}function Np(e,t){return`${$U(e)}\0\0${DM(t)?.join("\0")??""}`}function ihe(e,t,n={hasRegisterHighlight:!0,hasCreateRenderer:!0}){const s=FM(e,t),o={...s},i=!!(o.langs?.length&&n.hasCreateRenderer&&!n.hasRegisterHighlight);return i&&(delete s.langs,delete o.langs),{key:Np(o.themes,o.langs),registerOptions:s,rendererOptions:o,ignoredLangs:i}}async function rhe(e,t={},n){if(!e)return"ready";const s=FM(t.themes,t.langs),o=Np(s.themes,s.langs),i=n&&n===o?n:o,r=AU(e);if(r.completed.has(i))return"ready";if(Ig(r,s))return r.completed.add(i),"ready";const l=r.inFlight.get(i);if(l)return l;const a=r.tail.catch(()=>{}).then(()=>{if(r.completed.has(i)||Ig(r,s))return r.completed.add(i),"ready";const c=MU(r,s),u=Np(c.themes,c.langs);return r.completed.has(u)||Ig(r,c)?(r.completed.add(i),r.completed.add(u),"ready"):Promise.resolve(e(c)).then(()=>(ey(c)?(r.registeredThemes=c.themes?[...c.themes]:r.registeredThemes,r.registeredLangs=c.langs?[...c.langs]:r.registeredLangs):r.registeredAllLangs=!0,r.completed.add(u),"ready"))}).then(()=>(r.completed.add(i),"ready")).finally(()=>{r.inFlight.get(i)===a&&r.inFlight.delete(i)});return r.inFlight.set(i,a),r.tail=a.catch(()=>{}),a}function _a(e,t,n=1){const s=Number(e);return Number.isFinite(s)?Math.max(n,s):t}function N2(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var NU=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const p=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const f=L2();this.startedAt=p&&this.hasStarted?f-this.normalizedStartDelayMs:f,this.lastTick=f,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=L2();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAt<this.normalizedStartDelayMs){this.rafId=requestAnimationFrame(this.tick);return}const p=1e3/Math.max(1,this.maxCommitFps),h=Math.min(100,Math.max(0,d-this.lastTick));if(h<p){this.rafId=requestAnimationFrame(this.tick);return}this.lastTick=d;const f=this.pendingChars,m=f>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,b=RU(f/Math.max(.001,m/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(b-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const _=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),g=PU(this.source.slice(this.visible.length),_,this.segmenter);g.text&&(this.visible+=g.text,this.charBudget=Math.max(0,this.charBudget-g.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:s=1e3,targetLatencyMs:o=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:c=80,flushOnFinish:u=!1}=e;this.minCharsPerSecond=_a(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,_a(s,1e3,1)),this.normalizedTargetLatencyMs=_a(o,900,1),this.normalizedCatchUpLatencyMs=_a(i,350,1),this.normalizedCatchUpThreshold=N2(r,600),this.normalizedStartDelayMs=N2(a,80),this.maxCommitFps=Math.trunc(_a(l,30,1)),this.maxCharsPerCommit=Math.trunc(_a(c,80,1)),this.flushOnFinish=u,this.segmenter=OU(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function LU(e={},t){const n=new NU(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function OU(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function PU(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let s="",o=0;for(const i of n.segment(e)){if(o>=t)break;s+=i.segment,o++}return{text:s,graphemeCount:o}}function L2(){return typeof performance<"u"?performance.now():Date.now()}function RU(e,t,n){return Math.min(n,Math.max(t,e))}var DU=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const u1=Symbol.for("markstream-vue:node-lifecycle"),O2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',P2='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',BU={id:"material",core:{"":P2,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:P2,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:O2,csharp:O2,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>Xs(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},d1=new Map;let R2="material";const Fa=new Map,D2=new Map;let f1=null;function FU(e){d1.set(e.id,e)}function HU(e){return DU(this,null,function*(){var t,n,s;if(Fa.has(e.id))return(t=Fa.get(e.id))!=null?t:null;let o=D2.get(e.id);return o||(o=((s=(n=e.loadExtended)==null?void 0:n.call(e))!=null?s:Promise.resolve(null)).then(i=>(Fa.set(e.id,i),f1?.(),i)).catch(()=>(Fa.set(e.id,null),null)),D2.set(e.id,o)),o})}const WU=Ql(0);f1=()=>{WU.value++},FU(BU);const zU={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function ty(e){var t;const n=(function(s){if(!s)return"";const o=s.trim();if(!o)return"";const[i]=o.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=zU[n])!=null?t:n}function lhe(e){const t=ty(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}function ahe(e){return(function(s){const o=d1.get(R2);if(!o)return;const i=o.core[s];if(i)return i;const r=Fa.get(o.id);if(r){const l=r[s];if(l)return l}o.loadExtended&&!Fa.has(o.id)&&HU(o)})(ty(e))||((n=(t=d1.get(R2))==null?void 0:t.fallback)!=null?n:"");var t,n}const che={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};let HM=!1;function uhe(){return HM}function dhe(){HM=!0}var Mh=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let Ao=null,$f=!1,Eh=sy;function Ih(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function ny(){try{const e=globalThis;return Ih(e?.katex)}catch{return null}}function sy(){return Mh(null,null,function*(){const e=ny();if(e)return e;const t=yield Xs(()=>import("./katex-DnlPpQZa.js"),[]);try{yield Xs(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([2,3]))}catch{}return Ih(t)})}function UU(e){Eh=e,Ao=null,$f=!1}function qU(e){UU(sy)}function WM(){return typeof Eh=="function"}function fhe(){var e;const t=Eh;if(!t||t===sy)return null;if(Ao)return Ao;const n=ny();if(n)return Ao=n,Ao;try{const s=t();return s&&typeof s?.then!="function"?(Ao=(e=Ih(s))!=null?e:s,Ao):null}catch{return null}}function oy(){return Mh(this,null,function*(){var e;const t=ny();if(t)return Ao=t,Ao;if(Ao)return Ao;if($f)return null;const n=Eh;if(!n)return $f=!0,null;try{const s=yield n();if(s)return Ao=(e=Ih(s))!=null?e:s,Ao}catch{}return $f=!0,null})}function zM(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Fr=null,$r=null;const Yo=new Map,Zi=new Map;let Lp=5;const Rl=new Set;function Ku(){if(Yo.size<Lp&&Rl.size){const e=Array.from(Rl);Rl.clear();for(const t of e)try{t()}catch{}}}function jU(e){Fr=e,$r=null,Fr.onmessage=t=>{const{id:n,html:s,error:o}=t.data,i=Yo.get(n);if(i)if(Yo.delete(n),clearTimeout(i.timeoutId),Ku(),o)i.reject(new Error(o));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(Zi.set(a,s),Zi.size>200){const c=Zi.keys().next().value;Zi.delete(c)}}i.resolve(s)}},Fr.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,s]of Yo.entries())clearTimeout(s.timeoutId),s.reject(new Error(`Worker error: ${t.message}`));Yo.clear(),Ku()}}function VU(){var e;Fr&&((e=Fr.terminate)==null||e.call(Fr)),Fr=null,$r=null}function KU(e,t=!0,n=2e3,s){return Mh(this,null,function*(){performance.now();const o=zM(e);if(!WM()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if($r)return Promise.reject($r);const i=`${t?"d":"i"}:${o}`,r=Zi.get(i);if(r)return Promise.resolve(r);const l=Fr||($r=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),$r.name="WorkerInitError",$r.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject($r);if(Yo.size>=Lp){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Yo.size,a.max=Lp,Promise.reject(a)}return new Promise((a,c)=>{if(s?.aborted){const f=new Error("Aborted");return f.name="AbortError",void c(f)}const u=Math.random().toString(36).slice(2),d=globalThis.setTimeout(()=>{Yo.delete(u);const f=new Error("Worker render timed out");f.name="WorkerTimeout",f.code="WORKER_TIMEOUT",c(f),Ku()},n);s&&s.addEventListener("abort",()=>{globalThis.clearTimeout(d),Yo.has(u)&&Yo.delete(u);const f=new Error("Aborted");f.name="AbortError",c(f),Ku()},{once:!0});const p=a,h=c;Yo.set(u,{resolve:f=>{p(f)},reject:f=>{h(f)},timeoutId:d}),l.postMessage({id:u,content:o,displayMode:t})})})}function phe(e,t=!0,n){const s=`${t?"d":"i"}:${zM(e)}`;if(Zi.set(s,n),Zi.size>200){const o=Zi.keys().next().value;Zi.delete(o)}}const GU="WORKER_BUSY";function YU(e=2e3,t){return Yo.size<Lp?Promise.resolve():new Promise((n,s)=>{let o,i=!1;const r=()=>{i||(i=!0,o&&globalThis.clearTimeout(o),Rl.delete(r),n())};if(Rl.add(r),o=globalThis.setTimeout(()=>{if(i)return;i=!0,Rl.delete(r);const l=new Error("Wait for worker slot timed out");l.name="WorkerBusyTimeout",l.code="WORKER_BUSY_TIMEOUT",s(l)},e),queueMicrotask(()=>Ku()),t){const l=()=>{if(i)return;i=!0,o&&globalThis.clearTimeout(o),Rl.delete(r);const a=new Error("Aborted");a.name="AbortError",s(a)};t.aborted?l():t.addEventListener("abort",l,{once:!0})}})}const Kc={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function hhe(e){return Mh(this,arguments,function*(t,n=!0,s={}){var o,i,r,l;if(!WM()){const m=new Error("KaTeX rendering disabled");throw m.name="KaTeXDisabled",m.code="KATEX_DISABLED",m}const a=(o=s.timeout)!=null?o:Kc.timeout,c=(i=s.waitTimeout)!=null?i:Kc.waitTimeout,u=(r=s.backoffMs)!=null?r:Kc.backoffMs,d=(l=s.maxRetries)!=null?l:Kc.maxRetries,p=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):Kc.maxRetries,h=s.signal;let f=0;for(;;){if(h?.aborted){const m=new Error("Aborted");throw m.name="AbortError",m}try{return yield KU(t,n,a,h)}catch(m){if(m?.code!==GU||f>=p)throw m;if(f++,yield YU(c,h).catch(()=>{}),h?.aborted){const b=new Error("Aborted");throw b.name="AbortError",b}u>0&&(yield new Promise(b=>globalThis.setTimeout(b,u*f)))}}})}function Ha(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function XU(e){var t;for(const n of e.split(/\r?\n/)){const s=n.trim();if(!s||s.startsWith("%%"))continue;const o=s.match(/^([A-Z][\w-]*)\b/i);return((t=o?.[1])==null?void 0:t.toLowerCase())||""}return""}function p1(e){const t=e.split(/\r?\n/).map(o=>o.trim()).filter(o=>o&&!o.startsWith("%%")),n=Math.max(1,t.length),s=XU(e);return s==="gantt"?220+28*n:s==="sequencediagram"?180+26*n:s==="classdiagram"||s==="statediagram"||s==="erdiagram"?180+24*n:s==="flowchart"||s==="graph"?170+28*n:200+22*n}function h1(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function UM(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function m1(e,t=360,n=500){return UM(e,t,n)}function g1(e,t=360,n=500){return UM(e,t,n)}var QU=Object.defineProperty,ZU=Object.defineProperties,JU=Object.getOwnPropertyDescriptors,B2=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,F2=(e,t,n)=>t in e?QU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qM=(e,t)=>{for(var n in t||(t={}))eq.call(t,n)&&F2(e,n,t[n]);if(B2)for(var n of B2(t))tq.call(t,n)&&F2(e,n,t[n]);return e},iy=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const ry=()=>Xs(()=>import("./mermaid.core-D-9Sx1No.js").then(e=>e.bq),[]);let zi=null,ly=ry;function nq(e){ly=e,zi=null}function sq(e){nq(ry)}function oq(){return typeof ly=="function"}function H2(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const o=t.mermaidAPI;return n=qM({},t),s={render:o.render.bind(o),parse:o.parse?o.parse.bind(o):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):o.initialize?o.initialize(i):void 0},ZU(n,JU(s))}var n,s;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function W2(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const s=qM({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,s):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(s):void 0}}catch{}}function mhe(){return iy(this,null,function*(){if(zi)return zi;const e=(function(){try{const s=globalThis;return H2(s?.mermaid)}catch{return null}})();if(e)return zi=e,W2(zi),zi;const t=ly;if(!t)return null;let n;try{n=yield t()}catch(s){throw t===ry?new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.'):s}return n?(zi=H2(n),W2(zi),zi):null})}let Gs=null,Nr=null;const Ts=new Map;let z2=5,U2=!1;const iq="WORKER_BUSY",rq="MERMAID_DISABLED";function lq(e){Gs=e,Nr=null;const t=e;Gs.onmessage=n=>{if(Gs!==t)return;const{id:s,ok:o,result:i,error:r}=n.data,l=Ts.get(s);l&&(o===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},Gs.onerror=n=>{var s,o;if(Gs===t)if(Ts.size!==0){try{U2?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}for(const[i,r]of Ts.entries())r.reject(new Error(`Worker error: ${n.message}`));Ts.clear()}else(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},Gs.onmessageerror=n=>{var s,o;if(Gs===t)if(Ts.size!==0){try{U2?console.error("[mermaidWorkerClient] Worker messageerror:",n):(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}for(const[i,r]of Ts.entries())r.reject(new Error("Worker messageerror"));Ts.clear()}else(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function aq(){var e;if(Gs)try{for(const[t,n]of Ts.entries())n.reject(new Error("Worker cleared"));Ts.clear(),(e=Gs.terminate)==null||e.call(Gs)}catch{}Gs=null,Nr=null}function jM(e,t,n=1400){if(!oq()){const o=new Error("Mermaid rendering disabled");return o.name="MermaidDisabled",o.code=rq,Promise.reject(o)}if(Nr)return Promise.reject(Nr);const s=Gs||(Nr=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Nr.name="WorkerInitError",Nr.code="WORKER_INIT_ERROR",null);if(!s)return Promise.reject(Nr);if(Ts.size>=z2){const o=new Error("Worker busy");return o.name="WorkerBusy",o.code=iq,o.inFlight=Ts.size,o.max=z2,Promise.reject(o)}return new Promise((o,i)=>{const r=Math.random().toString(36).slice(2);let l,a=!1;const c=()=>{a||(a=!0,l!=null&&globalThis.clearTimeout(l),Ts.delete(r))},u={resolve:d=>{c(),o(d)},reject:d=>{c(),i(d)}};Ts.set(r,u);try{s.postMessage({id:r,action:e,payload:t})}catch(d){return Ts.delete(r),void i(d)}l=globalThis.setTimeout(()=>{const d=new Error("Worker call timed out");d.name="WorkerTimeout",d.code="WORKER_TIMEOUT";const p=Ts.get(r);p&&p.reject(d)},n)})}function ghe(e,t,n=1400){return iy(this,null,function*(){try{return yield jM("canParse",{code:e,theme:t},n)}catch(s){return Promise.reject(s)}})}function vhe(e,t,n=1400){return iy(this,null,function*(){try{return yield jM("findPrefix",{code:e,theme:t},n)}catch(s){return Promise.reject(s)}})}function yhe(){if(Gs)try{for(const[e,t]of Ts.entries())t.reject(new Error("Worker terminated"));Ts.clear(),Gs.terminate()}finally{Gs=null}}var cq=Object.defineProperty,uq=Object.defineProperties,dq=Object.getOwnPropertyDescriptors,q2=Object.getOwnPropertySymbols,fq=Object.prototype.hasOwnProperty,pq=Object.prototype.propertyIsEnumerable,j2=(e,t,n)=>t in e?cq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t)=>{for(var n in t||(t={}))fq.call(t,n)&&j2(e,n,t[n]);if(q2)for(var n of q2(t))pq.call(t,n)&&j2(e,n,t[n]);return e},Lt=(e,t)=>uq(e,dq(t)),zn=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const hq="__global__",$g="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",v1=(()=>{const e=globalThis;if(e[$g])return e[$g];const t={scopedCustomComponents:{},revision:Ql(0)};return e[$g]=t,t})(),V2=v1.revision,mq=Symbol("markstreamCustomComponents"),gq=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function dd(e){return gq.has(String(e).trim().toLowerCase())}function vq(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ng(e={}){const t={};for(const[n,s]of Object.entries(e))if(s!=null){t[n]=s;for(const o of new Set([si(n),si(vq(n))]))!o||dd(o)||Object.prototype.hasOwnProperty.call(t,o)||(t[o]=s)}return t}function cs(e){const t=Ut(mq,null);return F(()=>{var n;return V2.value,(function(s,o={}){return V2.value,it(it(it({},Ng(v1.scopedCustomComponents[hq]||{})),Ng(o)),Ng((function(i){return i&&v1.scopedCustomComponents[i]||{}})(s)))})(e?.(),(n=t?.value)!=null?n:{})})}const yq=["aria-label"],kq={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},bq={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},un=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},Io=un(je({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(w(),N("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(w(),N("svg",bq,[...n[1]||(n[1]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),T("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(w(),N("svg",kq,[...n[0]||(n[0]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,yq))}),[["__scopeId","data-v-be21ab83"]]);Io.install=e=>{e.component(Io.__name,Io)};const _q={class:"emoji-node"},ho=un(je({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(w(),N("span",_q,R(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);ho.install=e=>{e.component(ho.__name,ho)};const wq=["id"],Sq=["title"],$o=un(je({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const s=document.querySelector(t);s?s.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(s,o)=>(w(),N("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[T("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+R(e.node.id)+"]",9,Sq)],8,wq))}}),[["__scopeId","data-v-c1463a29"]]);$o.install=e=>{e.component($o.__name,$o)};const VM=(()=>{try{return!1}catch{}return!1})();function Lg(e){VM&&console.warn(e)}function K2(e,t="safe",n){return J0(e,t,n)}function KM(e){return nU(e)}function Og(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function ay(e,t="safe"){const n=String(e.tag||e.type||"").trim(),s=c1((o=e.attrs)?Array.isArray(o)?o.every(Array.isArray)?o.map(([r,l])=>[String(r),Og(l)]):o.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),Og(r.value)]):Object.entries(o).map(([r,l])=>[r,Og(l)]):null,t,n);var o;if(!s)return;const i=KM($p(s));return Object.keys(i).length>0?i:void 0}function G2(e,t,n=!1){const s=Object.entries(t??{}),o=s.length>0?s.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${o} />`:`<${e}${o}>`}function Gc(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Pg(e,t,n,s,o,i,r=!1){const l=(function(d,p){return IM(d,p)})(e,s);if(ad.has(e.toLowerCase())||!l&&TM(e,i))return null;if(!l&&Z0(e,i))return r?[G2(e,t,!0)]:[G2(e,t),...n,`</${e}>`];const a=J0(t,i,e),c=a.key,u=c!=null&&c!==""?c:o;if(l){const d=s[e]||s[e.toLowerCase()],p=KM(a);return cn(d,Lt(it({},p),{key:u}),n.length>0?n:void 0)}return cn(e,Lt(it({},a),{innerHTML:void 0,key:u}),n.length>0?n:void 0)}function GM(e,t){return rU(e,t)}function Op(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const c=[],u=[];for(const d of i)if(d.type==="text")(c.length>0?c[c.length-1].children:u).push(d.content);else if(d.type==="self_closing"){const p=Pg(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);Gc(c.length>0?c[c.length-1].children:u,p)}else if(d.type==="tag_open")c.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const p=d.tagName.toLowerCase();let h=-1;for(let f=c.length-1;f>=0;f--)if(c[f].tagName.toLowerCase()===p){h=f;break}if(h!==-1)for(;c.length>h;){const f=c.pop(),m=Pg(f.tagName,f.attrs||{},f.children,r,f.autoKey,l);c.length>0?Gc(c[c.length-1].children,m):Gc(u,m),f.tagName.toLowerCase()!==p&&c.length>h&&Lg(`Auto-closing unclosed tag: <${f.tagName}>`)}else Lg(`Ignoring closing tag with no matching opening tag: </${d.tagName}>`)}for(;c.length>0;){const d=c.pop(),p=Pg(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);c.length>0?Gc(c[c.length-1].children,p):Gc(u,p),Lg(`Auto-closing unclosed tag: <${d.tagName}>`)}return u})(sU(e),t,n)}catch(o){return s=o,VM&&console.error("Failed to parse HTML to VNodes:",s),null}var s}const Cq=["innerHTML"],No=un(je({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Ut("markstreamHtmlPolicy",void 0),s=F(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),o=cs(()=>t.customId),i=je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=F(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:ec(l,s.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const c=Op(l,o.value,s.value);if(c!==null)return{mode:"dynamic",nodes:c}}if(!GM(l,o.value))return{mode:"html",content:ec(l,s.value)};const a=Op(l,o.value,s.value);return a===null?{mode:"html",content:ec(l,s.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(w(),N("span",{key:0,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[oe(x(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(w(),N("span",{key:1,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},R(r.value.content),3)):(w(),N("span",{key:2,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,Cq))}}),[["__scopeId","data-v-d17f12b0"]]);No.install=e=>{e.component(No.__name,No)};const xq={class:"inline-code"},Aq={key:0},Us=un(je({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=nd(),s=Ut("markstreamFade",void 0),o=Ut("markstreamTextStreamState",void 0),i=Ut("markstreamStreamVersion",void 0),r=F(()=>{const g=n.fade;return g===""||g===!0||g==="true"||g!==!1&&g!=="false"&&void 0}),l=F(()=>typeof r.value=="boolean"?r.value:typeof s?.value!="boolean"||s.value),a=F(()=>{var g;return String((g=t.node.code)!=null?g:"")}),c=F(()=>!l.value),u=F(()=>{var g;const v=(g=n["index-key"])!=null?g:n.indexKey;return v==null||v===""?"":String(v)}),d=Z(t.node.code),p=Z("");let h=i?.value;const f=Z(0);function m(){return d.value+p.value}function b(){p.value&&(d.value=m(),p.value="")}Ke([()=>t.node.code,u,l,()=>i?.value],([g,v,y,A])=>{const O=String(g??""),$=u.value,k=A!==h;h=A;const E=OM({nextContent:O,persistedContent:$?o?.get($):void 0,currentState:{settledContent:d.value,streamedDelta:p.value},typewriterEnabled:l.value,streamRenderVersionChanged:k});d.value=E.settledContent,p.value=E.streamedDelta,E.appended&&(f.value+=1),$&&o?.set($,O)},{immediate:!0}),Ke(l,g=>{var v;g||(v=m(),d.value=v,p.value="")});const _=F(()=>f.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(g,v)=>(w(),N("code",xq,[c.value?(w(),N(Le,{key:0},[qe(R(a.value),1)],64)):(w(),N(Le,{key:1},[d.value?(w(),N("span",Aq,R(d.value),1)):ie("",!0),p.value?(w(),N("span",{key:1,class:Re(["inline-code-stream-delta",[_.value]]),onAnimationend:b},R(p.value),35)):ie("",!0)],64))]))}}),[["__scopeId","data-v-1b73ee4e"]]);Us.install=e=>{e.component(Us.__name,Us)};const y1=Z(!1),Y2=Z(""),X2=Z("top"),yu=Z(null),ku=Z(null),k1=Z(null),b1=Z(null),Q2=Z(null);let Nf=null,Lf=null,_1=0;function YM(){Nf&&(clearTimeout(Nf),Nf=null),Lf&&(clearTimeout(Lf),Lf=null)}let df=!1,ff=null,Z2=!1;function Tq(e,t,n="top",s=!1,o,i){if(!e)return;const r=++_1;YM();const l=()=>zn(null,null,function*(){var a,c;if(yield(function(){return zn(this,null,function*(){if(!df&&!Z2&&typeof document<"u"){ff!=null||(ff=zn(null,null,function*(){const[{createApp:u,h:d},{default:p}]=yield Promise.all([Xs(()=>import("./vue.runtime.esm-bundler-BwwRtQwQ.js"),[]),Xs(()=>import("./Tooltip-CFQEzqC-.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),u({setup:()=>()=>{var f;return d(p,{visible:y1.value,"anchor-el":yu.value,content:Y2.value,placement:X2.value,id:ku.value,originX:k1.value,originY:b1.value,isDark:(f=Q2.value)!=null?f:void 0})}}).mount(h),df=!0}));try{yield ff}catch(u){df=!1,ff=null,Z2=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",u)}}})})(),df&&r===_1){ku.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,yu.value=e,Y2.value=t,X2.value=n,k1.value=(a=o?.x)!=null?a:null,b1.value=(c=o?.y)!=null?c:null,Q2.value=typeof i=="boolean"?i:null,y1.value=!0;try{e.setAttribute("aria-describedby",ku.value)}catch{}}});s?l():Nf=setTimeout(l,80)}function Mq(e=!1){_1+=1,YM();const t=()=>{if(yu.value&&ku.value)try{yu.value.removeAttribute("aria-describedby")}catch{}y1.value=!1,yu.value=null,ku.value=null,k1.value=null,b1.value=null};e?t():Lf=setTimeout(t,120)}const w1={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},S1=e=>{var t;return(t=w1[e])!=null?t:(function(n){return(n.split(".").pop()||n).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function J2(e){return{t(t){if(e.te&&w1[t]&&!e.te(t))return S1(t);const n=e.t(t);return n===t&&w1[t]?S1(t):n}}}function Eq(){const e=(function(){var t,n;try{const s=Ls(),o=s?.proxy,i=o?.$t;if(typeof i=="function"){const a=o?.$te;return{t:i.bind(o),te:typeof a=="function"?a.bind(o):void 0}}const r=(n=(t=s?.appContext)==null?void 0:t.config)==null?void 0:n.globalProperties,l=r?.$t;if(typeof l=="function"){const a=r?.$te;return{t:l.bind(r),te:typeof a=="function"?a.bind(r):void 0}}}catch{}return null})();if(e)return J2(e);try{const t=globalThis.$vueI18nUse||null;if(t&&typeof t=="function")try{const n=t();if(n&&typeof n.t=="function")return J2({t:n.t.bind(n),te:typeof n.te=="function"?n.te.bind(n):void 0})}catch{}}catch{}return{t:S1}}function Iq(e,t){var n,s;const o=(s=(n=e.indexKey)!=null?n:t["index-key"])!=null?s:t.indexKey;return o==null||o===""?"":String(o)}const $q=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Nq={key:1,class:"image-placeholder"},Lq={key:1,class:"image-node__raw-text"},Oq={key:0,class:"image-shimmer-overlay"},Pq={key:1,class:"image-node__raw-text"},Rq={key:2,class:"image-error"},qr=un(je({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){const n=e,s=t,o=Z(!1),i=Z(!1),r=Z(""),l=Z("primary"),a=Z(null),c=nd(),u=Ut(u1,null);let d="",p=null;const h=F(()=>Lw(n.node.src)),f=F(()=>Lw(n.fallbackSrc)),m=F(()=>r.value),b=F(()=>!n.lazy),_=F(()=>!n.node.loading&&l.value!=="failed"&&r.value.length>0),g=F(()=>l.value==="failed"),v=F(()=>!b.value&&!o.value&&!i.value&&l.value!=="failed"&&r.value.length>0),y=F(()=>Iq(n,c));function A(P=y.value){P&&a.value&&u?.reportHeight(P,a.value.offsetHeight)}function O(P=y.value){P&&ht(()=>{A(P)})}function $(){p&&(clearTimeout(p),p=null)}function k(){const P=y.value;P&&d!==P&&(d&&u?.markSettled(d),$(),d=P,u?.markPending(P),typeof window<"u"&&(p=window.setTimeout(()=>{d===P&&(O(P),E())},8e3)))}function E(){return zn(this,null,function*(){const P=d;P&&($(),d="",yield ht(),A(P),u?.markSettled(P))})}function M(){if(l.value==="primary"&&f.value&&f.value!==r.value)return l.value="fallback",r.value=f.value,o.value=!1,i.value=!1,void O();l.value="failed",i.value=!0,s("error",r.value),O()}function L(){o.value=!0,i.value=!1,s("load",m.value),O()}function S(P){P.preventDefault(),o.value&&!i.value&&s("click",[P,m.value])}const{t:I}=Eq();return Ke([h,f,()=>n.node.loading],()=>(o.value=!1,i.value=!1,n.node.loading||h.value?(r.value=h.value,void(l.value="primary")):f.value?(r.value=f.value,void(l.value="fallback")):(r.value="",l.value="failed",void(i.value=!0))),{immediate:!0}),Ke([_,o,i,m,()=>n.lazy],([P,D,W,z,q])=>P&&z&&!W?D?(E(),void O()):q?(k(),void O()):void(D||W||k()):(E(),void O()),{flush:"post",immediate:!0}),ls(()=>{(function(){const P=d;P&&($(),d="",u?.markSettled(P))})()}),(P,D)=>{var W,z,q,Q,X;return w(),N("span",{ref_key:"rootRef",ref:a,class:"image-node-container"},[_.value?(w(),N("img",{key:0,src:m.value,alt:String((z=(W=n.node.alt)!=null?W:n.node.title)!=null?z:""),title:String((Q=(q=n.node.title)!=null?q:n.node.alt)!=null?Q:""),class:Re(["image-node__img",{"is-loading":!b.value&&!o.value,"is-loaded":b.value||o.value,"has-natural-size":o.value,"cursor-pointer":o.value}]),loading:n.lazy?"lazy":void 0,fetchpriority:b.value?"high":void 0,decoding:b.value?"sync":"async",tabindex:o.value?0:-1,"aria-label":(X=n.node.alt)!=null?X:x(I)("image.preview"),onError:M,onLoad:L,onClick:S},null,42,$q)):ie("",!0),e.node.loading&&!i.value?(w(),N("span",Nq,[n.usePlaceholder?Cn(P.$slots,"placeholder",{key:0,node:n.node,displaySrc:m.value,imageLoaded:o.value,hasError:i.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy},()=>[D[0]||(D[0]=T("span",{class:"image-shimmer"},null,-1))],!0):(w(),N("span",Lq,R(e.node.raw),1))])):ie("",!0),oe(Gr,{name:"shimmer-fade"},{default:_e(()=>[v.value&&!e.node.loading?(w(),N("span",Oq,[n.usePlaceholder?Cn(P.$slots,"placeholder",{key:0,node:n.node,displaySrc:m.value,imageLoaded:o.value,hasError:i.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy},()=>[D[1]||(D[1]=T("span",{class:"image-shimmer"},null,-1))],!0):(w(),N("span",Pq,R(e.node.raw),1))])):ie("",!0)]),_:3}),g.value?(w(),N("span",Rq,[Cn(P.$slots,"error",{node:n.node,displaySrc:m.value,imageLoaded:o.value,hasError:i.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy},()=>[D[2]||(D[2]=T("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[T("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),T("span",null,R(x(I)("image.loadError")),1)],!0)])):ie("",!0)],512)}}}),[["__scopeId","data-v-cbb5c63e"]]);qr.install=e=>{e.component(qr.__name,qr)};const Dq={key:2},Ni=je({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=cs(()=>t.customId),s=Ut("markstreamHtmlPolicy",void 0),o=Ut("markstreamNestedRendererProps",void 0),i=F(()=>{var f;return(f=s?.value)!=null?f:"safe"}),r=F(()=>{var f,m;const b=(f=o?.value)!=null?f:{};return Lt(it({},b),{customId:(m=t.customId)!=null?m:b.customId,htmlPolicy:i.value})}),l=ui({loader:()=>Promise.resolve().then(()=>my),suspensible:!1}),a=F(()=>t.components[String(t.node.type)]),c=F(()=>!!(a.value&&n.value[t.node.type]&&!dd(String(t.node.type)))),u=F(()=>c.value?ay(t.node,i.value):void 0),d=F(()=>Array.isArray(t.node.children)&&t.node.children.length>0),p=F(()=>{var f;return String((f=t.node.content)!=null?f:"")}),h=F(()=>{var f,m;return String((m=(f=t.node.content)!=null?f:t.node.raw)!=null?m:"")});return(f,m)=>a.value&&c.value?(w(),ve(Hs(a.value),dn({key:0},u.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:_e(()=>[d.value?(w(),ve(x(l),dn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):p.value?(w(),ve(x(l),dn({key:1},r.value,{content:p.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(w(),ve(Hs(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(w(),N("span",Dq,R(h.value),1)):ie("",!0)}}),Bq=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Fq={key:0,translate:"no",class:"markstream-pre__diff-code"},Hq={class:"markstream-pre__diff-number","aria-hidden":"true"},Wq={class:"markstream-pre__diff-content"},zq={class:"markstream-pre__diff-content-inner"},Uq={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},qq=["textContent"],xo=je({__name:"PreCodeNode",props:{node:{},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},reservedHeightPx:{}},setup(e){const t=e,n=F(()=>{var S,I,P;const D=String((I=(S=t.node)==null?void 0:S.language)!=null?I:"");return String((P=String(D).split(/\s+/g)[0])!=null?P:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=F(()=>`language-${n.value}`),o=F(()=>{var S,I,P,D,W;return((S=t.node)==null?void 0:S.diff)===!0?String((P=(I=t.node)==null?void 0:I.code)!=null?P:""):(function(z,q){const Q=String(z??"");return q?Q:Q.replace(/\r\n$|\n$|\r$/,"")})((D=t.node)==null?void 0:D.code,((W=t.node)==null?void 0:W.loading)===!0)}),i=F(()=>o.value.split(/\r\n|\n|\r/)),r=F(()=>Array.from({length:Math.max(1,i.value.length)},(S,I)=>I+1)),l=F(()=>{var S;return t.showLineNumbers===!0&&((S=t.node)==null?void 0:S.diff)===!0}),a=F(()=>l.value&&t.diffInline===!0),c=F(()=>{const S=Number(t.reservedHeightPx);if(!Number.isFinite(S)||S<=0)return;const I=`${Math.ceil(S)}px`;return{height:I,minHeight:I,maxHeight:I,overflow:"auto"}});function u(S){return String(S??"").trim().length===0}function d(S,I="context",P={}){const D=u(S);return{code:S,kind:D&&I!=="hunk"&&!P.preserveBlankKind?"context":I,empty:D}}function p(S){const I=String(S??"");return I?I.split(/\r\n|\n|\r/):[]}function h(S,I){return!u(S[I])||I<S.length-1}function f(S){return S.startsWith("-")&&!S.startsWith("---")}function m(S){return S.startsWith("+")&&!S.startsWith("+++")}function b(S,I){const P=p(S),D=p(I),W=(function(ye,Me){const we=ye.length,ze=Me.length;if((we+1)*(ze+1)>15e5)return null;const Ue=ze+1,Fe=new Uint32Array((we+1)*(ze+1));for(let G=1;G<=we;G++)for(let ne=1;ne<=ze;ne++){const H=G*Ue+ne;if(ye[G-1]===Me[ne-1])Fe[H]=Fe[(G-1)*Ue+(ne-1)]+1;else{const J=Fe[(G-1)*Ue+ne],ce=Fe[G*Ue+(ne-1)];Fe[H]=J>=ce?J:ce}}const rt=[];let le=we,U=ze;for(;le>0&&U>0;)ye[le-1]===Me[U-1]?(rt.push({originalIndex:le-1,modifiedIndex:U-1}),le--,U--):Fe[(le-1)*Ue+U]>=Fe[le*Ue+(U-1)]?le--:U--;return rt.reverse(),rt})(P,D);if(W){const ye=[];let Me=0,we=0;for(const ze of W){for(;Me<ze.originalIndex;)ye.push(Lt(it({},d(P[Me],"removed",{preserveBlankKind:h(P,Me)})),{key:`inline-removed-source-${Me}`,number:""})),Me++;for(;we<ze.modifiedIndex;)ye.push(Lt(it({},d(D[we],"added",{preserveBlankKind:h(D,we)})),{key:`inline-added-source-${we}`,number:we+1})),we++;ye.push(Lt(it({},d(D[ze.modifiedIndex])),{key:`inline-context-source-${ze.originalIndex}-${ze.modifiedIndex}`,number:ze.modifiedIndex+1})),Me=ze.originalIndex+1,we=ze.modifiedIndex+1}for(;Me<P.length;)ye.push(Lt(it({},d(P[Me],"removed",{preserveBlankKind:h(P,Me)})),{key:`inline-removed-source-${Me}`,number:""})),Me++;for(;we<D.length;)ye.push(Lt(it({},d(D[we],"added",{preserveBlankKind:h(D,we)})),{key:`inline-added-source-${we}`,number:we+1})),we++;return ye}const z=[];let q=0,Q=P.length-1,X=D.length-1;for(;q<=Q&&q<=X&&P[q]===D[q];)z.push(Lt(it({},d(D[q])),{key:`inline-prefix-${q}`,number:q+1})),q++;const fe=[];for(;Q>=q&&X>=q&&P[Q]===D[X];)fe.unshift(Lt(it({},d(D[X])),{key:`inline-suffix-${X}`,number:X+1})),Q--,X--;for(let ye=q;ye<=Q;ye++)z.push(Lt(it({},d(P[ye],"removed",{preserveBlankKind:h(P,ye)})),{key:`inline-removed-source-${ye}`,number:""}));for(let ye=q;ye<=X;ye++)z.push(Lt(it({},d(D[ye],"added",{preserveBlankKind:h(D,ye)})),{key:`inline-added-source-${ye}`,number:ye+1}));return z.concat(fe)}const _=F(()=>{var S,I,P,D;const W=(function(X){const fe=X.some(Me=>f(Me)),ye=X.some(Me=>m(Me));return fe&&ye||(function(){var Me,we,ze,Ue;if(n.value==="diff")return!0;const Fe=(Ue=(ze=String((we=(Me=t.node)==null?void 0:Me.raw)!=null?we:"").split(/\r?\n/,1)[0])==null?void 0:ze.trim())!=null?Ue:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(Fe)})()&&(fe||ye)})(i.value),z=(function(){var X,fe;return((X=t.node)==null?void 0:X.originalCode)!=null||((fe=t.node)==null?void 0:fe.updatedCode)!=null})();if(a.value)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:W?(function(X){const fe=[];let ye=1;for(const[Me,we]of X.entries())if(we.startsWith("@@"))fe.push(Lt(it({},d(we,"hunk")),{key:`inline-hunk-${Me}`,number:""}));else if(f(we))fe.push(Lt(it({},d(we.slice(1),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${Me}`,number:""}));else if(m(we))fe.push(Lt(it({},d(we.slice(1),"added",{preserveBlankKind:!0})),{key:`inline-added-${Me}`,number:ye++}));else{const ze=we.startsWith(" ")?we.slice(1):we;fe.push(Lt(it({},d(ze)),{key:`inline-context-${Me}`,number:ye})),ye++}return fe})(i.value):b((S=t.node)==null?void 0:S.originalCode,(I=t.node)==null?void 0:I.updatedCode)}];if(!W&&z){const X=p((P=t.node)==null?void 0:P.originalCode),fe=p((D=t.node)==null?void 0:D.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:X.map((ye,Me)=>{const we=fe[Me]===ye?"context":"removed";return Lt(it({},d(ye,we,{preserveBlankKind:h(X,Me)})),{key:`original-${Me}`,number:Me+1})})},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:fe.map((ye,Me)=>{const we=X[Me]===ye?"context":"added";return Lt(it({},d(ye,we,{preserveBlankKind:h(fe,Me)})),{key:`modified-${Me}`,number:Me+1})})}]}const q=[],Q=[];for(const X of i.value)if(X.startsWith("@@"))q.push(d(X,"hunk")),Q.push(d(X,"hunk"));else if(X.startsWith("-")&&!X.startsWith("---"))q.push(d(X.slice(1),"removed",{preserveBlankKind:!0}));else if(X.startsWith("+")&&!X.startsWith("+++"))Q.push(d(X.slice(1),"added",{preserveBlankKind:!0}));else{const fe=X.startsWith(" ")?X.slice(1):X;q.push(d(fe)),Q.push(d(fe))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:q.map((X,fe)=>Lt(it({},X),{key:`original-${fe}`,number:fe+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:Q.map((X,fe)=>Lt(it({},X),{key:`modified-${fe}`,number:fe+1}))}]}),g=F(()=>{const S=n.value;return S?`Code block: ${S}`:"Code block"}),v=Z(null),y=Z([]);let A=null,O=null;function $(S){const I=Number.parseFloat(String(S??""));return Number.isFinite(I)&&I>0?I:0}function k(S,I){var P;if(!S)return I;const D=S.querySelector(".markstream-pre__diff-content"),W=D?.getBoundingClientRect(),z=(P=W?.height)!=null?P:0;return Math.max(I,Math.ceil(z))}function E(){typeof window<"u"&&(A!=null&&window.cancelAnimationFrame(A),A=window.requestAnimationFrame(()=>{(function(){var S,I;A=null;const P=v.value;if(!P||!l.value)return void(y.value.length&&(y.value=[]));const D=(function(ye){const Me=window.getComputedStyle(ye),we=$(Me.getPropertyValue("--markstream-pre-diff-line-height"));if(we>0)return we;const ze=$(Me.lineHeight);return ze>0?ze:18})(P),W=Array.from(P.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),z=Array.from(P.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),q=Math.max(W.length,z.length),Q=[];for(let ye=0;ye<q;ye++){const Me=k((S=W[ye])!=null?S:null,D),we=k((I=z[ye])!=null?I:null,D),ze=Math.max(D,Me,we);Q.push({rowHeight:ze,originalHeight:Me,modifiedHeight:we})}var X,fe;X=y.value,fe=Q,X.length===fe.length&&X.every((ye,Me)=>{const we=fe[Me];return we&&Math.abs(ye.rowHeight-we.rowHeight)<=.5&&Math.abs(ye.originalHeight-we.originalHeight)<=.5&&Math.abs(ye.modifiedHeight-we.modifiedHeight)<=.5})||(y.value=Q)})()}))}function M(S){O?.disconnect(),O=null,S&&l.value&&typeof ResizeObserver<"u"&&(O=new ResizeObserver(()=>{E()}),O.observe(S))}function L(S,I){const P=y.value[S];if(!P)return;const D=I==="original"?P.originalHeight:P.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(P.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(D)}px`}}return Ke(v,S=>{M(S),ht(()=>E())},{flush:"post"}),Ke([l,_],()=>{M(v.value),ht(()=>E())},{flush:"post",immediate:!0}),ls(()=>{A!=null&&(window.cancelAnimationFrame(A),A=null),O?.disconnect(),O=null}),(S,I)=>(w(),N("pre",{ref_key:"preRef",ref:v,style:Gt(c.value),class:Re([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":l.value,"markstream-pre--diff-inline":a.value}]),"aria-busy":e.node.loading===!0,"aria-label":g.value,"data-language":n.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[l.value?(w(),N("code",Fq,[(w(!0),N(Le,null,nt(_.value,P=>(w(),N("span",{key:P.key,class:Re(["markstream-pre__diff-pane",P.className])},[(w(!0),N(Le,null,nt(P.lines,(D,W)=>(w(),N("span",{key:D.key,class:Re(["markstream-pre__diff-line",[`markstream-pre__diff-line--${D.kind}`,{"markstream-pre__diff-line--empty":D.empty}]]),style:Gt(L(W,P.key))},[I[0]||(I[0]=T("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),T("span",Hq,R(D.number),1),T("span",Wq,[T("span",zq,R(D.code),1)])],6))),128))],2))),128))])):(w(),N(Le,{key:1},[t.showLineNumbers?(w(),N("span",Uq,[(w(!0),N(Le,null,nt(r.value,P=>(w(),N("span",{key:P,class:"markstream-pre__line-number"},R(P),1))),128))])):ie("",!0),T("code",{translate:"no",class:"markstream-pre__code",textContent:R(o.value)},null,8,qq)],64))],14,Bq))}});xo.install=e=>{e.component(xo.__name,xo)};const Rg=Ql(!1);let eS=null;const jq={key:0},Xn=un(je({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=(eS||(eS=oy().then(_=>{Rg.value=!!_}).catch(()=>{Rg.value=!1})),Vf(Rg)),s=nd(),o=Ut("markstreamFade",void 0),i=Ut("markstreamTextStreamState",void 0),r=Ut("markstreamStreamVersion",void 0),l=F(()=>{const _=s.fade;return _===""||_===!0||_==="true"||_!==!1&&_!=="false"&&void 0}),a=F(()=>typeof l.value=="boolean"?l.value:typeof o?.value!="boolean"||o.value),c=F(()=>{var _;const g=(_=s["index-key"])!=null?_:s.indexKey;return g==null||g===""?"":String(g)}),u=Z(t.node.content),d=Z("");let p=r?.value;const h=Z(0);function f(){return u.value+d.value}function m(){d.value&&(u.value=f(),d.value="")}Ke([()=>t.node.content,c,a,()=>r?.value],([_,g,v,y])=>{const A=String(_??""),O=c.value,$=y!==p;p=y;const k=OM({nextContent:A,persistedContent:O?i?.get(O):void 0,currentState:{settledContent:u.value,streamedDelta:d.value},typewriterEnabled:a.value,streamRenderVersionChanged:$});u.value=k.settledContent,d.value=k.streamedDelta,k.appended&&(h.value+=1),O&&i?.set(O,A)},{immediate:!0}),Ke(a,_=>{var g;_||(g=f(),u.value=g,d.value="")});const b=F(()=>h.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(_,g)=>(w(),N("span",{class:Re([[x(n)&&e.node.center?"text-node-center":""],"text-node"])},[u.value?(w(),N("span",jq,R(u.value),1)):ie("",!0),d.value?(w(),N("span",{key:1,class:Re(["text-node-stream-delta",[b.value]]),onAnimationend:m},R(d.value),35)):ie("",!0)],2))}}),[["__scopeId","data-v-aae85f13"]]);Xn.install=e=>{e.component(Xn.__name,Xn)};const XM=je({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:t}){const n=t;return()=>{var s;return cn(xo,Lt(it({},t),{node:n.node,showLineNumbers:!0,reservedHeightPx:(s=n.estimatedHeightPx)!=null?s:n.estimatedContentHeightPx,class:["code-pre-fallback",t.class],"data-markstream-code-loading":"1"}))}}}),Dg=ui({loader:()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./CodeBlockNode-CXnTLMNr.js"),__vite__mapDeps([4,5,6]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to preformatted code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),xo}}),loadingComponent:XM,delay:0,suspensible:!1}),gi=ui(()=>zn(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,s,o,i;return cn(Xn,Lt(it({},t),{node:{type:"text",content:(s=t.node.raw)!=null?s:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(o=t.node.content)!=null?o:""}$`}}))};try{if(yield oy())return(yield Xs(()=>import("./index6-CBdZmmyx.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,s,o,i;return cn(Xn,Lt(it({},t),{node:{type:"text",content:(s=t.node.raw)!=null?s:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(o=t.node.content)!=null?o:""}$`}}))}})),QM=ui(()=>zn(null,null,function*(){try{if(yield oy())return(yield Xs(()=>import("./index5-B2PldaO2.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,s,o;return cn(Xn,Lt(it({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(o=e.node.raw)!=null?o:`$$${(s=e.node.content)!=null?s:""}$$`}}))}})),Zs=un(je({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(w(),N("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=s=>t.$emit("click",s,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=s=>t.$emit("mouseEnter",s,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=s=>t.$emit("mouseLeave",s,e.node.id,e.messageId,e.threadId))},R(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Zs.install=e=>{e.component(Zs.__name,Zs)};const Vq={class:"superscript-node"},mo=un(je({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,footnote_reference:$o,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,emoji:ho,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("sup",Vq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"superscript"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);mo.install=e=>{e.component(mo.__name,mo)};const Kq={class:"subscript-node"},go=un(je({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,footnote_reference:$o,strikethrough:eo,highlight:Lo,insert:vo,superscript:mo,emoji:ho,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("sub",Kq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"subscript"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);go.install=e=>{e.component(go.__name,go)};const Gq={class:"strong-node"},Js=un(je({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,emphasis:no,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("strong",Gq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"strong"}-${l}`,components:s.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);Js.install=e=>{e.component(Js.__name,Js)};const Yq={class:"strikethrough-node"},eo=un(je({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("del",Yq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"strikethrough"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);eo.install=e=>{e.component(eo.__name,eo)};const Xq=["href","title","aria-label","aria-hidden","target","rel"],Qq=["aria-hidden"],Zq={class:"link-text-wrapper relative inline-flex"},Jq={class:"leading-[normal] link-text"},to=un(je({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=Ut("markstreamShowTooltips",void 0),s=F(()=>{const _=n?.value;return typeof _=="boolean"?_:t.showTooltip}),o=F(()=>{var _,g,v,y,A;const O=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",$=(_=t.animationOpacity)!=null?_:.35,k=Math.max(.12,Math.min(.5*$,$)),E={"--underline-height":`${(g=t.underlineHeight)!=null?g:2}px`,"--underline-bottom":O,"--underline-opacity":String($),"--underline-rest-opacity":String(k),"--underline-duration":`${(v=t.animationDuration)!=null?v:1.6}s`,"--underline-timing":(y=t.animationTiming)!=null?y:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(A=t.animationIteration)!=null?A:"infinite"};return t.color&&(E["--link-color"]=t.color),E}),i=cs(()=>t.customId),r=F(()=>it({text:Xn,strong:Js,strikethrough:eo,emphasis:no,image:qr,html_inline:No,inline_code:Us},i.value)),l=nd(),a=F(()=>{var _,g;const v=(_=t.node)==null?void 0:_.attrs;if(!v||typeof v!="object")return{};const y={};if(Array.isArray(v))for(const A of v)Array.isArray(A)&&A[0]&&(y[String(A[0])]=String((g=A[1])!=null?g:""));else for(const[A,O]of Object.entries(v))A&&O!=null&&O!==!1&&(y[A]=O===!0?"":String(O));return K2(y,"safe","a")}),c=F(()=>it(it({},l),a.value)),u=F(()=>{var _,g;return K2({href:String((g=(_=t.node)==null?void 0:_.href)!=null?g:"")},"safe","a").href}),d=F(()=>{if(!u.value)return;const _=c.value.target;return(typeof _=="string"?_.trim():String(_??"").trim())||(U9(u.value)?"_blank":void 0)}),p=F(()=>{var _;return String((_=d.value)!=null?_:"").trim().toLowerCase()==="_blank"}),h=F(()=>{if(!u.value)return;const _=c.value.rel,g=new Set((typeof _=="string"?_:String(_??"")).split(/\s+/).filter(Boolean)),v=new Set(Array.from(g).filter(y=>y.toLowerCase()!=="opener"));return p.value&&(v.add("noopener"),v.add("noreferrer")),v.size>0?Array.from(v).join(" "):void 0}),f=F(()=>{const _=it({},c.value);return delete _.title,delete _.href,delete _.target,delete _.rel,_});function m(){s.value&&Mq()}const b=F(()=>{var _,g;const v=(_=t.node)==null?void 0:_.title;return typeof v=="string"&&v.trim().length>0?v:String((g=u.value)!=null?g:"")});return(_,g)=>{var v,y;return e.node.loading?(w(),N("span",dn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},x(l),{style:o.value}),[T("span",Zq,[T("span",Jq,[oe(x(Xn),{class:"leading-[normal] link-text",node:{type:"text",content:String((v=e.node.text)!=null?v:""),raw:String((y=e.node.text)!=null?y:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),g[1]||(g[1]=T("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Qq)):(w(),N("a",dn({key:0,class:"link-node",href:u.value,title:s.value?"":b.value,"aria-label":`Link: ${b.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},f.value,{style:o.value,onMouseenter:g[0]||(g[0]=A=>(function(O){var $,k,E,M;if(!s.value)return;const L=O,S=L?.clientX!=null&&L?.clientY!=null?{x:L.clientX,y:L.clientY}:void 0,I=(($=t.node)==null?void 0:$.title)||((k=u.value)!=null&&k.includes("xn--")&&((M=(E=t.node)==null?void 0:E.text)!=null&&M.includes("://"))?t.node.text:u.value)||"";Tq(O.currentTarget,I,"top",!1,S)})(A)),onMouseleave:m}),[(w(!0),N(Le,null,nt(e.node.children,(A,O)=>(w(),ve(x(Ni),{key:`${e.indexKey||"emphasis"}-${O}`,components:r.value,node:A,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${O}`},null,8,["components","node","custom-id","index-key"]))),128))],16,Xq))}}}),[["__scopeId","data-v-367e6ca4"]]);to.install=e=>{e.component(to.__name,to)};const ej={class:"insert-node"},vo=un(je({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,strikethrough:eo,highlight:Lo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("ins",ej,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"insert"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);vo.install=e=>{e.component(vo.__name,vo)};const tj={class:"highlight-node"},Lo=un(je({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,strikethrough:eo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("mark",tj,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"highlight"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);Lo.install=e=>{e.component(Lo.__name,Lo)};const nj={class:"emphasis-node"},no=un(je({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("em",nj,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"emphasis"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);no.install=e=>{e.component(no.__name,no)};const sj={class:"hard-break"},jr=un(je({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(w(),N("br",sj))}),[["__scopeId","data-v-50c58f70"]]);jr.install=e=>{e.component(jr.__name,jr)};const Gu=je({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=Dr({checkbox:Io,checkbox_input:Io,emoji:ho,emphasis:no,hardbreak:jr,highlight:Lo,inline_code:Us,insert:vo,link:to,reference:Zs,strikethrough:eo,strong:Js,subscript:go,superscript:mo,text:Xn}),s=cs(()=>t.customId),o=F(()=>{const i=s.value;return Object.keys(i).length>0?it(it({},n),i):n});return(i,r)=>(w(!0),N(Le,null,nt(e.nodes,(l,a)=>(w(),ve(x(Ni),{key:a,components:o.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function C1(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(C1)}function Pp(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(C1))return e;if(!t||e.length!==1)return null;const s=e[0];if(s?.type!=="paragraph"||!Array.isArray(s.children))return null;const o=s.children;return(n||o.length>0)&&o.every(C1)?o:null}function dc(e){var t,n;if(!e?.length)return null;let s="";for(const o of e){if(o?.type!=="text"||o.center===!0)return null;s+=String((n=(t=o.content)!=null?t:o.raw)!=null?n:"")}return s}const oj=["cite"],ij={key:0,dir:"auto",class:"paragraph-node"},rj=["custom-id"],Of=un(je({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>!!n.value.paragraph),o=F(()=>!!n.value.text),i=F(()=>Pp(t.node.children,!s.value)),r=F(()=>t.fade!==!1||o.value?null:dc(i.value));return En("markstreamShowTooltips",F(()=>t.showTooltips)),En("markstreamFade",F(()=>t.fade)),(l,a)=>(w(),N("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(w(),N("p",ij,[r.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(r.value),9,rj)):(w(),ve(x(Gu),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(w(),ve(x(yo),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=c=>l.$emit("copy",c))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,oj))}}),[["__scopeId","data-v-abfecebc"]]);Of.install=e=>{e.component(Of.__name,Of)};const lj={class:"definition-list"},aj={class:"definition-term"},cj={class:"definition-desc"},Pf=un(je({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,s)=>(w(),N("dl",lj,[(w(!0),N(Le,null,nt(t.node.items,(o,i)=>(w(),N(Le,{key:i},[T("dt",aj,[oe(x(yo),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:o.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:s[0]||(s[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),T("dd",cj,[oe(x(yo),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:o.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:s[1]||(s[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);Pf.install=e=>{e.component(Pf.__name,Pf)};const uj=["href","title"],bu=un(je({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(s){var o;if(s.preventDefault(),typeof document>"u")return;const i=`fnref-${String((o=t.node.id)!=null?o:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(s,o)=>(w(),N("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,uj))}}),[["__scopeId","data-v-e1eb37b6"]]);bu.install=e=>{e.component(bu.__name,bu)};const dj=["id"],fj={class:"flex-1"},Rf=je({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,s)=>(w(),N("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[T("div",fj,[oe(x(yo),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:s[0]||(s[0]=o=>n.$emit("copy",o))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,dj))}});Rf.install=e=>{e.component(Rf.__name,Rf)};const pj=["custom-id"],x1=un(je({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=Ut("markstreamFade",void 0),o=F(()=>s?.value!==!1||n.value.text?null:dc(t.node.children)),i=F(()=>it({text:Xn,inline_code:Us,link:to,image:qr,strong:Js,emphasis:no,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,checkbox:Io,checkbox_input:Io,footnote_reference:$o,hardbreak:jr,math_inline:gi,reference:Zs},n.value));return(r,l)=>(w(),ve(Hs(`h${e.node.level}`),dn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:_e(()=>[o.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(o.value),9,pj)):(w(!0),N(Le,{key:1},nt(e.node.children,(a,c)=>(w(),ve(x(Ni),{key:c,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${c}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),Rp=x1;Rp.install=e=>{e.component(x1.__name,x1)};const hj={key:0,dir:"auto",class:"paragraph-node"},mj=["custom-id"],gj={dir:"auto",class:"paragraph-node"},vj=["custom-id"],tc=un(je({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=F(()=>{var h;return(h=t.node)!=null?h:t.item}),s=cs(()=>t.customId),o=F(()=>!!s.value.paragraph),i=F(()=>!!s.value.text),r=F(()=>{var h;return Pp((h=n.value)==null?void 0:h.children,!o.value)}),l=F(()=>{var h;if(o.value)return null;const f=(h=n.value)==null?void 0:h.children;if(!Array.isArray(f)||f.length<2)return null;const m=f[0];if(m?.type!=="paragraph"||!Array.isArray(m.children))return null;const b=f.slice(1);if(!b.every(g=>g?.type==="list"))return null;const _=Pp([m]);return _?{paragraphChildren:_,nestedLists:b}:null});function a(){return t.fade===!1&&!i.value}const c=F(()=>a()?dc(r.value):null),u=F(()=>{var h;return a()?dc((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),p=F(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return En("markstreamShowTooltips",F(()=>t.showTooltips)),En("markstreamFade",F(()=>t.fade)),(h,f)=>{var m,b;return w(),N("li",dn({class:"list-item",dir:"auto"},p.value),[r.value?(w(),N("p",hj,[c.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(c.value),9,mj)):(w(),ve(x(Gu),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(w(),N(Le,{key:1},[T("p",gj,[u.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(u.value),9,vj)):(w(),ve(x(Gu),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(w(!0),N(Le,null,nt(l.value.nestedLists,(_,g)=>(w(),ve(x(yo),{key:g,nodes:[_],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${g}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:f[0]||(f[0]=v=>h.$emit("copy",v))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(w(),ve(x(yo),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(b=(m=n.value)==null?void 0:m.children)!=null?b:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:f[1]||(f[1]=_=>h.$emit("copy",_))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);tc.install=e=>{e.component(tc.__name,tc)};const nc=un(je({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=cs(()=>e.customId),n=F(()=>t.value.list_item||tc);return(s,o)=>(w(),ve(Hs(e.node.ordered?"ol":"ul"),{class:Re(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:_e(()=>[(w(!0),N(Le,null,nt(e.node.items,(i,r)=>{var l;return w(),ve(Hs(n.value),dn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:o[0]||(o[0]=a=>s.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);nc.install=e=>{e.component(nc.__name,nc)};const ZM=Symbol("ViewportPriority");function yj(e,t){var n,s;const o=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?Z(t):t,r=o?(n=window.requestIdleCallback)!=null?n:g=>window.setTimeout(()=>g({didTimeout:!0,timeRemaining:()=>0}),16):null,l=o?(s=window.cancelIdleCallback)!=null?s:g=>window.clearTimeout(g):null;let a=null,c=null;const u=new Map,d=new Set;let p=null;function h(){if(p!=null){try{l?.(p)}catch{}p=null}}function f(){if(!u.size){try{a?.disconnect()}catch{}a=null,c=null,d.size||h()}}function m(g){const v=u.get(g);if(v){if(!v.visible.value){v.visible.value=!0;try{v.resolve()}catch{}}try{a?.unobserve(g)}catch{}u.delete(g),d.delete(g),f()}}function b(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&p==null&&d.size&&(p=r(()=>{p=null;const g=d.values().next().value;g&&(d.delete(g),m(g),d.size&&b())},{timeout:1200}))}Ke(i,g=>{if(!g){for(const v of Array.from(u.keys()))m(v);h()}},{flush:"sync"});const _=(g,v)=>{const y=Z(!1);let A,O=!1;const $=new Promise(M=>{A=()=>{O||(O=!0,M())}}),k=()=>{try{a?.unobserve(g)}catch{}u.delete(g),d.delete(g),f()};if(!o||!i.value)return y.value=!0,A(),{isVisible:y,whenVisible:$,destroy:k};const E=(function(M,L){if(!o)return a;if(typeof IntersectionObserver>"u")return null;const S=(function(D,W){var z,q,Q;return{root:(z=e?.(D??null))!=null?z:null,rootMargin:(q=W?.rootMargin)!=null?q:"300px",threshold:(Q=W?.threshold)!=null?Q:0}})(M,L);if(a&&(P=S,(I=c)&&I.root===P.root&&I.rootMargin===P.rootMargin&&I.threshold===P.threshold))return a;var I,P;if(a)try{a.disconnect()}catch{}a=new IntersectionObserver(D=>{for(const W of D)(W.isIntersecting||W.intersectionRatio>0)&&m(W.target)},{root:S.root,rootMargin:S.rootMargin,threshold:S.threshold}),c=S;for(const D of u.keys())a.observe(D);return a})(g,v);return E?(u.set(g,{resolve:A,visible:y}),E.observe(g),d.add(g),b(),{isVisible:y,whenVisible:$,destroy:k}):(y.value=!0,A(),{isVisible:y,whenVisible:$,destroy:k})};return En(ZM,_),_}function kj(){var e,t;const n=Ut(ZM,void 0);if(n)return n;const s=new WeakMap;let o=null;const i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:p=>window.setTimeout(()=>p({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:p=>window.clearTimeout(p):null,c=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},u=p=>{const h=s.get(p);if(h){if(!h.visible.value){h.visible.value=!0;try{h.resolve()}catch{}}try{o?.unobserve(p)}catch{}s.delete(p),i.delete(p),i.size||c()}},d=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const p=i.values().next().value;p&&(i.delete(p),u(p),i.size&&d())},{timeout:1200}))};return p=>{const h=Z(!1);let f,m=!1;const b=new Promise(v=>{f=()=>{m||(m=!0,v())}}),_=()=>{try{o?.unobserve(p)}catch{}s.delete(p),i.delete(p),i.size||c()},g=o||(typeof window>"u"||typeof IntersectionObserver>"u"?null:(o=new IntersectionObserver(v=>{for(const y of v)(y.isIntersecting||y.intersectionRatio>0)&&u(y.target)},{root:null,rootMargin:"300px",threshold:0}),o));return g?(s.set(p,{resolve:f,visible:h}),g.observe(p),i.add(p),d(),{isVisible:h,whenVisible:b,destroy:_}):(h.value=!0,f(),{isVisible:h,whenVisible:b,destroy:_})}}const bj={key:2,class:"html-block-node__raw"},_j=["innerHTML"],wj={key:1,class:"html-block-node__placeholder"},_u=un(je({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Ut("markstreamHtmlPolicy",void 0),s=Ut("markstreamNestedRendererProps",void 0),o=F(()=>{var O,$;return($=(O=t.htmlPolicy)!=null?O:n?.value)!=null?$:"safe"}),i=F(()=>{var O,$;const k=(O=s?.value)!=null?O:{};return Lt(it({},k),{customId:($=t.customId)!=null?$:k.customId,htmlPolicy:o.value})}),r=ui({loader:()=>Promise.resolve().then(()=>my),suspensible:!1}),l=F(()=>{const O=c1(t.node.attrs,o.value);if(!O)return;const $=$p(O);return Object.keys($).length>0?$:void 0}),a=F(()=>{const O=String(t.node.tag||"").trim(),$=c1(t.node.attrs,o.value,O);if(!$)return;const k=$p($);return Object.keys(k).length>0?k:void 0}),c=cs(()=>t.customId),u=je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=Z(null),p=Z(typeof window>"u"),h=Z(t.node.content),f=F(()=>Array.isArray(t.node.children)?t.node.children:[]),m=F(()=>String(t.node.tag||"div")),b=F(()=>{const O=m.value.trim().toLowerCase();return DT.has(O)||Z0(O,o.value)}),_=F(()=>f.value.length>0&&!!t.node.tag&&!b.value),g=F(()=>{var O,$,k;if(_.value)return{mode:"structured"};if(!p.value)return{mode:"html",content:(O=h.value)!=null?O:""};const E=($=h.value)!=null?$:t.node.content;if(!E)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:ec(E,o.value)};if(t.node.loading){const L=Op(E,c.value,o.value);return L===null?{mode:"text",content:(k=t.node.raw)!=null?k:E}:{mode:"dynamic",nodes:L}}if(!GM(E,c.value))return{mode:"html",content:ec(E,o.value)};const M=Op(E,c.value,o.value);return M===null?{mode:"html",content:ec(E,o.value)}:{mode:"dynamic",nodes:M}}),v=kj(),y=Z(null),A=!!t.node.loading;return typeof window<"u"?(Ke(d,O=>{var $,k;if((k=($=y.value)==null?void 0:$.destroy)==null||k.call($),y.value=null,!A)return p.value=!0,void(h.value=t.node.content);if(!O)return void(p.value=!1);const E=v(O,{rootMargin:"400px"});y.value=E,p.value=E.isVisible.value,E.whenVisible.then(()=>{p.value=!0})},{immediate:!0}),Ke(()=>t.node.content,O=>{A&&!p.value||(h.value=O)})):p.value=!0,ls(()=>{var O,$;($=(O=y.value)==null?void 0:O.destroy)==null||$.call(O),y.value=null}),(O,$)=>(w(),ve(Hs(_.value?m.value:"div"),dn({ref_key:"htmlRef",ref:d,class:"html-block-node"},_.value?a.value:void 0),{default:_e(()=>[p.value?(w(),N(Le,{key:0},[g.value.mode==="structured"?(w(),ve(x(r),dn({key:0},i.value,{nodes:f.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):g.value.mode==="dynamic"?(w(),ve(x(u),{key:1,nodes:g.value.nodes},null,8,["nodes"])):g.value.mode==="text"?(w(),N("pre",bj,R(g.value.content),1)):(w(),N("div",dn({key:3},l.value,{innerHTML:g.value.content}),null,16,_j))],64)):(w(),N("div",wj,[Cn(O.$slots,"placeholder",{node:e.node},()=>[$[0]||($[0]=T("span",{class:"html-block-node__placeholder-bar"},null,-1)),$[1]||($[1]=T("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),$[2]||($[2]=T("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-f1744dfb"]]);_u.install=e=>{e.component(_u.__name,_u)};const Sj={dir:"auto",class:"paragraph-node"},Cj=["custom-id"],ql=un(je({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=cs(()=>t.customId),s=Ut("markstreamHtmlPolicy",void 0),o=Ut("markstreamFade",void 0),i=Ut("markstreamParseOptions",void 0),r=Ut("markstreamCustomMarkdownIt",void 0),l=Ut("markstreamNestedRendererProps",void 0),a=F(()=>{var k;return(k=s?.value)!=null?k:"safe"}),c=F(()=>{var k;return(k=t.parseOptions)!=null?k:i?.value}),u=F(()=>{var k;return(k=t.customMarkdownIt)!=null?k:r?.value}),d=F(()=>{var k,E;return(E=t.customHtmlTags)!=null?E:(k=l?.value)==null?void 0:k.customHtmlTags}),p=F(()=>{var k,E;const M=(k=l?.value)!=null?k:{};return Lt(it({},M),{customId:(E=t.customId)!=null?E:M.customId,customHtmlTags:d.value,parseOptions:c.value,customMarkdownIt:u.value,htmlPolicy:a.value})}),h=ui({loader:()=>Promise.resolve().then(()=>my),suspensible:!1});function f(k){var E;return k.type==="text"&&String((E=k.content)!=null?E:"").trim()===""}const m=F(()=>t.node.children.filter(k=>!f(k))),b=F(()=>m.value.length>0&&m.value.every(k=>k.type==="image"||(function(E){var M;const L=(function(S){return S.type==="link"&&Array.isArray(S.children)?S.children.filter(I=>!f(I)):[]})(E);return L.length===1&&((M=L[0])==null?void 0:M.type)==="image"})(k))),_=F(()=>new Set(kc(d.value))),g=F(()=>{if(!b.value||m.value.length<=1)return t.node.children;const k=[];for(let E=0;E<t.node.children.length;E++){const M=t.node.children[E];if(!f(M)){k.push(M);continue}const L=k.length>0,S=t.node.children.slice(E+1).some(I=>!f(I));L&&S&&k.push(Lt(it({},M),{content:" ",raw:" "}))}return k}),v=F(()=>o?.value===!1&&!n.value.text),y=F(()=>v.value?dc(g.value):null);function A(k,E){return{node:k,"index-key":`${t.indexKey}-${E}`,"custom-id":t.customId,"custom-html-tags":d.value}}const O=F(()=>it({inline_code:Us,image:qr,link:to,hardbreak:jr,emphasis:no,strong:Js,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,html_inline:No,html_block:_u,emoji:ho,checkbox:Io,math_inline:gi,checkbox_input:Io,reference:Zs,footnote_anchor:bu,footnote_reference:$o,text:Xn},n.value)),$=F(()=>g.value.map((k,E)=>{var M;const L=(function(S){var I,P,D,W;if(S.type==="html_block"||S.type==="html_inline"){const z=String((I=S.tag)!=null?I:"").trim().toLowerCase()||WT(S.content);if(z&&!_.value.has(z)&&zT((P=S.content)!=null?P:S.raw,z)){const q=String((W=(D=S.content)!=null?D:S.raw)!=null?W:"");return{child:{type:"text",content:q,raw:q},component:Xn,isCustomComponent:!1}}}return{child:S,component:O.value[S.type],isCustomComponent:!!(n.value[S.type]&&!dd(String(S.type)))}})(k);return Lt(it({},L),{index:E,key:`${t.indexKey||"paragraph"}-${E}`,customAttrs:L.isCustomComponent?ay(L.child,a.value):void 0,hasSlotChildren:Array.isArray(L.child.children)&&L.child.children.length>0,slotContent:String((M=L.child.content)!=null?M:""),originalChild:k})}));return(k,E)=>(w(),N("p",Sj,[y.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(y.value),9,Cj)):(w(!0),N(Le,{key:1},nt($.value,M=>{return w(),N(Le,{key:M.key},[b.value&&f(M.originalChild)?(w(),N(Le,{key:0},[qe(R((L=M.originalChild,String((S=L.content)!=null?S:""))),1)],64)):M.isCustomComponent?(w(),ve(Hs(M.component),dn({key:1,ref_for:!0},M.customAttrs,{node:M.child,loading:M.child.loading,"index-key":M.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":p.value.isDark}),{default:_e(()=>[M.hasSlotChildren?(w(),ve(x(h),dn({key:0,ref_for:!0},p.value,{nodes:M.child.children,"index-key":M.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):M.slotContent?(w(),ve(x(h),dn({key:1,ref_for:!0},p.value,{content:M.slotContent,final:!M.child.loading,"index-key":`${M.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(w(),ve(Hs(M.component),dn({key:2,ref_for:!0},A(M.child,M.index)),null,16))],64);var L,S}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);ql.install=e=>{e.component(ql.__name,ql)};const xj={class:"table-node-wrapper"},Aj=["aria-busy"],Tj={key:0},Mj=["custom-id"],Ej=["aria-label","onPointerdown"],Ij=["custom-id"],$j={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},wu=un(je({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=F(()=>{var _;return(_=t.node.loading)!=null&&_}),s=F(()=>{var _;return(_=t.node.rows)!=null?_:[]}),o=Z(null),i=Z([]);let r=null;const l=F(()=>t.node.header.cells.length),a=F(()=>i.value.some(_=>Number.isFinite(_)&&_>0)),c=F(()=>a.value?i.value.map(_=>_>0?{width:`${_}px`}:void 0):[]);En("markstreamShowTooltips",F(()=>t.showTooltips)),En("markstreamFade",F(()=>t.fade));const u=cs(()=>t.customId),d=F(()=>!!u.value.text),p=F(()=>!!u.value.paragraph),h=new WeakMap;function f(_){const g=t.fade===!1&&!d.value,v=!p.value,y=h.get(_);if(y?.children===_.children&&y.textFastPath===g&&y.paragraphFastPath===v)return y.info;const A=Pp(_.children,v,!0),O={simpleChildren:A,plainText:A&&g?dc(A):null};return h.set(_,{children:_.children,textFastPath:g,paragraphFastPath:v,info:O}),O}function m(_){if(!r)return;_.preventDefault();const g=r.startWidth+r.nextStartWidth,v=Math.min(48,Math.floor(g/2)),y=Math.max(v,Math.min(g-v,Math.round(r.startWidth+_.clientX-r.startX))),A=[...r.widths];A[r.index]=y,A[r.index+1]=g-y,i.value=A}function b(){r&&(window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),r=null)}return Ke(l,()=>{b(),i.value=[]}),ls(b),(_,g)=>(w(),N("div",xj,[T("table",{ref_key:"tableRef",ref:o,class:Re(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(w(),N("colgroup",Tj,[(w(!0),N(Le,null,nt(e.node.header.cells,(v,y)=>(w(),N("col",{key:y,style:Gt(c.value[y])},null,4))),128))])):ie("",!0),T("thead",null,[T("tr",null,[(w(!0),N(Le,null,nt(e.node.header.cells,(v,y)=>(w(),N("th",{key:y,dir:"auto",class:Re([v.align==="right"?"text-right":v.align==="center"?"text-center":"text-left"])},[f(v).plainText!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(f(v).plainText),9,Mj)):f(v).simpleChildren?(w(),ve(x(Gu),{key:1,nodes:f(v).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${y}`},null,8,["nodes","custom-id","index-key"])):(w(),ve(x(yo),{key:2,nodes:v.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[0]||(g[0]=A=>_.$emit("copy",A))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),y<e.node.header.cells.length-1?(w(),N("button",{key:3,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${y+1} and ${y+2}`,onPointerdown:A=>(function(O,$){if($.button!==0)return;const k=(function(){var L;const S=(L=o.value)==null?void 0:L.querySelectorAll("thead th");return Array.from(S??[],I=>Math.round(I.getBoundingClientRect().width))})(),E=k[O],M=k[O+1];E&&M&&($.preventDefault(),r={index:O,startX:$.clientX,startWidth:E,nextStartWidth:M,widths:k},i.value=k,window.addEventListener("pointermove",m),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b))})(y,A)},null,40,Ej)):ie("",!0)],2))),128))])]),T("tbody",null,[(w(!0),N(Le,null,nt(s.value,(v,y)=>(w(),N("tr",{key:y},[(w(!0),N(Le,null,nt(v.cells,(A,O)=>(w(),N("td",{key:O,class:Re([A.align==="right"?"text-right":A.align==="center"?"text-center":"text-left"]),dir:"auto"},[f(A).plainText!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(f(A).plainText),9,Ij)):f(A).simpleChildren?(w(),ve(x(Gu),{key:1,nodes:f(A).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${y}-${O}`},null,8,["nodes","custom-id","index-key"])):(w(),ve(x(yo),{key:2,nodes:A.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[1]||(g[1]=$=>_.$emit("copy",$))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,Aj),oe(Gr,{name:"table-node-fade"},{default:_e(()=>[n.value?(w(),N("div",$j,[Cn(_.$slots,"loading",{isLoading:n.value},()=>[g[2]||(g[2]=T("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),g[3]||(g[3]=T("span",{class:"sr-only"},"Loading",-1))],!0)])):ie("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);wu.install=e=>{e.component(wu.__name,wu)};const Nj={class:"hr-node"},Df=un({},[["render",function(e,t){return w(),N("hr",Nj)}],["__scopeId","data-v-39b2349c"]]);Df.install=e=>{e.component(Df.__name,Df)};const Lj={class:"unknown-node"},A1=je({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(w(),N("div",Lj,R(e.node.raw),1))}),Bf=un(je({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=F(()=>`vmr-container vmr-container-${t.node.name}`),s=cs(()=>t.customId),o=F(()=>it({text:Xn,paragraph:ql,heading:Rp,inline_code:Us,link:to,image:qr,strong:Js,emphasis:no,strikethrough:eo,insert:vo,subscript:go,superscript:mo,checkbox:Io,checkbox_input:Io,hardbreak:jr,math_inline:gi,reference:Zs,list:nc,math_block:QM,table:wu},s.value));return(i,r)=>(w(),N("div",dn({class:n.value},e.node.attrs),[(w(!0),N(Le,null,nt(e.node.children,(l,a)=>{return w(),ve(Hs((c=l.type,o.value[c]||A1)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var c}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);Bf.install=e=>{e.component(Bf.__name,Bf)};const Oj=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],tS=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function Pj(e){if(e<=255)return Oj[e];let t=0,n=tS.length-1;for(;t<=n;){const s=t+n>>1,o=tS[s];if(e<o[0])n=s-1;else{if(!(e>o[1]))return o[2];t=s+1}}return"L"}const Rj=/[ \t\n\r\f]+/g,Dj=/[\t\n\r\f]| {2,}|^ | $/;let Bg=null;const Bj=new RegExp("\\p{Script=Arabic}","u"),$h=new RegExp("\\p{M}","u"),JM=new RegExp("\\p{Nd}","u");function nS(e){return Bj.test(e)}function sS(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function er(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){const s=e.charCodeAt(t+1);if(s>=56320&&s<=57343){if(sS(s-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(sS(n))return!0}}return!1}const Fj=new Set([" "," ","","\uFEFF"]);function Hj(e){return er(e)}function T1(e){return!(function(t){const n=Dp(t);return n!==null&&(cy.has(n)||Kl.has(n))})(e)&&!(function(t){const n=Dp(t);return n!==null&&Fj.has(n)})(e)}const cy=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),Nh=new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),uy=new Set(["'","’"]),Kl=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Wj=new Set([":",".","،","؛"]),zj=new Set(["၏"]),Uj=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function qj(e){if(dy(e))return!0;let t=!1;for(const n of e)if(Kl.has(n))t=!0;else if(!t||!$h.test(n))return!1;return t}function jj(e){for(const t of e)if(!cy.has(t)&&!Kl.has(t))return!1;return e.length>0}function Vj(e){if(dy(e))return!0;for(const t of e)if(!Nh.has(t)&&!uy.has(t)&&!$h.test(t))return!1;return e.length>0}function dy(e){let t=!1;for(const n of e)if(n!=="\\"&&!$h.test(n)){if(!(Nh.has(n)||Kl.has(n)||uy.has(n)))return!1;t=!0}return t}function e3(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const s=e.charCodeAt(n);if(s<56320||s>57343)return n;const o=n-1;if(o<0)return n;const i=e.charCodeAt(o);return i>=55296&&i<=56319?o:n}function Dp(e){if(e.length===0)return null;const t=e3(e,e.length);return e.slice(t)}function Kj(e){const t=Array.from(e);let n=t.length;for(;n>0;){const s=t[n-1];if($h.test(s))n--;else{if(!Nh.has(s)&&!uy.has(s))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Gj(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function oS(e,t,n,s){const o=t[s],i=e[s];if(o==null)return i;const r=n[s];if(i.length===r)return i;const l=o.repeat(r);return e[s]=l,l}function iS(e,t){return e&&t!==null&&Wj.has(t)}function Yj(e){const t=Dp(e);return t!==null&&zj.has(t)}function Xj(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function M1(e){let t=e.length;for(;t>0;){const n=e3(e,t),s=e.slice(n,t);if(Uj.has(s))return!0;if(!Kl.has(s))return!1;t=n}return!1}function Qj(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`
|
|
236
|
+
</div>`};const a=/^\[(\d+)\]/,c=/^\[([^\]\n]+)\]/,u=p=>{if(!p.startsWith("["))return!1;const h=c.exec(p);if(!h)return p!=="["&&!/^\[\d+$/.test(p);const f=String(h[1]??"");return p.slice(h[0].length).startsWith("(")?!1:!/^\d+$/.test(f)},d=(p,h)=>{const f=p;if(f.src[f.pos]!=="[")return!1;const m=a.exec(f.src.slice(f.pos));if(!m)return!1;const b=f.src.slice(Math.max(0,f.pos-120),f.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(b))return!1;const _=f.src.slice(f.pos+m[0].length);if(_.startsWith("](")||_.startsWith("(")||u(_))return!1;if(!h){const g=m[1],v=f.push("reference","span",0);v.content=g,v.markup=m[0],v.raw=m[0]}return f.pos+=m[0].length,!0};return n.inline.ruler.before("escape","reference",d),n.renderer.rules.reference=(p,h)=>{const m=String(p[h].content??"");return`<span class="reference-link" data-reference-id="${m}" role="button" tabindex="0" title="Click to view reference">${m}</span>`},n}function xU({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function OM({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:s,streamRenderVersionChanged:o=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return s?n.streamedDelta&&i===e?o?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:xU({nextContent:e,previousContent:t??i,typewriterEnabled:s}):{settledContent:e,streamedDelta:"",appended:!1}}const I2=new WeakMap;function AU(e){let t=I2.get(e);return t||(t={inFlight:new Map,completed:new Set,registeredAllLangs:!1,registeredThemes:[],registeredLangs:[],tail:Promise.resolve()},I2.set(e,t)),t}function $2(e,t){if(!t?.length)return[...e];const n=[...e],s=new Set(n);for(const o of t)s.has(o)||(s.add(o),n.push(o));return n}function ey(e){return!!(e.themes?.length||e.langs?.length)}function PM(e,t){if(!t?.length)return!0;const n=new Set(e);return t.every(s=>n.has(s))}function TU(e,t){return!t?.length||e.registeredAllLangs?!0:PM(e.registeredLangs,t)}function Ig(e,t){return ey(t)&&PM(e.registeredThemes,t.themes)&&TU(e,t.langs)}function MU(e,t){if(!ey(t))return t;const n=$2(e.registeredThemes,t.themes),s=e.registeredAllLangs?[]:$2(e.registeredLangs,t.langs);return{...n.length?{themes:n}:{},...s.length?{langs:s}:{}}}const EU={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function IU(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function RM(e){const t=IU(e);return EU[t]??t}function DM(e){if(!Array.isArray(e))return;const t=e.filter(s=>typeof s=="string").map(s=>RM(s)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function BM(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const s of e){if(typeof s!="string")continue;const o=s.trim();!o||n.has(o)||(n.add(o),t.push(o))}return t.length>0?t:void 0}function $U(e){return BM(e)?.join("\0")??""}function FM(e,t){const n=BM(e),s=DM(t);return{...n?.length?{themes:n}:{},...s?.length?{langs:s}:{}}}function Np(e,t){return`${$U(e)}\0\0${DM(t)?.join("\0")??""}`}function ihe(e,t,n={hasRegisterHighlight:!0,hasCreateRenderer:!0}){const s=FM(e,t),o={...s},i=!!(o.langs?.length&&n.hasCreateRenderer&&!n.hasRegisterHighlight);return i&&(delete s.langs,delete o.langs),{key:Np(o.themes,o.langs),registerOptions:s,rendererOptions:o,ignoredLangs:i}}async function rhe(e,t={},n){if(!e)return"ready";const s=FM(t.themes,t.langs),o=Np(s.themes,s.langs),i=n&&n===o?n:o,r=AU(e);if(r.completed.has(i))return"ready";if(Ig(r,s))return r.completed.add(i),"ready";const l=r.inFlight.get(i);if(l)return l;const a=r.tail.catch(()=>{}).then(()=>{if(r.completed.has(i)||Ig(r,s))return r.completed.add(i),"ready";const c=MU(r,s),u=Np(c.themes,c.langs);return r.completed.has(u)||Ig(r,c)?(r.completed.add(i),r.completed.add(u),"ready"):Promise.resolve(e(c)).then(()=>(ey(c)?(r.registeredThemes=c.themes?[...c.themes]:r.registeredThemes,r.registeredLangs=c.langs?[...c.langs]:r.registeredLangs):r.registeredAllLangs=!0,r.completed.add(u),"ready"))}).then(()=>(r.completed.add(i),"ready")).finally(()=>{r.inFlight.get(i)===a&&r.inFlight.delete(i)});return r.inFlight.set(i,a),r.tail=a.catch(()=>{}),a}function _a(e,t,n=1){const s=Number(e);return Number.isFinite(s)?Math.max(n,s):t}function N2(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var NU=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const p=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const f=L2();this.startedAt=p&&this.hasStarted?f-this.normalizedStartDelayMs:f,this.lastTick=f,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=L2();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAt<this.normalizedStartDelayMs){this.rafId=requestAnimationFrame(this.tick);return}const p=1e3/Math.max(1,this.maxCommitFps),h=Math.min(100,Math.max(0,d-this.lastTick));if(h<p){this.rafId=requestAnimationFrame(this.tick);return}this.lastTick=d;const f=this.pendingChars,m=f>this.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,b=RU(f/Math.max(.001,m/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(b-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const _=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),g=PU(this.source.slice(this.visible.length),_,this.segmenter);g.text&&(this.visible+=g.text,this.charBudget=Math.max(0,this.charBudget-g.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:s=1e3,targetLatencyMs:o=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:c=80,flushOnFinish:u=!1}=e;this.minCharsPerSecond=_a(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,_a(s,1e3,1)),this.normalizedTargetLatencyMs=_a(o,900,1),this.normalizedCatchUpLatencyMs=_a(i,350,1),this.normalizedCatchUpThreshold=N2(r,600),this.normalizedStartDelayMs=N2(a,80),this.maxCommitFps=Math.trunc(_a(l,30,1)),this.maxCharsPerCommit=Math.trunc(_a(c,80,1)),this.flushOnFinish=u,this.segmenter=OU(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function LU(e={},t){const n=new NU(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function OU(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function PU(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let s="",o=0;for(const i of n.segment(e)){if(o>=t)break;s+=i.segment,o++}return{text:s,graphemeCount:o}}function L2(){return typeof performance<"u"?performance.now():Date.now()}function RU(e,t,n){return Math.min(n,Math.max(t,e))}var DU=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const u1=Symbol.for("markstream-vue:node-lifecycle"),O2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M30 14v-2h-2V8h-2v4h-2V8h-2v4h-2v2h2v2h-2v2h2v4h2v-4h2v4h2v-4h2v-2h-2v-2Zm-4 2h-2v-2h2Zm-12.437 6A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',P2='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',BU={id:"material",core:{"":P2,plain:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path d="M0 0h24v24H0z"/><path fill="#42a5f5" d="M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z"/></svg>',text:P2,javascript:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ffca28" d="M2 2v12h12V2zm6 6h1v4a1.003 1.003 0 0 1-1 1H7a1.003 1.003 0 0 1-1-1v-1h1v1h1zm3 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',typescript:'<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 16 16"><path fill="#0288d1" d="M2 2v12h12V2zm4 6h3v1H8v4H7V9H6zm5 0h2v1h-2v1h1a1.003 1.003 0 0 1 1 1v1a1.003 1.003 0 0 1-1 1h-2v-1h2v-1h-1a1.003 1.003 0 0 1-1-1V9a1.003 1.003 0 0 1 1-1"/></svg>',jsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00bcd4" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#00bcd4" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#00bcd4" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#00bcd4" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',tsx:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M16 12c7.444 0 12 2.59 12 4s-4.556 4-12 4-12-2.59-12-4 4.556-4 12-4m0-2c-7.732 0-14 2.686-14 6s6.268 6 14 6 14-2.686 14-6-6.268-6-14-6"/><path fill="#0288d1" d="M16 14a2 2 0 1 0 2 2 2 2 0 0 0-2-2"/><path fill="#0288d1" d="M10.458 5.507c2.017 0 5.937 3.177 9.006 8.493 3.722 6.447 3.757 11.687 2.536 12.392a.9.9 0 0 1-.457.1c-2.017 0-5.938-3.176-9.007-8.492C8.814 11.553 8.779 6.313 10 5.608a.9.9 0 0 1 .458-.1m-.001-2A2.87 2.87 0 0 0 9 3.875C6.13 5.532 6.938 12.304 10.804 19c3.284 5.69 7.72 9.493 10.74 9.493A2.87 2.87 0 0 0 23 28.124c2.87-1.656 2.062-8.428-1.804-15.124-3.284-5.69-7.72-9.493-10.74-9.493Z"/><path fill="#0288d1" d="M21.543 5.507a.9.9 0 0 1 .457.1c1.221.706 1.186 5.946-2.536 12.393-3.07 5.316-6.99 8.493-9.007 8.493a.9.9 0 0 1-.457-.1C8.779 25.686 8.814 20.446 12.536 14c3.07-5.316 6.99-8.493 9.007-8.493m0-2c-3.02 0-7.455 3.804-10.74 9.493C6.939 19.696 6.13 26.468 9 28.124a2.87 2.87 0 0 0 1.457.369c3.02 0 7.455-3.804 10.74-9.493C25.061 12.304 25.87 5.532 23 3.876a2.87 2.87 0 0 0-1.457-.369"/></svg>',html:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#e65100" d="m4 4 2 22 10 2 10-2 2-22Zm19.72 7H11.28l.29 3h11.86l-.802 9.335L15.99 25l-6.635-1.646L8.93 19h3.02l.19 2 3.86.77 3.84-.77.29-4H8.84L8 8h16Z"/></svg>',css:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#7e57c2" d="M20 18h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 20 22h2v2h2v-2c0-.388-.562-.851-1.254-1.034C20.356 20.34 20 18.84 20 18m-3.254 2.966C14.356 20.34 14 18.84 14 18h-2v-2h-2v8h2v-2h4v2h2v-2c0-.388-.562-.851-1.254-1.034"/><path fill="#7e57c2" d="M24 4H4v20a4 4 0 0 0 4 4h16.16A3.84 3.84 0 0 0 28 24.16V8a4 4 0 0 0-4-4m2 14h-2v-2h-2v2c0 .193 0 .703 1.254 1.033A3.345 3.345 0 0 1 26 22v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2 2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2 2 2 0 0 1 2-2h2a2 2 0 0 1 2 2Z"/></svg>',scss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ec407a" d="M27.837 5.673a4.33 4.33 0 0 0-2.293-2.701c-2.362-1.261-6.11-1.298-9.548-.092a26.3 26.3 0 0 0-8.76 4.966c-2.752 2.542-3.438 4.925-3.189 6.194.523 2.668 3.274 4.539 5.485 6.042.418.284.822.559 1.175.816-1.429.76-4.261 2.444-5.088 4.248a3.88 3.88 0 0 0-.118 3.332A2.37 2.37 0 0 0 6.869 29.8a5.6 5.6 0 0 0 1.49.2 6.35 6.35 0 0 0 5.19-2.856 6.74 6.74 0 0 0 .864-5.382 7.3 7.3 0 0 1 2.044-.03 3.92 3.92 0 0 1 2.816 1.311 1.82 1.82 0 0 1 .423 1.262 1.55 1.55 0 0 1-.772 1.05c-.234.14-.586.355-.504.803.036.194.198.633.894.512a2.93 2.93 0 0 0 2.145-2.651 4 4 0 0 0-1.197-2.904 5.94 5.94 0 0 0-4.396-1.626 10.6 10.6 0 0 0-2.672.304 20 20 0 0 0-2.203-1.846c-1.712-1.3-3.33-2.529-3.235-4.26.125-2.263 2.468-4.532 6.964-6.744 4.016-1.976 7.254-2.037 8.944-1.438a2 2 0 0 1 1.204.883 2.77 2.77 0 0 1-.36 2.47 9.71 9.71 0 0 1-7.425 4.304 3.86 3.86 0 0 1-3.238-.757c-.278-.302-.593-.645-1.074-.383q-.565.31-.225 1.189a3.9 3.9 0 0 0 2.407 1.92 11.7 11.7 0 0 0 7.128-.671c3.527-1.35 6.681-5.202 5.756-8.787M11.895 24.475a4 4 0 0 1-.192.468 4.5 4.5 0 0 1-.753 1.081 2.83 2.83 0 0 1-2.533 1.107c-.056-.032-.078-.146-.085-.193a3.28 3.28 0 0 1 1.076-2.284 11.3 11.3 0 0 1 2.644-1.933 3.85 3.85 0 0 1-.157 1.754"/></svg>',json:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path fill="#f9a825" d="M560-160v-80h120q17 0 28.5-11.5T720-280v-80q0-38 22-69t58-44v-14q-36-13-58-44t-22-69v-80q0-17-11.5-28.5T680-720H560v-80h120q50 0 85 35t35 85v80q0 17 11.5 28.5T840-560h40v160h-40q-17 0-28.5 11.5T800-360v80q0 50-35 85t-85 35zm-280 0q-50 0-85-35t-35-85v-80q0-17-11.5-28.5T120-400H80v-160h40q17 0 28.5-11.5T160-600v-80q0-50 35-85t85-35h120v80H280q-17 0-28.5 11.5T240-680v80q0 38-22 69t-58 44v14q36 13 58 44t22 69v80q0 17 11.5 28.5T280-240h120v80z"/></svg>',python:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#0288d1" d="M9.86 2A2.86 2.86 0 0 0 7 4.86v1.68h4.29c.39 0 .71.57.71.96H4.86A2.86 2.86 0 0 0 2 10.36v3.781a2.86 2.86 0 0 0 2.86 2.86h1.18v-2.68a2.85 2.85 0 0 1 2.85-2.86h5.25c1.58 0 2.86-1.271 2.86-2.851V4.86A2.86 2.86 0 0 0 14.14 2zm-.72 1.61c.4 0 .72.12.72.71s-.32.891-.72.891c-.39 0-.71-.3-.71-.89s.32-.711.71-.711"/><path fill="#fdd835" d="M17.959 7v2.68a2.85 2.85 0 0 1-2.85 2.859H9.86A2.85 2.85 0 0 0 7 15.389v3.75a2.86 2.86 0 0 0 2.86 2.86h4.28A2.86 2.86 0 0 0 17 19.14v-1.68h-4.291c-.39 0-.709-.57-.709-.96h7.14A2.86 2.86 0 0 0 22 13.64V9.86A2.86 2.86 0 0 0 19.14 7zM8.32 11.513l-.004.004.038-.004zm6.54 7.276c.39 0 .71.3.71.89a.71.71 0 0 1-.71.71c-.4 0-.72-.12-.72-.71s.32-.89.72-.89"/></svg>',ruby:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#f44336" d="M18.041 3.177c2.24.382 2.879 1.919 2.843 3.527V6.67l-1.013 13.266-13.132.897h.008c-1.093-.044-3.518-.151-3.634-3.545l1.217-2.222 2.462 5.74 2.097-6.77-.045.009.018-.018 6.85 2.186L13.945 9.3l6.53-.409-5.144-4.212 2.71-1.51v.009M3.113 17.252v.017zM6.916 6.874c2.63-2.622 6.033-4.168 7.34-2.844 1.297 1.306-.072 4.523-2.702 7.135-2.666 2.613-6.015 4.248-7.322 2.933-1.306-1.324.036-4.612 2.675-7.224z"/></svg>',go:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#00acc1" d="M2 12h4v2H2zm-2 4h6v2H0zm4 4h2v2H4zm16.954-5H14v3h3.239a4.42 4.42 0 0 1-3.531 2 2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 15.292 13a2.73 2.73 0 0 1 1.749.584l2.962-1.185A5.6 5.6 0 0 0 15.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 6.4 6.4 0 0 0 .003-1.5"/><path fill="#00acc1" d="M26.292 10a7.526 7.526 0 0 0-7.243 6.5 5.614 5.614 0 0 0 5.659 6.5 7.526 7.526 0 0 0 7.243-6.5 5.614 5.614 0 0 0-5.659-6.5m2.681 6.137A4.515 4.515 0 0 1 24.708 20a2.65 2.65 0 0 1-2.053-.858 2.86 2.86 0 0 1-.628-2.28A4.515 4.515 0 0 1 26.292 13a2.65 2.65 0 0 1 2.053.858 2.86 2.86 0 0 1 .628 2.28Z"/></svg>',java:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#f44336" d="M4 26h24v2H4zM28 4H7a1 1 0 0 0-1 1v13a4 4 0 0 0 4 4h10a4 4 0 0 0 4-4v-4h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 8h-4V6h4Z"/></svg>',kotlin:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"><defs><linearGradient id="a" x1="1.725" x2="22.185" y1="22.67" y2="1.982" gradientTransform="translate(1.306 1.129)scale(.89324)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7c4dff"/><stop offset=".5" stop-color="#d500f9"/><stop offset="1" stop-color="#ef5350"/></linearGradient></defs><path fill="url(#a)" d="M2.975 2.976v18.048h18.05v-.03l-4.478-4.511-4.48-4.515 4.48-4.515 4.443-4.477z"/></svg>',c:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M19.563 22A5.57 5.57 0 0 1 14 16.437v-2.873A5.57 5.57 0 0 1 19.563 8H24V2h-4.437A11.563 11.563 0 0 0 8 13.563v2.873A11.564 11.564 0 0 0 19.563 28H24v-6Z"/></svg>',cpp:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#0288d1" d="M28 14v-4h-2v4h-6v-4h-2v4h-4v2h4v4h2v-4h6v4h2v-4h4v-2z"/><path fill="#0288d1" d="M13.563 22A5.57 5.57 0 0 1 8 16.437v-2.873A5.57 5.57 0 0 1 13.563 8H18V2h-4.437A11.563 11.563 0 0 0 2 13.563v2.873A11.564 11.564 0 0 0 13.563 28H18v-6Z"/></svg>',cs:O2,csharp:O2,php:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#1e88e5" d="M12 18.08c-6.63 0-12-2.72-12-6.08s5.37-6.08 12-6.08S24 8.64 24 12s-5.37 6.08-12 6.08m-5.19-7.95c.54 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.58 1.09q-.42.33-1.29.33h-.87l.53-2.76zm-3.5 5.55h1.44l.34-1.75h1.23c.54 0 .98-.06 1.33-.17.35-.12.67-.31.96-.58.24-.22.43-.46.58-.73.15-.26.26-.56.31-.88.16-.78.05-1.39-.33-1.82-.39-.44-.99-.65-1.82-.65H4.59zm7.25-8.33-1.28 6.58h1.42l.74-3.77h1.14c.36 0 .6.06.71.18s.13.34.07.66l-.57 2.93h1.45l.59-3.07c.13-.62.03-1.07-.27-1.36-.3-.27-.85-.4-1.65-.4h-1.27L12 7.35zM18 10.13c.55 0 .91.1 1.09.31.18.2.22.56.13 1.03-.1.53-.29.87-.57 1.09-.29.22-.72.33-1.3.33h-.85l.5-2.76zm-3.5 5.55h1.44l.34-1.75h1.22c.55 0 1-.06 1.35-.17.35-.12.65-.31.95-.58.24-.22.44-.46.58-.73.15-.26.26-.56.32-.88.15-.78.04-1.39-.34-1.82-.36-.44-.99-.65-1.82-.65h-2.75z"/></svg>',shell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',powershell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#03a9f4" d="M29.07 6H7.677A1.535 1.535 0 0 0 6.24 7.113l-4.2 17.774A.852.852 0 0 0 2.93 26h21.393a1.535 1.535 0 0 0 1.436-1.113L29.96 7.112A.852.852 0 0 0 29.07 6M8.626 23.797a1.4 1.4 0 0 1-1.814-.31l-.007-.009a1.075 1.075 0 0 1 .315-1.599l9.6-6.061-6.102-5.852-.01-.01a1.068 1.068 0 0 1 .084-1.625l.037-.03a1.38 1.38 0 0 1 1.8.07l7.233 6.957a1.1 1.1 0 0 1 .236.739 1.08 1.08 0 0 1-.412.79c-.074.04-.146.119-10.951 6.935ZM24 22.94A1.135 1.135 0 0 1 22.803 24h-5.634a1.061 1.061 0 1 1 .001-2.112h5.633A1.134 1.134 0 0 1 24 22.938Z"/></svg>',sql:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ffca28" d="M16 24c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-8c-5.525 0-10-.9-10-2v4c0 1.1 4.475 2 10 2s10-.9 10-2v-4c0 1.1-4.475 2-10 2m0-12C10.477 4 6 4.895 6 6v4c0 1.1 4.475 2 10 2s10-.9 10-2V6c0-1.105-4.477-2-10-2"/></svg>',yaml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#ff5252" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m12 16v-2H9v2zm-4-4v-2H6v2z"/></svg>',markdown:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>',xml:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#8bc34a" d="M13 9h5.5L13 3.5zM6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m.12 13.5 3.74 3.74 1.42-1.41-2.33-2.33 2.33-2.33-1.42-1.41zm11.16 0-3.74-3.74-1.42 1.41 2.33 2.33-2.33 2.33 1.42 1.41z"/></svg>',rust:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#ff7043" d="m30 12-4-2V6h-4l-2-4-4 2-4-2-2 4H6v4l-4 2 2 4-2 4 4 2v4h4l2 4 4-2 4 2 2-4h4v-4l4-2-2-4ZM6 16a9.9 9.9 0 0 1 .842-4H10v8H6.842A9.9 9.9 0 0 1 6 16m10 10a9.98 9.98 0 0 1-7.978-4H16v-2h-2v-2h4c.819.819.297 2.308 1.179 3.37a1.89 1.89 0 0 0 1.46.63h3.34A9.98 9.98 0 0 1 16 26m-2-12v-2h4a1 1 0 0 1 0 2Zm11.158 6H24a2.006 2.006 0 0 1-2-2 2 2 0 0 0-2-2 3 3 0 0 0 3-3q0-.08-.004-.161A3.115 3.115 0 0 0 19.83 10H8.022a9.986 9.986 0 0 1 17.136 10"/></svg>',vue:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#41b883" d="M1.791 3.851 12 21.471 22.209 3.936V3.85H18.24l-6.18 10.616L5.906 3.851z"/><path fill="#35495e" d="m5.907 3.851 6.152 10.617L18.24 3.851h-3.723L12.084 8.03 9.66 3.85z"/></svg>',mermaid:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path fill="#42a5f5" d="m14 10-4 3.5L6 10H4v12h4v-6l2 2 2-2v6h4V10zm12 6v-6h-4v6h-4l6 8 6-8z"/></svg>'},fallback:'<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#ff7043" d="M2 2a1 1 0 0 0-1 1v10c0 .554.446 1 1 1h12c.554 0 1-.446 1-1V3a1 1 0 0 0-1-1zm0 3h12v8H2zm1 2 2 2-2 2 1 1 3-3-3-3zm5 3.5V12h5v-1.5z"/></svg>',loadExtended:()=>Xs(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},d1=new Map;let R2="material";const Fa=new Map,D2=new Map;let f1=null;function FU(e){d1.set(e.id,e)}function HU(e){return DU(this,null,function*(){var t,n,s;if(Fa.has(e.id))return(t=Fa.get(e.id))!=null?t:null;let o=D2.get(e.id);return o||(o=((s=(n=e.loadExtended)==null?void 0:n.call(e))!=null?s:Promise.resolve(null)).then(i=>(Fa.set(e.id,i),f1?.(),i)).catch(()=>(Fa.set(e.id,null),null)),D2.set(e.id,o)),o})}const WU=Ql(0);f1=()=>{WU.value++},FU(BU);const zU={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function ty(e){var t;const n=(function(s){if(!s)return"";const o=s.trim();if(!o)return"";const[i]=o.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=zU[n])!=null?t:n}function lhe(e){const t=ty(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}function ahe(e){return(function(s){const o=d1.get(R2);if(!o)return;const i=o.core[s];if(i)return i;const r=Fa.get(o.id);if(r){const l=r[s];if(l)return l}o.loadExtended&&!Fa.has(o.id)&&HU(o)})(ty(e))||((n=(t=d1.get(R2))==null?void 0:t.fallback)!=null?n:"");var t,n}const che={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};let HM=!1;function uhe(){return HM}function dhe(){HM=!0}var Mh=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let Ao=null,$f=!1,Eh=sy;function Ih(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function ny(){try{const e=globalThis;return Ih(e?.katex)}catch{return null}}function sy(){return Mh(null,null,function*(){const e=ny();if(e)return e;const t=yield Xs(()=>import("./katex-DnlPpQZa.js"),[]);try{yield Xs(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([2,3]))}catch{}return Ih(t)})}function UU(e){Eh=e,Ao=null,$f=!1}function qU(e){UU(sy)}function WM(){return typeof Eh=="function"}function fhe(){var e;const t=Eh;if(!t||t===sy)return null;if(Ao)return Ao;const n=ny();if(n)return Ao=n,Ao;try{const s=t();return s&&typeof s?.then!="function"?(Ao=(e=Ih(s))!=null?e:s,Ao):null}catch{return null}}function oy(){return Mh(this,null,function*(){var e;const t=ny();if(t)return Ao=t,Ao;if(Ao)return Ao;if($f)return null;const n=Eh;if(!n)return $f=!0,null;try{const s=yield n();if(s)return Ao=(e=Ih(s))!=null?e:s,Ao}catch{}return $f=!0,null})}function zM(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Fr=null,$r=null;const Yo=new Map,Zi=new Map;let Lp=5;const Rl=new Set;function Ku(){if(Yo.size<Lp&&Rl.size){const e=Array.from(Rl);Rl.clear();for(const t of e)try{t()}catch{}}}function jU(e){Fr=e,$r=null,Fr.onmessage=t=>{const{id:n,html:s,error:o}=t.data,i=Yo.get(n);if(i)if(Yo.delete(n),clearTimeout(i.timeoutId),Ku(),o)i.reject(new Error(o));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(Zi.set(a,s),Zi.size>200){const c=Zi.keys().next().value;Zi.delete(c)}}i.resolve(s)}},Fr.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,s]of Yo.entries())clearTimeout(s.timeoutId),s.reject(new Error(`Worker error: ${t.message}`));Yo.clear(),Ku()}}function VU(){var e;Fr&&((e=Fr.terminate)==null||e.call(Fr)),Fr=null,$r=null}function KU(e,t=!0,n=2e3,s){return Mh(this,null,function*(){performance.now();const o=zM(e);if(!WM()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if($r)return Promise.reject($r);const i=`${t?"d":"i"}:${o}`,r=Zi.get(i);if(r)return Promise.resolve(r);const l=Fr||($r=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),$r.name="WorkerInitError",$r.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject($r);if(Yo.size>=Lp){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Yo.size,a.max=Lp,Promise.reject(a)}return new Promise((a,c)=>{if(s?.aborted){const f=new Error("Aborted");return f.name="AbortError",void c(f)}const u=Math.random().toString(36).slice(2),d=globalThis.setTimeout(()=>{Yo.delete(u);const f=new Error("Worker render timed out");f.name="WorkerTimeout",f.code="WORKER_TIMEOUT",c(f),Ku()},n);s&&s.addEventListener("abort",()=>{globalThis.clearTimeout(d),Yo.has(u)&&Yo.delete(u);const f=new Error("Aborted");f.name="AbortError",c(f),Ku()},{once:!0});const p=a,h=c;Yo.set(u,{resolve:f=>{p(f)},reject:f=>{h(f)},timeoutId:d}),l.postMessage({id:u,content:o,displayMode:t})})})}function phe(e,t=!0,n){const s=`${t?"d":"i"}:${zM(e)}`;if(Zi.set(s,n),Zi.size>200){const o=Zi.keys().next().value;Zi.delete(o)}}const GU="WORKER_BUSY";function YU(e=2e3,t){return Yo.size<Lp?Promise.resolve():new Promise((n,s)=>{let o,i=!1;const r=()=>{i||(i=!0,o&&globalThis.clearTimeout(o),Rl.delete(r),n())};if(Rl.add(r),o=globalThis.setTimeout(()=>{if(i)return;i=!0,Rl.delete(r);const l=new Error("Wait for worker slot timed out");l.name="WorkerBusyTimeout",l.code="WORKER_BUSY_TIMEOUT",s(l)},e),queueMicrotask(()=>Ku()),t){const l=()=>{if(i)return;i=!0,o&&globalThis.clearTimeout(o),Rl.delete(r);const a=new Error("Aborted");a.name="AbortError",s(a)};t.aborted?l():t.addEventListener("abort",l,{once:!0})}})}const Kc={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function hhe(e){return Mh(this,arguments,function*(t,n=!0,s={}){var o,i,r,l;if(!WM()){const m=new Error("KaTeX rendering disabled");throw m.name="KaTeXDisabled",m.code="KATEX_DISABLED",m}const a=(o=s.timeout)!=null?o:Kc.timeout,c=(i=s.waitTimeout)!=null?i:Kc.waitTimeout,u=(r=s.backoffMs)!=null?r:Kc.backoffMs,d=(l=s.maxRetries)!=null?l:Kc.maxRetries,p=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):Kc.maxRetries,h=s.signal;let f=0;for(;;){if(h?.aborted){const m=new Error("Aborted");throw m.name="AbortError",m}try{return yield KU(t,n,a,h)}catch(m){if(m?.code!==GU||f>=p)throw m;if(f++,yield YU(c,h).catch(()=>{}),h?.aborted){const b=new Error("Aborted");throw b.name="AbortError",b}u>0&&(yield new Promise(b=>globalThis.setTimeout(b,u*f)))}}})}function Ha(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function XU(e){var t;for(const n of e.split(/\r?\n/)){const s=n.trim();if(!s||s.startsWith("%%"))continue;const o=s.match(/^([A-Z][\w-]*)\b/i);return((t=o?.[1])==null?void 0:t.toLowerCase())||""}return""}function p1(e){const t=e.split(/\r?\n/).map(o=>o.trim()).filter(o=>o&&!o.startsWith("%%")),n=Math.max(1,t.length),s=XU(e);return s==="gantt"?220+28*n:s==="sequencediagram"?180+26*n:s==="classdiagram"||s==="statediagram"||s==="erdiagram"?180+24*n:s==="flowchart"||s==="graph"?170+28*n:200+22*n}function h1(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function UM(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function m1(e,t=360,n=500){return UM(e,t,n)}function g1(e,t=360,n=500){return UM(e,t,n)}var QU=Object.defineProperty,ZU=Object.defineProperties,JU=Object.getOwnPropertyDescriptors,B2=Object.getOwnPropertySymbols,eq=Object.prototype.hasOwnProperty,tq=Object.prototype.propertyIsEnumerable,F2=(e,t,n)=>t in e?QU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qM=(e,t)=>{for(var n in t||(t={}))eq.call(t,n)&&F2(e,n,t[n]);if(B2)for(var n of B2(t))tq.call(t,n)&&F2(e,n,t[n]);return e},iy=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const ry=()=>Xs(()=>import("./mermaid.core-B1M2O7nN.js").then(e=>e.bq),[]);let zi=null,ly=ry;function nq(e){ly=e,zi=null}function sq(e){nq(ry)}function oq(){return typeof ly=="function"}function H2(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const o=t.mermaidAPI;return n=qM({},t),s={render:o.render.bind(o),parse:o.parse?o.parse.bind(o):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):o.initialize?o.initialize(i):void 0},ZU(n,JU(s))}var n,s;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function W2(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const s=qM({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,s):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(s):void 0}}catch{}}function mhe(){return iy(this,null,function*(){if(zi)return zi;const e=(function(){try{const s=globalThis;return H2(s?.mermaid)}catch{return null}})();if(e)return zi=e,W2(zi),zi;const t=ly;if(!t)return null;let n;try{n=yield t()}catch(s){throw t===ry?new Error('Optional dependency "mermaid" is not installed. Please install it to enable mermaid diagrams.'):s}return n?(zi=H2(n),W2(zi),zi):null})}let Gs=null,Nr=null;const Ts=new Map;let z2=5,U2=!1;const iq="WORKER_BUSY",rq="MERMAID_DISABLED";function lq(e){Gs=e,Nr=null;const t=e;Gs.onmessage=n=>{if(Gs!==t)return;const{id:s,ok:o,result:i,error:r}=n.data,l=Ts.get(s);l&&(o===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},Gs.onerror=n=>{var s,o;if(Gs===t)if(Ts.size!==0){try{U2?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}for(const[i,r]of Ts.entries())r.reject(new Error(`Worker error: ${n.message}`));Ts.clear()}else(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},Gs.onmessageerror=n=>{var s,o;if(Gs===t)if(Ts.size!==0){try{U2?console.error("[mermaidWorkerClient] Worker messageerror:",n):(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}for(const[i,r]of Ts.entries())r.reject(new Error("Worker messageerror"));Ts.clear()}else(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function aq(){var e;if(Gs)try{for(const[t,n]of Ts.entries())n.reject(new Error("Worker cleared"));Ts.clear(),(e=Gs.terminate)==null||e.call(Gs)}catch{}Gs=null,Nr=null}function jM(e,t,n=1400){if(!oq()){const o=new Error("Mermaid rendering disabled");return o.name="MermaidDisabled",o.code=rq,Promise.reject(o)}if(Nr)return Promise.reject(Nr);const s=Gs||(Nr=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Nr.name="WorkerInitError",Nr.code="WORKER_INIT_ERROR",null);if(!s)return Promise.reject(Nr);if(Ts.size>=z2){const o=new Error("Worker busy");return o.name="WorkerBusy",o.code=iq,o.inFlight=Ts.size,o.max=z2,Promise.reject(o)}return new Promise((o,i)=>{const r=Math.random().toString(36).slice(2);let l,a=!1;const c=()=>{a||(a=!0,l!=null&&globalThis.clearTimeout(l),Ts.delete(r))},u={resolve:d=>{c(),o(d)},reject:d=>{c(),i(d)}};Ts.set(r,u);try{s.postMessage({id:r,action:e,payload:t})}catch(d){return Ts.delete(r),void i(d)}l=globalThis.setTimeout(()=>{const d=new Error("Worker call timed out");d.name="WorkerTimeout",d.code="WORKER_TIMEOUT";const p=Ts.get(r);p&&p.reject(d)},n)})}function ghe(e,t,n=1400){return iy(this,null,function*(){try{return yield jM("canParse",{code:e,theme:t},n)}catch(s){return Promise.reject(s)}})}function vhe(e,t,n=1400){return iy(this,null,function*(){try{return yield jM("findPrefix",{code:e,theme:t},n)}catch(s){return Promise.reject(s)}})}function yhe(){if(Gs)try{for(const[e,t]of Ts.entries())t.reject(new Error("Worker terminated"));Ts.clear(),Gs.terminate()}finally{Gs=null}}var cq=Object.defineProperty,uq=Object.defineProperties,dq=Object.getOwnPropertyDescriptors,q2=Object.getOwnPropertySymbols,fq=Object.prototype.hasOwnProperty,pq=Object.prototype.propertyIsEnumerable,j2=(e,t,n)=>t in e?cq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t)=>{for(var n in t||(t={}))fq.call(t,n)&&j2(e,n,t[n]);if(q2)for(var n of q2(t))pq.call(t,n)&&j2(e,n,t[n]);return e},Lt=(e,t)=>uq(e,dq(t)),zn=(e,t,n)=>new Promise((s,o)=>{var i=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const hq="__global__",$g="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",v1=(()=>{const e=globalThis;if(e[$g])return e[$g];const t={scopedCustomComponents:{},revision:Ql(0)};return e[$g]=t,t})(),V2=v1.revision,mq=Symbol("markstreamCustomComponents"),gq=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function dd(e){return gq.has(String(e).trim().toLowerCase())}function vq(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function Ng(e={}){const t={};for(const[n,s]of Object.entries(e))if(s!=null){t[n]=s;for(const o of new Set([si(n),si(vq(n))]))!o||dd(o)||Object.prototype.hasOwnProperty.call(t,o)||(t[o]=s)}return t}function cs(e){const t=Ut(mq,null);return F(()=>{var n;return V2.value,(function(s,o={}){return V2.value,it(it(it({},Ng(v1.scopedCustomComponents[hq]||{})),Ng(o)),Ng((function(i){return i&&v1.scopedCustomComponents[i]||{}})(s)))})(e?.(),(n=t?.value)!=null?n:{})})}const yq=["aria-label"],kq={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},bq={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},un=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},Io=un(je({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(w(),N("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(w(),N("svg",bq,[...n[1]||(n[1]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),T("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(w(),N("svg",kq,[...n[0]||(n[0]=[T("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,yq))}),[["__scopeId","data-v-be21ab83"]]);Io.install=e=>{e.component(Io.__name,Io)};const _q={class:"emoji-node"},ho=un(je({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(w(),N("span",_q,R(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);ho.install=e=>{e.component(ho.__name,ho)};const wq=["id"],Sq=["title"],$o=un(je({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const s=document.querySelector(t);s?s.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(s,o)=>(w(),N("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[T("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+R(e.node.id)+"]",9,Sq)],8,wq))}}),[["__scopeId","data-v-c1463a29"]]);$o.install=e=>{e.component($o.__name,$o)};const VM=(()=>{try{return!1}catch{}return!1})();function Lg(e){VM&&console.warn(e)}function K2(e,t="safe",n){return J0(e,t,n)}function KM(e){return nU(e)}function Og(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function ay(e,t="safe"){const n=String(e.tag||e.type||"").trim(),s=c1((o=e.attrs)?Array.isArray(o)?o.every(Array.isArray)?o.map(([r,l])=>[String(r),Og(l)]):o.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),Og(r.value)]):Object.entries(o).map(([r,l])=>[r,Og(l)]):null,t,n);var o;if(!s)return;const i=KM($p(s));return Object.keys(i).length>0?i:void 0}function G2(e,t,n=!1){const s=Object.entries(t??{}),o=s.length>0?s.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${o} />`:`<${e}${o}>`}function Gc(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Pg(e,t,n,s,o,i,r=!1){const l=(function(d,p){return IM(d,p)})(e,s);if(ad.has(e.toLowerCase())||!l&&TM(e,i))return null;if(!l&&Z0(e,i))return r?[G2(e,t,!0)]:[G2(e,t),...n,`</${e}>`];const a=J0(t,i,e),c=a.key,u=c!=null&&c!==""?c:o;if(l){const d=s[e]||s[e.toLowerCase()],p=KM(a);return cn(d,Lt(it({},p),{key:u}),n.length>0?n:void 0)}return cn(e,Lt(it({},a),{innerHTML:void 0,key:u}),n.length>0?n:void 0)}function GM(e,t){return rU(e,t)}function Op(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const c=[],u=[];for(const d of i)if(d.type==="text")(c.length>0?c[c.length-1].children:u).push(d.content);else if(d.type==="self_closing"){const p=Pg(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);Gc(c.length>0?c[c.length-1].children:u,p)}else if(d.type==="tag_open")c.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const p=d.tagName.toLowerCase();let h=-1;for(let f=c.length-1;f>=0;f--)if(c[f].tagName.toLowerCase()===p){h=f;break}if(h!==-1)for(;c.length>h;){const f=c.pop(),m=Pg(f.tagName,f.attrs||{},f.children,r,f.autoKey,l);c.length>0?Gc(c[c.length-1].children,m):Gc(u,m),f.tagName.toLowerCase()!==p&&c.length>h&&Lg(`Auto-closing unclosed tag: <${f.tagName}>`)}else Lg(`Ignoring closing tag with no matching opening tag: </${d.tagName}>`)}for(;c.length>0;){const d=c.pop(),p=Pg(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);c.length>0?Gc(c[c.length-1].children,p):Gc(u,p),Lg(`Auto-closing unclosed tag: <${d.tagName}>`)}return u})(sU(e),t,n)}catch(o){return s=o,VM&&console.error("Failed to parse HTML to VNodes:",s),null}var s}const Cq=["innerHTML"],No=un(je({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Ut("markstreamHtmlPolicy",void 0),s=F(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),o=cs(()=>t.customId),i=je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=F(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:ec(l,s.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const c=Op(l,o.value,s.value);if(c!==null)return{mode:"dynamic",nodes:c}}if(!GM(l,o.value))return{mode:"html",content:ec(l,s.value)};const a=Op(l,o.value,s.value);return a===null?{mode:"html",content:ec(l,s.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(w(),N("span",{key:0,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[oe(x(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(w(),N("span",{key:1,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},R(r.value.content),3)):(w(),N("span",{key:2,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,Cq))}}),[["__scopeId","data-v-d17f12b0"]]);No.install=e=>{e.component(No.__name,No)};const xq={class:"inline-code"},Aq={key:0},Us=un(je({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=nd(),s=Ut("markstreamFade",void 0),o=Ut("markstreamTextStreamState",void 0),i=Ut("markstreamStreamVersion",void 0),r=F(()=>{const g=n.fade;return g===""||g===!0||g==="true"||g!==!1&&g!=="false"&&void 0}),l=F(()=>typeof r.value=="boolean"?r.value:typeof s?.value!="boolean"||s.value),a=F(()=>{var g;return String((g=t.node.code)!=null?g:"")}),c=F(()=>!l.value),u=F(()=>{var g;const v=(g=n["index-key"])!=null?g:n.indexKey;return v==null||v===""?"":String(v)}),d=Z(t.node.code),p=Z("");let h=i?.value;const f=Z(0);function m(){return d.value+p.value}function b(){p.value&&(d.value=m(),p.value="")}Ke([()=>t.node.code,u,l,()=>i?.value],([g,v,y,A])=>{const O=String(g??""),$=u.value,k=A!==h;h=A;const E=OM({nextContent:O,persistedContent:$?o?.get($):void 0,currentState:{settledContent:d.value,streamedDelta:p.value},typewriterEnabled:l.value,streamRenderVersionChanged:k});d.value=E.settledContent,p.value=E.streamedDelta,E.appended&&(f.value+=1),$&&o?.set($,O)},{immediate:!0}),Ke(l,g=>{var v;g||(v=m(),d.value=v,p.value="")});const _=F(()=>f.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(g,v)=>(w(),N("code",xq,[c.value?(w(),N(Le,{key:0},[qe(R(a.value),1)],64)):(w(),N(Le,{key:1},[d.value?(w(),N("span",Aq,R(d.value),1)):ie("",!0),p.value?(w(),N("span",{key:1,class:Re(["inline-code-stream-delta",[_.value]]),onAnimationend:b},R(p.value),35)):ie("",!0)],64))]))}}),[["__scopeId","data-v-1b73ee4e"]]);Us.install=e=>{e.component(Us.__name,Us)};const y1=Z(!1),Y2=Z(""),X2=Z("top"),yu=Z(null),ku=Z(null),k1=Z(null),b1=Z(null),Q2=Z(null);let Nf=null,Lf=null,_1=0;function YM(){Nf&&(clearTimeout(Nf),Nf=null),Lf&&(clearTimeout(Lf),Lf=null)}let df=!1,ff=null,Z2=!1;function Tq(e,t,n="top",s=!1,o,i){if(!e)return;const r=++_1;YM();const l=()=>zn(null,null,function*(){var a,c;if(yield(function(){return zn(this,null,function*(){if(!df&&!Z2&&typeof document<"u"){ff!=null||(ff=zn(null,null,function*(){const[{createApp:u,h:d},{default:p}]=yield Promise.all([Xs(()=>import("./vue.runtime.esm-bundler-B-3uIy85.js"),[]),Xs(()=>import("./Tooltip-CTWv7WCU.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),u({setup:()=>()=>{var f;return d(p,{visible:y1.value,"anchor-el":yu.value,content:Y2.value,placement:X2.value,id:ku.value,originX:k1.value,originY:b1.value,isDark:(f=Q2.value)!=null?f:void 0})}}).mount(h),df=!0}));try{yield ff}catch(u){df=!1,ff=null,Z2=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",u)}}})})(),df&&r===_1){ku.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,yu.value=e,Y2.value=t,X2.value=n,k1.value=(a=o?.x)!=null?a:null,b1.value=(c=o?.y)!=null?c:null,Q2.value=typeof i=="boolean"?i:null,y1.value=!0;try{e.setAttribute("aria-describedby",ku.value)}catch{}}});s?l():Nf=setTimeout(l,80)}function Mq(e=!1){_1+=1,YM();const t=()=>{if(yu.value&&ku.value)try{yu.value.removeAttribute("aria-describedby")}catch{}y1.value=!1,yu.value=null,ku.value=null,k1.value=null,b1.value=null};e?t():Lf=setTimeout(t,120)}const w1={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},S1=e=>{var t;return(t=w1[e])!=null?t:(function(n){return(n.split(".").pop()||n).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function J2(e){return{t(t){if(e.te&&w1[t]&&!e.te(t))return S1(t);const n=e.t(t);return n===t&&w1[t]?S1(t):n}}}function Eq(){const e=(function(){var t,n;try{const s=Ls(),o=s?.proxy,i=o?.$t;if(typeof i=="function"){const a=o?.$te;return{t:i.bind(o),te:typeof a=="function"?a.bind(o):void 0}}const r=(n=(t=s?.appContext)==null?void 0:t.config)==null?void 0:n.globalProperties,l=r?.$t;if(typeof l=="function"){const a=r?.$te;return{t:l.bind(r),te:typeof a=="function"?a.bind(r):void 0}}}catch{}return null})();if(e)return J2(e);try{const t=globalThis.$vueI18nUse||null;if(t&&typeof t=="function")try{const n=t();if(n&&typeof n.t=="function")return J2({t:n.t.bind(n),te:typeof n.te=="function"?n.te.bind(n):void 0})}catch{}}catch{}return{t:S1}}function Iq(e,t){var n,s;const o=(s=(n=e.indexKey)!=null?n:t["index-key"])!=null?s:t.indexKey;return o==null||o===""?"":String(o)}const $q=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Nq={key:1,class:"image-placeholder"},Lq={key:1,class:"image-node__raw-text"},Oq={key:0,class:"image-shimmer-overlay"},Pq={key:1,class:"image-node__raw-text"},Rq={key:2,class:"image-error"},qr=un(je({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){const n=e,s=t,o=Z(!1),i=Z(!1),r=Z(""),l=Z("primary"),a=Z(null),c=nd(),u=Ut(u1,null);let d="",p=null;const h=F(()=>Lw(n.node.src)),f=F(()=>Lw(n.fallbackSrc)),m=F(()=>r.value),b=F(()=>!n.lazy),_=F(()=>!n.node.loading&&l.value!=="failed"&&r.value.length>0),g=F(()=>l.value==="failed"),v=F(()=>!b.value&&!o.value&&!i.value&&l.value!=="failed"&&r.value.length>0),y=F(()=>Iq(n,c));function A(P=y.value){P&&a.value&&u?.reportHeight(P,a.value.offsetHeight)}function O(P=y.value){P&&ht(()=>{A(P)})}function $(){p&&(clearTimeout(p),p=null)}function k(){const P=y.value;P&&d!==P&&(d&&u?.markSettled(d),$(),d=P,u?.markPending(P),typeof window<"u"&&(p=window.setTimeout(()=>{d===P&&(O(P),E())},8e3)))}function E(){return zn(this,null,function*(){const P=d;P&&($(),d="",yield ht(),A(P),u?.markSettled(P))})}function M(){if(l.value==="primary"&&f.value&&f.value!==r.value)return l.value="fallback",r.value=f.value,o.value=!1,i.value=!1,void O();l.value="failed",i.value=!0,s("error",r.value),O()}function L(){o.value=!0,i.value=!1,s("load",m.value),O()}function S(P){P.preventDefault(),o.value&&!i.value&&s("click",[P,m.value])}const{t:I}=Eq();return Ke([h,f,()=>n.node.loading],()=>(o.value=!1,i.value=!1,n.node.loading||h.value?(r.value=h.value,void(l.value="primary")):f.value?(r.value=f.value,void(l.value="fallback")):(r.value="",l.value="failed",void(i.value=!0))),{immediate:!0}),Ke([_,o,i,m,()=>n.lazy],([P,D,W,z,q])=>P&&z&&!W?D?(E(),void O()):q?(k(),void O()):void(D||W||k()):(E(),void O()),{flush:"post",immediate:!0}),ls(()=>{(function(){const P=d;P&&($(),d="",u?.markSettled(P))})()}),(P,D)=>{var W,z,q,Q,X;return w(),N("span",{ref_key:"rootRef",ref:a,class:"image-node-container"},[_.value?(w(),N("img",{key:0,src:m.value,alt:String((z=(W=n.node.alt)!=null?W:n.node.title)!=null?z:""),title:String((Q=(q=n.node.title)!=null?q:n.node.alt)!=null?Q:""),class:Re(["image-node__img",{"is-loading":!b.value&&!o.value,"is-loaded":b.value||o.value,"has-natural-size":o.value,"cursor-pointer":o.value}]),loading:n.lazy?"lazy":void 0,fetchpriority:b.value?"high":void 0,decoding:b.value?"sync":"async",tabindex:o.value?0:-1,"aria-label":(X=n.node.alt)!=null?X:x(I)("image.preview"),onError:M,onLoad:L,onClick:S},null,42,$q)):ie("",!0),e.node.loading&&!i.value?(w(),N("span",Nq,[n.usePlaceholder?Cn(P.$slots,"placeholder",{key:0,node:n.node,displaySrc:m.value,imageLoaded:o.value,hasError:i.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy},()=>[D[0]||(D[0]=T("span",{class:"image-shimmer"},null,-1))],!0):(w(),N("span",Lq,R(e.node.raw),1))])):ie("",!0),oe(Gr,{name:"shimmer-fade"},{default:_e(()=>[v.value&&!e.node.loading?(w(),N("span",Oq,[n.usePlaceholder?Cn(P.$slots,"placeholder",{key:0,node:n.node,displaySrc:m.value,imageLoaded:o.value,hasError:i.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy},()=>[D[1]||(D[1]=T("span",{class:"image-shimmer"},null,-1))],!0):(w(),N("span",Pq,R(e.node.raw),1))])):ie("",!0)]),_:3}),g.value?(w(),N("span",Rq,[Cn(P.$slots,"error",{node:n.node,displaySrc:m.value,imageLoaded:o.value,hasError:i.value,fallbackSrc:n.fallbackSrc,lazy:n.lazy},()=>[D[2]||(D[2]=T("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[T("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),T("span",null,R(x(I)("image.loadError")),1)],!0)])):ie("",!0)],512)}}}),[["__scopeId","data-v-cbb5c63e"]]);qr.install=e=>{e.component(qr.__name,qr)};const Dq={key:2},Ni=je({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=cs(()=>t.customId),s=Ut("markstreamHtmlPolicy",void 0),o=Ut("markstreamNestedRendererProps",void 0),i=F(()=>{var f;return(f=s?.value)!=null?f:"safe"}),r=F(()=>{var f,m;const b=(f=o?.value)!=null?f:{};return Lt(it({},b),{customId:(m=t.customId)!=null?m:b.customId,htmlPolicy:i.value})}),l=ui({loader:()=>Promise.resolve().then(()=>my),suspensible:!1}),a=F(()=>t.components[String(t.node.type)]),c=F(()=>!!(a.value&&n.value[t.node.type]&&!dd(String(t.node.type)))),u=F(()=>c.value?ay(t.node,i.value):void 0),d=F(()=>Array.isArray(t.node.children)&&t.node.children.length>0),p=F(()=>{var f;return String((f=t.node.content)!=null?f:"")}),h=F(()=>{var f,m;return String((m=(f=t.node.content)!=null?f:t.node.raw)!=null?m:"")});return(f,m)=>a.value&&c.value?(w(),ve(Hs(a.value),dn({key:0},u.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:_e(()=>[d.value?(w(),ve(x(l),dn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):p.value?(w(),ve(x(l),dn({key:1},r.value,{content:p.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(w(),ve(Hs(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(w(),N("span",Dq,R(h.value),1)):ie("",!0)}}),Bq=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Fq={key:0,translate:"no",class:"markstream-pre__diff-code"},Hq={class:"markstream-pre__diff-number","aria-hidden":"true"},Wq={class:"markstream-pre__diff-content"},zq={class:"markstream-pre__diff-content-inner"},Uq={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},qq=["textContent"],xo=je({__name:"PreCodeNode",props:{node:{},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},reservedHeightPx:{}},setup(e){const t=e,n=F(()=>{var S,I,P;const D=String((I=(S=t.node)==null?void 0:S.language)!=null?I:"");return String((P=String(D).split(/\s+/g)[0])!=null?P:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=F(()=>`language-${n.value}`),o=F(()=>{var S,I,P,D,W;return((S=t.node)==null?void 0:S.diff)===!0?String((P=(I=t.node)==null?void 0:I.code)!=null?P:""):(function(z,q){const Q=String(z??"");return q?Q:Q.replace(/\r\n$|\n$|\r$/,"")})((D=t.node)==null?void 0:D.code,((W=t.node)==null?void 0:W.loading)===!0)}),i=F(()=>o.value.split(/\r\n|\n|\r/)),r=F(()=>Array.from({length:Math.max(1,i.value.length)},(S,I)=>I+1)),l=F(()=>{var S;return t.showLineNumbers===!0&&((S=t.node)==null?void 0:S.diff)===!0}),a=F(()=>l.value&&t.diffInline===!0),c=F(()=>{const S=Number(t.reservedHeightPx);if(!Number.isFinite(S)||S<=0)return;const I=`${Math.ceil(S)}px`;return{height:I,minHeight:I,maxHeight:I,overflow:"auto"}});function u(S){return String(S??"").trim().length===0}function d(S,I="context",P={}){const D=u(S);return{code:S,kind:D&&I!=="hunk"&&!P.preserveBlankKind?"context":I,empty:D}}function p(S){const I=String(S??"");return I?I.split(/\r\n|\n|\r/):[]}function h(S,I){return!u(S[I])||I<S.length-1}function f(S){return S.startsWith("-")&&!S.startsWith("---")}function m(S){return S.startsWith("+")&&!S.startsWith("+++")}function b(S,I){const P=p(S),D=p(I),W=(function(ye,Me){const we=ye.length,ze=Me.length;if((we+1)*(ze+1)>15e5)return null;const Ue=ze+1,Fe=new Uint32Array((we+1)*(ze+1));for(let G=1;G<=we;G++)for(let ne=1;ne<=ze;ne++){const H=G*Ue+ne;if(ye[G-1]===Me[ne-1])Fe[H]=Fe[(G-1)*Ue+(ne-1)]+1;else{const J=Fe[(G-1)*Ue+ne],ce=Fe[G*Ue+(ne-1)];Fe[H]=J>=ce?J:ce}}const rt=[];let le=we,U=ze;for(;le>0&&U>0;)ye[le-1]===Me[U-1]?(rt.push({originalIndex:le-1,modifiedIndex:U-1}),le--,U--):Fe[(le-1)*Ue+U]>=Fe[le*Ue+(U-1)]?le--:U--;return rt.reverse(),rt})(P,D);if(W){const ye=[];let Me=0,we=0;for(const ze of W){for(;Me<ze.originalIndex;)ye.push(Lt(it({},d(P[Me],"removed",{preserveBlankKind:h(P,Me)})),{key:`inline-removed-source-${Me}`,number:""})),Me++;for(;we<ze.modifiedIndex;)ye.push(Lt(it({},d(D[we],"added",{preserveBlankKind:h(D,we)})),{key:`inline-added-source-${we}`,number:we+1})),we++;ye.push(Lt(it({},d(D[ze.modifiedIndex])),{key:`inline-context-source-${ze.originalIndex}-${ze.modifiedIndex}`,number:ze.modifiedIndex+1})),Me=ze.originalIndex+1,we=ze.modifiedIndex+1}for(;Me<P.length;)ye.push(Lt(it({},d(P[Me],"removed",{preserveBlankKind:h(P,Me)})),{key:`inline-removed-source-${Me}`,number:""})),Me++;for(;we<D.length;)ye.push(Lt(it({},d(D[we],"added",{preserveBlankKind:h(D,we)})),{key:`inline-added-source-${we}`,number:we+1})),we++;return ye}const z=[];let q=0,Q=P.length-1,X=D.length-1;for(;q<=Q&&q<=X&&P[q]===D[q];)z.push(Lt(it({},d(D[q])),{key:`inline-prefix-${q}`,number:q+1})),q++;const fe=[];for(;Q>=q&&X>=q&&P[Q]===D[X];)fe.unshift(Lt(it({},d(D[X])),{key:`inline-suffix-${X}`,number:X+1})),Q--,X--;for(let ye=q;ye<=Q;ye++)z.push(Lt(it({},d(P[ye],"removed",{preserveBlankKind:h(P,ye)})),{key:`inline-removed-source-${ye}`,number:""}));for(let ye=q;ye<=X;ye++)z.push(Lt(it({},d(D[ye],"added",{preserveBlankKind:h(D,ye)})),{key:`inline-added-source-${ye}`,number:ye+1}));return z.concat(fe)}const _=F(()=>{var S,I,P,D;const W=(function(X){const fe=X.some(Me=>f(Me)),ye=X.some(Me=>m(Me));return fe&&ye||(function(){var Me,we,ze,Ue;if(n.value==="diff")return!0;const Fe=(Ue=(ze=String((we=(Me=t.node)==null?void 0:Me.raw)!=null?we:"").split(/\r?\n/,1)[0])==null?void 0:ze.trim())!=null?Ue:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(Fe)})()&&(fe||ye)})(i.value),z=(function(){var X,fe;return((X=t.node)==null?void 0:X.originalCode)!=null||((fe=t.node)==null?void 0:fe.updatedCode)!=null})();if(a.value)return[{key:"inline",className:"markstream-pre__diff-pane--inline",lines:W?(function(X){const fe=[];let ye=1;for(const[Me,we]of X.entries())if(we.startsWith("@@"))fe.push(Lt(it({},d(we,"hunk")),{key:`inline-hunk-${Me}`,number:""}));else if(f(we))fe.push(Lt(it({},d(we.slice(1),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${Me}`,number:""}));else if(m(we))fe.push(Lt(it({},d(we.slice(1),"added",{preserveBlankKind:!0})),{key:`inline-added-${Me}`,number:ye++}));else{const ze=we.startsWith(" ")?we.slice(1):we;fe.push(Lt(it({},d(ze)),{key:`inline-context-${Me}`,number:ye})),ye++}return fe})(i.value):b((S=t.node)==null?void 0:S.originalCode,(I=t.node)==null?void 0:I.updatedCode)}];if(!W&&z){const X=p((P=t.node)==null?void 0:P.originalCode),fe=p((D=t.node)==null?void 0:D.updatedCode);return[{key:"original",className:"markstream-pre__diff-pane--original",lines:X.map((ye,Me)=>{const we=fe[Me]===ye?"context":"removed";return Lt(it({},d(ye,we,{preserveBlankKind:h(X,Me)})),{key:`original-${Me}`,number:Me+1})})},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:fe.map((ye,Me)=>{const we=X[Me]===ye?"context":"added";return Lt(it({},d(ye,we,{preserveBlankKind:h(fe,Me)})),{key:`modified-${Me}`,number:Me+1})})}]}const q=[],Q=[];for(const X of i.value)if(X.startsWith("@@"))q.push(d(X,"hunk")),Q.push(d(X,"hunk"));else if(X.startsWith("-")&&!X.startsWith("---"))q.push(d(X.slice(1),"removed",{preserveBlankKind:!0}));else if(X.startsWith("+")&&!X.startsWith("+++"))Q.push(d(X.slice(1),"added",{preserveBlankKind:!0}));else{const fe=X.startsWith(" ")?X.slice(1):X;q.push(d(fe)),Q.push(d(fe))}return[{key:"original",className:"markstream-pre__diff-pane--original",lines:q.map((X,fe)=>Lt(it({},X),{key:`original-${fe}`,number:fe+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:Q.map((X,fe)=>Lt(it({},X),{key:`modified-${fe}`,number:fe+1}))}]}),g=F(()=>{const S=n.value;return S?`Code block: ${S}`:"Code block"}),v=Z(null),y=Z([]);let A=null,O=null;function $(S){const I=Number.parseFloat(String(S??""));return Number.isFinite(I)&&I>0?I:0}function k(S,I){var P;if(!S)return I;const D=S.querySelector(".markstream-pre__diff-content"),W=D?.getBoundingClientRect(),z=(P=W?.height)!=null?P:0;return Math.max(I,Math.ceil(z))}function E(){typeof window<"u"&&(A!=null&&window.cancelAnimationFrame(A),A=window.requestAnimationFrame(()=>{(function(){var S,I;A=null;const P=v.value;if(!P||!l.value)return void(y.value.length&&(y.value=[]));const D=(function(ye){const Me=window.getComputedStyle(ye),we=$(Me.getPropertyValue("--markstream-pre-diff-line-height"));if(we>0)return we;const ze=$(Me.lineHeight);return ze>0?ze:18})(P),W=Array.from(P.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),z=Array.from(P.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),q=Math.max(W.length,z.length),Q=[];for(let ye=0;ye<q;ye++){const Me=k((S=W[ye])!=null?S:null,D),we=k((I=z[ye])!=null?I:null,D),ze=Math.max(D,Me,we);Q.push({rowHeight:ze,originalHeight:Me,modifiedHeight:we})}var X,fe;X=y.value,fe=Q,X.length===fe.length&&X.every((ye,Me)=>{const we=fe[Me];return we&&Math.abs(ye.rowHeight-we.rowHeight)<=.5&&Math.abs(ye.originalHeight-we.originalHeight)<=.5&&Math.abs(ye.modifiedHeight-we.modifiedHeight)<=.5})||(y.value=Q)})()}))}function M(S){O?.disconnect(),O=null,S&&l.value&&typeof ResizeObserver<"u"&&(O=new ResizeObserver(()=>{E()}),O.observe(S))}function L(S,I){const P=y.value[S];if(!P)return;const D=I==="original"?P.originalHeight:P.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(P.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(D)}px`}}return Ke(v,S=>{M(S),ht(()=>E())},{flush:"post"}),Ke([l,_],()=>{M(v.value),ht(()=>E())},{flush:"post",immediate:!0}),ls(()=>{A!=null&&(window.cancelAnimationFrame(A),A=null),O?.disconnect(),O=null}),(S,I)=>(w(),N("pre",{ref_key:"preRef",ref:v,style:Gt(c.value),class:Re([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":l.value,"markstream-pre--diff-inline":a.value}]),"aria-busy":e.node.loading===!0,"aria-label":g.value,"data-language":n.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[l.value?(w(),N("code",Fq,[(w(!0),N(Le,null,nt(_.value,P=>(w(),N("span",{key:P.key,class:Re(["markstream-pre__diff-pane",P.className])},[(w(!0),N(Le,null,nt(P.lines,(D,W)=>(w(),N("span",{key:D.key,class:Re(["markstream-pre__diff-line",[`markstream-pre__diff-line--${D.kind}`,{"markstream-pre__diff-line--empty":D.empty}]]),style:Gt(L(W,P.key))},[I[0]||(I[0]=T("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),T("span",Hq,R(D.number),1),T("span",Wq,[T("span",zq,R(D.code),1)])],6))),128))],2))),128))])):(w(),N(Le,{key:1},[t.showLineNumbers?(w(),N("span",Uq,[(w(!0),N(Le,null,nt(r.value,P=>(w(),N("span",{key:P,class:"markstream-pre__line-number"},R(P),1))),128))])):ie("",!0),T("code",{translate:"no",class:"markstream-pre__code",textContent:R(o.value)},null,8,qq)],64))],14,Bq))}});xo.install=e=>{e.component(xo.__name,xo)};const Rg=Ql(!1);let eS=null;const jq={key:0},Xn=un(je({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=(eS||(eS=oy().then(_=>{Rg.value=!!_}).catch(()=>{Rg.value=!1})),Vf(Rg)),s=nd(),o=Ut("markstreamFade",void 0),i=Ut("markstreamTextStreamState",void 0),r=Ut("markstreamStreamVersion",void 0),l=F(()=>{const _=s.fade;return _===""||_===!0||_==="true"||_!==!1&&_!=="false"&&void 0}),a=F(()=>typeof l.value=="boolean"?l.value:typeof o?.value!="boolean"||o.value),c=F(()=>{var _;const g=(_=s["index-key"])!=null?_:s.indexKey;return g==null||g===""?"":String(g)}),u=Z(t.node.content),d=Z("");let p=r?.value;const h=Z(0);function f(){return u.value+d.value}function m(){d.value&&(u.value=f(),d.value="")}Ke([()=>t.node.content,c,a,()=>r?.value],([_,g,v,y])=>{const A=String(_??""),O=c.value,$=y!==p;p=y;const k=OM({nextContent:A,persistedContent:O?i?.get(O):void 0,currentState:{settledContent:u.value,streamedDelta:d.value},typewriterEnabled:a.value,streamRenderVersionChanged:$});u.value=k.settledContent,d.value=k.streamedDelta,k.appended&&(h.value+=1),O&&i?.set(O,A)},{immediate:!0}),Ke(a,_=>{var g;_||(g=f(),u.value=g,d.value="")});const b=F(()=>h.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(_,g)=>(w(),N("span",{class:Re([[x(n)&&e.node.center?"text-node-center":""],"text-node"])},[u.value?(w(),N("span",jq,R(u.value),1)):ie("",!0),d.value?(w(),N("span",{key:1,class:Re(["text-node-stream-delta",[b.value]]),onAnimationend:m},R(d.value),35)):ie("",!0)],2))}}),[["__scopeId","data-v-aae85f13"]]);Xn.install=e=>{e.component(Xn.__name,Xn)};const XM=je({name:"CodeBlockNodeLoading",inheritAttrs:!1,setup(e,{attrs:t}){const n=t;return()=>{var s;return cn(xo,Lt(it({},t),{node:n.node,showLineNumbers:!0,reservedHeightPx:(s=n.estimatedHeightPx)!=null?s:n.estimatedContentHeightPx,class:["code-pre-fallback",t.class],"data-markstream-code-loading":"1"}))}}}),Dg=ui({loader:()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./CodeBlockNode-TKKkJX8L.js"),__vite__mapDeps([4,5,6]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependencies for CodeBlockNode are missing. Falling back to preformatted code rendering (no Monaco). To enable full code block features, please install "stream-monaco".',e),xo}}),loadingComponent:XM,delay:0,suspensible:!1}),gi=ui(()=>zn(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,s,o,i;return cn(Xn,Lt(it({},t),{node:{type:"text",content:(s=t.node.raw)!=null?s:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(o=t.node.content)!=null?o:""}$`}}))};try{if(yield oy())return(yield Xs(()=>import("./index6-BetANtnV.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,s,o,i;return cn(Xn,Lt(it({},t),{node:{type:"text",content:(s=t.node.raw)!=null?s:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(o=t.node.content)!=null?o:""}$`}}))}})),QM=ui(()=>zn(null,null,function*(){try{if(yield oy())return(yield Xs(()=>import("./index5-BYNcV8BY.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,s,o;return cn(Xn,Lt(it({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(o=e.node.raw)!=null?o:`$$${(s=e.node.content)!=null?s:""}$$`}}))}})),Zs=un(je({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(w(),N("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=s=>t.$emit("click",s,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=s=>t.$emit("mouseEnter",s,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=s=>t.$emit("mouseLeave",s,e.node.id,e.messageId,e.threadId))},R(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);Zs.install=e=>{e.component(Zs.__name,Zs)};const Vq={class:"superscript-node"},mo=un(je({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,footnote_reference:$o,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,emoji:ho,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("sup",Vq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"superscript"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);mo.install=e=>{e.component(mo.__name,mo)};const Kq={class:"subscript-node"},go=un(je({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,footnote_reference:$o,strikethrough:eo,highlight:Lo,insert:vo,superscript:mo,emoji:ho,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("sub",Kq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"subscript"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);go.install=e=>{e.component(go.__name,go)};const Gq={class:"strong-node"},Js=un(je({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,emphasis:no,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("strong",Gq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"strong"}-${l}`,components:s.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);Js.install=e=>{e.component(Js.__name,Js)};const Yq={class:"strikethrough-node"},eo=un(je({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("del",Yq,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"strikethrough"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);eo.install=e=>{e.component(eo.__name,eo)};const Xq=["href","title","aria-label","aria-hidden","target","rel"],Qq=["aria-hidden"],Zq={class:"link-text-wrapper relative inline-flex"},Jq={class:"leading-[normal] link-text"},to=un(je({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=Ut("markstreamShowTooltips",void 0),s=F(()=>{const _=n?.value;return typeof _=="boolean"?_:t.showTooltip}),o=F(()=>{var _,g,v,y,A;const O=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",$=(_=t.animationOpacity)!=null?_:.35,k=Math.max(.12,Math.min(.5*$,$)),E={"--underline-height":`${(g=t.underlineHeight)!=null?g:2}px`,"--underline-bottom":O,"--underline-opacity":String($),"--underline-rest-opacity":String(k),"--underline-duration":`${(v=t.animationDuration)!=null?v:1.6}s`,"--underline-timing":(y=t.animationTiming)!=null?y:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(A=t.animationIteration)!=null?A:"infinite"};return t.color&&(E["--link-color"]=t.color),E}),i=cs(()=>t.customId),r=F(()=>it({text:Xn,strong:Js,strikethrough:eo,emphasis:no,image:qr,html_inline:No,inline_code:Us},i.value)),l=nd(),a=F(()=>{var _,g;const v=(_=t.node)==null?void 0:_.attrs;if(!v||typeof v!="object")return{};const y={};if(Array.isArray(v))for(const A of v)Array.isArray(A)&&A[0]&&(y[String(A[0])]=String((g=A[1])!=null?g:""));else for(const[A,O]of Object.entries(v))A&&O!=null&&O!==!1&&(y[A]=O===!0?"":String(O));return K2(y,"safe","a")}),c=F(()=>it(it({},l),a.value)),u=F(()=>{var _,g;return K2({href:String((g=(_=t.node)==null?void 0:_.href)!=null?g:"")},"safe","a").href}),d=F(()=>{if(!u.value)return;const _=c.value.target;return(typeof _=="string"?_.trim():String(_??"").trim())||(U9(u.value)?"_blank":void 0)}),p=F(()=>{var _;return String((_=d.value)!=null?_:"").trim().toLowerCase()==="_blank"}),h=F(()=>{if(!u.value)return;const _=c.value.rel,g=new Set((typeof _=="string"?_:String(_??"")).split(/\s+/).filter(Boolean)),v=new Set(Array.from(g).filter(y=>y.toLowerCase()!=="opener"));return p.value&&(v.add("noopener"),v.add("noreferrer")),v.size>0?Array.from(v).join(" "):void 0}),f=F(()=>{const _=it({},c.value);return delete _.title,delete _.href,delete _.target,delete _.rel,_});function m(){s.value&&Mq()}const b=F(()=>{var _,g;const v=(_=t.node)==null?void 0:_.title;return typeof v=="string"&&v.trim().length>0?v:String((g=u.value)!=null?g:"")});return(_,g)=>{var v,y;return e.node.loading?(w(),N("span",dn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},x(l),{style:o.value}),[T("span",Zq,[T("span",Jq,[oe(x(Xn),{class:"leading-[normal] link-text",node:{type:"text",content:String((v=e.node.text)!=null?v:""),raw:String((y=e.node.text)!=null?y:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),g[1]||(g[1]=T("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Qq)):(w(),N("a",dn({key:0,class:"link-node",href:u.value,title:s.value?"":b.value,"aria-label":`Link: ${b.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},f.value,{style:o.value,onMouseenter:g[0]||(g[0]=A=>(function(O){var $,k,E,M;if(!s.value)return;const L=O,S=L?.clientX!=null&&L?.clientY!=null?{x:L.clientX,y:L.clientY}:void 0,I=(($=t.node)==null?void 0:$.title)||((k=u.value)!=null&&k.includes("xn--")&&((M=(E=t.node)==null?void 0:E.text)!=null&&M.includes("://"))?t.node.text:u.value)||"";Tq(O.currentTarget,I,"top",!1,S)})(A)),onMouseleave:m}),[(w(!0),N(Le,null,nt(e.node.children,(A,O)=>(w(),ve(x(Ni),{key:`${e.indexKey||"emphasis"}-${O}`,components:r.value,node:A,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${O}`},null,8,["components","node","custom-id","index-key"]))),128))],16,Xq))}}}),[["__scopeId","data-v-367e6ca4"]]);to.install=e=>{e.component(to.__name,to)};const ej={class:"insert-node"},vo=un(je({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,strikethrough:eo,highlight:Lo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("ins",ej,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"insert"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);vo.install=e=>{e.component(vo.__name,vo)};const tj={class:"highlight-node"},Lo=un(je({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,emphasis:no,strikethrough:eo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("mark",tj,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"highlight"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);Lo.install=e=>{e.component(Lo.__name,Lo)};const nj={class:"emphasis-node"},no=un(je({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>it({text:Xn,inline_code:Us,link:to,html_inline:No,strong:Js,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,footnote_reference:$o,math_inline:gi,reference:Zs},n.value));return(o,i)=>(w(),N("em",nj,[(w(!0),N(Le,null,nt(e.node.children,(r,l)=>(w(),ve(x(Ni),{key:`${e.indexKey||"emphasis"}-${l}`,components:s.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);no.install=e=>{e.component(no.__name,no)};const sj={class:"hard-break"},jr=un(je({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(w(),N("br",sj))}),[["__scopeId","data-v-50c58f70"]]);jr.install=e=>{e.component(jr.__name,jr)};const Gu=je({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=Dr({checkbox:Io,checkbox_input:Io,emoji:ho,emphasis:no,hardbreak:jr,highlight:Lo,inline_code:Us,insert:vo,link:to,reference:Zs,strikethrough:eo,strong:Js,subscript:go,superscript:mo,text:Xn}),s=cs(()=>t.customId),o=F(()=>{const i=s.value;return Object.keys(i).length>0?it(it({},n),i):n});return(i,r)=>(w(!0),N(Le,null,nt(e.nodes,(l,a)=>(w(),ve(x(Ni),{key:a,components:o.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function C1(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(C1)}function Pp(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(C1))return e;if(!t||e.length!==1)return null;const s=e[0];if(s?.type!=="paragraph"||!Array.isArray(s.children))return null;const o=s.children;return(n||o.length>0)&&o.every(C1)?o:null}function dc(e){var t,n;if(!e?.length)return null;let s="";for(const o of e){if(o?.type!=="text"||o.center===!0)return null;s+=String((n=(t=o.content)!=null?t:o.raw)!=null?n:"")}return s}const oj=["cite"],ij={key:0,dir:"auto",class:"paragraph-node"},rj=["custom-id"],Of=un(je({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=cs(()=>t.customId),s=F(()=>!!n.value.paragraph),o=F(()=>!!n.value.text),i=F(()=>Pp(t.node.children,!s.value)),r=F(()=>t.fade!==!1||o.value?null:dc(i.value));return En("markstreamShowTooltips",F(()=>t.showTooltips)),En("markstreamFade",F(()=>t.fade)),(l,a)=>(w(),N("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(w(),N("p",ij,[r.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(r.value),9,rj)):(w(),ve(x(Gu),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(w(),ve(x(yo),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=c=>l.$emit("copy",c))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,oj))}}),[["__scopeId","data-v-abfecebc"]]);Of.install=e=>{e.component(Of.__name,Of)};const lj={class:"definition-list"},aj={class:"definition-term"},cj={class:"definition-desc"},Pf=un(je({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,s)=>(w(),N("dl",lj,[(w(!0),N(Le,null,nt(t.node.items,(o,i)=>(w(),N(Le,{key:i},[T("dt",aj,[oe(x(yo),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:o.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:s[0]||(s[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),T("dd",cj,[oe(x(yo),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:o.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:s[1]||(s[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);Pf.install=e=>{e.component(Pf.__name,Pf)};const uj=["href","title"],bu=un(je({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(s){var o;if(s.preventDefault(),typeof document>"u")return;const i=`fnref-${String((o=t.node.id)!=null?o:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(s,o)=>(w(),N("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,uj))}}),[["__scopeId","data-v-e1eb37b6"]]);bu.install=e=>{e.component(bu.__name,bu)};const dj=["id"],fj={class:"flex-1"},Rf=je({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,s)=>(w(),N("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[T("div",fj,[oe(x(yo),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:s[0]||(s[0]=o=>n.$emit("copy",o))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,dj))}});Rf.install=e=>{e.component(Rf.__name,Rf)};const pj=["custom-id"],x1=un(je({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=cs(()=>t.customId),s=Ut("markstreamFade",void 0),o=F(()=>s?.value!==!1||n.value.text?null:dc(t.node.children)),i=F(()=>it({text:Xn,inline_code:Us,link:to,image:qr,strong:Js,emphasis:no,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,checkbox:Io,checkbox_input:Io,footnote_reference:$o,hardbreak:jr,math_inline:gi,reference:Zs},n.value));return(r,l)=>(w(),ve(Hs(`h${e.node.level}`),dn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:_e(()=>[o.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(o.value),9,pj)):(w(!0),N(Le,{key:1},nt(e.node.children,(a,c)=>(w(),ve(x(Ni),{key:c,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${c}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),Rp=x1;Rp.install=e=>{e.component(x1.__name,x1)};const hj={key:0,dir:"auto",class:"paragraph-node"},mj=["custom-id"],gj={dir:"auto",class:"paragraph-node"},vj=["custom-id"],tc=un(je({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=F(()=>{var h;return(h=t.node)!=null?h:t.item}),s=cs(()=>t.customId),o=F(()=>!!s.value.paragraph),i=F(()=>!!s.value.text),r=F(()=>{var h;return Pp((h=n.value)==null?void 0:h.children,!o.value)}),l=F(()=>{var h;if(o.value)return null;const f=(h=n.value)==null?void 0:h.children;if(!Array.isArray(f)||f.length<2)return null;const m=f[0];if(m?.type!=="paragraph"||!Array.isArray(m.children))return null;const b=f.slice(1);if(!b.every(g=>g?.type==="list"))return null;const _=Pp([m]);return _?{paragraphChildren:_,nestedLists:b}:null});function a(){return t.fade===!1&&!i.value}const c=F(()=>a()?dc(r.value):null),u=F(()=>{var h;return a()?dc((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),p=F(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return En("markstreamShowTooltips",F(()=>t.showTooltips)),En("markstreamFade",F(()=>t.fade)),(h,f)=>{var m,b;return w(),N("li",dn({class:"list-item",dir:"auto"},p.value),[r.value?(w(),N("p",hj,[c.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(c.value),9,mj)):(w(),ve(x(Gu),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(w(),N(Le,{key:1},[T("p",gj,[u.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(u.value),9,vj)):(w(),ve(x(Gu),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(w(!0),N(Le,null,nt(l.value.nestedLists,(_,g)=>(w(),ve(x(yo),{key:g,nodes:[_],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${g}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:f[0]||(f[0]=v=>h.$emit("copy",v))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(w(),ve(x(yo),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(b=(m=n.value)==null?void 0:m.children)!=null?b:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:f[1]||(f[1]=_=>h.$emit("copy",_))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);tc.install=e=>{e.component(tc.__name,tc)};const nc=un(je({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=cs(()=>e.customId),n=F(()=>t.value.list_item||tc);return(s,o)=>(w(),ve(Hs(e.node.ordered?"ol":"ul"),{class:Re(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:_e(()=>[(w(!0),N(Le,null,nt(e.node.items,(i,r)=>{var l;return w(),ve(Hs(n.value),dn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:o[0]||(o[0]=a=>s.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);nc.install=e=>{e.component(nc.__name,nc)};const ZM=Symbol("ViewportPriority");function yj(e,t){var n,s;const o=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?Z(t):t,r=o?(n=window.requestIdleCallback)!=null?n:g=>window.setTimeout(()=>g({didTimeout:!0,timeRemaining:()=>0}),16):null,l=o?(s=window.cancelIdleCallback)!=null?s:g=>window.clearTimeout(g):null;let a=null,c=null;const u=new Map,d=new Set;let p=null;function h(){if(p!=null){try{l?.(p)}catch{}p=null}}function f(){if(!u.size){try{a?.disconnect()}catch{}a=null,c=null,d.size||h()}}function m(g){const v=u.get(g);if(v){if(!v.visible.value){v.visible.value=!0;try{v.resolve()}catch{}}try{a?.unobserve(g)}catch{}u.delete(g),d.delete(g),f()}}function b(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&p==null&&d.size&&(p=r(()=>{p=null;const g=d.values().next().value;g&&(d.delete(g),m(g),d.size&&b())},{timeout:1200}))}Ke(i,g=>{if(!g){for(const v of Array.from(u.keys()))m(v);h()}},{flush:"sync"});const _=(g,v)=>{const y=Z(!1);let A,O=!1;const $=new Promise(M=>{A=()=>{O||(O=!0,M())}}),k=()=>{try{a?.unobserve(g)}catch{}u.delete(g),d.delete(g),f()};if(!o||!i.value)return y.value=!0,A(),{isVisible:y,whenVisible:$,destroy:k};const E=(function(M,L){if(!o)return a;if(typeof IntersectionObserver>"u")return null;const S=(function(D,W){var z,q,Q;return{root:(z=e?.(D??null))!=null?z:null,rootMargin:(q=W?.rootMargin)!=null?q:"300px",threshold:(Q=W?.threshold)!=null?Q:0}})(M,L);if(a&&(P=S,(I=c)&&I.root===P.root&&I.rootMargin===P.rootMargin&&I.threshold===P.threshold))return a;var I,P;if(a)try{a.disconnect()}catch{}a=new IntersectionObserver(D=>{for(const W of D)(W.isIntersecting||W.intersectionRatio>0)&&m(W.target)},{root:S.root,rootMargin:S.rootMargin,threshold:S.threshold}),c=S;for(const D of u.keys())a.observe(D);return a})(g,v);return E?(u.set(g,{resolve:A,visible:y}),E.observe(g),d.add(g),b(),{isVisible:y,whenVisible:$,destroy:k}):(y.value=!0,A(),{isVisible:y,whenVisible:$,destroy:k})};return En(ZM,_),_}function kj(){var e,t;const n=Ut(ZM,void 0);if(n)return n;const s=new WeakMap;let o=null;const i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:p=>window.setTimeout(()=>p({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:p=>window.clearTimeout(p):null,c=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},u=p=>{const h=s.get(p);if(h){if(!h.visible.value){h.visible.value=!0;try{h.resolve()}catch{}}try{o?.unobserve(p)}catch{}s.delete(p),i.delete(p),i.size||c()}},d=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const p=i.values().next().value;p&&(i.delete(p),u(p),i.size&&d())},{timeout:1200}))};return p=>{const h=Z(!1);let f,m=!1;const b=new Promise(v=>{f=()=>{m||(m=!0,v())}}),_=()=>{try{o?.unobserve(p)}catch{}s.delete(p),i.delete(p),i.size||c()},g=o||(typeof window>"u"||typeof IntersectionObserver>"u"?null:(o=new IntersectionObserver(v=>{for(const y of v)(y.isIntersecting||y.intersectionRatio>0)&&u(y.target)},{root:null,rootMargin:"300px",threshold:0}),o));return g?(s.set(p,{resolve:f,visible:h}),g.observe(p),i.add(p),d(),{isVisible:h,whenVisible:b,destroy:_}):(h.value=!0,f(),{isVisible:h,whenVisible:b,destroy:_})}}const bj={key:2,class:"html-block-node__raw"},_j=["innerHTML"],wj={key:1,class:"html-block-node__placeholder"},_u=un(je({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=Ut("markstreamHtmlPolicy",void 0),s=Ut("markstreamNestedRendererProps",void 0),o=F(()=>{var O,$;return($=(O=t.htmlPolicy)!=null?O:n?.value)!=null?$:"safe"}),i=F(()=>{var O,$;const k=(O=s?.value)!=null?O:{};return Lt(it({},k),{customId:($=t.customId)!=null?$:k.customId,htmlPolicy:o.value})}),r=ui({loader:()=>Promise.resolve().then(()=>my),suspensible:!1}),l=F(()=>{const O=c1(t.node.attrs,o.value);if(!O)return;const $=$p(O);return Object.keys($).length>0?$:void 0}),a=F(()=>{const O=String(t.node.tag||"").trim(),$=c1(t.node.attrs,o.value,O);if(!$)return;const k=$p($);return Object.keys(k).length>0?k:void 0}),c=cs(()=>t.customId),u=je({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=Z(null),p=Z(typeof window>"u"),h=Z(t.node.content),f=F(()=>Array.isArray(t.node.children)?t.node.children:[]),m=F(()=>String(t.node.tag||"div")),b=F(()=>{const O=m.value.trim().toLowerCase();return DT.has(O)||Z0(O,o.value)}),_=F(()=>f.value.length>0&&!!t.node.tag&&!b.value),g=F(()=>{var O,$,k;if(_.value)return{mode:"structured"};if(!p.value)return{mode:"html",content:(O=h.value)!=null?O:""};const E=($=h.value)!=null?$:t.node.content;if(!E)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:ec(E,o.value)};if(t.node.loading){const L=Op(E,c.value,o.value);return L===null?{mode:"text",content:(k=t.node.raw)!=null?k:E}:{mode:"dynamic",nodes:L}}if(!GM(E,c.value))return{mode:"html",content:ec(E,o.value)};const M=Op(E,c.value,o.value);return M===null?{mode:"html",content:ec(E,o.value)}:{mode:"dynamic",nodes:M}}),v=kj(),y=Z(null),A=!!t.node.loading;return typeof window<"u"?(Ke(d,O=>{var $,k;if((k=($=y.value)==null?void 0:$.destroy)==null||k.call($),y.value=null,!A)return p.value=!0,void(h.value=t.node.content);if(!O)return void(p.value=!1);const E=v(O,{rootMargin:"400px"});y.value=E,p.value=E.isVisible.value,E.whenVisible.then(()=>{p.value=!0})},{immediate:!0}),Ke(()=>t.node.content,O=>{A&&!p.value||(h.value=O)})):p.value=!0,ls(()=>{var O,$;($=(O=y.value)==null?void 0:O.destroy)==null||$.call(O),y.value=null}),(O,$)=>(w(),ve(Hs(_.value?m.value:"div"),dn({ref_key:"htmlRef",ref:d,class:"html-block-node"},_.value?a.value:void 0),{default:_e(()=>[p.value?(w(),N(Le,{key:0},[g.value.mode==="structured"?(w(),ve(x(r),dn({key:0},i.value,{nodes:f.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):g.value.mode==="dynamic"?(w(),ve(x(u),{key:1,nodes:g.value.nodes},null,8,["nodes"])):g.value.mode==="text"?(w(),N("pre",bj,R(g.value.content),1)):(w(),N("div",dn({key:3},l.value,{innerHTML:g.value.content}),null,16,_j))],64)):(w(),N("div",wj,[Cn(O.$slots,"placeholder",{node:e.node},()=>[$[0]||($[0]=T("span",{class:"html-block-node__placeholder-bar"},null,-1)),$[1]||($[1]=T("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),$[2]||($[2]=T("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16))}}),[["__scopeId","data-v-f1744dfb"]]);_u.install=e=>{e.component(_u.__name,_u)};const Sj={dir:"auto",class:"paragraph-node"},Cj=["custom-id"],ql=un(je({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=cs(()=>t.customId),s=Ut("markstreamHtmlPolicy",void 0),o=Ut("markstreamFade",void 0),i=Ut("markstreamParseOptions",void 0),r=Ut("markstreamCustomMarkdownIt",void 0),l=Ut("markstreamNestedRendererProps",void 0),a=F(()=>{var k;return(k=s?.value)!=null?k:"safe"}),c=F(()=>{var k;return(k=t.parseOptions)!=null?k:i?.value}),u=F(()=>{var k;return(k=t.customMarkdownIt)!=null?k:r?.value}),d=F(()=>{var k,E;return(E=t.customHtmlTags)!=null?E:(k=l?.value)==null?void 0:k.customHtmlTags}),p=F(()=>{var k,E;const M=(k=l?.value)!=null?k:{};return Lt(it({},M),{customId:(E=t.customId)!=null?E:M.customId,customHtmlTags:d.value,parseOptions:c.value,customMarkdownIt:u.value,htmlPolicy:a.value})}),h=ui({loader:()=>Promise.resolve().then(()=>my),suspensible:!1});function f(k){var E;return k.type==="text"&&String((E=k.content)!=null?E:"").trim()===""}const m=F(()=>t.node.children.filter(k=>!f(k))),b=F(()=>m.value.length>0&&m.value.every(k=>k.type==="image"||(function(E){var M;const L=(function(S){return S.type==="link"&&Array.isArray(S.children)?S.children.filter(I=>!f(I)):[]})(E);return L.length===1&&((M=L[0])==null?void 0:M.type)==="image"})(k))),_=F(()=>new Set(kc(d.value))),g=F(()=>{if(!b.value||m.value.length<=1)return t.node.children;const k=[];for(let E=0;E<t.node.children.length;E++){const M=t.node.children[E];if(!f(M)){k.push(M);continue}const L=k.length>0,S=t.node.children.slice(E+1).some(I=>!f(I));L&&S&&k.push(Lt(it({},M),{content:" ",raw:" "}))}return k}),v=F(()=>o?.value===!1&&!n.value.text),y=F(()=>v.value?dc(g.value):null);function A(k,E){return{node:k,"index-key":`${t.indexKey}-${E}`,"custom-id":t.customId,"custom-html-tags":d.value}}const O=F(()=>it({inline_code:Us,image:qr,link:to,hardbreak:jr,emphasis:no,strong:Js,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,html_inline:No,html_block:_u,emoji:ho,checkbox:Io,math_inline:gi,checkbox_input:Io,reference:Zs,footnote_anchor:bu,footnote_reference:$o,text:Xn},n.value)),$=F(()=>g.value.map((k,E)=>{var M;const L=(function(S){var I,P,D,W;if(S.type==="html_block"||S.type==="html_inline"){const z=String((I=S.tag)!=null?I:"").trim().toLowerCase()||WT(S.content);if(z&&!_.value.has(z)&&zT((P=S.content)!=null?P:S.raw,z)){const q=String((W=(D=S.content)!=null?D:S.raw)!=null?W:"");return{child:{type:"text",content:q,raw:q},component:Xn,isCustomComponent:!1}}}return{child:S,component:O.value[S.type],isCustomComponent:!!(n.value[S.type]&&!dd(String(S.type)))}})(k);return Lt(it({},L),{index:E,key:`${t.indexKey||"paragraph"}-${E}`,customAttrs:L.isCustomComponent?ay(L.child,a.value):void 0,hasSlotChildren:Array.isArray(L.child.children)&&L.child.children.length>0,slotContent:String((M=L.child.content)!=null?M:""),originalChild:k})}));return(k,E)=>(w(),N("p",Sj,[y.value!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(y.value),9,Cj)):(w(!0),N(Le,{key:1},nt($.value,M=>{return w(),N(Le,{key:M.key},[b.value&&f(M.originalChild)?(w(),N(Le,{key:0},[qe(R((L=M.originalChild,String((S=L.content)!=null?S:""))),1)],64)):M.isCustomComponent?(w(),ve(Hs(M.component),dn({key:1,ref_for:!0},M.customAttrs,{node:M.child,loading:M.child.loading,"index-key":M.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":p.value.isDark}),{default:_e(()=>[M.hasSlotChildren?(w(),ve(x(h),dn({key:0,ref_for:!0},p.value,{nodes:M.child.children,"index-key":M.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):M.slotContent?(w(),ve(x(h),dn({key:1,ref_for:!0},p.value,{content:M.slotContent,final:!M.child.loading,"index-key":`${M.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(w(),ve(Hs(M.component),dn({key:2,ref_for:!0},A(M.child,M.index)),null,16))],64);var L,S}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);ql.install=e=>{e.component(ql.__name,ql)};const xj={class:"table-node-wrapper"},Aj=["aria-busy"],Tj={key:0},Mj=["custom-id"],Ej=["aria-label","onPointerdown"],Ij=["custom-id"],$j={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},wu=un(je({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=F(()=>{var _;return(_=t.node.loading)!=null&&_}),s=F(()=>{var _;return(_=t.node.rows)!=null?_:[]}),o=Z(null),i=Z([]);let r=null;const l=F(()=>t.node.header.cells.length),a=F(()=>i.value.some(_=>Number.isFinite(_)&&_>0)),c=F(()=>a.value?i.value.map(_=>_>0?{width:`${_}px`}:void 0):[]);En("markstreamShowTooltips",F(()=>t.showTooltips)),En("markstreamFade",F(()=>t.fade));const u=cs(()=>t.customId),d=F(()=>!!u.value.text),p=F(()=>!!u.value.paragraph),h=new WeakMap;function f(_){const g=t.fade===!1&&!d.value,v=!p.value,y=h.get(_);if(y?.children===_.children&&y.textFastPath===g&&y.paragraphFastPath===v)return y.info;const A=Pp(_.children,v,!0),O={simpleChildren:A,plainText:A&&g?dc(A):null};return h.set(_,{children:_.children,textFastPath:g,paragraphFastPath:v,info:O}),O}function m(_){if(!r)return;_.preventDefault();const g=r.startWidth+r.nextStartWidth,v=Math.min(48,Math.floor(g/2)),y=Math.max(v,Math.min(g-v,Math.round(r.startWidth+_.clientX-r.startX))),A=[...r.widths];A[r.index]=y,A[r.index+1]=g-y,i.value=A}function b(){r&&(window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),r=null)}return Ke(l,()=>{b(),i.value=[]}),ls(b),(_,g)=>(w(),N("div",xj,[T("table",{ref_key:"tableRef",ref:o,class:Re(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(w(),N("colgroup",Tj,[(w(!0),N(Le,null,nt(e.node.header.cells,(v,y)=>(w(),N("col",{key:y,style:Gt(c.value[y])},null,4))),128))])):ie("",!0),T("thead",null,[T("tr",null,[(w(!0),N(Le,null,nt(e.node.header.cells,(v,y)=>(w(),N("th",{key:y,dir:"auto",class:Re([v.align==="right"?"text-right":v.align==="center"?"text-center":"text-left"])},[f(v).plainText!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(f(v).plainText),9,Mj)):f(v).simpleChildren?(w(),ve(x(Gu),{key:1,nodes:f(v).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${y}`},null,8,["nodes","custom-id","index-key"])):(w(),ve(x(yo),{key:2,nodes:v.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[0]||(g[0]=A=>_.$emit("copy",A))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),y<e.node.header.cells.length-1?(w(),N("button",{key:3,type:"button",class:"table-node__resize-handle","aria-label":`Resize columns ${y+1} and ${y+2}`,onPointerdown:A=>(function(O,$){if($.button!==0)return;const k=(function(){var L;const S=(L=o.value)==null?void 0:L.querySelectorAll("thead th");return Array.from(S??[],I=>Math.round(I.getBoundingClientRect().width))})(),E=k[O],M=k[O+1];E&&M&&($.preventDefault(),r={index:O,startX:$.clientX,startWidth:E,nextStartWidth:M,widths:k},i.value=k,window.addEventListener("pointermove",m),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b))})(y,A)},null,40,Ej)):ie("",!0)],2))),128))])]),T("tbody",null,[(w(!0),N(Le,null,nt(s.value,(v,y)=>(w(),N("tr",{key:y},[(w(!0),N(Le,null,nt(v.cells,(A,O)=>(w(),N("td",{key:O,class:Re([A.align==="right"?"text-right":A.align==="center"?"text-center":"text-left"]),dir:"auto"},[f(A).plainText!==null?(w(),N("span",{key:0,class:"text-node","custom-id":t.customId},R(f(A).plainText),9,Ij)):f(A).simpleChildren?(w(),ve(x(Gu),{key:1,nodes:f(A).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${y}-${O}`},null,8,["nodes","custom-id","index-key"])):(w(),ve(x(yo),{key:2,nodes:A.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:g[1]||(g[1]=$=>_.$emit("copy",$))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,Aj),oe(Gr,{name:"table-node-fade"},{default:_e(()=>[n.value?(w(),N("div",$j,[Cn(_.$slots,"loading",{isLoading:n.value},()=>[g[2]||(g[2]=T("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),g[3]||(g[3]=T("span",{class:"sr-only"},"Loading",-1))],!0)])):ie("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);wu.install=e=>{e.component(wu.__name,wu)};const Nj={class:"hr-node"},Df=un({},[["render",function(e,t){return w(),N("hr",Nj)}],["__scopeId","data-v-39b2349c"]]);Df.install=e=>{e.component(Df.__name,Df)};const Lj={class:"unknown-node"},A1=je({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(w(),N("div",Lj,R(e.node.raw),1))}),Bf=un(je({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=F(()=>`vmr-container vmr-container-${t.node.name}`),s=cs(()=>t.customId),o=F(()=>it({text:Xn,paragraph:ql,heading:Rp,inline_code:Us,link:to,image:qr,strong:Js,emphasis:no,strikethrough:eo,insert:vo,subscript:go,superscript:mo,checkbox:Io,checkbox_input:Io,hardbreak:jr,math_inline:gi,reference:Zs,list:nc,math_block:QM,table:wu},s.value));return(i,r)=>(w(),N("div",dn({class:n.value},e.node.attrs),[(w(!0),N(Le,null,nt(e.node.children,(l,a)=>{return w(),ve(Hs((c=l.type,o.value[c]||A1)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var c}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);Bf.install=e=>{e.component(Bf.__name,Bf)};const Oj=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],tS=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function Pj(e){if(e<=255)return Oj[e];let t=0,n=tS.length-1;for(;t<=n;){const s=t+n>>1,o=tS[s];if(e<o[0])n=s-1;else{if(!(e>o[1]))return o[2];t=s+1}}return"L"}const Rj=/[ \t\n\r\f]+/g,Dj=/[\t\n\r\f]| {2,}|^ | $/;let Bg=null;const Bj=new RegExp("\\p{Script=Arabic}","u"),$h=new RegExp("\\p{M}","u"),JM=new RegExp("\\p{Nd}","u");function nS(e){return Bj.test(e)}function sS(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function er(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){const s=e.charCodeAt(t+1);if(s>=56320&&s<=57343){if(sS(s-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(sS(n))return!0}}return!1}const Fj=new Set([" "," ","","\uFEFF"]);function Hj(e){return er(e)}function T1(e){return!(function(t){const n=Dp(t);return n!==null&&(cy.has(n)||Kl.has(n))})(e)&&!(function(t){const n=Dp(t);return n!==null&&Fj.has(n)})(e)}const cy=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),Nh=new Set(['"',"(","[","{","“","‘","«","‹","(","〔","〈","《","「","『","【","〖","〘","〚"]),uy=new Set(["'","’"]),Kl=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),Wj=new Set([":",".","،","؛"]),zj=new Set(["၏"]),Uj=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function qj(e){if(dy(e))return!0;let t=!1;for(const n of e)if(Kl.has(n))t=!0;else if(!t||!$h.test(n))return!1;return t}function jj(e){for(const t of e)if(!cy.has(t)&&!Kl.has(t))return!1;return e.length>0}function Vj(e){if(dy(e))return!0;for(const t of e)if(!Nh.has(t)&&!uy.has(t)&&!$h.test(t))return!1;return e.length>0}function dy(e){let t=!1;for(const n of e)if(n!=="\\"&&!$h.test(n)){if(!(Nh.has(n)||Kl.has(n)||uy.has(n)))return!1;t=!0}return t}function e3(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const s=e.charCodeAt(n);if(s<56320||s>57343)return n;const o=n-1;if(o<0)return n;const i=e.charCodeAt(o);return i>=55296&&i<=56319?o:n}function Dp(e){if(e.length===0)return null;const t=e3(e,e.length);return e.slice(t)}function Kj(e){const t=Array.from(e);let n=t.length;for(;n>0;){const s=t[n-1];if($h.test(s))n--;else{if(!Nh.has(s)&&!uy.has(s))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function Gj(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function oS(e,t,n,s){const o=t[s],i=e[s];if(o==null)return i;const r=n[s];if(i.length===r)return i;const l=o.repeat(r);return e[s]=l,l}function iS(e,t){return e&&t!==null&&Wj.has(t)}function Yj(e){const t=Dp(e);return t!==null&&zj.has(t)}function Xj(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function M1(e){let t=e.length;for(;t>0;){const n=e3(e,t),s=e.slice(n,t);if(Uj.has(s))return!0;if(!Kl.has(s))return!1;t=n}return!1}function Qj(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`
|
|
237
237
|
`)return"hard-break"}return e===" "?"space":e===" "||e===" "||e===""||e==="\uFEFF"?"glue":e===""?"zero-width-break":e===""?"soft-hyphen":"text"}const Zj=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Vo(e){return e.length===1?e[0]:e.join("")}function Jj(e,t){const n=[];for(let s=e.length-1;s>=0;s--)n.push(e[s]);return n.push(t),Vo(n)}function eV(e,t,n,s){if(!Zj.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const o=[];let i=null,r=[],l=n,a=!1,c=0;for(const u of e){const d=Qj(u,s),p=d==="text"&&t;i===null||d!==i||p!==a?(i!==null&&o.push({text:Vo(r),isWordLike:a,kind:i,start:l}),i=d,r=[u],l=n+c,a=p,c+=u.length):(r.push(u),c+=u.length)}return i!==null&&o.push({text:Vo(r),isWordLike:a,kind:i,start:l}),o}function Fg(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const tV=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function nV(e,t){const n=e.texts[t];return!!n.startsWith("www.")||tV.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function sV(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}const oV=new Set([":","-","/","×",",",".","+","–","—"]),rS=/^[A-Za-z0-9_]+[,:;]*$/,lS=/[,:;]+$/;function aS(e){for(const t of e)if(JM.test(t))return!0;return!1}function Ff(e){if(e.length===0)return!1;for(const t of e)if(!JM.test(t)&&!oV.has(t))return!1;return!0}function cS(e,t,n){var s,o,i;const r=(Bg===null&&(Bg=new Intl.Segmenter(void 0,{granularity:"word"})),Bg);let l=0;const a=[],c=[],u=[],d=[],p=[],h=[],f=[],m=[],b=[],_=[],g=[],v=[];for(const k of r.segment(e))for(const E of eV(k.segment,(s=k.isWordLike)!=null&&s,k.index,n)){let M=function(){h[q]!==null&&(c[q]=[oS(a,h,f,q)],h[q]=null),c[q].push(E.text),u[q]=u[q]||E.isWordLike,m[q]=m[q]||I,b[q]=b[q]||P,_[q]=W,g[q]=z,v[q]=iS(b[q],D)};const L=E.kind==="text",S=Gj(E.text,E.isWordLike,E.kind),I=er(E.text),P=nS(E.text),D=Dp(E.text),W=M1(E.text),z=Yj(E.text),q=l-1;t.carryCJKAfterClosingQuote&&L&&l>0&&d[q]==="text"&&I&&m[q]&&_[q]||L&&l>0&&d[q]==="text"&&jj(E.text)&&m[q]||L&&l>0&&d[q]==="text"&&g[q]?M():L&&l>0&&d[q]==="text"&&E.isWordLike&&P&&v[q]?(M(),u[q]=!0):S!==null&&l>0&&d[q]==="text"&&h[q]===S?f[q]=((o=f[q])!=null?o:1)+1:L&&!E.isWordLike&&l>0&&d[q]==="text"&&(qj(E.text)||E.text==="-"&&u[q])?M():(a[l]=E.text,c[l]=[E.text],u[l]=E.isWordLike,d[l]=E.kind,p[l]=E.start,h[l]=S,f[l]=S===null?0:1,m[l]=I,b[l]=P,_[l]=W,g[l]=z,v[l]=iS(P,D),l++)}for(let k=0;k<l;k++)h[k]===null?a[k]=Vo(c[k]):a[k]=oS(a,h,f,k);for(let k=1;k<l;k++)d[k]==="text"&&!u[k]&&dy(a[k])&&d[k-1]==="text"&&(a[k-1]+=a[k],u[k-1]=u[k-1]||u[k],a[k]="");const y=Array.from({length:l},()=>null);let A=-1;for(let k=l-1;k>=0;k--){const E=a[k];if(E.length!==0){if(d[k]==="text"&&!u[k]&&Vj(E)&&A>=0&&d[A]==="text"){const M=(i=y[A])!=null?i:[];M.push(E),y[A]=M,p[A]=p[k],a[k]="";continue}A=k}}for(let k=0;k<l;k++){const E=y[k];E!=null&&(a[k]=Jj(E,a[k]))}let O=0;for(let k=0;k<l;k++){const E=a[k];E.length!==0&&(O!==k&&(a[O]=E,u[O]=u[k],d[O]=d[k],p[O]=p[k]),O++)}a.length=O,u.length=O,d.length=O,p.length=O;const $=(function(k){const E=k.texts.slice(),M=k.isWordLike.slice(),L=k.kinds.slice(),S=k.starts.slice();for(let I=0;I<E.length-1;I++){if(L[I]!=="text"||L[I+1]!=="text"||!er(E[I])||!er(E[I+1]))continue;const P=Kj(E[I]);P!==null&&(E[I]=P.head,E[I+1]=P.tail+E[I+1],S[I+1]=S[I]+P.head.length)}return{len:E.length,texts:E,isWordLike:M,kinds:L,starts:S}})((function(k){const E=[],M=[],L=[],S=[];for(let I=0;I<k.len;I++){const P=k.texts[I],D=k.kinds[I],W=k.isWordLike[I];if(D==="text"&&W&&rS.test(P)){const z=[P];let q=lS.test(P),Q=I+1;for(;q&&Q<k.len&&k.kinds[Q]==="text"&&k.isWordLike[Q]&&rS.test(k.texts[Q]);){const X=k.texts[Q];z.push(X),q=lS.test(X),Q++}E.push(Vo(z)),M.push(!0),L.push("text"),S.push(k.starts[I]),I=Q-1;continue}E.push(P),M.push(W),L.push(D),S.push(k.starts[I])}return{len:E.length,texts:E,isWordLike:M,kinds:L,starts:S}})((function(k){const E=[],M=[],L=[],S=[];for(let I=0;I<k.len;I++){const P=k.texts[I];if(k.kinds[I]==="text"&&P.includes("-")){const D=P.split("-");let W=D.length>1;for(let z=0;z<D.length;z++){const q=D[z];if(!W)break;q.length!==0&&aS(q)&&Ff(q)||(W=!1)}if(W){let z=0;for(let q=0;q<D.length;q++){const Q=D[q],X=q<D.length-1?`${Q}-`:Q;E.push(X),M.push(!0),L.push("text"),S.push(k.starts[I]+z),z+=X.length}continue}}E.push(P),M.push(k.isWordLike[I]),L.push(k.kinds[I]),S.push(k.starts[I])}return{len:E.length,texts:E,isWordLike:M,kinds:L,starts:S}})((function(k){const E=[],M=[],L=[],S=[];for(let I=0;I<k.len;I++){const P=k.texts[I],D=k.kinds[I];if(D==="text"&&Ff(P)&&aS(P)){const W=[P];let z=I+1;for(;z<k.len&&k.kinds[z]==="text"&&Ff(k.texts[z]);)W.push(k.texts[z]),z++;E.push(Vo(W)),M.push(!0),L.push("text"),S.push(k.starts[I]),I=z-1;continue}E.push(P),M.push(k.isWordLike[I]),L.push(D),S.push(k.starts[I])}return{len:E.length,texts:E,isWordLike:M,kinds:L,starts:S}})((function(k){const E=[],M=[],L=[],S=[];for(let I=0;I<k.len;I++){const P=k.texts[I];if(E.push(P),M.push(k.isWordLike[I]),L.push(k.kinds[I]),S.push(k.starts[I]),!sV(P))continue;const D=I+1;if(D>=k.len||Fg(k.kinds[D]))continue;const W=[],z=k.starts[D];let q=D;for(;q<k.len&&!Fg(k.kinds[q]);)W.push(k.texts[q]),q++;W.length>0&&(E.push(Vo(W)),M.push(!0),L.push("text"),S.push(z),I=q-1)}return{len:E.length,texts:E,isWordLike:M,kinds:L,starts:S}})((function(k){const E=k.texts.slice(),M=k.isWordLike.slice(),L=k.kinds.slice(),S=k.starts.slice();for(let P=0;P<k.len;P++){if(L[P]!=="text"||!nV(k,P))continue;const D=[E[P]];let W=P+1;for(;W<k.len&&!Fg(L[W]);){D.push(E[W]),M[P]=!0;const z=E[W].includes("?");if(L[W]="text",E[W]="",W++,z)break}E[P]=Vo(D)}let I=0;for(let P=0;P<E.length;P++){const D=E[P];D.length!==0&&(I!==P&&(E[I]=D,M[I]=M[P],L[I]=L[P],S[I]=S[P]),I++)}return E.length=I,M.length=I,L.length=I,S.length=I,{len:I,texts:E,isWordLike:M,kinds:L,starts:S}})((function(k){const E=[],M=[],L=[],S=[];let I=0;for(;I<k.len;){const P=[k.texts[I]];let D=k.isWordLike[I],W=k.kinds[I],z=k.starts[I];if(W==="glue"){const q=[P[0]],Q=z;for(I++;I<k.len&&k.kinds[I]==="glue";)q.push(k.texts[I]),I++;const X=Vo(q);if(!(I<k.len&&k.kinds[I]==="text")){E.push(X),M.push(!1),L.push("glue"),S.push(Q);continue}P[0]=X,P.push(k.texts[I]),D=k.isWordLike[I],W="text",z=Q,I++}else I++;if(W==="text")for(;I<k.len&&k.kinds[I]==="glue";){const q=[];for(;I<k.len&&k.kinds[I]==="glue";)q.push(k.texts[I]),I++;const Q=Vo(q);I<k.len&&k.kinds[I]==="text"?(P.push(Q,k.texts[I]),D=D||k.isWordLike[I],I++):P.push(Q)}E.push(Vo(P)),M.push(D),L.push(W),S.push(z)}return{len:E.length,texts:E,isWordLike:M,kinds:L,starts:S}})({len:O,texts:a,isWordLike:u,kinds:d,starts:p})))))));for(let k=0;k<$.len-1;k++){const E=Xj($.texts[k]);E!==null&&($.kinds[k]!=="space"&&$.kinds[k]!=="preserved-space"||$.kinds[k+1]!=="text"||!nS($.texts[k+1])||($.texts[k]=E.space,$.isWordLike[k]=!1,$.kinds[k]=$.kinds[k]==="preserved-space"?"preserved-space":"space",$.texts[k+1]=E.marks+$.texts[k+1],$.starts[k+1]=$.starts[k]+E.space.length))}return $}function iV(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const n=[];let s=0;for(let o=0;o<e.len;o++)e.kinds[o]==="hard-break"&&(n.push({startSegmentIndex:s,endSegmentIndex:o,consumedEndSegmentIndex:o+1}),s=o+1);return s<e.len&&n.push({startSegmentIndex:s,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}let wa=null;const uS=new Map;let Sa=null;const rV=new RegExp("\\p{Emoji_Presentation}","u"),lV=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let Hg=null;const dS=new Map;function E1(){if(wa!==null)return wa;if(typeof OffscreenCanvas<"u")return wa=new OffscreenCanvas(1,1).getContext("2d"),wa;if(typeof document<"u")return wa=document.createElement("canvas").getContext("2d"),wa;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Cr(e,t){let n=t.get(e);return n===void 0&&(n={width:E1().measureText(e).width,containsCJK:er(e)},t.set(e,n)),n}function Lh(){if(Sa!==null)return Sa;if(typeof navigator>"u")return Sa={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Sa;const e=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),n=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return Sa={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},Sa}function t3(){return Hg===null&&(Hg=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Hg}function aV(e){return rV.test(e)||e.includes("️")}function Tl(e,t,n){return n===0?t.width:t.width-(function(s,o){return o.emojiCount===void 0&&(o.emojiCount=(function(i){let r=0;const l=t3();for(const a of l.segment(i))aV(a.segment)&&r++;return r})(s)),o.emojiCount})(e,t)*n}function cV(e,t){for(;t<e.widths.length;){const n=e.kinds[t];if(n!=="space"&&n!=="zero-width-break"&&n!=="soft-hyphen")break;t++}return t}function uV(e,t){if(t<=0)return 0;const n=e%t;return Math.abs(n)<=1e-6?t:t-n}function fS(e,t,n){const{widths:s,kinds:o,breakableFitAdvances:i}=e;if(s.length===0)return 0;const r=t+Lh().lineFitEpsilon;let l=0,a=0,c=!1,u=0,d=0,p=-1,h=0;function f(y=u,A=d,O=a){l++,a=0,c=!1,p=-1,h=0}function m(y,A){c=!0,u=y+1,d=0,a=A}function b(y,A,O){c=!0,u=y,d=A+1,a=O}function _(y,A){c?(a+=A,u=y+1,d=0):m(y,A)}function g(y,A){const O=i[y];for(let $=A;$<O.length;$++){const k=O[$];c?a+k>r?(f(),b(y,$,k)):(a+=k,u=y,d=$+1):b(y,$,k)}c&&u===y&&d===O.length&&(u=y+1,d=0)}let v=0;for(;v<s.length&&(c||(v=cV(e,v),!(v>=s.length)));){const y=s[v],A=o[v],O=A==="space"||A==="preserved-space"||A==="tab"||A==="zero-width-break"||A==="soft-hyphen";if(c)if(a+y>r){if(O){_(v,y),f(v+1,0,a-y),v++;continue}if(p>=0){if(u>p||u===p&&d>0){f();continue}f(p,0,h);continue}if(y>t&&i[v]!==null){f(),g(v,0),v++;continue}f()}else _(v,y),O&&(p=v+1,h=a-y),v++;else y>t&&i[v]!==null?g(v,0):m(v,y),O&&(p=v+1,h=a-y),v++}return c&&f(),l}let Wg=null;function dV(e,t){const n=[];let s=[],o=0,i=!1,r=!1,l=!1;function a(){s.length!==0&&(n.push({text:s.length===1?s[0]:s.join(""),start:o}),s=[],i=!1,r=!1,l=!1)}function c(d,p,h){s=[d],o=p,i=h,r=M1(d),l=Nh.has(d)}function u(d,p){s.push(d),i=i||p;const h=M1(d);r=d.length===1&&Kl.has(d)&&r||h,l=!1}for(const d of(Wg===null&&(Wg=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Wg).segment(e)){const p=d.segment,h=er(p);s.length!==0?l||cy.has(p)||Kl.has(p)||t.carryCJKAfterClosingQuote&&h&&r?u(p,h):i||h?(a(),c(p,d.index,h)):u(p,h):c(p,d.index,h)}return a(),n}function fV(e){if(e.length<=1)return e;const t=[];let n=[e[0].text],s=e[0].start,o=er(e[0].text),i=T1(e[0].text);function r(){t.push({text:n.length===1?n[0]:n.join(""),start:s})}for(let l=1;l<e.length;l++){const a=e[l],c=er(a.text),u=T1(a.text);o&&i?(n.push(a.text),o=o||c,i=u):(r(),n=[a.text],s=a.start,o=c,i=u)}return r(),t}function pV(e,t,n,s){const o=Lh(),{cache:i,emojiCorrection:r}=(function($,k){E1().font=$;const E=(function(S){let I=uS.get(S);return I||(I=new Map,uS.set(S,I)),I})($),M=(function(S){const I=S.match(/(\d+(?:\.\d+)?)\s*px/);return I?parseFloat(I[1]):16})($),L=k?(function(S,I){let P=dS.get(S);if(P!==void 0)return P;const D=E1();D.font=S;const W=D.measureText("😀").width;if(P=0,W>I+.5&&typeof document<"u"&&document.body!==null){const z=document.createElement("span");z.style.font=S,z.style.display="inline-block",z.style.visibility="hidden",z.style.position="absolute",z.textContent="😀",document.body.appendChild(z);const q=z.getBoundingClientRect().width;document.body.removeChild(z),W-q>.5&&(P=W-q)}return dS.set(S,P),P})($,M):0;return{cache:E,fontSize:M,emojiCorrection:L}})(t,(l=e.normalized,lV.test(l)));var l;const a=Tl("-",Cr("-",i),r),c=8*Tl(" ",Cr(" ",i),r);if(e.len===0)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const u=[],d=[],p=[],h=[];let f=e.chunks.length<=1;const m=null,b=[],_=n?[]:null,g=Array.from({length:e.len});function v($,k,E,M,L,S,I){L!=="text"&&L!=="space"&&L!=="zero-width-break"&&(f=!1),u.push(k),d.push(E),p.push(M),h.push(L),b.push(I),_!==null&&_.push($)}function y($,k,E,M,L){const S=Cr($,i),I=Tl($,S,r),P=k==="space"||k==="preserved-space"||k==="zero-width-break"?0:I,D=k==="space"||k==="zero-width-break"?0:I;if(L&&M&&$.length>1){let W="sum-graphemes";Ff($)?W="pair-context":o.preferPrefixWidthsForBreakableRuns&&(W="segment-prefixes");const z=(function(q,Q,X,fe,ye){if(Q.breakableFitAdvances!==void 0)return Q.breakableFitAdvances;const Me=t3(),we=[];for(const rt of Me.segment(q))we.push(rt.segment);if(we.length<=1)return Q.breakableFitAdvances=null,Q.breakableFitAdvances;if(ye==="sum-graphemes"){const rt=[];for(const le of we){const U=Cr(le,X);rt.push(Tl(le,U,fe))}return Q.breakableFitAdvances=rt,Q.breakableFitAdvances}if(ye==="pair-context"||we.length>96){const rt=[];let le=null,U=0;for(const G of we){const ne=Tl(G,Cr(G,X),fe);if(le===null)rt.push(ne);else{const H=le+G,J=Cr(H,X);rt.push(Tl(H,J,fe)-U)}le=G,U=ne}return Q.breakableFitAdvances=rt,Q.breakableFitAdvances}const ze=[];let Ue="",Fe=0;for(const rt of we){Ue+=rt;const le=Tl(Ue,Cr(Ue,X),fe);ze.push(le-Fe),Fe=le}return Q.breakableFitAdvances=ze,Q.breakableFitAdvances})($,S,i,r,W);return void v($,I,P,D,k,E,z)}v($,I,P,D,k,E,null)}for(let $=0;$<e.len;$++){g[$]=u.length;const k=e.texts[$],E=e.isWordLike[$],M=e.kinds[$],L=e.starts[$];if(M==="soft-hyphen"){v(k,0,a,a,M,L,null);continue}if(M==="hard-break"){v(k,0,0,0,M,L,null);continue}if(M==="tab"){v(k,0,0,0,M,L,null);continue}const S=Cr(k,i);if(M==="text"&&S.containsCJK){const I=dV(k,o),P=s==="keep-all"?fV(I):I;for(let D=0;D<P.length;D++){const W=P[D];y(W.text,"text",L+W.start,E,s==="keep-all"||!er(W.text))}continue}y(k,M,L,E,!0)}const A=(function($,k,E){const M=[];for(let L=0;L<$.length;L++){const S=$[L],I=S.startSegmentIndex<k.length?k[S.startSegmentIndex]:E,P=S.endSegmentIndex<k.length?k[S.endSegmentIndex]:E,D=S.consumedEndSegmentIndex<k.length?k[S.consumedEndSegmentIndex]:E;M.push({startSegmentIndex:I,endSegmentIndex:P,consumedEndSegmentIndex:D})}return M})(e.chunks,g,u.length),O=m===null?null:(function($,k){const E=(function(L){const S=L.length;if(S===0)return null;const I=new Array(S);let P=!1;for(let X=0;X<S;){const fe=L.charCodeAt(X);let ye=fe,Me=1;if(fe>=55296&&fe<=56319&&X+1<S){const ze=L.charCodeAt(X+1);ze>=56320&&ze<=57343&&(ye=ze-56320+(fe-55296<<10)+65536,Me=2)}const we=Pj(ye);we!=="R"&&we!=="AL"&&we!=="AN"||(P=!0);for(let ze=0;ze<Me;ze++)I[X+ze]=we;X+=Me}if(!P)return null;let D=0;for(let X=0;X<S;X++){const fe=I[X];if(fe==="L"){D=0;break}if(fe==="R"||fe==="AL"){D=1;break}}const W=new Int8Array(S);for(let X=0;X<S;X++)W[X]=D;const z=1&D?"R":"L",q=z;let Q=q;for(let X=0;X<S;X++)I[X]==="NSM"?I[X]=Q:Q=I[X];Q=q;for(let X=0;X<S;X++){const fe=I[X];fe==="EN"?I[X]=Q==="AL"?"AN":"EN":fe!=="R"&&fe!=="L"&&fe!=="AL"||(Q=fe)}for(let X=0;X<S;X++)I[X]==="AL"&&(I[X]="R");for(let X=1;X<S-1;X++)I[X]==="ES"&&I[X-1]==="EN"&&I[X+1]==="EN"&&(I[X]="EN"),I[X]!=="CS"||I[X-1]!=="EN"&&I[X-1]!=="AN"||I[X+1]!==I[X-1]||(I[X]=I[X-1]);for(let X=0;X<S;X++){if(I[X]!=="EN")continue;let fe;for(fe=X-1;fe>=0&&I[fe]==="ET";fe--)I[fe]="EN";for(fe=X+1;fe<S&&I[fe]==="ET";fe++)I[fe]="EN"}for(let X=0;X<S;X++){const fe=I[X];fe!=="WS"&&fe!=="ES"&&fe!=="ET"&&fe!=="CS"||(I[X]="ON")}Q=q;for(let X=0;X<S;X++){const fe=I[X];fe==="EN"?I[X]=Q==="L"?"L":"EN":fe!=="R"&&fe!=="L"||(Q=fe)}for(let X=0;X<S;X++){if(I[X]!=="ON")continue;let fe=X+1;for(;fe<S&&I[fe]==="ON";)fe++;const ye=(X>0?I[X-1]:q)!=="L"?"R":"L";if(ye===((fe<S?I[fe]:q)!=="L"?"R":"L"))for(let Me=X;Me<fe;Me++)I[Me]=ye;X=fe-1}for(let X=0;X<S;X++)I[X]==="ON"&&(I[X]=z);for(let X=0;X<S;X++){const fe=I[X];1&W[X]?fe!=="L"&&fe!=="AN"&&fe!=="EN"||W[X]++:fe==="R"?W[X]++:fe!=="AN"&&fe!=="EN"||(W[X]+=2)}return W})($);if(E===null)return null;const M=new Int8Array(k.length);for(let L=0;L<k.length;L++)M[L]=E[k[L]];return M})(e.normalized,m);return _!==null?{widths:u,lineEndFitAdvances:d,lineEndPaintAdvances:p,kinds:h,simpleLineWalkFastPath:f,segLevels:O,breakableFitAdvances:b,discretionaryHyphenWidth:a,tabStopAdvance:c,chunks:A,segments:_}:{widths:u,lineEndFitAdvances:d,lineEndPaintAdvances:p,kinds:h,simpleLineWalkFastPath:f,segLevels:O,breakableFitAdvances:b,discretionaryHyphenWidth:a,tabStopAdvance:c,chunks:A}}function hV(e,t,n){return(function(s,o,i,r){var l;const a=(l=r?.wordBreak)!=null?l:"normal";return pV((function(c,u,d="normal",p="normal"){const h=(function(b){const _=b??"normal";return _==="pre-wrap"?{mode:_,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:_,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}})(d),f=h.mode==="pre-wrap"?(function(b){return/[\r\f]/.test(b)?b.replace(/\r\n/g,`
|
|
238
238
|
`).replace(/[\r\f]/g,`
|
|
239
239
|
`):b.replace(/\r\n/g,`
|
|
@@ -242,9 +242,9 @@ ${v}`);u+=$}else u+=O;u+=_,d=h?p+1:e.length}return u}function Xz(e,t){if(!e||!t.
|
|
|
242
242
|
`,t-1)+1;return e.slice(n,t).trim()}function SS(e){const t=i3(e);return t.length>=2&&t.every(n=>{const s=n.trim();return s.length>=1&&s.replace(/^:/,"").replace(/:$/,"").split("").every(o=>o==="-")})}function i3(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function r3(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function fy(e){const t=String(e??"");return`${t.length}:${r3(t)}`}function I1(e,t=new WeakMap,n=0){if(e==null||typeof e=="number"||typeof e=="boolean")return String(e);if(typeof e=="string")return`s:${(function(r){return r.length<=8192?fy(r):`${r.length}:${r3(r.slice(0,8192))}:truncated`})(e)}`;if(typeof e=="function")return`fn:${Xo(e)}`;if(typeof e!="object")return typeof e;const s=e,o=t.get(s);if(o)return`cycle:${o}`;if(n>=6)return`object:${Xo(s)}`;const i=Xo(s);if(t.set(s,i),Array.isArray(e)){const r=e.slice(0,200);return`a:${e.length}:${r.map(l=>I1(l,t,n+1)).join(",")}`}if(typeof e=="object"){const r=e,l=Object.keys(r).sort(),a=l.slice(0,80);return`o:${l.length}:${a.sort().map(c=>`${c}:${I1(r[c],t,n+1)}`).join(";")}`}return typeof e}function Bp(e){return typeof e=="object"&&e!==null&&typeof e.type=="string"&&typeof e.raw=="string"}function l3(e,t=new WeakMap,n=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(s=>Bp(s)?Jr(s,t,n+1):l3(s,t,n+1)).join(",")}`:Bp(e)?Jr(e,t,n):I1(e,t,n)}function CV(e,t,n){return Object.keys(e).sort().filter(s=>s!=="children"&&!o3.includes(s)).map(s=>{const o=e[s];return typeof o=="string"?`${s}=s:${fy(o)}`:typeof o=="number"||typeof o=="boolean"||o==null?`${s}=${String(o)}`:typeof o=="function"?`${s}=fn:${Xo(o)}`:wV.has(s)&&(Array.isArray(o)||typeof o=="object")?`${s}=${l3(o,t,n+1)}`:o&&typeof o=="object"?`${s}=object:${Xo(o)}`:""}).filter(Boolean).join(";")}function xV(e){return o3.map(t=>{const n=e[t];return typeof n=="string"?`${t}=s:${fy(n)}`:""}).filter(Boolean).join(";")}function Jr(e,t=new WeakMap,n=0){const s=kS.get(e);if(s)return s;const o=e,i=t.get(o);if(i)return`node-cycle:${i}`;if(n>=6)return`node:${e.type}:${Xo(o)}`;const r=Xo(o);t.set(o,r);const l=(function(a,c,u){const d=a,p=Array.isArray(d.children)?d.children:[],h=p.length?p.slice(0,200).map(f=>Jr(f,c,u+1)).join("|"):"";return[a.type,xV(d),CV(d,c,u),p.length,h].join(":")})(e,t,n);return kS.set(o,l),l}function a3(e,t){return Jr(e)===Jr(t)}function py(e,t,n){const s=ai(),o=t==="stabilizeSignatureMs"?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return n()}finally{e[t]+=ai()-s,e[o]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function CS(e,t,n){return py(t,n,()=>Jr(e))}function c3(e,t,n){return CS(e,n,"stabilizeSignatureMs")===CS(t,n,"stabilizeSignatureMs")}function Vg(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function xS(e,t,n){return e<0?0:Math.max(t.length,n.length)-e}function AV(e,t){return e.length===t.length&&e===t}function hy(e,t,n=0){if(n>=4)return null;if(e.type!==t.type)return!1;const s=e,o=t,i=Object.keys(s).filter(u=>u!=="type"&&u!=="children").sort(),r=Object.keys(o).filter(u=>u!=="type"&&u!=="children").sort();if(i.length!==r.length)return!1;for(let u=0;u<i.length;u++){const d=i[u];if(d!==r[u])return!1;const p=s[d],h=o[d];if(typeof p!=typeof h)return!1;if(typeof p!="string"){if(typeof p!="number"&&typeof p!="boolean"&&p!=null)return null;if(!Object.is(p,h))return!1}else if(typeof h!="string"||!AV(p,h))return!1}const l=Object.prototype.hasOwnProperty.call(s,"children");if(l!==Object.prototype.hasOwnProperty.call(o,"children"))return!1;if(!l)return!0;const a=s.children,c=o.children;if(!Array.isArray(a)||!Array.isArray(c))return null;if(a.length!==c.length)return!1;for(let u=0;u<a.length;u++){const d=a[u],p=c[u];if(!Bp(d)||!Bp(p))return null;const h=hy(d,p,n+1);if(h==null)return null;if(!h)return!1}return!0}function TV(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e.type!==t.type)return!1;const n=hy(e,t);return n??a3(e,t)}function MV(e,t,n){if(!e||!t)return!1;if(e===t)return!0;if(e.type!==t.type)return!1;let s=null;return py(n,"stabilizeSignatureMs",()=>{s=hy(e,t)}),s??c3(e,t,n)}function EV(e,t){const n={};for(const s of bV){const o=e[s],i=t?.[s];typeof o=="number"&&(n[s]=o-(typeof i=="number"?i:0))}return n}function IV(e,t){var n;const s=E2(t.instanceMsgId),o=new Map,i=(n=t.smoothStreamingEnabled)!=null?n:F(()=>!1),r=Z(t.renderContent.value);let l,a=[],c="",u="",d="",p=0,h=0,f=ai();function m(){l&&(clearTimeout(l),l=void 0)}function b(){m();const E=t.renderContent.value;r.value!==E&&(r.value=E),f=ai()}Ke([t.renderContent,t.effectiveFinal,i],([E,M,L])=>{r.value!==E&&(!L||M||(function(S,I){if(!S&&I||I.length<=80||I.length<S.length||!I.startsWith(S))return!0;const P=I.slice(S.length);return!!P&&(!!SS(wS(I))||!(!P.includes(`
|
|
243
243
|
|
|
244
244
|
`)&&!/(?:^|\n)(?:#{1,6}\s|[-+*]\s+|\d+[.)]\s+|>\s*|`{3,}|~{3,})/.test(P))||P.endsWith(`
|
|
245
|
-
`)&&!(function(D){const W=wS(D);if(SS(W))return!1;const z=i3(W);return z.length>=2&&z.some(q=>q.trim())})(I))})(r.value,E)?b():(function(){if(h+=1,l)return;const S=Math.max(0,(function(I){const P=I.parseCoalesceMs;return typeof P=="number"&&Number.isFinite(P)&&P>=0?P:80})(e)-(ai()-f));S<=0?b():l=setTimeout(b,S)})())},{flush:"sync",immediate:!0}),K1(m);const _=F(()=>{var E,M,L,S;return Y9(e.customHtmlTags,(E=e.parseOptions)==null?void 0:E.customHtmlTags,(S=(L=(M=t.customComponentsMap)==null?void 0:M.value)!=null?L:{},Object.entries(S).map(([I,P])=>{const D=si(I);return P==null||!D||dd(D)||RT.has(D)||ad.has(D)?"":D}).filter(Boolean)))}),g=F(()=>{const{key:E,tags:M}=X9(_.value);if(!E)return s;const L=o.get(E);if(L)return L;const S=E2(t.instanceMsgId,{customHtmlTags:M});return o.set(E,S),S}),v=F(()=>{const E=g.value;return e.customMarkdownIt?e.customMarkdownIt(E):E}),y=F(()=>{var E,M;const L=(E=e.parseOptions)!=null?E:{},S=t.effectiveFinal.value,I=_.value,P=S!=null,D=I.length>0;return P||D||L.streamParse==null?it(it(Lt(it({},L),{streamParse:(M=L.streamParse)==null||M}),P?{final:S}:{}),D?{customHtmlTags:I}:{}):L}),A=F(()=>{var E;return new Set(((E=y.value.customHtmlTags)!=null?E:[]).map(M=>String(M).trim().toLowerCase()).filter(Boolean))}),O=F(()=>_S(y.value,v.value,e.customMarkdownIt,{includeFinal:!0})),$=F(()=>_S(y.value,v.value,e.customMarkdownIt,{includeFinal:!1}));Ke([O,$],([E,M],[L,S])=>{L&&(E===L&&M===S||(b(),M!==S&&(a=[],d="")))},{flush:"sync"});const k=F(()=>{var E,M,L,S,I,P,D,W;if((E=e.nodes)!=null&&E.length)return a=[],d="",Dr(e.nodes.slice());const z=r.value;if(!z)return a=[],d="",[];const q=t.debugPerformanceEnabled.value,Q=q?ai():0,X=v.value,fe=O.value,ye=$.value;c&&fe!==c&&(function(ce){var te,ue;(ue=(te=ce.stream)==null?void 0:te.reset)==null||ue.call(te)})(X),u&&ye!==u&&(a=[],d="");const Me=a.length>0&&z.startsWith(d)&&ye===u,we=q?bS(X):null,ze=q?{}:void 0,Ue=ze?Lt(it({},y.value),{__timing:ze}):y.value,Fe=CM(z,X,Ue),rt=q?ai():0,le=q?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let U,G=q?Vg(Fe.length):void 0,ne=0,H=0;if(Me){const ce=q?ai():0;if(le){const te=(function(ue,j,Y){if(!j.length)return{nodes:ue,metrics:Vg(ue.length)};const re=(function(Ie,ae,Te){const Ve=Math.min(Ie.length,ae.length);for(let tt=0;tt<Ve;tt++)if(!MV(ae[tt],Ie[tt],Te))return tt;return Ie.length===ae.length?-1:Ve})(ue,j,Y);if(re<0)return{nodes:j,metrics:{reusedNodeCount:ue.length,dirtyStartIndex:re,stablePrefixNodeCount:ue.length,dirtyTailNodeCount:0}};const ge=ue.slice();let Ae=re;for(let Ie=0;Ie<re;Ie++)ge[Ie]=j[Ie];for(let Ie=re;Ie<ue.length;Ie++){const ae=j[Ie],Te=ue[Ie];ae&&c3(ae,Te,Y)&&(ge[Ie]=ae,Ae+=1)}return{nodes:ge,metrics:{reusedNodeCount:Ae,dirtyStartIndex:re,stablePrefixNodeCount:re,dirtyTailNodeCount:xS(re,ue,j)}}})(Fe,a,le);U=te.nodes,G=te.metrics}else{const te=(function(ue,j){if(!j.length)return{nodes:ue,metrics:Vg(ue.length)};const Y=(function(Ae,Ie){const ae=Math.min(Ae.length,Ie.length);for(let Te=0;Te<ae;Te++)if(!TV(Ie[Te],Ae[Te]))return Te;return Ae.length===Ie.length?-1:ae})(ue,j);if(Y<0)return{nodes:j,metrics:{reusedNodeCount:ue.length,dirtyStartIndex:Y,stablePrefixNodeCount:ue.length,dirtyTailNodeCount:0}};const re=ue.slice();let ge=Y;for(let Ae=0;Ae<Y;Ae++)re[Ae]=j[Ae];for(let Ae=Y;Ae<ue.length;Ae++){const Ie=j[Ae],ae=ue[Ae];Ie&&a3(Ie,ae)&&(re[Ae]=Ie,ge+=1)}return{nodes:re,metrics:{reusedNodeCount:ge,dirtyStartIndex:Y,stablePrefixNodeCount:Y,dirtyTailNodeCount:xS(Y,ue,j)}}})(Fe,a);U=te.nodes,G=te.metrics}ne=q?ai()-ce:0,H=G?.dirtyStartIndex==null||G.dirtyStartIndex<0?U.length:G.dirtyStartIndex}else U=Fe;le?(function(ce,te,ue=0){for(let j=Math.max(0,ue);j<ce.length;j++)py(te,"primeSignatureMs",()=>Jr(ce[j]))})(U,le,H):(function(ce,te=0){for(let ue=Math.max(0,te);ue<ce.length;ue++)Jr(ce[ue])})(U,H);const J=q?ai()-rt:0;if(p+=1,d=z,c=fe,u=ye,a=U,q){const ce=bS(X),te=typeof ce?.total=="number"&&ce.total>((M=we?.total)!=null?M:0);t.logPerf(te?"parse(stream)":"parse(sync)",it(it(it({rendererId:t.instanceMsgId,ms:Math.round(ai()-Q),nodes:U.length,contentLength:z.length,parseCommitCount:p,parseCoalescedCount:h,nodeReuseMs:J,signatureMs:(L=le?.signatureMs)!=null?L:0,stabilizeSignatureMs:(S=le?.stabilizeSignatureMs)!=null?S:0,primeSignatureMs:(I=le?.primeSignatureMs)!=null?I:0,signatureCallCount:(P=le?.signatureCallCount)!=null?P:0,stabilizeSignatureCallCount:(D=le?.stabilizeSignatureCallCount)!=null?D:0,primeSignatureCallCount:(W=le?.primeSignatureCallCount)!=null?W:0,stabilizeMs:ne},G??{}),ze?Object.fromEntries(_V.map(ue=>{var j;return[ue,(j=ze[ue])!=null?j:0]})):{}),ce?{streamMode:ce.lastMode,streamDelta:EV(ce,we),streamStats:ce}:{}))}return Dr(U)});return{effectiveCustomHtmlTags:_,effectiveCustomHtmlTagsSet:A,mdBase:g,mdInstance:v,mergedParseOptions:y,parsedNodes:k}}function $V(e){const{isClient:t}=e,n=Z(new Set),s=new Map,o=new Map,i=new Map;function r(c){if(!t)return;const u=i.get(c);u!=null&&(window.clearTimeout(u),i.delete(c))}function l(){if(t)for(const c of i.values())window.clearTimeout(c);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:s,nodeVisibilityWatchStops:o,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(c,u=!0){var d;u&&r(c),(function(p,h){if((m=(f=e.shouldTrackVisibleNodeIndices)==null?void 0:f.call(e))!=null&&!m)return;var f,m;const b=n.value,_=b.has(p);if(h){if(_)return;const v=new Set(b);return v.add(p),void(n.value=v)}if(!_)return;const g=new Set(b);g.delete(p),n.value=g})(c,u),u&&((d=e.onNodeMarkedVisible)==null||d.call(e,c))},resetNodeVisibleState:a,cleanupNodeVisibility:function(c){var u;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[p,h]of o.entries())p<c||(h(),o.delete(p));for(const[p,h]of s.entries())p<c||(h.destroy(),s.delete(p),r(p),(u=e.onNodeVisibilityCleaned)==null||u.call(e,p));for(const p of Array.from(i.keys()))p<c||r(p);if(!n.value.size)return;const d=new Set;for(const p of n.value)p<c&&d.add(p);n.value=d},destroyNodeVisibilityState:function(){a();for(const c of o.values())c();o.clear();for(const c of s.values())c.destroy();s.clear(),l()}}}function NV(e={}){const t=Z(""),n=Z(""),s=Z(!1),o=LU(e),i=()=>{const u=o.getSnapshot();t.value=u.source,n.value=u.visible,s.value=u.done},r=o.subscribe(i);i();const l=F(()=>Math.max(0,t.value.length-n.value.length)),a=F(()=>l.value===0),c=F(()=>s.value&&a.value);return V1()&&K1(()=>{r(),o.destroy()}),{source:t,visible:n,done:s,final:c,caughtUp:a,pendingChars:l,enqueue:u=>o.enqueue(u),finish:u=>o.finish(u),flush:()=>o.flush(),reset:u=>o.reset(u),pause:()=>o.pause(),resume:()=>o.resume()}}const AS=/auto|scroll|overlay/i;function LV(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return AS.test(t)||AS.test(n)}function OV(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const PV=je({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=F(()=>{var n,s;return g1((s=Ha(e.estimatedPreviewHeightPx))!=null?s:h1(String((n=e.node.code)!=null?n:"")))});return()=>cn("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?cn("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[cn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[cn("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),cn("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),cn("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>cn("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,cn("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[cn("div",{class:"absolute inset-0"},[cn("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),RV=je({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=F(()=>{var n,s;return m1((s=Ha(e.estimatedPreviewHeightPx))!=null?s:p1(String((n=e.node.code)!=null?n:"")))});return()=>cn("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?cn("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[cn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[cn("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),cn("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>cn("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[cn("span",{class:"action-icon block"})])))]):null,cn("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[cn("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}),DV=["data-custom-id"],BV={class:"m-0 p-0"},FV=["data-probe"],HV=["data-node-index","data-node-type"],u3=un(je(Lt(it({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},htmlPolicy:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const s=e,o=n,i=Ls(),r=Ut("markstreamNestedRendererProps",void 0);function l(C){var B,V;const K=s[C];return(function(ee){const he=i?.vnode.props;return!!he&&(Object.prototype.hasOwnProperty.call(he,ee)||Object.prototype.hasOwnProperty.call(he,String(ee).replace(/[A-Z]/g,ke=>`-${ke.toLowerCase()}`)))})(C)?K:(V=(B=r?.value)==null?void 0:B[C])!=null?V:K}const a={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}},c=F(()=>{return(C=l("mode"))==="chat"||C==="minimal"||C==="docs"?C:"docs";var C}),u=F(()=>{const C=l("renderCodeBlocksAsPre"),B=l("codeRenderer");return C===!0?"pre":B==="pre"||B==="shiki"||B==="monaco"?B:C===!1||c.value==="docs"?"monaco":"pre"}),d=F(()=>a[c.value]),p=F(()=>{var C;return(C=l("showTooltips"))!=null?C:d.value.showTooltips}),h=F(()=>{var C;return(C=l("fade"))!=null?C:d.value.fade}),f=F(()=>{var C;return(C=l("batchRendering"))!=null?C:d.value.batchRendering}),m=F(()=>{var C;return(C=l("initialRenderBatchSize"))!=null?C:d.value.initialRenderBatchSize}),b=F(()=>{var C;return(C=l("renderBatchSize"))!=null?C:d.value.renderBatchSize}),_=F(()=>{var C;return(C=l("renderBatchDelay"))!=null?C:d.value.renderBatchDelay}),g=F(()=>{var C;return(C=l("renderBatchBudgetMs"))!=null?C:d.value.renderBatchBudgetMs}),v=F(()=>{var C;return(C=l("renderBatchIdleTimeoutMs"))!=null?C:d.value.renderBatchIdleTimeoutMs}),y=F(()=>{var C;return(C=l("deferNodesUntilVisible"))!=null?C:d.value.deferNodesUntilVisible}),A=F(()=>{var C;return(C=l("maxLiveNodes"))!=null?C:d.value.maxLiveNodes}),O=F(()=>{var C;return(C=l("liveNodeBuffer"))!=null?C:d.value.liveNodeBuffer}),$=F(()=>{var C;return(C=l("nodeVirtual"))!=null?C:d.value.nodeVirtual}),k={get content(){return s.content},get nodes(){return s.nodes},get final(){return s.final},get parseOptions(){return l("parseOptions")},get customMarkdownIt(){return l("customMarkdownIt")},get debugPerformance(){return s.debugPerformance},get customHtmlTags(){return l("customHtmlTags")},get mode(){return l("mode")},get htmlPolicy(){return l("htmlPolicy")},get viewportPriority(){return l("viewportPriority")},get codeBlockStream(){return l("codeBlockStream")},get codeBlockDarkTheme(){return l("codeBlockDarkTheme")},get codeBlockLightTheme(){return l("codeBlockLightTheme")},get codeBlockMonacoOptions(){return l("codeBlockMonacoOptions")},get codeRenderer(){return l("codeRenderer")},get renderCodeBlocksAsPre(){return l("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return l("codeBlockMinWidth")},get codeBlockMaxWidth(){return l("codeBlockMaxWidth")},get codeBlockProps(){return l("codeBlockProps")},get mermaidProps(){return l("mermaidProps")},get d2Props(){return l("d2Props")},get infographicProps(){return l("infographicProps")},get showTooltips(){return p.value},get themes(){return l("themes")},get langs(){return l("langs")},get isDark(){return l("isDark")},get customId(){return l("customId")},get indexKey(){return s.indexKey},get typewriter(){return l("typewriter")},get smoothStreaming(){return s.smoothStreaming},get smoothStreamingOptions(){return l("smoothStreamingOptions")},get parseCoalesceMs(){return l("parseCoalesceMs")},get fade(){return h.value},get batchRendering(){return f.value},get initialRenderBatchSize(){return m.value},get renderBatchSize(){return b.value},get renderBatchDelay(){return _.value},get renderBatchBudgetMs(){return g.value},get renderBatchIdleTimeoutMs(){return v.value},get deferNodesUntilVisible(){return y.value},get maxLiveNodes(){return A.value},get liveNodeBuffer(){return O.value},get nodeVirtual(){return $.value},get virtualScroll(){return s.virtualScroll},get renderAsFragment(){return s.renderAsFragment}};function E(C){o("height-change",C)}function M(C){o("virtual-state-change",C)}function L(C){o("anchor-change",C)}const S=Z(),I=Z(null),P=Z(null),D=Z(null),W=$s({1:null,2:null,3:null,4:null,5:null,6:null}),z=Z(!1),q=new Map,Q=Z(0),X=Z(0),fe=Z({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function ye(){var C,B;if(((C=s.virtualScroll)==null?void 0:C.enabled)!==!0)return null;const V=(B=s.virtualScroll)==null?void 0:B.scrollRoot;return Me(typeof V=="function"?V():V)}function Me(C){return C?typeof HTMLElement<"u"&&C instanceof HTMLElement?C:typeof C=="object"&&"value"in C?Me(C.value):typeof C=="object"&&"$el"in C?Me(C.$el):null:null}const{isClient:we,renderAsFragment:ze,debugPerformanceEnabled:Ue,resolvedShowTooltips:Fe,resolvedHtmlPolicy:rt,inheritedSmoothStreaming:le,ownsTypewriterCursor:U}=(function(C){const B=typeof window<"u",V=nd(),K=Ut("markstreamHtmlPolicy",void 0),ee=Ut("markstreamTypewriterCursor",void 0),he=Ut("markstreamSmoothStreaming",void 0),ke=F(()=>C.renderAsFragment===!0),Se=F(()=>!!(C.debugPerformance&&B&&typeof console<"u")),Pe=F(()=>{var De;if(typeof C.showTooltips=="boolean")return C.showTooltips;const $e=(De=V.showTooltips)!=null?De:V["show-tooltips"];return $e===""||$e===!0||$e==="true"||$e!==!1&&$e!=="false"&&void 0}),Ee=F(()=>{var De,$e;return($e=(De=C.htmlPolicy)!=null?De:K?.value)!=null?$e:"safe"}),We=F(()=>ee?.value!==!0);return{isClient:B,renderAsFragment:ke,debugPerformanceEnabled:Se,resolvedShowTooltips:Pe,resolvedHtmlPolicy:Ee,inheritedSmoothStreaming:he,inheritedTypewriterCursor:ee,ownsTypewriterCursor:We}})(k),{resolveViewportRoot:G,resolveScrollContainer:ne,isReverseFlexScrollRoot:H,getNormalizedScrollTop:J,getOffsetTopWithinRoot:ce}=(function(C,B){function V(){var Se,Pe;return(Pe=(Se=B.scrollRoot)==null?void 0:Se.call(B))!=null?Pe:null}function K(Se){if(typeof window>"u")return null;const Pe=V();if(Pe)return Pe;const Ee=Se??C.value;if(!Ee)return null;const We=Ee.ownerDocument||document,De=We.scrollingElement||We.documentElement;let $e=Ee;for(;$e&&$e!==We.body&&$e!==De;){if(LV(window.getComputedStyle($e))&&OV($e))return $e;$e=$e.parentElement}return null}function ee(Se){if(!B.isClient)return!1;try{const Pe=window.getComputedStyle(Se);return!!(Pe.display||"").toLowerCase().includes("flex")&&(Pe.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function he(Se,Pe,Ee){var We,De;if(Ee)return ke(Pe);const $e=Se.scrollTop;if(!ee(Se))return $e;const He=$e<0?-$e:$e;return Math.max(0,((We=Se.scrollHeight)!=null?We:0)-((De=Se.clientHeight)!=null?De:0))-He}function ke(Se){var Pe,Ee,We,De,$e;const He=Number((Pe=Se.scrollingElement)==null?void 0:Pe.scrollTop),Qe=Number((We=(Ee=Se.documentElement)==null?void 0:Ee.scrollTop)!=null?We:0),Ze=Number(($e=(De=Se.body)==null?void 0:De.scrollTop)!=null?$e:0);return Math.max(0,Number.isFinite(He)?He:0,Number.isFinite(Qe)?Qe:0,Number.isFinite(Ze)?Ze:0)}return{resolveViewportRoot:K,resolveScrollContainer:function(Se){var Pe,Ee,We,De;const $e=V();if($e)return $e;const He=K((Pe=Se??C.value)!=null?Pe:null);if(He)return He;const Qe=(De=(We=Se?.ownerDocument)!=null?We:(Ee=C.value)==null?void 0:Ee.ownerDocument)!=null?De:typeof document<"u"?document:null;return Qe?.scrollingElement||Qe?.documentElement||null},isReverseFlexScrollRoot:ee,getNormalizedScrollTop:he,getOffsetTopWithinRoot:function(Se,Pe){const Ee=Pe.ownerDocument||Se.ownerDocument||document;if((function(He,Qe){return He===Qe.documentElement||He===Qe.body||He===Qe.scrollingElement})(Pe,Ee))return Se.getBoundingClientRect().top+ke(Ee);const We=Pe.getBoundingClientRect(),De=Se.getBoundingClientRect(),$e=he(Pe,Ee,!1);return De.top-We.top+$e}}})(S,{isClient:we,scrollRoot:ye});En("markstreamShowTooltips",Fe),En("markstreamHtmlPolicy",rt),En("markstreamTypewriter",F(()=>k.typewriter!==!1)),En("markstreamFade",F(()=>k.fade!==!1)),En("markstreamTypewriterCursor",F(()=>!0)),En("markstreamTextStreamState",q),En("markstreamStreamVersion",Q),En("markstreamParseOptions",F(()=>k.parseOptions)),En("markstreamCustomMarkdownIt",F(()=>k.customMarkdownIt));const{smoothStreamingEnabled:te,renderContent:ue,effectiveFinal:j}=(function(C,B){const V=NV(C.smoothStreamingOptions),K=F(()=>{var Ee,We,De;return C.smoothStreaming!==!1&&!((Ee=C.nodes)!=null&&Ee.length)&&(C.smoothStreaming===!0||!((We=B.inheritedSmoothStreaming)!=null&&We.value))&&(C.smoothStreaming===!0||C.typewriter===!0||((De=C.maxLiveNodes)!=null?De:0)<=0)}),ee=Z(!B.isClient||C.smoothStreaming===!0);hn(()=>{ee.value=!0});const he=F(()=>ee.value&&K.value),ke=F(()=>{var Ee;return he.value?V.visible.value:(Ee=C.content)!=null?Ee:""}),Se=F(()=>{var Ee,We;const De=(Ee=C.parseOptions)!=null?Ee:{};return(We=C.final)!=null?We:De.final}),Pe=F(()=>{const Ee=Se.value;return he.value&&Ee!=null?!!Ee&&V.caughtUp.value:Ee});return Ke([()=>C.content,()=>C.nodes,he,Se],([Ee,We,De,$e])=>{if(We?.length)return void V.reset("");const He=Ee??"";if(!De)return V.reset(He),void($e&&V.finish({flush:!0}));const Qe=V.source.value;He?He===Qe||(He.startsWith(Qe)?V.enqueue(He.slice(Qe.length)):V.reset(He)):V.reset(""),$e&&V.finish()},{immediate:!0}),{smoothStream:V,smoothStreamingEligible:K,smoothStreamingEnabled:he,renderContent:ke,requestedFinal:Se,effectiveFinal:Pe}})(k,{isClient:we,inheritedSmoothStreaming:le});En("markstreamSmoothStreaming",te);const Y=Z(!1);let re="",ge=!1,Ae=null;function Ie(){we&&Ae!=null&&(window.clearTimeout(Ae),Ae=null)}function ae(){Y.value=!1,Ie()}function Te(C,B){if(!Ue.value)return;const V=(function(){if(!Ue.value)return null;const K=Tt(Ve),ee=Tt(tt),he=Math.max(kt,ee);if(K<=0&&he<=0)return null;const ke={total:K,maxPerFrame:he,byLabel:(Se=Ve,Object.fromEntries(Array.from(Se.entries()).sort((Pe,Ee)=>Ee[1]-Pe[1]||Pe[0].localeCompare(Ee[0]))))};var Se;return Ve.clear(),tt.clear(),kt=0,ke})();console.info(`[markstream-vue][perf] ${C}`,V?Lt(it({},B),{layoutReads:V}):B)}Ke([ue,()=>s.nodes,j],([C,B,V])=>{const K=C??"";return B?.length||V===!0?(ae(),re=K,void(ge=!0)):ge?(re&&K.length>re.length&&K.startsWith(re)?(Y.value=!0,we&&(Ie(),Ae=window.setTimeout(()=>{var ee;Ae=null,j.value===!0||(ee=s.nodes)!=null&&ee.length||(fa(),Y.value=!1,Pi())},1200))):(K.length<re.length||!K.startsWith(re))&&ae(),void(re=K)):(re=K,void(ge=!0))},{flush:"sync",immediate:!0});const Ve=new Map,tt=new Map;let bt=!1,kt=0;function Tt(C){let B=0;for(const V of C.values())B+=V;return B}function Pt(){kt=Math.max(kt,Tt(tt)),tt.clear(),bt=!1}function mt(C,B){return(function(V){var K,ee;Ue.value&&(Ve.set(V,((K=Ve.get(V))!=null?K:0)+1),tt.set(V,((ee=tt.get(V))!=null?ee:0)+1),bt||(bt=!0,we&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(Pt):typeof queueMicrotask!="function"?setTimeout(Pt,0):queueMicrotask(Pt)))})(C),B()}const Yt=k.customId?`renderer-${k.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Rn=(function(C){const B=new Map;return{scope:C,cache:B,clear:()=>B.clear()}})(Yt),Dn=F(()=>`${Yt}:${Q.value}`);En(s3,Rn);const Ft=cs(()=>k.customId),{effectiveCustomHtmlTagsSet:bn,mergedParseOptions:Vn,parsedNodes:st}=IV(k,{instanceMsgId:Yt,renderContent:ue,effectiveFinal:j,smoothStreamingEnabled:te,debugPerformanceEnabled:Ue,customComponentsMap:Ft,logPerf:Te});Ke(st,()=>{Rn.clear(),Q.value+=1},{immediate:!0});const In=F(()=>({customId:k.customId,customHtmlTags:Vn.value.customHtmlTags,parseOptions:k.parseOptions,customMarkdownIt:k.customMarkdownIt,htmlPolicy:rt.value,viewportPriority:k.viewportPriority,mode:c.value,codeRenderer:u.value,codeBlockStream:k.codeBlockStream,codeBlockDarkTheme:k.codeBlockDarkTheme,codeBlockLightTheme:k.codeBlockLightTheme,codeBlockMonacoOptions:k.codeBlockMonacoOptions,renderCodeBlocksAsPre:k.renderCodeBlocksAsPre,codeBlockMinWidth:k.codeBlockMinWidth,codeBlockMaxWidth:k.codeBlockMaxWidth,codeBlockProps:k.codeBlockProps,mermaidProps:k.mermaidProps,d2Props:k.d2Props,infographicProps:k.infographicProps,showTooltips:Fe.value,themes:k.themes,langs:k.langs,isDark:k.isDark,typewriter:k.typewriter,smoothStreamingOptions:k.smoothStreamingOptions,parseCoalesceMs:k.parseCoalesceMs,fade:k.fade}));En("markstreamNestedRendererProps",In);const _n=F(()=>st.value),Kn=F(()=>st.value.length),$n=Z(null),Ge=Z(null),Ye=Z(null),Ct=Z(null),$t=s.indexKey!=null&&String(s.indexKey).startsWith("list-item-"),mn=!$t&&k.customId?hS(k.customId):null,Nn=F(()=>mn?(pS.value,hS(k.customId)):null),tn=F(()=>{var C;return!!(we&&!ze.value&&k.customId&&!$t&&((C=Nn.value)!=null&&C.enabled))}),Ln=F(()=>{var C;return!!(!ze.value&&((C=s.virtualScroll)!=null&&C.enabled))}),Zn=Z(!1);hn(()=>{Zn.value=!0});const Mt=F(()=>!!(we&&Ln.value));En("markstreamHostScrollManaged",Mt);const us=F(()=>!!(Zn.value&&Mt.value)),Xt=F(()=>tn.value||Mt.value),oi=F(()=>tn.value||us.value),bs=F(()=>{var C;return Xt.value&&((C=Nn.value)==null?void 0:C.textEstimation)!==!1}),Do=F(()=>{var C;return Xt.value&&((C=Nn.value)==null?void 0:C.codeBlockEstimation)!==!1});function so(){const C=X.value||mt("getMeasuredContainerWidth.clientWidth",()=>{var B;return((B=S.value)==null?void 0:B.clientWidth)||0});return Number.isFinite(C)&&C>0?C:0}const qs=F(()=>{const C=so();return C>0?Math.max(1,Math.round(C)):640}),oo=F(()=>{var C;return Math.max(1,(C=k.maxLiveNodes)!=null?C:320)}),Nt=F(()=>{var C;return!ze.value&&k.nodeVirtual!==!1&&!(((C=k.maxLiveNodes)!=null?C:0)<=0)&&(k.nodeVirtual===!0?st.value.length>0:st.value.length>oo.value)}),Xe=F(()=>Nt.value||tn.value||Mt.value),ot=F(()=>k.viewportPriority!==!1&&!z.value),de=yj(C=>{var B;return G((B=C??S.value)!=null?B:null)},ot),{requestFrame:pe,cancelFrame:Oe,hasIdleCallback:Qt,isTestEnv:Wt}=(function(C){const B=C.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,V=C.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,K=C.isClient&&typeof window.requestIdleCallback=="function",ee=(function(){var he;if(typeof globalThis>"u"||!("process"in globalThis))return;const ke=(he=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:he.value;return ke?.env})();return{requestFrame:B,cancelFrame:V,hasIdleCallback:K,isTestEnv:ee?.NODE_ENV==="test"}})({isClient:we}),{resolvedBatchSize:ds,resolvedInitialBatch:Bn,batchingEnabled:bo,incrementalRenderingActive:ii,renderedCount:_s,previousRenderContext:ta,adaptiveBatchSize:ll,previousBatchConfig:al}=(function(C,B){var V;const K=F(()=>{var De;const $e=Math.trunc((De=C.renderBatchSize)!=null?De:80);return Number.isFinite($e)?Math.max(0,$e):0}),ee=F(()=>{var De;const $e=Math.trunc((De=C.initialRenderBatchSize)!=null?De:K.value);return Number.isFinite($e)?Math.max(0,$e):K.value}),he=F(()=>!B.renderAsFragment.value&&C.batchRendering!==!1&&K.value>0&&B.isClient&&!B.isTestEnv),ke=Z(0),Se=Z({key:C.indexKey,total:0}),Pe=Z(Math.max(1,K.value||1)),Ee=F(()=>{var De;return he.value&&((De=C.maxLiveNodes)!=null?De:0)<=0}),We=Z({batchSize:K.value,initial:ee.value,delay:(V=C.renderBatchDelay)!=null?V:16,enabled:Ee.value});return{resolvedBatchSize:K,resolvedInitialBatch:ee,batchingEnabled:he,incrementalRenderingActive:Ee,renderedCount:ke,previousRenderContext:Se,adaptiveBatchSize:Pe,previousBatchConfig:We}})(k,{isClient:we,isTestEnv:Wt,renderAsFragment:ze}),Os=new Map,ft=new Map,me=new WeakMap;let Ne=null;const xn=new WeakMap,ws=new Map,se=Z(0),Ce=F(()=>(se.value,Array.from(Os.entries()).sort((C,B)=>C[0]-B[0]))),xe=Z(null),Be=Z(null);let et=null,at=0,Ot=null;const{activeRestoreAnchor:Vt,getRelativeScrollTopWithinContainer:qt,setRelativeScrollTopWithinContainer:Bo,resolveAnchorOffset:Fo,clearRestoreReconcile:nn,scheduleRestoreReconcile:Jn,captureRestoreAnchor:Fn,restoreAnchor:Ss,getAnchorDrift:Ps}=(function(C){const{isClient:B,containerRef:V,parsedNodeCount:K,requestFrame:ee,cancelFrame:he,resolveScrollContainer:ke,getNormalizedScrollTop:Se,getOffsetTopWithinRoot:Pe,isReverseFlexScrollRoot:Ee,estimateIndexForOffset:We,estimateHeightRange:De,getFallbackNodeHeight:$e,clamp:He}=C,Qe=Z(null);let Ze=null,_t=[];function lt(){const xt=ke(),Bt=V.value;if(!xt||!Bt)return null;const Rt=xt.ownerDocument||Bt.ownerDocument||document;if(xt===Rt.documentElement||xt===Rt.body||xt===Rt.scrollingElement){const ln=Bt.getBoundingClientRect();return Math.max(0,-ln.top)}return Math.max(0,Se(xt,Rt,!1)-Pe(Bt,xt))}function ct(xt){var Bt;const Rt=ke(),ln=V.value;if(!Rt||!ln)return;const Co=Math.max(0,xt),js=Rt.ownerDocument||ln.ownerDocument||document,ri=js.defaultView||(typeof window<"u"?window:null);if(Rt===js.documentElement||Rt===js.body||Rt===js.scrollingElement){const hr=Se(Rt,js,!0)+ln.getBoundingClientRect().top;return void((Bt=ri?.scrollTo)==null||Bt.call(ri,0,Math.max(0,hr+Co)))}vS(Rt,js,Pe(ln,Rt)+Co,{isReverseFlexScrollRoot:hr=>{var mr;return(mr=Ee?.(hr))!=null&&mr},getNormalizedScrollTop:Se})}function St(xt){const Bt=K.value,Rt=He(xt.nodeIndex,0,Math.max(0,Bt-1));return De(0,Rt)+Math.max(0,xt.offsetWithinNodePx)}function wt(){if(Ze!=null&&(he?.(Ze),Ze=null),B)for(const xt of _t)window.clearTimeout(xt);_t=[]}function Zt(xt){const Bt=St(xt),Rt=lt();Rt!=null&&Math.abs(Rt-Bt)<=.5||ct(Bt)}return{activeRestoreAnchor:Qe,getRelativeScrollTopWithinContainer:lt,setRelativeScrollTopWithinContainer:ct,resolveAnchorOffset:St,clearRestoreReconcile:wt,applyRestoreAnchor:Zt,scheduleRestoreReconcile:function(){Qe.value&&B&&Ze==null&&(Ze=ee?ee(()=>{Ze=null,Qe.value&&Zt(Qe.value)}):null,Ze==null&&Qe.value&&Zt(Qe.value))},captureRestoreAnchor:function(){const xt=lt(),Bt=K.value;if(xt==null||Bt<=0)return null;const Rt=He(We(xt+1),0,Bt-1),ln=De(0,Rt),Co=$e(Rt);return{nodeIndex:Rt,offsetWithinNodePx:He(xt-ln,0,Math.max(0,Co-1))}},restoreAnchor:function(xt){const Bt=K.value;if(Qe.value={nodeIndex:He(xt.nodeIndex,0,Math.max(0,Bt-1)),offsetWithinNodePx:Math.max(0,xt.offsetWithinNodePx)},wt(),Zt(Qe.value),B)for(const Rt of[0,120,280,480])_t.push(window.setTimeout(()=>{Qe.value&&Zt(Qe.value)},Rt))},getAnchorDrift:function(xt){const Bt=lt();return Bt==null?null:Bt-St(xt)}}})({isClient:we,containerRef:S,parsedNodeCount:Kn,requestFrame:pe,cancelFrame:Oe,resolveScrollContainer:()=>xe.value||ne(),getNormalizedScrollTop:J,getOffsetTopWithinRoot:ce,isReverseFlexScrollRoot:H,estimateIndexForOffset:Em,estimateHeightRange:pr,getFallbackNodeHeight:Cd,clamp:As}),{nodeHeights:fs,heightStats:Cs,heightTreeSize:cl,heightSumTree:jh,heightKnownTree:Vh,averageNodeHeight:yi,resetHeightMeasurements:T4,pruneHeightMeasurements:M4,rebuildHeightTrees:md,recordNodeHeight:E4,removeNodeHeights:I4,exportHeightCache:$4,importHeightCache:N4,fenwickRangeSum:gd}=(function(C={}){const B=$s({}),V=$s({total:0,count:0}),K=Z(0),ee=Z([]),he=Z([]);function ke(){for(const $e of Object.keys(B))delete B[Number($e)];V.total=0,V.count=0,K.value=0,ee.value=[],he.value=[]}function Se($e,He,Qe){for(let Ze=He+1;Ze<$e.length;Ze+=Ze&-Ze)$e[Ze]+=Qe}function Pe($e,He){let Qe=0;for(let Ze=He+1;Ze>0;Ze-=Ze&-Ze)Qe+=$e[Ze];return Qe}function Ee($e){K.value=$e;const He=new Array($e+1).fill(0),Qe=new Array($e+1).fill(0);for(const[Ze,_t]of Object.entries(B)){const lt=Number(Ze),ct=Number(_t);!Number.isFinite(lt)||lt<0||lt>=$e||!Number.isFinite(ct)||ct<=0||(Se(He,lt,ct),Se(Qe,lt,1))}ee.value=He,he.value=Qe}function We($e){if(!Number.isInteger($e)||$e<0)return!1;const He=B[$e];if(!Number.isFinite(He)||He<=0)return!1;if(delete B[$e],V.total=Math.max(0,V.total-He),V.count=Math.max(0,V.count-1),K.value>$e){const Qe=ee.value,Ze=he.value;Qe.length&&Ze.length&&(Se(Qe,$e,-He),Se(Ze,$e,-1))}return!0}const De=F(()=>V.count>0?Math.max(12,V.total/V.count):32);return{nodeHeights:B,heightStats:V,heightTreeSize:K,heightSumTree:ee,heightKnownTree:he,averageNodeHeight:De,resetHeightMeasurements:ke,pruneHeightMeasurements:function($e){if($e<=0)return void ke();let He=0,Qe=0;for(const[Ze,_t]of Object.entries(B)){const lt=Number(Ze),ct=Number(_t);!Number.isFinite(lt)||lt<0||lt>=$e||!Number.isFinite(ct)||ct<=0?delete B[lt]:(He+=ct,Qe++)}V.total=He,V.count=Qe},rebuildHeightTrees:Ee,recordNodeHeight:function($e,He,Qe={}){(function(Ze,_t,lt={}){var ct;if(!Number.isFinite(_t)||_t<=0)return!1;const St=B[Ze];if(St&&(lt.allowShrink===!1&&_t<St||Math.abs(_t-St)<=1))return!1;if(B[Ze]=_t,St?V.total+=_t-St:(V.total+=_t,V.count++),K.value>Ze){const wt=ee.value,Zt=he.value;if(wt.length&&Zt.length)if(St){const xt=_t-St;xt!==0&&Se(wt,Ze,xt)}else Se(wt,Ze,_t),Se(Zt,Ze,1)}lt.notify!==!1&&((ct=C.onHeightRecorded)==null||ct.call(C))})($e,He,Lt(it({},Qe),{notify:!0}))},removeNodeHeight:function($e,He={}){var Qe;const Ze=We($e);return Ze&&He.notify!==!1&&((Qe=C.onHeightRecorded)==null||Qe.call(C)),Ze},removeNodeHeights:function($e,He={}){var Qe;let Ze=0;for(const _t of $e)We(Number(_t))&&Ze++;return Ze>0&&He.notify!==!1&&((Qe=C.onHeightRecorded)==null||Qe.call(C)),Ze},exportHeightCache:function(){return Object.entries(B).map(([$e,He])=>({index:Number($e),height:Number(He)})).filter($e=>Number.isFinite($e.index)&&$e.index>=0&&Number.isFinite($e.height)&&$e.height>0).sort(($e,He)=>$e.index-He.index)},importHeightCache:function($e,He={}){var Qe;if(!Array.isArray($e))return;const Ze=K.value;let _t=!1;if(He.mode!=="merge"){const lt=Object.keys(B);if(lt.length>0){for(const ct of lt)delete B[Number(ct)];_t=!0}}for(const lt of $e){const ct=Number(lt.index),St=Number(lt.height);if(!Number.isInteger(ct)||ct<0||Ze>0&&ct>=Ze||!Number.isFinite(St)||St<=0)continue;const wt=B[ct];wt&&Math.abs(wt-St)<=1||(B[ct]=St,_t=!0)}_t&&((function(){let lt=0,ct=0;const St=K.value;for(const[wt,Zt]of Object.entries(B)){const xt=Number(wt),Bt=Number(Zt);!Number.isFinite(xt)||xt<0||St>0&&xt>=St||!Number.isFinite(Bt)||Bt<=0?delete B[xt]:(lt+=Bt,ct++)}V.total=lt,V.count=ct})(),Ze>0&&Ee(Ze),(Qe=C.onHeightRecorded)==null||Qe.call(C))},fenwickRangeSum:function($e,He,Qe){if(Qe<=He)return 0;const Ze=Pe($e,Qe-1);return He<=0?Ze:Ze-Pe($e,He-1)}}})({onHeightRecorded:()=>{Wo(),Mt.value&&Dc(),Vt.value&&Jn(),Be.value&&ca(),An("node-resize")}});function vd(){T4(),ws.clear()}function By(C){!Number.isInteger(C)||C<0||C>=st.value.length||ws.set(C,Ac(C))}function Fy(C,B,V={}){const K=fs[C];E4(C,B,V);const ee=fs[C];ee&&ee>0?By(C):K&&ws.delete(C)}function Hy(C,B){const V=mt("getNodeLayoutHeight.slot.offsetHeight",()=>{var K,ee;return(ee=(K=Os.get(C))==null?void 0:K.offsetHeight)!=null?ee:0});return V>0?V:mt("getNodeLayoutHeight.content.offsetHeight",()=>B.offsetHeight)}function Wy(C,B={}){N4(C,B),bm()}const cr=F(()=>{var C;return!ze.value&&k.deferNodesUntilVisible!==!1&&!(((C=k.maxLiveNodes)!=null?C:0)<=0)&&!Nt.value&&!(st.value.length>900)&&ot.value}),zy=F(()=>!!de&&(cr.value||Nt.value)),Uy=F(()=>Nt.value||Mt.value),{liveNodeBufferResolved:wc,focusIndex:Ho,liveRange:xs,updateLiveRange:ul}=(function(C,B){const{parsedNodeCount:V,virtualizationEnabled:K,maxLiveNodesResolved:ee,clamp:he}=B,ke=F(()=>{var Ee;return Math.max(0,(Ee=C.liveNodeBuffer)!=null?Ee:60)}),Se=Z(0),Pe=$s({start:0,end:0});return{liveNodeBufferResolved:ke,focusIndex:Se,liveRange:Pe,updateLiveRange:function(){const Ee=V.value;if(!K.value||Ee===0)return Pe.start=0,void(Pe.end=Ee);const We=Math.min(ee.value,Ee),De=ke.value,$e=he(Se.value-De,0,Math.max(0,Ee-We));Pe.start=$e,Pe.end=Math.min(Ee,$e+We)}}})(k,{parsedNodeCount:Kn,virtualizationEnabled:Nt,maxLiveNodesResolved:oo,clamp:As}),ki=new Map,dl=new Map,ur=new Map,yd=[],Li=new Map,dr=new Set,qy=Z(0);let Kh=!1;const jy=F(()=>(qy.value,dr.size)),_o=new Map,bi=new Map,Vy=Z(0),Gh=F(()=>{Vy.value;let C=0;for(const B of _o.values())C+=Math.max(0,B);return C});let wo=null,Yh=!0,Ky=[0],Gy="";function Wo(){Yh=!0}const kd=F(()=>{if(!Nt.value)return st.value.length;const C=wc.value,B=Math.max(xs.end+C,Bn.value),V=Math.min(st.value.length,B);return Math.max(_s.value,V)});function bd(){Kh||(Kh=!0,queueMicrotask(()=>{Kh=!1,qy.value+=1}))}function Yy(C,B,V="node-resize"){if(!we||typeof window>"u")return null;const K=window.setTimeout(()=>{dr.delete(K)&&bd();try{B()}finally{An(V)}},Math.max(0,C));return dr.add(K),bd(),K}function _d(C){we&&C!=null&&(dr.delete(C)&&bd(),window.clearTimeout(C))}function Xy(){if(we&&typeof window<"u")for(const C of dr)window.clearTimeout(C);dr.size&&(dr.clear(),bd()),yd.length=0,ur.clear()}function L4(C){var B,V;return(V=(B=Ct.value)==null?void 0:B[C])!=null?V:null}const{cancelScheduledFocusSync:Xh,scheduleFocusSync:_i}=(function(C){const{isClient:B,containerRef:V,virtualizationEnabled:K,requestFrame:ee,cancelFrame:he,syncFocusToScroll:ke}=C;let Se=null;function Pe(){var We,De,$e;return($e=(De=(We=V.value)==null?void 0:We.ownerDocument)==null?void 0:De.defaultView)!=null?$e:typeof window<"u"?window:null}function Ee(){if(!Se)return;const We=Pe();Se.viaTimeout?We?We.clearTimeout(Se.id):clearTimeout(Se.id):he?.(Se.id),Se=null}return{cancelScheduledFocusSync:Ee,scheduleFocusSync:function(We={}){if(!K.value)return;if(!B)return void ke(!0);if(We.immediate)return Ee(),void ke(!0);if(Se)return;const De=()=>{Se=null,ke()};if(ee)return void(Se={id:ee(De),viaTimeout:!1});const $e=Pe();Se={id:$e?$e.setTimeout(De,16):setTimeout(De,16),viaTimeout:!0}}}})({isClient:we,containerRef:S,virtualizationEnabled:Nt,requestFrame:pe,cancelFrame:Oe,syncFocusToScroll:function(C=!1){var B;if(!Nt.value)return;const V=xe.value||ne();if(!V)return;const K=V.ownerDocument||((B=S.value)==null?void 0:B.ownerDocument)||document,ee=K?.defaultView||(typeof window<"u"?window:null),he=V===K?.documentElement||V===K?.body,ke=st.value.length;if(!he&&ke>0&&H(V)){const Qe=mt("syncFocusToScroll.clientHeight",()=>V.clientHeight||0),Ze=mt("syncFocusToScroll.scrollTop",()=>V.scrollTop),_t=Ze<0?-Ze:Ze,lt=(function(St){var wt,Zt;const xt=st.value;if(!xt.length)return 0;if(St<=0)return Math.max(0,xt.length-1);if(Xt.value){const Rt=(wt=tm()[xt.length])!=null?wt:0;return ok(Math.max(0,Rt-St))}if(cl.value===xt.length){const Rt=pr(0,xt.length);return Em(Math.max(0,Rt-St))}let Bt=St;for(let Rt=xt.length-1;Rt>=0;Rt--){const ln=(Zt=fs[Rt])!=null?Zt:yi.value;if(Bt<=ln)return Rt;Bt-=ln}return 0})(Math.max(0,_t)+.5*Math.max(0,Qe)),ct=As(lt,0,Math.max(0,ke-1));return void((C||Math.abs(ct-Ho.value)>1)&&(Ho.value=ct,ul()))}const Se=he?null:mt("syncFocusToScroll.root.getBoundingClientRect",()=>V.getBoundingClientRect()),Pe=he?0:Se.top,Ee=he?mt("syncFocusToScroll.viewport.clientHeight",()=>{var Qe,Ze;return(Ze=(Qe=ee?.innerHeight)!=null?Qe:V.clientHeight)!=null?Ze:0}):Se.bottom,We=Ce.value;let De=null,$e=null;for(const[Qe,Ze]of We){if(!Ze)continue;const _t=mt("syncFocusToScroll.slot.getBoundingClientRect",()=>Ze.getBoundingClientRect());_t.bottom<=Pe||_t.top>=Ee||(De==null&&(De=Qe),$e=Qe)}if(De==null||$e==null){const Qe=S.value;if(!Qe)return;const Ze=he?{top:0}:mt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>V.getBoundingClientRect()),_t=mt("syncFocusToScroll.fallback.scrollTop",()=>J(V,K,he)),lt=he?(()=>{const wt=mt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>Qe.getBoundingClientRect()),Zt=(he?0:Ze.top)-wt.top;return Math.max(0,Zt)})():(()=>{const wt=ce(Qe,V);return Math.max(0,_t-wt)})(),ct=he?mt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var wt,Zt,xt,Bt;return(Bt=(xt=(Zt=ee?.innerHeight)!=null?Zt:(wt=K?.documentElement)==null?void 0:wt.clientHeight)!=null?xt:V.clientHeight)!=null?Bt:0}):mt("syncFocusToScroll.fallback.root.clientHeight",()=>V.clientHeight),St=Em(lt+.5*Math.max(0,ct));return Ho.value=As(St,0,Math.max(0,st.value.length-1)),void ul()}const He=Math.round((De+$e)/2);!C&&Math.abs(He-Ho.value)<=1||(Ho.value=As(He,0,Math.max(0,st.value.length-1)),ul())}}),{visibleNodeIndices:Qh,nodeVisibilityHandles:na,nodeVisibilityWatchStops:wd,nodeVisibilityFallbackTimers:Qy,clearVisibilityFallback:Sd,markNodeVisible:fr,cleanupNodeVisibility:O4,destroyNodeVisibilityState:Zh}=$V({isClient:we,shouldTrackVisibleNodeIndices:()=>cr.value,shouldCleanupNodeVisibility:()=>Nt.value,onNodeMarkedVisible:C=>{Nt.value?_i():Ho.value=As(C,0,Math.max(0,st.value.length-1))},onNodeVisibilityCleaned:C=>{Os.delete(C)&&Ak()}}),{cleanupScrollListener:Zy,setupScrollListener:P4}=(function(C){const{isClient:B,virtualizationEnabled:V,listenerEnabled:K,scrollRootElement:ee,resolveScrollContainer:he,scheduleFocusSync:ke,onScroll:Se}=C;let Pe=null,Ee=null;function We(){Pe&&(Pe(),Pe=null),Ee=null,ee.value=null}function De($e){const He=C.getScrollTop?C.getScrollTop($e):$e.scrollTop;return Math.max(0,Number.isFinite(He)?Math.abs(He):0)}return{cleanupScrollListener:We,setupScrollListener:function(){if(!B)return;if(!(($e=K?.value)!=null?$e:V.value))return void We();var $e;const He=he();if(!He)return void We();if(ee.value===He&&Pe)return;We(),Ee=De(He);const Qe=()=>{if(Se?.(),V.value){const Ze=(function(_t){const lt=De(_t),ct=Ee;Ee=lt;const St=Math.max(480,.75*(_t.clientHeight||0));return ct==null?lt>St?{immediate:!0}:void 0:Math.abs(lt-ct)>St?{immediate:!0}:void 0})(He);Ze?ke(Ze):ke()}};He.addEventListener("scroll",Qe,{passive:!0}),ee.value=He,Pe=()=>{He.removeEventListener("scroll",Qe)}}}})({isClient:we,virtualizationEnabled:Nt,listenerEnabled:Uy,scrollRootElement:xe,resolveScrollContainer:ne,scheduleFocusSync:_i,onScroll:function(){const C=Be.value;if(!C)return;const B=xc();if(!B||(function(K){if($c()>=at)return Ot=null,!1;const ee=Ot;if(ee==null)return!0;const he=Math.abs(K.scrollTop-ee)<=2;return he||(Ot=null),he})(B))return;const V=pk(B);V!=null?(V<-32||Math.abs(Math.max(0,V)-Math.max(0,C.distanceFromBottomPx))>32)&&aa("restore"):aa("restore")},getScrollTop:C=>{var B;const V=C.ownerDocument||((B=S.value)==null?void 0:B.ownerDocument)||document,K=C===V.documentElement||C===V.body||C===V.scrollingElement;return mt("scrollListener.getScrollTop",()=>J(C,V,K))}});function As(C,B,V){return Math.min(Math.max(C,B),V)}function Jh(C){return C?.firstElementChild}function Jy(C,B){var V;return C?(V=C.matches)!=null&&V.call(C,B)?C:C.querySelector(B):null}function ek(){if(!Xt.value)return void(X.value=0);const C=mt("updateExperimentContainerWidth.clientWidth",()=>{var B,V;return(V=(B=S.value)==null?void 0:B.clientWidth)!=null?V:0});X.value=C>0?C:0}let Sc=null;function em(){Sc?.disconnect(),Sc=null}const tk=ui({loader:()=>zn(null,null,function*(){return(yield Xs(()=>import("./index8-B6k25jtU.js"),__vite__mapDeps([7,6]))).default}),loadingComponent:XM,delay:0,suspensible:!1});function nk(C){return C===tk}const sk=F(()=>u.value==="pre"?xo:u.value==="shiki"?tk:Dg),fl=F(()=>{const C=st.value;if(!C.length||!Xt.value)return C.map(()=>null);const B=X.value||mt("estimatedNodeHeights.clientWidth",()=>{var V;return((V=S.value)==null?void 0:V.clientWidth)||0});return!Number.isFinite(B)||B<=0?C.map(()=>null):C.map((V,K)=>{const ee=fs[K],he=typeof ee=="number"&&ee>0;if(bs.value&&!he){const Se=n3(V,B,fe.value);if(Se)return Se}if(Do.value&&V.type==="code_block"){const Se=(function(Pe){if(Pe.type!=="code_block")return null;const Ee=Fk(Pe,$d(Pe));return nk(Ee)?"markdown":Ee===xo?"pre":Ee===sk.value||Ee===Dg?"monaco":null})(V);if(Se==="monaco"||Se==="markdown"||Se==="pre")return gV(V,{rendererKind:Se,monacoOptions:k.codeBlockMonacoOptions,showHeader:((ke=k.codeBlockProps)==null?void 0:ke.showHeader)!==!1})}var ke;return null})});function Cd(C){var B;const V=fs[C];if(Number.isFinite(V)&&V>0)return V;const K=(B=fl.value[C])==null?void 0:B.height;return Number.isFinite(K)&&K>0?K:Math.max(yi.value,(function(ee){var he,ke,Se,Pe,Ee,We,De,$e,He,Qe,Ze,_t,lt;const ct=st.value[ee];if(!ct||typeof ct!="object")return 32;const St=String((he=ct.type)!=null?he:""),wt=so()||640;switch(St){case"heading":return 44;case"paragraph":return sa(String((Se=(ke=ct.raw)!=null?ke:ct.content)!=null?Se:""),wt,34);case"list":{const Zt=Array.isArray(ct.items)?ct.items.length:1;return Math.max(48,30*Zt+12)}case"list_item":return sa(String((Ee=(Pe=ct.raw)!=null?Pe:ct.content)!=null?Ee:""),wt,34);case"blockquote":return sa(String((De=(We=ct.raw)!=null?We:ct.content)!=null?De:""),wt,56);case"table":{const Zt=Array.isArray(ct.rows)?ct.rows.length:Array.isArray(ct.children)?ct.children.length:3;return Math.max(120,38*Zt+48)}case"code_block":return sa(String((He=($e=ct.code)!=null?$e:ct.raw)!=null?He:""),wt,96,20);case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return sa(String((Ze=(Qe=ct.raw)!=null?Qe:ct.content)!=null?Ze:""),wt,96);case"thematic_break":return 24;default:return sa(String((lt=(_t=ct.raw)!=null?_t:ct.content)!=null?lt:""),wt,40)}})(C))}function sa(C,B,V,K=22){const ee=String(C??"");if(!ee)return V;const he=Math.max(18,Math.floor(Math.max(320,B)/8)),ke=ee.split(/\r?\n/).length,Se=Math.ceil(ee.length/he),Pe=Math.max(1,ke,Se);return Math.max(V,Math.ceil(Pe*K+12))}function Cc(C){const B=Number(C);return!Number.isFinite(B)||B<=0?-1:Math.round(B/32)}function tm(){var C,B;const V=st.value.length,K=Cc(X.value||mt("getFallbackHeightPrefix.clientWidth",()=>{var Se;return((Se=S.value)==null?void 0:Se.clientWidth)||0})),ee=((C=s.virtualScroll)==null?void 0:C.measurementKey)==null?"":String(s.virtualScroll.measurementKey),he=[V,Cs.count,Math.round(Cs.total),Math.round(100*yi.value),ee,K,Xt.value?1:0,pS.value,Q.value].join(":");if(!Yh&&Gy===he)return Ky;const ke=new Array(V+1);ke[0]=0;for(let Se=0;Se<V;Se++)ke[Se+1]=ke[Se]+(Xt.value?Cd(Se):(B=fs[Se])!=null?B:yi.value);return Ky=ke,Gy=he,Yh=!1,ke}function ok(C){var B,V;const K=st.value.length;if(K<=0||C<=0)return 0;const ee=tm();if(C>=((B=ee[K])!=null?B:0))return K-1;let he=0,ke=K-1,Se=K-1;for(;he<=ke;){const Pe=he+ke>>1;((V=ee[Pe+1])!=null?V:0)>=C?(Se=Pe,ke=Pe-1):he=Pe+1}return Se}function pr(C,B){var V,K;if(C>=B)return 0;if(Xt.value)return(function(ke,Se){var Pe,Ee;const We=st.value.length,De=As(Math.trunc(ke),0,We),$e=As(Math.trunc(Se),De,We);if(De>=$e)return 0;const He=tm();return((Pe=He[$e])!=null?Pe:0)-((Ee=He[De])!=null?Ee:0)})(C,B);if(cl.value!==st.value.length){let ke=0;for(let Se=C;Se<B;Se++)ke+=(V=fs[Se])!=null?V:yi.value;return ke}const ee=jh.value,he=Vh.value;if(!ee.length||!he.length){let ke=0;for(let Se=C;Se<B;Se++)ke+=(K=fs[Se])!=null?K:yi.value;return ke}return gd(ee,C,B)+(B-C-gd(he,C,B))*yi.value}Ke(()=>st.value.length,C=>{Wo(),C<=0?vd():(C<cl.value&&M4(C),C!==cl.value&&md(C))},{immediate:!0});const R4=F(()=>{if(!Nt.value)return st.value.map((K,ee)=>({node:K,index:ee}));const C=st.value.length,B=As(xs.start,0,C),V=As(xs.end,B,C);return st.value.slice(B,V).map((K,ee)=>({node:K,index:B+ee}))}),nm=F(()=>Nt.value?pr(0,Math.min(xs.start,st.value.length)):0),sm=F(()=>{if(!Nt.value)return 0;const C=st.value.length;return pr(Math.min(xs.end,C),C)});function ik(){if(!Xt.value)return 0;let C=0;const B=fl.value;for(let V=0;V<B.length;V++){if(!B[V])continue;const K=fs[V];Number.isFinite(K)&&K>0||C++}return C}function rk(){const C=st.value.length;return{totalNodes:C,measuredCount:Cs.count,estimatedCount:ik(),averageNodeHeight:yi.value,topSpacerHeight:nm.value,bottomSpacerHeight:sm.value,estimatedTotalHeight:pr(0,C),width:pl()}}function D4(){const C=st.value,B=rk();return Lt(it({},B),{probe:{paragraphReady:!!fe.value.paragraph,listItemReady:!!fe.value.listItem,listWrapperOverhead:fe.value.listWrapperOverhead,headingReadyLevels:Object.entries(fe.value.headings).filter(([,V])=>!!V).map(([V])=>Number(V))},nodes:C.map((V,K)=>{var ee,he,ke,Se,Pe,Ee,We,De,$e;return{index:K,type:V.type,estimateKind:(he=(ee=fl.value[K])==null?void 0:ee.kind)!=null?he:null,rendererKind:(Se=(ke=fl.value[K])==null?void 0:ke.rendererKind)!=null?Se:null,estimatedHeight:(Ee=(Pe=fl.value[K])==null?void 0:Pe.height)!=null?Ee:null,estimatedContentHeight:(De=(We=fl.value[K])==null?void 0:We.contentHeight)!=null?De:null,measuredHeight:($e=fs[K])!=null?$e:null}})})}function om(){return s.indexKey!=null?String(s.indexKey):Ln.value?`virtual-${On()}`:"markdown-renderer"}function lk(C){const B=String(C),V=`${om()}-`;if(!B.startsWith(V))return null;const K=B.slice(V.length).match(/^(\d+)(?:$|-)/);if(!K)return null;const ee=Number(K[1]);return!Number.isInteger(ee)||ee<0||ee>=st.value.length?null:ee}function On(){var C,B,V;const K=(C=s.virtualScroll)==null?void 0:C.sessionKey;return String(K!=null&&K!==""?K:(V=(B=s.indexKey)!=null?B:k.customId)!=null?V:Yt)}function ps(){var C;const B=(C=s.virtualScroll)==null?void 0:C.threadKey;return B==null||B===""?void 0:String(B)}function im(C){var B;return(C??"")===((B=ps())!=null?B:"")}function B4(){var C;const B=(C=s.virtualScroll)==null?void 0:C.measurementKey;return B==null?"":String(B)}function F4(){var C,B;const V=u.value,K=V==="monaco"?k.codeBlockMonacoOptions:void 0,ee=k.codeBlockProps,he=V==="shiki";return[k.isDark?"dark":"light",V==="monaco"?"code-rich":V==="pre"?"code-pre":"code-shiki",k.codeBlockStream===!1?"code-static":"code-stream",vs(k.codeBlockMinWidth),vs(k.codeBlockMaxWidth),...he?[Np((C=ee?.themes)!=null?C:k.themes,(B=ee?.langs)!=null?B:k.langs)]:[],vs(K?.fontSize),vs(K?.lineHeight),vs(K?.fontFamily),vs(K?.tabSize),vs(K?.MAX_HEIGHT),vs(K?.wordWrap),vs(K?.wrappingIndent),vs(K?.padding),vs(ee?.showHeader),vs(ee?.showCopyButton),vs(ee?.showExpandButton),vs(ee?.showPreviewButton),vs(ee?.showCollapseButton),vs(ee?.showFontSizeButtons)].join("\0")}function Oi(){return[B4(),F4()].join("\0")}function pl(){return so()}const xd=F(()=>Cc(pl())),So=F(()=>[Oi(),xd.value].join("\0")),H4=F(()=>{var C;return Ln.value?["virtual",(C=ps())!=null?C:"",On(),So.value].join("\0"):s.indexKey});function oa(){Vy.value+=1}function rm(C){return!(!C||!Number.isInteger(C.index)||C.index<0||C.index>=st.value.length||C.sessionKey!==On()||C.threadKey!==ps()||C.layoutEpochKey!==So.value)}function ak(C){const B=String(C),V=bi.get(B);return V?rm(V)?V.index:null:lk(B)}function ck(C="async-node"){(_o.size||bi.size)&&(_o.clear(),bi.clear(),oa(),An(C))}const ia=Ut(u1,null),lm={reportHeight(C,B){if(!Mt.value)return;const V=ak(C);if(V==null)return;const K=ki.get(V);if(!K)return;const ee=Number(B),he=Hy(V,K);Fy(V,Number.isFinite(ee)&&ee>0?Math.max(ee,he||0):he)},markPending(C){if(!Mt.value)return;const B=lk(C);B!=null&&(function(V,K){var ee;const he=bi.get(V);if(he&&rm(he))return _o.set(V,Math.max(0,(ee=_o.get(V))!=null?ee:0)+1),oa(),void An("async-node");_o.set(V,1),bi.set(V,(function(ke){return{index:ke,sessionKey:On(),threadKey:ps(),layoutEpochKey:So.value}})(K)),oa(),An("async-node")})(String(C),B)},markSettled(C){if(!Mt.value)return;const B=String(C),V=ak(C);(V!=null||(function(K){return _o.has(String(K))})(B))&&(function(K){var ee;const he=(ee=_o.get(K))!=null?ee:0;return!(he<=0||(he<=1?(_o.delete(K),bi.delete(K)):_o.set(K,he-1),oa(),he===1&&An("async-node"),0))})(B)&&V!=null&&Pi()}};function W4(){let C=0;for(const B of ki.values())C+=mt("getVisibleDomHeight.offsetHeight",()=>{var V;return(V=B?.offsetHeight)!=null?V:0});return Math.ceil(Math.max(0,C))}En(u1,{reportHeight(C,B){lm.reportHeight(C,B),ia?.reportHeight(C,B)},markPending(C){lm.markPending(C),ia?.markPending(C)},markSettled(C){lm.markSettled(C),ia?.markSettled(C)}});let am,cm=null,ra=null;function Ad(C){return C!==!1&&C!=null&&C!==""}function uk(){return Nt.value?(function(){if(!Nt.value)return!0;const C=st.value.length,B=As(xs.start,0,C),V=As(xs.end,B,C);if(B>=V)return!0;for(let K=B;K<V;K++)if(!Os.has(K)||Im(K)&&!ki.has(K))return!1;return!0})():_s.value>=kd.value}function um(){return j.value===!0&&!Y.value&&Gh.value===0&&dr.size===0&&Li.size===0&&wo==null&&uk()}function dk(){var C,B;if(((C=s.virtualScroll)==null?void 0:C.settleMode)!=="manual"||cm===On()&&am===ps())return!0;const V=(B=s.virtualScroll)==null?void 0:B.settledToken;return!!Ad(V)&&ra===Bc(V)}function dm(){return um()&&dk()}function z4(C,B){return B.totalNodes<=0?C==="final"?"final":"estimate":B.measuredCount>=B.totalNodes?C==="final"?"final":"measured":B.measuredCount>0||B.estimatedCount>0?"mixed":"estimate"}function hl(C="manual",B){const V=rk(),K=(function(ee){return ee||(j.value!==!0?st.value.length>0?"streaming":"estimating":!uk()||Li.size>0||wo!=null?"measuring":dm()?"settled":"settling")})(B);return{sessionKey:On(),threadKey:ps(),phase:K,nodeCount:V.totalNodes,liveRange:{start:xs.start,end:xs.end},renderedCount:_s.value,measuredCount:V.measuredCount,estimatedCount:V.estimatedCount,averageNodeHeight:V.averageNodeHeight,topSpacerHeight:V.topSpacerHeight,bottomSpacerHeight:V.bottomSpacerHeight,visibleDomHeight:W4(),totalHeight:fk(),width:V.width,final:j.value===!0,stable:dm(),confidence:z4(K,V),reason:C}}function xc(){const C=xe.value||ne(),B=S.value;if(!C||!B)return null;const V=C.ownerDocument||B.ownerDocument||document,K=C===V.documentElement||C===V.body||C===V.scrollingElement,ee=mt("getScrollBox.scrollTop",()=>J(C,V,K)),he=mt("getScrollBox.scrollHeight",()=>{var Se,Pe,Ee,We,De;return K?Math.max((Pe=(Se=V.documentElement)==null?void 0:Se.scrollHeight)!=null?Pe:0,(We=(Ee=V.body)==null?void 0:Ee.scrollHeight)!=null?We:0,(De=C.scrollHeight)!=null?De:0):C.scrollHeight}),ke=mt("getScrollBox.clientHeight",()=>{var Se;return K?((Se=V.documentElement)==null?void 0:Se.clientHeight)||C.clientHeight||0:C.clientHeight});return{root:C,doc:V,isViewportRoot:K,scrollTop:ee,scrollHeight:he,clientHeight:ke}}function fk(){const C=st.value.length,B=Math.max(0,pr(0,C)),V=mt("getRendererLogicalHeight.offsetHeight",()=>{var ee,he;return(he=(ee=S.value)==null?void 0:ee.offsetHeight)!=null?he:0}),K=Math.max(0,V>0?V:mt("getRendererLogicalHeight.scrollHeight",()=>{var ee,he;return(he=(ee=S.value)==null?void 0:ee.scrollHeight)!=null?he:0}));return C<=0?Math.ceil(V):Nt.value?B>0?Math.max(1,Math.ceil(B),(function(){let ee=nm.value+sm.value;for(const he of Os.values())he&&(ee+=Math.max(0,mt("getVirtualizedDomLogicalHeight.offsetHeight",()=>he.offsetHeight||0)));return Math.ceil(Math.max(0,ee))})(),(function(ee,he){return ee<=0||he<=0?0:he<=ee+Math.max(512,.05*ee)?Math.ceil(he):0})(B,K)):Math.max(1,Math.ceil(K)):Mt.value?B>0||Cs.count>0||ik()>0?(ii.value&&_s.value,Math.max(1,Math.ceil(K),Math.ceil(B))):Math.ceil(K):Math.max(1,Math.ceil(K),Math.ceil(B))}function pk(C){const B=S.value;if(!B)return null;const V=mt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>B.getBoundingClientRect());return(function(ee){return ee.isViewportRoot?ee.clientHeight:mt("getViewportBottomInRoot.getBoundingClientRect",()=>ee.root.getBoundingClientRect().bottom)})(C)-V.bottom}function U4(C={}){const B=C.requireViewport!==!1,V=(function(he=64){const ke=xc(),Se=S.value;if(!ke||!Se)return!1;const Pe=(function(We){if(We.isViewportRoot)return{top:0,bottom:We.clientHeight};const De=mt("getVirtualViewportRect.getBoundingClientRect",()=>We.root.getBoundingClientRect());return{top:De.top,bottom:De.bottom}})(ke),Ee=mt("isRendererNearVirtualViewport.getBoundingClientRect",()=>Se.getBoundingClientRect());return Ee.bottom>=Pe.top-he&&Ee.top<=Pe.bottom+he})();if(B&&!V)return null;const K=(function(){const he=xc(),ke=S.value;if(!he||!ke||Math.max(0,he.scrollHeight-he.scrollTop-he.clientHeight)>64)return null;const Se=pk(he);return Se==null?null:Se>=-8&&Se<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,Se)}:null})();if(K)return{anchor:K,captured:!0};const ee=Fn();if(ee)return{anchor:{type:"node",nodeIndex:ee.nodeIndex,offsetWithinNodePx:ee.offsetWithinNodePx},captured:V};if(C.allowFallback===!0){const he=(function(){const ke=st.value.length;return ke<=0?null:{type:"node",nodeIndex:As(Ho.value,0,Math.max(0,ke-1)),offsetWithinNodePx:0}})();return he?{anchor:he,captured:!1}:null}return null}function fm(C){let B=2166136261;for(let V=0;V<C.length;V++)B^=C.charCodeAt(V),B=Math.imul(B,16777619);return(B>>>0).toString(36)}function q4(C,B){let V=C;for(let K=0;K<B.length;K++)V^=B.charCodeAt(K),V=Math.imul(V,16777619);return V^=31,V=Math.imul(V,16777619),V}const j4=new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function Td(C,B=new WeakSet,V=0){if(C==null||typeof C=="number"||typeof C=="boolean")return String(C);if(typeof C=="string")return`s:${(function(K){const ee=K.length>8192?`${K.slice(0,8192)}...${K.length}`:K;return`${K.length}:${fm(ee)}`})(C)}`;if(typeof C=="function")return"fn";if(typeof C!="object")return typeof C;if(B.has(C))return"cycle";if(V>=6)return"max-depth";B.add(C);try{if(Array.isArray(C)){if(C.length<=160){const Ee=[];for(let We=0;We<C.length;We++)Ee.push(Td(C[We],B,V+1));return`a:${C.length}:${Ee.join(",")}`}const he=[],ke=[],Se=Math.max(0,C.length-32);let Pe=2166136261;for(let Ee=0;Ee<C.length;Ee++){const We=Td(C[Ee],B,V+1);Pe=q4(Pe,We),Ee<32&&he.push(We),Ee>=Se&&ke.push(We)}return[`a:${C.length}`,`h=${he.join(",")}`,`t=${ke.join(",")}`,`all=${(Pe>>>0).toString(36)}`].join(":")}const K=C,ee=Object.keys(K).filter(he=>{const ke=K[he];return he!=="parent"&&he!=="el"&&he!=="component"&&(ke==null||typeof ke=="string"||typeof ke=="number"||typeof ke=="boolean"||j4.has(he))}).sort();return`o:${ee.length}:${ee.map(he=>`${he}=${Td(K[he],B,V+1)}`).join(";")}`}finally{B.delete(C)}}let hk=-1,pm="";function Ac(C){const B=st.value[C];return B?fm(Td(B)):""}function hm(){const C=Q.value;if(hk===C)return pm;let B=2166136261;for(let V=0;V<st.value.length;V++){const K=Ac(V);for(let ee=0;ee<K.length;ee++)B^=K.charCodeAt(ee),B=Math.imul(B,16777619)}return pm=(B>>>0).toString(36),hk=C,pm}function la(C,B={}){var V;const K=B.includeHeightCache===!0,ee=(V=B.includeContentHash)!=null?V:K,he=K?(function(Se){const Pe=(function(){var Ze,_t;const lt=Number((_t=(Ze=s.virtualScroll)==null?void 0:Ze.heightCacheLimit)!=null?_t:5e3);return!Number.isFinite(lt)||lt<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(lt))})();if(!Number.isFinite(Pe)||Se.length<=Pe)return Se;const Ee=new Map,We=Ze=>{!Ze||Ee.size>=Pe||Ee.set(Ze.index,Ze)},De=st.value.length,$e=As(xs.start-2*wc.value,0,De),He=As(xs.end+2*wc.value,$e,De);for(const Ze of Se)Ze.index>=$e&&Ze.index<He&&We(Ze);const Qe=Math.max(1,Math.ceil(Se.length/Pe));for(let Ze=0;Ze<Se.length&&Ee.size<Pe;Ze+=Qe)We(Se[Ze]);for(let Ze=Se.length-1;Ze>=0&&Ee.size<Pe;Ze-=Qe)We(Se[Ze]);return Array.from(Ee.values()).sort((Ze,_t)=>Ze.index-_t.index).slice(0,Pe)})($4().map(Se=>{var Pe;const Ee=st.value[Se.index];return Ee?Lt(it({},Se),{nodeType:String((Pe=Ee.type)!=null?Pe:""),signature:Ac(Se.index)}):null}).filter(Se=>!!Se)):[],ke=U4({allowFallback:B.allowAnchorFallback===!0,requireViewport:B.requireViewport});return ke||he.length||B.includeEmptyState===!0?Lt(it({sessionKey:C.sessionKey,threadKey:C.threadKey},ke?{anchor:ke.anchor,anchorCaptured:ke.captured}:{anchorCaptured:!1}),{metrics:C,width:C.width,contentHash:ee?hm():void 0,measurementKey:Oi()||void 0,heightCache:he.length?he:void 0}):null}function mm(C){var B,V;const K=xc();if(!K)return;const ee=(function(Se){const Pe=S.value;if(!Pe)return null;const Ee=ce(Pe,Se.root),We=st.value.length,De=mt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>Pe.offsetHeight||0),$e=Math.max(0,De>0?De:We>0?mt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>Pe.scrollHeight||0):0),He=fk();return Ee+Math.max($e,He)})(K);if(ee==null)return;const he=Math.max(0,C.distanceFromBottomPx),ke=Math.max(0,ee-K.clientHeight-he);(function(Se){at=$c()+120,Ot=Se})(ke),K.isViewportRoot?(V=(B=K.doc.defaultView)==null?void 0:B.scrollTo)==null||V.call(B,0,ke):vS(K.root,K.doc,ke,{isReverseFlexScrollRoot:H,getNormalizedScrollTop:J})}const gm=[];function mk(){if(we)for(et!=null&&(Oe?.(et),et=null);gm.length;){const C=gm.pop();C!=null&&window.clearTimeout(C)}}function aa(C){const B=!!Be.value;Be.value=null,at=0,Ot=null,mk(),B&&C&&An(C)}function ca(){if(!Be.value||!we||et!=null)return;const C=()=>{et=null;const B=Be.value;B&&mm(B)};et=pe?pe(C):null,et==null&&C()}function gk(C,B={}){const V=st.value.length;return V<=0?[]:C.filter(K=>!(!Number.isInteger(K.index)||K.index<0||K.index>=V)&&!(!Number.isFinite(K.height)||K.height<=0)&&!(B.requireSignature&&!K.signature)&&!(B.requireCompatibilityMetadata&&!K.nodeType&&!K.signature)&&(function(ee){var he;const ke=st.value[ee.index];return!(!ke||ee.nodeType&&ee.nodeType!==String((he=ke.type)!=null?he:"")||ee.signature&&ee.signature!==Ac(ee.index))})(K))}function vk(C){const B=Cc(pl()),V=Cc(C);return B!==-1&&V!==-1&&B===V}function vm(C){var B;const V=Number(C?.width);if(Number.isFinite(V)&&V>0)return V;const K=Number((B=C?.metrics)==null?void 0:B.width);return Number.isFinite(K)&&K>0?K:null}function yk(C){var B;return C.sessionKey===On()&&!!im(C.threadKey)&&((B=C.measurementKey)!=null?B:"")===Oi()&&!!vk(vm(C))&&!!(function(V){const K=V.heightCache;return!!K?.length&&(kk(V)?K.some(ee=>!!(ee.nodeType||ee.signature)):K.some(ee=>!!ee.signature))})(C)}function kk(C){return!!(C.contentHash&&C.contentHash===hm())}function V4(C){return!kk(C)}let ml=null,gl=null,Md=null,Tc=null,Mc=null;function ym(C){var B;const V=C.map(ee=>{var he,ke;return[ee.index,Math.round(10*ee.height),(he=ee.nodeType)!=null?he:"",(ke=ee.signature)!=null?ke:""].join("")}).join(""),K=Cc(pl());return[(B=ps())!=null?B:"",On(),Oi(),st.value.length,K,C.length,fm(V)].join(":")}function bk(C=(B=>(B=s.virtualScroll)==null?void 0:B.heightCache)()){if(!Mt.value||!C?.length||st.value.length<=0||!vk((B=s.virtualScroll)==null?void 0:B.heightCacheWidth))return!1;var B;const V=gk(C,{requireSignature:!0});if(!V.length)return!1;const K=ym(V);return K===ml?(gl="standalone",!0):(Wy(V,{mode:"merge"}),Wo(),ml=K,gl="standalone",Lc(),An("restore"),!0)}function km(C,B={}){var V,K,ee;if(!Mt.value||!C||C.sessionKey!==On()||!im(C.threadKey)||st.value.length<=0)return!1;const he=!!((V=C.heightCache)!=null&&V.length)&&!Ed(),ke=!C.anchor||C.anchorCaptured===!1&&B.allowUncapturedAnchor!==!0?null:C.anchor,Se=B.restoreAnchor===!0&&!!ke&&!Ed()&&Number(vm(C))>0;let Pe=!1;if((K=C.heightCache)!=null&&K.length&&yk(C)){const We=gk(C.heightCache,{requireCompatibilityMetadata:!C.contentHash,requireSignature:V4(C)});We.length&&(Wy(We,{mode:"merge"}),Wo(),ml=ym(We),gl="restore",Lc(),Pe=!0)}if(he||Se)return!1;if(!B.restoreAnchor||!ke)return Pe&&An("restore"),!0;const Ee=(function(We,De){var $e;const He=We.anchor,Qe=He?He.type==="bottom"?`bottom:${Math.round(He.distanceFromBottomPx)}`:`node:${He.nodeIndex}:${Math.round(He.offsetWithinNodePx)}`:"none";return[($e=ps())!=null?$e:"",On(),Oi(),xd.value,De,Qe].join(":")})(C,(ee=B.restoreToken)!=null?ee:"imperative");return Md===Ee?(Pe&&An("restore"),!0):(Md=Ee,(function(We){const De=()=>{if(We.type==="node")return aa(),void Ss({nodeIndex:We.nodeIndex,offsetWithinNodePx:We.offsetWithinNodePx});if(nn(),Vt.value=null,Be.value=We,mk(),mm(We),we)for(const $e of[0,120,280,480])gm.push(window.setTimeout(()=>{const He=Be.value;He&&mm(He)},$e))};(function($e){if(!Nt.value)return!1;const He=st.value.length;return!(He<=0||(Ho.value=$e.type==="node"?As($e.nodeIndex,0,He-1):He-1,ul(),0))})(We)?ht(De):De()})(ke),An("restore"),!0)}function Ed(){const C=pl();return Number.isFinite(C)&&C>0}function _k(C){var B;return C.sessionKey===On()&&!!im(C.threadKey)&&(st.value.length<=0||!(!((B=C.heightCache)!=null&&B.length)||Ed())||!(!(C.anchor&&Number(vm(C))>0)||Ed()))}function bm(){ws.clear();for(const C of Object.keys(fs)){const B=Number(C);Number.isInteger(B)&&B>=0&&B<st.value.length&&By(B)}}function Ec(){wo!=null&&(Oe?.(wo),wo=null),$m()}function wk(){return!we||Wt?Promise.resolve():new Promise(C=>{let B=!1,V=null;const K=()=>{B||(B=!0,V!=null&&window.clearTimeout(V),C())};if(pe)return pe(K),void(V=window.setTimeout(K,50));V=window.setTimeout(K,0)})}function _m(C,B=ps(),V=So.value){return On()===C&&ps()===B&&So.value===V}function wm(){return zn(this,arguments,function*(C={}){var B,V,K,ee,he;const ke=On(),Se=ps(),Pe=So.value,Ee=(B=C.frames)!=null?B:2,We=(V=C.timeoutMs)!=null?V:120,De=(K=C.reason)!=null?K:"manual",$e=C.expectedSettledTokenKey,He=C.flushPendingTimers===!0,Qe=hl(De),Ze=()=>Lt(it({},Qe),{phase:Qe.final?"settling":Qe.phase,stable:!1,confidence:Qe.confidence==="final"?"mixed":Qe.confidence,reason:De}),_t=()=>_m(ke,Se,Pe)&&($e==null||Nc()===$e);for(let wt=0;wt<Ee;wt++){if(yield ht(),!_t()||(yield wk(),!_t()))return Ze();Pi(),Ec()}if(yield(function(wt){return!we||wt<=0?Promise.resolve():new Promise(Zt=>window.setTimeout(Zt,wt))})(We),!_t()||(He&&Xy(),Pi(),Ec(),!_t()))return Ze();const lt=um();lt&&(cm=ke,am=Se,((ee=s.virtualScroll)==null?void 0:ee.settleMode)==="manual"&&$e!=null&&Ad((he=s.virtualScroll)==null?void 0:he.settledToken)&&Nc()===$e&&(ra=Bc(s.virtualScroll.settledToken)));const ct=_t()&<&&dk(),St=hl(De,ct?"final":void 0);return Tm(St,!0),St})}let Sm="content",vl=null,yl=null,Cm=0,Ic=null,ua=null,xm=null,Am=null;function $c(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Sk(C){var B,V;const K=Ic;if(!K)return!0;const ee=(V=(B=s.virtualScroll)==null?void 0:B.heightDiffThresholdPx)!=null?V:1;return Math.abs(C.totalHeight-K.totalHeight)>ee||C.sessionKey!==K.sessionKey||C.phase!==K.phase||C.stable!==K.stable||C.final!==K.final||C.threadKey!==K.threadKey||C.nodeCount!==K.nodeCount||C.measuredCount!==K.measuredCount||C.width!==K.width}function vs(C){if(C==null)return"";if(typeof C=="string"||typeof C=="number"||typeof C=="boolean")return String(C);try{return JSON.stringify(C)}catch{return String(C)}}function Nc(C=(B=>(B=s.virtualScroll)==null?void 0:B.settledToken)()){return vs(C)}function Ck(C,B){var V,K;return[C,B.sessionKey,(V=B.threadKey)!=null?V:"",Oi(),hm(),vs((K=s.virtualScroll)==null?void 0:K.settledToken),Math.round(B.totalHeight),Math.round(B.width)].join("\0")}function Lc(){xm=null,Am=null,ua=null}function K4(C){const B=C.heightCache;return B?.length?ym(B):""}function Oc(C){var B,V,K;const ee=C.metrics,he=C.anchor?(ke=C.anchor).type==="bottom"?`bottom:${Math.round(ke.distanceFromBottomPx)}`:`node:${ke.nodeIndex}:${Math.round(ke.offsetWithinNodePx)}`:"none";var ke;return[C.sessionKey,(B=C.threadKey)!=null?B:"",(V=C.measurementKey)!=null?V:Oi(),(K=C.contentHash)!=null?K:"",K4(C),he,C.anchorCaptured?1:0,ee.liveRange.start,ee.liveRange.end,ee.renderedCount,ee.nodeCount,Math.round(ee.totalHeight),Math.round(ee.width),ee.phase,ee.stable?1:0].join("\0")}function Tm(C,B=!1){if(!Mt.value||(function(ke=!1){return!ke&&Ln.value&&!us.value})(B))return;const V=B||Sk(C),K=(function(ke,Se=!1){return Se||ke.stable||ke.phase==="final"?{state:la(ke,{includeHeightCache:!0})}:{state:la(ke)}})(C,B),ee=K.state,he=!!(ee&&(V||(function(ke,Se=!1){return!!Se||Oc(ke)!==ua})(ee,B)));if(V&&(E(C),Ic=C,Cm=$c()),ee&&he&&(M(ee),ee.anchor&&L(ee.anchor),ua=Oc(ee)),C.stable){const ke=Ck("settled",C);if(ke!==xm){xm=ke;const Se=la(C,{includeHeightCache:!0});Se&&(M(Se),ua=Oc(Se)),(function(Pe){o("render-settled",Pe)})(C)}}if(C.phase==="final"){const ke=Ck("final",C);if(ke!==Am){Am=ke;const Se=la(C,{includeHeightCache:!0});Se&&(M(Se),ua=Oc(Se)),(function(Pe){o("render-final",Pe)})(C)}}}function Mm(){vl!=null&&(Oe?.(vl),vl=null),yl!=null&&we&&(window.clearTimeout(yl),yl=null)}function xk(){vl=null,yl=null,(function(C){if(Li.size>0||wo!=null)return!0;switch(C){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(Sm)&&(Pi(),Ec()),Tm(hl(Sm))}function An(C){var B,V;if(!Mt.value||(Sm=C,vl!=null||yl!=null))return;const K=Math.max(0,(V=(B=s.virtualScroll)==null?void 0:B.emitIntervalMs)!=null?V:32),ee=Math.max(0,K-($c()-Cm)),he=()=>{yl=null,vl=pe?pe(xk):null,vl==null&&xk()};we&&ee>0?yl=window.setTimeout(he,ee):he()}function Em(C){var B;if(C<=0)return 0;const V=st.value;if(Xt.value)return ok(C);if(cl.value===V.length&&jh.value.length&&Vh.value.length){const ee=yi.value,he=jh.value,ke=Vh.value,Se=De=>De<=0?0:gd(he,0,De)+(De-gd(ke,0,De))*ee;let Pe=0,Ee=V.length-1,We=V.length-1;for(;Pe<=Ee;){const De=Pe+Ee>>1;Se(De+1)>=C?(We=De,Ee=De-1):Pe=De+1}return We}let K=C;for(let ee=0;ee<V.length;ee++){const he=(B=fs[ee])!=null?B:yi.value;if(K<=he)return ee;K-=he}return Math.max(0,V.length-1)}function Ak(){se.value+=1}function Im(C){return!(ii.value&&C>=_s.value)&&(!cr.value||C<Bn.value||Qh.value.has(C))}function da(C){const B=wd.get(C);B&&(B(),wd.delete(C));const V=na.get(C);V&&(V.destroy(),na.delete(C)),Sd(C)}function Tk(C,B){let V=!1;if(B){const he=Os.get(C);Os.set(C,B),he!==B&&(V=!0)}else Os.delete(C)&&(V=!0);if(V&&Ak(),B||Sd(C),!zy.value||!de||!Nt.value&&cr.value&&!z.value&&na.size>=640&&(z.value||(z.value=!0,Zh()),!zy.value||!de))return da(C),void(B&&fr(C,!0));if(C<Bn.value&&!Nt.value||Qh.value.has(C))return da(C),void fr(C,!0);if(!B)return void da(C);da(C);const K=de(B,{rootMargin:"400px"});if(!K)return;na.set(C,K),fr(C,K.isVisible.value),cr.value&&(function(he){if(!we||!cr.value)return;Sd(he);const ke=he%17*23,Se=window.setTimeout(()=>{if(Qy.delete(he),!cr.value||Qh.value.has(he))return;const Pe=Os.get(he);if(!Pe)return;const Ee=ne(Pe),We=Pe.ownerDocument||document,De=We.defaultView||window,$e=!Ee||Ee===We.documentElement||Ee===We.body,He=!$e&&Ee?mt("nodeVisibilityFallback.root.getBoundingClientRect",()=>Ee.getBoundingClientRect()):null,Qe=$e?0:He.top,Ze=$e?mt("nodeVisibilityFallback.clientHeight",()=>{var lt,ct;return(ct=(lt=De.innerHeight)!=null?lt:Ee?.clientHeight)!=null?ct:0}):He.bottom,_t=mt("nodeVisibilityFallback.node.getBoundingClientRect",()=>Pe.getBoundingClientRect());_t.bottom>=Qe-500&&_t.top<=Ze+500&&fr(he,!0)},1800+ke);Qy.set(he,Se)})(C);let ee=null;ee=Ke(()=>K.isVisible.value,he=>{if(he){Sd(C),fr(C,!0),ee?.(),wd.delete(C),na.get(C)===K&&na.delete(C);try{K.destroy()}catch{}}},{immediate:!0}),wd.set(C,ee),Nt.value&&_i()}function $m(){wo=null;for(const[C,B]of Li)Li.delete(C),ki.get(C)===B.el&&dl.get(C)===B.version&&Fy(C,B.height,{allowShrink:B.allowShrink})}function fa(){wo!=null&&(Oe?.(wo),wo=null),Li.clear()}function Id(C,B){(function(V,K,ee){var he;if(!Number.isFinite(ee)||ee<=0||ki.get(V)!==K)return;const ke=dl.get(V);if(ke==null)return;const Se=st.value[V],Pe=Y.value&&j.value!==!0&&!((he=s.nodes)!=null&&he.length)&&V>=st.value.length-2,Ee=!(Se?.loading===!0||Pe),We=Li.get(V),De=We?We.allowShrink&&Ee:Ee,$e=We&&!De?Math.max(We.height,ee):ee;Li.set(V,{height:$e,allowShrink:De,version:ke,el:K}),wo==null&&(wo=pe?pe($m):null,wo==null&&$m())})(C,B,Hy(C,B))}function Pi(){for(const[C,B]of ki)B&&Id(C,B)}function Mk(){Ne?.disconnect(),Ne=null,ft.clear()}function Nm(){for(;yd.length;)_d(yd.pop())}Ke(us,C=>{C&&An("content")},{flush:"post"}),t({getVirtualMetrics:hl,captureVirtualState:function(C={}){var B;return la(hl("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:C.allowFallbackAnchor===!0,requireViewport:C.requireViewport===!0,includeEmptyState:(B=C.includeEmptyState)==null||B})},restoreVirtualState:function(C,B={}){const V=B.restoreAnchor===!0,K=B.restoreToken==null?"imperative":String(B.restoreToken);Tc=C,Mc={restoreAnchor:V,restoreToken:K,allowUncapturedAnchor:B.allowUncapturedAnchor===!0},!km(C,{restoreAnchor:V,restoreToken:K,allowUncapturedAnchor:B.allowUncapturedAnchor===!0})&&_k(C)||(Tc=null,Mc=null)},forceMeasure:function(C="manual"){return zn(this,null,function*(){yield ht(),yield wk(),Pi(),Ec(),yield ht();const B=hl(C);return Tm(B,!0),B})},settle:wm,scrollToNode:function(C,B="start"){aa(),nn();const V=st.value.length;if(V<=0)return;const K=As(C,0,V-1),ee=()=>{var he;const ke=Fo({nodeIndex:K,offsetWithinNodePx:0}),Se=Cd(K),Pe=xc(),Ee=(he=Pe?.clientHeight)!=null?he:0,We=qt();let De=ke;if(B==="center")De=ke-Ee/2+Se/2;else if(B==="end")De=ke-Ee+Se;else if(B==="nearest"&&We!=null){if(ke>=We&&ke+Se<=We+Ee)return;De=ke<We?ke:ke-Ee+Se}Bo(Math.max(0,De)),_i({immediate:!0}),Nt.value&&(Ho.value=K,ul())};if(Nt.value)return Ho.value=K,ul(),void ht(ee);ee()}}),Ke(()=>Xe.value,C=>{if(!C){Mk();for(const B of ur.values())for(const V of B)_d(V);ur.clear(),dl.clear(),Nm(),fa()}},{immediate:!0}),Ke(j,C=>{C&&(function(){if(we&&j.value&&ki.size){Nm();for(const B of[80,240,640]){const V=Yy(B,()=>{for(const[K,ee]of ki)ee&&Id(K,ee)},"final");V!=null&&yd.push(V)}}})(),An(C?"final":"content")}),Ke([()=>st.value.length,()=>_s.value],()=>{Be.value&&ca(),An("content")},{flush:"post",immediate:!0}),Ke([()=>xs.start,()=>xs.end],()=>{An("batch")},{flush:"post"});const{cleanupBatchScheduler:G4}=(function(C){const{props:B,isClient:V,isTestEnv:K,parsedNodesIdentity:ee,parsedNodeCount:he,desiredRenderedCount:ke,datasetKey:Se,batchingEnabled:Pe,incrementalRenderingActive:Ee,resolvedBatchSize:We,resolvedInitialBatch:De,renderedCount:$e,adaptiveBatchSize:He,previousRenderContext:Qe,previousBatchConfig:Ze,requestFrame:_t,cancelFrame:lt,hasIdleCallback:ct,cleanupNodeVisibility:St,onDatasetKeyChanged:wt,onDatasetChanged:Zt}=C;let xt=null,Bt=null,Rt=!1,ln=null,Co=null,js=0,ri=!1,hr=!1;const mr=new Set,bl=new Set;function Vk(){if(V){xt!=null&&(lt?.(xt),xt=null),Bt!=null&&(window.clearTimeout(Bt),Bt=null),Co!=null&&typeof window.cancelIdleCallback=="function"&&(window.cancelIdleCallback(Co),Co=null),js+=1;for(const Rs of mr)lt?.(Rs);mr.clear();for(const Rs of bl)window.clearTimeout(Rs);bl.clear(),Rt=!1,ln=null,ri=!1,hr=!1}}function Dd(){return typeof performance<"u"?performance.now():Date.now()}function Kk(Rs){(function(Ri){var gr;if(!Ee.value)return;const Di=Math.max(2,(gr=B.renderBatchBudgetMs)!=null?gr:6),Bi=Math.max(1,We.value||1),li=Math.max(1,Math.floor(Bi/4));Ri>1.2*Di?He.value=Math.max(li,Math.floor(.7*He.value)):Ri<.5*Di&&He.value<Bi&&(He.value=Math.min(Bi,Math.ceil(1.2*He.value)))})(Rs),ri=!1;const io=hr||$e.value<ke.value;hr=!1,io&&Xk()}function Gk(Rs,io={}){var Ri,gr;if(!Ee.value)return;const Di=ke.value;if($e.value>=Di)return;const Bi=Math.max(1,Rs),li=()=>{const ma=Dd();let ga=0;xt=null,Bt=null,Co=null,Rt=!1;const va=ln??Bi;ln=null;const Hm=Dd();$e.value=Math.min(Di,$e.value+va),St($e.value),ga=Dd()-Hm,(function(Wm,Qk){if(!V)return void Kk(Qk);ri=!0;const Zk=++js;ht().then(()=>{var Jk;if(Zk!==js)return;const hE=Dd(),mE=Math.max(Qk,hE-Wm),eb=()=>{Zk===js&&Kk(mE)};if(_t){let nb=!1,Fi=null;const sb=()=>{nb||(nb=!0,eb())},Bd=_t(()=>{mr.delete(Bd),Fi!=null&&(window.clearTimeout(Fi),bl.delete(Fi),Fi=null),sb()});return mr.add(Bd),Fi=window.setTimeout(()=>{Fi!=null&&bl.delete(Fi),Fi=null,lt?.(Bd),mr.delete(Bd),sb()},Math.max(32,(Jk=B.renderBatchIdleTimeoutMs)!=null?Jk:120)),void bl.add(Fi)}const tb=window.setTimeout(()=>{bl.delete(tb),eb()},0);bl.add(tb)})})(ma,ga)};if(!V||io.immediate)return void li();const vr=Math.max(0,(Ri=B.renderBatchDelay)!=null?Ri:16);if(ln=ln!=null?Math.max(ln,Bi):Bi,!Rt){if(Rt=!0,!K&&ct&&window.requestIdleCallback){const ma=Math.max(0,(gr=B.renderBatchIdleTimeoutMs)!=null?gr:120);return void(Co=window.requestIdleCallback(()=>li(),{timeout:ma}))}_t&&!K?xt=_t(()=>{vr!==0?Bt=window.setTimeout(()=>li(),vr):li()}):Bt=window.setTimeout(()=>li(),vr)}}function Yk(Rs,io={}){ri?hr=!0:Rs==null?Xk():Gk(Rs,io)}function Xk(){Ee.value&&Gk(Pe.value?Math.max(1,Math.round(He.value)):Math.max(1,We.value))}return Ke([ee,he,Se,Ee,We,De,()=>B.renderBatchDelay],()=>{var Rs;const io=he.value,Ri=Qe.value,gr=Se.value,Di=!Object.is(gr,Ri.key),Bi=io!==Ri.total,li=Di||Bi;Qe.value={key:gr,total:io};const vr=Ze.value,ma=(Rs=B.renderBatchDelay)!=null?Rs:16,ga=vr.batchSize!==We.value||vr.initial!==De.value||vr.delay!==ma||vr.enabled!==Ee.value;Ze.value={batchSize:We.value,initial:De.value,delay:ma,enabled:Ee.value},Di&&wt(io),(li||ga||!Ee.value)&&Vk(),(li||ga)&&(He.value=Math.max(1,We.value||1)),li&&Zt();const va=ke.value;if(!io)return $e.value=0,void St(0);if(!Ee.value)return $e.value=va,void St($e.value);const Hm=Di||Ri.total===0;$e.value=Hm||ga?Math.min(va,De.value):Math.min($e.value,va);const Wm=Math.max(1,De.value||We.value||io);$e.value<va?Yk(Wm,{immediate:!V}):St($e.value)},{immediate:!0}),Ke(ke,(Rs,io)=>{Ee.value&&(typeof io=="number"&&Rs<=io||Rs>$e.value&&Yk())}),{cleanupBatchScheduler:Vk}})({props:k,isClient:we,isTestEnv:Wt,parsedNodesIdentity:_n,parsedNodeCount:Kn,desiredRenderedCount:kd,datasetKey:H4,batchingEnabled:bo,incrementalRenderingActive:ii,resolvedBatchSize:ds,resolvedInitialBatch:Bn,renderedCount:_s,adaptiveBatchSize:ll,previousRenderContext:ta,previousBatchConfig:al,requestFrame:pe,cancelFrame:Oe,hasIdleCallback:Qt,cleanupNodeVisibility:O4,onDatasetKeyChanged:C=>{fa(),vd(),Wo(),Lc(),C>0&&md(C)},onDatasetChanged:()=>{Nt.value&&_i({immediate:!0})}});Ke([Uy,Nt,()=>S.value,()=>ye()],([C,B])=>{if(!C)return Zy(),void Xh();P4(),B?_i({immediate:!0}):Xh()},{flush:"post",immediate:!0}),Ke([()=>st.value.length,()=>Nt.value],C=>zn(null,[C],function*([B,V]){V&&B&&we&&(yield ht(),_i({immediate:!0}))}),{flush:"post"}),Ke(Xt,C=>{C&&(function(){var B;if($n.value&&Ge.value&&Ye.value&&((B=Ct.value)!=null&&B[1]))return;const V=Dr({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),K=Dr({type:"list_item",children:[V],raw:"- Probe paragraph text"}),ee=Dr({type:"list",ordered:!1,items:[K],raw:"- Probe paragraph text"});$n.value=V,Ge.value=K,Ye.value=ee;const he={1:null,2:null,3:null,4:null,5:null,6:null};for(let ke=1;ke<=6;ke++)he[ke]=Dr({type:"heading",level:ke,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(ke)} Probe heading`});Ct.value=he})()},{immediate:!0}),Ke([()=>S.value,Xt],()=>{if(!Xt.value)return em(),void(X.value=0);ek(),em(),Xt.value&&S.value&&typeof ResizeObserver<"u"&&(Sc=new ResizeObserver(()=>{ek(),Vt.value&&Jn(),Be.value&&ca(),An("resize")}),Sc.observe(S.value))},{immediate:!0}),Ke([Xt,qs,So],()=>zn(null,null,function*(){if(!Xt.value)return fe.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Wo();yield ht(),(function(){if(!Xt.value||typeof window>"u")return fe.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Wo();const C={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},B=Jy(Jh(I.value),".paragraph-node");C.paragraph=jg(I.value,B,"pre-wrap");const V=Jh(P.value),K=V?.querySelector(".paragraph-node");C.listItem=jg(P.value,K,"pre-wrap");const ee=mt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var ke,Se;return(Se=(ke=D.value)==null?void 0:ke.offsetHeight)!=null?Se:0}),he=mt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var ke,Se;return(Se=(ke=P.value)==null?void 0:ke.offsetHeight)!=null?Se:0});C.listWrapperOverhead=Math.max(0,ee-he);for(let ke=1;ke<=6;ke++){const Se=Jy(Jh(W[ke]),`h${ke}`);C.headings[ke]=jg(W[ke],Se,"pre-wrap")}fe.value=C,Wo()})()}),{flush:"post",immediate:!0}),Ke(()=>st.value.length,()=>{Nt.value&&_i({immediate:!0})}),Ke([Xt,X],()=>{Wo(),Nt.value&&_i({immediate:!0}),Vt.value&&Jn(),Be.value&&ca(),An("resize")},{immediate:!1}),Ke(()=>cr.value,C=>{if(C)for(const[B,V]of Os)Tk(B,V);else{Zh();for(const[B,V]of Os)V&&fr(B,!0)}},{immediate:!1}),Ke([()=>k.viewportPriority,()=>st.value.length],([C,B])=>{C!==!1?z.value&&B<=200&&(z.value=!1):z.value=!1}),Ke(()=>_s.value,()=>{Nt.value&&_i({immediate:!0})}),Ke([Ho,oo,wc,()=>st.value.length,Nt],()=>{ul()},{immediate:!0});let Pc=null,Rc=!1,pa=null;function Dc(){Pc=null,cm=null,am=void 0,ra=null,Lc()}function Lm(){fa(),vd(),Wo(),ws.clear();const C=st.value.length;C>0&&md(C),bm()}function Om(){Mm(),Xy(),Ic=null,ml=null,gl=null,Md=null,Tc=null,Mc=null,Rc=!1,Dc(),ck("restore"),nn(),aa()}function Bc(C){var B;return[(B=ps())!=null?B:"",On(),Oi(),xd.value,Nc(C),st.value.length,Math.round(pr(0,st.value.length)),Math.round(pl()),Cs.count,Math.round(Cs.total)].join(":")}function Ek(){return zn(this,null,function*(){var C,B,V,K;const ee=(C=s.virtualScroll)==null?void 0:C.settledToken,he=Nc(ee),ke=On(),Se=ps(),Pe=So.value;if(Mt.value&&((B=s.virtualScroll)==null?void 0:B.settleMode)==="manual"&&Ad(ee))if(um()){if(Bc(ee)!==ra&&!Rc){Rc=!0;try{const Ee=yield wm({reason:"manual",expectedSettledTokenKey:he}),We=Nc()===he;_m(ke,Se,Pe)&&Ee.sessionKey===ke&&Ee.threadKey===Se&&We&&Ee.stable&&Ee.phase==="final"&&(ra=Bc((V=s.virtualScroll)==null?void 0:V.settledToken))}finally{Rc=!1,yield ht();const Ee=(K=s.virtualScroll)==null?void 0:K.settledToken,We=Ad(Ee)?Bc(Ee):"";_m(ke,Se,Pe)&&We&&ra!==We&&Ek()}}}else An("manual")})}Ke(Mt,(C,B)=>{if(C!==B){if(!C)return Om(),void Mm();Om(),Lm(),pa=So.value,An("content")}},{flush:"post"}),Ke([Mt,So],([C,B])=>{C?pa!=null?pa!==B&&(pa=B,(function(V="resize"){fa(),vd(),Wo(),ws.clear();const K=st.value.length;K>0&&md(K),bm(),ml=null,gl=null,Md=null,Ic=null,Rc=!1,Dc(),bk(),ht(()=>{Pi(),Vt.value&&Jn(),Be.value&&ca(),An(V)})})("resize")):pa=B:pa=null},{flush:"post",immediate:!0}),Ke([Mt,()=>On(),()=>ps()],([C])=>{C&&(Om(),Lm(),ck("content"),An("content"))}),Ke([Mt,()=>On(),()=>ps(),So,()=>st.value.length],([C])=>{C&&(function(B="async-node"){let V=!1;for(const[K,ee]of Array.from(bi.entries()))rm(ee)||(bi.delete(K),_o.delete(K),V=!0);V&&(oa(),An(B))})("async-node")},{flush:"post"}),Ke([Mt,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.sessionKey},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey},()=>s.indexKey,()=>Q.value],([C])=>{C&&(Lc(),(function(B="content"){if(!Mt.value)return;const V=[],K=st.value.length;for(const ee of Array.from(ws.keys())){if(ee>=K){V.push(ee);continue}const he=Ac(ee),ke=ws.get(ee);ke!=null&&ke!==he&&V.push(ee),ws.set(ee,he)}for(const ee of Array.from(ws.keys()))ee>=K&&ws.delete(ee);V.length&&((function(ee,he={}){const ke=Array.from(ee,Number);I4(ke,he)>0&&(function(Pe){for(const Ee of Pe)ws.delete(Ee)})(ke)})(V,{notify:!1}),Wo(),Dc(),Vt.value&&Jn(),Be.value&&ca(),An(B))})("content"))},{flush:"post",immediate:!0}),Ke([Mt,()=>st.value.length,()=>On(),()=>ps()],([C,B,V,K],[ee,he,ke,Se])=>{C&&ee&&V===ke&&K===Se&&B!==he&&Dc()},{flush:"post"}),Ke([Mt,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.heightCache},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.heightCacheWidth},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreState},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey},()=>st.value.length,()=>On(),X],()=>{bk()},{flush:"post",immediate:!0}),Ke([Mt,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreState},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreAnchor},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey},()=>st.value.length,()=>On(),X],C=>zn(null,[C],function*([B,V]){if(!B||!V)return;yield ht();const K=(function(){var ee;const he=(ee=s.virtualScroll)==null?void 0:ee.restoreAnchor;return he==null||he===!1?null:he===!0?"true":String(he)})();km(V,{restoreAnchor:K!=null,restoreToken:K??void 0})}),{flush:"post",immediate:!0}),Ke([Mt,X,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreState},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey}],([C])=>{var B;if(!C)return;const V=(B=s.virtualScroll)==null?void 0:B.restoreState;V&&ml&&gl==="restore"&&(yk(V)||(Lm(),ml=null,gl=null,An("resize")))},{flush:"post"}),Ke([Mt,()=>st.value.length,()=>On(),X],C=>zn(null,[C],function*([B]){var V;const K=Tc,ee=Mc;B&&K&&(yield ht(),!km(K,{restoreAnchor:ee?.restoreAnchor===!0,restoreToken:(V=ee?.restoreToken)!=null?V:"imperative",allowUncapturedAnchor:ee?.allowUncapturedAnchor===!0})&&_k(K)||(Tc=null,Mc=null))}),{flush:"post",immediate:!0}),Ke([Mt,j,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.settleMode},()=>On(),()=>ps(),So,Gh,jy,()=>_s.value,kd,()=>Cs.count,()=>Cs.total],([C,B,V])=>{if(!C||B!==!0||V==="manual"||!dm())return;const K=(function(){var ee;const he=st.value.length;return[(ee=ps())!=null?ee:"",On(),Oi(),xd.value,he,Math.round(pr(0,he)),Math.round(pl()),Cs.count,Math.round(Cs.total)].join(":")})();Pc!==K&&(Pc=K,wm({reason:"final"}).then(ee=>{ee.stable||Pc!==K||(Pc=null)}))},{flush:"post",immediate:!0}),Ke([Mt,j,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.settleMode},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.settledToken},()=>On(),()=>ps(),So,Gh,jy,()=>_s.value,kd,()=>st.value.length,()=>Cs.count,()=>Cs.total],()=>{Ek()},{flush:"post",immediate:!0}),Ke([()=>st.value.length,Nt,oo,wc,()=>xs.start,()=>xs.end],([C,B,V,K,ee,he])=>{Ue.value&&Te("virtualization",{nodes:C,virtualization:B,maxLiveNodes:V,buffer:K,focusIndex:Ho.value,scroll:B?(()=>{const ke=xe.value||ne();return ke?{reverse:H(ke),scrollTop:Math.round(ke.scrollTop),scrollTopAbs:Math.round(Math.abs(ke.scrollTop)),scrollHeight:Math.round(ke.scrollHeight),clientHeight:Math.round(ke.clientHeight)}:null})():null,liveRange:{start:ee,end:he},rendered:_s.value})}),Ke([()=>k.customId],([C],B,V)=>{if(!C||$t)return;const K=(function(ee,he){return ee?(hs.controllers[ee]=he,()=>{hs.controllers[ee]===he&&delete hs.controllers[ee]}):()=>{}})(C,{captureRestoreAnchor:Fn,restoreAnchor:Ss,getAnchorDrift:Ps,getReport:D4});V(()=>{K()})},{immediate:!0}),ls(()=>{(function(){if(Mt.value)try{Pi(),Ec();const C=hl("manual");Sk(C)&&(E(C),Ic=C,Cm=$c());const B=la(C,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});B&&(M(B),B.anchor&&L(B.anchor),ua=Oc(B))}catch{}})(),G4(),Zh(),Ie(),Mk();for(const C of ur.values())for(const B of C)_d(B);ur.clear(),dl.clear(),ws.clear(),Nm(),fa(),em(),nn(),aa(),Mm(),Zy(),Xh()});const Y4=ui({loader:()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./index11-Dto_yZNz.js"),__vite__mapDeps([8,5]))).default}catch(C){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',C),xo}}),loadingComponent:RV,delay:0}),X4=ui({loader:()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./index10-CNr4U-Nw.js"),[])).default}catch(C){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',C),xo}}),loadingComponent:PV,delay:0}),Q4=ui(()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./index7-Dz9oCsUF.js"),[])).default}catch(C){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',C),xo}})),Ik={text:Xn,paragraph:ql,heading:Rp,code_block:Dg,list:nc,list_item:tc,blockquote:Of,table:wu,definition_list:Pf,footnote:Rf,footnote_reference:$o,footnote_anchor:bu,admonition:Hf,vmr_container:Bf,hardbreak:jr,link:to,image:qr,thematic_break:Df,math_inline:gi,math_block:QM,strong:Js,emphasis:no,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,checkbox:Io,checkbox_input:Io,inline_code:Us,html_inline:No,reference:Zs,html_block:_u},Z4=F(()=>om()),$k=F(()=>gS(k.codeBlockProps)),J4=F(()=>gS(k.codeBlockProps,{omit:["langs"]})),Nk=F(()=>it(it({stream:k.codeBlockStream,darkTheme:k.codeBlockDarkTheme,lightTheme:k.codeBlockLightTheme,monacoOptions:k.codeBlockMonacoOptions,themes:k.themes,langs:u.value==="shiki"?k.langs:void 0,minWidth:k.codeBlockMinWidth,maxWidth:k.codeBlockMaxWidth},typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{}),J4.value)),Lk=F(()=>it(Lt(it({},Nk.value),{langs:k.langs}),$k.value));function Ok(C){return typeof C=="boolean"?C:void 0}const eE=F(()=>{const C=k.codeBlockProps||{},B={},V=Ok(C.showLineNumbers);V!==void 0&&(B.showLineNumbers=V);const K=Ok(C.diffInline);K!==void 0&&(B.diffInline=K);const ee=(function(he){const ke=Number(he);return Number.isFinite(ke)&&ke>0?ke:void 0})(C.reservedHeightPx);return ee!==void 0&&(B.reservedHeightPx=ee),B}),tE=F(()=>it(it({stream:k.codeBlockStream,darkTheme:k.codeBlockDarkTheme,lightTheme:k.codeBlockLightTheme,themes:k.themes,langs:k.langs,minWidth:k.codeBlockMinWidth,maxWidth:k.codeBlockMaxWidth},typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{}),$k.value)),nE=F(()=>it({},k.mermaidProps||{})),Pk=F(()=>it({},k.d2Props||{})),sE=F(()=>it({},k.infographicProps||{})),Fc=F(()=>({typewriter:k.typewriter,fade:k.fade,customHtmlTags:Vn.value.customHtmlTags})),oE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltip:Fe.value}:{})),iE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{})),rE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{})),lE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{}));function aE(C){return Array.isArray(C.children)&&C.children.length>0}const Pm=F(()=>R4.value.map(C=>{var B,V,K,ee,he,ke,Se,Pe;let Ee=(function(lt){var ct,St,wt,Zt,xt,Bt,Rt;if(lt.type!=="code_block")return lt;const ln=lt,Co=[String((ct=ln.language)!=null?ct:""),String((St=ln.loading)!=null?St:""),String((wt=ln.diff)!=null?wt:""),String((Zt=ln.code)!=null?Zt:""),String((xt=ln.originalCode)!=null?xt:""),String((Bt=ln.updatedCode)!=null?Bt:""),String((Rt=ln.raw)!=null?Rt:"")].join("\0"),js=xn.get(ln);if(js&&js.signature===Co)return js.node;const ri=it({},ln);return xn.set(ln,{signature:Co,node:ri}),ri})(C.node);const We=$d(Ee);let De=Fk(Ee,We);if((Ee.type==="html_block"||Ee.type==="html_inline")&&De===Ik[Ee.type]){const lt=Ee,ct=String((B=lt.tag)!=null?B:"").trim().toLowerCase()||WT(lt.content);if(ct){const St=Ft.value[ct];if(bn.value.has(ct)&&St)De=St,Ee=Lt(it({},lt),{type:ct,tag:ct,content:Z9(lt.content,ct)});else if(zT((V=lt.content)!=null?V:lt.raw,ct)){const wt=String((ee=(K=lt.content)!=null?K:lt.raw)!=null?ee:"");Ee.type==="html_inline"?(De=Xn,Ee={type:"text",content:wt,raw:wt}):(De=ql,Ee={type:"paragraph",children:[{type:"text",content:wt,raw:wt}],raw:wt})}}}const $e=Ee.type==="code_block"&&u.value==="pre"&&De===xo&&!Rm(Ft.value,We);let He=it({},(function(lt,ct,St){const wt=ct??$d(lt);if(lt.type==="code_block"){const Zt=wt?Rm(Ft.value,wt):void 0;if(St&&u.value==="pre"&&!Zt&&St===xo)return eE.value;if(St&&wt&&St===Zt)return wt==="mermaid"?Dk(lt):wt==="infographic"?Bk(lt):wt==="d2"||wt==="d2lang"?Pk.value:Lk.value;if(St&&St===Ft.value.code_block)return Lk.value;if(nk(St))return tE.value}return wt==="mermaid"?Dk(lt):wt==="infographic"?Bk(lt):wt==="d2"||wt==="d2lang"?Pk.value:lt.type==="link"?oE.value:lt.type==="list"?iE.value:lt.type==="blockquote"?rE.value:lt.type==="table"?lE.value:lt.type==="code_block"?Nk.value:Fc.value})(Ee,We,De));const Qe=fl.value[C.index];Ee.type==="code_block"&&Qe?.kind==="code-block"&&(He=Lt(it({},He),$e?{reservedHeightPx:(he=Qe.height)!=null?he:Qe.contentHeight}:{estimatedHeightPx:Qe.height,estimatedContentHeightPx:Qe.contentHeight})),$e||Ee.type!=="code_block"||We!=="mermaid"||Ha(He.estimatedPreviewHeightPx)!=null||(He=Lt(it({},He),{estimatedPreviewHeightPx:m1(p1(String((ke=Ee.code)!=null?ke:"")))})),$e||Ee.type!=="code_block"||We!=="infographic"||Ha(He.estimatedPreviewHeightPx)!=null||(He=Lt(it({},He),{estimatedPreviewHeightPx:g1(h1(String((Se=Ee.code)!=null?Se:"")))})),Ee.type==="math_block"&&(He=Lt(it({},He),{cacheScope:Dn.value}));const Ze=(function(lt,ct){const St=String(lt.type);return!dd(St)&&Ft.value[St]===ct})(Ee,De),_t=Ze?ay(Ee,rt.value):void 0;return Lt(it({},C),{node:Ee,component:De,bindings:He,customBindings:it(it({},_t??{}),He),rendersCustomNode:Ze,hasSlotChildren:aE(Ee),slotContent:String((Pe=Ee.content)!=null?Pe:""),isCodeBlock:Ee.type==="code_block",indexKey:`${Z4.value}-${C.index}`})}));function $d(C){var B;return C?.type==="code_block"?String((B=C.language)!=null?B:"").trim().toLowerCase():""}function Rm(C,B){const V=B.trim().toLowerCase();if(V)for(const K of[V,ty(V),RM(V)]){const ee=K&&C[K];if(ee)return ee}}function Rk(C,B,V,K){var ee,he;const ke=it({},C.value);return Ha(ke.estimatedPreviewHeightPx)==null&&(ke.estimatedPreviewHeightPx=K(V(String((ee=B?.code)!=null?ee:"")),void 0,ke.maxHeight==="none"?null:(he=Ha(ke.maxHeight))!=null?he:void 0)),ke}function Dk(C){return Rk(nE,C,p1,m1)}function Bk(C){return Rk(sE,C,h1,g1)}function Fk(C,B){if(!C)return A1;const V=Ft.value,K=V[String(C.type)];if(C.type==="code_block"){const ee=B??$d(C),he=ee?Rm(V,ee):void 0;return he||(u.value==="pre"?V.code_block||xo:ee==="mermaid"?V.mermaid||Y4:ee==="infographic"?V.infographic||X4:ee==="d2"||ee==="d2lang"?V.d2||Q4:K||V.code_block||sk.value)}return K||Ik[String(C.type)]||A1}function Dm(C){o("click",C)}function cE(C){var B;(B=C.target)!=null&&B.closest("[data-node-index]")&&o("mouseover",C)}function uE(C){var B;(B=C.target)!=null&&B.closest("[data-node-index]")&&o("mouseout",C)}function Hk(C){o("mouseover",C)}function Wk(C){o("mouseout",C)}const kl=Z(null),wi=Z(!1);let Hc,ha=null,Bm=0,Nd=0,Ld=0;const zk=["code_block","admonition","table","math_block","html_block","image","thematic_break"],dE=new Set(zk),Uk=[".typewriter-cursor",".height-estimation-probes",...zk.map(C=>`[data-node-type="${C}"]`),"script","style"].join(",");function qk(C){if(!C||typeof C!="object")return!1;const B=C.type;return typeof B=="string"&&dE.has(B)}function Od(C){var B,V;if(!C||typeof C!="object")return 0;const K=C,ee=(V=(B=K.raw)!=null?B:K.content)!=null?V:K.code;if(typeof ee=="string")return ee.length;const he=K.children;if(Array.isArray(he))return he.reduce((Se,Pe)=>Se+Od(Pe),0);const ke=K.items;return Array.isArray(ke)?ke.reduce((Se,Pe)=>Se+Od(Pe),0):0}function Pd(){Hc&&(clearTimeout(Hc),Hc=void 0)}function jk(){Bm+=1,ha!=null&&(Oe?.(ha),ha=null)}function Rd(){jk(),kl.value&&(kl.value.style.visibility="hidden")}function fE(C){var B;if(C.nodeType!==Node.TEXT_NODE||!((B=C.textContent)!=null?B:"").trim())return!1;const V=C.parentElement;return!!V&&!V.closest(Uk)}function pE(C){let B=C.lastChild;for(;B;){if(fE(B))return B;if(B.nodeType===Node.ELEMENT_NODE){const V=B;if(!V.matches(Uk)&&V.lastChild){B=V.lastChild;continue}}for(;B&&B!==C&&!B.previousSibling;)B=B.parentNode;if(!B||B===C)break;B=B.previousSibling}return null}function Fm(){if(!we||!wi.value||ha!=null)return;const C=Bm,B=()=>{ha=null,C===Bm&&(function(){var V,K;if(!(we&&wi.value&&S.value&&kl.value))return;const ee=S.value,he=kl.value;he.style.visibility="hidden";const ke=(function(){const De=Pm.value;for(let $e=De.length-1;$e>=0;$e--){const He=De[$e];if(!He||qk(He.node)||!Im(He.index))continue;const Qe=Os.get(He.index);if(!Qe)continue;const Ze=pE(Qe);if(Ze)return Ze}return null})();if(!ke)return;let Se=0,Pe=0,Ee=20,We=!1;if(ke?.textContent){const De=ke.textContent.length,$e=document.createRange();$e.setStart(ke,Math.max(0,De-1)),$e.setEnd(ke,De);const He=typeof $e.getClientRects=="function"?$e.getClientRects():void 0,Qe=(K=He?.[He.length-1])!=null?K:(V=ke.parentElement)==null?void 0:V.getBoundingClientRect();if(Qe){const Ze=mt("typewriterCursor.root.getBoundingClientRect",()=>ee.getBoundingClientRect());Se=Qe.right-Ze.left+ee.scrollLeft,Pe=Qe.top-Ze.top+ee.scrollTop,Ee=Qe.height||Ee,We=!0}$e.detach()}We&&(he.style.transform=`translate(${Math.max(0,Se)}px, ${Math.max(0,Pe)}px)`,he.style.height=`${Ee}px`,he.style.visibility="visible")})()};pe?ha=pe(B):B()}return Ke([ue,()=>s.content,()=>s.nodes,()=>k.typewriter,j],()=>zn(null,null,function*(){var C,B;if(!we||ze.value||!U.value)return;if(j.value)return wi.value=!1,Pd(),void Rd();if((C=s.nodes)!=null&&C.length)return wi.value=!1,Pd(),Rd(),Nd=((B=s.content)!=null?B:"").length,void(Ld=ue.value.length);const V=(function(){var Se,Pe;return(Se=s.nodes)!=null&&Se.length?s.nodes.reduce((Ee,We)=>Ee+Od(We),0):((Pe=s.content)!=null?Pe:"").length})(),K=(function(){var Se;return(Se=s.nodes)!=null&&Se.length?s.nodes.reduce((Pe,Ee)=>Pe+Od(Ee),0):ue.value.length})(),ee=!qk(st.value[st.value.length-1]),he=V>Nd,ke=K>Ld;if(k.typewriter===!1||!ee||!he&&!ke)return k.typewriter!==!1&&ee||(wi.value=!1,Rd()),Nd=V,void(Ld=K);Nd=V,Ld=K,wi.value=!0,kl.value&&(kl.value.style.visibility="hidden"),Pd(),yield ht(),Fm(),Hc=setTimeout(()=>{Hc=void 0,wi.value=!1},3e3)}),{flush:"post",immediate:!0}),Ke(wi,C=>zn(null,null,function*(){C?(yield ht(),Fm()):Rd()}),{flush:"post"}),Ke([()=>_s.value,()=>xs.start,()=>xs.end],()=>zn(null,null,function*(){we&&!ze.value&&U.value&&wi.value&&(yield ht(),Fm())}),{flush:"post"}),ls(()=>{Pd(),jk(),Rn.clear()}),(C,B)=>{const V=HI("NodeRenderer",!0);return x(ze)?(w(!0),N(Le,{key:0},nt(Pm.value,K=>(w(),N(Le,{key:K.index},[K.rendersCustomNode?(w(),ve(Hs(K.component),dn({key:0,ref_for:!0},K.customBindings,{node:K.node,loading:K.node.loading,"index-key":K.indexKey,"custom-id":k.customId,"is-dark":k.isDark,onClick:Dm,onMouseover:Hk,onMouseout:Wk,onCopy:B[0]||(B[0]=ee=>o("copy",ee)),onHandleArtifactClick:B[1]||(B[1]=ee=>o("handleArtifactClick",ee))}),{default:_e(()=>[K.hasSlotChildren?(w(),ve(V,dn({key:0,ref_for:!0},In.value,{nodes:K.node.children,"index-key":K.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):K.slotContent?(w(),ve(V,dn({key:1,ref_for:!0},In.value,{content:K.slotContent,final:!K.node.loading,"index-key":`${K.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Hs(K.component),dn({key:1,node:K.node,loading:K.node.loading,"index-key":K.indexKey},{ref_for:!0},K.bindings,{"custom-id":k.customId,"is-dark":k.isDark,onClick:Dm,onMouseover:Hk,onMouseout:Wk,onCopy:B[2]||(B[2]=ee=>o("copy",ee)),onHandleArtifactClick:B[3]||(B[3]=ee=>o("handleArtifactClick",ee))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(w(),N("div",{key:1,ref_key:"containerRef",ref:S,class:Re(["markstream-vue markdown-renderer",[{dark:k.isDark},{virtualized:Nt.value},{"virtual-scroll-coordinated":us.value}]]),"data-custom-id":k.customId,onClick:Dm,onMouseover:cE,onMouseout:uE},[oi.value||Nt.value?(w(),N(Le,{key:0},[oi.value?(w(),N("div",{key:0,class:"height-estimation-probes",style:Gt({width:`${qs.value}px`}),"aria-hidden":"true"},[T("div",{ref_key:"paragraphProbeWrapperRef",ref:I,class:"node-content","data-probe":"paragraph"},[oe(x(ql),{node:$n.value,"index-key":"probe-paragraph"},null,8,["node"])],512),T("div",{ref_key:"listItemProbeWrapperRef",ref:P,class:"node-content","data-probe":"list-item"},[T("ul",BV,[oe(x(tc),{node:Ge.value,"index-key":"probe-list-item"},null,8,["node"])])],512),T("div",{ref_key:"listProbeWrapperRef",ref:D,class:"node-content","data-probe":"list"},[oe(x(nc),{node:Ye.value,"index-key":"probe-list"},null,8,["node"])],512),(w(),N(Le,null,nt(6,K=>T("div",{key:`probe-heading-${K}`,ref_for:!0,ref:ee=>(function(he,ke){he<1||he>6||(W[he]=ke)})(K,ee),class:"node-content","data-probe":`heading-${K}`},[oe(x(Rp),{node:L4(K),"index-key":`probe-heading-${K}`},null,8,["node","index-key"])],8,FV)),64))],4)):ie("",!0),Nt.value?(w(),N("div",{key:1,class:"node-spacer",style:Gt({height:`${nm.value}px`}),"aria-hidden":"true"},null,4)):ie("",!0)],64)):ie("",!0),(w(!0),N(Le,null,nt(Pm.value,K=>(w(),N("div",{key:K.index,ref_for:!0,ref:ee=>Tk(K.index,ee),class:"node-slot","data-node-index":K.index,"data-node-type":K.node.type},[Im(K.index)?(w(),N("div",{key:0,ref_for:!0,ref:ee=>(function(he,ke){var Se;ke||(function(De){const $e=`${om()}-${De}`;let He=!1;for(const Qe of Array.from(_o.keys())){const Ze=bi.get(Qe);(Ze?.index===De||Qe===$e||Qe.startsWith(`${$e}-`))&&(_o.delete(Qe),bi.delete(Qe),He=!0)}He&&(oa(),An("async-node"))})(he),Li.delete(he),(function(De){var $e;const He=(($e=dl.get(De))!=null?$e:0)+1;dl.set(De,He)})(he);const Pe=ur.get(he);if(Pe){for(const De of Pe)_d(De);ur.delete(he)}if((function(De){const $e=ft.get(De);$e&&(Ne?.unobserve($e),me.delete($e),ft.delete(De))})(he),!ke||!Xe.value)return ki.delete(he),void dl.delete(he);ki.set(he,ke);const Ee=()=>{Id(he,ke)};queueMicrotask(Ee);const We=(Ne||typeof ResizeObserver>"u"||(Ne=new ResizeObserver(De=>{if(De.length)for(const $e of De){const He=me.get($e.target),Qe=ft.get(He??-1);He!=null&&Qe&&Id(He,Qe)}else Pi()})),Ne);if(We&&(ft.set(he,ke),me.set(ke,he),We.observe(ke)),typeof window<"u"){const De=((Se=st.value[he])==null?void 0:Se.type)==="code_block"?[16,80,240,800]:j.value?[80]:[];if(De.length){const $e=De.map(He=>Yy(He,Ee,"node-resize")).filter(He=>He!=null);$e.length&&ur.set(he,$e)}}})(K.index,ee),class:"node-content"},[K.isCodeBlock?K.rendersCustomNode?(w(),ve(Hs(K.component),dn({key:1,ref_for:!0},K.customBindings,{node:K.node,loading:K.node.loading,"index-key":K.indexKey,"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[8]||(B[8]=ee=>o("copy",ee)),onHandleArtifactClick:B[9]||(B[9]=ee=>o("handleArtifactClick",ee))}),{default:_e(()=>[K.hasSlotChildren?(w(),ve(V,dn({key:0,ref_for:!0},In.value,{nodes:K.node.children,"index-key":K.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):K.slotContent?(w(),ve(V,dn({key:1,ref_for:!0},In.value,{content:K.slotContent,final:!K.node.loading,"index-key":`${K.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Hs(K.component),dn({key:2,node:K.node,loading:K.node.loading,"index-key":K.indexKey},{ref_for:!0},K.bindings,{"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[10]||(B[10]=ee=>o("copy",ee)),onHandleArtifactClick:B[11]||(B[11]=ee=>o("handleArtifactClick",ee))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Gr,{key:0,name:"fade",css:k.fade!==!1,appear:k.fade!==!1},{default:_e(()=>[K.rendersCustomNode?(w(),ve(Hs(K.component),dn({key:0,ref_for:!0},K.customBindings,{node:K.node,loading:K.node.loading,"index-key":K.indexKey,"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[4]||(B[4]=ee=>o("copy",ee)),onHandleArtifactClick:B[5]||(B[5]=ee=>o("handleArtifactClick",ee))}),{default:_e(()=>[K.hasSlotChildren?(w(),ve(V,dn({key:0,ref_for:!0},In.value,{nodes:K.node.children,"index-key":K.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):K.slotContent?(w(),ve(V,dn({key:1,ref_for:!0},In.value,{content:K.slotContent,final:!K.node.loading,"index-key":`${K.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Hs(K.component),dn({key:1,node:K.node,loading:K.node.loading,"index-key":K.indexKey},{ref_for:!0},K.bindings,{"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[6]||(B[6]=ee=>o("copy",ee)),onHandleArtifactClick:B[7]||(B[7]=ee=>o("handleArtifactClick",ee))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(w(),N("div",{key:1,class:"node-placeholder",style:Gt({height:`${Cd(K.index)}px`})},null,4))],8,HV))),128)),wi.value?(w(),N("span",{key:1,ref_key:"typewriterCursorRef",ref:kl,class:"typewriter-cursor","aria-hidden":"true"},null,512)):ie("",!0),Nt.value?(w(),N("div",{key:2,class:"node-spacer",style:Gt({height:`${sm.value}px`}),"aria-hidden":"true"},null,4)):ie("",!0)],42,DV))}}})),[["__scopeId","data-v-2e8e6e17"]]),yo=u3;yo.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",yo.__name,yo.name].filter(n=>!!n));for(const n of t)e.component(n,u3)};const my=Object.freeze(Object.defineProperty({__proto__:null,default:yo},Symbol.toStringTag,{value:"Module"})),WV={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},zV={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},UV={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},qV={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},jV={class:"admonition-title"},VV=["aria-expanded","aria-controls"],KV=["id"],Hf=un(je({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const s=e,o=t,i=F(()=>{if(s.node.title&&s.node.title.trim().length)return s.node.title;const c=s.node.kind||"note";return c.charAt(0).toUpperCase()+c.slice(1)}),r=Z(!!s.node.collapsible&&!((n=s.node.open)==null||n));function l(){s.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(c,u)=>(w(),N("div",{class:Re(["admonition",[`admonition-${s.node.kind}`]])},[T("div",{id:a,class:"admonition-legend"},[s.node.kind==="note"||s.node.kind==="info"?(w(),N("svg",WV,[...u[1]||(u[1]=[T("circle",{cx:"12",cy:"12",r:"10"},null,-1),T("path",{d:"M12 16v-4"},null,-1),T("path",{d:"M12 8h.01"},null,-1)])])):s.node.kind==="tip"?(w(),N("svg",zV,[...u[2]||(u[2]=[T("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),T("path",{d:"M9 18h6"},null,-1),T("path",{d:"M10 22h4"},null,-1)])])):s.node.kind==="warning"||s.node.kind==="caution"?(w(),N("svg",UV,[...u[3]||(u[3]=[T("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),T("path",{d:"M12 9v4"},null,-1),T("path",{d:"M12 17h.01"},null,-1)])])):s.node.kind==="danger"||s.node.kind==="error"?(w(),N("svg",qV,[...u[4]||(u[4]=[T("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),T("path",{d:"M12 8v4"},null,-1),T("path",{d:"M12 16h.01"},null,-1)])])):ie("",!0),T("span",jV,R(i.value),1),s.node.collapsible?(w(),N("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(w(),N("svg",{style:Gt({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...u[5]||(u[5]=[T("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,VV)):ie("",!0)]),Mn(T("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[oe(x(yo),{"index-key":`admonition-${e.indexKey}`,nodes:s.node.children,"custom-id":s.customId,typewriter:s.typewriter,fade:s.fade,onCopy:u[0]||(u[0]=d=>o("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,KV),[[Qo,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Hf.install=e=>{e.component(Hf.__name,Hf)};const d3=()=>Xs(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let hf=null,GV=d3;function _he(){return zn(this,null,function*(){if(hf)return hf;const e=GV;if(!e)return null;let t;try{t=yield e()}catch(n){throw e===d3?new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.'):n}return t?(hf=(function(n){var s;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const o=(s=n.default)!=null?s:n;return typeof o=="function"?o:o?.D2&&typeof o.D2=="function"?o.D2:o})(t),hf):null})}function whe(){return!1}function She(){return zn(this,null,function*(){return null})}const mf=Z(!1);let TS=!1;function Kg(){const e=document.documentElement.dataset.colorScheme;return e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function YV(){return!TS&&typeof window<"u"&&typeof document<"u"&&(TS=!0,mf.value=Kg(),new MutationObserver(()=>{mf.value=Kg()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{mf.value=Kg()})),mf}const f3=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],XV=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),$1=[...f3].sort((e,t)=>t.length-e.length).join("|"),Gg=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${$1}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${$1})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),p3=/[),.;!?,。;!?)]+$/;function QV(e){const t=e.toLowerCase();return f3.some(n=>t.endsWith(`.${n}`))}function ZV(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${$1}))["']`,"gi");let s;for(;(s=n.exec(e))!==null;){const o=s[1];if(!o)continue;const i=o.split("/").pop();i&&t.set(i,o)}return t}function JV(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const s=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!s)return null;let o=(s[1]??"").replace(p3,"");if(!o)return null;const i=o.split("/").pop()??o,r=o.includes("/"),l=XV.has(i),a=QV(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;o=d}const c=s[2]??s[3],u=c?Number(c):void 0;return{path:o,line:u!==void 0&&Number.isFinite(u)&&u>0?u:void 0}}function eK(e,t={}){const n=[];Gg.lastIndex=0;let s;for(;(s=Gg.exec(e))!==null;){const o=s[0]??"",i=s[1]??"",r=o.indexOf(i);if(r<0)continue;const l=s[2]??s[3];let a=i+(l?o.slice(r+i.length):"");const c=a.replace(p3,""),u=a.length-c.length;a=c;const d=JV(a,t);if(!d)continue;const p=s.index+r,h=p+a.length;n.push({...d,start:p,end:h,text:a}),u>0&&(Gg.lastIndex-=u)}return n}const tK=12e4,nK=6e4,sK=32,oK=3e4,MS=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function iK(e){let t=0,n=0,s=0;MS.lastIndex=0;let o;for(;(o=MS.exec(e))!==null;){const r=o[3]??"";t+=1,n+=r.length,s=Math.max(s,r.length)}return{codeRenderer:e.length>=tK||n>=nK||t>=sK||s>=oK?"pre":"shiki",codeFenceCount:t,codeChars:n}}function rK(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function lK(e){return new Worker("/assets/mermaidParser.worker-PTFfzpoB.js",{type:"module",name:e?.name})}const aK={key:1,class:"diff-wrap"},cK={class:"diff-bar"},uK=["onClick"],dK={class:"diff-pre"},fK="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",ES="github-light",IS="github-dark",pK=je({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){qU(),sq(),VU(),aq(),jU(new rK),lq(new lK);function t(P){return P.inline.ruler.disable("math"),P}const{t:n}=It(),s=Ut("resolveImage"),o=Z(null),i=e,r=F(()=>!i.streaming),l=F(()=>ZV(i.text??"")),a=F(()=>i.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:iK(i.text??"")),c=YV(),u=F(()=>!i.streaming),d=$s(new Map),p=new Set,h=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,f=/(<img\b[^>]*?\bsrc=")([^"]+)(")/gi;function m(P){return!/^(https?:|data:|blob:)/i.test(P)}function b(P){if(!s)return;const D=[];for(const W of[h,f]){W.lastIndex=0;let z;for(;(z=W.exec(P))!==null;)D.push(z[2]??"")}for(const W of D)!W||!m(W)||d.has(W)||p.has(W)||(p.add(W),s(W).then(z=>{d.set(W,z!==W?z:"")}).catch(()=>{d.set(W,"")}).finally(()=>{p.delete(W)}))}function _(P){if(!s)return P;const D=W=>{if(!m(W))return null;const z=d.get(W);return z===void 0?fK:z===""?null:z};return P.replace(h,(W,z,q,Q)=>{const X=D(q);return X===null?W:`${z}${X}${Q}`}).replace(f,(W,z,q,Q)=>{const X=D(q);return X===null?W:`${z}${X}${Q}`})}Ke(()=>i.text,P=>b(P??""),{immediate:!0});function g(){if(!o.value||!i.openFile||i.streaming)return;const P=document.createTreeWalker(o.value,NodeFilter.SHOW_TEXT),D=[];let W=P.nextNode();for(;W;){const z=W,q=z.parentElement;q&&!q.closest("a, pre, .md-file-link, svg")&&z.data.trim().length>0&&D.push(z),W=P.nextNode()}for(const z of D){const q=eK(z.data,{aliases:l.value});if(q.length===0||!z.parentNode)continue;const Q=document.createDocumentFragment();let X=0;for(const fe of q){fe.start>X&&Q.append(document.createTextNode(z.data.slice(X,fe.start)));const ye=document.createElement("button");ye.type="button",ye.className="md-file-link",ye.textContent=fe.text,ye.title=fe.line?`${fe.path}:${fe.line}`:fe.path,ye.addEventListener("click",Me=>{Me.preventDefault(),Me.stopPropagation(),i.openFile?.({path:fe.path,line:fe.line})}),Q.append(ye),X=fe.end}X<z.data.length&&Q.append(document.createTextNode(z.data.slice(X))),z.parentNode.replaceChild(Q,z)}}function v(P){return!(!P||/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(P))}function y(P){let D=P.length;for(const W of["#","?"]){const z=P.indexOf(W);z!==-1&&z<D&&(D=z)}return P.slice(0,D)}function A(){if(!o.value||!i.openFile||i.streaming)return;const P=o.value.querySelectorAll("a[href]");for(const D of P){if(D.dataset.mdLinkHandled==="true"||D.closest("svg"))continue;const W=D.getAttribute("href")??"";v(W)&&(D.dataset.mdLinkHandled="true",D.addEventListener("click",z=>{z.preventDefault(),z.stopPropagation(),i.openFile?.({path:y(W)})}))}}function O(){ht().then(()=>{g(),A()})}Ke(()=>i.text,O),Ke(()=>i.streaming,O);let $=null;hn(()=>{O(),o.value&&($=new MutationObserver(O),$.observe(o.value,{childList:!0,subtree:!0}))}),kn(()=>{$?.disconnect()});const k={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1},E=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,M=F(()=>{const P=_(i.text??""),D=[];let W=0;E.lastIndex=0;let z;for(;(z=E.exec(P))!==null;){const Q=z[1]??"",X=P.slice(W,z.index)+(Q||"");X.trim()&&D.push({kind:"md",text:X}),D.push({kind:"diff",code:z[2]??""}),W=E.lastIndex}const q=P.slice(W);return(q.trim()||D.length===0)&&D.push({kind:"md",text:q}),D});function L(P){return P.split(`
|
|
246
|
-
`).map(D=>/^\+(?!\+\+)/.test(D)?{cls:"diff-add",text:D}:/^-(?!--)/.test(D)?{cls:"diff-del",text:D}:D.startsWith("@@")?{cls:"diff-hunk",text:D}:{cls:"diff-ctx",text:D})}const S=Z(null);function I(P,D){zs(P).then(W=>{W&&(S.value=D,setTimeout(()=>{S.value=null},1400))})}return(P,D)=>(w(),N("div",{ref_key:"mdRef",ref:o,class:"md"},[(w(!0),N(Le,null,nt(M.value,(W,z)=>(w(),N(Le,{key:z},[W.kind==="md"?(w(),ve(x(yo),{key:0,content:W.text,"custom-markdown-it":t,mode:"chat","code-renderer":a.value.codeRenderer,"is-dark":x(c),"code-block-light-theme":ES,"code-block-dark-theme":IS,themes:[ES,IS],"code-block-props":k,final:r.value,"smooth-streaming":e.streaming,"batch-rendering":u.value,"defer-nodes-until-visible":!1},null,8,["content","code-renderer","is-dark","themes","final","smooth-streaming","batch-rendering"])):(w(),N("div",aK,[T("div",cK,[D[0]||(D[0]=T("span",{class:"diff-lang"},"diff",-1)),oe(Ht,{text:x(n)("filePreview.copyCode")},{default:_e(()=>[T("button",{class:"diff-copy",onClick:q=>I(W.code,z)},R(S.value===z?"✓":"⧉"),9,uK)]),_:2},1032,["text"])]),T("pre",dK,[T("code",null,[(w(!0),N(Le,null,nt(L(W.code),(q,Q)=>(w(),N("span",{key:Q,class:Re(q.cls)},R(q.text),3))),128))])])]))],64))),128))],512))}}),Oh=ut(pK,[["__scopeId","data-v-96a9bd63"]]),hK={class:"tc-anim"},mK={class:"prev-anim"},gK={class:"prev"},vK=je({__name:"ThinkingBlock",props:{text:{},mobile:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1},foldable:{type:Boolean,default:!0}},emits:["open"],setup(e,{emit:t}){const n=e,s=t,o=F(()=>n.text.split(/\n{2,}/).filter(c=>c.trim().length>0)),i=F(()=>n.foldable&&o.value.length>1),r=F(()=>n.streaming||!i.value),l=F(()=>o.value.pop()??""),a=Z(null);return hn(()=>{if(!n.streaming)return;const c=a.value;c&&(c.scrollTop=c.scrollHeight)}),Ke(()=>n.text,()=>{const c=a.value;!c||!(c.scrollHeight-c.scrollTop-c.clientHeight<24)||ht(()=>{a.value&&(a.value.scrollTop=a.value.scrollHeight)})},{immediate:!0}),(c,u)=>(w(),N("div",{class:Re(["think",{mob:e.mobile}])},[i.value?(w(),N("div",{key:0,class:Re(["tc-wrap",{"is-collapsed":!r.value}]),onClick:u[0]||(u[0]=d=>s("open"))},[T("div",hK,[T("pre",{ref_key:"bodyEl",ref:a,class:"tc"},R(e.text),513)]),T("div",mK,[T("span",gK,R(l.value),1)])],2)):(w(),N("pre",{key:1,ref_key:"bodyEl",ref:a,class:"tc"},R(e.text),513))],2))}}),yK=ut(vK,[["__scopeId","data-v-7bcec011"]]),kK={class:"activity-notice",role:"status"},bK={"aria-hidden":"true"},_K={class:"an-label"},wK=je({__name:"ActivityNotice",props:{label:{}},setup(e){return(t,n)=>(w(),N("div",kK,[T("span",bK,[oe(ni,{size:"sm"})]),T("span",_K,R(e.label),1)]))}}),SK=ut(wK,[["__scopeId","data-v-59b71004"]]);function h3(e){return{inputTokens:e.input_tokens,outputTokens:e.output_tokens,cacheReadTokens:e.cache_read_tokens,cacheCreationTokens:e.cache_creation_tokens,totalCostUsd:e.total_cost_usd,contextTokens:e.context_tokens,contextLimit:e.context_limit,turnCount:e.turn_count}}function N1(e){switch(e){case"idle":return"idle";case"running":return"running";case"awaiting_approval":return"awaitingApproval";case"awaiting_question":return"awaitingQuestion";case"aborted":return"aborted"}}function CK(e){switch(e){case"idle":return"idle";case"running":return"running";case"awaitingApproval":return"awaiting_approval";case"awaitingQuestion":return"awaiting_question";case"aborted":return"aborted"}}function Ti(e){return{id:e.id,title:e.title,createdAt:e.created_at,updatedAt:e.updated_at,status:N1(e.status),archived:e.archived??!1,currentPromptId:e.current_prompt_id,lastPrompt:e.last_prompt,cwd:e.metadata.cwd,model:e.agent_config.model,usage:h3(e.usage),messageCount:e.message_count,lastSeq:e.last_seq,workspaceId:e.workspace_id,parentSessionId:typeof e.metadata.parent_session_id=="string"?e.metadata.parent_session_id:void 0}}function Su(e){return{id:e.id,root:e.root,name:e.name,isGitRepo:e.is_git_repo,branch:e.branch??void 0,lastOpenedAt:e.last_opened_at,sessionCount:e.session_count}}function $S(e){return e.kind==="base64"?{kind:"base64",mediaType:e.media_type,data:e.data}:e.kind==="file"?{kind:"file",fileId:e.file_id}:{kind:"url",url:e.url}}function gy(e){switch(e.type){case"text":return{type:"text",text:e.text};case"tool_use":return{type:"toolUse",toolCallId:e.tool_call_id,toolName:e.tool_name,input:e.input};case"tool_result":return{type:"toolResult",toolCallId:e.tool_call_id,output:e.output,isError:e.is_error};case"image":return{type:"image",source:$S(e.source)};case"video":return{type:"video",source:$S(e.source)};case"file":return{type:"file",fileId:e.file_id,name:e.name,mediaType:e.media_type,size:e.size};case"thinking":return{type:"thinking",thinking:e.thinking,signature:e.signature};default:return{type:"unknown",raw:e}}}function L1(e){return{id:e.id,sessionId:e.session_id,role:e.role,content:e.content.map(gy),createdAt:e.created_at,promptId:e.prompt_id,parentMessageId:e.parent_message_id,metadata:e.metadata}}function xK(e){switch(e.type){case"text":return{type:"text",text:e.text};case"toolUse":return{type:"tool_use",tool_call_id:e.toolCallId,tool_name:e.toolName,input:e.input};case"toolResult":return{type:"tool_result",tool_call_id:e.toolCallId,output:e.output,is_error:e.isError};case"image":case"video":{const t=e.source;let n;return t.kind==="base64"?n={kind:"base64",media_type:t.mediaType,data:t.data}:t.kind==="file"?n={kind:"file",file_id:t.fileId}:n={kind:"url",url:t.url},{type:e.type,source:n}}case"file":return{type:"file",file_id:e.fileId,name:e.name,media_type:e.mediaType,size:e.size};case"thinking":return{type:"thinking",thinking:e.thinking,signature:e.signature};case"unknown":return e.raw}}function AK(e){return{content:e.content.map(xK),metadata:e.metadata,agent_id:e.agentId,model:e.model,thinking:e.thinking,permission_mode:e.permissionMode,plan_mode:e.planMode,swarm_mode:e.swarmMode,goal_objective:e.goalObjective,goal_control:e.goalControl}}function TK(e){return{decision:e.decision,scope:e.scope,feedback:e.feedback,selected_label:e.selectedLabel}}function m3(e){return{approvalId:e.approval_id,sessionId:e.session_id,turnId:e.turn_id,toolCallId:e.tool_call_id,toolName:e.tool_name,action:e.action,display:e.tool_input_display??e.display,expiresAt:e.expires_at,createdAt:e.created_at}}function MK(e){return{id:e.id,label:e.label,description:e.description,recommended:e.recommended===!0||e.is_recommended===!0}}function EK(e){return{id:e.id,question:e.question,header:e.header,body:e.body,options:e.options.map(MK),multiSelect:e.multi_select,allowOther:e.allow_other,otherLabel:e.other_label,otherDescription:e.other_description}}function g3(e){return{questionId:e.question_id,sessionId:e.session_id,turnId:e.turn_id,toolCallId:e.tool_call_id,questions:e.questions.map(EK),createdAt:e.created_at}}function IK(e){switch(e.kind){case"single":return{kind:"single",option_id:e.optionId};case"multi":return{kind:"multi",option_ids:e.optionIds};case"other":return{kind:"other",text:e.text};case"multiWithOther":return{kind:"multi_with_other",option_ids:e.optionIds,other_text:e.otherText};case"skipped":return{kind:"skipped"}}}function $K(e){const t={};for(const[n,s]of Object.entries(e.answers))t[n]=IK(s);return{answers:t,method:e.method,note:e.note}}function O1(e){return{id:e.id,sessionId:e.session_id,kind:e.kind,description:e.description,status:e.status,command:e.command,createdAt:e.created_at,startedAt:e.started_at,completedAt:e.completed_at,outputPreview:e.output_preview,outputBytes:e.output_bytes,subagentPhase:e.subagent_phase,subagentType:e.subagent_type,parentToolCallId:e.parent_tool_call_id,suspendedReason:e.suspended_reason,swarmIndex:e.swarm_index,runInBackground:e.kind==="subagent"?!0:void 0}}function NS(e){return{path:e.path,name:e.name,kind:e.kind,size:e.size,modifiedAt:e.modified_at,etag:e.etag,mime:e.mime,languageId:e.language_id,isBinary:e.is_binary,isSymlinkTo:e.is_symlink_to,gitStatus:e.git_status,childCount:e.child_count}}function xr(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Ca(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Uo(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function NK(e){if(!e||typeof e!="object")return null;const t=e,n=xr(t,"status");if(n!=="active"&&n!=="paused"&&n!=="blocked"&&n!=="complete")return null;const s=t.budget,o=s&&typeof s=="object"?s:{};return{goalId:xr(t,"goalId")??xr(t,"goal_id")??"goal",objective:xr(t,"objective")??"",completionCriterion:xr(t,"completionCriterion")??xr(t,"completion_criterion"),status:n,turnsUsed:Ca(t,"turnsUsed")??Ca(t,"turns_used")??0,tokensUsed:Ca(t,"tokensUsed")??Ca(t,"tokens_used")??0,wallClockMs:Ca(t,"wallClockMs")??Ca(t,"wall_clock_ms")??0,terminalReason:xr(t,"terminalReason")??xr(t,"terminal_reason"),budget:{tokenBudget:Uo(o,"tokenBudget")??Uo(o,"token_budget"),remainingTokens:Uo(o,"remainingTokens")??Uo(o,"remaining_tokens"),turnBudget:Uo(o,"turnBudget")??Uo(o,"turn_budget"),remainingTurns:Uo(o,"remainingTurns")??Uo(o,"remaining_turns"),wallClockBudgetMs:Uo(o,"wallClockBudgetMs")??Uo(o,"wall_clock_budget_ms"),remainingWallClockMs:Uo(o,"remainingWallClockMs")??Uo(o,"remaining_wall_clock_ms"),overBudget:o.overBudget===!0||o.over_budget===!0}}}function LK(e){const t=e;switch(e.type){case"event.session.created":return{type:"sessionCreated",session:Ti(t.payload.session)};case"event.session.updated":return{type:"sessionUpdated",session:Ti(t.payload.session),changedFields:t.payload.changed_fields};case"event.session.deleted":return{type:"sessionDeleted",sessionId:t.session_id};case"event.workspace.created":return{type:"workspaceCreated",workspace:Su(t.payload.workspace)};case"event.workspace.updated":return{type:"workspaceUpdated",workspace:Su(t.payload.workspace)};case"event.workspace.deleted":return{type:"workspaceDeleted",workspaceId:t.payload.workspace_id,root:t.payload.root};case"event.session.status_changed":return{type:"sessionStatusChanged",sessionId:t.session_id,status:N1(t.payload.status),previousStatus:N1(t.payload.previous_status),currentPromptId:t.payload.current_prompt_id};case"event.session.usage_updated":return{type:"sessionUsageUpdated",sessionId:t.session_id,usage:h3(t.payload.usage)};case"event.session.history_compacted":return{type:"historyCompacted",sessionId:t.session_id,beforeSeq:t.payload.before_seq,reason:t.payload.reason,summaryMessageId:t.payload.summary_message_id};case"event.goal.updated":{const n=NK(t.payload.snapshot??null);return{type:"goalUpdated",sessionId:t.session_id,goal:n?.status==="complete"?null:n}}case"event.message.created":return{type:"messageCreated",message:L1(t.payload.message)};case"event.message.updated":return{type:"messageUpdated",sessionId:t.session_id,messageId:t.payload.message_id,content:t.payload.content.map(gy),status:t.payload.status};case"event.assistant.delta":return{type:"assistantDelta",sessionId:t.session_id,messageId:t.payload.message_id,contentIndex:t.payload.content_index,delta:t.payload.delta};case"event.assistant.tool_use_started":case"event.assistant.tool_use_delta":case"event.assistant.tool_use_completed":case"event.assistant.completed":case"event.tool.started":return{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.tool.output":return{type:"toolOutput",sessionId:t.session_id,toolCallId:t.payload.tool_call_id,outputChunk:t.payload.chunk,stream:t.payload.stream};case"event.tool.progress":return typeof t.payload.message=="string"&&t.payload.message.length>0?{type:"toolOutput",sessionId:t.session_id,toolCallId:t.payload.tool_call_id,outputChunk:t.payload.message,stream:"stdout"}:{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.tool.completed":return{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.approval.requested":return{type:"approvalRequested",sessionId:t.session_id,approval:m3(t.payload)};case"event.approval.resolved":return{type:"approvalResolved",sessionId:t.session_id,approvalId:t.payload.approval_id,decision:t.payload.decision,resolvedAt:t.payload.resolved_at};case"event.approval.expired":return{type:"approvalExpired",sessionId:t.session_id,approvalId:t.payload.approval_id};case"event.question.requested":return{type:"questionRequested",sessionId:t.session_id,question:g3(t.payload)};case"event.question.answered":return{type:"questionAnswered",sessionId:t.session_id,questionId:t.payload.question_id,resolvedAt:t.payload.resolved_at};case"event.question.dismissed":return{type:"questionDismissed",sessionId:t.session_id,questionId:t.payload.question_id,dismissedAt:t.payload.dismissed_at};case"event.task.created":return{type:"taskCreated",sessionId:t.session_id,task:O1(t.payload.task)};case"event.task.progress":return{type:"taskProgress",sessionId:t.session_id,taskId:t.payload.task_id,outputChunk:t.payload.output_chunk,stream:t.payload.stream};case"event.task.completed":return{type:"taskCompleted",sessionId:t.session_id,taskId:t.payload.task_id,status:t.payload.status,outputPreview:t.payload.output_preview,outputBytes:t.payload.output_bytes};case"event.config.changed":return{type:"configChanged",changedFields:t.payload.changed_fields,config:P1(t.payload.config)};case"event.model_catalog.changed":return{type:"modelCatalogChanged",changed:t.payload.changed.map(n=>({providerId:n.provider_id,providerName:n.provider_name,added:n.added,removed:n.removed})),unchanged:t.payload.unchanged,failed:t.payload.failed};default:return{type:"unknown",raw:e}}}function OK(e){return{id:e.model,provider:e.provider,model:e.model,displayName:e.display_name,maxContextSize:e.max_context_size,capabilities:e.capabilities,supportEfforts:e.support_efforts,defaultEffort:e.default_effort}}function LS(e){return{id:e.id,type:e.type,baseUrl:e.base_url,defaultModel:e.default_model,hasApiKey:e.has_api_key,status:e.status,models:e.models}}function P1(e){const t={};for(const[n,s]of Object.entries(e.providers))t[n]={type:s.type,baseUrl:s.base_url,defaultModel:s.default_model,hasApiKey:s.has_api_key};return{providers:t,defaultProvider:e.default_provider,defaultModel:e.default_model,models:e.models,thinking:e.thinking,planMode:e.plan_mode,yolo:e.yolo,defaultPermissionMode:e.default_permission_mode,defaultPlanMode:e.default_plan_mode,permission:e.permission,hooks:e.hooks,services:e.services,mergeAllAvailableSkills:e.merge_all_available_skills,extraSkillDirs:e.extra_skill_dirs,loopControl:e.loop_control,background:e.background,experimental:e.experimental,telemetry:e.telemetry,raw:e.raw}}function PK(e){return e.session_id}function RK(e){return e.seq}const DK="main",BK=new Set(["turn.started","turn.step.started","turn.step.completed","turn.step.retrying","turn.step.interrupted","turn.ended","thinking.delta","assistant.delta","tool.use","tool.call.started","tool.call.delta","tool.progress","tool.result","agent.status.updated","prompt.completed"]);function Lr(e="msg_"){const t=Date.now().toString(36).padStart(10,"0"),n=Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${e}${t}${n}`}function FK(e){if(!e||typeof e!="object")return{input:0,output:0,cacheRead:0,cacheCreate:0};const t=e;return{input:t.inputOther??t.input_tokens??0,output:t.output??t.output_tokens??0,cacheRead:t.inputCacheRead??t.cache_read_input_tokens??0,cacheCreate:t.inputCacheCreation??t.cache_creation_input_tokens??0}}function OS(){return{turnPromptId:new Map,currentPromptId:void 0,currentAssistantMsgId:void 0,turnTextLen:0,turnThinkLen:0,toolStartTimes:new Map,totalInput:0,totalOutput:0,totalCacheRead:0,totalCacheCreate:0,contextTokens:0,contextLimit:0,turnCount:0,model:"",messages:[],subagentMeta:new Map}}function co(e,t){const n=e[t];return typeof n=="string"?n:void 0}function El(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function qo(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function HK(e){if(!e||typeof e!="object")return null;const t=e,n=t.budget,s=n&&typeof n=="object"?n:{},o=co(t,"status");if(o!=="active"&&o!=="paused"&&o!=="blocked"&&o!=="complete")return null;const i=co(t,"goalId")??co(t,"goal_id")??"goal",r=co(t,"objective")??"";return{goalId:i,objective:r,completionCriterion:co(t,"completionCriterion")??co(t,"completion_criterion"),status:o,turnsUsed:El(t,"turnsUsed")??El(t,"turns_used")??0,tokensUsed:El(t,"tokensUsed")??El(t,"tokens_used")??0,wallClockMs:El(t,"wallClockMs")??El(t,"wall_clock_ms")??0,terminalReason:co(t,"terminalReason")??co(t,"terminal_reason"),budget:{tokenBudget:qo(s,"tokenBudget")??qo(s,"token_budget"),remainingTokens:qo(s,"remainingTokens")??qo(s,"remaining_tokens"),turnBudget:qo(s,"turnBudget")??qo(s,"turn_budget"),remainingTurns:qo(s,"remainingTurns")??qo(s,"remaining_turns"),wallClockBudgetMs:qo(s,"wallClockBudgetMs")??qo(s,"wall_clock_budget_ms"),remainingWallClockMs:qo(s,"remainingWallClockMs")??qo(s,"remaining_wall_clock_ms"),overBudget:s.overBudget===!0||s.over_budget===!0}}}function Wa(e,t,n,s){if(typeof n!="string"||n.length===0)return null;const i={...e.subagentMeta.get(n)??{id:n,sessionId:t,kind:"subagent",description:"Sub Agent",status:"running",createdAt:new Date().toISOString(),subagentPhase:"queued"},...s,id:n,sessionId:t,kind:"subagent"};return e.subagentMeta.set(n,i),i}function WK(e,t){if(e==="turn.step.started")return null;if(e==="tool.use"||e==="tool.call.started"){const n=co(t,"name")??co(t,"toolName")??"tool",s=id(zK(n)),o=UK(n,t.args??t.input);return o?`Calling ${s}: ${o}`:`Calling ${s}`}if(e==="tool.progress"){const n=t.update;if(n&&typeof n=="object"){const o=co(n,"text");if(o)return Yg(o);const i=co(n,"message");if(i)return Yg(i)}const s=co(t,"message");if(s)return Yg(s)}return null}function zK(e){return e.replace(/_\d+$/,"")}const PS=2e3;function Yg(e){return e.length>PS?`${e.slice(0,PS)}…`:e}function UK(e,t){if(t==null)return"";const n=typeof t=="string"?t:JSON.stringify(t);return Bu(e,n)}function qK(e,t,n,s,o,i){if(i.has(n)&&s==="turn.step.started")return[];if(s==="assistant.delta"){const u=co(o,"delta");if(!u)return[];const d=e.subagentMeta.get(n),p=Wa(e,t,n,{status:"running",subagentPhase:"working",startedAt:d?.startedAt??new Date().toISOString()}),h=[];return p&&h.push({type:"taskCreated",sessionId:t,task:p}),h.push({type:"taskProgress",sessionId:t,taskId:n,outputChunk:u,stream:"stdout",kind:"text"}),h}const r=WK(s,o);if(r===null||r.length===0)return[];const l=e.subagentMeta.get(n),a=Wa(e,t,n,{status:"running",subagentPhase:"working",startedAt:l?.startedAt??new Date().toISOString()}),c=[];return a&&c.push({type:"taskCreated",sessionId:t,task:a}),c.push({type:"taskProgress",sessionId:t,taskId:n,outputChunk:r,stream:"stdout"}),c}function gf(e){return{...e,content:e.content.map(t=>({...t}))}}function RS(e,t,n){const s={id:Lr("msg_"),sessionId:t,role:"assistant",content:[],createdAt:new Date().toISOString(),promptId:n};return e.messages.push(s),s}function jK(e,t,n,s,o,i){const r={id:s,sessionId:t,role:"user",content:o,createdAt:i,promptId:n};return e.messages.push(r),r}function VK(e){return Array.isArray(e)?e.map(t=>gy(t)):[]}function DS(e,t,n,s){const o=e.messages.find(r=>r.id===t);if(!o)return-1;const i=o.content.at(-1);return i&&i.type===n?(n==="text"?i.text+=s:i.thinking+=s,o.content.length-1):(o.content.push(n==="text"?{type:"text",text:s}:{type:"thinking",thinking:s}),o.content.length-1)}function KK(e,t,n,s,o,i){const r=e.messages.find(l=>l.id===t);r&&r.content.push({type:"toolUse",toolCallId:n,toolName:s,input:o,outputLines:i})}function GK(e){const t=e.update,n=t&&typeof t=="object"?t:null,o=(n?.stream??n?.kind??e.stream)==="stderr"?"stderr":"stdout",i=typeof n?.text=="string"&&n.text||typeof n?.message=="string"&&n.message||typeof e.chunk=="string"&&e.chunk||typeof e.output=="string"&&e.output||typeof e.message=="string"&&e.message||"";return i.length>0?{outputChunk:i,stream:o}:null}function BS(e,t){e.messages.find(n=>n.id===t)}function YK(e,t,n,s,o,i){const r={id:Lr("msg_"),sessionId:t,role:"tool",content:[{type:"toolResult",toolCallId:n,output:s,isError:o}],createdAt:new Date().toISOString(),promptId:i};return e.messages.push(r),r}function Xg(e,t){return e.messages.find(n=>n.id===t)}function FS(e){return{inputTokens:e.totalInput,outputTokens:e.totalOutput,cacheReadTokens:e.totalCacheRead,cacheCreationTokens:e.totalCacheCreate,totalCostUsd:0,contextTokens:e.contextTokens,contextLimit:e.contextLimit,turnCount:e.turnCount}}function XK(){const e=new Map,t=new Set;function n(u){let d=e.get(u);return d||(d=OS(),e.set(u,d)),d}function s(u){e.set(u,OS())}function o(u){t.add(u)}function i(u,d){const p=n(u);p.currentPromptId=d}function r(u,d){s(u);const p=n(u),h=d.promptId??Lr("pr_");p.currentPromptId=h,p.turnPromptId.set(d.turnId,h);const f=RS(p,u,h);d.thinkingText.length>0&&f.content.push({type:"thinking",thinking:d.thinkingText}),d.assistantText.length>0&&f.content.push({type:"text",text:d.assistantText});for(const m of d.runningTools){const b=typeof m.lastProgress?.text=="string"&&m.lastProgress.text.length>0?[m.lastProgress.text]:void 0;f.content.push({type:"toolUse",toolCallId:m.toolCallId,toolName:m.name,input:m.args??{},outputLines:b}),p.toolStartTimes.set(m.toolCallId,Date.now())}return p.currentAssistantMsgId=f.id,p.turnTextLen=d.assistantText.length,p.turnThinkLen=d.thinkingText.length,[{type:"sessionStatusChanged",sessionId:u,status:"running",previousStatus:"idle",currentPromptId:h},{type:"messageCreated",message:gf(f)}]}function l(u,d,p,h){try{return c(u,d,p,h)}catch(f){return console.error("[agentProjector] Error projecting event:",u,f instanceof Error?f.message:f),[]}}function a(u,d){return d===void 0?"append":d<u?"skip":d>u?"gap":"append"}function c(u,d,p,h){const f=n(p),m=d,b=[],_=m?.agentId;if(typeof _=="string"&&_!==DK){const g=t.has(_);if(g&&(u==="thinking.delta"||u==="assistant.delta")){const v=m?.delta??"";return v?[{type:"agentDelta",sessionId:p,agentId:_,delta:{[u==="thinking.delta"?"thinking":"text"]:v}}]:[]}if(g&&u==="turn.ended")return[{type:"agentTurnEnded",sessionId:p,agentId:_,reason:m?.reason}];if(BK.has(u))return qK(f,p,_,u,m??{},t)}switch(u){case"session.meta.updated":{const g=m?.patch?.title??m?.title,v=m?.patch?.lastPrompt,y={};typeof g=="string"&&g.length>0&&(y.title=g),typeof v=="string"&&(y.lastPrompt=v),(y.title!==void 0||y.lastPrompt!==void 0)&&b.push({type:"sessionMetaUpdated",sessionId:p,...y});break}case"prompt.submitted":{const g=m?.promptId,v=m?.userMessageId;if(!g||!v)break;const y=VK(m?.content);if(y.length===0)break;f.currentPromptId=g;const A=jK(f,p,g,v,y,typeof m?.createdAt=="string"?m.createdAt:new Date().toISOString());b.push({type:"messageCreated",message:gf(A)});break}case"turn.started":{const g=m?.turnId,v=f.currentPromptId??Lr("pr_");f.currentPromptId=v,g!==void 0&&f.turnPromptId.set(g,v),f.turnTextLen=0,f.turnThinkLen=0,b.push({type:"sessionStatusChanged",sessionId:p,status:"running",previousStatus:"idle",currentPromptId:v});break}case"turn.step.started":{const g=m?.turnId;let v=f.turnPromptId.get(g)??f.currentPromptId;v||(v=Lr("pr_"),f.currentPromptId=v,g!==void 0&&f.turnPromptId.set(g,v));const y=RS(f,p,v);f.currentAssistantMsgId=y.id,b.push({type:"messageCreated",message:gf(y)});break}case"thinking.delta":{const g=f.currentAssistantMsgId;if(!g)break;const v=m?.delta??"";if(!v)break;h?.offset===0&&f.turnThinkLen>0&&(f.turnThinkLen=0);const y=a(f.turnThinkLen,h?.offset);if(y==="skip")break;if(y==="gap"){b.push({type:"historyCompacted",sessionId:p,beforeSeq:0,reason:"delta_gap"});break}const A=DS(f,g,"thinking",v);if(A<0)break;f.turnThinkLen+=v.length,b.push({type:"assistantDelta",sessionId:p,messageId:g,contentIndex:A,delta:{thinking:v}});break}case"assistant.delta":{const g=f.currentAssistantMsgId;if(!g)break;const v=m?.delta??"";if(!v)break;h?.offset===0&&f.turnTextLen>0&&(f.turnTextLen=0);const y=a(f.turnTextLen,h?.offset);if(y==="skip")break;if(y==="gap"){b.push({type:"historyCompacted",sessionId:p,beforeSeq:0,reason:"delta_gap"});break}const A=DS(f,g,"text",v);if(A<0)break;f.turnTextLen+=v.length,b.push({type:"assistantDelta",sessionId:p,messageId:g,contentIndex:A,delta:{text:v}});break}case"tool.use":case"tool.call.started":{const g=f.currentAssistantMsgId,v=m?.turnId,y=f.turnPromptId.get(v)??f.currentPromptId;if(!g||!y)break;const A=m?.toolCallId,O=m?.name??m?.toolName??"",$=m?.args??m?.input??{};KK(f,g,A,O,$);const k=Xg(f,g);k&&k.content.length-1,f.toolStartTimes.set(A,Date.now()),k&&b.push({type:"messageUpdated",sessionId:p,messageId:g,content:k.content.map(E=>({...E})),status:"pending"});break}case"tool.call.delta":break;case"tool.progress":{const g=m?.toolCallId,v=GK(m??{});g&&v&&b.push({type:"toolOutput",sessionId:p,toolCallId:g,outputChunk:v.outputChunk,stream:v.stream});break}case"tool.result":{const g=m?.turnId;let v=f.turnPromptId.get(g)??f.currentPromptId;v||(v=Lr("pr_"),f.currentPromptId=v,g!==void 0&&f.turnPromptId.set(g,v));const y=m?.toolCallId,A=m?.output,O=m?.isError??!1;f.toolStartTimes.get(y)??Date.now(),f.toolStartTimes.delete(y);const $=YK(f,p,y,A,O,v);b.push({type:"messageCreated",message:gf($)}),f.currentAssistantMsgId=void 0;break}case"turn.step.completed":{const g=f.currentAssistantMsgId,v=FK(m?.usage);if(f.totalInput+=v.input,f.totalOutput+=v.output,f.totalCacheRead+=v.cacheRead,f.totalCacheCreate+=v.cacheCreate,g){BS(f,g);const y=Xg(f,g);y&&b.push({type:"messageUpdated",sessionId:p,messageId:g,content:y.content.map(A=>({...A})),status:"completed"})}break}case"agent.status.updated":{m?.model&&(f.model=m.model),m?.contextTokens!==void 0&&(f.contextTokens=m.contextTokens),m?.maxContextTokens!==void 0&&(f.contextLimit=m.maxContextTokens),b.push({type:"sessionUsageUpdated",sessionId:p,usage:FS(f),model:f.model||void 0,swarmMode:m?.swarmMode===!0?!0:m?.swarmMode===!1?!1:void 0,planMode:m?.planMode===!0?!0:m?.planMode===!1?!1:void 0});break}case"turn.ended":{const g=f.currentAssistantMsgId,v=m?.reason??"completed",y=El(m??{},"durationMs");if(g){BS(f,g);const $=Xg(f,g);$&&b.push({type:"messageUpdated",sessionId:p,messageId:g,content:$.content.map(k=>({...k})),status:v==="failed"||v==="filtered"?"error":"completed",durationMs:y})}f.turnCount++;const A=FS(f);b.push({type:"sessionUsageUpdated",sessionId:p,usage:A});const O=v==="cancelled"||v==="failed"||v==="filtered"?"aborted":"idle";b.push({type:"sessionStatusChanged",sessionId:p,status:O,previousStatus:"running"}),f.currentAssistantMsgId=void 0,f.currentPromptId=void 0,f.turnTextLen=0,f.turnThinkLen=0;break}case"prompt.completed":break;case"turn.step.retrying":case"turn.step.interrupted":{f.currentAssistantMsgId=void 0;break}case"subagent.spawned":{const v={id:typeof m?.subagentId=="string"&&m.subagentId.length>0?m.subagentId:Lr("task_"),sessionId:p,kind:"subagent",description:typeof m?.description=="string"?m.description:m?.subagentName??"Sub Agent",status:"running",createdAt:new Date().toISOString(),subagentPhase:"queued",subagentType:typeof m?.subagentName=="string"?m.subagentName:void 0,parentToolCallId:typeof m?.parentToolCallId=="string"?m.parentToolCallId:void 0,swarmIndex:typeof m?.swarmIndex=="number"?m.swarmIndex:void 0,runInBackground:m?.runInBackground===!0};f.subagentMeta.set(v.id,v),b.push({type:"taskCreated",sessionId:p,task:v});break}case"subagent.started":{const g=Wa(f,p,m?.subagentId,{subagentPhase:"working",status:"running",startedAt:new Date().toISOString()});g&&b.push({type:"taskCreated",sessionId:p,task:g});break}case"subagent.suspended":{const g=Wa(f,p,m?.subagentId,{subagentPhase:"suspended",status:"running",suspendedReason:typeof m?.reason=="string"?m.reason:void 0});g&&b.push({type:"taskCreated",sessionId:p,task:g});break}case"subagent.completed":{const g=typeof m?.resultSummary=="string"?m.resultSummary:void 0,v=Wa(f,p,m?.subagentId,{subagentPhase:"completed",status:"completed",completedAt:new Date().toISOString(),outputPreview:g});v&&b.push({type:"taskCreated",sessionId:p,task:v}),b.push({type:"taskCompleted",sessionId:p,taskId:m?.subagentId??"",status:"completed",outputPreview:g});break}case"subagent.failed":{const g=typeof m?.error=="string"?m.error:void 0,v=Wa(f,p,m?.subagentId,{subagentPhase:"failed",status:"failed",completedAt:new Date().toISOString(),outputPreview:g});v&&b.push({type:"taskCreated",sessionId:p,task:v}),b.push({type:"taskCompleted",sessionId:p,taskId:m?.subagentId??"",status:"failed",outputPreview:g});break}case"error":{b.push({type:"unknown",raw:{_agentError:!0,code:m?.code,message:m?.message}});break}case"warning":{b.push({type:"unknown",raw:{_agentWarning:!0,message:m?.message}});break}case"background.task.started":{const g=m?.info??{},v=typeof g.startedAt=="number"?new Date(g.startedAt).toISOString():void 0,y=typeof g.taskId=="string"?g.taskId:typeof g.taskId=="number"?String(g.taskId):Lr("task_"),A=typeof g.description=="string"?g.description:typeof g.command=="string"?g.command:Un.global.t("tasks.defaultDescription"),O=typeof g.command=="string"?g.command:void 0;b.push({type:"taskCreated",sessionId:p,task:{id:y,sessionId:p,kind:"bash",description:A,command:O,status:"running",createdAt:v??new Date().toISOString(),startedAt:v,outputPreview:O!==void 0?`$ ${O}`:void 0}});break}case"background.task.terminated":{const g=m?.info??{},v=g.status==="failed"||typeof g.exitCode=="number"&&g.exitCode!==0;b.push({type:"taskCompleted",sessionId:p,taskId:typeof g.taskId=="string"?g.taskId:typeof g.taskId=="number"?String(g.taskId):"",status:v?"failed":"completed"});break}case"compaction.completed":{const g=m?.result??{};b.push({type:"compactionCompleted",sessionId:p,tokensBefore:typeof g.tokensBefore=="number"?g.tokensBefore:void 0,tokensAfter:typeof g.tokensAfter=="number"?g.tokensAfter:void 0,summary:typeof g.summary=="string"?g.summary:void 0}),b.push({type:"historyCompacted",sessionId:p,beforeSeq:0,reason:"auto_compact"});break}case"compaction.started":{b.push({type:"compactionStarted",sessionId:p,trigger:m?.trigger==="manual"?"manual":"auto",instruction:typeof m?.instruction=="string"?m.instruction:void 0});break}case"compaction.cancelled":{b.push({type:"compactionCancelled",sessionId:p});break}case"goal.updated":{const g=HK(m?.snapshot??null);b.push({type:"goalUpdated",sessionId:p,goal:g?.status==="complete"?null:g});break}}return b}return{project:l,bindNextPromptId:i,seedInFlight:r,reset:s,markSideChannelAgent:o}}const QK=new Set(["server_hello","ack","ping","resync_required","error","pong"]),HS=new Set(["turn.started","turn.step.started","turn.step.completed","turn.step.retrying","turn.step.interrupted","turn.ended","thinking.delta","assistant.delta","tool.call.started","tool.use","tool.call.delta","tool.progress","tool.result","agent.status.updated","prompt.submitted","prompt.completed","session.meta.updated","compaction.started","compaction.progress","compaction.completed","compaction.cancelled","goal.updated","error","warning","subagent.spawned","subagent.started","subagent.suspended","subagent.completed","subagent.failed","background.task.started","background.task.terminated"]),ZK=new Set(["session.created","session.updated","session.deleted","session.status_changed","session.usage_updated","session.history_compacted","message.created","message.updated","approval.requested","approval.resolved","approval.expired","question.requested","question.answered","question.dismissed","task.created","task.progress","task.completed","assistant.tool_use_started","assistant.tool_use_delta","assistant.tool_use_completed","assistant.completed","tool.started","tool.output","tool.completed"]),JK=new Set(["assistant.delta","thinking.delta"]);function eG(e,t){if(QK.has(e))return{route:"ignore"};const n=e.startsWith("event."),s=n?e.slice(6):e;return JK.has(s)?tG(t)?{route:"agent",agentType:s}:{route:"protocol"}:n?ZK.has(s)?{route:"protocol"}:HS.has(s)?{route:"agent",agentType:s}:{route:"protocol"}:HS.has(s)?{route:"agent",agentType:s}:{route:"agent",agentType:s}}function tG(e){if(!e||typeof e!="object")return!1;const t=e;return"message_id"in t||"content_index"in t?!1:typeof t.delta=="string"}class Wf extends Error{code;requestId;details;timestamp;durationMs;constructor(t){super(t.msg),this.name="DaemonApiError",this.code=t.code,this.requestId=t.requestId,this.details=t.details,this.timestamp=t.timestamp,this.durationMs=t.durationMs}}class $a extends Error{cause;method;path;url;requestId;phase;timeoutMs;status;statusText;contentType;bodyPreview;timestamp;durationMs;constructor(t){super(t.message),this.name="DaemonNetworkError",this.cause=t.cause,this.method=t.method,this.path=t.path,this.url=t.url,this.requestId=t.requestId,this.phase=t.phase,this.timeoutMs=t.timeoutMs,this.status=t.status,this.statusText=t.statusText,this.contentType=t.contentType,this.bodyPreview=t.bodyPreview,this.timestamp=t.timestamp,this.durationMs=t.durationMs}}function el(e){return e instanceof Wf||typeof e=="object"&&e!==null&&e.name==="DaemonApiError"&&typeof e.code=="number"}function v3(e){return e instanceof $a||typeof e=="object"&&e!==null&&e.name==="DaemonNetworkError"&&typeof e.method=="string"&&typeof e.path=="string"}const WS=1e3,Qg=16384,Zg=500,Jg=50,nG=6,sG=/api[_-]?key|authorization|token|secret|password|cookie|credential/i,oG=/^[A-Za-z0-9+/=_-]{200,}$/;let ev=null;function vi(){if(ev!==null)return ev;let e=!1;try{if(typeof location<"u"){const t=new URLSearchParams(location.search).get("debug");(t==="1"||t==="true")&&(e=!0)}}catch{}return e||(e=Qn(Et.debug)==="1"),ev=e,e}const Hr=[];let iG=1;const vy=Z(0),su=Ql(!1);function rG(){return Hr}function lG(){Hr.length=0,vy.value++}function rl(e){su.value||(Hr.push({id:iG++,ts:Date.now(),...e}),Hr.length>WS&&Hr.splice(0,Hr.length-WS),vy.value++)}function R1(e,t=0){if(e==null)return e;const n=typeof e;if(n==="number"||n==="boolean")return e;if(n==="string"){const o=e;return oG.test(o)?`[base64-like, ${o.length} chars omitted]`:o.length>Zg?`${o.slice(0,Zg)}… [+${o.length-Zg} chars]`:o}if(n!=="object")return String(e);if(t>=nG)return"[max depth]";if(Array.isArray(e)){const o=e.slice(0,Jg).map(i=>R1(i,t+1));return e.length>Jg&&o.push(`[+${e.length-Jg} more items]`),o}const s={};for(const[o,i]of Object.entries(e))s[o]=sG.test(o)?"[redacted]":R1(i,t+1);return s}function ea(e){if(e===void 0)return;const t=R1(e);try{const n=JSON.stringify(t);if(n!==void 0&&n.length>Qg)return{_truncated:`detail JSON was ${n.length} chars; first ${Qg} kept`,preview:n.slice(0,Qg)}}catch{return"[unserializable detail]"}return t}function tv(e){vi()&&rl({source:"rest",kind:"rest:request",label:`→ ${e.method} ${e.path}`,method:e.method,path:e.path,requestId:e.requestId,detail:{url:e.url,body:ea(e.body)}})}function vf(e){if(!vi())return;const t=e.code!==0;rl({source:"rest",kind:t?"rest:error":"rest:response",label:`← ${e.method} ${e.path} ${e.status} code=${e.code}${t?` "${e.msg}"`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,code:e.code,durationMs:e.durationMs,detail:{envelope:{code:e.code,msg:e.msg,request_id:e.envelopeRequestId},data:ea(e.data)}})}function Xc(e){vi()&&rl({source:"rest",kind:"rest:error",label:`✕ ${e.method} ${e.path} ${e.phase} error${e.status!==void 0?` (HTTP ${e.status})`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,durationMs:e.durationMs,detail:{phase:e.phase,error:String(e.error)}})}function xa(e,t){vi()&&rl({source:"ws",kind:"ws:lifecycle",eventType:e,label:`ws ${e}`,detail:ea(t)})}function aG(e){if(!vi())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",s=t.payload,o=typeof s?.session_id=="string"?s.session_id:void 0;rl({source:"ws",kind:"ws:out",eventType:n,sessionId:o,label:`→ ${n}`,detail:ea(e)})}function cG(e){if(!vi())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",s=typeof t.session_id=="string"?t.session_id:typeof t.payload?.session_id=="string"?t.payload.session_id:void 0,o=typeof t.seq=="number"?t.seq:void 0,i=typeof t.offset=="number"?t.offset:void 0,r=[s,o!==void 0?`seq=${o}`:void 0,i!==void 0?`offset=${i}`:void 0,t.volatile===!0?"volatile":void 0].filter(Boolean);rl({source:"ws",kind:"ws:in",eventType:n,sessionId:s,seq:o,offset:i,label:`← ${n}${r.length>0?` (${r.join(" ")})`:""}`,detail:ea(t.payload)})}const uG={error:"✕",warn:"⚠",info:"ℹ",debug:"·",log:"·"};function nv(e,t,n){vi()&&rl({source:"client",kind:`client:${e}`,label:`${uG[e]} ${t}`,detail:ea(n)})}function Or(e,t){vi()&&rl({source:"client",kind:"client:event",label:`· ${e}`,detail:ea(t)})}let zS=!1;function dG(){if(!(zS||!vi())){zS=!0;try{typeof window<"u"&&(window.addEventListener("error",e=>{nv("error",e.message||"window error",{source:e.filename,line:e.lineno,col:e.colno,stack:e.error instanceof Error?e.error.stack:void 0})}),window.addEventListener("unhandledrejection",e=>{const t=e.reason;nv("error","unhandled promise rejection",{reason:t instanceof Error?`${t.name}: ${t.message}`:t,stack:t instanceof Error?t.stack:void 0})}))}catch{}for(const e of["error","warn","log","info","debug"]){const t=console[e];typeof t=="function"&&(console[e]=(...n)=>{try{nv(e,n.map(fG).join(" "),n.length>1?n:n[0])}catch{}t.apply(console,n)})}}}function fG(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch{return String(e)}}function y3(e=Hr){if(typeof document>"u")return;const t=new Blob([pG(e)],{type:"application/x-ndjson"}),n=URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download=`king-web-log-${new Date().toISOString().replace(/[:.]/g,"-")}.jsonl`,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(n)}function pG(e=Hr){return e.map(t=>JSON.stringify(t)).join(`
|
|
247
|
-
`)}const yy="king-web.server-credential",hG="token";let Yu;const D1=new Set;function mG(){if(typeof window>"u")return;const e=window.location.hash??"";if(!e.startsWith("#"))return;const n=new URLSearchParams(e.slice(1)).get(hG);if(!n)return;const s=new URL(window.location.href);return s.hash="",window.history.replaceState(window.history.state,"",`${s.pathname}${s.search}`),n}function gG(){try{return globalThis.sessionStorage?.getItem(yy)??void 0}catch{return}}function vG(){const e=mG();return e?(b3(e),!0):(Yu=gG(),Yu!==void 0)}function k3(){return Yu}function b3(e){Yu=e;try{globalThis.sessionStorage?.setItem(yy,e)}catch{}}function yG(){Yu=void 0;try{globalThis.sessionStorage?.removeItem(yy)}catch{}}function kG(e){return D1.add(e),()=>{D1.delete(e)}}function bG(){yG();for(const e of D1)try{e()}catch{}}const Na=3e4,_3="0123456789ABCDEFGHJKMNPQRSTVWXYZ",US=500,_G=40101;function sv(){try{return AbortSignal.timeout(Na)}catch{return}}function wG(e,t){let n="",s=e;for(let o=0;o<t;o++)n=_3[s%32]+n,s=Math.floor(s/32);return n}function SG(e){const t=new Uint8Array(e);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(t);else for(let n=0;n<t.length;n++)t[n]=Math.floor(Math.random()*256);return Array.from(t,n=>_3[n%32]).join("")}function ov(){return`${wG(Date.now(),10)}${SG(16)}`}function CG(e){try{const t=[];return e.forEach((n,s)=>{typeof n=="string"?t.push({field:s,value:n}):t.push({field:s,file:n.name,size:n.size,type:n.type})}),{formData:t}}catch{return"[FormData]"}}async function qS(e){try{const t=await e.text();return t?t.length>US?`${t.slice(0,US)}...`:t:void 0}catch{return}}class xG{constructor(t,n){this.origin=t,this.identity=n}async get(t,n){return this.request("GET",t,void 0,n)}async getBlob(t){const n=cu(this.origin,t),s=ov(),o={"X-Request-Id":s};this.addClientHeaders(o);const i=Date.now();tv({method:"GET",path:t,url:n,requestId:s});let r;try{r=await fetch(n,{method:"GET",headers:o,signal:sv()})}catch(a){throw Xc({method:"GET",path:t,requestId:s,phase:"fetch",durationMs:Date.now()-i,error:a}),new $a({message:`Network error calling GET ${t}`,cause:a,method:"GET",path:t,url:n,requestId:s,phase:"fetch",timeoutMs:Na,timestamp:Date.now(),durationMs:Date.now()-i})}if(r.ok)return vf({method:"GET",path:t,requestId:s,status:r.status,durationMs:Date.now()-i,code:0,msg:""}),r.blob();let l;try{l=await r.clone().json()}catch{}throw this.checkAuthRequired(r,l?.code??0),vf({method:"GET",path:t,requestId:s,status:r.status,durationMs:Date.now()-i,code:l?.code??r.status,msg:l?.msg??r.statusText,envelopeRequestId:l?.request_id}),new Wf({code:l?.code??r.status,msg:l?.msg??r.statusText,requestId:l?.request_id??s,details:l?.details,timestamp:Date.now(),durationMs:Date.now()-i})}async post(t,n,s){return this.request("POST",t,n,void 0,s?.allowCodes)}async postForm(t,n){const s=cu(this.origin,t),o=ov(),i={"X-Request-Id":o};this.addClientHeaders(i);const r=Date.now();tv({method:"POST",path:t,url:s,requestId:o,body:CG(n)});let l;try{l=await fetch(s,{method:"POST",headers:i,body:n,signal:sv()})}catch(u){throw Xc({method:"POST",path:t,requestId:o,phase:"fetch",durationMs:Date.now()-r,error:u}),new $a({message:`Network error calling POST ${t}`,cause:u,method:"POST",path:t,url:s,requestId:o,phase:"fetch",timeoutMs:Na,timestamp:Date.now(),durationMs:Date.now()-r})}let a;const c=l.clone();try{a=await l.json()}catch(u){throw Xc({method:"POST",path:t,requestId:o,phase:"parse",durationMs:Date.now()-r,status:l.status,error:u}),new $a({message:`Failed to parse JSON response from POST ${t}`,cause:u,method:"POST",path:t,url:s,requestId:o,phase:"parse",timeoutMs:Na,status:l.status,statusText:l.statusText,contentType:l.headers.get("content-type")??void 0,bodyPreview:await qS(c),timestamp:Date.now(),durationMs:Date.now()-r})}if(vf({method:"POST",path:t,requestId:o,status:l.status,durationMs:Date.now()-r,code:a.code,msg:a.msg,envelopeRequestId:a.request_id,data:a.data}),this.checkAuthRequired(l,a.code),a.code!==0)throw new Wf({code:a.code,msg:a.msg,requestId:a.request_id,details:a.details,timestamp:Date.now(),durationMs:Date.now()-r});return a.data}async patch(t,n){return this.request("PATCH",t,n)}async delete(t){return this.request("DELETE",t)}async request(t,n,s,o,i=[]){let r=cu(this.origin,n);if(o){const h=new URLSearchParams;for(const[m,b]of Object.entries(o))b!==void 0&&h.set(m,String(b));const f=h.toString();f&&(r=`${r}?${f}`)}const l=ov(),a={"X-Request-Id":l};this.addClientHeaders(a),s!==void 0&&(a["Content-Type"]="application/json; charset=utf-8");const c=Date.now();tv({method:t,path:n,url:r,requestId:l,body:s});let u;try{u=await fetch(r,{method:t,headers:a,body:s!==void 0?JSON.stringify(s):void 0,signal:sv()})}catch(h){throw Xc({method:t,path:n,requestId:l,phase:"fetch",durationMs:Date.now()-c,error:h}),new $a({message:`Network error calling ${t} ${n}`,cause:h,method:t,path:n,url:r,requestId:l,phase:"fetch",timeoutMs:Na,timestamp:Date.now(),durationMs:Date.now()-c})}let d;const p=u.clone();try{d=await u.json()}catch(h){throw Xc({method:t,path:n,requestId:l,phase:"parse",durationMs:Date.now()-c,status:u.status,error:h}),new $a({message:`Failed to parse JSON response from ${t} ${n}`,cause:h,method:t,path:n,url:r,requestId:l,phase:"parse",timeoutMs:Na,status:u.status,statusText:u.statusText,contentType:u.headers.get("content-type")??void 0,bodyPreview:await qS(p),timestamp:Date.now(),durationMs:Date.now()-c})}if(vf({method:t,path:n,requestId:l,status:u.status,durationMs:Date.now()-c,code:d.code,msg:d.msg,envelopeRequestId:d.request_id,data:d.data}),this.checkAuthRequired(u,d.code),d.code!==0&&!i.includes(d.code))throw new Wf({code:d.code,msg:d.msg,requestId:d.request_id,details:d.details,timestamp:Date.now(),durationMs:Date.now()-c});return d.data}addClientHeaders(t){const n=k3();n!==void 0&&(t.Authorization=`Bearer ${n}`),this.identity!==void 0&&(t["X-Blun-Client-Id"]=this.identity.clientId,t["X-Blun-Client-Name"]=this.identity.clientName,t["X-Blun-Client-Version"]=this.identity.clientVersion,t["X-Blun-Client-Ui-Mode"]=this.identity.clientUiMode)}checkAuthRequired(t,n){(t.status===401||n===_G)&&bG()}}const AG="blun.bearer.";class TG{constructor(t,n,s){this.wsUrl=t,this.clientId=n,this.handlers=s}ws=null;connected=!1;closed=!1;subscriptions=new Map;pendingSubscriptions=[];terminalAttachments=new Map;msgSeq=0;reconnectAttempts=0;reconnectTimer=null;connect(){if(this.ws!==null||this.closed)return;xa("connect",{url:this.wsUrl,attempt:this.reconnectAttempts});const t=k3(),n=t!==void 0?[`${AG}${t}`]:void 0,s=new WebSocket(this.wsUrl,n);this.ws=s,s.onopen=()=>{xa("open")},s.onmessage=o=>{try{const i=JSON.parse(String(o.data));cG(i),this.handleFrame(i)}catch(i){xa("parse-error",{error:String(i)}),this.handlers.onError(0,`Failed to parse WS frame: ${String(i)}`,!1)}},s.onerror=()=>{xa("error"),this.handlers.onError(0,"WebSocket error",!1)},s.onclose=o=>{xa("close",o?{code:o.code,reason:o.reason,wasClean:o.wasClean}:void 0),this.connected=!1,this.ws=null,this.handlers.onConnectionState(!1),this.scheduleReconnect()}}scheduleReconnect(){if(this.closed||this.reconnectTimer!==null)return;const n=Math.min(3e4,1e3*2**this.reconnectAttempts)+Math.floor(Math.random()*250);this.reconnectAttempts+=1,xa("reconnect-scheduled",{delayMs:n,attempt:this.reconnectAttempts}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}subscribe(t,n={seq:0}){if(this.subscriptions.set(t,{...n}),this.connected)this.sendSubscribe([t],{[t]:n});else{const s=this.pendingSubscriptions.findIndex(o=>o.sessionId===t);s!==-1&&this.pendingSubscriptions.splice(s,1),this.pendingSubscriptions.push({sessionId:t,cursor:{...n}})}}unsubscribe(t){this.subscriptions.delete(t);const n=this.pendingSubscriptions.findIndex(s=>s.sessionId===t);n!==-1&&this.pendingSubscriptions.splice(n,1),this.connected&&this.ws&&this.send({type:"unsubscribe",id:this.nextId(),payload:{session_ids:[t]}})}abort(t,n){!this.connected||!this.ws||this.send({type:"abort",id:this.nextId(),payload:{session_id:t,prompt_id:n}})}terminalAttach(t,n,s){const o=yf(t,n),i=this.terminalAttachments.get(o),r=s??i?.lastSeq??0;this.terminalAttachments.set(o,{sessionId:t,terminalId:n,lastSeq:r}),!(!this.connected||!this.ws)&&this.sendTerminalAttach(t,n,r)}terminalInput(t,n,s){!this.connected||!this.ws||this.send({type:"terminal_input",id:this.nextId(),payload:{session_id:t,terminal_id:n,data:s}})}terminalResize(t,n,s,o){!this.connected||!this.ws||this.send({type:"terminal_resize",id:this.nextId(),payload:{session_id:t,terminal_id:n,cols:s,rows:o}})}terminalDetach(t,n){this.terminalAttachments.delete(yf(t,n)),!(!this.connected||!this.ws)&&this.send({type:"terminal_detach",id:this.nextId(),payload:{session_id:t,terminal_id:n}})}terminalClose(t,n){this.terminalAttachments.delete(yf(t,n)),!(!this.connected||!this.ws)&&this.send({type:"terminal_close",id:this.nextId(),payload:{session_id:t,terminal_id:n}})}close(){this.closed=!0,this.connected=!1,this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(1e3),this.ws=null)}handleFrame(t){const n=t;switch(t.type){case"server_hello":this.onServerHello();break;case"ping":this.send({type:"pong",payload:{nonce:n.payload.nonce}});break;case"resync_required":{const s=n.payload.session_id,o=n.payload.epoch;this.subscriptions.set(s,{seq:n.payload.current_seq,epoch:o}),this.handlers.onResync(s,n.payload.current_seq,o);break}case"error":{const s=n.session_id;typeof s=="string"&&this.handlers.onRawAgentEvent?this.handlers.onRawAgentEvent({type:"error",seq:n.seq,session_id:s,timestamp:n.timestamp,payload:n.payload}):this.handlers.onError(n.payload.code,n.payload.msg,n.payload.fatal);break}case"ack":break;case"terminal_output":{const s=n.session_id,o=n.terminal_id,i=n.seq,r=yf(s,o),l=this.terminalAttachments.get(r);l&&this.terminalAttachments.set(r,{...l,lastSeq:Math.max(l.lastSeq,i)});const a=typeof n.payload?.data=="string"?n.payload.data:"";this.handlers.onTerminalOutput?.(s,o,a,i);break}case"terminal_exit":{const s=n.session_id,o=n.terminal_id,i=n.payload?.exit_code,r=typeof i=="number"?i:null;this.handlers.onTerminalExit?.(s,o,r);break}default:{this.trackCursor(n);const s=n.type,o=eG(s,n.payload);if(o.route==="protocol"){this.handlers.onWireEvent(n);break}if(o.route==="agent"){if(this.handlers.onRawAgentEvent&&typeof n.session_id=="string"){const i=n,r=n;this.handlers.onRawAgentEvent({type:o.agentType,seq:i.seq,session_id:i.session_id,timestamp:i.timestamp,payload:i.payload,...r.volatile!==void 0?{volatile:r.volatile}:{},...r.offset!==void 0?{offset:r.offset}:{}})}break}break}}}onServerHello(){this.connected=!0,this.reconnectAttempts=0,this.handlers.onConnectionState(!0);const t=Array.from(this.subscriptions.keys());for(const s of this.pendingSubscriptions)this.subscriptions.set(s.sessionId,s.cursor),t.includes(s.sessionId)||t.push(s.sessionId);this.pendingSubscriptions.length=0;const n={};for(const[s,o]of this.subscriptions.entries())n[s]=o;this.send({type:"client_hello",id:this.nextId(),payload:{client_id:this.clientId,subscriptions:t,cursors:n}});for(const s of this.terminalAttachments.values())this.sendTerminalAttach(s.sessionId,s.terminalId,s.lastSeq)}sendSubscribe(t,n){this.send({type:"subscribe",id:this.nextId(),payload:{session_ids:t,cursors:n}})}sendTerminalAttach(t,n,s){this.send({type:"terminal_attach",id:this.nextId(),payload:{session_id:t,terminal_id:n,since_seq:s>0?s:void 0}})}trackCursor(t){if(t.volatile===!0)return;const n=t.session_id,s=t.seq;if(typeof n!="string"||typeof s!="number")return;const o=this.subscriptions.get(n);if(!o||s<=o.seq&&o.epoch!==void 0)return;const i=typeof t.epoch=="string"?t.epoch:o.epoch;this.subscriptions.set(n,{seq:Math.max(s,o.seq),epoch:i})}send(t){if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN))try{this.ws.send(JSON.stringify(t)),aG(t)}catch{}}nextId(){return`c_${++this.msgSeq}`}}function yf(e,t){return`${e}\0${t}`}function iv(e){return{id:e.id,sessionId:e.session_id,cwd:e.cwd,shell:e.shell,cols:e.cols,rows:e.rows,status:e.status,createdAt:e.created_at,exitedAt:e.exited_at,exitCode:e.exit_code}}function jS(e){return e==="auto_compact"||e==="manual_compact"}class MG{http;config;constructor(t){this.config=t,this.http=new xG(t.serverHttpUrl,{clientId:t.clientId,clientName:t.clientName,clientVersion:t.clientVersion,clientUiMode:t.clientUiMode})}async getHealth(){return{status:"ok",uptimeSec:(await this.http.get("/healthz")).uptime_sec??0}}async getMeta(){const t=await this.http.get("/meta");return{serverVersion:t.server_version,serverId:t.server_id,startedAt:t.started_at,capabilities:t.capabilities,openInApps:Array.isArray(t.open_in_apps)?t.open_in_apps:[],dangerousBypassAuth:t.dangerous_bypass_auth===!0}}async listSessions(t){const n={before_id:t?.beforeId,after_id:t?.afterId,page_size:t?.pageSize,status:t?.status?CK(t.status):void 0,include_archive:t?.includeArchive,exclude_empty:t?.excludeEmpty,workspace_id:t?.workspaceId},s=await this.http.get("/sessions",n);return{items:s.items.map(Ti),hasMore:s.has_more}}async createSession(t){const n={metadata:t.cwd!==void 0?{cwd:t.cwd}:{}};t.workspaceId!==void 0&&(n.workspace_id=t.workspaceId),t.title!==void 0&&(n.title=t.title),t.model!==void 0&&(n.agent_config={model:t.model});const s=await this.http.post("/sessions",n);return Ti(s)}async getSession(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}`);return Ti(n)}async updateSession(t,n){const s={};n.title!==void 0&&(s.title=n.title),n.cwd!==void 0&&(s.metadata={cwd:n.cwd});const o={};n.model!==void 0&&(o.model=n.model),n.permissionMode!==void 0&&(o.permission_mode=n.permissionMode),n.planMode!==void 0&&(o.plan_mode=n.planMode),n.swarmMode!==void 0&&(o.swarm_mode=n.swarmMode),n.goalObjective!==void 0&&(o.goal_objective=n.goalObjective),n.goalControl!==void 0&&(o.goal_control=n.goalControl),n.thinking!==void 0&&(o.thinking=n.thinking),Object.keys(o).length>0&&(s.agent_config=o);const i=await this.http.post(`/sessions/${encodeURIComponent(t)}/profile`,s);return Ti(i)}async getSessionStatus(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}/status`);return{model:n.model&&n.model.length>0?n.model:null,thinkingEffort:n.thinking_level,permission:n.permission,planMode:n.plan_mode===!0,swarmMode:n.swarm_mode===!0,contextTokens:n.context_tokens??0,maxContextTokens:n.max_context_tokens??0,contextUsage:n.context_usage??0}}async getSessionWarnings(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/warnings`)).warnings??[]}async archiveSession(t){return await this.http.post(`/sessions/${encodeURIComponent(t)}:archive`,{})}async listMessages(t,n){const s={before_id:n?.beforeId,after_id:n?.afterId,page_size:n?.pageSize,role:n?.role},o=await this.http.get(`/sessions/${encodeURIComponent(t)}/messages`,s);return{items:o.items.map(L1),hasMore:o.has_more}}async getSessionSnapshot(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}/snapshot`);return{asOfSeq:n.as_of_seq,epoch:n.epoch,session:Ti(n.session),messages:n.messages.items.map(L1),hasMoreMessages:n.messages.has_more,inFlightTurn:n.in_flight_turn===null?null:{turnId:n.in_flight_turn.turn_id,assistantText:n.in_flight_turn.assistant_text,thinkingText:n.in_flight_turn.thinking_text,runningTools:n.in_flight_turn.running_tools.map(s=>({toolCallId:s.tool_call_id,name:s.name,args:s.args,description:s.description,lastProgress:s.last_progress})),promptId:n.in_flight_turn.current_prompt_id},pendingApprovals:n.pending_approvals.map(m3),pendingQuestions:n.pending_questions.map(g3)}}async submitPrompt(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts`,AK(n));return{promptId:s.prompt_id,userMessageId:s.user_message_id,status:s.status}}async steerPrompts(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts:steer`,{prompt_ids:n});return{steered:s.steered,promptIds:s.prompt_ids}}async abortPrompt(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts/${encodeURIComponent(n)}:abort`,void 0,{allowCodes:[40903]});return{aborted:s.aborted,atSeq:s.at_seq}}async abortSession(t){return{aborted:(await this.http.post(`/sessions/${encodeURIComponent(t)}:abort`,{})).aborted}}async compactSession(t,n){await this.http.post(`/sessions/${encodeURIComponent(t)}:compact`,n?{instruction:n}:{})}async undoSession(t,n=1){await this.http.post(`/sessions/${encodeURIComponent(t)}:undo`,{count:n})}async forkSession(t,n){const s={};n?.title!==void 0&&(s.title=n.title);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}:fork`,s);return Ti(o)}async createChildSession(t,n){const s={};n?.title!==void 0&&(s.title=n.title);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/children`,s);return Ti(o)}async listChildSessions(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/children`)).items.map(Ti)}async startBtw(t){return{agentId:(await this.http.post(`/sessions/${encodeURIComponent(t)}:btw`,{})).agent_id}}async respondApproval(t,n,s){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/approvals/${encodeURIComponent(n)}`,TK(s));return{resolved:o.resolved,resolvedAt:o.resolved_at}}async respondQuestion(t,n,s){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/questions/${encodeURIComponent(n)}`,$K(s));return{resolved:o.resolved,resolvedAt:o.resolved_at}}async dismissQuestion(t,n){return{dismissed:!0,dismissedAt:(await this.http.post(`/sessions/${encodeURIComponent(t)}/questions/${encodeURIComponent(n)}:dismiss`,void 0,{allowCodes:[40909]})).dismissed_at}}async listTasks(t,n){const s={status:n};return(await this.http.get(`/sessions/${encodeURIComponent(t)}/tasks`,s)).items.map(O1)}async getTask(t,n,s){const o={with_output:s?.withOutput,output_bytes:s?.outputBytes},i=await this.http.get(`/sessions/${encodeURIComponent(t)}/tasks/${encodeURIComponent(n)}`,o);return O1(i)}async cancelTask(t,n){return await this.http.post(`/sessions/${encodeURIComponent(t)}/tasks/${encodeURIComponent(n)}:cancel`)}async listTerminals(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/terminals`)).items.map(iv)}async createTerminal(t,n={}){const s={cwd:n.cwd,shell:n.shell,cols:n.cols,rows:n.rows},o=await this.http.post(`/sessions/${encodeURIComponent(t)}/terminals`,s);return iv(o)}async getTerminal(t,n){const s=await this.http.get(`/sessions/${encodeURIComponent(t)}/terminals/${encodeURIComponent(n)}`);return iv(s)}async closeTerminal(t,n){return this.http.post(`/sessions/${encodeURIComponent(t)}/terminals/${encodeURIComponent(n)}:close`)}async listSkills(t){return((await this.http.get(`/sessions/${encodeURIComponent(t)}/skills`)).skills??[]).map(s=>({name:s.name,description:s.description,source:s.source}))}async activateSkill(t,n,s){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/skills/${encodeURIComponent(n)}:activate`,s!==void 0&&s.length>0?{args:s}:{});return{activated:o.activated,skillName:o.skill_name}}async listDirectory(t,n){const s={};n.path!==void 0&&(s.path=n.path),n.depth!==void 0&&(s.depth=n.depth),n.includeGitStatus!==void 0&&(s.include_git_status=n.includeGitStatus);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:list`,s),i=o.children_by_path?Object.fromEntries(Object.entries(o.children_by_path).map(([r,l])=>[r,l.map(NS)])):void 0;return{items:o.items.map(NS),childrenByPath:i,truncated:o.truncated}}async readFile(t,n){const s={path:n.path};n.offset!==void 0&&(s.offset=n.offset),n.length!==void 0&&(s.length=n.length);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:read`,s);return{path:o.path,content:o.content,encoding:o.encoding,size:o.size,truncated:o.truncated,etag:o.etag,mime:o.mime,languageId:o.language_id,lineCount:o.line_count,isBinary:o.is_binary}}async searchFiles(t,n){const s={query:n.query};n.limit!==void 0&&(s.limit=n.limit);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:search`,s);return{items:o.items.map(i=>({path:i.path,name:i.name,kind:i.kind,score:i.score,matchPositions:i.match_positions})),truncated:o.truncated}}async grepFiles(t,n){const s={pattern:n.pattern};n.regex!==void 0&&(s.regex=n.regex),n.caseSensitive!==void 0&&(s.case_sensitive=n.caseSensitive);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:grep`,s);return{files:o.files,filesScanned:o.files_scanned,truncated:o.truncated,elapsedMs:o.elapsed_ms}}async getGitStatus(t,n){const s={};n!==void 0&&(s.paths=n);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:git_status`,s);return{branch:o.branch,ahead:o.ahead,behind:o.behind,entries:o.entries,additions:o.additions,deletions:o.deletions,pullRequest:o.pullRequest??null}}async getFileDiff(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:diff`,{path:n});return{path:s.path,diff:s.diff}}getFileDownloadUrl(t,n){const s=n.split("/").map(o=>encodeURIComponent(o)).join("/");return cu(this.config.serverHttpUrl,`/sessions/${encodeURIComponent(t)}/fs/${s}:download`)}async openFile(t,n){const s={path:n.path};return n.line!==void 0&&(s.line=n.line),this.http.post(`/sessions/${encodeURIComponent(t)}/fs:open`,s)}async revealFile(t,n){return this.http.post(`/sessions/${encodeURIComponent(t)}/fs:reveal`,{path:n.path})}async openInApp(t,n,s,o){const i={app_id:n,path:s};o!==void 0&&(i.line=o),await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:open-in`,i)}async listWorkspaces(){try{return((await this.http.get("/workspaces")).items??[]).map(Su)}catch{return[]}}async addWorkspace(t){const n={root:t.root};t.name!==void 0&&(n.name=t.name);const s=await this.http.post("/workspaces",n);return Su(s)}async deleteWorkspace(t){await this.http.delete(`/workspaces/${encodeURIComponent(t)}`)}async updateWorkspace(t,n){const s=await this.http.patch(`/workspaces/${encodeURIComponent(t)}`,{name:n.name});return Su(s)}async browseFs(t){try{const n=await this.http.get("/fs:browse",{path:t});return{path:n.path,parent:n.parent,entries:(n.entries??[]).map(s=>({name:s.name,path:s.path,isDir:s.is_dir,isGitRepo:s.is_git_repo,branch:s.branch}))}}catch{return{path:"",parent:null,entries:[]}}}async getFsHome(){try{const t=await this.http.get("/fs:home");return{home:t.home,recentRoots:t.recent_roots??[]}}catch{return{home:"",recentRoots:[]}}}async listModels(){return(await this.http.get("/models")).items.map(OK)}async listProviders(){return(await this.http.get("/providers")).items.map(LS)}async addProvider(t){const n={type:t.type};t.apiKey!==void 0&&(n.api_key=t.apiKey),t.baseUrl!==void 0&&(n.base_url=t.baseUrl),t.defaultModel!==void 0&&(n.default_model=t.defaultModel);const s=await this.http.post("/providers",n);return LS(s)}async deleteProvider(t){return this.http.delete(`/providers/${encodeURIComponent(t)}`)}async refreshProvider(t){const n=await this.http.post(`/providers/${encodeURIComponent(t)}:refresh`);return rv(n)}async refreshAllProviders(){const t=await this.http.post("/providers:refresh");return rv(t)}async refreshOAuthProviderModels(){const t=await this.http.post("/providers:refresh_oauth");return rv(t)}async getConfig(){const t=await this.http.get("/config");return P1(t)}async setConfig(t){const n={},s={providers:"providers",defaultProvider:"default_provider",defaultModel:"default_model",models:"models",thinking:"thinking",planMode:"plan_mode",yolo:"yolo",defaultPermissionMode:"default_permission_mode",defaultPlanMode:"default_plan_mode",permission:"permission",hooks:"hooks",services:"services",mergeAllAvailableSkills:"merge_all_available_skills",extraSkillDirs:"extra_skill_dirs",loopControl:"loop_control",background:"background",experimental:"experimental",telemetry:"telemetry",raw:"raw"};for(const[i,r]of Object.entries(t)){const l=s[i];l!==void 0&&(n[l]=r)}const o=await this.http.post("/config",n);return P1(o)}async getAuth(){const t=await this.http.get("/auth");return{ready:t.ready,providersCount:t.providers_count,defaultModel:t.default_model,managedProvider:t.managed_provider?{status:t.managed_provider.status}:null}}async startOAuthLogin(){const t=await this.http.post("/oauth/login",{});return{flowId:t.flow_id,provider:t.provider,verificationUri:t.verification_uri,verificationUriComplete:t.verification_uri_complete,userCode:t.user_code,expiresIn:t.expires_in,interval:t.interval,status:t.status,expiresAt:t.expires_at}}async pollOAuthLogin(){const t=await this.http.get("/oauth/login");return t?{flowId:t.flow_id,status:t.status,resolvedAt:t.resolved_at}:null}async cancelOAuthLogin(){const t=await this.http.delete("/oauth/login");return{cancelled:t.cancelled,status:t.status}}async logout(){return{loggedOut:(await this.http.post("/oauth/logout",{})).logged_out}}async uploadFile(t){const n=new FormData;n.append("file",t.file,t.name??(t.file instanceof File?t.file.name:"upload")),t.name!==void 0&&n.append("name",t.name);const s=await this.http.postForm("/files",n);return{id:s.id,name:s.name,mediaType:s.media_type,size:s.size}}getFileUrl(t){return cu(this.config.serverHttpUrl,`/files/${encodeURIComponent(t)}`)}async getFileBlob(t){return this.http.getBlob(`/files/${encodeURIComponent(t)}`)}connectEvents(t){const n=M5(this.config.serverHttpUrl,this.config.clientId),s=XK(),o=new TG(n,this.config.clientId,{onWireEvent:i=>{const r=PK(i),l=RK(i),a=LK(i);a.type==="historyCompacted"&&!jS(a.reason)&&t.onResync(a.sessionId,a.beforeSeq),t.onEvent(a,{sessionId:r,seq:l})},onRawAgentEvent:i=>{const{type:r,seq:l,session_id:a,payload:c,offset:u}=i,d=s.project(r,c,a,{offset:u});for(const p of d)p.type==="historyCompacted"&&!jS(p.reason)&&t.onResync(a,l),t.onEvent(p,{sessionId:a,seq:l})},onResync:(i,r,l)=>{s.reset(i),t.onResync(i,r,l)},onConnectionState:i=>{t.onConnectionChange(i)},onError:(i,r,l)=>{t.onError(i,r,l)},onTerminalOutput:(i,r,l,a)=>{t.onTerminalOutput?.(i,r,l,a)},onTerminalExit:(i,r,l)=>{t.onTerminalExit?.(i,r,l)}});return o.connect(),{subscribe(i,r){o.subscribe(i,r??{seq:0})},unsubscribe(i){o.unsubscribe(i)},seedSnapshot(i,r){if(r.inFlightTurn===null){s.reset(i);return}const l=s.seedInFlight(i,r.inFlightTurn);for(const a of l)t.onEvent(a,{sessionId:i,seq:r.asOfSeq})},bindNextPromptId(i,r){s.bindNextPromptId(i,r)},abort(i,r){o.abort(i,r)},terminalAttach(i,r,l){o.terminalAttach(i,r,l)},terminalInput(i,r,l){o.terminalInput(i,r,l)},terminalResize(i,r,l,a){o.terminalResize(i,r,l,a)},terminalDetach(i,r){o.terminalDetach(i,r)},terminalClose(i,r){o.terminalClose(i,r)},markSideChannelAgent(i){s.markSideChannelAgent(i)},close(){o.close()}}}}function rv(e){return{changed:e.changed.map(t=>({providerId:t.provider_id,providerName:t.provider_name,added:t.added,removed:t.removed})),unchanged:e.unchanged,failed:e.failed}}let VS;function dt(){return VS??=new MG(S5()),VS}const EG=["src","controls","muted"],IG=["src","alt"],lv=je({__name:"AuthMedia",props:{url:{},kind:{},alt:{},fileId:{},mediaClass:{default:"u-img"},controls:{type:Boolean,default:!0},muted:{type:Boolean,default:!1}},setup(e){const t=e,n=Z(t.fileId?"":t.url),s=Z(null),o=Z(!t.fileId);let i=null,r=0,l=!1,a=null;function c(){i!==null&&(URL.revokeObjectURL(i),i=null)}async function u(){const d=++r;if(c(),!t.fileId){n.value=t.url;return}if(o.value)try{const p=await dt().getFileBlob(t.fileId),h=URL.createObjectURL(p);if(l||d!==r){URL.revokeObjectURL(h);return}i=h,n.value=i}catch{if(l||d!==r)return;n.value=t.url}}return Ke(()=>[t.fileId,t.url,o.value],u,{immediate:!0}),hn(()=>{typeof IntersectionObserver=="function"&&s.value?(a=new IntersectionObserver(d=>{d[0]?.isIntersecting&&(o.value=!0,a?.disconnect(),a=null)},{rootMargin:"200px"}),a.observe(s.value)):o.value=!0}),ls(()=>{l=!0,a?.disconnect(),a=null,c()}),(d,p)=>e.kind==="video"?(w(),N("video",{key:0,ref_key:"mediaEl",ref:s,class:Re(e.mediaClass),src:n.value||void 0,controls:e.controls,muted:e.muted,playsinline:"",preload:"metadata"},null,10,EG)):(w(),N("img",{key:1,ref_key:"mediaEl",ref:s,class:Re(e.mediaClass),src:n.value||void 0,alt:e.alt||"",loading:"lazy"},null,10,IG))}}),$G=["aria-label"],NG=120,LG=60,OG=je({__name:"MoonSpinner",props:{size:{default:"md"},fast:{type:Boolean},label:{default:"Waiting for response…"}},setup(e){const t=["🌑","🌒","🌓","🌔","🌕","🌖","🌗","🌘"];function n(s){return{"--moon-frame-delay":`${s*NG}ms`,"--moon-frame-fast-delay":`${s*LG}ms`}}return(s,o)=>(w(),N("span",{class:Re(["ui-moon",[`ui-moon--${e.size}`,{"ui-moon--fast":e.fast}]]),"aria-label":e.label,role:"img"},[(w(),N(Le,null,nt(t,(i,r)=>T("span",{key:i,class:"ui-moon__frame",style:Gt(n(r)),"aria-hidden":"true"},R(i),5)),64))],10,$G))}}),w3=ut(OG,[["__scopeId","data-v-ca9cc3be"]]);function PG(e,t="昨天"){try{const n=new Date(e);if(Number.isNaN(n.getTime()))return e;const s=new Date,o=u=>String(u).padStart(2,"0"),i=`${o(n.getHours())}:${o(n.getMinutes())}`,r=n.getFullYear()===s.getFullYear(),l=n.getMonth()===s.getMonth(),a=n.getDate()===s.getDate();if(r&&l&&a)return i;const c=new Date(s);return c.setDate(s.getDate()-1),n.getFullYear()===c.getFullYear()&&n.getMonth()===c.getMonth()&&n.getDate()===c.getDate()?`${t} ${i}`:r?`${o(n.getMonth()+1)}-${o(n.getDate())} ${i}`:`${n.getFullYear()}-${o(n.getMonth()+1)}-${o(n.getDate())} ${i}`}catch{return e}}const RG={class:"chat"},DG={key:0,class:"chat-loading"},BG={class:"chat-loading-text"},FG={key:1,class:"chat-empty"},HG={key:1,class:"top-sentinel-text"},WG=["data-turn-id"],zG={key:0,class:"u-imgs"},UG=["aria-label","onClick"],qG={key:1,class:"skill-act"},jG={class:"skill-act-head"},VG={key:0,class:"skill-act-args"},KG={key:2,class:"skill-act"},GG={class:"skill-act-head"},YG={key:0,class:"skill-act-args"},XG={key:3,class:"u-text"},QG={key:0,class:"u-meta"},ZG=["aria-label","onClick"],JG=["aria-label","onClick"],eY=["onClick"],tY=["data-turn-id"],nY=["onClick"],sY={class:"cd-view"},oY={key:1,class:"cd-label"},iY=["data-turn-id"],rY={key:1,class:"msg"},lY={key:0,class:"a-msg-ft"},aY={key:0,class:"a-duration"},cY=["aria-label","onClick"],uY={key:4,class:"sending-placeholder"},dY={key:5,class:"q-stack"},fY={class:"q-head"},pY={class:"q-title"},hY={class:"q-hint"},mY=["onDragover","onDrop"],gY={class:"u-bub q-bub"},vY=["title","onDragstart"],yY=["title","disabled","onClick"],kY={key:0,class:"u-text q-text"},bY={key:1,class:"q-text q-text-placeholder"},_Y={key:0,class:"q-imgs"},wY={key:1,class:"q-tag q-tag-next"},SY={key:2,class:"q-tag q-tag-idx"},CY=["aria-label","onClick"],xY=2500,AY=je({__name:"ChatPane",props:{turns:{},approvals:{default:()=>[]},running:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},fastMoon:{type:Boolean,default:!1},sessionLoading:{type:Boolean},compaction:{default:null},hasMoreMessages:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},loadingMoreError:{type:Boolean,default:!1},isFollowing:{type:Boolean,default:!1},toolDiffPanel:{type:Boolean,default:!1},queued:{default:()=>[]}},emits:["openFile","openMedia","copyConversationCopied","openThinking","openCompaction","openAgent","openToolDiff","editMessage","loadOlderMessages","unqueue","editQueued","reorderQueue"],setup(e,{expose:t,emit:n}){const{t:s}=It(),{confirm:o}=ol();kn(()=>{we!==null&&(clearTimeout(we),we=null),z!==null&&(clearTimeout(z),z=null),E!==null&&(clearTimeout(E),E=null)});const i=e,r=Z(null);let l=null;function a(){!r.value||typeof IntersectionObserver>"u"||(l?.disconnect(),l=new IntersectionObserver(le=>{le[0]?.isIntersecting&&i.hasMoreMessages&&!i.loadingMore&&!i.loadingMoreError&&!i.sessionLoading&&!i.isFollowing&&d("loadOlderMessages")},{root:null,rootMargin:"200px 0px 0px 0px",threshold:0}),l.observe(r.value))}hn(a),kn(()=>{l?.disconnect(),l=null}),Ke(()=>[i.hasMoreMessages,i.loadingMore,i.loadingMoreError],()=>{ht().then(a)});const c=F(()=>{if(!i.running||i.turns.length===0)return null;const le=i.turns.at(-1);return le.role==="assistant"?le.id:null}),u=F(()=>i.sending||i.running),d=n,p=Z(null),h=Z(null);function f(le){return(le.attachments?.length??0)>0}function m(le,U){f(U)||d("editQueued",le)}function b(le,U){if(p.value=le,!U.dataTransfer)return;U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",String(le));const G=U.currentTarget?.closest(".q-turn");G&&U.dataTransfer.setDragImage(G,24,24)}function _(le,U){if(p.value===null)return;U.preventDefault(),U.dataTransfer&&(U.dataTransfer.dropEffect="move");const G=U.currentTarget.getBoundingClientRect(),ne=U.clientY<G.top+G.height/2?"before":"after";h.value={index:le,position:ne}}function g(le,U){U.preventDefault();const G=p.value,ne=h.value?.position??"before";if(p.value=null,h.value=null,G===null)return;let H=ne==="before"?le:le+1;G<H&&(H-=1),G!==H&&d("reorderQueue",{from:G,to:H})}function v(){p.value=null,h.value=null}const y=F(()=>{for(let le=i.turns.length-1;le>=0;le--)if(i.turns[le].role==="user")return i.turns[le].id;return null});function A(le){return le.role==="user"&&le.id===y.value&&!i.running&&!i.sending&&!le.skillActivation&&!le.pluginCommand}function O(le){const U=le.compaction,G=U?.trigger==="auto"?s("conversation.compactedAuto"):s("conversation.compactedPlain");return typeof U?.tokensBefore=="number"&&typeof U?.tokensAfter=="number"?G+s("conversation.compactedTokens",{before:R_(U.tokensBefore),after:R_(U.tokensAfter)}):G}const $=Z(null),k=Z(null);let E=null;const M=Z(new Set);function L(le){return M.value.has(le)}function S(le){const U=new Set(M.value);U.has(le)?U.delete(le):U.add(le),M.value=U}function I(le,U){if(L(U)){const G=new Date(le);if(Number.isNaN(G.getTime()))return le;const ne=H=>String(H).padStart(2,"0");return`${G.getFullYear()}-${ne(G.getMonth()+1)}-${ne(G.getDate())} ${ne(G.getHours())}:${ne(G.getMinutes())}`}return PG(le,s("conversation.yesterday"))}async function P(le){await o({title:s("conversation.undo"),message:s("conversation.undoConfirm"),variant:"primary"})&&D(le)}function D(le){k.value===null&&(k.value=le.id,d("editMessage",le.text),E=setTimeout(()=>{E=null,k.value=null},xY))}Ke(()=>i.turns,le=>{k.value!==null&&(le.some(U=>U.id===k.value)||(k.value=null,E!==null&&(clearTimeout(E),E=null)))},{flush:"post"});const W=Z(!1);let z=null;function q(){if(i.turns.length===0)return;const le=[];for(const G of i.turns){if(G.role==="compaction")continue;const ne=G.role==="user"?"User":"Assistant",H=LP(G);H.trim()&&le.push(`**${ne}**
|
|
245
|
+
`)&&!(function(D){const W=wS(D);if(SS(W))return!1;const z=i3(W);return z.length>=2&&z.some(q=>q.trim())})(I))})(r.value,E)?b():(function(){if(h+=1,l)return;const S=Math.max(0,(function(I){const P=I.parseCoalesceMs;return typeof P=="number"&&Number.isFinite(P)&&P>=0?P:80})(e)-(ai()-f));S<=0?b():l=setTimeout(b,S)})())},{flush:"sync",immediate:!0}),K1(m);const _=F(()=>{var E,M,L,S;return Y9(e.customHtmlTags,(E=e.parseOptions)==null?void 0:E.customHtmlTags,(S=(L=(M=t.customComponentsMap)==null?void 0:M.value)!=null?L:{},Object.entries(S).map(([I,P])=>{const D=si(I);return P==null||!D||dd(D)||RT.has(D)||ad.has(D)?"":D}).filter(Boolean)))}),g=F(()=>{const{key:E,tags:M}=X9(_.value);if(!E)return s;const L=o.get(E);if(L)return L;const S=E2(t.instanceMsgId,{customHtmlTags:M});return o.set(E,S),S}),v=F(()=>{const E=g.value;return e.customMarkdownIt?e.customMarkdownIt(E):E}),y=F(()=>{var E,M;const L=(E=e.parseOptions)!=null?E:{},S=t.effectiveFinal.value,I=_.value,P=S!=null,D=I.length>0;return P||D||L.streamParse==null?it(it(Lt(it({},L),{streamParse:(M=L.streamParse)==null||M}),P?{final:S}:{}),D?{customHtmlTags:I}:{}):L}),A=F(()=>{var E;return new Set(((E=y.value.customHtmlTags)!=null?E:[]).map(M=>String(M).trim().toLowerCase()).filter(Boolean))}),O=F(()=>_S(y.value,v.value,e.customMarkdownIt,{includeFinal:!0})),$=F(()=>_S(y.value,v.value,e.customMarkdownIt,{includeFinal:!1}));Ke([O,$],([E,M],[L,S])=>{L&&(E===L&&M===S||(b(),M!==S&&(a=[],d="")))},{flush:"sync"});const k=F(()=>{var E,M,L,S,I,P,D,W;if((E=e.nodes)!=null&&E.length)return a=[],d="",Dr(e.nodes.slice());const z=r.value;if(!z)return a=[],d="",[];const q=t.debugPerformanceEnabled.value,Q=q?ai():0,X=v.value,fe=O.value,ye=$.value;c&&fe!==c&&(function(ce){var te,ue;(ue=(te=ce.stream)==null?void 0:te.reset)==null||ue.call(te)})(X),u&&ye!==u&&(a=[],d="");const Me=a.length>0&&z.startsWith(d)&&ye===u,we=q?bS(X):null,ze=q?{}:void 0,Ue=ze?Lt(it({},y.value),{__timing:ze}):y.value,Fe=CM(z,X,Ue),rt=q?ai():0,le=q?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let U,G=q?Vg(Fe.length):void 0,ne=0,H=0;if(Me){const ce=q?ai():0;if(le){const te=(function(ue,j,Y){if(!j.length)return{nodes:ue,metrics:Vg(ue.length)};const re=(function(Ie,ae,Te){const Ve=Math.min(Ie.length,ae.length);for(let tt=0;tt<Ve;tt++)if(!MV(ae[tt],Ie[tt],Te))return tt;return Ie.length===ae.length?-1:Ve})(ue,j,Y);if(re<0)return{nodes:j,metrics:{reusedNodeCount:ue.length,dirtyStartIndex:re,stablePrefixNodeCount:ue.length,dirtyTailNodeCount:0}};const ge=ue.slice();let Ae=re;for(let Ie=0;Ie<re;Ie++)ge[Ie]=j[Ie];for(let Ie=re;Ie<ue.length;Ie++){const ae=j[Ie],Te=ue[Ie];ae&&c3(ae,Te,Y)&&(ge[Ie]=ae,Ae+=1)}return{nodes:ge,metrics:{reusedNodeCount:Ae,dirtyStartIndex:re,stablePrefixNodeCount:re,dirtyTailNodeCount:xS(re,ue,j)}}})(Fe,a,le);U=te.nodes,G=te.metrics}else{const te=(function(ue,j){if(!j.length)return{nodes:ue,metrics:Vg(ue.length)};const Y=(function(Ae,Ie){const ae=Math.min(Ae.length,Ie.length);for(let Te=0;Te<ae;Te++)if(!TV(Ie[Te],Ae[Te]))return Te;return Ae.length===Ie.length?-1:ae})(ue,j);if(Y<0)return{nodes:j,metrics:{reusedNodeCount:ue.length,dirtyStartIndex:Y,stablePrefixNodeCount:ue.length,dirtyTailNodeCount:0}};const re=ue.slice();let ge=Y;for(let Ae=0;Ae<Y;Ae++)re[Ae]=j[Ae];for(let Ae=Y;Ae<ue.length;Ae++){const Ie=j[Ae],ae=ue[Ae];Ie&&a3(Ie,ae)&&(re[Ae]=Ie,ge+=1)}return{nodes:re,metrics:{reusedNodeCount:ge,dirtyStartIndex:Y,stablePrefixNodeCount:Y,dirtyTailNodeCount:xS(Y,ue,j)}}})(Fe,a);U=te.nodes,G=te.metrics}ne=q?ai()-ce:0,H=G?.dirtyStartIndex==null||G.dirtyStartIndex<0?U.length:G.dirtyStartIndex}else U=Fe;le?(function(ce,te,ue=0){for(let j=Math.max(0,ue);j<ce.length;j++)py(te,"primeSignatureMs",()=>Jr(ce[j]))})(U,le,H):(function(ce,te=0){for(let ue=Math.max(0,te);ue<ce.length;ue++)Jr(ce[ue])})(U,H);const J=q?ai()-rt:0;if(p+=1,d=z,c=fe,u=ye,a=U,q){const ce=bS(X),te=typeof ce?.total=="number"&&ce.total>((M=we?.total)!=null?M:0);t.logPerf(te?"parse(stream)":"parse(sync)",it(it(it({rendererId:t.instanceMsgId,ms:Math.round(ai()-Q),nodes:U.length,contentLength:z.length,parseCommitCount:p,parseCoalescedCount:h,nodeReuseMs:J,signatureMs:(L=le?.signatureMs)!=null?L:0,stabilizeSignatureMs:(S=le?.stabilizeSignatureMs)!=null?S:0,primeSignatureMs:(I=le?.primeSignatureMs)!=null?I:0,signatureCallCount:(P=le?.signatureCallCount)!=null?P:0,stabilizeSignatureCallCount:(D=le?.stabilizeSignatureCallCount)!=null?D:0,primeSignatureCallCount:(W=le?.primeSignatureCallCount)!=null?W:0,stabilizeMs:ne},G??{}),ze?Object.fromEntries(_V.map(ue=>{var j;return[ue,(j=ze[ue])!=null?j:0]})):{}),ce?{streamMode:ce.lastMode,streamDelta:EV(ce,we),streamStats:ce}:{}))}return Dr(U)});return{effectiveCustomHtmlTags:_,effectiveCustomHtmlTagsSet:A,mdBase:g,mdInstance:v,mergedParseOptions:y,parsedNodes:k}}function $V(e){const{isClient:t}=e,n=Z(new Set),s=new Map,o=new Map,i=new Map;function r(c){if(!t)return;const u=i.get(c);u!=null&&(window.clearTimeout(u),i.delete(c))}function l(){if(t)for(const c of i.values())window.clearTimeout(c);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:s,nodeVisibilityWatchStops:o,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(c,u=!0){var d;u&&r(c),(function(p,h){if((m=(f=e.shouldTrackVisibleNodeIndices)==null?void 0:f.call(e))!=null&&!m)return;var f,m;const b=n.value,_=b.has(p);if(h){if(_)return;const v=new Set(b);return v.add(p),void(n.value=v)}if(!_)return;const g=new Set(b);g.delete(p),n.value=g})(c,u),u&&((d=e.onNodeMarkedVisible)==null||d.call(e,c))},resetNodeVisibleState:a,cleanupNodeVisibility:function(c){var u;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[p,h]of o.entries())p<c||(h(),o.delete(p));for(const[p,h]of s.entries())p<c||(h.destroy(),s.delete(p),r(p),(u=e.onNodeVisibilityCleaned)==null||u.call(e,p));for(const p of Array.from(i.keys()))p<c||r(p);if(!n.value.size)return;const d=new Set;for(const p of n.value)p<c&&d.add(p);n.value=d},destroyNodeVisibilityState:function(){a();for(const c of o.values())c();o.clear();for(const c of s.values())c.destroy();s.clear(),l()}}}function NV(e={}){const t=Z(""),n=Z(""),s=Z(!1),o=LU(e),i=()=>{const u=o.getSnapshot();t.value=u.source,n.value=u.visible,s.value=u.done},r=o.subscribe(i);i();const l=F(()=>Math.max(0,t.value.length-n.value.length)),a=F(()=>l.value===0),c=F(()=>s.value&&a.value);return V1()&&K1(()=>{r(),o.destroy()}),{source:t,visible:n,done:s,final:c,caughtUp:a,pendingChars:l,enqueue:u=>o.enqueue(u),finish:u=>o.finish(u),flush:()=>o.flush(),reset:u=>o.reset(u),pause:()=>o.pause(),resume:()=>o.resume()}}const AS=/auto|scroll|overlay/i;function LV(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return AS.test(t)||AS.test(n)}function OV(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const PV=je({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=F(()=>{var n,s;return g1((s=Ha(e.estimatedPreviewHeightPx))!=null?s:h1(String((n=e.node.code)!=null?n:"")))});return()=>cn("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?cn("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[cn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[cn("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),cn("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),cn("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>cn("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,cn("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[cn("div",{class:"absolute inset-0"},[cn("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}),RV=je({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=F(()=>{var n,s;return m1((s=Ha(e.estimatedPreviewHeightPx))!=null?s:p1(String((n=e.node.code)!=null?n:"")))});return()=>cn("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?cn("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[cn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[cn("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),cn("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>cn("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[cn("span",{class:"action-icon block"})])))]):null,cn("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[cn("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}),DV=["data-custom-id"],BV={class:"m-0 p-0"},FV=["data-probe"],HV=["data-node-index","data-node-type"],u3=un(je(Lt(it({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},htmlPolicy:{},viewportPriority:{type:Boolean},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:Boolean,default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const s=e,o=n,i=Ls(),r=Ut("markstreamNestedRendererProps",void 0);function l(C){var B,V;const K=s[C];return(function(ee){const he=i?.vnode.props;return!!he&&(Object.prototype.hasOwnProperty.call(he,ee)||Object.prototype.hasOwnProperty.call(he,String(ee).replace(/[A-Z]/g,ke=>`-${ke.toLowerCase()}`)))})(C)?K:(V=(B=r?.value)==null?void 0:B[C])!=null?V:K}const a={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:16,renderBatchSize:16,renderBatchDelay:8,renderBatchBudgetMs:4,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}},c=F(()=>{return(C=l("mode"))==="chat"||C==="minimal"||C==="docs"?C:"docs";var C}),u=F(()=>{const C=l("renderCodeBlocksAsPre"),B=l("codeRenderer");return C===!0?"pre":B==="pre"||B==="shiki"||B==="monaco"?B:C===!1||c.value==="docs"?"monaco":"pre"}),d=F(()=>a[c.value]),p=F(()=>{var C;return(C=l("showTooltips"))!=null?C:d.value.showTooltips}),h=F(()=>{var C;return(C=l("fade"))!=null?C:d.value.fade}),f=F(()=>{var C;return(C=l("batchRendering"))!=null?C:d.value.batchRendering}),m=F(()=>{var C;return(C=l("initialRenderBatchSize"))!=null?C:d.value.initialRenderBatchSize}),b=F(()=>{var C;return(C=l("renderBatchSize"))!=null?C:d.value.renderBatchSize}),_=F(()=>{var C;return(C=l("renderBatchDelay"))!=null?C:d.value.renderBatchDelay}),g=F(()=>{var C;return(C=l("renderBatchBudgetMs"))!=null?C:d.value.renderBatchBudgetMs}),v=F(()=>{var C;return(C=l("renderBatchIdleTimeoutMs"))!=null?C:d.value.renderBatchIdleTimeoutMs}),y=F(()=>{var C;return(C=l("deferNodesUntilVisible"))!=null?C:d.value.deferNodesUntilVisible}),A=F(()=>{var C;return(C=l("maxLiveNodes"))!=null?C:d.value.maxLiveNodes}),O=F(()=>{var C;return(C=l("liveNodeBuffer"))!=null?C:d.value.liveNodeBuffer}),$=F(()=>{var C;return(C=l("nodeVirtual"))!=null?C:d.value.nodeVirtual}),k={get content(){return s.content},get nodes(){return s.nodes},get final(){return s.final},get parseOptions(){return l("parseOptions")},get customMarkdownIt(){return l("customMarkdownIt")},get debugPerformance(){return s.debugPerformance},get customHtmlTags(){return l("customHtmlTags")},get mode(){return l("mode")},get htmlPolicy(){return l("htmlPolicy")},get viewportPriority(){return l("viewportPriority")},get codeBlockStream(){return l("codeBlockStream")},get codeBlockDarkTheme(){return l("codeBlockDarkTheme")},get codeBlockLightTheme(){return l("codeBlockLightTheme")},get codeBlockMonacoOptions(){return l("codeBlockMonacoOptions")},get codeRenderer(){return l("codeRenderer")},get renderCodeBlocksAsPre(){return l("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return l("codeBlockMinWidth")},get codeBlockMaxWidth(){return l("codeBlockMaxWidth")},get codeBlockProps(){return l("codeBlockProps")},get mermaidProps(){return l("mermaidProps")},get d2Props(){return l("d2Props")},get infographicProps(){return l("infographicProps")},get showTooltips(){return p.value},get themes(){return l("themes")},get langs(){return l("langs")},get isDark(){return l("isDark")},get customId(){return l("customId")},get indexKey(){return s.indexKey},get typewriter(){return l("typewriter")},get smoothStreaming(){return s.smoothStreaming},get smoothStreamingOptions(){return l("smoothStreamingOptions")},get parseCoalesceMs(){return l("parseCoalesceMs")},get fade(){return h.value},get batchRendering(){return f.value},get initialRenderBatchSize(){return m.value},get renderBatchSize(){return b.value},get renderBatchDelay(){return _.value},get renderBatchBudgetMs(){return g.value},get renderBatchIdleTimeoutMs(){return v.value},get deferNodesUntilVisible(){return y.value},get maxLiveNodes(){return A.value},get liveNodeBuffer(){return O.value},get nodeVirtual(){return $.value},get virtualScroll(){return s.virtualScroll},get renderAsFragment(){return s.renderAsFragment}};function E(C){o("height-change",C)}function M(C){o("virtual-state-change",C)}function L(C){o("anchor-change",C)}const S=Z(),I=Z(null),P=Z(null),D=Z(null),W=$s({1:null,2:null,3:null,4:null,5:null,6:null}),z=Z(!1),q=new Map,Q=Z(0),X=Z(0),fe=Z({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function ye(){var C,B;if(((C=s.virtualScroll)==null?void 0:C.enabled)!==!0)return null;const V=(B=s.virtualScroll)==null?void 0:B.scrollRoot;return Me(typeof V=="function"?V():V)}function Me(C){return C?typeof HTMLElement<"u"&&C instanceof HTMLElement?C:typeof C=="object"&&"value"in C?Me(C.value):typeof C=="object"&&"$el"in C?Me(C.$el):null:null}const{isClient:we,renderAsFragment:ze,debugPerformanceEnabled:Ue,resolvedShowTooltips:Fe,resolvedHtmlPolicy:rt,inheritedSmoothStreaming:le,ownsTypewriterCursor:U}=(function(C){const B=typeof window<"u",V=nd(),K=Ut("markstreamHtmlPolicy",void 0),ee=Ut("markstreamTypewriterCursor",void 0),he=Ut("markstreamSmoothStreaming",void 0),ke=F(()=>C.renderAsFragment===!0),Se=F(()=>!!(C.debugPerformance&&B&&typeof console<"u")),Pe=F(()=>{var De;if(typeof C.showTooltips=="boolean")return C.showTooltips;const $e=(De=V.showTooltips)!=null?De:V["show-tooltips"];return $e===""||$e===!0||$e==="true"||$e!==!1&&$e!=="false"&&void 0}),Ee=F(()=>{var De,$e;return($e=(De=C.htmlPolicy)!=null?De:K?.value)!=null?$e:"safe"}),We=F(()=>ee?.value!==!0);return{isClient:B,renderAsFragment:ke,debugPerformanceEnabled:Se,resolvedShowTooltips:Pe,resolvedHtmlPolicy:Ee,inheritedSmoothStreaming:he,inheritedTypewriterCursor:ee,ownsTypewriterCursor:We}})(k),{resolveViewportRoot:G,resolveScrollContainer:ne,isReverseFlexScrollRoot:H,getNormalizedScrollTop:J,getOffsetTopWithinRoot:ce}=(function(C,B){function V(){var Se,Pe;return(Pe=(Se=B.scrollRoot)==null?void 0:Se.call(B))!=null?Pe:null}function K(Se){if(typeof window>"u")return null;const Pe=V();if(Pe)return Pe;const Ee=Se??C.value;if(!Ee)return null;const We=Ee.ownerDocument||document,De=We.scrollingElement||We.documentElement;let $e=Ee;for(;$e&&$e!==We.body&&$e!==De;){if(LV(window.getComputedStyle($e))&&OV($e))return $e;$e=$e.parentElement}return null}function ee(Se){if(!B.isClient)return!1;try{const Pe=window.getComputedStyle(Se);return!!(Pe.display||"").toLowerCase().includes("flex")&&(Pe.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function he(Se,Pe,Ee){var We,De;if(Ee)return ke(Pe);const $e=Se.scrollTop;if(!ee(Se))return $e;const He=$e<0?-$e:$e;return Math.max(0,((We=Se.scrollHeight)!=null?We:0)-((De=Se.clientHeight)!=null?De:0))-He}function ke(Se){var Pe,Ee,We,De,$e;const He=Number((Pe=Se.scrollingElement)==null?void 0:Pe.scrollTop),Qe=Number((We=(Ee=Se.documentElement)==null?void 0:Ee.scrollTop)!=null?We:0),Ze=Number(($e=(De=Se.body)==null?void 0:De.scrollTop)!=null?$e:0);return Math.max(0,Number.isFinite(He)?He:0,Number.isFinite(Qe)?Qe:0,Number.isFinite(Ze)?Ze:0)}return{resolveViewportRoot:K,resolveScrollContainer:function(Se){var Pe,Ee,We,De;const $e=V();if($e)return $e;const He=K((Pe=Se??C.value)!=null?Pe:null);if(He)return He;const Qe=(De=(We=Se?.ownerDocument)!=null?We:(Ee=C.value)==null?void 0:Ee.ownerDocument)!=null?De:typeof document<"u"?document:null;return Qe?.scrollingElement||Qe?.documentElement||null},isReverseFlexScrollRoot:ee,getNormalizedScrollTop:he,getOffsetTopWithinRoot:function(Se,Pe){const Ee=Pe.ownerDocument||Se.ownerDocument||document;if((function(He,Qe){return He===Qe.documentElement||He===Qe.body||He===Qe.scrollingElement})(Pe,Ee))return Se.getBoundingClientRect().top+ke(Ee);const We=Pe.getBoundingClientRect(),De=Se.getBoundingClientRect(),$e=he(Pe,Ee,!1);return De.top-We.top+$e}}})(S,{isClient:we,scrollRoot:ye});En("markstreamShowTooltips",Fe),En("markstreamHtmlPolicy",rt),En("markstreamTypewriter",F(()=>k.typewriter!==!1)),En("markstreamFade",F(()=>k.fade!==!1)),En("markstreamTypewriterCursor",F(()=>!0)),En("markstreamTextStreamState",q),En("markstreamStreamVersion",Q),En("markstreamParseOptions",F(()=>k.parseOptions)),En("markstreamCustomMarkdownIt",F(()=>k.customMarkdownIt));const{smoothStreamingEnabled:te,renderContent:ue,effectiveFinal:j}=(function(C,B){const V=NV(C.smoothStreamingOptions),K=F(()=>{var Ee,We,De;return C.smoothStreaming!==!1&&!((Ee=C.nodes)!=null&&Ee.length)&&(C.smoothStreaming===!0||!((We=B.inheritedSmoothStreaming)!=null&&We.value))&&(C.smoothStreaming===!0||C.typewriter===!0||((De=C.maxLiveNodes)!=null?De:0)<=0)}),ee=Z(!B.isClient||C.smoothStreaming===!0);hn(()=>{ee.value=!0});const he=F(()=>ee.value&&K.value),ke=F(()=>{var Ee;return he.value?V.visible.value:(Ee=C.content)!=null?Ee:""}),Se=F(()=>{var Ee,We;const De=(Ee=C.parseOptions)!=null?Ee:{};return(We=C.final)!=null?We:De.final}),Pe=F(()=>{const Ee=Se.value;return he.value&&Ee!=null?!!Ee&&V.caughtUp.value:Ee});return Ke([()=>C.content,()=>C.nodes,he,Se],([Ee,We,De,$e])=>{if(We?.length)return void V.reset("");const He=Ee??"";if(!De)return V.reset(He),void($e&&V.finish({flush:!0}));const Qe=V.source.value;He?He===Qe||(He.startsWith(Qe)?V.enqueue(He.slice(Qe.length)):V.reset(He)):V.reset(""),$e&&V.finish()},{immediate:!0}),{smoothStream:V,smoothStreamingEligible:K,smoothStreamingEnabled:he,renderContent:ke,requestedFinal:Se,effectiveFinal:Pe}})(k,{isClient:we,inheritedSmoothStreaming:le});En("markstreamSmoothStreaming",te);const Y=Z(!1);let re="",ge=!1,Ae=null;function Ie(){we&&Ae!=null&&(window.clearTimeout(Ae),Ae=null)}function ae(){Y.value=!1,Ie()}function Te(C,B){if(!Ue.value)return;const V=(function(){if(!Ue.value)return null;const K=Tt(Ve),ee=Tt(tt),he=Math.max(kt,ee);if(K<=0&&he<=0)return null;const ke={total:K,maxPerFrame:he,byLabel:(Se=Ve,Object.fromEntries(Array.from(Se.entries()).sort((Pe,Ee)=>Ee[1]-Pe[1]||Pe[0].localeCompare(Ee[0]))))};var Se;return Ve.clear(),tt.clear(),kt=0,ke})();console.info(`[markstream-vue][perf] ${C}`,V?Lt(it({},B),{layoutReads:V}):B)}Ke([ue,()=>s.nodes,j],([C,B,V])=>{const K=C??"";return B?.length||V===!0?(ae(),re=K,void(ge=!0)):ge?(re&&K.length>re.length&&K.startsWith(re)?(Y.value=!0,we&&(Ie(),Ae=window.setTimeout(()=>{var ee;Ae=null,j.value===!0||(ee=s.nodes)!=null&&ee.length||(fa(),Y.value=!1,Pi())},1200))):(K.length<re.length||!K.startsWith(re))&&ae(),void(re=K)):(re=K,void(ge=!0))},{flush:"sync",immediate:!0});const Ve=new Map,tt=new Map;let bt=!1,kt=0;function Tt(C){let B=0;for(const V of C.values())B+=V;return B}function Pt(){kt=Math.max(kt,Tt(tt)),tt.clear(),bt=!1}function mt(C,B){return(function(V){var K,ee;Ue.value&&(Ve.set(V,((K=Ve.get(V))!=null?K:0)+1),tt.set(V,((ee=tt.get(V))!=null?ee:0)+1),bt||(bt=!0,we&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(Pt):typeof queueMicrotask!="function"?setTimeout(Pt,0):queueMicrotask(Pt)))})(C),B()}const Yt=k.customId?`renderer-${k.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Rn=(function(C){const B=new Map;return{scope:C,cache:B,clear:()=>B.clear()}})(Yt),Dn=F(()=>`${Yt}:${Q.value}`);En(s3,Rn);const Ft=cs(()=>k.customId),{effectiveCustomHtmlTagsSet:bn,mergedParseOptions:Vn,parsedNodes:st}=IV(k,{instanceMsgId:Yt,renderContent:ue,effectiveFinal:j,smoothStreamingEnabled:te,debugPerformanceEnabled:Ue,customComponentsMap:Ft,logPerf:Te});Ke(st,()=>{Rn.clear(),Q.value+=1},{immediate:!0});const In=F(()=>({customId:k.customId,customHtmlTags:Vn.value.customHtmlTags,parseOptions:k.parseOptions,customMarkdownIt:k.customMarkdownIt,htmlPolicy:rt.value,viewportPriority:k.viewportPriority,mode:c.value,codeRenderer:u.value,codeBlockStream:k.codeBlockStream,codeBlockDarkTheme:k.codeBlockDarkTheme,codeBlockLightTheme:k.codeBlockLightTheme,codeBlockMonacoOptions:k.codeBlockMonacoOptions,renderCodeBlocksAsPre:k.renderCodeBlocksAsPre,codeBlockMinWidth:k.codeBlockMinWidth,codeBlockMaxWidth:k.codeBlockMaxWidth,codeBlockProps:k.codeBlockProps,mermaidProps:k.mermaidProps,d2Props:k.d2Props,infographicProps:k.infographicProps,showTooltips:Fe.value,themes:k.themes,langs:k.langs,isDark:k.isDark,typewriter:k.typewriter,smoothStreamingOptions:k.smoothStreamingOptions,parseCoalesceMs:k.parseCoalesceMs,fade:k.fade}));En("markstreamNestedRendererProps",In);const _n=F(()=>st.value),Kn=F(()=>st.value.length),$n=Z(null),Ge=Z(null),Ye=Z(null),Ct=Z(null),$t=s.indexKey!=null&&String(s.indexKey).startsWith("list-item-"),mn=!$t&&k.customId?hS(k.customId):null,Nn=F(()=>mn?(pS.value,hS(k.customId)):null),tn=F(()=>{var C;return!!(we&&!ze.value&&k.customId&&!$t&&((C=Nn.value)!=null&&C.enabled))}),Ln=F(()=>{var C;return!!(!ze.value&&((C=s.virtualScroll)!=null&&C.enabled))}),Zn=Z(!1);hn(()=>{Zn.value=!0});const Mt=F(()=>!!(we&&Ln.value));En("markstreamHostScrollManaged",Mt);const us=F(()=>!!(Zn.value&&Mt.value)),Xt=F(()=>tn.value||Mt.value),oi=F(()=>tn.value||us.value),bs=F(()=>{var C;return Xt.value&&((C=Nn.value)==null?void 0:C.textEstimation)!==!1}),Do=F(()=>{var C;return Xt.value&&((C=Nn.value)==null?void 0:C.codeBlockEstimation)!==!1});function so(){const C=X.value||mt("getMeasuredContainerWidth.clientWidth",()=>{var B;return((B=S.value)==null?void 0:B.clientWidth)||0});return Number.isFinite(C)&&C>0?C:0}const qs=F(()=>{const C=so();return C>0?Math.max(1,Math.round(C)):640}),oo=F(()=>{var C;return Math.max(1,(C=k.maxLiveNodes)!=null?C:320)}),Nt=F(()=>{var C;return!ze.value&&k.nodeVirtual!==!1&&!(((C=k.maxLiveNodes)!=null?C:0)<=0)&&(k.nodeVirtual===!0?st.value.length>0:st.value.length>oo.value)}),Xe=F(()=>Nt.value||tn.value||Mt.value),ot=F(()=>k.viewportPriority!==!1&&!z.value),de=yj(C=>{var B;return G((B=C??S.value)!=null?B:null)},ot),{requestFrame:pe,cancelFrame:Oe,hasIdleCallback:Qt,isTestEnv:Wt}=(function(C){const B=C.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,V=C.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,K=C.isClient&&typeof window.requestIdleCallback=="function",ee=(function(){var he;if(typeof globalThis>"u"||!("process"in globalThis))return;const ke=(he=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:he.value;return ke?.env})();return{requestFrame:B,cancelFrame:V,hasIdleCallback:K,isTestEnv:ee?.NODE_ENV==="test"}})({isClient:we}),{resolvedBatchSize:ds,resolvedInitialBatch:Bn,batchingEnabled:bo,incrementalRenderingActive:ii,renderedCount:_s,previousRenderContext:ta,adaptiveBatchSize:ll,previousBatchConfig:al}=(function(C,B){var V;const K=F(()=>{var De;const $e=Math.trunc((De=C.renderBatchSize)!=null?De:80);return Number.isFinite($e)?Math.max(0,$e):0}),ee=F(()=>{var De;const $e=Math.trunc((De=C.initialRenderBatchSize)!=null?De:K.value);return Number.isFinite($e)?Math.max(0,$e):K.value}),he=F(()=>!B.renderAsFragment.value&&C.batchRendering!==!1&&K.value>0&&B.isClient&&!B.isTestEnv),ke=Z(0),Se=Z({key:C.indexKey,total:0}),Pe=Z(Math.max(1,K.value||1)),Ee=F(()=>{var De;return he.value&&((De=C.maxLiveNodes)!=null?De:0)<=0}),We=Z({batchSize:K.value,initial:ee.value,delay:(V=C.renderBatchDelay)!=null?V:16,enabled:Ee.value});return{resolvedBatchSize:K,resolvedInitialBatch:ee,batchingEnabled:he,incrementalRenderingActive:Ee,renderedCount:ke,previousRenderContext:Se,adaptiveBatchSize:Pe,previousBatchConfig:We}})(k,{isClient:we,isTestEnv:Wt,renderAsFragment:ze}),Os=new Map,ft=new Map,me=new WeakMap;let Ne=null;const xn=new WeakMap,ws=new Map,se=Z(0),Ce=F(()=>(se.value,Array.from(Os.entries()).sort((C,B)=>C[0]-B[0]))),xe=Z(null),Be=Z(null);let et=null,at=0,Ot=null;const{activeRestoreAnchor:Vt,getRelativeScrollTopWithinContainer:qt,setRelativeScrollTopWithinContainer:Bo,resolveAnchorOffset:Fo,clearRestoreReconcile:nn,scheduleRestoreReconcile:Jn,captureRestoreAnchor:Fn,restoreAnchor:Ss,getAnchorDrift:Ps}=(function(C){const{isClient:B,containerRef:V,parsedNodeCount:K,requestFrame:ee,cancelFrame:he,resolveScrollContainer:ke,getNormalizedScrollTop:Se,getOffsetTopWithinRoot:Pe,isReverseFlexScrollRoot:Ee,estimateIndexForOffset:We,estimateHeightRange:De,getFallbackNodeHeight:$e,clamp:He}=C,Qe=Z(null);let Ze=null,_t=[];function lt(){const xt=ke(),Bt=V.value;if(!xt||!Bt)return null;const Rt=xt.ownerDocument||Bt.ownerDocument||document;if(xt===Rt.documentElement||xt===Rt.body||xt===Rt.scrollingElement){const ln=Bt.getBoundingClientRect();return Math.max(0,-ln.top)}return Math.max(0,Se(xt,Rt,!1)-Pe(Bt,xt))}function ct(xt){var Bt;const Rt=ke(),ln=V.value;if(!Rt||!ln)return;const Co=Math.max(0,xt),js=Rt.ownerDocument||ln.ownerDocument||document,ri=js.defaultView||(typeof window<"u"?window:null);if(Rt===js.documentElement||Rt===js.body||Rt===js.scrollingElement){const hr=Se(Rt,js,!0)+ln.getBoundingClientRect().top;return void((Bt=ri?.scrollTo)==null||Bt.call(ri,0,Math.max(0,hr+Co)))}vS(Rt,js,Pe(ln,Rt)+Co,{isReverseFlexScrollRoot:hr=>{var mr;return(mr=Ee?.(hr))!=null&&mr},getNormalizedScrollTop:Se})}function St(xt){const Bt=K.value,Rt=He(xt.nodeIndex,0,Math.max(0,Bt-1));return De(0,Rt)+Math.max(0,xt.offsetWithinNodePx)}function wt(){if(Ze!=null&&(he?.(Ze),Ze=null),B)for(const xt of _t)window.clearTimeout(xt);_t=[]}function Zt(xt){const Bt=St(xt),Rt=lt();Rt!=null&&Math.abs(Rt-Bt)<=.5||ct(Bt)}return{activeRestoreAnchor:Qe,getRelativeScrollTopWithinContainer:lt,setRelativeScrollTopWithinContainer:ct,resolveAnchorOffset:St,clearRestoreReconcile:wt,applyRestoreAnchor:Zt,scheduleRestoreReconcile:function(){Qe.value&&B&&Ze==null&&(Ze=ee?ee(()=>{Ze=null,Qe.value&&Zt(Qe.value)}):null,Ze==null&&Qe.value&&Zt(Qe.value))},captureRestoreAnchor:function(){const xt=lt(),Bt=K.value;if(xt==null||Bt<=0)return null;const Rt=He(We(xt+1),0,Bt-1),ln=De(0,Rt),Co=$e(Rt);return{nodeIndex:Rt,offsetWithinNodePx:He(xt-ln,0,Math.max(0,Co-1))}},restoreAnchor:function(xt){const Bt=K.value;if(Qe.value={nodeIndex:He(xt.nodeIndex,0,Math.max(0,Bt-1)),offsetWithinNodePx:Math.max(0,xt.offsetWithinNodePx)},wt(),Zt(Qe.value),B)for(const Rt of[0,120,280,480])_t.push(window.setTimeout(()=>{Qe.value&&Zt(Qe.value)},Rt))},getAnchorDrift:function(xt){const Bt=lt();return Bt==null?null:Bt-St(xt)}}})({isClient:we,containerRef:S,parsedNodeCount:Kn,requestFrame:pe,cancelFrame:Oe,resolveScrollContainer:()=>xe.value||ne(),getNormalizedScrollTop:J,getOffsetTopWithinRoot:ce,isReverseFlexScrollRoot:H,estimateIndexForOffset:Em,estimateHeightRange:pr,getFallbackNodeHeight:Cd,clamp:As}),{nodeHeights:fs,heightStats:Cs,heightTreeSize:cl,heightSumTree:jh,heightKnownTree:Vh,averageNodeHeight:yi,resetHeightMeasurements:T4,pruneHeightMeasurements:M4,rebuildHeightTrees:md,recordNodeHeight:E4,removeNodeHeights:I4,exportHeightCache:$4,importHeightCache:N4,fenwickRangeSum:gd}=(function(C={}){const B=$s({}),V=$s({total:0,count:0}),K=Z(0),ee=Z([]),he=Z([]);function ke(){for(const $e of Object.keys(B))delete B[Number($e)];V.total=0,V.count=0,K.value=0,ee.value=[],he.value=[]}function Se($e,He,Qe){for(let Ze=He+1;Ze<$e.length;Ze+=Ze&-Ze)$e[Ze]+=Qe}function Pe($e,He){let Qe=0;for(let Ze=He+1;Ze>0;Ze-=Ze&-Ze)Qe+=$e[Ze];return Qe}function Ee($e){K.value=$e;const He=new Array($e+1).fill(0),Qe=new Array($e+1).fill(0);for(const[Ze,_t]of Object.entries(B)){const lt=Number(Ze),ct=Number(_t);!Number.isFinite(lt)||lt<0||lt>=$e||!Number.isFinite(ct)||ct<=0||(Se(He,lt,ct),Se(Qe,lt,1))}ee.value=He,he.value=Qe}function We($e){if(!Number.isInteger($e)||$e<0)return!1;const He=B[$e];if(!Number.isFinite(He)||He<=0)return!1;if(delete B[$e],V.total=Math.max(0,V.total-He),V.count=Math.max(0,V.count-1),K.value>$e){const Qe=ee.value,Ze=he.value;Qe.length&&Ze.length&&(Se(Qe,$e,-He),Se(Ze,$e,-1))}return!0}const De=F(()=>V.count>0?Math.max(12,V.total/V.count):32);return{nodeHeights:B,heightStats:V,heightTreeSize:K,heightSumTree:ee,heightKnownTree:he,averageNodeHeight:De,resetHeightMeasurements:ke,pruneHeightMeasurements:function($e){if($e<=0)return void ke();let He=0,Qe=0;for(const[Ze,_t]of Object.entries(B)){const lt=Number(Ze),ct=Number(_t);!Number.isFinite(lt)||lt<0||lt>=$e||!Number.isFinite(ct)||ct<=0?delete B[lt]:(He+=ct,Qe++)}V.total=He,V.count=Qe},rebuildHeightTrees:Ee,recordNodeHeight:function($e,He,Qe={}){(function(Ze,_t,lt={}){var ct;if(!Number.isFinite(_t)||_t<=0)return!1;const St=B[Ze];if(St&&(lt.allowShrink===!1&&_t<St||Math.abs(_t-St)<=1))return!1;if(B[Ze]=_t,St?V.total+=_t-St:(V.total+=_t,V.count++),K.value>Ze){const wt=ee.value,Zt=he.value;if(wt.length&&Zt.length)if(St){const xt=_t-St;xt!==0&&Se(wt,Ze,xt)}else Se(wt,Ze,_t),Se(Zt,Ze,1)}lt.notify!==!1&&((ct=C.onHeightRecorded)==null||ct.call(C))})($e,He,Lt(it({},Qe),{notify:!0}))},removeNodeHeight:function($e,He={}){var Qe;const Ze=We($e);return Ze&&He.notify!==!1&&((Qe=C.onHeightRecorded)==null||Qe.call(C)),Ze},removeNodeHeights:function($e,He={}){var Qe;let Ze=0;for(const _t of $e)We(Number(_t))&&Ze++;return Ze>0&&He.notify!==!1&&((Qe=C.onHeightRecorded)==null||Qe.call(C)),Ze},exportHeightCache:function(){return Object.entries(B).map(([$e,He])=>({index:Number($e),height:Number(He)})).filter($e=>Number.isFinite($e.index)&&$e.index>=0&&Number.isFinite($e.height)&&$e.height>0).sort(($e,He)=>$e.index-He.index)},importHeightCache:function($e,He={}){var Qe;if(!Array.isArray($e))return;const Ze=K.value;let _t=!1;if(He.mode!=="merge"){const lt=Object.keys(B);if(lt.length>0){for(const ct of lt)delete B[Number(ct)];_t=!0}}for(const lt of $e){const ct=Number(lt.index),St=Number(lt.height);if(!Number.isInteger(ct)||ct<0||Ze>0&&ct>=Ze||!Number.isFinite(St)||St<=0)continue;const wt=B[ct];wt&&Math.abs(wt-St)<=1||(B[ct]=St,_t=!0)}_t&&((function(){let lt=0,ct=0;const St=K.value;for(const[wt,Zt]of Object.entries(B)){const xt=Number(wt),Bt=Number(Zt);!Number.isFinite(xt)||xt<0||St>0&&xt>=St||!Number.isFinite(Bt)||Bt<=0?delete B[xt]:(lt+=Bt,ct++)}V.total=lt,V.count=ct})(),Ze>0&&Ee(Ze),(Qe=C.onHeightRecorded)==null||Qe.call(C))},fenwickRangeSum:function($e,He,Qe){if(Qe<=He)return 0;const Ze=Pe($e,Qe-1);return He<=0?Ze:Ze-Pe($e,He-1)}}})({onHeightRecorded:()=>{Wo(),Mt.value&&Dc(),Vt.value&&Jn(),Be.value&&ca(),An("node-resize")}});function vd(){T4(),ws.clear()}function By(C){!Number.isInteger(C)||C<0||C>=st.value.length||ws.set(C,Ac(C))}function Fy(C,B,V={}){const K=fs[C];E4(C,B,V);const ee=fs[C];ee&&ee>0?By(C):K&&ws.delete(C)}function Hy(C,B){const V=mt("getNodeLayoutHeight.slot.offsetHeight",()=>{var K,ee;return(ee=(K=Os.get(C))==null?void 0:K.offsetHeight)!=null?ee:0});return V>0?V:mt("getNodeLayoutHeight.content.offsetHeight",()=>B.offsetHeight)}function Wy(C,B={}){N4(C,B),bm()}const cr=F(()=>{var C;return!ze.value&&k.deferNodesUntilVisible!==!1&&!(((C=k.maxLiveNodes)!=null?C:0)<=0)&&!Nt.value&&!(st.value.length>900)&&ot.value}),zy=F(()=>!!de&&(cr.value||Nt.value)),Uy=F(()=>Nt.value||Mt.value),{liveNodeBufferResolved:wc,focusIndex:Ho,liveRange:xs,updateLiveRange:ul}=(function(C,B){const{parsedNodeCount:V,virtualizationEnabled:K,maxLiveNodesResolved:ee,clamp:he}=B,ke=F(()=>{var Ee;return Math.max(0,(Ee=C.liveNodeBuffer)!=null?Ee:60)}),Se=Z(0),Pe=$s({start:0,end:0});return{liveNodeBufferResolved:ke,focusIndex:Se,liveRange:Pe,updateLiveRange:function(){const Ee=V.value;if(!K.value||Ee===0)return Pe.start=0,void(Pe.end=Ee);const We=Math.min(ee.value,Ee),De=ke.value,$e=he(Se.value-De,0,Math.max(0,Ee-We));Pe.start=$e,Pe.end=Math.min(Ee,$e+We)}}})(k,{parsedNodeCount:Kn,virtualizationEnabled:Nt,maxLiveNodesResolved:oo,clamp:As}),ki=new Map,dl=new Map,ur=new Map,yd=[],Li=new Map,dr=new Set,qy=Z(0);let Kh=!1;const jy=F(()=>(qy.value,dr.size)),_o=new Map,bi=new Map,Vy=Z(0),Gh=F(()=>{Vy.value;let C=0;for(const B of _o.values())C+=Math.max(0,B);return C});let wo=null,Yh=!0,Ky=[0],Gy="";function Wo(){Yh=!0}const kd=F(()=>{if(!Nt.value)return st.value.length;const C=wc.value,B=Math.max(xs.end+C,Bn.value),V=Math.min(st.value.length,B);return Math.max(_s.value,V)});function bd(){Kh||(Kh=!0,queueMicrotask(()=>{Kh=!1,qy.value+=1}))}function Yy(C,B,V="node-resize"){if(!we||typeof window>"u")return null;const K=window.setTimeout(()=>{dr.delete(K)&&bd();try{B()}finally{An(V)}},Math.max(0,C));return dr.add(K),bd(),K}function _d(C){we&&C!=null&&(dr.delete(C)&&bd(),window.clearTimeout(C))}function Xy(){if(we&&typeof window<"u")for(const C of dr)window.clearTimeout(C);dr.size&&(dr.clear(),bd()),yd.length=0,ur.clear()}function L4(C){var B,V;return(V=(B=Ct.value)==null?void 0:B[C])!=null?V:null}const{cancelScheduledFocusSync:Xh,scheduleFocusSync:_i}=(function(C){const{isClient:B,containerRef:V,virtualizationEnabled:K,requestFrame:ee,cancelFrame:he,syncFocusToScroll:ke}=C;let Se=null;function Pe(){var We,De,$e;return($e=(De=(We=V.value)==null?void 0:We.ownerDocument)==null?void 0:De.defaultView)!=null?$e:typeof window<"u"?window:null}function Ee(){if(!Se)return;const We=Pe();Se.viaTimeout?We?We.clearTimeout(Se.id):clearTimeout(Se.id):he?.(Se.id),Se=null}return{cancelScheduledFocusSync:Ee,scheduleFocusSync:function(We={}){if(!K.value)return;if(!B)return void ke(!0);if(We.immediate)return Ee(),void ke(!0);if(Se)return;const De=()=>{Se=null,ke()};if(ee)return void(Se={id:ee(De),viaTimeout:!1});const $e=Pe();Se={id:$e?$e.setTimeout(De,16):setTimeout(De,16),viaTimeout:!0}}}})({isClient:we,containerRef:S,virtualizationEnabled:Nt,requestFrame:pe,cancelFrame:Oe,syncFocusToScroll:function(C=!1){var B;if(!Nt.value)return;const V=xe.value||ne();if(!V)return;const K=V.ownerDocument||((B=S.value)==null?void 0:B.ownerDocument)||document,ee=K?.defaultView||(typeof window<"u"?window:null),he=V===K?.documentElement||V===K?.body,ke=st.value.length;if(!he&&ke>0&&H(V)){const Qe=mt("syncFocusToScroll.clientHeight",()=>V.clientHeight||0),Ze=mt("syncFocusToScroll.scrollTop",()=>V.scrollTop),_t=Ze<0?-Ze:Ze,lt=(function(St){var wt,Zt;const xt=st.value;if(!xt.length)return 0;if(St<=0)return Math.max(0,xt.length-1);if(Xt.value){const Rt=(wt=tm()[xt.length])!=null?wt:0;return ok(Math.max(0,Rt-St))}if(cl.value===xt.length){const Rt=pr(0,xt.length);return Em(Math.max(0,Rt-St))}let Bt=St;for(let Rt=xt.length-1;Rt>=0;Rt--){const ln=(Zt=fs[Rt])!=null?Zt:yi.value;if(Bt<=ln)return Rt;Bt-=ln}return 0})(Math.max(0,_t)+.5*Math.max(0,Qe)),ct=As(lt,0,Math.max(0,ke-1));return void((C||Math.abs(ct-Ho.value)>1)&&(Ho.value=ct,ul()))}const Se=he?null:mt("syncFocusToScroll.root.getBoundingClientRect",()=>V.getBoundingClientRect()),Pe=he?0:Se.top,Ee=he?mt("syncFocusToScroll.viewport.clientHeight",()=>{var Qe,Ze;return(Ze=(Qe=ee?.innerHeight)!=null?Qe:V.clientHeight)!=null?Ze:0}):Se.bottom,We=Ce.value;let De=null,$e=null;for(const[Qe,Ze]of We){if(!Ze)continue;const _t=mt("syncFocusToScroll.slot.getBoundingClientRect",()=>Ze.getBoundingClientRect());_t.bottom<=Pe||_t.top>=Ee||(De==null&&(De=Qe),$e=Qe)}if(De==null||$e==null){const Qe=S.value;if(!Qe)return;const Ze=he?{top:0}:mt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>V.getBoundingClientRect()),_t=mt("syncFocusToScroll.fallback.scrollTop",()=>J(V,K,he)),lt=he?(()=>{const wt=mt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>Qe.getBoundingClientRect()),Zt=(he?0:Ze.top)-wt.top;return Math.max(0,Zt)})():(()=>{const wt=ce(Qe,V);return Math.max(0,_t-wt)})(),ct=he?mt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var wt,Zt,xt,Bt;return(Bt=(xt=(Zt=ee?.innerHeight)!=null?Zt:(wt=K?.documentElement)==null?void 0:wt.clientHeight)!=null?xt:V.clientHeight)!=null?Bt:0}):mt("syncFocusToScroll.fallback.root.clientHeight",()=>V.clientHeight),St=Em(lt+.5*Math.max(0,ct));return Ho.value=As(St,0,Math.max(0,st.value.length-1)),void ul()}const He=Math.round((De+$e)/2);!C&&Math.abs(He-Ho.value)<=1||(Ho.value=As(He,0,Math.max(0,st.value.length-1)),ul())}}),{visibleNodeIndices:Qh,nodeVisibilityHandles:na,nodeVisibilityWatchStops:wd,nodeVisibilityFallbackTimers:Qy,clearVisibilityFallback:Sd,markNodeVisible:fr,cleanupNodeVisibility:O4,destroyNodeVisibilityState:Zh}=$V({isClient:we,shouldTrackVisibleNodeIndices:()=>cr.value,shouldCleanupNodeVisibility:()=>Nt.value,onNodeMarkedVisible:C=>{Nt.value?_i():Ho.value=As(C,0,Math.max(0,st.value.length-1))},onNodeVisibilityCleaned:C=>{Os.delete(C)&&Ak()}}),{cleanupScrollListener:Zy,setupScrollListener:P4}=(function(C){const{isClient:B,virtualizationEnabled:V,listenerEnabled:K,scrollRootElement:ee,resolveScrollContainer:he,scheduleFocusSync:ke,onScroll:Se}=C;let Pe=null,Ee=null;function We(){Pe&&(Pe(),Pe=null),Ee=null,ee.value=null}function De($e){const He=C.getScrollTop?C.getScrollTop($e):$e.scrollTop;return Math.max(0,Number.isFinite(He)?Math.abs(He):0)}return{cleanupScrollListener:We,setupScrollListener:function(){if(!B)return;if(!(($e=K?.value)!=null?$e:V.value))return void We();var $e;const He=he();if(!He)return void We();if(ee.value===He&&Pe)return;We(),Ee=De(He);const Qe=()=>{if(Se?.(),V.value){const Ze=(function(_t){const lt=De(_t),ct=Ee;Ee=lt;const St=Math.max(480,.75*(_t.clientHeight||0));return ct==null?lt>St?{immediate:!0}:void 0:Math.abs(lt-ct)>St?{immediate:!0}:void 0})(He);Ze?ke(Ze):ke()}};He.addEventListener("scroll",Qe,{passive:!0}),ee.value=He,Pe=()=>{He.removeEventListener("scroll",Qe)}}}})({isClient:we,virtualizationEnabled:Nt,listenerEnabled:Uy,scrollRootElement:xe,resolveScrollContainer:ne,scheduleFocusSync:_i,onScroll:function(){const C=Be.value;if(!C)return;const B=xc();if(!B||(function(K){if($c()>=at)return Ot=null,!1;const ee=Ot;if(ee==null)return!0;const he=Math.abs(K.scrollTop-ee)<=2;return he||(Ot=null),he})(B))return;const V=pk(B);V!=null?(V<-32||Math.abs(Math.max(0,V)-Math.max(0,C.distanceFromBottomPx))>32)&&aa("restore"):aa("restore")},getScrollTop:C=>{var B;const V=C.ownerDocument||((B=S.value)==null?void 0:B.ownerDocument)||document,K=C===V.documentElement||C===V.body||C===V.scrollingElement;return mt("scrollListener.getScrollTop",()=>J(C,V,K))}});function As(C,B,V){return Math.min(Math.max(C,B),V)}function Jh(C){return C?.firstElementChild}function Jy(C,B){var V;return C?(V=C.matches)!=null&&V.call(C,B)?C:C.querySelector(B):null}function ek(){if(!Xt.value)return void(X.value=0);const C=mt("updateExperimentContainerWidth.clientWidth",()=>{var B,V;return(V=(B=S.value)==null?void 0:B.clientWidth)!=null?V:0});X.value=C>0?C:0}let Sc=null;function em(){Sc?.disconnect(),Sc=null}const tk=ui({loader:()=>zn(null,null,function*(){return(yield Xs(()=>import("./index8-B1lp-RvF.js"),__vite__mapDeps([7,6]))).default}),loadingComponent:XM,delay:0,suspensible:!1});function nk(C){return C===tk}const sk=F(()=>u.value==="pre"?xo:u.value==="shiki"?tk:Dg),fl=F(()=>{const C=st.value;if(!C.length||!Xt.value)return C.map(()=>null);const B=X.value||mt("estimatedNodeHeights.clientWidth",()=>{var V;return((V=S.value)==null?void 0:V.clientWidth)||0});return!Number.isFinite(B)||B<=0?C.map(()=>null):C.map((V,K)=>{const ee=fs[K],he=typeof ee=="number"&&ee>0;if(bs.value&&!he){const Se=n3(V,B,fe.value);if(Se)return Se}if(Do.value&&V.type==="code_block"){const Se=(function(Pe){if(Pe.type!=="code_block")return null;const Ee=Fk(Pe,$d(Pe));return nk(Ee)?"markdown":Ee===xo?"pre":Ee===sk.value||Ee===Dg?"monaco":null})(V);if(Se==="monaco"||Se==="markdown"||Se==="pre")return gV(V,{rendererKind:Se,monacoOptions:k.codeBlockMonacoOptions,showHeader:((ke=k.codeBlockProps)==null?void 0:ke.showHeader)!==!1})}var ke;return null})});function Cd(C){var B;const V=fs[C];if(Number.isFinite(V)&&V>0)return V;const K=(B=fl.value[C])==null?void 0:B.height;return Number.isFinite(K)&&K>0?K:Math.max(yi.value,(function(ee){var he,ke,Se,Pe,Ee,We,De,$e,He,Qe,Ze,_t,lt;const ct=st.value[ee];if(!ct||typeof ct!="object")return 32;const St=String((he=ct.type)!=null?he:""),wt=so()||640;switch(St){case"heading":return 44;case"paragraph":return sa(String((Se=(ke=ct.raw)!=null?ke:ct.content)!=null?Se:""),wt,34);case"list":{const Zt=Array.isArray(ct.items)?ct.items.length:1;return Math.max(48,30*Zt+12)}case"list_item":return sa(String((Ee=(Pe=ct.raw)!=null?Pe:ct.content)!=null?Ee:""),wt,34);case"blockquote":return sa(String((De=(We=ct.raw)!=null?We:ct.content)!=null?De:""),wt,56);case"table":{const Zt=Array.isArray(ct.rows)?ct.rows.length:Array.isArray(ct.children)?ct.children.length:3;return Math.max(120,38*Zt+48)}case"code_block":return sa(String((He=($e=ct.code)!=null?$e:ct.raw)!=null?He:""),wt,96,20);case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return sa(String((Ze=(Qe=ct.raw)!=null?Qe:ct.content)!=null?Ze:""),wt,96);case"thematic_break":return 24;default:return sa(String((lt=(_t=ct.raw)!=null?_t:ct.content)!=null?lt:""),wt,40)}})(C))}function sa(C,B,V,K=22){const ee=String(C??"");if(!ee)return V;const he=Math.max(18,Math.floor(Math.max(320,B)/8)),ke=ee.split(/\r?\n/).length,Se=Math.ceil(ee.length/he),Pe=Math.max(1,ke,Se);return Math.max(V,Math.ceil(Pe*K+12))}function Cc(C){const B=Number(C);return!Number.isFinite(B)||B<=0?-1:Math.round(B/32)}function tm(){var C,B;const V=st.value.length,K=Cc(X.value||mt("getFallbackHeightPrefix.clientWidth",()=>{var Se;return((Se=S.value)==null?void 0:Se.clientWidth)||0})),ee=((C=s.virtualScroll)==null?void 0:C.measurementKey)==null?"":String(s.virtualScroll.measurementKey),he=[V,Cs.count,Math.round(Cs.total),Math.round(100*yi.value),ee,K,Xt.value?1:0,pS.value,Q.value].join(":");if(!Yh&&Gy===he)return Ky;const ke=new Array(V+1);ke[0]=0;for(let Se=0;Se<V;Se++)ke[Se+1]=ke[Se]+(Xt.value?Cd(Se):(B=fs[Se])!=null?B:yi.value);return Ky=ke,Gy=he,Yh=!1,ke}function ok(C){var B,V;const K=st.value.length;if(K<=0||C<=0)return 0;const ee=tm();if(C>=((B=ee[K])!=null?B:0))return K-1;let he=0,ke=K-1,Se=K-1;for(;he<=ke;){const Pe=he+ke>>1;((V=ee[Pe+1])!=null?V:0)>=C?(Se=Pe,ke=Pe-1):he=Pe+1}return Se}function pr(C,B){var V,K;if(C>=B)return 0;if(Xt.value)return(function(ke,Se){var Pe,Ee;const We=st.value.length,De=As(Math.trunc(ke),0,We),$e=As(Math.trunc(Se),De,We);if(De>=$e)return 0;const He=tm();return((Pe=He[$e])!=null?Pe:0)-((Ee=He[De])!=null?Ee:0)})(C,B);if(cl.value!==st.value.length){let ke=0;for(let Se=C;Se<B;Se++)ke+=(V=fs[Se])!=null?V:yi.value;return ke}const ee=jh.value,he=Vh.value;if(!ee.length||!he.length){let ke=0;for(let Se=C;Se<B;Se++)ke+=(K=fs[Se])!=null?K:yi.value;return ke}return gd(ee,C,B)+(B-C-gd(he,C,B))*yi.value}Ke(()=>st.value.length,C=>{Wo(),C<=0?vd():(C<cl.value&&M4(C),C!==cl.value&&md(C))},{immediate:!0});const R4=F(()=>{if(!Nt.value)return st.value.map((K,ee)=>({node:K,index:ee}));const C=st.value.length,B=As(xs.start,0,C),V=As(xs.end,B,C);return st.value.slice(B,V).map((K,ee)=>({node:K,index:B+ee}))}),nm=F(()=>Nt.value?pr(0,Math.min(xs.start,st.value.length)):0),sm=F(()=>{if(!Nt.value)return 0;const C=st.value.length;return pr(Math.min(xs.end,C),C)});function ik(){if(!Xt.value)return 0;let C=0;const B=fl.value;for(let V=0;V<B.length;V++){if(!B[V])continue;const K=fs[V];Number.isFinite(K)&&K>0||C++}return C}function rk(){const C=st.value.length;return{totalNodes:C,measuredCount:Cs.count,estimatedCount:ik(),averageNodeHeight:yi.value,topSpacerHeight:nm.value,bottomSpacerHeight:sm.value,estimatedTotalHeight:pr(0,C),width:pl()}}function D4(){const C=st.value,B=rk();return Lt(it({},B),{probe:{paragraphReady:!!fe.value.paragraph,listItemReady:!!fe.value.listItem,listWrapperOverhead:fe.value.listWrapperOverhead,headingReadyLevels:Object.entries(fe.value.headings).filter(([,V])=>!!V).map(([V])=>Number(V))},nodes:C.map((V,K)=>{var ee,he,ke,Se,Pe,Ee,We,De,$e;return{index:K,type:V.type,estimateKind:(he=(ee=fl.value[K])==null?void 0:ee.kind)!=null?he:null,rendererKind:(Se=(ke=fl.value[K])==null?void 0:ke.rendererKind)!=null?Se:null,estimatedHeight:(Ee=(Pe=fl.value[K])==null?void 0:Pe.height)!=null?Ee:null,estimatedContentHeight:(De=(We=fl.value[K])==null?void 0:We.contentHeight)!=null?De:null,measuredHeight:($e=fs[K])!=null?$e:null}})})}function om(){return s.indexKey!=null?String(s.indexKey):Ln.value?`virtual-${On()}`:"markdown-renderer"}function lk(C){const B=String(C),V=`${om()}-`;if(!B.startsWith(V))return null;const K=B.slice(V.length).match(/^(\d+)(?:$|-)/);if(!K)return null;const ee=Number(K[1]);return!Number.isInteger(ee)||ee<0||ee>=st.value.length?null:ee}function On(){var C,B,V;const K=(C=s.virtualScroll)==null?void 0:C.sessionKey;return String(K!=null&&K!==""?K:(V=(B=s.indexKey)!=null?B:k.customId)!=null?V:Yt)}function ps(){var C;const B=(C=s.virtualScroll)==null?void 0:C.threadKey;return B==null||B===""?void 0:String(B)}function im(C){var B;return(C??"")===((B=ps())!=null?B:"")}function B4(){var C;const B=(C=s.virtualScroll)==null?void 0:C.measurementKey;return B==null?"":String(B)}function F4(){var C,B;const V=u.value,K=V==="monaco"?k.codeBlockMonacoOptions:void 0,ee=k.codeBlockProps,he=V==="shiki";return[k.isDark?"dark":"light",V==="monaco"?"code-rich":V==="pre"?"code-pre":"code-shiki",k.codeBlockStream===!1?"code-static":"code-stream",vs(k.codeBlockMinWidth),vs(k.codeBlockMaxWidth),...he?[Np((C=ee?.themes)!=null?C:k.themes,(B=ee?.langs)!=null?B:k.langs)]:[],vs(K?.fontSize),vs(K?.lineHeight),vs(K?.fontFamily),vs(K?.tabSize),vs(K?.MAX_HEIGHT),vs(K?.wordWrap),vs(K?.wrappingIndent),vs(K?.padding),vs(ee?.showHeader),vs(ee?.showCopyButton),vs(ee?.showExpandButton),vs(ee?.showPreviewButton),vs(ee?.showCollapseButton),vs(ee?.showFontSizeButtons)].join("\0")}function Oi(){return[B4(),F4()].join("\0")}function pl(){return so()}const xd=F(()=>Cc(pl())),So=F(()=>[Oi(),xd.value].join("\0")),H4=F(()=>{var C;return Ln.value?["virtual",(C=ps())!=null?C:"",On(),So.value].join("\0"):s.indexKey});function oa(){Vy.value+=1}function rm(C){return!(!C||!Number.isInteger(C.index)||C.index<0||C.index>=st.value.length||C.sessionKey!==On()||C.threadKey!==ps()||C.layoutEpochKey!==So.value)}function ak(C){const B=String(C),V=bi.get(B);return V?rm(V)?V.index:null:lk(B)}function ck(C="async-node"){(_o.size||bi.size)&&(_o.clear(),bi.clear(),oa(),An(C))}const ia=Ut(u1,null),lm={reportHeight(C,B){if(!Mt.value)return;const V=ak(C);if(V==null)return;const K=ki.get(V);if(!K)return;const ee=Number(B),he=Hy(V,K);Fy(V,Number.isFinite(ee)&&ee>0?Math.max(ee,he||0):he)},markPending(C){if(!Mt.value)return;const B=lk(C);B!=null&&(function(V,K){var ee;const he=bi.get(V);if(he&&rm(he))return _o.set(V,Math.max(0,(ee=_o.get(V))!=null?ee:0)+1),oa(),void An("async-node");_o.set(V,1),bi.set(V,(function(ke){return{index:ke,sessionKey:On(),threadKey:ps(),layoutEpochKey:So.value}})(K)),oa(),An("async-node")})(String(C),B)},markSettled(C){if(!Mt.value)return;const B=String(C),V=ak(C);(V!=null||(function(K){return _o.has(String(K))})(B))&&(function(K){var ee;const he=(ee=_o.get(K))!=null?ee:0;return!(he<=0||(he<=1?(_o.delete(K),bi.delete(K)):_o.set(K,he-1),oa(),he===1&&An("async-node"),0))})(B)&&V!=null&&Pi()}};function W4(){let C=0;for(const B of ki.values())C+=mt("getVisibleDomHeight.offsetHeight",()=>{var V;return(V=B?.offsetHeight)!=null?V:0});return Math.ceil(Math.max(0,C))}En(u1,{reportHeight(C,B){lm.reportHeight(C,B),ia?.reportHeight(C,B)},markPending(C){lm.markPending(C),ia?.markPending(C)},markSettled(C){lm.markSettled(C),ia?.markSettled(C)}});let am,cm=null,ra=null;function Ad(C){return C!==!1&&C!=null&&C!==""}function uk(){return Nt.value?(function(){if(!Nt.value)return!0;const C=st.value.length,B=As(xs.start,0,C),V=As(xs.end,B,C);if(B>=V)return!0;for(let K=B;K<V;K++)if(!Os.has(K)||Im(K)&&!ki.has(K))return!1;return!0})():_s.value>=kd.value}function um(){return j.value===!0&&!Y.value&&Gh.value===0&&dr.size===0&&Li.size===0&&wo==null&&uk()}function dk(){var C,B;if(((C=s.virtualScroll)==null?void 0:C.settleMode)!=="manual"||cm===On()&&am===ps())return!0;const V=(B=s.virtualScroll)==null?void 0:B.settledToken;return!!Ad(V)&&ra===Bc(V)}function dm(){return um()&&dk()}function z4(C,B){return B.totalNodes<=0?C==="final"?"final":"estimate":B.measuredCount>=B.totalNodes?C==="final"?"final":"measured":B.measuredCount>0||B.estimatedCount>0?"mixed":"estimate"}function hl(C="manual",B){const V=rk(),K=(function(ee){return ee||(j.value!==!0?st.value.length>0?"streaming":"estimating":!uk()||Li.size>0||wo!=null?"measuring":dm()?"settled":"settling")})(B);return{sessionKey:On(),threadKey:ps(),phase:K,nodeCount:V.totalNodes,liveRange:{start:xs.start,end:xs.end},renderedCount:_s.value,measuredCount:V.measuredCount,estimatedCount:V.estimatedCount,averageNodeHeight:V.averageNodeHeight,topSpacerHeight:V.topSpacerHeight,bottomSpacerHeight:V.bottomSpacerHeight,visibleDomHeight:W4(),totalHeight:fk(),width:V.width,final:j.value===!0,stable:dm(),confidence:z4(K,V),reason:C}}function xc(){const C=xe.value||ne(),B=S.value;if(!C||!B)return null;const V=C.ownerDocument||B.ownerDocument||document,K=C===V.documentElement||C===V.body||C===V.scrollingElement,ee=mt("getScrollBox.scrollTop",()=>J(C,V,K)),he=mt("getScrollBox.scrollHeight",()=>{var Se,Pe,Ee,We,De;return K?Math.max((Pe=(Se=V.documentElement)==null?void 0:Se.scrollHeight)!=null?Pe:0,(We=(Ee=V.body)==null?void 0:Ee.scrollHeight)!=null?We:0,(De=C.scrollHeight)!=null?De:0):C.scrollHeight}),ke=mt("getScrollBox.clientHeight",()=>{var Se;return K?((Se=V.documentElement)==null?void 0:Se.clientHeight)||C.clientHeight||0:C.clientHeight});return{root:C,doc:V,isViewportRoot:K,scrollTop:ee,scrollHeight:he,clientHeight:ke}}function fk(){const C=st.value.length,B=Math.max(0,pr(0,C)),V=mt("getRendererLogicalHeight.offsetHeight",()=>{var ee,he;return(he=(ee=S.value)==null?void 0:ee.offsetHeight)!=null?he:0}),K=Math.max(0,V>0?V:mt("getRendererLogicalHeight.scrollHeight",()=>{var ee,he;return(he=(ee=S.value)==null?void 0:ee.scrollHeight)!=null?he:0}));return C<=0?Math.ceil(V):Nt.value?B>0?Math.max(1,Math.ceil(B),(function(){let ee=nm.value+sm.value;for(const he of Os.values())he&&(ee+=Math.max(0,mt("getVirtualizedDomLogicalHeight.offsetHeight",()=>he.offsetHeight||0)));return Math.ceil(Math.max(0,ee))})(),(function(ee,he){return ee<=0||he<=0?0:he<=ee+Math.max(512,.05*ee)?Math.ceil(he):0})(B,K)):Math.max(1,Math.ceil(K)):Mt.value?B>0||Cs.count>0||ik()>0?(ii.value&&_s.value,Math.max(1,Math.ceil(K),Math.ceil(B))):Math.ceil(K):Math.max(1,Math.ceil(K),Math.ceil(B))}function pk(C){const B=S.value;if(!B)return null;const V=mt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>B.getBoundingClientRect());return(function(ee){return ee.isViewportRoot?ee.clientHeight:mt("getViewportBottomInRoot.getBoundingClientRect",()=>ee.root.getBoundingClientRect().bottom)})(C)-V.bottom}function U4(C={}){const B=C.requireViewport!==!1,V=(function(he=64){const ke=xc(),Se=S.value;if(!ke||!Se)return!1;const Pe=(function(We){if(We.isViewportRoot)return{top:0,bottom:We.clientHeight};const De=mt("getVirtualViewportRect.getBoundingClientRect",()=>We.root.getBoundingClientRect());return{top:De.top,bottom:De.bottom}})(ke),Ee=mt("isRendererNearVirtualViewport.getBoundingClientRect",()=>Se.getBoundingClientRect());return Ee.bottom>=Pe.top-he&&Ee.top<=Pe.bottom+he})();if(B&&!V)return null;const K=(function(){const he=xc(),ke=S.value;if(!he||!ke||Math.max(0,he.scrollHeight-he.scrollTop-he.clientHeight)>64)return null;const Se=pk(he);return Se==null?null:Se>=-8&&Se<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,Se)}:null})();if(K)return{anchor:K,captured:!0};const ee=Fn();if(ee)return{anchor:{type:"node",nodeIndex:ee.nodeIndex,offsetWithinNodePx:ee.offsetWithinNodePx},captured:V};if(C.allowFallback===!0){const he=(function(){const ke=st.value.length;return ke<=0?null:{type:"node",nodeIndex:As(Ho.value,0,Math.max(0,ke-1)),offsetWithinNodePx:0}})();return he?{anchor:he,captured:!1}:null}return null}function fm(C){let B=2166136261;for(let V=0;V<C.length;V++)B^=C.charCodeAt(V),B=Math.imul(B,16777619);return(B>>>0).toString(36)}function q4(C,B){let V=C;for(let K=0;K<B.length;K++)V^=B.charCodeAt(K),V=Math.imul(V,16777619);return V^=31,V=Math.imul(V,16777619),V}const j4=new Set(["children","items","header","rows","cells","attrs","data","term","definition"]);function Td(C,B=new WeakSet,V=0){if(C==null||typeof C=="number"||typeof C=="boolean")return String(C);if(typeof C=="string")return`s:${(function(K){const ee=K.length>8192?`${K.slice(0,8192)}...${K.length}`:K;return`${K.length}:${fm(ee)}`})(C)}`;if(typeof C=="function")return"fn";if(typeof C!="object")return typeof C;if(B.has(C))return"cycle";if(V>=6)return"max-depth";B.add(C);try{if(Array.isArray(C)){if(C.length<=160){const Ee=[];for(let We=0;We<C.length;We++)Ee.push(Td(C[We],B,V+1));return`a:${C.length}:${Ee.join(",")}`}const he=[],ke=[],Se=Math.max(0,C.length-32);let Pe=2166136261;for(let Ee=0;Ee<C.length;Ee++){const We=Td(C[Ee],B,V+1);Pe=q4(Pe,We),Ee<32&&he.push(We),Ee>=Se&&ke.push(We)}return[`a:${C.length}`,`h=${he.join(",")}`,`t=${ke.join(",")}`,`all=${(Pe>>>0).toString(36)}`].join(":")}const K=C,ee=Object.keys(K).filter(he=>{const ke=K[he];return he!=="parent"&&he!=="el"&&he!=="component"&&(ke==null||typeof ke=="string"||typeof ke=="number"||typeof ke=="boolean"||j4.has(he))}).sort();return`o:${ee.length}:${ee.map(he=>`${he}=${Td(K[he],B,V+1)}`).join(";")}`}finally{B.delete(C)}}let hk=-1,pm="";function Ac(C){const B=st.value[C];return B?fm(Td(B)):""}function hm(){const C=Q.value;if(hk===C)return pm;let B=2166136261;for(let V=0;V<st.value.length;V++){const K=Ac(V);for(let ee=0;ee<K.length;ee++)B^=K.charCodeAt(ee),B=Math.imul(B,16777619)}return pm=(B>>>0).toString(36),hk=C,pm}function la(C,B={}){var V;const K=B.includeHeightCache===!0,ee=(V=B.includeContentHash)!=null?V:K,he=K?(function(Se){const Pe=(function(){var Ze,_t;const lt=Number((_t=(Ze=s.virtualScroll)==null?void 0:Ze.heightCacheLimit)!=null?_t:5e3);return!Number.isFinite(lt)||lt<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(lt))})();if(!Number.isFinite(Pe)||Se.length<=Pe)return Se;const Ee=new Map,We=Ze=>{!Ze||Ee.size>=Pe||Ee.set(Ze.index,Ze)},De=st.value.length,$e=As(xs.start-2*wc.value,0,De),He=As(xs.end+2*wc.value,$e,De);for(const Ze of Se)Ze.index>=$e&&Ze.index<He&&We(Ze);const Qe=Math.max(1,Math.ceil(Se.length/Pe));for(let Ze=0;Ze<Se.length&&Ee.size<Pe;Ze+=Qe)We(Se[Ze]);for(let Ze=Se.length-1;Ze>=0&&Ee.size<Pe;Ze-=Qe)We(Se[Ze]);return Array.from(Ee.values()).sort((Ze,_t)=>Ze.index-_t.index).slice(0,Pe)})($4().map(Se=>{var Pe;const Ee=st.value[Se.index];return Ee?Lt(it({},Se),{nodeType:String((Pe=Ee.type)!=null?Pe:""),signature:Ac(Se.index)}):null}).filter(Se=>!!Se)):[],ke=U4({allowFallback:B.allowAnchorFallback===!0,requireViewport:B.requireViewport});return ke||he.length||B.includeEmptyState===!0?Lt(it({sessionKey:C.sessionKey,threadKey:C.threadKey},ke?{anchor:ke.anchor,anchorCaptured:ke.captured}:{anchorCaptured:!1}),{metrics:C,width:C.width,contentHash:ee?hm():void 0,measurementKey:Oi()||void 0,heightCache:he.length?he:void 0}):null}function mm(C){var B,V;const K=xc();if(!K)return;const ee=(function(Se){const Pe=S.value;if(!Pe)return null;const Ee=ce(Pe,Se.root),We=st.value.length,De=mt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>Pe.offsetHeight||0),$e=Math.max(0,De>0?De:We>0?mt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>Pe.scrollHeight||0):0),He=fk();return Ee+Math.max($e,He)})(K);if(ee==null)return;const he=Math.max(0,C.distanceFromBottomPx),ke=Math.max(0,ee-K.clientHeight-he);(function(Se){at=$c()+120,Ot=Se})(ke),K.isViewportRoot?(V=(B=K.doc.defaultView)==null?void 0:B.scrollTo)==null||V.call(B,0,ke):vS(K.root,K.doc,ke,{isReverseFlexScrollRoot:H,getNormalizedScrollTop:J})}const gm=[];function mk(){if(we)for(et!=null&&(Oe?.(et),et=null);gm.length;){const C=gm.pop();C!=null&&window.clearTimeout(C)}}function aa(C){const B=!!Be.value;Be.value=null,at=0,Ot=null,mk(),B&&C&&An(C)}function ca(){if(!Be.value||!we||et!=null)return;const C=()=>{et=null;const B=Be.value;B&&mm(B)};et=pe?pe(C):null,et==null&&C()}function gk(C,B={}){const V=st.value.length;return V<=0?[]:C.filter(K=>!(!Number.isInteger(K.index)||K.index<0||K.index>=V)&&!(!Number.isFinite(K.height)||K.height<=0)&&!(B.requireSignature&&!K.signature)&&!(B.requireCompatibilityMetadata&&!K.nodeType&&!K.signature)&&(function(ee){var he;const ke=st.value[ee.index];return!(!ke||ee.nodeType&&ee.nodeType!==String((he=ke.type)!=null?he:"")||ee.signature&&ee.signature!==Ac(ee.index))})(K))}function vk(C){const B=Cc(pl()),V=Cc(C);return B!==-1&&V!==-1&&B===V}function vm(C){var B;const V=Number(C?.width);if(Number.isFinite(V)&&V>0)return V;const K=Number((B=C?.metrics)==null?void 0:B.width);return Number.isFinite(K)&&K>0?K:null}function yk(C){var B;return C.sessionKey===On()&&!!im(C.threadKey)&&((B=C.measurementKey)!=null?B:"")===Oi()&&!!vk(vm(C))&&!!(function(V){const K=V.heightCache;return!!K?.length&&(kk(V)?K.some(ee=>!!(ee.nodeType||ee.signature)):K.some(ee=>!!ee.signature))})(C)}function kk(C){return!!(C.contentHash&&C.contentHash===hm())}function V4(C){return!kk(C)}let ml=null,gl=null,Md=null,Tc=null,Mc=null;function ym(C){var B;const V=C.map(ee=>{var he,ke;return[ee.index,Math.round(10*ee.height),(he=ee.nodeType)!=null?he:"",(ke=ee.signature)!=null?ke:""].join("")}).join(""),K=Cc(pl());return[(B=ps())!=null?B:"",On(),Oi(),st.value.length,K,C.length,fm(V)].join(":")}function bk(C=(B=>(B=s.virtualScroll)==null?void 0:B.heightCache)()){if(!Mt.value||!C?.length||st.value.length<=0||!vk((B=s.virtualScroll)==null?void 0:B.heightCacheWidth))return!1;var B;const V=gk(C,{requireSignature:!0});if(!V.length)return!1;const K=ym(V);return K===ml?(gl="standalone",!0):(Wy(V,{mode:"merge"}),Wo(),ml=K,gl="standalone",Lc(),An("restore"),!0)}function km(C,B={}){var V,K,ee;if(!Mt.value||!C||C.sessionKey!==On()||!im(C.threadKey)||st.value.length<=0)return!1;const he=!!((V=C.heightCache)!=null&&V.length)&&!Ed(),ke=!C.anchor||C.anchorCaptured===!1&&B.allowUncapturedAnchor!==!0?null:C.anchor,Se=B.restoreAnchor===!0&&!!ke&&!Ed()&&Number(vm(C))>0;let Pe=!1;if((K=C.heightCache)!=null&&K.length&&yk(C)){const We=gk(C.heightCache,{requireCompatibilityMetadata:!C.contentHash,requireSignature:V4(C)});We.length&&(Wy(We,{mode:"merge"}),Wo(),ml=ym(We),gl="restore",Lc(),Pe=!0)}if(he||Se)return!1;if(!B.restoreAnchor||!ke)return Pe&&An("restore"),!0;const Ee=(function(We,De){var $e;const He=We.anchor,Qe=He?He.type==="bottom"?`bottom:${Math.round(He.distanceFromBottomPx)}`:`node:${He.nodeIndex}:${Math.round(He.offsetWithinNodePx)}`:"none";return[($e=ps())!=null?$e:"",On(),Oi(),xd.value,De,Qe].join(":")})(C,(ee=B.restoreToken)!=null?ee:"imperative");return Md===Ee?(Pe&&An("restore"),!0):(Md=Ee,(function(We){const De=()=>{if(We.type==="node")return aa(),void Ss({nodeIndex:We.nodeIndex,offsetWithinNodePx:We.offsetWithinNodePx});if(nn(),Vt.value=null,Be.value=We,mk(),mm(We),we)for(const $e of[0,120,280,480])gm.push(window.setTimeout(()=>{const He=Be.value;He&&mm(He)},$e))};(function($e){if(!Nt.value)return!1;const He=st.value.length;return!(He<=0||(Ho.value=$e.type==="node"?As($e.nodeIndex,0,He-1):He-1,ul(),0))})(We)?ht(De):De()})(ke),An("restore"),!0)}function Ed(){const C=pl();return Number.isFinite(C)&&C>0}function _k(C){var B;return C.sessionKey===On()&&!!im(C.threadKey)&&(st.value.length<=0||!(!((B=C.heightCache)!=null&&B.length)||Ed())||!(!(C.anchor&&Number(vm(C))>0)||Ed()))}function bm(){ws.clear();for(const C of Object.keys(fs)){const B=Number(C);Number.isInteger(B)&&B>=0&&B<st.value.length&&By(B)}}function Ec(){wo!=null&&(Oe?.(wo),wo=null),$m()}function wk(){return!we||Wt?Promise.resolve():new Promise(C=>{let B=!1,V=null;const K=()=>{B||(B=!0,V!=null&&window.clearTimeout(V),C())};if(pe)return pe(K),void(V=window.setTimeout(K,50));V=window.setTimeout(K,0)})}function _m(C,B=ps(),V=So.value){return On()===C&&ps()===B&&So.value===V}function wm(){return zn(this,arguments,function*(C={}){var B,V,K,ee,he;const ke=On(),Se=ps(),Pe=So.value,Ee=(B=C.frames)!=null?B:2,We=(V=C.timeoutMs)!=null?V:120,De=(K=C.reason)!=null?K:"manual",$e=C.expectedSettledTokenKey,He=C.flushPendingTimers===!0,Qe=hl(De),Ze=()=>Lt(it({},Qe),{phase:Qe.final?"settling":Qe.phase,stable:!1,confidence:Qe.confidence==="final"?"mixed":Qe.confidence,reason:De}),_t=()=>_m(ke,Se,Pe)&&($e==null||Nc()===$e);for(let wt=0;wt<Ee;wt++){if(yield ht(),!_t()||(yield wk(),!_t()))return Ze();Pi(),Ec()}if(yield(function(wt){return!we||wt<=0?Promise.resolve():new Promise(Zt=>window.setTimeout(Zt,wt))})(We),!_t()||(He&&Xy(),Pi(),Ec(),!_t()))return Ze();const lt=um();lt&&(cm=ke,am=Se,((ee=s.virtualScroll)==null?void 0:ee.settleMode)==="manual"&&$e!=null&&Ad((he=s.virtualScroll)==null?void 0:he.settledToken)&&Nc()===$e&&(ra=Bc(s.virtualScroll.settledToken)));const ct=_t()&<&&dk(),St=hl(De,ct?"final":void 0);return Tm(St,!0),St})}let Sm="content",vl=null,yl=null,Cm=0,Ic=null,ua=null,xm=null,Am=null;function $c(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Sk(C){var B,V;const K=Ic;if(!K)return!0;const ee=(V=(B=s.virtualScroll)==null?void 0:B.heightDiffThresholdPx)!=null?V:1;return Math.abs(C.totalHeight-K.totalHeight)>ee||C.sessionKey!==K.sessionKey||C.phase!==K.phase||C.stable!==K.stable||C.final!==K.final||C.threadKey!==K.threadKey||C.nodeCount!==K.nodeCount||C.measuredCount!==K.measuredCount||C.width!==K.width}function vs(C){if(C==null)return"";if(typeof C=="string"||typeof C=="number"||typeof C=="boolean")return String(C);try{return JSON.stringify(C)}catch{return String(C)}}function Nc(C=(B=>(B=s.virtualScroll)==null?void 0:B.settledToken)()){return vs(C)}function Ck(C,B){var V,K;return[C,B.sessionKey,(V=B.threadKey)!=null?V:"",Oi(),hm(),vs((K=s.virtualScroll)==null?void 0:K.settledToken),Math.round(B.totalHeight),Math.round(B.width)].join("\0")}function Lc(){xm=null,Am=null,ua=null}function K4(C){const B=C.heightCache;return B?.length?ym(B):""}function Oc(C){var B,V,K;const ee=C.metrics,he=C.anchor?(ke=C.anchor).type==="bottom"?`bottom:${Math.round(ke.distanceFromBottomPx)}`:`node:${ke.nodeIndex}:${Math.round(ke.offsetWithinNodePx)}`:"none";var ke;return[C.sessionKey,(B=C.threadKey)!=null?B:"",(V=C.measurementKey)!=null?V:Oi(),(K=C.contentHash)!=null?K:"",K4(C),he,C.anchorCaptured?1:0,ee.liveRange.start,ee.liveRange.end,ee.renderedCount,ee.nodeCount,Math.round(ee.totalHeight),Math.round(ee.width),ee.phase,ee.stable?1:0].join("\0")}function Tm(C,B=!1){if(!Mt.value||(function(ke=!1){return!ke&&Ln.value&&!us.value})(B))return;const V=B||Sk(C),K=(function(ke,Se=!1){return Se||ke.stable||ke.phase==="final"?{state:la(ke,{includeHeightCache:!0})}:{state:la(ke)}})(C,B),ee=K.state,he=!!(ee&&(V||(function(ke,Se=!1){return!!Se||Oc(ke)!==ua})(ee,B)));if(V&&(E(C),Ic=C,Cm=$c()),ee&&he&&(M(ee),ee.anchor&&L(ee.anchor),ua=Oc(ee)),C.stable){const ke=Ck("settled",C);if(ke!==xm){xm=ke;const Se=la(C,{includeHeightCache:!0});Se&&(M(Se),ua=Oc(Se)),(function(Pe){o("render-settled",Pe)})(C)}}if(C.phase==="final"){const ke=Ck("final",C);if(ke!==Am){Am=ke;const Se=la(C,{includeHeightCache:!0});Se&&(M(Se),ua=Oc(Se)),(function(Pe){o("render-final",Pe)})(C)}}}function Mm(){vl!=null&&(Oe?.(vl),vl=null),yl!=null&&we&&(window.clearTimeout(yl),yl=null)}function xk(){vl=null,yl=null,(function(C){if(Li.size>0||wo!=null)return!0;switch(C){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(Sm)&&(Pi(),Ec()),Tm(hl(Sm))}function An(C){var B,V;if(!Mt.value||(Sm=C,vl!=null||yl!=null))return;const K=Math.max(0,(V=(B=s.virtualScroll)==null?void 0:B.emitIntervalMs)!=null?V:32),ee=Math.max(0,K-($c()-Cm)),he=()=>{yl=null,vl=pe?pe(xk):null,vl==null&&xk()};we&&ee>0?yl=window.setTimeout(he,ee):he()}function Em(C){var B;if(C<=0)return 0;const V=st.value;if(Xt.value)return ok(C);if(cl.value===V.length&&jh.value.length&&Vh.value.length){const ee=yi.value,he=jh.value,ke=Vh.value,Se=De=>De<=0?0:gd(he,0,De)+(De-gd(ke,0,De))*ee;let Pe=0,Ee=V.length-1,We=V.length-1;for(;Pe<=Ee;){const De=Pe+Ee>>1;Se(De+1)>=C?(We=De,Ee=De-1):Pe=De+1}return We}let K=C;for(let ee=0;ee<V.length;ee++){const he=(B=fs[ee])!=null?B:yi.value;if(K<=he)return ee;K-=he}return Math.max(0,V.length-1)}function Ak(){se.value+=1}function Im(C){return!(ii.value&&C>=_s.value)&&(!cr.value||C<Bn.value||Qh.value.has(C))}function da(C){const B=wd.get(C);B&&(B(),wd.delete(C));const V=na.get(C);V&&(V.destroy(),na.delete(C)),Sd(C)}function Tk(C,B){let V=!1;if(B){const he=Os.get(C);Os.set(C,B),he!==B&&(V=!0)}else Os.delete(C)&&(V=!0);if(V&&Ak(),B||Sd(C),!zy.value||!de||!Nt.value&&cr.value&&!z.value&&na.size>=640&&(z.value||(z.value=!0,Zh()),!zy.value||!de))return da(C),void(B&&fr(C,!0));if(C<Bn.value&&!Nt.value||Qh.value.has(C))return da(C),void fr(C,!0);if(!B)return void da(C);da(C);const K=de(B,{rootMargin:"400px"});if(!K)return;na.set(C,K),fr(C,K.isVisible.value),cr.value&&(function(he){if(!we||!cr.value)return;Sd(he);const ke=he%17*23,Se=window.setTimeout(()=>{if(Qy.delete(he),!cr.value||Qh.value.has(he))return;const Pe=Os.get(he);if(!Pe)return;const Ee=ne(Pe),We=Pe.ownerDocument||document,De=We.defaultView||window,$e=!Ee||Ee===We.documentElement||Ee===We.body,He=!$e&&Ee?mt("nodeVisibilityFallback.root.getBoundingClientRect",()=>Ee.getBoundingClientRect()):null,Qe=$e?0:He.top,Ze=$e?mt("nodeVisibilityFallback.clientHeight",()=>{var lt,ct;return(ct=(lt=De.innerHeight)!=null?lt:Ee?.clientHeight)!=null?ct:0}):He.bottom,_t=mt("nodeVisibilityFallback.node.getBoundingClientRect",()=>Pe.getBoundingClientRect());_t.bottom>=Qe-500&&_t.top<=Ze+500&&fr(he,!0)},1800+ke);Qy.set(he,Se)})(C);let ee=null;ee=Ke(()=>K.isVisible.value,he=>{if(he){Sd(C),fr(C,!0),ee?.(),wd.delete(C),na.get(C)===K&&na.delete(C);try{K.destroy()}catch{}}},{immediate:!0}),wd.set(C,ee),Nt.value&&_i()}function $m(){wo=null;for(const[C,B]of Li)Li.delete(C),ki.get(C)===B.el&&dl.get(C)===B.version&&Fy(C,B.height,{allowShrink:B.allowShrink})}function fa(){wo!=null&&(Oe?.(wo),wo=null),Li.clear()}function Id(C,B){(function(V,K,ee){var he;if(!Number.isFinite(ee)||ee<=0||ki.get(V)!==K)return;const ke=dl.get(V);if(ke==null)return;const Se=st.value[V],Pe=Y.value&&j.value!==!0&&!((he=s.nodes)!=null&&he.length)&&V>=st.value.length-2,Ee=!(Se?.loading===!0||Pe),We=Li.get(V),De=We?We.allowShrink&&Ee:Ee,$e=We&&!De?Math.max(We.height,ee):ee;Li.set(V,{height:$e,allowShrink:De,version:ke,el:K}),wo==null&&(wo=pe?pe($m):null,wo==null&&$m())})(C,B,Hy(C,B))}function Pi(){for(const[C,B]of ki)B&&Id(C,B)}function Mk(){Ne?.disconnect(),Ne=null,ft.clear()}function Nm(){for(;yd.length;)_d(yd.pop())}Ke(us,C=>{C&&An("content")},{flush:"post"}),t({getVirtualMetrics:hl,captureVirtualState:function(C={}){var B;return la(hl("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:C.allowFallbackAnchor===!0,requireViewport:C.requireViewport===!0,includeEmptyState:(B=C.includeEmptyState)==null||B})},restoreVirtualState:function(C,B={}){const V=B.restoreAnchor===!0,K=B.restoreToken==null?"imperative":String(B.restoreToken);Tc=C,Mc={restoreAnchor:V,restoreToken:K,allowUncapturedAnchor:B.allowUncapturedAnchor===!0},!km(C,{restoreAnchor:V,restoreToken:K,allowUncapturedAnchor:B.allowUncapturedAnchor===!0})&&_k(C)||(Tc=null,Mc=null)},forceMeasure:function(C="manual"){return zn(this,null,function*(){yield ht(),yield wk(),Pi(),Ec(),yield ht();const B=hl(C);return Tm(B,!0),B})},settle:wm,scrollToNode:function(C,B="start"){aa(),nn();const V=st.value.length;if(V<=0)return;const K=As(C,0,V-1),ee=()=>{var he;const ke=Fo({nodeIndex:K,offsetWithinNodePx:0}),Se=Cd(K),Pe=xc(),Ee=(he=Pe?.clientHeight)!=null?he:0,We=qt();let De=ke;if(B==="center")De=ke-Ee/2+Se/2;else if(B==="end")De=ke-Ee+Se;else if(B==="nearest"&&We!=null){if(ke>=We&&ke+Se<=We+Ee)return;De=ke<We?ke:ke-Ee+Se}Bo(Math.max(0,De)),_i({immediate:!0}),Nt.value&&(Ho.value=K,ul())};if(Nt.value)return Ho.value=K,ul(),void ht(ee);ee()}}),Ke(()=>Xe.value,C=>{if(!C){Mk();for(const B of ur.values())for(const V of B)_d(V);ur.clear(),dl.clear(),Nm(),fa()}},{immediate:!0}),Ke(j,C=>{C&&(function(){if(we&&j.value&&ki.size){Nm();for(const B of[80,240,640]){const V=Yy(B,()=>{for(const[K,ee]of ki)ee&&Id(K,ee)},"final");V!=null&&yd.push(V)}}})(),An(C?"final":"content")}),Ke([()=>st.value.length,()=>_s.value],()=>{Be.value&&ca(),An("content")},{flush:"post",immediate:!0}),Ke([()=>xs.start,()=>xs.end],()=>{An("batch")},{flush:"post"});const{cleanupBatchScheduler:G4}=(function(C){const{props:B,isClient:V,isTestEnv:K,parsedNodesIdentity:ee,parsedNodeCount:he,desiredRenderedCount:ke,datasetKey:Se,batchingEnabled:Pe,incrementalRenderingActive:Ee,resolvedBatchSize:We,resolvedInitialBatch:De,renderedCount:$e,adaptiveBatchSize:He,previousRenderContext:Qe,previousBatchConfig:Ze,requestFrame:_t,cancelFrame:lt,hasIdleCallback:ct,cleanupNodeVisibility:St,onDatasetKeyChanged:wt,onDatasetChanged:Zt}=C;let xt=null,Bt=null,Rt=!1,ln=null,Co=null,js=0,ri=!1,hr=!1;const mr=new Set,bl=new Set;function Vk(){if(V){xt!=null&&(lt?.(xt),xt=null),Bt!=null&&(window.clearTimeout(Bt),Bt=null),Co!=null&&typeof window.cancelIdleCallback=="function"&&(window.cancelIdleCallback(Co),Co=null),js+=1;for(const Rs of mr)lt?.(Rs);mr.clear();for(const Rs of bl)window.clearTimeout(Rs);bl.clear(),Rt=!1,ln=null,ri=!1,hr=!1}}function Dd(){return typeof performance<"u"?performance.now():Date.now()}function Kk(Rs){(function(Ri){var gr;if(!Ee.value)return;const Di=Math.max(2,(gr=B.renderBatchBudgetMs)!=null?gr:6),Bi=Math.max(1,We.value||1),li=Math.max(1,Math.floor(Bi/4));Ri>1.2*Di?He.value=Math.max(li,Math.floor(.7*He.value)):Ri<.5*Di&&He.value<Bi&&(He.value=Math.min(Bi,Math.ceil(1.2*He.value)))})(Rs),ri=!1;const io=hr||$e.value<ke.value;hr=!1,io&&Xk()}function Gk(Rs,io={}){var Ri,gr;if(!Ee.value)return;const Di=ke.value;if($e.value>=Di)return;const Bi=Math.max(1,Rs),li=()=>{const ma=Dd();let ga=0;xt=null,Bt=null,Co=null,Rt=!1;const va=ln??Bi;ln=null;const Hm=Dd();$e.value=Math.min(Di,$e.value+va),St($e.value),ga=Dd()-Hm,(function(Wm,Qk){if(!V)return void Kk(Qk);ri=!0;const Zk=++js;ht().then(()=>{var Jk;if(Zk!==js)return;const hE=Dd(),mE=Math.max(Qk,hE-Wm),eb=()=>{Zk===js&&Kk(mE)};if(_t){let nb=!1,Fi=null;const sb=()=>{nb||(nb=!0,eb())},Bd=_t(()=>{mr.delete(Bd),Fi!=null&&(window.clearTimeout(Fi),bl.delete(Fi),Fi=null),sb()});return mr.add(Bd),Fi=window.setTimeout(()=>{Fi!=null&&bl.delete(Fi),Fi=null,lt?.(Bd),mr.delete(Bd),sb()},Math.max(32,(Jk=B.renderBatchIdleTimeoutMs)!=null?Jk:120)),void bl.add(Fi)}const tb=window.setTimeout(()=>{bl.delete(tb),eb()},0);bl.add(tb)})})(ma,ga)};if(!V||io.immediate)return void li();const vr=Math.max(0,(Ri=B.renderBatchDelay)!=null?Ri:16);if(ln=ln!=null?Math.max(ln,Bi):Bi,!Rt){if(Rt=!0,!K&&ct&&window.requestIdleCallback){const ma=Math.max(0,(gr=B.renderBatchIdleTimeoutMs)!=null?gr:120);return void(Co=window.requestIdleCallback(()=>li(),{timeout:ma}))}_t&&!K?xt=_t(()=>{vr!==0?Bt=window.setTimeout(()=>li(),vr):li()}):Bt=window.setTimeout(()=>li(),vr)}}function Yk(Rs,io={}){ri?hr=!0:Rs==null?Xk():Gk(Rs,io)}function Xk(){Ee.value&&Gk(Pe.value?Math.max(1,Math.round(He.value)):Math.max(1,We.value))}return Ke([ee,he,Se,Ee,We,De,()=>B.renderBatchDelay],()=>{var Rs;const io=he.value,Ri=Qe.value,gr=Se.value,Di=!Object.is(gr,Ri.key),Bi=io!==Ri.total,li=Di||Bi;Qe.value={key:gr,total:io};const vr=Ze.value,ma=(Rs=B.renderBatchDelay)!=null?Rs:16,ga=vr.batchSize!==We.value||vr.initial!==De.value||vr.delay!==ma||vr.enabled!==Ee.value;Ze.value={batchSize:We.value,initial:De.value,delay:ma,enabled:Ee.value},Di&&wt(io),(li||ga||!Ee.value)&&Vk(),(li||ga)&&(He.value=Math.max(1,We.value||1)),li&&Zt();const va=ke.value;if(!io)return $e.value=0,void St(0);if(!Ee.value)return $e.value=va,void St($e.value);const Hm=Di||Ri.total===0;$e.value=Hm||ga?Math.min(va,De.value):Math.min($e.value,va);const Wm=Math.max(1,De.value||We.value||io);$e.value<va?Yk(Wm,{immediate:!V}):St($e.value)},{immediate:!0}),Ke(ke,(Rs,io)=>{Ee.value&&(typeof io=="number"&&Rs<=io||Rs>$e.value&&Yk())}),{cleanupBatchScheduler:Vk}})({props:k,isClient:we,isTestEnv:Wt,parsedNodesIdentity:_n,parsedNodeCount:Kn,desiredRenderedCount:kd,datasetKey:H4,batchingEnabled:bo,incrementalRenderingActive:ii,resolvedBatchSize:ds,resolvedInitialBatch:Bn,renderedCount:_s,adaptiveBatchSize:ll,previousRenderContext:ta,previousBatchConfig:al,requestFrame:pe,cancelFrame:Oe,hasIdleCallback:Qt,cleanupNodeVisibility:O4,onDatasetKeyChanged:C=>{fa(),vd(),Wo(),Lc(),C>0&&md(C)},onDatasetChanged:()=>{Nt.value&&_i({immediate:!0})}});Ke([Uy,Nt,()=>S.value,()=>ye()],([C,B])=>{if(!C)return Zy(),void Xh();P4(),B?_i({immediate:!0}):Xh()},{flush:"post",immediate:!0}),Ke([()=>st.value.length,()=>Nt.value],C=>zn(null,[C],function*([B,V]){V&&B&&we&&(yield ht(),_i({immediate:!0}))}),{flush:"post"}),Ke(Xt,C=>{C&&(function(){var B;if($n.value&&Ge.value&&Ye.value&&((B=Ct.value)!=null&&B[1]))return;const V=Dr({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),K=Dr({type:"list_item",children:[V],raw:"- Probe paragraph text"}),ee=Dr({type:"list",ordered:!1,items:[K],raw:"- Probe paragraph text"});$n.value=V,Ge.value=K,Ye.value=ee;const he={1:null,2:null,3:null,4:null,5:null,6:null};for(let ke=1;ke<=6;ke++)he[ke]=Dr({type:"heading",level:ke,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(ke)} Probe heading`});Ct.value=he})()},{immediate:!0}),Ke([()=>S.value,Xt],()=>{if(!Xt.value)return em(),void(X.value=0);ek(),em(),Xt.value&&S.value&&typeof ResizeObserver<"u"&&(Sc=new ResizeObserver(()=>{ek(),Vt.value&&Jn(),Be.value&&ca(),An("resize")}),Sc.observe(S.value))},{immediate:!0}),Ke([Xt,qs,So],()=>zn(null,null,function*(){if(!Xt.value)return fe.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Wo();yield ht(),(function(){if(!Xt.value||typeof window>"u")return fe.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Wo();const C={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},B=Jy(Jh(I.value),".paragraph-node");C.paragraph=jg(I.value,B,"pre-wrap");const V=Jh(P.value),K=V?.querySelector(".paragraph-node");C.listItem=jg(P.value,K,"pre-wrap");const ee=mt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var ke,Se;return(Se=(ke=D.value)==null?void 0:ke.offsetHeight)!=null?Se:0}),he=mt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var ke,Se;return(Se=(ke=P.value)==null?void 0:ke.offsetHeight)!=null?Se:0});C.listWrapperOverhead=Math.max(0,ee-he);for(let ke=1;ke<=6;ke++){const Se=Jy(Jh(W[ke]),`h${ke}`);C.headings[ke]=jg(W[ke],Se,"pre-wrap")}fe.value=C,Wo()})()}),{flush:"post",immediate:!0}),Ke(()=>st.value.length,()=>{Nt.value&&_i({immediate:!0})}),Ke([Xt,X],()=>{Wo(),Nt.value&&_i({immediate:!0}),Vt.value&&Jn(),Be.value&&ca(),An("resize")},{immediate:!1}),Ke(()=>cr.value,C=>{if(C)for(const[B,V]of Os)Tk(B,V);else{Zh();for(const[B,V]of Os)V&&fr(B,!0)}},{immediate:!1}),Ke([()=>k.viewportPriority,()=>st.value.length],([C,B])=>{C!==!1?z.value&&B<=200&&(z.value=!1):z.value=!1}),Ke(()=>_s.value,()=>{Nt.value&&_i({immediate:!0})}),Ke([Ho,oo,wc,()=>st.value.length,Nt],()=>{ul()},{immediate:!0});let Pc=null,Rc=!1,pa=null;function Dc(){Pc=null,cm=null,am=void 0,ra=null,Lc()}function Lm(){fa(),vd(),Wo(),ws.clear();const C=st.value.length;C>0&&md(C),bm()}function Om(){Mm(),Xy(),Ic=null,ml=null,gl=null,Md=null,Tc=null,Mc=null,Rc=!1,Dc(),ck("restore"),nn(),aa()}function Bc(C){var B;return[(B=ps())!=null?B:"",On(),Oi(),xd.value,Nc(C),st.value.length,Math.round(pr(0,st.value.length)),Math.round(pl()),Cs.count,Math.round(Cs.total)].join(":")}function Ek(){return zn(this,null,function*(){var C,B,V,K;const ee=(C=s.virtualScroll)==null?void 0:C.settledToken,he=Nc(ee),ke=On(),Se=ps(),Pe=So.value;if(Mt.value&&((B=s.virtualScroll)==null?void 0:B.settleMode)==="manual"&&Ad(ee))if(um()){if(Bc(ee)!==ra&&!Rc){Rc=!0;try{const Ee=yield wm({reason:"manual",expectedSettledTokenKey:he}),We=Nc()===he;_m(ke,Se,Pe)&&Ee.sessionKey===ke&&Ee.threadKey===Se&&We&&Ee.stable&&Ee.phase==="final"&&(ra=Bc((V=s.virtualScroll)==null?void 0:V.settledToken))}finally{Rc=!1,yield ht();const Ee=(K=s.virtualScroll)==null?void 0:K.settledToken,We=Ad(Ee)?Bc(Ee):"";_m(ke,Se,Pe)&&We&&ra!==We&&Ek()}}}else An("manual")})}Ke(Mt,(C,B)=>{if(C!==B){if(!C)return Om(),void Mm();Om(),Lm(),pa=So.value,An("content")}},{flush:"post"}),Ke([Mt,So],([C,B])=>{C?pa!=null?pa!==B&&(pa=B,(function(V="resize"){fa(),vd(),Wo(),ws.clear();const K=st.value.length;K>0&&md(K),bm(),ml=null,gl=null,Md=null,Ic=null,Rc=!1,Dc(),bk(),ht(()=>{Pi(),Vt.value&&Jn(),Be.value&&ca(),An(V)})})("resize")):pa=B:pa=null},{flush:"post",immediate:!0}),Ke([Mt,()=>On(),()=>ps()],([C])=>{C&&(Om(),Lm(),ck("content"),An("content"))}),Ke([Mt,()=>On(),()=>ps(),So,()=>st.value.length],([C])=>{C&&(function(B="async-node"){let V=!1;for(const[K,ee]of Array.from(bi.entries()))rm(ee)||(bi.delete(K),_o.delete(K),V=!0);V&&(oa(),An(B))})("async-node")},{flush:"post"}),Ke([Mt,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.sessionKey},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey},()=>s.indexKey,()=>Q.value],([C])=>{C&&(Lc(),(function(B="content"){if(!Mt.value)return;const V=[],K=st.value.length;for(const ee of Array.from(ws.keys())){if(ee>=K){V.push(ee);continue}const he=Ac(ee),ke=ws.get(ee);ke!=null&&ke!==he&&V.push(ee),ws.set(ee,he)}for(const ee of Array.from(ws.keys()))ee>=K&&ws.delete(ee);V.length&&((function(ee,he={}){const ke=Array.from(ee,Number);I4(ke,he)>0&&(function(Pe){for(const Ee of Pe)ws.delete(Ee)})(ke)})(V,{notify:!1}),Wo(),Dc(),Vt.value&&Jn(),Be.value&&ca(),An(B))})("content"))},{flush:"post",immediate:!0}),Ke([Mt,()=>st.value.length,()=>On(),()=>ps()],([C,B,V,K],[ee,he,ke,Se])=>{C&&ee&&V===ke&&K===Se&&B!==he&&Dc()},{flush:"post"}),Ke([Mt,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.heightCache},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.heightCacheWidth},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreState},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey},()=>st.value.length,()=>On(),X],()=>{bk()},{flush:"post",immediate:!0}),Ke([Mt,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreState},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreAnchor},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey},()=>st.value.length,()=>On(),X],C=>zn(null,[C],function*([B,V]){if(!B||!V)return;yield ht();const K=(function(){var ee;const he=(ee=s.virtualScroll)==null?void 0:ee.restoreAnchor;return he==null||he===!1?null:he===!0?"true":String(he)})();km(V,{restoreAnchor:K!=null,restoreToken:K??void 0})}),{flush:"post",immediate:!0}),Ke([Mt,X,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.restoreState},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.measurementKey}],([C])=>{var B;if(!C)return;const V=(B=s.virtualScroll)==null?void 0:B.restoreState;V&&ml&&gl==="restore"&&(yk(V)||(Lm(),ml=null,gl=null,An("resize")))},{flush:"post"}),Ke([Mt,()=>st.value.length,()=>On(),X],C=>zn(null,[C],function*([B]){var V;const K=Tc,ee=Mc;B&&K&&(yield ht(),!km(K,{restoreAnchor:ee?.restoreAnchor===!0,restoreToken:(V=ee?.restoreToken)!=null?V:"imperative",allowUncapturedAnchor:ee?.allowUncapturedAnchor===!0})&&_k(K)||(Tc=null,Mc=null))}),{flush:"post",immediate:!0}),Ke([Mt,j,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.settleMode},()=>On(),()=>ps(),So,Gh,jy,()=>_s.value,kd,()=>Cs.count,()=>Cs.total],([C,B,V])=>{if(!C||B!==!0||V==="manual"||!dm())return;const K=(function(){var ee;const he=st.value.length;return[(ee=ps())!=null?ee:"",On(),Oi(),xd.value,he,Math.round(pr(0,he)),Math.round(pl()),Cs.count,Math.round(Cs.total)].join(":")})();Pc!==K&&(Pc=K,wm({reason:"final"}).then(ee=>{ee.stable||Pc!==K||(Pc=null)}))},{flush:"post",immediate:!0}),Ke([Mt,j,()=>{var C;return(C=s.virtualScroll)==null?void 0:C.settleMode},()=>{var C;return(C=s.virtualScroll)==null?void 0:C.settledToken},()=>On(),()=>ps(),So,Gh,jy,()=>_s.value,kd,()=>st.value.length,()=>Cs.count,()=>Cs.total],()=>{Ek()},{flush:"post",immediate:!0}),Ke([()=>st.value.length,Nt,oo,wc,()=>xs.start,()=>xs.end],([C,B,V,K,ee,he])=>{Ue.value&&Te("virtualization",{nodes:C,virtualization:B,maxLiveNodes:V,buffer:K,focusIndex:Ho.value,scroll:B?(()=>{const ke=xe.value||ne();return ke?{reverse:H(ke),scrollTop:Math.round(ke.scrollTop),scrollTopAbs:Math.round(Math.abs(ke.scrollTop)),scrollHeight:Math.round(ke.scrollHeight),clientHeight:Math.round(ke.clientHeight)}:null})():null,liveRange:{start:ee,end:he},rendered:_s.value})}),Ke([()=>k.customId],([C],B,V)=>{if(!C||$t)return;const K=(function(ee,he){return ee?(hs.controllers[ee]=he,()=>{hs.controllers[ee]===he&&delete hs.controllers[ee]}):()=>{}})(C,{captureRestoreAnchor:Fn,restoreAnchor:Ss,getAnchorDrift:Ps,getReport:D4});V(()=>{K()})},{immediate:!0}),ls(()=>{(function(){if(Mt.value)try{Pi(),Ec();const C=hl("manual");Sk(C)&&(E(C),Ic=C,Cm=$c());const B=la(C,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});B&&(M(B),B.anchor&&L(B.anchor),ua=Oc(B))}catch{}})(),G4(),Zh(),Ie(),Mk();for(const C of ur.values())for(const B of C)_d(B);ur.clear(),dl.clear(),ws.clear(),Nm(),fa(),em(),nn(),aa(),Mm(),Zy(),Xh()});const Y4=ui({loader:()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./index11-g8v025wN.js"),__vite__mapDeps([8,5]))).default}catch(C){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',C),xo}}),loadingComponent:RV,delay:0}),X4=ui({loader:()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./index10-Qbuw1N6u.js"),[])).default}catch(C){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',C),xo}}),loadingComponent:PV,delay:0}),Q4=ui(()=>zn(null,null,function*(){try{return(yield Xs(()=>import("./index7-BcPbgCKN.js"),[])).default}catch(C){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',C),xo}})),Ik={text:Xn,paragraph:ql,heading:Rp,code_block:Dg,list:nc,list_item:tc,blockquote:Of,table:wu,definition_list:Pf,footnote:Rf,footnote_reference:$o,footnote_anchor:bu,admonition:Hf,vmr_container:Bf,hardbreak:jr,link:to,image:qr,thematic_break:Df,math_inline:gi,math_block:QM,strong:Js,emphasis:no,strikethrough:eo,highlight:Lo,insert:vo,subscript:go,superscript:mo,emoji:ho,checkbox:Io,checkbox_input:Io,inline_code:Us,html_inline:No,reference:Zs,html_block:_u},Z4=F(()=>om()),$k=F(()=>gS(k.codeBlockProps)),J4=F(()=>gS(k.codeBlockProps,{omit:["langs"]})),Nk=F(()=>it(it({stream:k.codeBlockStream,darkTheme:k.codeBlockDarkTheme,lightTheme:k.codeBlockLightTheme,monacoOptions:k.codeBlockMonacoOptions,themes:k.themes,langs:u.value==="shiki"?k.langs:void 0,minWidth:k.codeBlockMinWidth,maxWidth:k.codeBlockMaxWidth},typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{}),J4.value)),Lk=F(()=>it(Lt(it({},Nk.value),{langs:k.langs}),$k.value));function Ok(C){return typeof C=="boolean"?C:void 0}const eE=F(()=>{const C=k.codeBlockProps||{},B={},V=Ok(C.showLineNumbers);V!==void 0&&(B.showLineNumbers=V);const K=Ok(C.diffInline);K!==void 0&&(B.diffInline=K);const ee=(function(he){const ke=Number(he);return Number.isFinite(ke)&&ke>0?ke:void 0})(C.reservedHeightPx);return ee!==void 0&&(B.reservedHeightPx=ee),B}),tE=F(()=>it(it({stream:k.codeBlockStream,darkTheme:k.codeBlockDarkTheme,lightTheme:k.codeBlockLightTheme,themes:k.themes,langs:k.langs,minWidth:k.codeBlockMinWidth,maxWidth:k.codeBlockMaxWidth},typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{}),$k.value)),nE=F(()=>it({},k.mermaidProps||{})),Pk=F(()=>it({},k.d2Props||{})),sE=F(()=>it({},k.infographicProps||{})),Fc=F(()=>({typewriter:k.typewriter,fade:k.fade,customHtmlTags:Vn.value.customHtmlTags})),oE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltip:Fe.value}:{})),iE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{})),rE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{})),lE=F(()=>it(it({},Fc.value),typeof Fe.value=="boolean"?{showTooltips:Fe.value}:{}));function aE(C){return Array.isArray(C.children)&&C.children.length>0}const Pm=F(()=>R4.value.map(C=>{var B,V,K,ee,he,ke,Se,Pe;let Ee=(function(lt){var ct,St,wt,Zt,xt,Bt,Rt;if(lt.type!=="code_block")return lt;const ln=lt,Co=[String((ct=ln.language)!=null?ct:""),String((St=ln.loading)!=null?St:""),String((wt=ln.diff)!=null?wt:""),String((Zt=ln.code)!=null?Zt:""),String((xt=ln.originalCode)!=null?xt:""),String((Bt=ln.updatedCode)!=null?Bt:""),String((Rt=ln.raw)!=null?Rt:"")].join("\0"),js=xn.get(ln);if(js&&js.signature===Co)return js.node;const ri=it({},ln);return xn.set(ln,{signature:Co,node:ri}),ri})(C.node);const We=$d(Ee);let De=Fk(Ee,We);if((Ee.type==="html_block"||Ee.type==="html_inline")&&De===Ik[Ee.type]){const lt=Ee,ct=String((B=lt.tag)!=null?B:"").trim().toLowerCase()||WT(lt.content);if(ct){const St=Ft.value[ct];if(bn.value.has(ct)&&St)De=St,Ee=Lt(it({},lt),{type:ct,tag:ct,content:Z9(lt.content,ct)});else if(zT((V=lt.content)!=null?V:lt.raw,ct)){const wt=String((ee=(K=lt.content)!=null?K:lt.raw)!=null?ee:"");Ee.type==="html_inline"?(De=Xn,Ee={type:"text",content:wt,raw:wt}):(De=ql,Ee={type:"paragraph",children:[{type:"text",content:wt,raw:wt}],raw:wt})}}}const $e=Ee.type==="code_block"&&u.value==="pre"&&De===xo&&!Rm(Ft.value,We);let He=it({},(function(lt,ct,St){const wt=ct??$d(lt);if(lt.type==="code_block"){const Zt=wt?Rm(Ft.value,wt):void 0;if(St&&u.value==="pre"&&!Zt&&St===xo)return eE.value;if(St&&wt&&St===Zt)return wt==="mermaid"?Dk(lt):wt==="infographic"?Bk(lt):wt==="d2"||wt==="d2lang"?Pk.value:Lk.value;if(St&&St===Ft.value.code_block)return Lk.value;if(nk(St))return tE.value}return wt==="mermaid"?Dk(lt):wt==="infographic"?Bk(lt):wt==="d2"||wt==="d2lang"?Pk.value:lt.type==="link"?oE.value:lt.type==="list"?iE.value:lt.type==="blockquote"?rE.value:lt.type==="table"?lE.value:lt.type==="code_block"?Nk.value:Fc.value})(Ee,We,De));const Qe=fl.value[C.index];Ee.type==="code_block"&&Qe?.kind==="code-block"&&(He=Lt(it({},He),$e?{reservedHeightPx:(he=Qe.height)!=null?he:Qe.contentHeight}:{estimatedHeightPx:Qe.height,estimatedContentHeightPx:Qe.contentHeight})),$e||Ee.type!=="code_block"||We!=="mermaid"||Ha(He.estimatedPreviewHeightPx)!=null||(He=Lt(it({},He),{estimatedPreviewHeightPx:m1(p1(String((ke=Ee.code)!=null?ke:"")))})),$e||Ee.type!=="code_block"||We!=="infographic"||Ha(He.estimatedPreviewHeightPx)!=null||(He=Lt(it({},He),{estimatedPreviewHeightPx:g1(h1(String((Se=Ee.code)!=null?Se:"")))})),Ee.type==="math_block"&&(He=Lt(it({},He),{cacheScope:Dn.value}));const Ze=(function(lt,ct){const St=String(lt.type);return!dd(St)&&Ft.value[St]===ct})(Ee,De),_t=Ze?ay(Ee,rt.value):void 0;return Lt(it({},C),{node:Ee,component:De,bindings:He,customBindings:it(it({},_t??{}),He),rendersCustomNode:Ze,hasSlotChildren:aE(Ee),slotContent:String((Pe=Ee.content)!=null?Pe:""),isCodeBlock:Ee.type==="code_block",indexKey:`${Z4.value}-${C.index}`})}));function $d(C){var B;return C?.type==="code_block"?String((B=C.language)!=null?B:"").trim().toLowerCase():""}function Rm(C,B){const V=B.trim().toLowerCase();if(V)for(const K of[V,ty(V),RM(V)]){const ee=K&&C[K];if(ee)return ee}}function Rk(C,B,V,K){var ee,he;const ke=it({},C.value);return Ha(ke.estimatedPreviewHeightPx)==null&&(ke.estimatedPreviewHeightPx=K(V(String((ee=B?.code)!=null?ee:"")),void 0,ke.maxHeight==="none"?null:(he=Ha(ke.maxHeight))!=null?he:void 0)),ke}function Dk(C){return Rk(nE,C,p1,m1)}function Bk(C){return Rk(sE,C,h1,g1)}function Fk(C,B){if(!C)return A1;const V=Ft.value,K=V[String(C.type)];if(C.type==="code_block"){const ee=B??$d(C),he=ee?Rm(V,ee):void 0;return he||(u.value==="pre"?V.code_block||xo:ee==="mermaid"?V.mermaid||Y4:ee==="infographic"?V.infographic||X4:ee==="d2"||ee==="d2lang"?V.d2||Q4:K||V.code_block||sk.value)}return K||Ik[String(C.type)]||A1}function Dm(C){o("click",C)}function cE(C){var B;(B=C.target)!=null&&B.closest("[data-node-index]")&&o("mouseover",C)}function uE(C){var B;(B=C.target)!=null&&B.closest("[data-node-index]")&&o("mouseout",C)}function Hk(C){o("mouseover",C)}function Wk(C){o("mouseout",C)}const kl=Z(null),wi=Z(!1);let Hc,ha=null,Bm=0,Nd=0,Ld=0;const zk=["code_block","admonition","table","math_block","html_block","image","thematic_break"],dE=new Set(zk),Uk=[".typewriter-cursor",".height-estimation-probes",...zk.map(C=>`[data-node-type="${C}"]`),"script","style"].join(",");function qk(C){if(!C||typeof C!="object")return!1;const B=C.type;return typeof B=="string"&&dE.has(B)}function Od(C){var B,V;if(!C||typeof C!="object")return 0;const K=C,ee=(V=(B=K.raw)!=null?B:K.content)!=null?V:K.code;if(typeof ee=="string")return ee.length;const he=K.children;if(Array.isArray(he))return he.reduce((Se,Pe)=>Se+Od(Pe),0);const ke=K.items;return Array.isArray(ke)?ke.reduce((Se,Pe)=>Se+Od(Pe),0):0}function Pd(){Hc&&(clearTimeout(Hc),Hc=void 0)}function jk(){Bm+=1,ha!=null&&(Oe?.(ha),ha=null)}function Rd(){jk(),kl.value&&(kl.value.style.visibility="hidden")}function fE(C){var B;if(C.nodeType!==Node.TEXT_NODE||!((B=C.textContent)!=null?B:"").trim())return!1;const V=C.parentElement;return!!V&&!V.closest(Uk)}function pE(C){let B=C.lastChild;for(;B;){if(fE(B))return B;if(B.nodeType===Node.ELEMENT_NODE){const V=B;if(!V.matches(Uk)&&V.lastChild){B=V.lastChild;continue}}for(;B&&B!==C&&!B.previousSibling;)B=B.parentNode;if(!B||B===C)break;B=B.previousSibling}return null}function Fm(){if(!we||!wi.value||ha!=null)return;const C=Bm,B=()=>{ha=null,C===Bm&&(function(){var V,K;if(!(we&&wi.value&&S.value&&kl.value))return;const ee=S.value,he=kl.value;he.style.visibility="hidden";const ke=(function(){const De=Pm.value;for(let $e=De.length-1;$e>=0;$e--){const He=De[$e];if(!He||qk(He.node)||!Im(He.index))continue;const Qe=Os.get(He.index);if(!Qe)continue;const Ze=pE(Qe);if(Ze)return Ze}return null})();if(!ke)return;let Se=0,Pe=0,Ee=20,We=!1;if(ke?.textContent){const De=ke.textContent.length,$e=document.createRange();$e.setStart(ke,Math.max(0,De-1)),$e.setEnd(ke,De);const He=typeof $e.getClientRects=="function"?$e.getClientRects():void 0,Qe=(K=He?.[He.length-1])!=null?K:(V=ke.parentElement)==null?void 0:V.getBoundingClientRect();if(Qe){const Ze=mt("typewriterCursor.root.getBoundingClientRect",()=>ee.getBoundingClientRect());Se=Qe.right-Ze.left+ee.scrollLeft,Pe=Qe.top-Ze.top+ee.scrollTop,Ee=Qe.height||Ee,We=!0}$e.detach()}We&&(he.style.transform=`translate(${Math.max(0,Se)}px, ${Math.max(0,Pe)}px)`,he.style.height=`${Ee}px`,he.style.visibility="visible")})()};pe?ha=pe(B):B()}return Ke([ue,()=>s.content,()=>s.nodes,()=>k.typewriter,j],()=>zn(null,null,function*(){var C,B;if(!we||ze.value||!U.value)return;if(j.value)return wi.value=!1,Pd(),void Rd();if((C=s.nodes)!=null&&C.length)return wi.value=!1,Pd(),Rd(),Nd=((B=s.content)!=null?B:"").length,void(Ld=ue.value.length);const V=(function(){var Se,Pe;return(Se=s.nodes)!=null&&Se.length?s.nodes.reduce((Ee,We)=>Ee+Od(We),0):((Pe=s.content)!=null?Pe:"").length})(),K=(function(){var Se;return(Se=s.nodes)!=null&&Se.length?s.nodes.reduce((Pe,Ee)=>Pe+Od(Ee),0):ue.value.length})(),ee=!qk(st.value[st.value.length-1]),he=V>Nd,ke=K>Ld;if(k.typewriter===!1||!ee||!he&&!ke)return k.typewriter!==!1&&ee||(wi.value=!1,Rd()),Nd=V,void(Ld=K);Nd=V,Ld=K,wi.value=!0,kl.value&&(kl.value.style.visibility="hidden"),Pd(),yield ht(),Fm(),Hc=setTimeout(()=>{Hc=void 0,wi.value=!1},3e3)}),{flush:"post",immediate:!0}),Ke(wi,C=>zn(null,null,function*(){C?(yield ht(),Fm()):Rd()}),{flush:"post"}),Ke([()=>_s.value,()=>xs.start,()=>xs.end],()=>zn(null,null,function*(){we&&!ze.value&&U.value&&wi.value&&(yield ht(),Fm())}),{flush:"post"}),ls(()=>{Pd(),jk(),Rn.clear()}),(C,B)=>{const V=HI("NodeRenderer",!0);return x(ze)?(w(!0),N(Le,{key:0},nt(Pm.value,K=>(w(),N(Le,{key:K.index},[K.rendersCustomNode?(w(),ve(Hs(K.component),dn({key:0,ref_for:!0},K.customBindings,{node:K.node,loading:K.node.loading,"index-key":K.indexKey,"custom-id":k.customId,"is-dark":k.isDark,onClick:Dm,onMouseover:Hk,onMouseout:Wk,onCopy:B[0]||(B[0]=ee=>o("copy",ee)),onHandleArtifactClick:B[1]||(B[1]=ee=>o("handleArtifactClick",ee))}),{default:_e(()=>[K.hasSlotChildren?(w(),ve(V,dn({key:0,ref_for:!0},In.value,{nodes:K.node.children,"index-key":K.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):K.slotContent?(w(),ve(V,dn({key:1,ref_for:!0},In.value,{content:K.slotContent,final:!K.node.loading,"index-key":`${K.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Hs(K.component),dn({key:1,node:K.node,loading:K.node.loading,"index-key":K.indexKey},{ref_for:!0},K.bindings,{"custom-id":k.customId,"is-dark":k.isDark,onClick:Dm,onMouseover:Hk,onMouseout:Wk,onCopy:B[2]||(B[2]=ee=>o("copy",ee)),onHandleArtifactClick:B[3]||(B[3]=ee=>o("handleArtifactClick",ee))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(w(),N("div",{key:1,ref_key:"containerRef",ref:S,class:Re(["markstream-vue markdown-renderer",[{dark:k.isDark},{virtualized:Nt.value},{"virtual-scroll-coordinated":us.value}]]),"data-custom-id":k.customId,onClick:Dm,onMouseover:cE,onMouseout:uE},[oi.value||Nt.value?(w(),N(Le,{key:0},[oi.value?(w(),N("div",{key:0,class:"height-estimation-probes",style:Gt({width:`${qs.value}px`}),"aria-hidden":"true"},[T("div",{ref_key:"paragraphProbeWrapperRef",ref:I,class:"node-content","data-probe":"paragraph"},[oe(x(ql),{node:$n.value,"index-key":"probe-paragraph"},null,8,["node"])],512),T("div",{ref_key:"listItemProbeWrapperRef",ref:P,class:"node-content","data-probe":"list-item"},[T("ul",BV,[oe(x(tc),{node:Ge.value,"index-key":"probe-list-item"},null,8,["node"])])],512),T("div",{ref_key:"listProbeWrapperRef",ref:D,class:"node-content","data-probe":"list"},[oe(x(nc),{node:Ye.value,"index-key":"probe-list"},null,8,["node"])],512),(w(),N(Le,null,nt(6,K=>T("div",{key:`probe-heading-${K}`,ref_for:!0,ref:ee=>(function(he,ke){he<1||he>6||(W[he]=ke)})(K,ee),class:"node-content","data-probe":`heading-${K}`},[oe(x(Rp),{node:L4(K),"index-key":`probe-heading-${K}`},null,8,["node","index-key"])],8,FV)),64))],4)):ie("",!0),Nt.value?(w(),N("div",{key:1,class:"node-spacer",style:Gt({height:`${nm.value}px`}),"aria-hidden":"true"},null,4)):ie("",!0)],64)):ie("",!0),(w(!0),N(Le,null,nt(Pm.value,K=>(w(),N("div",{key:K.index,ref_for:!0,ref:ee=>Tk(K.index,ee),class:"node-slot","data-node-index":K.index,"data-node-type":K.node.type},[Im(K.index)?(w(),N("div",{key:0,ref_for:!0,ref:ee=>(function(he,ke){var Se;ke||(function(De){const $e=`${om()}-${De}`;let He=!1;for(const Qe of Array.from(_o.keys())){const Ze=bi.get(Qe);(Ze?.index===De||Qe===$e||Qe.startsWith(`${$e}-`))&&(_o.delete(Qe),bi.delete(Qe),He=!0)}He&&(oa(),An("async-node"))})(he),Li.delete(he),(function(De){var $e;const He=(($e=dl.get(De))!=null?$e:0)+1;dl.set(De,He)})(he);const Pe=ur.get(he);if(Pe){for(const De of Pe)_d(De);ur.delete(he)}if((function(De){const $e=ft.get(De);$e&&(Ne?.unobserve($e),me.delete($e),ft.delete(De))})(he),!ke||!Xe.value)return ki.delete(he),void dl.delete(he);ki.set(he,ke);const Ee=()=>{Id(he,ke)};queueMicrotask(Ee);const We=(Ne||typeof ResizeObserver>"u"||(Ne=new ResizeObserver(De=>{if(De.length)for(const $e of De){const He=me.get($e.target),Qe=ft.get(He??-1);He!=null&&Qe&&Id(He,Qe)}else Pi()})),Ne);if(We&&(ft.set(he,ke),me.set(ke,he),We.observe(ke)),typeof window<"u"){const De=((Se=st.value[he])==null?void 0:Se.type)==="code_block"?[16,80,240,800]:j.value?[80]:[];if(De.length){const $e=De.map(He=>Yy(He,Ee,"node-resize")).filter(He=>He!=null);$e.length&&ur.set(he,$e)}}})(K.index,ee),class:"node-content"},[K.isCodeBlock?K.rendersCustomNode?(w(),ve(Hs(K.component),dn({key:1,ref_for:!0},K.customBindings,{node:K.node,loading:K.node.loading,"index-key":K.indexKey,"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[8]||(B[8]=ee=>o("copy",ee)),onHandleArtifactClick:B[9]||(B[9]=ee=>o("handleArtifactClick",ee))}),{default:_e(()=>[K.hasSlotChildren?(w(),ve(V,dn({key:0,ref_for:!0},In.value,{nodes:K.node.children,"index-key":K.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):K.slotContent?(w(),ve(V,dn({key:1,ref_for:!0},In.value,{content:K.slotContent,final:!K.node.loading,"index-key":`${K.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Hs(K.component),dn({key:2,node:K.node,loading:K.node.loading,"index-key":K.indexKey},{ref_for:!0},K.bindings,{"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[10]||(B[10]=ee=>o("copy",ee)),onHandleArtifactClick:B[11]||(B[11]=ee=>o("handleArtifactClick",ee))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Gr,{key:0,name:"fade",css:k.fade!==!1,appear:k.fade!==!1},{default:_e(()=>[K.rendersCustomNode?(w(),ve(Hs(K.component),dn({key:0,ref_for:!0},K.customBindings,{node:K.node,loading:K.node.loading,"index-key":K.indexKey,"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[4]||(B[4]=ee=>o("copy",ee)),onHandleArtifactClick:B[5]||(B[5]=ee=>o("handleArtifactClick",ee))}),{default:_e(()=>[K.hasSlotChildren?(w(),ve(V,dn({key:0,ref_for:!0},In.value,{nodes:K.node.children,"index-key":K.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):K.slotContent?(w(),ve(V,dn({key:1,ref_for:!0},In.value,{content:K.slotContent,final:!K.node.loading,"index-key":`${K.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ie("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(w(),ve(Hs(K.component),dn({key:1,node:K.node,loading:K.node.loading,"index-key":K.indexKey},{ref_for:!0},K.bindings,{"custom-id":k.customId,"is-dark":k.isDark,onCopy:B[6]||(B[6]=ee=>o("copy",ee)),onHandleArtifactClick:B[7]||(B[7]=ee=>o("handleArtifactClick",ee))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(w(),N("div",{key:1,class:"node-placeholder",style:Gt({height:`${Cd(K.index)}px`})},null,4))],8,HV))),128)),wi.value?(w(),N("span",{key:1,ref_key:"typewriterCursorRef",ref:kl,class:"typewriter-cursor","aria-hidden":"true"},null,512)):ie("",!0),Nt.value?(w(),N("div",{key:2,class:"node-spacer",style:Gt({height:`${sm.value}px`}),"aria-hidden":"true"},null,4)):ie("",!0)],42,DV))}}})),[["__scopeId","data-v-2e8e6e17"]]),yo=u3;yo.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",yo.__name,yo.name].filter(n=>!!n));for(const n of t)e.component(n,u3)};const my=Object.freeze(Object.defineProperty({__proto__:null,default:yo},Symbol.toStringTag,{value:"Module"})),WV={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},zV={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},UV={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},qV={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},jV={class:"admonition-title"},VV=["aria-expanded","aria-controls"],KV=["id"],Hf=un(je({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const s=e,o=t,i=F(()=>{if(s.node.title&&s.node.title.trim().length)return s.node.title;const c=s.node.kind||"note";return c.charAt(0).toUpperCase()+c.slice(1)}),r=Z(!!s.node.collapsible&&!((n=s.node.open)==null||n));function l(){s.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(c,u)=>(w(),N("div",{class:Re(["admonition",[`admonition-${s.node.kind}`]])},[T("div",{id:a,class:"admonition-legend"},[s.node.kind==="note"||s.node.kind==="info"?(w(),N("svg",WV,[...u[1]||(u[1]=[T("circle",{cx:"12",cy:"12",r:"10"},null,-1),T("path",{d:"M12 16v-4"},null,-1),T("path",{d:"M12 8h.01"},null,-1)])])):s.node.kind==="tip"?(w(),N("svg",zV,[...u[2]||(u[2]=[T("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),T("path",{d:"M9 18h6"},null,-1),T("path",{d:"M10 22h4"},null,-1)])])):s.node.kind==="warning"||s.node.kind==="caution"?(w(),N("svg",UV,[...u[3]||(u[3]=[T("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"},null,-1),T("path",{d:"M12 9v4"},null,-1),T("path",{d:"M12 17h.01"},null,-1)])])):s.node.kind==="danger"||s.node.kind==="error"?(w(),N("svg",qV,[...u[4]||(u[4]=[T("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),T("path",{d:"M12 8v4"},null,-1),T("path",{d:"M12 16h.01"},null,-1)])])):ie("",!0),T("span",jV,R(i.value),1),s.node.collapsible?(w(),N("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(w(),N("svg",{style:Gt({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...u[5]||(u[5]=[T("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,VV)):ie("",!0)]),Mn(T("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[oe(x(yo),{"index-key":`admonition-${e.indexKey}`,nodes:s.node.children,"custom-id":s.customId,typewriter:s.typewriter,fade:s.fade,onCopy:u[0]||(u[0]=d=>o("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,KV),[[Qo,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);Hf.install=e=>{e.component(Hf.__name,Hf)};const d3=()=>Xs(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let hf=null,GV=d3;function _he(){return zn(this,null,function*(){if(hf)return hf;const e=GV;if(!e)return null;let t;try{t=yield e()}catch(n){throw e===d3?new Error('Optional dependency "@terrastruct/d2" is not installed. Please install it to enable D2 diagrams.'):n}return t?(hf=(function(n){var s;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const o=(s=n.default)!=null?s:n;return typeof o=="function"?o:o?.D2&&typeof o.D2=="function"?o.D2:o})(t),hf):null})}function whe(){return!1}function She(){return zn(this,null,function*(){return null})}const mf=Z(!1);let TS=!1;function Kg(){const e=document.documentElement.dataset.colorScheme;return e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function YV(){return!TS&&typeof window<"u"&&typeof document<"u"&&(TS=!0,mf.value=Kg(),new MutationObserver(()=>{mf.value=Kg()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{mf.value=Kg()})),mf}const f3=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],XV=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),$1=[...f3].sort((e,t)=>t.length-e.length).join("|"),Gg=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${$1}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${$1})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),p3=/[),.;!?,。;!?)]+$/;function QV(e){const t=e.toLowerCase();return f3.some(n=>t.endsWith(`.${n}`))}function ZV(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${$1}))["']`,"gi");let s;for(;(s=n.exec(e))!==null;){const o=s[1];if(!o)continue;const i=o.split("/").pop();i&&t.set(i,o)}return t}function JV(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const s=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!s)return null;let o=(s[1]??"").replace(p3,"");if(!o)return null;const i=o.split("/").pop()??o,r=o.includes("/"),l=XV.has(i),a=QV(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;o=d}const c=s[2]??s[3],u=c?Number(c):void 0;return{path:o,line:u!==void 0&&Number.isFinite(u)&&u>0?u:void 0}}function eK(e,t={}){const n=[];Gg.lastIndex=0;let s;for(;(s=Gg.exec(e))!==null;){const o=s[0]??"",i=s[1]??"",r=o.indexOf(i);if(r<0)continue;const l=s[2]??s[3];let a=i+(l?o.slice(r+i.length):"");const c=a.replace(p3,""),u=a.length-c.length;a=c;const d=JV(a,t);if(!d)continue;const p=s.index+r,h=p+a.length;n.push({...d,start:p,end:h,text:a}),u>0&&(Gg.lastIndex-=u)}return n}const tK=12e4,nK=6e4,sK=32,oK=3e4,MS=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function iK(e){let t=0,n=0,s=0;MS.lastIndex=0;let o;for(;(o=MS.exec(e))!==null;){const r=o[3]??"";t+=1,n+=r.length,s=Math.max(s,r.length)}return{codeRenderer:e.length>=tK||n>=nK||t>=sK||s>=oK?"pre":"shiki",codeFenceCount:t,codeChars:n}}function rK(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function lK(e){return new Worker("/assets/mermaidParser.worker-PTFfzpoB.js",{type:"module",name:e?.name})}const aK={key:1,class:"diff-wrap"},cK={class:"diff-bar"},uK=["onClick"],dK={class:"diff-pre"},fK="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",ES="github-light",IS="github-dark",pK=je({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){qU(),sq(),VU(),aq(),jU(new rK),lq(new lK);function t(P){return P.inline.ruler.disable("math"),P}const{t:n}=It(),s=Ut("resolveImage"),o=Z(null),i=e,r=F(()=>!i.streaming),l=F(()=>ZV(i.text??"")),a=F(()=>i.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:iK(i.text??"")),c=YV(),u=F(()=>!i.streaming),d=$s(new Map),p=new Set,h=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,f=/(<img\b[^>]*?\bsrc=")([^"]+)(")/gi;function m(P){return!/^(https?:|data:|blob:)/i.test(P)}function b(P){if(!s)return;const D=[];for(const W of[h,f]){W.lastIndex=0;let z;for(;(z=W.exec(P))!==null;)D.push(z[2]??"")}for(const W of D)!W||!m(W)||d.has(W)||p.has(W)||(p.add(W),s(W).then(z=>{d.set(W,z!==W?z:"")}).catch(()=>{d.set(W,"")}).finally(()=>{p.delete(W)}))}function _(P){if(!s)return P;const D=W=>{if(!m(W))return null;const z=d.get(W);return z===void 0?fK:z===""?null:z};return P.replace(h,(W,z,q,Q)=>{const X=D(q);return X===null?W:`${z}${X}${Q}`}).replace(f,(W,z,q,Q)=>{const X=D(q);return X===null?W:`${z}${X}${Q}`})}Ke(()=>i.text,P=>b(P??""),{immediate:!0});function g(){if(!o.value||!i.openFile||i.streaming)return;const P=document.createTreeWalker(o.value,NodeFilter.SHOW_TEXT),D=[];let W=P.nextNode();for(;W;){const z=W,q=z.parentElement;q&&!q.closest("a, pre, .md-file-link, svg")&&z.data.trim().length>0&&D.push(z),W=P.nextNode()}for(const z of D){const q=eK(z.data,{aliases:l.value});if(q.length===0||!z.parentNode)continue;const Q=document.createDocumentFragment();let X=0;for(const fe of q){fe.start>X&&Q.append(document.createTextNode(z.data.slice(X,fe.start)));const ye=document.createElement("button");ye.type="button",ye.className="md-file-link",ye.textContent=fe.text,ye.title=fe.line?`${fe.path}:${fe.line}`:fe.path,ye.addEventListener("click",Me=>{Me.preventDefault(),Me.stopPropagation(),i.openFile?.({path:fe.path,line:fe.line})}),Q.append(ye),X=fe.end}X<z.data.length&&Q.append(document.createTextNode(z.data.slice(X))),z.parentNode.replaceChild(Q,z)}}function v(P){return!(!P||/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(P))}function y(P){let D=P.length;for(const W of["#","?"]){const z=P.indexOf(W);z!==-1&&z<D&&(D=z)}return P.slice(0,D)}function A(){if(!o.value||!i.openFile||i.streaming)return;const P=o.value.querySelectorAll("a[href]");for(const D of P){if(D.dataset.mdLinkHandled==="true"||D.closest("svg"))continue;const W=D.getAttribute("href")??"";v(W)&&(D.dataset.mdLinkHandled="true",D.addEventListener("click",z=>{z.preventDefault(),z.stopPropagation(),i.openFile?.({path:y(W)})}))}}function O(){ht().then(()=>{g(),A()})}Ke(()=>i.text,O),Ke(()=>i.streaming,O);let $=null;hn(()=>{O(),o.value&&($=new MutationObserver(O),$.observe(o.value,{childList:!0,subtree:!0}))}),kn(()=>{$?.disconnect()});const k={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1},E=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,M=F(()=>{const P=_(i.text??""),D=[];let W=0;E.lastIndex=0;let z;for(;(z=E.exec(P))!==null;){const Q=z[1]??"",X=P.slice(W,z.index)+(Q||"");X.trim()&&D.push({kind:"md",text:X}),D.push({kind:"diff",code:z[2]??""}),W=E.lastIndex}const q=P.slice(W);return(q.trim()||D.length===0)&&D.push({kind:"md",text:q}),D});function L(P){return P.split(`
|
|
246
|
+
`).map(D=>/^\+(?!\+\+)/.test(D)?{cls:"diff-add",text:D}:/^-(?!--)/.test(D)?{cls:"diff-del",text:D}:D.startsWith("@@")?{cls:"diff-hunk",text:D}:{cls:"diff-ctx",text:D})}const S=Z(null);function I(P,D){zs(P).then(W=>{W&&(S.value=D,setTimeout(()=>{S.value=null},1400))})}return(P,D)=>(w(),N("div",{ref_key:"mdRef",ref:o,class:"md"},[(w(!0),N(Le,null,nt(M.value,(W,z)=>(w(),N(Le,{key:z},[W.kind==="md"?(w(),ve(x(yo),{key:0,content:W.text,"custom-markdown-it":t,mode:"chat","code-renderer":a.value.codeRenderer,"is-dark":x(c),"code-block-light-theme":ES,"code-block-dark-theme":IS,themes:[ES,IS],"code-block-props":k,final:r.value,"smooth-streaming":e.streaming,"batch-rendering":u.value,"defer-nodes-until-visible":!1},null,8,["content","code-renderer","is-dark","themes","final","smooth-streaming","batch-rendering"])):(w(),N("div",aK,[T("div",cK,[D[0]||(D[0]=T("span",{class:"diff-lang"},"diff",-1)),oe(Ht,{text:x(n)("filePreview.copyCode")},{default:_e(()=>[T("button",{class:"diff-copy",onClick:q=>I(W.code,z)},R(S.value===z?"✓":"⧉"),9,uK)]),_:2},1032,["text"])]),T("pre",dK,[T("code",null,[(w(!0),N(Le,null,nt(L(W.code),(q,Q)=>(w(),N("span",{key:Q,class:Re(q.cls)},R(q.text),3))),128))])])]))],64))),128))],512))}}),Oh=ut(pK,[["__scopeId","data-v-f8fa117a"]]),hK={class:"tc-anim"},mK={class:"prev-anim"},gK={class:"prev"},vK=je({__name:"ThinkingBlock",props:{text:{},mobile:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1},foldable:{type:Boolean,default:!0}},emits:["open"],setup(e,{emit:t}){const n=e,s=t,o=F(()=>n.text.split(/\n{2,}/).filter(c=>c.trim().length>0)),i=F(()=>n.foldable&&o.value.length>1),r=F(()=>n.streaming||!i.value),l=F(()=>o.value.pop()??""),a=Z(null);return hn(()=>{if(!n.streaming)return;const c=a.value;c&&(c.scrollTop=c.scrollHeight)}),Ke(()=>n.text,()=>{const c=a.value;!c||!(c.scrollHeight-c.scrollTop-c.clientHeight<24)||ht(()=>{a.value&&(a.value.scrollTop=a.value.scrollHeight)})},{immediate:!0}),(c,u)=>(w(),N("div",{class:Re(["think",{mob:e.mobile}])},[i.value?(w(),N("div",{key:0,class:Re(["tc-wrap",{"is-collapsed":!r.value}]),onClick:u[0]||(u[0]=d=>s("open"))},[T("div",hK,[T("pre",{ref_key:"bodyEl",ref:a,class:"tc"},R(e.text),513)]),T("div",mK,[T("span",gK,R(l.value),1)])],2)):(w(),N("pre",{key:1,ref_key:"bodyEl",ref:a,class:"tc"},R(e.text),513))],2))}}),yK=ut(vK,[["__scopeId","data-v-973bc9c4"]]),kK={class:"activity-notice",role:"status"},bK={"aria-hidden":"true"},_K={class:"an-label"},wK=je({__name:"ActivityNotice",props:{label:{}},setup(e){return(t,n)=>(w(),N("div",kK,[T("span",bK,[oe(ni,{size:"sm"})]),T("span",_K,R(e.label),1)]))}}),SK=ut(wK,[["__scopeId","data-v-da568ece"]]);function h3(e){return{inputTokens:e.input_tokens,outputTokens:e.output_tokens,cacheReadTokens:e.cache_read_tokens,cacheCreationTokens:e.cache_creation_tokens,totalCostUsd:e.total_cost_usd,contextTokens:e.context_tokens,contextLimit:e.context_limit,turnCount:e.turn_count}}function N1(e){switch(e){case"idle":return"idle";case"running":return"running";case"awaiting_approval":return"awaitingApproval";case"awaiting_question":return"awaitingQuestion";case"aborted":return"aborted"}}function CK(e){switch(e){case"idle":return"idle";case"running":return"running";case"awaitingApproval":return"awaiting_approval";case"awaitingQuestion":return"awaiting_question";case"aborted":return"aborted"}}function Ti(e){return{id:e.id,title:e.title,createdAt:e.created_at,updatedAt:e.updated_at,status:N1(e.status),archived:e.archived??!1,currentPromptId:e.current_prompt_id,lastPrompt:e.last_prompt,cwd:e.metadata.cwd,model:e.agent_config.model,usage:h3(e.usage),messageCount:e.message_count,lastSeq:e.last_seq,workspaceId:e.workspace_id,parentSessionId:typeof e.metadata.parent_session_id=="string"?e.metadata.parent_session_id:void 0}}function Su(e){return{id:e.id,root:e.root,name:e.name,isGitRepo:e.is_git_repo,branch:e.branch??void 0,lastOpenedAt:e.last_opened_at,sessionCount:e.session_count}}function $S(e){return e.kind==="base64"?{kind:"base64",mediaType:e.media_type,data:e.data}:e.kind==="file"?{kind:"file",fileId:e.file_id}:{kind:"url",url:e.url}}function gy(e){switch(e.type){case"text":return{type:"text",text:e.text};case"tool_use":return{type:"toolUse",toolCallId:e.tool_call_id,toolName:e.tool_name,input:e.input};case"tool_result":return{type:"toolResult",toolCallId:e.tool_call_id,output:e.output,isError:e.is_error};case"image":return{type:"image",source:$S(e.source)};case"video":return{type:"video",source:$S(e.source)};case"file":return{type:"file",fileId:e.file_id,name:e.name,mediaType:e.media_type,size:e.size};case"thinking":return{type:"thinking",thinking:e.thinking,signature:e.signature};default:return{type:"unknown",raw:e}}}function L1(e){return{id:e.id,sessionId:e.session_id,role:e.role,content:e.content.map(gy),createdAt:e.created_at,promptId:e.prompt_id,parentMessageId:e.parent_message_id,metadata:e.metadata}}function xK(e){switch(e.type){case"text":return{type:"text",text:e.text};case"toolUse":return{type:"tool_use",tool_call_id:e.toolCallId,tool_name:e.toolName,input:e.input};case"toolResult":return{type:"tool_result",tool_call_id:e.toolCallId,output:e.output,is_error:e.isError};case"image":case"video":{const t=e.source;let n;return t.kind==="base64"?n={kind:"base64",media_type:t.mediaType,data:t.data}:t.kind==="file"?n={kind:"file",file_id:t.fileId}:n={kind:"url",url:t.url},{type:e.type,source:n}}case"file":return{type:"file",file_id:e.fileId,name:e.name,media_type:e.mediaType,size:e.size};case"thinking":return{type:"thinking",thinking:e.thinking,signature:e.signature};case"unknown":return e.raw}}function AK(e){return{content:e.content.map(xK),metadata:e.metadata,agent_id:e.agentId,model:e.model,thinking:e.thinking,permission_mode:e.permissionMode,plan_mode:e.planMode,swarm_mode:e.swarmMode,goal_objective:e.goalObjective,goal_control:e.goalControl}}function TK(e){return{decision:e.decision,scope:e.scope,feedback:e.feedback,selected_label:e.selectedLabel}}function m3(e){return{approvalId:e.approval_id,sessionId:e.session_id,turnId:e.turn_id,toolCallId:e.tool_call_id,toolName:e.tool_name,action:e.action,display:e.tool_input_display??e.display,expiresAt:e.expires_at,createdAt:e.created_at}}function MK(e){return{id:e.id,label:e.label,description:e.description,recommended:e.recommended===!0||e.is_recommended===!0}}function EK(e){return{id:e.id,question:e.question,header:e.header,body:e.body,options:e.options.map(MK),multiSelect:e.multi_select,allowOther:e.allow_other,otherLabel:e.other_label,otherDescription:e.other_description}}function g3(e){return{questionId:e.question_id,sessionId:e.session_id,turnId:e.turn_id,toolCallId:e.tool_call_id,questions:e.questions.map(EK),createdAt:e.created_at}}function IK(e){switch(e.kind){case"single":return{kind:"single",option_id:e.optionId};case"multi":return{kind:"multi",option_ids:e.optionIds};case"other":return{kind:"other",text:e.text};case"multiWithOther":return{kind:"multi_with_other",option_ids:e.optionIds,other_text:e.otherText};case"skipped":return{kind:"skipped"}}}function $K(e){const t={};for(const[n,s]of Object.entries(e.answers))t[n]=IK(s);return{answers:t,method:e.method,note:e.note}}function O1(e){return{id:e.id,sessionId:e.session_id,kind:e.kind,description:e.description,status:e.status,command:e.command,createdAt:e.created_at,startedAt:e.started_at,completedAt:e.completed_at,outputPreview:e.output_preview,outputBytes:e.output_bytes,subagentPhase:e.subagent_phase,subagentType:e.subagent_type,parentToolCallId:e.parent_tool_call_id,suspendedReason:e.suspended_reason,swarmIndex:e.swarm_index,runInBackground:e.kind==="subagent"?!0:void 0}}function NS(e){return{path:e.path,name:e.name,kind:e.kind,size:e.size,modifiedAt:e.modified_at,etag:e.etag,mime:e.mime,languageId:e.language_id,isBinary:e.is_binary,isSymlinkTo:e.is_symlink_to,gitStatus:e.git_status,childCount:e.child_count}}function xr(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Ca(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Uo(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function NK(e){if(!e||typeof e!="object")return null;const t=e,n=xr(t,"status");if(n!=="active"&&n!=="paused"&&n!=="blocked"&&n!=="complete")return null;const s=t.budget,o=s&&typeof s=="object"?s:{};return{goalId:xr(t,"goalId")??xr(t,"goal_id")??"goal",objective:xr(t,"objective")??"",completionCriterion:xr(t,"completionCriterion")??xr(t,"completion_criterion"),status:n,turnsUsed:Ca(t,"turnsUsed")??Ca(t,"turns_used")??0,tokensUsed:Ca(t,"tokensUsed")??Ca(t,"tokens_used")??0,wallClockMs:Ca(t,"wallClockMs")??Ca(t,"wall_clock_ms")??0,terminalReason:xr(t,"terminalReason")??xr(t,"terminal_reason"),budget:{tokenBudget:Uo(o,"tokenBudget")??Uo(o,"token_budget"),remainingTokens:Uo(o,"remainingTokens")??Uo(o,"remaining_tokens"),turnBudget:Uo(o,"turnBudget")??Uo(o,"turn_budget"),remainingTurns:Uo(o,"remainingTurns")??Uo(o,"remaining_turns"),wallClockBudgetMs:Uo(o,"wallClockBudgetMs")??Uo(o,"wall_clock_budget_ms"),remainingWallClockMs:Uo(o,"remainingWallClockMs")??Uo(o,"remaining_wall_clock_ms"),overBudget:o.overBudget===!0||o.over_budget===!0}}}function LK(e){const t=e;switch(e.type){case"event.session.created":return{type:"sessionCreated",session:Ti(t.payload.session)};case"event.session.updated":return{type:"sessionUpdated",session:Ti(t.payload.session),changedFields:t.payload.changed_fields};case"event.session.deleted":return{type:"sessionDeleted",sessionId:t.session_id};case"event.workspace.created":return{type:"workspaceCreated",workspace:Su(t.payload.workspace)};case"event.workspace.updated":return{type:"workspaceUpdated",workspace:Su(t.payload.workspace)};case"event.workspace.deleted":return{type:"workspaceDeleted",workspaceId:t.payload.workspace_id,root:t.payload.root};case"event.session.status_changed":return{type:"sessionStatusChanged",sessionId:t.session_id,status:N1(t.payload.status),previousStatus:N1(t.payload.previous_status),currentPromptId:t.payload.current_prompt_id};case"event.session.usage_updated":return{type:"sessionUsageUpdated",sessionId:t.session_id,usage:h3(t.payload.usage)};case"event.session.history_compacted":return{type:"historyCompacted",sessionId:t.session_id,beforeSeq:t.payload.before_seq,reason:t.payload.reason,summaryMessageId:t.payload.summary_message_id};case"event.goal.updated":{const n=NK(t.payload.snapshot??null);return{type:"goalUpdated",sessionId:t.session_id,goal:n?.status==="complete"?null:n}}case"event.message.created":return{type:"messageCreated",message:L1(t.payload.message)};case"event.message.updated":return{type:"messageUpdated",sessionId:t.session_id,messageId:t.payload.message_id,content:t.payload.content.map(gy),status:t.payload.status};case"event.assistant.delta":return{type:"assistantDelta",sessionId:t.session_id,messageId:t.payload.message_id,contentIndex:t.payload.content_index,delta:t.payload.delta};case"event.assistant.tool_use_started":case"event.assistant.tool_use_delta":case"event.assistant.tool_use_completed":case"event.assistant.completed":case"event.tool.started":return{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.tool.output":return{type:"toolOutput",sessionId:t.session_id,toolCallId:t.payload.tool_call_id,outputChunk:t.payload.chunk,stream:t.payload.stream};case"event.tool.progress":return typeof t.payload.message=="string"&&t.payload.message.length>0?{type:"toolOutput",sessionId:t.session_id,toolCallId:t.payload.tool_call_id,outputChunk:t.payload.message,stream:"stdout"}:{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.tool.completed":return{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.approval.requested":return{type:"approvalRequested",sessionId:t.session_id,approval:m3(t.payload)};case"event.approval.resolved":return{type:"approvalResolved",sessionId:t.session_id,approvalId:t.payload.approval_id,decision:t.payload.decision,resolvedAt:t.payload.resolved_at};case"event.approval.expired":return{type:"approvalExpired",sessionId:t.session_id,approvalId:t.payload.approval_id};case"event.question.requested":return{type:"questionRequested",sessionId:t.session_id,question:g3(t.payload)};case"event.question.answered":return{type:"questionAnswered",sessionId:t.session_id,questionId:t.payload.question_id,resolvedAt:t.payload.resolved_at};case"event.question.dismissed":return{type:"questionDismissed",sessionId:t.session_id,questionId:t.payload.question_id,dismissedAt:t.payload.dismissed_at};case"event.task.created":return{type:"taskCreated",sessionId:t.session_id,task:O1(t.payload.task)};case"event.task.progress":return{type:"taskProgress",sessionId:t.session_id,taskId:t.payload.task_id,outputChunk:t.payload.output_chunk,stream:t.payload.stream};case"event.task.completed":return{type:"taskCompleted",sessionId:t.session_id,taskId:t.payload.task_id,status:t.payload.status,outputPreview:t.payload.output_preview,outputBytes:t.payload.output_bytes};case"event.config.changed":return{type:"configChanged",changedFields:t.payload.changed_fields,config:P1(t.payload.config)};case"event.model_catalog.changed":return{type:"modelCatalogChanged",changed:t.payload.changed.map(n=>({providerId:n.provider_id,providerName:n.provider_name,added:n.added,removed:n.removed})),unchanged:t.payload.unchanged,failed:t.payload.failed};default:return{type:"unknown",raw:e}}}function OK(e){return{id:e.model,provider:e.provider,model:e.model,displayName:e.display_name,maxContextSize:e.max_context_size,capabilities:e.capabilities,supportEfforts:e.support_efforts,defaultEffort:e.default_effort}}function LS(e){return{id:e.id,type:e.type,baseUrl:e.base_url,defaultModel:e.default_model,hasApiKey:e.has_api_key,status:e.status,models:e.models}}function P1(e){const t={};for(const[n,s]of Object.entries(e.providers))t[n]={type:s.type,baseUrl:s.base_url,defaultModel:s.default_model,hasApiKey:s.has_api_key};return{providers:t,defaultProvider:e.default_provider,defaultModel:e.default_model,models:e.models,thinking:e.thinking,planMode:e.plan_mode,yolo:e.yolo,defaultPermissionMode:e.default_permission_mode,defaultPlanMode:e.default_plan_mode,permission:e.permission,hooks:e.hooks,services:e.services,mergeAllAvailableSkills:e.merge_all_available_skills,extraSkillDirs:e.extra_skill_dirs,loopControl:e.loop_control,background:e.background,experimental:e.experimental,telemetry:e.telemetry,raw:e.raw}}function PK(e){return e.session_id}function RK(e){return e.seq}const DK="main",BK=new Set(["turn.started","turn.step.started","turn.step.completed","turn.step.retrying","turn.step.interrupted","turn.ended","thinking.delta","assistant.delta","tool.use","tool.call.started","tool.call.delta","tool.progress","tool.result","agent.status.updated","prompt.completed"]);function Lr(e="msg_"){const t=Date.now().toString(36).padStart(10,"0"),n=Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${e}${t}${n}`}function FK(e){if(!e||typeof e!="object")return{input:0,output:0,cacheRead:0,cacheCreate:0};const t=e;return{input:t.inputOther??t.input_tokens??0,output:t.output??t.output_tokens??0,cacheRead:t.inputCacheRead??t.cache_read_input_tokens??0,cacheCreate:t.inputCacheCreation??t.cache_creation_input_tokens??0}}function OS(){return{turnPromptId:new Map,currentPromptId:void 0,currentAssistantMsgId:void 0,turnTextLen:0,turnThinkLen:0,toolStartTimes:new Map,totalInput:0,totalOutput:0,totalCacheRead:0,totalCacheCreate:0,contextTokens:0,contextLimit:0,turnCount:0,model:"",messages:[],subagentMeta:new Map}}function co(e,t){const n=e[t];return typeof n=="string"?n:void 0}function El(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function qo(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function HK(e){if(!e||typeof e!="object")return null;const t=e,n=t.budget,s=n&&typeof n=="object"?n:{},o=co(t,"status");if(o!=="active"&&o!=="paused"&&o!=="blocked"&&o!=="complete")return null;const i=co(t,"goalId")??co(t,"goal_id")??"goal",r=co(t,"objective")??"";return{goalId:i,objective:r,completionCriterion:co(t,"completionCriterion")??co(t,"completion_criterion"),status:o,turnsUsed:El(t,"turnsUsed")??El(t,"turns_used")??0,tokensUsed:El(t,"tokensUsed")??El(t,"tokens_used")??0,wallClockMs:El(t,"wallClockMs")??El(t,"wall_clock_ms")??0,terminalReason:co(t,"terminalReason")??co(t,"terminal_reason"),budget:{tokenBudget:qo(s,"tokenBudget")??qo(s,"token_budget"),remainingTokens:qo(s,"remainingTokens")??qo(s,"remaining_tokens"),turnBudget:qo(s,"turnBudget")??qo(s,"turn_budget"),remainingTurns:qo(s,"remainingTurns")??qo(s,"remaining_turns"),wallClockBudgetMs:qo(s,"wallClockBudgetMs")??qo(s,"wall_clock_budget_ms"),remainingWallClockMs:qo(s,"remainingWallClockMs")??qo(s,"remaining_wall_clock_ms"),overBudget:s.overBudget===!0||s.over_budget===!0}}}function Wa(e,t,n,s){if(typeof n!="string"||n.length===0)return null;const i={...e.subagentMeta.get(n)??{id:n,sessionId:t,kind:"subagent",description:"Sub Agent",status:"running",createdAt:new Date().toISOString(),subagentPhase:"queued"},...s,id:n,sessionId:t,kind:"subagent"};return e.subagentMeta.set(n,i),i}function WK(e,t){if(e==="turn.step.started")return null;if(e==="tool.use"||e==="tool.call.started"){const n=co(t,"name")??co(t,"toolName")??"tool",s=id(zK(n)),o=UK(n,t.args??t.input);return o?`Calling ${s}: ${o}`:`Calling ${s}`}if(e==="tool.progress"){const n=t.update;if(n&&typeof n=="object"){const o=co(n,"text");if(o)return Yg(o);const i=co(n,"message");if(i)return Yg(i)}const s=co(t,"message");if(s)return Yg(s)}return null}function zK(e){return e.replace(/_\d+$/,"")}const PS=2e3;function Yg(e){return e.length>PS?`${e.slice(0,PS)}…`:e}function UK(e,t){if(t==null)return"";const n=typeof t=="string"?t:JSON.stringify(t);return Bu(e,n)}function qK(e,t,n,s,o,i){if(i.has(n)&&s==="turn.step.started")return[];if(s==="assistant.delta"){const u=co(o,"delta");if(!u)return[];const d=e.subagentMeta.get(n),p=Wa(e,t,n,{status:"running",subagentPhase:"working",startedAt:d?.startedAt??new Date().toISOString()}),h=[];return p&&h.push({type:"taskCreated",sessionId:t,task:p}),h.push({type:"taskProgress",sessionId:t,taskId:n,outputChunk:u,stream:"stdout",kind:"text"}),h}const r=WK(s,o);if(r===null||r.length===0)return[];const l=e.subagentMeta.get(n),a=Wa(e,t,n,{status:"running",subagentPhase:"working",startedAt:l?.startedAt??new Date().toISOString()}),c=[];return a&&c.push({type:"taskCreated",sessionId:t,task:a}),c.push({type:"taskProgress",sessionId:t,taskId:n,outputChunk:r,stream:"stdout"}),c}function gf(e){return{...e,content:e.content.map(t=>({...t}))}}function RS(e,t,n){const s={id:Lr("msg_"),sessionId:t,role:"assistant",content:[],createdAt:new Date().toISOString(),promptId:n};return e.messages.push(s),s}function jK(e,t,n,s,o,i){const r={id:s,sessionId:t,role:"user",content:o,createdAt:i,promptId:n};return e.messages.push(r),r}function VK(e){return Array.isArray(e)?e.map(t=>gy(t)):[]}function DS(e,t,n,s){const o=e.messages.find(r=>r.id===t);if(!o)return-1;const i=o.content.at(-1);return i&&i.type===n?(n==="text"?i.text+=s:i.thinking+=s,o.content.length-1):(o.content.push(n==="text"?{type:"text",text:s}:{type:"thinking",thinking:s}),o.content.length-1)}function KK(e,t,n,s,o,i){const r=e.messages.find(l=>l.id===t);r&&r.content.push({type:"toolUse",toolCallId:n,toolName:s,input:o,outputLines:i})}function GK(e){const t=e.update,n=t&&typeof t=="object"?t:null,o=(n?.stream??n?.kind??e.stream)==="stderr"?"stderr":"stdout",i=typeof n?.text=="string"&&n.text||typeof n?.message=="string"&&n.message||typeof e.chunk=="string"&&e.chunk||typeof e.output=="string"&&e.output||typeof e.message=="string"&&e.message||"";return i.length>0?{outputChunk:i,stream:o}:null}function BS(e,t){e.messages.find(n=>n.id===t)}function YK(e,t,n,s,o,i){const r={id:Lr("msg_"),sessionId:t,role:"tool",content:[{type:"toolResult",toolCallId:n,output:s,isError:o}],createdAt:new Date().toISOString(),promptId:i};return e.messages.push(r),r}function Xg(e,t){return e.messages.find(n=>n.id===t)}function FS(e){return{inputTokens:e.totalInput,outputTokens:e.totalOutput,cacheReadTokens:e.totalCacheRead,cacheCreationTokens:e.totalCacheCreate,totalCostUsd:0,contextTokens:e.contextTokens,contextLimit:e.contextLimit,turnCount:e.turnCount}}function XK(){const e=new Map,t=new Set;function n(u){let d=e.get(u);return d||(d=OS(),e.set(u,d)),d}function s(u){e.set(u,OS())}function o(u){t.add(u)}function i(u,d){const p=n(u);p.currentPromptId=d}function r(u,d){s(u);const p=n(u),h=d.promptId??Lr("pr_");p.currentPromptId=h,p.turnPromptId.set(d.turnId,h);const f=RS(p,u,h);d.thinkingText.length>0&&f.content.push({type:"thinking",thinking:d.thinkingText}),d.assistantText.length>0&&f.content.push({type:"text",text:d.assistantText});for(const m of d.runningTools){const b=typeof m.lastProgress?.text=="string"&&m.lastProgress.text.length>0?[m.lastProgress.text]:void 0;f.content.push({type:"toolUse",toolCallId:m.toolCallId,toolName:m.name,input:m.args??{},outputLines:b}),p.toolStartTimes.set(m.toolCallId,Date.now())}return p.currentAssistantMsgId=f.id,p.turnTextLen=d.assistantText.length,p.turnThinkLen=d.thinkingText.length,[{type:"sessionStatusChanged",sessionId:u,status:"running",previousStatus:"idle",currentPromptId:h},{type:"messageCreated",message:gf(f)}]}function l(u,d,p,h){try{return c(u,d,p,h)}catch(f){return console.error("[agentProjector] Error projecting event:",u,f instanceof Error?f.message:f),[]}}function a(u,d){return d===void 0?"append":d<u?"skip":d>u?"gap":"append"}function c(u,d,p,h){const f=n(p),m=d,b=[],_=m?.agentId;if(typeof _=="string"&&_!==DK){const g=t.has(_);if(g&&(u==="thinking.delta"||u==="assistant.delta")){const v=m?.delta??"";return v?[{type:"agentDelta",sessionId:p,agentId:_,delta:{[u==="thinking.delta"?"thinking":"text"]:v}}]:[]}if(g&&u==="turn.ended")return[{type:"agentTurnEnded",sessionId:p,agentId:_,reason:m?.reason}];if(BK.has(u))return qK(f,p,_,u,m??{},t)}switch(u){case"session.meta.updated":{const g=m?.patch?.title??m?.title,v=m?.patch?.lastPrompt,y={};typeof g=="string"&&g.length>0&&(y.title=g),typeof v=="string"&&(y.lastPrompt=v),(y.title!==void 0||y.lastPrompt!==void 0)&&b.push({type:"sessionMetaUpdated",sessionId:p,...y});break}case"prompt.submitted":{const g=m?.promptId,v=m?.userMessageId;if(!g||!v)break;const y=VK(m?.content);if(y.length===0)break;f.currentPromptId=g;const A=jK(f,p,g,v,y,typeof m?.createdAt=="string"?m.createdAt:new Date().toISOString());b.push({type:"messageCreated",message:gf(A)});break}case"turn.started":{const g=m?.turnId,v=f.currentPromptId??Lr("pr_");f.currentPromptId=v,g!==void 0&&f.turnPromptId.set(g,v),f.turnTextLen=0,f.turnThinkLen=0,b.push({type:"sessionStatusChanged",sessionId:p,status:"running",previousStatus:"idle",currentPromptId:v});break}case"turn.step.started":{const g=m?.turnId;let v=f.turnPromptId.get(g)??f.currentPromptId;v||(v=Lr("pr_"),f.currentPromptId=v,g!==void 0&&f.turnPromptId.set(g,v));const y=RS(f,p,v);f.currentAssistantMsgId=y.id,b.push({type:"messageCreated",message:gf(y)});break}case"thinking.delta":{const g=f.currentAssistantMsgId;if(!g)break;const v=m?.delta??"";if(!v)break;h?.offset===0&&f.turnThinkLen>0&&(f.turnThinkLen=0);const y=a(f.turnThinkLen,h?.offset);if(y==="skip")break;if(y==="gap"){b.push({type:"historyCompacted",sessionId:p,beforeSeq:0,reason:"delta_gap"});break}const A=DS(f,g,"thinking",v);if(A<0)break;f.turnThinkLen+=v.length,b.push({type:"assistantDelta",sessionId:p,messageId:g,contentIndex:A,delta:{thinking:v}});break}case"assistant.delta":{const g=f.currentAssistantMsgId;if(!g)break;const v=m?.delta??"";if(!v)break;h?.offset===0&&f.turnTextLen>0&&(f.turnTextLen=0);const y=a(f.turnTextLen,h?.offset);if(y==="skip")break;if(y==="gap"){b.push({type:"historyCompacted",sessionId:p,beforeSeq:0,reason:"delta_gap"});break}const A=DS(f,g,"text",v);if(A<0)break;f.turnTextLen+=v.length,b.push({type:"assistantDelta",sessionId:p,messageId:g,contentIndex:A,delta:{text:v}});break}case"tool.use":case"tool.call.started":{const g=f.currentAssistantMsgId,v=m?.turnId,y=f.turnPromptId.get(v)??f.currentPromptId;if(!g||!y)break;const A=m?.toolCallId,O=m?.name??m?.toolName??"",$=m?.args??m?.input??{};KK(f,g,A,O,$);const k=Xg(f,g);k&&k.content.length-1,f.toolStartTimes.set(A,Date.now()),k&&b.push({type:"messageUpdated",sessionId:p,messageId:g,content:k.content.map(E=>({...E})),status:"pending"});break}case"tool.call.delta":break;case"tool.progress":{const g=m?.toolCallId,v=GK(m??{});g&&v&&b.push({type:"toolOutput",sessionId:p,toolCallId:g,outputChunk:v.outputChunk,stream:v.stream});break}case"tool.result":{const g=m?.turnId;let v=f.turnPromptId.get(g)??f.currentPromptId;v||(v=Lr("pr_"),f.currentPromptId=v,g!==void 0&&f.turnPromptId.set(g,v));const y=m?.toolCallId,A=m?.output,O=m?.isError??!1;f.toolStartTimes.get(y)??Date.now(),f.toolStartTimes.delete(y);const $=YK(f,p,y,A,O,v);b.push({type:"messageCreated",message:gf($)}),f.currentAssistantMsgId=void 0;break}case"turn.step.completed":{const g=f.currentAssistantMsgId,v=FK(m?.usage);if(f.totalInput+=v.input,f.totalOutput+=v.output,f.totalCacheRead+=v.cacheRead,f.totalCacheCreate+=v.cacheCreate,g){BS(f,g);const y=Xg(f,g);y&&b.push({type:"messageUpdated",sessionId:p,messageId:g,content:y.content.map(A=>({...A})),status:"completed"})}break}case"agent.status.updated":{m?.model&&(f.model=m.model),m?.contextTokens!==void 0&&(f.contextTokens=m.contextTokens),m?.maxContextTokens!==void 0&&(f.contextLimit=m.maxContextTokens),b.push({type:"sessionUsageUpdated",sessionId:p,usage:FS(f),model:f.model||void 0,swarmMode:m?.swarmMode===!0?!0:m?.swarmMode===!1?!1:void 0,planMode:m?.planMode===!0?!0:m?.planMode===!1?!1:void 0});break}case"turn.ended":{const g=f.currentAssistantMsgId,v=m?.reason??"completed",y=El(m??{},"durationMs");if(g){BS(f,g);const $=Xg(f,g);$&&b.push({type:"messageUpdated",sessionId:p,messageId:g,content:$.content.map(k=>({...k})),status:v==="failed"||v==="filtered"?"error":"completed",durationMs:y})}f.turnCount++;const A=FS(f);b.push({type:"sessionUsageUpdated",sessionId:p,usage:A});const O=v==="cancelled"||v==="failed"||v==="filtered"?"aborted":"idle";b.push({type:"sessionStatusChanged",sessionId:p,status:O,previousStatus:"running"}),f.currentAssistantMsgId=void 0,f.currentPromptId=void 0,f.turnTextLen=0,f.turnThinkLen=0;break}case"prompt.completed":break;case"turn.step.retrying":case"turn.step.interrupted":{f.currentAssistantMsgId=void 0;break}case"subagent.spawned":{const v={id:typeof m?.subagentId=="string"&&m.subagentId.length>0?m.subagentId:Lr("task_"),sessionId:p,kind:"subagent",description:typeof m?.description=="string"?m.description:m?.subagentName??"Sub Agent",status:"running",createdAt:new Date().toISOString(),subagentPhase:"queued",subagentType:typeof m?.subagentName=="string"?m.subagentName:void 0,parentToolCallId:typeof m?.parentToolCallId=="string"?m.parentToolCallId:void 0,swarmIndex:typeof m?.swarmIndex=="number"?m.swarmIndex:void 0,runInBackground:m?.runInBackground===!0};f.subagentMeta.set(v.id,v),b.push({type:"taskCreated",sessionId:p,task:v});break}case"subagent.started":{const g=Wa(f,p,m?.subagentId,{subagentPhase:"working",status:"running",startedAt:new Date().toISOString()});g&&b.push({type:"taskCreated",sessionId:p,task:g});break}case"subagent.suspended":{const g=Wa(f,p,m?.subagentId,{subagentPhase:"suspended",status:"running",suspendedReason:typeof m?.reason=="string"?m.reason:void 0});g&&b.push({type:"taskCreated",sessionId:p,task:g});break}case"subagent.completed":{const g=typeof m?.resultSummary=="string"?m.resultSummary:void 0,v=Wa(f,p,m?.subagentId,{subagentPhase:"completed",status:"completed",completedAt:new Date().toISOString(),outputPreview:g});v&&b.push({type:"taskCreated",sessionId:p,task:v}),b.push({type:"taskCompleted",sessionId:p,taskId:m?.subagentId??"",status:"completed",outputPreview:g});break}case"subagent.failed":{const g=typeof m?.error=="string"?m.error:void 0,v=Wa(f,p,m?.subagentId,{subagentPhase:"failed",status:"failed",completedAt:new Date().toISOString(),outputPreview:g});v&&b.push({type:"taskCreated",sessionId:p,task:v}),b.push({type:"taskCompleted",sessionId:p,taskId:m?.subagentId??"",status:"failed",outputPreview:g});break}case"error":{b.push({type:"unknown",raw:{_agentError:!0,code:m?.code,message:m?.message}});break}case"warning":{b.push({type:"unknown",raw:{_agentWarning:!0,message:m?.message}});break}case"background.task.started":{const g=m?.info??{},v=typeof g.startedAt=="number"?new Date(g.startedAt).toISOString():void 0,y=typeof g.taskId=="string"?g.taskId:typeof g.taskId=="number"?String(g.taskId):Lr("task_"),A=typeof g.description=="string"?g.description:typeof g.command=="string"?g.command:Un.global.t("tasks.defaultDescription"),O=typeof g.command=="string"?g.command:void 0;b.push({type:"taskCreated",sessionId:p,task:{id:y,sessionId:p,kind:"bash",description:A,command:O,status:"running",createdAt:v??new Date().toISOString(),startedAt:v,outputPreview:O!==void 0?`$ ${O}`:void 0}});break}case"background.task.terminated":{const g=m?.info??{},v=g.status==="failed"||typeof g.exitCode=="number"&&g.exitCode!==0;b.push({type:"taskCompleted",sessionId:p,taskId:typeof g.taskId=="string"?g.taskId:typeof g.taskId=="number"?String(g.taskId):"",status:v?"failed":"completed"});break}case"compaction.completed":{const g=m?.result??{};b.push({type:"compactionCompleted",sessionId:p,tokensBefore:typeof g.tokensBefore=="number"?g.tokensBefore:void 0,tokensAfter:typeof g.tokensAfter=="number"?g.tokensAfter:void 0,summary:typeof g.summary=="string"?g.summary:void 0}),b.push({type:"historyCompacted",sessionId:p,beforeSeq:0,reason:"auto_compact"});break}case"compaction.started":{b.push({type:"compactionStarted",sessionId:p,trigger:m?.trigger==="manual"?"manual":"auto",instruction:typeof m?.instruction=="string"?m.instruction:void 0});break}case"compaction.cancelled":{b.push({type:"compactionCancelled",sessionId:p});break}case"goal.updated":{const g=HK(m?.snapshot??null);b.push({type:"goalUpdated",sessionId:p,goal:g?.status==="complete"?null:g});break}}return b}return{project:l,bindNextPromptId:i,seedInFlight:r,reset:s,markSideChannelAgent:o}}const QK=new Set(["server_hello","ack","ping","resync_required","error","pong"]),HS=new Set(["turn.started","turn.step.started","turn.step.completed","turn.step.retrying","turn.step.interrupted","turn.ended","thinking.delta","assistant.delta","tool.call.started","tool.use","tool.call.delta","tool.progress","tool.result","agent.status.updated","prompt.submitted","prompt.completed","session.meta.updated","compaction.started","compaction.progress","compaction.completed","compaction.cancelled","goal.updated","error","warning","subagent.spawned","subagent.started","subagent.suspended","subagent.completed","subagent.failed","background.task.started","background.task.terminated"]),ZK=new Set(["session.created","session.updated","session.deleted","session.status_changed","session.usage_updated","session.history_compacted","message.created","message.updated","approval.requested","approval.resolved","approval.expired","question.requested","question.answered","question.dismissed","task.created","task.progress","task.completed","assistant.tool_use_started","assistant.tool_use_delta","assistant.tool_use_completed","assistant.completed","tool.started","tool.output","tool.completed"]),JK=new Set(["assistant.delta","thinking.delta"]);function eG(e,t){if(QK.has(e))return{route:"ignore"};const n=e.startsWith("event."),s=n?e.slice(6):e;return JK.has(s)?tG(t)?{route:"agent",agentType:s}:{route:"protocol"}:n?ZK.has(s)?{route:"protocol"}:HS.has(s)?{route:"agent",agentType:s}:{route:"protocol"}:HS.has(s)?{route:"agent",agentType:s}:{route:"agent",agentType:s}}function tG(e){if(!e||typeof e!="object")return!1;const t=e;return"message_id"in t||"content_index"in t?!1:typeof t.delta=="string"}class Wf extends Error{code;requestId;details;timestamp;durationMs;constructor(t){super(t.msg),this.name="DaemonApiError",this.code=t.code,this.requestId=t.requestId,this.details=t.details,this.timestamp=t.timestamp,this.durationMs=t.durationMs}}class $a extends Error{cause;method;path;url;requestId;phase;timeoutMs;status;statusText;contentType;bodyPreview;timestamp;durationMs;constructor(t){super(t.message),this.name="DaemonNetworkError",this.cause=t.cause,this.method=t.method,this.path=t.path,this.url=t.url,this.requestId=t.requestId,this.phase=t.phase,this.timeoutMs=t.timeoutMs,this.status=t.status,this.statusText=t.statusText,this.contentType=t.contentType,this.bodyPreview=t.bodyPreview,this.timestamp=t.timestamp,this.durationMs=t.durationMs}}function el(e){return e instanceof Wf||typeof e=="object"&&e!==null&&e.name==="DaemonApiError"&&typeof e.code=="number"}function v3(e){return e instanceof $a||typeof e=="object"&&e!==null&&e.name==="DaemonNetworkError"&&typeof e.method=="string"&&typeof e.path=="string"}const WS=1e3,Qg=16384,Zg=500,Jg=50,nG=6,sG=/api[_-]?key|authorization|token|secret|password|cookie|credential/i,oG=/^[A-Za-z0-9+/=_-]{200,}$/;let ev=null;function vi(){if(ev!==null)return ev;let e=!1;try{if(typeof location<"u"){const t=new URLSearchParams(location.search).get("debug");(t==="1"||t==="true")&&(e=!0)}}catch{}return e||(e=Qn(Et.debug)==="1"),ev=e,e}const Hr=[];let iG=1;const vy=Z(0),su=Ql(!1);function rG(){return Hr}function lG(){Hr.length=0,vy.value++}function rl(e){su.value||(Hr.push({id:iG++,ts:Date.now(),...e}),Hr.length>WS&&Hr.splice(0,Hr.length-WS),vy.value++)}function R1(e,t=0){if(e==null)return e;const n=typeof e;if(n==="number"||n==="boolean")return e;if(n==="string"){const o=e;return oG.test(o)?`[base64-like, ${o.length} chars omitted]`:o.length>Zg?`${o.slice(0,Zg)}… [+${o.length-Zg} chars]`:o}if(n!=="object")return String(e);if(t>=nG)return"[max depth]";if(Array.isArray(e)){const o=e.slice(0,Jg).map(i=>R1(i,t+1));return e.length>Jg&&o.push(`[+${e.length-Jg} more items]`),o}const s={};for(const[o,i]of Object.entries(e))s[o]=sG.test(o)?"[redacted]":R1(i,t+1);return s}function ea(e){if(e===void 0)return;const t=R1(e);try{const n=JSON.stringify(t);if(n!==void 0&&n.length>Qg)return{_truncated:`detail JSON was ${n.length} chars; first ${Qg} kept`,preview:n.slice(0,Qg)}}catch{return"[unserializable detail]"}return t}function tv(e){vi()&&rl({source:"rest",kind:"rest:request",label:`→ ${e.method} ${e.path}`,method:e.method,path:e.path,requestId:e.requestId,detail:{url:e.url,body:ea(e.body)}})}function vf(e){if(!vi())return;const t=e.code!==0;rl({source:"rest",kind:t?"rest:error":"rest:response",label:`← ${e.method} ${e.path} ${e.status} code=${e.code}${t?` "${e.msg}"`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,code:e.code,durationMs:e.durationMs,detail:{envelope:{code:e.code,msg:e.msg,request_id:e.envelopeRequestId},data:ea(e.data)}})}function Xc(e){vi()&&rl({source:"rest",kind:"rest:error",label:`✕ ${e.method} ${e.path} ${e.phase} error${e.status!==void 0?` (HTTP ${e.status})`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,durationMs:e.durationMs,detail:{phase:e.phase,error:String(e.error)}})}function xa(e,t){vi()&&rl({source:"ws",kind:"ws:lifecycle",eventType:e,label:`ws ${e}`,detail:ea(t)})}function aG(e){if(!vi())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",s=t.payload,o=typeof s?.session_id=="string"?s.session_id:void 0;rl({source:"ws",kind:"ws:out",eventType:n,sessionId:o,label:`→ ${n}`,detail:ea(e)})}function cG(e){if(!vi())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",s=typeof t.session_id=="string"?t.session_id:typeof t.payload?.session_id=="string"?t.payload.session_id:void 0,o=typeof t.seq=="number"?t.seq:void 0,i=typeof t.offset=="number"?t.offset:void 0,r=[s,o!==void 0?`seq=${o}`:void 0,i!==void 0?`offset=${i}`:void 0,t.volatile===!0?"volatile":void 0].filter(Boolean);rl({source:"ws",kind:"ws:in",eventType:n,sessionId:s,seq:o,offset:i,label:`← ${n}${r.length>0?` (${r.join(" ")})`:""}`,detail:ea(t.payload)})}const uG={error:"✕",warn:"⚠",info:"ℹ",debug:"·",log:"·"};function nv(e,t,n){vi()&&rl({source:"client",kind:`client:${e}`,label:`${uG[e]} ${t}`,detail:ea(n)})}function Or(e,t){vi()&&rl({source:"client",kind:"client:event",label:`· ${e}`,detail:ea(t)})}let zS=!1;function dG(){if(!(zS||!vi())){zS=!0;try{typeof window<"u"&&(window.addEventListener("error",e=>{nv("error",e.message||"window error",{source:e.filename,line:e.lineno,col:e.colno,stack:e.error instanceof Error?e.error.stack:void 0})}),window.addEventListener("unhandledrejection",e=>{const t=e.reason;nv("error","unhandled promise rejection",{reason:t instanceof Error?`${t.name}: ${t.message}`:t,stack:t instanceof Error?t.stack:void 0})}))}catch{}for(const e of["error","warn","log","info","debug"]){const t=console[e];typeof t=="function"&&(console[e]=(...n)=>{try{nv(e,n.map(fG).join(" "),n.length>1?n:n[0])}catch{}t.apply(console,n)})}}}function fG(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch{return String(e)}}function y3(e=Hr){if(typeof document>"u")return;const t=new Blob([pG(e)],{type:"application/x-ndjson"}),n=URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download=`king-web-log-${new Date().toISOString().replace(/[:.]/g,"-")}.jsonl`,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(n)}function pG(e=Hr){return e.map(t=>JSON.stringify(t)).join(`
|
|
247
|
+
`)}const yy="king-web.server-credential",hG="token";let Yu;const D1=new Set;function mG(){if(typeof window>"u")return;const e=window.location.hash??"";if(!e.startsWith("#"))return;const n=new URLSearchParams(e.slice(1)).get(hG);if(!n)return;const s=new URL(window.location.href);return s.hash="",window.history.replaceState(window.history.state,"",`${s.pathname}${s.search}`),n}function gG(){try{return globalThis.sessionStorage?.getItem(yy)??void 0}catch{return}}function vG(){const e=mG();return e?(b3(e),!0):(Yu=gG(),Yu!==void 0)}function k3(){return Yu}function b3(e){Yu=e;try{globalThis.sessionStorage?.setItem(yy,e)}catch{}}function yG(){Yu=void 0;try{globalThis.sessionStorage?.removeItem(yy)}catch{}}function kG(e){return D1.add(e),()=>{D1.delete(e)}}function bG(){yG();for(const e of D1)try{e()}catch{}}const Na=3e4,_3="0123456789ABCDEFGHJKMNPQRSTVWXYZ",US=500,_G=40101;function sv(){try{return AbortSignal.timeout(Na)}catch{return}}function wG(e,t){let n="",s=e;for(let o=0;o<t;o++)n=_3[s%32]+n,s=Math.floor(s/32);return n}function SG(e){const t=new Uint8Array(e);if(globalThis.crypto?.getRandomValues)globalThis.crypto.getRandomValues(t);else for(let n=0;n<t.length;n++)t[n]=Math.floor(Math.random()*256);return Array.from(t,n=>_3[n%32]).join("")}function ov(){return`${wG(Date.now(),10)}${SG(16)}`}function CG(e){try{const t=[];return e.forEach((n,s)=>{typeof n=="string"?t.push({field:s,value:n}):t.push({field:s,file:n.name,size:n.size,type:n.type})}),{formData:t}}catch{return"[FormData]"}}async function qS(e){try{const t=await e.text();return t?t.length>US?`${t.slice(0,US)}...`:t:void 0}catch{return}}class xG{constructor(t,n){this.origin=t,this.identity=n}async get(t,n){return this.request("GET",t,void 0,n)}async getBlob(t){const n=cu(this.origin,t),s=ov(),o={"X-Request-Id":s};this.addClientHeaders(o);const i=Date.now();tv({method:"GET",path:t,url:n,requestId:s});let r;try{r=await fetch(n,{method:"GET",headers:o,signal:sv()})}catch(a){throw Xc({method:"GET",path:t,requestId:s,phase:"fetch",durationMs:Date.now()-i,error:a}),new $a({message:`Network error calling GET ${t}`,cause:a,method:"GET",path:t,url:n,requestId:s,phase:"fetch",timeoutMs:Na,timestamp:Date.now(),durationMs:Date.now()-i})}if(r.ok)return vf({method:"GET",path:t,requestId:s,status:r.status,durationMs:Date.now()-i,code:0,msg:""}),r.blob();let l;try{l=await r.clone().json()}catch{}throw this.checkAuthRequired(r,l?.code??0),vf({method:"GET",path:t,requestId:s,status:r.status,durationMs:Date.now()-i,code:l?.code??r.status,msg:l?.msg??r.statusText,envelopeRequestId:l?.request_id}),new Wf({code:l?.code??r.status,msg:l?.msg??r.statusText,requestId:l?.request_id??s,details:l?.details,timestamp:Date.now(),durationMs:Date.now()-i})}async post(t,n,s){return this.request("POST",t,n,void 0,s?.allowCodes)}async postForm(t,n){const s=cu(this.origin,t),o=ov(),i={"X-Request-Id":o};this.addClientHeaders(i);const r=Date.now();tv({method:"POST",path:t,url:s,requestId:o,body:CG(n)});let l;try{l=await fetch(s,{method:"POST",headers:i,body:n,signal:sv()})}catch(u){throw Xc({method:"POST",path:t,requestId:o,phase:"fetch",durationMs:Date.now()-r,error:u}),new $a({message:`Network error calling POST ${t}`,cause:u,method:"POST",path:t,url:s,requestId:o,phase:"fetch",timeoutMs:Na,timestamp:Date.now(),durationMs:Date.now()-r})}let a;const c=l.clone();try{a=await l.json()}catch(u){throw Xc({method:"POST",path:t,requestId:o,phase:"parse",durationMs:Date.now()-r,status:l.status,error:u}),new $a({message:`Failed to parse JSON response from POST ${t}`,cause:u,method:"POST",path:t,url:s,requestId:o,phase:"parse",timeoutMs:Na,status:l.status,statusText:l.statusText,contentType:l.headers.get("content-type")??void 0,bodyPreview:await qS(c),timestamp:Date.now(),durationMs:Date.now()-r})}if(vf({method:"POST",path:t,requestId:o,status:l.status,durationMs:Date.now()-r,code:a.code,msg:a.msg,envelopeRequestId:a.request_id,data:a.data}),this.checkAuthRequired(l,a.code),a.code!==0)throw new Wf({code:a.code,msg:a.msg,requestId:a.request_id,details:a.details,timestamp:Date.now(),durationMs:Date.now()-r});return a.data}async patch(t,n){return this.request("PATCH",t,n)}async delete(t){return this.request("DELETE",t)}async request(t,n,s,o,i=[]){let r=cu(this.origin,n);if(o){const h=new URLSearchParams;for(const[m,b]of Object.entries(o))b!==void 0&&h.set(m,String(b));const f=h.toString();f&&(r=`${r}?${f}`)}const l=ov(),a={"X-Request-Id":l};this.addClientHeaders(a),s!==void 0&&(a["Content-Type"]="application/json; charset=utf-8");const c=Date.now();tv({method:t,path:n,url:r,requestId:l,body:s});let u;try{u=await fetch(r,{method:t,headers:a,body:s!==void 0?JSON.stringify(s):void 0,signal:sv()})}catch(h){throw Xc({method:t,path:n,requestId:l,phase:"fetch",durationMs:Date.now()-c,error:h}),new $a({message:`Network error calling ${t} ${n}`,cause:h,method:t,path:n,url:r,requestId:l,phase:"fetch",timeoutMs:Na,timestamp:Date.now(),durationMs:Date.now()-c})}let d;const p=u.clone();try{d=await u.json()}catch(h){throw Xc({method:t,path:n,requestId:l,phase:"parse",durationMs:Date.now()-c,status:u.status,error:h}),new $a({message:`Failed to parse JSON response from ${t} ${n}`,cause:h,method:t,path:n,url:r,requestId:l,phase:"parse",timeoutMs:Na,status:u.status,statusText:u.statusText,contentType:u.headers.get("content-type")??void 0,bodyPreview:await qS(p),timestamp:Date.now(),durationMs:Date.now()-c})}if(vf({method:t,path:n,requestId:l,status:u.status,durationMs:Date.now()-c,code:d.code,msg:d.msg,envelopeRequestId:d.request_id,data:d.data}),this.checkAuthRequired(u,d.code),d.code!==0&&!i.includes(d.code))throw new Wf({code:d.code,msg:d.msg,requestId:d.request_id,details:d.details,timestamp:Date.now(),durationMs:Date.now()-c});return d.data}addClientHeaders(t){const n=k3();n!==void 0&&(t.Authorization=`Bearer ${n}`),this.identity!==void 0&&(t["X-Blun-Client-Id"]=this.identity.clientId,t["X-Blun-Client-Name"]=this.identity.clientName,t["X-Blun-Client-Version"]=this.identity.clientVersion,t["X-Blun-Client-Ui-Mode"]=this.identity.clientUiMode)}checkAuthRequired(t,n){(t.status===401||n===_G)&&bG()}}const AG="blun.bearer.";class TG{constructor(t,n,s){this.wsUrl=t,this.clientId=n,this.handlers=s}ws=null;connected=!1;closed=!1;subscriptions=new Map;pendingSubscriptions=[];terminalAttachments=new Map;msgSeq=0;reconnectAttempts=0;reconnectTimer=null;connect(){if(this.ws!==null||this.closed)return;xa("connect",{url:this.wsUrl,attempt:this.reconnectAttempts});const t=k3(),n=t!==void 0?[`${AG}${t}`]:void 0,s=new WebSocket(this.wsUrl,n);this.ws=s,s.onopen=()=>{xa("open")},s.onmessage=o=>{try{const i=JSON.parse(String(o.data));cG(i),this.handleFrame(i)}catch(i){xa("parse-error",{error:String(i)}),this.handlers.onError(0,`Failed to parse WS frame: ${String(i)}`,!1)}},s.onerror=()=>{xa("error"),this.handlers.onError(0,"WebSocket error",!1)},s.onclose=o=>{xa("close",o?{code:o.code,reason:o.reason,wasClean:o.wasClean}:void 0),this.connected=!1,this.ws=null,this.handlers.onConnectionState(!1),this.scheduleReconnect()}}scheduleReconnect(){if(this.closed||this.reconnectTimer!==null)return;const n=Math.min(3e4,1e3*2**this.reconnectAttempts)+Math.floor(Math.random()*250);this.reconnectAttempts+=1,xa("reconnect-scheduled",{delayMs:n,attempt:this.reconnectAttempts}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}subscribe(t,n={seq:0}){if(this.subscriptions.set(t,{...n}),this.connected)this.sendSubscribe([t],{[t]:n});else{const s=this.pendingSubscriptions.findIndex(o=>o.sessionId===t);s!==-1&&this.pendingSubscriptions.splice(s,1),this.pendingSubscriptions.push({sessionId:t,cursor:{...n}})}}unsubscribe(t){this.subscriptions.delete(t);const n=this.pendingSubscriptions.findIndex(s=>s.sessionId===t);n!==-1&&this.pendingSubscriptions.splice(n,1),this.connected&&this.ws&&this.send({type:"unsubscribe",id:this.nextId(),payload:{session_ids:[t]}})}abort(t,n){!this.connected||!this.ws||this.send({type:"abort",id:this.nextId(),payload:{session_id:t,prompt_id:n}})}terminalAttach(t,n,s){const o=yf(t,n),i=this.terminalAttachments.get(o),r=s??i?.lastSeq??0;this.terminalAttachments.set(o,{sessionId:t,terminalId:n,lastSeq:r}),!(!this.connected||!this.ws)&&this.sendTerminalAttach(t,n,r)}terminalInput(t,n,s){!this.connected||!this.ws||this.send({type:"terminal_input",id:this.nextId(),payload:{session_id:t,terminal_id:n,data:s}})}terminalResize(t,n,s,o){!this.connected||!this.ws||this.send({type:"terminal_resize",id:this.nextId(),payload:{session_id:t,terminal_id:n,cols:s,rows:o}})}terminalDetach(t,n){this.terminalAttachments.delete(yf(t,n)),!(!this.connected||!this.ws)&&this.send({type:"terminal_detach",id:this.nextId(),payload:{session_id:t,terminal_id:n}})}terminalClose(t,n){this.terminalAttachments.delete(yf(t,n)),!(!this.connected||!this.ws)&&this.send({type:"terminal_close",id:this.nextId(),payload:{session_id:t,terminal_id:n}})}close(){this.closed=!0,this.connected=!1,this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(1e3),this.ws=null)}handleFrame(t){const n=t;switch(t.type){case"server_hello":this.onServerHello();break;case"ping":this.send({type:"pong",payload:{nonce:n.payload.nonce}});break;case"resync_required":{const s=n.payload.session_id,o=n.payload.epoch;this.subscriptions.set(s,{seq:n.payload.current_seq,epoch:o}),this.handlers.onResync(s,n.payload.current_seq,o);break}case"error":{const s=n.session_id;typeof s=="string"&&this.handlers.onRawAgentEvent?this.handlers.onRawAgentEvent({type:"error",seq:n.seq,session_id:s,timestamp:n.timestamp,payload:n.payload}):this.handlers.onError(n.payload.code,n.payload.msg,n.payload.fatal);break}case"ack":break;case"terminal_output":{const s=n.session_id,o=n.terminal_id,i=n.seq,r=yf(s,o),l=this.terminalAttachments.get(r);l&&this.terminalAttachments.set(r,{...l,lastSeq:Math.max(l.lastSeq,i)});const a=typeof n.payload?.data=="string"?n.payload.data:"";this.handlers.onTerminalOutput?.(s,o,a,i);break}case"terminal_exit":{const s=n.session_id,o=n.terminal_id,i=n.payload?.exit_code,r=typeof i=="number"?i:null;this.handlers.onTerminalExit?.(s,o,r);break}default:{this.trackCursor(n);const s=n.type,o=eG(s,n.payload);if(o.route==="protocol"){this.handlers.onWireEvent(n);break}if(o.route==="agent"){if(this.handlers.onRawAgentEvent&&typeof n.session_id=="string"){const i=n,r=n;this.handlers.onRawAgentEvent({type:o.agentType,seq:i.seq,session_id:i.session_id,timestamp:i.timestamp,payload:i.payload,...r.volatile!==void 0?{volatile:r.volatile}:{},...r.offset!==void 0?{offset:r.offset}:{}})}break}break}}}onServerHello(){this.connected=!0,this.reconnectAttempts=0,this.handlers.onConnectionState(!0);const t=Array.from(this.subscriptions.keys());for(const s of this.pendingSubscriptions)this.subscriptions.set(s.sessionId,s.cursor),t.includes(s.sessionId)||t.push(s.sessionId);this.pendingSubscriptions.length=0;const n={};for(const[s,o]of this.subscriptions.entries())n[s]=o;this.send({type:"client_hello",id:this.nextId(),payload:{client_id:this.clientId,subscriptions:t,cursors:n}});for(const s of this.terminalAttachments.values())this.sendTerminalAttach(s.sessionId,s.terminalId,s.lastSeq)}sendSubscribe(t,n){this.send({type:"subscribe",id:this.nextId(),payload:{session_ids:t,cursors:n}})}sendTerminalAttach(t,n,s){this.send({type:"terminal_attach",id:this.nextId(),payload:{session_id:t,terminal_id:n,since_seq:s>0?s:void 0}})}trackCursor(t){if(t.volatile===!0)return;const n=t.session_id,s=t.seq;if(typeof n!="string"||typeof s!="number")return;const o=this.subscriptions.get(n);if(!o||s<=o.seq&&o.epoch!==void 0)return;const i=typeof t.epoch=="string"?t.epoch:o.epoch;this.subscriptions.set(n,{seq:Math.max(s,o.seq),epoch:i})}send(t){if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN))try{this.ws.send(JSON.stringify(t)),aG(t)}catch{}}nextId(){return`c_${++this.msgSeq}`}}function yf(e,t){return`${e}\0${t}`}function iv(e){return{id:e.id,sessionId:e.session_id,cwd:e.cwd,shell:e.shell,cols:e.cols,rows:e.rows,status:e.status,createdAt:e.created_at,exitedAt:e.exited_at,exitCode:e.exit_code}}function jS(e){return e==="auto_compact"||e==="manual_compact"}class MG{http;config;constructor(t){this.config=t,this.http=new xG(t.serverHttpUrl,{clientId:t.clientId,clientName:t.clientName,clientVersion:t.clientVersion,clientUiMode:t.clientUiMode})}async getHealth(){return{status:"ok",uptimeSec:(await this.http.get("/healthz")).uptime_sec??0}}async getMeta(){const t=await this.http.get("/meta");return{serverVersion:t.server_version,serverId:t.server_id,startedAt:t.started_at,capabilities:t.capabilities,openInApps:Array.isArray(t.open_in_apps)?t.open_in_apps:[],dangerousBypassAuth:t.dangerous_bypass_auth===!0}}async listSessions(t){const n={before_id:t?.beforeId,after_id:t?.afterId,page_size:t?.pageSize,status:t?.status?CK(t.status):void 0,include_archive:t?.includeArchive,exclude_empty:t?.excludeEmpty,workspace_id:t?.workspaceId},s=await this.http.get("/sessions",n);return{items:s.items.map(Ti),hasMore:s.has_more}}async createSession(t){const n={metadata:t.cwd!==void 0?{cwd:t.cwd}:{}};t.workspaceId!==void 0&&(n.workspace_id=t.workspaceId),t.title!==void 0&&(n.title=t.title),t.model!==void 0&&(n.agent_config={model:t.model});const s=await this.http.post("/sessions",n);return Ti(s)}async getSession(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}`);return Ti(n)}async updateSession(t,n){const s={};n.title!==void 0&&(s.title=n.title),n.cwd!==void 0&&(s.metadata={cwd:n.cwd});const o={};n.model!==void 0&&(o.model=n.model),n.permissionMode!==void 0&&(o.permission_mode=n.permissionMode),n.planMode!==void 0&&(o.plan_mode=n.planMode),n.swarmMode!==void 0&&(o.swarm_mode=n.swarmMode),n.goalObjective!==void 0&&(o.goal_objective=n.goalObjective),n.goalControl!==void 0&&(o.goal_control=n.goalControl),n.thinking!==void 0&&(o.thinking=n.thinking),Object.keys(o).length>0&&(s.agent_config=o);const i=await this.http.post(`/sessions/${encodeURIComponent(t)}/profile`,s);return Ti(i)}async getSessionStatus(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}/status`);return{model:n.model&&n.model.length>0?n.model:null,thinkingEffort:n.thinking_level,permission:n.permission,planMode:n.plan_mode===!0,swarmMode:n.swarm_mode===!0,contextTokens:n.context_tokens??0,maxContextTokens:n.max_context_tokens??0,contextUsage:n.context_usage??0}}async getSessionWarnings(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/warnings`)).warnings??[]}async archiveSession(t){return await this.http.post(`/sessions/${encodeURIComponent(t)}:archive`,{})}async listMessages(t,n){const s={before_id:n?.beforeId,after_id:n?.afterId,page_size:n?.pageSize,role:n?.role},o=await this.http.get(`/sessions/${encodeURIComponent(t)}/messages`,s);return{items:o.items.map(L1),hasMore:o.has_more}}async getSessionSnapshot(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}/snapshot`);return{asOfSeq:n.as_of_seq,epoch:n.epoch,session:Ti(n.session),messages:n.messages.items.map(L1),hasMoreMessages:n.messages.has_more,inFlightTurn:n.in_flight_turn===null?null:{turnId:n.in_flight_turn.turn_id,assistantText:n.in_flight_turn.assistant_text,thinkingText:n.in_flight_turn.thinking_text,runningTools:n.in_flight_turn.running_tools.map(s=>({toolCallId:s.tool_call_id,name:s.name,args:s.args,description:s.description,lastProgress:s.last_progress})),promptId:n.in_flight_turn.current_prompt_id},pendingApprovals:n.pending_approvals.map(m3),pendingQuestions:n.pending_questions.map(g3)}}async submitPrompt(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts`,AK(n));return{promptId:s.prompt_id,userMessageId:s.user_message_id,status:s.status}}async steerPrompts(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts:steer`,{prompt_ids:n});return{steered:s.steered,promptIds:s.prompt_ids}}async abortPrompt(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts/${encodeURIComponent(n)}:abort`,void 0,{allowCodes:[40903]});return{aborted:s.aborted,atSeq:s.at_seq}}async abortSession(t){return{aborted:(await this.http.post(`/sessions/${encodeURIComponent(t)}:abort`,{})).aborted}}async compactSession(t,n){await this.http.post(`/sessions/${encodeURIComponent(t)}:compact`,n?{instruction:n}:{})}async undoSession(t,n=1){await this.http.post(`/sessions/${encodeURIComponent(t)}:undo`,{count:n})}async forkSession(t,n){const s={};n?.title!==void 0&&(s.title=n.title);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}:fork`,s);return Ti(o)}async createChildSession(t,n){const s={};n?.title!==void 0&&(s.title=n.title);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/children`,s);return Ti(o)}async listChildSessions(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/children`)).items.map(Ti)}async startBtw(t){return{agentId:(await this.http.post(`/sessions/${encodeURIComponent(t)}:btw`,{})).agent_id}}async respondApproval(t,n,s){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/approvals/${encodeURIComponent(n)}`,TK(s));return{resolved:o.resolved,resolvedAt:o.resolved_at}}async respondQuestion(t,n,s){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/questions/${encodeURIComponent(n)}`,$K(s));return{resolved:o.resolved,resolvedAt:o.resolved_at}}async dismissQuestion(t,n){return{dismissed:!0,dismissedAt:(await this.http.post(`/sessions/${encodeURIComponent(t)}/questions/${encodeURIComponent(n)}:dismiss`,void 0,{allowCodes:[40909]})).dismissed_at}}async listTasks(t,n){const s={status:n};return(await this.http.get(`/sessions/${encodeURIComponent(t)}/tasks`,s)).items.map(O1)}async getTask(t,n,s){const o={with_output:s?.withOutput,output_bytes:s?.outputBytes},i=await this.http.get(`/sessions/${encodeURIComponent(t)}/tasks/${encodeURIComponent(n)}`,o);return O1(i)}async cancelTask(t,n){return await this.http.post(`/sessions/${encodeURIComponent(t)}/tasks/${encodeURIComponent(n)}:cancel`)}async listTerminals(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/terminals`)).items.map(iv)}async createTerminal(t,n={}){const s={cwd:n.cwd,shell:n.shell,cols:n.cols,rows:n.rows},o=await this.http.post(`/sessions/${encodeURIComponent(t)}/terminals`,s);return iv(o)}async getTerminal(t,n){const s=await this.http.get(`/sessions/${encodeURIComponent(t)}/terminals/${encodeURIComponent(n)}`);return iv(s)}async closeTerminal(t,n){return this.http.post(`/sessions/${encodeURIComponent(t)}/terminals/${encodeURIComponent(n)}:close`)}async listSkills(t){return((await this.http.get(`/sessions/${encodeURIComponent(t)}/skills`)).skills??[]).map(s=>({name:s.name,description:s.description,source:s.source}))}async activateSkill(t,n,s){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/skills/${encodeURIComponent(n)}:activate`,s!==void 0&&s.length>0?{args:s}:{});return{activated:o.activated,skillName:o.skill_name}}async listDirectory(t,n){const s={};n.path!==void 0&&(s.path=n.path),n.depth!==void 0&&(s.depth=n.depth),n.includeGitStatus!==void 0&&(s.include_git_status=n.includeGitStatus);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:list`,s),i=o.children_by_path?Object.fromEntries(Object.entries(o.children_by_path).map(([r,l])=>[r,l.map(NS)])):void 0;return{items:o.items.map(NS),childrenByPath:i,truncated:o.truncated}}async readFile(t,n){const s={path:n.path};n.offset!==void 0&&(s.offset=n.offset),n.length!==void 0&&(s.length=n.length);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:read`,s);return{path:o.path,content:o.content,encoding:o.encoding,size:o.size,truncated:o.truncated,etag:o.etag,mime:o.mime,languageId:o.language_id,lineCount:o.line_count,isBinary:o.is_binary}}async searchFiles(t,n){const s={query:n.query};n.limit!==void 0&&(s.limit=n.limit);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:search`,s);return{items:o.items.map(i=>({path:i.path,name:i.name,kind:i.kind,score:i.score,matchPositions:i.match_positions})),truncated:o.truncated}}async grepFiles(t,n){const s={pattern:n.pattern};n.regex!==void 0&&(s.regex=n.regex),n.caseSensitive!==void 0&&(s.case_sensitive=n.caseSensitive);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:grep`,s);return{files:o.files,filesScanned:o.files_scanned,truncated:o.truncated,elapsedMs:o.elapsed_ms}}async getGitStatus(t,n){const s={};n!==void 0&&(s.paths=n);const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:git_status`,s);return{branch:o.branch,ahead:o.ahead,behind:o.behind,entries:o.entries,additions:o.additions,deletions:o.deletions,pullRequest:o.pullRequest??null}}async getFileDiff(t,n){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:diff`,{path:n});return{path:s.path,diff:s.diff}}getFileDownloadUrl(t,n){const s=n.split("/").map(o=>encodeURIComponent(o)).join("/");return cu(this.config.serverHttpUrl,`/sessions/${encodeURIComponent(t)}/fs/${s}:download`)}async openFile(t,n){const s={path:n.path};return n.line!==void 0&&(s.line=n.line),this.http.post(`/sessions/${encodeURIComponent(t)}/fs:open`,s)}async revealFile(t,n){return this.http.post(`/sessions/${encodeURIComponent(t)}/fs:reveal`,{path:n.path})}async openInApp(t,n,s,o){const i={app_id:n,path:s};o!==void 0&&(i.line=o),await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:open-in`,i)}async listWorkspaces(){try{return((await this.http.get("/workspaces")).items??[]).map(Su)}catch{return[]}}async addWorkspace(t){const n={root:t.root};t.name!==void 0&&(n.name=t.name);const s=await this.http.post("/workspaces",n);return Su(s)}async deleteWorkspace(t){await this.http.delete(`/workspaces/${encodeURIComponent(t)}`)}async updateWorkspace(t,n){const s=await this.http.patch(`/workspaces/${encodeURIComponent(t)}`,{name:n.name});return Su(s)}async browseFs(t){try{const n=await this.http.get("/fs:browse",{path:t});return{path:n.path,parent:n.parent,entries:(n.entries??[]).map(s=>({name:s.name,path:s.path,isDir:s.is_dir,isGitRepo:s.is_git_repo,branch:s.branch}))}}catch{return{path:"",parent:null,entries:[]}}}async getFsHome(){try{const t=await this.http.get("/fs:home");return{home:t.home,recentRoots:t.recent_roots??[]}}catch{return{home:"",recentRoots:[]}}}async listModels(){return(await this.http.get("/models")).items.map(OK)}async listProviders(){return(await this.http.get("/providers")).items.map(LS)}async addProvider(t){const n={type:t.type};t.apiKey!==void 0&&(n.api_key=t.apiKey),t.baseUrl!==void 0&&(n.base_url=t.baseUrl),t.defaultModel!==void 0&&(n.default_model=t.defaultModel);const s=await this.http.post("/providers",n);return LS(s)}async deleteProvider(t){return this.http.delete(`/providers/${encodeURIComponent(t)}`)}async refreshProvider(t){const n=await this.http.post(`/providers/${encodeURIComponent(t)}:refresh`);return rv(n)}async refreshAllProviders(){const t=await this.http.post("/providers:refresh");return rv(t)}async refreshOAuthProviderModels(){const t=await this.http.post("/providers:refresh_oauth");return rv(t)}async getConfig(){const t=await this.http.get("/config");return P1(t)}async setConfig(t){const n={},s={providers:"providers",defaultProvider:"default_provider",defaultModel:"default_model",models:"models",thinking:"thinking",planMode:"plan_mode",yolo:"yolo",defaultPermissionMode:"default_permission_mode",defaultPlanMode:"default_plan_mode",permission:"permission",hooks:"hooks",services:"services",mergeAllAvailableSkills:"merge_all_available_skills",extraSkillDirs:"extra_skill_dirs",loopControl:"loop_control",background:"background",experimental:"experimental",telemetry:"telemetry",raw:"raw"};for(const[i,r]of Object.entries(t)){const l=s[i];l!==void 0&&(n[l]=r)}const o=await this.http.post("/config",n);return P1(o)}async getAuth(){const t=await this.http.get("/auth");return{ready:t.ready,providersCount:t.providers_count,defaultModel:t.default_model,managedProvider:t.managed_provider?{status:t.managed_provider.status}:null}}async startOAuthLogin(){const t=await this.http.post("/oauth/login",{});return{flowId:t.flow_id,provider:t.provider,verificationUri:t.verification_uri,verificationUriComplete:t.verification_uri_complete,userCode:t.user_code,expiresIn:t.expires_in,interval:t.interval,status:t.status,expiresAt:t.expires_at}}async pollOAuthLogin(){const t=await this.http.get("/oauth/login");return t?{flowId:t.flow_id,status:t.status,resolvedAt:t.resolved_at}:null}async cancelOAuthLogin(){const t=await this.http.delete("/oauth/login");return{cancelled:t.cancelled,status:t.status}}async logout(){return{loggedOut:(await this.http.post("/oauth/logout",{})).logged_out}}async uploadFile(t){const n=new FormData;n.append("file",t.file,t.name??(t.file instanceof File?t.file.name:"upload")),t.name!==void 0&&n.append("name",t.name);const s=await this.http.postForm("/files",n);return{id:s.id,name:s.name,mediaType:s.media_type,size:s.size}}getFileUrl(t){return cu(this.config.serverHttpUrl,`/files/${encodeURIComponent(t)}`)}async getFileBlob(t){return this.http.getBlob(`/files/${encodeURIComponent(t)}`)}connectEvents(t){const n=M5(this.config.serverHttpUrl,this.config.clientId),s=XK(),o=new TG(n,this.config.clientId,{onWireEvent:i=>{const r=PK(i),l=RK(i),a=LK(i);a.type==="historyCompacted"&&!jS(a.reason)&&t.onResync(a.sessionId,a.beforeSeq),t.onEvent(a,{sessionId:r,seq:l})},onRawAgentEvent:i=>{const{type:r,seq:l,session_id:a,payload:c,offset:u}=i,d=s.project(r,c,a,{offset:u});for(const p of d)p.type==="historyCompacted"&&!jS(p.reason)&&t.onResync(a,l),t.onEvent(p,{sessionId:a,seq:l})},onResync:(i,r,l)=>{s.reset(i),t.onResync(i,r,l)},onConnectionState:i=>{t.onConnectionChange(i)},onError:(i,r,l)=>{t.onError(i,r,l)},onTerminalOutput:(i,r,l,a)=>{t.onTerminalOutput?.(i,r,l,a)},onTerminalExit:(i,r,l)=>{t.onTerminalExit?.(i,r,l)}});return o.connect(),{subscribe(i,r){o.subscribe(i,r??{seq:0})},unsubscribe(i){o.unsubscribe(i)},seedSnapshot(i,r){if(r.inFlightTurn===null){s.reset(i);return}const l=s.seedInFlight(i,r.inFlightTurn);for(const a of l)t.onEvent(a,{sessionId:i,seq:r.asOfSeq})},bindNextPromptId(i,r){s.bindNextPromptId(i,r)},abort(i,r){o.abort(i,r)},terminalAttach(i,r,l){o.terminalAttach(i,r,l)},terminalInput(i,r,l){o.terminalInput(i,r,l)},terminalResize(i,r,l,a){o.terminalResize(i,r,l,a)},terminalDetach(i,r){o.terminalDetach(i,r)},terminalClose(i,r){o.terminalClose(i,r)},markSideChannelAgent(i){s.markSideChannelAgent(i)},close(){o.close()}}}}function rv(e){return{changed:e.changed.map(t=>({providerId:t.provider_id,providerName:t.provider_name,added:t.added,removed:t.removed})),unchanged:e.unchanged,failed:e.failed}}let VS;function dt(){return VS??=new MG(S5()),VS}const EG=["src","controls","muted"],IG=["src","alt"],lv=je({__name:"AuthMedia",props:{url:{},kind:{},alt:{},fileId:{},mediaClass:{default:"u-img"},controls:{type:Boolean,default:!0},muted:{type:Boolean,default:!1}},setup(e){const t=e,n=Z(t.fileId?"":t.url),s=Z(null),o=Z(!t.fileId);let i=null,r=0,l=!1,a=null;function c(){i!==null&&(URL.revokeObjectURL(i),i=null)}async function u(){const d=++r;if(c(),!t.fileId){n.value=t.url;return}if(o.value)try{const p=await dt().getFileBlob(t.fileId),h=URL.createObjectURL(p);if(l||d!==r){URL.revokeObjectURL(h);return}i=h,n.value=i}catch{if(l||d!==r)return;n.value=t.url}}return Ke(()=>[t.fileId,t.url,o.value],u,{immediate:!0}),hn(()=>{typeof IntersectionObserver=="function"&&s.value?(a=new IntersectionObserver(d=>{d[0]?.isIntersecting&&(o.value=!0,a?.disconnect(),a=null)},{rootMargin:"200px"}),a.observe(s.value)):o.value=!0}),ls(()=>{l=!0,a?.disconnect(),a=null,c()}),(d,p)=>e.kind==="video"?(w(),N("video",{key:0,ref_key:"mediaEl",ref:s,class:Re(e.mediaClass),src:n.value||void 0,controls:e.controls,muted:e.muted,playsinline:"",preload:"metadata"},null,10,EG)):(w(),N("img",{key:1,ref_key:"mediaEl",ref:s,class:Re(e.mediaClass),src:n.value||void 0,alt:e.alt||"",loading:"lazy"},null,10,IG))}}),$G=["aria-label"],NG=120,LG=60,OG=je({__name:"MoonSpinner",props:{size:{default:"md"},fast:{type:Boolean},label:{default:"Waiting for response…"}},setup(e){const t=["🌑","🌒","🌓","🌔","🌕","🌖","🌗","🌘"];function n(s){return{"--moon-frame-delay":`${s*NG}ms`,"--moon-frame-fast-delay":`${s*LG}ms`}}return(s,o)=>(w(),N("span",{class:Re(["ui-moon",[`ui-moon--${e.size}`,{"ui-moon--fast":e.fast}]]),"aria-label":e.label,role:"img"},[(w(),N(Le,null,nt(t,(i,r)=>T("span",{key:i,class:"ui-moon__frame",style:Gt(n(r)),"aria-hidden":"true"},R(i),5)),64))],10,$G))}}),w3=ut(OG,[["__scopeId","data-v-893e6a43"]]);function PG(e,t="昨天"){try{const n=new Date(e);if(Number.isNaN(n.getTime()))return e;const s=new Date,o=u=>String(u).padStart(2,"0"),i=`${o(n.getHours())}:${o(n.getMinutes())}`,r=n.getFullYear()===s.getFullYear(),l=n.getMonth()===s.getMonth(),a=n.getDate()===s.getDate();if(r&&l&&a)return i;const c=new Date(s);return c.setDate(s.getDate()-1),n.getFullYear()===c.getFullYear()&&n.getMonth()===c.getMonth()&&n.getDate()===c.getDate()?`${t} ${i}`:r?`${o(n.getMonth()+1)}-${o(n.getDate())} ${i}`:`${n.getFullYear()}-${o(n.getMonth()+1)}-${o(n.getDate())} ${i}`}catch{return e}}const RG={class:"chat"},DG={key:0,class:"chat-loading"},BG={class:"chat-loading-text"},FG={key:1,class:"chat-empty"},HG={key:1,class:"top-sentinel-text"},WG=["data-turn-id"],zG={key:0,class:"u-imgs"},UG=["aria-label","onClick"],qG={key:1,class:"skill-act"},jG={class:"skill-act-head"},VG={key:0,class:"skill-act-args"},KG={key:2,class:"skill-act"},GG={class:"skill-act-head"},YG={key:0,class:"skill-act-args"},XG={key:3,class:"u-text"},QG={key:0,class:"u-meta"},ZG=["aria-label","onClick"],JG=["aria-label","onClick"],eY=["onClick"],tY=["data-turn-id"],nY=["onClick"],sY={class:"cd-view"},oY={key:1,class:"cd-label"},iY=["data-turn-id"],rY={key:1,class:"msg"},lY={key:0,class:"a-msg-ft"},aY={key:0,class:"a-duration"},cY=["aria-label","onClick"],uY={key:4,class:"sending-placeholder"},dY={key:5,class:"q-stack"},fY={class:"q-head"},pY={class:"q-title"},hY={class:"q-hint"},mY=["onDragover","onDrop"],gY={class:"u-bub q-bub"},vY=["title","onDragstart"],yY=["title","disabled","onClick"],kY={key:0,class:"u-text q-text"},bY={key:1,class:"q-text q-text-placeholder"},_Y={key:0,class:"q-imgs"},wY={key:1,class:"q-tag q-tag-next"},SY={key:2,class:"q-tag q-tag-idx"},CY=["aria-label","onClick"],xY=2500,AY=je({__name:"ChatPane",props:{turns:{},approvals:{default:()=>[]},running:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},fastMoon:{type:Boolean,default:!1},sessionLoading:{type:Boolean},compaction:{default:null},hasMoreMessages:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},loadingMoreError:{type:Boolean,default:!1},isFollowing:{type:Boolean,default:!1},toolDiffPanel:{type:Boolean,default:!1},queued:{default:()=>[]}},emits:["openFile","openMedia","copyConversationCopied","openThinking","openCompaction","openAgent","openToolDiff","editMessage","loadOlderMessages","unqueue","editQueued","reorderQueue"],setup(e,{expose:t,emit:n}){const{t:s}=It(),{confirm:o}=ol();kn(()=>{we!==null&&(clearTimeout(we),we=null),z!==null&&(clearTimeout(z),z=null),E!==null&&(clearTimeout(E),E=null)});const i=e,r=Z(null);let l=null;function a(){!r.value||typeof IntersectionObserver>"u"||(l?.disconnect(),l=new IntersectionObserver(le=>{le[0]?.isIntersecting&&i.hasMoreMessages&&!i.loadingMore&&!i.loadingMoreError&&!i.sessionLoading&&!i.isFollowing&&d("loadOlderMessages")},{root:null,rootMargin:"200px 0px 0px 0px",threshold:0}),l.observe(r.value))}hn(a),kn(()=>{l?.disconnect(),l=null}),Ke(()=>[i.hasMoreMessages,i.loadingMore,i.loadingMoreError],()=>{ht().then(a)});const c=F(()=>{if(!i.running||i.turns.length===0)return null;const le=i.turns.at(-1);return le.role==="assistant"?le.id:null}),u=F(()=>i.sending||i.running),d=n,p=Z(null),h=Z(null);function f(le){return(le.attachments?.length??0)>0}function m(le,U){f(U)||d("editQueued",le)}function b(le,U){if(p.value=le,!U.dataTransfer)return;U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",String(le));const G=U.currentTarget?.closest(".q-turn");G&&U.dataTransfer.setDragImage(G,24,24)}function _(le,U){if(p.value===null)return;U.preventDefault(),U.dataTransfer&&(U.dataTransfer.dropEffect="move");const G=U.currentTarget.getBoundingClientRect(),ne=U.clientY<G.top+G.height/2?"before":"after";h.value={index:le,position:ne}}function g(le,U){U.preventDefault();const G=p.value,ne=h.value?.position??"before";if(p.value=null,h.value=null,G===null)return;let H=ne==="before"?le:le+1;G<H&&(H-=1),G!==H&&d("reorderQueue",{from:G,to:H})}function v(){p.value=null,h.value=null}const y=F(()=>{for(let le=i.turns.length-1;le>=0;le--)if(i.turns[le].role==="user")return i.turns[le].id;return null});function A(le){return le.role==="user"&&le.id===y.value&&!i.running&&!i.sending&&!le.skillActivation&&!le.pluginCommand}function O(le){const U=le.compaction,G=U?.trigger==="auto"?s("conversation.compactedAuto"):s("conversation.compactedPlain");return typeof U?.tokensBefore=="number"&&typeof U?.tokensAfter=="number"?G+s("conversation.compactedTokens",{before:R_(U.tokensBefore),after:R_(U.tokensAfter)}):G}const $=Z(null),k=Z(null);let E=null;const M=Z(new Set);function L(le){return M.value.has(le)}function S(le){const U=new Set(M.value);U.has(le)?U.delete(le):U.add(le),M.value=U}function I(le,U){if(L(U)){const G=new Date(le);if(Number.isNaN(G.getTime()))return le;const ne=H=>String(H).padStart(2,"0");return`${G.getFullYear()}-${ne(G.getMonth()+1)}-${ne(G.getDate())} ${ne(G.getHours())}:${ne(G.getMinutes())}`}return PG(le,s("conversation.yesterday"))}async function P(le){await o({title:s("conversation.undo"),message:s("conversation.undoConfirm"),variant:"primary"})&&D(le)}function D(le){k.value===null&&(k.value=le.id,d("editMessage",le.text),E=setTimeout(()=>{E=null,k.value=null},xY))}Ke(()=>i.turns,le=>{k.value!==null&&(le.some(U=>U.id===k.value)||(k.value=null,E!==null&&(clearTimeout(E),E=null)))},{flush:"post"});const W=Z(!1);let z=null;function q(){if(i.turns.length===0)return;const le=[];for(const G of i.turns){if(G.role==="compaction")continue;const ne=G.role==="user"?"User":"Assistant",H=LP(G);H.trim()&&le.push(`**${ne}**
|
|
248
248
|
|
|
249
249
|
${H}`)}const U=le.join(`
|
|
250
250
|
|
|
@@ -252,13 +252,13 @@ ${H}`)}const U=le.join(`
|
|
|
252
252
|
|
|
253
253
|
`);zs(U).then(G=>{G&&(W.value=!0,d("copyConversationCopied"),z!==null&&clearTimeout(z),z=setTimeout(()=>{z=null,W.value=!1},2e3))}).catch(()=>{})}function Q(le){const U=[];for(let G=le;G>=0;G--){const ne=i.turns[G];if(!ne||ne.role!=="assistant")break;U.unshift(ne)}return U}function X(le){return Q(le).map(U=>NP(U)).filter(Boolean).join(`
|
|
254
254
|
|
|
255
|
-
`)}function fe(){for(let le=i.turns.length-1;le>=0;le-=1)if(i.turns[le]?.role==="assistant")return X(le);return""}function ye(){const le=fe();le.trim()&&zs(le).then(U=>{U&&(W.value=!0,d("copyConversationCopied"),z!==null&&clearTimeout(z),z=setTimeout(()=>{z=null,W.value=!1},2e3))}).catch(()=>{})}t({copyConversation:q,copyFinalSummary:ye});function Me(le){const U=i.turns[le];if(!U||U.role!=="assistant")return!1;const G=i.turns[le+1];return!G||G.role!=="assistant"}let we=null;function ze(le){const U=i.turns[le];if(!U)return;const G=X(le);G.trim()&&zs(G).then(ne=>{ne&&($.value=U.id,we!==null&&clearTimeout(we),we=setTimeout(()=>{we=null,$.value=null},1400))}).catch(()=>{})}function Ue(le){const U=le.text;U.trim()&&zs(U).then(G=>{G&&($.value=le.id,we!==null&&clearTimeout(we),we=setTimeout(()=>{we=null,$.value=null},1400))}).catch(()=>{})}function Fe(le){return{kind:"image",url:le.url,path:le.alt,fileId:le.fileId}}function rt(le,U){return le.id!==c.value?!1:U.sourceIndex===hh(le).length-1}return(le,U)=>(w(),N("div",RG,[e.sessionLoading?(w(),N("div",DG,[oe(ni,{size:"sm"}),T("span",BG,R(x(s)("conversation.loading")),1)])):e.turns.length===0&&(!e.approvals||e.approvals.length===0)?(w(),N("div",FG)):ie("",!0),e.hasMoreMessages||e.loadingMore?(w(),N("div",{key:2,ref_key:"topSentinelRef",ref:r,class:Re(["top-sentinel",{"top-sentinel-loading":e.loadingMore}])},[e.loadingMore?(w(),N("span",HG,[oe(ni,{size:"sm"}),qe(" "+R(x(s)("conversation.loadingOlder")),1)])):(w(),N("button",{key:0,type:"button",class:"top-sentinel-btn",onClick:U[0]||(U[0]=G=>d("loadOlderMessages"))},R(x(s)("conversation.loadOlder")),1))],2)):ie("",!0),(w(!0),N(Le,null,nt(e.turns,(G,ne)=>(w(),N(Le,{key:G.id},[G.role==="user"?(w(),N("div",{key:0,class:Re(["u-turn",{"is-latest-user":G.id===y.value}])},[T("div",{class:Re(["u-bub turn-anchor",{undoing:k.value===G.id}]),"data-turn-id":G.id},[G.images&&G.images.length>0?(w(),N("div",zG,[(w(!0),N(Le,null,nt(G.images,(H,J)=>(w(),N(Le,{key:J},[H.kind==="video"?(w(),ve(lv,{key:0,url:H.url,kind:"video","file-id":H.fileId,"media-class":"u-img"},null,8,["url","file-id"])):(w(),N("button",{key:1,type:"button",class:"u-img-btn","aria-label":x(s)("filePreview.enlargeImage"),onClick:ce=>d("openMedia",Fe(H))},[oe(lv,{url:H.url,kind:"image",alt:H.alt,"file-id":H.fileId,"media-class":"u-img"},null,8,["url","alt","file-id"])],8,UG))],64))),128))])):ie("",!0),G.skillActivation?(w(),N("div",qG,[T("div",jG,[U[9]||(U[9]=T("span",{class:"skill-act-arrow"},"▶",-1)),T("span",null,R(x(s)("conversation.activatedSkill",{name:G.skillActivation.name})),1)]),G.skillActivation.args?(w(),N("div",VG,R(G.skillActivation.args),1)):ie("",!0)])):G.pluginCommand?(w(),N("div",KG,[T("div",GG,[U[10]||(U[10]=T("span",{class:"skill-act-arrow"},"▶",-1)),T("span",null,"/"+R(G.pluginCommand.pluginId)+":"+R(G.pluginCommand.commandName),1)]),G.pluginCommand.args?(w(),N("div",YG,R(G.pluginCommand.args),1)):ie("",!0)])):(w(),N("div",XG,R(G.text),1))],10,WG),G.createdAt||A(G)?(w(),N("div",QG,[A(G)?(w(),N("div",{key:0,class:Re(["u-edit-wrap",{undoing:k.value===G.id}])},[T("button",{type:"button",class:"u-edit","aria-label":x(s)("conversation.undoTooltip"),onClick:H=>P(G)},[oe(Je,{name:"undo",size:"sm"})],8,ZG)],2)):ie("",!0),G.text.trim().length>0?(w(),N("button",{key:1,type:"button",class:"u-copy","aria-label":x(s)("filePreview.copy"),onClick:vt(H=>Ue(G),["stop"])},[$.value!==G.id?(w(),ve(Je,{key:0,name:"copy",size:"sm"})):(w(),ve(Je,{key:1,name:"check",size:"sm"}))],8,JG)):ie("",!0),G.createdAt?(w(),N("button",{key:2,type:"button",class:"u-time",onClick:vt(H=>S(G.id),["stop"])},R(I(G.createdAt,G.id)),9,eY)):ie("",!0)])):ie("",!0)],2)):G.role==="compaction"?(w(),N("div",{key:1,class:"compact-divider turn-anchor","data-turn-id":G.id,role:"separator"},[U[11]||(U[11]=T("span",{class:"cd-line","aria-hidden":"true"},null,-1)),G.text?(w(),N("button",{key:0,type:"button",class:"cd-label cd-btn",onClick:H=>d("openCompaction",{turnId:G.id})},[T("span",null,R(O(G)),1),T("span",sY,R(x(s)("conversation.viewSummary")),1)],8,nY)):(w(),N("span",oY,R(O(G)),1)),U[12]||(U[12]=T("span",{class:"cd-line","aria-hidden":"true"},null,-1))],8,tY)):(w(),N("div",{key:2,class:"a-msg turn-anchor","data-turn-id":G.id},[(w(!0),N(Le,null,nt(x($P)(G),(H,J)=>(w(),N(Le,{key:x(OP)(H,J)},[H.kind==="thinking"?(w(),ve(yK,{key:0,text:H.thinking,mobile:"",streaming:rt(G,H),onOpen:ce=>d("openThinking",{turnId:G.id,blockIndex:H.sourceIndex})},null,8,["text","streaming","onOpen"])):H.kind==="text"&&H.text?(w(),N("div",rY,[oe(Oh,{text:H.text,streaming:rt(G,H),"open-file":ce=>d("openFile",ce)},null,8,["text","streaming","open-file"])])):H.kind==="tool-stack"?(w(),ve(HP,{key:2,tools:H.tools,mobile:"","tool-diff-panel":e.toolDiffPanel,onOpenMedia:U[1]||(U[1]=ce=>d("openMedia",ce)),onOpenFile:U[2]||(U[2]=ce=>d("openFile",ce)),onOpenToolDiff:U[3]||(U[3]=ce=>d("openToolDiff",ce)),onOpenAgent:U[4]||(U[4]=ce=>d("openAgent",ce))},null,8,["tools","tool-diff-panel"])):H.kind==="tool"?(w(),ve(NA,{key:3,tool:H.tool,mobile:"","tool-diff-panel":e.toolDiffPanel,onOpenMedia:U[5]||(U[5]=ce=>d("openMedia",ce)),onOpenFile:U[6]||(U[6]=ce=>d("openFile",ce)),onOpenToolDiff:U[7]||(U[7]=ce=>d("openToolDiff",ce)),onOpenAgent:U[8]||(U[8]=ce=>d("openAgent",ce))},null,8,["tool","tool-diff-panel"])):ie("",!0)],64))),128)),G.id!==c.value&&Me(ne)&&(X(ne).trim().length>0||G.durationMs!==void 0)?(w(),N("div",lY,[oe(Ht,{text:`${G.durationMs} ms`},{default:_e(()=>[G.durationMs!==void 0?(w(),N("span",aY,R(x(MP)(G.durationMs)),1)):ie("",!0)]),_:2},1032,["text"]),X(ne).trim().length>0?(w(),N("button",{key:0,class:"a-cpbtn","aria-label":x(s)("filePreview.copy"),onClick:H=>ze(ne)},[$.value!==G.id?(w(),ve(Je,{key:0,name:"copy",size:"sm"})):(w(),ve(Je,{key:1,name:"check",size:"sm"}))],8,cY)):ie("",!0)])):ie("",!0)],8,iY))],64))),128)),e.compaction?(w(),ve(SK,{key:3,label:x(s)("conversation.compacting")},null,8,["label"])):ie("",!0),u.value?(w(),N("div",uY,[oe(w3,{fast:e.fastMoon},null,8,["fast"])])):ie("",!0),e.queued.length>0?(w(),N("div",dY,[T("div",fY,[T("span",pY,[oe(Je,{name:"mail",size:"sm"}),qe(" "+R(x(s)("composer.queueLabel"))+" · ",1),T("b",null,R(e.queued.length),1)]),T("span",hY,R(x(s)("composer.queueAutoDrain")),1)]),(w(!0),N(Le,null,nt(e.queued,(G,ne)=>(w(),N("div",{key:ne,class:Re(["u-turn q-turn",{"q-dragging":p.value===ne,"drop-before":h.value?.index===ne&&h.value.position==="before","drop-after":h.value?.index===ne&&h.value.position==="after"}]),onDragover:H=>_(ne,H),onDrop:H=>g(ne,H)},[T("div",gY,[T("span",{class:"q-grip",title:x(s)("composer.queueDragTitle"),draggable:"true",onDragstart:H=>b(ne,H),onDragend:v},[oe(Je,{name:"grip",size:"sm"})],40,vY),T("button",{type:"button",class:"q-body",title:f(G)?x(s)("composer.queuedHasImage",{n:G.attachments?.length??0}):x(s)("composer.editQueued"),disabled:f(G),onClick:H=>m(ne,G)},[G.text?(w(),N("span",kY,R(G.text),1)):(w(),N("span",bY,[oe(Je,{name:"image",size:"sm"}),qe(" "+R(x(s)("composer.queuedImageOnly",{n:G.attachments?.length??0})),1)]))],8,yY),f(G)?(w(),N("div",_Y,[(w(!0),N(Le,null,nt(G.attachments,(H,J)=>(w(),ve(lv,{key:J,url:H.url,kind:H.kind,"file-id":H.fileId,"media-class":"q-img",controls:!1,muted:""},null,8,["url","kind","file-id"]))),128))])):ie("",!0),ne===0?(w(),N("span",wY,R(x(s)("composer.queueNext")),1)):(w(),N("span",SY,"#"+R(ne+1),1)),T("button",{type:"button",class:"q-rm","aria-label":x(s)("composer.remove"),onClick:vt(H=>d("unqueue",ne),["stop"])},[oe(Je,{name:"close",size:"sm"})],8,CY)])],42,mY))),128))])):ie("",!0)]))}}),S3=ut(AY,[["__scopeId","data-v-e76f848f"]]),TY={class:"ch-id"},MY={key:0,class:"ch-ws"},EY={key:1,class:"ch-sep"},IY=["onKeydown"],$Y={class:"ch-ses"},NY={key:0,class:"ch-pill ch-sync-pill"},LY={key:0,class:"ch-ahead"},OY={key:1,class:"ch-behind"},PY={key:1,class:"ch-pill ch-diff-pill"},RY={key:0,class:"ch-add"},DY={key:1,class:"ch-del"},BY=je({__name:"ChatHeader",props:{sessionId:{},workspaceName:{},workspaceRoot:{},sessionTitle:{},branch:{},ahead:{},behind:{},changesCount:{},gitDiffStats:{},isGitRepo:{type:Boolean},pr:{},copied:{type:Boolean}},emits:["copyAll","copyFinalSummary","openChanges","openPr","renameSession","forkSession","archiveSession"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=e,i=t,r=F(()=>o.ahead??0),l=F(()=>o.behind??0),a=F(()=>o.gitDiffStats?.totalAdditions??0),c=F(()=>o.gitDiffStats?.totalDeletions??0),u=F(()=>a.value>0||c.value>0),d=Z(!1),p=Z(null),h=Z(null),f=Z({});function m(D){const W=D.target;h.value?.el?.contains(W)||p.value?.el?.contains(W)||g()}function b(){g()}async function _(D){if(D.stopPropagation(),d.value){g();return}d.value=!0,document.addEventListener("mousedown",m),window.addEventListener("resize",b),await ht();const W=p.value?.el,z=h.value?.el;if(!W||!z)return;const q=W.getBoundingClientRect(),Q=4,X=8,fe=z.offsetWidth,ye=z.offsetHeight;let Me=q.bottom+Q;Me+ye>window.innerHeight-X&&(Me=Math.max(X,q.top-ye-Q));let we=q.left;we+fe>window.innerWidth-X&&(we=Math.max(X,q.right-fe)),f.value={top:`${Math.round(Me)}px`,left:`${Math.round(we)}px`}}function g(){d.value=!1,document.removeEventListener("mousedown",m),window.removeEventListener("resize",b)}kn(()=>{document.removeEventListener("mousedown",m),window.removeEventListener("resize",b)});function v(){i("copyAll"),g()}function y(){i("copyFinalSummary"),g()}const A=Z(!1);function O(){o.sessionId&&zs(o.sessionId).then(D=>{D&&(A.value=!0,setTimeout(()=>{A.value=!1},1200))})}const $=Z(!1),k=Z(""),E=Z(null);async function M(){if(g(),!!o.sessionId){$.value=!0,k.value=o.sessionTitle??"",await ht();try{E.value?.focus(),E.value?.select()}catch{}}}function L(){const D=k.value.trim();D&&o.sessionId&&D!==(o.sessionTitle??"").trim()&&i("renameSession",o.sessionId,D),$.value=!1}function S(){$.value=!1}function I(){o.sessionId&&(g(),i("forkSession",o.sessionId))}async function P(){o.sessionId&&(g(),await s({title:n("header.archiveSession"),message:n("sidebar.archiveConfirm"),variant:"danger"})&&i("archiveSession",o.sessionId))}return(D,W)=>(w(),N("header",{class:Re(["chat-header",{"macos-desktop":x(AA)}])},[T("div",TY,[e.workspaceName?(w(),N("span",MY,R(e.workspaceName),1)):ie("",!0),e.workspaceName&&e.sessionTitle?(w(),N("span",EY,"/")):ie("",!0),$.value?Mn((w(),N("input",{key:2,ref_key:"renameInputRef",ref:E,"onUpdate:modelValue":W[0]||(W[0]=z=>k.value=z),class:"ch-rename",type:"text",onKeydown:[di(vt(L,["stop"]),["enter"]),di(vt(S,["stop"]),["esc"])],onBlur:L,onClick:W[1]||(W[1]=vt(()=>{},["stop"]))},null,40,IY)),[[ko,k.value]]):e.sessionTitle?(w(),ve(Ht,{key:3,text:e.sessionTitle},{default:_e(()=>[T("span",$Y,R(e.sessionTitle),1)]),_:1},8,["text"])):ie("",!0)]),oe(gn,{ref_key:"kebabRef",ref:p,class:Re(["ch-act-more",{open:d.value}]),label:x(n)("header.options"),"aria-expanded":d.value,"aria-haspopup":"menu",onClick:W[2]||(W[2]=vt(z=>_(z),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"md"})]),_:1},8,["class","label","aria-expanded"]),d.value?(w(),ve(Wl,{key:0,ref_key:"menuRef",ref:h,class:"ch-menu",style:Gt(f.value),onClick:W[3]||(W[3]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:v},{default:_e(()=>[qe(R(e.copied?x(n)("header.copied"):x(n)("header.copyAll")),1)]),_:1}),oe(fn,{onClick:y},{default:_e(()=>[qe(R(x(n)("header.copyFinalSummary")),1)]),_:1}),e.sessionId?(w(),N(Le,{key:0},[oe(fn,{separator:""}),oe(fn,{onClick:O},{default:_e(()=>[qe(R(A.value?x(n)("header.copied"):x(n)("header.copySessionId")),1)]),_:1}),oe(fn,{onClick:M},{default:_e(()=>[qe(R(x(n)("header.renameSession")),1)]),_:1}),oe(fn,{onClick:I},{default:_e(()=>[qe(R(x(n)("header.forkSession")),1)]),_:1}),oe(fn,{danger:"",onClick:P},{default:_e(()=>[qe(R(x(n)("header.archiveSession")),1)]),_:1})],64)):ie("",!0)]),_:1},8,["style"])):ie("",!0),W[6]||(W[6]=T("div",{class:"ch-spacer"},null,-1)),e.isGitRepo?(w(),N("button",{key:1,type:"button",class:"ch-git",onClick:W[4]||(W[4]=z=>i("openChanges"))},[T("span",{class:Re(["ch-branch",{"ch-detached":!e.branch}])},R(e.branch||x(n)("header.detached")),3),r.value>0||l.value>0?(w(),N("span",NY,[r.value>0?(w(),N("span",LY,"↑"+R(r.value),1)):ie("",!0),l.value>0?(w(),N("span",OY,"↓"+R(l.value),1)):ie("",!0)])):ie("",!0),u.value?(w(),N("span",PY,[a.value>0?(w(),N("span",RY,"+"+R(a.value),1)):ie("",!0),c.value>0?(w(),N("span",DY,"-"+R(c.value),1)):ie("",!0)])):ie("",!0)])):ie("",!0),e.pr?(w(),N("button",{key:2,type:"button",class:Re(["ch-pill ch-pr",`pr-${e.pr.state}`]),onClick:W[5]||(W[5]=z=>e.pr&&i("openPr",e.pr.url))},[oe(Je,{name:"git-pull-request",size:"sm"}),T("span",null,"PR #"+R(e.pr.number)+" · "+R(e.pr.state),1)],2)):ie("",!0)],2))}}),FY=ut(BY,[["__scopeId","data-v-f18c3cf2"]]),HY={key:0,class:"slash-menu",role:"listbox"},WY=["aria-selected","onMouseenter","onMousedown"],zY={class:"slash-name"},UY={class:"slash-desc"},qY=je({__name:"SlashMenu",props:{items:{},activeIndex:{}},emits:["select","hover"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z([]);return Ke(()=>s.activeIndex,r=>{i.value[r]?.scrollIntoView({block:"nearest"})}),(r,l)=>e.items.length>0?(w(),N("div",HY,[(w(!0),N(Le,null,nt(e.items,(a,c)=>(w(),N("div",{ref_for:!0,ref:u=>{u&&(i.value[c]=u)},key:`${a.name}-${c}`,class:Re(["slash-item",{active:c===s.activeIndex}]),role:"option","aria-selected":c===s.activeIndex,onMouseenter:u=>o("hover",c),onMousedown:vt(u=>o("select",a),["prevent"])},[T("span",zY,R(a.name),1),T("span",UY,R(a.isSkill?a.desc:x(n)(a.desc)),1)],42,WY))),128))])):ie("",!0)}}),jY=ut(qY,[["__scopeId","data-v-c9b2a03c"]]),VY={class:"mention-menu",role:"listbox"},KY={key:0,class:"mention-state dim"},GY={key:1,class:"mention-state dim"},YY=["aria-selected","onMouseenter","onMousedown"],XY=["innerHTML"],QY={class:"mention-name"},ZY={class:"mention-path"},JY=je({__name:"MentionMenu",props:{items:{},activeIndex:{},loading:{type:Boolean}},emits:["select","hover"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Ia("folder","sm"),r=Ia("code","sm"),l=Ia("file-text","sm"),a=Ia("image","sm"),c=Ia("file","sm"),u=new Set(["ts","tsx","js","jsx","mjs","cjs","vue","json","py","go","rs","java","kt","c","h","cpp","cc","hpp","cs","rb","php","swift","sh","bash","zsh","css","scss","less","html","htm","xml","sql","yaml","yml","toml","lua","dart","scala","clj","ex","exs"]),d=new Set(["md","markdown","mdx","txt","rst","adoc","pdf","doc","docx"]),p=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]);function h(f){const m=f.path;if(m.endsWith("/"))return i;const b=f.name||m.split("/").pop()||m,_=b.lastIndexOf("."),g=_>0?b.slice(_+1).toLowerCase():"";return g?u.has(g)?r:d.has(g)?l:p.has(g)?a:c:c}return(f,m)=>(w(),N("div",VY,[n.loading?(w(),N("div",KY,R(x(o)("mention.searching")),1)):n.items.length===0?(w(),N("div",GY,R(x(o)("mention.noMatch")),1)):(w(!0),N(Le,{key:2},nt(n.items,(b,_)=>(w(),N("div",{key:b.path,class:Re(["mention-item",{active:_===n.activeIndex}]),role:"option","aria-selected":_===n.activeIndex,onMouseenter:g=>s("hover",_),onMousedown:vt(g=>s("select",b),["prevent"])},[T("span",{class:"mention-icon",innerHTML:h(b),"aria-hidden":"true"},null,8,XY),T("span",QY,R(b.name),1),T("span",ZY,R(b.path),1)],42,YY))),128))]))}}),eX=ut(JY,[["__scopeId","data-v-81323377"]]),C3=[{name:"/help",desc:"commands.help.desc"},{name:"/new",desc:"commands.new.desc"},{name:"/clear",desc:"commands.clear.desc"},{name:"/model",desc:"commands.model.desc"},{name:"/login",desc:"commands.login.desc"},{name:"/permission",desc:"commands.permission.desc"},{name:"/plan",desc:"commands.plan.desc"},{name:"/swarm",desc:"commands.swarm.desc",acceptsInput:!0},{name:"/goal",desc:"commands.goal.desc",acceptsInput:!0},{name:"/btw",desc:"commands.btw.desc",acceptsInput:!0},{name:"/auto",desc:"commands.auto.desc"},{name:"/yolo",desc:"commands.yolo.desc"},{name:"/thinking",desc:"commands.thinking.desc"},{name:"/compact",desc:"commands.compact.desc",acceptsInput:!0},{name:"/undo",desc:"commands.undo.desc"},{name:"/fork",desc:"commands.fork.desc"},{name:"/status",desc:"commands.status.desc"}];function tX(e){if(!e.startsWith("/"))return null;const t=e.indexOf(" ");return t===-1?{cmd:e,arg:""}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}function x3(e=[]){const t=e.map(n=>({name:`/${n.name}`,desc:n.description,isSkill:!0,acceptsInput:!0}));return[...C3,...t]}function nX(e,t=C3){const n=e.toLowerCase().trim().replace(/^\//,"");return n===""?t:t.map((s,o)=>{const i=s.name.toLowerCase().replace(/^\//,"");let r=0;return i===n?r=3:i.startsWith(n)?r=2:i.includes(n)&&(r=1),{item:s,index:o,score:r}}).filter(({score:s})=>s>0).sort((s,o)=>s.score!==o.score?o.score-s.score:s.index-o.index).map(({item:s})=>s)}function fd(e){if(e===void 0)return"toggle";const t=e.capabilities??[];return t.includes("always_thinking")?"always-on":t.includes("thinking")||e.adaptiveThinking===!0?"toggle":"unsupported"}function ky(e){return e?.supportEfforts??[]}function sX(e){return e[Math.floor(e.length/2)]}function B1(e){if(fd(e)==="unsupported")return"off";const t=ky(e);return t.length>0?e?.defaultEffort??sX(t):"on"}function by(e){const t=ky(e),n=fd(e);return t.length>0?n==="always-on"?[...t]:["off",...t]:n==="always-on"?["on"]:n==="unsupported"?["off"]:["on","off"]}function F1(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function oX(e){return e!=="off"}function fc(e,t){if(e===void 0)return t;const n=fd(e);if(n==="unsupported")return"off";if(t==="off")return n==="always-on"?B1(e):"off";const s=ky(e);return s.length>0?s.includes(t)?t:B1(e):"on"}function _y(e,t){return t==="off"?"off":t==="on"?B1(e):t}const Fp=100;function iX(e){const t=od(Et.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const s=n.length>Fp?n.slice(-Fp):n,o={[e]:s};return yc(Et.inputHistory,o),o}return t&&typeof t=="object"?t:{}}function rX(e){const{text:t,textareaRef:n,autosize:s,sessionId:o}=e,i=Z(iX(o())),r=F(()=>i.value[o()??""]??[]);let l=-1,a="";function c(_){const g=o();if(l=-1,!g)return;const v=_.trim();if(!v)return;const y=i.value[g]??[];if(y.at(-1)===v)return;const A=[...y,v],O=A.length>Fp?A.slice(-Fp):A;i.value={...i.value,[g]:O},yc(Et.inputHistory,i.value)}function u(){const _=n.value;return _?(_.selectionStart??0)===0:!1}function d(_){t.value=_,ht(()=>{const g=n.value;if(!g)return;s();const v=_.length;g.setSelectionRange(v,v)})}function p(){const _=r.value;if(_.length!==0){if(l===-1)a=t.value,l=_.length-1;else if(l>0)l-=1;else return;d(_[l])}}function h(){if(l===-1)return;const _=r.value;l<_.length-1?(l+=1,d(_[l])):(l=-1,d(a))}function f(){l=-1}function m(){return l!==-1}function b(){return r.value.length>0}return Ke(o,()=>{l=-1}),{push:c,caretAtTextStart:u,recallOlder:p,recallNewer:h,resetBrowsing:f,isBrowsing:m,hasHistory:b}}function lX(e){const{text:t,textareaRef:n,autosize:s,skills:o,emitCommand:i,historyPush:r,clearDraft:l}=e,a=Z(!1),c=Z([]),u=Z(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(c.value=nX(h,x3(o())),u.value=0,a.value=c.value.length>0):a.value=!1}function p(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,ht(()=>{const f=n.value;if(!f)return;const m=t.value.length;f.setSelectionRange(m,m),f.focus(),s()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:c,active:u,update:d,select:p}}function aX(e){const{text:t,textareaRef:n,autosize:s,searchFiles:o}=e,i=Z(!1),r=Z([]),l=Z(0),a=Z(!1);let c=null;function u(){const h=t.value,f=n.value?.selectionStart??h.length;let m=f-1;for(;m>=0&&!/\s/.test(h[m]);)m--;m++;const b=h.slice(m,f);return b.startsWith("@")?{token:b.slice(1),start:m,end:f}:null}function d(){const h=u(),f=o();if(!h||!f){i.value=!1;return}const m=h.token;c!==null&&clearTimeout(c),c=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;try{r.value=await f(m)}catch{r.value=[]}finally{a.value=!1}},200)}function p(h){const f=u();if(!f)return;const m=t.value;t.value=m.slice(0,f.start)+h.path+m.slice(f.end),i.value=!1,ht(()=>{const b=n.value;if(!b)return;const _=f.start+h.path.length;b.setSelectionRange(_,_),b.focus(),s()})}return{open:i,items:r,active:l,loading:a,update:d,select:p}}function cX(e){const{sessionId:t}=e;function n(c){return Qn(x_(c))??""}function s(c,u){const d=x_(c);u?ts(d,u):cc(d)}const o=Z(n(t())),i=Z(null);function r(){const c=i.value;c&&(c.style.height="auto",c.style.height=`${c.scrollHeight}px`)}Ke(o,c=>{ht(r),s(t(),c)}),Ke(t,(c,u)=>{c!==u&&(s(u,o.value),o.value=n(c),ht(r))});function l(c){o.value=c,ht(()=>{const u=i.value;if(!u)return;u.focus();const d=c.length;u.setSelectionRange(d,d),r()})}function a(){s(t(),"")}return{text:o,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function uX(e){const{uploadImage:t,sessionId:n}=e,s=Z({}),o=F(()=>s.value[n()??""]??[]),i=Z(null),r=Z(null),l=Z(!1);let a=0;function c(){return`att_${++a}`}function u(k,E){s.value={...s.value,[k]:E}}function d(k){try{URL.revokeObjectURL(k.previewUrl)}catch{}}function p(k){return k.startsWith("image/")?"image":k.startsWith("video/")?"video":null}async function h(k){const E=t();if(!E)return;const M=n()??"",L=k.map(S=>({file:S,kind:p(S.type)})).filter(S=>S.kind!==null);if(L.length!==0)for(const{file:S,kind:I}of L){const P=c(),D=URL.createObjectURL(S),W={localId:P,name:S.name,kind:I,previewUrl:D,uploading:!0};u(M,[...s.value[M]??[],W]),E(S,S.name).then(z=>{const q=s.value[M]??[];u(M,q.map(Q=>Q.localId===P?{...Q,uploading:!1,fileId:z?.fileId,error:z===null}:Q))}).catch(()=>{const z=s.value[M]??[];u(M,z.map(q=>q.localId===P?{...q,uploading:!1,error:!0}:q))})}}function f(k){const E=n()??"",M=s.value[E]??[],L=M.find(S=>S.localId===k);i.value?.localId===k&&(i.value=null),L&&d(L),u(E,M.filter(S=>S.localId!==k))}function m(k){i.value=k}function b(){i.value=null}function _(){r.value?.click()}function g(k){const E=k.target,M=Array.from(E.files??[]);h(M),E.value=""}function v(k){if(!t())return;const E=k.clipboardData;if(!E)return;const M=[],L=new Set,S=(I,P)=>{const D=`${I.size}:${I.type}:${P}`;if(L.has(D))return;L.add(D);const W=I.type.split("/")[1]??"png",z=P.includes(".")?P:`paste-${Date.now()}.${W}`;M.push(I instanceof File?I:new File([I],z,{type:I.type}))};for(const I of Array.from(E.items))if(I.kind==="file"&&p(I.type)){const P=I.getAsFile();P&&S(P,P.name||`paste-${Date.now()}.${I.type.split("/")[1]??"png"}`)}for(const I of Array.from(E.files))p(I.type)&&S(I,I.name);M.length!==0&&(k.preventDefault(),h(M))}function y(k){!t()||!Array.from(k.dataTransfer?.items??[]).some(M=>M.kind==="file")||(k.preventDefault(),l.value=!0)}function A(){l.value=!1}function O(k){if(l.value=!1,!t())return;k.preventDefault();const E=Array.from(k.dataTransfer?.files??[]);h(E)}function $(){const k=n()??"";for(const E of s.value[k]??[])d(E);u(k,[])}return Ke(n,()=>{i.value=null}),hn(()=>{document.addEventListener("paste",v)}),kn(()=>{document.removeEventListener("paste",v);for(const k of Object.values(s.value))for(const E of k)d(E);i.value=null}),{attachments:o,previewAttachment:i,fileInputRef:r,isDragOver:l,removeAttachment:f,openAttachmentPreview:m,closeAttachmentPreview:b,openFilePicker:_,handleFileInputChange:g,handleDragOver:y,handleDragLeave:A,handleDrop:O,clearAfterSubmit:$}}const dX={class:"ctx-ring",viewBox:"0 0 20 20","aria-hidden":"true"},fX=["stroke-dasharray","stroke-dashoffset"],av=7,pX=je({__name:"ContextRing",props:{pct:{}},setup(e){const t=e,n=2*Math.PI*av;return(s,o)=>(w(),N("svg",dX,[T("circle",{class:"ctx-ring-track",cx:"10",cy:"10",r:av,fill:"none","stroke-width":"2.5"}),T("circle",{class:"ctx-ring-fill",cx:"10",cy:"10",r:av,fill:"none","stroke-width":"2.5","stroke-linecap":"round","stroke-dasharray":`${n}`,"stroke-dashoffset":`${n*(1-t.pct/100)}`},null,8,fX)]))}}),hX=ut(pX,[["__scopeId","data-v-a03ef5f7"]]),mX={key:0,class:"att-strip"},gX=["onClick"],vX=["src"],yX=["src","alt"],kX={key:2,class:"att-video-badge","aria-hidden":"true"},bX={class:"att-name"},_X={class:"att-err-icon"},wX=["onClick"],SX={class:"att-lightbox-card"},CX=["src"],xX=["src","alt"],AX={class:"att-lightbox-name"},TX={class:"composer-card"},MX={class:"cin-wrap"},EX={class:"input-row"},IX=["placeholder"],$X=["aria-label"],NX={class:"toolbar-left"},LX=["onKeydown"],OX=["onClick"],PX={class:"pd-check"},RX={class:"pd-info"},DX={class:"pd-desc"},BX={class:"mode-label"},FX={key:0,class:"mode-tag"},HX={key:1,class:"mode-tag"},WX={key:2,class:"mode-tag"},zX={class:"mode-row-name"},UX={class:"mode-row-name"},qX={class:"mode-row-name"},jX={key:0,class:"mode-row-actions"},VX={class:"toolbar-right"},KX={key:0,class:"ctx-group"},GX={class:"ctx-num"},YX=["onKeydown"],XX={key:0,class:"think-suffix"},QX=["aria-label"],ZX=["aria-label"],JX={key:0,class:"md-section"},eQ=["onClick"],tQ={class:"md-check"},nQ={class:"md-name"},sQ={class:"md-provider"},oQ={key:1,class:"md-divider"},iQ={key:2,class:"md-section"},rQ=["onClick"],lQ={class:"md-check"},aQ={class:"md-name"},cQ={key:3,class:"md-divider"},uQ={class:"md-name"},dQ={key:0,class:"md-note"},fQ=["aria-label"],pQ=["disabled","onClick"],hQ={class:"md-name"},KS=36,mQ=je({__name:"Composer",props:{running:{type:Boolean,default:!1},sessionId:{},queued:{default:()=>[]},searchFiles:{type:Function,default:void 0},uploadImage:{type:Function,default:void 0},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},activationBadges:{},models:{default:()=>[]},starredIds:{default:()=>[]},skills:{default:()=>[]},hideContext:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel"],setup(e,{expose:t,emit:n}){const s=e,o=F(()=>s.running?r("composer.placeholderRunning"):s.goalMode?r("status.goalPlaceholder"):r("composer.placeholder")),i=n,{t:r}=It(),{text:l,textareaRef:a,autosize:c,loadForEdit:u,clearDraft:d}=cX({sessionId:()=>s.sessionId}),p=Z(!1);function h(){p.value=!p.value,ht(()=>{c(),_(),a.value?.focus()})}function f(){p.value&&(p.value=!1,ht(c))}function m(Xe){if(typeof getComputedStyle>"u")return KS;const ot=Number.parseFloat(getComputedStyle(Xe).minHeight);return Number.isFinite(ot)&&ot>0?ot:KS}const b=Z(!1);function _(){const Xe=a.value;b.value=!!Xe&&Xe.scrollHeight>m(Xe)}Ke(l,()=>{ht(_)}),Ke(()=>s.sessionId,()=>{p.value=!1});const g=rX({text:l,textareaRef:a,autosize:c,sessionId:()=>s.sessionId}),{open:v,items:y,active:A,update:O,select:$}=lX({text:l,textareaRef:a,autosize:c,skills:()=>s.skills,emitCommand:Xe=>i("command",Xe),historyPush:Xe=>g.push(Xe),clearDraft:d}),{open:k,items:E,active:M,loading:L,update:S,select:I}=aX({text:l,textareaRef:a,autosize:c,searchFiles:()=>s.searchFiles});function P(){g.resetBrowsing(),O(),S()}const{attachments:D,previewAttachment:W,fileInputRef:z,isDragOver:q,removeAttachment:Q,openAttachmentPreview:X,closeAttachmentPreview:fe,openFilePicker:ye,handleFileInputChange:Me,handleDragOver:we,handleDragLeave:ze,handleDrop:Ue,clearAfterSubmit:Fe}=uX({uploadImage:()=>s.uploadImage,sessionId:()=>s.sessionId});hn(()=>{l.value&&ht(()=>{c(),_()})}),kn(()=>{document.removeEventListener("mousedown",Ln),H()});function rt(){a.value?.focus({preventScroll:!0})}t({loadForEdit:u,focus:rt});function le(){const Xe=l.value.trim();if(D.value.some(pe=>pe.uploading))return;const ot=D.value.filter(pe=>!pe.uploading&&!pe.error&&pe.fileId);if(!Xe&&ot.length===0)return;if(g.push(Xe),Xe){const pe=tX(Xe),Oe=pe?x3(s.skills).some(Qt=>Qt.name===pe.cmd):!1;if(pe&&Oe){l.value="",d(),v.value=!1,f(),i("command",pe.arg?`${pe.cmd} ${pe.arg}`:pe.cmd);return}}const de={text:Xe,attachments:ot.map(pe=>({fileId:pe.fileId,kind:pe.kind}))};W.value=null,Fe(),l.value="",d(),v.value=!1,k.value=!1,f(),i("submit",de)}function U(){if(!s.running||D.value.some(pe=>pe.uploading))return;const Xe=l.value.trim(),ot=D.value.filter(pe=>!pe.uploading&&!pe.error&&pe.fileId);if(!Xe&&ot.length===0&&s.queued.length===0)return;const de={text:Xe,attachments:ot.map(pe=>({fileId:pe.fileId,kind:pe.kind}))};Fe(),g.push(Xe),l.value="",d(),v.value=!1,k.value=!1,f(),i("steer",de)}let G=!1,ne=null;function H(){ne!==null&&(clearTimeout(ne),ne=null)}function J(){H(),G=!0}function ce(){H(),ne=setTimeout(()=>{ne=null,G=!1},0)}function te(Xe){return G||Xe.isComposing||Xe.keyCode===229}function ue(Xe){if(!te(Xe)){if(Xe.key==="Escape"){if(re.value){Xe.preventDefault(),ae();return}if(ge.value){Xe.preventDefault(),Ve();return}}if(v.value){if(Xe.key==="ArrowDown"){Xe.preventDefault(),A.value=(A.value+1)%y.value.length;return}if(Xe.key==="ArrowUp"){Xe.preventDefault(),A.value=(A.value-1+y.value.length)%y.value.length;return}if(Xe.key==="Enter"||Xe.key==="Tab"){Xe.preventDefault();const ot=y.value[A.value];ot&&$(ot);return}if(Xe.key==="Escape"){Xe.preventDefault(),v.value=!1;return}}if(k.value&&!L.value){if(Xe.key==="ArrowDown"){Xe.preventDefault(),M.value=(M.value+1)%Math.max(1,E.value.length);return}if(Xe.key==="ArrowUp"){Xe.preventDefault(),M.value=(M.value-1+Math.max(1,E.value.length))%Math.max(1,E.value.length);return}if(Xe.key==="Enter"||Xe.key==="Tab"){Xe.preventDefault();const ot=E.value[M.value];ot&&I(ot);return}if(Xe.key==="Escape"){Xe.preventDefault(),k.value=!1;return}}if(Xe.key==="s"&&(Xe.ctrlKey||Xe.metaKey)&&!Xe.shiftKey&&!Xe.altKey){s.running&&(Xe.preventDefault(),U());return}if(!p.value&&!v.value&&!k.value&&!Xe.shiftKey&&!Xe.altKey&&!Xe.metaKey&&!Xe.ctrlKey){const ot=g.isBrowsing();if(Xe.key==="ArrowUp"&&g.hasHistory()&&(ot||g.caretAtTextStart())){Xe.preventDefault(),g.recallOlder();return}if(Xe.key==="ArrowDown"&&ot){Xe.preventDefault(),g.recallNewer();return}}if(Xe.key==="Enter"&&!Xe.shiftKey){if(p.value&&!(Xe.metaKey||Xe.ctrlKey))return;Xe.preventDefault(),le()}}}const j=F(()=>r("composer.send")),Y=F(()=>!!s.uploadImage),re=Z(!1),ge=Z(!1),Ae=Z(null);function Ie(){re.value=!re.value,re.value?(ge.value=!1,tn(),document.addEventListener("click",tt,!0)):document.removeEventListener("click",tt,!0)}function ae(){re.value=!1,ge.value||document.removeEventListener("click",tt,!0)}function Te(){ge.value=!ge.value,ge.value?(re.value=!1,tn(),document.addEventListener("click",tt,!0)):document.removeEventListener("click",tt,!0)}function Ve(){ge.value=!1,re.value||document.removeEventListener("click",tt,!0)}function tt(Xe){Ae.value&&!Ae.value.contains(Xe.target)&&(ae(),Ve())}kn(()=>{document.removeEventListener("click",tt,!0)});const bt=Xe=>`${Math.round(Xe/1e3)}k`,kt=F(()=>{const Xe=s.status?.ctxMax??0;return Xe<=0?0:Math.min(100,Math.max(0,Math.round((s.status?.ctxUsed??0)/Xe*100)))}),Tt=F(()=>{const Xe=(s.status?.ctxUsed??0).toLocaleString(),ot=(s.status?.ctxMax??0).toLocaleString();return r("status.ctxTooltip",{used:Xe,max:ot,pct:kt.value})}),Pt=F(()=>kt.value>=80),mt=F(()=>{const Xe=s.status?.modelId??s.status?.model??"";return s.models?.find(ot=>ot.id===Xe||ot.model===Xe||ot.displayName===s.status?.model)}),Yt=F(()=>fd(mt.value)),Rn=F(()=>by(mt.value)),Dn=F(()=>fc(mt.value,s.thinking??"off")),Ft=F(()=>{const Xe=Rn.value,ot=Dn.value;return Xe.includes(ot)?ot:Xe.includes("on")?"on":Xe[0]??"off"}),bn=F(()=>Yt.value==="always-on"?!0:Yt.value==="unsupported"?!1:oX(Dn.value)),Vn=F(()=>Yt.value==="unsupported"||Rn.value.length<=1),st=F(()=>{if(!bn.value)return"";const Xe=(mt.value?.supportEfforts?.length??0)>0,ot=Dn.value;return Xe&&ot!=="on"?r("composer.thinkingSuffixEffort",{level:ot}):r("composer.thinkingSuffix")});function In(Xe){Vn.value||i("setThinking",_y(mt.value,Xe))}const _n=F(()=>s.planMode===!0),Kn=F(()=>s.swarmMode===!0),$n=F(()=>s.activationBadges?.goal!==null),Ge=F(()=>$n.value||s.goalMode===!0),Ye=Z(!1),Ct=Z(null),$t=Z(null),mn=Z({}),Nn=F(()=>_n.value||Kn.value||Ge.value);function tn(){Ye.value=!1,document.removeEventListener("mousedown",Ln)}function Ln(Xe){const ot=Xe.target;Ct.value?.contains(ot)||$t.value?.contains(ot)||tn()}function Zn(){if(Ye.value){tn();return}ae(),Ve();const Xe=Ct.value?.getBoundingClientRect();Xe&&(mn.value={left:`${Math.round(Xe.left)}px`,bottom:`${Math.round(window.innerHeight-Xe.top+8)}px`}),Ye.value=!0,setTimeout(()=>document.addEventListener("mousedown",Ln),0)}const Mt=[{mode:"manual",color:"var(--dim)",labelKey:"status.permissionManual",descKey:"status.permissionManualDesc"},{mode:"yolo",color:"var(--color-warning)",labelKey:"status.permissionYolo",descKey:"status.permissionYoloDesc"},{mode:"auto",color:"var(--color-danger)",labelKey:"status.permissionAuto",descKey:"status.permissionAutoDesc"}];function us(Xe){i("setPermission",Xe),Ve()}const Xt=F(()=>Mt.find(Xe=>Xe.mode===s.status?.permission)),oi=F(()=>Xt.value?r(Xt.value.labelKey):""),bs=F(()=>mt.value?.provider??""),Do=F(()=>!bs.value||!s.models?.length?[]:s.models.filter(Xe=>Xe.provider===bs.value)),so=F(()=>new Set(s.starredIds??[]));function qs(Xe){return so.value.has(Xe)}const oo=F(()=>s.models?.length?s.models.filter(Xe=>qs(Xe.id)&&Xe.provider!==bs.value):[]);function Nt(Xe){i("selectModel",Xe),ae()}return(Xe,ot)=>(w(),N("div",{class:Re(["composer",{"drag-over":x(q),expanded:p.value}]),onDragover:ot[17]||(ot[17]=(...de)=>x(we)&&x(we)(...de)),onDragleave:ot[18]||(ot[18]=(...de)=>x(ze)&&x(ze)(...de)),onDrop:ot[19]||(ot[19]=(...de)=>x(Ue)&&x(Ue)(...de))},[x(D).length>0?(w(),N("div",mX,[(w(!0),N(Le,null,nt(x(D),de=>(w(),N("div",{key:de.localId,class:Re(["att-chip",{"att-error":de.error}])},[oe(Ht,{text:x(r)("composer.previewAttachment",{name:de.name})},{default:_e(()=>[T("button",{type:"button",class:"att-preview",onClick:pe=>x(X)(de)},[de.kind==="video"?(w(),N("video",{key:0,class:"att-thumb",src:de.previewUrl,muted:"",playsinline:"",preload:"metadata"},null,8,vX)):(w(),N("img",{key:1,class:"att-thumb",src:de.previewUrl,alt:de.name},null,8,yX)),de.kind==="video"?(w(),N("span",kX,[oe(Je,{name:"play",size:"sm"})])):ie("",!0)],8,gX)]),_:2},1032,["text"]),T("span",bX,R(de.name),1),de.uploading?(w(),ve(ni,{key:0,size:"sm",label:x(r)("composer.uploading")},null,8,["label"])):de.error?(w(),ve(Ht,{key:1,text:x(r)("composer.uploadFailed")},{default:_e(()=>[T("span",_X,[oe(Je,{name:"info",size:"sm"})])]),_:1},8,["text"])):ie("",!0),oe(Ht,{text:x(r)("composer.removeNamed",{name:de.name})},{default:_e(()=>[T("button",{class:"att-rm",onClick:pe=>x(Q)(de.localId)},[oe(Je,{name:"close",size:"sm"})],8,wX)]),_:2},1032,["text"])],2))),128))])):ie("",!0),x(W)?(w(),N("div",{key:1,class:"att-lightbox",onClick:ot[1]||(ot[1]=vt((...de)=>x(fe)&&x(fe)(...de),["self"]))},[T("div",SX,[oe(Ht,{text:x(r)("model.close")},{default:_e(()=>[T("button",{type:"button",class:"att-lightbox-close",onClick:ot[0]||(ot[0]=(...de)=>x(fe)&&x(fe)(...de))},"✕")]),_:1},8,["text"]),x(W).kind==="video"?(w(),N("video",{key:0,class:"att-lightbox-media",src:x(W).previewUrl,controls:"",playsinline:""},null,8,CX)):(w(),N("img",{key:1,class:"att-lightbox-media",src:x(W).previewUrl,alt:x(W).name},null,8,xX)),T("div",AX,R(x(W).name),1)])])):ie("",!0),T("div",TX,[T("div",MX,[x(v)?(w(),ve(jY,{key:0,items:x(y),"active-index":x(A),onSelect:x($),onHover:ot[2]||(ot[2]=de=>A.value=de)},null,8,["items","active-index","onSelect"])):ie("",!0),x(k)?(w(),ve(eX,{key:1,items:x(E),"active-index":x(M),loading:x(L),onSelect:x(I),onHover:ot[3]||(ot[3]=de=>M.value=de)},null,8,["items","active-index","loading","onSelect"])):ie("",!0),T("div",EX,[Mn(T("textarea",{ref_key:"textareaRef",ref:a,"onUpdate:modelValue":ot[4]||(ot[4]=de=>es(l)?l.value=de:null),class:"ph",placeholder:o.value,rows:"1",onKeydown:ue,onCompositionstart:J,onCompositionend:ce,onInput:P},null,40,IX),[[ko,x(l)]]),p.value||b.value?(w(),N("button",{key:0,class:"expand-btn",type:"button","aria-label":p.value?x(r)("composer.collapseTitle"):x(r)("composer.expandTitle"),onClick:h},[p.value?(w(),ve(Je,{key:0,name:"collapse",size:"sm"})):(w(),ve(Je,{key:1,name:"expand",size:"sm"}))],8,$X)):ie("",!0)])]),Y.value?(w(),N("input",{key:0,ref_key:"fileInputRef",ref:z,type:"file",accept:"image/*,video/*",multiple:"",class:"file-input-hidden",onChange:ot[5]||(ot[5]=(...de)=>x(Me)&&x(Me)(...de))},null,544)):ie("",!0),T("div",{ref_key:"toolbarRef",ref:Ae,class:"toolbar"},[T("div",NX,[Y.value?(w(),ve(gn,{key:0,size:"md",label:x(r)("composer.attachImage"),onClick:x(ye)},{default:_e(()=>[oe(Je,{name:"image"})]),_:1},8,["label","onClick"])):ie("",!0),e.status?(w(),N("span",{key:1,class:Re(["perm-pill",["perm-"+e.status.permission,{open:ge.value}]]),role:"button",tabindex:"0",onClick:vt(Te,["stop"]),onKeydown:[di(Te,["enter"]),di(vt(Te,["prevent"]),["space"])]},R(oi.value),43,LX)):ie("",!0),ge.value&&e.status?(w(),N("div",{key:2,class:"perm-dropdown",role:"menu",onClick:ot[6]||(ot[6]=vt(()=>{},["stop"]))},[(w(),N(Le,null,nt(Mt,de=>T("button",{key:de.mode,class:Re(["pd-row",{"is-current":de.mode===e.status.permission}]),role:"menuitem",onClick:pe=>us(de.mode)},[T("span",PX,[de.mode===e.status.permission?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",RX,[T("span",{class:"pd-name",style:Gt({color:de.color})},R(x(r)(de.labelKey)),5),T("span",DX,R(x(r)(de.descKey)),1)])],10,OX)),64))])):ie("",!0),e.status?(w(),N("div",{key:3,ref_key:"modesRef",ref:Ct,class:"modes"},[T("button",{type:"button",class:Re(["mode-pill",{on:Nn.value,open:Ye.value}]),onClick:vt(Zn,["stop"])},[T("span",BX,R(x(r)("status.modesLabel")),1),_n.value?(w(),N("span",FX,R(x(r)("status.planLabel")),1)):ie("",!0),Kn.value?(w(),N("span",HX,R(x(r)("status.swarmLabel")),1)):ie("",!0),Ge.value?(w(),N("span",WX,R(x(r)("status.goalLabel")),1)):ie("",!0)],2),Ye.value?(w(),N("div",{key:0,ref_key:"modesMenuRef",ref:$t,class:"modes-menu",style:Gt(mn.value)},[T("button",{type:"button",class:Re(["mode-row",{on:_n.value}]),onClick:ot[7]||(ot[7]=de=>i("togglePlan"))},[T("span",zX,R(x(r)("status.planLabel")),1),T("span",{class:Re(["mode-switch",{on:_n.value}])},[...ot[20]||(ot[20]=[T("span",{class:"mode-knob"},null,-1)])],2)],2),T("button",{type:"button",class:Re(["mode-row",{on:Kn.value}]),onClick:ot[8]||(ot[8]=de=>i("toggleSwarm"))},[T("span",UX,R(x(r)("status.swarmLabel")),1),T("span",{class:Re(["mode-switch",{on:Kn.value}])},[...ot[21]||(ot[21]=[T("span",{class:"mode-knob"},null,-1)])],2)],2),T("div",{class:Re(["mode-row mode-row-goal",{on:$n.value||s.goalMode}])},[T("button",{type:"button",class:"mode-row-main",onClick:ot[9]||(ot[9]=de=>$n.value?i("controlGoal","cancel"):i("toggleGoal"))},[T("span",qX,R(x(r)("status.goalLabel")),1),$n.value?ie("",!0):(w(),N("span",{key:0,class:Re(["mode-switch",{on:s.goalMode}])},[...ot[22]||(ot[22]=[T("span",{class:"mode-knob"},null,-1)])],2))]),$n.value?(w(),N("div",jX,[T("button",{type:"button",class:"mode-row-action",onClick:ot[10]||(ot[10]=de=>i("controlGoal","pause"))},R(x(r)("status.goalPause")),1),T("button",{type:"button",class:"mode-row-action",onClick:ot[11]||(ot[11]=de=>i("controlGoal","resume"))},R(x(r)("status.goalResume")),1)])):ie("",!0)],2)],4)):ie("",!0)],512)):ie("",!0)]),T("div",VX,[Pt.value?(w(),N("button",{key:0,class:"compact-chip",onClick:ot[12]||(ot[12]=vt(de=>i("compact"),["stop"]))},"/compact")):ie("",!0),oe(Ht,{text:Tt.value},{default:_e(()=>[e.status&&!e.hideContext?(w(),N("span",KX,[oe(hX,{pct:kt.value},null,8,["pct"]),T("span",GX,R(bt(e.status.ctxUsed))+"/"+R(bt(e.status.ctxMax)),1)])):ie("",!0)]),_:1},8,["text"]),e.status?(w(),N("span",{key:1,class:Re(["model-pill",{open:re.value}]),role:"button",tabindex:"0",onClick:vt(Ie,["stop"]),onKeydown:[di(Ie,["enter"]),di(vt(Ie,["prevent"]),["space"])]},[T("b",null,R(e.status.model),1),st.value?(w(),N("span",XX,R(st.value),1)):ie("",!0),oe(Je,{class:"cv",name:"chevron-down",size:"sm"})],42,YX)):ie("",!0),e.running?(w(),ve(Ht,{key:2,text:x(r)("composer.interruptTitle")},{default:_e(()=>[T("button",{class:"stop","aria-label":x(r)("composer.interrupt"),onClick:ot[13]||(ot[13]=de=>i("interrupt"))},[oe(Je,{name:"stop",size:"sm"})],8,QX)]),_:1},8,["text"])):ie("",!0),T("button",{class:"send","aria-label":j.value,onClick:ot[14]||(ot[14]=de=>le())},[oe(Je,{name:"send",size:"sm"})],8,ZX)]),re.value&&e.status?(w(),N("div",{key:0,class:"model-dropdown",role:"menu",onClick:ot[16]||(ot[16]=vt(()=>{},["stop"]))},[oo.value.length>0?(w(),N("div",JX,R(x(r)("status.starredModels")),1)):ie("",!0),(w(!0),N(Le,null,nt(oo.value,de=>(w(),N("button",{key:de.id,class:Re(["md-row",{"is-current":de.id===e.status.modelId}]),role:"menuitem",onClick:pe=>Nt(de.id)},[T("span",tQ,[de.id===e.status.model||de.model===e.status.model||de.displayName===e.status.model?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",nQ,R(de.displayName??de.model),1),T("span",sQ,R(de.provider),1),oe(Je,{class:"md-star",name:"star",size:"sm"})],10,eQ))),128)),oo.value.length>0?(w(),N("div",oQ)):ie("",!0),Do.value.length>0?(w(),N("div",iQ,R(bs.value),1)):ie("",!0),(w(!0),N(Le,null,nt(Do.value,de=>(w(),N("button",{key:de.id,class:Re(["md-row",{"is-current":de.id===e.status.modelId}]),role:"menuitem",onClick:pe=>Nt(de.id)},[T("span",lQ,[de.id===e.status.model||de.model===e.status.model||de.displayName===e.status.model?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",aQ,R(de.displayName??de.model),1),qs(de.id)?(w(),ve(Je,{key:0,class:"md-star",name:"star",size:"sm"})):ie("",!0)],10,rQ))),128)),Do.value.length>0?(w(),N("div",cQ)):ie("",!0),T("div",{class:Re(["md-thinking",{"is-readonly":Vn.value}])},[T("span",uQ,R(x(r)("status.thinkingLabel")),1),Yt.value==="unsupported"?(w(),N("span",dQ,R(x(r)("status.modeNotSupported")),1)):(w(),N("div",{key:1,class:"effort-segments",role:"group","aria-label":x(r)("status.thinkingLabel")},[(w(!0),N(Le,null,nt(Rn.value,de=>(w(),N("button",{key:de,type:"button",class:Re(["effort-seg",{"is-active":de===Ft.value}]),disabled:Vn.value,onClick:pe=>In(de)},R(x(F1)(de)),11,pQ))),128))],8,fQ))],2),ot[23]||(ot[23]=T("div",{class:"md-divider"},null,-1)),T("button",{class:"md-row md-row-more",role:"menuitem",onClick:ot[15]||(ot[15]=de=>{ae(),i("pickModel")})},[T("span",hQ,R(x(r)("status.moreModels")),1)])])):ie("",!0)],512)])],34))}}),A3=ut(mQ,[["__scopeId","data-v-5012465f"]]),gQ=["id"],vQ=["aria-expanded"],yQ={class:"swarm-meta"},kQ={class:"swarm-meta"},bQ={class:"swarm-body"},_Q={class:"row-name"},wQ={key:0,class:"row-type"},SQ={key:0,class:"row-activity"},CQ={class:"row-phase"},xQ=je({__name:"SwarmCard",props:{group:{}},setup(e){const t=e,n=Z(!0),s=F(()=>t.group.members.length),o=F(()=>t.group.counts.completed+t.group.counts.failed),i=F(()=>t.group.counts.working+t.group.counts.queued+t.group.counts.suspended),r=F(()=>i.value>0?"running":t.group.counts.failed>0?"error":"done"),l=F(()=>{switch(r.value){case"running":return`${i.value} running`;case"error":return"has failures";default:return"completed"}});function a(p){switch(p){case"queued":return"Queued";case"working":return"Working";case"suspended":return"Suspended";case"completed":return"Completed";case"failed":return"Failed"}}function c(p){return p.outputLines?.map(h=>h.trimEnd()).filter(Boolean).at(-1)}function u(p){return p.suspendedReason||c(p)||p.summary}function d(){n.value=!n.value}return(p,h)=>(w(),N("section",{class:Re(["swarm-card",{open:n.value}]),id:`swarm-${e.group.id}`},[T("button",{class:"swarm-head",type:"button","aria-expanded":n.value,onClick:d},[oe(Fu,{status:r.value},null,8,["status"]),oe(Je,{class:"swarm-ic",name:"git-pull-request",size:"sm"}),h[0]||(h[0]=T("span",{class:"swarm-title"},"Swarm",-1)),T("span",yQ,"· "+R(o.value)+"/"+R(s.value),1),T("span",kQ,"· "+R(l.value),1),oe(Je,{class:"swarm-car",name:"chevron-right",size:"sm"})],8,vQ),Mn(T("div",bQ,[(w(!0),N(Le,null,nt(e.group.members,f=>(w(),N("div",{key:f.id,class:Re(["swarm-row",`phase-${f.phase}`])},[oe(Fu,{class:"row-dot",status:f.phase},null,8,["status"]),oe(Ht,{text:f.name},{default:_e(()=>[T("span",_Q,R(f.name),1)]),_:2},1032,["text"]),f.subagentType?(w(),N("span",wQ,R(f.subagentType),1)):ie("",!0),oe(Ht,{text:u(f)},{default:_e(()=>[u(f)?(w(),N("span",SQ,R(u(f)),1)):ie("",!0)]),_:2},1032,["text"]),T("span",CQ,R(a(f.phase)),1)],2))),128))],512),[[Qo,n.value]])],10,gQ))}}),AQ=ut(xQ,[["__scopeId","data-v-e56cfe7c"]]),TQ={key:0,class:"ui-card__head"},MQ={class:"ui-card__body"},EQ={key:1,class:"ui-card__foot"},IQ=je({__name:"Card",props:{elevated:{type:Boolean,default:!1}},setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-card",{"is-elevated":e.elevated}])},[t.$slots.head?(w(),N("div",TQ,[Cn(t.$slots,"head",{},void 0,!0)])):ie("",!0),T("div",MQ,[Cn(t.$slots,"default",{},void 0,!0)]),t.$slots.foot?(w(),N("div",EQ,[Cn(t.$slots,"foot",{},void 0,!0)])):ie("",!0)],2))}}),wy=ut(IQ,[["__scopeId","data-v-b608a7cc"]]),$Q=["type","disabled"],NQ={class:"ui-button__content"},LQ=je({__name:"Button",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean},loading:{type:Boolean},type:{default:"button"}},setup(e){return(t,n)=>(w(),N("button",{class:Re(["ui-button",[`ui-button--${e.variant}`,`ui-button--${e.size}`,{"is-loading":e.loading}]]),type:e.type,disabled:e.disabled||e.loading},[e.loading?(w(),ve(ni,{key:0,size:"sm",class:"ui-button__spinner"})):ie("",!0),T("span",NQ,[Cn(t.$slots,"default",{},void 0,!0)])],10,$Q))}}),Dt=ut(LQ,[["__scopeId","data-v-ca87f51a"]]),OQ={class:"goal-progress","aria-hidden":"true"},PQ={class:"goal-full"},RQ={key:0,class:"goal-criterion"},DQ={class:"goal-stats"},BQ={class:"goal-actions"},FQ=je({__name:"GoalStrip",props:{goal:{},forceExpanded:{}},emits:["controlGoal"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Z(!1);Ke(()=>n.forceExpanded,()=>{n.forceExpanded!==void 0&&(i.value=!0)});const r=F(()=>{const a=n.goal.budget.tokenBudget;return!a||a<=0?0:Math.max(0,Math.min(100,Math.round(n.goal.tokensUsed/a*100)))});function l(a){const c=Math.max(0,Math.round(a/1e3)),u=Math.floor(c/60),d=c%60;return u<=0?`${d}s`:u<60?`${u}m ${d}s`:`${Math.floor(u/60)}h ${u%60}m`}return(a,c)=>(w(),ve(wy,{class:Re(["goal-strip",{expanded:i.value}])},s0({head:_e(()=>[T("button",{class:"goal-row",type:"button",onClick:c[0]||(c[0]=u=>i.value=!i.value)},[c[4]||(c[4]=T("span",{class:"goal-kicker"},"Goal",-1)),T("span",{class:Re(["goal-objective",{"expanded-hidden":i.value}])},R(e.goal.objective),3),oe(Is,{variant:e.goal.status==="active"?"success":e.goal.status==="blocked"?"danger":e.goal.status==="paused"?"warning":"neutral",size:"sm",class:"goal-status"},{default:_e(()=>[qe(R(e.goal.status),1)]),_:1},8,["variant"]),T("span",OQ,[T("span",{class:"goal-progress-fill",style:Gt({width:`${r.value}%`})},null,4)]),oe(Je,{class:Re(["goal-chevron",{open:i.value}]),name:"chevron-right",size:"md"},null,8,["class"])])]),_:2},[i.value?{name:"default",fn:_e(()=>[T("div",PQ,R(e.goal.objective),1),e.goal.completionCriterion?(w(),N("div",RQ,[c[5]||(c[5]=T("span",null,"Done when",-1)),T("p",null,R(e.goal.completionCriterion),1)])):ie("",!0),T("div",DQ,[oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(e.goal.turnsUsed)+" turns",1)]),_:1}),oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(e.goal.tokensUsed.toLocaleString())+" tokens",1)]),_:1}),oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(l(e.goal.wallClockMs)),1)]),_:1}),e.goal.budget.tokenBudget!==null?(w(),ve(Is,{key:0,variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(r.value)+"% token budget",1)]),_:1})):ie("",!0)])]),key:"0"}:void 0,i.value?{name:"foot",fn:_e(()=>[T("div",BQ,[e.goal.status!=="paused"?(w(),ve(Dt,{key:0,size:"sm",variant:"secondary",class:"goal-action",onClick:c[1]||(c[1]=vt(u=>s("controlGoal","pause"),["stop"]))},{default:_e(()=>[qe(R(x(o)("status.goalPause")),1)]),_:1})):ie("",!0),e.goal.status==="paused"?(w(),ve(Dt,{key:1,size:"sm",variant:"primary",class:"goal-action",onClick:c[2]||(c[2]=vt(u=>s("controlGoal","resume"),["stop"]))},{default:_e(()=>[qe(R(x(o)("status.goalResume")),1)]),_:1})):ie("",!0),oe(Dt,{size:"sm",variant:"danger-soft",class:"goal-action",onClick:c[3]||(c[3]=vt(u=>s("controlGoal","cancel"),["stop"]))},{default:_e(()=>[qe(R(x(o)("status.goalCancel")),1)]),_:1})])]),key:"1"}:void 0]),1032,["class"]))}}),HQ=ut(FQ,[["__scopeId","data-v-eaeefe1e"]]),WQ={class:"qh"},zQ={class:"qtitle"},UQ={key:0,class:"qstep"},qQ={key:1,class:"qmin-peek"},jQ={class:"qbody"},VQ=["aria-label"],KQ=["aria-selected","aria-label","onClick"],GQ={class:"qstep-num"},YQ={key:1,class:"qheader-chip"},XQ={class:"qtext"},QQ={class:"qopts"},ZQ=["onClick"],JQ={class:"qopt-key"},eZ={class:"qopt-glyph"},tZ={key:0,class:"chk"},nZ={key:1,class:"rad"},sZ={class:"qopt-text"},oZ={class:"qopt-label"},iZ={key:0,class:"qopt-desc"},rZ={class:"qopt-glyph"},lZ={key:0,class:"chk"},aZ={key:1,class:"rad"},cZ={class:"qopt-label"},uZ=["placeholder"],dZ={class:"qfoot"},fZ=je({__name:"QuestionCard",props:{question:{},busyKind:{}},emits:["answer","dismiss"],setup(e,{emit:t}){const n=e,{t:s}=It(),o=t,i=Z(0),r=Z(!1),l=F(()=>n.question.questions[i.value]),a=F(()=>n.question.questions.length);function c(){i.value>0&&i.value--}function u(){i.value<a.value-1&&i.value++}function d(W){W>=0&&W<a.value&&(i.value=W)}function p(W){const z=f.value[W];return z?z.kind==="multi"?z.optionIds.length>0:z.kind==="multiWithOther"?z.optionIds.length>0||z.otherText.trim().length>0:z.kind==="other"?z.text.trim().length>0:!0:!1}function h(){return p(l.value.id)}const f=Z({});function m(W){return W.recommended===!0?!0:/\b(?:recommended|recommend)\b|推荐/.test(`${W.label} ${W.description??""}`.toLowerCase())}function b(){const W={...f.value};let z=!1;for(const q of n.question.questions){if(W[q.id])continue;const Q=q.options.filter(m);Q.length!==0&&(W[q.id]=q.multiSelect?{kind:"multi",optionIds:Q.map(X=>X.id)}:{kind:"single",optionId:Q[0].id},z=!0)}z&&(f.value=W)}Ke(()=>n.question.questionId,()=>{i.value=0,r.value=!1,f.value={},v.value={}}),Ke(()=>n.question,()=>{i.value>=n.question.questions.length&&(i.value=0),b()},{immediate:!0,deep:!0});function _(W,z){const q=f.value[W];if(q&&q.kind==="single"&&q.optionId===z){const Q={...f.value};delete Q[W],f.value=Q}else f.value={...f.value,[W]:{kind:"single",optionId:z}}}function g(W,z){const q=f.value[W],Q=q&&(q.kind==="multi"||q.kind==="multiWithOther")?q.kind==="multi"?[...q.optionIds]:[...q.optionIds]:[],X=Q.indexOf(z);X>=0?Q.splice(X,1):Q.push(z);const fe=f.value[W],ye=fe&&fe.kind==="multiWithOther"?fe.otherText:"";ye?f.value={...f.value,[W]:{kind:"multiWithOther",optionIds:Q,otherText:ye}}:f.value={...f.value,[W]:{kind:"multi",optionIds:Q}}}const v=Z({}),y=Z(null);function A(W){const z=n.question.questions.find(Q=>Q.id===W),q=v.value[W]??"";if(z.multiSelect){const Q=f.value[W],X=Q&&(Q.kind==="multi"||Q.kind==="multiWithOther")?Q.kind==="multi"?[...Q.optionIds]:[...Q.optionIds]:[];f.value={...f.value,[W]:{kind:"multiWithOther",optionIds:X,otherText:q}}}else f.value={...f.value,[W]:{kind:"other",text:q}}}function O(W){A(W),ht(()=>y.value?.focus())}function $(W,z){const q=f.value[W];return q?q.kind==="single"?q.optionId===z:q.kind==="multi"||q.kind==="multiWithOther"?q.optionIds.includes(z):!1:!1}function k(W){const z=f.value[W];return!!(z&&(z.kind==="other"||z.kind==="multiWithOther"))}function E(){return n.question.questions.every(W=>p(W.id))}const M=F(()=>n.busyKind==="answer"),L=F(()=>n.busyKind==="dismiss"),S=F(()=>!!n.busyKind);function I(){if(S.value||!E())return;const W={answers:f.value,method:"click"};o("answer",n.question.questionId,W)}function P(){S.value||o("dismiss",n.question.questionId)}function D(W){const z=(document.activeElement?.tagName??"").toLowerCase(),q=z==="input"||z==="textarea";if(S.value)return;if(W.key==="Enter"){if(W.preventDefault(),r.value)return;i.value<a.value-1&&h()?u():E()&&I();return}if(q)return;if(W.key==="Escape"){W.preventDefault(),P();return}if(r.value)return;const Q=parseInt(W.key,10);if(!isNaN(Q)&&Q>=1&&Q<=9){W.preventDefault();const X=l.value,fe=Q-1,ye=X.options[fe];ye&&(X.multiSelect?g(X.id,ye.id):_(X.id,ye.id))}}return hn(()=>document.addEventListener("keydown",D)),kn(()=>document.removeEventListener("keydown",D)),(W,z)=>(w(),ve(wy,{class:Re(["qcard",{minimized:r.value}])},s0({head:_e(()=>[T("div",WQ,[z[5]||(z[5]=T("span",{class:"qh-ic"},"?",-1)),T("span",zQ,R(x(s)("question.title")),1),a.value>1&&!r.value?(w(),N("span",UQ,R(x(s)("question.step",{current:i.value+1,total:a.value})),1)):ie("",!0),r.value?(w(),N("span",qQ,R(l.value.question),1)):ie("",!0),oe(gn,{class:"qmin",size:"sm",label:r.value?x(s)("question.expand"):x(s)("question.minimize"),onClick:z[0]||(z[0]=q=>r.value=!r.value)},{default:_e(()=>[r.value?(w(),ve(Je,{key:0,name:"chevron-down",size:"md"})):(w(),ve(Je,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:_e(()=>[T("div",jQ,[a.value>1?(w(),N("div",{key:0,class:"qsteps",role:"tablist","aria-label":x(s)("question.step",{current:i.value+1,total:a.value})},[(w(!0),N(Le,null,nt(n.question.questions,(q,Q)=>(w(),N("button",{key:q.id,type:"button",class:Re(["qstep-dot",{active:Q===i.value,answered:p(q.id)}]),"aria-selected":Q===i.value,"aria-label":x(s)("question.step",{current:Q+1,total:a.value}),onClick:X=>d(Q)},[T("span",GQ,R(Q+1),1)],10,KQ))),128))],8,VQ)):ie("",!0),l.value.header?(w(),N("div",YQ,[oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(l.value.header),1)]),_:1})])):ie("",!0),T("div",XQ,R(l.value.question),1),l.value.body?(w(),ve(Oh,{key:2,text:l.value.body,class:"qmdbody"},null,8,["text"])):ie("",!0),T("div",QQ,[(w(!0),N(Le,null,nt(l.value.options,(q,Q)=>(w(),N("label",{key:q.id,class:Re(["qopt",{selected:$(l.value.id,q.id)}]),onClick:vt(X=>l.value.multiSelect?g(l.value.id,q.id):_(l.value.id,q.id),["prevent"])},[T("span",JQ,R(Q+1),1),T("span",eZ,[l.value.multiSelect?(w(),N("span",tZ,R($(l.value.id,q.id)?"■":"□"),1)):(w(),N("span",nZ,R($(l.value.id,q.id)?"●":"○"),1))]),T("span",sZ,[T("span",oZ,R(q.label),1),q.description?(w(),N("span",iZ,R(q.description),1)):ie("",!0)])],10,ZQ))),128)),l.value.allowOther?(w(),N("label",{key:0,class:Re(["qopt",{selected:k(l.value.id)}]),onClick:z[4]||(z[4]=vt(q=>O(l.value.id),["prevent"]))},[z[6]||(z[6]=T("span",{class:"qopt-key"},null,-1)),T("span",rZ,[l.value.multiSelect?(w(),N("span",lZ,R(k(l.value.id)?"■":"□"),1)):(w(),N("span",aZ,R(k(l.value.id)?"●":"○"),1))]),T("span",cZ,R(l.value.otherLabel??x(s)("question.otherDefault")),1),Mn(T("input",{ref_key:"otherInputEl",ref:y,"onUpdate:modelValue":z[1]||(z[1]=q=>v.value[l.value.id]=q),class:"other-input",type:"text",placeholder:l.value.otherLabel??x(s)("question.otherDefault"),onInput:z[2]||(z[2]=q=>A(l.value.id)),onFocus:z[3]||(z[3]=q=>A(l.value.id))},null,40,uZ),[[ko,v.value[l.value.id]]])],2)):ie("",!0)])])]),key:"0"},r.value?void 0:{name:"foot",fn:_e(()=>[T("div",dZ,[i.value<a.value-1?(w(),ve(Dt,{key:0,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!h(),onClick:u},{default:_e(()=>[qe(R(x(s)("question.nextQuestion")),1)]),_:1},8,["disabled"])):(w(),ve(Dt,{key:1,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!E(),loading:M.value,onClick:I},{default:_e(()=>[qe(R(x(s)("question.submit")),1)]),_:1},8,["disabled","loading"])),a.value>1?(w(),ve(Dt,{key:2,class:"qfoot-btn",size:"sm",variant:"secondary",disabled:i.value===0||S.value,onClick:c},{default:_e(()=>[qe(R(x(s)("question.back")),1)]),_:1},8,["disabled"])):ie("",!0),oe(Dt,{class:"qfoot-btn",size:"sm",variant:"ghost",loading:L.value,disabled:S.value,onClick:P},{default:_e(()=>[qe(R(x(s)("question.dismiss")),1)]),_:1},8,["loading","disabled"])])]),key:"1"}]),1032,["class"]))}}),pZ=ut(fZ,[["__scopeId","data-v-edd2556f"]]),hZ={class:"ah"},mZ={class:"akind"},gZ={class:"apath"},vZ={class:"ah-path"},yZ={key:1,class:"diff"},kZ={class:"dg"},bZ={class:"dc"},_Z={key:2,class:"body-shell"},wZ={class:"shell-cmd"},SZ={key:0,class:"shell-cwd"},CZ={key:1,class:"shell-danger"},xZ={key:3,class:"body-file"},AZ={class:"file-bar"},TZ={class:"file-lang"},MZ={class:"file-content"},EZ={class:"file-ln"},IZ={class:"file-text"},$Z={key:4,class:"body-chip"},NZ={class:"chip-label"},LZ={class:"chip-value"},OZ={key:0,class:"chip-detail"},PZ={key:5,class:"body-chip"},RZ={key:0,class:"chip-label"},DZ={class:"chip-value"},BZ={key:6,class:"body-chip"},FZ={class:"chip-label"},HZ={class:"chip-value"},WZ={key:0,class:"chip-detail"},zZ={key:7,class:"body-chip"},UZ={class:"chip-label"},qZ={class:"chip-value"},jZ={key:0,class:"chip-detail"},VZ={key:8,class:"body-todo"},KZ={class:"todo-glyph"},GZ={key:9,class:"body-plan"},YZ={key:10,class:"body-generic"},XZ={class:"gen-text"},QZ={key:11,class:"feedback-wrap"},ZZ=["placeholder"],JZ={class:"feedback-hint"},eJ={key:0,class:"plan-actions"},tJ={class:"k"},nJ={key:0,class:"k"},sJ={key:0,class:"k"},oJ={key:1,class:"abtn"},iJ=je({__name:"ApprovalCard",props:{block:{},agentName:{},busy:{type:Boolean}},emits:["decide"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=F(()=>{const M=n.block;return M.kind!=="plan_review"?null:{plan:M.plan,path:M.path,options:M.options??[]}}),r=Z(!1),l=["shell","diff","file","fileop","url","search","invocation","todo","plan_review","generic"];function a(){const M=l.includes(n.block.kind)?n.block.kind:"generic";return o(`approval.title.${M}`)}const c=Z(!1),u=Z(""),d=Z(null);function p(){n.busy||(c.value=!0,u.value="",setTimeout(()=>d.value?.focus(),0))}function h(){if(n.busy)return;const M=u.value.trim();i.value?_("feedback",{decision:"rejected",selectedLabel:"Revise",feedback:M||void 0}):_("feedback",{decision:"rejected",feedback:M||void 0}),c.value=!1,u.value=""}function f(){c.value=!1,u.value=""}function m(M){M.key==="Enter"&&!M.shiftKey?(M.preventDefault(),h()):M.key==="Escape"&&(M.preventDefault(),f())}const b=Z(null);Ke(()=>n.busy,M=>{M||(b.value=null)});function _(M,L){n.busy||(b.value=M,s("decide",L))}function g(){_("approve",{decision:"approved"})}function v(){_("approveSession",{decision:"approved",scope:"session"})}function y(){_("reject",{decision:"rejected"})}function A(){_("approvePlan",{decision:"approved"})}function O(M){_(`option:${M}`,{decision:"approved",selectedLabel:M})}function $(){n.busy||p()}function k(){_("rejectAndExit",{decision:"rejected",selectedLabel:"Reject and Exit"})}function E(M){const L=(document.activeElement?.tagName??"").toLowerCase();if(L==="input"||L==="textarea"||n.busy||r.value)return;const S=i.value;if(S){if(S.options.length===0){M.key==="1"?(M.preventDefault(),A()):M.key==="2"?(M.preventDefault(),$()):M.key==="3"&&(M.preventDefault(),k());return}M.key==="1"&&S.options[0]?(M.preventDefault(),O(S.options[0].label)):M.key==="2"&&S.options[1]?(M.preventDefault(),O(S.options[1].label)):M.key==="3"&&S.options[2]&&(M.preventDefault(),O(S.options[2].label));return}M.key==="1"?(M.preventDefault(),g()):M.key==="2"?(M.preventDefault(),v()):M.key==="3"?(M.preventDefault(),y()):M.key==="4"&&(M.preventDefault(),p())}return hn(()=>document.addEventListener("keydown",E)),kn(()=>document.removeEventListener("keydown",E)),(M,L)=>(w(),ve(wy,{class:Re(["appr",{minimized:r.value}])},s0({head:_e(()=>[T("div",hZ,[L[2]||(L[2]=T("span",{class:"ah-ic"},"!",-1)),T("span",mZ,R(a()),1),T("span",gZ,[e.block.kind==="diff"||e.block.kind==="file"||e.block.kind==="fileop"?(w(),N(Le,{key:0},[qe(R(e.block.path),1)],64)):e.block.kind==="shell"?(w(),N(Le,{key:1},[qe(R(e.block.command),1)],64)):e.block.kind==="url"?(w(),N(Le,{key:2},[qe(R(e.block.url),1)],64)):e.block.kind==="search"?(w(),N(Le,{key:3},[qe(R(e.block.query),1)],64)):e.block.kind==="invocation"?(w(),N(Le,{key:4},[qe(R(e.block.name),1)],64)):e.block.kind==="generic"?(w(),N(Le,{key:5},[qe(R(e.block.summary),1)],64)):ie("",!0)]),e.agentName&&!r.value?(w(),ve(Is,{key:0,variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(x(o)("approval.subagentBadge",{name:e.agentName})),1)]),_:1})):ie("",!0),r.value?ie("",!0):(w(),ve(Is,{key:1,variant:"warning",size:"sm",class:"aw"},{default:_e(()=>[qe(R(x(o)("approval.required")),1)]),_:1})),oe(gn,{class:"amin",size:"sm",label:r.value?x(o)("question.expand"):x(o)("question.minimize"),onClick:L[0]||(L[0]=S=>r.value=!r.value)},{default:_e(()=>[r.value?(w(),ve(Je,{key:0,name:"chevron-down",size:"md"})):(w(),ve(Je,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:_e(()=>[e.block.kind==="plan_review"&&e.block.path?(w(),ve(Ht,{key:0,text:e.block.path},{default:_e(()=>[T("div",vZ,R(e.block.path),1)]),_:1},8,["text"])):ie("",!0),e.block.kind==="diff"?(w(),N("div",yZ,[(w(!0),N(Le,null,nt(e.block.diff,(S,I)=>(w(),N("div",{key:I,class:Re(["dl",S.kind==="add"?"add":S.kind==="rem"?"del":""])},[T("span",kZ,R(S.gutter),1),T("span",bZ,R(S.text),1)],2))),128))])):e.block.kind==="shell"?(w(),N("div",_Z,[T("div",wZ,[L[3]||(L[3]=T("span",{class:"shell-dollar"},"$",-1)),qe(" "+R(e.block.command),1)]),e.block.cwd?(w(),N("div",SZ,"cwd: "+R(e.block.cwd),1)):ie("",!0),e.block.danger?(w(),N("div",CZ,R(x(o)("approval.danger",{detail:e.block.danger})),1)):ie("",!0)])):e.block.kind==="file"?(w(),N("div",xZ,[T("div",AZ,[T("span",TZ,R(e.block.language??""),1)]),T("div",MZ,[(w(!0),N(Le,null,nt(e.block.content.split(`
|
|
256
|
-
`),(S,I)=>(w(),N("div",{key:I,class:"file-line"},[T("span",EZ,R(I+1),1),T("span",IZ,R(S),1)]))),128))])])):e.block.kind==="fileop"?(w(),N("div",$Z,[T("span",NZ,R(e.block.op),1),T("span",LZ,R(e.block.path),1),e.block.detail?(w(),N("span",OZ,R(e.block.detail),1)):ie("",!0)])):e.block.kind==="url"?(w(),N("div",PZ,[e.block.method?(w(),N("span",RZ,R(e.block.method),1)):ie("",!0),T("span",DZ,R(e.block.url),1)])):e.block.kind==="search"?(w(),N("div",BZ,[T("span",FZ,R(x(o)("approval.searchQueryLabel")),1),T("span",HZ,R(e.block.query),1),e.block.scope?(w(),N("span",WZ,R(x(o)("approval.searchScope",{scope:e.block.scope})),1)):ie("",!0)])):e.block.kind==="invocation"?(w(),N("div",zZ,[T("span",UZ,R(e.block.kind2),1),T("span",qZ,R(e.block.name),1),e.block.description?(w(),N("span",jZ,R(e.block.description),1)):ie("",!0)])):e.block.kind==="todo"?(w(),N("div",VZ,[(w(!0),N(Le,null,nt(e.block.items,(S,I)=>(w(),N("div",{key:I,class:"todo-item"},[T("span",KZ,R(S.status==="done"||S.status==="completed"?"✓":"○"),1),T("span",{class:Re(["todo-title",{"todo-done":S.status==="done"||S.status==="completed"}])},R(S.title),3)]))),128))])):e.block.kind==="plan_review"?(w(),N("div",GZ,[oe(Oh,{text:e.block.plan},null,8,["text"])])):(w(),N("div",YZ,[T("span",XZ,R(e.block.summary),1)])),c.value?(w(),N("div",QZ,[Mn(T("textarea",{ref_key:"feedbackRef",ref:d,"onUpdate:modelValue":L[1]||(L[1]=S=>u.value=S),class:"feedback-ta",placeholder:x(o)("approval.feedbackPlaceholder"),rows:"2",onKeydown:m},null,40,ZZ),[[ko,u.value]]),T("div",JZ,R(x(o)("approval.feedbackHint")),1)])):ie("",!0)]),key:"0"},r.value?void 0:{name:"foot",fn:_e(()=>[i.value?(w(),N("div",eJ,[i.value.options.length>0?(w(!0),N(Le,{key:0},nt(i.value.options,(S,I)=>(w(),ve(Ht,{key:I,text:S.description},{default:_e(()=>[oe(Dt,{class:"kbtn",size:"sm",variant:"primary",loading:b.value===`option:${S.label}`,disabled:e.busy,onClick:P=>O(S.label)},{default:_e(()=>[qe(R(S.label),1),T("span",tJ,"["+R(I+1)+"]",1)]),_:2},1032,["loading","disabled","onClick"])]),_:2},1032,["text"]))),128)):(w(),ve(Dt,{key:1,class:"kbtn",size:"sm",variant:"primary",loading:b.value==="approvePlan",disabled:e.busy,onClick:A},{default:_e(()=>[qe(R(x(o)("approval.approvePlan")),1),L[4]||(L[4]=T("span",{class:"k"},"[1]",-1))]),_:1},8,["loading","disabled"])),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",disabled:e.busy,onClick:$},{default:_e(()=>[qe(R(x(o)("approval.revise")),1),i.value.options.length===0?(w(),N("span",nJ,"[2]")):ie("",!0)]),_:1},8,["disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"danger-soft",loading:b.value==="rejectAndExit",disabled:e.busy,onClick:k},{default:_e(()=>[qe(R(x(o)("approval.rejectAndExit")),1),i.value.options.length===0?(w(),N("span",sJ,"[3]")):ie("",!0)]),_:1},8,["loading","disabled"])])):(w(),N("div",oJ,[oe(Dt,{class:"kbtn",size:"sm",variant:"primary",loading:b.value==="approve",disabled:e.busy,onClick:g},{default:_e(()=>[qe(R(x(o)("approval.approve")),1),L[5]||(L[5]=T("span",{class:"k"},"[1]",-1))]),_:1},8,["loading","disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",loading:b.value==="approveSession",disabled:e.busy,onClick:v},{default:_e(()=>[qe(R(x(o)("approval.approveSession")),1),L[6]||(L[6]=T("span",{class:"k"},"[2]",-1))]),_:1},8,["loading","disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",loading:b.value==="reject",disabled:e.busy,onClick:y},{default:_e(()=>[qe(R(x(o)("approval.reject")),1),L[7]||(L[7]=T("span",{class:"k"},"[3]",-1))]),_:1},8,["loading","disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",disabled:e.busy,onClick:p},{default:_e(()=>[qe(R(x(o)("approval.feedback")),1),L[8]||(L[8]=T("span",{class:"k"},"[4]",-1))]),_:1},8,["disabled"])]))]),key:"1"}]),1032,["class"]))}}),rJ=ut(iJ,[["__scopeId","data-v-
|
|
255
|
+
`)}function fe(){for(let le=i.turns.length-1;le>=0;le-=1)if(i.turns[le]?.role==="assistant")return X(le);return""}function ye(){const le=fe();le.trim()&&zs(le).then(U=>{U&&(W.value=!0,d("copyConversationCopied"),z!==null&&clearTimeout(z),z=setTimeout(()=>{z=null,W.value=!1},2e3))}).catch(()=>{})}t({copyConversation:q,copyFinalSummary:ye});function Me(le){const U=i.turns[le];if(!U||U.role!=="assistant")return!1;const G=i.turns[le+1];return!G||G.role!=="assistant"}let we=null;function ze(le){const U=i.turns[le];if(!U)return;const G=X(le);G.trim()&&zs(G).then(ne=>{ne&&($.value=U.id,we!==null&&clearTimeout(we),we=setTimeout(()=>{we=null,$.value=null},1400))}).catch(()=>{})}function Ue(le){const U=le.text;U.trim()&&zs(U).then(G=>{G&&($.value=le.id,we!==null&&clearTimeout(we),we=setTimeout(()=>{we=null,$.value=null},1400))}).catch(()=>{})}function Fe(le){return{kind:"image",url:le.url,path:le.alt,fileId:le.fileId}}function rt(le,U){return le.id!==c.value?!1:U.sourceIndex===hh(le).length-1}return(le,U)=>(w(),N("div",RG,[e.sessionLoading?(w(),N("div",DG,[oe(ni,{size:"sm"}),T("span",BG,R(x(s)("conversation.loading")),1)])):e.turns.length===0&&(!e.approvals||e.approvals.length===0)?(w(),N("div",FG)):ie("",!0),e.hasMoreMessages||e.loadingMore?(w(),N("div",{key:2,ref_key:"topSentinelRef",ref:r,class:Re(["top-sentinel",{"top-sentinel-loading":e.loadingMore}])},[e.loadingMore?(w(),N("span",HG,[oe(ni,{size:"sm"}),qe(" "+R(x(s)("conversation.loadingOlder")),1)])):(w(),N("button",{key:0,type:"button",class:"top-sentinel-btn",onClick:U[0]||(U[0]=G=>d("loadOlderMessages"))},R(x(s)("conversation.loadOlder")),1))],2)):ie("",!0),(w(!0),N(Le,null,nt(e.turns,(G,ne)=>(w(),N(Le,{key:G.id},[G.role==="user"?(w(),N("div",{key:0,class:Re(["u-turn",{"is-latest-user":G.id===y.value}])},[T("div",{class:Re(["u-bub turn-anchor",{undoing:k.value===G.id}]),"data-turn-id":G.id},[G.images&&G.images.length>0?(w(),N("div",zG,[(w(!0),N(Le,null,nt(G.images,(H,J)=>(w(),N(Le,{key:J},[H.kind==="video"?(w(),ve(lv,{key:0,url:H.url,kind:"video","file-id":H.fileId,"media-class":"u-img"},null,8,["url","file-id"])):(w(),N("button",{key:1,type:"button",class:"u-img-btn","aria-label":x(s)("filePreview.enlargeImage"),onClick:ce=>d("openMedia",Fe(H))},[oe(lv,{url:H.url,kind:"image",alt:H.alt,"file-id":H.fileId,"media-class":"u-img"},null,8,["url","alt","file-id"])],8,UG))],64))),128))])):ie("",!0),G.skillActivation?(w(),N("div",qG,[T("div",jG,[U[9]||(U[9]=T("span",{class:"skill-act-arrow"},"▶",-1)),T("span",null,R(x(s)("conversation.activatedSkill",{name:G.skillActivation.name})),1)]),G.skillActivation.args?(w(),N("div",VG,R(G.skillActivation.args),1)):ie("",!0)])):G.pluginCommand?(w(),N("div",KG,[T("div",GG,[U[10]||(U[10]=T("span",{class:"skill-act-arrow"},"▶",-1)),T("span",null,"/"+R(G.pluginCommand.pluginId)+":"+R(G.pluginCommand.commandName),1)]),G.pluginCommand.args?(w(),N("div",YG,R(G.pluginCommand.args),1)):ie("",!0)])):(w(),N("div",XG,R(G.text),1))],10,WG),G.createdAt||A(G)?(w(),N("div",QG,[A(G)?(w(),N("div",{key:0,class:Re(["u-edit-wrap",{undoing:k.value===G.id}])},[T("button",{type:"button",class:"u-edit","aria-label":x(s)("conversation.undoTooltip"),onClick:H=>P(G)},[oe(Je,{name:"undo",size:"sm"})],8,ZG)],2)):ie("",!0),G.text.trim().length>0?(w(),N("button",{key:1,type:"button",class:"u-copy","aria-label":x(s)("filePreview.copy"),onClick:vt(H=>Ue(G),["stop"])},[$.value!==G.id?(w(),ve(Je,{key:0,name:"copy",size:"sm"})):(w(),ve(Je,{key:1,name:"check",size:"sm"}))],8,JG)):ie("",!0),G.createdAt?(w(),N("button",{key:2,type:"button",class:"u-time",onClick:vt(H=>S(G.id),["stop"])},R(I(G.createdAt,G.id)),9,eY)):ie("",!0)])):ie("",!0)],2)):G.role==="compaction"?(w(),N("div",{key:1,class:"compact-divider turn-anchor","data-turn-id":G.id,role:"separator"},[U[11]||(U[11]=T("span",{class:"cd-line","aria-hidden":"true"},null,-1)),G.text?(w(),N("button",{key:0,type:"button",class:"cd-label cd-btn",onClick:H=>d("openCompaction",{turnId:G.id})},[T("span",null,R(O(G)),1),T("span",sY,R(x(s)("conversation.viewSummary")),1)],8,nY)):(w(),N("span",oY,R(O(G)),1)),U[12]||(U[12]=T("span",{class:"cd-line","aria-hidden":"true"},null,-1))],8,tY)):(w(),N("div",{key:2,class:"a-msg turn-anchor","data-turn-id":G.id},[(w(!0),N(Le,null,nt(x($P)(G),(H,J)=>(w(),N(Le,{key:x(OP)(H,J)},[H.kind==="thinking"?(w(),ve(yK,{key:0,text:H.thinking,mobile:"",streaming:rt(G,H),onOpen:ce=>d("openThinking",{turnId:G.id,blockIndex:H.sourceIndex})},null,8,["text","streaming","onOpen"])):H.kind==="text"&&H.text?(w(),N("div",rY,[oe(Oh,{text:H.text,streaming:rt(G,H),"open-file":ce=>d("openFile",ce)},null,8,["text","streaming","open-file"])])):H.kind==="tool-stack"?(w(),ve(HP,{key:2,tools:H.tools,mobile:"","tool-diff-panel":e.toolDiffPanel,onOpenMedia:U[1]||(U[1]=ce=>d("openMedia",ce)),onOpenFile:U[2]||(U[2]=ce=>d("openFile",ce)),onOpenToolDiff:U[3]||(U[3]=ce=>d("openToolDiff",ce)),onOpenAgent:U[4]||(U[4]=ce=>d("openAgent",ce))},null,8,["tools","tool-diff-panel"])):H.kind==="tool"?(w(),ve(NA,{key:3,tool:H.tool,mobile:"","tool-diff-panel":e.toolDiffPanel,onOpenMedia:U[5]||(U[5]=ce=>d("openMedia",ce)),onOpenFile:U[6]||(U[6]=ce=>d("openFile",ce)),onOpenToolDiff:U[7]||(U[7]=ce=>d("openToolDiff",ce)),onOpenAgent:U[8]||(U[8]=ce=>d("openAgent",ce))},null,8,["tool","tool-diff-panel"])):ie("",!0)],64))),128)),G.id!==c.value&&Me(ne)&&(X(ne).trim().length>0||G.durationMs!==void 0)?(w(),N("div",lY,[oe(Ht,{text:`${G.durationMs} ms`},{default:_e(()=>[G.durationMs!==void 0?(w(),N("span",aY,R(x(MP)(G.durationMs)),1)):ie("",!0)]),_:2},1032,["text"]),X(ne).trim().length>0?(w(),N("button",{key:0,class:"a-cpbtn","aria-label":x(s)("filePreview.copy"),onClick:H=>ze(ne)},[$.value!==G.id?(w(),ve(Je,{key:0,name:"copy",size:"sm"})):(w(),ve(Je,{key:1,name:"check",size:"sm"}))],8,cY)):ie("",!0)])):ie("",!0)],8,iY))],64))),128)),e.compaction?(w(),ve(SK,{key:3,label:x(s)("conversation.compacting")},null,8,["label"])):ie("",!0),u.value?(w(),N("div",uY,[oe(w3,{fast:e.fastMoon},null,8,["fast"])])):ie("",!0),e.queued.length>0?(w(),N("div",dY,[T("div",fY,[T("span",pY,[oe(Je,{name:"mail",size:"sm"}),qe(" "+R(x(s)("composer.queueLabel"))+" · ",1),T("b",null,R(e.queued.length),1)]),T("span",hY,R(x(s)("composer.queueAutoDrain")),1)]),(w(!0),N(Le,null,nt(e.queued,(G,ne)=>(w(),N("div",{key:ne,class:Re(["u-turn q-turn",{"q-dragging":p.value===ne,"drop-before":h.value?.index===ne&&h.value.position==="before","drop-after":h.value?.index===ne&&h.value.position==="after"}]),onDragover:H=>_(ne,H),onDrop:H=>g(ne,H)},[T("div",gY,[T("span",{class:"q-grip",title:x(s)("composer.queueDragTitle"),draggable:"true",onDragstart:H=>b(ne,H),onDragend:v},[oe(Je,{name:"grip",size:"sm"})],40,vY),T("button",{type:"button",class:"q-body",title:f(G)?x(s)("composer.queuedHasImage",{n:G.attachments?.length??0}):x(s)("composer.editQueued"),disabled:f(G),onClick:H=>m(ne,G)},[G.text?(w(),N("span",kY,R(G.text),1)):(w(),N("span",bY,[oe(Je,{name:"image",size:"sm"}),qe(" "+R(x(s)("composer.queuedImageOnly",{n:G.attachments?.length??0})),1)]))],8,yY),f(G)?(w(),N("div",_Y,[(w(!0),N(Le,null,nt(G.attachments,(H,J)=>(w(),ve(lv,{key:J,url:H.url,kind:H.kind,"file-id":H.fileId,"media-class":"q-img",controls:!1,muted:""},null,8,["url","kind","file-id"]))),128))])):ie("",!0),ne===0?(w(),N("span",wY,R(x(s)("composer.queueNext")),1)):(w(),N("span",SY,"#"+R(ne+1),1)),T("button",{type:"button",class:"q-rm","aria-label":x(s)("composer.remove"),onClick:vt(H=>d("unqueue",ne),["stop"])},[oe(Je,{name:"close",size:"sm"})],8,CY)])],42,mY))),128))])):ie("",!0)]))}}),S3=ut(AY,[["__scopeId","data-v-c9108d03"]]),TY={class:"ch-id"},MY={key:0,class:"ch-ws"},EY={key:1,class:"ch-sep"},IY=["onKeydown"],$Y={class:"ch-ses"},NY={key:0,class:"ch-pill ch-sync-pill"},LY={key:0,class:"ch-ahead"},OY={key:1,class:"ch-behind"},PY={key:1,class:"ch-pill ch-diff-pill"},RY={key:0,class:"ch-add"},DY={key:1,class:"ch-del"},BY=je({__name:"ChatHeader",props:{sessionId:{},workspaceName:{},workspaceRoot:{},sessionTitle:{},branch:{},ahead:{},behind:{},changesCount:{},gitDiffStats:{},isGitRepo:{type:Boolean},pr:{},copied:{type:Boolean}},emits:["copyAll","copyFinalSummary","openChanges","openPr","renameSession","forkSession","archiveSession"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=e,i=t,r=F(()=>o.ahead??0),l=F(()=>o.behind??0),a=F(()=>o.gitDiffStats?.totalAdditions??0),c=F(()=>o.gitDiffStats?.totalDeletions??0),u=F(()=>a.value>0||c.value>0),d=Z(!1),p=Z(null),h=Z(null),f=Z({});function m(D){const W=D.target;h.value?.el?.contains(W)||p.value?.el?.contains(W)||g()}function b(){g()}async function _(D){if(D.stopPropagation(),d.value){g();return}d.value=!0,document.addEventListener("mousedown",m),window.addEventListener("resize",b),await ht();const W=p.value?.el,z=h.value?.el;if(!W||!z)return;const q=W.getBoundingClientRect(),Q=4,X=8,fe=z.offsetWidth,ye=z.offsetHeight;let Me=q.bottom+Q;Me+ye>window.innerHeight-X&&(Me=Math.max(X,q.top-ye-Q));let we=q.left;we+fe>window.innerWidth-X&&(we=Math.max(X,q.right-fe)),f.value={top:`${Math.round(Me)}px`,left:`${Math.round(we)}px`}}function g(){d.value=!1,document.removeEventListener("mousedown",m),window.removeEventListener("resize",b)}kn(()=>{document.removeEventListener("mousedown",m),window.removeEventListener("resize",b)});function v(){i("copyAll"),g()}function y(){i("copyFinalSummary"),g()}const A=Z(!1);function O(){o.sessionId&&zs(o.sessionId).then(D=>{D&&(A.value=!0,setTimeout(()=>{A.value=!1},1200))})}const $=Z(!1),k=Z(""),E=Z(null);async function M(){if(g(),!!o.sessionId){$.value=!0,k.value=o.sessionTitle??"",await ht();try{E.value?.focus(),E.value?.select()}catch{}}}function L(){const D=k.value.trim();D&&o.sessionId&&D!==(o.sessionTitle??"").trim()&&i("renameSession",o.sessionId,D),$.value=!1}function S(){$.value=!1}function I(){o.sessionId&&(g(),i("forkSession",o.sessionId))}async function P(){o.sessionId&&(g(),await s({title:n("header.archiveSession"),message:n("sidebar.archiveConfirm"),variant:"danger"})&&i("archiveSession",o.sessionId))}return(D,W)=>(w(),N("header",{class:Re(["chat-header",{"macos-desktop":x(AA)}])},[T("div",TY,[e.workspaceName?(w(),N("span",MY,R(e.workspaceName),1)):ie("",!0),e.workspaceName&&e.sessionTitle?(w(),N("span",EY,"/")):ie("",!0),$.value?Mn((w(),N("input",{key:2,ref_key:"renameInputRef",ref:E,"onUpdate:modelValue":W[0]||(W[0]=z=>k.value=z),class:"ch-rename",type:"text",onKeydown:[di(vt(L,["stop"]),["enter"]),di(vt(S,["stop"]),["esc"])],onBlur:L,onClick:W[1]||(W[1]=vt(()=>{},["stop"]))},null,40,IY)),[[ko,k.value]]):e.sessionTitle?(w(),ve(Ht,{key:3,text:e.sessionTitle},{default:_e(()=>[T("span",$Y,R(e.sessionTitle),1)]),_:1},8,["text"])):ie("",!0)]),oe(gn,{ref_key:"kebabRef",ref:p,class:Re(["ch-act-more",{open:d.value}]),label:x(n)("header.options"),"aria-expanded":d.value,"aria-haspopup":"menu",onClick:W[2]||(W[2]=vt(z=>_(z),["stop"]))},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"md"})]),_:1},8,["class","label","aria-expanded"]),d.value?(w(),ve(Wl,{key:0,ref_key:"menuRef",ref:h,class:"ch-menu",style:Gt(f.value),onClick:W[3]||(W[3]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{onClick:v},{default:_e(()=>[qe(R(e.copied?x(n)("header.copied"):x(n)("header.copyAll")),1)]),_:1}),oe(fn,{onClick:y},{default:_e(()=>[qe(R(x(n)("header.copyFinalSummary")),1)]),_:1}),e.sessionId?(w(),N(Le,{key:0},[oe(fn,{separator:""}),oe(fn,{onClick:O},{default:_e(()=>[qe(R(A.value?x(n)("header.copied"):x(n)("header.copySessionId")),1)]),_:1}),oe(fn,{onClick:M},{default:_e(()=>[qe(R(x(n)("header.renameSession")),1)]),_:1}),oe(fn,{onClick:I},{default:_e(()=>[qe(R(x(n)("header.forkSession")),1)]),_:1}),oe(fn,{danger:"",onClick:P},{default:_e(()=>[qe(R(x(n)("header.archiveSession")),1)]),_:1})],64)):ie("",!0)]),_:1},8,["style"])):ie("",!0),W[6]||(W[6]=T("div",{class:"ch-spacer"},null,-1)),e.isGitRepo?(w(),N("button",{key:1,type:"button",class:"ch-git",onClick:W[4]||(W[4]=z=>i("openChanges"))},[T("span",{class:Re(["ch-branch",{"ch-detached":!e.branch}])},R(e.branch||x(n)("header.detached")),3),r.value>0||l.value>0?(w(),N("span",NY,[r.value>0?(w(),N("span",LY,"↑"+R(r.value),1)):ie("",!0),l.value>0?(w(),N("span",OY,"↓"+R(l.value),1)):ie("",!0)])):ie("",!0),u.value?(w(),N("span",PY,[a.value>0?(w(),N("span",RY,"+"+R(a.value),1)):ie("",!0),c.value>0?(w(),N("span",DY,"-"+R(c.value),1)):ie("",!0)])):ie("",!0)])):ie("",!0),e.pr?(w(),N("button",{key:2,type:"button",class:Re(["ch-pill ch-pr",`pr-${e.pr.state}`]),onClick:W[5]||(W[5]=z=>e.pr&&i("openPr",e.pr.url))},[oe(Je,{name:"git-pull-request",size:"sm"}),T("span",null,"PR #"+R(e.pr.number)+" · "+R(e.pr.state),1)],2)):ie("",!0)],2))}}),FY=ut(BY,[["__scopeId","data-v-cefe0a16"]]),HY={key:0,class:"slash-menu",role:"listbox"},WY=["aria-selected","onMouseenter","onMousedown"],zY={class:"slash-name"},UY={class:"slash-desc"},qY=je({__name:"SlashMenu",props:{items:{},activeIndex:{}},emits:["select","hover"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z([]);return Ke(()=>s.activeIndex,r=>{i.value[r]?.scrollIntoView({block:"nearest"})}),(r,l)=>e.items.length>0?(w(),N("div",HY,[(w(!0),N(Le,null,nt(e.items,(a,c)=>(w(),N("div",{ref_for:!0,ref:u=>{u&&(i.value[c]=u)},key:`${a.name}-${c}`,class:Re(["slash-item",{active:c===s.activeIndex}]),role:"option","aria-selected":c===s.activeIndex,onMouseenter:u=>o("hover",c),onMousedown:vt(u=>o("select",a),["prevent"])},[T("span",zY,R(a.name),1),T("span",UY,R(a.isSkill?a.desc:x(n)(a.desc)),1)],42,WY))),128))])):ie("",!0)}}),jY=ut(qY,[["__scopeId","data-v-e381b17b"]]),VY={class:"mention-menu",role:"listbox"},KY={key:0,class:"mention-state dim"},GY={key:1,class:"mention-state dim"},YY=["aria-selected","onMouseenter","onMousedown"],XY=["innerHTML"],QY={class:"mention-name"},ZY={class:"mention-path"},JY=je({__name:"MentionMenu",props:{items:{},activeIndex:{},loading:{type:Boolean}},emits:["select","hover"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Ia("folder","sm"),r=Ia("code","sm"),l=Ia("file-text","sm"),a=Ia("image","sm"),c=Ia("file","sm"),u=new Set(["ts","tsx","js","jsx","mjs","cjs","vue","json","py","go","rs","java","kt","c","h","cpp","cc","hpp","cs","rb","php","swift","sh","bash","zsh","css","scss","less","html","htm","xml","sql","yaml","yml","toml","lua","dart","scala","clj","ex","exs"]),d=new Set(["md","markdown","mdx","txt","rst","adoc","pdf","doc","docx"]),p=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]);function h(f){const m=f.path;if(m.endsWith("/"))return i;const b=f.name||m.split("/").pop()||m,_=b.lastIndexOf("."),g=_>0?b.slice(_+1).toLowerCase():"";return g?u.has(g)?r:d.has(g)?l:p.has(g)?a:c:c}return(f,m)=>(w(),N("div",VY,[n.loading?(w(),N("div",KY,R(x(o)("mention.searching")),1)):n.items.length===0?(w(),N("div",GY,R(x(o)("mention.noMatch")),1)):(w(!0),N(Le,{key:2},nt(n.items,(b,_)=>(w(),N("div",{key:b.path,class:Re(["mention-item",{active:_===n.activeIndex}]),role:"option","aria-selected":_===n.activeIndex,onMouseenter:g=>s("hover",_),onMousedown:vt(g=>s("select",b),["prevent"])},[T("span",{class:"mention-icon",innerHTML:h(b),"aria-hidden":"true"},null,8,XY),T("span",QY,R(b.name),1),T("span",ZY,R(b.path),1)],42,YY))),128))]))}}),eX=ut(JY,[["__scopeId","data-v-4cd7689f"]]),C3=[{name:"/help",desc:"commands.help.desc"},{name:"/new",desc:"commands.new.desc"},{name:"/clear",desc:"commands.clear.desc"},{name:"/model",desc:"commands.model.desc"},{name:"/login",desc:"commands.login.desc"},{name:"/permission",desc:"commands.permission.desc"},{name:"/plan",desc:"commands.plan.desc"},{name:"/swarm",desc:"commands.swarm.desc",acceptsInput:!0},{name:"/goal",desc:"commands.goal.desc",acceptsInput:!0},{name:"/btw",desc:"commands.btw.desc",acceptsInput:!0},{name:"/auto",desc:"commands.auto.desc"},{name:"/yolo",desc:"commands.yolo.desc"},{name:"/thinking",desc:"commands.thinking.desc"},{name:"/compact",desc:"commands.compact.desc",acceptsInput:!0},{name:"/undo",desc:"commands.undo.desc"},{name:"/fork",desc:"commands.fork.desc"},{name:"/status",desc:"commands.status.desc"}];function tX(e){if(!e.startsWith("/"))return null;const t=e.indexOf(" ");return t===-1?{cmd:e,arg:""}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}function x3(e=[]){const t=e.map(n=>({name:`/${n.name}`,desc:n.description,isSkill:!0,acceptsInput:!0}));return[...C3,...t]}function nX(e,t=C3){const n=e.toLowerCase().trim().replace(/^\//,"");return n===""?t:t.map((s,o)=>{const i=s.name.toLowerCase().replace(/^\//,"");let r=0;return i===n?r=3:i.startsWith(n)?r=2:i.includes(n)&&(r=1),{item:s,index:o,score:r}}).filter(({score:s})=>s>0).sort((s,o)=>s.score!==o.score?o.score-s.score:s.index-o.index).map(({item:s})=>s)}function fd(e){if(e===void 0)return"toggle";const t=e.capabilities??[];return t.includes("always_thinking")?"always-on":t.includes("thinking")||e.adaptiveThinking===!0?"toggle":"unsupported"}function ky(e){return e?.supportEfforts??[]}function sX(e){return e[Math.floor(e.length/2)]}function B1(e){if(fd(e)==="unsupported")return"off";const t=ky(e);return t.length>0?e?.defaultEffort??sX(t):"on"}function by(e){const t=ky(e),n=fd(e);return t.length>0?n==="always-on"?[...t]:["off",...t]:n==="always-on"?["on"]:n==="unsupported"?["off"]:["on","off"]}function F1(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function oX(e){return e!=="off"}function fc(e,t){if(e===void 0)return t;const n=fd(e);if(n==="unsupported")return"off";if(t==="off")return n==="always-on"?B1(e):"off";const s=ky(e);return s.length>0?s.includes(t)?t:B1(e):"on"}function _y(e,t){return t==="off"?"off":t==="on"?B1(e):t}const Fp=100;function iX(e){const t=od(Et.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const s=n.length>Fp?n.slice(-Fp):n,o={[e]:s};return yc(Et.inputHistory,o),o}return t&&typeof t=="object"?t:{}}function rX(e){const{text:t,textareaRef:n,autosize:s,sessionId:o}=e,i=Z(iX(o())),r=F(()=>i.value[o()??""]??[]);let l=-1,a="";function c(_){const g=o();if(l=-1,!g)return;const v=_.trim();if(!v)return;const y=i.value[g]??[];if(y.at(-1)===v)return;const A=[...y,v],O=A.length>Fp?A.slice(-Fp):A;i.value={...i.value,[g]:O},yc(Et.inputHistory,i.value)}function u(){const _=n.value;return _?(_.selectionStart??0)===0:!1}function d(_){t.value=_,ht(()=>{const g=n.value;if(!g)return;s();const v=_.length;g.setSelectionRange(v,v)})}function p(){const _=r.value;if(_.length!==0){if(l===-1)a=t.value,l=_.length-1;else if(l>0)l-=1;else return;d(_[l])}}function h(){if(l===-1)return;const _=r.value;l<_.length-1?(l+=1,d(_[l])):(l=-1,d(a))}function f(){l=-1}function m(){return l!==-1}function b(){return r.value.length>0}return Ke(o,()=>{l=-1}),{push:c,caretAtTextStart:u,recallOlder:p,recallNewer:h,resetBrowsing:f,isBrowsing:m,hasHistory:b}}function lX(e){const{text:t,textareaRef:n,autosize:s,skills:o,emitCommand:i,historyPush:r,clearDraft:l}=e,a=Z(!1),c=Z([]),u=Z(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(c.value=nX(h,x3(o())),u.value=0,a.value=c.value.length>0):a.value=!1}function p(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,ht(()=>{const f=n.value;if(!f)return;const m=t.value.length;f.setSelectionRange(m,m),f.focus(),s()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:c,active:u,update:d,select:p}}function aX(e){const{text:t,textareaRef:n,autosize:s,searchFiles:o}=e,i=Z(!1),r=Z([]),l=Z(0),a=Z(!1);let c=null;function u(){const h=t.value,f=n.value?.selectionStart??h.length;let m=f-1;for(;m>=0&&!/\s/.test(h[m]);)m--;m++;const b=h.slice(m,f);return b.startsWith("@")?{token:b.slice(1),start:m,end:f}:null}function d(){const h=u(),f=o();if(!h||!f){i.value=!1;return}const m=h.token;c!==null&&clearTimeout(c),c=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;try{r.value=await f(m)}catch{r.value=[]}finally{a.value=!1}},200)}function p(h){const f=u();if(!f)return;const m=t.value;t.value=m.slice(0,f.start)+h.path+m.slice(f.end),i.value=!1,ht(()=>{const b=n.value;if(!b)return;const _=f.start+h.path.length;b.setSelectionRange(_,_),b.focus(),s()})}return{open:i,items:r,active:l,loading:a,update:d,select:p}}function cX(e){const{sessionId:t}=e;function n(c){return Qn(x_(c))??""}function s(c,u){const d=x_(c);u?ts(d,u):cc(d)}const o=Z(n(t())),i=Z(null);function r(){const c=i.value;c&&(c.style.height="auto",c.style.height=`${c.scrollHeight}px`)}Ke(o,c=>{ht(r),s(t(),c)}),Ke(t,(c,u)=>{c!==u&&(s(u,o.value),o.value=n(c),ht(r))});function l(c){o.value=c,ht(()=>{const u=i.value;if(!u)return;u.focus();const d=c.length;u.setSelectionRange(d,d),r()})}function a(){s(t(),"")}return{text:o,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function uX(e){const{uploadImage:t,sessionId:n}=e,s=Z({}),o=F(()=>s.value[n()??""]??[]),i=Z(null),r=Z(null),l=Z(!1);let a=0;function c(){return`att_${++a}`}function u(k,E){s.value={...s.value,[k]:E}}function d(k){try{URL.revokeObjectURL(k.previewUrl)}catch{}}function p(k){return k.startsWith("image/")?"image":k.startsWith("video/")?"video":null}async function h(k){const E=t();if(!E)return;const M=n()??"",L=k.map(S=>({file:S,kind:p(S.type)})).filter(S=>S.kind!==null);if(L.length!==0)for(const{file:S,kind:I}of L){const P=c(),D=URL.createObjectURL(S),W={localId:P,name:S.name,kind:I,previewUrl:D,uploading:!0};u(M,[...s.value[M]??[],W]),E(S,S.name).then(z=>{const q=s.value[M]??[];u(M,q.map(Q=>Q.localId===P?{...Q,uploading:!1,fileId:z?.fileId,error:z===null}:Q))}).catch(()=>{const z=s.value[M]??[];u(M,z.map(q=>q.localId===P?{...q,uploading:!1,error:!0}:q))})}}function f(k){const E=n()??"",M=s.value[E]??[],L=M.find(S=>S.localId===k);i.value?.localId===k&&(i.value=null),L&&d(L),u(E,M.filter(S=>S.localId!==k))}function m(k){i.value=k}function b(){i.value=null}function _(){r.value?.click()}function g(k){const E=k.target,M=Array.from(E.files??[]);h(M),E.value=""}function v(k){if(!t())return;const E=k.clipboardData;if(!E)return;const M=[],L=new Set,S=(I,P)=>{const D=`${I.size}:${I.type}:${P}`;if(L.has(D))return;L.add(D);const W=I.type.split("/")[1]??"png",z=P.includes(".")?P:`paste-${Date.now()}.${W}`;M.push(I instanceof File?I:new File([I],z,{type:I.type}))};for(const I of Array.from(E.items))if(I.kind==="file"&&p(I.type)){const P=I.getAsFile();P&&S(P,P.name||`paste-${Date.now()}.${I.type.split("/")[1]??"png"}`)}for(const I of Array.from(E.files))p(I.type)&&S(I,I.name);M.length!==0&&(k.preventDefault(),h(M))}function y(k){!t()||!Array.from(k.dataTransfer?.items??[]).some(M=>M.kind==="file")||(k.preventDefault(),l.value=!0)}function A(){l.value=!1}function O(k){if(l.value=!1,!t())return;k.preventDefault();const E=Array.from(k.dataTransfer?.files??[]);h(E)}function $(){const k=n()??"";for(const E of s.value[k]??[])d(E);u(k,[])}return Ke(n,()=>{i.value=null}),hn(()=>{document.addEventListener("paste",v)}),kn(()=>{document.removeEventListener("paste",v);for(const k of Object.values(s.value))for(const E of k)d(E);i.value=null}),{attachments:o,previewAttachment:i,fileInputRef:r,isDragOver:l,removeAttachment:f,openAttachmentPreview:m,closeAttachmentPreview:b,openFilePicker:_,handleFileInputChange:g,handleDragOver:y,handleDragLeave:A,handleDrop:O,clearAfterSubmit:$}}const dX={class:"ctx-ring",viewBox:"0 0 20 20","aria-hidden":"true"},fX=["stroke-dasharray","stroke-dashoffset"],av=7,pX=je({__name:"ContextRing",props:{pct:{}},setup(e){const t=e,n=2*Math.PI*av;return(s,o)=>(w(),N("svg",dX,[T("circle",{class:"ctx-ring-track",cx:"10",cy:"10",r:av,fill:"none","stroke-width":"2.5"}),T("circle",{class:"ctx-ring-fill",cx:"10",cy:"10",r:av,fill:"none","stroke-width":"2.5","stroke-linecap":"round","stroke-dasharray":`${n}`,"stroke-dashoffset":`${n*(1-t.pct/100)}`},null,8,fX)]))}}),hX=ut(pX,[["__scopeId","data-v-cf70e825"]]),mX={key:0,class:"att-strip"},gX=["onClick"],vX=["src"],yX=["src","alt"],kX={key:2,class:"att-video-badge","aria-hidden":"true"},bX={class:"att-name"},_X={class:"att-err-icon"},wX=["onClick"],SX={class:"att-lightbox-card"},CX=["src"],xX=["src","alt"],AX={class:"att-lightbox-name"},TX={class:"composer-card"},MX={class:"cin-wrap"},EX={class:"input-row"},IX=["placeholder"],$X=["aria-label"],NX={class:"toolbar-left"},LX=["onKeydown"],OX=["onClick"],PX={class:"pd-check"},RX={class:"pd-info"},DX={class:"pd-desc"},BX={class:"mode-label"},FX={key:0,class:"mode-tag"},HX={key:1,class:"mode-tag"},WX={key:2,class:"mode-tag"},zX={class:"mode-row-name"},UX={class:"mode-row-name"},qX={class:"mode-row-name"},jX={key:0,class:"mode-row-actions"},VX={class:"toolbar-right"},KX={key:0,class:"ctx-group"},GX={class:"ctx-num"},YX=["onKeydown"],XX={key:0,class:"think-suffix"},QX=["aria-label"],ZX=["aria-label"],JX={key:0,class:"md-section"},eQ=["onClick"],tQ={class:"md-check"},nQ={class:"md-name"},sQ={class:"md-provider"},oQ={key:1,class:"md-divider"},iQ={key:2,class:"md-section"},rQ=["onClick"],lQ={class:"md-check"},aQ={class:"md-name"},cQ={key:3,class:"md-divider"},uQ={class:"md-name"},dQ={key:0,class:"md-note"},fQ=["aria-label"],pQ=["disabled","onClick"],hQ={class:"md-name"},KS=36,mQ=je({__name:"Composer",props:{running:{type:Boolean,default:!1},sessionId:{},queued:{default:()=>[]},searchFiles:{type:Function,default:void 0},uploadImage:{type:Function,default:void 0},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},activationBadges:{},models:{default:()=>[]},starredIds:{default:()=>[]},skills:{default:()=>[]},hideContext:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel"],setup(e,{expose:t,emit:n}){const s=e,o=F(()=>s.running?r("composer.placeholderRunning"):s.goalMode?r("status.goalPlaceholder"):r("composer.placeholder")),i=n,{t:r}=It(),{text:l,textareaRef:a,autosize:c,loadForEdit:u,clearDraft:d}=cX({sessionId:()=>s.sessionId}),p=Z(!1);function h(){p.value=!p.value,ht(()=>{c(),_(),a.value?.focus()})}function f(){p.value&&(p.value=!1,ht(c))}function m(Xe){if(typeof getComputedStyle>"u")return KS;const ot=Number.parseFloat(getComputedStyle(Xe).minHeight);return Number.isFinite(ot)&&ot>0?ot:KS}const b=Z(!1);function _(){const Xe=a.value;b.value=!!Xe&&Xe.scrollHeight>m(Xe)}Ke(l,()=>{ht(_)}),Ke(()=>s.sessionId,()=>{p.value=!1});const g=rX({text:l,textareaRef:a,autosize:c,sessionId:()=>s.sessionId}),{open:v,items:y,active:A,update:O,select:$}=lX({text:l,textareaRef:a,autosize:c,skills:()=>s.skills,emitCommand:Xe=>i("command",Xe),historyPush:Xe=>g.push(Xe),clearDraft:d}),{open:k,items:E,active:M,loading:L,update:S,select:I}=aX({text:l,textareaRef:a,autosize:c,searchFiles:()=>s.searchFiles});function P(){g.resetBrowsing(),O(),S()}const{attachments:D,previewAttachment:W,fileInputRef:z,isDragOver:q,removeAttachment:Q,openAttachmentPreview:X,closeAttachmentPreview:fe,openFilePicker:ye,handleFileInputChange:Me,handleDragOver:we,handleDragLeave:ze,handleDrop:Ue,clearAfterSubmit:Fe}=uX({uploadImage:()=>s.uploadImage,sessionId:()=>s.sessionId});hn(()=>{l.value&&ht(()=>{c(),_()})}),kn(()=>{document.removeEventListener("mousedown",Ln),H()});function rt(){a.value?.focus({preventScroll:!0})}t({loadForEdit:u,focus:rt});function le(){const Xe=l.value.trim();if(D.value.some(pe=>pe.uploading))return;const ot=D.value.filter(pe=>!pe.uploading&&!pe.error&&pe.fileId);if(!Xe&&ot.length===0)return;if(g.push(Xe),Xe){const pe=tX(Xe),Oe=pe?x3(s.skills).some(Qt=>Qt.name===pe.cmd):!1;if(pe&&Oe){l.value="",d(),v.value=!1,f(),i("command",pe.arg?`${pe.cmd} ${pe.arg}`:pe.cmd);return}}const de={text:Xe,attachments:ot.map(pe=>({fileId:pe.fileId,kind:pe.kind}))};W.value=null,Fe(),l.value="",d(),v.value=!1,k.value=!1,f(),i("submit",de)}function U(){if(!s.running||D.value.some(pe=>pe.uploading))return;const Xe=l.value.trim(),ot=D.value.filter(pe=>!pe.uploading&&!pe.error&&pe.fileId);if(!Xe&&ot.length===0&&s.queued.length===0)return;const de={text:Xe,attachments:ot.map(pe=>({fileId:pe.fileId,kind:pe.kind}))};Fe(),g.push(Xe),l.value="",d(),v.value=!1,k.value=!1,f(),i("steer",de)}let G=!1,ne=null;function H(){ne!==null&&(clearTimeout(ne),ne=null)}function J(){H(),G=!0}function ce(){H(),ne=setTimeout(()=>{ne=null,G=!1},0)}function te(Xe){return G||Xe.isComposing||Xe.keyCode===229}function ue(Xe){if(!te(Xe)){if(Xe.key==="Escape"){if(re.value){Xe.preventDefault(),ae();return}if(ge.value){Xe.preventDefault(),Ve();return}}if(v.value){if(Xe.key==="ArrowDown"){Xe.preventDefault(),A.value=(A.value+1)%y.value.length;return}if(Xe.key==="ArrowUp"){Xe.preventDefault(),A.value=(A.value-1+y.value.length)%y.value.length;return}if(Xe.key==="Enter"||Xe.key==="Tab"){Xe.preventDefault();const ot=y.value[A.value];ot&&$(ot);return}if(Xe.key==="Escape"){Xe.preventDefault(),v.value=!1;return}}if(k.value&&!L.value){if(Xe.key==="ArrowDown"){Xe.preventDefault(),M.value=(M.value+1)%Math.max(1,E.value.length);return}if(Xe.key==="ArrowUp"){Xe.preventDefault(),M.value=(M.value-1+Math.max(1,E.value.length))%Math.max(1,E.value.length);return}if(Xe.key==="Enter"||Xe.key==="Tab"){Xe.preventDefault();const ot=E.value[M.value];ot&&I(ot);return}if(Xe.key==="Escape"){Xe.preventDefault(),k.value=!1;return}}if(Xe.key==="s"&&(Xe.ctrlKey||Xe.metaKey)&&!Xe.shiftKey&&!Xe.altKey){s.running&&(Xe.preventDefault(),U());return}if(!p.value&&!v.value&&!k.value&&!Xe.shiftKey&&!Xe.altKey&&!Xe.metaKey&&!Xe.ctrlKey){const ot=g.isBrowsing();if(Xe.key==="ArrowUp"&&g.hasHistory()&&(ot||g.caretAtTextStart())){Xe.preventDefault(),g.recallOlder();return}if(Xe.key==="ArrowDown"&&ot){Xe.preventDefault(),g.recallNewer();return}}if(Xe.key==="Enter"&&!Xe.shiftKey){if(p.value&&!(Xe.metaKey||Xe.ctrlKey))return;Xe.preventDefault(),le()}}}const j=F(()=>r("composer.send")),Y=F(()=>!!s.uploadImage),re=Z(!1),ge=Z(!1),Ae=Z(null);function Ie(){re.value=!re.value,re.value?(ge.value=!1,tn(),document.addEventListener("click",tt,!0)):document.removeEventListener("click",tt,!0)}function ae(){re.value=!1,ge.value||document.removeEventListener("click",tt,!0)}function Te(){ge.value=!ge.value,ge.value?(re.value=!1,tn(),document.addEventListener("click",tt,!0)):document.removeEventListener("click",tt,!0)}function Ve(){ge.value=!1,re.value||document.removeEventListener("click",tt,!0)}function tt(Xe){Ae.value&&!Ae.value.contains(Xe.target)&&(ae(),Ve())}kn(()=>{document.removeEventListener("click",tt,!0)});const bt=Xe=>`${Math.round(Xe/1e3)}k`,kt=F(()=>{const Xe=s.status?.ctxMax??0;return Xe<=0?0:Math.min(100,Math.max(0,Math.round((s.status?.ctxUsed??0)/Xe*100)))}),Tt=F(()=>{const Xe=(s.status?.ctxUsed??0).toLocaleString(),ot=(s.status?.ctxMax??0).toLocaleString();return r("status.ctxTooltip",{used:Xe,max:ot,pct:kt.value})}),Pt=F(()=>kt.value>=80),mt=F(()=>{const Xe=s.status?.modelId??s.status?.model??"";return s.models?.find(ot=>ot.id===Xe||ot.model===Xe||ot.displayName===s.status?.model)}),Yt=F(()=>fd(mt.value)),Rn=F(()=>by(mt.value)),Dn=F(()=>fc(mt.value,s.thinking??"off")),Ft=F(()=>{const Xe=Rn.value,ot=Dn.value;return Xe.includes(ot)?ot:Xe.includes("on")?"on":Xe[0]??"off"}),bn=F(()=>Yt.value==="always-on"?!0:Yt.value==="unsupported"?!1:oX(Dn.value)),Vn=F(()=>Yt.value==="unsupported"||Rn.value.length<=1),st=F(()=>{if(!bn.value)return"";const Xe=(mt.value?.supportEfforts?.length??0)>0,ot=Dn.value;return Xe&&ot!=="on"?r("composer.thinkingSuffixEffort",{level:ot}):r("composer.thinkingSuffix")});function In(Xe){Vn.value||i("setThinking",_y(mt.value,Xe))}const _n=F(()=>s.planMode===!0),Kn=F(()=>s.swarmMode===!0),$n=F(()=>s.activationBadges?.goal!==null),Ge=F(()=>$n.value||s.goalMode===!0),Ye=Z(!1),Ct=Z(null),$t=Z(null),mn=Z({}),Nn=F(()=>_n.value||Kn.value||Ge.value);function tn(){Ye.value=!1,document.removeEventListener("mousedown",Ln)}function Ln(Xe){const ot=Xe.target;Ct.value?.contains(ot)||$t.value?.contains(ot)||tn()}function Zn(){if(Ye.value){tn();return}ae(),Ve();const Xe=Ct.value?.getBoundingClientRect();Xe&&(mn.value={left:`${Math.round(Xe.left)}px`,bottom:`${Math.round(window.innerHeight-Xe.top+8)}px`}),Ye.value=!0,setTimeout(()=>document.addEventListener("mousedown",Ln),0)}const Mt=[{mode:"manual",color:"var(--dim)",labelKey:"status.permissionManual",descKey:"status.permissionManualDesc"},{mode:"yolo",color:"var(--color-warning)",labelKey:"status.permissionYolo",descKey:"status.permissionYoloDesc"},{mode:"auto",color:"var(--color-danger)",labelKey:"status.permissionAuto",descKey:"status.permissionAutoDesc"}];function us(Xe){i("setPermission",Xe),Ve()}const Xt=F(()=>Mt.find(Xe=>Xe.mode===s.status?.permission)),oi=F(()=>Xt.value?r(Xt.value.labelKey):""),bs=F(()=>mt.value?.provider??""),Do=F(()=>!bs.value||!s.models?.length?[]:s.models.filter(Xe=>Xe.provider===bs.value)),so=F(()=>new Set(s.starredIds??[]));function qs(Xe){return so.value.has(Xe)}const oo=F(()=>s.models?.length?s.models.filter(Xe=>qs(Xe.id)&&Xe.provider!==bs.value):[]);function Nt(Xe){i("selectModel",Xe),ae()}return(Xe,ot)=>(w(),N("div",{class:Re(["composer",{"drag-over":x(q),expanded:p.value}]),onDragover:ot[17]||(ot[17]=(...de)=>x(we)&&x(we)(...de)),onDragleave:ot[18]||(ot[18]=(...de)=>x(ze)&&x(ze)(...de)),onDrop:ot[19]||(ot[19]=(...de)=>x(Ue)&&x(Ue)(...de))},[x(D).length>0?(w(),N("div",mX,[(w(!0),N(Le,null,nt(x(D),de=>(w(),N("div",{key:de.localId,class:Re(["att-chip",{"att-error":de.error}])},[oe(Ht,{text:x(r)("composer.previewAttachment",{name:de.name})},{default:_e(()=>[T("button",{type:"button",class:"att-preview",onClick:pe=>x(X)(de)},[de.kind==="video"?(w(),N("video",{key:0,class:"att-thumb",src:de.previewUrl,muted:"",playsinline:"",preload:"metadata"},null,8,vX)):(w(),N("img",{key:1,class:"att-thumb",src:de.previewUrl,alt:de.name},null,8,yX)),de.kind==="video"?(w(),N("span",kX,[oe(Je,{name:"play",size:"sm"})])):ie("",!0)],8,gX)]),_:2},1032,["text"]),T("span",bX,R(de.name),1),de.uploading?(w(),ve(ni,{key:0,size:"sm",label:x(r)("composer.uploading")},null,8,["label"])):de.error?(w(),ve(Ht,{key:1,text:x(r)("composer.uploadFailed")},{default:_e(()=>[T("span",_X,[oe(Je,{name:"info",size:"sm"})])]),_:1},8,["text"])):ie("",!0),oe(Ht,{text:x(r)("composer.removeNamed",{name:de.name})},{default:_e(()=>[T("button",{class:"att-rm",onClick:pe=>x(Q)(de.localId)},[oe(Je,{name:"close",size:"sm"})],8,wX)]),_:2},1032,["text"])],2))),128))])):ie("",!0),x(W)?(w(),N("div",{key:1,class:"att-lightbox",onClick:ot[1]||(ot[1]=vt((...de)=>x(fe)&&x(fe)(...de),["self"]))},[T("div",SX,[oe(Ht,{text:x(r)("model.close")},{default:_e(()=>[T("button",{type:"button",class:"att-lightbox-close",onClick:ot[0]||(ot[0]=(...de)=>x(fe)&&x(fe)(...de))},"✕")]),_:1},8,["text"]),x(W).kind==="video"?(w(),N("video",{key:0,class:"att-lightbox-media",src:x(W).previewUrl,controls:"",playsinline:""},null,8,CX)):(w(),N("img",{key:1,class:"att-lightbox-media",src:x(W).previewUrl,alt:x(W).name},null,8,xX)),T("div",AX,R(x(W).name),1)])])):ie("",!0),T("div",TX,[T("div",MX,[x(v)?(w(),ve(jY,{key:0,items:x(y),"active-index":x(A),onSelect:x($),onHover:ot[2]||(ot[2]=de=>A.value=de)},null,8,["items","active-index","onSelect"])):ie("",!0),x(k)?(w(),ve(eX,{key:1,items:x(E),"active-index":x(M),loading:x(L),onSelect:x(I),onHover:ot[3]||(ot[3]=de=>M.value=de)},null,8,["items","active-index","loading","onSelect"])):ie("",!0),T("div",EX,[Mn(T("textarea",{ref_key:"textareaRef",ref:a,"onUpdate:modelValue":ot[4]||(ot[4]=de=>es(l)?l.value=de:null),class:"ph",placeholder:o.value,rows:"1",onKeydown:ue,onCompositionstart:J,onCompositionend:ce,onInput:P},null,40,IX),[[ko,x(l)]]),p.value||b.value?(w(),N("button",{key:0,class:"expand-btn",type:"button","aria-label":p.value?x(r)("composer.collapseTitle"):x(r)("composer.expandTitle"),onClick:h},[p.value?(w(),ve(Je,{key:0,name:"collapse",size:"sm"})):(w(),ve(Je,{key:1,name:"expand",size:"sm"}))],8,$X)):ie("",!0)])]),Y.value?(w(),N("input",{key:0,ref_key:"fileInputRef",ref:z,type:"file",accept:"image/*,video/*",multiple:"",class:"file-input-hidden",onChange:ot[5]||(ot[5]=(...de)=>x(Me)&&x(Me)(...de))},null,544)):ie("",!0),T("div",{ref_key:"toolbarRef",ref:Ae,class:"toolbar"},[T("div",NX,[Y.value?(w(),ve(gn,{key:0,size:"md",label:x(r)("composer.attachImage"),onClick:x(ye)},{default:_e(()=>[oe(Je,{name:"image"})]),_:1},8,["label","onClick"])):ie("",!0),e.status?(w(),N("span",{key:1,class:Re(["perm-pill",["perm-"+e.status.permission,{open:ge.value}]]),role:"button",tabindex:"0",onClick:vt(Te,["stop"]),onKeydown:[di(Te,["enter"]),di(vt(Te,["prevent"]),["space"])]},R(oi.value),43,LX)):ie("",!0),ge.value&&e.status?(w(),N("div",{key:2,class:"perm-dropdown",role:"menu",onClick:ot[6]||(ot[6]=vt(()=>{},["stop"]))},[(w(),N(Le,null,nt(Mt,de=>T("button",{key:de.mode,class:Re(["pd-row",{"is-current":de.mode===e.status.permission}]),role:"menuitem",onClick:pe=>us(de.mode)},[T("span",PX,[de.mode===e.status.permission?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",RX,[T("span",{class:"pd-name",style:Gt({color:de.color})},R(x(r)(de.labelKey)),5),T("span",DX,R(x(r)(de.descKey)),1)])],10,OX)),64))])):ie("",!0),e.status?(w(),N("div",{key:3,ref_key:"modesRef",ref:Ct,class:"modes"},[T("button",{type:"button",class:Re(["mode-pill",{on:Nn.value,open:Ye.value}]),onClick:vt(Zn,["stop"])},[T("span",BX,R(x(r)("status.modesLabel")),1),_n.value?(w(),N("span",FX,R(x(r)("status.planLabel")),1)):ie("",!0),Kn.value?(w(),N("span",HX,R(x(r)("status.swarmLabel")),1)):ie("",!0),Ge.value?(w(),N("span",WX,R(x(r)("status.goalLabel")),1)):ie("",!0)],2),Ye.value?(w(),N("div",{key:0,ref_key:"modesMenuRef",ref:$t,class:"modes-menu",style:Gt(mn.value)},[T("button",{type:"button",class:Re(["mode-row",{on:_n.value}]),onClick:ot[7]||(ot[7]=de=>i("togglePlan"))},[T("span",zX,R(x(r)("status.planLabel")),1),T("span",{class:Re(["mode-switch",{on:_n.value}])},[...ot[20]||(ot[20]=[T("span",{class:"mode-knob"},null,-1)])],2)],2),T("button",{type:"button",class:Re(["mode-row",{on:Kn.value}]),onClick:ot[8]||(ot[8]=de=>i("toggleSwarm"))},[T("span",UX,R(x(r)("status.swarmLabel")),1),T("span",{class:Re(["mode-switch",{on:Kn.value}])},[...ot[21]||(ot[21]=[T("span",{class:"mode-knob"},null,-1)])],2)],2),T("div",{class:Re(["mode-row mode-row-goal",{on:$n.value||s.goalMode}])},[T("button",{type:"button",class:"mode-row-main",onClick:ot[9]||(ot[9]=de=>$n.value?i("controlGoal","cancel"):i("toggleGoal"))},[T("span",qX,R(x(r)("status.goalLabel")),1),$n.value?ie("",!0):(w(),N("span",{key:0,class:Re(["mode-switch",{on:s.goalMode}])},[...ot[22]||(ot[22]=[T("span",{class:"mode-knob"},null,-1)])],2))]),$n.value?(w(),N("div",jX,[T("button",{type:"button",class:"mode-row-action",onClick:ot[10]||(ot[10]=de=>i("controlGoal","pause"))},R(x(r)("status.goalPause")),1),T("button",{type:"button",class:"mode-row-action",onClick:ot[11]||(ot[11]=de=>i("controlGoal","resume"))},R(x(r)("status.goalResume")),1)])):ie("",!0)],2)],4)):ie("",!0)],512)):ie("",!0)]),T("div",VX,[Pt.value?(w(),N("button",{key:0,class:"compact-chip",onClick:ot[12]||(ot[12]=vt(de=>i("compact"),["stop"]))},"/compact")):ie("",!0),oe(Ht,{text:Tt.value},{default:_e(()=>[e.status&&!e.hideContext?(w(),N("span",KX,[oe(hX,{pct:kt.value},null,8,["pct"]),T("span",GX,R(bt(e.status.ctxUsed))+"/"+R(bt(e.status.ctxMax)),1)])):ie("",!0)]),_:1},8,["text"]),e.status?(w(),N("span",{key:1,class:Re(["model-pill",{open:re.value}]),role:"button",tabindex:"0",onClick:vt(Ie,["stop"]),onKeydown:[di(Ie,["enter"]),di(vt(Ie,["prevent"]),["space"])]},[T("b",null,R(e.status.model),1),st.value?(w(),N("span",XX,R(st.value),1)):ie("",!0),oe(Je,{class:"cv",name:"chevron-down",size:"sm"})],42,YX)):ie("",!0),e.running?(w(),ve(Ht,{key:2,text:x(r)("composer.interruptTitle")},{default:_e(()=>[T("button",{class:"stop","aria-label":x(r)("composer.interrupt"),onClick:ot[13]||(ot[13]=de=>i("interrupt"))},[oe(Je,{name:"stop",size:"sm"})],8,QX)]),_:1},8,["text"])):ie("",!0),T("button",{class:"send","aria-label":j.value,onClick:ot[14]||(ot[14]=de=>le())},[oe(Je,{name:"send",size:"sm"})],8,ZX)]),re.value&&e.status?(w(),N("div",{key:0,class:"model-dropdown",role:"menu",onClick:ot[16]||(ot[16]=vt(()=>{},["stop"]))},[oo.value.length>0?(w(),N("div",JX,R(x(r)("status.starredModels")),1)):ie("",!0),(w(!0),N(Le,null,nt(oo.value,de=>(w(),N("button",{key:de.id,class:Re(["md-row",{"is-current":de.id===e.status.modelId}]),role:"menuitem",onClick:pe=>Nt(de.id)},[T("span",tQ,[de.id===e.status.model||de.model===e.status.model||de.displayName===e.status.model?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",nQ,R(de.displayName??de.model),1),T("span",sQ,R(de.provider),1),oe(Je,{class:"md-star",name:"star",size:"sm"})],10,eQ))),128)),oo.value.length>0?(w(),N("div",oQ)):ie("",!0),Do.value.length>0?(w(),N("div",iQ,R(bs.value),1)):ie("",!0),(w(!0),N(Le,null,nt(Do.value,de=>(w(),N("button",{key:de.id,class:Re(["md-row",{"is-current":de.id===e.status.modelId}]),role:"menuitem",onClick:pe=>Nt(de.id)},[T("span",lQ,[de.id===e.status.model||de.model===e.status.model||de.displayName===e.status.model?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",aQ,R(de.displayName??de.model),1),qs(de.id)?(w(),ve(Je,{key:0,class:"md-star",name:"star",size:"sm"})):ie("",!0)],10,rQ))),128)),Do.value.length>0?(w(),N("div",cQ)):ie("",!0),T("div",{class:Re(["md-thinking",{"is-readonly":Vn.value}])},[T("span",uQ,R(x(r)("status.thinkingLabel")),1),Yt.value==="unsupported"?(w(),N("span",dQ,R(x(r)("status.modeNotSupported")),1)):(w(),N("div",{key:1,class:"effort-segments",role:"group","aria-label":x(r)("status.thinkingLabel")},[(w(!0),N(Le,null,nt(Rn.value,de=>(w(),N("button",{key:de,type:"button",class:Re(["effort-seg",{"is-active":de===Ft.value}]),disabled:Vn.value,onClick:pe=>In(de)},R(x(F1)(de)),11,pQ))),128))],8,fQ))],2),ot[23]||(ot[23]=T("div",{class:"md-divider"},null,-1)),T("button",{class:"md-row md-row-more",role:"menuitem",onClick:ot[15]||(ot[15]=de=>{ae(),i("pickModel")})},[T("span",hQ,R(x(r)("status.moreModels")),1)])])):ie("",!0)],512)])],34))}}),A3=ut(mQ,[["__scopeId","data-v-05103791"]]),gQ=["id"],vQ=["aria-expanded"],yQ={class:"swarm-meta"},kQ={class:"swarm-meta"},bQ={class:"swarm-body"},_Q={class:"row-name"},wQ={key:0,class:"row-type"},SQ={key:0,class:"row-activity"},CQ={class:"row-phase"},xQ=je({__name:"SwarmCard",props:{group:{}},setup(e){const t=e,n=Z(!0),s=F(()=>t.group.members.length),o=F(()=>t.group.counts.completed+t.group.counts.failed),i=F(()=>t.group.counts.working+t.group.counts.queued+t.group.counts.suspended),r=F(()=>i.value>0?"running":t.group.counts.failed>0?"error":"done"),l=F(()=>{switch(r.value){case"running":return`${i.value} running`;case"error":return"has failures";default:return"completed"}});function a(p){switch(p){case"queued":return"Queued";case"working":return"Working";case"suspended":return"Suspended";case"completed":return"Completed";case"failed":return"Failed"}}function c(p){return p.outputLines?.map(h=>h.trimEnd()).filter(Boolean).at(-1)}function u(p){return p.suspendedReason||c(p)||p.summary}function d(){n.value=!n.value}return(p,h)=>(w(),N("section",{class:Re(["swarm-card",{open:n.value}]),id:`swarm-${e.group.id}`},[T("button",{class:"swarm-head",type:"button","aria-expanded":n.value,onClick:d},[oe(Fu,{status:r.value},null,8,["status"]),oe(Je,{class:"swarm-ic",name:"git-pull-request",size:"sm"}),h[0]||(h[0]=T("span",{class:"swarm-title"},"Swarm",-1)),T("span",yQ,"· "+R(o.value)+"/"+R(s.value),1),T("span",kQ,"· "+R(l.value),1),oe(Je,{class:"swarm-car",name:"chevron-right",size:"sm"})],8,vQ),Mn(T("div",bQ,[(w(!0),N(Le,null,nt(e.group.members,f=>(w(),N("div",{key:f.id,class:Re(["swarm-row",`phase-${f.phase}`])},[oe(Fu,{class:"row-dot",status:f.phase},null,8,["status"]),oe(Ht,{text:f.name},{default:_e(()=>[T("span",_Q,R(f.name),1)]),_:2},1032,["text"]),f.subagentType?(w(),N("span",wQ,R(f.subagentType),1)):ie("",!0),oe(Ht,{text:u(f)},{default:_e(()=>[u(f)?(w(),N("span",SQ,R(u(f)),1)):ie("",!0)]),_:2},1032,["text"]),T("span",CQ,R(a(f.phase)),1)],2))),128))],512),[[Qo,n.value]])],10,gQ))}}),AQ=ut(xQ,[["__scopeId","data-v-30029745"]]),TQ={key:0,class:"ui-card__head"},MQ={class:"ui-card__body"},EQ={key:1,class:"ui-card__foot"},IQ=je({__name:"Card",props:{elevated:{type:Boolean,default:!1}},setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-card",{"is-elevated":e.elevated}])},[t.$slots.head?(w(),N("div",TQ,[Cn(t.$slots,"head",{},void 0,!0)])):ie("",!0),T("div",MQ,[Cn(t.$slots,"default",{},void 0,!0)]),t.$slots.foot?(w(),N("div",EQ,[Cn(t.$slots,"foot",{},void 0,!0)])):ie("",!0)],2))}}),wy=ut(IQ,[["__scopeId","data-v-2370af5e"]]),$Q=["type","disabled"],NQ={class:"ui-button__content"},LQ=je({__name:"Button",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean},loading:{type:Boolean},type:{default:"button"}},setup(e){return(t,n)=>(w(),N("button",{class:Re(["ui-button",[`ui-button--${e.variant}`,`ui-button--${e.size}`,{"is-loading":e.loading}]]),type:e.type,disabled:e.disabled||e.loading},[e.loading?(w(),ve(ni,{key:0,size:"sm",class:"ui-button__spinner"})):ie("",!0),T("span",NQ,[Cn(t.$slots,"default",{},void 0,!0)])],10,$Q))}}),Dt=ut(LQ,[["__scopeId","data-v-524526a4"]]),OQ={class:"goal-progress","aria-hidden":"true"},PQ={class:"goal-full"},RQ={key:0,class:"goal-criterion"},DQ={class:"goal-stats"},BQ={class:"goal-actions"},FQ=je({__name:"GoalStrip",props:{goal:{},forceExpanded:{}},emits:["controlGoal"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Z(!1);Ke(()=>n.forceExpanded,()=>{n.forceExpanded!==void 0&&(i.value=!0)});const r=F(()=>{const a=n.goal.budget.tokenBudget;return!a||a<=0?0:Math.max(0,Math.min(100,Math.round(n.goal.tokensUsed/a*100)))});function l(a){const c=Math.max(0,Math.round(a/1e3)),u=Math.floor(c/60),d=c%60;return u<=0?`${d}s`:u<60?`${u}m ${d}s`:`${Math.floor(u/60)}h ${u%60}m`}return(a,c)=>(w(),ve(wy,{class:Re(["goal-strip",{expanded:i.value}])},s0({head:_e(()=>[T("button",{class:"goal-row",type:"button",onClick:c[0]||(c[0]=u=>i.value=!i.value)},[c[4]||(c[4]=T("span",{class:"goal-kicker"},"Goal",-1)),T("span",{class:Re(["goal-objective",{"expanded-hidden":i.value}])},R(e.goal.objective),3),oe(Is,{variant:e.goal.status==="active"?"success":e.goal.status==="blocked"?"danger":e.goal.status==="paused"?"warning":"neutral",size:"sm",class:"goal-status"},{default:_e(()=>[qe(R(e.goal.status),1)]),_:1},8,["variant"]),T("span",OQ,[T("span",{class:"goal-progress-fill",style:Gt({width:`${r.value}%`})},null,4)]),oe(Je,{class:Re(["goal-chevron",{open:i.value}]),name:"chevron-right",size:"md"},null,8,["class"])])]),_:2},[i.value?{name:"default",fn:_e(()=>[T("div",PQ,R(e.goal.objective),1),e.goal.completionCriterion?(w(),N("div",RQ,[c[5]||(c[5]=T("span",null,"Done when",-1)),T("p",null,R(e.goal.completionCriterion),1)])):ie("",!0),T("div",DQ,[oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(e.goal.turnsUsed)+" turns",1)]),_:1}),oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(e.goal.tokensUsed.toLocaleString())+" tokens",1)]),_:1}),oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(l(e.goal.wallClockMs)),1)]),_:1}),e.goal.budget.tokenBudget!==null?(w(),ve(Is,{key:0,variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(r.value)+"% token budget",1)]),_:1})):ie("",!0)])]),key:"0"}:void 0,i.value?{name:"foot",fn:_e(()=>[T("div",BQ,[e.goal.status!=="paused"?(w(),ve(Dt,{key:0,size:"sm",variant:"secondary",class:"goal-action",onClick:c[1]||(c[1]=vt(u=>s("controlGoal","pause"),["stop"]))},{default:_e(()=>[qe(R(x(o)("status.goalPause")),1)]),_:1})):ie("",!0),e.goal.status==="paused"?(w(),ve(Dt,{key:1,size:"sm",variant:"primary",class:"goal-action",onClick:c[2]||(c[2]=vt(u=>s("controlGoal","resume"),["stop"]))},{default:_e(()=>[qe(R(x(o)("status.goalResume")),1)]),_:1})):ie("",!0),oe(Dt,{size:"sm",variant:"danger-soft",class:"goal-action",onClick:c[3]||(c[3]=vt(u=>s("controlGoal","cancel"),["stop"]))},{default:_e(()=>[qe(R(x(o)("status.goalCancel")),1)]),_:1})])]),key:"1"}:void 0]),1032,["class"]))}}),HQ=ut(FQ,[["__scopeId","data-v-30357e75"]]),WQ={class:"qh"},zQ={class:"qtitle"},UQ={key:0,class:"qstep"},qQ={key:1,class:"qmin-peek"},jQ={class:"qbody"},VQ=["aria-label"],KQ=["aria-selected","aria-label","onClick"],GQ={class:"qstep-num"},YQ={key:1,class:"qheader-chip"},XQ={class:"qtext"},QQ={class:"qopts"},ZQ=["onClick"],JQ={class:"qopt-key"},eZ={class:"qopt-glyph"},tZ={key:0,class:"chk"},nZ={key:1,class:"rad"},sZ={class:"qopt-text"},oZ={class:"qopt-label"},iZ={key:0,class:"qopt-desc"},rZ={class:"qopt-glyph"},lZ={key:0,class:"chk"},aZ={key:1,class:"rad"},cZ={class:"qopt-label"},uZ=["placeholder"],dZ={class:"qfoot"},fZ=je({__name:"QuestionCard",props:{question:{},busyKind:{}},emits:["answer","dismiss"],setup(e,{emit:t}){const n=e,{t:s}=It(),o=t,i=Z(0),r=Z(!1),l=F(()=>n.question.questions[i.value]),a=F(()=>n.question.questions.length);function c(){i.value>0&&i.value--}function u(){i.value<a.value-1&&i.value++}function d(W){W>=0&&W<a.value&&(i.value=W)}function p(W){const z=f.value[W];return z?z.kind==="multi"?z.optionIds.length>0:z.kind==="multiWithOther"?z.optionIds.length>0||z.otherText.trim().length>0:z.kind==="other"?z.text.trim().length>0:!0:!1}function h(){return p(l.value.id)}const f=Z({});function m(W){return W.recommended===!0?!0:/\b(?:recommended|recommend)\b|推荐/.test(`${W.label} ${W.description??""}`.toLowerCase())}function b(){const W={...f.value};let z=!1;for(const q of n.question.questions){if(W[q.id])continue;const Q=q.options.filter(m);Q.length!==0&&(W[q.id]=q.multiSelect?{kind:"multi",optionIds:Q.map(X=>X.id)}:{kind:"single",optionId:Q[0].id},z=!0)}z&&(f.value=W)}Ke(()=>n.question.questionId,()=>{i.value=0,r.value=!1,f.value={},v.value={}}),Ke(()=>n.question,()=>{i.value>=n.question.questions.length&&(i.value=0),b()},{immediate:!0,deep:!0});function _(W,z){const q=f.value[W];if(q&&q.kind==="single"&&q.optionId===z){const Q={...f.value};delete Q[W],f.value=Q}else f.value={...f.value,[W]:{kind:"single",optionId:z}}}function g(W,z){const q=f.value[W],Q=q&&(q.kind==="multi"||q.kind==="multiWithOther")?q.kind==="multi"?[...q.optionIds]:[...q.optionIds]:[],X=Q.indexOf(z);X>=0?Q.splice(X,1):Q.push(z);const fe=f.value[W],ye=fe&&fe.kind==="multiWithOther"?fe.otherText:"";ye?f.value={...f.value,[W]:{kind:"multiWithOther",optionIds:Q,otherText:ye}}:f.value={...f.value,[W]:{kind:"multi",optionIds:Q}}}const v=Z({}),y=Z(null);function A(W){const z=n.question.questions.find(Q=>Q.id===W),q=v.value[W]??"";if(z.multiSelect){const Q=f.value[W],X=Q&&(Q.kind==="multi"||Q.kind==="multiWithOther")?Q.kind==="multi"?[...Q.optionIds]:[...Q.optionIds]:[];f.value={...f.value,[W]:{kind:"multiWithOther",optionIds:X,otherText:q}}}else f.value={...f.value,[W]:{kind:"other",text:q}}}function O(W){A(W),ht(()=>y.value?.focus())}function $(W,z){const q=f.value[W];return q?q.kind==="single"?q.optionId===z:q.kind==="multi"||q.kind==="multiWithOther"?q.optionIds.includes(z):!1:!1}function k(W){const z=f.value[W];return!!(z&&(z.kind==="other"||z.kind==="multiWithOther"))}function E(){return n.question.questions.every(W=>p(W.id))}const M=F(()=>n.busyKind==="answer"),L=F(()=>n.busyKind==="dismiss"),S=F(()=>!!n.busyKind);function I(){if(S.value||!E())return;const W={answers:f.value,method:"click"};o("answer",n.question.questionId,W)}function P(){S.value||o("dismiss",n.question.questionId)}function D(W){const z=(document.activeElement?.tagName??"").toLowerCase(),q=z==="input"||z==="textarea";if(S.value)return;if(W.key==="Enter"){if(W.preventDefault(),r.value)return;i.value<a.value-1&&h()?u():E()&&I();return}if(q)return;if(W.key==="Escape"){W.preventDefault(),P();return}if(r.value)return;const Q=parseInt(W.key,10);if(!isNaN(Q)&&Q>=1&&Q<=9){W.preventDefault();const X=l.value,fe=Q-1,ye=X.options[fe];ye&&(X.multiSelect?g(X.id,ye.id):_(X.id,ye.id))}}return hn(()=>document.addEventListener("keydown",D)),kn(()=>document.removeEventListener("keydown",D)),(W,z)=>(w(),ve(wy,{class:Re(["qcard",{minimized:r.value}])},s0({head:_e(()=>[T("div",WQ,[z[5]||(z[5]=T("span",{class:"qh-ic"},"?",-1)),T("span",zQ,R(x(s)("question.title")),1),a.value>1&&!r.value?(w(),N("span",UQ,R(x(s)("question.step",{current:i.value+1,total:a.value})),1)):ie("",!0),r.value?(w(),N("span",qQ,R(l.value.question),1)):ie("",!0),oe(gn,{class:"qmin",size:"sm",label:r.value?x(s)("question.expand"):x(s)("question.minimize"),onClick:z[0]||(z[0]=q=>r.value=!r.value)},{default:_e(()=>[r.value?(w(),ve(Je,{key:0,name:"chevron-down",size:"md"})):(w(),ve(Je,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:_e(()=>[T("div",jQ,[a.value>1?(w(),N("div",{key:0,class:"qsteps",role:"tablist","aria-label":x(s)("question.step",{current:i.value+1,total:a.value})},[(w(!0),N(Le,null,nt(n.question.questions,(q,Q)=>(w(),N("button",{key:q.id,type:"button",class:Re(["qstep-dot",{active:Q===i.value,answered:p(q.id)}]),"aria-selected":Q===i.value,"aria-label":x(s)("question.step",{current:Q+1,total:a.value}),onClick:X=>d(Q)},[T("span",GQ,R(Q+1),1)],10,KQ))),128))],8,VQ)):ie("",!0),l.value.header?(w(),N("div",YQ,[oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(l.value.header),1)]),_:1})])):ie("",!0),T("div",XQ,R(l.value.question),1),l.value.body?(w(),ve(Oh,{key:2,text:l.value.body,class:"qmdbody"},null,8,["text"])):ie("",!0),T("div",QQ,[(w(!0),N(Le,null,nt(l.value.options,(q,Q)=>(w(),N("label",{key:q.id,class:Re(["qopt",{selected:$(l.value.id,q.id)}]),onClick:vt(X=>l.value.multiSelect?g(l.value.id,q.id):_(l.value.id,q.id),["prevent"])},[T("span",JQ,R(Q+1),1),T("span",eZ,[l.value.multiSelect?(w(),N("span",tZ,R($(l.value.id,q.id)?"■":"□"),1)):(w(),N("span",nZ,R($(l.value.id,q.id)?"●":"○"),1))]),T("span",sZ,[T("span",oZ,R(q.label),1),q.description?(w(),N("span",iZ,R(q.description),1)):ie("",!0)])],10,ZQ))),128)),l.value.allowOther?(w(),N("label",{key:0,class:Re(["qopt",{selected:k(l.value.id)}]),onClick:z[4]||(z[4]=vt(q=>O(l.value.id),["prevent"]))},[z[6]||(z[6]=T("span",{class:"qopt-key"},null,-1)),T("span",rZ,[l.value.multiSelect?(w(),N("span",lZ,R(k(l.value.id)?"■":"□"),1)):(w(),N("span",aZ,R(k(l.value.id)?"●":"○"),1))]),T("span",cZ,R(l.value.otherLabel??x(s)("question.otherDefault")),1),Mn(T("input",{ref_key:"otherInputEl",ref:y,"onUpdate:modelValue":z[1]||(z[1]=q=>v.value[l.value.id]=q),class:"other-input",type:"text",placeholder:l.value.otherLabel??x(s)("question.otherDefault"),onInput:z[2]||(z[2]=q=>A(l.value.id)),onFocus:z[3]||(z[3]=q=>A(l.value.id))},null,40,uZ),[[ko,v.value[l.value.id]]])],2)):ie("",!0)])])]),key:"0"},r.value?void 0:{name:"foot",fn:_e(()=>[T("div",dZ,[i.value<a.value-1?(w(),ve(Dt,{key:0,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!h(),onClick:u},{default:_e(()=>[qe(R(x(s)("question.nextQuestion")),1)]),_:1},8,["disabled"])):(w(),ve(Dt,{key:1,class:"qfoot-btn qfoot-main",size:"sm",variant:"primary",disabled:!E(),loading:M.value,onClick:I},{default:_e(()=>[qe(R(x(s)("question.submit")),1)]),_:1},8,["disabled","loading"])),a.value>1?(w(),ve(Dt,{key:2,class:"qfoot-btn",size:"sm",variant:"secondary",disabled:i.value===0||S.value,onClick:c},{default:_e(()=>[qe(R(x(s)("question.back")),1)]),_:1},8,["disabled"])):ie("",!0),oe(Dt,{class:"qfoot-btn",size:"sm",variant:"ghost",loading:L.value,disabled:S.value,onClick:P},{default:_e(()=>[qe(R(x(s)("question.dismiss")),1)]),_:1},8,["loading","disabled"])])]),key:"1"}]),1032,["class"]))}}),pZ=ut(fZ,[["__scopeId","data-v-9844d13c"]]),hZ={class:"ah"},mZ={class:"akind"},gZ={class:"apath"},vZ={class:"ah-path"},yZ={key:1,class:"diff"},kZ={class:"dg"},bZ={class:"dc"},_Z={key:2,class:"body-shell"},wZ={class:"shell-cmd"},SZ={key:0,class:"shell-cwd"},CZ={key:1,class:"shell-danger"},xZ={key:3,class:"body-file"},AZ={class:"file-bar"},TZ={class:"file-lang"},MZ={class:"file-content"},EZ={class:"file-ln"},IZ={class:"file-text"},$Z={key:4,class:"body-chip"},NZ={class:"chip-label"},LZ={class:"chip-value"},OZ={key:0,class:"chip-detail"},PZ={key:5,class:"body-chip"},RZ={key:0,class:"chip-label"},DZ={class:"chip-value"},BZ={key:6,class:"body-chip"},FZ={class:"chip-label"},HZ={class:"chip-value"},WZ={key:0,class:"chip-detail"},zZ={key:7,class:"body-chip"},UZ={class:"chip-label"},qZ={class:"chip-value"},jZ={key:0,class:"chip-detail"},VZ={key:8,class:"body-todo"},KZ={class:"todo-glyph"},GZ={key:9,class:"body-plan"},YZ={key:10,class:"body-generic"},XZ={class:"gen-text"},QZ={key:11,class:"feedback-wrap"},ZZ=["placeholder"],JZ={class:"feedback-hint"},eJ={key:0,class:"plan-actions"},tJ={class:"k"},nJ={key:0,class:"k"},sJ={key:0,class:"k"},oJ={key:1,class:"abtn"},iJ=je({__name:"ApprovalCard",props:{block:{},agentName:{},busy:{type:Boolean}},emits:["decide"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=F(()=>{const M=n.block;return M.kind!=="plan_review"?null:{plan:M.plan,path:M.path,options:M.options??[]}}),r=Z(!1),l=["shell","diff","file","fileop","url","search","invocation","todo","plan_review","generic"];function a(){const M=l.includes(n.block.kind)?n.block.kind:"generic";return o(`approval.title.${M}`)}const c=Z(!1),u=Z(""),d=Z(null);function p(){n.busy||(c.value=!0,u.value="",setTimeout(()=>d.value?.focus(),0))}function h(){if(n.busy)return;const M=u.value.trim();i.value?_("feedback",{decision:"rejected",selectedLabel:"Revise",feedback:M||void 0}):_("feedback",{decision:"rejected",feedback:M||void 0}),c.value=!1,u.value=""}function f(){c.value=!1,u.value=""}function m(M){M.key==="Enter"&&!M.shiftKey?(M.preventDefault(),h()):M.key==="Escape"&&(M.preventDefault(),f())}const b=Z(null);Ke(()=>n.busy,M=>{M||(b.value=null)});function _(M,L){n.busy||(b.value=M,s("decide",L))}function g(){_("approve",{decision:"approved"})}function v(){_("approveSession",{decision:"approved",scope:"session"})}function y(){_("reject",{decision:"rejected"})}function A(){_("approvePlan",{decision:"approved"})}function O(M){_(`option:${M}`,{decision:"approved",selectedLabel:M})}function $(){n.busy||p()}function k(){_("rejectAndExit",{decision:"rejected",selectedLabel:"Reject and Exit"})}function E(M){const L=(document.activeElement?.tagName??"").toLowerCase();if(L==="input"||L==="textarea"||n.busy||r.value)return;const S=i.value;if(S){if(S.options.length===0){M.key==="1"?(M.preventDefault(),A()):M.key==="2"?(M.preventDefault(),$()):M.key==="3"&&(M.preventDefault(),k());return}M.key==="1"&&S.options[0]?(M.preventDefault(),O(S.options[0].label)):M.key==="2"&&S.options[1]?(M.preventDefault(),O(S.options[1].label)):M.key==="3"&&S.options[2]&&(M.preventDefault(),O(S.options[2].label));return}M.key==="1"?(M.preventDefault(),g()):M.key==="2"?(M.preventDefault(),v()):M.key==="3"?(M.preventDefault(),y()):M.key==="4"&&(M.preventDefault(),p())}return hn(()=>document.addEventListener("keydown",E)),kn(()=>document.removeEventListener("keydown",E)),(M,L)=>(w(),ve(wy,{class:Re(["appr",{minimized:r.value}])},s0({head:_e(()=>[T("div",hZ,[L[2]||(L[2]=T("span",{class:"ah-ic"},"!",-1)),T("span",mZ,R(a()),1),T("span",gZ,[e.block.kind==="diff"||e.block.kind==="file"||e.block.kind==="fileop"?(w(),N(Le,{key:0},[qe(R(e.block.path),1)],64)):e.block.kind==="shell"?(w(),N(Le,{key:1},[qe(R(e.block.command),1)],64)):e.block.kind==="url"?(w(),N(Le,{key:2},[qe(R(e.block.url),1)],64)):e.block.kind==="search"?(w(),N(Le,{key:3},[qe(R(e.block.query),1)],64)):e.block.kind==="invocation"?(w(),N(Le,{key:4},[qe(R(e.block.name),1)],64)):e.block.kind==="generic"?(w(),N(Le,{key:5},[qe(R(e.block.summary),1)],64)):ie("",!0)]),e.agentName&&!r.value?(w(),ve(Is,{key:0,variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(x(o)("approval.subagentBadge",{name:e.agentName})),1)]),_:1})):ie("",!0),r.value?ie("",!0):(w(),ve(Is,{key:1,variant:"warning",size:"sm",class:"aw"},{default:_e(()=>[qe(R(x(o)("approval.required")),1)]),_:1})),oe(gn,{class:"amin",size:"sm",label:r.value?x(o)("question.expand"):x(o)("question.minimize"),onClick:L[0]||(L[0]=S=>r.value=!r.value)},{default:_e(()=>[r.value?(w(),ve(Je,{key:0,name:"chevron-down",size:"md"})):(w(),ve(Je,{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])])]),_:2},[r.value?void 0:{name:"default",fn:_e(()=>[e.block.kind==="plan_review"&&e.block.path?(w(),ve(Ht,{key:0,text:e.block.path},{default:_e(()=>[T("div",vZ,R(e.block.path),1)]),_:1},8,["text"])):ie("",!0),e.block.kind==="diff"?(w(),N("div",yZ,[(w(!0),N(Le,null,nt(e.block.diff,(S,I)=>(w(),N("div",{key:I,class:Re(["dl",S.kind==="add"?"add":S.kind==="rem"?"del":""])},[T("span",kZ,R(S.gutter),1),T("span",bZ,R(S.text),1)],2))),128))])):e.block.kind==="shell"?(w(),N("div",_Z,[T("div",wZ,[L[3]||(L[3]=T("span",{class:"shell-dollar"},"$",-1)),qe(" "+R(e.block.command),1)]),e.block.cwd?(w(),N("div",SZ,"cwd: "+R(e.block.cwd),1)):ie("",!0),e.block.danger?(w(),N("div",CZ,R(x(o)("approval.danger",{detail:e.block.danger})),1)):ie("",!0)])):e.block.kind==="file"?(w(),N("div",xZ,[T("div",AZ,[T("span",TZ,R(e.block.language??""),1)]),T("div",MZ,[(w(!0),N(Le,null,nt(e.block.content.split(`
|
|
256
|
+
`),(S,I)=>(w(),N("div",{key:I,class:"file-line"},[T("span",EZ,R(I+1),1),T("span",IZ,R(S),1)]))),128))])])):e.block.kind==="fileop"?(w(),N("div",$Z,[T("span",NZ,R(e.block.op),1),T("span",LZ,R(e.block.path),1),e.block.detail?(w(),N("span",OZ,R(e.block.detail),1)):ie("",!0)])):e.block.kind==="url"?(w(),N("div",PZ,[e.block.method?(w(),N("span",RZ,R(e.block.method),1)):ie("",!0),T("span",DZ,R(e.block.url),1)])):e.block.kind==="search"?(w(),N("div",BZ,[T("span",FZ,R(x(o)("approval.searchQueryLabel")),1),T("span",HZ,R(e.block.query),1),e.block.scope?(w(),N("span",WZ,R(x(o)("approval.searchScope",{scope:e.block.scope})),1)):ie("",!0)])):e.block.kind==="invocation"?(w(),N("div",zZ,[T("span",UZ,R(e.block.kind2),1),T("span",qZ,R(e.block.name),1),e.block.description?(w(),N("span",jZ,R(e.block.description),1)):ie("",!0)])):e.block.kind==="todo"?(w(),N("div",VZ,[(w(!0),N(Le,null,nt(e.block.items,(S,I)=>(w(),N("div",{key:I,class:"todo-item"},[T("span",KZ,R(S.status==="done"||S.status==="completed"?"✓":"○"),1),T("span",{class:Re(["todo-title",{"todo-done":S.status==="done"||S.status==="completed"}])},R(S.title),3)]))),128))])):e.block.kind==="plan_review"?(w(),N("div",GZ,[oe(Oh,{text:e.block.plan},null,8,["text"])])):(w(),N("div",YZ,[T("span",XZ,R(e.block.summary),1)])),c.value?(w(),N("div",QZ,[Mn(T("textarea",{ref_key:"feedbackRef",ref:d,"onUpdate:modelValue":L[1]||(L[1]=S=>u.value=S),class:"feedback-ta",placeholder:x(o)("approval.feedbackPlaceholder"),rows:"2",onKeydown:m},null,40,ZZ),[[ko,u.value]]),T("div",JZ,R(x(o)("approval.feedbackHint")),1)])):ie("",!0)]),key:"0"},r.value?void 0:{name:"foot",fn:_e(()=>[i.value?(w(),N("div",eJ,[i.value.options.length>0?(w(!0),N(Le,{key:0},nt(i.value.options,(S,I)=>(w(),ve(Ht,{key:I,text:S.description},{default:_e(()=>[oe(Dt,{class:"kbtn",size:"sm",variant:"primary",loading:b.value===`option:${S.label}`,disabled:e.busy,onClick:P=>O(S.label)},{default:_e(()=>[qe(R(S.label),1),T("span",tJ,"["+R(I+1)+"]",1)]),_:2},1032,["loading","disabled","onClick"])]),_:2},1032,["text"]))),128)):(w(),ve(Dt,{key:1,class:"kbtn",size:"sm",variant:"primary",loading:b.value==="approvePlan",disabled:e.busy,onClick:A},{default:_e(()=>[qe(R(x(o)("approval.approvePlan")),1),L[4]||(L[4]=T("span",{class:"k"},"[1]",-1))]),_:1},8,["loading","disabled"])),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",disabled:e.busy,onClick:$},{default:_e(()=>[qe(R(x(o)("approval.revise")),1),i.value.options.length===0?(w(),N("span",nJ,"[2]")):ie("",!0)]),_:1},8,["disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"danger-soft",loading:b.value==="rejectAndExit",disabled:e.busy,onClick:k},{default:_e(()=>[qe(R(x(o)("approval.rejectAndExit")),1),i.value.options.length===0?(w(),N("span",sJ,"[3]")):ie("",!0)]),_:1},8,["loading","disabled"])])):(w(),N("div",oJ,[oe(Dt,{class:"kbtn",size:"sm",variant:"primary",loading:b.value==="approve",disabled:e.busy,onClick:g},{default:_e(()=>[qe(R(x(o)("approval.approve")),1),L[5]||(L[5]=T("span",{class:"k"},"[1]",-1))]),_:1},8,["loading","disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",loading:b.value==="approveSession",disabled:e.busy,onClick:v},{default:_e(()=>[qe(R(x(o)("approval.approveSession")),1),L[6]||(L[6]=T("span",{class:"k"},"[2]",-1))]),_:1},8,["loading","disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",loading:b.value==="reject",disabled:e.busy,onClick:y},{default:_e(()=>[qe(R(x(o)("approval.reject")),1),L[7]||(L[7]=T("span",{class:"k"},"[3]",-1))]),_:1},8,["loading","disabled"]),oe(Dt,{class:"kbtn",size:"sm",variant:"secondary",disabled:e.busy,onClick:p},{default:_e(()=>[qe(R(x(o)("approval.feedback")),1),L[8]||(L[8]=T("span",{class:"k"},"[4]",-1))]),_:1},8,["disabled"])]))]),key:"1"}]),1032,["class"]))}}),rJ=ut(iJ,[["__scopeId","data-v-25706d67"]]),lJ=je({__name:"StatusGlyph",props:{status:{}},setup(e){const t=e,n={pending:"○",run:"●",done:"✓",fail:"✗"};return(s,o)=>(w(),N("span",{class:Re(["status-glyph",`s-${t.status}`]),"aria-hidden":"true"},R(n[t.status]),3))}}),T3=ut(lJ,[["__scopeId","data-v-aebe1130"]]),aJ={class:"taskspane"},cJ={class:"tp-head"},uJ={class:"tp-title"},dJ={class:"tp-count"},fJ={class:"tp-list"},pJ={key:0,class:"tp-empty"},hJ=["role","onClick"],mJ={class:"tp-name"},gJ={class:"tp-time"},vJ=["onClick"],yJ={key:0,class:"tp-detail"},kJ={key:0,class:"tp-codebox"},bJ=["onClick"],_J={class:"tp-pre"},wJ={class:"tp-cmd"},SJ={key:1,class:"tp-codebox"},CJ=["onClick"],xJ={class:"tp-pre"},AJ=je({__name:"TasksPane",props:{tasks:{}},emits:["cancel","open"],setup(e,{emit:t}){const n=t,{t:s}=It(),o=$s(new Set),i=$s(new Set),r=$s(new Set);function l(f){return!!(f.output&&f.output.length>0||f.meta)}function a(f){if(f.kind==="subagent"){n("open",f.id);return}l(f)&&(o.has(f.id)?o.delete(f.id):o.add(f.id))}function c(f){return f.kind==="subagent"||l(f)}function u(f){return f==="run"||f==="done"||f==="fail"?f:"pending"}async function d(f,m,b){await zs(f)&&(b.add(m),setTimeout(()=>b.delete(m),1500))}async function p(f){f.meta&&await d(f.meta,f.id,i)}async function h(f){const m=f.output?.join(`
|
|
257
257
|
`)??"";m&&await d(m,f.id,r)}return(f,m)=>(w(),N("div",aJ,[T("div",cJ,[T("span",uJ,R(x(s)("tasks.tag")),1),T("span",dJ,R(e.tasks.length),1)]),T("div",fJ,[e.tasks.length===0?(w(),N("div",pJ,R(x(s)("tasks.emptyTasks")),1)):(w(!0),N(Le,{key:1},nt(e.tasks,b=>(w(),N("div",{key:b.id,class:Re(["tp-row",{done:b.state==="done",fail:b.state==="fail",expandable:c(b)}])},[T("div",{class:"tp-main",role:c(b)?"button":void 0,onClick:_=>a(b)},[oe(T3,{status:u(b.state)},null,8,["status"]),T("span",mJ,R(b.name),1),oe(Is,{variant:"neutral",size:"sm"},{default:_e(()=>[qe(R(b.kind),1)]),_:2},1024),T("span",gJ,R(b.timing),1),b.state==="run"?(w(),N("button",{key:0,class:"tp-stop",onClick:vt(_=>n("cancel",b.id),["stop"])},R(x(s)("tasks.stop")),9,vJ)):ie("",!0),b.kind==="subagent"?(w(),ve(Je,{key:1,class:"tp-chevron",name:"chevron-right",size:"sm"})):l(b)?(w(),ve(Je,{key:2,class:Re(["tp-chevron",{open:o.has(b.id)}]),name:"chevron-right",size:"sm"},null,8,["class"])):ie("",!0)],8,hJ),o.has(b.id)&&l(b)?(w(),N("div",yJ,[b.meta?(w(),N("div",kJ,[T("button",{class:Re(["tp-copy",{copied:i.has(b.id)}]),onClick:vt(_=>p(b),["stop"])},R(i.has(b.id)?"已复制":"复制"),11,bJ),T("pre",_J,[T("code",null,[T("span",wJ,R(b.meta),1)])])])):ie("",!0),b.output&&b.output.length>0?(w(),N("div",SJ,[T("button",{class:Re(["tp-copy",{copied:r.has(b.id)}]),onClick:vt(_=>h(b),["stop"])},R(r.has(b.id)?"已复制":"复制"),11,CJ),T("pre",xJ,[T("code",null,[m[0]||(m[0]=qe(`
|
|
258
258
|
`,-1)),(w(!0),N(Le,null,nt(b.output,(_,g)=>(w(),N("span",{key:g,class:"tp-line"},R(_),1))),128)),m[1]||(m[1]=qe(`
|
|
259
|
-
`,-1))])])])):ie("",!0)])):ie("",!0)],2))),128))])]))}}),GS=ut(AJ,[["__scopeId","data-v-e4994414"]]),TJ={class:"todo-card"},MJ={key:0,class:"tc-empty"},EJ={class:"tc-name"},IJ=je({__name:"TodoCard",props:{todos:{}},setup(e){const t=e,{t:n}=It();function s(o){return o==="in_progress"?"run":o}return(o,i)=>(w(),N("div",TJ,[t.todos.length===0?(w(),N("div",MJ,[i[0]||(i[0]=T("svg",{class:"tc-empty-ico",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[T("path",{d:"M9 11l2 2 4-4"}),T("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"})],-1)),T("span",null,R(x(n)("tasks.emptyTodo")),1)])):ie("",!0),(w(!0),N(Le,null,nt(t.todos,(r,l)=>(w(),N("div",{key:l,class:Re(["tc-row",`s-${r.status}`])},[oe(T3,{status:s(r.status)},null,8,["status"]),T("span",EJ,R(r.title),1)],2))),128))]))}}),$J=ut(IJ,[["__scopeId","data-v-962a0d71"]]),NJ=["disabled","aria-pressed"],LJ=je({__name:"Pill",props:{clickable:{type:Boolean,default:!0},active:{type:Boolean},disabled:{type:Boolean},ariaPressed:{type:Boolean}},emits:["click"],setup(e){return(t,n)=>e.clickable?(w(),N("button",{key:0,class:Re(["ui-pill",{"is-active":e.active}]),type:"button",disabled:e.disabled,"aria-pressed":e.ariaPressed,onClick:n[0]||(n[0]=s=>t.$emit("click",s))},[Cn(t.$slots,"default",{},void 0,!0)],10,NJ)):(w(),N("span",{key:1,class:Re(["ui-pill",{"is-active":e.active}])},[Cn(t.$slots,"default",{},void 0,!0)],2))}}),cv=ut(LJ,[["__scopeId","data-v-153e43ad"]]),OJ={class:"dock-work-head"},PJ={key:0,class:"dock-work-tab static"},RJ={key:1,class:"dock-work-tab static"},DJ={key:2,class:"dock-work-tab static"},BJ={class:"dock-work-body"},FJ={class:"dw-count"},HJ={class:"dw-count"},WJ={class:"dw-count"},zJ=je({__name:"ChatDock",props:{sessionId:{},running:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},activationBadges:{},models:{},starredIds:{},skills:{},goal:{},goalExpandSignal:{},dockPanel:{},bashTasks:{},subagentTasks:{},bashRunning:{},subagentRunning:{},todoDoneCount:{},hasDockWork:{type:Boolean},todos:{},pendingQuestion:{},questionBusyKind:{},pendingApproval:{},approvalBusy:{type:Boolean},mobile:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel","answer","dismiss","approval","cancelTask","toggle-dock-panel","close-dock-panel","openAgent"],setup(e,{expose:t,emit:n}){const s=e,o=n,{t:i}=It(),r=Z(null),l=Z(null),a=Z(null);function c(p){r.value?.loadForEdit(p)}function u(){r.value?.focus()}function d(p){if(!s.dockPanel)return;const h=p.target;h&&(l.value?.contains(h)||a.value?.contains(h)||o("close-dock-panel"))}return Ke(()=>s.dockPanel,p=>{typeof document>"u"||(document.removeEventListener("mousedown",d,!0),p&&document.addEventListener("mousedown",d,!0))},{immediate:!0}),kn(()=>{typeof document<"u"&&document.removeEventListener("mousedown",d,!0)}),t({loadForEdit:c,focus:u}),(p,h)=>(w(),N("div",{class:Re(["chat-dock",[e.mobile?"align-mobile":"align-center"]]),onClick:h[28]||(h[28]=vt(()=>{},["stop"]))},[oe(Gr,{name:"dock-panel"},{default:_e(()=>[e.dockPanel?(w(),N("div",{key:0,ref_key:"workPanelRef",ref:l,class:"dock-work-panel",onClick:h[3]||(h[3]=vt(()=>{},["stop"]))},[T("div",OJ,[e.dockPanel==="bash"?(w(),N("span",PJ,R(x(i)("tasks.dockBash"))+" · "+R(e.bashRunning)+" "+R(x(i)("tasks.running")),1)):e.dockPanel==="subagent"?(w(),N("span",RJ,R(x(i)("tasks.dockSubagent"))+" · "+R(e.subagentRunning)+" "+R(x(i)("tasks.running")),1)):e.dockPanel==="todos"?(w(),N("span",DJ,R(x(i)("tasks.dockTodos"))+" · "+R(e.todoDoneCount)+"/"+R(e.todos?.length??0),1)):ie("",!0)]),T("div",BJ,[e.dockPanel==="bash"?(w(),ve(GS,{key:0,tasks:e.bashTasks,onCancel:h[0]||(h[0]=f=>o("cancelTask",f))},null,8,["tasks"])):e.dockPanel==="subagent"?(w(),ve(GS,{key:1,tasks:e.subagentTasks,onCancel:h[1]||(h[1]=f=>o("cancelTask",f)),onOpen:h[2]||(h[2]=f=>o("openAgent",f))},null,8,["tasks"])):e.dockPanel==="todos"?(w(),ve($J,{key:2,todos:e.todos??[]},null,8,["todos"])):ie("",!0)])],512)):ie("",!0)]),_:1}),e.goal?(w(),ve(HQ,{key:0,goal:e.goal,"force-expanded":e.goalExpandSignal,onControlGoal:h[4]||(h[4]=f=>o("controlGoal",f))},null,8,["goal","force-expanded"])):ie("",!0),e.hasDockWork?(w(),N("div",{key:1,ref_key:"workbarRef",ref:a,class:"dock-workbar"},[e.bashTasks.length>0?(w(),ve(cv,{key:0,active:e.dockPanel==="bash","aria-pressed":e.dockPanel==="bash",onClick:h[5]||(h[5]=f=>o("toggle-dock-panel","bash"))},{default:_e(()=>[oe(Je,{name:"clock",size:"md"}),T("span",null,R(x(i)("tasks.dockBash")),1),T("span",FJ,[h[29]||(h[29]=qe("(",-1)),T("b",null,R(e.bashTasks.length),1),h[30]||(h[30]=qe(")",-1))])]),_:1},8,["active","aria-pressed"])):ie("",!0),e.subagentTasks.length>0?(w(),ve(cv,{key:1,active:e.dockPanel==="subagent","aria-pressed":e.dockPanel==="subagent",onClick:h[6]||(h[6]=f=>o("toggle-dock-panel","subagent"))},{default:_e(()=>[oe(Je,{name:"sparkles",size:"md"}),T("span",null,R(x(i)("tasks.dockSubagent")),1),T("span",HJ,[h[31]||(h[31]=qe("(",-1)),T("b",null,R(e.subagentTasks.length),1),h[32]||(h[32]=qe(")",-1))])]),_:1},8,["active","aria-pressed"])):ie("",!0),(e.todos?.length??0)>0?(w(),ve(cv,{key:2,active:e.dockPanel==="todos","aria-pressed":e.dockPanel==="todos",onClick:h[7]||(h[7]=f=>o("toggle-dock-panel","todos"))},{default:_e(()=>[oe(Je,{name:"check-list",size:"md"}),T("span",null,R(x(i)("tasks.dockTodos")),1),T("span",WJ,[h[33]||(h[33]=qe("(",-1)),T("b",null,R(e.todoDoneCount)+"/"+R(e.todos?.length??0),1),h[34]||(h[34]=qe(")",-1))])]),_:1},8,["active","aria-pressed"])):ie("",!0)],512)):ie("",!0),e.pendingQuestion?(w(),ve(pZ,{key:e.pendingQuestion.questionId,question:e.pendingQuestion,"busy-kind":e.questionBusyKind,onAnswer:h[8]||(h[8]=(f,m)=>o("answer",f,m)),onDismiss:h[9]||(h[9]=f=>o("dismiss",f))},null,8,["question","busy-kind"])):e.pendingApproval?(w(),ve(rJ,{key:e.pendingApproval.approvalId,class:"dock-approval",block:e.pendingApproval.block,"agent-name":e.pendingApproval.agentName,busy:e.approvalBusy,onDecide:h[10]||(h[10]=f=>o("approval",e.pendingApproval.approvalId,f))},null,8,["block","agent-name","busy"])):(w(),ve(A3,{key:4,ref_key:"composerRef",ref:r,"session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,onSubmit:h[11]||(h[11]=f=>o("submit",f)),onSteer:h[12]||(h[12]=f=>o("steer",f)),onCommand:h[13]||(h[13]=f=>o("command",f)),onInterrupt:h[14]||(h[14]=f=>o("interrupt")),onSetPermission:h[15]||(h[15]=f=>o("setPermission",f)),onSetThinking:h[16]||(h[16]=f=>o("setThinking",f)),onTogglePlan:h[17]||(h[17]=f=>o("togglePlan")),onToggleSwarm:h[18]||(h[18]=f=>o("toggleSwarm")),onToggleGoal:h[19]||(h[19]=f=>o("toggleGoal")),onOpenBtw:h[20]||(h[20]=f=>o("openBtw")),onCreateGoal:h[21]||(h[21]=f=>o("createGoal",f)),onControlGoal:h[22]||(h[22]=f=>o("controlGoal",f)),onFocusGoal:h[23]||(h[23]=f=>o("focusGoal")),onFocusSwarm:h[24]||(h[24]=f=>o("focusSwarm")),onCompact:h[25]||(h[25]=f=>o("compact")),onPickModel:h[26]||(h[26]=f=>o("pickModel")),onSelectModel:h[27]||(h[27]=f=>o("selectModel",f))},null,8,["session-id","running","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","activation-badges","models","starred-ids","skills"]))],2))}}),UJ=ut(zJ,[["__scopeId","data-v-c6b691c5"]]),qJ=["aria-label","aria-hidden"],jJ={class:"toc-scroll"},VJ=["onClick"],KJ={class:"toc-label"},GJ=240,YJ=je({__name:"ConversationToc",props:{items:{},activeTurnId:{},mobile:{type:Boolean},sessionLoading:{type:Boolean}},emits:["select"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Z(null),r=Z(!0);let l=null;function a(){const u=i.value,d=u?.offsetParent;if(!u||!d)return;const p=u.getBoundingClientRect().left,h=d.getBoundingClientRect().right;r.value=h-p>=GJ}const c=F(()=>!n.mobile&&!n.sessionLoading&&n.items.length>1);return Ke(c,u=>{l?.disconnect(),l=null,u&&ht(()=>{const d=i.value,p=d?.offsetParent;!d||!p||(typeof ResizeObserver<"u"&&(l=new ResizeObserver(a),l.observe(p)),a())})},{immediate:!0}),ls(()=>{l?.disconnect(),l=null}),(u,d)=>c.value?(w(),N("nav",{key:0,ref_key:"navRef",ref:i,class:Re(["conversation-toc",{"toc-clipped":!r.value}]),"aria-label":x(o)("conversation.toc"),"aria-hidden":r.value?void 0:!0},[T("div",jJ,[(w(!0),N(Le,null,nt(e.items,p=>(w(),N("button",{key:p.id,type:"button",class:Re(["toc-row",{active:e.activeTurnId===p.id}]),onClick:h=>s("select",p.id)},[d[0]||(d[0]=T("span",{class:"toc-bar"},null,-1)),T("span",KJ,R(p.title),1)],10,VJ))),128))])],10,qJ)):ie("",!0)}}),XJ=ut(YJ,[["__scopeId","data-v-f85aa2e9"]]),QJ=5;function ZJ(e,t,n,s=QJ){if(n||e.length<=s)return e;const o=e.slice(0,s);if(t&&!o.some(i=>i.id===t)){const i=e.find(r=>r.id===t);i&&(o[s-1]=i)}return o}const JJ={class:"chat-layout"},eee={class:"empty-hint"},tee={class:"empty-hint-title"},nee={class:"empty-hint-text"},see={key:0,class:"ws-pick"},oee={class:"ws-pick-name"},iee={key:1,class:"ws-pick-menu"},ree=["onClick"],lee={class:"ws-pick-item-name"},aee={class:"ws-pick-item-path"},cee={key:0,class:"swarm-stack"},uee=["aria-label"],dee={key:0,class:"abort-toast",role:"status","aria-live":"polite"},fee={class:"abort-toast-text"},uv=80,YS=1e3,pee=420,hee=3e3,mee=je({__name:"ConversationPane",props:{turns:{},sessionId:{},approvals:{},gitInfo:{},tasks:{},todos:{},goal:{},swarms:{},activationBadges:{},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},questions:{},pendingQuestionActions:{},pendingApprovalActions:{},running:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},changes:{},fileReloadKey:{},sending:{type:Boolean},fastMoon:{type:Boolean},mobile:{type:Boolean},sessionLoading:{type:Boolean},compaction:{},hasMoreMessages:{type:Boolean},loadingMore:{type:Boolean},loadingMoreError:{type:Boolean},loadOlderMessages:{type:Function},models:{},starredIds:{},skills:{},workspaceName:{},workspaceRoot:{},gitDiffStats:{},workspaces:{},activeWorkspaceId:{},sessionTitle:{},pr:{},conversationToc:{type:Boolean}},emits:["submit","steer","approval","cancelTask","answer","dismiss","command","interrupt","unqueue","editQueued","reorderQueue","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","createGoal","controlGoal","compact","pickModel","selectModel","openFile","openMedia","openThinking","openCompaction","openAgent","openToolDiff","openChanges","refreshGitStatus","editMessage","selectWorkspace","addWorkspace","openPr","renameSession","forkSession","archiveSession"],setup(e,{expose:t,emit:n}){const s=e,o=n,i=Z(!1),r=Z(!1),l=F(()=>s.workspaces?.find(pe=>pe.id===s.activeWorkspaceId)?.name??s.workspaceName??""),a=F(()=>(s.workspaces?.length??0)>0),c=F(()=>ZJ(s.workspaces??[],s.activeWorkspaceId,r.value)),u=F(()=>(s.workspaces?.length??0)-c.value.length);Ke(i,de=>{de||(r.value=!1)});const d=F(()=>s.swarms?.filter(de=>de.members.some(pe=>pe.phase!=="completed"&&pe.phase!=="failed"))??[]);function p(de){i.value=!1,de!==s.activeWorkspaceId&&o("selectWorkspace",de)}const{t:h}=It();cc(Et.contentAlign);const f=Z(null),m=Z(null),b=Z(null),_=Z(!1),g=Z(0);let v=null;function y(de){(b.value??m.value)?.loadForEdit(de)}function A(){_.value=!0,v!==null&&clearTimeout(v),v=setTimeout(()=>{v=null,_.value=!1},2e3)}function O(){g.value++}function $(){ht(()=>{Fe.value?.querySelector(".swarm-card")?.scrollIntoView({behavior:"smooth",block:"center"})})}const k=F(()=>s.tasks.filter(de=>de.kind!=="subagent")),E=F(()=>s.tasks.filter(de=>de.kind==="subagent"&&de.runInBackground)),M=F(()=>k.value.filter(de=>de.state==="run").length),L=F(()=>E.value.filter(de=>de.state==="run").length);function S(de){const pe=s.tasks,Oe=pe.find(Wt=>Wt.id===de)??pe.find(Wt=>Wt.parentToolCallId===de);if(Oe)return Oe.id;const Qt=pe.filter(Wt=>Wt.kind==="subagent"&&!Wt.parentToolCallId);if(Qt.length===1)return Qt[0].id}En("resolveAgentTaskId",S);const I=F(()=>(s.todos??[]).filter(de=>de.status==="done").length),P=F(()=>k.value.length>0||E.value.length>0||(s.todos?.length??0)>0||(s.queued?.length??0)>0),D=Z(null),W=F(()=>s.gitInfo?s.changes?.length??0:0);function z(de){D.value=D.value===de?null:de}function q(){D.value=null}Ke(P,de=>{de||q()});function Q(de){if(de.role==="compaction")return h("conversation.compactedPlain");if(de.role==="user"){if(de.skillActivation)return`/${de.skillActivation.name}`;if(de.pluginCommand)return`/${de.pluginCommand.pluginId}:${de.pluginCommand.commandName}`;const Oe=de.text.trim().replaceAll(/\s+/g," ");return Oe.length>0?Oe:"user"}const pe=(de.text||de.thinking||"").trim().replaceAll(/\s+/g," ");return pe.length>0?pe:(de.tools?.length??0)>0?`${de.tools.length} tools`:"blun"}const X=F(()=>s.turns.filter(de=>de.role==="user").map((de,pe)=>({id:de.id,role:de.role,no:pe+1,title:Q(de)}))),fe=Z(null);function ye(){const de=Fe.value;if(!de)return;const pe=de.querySelectorAll(".turn-anchor[data-turn-id]");if(pe.length===0)return;const Oe=X.value;if(Oe.length===0)return;const Qt=new Set(Oe.map(bo=>bo.id));if(j()<=uv){fe.value=Oe[Oe.length-1].id;return}const Wt=de.getBoundingClientRect(),ds=Wt.height/2;let Bn=null;pe.forEach(bo=>{const ii=bo.dataset.turnId;if(!ii||!Qt.has(ii))return;bo.getBoundingClientRect().top-Wt.top<=ds&&(Bn=ii)}),fe.value=Bn??Oe[0].id}const Me=F(()=>s.questions&&s.questions.length>0?s.questions[0]:void 0),we=F(()=>{const de=Me.value;if(de)return s.pendingQuestionActions?.[de.questionId]}),ze=F(()=>s.approvals&&s.approvals.length>0?s.approvals[0]:void 0),Ue=F(()=>{const de=ze.value;return de?!!s.pendingApprovalActions?.[de.approvalId]:!1}),Fe=Z(null),rt=Z(null),le=Z(0),U=Z(0),G=F(()=>({"--panes-scrollbar-width":`${le.value}px`}));function ne(de){return de instanceof HTMLElement?de:de&&"$el"in de&&de.$el instanceof HTMLElement?de.$el:null}function H(){const de=Fe.value;le.value=de?Math.max(0,de.offsetWidth-de.clientWidth):0,U.value=rt.value?.offsetHeight??0}function J(de){const pe=ne(de);Fe.value=pe,pe&&oi()}function ce(de){const pe=ne(de);rt.value=pe??null,de&&"loadForEdit"in de&&typeof de.loadForEdit=="function"&&"focus"in de&&typeof de.focus=="function"?b.value={loadForEdit:de.loadForEdit.bind(de),focus:de.focus.bind(de)}:b.value=null,Xt()}const te=Z(!0),ue=Z(!1);function j(){const de=Fe.value;return de?de.scrollHeight-de.scrollTop-de.clientHeight:0}let Y=0,re=0,ge=0,Ae=0,Ie=0,ae=0;function Te(){return Date.now()<re}function Ve(){const de=Fe.value;if(!de)return;const pe=de.scrollTop;if(performance.now()-ge<100){Y=pe;return}const Oe=j();if(Te()){te.value=!0,ue.value=!1,Y=pe;return}pe<Y-1&&Oe>1?te.value=!1:Oe<=uv&&pe>Y+1&&(te.value=!0,ue.value=!1),Y=pe,ye()}function tt(de=!1){const pe=Fe.value;te.value=!0,ue.value=!1,pe&&(!de&&performance.now()<Ae||(de&&typeof pe.scrollTo=="function"?(ge=performance.now(),Ae=performance.now()+pee,pe.scrollTo({top:pe.scrollHeight,behavior:"smooth"})):pe.scrollTop=pe.scrollHeight,Y=pe.scrollTop))}function bt(de,pe){const Oe=de.querySelectorAll(".turn-anchor");for(const Qt of Oe)if(Qt.offsetTop>=pe){const Wt=Qt.dataset.turnId;if(Wt)return{id:Wt,top:Qt.offsetTop}}return null}async function kt(){if(!s.sessionId||!s.loadOlderMessages||s.loadingMore||!s.hasMoreMessages)return;const de=s.sessionId,pe=Fe.value,Oe=pe?.scrollTop??0,Qt=pe?.scrollHeight??0,Wt=pe?bt(pe,Oe):null;Zn.value=!0;try{await s.loadOlderMessages(de),await ht()}finally{Zn.value=!1}if(s.sessionId!==de)return;const ds=Fe.value;if(!ds)return;let Bn=0;if(Wt){const bo=ds.querySelector(`.turn-anchor[data-turn-id="${Tt(Wt.id)}"]`);bo&&(Bn=bo.offsetTop-Wt.top)}Bn===0&&(Bn=ds.scrollHeight-Qt),ds.scrollTop=Oe+Bn}function Tt(de){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(de):de.replaceAll(/["\\]/g,"\\$&")}function Pt(de){const pe=Fe.value;if(!pe)return;const Oe=pe.querySelector(`.turn-anchor[data-turn-id="${Tt(de)}"]`);Oe&&(te.value=!1,ue.value=j()>uv,Oe.scrollIntoView({behavior:"smooth",block:"center"}))}function mt(){const de=Fe.value;if(!de)return"none";const pe=de.firstElementChild,Oe=pe instanceof HTMLElement?pe.offsetHeight:0,Qt=rt.value?.offsetHeight??0;return`${de.scrollHeight}:${de.clientHeight}:${Oe}:${Qt}`}function Yt(de){return typeof requestAnimationFrame=="function"?requestAnimationFrame(de):setTimeout(de,16)}function Rn(de){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(de):clearTimeout(de)}function Dn(de=36){if(!te.value&&!Te())return;const pe=++ae;let Oe="",Qt=0,Wt=0;Ie&&(Rn(Ie),Ie=0);const ds=()=>{if(Ie=0,pe!==ae||!te.value&&!Te())return;tt(!1);const Bn=mt();Qt=Bn===Oe?Qt+1:0,Oe=Bn,Wt++,Qt<3&&Wt<de&&(Ie=Yt(ds))};Ie=Yt(ds)}function Ft(de,pe){return de!==void 0&&de.length>0&&pe.length>=de.length&&de.firstId!==pe.firstId&&de.lastId===pe.lastId&&de.lastTextLen===pe.lastTextLen&&de.lastThinkingLen===pe.lastThinkingLen&&de.lastToolsLen===pe.lastToolsLen&&de.approvalIds===pe.approvalIds}const bn=F(()=>{const de=(s.approvals??[]).map(ds=>ds.approvalId).join(","),pe=s.turns,Oe=pe.at(-1),Qt=Oe?.thinking?.length??0,Wt=Oe?.tools?.reduce((ds,Bn)=>ds+Bn.name.length+(Bn.arg?.length??0)+(Bn.output?.join("").length??0),0)??0;return{length:pe.length,firstId:pe[0]?.id??"",lastId:Oe?.id??"",lastTextLen:Oe?.text.length??0,lastThinkingLen:Qt,lastToolsLen:Wt,approvalIds:de}});Ke(bn,async(de,pe)=>{if(Zn.value&&Ft(pe,de)){ye();return}await ht(),te.value||Te()?tt(de.length<pe.length):ue.value=!0,ye()}),Ke(rt,()=>{Xt()}),Ke(()=>s.mobile,async()=>{await ht(),H()});const Vn=new Map;Ke(()=>s.fileReloadKey,async(de,pe)=>{const Oe=Fe.value;pe&&Oe&&Vn.set(String(pe),{top:Oe.scrollTop,following:te.value}),await ht();const Qt=Fe.value,Wt=de?Vn.get(String(de)):void 0;Wt&&Qt?(te.value=Wt.following,Qt.scrollTop=Wt.top,Y=Wt.top,Wt.following&&Dn()):(te.value=!0,Y=0,tt(!1),Dn()),ye()}),Ke(()=>s.sessionLoading,async(de,pe)=>{de||!pe||(te.value=!0,await ht(),Dn(),ye())}),Ke(()=>s.running,async(de,pe)=>{de||!pe||!te.value&&!Te()||(await ht(),Dn(48),ye())});function st(){te.value=!0,ue.value=!1,re=Date.now()+YS,ht(()=>{tt(!0),Dn(16)})}function In(de){st(),o("submit",de)}function _n(de){te.value=!0,ue.value=!1,re=Date.now()+YS,o("editMessage",de)}function Kn(de){const pe=s.queued?.[de]?.text??"";pe&&y(pe),o("editQueued",de)}function $n(de){o("reorderQueue",de)}function Ge(de,pe){st(),o("answer",de,pe)}function Ye(de,pe){!de||!pe||o("approval",de,pe)}let Ct=null,$t=null,mn=null,Nn=null,tn=0,Ln=!1;const Zn=Z(!1);function Mt(de){if(Zn.value||(Ln=Ln||de,tn))return;tn=(typeof requestAnimationFrame=="function"?requestAnimationFrame:Oe=>setTimeout(Oe,16))(()=>{tn=0;const Oe=Ln;Ln=!1,te.value||Te()?tt(!1):Oe&&(ue.value=!0)})}function us(){if(!$t)return;const de=Fe.value?.firstElementChild??null;de!==mn&&(mn&&$t.unobserve(mn),mn=de,de&&$t.observe(de))}function Xt(){if(!$t)return;const de=rt.value;de!==Nn&&(Nn&&$t.unobserve(Nn),Nn=de,de&&$t.observe(de))}function oi(){const de=Fe.value;H(),Ct&&(Ct.disconnect(),de&&Ct.observe(de,{childList:!0,subtree:!0,characterData:!0})),$t&&($t.disconnect(),mn=null,Nn=null,de&&$t.observe(de),us(),Xt())}function bs(){us(),Mt(!0)}function Do(){typeof document>"u"||document.visibilityState==="visible"&&te.value&&Dn()}const so=Z(!1);let qs=null;function oo(){so.value=!0,qs!==null&&clearTimeout(qs),qs=setTimeout(()=>{so.value=!1},hee)}function Nt(){oo(),o("interrupt")}function Xe(de){de.key==="Escape"&&(s.running||s.sending)&&(de.preventDefault(),Nt())}hn(()=>{ht(()=>{typeof MutationObserver=="function"&&(Ct=new MutationObserver(bs)),typeof ResizeObserver=="function"&&($t=new ResizeObserver(()=>{H(),Mt(!1)})),oi(),Dn(48),ye(),typeof document<"u"&&(document.addEventListener("visibilitychange",Do),document.addEventListener("keydown",Xe))})}),kn(()=>{Ct&&Ct.disconnect(),$t&&$t.disconnect(),tn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(tn),Ie&&Rn(Ie),qs!==null&&clearTimeout(qs),v!==null&&(clearTimeout(v),v=null),typeof document<"u"&&(document.removeEventListener("visibilitychange",Do),document.removeEventListener("keydown",Xe))});function ot(){(b.value??m.value)?.focus()}return t({loadComposerForEdit:y,focusComposer:ot}),(de,pe)=>(w(),N("section",{class:Re(["con",{mobile:e.mobile}])},[!e.mobile&&!(e.turns.length===0&&!e.sessionLoading)?(w(),ve(FY,{key:0,"session-id":e.sessionId,"workspace-name":e.workspaceName,"workspace-root":e.workspaceRoot,"session-title":e.sessionTitle,branch:e.gitInfo?.branch,ahead:e.gitInfo?.ahead,behind:e.gitInfo?.behind,"changes-count":W.value,"git-diff-stats":e.gitDiffStats,"is-git-repo":!!e.gitInfo,pr:e.pr,copied:_.value,onOpenChanges:pe[0]||(pe[0]=Oe=>o("openChanges")),onCopyAll:pe[1]||(pe[1]=Oe=>f.value?.copyConversation()),onCopyFinalSummary:pe[2]||(pe[2]=Oe=>f.value?.copyFinalSummary()),onOpenPr:pe[3]||(pe[3]=Oe=>e.pr&&o("openPr",e.pr.url)),onRenameSession:pe[4]||(pe[4]=(Oe,Qt)=>o("renameSession",Oe,Qt)),onForkSession:pe[5]||(pe[5]=Oe=>o("forkSession",Oe)),onArchiveSession:pe[6]||(pe[6]=Oe=>o("archiveSession",Oe))},null,8,["session-id","workspace-name","workspace-root","session-title","branch","ahead","behind","changes-count","git-diff-stats","is-git-repo","pr","copied"])):ie("",!0),e.conversationToc?(w(),ve(XJ,{key:1,items:X.value,"active-turn-id":fe.value,mobile:e.mobile,"session-loading":e.sessionLoading,onSelect:Pt},null,8,["items","active-turn-id","mobile","session-loading"])):ie("",!0),T("div",JJ,[T("div",{ref:J,class:"panes chat-scroll",onScrollPassive:Ve},[T("div",{class:Re(["content-wrap",[e.mobile?"align-mobile":"align-center"]])},[e.turns.length===0&&!e.sessionLoading?(w(),N(Le,{key:0},[pe[54]||(pe[54]=T("div",{class:"empty-spacer"},null,-1)),T("div",eee,[T("span",tee,R(x(h)("composer.emptyConversationTitle")),1),T("span",nee,R(x(h)("composer.emptyConversation")),1),a.value?(w(),N("div",see,[oe(Ht,{text:x(h)("conversation.switchWorkspace")},{default:_e(()=>[T("button",{type:"button",class:"ws-pick-btn",onClick:pe[7]||(pe[7]=vt(Oe=>i.value=!i.value,["stop"]))},[oe(Je,{name:"folder",size:"sm"}),T("span",oee,R(l.value),1),oe(Je,{class:Re(["ws-pick-chev",{open:i.value}]),name:"chevron-down",size:"sm"},null,8,["class"])])]),_:1},8,["text"]),i.value?(w(),N("div",{key:0,class:"ws-pick-backdrop",onClick:pe[8]||(pe[8]=Oe=>i.value=!1)})):ie("",!0),i.value?(w(),N("div",iee,[(w(!0),N(Le,null,nt(c.value,Oe=>(w(),N("button",{key:Oe.id,type:"button",class:Re(["ws-pick-item",{on:Oe.id===e.activeWorkspaceId}]),onClick:vt(Qt=>p(Oe.id),["stop"])},[T("span",lee,R(Oe.name),1),T("span",aee,R(Oe.shortPath),1)],10,ree))),128)),u.value>0?(w(),N("button",{key:0,type:"button",class:"ws-pick-item ws-pick-more",onClick:pe[9]||(pe[9]=vt(Oe=>r.value=!r.value,["stop"]))},[T("span",null,R(x(h)("conversation.moreWorkspaces",{count:u.value})),1)])):ie("",!0),pe[53]||(pe[53]=T("div",{class:"ws-pick-divider"},null,-1)),T("button",{type:"button",class:"ws-pick-action",onClick:pe[10]||(pe[10]=vt(Oe=>{i.value=!1,o("addWorkspace")},["stop"]))},[oe(Je,{name:"plus",size:"sm"}),T("span",null,R(x(h)("conversation.addWorkspace")),1)])])):ie("",!0)])):(w(),N("button",{key:1,type:"button",class:"empty-add-workspace",onClick:pe[11]||(pe[11]=Oe=>o("addWorkspace"))},[oe(Je,{name:"folder-plus",size:"sm"}),T("span",null,R(x(h)("conversation.addWorkspace")),1)]))]),oe(A3,{ref_key:"emptyComposerRef",ref:m,class:"empty-composer","session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,"hide-context":"",onSubmit:In,onSteer:pe[12]||(pe[12]=Oe=>o("steer",Oe)),onCommand:pe[13]||(pe[13]=Oe=>o("command",Oe)),onInterrupt:Nt,onUnqueue:pe[14]||(pe[14]=Oe=>o("unqueue",Oe)),onEditQueued:pe[15]||(pe[15]=Oe=>o("editQueued",Oe)),onSetPermission:pe[16]||(pe[16]=Oe=>o("setPermission",Oe)),onSetThinking:pe[17]||(pe[17]=Oe=>o("setThinking",Oe)),onTogglePlan:pe[18]||(pe[18]=Oe=>o("togglePlan")),onToggleSwarm:pe[19]||(pe[19]=Oe=>o("toggleSwarm")),onToggleGoal:pe[20]||(pe[20]=Oe=>o("toggleGoal")),onOpenBtw:pe[21]||(pe[21]=Oe=>o("command","/btw")),onCreateGoal:pe[22]||(pe[22]=Oe=>o("createGoal",Oe)),onControlGoal:pe[23]||(pe[23]=Oe=>o("controlGoal",Oe)),onFocusGoal:O,onFocusSwarm:$,onCompact:pe[24]||(pe[24]=Oe=>o("compact")),onPickModel:pe[25]||(pe[25]=Oe=>o("pickModel")),onSelectModel:pe[26]||(pe[26]=Oe=>o("selectModel",Oe))},null,8,["session-id","running","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","activation-badges","models","starred-ids","skills"]),pe[55]||(pe[55]=T("div",{class:"empty-spacer"},null,-1))],64)):(w(),N(Le,{key:1},[(w(),ve(S3,{ref_key:"chatPaneRef",ref:f,key:e.fileReloadKey??"no-session",turns:e.turns,approvals:e.approvals,running:e.running,sending:e.sending,"fast-moon":e.fastMoon,"session-loading":e.sessionLoading,compaction:e.compaction,"has-more-messages":e.hasMoreMessages,"loading-more":e.loadingMore,"loading-more-error":e.loadingMoreError,"is-following":te.value,"tool-diff-panel":!0,queued:e.queued,onOpenFile:pe[27]||(pe[27]=Oe=>o("openFile",Oe)),onOpenMedia:pe[28]||(pe[28]=Oe=>o("openMedia",Oe)),onCopyConversationCopied:A,onOpenThinking:pe[29]||(pe[29]=Oe=>o("openThinking",Oe)),onOpenCompaction:pe[30]||(pe[30]=Oe=>o("openCompaction",Oe)),onOpenAgent:pe[31]||(pe[31]=Oe=>o("openAgent",Oe)),onOpenToolDiff:pe[32]||(pe[32]=Oe=>o("openToolDiff",Oe)),onEditMessage:_n,onLoadOlderMessages:kt,onUnqueue:pe[33]||(pe[33]=Oe=>o("unqueue",Oe)),onEditQueued:Kn,onReorderQueue:$n},null,8,["turns","approvals","running","sending","fast-moon","session-loading","compaction","has-more-messages","loading-more","loading-more-error","is-following","queued"])),d.value.length>0?(w(),N("div",cee,[(w(!0),N(Le,null,nt(d.value,Oe=>(w(),ve(AQ,{key:Oe.id,group:Oe},null,8,["group"]))),128))])):ie("",!0)],64))],2)],32),e.turns.length===0&&!e.sessionLoading?ie("",!0):(w(),ve(UJ,{key:0,ref:ce,style:Gt(G.value),"session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,goal:e.goal,"goal-expand-signal":g.value,"dock-panel":D.value,"bash-tasks":k.value,"subagent-tasks":E.value,"bash-running":M.value,"subagent-running":L.value,"todo-done-count":I.value,"has-dock-work":P.value,todos:e.todos,"pending-question":Me.value,"question-busy-kind":we.value,"pending-approval":ze.value,"approval-busy":Ue.value,mobile:e.mobile,onToggleDockPanel:pe[34]||(pe[34]=Oe=>z(Oe)),onCloseDockPanel:pe[35]||(pe[35]=Oe=>q()),onOpenAgent:pe[36]||(pe[36]=Oe=>o("openAgent",Oe)),onAnswer:Ge,onDismiss:pe[37]||(pe[37]=Oe=>o("dismiss",Oe)),onApproval:Ye,onCancelTask:pe[38]||(pe[38]=Oe=>o("cancelTask",Oe)),onControlGoal:pe[39]||(pe[39]=Oe=>o("controlGoal",Oe)),onSubmit:In,onSteer:pe[40]||(pe[40]=Oe=>o("steer",Oe)),onCommand:pe[41]||(pe[41]=Oe=>o("command",Oe)),onInterrupt:Nt,onSetPermission:pe[42]||(pe[42]=Oe=>o("setPermission",Oe)),onSetThinking:pe[43]||(pe[43]=Oe=>o("setThinking",Oe)),onTogglePlan:pe[44]||(pe[44]=Oe=>o("togglePlan")),onToggleSwarm:pe[45]||(pe[45]=Oe=>o("toggleSwarm")),onToggleGoal:pe[46]||(pe[46]=Oe=>o("toggleGoal")),onOpenBtw:pe[47]||(pe[47]=Oe=>o("command","/btw")),onCreateGoal:pe[48]||(pe[48]=Oe=>o("createGoal",Oe)),onFocusGoal:O,onFocusSwarm:$,onCompact:pe[49]||(pe[49]=Oe=>o("compact")),onPickModel:pe[50]||(pe[50]=Oe=>o("pickModel")),onSelectModel:pe[51]||(pe[51]=Oe=>o("selectModel",Oe))},null,8,["style","session-id","running","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","activation-badges","models","starred-ids","skills","goal","goal-expand-signal","dock-panel","bash-tasks","subagent-tasks","bash-running","subagent-running","todo-done-count","has-dock-work","todos","pending-question","question-busy-kind","pending-approval","approval-busy","mobile"]))]),oe(Gr,{name:"pill"},{default:_e(()=>[ue.value?(w(),N("button",{key:0,class:"newmsg-pill",style:Gt({bottom:`${U.value+12}px`}),"aria-label":x(h)("conversation.jumpToLatestAria"),onClick:pe[52]||(pe[52]=Oe=>tt(!0))},[oe(Je,{class:"pill-chevron",name:"chevron-down",size:"md"}),qe(" "+R(x(h)("conversation.newMessages")),1)],12,uee)):ie("",!0)]),_:1}),oe(Gr,{name:"abort-toast"},{default:_e(()=>[so.value?(w(),N("div",dee,[T("span",fee,R(x(h)("conversation.manuallyAborted")),1)])):ie("",!0)]),_:1})],2))}}),gee=ut(mee,[["__scopeId","data-v-3a3f1612"]]),vee=["aria-selected","onClick"],yee=je({__name:"SegmentedControl",props:{modelValue:{},options:{},size:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,o)=>(w(),N("div",{class:Re(["ui-seg",`ui-seg--${e.size??"md"}`]),role:"tablist"},[(w(!0),N(Le,null,nt(e.options,i=>(w(),N("button",{key:i.value,class:Re(["ui-seg__item",{"is-on":i.value===e.modelValue}]),type:"button",role:"tab","aria-selected":i.value===e.modelValue,onClick:r=>n("update:modelValue",i.value)},R(i.label),11,vee))),128))],2))}}),Oo=ut(yee,[["__scopeId","data-v-8e9809dc"]]),kee={class:"ui-panel-header__title"},bee={key:0,class:"ui-panel-header__sub"},_ee=je({__name:"PanelHeader",props:{title:{},subtitle:{},closable:{type:Boolean,default:!0},closeLabel:{default:"Close"},wrap:{type:Boolean}},emits:["close"],setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-panel-header",{wrap:e.wrap}])},[T("span",kee,R(e.title),1),oe(Ht,{text:e.subtitle},{default:_e(()=>[e.subtitle?(w(),N("span",bee,R(e.subtitle),1)):ie("",!0)]),_:1},8,["text"]),Cn(t.$slots,"default",{},void 0,!0),e.closable?(w(),ve(gn,{key:0,class:"ui-panel-header__close",size:"sm",label:e.closeLabel,onClick:n[0]||(n[0]=s=>t.$emit("close"))},{default:_e(()=>[oe(Je,{name:"close",size:"sm"})]),_:1},8,["label"])):ie("",!0)],2))}}),Gl=ut(_ee,[["__scopeId","data-v-ccbb61e2"]]),wee={key:0,class:"fp-empty fp-error"},See={key:1,class:"fp-empty"},Cee={key:2,class:"fp-loading"},xee={class:"fp-path"},Aee={class:"fp-meta"},Tee={key:0,class:"fp-lines"},Mee={class:"fp-size"},Eee={key:3,class:"fp-search"},Iee=["placeholder"],$ee={key:0,class:"fp-search-count"},Nee=["href","aria-label"],Lee={key:1,class:"fp-code"},Oee={class:"fp-line-table"},Pee=["data-line"],Ree={class:"fp-gutter"},Dee=["innerHTML"],Bee={key:1,class:"fp-body fp-code"},Fee={class:"fp-line-table"},Hee=["data-line"],Wee={class:"fp-gutter"},zee=["innerHTML"],Uee={key:2,class:"fp-body"},qee=["srcdoc","title"],jee={key:1,class:"fp-code"},Vee={class:"fp-line-table"},Kee=["data-line"],Gee={class:"fp-gutter"},Yee=["innerHTML"],Xee={key:3,class:"fp-body fp-pdf-wrap"},Qee=["src","title"],Zee={key:1,class:"fp-binary-card"},Jee={class:"fp-binary-label"},ete={key:4,class:"fp-body fp-table-wrap"},tte={class:"fp-table"},nte=["data-line"],ste={key:5,class:"fp-body fp-image-wrap"},ote=["src","alt"],ite={key:1,class:"fp-binary-card"},rte={class:"fp-binary-icon"},lte={class:"fp-binary-label"},ate={key:6,class:"fp-body fp-code"},cte={class:"fp-line-table"},ute=["data-line"],dte={class:"fp-gutter"},fte=["innerHTML"],pte={key:7,class:"fp-body fp-binary-wrap"},hte={class:"fp-binary-card"},mte={class:"fp-binary-icon"},gte={class:"fp-binary-label"},vte=je({__name:"FilePreview",props:{file:{},loading:{type:Boolean},error:{},line:{},downloadUrl:{},closable:{type:Boolean},externalActions:{type:Boolean},openFile:{type:Function}},emits:["close","openExternal","reveal"],setup(e,{emit:t}){const{t:n}=It();function s(le,U){const G=U?U.split("/").filter(Boolean):[];for(const ne of le.split("/"))ne===""||ne==="."||(ne===".."?G.pop():G.push(ne));return G.join("/")}const o=Ut("resolveImage",async le=>le),i=F(()=>{const le=c.file?.path??"",U=le.lastIndexOf("/");return U>0?le.slice(0,U):""});function r(le){if(/^(https?:|data:|blob:)/i.test(le)||le.startsWith("/"))return le;const U=i.value;return U?s(le,U):le}async function l(le){const U=r(le);return o?o(U):U}En("resolveImage",l);function a(le){let U=le.path;if(/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(U)||U.startsWith("/"))return le;for(const ne of["#","?"]){const H=U.indexOf(ne);H!==-1&&(U=U.slice(0,H))}const G=i.value;return{...le,path:s(U,G)}}const c=e,u=t;function d(le){c.openFile?.(a(le))}const p=Z(null),h=F(()=>{const le=c.file;if(!le)return"binary";const U=le.mime??"",G=le.languageId??"",ne=le.path.toLowerCase();return U==="text/markdown"||G==="markdown"||G==="md"||ne.endsWith(".mdx")?"markdown":U==="application/json"||G==="json"?"json":U==="text/html"||G==="html"||ne.endsWith(".html")||ne.endsWith(".htm")?"html":U==="application/pdf"||ne.endsWith(".pdf")?"pdf":U==="text/csv"||G==="csv"||ne.endsWith(".csv")?"csv":U.startsWith("image/")?"image":le.isBinary?"binary":U.startsWith("text/")||G!==""?"text":"binary"});function f(le){const U=atob(le),G=Uint8Array.from(U,ne=>ne.charCodeAt(0));return new TextDecoder().decode(G)}const m=F(()=>{const le=c.file;if(!le)return"";if(le.encoding==="base64")try{return f(le.content)}catch{return le.content}return le.content}),b=F(()=>{if(h.value!=="json"||!c.file)return"";try{return JSON.stringify(JSON.parse(m.value),null,2)}catch{return m.value}}),_=F(()=>c.file?(h.value==="json"?b.value:m.value).split(`
|
|
260
|
-
`):[]),g=F(()=>c.file?h.value==="json"?b.value:m.value:""),v=Z(""),y=Z(0),A=F(()=>{const le=v.value.trim().toLowerCase();if(!le)return[];const U=[];return _.value.forEach((G,ne)=>{G.toLowerCase().includes(le)&&U.push(ne+1)}),U});Ke(v,()=>{y.value=0});function O(le,U=!1){le&&ht(()=>{const G=p.value?.querySelector(".fp-body"),ne=G?.querySelector(`[data-line="${le}"]`);if(!G||!ne)return;U&&(G.scrollTop=0);const H=G.getBoundingClientRect(),J=ne.getBoundingClientRect(),ce=J.top-H.top+G.scrollTop;G.scrollTop=ce-G.clientHeight/2+J.height/2})}Ke(()=>[c.file?.path,c.line],()=>O(c.line,!0),{immediate:!0});function $(le){const U=A.value;U.length!==0&&(y.value=(y.value+le+U.length)%U.length,O(U[y.value]))}function k(le){const U=A.value;return{target:c.line===le,hit:U.includes(le),active:U[y.value]===le}}function E(le){return le<1024?`${le} B`:le<1024*1024?`${(le/1024).toFixed(1)} KB`:`${(le/(1024*1024)).toFixed(1)} MB`}const M=Z(!1),L=Z(!1);function S(){c.file&&zs(g.value).then(le=>{le&&(M.value=!0,setTimeout(()=>{M.value=!1},1400))})}function I(){c.file&&zs(c.file.path).then(le=>{le&&(L.value=!0,setTimeout(()=>{L.value=!1},1400))})}const P=Z("preview"),D=Z("preview"),W=Z("fit");function z(le){P.value=le}function q(le){D.value=le}function Q(le){W.value=le}Ke(h,le=>{P.value=le==="html"?"preview":"source",D.value="preview",W.value="fit"});const X=F(()=>{const le=c.file;return!le||h.value!=="image"?null:le.sourceUrl?le.sourceUrl:le.encoding==="base64"?`data:${le.mime};base64,${le.content}`:le.mime==="image/svg+xml"?`data:${le.mime};charset=utf-8,${encodeURIComponent(le.content)}`:null}),fe=F(()=>{const le=c.file;return!le||h.value!=="pdf"?null:c.downloadUrl?c.downloadUrl:le.encoding==="base64"?`data:${le.mime};base64,${le.content}`:null}),ye=F(()=>c.file?["<!doctype html>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data: blob:; style-src 'unsafe-inline'; font-src data:;">`,m.value].join(""):"");function Me(le){const U=[];let G="",ne=!1;for(let H=0;H<le.length;H++){const J=le[H];J==='"'&&le[H+1]==='"'?(G+='"',H++):J==='"'?ne=!ne:J===","&&!ne?(U.push(G),G=""):G+=J}return U.push(G),U}const we=F(()=>_.value.slice(0,200).map(Me));function ze(le){return le.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function Ue(){const le=c.file;if(!le)return"";const U=le.languageId?.toLowerCase();return U||(le.path.split(".").pop()?.toLowerCase()??"")}function Fe(le){const U=Ue();let G=ze(le);return h.value==="json"||U==="json"||U==="jsonc"?(G=G.replace(/("[^&]*?")(\s*:)/g,'<span class="tok-key">$1</span>$2'),G=G.replace(/(:\s*)("[^&]*?")/g,'$1<span class="tok-string">$2</span>'),G=G.replace(/\b(true|false|null)\b/g,'<span class="tok-literal">$1</span>'),G=G.replace(/(:\s*)(-?\d+(?:\.\d+)?)/g,'$1<span class="tok-number">$2</span>'),G):h.value==="html"||U==="html"||U==="xml"||U==="svg"?(G=G.replace(/\s([A-Za-z_:][-A-Za-z0-9_:.]*)(=)/g,' <span class="tok-attr">$1</span>$2'),G=G.replace(/(".*?")/g,'<span class="tok-string">$1</span>'),G=G.replace(/(<\/?)([A-Za-z][\w:-]*)/g,'$1<span class="tok-tag">$2</span>'),G):(G=G.replace(/\b(async|await|break|case|catch|class|const|continue|else|export|extends|finally|for|from|function|if|import|interface|let|new|return|switch|throw|try|type|while)\b/g,'<span class="tok-keyword">$1</span>'),G=G.replace(/(".*?"|'.*?')/g,'<span class="tok-string">$1</span>'),G=G.replace(/(\/\/.*)$/g,'<span class="tok-comment">$1</span>'),G)}function rt(le,U=55){return!le||le.length<=U?le:"…"+le.slice(le.length-U+1)}return(le,U)=>(w(),N("div",{ref_key:"rootRef",ref:p,class:"file-preview"},[e.error&&!e.loading?(w(),N("div",wee,[T("span",null,R(e.error),1),e.closable?(w(),ve(Dt,{key:0,variant:"secondary",size:"sm",onClick:U[0]||(U[0]=G=>u("close"))},{default:_e(()=>[qe(R(x(n)("filePreview.close")),1)]),_:1})):ie("",!0)])):!e.file&&!e.loading?(w(),N("div",See,R(x(n)("filePreview.empty")),1)):e.loading?(w(),N("div",Cee,[U[7]||(U[7]=T("span",{class:"spinner"},null,-1)),T("span",null,R(x(n)("filePreview.loading")),1)])):e.file?(w(),N(Le,{key:3},[oe(Gl,{wrap:"",title:x(n)("common.preview"),closable:e.closable,"close-label":x(n)("filePreview.close"),onClose:U[6]||(U[6]=G=>u("close"))},{default:_e(()=>[oe(Ht,{text:e.file.path},{default:_e(()=>[T("span",xee,R(rt(e.file.path)),1)]),_:1},8,["text"]),T("span",Aee,[e.file.lineCount?(w(),N("span",Tee,R(x(n)("filePreview.lineCount",{count:e.file.lineCount})),1)):ie("",!0),T("span",Mee,R(E(e.file.size)),1)]),h.value==="html"?(w(),ve(Oo,{key:0,"model-value":P.value,size:"sm",options:[{value:"preview",label:x(n)("filePreview.preview")},{value:"source",label:x(n)("filePreview.source")}],"onUpdate:modelValue":z},null,8,["model-value","options"])):ie("",!0),h.value==="markdown"?(w(),ve(Oo,{key:1,"model-value":D.value,size:"sm",options:[{value:"preview",label:x(n)("filePreview.preview")},{value:"source",label:x(n)("filePreview.source")}],"onUpdate:modelValue":q},null,8,["model-value","options"])):ie("",!0),h.value==="image"?(w(),ve(Oo,{key:2,"model-value":W.value,size:"sm",options:[{value:"fit",label:x(n)("filePreview.fit")},{value:"actual",label:x(n)("filePreview.actual")}],"onUpdate:modelValue":Q},null,8,["model-value","options"])):ie("",!0),h.value==="text"||h.value==="json"||h.value==="html"||h.value==="csv"?(w(),N("div",Eee,[Mn(T("input",{"onUpdate:modelValue":U[1]||(U[1]=G=>v.value=G),class:"fp-search-input",type:"search",placeholder:x(n)("filePreview.search")},null,8,Iee),[[ko,v.value]]),v.value.trim()?(w(),N("span",$ee,R(A.value.length),1)):ie("",!0),oe(gn,{size:"sm",disabled:A.value.length===0,label:x(n)("filePreview.prevMatch"),onClick:U[2]||(U[2]=G=>$(-1))},{default:_e(()=>[oe(Je,{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),oe(gn,{size:"sm",disabled:A.value.length===0,label:x(n)("filePreview.nextMatch"),onClick:U[3]||(U[3]=G=>$(1))},{default:_e(()=>[oe(Je,{name:"arrow-down",size:"md"})]),_:1},8,["disabled","label"])])):ie("",!0),oe(gn,{size:"sm",class:Re({copied:L.value}),label:L.value?x(n)("filePreview.copied"):x(n)("filePreview.copyPath"),onClick:I},{default:_e(()=>[L.value?(w(),ve(Je,{key:1,class:"fp-check",name:"check",size:"md"})):(w(),ve(Je,{key:0,name:"link",size:"md"}))]),_:1},8,["class","label"]),e.externalActions?(w(),ve(gn,{key:4,size:"sm",label:x(n)("filePreview.openInEditor"),onClick:U[4]||(U[4]=G=>u("openExternal"))},{default:_e(()=>[oe(Je,{name:"external-link",size:"md"})]),_:1},8,["label"])):ie("",!0),e.externalActions?(w(),ve(gn,{key:5,size:"sm",label:x(n)("filePreview.reveal"),onClick:U[5]||(U[5]=G=>u("reveal"))},{default:_e(()=>[oe(Je,{name:"folder",size:"md"})]),_:1},8,["label"])):ie("",!0),e.downloadUrl?(w(),N("a",{key:6,class:"fp-download",href:e.downloadUrl,target:"_blank",rel:"noreferrer",download:"","aria-label":x(n)("filePreview.download")},[oe(Je,{name:"download",size:"md"})],8,Nee)):ie("",!0),!e.file.isBinary&&h.value!=="image"?(w(),ve(gn,{key:7,size:"sm",class:Re({copied:M.value}),label:M.value?x(n)("filePreview.copied"):x(n)("filePreview.copy"),onClick:S},{default:_e(()=>[M.value?(w(),ve(Je,{key:1,class:"fp-check",name:"check",size:"md"})):(w(),ve(Je,{key:0,name:"copy",size:"md"}))]),_:1},8,["class","label"])):ie("",!0)]),_:1},8,["title","closable","close-label"]),h.value==="markdown"?(w(),N("div",{key:0,class:Re(["fp-body",{"fp-markdown":D.value==="preview"}])},[D.value==="preview"?(w(),ve(Oh,{key:0,text:m.value,"open-file":c.openFile?d:void 0},null,8,["text","open-file"])):(w(),N("div",Lee,[T("div",Oee,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",Ree,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,Dee)],10,Pee))),128))])]))],2)):h.value==="json"?(w(),N("div",Bee,[T("div",Fee,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",Wee,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,zee)],10,Hee))),128))])])):h.value==="html"?(w(),N("div",Uee,[P.value==="preview"?(w(),N("iframe",{key:0,class:"fp-html-frame",sandbox:"",srcdoc:ye.value,title:e.file.path},null,8,qee)):(w(),N("div",jee,[T("div",Vee,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",Gee,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,Yee)],10,Kee))),128))])]))])):h.value==="pdf"?(w(),N("div",Xee,[fe.value?(w(),N("iframe",{key:0,class:"fp-pdf-frame",src:fe.value,title:e.file.path},null,8,Qee)):(w(),N("div",Zee,[T("span",Jee,R(x(n)("filePreview.pdfNoPreview")),1)]))])):h.value==="csv"?(w(),N("div",ete,[T("table",tte,[T("tbody",null,[(w(!0),N(Le,null,nt(we.value,(G,ne)=>(w(),N("tr",{key:ne,class:Re(k(ne+1)),"data-line":ne+1},[T("th",null,R(ne+1),1),(w(!0),N(Le,null,nt(G,(H,J)=>(w(),N("td",{key:J},R(H),1))),128))],10,nte))),128))])])])):h.value==="image"?(w(),N("div",ste,[X.value?(w(),N("img",{key:0,src:X.value,alt:e.file.path,class:Re(["fp-image",{actual:W.value==="actual"}])},null,10,ote)):(w(),N("div",ite,[T("span",rte,[oe(Je,{name:"image-off",size:"lg"})]),T("span",lte,R(x(n)("filePreview.imageNoPreview",{mime:e.file.mime,size:E(e.file.size)})),1)]))])):h.value==="text"?(w(),N("div",ate,[T("div",cte,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",dte,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,fte)],10,ute))),128))])])):(w(),N("div",pte,[T("div",hte,[T("span",mte,[oe(Je,{name:"file-off",size:"lg"})]),T("span",gte,R(x(n)("filePreview.binaryNoPreview",{mime:e.file.mime||x(n)("filePreview.unknownType"),size:E(e.file.size)})),1)])]))],64)):ie("",!0)],512))}}),yte=ut(vte,[["__scopeId","data-v-70bf9696"]]),kte={class:"tp"},bte=je({__name:"ThinkingPanel",props:{text:{},subtitle:{}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Z(null);return Ke(()=>n.text,()=>{const r=i.value;!r||!(r.scrollHeight-r.scrollTop-r.clientHeight<24)||ht(()=>{i.value&&(i.value.scrollTop=i.value.scrollHeight)})},{immediate:!0}),(r,l)=>(w(),N("div",kte,[oe(Gl,{title:x(o)("common.preview"),subtitle:e.subtitle??x(o)("thinking.panelTitle"),"close-label":x(o)("thinking.close"),onClose:l[0]||(l[0]=a=>s("close"))},null,8,["title","subtitle","close-label"]),T("pre",{ref_key:"bodyEl",ref:i,class:"tp-body"},R(e.text),513)]))}}),XS=ut(bte,[["__scopeId","data-v-a973197e"]]),_te={class:"ap"},wte={key:0,class:"ap-type"},Ste={key:1,class:"ap-reason"},Cte={key:2,class:"ap-field"},xte={class:"ap-field-body"},Ate={key:3,class:"ap-field"},Tte={class:"ap-field-body ap-live"},Mte={key:4,class:"ap-field"},Ete={class:"ap-field-body ap-progress"},Ite={key:0,class:"ap-call"},$te={key:1,class:"ap-output"},Nte=["onClick"],Lte={key:5,class:"ap-field"},Ote={class:"ap-field-body"},Pte=8,QS=5,ZS=2,Rte=je({__name:"AgentDetailPanel",props:{member:{}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=F(()=>(n.member.outputLines??[]).map(m=>m.trimEnd()).filter(m=>m.length>0)),r=F(()=>(n.member.text??"").trimEnd());function l(m){const b=[];let _=null,g=0;for(const v of m)v.startsWith("Calling ")?(_={key:`g${g++}`,call:v,output:[]},b.push(_)):_?_.output.push(v):(_={key:`g${g++}`,call:"",output:[v]},b.push(_));return b}const a=F(()=>l(i.value)),c=Z(new Set);function u(m){return c.value.has(m)}function d(m){const b=new Set(c.value);b.has(m)?b.delete(m):b.add(m),c.value=b}function p(m){return m.output.length-QS-ZS}function h(m){switch(m){case"queued":return"Queued";case"working":return"Working";case"suspended":return"Suspended";case"completed":return"Completed";case"failed":return"Failed"}}const f=Z(null);return Ke(()=>i.value.length+r.value.length,()=>{const m=f.value;!m||!(m.scrollHeight-m.scrollTop-m.clientHeight<24)||ht(()=>{f.value&&(f.value.scrollTop=f.value.scrollHeight)})},{immediate:!0}),(m,b)=>(w(),N("div",_te,[oe(Gl,{title:x(o)("common.preview"),subtitle:e.member.name,"close-label":x(o)("thinking.close"),onClose:b[0]||(b[0]=_=>s("close"))},{default:_e(()=>[oe(Is,{variant:"neutral",size:"sm",class:"ap-phase"},{default:_e(()=>[qe(R(h(e.member.phase)),1)]),_:1})]),_:1},8,["title","subtitle","close-label"]),T("div",{ref_key:"bodyEl",ref:f,class:"ap-body"},[e.member.subagentType?(w(),N("div",wte,R(e.member.subagentType),1)):ie("",!0),e.member.suspendedReason?(w(),N("div",Ste,R(e.member.suspendedReason),1)):ie("",!0),e.member.prompt?(w(),N("div",Cte,[b[1]||(b[1]=T("span",{class:"ap-field-label"},"Task",-1)),T("div",xte,R(e.member.prompt),1)])):ie("",!0),r.value?(w(),N("div",Ate,[b[2]||(b[2]=T("span",{class:"ap-field-label"},"Output",-1)),T("div",Tte,R(r.value),1)])):ie("",!0),a.value.length>0?(w(),N("div",Mte,[b[4]||(b[4]=T("span",{class:"ap-field-label"},"Progress",-1)),T("div",Ete,[(w(!0),N(Le,null,nt(a.value,_=>(w(),N("div",{key:_.key,class:"ap-group"},[_.call?(w(),N("div",Ite,[b[3]||(b[3]=T("span",{class:"ap-glyph","aria-hidden":"true"},"▶",-1)),qe(" "+R(_.call),1)])):ie("",!0),_.output.length>0?(w(),N("div",$te,[_.output.length<=Pte||u(_.key)?(w(!0),N(Le,{key:0},nt(_.output,(g,v)=>(w(),N("div",{key:v,class:"ap-out-line"},R(g),1))),128)):(w(),N(Le,{key:1},[(w(!0),N(Le,null,nt(_.output.slice(0,QS),(g,v)=>(w(),N("div",{key:v,class:"ap-out-line"},R(g),1))),128)),T("button",{type:"button",class:"ap-fold",onClick:g=>d(_.key)}," … ("+R(p(_))+" more) ",9,Nte),(w(!0),N(Le,null,nt(_.output.slice(-ZS),(g,v)=>(w(),N("div",{key:"t"+v,class:"ap-out-line"},R(g),1))),128))],64))])):ie("",!0)]))),128))])])):ie("",!0),e.member.summary?(w(),N("div",Lte,[b[5]||(b[5]=T("span",{class:"ap-field-label"},"Result",-1)),T("div",Ote,R(e.member.summary),1)])):ie("",!0)],512)]))}}),Dte=ut(Rte,[["__scopeId","data-v-d453da30"]]),Bte={class:"diff-lines"},Fte={key:0,class:"hunk-text"},Hte={class:"dl-gutter old"},Wte={class:"dl-gutter new"},zte={class:"dl-sign"},Ute={class:"dl-text"},qte=je({__name:"DiffLines",props:{lines:{}},setup(e){function t(o){return o.oldNo!==void 0?String(o.oldNo):""}function n(o){return o.newNo!==void 0?String(o.newNo):""}function s(o){return`dl-${o.type}`}return(o,i)=>(w(),N("div",Bte,[(w(!0),N(Le,null,nt(e.lines,(r,l)=>(w(),N("div",{key:l,class:Re(["dl",s(r)])},[r.type==="hunk"?(w(),N("span",Fte,R(r.text),1)):(w(),N(Le,{key:1},[T("span",Hte,R(t(r)),1),T("span",Wte,R(n(r)),1),T("span",zte,R(r.type==="add"?"+":r.type==="del"?"-":" "),1),T("span",Ute,R(r.text),1)],64))],2))),128))]))}}),M3=ut(qte,[["__scopeId","data-v-cc107be2"]]),jte={class:"tdp"},Vte={class:"tdp-body"},Kte={key:1,class:"tdp-output"},Gte={key:2,class:"tdp-empty"},Yte=je({__name:"ToolDiffPanel",props:{target:{}},emits:["close"],setup(e,{emit:t}){const n=t,{t:s}=It();return(o,i)=>(w(),N("div",jte,[oe(Gl,{title:e.target.title,subtitle:e.target.path,"close-label":x(s)("thinking.close"),onClose:i[0]||(i[0]=r=>n("close"))},null,8,["title","subtitle","close-label"]),T("div",Vte,[e.target.lines&&e.target.lines.length>0?(w(),ve(M3,{key:0,lines:e.target.lines},null,8,["lines"])):e.target.output&&e.target.output.length>0?(w(),N("div",Kte,[(w(!0),N(Le,null,nt(e.target.output,(r,l)=>(w(),N("div",{key:l},R(r),1))),128))])):(w(),N("div",Gte,R(x(s)("diff.noDiff")),1))])]))}}),Xte=ut(Yte,[["__scopeId","data-v-589e903e"]]),Qte={class:"sc"},Zte={key:0,class:"sc-empty"},Jte={key:2,class:"sc-loading","aria-hidden":"true"},ene={class:"sc-composer"},tne=["placeholder"],nne=["disabled"],sne=je({__name:"SideChatPanel",props:{turns:{},running:{type:Boolean},sending:{type:Boolean},title:{},subtitle:{}},emits:["send","close"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=F(()=>n.turns.find(g=>g.role==="user")?.text?.trim()??""),r=F(()=>n.title?.trim()||o("sideChat.title")),l=F(()=>n.subtitle?.trim()?n.subtitle.trim():i.value||o("sideChat.subtitle")),a=Z(""),c=Z(null),u=Z(null);function d(){const _=a.value.trim();_&&(s("send",_),a.value="",ht(()=>{c.value&&(c.value.style.height="auto"),p()}))}function p(){const _=u.value;_&&(_.scrollTop=_.scrollHeight)}const h=F(()=>{const _=n.turns;if(_.length===0)return"0";const g=_.at(-1),v=g.thinking?.length??0,y=g.tools?.reduce((A,O)=>A+O.name.length+(O.arg?.length??0)+(O.output?.join("").length??0),0)??0;return`${_.length}:${g.text.length}:${v}:${y}`});Ke(h,async()=>{!n.running&&!n.sending||(await ht(),p())});const f=F(()=>n.sending?n.turns.at(-1)?.role==="user":!1);function m(_){_.key==="Enter"&&!_.shiftKey&&!_.isComposing&&(_.preventDefault(),d())}function b(){const _=c.value;_&&(_.style.height="auto",_.style.height=`${Math.min(_.scrollHeight,160)}px`)}return(_,g)=>(w(),N("div",Qte,[oe(Gl,{title:r.value,subtitle:l.value,"close-label":x(o)("thinking.close"),onClose:g[0]||(g[0]=v=>s("close"))},null,8,["title","subtitle","close-label"]),T("div",{ref_key:"bodyRef",ref:u,class:"sc-body"},[e.turns.length===0?(w(),N("div",Zte,R(x(o)("sideChat.empty")),1)):(w(),ve(S3,{key:1,turns:e.turns,approvals:[],running:e.running,sending:e.sending},null,8,["turns","running","sending"])),f.value?(w(),N("div",Jte,[oe(w3)])):ie("",!0)],512),T("div",ene,[Mn(T("textarea",{ref_key:"inputRef",ref:c,"onUpdate:modelValue":g[1]||(g[1]=v=>a.value=v),class:"sc-input",rows:"1",placeholder:x(o)("sideChat.placeholder"),onInput:b,onKeydown:m},null,40,tne),[[ko,a.value]]),oe(Ht,{text:x(o)("sideChat.send")},{default:_e(()=>[T("button",{type:"button",class:"sc-send",disabled:!a.value.trim(),onClick:d},[oe(Je,{name:"arrow-right",size:"sm"})],8,nne)]),_:1},8,["text"])])]))}}),one=ut(sne,[["__scopeId","data-v-3806a0d3"]]),ine={class:"changes-pane"},rne={class:"dv-path"},lne={class:"diff-head"},ane={class:"back-label"},cne={key:0,class:"empty-state"},une={key:1,class:"dv-lines-wrap"},dne={key:2,class:"empty-state"},fne={class:"dv-change-count"},pne={class:"ch-head"},hne={class:"br-label"},mne={class:"br-name"},gne={key:0,class:"sync-info"},vne={key:0,class:"ahead"},yne={key:0,class:"behind"},kne={key:1,class:"empty-head"},bne={key:0,class:"ch-list"},_ne=["onClick"],wne={class:"fpath"},Sne={key:1,class:"ch-list ch-tree"},Cne={class:"tree-list"},xne=["onClick"],Ane={class:"tree-name"},Tne=["onClick"],Mne={class:"tree-name"},Ene={key:2,class:"empty-state"},Ine={key:3,class:"empty-state"},$ne=je({__name:"DiffView",props:{changes:{},gitInfo:{},fileDiff:{},selectedDiffPath:{},fileDiffLoading:{type:Boolean},mode:{default:"full"},hideBack:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},emits:["open","back","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(L){const S=L.toLowerCase();return S==="modified"?"modified":S==="added"?"added":S==="deleted"?"deleted":S==="renamed"?"renamed":S==="untracked"?"untracked":S==="conflicted"?"conflicted":S==="ignored"?"ignored":S==="clean"?"clean":"unknown"}const r={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"I",clean:"·",unknown:"?"};function l(L){return r[i(L)]??"?"}function a(L,S=60){return L.length<=S?L:"…"+L.slice(L.length-S+1)}const c=F(()=>s.gitInfo!==null),u=F(()=>s.changes.length>0),d=F(()=>(s.selectedDiffPath??null)!==null),p=F(()=>s.mode==="detail"||s.mode==="full"&&d.value),h=F(()=>s.fileDiff??[]),f=F(()=>s.fileDiffLoading===!0);function m(L){o("open",L)}function b(){o("back")}function _(){o("close")}const g=Z("list");function v(L){g.value=L}function y(L){const S={children:[]},I=[...L].sort((P,D)=>P.path.localeCompare(D.path));for(const P of I){const D=P.path.split("/");let W=S;for(let z=0;z<D.length;z++){const q=D[z],Q=z===D.length-1,X=D.slice(0,z+1).join("/");let fe=W.children.find(ye=>ye.name===q&&ye.kind===(Q?"file":"folder"));fe||(fe={name:q,path:X,kind:Q?"file":"folder",status:Q?P.status:void 0,children:[]},W.children.push(fe)),W=fe}}return S.children}const A=F(()=>y(s.changes)),O=Z(new Set);function $(L){return!O.value.has(L)}const k=F(()=>{const L=[];function S(I,P){for(const D of I)L.push({node:D,depth:P}),D.kind==="folder"&&$(D.path)&&S(D.children,P+1)}return S(A.value,0),L});function E(L){const S=new Set(O.value);S.has(L.path)?S.delete(L.path):S.add(L.path),O.value=S}function M(L){return`${16+L*16}px`}return(L,S)=>(w(),N("div",ine,[p.value?(w(),N(Le,{key:0},[oe(Gl,{title:x(n)("diff.title"),closable:e.closable,"close-label":x(n)("diff.close"),onClose:_},{default:_e(()=>[oe(Ht,{text:e.selectedDiffPath??""},{default:_e(()=>[T("span",rne,R(a(e.selectedDiffPath??"",50)),1)]),_:1},8,["text"])]),_:1},8,["title","closable","close-label"]),T("div",lne,[e.hideBack?ie("",!0):(w(),ve(Dt,{key:0,variant:"ghost",size:"sm",onClick:b},{default:_e(()=>[S[0]||(S[0]=T("span",{"aria-hidden":"true"},"←",-1)),T("span",ane,R(x(n)("diff.back")),1)]),_:1}))]),f.value?(w(),N("div",cne,R(x(n)("diff.loading")),1)):h.value.length>0?(w(),N("div",une,[oe(M3,{lines:h.value},null,8,["lines"])])):(w(),N("div",dne,R(x(n)("diff.noDiff")),1))],64)):(w(),N(Le,{key:1},[oe(Gl,{title:x(n)("diff.title"),closable:e.closable,"close-label":x(n)("diff.close"),onClose:_},{default:_e(()=>[T("span",fne,R(x(n)("diff.changeCount",{count:e.changes.length})),1),oe(Oo,{"model-value":g.value,size:"sm",options:[{value:"list",label:x(n)("diff.list")},{value:"tree",label:x(n)("diff.tree")}],"onUpdate:modelValue":v},null,8,["model-value","options"])]),_:1},8,["title","closable","close-label"]),T("div",pne,[c.value?(w(),N(Le,{key:0},[T("span",hne,R(x(n)("diff.branch")),1),T("span",mne,R(e.gitInfo.branch),1),e.gitInfo.ahead>0||e.gitInfo.behind>0?(w(),N("span",gne,[oe(Ht,{text:x(n)("diff.aheadTitle")},{default:_e(()=>[e.gitInfo.ahead>0?(w(),N("span",vne,"↑"+R(e.gitInfo.ahead),1)):ie("",!0)]),_:1},8,["text"]),oe(Ht,{text:x(n)("diff.behindTitle")},{default:_e(()=>[e.gitInfo.behind>0?(w(),N("span",yne,"↓"+R(e.gitInfo.behind),1)):ie("",!0)]),_:1},8,["text"])])):ie("",!0)],64)):(w(),N("span",kne,R(x(n)("diff.empty")),1))]),u.value&&g.value==="list"?(w(),N("div",bne,[(w(!0),N(Le,null,nt(e.changes,I=>(w(),ve(Ht,{key:I.path,text:I.path},{default:_e(()=>[T("button",{type:"button",class:"ch-row",onClick:P=>m(I.path)},[T("span",{class:Re(["badge",i(I.status)])},R(l(I.status)),3),T("span",wne,R(a(I.path)),1)],8,_ne)]),_:2},1032,["text"]))),128))])):u.value&&g.value==="tree"?(w(),N("div",Sne,[T("ul",Cne,[(w(!0),N(Le,null,nt(k.value,({node:I,depth:P})=>(w(),N("li",{key:I.path,class:"tree-node"},[I.kind==="folder"?(w(),N("button",{key:0,type:"button",class:"tree-row tree-folder",style:Gt({paddingLeft:M(P)}),onClick:D=>E(I)},[oe(Je,{class:"tree-icon",name:"folder-solid",size:"sm"}),T("span",Ane,R(I.name),1)],12,xne)):(w(),ve(Ht,{key:1,text:I.path},{default:_e(()=>[T("button",{type:"button",class:"tree-row tree-file",style:Gt({paddingLeft:M(P)}),onClick:D=>m(I.path)},[T("span",{class:Re(["badge",i(I.status)])},R(l(I.status)),3),T("span",Mne,R(I.name),1)],12,Tne)]),_:2},1032,["text"]))]))),128))])])):c.value?(w(),N("div",Ene,R(x(n)("diff.clean")),1)):(w(),N("div",Ine,R(x(n)("diff.empty")),1))],64))]))}}),Nne=ut($ne,[["__scopeId","data-v-6b7fac61"]]);function Sy(e,t){let n=null;hn(()=>{n=typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null,ht(()=>{const s=t?.value??e.value;try{s?.focus()}catch{}})}),ls(()=>{const s=n;if(n=null,!(!s||typeof document>"u"||!document.contains(s)))try{s.focus()}catch{}})}const Lne=["type","value","placeholder","disabled","readonly"],One=je({__name:"Input",props:{modelValue:{},size:{default:"md"},type:{default:"text"},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},error:{type:Boolean}},emits:["update:modelValue","focus","blur"],setup(e,{expose:t,emit:n}){const s=n,o=Z();function i(a){s("update:modelValue",a.target.value)}function r(){o.value?.focus()}function l(){o.value?.select()}return t({focus:r,select:l,el:o}),(a,c)=>(w(),N("input",{ref_key:"el",ref:o,class:Re(["ui-input",[`ui-input--${e.size}`,{"has-error":e.error}]]),type:e.type,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,onInput:i,onFocus:c[0]||(c[0]=u=>a.$emit("focus",u)),onBlur:c[1]||(c[1]=u=>a.$emit("blur",u))},null,42,Lne))}}),sc=ut(One,[["__scopeId","data-v-29a26c16"]]),Pne={class:"search-wrap"},Rne={key:0,class:"tab-strip"},Dne={key:1,class:"state-row"},Bne={key:2,class:"state-row unavail"},Fne={key:3,class:"model-list"},Hne=["aria-selected","onClick","onMouseenter"],Wne={class:"check"},zne={class:"model-main"},Une={class:"model-name"},qne={class:"model-id"},jne={key:0,class:"caps"},Vne={class:"model-provider"},Kne={class:"model-ctx"},Gne={key:0,class:"empty"},Yne={class:"footer-hint"},Xne=je({__name:"ModelPicker",props:{models:{},current:{},starredIds:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:["select","toggle-star","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=F(()=>new Set(s.starredIds??[]));function r(v){return i.value.has(v)}const l=Z(""),a=Z(null),c=Z(null),u=Z("all");Sy(c,a);const d=F(()=>{const v=new Set,y=[{id:"all",label:n("model.allTab")}];for(const A of s.models)v.has(A.provider)||(v.add(A.provider),y.push({id:A.provider,label:A.provider}));return y}),p=F(()=>{const v=l.value.toLowerCase().trim(),y=s.models.filter(A=>{if(u.value!=="all"&&A.provider!==u.value)return!1;const O=(A.displayName??A.model).toLowerCase().includes(v),$=A.provider.toLowerCase().includes(v),k=A.id.toLowerCase().includes(v);return!v||O||$||k});return u.value!=="all"?y:y.sort((A,O)=>{const $=r(A.id)?1:0;return(r(O.id)?1:0)-$})}),h=F(()=>p.value),f=Z(0);Ke([l,u],()=>{f.value=0}),Ke(d,v=>{v.some(y=>y.id===u.value)||(u.value="all")}),Ke(h,v=>{f.value=Math.min(f.value,Math.max(v.length-1,0))});function m(v){if(v.key==="Escape"){o("close");return}if(v.key==="ArrowDown")v.preventDefault(),f.value=Math.min(f.value+1,h.value.length-1);else if(v.key==="ArrowUp")v.preventDefault(),f.value=Math.max(f.value-1,0);else if(v.key==="Enter"){const y=h.value[f.value];y&&o("select",y.id)}}hn(()=>{document.addEventListener("keydown",m)}),kn(()=>{document.removeEventListener("keydown",m)});function b(v){o("select",v)}function _(v){return h.value.indexOf(v)}function g(v){u.value=v}return(v,y)=>(w(),ve(ar,{open:!0,"close-on-esc":!1,title:x(n)("model.title"),size:"xl",height:"fixed",onClose:y[1]||(y[1]=A=>o("close"))},{default:_e(()=>[T("div",{ref_key:"dialogRef",ref:c,class:"mp"},[T("div",Pne,[oe(sc,{ref_key:"searchRef",ref:a,modelValue:l.value,"onUpdate:modelValue":y[0]||(y[0]=A=>l.value=A),placeholder:x(n)("model.searchPlaceholder"),autocomplete:"off",spellcheck:"false",autofocus:""},null,8,["modelValue","placeholder"])]),d.value.length>1?(w(),N("div",Rne,[(w(!0),N(Le,null,nt(d.value,A=>(w(),ve(Dt,{key:A.id,variant:A.id===u.value?"secondary":"ghost",size:"sm",onClick:O=>g(A.id)},{default:_e(()=>[qe(R(A.label),1)]),_:2},1032,["variant","onClick"]))),128))])):ie("",!0),e.loading?(w(),N("div",Dne,[oe(ni,{size:"sm"}),T("span",null,R(x(n)("model.loading")),1)])):e.unavailable?(w(),N("div",Bne,[oe(Je,{name:"alert-triangle",size:"lg"}),T("span",null,R(x(n)("model.unavailable")),1)])):(w(),N("div",Fne,[(w(!0),N(Le,null,nt(h.value,A=>(w(),N("div",{key:A.id,class:Re(["model-row",{"is-current":A.id===e.current,"is-selected":_(A)===f.value}]),role:"option","aria-selected":A.id===e.current,onClick:O=>b(A.id),onMouseenter:O=>f.value=_(A)},[T("span",Wne,[A.id===e.current?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",zne,[T("span",Une,R(A.displayName??A.model),1),T("span",qne,R(A.id),1),A.capabilities&&A.capabilities.length>0?(w(),N("span",jne,[(w(!0),N(Le,null,nt(A.capabilities,O=>(w(),ve(Is,{key:O,variant:"info",size:"sm"},{default:_e(()=>[qe(R(O),1)]),_:2},1024))),128))])):ie("",!0)]),T("span",Vne,R(A.provider),1),T("span",Kne,R(x(n)("model.contextSuffix",{size:Math.round(A.maxContextSize/1e3)})),1),oe(gn,{size:"sm",label:r(A.id)?x(n)("model.unstarTitle"):x(n)("model.starTitle"),onClick:vt(O=>o("toggle-star",A.id),["stop"])},{default:_e(()=>[r(A.id)?(w(),ve(Je,{key:0,name:"star",size:"md"})):(w(),ve(Je,{key:1,name:"star-outline",size:"md"}))]),_:2},1032,["label","onClick"])],42,Hne))),128)),h.value.length===0&&!e.loading&&!e.unavailable?(w(),N("div",Gne,R(s.models.length===0?x(n)("model.emptyNoModels"):x(n)("model.emptyNoMatch")),1)):ie("",!0)])),T("div",Yne,R(x(n)("model.footerHint")),1)],512)]),_:1},8,["title"]))}}),Qne=ut(Xne,[["__scopeId","data-v-4b5503fc"]]),Zne={key:0,class:"ui-field__label"},Jne={key:1,class:"ui-field__error"},ese={key:2,class:"ui-field__hint"},tse=je({__name:"Field",props:{label:{},hint:{},error:{}},setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-field",{"has-error":!!e.error}])},[e.label?(w(),N("label",Zne,R(e.label),1)):ie("",!0),Cn(t.$slots,"default",{},void 0,!0),e.error?(w(),N("span",Jne,R(e.error),1)):e.hint?(w(),N("span",ese,R(e.hint),1)):ie("",!0)],2))}}),zf=ut(tse,[["__scopeId","data-v-4e85a1b8"]]),nse={class:"prov-list"},sse={key:0,class:"state-row"},ose={key:1,class:"state-row unavail"},ise={key:2,class:"empty"},rse={class:"prov-info"},lse={class:"prov-type"},ase={key:0,class:"prov-url"},cse={class:"prov-meta"},use={key:0},dse={class:"prov-actions"},fse={key:0,class:"add-section"},pse={key:0,class:"add-btns"},hse={key:1,class:"add-form"},mse={key:0,class:"add-error"},gse={class:"form-btns"},vse={class:"footer-hint"},yse=je({__name:"ProviderManager",props:{providers:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:["add","refresh","delete","openLogin","close"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=Z(null);Sy(o);const i=e,r=F(()=>i.providers.filter(g=>g.type.toLowerCase()==="blun")),l=t;async function a(g){await s({title:n("providers.delete"),message:n("providers.confirmDelete"),variant:"danger"})&&l("delete",g)}const c=Z(!1),u=$s({apiKey:"",baseUrl:"",defaultModel:""}),d=Z("");function p(){u.apiKey="",u.baseUrl="",u.defaultModel="",d.value="",c.value=!0}function h(){c.value=!1}function f(){if(!u.apiKey.trim()){d.value=n("providers.apiKeyRequired");return}d.value="",l("add",{type:"blun",apiKey:u.apiKey.trim()||void 0,baseUrl:u.baseUrl.trim()||void 0,defaultModel:u.defaultModel.trim()||void 0}),c.value=!1}function m(g){if(g.key==="Escape"){if(c.value){h();return}l("close")}}hn(()=>document.addEventListener("keydown",m)),kn(()=>document.removeEventListener("keydown",m));function b(g){return g==="connected"?"var(--color-success)":g==="error"?"var(--color-danger)":"var(--color-text-faint)"}function _(g){return n(g==="connected"?"providers.status.connected":g==="error"?"providers.status.error":"providers.status.unconfigured")}return(g,v)=>(w(),ve(ar,{open:!0,"close-on-esc":!1,title:x(n)("providers.title"),size:"xl",height:"fixed",onClose:v[4]||(v[4]=y=>l("close"))},{default:_e(()=>[T("div",{ref_key:"dialogRef",ref:o,class:"pm"},[T("div",nse,[e.loading?(w(),N("div",sse,[oe(ni,{size:"sm"}),T("span",null,R(x(n)("providers.loading")),1)])):e.unavailable?(w(),N("div",ose,[oe(Je,{name:"alert-triangle",size:"md"}),T("span",null,R(x(n)("providers.unavailable")),1)])):r.value.length===0?(w(),N("div",ise,R(x(n)("providers.empty")),1)):(w(!0),N(Le,{key:3},nt(r.value,y=>(w(),N("div",{key:y.id,class:"prov-row"},[oe(Ht,{text:_(y.status)},{default:_e(()=>[T("span",{class:Re(["status-dot",{"status-dot--empty":y.status!=="connected"&&y.status!=="error"}]),style:Gt(y.status==="connected"||y.status==="error"?{background:b(y.status)}:void 0)},null,6)]),_:2},1032,["text"]),T("div",rse,[T("span",lse,R(y.type),1),y.baseUrl?(w(),N("span",ase,R(y.baseUrl),1)):ie("",!0),T("span",cse,[oe(Is,{variant:y.hasApiKey?"success":"neutral",size:"sm"},{default:_e(()=>[qe(R(y.hasApiKey?x(n)("providers.keySet"):x(n)("providers.keyNotSet")),1)]),_:2},1032,["variant"]),y.models&&y.models.length>0?(w(),N("span",use," · "+R(x(n)("providers.modelCount",{count:y.models.length})),1)):ie("",!0)])]),T("div",dse,[oe(Ht,{text:x(n)("providers.refreshTitle",{type:y.type})},{default:_e(()=>[oe(Dt,{variant:"secondary",size:"sm",onClick:A=>l("refresh",y.id)},{default:_e(()=>[qe(R(x(n)("providers.refresh")),1)]),_:1},8,["onClick"])]),_:2},1032,["text"]),oe(Ht,{text:x(n)("providers.deleteTitle",{type:y.type})},{default:_e(()=>[oe(Dt,{variant:"danger-soft",size:"sm",onClick:A=>a(y.id)},{default:_e(()=>[qe(R(x(n)("providers.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["text"])])]))),128))]),e.unavailable?ie("",!0):(w(),N("div",fse,[c.value?(w(),N("div",hse,[oe(zf,{label:x(n)("providers.fieldApiKey")},{default:_e(()=>[oe(sc,{modelValue:u.apiKey,"onUpdate:modelValue":v[1]||(v[1]=y=>u.apiKey=y),type:"password",placeholder:"sk-…",autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),_:1},8,["label"]),oe(zf,{label:x(n)("providers.fieldBaseUrl")},{default:_e(()=>[oe(sc,{modelValue:u.baseUrl,"onUpdate:modelValue":v[2]||(v[2]=y=>u.baseUrl=y),placeholder:x(n)("providers.baseUrlPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),oe(zf,{label:x(n)("providers.fieldDefaultModel")},{default:_e(()=>[oe(sc,{modelValue:u.defaultModel,"onUpdate:modelValue":v[3]||(v[3]=y=>u.defaultModel=y),placeholder:x(n)("providers.optional"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),d.value?(w(),N("div",mse,R(d.value),1)):ie("",!0),T("div",gse,[oe(Dt,{variant:"primary",size:"sm",onClick:f},{default:_e(()=>[qe(R(x(n)("providers.add")),1)]),_:1}),oe(Dt,{variant:"secondary",size:"sm",onClick:h},{default:_e(()=>[qe(R(x(n)("common.cancel")),1)]),_:1})])])):(w(),N("div",pse,[oe(Dt,{variant:"secondary",size:"sm",onClick:v[0]||(v[0]=y=>l("openLogin"))},{default:_e(()=>[oe(Je,{name:"user",size:"sm"}),qe(" "+R(x(n)("providers.loginBlun")),1)]),_:1}),oe(Dt,{variant:"primary",size:"sm",onClick:p},{default:_e(()=>[oe(Je,{name:"plus",size:"sm"}),qe(" "+R(x(n)("providers.enterApiKey")),1)]),_:1})]))])),T("div",vse,R(x(n)("providers.escClose")),1)],512)]),_:1},8,["title"]))}}),kse=ut(yse,[["__scopeId","data-v-2c77ee6d"]]),bse={key:0,width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",stroke:"var(--color-success)","stroke-width":"2","aria-hidden":"true"},_se={key:1,width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",stroke:"var(--color-danger)","stroke-width":"1.5","aria-hidden":"true"},wse={key:2,width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",stroke:"var(--color-warning)","stroke-width":"1.5","aria-hidden":"true"},dv=je({__name:"AuthStateIcon",props:{kind:{}},setup(e){return(t,n)=>e.kind==="success"?(w(),N("svg",bse,[...n[0]||(n[0]=[T("circle",{cx:"18",cy:"18",r:"15"},null,-1),T("polyline",{points:"10,18 15,24 26,12"},null,-1)])])):e.kind==="expired"?(w(),N("svg",_se,[...n[1]||(n[1]=[T("circle",{cx:"14",cy:"14",r:"12"},null,-1),T("line",{x1:"14",y1:"8",x2:"14",y2:"15"},null,-1),T("circle",{cx:"14",cy:"19",r:"1.2",fill:"var(--color-danger)"},null,-1)])])):(w(),N("svg",wse,[...n[2]||(n[2]=[T("path",{d:"M14 3 L26 24 H2 Z"},null,-1),T("line",{x1:"14",y1:"12",x2:"14",y2:"18"},null,-1),T("circle",{cx:"14",cy:"21.5",r:"1",fill:"var(--color-warning)"},null,-1)])]))}}),Sse={key:0,class:"center-body"},Cse={class:"center-text"},xse={key:1,class:"nb"},Ase={class:"nb-lead"},Tse=["href"],Mse={class:"nb-or"},Ese={class:"nb-fallback"},Ise={class:"nb-fb-text"},$se=["href"],Nse={class:"nb-code-row"},Lse={class:"nb-code"},Ose={class:"nb-status"},Pse={class:"nb-status-text"},Rse={class:"nb-countdown"},Dse={key:2,class:"center-body"},Bse={class:"center-text success-text"},Fse={class:"center-hint"},Hse={class:"center-body"},Wse={class:"center-text err-text"},zse={class:"center-hint"},Use={class:"actions"},qse={class:"center-body"},jse={class:"center-text warn-text"},Vse={class:"center-hint"},Kse={class:"actions"},Gse=je({__name:"LoginDialog",props:{onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["success","close"],setup(e,{emit:t}){const{t:n}=It(),s=Z(!0),o=t,i=e,r=Z("starting"),l=Z(null),a=Z(0),c=Z(!1);let u=null,d=null;hn(async()=>{await p()}),kn(()=>{m()});async function p(){m(),l.value=null,r.value="starting";const y=await i.onStartOAuthLogin();if(!y){r.value="error";return}l.value={flowId:y.flowId,verificationUri:y.verificationUri,verificationUriComplete:y.verificationUriComplete,userCode:y.userCode,expiresIn:y.expiresIn,interval:y.interval},a.value=y.expiresIn,r.value="device-code",h(),f(y.interval)}function h(){d&&clearInterval(d),d=setInterval(()=>{a.value>0?a.value--:(d&&clearInterval(d),d=null)},1e3)}function f(y){u&&clearTimeout(u),u=setTimeout(async()=>{const A=await i.onPollOAuthLogin();A?.status==="authenticated"?(m(),r.value="success",setTimeout(()=>{o("success"),o("close")},1200)):A?.status==="expired"||A?.status==="cancelled"?(m(),r.value="expired"):f(y)},y*1e3)}function m(){u&&(clearTimeout(u),u=null),d&&(clearInterval(d),d=null)}async function b(){await p()}async function _(){!l.value||!await zs(l.value.userCode)||(c.value=!0,setTimeout(()=>{c.value=!1},2e3))}async function g(){m(),r.value==="device-code"&&i.onCancelOAuthLogin(),o("close")}function v(y){const A=Math.floor(y/60),O=y%60;return`${A}:${String(O).padStart(2,"0")}`}return(y,A)=>(w(),ve(ar,{open:s.value,"onUpdate:open":A[0]||(A[0]=O=>s.value=O),title:x(n)("login.title"),"close-on-overlay":!1,onClose:g},{default:_e(()=>[r.value==="starting"?(w(),N("div",Sse,[oe(ni,{size:"md"}),T("span",Cse,R(x(n)("login.starting")),1)])):r.value==="device-code"&&l.value?(w(),N("div",xse,[T("div",Ase,R(x(n)("login.lead")),1),T("a",{class:"nb-primary",href:l.value.verificationUriComplete,target:"_blank",rel:"noopener noreferrer"},[qe(R(x(n)("login.authorizeInBrowser"))+" ",1),oe(Je,{name:"external-link",size:"sm"})],8,Tse),T("div",Mse,R(x(n)("login.orDivider")),1),T("div",Ese,[T("div",Ise,[qe(R(x(n)("login.fallbackPrefix")),1),T("a",{class:"nb-fb-link",href:l.value.verificationUri,target:"_blank",rel:"noopener noreferrer"},R(l.value.verificationUri),9,$se),qe(R(x(n)("login.fallbackSuffix")),1)]),T("div",Nse,[T("span",Lse,R(l.value.userCode),1),oe(Dt,{class:Re(["nb-copy",{"is-copied":c.value}]),variant:"secondary",size:"sm",onClick:_},{default:_e(()=>[c.value?(w(),N(Le,{key:0},[oe(Je,{name:"check",size:"sm"}),qe(" "+R(x(n)("login.copied")),1)],64)):(w(),N(Le,{key:1},[oe(Je,{name:"copy",size:"sm"}),qe(" "+R(x(n)("login.copy")),1)],64))]),_:1},8,["class"])])]),T("div",Ose,[oe(ni,{size:"sm",label:x(n)("login.waitingAuth")},null,8,["label"]),T("span",Pse,R(x(n)("login.waitingAutoClose")),1),T("span",Rse,R(v(a.value)),1)])])):r.value==="success"?(w(),N("div",Dse,[oe(dv,{kind:"success"}),T("span",Bse,R(x(n)("login.success")),1),T("span",Fse,R(x(n)("login.successHint")),1)])):r.value==="expired"?(w(),N(Le,{key:3},[T("div",Hse,[oe(dv,{kind:"expired"}),T("span",Wse,R(x(n)("login.expiredTitle")),1),T("span",zse,R(x(n)("login.expiredHint")),1)]),T("div",Use,[oe(Dt,{variant:"primary",onClick:b},{default:_e(()=>[qe(R(x(n)("login.retry")),1)]),_:1}),oe(Dt,{variant:"secondary",onClick:g},{default:_e(()=>[qe(R(x(n)("login.closeBtn")),1)]),_:1})])],64)):r.value==="error"?(w(),N(Le,{key:4},[T("div",qse,[oe(dv,{kind:"error"}),T("span",jse,R(x(n)("login.errorTitle")),1),T("span",Vse,R(x(n)("login.errorHint")),1)]),T("div",Kse,[oe(Dt,{variant:"primary",onClick:b},{default:_e(()=>[qe(R(x(n)("login.retry")),1)]),_:1}),oe(Dt,{variant:"secondary",onClick:g},{default:_e(()=>[qe(R(x(n)("login.closeBtn")),1)]),_:1})])],64)):ie("",!0)]),_:1},8,["open","title"]))}}),Yse=ut(Gse,[["__scopeId","data-v-4fc29df1"]]),E3=je({__name:"LanguageSwitcher",setup(e){const{locale:t}=It(),n=TA.map(o=>({value:o.code,label:o.label}));function s(o){t.value!==o&&MA(o)}return(o,i)=>(w(),ve(Oo,{"model-value":x(t),options:x(n),"onUpdate:modelValue":s},null,8,["model-value","options"]))}}),Xse=["aria-checked","aria-label","disabled"],Qse=je({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,o)=>(w(),N("button",{class:Re(["ui-switch",{"is-on":e.modelValue}]),type:"button",role:"switch","aria-checked":e.modelValue,"aria-label":e.label,disabled:e.disabled,onClick:o[0]||(o[0]=i=>n("update:modelValue",!e.modelValue))},[...o[1]||(o[1]=[T("span",{class:"ui-switch__thumb"},null,-1)])],10,Xse))}}),Ar=ut(Qse,[["__scopeId","data-v-75ecc366"]]),Zse=["value","disabled"],Jse=je({__name:"Select",props:{modelValue:{},size:{default:"md"},disabled:{type:Boolean},error:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;function s(o){n("update:modelValue",o.target.value)}return(o,i)=>(w(),N("select",{class:Re(["ui-select",[`ui-select--${e.size}`,{"has-error":e.error}]]),value:e.modelValue,disabled:e.disabled,onChange:s},[Cn(o.$slots,"default",{},void 0,!0)],42,Zse))}}),eoe=ut(Jse,[["__scopeId","data-v-2d0dfea2"]]),toe=["aria-label"],noe=["aria-selected","onClick"],soe={class:"body"},ooe={class:"panel"},ioe={class:"sec"},roe={class:"sec-title"},loe={class:"row"},aoe={class:"rlabel"},coe={class:"row"},uoe={class:"rlabel"},doe={class:"row"},foe={class:"rlabel"},poe={class:"num-field"},hoe=["value","aria-label"],moe={class:"row"},goe={class:"rlabel"},voe={class:"row"},yoe={class:"rlabel"},koe={class:"hint"},boe={class:"sec"},_oe={class:"sec-title"},woe={class:"row"},Soe={class:"rlabel"},Coe={key:0,class:"hint"},xoe={class:"row"},Aoe={class:"rlabel"},Toe={key:0,class:"hint"},Moe={class:"row"},Eoe={class:"rlabel"},Ioe={class:"panel"},$oe={class:"sec"},Noe={class:"sec-title"},Loe={class:"row"},Ooe={class:"rlabel"},Poe={key:0,class:"rvalue"},Roe={class:"actions"},Doe={class:"panel"},Boe={class:"sec"},Foe={class:"sec-head"},Hoe={class:"sec-title"},Woe={key:0,class:"saving"},zoe={class:"row"},Uoe={class:"rlabel"},qoe={class:"hint"},joe={key:0,class:"select-wrap"},Voe={key:0,value:"",disabled:""},Koe=["label"],Goe=["value"],Yoe={key:1,class:"rvalue mono"},Xoe={class:"row"},Qoe={class:"rlabel"},Zoe={class:"hint"},Joe={class:"row"},eie={class:"rlabel"},tie={class:"hint"},nie={class:"row"},sie={class:"rlabel"},oie={class:"hint"},iie={class:"row"},rie={class:"rlabel"},lie={class:"hint"},aie={key:1,class:"empty-config"},cie={class:"panel"},uie={class:"sec"},die={class:"sec-title"},fie={class:"row"},pie={class:"rlabel"},hie={class:"rvalue mono"},mie={class:"row"},gie={class:"rlabel"},vie={class:"rvalue mono"},yie={key:0,class:"row"},kie={class:"rlabel"},bie={class:"hint"},_ie={class:"hint"},wie={class:"row"},Sie={class:"rlabel"},Cie={key:0,class:"hint"},xie=je({__name:"SettingsDialog",props:{colorScheme:{},accent:{},uiFontSize:{},authReady:{type:Boolean},accountModel:{},notify:{type:Boolean},notifyQuestion:{type:Boolean},notifyPermission:{},sound:{type:Boolean},conversationToc:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{}},emits:["setColorScheme","setAccent","setUiFontSize","setNotify","setNotifyQuestion","setSound","setConversationToc","login","logout","openOnboarding","openProviders","updateConfig","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z("general"),r=[{id:"general",labelKey:"settings.tabs.general"},{id:"agent",labelKey:"settings.tabs.agent"},{id:"account",labelKey:"settings.tabs.account"},{id:"advanced",labelKey:"settings.tabs.advanced"}],l=T5(),a=["manual","auto","yolo"],c={manual:"status.permissionManual",auto:"status.permissionAuto",yolo:"status.permissionYolo"},u=Z(null);Sy(u);function d(M){M.key==="Escape"&&o("close")}hn(()=>document.addEventListener("keydown",d)),kn(()=>document.removeEventListener("keydown",d));function p(){y3()}const h=F(()=>{const M=new Map;for(const L of s.models??[])M.set(L.id,{id:L.id,label:L.displayName??L.model??L.id,provider:L.provider});for(const[L,S]of Object.entries(s.config?.models??{})){if(M.has(L))continue;const I=b(S);M.set(L,{id:L,label:_(L,S,I),provider:I??L})}return Array.from(M.values())}),f=F(()=>{const M=new Map;for(const L of h.value){const S=M.get(L.provider)??[];S.push(L),M.set(L.provider,S)}for(const L of M.values())L.sort((S,I)=>S.label.localeCompare(I.label));return Array.from(M.entries()).toSorted(([L],[S])=>L.localeCompare(S)).map(([L,S])=>({provider:L,options:S}))}),m=F(()=>{const M=s.config?.defaultPermissionMode;return M==="auto"||M==="yolo"||M==="manual"?M:"manual"});function b(M){if(!M||typeof M!="object")return;const L=M;return typeof L.provider=="string"?L.provider:void 0}function _(M,L,S){if(!L||typeof L!="object")return M;const I=L,P=typeof I.model=="string"?I.model:void 0,D=S??b(L);return P&&D?`${M} (${D}/${P})`:P?`${M} (${P})`:M}function g(M){return M===!0}function v(M){!M||M===s.config?.defaultModel||o("updateConfig",{defaultModel:M})}function y(M){M!==m.value&&o("updateConfig",{defaultPermissionMode:M})}function A(M){const L=s.config?.[M];o("updateConfig",{[M]:!g(L)})}function O(){const M=s.config?.thinking;return!M||typeof M!="object"?!0:M.enabled!==!1}function $(){o("updateConfig",{thinking:{enabled:!O()}})}function k(){const M=s.config?.telemetry!==!1;o("updateConfig",{telemetry:!M})}function E(M){i.value=M}return(M,L)=>(w(),ve(ar,{open:!0,"close-on-esc":!1,title:x(n)("settings.title"),size:"xl",height:"fixed",padded:!1,onClose:L[15]||(L[15]=S=>o("close"))},{default:_e(()=>[T("div",{ref_key:"dialogRef",ref:u,class:"sd"},[T("nav",{class:"settings-tabs",role:"tablist","aria-label":x(n)("settings.title")},[(w(),N(Le,null,nt(r,S=>T("button",{key:S.id,type:"button",class:Re(["tab",{on:i.value===S.id}]),role:"tab","aria-selected":i.value===S.id,onClick:I=>E(S.id)},R(x(n)(S.labelKey)),11,noe)),64))],8,toe),T("div",soe,[Mn(T("section",ooe,[T("section",ioe,[T("h3",roe,R(x(n)("settings.appearance")),1),T("div",loe,[T("span",aoe,R(x(n)("theme.colorSchemeLabel")),1),oe(Oo,{"model-value":e.colorScheme,options:[{value:"light",label:x(n)("theme.light")},{value:"dark",label:x(n)("theme.dark")},{value:"system",label:x(n)("theme.system")}],"onUpdate:modelValue":L[0]||(L[0]=S=>o("setColorScheme",S))},null,8,["model-value","options"])]),T("div",coe,[T("span",uoe,R(x(n)("theme.accentLabel")),1),oe(Oo,{"model-value":e.accent,options:[{value:"blue",label:x(n)("theme.accentBlue")},{value:"mono",label:x(n)("theme.accentBlack")}],"onUpdate:modelValue":L[1]||(L[1]=S=>o("setAccent",S))},null,8,["model-value","options"])]),T("div",doe,[T("span",foe,R(x(n)("settings.uiFontSize")),1),T("label",poe,[T("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":x(n)("settings.uiFontSize"),onInput:L[2]||(L[2]=S=>o("setUiFontSize",Number(S.target.value)))},null,40,hoe),L[16]||(L[16]=T("span",{class:"num-unit"},"px",-1))])]),T("div",moe,[T("span",goe,R(x(n)("sidebar.language")),1),oe(E3)]),T("div",voe,[T("span",yoe,[qe(R(x(n)("settings.conversationToc"))+" ",1),T("span",koe,R(x(n)("settings.conversationTocHint")),1)]),oe(Ar,{"model-value":e.conversationToc??!0,label:x(n)("settings.conversationToc"),"onUpdate:modelValue":L[3]||(L[3]=S=>o("setConversationToc",S))},null,8,["model-value","label"])])]),T("section",boe,[T("h3",_oe,R(x(n)("settings.notifications")),1),T("div",woe,[T("span",Soe,[qe(R(x(n)("settings.notifyOnComplete"))+" ",1),e.notifyPermission==="denied"?(w(),N("span",Coe,R(x(n)("settings.notifyDenied")),1)):ie("",!0)]),oe(Ar,{"model-value":e.notify,disabled:e.notifyPermission==="denied",label:x(n)("settings.notifyOnComplete"),"onUpdate:modelValue":L[4]||(L[4]=S=>o("setNotify",S))},null,8,["model-value","disabled","label"])]),T("div",xoe,[T("span",Aoe,[qe(R(x(n)("settings.notifyOnQuestion"))+" ",1),e.notifyPermission==="denied"?(w(),N("span",Toe,R(x(n)("settings.notifyDenied")),1)):ie("",!0)]),oe(Ar,{"model-value":e.notifyQuestion,disabled:e.notifyPermission==="denied",label:x(n)("settings.notifyOnQuestion"),"onUpdate:modelValue":L[5]||(L[5]=S=>o("setNotifyQuestion",S))},null,8,["model-value","disabled","label"])]),T("div",Moe,[T("span",Eoe,R(x(n)("settings.soundOnComplete")),1),oe(Ar,{"model-value":e.sound,label:x(n)("settings.soundOnComplete"),"onUpdate:modelValue":L[6]||(L[6]=S=>o("setSound",S))},null,8,["model-value","label"])])])],512),[[Qo,i.value==="general"]]),Mn(T("section",Ioe,[T("section",$oe,[T("h3",Noe,R(x(n)("settings.account")),1),T("div",Loe,[T("span",Ooe,R(e.authReady?"managed:blun":x(n)("sidebar.notSignedIn")),1),oe(Ht,{text:e.accountModel},{default:_e(()=>[e.authReady&&e.accountModel?(w(),N("span",Poe,R(e.accountModel),1)):ie("",!0)]),_:1},8,["text"])]),T("div",Roe,[oe(Dt,{variant:"secondary",size:"sm",onClick:L[7]||(L[7]=S=>{o("openOnboarding"),o("close")})},{default:_e(()=>[qe(R(x(n)("onboarding.reopen")),1)]),_:1}),e.authReady?(w(),ve(Dt,{key:0,variant:"danger-soft",size:"sm",onClick:L[8]||(L[8]=S=>o("logout"))},{default:_e(()=>[qe(R(x(n)("sidebar.signOut")),1)]),_:1})):(w(),ve(Dt,{key:1,variant:"primary",size:"sm",onClick:L[9]||(L[9]=S=>o("login"))},{default:_e(()=>[qe(R(x(n)("sidebar.signIn")),1)]),_:1}))])])],512),[[Qo,i.value==="account"]]),Mn(T("section",Doe,[T("section",Boe,[T("div",Foe,[T("h3",Hoe,R(x(n)("settings.agentDefaults")),1),e.configSaving?(w(),N("span",Woe,R(x(n)("settings.saving")),1)):ie("",!0)]),e.config?(w(),N(Le,{key:0},[T("div",zoe,[T("span",Uoe,[qe(R(x(n)("settings.defaultModel"))+" ",1),T("span",qoe,R(x(n)("settings.defaultModelHint")),1)]),f.value.length>0?(w(),N("div",joe,[oe(eoe,{"model-value":e.config.defaultModel??"",disabled:e.configSaving,"aria-label":x(n)("settings.defaultModel"),"onUpdate:modelValue":v},{default:_e(()=>[e.config.defaultModel?ie("",!0):(w(),N("option",Voe,R(x(n)("settings.noDefaultModel")),1)),(w(!0),N(Le,null,nt(f.value,S=>(w(),N("optgroup",{key:S.provider,label:S.provider},[(w(!0),N(Le,null,nt(S.options,I=>(w(),N("option",{key:I.id,value:I.id},R(I.label),9,Goe))),128))],8,Koe))),128))]),_:1},8,["model-value","disabled","aria-label"])])):(w(),N("span",Yoe,R(e.config.defaultModel??x(n)("settings.noDefaultModel")),1))]),T("div",Xoe,[T("span",Qoe,[qe(R(x(n)("settings.defaultPermission"))+" ",1),T("span",Zoe,R(x(n)("settings.defaultPermissionHint")),1)]),oe(Oo,{"model-value":m.value,options:a.map(S=>({value:S,label:x(n)(c[S])})),"onUpdate:modelValue":L[10]||(L[10]=S=>y(S))},null,8,["model-value","options"])]),T("div",Joe,[T("span",eie,[qe(R(x(n)("settings.defaultThinking"))+" ",1),T("span",tie,R(x(n)("settings.defaultThinkingHint")),1)]),oe(Ar,{"model-value":O(),disabled:e.configSaving,label:x(n)("settings.defaultThinking"),"onUpdate:modelValue":L[11]||(L[11]=S=>$())},null,8,["model-value","disabled","label"])]),T("div",nie,[T("span",sie,[qe(R(x(n)("settings.defaultPlanMode"))+" ",1),T("span",oie,R(x(n)("settings.defaultPlanModeHint")),1)]),oe(Ar,{"model-value":g(e.config.defaultPlanMode),disabled:e.configSaving,label:x(n)("settings.defaultPlanMode"),"onUpdate:modelValue":L[12]||(L[12]=S=>A("defaultPlanMode"))},null,8,["model-value","disabled","label"])]),T("div",iie,[T("span",rie,[qe(R(x(n)("settings.mergeSkills"))+" ",1),T("span",lie,R(x(n)("settings.mergeSkillsHint")),1)]),oe(Ar,{"model-value":g(e.config.mergeAllAvailableSkills),disabled:e.configSaving,label:x(n)("settings.mergeSkills"),"onUpdate:modelValue":L[13]||(L[13]=S=>A("mergeAllAvailableSkills"))},null,8,["model-value","disabled","label"])])],64)):(w(),N("div",aie,R(x(n)("settings.configUnavailable")),1))])],512),[[Qo,i.value==="agent"]]),Mn(T("section",cie,[T("section",uie,[T("h3",die,R(x(n)("settings.advanced")),1),T("div",fie,[T("span",pie,R(x(n)("sidebar.daemon")),1),T("span",hie,R(x(l)),1)]),T("div",mie,[T("span",gie,R(x(n)("settings.serverVersion")),1),T("span",vie,R(e.serverVersion||"-"),1)]),e.config?(w(),N("div",yie,[T("span",kie,[qe(R(x(n)("settings.telemetry"))+" ",1),T("span",bie,R(x(n)("settings.telemetryHint")),1),T("span",_ie,R(x(n)("settings.telemetryRestartHint")),1)]),oe(Ar,{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:x(n)("settings.telemetry"),"onUpdate:modelValue":L[14]||(L[14]=S=>k())},null,8,["model-value","disabled","label"])])):ie("",!0),T("div",wie,[T("span",Sie,[qe(R(x(n)("settings.exportLog"))+" ",1),x(vi)()?ie("",!0):(w(),N("span",Cie,R(x(n)("settings.logHint")),1))]),oe(Dt,{variant:"secondary",size:"sm",onClick:p},{default:_e(()=>[qe(R(x(n)("settings.exportLogBtn")),1)]),_:1})])])],512),[[Qo,i.value==="advanced"]])])],512)]),_:1},8,["title"]))}}),Aie=ut(xie,[["__scopeId","data-v-95e7acdd"]]),Tie={class:"aw"},Mie={class:"crumbbar"},Eie={class:"crumbs"},Iie={key:0,class:"crumb-sep"},$ie=["onClick"],Nie={key:0,class:"filterbar"},Lie=["placeholder"],Oie={class:"folder-list"},Pie={key:0,class:"fl-loading"},Rie=["onClick"],Die={class:"folder-name search-rel"},Bie={key:0,class:"git-branch"},Fie={key:0,class:"fl-empty"},Hie={key:1,class:"fl-loading"},Wie=["onClick"],zie={class:"folder-name"},Uie={key:0,class:"git-branch"},qie={key:0,class:"fl-empty"},jie={class:"paste-row"},Vie={class:"paste-input-wrap"},Kie={key:1,class:"add-error",role:"alert"},Gie={class:"actions"},Yie={class:"footer-hint"},Xie=600,Qie=6,JS=150,Zie=je({__name:"AddWorkspaceDialog",props:{browseFs:{type:Function},getFsHome:{type:Function},defaultPath:{},error:{}},emits:["add","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z(!0),r=Z(!1),l=Z(!1),a=Z(""),c=Z(null),u=Z([]),d=Z(""),p=Z(!1),h=Z([]),f=F(()=>d.value.trim().length>0);let m=0,b=null;function _(I,P){const D=I.toLowerCase(),W=P.toLowerCase();let z=0;for(let q=0;q<W.length&&z<D.length;q++)W[q]===D[z]&&z++;return z===D.length}async function g(I){const P=a.value,D=I.trim();if(!P||D===""){h.value=[],p.value=!1;return}const W=++m;p.value=!0;const z=[],q=[{path:P,depth:0}];let Q=0;for(;q.length>0&&Q<Xie&&z.length<JS;){if(W!==m)return;const X=q.shift();Q++;let fe;try{fe=await s.browseFs(X.path)}catch{continue}if(W!==m)return;for(const ye of fe.entries){if(!ye.isDir)continue;const Me=ye.path.startsWith(P)?ye.path.slice(P.length).replace(/^\/+/,""):ye.path;if(_(D,Me||ye.name)&&(z.push({path:ye.path,name:ye.name,rel:Me||ye.name,isGitRepo:ye.isGitRepo,branch:ye.branch}),z.length>=JS))break;X.depth+1<Qie&&q.push({path:ye.path,depth:X.depth+1})}W===m&&(h.value=[...z])}W===m&&(p.value=!1)}Ke(d,I=>{if(b&&clearTimeout(b),I.trim()===""){m++,h.value=[],p.value=!1;return}b=setTimeout(()=>void g(I),220)});const v=Z(!1),y=Z(""),A=F(()=>y.value.trim()),O=F(()=>{const I=a.value;if(!I)return[];const P=I.split("/").filter(Boolean),D=[{label:"/",path:"/"}];let W="";for(const z of P)W+=`/${z}`,D.push({label:z,path:W});return D}),$=F(()=>a.value.length>0);async function k(I){r.value=!0;try{const P=await s.browseFs(I);if(!P.path){l.value=!0;return}a.value=P.path,c.value=P.parent,u.value=P.entries,d.value="",l.value=!1}catch{l.value=!0}finally{r.value=!1}}function E(I){I.isDir&&k(I.path)}function M(){c.value&&k(c.value)}function L(){$.value&&o("add",a.value)}function S(){A.value.length!==0&&o("add",A.value)}return hn(async()=>{r.value=!0;try{if(s.defaultPath&&(await k(s.defaultPath),!l.value))return;const I=await s.getFsHome();I.home?await k(I.home):l.value=!0}catch{l.value=!0}finally{r.value=!1}}),kn(()=>{b&&clearTimeout(b)}),(I,P)=>(w(),ve(ar,{open:i.value,"onUpdate:open":P[5]||(P[5]=D=>i.value=D),title:x(n)("workspace.addTitle"),size:"lg",height:"fixed",onClose:P[6]||(P[6]=D=>o("close"))},{default:_e(()=>[T("div",Tie,[l.value?ie("",!0):(w(),N(Le,{key:0},[T("div",Mie,[oe(gn,{size:"sm",disabled:!c.value,label:x(n)("workspace.up"),onClick:M},{default:_e(()=>[oe(Je,{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),T("div",Eie,[(w(!0),N(Le,null,nt(O.value,(D,W)=>(w(),N(Le,{key:D.path},[W>1?(w(),N("span",Iie,"/")):ie("",!0),T("button",{class:Re(["crumb",{last:W===O.value.length-1}]),onClick:z=>k(D.path)},R(D.label),11,$ie)],64))),128))])]),r.value?ie("",!0):(w(),N("div",Nie,[oe(Je,{class:"filter-icon",name:"search",size:"md"}),Mn(T("input",{"onUpdate:modelValue":P[0]||(P[0]=D=>d.value=D),class:"filter-input",type:"text",placeholder:x(n)("workspace.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:P[1]||(P[1]=vt(()=>{},["stop"]))},null,40,Lie),[[ko,d.value]]),p.value?(w(),ve(ni,{key:0,size:"sm"})):ie("",!0)])),T("div",Oie,[r.value?(w(),N("div",Pie,R(x(n)("workspace.browsing")),1)):f.value?(w(),N(Le,{key:1},[(w(!0),N(Le,null,nt(h.value,D=>(w(),N("button",{key:D.path,class:"folder-row",onClick:W=>k(D.path)},[oe(Je,{class:"dir-icon",name:"folder-closed",size:"sm"}),T("span",Die,R(D.rel),1),D.isGitRepo?(w(),ve(Is,{key:0,variant:"info",size:"sm"},{default:_e(()=>[qe(R(x(n)("workspace.gitTag")),1),D.branch?(w(),N("span",Bie,R(D.branch),1)):ie("",!0)]),_:2},1024)):ie("",!0)],8,Rie))),128)),!p.value&&h.value.length===0?(w(),N("div",Fie,R(x(n)("workspace.noFilterMatch",{q:d.value.trim()})),1)):p.value&&h.value.length===0?(w(),N("div",Hie,R(x(n)("workspace.searching")),1)):ie("",!0)],64)):(w(),N(Le,{key:2},[(w(!0),N(Le,null,nt(u.value,D=>(w(),N("button",{key:D.path,class:"folder-row",onClick:W=>E(D)},[oe(Je,{class:"dir-icon",name:"folder-closed",size:"sm"}),T("span",zie,R(D.name),1),D.isGitRepo?(w(),ve(Is,{key:0,variant:"info",size:"sm"},{default:_e(()=>[qe(R(x(n)("workspace.gitTag")),1),D.branch?(w(),N("span",Uie,R(D.branch),1)):ie("",!0)]),_:2},1024)):ie("",!0)],8,Wie))),128)),u.value.length===0?(w(),N("div",qie,R(x(n)("workspace.noSubfolders")),1)):ie("",!0)],64))])],64)),T("div",{class:Re(["paste-section",{"paste-only":l.value}])},[!l.value&&!v.value?(w(),ve(Dt,{key:0,variant:"ghost",size:"sm",onClick:P[2]||(P[2]=D=>v.value=!0)},{default:_e(()=>[qe(R(x(n)("workspace.pasteToggle")),1)]),_:1})):(w(),ve(zf,{key:1,label:x(n)("workspace.pathLabel")},{default:_e(()=>[T("div",jie,[T("div",Vie,[oe(sc,{modelValue:y.value,"onUpdate:modelValue":P[3]||(P[3]=D=>y.value=D),placeholder:x(n)("workspace.pathPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:di(vt(S,["stop"]),["enter"])},null,8,["modelValue","placeholder","onKeydown"])]),oe(gn,{disabled:A.value.length===0,label:x(n)("workspace.add"),onClick:S},{default:_e(()=>[oe(Je,{name:"plus",size:"md"})]),_:1},8,["disabled","label"])])]),_:1},8,["label"]))],2),e.error?(w(),N("div",Kie,R(e.error),1)):ie("",!0),T("div",Gie,[oe(Ht,{text:a.value},{default:_e(()=>[l.value?ie("",!0):(w(),ve(Dt,{key:0,variant:"primary",disabled:!$.value,onClick:L},{default:_e(()=>[qe(R(x(n)("workspace.openThisFolder")),1)]),_:1},8,["disabled"]))]),_:1},8,["text"]),oe(Dt,{variant:"secondary",onClick:P[4]||(P[4]=D=>o("close"))},{default:_e(()=>[qe(R(x(n)("workspace.cancel")),1)]),_:1})]),T("div",Yie,R(x(n)("workspace.browseHint")),1)])]),_:1},8,["open","title"]))}}),Jie=ut(Zie,[["__scopeId","data-v-f9402320"]]),ere={key:0,class:"confirm-dialog__message"},tre=je({__name:"ConfirmDialog",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:"danger"},loading:{type:Boolean}},emits:["update:open","confirm","cancel"],setup(e,{emit:t}){const n=t,{t:s}=It();function o(){n("update:open",!1),n("cancel")}return(i,r)=>(w(),ve(ar,{open:e.open,title:e.title,height:"auto","onUpdate:open":r[1]||(r[1]=l=>n("update:open",l)),onClose:o},{foot:_e(()=>[oe(Dt,{variant:"secondary",disabled:e.loading,onClick:o},{default:_e(()=>[qe(R(e.cancelLabel??x(s)("common.cancel")),1)]),_:1},8,["disabled"]),oe(Dt,{variant:e.variant,loading:e.loading,onClick:r[0]||(r[0]=l=>n("confirm"))},{default:_e(()=>[qe(R(e.confirmLabel??x(s)("common.confirm")),1)]),_:1},8,["variant","loading"])]),default:_e(()=>[e.message?(w(),N("p",ere,R(e.message),1)):ie("",!0)]),_:1},8,["open","title"]))}}),nre=ut(tre,[["__scopeId","data-v-c6990648"]]),sre=je({__name:"ConfirmDialogHost",setup(e){const{current:t,settle:n}=ol();return(s,o)=>(w(),ve(nre,{open:x(t)!==null,title:x(t)?.title??"",message:x(t)?.message,"confirm-label":x(t)?.confirmLabel,"cancel-label":x(t)?.cancelLabel,variant:x(t)?.variant,onConfirm:o[0]||(o[0]=i=>x(n)(!0)),onCancel:o[1]||(o[1]=i=>x(n)(!1))},null,8,["open","title","message","confirm-label","cancel-label","variant"]))}}),ore={class:"rows"},ire={class:"row"},rre={class:"row"},lre={class:"row"},are={class:"row"},cre={class:"row"},ure={class:"row"},dre={class:"ctx-text"},fre={key:0,class:"bar"},pre={class:"row"},hre=je({__name:"StatusPanel",props:{status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},costUsd:{}},emits:["close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z(!0),r=F(()=>s.status.ctxMax>0?Math.round(s.status.ctxUsed/s.status.ctxMax*100):0),l=F(()=>s.status.ctxMax>0?n("status.statusContextValue",{used:s.status.ctxUsed.toLocaleString(),max:s.status.ctxMax.toLocaleString(),pct:r.value}):n("status.statusNone"));function a(f){return n(f==="yolo"?"status.permissionYolo":f==="auto"?"status.permissionAuto":"status.permissionManual")}const c=F(()=>{const f=s.status.permission;return f==="yolo"?"var(--color-danger)":f==="auto"?"var(--color-warning)":"var(--color-text)"}),u=F(()=>s.planMode?n("status.planOn"):n("status.planOff")),d=F(()=>s.swarmMode?n("status.swarmOn"):n("status.swarmOff")),p=F(()=>typeof s.costUsd=="number"&&s.costUsd>0),h=F(()=>p.value?`$${s.costUsd.toFixed(4)}`:n("status.statusNone"));return(f,m)=>(w(),ve(ar,{open:i.value,"onUpdate:open":m[0]||(m[0]=b=>i.value=b),title:x(n)("status.statusPanelTitle"),onClose:m[1]||(m[1]=b=>o("close"))},{default:_e(()=>[T("dl",ore,[T("div",ire,[T("dt",null,R(x(n)("status.statusModel")),1),T("dd",null,R(e.status.model),1)]),T("div",rre,[T("dt",null,R(x(n)("status.statusThinking")),1),T("dd",null,R(e.thinking),1)]),T("div",lre,[T("dt",null,R(x(n)("status.statusPermission")),1),T("dd",{style:Gt({color:c.value})},R(a(e.status.permission)),5)]),T("div",are,[T("dt",null,R(x(n)("status.statusPlanMode")),1),T("dd",{class:Re({"plan-on":e.planMode})},R(u.value),3)]),T("div",cre,[T("dt",null,R(x(n)("status.statusSwarmMode")),1),T("dd",{class:Re({"swarm-on":e.swarmMode})},R(d.value),3)]),T("div",ure,[T("dt",null,R(x(n)("status.statusContext")),1),T("dd",null,[T("span",dre,R(l.value),1),e.status.ctxMax>0?(w(),N("span",fre,[T("i",{style:Gt({width:r.value+"%"})},null,4)])):ie("",!0)])]),T("div",pre,[T("dt",null,R(x(n)("status.statusCost")),1),T("dd",null,R(h.value),1)])])]),_:1},8,["open","title"]))}}),mre=ut(hre,[["__scopeId","data-v-b0ca89fe"]]),gre={class:"ui-toast__icon","aria-hidden":"true"},vre={class:"ui-toast__body"},yre={class:"ui-toast__title"},kre={key:0,class:"ui-toast__msg"},bre=je({__name:"Toast",props:{variant:{default:"info"},title:{},message:{},dismissLabel:{default:"Dismiss"}},emits:["dismiss"],setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-toast",`ui-toast--${e.variant}`])},[T("span",gre,[Cn(t.$slots,"icon",{},()=>[e.variant==="success"?(w(),ve(Je,{key:0,name:"check"})):e.variant==="danger"?(w(),ve(Je,{key:1,name:"close"})):e.variant==="warning"?(w(),ve(Je,{key:2,name:"alert-triangle"})):(w(),ve(Je,{key:3,name:"info"}))],!0)]),T("div",vre,[T("div",yre,R(e.title),1),e.message?(w(),N("div",kre,R(e.message),1)):ie("",!0),Cn(t.$slots,"default",{},void 0,!0)]),oe(gn,{class:"ui-toast__close",size:"sm",label:e.dismissLabel,onClick:n[0]||(n[0]=s=>t.$emit("dismiss"))},{default:_e(()=>[oe(Je,{name:"close",size:"sm"})]),_:1},8,["label"])],2))}}),_re=ut(bre,[["__scopeId","data-v-e97817f6"]]),wre={key:0,class:"actions"},Sre=["onClick"],Cre=["onClick"],xre={key:1,class:"details"},Are=je({__name:"WarningToasts",props:{warnings:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It();function i(k){return typeof k=="object"&&k!==null}function r(k){return i(k)?k.title:k}function l(k){return i(k)?k.message??"":""}function a(k){return i(k)?k.details:void 0}function c(k){return i(k)?k.severity==="error":k.startsWith(`${o("warnings.errorLabel")}:`)||/\b4\d\d\b|error|失败|failed/i.test(k)}function u(k){return i(k)?`notice:${k.severity}:${k.title}:${k.message??""}:${JSON.stringify(k.details??[])}`:`text:${k}`}function d(k){if(!i(k))return k;const E=[k.title];k.message&&E.push(k.message);const M=k.details??[];if(M.length>0){E.push("",`${o("warnings.diagnostics")}:`);for(const L of M)E.push(`${L.label}: ${L.value}`)}return E.join(`
|
|
261
|
-
`)}let p=1;const h=Z([]),f=new Map,m=new Map;function b(k){const E=c(k)?12e3:6e3;return typeof window<"u"&&window.matchMedia?.("(hover: none)").matches===!0?E+5e3:E}function _(k,E){const M=f.get(k)??{handle:null,deadline:0,remaining:0};M.handle=setTimeout(()=>$(k),E),M.deadline=Date.now()+E,f.set(k,M)}function g(k){const E=f.get(k);E&&E.handle!==null&&clearTimeout(E.handle),f.delete(k)}function v(k){const E=f.get(k);!E||E.handle===null||(clearTimeout(E.handle),E.handle=null,E.remaining=Math.max(0,E.deadline-Date.now()))}function y(k){if(h.value.find(L=>L.id===k)?.detailsOpen)return;const M=f.get(k);!M||M.handle!==null||_(k,M.remaining)}function A(k){k.detailsOpen=!k.detailsOpen,k.detailsOpen?v(k.id):y(k.id)}async function O(k){if(!await zs(d(k.warning)))return;k.copied=!0;const M=m.get(k.id);M&&clearTimeout(M),m.set(k.id,setTimeout(()=>{k.copied=!1,m.delete(k.id)},1400))}function $(k){g(k);const E=m.get(k);E&&clearTimeout(E),m.delete(k);const M=h.value.findIndex(L=>L.id===k);M!==-1&&(h.value=h.value.filter(L=>L.id!==k),s("dismiss",M))}return Ke(()=>n.warnings,k=>{const E=[...h.value];h.value=k.map(M=>{const L=u(M),S=E.findIndex(D=>D.key===L),I=S===-1?void 0:E.splice(S,1)[0];if(I)return I.warning=M,I;const P={id:p++,key:L,warning:M,detailsOpen:!1,copied:!1};return _(P.id,b(M)),P});for(const M of E){g(M.id);const L=m.get(M.id);L&&clearTimeout(L),m.delete(M.id)}},{immediate:!0,flush:"post"}),kn(()=>{f.forEach(k=>{k.handle!==null&&clearTimeout(k.handle)}),f.clear(),m.forEach(k=>clearTimeout(k)),m.clear()}),(k,E)=>(w(),ve(Z$,{name:"toast",tag:"div",class:"toasts",role:"status","aria-live":"polite"},{default:_e(()=>[(w(!0),N(Le,null,nt(h.value,M=>(w(),ve(_re,{key:M.id,variant:c(M.warning)?"danger":"warning",title:r(M.warning),message:l(M.warning),"dismiss-label":x(o)("warnings.dismiss"),onDismiss:L=>$(M.id),onPointerenter:L=>v(M.id),onPointerleave:L=>y(M.id)},{default:_e(()=>[a(M.warning)?.length?(w(),N("div",wre,[T("button",{class:"link",type:"button",onClick:L=>A(M)},R(M.detailsOpen?x(o)("warnings.hideDetails"):x(o)("warnings.showDetails")),9,Sre),T("button",{class:"link",type:"button",onClick:L=>O(M)},R(M.copied?x(o)("warnings.copied"):x(o)("warnings.copyDetails")),9,Cre)])):ie("",!0),M.detailsOpen&&a(M.warning)?.length?(w(),N("dl",xre,[(w(!0),N(Le,null,nt(a(M.warning),L=>(w(),N("div",{key:`${L.label}:${L.value}`,class:"detail-row"},[T("dt",null,R(L.label),1),T("dd",null,R(L.value),1)]))),128))])):ie("",!0)]),_:2},1032,["variant","title","message","dismiss-label","onDismiss","onPointerenter","onPointerleave"]))),128))]),_:1}))}}),Tre=ut(Are,[["__scopeId","data-v-d79b1164"]]),Mre={class:"topbar"},Ere={class:"wsq"},Ire=["aria-label"],$re={class:"tb-path"},Nre={class:"ws"},Lre={class:"se"},Ore={class:"tb-sub"},Pre=je({__name:"MobileTopBar",props:{workspace:{default:null},sessionTitle:{default:""},running:{type:Boolean,default:!1},branch:{default:""},sessionCount:{default:0}},emits:["openSwitcher","openSettings"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=F(()=>{const a=s.workspace,u=(a?.name||a?.root||"").trim().charAt(0);return u?u.toUpperCase():"K"}),r=F(()=>s.workspace?.name??n("workspace.noWorkspace")),l=F(()=>s.running?n("mobile.running"):n("mobile.idle"));return(a,c)=>(w(),N("div",Mre,[T("span",Ere,R(i.value),1),T("button",{type:"button",class:"tb-mid","aria-label":x(n)("mobile.openSwitcher"),onClick:c[0]||(c[0]=u=>o("openSwitcher"))},[T("span",$re,[T("span",Nre,R(r.value),1),e.sessionTitle?(w(),N(Le,{key:0},[c[2]||(c[2]=T("span",{class:"sl"},"/",-1)),T("span",Lre,R(e.sessionTitle),1)],64)):ie("",!0),c[3]||(c[3]=T("span",{class:"cv"},"⌄",-1))]),T("span",Ore,[T("span",{class:Re(["rd",{on:e.running}])},null,2),T("span",null,R(l.value),1),e.branch?(w(),N(Le,{key:0},[qe(" · "+R(e.branch),1)],64)):ie("",!0),e.sessionCount>0?(w(),N(Le,{key:1},[qe(" · "+R(x(n)("mobile.sessionCount",{n:e.sessionCount})),1)],64)):ie("",!0)])],8,Ire),oe(gn,{size:"lg",label:x(n)("mobile.openSettings"),onClick:c[1]||(c[1]=u=>o("openSettings"))},{default:_e(()=>[oe(Je,{name:"sliders",size:"lg"})]),_:1},8,["label"])]))}}),Rre=ut(Pre,[["__scopeId","data-v-63dd28bd"]]),Dre={key:0,class:"sheet-root"},Bre=["aria-label"],Fre=["aria-label"],Hre={key:0,class:"sheet-head"},Wre={class:"sheet-title"},zre={class:"sheet-body"},Ure=je({__name:"BottomSheet",props:{modelValue:{type:Boolean},title:{default:""}},emits:["update:modelValue","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(){o("update:modelValue",!1),o("close")}function r(l){l.key==="Escape"&&i()}return Ke(()=>s.modelValue,l=>{typeof document>"u"||(l?document.addEventListener("keydown",r):document.removeEventListener("keydown",r))},{immediate:!0}),kn(()=>{typeof document<"u"&&document.removeEventListener("keydown",r)}),(l,a)=>(w(),ve(Gr,{name:"sheet"},{default:_e(()=>[e.modelValue?(w(),N("div",Dre,[T("div",{class:"sheet-scrim",onClick:i}),T("div",{class:"sheet-panel",role:"dialog","aria-label":e.title||x(n)("mobile.sheetLabel")},[T("button",{type:"button",class:"sheet-grab","aria-label":x(n)("mobile.closeSheet"),onClick:i},null,8,Fre),e.title?(w(),N("div",Hre,[T("span",Wre,R(e.title),1)])):ie("",!0),T("div",zre,[Cn(l.$slots,"default",{},void 0,!0)])],8,Bre)])):ie("",!0)]),_:3}))}}),I3=ut(Ure,[["__scopeId","data-v-52795127"]]),qre={class:"mlist"},jre={key:0,class:"mempty"},Vre=["onClick"],Kre={class:"mgh-main"},Gre={class:"mgh-name"},Yre={class:"mgh-path"},Xre={key:2,class:"att"},Qre={key:0,class:"mempty small"},Zre=["onClick"],Jre={class:"m"},ele={class:"s"},tle={key:0,class:"att"},nle=["disabled","onClick"],sle=["onClick"],ole=je({__name:"MobileSwitcherSheet",props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:["update:modelValue","select","create","createInWorkspace","addWorkspace","rename","archive","deleteWorkspace","loadMore"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=e,i=t;function r(){i("update:modelValue",!1)}function l(S){i("select",S),r()}function a(S){i("createInWorkspace",S),r()}function c(){i("create"),r()}function u(){i("addWorkspace"),r()}const d=Z(new Set);function p(S){return d.value.has(S)}function h(S){const I=new Set(d.value);I.has(S)?I.delete(S):I.add(S),d.value=I,y.value=null,k.value=null}const f=Z(new Set);function m(S){return f.value.has(S)}function b(S){const I=new Set(f.value);I.has(S)?I.delete(S):I.add(S),f.value=I}function _(S){if(m(S.workspace.id))return S.sessions;const I=S.sessions.slice(0,S.initialCount);if(o.activeId&&!I.some(P=>P.id===o.activeId)){const P=S.sessions.find(D=>D.id===o.activeId);if(P)return[...I,P]}return I}function g(S){if(!f.value.has(S)){const I=new Set(f.value);I.add(S),f.value=I}i("loadMore",S)}function v(S){return o.attentionByWorkspace[S]??0}const y=Z(null);function A(S){y.value=y.value===S?null:S,k.value=null}function O(S){y.value=null;const P=(typeof window<"u"?window.prompt(n("sidebar.rename"),S.title):null)?.trim();P&&i("rename",S.id,P)}async function $(S){y.value=null,await s({title:n("sidebar.archive"),message:n("sidebar.archiveConfirm"),variant:"danger"})&&i("archive",S)}const k=Z(null);function E(S){k.value=k.value===S?null:S,y.value=null}function M(S){zs(S.root),k.value=null}async function L(S){k.value=null,await s({title:n("sidebar.removeWorkspace"),message:n("workspace.removeWorkspaceConfirm",{name:S.name}),variant:"danger"})&&i("deleteWorkspace",S.id)}return(S,I)=>(w(),ve(I3,{"model-value":e.modelValue,"onUpdate:modelValue":I[2]||(I[2]=P=>i("update:modelValue",P))},{default:_e(()=>[T("button",{type:"button",class:"newrow",onClick:c},[oe(Je,{name:"message",size:"sm"}),qe(" "+R(x(n)("sidebar.newChat")),1)]),T("button",{type:"button",class:"newrow secondary",onClick:u},[oe(Je,{name:"folder",size:"sm"}),qe(" "+R(x(n)("sidebar.newWorkspace")),1)]),T("div",qre,[e.groups.length===0?(w(),N("div",jre,R(x(n)("workspace.noWorkspace")),1)):ie("",!0),(w(!0),N(Le,null,nt(e.groups,P=>(w(),N("div",{key:P.workspace.id,class:"mgroup"},[T("div",{class:Re(["mgh",{on:P.workspace.id===e.activeWorkspaceId}]),onClick:D=>h(P.workspace.id)},[p(P.workspace.id)?(w(),ve(Je,{key:0,class:"mgh-folder",name:"folder-closed",size:"sm"})):(w(),ve(Je,{key:1,class:"mgh-folder",name:"folder",size:"sm"})),T("div",Kre,[T("span",Gre,R(P.workspace.name),1),oe(Ht,{text:P.workspace.root},{default:_e(()=>[T("span",Yre,R(P.workspace.branch||P.workspace.shortPath),1)]),_:2},1032,["text"])]),p(P.workspace.id)&&v(P.workspace.id)>0?(w(),N("span",Xre,R(v(P.workspace.id)),1)):ie("",!0),oe(gn,{size:"lg",class:"mgh-more",label:x(n)("sidebar.options"),onClick:vt(D=>E(P.workspace.id),["stop"])},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),oe(gn,{size:"lg",class:"mgh-add",label:x(n)("workspace.newInGroup"),onClick:vt(D=>a(P.workspace.id),["stop"])},{default:_e(()=>[oe(Je,{name:"plus",size:"md"})]),_:1},8,["label","onClick"]),k.value===P.workspace.id?(w(),ve(Wl,{key:3,class:"kmenu wsmenu",onClick:I[0]||(I[0]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{size:"lg",onClick:D=>M(P.workspace)},{default:_e(()=>[qe(R(x(n)("sidebar.copyPath")),1)]),_:1},8,["onClick"]),oe(fn,{size:"lg",danger:"",onClick:D=>L(P.workspace)},{default:_e(()=>[qe(R(x(n)("sidebar.delete")),1)]),_:1},8,["onClick"])]),_:2},1024)):ie("",!0)],10,Vre),Mn(T("div",null,[P.sessions.length===0?(w(),N("div",Qre,R(x(n)("sidebar.noSessions")),1)):ie("",!0),(w(!0),N(Le,null,nt(_(P),D=>(w(),N("div",{key:D.id,class:Re(["srow",{cur:D.id===e.activeId}]),onClick:W=>l(D.id)},[T("div",Jre,[T("div",{class:Re(["t",{run:D.busy,aborted:D.status==="aborted"}])},R(D.title),3),T("div",ele,R(D.time),1)]),(e.attentionBySession[D.id]??0)>0?(w(),N("span",tle,R(e.attentionBySession[D.id]),1)):ie("",!0),oe(gn,{size:"lg",class:"kb",label:x(n)("sidebar.options"),onClick:vt(W=>A(D.id),["stop"])},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),y.value===D.id?(w(),ve(Wl,{key:1,class:"kmenu",onClick:I[1]||(I[1]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{size:"lg",onClick:W=>O(D)},{default:_e(()=>[qe(R(x(n)("sidebar.rename")),1)]),_:1},8,["onClick"]),oe(fn,{size:"lg",danger:"",onClick:W=>$(D.id)},{default:_e(()=>[qe(R(x(n)("sidebar.archive")),1)]),_:1},8,["onClick"])]),_:2},1024)):ie("",!0)],10,Zre))),128)),P.hasMore||P.loadingMore?(w(),N("button",{key:1,type:"button",class:"mshow-more",disabled:P.loadingMore,onClick:vt(D=>g(P.workspace.id),["stop"])},R(P.loadingMore?x(n)("sidebar.loadingMore"):x(n)("sidebar.showMore",{count:Math.max(0,P.workspace.sessionCount-P.sessions.length)})),9,nle)):ie("",!0),P.sessions.length>P.initialCount?(w(),N("button",{key:2,type:"button",class:"mshow-more",onClick:vt(D=>b(P.workspace.id),["stop"])},R(m(P.workspace.id)?x(n)("sidebar.showLess"):x(n)("sidebar.showAll",{count:P.sessions.length-P.initialCount})),9,sle)):ie("",!0)],512),[[Qo,!p(P.workspace.id)]])]))),128))])]),_:1},8,["model-value"]))}}),ile=ut(ole,[["__scopeId","data-v-9cd91593"]]),rle={class:"group-title"},lle={class:"srow-main"},ale={class:"srow-label"},cle={class:"srow-sub"},ule={class:"srow read-only"},dle={class:"srow-main"},fle={class:"srow-label"},ple={key:0,class:"srow-sub"},hle={class:"srow-main"},mle={class:"srow-label"},gle={class:"srow-sub"},vle=["aria-checked"],yle={class:"srow-main"},kle={class:"srow-label"},ble={class:"srow-sub"},_le=["aria-checked"],wle={class:"srow-main"},Sle={class:"srow-label"},Cle={class:"srow read-only"},xle={class:"srow-main"},Ale={class:"srow-label"},Tle={class:"srow-sub"},Mle=["aria-label"],Ele={class:"group-title"},Ile={class:"srow read-only pref"},$le={class:"srow-main"},Nle={class:"srow-label"},Lle={class:"srow read-only pref"},Ole={class:"srow-main"},Ple={class:"srow-label"},Rle={class:"srow read-only pref"},Dle={class:"srow-main"},Ble={class:"srow-label"},Fle={class:"num-field"},Hle=["value","aria-label"],Wle={class:"srow-main"},zle={class:"srow-label"},Ule={class:"srow-sub"},qle=["aria-checked"],jle={class:"srow-main"},Vle={class:"srow-label"},Kle={class:"srow-main"},Gle={class:"srow-label"},Yle={key:2,class:"srow read-only"},Xle={class:"srow-main"},Qle={class:"srow-label"},Zle={class:"srow-val dim"},Jle=je({__name:"MobileSettingsSheet",props:{modelValue:{type:Boolean},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},colorScheme:{default:"system"},uiFontSize:{default:14},authReady:{type:Boolean,default:!1},conversationToc:{type:Boolean},serverVersion:{default:""},models:{default:()=>[]}},emits:["update:modelValue","pickModel","setThinking","togglePlan","toggleSwarm","setPermission","setColorScheme","setUiFontSize","setConversationToc","login","logout"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(E){o("setColorScheme",E)}const r=["manual","auto","yolo"],l=F(()=>{const E=s.status?.modelId??s.status?.model??"";return s.models?.find(M=>M.id===E||M.model===E||M.displayName===s.status?.model)}),a=F(()=>fd(l.value)),c=F(()=>by(l.value)),u=F(()=>fc(l.value,s.thinking??"off")),d=F(()=>{const E=c.value,M=u.value;return E.includes(M)?M:E.includes("on")?"on":E[0]??"off"}),p=F(()=>c.value.map(E=>({value:E,label:F1(E)}))),h=F(()=>s.planMode===!0),f=F(()=>s.swarmMode===!0),m=F(()=>{const E=s.status.permission;return E==="yolo"?"var(--color-danger)":E==="auto"?"var(--color-warning)":"var(--color-text-muted)"}),b=F(()=>{const E=s.status.permission,M=n(E==="yolo"?"mobile.permYoloSub":E==="auto"?"mobile.permAutoSub":"mobile.permManualSub");return`${E} · ${M}`}),_=E=>`${Math.round(E/1e3)}k`,g=F(()=>s.status.ctxMax>0?Math.min(100,Math.max(0,Math.round(s.status.ctxUsed/s.status.ctxMax*100))):0),v=F(()=>s.status.ctxMax>0?`${_(s.status.ctxUsed)}/${_(s.status.ctxMax)}`:n("status.statusNone"));function y(E){o("setThinking",_y(l.value,E))}function A(){const E=r.indexOf(s.status.permission),M=r[(E+1)%r.length];o("setPermission",M)}function O(){o("pickModel"),o("update:modelValue",!1)}function $(){o("login"),o("update:modelValue",!1)}function k(){o("logout"),o("update:modelValue",!1)}return(E,M)=>(w(),ve(I3,{"model-value":e.modelValue,title:x(n)("mobile.settingsTitle"),"onUpdate:modelValue":M[4]||(M[4]=L=>o("update:modelValue",L))},{default:_e(()=>[T("div",rle,R(x(n)("mobile.groupSession")),1),T("button",{type:"button",class:"srow",onClick:O},[T("span",lle,[T("span",ale,R(x(n)("status.statusModel")),1),T("span",cle,R(e.status.model),1)]),M[5]||(M[5]=T("span",{class:"chev"},"›",-1))]),T("div",ule,[T("span",dle,[T("span",fle,R(x(n)("status.statusThinking")),1),a.value==="unsupported"?(w(),N("span",ple,R(x(n)("status.modeNotSupported")),1)):ie("",!0)]),c.value.length>1?(w(),ve(Oo,{key:0,"model-value":d.value,options:p.value,size:"sm","onUpdate:modelValue":y},null,8,["model-value","options"])):(w(),N("span",{key:1,class:Re(["srow-val",{dim:d.value==="off"}])},R(d.value==="off"?x(n)("status.planOff"):x(F1)(d.value)),3))]),T("button",{type:"button",class:"srow",onClick:M[0]||(M[0]=L=>o("togglePlan"))},[T("span",hle,[T("span",mle,R(x(n)("status.statusPlanMode")),1),T("span",gle,R(x(n)("mobile.planModeSub")),1)]),T("span",{class:Re(["toggle",{on:h.value}]),role:"switch","aria-checked":h.value},null,10,vle)]),T("button",{type:"button",class:"srow",onClick:M[1]||(M[1]=L=>o("toggleSwarm"))},[T("span",yle,[T("span",kle,R(x(n)("status.statusSwarmMode")),1),T("span",ble,R(x(n)("mobile.swarmModeSub")),1)]),T("span",{class:Re(["toggle",{on:f.value}]),role:"switch","aria-checked":f.value},null,10,_le)]),T("button",{type:"button",class:"srow",onClick:A},[T("span",wle,[T("span",Sle,R(x(n)("status.statusPermission")),1),T("span",{class:"srow-sub",style:Gt({color:m.value})},R(b.value),5)]),M[6]||(M[6]=T("span",{class:"chev"},"›",-1))]),T("div",Cle,[T("span",xle,[T("span",Ale,R(x(n)("status.statusContext")),1),T("span",Tle,R(v.value),1)]),T("span",{class:"ctx-meter","aria-label":v.value},[T("i",{style:Gt({width:g.value+"%"})},null,4)],8,Mle)]),T("div",Ele,R(x(n)("mobile.groupApp")),1),T("div",Ile,[T("span",$le,[T("span",Nle,R(x(n)("theme.colorSchemeLabel")),1)]),oe(Oo,{"model-value":e.colorScheme??"system",options:[{value:"light",label:x(n)("theme.light")},{value:"dark",label:x(n)("theme.dark")},{value:"system",label:x(n)("theme.system")}],"onUpdate:modelValue":i},null,8,["model-value","options"])]),T("div",Lle,[T("span",Ole,[T("span",Ple,R(x(n)("sidebar.language")),1)]),oe(E3)]),T("div",Rle,[T("span",Dle,[T("span",Ble,R(x(n)("settings.uiFontSize")),1)]),T("label",Fle,[T("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":x(n)("settings.uiFontSize"),onInput:M[2]||(M[2]=L=>o("setUiFontSize",Number(L.target.value)))},null,40,Hle),M[7]||(M[7]=T("span",{class:"num-unit"},"px",-1))])]),T("button",{type:"button",class:"srow",onClick:M[3]||(M[3]=L=>o("setConversationToc",!e.conversationToc))},[T("span",Wle,[T("span",zle,R(x(n)("settings.conversationToc")),1),T("span",Ule,R(x(n)("settings.conversationTocHint")),1)]),T("span",{class:Re(["toggle",{on:e.conversationToc}]),role:"switch","aria-checked":e.conversationToc},null,10,qle)]),e.authReady?(w(),N("button",{key:0,type:"button",class:"srow acct out",onClick:k},[T("span",jle,[T("span",Vle,R(x(n)("sidebar.signOut")),1)])])):(w(),N("button",{key:1,type:"button",class:"srow acct in",onClick:$},[T("span",Kle,[T("span",Gle,R(x(n)("sidebar.signIn")),1)])])),e.serverVersion?(w(),N("div",Yle,[T("span",Xle,[T("span",Qle,R(x(n)("settings.serverVersion")),1)]),T("span",Zle,R(e.serverVersion),1)])):ie("",!0)]),_:1},8,["model-value","title"]))}}),eae=ut(Jle,[["__scopeId","data-v-024e4fb3"]]),$3=["blue","mono"],N3=["light","dark","system"],L3=14,tae=12,nae=20;function sae(){const e=Qn(Et.accent);return e&&$3.includes(e)?e:"blue"}function oae(e){typeof document>"u"||!document.documentElement||(document.documentElement.dataset.accent=e)}function iae(){const e=Qn(Et.colorScheme);return e&&N3.includes(e)?e:"system"}function rae(e){if(typeof document>"u"||!document.documentElement)return;document.documentElement.dataset.colorScheme=e;const t=document.querySelectorAll('meta[name="theme-color"]');if(t.length===0)return;const n=e==="dark"?"#0d1117":e==="light"?"#ffffff":null;t.forEach(s=>{const i=(s.getAttribute("media")??"").includes("dark")?"#0d1117":"#ffffff";s.setAttribute("content",n??i)})}function Cy(e){return Number.isFinite(e)?Math.min(nae,Math.max(tae,Math.round(e))):L3}function lae(){const e=Qn(Et.uiFontSize);return e===null?L3:Cy(Number(e))}function aae(e){typeof document>"u"||!document.documentElement||document.documentElement.style.setProperty("--ui-font-size",`${Cy(e)}px`)}const xy=Z(iae()),Ay=Z(sae()),Ty=Z(lae());Ke(xy,rae,{immediate:!0});Ke(Ay,oae,{immediate:!0});Ke(Ty,aae,{immediate:!0});function cae(e){N3.includes(e)&&(xy.value=e,ts(Et.colorScheme,e))}function uae(e){$3.includes(e)&&(Ay.value=e,ts(Et.accent,e))}function dae(e){const t=Cy(e);Ty.value=t,ts(Et.uiFontSize,String(t))}const fae=600,pae=250,Ph=250,hae=1e3,mae=160,Hp=Z(!1);let Ll=[],Dl=null,Wp=-Ph;function gae(){Ll=[],Wp=-Ph,Hp.value=!1,Dl!==null&&(clearTimeout(Dl),Dl=null)}function vae(){Hp.value=!0,Dl!==null&&clearTimeout(Dl),Dl=setTimeout(()=>{Dl=null,Ll=[],Wp=-Ph,Hp.value=!1},hae)}function yae(e){if(e<=0)return;const t=Date.now();Ll.push({time:t,chars:e});const n=t-fae;if(Ll=Ll.filter(l=>l.time>=n),t-Wp<Ph)return;Wp=t;const s=Ll[0]?.time??t,o=Math.max(t-s,pae);Ll.reduce((l,a)=>l+a.chars,0)/o*1e3>=mae&&vae()}function O3(){return{colorScheme:xy,accent:Ay,uiFontSize:Ty,fastMoon:Hp,setColorScheme:cae,setAccent:uae,setUiFontSize:dae,resetFastMoon:gae,recordMoonDelta:yae}}const kae={class:"ob-brand"},bae={class:"ob-brand-text"},_ae={class:"ob-title"},wae={class:"ob-sub"},Sae={class:"ob-sec"},Cae={class:"ob-label"},xae={class:"ob-sec"},Aae={class:"ob-label"},Tae={class:"ob-sec"},Mae={class:"ob-label"},Eae=je({__name:"Onboarding",emits:["complete","skip"],setup(e,{emit:t}){const n=t,{t:s,locale:o}=It(),{colorScheme:i,accent:r,setColorScheme:l,setAccent:a}=O3();function c(d){o.value!==d&&MA(d)}function u(){n("complete")}return(d,p)=>(w(),ve(ar,{open:!0,size:"md","close-on-overlay":!1,"close-on-esc":!1,onClose:p[3]||(p[3]=h=>n("skip"))},{head:_e(()=>[T("div",kae,[p[4]||(p[4]=T("svg",{class:"ob-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BLUN King"},[T("defs",null,[T("mask",{id:"obBlunEyes",maskUnits:"userSpaceOnUse"},[T("rect",{x:"0",y:"0",width:"32",height:"22",fill:"#fff"}),T("g",{class:"ob-eyes",fill:"#000"},[T("rect",{class:"ob-eye",x:"11.8",y:"7",width:"2.8",height:"8",rx:"1.4"}),T("rect",{class:"ob-eye",x:"17.4",y:"7",width:"2.8",height:"8",rx:"1.4"})])])]),T("rect",{x:"1",y:"1",width:"30",height:"20",rx:"6",fill:"var(--color-accent)",mask:"url(#obBlunEyes)"})],-1)),T("div",bae,[T("div",_ae,R(x(s)("onboarding.title")),1),T("div",wae,R(x(s)("onboarding.subtitle")),1)])])]),default:_e(()=>[T("section",Sae,[T("div",Cae,R(x(s)("onboarding.languageLabel")),1),oe(Oo,{"model-value":x(o),options:x(TA).map(h=>({value:h.code,label:h.label})),"onUpdate:modelValue":p[0]||(p[0]=h=>c(h))},null,8,["model-value","options"])]),T("section",xae,[T("div",Aae,R(x(s)("theme.colorSchemeLabel")),1),oe(Oo,{"model-value":x(i),options:[{value:"light",label:x(s)("theme.light")},{value:"dark",label:x(s)("theme.dark")},{value:"system",label:x(s)("theme.system")}],"onUpdate:modelValue":p[1]||(p[1]=h=>x(l)(h))},null,8,["model-value","options"])]),T("section",Tae,[T("div",Mae,R(x(s)("theme.accentLabel")),1),oe(Oo,{"model-value":x(r),options:[{value:"blue",label:x(s)("theme.accentBlue")},{value:"mono",label:x(s)("theme.accentBlack")}],"onUpdate:modelValue":p[2]||(p[2]=h=>x(a)(h))},null,8,["model-value","options"])]),oe(Dt,{variant:"primary",size:"lg",class:"ob-start",onClick:u},{default:_e(()=>[qe(R(x(s)("onboarding.start")),1)]),_:1})]),_:1}))}}),Iae=ut(Eae,[["__scopeId","data-v-b47a0a7c"]]),$ae=["aria-label"],Nae={class:"gload-box"},Lae={class:"gload-text"},Oae=je({__name:"GlobalLoading",setup(e){const{t}=It();return(n,s)=>(w(),N("div",{class:"gload",role:"status","aria-label":x(t)("app.connecting")},[T("div",Nae,[s[0]||(s[0]=c0('<svg class="gload-logo" viewBox="0 0 96 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" data-v-ebff26e9><path fill="currentColor" d="M35.767 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304c-.37 0-.671.3-.671.671z" data-v-ebff26e9></path><path fill="currentColor" d="M90.353 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304a.67.67 0 0 0-.671.671z" data-v-ebff26e9></path><path fill="currentColor" d="M73.256 0a.67.67 0 0 0-.652.512l-6.366 26.1c-.106.428-.607.428-.71 0L59.159.512A.67.67 0 0 0 58.511 0H47.725c-.37 0-.668.3-.668.671V31.33c0 .37.3.671.67.671h4.781c.37 0 .671-.292.671-.662V5.554c0-.515.604-.622.726-.127l6.358 26.06a.67.67 0 0 0 .653.513h9.931c.31 0 .58-.212.653-.512L77.855 5.43c.122-.495.726-.388.726.127v25.772c0 .37.3.671.671.671h4.78c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.671-.671z" data-v-ebff26e9></path><path fill="currentColor" d="M15.279 14.837 28.264 1.133A.671.671 0 0 0 27.777 0h-6.043a.67.67 0 0 0-.477.199L6.374 15.223c-.231.234-.573.025-.573-.35V.672c0-.37-.3-.671-.671-.671H.67a.67.67 0 0 0-.67.67V31.33c0 .37.3.671.671.671H5.13c.37 0 .671-.3.671-.671v-6.114a.5.5 0 0 1 .13-.35l4.594-4.69a.293.293 0 0 1 .386-.045l12.286 9.305c1.796 1.245 4.083 2.06 6.178 2.401a.645.645 0 0 0 .743-.648v-5.537a.7.7 0 0 0-.562-.677c-1.215-.262-2.565-.758-3.59-1.468L15.332 15.58c-.22-.152-.248-.544-.052-.744" data-v-ebff26e9></path></svg>',1)),oe(ni,{size:"md",label:x(t)("app.connecting")},null,8,["label"]),T("div",Lae,R(x(t)("app.connecting")),1)])],8,$ae))}}),Pae=ut(Oae,[["__scopeId","data-v-ebff26e9"]]),Rae={class:"kap-root"},Dae={class:"kap-head"},Bae={class:"kap-count"},Fae={class:"kap-head-actions"},Hae={class:"kap-filters"},Wae=["value"],zae={class:"kap-check"},Uae={class:"kap-check"},qae={class:"kap-view-toggle",role:"group"},jae={key:0,class:"kap-empty"},Vae=["onClick"],Kae={class:"kap-ts"},Gae={class:"kap-label"},Yae={key:0,class:"kap-detail"},Xae={class:"kap-detail-actions"},Qae=["onClick"],Zae={key:1,class:"kap-agg"},Jae={class:"mono"},ece={class:"mono"},tce={class:"num"},nce={class:"num"},sce={key:0},oce={class:"mono"},ice={class:"num"},rce={class:"num"},lce={key:0},ace=je({__name:"KapDebugView",emits:["close"],setup(e,{emit:t}){const n=t,s=Z("all"),o=Z(""),i=Z(""),r=Z(!1),l=Z("timeline"),a=F(()=>(vy.value,[...rG()])),c=F(()=>{const E=new Set;for(const M of a.value)M.sessionId&&E.add(M.sessionId);return[...E].sort()});function u(E){return E.kind==="rest:error"||E.code!==void 0&&E.code!==0||E.eventType==="error"||E.eventType==="parse-error"}const d=F(()=>{const E=o.value.trim().toLowerCase();return a.value.filter(M=>!(s.value!=="all"&&M.source!==s.value||i.value&&M.sessionId!==i.value||r.value&&!u(M)||E&&!`${M.label} ${M.kind} ${M.eventType??""} ${M.sessionId??""} ${M.requestId??""}`.toLowerCase().includes(E)))}),p=F(()=>{const E=new Map;for(const M of d.value){if(M.kind!=="ws:in"&&M.kind!=="ws:out")continue;const L=M.kind==="ws:in"?"←":"→",S=`${L} ${M.eventType??"?"} @ ${M.sessionId??"-"}`,I=E.get(S)??{key:S,sessionId:M.sessionId??"-",eventType:M.eventType??"?",dir:L,count:0};I.count++,M.seq!==void 0&&(I.lastSeq=M.seq),E.set(S,I)}return[...E.values()].sort((M,L)=>L.count-M.count)}),h=F(()=>{const E=new Map;for(const M of d.value){if(M.source!=="rest"||M.kind==="rest:request")continue;const L=`${M.method??"?"} ${M.path??"?"}`,S=E.get(L)??{count:0,errors:0,totalMs:0,timed:0};S.count++,u(M)&&S.errors++,M.durationMs!==void 0&&(S.totalMs+=M.durationMs,S.timed++),E.set(L,S)}return[...E.entries()].map(([M,L])=>({key:M,count:L.count,errors:L.errors,avgMs:L.timed>0?Math.round(L.totalMs/L.timed):0})).sort((M,L)=>L.count-M.count)}),f=Z(null),m=Z(!0),b=Z(null),_=Z(null);Ke(()=>d.value.length,async()=>{if(!m.value||l.value!=="timeline")return;await ht();const E=b.value;E&&(E.scrollTop=E.scrollHeight)});function g(E){f.value=f.value===E?null:E}function v(E){const M=new Date(E),L=(S,I=2)=>String(S).padStart(I,"0");return`${L(M.getHours())}:${L(M.getMinutes())}:${L(M.getSeconds())}.${L(M.getMilliseconds(),3)}`}function y(E){return JSON.stringify(E,null,2)}async function A(E){await zs(y(E))&&(_.value=E.id,setTimeout(()=>{_.value===E.id&&(_.value=null)},1500))}function O(){y3(d.value)}function $(E){return u(E)||E.source==="client"?"b-err":E.source==="rest"?"b-rest":E.kind==="ws:lifecycle"?"b-life":E.kind==="ws:out"?"b-out":"b-in"}function k(E){return E.source==="rest"?"REST":E.source==="client"?"APP":"WS"}return(E,M)=>(w(),N("section",Rae,[T("header",Dae,[M[11]||(M[11]=T("strong",null,"KAP debug",-1)),T("span",Bae,R(d.value.length)+"/"+R(a.value.length),1),T("div",Fae,[T("button",{type:"button",class:Re({on:x(su)}),onClick:M[0]||(M[0]=L=>su.value=!x(su))},R(x(su)?"resume":"pause"),3),T("button",{type:"button",onClick:M[1]||(M[1]=L=>x(lG)())},"clear"),T("button",{type:"button",onClick:M[2]||(M[2]=L=>O())},"export jsonl"),oe(Ht,{text:"Close window"},{default:_e(()=>[T("button",{type:"button",onClick:M[3]||(M[3]=L=>n("close"))},"✕")]),_:1})])]),T("div",Hae,[Mn(T("select",{"onUpdate:modelValue":M[4]||(M[4]=L=>s.value=L),"aria-label":"Source filter"},[...M[12]||(M[12]=[T("option",{value:"all"},"rest + ws + app",-1),T("option",{value:"rest"},"rest",-1),T("option",{value:"ws"},"ws",-1),T("option",{value:"client"},"app errors",-1)])],512),[[Rv,s.value]]),Mn(T("select",{"onUpdate:modelValue":M[5]||(M[5]=L=>i.value=L),"aria-label":"Session filter"},[M[13]||(M[13]=T("option",{value:""},"all sessions",-1)),(w(!0),N(Le,null,nt(c.value,L=>(w(),N("option",{key:L,value:L},R(L),9,Wae))),128))],512),[[Rv,i.value]]),Mn(T("input",{"onUpdate:modelValue":M[6]||(M[6]=L=>o.value=L),type:"text",placeholder:"filter (type / path / id)","aria-label":"Text filter"},null,512),[[ko,o.value]]),T("label",zae,[Mn(T("input",{"onUpdate:modelValue":M[7]||(M[7]=L=>r.value=L),type:"checkbox"},null,512),[[lp,r.value]]),M[14]||(M[14]=qe(" errors",-1))]),T("label",Uae,[Mn(T("input",{"onUpdate:modelValue":M[8]||(M[8]=L=>m.value=L),type:"checkbox"},null,512),[[lp,m.value]]),M[15]||(M[15]=qe(" follow",-1))]),T("div",qae,[T("button",{type:"button",class:Re({on:l.value==="timeline"}),onClick:M[9]||(M[9]=L=>l.value="timeline")},"timeline",2),T("button",{type:"button",class:Re({on:l.value==="aggregate"}),onClick:M[10]||(M[10]=L=>l.value="aggregate")},"aggregate",2)])]),l.value==="timeline"?(w(),N("div",{key:0,ref_key:"listRef",ref:b,class:"kap-list"},[d.value.length===0?(w(),N("div",jae," No trace entries yet. REST calls and WS frames will appear here. ")):ie("",!0),(w(!0),N(Le,null,nt(d.value,L=>(w(),N("div",{key:L.id,class:"kap-row-wrap"},[T("button",{type:"button",class:Re(["kap-row",{expanded:f.value===L.id}]),onClick:S=>g(L.id)},[T("span",Kae,R(v(L.ts)),1),T("span",{class:Re(["kap-badge",$(L)])},R(k(L)),3),T("span",Gae,R(L.label),1)],10,Vae),f.value===L.id?(w(),N("div",Yae,[T("div",Xae,[T("button",{type:"button",onClick:S=>A(L)},R(_.value===L.id?"copied ✓":"copy json"),9,Qae)]),T("pre",null,R(y(L)),1)])):ie("",!0)]))),128))],512)):(w(),N("div",Zae,[M[20]||(M[20]=T("h4",null,"WS frames by session / type",-1)),T("table",null,[M[17]||(M[17]=T("thead",null,[T("tr",null,[T("th",null,"dir"),T("th",null,"type"),T("th",null,"session"),T("th",null,"count"),T("th",null,"last seq")])],-1)),T("tbody",null,[(w(!0),N(Le,null,nt(p.value,L=>(w(),N("tr",{key:L.key},[T("td",null,R(L.dir),1),T("td",Jae,R(L.eventType),1),T("td",ece,R(L.sessionId),1),T("td",tce,R(L.count),1),T("td",nce,R(L.lastSeq??"—"),1)]))),128)),p.value.length===0?(w(),N("tr",sce,[...M[16]||(M[16]=[T("td",{colspan:"5",class:"kap-empty"},"no ws frames",-1)])])):ie("",!0)])]),M[21]||(M[21]=T("h4",null,"REST by endpoint",-1)),T("table",null,[M[19]||(M[19]=T("thead",null,[T("tr",null,[T("th",null,"endpoint"),T("th",null,"count"),T("th",null,"errors"),T("th",null,"avg ms")])],-1)),T("tbody",null,[(w(!0),N(Le,null,nt(h.value,L=>(w(),N("tr",{key:L.key},[T("td",oce,R(L.key),1),T("td",ice,R(L.count),1),T("td",{class:Re(["num",{err:L.errors>0}])},R(L.errors),3),T("td",rce,R(L.avgMs),1)]))),128)),h.value.length===0?(w(),N("tr",lce,[...M[18]||(M[18]=[T("td",{colspan:"4",class:"kap-empty"},"no rest calls",-1)])])):ie("",!0)])])]))]))}}),cce=ut(ace,[["__scopeId","data-v-fcc21eb7"]]),uce=je({__name:"DebugPanel",setup(e){const t=Z(!1);let n=null,s=null,o=null;const i=["data-color-scheme","data-accent"];function r(u){const d=document.documentElement,p=u.documentElement;for(const h of i){const f=d.getAttribute(h);f!==null?p.setAttribute(h,f):p.removeAttribute(h)}}function l(u){const d=u.document;d.title="KAP debug";const p=d.createElement("base");p.href=location.href,d.head.appendChild(p);for(const f of Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')))d.head.appendChild(f.cloneNode(!0));r(d),d.body.style.margin="0";const h=d.createElement("div");return h.style.height="100vh",d.body.appendChild(h),h}function a(){o?.disconnect(),o=null;try{s?.unmount()}catch{}s=null,n=null,t.value=!1}function c(){if(n&&!n.closed){n.focus();return}const u=window.open("","kap-debug","popup=yes,width=1040,height=760");if(!u)return;n=u;const d=l(u),p=ap(cce,{onClose:()=>u.close()});p.mount(d),s=p,t.value=!0,o=new MutationObserver(()=>{n&&!n.closed&&r(n.document)}),o.observe(document.documentElement,{attributes:!0,attributeFilter:[...i]}),u.addEventListener("pagehide",a),u.addEventListener("beforeunload",a)}return hn(()=>{c()}),ls(()=>{n&&!n.closed&&n.close(),a()}),(u,d)=>(w(),ve(Ht,{text:t.value?"Focus KAP debug window":"Open KAP debug window"},{default:_e(()=>[T("button",{class:"kap-fab",type:"button",onClick:c}," KAP ")]),_:1},8,["text"]))}}),dce=ut(uce,[["__scopeId","data-v-2fa4bf16"]]);function fce(e){const t=e.split("/").filter(Boolean);return t.length>0?t[t.length-1]:e}function pce(e,t){return e.find(n=>n.root===t.cwd)?.id??t.workspaceId??t.cwd}function hce(e){const{workspaces:t,sessions:n,hiddenWorkspaceRoots:s,activeRoot:o,activeBranch:i,sessionsHasMoreByWorkspace:r}=e,l=new Set(s),a=new Map;for(const h of t)l.has(h.root)||a.has(h.root)||a.set(h.root,{...h});for(const h of n){const f=h.cwd;f&&(l.has(f)||a.has(f)||a.set(f,{id:h.workspaceId??f,root:f,name:fce(f),isGitRepo:!1,sessionCount:0}))}const c=new Map;for(const h of n){const f=pce(t,h);c.set(f,(c.get(f)??0)+1)}const u=[...new Set(t.filter(h=>!l.has(h.root)).map(h=>h.root))],d=[...a.keys()].filter(h=>!u.includes(h));d.sort((h,f)=>h.localeCompare(f));const p=[];for(const h of[...u,...d]){const f=a.get(h),m=c.get(f.id)??c.get(f.root)??0,b=r[f.id]===!1?m:Math.max(f.sessionCount,m);let _=f.branch;!_&&i&&o===f.root&&(_=i),p.push({...f,sessionCount:b,branch:_})}return p}function mce(e){const t=new Map,n=new Set;function s(i){const r=t.get(i);if(r!==void 0)return r;const l=(async()=>e(i))().finally(()=>{t.delete(i),n.delete(i)&&s(i)});return t.set(i,l),l}function o(i){if(t.has(i)){n.add(i);return}s(i)}return{run:s,request:o}}const gce=new Set(["assistantDelta","agentDelta","toolOutput","taskProgress"]);function vce(e){return gce.has(e.type)}function yce(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function kce(e,t,n=yce){let s=[],o=null;const i=()=>{if(o=null,s.length===0)return;const l=s;s=[];for(const a of l)e(a)},r=(l=>{if(t(l)){s.push(l),o===null&&(o=n(i));return}i(),e(l)});return r.flush=i,r}function P3(e,t){const n=Qn(e);return n===null?t:n==="1"}const My=Z(P3(Et.notifyOnComplete,!0)),Ey=Z(P3(Et.notifyOnQuestion,!1)),Iy=Z(typeof Notification<"u"?Notification.permission:"denied");async function R3(e,t,n){if(!n){e.value=!1,ts(t,"0");return}if(typeof Notification>"u")return;let s=Notification.permission;if(s==="default")try{s=await Notification.requestPermission()}catch{}Iy.value=s,s==="granted"&&(e.value=!0,ts(t,"1"))}function bce(e){return R3(My,Et.notifyOnComplete,e)}function _ce(e){return R3(Ey,Et.notifyOnQuestion,e)}function D3(e,t,n,s){if(!e||typeof Notification>"u")return;const o=Notification.permission;if(o!=="denied"){if(o==="default"){Notification.requestPermission().then(i=>{Iy.value=i,i==="granted"&&eC(t,n,s)});return}eC(t,n,s)}}function eC(e,t,n){if(e.isActiveAndVisible)return;const s=e.sessionTitle.trim()||"BLUN King";try{const o=new Notification(s,{body:t,tag:n});o.onclick=()=>{try{window.focus()}catch{}e.onClick(),o.close()}}catch{}}function wce(e,t){D3(My.value,t,Un.global.t("settings.notifyBody"),`blun-complete-${e}`)}function Sce(e,t){const n=t.questionPreview||Un.global.t("settings.notifyQuestionBody");D3(Ey.value,t,n,`blun-question-${e}`)}function Cce(){return{notifyOnComplete:My,notifyOnQuestion:Ey,notifyPermission:Iy,setNotifyOnComplete:bce,setNotifyOnQuestion:_ce,maybeNotifyCompletion:wce,maybeNotifyQuestion:Sce}}function xce(){return Qn(Et.soundOnComplete)==="1"}const pd=Z(xce());function Ace(){if(typeof window>"u")return;const e=window;return window.AudioContext??e.webkitAudioContext}let fv=null;function B3(){const e=Ace();if(!e)return null;if(fv===null)try{fv=new e}catch{return null}return fv}function F3(){if(!pd.value)return;const e=B3();e!==null&&e.state==="suspended"&&e.resume().then(()=>{Or("sound: audio context resumed",{state:e.state})},t=>{Or("sound: audio context resume rejected",{error:String(t)})})}let tC=!1;function Tce(){if(tC||typeof window>"u")return;tC=!0;const e=()=>{F3()};window.addEventListener("pointerdown",e,{capture:!0}),window.addEventListener("keydown",e,{capture:!0})}Tce();function Mce(e){pd.value=e,ts(Et.soundOnComplete,e?"1":"0"),e&&F3()}function nC(e,t,n,s,o){const i=e.createOscillator(),r=e.createGain();i.type="sine",i.frequency.value=t,i.connect(r),r.connect(e.destination);const l=e.currentTime+n;r.gain.setValueAtTime(1e-4,l),r.gain.exponentialRampToValueAtTime(o,l+.01),r.gain.exponentialRampToValueAtTime(1e-4,l+s),i.start(l),i.stop(l+s+.02)}function H3(){const e=B3();if(e===null){Or("sound: skipped, AudioContext unavailable");return}if(e.state!=="running"){Or("sound: skipped, context not running",{state:e.state}),e.state==="suspended"&&e.resume().then(()=>{Or("sound: context resumed for next time",{state:e.state})},t=>{Or("sound: resume rejected",{error:String(t)})});return}try{nC(e,880,0,.16,.18),nC(e,1320,.1,.22,.16),Or("sound: chime scheduled",{state:e.state})}catch(t){Or("sound: failed to play",{error:String(t)})}}function Ece(){pd.value&&H3()}function Ice(){pd.value&&H3()}function $ce(){return{soundOnComplete:pd,setSoundOnComplete:Mce,maybePlayCompletionSound:Ece,maybePlayQuestionSound:Ice}}function sC(e,t){const n=new Set(e.map(o=>o.id)),s=t.filter(o=>o.kind==="subagent"&&!n.has(o.id));return s.length===0?e:[...e,...s]}const Nce=1e3,Lce=4096,oC=32*1024;function Oce(e,t){let n=null,s;const o=new Set;async function i(p){try{const f=await dt().listTasks(p);e.tasksBySession={...e.tasksBySession,[p]:sC(f,e.tasksBySession[p]??[])},await r(p,f)}catch{}}async function r(p,h){if(e.activeSessionId!==p)return;const f=h??e.tasksBySession[p]??[],m=dt(),b=new Map;if(await Promise.all(f.map(async g=>{if((g.status==="completed"||g.status==="failed"||g.status==="cancelled")&&!o.has(g.id)&&!((g.outputLines?.length??0)>0))try{const y=await m.getTask(p,g.id,{withOutput:!0,outputBytes:oC});y.outputPreview!==void 0&&b.set(g.id,{preview:y.outputPreview,bytes:y.outputBytes})}catch{}finally{o.add(g.id)}})),b.size===0)return;const _=e.tasksBySession[p]??[];e.tasksBySession={...e.tasksBySession,[p]:_.map(g=>{const v=b.get(g.id);return v?{...g,outputPreview:v.preview,outputBytes:v.bytes}:g})}}async function l(p){if(e.activeSessionId!==p)return;const h=dt();let f;try{f=await h.listTasks(p)}catch{return}const m=new Map;await Promise.all(f.map(async v=>{const y=v.status==="running",A=v.status==="completed"||v.status==="failed"||v.status==="cancelled";if(!(!y&&!A)&&!(A&&(o.has(v.id)||(v.outputLines?.length??0)>0)))try{const O=await h.getTask(p,v.id,{withOutput:!0,outputBytes:y?Lce:oC});O.outputPreview!==void 0&&m.set(v.id,{preview:O.outputPreview,bytes:O.outputBytes})}catch{}finally{A&&o.add(v.id)}}));const b=e.tasksBySession[p]??[],_=new Map(b.map(v=>[v.id,v])),g=f.map(v=>{const y=_.get(v.id),A=m.get(v.id);return{...v,outputLines:y?.outputLines,text:y?.text,outputPreview:A?.preview??y?.outputPreview,outputBytes:A?.bytes??y?.outputBytes}});e.tasksBySession={...e.tasksBySession,[p]:sC(g,b)}}function a(p){n!==null&&s===p||(c(),s=p,l(p),n=setInterval(()=>{typeof document<"u"&&document.visibilityState==="hidden"||(e.activeSessionId===p?l(p):c())},Nce))}function c(){n!==null&&(clearInterval(n),n=null),s=void 0,o.clear()}const u=Z(0);let d=null;return Ke(()=>t.value.some(p=>p.status==="running"),p=>{p&&d===null?d=setInterval(()=>{u.value=(u.value+1)%Number.MAX_SAFE_INTEGER},1e3):!p&&d!==null&&(clearInterval(d),d=null)},{immediate:!0}),Ke(()=>{const p=e.activeSessionId;if(!p)return{sid:void 0,hasRunning:!1};const h=e.tasksBySession[p]??[];return{sid:p,hasRunning:h.some(f=>f.status==="running")}},({sid:p,hasRunning:h},f,m)=>{let b;h&&p!==void 0?a(p):p!==void 0?b=setTimeout(()=>{(e.tasksBySession[p]??[]).some(g=>g.status==="running")||c()},1500):c(),m(()=>{b!==void 0&&clearTimeout(b)})},{deep:!0,immediate:!0}),{taskClock:F(()=>u.value),loadTasksForSession:i}}const W3=Et.starredModels;function Pce(){try{const e=Qn(W3);if(!e)return[];const t=JSON.parse(e);if(Array.isArray(t)&&t.every(n=>typeof n=="string"))return t}catch{}return[]}function Rce(e){try{ts(W3,JSON.stringify(e))}catch{}}function Dce(e,t){const{pushOperationFailure:n,refreshSessionStatus:s,persistSessionProfile:o,activity:i,inFlightPromptSessions:r,saveThinkingToStorage:l,updateSession:a,updateSessionMessages:c}=t,u=Z([]),d=Z(Pce()),p=Z({}),h=Z([]),f=Z(null);function m(z){if(!(z==null||z.length===0))return u.value.find(q=>q.id===z||q.model===z)}function b(){const z=e.activeSessionId?e.sessions.find(q=>q.id===e.activeSessionId):void 0;return m(z?.model??f.value??e.defaultModel)}function _(z){const q=fc(b(),z);return e.thinking=q,l(q),q}async function g(z){try{const Q=await dt().listSkills(z);p.value={...p.value,[z]:Q}}catch{}}async function v(){try{const z=dt();u.value=await z.listModels(),_(e.thinking)}catch(z){n("loadModels",z)}}async function y(){try{const z=await dt().refreshOAuthProviderModels();for(const q of z.failed)n("refreshOAuthProviderModels",new Error(q.reason),{message:q.provider})}catch{}}async function A(){try{const z=dt();h.value=await z.listProviders()}catch(z){n("loadProviders",z)}}async function O(z){const q=e.activeSessionId,Q=fc(m(z),e.thinking),X=e.thinking;if(!q){f.value=z,_(Q);return}const fe=e.sessions.find(ye=>ye.id===q)?.model;a(q,ye=>({...ye,model:z})),Q!==X&&(e.thinking=Q,l(Q));try{await dt().updateSession(q,{model:z,thinking:Q!==X?Q:void 0})}catch(ye){a(q,Me=>({...Me,model:fe??Me.model})),Q!==X&&(e.thinking=X,l(X)),n("setModel",ye,{sessionId:q});return}await s(q)}function $(z){const q=new Set(d.value);q.has(z)?q.delete(z):q.add(z),d.value=Array.from(q),Rce(d.value)}async function k(z,q){const Q=e.activeSessionId;if(!Q)return;const X=i.value==="idle"&&!r.has(Q),fe=`msg_skill_opt_${Date.now().toString(36)}`;if(X){r.add(Q),e.sendingBySession={...e.sendingBySession,[Q]:!0};const ye={id:fe,sessionId:Q,role:"user",content:[{type:"text",text:`/${z}${q?` ${q}`:""}`}],createdAt:new Date().toISOString(),metadata:{"blunWeb.optimisticUserMessage":!0,origin:{kind:"skill_activation",trigger:"user-slash",skillName:z,skillArgs:q}}};c(Q,Me=>[...Me,ye])}try{await dt().activateSkill(Q,z,q)}catch(ye){X&&(r.delete(Q),e.sendingBySession={...e.sendingBySession,[Q]:!1},c(Q,Me=>Me.filter(we=>we.id!==fe))),n("activateSkill",ye,{sessionId:Q})}}async function E(z){try{await dt().addProvider(z),await Promise.all([A(),v()])}catch(q){n("addProvider",q)}}async function M(z){try{await dt().deleteProvider(z),await Promise.all([A(),v()])}catch(q){n("deleteProvider",q)}}async function L(z){try{const q=await dt().refreshProvider(z);for(const Q of q.failed)n("refreshProvider",new Error(Q.reason),{message:Q.provider});await Promise.all([A(),v()])}catch(q){n("refreshProvider",q)}}async function S(){try{const z=await dt().refreshAllProviders();for(const q of z.failed)n("refreshAllProviders",new Error(q.reason),{message:q.provider});await Promise.all([A(),v()])}catch(z){n("refreshAllProviders",z)}}async function I(){try{return await dt().startOAuthLogin()}catch{return null}}async function P(){try{return await dt().pollOAuthLogin()}catch{return null}}async function D(){try{await dt().cancelOAuthLogin()}catch{}}function W(z){const q=_(z);o({thinking:q})}return{models:u,starredModelIds:d,providers:h,draftModel:f,skillsBySession:p,loadSkillsForSession:g,loadModels:v,refreshOAuthProviderModels:y,loadProviders:A,setModel:O,toggleStarModel:$,activateSkill:k,addProvider:E,deleteProvider:M,refreshProvider:L,refreshAllProviders:S,startOAuthLogin:I,pollOAuthLogin:P,cancelOAuthLogin:D,setThinking:W}}const z3="blunWeb.compaction",Bce=["queued","working","suspended","completed","failed"];function U3(e){return e.status==="completed"?"completed":e.status==="failed"||e.status==="cancelled"?"failed":e.subagentPhase?e.subagentPhase:"working"}function Fce(){return{queued:0,working:0,suspended:0,completed:0,failed:0}}function Hce(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||n.swarmIndex===void 0)continue;const s=n.parentToolCallId??"swarm",o=t.get(s)??[];o.push({id:n.id,name:n.description,subagentType:n.subagentType,phase:U3(n),summary:n.outputPreview,outputLines:n.outputLines,suspendedReason:n.suspendedReason,swarmIndex:n.swarmIndex}),t.set(s,o)}return[...t.entries()].map(([n,s])=>{const o=s.toSorted((r,l)=>r.swarmIndex-l.swarmIndex||r.id.localeCompare(l.id)),i=Fce();for(const r of o)i[r.phase]++;return{id:n,members:o,counts:i}}).filter(n=>n.members.length>1).toSorted((n,s)=>{const o=n.members.at(0)?.swarmIndex??0,i=s.members.at(0)?.swarmIndex??0;return o!==i?o-i:n.id.localeCompare(s.id)})}function Wce(e){let t=0,n=0;for(const s of e){n+=s.members.length;for(const o of Bce)(o==="completed"||o==="failed")&&(t+=s.counts[o])}return{done:t,total:n}}const zce=/^read[_-]?media(?:file)?$/i,Uce=/^data:([^;]+);base64,(.*)$/s,qce=/^<(image|video|audio)\s+path="([^"]+)">$/,jce=/^<(image|video|audio)\s+path="([^"]+)">(?:<\/\1>)?$/,Vce=/Mime type:\s*([^.\s]+)/i,Kce=/Size:\s*(\d+)\s*bytes/i,Gce=/Original dimensions:\s*(\d+)x(\d+)\s*pixels/i;function Yce(e){return e.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function Xce(e){const t=jce.exec(e.trim());return t?{kind:t[1],path:Yce(t[2])}:null}const Qce=/^f_[A-Za-z0-9]{10,}$/;function Zce(e){const t=e.split(/[\\/]/).at(-1)??"",n=t.lastIndexOf("."),s=n>0?t.slice(0,n):t;return Qce.test(s)?s:void 0}function Jce(e){if(e.length===0)return 0;const t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function eue(e){if(Array.isArray(e))return e;if(typeof e!="string")return null;try{const t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function tue(e){const t=e.type,n=t==="image_url"?"image":t==="video_url"?"video":t==="audio_url"?"audio":null;if(n===null)return null;const o=e[n==="image"?"imageUrl":n==="video"?"videoUrl":"audioUrl"];if(typeof o!="object"||o===null)return null;const i=o.url;return typeof i=="string"?{kind:n,url:i}:null}function nue(e,t){if(!zce.test(e))return;const n=eue(t);if(n===null)return;let s,o,i,r,l,a=null;for(const u of n){if(typeof u!="object"||u===null)continue;const d=u;if(d.type==="text"&&typeof d.text=="string"){const h=d.text,f=qce.exec(h);f&&(o=f[1],s=f[2]);const m=Vce.exec(h);m?.[1]&&(i=m[1]);const b=Kce.exec(h);b?.[1]&&(r=Number(b[1]));const _=Gce.exec(h);_?.[1]&&_[2]&&(l=`${_[1]}x${_[2]}`);continue}const p=tue(d);p&&(a=p)}if(a===null)return;const c=Uce.exec(a.url);return c?.[1]&&(i=c[1]),c?.[2]&&(r=Jce(c[2])),{kind:a.kind??o??"image",url:a.url,path:s,mimeType:i,bytes:Number.isFinite(r)?r:void 0,dimensions:l}}function sue(e){if(e!=null){if(typeof e=="string")return e.split(`
|
|
259
|
+
`,-1))])])])):ie("",!0)])):ie("",!0)],2))),128))])]))}}),GS=ut(AJ,[["__scopeId","data-v-8872e24d"]]),TJ={class:"todo-card"},MJ={key:0,class:"tc-empty"},EJ={class:"tc-name"},IJ=je({__name:"TodoCard",props:{todos:{}},setup(e){const t=e,{t:n}=It();function s(o){return o==="in_progress"?"run":o}return(o,i)=>(w(),N("div",TJ,[t.todos.length===0?(w(),N("div",MJ,[i[0]||(i[0]=T("svg",{class:"tc-empty-ico",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[T("path",{d:"M9 11l2 2 4-4"}),T("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"})],-1)),T("span",null,R(x(n)("tasks.emptyTodo")),1)])):ie("",!0),(w(!0),N(Le,null,nt(t.todos,(r,l)=>(w(),N("div",{key:l,class:Re(["tc-row",`s-${r.status}`])},[oe(T3,{status:s(r.status)},null,8,["status"]),T("span",EJ,R(r.title),1)],2))),128))]))}}),$J=ut(IJ,[["__scopeId","data-v-19b55e45"]]),NJ=["disabled","aria-pressed"],LJ=je({__name:"Pill",props:{clickable:{type:Boolean,default:!0},active:{type:Boolean},disabled:{type:Boolean},ariaPressed:{type:Boolean}},emits:["click"],setup(e){return(t,n)=>e.clickable?(w(),N("button",{key:0,class:Re(["ui-pill",{"is-active":e.active}]),type:"button",disabled:e.disabled,"aria-pressed":e.ariaPressed,onClick:n[0]||(n[0]=s=>t.$emit("click",s))},[Cn(t.$slots,"default",{},void 0,!0)],10,NJ)):(w(),N("span",{key:1,class:Re(["ui-pill",{"is-active":e.active}])},[Cn(t.$slots,"default",{},void 0,!0)],2))}}),cv=ut(LJ,[["__scopeId","data-v-af95f94d"]]),OJ={class:"dock-work-head"},PJ={key:0,class:"dock-work-tab static"},RJ={key:1,class:"dock-work-tab static"},DJ={key:2,class:"dock-work-tab static"},BJ={class:"dock-work-body"},FJ={class:"dw-count"},HJ={class:"dw-count"},WJ={class:"dw-count"},zJ=je({__name:"ChatDock",props:{sessionId:{},running:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},activationBadges:{},models:{},starredIds:{},skills:{},goal:{},goalExpandSignal:{},dockPanel:{},bashTasks:{},subagentTasks:{},bashRunning:{},subagentRunning:{},todoDoneCount:{},hasDockWork:{type:Boolean},todos:{},pendingQuestion:{},questionBusyKind:{},pendingApproval:{},approvalBusy:{type:Boolean},mobile:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel","answer","dismiss","approval","cancelTask","toggle-dock-panel","close-dock-panel","openAgent"],setup(e,{expose:t,emit:n}){const s=e,o=n,{t:i}=It(),r=Z(null),l=Z(null),a=Z(null);function c(p){r.value?.loadForEdit(p)}function u(){r.value?.focus()}function d(p){if(!s.dockPanel)return;const h=p.target;h&&(l.value?.contains(h)||a.value?.contains(h)||o("close-dock-panel"))}return Ke(()=>s.dockPanel,p=>{typeof document>"u"||(document.removeEventListener("mousedown",d,!0),p&&document.addEventListener("mousedown",d,!0))},{immediate:!0}),kn(()=>{typeof document<"u"&&document.removeEventListener("mousedown",d,!0)}),t({loadForEdit:c,focus:u}),(p,h)=>(w(),N("div",{class:Re(["chat-dock",[e.mobile?"align-mobile":"align-center"]]),onClick:h[28]||(h[28]=vt(()=>{},["stop"]))},[oe(Gr,{name:"dock-panel"},{default:_e(()=>[e.dockPanel?(w(),N("div",{key:0,ref_key:"workPanelRef",ref:l,class:"dock-work-panel",onClick:h[3]||(h[3]=vt(()=>{},["stop"]))},[T("div",OJ,[e.dockPanel==="bash"?(w(),N("span",PJ,R(x(i)("tasks.dockBash"))+" · "+R(e.bashRunning)+" "+R(x(i)("tasks.running")),1)):e.dockPanel==="subagent"?(w(),N("span",RJ,R(x(i)("tasks.dockSubagent"))+" · "+R(e.subagentRunning)+" "+R(x(i)("tasks.running")),1)):e.dockPanel==="todos"?(w(),N("span",DJ,R(x(i)("tasks.dockTodos"))+" · "+R(e.todoDoneCount)+"/"+R(e.todos?.length??0),1)):ie("",!0)]),T("div",BJ,[e.dockPanel==="bash"?(w(),ve(GS,{key:0,tasks:e.bashTasks,onCancel:h[0]||(h[0]=f=>o("cancelTask",f))},null,8,["tasks"])):e.dockPanel==="subagent"?(w(),ve(GS,{key:1,tasks:e.subagentTasks,onCancel:h[1]||(h[1]=f=>o("cancelTask",f)),onOpen:h[2]||(h[2]=f=>o("openAgent",f))},null,8,["tasks"])):e.dockPanel==="todos"?(w(),ve($J,{key:2,todos:e.todos??[]},null,8,["todos"])):ie("",!0)])],512)):ie("",!0)]),_:1}),e.goal?(w(),ve(HQ,{key:0,goal:e.goal,"force-expanded":e.goalExpandSignal,onControlGoal:h[4]||(h[4]=f=>o("controlGoal",f))},null,8,["goal","force-expanded"])):ie("",!0),e.hasDockWork?(w(),N("div",{key:1,ref_key:"workbarRef",ref:a,class:"dock-workbar"},[e.bashTasks.length>0?(w(),ve(cv,{key:0,active:e.dockPanel==="bash","aria-pressed":e.dockPanel==="bash",onClick:h[5]||(h[5]=f=>o("toggle-dock-panel","bash"))},{default:_e(()=>[oe(Je,{name:"clock",size:"md"}),T("span",null,R(x(i)("tasks.dockBash")),1),T("span",FJ,[h[29]||(h[29]=qe("(",-1)),T("b",null,R(e.bashTasks.length),1),h[30]||(h[30]=qe(")",-1))])]),_:1},8,["active","aria-pressed"])):ie("",!0),e.subagentTasks.length>0?(w(),ve(cv,{key:1,active:e.dockPanel==="subagent","aria-pressed":e.dockPanel==="subagent",onClick:h[6]||(h[6]=f=>o("toggle-dock-panel","subagent"))},{default:_e(()=>[oe(Je,{name:"sparkles",size:"md"}),T("span",null,R(x(i)("tasks.dockSubagent")),1),T("span",HJ,[h[31]||(h[31]=qe("(",-1)),T("b",null,R(e.subagentTasks.length),1),h[32]||(h[32]=qe(")",-1))])]),_:1},8,["active","aria-pressed"])):ie("",!0),(e.todos?.length??0)>0?(w(),ve(cv,{key:2,active:e.dockPanel==="todos","aria-pressed":e.dockPanel==="todos",onClick:h[7]||(h[7]=f=>o("toggle-dock-panel","todos"))},{default:_e(()=>[oe(Je,{name:"check-list",size:"md"}),T("span",null,R(x(i)("tasks.dockTodos")),1),T("span",WJ,[h[33]||(h[33]=qe("(",-1)),T("b",null,R(e.todoDoneCount)+"/"+R(e.todos?.length??0),1),h[34]||(h[34]=qe(")",-1))])]),_:1},8,["active","aria-pressed"])):ie("",!0)],512)):ie("",!0),e.pendingQuestion?(w(),ve(pZ,{key:e.pendingQuestion.questionId,question:e.pendingQuestion,"busy-kind":e.questionBusyKind,onAnswer:h[8]||(h[8]=(f,m)=>o("answer",f,m)),onDismiss:h[9]||(h[9]=f=>o("dismiss",f))},null,8,["question","busy-kind"])):e.pendingApproval?(w(),ve(rJ,{key:e.pendingApproval.approvalId,class:"dock-approval",block:e.pendingApproval.block,"agent-name":e.pendingApproval.agentName,busy:e.approvalBusy,onDecide:h[10]||(h[10]=f=>o("approval",e.pendingApproval.approvalId,f))},null,8,["block","agent-name","busy"])):(w(),ve(A3,{key:4,ref_key:"composerRef",ref:r,"session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,onSubmit:h[11]||(h[11]=f=>o("submit",f)),onSteer:h[12]||(h[12]=f=>o("steer",f)),onCommand:h[13]||(h[13]=f=>o("command",f)),onInterrupt:h[14]||(h[14]=f=>o("interrupt")),onSetPermission:h[15]||(h[15]=f=>o("setPermission",f)),onSetThinking:h[16]||(h[16]=f=>o("setThinking",f)),onTogglePlan:h[17]||(h[17]=f=>o("togglePlan")),onToggleSwarm:h[18]||(h[18]=f=>o("toggleSwarm")),onToggleGoal:h[19]||(h[19]=f=>o("toggleGoal")),onOpenBtw:h[20]||(h[20]=f=>o("openBtw")),onCreateGoal:h[21]||(h[21]=f=>o("createGoal",f)),onControlGoal:h[22]||(h[22]=f=>o("controlGoal",f)),onFocusGoal:h[23]||(h[23]=f=>o("focusGoal")),onFocusSwarm:h[24]||(h[24]=f=>o("focusSwarm")),onCompact:h[25]||(h[25]=f=>o("compact")),onPickModel:h[26]||(h[26]=f=>o("pickModel")),onSelectModel:h[27]||(h[27]=f=>o("selectModel",f))},null,8,["session-id","running","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","activation-badges","models","starred-ids","skills"]))],2))}}),UJ=ut(zJ,[["__scopeId","data-v-e653e43b"]]),qJ=["aria-label","aria-hidden"],jJ={class:"toc-scroll"},VJ=["onClick"],KJ={class:"toc-label"},GJ=240,YJ=je({__name:"ConversationToc",props:{items:{},activeTurnId:{},mobile:{type:Boolean},sessionLoading:{type:Boolean}},emits:["select"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Z(null),r=Z(!0);let l=null;function a(){const u=i.value,d=u?.offsetParent;if(!u||!d)return;const p=u.getBoundingClientRect().left,h=d.getBoundingClientRect().right;r.value=h-p>=GJ}const c=F(()=>!n.mobile&&!n.sessionLoading&&n.items.length>1);return Ke(c,u=>{l?.disconnect(),l=null,u&&ht(()=>{const d=i.value,p=d?.offsetParent;!d||!p||(typeof ResizeObserver<"u"&&(l=new ResizeObserver(a),l.observe(p)),a())})},{immediate:!0}),ls(()=>{l?.disconnect(),l=null}),(u,d)=>c.value?(w(),N("nav",{key:0,ref_key:"navRef",ref:i,class:Re(["conversation-toc",{"toc-clipped":!r.value}]),"aria-label":x(o)("conversation.toc"),"aria-hidden":r.value?void 0:!0},[T("div",jJ,[(w(!0),N(Le,null,nt(e.items,p=>(w(),N("button",{key:p.id,type:"button",class:Re(["toc-row",{active:e.activeTurnId===p.id}]),onClick:h=>s("select",p.id)},[d[0]||(d[0]=T("span",{class:"toc-bar"},null,-1)),T("span",KJ,R(p.title),1)],10,VJ))),128))])],10,qJ)):ie("",!0)}}),XJ=ut(YJ,[["__scopeId","data-v-721a06f8"]]),QJ=5;function ZJ(e,t,n,s=QJ){if(n||e.length<=s)return e;const o=e.slice(0,s);if(t&&!o.some(i=>i.id===t)){const i=e.find(r=>r.id===t);i&&(o[s-1]=i)}return o}const JJ={class:"chat-layout"},eee={class:"empty-hint"},tee={class:"empty-hint-title"},nee={class:"empty-hint-text"},see={key:0,class:"ws-pick"},oee={class:"ws-pick-name"},iee={key:1,class:"ws-pick-menu"},ree=["onClick"],lee={class:"ws-pick-item-name"},aee={class:"ws-pick-item-path"},cee={key:0,class:"swarm-stack"},uee=["aria-label"],dee={key:0,class:"abort-toast",role:"status","aria-live":"polite"},fee={class:"abort-toast-text"},uv=80,YS=1e3,pee=420,hee=3e3,mee=je({__name:"ConversationPane",props:{turns:{},sessionId:{},approvals:{},gitInfo:{},tasks:{},todos:{},goal:{},swarms:{},activationBadges:{},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},questions:{},pendingQuestionActions:{},pendingApprovalActions:{},running:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},changes:{},fileReloadKey:{},sending:{type:Boolean},fastMoon:{type:Boolean},mobile:{type:Boolean},sessionLoading:{type:Boolean},compaction:{},hasMoreMessages:{type:Boolean},loadingMore:{type:Boolean},loadingMoreError:{type:Boolean},loadOlderMessages:{type:Function},models:{},starredIds:{},skills:{},workspaceName:{},workspaceRoot:{},gitDiffStats:{},workspaces:{},activeWorkspaceId:{},sessionTitle:{},pr:{},conversationToc:{type:Boolean}},emits:["submit","steer","approval","cancelTask","answer","dismiss","command","interrupt","unqueue","editQueued","reorderQueue","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","createGoal","controlGoal","compact","pickModel","selectModel","openFile","openMedia","openThinking","openCompaction","openAgent","openToolDiff","openChanges","refreshGitStatus","editMessage","selectWorkspace","addWorkspace","openPr","renameSession","forkSession","archiveSession"],setup(e,{expose:t,emit:n}){const s=e,o=n,i=Z(!1),r=Z(!1),l=F(()=>s.workspaces?.find(pe=>pe.id===s.activeWorkspaceId)?.name??s.workspaceName??""),a=F(()=>(s.workspaces?.length??0)>0),c=F(()=>ZJ(s.workspaces??[],s.activeWorkspaceId,r.value)),u=F(()=>(s.workspaces?.length??0)-c.value.length);Ke(i,de=>{de||(r.value=!1)});const d=F(()=>s.swarms?.filter(de=>de.members.some(pe=>pe.phase!=="completed"&&pe.phase!=="failed"))??[]);function p(de){i.value=!1,de!==s.activeWorkspaceId&&o("selectWorkspace",de)}const{t:h}=It();cc(Et.contentAlign);const f=Z(null),m=Z(null),b=Z(null),_=Z(!1),g=Z(0);let v=null;function y(de){(b.value??m.value)?.loadForEdit(de)}function A(){_.value=!0,v!==null&&clearTimeout(v),v=setTimeout(()=>{v=null,_.value=!1},2e3)}function O(){g.value++}function $(){ht(()=>{Fe.value?.querySelector(".swarm-card")?.scrollIntoView({behavior:"smooth",block:"center"})})}const k=F(()=>s.tasks.filter(de=>de.kind!=="subagent")),E=F(()=>s.tasks.filter(de=>de.kind==="subagent"&&de.runInBackground)),M=F(()=>k.value.filter(de=>de.state==="run").length),L=F(()=>E.value.filter(de=>de.state==="run").length);function S(de){const pe=s.tasks,Oe=pe.find(Wt=>Wt.id===de)??pe.find(Wt=>Wt.parentToolCallId===de);if(Oe)return Oe.id;const Qt=pe.filter(Wt=>Wt.kind==="subagent"&&!Wt.parentToolCallId);if(Qt.length===1)return Qt[0].id}En("resolveAgentTaskId",S);const I=F(()=>(s.todos??[]).filter(de=>de.status==="done").length),P=F(()=>k.value.length>0||E.value.length>0||(s.todos?.length??0)>0||(s.queued?.length??0)>0),D=Z(null),W=F(()=>s.gitInfo?s.changes?.length??0:0);function z(de){D.value=D.value===de?null:de}function q(){D.value=null}Ke(P,de=>{de||q()});function Q(de){if(de.role==="compaction")return h("conversation.compactedPlain");if(de.role==="user"){if(de.skillActivation)return`/${de.skillActivation.name}`;if(de.pluginCommand)return`/${de.pluginCommand.pluginId}:${de.pluginCommand.commandName}`;const Oe=de.text.trim().replaceAll(/\s+/g," ");return Oe.length>0?Oe:"user"}const pe=(de.text||de.thinking||"").trim().replaceAll(/\s+/g," ");return pe.length>0?pe:(de.tools?.length??0)>0?`${de.tools.length} tools`:"blun"}const X=F(()=>s.turns.filter(de=>de.role==="user").map((de,pe)=>({id:de.id,role:de.role,no:pe+1,title:Q(de)}))),fe=Z(null);function ye(){const de=Fe.value;if(!de)return;const pe=de.querySelectorAll(".turn-anchor[data-turn-id]");if(pe.length===0)return;const Oe=X.value;if(Oe.length===0)return;const Qt=new Set(Oe.map(bo=>bo.id));if(j()<=uv){fe.value=Oe[Oe.length-1].id;return}const Wt=de.getBoundingClientRect(),ds=Wt.height/2;let Bn=null;pe.forEach(bo=>{const ii=bo.dataset.turnId;if(!ii||!Qt.has(ii))return;bo.getBoundingClientRect().top-Wt.top<=ds&&(Bn=ii)}),fe.value=Bn??Oe[0].id}const Me=F(()=>s.questions&&s.questions.length>0?s.questions[0]:void 0),we=F(()=>{const de=Me.value;if(de)return s.pendingQuestionActions?.[de.questionId]}),ze=F(()=>s.approvals&&s.approvals.length>0?s.approvals[0]:void 0),Ue=F(()=>{const de=ze.value;return de?!!s.pendingApprovalActions?.[de.approvalId]:!1}),Fe=Z(null),rt=Z(null),le=Z(0),U=Z(0),G=F(()=>({"--panes-scrollbar-width":`${le.value}px`}));function ne(de){return de instanceof HTMLElement?de:de&&"$el"in de&&de.$el instanceof HTMLElement?de.$el:null}function H(){const de=Fe.value;le.value=de?Math.max(0,de.offsetWidth-de.clientWidth):0,U.value=rt.value?.offsetHeight??0}function J(de){const pe=ne(de);Fe.value=pe,pe&&oi()}function ce(de){const pe=ne(de);rt.value=pe??null,de&&"loadForEdit"in de&&typeof de.loadForEdit=="function"&&"focus"in de&&typeof de.focus=="function"?b.value={loadForEdit:de.loadForEdit.bind(de),focus:de.focus.bind(de)}:b.value=null,Xt()}const te=Z(!0),ue=Z(!1);function j(){const de=Fe.value;return de?de.scrollHeight-de.scrollTop-de.clientHeight:0}let Y=0,re=0,ge=0,Ae=0,Ie=0,ae=0;function Te(){return Date.now()<re}function Ve(){const de=Fe.value;if(!de)return;const pe=de.scrollTop;if(performance.now()-ge<100){Y=pe;return}const Oe=j();if(Te()){te.value=!0,ue.value=!1,Y=pe;return}pe<Y-1&&Oe>1?te.value=!1:Oe<=uv&&pe>Y+1&&(te.value=!0,ue.value=!1),Y=pe,ye()}function tt(de=!1){const pe=Fe.value;te.value=!0,ue.value=!1,pe&&(!de&&performance.now()<Ae||(de&&typeof pe.scrollTo=="function"?(ge=performance.now(),Ae=performance.now()+pee,pe.scrollTo({top:pe.scrollHeight,behavior:"smooth"})):pe.scrollTop=pe.scrollHeight,Y=pe.scrollTop))}function bt(de,pe){const Oe=de.querySelectorAll(".turn-anchor");for(const Qt of Oe)if(Qt.offsetTop>=pe){const Wt=Qt.dataset.turnId;if(Wt)return{id:Wt,top:Qt.offsetTop}}return null}async function kt(){if(!s.sessionId||!s.loadOlderMessages||s.loadingMore||!s.hasMoreMessages)return;const de=s.sessionId,pe=Fe.value,Oe=pe?.scrollTop??0,Qt=pe?.scrollHeight??0,Wt=pe?bt(pe,Oe):null;Zn.value=!0;try{await s.loadOlderMessages(de),await ht()}finally{Zn.value=!1}if(s.sessionId!==de)return;const ds=Fe.value;if(!ds)return;let Bn=0;if(Wt){const bo=ds.querySelector(`.turn-anchor[data-turn-id="${Tt(Wt.id)}"]`);bo&&(Bn=bo.offsetTop-Wt.top)}Bn===0&&(Bn=ds.scrollHeight-Qt),ds.scrollTop=Oe+Bn}function Tt(de){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(de):de.replaceAll(/["\\]/g,"\\$&")}function Pt(de){const pe=Fe.value;if(!pe)return;const Oe=pe.querySelector(`.turn-anchor[data-turn-id="${Tt(de)}"]`);Oe&&(te.value=!1,ue.value=j()>uv,Oe.scrollIntoView({behavior:"smooth",block:"center"}))}function mt(){const de=Fe.value;if(!de)return"none";const pe=de.firstElementChild,Oe=pe instanceof HTMLElement?pe.offsetHeight:0,Qt=rt.value?.offsetHeight??0;return`${de.scrollHeight}:${de.clientHeight}:${Oe}:${Qt}`}function Yt(de){return typeof requestAnimationFrame=="function"?requestAnimationFrame(de):setTimeout(de,16)}function Rn(de){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(de):clearTimeout(de)}function Dn(de=36){if(!te.value&&!Te())return;const pe=++ae;let Oe="",Qt=0,Wt=0;Ie&&(Rn(Ie),Ie=0);const ds=()=>{if(Ie=0,pe!==ae||!te.value&&!Te())return;tt(!1);const Bn=mt();Qt=Bn===Oe?Qt+1:0,Oe=Bn,Wt++,Qt<3&&Wt<de&&(Ie=Yt(ds))};Ie=Yt(ds)}function Ft(de,pe){return de!==void 0&&de.length>0&&pe.length>=de.length&&de.firstId!==pe.firstId&&de.lastId===pe.lastId&&de.lastTextLen===pe.lastTextLen&&de.lastThinkingLen===pe.lastThinkingLen&&de.lastToolsLen===pe.lastToolsLen&&de.approvalIds===pe.approvalIds}const bn=F(()=>{const de=(s.approvals??[]).map(ds=>ds.approvalId).join(","),pe=s.turns,Oe=pe.at(-1),Qt=Oe?.thinking?.length??0,Wt=Oe?.tools?.reduce((ds,Bn)=>ds+Bn.name.length+(Bn.arg?.length??0)+(Bn.output?.join("").length??0),0)??0;return{length:pe.length,firstId:pe[0]?.id??"",lastId:Oe?.id??"",lastTextLen:Oe?.text.length??0,lastThinkingLen:Qt,lastToolsLen:Wt,approvalIds:de}});Ke(bn,async(de,pe)=>{if(Zn.value&&Ft(pe,de)){ye();return}await ht(),te.value||Te()?tt(de.length<pe.length):ue.value=!0,ye()}),Ke(rt,()=>{Xt()}),Ke(()=>s.mobile,async()=>{await ht(),H()});const Vn=new Map;Ke(()=>s.fileReloadKey,async(de,pe)=>{const Oe=Fe.value;pe&&Oe&&Vn.set(String(pe),{top:Oe.scrollTop,following:te.value}),await ht();const Qt=Fe.value,Wt=de?Vn.get(String(de)):void 0;Wt&&Qt?(te.value=Wt.following,Qt.scrollTop=Wt.top,Y=Wt.top,Wt.following&&Dn()):(te.value=!0,Y=0,tt(!1),Dn()),ye()}),Ke(()=>s.sessionLoading,async(de,pe)=>{de||!pe||(te.value=!0,await ht(),Dn(),ye())}),Ke(()=>s.running,async(de,pe)=>{de||!pe||!te.value&&!Te()||(await ht(),Dn(48),ye())});function st(){te.value=!0,ue.value=!1,re=Date.now()+YS,ht(()=>{tt(!0),Dn(16)})}function In(de){st(),o("submit",de)}function _n(de){te.value=!0,ue.value=!1,re=Date.now()+YS,o("editMessage",de)}function Kn(de){const pe=s.queued?.[de]?.text??"";pe&&y(pe),o("editQueued",de)}function $n(de){o("reorderQueue",de)}function Ge(de,pe){st(),o("answer",de,pe)}function Ye(de,pe){!de||!pe||o("approval",de,pe)}let Ct=null,$t=null,mn=null,Nn=null,tn=0,Ln=!1;const Zn=Z(!1);function Mt(de){if(Zn.value||(Ln=Ln||de,tn))return;tn=(typeof requestAnimationFrame=="function"?requestAnimationFrame:Oe=>setTimeout(Oe,16))(()=>{tn=0;const Oe=Ln;Ln=!1,te.value||Te()?tt(!1):Oe&&(ue.value=!0)})}function us(){if(!$t)return;const de=Fe.value?.firstElementChild??null;de!==mn&&(mn&&$t.unobserve(mn),mn=de,de&&$t.observe(de))}function Xt(){if(!$t)return;const de=rt.value;de!==Nn&&(Nn&&$t.unobserve(Nn),Nn=de,de&&$t.observe(de))}function oi(){const de=Fe.value;H(),Ct&&(Ct.disconnect(),de&&Ct.observe(de,{childList:!0,subtree:!0,characterData:!0})),$t&&($t.disconnect(),mn=null,Nn=null,de&&$t.observe(de),us(),Xt())}function bs(){us(),Mt(!0)}function Do(){typeof document>"u"||document.visibilityState==="visible"&&te.value&&Dn()}const so=Z(!1);let qs=null;function oo(){so.value=!0,qs!==null&&clearTimeout(qs),qs=setTimeout(()=>{so.value=!1},hee)}function Nt(){oo(),o("interrupt")}function Xe(de){de.key==="Escape"&&(s.running||s.sending)&&(de.preventDefault(),Nt())}hn(()=>{ht(()=>{typeof MutationObserver=="function"&&(Ct=new MutationObserver(bs)),typeof ResizeObserver=="function"&&($t=new ResizeObserver(()=>{H(),Mt(!1)})),oi(),Dn(48),ye(),typeof document<"u"&&(document.addEventListener("visibilitychange",Do),document.addEventListener("keydown",Xe))})}),kn(()=>{Ct&&Ct.disconnect(),$t&&$t.disconnect(),tn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(tn),Ie&&Rn(Ie),qs!==null&&clearTimeout(qs),v!==null&&(clearTimeout(v),v=null),typeof document<"u"&&(document.removeEventListener("visibilitychange",Do),document.removeEventListener("keydown",Xe))});function ot(){(b.value??m.value)?.focus()}return t({loadComposerForEdit:y,focusComposer:ot}),(de,pe)=>(w(),N("section",{class:Re(["con",{mobile:e.mobile}])},[!e.mobile&&!(e.turns.length===0&&!e.sessionLoading)?(w(),ve(FY,{key:0,"session-id":e.sessionId,"workspace-name":e.workspaceName,"workspace-root":e.workspaceRoot,"session-title":e.sessionTitle,branch:e.gitInfo?.branch,ahead:e.gitInfo?.ahead,behind:e.gitInfo?.behind,"changes-count":W.value,"git-diff-stats":e.gitDiffStats,"is-git-repo":!!e.gitInfo,pr:e.pr,copied:_.value,onOpenChanges:pe[0]||(pe[0]=Oe=>o("openChanges")),onCopyAll:pe[1]||(pe[1]=Oe=>f.value?.copyConversation()),onCopyFinalSummary:pe[2]||(pe[2]=Oe=>f.value?.copyFinalSummary()),onOpenPr:pe[3]||(pe[3]=Oe=>e.pr&&o("openPr",e.pr.url)),onRenameSession:pe[4]||(pe[4]=(Oe,Qt)=>o("renameSession",Oe,Qt)),onForkSession:pe[5]||(pe[5]=Oe=>o("forkSession",Oe)),onArchiveSession:pe[6]||(pe[6]=Oe=>o("archiveSession",Oe))},null,8,["session-id","workspace-name","workspace-root","session-title","branch","ahead","behind","changes-count","git-diff-stats","is-git-repo","pr","copied"])):ie("",!0),e.conversationToc?(w(),ve(XJ,{key:1,items:X.value,"active-turn-id":fe.value,mobile:e.mobile,"session-loading":e.sessionLoading,onSelect:Pt},null,8,["items","active-turn-id","mobile","session-loading"])):ie("",!0),T("div",JJ,[T("div",{ref:J,class:"panes chat-scroll",onScrollPassive:Ve},[T("div",{class:Re(["content-wrap",[e.mobile?"align-mobile":"align-center"]])},[e.turns.length===0&&!e.sessionLoading?(w(),N(Le,{key:0},[pe[54]||(pe[54]=T("div",{class:"empty-spacer"},null,-1)),T("div",eee,[T("span",tee,R(x(h)("composer.emptyConversationTitle")),1),T("span",nee,R(x(h)("composer.emptyConversation")),1),a.value?(w(),N("div",see,[oe(Ht,{text:x(h)("conversation.switchWorkspace")},{default:_e(()=>[T("button",{type:"button",class:"ws-pick-btn",onClick:pe[7]||(pe[7]=vt(Oe=>i.value=!i.value,["stop"]))},[oe(Je,{name:"folder",size:"sm"}),T("span",oee,R(l.value),1),oe(Je,{class:Re(["ws-pick-chev",{open:i.value}]),name:"chevron-down",size:"sm"},null,8,["class"])])]),_:1},8,["text"]),i.value?(w(),N("div",{key:0,class:"ws-pick-backdrop",onClick:pe[8]||(pe[8]=Oe=>i.value=!1)})):ie("",!0),i.value?(w(),N("div",iee,[(w(!0),N(Le,null,nt(c.value,Oe=>(w(),N("button",{key:Oe.id,type:"button",class:Re(["ws-pick-item",{on:Oe.id===e.activeWorkspaceId}]),onClick:vt(Qt=>p(Oe.id),["stop"])},[T("span",lee,R(Oe.name),1),T("span",aee,R(Oe.shortPath),1)],10,ree))),128)),u.value>0?(w(),N("button",{key:0,type:"button",class:"ws-pick-item ws-pick-more",onClick:pe[9]||(pe[9]=vt(Oe=>r.value=!r.value,["stop"]))},[T("span",null,R(x(h)("conversation.moreWorkspaces",{count:u.value})),1)])):ie("",!0),pe[53]||(pe[53]=T("div",{class:"ws-pick-divider"},null,-1)),T("button",{type:"button",class:"ws-pick-action",onClick:pe[10]||(pe[10]=vt(Oe=>{i.value=!1,o("addWorkspace")},["stop"]))},[oe(Je,{name:"plus",size:"sm"}),T("span",null,R(x(h)("conversation.addWorkspace")),1)])])):ie("",!0)])):(w(),N("button",{key:1,type:"button",class:"empty-add-workspace",onClick:pe[11]||(pe[11]=Oe=>o("addWorkspace"))},[oe(Je,{name:"folder-plus",size:"sm"}),T("span",null,R(x(h)("conversation.addWorkspace")),1)]))]),oe(A3,{ref_key:"emptyComposerRef",ref:m,class:"empty-composer","session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,"hide-context":"",onSubmit:In,onSteer:pe[12]||(pe[12]=Oe=>o("steer",Oe)),onCommand:pe[13]||(pe[13]=Oe=>o("command",Oe)),onInterrupt:Nt,onUnqueue:pe[14]||(pe[14]=Oe=>o("unqueue",Oe)),onEditQueued:pe[15]||(pe[15]=Oe=>o("editQueued",Oe)),onSetPermission:pe[16]||(pe[16]=Oe=>o("setPermission",Oe)),onSetThinking:pe[17]||(pe[17]=Oe=>o("setThinking",Oe)),onTogglePlan:pe[18]||(pe[18]=Oe=>o("togglePlan")),onToggleSwarm:pe[19]||(pe[19]=Oe=>o("toggleSwarm")),onToggleGoal:pe[20]||(pe[20]=Oe=>o("toggleGoal")),onOpenBtw:pe[21]||(pe[21]=Oe=>o("command","/btw")),onCreateGoal:pe[22]||(pe[22]=Oe=>o("createGoal",Oe)),onControlGoal:pe[23]||(pe[23]=Oe=>o("controlGoal",Oe)),onFocusGoal:O,onFocusSwarm:$,onCompact:pe[24]||(pe[24]=Oe=>o("compact")),onPickModel:pe[25]||(pe[25]=Oe=>o("pickModel")),onSelectModel:pe[26]||(pe[26]=Oe=>o("selectModel",Oe))},null,8,["session-id","running","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","activation-badges","models","starred-ids","skills"]),pe[55]||(pe[55]=T("div",{class:"empty-spacer"},null,-1))],64)):(w(),N(Le,{key:1},[(w(),ve(S3,{ref_key:"chatPaneRef",ref:f,key:e.fileReloadKey??"no-session",turns:e.turns,approvals:e.approvals,running:e.running,sending:e.sending,"fast-moon":e.fastMoon,"session-loading":e.sessionLoading,compaction:e.compaction,"has-more-messages":e.hasMoreMessages,"loading-more":e.loadingMore,"loading-more-error":e.loadingMoreError,"is-following":te.value,"tool-diff-panel":!0,queued:e.queued,onOpenFile:pe[27]||(pe[27]=Oe=>o("openFile",Oe)),onOpenMedia:pe[28]||(pe[28]=Oe=>o("openMedia",Oe)),onCopyConversationCopied:A,onOpenThinking:pe[29]||(pe[29]=Oe=>o("openThinking",Oe)),onOpenCompaction:pe[30]||(pe[30]=Oe=>o("openCompaction",Oe)),onOpenAgent:pe[31]||(pe[31]=Oe=>o("openAgent",Oe)),onOpenToolDiff:pe[32]||(pe[32]=Oe=>o("openToolDiff",Oe)),onEditMessage:_n,onLoadOlderMessages:kt,onUnqueue:pe[33]||(pe[33]=Oe=>o("unqueue",Oe)),onEditQueued:Kn,onReorderQueue:$n},null,8,["turns","approvals","running","sending","fast-moon","session-loading","compaction","has-more-messages","loading-more","loading-more-error","is-following","queued"])),d.value.length>0?(w(),N("div",cee,[(w(!0),N(Le,null,nt(d.value,Oe=>(w(),ve(AQ,{key:Oe.id,group:Oe},null,8,["group"]))),128))])):ie("",!0)],64))],2)],32),e.turns.length===0&&!e.sessionLoading?ie("",!0):(w(),ve(UJ,{key:0,ref:ce,style:Gt(G.value),"session-id":e.sessionId,running:e.running,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,"activation-badges":e.activationBadges,models:e.models,"starred-ids":e.starredIds,skills:e.skills,goal:e.goal,"goal-expand-signal":g.value,"dock-panel":D.value,"bash-tasks":k.value,"subagent-tasks":E.value,"bash-running":M.value,"subagent-running":L.value,"todo-done-count":I.value,"has-dock-work":P.value,todos:e.todos,"pending-question":Me.value,"question-busy-kind":we.value,"pending-approval":ze.value,"approval-busy":Ue.value,mobile:e.mobile,onToggleDockPanel:pe[34]||(pe[34]=Oe=>z(Oe)),onCloseDockPanel:pe[35]||(pe[35]=Oe=>q()),onOpenAgent:pe[36]||(pe[36]=Oe=>o("openAgent",Oe)),onAnswer:Ge,onDismiss:pe[37]||(pe[37]=Oe=>o("dismiss",Oe)),onApproval:Ye,onCancelTask:pe[38]||(pe[38]=Oe=>o("cancelTask",Oe)),onControlGoal:pe[39]||(pe[39]=Oe=>o("controlGoal",Oe)),onSubmit:In,onSteer:pe[40]||(pe[40]=Oe=>o("steer",Oe)),onCommand:pe[41]||(pe[41]=Oe=>o("command",Oe)),onInterrupt:Nt,onSetPermission:pe[42]||(pe[42]=Oe=>o("setPermission",Oe)),onSetThinking:pe[43]||(pe[43]=Oe=>o("setThinking",Oe)),onTogglePlan:pe[44]||(pe[44]=Oe=>o("togglePlan")),onToggleSwarm:pe[45]||(pe[45]=Oe=>o("toggleSwarm")),onToggleGoal:pe[46]||(pe[46]=Oe=>o("toggleGoal")),onOpenBtw:pe[47]||(pe[47]=Oe=>o("command","/btw")),onCreateGoal:pe[48]||(pe[48]=Oe=>o("createGoal",Oe)),onFocusGoal:O,onFocusSwarm:$,onCompact:pe[49]||(pe[49]=Oe=>o("compact")),onPickModel:pe[50]||(pe[50]=Oe=>o("pickModel")),onSelectModel:pe[51]||(pe[51]=Oe=>o("selectModel",Oe))},null,8,["style","session-id","running","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","activation-badges","models","starred-ids","skills","goal","goal-expand-signal","dock-panel","bash-tasks","subagent-tasks","bash-running","subagent-running","todo-done-count","has-dock-work","todos","pending-question","question-busy-kind","pending-approval","approval-busy","mobile"]))]),oe(Gr,{name:"pill"},{default:_e(()=>[ue.value?(w(),N("button",{key:0,class:"newmsg-pill",style:Gt({bottom:`${U.value+12}px`}),"aria-label":x(h)("conversation.jumpToLatestAria"),onClick:pe[52]||(pe[52]=Oe=>tt(!0))},[oe(Je,{class:"pill-chevron",name:"chevron-down",size:"md"}),qe(" "+R(x(h)("conversation.newMessages")),1)],12,uee)):ie("",!0)]),_:1}),oe(Gr,{name:"abort-toast"},{default:_e(()=>[so.value?(w(),N("div",dee,[T("span",fee,R(x(h)("conversation.manuallyAborted")),1)])):ie("",!0)]),_:1})],2))}}),gee=ut(mee,[["__scopeId","data-v-fd8a6a5a"]]),vee=["aria-selected","onClick"],yee=je({__name:"SegmentedControl",props:{modelValue:{},options:{},size:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,o)=>(w(),N("div",{class:Re(["ui-seg",`ui-seg--${e.size??"md"}`]),role:"tablist"},[(w(!0),N(Le,null,nt(e.options,i=>(w(),N("button",{key:i.value,class:Re(["ui-seg__item",{"is-on":i.value===e.modelValue}]),type:"button",role:"tab","aria-selected":i.value===e.modelValue,onClick:r=>n("update:modelValue",i.value)},R(i.label),11,vee))),128))],2))}}),Oo=ut(yee,[["__scopeId","data-v-a2050005"]]),kee={class:"ui-panel-header__title"},bee={key:0,class:"ui-panel-header__sub"},_ee=je({__name:"PanelHeader",props:{title:{},subtitle:{},closable:{type:Boolean,default:!0},closeLabel:{default:"Close"},wrap:{type:Boolean}},emits:["close"],setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-panel-header",{wrap:e.wrap}])},[T("span",kee,R(e.title),1),oe(Ht,{text:e.subtitle},{default:_e(()=>[e.subtitle?(w(),N("span",bee,R(e.subtitle),1)):ie("",!0)]),_:1},8,["text"]),Cn(t.$slots,"default",{},void 0,!0),e.closable?(w(),ve(gn,{key:0,class:"ui-panel-header__close",size:"sm",label:e.closeLabel,onClick:n[0]||(n[0]=s=>t.$emit("close"))},{default:_e(()=>[oe(Je,{name:"close",size:"sm"})]),_:1},8,["label"])):ie("",!0)],2))}}),Gl=ut(_ee,[["__scopeId","data-v-d3e1bd66"]]),wee={key:0,class:"fp-empty fp-error"},See={key:1,class:"fp-empty"},Cee={key:2,class:"fp-loading"},xee={class:"fp-path"},Aee={class:"fp-meta"},Tee={key:0,class:"fp-lines"},Mee={class:"fp-size"},Eee={key:3,class:"fp-search"},Iee=["placeholder"],$ee={key:0,class:"fp-search-count"},Nee=["href","aria-label"],Lee={key:1,class:"fp-code"},Oee={class:"fp-line-table"},Pee=["data-line"],Ree={class:"fp-gutter"},Dee=["innerHTML"],Bee={key:1,class:"fp-body fp-code"},Fee={class:"fp-line-table"},Hee=["data-line"],Wee={class:"fp-gutter"},zee=["innerHTML"],Uee={key:2,class:"fp-body"},qee=["srcdoc","title"],jee={key:1,class:"fp-code"},Vee={class:"fp-line-table"},Kee=["data-line"],Gee={class:"fp-gutter"},Yee=["innerHTML"],Xee={key:3,class:"fp-body fp-pdf-wrap"},Qee=["src","title"],Zee={key:1,class:"fp-binary-card"},Jee={class:"fp-binary-label"},ete={key:4,class:"fp-body fp-table-wrap"},tte={class:"fp-table"},nte=["data-line"],ste={key:5,class:"fp-body fp-image-wrap"},ote=["src","alt"],ite={key:1,class:"fp-binary-card"},rte={class:"fp-binary-icon"},lte={class:"fp-binary-label"},ate={key:6,class:"fp-body fp-code"},cte={class:"fp-line-table"},ute=["data-line"],dte={class:"fp-gutter"},fte=["innerHTML"],pte={key:7,class:"fp-body fp-binary-wrap"},hte={class:"fp-binary-card"},mte={class:"fp-binary-icon"},gte={class:"fp-binary-label"},vte=je({__name:"FilePreview",props:{file:{},loading:{type:Boolean},error:{},line:{},downloadUrl:{},closable:{type:Boolean},externalActions:{type:Boolean},openFile:{type:Function}},emits:["close","openExternal","reveal"],setup(e,{emit:t}){const{t:n}=It();function s(le,U){const G=U?U.split("/").filter(Boolean):[];for(const ne of le.split("/"))ne===""||ne==="."||(ne===".."?G.pop():G.push(ne));return G.join("/")}const o=Ut("resolveImage",async le=>le),i=F(()=>{const le=c.file?.path??"",U=le.lastIndexOf("/");return U>0?le.slice(0,U):""});function r(le){if(/^(https?:|data:|blob:)/i.test(le)||le.startsWith("/"))return le;const U=i.value;return U?s(le,U):le}async function l(le){const U=r(le);return o?o(U):U}En("resolveImage",l);function a(le){let U=le.path;if(/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(U)||U.startsWith("/"))return le;for(const ne of["#","?"]){const H=U.indexOf(ne);H!==-1&&(U=U.slice(0,H))}const G=i.value;return{...le,path:s(U,G)}}const c=e,u=t;function d(le){c.openFile?.(a(le))}const p=Z(null),h=F(()=>{const le=c.file;if(!le)return"binary";const U=le.mime??"",G=le.languageId??"",ne=le.path.toLowerCase();return U==="text/markdown"||G==="markdown"||G==="md"||ne.endsWith(".mdx")?"markdown":U==="application/json"||G==="json"?"json":U==="text/html"||G==="html"||ne.endsWith(".html")||ne.endsWith(".htm")?"html":U==="application/pdf"||ne.endsWith(".pdf")?"pdf":U==="text/csv"||G==="csv"||ne.endsWith(".csv")?"csv":U.startsWith("image/")?"image":le.isBinary?"binary":U.startsWith("text/")||G!==""?"text":"binary"});function f(le){const U=atob(le),G=Uint8Array.from(U,ne=>ne.charCodeAt(0));return new TextDecoder().decode(G)}const m=F(()=>{const le=c.file;if(!le)return"";if(le.encoding==="base64")try{return f(le.content)}catch{return le.content}return le.content}),b=F(()=>{if(h.value!=="json"||!c.file)return"";try{return JSON.stringify(JSON.parse(m.value),null,2)}catch{return m.value}}),_=F(()=>c.file?(h.value==="json"?b.value:m.value).split(`
|
|
260
|
+
`):[]),g=F(()=>c.file?h.value==="json"?b.value:m.value:""),v=Z(""),y=Z(0),A=F(()=>{const le=v.value.trim().toLowerCase();if(!le)return[];const U=[];return _.value.forEach((G,ne)=>{G.toLowerCase().includes(le)&&U.push(ne+1)}),U});Ke(v,()=>{y.value=0});function O(le,U=!1){le&&ht(()=>{const G=p.value?.querySelector(".fp-body"),ne=G?.querySelector(`[data-line="${le}"]`);if(!G||!ne)return;U&&(G.scrollTop=0);const H=G.getBoundingClientRect(),J=ne.getBoundingClientRect(),ce=J.top-H.top+G.scrollTop;G.scrollTop=ce-G.clientHeight/2+J.height/2})}Ke(()=>[c.file?.path,c.line],()=>O(c.line,!0),{immediate:!0});function $(le){const U=A.value;U.length!==0&&(y.value=(y.value+le+U.length)%U.length,O(U[y.value]))}function k(le){const U=A.value;return{target:c.line===le,hit:U.includes(le),active:U[y.value]===le}}function E(le){return le<1024?`${le} B`:le<1024*1024?`${(le/1024).toFixed(1)} KB`:`${(le/(1024*1024)).toFixed(1)} MB`}const M=Z(!1),L=Z(!1);function S(){c.file&&zs(g.value).then(le=>{le&&(M.value=!0,setTimeout(()=>{M.value=!1},1400))})}function I(){c.file&&zs(c.file.path).then(le=>{le&&(L.value=!0,setTimeout(()=>{L.value=!1},1400))})}const P=Z("preview"),D=Z("preview"),W=Z("fit");function z(le){P.value=le}function q(le){D.value=le}function Q(le){W.value=le}Ke(h,le=>{P.value=le==="html"?"preview":"source",D.value="preview",W.value="fit"});const X=F(()=>{const le=c.file;return!le||h.value!=="image"?null:le.sourceUrl?le.sourceUrl:le.encoding==="base64"?`data:${le.mime};base64,${le.content}`:le.mime==="image/svg+xml"?`data:${le.mime};charset=utf-8,${encodeURIComponent(le.content)}`:null}),fe=F(()=>{const le=c.file;return!le||h.value!=="pdf"?null:c.downloadUrl?c.downloadUrl:le.encoding==="base64"?`data:${le.mime};base64,${le.content}`:null}),ye=F(()=>c.file?["<!doctype html>",'<meta charset="utf-8">',`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data: blob:; style-src 'unsafe-inline'; font-src data:;">`,m.value].join(""):"");function Me(le){const U=[];let G="",ne=!1;for(let H=0;H<le.length;H++){const J=le[H];J==='"'&&le[H+1]==='"'?(G+='"',H++):J==='"'?ne=!ne:J===","&&!ne?(U.push(G),G=""):G+=J}return U.push(G),U}const we=F(()=>_.value.slice(0,200).map(Me));function ze(le){return le.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}function Ue(){const le=c.file;if(!le)return"";const U=le.languageId?.toLowerCase();return U||(le.path.split(".").pop()?.toLowerCase()??"")}function Fe(le){const U=Ue();let G=ze(le);return h.value==="json"||U==="json"||U==="jsonc"?(G=G.replace(/("[^&]*?")(\s*:)/g,'<span class="tok-key">$1</span>$2'),G=G.replace(/(:\s*)("[^&]*?")/g,'$1<span class="tok-string">$2</span>'),G=G.replace(/\b(true|false|null)\b/g,'<span class="tok-literal">$1</span>'),G=G.replace(/(:\s*)(-?\d+(?:\.\d+)?)/g,'$1<span class="tok-number">$2</span>'),G):h.value==="html"||U==="html"||U==="xml"||U==="svg"?(G=G.replace(/\s([A-Za-z_:][-A-Za-z0-9_:.]*)(=)/g,' <span class="tok-attr">$1</span>$2'),G=G.replace(/(".*?")/g,'<span class="tok-string">$1</span>'),G=G.replace(/(<\/?)([A-Za-z][\w:-]*)/g,'$1<span class="tok-tag">$2</span>'),G):(G=G.replace(/\b(async|await|break|case|catch|class|const|continue|else|export|extends|finally|for|from|function|if|import|interface|let|new|return|switch|throw|try|type|while)\b/g,'<span class="tok-keyword">$1</span>'),G=G.replace(/(".*?"|'.*?')/g,'<span class="tok-string">$1</span>'),G=G.replace(/(\/\/.*)$/g,'<span class="tok-comment">$1</span>'),G)}function rt(le,U=55){return!le||le.length<=U?le:"…"+le.slice(le.length-U+1)}return(le,U)=>(w(),N("div",{ref_key:"rootRef",ref:p,class:"file-preview"},[e.error&&!e.loading?(w(),N("div",wee,[T("span",null,R(e.error),1),e.closable?(w(),ve(Dt,{key:0,variant:"secondary",size:"sm",onClick:U[0]||(U[0]=G=>u("close"))},{default:_e(()=>[qe(R(x(n)("filePreview.close")),1)]),_:1})):ie("",!0)])):!e.file&&!e.loading?(w(),N("div",See,R(x(n)("filePreview.empty")),1)):e.loading?(w(),N("div",Cee,[U[7]||(U[7]=T("span",{class:"spinner"},null,-1)),T("span",null,R(x(n)("filePreview.loading")),1)])):e.file?(w(),N(Le,{key:3},[oe(Gl,{wrap:"",title:x(n)("common.preview"),closable:e.closable,"close-label":x(n)("filePreview.close"),onClose:U[6]||(U[6]=G=>u("close"))},{default:_e(()=>[oe(Ht,{text:e.file.path},{default:_e(()=>[T("span",xee,R(rt(e.file.path)),1)]),_:1},8,["text"]),T("span",Aee,[e.file.lineCount?(w(),N("span",Tee,R(x(n)("filePreview.lineCount",{count:e.file.lineCount})),1)):ie("",!0),T("span",Mee,R(E(e.file.size)),1)]),h.value==="html"?(w(),ve(Oo,{key:0,"model-value":P.value,size:"sm",options:[{value:"preview",label:x(n)("filePreview.preview")},{value:"source",label:x(n)("filePreview.source")}],"onUpdate:modelValue":z},null,8,["model-value","options"])):ie("",!0),h.value==="markdown"?(w(),ve(Oo,{key:1,"model-value":D.value,size:"sm",options:[{value:"preview",label:x(n)("filePreview.preview")},{value:"source",label:x(n)("filePreview.source")}],"onUpdate:modelValue":q},null,8,["model-value","options"])):ie("",!0),h.value==="image"?(w(),ve(Oo,{key:2,"model-value":W.value,size:"sm",options:[{value:"fit",label:x(n)("filePreview.fit")},{value:"actual",label:x(n)("filePreview.actual")}],"onUpdate:modelValue":Q},null,8,["model-value","options"])):ie("",!0),h.value==="text"||h.value==="json"||h.value==="html"||h.value==="csv"?(w(),N("div",Eee,[Mn(T("input",{"onUpdate:modelValue":U[1]||(U[1]=G=>v.value=G),class:"fp-search-input",type:"search",placeholder:x(n)("filePreview.search")},null,8,Iee),[[ko,v.value]]),v.value.trim()?(w(),N("span",$ee,R(A.value.length),1)):ie("",!0),oe(gn,{size:"sm",disabled:A.value.length===0,label:x(n)("filePreview.prevMatch"),onClick:U[2]||(U[2]=G=>$(-1))},{default:_e(()=>[oe(Je,{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),oe(gn,{size:"sm",disabled:A.value.length===0,label:x(n)("filePreview.nextMatch"),onClick:U[3]||(U[3]=G=>$(1))},{default:_e(()=>[oe(Je,{name:"arrow-down",size:"md"})]),_:1},8,["disabled","label"])])):ie("",!0),oe(gn,{size:"sm",class:Re({copied:L.value}),label:L.value?x(n)("filePreview.copied"):x(n)("filePreview.copyPath"),onClick:I},{default:_e(()=>[L.value?(w(),ve(Je,{key:1,class:"fp-check",name:"check",size:"md"})):(w(),ve(Je,{key:0,name:"link",size:"md"}))]),_:1},8,["class","label"]),e.externalActions?(w(),ve(gn,{key:4,size:"sm",label:x(n)("filePreview.openInEditor"),onClick:U[4]||(U[4]=G=>u("openExternal"))},{default:_e(()=>[oe(Je,{name:"external-link",size:"md"})]),_:1},8,["label"])):ie("",!0),e.externalActions?(w(),ve(gn,{key:5,size:"sm",label:x(n)("filePreview.reveal"),onClick:U[5]||(U[5]=G=>u("reveal"))},{default:_e(()=>[oe(Je,{name:"folder",size:"md"})]),_:1},8,["label"])):ie("",!0),e.downloadUrl?(w(),N("a",{key:6,class:"fp-download",href:e.downloadUrl,target:"_blank",rel:"noreferrer",download:"","aria-label":x(n)("filePreview.download")},[oe(Je,{name:"download",size:"md"})],8,Nee)):ie("",!0),!e.file.isBinary&&h.value!=="image"?(w(),ve(gn,{key:7,size:"sm",class:Re({copied:M.value}),label:M.value?x(n)("filePreview.copied"):x(n)("filePreview.copy"),onClick:S},{default:_e(()=>[M.value?(w(),ve(Je,{key:1,class:"fp-check",name:"check",size:"md"})):(w(),ve(Je,{key:0,name:"copy",size:"md"}))]),_:1},8,["class","label"])):ie("",!0)]),_:1},8,["title","closable","close-label"]),h.value==="markdown"?(w(),N("div",{key:0,class:Re(["fp-body",{"fp-markdown":D.value==="preview"}])},[D.value==="preview"?(w(),ve(Oh,{key:0,text:m.value,"open-file":c.openFile?d:void 0},null,8,["text","open-file"])):(w(),N("div",Lee,[T("div",Oee,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",Ree,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,Dee)],10,Pee))),128))])]))],2)):h.value==="json"?(w(),N("div",Bee,[T("div",Fee,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",Wee,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,zee)],10,Hee))),128))])])):h.value==="html"?(w(),N("div",Uee,[P.value==="preview"?(w(),N("iframe",{key:0,class:"fp-html-frame",sandbox:"",srcdoc:ye.value,title:e.file.path},null,8,qee)):(w(),N("div",jee,[T("div",Vee,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",Gee,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,Yee)],10,Kee))),128))])]))])):h.value==="pdf"?(w(),N("div",Xee,[fe.value?(w(),N("iframe",{key:0,class:"fp-pdf-frame",src:fe.value,title:e.file.path},null,8,Qee)):(w(),N("div",Zee,[T("span",Jee,R(x(n)("filePreview.pdfNoPreview")),1)]))])):h.value==="csv"?(w(),N("div",ete,[T("table",tte,[T("tbody",null,[(w(!0),N(Le,null,nt(we.value,(G,ne)=>(w(),N("tr",{key:ne,class:Re(k(ne+1)),"data-line":ne+1},[T("th",null,R(ne+1),1),(w(!0),N(Le,null,nt(G,(H,J)=>(w(),N("td",{key:J},R(H),1))),128))],10,nte))),128))])])])):h.value==="image"?(w(),N("div",ste,[X.value?(w(),N("img",{key:0,src:X.value,alt:e.file.path,class:Re(["fp-image",{actual:W.value==="actual"}])},null,10,ote)):(w(),N("div",ite,[T("span",rte,[oe(Je,{name:"image-off",size:"lg"})]),T("span",lte,R(x(n)("filePreview.imageNoPreview",{mime:e.file.mime,size:E(e.file.size)})),1)]))])):h.value==="text"?(w(),N("div",ate,[T("div",cte,[(w(!0),N(Le,null,nt(_.value,(G,ne)=>(w(),N("div",{key:ne,class:Re(["fp-line-row",k(ne+1)]),"data-line":ne+1},[T("span",dte,R(ne+1),1),T("span",{class:"fp-line-text",innerHTML:Fe(G)},null,8,fte)],10,ute))),128))])])):(w(),N("div",pte,[T("div",hte,[T("span",mte,[oe(Je,{name:"file-off",size:"lg"})]),T("span",gte,R(x(n)("filePreview.binaryNoPreview",{mime:e.file.mime||x(n)("filePreview.unknownType"),size:E(e.file.size)})),1)])]))],64)):ie("",!0)],512))}}),yte=ut(vte,[["__scopeId","data-v-5c8baacf"]]),kte={class:"tp"},bte=je({__name:"ThinkingPanel",props:{text:{},subtitle:{}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=Z(null);return Ke(()=>n.text,()=>{const r=i.value;!r||!(r.scrollHeight-r.scrollTop-r.clientHeight<24)||ht(()=>{i.value&&(i.value.scrollTop=i.value.scrollHeight)})},{immediate:!0}),(r,l)=>(w(),N("div",kte,[oe(Gl,{title:x(o)("common.preview"),subtitle:e.subtitle??x(o)("thinking.panelTitle"),"close-label":x(o)("thinking.close"),onClose:l[0]||(l[0]=a=>s("close"))},null,8,["title","subtitle","close-label"]),T("pre",{ref_key:"bodyEl",ref:i,class:"tp-body"},R(e.text),513)]))}}),XS=ut(bte,[["__scopeId","data-v-8ac2d555"]]),_te={class:"ap"},wte={key:0,class:"ap-type"},Ste={key:1,class:"ap-reason"},Cte={key:2,class:"ap-field"},xte={class:"ap-field-body"},Ate={key:3,class:"ap-field"},Tte={class:"ap-field-body ap-live"},Mte={key:4,class:"ap-field"},Ete={class:"ap-field-body ap-progress"},Ite={key:0,class:"ap-call"},$te={key:1,class:"ap-output"},Nte=["onClick"],Lte={key:5,class:"ap-field"},Ote={class:"ap-field-body"},Pte=8,QS=5,ZS=2,Rte=je({__name:"AgentDetailPanel",props:{member:{}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=F(()=>(n.member.outputLines??[]).map(m=>m.trimEnd()).filter(m=>m.length>0)),r=F(()=>(n.member.text??"").trimEnd());function l(m){const b=[];let _=null,g=0;for(const v of m)v.startsWith("Calling ")?(_={key:`g${g++}`,call:v,output:[]},b.push(_)):_?_.output.push(v):(_={key:`g${g++}`,call:"",output:[v]},b.push(_));return b}const a=F(()=>l(i.value)),c=Z(new Set);function u(m){return c.value.has(m)}function d(m){const b=new Set(c.value);b.has(m)?b.delete(m):b.add(m),c.value=b}function p(m){return m.output.length-QS-ZS}function h(m){switch(m){case"queued":return"Queued";case"working":return"Working";case"suspended":return"Suspended";case"completed":return"Completed";case"failed":return"Failed"}}const f=Z(null);return Ke(()=>i.value.length+r.value.length,()=>{const m=f.value;!m||!(m.scrollHeight-m.scrollTop-m.clientHeight<24)||ht(()=>{f.value&&(f.value.scrollTop=f.value.scrollHeight)})},{immediate:!0}),(m,b)=>(w(),N("div",_te,[oe(Gl,{title:x(o)("common.preview"),subtitle:e.member.name,"close-label":x(o)("thinking.close"),onClose:b[0]||(b[0]=_=>s("close"))},{default:_e(()=>[oe(Is,{variant:"neutral",size:"sm",class:"ap-phase"},{default:_e(()=>[qe(R(h(e.member.phase)),1)]),_:1})]),_:1},8,["title","subtitle","close-label"]),T("div",{ref_key:"bodyEl",ref:f,class:"ap-body"},[e.member.subagentType?(w(),N("div",wte,R(e.member.subagentType),1)):ie("",!0),e.member.suspendedReason?(w(),N("div",Ste,R(e.member.suspendedReason),1)):ie("",!0),e.member.prompt?(w(),N("div",Cte,[b[1]||(b[1]=T("span",{class:"ap-field-label"},"Task",-1)),T("div",xte,R(e.member.prompt),1)])):ie("",!0),r.value?(w(),N("div",Ate,[b[2]||(b[2]=T("span",{class:"ap-field-label"},"Output",-1)),T("div",Tte,R(r.value),1)])):ie("",!0),a.value.length>0?(w(),N("div",Mte,[b[4]||(b[4]=T("span",{class:"ap-field-label"},"Progress",-1)),T("div",Ete,[(w(!0),N(Le,null,nt(a.value,_=>(w(),N("div",{key:_.key,class:"ap-group"},[_.call?(w(),N("div",Ite,[b[3]||(b[3]=T("span",{class:"ap-glyph","aria-hidden":"true"},"▶",-1)),qe(" "+R(_.call),1)])):ie("",!0),_.output.length>0?(w(),N("div",$te,[_.output.length<=Pte||u(_.key)?(w(!0),N(Le,{key:0},nt(_.output,(g,v)=>(w(),N("div",{key:v,class:"ap-out-line"},R(g),1))),128)):(w(),N(Le,{key:1},[(w(!0),N(Le,null,nt(_.output.slice(0,QS),(g,v)=>(w(),N("div",{key:v,class:"ap-out-line"},R(g),1))),128)),T("button",{type:"button",class:"ap-fold",onClick:g=>d(_.key)}," … ("+R(p(_))+" more) ",9,Nte),(w(!0),N(Le,null,nt(_.output.slice(-ZS),(g,v)=>(w(),N("div",{key:"t"+v,class:"ap-out-line"},R(g),1))),128))],64))])):ie("",!0)]))),128))])])):ie("",!0),e.member.summary?(w(),N("div",Lte,[b[5]||(b[5]=T("span",{class:"ap-field-label"},"Result",-1)),T("div",Ote,R(e.member.summary),1)])):ie("",!0)],512)]))}}),Dte=ut(Rte,[["__scopeId","data-v-3a498db6"]]),Bte={class:"diff-lines"},Fte={key:0,class:"hunk-text"},Hte={class:"dl-gutter old"},Wte={class:"dl-gutter new"},zte={class:"dl-sign"},Ute={class:"dl-text"},qte=je({__name:"DiffLines",props:{lines:{}},setup(e){function t(o){return o.oldNo!==void 0?String(o.oldNo):""}function n(o){return o.newNo!==void 0?String(o.newNo):""}function s(o){return`dl-${o.type}`}return(o,i)=>(w(),N("div",Bte,[(w(!0),N(Le,null,nt(e.lines,(r,l)=>(w(),N("div",{key:l,class:Re(["dl",s(r)])},[r.type==="hunk"?(w(),N("span",Fte,R(r.text),1)):(w(),N(Le,{key:1},[T("span",Hte,R(t(r)),1),T("span",Wte,R(n(r)),1),T("span",zte,R(r.type==="add"?"+":r.type==="del"?"-":" "),1),T("span",Ute,R(r.text),1)],64))],2))),128))]))}}),M3=ut(qte,[["__scopeId","data-v-cba18f82"]]),jte={class:"tdp"},Vte={class:"tdp-body"},Kte={key:1,class:"tdp-output"},Gte={key:2,class:"tdp-empty"},Yte=je({__name:"ToolDiffPanel",props:{target:{}},emits:["close"],setup(e,{emit:t}){const n=t,{t:s}=It();return(o,i)=>(w(),N("div",jte,[oe(Gl,{title:e.target.title,subtitle:e.target.path,"close-label":x(s)("thinking.close"),onClose:i[0]||(i[0]=r=>n("close"))},null,8,["title","subtitle","close-label"]),T("div",Vte,[e.target.lines&&e.target.lines.length>0?(w(),ve(M3,{key:0,lines:e.target.lines},null,8,["lines"])):e.target.output&&e.target.output.length>0?(w(),N("div",Kte,[(w(!0),N(Le,null,nt(e.target.output,(r,l)=>(w(),N("div",{key:l},R(r),1))),128))])):(w(),N("div",Gte,R(x(s)("diff.noDiff")),1))])]))}}),Xte=ut(Yte,[["__scopeId","data-v-465eaa15"]]),Qte={class:"sc"},Zte={key:0,class:"sc-empty"},Jte={key:2,class:"sc-loading","aria-hidden":"true"},ene={class:"sc-composer"},tne=["placeholder"],nne=["disabled"],sne=je({__name:"SideChatPanel",props:{turns:{},running:{type:Boolean},sending:{type:Boolean},title:{},subtitle:{}},emits:["send","close"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It(),i=F(()=>n.turns.find(g=>g.role==="user")?.text?.trim()??""),r=F(()=>n.title?.trim()||o("sideChat.title")),l=F(()=>n.subtitle?.trim()?n.subtitle.trim():i.value||o("sideChat.subtitle")),a=Z(""),c=Z(null),u=Z(null);function d(){const _=a.value.trim();_&&(s("send",_),a.value="",ht(()=>{c.value&&(c.value.style.height="auto"),p()}))}function p(){const _=u.value;_&&(_.scrollTop=_.scrollHeight)}const h=F(()=>{const _=n.turns;if(_.length===0)return"0";const g=_.at(-1),v=g.thinking?.length??0,y=g.tools?.reduce((A,O)=>A+O.name.length+(O.arg?.length??0)+(O.output?.join("").length??0),0)??0;return`${_.length}:${g.text.length}:${v}:${y}`});Ke(h,async()=>{!n.running&&!n.sending||(await ht(),p())});const f=F(()=>n.sending?n.turns.at(-1)?.role==="user":!1);function m(_){_.key==="Enter"&&!_.shiftKey&&!_.isComposing&&(_.preventDefault(),d())}function b(){const _=c.value;_&&(_.style.height="auto",_.style.height=`${Math.min(_.scrollHeight,160)}px`)}return(_,g)=>(w(),N("div",Qte,[oe(Gl,{title:r.value,subtitle:l.value,"close-label":x(o)("thinking.close"),onClose:g[0]||(g[0]=v=>s("close"))},null,8,["title","subtitle","close-label"]),T("div",{ref_key:"bodyRef",ref:u,class:"sc-body"},[e.turns.length===0?(w(),N("div",Zte,R(x(o)("sideChat.empty")),1)):(w(),ve(S3,{key:1,turns:e.turns,approvals:[],running:e.running,sending:e.sending},null,8,["turns","running","sending"])),f.value?(w(),N("div",Jte,[oe(w3)])):ie("",!0)],512),T("div",ene,[Mn(T("textarea",{ref_key:"inputRef",ref:c,"onUpdate:modelValue":g[1]||(g[1]=v=>a.value=v),class:"sc-input",rows:"1",placeholder:x(o)("sideChat.placeholder"),onInput:b,onKeydown:m},null,40,tne),[[ko,a.value]]),oe(Ht,{text:x(o)("sideChat.send")},{default:_e(()=>[T("button",{type:"button",class:"sc-send",disabled:!a.value.trim(),onClick:d},[oe(Je,{name:"arrow-right",size:"sm"})],8,nne)]),_:1},8,["text"])])]))}}),one=ut(sne,[["__scopeId","data-v-9d5cc333"]]),ine={class:"changes-pane"},rne={class:"dv-path"},lne={class:"diff-head"},ane={class:"back-label"},cne={key:0,class:"empty-state"},une={key:1,class:"dv-lines-wrap"},dne={key:2,class:"empty-state"},fne={class:"dv-change-count"},pne={class:"ch-head"},hne={class:"br-label"},mne={class:"br-name"},gne={key:0,class:"sync-info"},vne={key:0,class:"ahead"},yne={key:0,class:"behind"},kne={key:1,class:"empty-head"},bne={key:0,class:"ch-list"},_ne=["onClick"],wne={class:"fpath"},Sne={key:1,class:"ch-list ch-tree"},Cne={class:"tree-list"},xne=["onClick"],Ane={class:"tree-name"},Tne=["onClick"],Mne={class:"tree-name"},Ene={key:2,class:"empty-state"},Ine={key:3,class:"empty-state"},$ne=je({__name:"DiffView",props:{changes:{},gitInfo:{},fileDiff:{},selectedDiffPath:{},fileDiffLoading:{type:Boolean},mode:{default:"full"},hideBack:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},emits:["open","back","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(L){const S=L.toLowerCase();return S==="modified"?"modified":S==="added"?"added":S==="deleted"?"deleted":S==="renamed"?"renamed":S==="untracked"?"untracked":S==="conflicted"?"conflicted":S==="ignored"?"ignored":S==="clean"?"clean":"unknown"}const r={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"I",clean:"·",unknown:"?"};function l(L){return r[i(L)]??"?"}function a(L,S=60){return L.length<=S?L:"…"+L.slice(L.length-S+1)}const c=F(()=>s.gitInfo!==null),u=F(()=>s.changes.length>0),d=F(()=>(s.selectedDiffPath??null)!==null),p=F(()=>s.mode==="detail"||s.mode==="full"&&d.value),h=F(()=>s.fileDiff??[]),f=F(()=>s.fileDiffLoading===!0);function m(L){o("open",L)}function b(){o("back")}function _(){o("close")}const g=Z("list");function v(L){g.value=L}function y(L){const S={children:[]},I=[...L].sort((P,D)=>P.path.localeCompare(D.path));for(const P of I){const D=P.path.split("/");let W=S;for(let z=0;z<D.length;z++){const q=D[z],Q=z===D.length-1,X=D.slice(0,z+1).join("/");let fe=W.children.find(ye=>ye.name===q&&ye.kind===(Q?"file":"folder"));fe||(fe={name:q,path:X,kind:Q?"file":"folder",status:Q?P.status:void 0,children:[]},W.children.push(fe)),W=fe}}return S.children}const A=F(()=>y(s.changes)),O=Z(new Set);function $(L){return!O.value.has(L)}const k=F(()=>{const L=[];function S(I,P){for(const D of I)L.push({node:D,depth:P}),D.kind==="folder"&&$(D.path)&&S(D.children,P+1)}return S(A.value,0),L});function E(L){const S=new Set(O.value);S.has(L.path)?S.delete(L.path):S.add(L.path),O.value=S}function M(L){return`${16+L*16}px`}return(L,S)=>(w(),N("div",ine,[p.value?(w(),N(Le,{key:0},[oe(Gl,{title:x(n)("diff.title"),closable:e.closable,"close-label":x(n)("diff.close"),onClose:_},{default:_e(()=>[oe(Ht,{text:e.selectedDiffPath??""},{default:_e(()=>[T("span",rne,R(a(e.selectedDiffPath??"",50)),1)]),_:1},8,["text"])]),_:1},8,["title","closable","close-label"]),T("div",lne,[e.hideBack?ie("",!0):(w(),ve(Dt,{key:0,variant:"ghost",size:"sm",onClick:b},{default:_e(()=>[S[0]||(S[0]=T("span",{"aria-hidden":"true"},"←",-1)),T("span",ane,R(x(n)("diff.back")),1)]),_:1}))]),f.value?(w(),N("div",cne,R(x(n)("diff.loading")),1)):h.value.length>0?(w(),N("div",une,[oe(M3,{lines:h.value},null,8,["lines"])])):(w(),N("div",dne,R(x(n)("diff.noDiff")),1))],64)):(w(),N(Le,{key:1},[oe(Gl,{title:x(n)("diff.title"),closable:e.closable,"close-label":x(n)("diff.close"),onClose:_},{default:_e(()=>[T("span",fne,R(x(n)("diff.changeCount",{count:e.changes.length})),1),oe(Oo,{"model-value":g.value,size:"sm",options:[{value:"list",label:x(n)("diff.list")},{value:"tree",label:x(n)("diff.tree")}],"onUpdate:modelValue":v},null,8,["model-value","options"])]),_:1},8,["title","closable","close-label"]),T("div",pne,[c.value?(w(),N(Le,{key:0},[T("span",hne,R(x(n)("diff.branch")),1),T("span",mne,R(e.gitInfo.branch),1),e.gitInfo.ahead>0||e.gitInfo.behind>0?(w(),N("span",gne,[oe(Ht,{text:x(n)("diff.aheadTitle")},{default:_e(()=>[e.gitInfo.ahead>0?(w(),N("span",vne,"↑"+R(e.gitInfo.ahead),1)):ie("",!0)]),_:1},8,["text"]),oe(Ht,{text:x(n)("diff.behindTitle")},{default:_e(()=>[e.gitInfo.behind>0?(w(),N("span",yne,"↓"+R(e.gitInfo.behind),1)):ie("",!0)]),_:1},8,["text"])])):ie("",!0)],64)):(w(),N("span",kne,R(x(n)("diff.empty")),1))]),u.value&&g.value==="list"?(w(),N("div",bne,[(w(!0),N(Le,null,nt(e.changes,I=>(w(),ve(Ht,{key:I.path,text:I.path},{default:_e(()=>[T("button",{type:"button",class:"ch-row",onClick:P=>m(I.path)},[T("span",{class:Re(["badge",i(I.status)])},R(l(I.status)),3),T("span",wne,R(a(I.path)),1)],8,_ne)]),_:2},1032,["text"]))),128))])):u.value&&g.value==="tree"?(w(),N("div",Sne,[T("ul",Cne,[(w(!0),N(Le,null,nt(k.value,({node:I,depth:P})=>(w(),N("li",{key:I.path,class:"tree-node"},[I.kind==="folder"?(w(),N("button",{key:0,type:"button",class:"tree-row tree-folder",style:Gt({paddingLeft:M(P)}),onClick:D=>E(I)},[oe(Je,{class:"tree-icon",name:"folder-solid",size:"sm"}),T("span",Ane,R(I.name),1)],12,xne)):(w(),ve(Ht,{key:1,text:I.path},{default:_e(()=>[T("button",{type:"button",class:"tree-row tree-file",style:Gt({paddingLeft:M(P)}),onClick:D=>m(I.path)},[T("span",{class:Re(["badge",i(I.status)])},R(l(I.status)),3),T("span",Mne,R(I.name),1)],12,Tne)]),_:2},1032,["text"]))]))),128))])])):c.value?(w(),N("div",Ene,R(x(n)("diff.clean")),1)):(w(),N("div",Ine,R(x(n)("diff.empty")),1))],64))]))}}),Nne=ut($ne,[["__scopeId","data-v-57f1a05b"]]);function Sy(e,t){let n=null;hn(()=>{n=typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null,ht(()=>{const s=t?.value??e.value;try{s?.focus()}catch{}})}),ls(()=>{const s=n;if(n=null,!(!s||typeof document>"u"||!document.contains(s)))try{s.focus()}catch{}})}const Lne=["type","value","placeholder","disabled","readonly"],One=je({__name:"Input",props:{modelValue:{},size:{default:"md"},type:{default:"text"},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},error:{type:Boolean}},emits:["update:modelValue","focus","blur"],setup(e,{expose:t,emit:n}){const s=n,o=Z();function i(a){s("update:modelValue",a.target.value)}function r(){o.value?.focus()}function l(){o.value?.select()}return t({focus:r,select:l,el:o}),(a,c)=>(w(),N("input",{ref_key:"el",ref:o,class:Re(["ui-input",[`ui-input--${e.size}`,{"has-error":e.error}]]),type:e.type,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,onInput:i,onFocus:c[0]||(c[0]=u=>a.$emit("focus",u)),onBlur:c[1]||(c[1]=u=>a.$emit("blur",u))},null,42,Lne))}}),sc=ut(One,[["__scopeId","data-v-fef6d5bc"]]),Pne={class:"search-wrap"},Rne={key:0,class:"tab-strip"},Dne={key:1,class:"state-row"},Bne={key:2,class:"state-row unavail"},Fne={key:3,class:"model-list"},Hne=["aria-selected","onClick","onMouseenter"],Wne={class:"check"},zne={class:"model-main"},Une={class:"model-name"},qne={class:"model-id"},jne={key:0,class:"caps"},Vne={class:"model-provider"},Kne={class:"model-ctx"},Gne={key:0,class:"empty"},Yne={class:"footer-hint"},Xne=je({__name:"ModelPicker",props:{models:{},current:{},starredIds:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:["select","toggle-star","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=F(()=>new Set(s.starredIds??[]));function r(v){return i.value.has(v)}const l=Z(""),a=Z(null),c=Z(null),u=Z("all");Sy(c,a);const d=F(()=>{const v=new Set,y=[{id:"all",label:n("model.allTab")}];for(const A of s.models)v.has(A.provider)||(v.add(A.provider),y.push({id:A.provider,label:A.provider}));return y}),p=F(()=>{const v=l.value.toLowerCase().trim(),y=s.models.filter(A=>{if(u.value!=="all"&&A.provider!==u.value)return!1;const O=(A.displayName??A.model).toLowerCase().includes(v),$=A.provider.toLowerCase().includes(v),k=A.id.toLowerCase().includes(v);return!v||O||$||k});return u.value!=="all"?y:y.sort((A,O)=>{const $=r(A.id)?1:0;return(r(O.id)?1:0)-$})}),h=F(()=>p.value),f=Z(0);Ke([l,u],()=>{f.value=0}),Ke(d,v=>{v.some(y=>y.id===u.value)||(u.value="all")}),Ke(h,v=>{f.value=Math.min(f.value,Math.max(v.length-1,0))});function m(v){if(v.key==="Escape"){o("close");return}if(v.key==="ArrowDown")v.preventDefault(),f.value=Math.min(f.value+1,h.value.length-1);else if(v.key==="ArrowUp")v.preventDefault(),f.value=Math.max(f.value-1,0);else if(v.key==="Enter"){const y=h.value[f.value];y&&o("select",y.id)}}hn(()=>{document.addEventListener("keydown",m)}),kn(()=>{document.removeEventListener("keydown",m)});function b(v){o("select",v)}function _(v){return h.value.indexOf(v)}function g(v){u.value=v}return(v,y)=>(w(),ve(ar,{open:!0,"close-on-esc":!1,title:x(n)("model.title"),size:"xl",height:"fixed",onClose:y[1]||(y[1]=A=>o("close"))},{default:_e(()=>[T("div",{ref_key:"dialogRef",ref:c,class:"mp"},[T("div",Pne,[oe(sc,{ref_key:"searchRef",ref:a,modelValue:l.value,"onUpdate:modelValue":y[0]||(y[0]=A=>l.value=A),placeholder:x(n)("model.searchPlaceholder"),autocomplete:"off",spellcheck:"false",autofocus:""},null,8,["modelValue","placeholder"])]),d.value.length>1?(w(),N("div",Rne,[(w(!0),N(Le,null,nt(d.value,A=>(w(),ve(Dt,{key:A.id,variant:A.id===u.value?"secondary":"ghost",size:"sm",onClick:O=>g(A.id)},{default:_e(()=>[qe(R(A.label),1)]),_:2},1032,["variant","onClick"]))),128))])):ie("",!0),e.loading?(w(),N("div",Dne,[oe(ni,{size:"sm"}),T("span",null,R(x(n)("model.loading")),1)])):e.unavailable?(w(),N("div",Bne,[oe(Je,{name:"alert-triangle",size:"lg"}),T("span",null,R(x(n)("model.unavailable")),1)])):(w(),N("div",Fne,[(w(!0),N(Le,null,nt(h.value,A=>(w(),N("div",{key:A.id,class:Re(["model-row",{"is-current":A.id===e.current,"is-selected":_(A)===f.value}]),role:"option","aria-selected":A.id===e.current,onClick:O=>b(A.id),onMouseenter:O=>f.value=_(A)},[T("span",Wne,[A.id===e.current?(w(),ve(Je,{key:0,name:"check",size:"sm"})):ie("",!0)]),T("span",zne,[T("span",Une,R(A.displayName??A.model),1),T("span",qne,R(A.id),1),A.capabilities&&A.capabilities.length>0?(w(),N("span",jne,[(w(!0),N(Le,null,nt(A.capabilities,O=>(w(),ve(Is,{key:O,variant:"info",size:"sm"},{default:_e(()=>[qe(R(O),1)]),_:2},1024))),128))])):ie("",!0)]),T("span",Vne,R(A.provider),1),T("span",Kne,R(x(n)("model.contextSuffix",{size:Math.round(A.maxContextSize/1e3)})),1),oe(gn,{size:"sm",label:r(A.id)?x(n)("model.unstarTitle"):x(n)("model.starTitle"),onClick:vt(O=>o("toggle-star",A.id),["stop"])},{default:_e(()=>[r(A.id)?(w(),ve(Je,{key:0,name:"star",size:"md"})):(w(),ve(Je,{key:1,name:"star-outline",size:"md"}))]),_:2},1032,["label","onClick"])],42,Hne))),128)),h.value.length===0&&!e.loading&&!e.unavailable?(w(),N("div",Gne,R(s.models.length===0?x(n)("model.emptyNoModels"):x(n)("model.emptyNoMatch")),1)):ie("",!0)])),T("div",Yne,R(x(n)("model.footerHint")),1)],512)]),_:1},8,["title"]))}}),Qne=ut(Xne,[["__scopeId","data-v-610af162"]]),Zne={key:0,class:"ui-field__label"},Jne={key:1,class:"ui-field__error"},ese={key:2,class:"ui-field__hint"},tse=je({__name:"Field",props:{label:{},hint:{},error:{}},setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-field",{"has-error":!!e.error}])},[e.label?(w(),N("label",Zne,R(e.label),1)):ie("",!0),Cn(t.$slots,"default",{},void 0,!0),e.error?(w(),N("span",Jne,R(e.error),1)):e.hint?(w(),N("span",ese,R(e.hint),1)):ie("",!0)],2))}}),zf=ut(tse,[["__scopeId","data-v-8bdbf1c0"]]),nse={class:"prov-list"},sse={key:0,class:"state-row"},ose={key:1,class:"state-row unavail"},ise={key:2,class:"empty"},rse={class:"prov-info"},lse={class:"prov-type"},ase={key:0,class:"prov-url"},cse={class:"prov-meta"},use={key:0},dse={class:"prov-actions"},fse={key:0,class:"add-section"},pse={key:0,class:"add-btns"},hse={key:1,class:"add-form"},mse={key:0,class:"add-error"},gse={class:"form-btns"},vse={class:"footer-hint"},yse=je({__name:"ProviderManager",props:{providers:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:["add","refresh","delete","openLogin","close"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=Z(null);Sy(o);const i=e,r=F(()=>i.providers.filter(g=>g.type.toLowerCase()==="blun")),l=t;async function a(g){await s({title:n("providers.delete"),message:n("providers.confirmDelete"),variant:"danger"})&&l("delete",g)}const c=Z(!1),u=$s({apiKey:"",baseUrl:"",defaultModel:""}),d=Z("");function p(){u.apiKey="",u.baseUrl="",u.defaultModel="",d.value="",c.value=!0}function h(){c.value=!1}function f(){if(!u.apiKey.trim()){d.value=n("providers.apiKeyRequired");return}d.value="",l("add",{type:"blun",apiKey:u.apiKey.trim()||void 0,baseUrl:u.baseUrl.trim()||void 0,defaultModel:u.defaultModel.trim()||void 0}),c.value=!1}function m(g){if(g.key==="Escape"){if(c.value){h();return}l("close")}}hn(()=>document.addEventListener("keydown",m)),kn(()=>document.removeEventListener("keydown",m));function b(g){return g==="connected"?"var(--color-success)":g==="error"?"var(--color-danger)":"var(--color-text-faint)"}function _(g){return n(g==="connected"?"providers.status.connected":g==="error"?"providers.status.error":"providers.status.unconfigured")}return(g,v)=>(w(),ve(ar,{open:!0,"close-on-esc":!1,title:x(n)("providers.title"),size:"xl",height:"fixed",onClose:v[4]||(v[4]=y=>l("close"))},{default:_e(()=>[T("div",{ref_key:"dialogRef",ref:o,class:"pm"},[T("div",nse,[e.loading?(w(),N("div",sse,[oe(ni,{size:"sm"}),T("span",null,R(x(n)("providers.loading")),1)])):e.unavailable?(w(),N("div",ose,[oe(Je,{name:"alert-triangle",size:"md"}),T("span",null,R(x(n)("providers.unavailable")),1)])):r.value.length===0?(w(),N("div",ise,R(x(n)("providers.empty")),1)):(w(!0),N(Le,{key:3},nt(r.value,y=>(w(),N("div",{key:y.id,class:"prov-row"},[oe(Ht,{text:_(y.status)},{default:_e(()=>[T("span",{class:Re(["status-dot",{"status-dot--empty":y.status!=="connected"&&y.status!=="error"}]),style:Gt(y.status==="connected"||y.status==="error"?{background:b(y.status)}:void 0)},null,6)]),_:2},1032,["text"]),T("div",rse,[T("span",lse,R(y.type),1),y.baseUrl?(w(),N("span",ase,R(y.baseUrl),1)):ie("",!0),T("span",cse,[oe(Is,{variant:y.hasApiKey?"success":"neutral",size:"sm"},{default:_e(()=>[qe(R(y.hasApiKey?x(n)("providers.keySet"):x(n)("providers.keyNotSet")),1)]),_:2},1032,["variant"]),y.models&&y.models.length>0?(w(),N("span",use," · "+R(x(n)("providers.modelCount",{count:y.models.length})),1)):ie("",!0)])]),T("div",dse,[oe(Ht,{text:x(n)("providers.refreshTitle",{type:y.type})},{default:_e(()=>[oe(Dt,{variant:"secondary",size:"sm",onClick:A=>l("refresh",y.id)},{default:_e(()=>[qe(R(x(n)("providers.refresh")),1)]),_:1},8,["onClick"])]),_:2},1032,["text"]),oe(Ht,{text:x(n)("providers.deleteTitle",{type:y.type})},{default:_e(()=>[oe(Dt,{variant:"danger-soft",size:"sm",onClick:A=>a(y.id)},{default:_e(()=>[qe(R(x(n)("providers.delete")),1)]),_:1},8,["onClick"])]),_:2},1032,["text"])])]))),128))]),e.unavailable?ie("",!0):(w(),N("div",fse,[c.value?(w(),N("div",hse,[oe(zf,{label:x(n)("providers.fieldApiKey")},{default:_e(()=>[oe(sc,{modelValue:u.apiKey,"onUpdate:modelValue":v[1]||(v[1]=y=>u.apiKey=y),type:"password",placeholder:"sk-…",autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),_:1},8,["label"]),oe(zf,{label:x(n)("providers.fieldBaseUrl")},{default:_e(()=>[oe(sc,{modelValue:u.baseUrl,"onUpdate:modelValue":v[2]||(v[2]=y=>u.baseUrl=y),placeholder:x(n)("providers.baseUrlPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),oe(zf,{label:x(n)("providers.fieldDefaultModel")},{default:_e(()=>[oe(sc,{modelValue:u.defaultModel,"onUpdate:modelValue":v[3]||(v[3]=y=>u.defaultModel=y),placeholder:x(n)("providers.optional"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),d.value?(w(),N("div",mse,R(d.value),1)):ie("",!0),T("div",gse,[oe(Dt,{variant:"primary",size:"sm",onClick:f},{default:_e(()=>[qe(R(x(n)("providers.add")),1)]),_:1}),oe(Dt,{variant:"secondary",size:"sm",onClick:h},{default:_e(()=>[qe(R(x(n)("common.cancel")),1)]),_:1})])])):(w(),N("div",pse,[oe(Dt,{variant:"secondary",size:"sm",onClick:v[0]||(v[0]=y=>l("openLogin"))},{default:_e(()=>[oe(Je,{name:"user",size:"sm"}),qe(" "+R(x(n)("providers.loginBlun")),1)]),_:1}),oe(Dt,{variant:"primary",size:"sm",onClick:p},{default:_e(()=>[oe(Je,{name:"plus",size:"sm"}),qe(" "+R(x(n)("providers.enterApiKey")),1)]),_:1})]))])),T("div",vse,R(x(n)("providers.escClose")),1)],512)]),_:1},8,["title"]))}}),kse=ut(yse,[["__scopeId","data-v-791cd315"]]),bse={key:0,width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",stroke:"var(--color-success)","stroke-width":"2","aria-hidden":"true"},_se={key:1,width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",stroke:"var(--color-danger)","stroke-width":"1.5","aria-hidden":"true"},wse={key:2,width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",stroke:"var(--color-warning)","stroke-width":"1.5","aria-hidden":"true"},dv=je({__name:"AuthStateIcon",props:{kind:{}},setup(e){return(t,n)=>e.kind==="success"?(w(),N("svg",bse,[...n[0]||(n[0]=[T("circle",{cx:"18",cy:"18",r:"15"},null,-1),T("polyline",{points:"10,18 15,24 26,12"},null,-1)])])):e.kind==="expired"?(w(),N("svg",_se,[...n[1]||(n[1]=[T("circle",{cx:"14",cy:"14",r:"12"},null,-1),T("line",{x1:"14",y1:"8",x2:"14",y2:"15"},null,-1),T("circle",{cx:"14",cy:"19",r:"1.2",fill:"var(--color-danger)"},null,-1)])])):(w(),N("svg",wse,[...n[2]||(n[2]=[T("path",{d:"M14 3 L26 24 H2 Z"},null,-1),T("line",{x1:"14",y1:"12",x2:"14",y2:"18"},null,-1),T("circle",{cx:"14",cy:"21.5",r:"1",fill:"var(--color-warning)"},null,-1)])]))}}),Sse={key:0,class:"center-body"},Cse={class:"center-text"},xse={key:1,class:"nb"},Ase={class:"nb-lead"},Tse=["href"],Mse={class:"nb-or"},Ese={class:"nb-fallback"},Ise={class:"nb-fb-text"},$se=["href"],Nse={class:"nb-code-row"},Lse={class:"nb-code"},Ose={class:"nb-status"},Pse={class:"nb-status-text"},Rse={class:"nb-countdown"},Dse={key:2,class:"center-body"},Bse={class:"center-text success-text"},Fse={class:"center-hint"},Hse={class:"center-body"},Wse={class:"center-text err-text"},zse={class:"center-hint"},Use={class:"actions"},qse={class:"center-body"},jse={class:"center-text warn-text"},Vse={class:"center-hint"},Kse={class:"actions"},Gse=je({__name:"LoginDialog",props:{onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["success","close"],setup(e,{emit:t}){const{t:n}=It(),s=Z(!0),o=t,i=e,r=Z("starting"),l=Z(null),a=Z(0),c=Z(!1);let u=null,d=null;hn(async()=>{await p()}),kn(()=>{m()});async function p(){m(),l.value=null,r.value="starting";const y=await i.onStartOAuthLogin();if(!y){r.value="error";return}l.value={flowId:y.flowId,verificationUri:y.verificationUri,verificationUriComplete:y.verificationUriComplete,userCode:y.userCode,expiresIn:y.expiresIn,interval:y.interval},a.value=y.expiresIn,r.value="device-code",h(),f(y.interval)}function h(){d&&clearInterval(d),d=setInterval(()=>{a.value>0?a.value--:(d&&clearInterval(d),d=null)},1e3)}function f(y){u&&clearTimeout(u),u=setTimeout(async()=>{const A=await i.onPollOAuthLogin();A?.status==="authenticated"?(m(),r.value="success",setTimeout(()=>{o("success"),o("close")},1200)):A?.status==="expired"||A?.status==="cancelled"?(m(),r.value="expired"):f(y)},y*1e3)}function m(){u&&(clearTimeout(u),u=null),d&&(clearInterval(d),d=null)}async function b(){await p()}async function _(){!l.value||!await zs(l.value.userCode)||(c.value=!0,setTimeout(()=>{c.value=!1},2e3))}async function g(){m(),r.value==="device-code"&&i.onCancelOAuthLogin(),o("close")}function v(y){const A=Math.floor(y/60),O=y%60;return`${A}:${String(O).padStart(2,"0")}`}return(y,A)=>(w(),ve(ar,{open:s.value,"onUpdate:open":A[0]||(A[0]=O=>s.value=O),title:x(n)("login.title"),"close-on-overlay":!1,onClose:g},{default:_e(()=>[r.value==="starting"?(w(),N("div",Sse,[oe(ni,{size:"md"}),T("span",Cse,R(x(n)("login.starting")),1)])):r.value==="device-code"&&l.value?(w(),N("div",xse,[T("div",Ase,R(x(n)("login.lead")),1),T("a",{class:"nb-primary",href:l.value.verificationUriComplete,target:"_blank",rel:"noopener noreferrer"},[qe(R(x(n)("login.authorizeInBrowser"))+" ",1),oe(Je,{name:"external-link",size:"sm"})],8,Tse),T("div",Mse,R(x(n)("login.orDivider")),1),T("div",Ese,[T("div",Ise,[qe(R(x(n)("login.fallbackPrefix")),1),T("a",{class:"nb-fb-link",href:l.value.verificationUri,target:"_blank",rel:"noopener noreferrer"},R(l.value.verificationUri),9,$se),qe(R(x(n)("login.fallbackSuffix")),1)]),T("div",Nse,[T("span",Lse,R(l.value.userCode),1),oe(Dt,{class:Re(["nb-copy",{"is-copied":c.value}]),variant:"secondary",size:"sm",onClick:_},{default:_e(()=>[c.value?(w(),N(Le,{key:0},[oe(Je,{name:"check",size:"sm"}),qe(" "+R(x(n)("login.copied")),1)],64)):(w(),N(Le,{key:1},[oe(Je,{name:"copy",size:"sm"}),qe(" "+R(x(n)("login.copy")),1)],64))]),_:1},8,["class"])])]),T("div",Ose,[oe(ni,{size:"sm",label:x(n)("login.waitingAuth")},null,8,["label"]),T("span",Pse,R(x(n)("login.waitingAutoClose")),1),T("span",Rse,R(v(a.value)),1)])])):r.value==="success"?(w(),N("div",Dse,[oe(dv,{kind:"success"}),T("span",Bse,R(x(n)("login.success")),1),T("span",Fse,R(x(n)("login.successHint")),1)])):r.value==="expired"?(w(),N(Le,{key:3},[T("div",Hse,[oe(dv,{kind:"expired"}),T("span",Wse,R(x(n)("login.expiredTitle")),1),T("span",zse,R(x(n)("login.expiredHint")),1)]),T("div",Use,[oe(Dt,{variant:"primary",onClick:b},{default:_e(()=>[qe(R(x(n)("login.retry")),1)]),_:1}),oe(Dt,{variant:"secondary",onClick:g},{default:_e(()=>[qe(R(x(n)("login.closeBtn")),1)]),_:1})])],64)):r.value==="error"?(w(),N(Le,{key:4},[T("div",qse,[oe(dv,{kind:"error"}),T("span",jse,R(x(n)("login.errorTitle")),1),T("span",Vse,R(x(n)("login.errorHint")),1)]),T("div",Kse,[oe(Dt,{variant:"primary",onClick:b},{default:_e(()=>[qe(R(x(n)("login.retry")),1)]),_:1}),oe(Dt,{variant:"secondary",onClick:g},{default:_e(()=>[qe(R(x(n)("login.closeBtn")),1)]),_:1})])],64)):ie("",!0)]),_:1},8,["open","title"]))}}),Yse=ut(Gse,[["__scopeId","data-v-1d93ac7a"]]),E3=je({__name:"LanguageSwitcher",setup(e){const{locale:t}=It(),n=TA.map(o=>({value:o.code,label:o.label}));function s(o){t.value!==o&&MA(o)}return(o,i)=>(w(),ve(Oo,{"model-value":x(t),options:x(n),"onUpdate:modelValue":s},null,8,["model-value","options"]))}}),Xse=["aria-checked","aria-label","disabled"],Qse=je({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(s,o)=>(w(),N("button",{class:Re(["ui-switch",{"is-on":e.modelValue}]),type:"button",role:"switch","aria-checked":e.modelValue,"aria-label":e.label,disabled:e.disabled,onClick:o[0]||(o[0]=i=>n("update:modelValue",!e.modelValue))},[...o[1]||(o[1]=[T("span",{class:"ui-switch__thumb"},null,-1)])],10,Xse))}}),Ar=ut(Qse,[["__scopeId","data-v-9e0e1f3a"]]),Zse=["value","disabled"],Jse=je({__name:"Select",props:{modelValue:{},size:{default:"md"},disabled:{type:Boolean},error:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;function s(o){n("update:modelValue",o.target.value)}return(o,i)=>(w(),N("select",{class:Re(["ui-select",[`ui-select--${e.size}`,{"has-error":e.error}]]),value:e.modelValue,disabled:e.disabled,onChange:s},[Cn(o.$slots,"default",{},void 0,!0)],42,Zse))}}),eoe=ut(Jse,[["__scopeId","data-v-bf7b29d1"]]),toe=["aria-label"],noe=["aria-selected","onClick"],soe={class:"body"},ooe={class:"panel"},ioe={class:"sec"},roe={class:"sec-title"},loe={class:"row"},aoe={class:"rlabel"},coe={class:"row"},uoe={class:"rlabel"},doe={class:"row"},foe={class:"rlabel"},poe={class:"num-field"},hoe=["value","aria-label"],moe={class:"row"},goe={class:"rlabel"},voe={class:"row"},yoe={class:"rlabel"},koe={class:"hint"},boe={class:"sec"},_oe={class:"sec-title"},woe={class:"row"},Soe={class:"rlabel"},Coe={key:0,class:"hint"},xoe={class:"row"},Aoe={class:"rlabel"},Toe={key:0,class:"hint"},Moe={class:"row"},Eoe={class:"rlabel"},Ioe={class:"panel"},$oe={class:"sec"},Noe={class:"sec-title"},Loe={class:"row"},Ooe={class:"rlabel"},Poe={key:0,class:"rvalue"},Roe={class:"actions"},Doe={class:"panel"},Boe={class:"sec"},Foe={class:"sec-head"},Hoe={class:"sec-title"},Woe={key:0,class:"saving"},zoe={class:"row"},Uoe={class:"rlabel"},qoe={class:"hint"},joe={key:0,class:"select-wrap"},Voe={key:0,value:"",disabled:""},Koe=["label"],Goe=["value"],Yoe={key:1,class:"rvalue mono"},Xoe={class:"row"},Qoe={class:"rlabel"},Zoe={class:"hint"},Joe={class:"row"},eie={class:"rlabel"},tie={class:"hint"},nie={class:"row"},sie={class:"rlabel"},oie={class:"hint"},iie={class:"row"},rie={class:"rlabel"},lie={class:"hint"},aie={key:1,class:"empty-config"},cie={class:"panel"},uie={class:"sec"},die={class:"sec-title"},fie={class:"row"},pie={class:"rlabel"},hie={class:"rvalue mono"},mie={class:"row"},gie={class:"rlabel"},vie={class:"rvalue mono"},yie={key:0,class:"row"},kie={class:"rlabel"},bie={class:"hint"},_ie={class:"hint"},wie={class:"row"},Sie={class:"rlabel"},Cie={key:0,class:"hint"},xie=je({__name:"SettingsDialog",props:{colorScheme:{},accent:{},uiFontSize:{},authReady:{type:Boolean},accountModel:{},notify:{type:Boolean},notifyQuestion:{type:Boolean},notifyPermission:{},sound:{type:Boolean},conversationToc:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{}},emits:["setColorScheme","setAccent","setUiFontSize","setNotify","setNotifyQuestion","setSound","setConversationToc","login","logout","openOnboarding","openProviders","updateConfig","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z("general"),r=[{id:"general",labelKey:"settings.tabs.general"},{id:"agent",labelKey:"settings.tabs.agent"},{id:"account",labelKey:"settings.tabs.account"},{id:"advanced",labelKey:"settings.tabs.advanced"}],l=T5(),a=["manual","auto","yolo"],c={manual:"status.permissionManual",auto:"status.permissionAuto",yolo:"status.permissionYolo"},u=Z(null);Sy(u);function d(M){M.key==="Escape"&&o("close")}hn(()=>document.addEventListener("keydown",d)),kn(()=>document.removeEventListener("keydown",d));function p(){y3()}const h=F(()=>{const M=new Map;for(const L of s.models??[])M.set(L.id,{id:L.id,label:L.displayName??L.model??L.id,provider:L.provider});for(const[L,S]of Object.entries(s.config?.models??{})){if(M.has(L))continue;const I=b(S);M.set(L,{id:L,label:_(L,S,I),provider:I??L})}return Array.from(M.values())}),f=F(()=>{const M=new Map;for(const L of h.value){const S=M.get(L.provider)??[];S.push(L),M.set(L.provider,S)}for(const L of M.values())L.sort((S,I)=>S.label.localeCompare(I.label));return Array.from(M.entries()).toSorted(([L],[S])=>L.localeCompare(S)).map(([L,S])=>({provider:L,options:S}))}),m=F(()=>{const M=s.config?.defaultPermissionMode;return M==="auto"||M==="yolo"||M==="manual"?M:"manual"});function b(M){if(!M||typeof M!="object")return;const L=M;return typeof L.provider=="string"?L.provider:void 0}function _(M,L,S){if(!L||typeof L!="object")return M;const I=L,P=typeof I.model=="string"?I.model:void 0,D=S??b(L);return P&&D?`${M} (${D}/${P})`:P?`${M} (${P})`:M}function g(M){return M===!0}function v(M){!M||M===s.config?.defaultModel||o("updateConfig",{defaultModel:M})}function y(M){M!==m.value&&o("updateConfig",{defaultPermissionMode:M})}function A(M){const L=s.config?.[M];o("updateConfig",{[M]:!g(L)})}function O(){const M=s.config?.thinking;return!M||typeof M!="object"?!0:M.enabled!==!1}function $(){o("updateConfig",{thinking:{enabled:!O()}})}function k(){const M=s.config?.telemetry!==!1;o("updateConfig",{telemetry:!M})}function E(M){i.value=M}return(M,L)=>(w(),ve(ar,{open:!0,"close-on-esc":!1,title:x(n)("settings.title"),size:"xl",height:"fixed",padded:!1,onClose:L[15]||(L[15]=S=>o("close"))},{default:_e(()=>[T("div",{ref_key:"dialogRef",ref:u,class:"sd"},[T("nav",{class:"settings-tabs",role:"tablist","aria-label":x(n)("settings.title")},[(w(),N(Le,null,nt(r,S=>T("button",{key:S.id,type:"button",class:Re(["tab",{on:i.value===S.id}]),role:"tab","aria-selected":i.value===S.id,onClick:I=>E(S.id)},R(x(n)(S.labelKey)),11,noe)),64))],8,toe),T("div",soe,[Mn(T("section",ooe,[T("section",ioe,[T("h3",roe,R(x(n)("settings.appearance")),1),T("div",loe,[T("span",aoe,R(x(n)("theme.colorSchemeLabel")),1),oe(Oo,{"model-value":e.colorScheme,options:[{value:"light",label:x(n)("theme.light")},{value:"dark",label:x(n)("theme.dark")},{value:"system",label:x(n)("theme.system")}],"onUpdate:modelValue":L[0]||(L[0]=S=>o("setColorScheme",S))},null,8,["model-value","options"])]),T("div",coe,[T("span",uoe,R(x(n)("theme.accentLabel")),1),oe(Oo,{"model-value":e.accent,options:[{value:"blue",label:x(n)("theme.accentBlue")},{value:"mono",label:x(n)("theme.accentBlack")}],"onUpdate:modelValue":L[1]||(L[1]=S=>o("setAccent",S))},null,8,["model-value","options"])]),T("div",doe,[T("span",foe,R(x(n)("settings.uiFontSize")),1),T("label",poe,[T("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":x(n)("settings.uiFontSize"),onInput:L[2]||(L[2]=S=>o("setUiFontSize",Number(S.target.value)))},null,40,hoe),L[16]||(L[16]=T("span",{class:"num-unit"},"px",-1))])]),T("div",moe,[T("span",goe,R(x(n)("sidebar.language")),1),oe(E3)]),T("div",voe,[T("span",yoe,[qe(R(x(n)("settings.conversationToc"))+" ",1),T("span",koe,R(x(n)("settings.conversationTocHint")),1)]),oe(Ar,{"model-value":e.conversationToc??!0,label:x(n)("settings.conversationToc"),"onUpdate:modelValue":L[3]||(L[3]=S=>o("setConversationToc",S))},null,8,["model-value","label"])])]),T("section",boe,[T("h3",_oe,R(x(n)("settings.notifications")),1),T("div",woe,[T("span",Soe,[qe(R(x(n)("settings.notifyOnComplete"))+" ",1),e.notifyPermission==="denied"?(w(),N("span",Coe,R(x(n)("settings.notifyDenied")),1)):ie("",!0)]),oe(Ar,{"model-value":e.notify,disabled:e.notifyPermission==="denied",label:x(n)("settings.notifyOnComplete"),"onUpdate:modelValue":L[4]||(L[4]=S=>o("setNotify",S))},null,8,["model-value","disabled","label"])]),T("div",xoe,[T("span",Aoe,[qe(R(x(n)("settings.notifyOnQuestion"))+" ",1),e.notifyPermission==="denied"?(w(),N("span",Toe,R(x(n)("settings.notifyDenied")),1)):ie("",!0)]),oe(Ar,{"model-value":e.notifyQuestion,disabled:e.notifyPermission==="denied",label:x(n)("settings.notifyOnQuestion"),"onUpdate:modelValue":L[5]||(L[5]=S=>o("setNotifyQuestion",S))},null,8,["model-value","disabled","label"])]),T("div",Moe,[T("span",Eoe,R(x(n)("settings.soundOnComplete")),1),oe(Ar,{"model-value":e.sound,label:x(n)("settings.soundOnComplete"),"onUpdate:modelValue":L[6]||(L[6]=S=>o("setSound",S))},null,8,["model-value","label"])])])],512),[[Qo,i.value==="general"]]),Mn(T("section",Ioe,[T("section",$oe,[T("h3",Noe,R(x(n)("settings.account")),1),T("div",Loe,[T("span",Ooe,R(e.authReady?"managed:blun":x(n)("sidebar.notSignedIn")),1),oe(Ht,{text:e.accountModel},{default:_e(()=>[e.authReady&&e.accountModel?(w(),N("span",Poe,R(e.accountModel),1)):ie("",!0)]),_:1},8,["text"])]),T("div",Roe,[oe(Dt,{variant:"secondary",size:"sm",onClick:L[7]||(L[7]=S=>{o("openOnboarding"),o("close")})},{default:_e(()=>[qe(R(x(n)("onboarding.reopen")),1)]),_:1}),e.authReady?(w(),ve(Dt,{key:0,variant:"danger-soft",size:"sm",onClick:L[8]||(L[8]=S=>o("logout"))},{default:_e(()=>[qe(R(x(n)("sidebar.signOut")),1)]),_:1})):(w(),ve(Dt,{key:1,variant:"primary",size:"sm",onClick:L[9]||(L[9]=S=>o("login"))},{default:_e(()=>[qe(R(x(n)("sidebar.signIn")),1)]),_:1}))])])],512),[[Qo,i.value==="account"]]),Mn(T("section",Doe,[T("section",Boe,[T("div",Foe,[T("h3",Hoe,R(x(n)("settings.agentDefaults")),1),e.configSaving?(w(),N("span",Woe,R(x(n)("settings.saving")),1)):ie("",!0)]),e.config?(w(),N(Le,{key:0},[T("div",zoe,[T("span",Uoe,[qe(R(x(n)("settings.defaultModel"))+" ",1),T("span",qoe,R(x(n)("settings.defaultModelHint")),1)]),f.value.length>0?(w(),N("div",joe,[oe(eoe,{"model-value":e.config.defaultModel??"",disabled:e.configSaving,"aria-label":x(n)("settings.defaultModel"),"onUpdate:modelValue":v},{default:_e(()=>[e.config.defaultModel?ie("",!0):(w(),N("option",Voe,R(x(n)("settings.noDefaultModel")),1)),(w(!0),N(Le,null,nt(f.value,S=>(w(),N("optgroup",{key:S.provider,label:S.provider},[(w(!0),N(Le,null,nt(S.options,I=>(w(),N("option",{key:I.id,value:I.id},R(I.label),9,Goe))),128))],8,Koe))),128))]),_:1},8,["model-value","disabled","aria-label"])])):(w(),N("span",Yoe,R(e.config.defaultModel??x(n)("settings.noDefaultModel")),1))]),T("div",Xoe,[T("span",Qoe,[qe(R(x(n)("settings.defaultPermission"))+" ",1),T("span",Zoe,R(x(n)("settings.defaultPermissionHint")),1)]),oe(Oo,{"model-value":m.value,options:a.map(S=>({value:S,label:x(n)(c[S])})),"onUpdate:modelValue":L[10]||(L[10]=S=>y(S))},null,8,["model-value","options"])]),T("div",Joe,[T("span",eie,[qe(R(x(n)("settings.defaultThinking"))+" ",1),T("span",tie,R(x(n)("settings.defaultThinkingHint")),1)]),oe(Ar,{"model-value":O(),disabled:e.configSaving,label:x(n)("settings.defaultThinking"),"onUpdate:modelValue":L[11]||(L[11]=S=>$())},null,8,["model-value","disabled","label"])]),T("div",nie,[T("span",sie,[qe(R(x(n)("settings.defaultPlanMode"))+" ",1),T("span",oie,R(x(n)("settings.defaultPlanModeHint")),1)]),oe(Ar,{"model-value":g(e.config.defaultPlanMode),disabled:e.configSaving,label:x(n)("settings.defaultPlanMode"),"onUpdate:modelValue":L[12]||(L[12]=S=>A("defaultPlanMode"))},null,8,["model-value","disabled","label"])]),T("div",iie,[T("span",rie,[qe(R(x(n)("settings.mergeSkills"))+" ",1),T("span",lie,R(x(n)("settings.mergeSkillsHint")),1)]),oe(Ar,{"model-value":g(e.config.mergeAllAvailableSkills),disabled:e.configSaving,label:x(n)("settings.mergeSkills"),"onUpdate:modelValue":L[13]||(L[13]=S=>A("mergeAllAvailableSkills"))},null,8,["model-value","disabled","label"])])],64)):(w(),N("div",aie,R(x(n)("settings.configUnavailable")),1))])],512),[[Qo,i.value==="agent"]]),Mn(T("section",cie,[T("section",uie,[T("h3",die,R(x(n)("settings.advanced")),1),T("div",fie,[T("span",pie,R(x(n)("sidebar.daemon")),1),T("span",hie,R(x(l)),1)]),T("div",mie,[T("span",gie,R(x(n)("settings.serverVersion")),1),T("span",vie,R(e.serverVersion||"-"),1)]),e.config?(w(),N("div",yie,[T("span",kie,[qe(R(x(n)("settings.telemetry"))+" ",1),T("span",bie,R(x(n)("settings.telemetryHint")),1),T("span",_ie,R(x(n)("settings.telemetryRestartHint")),1)]),oe(Ar,{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:x(n)("settings.telemetry"),"onUpdate:modelValue":L[14]||(L[14]=S=>k())},null,8,["model-value","disabled","label"])])):ie("",!0),T("div",wie,[T("span",Sie,[qe(R(x(n)("settings.exportLog"))+" ",1),x(vi)()?ie("",!0):(w(),N("span",Cie,R(x(n)("settings.logHint")),1))]),oe(Dt,{variant:"secondary",size:"sm",onClick:p},{default:_e(()=>[qe(R(x(n)("settings.exportLogBtn")),1)]),_:1})])])],512),[[Qo,i.value==="advanced"]])])],512)]),_:1},8,["title"]))}}),Aie=ut(xie,[["__scopeId","data-v-5e28caf4"]]),Tie={class:"aw"},Mie={class:"crumbbar"},Eie={class:"crumbs"},Iie={key:0,class:"crumb-sep"},$ie=["onClick"],Nie={key:0,class:"filterbar"},Lie=["placeholder"],Oie={class:"folder-list"},Pie={key:0,class:"fl-loading"},Rie=["onClick"],Die={class:"folder-name search-rel"},Bie={key:0,class:"git-branch"},Fie={key:0,class:"fl-empty"},Hie={key:1,class:"fl-loading"},Wie=["onClick"],zie={class:"folder-name"},Uie={key:0,class:"git-branch"},qie={key:0,class:"fl-empty"},jie={class:"paste-row"},Vie={class:"paste-input-wrap"},Kie={key:1,class:"add-error",role:"alert"},Gie={class:"actions"},Yie={class:"footer-hint"},Xie=600,Qie=6,JS=150,Zie=je({__name:"AddWorkspaceDialog",props:{browseFs:{type:Function},getFsHome:{type:Function},defaultPath:{},error:{}},emits:["add","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z(!0),r=Z(!1),l=Z(!1),a=Z(""),c=Z(null),u=Z([]),d=Z(""),p=Z(!1),h=Z([]),f=F(()=>d.value.trim().length>0);let m=0,b=null;function _(I,P){const D=I.toLowerCase(),W=P.toLowerCase();let z=0;for(let q=0;q<W.length&&z<D.length;q++)W[q]===D[z]&&z++;return z===D.length}async function g(I){const P=a.value,D=I.trim();if(!P||D===""){h.value=[],p.value=!1;return}const W=++m;p.value=!0;const z=[],q=[{path:P,depth:0}];let Q=0;for(;q.length>0&&Q<Xie&&z.length<JS;){if(W!==m)return;const X=q.shift();Q++;let fe;try{fe=await s.browseFs(X.path)}catch{continue}if(W!==m)return;for(const ye of fe.entries){if(!ye.isDir)continue;const Me=ye.path.startsWith(P)?ye.path.slice(P.length).replace(/^\/+/,""):ye.path;if(_(D,Me||ye.name)&&(z.push({path:ye.path,name:ye.name,rel:Me||ye.name,isGitRepo:ye.isGitRepo,branch:ye.branch}),z.length>=JS))break;X.depth+1<Qie&&q.push({path:ye.path,depth:X.depth+1})}W===m&&(h.value=[...z])}W===m&&(p.value=!1)}Ke(d,I=>{if(b&&clearTimeout(b),I.trim()===""){m++,h.value=[],p.value=!1;return}b=setTimeout(()=>void g(I),220)});const v=Z(!1),y=Z(""),A=F(()=>y.value.trim()),O=F(()=>{const I=a.value;if(!I)return[];const P=I.split("/").filter(Boolean),D=[{label:"/",path:"/"}];let W="";for(const z of P)W+=`/${z}`,D.push({label:z,path:W});return D}),$=F(()=>a.value.length>0);async function k(I){r.value=!0;try{const P=await s.browseFs(I);if(!P.path){l.value=!0;return}a.value=P.path,c.value=P.parent,u.value=P.entries,d.value="",l.value=!1}catch{l.value=!0}finally{r.value=!1}}function E(I){I.isDir&&k(I.path)}function M(){c.value&&k(c.value)}function L(){$.value&&o("add",a.value)}function S(){A.value.length!==0&&o("add",A.value)}return hn(async()=>{r.value=!0;try{if(s.defaultPath&&(await k(s.defaultPath),!l.value))return;const I=await s.getFsHome();I.home?await k(I.home):l.value=!0}catch{l.value=!0}finally{r.value=!1}}),kn(()=>{b&&clearTimeout(b)}),(I,P)=>(w(),ve(ar,{open:i.value,"onUpdate:open":P[5]||(P[5]=D=>i.value=D),title:x(n)("workspace.addTitle"),size:"lg",height:"fixed",onClose:P[6]||(P[6]=D=>o("close"))},{default:_e(()=>[T("div",Tie,[l.value?ie("",!0):(w(),N(Le,{key:0},[T("div",Mie,[oe(gn,{size:"sm",disabled:!c.value,label:x(n)("workspace.up"),onClick:M},{default:_e(()=>[oe(Je,{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),T("div",Eie,[(w(!0),N(Le,null,nt(O.value,(D,W)=>(w(),N(Le,{key:D.path},[W>1?(w(),N("span",Iie,"/")):ie("",!0),T("button",{class:Re(["crumb",{last:W===O.value.length-1}]),onClick:z=>k(D.path)},R(D.label),11,$ie)],64))),128))])]),r.value?ie("",!0):(w(),N("div",Nie,[oe(Je,{class:"filter-icon",name:"search",size:"md"}),Mn(T("input",{"onUpdate:modelValue":P[0]||(P[0]=D=>d.value=D),class:"filter-input",type:"text",placeholder:x(n)("workspace.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:P[1]||(P[1]=vt(()=>{},["stop"]))},null,40,Lie),[[ko,d.value]]),p.value?(w(),ve(ni,{key:0,size:"sm"})):ie("",!0)])),T("div",Oie,[r.value?(w(),N("div",Pie,R(x(n)("workspace.browsing")),1)):f.value?(w(),N(Le,{key:1},[(w(!0),N(Le,null,nt(h.value,D=>(w(),N("button",{key:D.path,class:"folder-row",onClick:W=>k(D.path)},[oe(Je,{class:"dir-icon",name:"folder-closed",size:"sm"}),T("span",Die,R(D.rel),1),D.isGitRepo?(w(),ve(Is,{key:0,variant:"info",size:"sm"},{default:_e(()=>[qe(R(x(n)("workspace.gitTag")),1),D.branch?(w(),N("span",Bie,R(D.branch),1)):ie("",!0)]),_:2},1024)):ie("",!0)],8,Rie))),128)),!p.value&&h.value.length===0?(w(),N("div",Fie,R(x(n)("workspace.noFilterMatch",{q:d.value.trim()})),1)):p.value&&h.value.length===0?(w(),N("div",Hie,R(x(n)("workspace.searching")),1)):ie("",!0)],64)):(w(),N(Le,{key:2},[(w(!0),N(Le,null,nt(u.value,D=>(w(),N("button",{key:D.path,class:"folder-row",onClick:W=>E(D)},[oe(Je,{class:"dir-icon",name:"folder-closed",size:"sm"}),T("span",zie,R(D.name),1),D.isGitRepo?(w(),ve(Is,{key:0,variant:"info",size:"sm"},{default:_e(()=>[qe(R(x(n)("workspace.gitTag")),1),D.branch?(w(),N("span",Uie,R(D.branch),1)):ie("",!0)]),_:2},1024)):ie("",!0)],8,Wie))),128)),u.value.length===0?(w(),N("div",qie,R(x(n)("workspace.noSubfolders")),1)):ie("",!0)],64))])],64)),T("div",{class:Re(["paste-section",{"paste-only":l.value}])},[!l.value&&!v.value?(w(),ve(Dt,{key:0,variant:"ghost",size:"sm",onClick:P[2]||(P[2]=D=>v.value=!0)},{default:_e(()=>[qe(R(x(n)("workspace.pasteToggle")),1)]),_:1})):(w(),ve(zf,{key:1,label:x(n)("workspace.pathLabel")},{default:_e(()=>[T("div",jie,[T("div",Vie,[oe(sc,{modelValue:y.value,"onUpdate:modelValue":P[3]||(P[3]=D=>y.value=D),placeholder:x(n)("workspace.pathPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:di(vt(S,["stop"]),["enter"])},null,8,["modelValue","placeholder","onKeydown"])]),oe(gn,{disabled:A.value.length===0,label:x(n)("workspace.add"),onClick:S},{default:_e(()=>[oe(Je,{name:"plus",size:"md"})]),_:1},8,["disabled","label"])])]),_:1},8,["label"]))],2),e.error?(w(),N("div",Kie,R(e.error),1)):ie("",!0),T("div",Gie,[oe(Ht,{text:a.value},{default:_e(()=>[l.value?ie("",!0):(w(),ve(Dt,{key:0,variant:"primary",disabled:!$.value,onClick:L},{default:_e(()=>[qe(R(x(n)("workspace.openThisFolder")),1)]),_:1},8,["disabled"]))]),_:1},8,["text"]),oe(Dt,{variant:"secondary",onClick:P[4]||(P[4]=D=>o("close"))},{default:_e(()=>[qe(R(x(n)("workspace.cancel")),1)]),_:1})]),T("div",Yie,R(x(n)("workspace.browseHint")),1)])]),_:1},8,["open","title"]))}}),Jie=ut(Zie,[["__scopeId","data-v-68837648"]]),ere={key:0,class:"confirm-dialog__message"},tre=je({__name:"ConfirmDialog",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:"danger"},loading:{type:Boolean}},emits:["update:open","confirm","cancel"],setup(e,{emit:t}){const n=t,{t:s}=It();function o(){n("update:open",!1),n("cancel")}return(i,r)=>(w(),ve(ar,{open:e.open,title:e.title,height:"auto","onUpdate:open":r[1]||(r[1]=l=>n("update:open",l)),onClose:o},{foot:_e(()=>[oe(Dt,{variant:"secondary",disabled:e.loading,onClick:o},{default:_e(()=>[qe(R(e.cancelLabel??x(s)("common.cancel")),1)]),_:1},8,["disabled"]),oe(Dt,{variant:e.variant,loading:e.loading,onClick:r[0]||(r[0]=l=>n("confirm"))},{default:_e(()=>[qe(R(e.confirmLabel??x(s)("common.confirm")),1)]),_:1},8,["variant","loading"])]),default:_e(()=>[e.message?(w(),N("p",ere,R(e.message),1)):ie("",!0)]),_:1},8,["open","title"]))}}),nre=ut(tre,[["__scopeId","data-v-6fa569a5"]]),sre=je({__name:"ConfirmDialogHost",setup(e){const{current:t,settle:n}=ol();return(s,o)=>(w(),ve(nre,{open:x(t)!==null,title:x(t)?.title??"",message:x(t)?.message,"confirm-label":x(t)?.confirmLabel,"cancel-label":x(t)?.cancelLabel,variant:x(t)?.variant,onConfirm:o[0]||(o[0]=i=>x(n)(!0)),onCancel:o[1]||(o[1]=i=>x(n)(!1))},null,8,["open","title","message","confirm-label","cancel-label","variant"]))}}),ore={class:"rows"},ire={class:"row"},rre={class:"row"},lre={class:"row"},are={class:"row"},cre={class:"row"},ure={class:"row"},dre={class:"ctx-text"},fre={key:0,class:"bar"},pre={class:"row"},hre=je({__name:"StatusPanel",props:{status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},costUsd:{}},emits:["close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=Z(!0),r=F(()=>s.status.ctxMax>0?Math.round(s.status.ctxUsed/s.status.ctxMax*100):0),l=F(()=>s.status.ctxMax>0?n("status.statusContextValue",{used:s.status.ctxUsed.toLocaleString(),max:s.status.ctxMax.toLocaleString(),pct:r.value}):n("status.statusNone"));function a(f){return n(f==="yolo"?"status.permissionYolo":f==="auto"?"status.permissionAuto":"status.permissionManual")}const c=F(()=>{const f=s.status.permission;return f==="yolo"?"var(--color-danger)":f==="auto"?"var(--color-warning)":"var(--color-text)"}),u=F(()=>s.planMode?n("status.planOn"):n("status.planOff")),d=F(()=>s.swarmMode?n("status.swarmOn"):n("status.swarmOff")),p=F(()=>typeof s.costUsd=="number"&&s.costUsd>0),h=F(()=>p.value?`$${s.costUsd.toFixed(4)}`:n("status.statusNone"));return(f,m)=>(w(),ve(ar,{open:i.value,"onUpdate:open":m[0]||(m[0]=b=>i.value=b),title:x(n)("status.statusPanelTitle"),onClose:m[1]||(m[1]=b=>o("close"))},{default:_e(()=>[T("dl",ore,[T("div",ire,[T("dt",null,R(x(n)("status.statusModel")),1),T("dd",null,R(e.status.model),1)]),T("div",rre,[T("dt",null,R(x(n)("status.statusThinking")),1),T("dd",null,R(e.thinking),1)]),T("div",lre,[T("dt",null,R(x(n)("status.statusPermission")),1),T("dd",{style:Gt({color:c.value})},R(a(e.status.permission)),5)]),T("div",are,[T("dt",null,R(x(n)("status.statusPlanMode")),1),T("dd",{class:Re({"plan-on":e.planMode})},R(u.value),3)]),T("div",cre,[T("dt",null,R(x(n)("status.statusSwarmMode")),1),T("dd",{class:Re({"swarm-on":e.swarmMode})},R(d.value),3)]),T("div",ure,[T("dt",null,R(x(n)("status.statusContext")),1),T("dd",null,[T("span",dre,R(l.value),1),e.status.ctxMax>0?(w(),N("span",fre,[T("i",{style:Gt({width:r.value+"%"})},null,4)])):ie("",!0)])]),T("div",pre,[T("dt",null,R(x(n)("status.statusCost")),1),T("dd",null,R(h.value),1)])])]),_:1},8,["open","title"]))}}),mre=ut(hre,[["__scopeId","data-v-ba2bb6f1"]]),gre={class:"ui-toast__icon","aria-hidden":"true"},vre={class:"ui-toast__body"},yre={class:"ui-toast__title"},kre={key:0,class:"ui-toast__msg"},bre=je({__name:"Toast",props:{variant:{default:"info"},title:{},message:{},dismissLabel:{default:"Dismiss"}},emits:["dismiss"],setup(e){return(t,n)=>(w(),N("div",{class:Re(["ui-toast",`ui-toast--${e.variant}`])},[T("span",gre,[Cn(t.$slots,"icon",{},()=>[e.variant==="success"?(w(),ve(Je,{key:0,name:"check"})):e.variant==="danger"?(w(),ve(Je,{key:1,name:"close"})):e.variant==="warning"?(w(),ve(Je,{key:2,name:"alert-triangle"})):(w(),ve(Je,{key:3,name:"info"}))],!0)]),T("div",vre,[T("div",yre,R(e.title),1),e.message?(w(),N("div",kre,R(e.message),1)):ie("",!0),Cn(t.$slots,"default",{},void 0,!0)]),oe(gn,{class:"ui-toast__close",size:"sm",label:e.dismissLabel,onClick:n[0]||(n[0]=s=>t.$emit("dismiss"))},{default:_e(()=>[oe(Je,{name:"close",size:"sm"})]),_:1},8,["label"])],2))}}),_re=ut(bre,[["__scopeId","data-v-68483b81"]]),wre={key:0,class:"actions"},Sre=["onClick"],Cre=["onClick"],xre={key:1,class:"details"},Are=je({__name:"WarningToasts",props:{warnings:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,s=t,{t:o}=It();function i(k){return typeof k=="object"&&k!==null}function r(k){return i(k)?k.title:k}function l(k){return i(k)?k.message??"":""}function a(k){return i(k)?k.details:void 0}function c(k){return i(k)?k.severity==="error":k.startsWith(`${o("warnings.errorLabel")}:`)||/\b4\d\d\b|error|失败|failed/i.test(k)}function u(k){return i(k)?`notice:${k.severity}:${k.title}:${k.message??""}:${JSON.stringify(k.details??[])}`:`text:${k}`}function d(k){if(!i(k))return k;const E=[k.title];k.message&&E.push(k.message);const M=k.details??[];if(M.length>0){E.push("",`${o("warnings.diagnostics")}:`);for(const L of M)E.push(`${L.label}: ${L.value}`)}return E.join(`
|
|
261
|
+
`)}let p=1;const h=Z([]),f=new Map,m=new Map;function b(k){const E=c(k)?12e3:6e3;return typeof window<"u"&&window.matchMedia?.("(hover: none)").matches===!0?E+5e3:E}function _(k,E){const M=f.get(k)??{handle:null,deadline:0,remaining:0};M.handle=setTimeout(()=>$(k),E),M.deadline=Date.now()+E,f.set(k,M)}function g(k){const E=f.get(k);E&&E.handle!==null&&clearTimeout(E.handle),f.delete(k)}function v(k){const E=f.get(k);!E||E.handle===null||(clearTimeout(E.handle),E.handle=null,E.remaining=Math.max(0,E.deadline-Date.now()))}function y(k){if(h.value.find(L=>L.id===k)?.detailsOpen)return;const M=f.get(k);!M||M.handle!==null||_(k,M.remaining)}function A(k){k.detailsOpen=!k.detailsOpen,k.detailsOpen?v(k.id):y(k.id)}async function O(k){if(!await zs(d(k.warning)))return;k.copied=!0;const M=m.get(k.id);M&&clearTimeout(M),m.set(k.id,setTimeout(()=>{k.copied=!1,m.delete(k.id)},1400))}function $(k){g(k);const E=m.get(k);E&&clearTimeout(E),m.delete(k);const M=h.value.findIndex(L=>L.id===k);M!==-1&&(h.value=h.value.filter(L=>L.id!==k),s("dismiss",M))}return Ke(()=>n.warnings,k=>{const E=[...h.value];h.value=k.map(M=>{const L=u(M),S=E.findIndex(D=>D.key===L),I=S===-1?void 0:E.splice(S,1)[0];if(I)return I.warning=M,I;const P={id:p++,key:L,warning:M,detailsOpen:!1,copied:!1};return _(P.id,b(M)),P});for(const M of E){g(M.id);const L=m.get(M.id);L&&clearTimeout(L),m.delete(M.id)}},{immediate:!0,flush:"post"}),kn(()=>{f.forEach(k=>{k.handle!==null&&clearTimeout(k.handle)}),f.clear(),m.forEach(k=>clearTimeout(k)),m.clear()}),(k,E)=>(w(),ve(Z$,{name:"toast",tag:"div",class:"toasts",role:"status","aria-live":"polite"},{default:_e(()=>[(w(!0),N(Le,null,nt(h.value,M=>(w(),ve(_re,{key:M.id,variant:c(M.warning)?"danger":"warning",title:r(M.warning),message:l(M.warning),"dismiss-label":x(o)("warnings.dismiss"),onDismiss:L=>$(M.id),onPointerenter:L=>v(M.id),onPointerleave:L=>y(M.id)},{default:_e(()=>[a(M.warning)?.length?(w(),N("div",wre,[T("button",{class:"link",type:"button",onClick:L=>A(M)},R(M.detailsOpen?x(o)("warnings.hideDetails"):x(o)("warnings.showDetails")),9,Sre),T("button",{class:"link",type:"button",onClick:L=>O(M)},R(M.copied?x(o)("warnings.copied"):x(o)("warnings.copyDetails")),9,Cre)])):ie("",!0),M.detailsOpen&&a(M.warning)?.length?(w(),N("dl",xre,[(w(!0),N(Le,null,nt(a(M.warning),L=>(w(),N("div",{key:`${L.label}:${L.value}`,class:"detail-row"},[T("dt",null,R(L.label),1),T("dd",null,R(L.value),1)]))),128))])):ie("",!0)]),_:2},1032,["variant","title","message","dismiss-label","onDismiss","onPointerenter","onPointerleave"]))),128))]),_:1}))}}),Tre=ut(Are,[["__scopeId","data-v-0ff7ecb5"]]),Mre={class:"topbar"},Ere={class:"wsq"},Ire=["aria-label"],$re={class:"tb-path"},Nre={class:"ws"},Lre={class:"se"},Ore={class:"tb-sub"},Pre=je({__name:"MobileTopBar",props:{workspace:{default:null},sessionTitle:{default:""},running:{type:Boolean,default:!1},branch:{default:""},sessionCount:{default:0}},emits:["openSwitcher","openSettings"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t,i=F(()=>{const a=s.workspace,u=(a?.name||a?.root||"").trim().charAt(0);return u?u.toUpperCase():"K"}),r=F(()=>s.workspace?.name??n("workspace.noWorkspace")),l=F(()=>s.running?n("mobile.running"):n("mobile.idle"));return(a,c)=>(w(),N("div",Mre,[T("span",Ere,R(i.value),1),T("button",{type:"button",class:"tb-mid","aria-label":x(n)("mobile.openSwitcher"),onClick:c[0]||(c[0]=u=>o("openSwitcher"))},[T("span",$re,[T("span",Nre,R(r.value),1),e.sessionTitle?(w(),N(Le,{key:0},[c[2]||(c[2]=T("span",{class:"sl"},"/",-1)),T("span",Lre,R(e.sessionTitle),1)],64)):ie("",!0),c[3]||(c[3]=T("span",{class:"cv"},"⌄",-1))]),T("span",Ore,[T("span",{class:Re(["rd",{on:e.running}])},null,2),T("span",null,R(l.value),1),e.branch?(w(),N(Le,{key:0},[qe(" · "+R(e.branch),1)],64)):ie("",!0),e.sessionCount>0?(w(),N(Le,{key:1},[qe(" · "+R(x(n)("mobile.sessionCount",{n:e.sessionCount})),1)],64)):ie("",!0)])],8,Ire),oe(gn,{size:"lg",label:x(n)("mobile.openSettings"),onClick:c[1]||(c[1]=u=>o("openSettings"))},{default:_e(()=>[oe(Je,{name:"sliders",size:"lg"})]),_:1},8,["label"])]))}}),Rre=ut(Pre,[["__scopeId","data-v-da181e88"]]),Dre={key:0,class:"sheet-root"},Bre=["aria-label"],Fre=["aria-label"],Hre={key:0,class:"sheet-head"},Wre={class:"sheet-title"},zre={class:"sheet-body"},Ure=je({__name:"BottomSheet",props:{modelValue:{type:Boolean},title:{default:""}},emits:["update:modelValue","close"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(){o("update:modelValue",!1),o("close")}function r(l){l.key==="Escape"&&i()}return Ke(()=>s.modelValue,l=>{typeof document>"u"||(l?document.addEventListener("keydown",r):document.removeEventListener("keydown",r))},{immediate:!0}),kn(()=>{typeof document<"u"&&document.removeEventListener("keydown",r)}),(l,a)=>(w(),ve(Gr,{name:"sheet"},{default:_e(()=>[e.modelValue?(w(),N("div",Dre,[T("div",{class:"sheet-scrim",onClick:i}),T("div",{class:"sheet-panel",role:"dialog","aria-label":e.title||x(n)("mobile.sheetLabel")},[T("button",{type:"button",class:"sheet-grab","aria-label":x(n)("mobile.closeSheet"),onClick:i},null,8,Fre),e.title?(w(),N("div",Hre,[T("span",Wre,R(e.title),1)])):ie("",!0),T("div",zre,[Cn(l.$slots,"default",{},void 0,!0)])],8,Bre)])):ie("",!0)]),_:3}))}}),I3=ut(Ure,[["__scopeId","data-v-2f716843"]]),qre={class:"mlist"},jre={key:0,class:"mempty"},Vre=["onClick"],Kre={class:"mgh-main"},Gre={class:"mgh-name"},Yre={class:"mgh-path"},Xre={key:2,class:"att"},Qre={key:0,class:"mempty small"},Zre=["onClick"],Jre={class:"m"},ele={class:"s"},tle={key:0,class:"att"},nle=["disabled","onClick"],sle=["onClick"],ole=je({__name:"MobileSwitcherSheet",props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:["update:modelValue","select","create","createInWorkspace","addWorkspace","rename","archive","deleteWorkspace","loadMore"],setup(e,{emit:t}){const{t:n}=It(),{confirm:s}=ol(),o=e,i=t;function r(){i("update:modelValue",!1)}function l(S){i("select",S),r()}function a(S){i("createInWorkspace",S),r()}function c(){i("create"),r()}function u(){i("addWorkspace"),r()}const d=Z(new Set);function p(S){return d.value.has(S)}function h(S){const I=new Set(d.value);I.has(S)?I.delete(S):I.add(S),d.value=I,y.value=null,k.value=null}const f=Z(new Set);function m(S){return f.value.has(S)}function b(S){const I=new Set(f.value);I.has(S)?I.delete(S):I.add(S),f.value=I}function _(S){if(m(S.workspace.id))return S.sessions;const I=S.sessions.slice(0,S.initialCount);if(o.activeId&&!I.some(P=>P.id===o.activeId)){const P=S.sessions.find(D=>D.id===o.activeId);if(P)return[...I,P]}return I}function g(S){if(!f.value.has(S)){const I=new Set(f.value);I.add(S),f.value=I}i("loadMore",S)}function v(S){return o.attentionByWorkspace[S]??0}const y=Z(null);function A(S){y.value=y.value===S?null:S,k.value=null}function O(S){y.value=null;const P=(typeof window<"u"?window.prompt(n("sidebar.rename"),S.title):null)?.trim();P&&i("rename",S.id,P)}async function $(S){y.value=null,await s({title:n("sidebar.archive"),message:n("sidebar.archiveConfirm"),variant:"danger"})&&i("archive",S)}const k=Z(null);function E(S){k.value=k.value===S?null:S,y.value=null}function M(S){zs(S.root),k.value=null}async function L(S){k.value=null,await s({title:n("sidebar.removeWorkspace"),message:n("workspace.removeWorkspaceConfirm",{name:S.name}),variant:"danger"})&&i("deleteWorkspace",S.id)}return(S,I)=>(w(),ve(I3,{"model-value":e.modelValue,"onUpdate:modelValue":I[2]||(I[2]=P=>i("update:modelValue",P))},{default:_e(()=>[T("button",{type:"button",class:"newrow",onClick:c},[oe(Je,{name:"message",size:"sm"}),qe(" "+R(x(n)("sidebar.newChat")),1)]),T("button",{type:"button",class:"newrow secondary",onClick:u},[oe(Je,{name:"folder",size:"sm"}),qe(" "+R(x(n)("sidebar.newWorkspace")),1)]),T("div",qre,[e.groups.length===0?(w(),N("div",jre,R(x(n)("workspace.noWorkspace")),1)):ie("",!0),(w(!0),N(Le,null,nt(e.groups,P=>(w(),N("div",{key:P.workspace.id,class:"mgroup"},[T("div",{class:Re(["mgh",{on:P.workspace.id===e.activeWorkspaceId}]),onClick:D=>h(P.workspace.id)},[p(P.workspace.id)?(w(),ve(Je,{key:0,class:"mgh-folder",name:"folder-closed",size:"sm"})):(w(),ve(Je,{key:1,class:"mgh-folder",name:"folder",size:"sm"})),T("div",Kre,[T("span",Gre,R(P.workspace.name),1),oe(Ht,{text:P.workspace.root},{default:_e(()=>[T("span",Yre,R(P.workspace.branch||P.workspace.shortPath),1)]),_:2},1032,["text"])]),p(P.workspace.id)&&v(P.workspace.id)>0?(w(),N("span",Xre,R(v(P.workspace.id)),1)):ie("",!0),oe(gn,{size:"lg",class:"mgh-more",label:x(n)("sidebar.options"),onClick:vt(D=>E(P.workspace.id),["stop"])},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),oe(gn,{size:"lg",class:"mgh-add",label:x(n)("workspace.newInGroup"),onClick:vt(D=>a(P.workspace.id),["stop"])},{default:_e(()=>[oe(Je,{name:"plus",size:"md"})]),_:1},8,["label","onClick"]),k.value===P.workspace.id?(w(),ve(Wl,{key:3,class:"kmenu wsmenu",onClick:I[0]||(I[0]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{size:"lg",onClick:D=>M(P.workspace)},{default:_e(()=>[qe(R(x(n)("sidebar.copyPath")),1)]),_:1},8,["onClick"]),oe(fn,{size:"lg",danger:"",onClick:D=>L(P.workspace)},{default:_e(()=>[qe(R(x(n)("sidebar.delete")),1)]),_:1},8,["onClick"])]),_:2},1024)):ie("",!0)],10,Vre),Mn(T("div",null,[P.sessions.length===0?(w(),N("div",Qre,R(x(n)("sidebar.noSessions")),1)):ie("",!0),(w(!0),N(Le,null,nt(_(P),D=>(w(),N("div",{key:D.id,class:Re(["srow",{cur:D.id===e.activeId}]),onClick:W=>l(D.id)},[T("div",Jre,[T("div",{class:Re(["t",{run:D.busy,aborted:D.status==="aborted"}])},R(D.title),3),T("div",ele,R(D.time),1)]),(e.attentionBySession[D.id]??0)>0?(w(),N("span",tle,R(e.attentionBySession[D.id]),1)):ie("",!0),oe(gn,{size:"lg",class:"kb",label:x(n)("sidebar.options"),onClick:vt(W=>A(D.id),["stop"])},{default:_e(()=>[oe(Je,{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),y.value===D.id?(w(),ve(Wl,{key:1,class:"kmenu",onClick:I[1]||(I[1]=vt(()=>{},["stop"]))},{default:_e(()=>[oe(fn,{size:"lg",onClick:W=>O(D)},{default:_e(()=>[qe(R(x(n)("sidebar.rename")),1)]),_:1},8,["onClick"]),oe(fn,{size:"lg",danger:"",onClick:W=>$(D.id)},{default:_e(()=>[qe(R(x(n)("sidebar.archive")),1)]),_:1},8,["onClick"])]),_:2},1024)):ie("",!0)],10,Zre))),128)),P.hasMore||P.loadingMore?(w(),N("button",{key:1,type:"button",class:"mshow-more",disabled:P.loadingMore,onClick:vt(D=>g(P.workspace.id),["stop"])},R(P.loadingMore?x(n)("sidebar.loadingMore"):x(n)("sidebar.showMore",{count:Math.max(0,P.workspace.sessionCount-P.sessions.length)})),9,nle)):ie("",!0),P.sessions.length>P.initialCount?(w(),N("button",{key:2,type:"button",class:"mshow-more",onClick:vt(D=>b(P.workspace.id),["stop"])},R(m(P.workspace.id)?x(n)("sidebar.showLess"):x(n)("sidebar.showAll",{count:P.sessions.length-P.initialCount})),9,sle)):ie("",!0)],512),[[Qo,!p(P.workspace.id)]])]))),128))])]),_:1},8,["model-value"]))}}),ile=ut(ole,[["__scopeId","data-v-d3a7ef72"]]),rle={class:"group-title"},lle={class:"srow-main"},ale={class:"srow-label"},cle={class:"srow-sub"},ule={class:"srow read-only"},dle={class:"srow-main"},fle={class:"srow-label"},ple={key:0,class:"srow-sub"},hle={class:"srow-main"},mle={class:"srow-label"},gle={class:"srow-sub"},vle=["aria-checked"],yle={class:"srow-main"},kle={class:"srow-label"},ble={class:"srow-sub"},_le=["aria-checked"],wle={class:"srow-main"},Sle={class:"srow-label"},Cle={class:"srow read-only"},xle={class:"srow-main"},Ale={class:"srow-label"},Tle={class:"srow-sub"},Mle=["aria-label"],Ele={class:"group-title"},Ile={class:"srow read-only pref"},$le={class:"srow-main"},Nle={class:"srow-label"},Lle={class:"srow read-only pref"},Ole={class:"srow-main"},Ple={class:"srow-label"},Rle={class:"srow read-only pref"},Dle={class:"srow-main"},Ble={class:"srow-label"},Fle={class:"num-field"},Hle=["value","aria-label"],Wle={class:"srow-main"},zle={class:"srow-label"},Ule={class:"srow-sub"},qle=["aria-checked"],jle={class:"srow-main"},Vle={class:"srow-label"},Kle={class:"srow-main"},Gle={class:"srow-label"},Yle={key:2,class:"srow read-only"},Xle={class:"srow-main"},Qle={class:"srow-label"},Zle={class:"srow-val dim"},Jle=je({__name:"MobileSettingsSheet",props:{modelValue:{type:Boolean},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},colorScheme:{default:"system"},uiFontSize:{default:14},authReady:{type:Boolean,default:!1},conversationToc:{type:Boolean},serverVersion:{default:""},models:{default:()=>[]}},emits:["update:modelValue","pickModel","setThinking","togglePlan","toggleSwarm","setPermission","setColorScheme","setUiFontSize","setConversationToc","login","logout"],setup(e,{emit:t}){const{t:n}=It(),s=e,o=t;function i(E){o("setColorScheme",E)}const r=["manual","auto","yolo"],l=F(()=>{const E=s.status?.modelId??s.status?.model??"";return s.models?.find(M=>M.id===E||M.model===E||M.displayName===s.status?.model)}),a=F(()=>fd(l.value)),c=F(()=>by(l.value)),u=F(()=>fc(l.value,s.thinking??"off")),d=F(()=>{const E=c.value,M=u.value;return E.includes(M)?M:E.includes("on")?"on":E[0]??"off"}),p=F(()=>c.value.map(E=>({value:E,label:F1(E)}))),h=F(()=>s.planMode===!0),f=F(()=>s.swarmMode===!0),m=F(()=>{const E=s.status.permission;return E==="yolo"?"var(--color-danger)":E==="auto"?"var(--color-warning)":"var(--color-text-muted)"}),b=F(()=>{const E=s.status.permission,M=n(E==="yolo"?"mobile.permYoloSub":E==="auto"?"mobile.permAutoSub":"mobile.permManualSub");return`${E} · ${M}`}),_=E=>`${Math.round(E/1e3)}k`,g=F(()=>s.status.ctxMax>0?Math.min(100,Math.max(0,Math.round(s.status.ctxUsed/s.status.ctxMax*100))):0),v=F(()=>s.status.ctxMax>0?`${_(s.status.ctxUsed)}/${_(s.status.ctxMax)}`:n("status.statusNone"));function y(E){o("setThinking",_y(l.value,E))}function A(){const E=r.indexOf(s.status.permission),M=r[(E+1)%r.length];o("setPermission",M)}function O(){o("pickModel"),o("update:modelValue",!1)}function $(){o("login"),o("update:modelValue",!1)}function k(){o("logout"),o("update:modelValue",!1)}return(E,M)=>(w(),ve(I3,{"model-value":e.modelValue,title:x(n)("mobile.settingsTitle"),"onUpdate:modelValue":M[4]||(M[4]=L=>o("update:modelValue",L))},{default:_e(()=>[T("div",rle,R(x(n)("mobile.groupSession")),1),T("button",{type:"button",class:"srow",onClick:O},[T("span",lle,[T("span",ale,R(x(n)("status.statusModel")),1),T("span",cle,R(e.status.model),1)]),M[5]||(M[5]=T("span",{class:"chev"},"›",-1))]),T("div",ule,[T("span",dle,[T("span",fle,R(x(n)("status.statusThinking")),1),a.value==="unsupported"?(w(),N("span",ple,R(x(n)("status.modeNotSupported")),1)):ie("",!0)]),c.value.length>1?(w(),ve(Oo,{key:0,"model-value":d.value,options:p.value,size:"sm","onUpdate:modelValue":y},null,8,["model-value","options"])):(w(),N("span",{key:1,class:Re(["srow-val",{dim:d.value==="off"}])},R(d.value==="off"?x(n)("status.planOff"):x(F1)(d.value)),3))]),T("button",{type:"button",class:"srow",onClick:M[0]||(M[0]=L=>o("togglePlan"))},[T("span",hle,[T("span",mle,R(x(n)("status.statusPlanMode")),1),T("span",gle,R(x(n)("mobile.planModeSub")),1)]),T("span",{class:Re(["toggle",{on:h.value}]),role:"switch","aria-checked":h.value},null,10,vle)]),T("button",{type:"button",class:"srow",onClick:M[1]||(M[1]=L=>o("toggleSwarm"))},[T("span",yle,[T("span",kle,R(x(n)("status.statusSwarmMode")),1),T("span",ble,R(x(n)("mobile.swarmModeSub")),1)]),T("span",{class:Re(["toggle",{on:f.value}]),role:"switch","aria-checked":f.value},null,10,_le)]),T("button",{type:"button",class:"srow",onClick:A},[T("span",wle,[T("span",Sle,R(x(n)("status.statusPermission")),1),T("span",{class:"srow-sub",style:Gt({color:m.value})},R(b.value),5)]),M[6]||(M[6]=T("span",{class:"chev"},"›",-1))]),T("div",Cle,[T("span",xle,[T("span",Ale,R(x(n)("status.statusContext")),1),T("span",Tle,R(v.value),1)]),T("span",{class:"ctx-meter","aria-label":v.value},[T("i",{style:Gt({width:g.value+"%"})},null,4)],8,Mle)]),T("div",Ele,R(x(n)("mobile.groupApp")),1),T("div",Ile,[T("span",$le,[T("span",Nle,R(x(n)("theme.colorSchemeLabel")),1)]),oe(Oo,{"model-value":e.colorScheme??"system",options:[{value:"light",label:x(n)("theme.light")},{value:"dark",label:x(n)("theme.dark")},{value:"system",label:x(n)("theme.system")}],"onUpdate:modelValue":i},null,8,["model-value","options"])]),T("div",Lle,[T("span",Ole,[T("span",Ple,R(x(n)("sidebar.language")),1)]),oe(E3)]),T("div",Rle,[T("span",Dle,[T("span",Ble,R(x(n)("settings.uiFontSize")),1)]),T("label",Fle,[T("input",{class:"num-input",type:"number",min:"12",max:"20",step:"1",value:e.uiFontSize,"aria-label":x(n)("settings.uiFontSize"),onInput:M[2]||(M[2]=L=>o("setUiFontSize",Number(L.target.value)))},null,40,Hle),M[7]||(M[7]=T("span",{class:"num-unit"},"px",-1))])]),T("button",{type:"button",class:"srow",onClick:M[3]||(M[3]=L=>o("setConversationToc",!e.conversationToc))},[T("span",Wle,[T("span",zle,R(x(n)("settings.conversationToc")),1),T("span",Ule,R(x(n)("settings.conversationTocHint")),1)]),T("span",{class:Re(["toggle",{on:e.conversationToc}]),role:"switch","aria-checked":e.conversationToc},null,10,qle)]),e.authReady?(w(),N("button",{key:0,type:"button",class:"srow acct out",onClick:k},[T("span",jle,[T("span",Vle,R(x(n)("sidebar.signOut")),1)])])):(w(),N("button",{key:1,type:"button",class:"srow acct in",onClick:$},[T("span",Kle,[T("span",Gle,R(x(n)("sidebar.signIn")),1)])])),e.serverVersion?(w(),N("div",Yle,[T("span",Xle,[T("span",Qle,R(x(n)("settings.serverVersion")),1)]),T("span",Zle,R(e.serverVersion),1)])):ie("",!0)]),_:1},8,["model-value","title"]))}}),eae=ut(Jle,[["__scopeId","data-v-050ac5b0"]]),$3=["blue","mono"],N3=["light","dark","system"],L3=14,tae=12,nae=20;function sae(){const e=Qn(Et.accent);return e&&$3.includes(e)?e:"blue"}function oae(e){typeof document>"u"||!document.documentElement||(document.documentElement.dataset.accent=e)}function iae(){const e=Qn(Et.colorScheme);return e&&N3.includes(e)?e:"system"}function rae(e){if(typeof document>"u"||!document.documentElement)return;document.documentElement.dataset.colorScheme=e;const t=document.querySelectorAll('meta[name="theme-color"]');if(t.length===0)return;const n=e==="dark"?"#0d1117":e==="light"?"#ffffff":null;t.forEach(s=>{const i=(s.getAttribute("media")??"").includes("dark")?"#0d1117":"#ffffff";s.setAttribute("content",n??i)})}function Cy(e){return Number.isFinite(e)?Math.min(nae,Math.max(tae,Math.round(e))):L3}function lae(){const e=Qn(Et.uiFontSize);return e===null?L3:Cy(Number(e))}function aae(e){typeof document>"u"||!document.documentElement||document.documentElement.style.setProperty("--ui-font-size",`${Cy(e)}px`)}const xy=Z(iae()),Ay=Z(sae()),Ty=Z(lae());Ke(xy,rae,{immediate:!0});Ke(Ay,oae,{immediate:!0});Ke(Ty,aae,{immediate:!0});function cae(e){N3.includes(e)&&(xy.value=e,ts(Et.colorScheme,e))}function uae(e){$3.includes(e)&&(Ay.value=e,ts(Et.accent,e))}function dae(e){const t=Cy(e);Ty.value=t,ts(Et.uiFontSize,String(t))}const fae=600,pae=250,Ph=250,hae=1e3,mae=160,Hp=Z(!1);let Ll=[],Dl=null,Wp=-Ph;function gae(){Ll=[],Wp=-Ph,Hp.value=!1,Dl!==null&&(clearTimeout(Dl),Dl=null)}function vae(){Hp.value=!0,Dl!==null&&clearTimeout(Dl),Dl=setTimeout(()=>{Dl=null,Ll=[],Wp=-Ph,Hp.value=!1},hae)}function yae(e){if(e<=0)return;const t=Date.now();Ll.push({time:t,chars:e});const n=t-fae;if(Ll=Ll.filter(l=>l.time>=n),t-Wp<Ph)return;Wp=t;const s=Ll[0]?.time??t,o=Math.max(t-s,pae);Ll.reduce((l,a)=>l+a.chars,0)/o*1e3>=mae&&vae()}function O3(){return{colorScheme:xy,accent:Ay,uiFontSize:Ty,fastMoon:Hp,setColorScheme:cae,setAccent:uae,setUiFontSize:dae,resetFastMoon:gae,recordMoonDelta:yae}}const kae={class:"ob-brand"},bae={class:"ob-brand-text"},_ae={class:"ob-title"},wae={class:"ob-sub"},Sae={class:"ob-sec"},Cae={class:"ob-label"},xae={class:"ob-sec"},Aae={class:"ob-label"},Tae={class:"ob-sec"},Mae={class:"ob-label"},Eae=je({__name:"Onboarding",emits:["complete","skip"],setup(e,{emit:t}){const n=t,{t:s,locale:o}=It(),{colorScheme:i,accent:r,setColorScheme:l,setAccent:a}=O3();function c(d){o.value!==d&&MA(d)}function u(){n("complete")}return(d,p)=>(w(),ve(ar,{open:!0,size:"md","close-on-overlay":!1,"close-on-esc":!1,onClose:p[3]||(p[3]=h=>n("skip"))},{head:_e(()=>[T("div",kae,[p[4]||(p[4]=T("svg",{class:"ob-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BLUN King"},[T("defs",null,[T("mask",{id:"obBlunEyes",maskUnits:"userSpaceOnUse"},[T("rect",{x:"0",y:"0",width:"32",height:"22",fill:"#fff"}),T("g",{class:"ob-eyes",fill:"#000"},[T("rect",{class:"ob-eye",x:"11.8",y:"7",width:"2.8",height:"8",rx:"1.4"}),T("rect",{class:"ob-eye",x:"17.4",y:"7",width:"2.8",height:"8",rx:"1.4"})])])]),T("rect",{x:"1",y:"1",width:"30",height:"20",rx:"6",fill:"var(--color-accent)",mask:"url(#obBlunEyes)"})],-1)),T("div",bae,[T("div",_ae,R(x(s)("onboarding.title")),1),T("div",wae,R(x(s)("onboarding.subtitle")),1)])])]),default:_e(()=>[T("section",Sae,[T("div",Cae,R(x(s)("onboarding.languageLabel")),1),oe(Oo,{"model-value":x(o),options:x(TA).map(h=>({value:h.code,label:h.label})),"onUpdate:modelValue":p[0]||(p[0]=h=>c(h))},null,8,["model-value","options"])]),T("section",xae,[T("div",Aae,R(x(s)("theme.colorSchemeLabel")),1),oe(Oo,{"model-value":x(i),options:[{value:"light",label:x(s)("theme.light")},{value:"dark",label:x(s)("theme.dark")},{value:"system",label:x(s)("theme.system")}],"onUpdate:modelValue":p[1]||(p[1]=h=>x(l)(h))},null,8,["model-value","options"])]),T("section",Tae,[T("div",Mae,R(x(s)("theme.accentLabel")),1),oe(Oo,{"model-value":x(r),options:[{value:"blue",label:x(s)("theme.accentBlue")},{value:"mono",label:x(s)("theme.accentBlack")}],"onUpdate:modelValue":p[2]||(p[2]=h=>x(a)(h))},null,8,["model-value","options"])]),oe(Dt,{variant:"primary",size:"lg",class:"ob-start",onClick:u},{default:_e(()=>[qe(R(x(s)("onboarding.start")),1)]),_:1})]),_:1}))}}),Iae=ut(Eae,[["__scopeId","data-v-14f5c46f"]]),$ae=["aria-label"],Nae={class:"gload-box"},Lae={class:"gload-text"},Oae=je({__name:"GlobalLoading",setup(e){const{t}=It();return(n,s)=>(w(),N("div",{class:"gload",role:"status","aria-label":x(t)("app.connecting")},[T("div",Nae,[s[0]||(s[0]=c0('<svg class="gload-logo" viewBox="0 0 96 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" data-v-6b8d58b4><path fill="currentColor" d="M35.767 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304c-.37 0-.671.3-.671.671z" data-v-6b8d58b4></path><path fill="currentColor" d="M90.353 31.329c0 .37.3.671.67.671h4.305c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.672-.671h-4.304a.67.67 0 0 0-.671.671z" data-v-6b8d58b4></path><path fill="currentColor" d="M73.256 0a.67.67 0 0 0-.652.512l-6.366 26.1c-.106.428-.607.428-.71 0L59.159.512A.67.67 0 0 0 58.511 0H47.725c-.37 0-.668.3-.668.671V31.33c0 .37.3.671.67.671h4.781c.37 0 .671-.292.671-.662V5.554c0-.515.604-.622.726-.127l6.358 26.06a.67.67 0 0 0 .653.513h9.931c.31 0 .58-.212.653-.512L77.855 5.43c.122-.495.726-.388.726.127v25.772c0 .37.3.671.671.671h4.78c.371 0 .672-.3.672-.671V.67c0-.37-.3-.671-.671-.671z" data-v-6b8d58b4></path><path fill="currentColor" d="M15.279 14.837 28.264 1.133A.671.671 0 0 0 27.777 0h-6.043a.67.67 0 0 0-.477.199L6.374 15.223c-.231.234-.573.025-.573-.35V.672c0-.37-.3-.671-.671-.671H.67a.67.67 0 0 0-.67.67V31.33c0 .37.3.671.671.671H5.13c.37 0 .671-.3.671-.671v-6.114a.5.5 0 0 1 .13-.35l4.594-4.69a.293.293 0 0 1 .386-.045l12.286 9.305c1.796 1.245 4.083 2.06 6.178 2.401a.645.645 0 0 0 .743-.648v-5.537a.7.7 0 0 0-.562-.677c-1.215-.262-2.565-.758-3.59-1.468L15.332 15.58c-.22-.152-.248-.544-.052-.744" data-v-6b8d58b4></path></svg>',1)),oe(ni,{size:"md",label:x(t)("app.connecting")},null,8,["label"]),T("div",Lae,R(x(t)("app.connecting")),1)])],8,$ae))}}),Pae=ut(Oae,[["__scopeId","data-v-6b8d58b4"]]),Rae={class:"kap-root"},Dae={class:"kap-head"},Bae={class:"kap-count"},Fae={class:"kap-head-actions"},Hae={class:"kap-filters"},Wae=["value"],zae={class:"kap-check"},Uae={class:"kap-check"},qae={class:"kap-view-toggle",role:"group"},jae={key:0,class:"kap-empty"},Vae=["onClick"],Kae={class:"kap-ts"},Gae={class:"kap-label"},Yae={key:0,class:"kap-detail"},Xae={class:"kap-detail-actions"},Qae=["onClick"],Zae={key:1,class:"kap-agg"},Jae={class:"mono"},ece={class:"mono"},tce={class:"num"},nce={class:"num"},sce={key:0},oce={class:"mono"},ice={class:"num"},rce={class:"num"},lce={key:0},ace=je({__name:"KapDebugView",emits:["close"],setup(e,{emit:t}){const n=t,s=Z("all"),o=Z(""),i=Z(""),r=Z(!1),l=Z("timeline"),a=F(()=>(vy.value,[...rG()])),c=F(()=>{const E=new Set;for(const M of a.value)M.sessionId&&E.add(M.sessionId);return[...E].sort()});function u(E){return E.kind==="rest:error"||E.code!==void 0&&E.code!==0||E.eventType==="error"||E.eventType==="parse-error"}const d=F(()=>{const E=o.value.trim().toLowerCase();return a.value.filter(M=>!(s.value!=="all"&&M.source!==s.value||i.value&&M.sessionId!==i.value||r.value&&!u(M)||E&&!`${M.label} ${M.kind} ${M.eventType??""} ${M.sessionId??""} ${M.requestId??""}`.toLowerCase().includes(E)))}),p=F(()=>{const E=new Map;for(const M of d.value){if(M.kind!=="ws:in"&&M.kind!=="ws:out")continue;const L=M.kind==="ws:in"?"←":"→",S=`${L} ${M.eventType??"?"} @ ${M.sessionId??"-"}`,I=E.get(S)??{key:S,sessionId:M.sessionId??"-",eventType:M.eventType??"?",dir:L,count:0};I.count++,M.seq!==void 0&&(I.lastSeq=M.seq),E.set(S,I)}return[...E.values()].sort((M,L)=>L.count-M.count)}),h=F(()=>{const E=new Map;for(const M of d.value){if(M.source!=="rest"||M.kind==="rest:request")continue;const L=`${M.method??"?"} ${M.path??"?"}`,S=E.get(L)??{count:0,errors:0,totalMs:0,timed:0};S.count++,u(M)&&S.errors++,M.durationMs!==void 0&&(S.totalMs+=M.durationMs,S.timed++),E.set(L,S)}return[...E.entries()].map(([M,L])=>({key:M,count:L.count,errors:L.errors,avgMs:L.timed>0?Math.round(L.totalMs/L.timed):0})).sort((M,L)=>L.count-M.count)}),f=Z(null),m=Z(!0),b=Z(null),_=Z(null);Ke(()=>d.value.length,async()=>{if(!m.value||l.value!=="timeline")return;await ht();const E=b.value;E&&(E.scrollTop=E.scrollHeight)});function g(E){f.value=f.value===E?null:E}function v(E){const M=new Date(E),L=(S,I=2)=>String(S).padStart(I,"0");return`${L(M.getHours())}:${L(M.getMinutes())}:${L(M.getSeconds())}.${L(M.getMilliseconds(),3)}`}function y(E){return JSON.stringify(E,null,2)}async function A(E){await zs(y(E))&&(_.value=E.id,setTimeout(()=>{_.value===E.id&&(_.value=null)},1500))}function O(){y3(d.value)}function $(E){return u(E)||E.source==="client"?"b-err":E.source==="rest"?"b-rest":E.kind==="ws:lifecycle"?"b-life":E.kind==="ws:out"?"b-out":"b-in"}function k(E){return E.source==="rest"?"REST":E.source==="client"?"APP":"WS"}return(E,M)=>(w(),N("section",Rae,[T("header",Dae,[M[11]||(M[11]=T("strong",null,"KAP debug",-1)),T("span",Bae,R(d.value.length)+"/"+R(a.value.length),1),T("div",Fae,[T("button",{type:"button",class:Re({on:x(su)}),onClick:M[0]||(M[0]=L=>su.value=!x(su))},R(x(su)?"resume":"pause"),3),T("button",{type:"button",onClick:M[1]||(M[1]=L=>x(lG)())},"clear"),T("button",{type:"button",onClick:M[2]||(M[2]=L=>O())},"export jsonl"),oe(Ht,{text:"Close window"},{default:_e(()=>[T("button",{type:"button",onClick:M[3]||(M[3]=L=>n("close"))},"✕")]),_:1})])]),T("div",Hae,[Mn(T("select",{"onUpdate:modelValue":M[4]||(M[4]=L=>s.value=L),"aria-label":"Source filter"},[...M[12]||(M[12]=[T("option",{value:"all"},"rest + ws + app",-1),T("option",{value:"rest"},"rest",-1),T("option",{value:"ws"},"ws",-1),T("option",{value:"client"},"app errors",-1)])],512),[[Rv,s.value]]),Mn(T("select",{"onUpdate:modelValue":M[5]||(M[5]=L=>i.value=L),"aria-label":"Session filter"},[M[13]||(M[13]=T("option",{value:""},"all sessions",-1)),(w(!0),N(Le,null,nt(c.value,L=>(w(),N("option",{key:L,value:L},R(L),9,Wae))),128))],512),[[Rv,i.value]]),Mn(T("input",{"onUpdate:modelValue":M[6]||(M[6]=L=>o.value=L),type:"text",placeholder:"filter (type / path / id)","aria-label":"Text filter"},null,512),[[ko,o.value]]),T("label",zae,[Mn(T("input",{"onUpdate:modelValue":M[7]||(M[7]=L=>r.value=L),type:"checkbox"},null,512),[[lp,r.value]]),M[14]||(M[14]=qe(" errors",-1))]),T("label",Uae,[Mn(T("input",{"onUpdate:modelValue":M[8]||(M[8]=L=>m.value=L),type:"checkbox"},null,512),[[lp,m.value]]),M[15]||(M[15]=qe(" follow",-1))]),T("div",qae,[T("button",{type:"button",class:Re({on:l.value==="timeline"}),onClick:M[9]||(M[9]=L=>l.value="timeline")},"timeline",2),T("button",{type:"button",class:Re({on:l.value==="aggregate"}),onClick:M[10]||(M[10]=L=>l.value="aggregate")},"aggregate",2)])]),l.value==="timeline"?(w(),N("div",{key:0,ref_key:"listRef",ref:b,class:"kap-list"},[d.value.length===0?(w(),N("div",jae," No trace entries yet. REST calls and WS frames will appear here. ")):ie("",!0),(w(!0),N(Le,null,nt(d.value,L=>(w(),N("div",{key:L.id,class:"kap-row-wrap"},[T("button",{type:"button",class:Re(["kap-row",{expanded:f.value===L.id}]),onClick:S=>g(L.id)},[T("span",Kae,R(v(L.ts)),1),T("span",{class:Re(["kap-badge",$(L)])},R(k(L)),3),T("span",Gae,R(L.label),1)],10,Vae),f.value===L.id?(w(),N("div",Yae,[T("div",Xae,[T("button",{type:"button",onClick:S=>A(L)},R(_.value===L.id?"copied ✓":"copy json"),9,Qae)]),T("pre",null,R(y(L)),1)])):ie("",!0)]))),128))],512)):(w(),N("div",Zae,[M[20]||(M[20]=T("h4",null,"WS frames by session / type",-1)),T("table",null,[M[17]||(M[17]=T("thead",null,[T("tr",null,[T("th",null,"dir"),T("th",null,"type"),T("th",null,"session"),T("th",null,"count"),T("th",null,"last seq")])],-1)),T("tbody",null,[(w(!0),N(Le,null,nt(p.value,L=>(w(),N("tr",{key:L.key},[T("td",null,R(L.dir),1),T("td",Jae,R(L.eventType),1),T("td",ece,R(L.sessionId),1),T("td",tce,R(L.count),1),T("td",nce,R(L.lastSeq??"—"),1)]))),128)),p.value.length===0?(w(),N("tr",sce,[...M[16]||(M[16]=[T("td",{colspan:"5",class:"kap-empty"},"no ws frames",-1)])])):ie("",!0)])]),M[21]||(M[21]=T("h4",null,"REST by endpoint",-1)),T("table",null,[M[19]||(M[19]=T("thead",null,[T("tr",null,[T("th",null,"endpoint"),T("th",null,"count"),T("th",null,"errors"),T("th",null,"avg ms")])],-1)),T("tbody",null,[(w(!0),N(Le,null,nt(h.value,L=>(w(),N("tr",{key:L.key},[T("td",oce,R(L.key),1),T("td",ice,R(L.count),1),T("td",{class:Re(["num",{err:L.errors>0}])},R(L.errors),3),T("td",rce,R(L.avgMs),1)]))),128)),h.value.length===0?(w(),N("tr",lce,[...M[18]||(M[18]=[T("td",{colspan:"4",class:"kap-empty"},"no rest calls",-1)])])):ie("",!0)])])]))]))}}),cce=ut(ace,[["__scopeId","data-v-7f7ba121"]]),uce=je({__name:"DebugPanel",setup(e){const t=Z(!1);let n=null,s=null,o=null;const i=["data-color-scheme","data-accent"];function r(u){const d=document.documentElement,p=u.documentElement;for(const h of i){const f=d.getAttribute(h);f!==null?p.setAttribute(h,f):p.removeAttribute(h)}}function l(u){const d=u.document;d.title="KAP debug";const p=d.createElement("base");p.href=location.href,d.head.appendChild(p);for(const f of Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')))d.head.appendChild(f.cloneNode(!0));r(d),d.body.style.margin="0";const h=d.createElement("div");return h.style.height="100vh",d.body.appendChild(h),h}function a(){o?.disconnect(),o=null;try{s?.unmount()}catch{}s=null,n=null,t.value=!1}function c(){if(n&&!n.closed){n.focus();return}const u=window.open("","kap-debug","popup=yes,width=1040,height=760");if(!u)return;n=u;const d=l(u),p=ap(cce,{onClose:()=>u.close()});p.mount(d),s=p,t.value=!0,o=new MutationObserver(()=>{n&&!n.closed&&r(n.document)}),o.observe(document.documentElement,{attributes:!0,attributeFilter:[...i]}),u.addEventListener("pagehide",a),u.addEventListener("beforeunload",a)}return hn(()=>{c()}),ls(()=>{n&&!n.closed&&n.close(),a()}),(u,d)=>(w(),ve(Ht,{text:t.value?"Focus KAP debug window":"Open KAP debug window"},{default:_e(()=>[T("button",{class:"kap-fab",type:"button",onClick:c}," KAP ")]),_:1},8,["text"]))}}),dce=ut(uce,[["__scopeId","data-v-0b1cbb64"]]);function fce(e){const t=e.split("/").filter(Boolean);return t.length>0?t[t.length-1]:e}function pce(e,t){return e.find(n=>n.root===t.cwd)?.id??t.workspaceId??t.cwd}function hce(e){const{workspaces:t,sessions:n,hiddenWorkspaceRoots:s,activeRoot:o,activeBranch:i,sessionsHasMoreByWorkspace:r}=e,l=new Set(s),a=new Map;for(const h of t)l.has(h.root)||a.has(h.root)||a.set(h.root,{...h});for(const h of n){const f=h.cwd;f&&(l.has(f)||a.has(f)||a.set(f,{id:h.workspaceId??f,root:f,name:fce(f),isGitRepo:!1,sessionCount:0}))}const c=new Map;for(const h of n){const f=pce(t,h);c.set(f,(c.get(f)??0)+1)}const u=[...new Set(t.filter(h=>!l.has(h.root)).map(h=>h.root))],d=[...a.keys()].filter(h=>!u.includes(h));d.sort((h,f)=>h.localeCompare(f));const p=[];for(const h of[...u,...d]){const f=a.get(h),m=c.get(f.id)??c.get(f.root)??0,b=r[f.id]===!1?m:Math.max(f.sessionCount,m);let _=f.branch;!_&&i&&o===f.root&&(_=i),p.push({...f,sessionCount:b,branch:_})}return p}function mce(e){const t=new Map,n=new Set;function s(i){const r=t.get(i);if(r!==void 0)return r;const l=(async()=>e(i))().finally(()=>{t.delete(i),n.delete(i)&&s(i)});return t.set(i,l),l}function o(i){if(t.has(i)){n.add(i);return}s(i)}return{run:s,request:o}}const gce=new Set(["assistantDelta","agentDelta","toolOutput","taskProgress"]);function vce(e){return gce.has(e.type)}function yce(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function kce(e,t,n=yce){let s=[],o=null;const i=()=>{if(o=null,s.length===0)return;const l=s;s=[];for(const a of l)e(a)},r=(l=>{if(t(l)){s.push(l),o===null&&(o=n(i));return}i(),e(l)});return r.flush=i,r}function P3(e,t){const n=Qn(e);return n===null?t:n==="1"}const My=Z(P3(Et.notifyOnComplete,!0)),Ey=Z(P3(Et.notifyOnQuestion,!1)),Iy=Z(typeof Notification<"u"?Notification.permission:"denied");async function R3(e,t,n){if(!n){e.value=!1,ts(t,"0");return}if(typeof Notification>"u")return;let s=Notification.permission;if(s==="default")try{s=await Notification.requestPermission()}catch{}Iy.value=s,s==="granted"&&(e.value=!0,ts(t,"1"))}function bce(e){return R3(My,Et.notifyOnComplete,e)}function _ce(e){return R3(Ey,Et.notifyOnQuestion,e)}function D3(e,t,n,s){if(!e||typeof Notification>"u")return;const o=Notification.permission;if(o!=="denied"){if(o==="default"){Notification.requestPermission().then(i=>{Iy.value=i,i==="granted"&&eC(t,n,s)});return}eC(t,n,s)}}function eC(e,t,n){if(e.isActiveAndVisible)return;const s=e.sessionTitle.trim()||"BLUN King";try{const o=new Notification(s,{body:t,tag:n});o.onclick=()=>{try{window.focus()}catch{}e.onClick(),o.close()}}catch{}}function wce(e,t){D3(My.value,t,Un.global.t("settings.notifyBody"),`blun-complete-${e}`)}function Sce(e,t){const n=t.questionPreview||Un.global.t("settings.notifyQuestionBody");D3(Ey.value,t,n,`blun-question-${e}`)}function Cce(){return{notifyOnComplete:My,notifyOnQuestion:Ey,notifyPermission:Iy,setNotifyOnComplete:bce,setNotifyOnQuestion:_ce,maybeNotifyCompletion:wce,maybeNotifyQuestion:Sce}}function xce(){return Qn(Et.soundOnComplete)==="1"}const pd=Z(xce());function Ace(){if(typeof window>"u")return;const e=window;return window.AudioContext??e.webkitAudioContext}let fv=null;function B3(){const e=Ace();if(!e)return null;if(fv===null)try{fv=new e}catch{return null}return fv}function F3(){if(!pd.value)return;const e=B3();e!==null&&e.state==="suspended"&&e.resume().then(()=>{Or("sound: audio context resumed",{state:e.state})},t=>{Or("sound: audio context resume rejected",{error:String(t)})})}let tC=!1;function Tce(){if(tC||typeof window>"u")return;tC=!0;const e=()=>{F3()};window.addEventListener("pointerdown",e,{capture:!0}),window.addEventListener("keydown",e,{capture:!0})}Tce();function Mce(e){pd.value=e,ts(Et.soundOnComplete,e?"1":"0"),e&&F3()}function nC(e,t,n,s,o){const i=e.createOscillator(),r=e.createGain();i.type="sine",i.frequency.value=t,i.connect(r),r.connect(e.destination);const l=e.currentTime+n;r.gain.setValueAtTime(1e-4,l),r.gain.exponentialRampToValueAtTime(o,l+.01),r.gain.exponentialRampToValueAtTime(1e-4,l+s),i.start(l),i.stop(l+s+.02)}function H3(){const e=B3();if(e===null){Or("sound: skipped, AudioContext unavailable");return}if(e.state!=="running"){Or("sound: skipped, context not running",{state:e.state}),e.state==="suspended"&&e.resume().then(()=>{Or("sound: context resumed for next time",{state:e.state})},t=>{Or("sound: resume rejected",{error:String(t)})});return}try{nC(e,880,0,.16,.18),nC(e,1320,.1,.22,.16),Or("sound: chime scheduled",{state:e.state})}catch(t){Or("sound: failed to play",{error:String(t)})}}function Ece(){pd.value&&H3()}function Ice(){pd.value&&H3()}function $ce(){return{soundOnComplete:pd,setSoundOnComplete:Mce,maybePlayCompletionSound:Ece,maybePlayQuestionSound:Ice}}function sC(e,t){const n=new Set(e.map(o=>o.id)),s=t.filter(o=>o.kind==="subagent"&&!n.has(o.id));return s.length===0?e:[...e,...s]}const Nce=1e3,Lce=4096,oC=32*1024;function Oce(e,t){let n=null,s;const o=new Set;async function i(p){try{const f=await dt().listTasks(p);e.tasksBySession={...e.tasksBySession,[p]:sC(f,e.tasksBySession[p]??[])},await r(p,f)}catch{}}async function r(p,h){if(e.activeSessionId!==p)return;const f=h??e.tasksBySession[p]??[],m=dt(),b=new Map;if(await Promise.all(f.map(async g=>{if((g.status==="completed"||g.status==="failed"||g.status==="cancelled")&&!o.has(g.id)&&!((g.outputLines?.length??0)>0))try{const y=await m.getTask(p,g.id,{withOutput:!0,outputBytes:oC});y.outputPreview!==void 0&&b.set(g.id,{preview:y.outputPreview,bytes:y.outputBytes})}catch{}finally{o.add(g.id)}})),b.size===0)return;const _=e.tasksBySession[p]??[];e.tasksBySession={...e.tasksBySession,[p]:_.map(g=>{const v=b.get(g.id);return v?{...g,outputPreview:v.preview,outputBytes:v.bytes}:g})}}async function l(p){if(e.activeSessionId!==p)return;const h=dt();let f;try{f=await h.listTasks(p)}catch{return}const m=new Map;await Promise.all(f.map(async v=>{const y=v.status==="running",A=v.status==="completed"||v.status==="failed"||v.status==="cancelled";if(!(!y&&!A)&&!(A&&(o.has(v.id)||(v.outputLines?.length??0)>0)))try{const O=await h.getTask(p,v.id,{withOutput:!0,outputBytes:y?Lce:oC});O.outputPreview!==void 0&&m.set(v.id,{preview:O.outputPreview,bytes:O.outputBytes})}catch{}finally{A&&o.add(v.id)}}));const b=e.tasksBySession[p]??[],_=new Map(b.map(v=>[v.id,v])),g=f.map(v=>{const y=_.get(v.id),A=m.get(v.id);return{...v,outputLines:y?.outputLines,text:y?.text,outputPreview:A?.preview??y?.outputPreview,outputBytes:A?.bytes??y?.outputBytes}});e.tasksBySession={...e.tasksBySession,[p]:sC(g,b)}}function a(p){n!==null&&s===p||(c(),s=p,l(p),n=setInterval(()=>{typeof document<"u"&&document.visibilityState==="hidden"||(e.activeSessionId===p?l(p):c())},Nce))}function c(){n!==null&&(clearInterval(n),n=null),s=void 0,o.clear()}const u=Z(0);let d=null;return Ke(()=>t.value.some(p=>p.status==="running"),p=>{p&&d===null?d=setInterval(()=>{u.value=(u.value+1)%Number.MAX_SAFE_INTEGER},1e3):!p&&d!==null&&(clearInterval(d),d=null)},{immediate:!0}),Ke(()=>{const p=e.activeSessionId;if(!p)return{sid:void 0,hasRunning:!1};const h=e.tasksBySession[p]??[];return{sid:p,hasRunning:h.some(f=>f.status==="running")}},({sid:p,hasRunning:h},f,m)=>{let b;h&&p!==void 0?a(p):p!==void 0?b=setTimeout(()=>{(e.tasksBySession[p]??[]).some(g=>g.status==="running")||c()},1500):c(),m(()=>{b!==void 0&&clearTimeout(b)})},{deep:!0,immediate:!0}),{taskClock:F(()=>u.value),loadTasksForSession:i}}const W3=Et.starredModels;function Pce(){try{const e=Qn(W3);if(!e)return[];const t=JSON.parse(e);if(Array.isArray(t)&&t.every(n=>typeof n=="string"))return t}catch{}return[]}function Rce(e){try{ts(W3,JSON.stringify(e))}catch{}}function Dce(e,t){const{pushOperationFailure:n,refreshSessionStatus:s,persistSessionProfile:o,activity:i,inFlightPromptSessions:r,saveThinkingToStorage:l,updateSession:a,updateSessionMessages:c}=t,u=Z([]),d=Z(Pce()),p=Z({}),h=Z([]),f=Z(null);function m(z){if(!(z==null||z.length===0))return u.value.find(q=>q.id===z||q.model===z)}function b(){const z=e.activeSessionId?e.sessions.find(q=>q.id===e.activeSessionId):void 0;return m(z?.model??f.value??e.defaultModel)}function _(z){const q=fc(b(),z);return e.thinking=q,l(q),q}async function g(z){try{const Q=await dt().listSkills(z);p.value={...p.value,[z]:Q}}catch{}}async function v(){try{const z=dt();u.value=await z.listModels(),_(e.thinking)}catch(z){n("loadModels",z)}}async function y(){try{const z=await dt().refreshOAuthProviderModels();for(const q of z.failed)n("refreshOAuthProviderModels",new Error(q.reason),{message:q.provider})}catch{}}async function A(){try{const z=dt();h.value=await z.listProviders()}catch(z){n("loadProviders",z)}}async function O(z){const q=e.activeSessionId,Q=fc(m(z),e.thinking),X=e.thinking;if(!q){f.value=z,_(Q);return}const fe=e.sessions.find(ye=>ye.id===q)?.model;a(q,ye=>({...ye,model:z})),Q!==X&&(e.thinking=Q,l(Q));try{await dt().updateSession(q,{model:z,thinking:Q!==X?Q:void 0})}catch(ye){a(q,Me=>({...Me,model:fe??Me.model})),Q!==X&&(e.thinking=X,l(X)),n("setModel",ye,{sessionId:q});return}await s(q)}function $(z){const q=new Set(d.value);q.has(z)?q.delete(z):q.add(z),d.value=Array.from(q),Rce(d.value)}async function k(z,q){const Q=e.activeSessionId;if(!Q)return;const X=i.value==="idle"&&!r.has(Q),fe=`msg_skill_opt_${Date.now().toString(36)}`;if(X){r.add(Q),e.sendingBySession={...e.sendingBySession,[Q]:!0};const ye={id:fe,sessionId:Q,role:"user",content:[{type:"text",text:`/${z}${q?` ${q}`:""}`}],createdAt:new Date().toISOString(),metadata:{"blunWeb.optimisticUserMessage":!0,origin:{kind:"skill_activation",trigger:"user-slash",skillName:z,skillArgs:q}}};c(Q,Me=>[...Me,ye])}try{await dt().activateSkill(Q,z,q)}catch(ye){X&&(r.delete(Q),e.sendingBySession={...e.sendingBySession,[Q]:!1},c(Q,Me=>Me.filter(we=>we.id!==fe))),n("activateSkill",ye,{sessionId:Q})}}async function E(z){try{await dt().addProvider(z),await Promise.all([A(),v()])}catch(q){n("addProvider",q)}}async function M(z){try{await dt().deleteProvider(z),await Promise.all([A(),v()])}catch(q){n("deleteProvider",q)}}async function L(z){try{const q=await dt().refreshProvider(z);for(const Q of q.failed)n("refreshProvider",new Error(Q.reason),{message:Q.provider});await Promise.all([A(),v()])}catch(q){n("refreshProvider",q)}}async function S(){try{const z=await dt().refreshAllProviders();for(const q of z.failed)n("refreshAllProviders",new Error(q.reason),{message:q.provider});await Promise.all([A(),v()])}catch(z){n("refreshAllProviders",z)}}async function I(){try{return await dt().startOAuthLogin()}catch{return null}}async function P(){try{return await dt().pollOAuthLogin()}catch{return null}}async function D(){try{await dt().cancelOAuthLogin()}catch{}}function W(z){const q=_(z);o({thinking:q})}return{models:u,starredModelIds:d,providers:h,draftModel:f,skillsBySession:p,loadSkillsForSession:g,loadModels:v,refreshOAuthProviderModels:y,loadProviders:A,setModel:O,toggleStarModel:$,activateSkill:k,addProvider:E,deleteProvider:M,refreshProvider:L,refreshAllProviders:S,startOAuthLogin:I,pollOAuthLogin:P,cancelOAuthLogin:D,setThinking:W}}const z3="blunWeb.compaction",Bce=["queued","working","suspended","completed","failed"];function U3(e){return e.status==="completed"?"completed":e.status==="failed"||e.status==="cancelled"?"failed":e.subagentPhase?e.subagentPhase:"working"}function Fce(){return{queued:0,working:0,suspended:0,completed:0,failed:0}}function Hce(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||n.swarmIndex===void 0)continue;const s=n.parentToolCallId??"swarm",o=t.get(s)??[];o.push({id:n.id,name:n.description,subagentType:n.subagentType,phase:U3(n),summary:n.outputPreview,outputLines:n.outputLines,suspendedReason:n.suspendedReason,swarmIndex:n.swarmIndex}),t.set(s,o)}return[...t.entries()].map(([n,s])=>{const o=s.toSorted((r,l)=>r.swarmIndex-l.swarmIndex||r.id.localeCompare(l.id)),i=Fce();for(const r of o)i[r.phase]++;return{id:n,members:o,counts:i}}).filter(n=>n.members.length>1).toSorted((n,s)=>{const o=n.members.at(0)?.swarmIndex??0,i=s.members.at(0)?.swarmIndex??0;return o!==i?o-i:n.id.localeCompare(s.id)})}function Wce(e){let t=0,n=0;for(const s of e){n+=s.members.length;for(const o of Bce)(o==="completed"||o==="failed")&&(t+=s.counts[o])}return{done:t,total:n}}const zce=/^read[_-]?media(?:file)?$/i,Uce=/^data:([^;]+);base64,(.*)$/s,qce=/^<(image|video|audio)\s+path="([^"]+)">$/,jce=/^<(image|video|audio)\s+path="([^"]+)">(?:<\/\1>)?$/,Vce=/Mime type:\s*([^.\s]+)/i,Kce=/Size:\s*(\d+)\s*bytes/i,Gce=/Original dimensions:\s*(\d+)x(\d+)\s*pixels/i;function Yce(e){return e.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function Xce(e){const t=jce.exec(e.trim());return t?{kind:t[1],path:Yce(t[2])}:null}const Qce=/^f_[A-Za-z0-9]{10,}$/;function Zce(e){const t=e.split(/[\\/]/).at(-1)??"",n=t.lastIndexOf("."),s=n>0?t.slice(0,n):t;return Qce.test(s)?s:void 0}function Jce(e){if(e.length===0)return 0;const t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function eue(e){if(Array.isArray(e))return e;if(typeof e!="string")return null;try{const t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function tue(e){const t=e.type,n=t==="image_url"?"image":t==="video_url"?"video":t==="audio_url"?"audio":null;if(n===null)return null;const o=e[n==="image"?"imageUrl":n==="video"?"videoUrl":"audioUrl"];if(typeof o!="object"||o===null)return null;const i=o.url;return typeof i=="string"?{kind:n,url:i}:null}function nue(e,t){if(!zce.test(e))return;const n=eue(t);if(n===null)return;let s,o,i,r,l,a=null;for(const u of n){if(typeof u!="object"||u===null)continue;const d=u;if(d.type==="text"&&typeof d.text=="string"){const h=d.text,f=qce.exec(h);f&&(o=f[1],s=f[2]);const m=Vce.exec(h);m?.[1]&&(i=m[1]);const b=Kce.exec(h);b?.[1]&&(r=Number(b[1]));const _=Gce.exec(h);_?.[1]&&_[2]&&(l=`${_[1]}x${_[2]}`);continue}const p=tue(d);p&&(a=p)}if(a===null)return;const c=Uce.exec(a.url);return c?.[1]&&(i=c[1]),c?.[2]&&(r=Jce(c[2])),{kind:a.kind??o??"image",url:a.url,path:s,mimeType:i,bytes:Number.isFinite(r)?r:void 0,dimensions:l}}function sue(e){if(e!=null){if(typeof e=="string")return e.split(`
|
|
262
262
|
`);if(Array.isArray(e)){const t=[];for(const n of e)if(typeof n=="string")t.push(...n.split(`
|
|
263
263
|
`));else if(n&&typeof n=="object"){const s=n;s.type==="text"&&typeof s.text=="string"?t.push(...s.text.split(`
|
|
264
264
|
`)):s.type==="think"&&typeof s.think=="string"?t.push(...s.think.split(`
|
|
@@ -276,4 +276,4 @@ ${H}`)}const U=le.join(`
|
|
|
276
276
|
`);if(a.value==="idle"&&!c.has(xe)){await $n(xe,Vt,at);return}const qt=[];Vt&&qt.push({type:"text",text:Vt});for(const nn of at)nn.kind==="video"?qt.push({type:"video",source:{kind:"file",fileId:nn.fileId}}):qt.push({type:"image",source:{kind:"file",fileId:nn.fileId}});const Bo=g(),Fo={id:Bo,sessionId:xe,role:"user",content:qt,createdAt:new Date().toISOString(),metadata:{"blunWeb.optimisticUserMessage":!0}};_(xe,nn=>[...nn,Fo]);try{const nn=dt(),Jn=e.sessions.find(Ps=>Ps.id===xe),Fn=(Jn?.model&&Jn.model.length>0?Jn.model:e.defaultModel)??void 0,Ss=await nn.submitPrompt(xe,{content:qt,model:Fn,thinking:Kn(Fn),permissionMode:e.permission,planMode:e.planModeBySession[xe]??!1,swarmMode:e.swarmModeBySession[xe]??!1});if(_(xe,Ps=>{const fs=Ps.findIndex(cl=>cl.id===Bo);if(fs===-1)return Ps;const Cs=[...Ps];return Cs[fs]={...Cs[fs],promptId:Cs[fs].promptId??Ss.promptId},Cs}),Ss.status!=="queued"){e.promptIdBySession={...e.promptIdBySession,[xe]:Ss.promptId},v()?.bindNextPromptId(xe,Ss.promptId);return}try{await nn.steerPrompts(xe,[Ss.promptId])}catch{}}catch(nn){_(xe,Jn=>Jn.filter(Fn=>Fn.id!==Bo)),l("steer",nn,{sessionId:xe})}}async function Ct(se,Ce){try{const Be=await dt().uploadFile({file:se,name:Ce});return{fileId:Be.id,name:Be.name,mediaType:Be.mediaType}}catch(xe){return l("uploadImage",xe),null}}function $t(se,Ce){const xe=e.activeSessionId;if(!xe)return;const Be=e.queuedBySession[xe]??[];e.queuedBySession={...e.queuedBySession,[xe]:[...Be,{text:se,attachments:Ce}]}}async function mn(){const se=e.activeSessionId;if(!se)return;const Ce=e.sessions.find(et=>et.id===se);let xe=e.promptIdBySession[se];if(xe===void 0){const et=Ce?.currentPromptId;et?.startsWith("prompt_")&&(xe=et)}const Be=dt();if(xe!==void 0)try{if((await Be.abortPrompt(se,xe)).aborted)return;const at={...e.promptIdBySession};delete at[se],e.promptIdBySession=at}catch(et){if(el(et)&&et.code===vue){const at={...e.promptIdBySession};delete at[se],e.promptIdBySession=at}else{l("abortCurrentPrompt",et,{sessionId:se});return}}try{await Be.abortSession(se)}catch(et){l("abortCurrentPrompt",et,{sessionId:se})}}function Nn(se,Ce){const xe=e.approvalsBySession[se]??[];e.approvalsBySession={...e.approvalsBySession,[se]:xe.filter(Be=>Be.approvalId!==Ce)}}function tn(se,Ce){const xe=e.questionsBySession[se]??[];e.questionsBySession={...e.questionsBySession,[se]:xe.filter(Be=>Be.questionId!==Ce)}}async function Ln(se,Ce){const xe=e.activeSessionId;if(xe&&!kf[se]){kf[se]=!0;try{const Be=dt(),et={decision:Ce.decision,scope:Ce.scope,feedback:Ce.feedback,selectedLabel:Ce.selectedLabel};await Be.respondApproval(xe,se,et),Nn(xe,se)}catch(Be){pv(Be)?Nn(xe,se):l("respondApproval",Be,{sessionId:xe})}finally{delete kf[se]}}}async function Zn(se,Ce){const xe=e.activeSessionId;if(xe&&!Ml[se]){Ml[se]="answer";try{await dt().respondQuestion(xe,se,Ce),tn(xe,se)}catch(Be){pv(Be)?tn(xe,se):l("respondQuestion",Be,{sessionId:xe})}finally{delete Ml[se]}}}async function Mt(se){const Ce=e.activeSessionId;if(Ce&&!Ml[se]){Ml[se]="dismiss";try{await dt().dismissQuestion(Ce,se),tn(Ce,se)}catch(xe){pv(xe)?tn(Ce,se):l("dismissQuestion",xe,{sessionId:Ce})}finally{delete Ml[se]}}}async function us(se){const Ce=e.activeSessionId;if(Ce&&!hv[se]){hv[se]=!0;try{await dt().cancelTask(Ce,se);const Be=e.tasksBySession[Ce]??[];e.tasksBySession={...e.tasksBySession,[Ce]:Be.map(et=>et.id===se?{...et,status:"cancelled"}:et)}}catch(xe){_ue(xe)||l("cancelTask",xe,{sessionId:Ce})}finally{delete hv[se]}}}function Xt(se){const Ce=e.activeSessionId;Ce?(e.planModeBySession={...e.planModeBySession,[Ce]:se},P(),k({planMode:se})):z.planMode=se}function oi(){const se=e.activeSessionId,Ce=se?e.planModeBySession[se]??!1:z.planMode;Xt(!Ce)}function bs(se){const Ce=e.activeSessionId;Ce?(e.swarmModeBySession={...e.swarmModeBySession,[Ce]:se},D(),k({swarmMode:se})):z.swarmMode=se}async function Do(){const se=e.activeSessionId,xe=!(se?e.swarmModeBySession[se]??!1:z.swarmMode);xe&&e.permission==="manual"&&!await s({title:n("workspace.swarmEnableConfirm"),variant:"primary"})||bs(xe)}function so(se){const Ce=e.activeSessionId;Ce?(e.goalModeBySession={...e.goalModeBySession,[Ce]:se},W()):z.goalMode=se}function qs(){const se=e.activeSessionId,Ce=se?e.goalModeBySession[se]??!1:z.goalMode;so(!Ce)}async function oo(se){const Ce=se.trim();if(!Ce||e.permission==="manual"&&!await s({title:n("workspace.goalStartConfirm",{objective:Ce}),variant:"primary"}))return;const xe=e.activeSessionId;if(xe){try{await dt().updateSession(xe,{goalObjective:Ce})}catch(Be){l("createGoal",Be,{sessionId:xe,message:fe(Be)});return}await Ge(Ce)}}function Nt(se){const Ce=e.activeSessionId;Ce&&Promise.resolve(dt().updateSession(Ce,{goalControl:se})).catch(xe=>{l("controlGoal",xe,{sessionId:Ce,message:fe(xe)})})}function Xe(se){e.permission=se,I(se),k({permissionMode:se})}function ot(se){const Ce=[...e.warnings];Ce.splice(se,1),e.warnings=Ce}async function de(se,Ce){try{await dt().updateSession(se,{title:Ce}),p(se,Be=>({...Be,title:Ce}))}catch(xe){l("renameSession",xe,{sessionId:se})}}async function pe(se,Ce){const xe=e.workspaces.find(et=>et.id===se)?.root,Be=()=>{e.workspaces=e.workspaces.map(et=>et.id===se?{...et,name:Ce}:et)};try{if(await dt().updateWorkspace(se,{name:Ce}),xe!==void 0){const et=Zd();xe in et&&(delete et[xe],A_(et))}Be()}catch(et){if(xe!==void 0&&el(et)&&et.code===yue){A_({...Zd(),[xe]:Ce}),Be();return}l("renameWorkspace",et)}}async function Oe(se){const Ce=e.workspaces.find(at=>at.id===se)?.root??E.value.find(at=>at.id===se)?.root??se,xe=e.activeSessionId?e.sessions.find(at=>at.id===e.activeSessionId):void 0,Be=e.activeWorkspaceId===se||e.activeWorkspaceId===Ce,et=!!(xe&&(xe.cwd===Ce||xe.workspaceId===se||S(xe)===se));Ce&&!e.hiddenWorkspaceRoots.includes(Ce)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,Ce],X(e.hiddenWorkspaceRoots));try{await dt().deleteWorkspace(se)}catch{}if(e.workspaces=e.workspaces.filter(at=>at.id!==se&&at.root!==Ce),Be||et){const at=M.value[0]?.id??null;if(e.activeWorkspaceId=at,at)Q(at);else try{cc(Et.activeWorkspace)}catch{}}(Be||et)&&(b(void 0),e.sessionLoading=!1,U(),Ft(void 0,"replace"))}async function Qt(se){try{await dt().archiveSession(se),m(se),i.clearSideChatForSession(se);const{[se]:xe,...Be}=e.sideChatUserMessageIdsBySession;if(e.sideChatUserMessageIdsBySession=Be,e.activeSessionId===se){const et=e.sessions[0];et?await _n(et.id,{urlMode:"replace"}):(b(void 0),Ft(void 0,"replace"))}}catch(Ce){l("archiveSession",Ce,{sessionId:se})}}async function Wt(){try{await dt().logout(),await ne(),await Ie()}catch(se){l("logout",se)}}function ds(se){const Ce=e.activeSessionId;Ce&&dt().compactSession(Ce,se).catch(xe=>{l("compact",xe,{sessionId:Ce})})}async function Bn(se){const Ce=se??e.activeSessionId;if(Ce)try{const xe=await dt().forkSession(Ce);h(xe),await _n(xe.id)}catch(xe){l("fork",xe,{sessionId:Ce})}}async function bo(se=1){const Ce=e.activeSessionId;if(!Ce)return null;const xe=(()=>{const Be=e.messagesBySession[Ce]??[];for(let et=Be.length-1;et>=0;et--){const at=Be[et];if(at.role==="user"&&!(at.metadata?.origin&&at.metadata.origin.kind!=="user"))return at.content.filter(Ot=>Ot.type==="text").map(Ot=>Ot.text).join(`
|
|
277
277
|
`)}return null})();try{return await dt().undoSession(Ce,se),await y(Ce),xe}catch(Be){return l("undo",Be,{sessionId:Ce}),null}}function ii(se){const Ce=e.activeSessionId;if(!Ce)return;const xe=e.queuedBySession[Ce]??[];if(se<0||se>=xe.length)return;const Be=[...xe];Be.splice(se,1),e.queuedBySession={...e.queuedBySession,[Ce]:Be}}function _s(se,Ce){const xe=e.activeSessionId;if(!xe)return;const Be=e.queuedBySession[xe]??[];if(se===Ce||se<0||se>=Be.length||Ce<0||Ce>=Be.length)return;const et=[...Be],[at]=et.splice(se,1);at!==void 0&&(et.splice(Ce,0,at),e.queuedBySession={...e.queuedBySession,[xe]:et})}async function ta(se){const Ce=e.activeSessionId;if(!Ce)return[];try{return(await dt().listDirectory(Ce,{path:se,includeGitStatus:!0})).items}catch{return[]}}async function ll(se){const Ce=e.activeSessionId;if(!Ce)return null;try{const Be=await dt().readFile(Ce,{path:se});return{path:Be.path,content:Be.content,encoding:Be.encoding,mime:Be.mime,languageId:Be.languageId,isBinary:Be.isBinary,size:Be.size,lineCount:Be.lineCount}}catch{return null}}const al=10485760;function Os(se){const Ce=e.activeSessionId;return Ce?dt().getFileDownloadUrl(Ce,se):null}async function ft(se,Ce){const xe=e.activeSessionId;if(!xe)return!1;try{return await dt().openFile(xe,{path:se,line:Ce}),!0}catch(Be){return l("openFile",Be,{sessionId:xe}),!1}}async function me(se){const Ce=e.activeSessionId;if(!Ce)return;const xe=L.value.cwd||".";try{await dt().openInApp(Ce,se,xe)}catch(Be){l("openInApp",Be,{sessionId:Ce})}}async function Ne(se){const Ce=e.activeSessionId;if(!Ce)return!1;try{return await dt().revealFile(Ce,{path:se}),!0}catch(xe){return l("revealFile",xe,{sessionId:Ce}),!1}}async function xn(se){if(/^(https?:|data:|blob:)/i.test(se))return se;const Ce=e.activeSessionId;if(!Ce)return se;let xe=se;if(xe.startsWith("/")){const Be=e.sessions.find(et=>et.id===Ce)?.cwd;if(Be&&(xe===Be||xe.startsWith(Be.endsWith("/")?Be:`${Be}/`))){if(xe=xe.slice(Be.length).replace(/^\//,""),!xe)return se}else return se}try{const et=await dt().readFile(Ce,{path:xe,length:al});return!et.isBinary||et.encoding!=="base64"||et.truncated?se:`data:${et.mime};base64,${et.content}`}catch{return se}}async function ws(se){const Ce=e.activeSessionId;if(!Ce)return[];try{return(await dt().searchFiles(Ce,{query:se,limit:20})).items.map(et=>({path:et.path,name:et.name}))}catch{return[]}}return{loadFileDiff:le,clearFileDiff:U,loadGitStatus:G,checkAuth:ne,loadConfig:H,updateConfig:J,listAllSessionsGlobal:j,load:Ie,loadWorkspaces:ae,loadMoreSessions:ge,loadAllSessions:Ae,selectWorkspace:Ve,openWorkspace:tt,upsertWorkspacePreserveOrder:bt,applyWorkspaceEvent:kt,clearActiveSession:Tt,openWorkspaceDraft:Pt,startSessionAndSendPrompt:mt,addWorkspaceByPath:Yt,browseFs:Rn,getFsHome:Dn,writeSessionUrl:Ft,fetchSessionIntoList:bn,onSessionRoutePopState:Vn,bindSessionRoute:In,selectSession:_n,submitPromptInternal:$n,sendPrompt:Ge,steerPrompt:Ye,uploadImage:Ct,enqueue:$t,unqueue:ii,reorderQueue:_s,abortCurrentPrompt:mn,respondApproval:Ln,respondQuestion:Zn,dismissQuestion:Mt,pendingQuestionActions:Ml,pendingApprovalActions:kf,cancelTask:us,setPlanMode:Xt,togglePlanMode:oi,setSwarmMode:bs,toggleSwarmMode:Do,setGoalMode:so,toggleGoalMode:qs,createGoal:oo,controlGoal:Nt,setPermission:Xe,dismissWarning:ot,renameSession:de,renameWorkspace:pe,deleteWorkspace:Oe,archiveSession:Qt,logout:Wt,compact:ds,forkSession:Bn,undo:bo,listDir:ta,readFileContent:ll,getFileDownloadUrl:Os,openWorkspaceFile:ft,openInApp:me,revealWorkspaceFile:Ne,resolveImageUrl:xn,searchFiles:ws,loadOlderMessages:Fe,refreshSessionSidecars:rt}}const Sue="blunWeb.optimisticUserMessage";function Cue(){return{sessions:[],activeSessionId:void 0,messagesBySession:{},approvalsBySession:{},planReviewByToolCallId:{},questionsBySession:{},tasksBySession:{},goalBySession:{},lastSeqBySession:{},compactionBySession:{},warnings:[]}}function xue(e){return{...e,sessions:e.sessions,messagesBySession:{...e.messagesBySession},approvalsBySession:{...e.approvalsBySession},planReviewByToolCallId:{...e.planReviewByToolCallId},questionsBySession:{...e.questionsBySession},tasksBySession:{...e.tasksBySession},goalBySession:{...e.goalBySession},lastSeqBySession:{...e.lastSeqBySession},compactionBySession:{...e.compactionBySession},warnings:[...e.warnings]}}function Aue(e,t,n){if(t!==void 0&&n!==void 0&&n>0){const s=e.lastSeqBySession[t]??0;n>s&&(e.lastSeqBySession[t]=n)}}function mv(e){return e.role==="user"&&e.metadata?.[Sue]===!0}function Tue(e,t){return JSON.stringify(e.content)===JSON.stringify(t.content)}const Mue=/^<(image|video|audio)\s+path="[^"]+"><\/\1>$/;function rC(e){let t="",n=0;for(const s of e.content)s.type==="text"?Mue.test(s.text.trim())?n+=1:t+=s.text:(s.type==="image"||s.type==="video"||s.type==="file")&&(n+=1);return{text:t,media:n}}function Eue(e,t){const n=rC(e),s=rC(t);return n.text===s.text&&n.media===s.media}function Iue(e,t){const n=t.promptId;if(n!==void 0)for(let s=e.length-1;s>=0;s--){const o=e[s];if(mv(o)&&o.promptId===n)return s}for(let s=e.length-1;s>=0;s--){const o=e[s];if(mv(o)&&Tue(o,t))return s}for(let s=e.length-1;s>=0;s--){const o=e[s];if(mv(o)&&Eue(o,t))return s}return-1}function $ue(e,t,n){let s=!1;const o=e.map(i=>{let r=!1;const l=i.content.map(a=>a.type!=="toolUse"||a.toolCallId!==t?a:(r=!0,{...a,outputLines:[...a.outputLines??[],n]}));return r?(s=!0,{...i,content:l}):i});return s?o:e}function Nue(e,t,n){const s=xue(e);switch(Aue(s,n.sessionId,n.seq),t.type){case"sessionCreated":{s.sessions.some(i=>i.id===t.session.id)||(s.sessions=[t.session,...s.sessions]);break}case"sessionUpdated":{s.sessions=s.sessions.map(o=>o.id===t.session.id?t.session:o);break}case"sessionDeleted":{const o=t.sessionId;s.sessions=s.sessions.filter(i=>i.id!==o),delete s.messagesBySession[o],delete s.tasksBySession[o],delete s.goalBySession[o],delete s.approvalsBySession[o],delete s.questionsBySession[o],delete s.lastSeqBySession[o],s.activeSessionId===o&&(s.activeSessionId=void 0);break}case"sessionStatusChanged":{s.sessions=s.sessions.map(o=>o.id!==t.sessionId?o:{...o,status:t.status,currentPromptId:t.currentPromptId});break}case"sessionMetaUpdated":{s.sessions=s.sessions.map(o=>o.id===t.sessionId?{...o,title:t.title??o.title,lastPrompt:t.lastPrompt??o.lastPrompt}:o);break}case"sessionUsageUpdated":{s.sessions=s.sessions.map(o=>{if(o.id!==t.sessionId)return o;const i=t.model&&t.model.length>0?t.model:o.model;return{...o,usage:t.usage,model:i}});break}case"historyCompacted":break;case"compactionStarted":{s.compactionBySession={...s.compactionBySession,[t.sessionId]:{status:"running",trigger:t.trigger}};break}case"compactionCompleted":{const o=t.sessionId,i=s.compactionBySession[o],{[o]:r,...l}=s.compactionBySession;if(s.compactionBySession=l,Object.prototype.hasOwnProperty.call(s.messagesBySession,o)){const a=s.messagesBySession[o]??[],c=`compaction_${o}_${n.seq}`;if(!a.some(u=>u.id===c)){const u={trigger:i?.trigger??"auto",tokensBefore:t.tokensBefore,tokensAfter:t.tokensAfter};s.messagesBySession[o]=[...a,{id:c,sessionId:o,role:"assistant",content:t.summary?[{type:"text",text:t.summary}]:[],createdAt:new Date().toISOString(),metadata:{origin:{kind:"compaction_summary"},[z3]:u}}]}}break}case"compactionCancelled":{const{[t.sessionId]:o,...i}=s.compactionBySession;s.compactionBySession=i;break}case"messageCreated":{const o=t.message.sessionId,i=t.message.createdAt;s.sessions=s.sessions.map(a=>a.id===o&&i>a.updatedAt?{...a,updatedAt:i}:a);const r=s.messagesBySession[o]??[];if(!r.some(a=>a.id===t.message.id)){if(t.message.role==="user"){const a=Iue(r,t.message);if(a!==-1){const c=[...r],u=c[a];c[a]={...t.message,id:u.id,promptId:t.message.promptId??u.promptId,metadata:{...t.message.metadata,...u.metadata}},s.messagesBySession[o]=c;break}}s.messagesBySession[o]=[...r,t.message]}break}case"messageUpdated":{const o=t.sessionId,i=s.messagesBySession[o]??[];s.messagesBySession[o]=i.map(r=>r.id!==t.messageId?r:{...r,content:t.content,durationMs:t.durationMs??r.durationMs});break}case"assistantDelta":{const o=t.sessionId,i=s.messagesBySession[o]??[];s.messagesBySession[o]=i.map(r=>{if(r.id!==t.messageId)return r;const l=[...r.content],a=t.contentIndex;for(;l.length<=a;)l.push({type:"text",text:""});const c=l[a];let u;return t.delta.text!==void 0?c.type==="text"?u={type:"text",text:c.text+t.delta.text}:u={type:"text",text:t.delta.text}:t.delta.thinking!==void 0?c.type==="thinking"?u={type:"thinking",thinking:c.thinking+t.delta.thinking,signature:c.signature}:u={type:"thinking",thinking:t.delta.thinking}:u=c,l[a]=u,{...r,content:l}});break}case"toolOutput":{const o=t.sessionId,i=s.messagesBySession[o]??[];s.messagesBySession[o]=$ue(i,t.toolCallId,t.outputChunk);break}case"approvalRequested":{const o=t.sessionId,i=s.approvalsBySession[o]??[];i.some(a=>a.approvalId===t.approval.approvalId)||(s.approvalsBySession[o]=[...i,t.approval]);const l=t.approval.display;l?.kind==="plan_review"&&typeof l.plan=="string"&&l.plan.length>0&&(s.planReviewByToolCallId={...s.planReviewByToolCallId,[t.approval.toolCallId]:{plan:l.plan,path:typeof l.path=="string"?l.path:void 0}});break}case"approvalResolved":case"approvalExpired":{const o=t.sessionId,i=t.approvalId,r=s.approvalsBySession[o]??[];s.approvalsBySession[o]=r.filter(l=>l.approvalId!==i);break}case"questionRequested":{const o=t.sessionId,i=s.questionsBySession[o]??[];i.some(l=>l.questionId===t.question.questionId)||(s.questionsBySession[o]=[...i,t.question]);break}case"questionAnswered":case"questionDismissed":{const o=t.sessionId,i=t.questionId,r=s.questionsBySession[o]??[];s.questionsBySession[o]=r.filter(l=>l.questionId!==i);break}case"taskCreated":{const o=t.sessionId,i=s.tasksBySession[o]??[],r=i.findIndex(l=>l.id===t.task.id);if(r===-1)s.tasksBySession[o]=[...i,t.task];else{const l=[...i];l[r]={...t.task,outputLines:i[r].outputLines,text:i[r].text},s.tasksBySession[o]=l}break}case"taskProgress":{const o=t.sessionId,i=s.tasksBySession[o]??[];s.tasksBySession[o]=i.map(r=>{if(r.id!==t.taskId)return r;if(r.kind==="subagent"&&t.kind==="text")return{...r,text:(r.text??"")+t.outputChunk};const l=r.outputLines??[];if(l.at(-1)===t.outputChunk)return r;const a=[...l,t.outputChunk];return{...r,outputLines:r.kind==="subagent"?a:a.slice(-40)}});break}case"taskCompleted":{const o=t.sessionId,i=s.tasksBySession[o]??[];s.tasksBySession[o]=i.map(r=>r.id!==t.taskId?r:{...r,status:t.status,outputPreview:t.outputPreview,outputBytes:t.outputBytes});break}case"goalUpdated":{const o=t.sessionId;t.goal===null||t.goal.status==="complete"?delete s.goalBySession[o]:s.goalBySession[o]=t.goal;break}case"configChanged":{s.config=t.config;break}case"modelCatalogChanged":break;case"agentDelta":case"agentTurnEnded":break;case"unknown":{const o=t.raw;if(!(o&&o._noop===!0))if(o&&(o._agentError||o._agentWarning)){const i=o._agentError?Un.global.t("warnings.errorLabel"):Un.global.t("warnings.noteLabel"),r=o.message??o.code??"agent error";s.warnings=[...s.warnings,`${i}: ${r}`]}else{const i=o?.type??"(unknown)";s.warnings=[...s.warnings,`Unhandled event: ${i}`]}break}}return s}function Lue(e){return e==="in_progress"?"in_progress":e==="done"||e==="completed"?"done":"pending"}function Oue(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="assistant")for(let s=n.content.length-1;s>=0;s--){const o=n.content[s];if(o.type!=="toolUse"||Zl(o.toolName)!=="todo")continue;let i=o.input;if(typeof i=="string")try{i=JSON.parse(i)}catch{continue}const r=i?.todos;if(Array.isArray(r))return r.flatMap(l=>{const a=l??{},c=typeof a.title=="string"?a.title:typeof a.content=="string"?a.content:"";return c?[{title:c,status:Lue(a.status)}]:[]})}}return[]}const Ei=O3(),Ol=Cce(),zp=$ce(),j3=Et.permission,V3=Et.activeWorkspace,K3=Et.thinking,G3=Et.planMode,Y3=Et.swarmMode,X3=Et.goalMode,lC=40401,Q3=Et.onboarded,Pue=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,31}$/;cc(Et.codeFont);cc(Et.theme);function Rue(){try{const e=Qn(j3);if(e==="auto"||e==="yolo"||e==="manual")return e}catch{}return"manual"}function Due(e){try{ts(j3,e)}catch{}}function Bue(){try{const e=Qn(K3);if(e&&Pue.test(e))return e}catch{}return"high"}function Fue(e){try{ts(K3,e)}catch{}}function gv(e){const t=Qn(e);if(!t)return{};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const s={};for(const[o,i]of Object.entries(n))i===!0&&(s[o]=!0);return s}catch{return{}}}function $y(e,t){try{const n={};for(const[s,o]of Object.entries(t))o&&(n[s]=!0);ts(e,JSON.stringify(n))}catch{}}function Z3(){$y(G3,be.planModeBySession)}function J3(){$y(Y3,be.swarmModeBySession)}function e4(){$y(X3,be.goalModeBySession)}function Hue(){try{return Qn(V3)}catch{return null}}const t4=Et.hiddenWorkspaces;function Wue(){try{const e=Qn(t4);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function zue(e){try{ts(t4,JSON.stringify(e))}catch{}}function Uue(e){try{ts(V3,e)}catch{}}function que(e,t){if(t&&e.startsWith(t)){const s=e.slice(t.length);return s?`~${s}`:"~"}const n=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);return n?`~${n[1]??""}`:e}const be=$s({...Cue(),connected:!1,serverVersion:"",dangerousBypassAuth:!1,workspaceName:"king-web",connection:"disconnected",permission:Rue(),thinking:Bue(),planModeBySession:gv(G3),swarmModeBySession:gv(Y3),goalModeBySession:gv(X3),loading:!1,sessionLoading:!1,queuedBySession:{},gitStatusBySession:{},promptIdBySession:{},sendingBySession:{},unreadBySession:_0(),authReady:!1,defaultModel:null,managedProviderStatus:null,workspaces:[],activeWorkspaceId:Hue(),fsHome:null,recentRoots:[],hiddenWorkspaceRoots:Wue(),availableOpenInApps:[],config:null,sideChatMessagesByAgent:{},sideChatSendingByAgent:{},sideChatUserMessageIdsBySession:{},messagesLoadingMoreBySession:{},messagesHasMoreBySession:{},messagesLoadMoreErrorBySession:{},sessionsHasMoreByWorkspace:{},sessionsLoadingMoreByWorkspace:{},sessionsCursorByWorkspace:{},sessionsInitialCountByWorkspace:{},sessionsFullyLoaded:!1}),Rh=$s({planMode:!1,swarmMode:!1,goalMode:!1});function n4(e){be.sessions=e}function Dh(e,t){be.sessions=be.sessions.map(n=>n.id===e?t(n):n)}function jue(e){be.sessions=[e,...be.sessions.filter(t=>t.id!==e.id)]}function Vue(e){be.sessions=[...be.sessions,e]}function Kue(e){be.sessions=be.sessions.filter(t=>t.id!==e)}function s4(){const e=be.activeSessionId;e&&be.unreadBySession[e]&&typeof document<"u"&&document.visibilityState==="visible"&&(be.unreadBySession={...be.unreadBySession,[e]:!1},w0({[e]:!1}))}typeof window<"u"&&window.addEventListener("storage",e=>{e.key===Et.unread&&(be.unreadBySession=_0(),s4())});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&s4()});function Ny(e){be.activeSessionId=e}function Gue(e){be.messagesBySession=e}function Yue(e,t){be.messagesBySession={...be.messagesBySession,[e]:t}}function o4(e,t){be.messagesBySession={...be.messagesBySession,[e]:t(be.messagesBySession[e]??[])}}function Xue(e){const{[e]:t,...n}=be.messagesBySession;be.messagesBySession=n}function i4(e){hi?.unsubscribe(e),yde(e),Xu.flush(),Kue(e),Xue(e),delete be.approvalsBySession[e],delete be.questionsBySession[e],delete be.tasksBySession[e],delete be.goalBySession[e],delete be.gitStatusBySession[e],delete be.lastSeqBySession[e],delete be.compactionBySession[e],delete be.messagesLoadingMoreBySession[e],delete be.messagesHasMoreBySession[e],delete be.messagesLoadMoreErrorBySession[e],delete Hh[e],m4.delete(e),Fh.delete(e),delete be.queuedBySession[e],delete be.promptIdBySession[e],delete be.sendingBySession[e],delete be.planModeBySession[e],delete be.swarmModeBySession[e],delete be.goalModeBySession[e],Z3(),J3(),e4()}const r4=Z(null),l4=Z([]),a4=Z(!1),c4=Z(!1);async function Bh(e){let t;try{t=await dt().getSessionStatus(e)}catch{return}Dh(e,n=>({...n,model:t.model||n.model,usage:{...n.usage,contextTokens:t.contextTokens,contextLimit:t.maxContextTokens}})),be.swarmModeBySession={...be.swarmModeBySession,[e]:t.swarmMode},be.planModeBySession={...be.planModeBySession,[e]:t.planMode}}function u4(e){const t=be.activeSessionId;t&&Promise.resolve(dt().updateSession(t,e)).then(()=>Bh(t)).catch(()=>{})}const d4=Et.conversationToc;function Que(){try{const e=Qn(d4);return e===null?!0:e==="true"}catch{return!0}}function Zue(e){try{ts(d4,e?"true":"false")}catch{}}const f4=Z(Que());function Jue(e){f4.value=e,Zue(e)}function ede(e){try{return Qn(e)??""}catch{return""}}const p4=Z(ede(Q3)==="1");function tde(e){p4.value=e;try{ts(Q3,e?"1":"0")}catch{}}let hi=null,aC=0;function h4(){return aC+=1,`msg_opt_${Date.now().toString(36)}_${aC}`}const Fh=new Set;function nde(e,t,n){const s={sessions:be.sessions,activeSessionId:be.activeSessionId,messagesBySession:be.messagesBySession,approvalsBySession:be.approvalsBySession,planReviewByToolCallId:be.planReviewByToolCallId,questionsBySession:be.questionsBySession,tasksBySession:be.tasksBySession,goalBySession:be.goalBySession,lastSeqBySession:be.lastSeqBySession,compactionBySession:be.compactionBySession,config:be.config,warnings:be.warnings},o=Nue(s,e,{sessionId:t,seq:n});n4(o.sessions),Ny(o.activeSessionId),Gue(o.messagesBySession),be.approvalsBySession=o.approvalsBySession,be.planReviewByToolCallId=o.planReviewByToolCallId,be.questionsBySession=o.questionsBySession,be.tasksBySession=o.tasksBySession,be.goalBySession=o.goalBySession,be.lastSeqBySession=o.lastSeqBySession,be.compactionBySession=o.compactionBySession,be.config=o.config??null,be.warnings=o.warnings,e.type==="configChanged"&&(be.defaultModel=e.config.defaultModel??null),e.type==="modelCatalogChanged"&&(Wn.loadModels(),Wn.loadProviders()),e.type==="sessionUsageUpdated"&&(e.swarmMode!==void 0&&(be.swarmModeBySession={...be.swarmModeBySession,[e.sessionId]:e.swarmMode}),e.planMode!==void 0&&(be.planModeBySession={...be.planModeBySession,[e.sessionId]:e.planMode}))}function sde(e,t){nde(e,t.sessionId,t.seq);const n=Bs.sideChatTargetBySession.value[t.sessionId];if(n){const{agentId:s}=n,o=t.sessionId;e.type==="agentDelta"&&e.agentId===s?e.delta.text&&Bs.appendSideChatAssistantText(s,o,e.delta.text):e.type==="agentTurnEnded"&&e.agentId===s?Bs.finishSideChatAgent(s,o):e.type==="taskProgress"&&e.taskId===s?Bs.appendSideChatAssistantText(s,o,e.outputChunk):e.type==="taskCompleted"&&e.taskId===s&&Bs.finishSideChatAgent(s,o,e.outputPreview)}if(e.type==="messageCreated"&&e.message.role==="user"&&e.message.promptId!==void 0){const s=e.message.sessionId;be.promptIdBySession[s]!==e.message.promptId&&(be.promptIdBySession={...be.promptIdBySession,[s]:e.message.promptId})}e.type==="assistantDelta"&&t.sessionId===be.activeSessionId&&Ei.recordMoonDelta((e.delta.text?.length??0)+(e.delta.thinking?.length??0)),e.type==="sessionStatusChanged"&&(e.status==="idle"||e.status==="aborted")&&_fe(e.sessionId,e.status),e.type==="questionRequested"&&wfe(e.sessionId,e.question)}const Xu=kce(({appEvent:e,meta:t})=>sde(e,t),({appEvent:e})=>vce(e));function Ly(){if(hi!==null||typeof WebSocket>"u")return;be.connection="connecting",hi=dt().connectEvents({onEvent(t,n){if(t.type==="workspaceCreated"||t.type==="workspaceUpdated"||t.type==="workspaceDeleted"){gt.applyWorkspaceEvent(t);return}Xu({appEvent:t,meta:n})},onResync(t,n,s){Xu.flush(),s!==void 0&&(Hh[t]=s),mde.request(t)},onError(t,n,s){Oy({severity:"error",title:Un.global.t("warnings.wsTitle"),message:n,details:[Hn("message",n)].filter(o=>o!==void 0)})},onConnectionChange(t){be.connected=t,be.connection=t?"connected":"disconnected"}})}const Hh={},m4=new Set;function ode(e){return el(e)&&e.code===lC?!0:typeof e=="object"&&e!==null&&e.code===lC}function Hn(e,t){if(!(t==null||t===""))return{label:Un.global.t(`warnings.details.${e}`),value:g4(t)}}function g4(e){if(e instanceof Error)return typeof e.stack=="string"&&e.stack?e.stack:e.message?`${e.name}: ${e.message}`:e.name;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function ide(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.name=="string"?e.name:void 0}function rde(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.message=="string"?e.message:void 0}function lde(e){return e instanceof Error&&typeof e.stack=="string"&&e.stack?e.stack:void 0}function ade(e){if(!(typeof e!="number"||!Number.isFinite(e)))return new Date(e).toISOString()}function cC(e){if(!(typeof e!="number"||!Number.isFinite(e)))return`${Math.round(e)}ms`}function cde(e,t,n){const s=v3(t),o=el(t),i=s||o?t.timestamp:void 0,r=s||o?t.durationMs:void 0,l=[Hn("operation",e),Hn("sessionId",n??be.activeSessionId),Hn("connection",be.connection),Hn("timestamp",ade(i??Date.now()))];return s?l.push(Hn("duration",cC(r)),Hn("request",`${t.method} ${t.path}`),Hn("endpoint",t.url),Hn("requestId",t.requestId),Hn("phase",t.phase),Hn("timeout",`${t.timeoutMs}ms`),Hn("status",t.status===void 0?void 0:`${t.status} ${t.statusText??""}`.trim()),Hn("contentType",t.contentType),Hn("responsePreview",t.bodyPreview),Hn("cause",t.cause)):o?l.push(Hn("duration",cC(r)),Hn("code",t.code),Hn("requestId",t.requestId),Hn("message",t.message),Hn("details",t.details)):l.push(Hn("errorName",ide(t)),Hn("message",rde(t)??g4(t)),Hn("stack",lde(t))),l.filter(a=>a!==void 0)}function ude(e,t,n={}){const s=v3(t),o=el(t),i=n.title??(s?Un.global.t("warnings.daemonNetworkTitle"):o?Un.global.t("warnings.daemonApiTitle"):Un.global.t("warnings.operationFailedTitle")),r=n.message??(s?Un.global.t("warnings.daemonNetworkMessage"):o?t.message:Un.global.t("warnings.operationFailedMessage"));return{severity:"error",title:i,message:r,details:cde(e,t,n.sessionId)}}function Oy(e){be.warnings=[...be.warnings,e]}function Wh(e,t,n){Oy(ude(e,t,n))}const dde={40913:"warnings.goal.alreadyExists",40914:"warnings.goal.notFound",40915:"warnings.goal.statusInvalid",40916:"warnings.goal.notResumable",40918:"warnings.goal.objectiveTooLong"};function fde(e){if(!el(e))return;const t=dde[e.code];return t?Un.global.t(t):void 0}async function pde(e){if(i4(e),be.activeSessionId!==e)return;const t=be.sessions[0];t?await gt.selectSession(t.id,{urlMode:"replace"}):(Ny(void 0),be.sessionLoading=!1,gt.writeSessionUrl(void 0,"replace"))}const uC=new Set;async function hde(e){if(!uC.has(e)){uC.add(e);try{const t=await dt().getSessionWarnings(e),n=Un.global.t("warnings.noteLabel");for(const s of t)Oy(`${n}: ${s.message}`)}catch{}}}async function Py(e){try{const n=await dt().getSessionSnapshot(e);Xu.flush(),Dh(e,s=>({...n.session,model:n.session.model&&n.session.model.length>0?n.session.model:s.model})),Yue(e,n.messages),be.messagesHasMoreBySession={...be.messagesHasMoreBySession,[e]:n.hasMoreMessages},be.approvalsBySession={...be.approvalsBySession,[e]:n.pendingApprovals};for(const s of n.pendingApprovals){const o=s.display;o?.kind==="plan_review"&&typeof o.plan=="string"&&o.plan.length>0&&(be.planReviewByToolCallId={...be.planReviewByToolCallId,[s.toolCallId]:{plan:o.plan,path:typeof o.path=="string"?o.path:void 0}})}return be.questionsBySession={...be.questionsBySession,[e]:n.pendingQuestions},be.lastSeqBySession={...be.lastSeqBySession,[e]:n.asOfSeq},Hh[e]=n.epoch,Ly(),hi&&(hi.seedSnapshot(e,n),hi.subscribe(e,{seq:n.asOfSeq,epoch:n.epoch}),v4(e)),zh.delete(e),hde(e),"ok"}catch(t){return ode(t)?(await pde(e),"not-found"):(Wh("getSessionSnapshot",t,{title:Un.global.t("warnings.sessionSnapshotTitle"),message:Un.global.t("warnings.sessionSnapshotMessage"),sessionId:e}),"failed")}}const mde=mce(Py);function gde(e){return Object.prototype.hasOwnProperty.call(be.messagesBySession,e)}const vde=4,ji=[],zh=new Set;function v4(e){const t=ji.indexOf(e);for(t!==-1&&ji.splice(t,1),ji.unshift(e);ji.length>vde;){let n=-1;for(let o=ji.length-1;o>=0;o--)if(ji[o]!==be.activeSessionId){n=o;break}if(n===-1)break;const[s]=ji.splice(n,1);if(s===void 0)break;hi?.unsubscribe(s),zh.add(s)}}function yde(e){const t=ji.indexOf(e);t!==-1&&ji.splice(t,1),zh.delete(e)}function kde(e){if(Ly(),hi){Xu.flush();const t=be.lastSeqBySession[e]??0,n=Hh[e];hi.subscribe(e,{seq:t,epoch:n}),v4(e)}}async function bde(e){return zh.has(e)?Py(e):(kde(e),"ok")}function Uh(e){const t=be.sessions.find(i=>i.id===e);if(!t||t.status!=="running")return!1;const n=Bs.sideChatTargetBySession.value[e]?.agentId,o=(be.tasksBySession[e]??[]).filter(i=>i.status==="running");return o.length===0?!(n&&be.sideChatSendingByAgent[n]):o.some(i=>i.id!==n)}function Ry(e,t){try{const n=new Date(e),o=Date.now()-n.getTime(),i=o/36e5;if(o<6e4)return Un.global.t("sessions.justNow");if(i<1)return`${Math.round(o/6e4)}m`;if(i<24)return`${Math.round(i)}h`;const r=o/864e5;return r<7?`${Math.round(r)}d`:r<30?`${Math.round(r/7)}w`:r<365?`${Math.round(r/30)}m`:`${Math.round(r/365)}y`}catch{return e}}const _de=3e4,Qu=Z(0);let vv=null;function wde(){vv===null&&(vv=setInterval(()=>{Qu.value=(Qu.value+1)%Number.MAX_SAFE_INTEGER},_de),vv.unref?.())}function Sde(e,t){const n=e.split(`
|
|
278
278
|
`),s=t.split(`
|
|
279
|
-
`),o=[];return n.forEach((i,r)=>{o.push({kind:"rem",gutter:String(r+1),text:`- ${i}`})}),s.forEach((i,r)=>{o.push({kind:"add",gutter:String(r+1),text:`+ ${i}`})}),o}function Cde(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const s=typeof t.path=="string"?t.path:"";return Array.isArray(t.diff)?{kind:"diff",path:s,diff:t.diff}:typeof t.old_text=="string"&&typeof t.new_text=="string"?{kind:"diff",path:s,diff:Sde(t.old_text,t.new_text)}:{kind:"diff",path:s,diff:[]}}if(n==="shell"||n==="command"){const s=typeof t.command=="string"?t.command:e.action,o=typeof t.cwd=="string"?t.cwd:void 0,i=typeof t.danger=="string"?t.danger:void 0;return{kind:"shell",command:s,cwd:o,danger:i}}if(n==="file_content"||n==="file"){const s=typeof t.path=="string"?t.path:"",o=typeof t.content=="string"?t.content:"",i=typeof t.language=="string"?t.language:void 0;return{kind:"file",path:s,content:o,language:i}}if(n==="file_op"||n==="fileop"){const s=typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,o=typeof t.path=="string"?t.path:"",i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:s,path:o,detail:i}}if(n==="url_fetch"||n==="url"){const s=typeof t.url=="string"?t.url:e.action;return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:s}}if(n==="search"){const s=typeof t.query=="string"?t.query:e.action,o=typeof t.scope=="string"?t.scope:void 0;return{kind:"search",query:s,scope:o}}if(n==="invocation"||n==="agent_call"||n==="skill_call"){const s=typeof t.kind=="string"?t.kind:n,o=typeof t.name=="string"?t.name:e.toolName,i=typeof t.description=="string"?t.description:void 0;return{kind:"invocation",kind2:s,name:o,description:i}}if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const s=typeof t.plan=="string"?t.plan:"",o=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},c=typeof a.label=="string"?a.label:"";if(!c)return null;const u=typeof a.description=="string"?a.description:void 0;return{label:c,description:u}}).filter(l=>l!==null);return{kind:"plan_review",plan:s,path:o,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function xde(e){return{questionId:e.questionId,sessionId:e.sessionId,questions:e.questions.map(t=>({id:t.id,question:t.question,header:t.header,body:t.body,options:t.options.map(n=>({id:n.id,label:n.label,description:n.description,recommended:n.recommended})),multiSelect:t.multiSelect,allowOther:t.allowOther,otherLabel:t.otherLabel}))}}function Ade(e){const t=be.messagesBySession[e.sessionId];if(!t||t.length===0)return;const n=new Map;for(const o of t)if(o.role==="assistant")for(const i of o.content){if(i.type!=="toolUse"||i.toolName!=="Bash"&&i.toolName!=="bash")continue;const r=i.input,l=r&&typeof r.command=="string"?r.command:void 0;l&&n.set(i.toolCallId,l)}if(n.size===0)return;const s=`task_id: ${e.id}`;for(const o of t)if(o.role==="tool")for(const i of o.content){if(i.type!=="toolResult")continue;if((typeof i.output=="string"?i.output:i.output!==void 0?JSON.stringify(i.output):"").includes(s)){const l=n.get(i.toolCallId);if(l)return l}}}function Tde(e){let t;e.status==="running"?t="run":e.status==="completed"?t="done":t="fail";let n="";if(e.status==="running"&&e.startedAt){const r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3),l=Math.floor(r/60),a=r%60;n=Un.global.t("tasks.timingRunning",{time:`${l}:${String(a).padStart(2,"0")}`})}else if(e.completedAt&&e.startedAt){const r=Math.round((new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3);n=Un.global.t("tasks.timingDone",{sec:r})}else n=e.status;const s=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,o=e.command??Ade(e),i=e.kind==="bash"&&o?`$ ${o}`:void 0;return{id:e.id,name:e.description,kind:e.kind,state:t,timing:n,meta:i,output:s,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId}}const Mde=F(()=>{const e=be.sessions.find(n=>n.id===be.activeSessionId),t=e?e.cwd.split("/").pop()??e.cwd:"main";return{name:be.workspaceName,branch:t}}),Ede=F(()=>(Qu.value,be.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:Ry(e.updatedAt,e.status),status:e.status,busy:Uh(e.id)})))),Ide=F(()=>be.activeSessionId??""),$de=F(()=>{const e=be.activeSessionId;return e?Wn.skillsBySession.value[e]??[]:[]}),Nde=F(()=>{const e=be.activeSessionId;return e?be.sendingBySession[e]??!1:!1}),Bs=fue(be,{pushOperationFailure:Wh,nextOptimisticMsgId:h4,connectEventsIfNeeded:Ly,getEventConn:()=>hi}),hd=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=Bs.sideChatTargetBySession.value[e]?.agentId;return(be.tasksBySession[e]??[]).filter(n=>n.id!==t)}),y4=Oce(be,hd),Lde=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=new Set(be.sideChatUserMessageIdsBySession[e]??[]),n=(be.messagesBySession[e]??[]).filter(o=>!t.has(o.id)),s=be.approvalsBySession[e]??[];return q3(n,s,o=>dt().getFileUrl(o),qh.value!=="idle",hd.value,be.planReviewByToolCallId)}),Ode=F(()=>(y4.taskClock.value,hd.value.map(Tde))),k4=F(()=>Hce(hd.value)),La=F(()=>{const e=be.activeSessionId;return e?be.goalBySession[e]??null:null}),Pde=F(()=>{const e=be.activeSessionId;return e?Oue(be.messagesBySession[e]??[]):[]}),Rde=F(()=>{const e=be.activeSessionId;return e?be.compactionBySession[e]??null:null}),Dde=F(()=>be.connection),Bde=F(()=>be.loading),Fde=F(()=>be.sessionLoading),Hde=F(()=>{const e=be.activeSessionId;return e?be.messagesLoadingMoreBySession[e]??!1:!1}),Wde=F(()=>{const e=be.activeSessionId;return e?be.messagesHasMoreBySession[e]??!1:!1}),zde=F(()=>{const e=be.activeSessionId;return e?be.messagesLoadMoreErrorBySession[e]??!1:!1}),Ude=F(()=>be.serverVersion),qde=F(()=>be.dangerousBypassAuth);function jde(){be.dangerousBypassAuth=!1}const Vde=F(()=>be.permission),Kde=F(()=>be.thinking),b4=F(()=>{const e=be.activeSessionId;return e?be.planModeBySession[e]??!1:Rh.planMode}),Gde=F(()=>{const e=be.activeSessionId;return e?be.swarmModeBySession[e]??!1:Rh.swarmMode}),Yde=F(()=>{const e=be.activeSessionId;return e?be.goalModeBySession[e]??!1:Rh.goalMode}),Xde=F(()=>{const e=Wce(k4.value);return{plan:b4.value,goal:La.value&&La.value.status!=="complete"?{status:La.value.status,turnsUsed:La.value.turnsUsed,elapsedMs:La.value.wallClockMs}:null,swarm:e.total>0?e:null}}),Qde=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=dt();return(be.queuedBySession[e]??[]).map(n=>({text:n.text,attachmentCount:n.attachments?.length??0,attachments:n.attachments?.map(s=>({fileId:s.fileId,kind:s.kind,url:t.getFileUrl(s.fileId)}))}))}),Zde=F(()=>be.warnings),Jde=F(()=>{const e=be.activeSessionId;return e?(be.questionsBySession[e]??[]).map(xde):[]}),efe=F(()=>{const e=be.activeSessionId;return e?(be.approvalsBySession[e]??[]).map(t=>({approvalId:t.approvalId,block:Cde(t),agentName:t.agentName})):[]}),qh=F(()=>{const e=be.activeSessionId;return e?(be.approvalsBySession[e]??[]).length>0?"awaiting-approval":(be.questionsBySession[e]??[]).length>0?"awaiting-question":Uh(e)?"running":"idle":"idle"}),Wn=Dce(be,{pushOperationFailure:Wh,refreshSessionStatus:Bh,persistSessionProfile:u4,activity:qh,inFlightPromptSessions:Fh,saveThinkingToStorage:Fue,updateSession:Dh,updateSessionMessages:o4}),Up=F(()=>{const e=be.activeSessionId;if(!e)return null;const t=be.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),tfe=F(()=>{const e=be.activeSessionId;return e?be.gitStatusBySession[e]?.pullRequest??null:null}),nfe=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=be.gitStatusBySession[e];return t?Object.entries(t.entries).map(([n,s])=>({path:n,status:s})).sort((n,s)=>n.path.localeCompare(s.path)):[]}),sfe=F(()=>{const e=be.activeSessionId;if(!e)return null;const t=be.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),_4=F(()=>{const e=be.sessions.find(r=>r.id===be.activeSessionId),t=Up.value?.branch??(e?e.cwd.split("/").pop()??e.cwd:"main"),n=e===void 0?Wn.draftModel.value:null,s=(e?.model&&e.model.length>0?e.model:n??be.defaultModel)??"—",o=Wn.models.value.find(r=>r.id===s||r.model===s);return{model:o?.displayName||o?.model||(s.includes("/")?s.split("/").pop():s),modelId:o?.id??s,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:be.permission,branch:t,cwd:e?.cwd??"",isGitRepo:Up.value!==null}}),ofe=F(()=>l4.value),ife=F(()=>be.sessions.find(t=>t.id===be.activeSessionId)?.usage.totalCostUsd??0),rfe=F(()=>be.authReady),lfe=F(()=>be.defaultModel),afe=F(()=>be.managedProviderStatus),cfe=F(()=>be.config),ufe=F(()=>{const e=be.activeSessionId;if(!e)return{};const t=be.gitStatusBySession[e];return t?{...t.entries}:{}});function pc(e){return be.workspaces.find(t=>t.root===e.cwd)?.id??e.workspaceId??e.cwd}const Dy=F(()=>hce({workspaces:be.workspaces,sessions:be.sessions,hiddenWorkspaceRoots:be.hiddenWorkspaceRoots,activeRoot:be.sessions.find(e=>e.id===be.activeSessionId)?.cwd,activeBranch:Up.value?.branch??null,sessionsHasMoreByWorkspace:be.sessionsHasMoreByWorkspace})),qp=Z(k5()),hc=Z(b5()==="manual"?"manual":"recent");Ke(()=>[Dy.value.map(e=>e.id).join("\0"),be.loading],([e,t])=>{if(t)return;const n=e?e.split("\0"):[],s=N5(n,qp.value);s!==null&&(qp.value=s,kA(s))});const Yl=F(()=>{const e=Dy.value.map(t=>({id:t.id,name:t.name,root:t.root,shortPath:que(t.root,be.fsHome),branch:t.branch,sessionCount:t.sessionCount}));if(hc.value==="recent"){const t=new Map;for(const n of be.sessions){if(n.parentSessionId)continue;const s=pc(n),o=new Date(n.updatedAt).getTime();o>(t.get(s)??Number.NEGATIVE_INFINITY)&&t.set(s,o)}return P5(e,t)}return L5(e,qp.value)}),w4=F(()=>{const e=be.activeWorkspaceId,t=Yl.value;return e&&t.some(n=>n.id===e)?e:t[0]?.id??null}),dfe=F(()=>{const e=w4.value;return e?Yl.value.find(t=>t.id===e)??null:null}),ffe=F(()=>{Qu.value;const e=new Set(Yl.value.map(n=>n.id)),t=new Map(Yl.value.map(n=>[n.id,n.name]));return be.sessions.filter(n=>!n.parentSessionId&&e.has(pc(n))).map(n=>{const s=pc(n);return{id:n.id,title:n.title,time:Ry(n.updatedAt,n.status),status:n.status,busy:Uh(n.id),lastPrompt:n.lastPrompt,workspaceId:s,workspaceName:t.get(s)}})}),pfe=F(()=>{Qu.value;const e=new Map;for(const t of be.sessions.toSorted((n,s)=>new Date(s.updatedAt).getTime()-new Date(n.updatedAt).getTime())){if(t.parentSessionId)continue;const n=pc(t),s={id:t.id,title:t.title,time:Ry(t.updatedAt,t.status),status:t.status,busy:Uh(t.id),updatedAt:t.updatedAt},o=e.get(n)??[];o.push(s),e.set(n,o)}return Yl.value.map(t=>({workspace:t,sessions:e.get(t.id)??[],hasMore:be.sessionsHasMoreByWorkspace[t.id]??!1,loadingMore:be.sessionsLoadingMoreByWorkspace[t.id]??!1,initialCount:be.sessionsInitialCountByWorkspace[t.id]??W1}))});function hfe(e){qp.value=e,kA(e),hc.value!=="manual"&&(hc.value="manual",bA("manual"))}function mfe(e){hc.value!==e&&(hc.value=e,bA(e))}const S4=F(()=>{const e={};for(const[t,n]of Object.entries(be.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(const[t,n]of Object.entries(be.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),gfe=F(()=>{const e={};for(const[t,n]of Object.entries(be.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(const[t,n]of Object.entries(be.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),vfe=F(()=>{const e={};for(const[t,n]of Object.entries(be.unreadBySession))n&&(e[t]=!0);return e}),yfe=F(()=>{const e={},t=S4.value;for(const n of be.sessions){const s=t[n.id]??0;if(s<=0)continue;const o=pc(n);e[o]=(e[o]??0)+s}return e}),kfe=F(()=>be.recentRoots),bfe=F(()=>be.availableOpenInApps),gt=wue(be,{taskPoller:y4,sideChat:Bs,modelProvider:Wn,pushOperationFailure:Wh,activity:qh,inFlightPromptSessions:Fh,sessionsKnownEmpty:m4,setSessions:n4,updateSession:Dh,upsertSessionFront:jue,appendSession:Vue,forgetSession:i4,setActiveSessionId:Ny,updateSessionMessages:o4,nextOptimisticMsgId:h4,getEventConn:()=>hi,syncSessionFromSnapshot:Py,reopenSession:bde,hasLoadedMessages:gde,refreshSessionStatus:Bh,persistSessionProfile:u4,mergedWorkspaces:Dy,workspacesView:Yl,status:_4,workspaceIdForSession:pc,savePermissionToStorage:Due,savePlanModeToStorage:Z3,saveSwarmModeToStorage:J3,saveGoalModeToStorage:e4,draftModes:Rh,saveUnread:w0,saveActiveWorkspaceToStorage:Uue,saveHiddenWorkspacesToStorage:zue,goalErrorMessage:fde,resetFastMoon:Ei.resetFastMoon,initialized:c4,selectedDiffPath:r4,fileDiffLines:l4,fileDiffLoading:a4});function _fe(e,t){if(Fh.delete(e),be.sendingBySession={...be.sendingBySession,[e]:!1},be.promptIdBySession[e]!==void 0){const i={...be.promptIdBySession};delete i[e],be.promptIdBySession=i}e===be.activeSessionId?(Ei.resetFastMoon(),gt.loadGitStatus(e),Bh(e)):t==="idle"&&(be.unreadBySession={...be.unreadBySession,[e]:!0},w0({[e]:!0})),Ol.maybeNotifyCompletion(e,{isActiveAndVisible:e===be.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible",sessionTitle:be.sessions.find(i=>i.id===e)?.title??"",onClick:()=>{gt.selectSession(e)}}),t==="idle"&&zp.maybePlayCompletionSound();const n=be.queuedBySession[e]??[];if(n.length===0)return;const[s,...o]=n;be.queuedBySession={...be.queuedBySession,[e]:o},s!==void 0&>.submitPromptInternal(e,s.text,s.attachments).then(i=>{if(!i){const r=be.queuedBySession[e]??[];be.queuedBySession={...be.queuedBySession,[e]:[s,...r]}}})}function wfe(e,t){const n=t.questions[0],s=n?.header?.trim()??"",o=n?.question?.trim()??"",i=s&&o?`${s}: ${o}`:o||s;Ol.maybeNotifyQuestion(e,{isActiveAndVisible:e===be.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible",sessionTitle:be.sessions.find(r=>r.id===e)?.title??"",questionPreview:i,onClick:()=>{gt.selectSession(e)}}),zp.maybePlayQuestionSound()}function Sfe(){return wde(),{workspace:Mde,sessions:Ede,activeSessionId:Ide,workspacesView:Yl,workspaceSortMode:hc,visibleWorkspace:dfe,activeWorkspaceId:w4,sessionsForView:ffe,workspaceGroups:pfe,attentionBySession:S4,pendingBySession:gfe,attentionByWorkspace:yfe,unreadBySession:vfe,recentRoots:kfe,turns:Lde,tasks:Ode,activeAppTasks:hd,todos:Pde,goal:La,swarms:k4,activationBadges:Xde,compaction:Rde,status:_4,sessionCost:ife,fileDiff:ofe,selectedDiffPath:r4,fileDiffLoading:a4,changes:nfe,gitInfo:Up,gitDiffStats:sfe,activePullRequest:tfe,changesByPath:ufe,pendingApprovals:efe,availableOpenInApps:bfe,connection:Dde,loading:Bde,sessionLoading:Fde,loadingMoreMessages:Hde,hasMoreMessages:Wde,loadMoreMessagesError:zde,serverVersion:Ude,dangerousBypassAuth:qde,clearDangerousBypassAuth:jde,initialized:c4,permission:Vde,thinking:Kde,planMode:b4,swarmMode:Gde,goalMode:Yde,queued:Qde,warnings:Zde,questions:Jde,activity:qh,isSending:Nde,fastMoon:Ei.fastMoon,models:Wn.models,starredModelIds:Wn.starredModelIds,providers:Wn.providers,uiFontSize:Ei.uiFontSize,setUiFontSize:Ei.setUiFontSize,conversationToc:f4,setConversationToc:Jue,colorScheme:Ei.colorScheme,setColorScheme:Ei.setColorScheme,accent:Ei.accent,setAccent:Ei.setAccent,notifyOnComplete:Ol.notifyOnComplete,notifyOnQuestion:Ol.notifyOnQuestion,notifyPermission:Ol.notifyPermission,setNotifyOnComplete:Ol.setNotifyOnComplete,setNotifyOnQuestion:Ol.setNotifyOnQuestion,soundOnComplete:zp.soundOnComplete,setSoundOnComplete:zp.setSoundOnComplete,onboarded:p4,setOnboarded:tde,load:gt.load,selectSession:gt.selectSession,clearActiveSession:gt.clearActiveSession,loadOlderMessages:gt.loadOlderMessages,loadWorkspaces:gt.loadWorkspaces,loadMoreSessions:gt.loadMoreSessions,loadAllSessions:gt.loadAllSessions,selectWorkspace:gt.selectWorkspace,openWorkspace:gt.openWorkspace,openWorkspaceDraft:gt.openWorkspaceDraft,startSessionAndSendPrompt:gt.startSessionAndSendPrompt,addWorkspaceByPath:gt.addWorkspaceByPath,browseFs:gt.browseFs,getFsHome:gt.getFsHome,sendPrompt:gt.sendPrompt,steerPrompt:gt.steerPrompt,sideChatVisible:Bs.sideChatVisible,sideChatSessionId:Bs.sideChatSessionId,sideChatTurns:Bs.sideChatTurns,sideChatRunning:Bs.sideChatRunning,sideChatSending:Bs.sideChatSending,openSideChat:Bs.openSideChat,closeSideChat:Bs.closeSideChat,sendSideChatPrompt:Bs.sendSideChatPrompt,uploadImage:gt.uploadImage,abortCurrentPrompt:gt.abortCurrentPrompt,respondApproval:gt.respondApproval,respondQuestion:gt.respondQuestion,dismissQuestion:gt.dismissQuestion,pendingQuestionActions:gt.pendingQuestionActions,pendingApprovalActions:gt.pendingApprovalActions,cancelTask:gt.cancelTask,setPermission:gt.setPermission,setThinking:Wn.setThinking,setPlanMode:gt.setPlanMode,togglePlanMode:gt.togglePlanMode,setSwarmMode:gt.setSwarmMode,toggleSwarmMode:gt.toggleSwarmMode,setGoalMode:gt.setGoalMode,toggleGoalMode:gt.toggleGoalMode,createGoal:gt.createGoal,controlGoal:gt.controlGoal,enqueue:gt.enqueue,dismissWarning:gt.dismissWarning,renameSession:gt.renameSession,renameWorkspace:gt.renameWorkspace,deleteWorkspace:gt.deleteWorkspace,reorderWorkspaces:hfe,setWorkspaceSortMode:mfe,archiveSession:gt.archiveSession,compact:gt.compact,forkSession:gt.forkSession,undo:gt.undo,unqueue:gt.unqueue,reorderQueue:gt.reorderQueue,searchFiles:gt.searchFiles,loadGitStatus:gt.loadGitStatus,loadFileDiff:gt.loadFileDiff,clearFileDiff:gt.clearFileDiff,listDir:gt.listDir,readFileContent:gt.readFileContent,getFileDownloadUrl:gt.getFileDownloadUrl,openWorkspaceFile:gt.openWorkspaceFile,openInApp:gt.openInApp,revealWorkspaceFile:gt.revealWorkspaceFile,resolveImageUrl:gt.resolveImageUrl,refreshOAuthProviderModels:Wn.refreshOAuthProviderModels,loadModels:Wn.loadModels,loadProviders:Wn.loadProviders,skills:$de,activateSkill:Wn.activateSkill,setModel:Wn.setModel,toggleStarModel:Wn.toggleStarModel,addProvider:Wn.addProvider,deleteProvider:Wn.deleteProvider,refreshProvider:Wn.refreshProvider,refreshAllProviders:Wn.refreshAllProviders,authReady:rfe,defaultModel:lfe,managedProviderStatus:afe,config:cfe,updateConfig:gt.updateConfig,checkAuth:gt.checkAuth,startOAuthLogin:Wn.startOAuthLogin,pollOAuthLogin:Wn.pollOAuthLogin,cancelOAuthLogin:Wn.cancelOAuthLogin,logout:gt.logout}}function Cfe({client:e,authLogoRef:t}){const n=F(()=>e.authReady.value),s=F(()=>e.initialized.value&&!n.value),o="/login",i=Z(null);let r=null;function l(){return typeof window>"u"?"/":`${window.location.pathname}${window.location.search}${window.location.hash}`}function a(u){typeof window>"u"||window.history.replaceState(window.history.state,"",u)}Ke(s,u=>{if(!(typeof window>"u")){if(u){window.location.pathname!==o&&(i.value=l(),a(o));return}window.location.pathname===o&&(a(i.value??"/"),i.value=null)}},{immediate:!0});function c(){const u=t.value;u&&(u.classList.remove("blink-now"),u.getBoundingClientRect(),u.classList.add("blink-now"),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,u.classList.remove("blink-now")},300))}return kn(()=>{r!==null&&clearTimeout(r)}),{showAuthGate:s,blinkAuthLogo:c}}function xfe({running:e,showAuthGate:t}){const{t:n}=It(),s=["◐","◓","◑","◒"],o=Z(0);let i=null;function r(){i===null&&(o.value=0,i=setInterval(()=>{o.value=(o.value+1)%s.length},250))}function l(){i!==null&&(clearInterval(i),i=null),o.value=0}Ke(e,c=>{c?r():l()},{immediate:!0});const a=F(()=>{const c=e.value?`${s[o.value]} `:"";return t.value?`${c}${n("app.authPageTitle")} - BLUN King Web`:`${c}BLUN King Web`});hI(()=>{typeof document<"u"&&(document.title=a.value)}),kn(()=>{l()})}const C4=Z(typeof window>"u"?0:window.innerWidth);let bf=0,jp=!1;function z1(){C4.value=window.innerWidth}function Afe(){jp||typeof window>"u"||(window.addEventListener("resize",z1),jp=!0,z1())}function Tfe(){!jp||typeof window>"u"||(window.removeEventListener("resize",z1),jp=!1)}function x4(e,t,n){return Math.max(t,e-n)}function U1(e,t,n){return Math.min(n,Math.max(t,e))}function A4(){return hn(()=>{bf+=1,Afe()}),ls(()=>{bf=Math.max(0,bf-1),bf===0&&Tfe()}),{viewportWidth:C4}}const Mfe="king-web.file-preview-width",Oa=320;function Efe({client:e,sideWidth:t,detailTarget:n,closeFilePreview:s}){const{viewportWidth:o}=A4(),i=F(()=>Math.max(0,o.value-t.value)),r=F(()=>x4(i.value,Oa,Oa));function l(ne){return U1(Math.round(ne),Oa,r.value)}function a(){return l(i.value/2)}const c=F(()=>a()),u=Z(c.value),d=F(()=>U1(u.value,Oa,r.value)),p=Z(null),h=F(()=>{const ne=p.value;if(!ne)return null;const J=e.turns.value.find(ce=>ce.id===ne.turnId)?.blocks?.[ne.blockIndex];return J?.kind==="thinking"?J.thinking:null}),f=F(()=>h.value!==null);function m(ne){const H=p.value;if(H&&H.turnId===ne.turnId&&H.blockIndex===ne.blockIndex){p.value=null,n.value==="thinking"&&(n.value=null);return}n.value="thinking",p.value=ne}function b(){p.value=null,n.value==="thinking"&&(n.value=null)}const _=Z(null),g=F(()=>{const ne=_.value;if(!ne)return null;const H=e.turns.value.find(J=>J.id===ne.turnId);return H?.role==="compaction"&&H.text?H.text:null}),v=F(()=>g.value!==null);function y(ne){if(_.value?.turnId===ne.turnId){_.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",_.value=ne}function A(){_.value=null,n.value==="compaction"&&(n.value=null)}const O=Z(null);function $(ne){const H=e.activeAppTasks.value,J=H.find(te=>te.id===ne)??H.find(te=>te.parentToolCallId===ne);if(J)return J.id;const ce=H.filter(te=>te.kind==="subagent"&&!te.parentToolCallId);if(ce.length===1)return ce[0].id}const k=F(()=>{const ne=O.value;if(!ne)return null;const H=e.activeAppTasks.value.find(J=>J.id===ne.subagentId);return H?oue(H):null}),E=F(()=>k.value!==null);function M(ne){const H=$(ne);if(H){if(O.value?.subagentId===H){O.value=null,n.value==="agent"&&(n.value=null);return}O.value={subagentId:H},n.value="agent"}}function L(){O.value=null,n.value==="agent"&&(n.value=null)}const S=Z(null),I=F(()=>{const ne=S.value;if(!ne)return null;const H=aP(e.turns.value,ne);return H?{id:ne,title:id(H.name),path:lP(H.arg),lines:H.status==="error"?null:$A(H),output:H.output}:null}),P=F(()=>I.value!==null);function D(ne){if(n.value==="toolDiff"&&S.value===ne){W();return}n.value="toolDiff",S.value=ne}function W(){S.value=null,n.value==="toolDiff"&&(n.value=null)}const z=Z("list"),q=Z(null);function Q(){if(n.value==="diff"){X();return}n.value="diff",z.value="list",q.value=null,e.loadGitStatus(e.activeSessionId.value)}function X(){n.value==="diff"&&(n.value=null),z.value="list",q.value=null,e.clearFileDiff()}async function fe(ne){z.value="detail",q.value=ne,await e.loadFileDiff(ne)}async function ye(ne){await e.openSideChat(ne),n.value="btw"}function Me(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function we(){n.value==="btw"&&(n.value=null)}const ze=F(()=>e.sideChatVisible.value),Ue=F(()=>n.value!==null&&(n.value!=="thinking"||f.value)&&(n.value!=="compaction"||v.value)&&(n.value!=="agent"||E.value)&&(n.value!=="toolDiff"||P.value)&&(n.value!=="btw"||ze.value)),Fe=Z(!1),rt=Z({});function le(){switch(n.value){case"thinking":return p.value?{kind:"thinking",...p.value}:null;case"compaction":return _.value?{kind:"compaction",..._.value}:null;case"agent":return O.value?{kind:"agent",...O.value}:null;case"toolDiff":return S.value?{kind:"toolDiff",toolId:S.value}:null;case"btw":return{kind:"btw"};default:return null}}function U(ne){if(ne)switch(ne.kind){case"thinking":p.value={turnId:ne.turnId,blockIndex:ne.blockIndex},n.value="thinking";break;case"compaction":_.value={turnId:ne.turnId},n.value="compaction";break;case"agent":O.value={subagentId:ne.subagentId},n.value="agent";break;case"toolDiff":S.value=ne.toolId,n.value="toolDiff";break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function G(){return n.value==="thinking"&&f.value?(b(),!0):n.value==="compaction"&&v.value?(A(),!0):n.value==="agent"&&E.value?(L(),!0):n.value==="toolDiff"&&P.value?(W(),!0):n.value==="file"?(s(),!0):n.value==="diff"?(X(),!0):n.value==="btw"?(Me(),!0):!1}return Ke(e.activeSessionId,(ne,H)=>{if(H){const J=le();J?rt.value[H]=J:delete rt.value[H]}s(),b(),A(),L(),W(),X(),we(),ne&&U(rt.value[ne])}),{PREVIEW_WIDTH_KEY:Mfe,PREVIEW_MIN:Oa,previewDefaultWidth:c,previewMax:r,previewWidth:u,previewPanelWidth:d,thinkingPanelText:h,thinkingVisible:f,openThinkingPanel:m,closeThinkingPanel:b,compactionPanelText:g,compactionPanelVisible:v,openCompactionPanel:y,closeCompactionPanel:A,agentPanelMember:k,agentPanelVisible:E,openAgentPanel:M,closeAgentPanel:L,toolDiffTarget:I,toolDiffVisible:P,openToolDiff:D,closeToolDiff:W,detailDiffMode:z,detailDiffPath:q,openDiffDetail:Q,closeDiffDetail:X,selectDiffFile:fe,btwVisible:ze,openSideChatTab:ye,closeSideChat:Me,hideSideChatPanel:we,sidePanelVisible:Ue,panelDragging:Fe,closeOpenSidePanel:G}}const Ife=Et.sidebarWidth,dC=Et.sidebarCollapsed,fC=270,yv=170,$fe=36,Nfe=320;function Lfe(e={}){const{viewportWidth:t}=A4(),n=Z(fC),s=Z(!1),o=F(()=>{const c=Nfe+(RC(e.previewOpen)?Oa:0);return x4(t.value,yv,c)}),i=F(()=>s.value?$fe:U1(n.value,yv,o.value));function r(){try{s.value=Qn(dC)==="true"}catch{s.value=!1}}function l(){try{ts(dC,String(s.value))}catch{}}function a(){s.value=!s.value,l()}return{SIDEBAR_WIDTH_KEY:Ife,SIDEBAR_DEFAULT:fC,SIDEBAR_MIN:yv,sidebarMax:o,sessionColWidth:n,sidebarCollapsed:s,sideWidth:i,loadSidebarCollapsed:r,toggleSidebarCollapse:a}}function Ofe({client:e,detailTarget:t}){const{t:n}=It(),s=Z(null),o=Z(null),i=Z(!1),r=Z(null),l=Z(null);let a=0,c=null;function u(){c!==null&&(URL.revokeObjectURL(c),c=null)}const d=F(()=>{const $=l.value;return $?e.getFileDownloadUrl($):null}),p=F(()=>s.value!==null);function h($){return $.length>1?$.replace(/\/+$/,""):$}function f($){const k=[];for(const E of $.split(/[\\/]+/))if(!(!E||E===".")){if(E===".."){k.pop();continue}k.push(E)}return k.join("/")}function m($){const k=$.trim();if(!k)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(k))return{error:n("filePreview.errors.unsupportedPath")};if(k.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const E=h(e.status.value.cwd);if(k.startsWith("/")){if(!E||k!==E&&!k.startsWith(`${E}/`))return{error:n("filePreview.errors.outsideWorkspace")};const L=k===E?"":k.slice(E.length+1);if(L.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const S=f(L);return S?{path:S}:{error:n("filePreview.errors.isDirectory")}}if(k.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const M=f(k);return M?{path:M}:{error:n("filePreview.errors.emptyPath")}}async function b($){const k=s.value;if(t.value==="file"&&k&&k.path===$.path&&k.line===$.line){y();return}const E=++a;u(),t.value="file",o.value=null,r.value=null,i.value=!0,s.value=$,l.value=null;const M=m($.path);if("error"in M){i.value=!1,r.value=M.error;return}l.value=M.path;try{const L=await e.readFileContent(M.path);if(E!==a)return;L?o.value={...L,path:L.path||M.path}:o.value={path:M.path,content:"",encoding:"utf-8",mime:"text/plain",isBinary:!1,size:0}}catch(L){if(E!==a)return;r.value=L instanceof Error?L.message:n("filePreview.errors.loadFailed")}finally{E===a&&(i.value=!1)}}function _($){return/^data:([^;,]+)/i.exec($)?.[1]}function g($){if($.kind!=="image")return;const k=++a;u(),t.value="file",s.value=null,l.value=null,r.value=null;const E={path:$.path??"ReadMediaFile image",content:"",encoding:"utf-8",mime:$.mimeType??_($.url)??"image/*",isBinary:!0,size:$.bytes??0};$.fileId?(i.value=!0,o.value=E,dt().getFileBlob($.fileId).then(M=>{if(k===a){if(t.value!=="file"||!o.value){i.value=!1;return}c=URL.createObjectURL(M),o.value={...o.value,sourceUrl:c},i.value=!1}}).catch(()=>{k===a&&(o.value&&(o.value={...o.value,sourceUrl:$.url}),i.value=!1)})):(i.value=!1,o.value={...E,sourceUrl:$.url})}function v(){a+=1,s.value=null,l.value=null,o.value=null,r.value=null,i.value=!1,u()}function y(){v(),t.value==="file"&&(t.value=null)}Ke(t,($,k)=>{k==="file"&&$!=="file"&&v()});function A(){const $=o.value?.path??s.value?.path;$&&e.openWorkspaceFile($,s.value?.line)}function O(){const $=o.value?.path??s.value?.path;$&&e.revealWorkspaceFile($)}return{previewTarget:s,previewFile:o,previewLoading:i,previewError:r,previewDownloadUrl:d,previewExternalActions:p,openFilePreview:b,openMediaPreview:g,closeFilePreview:y,openPreviewInEditor:A,revealPreviewFile:O}}const Pfe=640,Rfe=`(max-width: ${Pfe}px)`;function Dfe(){const e=Z(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(Rfe);e.value=t.matches;const n=s=>{e.value=s.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),kn(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),kn(()=>t.removeListener(n))),e}const Bfe={class:"server-auth-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"server-auth-title"},Ffe={class:"server-auth-card"},Hfe={class:"server-auth-body"},Wfe={class:"server-auth-foot"},zfe=je({__name:"ServerAuthDialog",setup(e){const t=Z(""),n=Z(null),s=Z(!1);hn(()=>{ht(()=>n.value?.focus())});function o(){const r=t.value;!r||s.value||(s.value=!0,b3(r),window.location.reload())}function i(r){r.key==="Enter"&&(r.preventDefault(),o())}return(r,l)=>(w(),N("div",Bfe,[T("div",Ffe,[l[1]||(l[1]=T("div",{class:"server-auth-head"},[T("h1",{id:"server-auth-title",class:"server-auth-title"},"Server token required"),T("p",{class:"server-auth-hint"},[qe(" This server is protected. Enter the bearer token printed when the server started (or the password set via "),T("code",null,"BLUN_PASSWORD"),qe("). ")])],-1)),T("div",Hfe,[oe(sc,{ref_key:"inputRef",ref:n,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"password",autocomplete:"current-password",placeholder:"Token",disabled:s.value,onKeydown:i},null,8,["modelValue","disabled"])]),T("div",Wfe,[oe(Dt,{variant:"primary",disabled:!t.value||s.value,loading:s.value,onClick:o},{default:_e(()=>[qe(R(s.value?"Connecting…":"Connect"),1)]),_:1},8,["disabled","loading"])])])]))}}),Ufe=ut(zfe,[["__scopeId","data-v-f0029224"]]),qfe={class:"app-shell"},jfe={key:1,class:"auth-page"},Vfe={class:"auth-page-inner"},Kfe={class:"auth-page-copy"},Gfe={key:0,class:"sidebar-rail"},Yfe=["aria-label","aria-hidden"],Xfe=je({__name:"App",setup(e){const t=vG(),n=Z(!t);let s=null;const o=Sfe(),i=F(()=>!o.dangerousBypassAuth.value&&n.value);En("resolveImage",o.resolveImageUrl);const{t:r}=It(),l=vi(),a=Dfe(),c=Z(!1),u=Z(!1),d=F(()=>{const ft=o.activeSessionId.value;return o.sessions.value.find(me=>me.id===ft)?.title??""}),p=F(()=>o.visibleWorkspace.value?.sessionCount??0),h=F(()=>o.activity.value!=="idle"),f=Z(null),{showAuthGate:m,blinkAuthLogo:b}=Cfe({client:o,authLogoRef:f});xfe({running:h,showAuthGate:m});function _(ft){const me=o.status.value.modelId??o.status.value.model??"",Ne=o.models.value.find(xe=>xe.id===me||xe.model===me||xe.displayName===o.status.value.model),xn=by(Ne),ws=fc(Ne,ft),se=xn.indexOf(ws),Ce=xn[(se+1)%xn.length]??xn[0]??"off";return _y(Ne,Ce)}const g=Z(!o.onboarded.value);function v(){o.setOnboarded(!0),g.value=!1}function y(){g.value=!0}hn(()=>{o.load(),Fe(),document.addEventListener("keydown",A,!0),s=kG(()=>{n.value=!0,o.clearDangerousBypassAuth()})}),kn(()=>{document.removeEventListener("keydown",A,!0),s!==null&&(s(),s=null)});function A(ft){ft.key==="Escape"&&(Nn.value||st()&&(ft.stopPropagation(),ft.preventDefault()))}const O=Z(null),$=Z(!1);Ke(o.activeSessionId,()=>{$.value=!0,ht(()=>{$.value=!1})});const{previewTarget:k,previewFile:E,previewLoading:M,previewError:L,previewDownloadUrl:S,previewExternalActions:I,openFilePreview:P,openMediaPreview:D,closeFilePreview:W,openPreviewInEditor:z,revealPreviewFile:q}=Ofe({client:o,detailTarget:O}),Q=F(()=>O.value!==null),{SIDEBAR_WIDTH_KEY:X,SIDEBAR_DEFAULT:fe,SIDEBAR_MIN:ye,sidebarMax:Me,sessionColWidth:we,sidebarCollapsed:ze,sideWidth:Ue,loadSidebarCollapsed:Fe,toggleSidebarCollapse:rt}=Lfe({previewOpen:Q}),{PREVIEW_WIDTH_KEY:le,PREVIEW_MIN:U,previewDefaultWidth:G,previewMax:ne,previewWidth:H,previewPanelWidth:J,thinkingPanelText:ce,thinkingVisible:te,openThinkingPanel:ue,closeThinkingPanel:j,compactionPanelText:Y,compactionPanelVisible:re,openCompactionPanel:ge,closeCompactionPanel:Ae,agentPanelMember:Ie,openAgentPanel:ae,closeAgentPanel:Te,toolDiffTarget:Ve,openToolDiff:tt,closeToolDiff:bt,detailDiffMode:kt,detailDiffPath:Tt,openDiffDetail:Pt,closeDiffDetail:mt,selectDiffFile:Yt,btwVisible:Rn,openSideChatTab:Dn,closeSideChat:Ft,sidePanelVisible:bn,panelDragging:Vn,closeOpenSidePanel:st}=Efe({client:o,sideWidth:Ue,detailTarget:O,closeFilePreview:W}),In=Z(null),_n=Z(!1),Kn=Z(!1),$n=Z(!1),Ge=Z(!1),Ye=Z(!1),Ct=Z(!1),$t=Z(null),mn=Z(null),Nn=F(()=>Ea.value>0||_n.value||Kn.value||$n.value||Ge.value||Ye.value||Ct.value||g.value||c.value||u.value),tn=Z(!1),Ln=Z(!1),Zn=Z(!1),Mt=Z(!1),us=Z(!1);async function Xt(){tn.value=!0,Ln.value=!1,_n.value=!0;try{await o.refreshOAuthProviderModels(),await o.loadModels()}catch{Ln.value=!0}finally{tn.value=!1}}async function oi(){Zn.value=!0,Mt.value=!1,Kn.value=!0;try{await o.loadProviders()}catch{Mt.value=!0}finally{Zn.value=!1}}function bs(){$n.value=!0}async function Do(ft){_n.value=!1,await o.setModel(ft)}async function so(ft){await o.addProvider(ft)}async function qs(ft){await o.deleteProvider(ft)}async function oo(ft){await o.refreshProvider(ft)}async function Nt(ft){us.value=!0;try{await o.updateConfig(ft)&&await o.checkAuth()}finally{us.value=!1}}async function Xe(){return o.startOAuthLogin()}async function ot(){return o.pollOAuthLogin()}async function de(){return o.cancelOAuthLogin()}async function pe(){$n.value=!1,await o.checkAuth(),await o.load()}async function Oe(ft){await o.undo(1),await ht(),In.value?.loadComposerForEdit(ft)}function Qt(ft){if(ft==="/compact"||ft.startsWith("/compact ")){o.compact(ft.slice(8).trim()||void 0);return}if(ft==="/swarm"||ft.startsWith("/swarm ")){const me=ft.slice(6).trim();me==="on"?o.setSwarmMode(!0):me==="off"?o.setSwarmMode(!1):me?(o.setSwarmMode(!0),o.sendPrompt(me)):o.toggleSwarmMode();return}if(ft==="/goal"||ft.startsWith("/goal ")){const me=ft.slice(5).trim();me==="pause"||me==="resume"||me==="cancel"?o.controlGoal(me):me?o.createGoal(me):o.toggleGoalMode();return}if(ft==="/btw"||ft.startsWith("/btw ")){const me=ft.slice(4).trim();!me&&o.sideChatVisible.value?Ft():Dn(me||void 0);return}switch(ft){case"/new":case"/clear":ll();break;case"/fork":o.forkSession();break;case"/undo":o.undo();break;case"/permission":{const me=o.permission.value,Ne=me==="manual"?"auto":me==="auto"?"yolo":"manual";o.setPermission(Ne);break}case"/plan":o.togglePlanMode();break;case"/auto":o.setPermission("auto");break;case"/yolo":o.setPermission("yolo");break;case"/thinking":o.setThinking(_(o.thinking.value));break;case"/help":o.dismissWarning(-1);break;case"/status":Ye.value=!0;break;case"/model":Xt();break;case"/provider":break;case"/login":bs();break;default:{const me=ft.indexOf(" "),Ne=(me===-1?ft:ft.slice(0,me)).slice(1),xn=me===-1?void 0:ft.slice(me+1).trim()||void 0;Ne&&o.activateSkill(Ne,xn);break}}}function Wt(ft){o.unqueue(ft)}function ds(ft){o.unqueue(ft)}function Bn(ft){o.reorderQueue(ft.from,ft.to)}async function bo(ft){const me=o.activeWorkspaceId.value;if(!o.activeSessionId.value&&me){await o.startSessionAndSendPrompt(me,ft.text,ft.attachments);return}if(!o.activeSessionId.value&&!me){$t.value=ft,Ge.value=!0;return}o.sendPrompt(ft.text,ft.attachments)}async function ii(ft){if(mn.value=null,!await o.addWorkspaceByPath(ft)){mn.value=r("workspace.addFailed");return}Ge.value=!1;const Ne=$t.value;$t.value=null;const xn=o.activeWorkspaceId.value;Ne&&xn&&await o.startSessionAndSendPrompt(xn,Ne.text,Ne.attachments)}function _s(){$t.value=null,mn.value=null,Ge.value=!1}function ta(){ht(()=>{In.value?.focusComposer()})}function ll(){const ft=o.activeWorkspaceId.value;ft?o.openWorkspaceDraft(ft):o.clearActiveSession(),ta()}function al(ft){o.openWorkspaceDraft(ft),ta()}function Os(ft){ft&&window.open(ft,"_blank","noopener")}return(ft,me)=>(w(),N("div",qfe,[i.value?(w(),ve(Ufe,{key:0})):ie("",!0),x(m)?(w(),N("section",jfe,[T("div",Vfe,[(w(),N("svg",{ref_key:"authLogoRef",ref:f,class:"auth-page-logo ch-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BLUN King",onMousedown:me[0]||(me[0]=vt(()=>{},["prevent"])),onClick:me[1]||(me[1]=(...Ne)=>x(b)&&x(b)(...Ne))},[...me[94]||(me[94]=[c0('<defs data-v-f134c061><mask id="authBlunEyes" maskUnits="userSpaceOnUse" data-v-f134c061><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-f134c061></rect><g class="ch-eyes" fill="#000" data-v-f134c061><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-f134c061></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-f134c061></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#authBlunEyes)" data-v-f134c061></rect>',2)])],544)),T("div",Kfe,[T("h1",null,R(x(r)("app.authPageTitle")),1),T("p",null,R(x(r)("app.authPageMessage")),1)]),oe(Dt,{class:"auth-page-btn",variant:"primary",onClick:bs},{default:_e(()=>[oe(Je,{name:"log-in",size:"md"}),T("span",null,R(x(r)("app.authPageLogin")),1)]),_:1})])])):(w(),N("div",{key:2,class:Re(["app",{mobile:x(a),"sidebar-collapsed":x(ze)&&!x(a)}]),style:Gt({"--side-w":x(Ue)+"px","--preview-w":x(J)+"px"})},[x(a)?(w(),ve(Rre,{key:1,workspace:x(o).visibleWorkspace.value,"session-title":d.value,running:h.value,branch:x(o).status.value.branch,"session-count":p.value,onOpenSwitcher:me[17]||(me[17]=Ne=>c.value=!0),onOpenSettings:me[18]||(me[18]=Ne=>u.value=!0)},null,8,["workspace","session-title","running","branch","session-count"])):(w(),N(Le,{key:0},[Mn(oe(w8,{"col-width":x(Ue),"active-workspace":x(o).visibleWorkspace.value,"active-workspace-id":x(o).activeWorkspaceId.value,sessions:x(o).sessionsForView.value,groups:x(o).workspaceGroups.value,"active-id":x(o).activeSessionId.value,"attention-by-session":x(o).attentionBySession.value,"pending-by-session":x(o).pendingBySession.value,"unread-by-session":x(o).unreadBySession.value,"workspace-sort-mode":x(o).workspaceSortMode.value,onSelect:me[2]||(me[2]=Ne=>x(o).selectSession(Ne)),onCreate:ll,onCreateInWorkspace:me[3]||(me[3]=Ne=>al(Ne)),onSelectWorkspace:me[4]||(me[4]=Ne=>x(o).openWorkspace(Ne)),onAddWorkspace:me[5]||(me[5]=Ne=>Ge.value=!0),onRename:me[6]||(me[6]=(Ne,xn)=>x(o).renameSession(Ne,xn)),onArchive:me[7]||(me[7]=Ne=>x(o).archiveSession(Ne)),onFork:me[8]||(me[8]=Ne=>x(o).forkSession(Ne)),onRenameWorkspace:me[9]||(me[9]=(Ne,xn)=>x(o).renameWorkspace(Ne,xn)),onDeleteWorkspace:me[10]||(me[10]=Ne=>x(o).deleteWorkspace(Ne)),onReorderWorkspaces:me[11]||(me[11]=Ne=>x(o).reorderWorkspaces(Ne)),onSetWorkspaceSortMode:me[12]||(me[12]=Ne=>x(o).setWorkspaceSortMode(Ne)),onLoadMoreSessions:me[13]||(me[13]=Ne=>void x(o).loadMoreSessions(Ne)),onLoadAllSessions:me[14]||(me[14]=Ne=>void x(o).loadAllSessions()),onOpenSettings:me[15]||(me[15]=Ne=>Ct.value=!0),onCollapse:x(rt)},null,8,["col-width","active-workspace","active-workspace-id","sessions","groups","active-id","attention-by-session","pending-by-session","unread-by-session","workspace-sort-mode","onCollapse"]),[[Qo,!x(ze)]]),Mn(oe(L_,{"storage-key":x(X),"default-width":x(fe),min:x(ye),max:x(Me),"onUpdate:width":me[16]||(me[16]=Ne=>we.value=Ne)},null,8,["storage-key","default-width","min","max"]),[[Qo,!x(ze)]]),x(ze)?(w(),N("div",Gfe,[oe(gn,{size:"sm",label:x(r)("sidebar.expandSidebar"),onClick:x(rt)},{default:_e(()=>[oe(Je,{name:"panel-expand",size:"sm"})]),_:1},8,["label","onClick"])])):ie("",!0)],64)),oe(gee,{ref_key:"conversationPaneRef",ref:In,mobile:x(a),turns:x(o).turns.value,"session-id":x(o).activeSessionId.value,approvals:x(o).pendingApprovals.value,changes:x(o).changes.value,"git-info":x(o).gitInfo.value,tasks:x(o).tasks.value,todos:x(o).todos.value,goal:x(o).goal.value,swarms:x(o).swarms.value,"activation-badges":x(o).activationBadges.value,status:x(o).status.value,thinking:x(o).thinking.value,"plan-mode":x(o).planMode.value,"swarm-mode":x(o).swarmMode.value,"goal-mode":x(o).goalMode.value,models:x(o).models.value,"starred-ids":x(o).starredModelIds.value,skills:x(o).skills.value,questions:x(o).questions.value,"pending-question-actions":x(o).pendingQuestionActions,"pending-approval-actions":x(o).pendingApprovalActions,running:h.value,queued:x(o).queued.value,"search-files":x(o).searchFiles,"upload-image":x(o).uploadImage,sending:x(o).isSending.value,"fast-moon":x(o).fastMoon.value,"file-reload-key":x(o).activeSessionId.value,"session-loading":x(o).sessionLoading.value,compaction:x(o).compaction.value,"has-more-messages":x(o).hasMoreMessages.value,"loading-more":x(o).loadingMoreMessages.value,"loading-more-error":x(o).loadMoreMessagesError.value,"load-older-messages":x(o).loadOlderMessages,"workspace-name":x(o).visibleWorkspace.value?.name,"workspace-root":x(o).visibleWorkspace.value?.root??x(o).status.value.cwd,"git-diff-stats":x(o).gitDiffStats.value,workspaces:x(o).workspacesView.value,"active-workspace-id":x(o).activeWorkspaceId.value,"session-title":d.value,pr:x(o).activePullRequest.value,"conversation-toc":x(o).conversationToc.value,onOpenChanges:me[19]||(me[19]=Ne=>x(Pt)()),onSelectWorkspace:me[20]||(me[20]=Ne=>al(Ne)),onAddWorkspace:me[21]||(me[21]=Ne=>Ge.value=!0),onOpenPr:Os,onSubmit:me[22]||(me[22]=Ne=>bo(Ne)),onSteer:me[23]||(me[23]=Ne=>x(o).steerPrompt(Ne.text,Ne.attachments)),onApproval:me[24]||(me[24]=(Ne,xn)=>x(o).respondApproval(Ne,xn)),onCancelTask:me[25]||(me[25]=Ne=>x(o).cancelTask(Ne)),onAnswer:me[26]||(me[26]=(Ne,xn)=>x(o).respondQuestion(Ne,xn)),onDismiss:me[27]||(me[27]=Ne=>x(o).dismissQuestion(Ne)),onCommand:Qt,onInterrupt:me[28]||(me[28]=Ne=>x(o).abortCurrentPrompt()),onUnqueue:Wt,onEditQueued:ds,onReorderQueue:Bn,onSetPermission:me[29]||(me[29]=Ne=>x(o).setPermission(Ne)),onSetThinking:me[30]||(me[30]=Ne=>x(o).setThinking(Ne)),onTogglePlan:me[31]||(me[31]=Ne=>x(o).togglePlanMode()),onToggleSwarm:me[32]||(me[32]=Ne=>x(o).toggleSwarmMode()),onToggleGoal:me[33]||(me[33]=Ne=>x(o).toggleGoalMode()),onCreateGoal:me[34]||(me[34]=Ne=>x(o).createGoal(Ne)),onControlGoal:me[35]||(me[35]=Ne=>x(o).controlGoal(Ne)),onRefreshGitStatus:me[36]||(me[36]=Ne=>x(o).activeSessionId.value&&x(o).loadGitStatus(x(o).activeSessionId.value)),onRenameSession:me[37]||(me[37]=(Ne,xn)=>x(o).renameSession(Ne,xn)),onForkSession:me[38]||(me[38]=Ne=>x(o).forkSession(Ne)),onArchiveSession:me[39]||(me[39]=Ne=>x(o).archiveSession(Ne)),onCompact:me[40]||(me[40]=Ne=>x(o).compact()),onPickModel:me[41]||(me[41]=Ne=>Xt()),onSelectModel:me[42]||(me[42]=Ne=>x(o).setModel(Ne)),onOpenFile:me[43]||(me[43]=Ne=>x(P)(Ne)),onOpenMedia:me[44]||(me[44]=Ne=>x(D)(Ne)),onOpenThinking:me[45]||(me[45]=Ne=>x(ue)(Ne)),onOpenCompaction:me[46]||(me[46]=Ne=>x(ge)(Ne)),onOpenAgent:me[47]||(me[47]=Ne=>x(ae)(Ne)),onOpenToolDiff:me[48]||(me[48]=Ne=>x(tt)(Ne)),onEditMessage:Oe},null,8,["mobile","turns","session-id","approvals","changes","git-info","tasks","todos","goal","swarms","activation-badges","status","thinking","plan-mode","swarm-mode","goal-mode","models","starred-ids","skills","questions","pending-question-actions","pending-approval-actions","running","queued","search-files","upload-image","sending","fast-moon","file-reload-key","session-loading","compaction","has-more-messages","loading-more","loading-more-error","load-older-messages","workspace-name","workspace-root","git-diff-stats","workspaces","active-workspace-id","session-title","pr","conversation-toc"]),x(bn)&&!x(a)?(w(),ve(L_,{key:2,"storage-key":x(le),"default-width":x(G),min:x(U),max:x(ne),reverse:"","aria-label":x(r)("layout.resizePreviewAria"),"onUpdate:width":me[49]||(me[49]=Ne=>H.value=Ne),"onUpdate:dragging":me[50]||(me[50]=Ne=>Vn.value=Ne)},null,8,["storage-key","default-width","min","max","aria-label"])):ie("",!0),!x(a)||x(bn)?(w(),N("aside",{key:3,class:Re(["global-preview",{open:x(bn),mobile:x(a),"no-anim":x(Vn)||$.value}]),role:"complementary","aria-label":x(r)("layout.detailPanelAria"),"aria-hidden":!x(bn)},[O.value==="thinking"&&x(te)?(w(),ve(XS,{key:0,text:x(ce)??"",onClose:x(j)},null,8,["text","onClose"])):O.value==="compaction"&&x(re)?(w(),ve(XS,{key:1,text:x(Y)??"",subtitle:x(r)("conversation.summaryTitle"),onClose:x(Ae)},null,8,["text","subtitle","onClose"])):O.value==="agent"&&x(Ie)?(w(),ve(Dte,{key:2,member:x(Ie),onClose:x(Te)},null,8,["member","onClose"])):O.value==="btw"&&x(Rn)?(w(),ve(one,{key:3,turns:x(o).sideChatTurns.value,running:x(o).sideChatRunning.value,sending:x(o).sideChatSending.value,onSend:me[51]||(me[51]=Ne=>x(o).sendSideChatPrompt(Ne)),onClose:x(Ft)},null,8,["turns","running","sending","onClose"])):O.value==="diff"?(w(),ve(Nne,{key:4,mode:x(kt),changes:x(o).changes.value,"git-info":x(o).gitInfo.value,"file-diff":x(o).fileDiff.value,"selected-diff-path":x(o).selectedDiffPath.value,"file-diff-loading":x(o).fileDiffLoading.value,closable:"",onOpen:x(Yt),onBack:me[52]||(me[52]=Ne=>{kt.value="list",Tt.value=null,x(o).clearFileDiff()}),onClose:x(mt)},null,8,["mode","changes","git-info","file-diff","selected-diff-path","file-diff-loading","onOpen","onClose"])):O.value==="toolDiff"&&x(Ve)?(w(),ve(Xte,{key:5,target:x(Ve),onClose:x(bt)},null,8,["target","onClose"])):O.value==="file"?(w(),ve(yte,{key:6,file:x(E),loading:x(M),error:x(L),line:x(k)?.line,"download-url":x(S),closable:"","external-actions":x(I),"open-file":x(P),onClose:x(W),onOpenExternal:x(z),onReveal:x(q)},null,8,["file","loading","error","line","download-url","external-actions","open-file","onClose","onOpenExternal","onReveal"])):ie("",!0)],10,Yfe)):ie("",!0),_n.value?(w(),ve(Qne,{key:4,models:x(o).models.value,current:x(o).status.value.modelId,"starred-ids":x(o).starredModelIds.value,loading:tn.value,unavailable:Ln.value,onSelect:me[53]||(me[53]=Ne=>Do(Ne)),onToggleStar:me[54]||(me[54]=Ne=>x(o).toggleStarModel(Ne)),onClose:me[55]||(me[55]=Ne=>_n.value=!1)},null,8,["models","current","starred-ids","loading","unavailable"])):ie("",!0),Ct.value?(w(),ve(Aie,{key:5,"color-scheme":x(o).colorScheme.value,accent:x(o).accent.value,"ui-font-size":x(o).uiFontSize.value,"auth-ready":x(o).authReady.value,"account-model":x(o).defaultModel.value,notify:x(o).notifyOnComplete.value,"notify-question":x(o).notifyOnQuestion.value,"notify-permission":x(o).notifyPermission.value,sound:x(o).soundOnComplete.value,"conversation-toc":x(o).conversationToc.value,config:x(o).config.value,models:x(o).models.value,"config-saving":us.value,"server-version":x(o).serverVersion.value,onSetColorScheme:me[56]||(me[56]=Ne=>x(o).setColorScheme(Ne)),onSetAccent:me[57]||(me[57]=Ne=>x(o).setAccent(Ne)),onSetUiFontSize:me[58]||(me[58]=Ne=>x(o).setUiFontSize(Ne)),onSetNotify:me[59]||(me[59]=Ne=>x(o).setNotifyOnComplete(Ne)),onSetNotifyQuestion:me[60]||(me[60]=Ne=>x(o).setNotifyOnQuestion(Ne)),onSetSound:me[61]||(me[61]=Ne=>x(o).setSoundOnComplete(Ne)),onSetConversationToc:me[62]||(me[62]=Ne=>x(o).setConversationToc(Ne)),onUpdateConfig:me[63]||(me[63]=Ne=>Nt(Ne)),onLogin:me[64]||(me[64]=()=>{Ct.value=!1,bs()}),onLogout:x(o).logout,onOpenOnboarding:me[65]||(me[65]=()=>{Ct.value=!1,y()}),onOpenProviders:me[66]||(me[66]=()=>{Ct.value=!1,oi()}),onClose:me[67]||(me[67]=Ne=>Ct.value=!1)},null,8,["color-scheme","accent","ui-font-size","auth-ready","account-model","notify","notify-question","notify-permission","sound","conversation-toc","config","models","config-saving","server-version","onLogout"])):ie("",!0),Kn.value?(w(),ve(kse,{key:6,providers:x(o).providers.value,loading:Zn.value,unavailable:Mt.value,onAdd:me[68]||(me[68]=Ne=>so(Ne)),onRefresh:me[69]||(me[69]=Ne=>oo(Ne)),onDelete:me[70]||(me[70]=Ne=>qs(Ne)),onOpenLogin:me[71]||(me[71]=()=>{Kn.value=!1,bs()}),onClose:me[72]||(me[72]=Ne=>Kn.value=!1)},null,8,["providers","loading","unavailable"])):ie("",!0),Ye.value?(w(),ve(mre,{key:7,status:x(o).status.value,thinking:x(o).thinking.value,"plan-mode":x(o).planMode.value,"swarm-mode":x(o).swarmMode.value,"cost-usd":x(o).sessionCost.value,onClose:me[73]||(me[73]=Ne=>Ye.value=!1)},null,8,["status","thinking","plan-mode","swarm-mode","cost-usd"])):ie("",!0),Ge.value?(w(),ve(Jie,{key:8,"browse-fs":x(o).browseFs,"get-fs-home":x(o).getFsHome,"default-path":x(o).visibleWorkspace.value?.root??x(o).status.value.cwd,error:mn.value,onAdd:me[74]||(me[74]=Ne=>ii(Ne)),onClose:_s},null,8,["browse-fs","get-fs-home","default-path","error"])):ie("",!0),oe(Gr,{name:"gload-fade"},{default:_e(()=>[x(o).initialized.value?ie("",!0):(w(),ve(Pae,{key:0}))]),_:1}),g.value&&!x(m)?(w(),ve(Iae,{key:9,onComplete:v,onSkip:v})):ie("",!0),oe(Tre,{warnings:x(o).warnings.value,onDismiss:x(o).dismissWarning},null,8,["warnings","onDismiss"]),x(l)?(w(),ve(dce,{key:10})):ie("",!0),oe(sre),x(a)?(w(),ve(ile,{key:11,modelValue:c.value,"onUpdate:modelValue":me[75]||(me[75]=Ne=>c.value=Ne),groups:x(o).workspaceGroups.value,"active-workspace-id":x(o).activeWorkspaceId.value,"active-id":x(o).activeSessionId.value,"attention-by-session":x(o).attentionBySession.value,"attention-by-workspace":x(o).attentionByWorkspace.value,onSelect:me[76]||(me[76]=Ne=>x(o).selectSession(Ne)),onCreate:ll,onCreateInWorkspace:me[77]||(me[77]=Ne=>al(Ne)),onAddWorkspace:me[78]||(me[78]=Ne=>Ge.value=!0),onRename:me[79]||(me[79]=(Ne,xn)=>x(o).renameSession(Ne,xn)),onArchive:me[80]||(me[80]=Ne=>x(o).archiveSession(Ne)),onDeleteWorkspace:me[81]||(me[81]=Ne=>x(o).deleteWorkspace(Ne)),onLoadMore:me[82]||(me[82]=Ne=>void x(o).loadMoreSessions(Ne))},null,8,["modelValue","groups","active-workspace-id","active-id","attention-by-session","attention-by-workspace"])):ie("",!0),x(a)?(w(),ve(eae,{key:12,modelValue:u.value,"onUpdate:modelValue":me[83]||(me[83]=Ne=>u.value=Ne),status:x(o).status.value,thinking:x(o).thinking.value,models:x(o).models.value,"plan-mode":x(o).planMode.value,"swarm-mode":x(o).swarmMode.value,"color-scheme":x(o).colorScheme.value,"ui-font-size":x(o).uiFontSize.value,"auth-ready":x(o).authReady.value,"conversation-toc":x(o).conversationToc.value,"server-version":x(o).serverVersion.value,onPickModel:me[84]||(me[84]=Ne=>Xt()),onSetThinking:me[85]||(me[85]=Ne=>x(o).setThinking(Ne)),onTogglePlan:me[86]||(me[86]=Ne=>x(o).togglePlanMode()),onToggleSwarm:me[87]||(me[87]=Ne=>x(o).toggleSwarmMode()),onSetPermission:me[88]||(me[88]=Ne=>x(o).setPermission(Ne)),onSetColorScheme:me[89]||(me[89]=Ne=>x(o).setColorScheme(Ne)),onSetUiFontSize:me[90]||(me[90]=Ne=>x(o).setUiFontSize(Ne)),onSetConversationToc:me[91]||(me[91]=Ne=>x(o).setConversationToc(Ne)),onLogin:me[92]||(me[92]=()=>{u.value=!1,bs()}),onLogout:x(o).logout},null,8,["modelValue","status","thinking","models","plan-mode","swarm-mode","color-scheme","ui-font-size","auth-ready","conversation-toc","server-version","onLogout"])):ie("",!0)],6)),$n.value?(w(),ve(Yse,{key:3,"on-start-o-auth-login":Xe,"on-poll-o-auth-login":ot,"on-cancel-o-auth-login":de,onSuccess:pe,onClose:me[93]||(me[93]=Ne=>$n.value=!1)})):ie("",!0)]))}}),Qfe=ut(Xfe,[["__scopeId","data-v-f134c061"]]);dG();ap(Qfe).use(Un).mount("#app");export{$E as $,s0 as A,_I as B,os as C,Xpe as D,kC as E,Le as F,c0 as G,qe as H,oe as I,eI as J,_pe as K,ui as L,je as M,K$ as N,xpe as O,Ape as P,Epe as Q,qf as R,Ga as S,lh as T,Tpe as U,d0 as V,Cpe as W,Zpe as X,Mpe as Y,jpe as Z,Jfe as _,GC as a,Hs as a$,Ls as a0,V1 as a1,lpe as a2,Z1 as a3,v$ as a4,cn as a5,gc as a6,ppe as a7,the as a8,vpe as a9,JC as aA,NI as aB,BI as aC,hn as aD,DI as aE,RI as aF,K1 as aG,PI as aH,kn as aI,e0 as aJ,iI as aK,w as aL,q$ as aM,dpe as aN,En as aO,DC as aP,upe as aQ,Yf as aR,$s as aS,Vf as aT,Z as aU,Fpe as aV,c6 as aW,nt as aX,Cn as aY,HI as aZ,wpe as a_,bpe as aa,kpe as ab,ype as ac,Wpe as ad,nhe as ae,Ut as af,S$ as ag,ih as ah,Wr as ai,or as aj,es as ak,Hpe as al,Mo as am,Kr as an,Dr as ao,Npe as ap,Lpe as aq,dn as ar,ht as as,M$ as at,Re as au,Zfe as av,Gt as aw,$I as ax,OI as ay,ls as az,cpe as b,Iq as b$,Gpe as b0,Mu as b1,tp as b2,Vpe as b3,Vr as b4,XE as b5,tpe as b6,Ql as b7,fI as b8,Kpe as b9,ko as bA,Qo as bB,C$ as bC,Upe as bD,Ke as bE,hI as bF,hpe as bG,mI as bH,Ppe as bI,_e as bJ,Ipe as bK,Mn as bL,di as bM,zpe as bN,vt as bO,fpe as bP,un as bQ,Xs as bR,fhe as bS,kj as bT,zM as bU,hhe as bV,GU as bW,oy as bX,phe as bY,u1 as bZ,bhe as b_,epe as ba,R as bb,_f as bc,Spe as bd,Kt as be,ope as bf,spe as bg,RC as bh,Bpe as bi,npe as bj,x as bk,nd as bl,ehe as bm,Qpe as bn,Y$ as bo,mpe as bp,Rpe as bq,pI as br,Jpe as bs,$pe as bt,gpe as bu,KC as bv,lp as bw,o6 as bx,Fx as by,Rv as bz,qpe as c,Eq as c0,ty as c1,Mq as c2,che as c3,WU as c4,ahe as c5,Np as c6,ihe as c7,Tq as c8,RM as c9,khe as ca,rhe as cb,whe as cc,g1 as cd,Ha as ce,h1 as cf,She as cg,_he as ch,dhe as ci,xo as cj,lhe as ck,uhe as cl,XU as cm,yhe as cn,m1 as co,p1 as cp,vhe as cq,ohe as cr,ghe as cs,mhe as ct,ut as cu,she as cv,_A as cw,X5 as cx,Dpe as d,zr as e,ipe as f,Gr as g,Z$ as h,rpe as i,ape as j,ti as k,Ju as l,gs as m,Qp as n,ir as o,Ype as p,F as q,ap as r,ve as s,ie as t,N as u,T as v,a$ as w,Ope as x,l$ as y,u6 as z};
|
|
279
|
+
`),o=[];return n.forEach((i,r)=>{o.push({kind:"rem",gutter:String(r+1),text:`- ${i}`})}),s.forEach((i,r)=>{o.push({kind:"add",gutter:String(r+1),text:`+ ${i}`})}),o}function Cde(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const s=typeof t.path=="string"?t.path:"";return Array.isArray(t.diff)?{kind:"diff",path:s,diff:t.diff}:typeof t.old_text=="string"&&typeof t.new_text=="string"?{kind:"diff",path:s,diff:Sde(t.old_text,t.new_text)}:{kind:"diff",path:s,diff:[]}}if(n==="shell"||n==="command"){const s=typeof t.command=="string"?t.command:e.action,o=typeof t.cwd=="string"?t.cwd:void 0,i=typeof t.danger=="string"?t.danger:void 0;return{kind:"shell",command:s,cwd:o,danger:i}}if(n==="file_content"||n==="file"){const s=typeof t.path=="string"?t.path:"",o=typeof t.content=="string"?t.content:"",i=typeof t.language=="string"?t.language:void 0;return{kind:"file",path:s,content:o,language:i}}if(n==="file_op"||n==="fileop"){const s=typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,o=typeof t.path=="string"?t.path:"",i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:s,path:o,detail:i}}if(n==="url_fetch"||n==="url"){const s=typeof t.url=="string"?t.url:e.action;return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:s}}if(n==="search"){const s=typeof t.query=="string"?t.query:e.action,o=typeof t.scope=="string"?t.scope:void 0;return{kind:"search",query:s,scope:o}}if(n==="invocation"||n==="agent_call"||n==="skill_call"){const s=typeof t.kind=="string"?t.kind:n,o=typeof t.name=="string"?t.name:e.toolName,i=typeof t.description=="string"?t.description:void 0;return{kind:"invocation",kind2:s,name:o,description:i}}if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const s=typeof t.plan=="string"?t.plan:"",o=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},c=typeof a.label=="string"?a.label:"";if(!c)return null;const u=typeof a.description=="string"?a.description:void 0;return{label:c,description:u}}).filter(l=>l!==null);return{kind:"plan_review",plan:s,path:o,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function xde(e){return{questionId:e.questionId,sessionId:e.sessionId,questions:e.questions.map(t=>({id:t.id,question:t.question,header:t.header,body:t.body,options:t.options.map(n=>({id:n.id,label:n.label,description:n.description,recommended:n.recommended})),multiSelect:t.multiSelect,allowOther:t.allowOther,otherLabel:t.otherLabel}))}}function Ade(e){const t=be.messagesBySession[e.sessionId];if(!t||t.length===0)return;const n=new Map;for(const o of t)if(o.role==="assistant")for(const i of o.content){if(i.type!=="toolUse"||i.toolName!=="Bash"&&i.toolName!=="bash")continue;const r=i.input,l=r&&typeof r.command=="string"?r.command:void 0;l&&n.set(i.toolCallId,l)}if(n.size===0)return;const s=`task_id: ${e.id}`;for(const o of t)if(o.role==="tool")for(const i of o.content){if(i.type!=="toolResult")continue;if((typeof i.output=="string"?i.output:i.output!==void 0?JSON.stringify(i.output):"").includes(s)){const l=n.get(i.toolCallId);if(l)return l}}}function Tde(e){let t;e.status==="running"?t="run":e.status==="completed"?t="done":t="fail";let n="";if(e.status==="running"&&e.startedAt){const r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3),l=Math.floor(r/60),a=r%60;n=Un.global.t("tasks.timingRunning",{time:`${l}:${String(a).padStart(2,"0")}`})}else if(e.completedAt&&e.startedAt){const r=Math.round((new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3);n=Un.global.t("tasks.timingDone",{sec:r})}else n=e.status;const s=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,o=e.command??Ade(e),i=e.kind==="bash"&&o?`$ ${o}`:void 0;return{id:e.id,name:e.description,kind:e.kind,state:t,timing:n,meta:i,output:s,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId}}const Mde=F(()=>{const e=be.sessions.find(n=>n.id===be.activeSessionId),t=e?e.cwd.split("/").pop()??e.cwd:"main";return{name:be.workspaceName,branch:t}}),Ede=F(()=>(Qu.value,be.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:Ry(e.updatedAt,e.status),status:e.status,busy:Uh(e.id)})))),Ide=F(()=>be.activeSessionId??""),$de=F(()=>{const e=be.activeSessionId;return e?Wn.skillsBySession.value[e]??[]:[]}),Nde=F(()=>{const e=be.activeSessionId;return e?be.sendingBySession[e]??!1:!1}),Bs=fue(be,{pushOperationFailure:Wh,nextOptimisticMsgId:h4,connectEventsIfNeeded:Ly,getEventConn:()=>hi}),hd=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=Bs.sideChatTargetBySession.value[e]?.agentId;return(be.tasksBySession[e]??[]).filter(n=>n.id!==t)}),y4=Oce(be,hd),Lde=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=new Set(be.sideChatUserMessageIdsBySession[e]??[]),n=(be.messagesBySession[e]??[]).filter(o=>!t.has(o.id)),s=be.approvalsBySession[e]??[];return q3(n,s,o=>dt().getFileUrl(o),qh.value!=="idle",hd.value,be.planReviewByToolCallId)}),Ode=F(()=>(y4.taskClock.value,hd.value.map(Tde))),k4=F(()=>Hce(hd.value)),La=F(()=>{const e=be.activeSessionId;return e?be.goalBySession[e]??null:null}),Pde=F(()=>{const e=be.activeSessionId;return e?Oue(be.messagesBySession[e]??[]):[]}),Rde=F(()=>{const e=be.activeSessionId;return e?be.compactionBySession[e]??null:null}),Dde=F(()=>be.connection),Bde=F(()=>be.loading),Fde=F(()=>be.sessionLoading),Hde=F(()=>{const e=be.activeSessionId;return e?be.messagesLoadingMoreBySession[e]??!1:!1}),Wde=F(()=>{const e=be.activeSessionId;return e?be.messagesHasMoreBySession[e]??!1:!1}),zde=F(()=>{const e=be.activeSessionId;return e?be.messagesLoadMoreErrorBySession[e]??!1:!1}),Ude=F(()=>be.serverVersion),qde=F(()=>be.dangerousBypassAuth);function jde(){be.dangerousBypassAuth=!1}const Vde=F(()=>be.permission),Kde=F(()=>be.thinking),b4=F(()=>{const e=be.activeSessionId;return e?be.planModeBySession[e]??!1:Rh.planMode}),Gde=F(()=>{const e=be.activeSessionId;return e?be.swarmModeBySession[e]??!1:Rh.swarmMode}),Yde=F(()=>{const e=be.activeSessionId;return e?be.goalModeBySession[e]??!1:Rh.goalMode}),Xde=F(()=>{const e=Wce(k4.value);return{plan:b4.value,goal:La.value&&La.value.status!=="complete"?{status:La.value.status,turnsUsed:La.value.turnsUsed,elapsedMs:La.value.wallClockMs}:null,swarm:e.total>0?e:null}}),Qde=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=dt();return(be.queuedBySession[e]??[]).map(n=>({text:n.text,attachmentCount:n.attachments?.length??0,attachments:n.attachments?.map(s=>({fileId:s.fileId,kind:s.kind,url:t.getFileUrl(s.fileId)}))}))}),Zde=F(()=>be.warnings),Jde=F(()=>{const e=be.activeSessionId;return e?(be.questionsBySession[e]??[]).map(xde):[]}),efe=F(()=>{const e=be.activeSessionId;return e?(be.approvalsBySession[e]??[]).map(t=>({approvalId:t.approvalId,block:Cde(t),agentName:t.agentName})):[]}),qh=F(()=>{const e=be.activeSessionId;return e?(be.approvalsBySession[e]??[]).length>0?"awaiting-approval":(be.questionsBySession[e]??[]).length>0?"awaiting-question":Uh(e)?"running":"idle":"idle"}),Wn=Dce(be,{pushOperationFailure:Wh,refreshSessionStatus:Bh,persistSessionProfile:u4,activity:qh,inFlightPromptSessions:Fh,saveThinkingToStorage:Fue,updateSession:Dh,updateSessionMessages:o4}),Up=F(()=>{const e=be.activeSessionId;if(!e)return null;const t=be.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),tfe=F(()=>{const e=be.activeSessionId;return e?be.gitStatusBySession[e]?.pullRequest??null:null}),nfe=F(()=>{const e=be.activeSessionId;if(!e)return[];const t=be.gitStatusBySession[e];return t?Object.entries(t.entries).map(([n,s])=>({path:n,status:s})).sort((n,s)=>n.path.localeCompare(s.path)):[]}),sfe=F(()=>{const e=be.activeSessionId;if(!e)return null;const t=be.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),_4=F(()=>{const e=be.sessions.find(r=>r.id===be.activeSessionId),t=Up.value?.branch??(e?e.cwd.split("/").pop()??e.cwd:"main"),n=e===void 0?Wn.draftModel.value:null,s=(e?.model&&e.model.length>0?e.model:n??be.defaultModel)??"—",o=Wn.models.value.find(r=>r.id===s||r.model===s);return{model:o?.displayName||o?.model||(s.includes("/")?s.split("/").pop():s),modelId:o?.id??s,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:be.permission,branch:t,cwd:e?.cwd??"",isGitRepo:Up.value!==null}}),ofe=F(()=>l4.value),ife=F(()=>be.sessions.find(t=>t.id===be.activeSessionId)?.usage.totalCostUsd??0),rfe=F(()=>be.authReady),lfe=F(()=>be.defaultModel),afe=F(()=>be.managedProviderStatus),cfe=F(()=>be.config),ufe=F(()=>{const e=be.activeSessionId;if(!e)return{};const t=be.gitStatusBySession[e];return t?{...t.entries}:{}});function pc(e){return be.workspaces.find(t=>t.root===e.cwd)?.id??e.workspaceId??e.cwd}const Dy=F(()=>hce({workspaces:be.workspaces,sessions:be.sessions,hiddenWorkspaceRoots:be.hiddenWorkspaceRoots,activeRoot:be.sessions.find(e=>e.id===be.activeSessionId)?.cwd,activeBranch:Up.value?.branch??null,sessionsHasMoreByWorkspace:be.sessionsHasMoreByWorkspace})),qp=Z(k5()),hc=Z(b5()==="manual"?"manual":"recent");Ke(()=>[Dy.value.map(e=>e.id).join("\0"),be.loading],([e,t])=>{if(t)return;const n=e?e.split("\0"):[],s=N5(n,qp.value);s!==null&&(qp.value=s,kA(s))});const Yl=F(()=>{const e=Dy.value.map(t=>({id:t.id,name:t.name,root:t.root,shortPath:que(t.root,be.fsHome),branch:t.branch,sessionCount:t.sessionCount}));if(hc.value==="recent"){const t=new Map;for(const n of be.sessions){if(n.parentSessionId)continue;const s=pc(n),o=new Date(n.updatedAt).getTime();o>(t.get(s)??Number.NEGATIVE_INFINITY)&&t.set(s,o)}return P5(e,t)}return L5(e,qp.value)}),w4=F(()=>{const e=be.activeWorkspaceId,t=Yl.value;return e&&t.some(n=>n.id===e)?e:t[0]?.id??null}),dfe=F(()=>{const e=w4.value;return e?Yl.value.find(t=>t.id===e)??null:null}),ffe=F(()=>{Qu.value;const e=new Set(Yl.value.map(n=>n.id)),t=new Map(Yl.value.map(n=>[n.id,n.name]));return be.sessions.filter(n=>!n.parentSessionId&&e.has(pc(n))).map(n=>{const s=pc(n);return{id:n.id,title:n.title,time:Ry(n.updatedAt,n.status),status:n.status,busy:Uh(n.id),lastPrompt:n.lastPrompt,workspaceId:s,workspaceName:t.get(s)}})}),pfe=F(()=>{Qu.value;const e=new Map;for(const t of be.sessions.toSorted((n,s)=>new Date(s.updatedAt).getTime()-new Date(n.updatedAt).getTime())){if(t.parentSessionId)continue;const n=pc(t),s={id:t.id,title:t.title,time:Ry(t.updatedAt,t.status),status:t.status,busy:Uh(t.id),updatedAt:t.updatedAt},o=e.get(n)??[];o.push(s),e.set(n,o)}return Yl.value.map(t=>({workspace:t,sessions:e.get(t.id)??[],hasMore:be.sessionsHasMoreByWorkspace[t.id]??!1,loadingMore:be.sessionsLoadingMoreByWorkspace[t.id]??!1,initialCount:be.sessionsInitialCountByWorkspace[t.id]??W1}))});function hfe(e){qp.value=e,kA(e),hc.value!=="manual"&&(hc.value="manual",bA("manual"))}function mfe(e){hc.value!==e&&(hc.value=e,bA(e))}const S4=F(()=>{const e={};for(const[t,n]of Object.entries(be.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(const[t,n]of Object.entries(be.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),gfe=F(()=>{const e={};for(const[t,n]of Object.entries(be.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(const[t,n]of Object.entries(be.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),vfe=F(()=>{const e={};for(const[t,n]of Object.entries(be.unreadBySession))n&&(e[t]=!0);return e}),yfe=F(()=>{const e={},t=S4.value;for(const n of be.sessions){const s=t[n.id]??0;if(s<=0)continue;const o=pc(n);e[o]=(e[o]??0)+s}return e}),kfe=F(()=>be.recentRoots),bfe=F(()=>be.availableOpenInApps),gt=wue(be,{taskPoller:y4,sideChat:Bs,modelProvider:Wn,pushOperationFailure:Wh,activity:qh,inFlightPromptSessions:Fh,sessionsKnownEmpty:m4,setSessions:n4,updateSession:Dh,upsertSessionFront:jue,appendSession:Vue,forgetSession:i4,setActiveSessionId:Ny,updateSessionMessages:o4,nextOptimisticMsgId:h4,getEventConn:()=>hi,syncSessionFromSnapshot:Py,reopenSession:bde,hasLoadedMessages:gde,refreshSessionStatus:Bh,persistSessionProfile:u4,mergedWorkspaces:Dy,workspacesView:Yl,status:_4,workspaceIdForSession:pc,savePermissionToStorage:Due,savePlanModeToStorage:Z3,saveSwarmModeToStorage:J3,saveGoalModeToStorage:e4,draftModes:Rh,saveUnread:w0,saveActiveWorkspaceToStorage:Uue,saveHiddenWorkspacesToStorage:zue,goalErrorMessage:fde,resetFastMoon:Ei.resetFastMoon,initialized:c4,selectedDiffPath:r4,fileDiffLines:l4,fileDiffLoading:a4});function _fe(e,t){if(Fh.delete(e),be.sendingBySession={...be.sendingBySession,[e]:!1},be.promptIdBySession[e]!==void 0){const i={...be.promptIdBySession};delete i[e],be.promptIdBySession=i}e===be.activeSessionId?(Ei.resetFastMoon(),gt.loadGitStatus(e),Bh(e)):t==="idle"&&(be.unreadBySession={...be.unreadBySession,[e]:!0},w0({[e]:!0})),Ol.maybeNotifyCompletion(e,{isActiveAndVisible:e===be.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible",sessionTitle:be.sessions.find(i=>i.id===e)?.title??"",onClick:()=>{gt.selectSession(e)}}),t==="idle"&&zp.maybePlayCompletionSound();const n=be.queuedBySession[e]??[];if(n.length===0)return;const[s,...o]=n;be.queuedBySession={...be.queuedBySession,[e]:o},s!==void 0&>.submitPromptInternal(e,s.text,s.attachments).then(i=>{if(!i){const r=be.queuedBySession[e]??[];be.queuedBySession={...be.queuedBySession,[e]:[s,...r]}}})}function wfe(e,t){const n=t.questions[0],s=n?.header?.trim()??"",o=n?.question?.trim()??"",i=s&&o?`${s}: ${o}`:o||s;Ol.maybeNotifyQuestion(e,{isActiveAndVisible:e===be.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible",sessionTitle:be.sessions.find(r=>r.id===e)?.title??"",questionPreview:i,onClick:()=>{gt.selectSession(e)}}),zp.maybePlayQuestionSound()}function Sfe(){return wde(),{workspace:Mde,sessions:Ede,activeSessionId:Ide,workspacesView:Yl,workspaceSortMode:hc,visibleWorkspace:dfe,activeWorkspaceId:w4,sessionsForView:ffe,workspaceGroups:pfe,attentionBySession:S4,pendingBySession:gfe,attentionByWorkspace:yfe,unreadBySession:vfe,recentRoots:kfe,turns:Lde,tasks:Ode,activeAppTasks:hd,todos:Pde,goal:La,swarms:k4,activationBadges:Xde,compaction:Rde,status:_4,sessionCost:ife,fileDiff:ofe,selectedDiffPath:r4,fileDiffLoading:a4,changes:nfe,gitInfo:Up,gitDiffStats:sfe,activePullRequest:tfe,changesByPath:ufe,pendingApprovals:efe,availableOpenInApps:bfe,connection:Dde,loading:Bde,sessionLoading:Fde,loadingMoreMessages:Hde,hasMoreMessages:Wde,loadMoreMessagesError:zde,serverVersion:Ude,dangerousBypassAuth:qde,clearDangerousBypassAuth:jde,initialized:c4,permission:Vde,thinking:Kde,planMode:b4,swarmMode:Gde,goalMode:Yde,queued:Qde,warnings:Zde,questions:Jde,activity:qh,isSending:Nde,fastMoon:Ei.fastMoon,models:Wn.models,starredModelIds:Wn.starredModelIds,providers:Wn.providers,uiFontSize:Ei.uiFontSize,setUiFontSize:Ei.setUiFontSize,conversationToc:f4,setConversationToc:Jue,colorScheme:Ei.colorScheme,setColorScheme:Ei.setColorScheme,accent:Ei.accent,setAccent:Ei.setAccent,notifyOnComplete:Ol.notifyOnComplete,notifyOnQuestion:Ol.notifyOnQuestion,notifyPermission:Ol.notifyPermission,setNotifyOnComplete:Ol.setNotifyOnComplete,setNotifyOnQuestion:Ol.setNotifyOnQuestion,soundOnComplete:zp.soundOnComplete,setSoundOnComplete:zp.setSoundOnComplete,onboarded:p4,setOnboarded:tde,load:gt.load,selectSession:gt.selectSession,clearActiveSession:gt.clearActiveSession,loadOlderMessages:gt.loadOlderMessages,loadWorkspaces:gt.loadWorkspaces,loadMoreSessions:gt.loadMoreSessions,loadAllSessions:gt.loadAllSessions,selectWorkspace:gt.selectWorkspace,openWorkspace:gt.openWorkspace,openWorkspaceDraft:gt.openWorkspaceDraft,startSessionAndSendPrompt:gt.startSessionAndSendPrompt,addWorkspaceByPath:gt.addWorkspaceByPath,browseFs:gt.browseFs,getFsHome:gt.getFsHome,sendPrompt:gt.sendPrompt,steerPrompt:gt.steerPrompt,sideChatVisible:Bs.sideChatVisible,sideChatSessionId:Bs.sideChatSessionId,sideChatTurns:Bs.sideChatTurns,sideChatRunning:Bs.sideChatRunning,sideChatSending:Bs.sideChatSending,openSideChat:Bs.openSideChat,closeSideChat:Bs.closeSideChat,sendSideChatPrompt:Bs.sendSideChatPrompt,uploadImage:gt.uploadImage,abortCurrentPrompt:gt.abortCurrentPrompt,respondApproval:gt.respondApproval,respondQuestion:gt.respondQuestion,dismissQuestion:gt.dismissQuestion,pendingQuestionActions:gt.pendingQuestionActions,pendingApprovalActions:gt.pendingApprovalActions,cancelTask:gt.cancelTask,setPermission:gt.setPermission,setThinking:Wn.setThinking,setPlanMode:gt.setPlanMode,togglePlanMode:gt.togglePlanMode,setSwarmMode:gt.setSwarmMode,toggleSwarmMode:gt.toggleSwarmMode,setGoalMode:gt.setGoalMode,toggleGoalMode:gt.toggleGoalMode,createGoal:gt.createGoal,controlGoal:gt.controlGoal,enqueue:gt.enqueue,dismissWarning:gt.dismissWarning,renameSession:gt.renameSession,renameWorkspace:gt.renameWorkspace,deleteWorkspace:gt.deleteWorkspace,reorderWorkspaces:hfe,setWorkspaceSortMode:mfe,archiveSession:gt.archiveSession,compact:gt.compact,forkSession:gt.forkSession,undo:gt.undo,unqueue:gt.unqueue,reorderQueue:gt.reorderQueue,searchFiles:gt.searchFiles,loadGitStatus:gt.loadGitStatus,loadFileDiff:gt.loadFileDiff,clearFileDiff:gt.clearFileDiff,listDir:gt.listDir,readFileContent:gt.readFileContent,getFileDownloadUrl:gt.getFileDownloadUrl,openWorkspaceFile:gt.openWorkspaceFile,openInApp:gt.openInApp,revealWorkspaceFile:gt.revealWorkspaceFile,resolveImageUrl:gt.resolveImageUrl,refreshOAuthProviderModels:Wn.refreshOAuthProviderModels,loadModels:Wn.loadModels,loadProviders:Wn.loadProviders,skills:$de,activateSkill:Wn.activateSkill,setModel:Wn.setModel,toggleStarModel:Wn.toggleStarModel,addProvider:Wn.addProvider,deleteProvider:Wn.deleteProvider,refreshProvider:Wn.refreshProvider,refreshAllProviders:Wn.refreshAllProviders,authReady:rfe,defaultModel:lfe,managedProviderStatus:afe,config:cfe,updateConfig:gt.updateConfig,checkAuth:gt.checkAuth,startOAuthLogin:Wn.startOAuthLogin,pollOAuthLogin:Wn.pollOAuthLogin,cancelOAuthLogin:Wn.cancelOAuthLogin,logout:gt.logout}}function Cfe({client:e,authLogoRef:t}){const n=F(()=>e.authReady.value),s=F(()=>e.initialized.value&&!n.value),o="/login",i=Z(null);let r=null;function l(){return typeof window>"u"?"/":`${window.location.pathname}${window.location.search}${window.location.hash}`}function a(u){typeof window>"u"||window.history.replaceState(window.history.state,"",u)}Ke(s,u=>{if(!(typeof window>"u")){if(u){window.location.pathname!==o&&(i.value=l(),a(o));return}window.location.pathname===o&&(a(i.value??"/"),i.value=null)}},{immediate:!0});function c(){const u=t.value;u&&(u.classList.remove("blink-now"),u.getBoundingClientRect(),u.classList.add("blink-now"),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,u.classList.remove("blink-now")},300))}return kn(()=>{r!==null&&clearTimeout(r)}),{showAuthGate:s,blinkAuthLogo:c}}function xfe({running:e,showAuthGate:t}){const{t:n}=It(),s=["◐","◓","◑","◒"],o=Z(0);let i=null;function r(){i===null&&(o.value=0,i=setInterval(()=>{o.value=(o.value+1)%s.length},250))}function l(){i!==null&&(clearInterval(i),i=null),o.value=0}Ke(e,c=>{c?r():l()},{immediate:!0});const a=F(()=>{const c=e.value?`${s[o.value]} `:"";return t.value?`${c}${n("app.authPageTitle")} - BLUN King Web`:`${c}BLUN King Web`});hI(()=>{typeof document<"u"&&(document.title=a.value)}),kn(()=>{l()})}const C4=Z(typeof window>"u"?0:window.innerWidth);let bf=0,jp=!1;function z1(){C4.value=window.innerWidth}function Afe(){jp||typeof window>"u"||(window.addEventListener("resize",z1),jp=!0,z1())}function Tfe(){!jp||typeof window>"u"||(window.removeEventListener("resize",z1),jp=!1)}function x4(e,t,n){return Math.max(t,e-n)}function U1(e,t,n){return Math.min(n,Math.max(t,e))}function A4(){return hn(()=>{bf+=1,Afe()}),ls(()=>{bf=Math.max(0,bf-1),bf===0&&Tfe()}),{viewportWidth:C4}}const Mfe="king-web.file-preview-width",Oa=320;function Efe({client:e,sideWidth:t,detailTarget:n,closeFilePreview:s}){const{viewportWidth:o}=A4(),i=F(()=>Math.max(0,o.value-t.value)),r=F(()=>x4(i.value,Oa,Oa));function l(ne){return U1(Math.round(ne),Oa,r.value)}function a(){return l(i.value/2)}const c=F(()=>a()),u=Z(c.value),d=F(()=>U1(u.value,Oa,r.value)),p=Z(null),h=F(()=>{const ne=p.value;if(!ne)return null;const J=e.turns.value.find(ce=>ce.id===ne.turnId)?.blocks?.[ne.blockIndex];return J?.kind==="thinking"?J.thinking:null}),f=F(()=>h.value!==null);function m(ne){const H=p.value;if(H&&H.turnId===ne.turnId&&H.blockIndex===ne.blockIndex){p.value=null,n.value==="thinking"&&(n.value=null);return}n.value="thinking",p.value=ne}function b(){p.value=null,n.value==="thinking"&&(n.value=null)}const _=Z(null),g=F(()=>{const ne=_.value;if(!ne)return null;const H=e.turns.value.find(J=>J.id===ne.turnId);return H?.role==="compaction"&&H.text?H.text:null}),v=F(()=>g.value!==null);function y(ne){if(_.value?.turnId===ne.turnId){_.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",_.value=ne}function A(){_.value=null,n.value==="compaction"&&(n.value=null)}const O=Z(null);function $(ne){const H=e.activeAppTasks.value,J=H.find(te=>te.id===ne)??H.find(te=>te.parentToolCallId===ne);if(J)return J.id;const ce=H.filter(te=>te.kind==="subagent"&&!te.parentToolCallId);if(ce.length===1)return ce[0].id}const k=F(()=>{const ne=O.value;if(!ne)return null;const H=e.activeAppTasks.value.find(J=>J.id===ne.subagentId);return H?oue(H):null}),E=F(()=>k.value!==null);function M(ne){const H=$(ne);if(H){if(O.value?.subagentId===H){O.value=null,n.value==="agent"&&(n.value=null);return}O.value={subagentId:H},n.value="agent"}}function L(){O.value=null,n.value==="agent"&&(n.value=null)}const S=Z(null),I=F(()=>{const ne=S.value;if(!ne)return null;const H=aP(e.turns.value,ne);return H?{id:ne,title:id(H.name),path:lP(H.arg),lines:H.status==="error"?null:$A(H),output:H.output}:null}),P=F(()=>I.value!==null);function D(ne){if(n.value==="toolDiff"&&S.value===ne){W();return}n.value="toolDiff",S.value=ne}function W(){S.value=null,n.value==="toolDiff"&&(n.value=null)}const z=Z("list"),q=Z(null);function Q(){if(n.value==="diff"){X();return}n.value="diff",z.value="list",q.value=null,e.loadGitStatus(e.activeSessionId.value)}function X(){n.value==="diff"&&(n.value=null),z.value="list",q.value=null,e.clearFileDiff()}async function fe(ne){z.value="detail",q.value=ne,await e.loadFileDiff(ne)}async function ye(ne){await e.openSideChat(ne),n.value="btw"}function Me(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function we(){n.value==="btw"&&(n.value=null)}const ze=F(()=>e.sideChatVisible.value),Ue=F(()=>n.value!==null&&(n.value!=="thinking"||f.value)&&(n.value!=="compaction"||v.value)&&(n.value!=="agent"||E.value)&&(n.value!=="toolDiff"||P.value)&&(n.value!=="btw"||ze.value)),Fe=Z(!1),rt=Z({});function le(){switch(n.value){case"thinking":return p.value?{kind:"thinking",...p.value}:null;case"compaction":return _.value?{kind:"compaction",..._.value}:null;case"agent":return O.value?{kind:"agent",...O.value}:null;case"toolDiff":return S.value?{kind:"toolDiff",toolId:S.value}:null;case"btw":return{kind:"btw"};default:return null}}function U(ne){if(ne)switch(ne.kind){case"thinking":p.value={turnId:ne.turnId,blockIndex:ne.blockIndex},n.value="thinking";break;case"compaction":_.value={turnId:ne.turnId},n.value="compaction";break;case"agent":O.value={subagentId:ne.subagentId},n.value="agent";break;case"toolDiff":S.value=ne.toolId,n.value="toolDiff";break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function G(){return n.value==="thinking"&&f.value?(b(),!0):n.value==="compaction"&&v.value?(A(),!0):n.value==="agent"&&E.value?(L(),!0):n.value==="toolDiff"&&P.value?(W(),!0):n.value==="file"?(s(),!0):n.value==="diff"?(X(),!0):n.value==="btw"?(Me(),!0):!1}return Ke(e.activeSessionId,(ne,H)=>{if(H){const J=le();J?rt.value[H]=J:delete rt.value[H]}s(),b(),A(),L(),W(),X(),we(),ne&&U(rt.value[ne])}),{PREVIEW_WIDTH_KEY:Mfe,PREVIEW_MIN:Oa,previewDefaultWidth:c,previewMax:r,previewWidth:u,previewPanelWidth:d,thinkingPanelText:h,thinkingVisible:f,openThinkingPanel:m,closeThinkingPanel:b,compactionPanelText:g,compactionPanelVisible:v,openCompactionPanel:y,closeCompactionPanel:A,agentPanelMember:k,agentPanelVisible:E,openAgentPanel:M,closeAgentPanel:L,toolDiffTarget:I,toolDiffVisible:P,openToolDiff:D,closeToolDiff:W,detailDiffMode:z,detailDiffPath:q,openDiffDetail:Q,closeDiffDetail:X,selectDiffFile:fe,btwVisible:ze,openSideChatTab:ye,closeSideChat:Me,hideSideChatPanel:we,sidePanelVisible:Ue,panelDragging:Fe,closeOpenSidePanel:G}}const Ife=Et.sidebarWidth,dC=Et.sidebarCollapsed,fC=270,yv=170,$fe=36,Nfe=320;function Lfe(e={}){const{viewportWidth:t}=A4(),n=Z(fC),s=Z(!1),o=F(()=>{const c=Nfe+(RC(e.previewOpen)?Oa:0);return x4(t.value,yv,c)}),i=F(()=>s.value?$fe:U1(n.value,yv,o.value));function r(){try{s.value=Qn(dC)==="true"}catch{s.value=!1}}function l(){try{ts(dC,String(s.value))}catch{}}function a(){s.value=!s.value,l()}return{SIDEBAR_WIDTH_KEY:Ife,SIDEBAR_DEFAULT:fC,SIDEBAR_MIN:yv,sidebarMax:o,sessionColWidth:n,sidebarCollapsed:s,sideWidth:i,loadSidebarCollapsed:r,toggleSidebarCollapse:a}}function Ofe({client:e,detailTarget:t}){const{t:n}=It(),s=Z(null),o=Z(null),i=Z(!1),r=Z(null),l=Z(null);let a=0,c=null;function u(){c!==null&&(URL.revokeObjectURL(c),c=null)}const d=F(()=>{const $=l.value;return $?e.getFileDownloadUrl($):null}),p=F(()=>s.value!==null);function h($){return $.length>1?$.replace(/\/+$/,""):$}function f($){const k=[];for(const E of $.split(/[\\/]+/))if(!(!E||E===".")){if(E===".."){k.pop();continue}k.push(E)}return k.join("/")}function m($){const k=$.trim();if(!k)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(k))return{error:n("filePreview.errors.unsupportedPath")};if(k.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const E=h(e.status.value.cwd);if(k.startsWith("/")){if(!E||k!==E&&!k.startsWith(`${E}/`))return{error:n("filePreview.errors.outsideWorkspace")};const L=k===E?"":k.slice(E.length+1);if(L.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const S=f(L);return S?{path:S}:{error:n("filePreview.errors.isDirectory")}}if(k.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const M=f(k);return M?{path:M}:{error:n("filePreview.errors.emptyPath")}}async function b($){const k=s.value;if(t.value==="file"&&k&&k.path===$.path&&k.line===$.line){y();return}const E=++a;u(),t.value="file",o.value=null,r.value=null,i.value=!0,s.value=$,l.value=null;const M=m($.path);if("error"in M){i.value=!1,r.value=M.error;return}l.value=M.path;try{const L=await e.readFileContent(M.path);if(E!==a)return;L?o.value={...L,path:L.path||M.path}:o.value={path:M.path,content:"",encoding:"utf-8",mime:"text/plain",isBinary:!1,size:0}}catch(L){if(E!==a)return;r.value=L instanceof Error?L.message:n("filePreview.errors.loadFailed")}finally{E===a&&(i.value=!1)}}function _($){return/^data:([^;,]+)/i.exec($)?.[1]}function g($){if($.kind!=="image")return;const k=++a;u(),t.value="file",s.value=null,l.value=null,r.value=null;const E={path:$.path??"ReadMediaFile image",content:"",encoding:"utf-8",mime:$.mimeType??_($.url)??"image/*",isBinary:!0,size:$.bytes??0};$.fileId?(i.value=!0,o.value=E,dt().getFileBlob($.fileId).then(M=>{if(k===a){if(t.value!=="file"||!o.value){i.value=!1;return}c=URL.createObjectURL(M),o.value={...o.value,sourceUrl:c},i.value=!1}}).catch(()=>{k===a&&(o.value&&(o.value={...o.value,sourceUrl:$.url}),i.value=!1)})):(i.value=!1,o.value={...E,sourceUrl:$.url})}function v(){a+=1,s.value=null,l.value=null,o.value=null,r.value=null,i.value=!1,u()}function y(){v(),t.value==="file"&&(t.value=null)}Ke(t,($,k)=>{k==="file"&&$!=="file"&&v()});function A(){const $=o.value?.path??s.value?.path;$&&e.openWorkspaceFile($,s.value?.line)}function O(){const $=o.value?.path??s.value?.path;$&&e.revealWorkspaceFile($)}return{previewTarget:s,previewFile:o,previewLoading:i,previewError:r,previewDownloadUrl:d,previewExternalActions:p,openFilePreview:b,openMediaPreview:g,closeFilePreview:y,openPreviewInEditor:A,revealPreviewFile:O}}const Pfe=640,Rfe=`(max-width: ${Pfe}px)`;function Dfe(){const e=Z(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(Rfe);e.value=t.matches;const n=s=>{e.value=s.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),kn(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),kn(()=>t.removeListener(n))),e}const Bfe={class:"server-auth-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"server-auth-title"},Ffe={class:"server-auth-card"},Hfe={class:"server-auth-body"},Wfe={class:"server-auth-foot"},zfe=je({__name:"ServerAuthDialog",setup(e){const t=Z(""),n=Z(null),s=Z(!1);hn(()=>{ht(()=>n.value?.focus())});function o(){const r=t.value;!r||s.value||(s.value=!0,b3(r),window.location.reload())}function i(r){r.key==="Enter"&&(r.preventDefault(),o())}return(r,l)=>(w(),N("div",Bfe,[T("div",Ffe,[l[1]||(l[1]=T("div",{class:"server-auth-head"},[T("h1",{id:"server-auth-title",class:"server-auth-title"},"Server token required"),T("p",{class:"server-auth-hint"},[qe(" This server is protected. Enter the bearer token printed when the server started (or the password set via "),T("code",null,"BLUN_PASSWORD"),qe("). ")])],-1)),T("div",Hfe,[oe(sc,{ref_key:"inputRef",ref:n,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"password",autocomplete:"current-password",placeholder:"Token",disabled:s.value,onKeydown:i},null,8,["modelValue","disabled"])]),T("div",Wfe,[oe(Dt,{variant:"primary",disabled:!t.value||s.value,loading:s.value,onClick:o},{default:_e(()=>[qe(R(s.value?"Connecting…":"Connect"),1)]),_:1},8,["disabled","loading"])])])]))}}),Ufe=ut(zfe,[["__scopeId","data-v-652d5946"]]),qfe={class:"app-shell"},jfe={key:1,class:"auth-page"},Vfe={class:"auth-page-inner"},Kfe={class:"auth-page-copy"},Gfe={key:0,class:"sidebar-rail"},Yfe=["aria-label","aria-hidden"],Xfe=je({__name:"App",setup(e){const t=vG(),n=Z(!t);let s=null;const o=Sfe(),i=F(()=>!o.dangerousBypassAuth.value&&n.value);En("resolveImage",o.resolveImageUrl);const{t:r}=It(),l=vi(),a=Dfe(),c=Z(!1),u=Z(!1),d=F(()=>{const ft=o.activeSessionId.value;return o.sessions.value.find(me=>me.id===ft)?.title??""}),p=F(()=>o.visibleWorkspace.value?.sessionCount??0),h=F(()=>o.activity.value!=="idle"),f=Z(null),{showAuthGate:m,blinkAuthLogo:b}=Cfe({client:o,authLogoRef:f});xfe({running:h,showAuthGate:m});function _(ft){const me=o.status.value.modelId??o.status.value.model??"",Ne=o.models.value.find(xe=>xe.id===me||xe.model===me||xe.displayName===o.status.value.model),xn=by(Ne),ws=fc(Ne,ft),se=xn.indexOf(ws),Ce=xn[(se+1)%xn.length]??xn[0]??"off";return _y(Ne,Ce)}const g=Z(!o.onboarded.value);function v(){o.setOnboarded(!0),g.value=!1}function y(){g.value=!0}hn(()=>{o.load(),Fe(),document.addEventListener("keydown",A,!0),s=kG(()=>{n.value=!0,o.clearDangerousBypassAuth()})}),kn(()=>{document.removeEventListener("keydown",A,!0),s!==null&&(s(),s=null)});function A(ft){ft.key==="Escape"&&(Nn.value||st()&&(ft.stopPropagation(),ft.preventDefault()))}const O=Z(null),$=Z(!1);Ke(o.activeSessionId,()=>{$.value=!0,ht(()=>{$.value=!1})});const{previewTarget:k,previewFile:E,previewLoading:M,previewError:L,previewDownloadUrl:S,previewExternalActions:I,openFilePreview:P,openMediaPreview:D,closeFilePreview:W,openPreviewInEditor:z,revealPreviewFile:q}=Ofe({client:o,detailTarget:O}),Q=F(()=>O.value!==null),{SIDEBAR_WIDTH_KEY:X,SIDEBAR_DEFAULT:fe,SIDEBAR_MIN:ye,sidebarMax:Me,sessionColWidth:we,sidebarCollapsed:ze,sideWidth:Ue,loadSidebarCollapsed:Fe,toggleSidebarCollapse:rt}=Lfe({previewOpen:Q}),{PREVIEW_WIDTH_KEY:le,PREVIEW_MIN:U,previewDefaultWidth:G,previewMax:ne,previewWidth:H,previewPanelWidth:J,thinkingPanelText:ce,thinkingVisible:te,openThinkingPanel:ue,closeThinkingPanel:j,compactionPanelText:Y,compactionPanelVisible:re,openCompactionPanel:ge,closeCompactionPanel:Ae,agentPanelMember:Ie,openAgentPanel:ae,closeAgentPanel:Te,toolDiffTarget:Ve,openToolDiff:tt,closeToolDiff:bt,detailDiffMode:kt,detailDiffPath:Tt,openDiffDetail:Pt,closeDiffDetail:mt,selectDiffFile:Yt,btwVisible:Rn,openSideChatTab:Dn,closeSideChat:Ft,sidePanelVisible:bn,panelDragging:Vn,closeOpenSidePanel:st}=Efe({client:o,sideWidth:Ue,detailTarget:O,closeFilePreview:W}),In=Z(null),_n=Z(!1),Kn=Z(!1),$n=Z(!1),Ge=Z(!1),Ye=Z(!1),Ct=Z(!1),$t=Z(null),mn=Z(null),Nn=F(()=>Ea.value>0||_n.value||Kn.value||$n.value||Ge.value||Ye.value||Ct.value||g.value||c.value||u.value),tn=Z(!1),Ln=Z(!1),Zn=Z(!1),Mt=Z(!1),us=Z(!1);async function Xt(){tn.value=!0,Ln.value=!1,_n.value=!0;try{await o.refreshOAuthProviderModels(),await o.loadModels()}catch{Ln.value=!0}finally{tn.value=!1}}async function oi(){Zn.value=!0,Mt.value=!1,Kn.value=!0;try{await o.loadProviders()}catch{Mt.value=!0}finally{Zn.value=!1}}function bs(){$n.value=!0}async function Do(ft){_n.value=!1,await o.setModel(ft)}async function so(ft){await o.addProvider(ft)}async function qs(ft){await o.deleteProvider(ft)}async function oo(ft){await o.refreshProvider(ft)}async function Nt(ft){us.value=!0;try{await o.updateConfig(ft)&&await o.checkAuth()}finally{us.value=!1}}async function Xe(){return o.startOAuthLogin()}async function ot(){return o.pollOAuthLogin()}async function de(){return o.cancelOAuthLogin()}async function pe(){$n.value=!1,await o.checkAuth(),await o.load()}async function Oe(ft){await o.undo(1),await ht(),In.value?.loadComposerForEdit(ft)}function Qt(ft){if(ft==="/compact"||ft.startsWith("/compact ")){o.compact(ft.slice(8).trim()||void 0);return}if(ft==="/swarm"||ft.startsWith("/swarm ")){const me=ft.slice(6).trim();me==="on"?o.setSwarmMode(!0):me==="off"?o.setSwarmMode(!1):me?(o.setSwarmMode(!0),o.sendPrompt(me)):o.toggleSwarmMode();return}if(ft==="/goal"||ft.startsWith("/goal ")){const me=ft.slice(5).trim();me==="pause"||me==="resume"||me==="cancel"?o.controlGoal(me):me?o.createGoal(me):o.toggleGoalMode();return}if(ft==="/btw"||ft.startsWith("/btw ")){const me=ft.slice(4).trim();!me&&o.sideChatVisible.value?Ft():Dn(me||void 0);return}switch(ft){case"/new":case"/clear":ll();break;case"/fork":o.forkSession();break;case"/undo":o.undo();break;case"/permission":{const me=o.permission.value,Ne=me==="manual"?"auto":me==="auto"?"yolo":"manual";o.setPermission(Ne);break}case"/plan":o.togglePlanMode();break;case"/auto":o.setPermission("auto");break;case"/yolo":o.setPermission("yolo");break;case"/thinking":o.setThinking(_(o.thinking.value));break;case"/help":o.dismissWarning(-1);break;case"/status":Ye.value=!0;break;case"/model":Xt();break;case"/provider":break;case"/login":bs();break;default:{const me=ft.indexOf(" "),Ne=(me===-1?ft:ft.slice(0,me)).slice(1),xn=me===-1?void 0:ft.slice(me+1).trim()||void 0;Ne&&o.activateSkill(Ne,xn);break}}}function Wt(ft){o.unqueue(ft)}function ds(ft){o.unqueue(ft)}function Bn(ft){o.reorderQueue(ft.from,ft.to)}async function bo(ft){const me=o.activeWorkspaceId.value;if(!o.activeSessionId.value&&me){await o.startSessionAndSendPrompt(me,ft.text,ft.attachments);return}if(!o.activeSessionId.value&&!me){$t.value=ft,Ge.value=!0;return}o.sendPrompt(ft.text,ft.attachments)}async function ii(ft){if(mn.value=null,!await o.addWorkspaceByPath(ft)){mn.value=r("workspace.addFailed");return}Ge.value=!1;const Ne=$t.value;$t.value=null;const xn=o.activeWorkspaceId.value;Ne&&xn&&await o.startSessionAndSendPrompt(xn,Ne.text,Ne.attachments)}function _s(){$t.value=null,mn.value=null,Ge.value=!1}function ta(){ht(()=>{In.value?.focusComposer()})}function ll(){const ft=o.activeWorkspaceId.value;ft?o.openWorkspaceDraft(ft):o.clearActiveSession(),ta()}function al(ft){o.openWorkspaceDraft(ft),ta()}function Os(ft){ft&&window.open(ft,"_blank","noopener")}return(ft,me)=>(w(),N("div",qfe,[i.value?(w(),ve(Ufe,{key:0})):ie("",!0),x(m)?(w(),N("section",jfe,[T("div",Vfe,[(w(),N("svg",{ref_key:"authLogoRef",ref:f,class:"auth-page-logo ch-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"BLUN King",onMousedown:me[0]||(me[0]=vt(()=>{},["prevent"])),onClick:me[1]||(me[1]=(...Ne)=>x(b)&&x(b)(...Ne))},[...me[94]||(me[94]=[c0('<defs data-v-b9b1ff39><mask id="authBlunEyes" maskUnits="userSpaceOnUse" data-v-b9b1ff39><rect x="0" y="0" width="32" height="22" fill="#fff" data-v-b9b1ff39></rect><g class="ch-eyes" fill="#000" data-v-b9b1ff39><rect class="ch-eye" x="11.8" y="7" width="2.8" height="8" rx="1.4" data-v-b9b1ff39></rect><rect class="ch-eye" x="17.4" y="7" width="2.8" height="8" rx="1.4" data-v-b9b1ff39></rect></g></mask></defs><rect x="1" y="1" width="30" height="20" rx="6" fill="var(--logo)" mask="url(#authBlunEyes)" data-v-b9b1ff39></rect>',2)])],544)),T("div",Kfe,[T("h1",null,R(x(r)("app.authPageTitle")),1),T("p",null,R(x(r)("app.authPageMessage")),1)]),oe(Dt,{class:"auth-page-btn",variant:"primary",onClick:bs},{default:_e(()=>[oe(Je,{name:"log-in",size:"md"}),T("span",null,R(x(r)("app.authPageLogin")),1)]),_:1})])])):(w(),N("div",{key:2,class:Re(["app",{mobile:x(a),"sidebar-collapsed":x(ze)&&!x(a)}]),style:Gt({"--side-w":x(Ue)+"px","--preview-w":x(J)+"px"})},[x(a)?(w(),ve(Rre,{key:1,workspace:x(o).visibleWorkspace.value,"session-title":d.value,running:h.value,branch:x(o).status.value.branch,"session-count":p.value,onOpenSwitcher:me[17]||(me[17]=Ne=>c.value=!0),onOpenSettings:me[18]||(me[18]=Ne=>u.value=!0)},null,8,["workspace","session-title","running","branch","session-count"])):(w(),N(Le,{key:0},[Mn(oe(wL,{"col-width":x(Ue),"active-workspace":x(o).visibleWorkspace.value,"active-workspace-id":x(o).activeWorkspaceId.value,sessions:x(o).sessionsForView.value,groups:x(o).workspaceGroups.value,"active-id":x(o).activeSessionId.value,"attention-by-session":x(o).attentionBySession.value,"pending-by-session":x(o).pendingBySession.value,"unread-by-session":x(o).unreadBySession.value,"workspace-sort-mode":x(o).workspaceSortMode.value,onSelect:me[2]||(me[2]=Ne=>x(o).selectSession(Ne)),onCreate:ll,onCreateInWorkspace:me[3]||(me[3]=Ne=>al(Ne)),onSelectWorkspace:me[4]||(me[4]=Ne=>x(o).openWorkspace(Ne)),onAddWorkspace:me[5]||(me[5]=Ne=>Ge.value=!0),onRename:me[6]||(me[6]=(Ne,xn)=>x(o).renameSession(Ne,xn)),onArchive:me[7]||(me[7]=Ne=>x(o).archiveSession(Ne)),onFork:me[8]||(me[8]=Ne=>x(o).forkSession(Ne)),onRenameWorkspace:me[9]||(me[9]=(Ne,xn)=>x(o).renameWorkspace(Ne,xn)),onDeleteWorkspace:me[10]||(me[10]=Ne=>x(o).deleteWorkspace(Ne)),onReorderWorkspaces:me[11]||(me[11]=Ne=>x(o).reorderWorkspaces(Ne)),onSetWorkspaceSortMode:me[12]||(me[12]=Ne=>x(o).setWorkspaceSortMode(Ne)),onLoadMoreSessions:me[13]||(me[13]=Ne=>void x(o).loadMoreSessions(Ne)),onLoadAllSessions:me[14]||(me[14]=Ne=>void x(o).loadAllSessions()),onOpenSettings:me[15]||(me[15]=Ne=>Ct.value=!0),onCollapse:x(rt)},null,8,["col-width","active-workspace","active-workspace-id","sessions","groups","active-id","attention-by-session","pending-by-session","unread-by-session","workspace-sort-mode","onCollapse"]),[[Qo,!x(ze)]]),Mn(oe(L_,{"storage-key":x(X),"default-width":x(fe),min:x(ye),max:x(Me),"onUpdate:width":me[16]||(me[16]=Ne=>we.value=Ne)},null,8,["storage-key","default-width","min","max"]),[[Qo,!x(ze)]]),x(ze)?(w(),N("div",Gfe,[oe(gn,{size:"sm",label:x(r)("sidebar.expandSidebar"),onClick:x(rt)},{default:_e(()=>[oe(Je,{name:"panel-expand",size:"sm"})]),_:1},8,["label","onClick"])])):ie("",!0)],64)),oe(gee,{ref_key:"conversationPaneRef",ref:In,mobile:x(a),turns:x(o).turns.value,"session-id":x(o).activeSessionId.value,approvals:x(o).pendingApprovals.value,changes:x(o).changes.value,"git-info":x(o).gitInfo.value,tasks:x(o).tasks.value,todos:x(o).todos.value,goal:x(o).goal.value,swarms:x(o).swarms.value,"activation-badges":x(o).activationBadges.value,status:x(o).status.value,thinking:x(o).thinking.value,"plan-mode":x(o).planMode.value,"swarm-mode":x(o).swarmMode.value,"goal-mode":x(o).goalMode.value,models:x(o).models.value,"starred-ids":x(o).starredModelIds.value,skills:x(o).skills.value,questions:x(o).questions.value,"pending-question-actions":x(o).pendingQuestionActions,"pending-approval-actions":x(o).pendingApprovalActions,running:h.value,queued:x(o).queued.value,"search-files":x(o).searchFiles,"upload-image":x(o).uploadImage,sending:x(o).isSending.value,"fast-moon":x(o).fastMoon.value,"file-reload-key":x(o).activeSessionId.value,"session-loading":x(o).sessionLoading.value,compaction:x(o).compaction.value,"has-more-messages":x(o).hasMoreMessages.value,"loading-more":x(o).loadingMoreMessages.value,"loading-more-error":x(o).loadMoreMessagesError.value,"load-older-messages":x(o).loadOlderMessages,"workspace-name":x(o).visibleWorkspace.value?.name,"workspace-root":x(o).visibleWorkspace.value?.root??x(o).status.value.cwd,"git-diff-stats":x(o).gitDiffStats.value,workspaces:x(o).workspacesView.value,"active-workspace-id":x(o).activeWorkspaceId.value,"session-title":d.value,pr:x(o).activePullRequest.value,"conversation-toc":x(o).conversationToc.value,onOpenChanges:me[19]||(me[19]=Ne=>x(Pt)()),onSelectWorkspace:me[20]||(me[20]=Ne=>al(Ne)),onAddWorkspace:me[21]||(me[21]=Ne=>Ge.value=!0),onOpenPr:Os,onSubmit:me[22]||(me[22]=Ne=>bo(Ne)),onSteer:me[23]||(me[23]=Ne=>x(o).steerPrompt(Ne.text,Ne.attachments)),onApproval:me[24]||(me[24]=(Ne,xn)=>x(o).respondApproval(Ne,xn)),onCancelTask:me[25]||(me[25]=Ne=>x(o).cancelTask(Ne)),onAnswer:me[26]||(me[26]=(Ne,xn)=>x(o).respondQuestion(Ne,xn)),onDismiss:me[27]||(me[27]=Ne=>x(o).dismissQuestion(Ne)),onCommand:Qt,onInterrupt:me[28]||(me[28]=Ne=>x(o).abortCurrentPrompt()),onUnqueue:Wt,onEditQueued:ds,onReorderQueue:Bn,onSetPermission:me[29]||(me[29]=Ne=>x(o).setPermission(Ne)),onSetThinking:me[30]||(me[30]=Ne=>x(o).setThinking(Ne)),onTogglePlan:me[31]||(me[31]=Ne=>x(o).togglePlanMode()),onToggleSwarm:me[32]||(me[32]=Ne=>x(o).toggleSwarmMode()),onToggleGoal:me[33]||(me[33]=Ne=>x(o).toggleGoalMode()),onCreateGoal:me[34]||(me[34]=Ne=>x(o).createGoal(Ne)),onControlGoal:me[35]||(me[35]=Ne=>x(o).controlGoal(Ne)),onRefreshGitStatus:me[36]||(me[36]=Ne=>x(o).activeSessionId.value&&x(o).loadGitStatus(x(o).activeSessionId.value)),onRenameSession:me[37]||(me[37]=(Ne,xn)=>x(o).renameSession(Ne,xn)),onForkSession:me[38]||(me[38]=Ne=>x(o).forkSession(Ne)),onArchiveSession:me[39]||(me[39]=Ne=>x(o).archiveSession(Ne)),onCompact:me[40]||(me[40]=Ne=>x(o).compact()),onPickModel:me[41]||(me[41]=Ne=>Xt()),onSelectModel:me[42]||(me[42]=Ne=>x(o).setModel(Ne)),onOpenFile:me[43]||(me[43]=Ne=>x(P)(Ne)),onOpenMedia:me[44]||(me[44]=Ne=>x(D)(Ne)),onOpenThinking:me[45]||(me[45]=Ne=>x(ue)(Ne)),onOpenCompaction:me[46]||(me[46]=Ne=>x(ge)(Ne)),onOpenAgent:me[47]||(me[47]=Ne=>x(ae)(Ne)),onOpenToolDiff:me[48]||(me[48]=Ne=>x(tt)(Ne)),onEditMessage:Oe},null,8,["mobile","turns","session-id","approvals","changes","git-info","tasks","todos","goal","swarms","activation-badges","status","thinking","plan-mode","swarm-mode","goal-mode","models","starred-ids","skills","questions","pending-question-actions","pending-approval-actions","running","queued","search-files","upload-image","sending","fast-moon","file-reload-key","session-loading","compaction","has-more-messages","loading-more","loading-more-error","load-older-messages","workspace-name","workspace-root","git-diff-stats","workspaces","active-workspace-id","session-title","pr","conversation-toc"]),x(bn)&&!x(a)?(w(),ve(L_,{key:2,"storage-key":x(le),"default-width":x(G),min:x(U),max:x(ne),reverse:"","aria-label":x(r)("layout.resizePreviewAria"),"onUpdate:width":me[49]||(me[49]=Ne=>H.value=Ne),"onUpdate:dragging":me[50]||(me[50]=Ne=>Vn.value=Ne)},null,8,["storage-key","default-width","min","max","aria-label"])):ie("",!0),!x(a)||x(bn)?(w(),N("aside",{key:3,class:Re(["global-preview",{open:x(bn),mobile:x(a),"no-anim":x(Vn)||$.value}]),role:"complementary","aria-label":x(r)("layout.detailPanelAria"),"aria-hidden":!x(bn)},[O.value==="thinking"&&x(te)?(w(),ve(XS,{key:0,text:x(ce)??"",onClose:x(j)},null,8,["text","onClose"])):O.value==="compaction"&&x(re)?(w(),ve(XS,{key:1,text:x(Y)??"",subtitle:x(r)("conversation.summaryTitle"),onClose:x(Ae)},null,8,["text","subtitle","onClose"])):O.value==="agent"&&x(Ie)?(w(),ve(Dte,{key:2,member:x(Ie),onClose:x(Te)},null,8,["member","onClose"])):O.value==="btw"&&x(Rn)?(w(),ve(one,{key:3,turns:x(o).sideChatTurns.value,running:x(o).sideChatRunning.value,sending:x(o).sideChatSending.value,onSend:me[51]||(me[51]=Ne=>x(o).sendSideChatPrompt(Ne)),onClose:x(Ft)},null,8,["turns","running","sending","onClose"])):O.value==="diff"?(w(),ve(Nne,{key:4,mode:x(kt),changes:x(o).changes.value,"git-info":x(o).gitInfo.value,"file-diff":x(o).fileDiff.value,"selected-diff-path":x(o).selectedDiffPath.value,"file-diff-loading":x(o).fileDiffLoading.value,closable:"",onOpen:x(Yt),onBack:me[52]||(me[52]=Ne=>{kt.value="list",Tt.value=null,x(o).clearFileDiff()}),onClose:x(mt)},null,8,["mode","changes","git-info","file-diff","selected-diff-path","file-diff-loading","onOpen","onClose"])):O.value==="toolDiff"&&x(Ve)?(w(),ve(Xte,{key:5,target:x(Ve),onClose:x(bt)},null,8,["target","onClose"])):O.value==="file"?(w(),ve(yte,{key:6,file:x(E),loading:x(M),error:x(L),line:x(k)?.line,"download-url":x(S),closable:"","external-actions":x(I),"open-file":x(P),onClose:x(W),onOpenExternal:x(z),onReveal:x(q)},null,8,["file","loading","error","line","download-url","external-actions","open-file","onClose","onOpenExternal","onReveal"])):ie("",!0)],10,Yfe)):ie("",!0),_n.value?(w(),ve(Qne,{key:4,models:x(o).models.value,current:x(o).status.value.modelId,"starred-ids":x(o).starredModelIds.value,loading:tn.value,unavailable:Ln.value,onSelect:me[53]||(me[53]=Ne=>Do(Ne)),onToggleStar:me[54]||(me[54]=Ne=>x(o).toggleStarModel(Ne)),onClose:me[55]||(me[55]=Ne=>_n.value=!1)},null,8,["models","current","starred-ids","loading","unavailable"])):ie("",!0),Ct.value?(w(),ve(Aie,{key:5,"color-scheme":x(o).colorScheme.value,accent:x(o).accent.value,"ui-font-size":x(o).uiFontSize.value,"auth-ready":x(o).authReady.value,"account-model":x(o).defaultModel.value,notify:x(o).notifyOnComplete.value,"notify-question":x(o).notifyOnQuestion.value,"notify-permission":x(o).notifyPermission.value,sound:x(o).soundOnComplete.value,"conversation-toc":x(o).conversationToc.value,config:x(o).config.value,models:x(o).models.value,"config-saving":us.value,"server-version":x(o).serverVersion.value,onSetColorScheme:me[56]||(me[56]=Ne=>x(o).setColorScheme(Ne)),onSetAccent:me[57]||(me[57]=Ne=>x(o).setAccent(Ne)),onSetUiFontSize:me[58]||(me[58]=Ne=>x(o).setUiFontSize(Ne)),onSetNotify:me[59]||(me[59]=Ne=>x(o).setNotifyOnComplete(Ne)),onSetNotifyQuestion:me[60]||(me[60]=Ne=>x(o).setNotifyOnQuestion(Ne)),onSetSound:me[61]||(me[61]=Ne=>x(o).setSoundOnComplete(Ne)),onSetConversationToc:me[62]||(me[62]=Ne=>x(o).setConversationToc(Ne)),onUpdateConfig:me[63]||(me[63]=Ne=>Nt(Ne)),onLogin:me[64]||(me[64]=()=>{Ct.value=!1,bs()}),onLogout:x(o).logout,onOpenOnboarding:me[65]||(me[65]=()=>{Ct.value=!1,y()}),onOpenProviders:me[66]||(me[66]=()=>{Ct.value=!1,oi()}),onClose:me[67]||(me[67]=Ne=>Ct.value=!1)},null,8,["color-scheme","accent","ui-font-size","auth-ready","account-model","notify","notify-question","notify-permission","sound","conversation-toc","config","models","config-saving","server-version","onLogout"])):ie("",!0),Kn.value?(w(),ve(kse,{key:6,providers:x(o).providers.value,loading:Zn.value,unavailable:Mt.value,onAdd:me[68]||(me[68]=Ne=>so(Ne)),onRefresh:me[69]||(me[69]=Ne=>oo(Ne)),onDelete:me[70]||(me[70]=Ne=>qs(Ne)),onOpenLogin:me[71]||(me[71]=()=>{Kn.value=!1,bs()}),onClose:me[72]||(me[72]=Ne=>Kn.value=!1)},null,8,["providers","loading","unavailable"])):ie("",!0),Ye.value?(w(),ve(mre,{key:7,status:x(o).status.value,thinking:x(o).thinking.value,"plan-mode":x(o).planMode.value,"swarm-mode":x(o).swarmMode.value,"cost-usd":x(o).sessionCost.value,onClose:me[73]||(me[73]=Ne=>Ye.value=!1)},null,8,["status","thinking","plan-mode","swarm-mode","cost-usd"])):ie("",!0),Ge.value?(w(),ve(Jie,{key:8,"browse-fs":x(o).browseFs,"get-fs-home":x(o).getFsHome,"default-path":x(o).visibleWorkspace.value?.root??x(o).status.value.cwd,error:mn.value,onAdd:me[74]||(me[74]=Ne=>ii(Ne)),onClose:_s},null,8,["browse-fs","get-fs-home","default-path","error"])):ie("",!0),oe(Gr,{name:"gload-fade"},{default:_e(()=>[x(o).initialized.value?ie("",!0):(w(),ve(Pae,{key:0}))]),_:1}),g.value&&!x(m)?(w(),ve(Iae,{key:9,onComplete:v,onSkip:v})):ie("",!0),oe(Tre,{warnings:x(o).warnings.value,onDismiss:x(o).dismissWarning},null,8,["warnings","onDismiss"]),x(l)?(w(),ve(dce,{key:10})):ie("",!0),oe(sre),x(a)?(w(),ve(ile,{key:11,modelValue:c.value,"onUpdate:modelValue":me[75]||(me[75]=Ne=>c.value=Ne),groups:x(o).workspaceGroups.value,"active-workspace-id":x(o).activeWorkspaceId.value,"active-id":x(o).activeSessionId.value,"attention-by-session":x(o).attentionBySession.value,"attention-by-workspace":x(o).attentionByWorkspace.value,onSelect:me[76]||(me[76]=Ne=>x(o).selectSession(Ne)),onCreate:ll,onCreateInWorkspace:me[77]||(me[77]=Ne=>al(Ne)),onAddWorkspace:me[78]||(me[78]=Ne=>Ge.value=!0),onRename:me[79]||(me[79]=(Ne,xn)=>x(o).renameSession(Ne,xn)),onArchive:me[80]||(me[80]=Ne=>x(o).archiveSession(Ne)),onDeleteWorkspace:me[81]||(me[81]=Ne=>x(o).deleteWorkspace(Ne)),onLoadMore:me[82]||(me[82]=Ne=>void x(o).loadMoreSessions(Ne))},null,8,["modelValue","groups","active-workspace-id","active-id","attention-by-session","attention-by-workspace"])):ie("",!0),x(a)?(w(),ve(eae,{key:12,modelValue:u.value,"onUpdate:modelValue":me[83]||(me[83]=Ne=>u.value=Ne),status:x(o).status.value,thinking:x(o).thinking.value,models:x(o).models.value,"plan-mode":x(o).planMode.value,"swarm-mode":x(o).swarmMode.value,"color-scheme":x(o).colorScheme.value,"ui-font-size":x(o).uiFontSize.value,"auth-ready":x(o).authReady.value,"conversation-toc":x(o).conversationToc.value,"server-version":x(o).serverVersion.value,onPickModel:me[84]||(me[84]=Ne=>Xt()),onSetThinking:me[85]||(me[85]=Ne=>x(o).setThinking(Ne)),onTogglePlan:me[86]||(me[86]=Ne=>x(o).togglePlanMode()),onToggleSwarm:me[87]||(me[87]=Ne=>x(o).toggleSwarmMode()),onSetPermission:me[88]||(me[88]=Ne=>x(o).setPermission(Ne)),onSetColorScheme:me[89]||(me[89]=Ne=>x(o).setColorScheme(Ne)),onSetUiFontSize:me[90]||(me[90]=Ne=>x(o).setUiFontSize(Ne)),onSetConversationToc:me[91]||(me[91]=Ne=>x(o).setConversationToc(Ne)),onLogin:me[92]||(me[92]=()=>{u.value=!1,bs()}),onLogout:x(o).logout},null,8,["modelValue","status","thinking","models","plan-mode","swarm-mode","color-scheme","ui-font-size","auth-ready","conversation-toc","server-version","onLogout"])):ie("",!0)],6)),$n.value?(w(),ve(Yse,{key:3,"on-start-o-auth-login":Xe,"on-poll-o-auth-login":ot,"on-cancel-o-auth-login":de,onSuccess:pe,onClose:me[93]||(me[93]=Ne=>$n.value=!1)})):ie("",!0)]))}}),Qfe=ut(Xfe,[["__scopeId","data-v-b9b1ff39"]]);dG();ap(Qfe).use(Un).mount("#app");export{$E as $,s0 as A,_I as B,os as C,Xpe as D,kC as E,Le as F,c0 as G,qe as H,oe as I,eI as J,_pe as K,ui as L,je as M,K$ as N,xpe as O,Ape as P,Epe as Q,qf as R,Ga as S,lh as T,Tpe as U,d0 as V,Cpe as W,Zpe as X,Mpe as Y,jpe as Z,Jfe as _,GC as a,Hs as a$,Ls as a0,V1 as a1,lpe as a2,Z1 as a3,v$ as a4,cn as a5,gc as a6,ppe as a7,the as a8,vpe as a9,JC as aA,NI as aB,BI as aC,hn as aD,DI as aE,RI as aF,K1 as aG,PI as aH,kn as aI,e0 as aJ,iI as aK,w as aL,q$ as aM,dpe as aN,En as aO,DC as aP,upe as aQ,Yf as aR,$s as aS,Vf as aT,Z as aU,Fpe as aV,c6 as aW,nt as aX,Cn as aY,HI as aZ,wpe as a_,bpe as aa,kpe as ab,ype as ac,Wpe as ad,nhe as ae,Ut as af,S$ as ag,ih as ah,Wr as ai,or as aj,es as ak,Hpe as al,Mo as am,Kr as an,Dr as ao,Npe as ap,Lpe as aq,dn as ar,ht as as,M$ as at,Re as au,Zfe as av,Gt as aw,$I as ax,OI as ay,ls as az,cpe as b,Iq as b$,Gpe as b0,Mu as b1,tp as b2,Vpe as b3,Vr as b4,XE as b5,tpe as b6,Ql as b7,fI as b8,Kpe as b9,ko as bA,Qo as bB,C$ as bC,Upe as bD,Ke as bE,hI as bF,hpe as bG,mI as bH,Ppe as bI,_e as bJ,Ipe as bK,Mn as bL,di as bM,zpe as bN,vt as bO,fpe as bP,un as bQ,Xs as bR,fhe as bS,kj as bT,zM as bU,hhe as bV,GU as bW,oy as bX,phe as bY,u1 as bZ,bhe as b_,epe as ba,R as bb,_f as bc,Spe as bd,Kt as be,ope as bf,spe as bg,RC as bh,Bpe as bi,npe as bj,x as bk,nd as bl,ehe as bm,Qpe as bn,Y$ as bo,mpe as bp,Rpe as bq,pI as br,Jpe as bs,$pe as bt,gpe as bu,KC as bv,lp as bw,o6 as bx,Fx as by,Rv as bz,qpe as c,Eq as c0,ty as c1,Mq as c2,che as c3,WU as c4,ahe as c5,Np as c6,ihe as c7,Tq as c8,RM as c9,khe as ca,rhe as cb,whe as cc,g1 as cd,Ha as ce,h1 as cf,She as cg,_he as ch,dhe as ci,xo as cj,lhe as ck,uhe as cl,XU as cm,yhe as cn,m1 as co,p1 as cp,vhe as cq,ohe as cr,ghe as cs,mhe as ct,ut as cu,she as cv,_A as cw,X5 as cx,Dpe as d,zr as e,ipe as f,Gr as g,Z$ as h,rpe as i,ape as j,ti as k,Ju as l,gs as m,Qp as n,ir as o,Ype as p,F as q,ap as r,ve as s,ie as t,N as u,T as v,a$ as w,Ope as x,l$ as y,u6 as z};
|