scream-code 0.16.1 → 0.16.3
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/README.md +1 -1
- package/dist/{app-lSa6fM8z.mjs → app-C1foLjDE.mjs} +582 -532
- package/dist/{dispatch-B6jbxY0D.mjs → dispatch-BGLqpKHG.mjs} +1 -1
- package/dist/{dispatch-DqeJdQZQ.mjs → dispatch-ChDxIz0h.mjs} +1721 -593
- package/dist/main.mjs +1 -1
- package/dist/public/assets/astro-DAp21e1Q.js +2 -0
- package/dist/public/assets/astro-DAp21e1Q.js.map +1 -0
- package/dist/public/assets/bash-Yzrsuije.js +2 -0
- package/dist/public/assets/bash-Yzrsuije.js.map +1 -0
- package/dist/public/assets/c-BIGW1oBm.js +2 -0
- package/dist/public/assets/c-BIGW1oBm.js.map +1 -0
- package/dist/public/assets/cpp-BRuaLJcg.js +2 -0
- package/dist/public/assets/cpp-BRuaLJcg.js.map +1 -0
- package/dist/public/assets/csharp-COcwbKMJ.js +2 -0
- package/dist/public/assets/csharp-COcwbKMJ.js.map +1 -0
- package/dist/public/assets/css-DEUVOdPa.js +2 -0
- package/dist/public/assets/css-DEUVOdPa.js.map +1 -0
- package/dist/public/assets/dart-CF10PKvl.js +2 -0
- package/dist/public/assets/dart-CF10PKvl.js.map +1 -0
- package/dist/public/assets/docker-BcOcwvcX.js +2 -0
- package/dist/public/assets/docker-BcOcwvcX.js.map +1 -0
- package/dist/public/assets/go-CxLEBnE3.js +2 -0
- package/dist/public/assets/go-CxLEBnE3.js.map +1 -0
- package/dist/public/assets/graphql-ChdNCCLP.js +2 -0
- package/dist/public/assets/graphql-ChdNCCLP.js.map +1 -0
- package/dist/public/assets/html-CNxCFRDw.js +2 -0
- package/dist/public/assets/html-CNxCFRDw.js.map +1 -0
- package/dist/public/assets/index-DQBhBKK1.css +1 -0
- package/dist/public/assets/index-DakPeNBt.js +240 -0
- package/dist/public/assets/index-DakPeNBt.js.map +1 -0
- package/dist/public/assets/ini-BEwlwnbL.js +2 -0
- package/dist/public/assets/ini-BEwlwnbL.js.map +1 -0
- package/dist/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/public/assets/java-CylS5w8V.js +2 -0
- package/dist/public/assets/java-CylS5w8V.js.map +1 -0
- package/dist/public/assets/javascript-wDzz0qaB.js +2 -0
- package/dist/public/assets/javascript-wDzz0qaB.js.map +1 -0
- package/dist/public/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/public/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/public/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/public/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/public/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/public/assets/json-Cp-IABpG.js +2 -0
- package/dist/public/assets/json-Cp-IABpG.js.map +1 -0
- package/dist/public/assets/jsx-g9-lgVsj.js +2 -0
- package/dist/public/assets/jsx-g9-lgVsj.js.map +1 -0
- package/dist/public/assets/kotlin-BdnUsdx6.js +2 -0
- package/dist/public/assets/kotlin-BdnUsdx6.js.map +1 -0
- package/dist/public/assets/lua-BaeVxFsk.js +2 -0
- package/dist/public/assets/lua-BaeVxFsk.js.map +1 -0
- package/dist/public/assets/make-CHLpvVh8.js +2 -0
- package/dist/public/assets/make-CHLpvVh8.js.map +1 -0
- package/dist/public/assets/markdown-Cvjx9yec.js +2 -0
- package/dist/public/assets/markdown-Cvjx9yec.js.map +1 -0
- package/dist/public/assets/perl-CptaX86O.js +2 -0
- package/dist/public/assets/perl-CptaX86O.js.map +1 -0
- package/dist/public/assets/postcss-DnzrXTVv.js +2 -0
- package/dist/public/assets/postcss-DnzrXTVv.js.map +1 -0
- package/dist/public/assets/protobuf-C7zT0LnQ.js +2 -0
- package/dist/public/assets/protobuf-C7zT0LnQ.js.map +1 -0
- package/dist/public/assets/python-B6aJPvgy.js +2 -0
- package/dist/public/assets/python-B6aJPvgy.js.map +1 -0
- package/dist/public/assets/r-Dspwwk_N.js +2 -0
- package/dist/public/assets/r-Dspwwk_N.js.map +1 -0
- package/dist/public/assets/ruby-CcrC3V9I.js +2 -0
- package/dist/public/assets/ruby-CcrC3V9I.js.map +1 -0
- package/dist/public/assets/rust-B1yitclQ.js +2 -0
- package/dist/public/assets/rust-B1yitclQ.js.map +1 -0
- package/dist/public/assets/scala-C151Ov-r.js +2 -0
- package/dist/public/assets/scala-C151Ov-r.js.map +1 -0
- package/dist/public/assets/sql-BLtJtn59.js +2 -0
- package/dist/public/assets/sql-BLtJtn59.js.map +1 -0
- package/dist/public/assets/svelte-U4fHntn6.js +2 -0
- package/dist/public/assets/svelte-U4fHntn6.js.map +1 -0
- package/dist/public/assets/swift-D82vCrfD.js +2 -0
- package/dist/public/assets/swift-D82vCrfD.js.map +1 -0
- package/dist/public/assets/toml-vGWfd6FD.js +2 -0
- package/dist/public/assets/toml-vGWfd6FD.js.map +1 -0
- package/dist/public/assets/tsx-COt5Ahok.js +2 -0
- package/dist/public/assets/tsx-COt5Ahok.js.map +1 -0
- package/dist/public/assets/typescript-BPQ3VLAy.js +2 -0
- package/dist/public/assets/typescript-BPQ3VLAy.js.map +1 -0
- package/dist/public/assets/xml-sdJ4AIDG.js +2 -0
- package/dist/public/assets/xml-sdJ4AIDG.js.map +1 -0
- package/dist/public/assets/yaml-Buea-lGh.js +2 -0
- package/dist/public/assets/yaml-Buea-lGh.js.map +1 -0
- package/dist/public/index.html +2 -2
- package/dist/{text-input-dialog-rSkH3JTV.mjs → text-input-dialog-DAQfJdHu.mjs} +1 -1
- package/dist/{text-input-dialog-BABWY9vy.mjs → text-input-dialog-GajpxjyL.mjs} +66 -20
- package/package.json +5 -4
- package/dist/public/assets/index-DwX1jGaf.js +0 -96
- package/dist/public/assets/index-DwX1jGaf.js.map +0 -1
- package/dist/public/assets/index-zIKfLBMX.css +0 -1
- package/dist/public/assets/wasm-CG6Dc4jp.js +0 -2
- package/dist/public/assets/wasm-CG6Dc4jp.js.map +0 -1
- package/icon.ico +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ruby-CcrC3V9I.js","./html-CNxCFRDw.js","./javascript-wDzz0qaB.js","./css-DEUVOdPa.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-BLtJtn59.js","./graphql-ChdNCCLP.js","./typescript-BPQ3VLAy.js","./jsx-g9-lgVsj.js","./tsx-COt5Ahok.js","./cpp-BRuaLJcg.js","./c-BIGW1oBm.js","./bash-Yzrsuije.js","./lua-BaeVxFsk.js","./yaml-Buea-lGh.js","./svelte-U4fHntn6.js","./postcss-DnzrXTVv.js","./astro-DAp21e1Q.js","./json-Cp-IABpG.js","./perl-CptaX86O.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Kp=Object.defineProperty;var Zp=Object.getPrototypeOf;var Yp=Reflect.get;var hu=e=>{throw TypeError(e)};var Xp=(e,t,n)=>t in e?Kp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var V=(e,t,n)=>Xp(e,typeof t!="symbol"?t+"":t,n),Ni=(e,t,n)=>t.has(e)||hu("Cannot "+n);var Et=(e,t,n)=>(Ni(e,t,"read from private field"),n?n.call(e):t.get(e)),Xn=(e,t,n)=>t.has(e)?hu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Yt=(e,t,n,s)=>(Ni(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Gi=(e,t,n)=>(Ni(e,t,"access private method"),n);var pu=(e,t,n)=>Yp(Zp(e),n,t);(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 r of o)if(r.type==="childList")for(const i of r.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}})();/**
|
|
3
|
+
* @vue/shared v3.5.40
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function dl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const tt={},Bs=[],en=()=>{},Id=()=>!1,ui=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ci=e=>e.startsWith("onUpdate:"),dt=Object.assign,fl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Jp=Object.prototype.hasOwnProperty,Ze=(e,t)=>Jp.call(e,t),Ae=Array.isArray,Fs=e=>Uo(e)==="[object Map]",di=e=>Uo(e)==="[object Set]",gu=e=>Uo(e)==="[object Date]",Ge=e=>typeof e=="function",ot=e=>typeof e=="string",sn=e=>typeof e=="symbol",Xe=e=>e!==null&&typeof e=="object",Ed=e=>(Xe(e)||Ge(e))&&Ge(e.then)&&Ge(e.catch),Ad=Object.prototype.toString,Uo=e=>Ad.call(e),Qp=e=>Uo(e).slice(8,-1),Md=e=>Uo(e)==="[object Object]",hl=e=>ot(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,yo=dl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),fi=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},eg=/-\w/g,Dt=fi(e=>e.replace(eg,t=>t.slice(1).toUpperCase())),tg=/\B([A-Z])/g,Kn=fi(e=>e.replace(tg,"-$1").toLowerCase()),hi=fi(e=>e.charAt(0).toUpperCase()+e.slice(1)),pr=fi(e=>e?`on${hi(e)}`:""),Xt=(e,t)=>!Object.is(e,t),gr=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Rd=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},pi=e=>{const t=parseFloat(e);return isNaN(t)?e:t},ng=e=>{const t=ot(e)?Number(e):NaN;return isNaN(t)?e:t};let mu;const gi=()=>mu||(mu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function yt(e){if(Ae(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],o=ot(s)?ig(s):yt(s);if(o)for(const r in o)t[r]=o[r]}return t}else if(ot(e)||Xe(e))return e}const sg=/;(?![^(]*\))/g,og=/:([^]+)/,rg=/\/\*[^]*?\*\//g;function ig(e){const t={};return e.replace(rg,"").split(sg).forEach(n=>{if(n){const s=n.split(og);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function fe(e){let t="";if(ot(e))t=e;else if(Ae(e))for(let n=0;n<e.length;n++){const s=fe(e[n]);s&&(t+=s+" ")}else if(Xe(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const ag="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",lg=dl(ag);function Pd(e){return!!e||e===""}function ug(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=zo(e[s],t[s]);return n}function zo(e,t){if(e===t)return!0;let n=gu(e),s=gu(t);if(n||s)return n&&s?e.getTime()===t.getTime():!1;if(n=sn(e),s=sn(t),n||s)return e===t;if(n=Ae(e),s=Ae(t),n||s)return n&&s?ug(e,t):!1;if(n=Xe(e),s=Xe(t),n||s){if(!n||!s)return!1;const o=Object.keys(e).length,r=Object.keys(t).length;if(o!==r)return!1;for(const i in e){const a=e.hasOwnProperty(i),l=t.hasOwnProperty(i);if(a&&!l||!a&&l||!zo(e[i],t[i]))return!1}}return String(e)===String(t)}function cg(e,t){return e.findIndex(n=>zo(n,t))}const Ld=e=>!!(e&&e.__v_isRef===!0),C=e=>ot(e)?e:e==null?"":Ae(e)||Xe(e)&&(e.toString===Ad||!Ge(e.toString))?Ld(e)?C(e.value):JSON.stringify(e,Dd,2):String(e),Dd=(e,t)=>Ld(t)?Dd(e,t.value):Fs(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,o],r)=>(n[Bi(s,r)+" =>"]=o,n),{})}:di(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Bi(n))}:sn(t)?Bi(t):Xe(t)&&!Ae(t)&&!Md(t)?String(t):t,Bi=(e,t="")=>{var n;return sn(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};function dg(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:String(e)}/**
|
|
7
|
+
* @vue/reactivity v3.5.40
|
|
8
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
+
* @license MIT
|
|
10
|
+
**/let kt;class fg{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&kt&&(kt.active?(this.parent=kt,this.index=(kt.scopes||(kt.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const s=this.scopes.slice();for(t=0,n=s.length;t<n;t++)s[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const s=this.effects.slice();for(t=0,n=s.length;t<n;t++)s[t].resume()}}run(t){if(this._active){const n=kt;try{return kt=this,t()}finally{kt=n}}}on(){++this._on===1&&(this.prevScope=kt,kt=this)}off(){if(this._on>0&&--this._on===0){if(kt===this)kt=this.prevScope;else{let t=kt;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,s;for(n=0,s=this.effects.length;n<s;n++)this.effects[n].stop();for(this.effects.length=0,n=0,s=this.cleanups.length;n<s;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(n=0,s=o.length;n<s;n++)o[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function hg(){return kt}let nt;const Fi=new WeakSet;class Od{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,kt&&(kt.active?kt.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Fi.has(this)&&(Fi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Gd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,vu(this),Bd(this);const t=nt,n=tn;nt=this,tn=!0;try{return this.fn()}finally{Fd(this),nt=t,tn=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)ml(t);this.deps=this.depsTail=void 0,vu(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Fi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Sa(this)&&this.run()}get dirty(){return Sa(this)}}let Nd=0,bo,ko;function Gd(e,t=!1){if(e.flags|=8,t){e.next=ko,ko=e;return}e.next=bo,bo=e}function pl(){Nd++}function gl(){if(--Nd>0)return;if(ko){let t=ko;for(ko=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;bo;){let t=bo;for(bo=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function Bd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Fd(e){let t,n=e.depsTail,s=n;for(;s;){const o=s.prevDep;s.version===-1?(s===n&&(n=o),ml(s),pg(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=o}e.deps=t,e.depsTail=n}function Sa(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(jd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function jd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Io)||(e.globalVersion=Io,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Sa(e))))return;e.flags|=2;const t=e.dep,n=nt,s=tn;nt=e,tn=!0;try{Bd(e);const o=e.fn(e._value);(t.version===0||Xt(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{nt=n,tn=s,Fd(e),e.flags&=-3}}function ml(e,t=!1){const{dep:n,prevSub:s,nextSub:o}=e;if(s&&(s.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let r=n.computed.deps;r;r=r.nextDep)ml(r,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function pg(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let tn=!0;const Ud=[];function An(){Ud.push(tn),tn=!1}function Mn(){const e=Ud.pop();tn=e===void 0?!0:e}function vu(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=nt;nt=void 0;try{t()}finally{nt=n}}}let Io=0;class gg{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class vl{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!nt||!tn||nt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==nt)n=this.activeLink=new gg(nt,this),nt.deps?(n.prevDep=nt.depsTail,nt.depsTail.nextDep=n,nt.depsTail=n):nt.deps=nt.depsTail=n,zd(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=nt.depsTail,n.nextDep=void 0,nt.depsTail.nextDep=n,nt.depsTail=n,nt.deps===n&&(nt.deps=s)}return n}trigger(t){this.version++,Io++,this.notify(t)}notify(t){pl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{gl()}}}function zd(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)zd(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const _a=new WeakMap,hs=Symbol(""),$a=Symbol(""),Eo=Symbol("");function $t(e,t,n){if(tn&&nt){let s=_a.get(e);s||_a.set(e,s=new Map);let o=s.get(n);o||(s.set(n,o=new vl),o.map=s,o.key=n),o.track()}}function wn(e,t,n,s,o,r){const i=_a.get(e);if(!i){Io++;return}const a=l=>{l&&l.trigger()};if(pl(),t==="clear")i.forEach(a);else{const l=Ae(e),u=l&&hl(n);if(l&&n==="length"){const c=Number(s);i.forEach((d,f)=>{(f==="length"||f===Eo||!sn(f)&&f>=c)&&a(d)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),u&&a(i.get(Eo)),t){case"add":l?u&&a(i.get("length")):(a(i.get(hs)),Fs(e)&&a(i.get($a)));break;case"delete":l||(a(i.get(hs)),Fs(e)&&a(i.get($a)));break;case"set":Fs(e)&&a(i.get(hs));break}}gl()}function Is(e){const t=We(e);return t===e?t:($t(t,"iterate",Eo),Vt(e)?t:t.map(on))}function mi(e){return $t(e=We(e),"iterate",Eo),e}function fn(e,t){return Rn(e)?Ks(ps(e)?on(t):t):on(t)}const mg={__proto__:null,[Symbol.iterator](){return ji(this,Symbol.iterator,e=>fn(this,e))},concat(...e){return Is(this).concat(...e.map(t=>Ae(t)?Is(t):t))},entries(){return ji(this,"entries",e=>(e[1]=fn(this,e[1]),e))},every(e,t){return pn(this,"every",e,t,void 0,arguments)},filter(e,t){return pn(this,"filter",e,t,n=>n.map(s=>fn(this,s)),arguments)},find(e,t){return pn(this,"find",e,t,n=>fn(this,n),arguments)},findIndex(e,t){return pn(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return pn(this,"findLast",e,t,n=>fn(this,n),arguments)},findLastIndex(e,t){return pn(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return pn(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ui(this,"includes",e)},indexOf(...e){return Ui(this,"indexOf",e)},join(e){return Is(this).join(e)},lastIndexOf(...e){return Ui(this,"lastIndexOf",e)},map(e,t){return pn(this,"map",e,t,void 0,arguments)},pop(){return oo(this,"pop")},push(...e){return oo(this,"push",e)},reduce(e,...t){return yu(this,"reduce",e,t)},reduceRight(e,...t){return yu(this,"reduceRight",e,t)},shift(){return oo(this,"shift")},some(e,t){return pn(this,"some",e,t,void 0,arguments)},splice(...e){return oo(this,"splice",e)},toReversed(){return Is(this).toReversed()},toSorted(e){return Is(this).toSorted(e)},toSpliced(...e){return Is(this).toSpliced(...e)},unshift(...e){return oo(this,"unshift",e)},values(){return ji(this,"values",e=>fn(this,e))}};function ji(e,t,n){const s=mi(e),o=s[t]();return s!==e&&!Vt(e)&&(o._next=o.next,o.next=()=>{const r=o._next();return r.done||(r.value=n(r.value)),r}),o}const vg=Array.prototype;function pn(e,t,n,s,o,r){const i=mi(e),a=i!==e&&!Vt(e),l=i[t];if(l!==vg[t]){const d=l.apply(e,r);return a?on(d):d}let u=n;i!==e&&(a?u=function(d,f){return n.call(this,fn(e,d),f,e)}:n.length>2&&(u=function(d,f){return n.call(this,d,f,e)}));const c=l.call(i,u,s);return a&&o?o(c):c}function yu(e,t,n,s){const o=mi(e),r=o!==e&&!Vt(e);let i=n,a=!1;o!==e&&(r?(a=s.length===0,i=function(u,c,d){return a&&(a=!1,u=fn(e,u)),n.call(this,u,fn(e,c),d,e)}):n.length>3&&(i=function(u,c,d){return n.call(this,u,c,d,e)}));const l=o[t](i,...s);return a?fn(e,l):l}function Ui(e,t,n){const s=We(e);$t(s,"iterate",Eo);const o=s[t](...n);return(o===-1||o===!1)&&kl(n[0])?(n[0]=We(n[0]),s[t](...n)):o}function oo(e,t,n=[]){An(),pl();const s=We(e)[t].apply(e,n);return gl(),Mn(),s}const yg=dl("__proto__,__v_isRef,__isVue"),Hd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(sn));function bg(e){sn(e)||(e=String(e));const t=We(this);return $t(t,"has",e),t.hasOwnProperty(e)}class Wd{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,r=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return r;if(n==="__v_raw")return s===(o?r?Eg:Zd:r?Kd:Vd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const i=Ae(t);if(!o){let l;if(i&&(l=mg[n]))return l;if(n==="hasOwnProperty")return bg}const a=Reflect.get(t,n,ht(t)?t:s);if((sn(n)?Hd.has(n):yg(n))||(o||$t(t,"get",n),r))return a;if(ht(a)){const l=i&&hl(n)?a:a.value;return o&&Xe(l)?xa(l):l}return Xe(a)?o?xa(a):Wn(a):a}}class qd extends Wd{constructor(t=!1){super(!1,t)}set(t,n,s,o){let r=t[n];const i=Ae(t)&&hl(n);if(!this._isShallow){const u=Rn(r);if(!Vt(s)&&!Rn(s)&&(r=We(r),s=We(s)),!i&&ht(r)&&!ht(s))return u||(r.value=s),!0}const a=i?Number(n)<t.length:Ze(t,n),l=Reflect.set(t,n,s,ht(t)?t:o);return t===We(o)&&l&&(a?Xt(s,r)&&wn(t,"set",n,s):wn(t,"add",n,s)),l}deleteProperty(t,n){const s=Ze(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&s&&wn(t,"delete",n,void 0),o}has(t,n){const s=Reflect.has(t,n);return(!sn(n)||!Hd.has(n))&&$t(t,"has",n),s}ownKeys(t){return $t(t,"iterate",Ae(t)?"length":hs),Reflect.ownKeys(t)}}class kg extends Wd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const wg=new qd,Sg=new kg,_g=new qd(!0);const Ca=e=>e,tr=e=>Reflect.getPrototypeOf(e);function $g(e,t,n){return function(...s){const o=this.__v_raw,r=We(o),i=Fs(r),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,u=o[e](...s),c=n?Ca:t?Ks:on;return!t&&$t(r,"iterate",l?$a:hs),dt(Object.create(u),{next(){const{value:d,done:f}=u.next();return f?{value:d,done:f}:{value:a?[c(d[0]),c(d[1])]:c(d),done:f}}})}}function nr(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Cg(e,t){const n={get(o){const r=this.__v_raw,i=We(r),a=We(o);e||(Xt(o,a)&&$t(i,"get",o),$t(i,"get",a));const{has:l}=tr(i),u=t?Ca:e?Ks:on;if(l.call(i,o))return u(r.get(o));if(l.call(i,a))return u(r.get(a));r!==i&&r.get(o)},get size(){const o=this.__v_raw;return!e&&$t(We(o),"iterate",hs),o.size},has(o){const r=this.__v_raw,i=We(r),a=We(o);return e||(Xt(o,a)&&$t(i,"has",o),$t(i,"has",a)),o===a?r.has(o):r.has(o)||r.has(a)},forEach(o,r){const i=this,a=i.__v_raw,l=We(a),u=t?Ca:e?Ks:on;return!e&&$t(l,"iterate",hs),a.forEach((c,d)=>o.call(r,u(c),u(d),i))}};return dt(n,e?{add:nr("add"),set:nr("set"),delete:nr("delete"),clear:nr("clear")}:{add(o){const r=We(this),i=tr(r),a=We(o),l=!t&&!Vt(o)&&!Rn(o)?a:o;return i.has.call(r,l)||Xt(o,l)&&i.has.call(r,o)||Xt(a,l)&&i.has.call(r,a)||(r.add(l),wn(r,"add",l,l)),this},set(o,r){!t&&!Vt(r)&&!Rn(r)&&(r=We(r));const i=We(this),{has:a,get:l}=tr(i);let u=a.call(i,o);u||(o=We(o),u=a.call(i,o));const c=l.call(i,o);return i.set(o,r),u?Xt(r,c)&&wn(i,"set",o,r):wn(i,"add",o,r),this},delete(o){const r=We(this),{has:i,get:a}=tr(r);let l=i.call(r,o);l||(o=We(o),l=i.call(r,o)),a&&a.call(r,o);const u=r.delete(o);return l&&wn(r,"delete",o,void 0),u},clear(){const o=We(this),r=o.size!==0,i=o.clear();return r&&wn(o,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=$g(o,e,t)}),n}function yl(e,t){const n=Cg(e,t);return(s,o,r)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?s:Reflect.get(Ze(n,o)&&o in s?n:s,o,r)}const xg={get:yl(!1,!1)},Tg={get:yl(!1,!0)},Ig={get:yl(!0,!1)};const Vd=new WeakMap,Kd=new WeakMap,Zd=new WeakMap,Eg=new WeakMap;function Ag(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Wn(e){return Rn(e)?e:bl(e,!1,wg,xg,Vd)}function Mg(e){return bl(e,!1,_g,Tg,Kd)}function xa(e){return bl(e,!0,Sg,Ig,Zd)}function bl(e,t,n,s,o){if(!Xe(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const r=o.get(e);if(r)return r;const i=Ag(Qp(e));if(i===0)return e;const a=new Proxy(e,i===2?s:n);return o.set(e,a),a}function ps(e){return Rn(e)?ps(e.__v_raw):!!(e&&e.__v_isReactive)}function Rn(e){return!!(e&&e.__v_isReadonly)}function Vt(e){return!!(e&&e.__v_isShallow)}function kl(e){return e?!!e.__v_raw:!1}function We(e){const t=e&&e.__v_raw;return t?We(t):e}function Rg(e){return!Ze(e,"__v_skip")&&Object.isExtensible(e)&&Rd(e,"__v_skip",!0),e}const on=e=>Xe(e)?Wn(e):e,Ks=e=>Xe(e)?xa(e):e;function ht(e){return e?e.__v_isRef===!0:!1}function M(e){return Yd(e,!1)}function Pg(e){return Yd(e,!0)}function Yd(e,t){return ht(e)?e:new Lg(e,t)}class Lg{constructor(t,n){this.dep=new vl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:We(t),this._value=n?t:on(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||Vt(t)||Rn(t);t=s?t:We(t),Xt(t,n)&&(this._rawValue=t,this._value=s?t:on(t),this.dep.trigger())}}function D(e){return ht(e)?e.value:e}const Dg={get:(e,t,n)=>t==="__v_raw"?e:D(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const o=e[t];return ht(o)&&!ht(n)?(o.value=n,!0):Reflect.set(e,t,n,s)}};function Xd(e){return ps(e)?e:new Proxy(e,Dg)}class Og{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new vl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Io-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&nt!==this)return Gd(this,!0),!0}get value(){const t=this.dep.track();return jd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Ng(e,t,n=!1){let s,o;return Ge(e)?s=e:(s=e.get,o=e.set),new Og(s,o,n)}const sr={},Ir=new WeakMap;let ss;function Gg(e,t=!1,n=ss){if(n){let s=Ir.get(n);s||Ir.set(n,s=[]),s.push(e)}}function Bg(e,t,n=tt){const{immediate:s,deep:o,once:r,scheduler:i,augmentJob:a,call:l}=n,u=I=>o?I:Vt(I)||o===!1||o===0?Sn(I,1):Sn(I);let c,d,f,p,m=!1,y=!1;if(ht(e)?(d=()=>e.value,m=Vt(e)):ps(e)?(d=()=>u(e),m=!0):Ae(e)?(y=!0,m=e.some(I=>ps(I)||Vt(I)),d=()=>e.map(I=>{if(ht(I))return I.value;if(ps(I))return u(I);if(Ge(I))return l?l(I,2):I()})):Ge(e)?t?d=l?()=>l(e,2):e:d=()=>{if(f){An();try{f()}finally{Mn()}}const I=ss;ss=c;try{return l?l(e,3,[p]):e(p)}finally{ss=I}}:d=en,t&&o){const I=d,q=o===!0?1/0:o;d=()=>Sn(I(),q)}const b=hg(),k=()=>{c.stop(),b&&b.active&&fl(b.effects,c)};if(r&&t){const I=t;t=(...q)=>{const B=I(...q);return k(),B}}let w=y?new Array(e.length).fill(sr):sr;const S=I=>{if(!(!(c.flags&1)||!c.dirty&&!I))if(t){const q=c.run();if(I||o||m||(y?q.some((B,R)=>Xt(B,w[R])):Xt(q,w))){f&&f();const B=ss;ss=c;try{const R=[q,w===sr?void 0:y&&w[0]===sr?[]:w,p];w=q,l?l(t,3,R):t(...R)}finally{ss=B}}}else c.run()};return a&&a(S),c=new Od(d),c.scheduler=i?()=>i(S,!1):S,p=I=>Gg(I,!1,c),f=c.onStop=()=>{const I=Ir.get(c);if(I){if(l)l(I,4);else for(const q of I)q();Ir.delete(c)}},t?s?S(!0):w=c.run():i?i(S.bind(null,!0),!0):c.run(),k.pause=c.pause.bind(c),k.resume=c.resume.bind(c),k.stop=k,k}function Sn(e,t=1/0,n){if(t<=0||!Xe(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,ht(e))Sn(e.value,t,n);else if(Ae(e))for(let s=0;s<e.length;s++)Sn(e[s],t,n);else if(di(e)||Fs(e))e.forEach(s=>{Sn(s,t,n)});else if(Md(e)){for(const s in e)Sn(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&Sn(e[s],t,n)}return e}/**
|
|
11
|
+
* @vue/runtime-core v3.5.40
|
|
12
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
+
* @license MIT
|
|
14
|
+
**/function Ho(e,t,n,s){try{return s?e(...s):e()}catch(o){vi(o,t,n)}}function Kt(e,t,n,s){if(Ge(e)){const o=Ho(e,t,n,s);return o&&Ed(o)&&o.catch(r=>{vi(r,t,n)}),o}if(Ae(e)){const o=[];for(let r=0;r<e.length;r++)o.push(Kt(e[r],t,n,s));return o}}function vi(e,t,n,s=!0){const o=t?t.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||tt;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let d=0;d<c.length;d++)if(c[d](e,l,u)===!1)return}a=a.parent}if(r){An(),Ho(r,null,10,[e,l,u]),Mn();return}}Fg(e,n,o,s,i)}function Fg(e,t,n,s=!0,o=!1){if(o)throw e;console.error(e)}const Rt=[];let dn=-1;const js=[];let Bn=null,Rs=0;const Jd=Promise.resolve();let Er=null;function Ve(e){const t=Er||Jd;return e?t.then(this?e.bind(this):e):t}function jg(e){let t=dn+1,n=Rt.length;for(;t<n;){const s=t+n>>>1,o=Rt[s],r=Ao(o);r<e||r===e&&o.flags&2?t=s+1:n=s}return t}function wl(e){if(!(e.flags&1)){const t=Ao(e),n=Rt[Rt.length-1];!n||!(e.flags&2)&&t>=Ao(n)?Rt.push(e):Rt.splice(jg(t),0,e),e.flags|=1,Qd()}}function Qd(){Er||(Er=Jd.then(nf))}function ef(e){Ae(e)?js.push(...e):Bn&&e.id===-1?Bn.splice(Rs+1,0,e):e.flags&1||(js.push(e),e.flags|=1),Qd()}function bu(e,t,n=dn+1){for(;n<Rt.length;n++){const s=Rt[n];if(s&&s.flags&2){if(e&&s.id!==e.uid)continue;Rt.splice(n,1),n--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function tf(e){if(js.length){const t=[...new Set(js)].sort((n,s)=>Ao(n)-Ao(s));if(js.length=0,Bn){Bn.push(...t);return}for(Bn=t,Rs=0;Rs<Bn.length;Rs++){const n=Bn[Rs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Bn=null,Rs=0}}const Ao=e=>e.id==null?e.flags&2?-1:1/0:e.id;function nf(e){try{for(dn=0;dn<Rt.length;dn++){const t=Rt[dn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Ho(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;dn<Rt.length;dn++){const t=Rt[dn];t&&(t.flags&=-2)}dn=-1,Rt.length=0,tf(),Er=null,(Rt.length||js.length)&&nf()}}let St=null,sf=null;function Ar(e){const t=St;return St=e,sf=e&&e.type.__scopeId||null,t}function it(e,t=St,n){if(!t||e._n)return e;const s=(...o)=>{s._d&&Pr(-1);const r=Ar(t),i=En.length;let a;try{a=e(...o)}finally{for(let l=En.length;l>i;l--)Tl();Ar(r),s._d&&Pr(1)}return a};return s._n=!0,s._c=!0,s._d=!0,s}function et(e,t){if(St===null)return e;const n=$i(St),s=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[r,i,a,l=tt]=t[o];r&&(Ge(r)&&(r={mounted:r,updated:r}),r.deep&&Sn(i),s.push({dir:r,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function Jn(e,t,n,s){const o=e.dirs,r=t&&t.dirs;for(let i=0;i<o.length;i++){const a=o[i];r&&(a.oldValue=r[i].value);let l=a.dir[s];l&&(An(),Kt(l,n,8,[e.el,a,e,t]),Mn())}}function mr(e,t){if(xt){let n=xt.provides;const s=xt.parent&&xt.parent.provides;s===n&&(n=xt.provides=Object.create(s)),n[e]=t}}function In(e,t,n=!1){const s=_i();if(s||zs){let o=zs?zs._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&Ge(t)?t.call(s&&s.proxy):t}}const Ug=Symbol.for("v-scx"),zg=()=>In(Ug);function xe(e,t,n){return of(e,t,n)}function of(e,t,n=tt){const{immediate:s,deep:o,flush:r,once:i}=n,a=dt({},n),l=t&&s||!t&&r!=="post";let u;if(Ro){if(r==="sync"){const p=zg();u=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=en,p.resume=en,p.pause=en,p}}const c=xt;a.call=(p,m,y)=>Kt(p,c,m,y);let d=!1;r==="post"?a.scheduler=p=>{Mt(p,c&&c.suspense)}:r!=="sync"&&(d=!0,a.scheduler=(p,m)=>{m?p():wl(p)}),a.augmentJob=p=>{t&&(p.flags|=4),d&&(p.flags|=2,c&&(p.id=c.uid,p.i=c))};const f=Bg(e,t,a);return Ro&&(u?u.push(f):l&&f()),f}function Hg(e,t,n){const s=this.proxy,o=ot(e)?e.includes(".")?rf(s,e):()=>s[e]:e.bind(s,s);let r;Ge(t)?r=t:(r=t.handler,n=t);const i=Wo(this),a=of(o,r.bind(s),n);return i(),a}function rf(e,t){const n=t.split(".");return()=>{let s=e;for(let o=0;o<n.length&&s;o++)s=s[n[o]];return s}}const Dn=new WeakMap,af=Symbol("_vte"),lf=e=>e.__isTeleport,rs=e=>e&&(e.disabled||e.disabled===""),Wg=e=>e&&(e.defer||e.defer===""),ku=e=>typeof SVGElement<"u"&&e instanceof SVGElement,wu=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ta=(e,t)=>{const n=e&&e.to;return ot(n)?t?t(n):null:n},qg={name:"Teleport",__isTeleport:!0,process(e,t,n,s,o,r,i,a,l,u){const{mc:c,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:y,createComment:b,parentNode:k}}=u,w=rs(t.props);let{dynamicChildren:S}=t;const I=(R,L,A)=>{R.shapeFlag&16&&c(R.children,L,A,o,r,i,a,l)},q=(R=t)=>{const L=rs(R.props),A=R.target=Ta(R.props,m),W=Ia(A,R,y,p);A&&(i!=="svg"&&ku(A)?i="svg":i!=="mathml"&&wu(A)&&(i="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(A),L||(I(R,A,W),po(R,!1)))},B=R=>{const L=()=>{if(Dn.get(R)===L){if(Dn.delete(R),rs(R.props)){const A=k(R.el)||n;I(R,A,R.anchor),po(R,!0)}q(R)}};Dn.set(R,L),Mt(L,r)};if(e==null){const R=t.el=y(""),L=t.anchor=y("");if(p(R,n,s),p(L,n,s),Wg(t.props)||r&&r.pendingBranch){B(t);return}w&&(I(t,n,L),po(t,!0)),q()}else{t.el=e.el;const R=t.anchor=e.anchor,L=Dn.get(e);if(L){L.flags|=8,Dn.delete(e),B(t);return}t.targetStart=e.targetStart;const A=t.target=e.target,W=t.targetAnchor=e.targetAnchor,F=rs(e.props),O=F?n:A,ee=F?R:W;if(i==="svg"||ku(A)?i="svg":(i==="mathml"||wu(A))&&(i="mathml"),S?(f(e.dynamicChildren,S,O,o,r,i,a),xl(e,t,!0)):l||d(e,t,O,ee,o,r,i,a,!1),w)F?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):or(t,n,R,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const x=Ta(t.props,m);x&&(t.target=x,or(t,x,null,u,0))}else F&&or(t,A,W,u,1);po(t,w)}},remove(e,t,n,{um:s,o:{remove:o}},r){const{shapeFlag:i,children:a,anchor:l,targetStart:u,targetAnchor:c,target:d,props:f}=e,p=rs(f),m=r||!p,y=Dn.get(e);if(y&&(y.flags|=8,Dn.delete(e)),d&&(o(u),o(c)),r&&o(l),!y&&(p||d)&&i&16)for(let b=0;b<a.length;b++){const k=a[b];s(k,t,n,m,!!k.dynamicChildren)}},move:or,hydrate:Vg};function or(e,t,n,{o:{insert:s},m:o},r=2){r===0&&s(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:l,children:u,props:c}=e,d=r===2;if(d&&s(i,t,n),!Dn.has(e)&&(!d||rs(c))&&l&16)for(let f=0;f<u.length;f++)o(u[f],t,n,2);d&&s(a,t,n)}function Vg(e,t,n,s,o,r,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:u,createText:c}},d){function f(b,k){let w=k;for(;w;){if(w&&w.nodeType===8){if(w.data==="teleport start anchor")t.targetStart=w;else if(w.data==="teleport anchor"){t.targetAnchor=w,b._lpa=t.targetAnchor&&i(t.targetAnchor);break}}w=i(w)}}function p(b,k){k.anchor=d(i(b),k,a(b),n,s,o,r)}const m=t.target=Ta(t.props,l),y=rs(t.props);if(m){const b=m._lpa||m.firstChild;t.shapeFlag&16&&(y?(p(e,t),f(m,b),t.targetAnchor||Ia(m,t,c,u,a(e)===m?e:null)):(t.anchor=i(e),f(m,b),t.targetAnchor||Ia(m,t,c,u),d(b&&i(b),t,m,n,s,o,r))),po(t,y)}else y&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const Qs=qg;function po(e,t){const n=e.ctx;if(n&&n.ut){let s,o;for(t?(s=e.el,o=e.anchor):(s=e.targetStart,o=e.targetAnchor);s&&s!==o;)s.nodeType===1&&s.setAttribute("data-v-owner",n.uid),s=s.nextSibling;n.ut()}}function Ia(e,t,n,s,o=null){const r=t.targetStart=n(""),i=t.targetAnchor=n("");return r[af]=i,e&&(s(r,e,o),s(i,e,o)),i}const Ut=Symbol("_leaveCb"),ro=Symbol("_enterCb");function uf(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return rt(()=>{e.isMounted=!0}),at(()=>{e.isUnmounting=!0}),e}const Ft=[Function,Array],cf={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ft,onEnter:Ft,onAfterEnter:Ft,onEnterCancelled:Ft,onBeforeLeave:Ft,onLeave:Ft,onAfterLeave:Ft,onLeaveCancelled:Ft,onBeforeAppear:Ft,onAppear:Ft,onAfterAppear:Ft,onAppearCancelled:Ft},df=e=>{const t=e.subTree;return t.component?df(t.component):t},Kg={name:"BaseTransition",props:cf,setup(e,{slots:t}){const n=_i(),s=uf();return()=>{const o=t.default&&Sl(t.default(),!0),r=o&&o.length?ff(o):n.subTree?N():void 0;if(!r)return;const i=We(e),{mode:a}=i;if(s.isLeaving)return zi(r);const l=Su(r);if(!l)return zi(r);let u=Mo(l,i,s,n,d=>u=d);l.type!==Ct&&ms(l,u);let c=n.subTree&&Su(n.subTree);if(c&&c.type!==Ct&&!is(c,l)&&df(n).type!==Ct){let d=Mo(c,i,s,n);if(ms(c,d),a==="out-in"&&l.type!==Ct)return s.isLeaving=!0,d.afterLeave=()=>{s.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,c=void 0},zi(r);a==="in-out"&&l.type!==Ct?d.delayLeave=(f,p,m)=>{const y=hf(s,c);y[String(c.key)]=c,f[Ut]=()=>{p(),f[Ut]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{m(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return r}}};function ff(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ct){t=n;break}}return t}const Zg=Kg;function hf(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function Mo(e,t,n,s,o){const{appear:r,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:c,onEnterCancelled:d,onBeforeLeave:f,onLeave:p,onAfterLeave:m,onLeaveCancelled:y,onBeforeAppear:b,onAppear:k,onAfterAppear:w,onAppearCancelled:S}=t,I=String(e.key),q=hf(n,e),B=(A,W)=>{A&&Kt(A,s,9,W)},R=(A,W)=>{const F=W[1];B(A,W),Ae(A)?A.every(O=>O.length<=1)&&F():A.length<=1&&F()},L={mode:i,persisted:a,beforeEnter(A){let W=l;if(!n.isMounted)if(r)W=b||l;else return;A[Ut]&&A[Ut](!0);const F=q[I];F&&is(e,F)&&F.el[Ut]&&F.el[Ut](),B(W,[A])},enter(A){if(q[I]===e)return;let W=u,F=c,O=d;if(!n.isMounted)if(r)W=k||u,F=w||c,O=S||d;else return;let ee=!1;A[ro]=E=>{ee||(ee=!0,E?B(O,[A]):B(F,[A]),L.delayedLeave&&L.delayedLeave(),A[ro]=void 0)};const x=A[ro].bind(null,!1);W?R(W,[A,x]):x()},leave(A,W){const F=String(e.key);if(A[ro]&&A[ro](!0),n.isUnmounting)return W();B(f,[A]);let O=!1;A[Ut]=x=>{O||(O=!0,W(),x?B(y,[A]):B(m,[A]),A[Ut]=void 0,q[F]===e&&delete q[F])};const ee=A[Ut].bind(null,!1);q[F]=e,p?R(p,[A,ee]):ee()},clone(A){const W=Mo(A,t,n,s,o);return o&&o(W),W}};return L}function zi(e){if(yi(e))return e=qn(e),e.children=null,e}function Su(e){if(!yi(e))return lf(e.type)&&e.children?ff(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Ge(n.default))return n.default()}}function ms(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ms(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Sl(e,t=!1,n){let s=[],o=0;for(let r=0;r<e.length;r++){let i=e[r];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:r);i.type===X?(i.patchFlag&128&&o++,s=s.concat(Sl(i.children,t,a))):(t||i.type!==Ct)&&s.push(a!=null?qn(i,{key:a}):i)}if(o>1)for(let r=0;r<s.length;r++)s[r].patchFlag=-2;return s}function Le(e,t){return Ge(e)?dt({name:e.name},t,{setup:e}):e}function pf(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function _u(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Mr=new WeakMap;function wo(e,t,n,s,o=!1){if(Ae(e)){e.forEach((y,b)=>wo(y,t&&(Ae(t)?t[b]:t),n,s,o));return}if(Us(s)&&!o){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&wo(e,t,n,s.component.subTree);return}const r=s.shapeFlag&4?$i(s.component):s.el,i=o?null:r,{i:a,r:l}=e,u=t&&t.r,c=a.refs===tt?a.refs={}:a.refs,d=a.setupState,f=We(d),p=d===tt?Id:y=>_u(c,y)?!1:Ze(f,y),m=(y,b)=>!(b&&_u(c,b));if(u!=null&&u!==l){if($u(t),ot(u))c[u]=null,p(u)&&(d[u]=null);else if(ht(u)){const y=t;m(u,y.k)&&(u.value=null),y.k&&(c[y.k]=null)}}if(Ge(l))Ho(l,a,12,[i,c]);else{const y=ot(l),b=ht(l);if(y||b){const k=()=>{if(e.f){const w=y?p(l)?d[l]:c[l]:m()||!e.k?l.value:c[e.k];if(o)Ae(w)&&fl(w,r);else if(Ae(w))w.includes(r)||w.push(r);else if(y)c[l]=[r],p(l)&&(d[l]=c[l]);else{const S=[r];m(l,e.k)&&(l.value=S),e.k&&(c[e.k]=S)}}else y?(c[l]=i,p(l)&&(d[l]=i)):b&&(m(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const w=()=>{k(),Mr.delete(e)};w.id=-1,Mr.set(e,w),Mt(w,n)}else $u(e),k()}}}function $u(e){const t=Mr.get(e);t&&(t.flags|=8,Mr.delete(e))}gi().requestIdleCallback;gi().cancelIdleCallback;const Us=e=>!!e.type.__asyncLoader,yi=e=>e.type.__isKeepAlive;function Yg(e,t){gf(e,"a",t)}function Xg(e,t){gf(e,"da",t)}function gf(e,t,n=xt){const s=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(bi(t,s,n),n){let o=n.parent;for(;o&&o.parent;)yi(o.parent.vnode)&&Jg(s,t,n,o),o=o.parent}}function Jg(e,t,n,s){const o=bi(t,e,s,!0);ki(()=>{fl(s[t],o)},n)}function bi(e,t,n=xt,s=!1){if(n){const o=n[e]||(n[e]=[]),r=t.__weh||(t.__weh=(...i)=>{An();const a=Wo(n),l=Kt(t,n,e,i);return a(),Mn(),l});return s?o.unshift(r):o.push(r),r}}const Pn=e=>(t,n=xt)=>{(!Ro||e==="sp")&&bi(e,(...s)=>t(...s),n)},Qg=Pn("bm"),rt=Pn("m"),mf=Pn("bu"),_l=Pn("u"),at=Pn("bum"),ki=Pn("um"),em=Pn("sp"),tm=Pn("rtg"),nm=Pn("rtc");function sm(e,t=xt){bi("ec",e,t)}const om="components",vf=Symbol.for("v-ndc");function yf(e){return ot(e)?rm(om,e,!1)||e:e||vf}function rm(e,t,n=!0,s=!1){const o=St||xt;if(o){const r=o.type;{const a=Um(r,!1);if(a&&(a===t||a===Dt(t)||a===hi(Dt(t))))return r}const i=Cu(o[e]||r[e],t)||Cu(o.appContext[e],t);return!i&&s?r:i}}function Cu(e,t){return e&&(e[t]||e[Dt(t)]||e[hi(Dt(t))])}function Me(e,t,n,s){let o;const r=n&&n[s],i=Ae(e);if(i||ot(e)){const a=i&&ps(e);let l=!1,u=!1;a&&(l=!Vt(e),u=Rn(e),e=mi(e)),o=new Array(e.length);for(let c=0,d=e.length;c<d;c++)o[c]=t(l?u?Ks(on(e[c])):on(e[c]):e[c],c,void 0,r&&r[c])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,r&&r[a])}else if(Xe(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,r&&r[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const c=a[l];o[l]=t(e[c],c,l,r&&r[l])}}else o=[];return n&&(n[s]=o),o}function So(e,t,n={},s,o,r){if(St.ce||St.parent&&Us(St.parent)&&St.parent.ce){const u=n,c=Object.keys(u).length>0;return t!=="default"&&(u.name=t),g(),Fe(X,null,[K("slot",u,s&&s())],c?-2:64)}let i=e[t];i&&i._c&&(i._d=!1);const a=En.length;g();let l;try{const u=i&&bf(i(n)),c=n.key||r||u&&u.key;l=Fe(X,{key:(c&&!sn(c)?c:`_${t}`)+(!u&&s?"_fb":"")},u||(s?s():[]),u&&e._===1?64:-2)}catch(u){for(let c=En.length;c>a;c--)Tl();throw u}finally{i&&i._c&&(i._d=!0)}return l}function bf(e){return e.some(t=>Ys(t)?!(t.type===Ct||t.type===X&&!bf(t.children)):!0)?e:null}function im(e,t){const n={};for(const s in e)n[pr(s)]=e[s];return n}const Ea=e=>e?Bf(e)?$i(e):Ea(e.parent):null,_o=dt(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ea(e.parent),$root:e=>Ea(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>wf(e),$forceUpdate:e=>e.f||(e.f=()=>{wl(e.update)}),$nextTick:e=>e.n||(e.n=Ve.bind(e.proxy)),$watch:e=>Hg.bind(e)}),Hi=(e,t)=>e!==tt&&!e.__isScriptSetup&&Ze(e,t),am={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:o,props:r,accessCache:i,type:a,appContext:l}=e;if(t[0]!=="$"){const f=i[t];if(f!==void 0)switch(f){case 1:return s[t];case 2:return o[t];case 4:return n[t];case 3:return r[t]}else{if(Hi(s,t))return i[t]=1,s[t];if(o!==tt&&Ze(o,t))return i[t]=2,o[t];if(Ze(r,t))return i[t]=3,r[t];if(n!==tt&&Ze(n,t))return i[t]=4,n[t];Aa&&(i[t]=0)}}const u=_o[t];let c,d;if(u)return t==="$attrs"&&$t(e.attrs,"get",""),u(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==tt&&Ze(n,t))return i[t]=4,n[t];if(d=l.config.globalProperties,Ze(d,t))return d[t]},set({_:e},t,n){const{data:s,setupState:o,ctx:r}=e;return Hi(o,t)?(o[t]=n,!0):s!==tt&&Ze(s,t)?(s[t]=n,!0):Ze(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(r[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:o,props:r,type:i}},a){let l;return!!(n[a]||e!==tt&&a[0]!=="$"&&Ze(e,a)||Hi(t,a)||Ze(r,a)||Ze(s,a)||Ze(_o,a)||Ze(o.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Ze(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function xu(e){return Ae(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Aa=!0;function lm(e){const t=wf(e),n=e.proxy,s=e.ctx;Aa=!1,t.beforeCreate&&Tu(t.beforeCreate,e,"bc");const{data:o,computed:r,methods:i,watch:a,provide:l,inject:u,created:c,beforeMount:d,mounted:f,beforeUpdate:p,updated:m,activated:y,deactivated:b,beforeDestroy:k,beforeUnmount:w,destroyed:S,unmounted:I,render:q,renderTracked:B,renderTriggered:R,errorCaptured:L,serverPrefetch:A,expose:W,inheritAttrs:F,components:O,directives:ee,filters:x}=t;if(u&&um(u,s,null),i)for(const oe in i){const ke=i[oe];Ge(ke)&&(s[oe]=ke.bind(n))}if(o){const oe=o.call(n,n);Xe(oe)&&(e.data=Wn(oe))}if(Aa=!0,r)for(const oe in r){const ke=r[oe],Te=Ge(ke)?ke.bind(n,n):Ge(ke.get)?ke.get.bind(n,n):en,ge=!Ge(ke)&&Ge(ke.set)?ke.set.bind(n):en,le=P({get:Te,set:ge});Object.defineProperty(s,oe,{enumerable:!0,configurable:!0,get:()=>le.value,set:ve=>le.value=ve})}if(a)for(const oe in a)kf(a[oe],s,n,oe);if(l){const oe=Ge(l)?l.call(n):l;Reflect.ownKeys(oe).forEach(ke=>{mr(ke,oe[ke])})}c&&Tu(c,e,"c");function z(oe,ke){Ae(ke)?ke.forEach(Te=>oe(Te.bind(n))):ke&&oe(ke.bind(n))}if(z(Qg,d),z(rt,f),z(mf,p),z(_l,m),z(Yg,y),z(Xg,b),z(sm,L),z(nm,B),z(tm,R),z(at,w),z(ki,I),z(em,A),Ae(W))if(W.length){const oe=e.exposed||(e.exposed={});W.forEach(ke=>{Object.defineProperty(oe,ke,{get:()=>n[ke],set:Te=>n[ke]=Te,enumerable:!0})})}else e.exposed||(e.exposed={});q&&e.render===en&&(e.render=q),F!=null&&(e.inheritAttrs=F),O&&(e.components=O),ee&&(e.directives=ee),A&&pf(e)}function um(e,t,n=en){Ae(e)&&(e=Ma(e));for(const s in e){const o=e[s];let r;Xe(o)?"default"in o?r=In(o.from||s,o.default,!0):r=In(o.from||s):r=In(o),ht(r)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:i=>r.value=i}):t[s]=r}}function Tu(e,t,n){Kt(Ae(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function kf(e,t,n,s){let o=s.includes(".")?rf(n,s):()=>n[s];if(ot(e)){const r=t[e];Ge(r)&&xe(o,r)}else if(Ge(e))xe(o,e.bind(n));else if(Xe(e))if(Ae(e))e.forEach(r=>kf(r,t,n,s));else{const r=Ge(e.handler)?e.handler.bind(n):t[e.handler];Ge(r)&&xe(o,r,e)}}function wf(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:o,optionsCache:r,config:{optionMergeStrategies:i}}=e.appContext,a=r.get(t);let l;return a?l=a:!o.length&&!n&&!s?l=t:(l={},o.length&&o.forEach(u=>Rr(l,u,i,!0)),Rr(l,t,i)),Xe(t)&&r.set(t,l),l}function Rr(e,t,n,s=!1){const{mixins:o,extends:r}=t;r&&Rr(e,r,n,!0),o&&o.forEach(i=>Rr(e,i,n,!0));for(const i in t)if(!(s&&i==="expose")){const a=cm[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const cm={data:Iu,props:Eu,emits:Eu,methods:go,computed:go,beforeCreate:At,created:At,beforeMount:At,mounted:At,beforeUpdate:At,updated:At,beforeDestroy:At,beforeUnmount:At,destroyed:At,unmounted:At,activated:At,deactivated:At,errorCaptured:At,serverPrefetch:At,components:go,directives:go,watch:fm,provide:Iu,inject:dm};function Iu(e,t){return t?e?function(){return dt(Ge(e)?e.call(this,this):e,Ge(t)?t.call(this,this):t)}:t:e}function dm(e,t){return go(Ma(e),Ma(t))}function Ma(e){if(Ae(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function At(e,t){return e?[...new Set([].concat(e,t))]:t}function go(e,t){return e?dt(Object.create(null),e,t):t}function Eu(e,t){return e?Ae(e)&&Ae(t)?[...new Set([...e,...t])]:dt(Object.create(null),xu(e),xu(t??{})):t}function fm(e,t){if(!e)return t;if(!t)return e;const n=dt(Object.create(null),e);for(const s in t)n[s]=At(e[s],t[s]);return n}function Sf(){return{app:null,config:{isNativeTag:Id,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let hm=0;function pm(e,t){return function(s,o=null){Ge(s)||(s=dt({},s)),o!=null&&!Xe(o)&&(o=null);const r=Sf(),i=new WeakSet,a=[];let l=!1;const u=r.app={_uid:hm++,_component:s,_props:o,_container:null,_context:r,_instance:null,version:Wm,get config(){return r.config},set config(c){},use(c,...d){return i.has(c)||(c&&Ge(c.install)?(i.add(c),c.install(u,...d)):Ge(c)&&(i.add(c),c(u,...d))),u},mixin(c){return r.mixins.includes(c)||r.mixins.push(c),u},component(c,d){return d?(r.components[c]=d,u):r.components[c]},directive(c,d){return d?(r.directives[c]=d,u):r.directives[c]},mount(c,d,f){if(!l){const p=u._ceVNode||K(s,o);return p.appContext=r,f===!0?f="svg":f===!1&&(f=void 0),e(p,c,f),l=!0,u._container=c,c.__vue_app__=u,$i(p.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Kt(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(c,d){return r.provides[c]=d,u},runWithContext(c){const d=zs;zs=u;try{return c()}finally{zs=d}}};return u}}let zs=null;const gm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Dt(t)}Modifiers`]||e[`${Kn(t)}Modifiers`];function mm(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||tt;let o=n;const r=t.startsWith("update:"),i=r&&gm(s,t.slice(7));i&&(i.trim&&(o=n.map(c=>ot(c)?c.trim():c)),i.number&&(o=n.map(pi)));let a,l=s[a=pr(t)]||s[a=pr(Dt(t))];!l&&r&&(l=s[a=pr(Kn(t))]),l&&Kt(l,e,6,o);const u=s[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Kt(u,e,6,o)}}const vm=new WeakMap;function _f(e,t,n=!1){const s=n?vm:t.emitsCache,o=s.get(e);if(o!==void 0)return o;const r=e.emits;let i={},a=!1;if(!Ge(e)){const l=u=>{const c=_f(u,t,!0);c&&(a=!0,dt(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!r&&!a?(Xe(e)&&s.set(e,null),null):(Ae(r)?r.forEach(l=>i[l]=null):dt(i,r),Xe(e)&&s.set(e,i),i)}function wi(e,t){return!e||!ui(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Ze(e,t[0].toLowerCase()+t.slice(1))||Ze(e,Kn(t))||Ze(e,t))}function Au(e){const{type:t,vnode:n,proxy:s,withProxy:o,propsOptions:[r],slots:i,attrs:a,emit:l,render:u,renderCache:c,props:d,data:f,setupState:p,ctx:m,inheritAttrs:y}=e,b=Ar(e);let k,w;try{if(n.shapeFlag&4){const I=o||s,q=I;k=hn(u.call(q,I,c,d,p,f,m)),w=a}else{const I=t;k=hn(I.length>1?I(d,{attrs:a,slots:i,emit:l}):I(d,null)),w=t.props?a:ym(a)}}catch(I){En.length=0,vi(I,e,1),k=K(Ct)}let S=k;if(w&&y!==!1){const I=Object.keys(w),{shapeFlag:q}=S;I.length&&q&7&&(r&&I.some(ci)&&(w=bm(w,r)),S=qn(S,w,!1,!0))}return n.dirs&&(S=qn(S,null,!1,!0),S.dirs=S.dirs?S.dirs.concat(n.dirs):n.dirs),n.transition&&ms(S,n.transition),k=S,Ar(b),k}const ym=e=>{let t;for(const n in e)(n==="class"||n==="style"||ui(n))&&((t||(t={}))[n]=e[n]);return t},bm=(e,t)=>{const n={};for(const s in e)(!ci(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function km(e,t,n){const{props:s,children:o,component:r}=e,{props:i,children:a,patchFlag:l}=t,u=r.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return s?Mu(s,i,u):!!i;if(l&8){const c=t.dynamicProps;for(let d=0;d<c.length;d++){const f=c[d];if($f(i,s,f)&&!wi(u,f))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:s===i?!1:s?i?Mu(s,i,u):!0:!!i;return!1}function Mu(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let o=0;o<s.length;o++){const r=s[o];if($f(t,e,r)&&!wi(n,r))return!0}return!1}function $f(e,t,n){const s=e[n],o=t[n];return n==="style"&&Xe(s)&&Xe(o)?!zo(s,o):s!==o}function wm({vnode:e,parent:t,suspense:n},s){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=s,e=o),o===e)(e=t.vnode).el=s,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=s)}const Cf={},xf=()=>Object.create(Cf),Tf=e=>Object.getPrototypeOf(e)===Cf;function Sm(e,t,n,s=!1){const o={},r=xf();e.propsDefaults=Object.create(null),If(e,t,o,r);for(const i in e.propsOptions[0])i in o||(o[i]=void 0);n?e.props=s?o:Mg(o):e.type.props?e.props=o:e.props=r,e.attrs=r}function _m(e,t,n,s){const{props:o,attrs:r,vnode:{patchFlag:i}}=e,a=We(o),[l]=e.propsOptions;let u=!1;if((s||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let d=0;d<c.length;d++){let f=c[d];if(wi(e.emitsOptions,f))continue;const p=t[f];if(l)if(Ze(r,f))p!==r[f]&&(r[f]=p,u=!0);else{const m=Dt(f);o[m]=Ra(l,a,m,p,e,!1)}else p!==r[f]&&(r[f]=p,u=!0)}}}else{If(e,t,o,r)&&(u=!0);let c;for(const d in a)(!t||!Ze(t,d)&&((c=Kn(d))===d||!Ze(t,c)))&&(l?n&&(n[d]!==void 0||n[c]!==void 0)&&(o[d]=Ra(l,a,d,void 0,e,!0)):delete o[d]);if(r!==a)for(const d in r)(!t||!Ze(t,d))&&(delete r[d],u=!0)}u&&wn(e.attrs,"set","")}function If(e,t,n,s){const[o,r]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(yo(l))continue;const u=t[l];let c;o&&Ze(o,c=Dt(l))?!r||!r.includes(c)?n[c]=u:(a||(a={}))[c]=u:wi(e.emitsOptions,l)||(!(l in s)||u!==s[l])&&(s[l]=u,i=!0)}if(r){const l=We(n),u=a||tt;for(let c=0;c<r.length;c++){const d=r[c];n[d]=Ra(o,l,d,u[d],e,!Ze(u,d))}}return i}function Ra(e,t,n,s,o,r){const i=e[n];if(i!=null){const a=Ze(i,"default");if(a&&s===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&Ge(l)){const{propsDefaults:u}=o;if(n in u)s=u[n];else{const c=Wo(o);s=u[n]=l.call(null,t),c()}}else s=l;o.ce&&o.ce._setProp(n,s)}i[0]&&(r&&!a?s=!1:i[1]&&(s===""||s===Kn(n))&&(s=!0))}return s}const $m=new WeakMap;function Ef(e,t,n=!1){const s=n?$m:t.propsCache,o=s.get(e);if(o)return o;const r=e.props,i={},a=[];let l=!1;if(!Ge(e)){const c=d=>{l=!0;const[f,p]=Ef(d,t,!0);dt(i,f),p&&a.push(...p)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!r&&!l)return Xe(e)&&s.set(e,Bs),Bs;if(Ae(r))for(let c=0;c<r.length;c++){const d=Dt(r[c]);Ru(d)&&(i[d]=tt)}else if(r)for(const c in r){const d=Dt(c);if(Ru(d)){const f=r[c],p=i[d]=Ae(f)||Ge(f)?{type:f}:dt({},f),m=p.type;let y=!1,b=!0;if(Ae(m))for(let k=0;k<m.length;++k){const w=m[k],S=Ge(w)&&w.name;if(S==="Boolean"){y=!0;break}else S==="String"&&(b=!1)}else y=Ge(m)&&m.name==="Boolean";p[0]=y,p[1]=b,(y||Ze(p,"default"))&&a.push(d)}}const u=[i,a];return Xe(e)&&s.set(e,u),u}function Ru(e){return e[0]!=="$"&&!yo(e)}const $l=e=>e==="_"||e==="_ctx"||e==="$stable",Cl=e=>Ae(e)?e.map(hn):[hn(e)],Cm=(e,t,n)=>{if(t._n)return t;const s=it((...o)=>Cl(t(...o)),n);return s._c=!1,s},Af=(e,t,n)=>{const s=e._ctx;for(const o in e){if($l(o))continue;const r=e[o];if(Ge(r))t[o]=Cm(o,r,s);else if(r!=null){const i=Cl(r);t[o]=()=>i}}},Mf=(e,t)=>{const n=Cl(t);e.slots.default=()=>n},Rf=(e,t,n)=>{for(const s in t)(n||!$l(s))&&(e[s]=t[s])},xm=(e,t,n)=>{const s=e.slots=xf();if(e.vnode.shapeFlag&32){const o=t._;o?(Rf(s,t,n),n&&Rd(s,"_",o,!0)):Af(t,s)}else t&&Mf(e,t)},Tm=(e,t,n)=>{const{vnode:s,slots:o}=e;let r=!0,i=tt;if(s.shapeFlag&32){const a=t._;a?n&&a===1?r=!1:Rf(o,t,n):(r=!t.$stable,Af(t,o)),i=t}else t&&(Mf(e,t),i={default:1});if(r)for(const a in o)!$l(a)&&i[a]==null&&delete o[a]},Mt=Rm;function Im(e){return Em(e)}function Em(e,t){const n=gi();n.__VUE__=!0;const{insert:s,remove:o,patchProp:r,createElement:i,createText:a,createComment:l,setText:u,setElementText:c,parentNode:d,nextSibling:f,setScopeId:p=en,insertStaticContent:m}=e,y=(_,$,U,Y=null,te=null,ne=null,ue=void 0,ce=null,ie=!!$.dynamicChildren)=>{if(_===$)return;_&&!is(_,$)&&(Y=Ke(_),ve(_,te,ne,!0),_=null),$.patchFlag===-2&&(ie=!1,$.dynamicChildren=null);const{type:T,ref:H,shapeFlag:G}=$;switch(T){case Si:b(_,$,U,Y);break;case Ct:k(_,$,U,Y);break;case vr:_==null&&w($,U,Y,ue);break;case X:O(_,$,U,Y,te,ne,ue,ce,ie);break;default:G&1?q(_,$,U,Y,te,ne,ue,ce,ie):G&6?ee(_,$,U,Y,te,ne,ue,ce,ie):(G&64||G&128)&&T.process(_,$,U,Y,te,ne,ue,ce,ie,Z)}H!=null&&te?wo(H,_&&_.ref,ne,$||_,!$):H==null&&_&&_.ref!=null&&wo(_.ref,null,ne,_,!0)},b=(_,$,U,Y)=>{if(_==null)s($.el=a($.children),U,Y);else{const te=$.el=_.el;$.children!==_.children&&u(te,$.children)}},k=(_,$,U,Y)=>{_==null?s($.el=l($.children||""),U,Y):$.el=_.el},w=(_,$,U,Y)=>{[_.el,_.anchor]=m(_.children,$,U,Y,_.el,_.anchor)},S=({el:_,anchor:$},U,Y)=>{let te;for(;_&&_!==$;)te=f(_),s(_,U,Y),_=te;s($,U,Y)},I=({el:_,anchor:$})=>{let U;for(;_&&_!==$;)U=f(_),o(_),_=U;o($)},q=(_,$,U,Y,te,ne,ue,ce,ie)=>{if($.type==="svg"?ue="svg":$.type==="math"&&(ue="mathml"),_==null)B($,U,Y,te,ne,ue,ce,ie);else{const T=_.el&&_.el._isVueCE?_.el:null;try{T&&T._beginPatch(),A(_,$,te,ne,ue,ce,ie)}finally{T&&T._endPatch()}}},B=(_,$,U,Y,te,ne,ue,ce)=>{let ie,T;const{props:H,shapeFlag:G,transition:se,dirs:he}=_;if(ie=_.el=i(_.type,ne,H&&H.is,H),G&8?c(ie,_.children):G&16&&L(_.children,ie,null,Y,te,Wi(_,ne),ue,ce),he&&Jn(_,null,Y,"created"),R(ie,_,_.scopeId,ue,Y),H){for(const _e in H)_e!=="value"&&!yo(_e)&&r(ie,_e,null,H[_e],ne,Y);"value"in H&&r(ie,"value",null,H.value,ne),(T=H.onVnodeBeforeMount)&&an(T,Y,_)}he&&Jn(_,null,Y,"beforeMount");const Se=Am(te,se);Se&&se.beforeEnter(ie),s(ie,$,U),((T=H&&H.onVnodeMounted)||Se||he)&&Mt(()=>{try{T&&an(T,Y,_),Se&&se.enter(ie),he&&Jn(_,null,Y,"mounted")}finally{}},te)},R=(_,$,U,Y,te)=>{if(U&&p(_,U),Y)for(let ne=0;ne<Y.length;ne++)p(_,Y[ne]);if(te){let ne=te.subTree;if($===ne||Df(ne.type)&&(ne.ssContent===$||ne.ssFallback===$)){const ue=te.vnode;R(_,ue,ue.scopeId,ue.slotScopeIds,te.parent)}}},L=(_,$,U,Y,te,ne,ue,ce,ie=0)=>{for(let T=ie;T<_.length;T++){const H=_[T]=ce?yn(_[T]):hn(_[T]);y(null,H,$,U,Y,te,ne,ue,ce)}},A=(_,$,U,Y,te,ne,ue)=>{const ce=$.el=_.el;let{patchFlag:ie,dynamicChildren:T,dirs:H}=$;ie|=_.patchFlag&16;const G=_.props||tt,se=$.props||tt;let he;if(U&&Qn(U,!1),(he=se.onVnodeBeforeUpdate)&&an(he,U,$,_),H&&Jn($,_,U,"beforeUpdate"),U&&Qn(U,!0),T&&(!_.dynamicChildren||_.dynamicChildren.length!==T.length)&&(ie=0,ue=!1,T=null),(G.innerHTML&&se.innerHTML==null||G.textContent&&se.textContent==null)&&c(ce,""),T?W(_.dynamicChildren,T,ce,U,Y,Wi($,te),ne):ue||ke(_,$,ce,null,U,Y,Wi($,te),ne,!1),ie>0){if(ie&16)F(ce,G,se,U,te);else if(ie&2&&G.class!==se.class&&r(ce,"class",null,se.class,te),ie&4&&r(ce,"style",G.style,se.style,te),ie&8){const Se=$.dynamicProps;for(let _e=0;_e<Se.length;_e++){const Re=Se[_e],we=G[Re],Oe=se[Re];(Oe!==we||Re==="value")&&r(ce,Re,we,Oe,te,U)}}ie&1&&_.children!==$.children&&c(ce,$.children)}else!ue&&T==null&&F(ce,G,se,U,te);((he=se.onVnodeUpdated)||H)&&Mt(()=>{he&&an(he,U,$,_),H&&Jn($,_,U,"updated")},Y)},W=(_,$,U,Y,te,ne,ue)=>{for(let ce=0;ce<$.length;ce++){const ie=_[ce],T=$[ce],H=ie.el&&(ie.type===X||!is(ie,T)||ie.shapeFlag&198)?d(ie.el):U;y(ie,T,H,null,Y,te,ne,ue,!0)}},F=(_,$,U,Y,te)=>{if($!==U){if($!==tt)for(const ne in $)!yo(ne)&&!(ne in U)&&r(_,ne,$[ne],null,te,Y);for(const ne in U){if(yo(ne))continue;const ue=U[ne],ce=$[ne];ue!==ce&&ne!=="value"&&r(_,ne,ce,ue,te,Y)}"value"in U&&r(_,"value",$.value,U.value,te)}},O=(_,$,U,Y,te,ne,ue,ce,ie)=>{const T=$.el=_?_.el:a(""),H=$.anchor=_?_.anchor:a("");let{patchFlag:G,dynamicChildren:se,slotScopeIds:he}=$;he&&(ce=ce?ce.concat(he):he),_==null?(s(T,U,Y),s(H,U,Y),L($.children||[],U,H,te,ne,ue,ce,ie)):G>0&&G&64&&se&&_.dynamicChildren&&_.dynamicChildren.length===se.length?(W(_.dynamicChildren,se,U,te,ne,ue,ce),($.key!=null||te&&$===te.subTree)&&xl(_,$,!0)):ke(_,$,U,H,te,ne,ue,ce,ie)},ee=(_,$,U,Y,te,ne,ue,ce,ie)=>{$.slotScopeIds=ce,_==null?$.shapeFlag&512?te.ctx.activate($,U,Y,ue,ie):x($,U,Y,te,ne,ue,ie):E(_,$,ie)},x=(_,$,U,Y,te,ne,ue)=>{const ce=_.component=Nm(_,Y,te);if(yi(_)&&(ce.ctx.renderer=Z),Gm(ce,!1,ue),ce.asyncDep){if(te&&te.registerDep(ce,z,ue),!_.el){const ie=ce.subTree=K(Ct);k(null,ie,$,U),_.placeholder=ie.el}}else z(ce,_,$,U,te,ne,ue)},E=(_,$,U)=>{const Y=$.component=_.component;if(km(_,$,U))if(Y.asyncDep&&!Y.asyncResolved){oe(Y,$,U);return}else Y.next=$,Y.update();else $.el=_.el,Y.vnode=$},z=(_,$,U,Y,te,ne,ue)=>{const ce=()=>{if(_.isMounted){let{next:G,bu:se,u:he,parent:Se,vnode:_e}=_;{const bt=Pf(_);if(bt){G&&(G.el=_e.el,oe(_,G,ue)),bt.asyncDep.then(()=>{Mt(()=>{_.isUnmounted||T()},te)});return}}let Re=G,we;Qn(_,!1),G?(G.el=_e.el,oe(_,G,ue)):G=_e,se&&gr(se),(we=G.props&&G.props.onVnodeBeforeUpdate)&&an(we,Se,G,_e),Qn(_,!0);const Oe=Au(_),It=_.subTree;_.subTree=Oe,y(It,Oe,d(It.el),Ke(It),_,te,ne),G.el=Oe.el,Re===null&&wm(_,Oe.el),he&&Mt(he,te),(we=G.props&&G.props.onVnodeUpdated)&&Mt(()=>an(we,Se,G,_e),te)}else{let G;const{el:se,props:he}=$,{bm:Se,m:_e,parent:Re,root:we,type:Oe}=_,It=Us($);Qn(_,!1),Se&&gr(Se),!It&&(G=he&&he.onVnodeBeforeMount)&&an(G,Re,$),Qn(_,!0);{we.ce&&we.ce._hasShadowRoot()&&we.ce._injectChildStyle(Oe,_.parent?_.parent.type:void 0);const bt=_.subTree=Au(_);y(null,bt,U,Y,_,te,ne),$.el=bt.el}if(_e&&Mt(_e,te),!It&&(G=he&&he.onVnodeMounted)){const bt=$;Mt(()=>an(G,Re,bt),te)}($.shapeFlag&256||Re&&Us(Re.vnode)&&Re.vnode.shapeFlag&256)&&_.a&&Mt(_.a,te),_.isMounted=!0,$=U=Y=null}};_.scope.on();const ie=_.effect=new Od(ce);_.scope.off();const T=_.update=ie.run.bind(ie),H=_.job=ie.runIfDirty.bind(ie);H.i=_,H.id=_.uid,ie.scheduler=()=>wl(H),Qn(_,!0),T()},oe=(_,$,U)=>{$.component=_;const Y=_.vnode.props;_.vnode=$,_.next=null,_m(_,$.props,Y,U),Tm(_,$.children,U),An(),bu(_),Mn()},ke=(_,$,U,Y,te,ne,ue,ce,ie=!1)=>{const T=_&&_.children,H=_?_.shapeFlag:0,G=$.children,{patchFlag:se,shapeFlag:he}=$;if(se>0){if(se&128){ge(T,G,U,Y,te,ne,ue,ce,ie);return}else if(se&256){Te(T,G,U,Y,te,ne,ue,ce,ie);return}}he&8?(H&16&&Ue(T,te,ne),G!==T&&c(U,G)):H&16?he&16?ge(T,G,U,Y,te,ne,ue,ce,ie):Ue(T,te,ne,!0):(H&8&&c(U,""),he&16&&L(G,U,Y,te,ne,ue,ce,ie))},Te=(_,$,U,Y,te,ne,ue,ce,ie)=>{_=_||Bs,$=$||Bs;const T=_.length,H=$.length,G=Math.min(T,H);let se;for(se=0;se<G;se++){const he=$[se]=ie?yn($[se]):hn($[se]);y(_[se],he,U,null,te,ne,ue,ce,ie)}T>H?Ue(_,te,ne,!0,!1,G):L($,U,Y,te,ne,ue,ce,ie,G)},ge=(_,$,U,Y,te,ne,ue,ce,ie)=>{let T=0;const H=$.length;let G=_.length-1,se=H-1;for(;T<=G&&T<=se;){const he=_[T],Se=$[T]=ie?yn($[T]):hn($[T]);if(is(he,Se))y(he,Se,U,null,te,ne,ue,ce,ie);else break;T++}for(;T<=G&&T<=se;){const he=_[G],Se=$[se]=ie?yn($[se]):hn($[se]);if(is(he,Se))y(he,Se,U,null,te,ne,ue,ce,ie);else break;G--,se--}if(T>G){if(T<=se){const he=se+1,Se=he<H?$[he].el:Y;for(;T<=se;)y(null,$[T]=ie?yn($[T]):hn($[T]),U,Se,te,ne,ue,ce,ie),T++}}else if(T>se)for(;T<=G;)ve(_[T],te,ne,!0),T++;else{const he=T,Se=T,_e=new Map;for(T=Se;T<=se;T++){const gt=$[T]=ie?yn($[T]):hn($[T]);gt.key!=null&&_e.set(gt.key,T)}let Re,we=0;const Oe=se-Se+1;let It=!1,bt=0;const rn=new Array(Oe);for(T=0;T<Oe;T++)rn[T]=0;for(T=he;T<=G;T++){const gt=_[T];if(we>=Oe){ve(gt,te,ne,!0);continue}let Ot;if(gt.key!=null)Ot=_e.get(gt.key);else for(Re=Se;Re<=se;Re++)if(rn[Re-Se]===0&&is(gt,$[Re])){Ot=Re;break}Ot===void 0?ve(gt,te,ne,!0):(rn[Ot-Se]=T+1,Ot>=bt?bt=Ot:It=!0,y(gt,$[Ot],U,null,te,ne,ue,ce,ie),we++)}const _s=It?Mm(rn):Bs;for(Re=_s.length-1,T=Oe-1;T>=0;T--){const gt=Se+T,Ot=$[gt],$s=$[gt+1],Cs=gt+1<H?$s.el||Lf($s):Y;rn[T]===0?y(null,Ot,U,Cs,te,ne,ue,ce,ie):It&&(Re<0||T!==_s[Re]?le(Ot,U,Cs,2):Re--)}}},le=(_,$,U,Y,te=null)=>{const{el:ne,type:ue,transition:ce,children:ie,shapeFlag:T}=_;if(T&6){le(_.component.subTree,$,U,Y);return}if(T&128){_.suspense.move($,U,Y);return}if(T&64){ue.move(_,$,U,Z);return}if(ue===X){s(ne,$,U);for(let G=0;G<ie.length;G++)le(ie[G],$,U,Y);s(_.anchor,$,U);return}if(ue===vr){S(_,$,U);return}if(Y!==2&&T&1&&ce)if(Y===0)ce.persisted&&!ne[Ut]?s(ne,$,U):(ce.beforeEnter(ne),s(ne,$,U),Mt(()=>ce.enter(ne),te));else{const{leave:G,delayLeave:se,afterLeave:he}=ce,Se=()=>{_.ctx.isUnmounted?o(ne):s(ne,$,U)},_e=()=>{const Re=ne._isLeaving||!!ne[Ut];ne._isLeaving&&ne[Ut](!0),ce.persisted&&!Re?Se():G(ne,()=>{Se(),he&&he()})};se?se(ne,Se,_e):_e()}else s(ne,$,U)},ve=(_,$,U,Y=!1,te=!1)=>{const{type:ne,props:ue,ref:ce,children:ie,dynamicChildren:T,shapeFlag:H,patchFlag:G,dirs:se,cacheIndex:he,memo:Se}=_;if(G===-2&&(te=!1),ce!=null&&(An(),wo(ce,null,U,_,!0),Mn()),he!=null&&($.renderCache[he]=void 0),H&256){$.ctx.deactivate(_);return}const _e=H&1&&se,Re=!Us(_);let we;if(Re&&(we=ue&&ue.onVnodeBeforeUnmount)&&an(we,$,_),H&6)Ee(_.component,U,Y);else{if(H&128){_.suspense.unmount(U,Y);return}_e&&Jn(_,null,$,"beforeUnmount"),H&64?_.type.remove(_,$,U,Z,Y):T&&!T.hasOnce&&(ne!==X||G>0&&G&64)?Ue(T,$,U,!1,!0):(ne===X&&G&384||!te&&H&16)&&Ue(ie,$,U),Y&&Q(_)}const Oe=Se!=null&&he==null;(Re&&(we=ue&&ue.onVnodeUnmounted)||_e||Oe)&&Mt(()=>{we&&an(we,$,_),_e&&Jn(_,null,$,"unmounted"),Oe&&(_.el=null)},U)},Q=_=>{const{type:$,el:U,anchor:Y,transition:te}=_;if($===X){ye(U,Y);return}if($===vr){I(_);return}const ne=()=>{o(U),te&&!te.persisted&&te.afterLeave&&te.afterLeave()};if(_.shapeFlag&1&&te&&!te.persisted){const{leave:ue,delayLeave:ce}=te,ie=()=>ue(U,ne);ce?ce(_.el,ne,ie):ie()}else ne()},ye=(_,$)=>{let U;for(;_!==$;)U=f(_),o(_),_=U;o($)},Ee=(_,$,U)=>{const{bum:Y,scope:te,job:ne,subTree:ue,um:ce,m:ie,a:T}=_;Pu(ie),Pu(T),Y&&gr(Y),te.stop(),ne&&(ne.flags|=8,ve(ue,_,$,U)),ce&&Mt(ce,$),Mt(()=>{_.isUnmounted=!0},$)},Ue=(_,$,U,Y=!1,te=!1,ne=0)=>{for(let ue=ne;ue<_.length;ue++)ve(_[ue],$,U,Y,te)},Ke=_=>{if(_.shapeFlag&6)return Ke(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const $=f(_.anchor||_.el),U=$&&$[af];return U?f(U):$};let J=!1;const de=(_,$,U)=>{let Y;_==null?$._vnode&&(ve($._vnode,null,null,!0),Y=$._vnode.component):y($._vnode||null,_,$,null,null,null,U),$._vnode=_,J||(J=!0,bu(Y),tf(),J=!1)},Z={p:y,um:ve,m:le,r:Q,mt:x,mc:L,pc:ke,pbc:W,n:Ke,o:e};return{render:de,hydrate:void 0,createApp:pm(de)}}function Wi({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Qn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Am(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function xl(e,t,n=!1){const s=e.children,o=t.children;if(Ae(s)&&Ae(o))for(let r=0;r<s.length;r++){const i=s[r];let a=o[r];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[r]=yn(o[r]),a.el=i.el),!n&&a.patchFlag!==-2&&xl(i,a)),a.type===Si&&(a.patchFlag===-1&&(a=o[r]=yn(a)),a.el=i.el),a.type===Ct&&!a.el&&(a.el=i.el)}}function Mm(e){const t=e.slice(),n=[0];let s,o,r,i,a;const l=e.length;for(s=0;s<l;s++){const u=e[s];if(u!==0){if(o=n[n.length-1],e[o]<u){t[s]=o,n.push(s);continue}for(r=0,i=n.length-1;r<i;)a=r+i>>1,e[n[a]]<u?r=a+1:i=a;u<e[n[r]]&&(r>0&&(t[s]=n[r-1]),n[r]=s)}}for(r=n.length,i=n[r-1];r-- >0;)n[r]=i,i=t[i];return n}function Pf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Pf(t)}function Pu(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Lf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Lf(t.subTree):null}const Df=e=>e.__isSuspense;function Rm(e,t){t&&t.pendingBranch?Ae(e)?t.effects.push(...e):t.effects.push(e):ef(e)}const X=Symbol.for("v-fgt"),Si=Symbol.for("v-txt"),Ct=Symbol.for("v-cmt"),vr=Symbol.for("v-stc"),En=[];let Pt=null;function g(e=!1){En.push(Pt=e?null:[])}function Tl(){En.pop(),Pt=En[En.length-1]||null}let Zs=1;function Pr(e,t=!1){Zs+=e,e<0&&Pt&&t&&(Pt.hasOnce=!0)}function Of(e){return e.dynamicChildren=Zs>0?Pt||Bs:null,Tl(),Zs>0&&Pt&&Pt.push(e),e}function v(e,t,n,s,o,r){return Of(h(e,t,n,s,o,r,!0))}function Fe(e,t,n,s,o){return Of(K(e,t,n,s,o,!0))}function Ys(e){return e?e.__v_isVNode===!0:!1}function is(e,t){return e.type===t.type&&e.key===t.key}const Nf=({key:e})=>e??null,yr=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?ot(e)||ht(e)||Ge(e)?{i:St,r:e,k:t,f:!!n}:e:null);function h(e,t=null,n=null,s=0,o=null,r=e===X?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Nf(t),ref:t&&yr(t),scopeId:sf,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:s,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:St};return a?(Lr(l,n),r&128&&e.normalize(l)):n&&(l.shapeFlag|=ot(n)?8:16),Zs>0&&!i&&Pt&&(l.patchFlag>0||r&6)&&l.patchFlag!==32&&Pt.push(l),l}const K=Pm;function Pm(e,t=null,n=null,s=0,o=null,r=!1){if((!e||e===vf)&&(e=Ct),Ys(e)){const a=qn(e,t,!0);return n&&Lr(a,n),Zs>0&&!r&&Pt&&(a.shapeFlag&6?Pt[Pt.indexOf(e)]=a:Pt.push(a)),a.patchFlag=-2,a}if(zm(e)&&(e=e.__vccOpts),t){t=Lm(t);let{class:a,style:l}=t;a&&!ot(a)&&(t.class=fe(a)),Xe(l)&&(kl(l)&&!Ae(l)&&(l=dt({},l)),t.style=yt(l))}const i=ot(e)?1:Df(e)?128:lf(e)?64:Xe(e)?4:Ge(e)?2:0;return h(e,t,n,s,o,i,r,!0)}function Lm(e){return e?kl(e)||Tf(e)?dt({},e):e:null}function qn(e,t,n=!1,s=!1){const{props:o,ref:r,patchFlag:i,children:a,transition:l}=e,u=t?Gf(o||{},t):o,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Nf(u),ref:t&&t.ref?n&&r?Ae(r)?r.concat(yr(t)):[r,yr(t)]:yr(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==X?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&qn(e.ssContent),ssFallback:e.ssFallback&&qn(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&s&&ms(c,l.clone(c)),c}function Pe(e=" ",t=0){return K(Si,null,e,t)}function N(e="",t=!1){return t?(g(),Fe(Ct,null,e)):K(Ct,null,e)}function hn(e){return e==null||typeof e=="boolean"?K(Ct):Ae(e)?K(X,null,e.slice()):Ys(e)?yn(e):K(Si,null,String(e))}function yn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:qn(e)}function Lr(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(Ae(t))n=16;else if(typeof t=="object")if(s&65){const o=t.default;o&&(o._c&&(o._d=!1),Lr(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Tf(t)?t._ctx=St:o===3&&St&&(St.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(Ge(t)){if(s&65){Lr(e,{default:t});return}t={default:t,_ctx:St},n=32}else t=String(t),s&64?(n=16,t=[Pe(t)]):n=8;e.children=t,e.shapeFlag|=n}function Gf(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const o in s)if(o==="class")t.class!==s.class&&(t.class=fe([t.class,s.class]));else if(o==="style")t.style=yt([t.style,s.style]);else if(ui(o)){const r=t[o],i=s[o];i&&r!==i&&!(Ae(r)&&r.includes(i))?t[o]=r?[].concat(r,i):i:i==null&&r==null&&!ci(o)&&(t[o]=i)}else o!==""&&(t[o]=s[o])}return t}function an(e,t,n,s=null){Kt(e,t,7,[n,s])}const Dm=Sf();let Om=0;function Nm(e,t,n){const s=e.type,o=(t?t.appContext:e.appContext)||Dm,r={uid:Om++,vnode:e,type:s,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new fg(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ef(s,o),emitsOptions:_f(s,o),emit:null,emitted:null,propsDefaults:tt,inheritAttrs:s.inheritAttrs,ctx:tt,data:tt,props:tt,attrs:tt,slots:tt,refs:tt,setupState:tt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=t?t.root:r,r.emit=mm.bind(null,r),e.ce&&e.ce(r),r}let xt=null;const _i=()=>xt||St;let Dr,Pa;{const e=gi(),t=(n,s)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(s),r=>{o.length>1?o.forEach(i=>i(r)):o[0](r)}};Dr=t("__VUE_INSTANCE_SETTERS__",n=>xt=n),Pa=t("__VUE_SSR_SETTERS__",n=>Ro=n)}const Wo=e=>{const t=xt;return Dr(e),e.scope.on(),()=>{e.scope.off(),Dr(t)}},Lu=()=>{xt&&xt.scope.off(),Dr(null)};function Bf(e){return e.vnode.shapeFlag&4}let Ro=!1;function Gm(e,t=!1,n=!1){t&&Pa(t);const{props:s,children:o}=e.vnode,r=Bf(e);Sm(e,s,r,t),xm(e,o,n||t);const i=r?Bm(e,t):void 0;return t&&Pa(!1),i}function Bm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,am);const{setup:s}=n;if(s){An();const o=e.setupContext=s.length>1?jm(e):null,r=Wo(e),i=Ho(s,e,0,[e.props,o]),a=Ed(i);if(Mn(),r(),(a||e.sp)&&!Us(e)&&pf(e),a){if(i.then(Lu,Lu),t)return i.then(l=>{Du(e,l)}).catch(l=>{vi(l,e,0)});e.asyncDep=i}else Du(e,i)}else Ff(e)}function Du(e,t,n){Ge(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Xe(t)&&(e.setupState=Xd(t)),Ff(e)}function Ff(e,t,n){const s=e.type;e.render||(e.render=s.render||en);{const o=Wo(e);An();try{lm(e)}finally{Mn(),o()}}}const Fm={get(e,t){return $t(e,"get",""),e[t]}};function jm(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Fm),slots:e.slots,emit:e.emit,expose:t}}function $i(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Xd(Rg(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in _o)return _o[n](e)},has(t,n){return n in t||n in _o}})):e.proxy}function Um(e,t=!0){return Ge(e)?e.displayName||e.name:e.name||t&&e.__name}function zm(e){return Ge(e)&&"__vccOpts"in e}const P=(e,t)=>Ng(e,t,Ro);function qe(e,t,n){try{Pr(-1);const s=arguments.length;return s===2?Xe(t)&&!Ae(t)?Ys(t)?K(e,null,[t]):K(e,t):K(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Ys(n)&&(n=[n]),K(e,t,n))}finally{Pr(1)}}function Hm(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let s=0;s<n.length;s++)if(Xt(n[s],t[s]))return!1;return Zs>0&&Pt&&Pt.push(e),!0}const Wm="3.5.40";/**
|
|
15
|
+
* @vue/runtime-dom v3.5.40
|
|
16
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
+
* @license MIT
|
|
18
|
+
**/let La;const Ou=typeof window<"u"&&window.trustedTypes;if(Ou)try{La=Ou.createPolicy("vue",{createHTML:e=>e})}catch{}const jf=La?e=>La.createHTML(e):e=>e,qm="http://www.w3.org/2000/svg",Vm="http://www.w3.org/1998/Math/MathML",vn=typeof document<"u"?document:null,Nu=vn&&vn.createElement("template"),Km={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const o=t==="svg"?vn.createElementNS(qm,e):t==="mathml"?vn.createElementNS(Vm,e):n?vn.createElement(e,{is:n}):vn.createElement(e);return e==="select"&&s&&s.multiple!=null&&o.setAttribute("multiple",s.multiple),o},createText:e=>vn.createTextNode(e),createComment:e=>vn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>vn.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,o,r){const i=n?n.previousSibling:t.lastChild;if(o&&(o===r||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===r||!(o=o.nextSibling)););else{Nu.innerHTML=jf(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const a=Nu.content;if(s==="svg"||s==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ln="transition",io="animation",Xs=Symbol("_vtc"),Uf={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},zf=dt({},cf,Uf),Zm=e=>(e.displayName="Transition",e.props=zf,e),Il=Zm((e,{slots:t})=>qe(Zg,Hf(e),t)),es=(e,t=[])=>{Ae(e)?e.forEach(n=>n(...t)):e&&e(...t)},Gu=e=>e?Ae(e)?e.some(t=>t.length>1):e.length>1:!1;function Hf(e){const t={};for(const O in e)O in Uf||(t[O]=e[O]);if(e.css===!1)return t;const{name:n="v",type:s,duration:o,enterFromClass:r=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=r,appearActiveClass:u=i,appearToClass:c=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=Ym(o),y=m&&m[0],b=m&&m[1],{onBeforeEnter:k,onEnter:w,onEnterCancelled:S,onLeave:I,onLeaveCancelled:q,onBeforeAppear:B=k,onAppear:R=w,onAppearCancelled:L=S}=t,A=(O,ee,x,E)=>{O._enterCancelled=E,On(O,ee?c:a),On(O,ee?u:i),x&&x()},W=(O,ee)=>{O._isLeaving=!1,On(O,d),On(O,p),On(O,f),ee&&ee()},F=O=>(ee,x)=>{const E=O?R:w,z=()=>A(ee,O,x);es(E,[ee,z]),Bu(()=>{On(ee,O?l:r),ln(ee,O?c:a),Gu(E)||Fu(ee,s,y,z)})};return dt(t,{onBeforeEnter(O){es(k,[O]),ln(O,r),ln(O,i)},onBeforeAppear(O){es(B,[O]),ln(O,l),ln(O,u)},onEnter:F(!1),onAppear:F(!0),onLeave(O,ee){O._isLeaving=!0;const x=()=>W(O,ee);ln(O,d),O._enterCancelled?(ln(O,f),Da(O)):(Da(O),ln(O,f)),Bu(()=>{O._isLeaving&&(On(O,d),ln(O,p),Gu(I)||Fu(O,s,b,x))}),es(I,[O,x])},onEnterCancelled(O){A(O,!1,void 0,!0),es(S,[O])},onAppearCancelled(O){A(O,!0,void 0,!0),es(L,[O])},onLeaveCancelled(O){W(O),es(q,[O])}})}function Ym(e){if(e==null)return null;if(Xe(e))return[qi(e.enter),qi(e.leave)];{const t=qi(e);return[t,t]}}function qi(e){return ng(e)}function ln(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Xs]||(e[Xs]=new Set)).add(t)}function On(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Xs];n&&(n.delete(t),n.size||(e[Xs]=void 0))}function Bu(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Xm=0;function Fu(e,t,n,s){const o=e._endId=++Xm,r=()=>{o===e._endId&&s()};if(n!=null)return setTimeout(r,n);const{type:i,timeout:a,propCount:l}=Wf(e,t);if(!i)return s();const u=i+"end";let c=0;const d=()=>{e.removeEventListener(u,f),r()},f=p=>{p.target===e&&++c>=l&&d()};setTimeout(()=>{c<l&&d()},a+1),e.addEventListener(u,f)}function Wf(e,t){const n=window.getComputedStyle(e),s=m=>(n[m]||"").split(", "),o=s(`${Ln}Delay`),r=s(`${Ln}Duration`),i=ju(o,r),a=s(`${io}Delay`),l=s(`${io}Duration`),u=ju(a,l);let c=null,d=0,f=0;t===Ln?i>0&&(c=Ln,d=i,f=r.length):t===io?u>0&&(c=io,d=u,f=l.length):(d=Math.max(i,u),c=d>0?i>u?Ln:io:null,f=c?c===Ln?r.length:l.length:0);const p=c===Ln&&/\b(?:transform|all)(?:,|$)/.test(s(`${Ln}Property`).toString());return{type:c,timeout:d,propCount:f,hasTransform:p}}function ju(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>Uu(n)+Uu(e[s])))}function Uu(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Da(e){return(e?e.ownerDocument:document).body.offsetHeight}function Jm(e,t,n){const s=e[Xs];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Or=Symbol("_vod"),El=Symbol("_vsh"),Nr={name:"show",beforeMount(e,{value:t},{transition:n}){e[Or]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):ao(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:s}){!t!=!n&&(s?t?(s.beforeEnter(e),ao(e,!0),s.enter(e)):s.leave(e,()=>{ao(e,!1)}):ao(e,t))},beforeUnmount(e,{value:t}){ao(e,t)}};function ao(e,t){e.style.display=t?e[Or]:"none",e[El]=!t}const qf=Symbol("");function Qm(e){const t=_i();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(r=>Gr(r,o))},s=()=>{const o=e(t.proxy);t.ce?Gr(t.ce,o):Oa(t.subTree,o),n(o)};mf(()=>{ef(s)}),rt(()=>{xe(s,en,{flush:"post"});const o=new MutationObserver(s);o.observe(t.subTree.el.parentNode,{childList:!0}),ki(()=>o.disconnect())})}function Oa(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{Oa(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Gr(e.el,t);else if(e.type===X)e.children.forEach(n=>Oa(n,t));else if(e.type===vr){let{el:n,anchor:s}=e;for(;n&&(Gr(n,t),n!==s);)n=n.nextSibling}}function Gr(e,t){if(e.nodeType===1){const n=e.style;let s="";for(const o in t){const r=dg(t[o]);n.setProperty(`--${o}`,r),s+=`--${o}: ${r};`}n[qf]=s}}const ev=/(?:^|;)\s*display\s*:/;function tv(e,t,n){const s=e.style,o=ot(n);let r=!1;if(n&&!o){if(t)if(ot(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&mo(s,a,"")}else for(const i in t)n[i]==null&&mo(s,i,"");for(const i in n){i==="display"&&(r=!0);const a=n[i];a!=null?sv(e,i,!ot(t)&&t?t[i]:void 0,a)||mo(s,i,a):mo(s,i,"")}}else if(o){if(t!==n){const i=s[qf];i&&(n+=";"+i),s.cssText=n,r=ev.test(n)}}else t&&e.removeAttribute("style");Or in e&&(e[Or]=r?s.display:"",e[El]&&(s.display="none"))}const zu=/\s*!important$/;function mo(e,t,n){if(Ae(n))n.forEach(s=>mo(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=nv(e,t);zu.test(n)?e.setProperty(Kn(s),n.replace(zu,""),"important"):e[s]=n}}const Hu=["Webkit","Moz","ms"],Vi={};function nv(e,t){const n=Vi[t];if(n)return n;let s=Dt(t);if(s!=="filter"&&s in e)return Vi[t]=s;s=hi(s);for(let o=0;o<Hu.length;o++){const r=Hu[o]+s;if(r in e)return Vi[t]=r}return t}function sv(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&ot(s)&&n===s}const Wu="http://www.w3.org/1999/xlink";function qu(e,t,n,s,o,r=lg(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Wu,t.slice(6,t.length)):e.setAttributeNS(Wu,t,n):n==null||r&&!Pd(n)?e.removeAttribute(t):e.setAttribute(t,r?"":sn(n)?String(n):n)}function Vu(e,t,n,s,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?jf(n):n);return}const r=e.tagName;if(t==="value"&&r!=="PROGRESS"&&!r.includes("-")){const a=r==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Pd(n):n==null&&a==="string"?(n="",i=!0):a==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(o||t)}function as(e,t,n,s){e.addEventListener(t,n,s)}function ov(e,t,n,s){e.removeEventListener(t,n,s)}const Ku=Symbol("_vei");function rv(e,t,n,s,o=null){const r=e[Ku]||(e[Ku]={}),i=r[t];if(s&&i)i.value=s;else{const[a,l]=lv(t);if(s){const u=r[t]=dv(s,o);as(e,a,u,l)}else i&&(ov(e,a,i,l),r[t]=void 0)}}const iv=/(Once|Passive|Capture)$/,av=/^on:?(?:Once|Passive|Capture)$/;function lv(e){let t,n;for(;(n=e.match(iv))&&!av.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):Kn(e.slice(2)),t]}let Ki=0;const uv=Promise.resolve(),cv=()=>Ki||(uv.then(()=>Ki=0),Ki=Date.now());function dv(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;const o=n.value;if(Ae(o)){const r=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{r.call(s),s._stopped=!0};const i=o.slice(),a=[s];for(let l=0;l<i.length&&!s._stopped;l++){const u=i[l];u&&Kt(u,t,5,a)}}else Kt(o,t,5,[s])};return n.value=e,n.attached=cv(),n}const Zu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,fv=(e,t,n,s,o,r)=>{const i=o==="svg";t==="class"?Jm(e,s,i):t==="style"?tv(e,n,s):ui(t)?ci(t)||rv(e,t,n,s,r):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):hv(e,t,s,i))?(Vu(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&qu(e,t,s,i,r,t!=="value")):e._isVueCE&&(pv(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!ot(s)))?Vu(e,Dt(t),s,r,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),qu(e,t,s,i))};function hv(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Zu(t)&&Ge(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Zu(t)&&ot(n)?!1:t in e}function pv(e,t){const n=e._def.props;if(!n)return!1;const s=Dt(t);return Array.isArray(n)?n.some(o=>Dt(o)===s):Object.keys(n).some(o=>Dt(o)===s)}const Vf=new WeakMap,Kf=new WeakMap,Br=Symbol("_moveCb"),Yu=Symbol("_enterCb"),gv=e=>(delete e.props.mode,e),mv=gv({name:"TransitionGroup",props:dt({},zf,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=_i(),s=uf();let o,r;return _l(()=>{if(!o.length)return;const i=e.moveClass||`${e.name||"v"}-move`;if(!wv(o[0].el,n.vnode.el,i)){o=[];return}o.forEach(yv),o.forEach(bv);const a=o.filter(kv);Da(n.vnode.el),a.forEach(l=>{const u=l.el,c=u.style;ln(u,i),c.transform=c.webkitTransform=c.transitionDuration="";const d=u[Br]=f=>{f&&f.target!==u||(!f||f.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",d),u[Br]=null,On(u,i))};u.addEventListener("transitionend",d)}),o=[]}),()=>{const i=We(e),a=Hf(i);let l=i.tag||X;if(o=[],r)for(let u=0;u<r.length;u++){const c=r[u];c.el&&c.el instanceof Element&&!c.el[El]&&(o.push(c),ms(c,Mo(c,a,s,n)),Vf.set(c,Zf(c.el)))}r=t.default?Sl(t.default()):[];for(let u=0;u<r.length;u++){const c=r[u];c.key!=null&&ms(c,Mo(c,a,s,n))}return K(l,null,r)}}}),vv=mv;function yv(e){const t=e.el;t[Br]&&t[Br](),t[Yu]&&t[Yu]()}function bv(e){Kf.set(e,Zf(e.el))}function kv(e){const t=Vf.get(e),n=Kf.get(e),s=t.left-n.left,o=t.top-n.top;if(s||o){const r=e.el,i=r.style,a=r.getBoundingClientRect();let l=1,u=1;return r.offsetWidth&&(l=a.width/r.offsetWidth),r.offsetHeight&&(u=a.height/r.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(l-1)<.01&&(l=1),Math.abs(u-1)<.01&&(u=1),i.transform=i.webkitTransform=`translate(${s/l}px,${o/u}px)`,i.transitionDuration="0s",e}}function Zf(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function wv(e,t,n){const s=e.cloneNode(),o=e[Xs];o&&o.forEach(a=>{a.split(/\s+/).forEach(l=>l&&s.classList.remove(l))}),n.split(/\s+/).forEach(a=>a&&s.classList.add(a)),s.style.display="none";const r=t.nodeType===1?t:t.parentNode;r.appendChild(s);const{hasTransform:i}=Wf(s);return r.removeChild(s),i}const Fr=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ae(t)?n=>gr(t,n):t};function Sv(e){e.target.composing=!0}function Xu(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Hs=Symbol("_assign");function Ju(e,t,n){return t&&(e=e.trim()),n&&(e=pi(e)),e}const ut={created(e,{modifiers:{lazy:t,trim:n,number:s}},o){e[Hs]=Fr(o);const r=s||o.props&&o.props.type==="number";as(e,t?"change":"input",i=>{i.target.composing||e[Hs](Ju(e.value,n,r))}),(n||r)&&as(e,"change",()=>{e.value=Ju(e.value,n,r)}),t||(as(e,"compositionstart",Sv),as(e,"compositionend",Xu),as(e,"change",Xu))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:o,number:r}},i){if(e[Hs]=Fr(i),e.composing)return;const a=(r||e.type==="number")&&!/^0\d/.test(e.value)?pi(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(s&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Qu={deep:!0,created(e,{value:t,modifiers:{number:n}},s){e._modelValue=t,as(e,"change",()=>{const o=Array.prototype.filter.call(e.options,r=>r.selected).map(r=>n?pi(jr(r)):jr(r));e[Hs](e.multiple?di(e._modelValue)?new Set(o):o:o[0]),e._assigning=!0,Ve(()=>{e._assigning=!1})}),e[Hs]=Fr(s)},mounted(e,{value:t}){ec(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Hs]=Fr(n)},updated(e,{value:t}){e._assigning||ec(e,t)}};function ec(e,t){const n=e.multiple,s=Ae(t);if(!(n&&!s&&!di(t))){for(let o=0,r=e.options.length;o<r;o++){const i=e.options[o],a=jr(i);if(n)if(s){const l=typeof a;l==="string"||l==="number"?i.selected=t.some(u=>String(u)===String(a)):i.selected=cg(t,a)>-1}else i.selected=t.has(a);else if(zo(jr(i),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function jr(e){return"_value"in e?e._value:e.value}const _v=["ctrl","shift","alt","meta"],$v={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>_v.some(n=>e[`${n}Key`]&&!t.includes(n))},st=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((o,...r)=>{for(let i=0;i<t.length;i++){const a=$v[t[i]];if(a&&a(o,t))return}return e(o,...r)}))},Cv={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Vn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=(o=>{if(!("key"in o))return;const r=Kn(o.key);if(t.some(i=>i===r||Cv[i]===r))return e(o)}))},xv=dt({patchProp:fv},Km);let tc;function Tv(){return tc||(tc=Im(xv))}const Iv=((...e)=>{const t=Tv().createApp(...e),{mount:n}=t;return t.mount=s=>{const o=Av(s);if(!o)return;const r=t._component;!Ge(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const i=n(o,!1,Ev(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),i},t});function Ev(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Av(e){return ot(e)?document.querySelector(e):e}const Ur=[{name:"model",description:"切换模型 / 思考强度",target:"local",group:"core"},{name:"new",description:"新建会话",target:"local",group:"core"},{name:"clear",description:"清空本地消息列表",target:"local",group:"core"},{name:"help",description:"显示可用命令",target:"local",group:"core"},{name:"compact",description:"压缩会话上下文",target:"backend",group:"core"},{name:"title",description:"重命名当前会话",target:"backend",aliases:["rename"],acceptsInput:!0,group:"core"},{name:"btw",description:"快速侧问(不打断当前回合)",target:"backend",acceptsInput:!0,group:"core"},{name:"auto",description:"切换为 auto 权限模式",target:"backend",group:"advanced"},{name:"yes",description:"切换为 yolo 权限模式",target:"backend",aliases:["yolo"],group:"advanced"},{name:"bot",description:"切换为 Bot 无人值守模式",target:"backend",group:"advanced"},{name:"plan",description:"切换计划模式",target:"backend",group:"advanced"},{name:"fork",description:"复制当前会话为新分支",target:"backend",group:"advanced"},{name:"status",description:"查看会话状态",target:"local",group:"advanced"},{name:"usage",description:"查看 Token 用量",target:"local",group:"advanced"}],Ws=M([]);function nc(e){Ws.value=[...e]}const $o=M("");function Mv(e){$o.value=e.trim().toLowerCase()}function Rv(){$o.value=""}const Pv=8,Yf=M(!1);function Lv(){return Yf.value}function sc(e,t){var n;return t?e.name.startsWith(t)||((n=e.aliases)==null?void 0:n.some(s=>s.startsWith(t)))===!0||e.description.includes(t):!0}function oc(e,t){return t?e.name.toLowerCase().startsWith(t)||e.name.includes(t)||e.description.includes(t):!0}function Dv(e){const t=(e||"").toLowerCase(),n=t===""&&$o.value==="";Yf.value=n;const s=Ur.filter(r=>sc(r,t)&&sc(r,$o.value)).filter(r=>!n||r.group!=="advanced"),o=Ws.value.filter(r=>oc(r,t)&&oc(r,$o.value)).map(r=>({name:r.name,description:r.description||"技能",target:"local",acceptsInput:!0,kind:"skill",source:r.pluginId?`plugin:${r.pluginId}`:r.source}));return[...s,...o]}function Ov(e){const t=e.toLowerCase(),n=Ur.find(s=>{var o;return s.name===t||((o=s.aliases)==null?void 0:o.includes(t))});return(n==null?void 0:n.name)??t}function Nv(e){const t=e.toLowerCase();return Ws.value.some(n=>n.name.toLowerCase()===t)}function Gv(){const e=o=>{var i;return`${(i=o.aliases)!=null&&i.length?[o.name,...o.aliases].map(a=>`/${a}`).join(", "):`/${o.name}`} - ${o.description}`},t=Ur.filter(o=>o.group!=="advanced"),n=Ur.filter(o=>o.group==="advanced"),s=["常用:",...t.map(e),"高级:",...n.map(e)];return Ws.value.length>0&&s.push("",`技能 ${Ws.value.length} 个(输入 / 后在菜单中查看,或前往技能中心):`,...Ws.value.map(o=>`/${o.name} - ${o.description||"技能"}`)),["可用命令:",...s].join(`
|
|
19
|
+
`)}let zr=null;const Al=Pg(null);function Bv(e){zr=e,Al.value=e}function Fv(e){zr===e&&(zr=null,Al.value=null)}function Xf(){return zr}function jv(){return{activeClient:Al}}const Po=M([]);let Uv=0;function zv(e,t="info",n=3500){const s=`toast_${++Uv}`;Po.value=[...Po.value,{id:s,type:t,message:e}],n>0&&setTimeout(()=>Jf(s),n)}function Jf(e){Po.value=Po.value.filter(t=>t.id!==e)}function qo(){return{toasts:Po,showToast:zv,removeToast:Jf}}const ze="/api/v1",Hv=2*3e4,rc=8;function Jt(e,t,n){e.wsHandlers.set(t,n)}function Wv(){const e=M("connecting"),t=M([]),n=M(!1),s=M(void 0),o=M([]),r=M({busy:!1}),i=M(null),a=M([]),l=M(!1),u=M(null),c=M(!1),d=M(null),f=M(null),p=M(null),m=M([]),y=M(null),b=M(!1),k=P(()=>r.value.busy||c.value),w=P(()=>f.value!==null&&!b.value);return{connectionStatus:e,messages:t,olderAvailable:n,oldestSeq:s,pendingApprovals:o,status:r,goal:i,todos:a,goalRequestPending:l,goalRequestError:u,promptPending:c,error:d,sessionId:f,workDir:p,isBusy:k,sessions:m,currentSessionId:y,isArchived:w,gitStatus:M(null),models:M([]),modelsError:M(null),like:M({}),sessionPlan:M(null),skills:M([]),skillsError:M(null),plugins:M([]),pluginInfo:M(null),mcpServers:M([]),mcpStartupMetrics:M(null),backgroundTasks:M([]),backgroundTaskOutput:M(""),config:M(null),experimentalFlags:M(null),preflightOk:M(!1),sessionActive:b,ws:null,heartbeatTimer:null,reconnectTimer:null,snapshotRetryTimer:null,lastPongAt:Date.now(),seq:0,epoch:0,reconnectAttempt:0,sessionGeneration:0,connectionGeneration:0,promptGeneration:0,liveGeneration:0,sessionMutationGeneration:0,goalMutationGeneration:0,permissionMutationGeneration:0,goalAwaitingMutation:null,goalRequestInFlight:!1,snapshotRetryGoalGeneration:null,pendingPromptAccepted:!1,disposed:!1,sentMessageIds:new Map,turnNumber:0,turnStartAt:0,turnFirstTokenAt:null,activeToolMs:0,streamDisposed:!1,pendingAssistantDelta:"",pendingThinkingDelta:"",pendingToolProgress:new Map,wsHandlers:new Map,wsUnknownFrames:0,journalGapCount:0}}function qv(){const{showToast:e}=qo();return{s:Wv(),showToast:e}}function bn(){return`msg_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function ic(e,t){if(e!==null&&typeof e=="object"){const n=e.message;if(typeof n=="string")return n}return t}const ac="scream-offline-prompt-queue",lc="scream-recent-prompts";function Vv(e){const{s:t}=e;let n=[];try{const c=localStorage.getItem(ac);if(c){const d=JSON.parse(c);Array.isArray(d)&&(n=d.filter(f=>typeof f=="string"))}}catch{n=[]}function s(){try{localStorage.setItem(ac,JSON.stringify(n.slice(0,20)))}catch{}}function o(){if(n.length===0)return;const c=n[0],d=`client_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,f=bn();t.sentMessageIds.set(d,{messageId:f,connectionGeneration:t.connectionGeneration,queueText:c}),t.promptGeneration++,t.pendingPromptAccepted=!1,t.promptPending.value=!0,t.messages.value.push({id:f,role:"user",content:c,clientMessageId:d,tools:[],ts:Date.now()}),u(c),e.send({type:"prompt",text:c,clientMessageId:d})}function r(){n.length>0&&n.shift(),s(),o()}function i(c){n.push(c),s()}function a(c){const d=n.indexOf(c);d>=0&&(n.splice(d,1),s())}let l=[];try{const c=localStorage.getItem(lc);if(c){const d=JSON.parse(c);Array.isArray(d)&&(l=d.filter(f=>typeof f=="string"))}}catch{l=[]}function u(c){const d=c.trim();if(d){l=[d,...l.filter(f=>f!==d)].slice(0,8);try{localStorage.setItem(lc,JSON.stringify(l))}catch{}}}return e.flushQueue=o,e.flushQueueNext=r,e.enqueueOfflinePrompt=i,e.removeOfflineQueueItem=a,e.recordRecentPrompt=u,{enqueueOfflinePrompt:i,removeOfflineQueueItem:a,recordRecentPrompt:u,flushQueue:o,flushQueueNext:r}}function br(e,t,n,s){return e===n&&t===s}function Kv(e){return e.currentSessionId===e.targetSessionId&&e.snapshot.sessionId===e.targetSessionId&&e.currentSessionGeneration===e.targetSessionGeneration&&e.currentConnectionGeneration===e.targetConnectionGeneration&&e.currentPromptGeneration===e.targetPromptGeneration&&e.currentLiveGeneration===e.targetLiveGeneration&&(e.currentEpoch===0||e.snapshot.epoch===e.currentEpoch)&&(e.snapshot.epoch!==e.currentEpoch||e.snapshot.seq>=e.currentSeq)}function Zv(e){return{objective:e.objective,completionCriterion:e.completionCriterion,replace:e.replace,budgets:e.budgets}}function Yv(e){return{objective:e.objective,budgets:e.budgets}}function Xv(e,t,n){return e!==0&&n.epoch!==e?"resync":n.seq<=t?"duplicate":t!==0&&n.seq>t+1?"gap":"apply"}function Jv(e,t){return t.type==="goal.updated"?{...e,goal:t.snapshot}:t.type==="todo.updated"?{...e,todos:t.todos}:e}function Qv(e){const t=[],n=new Map;for(const s of e){const o=s.phase??null;let r=n.get(o);r===void 0&&(r=t.length,n.set(o,r),t.push({phase:o,items:[]})),t[r].items.push(s)}return t}const Lo=new Map;function ey(e){Lo.set(e,Date.now())}function ty(e){return Lo.get(e)}function ny(e){const t=Lo.get(e);return t!==void 0&&Lo.delete(e),t}function sy(){Lo.clear()}function Zi(e){const t=e/1e3;return t<10?`${t.toFixed(1)}s`:t<60?`${Math.round(t)}s`:`${Math.floor(t/60)}m${String(Math.round(t%60)).padStart(2,"0")}s`}function oy(e){let t=null;return{schedule:()=>{if(t!==null)return;const r=i=>{if(i<=0){t=null,e();return}t=requestAnimationFrame(()=>r(i-1))};t=requestAnimationFrame(()=>r(2))},flushNow:()=>{t!==null&&(cancelAnimationFrame(t),t=null),e()},dispose:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}}function ry(e){const{s:t}=e;function n(){if(t.streamDisposed)return;const a=r();if(!a){t.pendingAssistantDelta="",t.pendingThinkingDelta="",t.pendingToolProgress.clear();return}if(t.pendingAssistantDelta&&(a.content+=t.pendingAssistantDelta,t.pendingAssistantDelta=""),t.pendingThinkingDelta){const l=a.tools.find(u=>u.name==="thinking");l?l.output=(l.output??"")+t.pendingThinkingDelta:a.tools.push({toolCallId:"thinking",name:"thinking",output:t.pendingThinkingDelta}),t.pendingThinkingDelta=""}if(t.pendingToolProgress.size>0){for(const[l,u]of t.pendingToolProgress){const c=a.tools.find(d=>d.toolCallId===l);c&&(c.progress=u)}t.pendingToolProgress.clear()}}const s=oy(n);function o(a){var u;const l=Jv({goal:t.goal.value,todos:t.todos.value},a);switch(t.goal.value=l.goal,t.todos.value=l.todos,a.type==="goal.updated"&&t.goalAwaitingMutation!==null&&t.goalAwaitingMutation.generation===t.goalMutationGeneration&&(t.goalAwaitingMutation=null,t.snapshotRetryGoalGeneration=null,e.syncGoalRequestPending()),a.type){case"turn.started":{t.pendingPromptAccepted&&(t.promptPending.value=!1,t.pendingPromptAccepted=!1,t.sentMessageIds.clear()),s.flushNow(),t.status.value={...t.status.value,busy:!0},t.turnNumber+=1,t.turnStartAt=Date.now(),t.turnFirstTokenAt=null,t.activeToolMs=0,sy(),t.messages.value.push({id:bn(),role:"assistant",content:"",tools:[],ts:Date.now(),model:t.status.value.model,turnStats:{turn:t.turnNumber,step:0,status:"running",firstTokenMs:null,llmMs:0,toolMs:0,tokens:null,tokensPerSec:null}});break}case"assistant.delta":{t.turnFirstTokenAt===null&&(t.turnFirstTokenAt=Date.now()),t.pendingAssistantDelta+=String(a.delta),s.schedule();break}case"thinking.delta":{t.turnFirstTokenAt===null&&(t.turnFirstTokenAt=Date.now()),t.pendingThinkingDelta+=String(a.delta),s.schedule();break}case"tool.call.started":{const c=r();c&&(c.tools.push({toolCallId:String(a.toolCallId),name:String(a.name),args:a.args}),c.turnStats&&(c.turnStats.step+=1)),ey(String(a.toolCallId));break}case"tool.result":{t.pendingToolProgress.delete(String(a.toolCallId));const c=ny(String(a.toolCallId));c!==void 0&&(t.activeToolMs+=Date.now()-c);const d=r();if(d){const f=d.tools.find(p=>p.toolCallId===a.toolCallId);f&&(f.output=String(a.output),f.isError=!!a.isError,f.progress=void 0,c!==void 0&&(f.durationMs=Date.now()-c))}break}case"tool.progress":{t.pendingToolProgress.set(String(a.toolCallId),String(a.message??a.output)),s.schedule();break}case"turn.ended":{if(s.flushNow(),t.status.value={...t.status.value,busy:!1},a.reason==="failed"){const m=r();m&&(m.isError=!0),t.error.value=ic(a.error,"Turn failed")}const c=r(),d=Date.now()-t.turnStartAt,f=(u=t.status.value.usage)==null?void 0:u.currentTurn,p=f?f.inputOther+f.output+f.inputCacheRead+f.inputCacheCreation:null;c&&c.turnStats&&(c.turnStats.status="done",c.turnStats.llmMs=d,c.turnStats.toolMs=t.activeToolMs,c.turnStats.firstTokenMs=t.turnFirstTokenAt!==null?t.turnFirstTokenAt-t.turnStartAt:null,c.turnStats.tokens=p,c.turnStats.tokensPerSec=p!==null&&d>0?Math.round(p/d*1e3):null),e.fetchSessions(),e.fetchGitStatus();break}case"session.meta.updated":{const c={};a.model!==void 0&&(c.model=a.model),a.contextTokens!==void 0&&(c.contextTokens=a.contextTokens),a.maxContextTokens!==void 0&&(c.maxContextTokens=a.maxContextTokens),a.contextUsage!==void 0&&(c.contextUsage=a.contextUsage),t.status.value={...t.status.value,...c};break}case"agent.status.updated":{const c={};if(a.model!==void 0&&(c.model=a.model),a.thinkingLevel!==void 0&&(c.thinkingLevel=a.thinkingLevel),a.contextTokens!==void 0&&(c.contextTokens=a.contextTokens),a.maxContextTokens!==void 0&&(c.maxContextTokens=a.maxContextTokens),a.contextUsage!==void 0&&(c.contextUsage=a.contextUsage),a.usage!==void 0){c.usage=a.usage;const d=a.usage;if(d!=null&&d.currentTurn){const f=r(),p=d.currentTurn.inputOther+d.currentTurn.output+d.currentTurn.inputCacheRead+d.currentTurn.inputCacheCreation;f!=null&&f.turnStats&&f.turnStats.status==="done"&&f.turnStats.tokens===null&&(f.turnStats.tokens=p,f.turnStats.tokensPerSec=f.turnStats.llmMs?Math.round(p/f.turnStats.llmMs*1e3):null)}}t.status.value={...t.status.value,...c};break}case"error":{t.error.value=ic(a.error,"Unknown error");break}}}function r(){for(let a=t.messages.value.length-1;a>=0;a--)if(t.messages.value[a].role==="assistant")return t.messages.value[a];return null}Jt(t,"event",a=>{const l=Xv(t.epoch,t.seq,a);if(l==="resync"){t.epoch=a.epoch,t.seq=0,t.journalGapCount=0,e.fetchSnapshot();return}if(l!=="duplicate"){if(l==="gap"){t.journalGapCount++;const u=t.journalGapCount>=3;(u?console.error:console.warn)(`[webClient] journal seq 缺口:epoch ${t.epoch} 内从 ${t.seq} 跳到 ${a.seq}(连续第 ${t.journalGapCount} 次${u?",超过阈值,流可能已持续损坏":""}),已触发快照补拉。`,a)}else t.journalGapCount=0;t.seq=a.seq,t.epoch=a.epoch,t.liveGeneration++,l==="gap"&&e.fetchSnapshot(),o(a.payload)}}),Jt(t,"resync_required",()=>{t.seq=0,e.fetchSnapshot()}),e.onEvent=o;function i(){t.streamDisposed=!0,s.dispose()}return{onEvent:o,disposeStreaming:i}}function iy(e){const{s:t,showToast:n}=e;function s(){t.disposed||t.snapshotRetryTimer!==null||(t.snapshotRetryTimer=window.setTimeout(()=>{t.snapshotRetryTimer=null;const i=t.snapshotRetryGoalGeneration;t.snapshotRetryGoalGeneration=null,o(i??void 0)},250))}async function o(i){var p,m;const a=t.sessionId.value;if(!a)return;const l=t.messages.value.length===0?100:void 0,u=t.sessionGeneration,c=t.connectionGeneration,d=t.promptGeneration,f=t.liveGeneration;try{const y=await fetch(`${ze}/sessions/${a}/snapshot${l?`?tail=${l}`:""}`);if(!y.ok){i!==void 0&&((p=t.goalAwaitingMutation)==null?void 0:p.generation)===i&&(t.snapshotRetryGoalGeneration=i,s());return}const b=await y.json();if(!Kv({snapshot:b,targetSessionId:a,currentSessionId:t.sessionId.value,targetSessionGeneration:u,currentSessionGeneration:t.sessionGeneration,targetConnectionGeneration:c,currentConnectionGeneration:t.connectionGeneration,targetPromptGeneration:d,currentPromptGeneration:t.promptGeneration,targetLiveGeneration:f,currentLiveGeneration:t.liveGeneration,currentEpoch:t.epoch,currentSeq:t.seq})){i!==void 0&&(t.snapshotRetryGoalGeneration=i),s();return}r(b,i)}catch{i!==void 0&&((m=t.goalAwaitingMutation)==null?void 0:m.generation)===i&&(t.snapshotRetryGoalGeneration=i,s())}}function r(i,a){var y;t.pendingAssistantDelta="",t.pendingThinkingDelta="",t.pendingToolProgress.clear();const l=t.messages.value.filter(b=>b.local),u=t.sentMessageIds.keys().next().value,c=u?t.sentMessageIds.get(u):void 0,d=c?t.messages.value.find(b=>b.id===c.messageId):void 0,f=!!(u&&i.messages.some(b=>b.clientMessageId===u)),p=!!(c&&!f&&c.connectionGeneration<t.connectionGeneration);p&&d&&(d.isError=!0);const m=d&&!f?[d]:[];t.messages.value=[...i.messages.map(b=>({...b,id:b.id??bn()})),...l,...m];for(let b=t.messages.value.length-1;b>=0;b--){const k=(y=t.messages.value[b])==null?void 0:y.turnStats;if(k&&typeof k.turn=="number"&&k.turn>0){t.turnNumber=k.turn;break}}t.pendingApprovals.value=i.pendingApprovals,t.status.value={...i.status,busy:i.busy},t.olderAvailable.value=!!i.olderAvailable,t.oldestSeq.value=i.oldestSeq,t.goal.value=i.goal,t.todos.value=i.todos,a!==void 0&&t.goalAwaitingMutation!==null&&t.goalAwaitingMutation.generation===a&&t.goalMutationGeneration===a&&(t.goalAwaitingMutation=null,e.syncGoalRequestPending()),(f||p)&&(t.promptPending.value=!1,t.pendingPromptAccepted=!1,t.sentMessageIds.clear(),p&&n("消息未送达,已恢复连接。","error")),t.seq=i.seq,t.epoch=i.epoch,t.workDir.value=i.workDir}return e.fetchSnapshot=o,{fetchSnapshot:o}}function ay(e){const{s:t,showToast:n}=e;function s(c){if(!c)return;if(t.connectionStatus.value==="idle"){n("暂无会话,请先新建会话。","warning");return}if(t.connectionStatus.value!=="connected"){e.enqueueOfflinePrompt(c),n("连接已断开,消息已排队,重连后自动发送。","warning"),e.connect();return}if(t.isBusy.value)return;const d=`client_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,f=bn();t.sentMessageIds.set(d,{messageId:f,connectionGeneration:t.connectionGeneration}),t.promptGeneration++,t.pendingPromptAccepted=!1,t.promptPending.value=!0,t.messages.value.push({id:f,role:"user",content:c,clientMessageId:d,tools:[],ts:Date.now()}),e.recordRecentPrompt(c),e.send({type:"prompt",text:c,clientMessageId:d})}function o(c,d){if(t.connectionStatus.value==="idle"){n("暂无会话,请先新建会话。","warning");return}if(t.connectionStatus.value!=="connected"){n("连接已断开,命令未发送。","error"),e.connect();return}if(t.isBusy.value&&c!=="btw"){n(`会话忙碌中,无法执行 /${c},请稍后再试。`,"warning");return}const f=["compact","plan","auto","yes","fork","title"];let p=null;f.includes(c)&&(p=bn(),t.messages.value.push({id:p,role:"system",content:`正在执行 /${c}${d?` ${d}`:""}...`,tools:[],pending:!0,ts:Date.now(),local:!0})),e.send({type:"command",command:c,...d?{args:d}:{},...p?{pendingMsgId:p}:{}})}function r(){t.messages.value=[],t.pendingApprovals.value=[]}function i(c){t.messages.value.push({id:bn(),role:"system",content:c,tools:[],ts:Date.now(),local:!0})}function a(c,d,f,p){if(t.connectionStatus.value!=="connected"){n("连接已断开,审批结果未发送。","error"),e.connect();return}t.pendingApprovals.value=t.pendingApprovals.value.filter(m=>m.id!==c),e.send({type:"approval_response",id:c,decision:d,...f?{feedback:f}:{},...p?{scope:p}:{}})}function l(){e.send({type:"abort"})}async function u(){var f;const c=t.sessionId.value,d=t.oldestSeq.value;if(!c||d===void 0)return 0;try{const p=await fetch(`${ze}/sessions/${c}/messages?before=${d}&tail=50`);if(!p.ok)return 0;const m=await p.json();if(m.messages.length===0)return 0;const y=m.messages.map(b=>({...b,id:b.id??bn()}));return t.messages.value=[...y,...t.messages.value],t.oldestSeq.value=((f=y[0])==null?void 0:f.seq)??d,t.olderAvailable.value=m.hasMore,y.length}catch{return 0}}return Jt(t,"user_message",c=>{var d;if(t.liveGeneration++,c.clientMessageId&&t.sentMessageIds.has(c.clientMessageId)){t.pendingPromptAccepted=!0,((d=t.sentMessageIds.get(c.clientMessageId))==null?void 0:d.queueText)!==void 0&&e.flushQueueNext();return}t.messages.value.push({id:bn(),role:"user",content:c.text,clientMessageId:c.clientMessageId,tools:[],ts:Date.now()})}),Jt(t,"approval_request",c=>{t.liveGeneration++,t.pendingApprovals.value=[...t.pendingApprovals.value,{id:c.id,toolName:c.toolName,action:c.action,display:c.display}]}),Jt(t,"approval_resolved",c=>{t.liveGeneration++,t.pendingApprovals.value=t.pendingApprovals.value.filter(d=>d.id!==c.id)}),Jt(t,"command_result",c=>{const d=c.pendingMsgId?t.messages.value.findIndex(f=>f.id===c.pendingMsgId):-1;if(d>=0){const f=t.messages.value[d];t.messages.value[d]={...f,content:c.message,isError:!c.ok,pending:!1}}else t.messages.value.push({id:bn(),role:"system",content:c.message,tools:[],isError:!c.ok,ts:Date.now(),local:!0});(c.command==="fork"||c.command==="title")&&e.fetchSessions(),c.ok&&c.command==="compact"&&e.fetchSnapshot()}),Jt(t,"error",c=>{if(t.error.value=c.message,c.clientMessageId){const d=t.sentMessageIds.get(c.clientMessageId);if(d){t.sentMessageIds.delete(c.clientMessageId),t.promptPending.value=!1,t.pendingPromptAccepted=!1;const f=t.messages.value.find(p=>p.id===d.messageId);f&&(f.isError=!0),n(`消息未发送:${c.message}`,"error"),d.queueText!==void 0&&e.removeOfflineQueueItem(d.queueText)}}}),e.appendSystemMessage=i,{sendPrompt:s,sendCommand:o,clearMessages:r,appendSystemMessage:i,abort:l,resolveApproval:a,loadOlderMessages:u}}function ly(e){const{s:t,showToast:n}=e;async function s(){try{const c=await fetch(`${ze}/sessions`);if(!c.ok)return;t.sessions.value=await c.json()}catch{}}async function o(c){const d=t.sessionGeneration,f=t.connectionGeneration;try{return(await fetch(`${ze}/sessions/${c}/activate`,{method:"POST"})).ok&&t.connectionGeneration===f&&br(t.sessionId.value,t.sessionGeneration,c,d)}catch{return!1}}async function r(){try{const c=await fetch(`${ze}/git/status`);if(!c.ok)return;const d=await c.json();t.gitStatus.value=d.isRepo?d:null}catch{}}async function i(c,d){try{const f=await fetch(`${ze}/sessions`,{method:"POST",...c?{headers:{"Content-Type":"application/json"},body:JSON.stringify({workDir:c})}:{}});if(!f.ok){const m=await f.json().catch(()=>null),y=m&&typeof m.message=="string"?m.message:"";n(`新建会话失败:${y||`HTTP ${f.status}`}`,"error");return}const p=await f.json();t.sessions.value=[p,...t.sessions.value],d==null||d(p.sessionId),await a(p.sessionId)}catch(f){n(`新建会话失败:${f instanceof Error?f.message:String(f)}`,"error")}}async function a(c){t.currentSessionId.value===c&&t.connectionStatus.value==="connected"||(t.currentSessionId.value=c,t.sessionId.value=c,t.sessionGeneration++,e.resetGoalRequestState(),t.seq=0,t.epoch=0,t.journalGapCount=0,t.messages.value=[],t.pendingApprovals.value=[],t.status.value={busy:!1},t.goal.value=null,t.todos.value=[],t.sessionPlan.value=null,t.skills.value=[],t.plugins.value=[],t.pluginInfo.value=null,t.mcpServers.value=[],t.mcpStartupMetrics.value=null,t.backgroundTasks.value=[],t.backgroundTaskOutput.value="",t.sessionActive.value=!1,t.promptPending.value=!1,t.pendingPromptAccepted=!1,t.sentMessageIds.clear(),t.reconnectTimer!==null&&(clearTimeout(t.reconnectTimer),t.reconnectTimer=null),t.snapshotRetryTimer!==null&&(clearTimeout(t.snapshotRetryTimer),t.snapshotRetryTimer=null),t.ws&&(t.ws.onclose=null,t.ws.close(),t.ws=null),e.stopHeartbeat(),e.connect())}async function l(c){try{const d=await fetch(`${ze}/sessions/${c}`,{method:"DELETE"});if(!d.ok){n(`删除会话失败(HTTP ${d.status})`,"error");return}if(t.sessions.value=t.sessions.value.filter(f=>f.sessionId!==c),t.currentSessionId.value===c){const f=t.sessions.value[0];f?await a(f.sessionId):(t.sessionGeneration++,e.resetGoalRequestState(),t.sessionId.value=null,t.currentSessionId.value=null,t.sessionActive.value=!1,t.seq=0,t.epoch=0,t.journalGapCount=0,t.messages.value=[],t.pendingApprovals.value=[],t.status.value={busy:!1},t.goal.value=null,t.todos.value=[],t.sessionPlan.value=null,t.skills.value=[],t.plugins.value=[],t.pluginInfo.value=null,t.mcpServers.value=[],t.mcpStartupMetrics.value=null,t.backgroundTasks.value=[],t.backgroundTaskOutput.value="",t.promptPending.value=!1,t.pendingPromptAccepted=!1,t.sentMessageIds.clear(),t.ws&&(t.ws.onclose=null,t.ws.close(),t.ws=null),e.stopHeartbeat(),e.setConnectionStatus("idle"))}}catch(d){n(`删除会话失败:${d instanceof Error?d.message:String(d)}`,"error")}}async function u(c){try{const d=await fetch(`${ze}/sessions/${c}/export`);if(!d.ok){n(`导出会话失败(HTTP ${d.status})`,"error");return}const f=await d.blob(),p=URL.createObjectURL(f),m=document.createElement("a");m.href=p,m.download=`${c}.md`,m.click(),URL.revokeObjectURL(p)}catch(d){n(`导出会话失败:${d instanceof Error?d.message:String(d)}`,"error")}}return e.fetchSessions=s,e.fetchGitStatus=r,e.activateSession=o,{fetchSessions:s,fetchGitStatus:r,createSession:i,switchSession:a,deleteSession:l,exportSession:u}}function uy(e){const{s:t,showToast:n}=e;async function s(){try{const u=await fetch(`${ze}/models`);if(!u.ok){t.modelsError.value=`模型列表加载失败(HTTP ${u.status})`;return}const c=await u.json();t.models.value=c.models,t.modelsError.value=null}catch(u){t.modelsError.value=`模型列表加载失败:${u instanceof Error?u.message:String(u)}`}}async function o(){try{const u=await fetch(`${ze}/like`);if(!u.ok)return;t.like.value=await u.json()}catch{}}async function r(u){try{return(await fetch(`${ze}/like`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)})).ok?(t.like.value=u,!0):!1}catch{return!1}}async function i(u,c,d){const f=t.sessionId.value;if(!f){n("请先打开一个会话","warning");return}const p=t.sessionGeneration,m=t.connectionGeneration,y=++t.sessionMutationGeneration;try{const b=await fetch(`${ze}/sessions/${f}/${u}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),k=await b.json();if(t.sessionId.value!==f||t.sessionGeneration!==p||t.connectionGeneration!==m||t.sessionMutationGeneration!==y)return;if(!b.ok){n(k.message??`请求失败(HTTP ${b.status})`,"error");return}k.status&&(t.status.value={...t.status.value,...k.status}),n(d,"success")}catch(b){if(t.sessionId.value!==f||t.sessionGeneration!==p||t.connectionGeneration!==m||t.sessionMutationGeneration!==y)return;n(`请求失败:${b instanceof Error?b.message:String(b)}`,"error")}}async function a(u){u!==t.status.value.model&&await i("model",{model:u},`已切换模型:${u}`)}async function l(u){u!==t.status.value.thinkingLevel&&await i("thinking",{level:u},`思考强度已切换为 ${u}`)}return Jt(t,"status",u=>{t.liveGeneration++,t.status.value={...t.status.value,...u.status}}),e.fetchModels=s,{fetchModels:s,fetchLike:o,updateLike:r,switchModel:a,switchThinking:l}}function cy(e){const{s:t}=e;function n(){t.goalRequestPending.value=t.goalRequestInFlight||t.goalAwaitingMutation!==null}function s(){t.goalMutationGeneration++,t.goalAwaitingMutation=null,t.goalRequestInFlight=!1,t.snapshotRetryGoalGeneration=null,t.goalRequestPending.value=!1,t.goalRequestError.value=null}async function o(f,p,m,y){const b=t.sessionId.value;if(!b)return t.goalRequestError.value="暂无可操作的会话。",null;if(t.connectionStatus.value!=="connected")return t.goalRequestError.value="连接已断开,请等待重连后再试。",null;if(t.isArchived.value)return t.goalRequestError.value="当前会话已归档,无法修改 Goal。",null;if(t.goalRequestInFlight)return t.goalRequestError.value="正在处理上一个请求,请稍候。",null;t.goalAwaitingMutation!==null&&(t.goalAwaitingMutation=null,n());const k=t.sessionGeneration,w=++t.goalMutationGeneration;t.goalRequestInFlight=!0,n(),t.goalRequestError.value=null;try{const S=await fetch(`${ze}/sessions/${b}/goal${f}`,{method:p,headers:{"Content-Type":"application/json"},body:JSON.stringify(m)}),I=await S.json().catch(()=>({}));return!br(t.sessionId.value,t.sessionGeneration,b,k)||t.goalMutationGeneration!==w?null:S.ok?(y&&(t.goalAwaitingMutation={generation:w},t.snapshotRetryGoalGeneration=w),I):(t.goalRequestError.value=typeof I.message=="string"?I.message:`请求失败(HTTP ${S.status})`,null)}catch(S){return br(t.sessionId.value,t.sessionGeneration,b,k)&&t.goalMutationGeneration===w&&(t.goalRequestError.value=`请求失败:${S instanceof Error?S.message:String(S)}`),null}finally{br(t.sessionId.value,t.sessionGeneration,b,k)&&t.goalMutationGeneration===w&&(t.goalRequestInFlight=!1,n())}}async function r(f){const p=await o("/refine","POST",{description:f},!1);return typeof(p==null?void 0:p.objective)=="string"?p.objective:null}async function i(f){return await o("","POST",Zv(f),!0)===null?!1:(t.goalAwaitingMutation!==null&&e.fetchSnapshot(t.goalAwaitingMutation.generation),!0)}async function a(f){return await o("","PATCH",Yv(f),!0)===null?!1:(t.goalAwaitingMutation!==null&&e.fetchSnapshot(t.goalAwaitingMutation.generation),!0)}async function l(f){return await o(f,"POST",{},!0)===null?!1:(t.goalAwaitingMutation!==null&&e.fetchSnapshot(t.goalAwaitingMutation.generation),!0)}function u(){return l("/pause")}function c(){return l("/resume")}function d(){return l("/cancel")}return e.resetGoalRequestState=s,e.syncGoalRequestPending=n,{refineGoal:r,createGoal:i,updateGoal:a,pauseGoal:u,resumeGoal:c,cancelGoal:d}}function dy(e){const{s:t,showToast:n}=e;async function s(){const y=t.sessionId.value;if(y)try{const b=await fetch(`${ze}/sessions/${y}/status`);if(!b.ok)return;const k=await b.json();t.status.value={...t.status.value,...k}}catch{}}async function o(){const y=t.sessionId.value;if(y)try{const b=await fetch(`${ze}/sessions/${y}/usage`);if(!b.ok)return;const k=await b.json();t.status.value={...t.status.value,usage:k}}catch{}}async function r(){const y=t.sessionId.value;if(y)try{const b=await fetch(`${ze}/sessions/${y}/context`);if(!b.ok)return;const k=await b.json();k.tokenCount!==void 0&&(t.status.value={...t.status.value,contextTokens:k.tokenCount})}catch{}}async function i(){const y=t.sessionId.value;if(y)try{const b=await fetch(`${ze}/sessions/${y}/plan`);if(!b.ok)return;t.sessionPlan.value=await b.json()}catch{}}async function a(){const y=t.sessionId.value;if(!y)return!1;try{return(await fetch(`${ze}/sessions/${y}/plan/clear`,{method:"POST"})).ok?(t.sessionPlan.value=null,!0):!1}catch{return!1}}async function l(y,b){const k=t.sessionId.value;if(!k)return!1;if(t.connectionStatus.value!=="connected")return n("连接已断开,操作未发送。","error"),e.connect(),!1;try{const w=await fetch(`${ze}/sessions/${k}/${y}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b??{})});if(!w.ok){const S=await w.json().catch(()=>({}));return n(S.message??`操作失败(HTTP ${w.status})`,"error"),!1}return!0}catch(w){return n(`操作失败:${w instanceof Error?w.message:String(w)}`,"error"),!1}}async function u(y){const b=t.sessionId.value,k=t.sessionGeneration,w=t.connectionGeneration,S=++t.permissionMutationGeneration,I=t.status.value.permission;return t.status.value={...t.status.value,permission:y},await l("permission",{mode:y})?(await s(),!0):(t.sessionId.value!==b||t.sessionGeneration!==k||t.connectionGeneration!==w||t.permissionMutationGeneration!==S||(t.status.value={...t.status.value,permission:I}),!1)}async function c(y,b){const k=await l("plan",{enabled:y,...b?{strategy:b}:{}});return k&&await s(),k}async function d(y){const b=await l("wolfpack",{enabled:y});return b&&await s(),b}async function f(y,b){const k=await l("rlm",{enabled:y,...b!==void 0?{maxDepth:b}:{}});return k&&await s(),k}async function p(y=1){return l("undo",{count:y})}async function m(y){return l("compact",y?{instruction:y}:{})}return e.postSessionAction=l,{fetchSessionStatus:s,fetchSessionUsage:o,fetchSessionContext:r,fetchSessionPlan:i,clearPlan:a,switchPermission:u,switchPlanMode:c,switchWolfpack:d,switchRlm:f,undoHistory:p,compact:m}}function fy(e){const{s:t}=e;async function n(){const y=t.sessionId.value;if(y)try{const b=await fetch(`${ze}/sessions/${y}/skills`);if(!b.ok){t.skillsError.value=`技能列表加载失败(HTTP ${b.status})`;return}t.skills.value=await b.json(),t.skillsError.value=null}catch(b){t.skillsError.value=`技能列表加载失败:${b instanceof Error?b.message:String(b)}`}}async function s(y,b){return e.postSessionAction(`skills/${encodeURIComponent(y)}/activate`,b?{args:b}:{})}async function o(y){const b=t.sessionId.value;if(!b)return!1;try{return(await fetch(`${ze}/sessions/${b}/skills/${encodeURIComponent(y)}`,{method:"DELETE"})).ok?(t.skills.value=t.skills.value.filter(w=>w.name!==y),!0):!1}catch{return!1}}async function r(){const y=t.sessionId.value;if(y)try{const b=await fetch(`${ze}/sessions/${y}/plugins`);if(!b.ok)return;t.plugins.value=await b.json()}catch{}}async function i(y){const b=t.sessionId.value;if(b)try{const k=await fetch(`${ze}/sessions/${b}/plugins/${encodeURIComponent(y)}`);if(!k.ok)return;t.pluginInfo.value=await k.json()}catch{}}async function a(y){const b=t.sessionId.value;if(!b)return null;try{const k=await fetch(`${ze}/sessions/${b}/plugins/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:y})});if(!k.ok)return null;const w=await k.json();return await r(),w}catch{return null}}async function l(y,b){return e.postSessionAction(`plugins/${encodeURIComponent(y)}/enable`,{enabled:b})}async function u(y,b,k){return e.postSessionAction(`plugins/${encodeURIComponent(y)}/mcp/${encodeURIComponent(b)}/enable`,{enabled:k})}async function c(y){const b=t.sessionId.value;if(!b)return!1;try{return(await fetch(`${ze}/sessions/${b}/plugins/${encodeURIComponent(y)}`,{method:"DELETE"})).ok?(t.plugins.value=t.plugins.value.filter(w=>w.id!==y),!0):!1}catch{return!1}}async function d(){const y=t.sessionId.value;if(!y)return null;try{const b=await fetch(`${ze}/sessions/${y}/plugins/reload`,{method:"POST"});if(!b.ok)return null;const k=await b.json();return await r(),k}catch{return null}}async function f(y){return e.postSessionAction(`plugins/${encodeURIComponent(y)}/activate`)}async function p(y){return e.postSessionAction(`plugins/${encodeURIComponent(y)}/deactivate`)}async function m(y){return e.postSessionAction(`plugins/${encodeURIComponent(y)}/inject`)}return{fetchSkills:n,activateSkill:s,removeSkill:o,fetchPlugins:r,fetchPluginInfo:i,installPlugin:a,setPluginEnabled:l,setPluginMcpServerEnabled:u,removePlugin:c,reloadPlugins:d,activatePlugin:f,deactivatePlugin:p,injectPlugin:m}}function hy(e){const{s:t}=e;async function n(){const d=t.sessionId.value;if(d)try{const f=await fetch(`${ze}/sessions/${d}/mcp`);if(!f.ok)return;t.mcpServers.value=await f.json()}catch{}}async function s(){const d=t.sessionId.value;if(d)try{const f=await fetch(`${ze}/sessions/${d}/mcp/startup-metrics`);if(!f.ok)return;t.mcpStartupMetrics.value=await f.json()}catch{}}async function o(d,f){return e.postSessionAction("mcp/add",{name:d,config:f})}async function r(d){return e.postSessionAction(`mcp/${encodeURIComponent(d)}/reconnect`)}async function i(d){return e.postSessionAction(`mcp/${encodeURIComponent(d)}/stop`)}async function a(d){const f=t.sessionId.value;if(!f)return!1;try{return(await fetch(`${ze}/sessions/${f}/mcp/${encodeURIComponent(d)}`,{method:"DELETE"})).ok?(t.mcpServers.value=t.mcpServers.value.filter(m=>m.name!==d),!0):!1}catch{return!1}}async function l(d,f){const p=t.sessionId.value;if(p)try{const m=new URLSearchParams;d!==void 0&&m.set("activeOnly",String(d)),f!==void 0&&m.set("limit",String(f));const y=m.toString(),b=await fetch(`${ze}/sessions/${p}/tasks${y?`?${y}`:""}`);if(!b.ok)return;t.backgroundTasks.value=await b.json()}catch{}}async function u(d,f){const p=t.sessionId.value;if(p)try{const m=f!==void 0?`?tail=${f}`:"",y=await fetch(`${ze}/sessions/${p}/tasks/${encodeURIComponent(d)}/output${m}`);if(!y.ok)return;const b=await y.json();t.backgroundTaskOutput.value=b.output}catch{}}async function c(d,f){return e.postSessionAction(`tasks/${encodeURIComponent(d)}/stop`,f?{reason:f}:{})}return{fetchMcpServers:n,fetchMcpStartupMetrics:s,addMcpServer:o,reconnectMcpServer:r,stopMcpServer:i,removeMcpServer:a,fetchBackgroundTasks:l,fetchBackgroundTaskOutput:u,stopBackgroundTask:c}}function py(e){const{s:t}=e;async function n(){try{const a=await fetch(`${ze}/config`);if(!a.ok)return;t.config.value=await a.json()}catch{}}async function s(a){try{const l=await fetch(`${ze}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:a})});return l.ok?(t.config.value=await l.json(),!0):!1}catch{return!1}}async function o(a){try{return(await fetch(`${ze}/config/providers/${encodeURIComponent(a)}`,{method:"DELETE"})).ok?(await n(),!0):!1}catch{return!1}}async function r(){try{const a=await fetch(`${ze}/experimental-flags`);if(!a.ok)return;t.experimentalFlags.value=await a.json()}catch{}}async function i(){try{if(!(await fetch(`${ze}/preflight`)).ok)return;t.preflightOk.value=!0}catch{}}return{fetchConfig:n,setConfig:s,removeProvider:o,fetchExperimentalFlags:r,preflight:i}}function gy(e){const{s:t}=e;return function(s){const o=t.wsHandlers.get(s.type);if(o!==void 0){o(s);return}t.wsUnknownFrames++,console.error(`[webClient] 收到未注册的 WS 帧类型 "${s.type}"(第 ${t.wsUnknownFrames} 次),该帧已被丢弃;请在对应域模块用 onWsMessage 注册处理器。`,s)}}function my(e){const{s:t,showToast:n}=e,s=gy(e);function o(){const p=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`;return t.currentSessionId.value?`${p}?sessionId=${encodeURIComponent(t.currentSessionId.value)}`:p}function r(f){t.connectionStatus.value=f}function i(f){var p;((p=t.ws)==null?void 0:p.readyState)===WebSocket.OPEN&&t.ws.send(JSON.stringify(f))}function a(f){l();const p=Number.isFinite(f)&&f>=1e3&&f<=12e4?f:15e3;t.lastPongAt=Date.now(),t.heartbeatTimer=window.setInterval(()=>{var m;if(Date.now()-t.lastPongAt>Hv){(m=t.ws)==null||m.close();return}i({type:"ping"})},p)}function l(){t.heartbeatTimer!==null&&(clearInterval(t.heartbeatTimer),t.heartbeatTimer=null)}function u(){if(t.disposed||t.reconnectTimer!==null)return;if(t.reconnectAttempt>=rc){r("disconnected"),t.error.value=`连接失败:自动重试已达上限(${rc} 次),请手动重试`;return}r("reconnecting"),t.reconnectAttempt++;const f=Math.min(1e3*2**t.reconnectAttempt,3e4);t.reconnectTimer=window.setTimeout(()=>{t.reconnectTimer=null,d()},f)}function c(){if(!t.disposed){if(t.reconnectTimer!==null&&(clearTimeout(t.reconnectTimer),t.reconnectTimer=null),t.ws!==null){try{t.ws.close()}catch{}t.ws=null}t.reconnectAttempt=0,d()}}function d(){if(t.disposed||t.ws&&(t.ws.readyState===WebSocket.CONNECTING||t.ws.readyState===WebSocket.OPEN))return;r("connecting"),t.error.value=null,e.resetGoalRequestState(),t.connectionGeneration++;const f=new WebSocket(o());t.ws=f,f.onclose=p=>{if(t.ws===f&&(t.ws=null,l(),t.connectionStatus.value!=="idle")){if(p.code===1008){t.sessionGeneration++,e.resetGoalRequestState(),t.sessionId.value=null,t.currentSessionId.value=null,t.sessionActive.value=!1,t.goal.value=null,t.todos.value=[],t.messages.value=[],t.error.value=null,t.promptPending.value=!1,t.sentMessageIds.clear(),r("idle"),p.reason!=="unauthorized"&&(n("会话不可用或已被删除","warning"),e.fetchSessions());return}r("disconnected"),u()}},f.onerror=()=>{t.ws===f&&r("reconnecting")},f.onmessage=p=>{if(t.ws!==f)return;t.lastPongAt=Date.now();let m;try{m=JSON.parse(p.data)}catch{return}s(m)}}return Jt(t,"server_hello",f=>{t.sessionId.value=f.sessionId,t.workDir.value=f.workDir,t.currentSessionId.value=f.sessionId,t.sessionActive.value=f.active;const p=t.epoch;t.epoch=f.epoch,a(f.heartbeat_ms),i({type:"client_hello",lastSeq:t.seq,epoch:p}),p!==0&&p!==f.epoch&&(t.seq=0),r("connected"),t.reconnectAttempt=0,e.flushQueue(),f.active?(e.fetchSnapshot(),e.fetchSessions(),e.fetchGitStatus()):e.activateSession(f.sessionId).then(m=>{m&&t.sessionId.value===f.sessionId&&(t.sessionActive.value=!0),e.fetchSnapshot(),e.fetchSessions(),e.fetchGitStatus()})}),Jt(t,"server_empty",()=>{r("idle")}),Jt(t,"pong",()=>{}),e.connect=d,e.send=i,e.stopHeartbeat=l,e.setConnectionStatus=r,{connect:d,send:i,reconnectNow:c,stopHeartbeat:l}}function vy(){const e=qv(),t=e.s;Vv(e);const n=ry(e),s=iy(e),o=ay(e),r=ly(e),i=uy(e),a=cy(e),l=dy(e),u=fy(e),c=hy(e),d=py(e),f=my(e);f.connect(),r.fetchSessions(),i.fetchModels();const p=()=>{f.connect()},m=()=>{!document.hidden&&t.connectionStatus.value!=="connected"&&f.connect()};window.addEventListener("online",p),document.addEventListener("visibilitychange",m),at(()=>{t.disposed=!0,n.disposeStreaming(),window.removeEventListener("online",p),document.removeEventListener("visibilitychange",m),f.stopHeartbeat(),t.reconnectTimer!==null&&(clearTimeout(t.reconnectTimer),t.reconnectTimer=null),t.snapshotRetryTimer!==null&&(clearTimeout(t.snapshotRetryTimer),t.snapshotRetryTimer=null),t.ws&&(t.ws.onclose=null,t.ws.close(),t.ws=null)}),xe(t.skills,b=>nc(b),{immediate:!0});const y={connectionStatus:t.connectionStatus,messages:t.messages,pendingApprovals:t.pendingApprovals,status:t.status,goal:t.goal,todos:t.todos,goalRequestPending:t.goalRequestPending,goalRequestError:t.goalRequestError,error:t.error,sessionId:t.sessionId,workDir:t.workDir,isBusy:t.isBusy,isArchived:t.isArchived,sessions:t.sessions,currentSessionId:t.currentSessionId,gitStatus:t.gitStatus,models:t.models,modelsError:t.modelsError,like:t.like,fetchLike:i.fetchLike,updateLike:i.updateLike,sendPrompt:o.sendPrompt,sendCommand:o.sendCommand,clearMessages:o.clearMessages,appendSystemMessage:o.appendSystemMessage,abort:o.abort,resolveApproval:o.resolveApproval,fetchSessions:r.fetchSessions,fetchGitStatus:r.fetchGitStatus,fetchModels:i.fetchModels,reconnectNow:f.reconnectNow,olderAvailable:t.olderAvailable,oldestSeq:t.oldestSeq,loadOlderMessages:o.loadOlderMessages,switchModel:i.switchModel,switchThinking:i.switchThinking,refineGoal:a.refineGoal,createGoal:a.createGoal,updateGoal:a.updateGoal,pauseGoal:a.pauseGoal,resumeGoal:a.resumeGoal,cancelGoal:a.cancelGoal,createSession:r.createSession,switchSession:r.switchSession,deleteSession:r.deleteSession,exportSession:r.exportSession,fetchSnapshot:s.fetchSnapshot,fetchSessionStatus:l.fetchSessionStatus,fetchSessionUsage:l.fetchSessionUsage,fetchSessionContext:l.fetchSessionContext,fetchSessionPlan:l.fetchSessionPlan,sessionPlan:t.sessionPlan,clearPlan:l.clearPlan,switchPermission:l.switchPermission,switchPlanMode:l.switchPlanMode,switchWolfpack:l.switchWolfpack,switchRlm:l.switchRlm,undoHistory:l.undoHistory,compact:l.compact,skills:t.skills,skillsError:t.skillsError,fetchSkills:u.fetchSkills,activateSkill:u.activateSkill,removeSkill:u.removeSkill,plugins:t.plugins,pluginInfo:t.pluginInfo,fetchPlugins:u.fetchPlugins,fetchPluginInfo:u.fetchPluginInfo,installPlugin:u.installPlugin,setPluginEnabled:u.setPluginEnabled,setPluginMcpServerEnabled:u.setPluginMcpServerEnabled,removePlugin:u.removePlugin,reloadPlugins:u.reloadPlugins,activatePlugin:u.activatePlugin,deactivatePlugin:u.deactivatePlugin,injectPlugin:u.injectPlugin,mcpServers:t.mcpServers,mcpStartupMetrics:t.mcpStartupMetrics,fetchMcpServers:c.fetchMcpServers,fetchMcpStartupMetrics:c.fetchMcpStartupMetrics,addMcpServer:c.addMcpServer,reconnectMcpServer:c.reconnectMcpServer,stopMcpServer:c.stopMcpServer,removeMcpServer:c.removeMcpServer,backgroundTasks:t.backgroundTasks,backgroundTaskOutput:t.backgroundTaskOutput,fetchBackgroundTasks:c.fetchBackgroundTasks,fetchBackgroundTaskOutput:c.fetchBackgroundTaskOutput,stopBackgroundTask:c.stopBackgroundTask,config:t.config,fetchConfig:d.fetchConfig,setConfig:d.setConfig,removeProvider:d.removeProvider,experimentalFlags:t.experimentalFlags,fetchExperimentalFlags:d.fetchExperimentalFlags,preflightOk:t.preflightOk,preflight:d.preflight};return Bv(y),at(()=>{Fv(y),nc([])}),y}const yy=["compact","auto","yes","bot","plan","fork","title","btw"];function Qf(e){const{showToast:t}=qo();async function n(o,r){var l;await((l=e.ensureSession)==null?void 0:l.call(e));const i=e.onSkill??(async(u,c)=>{const d=Xf();return d?await d.activateSkill(u,c):!1});let a=!1;try{a=await i(o,r)}catch(u){a=!1,t(`技能激活失败:${u instanceof Error?u.message:String(u)}`,"error");return}a?t(`技能已激活:/${o}`,"success"):t(`技能激活失败:/${o}`,"error")}async function s(o,r){var i,a,l;yy.includes(o)?(await((i=e.ensureSession)==null?void 0:i.call(e)),e.sendCommand(o,r)):o==="clear"?e.clearMessages():o==="new"?e.onNew():o==="help"?e.appendSystemMessage(Gv()):o==="model"?(a=e.openModelPicker)!=null&&a.call(e)||e.appendSystemMessage(`当前模型:${((l=e.currentModel)==null?void 0:l.call(e))??"unknown"}`):o==="status"||o==="usage"?e.showInfo?e.showInfo(o):e.appendSystemMessage("请在对话页查看会话详情"):Nv(o)?await n(o,r):t(`未知命令:/${o}`,"error")}return{onCommand:s}}const by=640,ky=1024,Ml=768,uc=264,Hr=420,wy=288,cc=56,Na=300,eh=.7,Sy=320,th=400;function os(e,t,n){const s=Number.isFinite(e)?e:t,o=Math.max(t,n);return Math.round(Math.max(t,Math.min(o,s)))}function _y(e){return os(e*.45,Na,Math.round(e*eh))}function $y(e){const{viewportWidth:t,rightPanelOpen:n,rightPanelWidth:s}=e;if(t<=by)return Hr;const o=t<Ml,r=o?Sy:th,i=!o&&n?s:0;return Math.min(Hr,t-r-i)}function Cy(e){const{viewportWidth:t,sidebarOpen:n,sidebarWidth:s}=e,o=Math.round(t*eh);if(t<Ml)return o;const r=n?s:0;return Math.min(o,t-th-r)}function Wr(e){try{return localStorage.getItem(e)??void 0}catch{return}}function qr(e,t){try{localStorage.setItem(e,t)}catch{}}function xy(e){try{const t=localStorage.getItem(e);return t===null?void 0:JSON.parse(t)}catch{return}}function Ty(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function dc(e){const{storageKey:t,minWidth:n,side:s}=e,o=S=>typeof S=="function"?S():S,r=()=>o(e.maxWidth);function i(){var I;const S=xy(t);return typeof S=="number"&&Number.isFinite(S)&&S>=n&&(((I=e.acceptStoredWidth)==null?void 0:I.call(e,S))??!0)?Math.round(S):o(e.defaultWidth)}const a=M(i()),l=M(!1);let u=null;function c(){Ty(t,a.value)}function d(S){return s==="left"?S:window.innerWidth-S}function f(S){if(!(e.canDrag&&!e.canDrag())){S.preventDefault(),l.value=!0,u=S.pointerId;try{S.currentTarget.setPointerCapture(S.pointerId)}catch{}}}function p(S){!l.value||S.pointerId!==u||(a.value=os(d(S.clientX),n,r()))}function m(S){!l.value||S.pointerId!==u||y()}function y(){l.value=!1,u=null,c()}function b(){a.value=os(o(e.defaultWidth),n,r()),c()}function k(S){const I=S.shiftKey?32:12,q=s==="left"?1:-1;if(S.key==="ArrowLeft")S.preventDefault(),a.value=os(a.value-q*I,n,r());else if(S.key==="ArrowRight")S.preventDefault(),a.value=os(a.value+q*I,n,r());else if(S.key==="Home")S.preventDefault(),a.value=n;else if(S.key==="End")S.preventDefault(),a.value=os(r(),n,r());else if(S.key==="Enter")S.preventDefault(),b();else return;c()}const w=P(()=>os(a.value,n,r()));return{width:a,effectiveWidth:w,resizing:l,onPointerDown:f,onPointerMove:p,onPointerUp:m,onKeydown:k,reset:b,release:y}}const Rl=new Map;function ks(e){return Rl.set(e.kind,e),e}function nh(e){const t=Rl.get(e);if(!t)throw new Error(`unregistered dock tab kind: ${e}`);return t}function Iy(e){return typeof e=="string"&&Rl.has(e)}ks({kind:"file",label:"文件",icon:"file",singleton:!1});ks({kind:"detail",label:"会话详情",icon:"layers",singleton:!0});ks({kind:"run",label:"运行状态",icon:"activity",singleton:!0});ks({kind:"git",label:"Git",icon:"git-branch",singleton:!0});ks({kind:"todo",label:"Todo",icon:"clipboard",singleton:!0});ks({kind:"goal",label:"目标",icon:"target",singleton:!0});ks({kind:"like",label:"偏好",icon:"user",singleton:!0});function sh(e){return`dock:${e}`}function Ey(e,t){return(e==null?void 0:e.displayMode)??t??"source"}function Ay(e,t){const n=e.find(r=>r.id===t.tabId);if(!n)return[...e,{id:t.tabId,kind:"file",label:t.fileName,filePath:t.filePath,sourceSessionId:t.sourceSessionId,initialDisplayMode:t.modeHint,viewerState:t.modeHint?{displayMode:t.modeHint,wrapLines:!1,scrollTop:0,scrollLeft:0}:void 0,viewerRevision:0}];if(n.kind!=="file")return e;const s=!!(t.sourceSessionId&&n.sourceSessionId!==t.sourceSessionId);return!s&&!t.modeHint?e:e.map(r=>{var a;if(r.id!==t.tabId||r.kind!=="file")return r;const i={...r};return s&&(i.sourceSessionId=t.sourceSessionId),t.modeHint?(i.initialDisplayMode=t.modeHint,i.viewerState={displayMode:t.modeHint,wrapLines:((a=r.viewerState)==null?void 0:a.wrapLines)??!1,scrollTop:0,scrollLeft:0},i.viewerRevision=(r.viewerRevision??0)+1):s&&(i.viewerRevision=(r.viewerRevision??0)+1),i})}function My(e,t){const n=sh(t);return e.some(s=>s.id===n)?e:[...e,{id:n,kind:t,label:nh(t).label}]}function Ry(e,t,n,s){const o=e.findIndex(a=>a.id===t&&a.kind==="file");if(o===-1)return e;const r=e[o];if((r.viewerRevision??0)!==n)return e;const i=[...e];return i[o]={...r,viewerState:s},i}const oh="scream-file-tabs";function Py(){try{const e=localStorage.getItem(oh);return e?JSON.parse(e):{}}catch{return{}}}function Vo(e){try{localStorage.setItem(oh,JSON.stringify(e))}catch{}}function Ly(e){return typeof e.id!="string"||typeof e.label!="string"?null:e.kind===void 0?typeof e.filePath=="string"?{...e,kind:"file"}:null:Iy(e.kind)?e.kind==="file"?typeof e.filePath!="string"?null:e:{id:e.id,kind:e.kind,label:e.label}:null}const Do=Py(),Yi=(Array.isArray(Do.tabs)?Do.tabs:[]).map(e=>Ly(e)).filter(e=>e!==null),fc=typeof Do.activeTabId=="string"?Do.activeTabId:null;var Td;const Ce=Wn({tabs:Yi,activeTabId:Yi.some(e=>e.id===fc)?fc:((Td=Yi.at(-1))==null?void 0:Td.id)??null,panelOpen:Do.panelOpen===!0});function Dy(){var e;if(Ce.tabs.length===0){Ce.activeTabId=null;return}Ce.tabs.some(t=>t.id===Ce.activeTabId)||(Ce.activeTabId=((e=Ce.tabs.at(-1))==null?void 0:e.id)??null)}function vs(e,t={}){const n=e.split("/").pop()||e,s=e;return Ce.tabs=Ay(Ce.tabs,{fileName:t.label??n,filePath:e,modeHint:t.modeHint,sourceSessionId:t.sessionId??null,tabId:s}),Ce.activeTabId=s,Ce.panelOpen=!0,Vo(Ce),s}function rh(e){const t=sh(e);return Ce.tabs=My(Ce.tabs,e),Ce.activeTabId=t,Ce.panelOpen=!0,Vo(Ce),t}function Oy(e){Ce.tabs.some(t=>t.id===e)&&(Ce.activeTabId=e,Vo(Ce))}function hc(e){const t=Ce.tabs.findIndex(n=>n.id===e);if(t!==-1){if(Ce.tabs=Ce.tabs.filter(n=>n.id!==e),Ce.activeTabId===e){const n=Ce.tabs[t]??Ce.tabs[t-1]??null;Ce.activeTabId=n?n.id:null}Ce.tabs.length===0&&(Ce.panelOpen=!1,Ce.activeTabId=null),Vo(Ce)}}function Pl(e){Ce.panelOpen=e,e&&Dy(),Vo(Ce)}function Ny(){Pl(!Ce.panelOpen)}const ih=()=>Ce.tabs.find(e=>e.id===Ce.activeTabId),Gy=()=>{const e=ih();return e&&e.kind==="file"?e:void 0},Ci=M(!1);let Vr=0;function By(){Vr++}function Fy(){Vr=Math.max(0,Vr-1)}function jy(){return Vr>0}function ah(){return jy()?(Ci.value=!0,!0):!1}function Uy(){Ci.value=!0}function Kr(){Ci.value=!1}function lh(){return{open:Ci,openSettingsModal:Uy,closeSettingsModal:Kr,tryOpenSettingsModal:ah}}const uh="scream-workspace-preference",xi=M(Wr(uh)||null),Ll=M(null);let lo=null;function zy(e){xi.value=e,qr(uh,e??"")}async function Hy(){return lo||(lo=(async()=>{try{const e=await fetch(`${ze}/workdir`);if(!e.ok)return;const t=await e.json();typeof t.workDir=="string"&&t.workDir&&(Ll.value=t.workDir)}catch{}finally{lo=null}})(),lo)}const Wy=P(()=>xi.value??Ll.value??""),qy=P(()=>!!xi.value);function Dl(){return{preferredWorkDir:xi,serverWorkDir:Ll,displayWorkDir:Wy,hasPreference:qy,setPreferredWorkDir:zy,fetchServerWorkDir:Hy}}function Ga(e){const t=e.replace(/[\\/]+$/,"");return t.split(/[\\/]/).filter(Boolean).at(-1)??t??e}const Vy=["type","disabled"],Ky=Le({__name:"Button",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean},type:{default:"button"}},setup(e){return(t,n)=>(g(),v("button",{class:fe(["ui-btn",[`ui-btn--${e.variant}`,`ui-btn--${e.size}`]]),type:e.type,disabled:e.disabled},[So(t.$slots,"default",{},void 0)],10,Vy))}}),De=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},Wt=De(Ky,[["__scopeId","data-v-f6df10d1"]]),Zy={key:0,class:"approval-card"},Yy={class:"approval-header"},Xy={class:"approval-title"},Jy={class:"tool-name"},Qy={class:"action-summary"},eb={key:0,class:"approval-count"},tb={class:"approval-action"},nb={key:0,class:"feedback-area"},sb={class:"approval-buttons"},ob={key:0,class:"busy-indicator","aria-label":"处理中"},rb=Le({__name:"ApprovalCard",props:{approvals:{}},emits:["resolve"],setup(e,{emit:t}){const n=e,s=t,o=M(!1),r=M(!1),i=M(""),a=M(new Set),l=P(()=>n.approvals[0]);xe(()=>n.approvals.map(m=>m.id).join(","),()=>{r.value=!1,i.value="";const m=new Set(n.approvals.map(y=>y.id));a.value=new Set([...a.value].filter(y=>m.has(y)))});function u(m){return typeof m.display=="string"?m.display:m.display&&typeof m.display=="object"&&"description"in m.display?String(m.display.description??""):m.action??"执行该操作"}function c(m){return a.value.has(m)}function d(m,y,b){const k=l.value;!k||c(k.id)||(a.value=new Set([...a.value,k.id]),s("resolve",k.id,m,y,b))}function f(){const m=i.value.trim();m&&d("rejected",m)}function p(m){if(!l.value||o.value)return;const b=m.target;if(b&&(b.tagName==="TEXTAREA"||b.tagName==="INPUT")){r.value&&m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),f());return}switch(m.key){case"1":m.preventDefault(),d("approved",void 0,"once");break;case"2":m.preventDefault(),d("approved",void 0,"session");break;case"3":m.preventDefault(),d("rejected");break;case"4":m.preventDefault(),r.value=!r.value;break}}return rt(()=>window.addEventListener("keydown",p)),at(()=>window.removeEventListener("keydown",p)),(m,y)=>e.approvals.length?(g(),v("div",Zy,[o.value?(g(),v("button",{key:0,class:"approval-minibar",onClick:y[0]||(y[0]=b=>o.value=!1)}," ⚠ "+C(e.approvals.length)+" 个待审批请求 — 点击展开 ",1)):l.value?(g(),v(X,{key:1},[h("div",Yy,[y[7]||(y[7]=h("span",{class:"approval-icon"},"⚠",-1)),h("span",Xy,[h("span",Jy,C(l.value.toolName),1),h("span",Qy,C(u(l.value)),1)]),e.approvals.length>1?(g(),v("span",eb,"+"+C(e.approvals.length-1),1)):N("",!0),h("button",{class:"icon-btn",title:"最小化","aria-label":"最小化",onClick:y[1]||(y[1]=b=>o.value=!0)},"—")]),h("pre",tb,C(u(l.value)),1),r.value?(g(),v("div",nb,[et(h("textarea",{"onUpdate:modelValue":y[2]||(y[2]=b=>i.value=b),class:"feedback-input",rows:"2",name:"approval-feedback","aria-label":"拒绝反馈",placeholder:"输入反馈,Enter 提交(将作为拒绝原因反馈给 Agent)"},null,512),[[ut,i.value]])])):N("",!0),h("div",sb,[K(Wt,{variant:"primary",disabled:c(l.value.id),onClick:y[3]||(y[3]=b=>d("approved",void 0,"once"))},{default:it(()=>[...y[8]||(y[8]=[h("kbd",null,"1",-1),Pe(" 批准 ",-1)])]),_:1},8,["disabled"]),K(Wt,{variant:"secondary",disabled:c(l.value.id),onClick:y[4]||(y[4]=b=>d("approved",void 0,"session"))},{default:it(()=>[...y[9]||(y[9]=[h("kbd",null,"2",-1),Pe(" 会话批准 ",-1)])]),_:1},8,["disabled"]),K(Wt,{variant:"danger",disabled:c(l.value.id),onClick:y[5]||(y[5]=b=>d("rejected"))},{default:it(()=>[...y[10]||(y[10]=[h("kbd",null,"3",-1),Pe(" 拒绝 ",-1)])]),_:1},8,["disabled"]),K(Wt,{variant:"secondary",class:fe({"feedback-active":r.value}),disabled:c(l.value.id),onClick:y[6]||(y[6]=b=>r.value=!r.value)},{default:it(()=>[...y[11]||(y[11]=[h("kbd",null,"4",-1),Pe(" 反馈 ",-1)])]),_:1},8,["class","disabled"]),c(l.value.id)?(g(),v("span",ob,[...y[12]||(y[12]=[h("span",{class:"spinner"},null,-1),Pe(" 处理中… ",-1)])])):N("",!0)])],64)):N("",!0)])):N("",!0)}}),ib=De(rb,[["__scopeId","data-v-137fa416"]]);function ab(e){const t=/(?:^|\s)@"([^"\n]*)$/.exec(e);if(t)return{start:e.length-(t[1].length+2),query:t[1],quoted:!0};const n=/(?:^|\s)@([^\s"]*)$/.exec(e);return n?{start:e.length-(n[1].length+1),query:n[1],quoted:!1}:null}function pc(e){let t=0;for(let n=0;n<e.length;n++)e[n]==="/"&&t++;return t}function gc(e,t){if(!e)return!0;let n=0;for(let s=0;s<t.length&&n<e.length;s++)t[s]===e[n]&&n++;return n===e.length}function lb(e,t){const n=e.path.toLowerCase();let s=0;if(t.includes("/"))n===t?s=100:n.startsWith(t)?s=80:n.includes(t)?s=50:gc(t,n)&&(s=10);else{const o=n.lastIndexOf("/"),r=o===-1?n:n.slice(o+1);r===t?s=100:r.startsWith(t)?s=80:r.includes(t)?s=50:n.includes(t)?s=30:gc(t,n)&&(s=10)}return e.isDir&&s>0&&(s+=10),s}const ub=20;function ch(e,t,n=ub){const s=t.toLowerCase();if(!s)return e.slice(0,n);const o=[];for(const r of e){const i=lb(r,s);i>0&&o.push({entry:r,score:i})}return o.sort((r,i)=>i.score-r.score||pc(r.entry.path)-pc(i.entry.path)||r.entry.path.localeCompare(i.entry.path)),o.slice(0,n).map(r=>r.entry)}function cb(e,t){const n=t?`${e}/`:e,s=n.includes(" ");if(t){const r=s?`@"${n}"`:`@${n}`;return{text:r,cursorOffset:s?r.length-1:r.length}}const o=s?`@"${n}" `:`@${n} `;return{text:o,cursorOffset:o.length}}const db="/api/v1/files",fb=3e4,Ba=new Map,kr=new Map;async function Ol(e){const t=Ba.get(e);if(t&&Date.now()-t.at<fb)return t.entries;const n=kr.get(e);if(n)return n;const s=(async()=>{try{const o=await fetch(`${db}/list?path=${encodeURIComponent(e)}`);if(!o.ok)return null;const r=await o.json();return r.entries&&Ba.set(e,{entries:r.entries,at:Date.now()}),r.entries??null}catch{return null}finally{kr.delete(e)}})();return kr.set(e,s),s}function hb(e){Ba.delete(e),kr.delete(e)}function pb(e,t){const n=e.replace(/\/+$/,""),s=n.split("/").filter(Boolean),o=[...s];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){if(o.length<=s.length)return null;o.pop();continue}o.push(i)}const r=`/${o.join("/")}`;return r===n||r.startsWith(`${n}/`)?r:null}function gb(e,t,n){const s=M(null),o=M([]),r=M(!1),i=M(!1),a=M(0),l=M(!1),u=M(null),c=M("");let d=null;function f(){d||(d=(async()=>{var L;try{const A=await fetch("/api/v1/files/root"),W=A.ok?await A.json():{};c.value=((L=W.roots)==null?void 0:L[0])??""}catch{c.value=""}S()})())}const p=P(()=>{const L=u.value;if(!L)return[];const A=L.query.lastIndexOf("/"),W=L.query.slice(A+1);return ch(o.value,W)}),m=P(()=>u.value!==null&&!l.value&&(r.value||p.value.length>0));function y(L){const A=L.lastIndexOf("/");return A===-1?{dirRel:"",tail:L}:{dirRel:L.slice(0,A),tail:L.slice(A+1)}}let b=!1,k=0;async function w(L,A){const W=++k;r.value=!0;try{const F=await Ol(L);if(F===null)throw new Error("listing failed");if(W!==k)return;const O=A?`${A.replace(/\/+$/,"")}/`:"";o.value=F.map(ee=>({path:`${O}${ee.name}`,isDir:ee.type==="dir"})),i.value=!1}catch{if(W!==k)return;o.value=[],i.value=!0,s.value=null}finally{W===k&&(r.value=!1)}}function S(){var E;if(b)return;const L=t.value;if(L&&L.value!==e.value){u.value=null;return}let A=(E=n.value)==null?void 0:E.trim();if(A||(f(),A=c.value),!L||!A){u.value=null;return}const W=L.selectionStart??L.value.length,F=ab(L.value.slice(0,W));if(!F){u.value=null,l.value=!1;return}const O=u.value;(!O||O.start!==F.start||O.query!==F.query)&&(l.value=!1),u.value=F,a.value=0;const{dirRel:ee}=y(F.query),x=pb(A,ee);if(x===null){s.value=null,o.value=[],i.value=!0;return}s.value!==x&&(s.value=x,w(x,ee))}function I(L){const A=p.value.length;A>0&&(a.value=(a.value+L+A)%A)}function q(L){const A=u.value,W=L??p.value[a.value];if(!A||!W)return!1;const F=t.value;if(!F)return!1;const O=F.selectionStart??F.value.length,ee=cb(W.path,W.isDir),x=e.value.slice(0,A.start),E=e.value.slice(O);e.value=x+ee.text+E,b=!0;const z=()=>{const oe=A.start+ee.cursorOffset;F.focus(),F.setSelectionRange(oe,oe),b=!1,S()};return typeof requestAnimationFrame=="function"?requestAnimationFrame(z):Promise.resolve().then(z),!0}function B(){l.value=!0}function R(){u.value=null,l.value=!1,a.value=0}return{visible:m,suggestions:p,index:a,dirLoading:r,dirMissing:i,refresh:S,move:I,confirm:q,dismiss:B,reset:R}}const dh=50;function mb(e,t=dh){const n=new Set,s=[];for(let o=e.length-1;o>=0&&s.length<t;o-=1){const r=e[o];if(!r||r.role!=="user"||r.local)continue;const i=(r.content??"").trim();!i||n.has(i)||(n.add(i),s.push(i))}return s}function vb(e,t,n=dh){const s=new Set,o=[],r=i=>{const a=i.trim();!a||s.has(a)||(s.add(a),o.push(a))};for(const i of t)r(i);for(let i=e.length-1;i>=0;i-=1){const a=e[i];a!==void 0&&r(a)}return o.slice(0,n).toReversed()}function Fa(e,t){return[{title:t,entries:e}]}function yb(){if(typeof navigator>"u")return"Ctrl";const e=`${navigator.platform??""} ${navigator.userAgent??""}`;return/Mac|iPhone|iPad|iPod/.test(e)?"⌘":"Ctrl"}const wr=yb(),bb=["width","height"],kb={key:0,d:"M4 7h16M4 12h16M4 17h16"},wb={key:1,d:"M12 5v14M5 12h14"},Sb={key:5,d:"M4 6h16M7 12h10M10 18h4"},_b={key:6,d:"M12 3v12m0 0 4-4m-4 4-4-4M5 20h14"},$b={key:7,d:"M4 7h16M9 7V4h6v3m3 0-1 13H7L6 7m4 4v5m4-5v5"},Cb={key:8,d:"M3 12h4l2-7 4 14 2-7h6"},xb={key:10,d:"m15 18-6-6 6-6"},Tb={key:11,d:"m9 18 6-6-6-6"},Ib={key:12,d:"m6 9 6 6 6-6"},Eb={key:16,d:"M20 15.5A8.5 8.5 0 0 1 8.5 4 8.5 8.5 0 1 0 20 15.5Z"},Ab={key:18,d:"M5 9a11 11 0 0 1 14 0M8.5 12.5a6 6 0 0 1 7 0M12 17h.01"},Mb={key:19,d:"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L8 18l-4 1 1-4Z"},Rb={key:20,d:"M12 16V4m0 0-4 4m4-4 4 4M5 20h14"},Pb={key:21,d:"m15 4 5 5M17.5 6.5 10 14m-2-2 4 4-3 4H3l1-6Z"},Lb={key:22,d:"M9 6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3Z"},Db={key:24,d:"m22 2-7 20-4-9-9-4ZM22 2 11 13"},Ob={key:25,x:"6",y:"6",width:"12",height:"12",rx:"2"},Nb={key:26,d:"m8 3 4 4 4-4M8 21l4-4 4 4M12 7v10"},Gb={key:27,d:"M9.5 4.5A3 3 0 0 0 5 7a3 3 0 0 0 .5 5.5A3 3 0 0 0 9 17v2a2 2 0 0 0 4 0V5a2.5 2.5 0 0 0-3.5-.5ZM13 6a3 3 0 0 1 5 2 3 3 0 0 1 .5 5.5A3 3 0 0 1 15 18"},Bb={key:30,d:"M21 12a8 8 0 0 1-9 8 9 9 0 0 1-4-.9L3 21l1.7-4A9 9 0 1 1 21 12Z"},Fb={key:31,d:"M20 13 13 20l-9-9V4h7ZM8.5 8.5h.01"},jb={key:32,d:"m12 3 1.3 3.7L17 8l-3.7 1.3L12 13l-1.3-3.7L7 8l3.7-1.3ZM5 15l.8 2.2L8 18l-2.2.8L5 21l-.8-2.2L2 18l2.2-.8ZM19 14l.7 1.8 1.8.7-1.8.7L19 19l-.7-1.8-1.8-.7 1.8-.7Z"},Ub={key:34,d:"M3 6h7l2 2h9v11H3Z"},zb={key:35,d:"m5 12 4 4L19 6"},Hb={key:39,d:"M21 12a9 9 0 1 1-2.6-6.4M21 3v6h-6"},Wb={key:46,d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-3-3Z"},qb={key:47,d:"M12 19V5m0 0-6 6m6-6 6 6"},Vb={key:48,d:"M18 6 6 18M6 6l12 12"},Kb={key:51,d:"M9 4H4v5M15 4h5v5M9 20H4v-5M15 20h5v-5"},Zb={key:52,d:"M4 9h5V4M20 9h-5V4M4 15h5v5M20 15h-5v5"},Yb={key:56,d:"M4 20V10M10 20V4M16 20v-7M21 20H3"},Xb=Le({__name:"SvgIcon",props:{name:{},size:{default:20}},setup(e){return(t,n)=>(g(),v("svg",{class:"svg-icon",width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.name==="menu"?(g(),v("path",kb)):e.name==="plus"?(g(),v("path",wb)):e.name==="panel-left"?(g(),v(X,{key:2},[n[0]||(n[0]=h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"},null,-1)),n[1]||(n[1]=h("path",{d:"M9 4v16"},null,-1))],64)):e.name==="panel-right"?(g(),v(X,{key:3},[n[2]||(n[2]=h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"},null,-1)),n[3]||(n[3]=h("path",{d:"M15 4v16"},null,-1))],64)):e.name==="search"?(g(),v(X,{key:4},[n[4]||(n[4]=h("circle",{cx:"11",cy:"11",r:"7"},null,-1)),n[5]||(n[5]=h("path",{d:"m20 20-4-4"},null,-1))],64)):e.name==="filter"?(g(),v("path",Sb)):e.name==="download"?(g(),v("path",_b)):e.name==="trash"?(g(),v("path",$b)):e.name==="activity"?(g(),v("path",Cb)):e.name==="help"?(g(),v(X,{key:9},[n[6]||(n[6]=h("circle",{cx:"12",cy:"12",r:"9"},null,-1)),n[7]||(n[7]=h("path",{d:"M9.7 9a2.5 2.5 0 1 1 3.5 2.3c-.8.4-1.2 1-1.2 1.7M12 17h.01"},null,-1))],64)):e.name==="chevron-left"?(g(),v("path",xb)):e.name==="chevron-right"?(g(),v("path",Tb)):e.name==="chevron-down"?(g(),v("path",Ib)):e.name==="bot"?(g(),v(X,{key:13},[n[8]||(n[8]=h("rect",{x:"4",y:"7",width:"16",height:"12",rx:"3"},null,-1)),n[9]||(n[9]=h("path",{d:"M12 3v4M8 12h.01M16 12h.01M9 16h6"},null,-1))],64)):e.name==="git-branch"?(g(),v(X,{key:14},[n[10]||(n[10]=h("circle",{cx:"6",cy:"5",r:"2"},null,-1)),n[11]||(n[11]=h("circle",{cx:"18",cy:"7",r:"2"},null,-1)),n[12]||(n[12]=h("circle",{cx:"6",cy:"19",r:"2"},null,-1)),n[13]||(n[13]=h("path",{d:"M6 7v10M8 10c5 0 3-3 8-3"},null,-1))],64)):e.name==="sun"?(g(),v(X,{key:15},[n[14]||(n[14]=h("circle",{cx:"12",cy:"12",r:"4"},null,-1)),n[15]||(n[15]=h("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.42 1.42m11.3 11.3 1.42 1.42M2 12h2m16 0h2M4.93 19.07l1.42-1.42m11.3-11.3 1.42-1.42"},null,-1))],64)):e.name==="moon"?(g(),v("path",Eb)):e.name==="monitor"?(g(),v(X,{key:17},[n[16]||(n[16]=h("rect",{x:"3",y:"4",width:"18",height:"13",rx:"2"},null,-1)),n[17]||(n[17]=h("path",{d:"M8 21h8M12 17v4"},null,-1))],64)):e.name==="wifi"?(g(),v("path",Ab)):e.name==="edit"?(g(),v("path",Mb)):e.name==="upload"?(g(),v("path",Rb)):e.name==="broom"?(g(),v("path",Pb)):e.name==="command"?(g(),v("path",Lb)):e.name==="at"?(g(),v(X,{key:23},[n[18]||(n[18]=h("circle",{cx:"12",cy:"12",r:"4"},null,-1)),n[19]||(n[19]=h("path",{d:"M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-3.5 7"},null,-1))],64)):e.name==="send"?(g(),v("path",Db)):e.name==="stop"?(g(),v("rect",Ob)):e.name==="compact"?(g(),v("path",Nb)):e.name==="brain"?(g(),v("path",Gb)):e.name==="clipboard"?(g(),v(X,{key:28},[n[20]||(n[20]=h("rect",{x:"5",y:"4",width:"14",height:"17",rx:"2"},null,-1)),n[21]||(n[21]=h("path",{d:"M9 4V2h6v2M9 10h6M9 14h6"},null,-1))],64)):e.name==="fork"?(g(),v(X,{key:29},[n[22]||(n[22]=h("circle",{cx:"6",cy:"4",r:"2"},null,-1)),n[23]||(n[23]=h("circle",{cx:"18",cy:"6",r:"2"},null,-1)),n[24]||(n[24]=h("circle",{cx:"6",cy:"20",r:"2"},null,-1)),n[25]||(n[25]=h("path",{d:"M6 6v12M8 10c6 0 4-4 8-4"},null,-1))],64)):e.name==="message-circle"?(g(),v("path",Bb)):e.name==="tag"?(g(),v("path",Fb)):e.name==="sparkles"?(g(),v("path",jb)):e.name==="terminal"?(g(),v(X,{key:33},[n[26]||(n[26]=h("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"},null,-1)),n[27]||(n[27]=h("path",{d:"m7 9 3 3-3 3m5 0h5"},null,-1))],64)):e.name==="folder"?(g(),v("path",Ub)):e.name==="check"?(g(),v("path",zb)):e.name==="speaker"?(g(),v(X,{key:36},[n[28]||(n[28]=h("path",{d:"M11 5 6 9H3v6h3l5 4V5z"},null,-1)),n[29]||(n[29]=h("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"},null,-1)),n[30]||(n[30]=h("path",{d:"M18 6a8.5 8.5 0 0 1 0 12"},null,-1))],64)):e.name==="speaker-off"?(g(),v(X,{key:37},[n[31]||(n[31]=h("path",{d:"M11 5 6 9H3v6h3l5 4V5z"},null,-1)),n[32]||(n[32]=h("path",{d:"m16 9 5 6M21 9l-5 6"},null,-1))],64)):e.name==="copy"?(g(),v(X,{key:38},[n[33]||(n[33]=h("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"},null,-1)),n[34]||(n[34]=h("path",{d:"M16 8V4H4v12h4"},null,-1))],64)):e.name==="refresh"?(g(),v("path",Hb)):e.name==="target"?(g(),v(X,{key:40},[n[35]||(n[35]=h("circle",{cx:"12",cy:"12",r:"9"},null,-1)),n[36]||(n[36]=h("circle",{cx:"12",cy:"12",r:"5"},null,-1)),n[37]||(n[37]=h("circle",{cx:"12",cy:"12",r:"1"},null,-1))],64)):e.name==="settings"?(g(),v(X,{key:41},[n[38]||(n[38]=h("circle",{cx:"12",cy:"12",r:"3"},null,-1)),n[39]||(n[39]=h("path",{d:"M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1.87-.34 1.7 1.7 0 0 0-1 1.55V21a2 2 0 1 1-4 0v-.09a1.7 1.7 0 0 0-1-1.55 1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.7 1.7 0 0 0 .34-1.87 1.7 1.7 0 0 0-1.55-1H3a2 2 0 1 1 0-4h.09a1.7 1.7 0 0 0 1.55-1 1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.7 1.7 0 0 0 1.87.34h.09a1.7 1.7 0 0 0 1-1.55V3a2 2 0 1 1 4 0v.09a1.7 1.7 0 0 0 1 1.55 1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.7 1.7 0 0 0-.34 1.87v.09a1.7 1.7 0 0 0 1.55 1H21a2 2 0 1 1 0 4h-.09a1.7 1.7 0 0 0-1.55 1Z"},null,-1))],64)):e.name==="home"?(g(),v(X,{key:42},[n[40]||(n[40]=h("path",{d:"M3 10.5 12 3l9 7.5"},null,-1)),n[41]||(n[41]=h("path",{d:"M5 9.5V21h14V9.5"},null,-1))],64)):e.name==="bell"?(g(),v(X,{key:43},[n[42]||(n[42]=h("path",{d:"M6 9a6 6 0 1 1 12 0c0 5 2 6 2 6H4s2-1 2-6"},null,-1)),n[43]||(n[43]=h("path",{d:"M10 19a2 2 0 0 0 4 0"},null,-1))],64)):e.name==="book"?(g(),v(X,{key:44},[n[44]||(n[44]=h("path",{d:"M4 5a2 2 0 0 1 2-2h13v18H6a2 2 0 0 0-2 2Z"},null,-1)),n[45]||(n[45]=h("path",{d:"M6 3v18"},null,-1))],64)):e.name==="layers"?(g(),v(X,{key:45},[n[46]||(n[46]=h("path",{d:"m12 3 9 5-9 5-9-5Z"},null,-1)),n[47]||(n[47]=h("path",{d:"m3 13 9 5 9-5"},null,-1))],64)):e.name==="wrench"?(g(),v("path",Wb)):e.name==="arrow-up"?(g(),v("path",qb)):e.name==="x"?(g(),v("path",Vb)):e.name==="file"?(g(),v(X,{key:49},[n[48]||(n[48]=h("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"},null,-1)),n[49]||(n[49]=h("path",{d:"M14 2v6h6"},null,-1))],64)):e.name==="user"?(g(),v(X,{key:50},[n[50]||(n[50]=h("circle",{cx:"12",cy:"8",r:"3.5"},null,-1)),n[51]||(n[51]=h("path",{d:"M5 20a7 7 0 0 1 14 0"},null,-1))],64)):e.name==="expand"?(g(),v("path",Kb)):e.name==="minimize"?(g(),v("path",Zb)):e.name==="shield"?(g(),v(X,{key:53},[n[52]||(n[52]=h("path",{d:"M12 3 5 6v5.5c0 4.2 2.9 7.6 7 9.5 4.1-1.9 7-5.3 7-9.5V6Z"},null,-1)),n[53]||(n[53]=h("path",{d:"M9.5 12.2 11.3 14l3.4-3.6"},null,-1))],64)):e.name==="queue"?(g(),v(X,{key:54},[n[54]||(n[54]=h("path",{d:"M4 7h11M4 12h11M4 17h7"},null,-1)),n[55]||(n[55]=h("path",{d:"M17.5 15.5 20 18l2.5-2.5M20 18v-6"},null,-1))],64)):e.name==="more"?(g(),v(X,{key:55},[n[56]||(n[56]=h("circle",{cx:"5.5",cy:"12",r:"1.4"},null,-1)),n[57]||(n[57]=h("circle",{cx:"12",cy:"12",r:"1.4"},null,-1)),n[58]||(n[58]=h("circle",{cx:"18.5",cy:"12",r:"1.4"},null,-1))],64)):e.name==="bar-chart"?(g(),v("path",Yb)):N("",!0)],8,bb))}}),me=De(Xb,[["__scopeId","data-v-421b9da7"]]),Jb={class:"at-menu",role:"listbox","aria-label":"文件提及"},Qb={key:0,class:"at-status"},ek={key:1,class:"at-status"},tk=["data-active","aria-selected","onClick","onMousemove"],nk={class:"at-item-name"},sk={key:0,class:"at-item-dir"},ok={class:"at-hints"},rk={class:"at-hint"},ik=["title"],ak=Le({__name:"AtFileMenu",props:{suggestions:{},activeIndex:{},loading:{type:Boolean,default:!1},workDir:{default:""}},emits:["select","hover"],setup(e,{emit:t}){const n=e,s=t,o=M(null);xe(()=>n.activeIndex,async()=>{var u;await Ve();const l=(u=o.value)==null?void 0:u.querySelector('[data-active="true"]');l==null||l.scrollIntoView({block:"nearest"})});const r=l=>l.split("/").pop()||l;function i(l){return r(l.path)}function a(l){const u=l.path.lastIndexOf("/");return u===-1?"":l.path.slice(0,u)}return(l,u)=>{var c;return g(),v("div",Jb,[e.loading&&e.suggestions.length===0?(g(),v("div",Qb,"加载文件列表…")):e.suggestions.length===0?(g(),v("div",ek,"无匹配文件")):(g(),v("ul",{key:2,ref_key:"listRef",ref:o,class:"at-list"},[(g(!0),v(X,null,Me(e.suggestions,(d,f)=>(g(),v("li",{key:d.path},[h("button",{class:fe(["at-item",{selected:f===e.activeIndex}]),"data-active":f===e.activeIndex?"true":void 0,role:"option","aria-selected":f===e.activeIndex,onClick:p=>s("select",d),onMousemove:p=>s("hover",f)},[h("span",{class:fe(["at-item-icon",{"is-dir":d.isDir}])},[K(me,{name:d.isDir?"folder":"file",size:14},null,8,["name"])],2),h("span",nk,C(i(d)),1),a(d)?(g(),v("span",sk,C(a(d)),1)):N("",!0)],42,tk)]))),128))],512)),h("div",ok,[u[1]||(u[1]=h("span",{class:"at-hint"},[h("kbd",null,"↑↓"),Pe("选择")],-1)),h("span",rk,[u[0]||(u[0]=h("kbd",null,"Tab/Enter",-1)),Pe(C((c=e.suggestions[e.activeIndex])!=null&&c.isDir?"进入目录":"插入引用"),1)]),u[2]||(u[2]=h("span",{class:"at-hint"},[h("kbd",null,"Esc"),Pe("关闭")],-1)),e.workDir?(g(),v("span",{key:0,class:"at-root",title:e.workDir},"根:"+C(r(e.workDir)),9,ik)):N("",!0)])])}}}),lk=De(ak,[["__scopeId","data-v-9c8e827b"]]),uk=["title","aria-label"],ck=["width","height","viewBox"],dk=["cx","cy","r"],fk=["cx","cy","r","stroke-dasharray","stroke-dashoffset","transform"],Xi=2,hk=Le({__name:"ContextRing",props:{usage:{default:void 0},size:{default:16}},setup(e){Qm(l=>({v1d95ffa8:a.value}));const t=e,n=P(()=>{if(t.usage===void 0||Number.isNaN(t.usage))return 0;const l=t.usage>1?t.usage/100:t.usage;return Math.min(1,Math.max(0,l))}),s=P(()=>Math.round(n.value*100)),o=P(()=>(t.size-Xi)/2),r=P(()=>2*Math.PI*o.value),i=P(()=>r.value*(1-n.value)),a=P(()=>n.value>=.9?"var(--color-danger)":n.value>=.7?"var(--color-warning)":"var(--color-accent)");return(l,u)=>(g(),v("span",{class:"context-ring",role:"img",title:`上下文占用 ${s.value}%`,"aria-label":`上下文占用 ${s.value}%`},[(g(),v("svg",{width:e.size,height:e.size,viewBox:`0 0 ${e.size} ${e.size}`},[h("circle",{class:"ring-track",cx:e.size/2,cy:e.size/2,r:o.value,"stroke-width":Xi,fill:"none"},null,8,dk),h("circle",{class:"ring-value",cx:e.size/2,cy:e.size/2,r:o.value,"stroke-width":Xi,fill:"none","stroke-linecap":"round","stroke-dasharray":r.value,"stroke-dashoffset":i.value,transform:`rotate(-90 ${e.size/2} ${e.size/2})`},null,8,fk)],8,ck))],8,uk))}}),fh=De(hk,[["__scopeId","data-v-3ffc343b"]]),pk=["data-goal-status"],gk={class:"goal-status"},mk=["title"],vk={class:"goal-metric",title:"已用轮次"},yk={class:"goal-actions"},bk=["disabled","title"],kk=["disabled","title"],wk=["disabled","title"],Sk=Le({__name:"GoalBar",props:{goal:{},disabled:{type:Boolean,default:!1},disabledReason:{default:""},busy:{type:Boolean,default:!1},pending:{type:Boolean,default:!1}},emits:["pause","resume","cancel","edit"],setup(e,{emit:t}){const n=e,s=t,o={active:"进行中",paused:"已暂停",blocked:"受阻",complete:"已完成"},r=P(()=>!!n.goal&&n.goal.status!=="complete"),i=P(()=>{var c;return((c=n.goal)==null?void 0:c.status)==="active"}),a=P(()=>{var c;return o[((c=n.goal)==null?void 0:c.status)??""]??"目标"}),l=P(()=>n.disabled?n.disabledReason||"当前不可操作":""),u=P(()=>{var f;const c=n.goal;if(!c)return"";const d=(f=c.budget)==null?void 0:f.turnBudget;return d?`${c.turnsUsed}/${d} 轮`:`${c.turnsUsed} 轮`});return(c,d)=>r.value&&e.goal?(g(),v("div",{key:0,class:"goal-bar","data-goal-bar":"","data-goal-status":e.goal.status},[K(me,{name:"target",size:14,class:"goal-icon"}),h("span",gk,C(a.value),1),h("span",{class:"goal-objective",title:e.goal.objective},C(e.goal.objective),9,mk),h("span",vk,C(u.value),1),h("div",yk,[h("button",{class:"goal-action",type:"button",title:"编辑目标与预算(在右栏 Goal 面板)","aria-label":"编辑目标",onClick:d[0]||(d[0]=f=>s("edit"))},[K(me,{name:"edit",size:13}),d[4]||(d[4]=h("span",null,"编辑",-1))]),i.value?(g(),v("button",{key:0,class:"goal-action",type:"button",disabled:e.disabled||e.busy||e.pending,title:e.disabled||e.pending?l.value:"暂停目标执行","aria-label":"暂停目标",onClick:d[1]||(d[1]=f=>s("pause"))},[...d[5]||(d[5]=[h("span",null,"暂停",-1)])],8,bk)):(g(),v("button",{key:1,class:"goal-action",type:"button",disabled:e.disabled||e.busy||e.pending,title:e.disabled||e.pending?l.value:"继续目标执行","aria-label":"继续目标",onClick:d[2]||(d[2]=f=>s("resume"))},[...d[6]||(d[6]=[h("span",null,"继续",-1)])],8,kk)),h("button",{class:"goal-action is-danger",type:"button",disabled:e.disabled||e.pending,title:e.disabled?l.value:"取消目标(可在右栏 Goal 面板查看结果)","aria-label":"取消目标",onClick:d[3]||(d[3]=f=>s("cancel"))}," 清除 ",8,wk)])],8,pk)):N("",!0)}}),_k=De(Sk,[["__scopeId","data-v-c7806e90"]]),$k={class:"history-menu",role:"listbox","aria-label":"输入历史"},Ck={class:"history-header",title:"输入历史"},xk=["data-active","aria-selected","onClick","onMousemove"],Tk={class:"history-item-index"},Ik={class:"history-item-text"},Ek=Le({__name:"HistoryMenu",props:{items:{},activeIndex:{}},emits:["apply","hover"],setup(e,{emit:t}){const n=e,s=t,o=M(null);return xe(()=>n.activeIndex,async()=>{var i;await Ve();const r=(i=o.value)==null?void 0:i.querySelector('[data-active="true"]');r==null||r.scrollIntoView({block:"nearest"})}),rt(async()=>{var i;await Ve();const r=(i=o.value)==null?void 0:i.querySelector('[data-active="true"]');r==null||r.scrollIntoView({block:"nearest"})}),(r,i)=>(g(),v("div",$k,[h("div",Ck,[K(me,{name:"refresh",size:14}),i[0]||(i[0]=h("span",{class:"history-hints"},[h("span",{class:"history-hint"},[h("kbd",null,"↑↓"),Pe("选择")]),h("span",{class:"history-hint"},[h("kbd",null,"Tab/Enter"),Pe("填入")]),h("span",{class:"history-hint"},[h("kbd",null,"Esc"),Pe("关闭")])],-1))]),h("ul",{ref_key:"listRef",ref:o,class:"history-list"},[(g(!0),v(X,null,Me(e.items,(a,l)=>(g(),v("li",{key:`${l}:${a}`},[h("button",{class:fe(["history-item",{selected:l===e.activeIndex}]),"data-active":l===e.activeIndex?"true":void 0,role:"option","aria-selected":l===e.activeIndex,onClick:u=>s("apply",a),onMousemove:u=>s("hover",l)},[h("span",Tk,C(l+1),1),h("span",Ik,C(a),1)],42,xk)]))),128))],512)]))}}),Ak=De(Ek,[["__scopeId","data-v-41efc12f"]]);function Nl(e,t){const n=t.gap??6,s=t.edge??8,o={position:"fixed",maxWidth:`${t.maxWidth}px`};return t.placement==="top"?o.bottom=`${window.innerHeight-e.top+n}px`:o.top=`${e.bottom+n}px`,t.align==="right"?o.right=`${Math.max(s,window.innerWidth-e.right)}px`:o.left=`${Math.min(Math.max(s,e.left),Math.max(s,window.innerWidth-t.maxWidth-s))}px`,o}const Mk=["aria-label"],Rk={key:0,class:"menu-heading"},Pk={key:0,class:"menu-group-title"},Lk=["disabled","title","aria-current","onClick"],Dk={class:"entry-label"};let Ds=null;function Ok(e){Ds==null||Ds(),Ds=e}function mc(e){Ds===e&&(Ds=null)}const Nk=Le({__name:"MenuPopover",props:{label:{},groups:{},open:{type:Boolean},align:{default:"right"},placement:{default:"top"},maxWidth:{default:300},heading:{default:void 0}},emits:["select","update:open"],setup(e,{emit:t}){const n=e,s=t,o=M(null),r=M({});function i(){n.open&&s("update:open",!1)}xe(()=>n.open,d=>{d?(Ok(i),a(),document.addEventListener("scroll",c,!0),window.addEventListener("resize",c)):(mc(i),document.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c))});function a(){const d=o.value;d&&(r.value=Nl(d.getBoundingClientRect(),{placement:n.placement,align:n.align,maxWidth:n.maxWidth}))}function l(d){const f=d.target;if(!(f instanceof Node))return;const p=o.value;p!=null&&p.contains(f)||f instanceof Element&&f.closest("[data-menu-popover]")||i()}function u(d){d.key==="Escape"&&n.open&&(d.stopPropagation(),i())}function c(){i()}return rt(()=>{document.addEventListener("pointerdown",l,!0),window.addEventListener("keydown",u,!0),n.open&&(a(),document.addEventListener("scroll",c,!0),window.addEventListener("resize",c))}),at(()=>{mc(i),document.removeEventListener("pointerdown",l,!0),window.removeEventListener("keydown",u,!0),document.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}),(d,f)=>(g(),v("span",{ref_key:"rootRef",ref:o,class:"menu-root"},[So(d.$slots,"default",{},void 0),(g(),Fe(Qs,{to:"body"},[e.open?(g(),v("div",{key:0,class:fe(["menu-popover",[`is-align-${e.align}`,`is-placement-${e.placement}`]]),style:yt(r.value),role:"menu","aria-label":e.label,"data-menu-popover":""},[e.heading?(g(),v("p",Rk,C(e.heading),1)):N("",!0),(g(!0),v(X,null,Me(e.groups,(p,m)=>(g(),v(X,{key:`g${m}`},[p.title?(g(),v("p",Pk,C(p.title),1)):N("",!0),(g(!0),v(X,null,Me(p.entries,y=>(g(),v("button",{key:y.key,class:fe(["menu-entry",{"is-active":y.checked,"is-danger":y.tone==="danger"}]),role:"menuitem",type:"button",disabled:y.disabled,title:y.title??y.label,"aria-current":y.checked?"true":void 0,onClick:b=>s("select",y.key)},[y.icon?(g(),Fe(me,{key:0,name:y.icon,size:14},null,8,["name"])):N("",!0),h("span",Dk,C(y.label),1),y.checked?(g(),Fe(me,{key:1,name:"check",size:14,class:"entry-check"})):N("",!0)],10,Lk))),128))],64))),128))],14,Mk)):N("",!0)]))],512))}}),ja=De(Nk,[["__scopeId","data-v-e68e06d8"]]),Gk=["onKeydown"],Bk={key:0,class:"picker-empty"},Fk={class:"picker-group-title"},jk=["onClick"],Uk={class:"row-main"},zk={class:"row-name"},Hk={class:"row-alias"},Wk={class:"row-meta"},qk={key:0,class:"row-check"},Vk={class:"picker-thinking"},Kk={class:"thinking-options"},Zk=["onClick"],Yk=Le({__name:"ModelPicker",props:{models:{},currentModel:{},currentThinking:{},open:{type:Boolean,default:!0}},emits:["apply-model","apply-thinking","close","update:open"],setup(e,{emit:t}){const n=e,s=t,o=["off","low","medium","high"],r={off:"关闭",low:"低",medium:"中",high:"高",xhigh:"超高",max:"最大"},i=M(""),a=M(null),l=P(()=>{const x=i.value.trim().toLowerCase();return x?n.models.filter(E=>E.alias.toLowerCase().includes(x)||E.provider.toLowerCase().includes(x)||(E.displayName??"").toLowerCase().includes(x)):n.models}),u=P(()=>{const x=new Map;for(const E of l.value){const z=x.get(E.provider)??[];z.push(E),x.set(E.provider,z)}return[...x.entries()].map(([E,z])=>({provider:E,models:z}))}),c=P(()=>n.models.find(x=>x.alias===n.currentModel)),d=P(()=>{var x;return((x=c.value)==null?void 0:x.thinkingLevels)??o});function f(x){return r[x]??x}function p(x){return x>=1e3?`${Math.round(x/1e3)}k`:String(x)}function m(x){return x.displayName??x.model}const y=M(null),b=M(null),k=M({});function w(){s("close"),s("update:open",!1)}function S(){var le;const x=y.value;if(!x)return;const z=(((le=x.closest(".chip-slot"))==null?void 0:le.querySelector(".model-select"))??document.querySelector(".model-select")??x).getBoundingClientRect(),oe=6,ke=8,Te=Nl(z,{placement:"top",align:"right",maxWidth:Math.min(320,window.innerWidth-ke*2),gap:oe,edge:ke}),ge=Math.max(240,z.top-oe-ke);Te.maxHeight=`min(60vh, ${ge}px)`,k.value=Te}function I(x){const E=x.target;E instanceof Element&&E.closest(".model-select")||b.value&&!b.value.contains(E)&&w()}function q(x){var z;const E=x.target;E instanceof Node&&((z=b.value)!=null&&z.contains(E))||w()}function B(){document.addEventListener("scroll",q,!0),window.addEventListener("resize",q)}function R(){document.removeEventListener("scroll",q,!0),window.removeEventListener("resize",q)}rt(()=>{var x;document.addEventListener("mousedown",I,!0),n.open&&((x=a.value)==null||x.focus(),S(),B())}),xe(()=>n.open,x=>{if(!x){R();return}B(),Ve(()=>{var E;S(),(E=a.value)==null||E.focus()})}),at(()=>{document.removeEventListener("mousedown",I,!0),R()});function L(x){x!==n.currentModel&&s("apply-model",x),w()}const A=M(null);function W(){const x=A.value;return x?Array.from(x.querySelectorAll(".picker-row")):[]}function F(){var x;(x=W()[0])==null||x.focus()}function O(x){var oe,ke,Te;if(x.key!=="ArrowDown"&&x.key!=="ArrowUp")return;const E=W();if(E.length===0)return;const z=E.indexOf(document.activeElement);x.preventDefault(),z===-1?(oe=E[0])==null||oe.focus():x.key==="ArrowDown"?(ke=E[(z+1)%E.length])==null||ke.focus():(Te=E[(z-1+E.length)%E.length])==null||Te.focus()}function ee(x){x!==n.currentThinking&&s("apply-thinking",x)}return(x,E)=>(g(),v("span",{ref_key:"anchorRef",ref:y,class:"model-picker model-picker--anchor"},[(g(),Fe(Qs,{to:"body"},[e.open?(g(),v("div",{key:0,ref_key:"rootRef",ref:b,class:"model-picker",style:yt(k.value),role:"dialog","aria-label":"模型选择",onKeydown:E[1]||(E[1]=Vn(st(z=>w(),["stop"]),["esc"]))},[et(h("input",{ref_key:"searchRef",ref:a,"onUpdate:modelValue":E[0]||(E[0]=z=>i.value=z),class:"picker-search",type:"text",placeholder:"搜索模型…",id:"model-search-input",name:"model-search",autocomplete:"off",spellcheck:"false",onKeydown:Vn(st(F,["prevent"]),["arrow-down"])},null,40,Gk),[[ut,i.value]]),h("div",{ref_key:"listRef",ref:A,class:"picker-list",onKeydown:O},[u.value.length===0?(g(),v("div",Bk,"无匹配模型")):N("",!0),(g(!0),v(X,null,Me(u.value,z=>(g(),v("div",{key:z.provider,class:"picker-group"},[h("div",Fk,C(z.provider),1),(g(!0),v(X,null,Me(z.models,oe=>(g(),v("button",{key:oe.alias,class:fe(["picker-row",{active:oe.alias===e.currentModel}]),onClick:ke=>L(oe.alias)},[h("span",Uk,[h("span",zk,C(m(oe)),1),h("span",Hk,C(oe.alias),1)]),h("span",Wk,C(p(oe.maxContextSize)),1),oe.alias===e.currentModel?(g(),v("span",qk,"✓")):N("",!0)],10,jk))),128))]))),128))],544),h("div",Vk,[E[2]||(E[2]=h("span",{class:"thinking-label"},"思考强度",-1)),h("div",Kk,[(g(!0),v(X,null,Me(d.value,z=>(g(),v("button",{key:z,class:fe(["thinking-btn",{active:z===e.currentThinking}]),onClick:oe=>ee(z)},C(f(z)),11,Zk))),128))])])],36)):N("",!0)]))],512))}}),Xk=De(Yk,[["__scopeId","data-v-0271ee16"]]),Jk={class:"slash-menu",role:"listbox","aria-label":"斜杠命令与技能"},Qk={key:0,class:"slash-search"},e1=["value"],t1={class:"slash-list"},n1={key:0,class:"slash-group"},s1={class:"slash-group-label"},o1={key:0,class:"slash-group-hint"},r1=["aria-selected","onMousedown","onMouseenter"],i1={class:"slash-name"},a1={key:0,class:"slash-aliases"},l1={class:"slash-desc"},u1={key:0,class:"slash-badge slash-badge-source"},c1={key:0,class:"slash-badge slash-badge-input"},d1={key:1,class:"slash-badge"},f1=Le({__name:"SlashMenu",props:{commands:{},activeIndex:{}},emits:["select","hover"],setup(e,{emit:t}){const n=e,s=t,o={builtin:"内置",user:"用户",extra:"扩展",project:"项目"};function r(d){return d?d.startsWith("plugin:")?`插件 ${d.slice(7)}`:o[d]||d:""}const i=P(()=>{const d=[];let f="";return n.commands.forEach((p,m)=>{const y=p.kind==="skill"?"skills":p.group==="advanced"?"advanced":"commands";y!==f&&(f=y,d.push({type:"header",label:a[y]})),d.push({type:"item",cmd:p,index:m})}),f!=="advanced"&&Lv()&&d.push({type:"header",label:a.advanced,hint:"输入继续筛选"}),d}),a={commands:"命令",advanced:"高级",skills:"技能"},l=M(""),u=P(()=>n.commands.length>Pv||l.value!=="");function c(d){l.value=d.target.value,Mv(l.value)}return at(()=>{l.value&&(l.value="",Rv())}),(d,f)=>(g(),v("div",Jk,[u.value?(g(),v("div",Qk,[h("input",{class:"slash-search-input",type:"text",value:l.value,placeholder:"筛选命令与技能…","aria-label":"筛选命令与技能",onInput:c,onMousedown:f[0]||(f[0]=st(()=>{},["stop"]))},null,40,e1)])):N("",!0),h("div",t1,[(g(!0),v(X,null,Me(i.value,(p,m)=>{var y;return g(),v(X,{key:m},[p.type==="header"?(g(),v("div",n1,[h("span",s1,C(p.label),1),p.hint?(g(),v("span",o1,C(p.hint),1)):N("",!0)])):(g(),v("button",{key:1,class:fe(["slash-item",{active:p.index===e.activeIndex}]),role:"option","aria-selected":p.index===e.activeIndex,onMousedown:st(b=>s("select",p.cmd),["prevent"]),onMouseenter:b=>s("hover",p.index)},[h("span",i1,[Pe("/"+C(p.cmd.name),1),(y=p.cmd.aliases)!=null&&y.length?(g(),v("span",a1,C(p.cmd.aliases.map(b=>`/${b}`).join(" ")),1)):N("",!0)]),h("span",l1,C(p.cmd.description),1),p.cmd.kind==="skill"?(g(),v(X,{key:0},[p.cmd.source?(g(),v("span",u1,C(r(p.cmd.source)),1)):N("",!0),f[1]||(f[1]=h("span",{class:"slash-badge slash-badge-skill"},"技能",-1))],64)):(g(),v(X,{key:1},[p.cmd.acceptsInput?(g(),v("span",c1,"输入参数")):N("",!0),p.cmd.target==="backend"?(g(),v("span",d1,"服务端")):N("",!0)],64))],42,r1))],64)}),128))]),f[2]||(f[2]=h("div",{class:"slash-hint"},"↑↓ 选择 · Enter/Tab 执行 · Esc 关闭",-1))]))}}),h1=De(f1,[["__scopeId","data-v-b0de79ca"]]),p1=34;function Sr(e){const t=e.split("/"),n=t.at(-1)??e;return t.length<=2?{dir:t.length===2?`${t[0]}/`:"",base:n}:e.length<=p1?{dir:`${t.slice(0,-1).join("/")}/`,base:n}:{dir:`…/${t.at(-2)}/`,base:n}}const g1={class:"picker-input-row"},m1=["placeholder","onKeydown"],v1=["disabled","title"],y1={key:0,class:"picker-warn"},b1={class:"picker-rows"},k1=["title","onClick"],w1={class:"row-base"},S1={class:"row-path"},_1={class:"picker-rows"},$1=["title","onClick"],C1={class:"row-base"},x1=Le({__name:"WorkspacePicker",props:{current:{default:""},defaultDir:{default:""},recentWorkDirs:{default:()=>[]}},emits:["select","close"],setup(e,{emit:t}){const n=e,s=t,o=M(n.current||n.defaultDir),r=M(null),i=M(null),a=M(null),l=M({}),u=P(()=>o.value.trim().startsWith("/")),c=P(()=>u.value&&o.value.trim().length>0);function d(){c.value&&s("select",o.value.trim())}const f=M([]);let p;xe(o,w=>{clearTimeout(p);const S=w.trim();if(!S.startsWith("/")){f.value=[];return}p=setTimeout(async()=>{const I=await Ol(S);o.value.trim()===S&&(f.value=(I??[]).filter(q=>q.type==="dir").slice(0,8))},250)});function m(w){var S;o.value=w.path,(S=r.value)==null||S.focus()}function y(){var L;const w=i.value;if(!w)return;const I=(((L=w.closest(".chip-slot"))==null?void 0:L.querySelector(".workspace-select"))??document.querySelector(".workspace-select")??w).getBoundingClientRect(),q=6,B=8,R=Nl(I,{placement:"top",align:"left",maxWidth:Math.min(360,window.innerWidth-B*2),gap:q,edge:B});R.maxHeight=`min(60vh, ${Math.max(240,I.top-q-B)}px)`,l.value=R}function b(w){const S=w.target;S instanceof Element&&S.closest(".workspace-select")||a.value&&!a.value.contains(S)&&s("close")}function k(w){var I;const S=w.target;S instanceof Node&&((I=a.value)!=null&&I.contains(S))||s("close")}return rt(()=>{document.addEventListener("mousedown",b,!0),document.addEventListener("scroll",k,!0),window.addEventListener("resize",k),Ve(()=>{var w,S;y(),(w=r.value)==null||w.focus(),(S=r.value)==null||S.select()})}),at(()=>{document.removeEventListener("mousedown",b,!0),document.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),clearTimeout(p)}),(w,S)=>(g(),v("span",{ref_key:"anchorRef",ref:i,class:"workspace-picker workspace-picker--anchor"},[(g(),Fe(Qs,{to:"body"},[h("div",{ref_key:"rootRef",ref:a,class:"workspace-picker",style:yt(l.value),role:"dialog","aria-label":"选择工作区",onKeydown:S[1]||(S[1]=Vn(st(I=>s("close"),["stop"]),["esc"]))},[S[4]||(S[4]=h("p",{class:"picker-title"},"工作区(下一次新建)",-1)),h("div",g1,[et(h("input",{ref_key:"inputRef",ref:r,"onUpdate:modelValue":S[0]||(S[0]=I=>o.value=I),class:"picker-path-input","data-testid":"workspace-path-input",placeholder:e.defaultDir||"输入绝对路径,如 /Users/you/project",spellcheck:"false",onKeydown:Vn(st(d,["prevent"]),["enter"])},null,40,m1),[[ut,o.value]]),h("button",{class:"picker-apply","data-testid":"workspace-apply",disabled:!c.value,title:c.value?"使用该目录新建会话":"工作区必须是绝对路径",onClick:d}," 选择 ",8,v1)]),o.value.trim()&&!u.value?(g(),v("p",y1,"需要绝对路径(以 / 开头)")):N("",!0),e.recentWorkDirs.length?(g(),v(X,{key:1},[S[2]||(S[2]=h("p",{class:"picker-section"},"最近使用",-1)),h("div",b1,[(g(!0),v(X,null,Me(e.recentWorkDirs,I=>(g(),v("button",{key:I,class:"picker-row",title:I,onClick:q=>s("select",I)},[K(me,{name:"folder",size:14}),h("span",w1,C(D(Ga)(I)),1),h("span",S1,C(D(Sr)(I).dir),1)],8,k1))),128))])],64)):N("",!0),f.value.length?(g(),v(X,{key:2},[S[3]||(S[3]=h("p",{class:"picker-section"},"子目录",-1)),h("div",_1,[(g(!0),v(X,null,Me(f.value,I=>(g(),v("button",{key:I.path,class:"picker-row",title:I.path,onClick:q=>m(I)},[K(me,{name:"folder",size:14}),h("span",C1,C(I.name),1)],8,$1))),128))])],64)):N("",!0)],36)]))],512))}}),T1=De(x1,[["__scopeId","data-v-a02cc634"]]),I1=["data-placeholder-state","placeholder"],E1={class:"composer-capsule-row"},A1={class:"composer-chips"},M1=["title"],R1={key:1,class:"chip-slot"},P1=["disabled","title","aria-haspopup","aria-expanded"],L1={class:"chip-text"},D1={key:2,class:"chip-slot"},O1=["disabled","title","aria-haspopup","aria-expanded"],N1={class:"chip-text"},G1=["disabled","title","aria-expanded"],B1={class:"chip-text"},F1=["disabled","title","aria-expanded"],j1={class:"chip-text"},U1=["title"],z1={class:"chip-text"},H1=["title"],W1={class:"chip-text"},q1=["data-action","disabled","title","aria-label"],V1={key:0,class:"primary-label"},vc=50,K1=5e3,Z1=Le({__name:"Composer",props:{busy:{type:Boolean},status:{default:void 0},sessionId:{default:null},models:{default:()=>[]},workDir:{default:""},variant:{default:"chat"},placeholder:{default:void 0},messages:{},connectionStatus:{default:"idle"},goal:{default:null},recentWorkDirs:{default:()=>[]}},emits:["send","abort","command","switch-model","switch-thinking","switch-permission","goal-pause","goal-resume","goal-cancel","goal-edit"],setup(e,{expose:t,emit:n}){const s=e,o=n,r=M(""),i=M(null),a=P(()=>s.workDir||void 0),l=gb(r,i,a),u=M(0),c=M(!1),d=P(()=>{const j=r.value;return!j.startsWith("/")||j.includes(`
|
|
20
|
+
`)||/\s/.test(j.slice(1))?null:j.slice(1)}),f=P(()=>d.value===null?[]:Dv(d.value)),p=P(()=>d.value!==null&&f.value.length>0&&!c.value);xe(d,()=>{u.value=0,c.value=!1});function m(j){const re=j??f.value[u.value];if(re){if(re.acceptsInput){r.value=`/${re.name} `,c.value=!0,Ve(()=>{var je;(je=i.value)==null||je.focus(),x()});return}R(`/${re.name}`),Te(),o("command",re.name)}}const y=M([]);xe(()=>s.sessionId,()=>{y.value=[]}),xe(()=>s.busy,j=>{if(!j&&y.value.length>0){const[re,...je]=y.value;y.value=je,re&&o("send",re)}});let b=0;const k=M([]),w=P(()=>vb(k.value,mb(s.messages??[]),vc)),S=M(!1),I=M(0);function q(){return`scream-history:${s.sessionId??"default"}`}function B(){try{const j=localStorage.getItem(q());k.value=j?JSON.parse(j):[]}catch{k.value=[]}}function R(j){if(k.value.at(-1)!==j){k.value=[...k.value,j].slice(-vc);try{localStorage.setItem(q(),JSON.stringify(k.value))}catch{}}}function L(j){r.value=j,S.value=!1,Ve(()=>{const re=i.value;re&&(re.focus(),re.setSelectionRange(re.value.length,re.value.length),x(),l.reset())})}function A(){c.value=!0,l.dismiss(),I.value=Math.max(0,w.value.length-1),S.value=!0}function W(j){const re=w.value.length;re!==0&&(I.value=Math.min(re-1,Math.max(0,I.value+j)))}xe(()=>w.value.length,()=>{I.value>=w.value.length&&(I.value=Math.max(0,w.value.length-1))});function F(){return`scream-draft:${s.sessionId??"default"}`}let O=null,ee;xe(r,()=>{x(),S.value=!1,l.refresh(),clearTimeout(ee),ee=setTimeout(()=>{try{r.value?localStorage.setItem(F(),r.value):localStorage.removeItem(F())}catch{}},300)}),xe(()=>s.sessionId,()=>{if(clearTimeout(ee),B(),S.value=!1,I.value=0,O&&Date.now()-O.at<=K1){r.value=O.text,O=null,Ve(x);return}O=null;let j="";try{j=localStorage.getItem(F())??""}catch{j=""}r.value=j,Ve(x)},{immediate:!0});function x(){const j=i.value;if(!j)return;j.style.height="auto";const re=Math.round(window.innerHeight*.25);j.style.height=`${Math.min(Math.max(j.scrollHeight,36),re)}px`}function E(){l.refresh()}const z=M(0);function oe(){const j=window.visualViewport;if(!j)return;const re=Math.round(window.innerHeight-j.height-j.offsetTop);z.value=re>120?re:0}"visualViewport"in window&&(rt(()=>{var j;(j=window.visualViewport)==null||j.addEventListener("resize",oe),oe()}),at(()=>{var j;(j=window.visualViewport)==null||j.removeEventListener("resize",oe),z.value=0}));function ke(j){const re=j.target;re instanceof Element&&(re.closest(".history-menu")||re.closest("#composer-input")||(S.value=!1,p.value&&!re.closest(".composer-chips")&&(c.value=!0)))}rt(()=>document.addEventListener("mousedown",ke)),at(()=>document.removeEventListener("mousedown",ke));function Te(){r.value="",l.reset(),S.value=!1,Ve(()=>{i.value&&(i.value.style.height="auto")})}function ge(){const j=r.value.trim();if(j){if(j.startsWith("/")){const re=j.indexOf(" "),je=(re===-1?j.slice(1):j.slice(1,re)).toLowerCase(),Yn=Ov(je),Vp=re===-1?"":j.slice(re+1).trim();R(j),o("command",Yn,Vp),Te();return}if(s.busy){le();return}R(j),o("send",j),Te()}}function le(){const j=r.value.trim();j&&(R(j),y.value=[...y.value,j],Te())}function ve(j){if(l.visible.value){if(j.key==="ArrowDown"){j.preventDefault(),l.move(1);return}if(j.key==="ArrowUp"){j.preventDefault(),l.move(-1);return}if((j.key==="Tab"||j.key==="Enter"&&!j.shiftKey)&&(j.isComposing||(j.preventDefault(),l.dirLoading.value)||l.confirm()))return;if(j.key==="Escape"){j.preventDefault(),l.dismiss();return}}if(p.value){if(j.key==="ArrowUp"){j.preventDefault(),u.value=(u.value-1+f.value.length)%f.value.length;return}if(j.key==="ArrowDown"){j.preventDefault(),u.value=(u.value+1)%f.value.length;return}if(j.key==="Tab"||j.key==="Enter"&&!j.shiftKey){if(j.key==="Enter"&&j.isComposing)return;j.preventDefault(),m();return}if(j.key==="Escape"){j.preventDefault(),c.value=!0;return}}if((j.ctrlKey||j.metaKey)&&j.key.toLowerCase()==="s"){j.preventDefault(),s.busy?le():ge();return}if(S.value&&!j.isComposing){if(j.key==="ArrowDown"){j.preventDefault(),W(1);return}if(j.key==="ArrowUp"){j.preventDefault(),W(-1);return}if(j.key==="Escape"){j.preventDefault(),S.value=!1;return}if((j.key==="Tab"||j.key==="Enter"&&!j.shiftKey)&&w.value[I.value]!==void 0){j.preventDefault(),L(w.value[I.value]);return}}if(j.key==="Enter"&&!j.shiftKey){if(j.isComposing||Date.now()-b<100)return;j.preventDefault(),ge();return}j.key==="ArrowUp"&&!j.isComposing&&!s.busy&&r.value.trim().length===0&&w.value.length>0&&(j.preventDefault(),A())}function Q(){y.value=[],o("abort")}function ye(j){r.value=j,S.value=!1,Ve(()=>{var re;x(),(re=i.value)==null||re.focus()})}function Ee(j,re={}){const je=re.activate!==!1;O={text:j,at:Date.now()},r.value=j,c.value=!0,l.dismiss(),S.value=!1,Ve(()=>{x();const Yn=i.value;!Yn||!je||(Yn.focus(),Yn.setSelectionRange(Yn.value.length,Yn.value.length))})}function Ue(j){r.value+=j,Ve(()=>{var re;x(),(re=i.value)==null||re.focus()})}const Ke=P(()=>{var j;return(j=s.status)==null?void 0:j.model}),J=P(()=>{var j;return(j=s.status)==null?void 0:j.permission}),de=P(()=>{var j;return(j=s.status)==null?void 0:j.contextUsage}),Z=P(()=>s.connectionStatus==="disconnected"||s.connectionStatus==="reconnecting"),Ie={offline:"连接已断开,正在重连 — 可以先打字,回车会把消息排队",plan:"计划模式:只做只读分析与方案输出,回车提交这个问题",queue:`已排队:回车继续排队下一条,${wr}S 立即注入`,busy:`回合进行中:现在打字然后回车,消息会排队随下一轮注入(${wr}S 立即注入)`,"no-workspace":"这个会话还没有工作目录:@ 文件提及暂不可用,可以直接提问",idle:"输入消息,@ 提及文件,/ 触发指令"},_=P(()=>{var j;return Z.value?"offline":s.busy?r.value.trim()?"queue":"busy":(j=s.status)!=null&&j.planMode?"plan":s.variant==="chat"&&!s.workDir?"no-workspace":"idle"}),$=P(()=>_.value==="idle"&&s.placeholder?s.placeholder:Ie[_.value]),U={off:"关闭",low:"低",medium:"中",high:"高",xhigh:"超高",max:"最大"},Y=P(()=>{var re;const j=(re=s.status)==null?void 0:re.model;if(j)return s.models.find(je=>je.alias===j)}),te=P(()=>{var j;return((j=Y.value)==null?void 0:j.thinkingLevels)??[]}),ne=P(()=>{var j;return(j=s.status)==null?void 0:j.thinkingLevel}),ue=P(()=>{const j=ne.value;return!j||j==="none"?"默认":U[j]??j}),ce={manual:"手动",auto:"自动",yolo:"YOLO",bot:"无人值守",ask:"询问"},ie=["manual","auto","yolo","bot"],T={manual:"每次工具调用都要你确认",auto:"安全操作自动放行,敏感操作仍要确认",yolo:"全部自动放行,不再打断",bot:"无人值守模式:批量接管确认"},H=P(()=>ce[J.value??""]??J.value??"手动"),G=P(()=>{switch(J.value){case"auto":return"perm-auto";case"yolo":return"perm-yolo";case"bot":return"perm-bot";default:return"perm-manual"}}),se=P(()=>{const j=de.value;return j===void 0?"":`${Math.round(j*100)}%`}),{preferredWorkDir:he,serverWorkDir:Se,displayWorkDir:_e,setPreferredWorkDir:Re}=Dl(),we=P(()=>{const re=s.variant==="chat"?Z.value?"连接已断开,正在重连 — 重连后可以切换":s.sessionId?"":"还没有打开会话,先新建或选择一个会话":"",je=s.models.length===0?"后端没有返回可选模型,暂时不能切换":"";return{model:{label:s.variant==="home"?"通用智能体":Ke.value??"",title:je||re||(Ke.value?`当前模型:${Ke.value},点击切换`:"会话状态还没回来"),enabled:!je&&!re,visible:!!Ke.value||s.variant==="home"},thinking:{label:`思考 · ${ue.value}`,title:re||`思考力度:${ue.value},点击调整(可选:${te.value.join(" / ")})`,enabled:!re,visible:s.variant==="chat"&&te.value.length>0},permission:{label:J.value?H.value:"权限",title:re||(J.value?`权限模式:${H.value},点击切换(会记录到会话日志)`:"权限模式:点击切换(会记录到会话日志)"),enabled:!re,visible:s.variant==="chat"},workspace:s.variant==="chat"?{label:s.workDir?Ga(s.workDir):"工作区",title:s.workDir?`工作区:${s.workDir} — 工作区随会话创建,不可中途更换`:"这个会话还没有工作目录",enabled:!1,visible:!0}:{label:_e.value?Ga(_e.value):"默认工作区",title:_e.value?`工作区:${_e.value},点击为下一次新建选择目录`:"还没拿到服务器默认工作区,点击可手动输入目录",enabled:!0,visible:!0},context:{label:se.value,title:de.value===void 0?"上下文占用还没回来":`上下文占用 ${(de.value*100).toFixed(1)}%`,enabled:!1,visible:de.value!==void 0}}}),Oe=M(null);function It(j){Re(j),Oe.value=null}function bt(j,re){re&&(S.value=!1,Oe.value=Oe.value===j?null:j)}function rn(j,re){re?Oe.value=j:Oe.value===j&&(Oe.value=null)}function _s(){return we.value.model.enabled?(Oe.value="model",!0):!1}const gt=P(()=>Oe.value==="model"),Ot=P(()=>Fa(te.value.map(j=>({key:j,label:j==="off"||j==="none"?"关闭":U[j]??j,checked:ne.value===j})),"思考力度")),$s=P(()=>Fa(ie.map(j=>({key:j,label:ce[j]??j,checked:J.value===j,title:T[j]})),"权限模式"));function Cs(j){o("switch-model",j),Oe.value=null}function Jo(j){o("switch-thinking",j),Oe.value=null}function Oi(j){o("switch-permission",j),Oe.value=null}const Zt=P(()=>s.busy?"stop":"send"),xs={send:{icon:"arrow-up",label:"发送",title:"发送(回车)"},stop:{icon:"stop",label:"停止",title:"停止当前回合"}},Qo=P(()=>xs[Zt.value].icon),Zn=P(()=>xs[Zt.value].label),er=P(()=>Zt.value==="stop"&&r.value.trim()?`${xs.stop.title}(回车把当前输入排队,${wr}S 立即注入)`:xs[Zt.value].title),pe=P(()=>Zt.value==="send"&&!r.value.trim());function be(){if(Zt.value==="stop"){Q();return}ge()}const $e=P(()=>!!s.goal&&(s.goal.status==="active"||s.goal.status==="paused"||s.goal.status==="blocked")),Gt=P(()=>Z.value||!s.sessionId),Ts=P(()=>Z.value?"连接已断开,正在重连":s.sessionId?"":"还没有打开会话");return t({insertText:ye,insertDraft:Ee,openModelPicker:_s}),(j,re)=>(g(),v("div",{class:"composer",style:yt(z.value?{paddingBottom:z.value+"px"}:void 0)},[p.value?(g(),Fe(h1,{key:0,commands:f.value,"active-index":u.value,onSelect:m,onHover:re[0]||(re[0]=je=>u.value=je)},null,8,["commands","active-index"])):N("",!0),D(l).visible.value?(g(),Fe(lk,{key:1,suggestions:D(l).suggestions.value,"active-index":D(l).index.value,loading:D(l).dirLoading.value,"work-dir":e.workDir,onSelect:re[1]||(re[1]=je=>D(l).confirm(je)),onHover:re[2]||(re[2]=je=>D(l).index.value=je)},null,8,["suggestions","active-index","loading","work-dir"])):N("",!0),S.value&&w.value.length>0?(g(),Fe(Ak,{key:2,items:w.value,"active-index":I.value,onApply:L,onHover:re[3]||(re[3]=je=>I.value=je)},null,8,["items","active-index"])):N("",!0),$e.value?(g(),Fe(_k,{key:3,goal:e.goal??null,busy:e.busy,disabled:Gt.value,"disabled-reason":Ts.value,onPause:re[4]||(re[4]=je=>o("goal-pause")),onResume:re[5]||(re[5]=je=>o("goal-resume")),onCancel:re[6]||(re[6]=je=>o("goal-cancel")),onEdit:re[7]||(re[7]=je=>o("goal-edit"))},null,8,["goal","busy","disabled","disabled-reason"])):N("",!0),et(h("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":re[8]||(re[8]=je=>r.value=je),id:"composer-input",name:"message",class:"composer-input",rows:"1","data-placeholder-state":_.value,placeholder:$.value,onKeydown:ve,onCompositionend:re[9]||(re[9]=je=>ht(b)?b.value=Date.now():b=Date.now()),onClick:E,onKeyup:E},null,40,I1),[[ut,r.value]]),h("div",E1,[h("div",A1,[e.variant==="chat"?(g(),v("button",{key:0,class:"composer-chip","data-chip":"mention",title:"插入 @ 提及文件",onClick:re[10]||(re[10]=je=>Ue("@"))},[K(me,{name:"at",size:14}),re[20]||(re[20]=h("span",null,"提及",-1))])):N("",!0),h("button",{class:"composer-chip","data-chip":"slash",title:e.variant==="home"?"插入 / 触发技能":"插入 / 触发指令",onClick:re[11]||(re[11]=je=>Ue("/"))},[K(me,{name:"command",size:14}),h("span",null,C(e.variant==="home"?"技能":"指令"),1)],8,M1),we.value.workspace.visible?(g(),v("span",R1,[h("button",{class:fe(["composer-chip workspace-select",{"is-clickable":we.value.workspace.enabled}]),"data-chip":"workspace",disabled:!we.value.workspace.enabled,title:we.value.workspace.title,"aria-haspopup":we.value.workspace.enabled?"dialog":void 0,"aria-expanded":Oe.value==="workspace"?"true":"false",onClick:re[12]||(re[12]=je=>bt("workspace",we.value.workspace.enabled))},[K(me,{name:"folder",size:14}),h("span",L1,C(we.value.workspace.label),1),we.value.workspace.enabled?(g(),Fe(me,{key:0,name:"chevron-down",size:12})):N("",!0)],10,P1),Oe.value==="workspace"?(g(),Fe(T1,{key:0,current:D(he)??"","default-dir":D(Se)??"","recent-work-dirs":e.recentWorkDirs,onSelect:It,onClose:re[13]||(re[13]=je=>Oe.value=null)},null,8,["current","default-dir","recent-work-dirs"])):N("",!0)])):N("",!0),we.value.model.visible?(g(),v("span",D1,[h("button",{class:fe(["composer-chip model-select",{"is-clickable":we.value.model.enabled}]),"data-chip":"model",disabled:!we.value.model.enabled,title:we.value.model.title,"aria-haspopup":we.value.model.enabled?"dialog":void 0,"aria-expanded":gt.value?"true":"false",onClick:re[14]||(re[14]=je=>bt("model",we.value.model.enabled))},[K(me,{name:"brain",size:14}),h("span",N1,C(we.value.model.label),1),we.value.model.enabled?(g(),Fe(me,{key:0,name:"chevron-down",size:12})):N("",!0)],10,O1),K(Il,{name:"picker"},{default:it(()=>[gt.value?(g(),Fe(Xk,{key:0,models:e.models,"current-model":Ke.value,"current-thinking":ne.value,onApplyModel:Cs,onApplyThinking:Jo,onClose:re[15]||(re[15]=je=>Oe.value=null)},null,8,["models","current-model","current-thinking"])):N("",!0)]),_:1})])):N("",!0),we.value.thinking.visible?(g(),Fe(ja,{key:3,class:"chip-slot",label:"思考力度",heading:"思考力度",groups:Ot.value,open:Oe.value==="thinking",placement:"top",align:"left","onUpdate:open":re[17]||(re[17]=je=>rn("thinking",je)),onSelect:Jo},{default:it(()=>[h("button",{class:fe(["composer-chip",{"is-clickable":we.value.thinking.enabled}]),"data-chip":"thinking",disabled:!we.value.thinking.enabled,title:we.value.thinking.title,"aria-haspopup":"menu","aria-expanded":Oe.value==="thinking"?"true":"false",onClick:re[16]||(re[16]=je=>bt("thinking",we.value.thinking.enabled))},[K(me,{name:"activity",size:14}),h("span",B1,C(we.value.thinking.label),1),K(me,{name:"chevron-down",size:12})],10,G1)]),_:1},8,["groups","open"])):N("",!0),we.value.permission.visible?(g(),Fe(ja,{key:4,class:"chip-slot",label:"权限模式",groups:$s.value,open:Oe.value==="permission",placement:"top",align:"left","onUpdate:open":re[19]||(re[19]=je=>rn("permission",je)),onSelect:Oi},{default:it(()=>[h("button",{class:fe(["composer-chip",["is-clickable",G.value]]),"data-chip":"permission",disabled:!we.value.permission.enabled,title:we.value.permission.title,"aria-haspopup":"menu","aria-expanded":Oe.value==="permission"?"true":"false",onClick:re[18]||(re[18]=je=>bt("permission",we.value.permission.enabled))},[K(me,{name:"shield",size:14}),h("span",j1,C(we.value.permission.label),1),K(me,{name:"chevron-down",size:12})],10,F1)]),_:1},8,["groups","open"])):N("",!0),we.value.context.visible?(g(),v("span",{key:5,class:"composer-chip is-static","data-chip":"context",title:we.value.context.title},[K(fh,{usage:de.value,size:14},null,8,["usage"]),h("span",z1,C(we.value.context.label),1)],8,U1)):N("",!0),y.value.length?(g(),v("span",{key:6,class:"composer-chip is-static","data-chip":"queue",title:`已排队 ${y.value.length} 条,当前回合结束后自动发送`},[K(me,{name:"queue",size:14}),h("span",W1,"排队 "+C(y.value.length),1)],8,H1)):N("",!0)]),h("button",{class:"composer-primary","data-action":Zt.value,disabled:pe.value,title:er.value,"aria-label":Zn.value,onClick:be},[K(me,{name:Qo.value,size:16},null,8,["name"]),Zt.value!=="send"?(g(),v("span",V1,C(Zn.value),1)):N("",!0)],8,q1)])],4))}}),hh=De(Z1,[["__scopeId","data-v-0d7ed99e"]]),Y1={class:"conv-bar"},X1={class:"conv-bar-left"},J1=["title"],Q1=["title"],ew={key:1,class:"title-text"},tw={class:"conv-bar-right"},nw=["title","aria-label","aria-expanded"],sw={key:0,class:"stats-metric mono"},ow={key:1,class:"stats-sep","aria-hidden":"true"},rw={key:2,class:"stats-metric mono"},iw=["aria-expanded"],aw=["title","aria-label"],lw=Le({__name:"ConversationHeader",props:{title:{default:null},busy:{type:Boolean,default:!1},statsOpen:{type:Boolean,default:!1},turnTokens:{default:null},turnCount:{default:null}},emits:["home","rename","export","fork","clear","toggle-stats"],setup(e,{emit:t}){const n=e,s=t,o=P(()=>Ce.panelOpen),r=P(()=>(n.turnCount??0)>0||(n.turnTokens??0)>0);function i(){Ce.panelOpen?Pl(!1):rh("detail")}function a(k){return k===null||k<=0?"":k>=1e6?`${(k/1e6).toFixed(1)}M`:k>=1e3?`${(k/1e3).toFixed(1)}k`:String(k)}const l=M(!1),u=P(()=>Fa([{key:"export",label:"导出 Markdown",icon:"download",disabled:!r.value,title:r.value?"把当前会话导出成 Markdown 文件":"还没有消息可导出"},{key:"fork",label:"分叉会话",icon:"fork",disabled:!r.value,title:r.value?"从当前会话分叉出新会话":"还没有消息可分叉"},{key:"clear",label:"清空本地消息",icon:"broom",tone:"danger",disabled:!r.value,title:r.value?"清空本地 journal(服务端记录不受影响)":"还没有消息可清空"},{key:"files",label:o.value?"收起文件面板":"打开文件面板",icon:"file",title:o.value?"收起右侧面板":"在右侧面板打开文件视图"}]));function c(k){l.value=!1,k==="export"?s("export"):k==="fork"?s("fork"):k==="clear"?s("clear"):k==="files"&&Ny()}const d=M(!1),f=M("");function p(){f.value=n.title??"",d.value=!0}function m(){const k=f.value.trim();d.value=!1,k&&k!==n.title&&s("rename",k)}function y(k){k.key==="Enter"?(k.preventDefault(),m()):k.key==="Escape"&&(k.preventDefault(),d.value=!1)}const b=P(()=>n.busy?"运行中":"就绪");return(k,w)=>(g(),v("header",Y1,[h("div",X1,[h("button",{class:"ghost-btn back-btn",title:"返回工作台","aria-label":"返回工作台",onClick:w[0]||(w[0]=S=>s("home"))},[K(me,{name:"chevron-left",size:20})]),h("span",{class:fe(["status-dot",{busy:e.busy}]),title:b.value,"aria-hidden":"true"},null,10,J1),h("button",{class:"title-btn",title:d.value?"":"点击重命名",onClick:p},[d.value?et((g(),v("input",{key:0,"onUpdate:modelValue":w[1]||(w[1]=S=>f.value=S),class:"title-input","aria-label":"会话标题",onKeydown:y,onBlur:m,onClick:w[2]||(w[2]=st(()=>{},["stop"]))},null,544)),[[ut,f.value]]):(g(),v("span",ew,C(e.title||"新会话"),1))],8,Q1)]),h("div",tw,[h("button",{class:fe(["ghost-btn stats-btn",{active:e.statsOpen}]),title:e.statsOpen?"收起会话统计":"会话统计:轮次与 token 用量","aria-label":e.statsOpen?"收起会话统计":"会话统计","aria-expanded":e.statsOpen,"data-stats-pill":"",onPointerdown:w[3]||(w[3]=st(()=>{},["stop"])),onClick:w[4]||(w[4]=S=>s("toggle-stats"))},[K(me,{name:"bar-chart",size:16}),e.turnCount?(g(),v("span",sw,C(e.turnCount)+" 轮",1)):N("",!0),e.turnCount&&a(e.turnTokens)?(g(),v("span",ow,"·")):N("",!0),a(e.turnTokens)?(g(),v("span",rw,C(a(e.turnTokens)),1)):N("",!0)],42,nw),K(ja,{open:l.value,"onUpdate:open":w[6]||(w[6]=S=>l.value=S),label:"更多会话操作",groups:u.value,placement:"bottom",align:"right",onSelect:c},{default:it(()=>[h("button",{class:fe(["ghost-btn more-btn",{active:l.value}]),title:"更多操作","aria-label":"更多操作","aria-haspopup":"menu","aria-expanded":l.value,onClick:w[5]||(w[5]=S=>l.value=!l.value)},[K(me,{name:"more",size:18})],10,iw)]),_:1},8,["open","groups"]),h("button",{class:fe(["ghost-btn",{active:o.value}]),title:o.value?"收起右栏":"打开右栏","aria-label":o.value?"收起右栏":"打开右栏",onClick:i},[K(me,{name:"panel-right",size:18})],10,aw)])]))}}),uw=De(lw,[["__scopeId","data-v-2143c508"]]),cw={key:0,class:"ui-dialog-header"},dw={class:"ui-dialog-title"},fw={class:"ui-dialog-body"},hw={key:1,class:"ui-dialog-footer"},pw='a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',gw=Le({__name:"Dialog",props:{open:{type:Boolean},title:{default:void 0},closable:{type:Boolean,default:!0},maxWidth:{default:void 0}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,o=M(null);let r=null;function i(){const l=o.value;return l?Array.from(l.querySelectorAll(pw)).filter(u=>u.offsetParent!==null||u===document.activeElement):[]}function a(l){var p,m,y;if(!n.open)return;if(l.key==="Escape"&&n.closable!==!1){l.stopPropagation(),s("close");return}if(l.key!=="Tab")return;const u=i();if(u.length===0){l.preventDefault(),(p=o.value)==null||p.focus();return}const c=u[0],d=u[u.length-1],f=document.activeElement;l.shiftKey?(f===c||!((m=o.value)!=null&&m.contains(f)))&&(l.preventDefault(),d.focus()):(f===d||!((y=o.value)!=null&&y.contains(f)))&&(l.preventDefault(),c.focus())}return xe(()=>n.open,l=>{l?(r=document.activeElement instanceof HTMLElement?document.activeElement:null,Ve(()=>{const u=i()[0]??o.value;u==null||u.focus()})):r&&(r.focus(),r=null)},{immediate:!1}),rt(()=>window.addEventListener("keydown",a,!0)),at(()=>window.removeEventListener("keydown",a,!0)),(l,u)=>(g(),Fe(Qs,{to:"body"},[K(Il,{name:"dialog"},{default:it(()=>[e.open?(g(),v("div",{key:0,class:"ui-dialog-overlay",onClick:u[1]||(u[1]=st(c=>e.closable!==!1&&s("close"),["self"]))},[h("div",{ref_key:"dialogRef",ref:o,class:"ui-dialog",style:yt(e.maxWidth?{maxWidth:e.maxWidth}:void 0),role:"dialog","aria-modal":"true",tabindex:"-1"},[e.title||l.$slots.header?(g(),v("div",cw,[So(l.$slots,"header",{},()=>[h("span",dw,C(e.title),1)],!0),e.closable!==!1?(g(),v("button",{key:0,class:"ui-dialog-close","aria-label":"关闭",onClick:u[0]||(u[0]=c=>s("close"))},"✕")):N("",!0)])):N("",!0),h("div",fw,[So(l.$slots,"default",{},void 0,!0)]),l.$slots.footer?(g(),v("div",hw,[So(l.$slots,"footer",{},void 0,!0)])):N("",!0)],4)])):N("",!0)]),_:3})]))}}),Gl=De(gw,[["__scopeId","data-v-396acebf"]]),mw={class:"info-row"},vw={class:"info-val mono"},yw={class:"info-row"},bw={class:"info-val mono"},kw={class:"info-row"},ww={class:"info-val"},Sw={class:"info-row"},_w={class:"info-val"},$w={class:"info-row"},Cw={class:"info-val"},xw={class:"info-row"},Tw={class:"info-val"},Iw={class:"info-row"},Ew={class:"info-val"},Aw={class:"info-row"},Mw={class:"info-val"},Rw={class:"info-row"},Pw={class:"info-val"},Lw={class:"info-row"},Dw={class:"info-val"},Ow={key:0,class:"info-row"},Nw={class:"info-val"},Gw={key:1,class:"info-row"},Bw={class:"info-val"},Fw={class:"info-val mono"},jw={class:"info-val"},Uw={key:3,class:"info-empty"},zw=Le({__name:"InfoPanel",props:{mode:{},status:{},sessionId:{},workDir:{}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,o=P(()=>n.mode==="status"?"会话状态":"Token 用量");function r(p){switch(p){case"auto":return"自动 (auto)";case"yolo":return"YOLO";case"manual":return"手动 (manual)";default:return p??"-"}}function i(p){return p?"开启":"关闭"}function a(p){return p!=null}function l(p){return typeof p=="number"?p.toLocaleString():"-"}function u(p){return typeof p!="number"?"-":`${(p>1?p:p*100).toFixed(1)}%`}function c(p){return p?p.inputOther+p.output+p.inputCacheRead+p.inputCacheCreation:0}function d(p){return p!=null&&p.byModel?Object.entries(p.byModel).map(([m,y])=>({model:m,tokens:c(y),output:y.output,cacheRead:y.inputCacheRead})):[]}const f=P(()=>a(n.status.usage)||a(n.status.contextTokens));return(p,m)=>(g(),Fe(Gl,{open:!0,title:o.value,onClose:m[0]||(m[0]=y=>s("close"))},{default:it(()=>{var y,b;return[e.mode==="status"?(g(),v(X,{key:0},[h("div",mw,[m[1]||(m[1]=h("span",{class:"info-key"},"会话 ID",-1)),h("span",vw,C(e.sessionId??"-"),1)]),h("div",yw,[m[2]||(m[2]=h("span",{class:"info-key"},"工作目录",-1)),h("span",bw,C(e.workDir??"-"),1)]),h("div",kw,[m[3]||(m[3]=h("span",{class:"info-key"},"模型",-1)),h("span",ww,C(e.status.model??"-"),1)]),h("div",Sw,[m[4]||(m[4]=h("span",{class:"info-key"},"权限模式",-1)),h("span",_w,C(r(e.status.permission)),1)]),h("div",$w,[m[5]||(m[5]=h("span",{class:"info-key"},"思考级别",-1)),h("span",Cw,C(e.status.thinkingLevel??"-"),1)]),h("div",xw,[m[6]||(m[6]=h("span",{class:"info-key"},"计划模式",-1)),h("span",Tw,C(i(e.status.planMode)),1)]),h("div",Iw,[m[7]||(m[7]=h("span",{class:"info-key"},"WolfPack 模式",-1)),h("span",Ew,C(i(e.status.wolfpackMode)),1)]),h("div",Aw,[m[8]||(m[8]=h("span",{class:"info-key"},"上下文",-1)),h("span",Mw,C(l(e.status.contextTokens))+" / "+C(l(e.status.maxContextTokens))+" ("+C(u(e.status.contextUsage))+")",1)])],64)):(g(),v(X,{key:1},[h("div",Rw,[m[9]||(m[9]=h("span",{class:"info-key"},"上下文 Token",-1)),h("span",Pw,C(l(e.status.contextTokens))+" / "+C(l(e.status.maxContextTokens)),1)]),h("div",Lw,[m[10]||(m[10]=h("span",{class:"info-key"},"上下文占比",-1)),h("span",Dw,C(u(e.status.contextUsage)),1)]),(y=e.status.usage)!=null&&y.total?(g(),v("div",Ow,[m[11]||(m[11]=h("span",{class:"info-key"},"累计 Token",-1)),h("span",Nw,C(l(c(e.status.usage.total))),1)])):N("",!0),(b=e.status.usage)!=null&&b.currentTurn?(g(),v("div",Gw,[m[12]||(m[12]=h("span",{class:"info-key"},"当前回合",-1)),h("span",Bw,C(l(c(e.status.usage.currentTurn))),1)])):N("",!0),d(e.status.usage).length?(g(),v(X,{key:2},[m[13]||(m[13]=h("div",{class:"info-subhead"},"按模型",-1)),(g(!0),v(X,null,Me(d(e.status.usage),k=>(g(),v("div",{key:k.model,class:"info-row info-row-model"},[h("span",Fw,C(k.model),1),h("span",jw,C(l(k.tokens))+"(输出 "+C(l(k.output))+" · 缓存读 "+C(l(k.cacheRead))+")",1)]))),128))],64)):N("",!0),f.value?N("",!0):(g(),v("div",Uw,"暂无用量数据"))],64))]}),_:1},8,["title"]))}}),ph=De(zw,[["__scopeId","data-v-1555711d"]]);function Hw(e,t=Date.now()){const n=new Date(e),s=new Date(t),o=n.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()&&n.getDate()===s.getDate()?o:`${n.getFullYear()===s.getFullYear()?`${n.getMonth()+1}月${n.getDate()}日`:`${n.getFullYear()}年${n.getMonth()+1}月${n.getDate()}日`} ${o}`}function Ww(e,t){const n=new Date(e),s=new Date(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()&&n.getDate()===s.getDate()}function qw(e,t=Date.now()){const n=new Date(e),s=new Date(t);return n.getFullYear()===s.getFullYear()?`${n.getMonth()+1}月${n.getDate()}日`:`${n.getFullYear()}年${n.getMonth()+1}月${n.getDate()}日`}const Vw=new Set(["edit","str_replace","replace","write","multi_edit","create_file","edit_file","apply_patch"]);function gh(e){return Vw.has(e.toLowerCase())}function Ti(e,t=!0){return e.suspended?"suspended":e.isError?"error":e.output===void 0?t?"running":"unknown":"ok"}function Kw(e,t=!0){const n=new Set(e.map(s=>Ti(s,t)));return n.has("running")?"running":n.has("error")?"error":n.has("suspended")?"suspended":n.has("unknown")?"unknown":"ok"}function Zw(e){if(!e||typeof e!="object")return null;const t=e,n=t.file_path??t.path;return typeof n=="string"&&n.length>0?n:null}function Bl(e,t){if(e.startsWith("/")||e.startsWith("~"))return e;let n=e;for(;n.startsWith("./");)n=n.slice(2);return t?`${t.replace(/\/+$/,"")}/${n}`:n}function Yw(e,t){const n=new Set,s=[];for(const o of e.tools){if(!gh(o.name)||Ti(o,!1)!=="ok")continue;const r=Zw(o.args);if(!r)continue;const i=Bl(r,t);n.has(i)||(n.add(i),s.push({filePath:i,toolName:o.name}))}return s}function Fl(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ws=Fl();function mh(e){ws=e}var Co={exec:()=>null};function Je(e,t=""){let n=typeof e=="string"?e:e.source;const s={replace:(o,r)=>{let i=typeof r=="string"?r:r.source;return i=i.replace(Lt.caret,"$1"),n=n.replace(o,i),s},getRegex:()=>new RegExp(n,t)};return s}var Lt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Xw=/^(?:[ \t]*(?:\n|$))+/,Jw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Qw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ko=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,e0=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,jl=/(?:[*+-]|\d{1,9}[.)])/,vh=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,yh=Je(vh).replace(/bull/g,jl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),t0=Je(vh).replace(/bull/g,jl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ul=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,n0=/^[^\n]+/,zl=/(?!\s*\])(?:\\.|[^\[\]\\])+/,s0=Je(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zl).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),o0=Je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,jl).getRegex(),Ii="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Hl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,r0=Je("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Hl).replace("tag",Ii).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),bh=Je(Ul).replace("hr",Ko).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ii).getRegex(),i0=Je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",bh).getRegex(),Wl={blockquote:i0,code:Jw,def:s0,fences:Qw,heading:e0,hr:Ko,html:r0,lheading:yh,list:o0,newline:Xw,paragraph:bh,table:Co,text:n0},yc=Je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ko).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ii).getRegex(),a0={...Wl,lheading:t0,table:yc,paragraph:Je(Ul).replace("hr",Ko).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",yc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ii).getRegex()},l0={...Wl,html:Je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Hl).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Co,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Je(Ul).replace("hr",Ko).replace("heading",` *#{1,6} *[^
|
|
21
|
+
]`).replace("lheading",yh).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},u0=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,c0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,kh=/^( {2,}|\\)\n(?!\s*$)/,d0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ei=/[\p{P}\p{S}]/u,ql=/[\s\p{P}\p{S}]/u,wh=/[^\s\p{P}\p{S}]/u,f0=Je(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ql).getRegex(),Sh=/(?!~)[\p{P}\p{S}]/u,h0=/(?!~)[\s\p{P}\p{S}]/u,p0=/(?:[^\s\p{P}\p{S}]|~)/u,g0=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,_h=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,m0=Je(_h,"u").replace(/punct/g,Ei).getRegex(),v0=Je(_h,"u").replace(/punct/g,Sh).getRegex(),$h="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",y0=Je($h,"gu").replace(/notPunctSpace/g,wh).replace(/punctSpace/g,ql).replace(/punct/g,Ei).getRegex(),b0=Je($h,"gu").replace(/notPunctSpace/g,p0).replace(/punctSpace/g,h0).replace(/punct/g,Sh).getRegex(),k0=Je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,wh).replace(/punctSpace/g,ql).replace(/punct/g,Ei).getRegex(),w0=Je(/\\(punct)/,"gu").replace(/punct/g,Ei).getRegex(),S0=Je(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_0=Je(Hl).replace("(?:-->|$)","-->").getRegex(),$0=Je("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zr=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,C0=Je(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Zr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ch=Je(/^!?\[(label)\]\[(ref)\]/).replace("label",Zr).replace("ref",zl).getRegex(),xh=Je(/^!?\[(ref)\](?:\[\])?/).replace("ref",zl).getRegex(),x0=Je("reflink|nolink(?!\\()","g").replace("reflink",Ch).replace("nolink",xh).getRegex(),Vl={_backpedal:Co,anyPunctuation:w0,autolink:S0,blockSkip:g0,br:kh,code:c0,del:Co,emStrongLDelim:m0,emStrongRDelimAst:y0,emStrongRDelimUnd:k0,escape:u0,link:C0,nolink:xh,punctuation:f0,reflink:Ch,reflinkSearch:x0,tag:$0,text:d0,url:Co},T0={...Vl,link:Je(/^!?\[(label)\]\((.*?)\)/).replace("label",Zr).getRegex(),reflink:Je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zr).getRegex()},Ua={...Vl,emStrongRDelimAst:b0,emStrongLDelim:v0,url:Je(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},I0={...Ua,br:Je(kh).replace("{2,}","*").getRegex(),text:Je(Ua.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},rr={normal:Wl,gfm:a0,pedantic:l0},uo={normal:Vl,gfm:Ua,breaks:I0,pedantic:T0},E0={"&":"&","<":"<",">":">",'"':""","'":"'"},bc=e=>E0[e];function un(e,t){if(t){if(Lt.escapeTest.test(e))return e.replace(Lt.escapeReplace,bc)}else if(Lt.escapeTestNoEncode.test(e))return e.replace(Lt.escapeReplaceNoEncode,bc);return e}function kc(e){try{e=encodeURI(e).replace(Lt.percentDecode,"%")}catch{return null}return e}function wc(e,t){var r;const n=e.replace(Lt.findPipe,(i,a,l)=>{let u=!1,c=a;for(;--c>=0&&l[c]==="\\";)u=!u;return u?"|":" |"}),s=n.split(Lt.splitPipe);let o=0;if(s[0].trim()||s.shift(),s.length>0&&!((r=s.at(-1))!=null&&r.trim())&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;o<s.length;o++)s[o]=s[o].trim().replace(Lt.slashPipe,"|");return s}function co(e,t,n){const s=e.length;if(s===0)return"";let o=0;for(;o<s&&e.charAt(s-o-1)===t;)o++;return e.slice(0,s-o)}function A0(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Sc(e,t,n,s,o){const r=t.href,i=t.title||null,a=e[1].replace(o.other.outputLinkReplace,"$1");s.state.inLink=!0;const l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:r,title:i,text:a,tokens:s.inlineTokens(a)};return s.state.inLink=!1,l}function M0(e,t,n){const s=e.match(n.other.indentCodeCompensation);if(s===null)return t;const o=s[1];return t.split(`
|
|
22
|
+
`).map(r=>{const i=r.match(n.other.beginningSpace);if(i===null)return r;const[a]=i;return a.length>=o.length?r.slice(o.length):r}).join(`
|
|
23
|
+
`)}var Yr=class{constructor(e){V(this,"options");V(this,"rules");V(this,"lexer");this.options=e||ws}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:co(n,`
|
|
24
|
+
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],s=M0(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const s=co(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:co(t[0],`
|
|
25
|
+
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=co(t[0],`
|
|
26
|
+
`).split(`
|
|
27
|
+
`),s="",o="";const r=[];for(;n.length>0;){let i=!1;const a=[];let l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),i=!0;else if(!i)a.push(n[l]);else break;n=n.slice(l);const u=a.join(`
|
|
28
|
+
`),c=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
29
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
30
|
+
${u}`:u,o=o?`${o}
|
|
31
|
+
${c}`:c;const d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,r,!0),this.lexer.state.top=d,n.length===0)break;const f=r.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){const p=f,m=p.raw+`
|
|
32
|
+
`+n.join(`
|
|
33
|
+
`),y=this.blockquote(m);r[r.length-1]=y,s=s.substring(0,s.length-p.raw.length)+y.raw,o=o.substring(0,o.length-p.text.length)+y.text;break}else if((f==null?void 0:f.type)==="list"){const p=f,m=p.raw+`
|
|
34
|
+
`+n.join(`
|
|
35
|
+
`),y=this.list(m);r[r.length-1]=y,s=s.substring(0,s.length-f.raw.length)+y.raw,o=o.substring(0,o.length-p.raw.length)+y.raw,n=m.substring(r.at(-1).raw.length).split(`
|
|
36
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:r,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,o={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const r=this.rules.other.listItemRegex(n);let i=!1;for(;e;){let l=!1,u="",c="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let d=t[2].split(`
|
|
37
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),f=e.split(`
|
|
38
|
+
`,1)[0],p=!d.trim(),m=0;if(this.options.pedantic?(m=2,c=d.trimStart()):p?m=t[1].length+1:(m=t[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,c=d.slice(m),m+=t[1].length),p&&this.rules.other.blankLine.test(f)&&(u+=f+`
|
|
39
|
+
`,e=e.substring(f.length+1),l=!0),!l){const k=this.rules.other.nextBulletRegex(m),w=this.rules.other.hrRegex(m),S=this.rules.other.fencesBeginRegex(m),I=this.rules.other.headingBeginRegex(m),q=this.rules.other.htmlBeginRegex(m);for(;e;){const B=e.split(`
|
|
40
|
+
`,1)[0];let R;if(f=B,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),R=f):R=f.replace(this.rules.other.tabCharGlobal," "),S.test(f)||I.test(f)||q.test(f)||k.test(f)||w.test(f))break;if(R.search(this.rules.other.nonSpaceChar)>=m||!f.trim())c+=`
|
|
41
|
+
`+R.slice(m);else{if(p||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||S.test(d)||I.test(d)||w.test(d))break;c+=`
|
|
42
|
+
`+f}!p&&!f.trim()&&(p=!0),u+=B+`
|
|
43
|
+
`,e=e.substring(B.length+1),d=R.slice(m)}}o.loose||(i?o.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(i=!0));let y=null,b;this.options.gfm&&(y=this.rules.other.listIsTask.exec(c),y&&(b=y[0]!=="[ ] ",c=c.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:u,task:!!y,checked:b,loose:!1,text:c,tokens:[]}),o.raw+=u}const a=o.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let l=0;l<o.items.length;l++)if(this.lexer.state.top=!1,o.items[l].tokens=this.lexer.blockTokens(o.items[l].text,[]),!o.loose){const u=o.items[l].tokens.filter(d=>d.type==="space"),c=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));o.loose=c}if(o.loose)for(let l=0;l<o.items.length;l++)o.items[l].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:o}}}table(e){var i;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=wc(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(i=t[3])!=null&&i.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
44
|
+
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const a of s)this.rules.other.tableAlignRight.test(a)?r.align.push("right"):this.rules.other.tableAlignCenter.test(a)?r.align.push("center"):this.rules.other.tableAlignLeft.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<n.length;a++)r.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:r.align[a]});for(const a of o)r.rows.push(wc(a,r.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[u]})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
|
45
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const r=co(n.slice(0,-1),"\\");if((n.length-r.length)%2===0)return}else{const r=A0(t[2],"()");if(r===-2)return;if(r>-1){const a=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let s=t[2],o="";if(this.options.pedantic){const r=this.rules.other.pedanticHrefTitle.exec(s);r&&(s=r[1],o=r[3])}else o=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Sc(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[s.toLowerCase()];if(!o){const r=n[0].charAt(0);return{type:"text",raw:r,text:r}}return Sc(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const r=[...s[0]].length-1;let i,a,l=r,u=0;const c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+r);(s=c.exec(t))!=null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){l+=a;continue}else if((s[5]||s[6])&&r%3&&!((r+a)%3)){u+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+u);const d=[...s[0]][0].length,f=e.slice(0,r+s.index+d+a);if(Math.min(r,a)%2){const m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}const p=f.slice(2,-2);return{type:"strong",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const s=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let s,o;if(t[2]==="@")s=t[0],o="mailto:"+s;else{let r;do r=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(r!==t[0]);s=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:s,href:o,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},$n=class za{constructor(t){V(this,"tokens");V(this,"options");V(this,"state");V(this,"tokenizer");V(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||ws,this.options.tokenizer=this.options.tokenizer||new Yr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:Lt,block:rr.normal,inline:uo.normal};this.options.pedantic?(n.block=rr.pedantic,n.inline=uo.pedantic):this.options.gfm&&(n.block=rr.gfm,this.options.breaks?n.inline=uo.breaks:n.inline=uo.gfm),this.tokenizer.rules=n}static get rules(){return{block:rr,inline:uo}}static lex(t,n){return new za(n).lex(t)}static lexInline(t,n){return new za(n).inlineTokens(t)}lex(t){t=t.replace(Lt.carriageReturn,`
|
|
46
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){var o,r,i;for(this.options.pedantic&&(t=t.replace(Lt.tabCharGlobal," ").replace(Lt.spaceLine,""));t;){let a;if((r=(o=this.options.extensions)==null?void 0:o.block)!=null&&r.some(u=>(a=u.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);const u=n.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
|
|
47
|
+
`:n.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);const u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=`
|
|
48
|
+
`+a.raw,u.text+=`
|
|
49
|
+
`+a.text,this.inlineQueue.at(-1).src=u.text):n.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);const u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=`
|
|
50
|
+
`+a.raw,u.text+=`
|
|
51
|
+
`+a.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),n.push(a);continue}let l=t;if((i=this.options.extensions)!=null&&i.startBlock){let u=1/0;const c=t.slice(1);let d;this.options.extensions.startBlock.forEach(f=>{d=f.call({lexer:this},c),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(l=t.substring(0,u+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){const u=n.at(-1);s&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=`
|
|
52
|
+
`+a.raw,u.text+=`
|
|
53
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(a),s=l.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);const u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=`
|
|
54
|
+
`+a.raw,u.text+=`
|
|
55
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(a);continue}if(t){const u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var a,l,u;let s=t,o=null;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)c.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,o.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(o=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let r=!1,i="";for(;t;){r||(i=""),r=!1;let c;if((l=(a=this.options.extensions)==null?void 0:a.inline)!=null&&l.some(f=>(c=f.call({lexer:this},t,n))?(t=t.substring(c.raw.length),n.push(c),!0):!1))continue;if(c=this.tokenizer.escape(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.tag(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.link(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(c.raw.length);const f=n.at(-1);c.type==="text"&&(f==null?void 0:f.type)==="text"?(f.raw+=c.raw,f.text+=c.text):n.push(c);continue}if(c=this.tokenizer.emStrong(t,s,i)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.codespan(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.br(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.del(t)){t=t.substring(c.raw.length),n.push(c);continue}if(c=this.tokenizer.autolink(t)){t=t.substring(c.raw.length),n.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(t))){t=t.substring(c.raw.length),n.push(c);continue}let d=t;if((u=this.options.extensions)!=null&&u.startInline){let f=1/0;const p=t.slice(1);let m;this.options.extensions.startInline.forEach(y=>{m=y.call({lexer:this},p),typeof m=="number"&&m>=0&&(f=Math.min(f,m))}),f<1/0&&f>=0&&(d=t.substring(0,f+1))}if(c=this.tokenizer.inlineText(d)){t=t.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(i=c.raw.slice(-1)),r=!0;const f=n.at(-1);(f==null?void 0:f.type)==="text"?(f.raw+=c.raw,f.text+=c.text):n.push(c);continue}if(t){const f="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return n}},Xr=class{constructor(e){V(this,"options");V(this,"parser");this.options=e||ws}space(e){return""}code({text:e,lang:t,escaped:n}){var r;const s=(r=(t||"").match(Lt.notSpaceStart))==null?void 0:r[0],o=e.replace(Lt.endingNewline,"")+`
|
|
56
|
+
`;return s?'<pre><code class="language-'+un(s)+'">'+(n?o:un(o,!0))+`</code></pre>
|
|
57
|
+
`:"<pre><code>"+(n?o:un(o,!0))+`</code></pre>
|
|
58
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
59
|
+
${this.parser.parse(e)}</blockquote>
|
|
60
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
61
|
+
`}hr(e){return`<hr>
|
|
62
|
+
`}list(e){const t=e.ordered,n=e.start;let s="";for(let i=0;i<e.items.length;i++){const a=e.items[i];s+=this.listitem(a)}const o=t?"ol":"ul",r=t&&n!==1?' start="'+n+'"':"";return"<"+o+r+`>
|
|
63
|
+
`+s+"</"+o+`>
|
|
64
|
+
`}listitem(e){var n;let t="";if(e.task){const s=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=s+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=s+" "+un(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:s+" ",text:s+" ",escaped:!0}):t+=s+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
65
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
66
|
+
`}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let s="";for(let o=0;o<e.rows.length;o++){const r=e.rows[o];n="";for(let i=0;i<r.length;i++)n+=this.tablecell(r[i]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
67
|
+
<thead>
|
|
68
|
+
`+t+`</thead>
|
|
69
|
+
`+s+`</table>
|
|
70
|
+
`}tablerow({text:e}){return`<tr>
|
|
71
|
+
${e}</tr>
|
|
72
|
+
`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
73
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${un(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),o=kc(e);if(o===null)return s;e=o;let r='<a href="'+e+'"';return t&&(r+=' title="'+un(t)+'"'),r+=">"+s+"</a>",r}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));const o=kc(e);if(o===null)return un(n);e=o;let r=`<img src="${e}" alt="${n}"`;return t&&(r+=` title="${un(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:un(e.text)}},Kl=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Cn=class Ha{constructor(t){V(this,"options");V(this,"renderer");V(this,"textRenderer");this.options=t||ws,this.options.renderer=this.options.renderer||new Xr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Kl}static parse(t,n){return new Ha(n).parse(t)}static parseInline(t,n){return new Ha(n).parseInline(t)}parse(t,n=!0){var o,r;let s="";for(let i=0;i<t.length;i++){const a=t[i];if((r=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&r[a.type]){const u=a,c=this.options.extensions.renderers[u.type].call({parser:this},u);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type)){s+=c||"";continue}}const l=a;switch(l.type){case"space":{s+=this.renderer.space(l);continue}case"hr":{s+=this.renderer.hr(l);continue}case"heading":{s+=this.renderer.heading(l);continue}case"code":{s+=this.renderer.code(l);continue}case"table":{s+=this.renderer.table(l);continue}case"blockquote":{s+=this.renderer.blockquote(l);continue}case"list":{s+=this.renderer.list(l);continue}case"html":{s+=this.renderer.html(l);continue}case"paragraph":{s+=this.renderer.paragraph(l);continue}case"text":{let u=l,c=this.renderer.text(u);for(;i+1<t.length&&t[i+1].type==="text";)u=t[++i],c+=`
|
|
74
|
+
`+this.renderer.text(u);n?s+=this.renderer.paragraph({type:"paragraph",raw:c,text:c,tokens:[{type:"text",raw:c,text:c,escaped:!0}]}):s+=c;continue}default:{const u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return s}parseInline(t,n=this.renderer){var o,r;let s="";for(let i=0;i<t.length;i++){const a=t[i];if((r=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&r[a.type]){const u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){s+=u||"";continue}}const l=a;switch(l.type){case"escape":{s+=n.text(l);break}case"html":{s+=n.html(l);break}case"link":{s+=n.link(l);break}case"image":{s+=n.image(l);break}case"strong":{s+=n.strong(l);break}case"em":{s+=n.em(l);break}case"codespan":{s+=n.codespan(l);break}case"br":{s+=n.br(l);break}case"del":{s+=n.del(l);break}case"text":{s+=n.text(l);break}default:{const u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return s}},wa,_r=(wa=class{constructor(e){V(this,"options");V(this,"block");this.options=e||ws}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?$n.lex:$n.lexInline}provideParser(){return this.block?Cn.parse:Cn.parseInline}},V(wa,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),wa),R0=class{constructor(...e){V(this,"defaults",Fl());V(this,"options",this.setOptions);V(this,"parse",this.parseMarkdown(!0));V(this,"parseInline",this.parseMarkdown(!1));V(this,"Parser",Cn);V(this,"Renderer",Xr);V(this,"TextRenderer",Kl);V(this,"Lexer",$n);V(this,"Tokenizer",Yr);V(this,"Hooks",_r);this.use(...e)}walkTokens(e,t){var s,o;let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{const i=r;for(const a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(const a of i.rows)for(const l of a)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{const i=r;n=n.concat(this.walkTokens(i.items,t));break}default:{const i=r;(o=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&o[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{const l=i[a].flat(1/0);n=n.concat(this.walkTokens(l,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const r=t.renderers[o.name];r?t.renderers[o.name]=function(...i){let a=o.renderer.apply(this,i);return a===!1&&(a=r.apply(this,i)),a}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[o.level];r?r.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),s.extensions=t),n.renderer){const o=this.defaults.renderer||new Xr(this.defaults);for(const r in n.renderer){if(!(r in o))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const i=r,a=n.renderer[i],l=o[i];o[i]=(...u)=>{let c=a.apply(o,u);return c===!1&&(c=l.apply(o,u)),c||""}}s.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new Yr(this.defaults);for(const r in n.tokenizer){if(!(r in o))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const i=r,a=n.tokenizer[i],l=o[i];o[i]=(...u)=>{let c=a.apply(o,u);return c===!1&&(c=l.apply(o,u)),c}}s.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new _r;for(const r in n.hooks){if(!(r in o))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;const i=r,a=n.hooks[i],l=o[i];_r.passThroughHooks.has(r)?o[i]=u=>{if(this.defaults.async)return Promise.resolve(a.call(o,u)).then(d=>l.call(o,d));const c=a.call(o,u);return l.call(o,c)}:o[i]=(...u)=>{let c=a.apply(o,u);return c===!1&&(c=l.apply(o,u)),c}}s.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,r=n.walkTokens;s.walkTokens=function(i){let a=[];return a.push(r.call(this,i)),o&&(a=a.concat(o.call(this,i))),a}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return $n.lex(e,t??this.defaults)}parser(e,t){return Cn.parse(e,t??this.defaults)}parseMarkdown(e){return(n,s)=>{const o={...s},r={...this.defaults,...o},i=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&o.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));r.hooks&&(r.hooks.options=r,r.hooks.block=e);const a=r.hooks?r.hooks.provideLexer():e?$n.lex:$n.lexInline,l=r.hooks?r.hooks.provideParser():e?Cn.parse:Cn.parseInline;if(r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(n):n).then(u=>a(u,r)).then(u=>r.hooks?r.hooks.processAllTokens(u):u).then(u=>r.walkTokens?Promise.all(this.walkTokens(u,r.walkTokens)).then(()=>u):u).then(u=>l(u,r)).then(u=>r.hooks?r.hooks.postprocess(u):u).catch(i);try{r.hooks&&(n=r.hooks.preprocess(n));let u=a(n,r);r.hooks&&(u=r.hooks.processAllTokens(u)),r.walkTokens&&this.walkTokens(u,r.walkTokens);let c=l(u,r);return r.hooks&&(c=r.hooks.postprocess(c)),c}catch(u){return i(u)}}}onError(e,t){return n=>{if(n.message+=`
|
|
75
|
+
Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+un(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},ys=new R0;function Ye(e,t){return ys.parse(e,t)}Ye.options=Ye.setOptions=function(e){return ys.setOptions(e),Ye.defaults=ys.defaults,mh(Ye.defaults),Ye};Ye.getDefaults=Fl;Ye.defaults=ws;Ye.use=function(...e){return ys.use(...e),Ye.defaults=ys.defaults,mh(Ye.defaults),Ye};Ye.walkTokens=function(e,t){return ys.walkTokens(e,t)};Ye.parseInline=ys.parseInline;Ye.Parser=Cn;Ye.parser=Cn.parse;Ye.Renderer=Xr;Ye.TextRenderer=Kl;Ye.Lexer=$n;Ye.lexer=$n.lex;Ye.Tokenizer=Yr;Ye.Hooks=_r;Ye.parse=Ye;Ye.options;Ye.setOptions;Ye.use;Ye.walkTokens;Ye.parseInline;Cn.parse;$n.lex;const P0="modulepreload",L0=function(e,t){return new URL(e,t).href},_c={},He=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let i=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const a=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=i(n.map(c=>{if(c=L0(c,s),c in _c)return;_c[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(!!s)for(let y=a.length-1;y>=0;y--){const b=a[y];if(b.href===c&&(!d||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":P0,d||(m.as="script"),m.crossOrigin="",m.href=c,u&&m.setAttribute("nonce",u),document.head.appendChild(m),d)return new Promise((y,b)=>{m.addEventListener("load",y),m.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return o.then(i=>{for(const a of i||[])a.status==="rejected"&&r(a.reason);return t().catch(r)})};let mt=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function D0(e){return Zl(e)}function Zl(e){return Array.isArray(e)?O0(e):e instanceof RegExp?e:typeof e=="object"?N0(e):e}function O0(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=Zl(e[n]);return t}function N0(e){let t={};for(let n in e)t[n]=Zl(e[n]);return t}function Th(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function Ih(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Ih(e.substring(0,e.length-1)):e.substr(~t+1)}var Ji=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ir=class{static hasCaptures(e){return e===null?!1:(Ji.lastIndex=0,Ji.test(e))}static replaceCaptures(e,t,n){return e.replace(Ji,(s,o,r,i)=>{let a=n[parseInt(o||r,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(i){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return s})}};function Eh(e,t){return e<t?-1:e>t?1:0}function Ah(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let o=0;o<n;o++){let r=Eh(e[o],t[o]);if(r!==0)return r}return 0}return n-s}function $c(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Mh(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Rh=class{constructor(e){V(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Jr=class{constructor(e,t,n){V(this,"_cachedMatchRoot",new Rh(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(F0(e),t)}static createFromParsedTheme(e,t){return U0(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,s=this._cachedMatchRoot.get(t).find(o=>G0(e.parent,o.parentScopes));return s?new Ph(s.fontStyle,s.foreground,s.background):null}},Qi=class $r{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new $r(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new $r(n,t[s]);return n}push(t){return new $r(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let s=this;for(;s&&s!==t;)n.push(s.scopeName),s=s.parent;return s===t?n.reverse():void 0}};function G0(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],o=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],o=!0}for(;e&&!B0(e.scopeName,s);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function B0(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Ph=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function F0(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let o=0,r=t.length;o<r;o++){let i=t[o];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let d=i.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),a=d.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let d=i.settings.fontStyle.split(" ");for(let f=0,p=d.length;f<p;f++)switch(d[f]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let u=null;typeof i.settings.foreground=="string"&&$c(i.settings.foreground)&&(u=i.settings.foreground);let c=null;typeof i.settings.background=="string"&&$c(i.settings.background)&&(c=i.settings.background);for(let d=0,f=a.length;d<f;d++){let m=a[d].trim().split(" "),y=m[m.length-1],b=null;m.length>1&&(b=m.slice(0,m.length-1),b.reverse()),n[s++]=new j0(y,b,o,l,u,c)}}return n}var j0=class{constructor(e,t,n,s,o,r){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=o,this.background=r}},Tt=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Tt||{});function U0(e,t){e.sort((l,u)=>{let c=Eh(l.scope,u.scope);return c!==0||(c=Ah(l.parentScopes,u.parentScopes),c!==0)?c:l.index-u.index});let n=0,s="#000000",o="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(s=l.foreground),l.background!==null&&(o=l.background)}let r=new z0(t),i=new Ph(n,r.getId(s),r.getId(o)),a=new W0(new Wa(0,null,-1,0,0),[]);for(let l=0,u=e.length;l<u;l++){let c=e[l];a.insert(0,c.scope,c.parentScopes,c.fontStyle,r.getId(c.foreground),r.getId(c.background))}return new Jr(r,i,a)}var z0=class{constructor(e){V(this,"_isFrozen");V(this,"_lastColorId");V(this,"_id2color");V(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},H0=Object.freeze([]),Wa=class Lh{constructor(t,n,s,o,r){V(this,"scopeDepth");V(this,"parentScopes");V(this,"fontStyle");V(this,"foreground");V(this,"background");this.scopeDepth=t,this.parentScopes=n||H0,this.fontStyle=s,this.foreground=o,this.background=r}clone(){return new Lh(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,o=t.length;s<o;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,o){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),o!==0&&(this.background=o)}},W0=class qa{constructor(t,n=[],s={}){V(this,"_rulesWithParentScopes");this._mainRule=t,this._children=s,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let s=0,o=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[o]===">"&&o++,!(s>=t.parentScopes.length||o>=n.parentScopes.length);){const r=n.parentScopes[o].length-t.parentScopes[s].length;if(r!==0)return r;s++,o++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),o,r;if(s===-1?(o=t,r=""):(o=t.substring(0,s),r=t.substring(s+1)),this._children.hasOwnProperty(o))return this._children[o].match(r)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(qa._cmpBySpecificity),n}insert(t,n,s,o,r,i){if(n===""){this._doInsertHere(t,s,o,r,i);return}let a=n.indexOf("."),l,u;a===-1?(l=n,u=""):(l=n.substring(0,a),u=n.substring(a+1));let c;this._children.hasOwnProperty(l)?c=this._children[l]:(c=new qa(this._mainRule.clone(),Wa.cloneArr(this._rulesWithParentScopes)),this._children[l]=c),c.insert(t+1,u,s,o,r,i)}_doInsertHere(t,n,s,o,r){if(n===null){this._mainRule.acceptOverwrite(t,s,o,r);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let l=this._rulesWithParentScopes[i];if(Ah(l.parentScopes,n)===0){l.acceptOverwrite(t,s,o,r);return}}s===-1&&(s=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new Wa(t,n,s,o,r))}},Js=class jt{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=jt.getLanguageId(t),s=jt.getTokenType(t),o=jt.getFontStyle(t),r=jt.getForeground(t),i=jt.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:o,foreground:r,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,s,o,r,i,a){let l=jt.getLanguageId(t),u=jt.getTokenType(t),c=jt.containsBalancedBrackets(t)?1:0,d=jt.getFontStyle(t),f=jt.getForeground(t),p=jt.getBackground(t);return n!==0&&(l=n),s!==8&&(u=s),o!==null&&(c=o?1:0),r!==-1&&(d=r),i!==0&&(f=i),a!==0&&(p=a),(l<<0|u<<8|c<<10|d<<11|f<<15|p<<24)>>>0}};function Qr(e,t){const n=[],s=q0(e);let o=s.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=s.next()}let u=i();if(n.push({matcher:u,priority:l}),o!==",")break;o=s.next()}return n;function r(){if(o==="-"){o=s.next();const l=r();return u=>!!l&&!l(u)}if(o==="("){o=s.next();const l=a();return o===")"&&(o=s.next()),l}if(Cc(o)){const l=[];do l.push(o),o=s.next();while(Cc(o));return u=>t(l,u)}return null}function i(){const l=[];let u=r();for(;u;)l.push(u),u=r();return c=>l.every(d=>d(c))}function a(){const l=[];let u=i();for(;u&&(l.push(u),o==="|"||o===",");){do o=s.next();while(o==="|"||o===",");u=i()}return c=>l.some(d=>d(c))}}function Cc(e){return!!e&&!!e.match(/[\w\.:]+/)}function q0(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}function Dh(e){typeof e.dispose=="function"&&e.dispose()}var Oo=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},V0=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},K0=class{constructor(){V(this,"_references",[]);V(this,"_seenReferenceKeys",new Set);V(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Z0=class{constructor(e,t){V(this,"seenFullScopeRequests",new Set);V(this,"seenPartialScopeRequests",new Set);V(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Oo(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new K0;for(const n of e)Y0(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Oo){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Y0(e,t,n,s){const o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const r=n.lookup(t);e instanceof Oo?Cr({baseGrammar:r,selfGrammar:o},s):Va(e.ruleName,{baseGrammar:r,selfGrammar:o,repository:o.repository},s);const i=n.injections(e.scopeName);if(i)for(const a of i)s.add(new Oo(a))}function Va(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];ei([s],t,n)}}function Cr(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&ei(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&ei(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function ei(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const o=s.repository?Th({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&ei(s.patterns,{...t,repository:o},n);const r=s.include;if(!r)continue;const i=Oh(r);switch(i.kind){case 0:Cr({...t,selfGrammar:t.baseGrammar},n);break;case 1:Cr(t,n);break;case 2:Va(i.ruleName,{...t,repository:o},n);break;case 3:case 4:const a=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:o};i.kind===4?Va(i.ruleName,l,n):Cr(l,n)}else i.kind===4?n.add(new V0(i.scopeName,i.ruleName)):n.add(new Oo(i.scopeName));break}}}var X0=class{constructor(){V(this,"kind",0)}},J0=class{constructor(){V(this,"kind",1)}},Q0=class{constructor(e){V(this,"kind",2);this.ruleName=e}},eS=class{constructor(e){V(this,"kind",3);this.scopeName=e}},tS=class{constructor(e,t){V(this,"kind",4);this.scopeName=e,this.ruleName=t}};function Oh(e){if(e==="$base")return new X0;if(e==="$self")return new J0;const t=e.indexOf("#");if(t===-1)return new eS(e);if(t===0)return new Q0(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new tS(n,s)}}var nS=/\\(\d+)/,xc=/\\(\d+)/g,sS=-1,Nh=-2;var Zo=class{constructor(e,t,n,s){V(this,"$location");V(this,"id");V(this,"_nameIsCapturing");V(this,"_name");V(this,"_contentNameIsCapturing");V(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ir.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=ir.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Ih(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:ir.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ir.replaceCaptures(this._contentName,e,t)}},oS=class extends Zo{constructor(t,n,s,o,r){super(t,n,s,o);V(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,s,o){throw new Error("Not supported!")}},rS=class extends Zo{constructor(t,n,s,o,r){super(t,n,s,null);V(this,"_match");V(this,"captures");V(this,"_cachedCompiledPatterns");this._match=new No(o,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t).compileAG(t,s,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Go,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Tc=class extends Zo{constructor(t,n,s,o,r){super(t,n,s,o);V(this,"hasMissingPatterns");V(this,"patterns");V(this,"_cachedCompiledPatterns");this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t).compileAG(t,s,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Go,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ka=class extends Zo{constructor(t,n,s,o,r,i,a,l,u,c){super(t,n,s,o);V(this,"_begin");V(this,"beginCaptures");V(this,"_end");V(this,"endHasBackReferences");V(this,"endCaptures");V(this,"applyEndPatternLast");V(this,"hasMissingPatterns");V(this,"patterns");V(this,"_cachedCompiledPatterns");this._begin=new No(r,this.id),this.beginCaptures=i,this._end=new No(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=u||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,o)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Go;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},ti=class extends Zo{constructor(t,n,s,o,r,i,a,l,u){super(t,n,s,o);V(this,"_begin");V(this,"beginCaptures");V(this,"whileCaptures");V(this,"_while");V(this,"whileHasBackReferences");V(this,"hasMissingPatterns");V(this,"patterns");V(this,"_cachedCompiledPatterns");V(this,"_cachedCompiledWhilePatterns");this._begin=new No(r,this.id),this.beginCaptures=i,this.whileCaptures=l,this._while=new No(a,Nh),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t).compileAG(t,s,o)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Go;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,s,o){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,o)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Go,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Gh=class _t{static createCaptureRule(t,n,s,o,r){return t.registerRule(i=>new oS(n,i,s,o,r))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new rS(t.$vscodeTextmateLocation,t.id,t.name,t.match,_t._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=Th({},s,t.repository));let r=t.patterns;return typeof r>"u"&&t.include&&(r=[{include:t.include}]),new Tc(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,_t._compilePatterns(r,n,s))}return t.while?new ti(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,_t._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,_t._compileCaptures(t.whileCaptures||t.captures,n,s),_t._compilePatterns(t.patterns,n,s)):new Ka(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,_t._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,_t._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,_t._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let o=[];if(t){let r=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>r&&(r=a)}for(let i=0;i<=r;i++)o[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let l=0;t[i].patterns&&(l=_t.getCompiledRuleId(t[i],n,s)),o[a]=_t.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,l)}}return o}static _compilePatterns(t,n,s){let o=[];if(t)for(let r=0,i=t.length;r<i;r++){const a=t[r];let l=-1;if(a.include){const u=Oh(a.include);switch(u.kind){case 0:case 1:l=_t.getCompiledRuleId(s[a.include],n,s);break;case 2:let c=s[u.ruleName];c&&(l=_t.getCompiledRuleId(c,n,s));break;case 3:case 4:const d=u.scopeName,f=u.kind===4?u.ruleName:null,p=n.getExternalGrammar(d,s);if(p)if(f){let m=p.repository[f];m&&(l=_t.getCompiledRuleId(m,n,p.repository))}else l=_t.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else l=_t.getCompiledRuleId(a,n,s);if(l!==-1){const u=n.getRule(l);let c=!1;if((u instanceof Tc||u instanceof Ka||u instanceof ti)&&u.hasMissingPatterns&&u.patterns.length===0&&(c=!0),c)continue;o.push(l)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},No=class Bh{constructor(t,n){V(this,"source");V(this,"ruleId");V(this,"hasAnchor");V(this,"hasBackReferences");V(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let o=0,r=[],i=!1;for(let a=0;a<s;a++)if(t.charAt(a)==="\\"&&a+1<s){const u=t.charAt(a+1);u==="z"?(r.push(t.substring(o,a)),r.push("$(?!\\n)(?<!\\n)"),o=a+2):(u==="A"||u==="G")&&(i=!0),a++}this.hasAnchor=i,o===0?this.source=t:(r.push(t.substring(o,s)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=nS.test(this.source):this.hasBackReferences=!1}clone(){return new Bh(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(o=>t.substring(o.start,o.end));return xc.lastIndex=0,this.source.replace(xc,(o,r)=>Mh(s[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],s=[],o=[],r,i,a,l;for(r=0,i=this.source.length;r<i;r++)a=this.source.charAt(r),t[r]=a,n[r]=a,s[r]=a,o[r]=a,a==="\\"&&r+1<i&&(l=this.source.charAt(r+1),l==="A"?(t[r+1]="",n[r+1]="",s[r+1]="A",o[r+1]="A"):l==="G"?(t[r+1]="",n[r+1]="G",s[r+1]="",o[r+1]="G"):(t[r+1]=l,n[r+1]=l,s[r+1]=l,o[r+1]=l),r++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:o.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Go=class{constructor(){V(this,"_items");V(this,"_hasAnchors");V(this,"_cached");V(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Ic(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(o=>o.resolveAnchors(t,n));return new Ic(e,s,this._items.map(o=>o.ruleId))}},Ic=class{constructor(e,t,n){V(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
76
|
+
`)}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},ea=class{constructor(e,t){this.languageId=e,this.tokenType=t}},_n,iS=(_n=class{constructor(t,n){V(this,"_defaultAttributes");V(this,"_embeddedLanguagesMatcher");V(this,"_getBasicScopeAttributes",new Rh(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new ea(n,s)}));this._defaultAttributes=new ea(t,8),this._embeddedLanguagesMatcher=new aS(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?_n._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(_n.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},V(_n,"_NULL_SCOPE_METADATA",new ea(0,0)),V(_n,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),_n),aS=class{constructor(e){V(this,"values");V(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>Mh(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Ec=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Fh(e,t,n,s,o,r,i,a){const l=t.content.length;let u=!1,c=-1;if(i){const p=lS(e,t,n,s,o,r);o=p.stack,s=p.linePos,n=p.isFirstLine,c=p.anchorPosition}const d=Date.now();for(;!u;){if(a!==0&&Date.now()-d>a)return new Ec(o,!0);f()}return new Ec(o,!1);function f(){const p=uS(e,t,n,s,o,c);if(!p){r.produce(o,l),u=!0;return}const m=p.captureIndices,y=p.matchedRuleId,b=m&&m.length>0?m[0].end>s:!1;if(y===sS){const k=o.getRule(e);r.produce(o,m[0].start),o=o.withContentNameScopesList(o.nameScopesList),vo(e,t,n,o,r,k.endCaptures,m),r.produce(o,m[0].end);const w=o;if(o=o.parent,c=w.getAnchorPos(),!b&&w.getEnterPos()===s){o=w,r.produce(o,l),u=!0;return}}else{const k=e.getRule(y);r.produce(o,m[0].start);const w=o,S=k.getName(t.content,m),I=o.contentNameScopesList.pushAttributed(S,e);if(o=o.push(y,s,c,m[0].end===l,null,I,I),k instanceof Ka){const q=k;vo(e,t,n,o,r,q.beginCaptures,m),r.produce(o,m[0].end),c=m[0].end;const B=q.getContentName(t.content,m),R=I.pushAttributed(B,e);if(o=o.withContentNameScopesList(R),q.endHasBackReferences&&(o=o.withEndRule(q.getEndWithResolvedBackReferences(t.content,m))),!b&&w.hasSameRuleAs(o)){o=o.pop(),r.produce(o,l),u=!0;return}}else if(k instanceof ti){const q=k;vo(e,t,n,o,r,q.beginCaptures,m),r.produce(o,m[0].end),c=m[0].end;const B=q.getContentName(t.content,m),R=I.pushAttributed(B,e);if(o=o.withContentNameScopesList(R),q.whileHasBackReferences&&(o=o.withEndRule(q.getWhileWithResolvedBackReferences(t.content,m))),!b&&w.hasSameRuleAs(o)){o=o.pop(),r.produce(o,l),u=!0;return}}else if(vo(e,t,n,o,r,k.captures,m),r.produce(o,m[0].end),o=o.pop(),!b){o=o.safePop(),r.produce(o,l),u=!0;return}}m[0].end>s&&(s=m[0].end,n=!1)}}function lS(e,t,n,s,o,r){let i=o.beginRuleCapturedEOL?0:-1;const a=[];for(let l=o;l;l=l.pop()){const u=l.getRule(e);u instanceof ti&&a.push({rule:u,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:u,findOptions:c}=fS(l.rule,e,l.stack.endRule,n,s===i),d=u.findNextMatchSync(t,s,c);if(d){if(d.ruleId!==Nh){o=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(r.produce(l.stack,d.captureIndices[0].start),vo(e,t,n,l.stack,r,l.rule.whileCaptures,d.captureIndices),r.produce(l.stack,d.captureIndices[0].end),i=d.captureIndices[0].end,d.captureIndices[0].end>s&&(s=d.captureIndices[0].end,n=!1))}else{o=l.stack.pop();break}}return{stack:o,linePos:s,anchorPosition:i,isFirstLine:n}}function uS(e,t,n,s,o,r){const i=cS(e,t,n,s,o,r),a=e.getInjections();if(a.length===0)return i;const l=dS(a,e,t,n,s,o,r);if(!l)return i;if(!i)return l;const u=i.captureIndices[0].start,c=l.captureIndices[0].start;return c<u||l.priorityMatch&&c===u?l:i}function cS(e,t,n,s,o,r){const i=o.getRule(e),{ruleScanner:a,findOptions:l}=jh(i,e,o.endRule,n,s===r),u=a.findNextMatchSync(t,s,l);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function dS(e,t,n,s,o,r,i){let a=Number.MAX_VALUE,l=null,u,c=0;const d=r.contentNameScopesList.getScopeNames();for(let f=0,p=e.length;f<p;f++){const m=e[f];if(!m.matcher(d))continue;const y=t.getRule(m.ruleId),{ruleScanner:b,findOptions:k}=jh(y,t,null,s,o===i),w=b.findNextMatchSync(n,o,k);if(!w)continue;const S=w.captureIndices[0].start;if(!(S>=a)&&(a=S,l=w.captureIndices,u=w.ruleId,c=m.priority,a===o))break}return l?{priorityMatch:c===-1,captureIndices:l,matchedRuleId:u}:null}function jh(e,t,n,s,o){return{ruleScanner:e.compileAG(t,n,s,o),findOptions:0}}function fS(e,t,n,s,o){return{ruleScanner:e.compileWhileAG(t,n,s,o),findOptions:0}}function vo(e,t,n,s,o,r,i){if(r.length===0)return;const a=t.content,l=Math.min(r.length,i.length),u=[],c=i[0].end;for(let d=0;d<l;d++){const f=r[d];if(f===null)continue;const p=i[d];if(p.length===0)continue;if(p.start>c)break;for(;u.length>0&&u[u.length-1].endPos<=p.start;)o.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?o.produceFromScopes(u[u.length-1].scopes,p.start):o.produce(s,p.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,i),b=s.contentNameScopesList.pushAttributed(y,e),k=f.getContentName(a,i),w=b.pushAttributed(k,e),S=s.push(f.retokenizeCapturedWithRuleId,p.start,-1,!1,null,b,w),I=e.createOnigString(a.substring(0,p.end));Fh(e,I,n&&p.start===0,p.start,S,o,!1,0),Dh(I);continue}const m=f.getName(a,i);if(m!==null){const b=(u.length>0?u[u.length-1].scopes:s.contentNameScopesList).pushAttributed(m,e);u.push(new hS(b,p.end))}}for(;u.length>0;)o.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var hS=class{constructor(e,t){V(this,"scopes");V(this,"endPos");this.scopes=e,this.endPos=t}};function pS(e,t,n,s,o,r,i,a){return new mS(e,t,n,s,o,r,i,a)}function Ac(e,t,n,s,o){const r=Qr(t,ni),i=Gh.getCompiledRuleId(n,s,o.repository);for(const a of r)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:o,priority:a.priority})}function ni(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let o=n;o<t.length;o++)if(gS(t[o],s))return n=o+1,!0;return!1})}function gS(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var mS=class{constructor(e,t,n,s,o,r,i,a){V(this,"_rootId");V(this,"_lastRuleId");V(this,"_ruleId2desc");V(this,"_includedGrammars");V(this,"_grammarRepository");V(this,"_grammar");V(this,"_injections");V(this,"_basicScopeAttributesProvider");V(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=r,this._onigLib=a,this._basicScopeAttributesProvider=new iS(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Mc(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const l of Object.keys(o)){const u=Qr(l,ni);for(const c of u)this._tokenTypeMatchers.push({matcher:c.matcher,type:o[l]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const o=s.injections;if(o)for(let i in o)Ac(t,i,o[i],this,s);const r=this._grammarRepository.injections(n);r&&r.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const l=a.injectionSelector;l&&Ac(t,l,a,this,a)}})}return t.sort((o,r)=>o.priority-r.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Mc(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){this._rootId===-1&&(this._rootId=Gh.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!t||t===Za.NULL){o=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),c=this.themeProvider.getDefaults(),d=Js.set(0,u.languageId,u.tokenType,null,c.fontStyle,c.foregroundId,c.backgroundId),f=this.getRule(this._rootId).getName(null,null);let p;f?p=xo.createRootAndLookUpScopeName(f,d,this):p=xo.createRoot("unknown",d),t=new Za(null,this._rootId,-1,-1,!1,null,p,p)}else o=!1,t.reset();e=e+`
|
|
77
|
+
`;const r=this.createOnigString(e),i=r.content.length,a=new yS(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Fh(this,r,o,0,t,a,!0,s);return Dh(r),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Mc(e,t){return e=D0(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var xo=class cn{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,o=(t==null?void 0:t.scopePath)??null;for(const r of n)o=Qi.push(o,r.scopeNames),s=new cn(s,o,r.encodedTokenAttributes);return s}static createRoot(t,n){return new cn(null,new Qi(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const o=s.getMetadataForScope(t),r=new Qi(null,t),i=s.themeProvider.themeMatch(r),a=cn.mergeAttributes(n,o,i);return new cn(null,r,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return cn.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,s){let o=-1,r=0,i=0;return s!==null&&(o=s.fontStyle,r=s.foregroundId,i=s.backgroundId),Js.set(t,n.languageId,n.tokenType,null,o,r,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return cn._pushAttributed(this,t,n);const s=t.split(/ /g);let o=this;for(const r of s)o=cn._pushAttributed(o,r,n);return o}static _pushAttributed(t,n,s){const o=s.getMetadataForScope(n),r=t.scopePath.push(n),i=s.themeProvider.themeMatch(r),a=cn.mergeAttributes(t.tokenAttributes,o,i);return new cn(t,r,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var o;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((o=s.parent)==null?void 0:o.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},zt,Za=(zt=class{constructor(t,n,s,o,r,i,a,l){V(this,"_stackElementBrand");V(this,"_enterPos");V(this,"_anchorPos");V(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=r,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=o}equals(t){return t===null?!1:zt._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?xo.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){zt._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,o,r,i,a){return new zt(this,t,n,s,o,r,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var s,o;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(o=this.contentNameScopesList)==null?void 0:o.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new zt(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,s;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((s=this.contentNameScopesList)==null?void 0:s.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const s=xo.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new zt(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,xo.fromExtension(s,n.contentNameScopesList))}},V(zt,"NULL",new zt(null,0,0,0,!1,null,null,null)),zt),vS=class{constructor(e,t){V(this,"balancedBracketScopes");V(this,"unbalancedBracketScopes");V(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Qr(n,ni).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Qr(n,ni).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},yS=class{constructor(e,t,n,s){V(this,"_emitBinaryTokens");V(this,"_lineText");V(this,"_tokens");V(this,"_binaryTokens");V(this,"_lastTokenEndIndex");V(this,"_tokenTypeOverrides");this.balancedBracketSelectors=s,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var s;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let o=(e==null?void 0:e.tokenAttributes)??0,r=!1;if((s=this.balancedBracketSelectors)!=null&&s.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=(e==null?void 0:e.getScopeNames())??[];for(const a of this._tokenTypeOverrides)a.matcher(i)&&(o=Js.set(o,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(o=Js.set(o,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===o){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(o),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,o=this._binaryTokens.length;s<o;s++)n[s]=this._binaryTokens[s];return n}},bS=class{constructor(e,t){V(this,"_grammars",new Map);V(this,"_rawGrammars",new Map);V(this,"_injectionGrammars",new Map);V(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,o){if(!this._grammars.has(e)){let r=this._rawGrammars.get(e);if(!r)return null;this._grammars.set(e,pS(e,r,t,n,s,o,this,this._onigLib))}return this._grammars.get(e)}},kS=class{constructor(t){V(this,"_options");V(this,"_syncRegistry");V(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new bS(Jr.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Jr.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new vS(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,o,r){const i=new Z0(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(t,n,s,o,r)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,o=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,o)}_grammarForScopeName(t,n=0,s=null,o=null,r=null){return this._syncRegistry.grammarForScopeName(t,n,s,o,r)}},Ya=Za.NULL;const wS=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Yo{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Yo.prototype.normal={};Yo.prototype.property={};Yo.prototype.space=void 0;function Uh(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new Yo(n,s,t)}function Xa(e){return e.toLowerCase()}class Nt{constructor(t,n){this.attribute=n,this.property=t}}Nt.prototype.attribute="";Nt.prototype.booleanish=!1;Nt.prototype.boolean=!1;Nt.prototype.commaOrSpaceSeparated=!1;Nt.prototype.commaSeparated=!1;Nt.prototype.defined=!1;Nt.prototype.mustUseProperty=!1;Nt.prototype.number=!1;Nt.prototype.overloadedBoolean=!1;Nt.prototype.property="";Nt.prototype.spaceSeparated=!1;Nt.prototype.space=void 0;let SS=0;const Ne=Ss(),ct=Ss(),Ja=Ss(),ae=Ss(),Qe=Ss(),gs=Ss(),Bt=Ss();function Ss(){return 2**++SS}const Qa=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:ct,commaOrSpaceSeparated:Bt,commaSeparated:gs,number:ae,overloadedBoolean:Ja,spaceSeparated:Qe},Symbol.toStringTag,{value:"Module"})),ta=Object.keys(Qa);class Yl extends Nt{constructor(t,n,s,o){let r=-1;if(super(t,n),Rc(this,"space",o),typeof s=="number")for(;++r<ta.length;){const i=ta[r];Rc(this,ta[r],(s&Qa[i])===Qa[i])}}}Yl.prototype.defined=!0;function Rc(e,t,n){n&&(e[t]=n)}function eo(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const r=new Yl(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(r.mustUseProperty=!0),t[s]=r,n[Xa(s)]=s,n[Xa(r.attribute)]=s}return new Yo(t,n,e.space)}const zh=eo({properties:{ariaActiveDescendant:null,ariaAtomic:ct,ariaAutoComplete:null,ariaBusy:ct,ariaChecked:ct,ariaColCount:ae,ariaColIndex:ae,ariaColSpan:ae,ariaControls:Qe,ariaCurrent:null,ariaDescribedBy:Qe,ariaDetails:null,ariaDisabled:ct,ariaDropEffect:Qe,ariaErrorMessage:null,ariaExpanded:ct,ariaFlowTo:Qe,ariaGrabbed:ct,ariaHasPopup:null,ariaHidden:ct,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Qe,ariaLevel:ae,ariaLive:null,ariaModal:ct,ariaMultiLine:ct,ariaMultiSelectable:ct,ariaOrientation:null,ariaOwns:Qe,ariaPlaceholder:null,ariaPosInSet:ae,ariaPressed:ct,ariaReadOnly:ct,ariaRelevant:null,ariaRequired:ct,ariaRoleDescription:Qe,ariaRowCount:ae,ariaRowIndex:ae,ariaRowSpan:ae,ariaSelected:ct,ariaSetSize:ae,ariaSort:null,ariaValueMax:ae,ariaValueMin:ae,ariaValueNow:ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Hh(e,t){return t in e?e[t]:t}function Wh(e,t){return Hh(e,t.toLowerCase())}const _S=eo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:gs,acceptCharset:Qe,accessKey:Qe,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alpha:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:Qe,autoFocus:Ne,autoPlay:Ne,blocking:Qe,capture:null,charSet:null,checked:Ne,cite:null,className:Qe,closedBy:null,colorSpace:null,cols:ae,colSpan:ae,command:null,commandFor:null,content:null,contentEditable:ct,controls:Ne,controlsList:Qe,coords:ae|gs,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:Ja,draggable:ct,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:Qe,height:ae,hidden:Ja,high:ae,href:null,hrefLang:null,htmlFor:Qe,httpEquiv:Qe,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:Qe,itemRef:Qe,itemScope:Ne,itemType:Qe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:ae,manifest:null,max:null,maxLength:ae,media:null,method:null,min:null,minLength:ae,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ne,optimum:ae,pattern:null,ping:Qe,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:Qe,required:Ne,reversed:Ne,rows:ae,rowSpan:ae,sandbox:Qe,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootCustomElementRegistry:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shadowRootSerializable:Ne,shape:null,size:ae,sizes:null,slot:null,span:ae,spellCheck:ct,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ae,step:null,style:null,tabIndex:ae,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:ct,width:ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Qe,axis:null,background:null,bgColor:null,border:ae,borderColor:null,bottomMargin:ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:ae,leftMargin:ae,link:null,longDesc:null,lowSrc:null,marginHeight:ae,marginWidth:ae,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:ae,rules:null,scheme:null,scrolling:ct,standby:null,summary:null,text:null,topMargin:ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ae,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ne,disablePictureInPicture:Ne,disableRemotePlayback:Ne,exportParts:gs,part:Qe,prefix:null,property:null,results:ae,security:null,unselectable:null},space:"html",transform:Wh}),$S=eo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Bt,accentHeight:ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ae,amplitude:ae,arabicForm:null,ascent:ae,attributeName:null,attributeType:null,azimuth:ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ae,by:null,calcMode:null,capHeight:ae,className:Qe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ae,diffuseConstant:ae,direction:null,display:null,dur:null,divisor:ae,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:ae,enableBackground:null,end:null,event:null,exponent:ae,externalResourcesRequired:null,fill:null,fillOpacity:ae,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:gs,g2:gs,glyphName:gs,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ae,horizOriginX:ae,horizOriginY:ae,id:null,ideographic:ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ae,k:ae,k1:ae,k2:ae,k3:ae,k4:ae,kernelMatrix:Bt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ae,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ae,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ae,overlineThickness:ae,paintOrder:null,panose1:null,path:null,pathLength:ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Qe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ae,pointsAtY:ae,pointsAtZ:ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Bt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Bt,rev:Bt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Bt,requiredFeatures:Bt,requiredFonts:Bt,requiredFormats:Bt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ae,specularExponent:ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ae,strikethroughThickness:ae,string:null,stroke:null,strokeDashArray:Bt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ae,strokeOpacity:ae,strokeWidth:null,style:null,surfaceScale:ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Bt,tabIndex:ae,tableValues:null,target:null,targetX:ae,targetY:ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Bt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ae,underlineThickness:ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ae,values:null,vAlphabetic:ae,vMathematical:ae,vectorEffect:null,vHanging:ae,vIdeographic:ae,version:null,vertAdvY:ae,vertOriginX:ae,vertOriginY:ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Hh}),qh=eo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Vh=eo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Wh}),Kh=eo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),CS=/[A-Z]/g,Pc=/-[a-z]/g,xS=/^data[-\w.:]+$/i;function TS(e,t){const n=Xa(t);let s=t,o=Nt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&xS.test(t)){if(t.charAt(4)==="-"){const r=t.slice(5).replace(Pc,ES);s="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{const r=t.slice(4);if(!Pc.test(r)){let i=r.replace(CS,IS);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=Yl}return new o(s,t)}function IS(e){return"-"+e.toLowerCase()}function ES(e){return e.charAt(1).toUpperCase()}const AS=Uh([zh,_S,qh,Vh,Kh],"html"),Zh=Uh([zh,$S,qh,Vh,Kh],"svg"),Lc={}.hasOwnProperty;function MS(e,t){const n=t||{};function s(o,...r){let i=s.invalid;const a=s.handlers;if(o&&Lc.call(o,e)){const l=String(o[e]);i=Lc.call(a,l)?a[l]:s.unknown}if(i)return i.call(this,o,...r)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}const RS=/["&'<>`]/g,PS=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,LS=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,DS=/[|\\{}()[\]^$+*?.]/g,Dc=new WeakMap;function OS(e,t){if(e=e.replace(t.subset?NS(t.subset):RS,s),t.subset||t.escapeOnly)return e;return e.replace(PS,n).replace(LS,s);function n(o,r,i){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,i.charCodeAt(r+2),t)}function s(o,r,i){return t.format(o.charCodeAt(0),i.charCodeAt(r+1),t)}}function NS(e){let t=Dc.get(e);return t||(t=GS(e),Dc.set(e,t)),t}function GS(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(DS,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const BS=/[\dA-Fa-f]/;function FS(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!BS.test(String.fromCharCode(t))?s:s+";"}const jS=/\d/;function US(e,t,n){const s="&#"+String(e);return n&&t&&!jS.test(String.fromCharCode(t))?s:s+";"}const zS=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],na={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},HS=["cent","copy","divide","gt","lt","not","para","times"],Yh={}.hasOwnProperty,el={};let ar;for(ar in na)Yh.call(na,ar)&&(el[na[ar]]=ar);const WS=/[^\dA-Za-z]/;function qS(e,t,n,s){const o=String.fromCharCode(e);if(Yh.call(el,o)){const r=el[o],i="&"+r;return n&&zS.includes(r)&&!HS.includes(r)&&(!s||t&&t!==61&&WS.test(String.fromCharCode(t)))?i:i+";"}return""}function VS(e,t,n){let s=FS(e,t,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=qS(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){const r=US(e,t,n.omitOptionalSemicolons);r.length<s.length&&(s=r)}return o&&(!n.useShortestReferences||o.length<s.length)?o:s}function qs(e,t){return OS(e,Object.assign({format:VS},t))}const KS=/^>|^->|<!--|-->|--!>|<!-$/g,ZS=[">"],YS=["<",">"];function XS(e,t,n,s){return s.settings.bogusComments?"<?"+qs(e.value,Object.assign({},s.settings.characterReferences,{subset:ZS}))+">":"<!--"+e.value.replace(KS,o)+"-->";function o(r){return qs(r,Object.assign({},s.settings.characterReferences,{subset:YS}))}}function JS(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}function Oc(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,o=n.indexOf(t);for(;o!==-1;)s++,o=n.indexOf(t,o+t.length);return s}function QS(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function e_(e){return e.join(" ").trim()}const t_=/[ \t\n\f\r]/g;function Xl(e){return typeof e=="object"?e.type==="text"?Nc(e.value):!1:Nc(e)}function Nc(e){return e.replace(t_,"")===""}const pt=Jh(1),Xh=Jh(-1),n_=[];function Jh(e){return t;function t(n,s,o){const r=n?n.children:n_;let i=(s||0)+e,a=r[i];if(!o)for(;a&&Xl(a);)i+=e,a=r[i];return a}}const s_={}.hasOwnProperty;function Qh(e){return t;function t(n,s,o){return s_.call(e,n.tagName)&&e[n.tagName](n,s,o)}}const Jl=Qh({body:r_,caption:sa,colgroup:sa,dd:u_,dt:l_,head:sa,html:o_,li:a_,optgroup:c_,option:d_,p:i_,rp:Gc,rt:Gc,tbody:h_,td:Bc,tfoot:p_,th:Bc,thead:f_,tr:g_});function sa(e,t,n){const s=pt(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&Xl(s.value.charAt(0)))}function o_(e,t,n){const s=pt(n,t);return!s||s.type!=="comment"}function r_(e,t,n){const s=pt(n,t);return!s||s.type!=="comment"}function i_(e,t,n){const s=pt(n,t);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function a_(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&s.tagName==="li"}function l_(e,t,n){const s=pt(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function u_(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function Gc(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function c_(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function d_(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function f_(e,t,n){const s=pt(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function h_(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function p_(e,t,n){return!pt(n,t)}function g_(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function Bc(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const m_=Qh({body:b_,colgroup:k_,head:y_,html:v_,tbody:w_});function v_(e){const t=pt(e,-1);return!t||t.type!=="comment"}function y_(e){const t=new Set;for(const s of e.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||n.type==="element"}function b_(e){const t=pt(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Xl(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function k_(e,t,n){const s=Xh(n,t),o=pt(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Jl(s,n.children.indexOf(s),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function w_(e,t,n){const s=Xh(n,t),o=pt(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Jl(s,n.children.indexOf(s),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const lr={name:[[`
|
|
78
|
+
\f\r &/=>`.split(""),`
|
|
79
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
80
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
81
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
82
|
+
\f\r &>`.split(""),`\0
|
|
83
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
84
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
85
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function S_(e,t,n,s){const o=s.schema,r=o.space==="svg"?!1:s.settings.omitOptionalTags;let i=o.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;o.space==="html"&&e.tagName==="svg"&&(s.schema=Zh);const u=__(s,e.properties),c=s.all(o.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=o,c&&(i=!1),(u||!r||!m_(e,t,n))&&(a.push("<",e.tagName,u?" "+u:""),i&&(o.space==="svg"||s.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!s.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(c),!i&&(!r||!Jl(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function __(e,t){const n=[];let s=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const r=$_(e,o,t[o]);r&&n.push(r)}}for(;++s<n.length;){const r=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&r!=='"'&&r!=="'"&&(n[s]+=" ")}return n.join("")}function $_(e,t,n){const s=TS(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,r=e.settings.allowDangerousCharacters?0:1;let i=e.quote,a;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=qs(s.attribute,Object.assign({},e.settings.characterReferences,{subset:lr.name[o][r]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?QS:e_)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=qs(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:lr.unquoted[o][r]}))),a!==n&&(e.settings.quoteSmart&&Oc(n,i)>Oc(n,e.alternative)&&(i=e.alternative),a=i+qs(n,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?lr.single:lr.double)[o][r],attribute:!0}))+i),l+(a&&"="+a))}const C_=["<","&"];function ep(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:qs(e.value,Object.assign({},s.settings.characterReferences,{subset:C_}))}function x_(e,t,n,s){return s.settings.allowDangerousHtml?e.value:ep(e,t,n,s)}function T_(e,t,n,s){return s.all(e)}const I_=MS("type",{invalid:E_,unknown:A_,handlers:{comment:XS,doctype:JS,element:S_,raw:x_,root:T_,text:ep}});function E_(e){throw new Error("Expected node, not `"+e+"`")}function A_(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const M_={},R_={},P_=[];function L_(e,t){const n=t||M_,s=n.quote||'"',o=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:D_,all:O_,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||wS,characterReferences:n.characterReferences||R_,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Zh:AS,quote:s,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function D_(e,t,n){return I_(e,t,n,this)}function O_(e){const t=[],n=e&&e.children||P_;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function si(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[o,r]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof r=="string"?n[o]=r:o===s&&Object.assign(n,r);return n}function zn(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function N_(e){return Array.isArray(e)?e:[e]}async function tp(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function Ql(e){return!e||["plaintext","txt","text","plain"].includes(e)}function G_(e){return e==="ansi"||Ql(e)}function eu(e){return e==="none"}function B_(e){return eu(e)}function np(e,t){var s;if(!t)return e;e.properties||(e.properties={}),(s=e.properties).class||(s.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const o of n)o&&!e.properties.class.includes(o)&&e.properties.class.push(o);return e}function Ai(e,t=!1){var r;if(e.length===0)return[["",0]];const n=e.split(/(\r?\n)/g);let s=0;const o=[];for(let i=0;i<n.length;i+=2){const a=t?n[i]+(n[i+1]||""):n[i];o.push([a,s]),s+=n[i].length,s+=((r=n[i+1])==null?void 0:r.length)||0}return o}function F_(e){const t=Ai(e,!0).map(([o])=>o);function n(o){if(o===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=o,i=0;for(const a of t){if(r<a.length)break;r-=a.length,i++}return{line:i,character:r}}function s(o,r){let i=0;for(let a=0;a<o;a++)i+=t[a].length;return i+=r,i}return{lines:t,indexToPos:n,posToIndex:s}}const tu="light-dark()",j_=["color","background-color"];function U_(e,t){let n=0;const s=[];for(const o of t)o>n&&s.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function z_(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((s,o)=>s-o);return n.length?e.map(s=>s.flatMap(o=>{const r=n.filter(i=>o.offset<i&&i<o.offset+o.content.length).map(i=>i-o.offset).sort((i,a)=>i-a);return r.length?U_(o,r):o})):e}function H_(e,t,n,s,o="css-vars"){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(c=>oi(e.variants[c])),a=new Set(i.flatMap(c=>Object.keys(c))),l={},u=(c,d)=>{const f=d==="color"?"":d==="background-color"?"-bg":`-${d}`;return n+t[c]+(d==="color"?"":f)};return i.forEach((c,d)=>{for(const f of a){const p=c[f]||"inherit";if(d===0&&s&&j_.includes(f))if(s===tu&&i.length>1){const m=t.findIndex(w=>w==="light"),y=t.findIndex(w=>w==="dark");if(m===-1||y===-1)throw new mt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const b=i[m][f]||"inherit",k=i[y][f]||"inherit";l[f]=`light-dark(${b}, ${k})`,o==="css-vars"&&(l[u(d,f)]=p)}else l[f]=p;else o==="css-vars"&&(l[u(d,f)]=p)}}),r.htmlStyle=l,r}function oi(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&Tt.Italic&&(t["font-style"]="italic"),e.fontStyle&Tt.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&Tt.Underline&&n.push("underline"),e.fontStyle&Tt.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function tl(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}const sp=new WeakMap;function Mi(e,t){sp.set(e,t)}function Bo(e){return sp.get(e)}class to{constructor(...t){V(this,"_stacks",{});V(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,o]=t;this.lang=s,this._stacks={[o]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new to(Object.fromEntries(N_(n).map(s=>[s,Ya])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return W_(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function W_(e){const t=[],n=new Set;function s(o){var i;if(n.has(o))return;n.add(o);const r=(i=o==null?void 0:o.nameScopesList)==null?void 0:i.scopeName;r&&t.push(r),o.parent&&s(o.parent)}return s(e),t}function q_(e,t){if(!(e instanceof to))throw new mt("Invalid grammar state");return e.getInternalStack(t)}function V_(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let s=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new mt(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...o.indexToPos(i),offset:i}}else{const a=o.lines[i.line];if(a===void 0)throw new mt(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${o.lines.length}`);let l=i.character;if(l<0&&(l=a.length+l),l<0||l>a.length)throw new mt(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);return{...i,character:l,offset:o.posToIndex(i.line,l)}}};const o=F_(n.source),r=(n.options.decorations||[]).map(i=>({...i,start:s(i.start),end:s(i.end)}));K_(r),e.set(n.meta,{decorations:r,converter:o,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var i;if(!((i=this.options.decorations)!=null&&i.length))return;const o=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return z_(n,o)},code(n){var c;if(!((c=this.options.decorations)!=null&&c.length))return;const s=t(this),o=Array.from(n.children).filter(d=>d.type==="element"&&d.tagName==="span");if(o.length!==s.converter.lines.length)throw new mt(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function r(d,f,p,m){const y=o[d];let b="",k=-1,w=-1;if(f===0&&(k=0),p===0&&(w=0),p===Number.POSITIVE_INFINITY&&(w=y.children.length),k===-1||w===-1)for(let I=0;I<y.children.length;I++)b+=op(y.children[I]),k===-1&&b.length===f&&(k=I+1),w===-1&&b.length===p&&(w=I+1);if(k===-1)throw new mt(`Failed to find start index for decoration ${JSON.stringify(m.start)}`);if(w===-1)throw new mt(`Failed to find end index for decoration ${JSON.stringify(m.end)}`);const S=y.children.slice(k,w);if(!m.alwaysWrap&&S.length===y.children.length)a(y,m,"line");else if(!m.alwaysWrap&&S.length===1&&S[0].type==="element")a(S[0],m,"token");else{const I={type:"element",tagName:"span",properties:{},children:S};a(I,m,"wrapper"),y.children.splice(k,S.length,I)}}function i(d,f){o[d]=a(o[d],f,"line")}function a(d,f,p){var b;const m=f.properties||{},y=f.transform||(k=>k);return d.tagName=f.tagName||"span",d.properties={...d.properties,...m,class:d.properties.class},(b=f.properties)!=null&&b.class&&np(d,f.properties.class),d=y(d,p)||d,d}const l=[],u=s.decorations.sort((d,f)=>f.start.offset-d.start.offset||d.end.offset-f.end.offset);for(const d of u){const{start:f,end:p}=d;if(f.line===p.line)r(f.line,f.character,p.character,d);else if(f.line<p.line){r(f.line,f.character,Number.POSITIVE_INFINITY,d);for(let m=f.line+1;m<p.line;m++)l.unshift(()=>i(m,d));r(p.line,0,p.character,d)}}l.forEach(d=>d())}}}function K_(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new mt(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const o=e[s],r=n.start.offset<=o.start.offset&&o.start.offset<n.end.offset,i=n.start.offset<o.end.offset&&o.end.offset<=n.end.offset,a=o.start.offset<=n.start.offset&&n.start.offset<o.end.offset,l=o.start.offset<n.end.offset&&n.end.offset<=o.end.offset;if(r||i||a||l){if(r&&i||a&&l||a&&n.start.offset===n.end.offset||i&&o.start.offset===o.end.offset)continue;throw new mt(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(o.start)} intersect.`)}}}}function op(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(op).join(""):""}const Z_=[V_()];function ri(e){const t=Y_(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Z_]}function Y_(e){const t=[],n=[],s=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":n.push(o);break;default:s.push(o)}return{pre:t,post:n,normal:s}}var us=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],oa={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function X_(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const s=e.indexOf("m",n);if(s!==-1)return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function Fc(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(s=>Number.parseInt(s));return n.length!==3||n.some(s=>Number.isNaN(s))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function J_(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(s===0)t.push({type:"resetAll"});else if(s<=9)oa[s]&&t.push({type:"setDecoration",value:oa[s]});else if(s<=29){const o=oa[s-20];o&&(t.push({type:"resetDecoration",value:o}),o==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:us[s-30]}});else if(s===38){const o=Fc(e);o&&t.push({type:"setForegroundColor",value:o})}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:us[s-40]}});else if(s===48){const o=Fc(e);o&&t.push({type:"setBackgroundColor",value:o})}else s===49?t.push({type:"resetBackgroundColor"}):s===53?t.push({type:"setDecoration",value:"overline"}):s===55?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:us[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:us[s-100+8]}})}return t}function Q_(){let e=null,t=null,n=new Set;return{parse(s){const o=[];let r=0;do{const i=X_(s,r),a=i.sequence?s.substring(r,i.startPosition):s.substring(r);if(a.length>0&&o.push({value:a,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const l=J_(i.sequence);for(const u of l)u.type==="resetAll"?(e=null,t=null,n.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&n.delete(u.value);for(const u of l)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&n.add(u.value)}r=i.position}while(r<s.length);return o}}}var e$={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function t$(e=e$){function t(a){return e[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let s;function o(){if(s)return s;s=[];for(let u=0;u<us.length;u++)s.push(t(us[u]));let a=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let c=0;c<6;c++)for(let d=0;d<6;d++)s.push(n([a[u],a[c],a[d]]));let l=8;for(let u=0;u<24;u++,l+=10)s.push(n([l,l,l]));return s}function r(a){return o()[a]}function i(a){switch(a.type){case"named":return t(a.name);case"rgb":return n(a.rgb);case"table":return r(a.index)}}return{value:i}}const n$={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function s$(e,t,n){const s=si(e,n),o=Ai(t),r=Object.fromEntries(us.map(l=>{var d;const u=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,c=(d=e.colors)==null?void 0:d[u];return[l,c||n$[l]]})),i=t$(r),a=Q_();return o.map(l=>a.parse(l[0]).map(u=>{let c,d;u.decorations.has("reverse")?(c=u.background?i.value(u.background):e.bg,d=u.foreground?i.value(u.foreground):e.fg):(c=u.foreground?i.value(u.foreground):e.fg,d=u.background?i.value(u.background):void 0),c=zn(c,s),d=zn(d,s),u.decorations.has("dim")&&(c=o$(c));let f=Tt.None;return u.decorations.has("bold")&&(f|=Tt.Bold),u.decorations.has("italic")&&(f|=Tt.Italic),u.decorations.has("underline")&&(f|=Tt.Underline),u.decorations.has("strikethrough")&&(f|=Tt.Strikethrough),{content:u.value,offset:l[1],color:c,bgColor:d,fontStyle:f}}))}function o$(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const s=t[1];if(s.length===8){const o=Math.round(Number.parseInt(s.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${s.slice(0,6)}${o}`}else{if(s.length===6)return`#${s}80`;if(s.length===4){const o=s[0],r=s[1],i=s[2],a=s[3],l=Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0");return`#${o}${o}${r}${r}${i}${i}${l}`}else if(s.length===3){const o=s[0],r=s[1],i=s[2];return`#${o}${o}${r}${r}${i}${i}80`}}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function nu(e,t,n={}){const{theme:s=e.getLoadedThemes()[0]}=n,o=e.resolveLangAlias(n.lang||"text");if(Ql(o)||eu(s))return Ai(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:r,colorMap:i}=e.setTheme(s);if(o==="ansi")return s$(r,t,n);const a=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==a.name)throw new mt(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(r.name))throw new mt(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${r.name}"`)}return i$(t,a,r,i,n)}function r$(...e){if(e.length===2)return Bo(e[1]);const[t,n,s={}]=e,{lang:o="text",theme:r=t.getLoadedThemes()[0]}=s;if(Ql(o)||eu(r))throw new mt("Plain language does not have grammar state");if(o==="ansi")throw new mt("ANSI language does not have grammar state");const{theme:i,colorMap:a}=t.setTheme(r),l=t.getLanguage(o);return new to(su(n,l,i,a,s).stateStack,l.name,i.name)}function i$(e,t,n,s,o){const r=su(e,t,n,s,o),i=new to(r.stateStack,t.name,n.name);return Mi(r.tokens,i),r.tokens}function su(e,t,n,s,o){const r=si(n,o),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500}=o,l=Ai(e);let u=o.grammarState?q_(o.grammarState,n.name)??Ya:o.grammarContextCode!=null?su(o.grammarContextCode,t,n,s,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:Ya,c=[];const d=[];for(let f=0,p=l.length;f<p;f++){const[m,y]=l[f];if(m===""){c=[],d.push([]);continue}if(i>0&&m.length>=i){c=[],d.push([{content:m,offset:y,color:"",fontStyle:0}]);continue}let b,k,w;o.includeExplanation&&(b=t.tokenizeLine(m,u,a),k=b.tokens,w=0);const S=t.tokenizeLine2(m,u,a),I=S.tokens.length/2;for(let q=0;q<I;q++){const B=S.tokens[2*q],R=q+1<I?S.tokens[2*q+2]:m.length;if(B===R)continue;const L=S.tokens[2*q+1],A=zn(s[Js.getForeground(L)],r),W=Js.getFontStyle(L),F={content:m.substring(B,R),offset:y+B,color:A,fontStyle:W};if(o.includeExplanation){const O=[];if(o.includeExplanation!=="scopeName")for(const x of n.settings){let E;switch(typeof x.scope){case"string":E=x.scope.split(/,/).map(z=>z.trim());break;case"object":E=x.scope;break;default:continue}O.push({settings:x,selectors:E.map(z=>z.split(/ /))})}F.explanation=[];let ee=0;for(;B+ee<R;){const x=k[w],E=m.substring(x.startIndex,x.endIndex);ee+=E.length,F.explanation.push({content:E,scopes:o.includeExplanation==="scopeName"?a$(x.scopes):l$(O,x.scopes)}),w+=1}}c.push(F)}d.push(c),c=[],u=S.ruleStack}return{tokens:d,stateStack:u}}function a$(e){return e.map(t=>({scopeName:t}))}function l$(e,t){const n=[];for(let s=0,o=t.length;s<o;s++){const r=t[s];n[s]={scopeName:r,themeMatches:c$(e,r,t.slice(0,s))}}return n}function jc(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function u$(e,t,n){if(!jc(e[e.length-1],t))return!1;let s=e.length-2,o=n.length-1;for(;s>=0&&o>=0;)jc(e[s],n[o])&&(s-=1),o-=1;return s===-1}function c$(e,t,n){const s=[];for(const{selectors:o,settings:r}of e)for(const i of o)if(u$(i,t,n)){s.push(r);break}return s}function rp(e,t,n){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=s.map(l=>{const u=nu(e,t,{...n,theme:l.theme}),c=Bo(u),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:u,state:c,theme:d}}),r=d$(...o.map(l=>l.tokens)),i=r[0].map((l,u)=>l.map((c,d)=>{const f={content:c.content,variants:{},offset:c.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=c.explanation),r.forEach((p,m)=>{const{content:y,explanation:b,offset:k,...w}=p[u][d];f.variants[s[m].color]=w}),f})),a=o[0].state?new to(Object.fromEntries(o.map(l=>{var u;return[l.theme,(u=l.state)==null?void 0:u.getInternalStack(l.theme)]})),o[0].state.lang):void 0;return a&&Mi(i,a),i}function d$(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const o=e.map(l=>l[s]),r=t.map(()=>[]);t.forEach((l,u)=>l.push(r[u]));const i=o.map(()=>0),a=o.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(u=>u.content.length));for(let u=0;u<n;u++){const c=a[u];c.content.length===l?(r[u].push(c),i[u]+=1,a[u]=o[u][i[u]]):(r[u].push({...c,content:c.content.slice(0,l)}),a[u]={...c,content:c.content.slice(l),offset:c.offset+l})}}}return t}function ii(e,t,n){let s,o,r,i,a,l;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:c="--shiki-",colorsRendering:d="css-vars"}=n,f=Object.entries(n.themes).filter(k=>k[1]).map(k=>({color:k[0],theme:k[1]})).sort((k,w)=>k.color===u?-1:w.color===u?1:0);if(f.length===0)throw new mt("`themes` option must not be empty");const p=rp(e,t,n);if(l=Bo(p),u&&tu!==u&&!f.find(k=>k.color===u))throw new mt(`\`themes\` option must contain the defaultColor key \`${u}\``);const m=f.map(k=>e.getTheme(k.theme)),y=f.map(k=>k.color);r=p.map(k=>k.map(w=>H_(w,y,c,u,d))),l&&Mi(r,l);const b=f.map(k=>si(k.theme,n));o=Uc(f,m,b,c,u,"fg",d),s=Uc(f,m,b,c,u,"bg",d),i=`shiki-themes ${m.map(k=>k.name).join(" ")}`,a=u?void 0:[o,s].join(";")}else if("theme"in n){const u=si(n.theme,n);r=nu(e,t,n);const c=e.getTheme(n.theme);s=zn(c.bg,u),o=zn(c.fg,u),i=c.name,l=Bo(r)}else throw new mt("Invalid options, either `theme` or `themes` must be provided");return{tokens:r,fg:o,bg:s,themeName:i,rootStyle:a,grammarState:l}}function Uc(e,t,n,s,o,r,i){return e.map((a,l)=>{const u=zn(t[l][r],n[l])||"inherit",c=`${s+a.color}${r==="bg"?"-bg":""}:${u}`;if(l===0&&o){if(o===tu&&e.length>1){const d=e.findIndex(y=>y.color==="light"),f=e.findIndex(y=>y.color==="dark");if(d===-1||f===-1)throw new mt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=zn(t[d][r],n[d])||"inherit",m=zn(t[f][r],n[f])||"inherit";return`light-dark(${p}, ${m});${c}`}return u}return i==="css-vars"?c:null}).filter(a=>!!a).join(";")}function ai(e,t,n,s={meta:{},options:n,codeToHast:(o,r)=>ai(e,o,r),codeToTokens:(o,r)=>ii(e,o,r)}){var m,y;let o=t;for(const b of ri(n))o=((m=b.preprocess)==null?void 0:m.call(s,o,n))||o;let{tokens:r,fg:i,bg:a,themeName:l,rootStyle:u,grammarState:c}=ii(e,o,n);const{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?r=h$(r):d==="never"&&(r=p$(r)),f&&(r=g$(r));const p={...s,get source(){return o}};for(const b of ri(n))r=((y=b.tokens)==null?void 0:y.call(p,r))||r;return f$(r,{...n,fg:i,bg:a,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??u},p,c)}function f$(e,t,n,s=Bo(e)){var y,b,k,w;const o=ri(t),r=[],i={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t,u={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),l!==!1&&l!=null&&(u.tabindex=l.toString());for(const[S,I]of Object.entries(t.meta||{}))S.startsWith("_")||(u[S]=I);let c={type:"element",tagName:"pre",properties:u,children:[],data:t.data},d={type:"element",tagName:"code",properties:{},children:r};const f=[],p={...n,structure:a,addClassToHast:np,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return c},get code(){return d},get lines(){return f}};if(e.forEach((S,I)=>{var R,L;I&&(a==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&r.push({type:"text",value:`
|
|
86
|
+
`}));let q={type:"element",tagName:"span",properties:{class:"line"},children:[]},B=0;for(const A of S){let W={type:"element",tagName:"span",properties:{...A.htmlAttrs},children:[{type:"text",value:A.content}]};const F=tl(A.htmlStyle||oi(A));F&&(W.properties.style=F);for(const O of o)W=((R=O==null?void 0:O.span)==null?void 0:R.call(p,W,I+1,B,q,A))||W;a==="inline"?i.children.push(W):a==="classic"&&q.children.push(W),B+=A.content.length}if(a==="classic"){for(const A of o)q=((L=A==null?void 0:A.line)==null?void 0:L.call(p,q,I+1))||q;f.push(q),r.push(q)}else a==="inline"&&f.push(q)}),a==="classic"){for(const S of o)d=((y=S==null?void 0:S.code)==null?void 0:y.call(p,d))||d;c.children.push(d);for(const S of o)c=((b=S==null?void 0:S.pre)==null?void 0:b.call(p,c))||c;i.children.push(c)}else if(a==="inline"){const S=[];let I={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const R of i.children)R.type==="element"&&R.tagName==="br"?(S.push(I),I={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(R.type==="element"||R.type==="text")&&I.children.push(R);S.push(I);let B={type:"element",tagName:"code",properties:{},children:S};for(const R of o)B=((k=R==null?void 0:R.code)==null?void 0:k.call(p,B))||B;i.children=[];for(let R=0;R<B.children.length;R++){R>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const L=B.children[R];L.type==="element"&&i.children.push(...L.children)}}let m=i;for(const S of o)m=((w=S==null?void 0:S.root)==null?void 0:w.call(p,m))||m;return s&&Mi(m,s),m}function h$(e){return e.map(t=>{const n=[];let s="",o;return t.forEach((r,i)=>{const l=!(r.fontStyle&&(r.fontStyle&Tt.Underline||r.fontStyle&Tt.Strikethrough));l&&r.content.match(/^\s+$/)&&t[i+1]?(o===void 0&&(o=r.offset),s+=r.content):s?(l?n.push({...r,offset:o,content:s+r.content}):n.push({content:s,offset:o},r),o=void 0,s=""):n.push(r)}),n})}function p$(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const s=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return n;const[,o,r,i]=s;if(!o&&!i)return n;const a=[{...n,offset:n.offset+o.length,content:r}];return o&&a.unshift({content:o,offset:n.offset}),i&&a.push({content:i,offset:n.offset+o.length+r.length}),a}))}function g$(e){return e.map(t=>{const n=[];for(const s of t){if(n.length===0){n.push({...s});continue}const o=n[n.length-1],r=tl(o.htmlStyle||oi(o)),i=tl(s.htmlStyle||oi(s)),a=o.fontStyle&&(o.fontStyle&Tt.Underline||o.fontStyle&Tt.Strikethrough),l=s.fontStyle&&(s.fontStyle&Tt.Underline||s.fontStyle&Tt.Strikethrough);!a&&!l&&r===i?o.content+=s.content:n.push({...s})}return n})}const m$=L_;function v$(e,t,n){var r;const s={meta:{},options:n,codeToHast:(i,a)=>ai(e,i,a),codeToTokens:(i,a)=>ii(e,i,a)};let o=m$(ai(e,t,n,s));for(const i of ri(n))o=((r=i.postprocess)==null?void 0:r.call(s,o,n))||o;return o}const zc={light:"#333333",dark:"#bbbbbb"},Hc={light:"#fffffe",dark:"#1e1e1e"},Wc="__shiki_resolved";function ou(e){var a,l,u,c,d;if(e!=null&&e[Wc])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const f=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(a=f==null?void 0:f.settings)!=null&&a.foreground&&(s=f.settings.foreground),(l=f==null?void 0:f.settings)!=null&&l.background&&(n=f.settings.background),!s&&((u=t==null?void 0:t.colors)!=null&&u["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((c=t==null?void 0:t.colors)!=null&&c["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?zc.light:zc.dark),n||(n=t.type==="light"?Hc.light:Hc.dark),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const r=new Map;function i(f){var m;if(r.has(f))return r.get(f);o+=1;const p=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return(m=t.colorReplacements)!=null&&m[`#${p}`]?i(f):(r.set(f,p),p)}t.settings=t.settings.map(f=>{var b,k;const p=((b=f.settings)==null?void 0:b.foreground)&&!f.settings.foreground.startsWith("#"),m=((k=f.settings)==null?void 0:k.background)&&!f.settings.background.startsWith("#");if(!p&&!m)return f;const y={...f,settings:{...f.settings}};if(p){const w=i(f.settings.foreground);t.colorReplacements[w]=f.settings.foreground,y.settings.foreground=w}if(m){const w=i(f.settings.background);t.colorReplacements[w]=f.settings.background,y.settings.background=w}return y});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((d=t.colors[f])!=null&&d.startsWith("#"))){const p=i(t.colors[f]);t.colorReplacements[p]=t.colors[f],t.colors[f]=p}return Object.defineProperty(t,Wc,{enumerable:!1,writable:!1,value:!0}),t}async function ip(e){return Array.from(new Set((await Promise.all(e.filter(t=>!G_(t)).map(async t=>await tp(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function ap(e){return(await Promise.all(e.map(async n=>B_(n)?null:ou(await tp(n))))).filter(n=>!!n)}let y$=3;function b$(e,t=3){t>y$||console.trace(`[SHIKI DEPRECATE]: ${e}`)}class Os extends Error{constructor(t){super(t),this.name="ShikiError"}}function lp(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Os(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class k$ extends kS{constructor(n,s,o,r={}){super(n);V(this,"_resolvedThemes",new Map);V(this,"_resolvedGrammars",new Map);V(this,"_langMap",new Map);V(this,"_langGraph",new Map);V(this,"_textmateThemeCache",new WeakMap);V(this,"_loadedThemesCache",null);V(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=s,this._langs=o,this._alias=r,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const s=ou(n);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let s=this._textmateThemeCache.get(n);s||(s=Jr.createFromRawTheme(n),this._textmateThemeCache.set(n,s)),this._syncRegistry.setTheme(s)}getGrammar(n){return n=lp(n,this._alias),this._resolvedGrammars.get(n)}loadLanguage(n){var i,a,l,u;if(this.getGrammar(n.name))return;const s=new Set([...this._langMap.values()].filter(c=>{var d;return(d=c.embeddedLangsLazy)==null?void 0:d.includes(n.name)}));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const r=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(r.name=n.name,this._resolvedGrammars.set(n.name,r),n.aliases&&n.aliases.forEach(c=>{this._alias[c]=n.name}),this._loadedLanguagesCache=null,s.size)for(const c of s)this._resolvedGrammars.delete(c.name),this._loadedLanguagesCache=null,(a=(i=this._syncRegistry)==null?void 0:i._injectionGrammars)==null||a.delete(c.scopeName),(u=(l=this._syncRegistry)==null?void 0:l._grammars)==null||u.delete(c.scopeName),this.loadLanguage(this._langMap.get(c.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const r of n)this.resolveEmbeddedLanguages(r);const s=Array.from(this._langGraph.entries()),o=s.filter(([r,i])=>!i);if(o.length){const r=s.filter(([i,a])=>{if(!a)return!1;const l=a.embeddedLanguages||a.embeddedLangs;return l==null?void 0:l.some(u=>o.map(([c])=>c).includes(u))}).filter(i=>!o.includes(i));throw new Os(`Missing languages ${o.map(([i])=>`\`${i}\``).join(", ")}, required by ${r.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[r,i]of s)this._resolver.addLanguage(i);for(const[r,i]of s)this.loadLanguage(i)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){this._langMap.set(n.name,n),this._langGraph.set(n.name,n);const s=n.embeddedLanguages??n.embeddedLangs;if(s)for(const o of s)this._langGraph.set(o,this._langMap.get(o))}}class w${constructor(t,n){V(this,"_langs",new Map);V(this,"_scopeToLang",new Map);V(this,"_injections",new Map);V(this,"_onigLib");this._onigLib={createOnigScanner:s=>t.createScanner(s),createOnigString:s=>t.createString(s)},n.forEach(s=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let s=[];for(let o=1;o<=n.length;o++){const r=n.slice(0,o).join(".");s=[...s,...this._injections.get(r)||[]]}return s}}let fo=0;function S$(e){fo+=1,e.warnings!==!1&&fo>=10&&fo%10===0&&console.warn(`[Shiki] ${fo} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Os("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(ou),o=new w$(e.engine,n),r=new k$(o,s,n,e.langAlias);let i;function a(S){return lp(S,e.langAlias)}function l(S){k();const I=r.getGrammar(typeof S=="string"?S:S.name);if(!I)throw new Os(`Language \`${S}\` not found, you may need to load it first`);return I}function u(S){if(S==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};k();const I=r.getTheme(S);if(!I)throw new Os(`Theme \`${S}\` not found, you may need to load it first`);return I}function c(S){k();const I=u(S);i!==S&&(r.setTheme(I),i=S);const q=r.getColorMap();return{theme:I,colorMap:q}}function d(){return k(),r.getLoadedThemes()}function f(){return k(),r.getLoadedLanguages()}function p(...S){k(),r.loadLanguages(S.flat(1))}async function m(...S){return p(await ip(S))}function y(...S){k();for(const I of S.flat(1))r.loadTheme(I)}async function b(...S){return k(),y(await ap(S))}function k(){if(t)throw new Os("Shiki instance has been disposed")}function w(){t||(t=!0,r.dispose(),fo-=1)}return{setTheme:c,getTheme:u,getLanguage:l,getLoadedThemes:d,getLoadedLanguages:f,resolveLangAlias:a,loadLanguage:m,loadLanguageSync:p,loadTheme:b,loadThemeSync:y,dispose:w,[Symbol.dispose]:w}}async function _$(e){e.engine||b$("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([ap(e.themes||[]),ip(e.langs||[]),e.engine]);return S$({...e,themes:t,langs:n,engine:s})}async function $$(e){const t=await _$(e);return{getLastGrammarState:(...n)=>r$(t,...n),codeToTokensBase:(n,s)=>nu(t,n,s),codeToTokensWithThemes:(n,s)=>rp(t,n,s),codeToTokens:(n,s)=>ii(t,n,s),codeToHast:(n,s)=>ai(t,n,s),codeToHtml:(n,s)=>v$(t,n,s),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function no(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function C$(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}const ru=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),vt=String.raw;function so(e,t){if(e==null)throw new Error(t??"Value expected");return e}const up=vt`\[\^?`,cp=`c.? | C(?:-.?)?|${vt`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${vt`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${vt`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${vt`o\{[^\}]*\}?`}|${vt`\d{1,3}`}`,iu=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ur=new RegExp(vt`
|
|
87
|
+
\\ (?:
|
|
88
|
+
${cp}
|
|
89
|
+
| [gk]<[^>]*>?
|
|
90
|
+
| [gk]'[^']*'?
|
|
91
|
+
| .
|
|
92
|
+
)
|
|
93
|
+
| \( (?:
|
|
94
|
+
\? (?:
|
|
95
|
+
[:=!>({]
|
|
96
|
+
| <[=!]
|
|
97
|
+
| <[^>]*>
|
|
98
|
+
| '[^']*'
|
|
99
|
+
| ~\|?
|
|
100
|
+
| #(?:[^)\\]|\\.?)*
|
|
101
|
+
| [^:)]*[:)]
|
|
102
|
+
)?
|
|
103
|
+
| \*[^\)]*\)?
|
|
104
|
+
)?
|
|
105
|
+
| (?:${iu.source})+
|
|
106
|
+
| ${up}
|
|
107
|
+
| .
|
|
108
|
+
`.replace(/\s+/g,""),"gsu"),ra=new RegExp(vt`
|
|
109
|
+
\\ (?:
|
|
110
|
+
${cp}
|
|
111
|
+
| .
|
|
112
|
+
)
|
|
113
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
114
|
+
| ${up}
|
|
115
|
+
| &&
|
|
116
|
+
| .
|
|
117
|
+
`.replace(/\s+/g,""),"gsu");function x$(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const s=W$(n.flags),o=[s.extended],r={captureGroup:n.rules.captureGroup,getCurrentModX(){return o.at(-1)},numOpenGroups:0,popModX(){o.pop()},pushModX(d){o.push(d)},replaceCurrentModX(d){o[o.length-1]=d},singleline:n.rules.singleline};let i=[],a;for(ur.lastIndex=0;a=ur.exec(e);){const d=T$(r,e,a[0],ur.lastIndex);d.tokens?i.push(...d.tokens):d.token&&i.push(d.token),d.lastIndex!==void 0&&(ur.lastIndex=d.lastIndex)}const l=[];let u=0;i.filter(d=>d.type==="GroupOpen").forEach(d=>{d.kind==="capturing"?d.number=++u:d.raw==="("&&l.push(d)}),u||l.forEach((d,f)=>{d.kind="capturing",d.number=f+1});const c=u||l.length;return{tokens:i.map(d=>d.type==="EscapedNumber"?V$(d,c):d).flat(),flags:s}}function T$(e,t,n,s){const[o,r]=n;if(n==="["||n==="[^"){const i=I$(t,n,s);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(o==="\\"){if("AbBGyYzZ".includes(r))return{token:qc(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:G$(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:fp(n)}}if(r==="K")return{token:hp("keep",n)};if(r==="N"||r==="R")return{token:cs("newline",n,{negate:r==="N"})};if(r==="O")return{token:cs("any",n)};if(r==="X")return{token:cs("text_segment",n)};const i=dp(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(o==="("){if(r==="*")return{token:U$(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(t[s]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:s+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:j$(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("&&!e.captureGroup||n==="(?:")return{token:Ps("group",n)};if(n==="(?>")return{token:Ps("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:Ps(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:Ps("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:Ps("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:D$(n)}}if(e.getCurrentModX()){if(n==="#"){const i=t.indexOf(`
|
|
118
|
+
`,s);return{lastIndex:i===-1?t.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=s,{lastIndex:i.exec(t)?i.lastIndex:s}}}if(n===".")return{token:cs("dot",n)};if(n==="^"||n==="$"){const i=e.singleline?{"^":vt`\A`,$:vt`\Z`}[n]:n;return{token:qc(i,n)}}return n==="|"?{token:A$(n)}:iu.test(n)?{tokens:K$(n)}:{token:xn(no(n),n)}}function I$(e,t,n){const s=[Vc(t[1]==="^",t)];let o=1,r;for(ra.lastIndex=n;r=ra.exec(e);){const i=r[0];if(i[0]==="["&&i[1]!==":")o++,s.push(Vc(i[1]==="^",i));else if(i==="]"){if(s.at(-1).type==="CharacterClassOpen")s.push(xn(93,i));else if(o--,s.push(M$(i)),!o)break}else{const a=E$(i);Array.isArray(a)?s.push(...a):s.push(a)}}return{tokens:s,lastIndex:ra.lastIndex||e.length}}function E$(e){if(e[0]==="\\")return dp(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!ru.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return cs("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?R$(e):e==="&&"?P$(e):xn(no(e),e)}function dp(e,{inCharClass:t}){const n=e[1];if(n==="c"||n==="C")return F$(e);if("dDhHsSwW".includes(n))return z$(e);if(e.startsWith(vt`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return H$(e)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(e))try{const s=e.split(/\\x/).slice(1).map(i=>parseInt(i,16)),o=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(s)),r=new TextEncoder;return[...o].map(i=>{const a=[...r.encode(i)].map(l=>`\\x${l.toString(16)}`).join("");return xn(no(i),a)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return xn(q$(e),e);if(Kc.has(n))return xn(Kc.get(n),e);if(/\d/.test(n))return L$(t,e);if(e==="\\")throw new Error(vt`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return xn(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function A$(e){return{type:"Alternator",raw:e}}function qc(e,t){return{type:"Assertion",kind:e,raw:t}}function fp(e){return{type:"Backreference",raw:e}}function xn(e,t){return{type:"Character",value:e,raw:t}}function M$(e){return{type:"CharacterClassClose",raw:e}}function R$(e){return{type:"CharacterClassHyphen",raw:e}}function P$(e){return{type:"CharacterClassIntersector",raw:e}}function Vc(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function cs(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function hp(e,t,n={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:so(n.flags),raw:t}}function L$(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function D$(e){return{type:"GroupClose",raw:e}}function Ps(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function O$(e,t,n,s){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:s}}function N$(e,t,n,s){return{type:"Quantifier",kind:e,min:t,max:n,raw:s}}function G$(e){return{type:"Subroutine",raw:e}}const B$=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Kc=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function F$(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return xn(no(t.toUpperCase())-64,e)}function j$(e,t){let{on:n,off:s}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;s??(s="");const o=(t.getCurrentModX()||n.includes("x"))&&!s.includes("x"),r=Yc(n),i=Yc(s),a={};if(r&&(a.enable=r),i&&(a.disable=i),e.endsWith(")"))return t.replaceCurrentModX(o),hp("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(o),t.numOpenGroups++,Ps("group",e,{...(r||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function U$(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:s,args:o}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(s==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const r=o?o.split(",").filter(c=>c!=="").map(c=>/^[+-]?\d+$/.test(c)?+c:c):[],[i,a,l]=r,u=B$.has(n)?n.toLowerCase():"custom";switch(u){case"fail":case"mismatch":case"skip":if(r.length>0)throw new Error(`Named callout arguments not allowed "${r}"`);break;case"error":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if(typeof i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!r.length||r.length>2)throw new Error(`Named callout must have one or two arguments "${r}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(r.length===2&&(typeof a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if(r.length===1&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(r.length!==3)throw new Error(`Named callout must have three arguments "${r}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof l=="string"&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${u}"`)}return O$(u,s??null,(o==null?void 0:o.split(","))??null,e)}function Zc(e){let t=null,n,s;if(e[0]==="{"){const{minStr:o,maxStr:r}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,i=1e5;if(+o>i||r&&+r>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+o,s=r===void 0?+o:r===""?1/0:+r,n>s&&(t="possessive",[n,s]=[s,n]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=e[0]==="+"?1:0,s=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return N$(t,n,s,e)}function z$(e){const t=e[1].toLowerCase();return cs({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function H$(e){const{p:t,neg:n,value:s}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return cs("property",e,{value:s,negate:t==="P"&&!n||t==="p"&&!!n})}function Yc(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function W$(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const s=e[n];if(!"imxDPSWy".includes(s))throw new Error(`Invalid flag "${s}"`);if(s==="y"){if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[n+2]==="g"?"grapheme":"word",n+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[s]]=!0}return t}function q$(e){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function V$(e,t){const{raw:n,inCharClass:s}=e,o=n.slice(1);if(!s&&(o!=="0"&&o.length===1||o[0]!=="0"&&+o<=t))return[fp(n)];const r=[],i=o.match(/^[0-7]+|\d/g);for(let a=0;a<i.length;a++){const l=i[a];let u;if(a===0&&l!=="8"&&l!=="9"){if(u=parseInt(l,8),u>127)throw new Error(vt`Octal encoded byte above 177 unsupported "${n}"`)}else u=no(l);r.push(xn(u,(a===0?"\\":"")+l))}return r}function K$(e){const t=[],n=new RegExp(iu,"gy");let s;for(;s=n.exec(e);){const o=s[0];if(o[0]==="{"){const r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(o);if(r){const{min:i,max:a}=r.groups;if(+i>+a&&o.endsWith("?")){n.lastIndex--,t.push(Zc(o.slice(0,-1)));continue}}}t.push(Zc(o))}return t}function pp(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const n=e.body[0];return!t||Object.keys(t).every(s=>t[s]===n[s])}function Z$(e){return Y$.has(e.type)}const Y$=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function gp(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},s=x$(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),o=(f,p)=>{const m=s.tokens[r.nextIndex];switch(r.parent=f,r.nextIndex++,m.type){case"Alternator":return bs();case"Assertion":return X$(m);case"Backreference":return J$(m,r);case"Character":return Ri(m.value,{useLastValid:!!p.isCheckingRangeEnd});case"CharacterClassHyphen":return Q$(m,r,p);case"CharacterClassOpen":return eC(m,r,p);case"CharacterSet":return tC(m,r);case"Directive":return aC(m.kind,{flags:m.flags});case"GroupOpen":return nC(m,r,p);case"NamedCallout":return uC(m.kind,m.tag,m.arguments);case"Quantifier":return sC(m,r);case"Subroutine":return oC(m,r);default:throw new Error(`Unexpected token type "${m.type}"`)}},r={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:s.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:o},i=dC(lC(s.flags));let a=i.body[0];for(;r.nextIndex<s.tokens.length;){const f=o(a,{});f.type==="Alternative"?(i.body.push(f),a=f):a.body.push(f)}const{capturingGroups:l,hasNumberedRef:u,namedGroupsByName:c,subroutines:d}=r;if(u&&c.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:f}of d)if(typeof f=="number"){if(f>l.length)throw new Error("Subroutine uses a group number that's not defined");f&&(l[f-1].isSubroutined=!0)}else if(c.has(f)){if(c.get(f).length>1)throw new Error(vt`Subroutine uses a duplicate group name "\g<${f}>"`);c.get(f)[0].isSubroutined=!0}else throw new Error(vt`Subroutine uses a group name that's not defined "\g<${f}>"`);return i}function X$({kind:e}){return nl(so({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===vt`\B`||e===vt`\Y`})}function J$({raw:e},t){const n=/^\\k[<']/.test(e),s=n?e.slice(3,-1):e.slice(1),o=(r,i=!1)=>{const a=t.capturingGroups.length;let l=!1;if(r>a)if(t.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,sl(i?a+1-r:r,{orphan:l})};if(n){const r=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(s);if(r)return o(+r.groups.num,!!r.groups.sign);if(/[-+]/.test(s))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(s))throw new Error(`Group name not defined to the left "${e}"`);return sl(s)}return o(+s)}function Q$(e,t,n){const{tokens:s,walk:o}=t,r=t.parent,i=r.body.at(-1),a=s[t.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const l=o(r,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&l.type==="Character")return r.body.pop(),iC(i,l);throw new Error("Invalid character class range")}return Ri(no("-"))}function eC({negate:e},t,n){const{tokens:s,walk:o}=t,r=[xr()],i=s[t.nextIndex];let a=Qc(i);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")r.push(xr()),t.nextIndex++;else{const u=r.at(-1);u.body.push(o(u,n))}a=Qc(s[t.nextIndex],i)}const l=xr({negate:e});return r.length===1?l.body=r[0].body:(l.kind="intersection",l.body=r.map(u=>u.body.length===1?u.body[0]:u)),t.nextIndex++,l}function tC({kind:e,negate:t,value:n},s){const{normalizeUnknownPropertyNames:o,skipPropertyNameValidation:r,unicodePropertyMap:i}=s;if(e==="property"){const a=Pi(n);if(ru.has(a)&&!(i!=null&&i.has(a)))e="posix",n=a;else return Ls(n,{negate:t,normalizeUnknownPropertyNames:o,skipPropertyNameValidation:r,unicodePropertyMap:i})}return e==="posix"?cC(n,{negate:t}):ol(e,{negate:t})}function nC(e,t,n){const{tokens:s,capturingGroups:o,namedGroupsByName:r,skipLookbehindValidation:i,walk:a}=t,l=fC(e),u=l.type==="AbsenceFunction",c=Jc(l),d=c&&l.negate;if(l.type==="CapturingGroup"&&(o.push(l),l.name&&C$(r,l.name,[]).push(l)),u&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let f=ed(s[t.nextIndex]);for(;f.type!=="GroupClose";){if(f.type==="Alternator")l.body.push(bs()),t.nextIndex++;else{const p=l.body.at(-1),m=a(p,{...n,isInAbsenceFunction:n.isInAbsenceFunction||u,isInLookbehind:n.isInLookbehind||c,isInNegLookbehind:n.isInNegLookbehind||d});if(p.body.push(m),(c||n.isInLookbehind)&&!i){const y="Lookbehind includes a pattern not allowed by Oniguruma";if(d||n.isInNegLookbehind){if(Xc(m)||m.type==="CapturingGroup")throw new Error(y)}else if(Xc(m)||Jc(m)&&m.negate)throw new Error(y)}}f=ed(s[t.nextIndex])}return t.nextIndex++,l}function sC({kind:e,min:t,max:n},s){const o=s.parent,r=o.body.at(-1);if(!r||!Z$(r))throw new Error("Quantifier requires a repeatable token");const i=vp(e,t,n,r);return o.body.pop(),i}function oC({raw:e},t){const{capturingGroups:n,subroutines:s}=t;let o=e.slice(3,-1);const r=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(o);if(r){const a=+r.groups.num,l=n.length;if(t.hasNumberedRef=!0,o={"":a,"+":l+a,"-":l+1-a}[r.groups.sign],o<1)throw new Error("Invalid subroutine number")}else o==="0"&&(o=0);const i=yp(o);return s.push(i),i}function rC(e,t){return{type:"AbsenceFunction",kind:e,body:Xo(t==null?void 0:t.body)}}function bs(e){return{type:"Alternative",body:bp(e==null?void 0:e.body)}}function nl(e,t){const n={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(n.negate=!!(t!=null&&t.negate)),n}function sl(e,t){const n=!!(t!=null&&t.orphan);return{type:"Backreference",ref:e,...n&&{orphan:n}}}function mp(e,t){const n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!hC(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Xo(t==null?void 0:t.body)}}function Ri(e,t){const n={useLastValid:!1,...t};if(e>1114111){const s=e.toString(16);if(n.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${s}}"`):new Error(`Invalid code point out of range in JS "\\x{${s}}"`)}return{type:"Character",value:e}}function xr(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:bp(e==null?void 0:e.body)}}function iC(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function ol(e,t){const n=!!(t!=null&&t.negate),s={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(s.negate=n),(e==="text_segment"||e==="newline"&&!n)&&(s.variableLength=!0),s}function aC(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:so(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function lC(e){return{type:"Flags",...e}}function Qt(e){const t=e==null?void 0:e.atomic,n=e==null?void 0:e.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:Xo(e==null?void 0:e.body)}}function ls(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:Xo(e==null?void 0:e.body)}}function uC(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}function cC(e,t){const n=!!(t!=null&&t.negate);if(!ru.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}function vp(e,t,n,s){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:s}}function dC(e,t){return{type:"Regex",body:Xo(t==null?void 0:t.body),flags:e}}function yp(e){return{type:"Subroutine",ref:e}}function Ls(e,t){var o;const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let s=(o=n.unicodePropertyMap)==null?void 0:o.get(Pi(e));if(!s){if(n.normalizeUnknownPropertyNames)s=pC(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(vt`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:s??e,negate:n.negate}}function fC({flags:e,kind:t,name:n,negate:s,number:o}){switch(t){case"absence_repeater":return rC("repeater");case"atomic":return Qt({atomic:!0});case"capturing":return mp(o,{name:n});case"group":return Qt({flags:e});case"lookahead":case"lookbehind":return ls({behind:t==="lookbehind",negate:s});default:throw new Error(`Unexpected group kind "${t}"`)}}function Xo(e){if(e===void 0)e=[bs()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function bp(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function Xc(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function Jc(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function hC(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function pC(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function Pi(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Qc(e,t){const n=t;return so(e,`Unclosed character class${(n==null?void 0:n.type)==="Character"&&n.value===93&&n.raw==="]"?' (started with "]")':""}`)}function ed(e){return so(e,"Unclosed group")}function To(e,t,n=null){function s(r,i){for(let a=0;a<r.length;a++){const l=o(r[a],i,a,r);a=Math.max(-1,a+l)}}function o(r,i=null,a=null,l=null){var k,w;let u=0,c=!1;const d={node:r,parent:i,key:a,container:l,root:e,remove(){cr(l).splice(Math.max(0,Es(a)+u),1),u--,c=!0},removeAllNextSiblings(){return cr(l).splice(Es(a)+1)},removeAllPrevSiblings(){const S=Es(a)+u;return u-=S,cr(l).splice(0,Math.max(0,S))},replaceWith(S,I={}){const q=!!I.traverse;l?l[Math.max(0,Es(a)+u)]=S:so(i,"Can't replace root node")[a]=S,q&&o(S,i,a,l),c=!0},replaceWithMultiple(S,I={}){const q=!!I.traverse;if(cr(l).splice(Math.max(0,Es(a)+u),1,...S),u+=S.length-1,q){let B=0;for(let R=0;R<S.length;R++)B+=o(S[R],i,Es(a)+R+B,l)}c=!0},skip(){c=!0}},{type:f}=r,p=t["*"],m=t[f],y=typeof p=="function"?p:p==null?void 0:p.enter,b=typeof m=="function"?m:m==null?void 0:m.enter;if(y==null||y(d,n),b==null||b(d,n),!c)switch(f){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":s(r.body,r);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":o(r.min,r,"min"),o(r.max,r,"max");break;case"Quantifier":o(r.body,r,"body");break;case"Regex":s(r.body,r),o(r.flags,r,"flags");break;default:throw new Error(`Unexpected node type "${f}"`)}return(k=m==null?void 0:m.exit)==null||k.call(m,d,n),(w=p==null?void 0:p.exit)==null||w.call(p,d,n),u}return o(e),e}function cr(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function Es(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const gC=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function mC(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function vC(e,t,n,s){return e.slice(0,t)+s+e.slice(t+n.length)}const qt=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function au(e,t,n,s){const o=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),r=[!1];let i=0,a="";for(const l of e.matchAll(o)){const{0:u,groups:{$skip:c}}=l;if(!c&&(!s||s===qt.DEFAULT==!i)){n instanceof Function?a+=n(l,{context:i?qt.CHAR_CLASS:qt.DEFAULT,negated:r[r.length-1]}):a+=n;continue}u[0]==="["?(i++,r.push(u[1]==="^")):u==="]"&&i&&(i--,r.pop()),a+=u}return a}function kp(e,t,n,s){au(e,t,n,s)}function yC(e,t,n=0,s){if(!new RegExp(t,"su").test(e))return null;const o=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");o.lastIndex=n;let r=0,i;for(;i=o.exec(e);){const{0:a,groups:{$skip:l}}=i;if(!l&&(!s||s===qt.DEFAULT==!r))return i;a==="["?r++:a==="]"&&r&&r--,o.lastIndex==i.index&&o.lastIndex++}return null}function dr(e,t,n){return!!yC(e,t,0,n)}function bC(e,t){const n=/\\?./gsu;n.lastIndex=t;let s=e.length,o=0,r=1,i;for(;i=n.exec(e);){const[a]=i;if(a==="[")o++;else if(o)a==="]"&&o--;else if(a==="(")r++;else if(a===")"&&(r--,!r)){s=i.index;break}}return e.slice(t,s)}const td=new RegExp(String.raw`(?<noncapturingStart>${gC})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function kC(e,t){const n=(t==null?void 0:t.hiddenCaptures)??[];let s=(t==null?void 0:t.captureTransfers)??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};const o="(?>",r="(?:(?=(",i=[0],a=[];let l=0,u=0,c=NaN,d;do{d=!1;let f=0,p=0,m=!1,y;for(td.lastIndex=Number.isNaN(c)?0:c+r.length;y=td.exec(e);){const{0:b,index:k,groups:{capturingStart:w,noncapturingStart:S}}=y;if(b==="[")f++;else if(f)b==="]"&&f--;else if(b===o&&!m)c=k,m=!0;else if(m&&S)p++;else if(w)m?p++:(l++,i.push(l+u));else if(b===")"&&m){if(!p){u++;const I=l+u;if(e=`${e.slice(0,c)}${r}${e.slice(c+o.length,k)}))<$$${I}>)${e.slice(k+1)}`,d=!0,a.push(I),mC(n,I),s.size){const q=new Map;s.forEach((B,R)=>{q.set(R>=I?R+1:R,B.map(L=>L>=I?L+1:L))}),s=q}break}p--}}}while(d);return n.push(...a),e=au(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:f,groups:{backrefNum:p,wrappedBackrefNum:m}})=>{if(p){const y=+p;if(y>i.length-1)throw new Error(`Backref "${f}" greater than number of captures`);return`\\${i[y]}`}return`\\${m}`},qt.DEFAULT),{pattern:e,captureTransfers:s,hiddenCaptures:n}}const wp=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,ia=new RegExp(String.raw`
|
|
119
|
+
\\(?: \d+
|
|
120
|
+
| c[A-Za-z]
|
|
121
|
+
| [gk]<[^>]+>
|
|
122
|
+
| [pPu]\{[^\}]+\}
|
|
123
|
+
| u[A-Fa-f\d]{4}
|
|
124
|
+
| x[A-Fa-f\d]{2}
|
|
125
|
+
)
|
|
126
|
+
| \((?: \? (?: [:=!>]
|
|
127
|
+
| <(?:[=!]|[^>]+>)
|
|
128
|
+
| [A-Za-z\-]+:
|
|
129
|
+
| \(DEFINE\)
|
|
130
|
+
))?
|
|
131
|
+
| (?<qBase>${wp})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
132
|
+
| \\?.
|
|
133
|
+
`.replace(/\s+/g,""),"gsu");function wC(e){if(!new RegExp(`${wp}\\+`).test(e))return{pattern:e};const t=[];let n=null,s=null,o="",r=0,i;for(ia.lastIndex=0;i=ia.exec(e);){const{0:a,index:l,groups:{qBase:u,qMod:c,invalidQ:d}}=i;if(a==="[")r||(s=l),r++;else if(a==="]")r?r--:s=null;else if(!r)if(c==="+"&&o&&!o.startsWith("(")){if(d)throw new Error(`Invalid quantifier "${a}"`);let f=-1;if(/^\{\d+\}$/.test(u))e=vC(e,l+u.length,c,"");else{if(o===")"||o==="]"){const p=o===")"?n:s;if(p===null)throw new Error(`Invalid unmatched "${o}"`);e=`${e.slice(0,p)}(?>${e.slice(p,l)}${u})${e.slice(l+a.length)}`}else e=`${e.slice(0,l-o.length)}(?>${o}${u})${e.slice(l+a.length)}`;f+=4}ia.lastIndex+=f}else a[0]==="("?t.push(l):a===")"&&(n=t.length?t.pop():null);o=a}return{pattern:e}}const Ht=String.raw,SC=Ht`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,rl=Ht`\(\?R=(?<rDepth>[^\)]+)\)|${SC}`,Li=Ht`\(\?<(?![=!])(?<captureName>[^>]+)>`,Sp=Ht`${Li}|(?<unnamed>\()(?!\?)`,ts=new RegExp(Ht`${Li}|${rl}|\(\?|\\?.`,"gsu"),aa="Cannot use multiple overlapping recursions";function _C(e,t){const{hiddenCaptures:n,mode:s}={hiddenCaptures:[],mode:"plugin",...t};let o=(t==null?void 0:t.captureTransfers)??new Map;if(!new RegExp(rl,"su").test(e))return{pattern:e,captureTransfers:o,hiddenCaptures:n};if(s==="plugin"&&dr(e,Ht`\(\?\(DEFINE\)`,qt.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const r=[],i=dr(e,Ht`\\[1-9]`,qt.DEFAULT),a=new Map,l=[];let u=!1,c=0,d=0,f;for(ts.lastIndex=0;f=ts.exec(e);){const{0:p,groups:{captureName:m,rDepth:y,gRNameOrNum:b,gRDepth:k}}=f;if(p==="[")c++;else if(c)p==="]"&&c--;else if(y){if(nd(y),u)throw new Error(aa);if(i)throw new Error(`${s==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const w=e.slice(0,f.index),S=e.slice(ts.lastIndex);if(dr(S,rl,qt.DEFAULT))throw new Error(aa);const I=+y-1;e=sd(w,S,I,!1,n,r,d),o=rd(o,w,I,r.length,0,d);break}else if(b){nd(k);let w=!1;for(const O of l)if(O.name===b||O.num===+b){if(w=!0,O.hasRecursedWithin)throw new Error(aa);break}if(!w)throw new Error(Ht`Recursive \g cannot be used outside the referenced group "${s==="external"?b:Ht`\g<${b}&R=${k}>`}"`);const S=a.get(b),I=bC(e,S);if(i&&dr(I,Ht`${Li}|\((?!\?)`,qt.DEFAULT))throw new Error(`${s==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const q=e.slice(S,f.index),B=I.slice(q.length+p.length),R=r.length,L=+k-1,A=sd(q,B,L,!0,n,r,d);o=rd(o,q,L,r.length-R,R,d);const W=e.slice(0,S),F=e.slice(S+I.length);e=`${W}${A}${F}`,ts.lastIndex+=A.length-p.length-q.length-B.length,l.forEach(O=>O.hasRecursedWithin=!0),u=!0}else if(m)d++,a.set(String(d),ts.lastIndex),a.set(m,ts.lastIndex),l.push({num:d,name:m});else if(p[0]==="("){const w=p==="(";w&&(d++,a.set(String(d),ts.lastIndex)),l.push(w?{num:d}:{})}else p===")"&&l.pop()}return n.push(...r),{pattern:e,captureTransfers:o,hiddenCaptures:n}}function nd(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function sd(e,t,n,s,o,r,i){const a=new Set;s&&kp(e+t,Li,({groups:{captureName:u}})=>{a.add(u)},qt.DEFAULT);const l=[n,s?a:null,o,r,i];return`${e}${od(`(?:${e}`,"forward",...l)}(?:)${od(`${t})`,"backward",...l)}${t}`}function od(e,t,n,s,o,r,i){const l=c=>t==="forward"?c+2:n-c+2-1;let u="";for(let c=0;c<n;c++){const d=l(c);u+=au(e,Ht`${Sp}|\\k<(?<backref>[^>]+)>`,({0:f,groups:{captureName:p,unnamed:m,backref:y}})=>{if(y&&s&&!s.has(y))return f;const b=`_$${d}`;if(m||p){const k=i+r.length+1;return r.push(k),$C(o,k),m?f:`(?<${p}${b}>`}return Ht`\k<${y}${b}>`},qt.DEFAULT)}return u}function $C(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function rd(e,t,n,s,o,r){if(e.size&&s){let i=0;kp(t,Sp,()=>i++,qt.DEFAULT);const a=r-i+o,l=new Map;return e.forEach((u,c)=>{const d=(s-i*n)/n,f=i*n,p=c>a+i?c+s:c,m=[];for(const y of u)if(y<=a)m.push(y);else if(y>a+i+d)m.push(y+s);else if(y<=a+i)for(let b=0;b<=n;b++)m.push(y+i*b);else for(let b=0;b<=n;b++)m.push(y+f+d*b);l.set(p,m)}),l}return e}var ft=String.fromCodePoint,Be=String.raw,nn={},Di=globalThis.RegExp;nn.flagGroups=(()=>{try{new Di("(?i:)")}catch{return!1}return!0})();nn.unicodeSets=(()=>{try{new Di("[[]]","v")}catch{return!1}return!0})();nn.bugFlagVLiteralHyphenIsRange=nn.unicodeSets?(()=>{try{new Di(Be`[\d\-a]`,"v")}catch{return!0}return!1})():!1;nn.bugNestedClassIgnoresNegation=nn.unicodeSets&&new Di("[[^a]]","v").test("a");function li(e,{enable:t,disable:n}){return{dotAll:!(n!=null&&n.dotAll)&&!!(t!=null&&t.dotAll||e.dotAll),ignoreCase:!(n!=null&&n.ignoreCase)&&!!(t!=null&&t.ignoreCase||e.ignoreCase)}}function Fo(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function il(e,t){return id[e]>=id[t]}function CC(e,t){if(e==null)throw new Error(t??"Value expected");return e}var id={ES2025:2025,ES2024:2024,ES2018:2018},xC={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function _p(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!xC[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=nn.flagGroups?"ES2025":nn.unicodeSets?"ES2024":"ES2018"),t}var TC="[ -\r ]",IC=new Set([ft(304),ft(305)]),gn=Be`[\p{L}\p{M}\p{N}\p{Pc}]`;function $p(e){if(IC.has(e))return[e];const t=new Set,n=e.toLowerCase(),s=n.toUpperCase(),o=MC.get(n),r=EC.get(n),i=AC.get(n);return[...s].length===1&&t.add(s),i&&t.add(i),o&&t.add(o),t.add(n),r&&t.add(r),[...t]}var lu=new Map(`C Other
|
|
134
|
+
Cc Control cntrl
|
|
135
|
+
Cf Format
|
|
136
|
+
Cn Unassigned
|
|
137
|
+
Co Private_Use
|
|
138
|
+
Cs Surrogate
|
|
139
|
+
L Letter
|
|
140
|
+
LC Cased_Letter
|
|
141
|
+
Ll Lowercase_Letter
|
|
142
|
+
Lm Modifier_Letter
|
|
143
|
+
Lo Other_Letter
|
|
144
|
+
Lt Titlecase_Letter
|
|
145
|
+
Lu Uppercase_Letter
|
|
146
|
+
M Mark Combining_Mark
|
|
147
|
+
Mc Spacing_Mark
|
|
148
|
+
Me Enclosing_Mark
|
|
149
|
+
Mn Nonspacing_Mark
|
|
150
|
+
N Number
|
|
151
|
+
Nd Decimal_Number digit
|
|
152
|
+
Nl Letter_Number
|
|
153
|
+
No Other_Number
|
|
154
|
+
P Punctuation punct
|
|
155
|
+
Pc Connector_Punctuation
|
|
156
|
+
Pd Dash_Punctuation
|
|
157
|
+
Pe Close_Punctuation
|
|
158
|
+
Pf Final_Punctuation
|
|
159
|
+
Pi Initial_Punctuation
|
|
160
|
+
Po Other_Punctuation
|
|
161
|
+
Ps Open_Punctuation
|
|
162
|
+
S Symbol
|
|
163
|
+
Sc Currency_Symbol
|
|
164
|
+
Sk Modifier_Symbol
|
|
165
|
+
Sm Math_Symbol
|
|
166
|
+
So Other_Symbol
|
|
167
|
+
Z Separator
|
|
168
|
+
Zl Line_Separator
|
|
169
|
+
Zp Paragraph_Separator
|
|
170
|
+
Zs Space_Separator
|
|
171
|
+
ASCII
|
|
172
|
+
ASCII_Hex_Digit AHex
|
|
173
|
+
Alphabetic Alpha
|
|
174
|
+
Any
|
|
175
|
+
Assigned
|
|
176
|
+
Bidi_Control Bidi_C
|
|
177
|
+
Bidi_Mirrored Bidi_M
|
|
178
|
+
Case_Ignorable CI
|
|
179
|
+
Cased
|
|
180
|
+
Changes_When_Casefolded CWCF
|
|
181
|
+
Changes_When_Casemapped CWCM
|
|
182
|
+
Changes_When_Lowercased CWL
|
|
183
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
184
|
+
Changes_When_Titlecased CWT
|
|
185
|
+
Changes_When_Uppercased CWU
|
|
186
|
+
Dash
|
|
187
|
+
Default_Ignorable_Code_Point DI
|
|
188
|
+
Deprecated Dep
|
|
189
|
+
Diacritic Dia
|
|
190
|
+
Emoji
|
|
191
|
+
Emoji_Component EComp
|
|
192
|
+
Emoji_Modifier EMod
|
|
193
|
+
Emoji_Modifier_Base EBase
|
|
194
|
+
Emoji_Presentation EPres
|
|
195
|
+
Extended_Pictographic ExtPict
|
|
196
|
+
Extender Ext
|
|
197
|
+
Grapheme_Base Gr_Base
|
|
198
|
+
Grapheme_Extend Gr_Ext
|
|
199
|
+
Hex_Digit Hex
|
|
200
|
+
IDS_Binary_Operator IDSB
|
|
201
|
+
IDS_Trinary_Operator IDST
|
|
202
|
+
ID_Continue IDC
|
|
203
|
+
ID_Start IDS
|
|
204
|
+
Ideographic Ideo
|
|
205
|
+
Join_Control Join_C
|
|
206
|
+
Logical_Order_Exception LOE
|
|
207
|
+
Lowercase Lower
|
|
208
|
+
Math
|
|
209
|
+
Noncharacter_Code_Point NChar
|
|
210
|
+
Pattern_Syntax Pat_Syn
|
|
211
|
+
Pattern_White_Space Pat_WS
|
|
212
|
+
Quotation_Mark QMark
|
|
213
|
+
Radical
|
|
214
|
+
Regional_Indicator RI
|
|
215
|
+
Sentence_Terminal STerm
|
|
216
|
+
Soft_Dotted SD
|
|
217
|
+
Terminal_Punctuation Term
|
|
218
|
+
Unified_Ideograph UIdeo
|
|
219
|
+
Uppercase Upper
|
|
220
|
+
Variation_Selector VS
|
|
221
|
+
White_Space space
|
|
222
|
+
XID_Continue XIDC
|
|
223
|
+
XID_Start XIDS`.split(/\s/).map(e=>[Pi(e),e])),EC=new Map([["s",ft(383)],[ft(383),"s"]]),AC=new Map([[ft(223),ft(7838)],[ft(107),ft(8490)],[ft(229),ft(8491)],[ft(969),ft(8486)]]),MC=new Map([Nn(453),Nn(456),Nn(459),Nn(498),...la(8072,8079),...la(8088,8095),...la(8104,8111),Nn(8124),Nn(8140),Nn(8188)]),RC=new Map([["alnum",Be`[\p{Alpha}\p{Nd}]`],["alpha",Be`\p{Alpha}`],["ascii",Be`\p{ASCII}`],["blank",Be`[\p{Zs}\t]`],["cntrl",Be`\p{Cc}`],["digit",Be`\p{Nd}`],["graph",Be`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",Be`\p{Lower}`],["print",Be`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",Be`[\p{P}\p{S}]`],["space",Be`\p{space}`],["upper",Be`\p{Upper}`],["word",Be`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",Be`\p{AHex}`]]);function PC(e,t){const n=[];for(let s=e;s<=t;s++)n.push(s);return n}function Nn(e){const t=ft(e);return[t.toLowerCase(),t]}function la(e,t){return PC(e,t).map(n=>Nn(n))}var Cp=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function LC(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};xp(e);const s={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:il(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};To(e,DC,s);const o={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},r={currentFlags:o,prevFlags:null,globalFlags:o,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:s.subroutineRefMap};To(e,OC,r);const i={groupsByName:r.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:r.reffedNodesByReferencer};return To(e,NC,i),e._originMap=r.groupOriginByCopy,e._strategy=s.strategy,e}var DC={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:s,kind:o}=e;if(o==="repeater"){const r=Qt();r.body[0].body.push(ls({negate:!0,body:s}),Ls("Any"));const i=Qt();i.body[0].body.push(vp("greedy",0,1/0,r)),n(lt(i,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:s}){const o=e.body.filter(r=>r.kind==="flags");for(let r=n+1;r<t.body.length;r++){const i=t.body[r];Fo(s,i,[]).push(...o)}},exit({node:e},{flagDirectivesByAlt:t}){var n;if((n=t.get(e))!=null&&n.length){const s=Ip(t.get(e));if(s){const o=Qt({flags:s});o.body[0].body=e.body,e.body=[lt(o,e)]}}}},Assertion({node:e,parent:t,key:n,container:s,root:o,remove:r,replaceWith:i},a){const{kind:l,negate:u}=e,{asciiWordBoundaries:c,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=a;if(l==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${u?"Y":"y"}"`);if(l==="line_end")i(lt(ls({body:[bs({body:[nl("string_end")]}),bs({body:[Ri(10)]})]}),t));else if(l==="line_start")i(lt(mn(Be`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(l==="search_start")if(f.has(e))o.flags.sticky=!0,r();else{const m=s[n-1];if(m&&zC(m))i(lt(ls({negate:!0}),t));else{if(d)throw new Error(Be`Uses "\G" in a way that requires a subclass`);i(Gn(nl("string_start"),t)),a.strategy="clip_search"}}else if(!(l==="string_end"||l==="string_start"))if(l==="string_end_newline")i(lt(mn(Be`(?=\n?\z)`),t));else if(l==="word_boundary"){if(!p&&!c){const m=`(?:(?<=${gn})(?!${gn})|(?<!${gn})(?=${gn}))`,y=`(?:(?<=${gn})(?=${gn})|(?<!${gn})(?!${gn}))`;i(lt(mn(u?y:m),t))}}else throw new Error(`Unexpected assertion kind "${l}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!ca(n)&&(n=ua(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:s}=e;s&&!ca(s)&&(s=ua(s,t),e.name=s),n.set(e.number,e),s&&n.set(s,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const s=xr({body:[e]});n(lt(s,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:s,minTargetEs2024:o,digitIsAscii:r,spaceIsAscii:i,wordIsAscii:a}){const{kind:l,negate:u,value:c}=e;if(r&&(l==="digit"||c==="digit")){n(Gn(ol("digit",{negate:u}),t));return}if(i&&(l==="space"||c==="space")){n(lt(da(mn(TC),u),t));return}if(a&&(l==="word"||c==="word")){n(Gn(ol("word",{negate:u}),t));return}if(l==="any")n(Gn(Ls("Any"),t));else if(l==="digit")n(Gn(Ls("Nd",{negate:u}),t));else if(l!=="dot")if(l==="text_segment"){if(s==="strict")throw new Error(Be`Use of "\X" requires non-strict accuracy`);const d="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",f=Be`\p{RI}{2}|${d}(?:\u200D${d})*`;n(lt(mn(Be`(?>\r\n|${o?Be`\p{RGI_Emoji}`:f}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(l==="hex")n(Gn(Ls("AHex",{negate:u}),t));else if(l==="newline")n(lt(mn(u?`[^
|
|
224
|
+
]`:`(?>\r
|
|
225
|
+
?|[
|
|
226
|
+
\v\f
\u2028\u2029])`),t));else if(l==="posix")if(!o&&(c==="graph"||c==="print")){if(s==="strict")throw new Error(`POSIX class "${c}" requires min target ES2024 or non-strict accuracy`);let d={graph:"!-~",print:" -~"}[c];u&&(d=`\0-${ft(d.codePointAt(0)-1)}${ft(d.codePointAt(2)+1)}-`),n(lt(mn(`[${d}]`),t))}else n(lt(da(mn(RC.get(c)),u),t));else if(l==="property")lu.has(Pi(c))||(e.key="sc");else if(l==="space")n(Gn(Ls("space",{negate:u}),t));else if(l==="word")n(lt(da(mn(gn),u),t));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:n,remove:s,replaceWith:o,removeAllPrevSiblings:r,removeAllNextSiblings:i}){const{kind:a,flags:l}=e;if(a==="flags")if(!l.enable&&!l.disable)s();else{const u=Qt({flags:l});u.body[0].body=i(),o(lt(u,t),{traverse:!0})}else if(a==="keep"){const u=n.body[0],d=n.body.length===1&&pp(u,{type:"Group"})&&u.body[0].body.length===1?u.body[0]:n;if(t.parent!==d||d.body.length>1)throw new Error(Be`Uses "\K" in a way that's unsupported`);const f=ls({behind:!0});f.body[0].body=r(),o(lt(f,t))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t!=null&&t.extended&&delete t.extended,n!=null&&n.extended&&delete n.extended,t!=null&&t.dotAll&&(n!=null&&n.dotAll)&&delete t.dotAll,t!=null&&t.ignoreCase&&(n!=null&&n.ignoreCase)&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:s}=e;if(s==="fail")n(lt(ls({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${s.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=Qt();t.body[0].body.push(e.body),e.body=lt(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let s=!1,o=!1;for(const r of e.body)if(r.body.length===1&&r.body[0].kind==="search_start")r.body.pop();else{const i=Ap(r.body);i?(s=!0,Array.isArray(i)?n.push(...i):n.push(i)):o=!0}s&&!o&&n.forEach(r=>t.add(r))},exit(e,{accuracy:t,passedLookbehind:n,strategy:s}){if(t==="strict"&&n&&s)throw new Error(Be`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!ca(n)&&(n=ua(n,t),e.ref=n)}},OC={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:s,ref:o}=e;s||n.set(e,[...t.get(o).map(({node:r})=>r)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:s},{groupOriginByCopy:o,groupsByName:r,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:l}){const u=o.get(e);if(u&&a.has(e.number)){const d=Gn(ad(e.number),t);l.set(d,a.get(e.number)),n(d);return}a.set(e.number,e),i.set(e.number,[]),e.name&&Fo(i,e.name,[]);const c=i.get(e.name??e.number);for(let d=0;d<c.length;d++){const f=c[d];if(u===f.node||u&&u===f.origin||e===f.origin){c.splice(d,1);break}}if(i.get(e.number).push({node:e,origin:u}),e.name&&i.get(e.name).push({node:e,origin:u}),e.name){const d=Fo(r,e.name,new Map);let f=!1;if(u)f=!0;else for(const p of d.values())if(!p.hasDuplicateNameToRemove){f=!0;break}r.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=li(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},s){const{isRecursive:o,ref:r}=e;if(o){let c=t;for(;(c=c.parent)&&!(c.type==="CapturingGroup"&&(c.name===r||c.number===r)););s.reffedNodesByReferencer.set(e,c);return}const i=s.subroutineRefMap.get(r),a=r===0,l=a?ad(0):Tp(i,s.groupOriginByCopy,null);let u=l;if(!a){const c=Ip(FC(i,f=>f.type==="Group"&&!!f.flags)),d=c?li(s.globalFlags,c):s.globalFlags;GC(d,s.currentFlags)||(u=Qt({flags:jC(d)}),u.body[0].body.push(l))}n(lt(u,t),{traverse:!a})}},NC={Backreference({node:e,parent:t,replaceWith:n},s){if(e.orphan){s.highestOrphanBackref=Math.max(s.highestOrphanBackref,e.ref);return}const r=s.reffedNodesByReferencer.get(e).filter(i=>BC(i,e));if(!r.length)n(lt(ls({negate:!0}),t));else if(r.length>1){const i=Qt({atomic:!0,body:r.reverse().map(a=>bs({body:[sl(a.number)]}))});n(lt(i,t))}else e.ref=r[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let s=0;s<n;s++){const o=mp();e.body.at(-1).body.push(o)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function xp(e){To(e,{"*"({node:t,parent:n}){t.parent=n}})}function GC(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function BC(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const s=Ep(n.parent);for(const o of s){if(o===n)break;if(o===e||Mp(o,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Tp(e,t,n,s){const o=Array.isArray(e)?[]:{};for(const[r,i]of Object.entries(e))r==="parent"?o.parent=Array.isArray(n)?s:n:i&&typeof i=="object"?o[r]=Tp(i,t,o,n):(r==="type"&&i==="CapturingGroup"&&t.set(o,t.get(e)??e),o[r]=i);return o}function ad(e){const t=yp(e);return t.isRecursive=!0,t}function FC(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function ua(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Ip(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:s})=>{t.forEach(o=>{var r,i;(r=s.enable)!=null&&r[o]&&(delete n.disable[o],n.enable[o]=!0),(i=s.disable)!=null&&i[o]&&(n.disable[o]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function jC({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ep(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Ap(e){const t=e.find(n=>n.kind==="search_start"||HC(n,{negate:!1})||!UC(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const s of t.body){const o=Ap(s.body);if(!o)return null;Array.isArray(o)?n.push(...o):n.push(o)}return n}return null}function Mp(e,t){const n=Ep(e)??[];for(const s of n)if(s===t||Mp(s,t))return!0;return!1}function UC({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function zC(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function HC(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&pp(e.body[0],{type:"Assertion",kind:"search_start"})}function ca(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function mn(e,t){const s=gp(e,{...t,unicodePropertyMap:lu}).body;return s.length>1||s[0].body.length>1?Qt({body:s}):s[0].body[0]}function da(e,t){return e.negate=t,e}function Gn(e,t){return e.parent=t,e}function lt(e,t){return xp(e),e.parent=t,e}function WC(e,t){const n=_p(t),s=il(n.target,"ES2024"),o=il(n.target,"ES2025"),r=n.rules.recursionLimit;if(!Number.isInteger(r)||r<2||r>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!o){const p=[e.flags.ignoreCase];To(e,qC,{getCurrentModI:()=>p.at(-1),popModI(){p.pop()},pushModI(m){p.push(m)},setHasCasedChar(){p.at(-1)?i=!0:a=!0}})}const l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!a)};let u=e;const c={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:r,useAppliedIgnoreCase:!!(!o&&i&&a),useFlagMods:o,useFlagV:s,verbose:n.verbose};function d(p){return c.lastNode=u,u=p,CC(VC[p.type],`Unexpected node type "${p.type}"`)(p,c,d)}const f={pattern:e.body.map(d).join("|"),flags:d(e.flags),options:{...e.options}};return s||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],c.captureMap.forEach((p,m)=>{p.hidden&&f._hiddenCaptures.push(m),p.transferTo&&Fo(f._captureTransfers,p.transferTo,[]).push(m)}),f}var qC={"*":{enter({node:e},t){if(ud(e)){const n=t.getCurrentModI();t.pushModI(e.flags?li({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){ud(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){uu(ft(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Rp(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&Cp.has(e.value)&&t.setHasCasedChar()}},VC={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?Be`\B`:Be`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:s,name:o,number:r}=e,i={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(i.hidden=!0,r>a.number&&(i.transferTo=a.number)),t.captureMap.set(r,i),`(${o?`?<${o}>`:""}${s.map(n).join("|")})`},Character({value:e},t){const n=ft(e),s=As(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==n)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&uu(n)){const o=$p(n);return t.inCharClass?o.join(""):o.length>1?`[${o.join("")}]`:o[0]}return n},CharacterClass(e,t,n){const{kind:s,negate:o,parent:r}=e;let{body:i}=e;if(s==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");nn.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(cd)&&(i=[Ri(45),...i.filter(u=>!cd(u))]);const a=()=>`[${o?"^":""}${i.map(n).join(s==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||nn.bugNestedClassIgnoresNegation)&&!o){const c=i.filter(d=>d.type==="CharacterClass"&&d.kind==="union"&&d.negate);if(c.length){const d=Qt(),f=d.body[0];return d.parent=r,f.parent=d,i=i.filter(p=>!c.includes(p)),e.body=i,i.length?(e.parent=f,f.body.push(e)):d.body.pop(),c.forEach(p=>{const m=bs({body:[p]});p.parent=m,m.parent=d,d.body.push(m)}),n(d)}}t.inCharClass=!0;const u=a();return t.inCharClass=!1,u}const l=i[0];if(s==="union"&&!o&&l&&((!t.useFlagV||!t.verbose)&&r.kind==="union"&&!(nn.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&r.kind==="intersection"&&i.length===1&&l.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&r.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,s=e.max.value,o={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},r=As(n,o),i=As(s,o),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const l=Rp(e);JC(l).forEach(c=>{a.add(Array.isArray(c)?`${As(c[0],o)}-${As(c[1],o)}`:As(c,o))})}return`${r}-${i}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:s},o){if(e==="dot")return o.currentFlags.dotAll?o.appliedGlobalFlags.dotAll||o.useFlagMods?".":"[^]":Be`[^\n]`;if(e==="digit")return t?Be`\D`:Be`\d`;if(e==="property"){if(o.useAppliedIgnoreCase&&o.currentFlags.ignoreCase&&Cp.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?Be`\P`:Be`\p`}{${s?`${s}=`:""}${n}}`}if(e==="word")return t?Be`\W`:Be`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:s},o,r){const i=o.currentFlags;n&&(o.currentFlags=li(i,n));const a=t.map(r).join("|"),l=!o.verbose&&t.length===1&&s.type!=="Quantifier"&&!e&&(!o.useFlagMods||!n)?a:`(?${QC(e,n,o.useFlagMods)}${a})`;return o.currentFlags=i,l},LookaroundAssertion({body:e,kind:t,negate:n},s,o){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(o).join("|")})`},Quantifier(e,t,n){return n(e.body)+ex(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const s=n.recursionLimit;return t===0?`(?R=${s})`:Be`\g<${t}&R=${s}>`}},KC=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),ZC=new Set(["-","\\","]","^","["]),YC=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),ld=new Map([[9,Be`\t`],[10,Be`\n`],[11,Be`\v`],[12,Be`\f`],[13,Be`\r`],[8232,Be`\u2028`],[8233,Be`\u2029`],[65279,Be`\uFEFF`]]),XC=new RegExp("^\\p{Cased}$","u");function uu(e){return XC.test(e)}function Rp(e,t){const n=!!(t!=null&&t.firstOnly),s=e.min.value,o=e.max.value,r=[];if(s<65&&(o===65535||o>=131071)||s===65536&&o>=131071)return r;for(let i=s;i<=o;i++){const a=ft(i);if(!uu(a))continue;const l=$p(a).filter(u=>{const c=u.codePointAt(0);return c<s||c>o});if(l.length&&(r.push(...l),n))break}return r}function As(e,{escDigit:t,inCharClass:n,useFlagV:s}){if(ld.has(e))return ld.get(e);if(e<32||e>126&&e<160||e>262143||t&&tx(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const o=n?s?YC:ZC:KC,r=ft(e);return(o.has(r)?"\\":"")+r}function JC(e){const t=e.map(o=>o.codePointAt(0)).sort((o,r)=>o-r),n=[];let s=null;for(let o=0;o<t.length;o++)t[o+1]===t[o]+1?s??(s=t[o]):s===null?n.push(t[o]):(n.push([s,t[o]]),s=null);return n}function QC(e,t,n){if(e)return">";let s="";if(t&&n){const{enable:o,disable:r}=t;s=(o!=null&&o.ignoreCase?"i":"")+(o!=null&&o.dotAll?"s":"")+(r?"-":"")+(r!=null&&r.ignoreCase?"i":"")+(r!=null&&r.dotAll?"s":"")}return`${s}:`}function ex({kind:e,max:t,min:n}){let s;return!n&&t===1?s="?":!n&&t===1/0?s="*":n===1&&t===1/0?s="+":n===t?s=`{${n}}`:s=`{${n},${t===1/0?"":t}}`,s+{greedy:"",lazy:"?",possessive:"+"}[e]}function ud({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function tx(e){return e>47&&e<58}function cd({type:e,value:t}){return e==="Character"&&t===45}var Fn,kn,ds,jn,fs,jo,al,Hn,nx=(Hn=class extends RegExp{constructor(n,s,o){var t=(...WD)=>(super(...WD),Xn(this,jo),Xn(this,Fn,new Map),Xn(this,kn,null),Xn(this,ds),Xn(this,jn,null),Xn(this,fs,null),V(this,"rawOptions",{}),this);const r=!!(o!=null&&o.lazyCompile);if(n instanceof RegExp){if(o)throw new Error("Cannot provide options when copying a regexp");const i=n;t(i,s),Yt(this,ds,i.source),i instanceof Hn&&(Yt(this,Fn,Et(i,Fn)),Yt(this,jn,Et(i,jn)),Yt(this,fs,Et(i,fs)),this.rawOptions=i.rawOptions)}else{const i={hiddenCaptures:[],strategy:null,transfers:[],...o};t(r?"":n,s),Yt(this,ds,n),Yt(this,Fn,ox(i.hiddenCaptures,i.transfers)),Yt(this,fs,i.strategy),this.rawOptions=o??{}}r||Yt(this,kn,this)}get source(){return Et(this,ds)||"(?:)"}exec(n){if(!Et(this,kn)){const{lazyCompile:r,...i}=this.rawOptions;Yt(this,kn,new Hn(Et(this,ds),this.flags,i))}const s=this.global||this.sticky,o=this.lastIndex;if(Et(this,fs)==="clip_search"&&s&&o){this.lastIndex=0;const r=Gi(this,jo,al).call(this,n.slice(o));return r&&(sx(r,o,n,this.hasIndices),this.lastIndex+=o),r}return Gi(this,jo,al).call(this,n)}},Fn=new WeakMap,kn=new WeakMap,ds=new WeakMap,jn=new WeakMap,fs=new WeakMap,jo=new WeakSet,al=function(n){Et(this,kn).lastIndex=this.lastIndex;const s=pu(Hn.prototype,this,"exec").call(Et(this,kn),n);if(this.lastIndex=Et(this,kn).lastIndex,!s||!Et(this,Fn).size)return s;const o=[...s];s.length=1;let r;this.hasIndices&&(r=[...s.indices],s.indices.length=1);const i=[0];for(let a=1;a<o.length;a++){const{hidden:l,transferTo:u}=Et(this,Fn).get(a)??{};if(l?i.push(null):(i.push(s.length),s.push(o[a]),this.hasIndices&&s.indices.push(r[a])),u&&o[a]!==void 0){const c=i[u];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(s[c]=o[a],this.hasIndices&&(s.indices[c]=r[a]),s.groups){Et(this,jn)||Yt(this,jn,rx(this.source));const d=Et(this,jn).get(u);d&&(s.groups[d]=o[a],this.hasIndices&&(s.indices.groups[d]=r[a]))}}}return s},Hn);function sx(e,t,n,s){if(e.index+=t,e.input=n,s){const o=e.indices;for(let i=0;i<o.length;i++){const a=o[i];a&&(o[i]=[a[0]+t,a[1]+t])}const r=o.groups;r&&Object.keys(r).forEach(i=>{const a=r[i];a&&(r[i]=[a[0]+t,a[1]+t])})}}function ox(e,t){const n=new Map;for(const s of e)n.set(s,{hidden:!0});for(const[s,o]of t)for(const r of o)Fo(n,r,{}).transferTo=s;return n}function rx(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let s=0,o=0,r;for(;r=t.exec(e);){const{0:i,groups:{capture:a,name:l}}=r;i==="["?s++:s?i==="]"&&s--:a&&(o++,l&&n.set(o,l))}return n}function ix(e,t){const n=ax(e,t);return n.options?new nx(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function ax(e,t){const n=_p(t),s=gp(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:lu}),o=LC(s,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),r=WC(o,n),i=_C(r.pattern,{captureTransfers:r._captureTransfers,hiddenCaptures:r._hiddenCaptures,mode:"external"}),a=wC(i.pattern),l=kC(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),u={pattern:l.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${r.flags}${r.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const c=l.hiddenCaptures.sort((m,y)=>m-y),d=Array.from(l.captureTransfers),f=o._strategy,p=u.pattern.length>=n.lazyCompileLength;(c.length||d.length||f||p)&&(u.options={...c.length&&{hiddenCaptures:c},...d.length&&{transfers:d},...f&&{strategy:f},...p&&{lazyCompile:p}})}return u}const dd=4294967295;class lx{constructor(t,n={}){V(this,"regexps");this.patterns=t,this.options=n;const{forgiving:s=!1,cache:o,regexConstructor:r}=n;if(!r)throw new Error("Option `regexConstructor` is not provided");this.regexps=t.map(i=>{if(typeof i!="string")return i;const a=o==null?void 0:o.get(i);if(a){if(a instanceof RegExp)return a;if(s)return null;throw a}try{const l=r(i);return o==null||o.set(i,l),l}catch(l){if(o==null||o.set(i,l),s)return null;throw l}})}findNextMatchSync(t,n,s){const o=typeof t=="string"?t:t.content,r=[];function i(a,l,u=0){return{index:a,captureIndices:l.indices.map(c=>c==null?{start:dd,end:dd,length:0}:{start:c[0]+u,end:c[1]+u,length:c[1]-c[0]})}}for(let a=0;a<this.regexps.length;a++){const l=this.regexps[a];if(l)try{l.lastIndex=n;const u=l.exec(o);if(!u)continue;if(u.index===n)return i(a,u,0);r.push([a,u,0])}catch(u){if(this.options.forgiving)continue;throw u}}if(r.length){const a=Math.min(...r.map(l=>l[1].index));for(const[l,u,c]of r)if(u.index===a)return i(l,u,c)}return null}}function ux(e,t){return ix(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function cx(e={}){const t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||(t.regexConstructor=n=>ux(n,{target:t.target})),{createScanner(n){return new lx(n,t)},createString(n){return{content:n}}}}const dx=["typescript","tsx","javascript","jsx","json","bash","python","yaml"];let Ns=null;const Gs=new Set,fa=new Set,fr=new Map,fx={js:"javascript",ts:"typescript",py:"python",sh:"bash",shell:"bash",shscript:"bash","shell-script":"bash",yml:"yaml",md:"markdown",rs:"rust",rb:"ruby",go:"go",java:"java",c:"c",cpp:"cpp","c++":"cpp",cs:"csharp","c#":"csharp",kt:"kotlin",kts:"kotlin",scala:"scala",swift:"swift",dart:"dart",lua:"lua",r:"r",sql:"sql",toml:"toml",ini:"ini",xml:"xml",svelte:"svelte",astro:"astro",dockerfile:"docker",makefile:"make",graphql:"graphql",proto:"protobuf",pl:"perl",pm:"perl"};function fd(e){const t=e.toLowerCase();return fx[t]??t}async function cu(){if(Ns)return Ns;const[e,t]=await Promise.all([He(()=>import("./github-dark-DHJKELXO.js"),[],import.meta.url),He(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url)]);return Ns=await $$({themes:[e.default,t.default],langs:[],engine:cx()}),Ns}const hx={typescript:()=>He(()=>import("./typescript-BPQ3VLAy.js"),[],import.meta.url),tsx:()=>He(()=>import("./tsx-COt5Ahok.js"),[],import.meta.url),javascript:()=>He(()=>import("./javascript-wDzz0qaB.js"),[],import.meta.url),jsx:()=>He(()=>import("./jsx-g9-lgVsj.js"),[],import.meta.url),json:()=>He(()=>import("./json-Cp-IABpG.js"),[],import.meta.url),bash:()=>He(()=>import("./bash-Yzrsuije.js"),[],import.meta.url),python:()=>He(()=>import("./python-B6aJPvgy.js"),[],import.meta.url),yaml:()=>He(()=>import("./yaml-Buea-lGh.js"),[],import.meta.url),markdown:()=>He(()=>import("./markdown-Cvjx9yec.js"),[],import.meta.url),rust:()=>He(()=>import("./rust-B1yitclQ.js"),[],import.meta.url),ruby:()=>He(()=>import("./ruby-CcrC3V9I.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url),go:()=>He(()=>import("./go-CxLEBnE3.js"),[],import.meta.url),java:()=>He(()=>import("./java-CylS5w8V.js"),[],import.meta.url),c:()=>He(()=>import("./c-BIGW1oBm.js"),[],import.meta.url),cpp:()=>He(()=>import("./cpp-BRuaLJcg.js"),__vite__mapDeps([11,12,6]),import.meta.url),csharp:()=>He(()=>import("./csharp-COcwbKMJ.js"),[],import.meta.url),kotlin:()=>He(()=>import("./kotlin-BdnUsdx6.js"),[],import.meta.url),scala:()=>He(()=>import("./scala-C151Ov-r.js"),[],import.meta.url),swift:()=>He(()=>import("./swift-D82vCrfD.js"),[],import.meta.url),dart:()=>He(()=>import("./dart-CF10PKvl.js"),[],import.meta.url),lua:()=>He(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([14,12]),import.meta.url),r:()=>He(()=>import("./r-Dspwwk_N.js"),[],import.meta.url),sql:()=>He(()=>import("./sql-BLtJtn59.js"),[],import.meta.url),toml:()=>He(()=>import("./toml-vGWfd6FD.js"),[],import.meta.url),ini:()=>He(()=>import("./ini-BEwlwnbL.js"),[],import.meta.url),xml:()=>He(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([4,5]),import.meta.url),svelte:()=>He(()=>import("./svelte-U4fHntn6.js"),__vite__mapDeps([16,2,8,3,17]),import.meta.url),astro:()=>He(()=>import("./astro-DAp21e1Q.js"),__vite__mapDeps([18,19,2,8,3,17,10]),import.meta.url),docker:()=>He(()=>import("./docker-BcOcwvcX.js"),[],import.meta.url),make:()=>He(()=>import("./make-CHLpvVh8.js"),[],import.meta.url),graphql:()=>He(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([7,2,8,9,10]),import.meta.url),protobuf:()=>He(()=>import("./protobuf-C7zT0LnQ.js"),[],import.meta.url),perl:()=>He(()=>import("./perl-CptaX86O.js"),__vite__mapDeps([20,1,2,3,4,5,6]),import.meta.url)};async function ll(e){if(Gs.has(e))return!0;if(fa.has(e))return!1;const t=hx[e];if(!t)return fa.add(e),!1;if(fr.has(e))return await fr.get(e),Gs.has(e);const n=(async()=>{try{const s=await cu(),o=await t();await s.loadLanguage(o.default),Gs.add(e)}catch{fa.add(e)}})();return fr.set(e,n),await n,fr.delete(e),Gs.has(e)}function hd(e){return Gs.has(e)}function Pp(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function Ms(e){return`<pre class="shiki-fallback"><code>${Pp(e)}</code></pre>`}function px(e){const t=[];return e.color&&t.push(`color:${e.color}`),e.fontStyle&&(e.fontStyle&1&&t.push("font-style:italic"),e.fontStyle&2&&t.push("font-weight:bold"),e.fontStyle&4&&t.push("text-decoration:underline")),`<span${t.length>0?` style="${t.join(";")}"`:""}>${Pp(e.content)}</span>`}function gx(e,t,n,s){if(!Ns||!Gs.has(t))return null;const o={lang:t,theme:n};s&&(o.grammarState=s);const r=Ns.codeToTokens(e,o);return{lines:r.tokens.map(i=>`<span class="line">${i.map(px).join("")}</span>`),fg:r.fg,bg:r.bg,grammarState:r.grammarState??s}}let wt=null;const Vs=new Map;function mx(){return wt||(wt=new IntersectionObserver(e=>{for(const t of e){if(!t.isIntersecting)continue;const n=Vs.get(t.target);n&&(Vs.delete(t.target),wt==null||wt.unobserve(t.target),n())}Vs.size===0&&(wt==null||wt.disconnect(),wt=null)},{rootMargin:"200px 0px"})),wt}function du(){return typeof IntersectionObserver<"u"}function vx(e,t){return du()?(Vs.set(e,t),mx().observe(e),()=>{Vs.delete(e),wt==null||wt.unobserve(e),Vs.size===0&&(wt==null||wt.disconnect(),wt=null)}):null}du()&&setTimeout(()=>{cu().then(()=>Promise.all(dx.map(e=>ll(e))))},0);const yx={class:"code-header"},bx={class:"code-lang"},kx={class:"code-content"},wx=["innerHTML"],Sx={key:0,class:"line"},_x=["innerHTML"],pd=32,$x=Le({__name:"CodeBlock",props:{code:{},lang:{},streaming:{type:Boolean}},setup(e){const t=e,n=In("effectiveTheme",M(typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"light")),s=M(""),o=M(""),r=M(!1),i=du(),a=M(!i);let l=null;const u=M(null),c=M([]),d=M(""),f=M(null);let p=null,m="",y="",b="",k=null,w=null;const S=new Set,I=P(()=>{const x=c.value,E=[];for(let z=0;z<x.length;z+=pd)E.push({key:z,html:x.slice(z,z+pd).join("")});return E});function q(){c.value=[],d.value="",f.value=null,p=null}function B(x){S.has(x)||(S.add(x),ll(x).then(E=>{!E||!t.streaming||x!==m||L()}))}function R(){var ve;const x=fd(((ve=t.lang)==null?void 0:ve.toLowerCase())??"text"),E=n.value==="light"?"github-light":"github-dark";if((x!==m||E!==y)&&(q(),m=x,y=E),!a.value||!i||!hd(x))return o.value=Ms(t.code),a.value&&i&&!hd(x)&&B(x),!1;const z=t.code,oe=z.lastIndexOf(`
|
|
227
|
+
`),ke=oe===-1?"":z.slice(0,oe),Te=oe===-1?z:z.slice(oe+1),ge=oe===-1?[]:ke.split(`
|
|
228
|
+
`);ge.length<c.value.length&&q();const le=ge.slice(c.value.length);if(le.length>0){const Q=gx(le.join(`
|
|
229
|
+
`),x,E,p);if(!Q)return o.value=Ms(z),!1;p=Q.grammarState,f.value||(f.value={theme:E,style:`background-color:${Q.bg};color:${Q.fg}`}),c.value=c.value.concat(Q.lines)}return f.value?(d.value=Te,b=z,!0):(o.value=Ms(z),!1)}function L(){t.streaming&&R()}function A(){return f.value?t.code===b?!0:t.code.startsWith(b)?R():!1:!1}function W(){if(t.streaming){L();return}A()||O()}function F(){a.value=!0,t.streaming?L():O()}async function O(){var oe;if(!a.value){o.value=Ms(t.code);return}const x=fd(((oe=t.lang)==null?void 0:oe.toLowerCase())??"text"),E=n.value==="light"?"github-light":"github-dark",z=`${t.code}${x}${E}`;if(!(z===k||z===w)){w=z;try{const ke=await cu();await ll(x)?s.value=ke.codeToHtml(t.code,{lang:x,theme:E}):s.value=Ms(t.code)}catch{s.value=Ms(t.code)}finally{w=null,k=z}f.value=null}}function ee(){navigator.clipboard.writeText(t.code).then(()=>{r.value=!0,setTimeout(()=>r.value=!1,1500)})}return rt(()=>{u.value&&(l=vx(u.value,F))}),at(()=>{l==null||l()}),xe(()=>[t.code,t.lang,n.value],()=>W(),{immediate:!0}),xe(()=>t.streaming,(x,E)=>{E&&!x&&W()}),(x,E)=>(g(),v("div",{class:"code-block",ref_key:"rootEl",ref:u},[h("div",yx,[h("span",bx,C(e.lang||"text"),1),h("button",{class:fe(["code-copy",{copied:r.value}]),onClick:ee},C(r.value?"已复制":"复制"),3)]),h("div",kx,[f.value?(g(),v("pre",{key:0,class:fe(["shiki",f.value.theme]),style:yt(f.value.style),tabindex:"0"},[h("code",null,[(g(!0),v(X,null,Me(I.value,z=>(g(),v("span",{key:z.key,class:"shiki-group",innerHTML:z.html},null,8,wx))),128)),d.value?(g(),v("span",Sx,C(d.value),1)):N("",!0)])],6)):(g(),v("div",{key:1,innerHTML:t.streaming?o.value:s.value||o.value},null,8,_x))])],512))}}),ul=De($x,[["__scopeId","data-v-d595bf82"]]),Un=Wn({open:!1,src:"",alt:""});function Lp(e,t=""){e&&(Un.src=e,Un.alt=t,Un.open=!0)}function ha(){Un.open=!1}const Cx=200;function xx(e){const t=e.raw??"";return`${e.type}:${t.length}:${Tx(t).toString(36)}`}function Tx(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+(e.codePointAt(n)??0)|0;return t>>>0}function Ix(e){const t=[...e];for(;t.length>0;){const n=t.pop();if(typeof n.type=="object")return!0;if(Array.isArray(n.children))for(const s of n.children)Ys(s)&&t.push(s)}return!1}function Ex(e=Cx){let t=new Map,n="";return{render(s,o,r){n.length>0&&o.startsWith(n)||t.clear(),n=o;const a=[],l=new Set;for(const u of s){const c=xx(u),d=u.raw??"",f=t.get(c);if(f&&f.raw===d&&!l.has(c)){l.add(c),a.push(...f.vnodes);continue}l.add(c);const p=r(u);p.length>0&&!Ix(p)&&(t.size>=e&&(t=new Map),t.set(c,{raw:d,vnodes:p})),a.push(...p)}return a},size:()=>t.size,clear:()=>{t=new Map,n=""}}}Ye.setOptions({gfm:!0,breaks:!1});const Ax=4e4,Tr=6e3,Mx=Le({props:{content:{type:String,required:!0},streaming:{type:Boolean,default:!1}},setup(e){const t=M(e.content);let n=null;const s=M(!1);let o=e.content;xe(()=>e.content,u=>{!u.startsWith(o)&&!o.startsWith(u)&&(s.value=!1),o=u});const r=P(()=>!e.streaming&&!s.value&&t.value.length>Ax);xe(()=>e.content,u=>{if(!e.streaming){t.value=u;return}n===null&&(n=requestAnimationFrame(()=>{n=null,t.value=e.content}))}),xe(()=>e.streaming,(u,c)=>{c&&!u&&(n!==null&&(cancelAnimationFrame(n),n=null),t.value=e.content)});const i=Ex(),a=P(()=>{const u=r.value?Rx(t.value):t.value,c=Px(u),d=Ye.lexer(c);return i.render(d,c,f=>cl(f,e.streaming))}),l=P(()=>t.value.length);return()=>{const u=a.value.slice();return r.value&&u.push(qe("button",{class:"md-expand",type:"button",onClick:()=>{s.value=!0}},`展开全文(共 ${l.value.toLocaleString()} 字符,当前仅预览前 ${Tr.toLocaleString()})`)),qe("div",{class:"markdown-body"},u)}}});function Rx(e){const t=e.lastIndexOf(`
|
|
230
|
+
`,Tr);return(t>Tr/2?e.slice(0,t):e.slice(0,Tr))+`
|
|
231
|
+
…`}function Px(e){const t=/^(`{3,})/gm;let n=null,s=-1,o=0,r;for(;(r=t.exec(e))!==null;){const i=r[1];n===null?(n=i,s=r.index,o=i.length):i.length>=o&&(n=null)}return n!==null?e.substring(0,s).trimEnd():e}function cl(e,t=!1){const n=e;switch(n.type){case"paragraph":return[qe("p",{class:"md-p"},Tn(n.tokens??[]))];case"heading":return[qe(`h${n.depth??2}`,{class:`md-h${n.depth??2}`},Tn(n.tokens??[]))];case"code":return[qe(ul,{code:n.text??"",lang:n.lang??"text",streaming:t})];case"blockquote":return[qe("blockquote",{class:"md-blockquote"},(n.tokens??[]).flatMap(s=>cl(s,t)))];case"list":{const s=(n.items??[]).map(o=>{const r=[];return o.task&&r.push(qe("input",{type:"checkbox",checked:o.checked,disabled:!0,class:"md-checkbox"})),r.push(...o.tokens.flatMap(i=>cl(i,t))),qe("li",{class:["md-li",o.task?"md-task":""]},r)});return[qe(n.ordered?"ol":"ul",{class:n.ordered?"md-ol":"md-ul"},s)]}case"hr":return[qe("hr",{class:"md-hr"})];case"space":return[];case"html":return[qe("pre",{class:"md-raw-html"},n.text??"")];case"table":return[qe("div",{class:"md-table-wrap",style:"overflow-x:auto"},[Lx(n)])];case"br":return[qe("br")];case"text":return[qe("span",{class:"md-text"},n.tokens?Tn(n.tokens):n.text??"")];case"def":return[];default:return[qe("p",{class:"md-p"},n.raw??"")]}}function Lx(e){const t=(e.header??[]).map((s,o)=>{var a;const r=(a=e.align)==null?void 0:a[o],i=s;return qe("th",{class:"md-th",style:r?`text-align:${r}`:""},i.tokens?Tn(i.tokens):String(i.text??""))}),n=(e.rows??[]).map(s=>qe("tr",{},s.map((o,r)=>{var l;const i=(l=e.align)==null?void 0:l[r],a=o;return qe("td",{class:"md-td",style:i?`text-align:${i}`:""},a.tokens?Tn(a.tokens):String(a.text??""))})));return qe("table",{class:"md-table"},[qe("thead",{},[qe("tr",{},t)]),qe("tbody",{},n)])}function Tn(e){return e.map(t=>{const n=t;switch(n.type){case"text":return n.text??"";case"codespan":return qe("code",{class:"md-code"},n.text??"");case"strong":return qe("strong",{class:"md-strong"},Tn(n.tokens??[]));case"em":return qe("em",{class:"md-em"},Tn(n.tokens??[]));case"del":return qe("del",{class:"md-del"},Tn(n.tokens??[]));case"link":{const s=n.href;return s&&!/^(https?:|mailto:|#|\/)/i.test(s)?n.raw??"":qe("a",{class:"md-a",href:s,target:"_blank",rel:"noopener"},Tn(n.tokens??[]))}case"image":{const s=n.href??"";return qe("button",{type:"button",class:"md-img-btn",title:"点击图片放大预览","aria-label":n.text?`放大预览图片:${n.text}`:"放大预览图片",onClick:()=>Lp(s,n.text??"")},[qe("img",{class:"md-img",src:s,alt:n.text??"",loading:"lazy"})])}case"br":return qe("br");case"html":return qe("code",{class:"md-raw-inline"},n.text??"");case"escape":return n.text??"";default:return n.raw??""}})}const Dp=De(Mx,[["__scopeId","data-v-b42f9687"]]);function Op(e,t,n){const s=M("");let o;function r(){o!==void 0&&(clearInterval(o),o=void 0)}return xe(()=>[e.value.durationMs,t.value],()=>{r();const i=e.value.durationMs;if(i!==void 0){s.value=Zi(i);return}if(s.value="",t.value!=="running"||!n())return;const a=ty(e.value.toolCallId);a!==void 0&&(s.value=Zi(Date.now()-a),o=setInterval(()=>{s.value=Zi(Date.now()-a)},1e3))},{immediate:!0}),at(r),s}const Dx=["onKeydown"],Ox={class:"tool-name"},Nx=["title"],Gx=["title"],Bx={class:"tool-collapse-inner"},Fx={class:"tool-body"},jx={key:0,class:"tool-args"},Ux={key:1,class:"tool-result"},zx={key:2,class:"tool-image-wrap"},Hx=["src"],Wx={key:3,class:"tool-output-actions"},qx={key:4,class:"tool-running-hint"},Vx=Le({__name:"GenericToolCard",props:{tool:{},live:{type:Boolean,default:!0},workDir:{default:""},sessionId:{default:""}},setup(e){const t=e,n=P(()=>Ti(t.tool,t.live)),s=P(()=>{switch(n.value){case"ok":return"✓";case"error":return"✗";default:return""}}),o=M(!1);let r=!1;xe(n,B=>{r||(o.value=B==="running")},{immediate:!0});function i(){r=!0,o.value=!o.value}const a=new Set(["path","file_path","filePath","file","filename"]),l=P(()=>{const B=t.tool.args;if(!B||typeof B!="object")return null;for(const[R,L]of Object.entries(B))if(a.has(R)&&typeof L=="string"&&L.length>0&&!L.includes(`
|
|
232
|
+
`))return L;return null});function u(){const B=l.value;B&&vs(Bl(B,t.workDir||void 0),{sessionId:t.sessionId||null})}const c=P(()=>{const B=t.tool.args;if(!B||typeof B!="object")return B===void 0?"":String(B);const R=[];for(const[L,A]of Object.entries(B)){if(l.value!==null&&a.has(L)&&A===l.value)continue;let W;if(typeof A=="string")W=A.length>40?`${A.slice(0,40)}…`:A;else{try{W=JSON.stringify(A)}catch{W=String(A)}W.length>40&&(W=`${W.slice(0,40)}…`)}if(R.push(`${L}=${W}`),R.length>=3)break}return R.join(" ")});function d(){if(!t.tool.args)return"";try{return JSON.stringify(t.tool.args,null,2)}catch{return String(t.tool.args)}}function f(B){return B??""}const p=P(()=>f(t.tool.output)),m=P(()=>p.value.length>8192),y=M(!1),b=P(()=>{const B=p.value;return m.value&&!y.value?`…${B.slice(-400)}`:B}),k=P(()=>{var L;const B=t.tool.progress;if(!B)return"";const R=B.split(`
|
|
233
|
+
`).filter(A=>A.trim());return((L=R[R.length-1])==null?void 0:L.slice(0,60))??""}),w=Op(P(()=>t.tool),n,()=>t.live);async function S(){var B;try{await((B=navigator.clipboard)==null?void 0:B.writeText(p.value))}catch{}}const I=P(()=>{const B=p.value.trim();return!/^[\w@./-]+\.(png|jpe?g|gif|webp|avif)$/i.test(B)||B.includes("..")||B.startsWith("/")||m.value?null:`/api/v1/files/raw?path=${encodeURIComponent(B)}`});function q(){const B=I.value;B&&Lp(B)}return(B,R)=>(g(),v("div",{class:fe(["tool-card",`is-${n.value}`])},[h("div",{class:"tool-header",role:"button",tabindex:"0",onClick:i,onKeydown:Vn(st(i,["prevent"]),["enter"])},[h("span",{class:fe(["status-dot",n.value])},[s.value?(g(),v(X,{key:0},[Pe(C(s.value),1)],64)):N("",!0)],2),h("span",Ox,C(e.tool.name),1),l.value?(g(),v("button",{key:0,class:"tool-pathlink",title:`在文件面板中打开 ${l.value}`,onClick:st(u,["stop"])},C(l.value),9,Nx)):N("",!0),c.value?(g(),v("span",{key:1,class:"tool-params",title:c.value},C(c.value),9,Gx)):N("",!0),D(w)?(g(),v("span",{key:2,class:fe(["tool-duration",{live:e.tool.durationMs===void 0}])},C(D(w)),3)):N("",!0),h("span",{class:fe(["tool-chevron",{open:o.value}])},"▸",2)],40,Dx),h("div",{class:fe(["tool-collapse",{open:o.value}])},[h("div",Bx,[h("div",Fx,[d()?(g(),v("pre",jx,[h("code",null,C(d()),1)])):N("",!0),e.tool.output!==void 0&&!I.value?(g(),v("pre",Ux,[h("code",null,C(b.value||"(无输出)"),1)])):N("",!0),e.tool.output!==void 0&&I.value?(g(),v("div",zx,[h("button",{type:"button",class:"tool-image-btn",title:"点击图片放大预览","aria-label":"放大预览图片",onClick:q},[h("img",{class:"tool-image",src:I.value,alt:"",loading:"lazy",onError:R[0]||(R[0]=L=>L.currentTarget.style.display="none")},null,40,Hx)])])):N("",!0),m.value?(g(),v("div",Wx,[h("button",{class:"tool-output-btn",onClick:R[1]||(R[1]=L=>y.value=!y.value)},C(y.value?"收起":"展开全文"),1),h("button",{class:"tool-output-btn",onClick:S},"复制")])):n.value==="running"?(g(),v("div",qx,C(k.value||"执行中…"),1)):N("",!0)])])],2)],2))}}),Kx=De(Vx,[["__scopeId","data-v-e65f250b"]]),Zx=500;function Yx(e,t){const n=e.length,s=t.length,o=Array.from({length:n+1},()=>new Array(s+1).fill(0));for(let r=1;r<=n;r++)for(let i=1;i<=s;i++)o[r][i]=e[r-1]===t[i-1]?o[r-1][i-1]+1:Math.max(o[r-1][i],o[r][i-1]);return o}function Xx(e,t,n,s,o){const r=[];for(;s>0||o>0;)s>0&&o>0&&t[s-1]===n[o-1]?(r.unshift({type:"context",text:t[s-1],oldNo:s,newNo:o}),s--,o--):o>0&&(s===0||e[s][o-1]>=e[s-1][o])?(r.unshift({type:"add",text:n[o-1],newNo:o}),o--):(r.unshift({type:"del",text:t[s-1],oldNo:s}),s--);return r}function Np(e){const t=[],n=e.replaceAll(`\r
|
|
234
|
+
`,`
|
|
235
|
+
`).split(`
|
|
236
|
+
`);let s=0,o=0;for(const r of n){if(r.startsWith("@@")){const i=/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(r);s=i?Number(i[1]):0,o=i?Number(i[2]):0;const a=r.startsWith("@@")?r.slice(r.indexOf("@@")+2,r.lastIndexOf("@@")||r.length):"";t.push({type:"context",text:a.trim()?`@@ hunk ${s},${o} @@`:r,oldNo:s,newNo:o});continue}if(r.startsWith("+++")||r.startsWith("---")){t.push({type:"context",text:r,oldNo:s,newNo:o});continue}r.startsWith("+")?(o+=1,t.push({type:"add",text:r.slice(1),newNo:o})):r.startsWith("-")?(s+=1,t.push({type:"del",text:r.slice(1),oldNo:s})):(s+=1,o+=1,t.push({type:"context",text:r,oldNo:s,newNo:o}))}return t}function Jx(e,t){const n=e.split(`
|
|
237
|
+
`),s=t.split(`
|
|
238
|
+
`);if(n.length+s.length>Zx){const r=[];return n.forEach((i,a)=>r.push({type:"del",text:i,oldNo:a+1})),s.forEach((i,a)=>r.push({type:"add",text:i,newNo:a+1})),r}const o=Yx(n,s);return Xx(o,n,s,n.length,s.length)}function Qx(e){let t=0,n=0;for(const s of e)s.type==="add"?t++:s.type==="del"&&n++;return{added:t,removed:n}}const eT=["old_string","oldString","old_str","old_text","oldText","old","search"],tT=["new_string","newString","new_str","new_text","newText","new","replace","content"],nT=["path","file_path","filePath","file","filename"];function pa(e,t){for(const n of t){const s=e[n];if(typeof s=="string"&&s.length>0)return s}}function sT(e){if(!e||typeof e!="object")return null;const t=e,n=pa(t,nT),s=pa(t,eT),o=pa(t,tT);if(!o&&!s)return null;const r=Jx(s??"",o??""),i=Qx(r);return{path:n,diff:r,stats:i}}const oT={class:"diff-lines"},rT={class:"dl-gutter old"},iT={class:"dl-gutter new"},aT={class:"dl-sign"},lT={class:"dl-text"},uT=Le({__name:"DiffLines",props:{lines:{}},setup(e){return(t,n)=>(g(),v("div",oT,[(g(!0),v(X,null,Me(e.lines,(s,o)=>(g(),v("div",{key:o,class:fe(["dl",`dl-${s.type}`])},[h("span",rT,C(s.oldNo??""),1),h("span",iT,C(s.newNo??""),1),h("span",aT,C(s.type==="add"?"+":s.type==="del"?"−":" "),1),h("span",lT,C(s.text),1)],2))),128))]))}}),fu=De(uT,[["__scopeId","data-v-e2e145aa"]]),cT=["onKeydown"],dT={class:"tool-name"},fT=["title"],hT={key:1,class:"diff-chip"},pT={class:"tool-collapse-inner"},gT={class:"tool-body"},mT={key:1,class:"tool-result"},vT={key:2,class:"tool-running-hint"},yT=Le({__name:"EditToolCard",props:{tool:{},live:{type:Boolean,default:!0},workDir:{default:""},sessionId:{default:""}},setup(e){const t=e,n=P(()=>Ti(t.tool,t.live)),s=P(()=>{switch(n.value){case"ok":return"✓";case"error":return"✗";default:return""}}),o=P(()=>sT(t.tool.args)),r=P(()=>{const y=o.value;if(!y||n.value==="error")return"";const{added:b,removed:k}=y.stats;return!b&&!k?"":`+${b} −${k}`}),i=P(()=>{var y;return(y=o.value)==null?void 0:y.path}),a=M(!1);let l=!1;xe(n,y=>{l||(a.value=y==="running")},{immediate:!0});function u(){l=!0,a.value=!a.value}const c=P(()=>{var y;return((y=o.value)==null?void 0:y.diff)??[]}),d=P(()=>c.value.length>0),f=Op(P(()=>t.tool),n,()=>t.live);function p(){const y=i.value;y&&vs(Bl(y,t.workDir||void 0),{modeHint:"diff",sessionId:t.sessionId||null})}const m=P(()=>{var k;const y=t.tool.progress;if(!y)return"";const b=y.split(`
|
|
239
|
+
`).filter(w=>w.trim());return((k=b[b.length-1])==null?void 0:k.slice(0,60))??""});return(y,b)=>(g(),v("div",{class:fe(["tool-card",`is-${n.value}`,"edit-tool-card"])},[h("div",{class:"tool-header",role:"button",tabindex:"0",onClick:u,onKeydown:Vn(st(u,["prevent"]),["enter"])},[h("span",{class:fe(["status-dot",n.value])},[s.value?(g(),v(X,{key:0},[Pe(C(s.value),1)],64)):N("",!0)],2),h("span",dT,C(e.tool.name),1),i.value?(g(),v("button",{key:0,class:"tool-filepath",title:`在文件面板中打开(diff) ${i.value}`,onClick:st(p,["stop"])},C(i.value),9,fT)):N("",!0),r.value?(g(),v("span",hT,C(r.value),1)):N("",!0),D(f)?(g(),v("span",{key:2,class:fe(["tool-duration",{live:e.tool.durationMs===void 0}])},C(D(f)),3)):N("",!0),h("span",{class:fe(["tool-chevron",{open:a.value}])},"▸",2)],40,cT),h("div",{class:fe(["tool-collapse",{open:a.value}])},[h("div",pT,[h("div",gT,[d.value?(g(),Fe(fu,{key:0,lines:c.value},null,8,["lines"])):N("",!0),e.tool.output!==void 0?(g(),v("pre",mT,[h("code",null,C(e.tool.output||"(无输出)"),1)])):(g(),v("div",vT,C(m.value||"执行中…"),1))])])],2)],2))}}),bT=De(yT,[["__scopeId","data-v-a5355539"]]),kT=["aria-expanded"],wT={class:"process-label"},ST={class:"process-meta"},_T=["title"],$T={class:"process-collapse"},CT={class:"process-inner"},xT={key:0,class:"process-more"},TT=["aria-expanded"],ga=20,IT=Le({__name:"ToolGroup",props:{name:{},tools:{},live:{type:Boolean,default:!0},workDir:{default:""},sessionId:{default:""}},setup(e){const t=e,n=M(!1),s=P(()=>Kw(t.tools,t.live)),o=P(()=>t.tools.filter(c=>c.output!==void 0&&!c.isError).length),r=P(()=>s.value==="running"?"执行中":s.value==="error"?"含失败调用":s.value==="suspended"?"含挂起等待":s.value==="unknown"?"结果未持久化":`已完成 ${o.value} 项`);function i(){n.value=!n.value}const a=M(!1),l=P(()=>Math.max(0,t.tools.length-ga)),u=P(()=>a.value?t.tools:t.tools.slice(0,ga));return(c,d)=>(g(),v("section",{class:fe(["tool-process",{open:n.value,running:s.value==="running",error:s.value==="error"}])},[h("button",{class:"process-head",type:"button","aria-expanded":n.value,onClick:i},[K(me,{name:"chevron-down",size:12,class:"chevron"}),h("span",{class:fe(["process-dot",s.value]),"aria-hidden":"true"},null,2),h("span",wT,C(e.name),1),h("span",ST,C(r.value)+" · "+C(e.tools.length)+" 步",1),h("span",{class:"process-names",title:e.tools.map(f=>f.name).join("、")},C(e.tools.map(f=>f.name).join(" · ")),9,_T)],8,kT),h("div",$T,[h("div",CT,[(g(!0),v(X,null,Me(u.value,f=>(g(),Fe(yf(D(gh)(f.name)?bT:Kx),{key:f.toolCallId,tool:f,live:e.live,"work-dir":e.workDir,"session-id":e.sessionId},null,8,["tool","live","work-dir","session-id"]))),128)),n.value&&l.value>0?(g(),v("div",xT,[h("button",{type:"button",class:"process-more-btn","aria-expanded":a.value,onClick:d[0]||(d[0]=f=>a.value=!a.value)},C(a.value?`收起,只看前 ${ga} 条`:`还有 ${l.value} 条 · 显示全部`),9,TT)])):N("",!0)])])],2))}}),ET=De(IT,[["__scopeId","data-v-4441817e"]]),AT={class:"thinking-block"},MT=["title"],RT={class:"teaser-text"},PT={class:"teaser-open"},LT={key:1,class:"thinking-stream","data-state":"running"},DT={class:"thinking-panel",role:"dialog","aria-label":"思考过程"},OT={class:"panel-body"},NT=Le({__name:"ThinkingBlock",props:{tool:{},active:{type:Boolean,default:!1},sessionId:{default:""},msgSeq:{default:void 0}},setup(e){const t=e,n=M(!1),s=M(null),o=M(!1),r=M(!1),i=M(t.tool.output??"");xe(()=>t.tool.output,f=>{f!==void 0&&!o.value&&!r.value&&(i.value=f)});const a=P(()=>!!t.tool.truncated);async function l(){if(!(!a.value||r.value||o.value)&&!(!t.sessionId||t.msgSeq===void 0)){o.value=!0;try{const p=await(await fetch(`/api/v1/sessions/${t.sessionId}/messages?seq=${t.msgSeq}&tool=${encodeURIComponent(t.tool.toolCallId)}`)).json();typeof p.output=="string"&&p.output.length>0&&(i.value=p.output,r.value=!0)}catch{}finally{o.value=!1}}}const u=P(()=>i.value.split(/\n+/).map(p=>p.trim()).filter(Boolean).at(-1)??"");xe(i,()=>{t.active&&Ve(()=>{const f=s.value;f&&(f.scrollTop=f.scrollHeight)})});function c(){l(),n.value=!0}function d(){n.value=!1}return(f,p)=>(g(),v("div",AT,[e.active?(g(),v("div",LT,[p[1]||(p[1]=h("div",{class:"stream-header"},[h("span",{class:"stream-icon"},"💭"),h("span",{class:"stream-title"},"思考中…"),h("span",{class:"stream-dot"})],-1)),h("div",{ref_key:"streamRef",ref:s,class:"stream-body"},C(i.value),513)])):(g(),v("button",{key:0,class:"thinking-teaser",title:a.value?"思考较长,点击查看完整思考过程":"点击查看完整思考过程",onClick:c},[p[0]||(p[0]=h("span",{class:"teaser-icon"},"💭",-1)),h("span",RT,C(o.value?"加载完整思考…":u.value||"思考过程"),1),h("span",PT,C(a.value?"查看全文":"展开"),1)],8,MT)),(g(),Fe(Qs,{to:"body"},[n.value?(g(),v("div",{key:0,class:"thinking-overlay",onClick:st(d,["self"])},[h("aside",DT,[h("header",{class:"panel-header"},[p[2]||(p[2]=h("span",null,"💭 思考过程",-1)),h("button",{class:"panel-close","aria-label":"关闭",onClick:d},"✕")]),h("div",OT,C(i.value||"(空)"),1)])])):N("",!0)]))]))}}),GT=De(NT,[["__scopeId","data-v-9382b07d"]]),BT={key:0,class:"clock"},FT={class:"stat"},jT={class:"stat"},UT={class:"stat"},zT={class:"stat"},HT={class:"stat"},WT={class:"stat"},qT=Le({__name:"TurnStats",props:{stats:{},inline:{type:Boolean}},setup(e){const t=e,n=M(null);let s=null;function o(){s!==null&&(clearInterval(s),s=null)}function r(){o();const l=t.stats.llmMs??0,u=Date.now();n.value=l,s=setInterval(()=>{n.value=l+(Date.now()-u)},300)}xe(()=>t.stats.status,l=>{l==="running"?r():o()},{immediate:!0}),at(o);function i(l){return l==null?"—":l<1e3?`${Math.round(l)}ms`:`${(l/1e3).toFixed(1)}s`}function a(l){return l==null?"—":l>=1e3?`${(l/1e3).toFixed(1)}k`:`${l}`}return(l,u)=>(g(),v("div",{class:fe(["turn-stats",[`is-${e.stats.status}`,{"is-inline":e.inline}]]),"aria-live":"polite"},[e.stats.status==="running"?(g(),v(X,{key:0},[u[0]||(u[0]=h("span",{class:"badge-gradient"},"正在思考",-1)),n.value!==null?(g(),v("span",BT,C(i(n.value)),1)):N("",!0)],64)):(g(),v(X,{key:1},[h("span",FT,C(e.stats.turn)+" 轮 · "+C(e.stats.step)+" 步",1),u[10]||(u[10]=h("span",{class:"dot"},"·",-1)),h("span",jT,[u[1]||(u[1]=h("span",{class:"k"},"LLM",-1)),Pe(" "+C(i(e.stats.llmMs)),1)]),e.stats.toolMs?(g(),v(X,{key:0},[u[3]||(u[3]=h("span",{class:"dot"},"·",-1)),h("span",UT,[u[2]||(u[2]=h("span",{class:"k"},"工具",-1)),Pe(" "+C(i(e.stats.toolMs)),1)])],64)):N("",!0),e.stats.firstTokenMs!==null&&e.stats.firstTokenMs!==void 0?(g(),v(X,{key:1},[u[5]||(u[5]=h("span",{class:"dot"},"·",-1)),h("span",zT,[u[4]||(u[4]=h("span",{class:"k"},"首token",-1)),Pe(" "+C(i(e.stats.firstTokenMs)),1)])],64)):N("",!0),e.stats.tokens!==null&&e.stats.tokens!==void 0?(g(),v(X,{key:2},[u[7]||(u[7]=h("span",{class:"dot"},"·",-1)),h("span",HT,[u[6]||(u[6]=h("span",{class:"k"},"tokens",-1)),Pe(" "+C(a(e.stats.tokens)),1)])],64)):N("",!0),e.stats.tokensPerSec!==null&&e.stats.tokensPerSec!==void 0?(g(),v(X,{key:3},[u[9]||(u[9]=h("span",{class:"dot"},"·",-1)),h("span",WT,[u[8]||(u[8]=h("span",{class:"k"},"tok/s",-1)),Pe(" "+C(e.stats.tokensPerSec),1)])],64)):N("",!0)],64))],2))}}),gd=De(qT,[["__scopeId","data-v-dad21b9b"]]),VT=["data-message-id","data-message-role"],KT={key:0,class:"user-wrap"},ZT={class:"user-head"},YT={key:0,class:"meta-time"},XT={class:"user-avatar","aria-hidden":"true"},JT={class:"user-bubble"},QT=["title","onClick"],eI={key:0,class:"message-meta user-meta"},tI={key:1,class:"assistant-wrap"},nI={key:0,class:"assistant-brand"},sI=["title"],oI={key:1,class:"brand-streaming"},rI={key:3,class:"brand-time"},iI={class:"assistant-body"},aI={key:0,class:"degraded-note"},lI={key:4,class:"streaming-cursor","aria-label":"正在生成"},uI={key:6,class:"written-files",role:"group","aria-label":"本回合写入的文件"},cI=["title","onClick"],dI={class:"written-file-name"},fI={key:7,class:"message-meta"},hI=["title"],pI=["title"],gI=Le({__name:"MessageItem",props:{message:{},isLatestUser:{type:Boolean,default:!1},idle:{type:Boolean,default:!0},streaming:{type:Boolean,default:!1},canFork:{type:Boolean,default:!1},showTimestamp:{type:Boolean,default:!0},showModel:{type:Boolean,default:!0},sessionId:{default:""},workDir:{default:""}},emits:["edit","retry","fork"],setup(e,{emit:t}){const n=e,s=t,o=M(!1);let r=null;const i=P(()=>n.message.role==="user"),a=P(()=>n.message.role==="assistant"),l=P(()=>{var F;return((F=n.message.turnStats)==null?void 0:F.status)==="running"}),u=P(()=>n.message.tools.filter(F=>F.name==="thinking")),c=P(()=>n.message.tools.filter(F=>F.name!=="thinking")),d=P(()=>n.message.ts!==void 0?Hw(n.message.ts):""),f=P(()=>{const F=n.message.model??"",O=F.lastIndexOf("/");return O>=0&&O<F.length-1?F.slice(O+1):F}),p=P(()=>i.value&&n.isLatestUser&&n.idle),m=P(()=>a.value&&!n.streaming?Yw(n.message,n.workDir||void 0):[]);function y(F){return F.split("/").pop()||F}function b(F){vs(F,{sessionId:n.sessionId||void 0})}const k=/(^|\s)@("[^"\n]+"|[^\s"]+)/g;function w(F){if(!F||F.startsWith("/")||F.startsWith("~"))return F;const O=n.workDir.trim();if(!O)return F;let ee=F;for(;ee.startsWith("./");)ee=ee.slice(2);return`${O.replace(/\/+$/,"")}/${ee}`}const S=P(()=>{const F=n.message.content;if(!i.value||!F||!F.includes("@"))return[];const O=[];let ee=0;k.lastIndex=0;let x;for(;(x=k.exec(F))!==null;){const E=x.index+x[1].length;E>ee&&O.push({text:F.slice(ee,E),path:null});const z=x[2],oe=z.startsWith('"')?z.slice(1,-1):z;O.push({text:F.slice(E,E+1+z.length),path:w(oe)}),ee=E+1+z.length}return ee<F.length&&O.push({text:F.slice(ee),path:null}),O});function I(F){vs(F,{sessionId:n.sessionId||void 0})}const q=In("showThinking",M(!0)),B=In("showTools",M(!0)),R=M(!1);let L=null;function A(){if(typeof window>"u"||!("speechSynthesis"in window))return;if(R.value){window.speechSynthesis.cancel(),R.value=!1,L=null;return}const F=n.message.content;if(!F)return;const O=new SpeechSynthesisUtterance(F);O.lang="zh-CN";const ee=()=>{L===ee&&(R.value=!1,L=null)};L=ee,O.addEventListener("end",ee),O.addEventListener("error",ee),window.speechSynthesis.cancel(),requestAnimationFrame(()=>{window.speechSynthesis.speak(O)}),R.value=!0}at(()=>{R.value&&"speechSynthesis"in window&&window.speechSynthesis.cancel()});async function W(){try{await navigator.clipboard.writeText(n.message.content)}catch{const F=document.createElement("textarea");F.value=n.message.content,document.body.append(F),F.select(),document.execCommand("copy"),F.remove()}o.value=!0,r!==null&&clearTimeout(r),r=window.setTimeout(()=>{o.value=!1},1500)}return(F,O)=>(g(),v("article",{class:fe(["message",e.message.role,{error:e.message.isError}]),"data-message-id":e.message.id,"data-message-role":e.message.role},[i.value?(g(),v("div",KT,[h("div",ZT,[d.value?(g(),v("span",YT,C(d.value),1)):N("",!0),O[3]||(O[3]=h("span",{class:"head-name"},"你",-1)),h("span",XT,[K(me,{name:"user",size:12})])]),h("div",JT,[S.value.length?(g(!0),v(X,{key:0},Me(S.value,(ee,x)=>(g(),v(X,{key:x},[ee.path!==null?(g(),v("button",{key:0,class:"at-link",title:`在文件面板中打开 ${ee.path}`,onClick:E=>I(ee.path??"")},C(ee.text),9,QT)):(g(),v(X,{key:1},[Pe(C(ee.text),1)],64))],64))),128)):(g(),v(X,{key:1},[Pe(C(e.message.content),1)],64))]),p.value?(g(),v("div",eI,[h("button",{title:"编辑并重新发送",onClick:O[0]||(O[0]=ee=>s("edit",e.message.content))},[K(me,{name:"edit",size:12}),O[4]||(O[4]=Pe("编辑重发",-1))])])):N("",!0)])):(g(),v("div",tI,[a.value&&(e.message.model&&e.showModel||e.streaming||l.value||e.showTimestamp&&d.value)?(g(),v("div",nI,[e.message.model&&e.showModel?(g(),v("span",{key:0,class:"brand-model",title:e.message.model},C(f.value),9,sI)):N("",!0),e.streaming?(g(),v("span",oI,[...O[5]||(O[5]=[h("i",{"aria-hidden":"true"},null,-1),Pe("生成中",-1)])])):N("",!0),l.value?(g(),Fe(gd,{key:2,stats:e.message.turnStats,inline:""},null,8,["stats"])):N("",!0),e.showTimestamp&&d.value?(g(),v("time",rI,C(d.value),1)):N("",!0)])):N("",!0),h("div",iI,[e.message.degraded?(g(),v("p",aI,"该回合早于持久化快照:正文与思考在服务重启后无法恢复(工具记录与消息结构已保留)。")):N("",!0),D(q)?(g(!0),v(X,{key:1},Me(u.value,ee=>(g(),Fe(GT,{key:ee.toolCallId,tool:ee,active:e.streaming,"session-id":e.sessionId,"msg-seq":e.message.seq},null,8,["tool","active","session-id","msg-seq"]))),128)):N("",!0),c.value.length&&D(B)?(g(),Fe(ET,{key:2,name:"工具调用过程",tools:c.value,live:e.streaming,"work-dir":e.workDir,"session-id":e.sessionId},null,8,["tools","live","work-dir","session-id"])):N("",!0),e.message.content?(g(),Fe(Dp,{key:3,class:"assistant-content",content:e.message.content,streaming:e.streaming},null,8,["content","streaming"])):e.streaming?(g(),v("span",lI)):N("",!0),e.message.turnStats&&e.message.turnStats.status!=="running"?(g(),Fe(gd,{key:5,stats:e.message.turnStats},null,8,["stats"])):N("",!0),m.value.length?(g(),v("div",uI,[(g(!0),v(X,null,Me(m.value,ee=>(g(),v("button",{key:ee.filePath,type:"button",class:"written-file",title:`在文件面板中打开 ${ee.filePath}`,onClick:x=>b(ee.filePath)},[K(me,{name:"file",size:12}),h("span",dI,C(y(ee.filePath)),1)],8,cI))),128))])):N("",!0),e.message.content||e.message.isError&&!e.streaming||e.canFork?(g(),v("div",fI,[e.message.content?(g(),v("button",{key:0,title:o.value?"已复制":"复制内容",onClick:W},[K(me,{name:o.value?"check":"copy",size:12},null,8,["name"]),Pe(C(o.value?"已复制":"复制"),1)],8,hI)):N("",!0),e.message.content?(g(),v("button",{key:1,title:R.value?"停止朗读":"朗读",onClick:A},[K(me,{name:R.value?"speaker-off":"speaker",size:12},null,8,["name"]),Pe(C(R.value?"停止":"朗读"),1)],8,pI)):N("",!0),e.message.isError&&!e.streaming?(g(),v("button",{key:2,class:"retry-btn",title:"重发最后一条消息",onClick:O[1]||(O[1]=ee=>s("retry"))},[K(me,{name:"refresh",size:12}),O[6]||(O[6]=Pe("重试",-1))])):N("",!0),a.value&&e.canFork&&!e.streaming?(g(),v("button",{key:3,title:"以当前对话为起点创建一个新会话",onClick:O[2]||(O[2]=ee=>s("fork"))},[K(me,{name:"fork",size:12}),O[7]||(O[7]=Pe("Fork",-1))])):N("",!0)])):N("",!0)])]))],10,VT))}}),mI=De(gI,[["__scopeId","data-v-c06917b6"]]),vI=["title","aria-label","onMouseenter","onClick"],yI={key:0,class:"minimap-tooltip"},bI="(min-width: 960px)",kI="(prefers-reduced-motion: reduce)",wI=24,SI=1e3,_I=Le({__name:"ChatMinimap",props:{messages:{},host:{},revision:{},revealMessage:{type:Function}},setup(e){const t=e,n=M(null),s=typeof window.matchMedia=="function",o=s?window.matchMedia(bI):null,r=s?window.matchMedia(kI):null,i=M((o==null?void 0:o.matches)??!1),a=M((r==null?void 0:r.matches)??!1);function l(Q){i.value=Q.matches}function u(Q){a.value=Q.matches}rt(()=>o==null?void 0:o.addEventListener("change",l)),at(()=>o==null?void 0:o.removeEventListener("change",l)),rt(()=>r==null?void 0:r.addEventListener("change",u)),at(()=>r==null?void 0:r.removeEventListener("change",u));function c(Q){var Ee;const ye=((Ee=Q.content)==null?void 0:Ee.length)??0;return ye<=0?.2:.2+.8*(1-1/(1+ye/200))}const d=P(()=>{let Q=0;return t.messages.map((ye,Ee)=>{const Ue=c(ye),Ke={id:ye.id??`seq-${Ee}`,seq:ye.seq??Ee,role:ye.role??"tool",ratio:Ue,offset:Q};return Q+=Ue,Ke})}),f=P(()=>d.value.reduce((Q,ye)=>Q+ye.ratio,0)||1),p=M({scrollTop:0,scrollHeight:0,clientHeight:0,trackHeight:0}),m=M(!1),y=M(!1),b=M(!1),k=M(null),w=P(()=>p.value.scrollHeight>p.value.clientHeight),S=P(()=>{const{scrollTop:Q,scrollHeight:ye,clientHeight:Ee,trackHeight:Ue}=p.value;if(!m.value||!w.value||Ue<=0)return{};const Ke=Math.max(wI,Ee/ye*Ue),J=Math.max(Ue-Ke,0);return{top:`${Math.min(Math.max(Q/ye*Ue,0),J)}px`,height:`${Ke}px`}}),I=P(()=>y.value||n.value!==null),q=P(()=>b.value&&!I.value&&!a.value);let B=null;function R(){b.value=!1,!a.value&&(B!==null&&clearTimeout(B),B=setTimeout(()=>{B=null,b.value=!0},SI))}function L(){B!==null&&(clearTimeout(B),B=null)}let A=null;function W(){var Ee;const Q=t.host;if(!Q){m.value=!1;return}const ye=((Ee=k.value)==null?void 0:Ee.clientHeight)??0;p.value={scrollTop:Q.scrollTop,scrollHeight:Q.scrollHeight,clientHeight:Q.clientHeight,trackHeight:ye||Q.clientHeight},m.value=Q.scrollHeight>0}function F(){A===null&&(A=requestAnimationFrame(()=>{A=null,W()}))}function O(){R(),F()}function ee(){y.value=!0,R()}function x(){y.value=!1,R()}let E=null;function z(){const Q=t.host;E==null||E.disconnect(),E=null,Q&&(Q.addEventListener("scroll",O,{passive:!0}),typeof ResizeObserver<"u"&&(E=new ResizeObserver(()=>F()),E.observe(Q)))}function oe(){var Q;(Q=t.host)==null||Q.removeEventListener("scroll",O),E==null||E.disconnect(),E=null}rt(()=>{i.value&&(z(),R(),F())}),at(()=>{oe(),L(),A!==null&&(cancelAnimationFrame(A),A=null)}),xe([()=>t.host,i],()=>{oe(),m.value=!1,Ve(()=>{i.value&&(z(),F())})});const ke=P(()=>{var Q,ye;return`${((Q=t.messages[0])==null?void 0:Q.id)??""}|${((ye=t.messages.at(-1))==null?void 0:ye.id)??""}`});let Te="",ge="";xe(ke,Q=>{const[ye,Ee]=Q.split("|"),Ue=Te!==""&&ye!==Te&&Ee!==ge;Te=ye??"",ge=Ee??"",Ue&&(m.value=!1),F()},{immediate:!0}),xe(w,Q=>{Q&&Ve(F)}),xe([()=>t.messages.length,()=>t.revision,f,i],()=>{F()});function le(Q){var Ke;const ye=t.host;if(!ye)return;(Ke=t.revealMessage)==null||Ke.call(t,Q);const Ee=`[data-message-id="${CSS.escape(Q)}"]`,Ue=()=>{var J;(J=ye.querySelector(Ee))==null||J.scrollIntoView({behavior:"smooth",block:"start"})};ye.querySelector(Ee)?Ue():Ve(Ue)}function ve(Q){const ye=Q.role==="user"?"用户":Q.role==="assistant"?"助手":"工具";return`#${Q.seq} ${ye}`}return(Q,ye)=>i.value&&d.value.length>0&&w.value?(g(),v("div",{key:0,class:fe(["minimap",{"is-quiet":q.value,"is-hovered":I.value}]),role:"navigation","aria-label":"消息地图",onPointerenter:ee,onPointerleave:x},[h("div",{ref_key:"trackRef",ref:k,class:"minimap-track"},[(g(!0),v(X,null,Me(d.value,Ee=>(g(),v("button",{key:Ee.id,class:fe(["minimap-block",`role-${Ee.role}`]),style:yt({top:`${Ee.offset/f.value*100}%`,height:`${Math.max(Ee.ratio/f.value*100,2)}%`}),title:ve(Ee),"aria-label":ve(Ee),onMouseenter:Ue=>n.value=Ee.seq,onMouseleave:ye[0]||(ye[0]=Ue=>n.value=null),onClick:Ue=>le(Ee.id)},[n.value===Ee.seq?(g(),v("span",yI,C(ve(Ee)),1)):N("",!0)],46,vI))),128)),h("div",{class:fe(["minimap-thumb",{"is-ready":m.value}]),style:yt(S.value),"aria-hidden":"true"},null,6)],512)],34)):N("",!0)}}),$I=De(_I,[["__scopeId","data-v-b3335103"]]);function md(e,t){return e-t}function vd(e,t){return Math.max(0,e-t)}const CI={class:"message-list-wrapper"},xI={key:0,class:"conn-banner",role:"status"},TI=["disabled"],II={key:0,class:"day-divider",role:"separator"},EI={key:1,class:"turn-divider","aria-hidden":"true"},AI={key:1,class:"message-skeleton","aria-hidden":"true"},MI=["aria-label"],RI={key:0,class:"scroll-badge"},PI=80,LI=40,DI=8,yd=24,OI=Le({__name:"MessageList",props:{messages:{},busy:{type:Boolean,default:!1},workDir:{default:null},sessionId:{default:""},connected:{type:Boolean,default:!1},olderAvailable:{type:Boolean,default:!1},olderLoading:{type:Boolean,default:!1}},emits:["edit","retry-connection","retry-message","load-older","fork"],setup(e,{emit:t}){const n=e,s=t,o=M(null),r=M(null);let i=null;const a=P(()=>{for(let T=n.messages.length-1;T>=0;T--)if(n.messages[T].role==="user")return n.messages[T].id;return null}),l=P(()=>{var T;return((T=n.messages.at(-1))==null?void 0:T.id)??null}),u=P(()=>{var T;return((T=[...n.messages].reverse().find(H=>H.role==="assistant"))==null?void 0:T.id)??null});function c(T){const H=n.messages[T];if(!H)return!1;if(H.role!=="assistant")return!0;const G=n.messages[T+1];return!G||G.role!=="assistant"||H.ts!==void 0&&G.ts!==void 0&&G.ts-H.ts>300*1e3}function d(T){const H=n.messages[T];if(!H||H.role!=="assistant"||!H.model)return!1;const G=n.messages[T-1];return!G||G.role!=="assistant"?!0:G.model!==H.model}function f(T){const H=n.messages[T];return!!H&&T>0&&H.role==="user"}function p(T){const H=n.messages[T],G=T>0?n.messages[T-1]:void 0;return!H||!G||H.ts===void 0||G.ts===void 0||Ww(G.ts,H.ts)?null:qw(H.ts)}const m={streaming:!1,isLatestUser:!1,canFork:!1,showTimestamp:!1,showModel:!1,idle:!0},y=P(()=>{const T=a.value,H=l.value,G=u.value,se=[];return n.messages.forEach((he,Se)=>{const _e=p(Se);_e!==null?se.push({kind:"day-divider",key:`${he.id}-divider`,dividerText:_e,flags:m}):f(Se)&&se.push({kind:"turn-divider",key:`${he.id}-divider`,dividerText:null,flags:m}),se.push({kind:"message",key:he.id,message:he,dividerText:null,flags:{streaming:n.busy&&he.id===H&&he.role==="assistant",isLatestUser:he.id===T,canFork:!n.busy&&he.id===G,showTimestamp:c(Se),showModel:d(Se),idle:!n.busy}})}),se});function b(T){return Math.max(0,T-PI)}const k=M(b(y.value.length)),w=P(()=>{const T=y.value.length,H=Math.min(Math.max(0,k.value),T);return y.value.slice(H)}),S=P(()=>k.value>0||n.olderAvailable);function I(T){const H=y.value;for(let G=0;G<H.length;G++){const se=H[G];if(se.kind==="message"&&se.message.id===T)return G}return-1}function q(T){const H=I(T);return H<0?!1:(H>=k.value||B(()=>{k.value=Math.max(0,H-DI)}),!0)}function B(T){const H=o.value;if(!H){T();return}const G=md(H.scrollHeight,H.scrollTop);T(),Ve(()=>{const se=o.value;se&&(se.scrollTop=vd(se.scrollHeight,G))})}let R=!1;const L=P(()=>{var G;const T=n.messages.at(-1);if(!T)return 0;let H=T.content.length;for(const se of T.tools)H+=((G=se.output)==null?void 0:G.length)??0;return H});let A=!1;const W=M(!1),F=M(0);function O(){const T=o.value;return T?T.scrollHeight-T.scrollTop-T.clientHeight<yd:!0}function ee(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function x(T){k.value=b(y.value.length),requestAnimationFrame(()=>{const H=o.value;if(!H)return;const G=ee()?"auto":T;G==="smooth"&&Te(),H.scrollTo({top:H.scrollHeight,behavior:G})})}let E=!1,z=null,oe=null;function ke(){const T=o.value;z&&T&&T.removeEventListener("scrollend",z),z=null,E=!1,oe!==null&&(clearTimeout(oe),oe=null)}function Te(){const T=o.value;T&&(ke(),E=!0,z=()=>ke(),T.addEventListener("scrollend",z),oe=setTimeout(ke,1500))}function ge(){const T=o.value;!E||!T||(T.scrollTo({top:T.scrollTop,behavior:"auto"}),ke())}let le=null,ve=null,Q=0,ye=null;const Ee=new Set;function Ue(){const T=ve,H=o.value;if(!T||!H)return;const G=new Set(Array.from(H.children));for(const se of Array.from(Ee))G.has(se)||(T.unobserve(se),Ee.delete(se));for(const se of G)Ee.has(se)||(T.observe(se),Ee.add(se))}function Ke(){const T=o.value;if(!T)return;const H=T.scrollHeight,G=H>Q;Q=H,G&&(te||R||(A||O())&&ye===null&&(ye=requestAnimationFrame(()=>{ye=null,x("auto")})))}function J(T){return T.seq!==void 0?`${T.role}:${T.seq}`:`id:${T.id}`}function de(T){for(const H of n.messages)if(J(H)===T)return H;return null}function Z(T){const H=T.querySelectorAll("[data-message-id]");for(const G of H)if(G.offsetTop+G.offsetHeight>T.scrollTop){const se=G.dataset.messageId;if(se)return{id:se,offsetTop:G.offsetTop}}return null}function Ie(){const T=o.value,H=n.sessionId;!T||!H||le===null&&(le=requestAnimationFrame(()=>{le=null;try{const G=Z(T);if(!G)return;const se=n.messages.find(Se=>Se.id===G.id),he=se?J(se):`id:${G.id}`;localStorage.setItem(`scream-scroll:${H}`,`v3:${he}:${Math.round(G.offsetTop-T.scrollTop)}`)}catch{}}))}function _(T){try{return localStorage.getItem(`scream-scroll:${T}`)!==null}catch{return!1}}function $(){k.value=b(y.value.length);const T=o.value;T&&(T.scrollTop=T.scrollHeight)}async function U(T,H){if(!q(T))return"unusable";await Ve();const G=o.value;if(!G)return"unusable";const se=Array.from(G.querySelectorAll("[data-message-id]")).find(he=>he.dataset.messageId===T);return se?(G.scrollTop=se.offsetTop-H,"restored"):"unusable"}async function Y(){const T=o.value,H=n.sessionId;if(!T||!H)return"missing";let G=null;try{G=localStorage.getItem(`scream-scroll:${H}`)}catch{}if(!G)return"missing";if(G.startsWith("v3:")){const he=G.slice(3),Se=he.lastIndexOf(":");if(Se<=0)return"unusable";const _e=he.slice(0,Se),Re=Number(he.slice(Se+1));if(!Number.isFinite(Re))return"unusable";const we=de(_e);return we?U(we.id,Re):"unusable"}if(G.startsWith("v2:")){const he=G.split(":"),Se=he[1],_e=Number(he[2]);return!Se||!Number.isFinite(_e)||!n.messages.some(Re=>Re.id===Se)?"unusable":U(Se,_e)}const se=Number(G);if(!Number.isFinite(se))return"unusable";if(!(se>0))return"restored";if(se>T.scrollHeight-T.clientHeight&&k.value>0){k.value=0,await Ve();const he=o.value;return he&&(he.scrollTop=se),"restored"}return T.scrollTop=se,"restored"}let te=!1;xe(()=>{var T;return[((T=n.messages[0])==null?void 0:T.id)??null,n.messages.length,n.sessionId]},([T,H,G],[se,he,Se])=>{const _e=H>0&&T!==null&&se!==null&&T!==se&&H>(he??0)&&G===Se;if(te=_e,!_e)return;R=!0;const Re=o.value;if(!Re)return;const we=md(Re.scrollHeight,Re.scrollTop);Ve(()=>{Re.scrollTop=vd(Re.scrollHeight,we)})}),xe(()=>y.value.length,(T,H)=>{const G=H??0;if(R){R=!1;return}k.value===b(G)&&!W.value?k.value=b(T):k.value>b(T)&&B(()=>{k.value=b(T)})});function ne(){const T=o.value;if(!T)return;const H=T.scrollHeight-T.scrollTop-T.clientHeight>yd;W.value=H,H||(F.value=0),H&&A&&(A=!1),n.busy||Ie()}let ue="";xe(()=>n.sessionId,()=>{ue="",F.value=0,te=!1,k.value=b(y.value.length)}),xe(()=>[n.messages.length,L.value],([T],[H])=>{if(T!==H){const G=te;if(te=!1,T>0&&ue!==n.sessionId){ue=n.sessionId;const se=(H??0)===0;if(se&&!_(n.sessionId)){Ve($);return}requestAnimationFrame(()=>requestAnimationFrame(async()=>{const he=await Y();he!=="restored"&&(se||he==="unusable")&&$()}));return}if(G)return;if(!O()){F.value=Math.max(0,F.value+Math.max(0,T-(H??0)));return}A=!0,W.value=!1,x("smooth");return}!A&&!O()||x("auto")}),xe(()=>n.busy,T=>{T||(A=!1)});function ce(){A=!0,W.value=!1,F.value=0,x("smooth")}const ie=P(()=>!n.busy||n.messages.length===0?!1:n.messages.at(-1).role==="user");return rt(()=>{var T,H,G,se;(T=o.value)==null||T.addEventListener("scroll",ne,{passive:!0}),(H=o.value)==null||H.addEventListener("wheel",ge,{passive:!0}),(G=o.value)==null||G.addEventListener("touchstart",ge,{passive:!0}),typeof IntersectionObserver<"u"&&(i=new IntersectionObserver(he=>{var Se;(Se=he[0])!=null&&Se.isIntersecting&&(k.value>0&&B(()=>{k.value=Math.max(0,k.value-LI)}),k.value===0&&n.olderAvailable&&!n.olderLoading&&n.messages.length>0&&s("load-older"))},{root:o.value,rootMargin:"120px 0px 0px 0px"}),r.value&&i.observe(r.value)),typeof ResizeObserver<"u"&&(Q=((se=o.value)==null?void 0:se.scrollHeight)??0,ve=new ResizeObserver(Ke),Ue()),_l(()=>Ue()),requestAnimationFrame(()=>requestAnimationFrame(async()=>{await Y()==="unusable"&&$()}))}),ki(()=>{var T,H,G;(T=o.value)==null||T.removeEventListener("scroll",ne),(H=o.value)==null||H.removeEventListener("wheel",ge),(G=o.value)==null||G.removeEventListener("touchstart",ge),i==null||i.disconnect(),i=null,ve==null||ve.disconnect(),ve=null,Ee.clear(),ye!==null&&(cancelAnimationFrame(ye),ye=null),ke(),le!==null&&(cancelAnimationFrame(le),le=null)}),xe(r,T=>{i&&(i.disconnect(),T&&i.observe(T))}),(T,H)=>(g(),v("div",CI,[!e.connected&&e.messages.length>0?(g(),v("div",xI,[H[7]||(H[7]=h("span",{class:"conn-dot","aria-hidden":"true"},null,-1)),H[8]||(H[8]=h("span",null,"连接中断,自动恢复中…",-1)),h("button",{class:"conn-retry",onClick:H[0]||(H[0]=G=>s("retry-connection"))},"立即重试")])):N("",!0),h("div",{ref_key:"listRef",ref:o,class:"message-list"},[S.value?(g(),v("div",{key:0,ref_key:"topSentinelRef",ref:r,class:"load-older-row"},[e.olderAvailable?(g(),v("button",{key:0,class:"load-older-btn",disabled:e.olderLoading,onClick:H[1]||(H[1]=G=>s("load-older"))},C(e.olderLoading?"加载中…":"加载更早消息"),9,TI)):N("",!0)],512)):N("",!0),(g(!0),v(X,null,Me(w.value,(G,se,he,Se)=>{const _e=[G.message,G.flags.streaming,G.flags.isLatestUser,G.flags.canFork,G.flags.showTimestamp,G.flags.showModel,G.flags.idle,G.dividerText,e.busy,e.sessionId,e.workDir];if(Se&&Se.el&&Se.key===G.key&&Hm(Se,_e))return Se;const Re=(g(),v(X,{key:G.key},[G.kind==="day-divider"?(g(),v("div",II,[h("span",null,C(G.dividerText),1)])):G.kind==="turn-divider"?(g(),v("div",EI)):(g(),Fe(mI,{key:2,message:G.message,"is-latest-user":G.flags.isLatestUser,idle:G.flags.idle,streaming:G.flags.streaming,"session-id":e.sessionId,"can-fork":G.flags.canFork,"show-timestamp":G.flags.showTimestamp,"show-model":G.flags.showModel,"work-dir":e.workDir??void 0,onEdit:H[2]||(H[2]=we=>s("edit",we)),onRetry:H[3]||(H[3]=we=>s("retry-message")),onFork:H[4]||(H[4]=we=>s("fork"))},null,8,["message","is-latest-user","idle","streaming","session-id","can-fork","show-timestamp","show-model","work-dir"]))],64));return Re.memo=_e,Re},H,5),128)),ie.value?(g(),v("div",AI,[...H[9]||(H[9]=[h("div",{class:"sk-body"},[h("div",{class:"sk-line sk-w-60"}),h("div",{class:"sk-line sk-w-90"}),h("div",{class:"sk-line sk-w-40"})],-1)])])):N("",!0)],512),K($I,{messages:e.messages,host:o.value,revision:k.value,"reveal-message":q},null,8,["messages","host","revision"]),K(Il,{name:"scroll-btn"},{default:it(()=>[W.value?(g(),v("button",{key:0,class:fe(["scroll-to-bottom",{streaming:e.busy}]),title:"滚动到最新消息","aria-label":F.value>0?`滚动到最新消息,${F.value} 条新消息`:"滚动到最新消息",onClick:ce},[K(me,{name:"chevron-down",size:18}),F.value>0?(g(),v("span",RI,C(F.value>99?"99+":F.value),1)):N("",!0)],10,MI)):N("",!0)]),_:1})]))}}),NI=De(OI,[["__scopeId","data-v-af6b9f2e"]]),GI={class:"stats-head"},BI={class:"stats-body"},FI={class:"stats-section"},jI={class:"stats-label-row"},UI={class:"stats-value mono"},zI=["aria-valuenow","aria-label"],HI={key:0,class:"stats-section"},WI={class:"stats-label-row"},qI={class:"stats-value mono"},VI={class:"stats-section"},KI={class:"stats-label-row"},ZI={class:"stats-value mono"},YI={class:"stats-grid"},XI={class:"stats-cell-label"},JI={class:"stats-cell-value mono"},QI={key:1,class:"stats-section"},eE=["title"],tE={class:"model-tokens mono"},nE={class:"model-dims mono"},sE={key:1,class:"stats-empty"},oE=Le({__name:"SessionStatsPanel",props:{status:{},fetchUsage:{type:Function},fetchContext:{type:Function}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,o=M(null);rt(()=>{n.fetchUsage(),n.fetchContext()});function r(w){const S=o.value;S&&!S.contains(w.target)&&s("close")}function i(w){w.key==="Escape"&&s("close")}rt(()=>{document.addEventListener("pointerdown",r),window.addEventListener("keydown",i)}),at(()=>{document.removeEventListener("pointerdown",r),window.removeEventListener("keydown",i)});function a(w){return w?w.inputOther+w.output+w.inputCacheRead+w.inputCacheCreation:0}function l(w){return typeof w!="number"?"-":w>=1e6?`${(w/1e6).toFixed(1)}M`:w>=1e3?`${(w/1e3).toFixed(1)}k`:String(w)}function u(w){return typeof w=="number"?w.toLocaleString():"-"}const c=P(()=>{const w=n.status.contextUsage;if(typeof w=="number"&&Number.isFinite(w)){const q=w>1?w:w*100;return Math.max(0,Math.min(q,100))}const S=n.status.contextTokens??0,I=n.status.maxContextTokens??0;return I<=0?0:Math.max(0,Math.min(S/I*100,100))}),d=P(()=>typeof n.status.contextTokens=="number"&&typeof n.status.maxContextTokens=="number"?`${u(n.status.contextTokens)} / ${u(n.status.maxContextTokens)}`:c.value>0?`${c.value.toFixed(1)}%`:"-"),f=P(()=>{var w;return(w=n.status.usage)==null?void 0:w.total}),p=P(()=>{var w;return(w=n.status.usage)==null?void 0:w.currentTurn}),m=P(()=>a(f.value)),y=P(()=>{var S;const w=(S=n.status.usage)==null?void 0:S.byModel;return w?Object.entries(w).map(([I,q])=>({model:I,tokens:a(q),input:q.inputOther,output:q.output,cacheRead:q.inputCacheRead,cacheCreation:q.inputCacheCreation})):[]}),b=P(()=>m.value>0||y.value.length>0||a(p.value)>0),k=P(()=>{var w,S,I,q;return[{key:"input",label:"输入",value:(w=f.value)==null?void 0:w.inputOther},{key:"output",label:"输出",value:(S=f.value)==null?void 0:S.output},{key:"cacheRead",label:"缓存读",value:(I=f.value)==null?void 0:I.inputCacheRead},{key:"cacheCreation",label:"缓存写",value:(q=f.value)==null?void 0:q.inputCacheCreation}]});return(w,S)=>(g(),v("div",{ref_key:"rootRef",ref:o,class:"stats-panel",role:"dialog","aria-label":"会话统计"},[h("div",GI,[S[1]||(S[1]=h("span",{class:"stats-title"},"会话统计",-1)),h("button",{class:"stats-close","aria-label":"关闭统计面板",onClick:S[0]||(S[0]=I=>s("close"))},[K(me,{name:"x",size:14})])]),h("div",BI,[h("div",FI,[h("div",jI,[S[2]||(S[2]=h("span",{class:"stats-label"},"上下文水位",-1)),h("span",UI,C(d.value),1)]),h("div",{class:"ctx-track",role:"progressbar","aria-valuenow":Math.round(c.value),"aria-valuemin":"0","aria-valuemax":"100","aria-label":`上下文 ${c.value.toFixed(1)}%`},[h("div",{class:"ctx-fill",style:yt({width:`${c.value}%`})},null,4)],8,zI)]),b.value?(g(),v(X,{key:0},[a(p.value)>0?(g(),v("div",HI,[h("div",WI,[S[3]||(S[3]=h("span",{class:"stats-label"},"当前回合",-1)),h("span",qI,C(l(a(p.value)))+" tokens",1)])])):N("",!0),h("div",VI,[h("div",KI,[S[4]||(S[4]=h("span",{class:"stats-label"},"本会话累计",-1)),h("span",ZI,C(l(m.value))+" tokens",1)]),h("div",YI,[(g(!0),v(X,null,Me(k.value,I=>(g(),v("div",{key:I.key,class:"stats-cell"},[h("span",XI,C(I.label),1),h("span",JI,C(u(I.value)),1)]))),128))])]),y.value.length>0?(g(),v("div",QI,[S[5]||(S[5]=h("div",{class:"stats-label"},"按模型",-1)),(g(!0),v(X,null,Me(y.value,I=>(g(),v("div",{key:I.model,class:"model-row"},[h("span",{class:"model-name",title:I.model},C(I.model),9,eE),h("span",tE,C(u(I.tokens)),1),h("span",nE," 入 "+C(u(I.input))+" · 出 "+C(u(I.output))+" · 缓存 "+C(u(I.cacheRead+I.cacheCreation)),1)]))),128))])):N("",!0)],64)):(g(),v("div",sE,"暂无用量数据"))])],512))}}),rE=De(oE,[["__scopeId","data-v-631485c2"]]),iE={class:"conversation"},aE={key:1,class:"stats-anchor"},lE={class:"chat-stage"},uE={class:"chat-column"},cE={class:"composer-dock"},dE=Le({__name:"ConversationView",props:{client:{}},emits:["home"],setup(e,{expose:t,emit:n}){const s=e,o=n,{connectionStatus:r,messages:i,pendingApprovals:a,status:l,sessionId:u,workDir:c,isBusy:d,models:f,sendPrompt:p,sendCommand:m,clearMessages:y,appendSystemMessage:b,abort:k,resolveApproval:w,exportSession:S,fetchSnapshot:I,switchModel:q,switchThinking:B,switchPermission:R,goal:L,pauseGoal:A,resumeGoal:W,cancelGoal:F}=s.client,O=M(null),ee=M(!1),x=M(!1),E=M("status"),z=P(()=>{var U;const _=(U=l.value.usage)==null?void 0:U.currentTurn;if(!_)return null;const $=_.inputOther+_.output+_.inputCacheRead+_.inputCacheCreation;return $>0?$:null}),oe=P(()=>{const _=s.client.sessions.value.find(Y=>Y.sessionId===s.client.currentSessionId.value),$=_==null?void 0:_.title;if($&&$!=="新会话"&&$!=="New Session")return $;const U=i.value.find(Y=>Y.role==="user");if(U){const Y=U.content.replace(/\s+/g," ").trim();if(Y)return Y.length>24?`${Y.slice(0,24)}…`:Y}return $??null}),ke=P(()=>{var _,$;for(let U=i.value.length-1;U>=0;U-=1){const Y=($=(_=i.value[U])==null?void 0:_.turnStats)==null?void 0:$.turn;if(Y)return Y}return i.value.filter(U=>U.role==="user").length}),Te=P(()=>i.value.length===0&&!d.value);function ge(_){var $;($=O.value)==null||$.insertText(_)}function le(_,$){return O.value?(O.value.insertDraft(_,$),!0):!1}t({insertDraft:le});async function ve(){window.confirm("取消目标会让它进入已结束态,确定继续?")&&await F()}function Q(){rh("goal")}function ye(_){I(),E.value=_,x.value=!0}function Ee(){var _;return((_=O.value)==null?void 0:_.openModelPicker())??!1}const{onCommand:Ue}=Qf({sendCommand:m,clearMessages:y,appendSystemMessage:b,onNew:()=>o("home"),openModelPicker:Ee,showInfo:ye,currentModel:()=>l.value.model});function Ke(_){m("title",_)}function J(){if(d.value||!r.value)return;const _=[...i.value].reverse().find($=>$.role==="user");_&&p(_.content)}const de=M(!1);async function Z(){de.value=!0,await s.client.loadOlderMessages(),de.value=!1}function Ie(){d.value||(m("fork"),setTimeout(()=>{s.client.fetchSessions()},1200))}return(_,$)=>(g(),v("div",iE,[Te.value?N("",!0):(g(),Fe(uw,{key:0,title:oe.value,busy:D(d),"stats-open":ee.value,"turn-tokens":z.value,"turn-count":ke.value,onHome:$[0]||($[0]=U=>o("home")),onRename:Ke,onExport:$[1]||($[1]=U=>D(u)&&D(S)(D(u))),onFork:Ie,onClear:D(y),onToggleStats:$[2]||($[2]=U=>ee.value=!ee.value)},null,8,["title","busy","stats-open","turn-tokens","turn-count","onClear"])),ee.value?(g(),v("div",aE,[K(rE,{status:D(l),"fetch-usage":s.client.fetchSessionUsage,"fetch-context":s.client.fetchSessionContext,onClose:$[3]||($[3]=U=>ee.value=!1)},null,8,["status","fetch-usage","fetch-context"])])):N("",!0),h("div",lE,[h("div",uE,[K(NI,{messages:D(i),busy:D(d),"work-dir":D(c),"session-id":D(u)??"",connected:D(r)==="connected","older-available":s.client.olderAvailable.value,"older-loading":de.value,onEdit:ge,onRetryConnection:$[4]||($[4]=U=>s.client.reconnectNow()),onRetryMessage:J,onLoadOlder:Z,onFork:Ie},null,8,["messages","busy","work-dir","session-id","connected","older-available","older-loading"]),h("div",cE,[K(ib,{approvals:D(a),onResolve:D(w)},null,8,["approvals","onResolve"]),K(hh,{ref_key:"composerRef",ref:O,busy:D(d),status:D(l),"session-id":D(u),models:D(f),"work-dir":D(c)||"",messages:D(i),"connection-status":D(r),goal:D(L),onSend:D(p),onAbort:D(k),onCommand:D(Ue),onSwitchModel:D(q),onSwitchThinking:D(B),onSwitchPermission:D(R),onGoalPause:D(A),onGoalResume:D(W),onGoalCancel:ve,onGoalEdit:Q},null,8,["busy","status","session-id","models","work-dir","messages","connection-status","goal","onSend","onAbort","onCommand","onSwitchModel","onSwitchThinking","onSwitchPermission","onGoalPause","onGoalResume"])])])]),x.value?(g(),Fe(ph,{key:2,mode:E.value,status:D(l),"session-id":D(u),"work-dir":D(c),onClose:$[5]||($[5]=U=>x.value=!1)},null,8,["mode","status","session-id","work-dir"])):N("",!0)]))}}),fE=De(dE,[["__scopeId","data-v-e3e8c44b"]]),hE=new Set(["png","jpg","jpeg","gif","webp","svg","avif","ico"]),pE=new Set(["mp3","wav","m4a","ogg"]),gE=new Set(["md","markdown"]);function Gp(e){const t=e.split(/[\\/]/).pop()??e,n=t.lastIndexOf(".");return n>0?t.slice(n+1).toLowerCase():""}function mE(e){const t=Gp(e);return hE.has(t)?"image":pE.has(t)?"audio":gE.has(t)?"markdown":t==="pdf"?"pdf":"source"}const vE={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",py:"python",rs:"rust",go:"go",java:"java",c:"c",h:"c",cpp:"cpp",hpp:"cpp",cs:"csharp",rb:"ruby",php:"php",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",json:"json",toml:"toml",ini:"ini",xml:"xml",html:"html",css:"css",scss:"scss",less:"less",sql:"sql",md:"markdown",markdown:"markdown",vue:"vue",svelte:"svelte",swift:"swift",kt:"kotlin",lua:"lua",r:"r",dart:"dart",graphql:"graphql",proto:"protobuf",txt:"text"};function bd(e){const t=(e.split(/[\\/]/).pop()??"").toLowerCase();return t==="dockerfile"?"docker":t==="makefile"?"make":vE[Gp(e)]??"text"}const yE={key:0,class:"file-viewer"},bE={class:"fv-toolbar"},kE=["title","aria-label"],wE={class:"fv-path-text"},SE={class:"fv-modes",role:"tablist","aria-label":"显示模式"},_E=["aria-selected","title","onClick"],$E={class:"fv-body"},CE={key:0,class:"fv-status"},xE={key:1,class:"fv-status fv-error"},TE={class:"fv-error-name"},IE={class:"fv-error-msg"},EE={key:0,class:"fv-scroll"},AE={key:1,class:"fv-status"},ME={key:0,class:"fv-media"},RE=["src","alt"],PE={key:1,class:"fv-media"},LE=["src"],DE={key:2,class:"fv-media fv-pdf"},OE=["src","title"],NE={key:3,class:"fv-scroll fv-markdown"},GE={key:4,class:"fv-scroll"},BE={key:4,class:"fv-scroll"},FE={key:0,class:"fv-note"},jE={key:1,class:"fv-empty"},ma="/api/v1",UE=Le({__name:"FileViewer",props:{client:{}},setup(e){const t=e,n=[{id:"source",label:"源码"},{id:"preview",label:"预览"},{id:"diff",label:"Diff"}],s=P(()=>Gy()),o=P(()=>s.value?Ey(s.value.viewerState,s.value.initialDisplayMode):"source"),r=P(()=>s.value?mE(s.value.filePath):"source"),i=M(0),a=P(()=>{if(!s.value)return"";const A=i.value>0?`&t=${i.value}`:"";return`${ma}/files/raw?path=${encodeURIComponent(s.value.filePath)}${A}`}),l=Wn(new Map),u=Wn(new Map);async function c(A){try{const W=await A.json();return W.message??W.error??`HTTP ${A.status}`}catch{return`HTTP ${A.status}`}}function d(A){var ee,x;const W=(ee=t.client)==null?void 0:ee.gitStatus.value,F=((x=t.client)==null?void 0:x.workDir.value)??"";if(!(W!=null&&W.files)||W.files.length===0)return null;const O=F&&A.startsWith(`${F}/`)?A.slice(F.length+1):A.startsWith("/")?null:A;if(O){const E=W.files.find(z=>(z.displayPath??z.path)===O);if(E)return E.path;for(const z of W.files){const oe=z.displayPath??z.path;if(oe&&z.path.endsWith(oe))return z.path.slice(0,z.path.length-oe.length)+O}}return null}function f(A){var ee;const W=[],F=x=>{x&&x!==A&&!W.includes(x)&&W.push(x)};F(d(A)),W.push(A);const O=((ee=t.client)==null?void 0:ee.workDir.value)??"";return O&&A.startsWith(`${O}/`)&&F(A.slice(O.length+1)),W}async function p(){const A=s.value;if(!(!A||u.has(A.filePath)))try{for(const W of f(A.filePath)){const F=await fetch(`${ma}/git/diff?path=${encodeURIComponent(W)}`);if(!F.ok){u.set(A.filePath,{status:"error",message:await c(F)});return}const O=await F.json();if((O.patch??"")!==""){u.set(A.filePath,{status:"ok",patch:O.patch??""});return}}u.set(A.filePath,{status:"ok",patch:""})}catch(W){u.set(A.filePath,{status:"error",message:W instanceof Error?W.message:String(W)})}}async function m(){const A=s.value;if(A){if(o.value==="diff"){await p();return}if(!(o.value==="preview"&&(r.value==="image"||r.value==="audio"||r.value==="pdf"))&&!l.has(A.filePath))try{const W=await fetch(`${ma}/files/read?path=${encodeURIComponent(A.filePath)}`);if(!W.ok)l.set(A.filePath,{status:"error",message:await c(W)});else{const F=await W.json();l.set(A.filePath,{status:"ok",content:F.content,truncated:F.truncated===!0})}}catch(W){l.set(A.filePath,{status:"error",message:W instanceof Error?W.message:String(W)})}}}xe(()=>{var A;return[(A=s.value)==null?void 0:A.id,o.value]},()=>{m()},{immediate:!0});const y=P(()=>{const A=s.value;if(A)return o.value==="diff"?u.get(A.filePath):o.value==="preview"&&(r.value==="image"||r.value==="audio"||r.value==="pdf")?{status:"ok"}:l.get(A.filePath)}),b=P(()=>s.value!==void 0&&y.value===void 0),k=P(()=>{var A;return((A=y.value)==null?void 0:A.status)==="error"?y.value:null}),w=P(()=>{const A=s.value?l.get(s.value.filePath):void 0;return(A==null?void 0:A.status)==="ok"?A.content:""}),S=P(()=>{const A=s.value?l.get(s.value.filePath):void 0;return(A==null?void 0:A.status)==="ok"?A.truncated:!1}),I=P(()=>{const A=s.value?u.get(s.value.filePath):void 0;return(A==null?void 0:A.status)==="ok"&&A.patch.trim()!==""?Np(A.patch):[]});function q(A){var O,ee,x;const W=s.value;if(!W||o.value===A)return;const F={displayMode:A,wrapLines:((O=W.viewerState)==null?void 0:O.wrapLines)??!1,scrollTop:((ee=W.viewerState)==null?void 0:ee.scrollTop)??0,scrollLeft:((x=W.viewerState)==null?void 0:x.scrollLeft)??0};Ce.tabs=Ry(Ce.tabs,W.id,W.viewerRevision??0,F)}function B(){const A=s.value;if(A){if(o.value==="diff")u.delete(A.filePath);else if(o.value==="preview"&&(r.value==="image"||r.value==="audio"||r.value==="pdf")){i.value+=1;return}else l.delete(A.filePath);m()}}const R=M(!1);function L(){var W;const A=s.value;A&&((W=navigator.clipboard)==null||W.writeText(A.filePath).then(()=>{R.value=!0,setTimeout(()=>R.value=!1,1500)}).catch(()=>{}))}return(A,W)=>s.value?(g(),v("div",yE,[h("div",bE,[h("button",{class:"fv-path",title:R.value?"已复制路径":`复制路径:${s.value.filePath}`,"aria-label":`文件路径 ${s.value.filePath}`,onClick:L},[K(me,{name:"copy",size:12,class:"fv-path-icon"}),h("span",wE,C(s.value.filePath),1)],8,kE),h("div",SE,[(g(),v(X,null,Me(n,F=>h("button",{key:F.id,class:fe(["fv-mode",{active:o.value===F.id}]),role:"tab","aria-selected":o.value===F.id,title:`${F.label}模式`,onClick:O=>q(F.id)},C(F.label),11,_E)),64))]),h("button",{class:"fv-icon-btn",title:"刷新","aria-label":"刷新",onClick:B},[K(me,{name:"refresh",size:14})])]),h("div",$E,[b.value?(g(),v("div",CE,[...W[0]||(W[0]=[h("span",{class:"fv-spinner","aria-hidden":"true"},null,-1),h("span",null,"加载中…",-1)])])):k.value?(g(),v("div",xE,[h("p",TE,C(s.value.label),1),h("p",IE,C(k.value.message),1),h("button",{class:"fv-retry",onClick:B},"重试")])):o.value==="diff"?(g(),v(X,{key:2},[I.value.length>0?(g(),v("div",EE,[K(fu,{lines:I.value},null,8,["lines"])])):(g(),v("div",AE,"该文件没有未提交的改动。"))],64)):o.value==="preview"?(g(),v(X,{key:3},[r.value==="image"?(g(),v("div",ME,[h("img",{src:a.value,alt:s.value.label},null,8,RE)])):r.value==="audio"?(g(),v("div",PE,[h("audio",{class:"fv-audio",controls:"",src:a.value},null,8,LE)])):r.value==="pdf"?(g(),v("div",DE,[h("iframe",{class:"fv-pdf-frame",src:a.value,title:s.value.label},null,8,OE)])):r.value==="markdown"?(g(),v("div",NE,[K(Dp,{content:w.value},null,8,["content"])])):(g(),v("div",GE,[W[1]||(W[1]=h("p",{class:"fv-note"},"该类型暂不支持预览,显示源码内容。",-1)),K(ul,{code:w.value,lang:D(bd)(s.value.filePath)},null,8,["code","lang"])]))],64)):(g(),v("div",BE,[S.value?(g(),v("p",FE,"文件较大,仅显示前 256KB。")):N("",!0),K(ul,{code:w.value,lang:D(bd)(s.value.filePath)},null,8,["code","lang"])]))])])):(g(),v("div",jE,"从工具卡片、文件浏览或消息中选择文件打开"))}}),zE=De(UE,[["__scopeId","data-v-5dae9ca4"]]),HE={class:"panel-head-row"},WE=["aria-expanded"],qE={class:"head-icon"},VE=["title"],KE={key:1,class:"head-hint"},ZE={class:"head-tail"},YE={key:0,class:"head-count"},XE={class:"panel-body"},JE={key:0,class:"git-files"},QE=["title","onClick"],eA={class:"git-file-name"},tA={key:0,class:"git-file-dir"},nA={class:"git-file-base"},sA={key:0,class:"git-file-stat"},oA={key:0,class:"add"},rA={key:1,class:"del"},iA={key:2,class:"diff-body"},aA={key:3,class:"panel-empty"},lA={key:1,class:"diff-empty"},uA=8,kd="scream-panel-git-open",cA=Le({__name:"GitPanel",props:{gitStatus:{default:null}},emits:["refresh","diff"],setup(e,{emit:t}){const n=e,s=t,o={M:"M",A:"A",D:"D",R:"R",U:"U","??":"?","?":"?"},r={D:"danger",A:"success",R:"success",U:"danger","??":"warning","?":"warning"},i=M(!1),a=M(!0);try{a.value=localStorage.getItem(kd)!=="0"}catch{}function l(){a.value=!a.value;try{localStorage.setItem(kd,a.value?"1":"0")}catch{}}function u(){s("refresh")}const c=P(()=>{var m;const p=((m=n.gitStatus)==null?void 0:m.files)??[];return i.value?p:p.slice(0,uA)}),d=P(()=>{var p,m;return Math.max(0,(((m=(p=n.gitStatus)==null?void 0:p.files)==null?void 0:m.length)??0)-c.value.length)}),f=P(()=>{var b,k;const p=((b=n.gitStatus)==null?void 0:b.ahead)??0,m=((k=n.gitStatus)==null?void 0:k.behind)??0;if(!p&&!m)return"";const y=[];return p&&y.push(`↑${p}`),m&&y.push(`↓${m}`),` · ${y.join(" ")}`});return(p,m)=>{var y;return g(),v("section",{class:fe(["panel-section","git-panel",{"is-open":a.value}])},[h("div",HE,[h("button",{class:"panel-head","aria-expanded":a.value,onClick:l},[h("span",qE,[K(me,{name:"git-branch",size:14})]),m[1]||(m[1]=h("span",{class:"head-title"},"Git 变更",-1)),e.gitStatus?(g(),v("span",{key:0,class:"head-hint",title:`${e.gitStatus.branch??"detached"}${f.value}`},C(e.gitStatus.branch??"detached")+C(f.value),9,VE)):(g(),v("span",KE,"状态不可用")),h("span",ZE,[e.gitStatus?(g(),v("span",YE,C(e.gitStatus.changed),1)):N("",!0),K(me,{class:fe(["chevron",{rotated:a.value}]),name:"chevron-down",size:14},null,8,["class"])])],8,WE),h("button",{class:"icon-btn",title:"刷新","aria-label":"刷新 Git 状态",onClick:u},[K(me,{name:"refresh",size:14})])]),et(h("div",XE,[e.gitStatus?(g(),v(X,{key:0},[c.value.length?(g(),v("ul",JE,[(g(!0),v(X,null,Me(c.value,b=>(g(),v("li",{key:b.path},[h("button",{class:"git-file",title:`查看 ${b.displayPath??b.path} 的 diff`,onClick:k=>s("diff",{path:b.path,display:b.displayPath??b.path,adds:b.adds,dels:b.dels})},[h("span",{class:fe(["git-file-status",r[b.status]??""])},C(o[b.status]??b.status),3),h("span",eA,[D(Sr)(b.displayPath??b.path).dir?(g(),v("span",tA,C(D(Sr)(b.displayPath??b.path).dir),1)):N("",!0),h("span",nA,C(D(Sr)(b.displayPath??b.path).base),1)]),b.adds!==void 0||b.dels!==void 0?(g(),v("span",sA,[b.adds?(g(),v("span",oA,"+"+C(b.adds),1)):N("",!0),b.dels?(g(),v("span",rA,"−"+C(b.dels),1)):N("",!0)])):N("",!0)],8,QE)]))),128))])):N("",!0),d.value?(g(),v("button",{key:1,class:"git-more",onClick:m[0]||(m[0]=b=>i.value=!i.value)},C(i.value?"收起列表":`显示全部 ${((y=e.gitStatus.files)==null?void 0:y.length)??0} 个文件`),1)):N("",!0),e.gitStatus.diffStat?(g(),v("pre",iA,C(e.gitStatus.diffStat),1)):c.value.length?N("",!0):(g(),v("div",aA,[K(me,{name:"check",size:18}),m[2]||(m[2]=h("span",null,"工作区干净,没有变更",-1))]))],64)):(g(),v("div",lA,"读取 Git 状态失败,点右上角刷新重试。"))],512),[[Nr,a.value]])],2)}}}),Bp=De(cA,[["__scopeId","data-v-39f0d843"]]),dA={class:"goal-panel panel-section"},fA={class:"section-heading"},hA={class:"head-icon"},pA=["title"],gA={key:0,class:"head-tail"},mA={class:"panel-body"},vA={key:0,class:"empty-state"},yA=["disabled"],bA={class:"refine-row"},kA=["disabled"],wA={key:0},SA=["disabled"],_A={class:"budget-grid"},$A=["disabled"],CA=["disabled"],xA={class:"time-budget"},TA=["disabled"],IA=["disabled"],EA=["disabled"],AA={key:0,class:"goal-summary"},MA={class:"objective"},RA={class:"criterion"},PA={key:0,class:"reason"},LA={class:"goal-metrics"},DA={class:"goal-metric"},OA={key:0,class:"bar"},NA={class:"goal-metric"},GA={key:0,class:"bar"},BA={class:"goal-metric"},FA={key:0,class:"bar"},jA={key:1,class:"budget-warning"},UA={key:2,class:"notes"},zA={class:"panel-actions"},HA=["disabled"],WA=["disabled"],qA=["disabled"],VA=["disabled"],KA=["disabled"],ZA={class:"budget-grid"},YA=["disabled"],XA=["disabled"],JA={class:"time-budget"},QA=["disabled"],eM=["disabled"],tM={class:"edit-actions"},nM=["disabled"],sM=["disabled"],oM={key:3,class:"form-error"},rM={key:4,class:"pending-copy"},iM=Le({__name:"GoalPanel",props:{goal:{},sessionId:{default:null},connectionStatus:{},busy:{type:Boolean,default:!1},archived:{type:Boolean,default:!1},pending:{type:Boolean,default:!1},error:{default:null},refineGoal:{},createGoal:{},updateGoal:{},pauseGoal:{},resumeGoal:{},cancelGoal:{}},setup(e){const t=e,n=M(""),s=M(""),o=M(""),r=M(""),i=M(""),a=M("minutes"),l=M(!1),u=M(null),c=M(!1),d=P(()=>t.connectionStatus==="connected"),f=P(()=>!t.sessionId||!d.value||t.archived||t.pending),p=P(()=>f.value),m=P(()=>{var x;return{active:"进行中",paused:"已暂停",blocked:"受阻",complete:"已完成"}[((x=t.goal)==null?void 0:x.status)??"active"]}),y=P(()=>t.sessionId?t.archived?"归档会话为只读状态":d.value?t.pending?"正在提交请求…":t.goal?"状态由核心事件实时同步":"创建后 Agent 将自动开始执行":"连接恢复后可继续管理":"选择或新建会话后即可配置");xe(()=>t.sessionId,()=>{l.value=!1,b()}),xe(()=>{var x;return(x=t.goal)==null?void 0:x.goalId},(x,E)=>{l.value=!1,x!==E&&b()});function b(){n.value="",s.value="",o.value="",r.value="",i.value="",a.value="minutes",c.value=!1,u.value=null}function k(x,E){const z=x.trim();if(!z)return null;const oe=Number(z);if(!Number.isSafeInteger(oe)||oe<=0){u.value=`${E}必须是正整数。`;return}return oe}function w(){u.value=null;const x=k(o.value,"轮次预算");if(x===void 0)return null;const E=k(r.value,"Token 预算");if(E===void 0)return null;const z=k(i.value,"时间预算");if(z===void 0)return null;const oe=[];return x!==null&&oe.push({value:x,unit:"turns"}),E!==null&&oe.push({value:E,unit:"tokens"}),z!==null&&oe.push({value:z,unit:a.value}),oe}async function S(){const x=n.value.trim();if(!x){u.value="请先输入需要优化的目标描述。";return}u.value=null,c.value=!1;const E=await t.refineGoal(x);E!==null&&(n.value=E,c.value=!0)}async function I(){const x=n.value.trim();if(!x){u.value="目标内容不能为空。";return}const E=w();if(E===null)return;await t.createGoal({objective:x,completionCriterion:s.value.trim()||void 0,replace:!1,budgets:E})&&(c.value=!1)}function q(x){x===null?(i.value="",a.value="minutes"):x%36e5===0?(i.value=String(x/36e5),a.value="hours"):x%6e4===0?(i.value=String(x/6e4),a.value="minutes"):x%1e3===0?(i.value=String(x/1e3),a.value="seconds"):(i.value=String(x),a.value="milliseconds")}function B(){const x=t.goal;x&&(n.value=x.objective,o.value=x.budget.turnBudget===null?"":String(x.budget.turnBudget),r.value=x.budget.tokenBudget===null?"":String(x.budget.tokenBudget),q(x.budget.wallClockBudgetMs),u.value=null,l.value=!0)}function R(x,E){return E==="hours"?x*36e5:E==="minutes"?x*6e4:E==="seconds"?x*1e3:x}async function L(){const x=t.goal;if(!x)return;const E=n.value.trim();if(!E){u.value="目标内容不能为空。";return}const z=w();if(z===null)return;const oe=k(o.value,"轮次预算"),ke=k(r.value,"Token 预算"),Te=k(i.value,"时间预算");if(oe===void 0||ke===void 0||Te===void 0)return;if(x.budget.turnBudget!==null&&oe===null){u.value="当前协议不支持清除已有轮次预算,请填写新的正整数。";return}if(x.budget.tokenBudget!==null&&ke===null){u.value="当前协议不支持清除已有 Token 预算,请填写新的正整数。";return}if(x.budget.wallClockBudgetMs!==null&&Te===null){u.value="当前协议不支持清除已有时间预算,请填写新的正整数。";return}const ge=z.filter(Q=>Q.unit==="turns"?Q.value!==x.budget.turnBudget:Q.unit==="tokens"?Q.value!==x.budget.tokenBudget:R(Q.value,Q.unit)!==x.budget.wallClockBudgetMs),le=E===x.objective?void 0:E;if(le===void 0&&ge.length===0){u.value="目标与预算没有变化。";return}await t.updateGoal({objective:le,budgets:ge})&&(l.value=!1)}async function A(x){u.value=null,!(x==="cancel"&&!window.confirm("确定取消当前 Goal?当前 Goal 状态将被清除。"))&&(x==="pause"?await t.pauseGoal():x==="resume"?await t.resumeGoal():await t.cancelGoal())}function W(x){return x.toLocaleString("zh-CN")}function F(x){if(x<1e3)return`${x} 毫秒`;const E=Math.floor(x/1e3);if(E<60)return`${E} 秒`;const z=Math.floor(E/3600),oe=Math.floor(E%3600/60);return z>0?`${z} 小时 ${oe} 分钟`:`${oe} 分钟`}function O(x,E){return E===null||E<=0?0:Math.min(100,Math.round(x/E*100))}function ee(x){return new Date(x).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}return(x,E)=>(g(),v("section",dA,[h("div",fA,[h("span",hA,[K(me,{name:"target",size:14})]),E[15]||(E[15]=h("span",{class:"head-title"},"Goal 管理",-1)),h("span",{class:"head-hint",title:y.value},C(y.value),9,pA),e.goal?(g(),v("span",gA,[h("span",{class:fe(["status-pill",`is-${e.goal.status}`])},C(m.value),3)])):N("",!0)]),h("div",mA,[e.sessionId?e.goal?(g(),v(X,{key:2},[l.value?(g(),v("form",{key:1,class:"goal-form edit-form",onSubmit:st(L,["prevent"])},[h("label",null,[E[33]||(E[33]=h("span",null,"目标内容",-1)),et(h("textarea",{"onUpdate:modelValue":E[9]||(E[9]=z=>n.value=z),rows:"3",maxlength:"4000",disabled:f.value||e.busy},null,8,KA),[[ut,n.value]])]),E[38]||(E[38]=h("div",{class:"budget-title"},[Pe("更新预算 "),h("small",null,"仅提交发生变化的预算")],-1)),h("div",ZA,[h("label",null,[E[34]||(E[34]=h("span",null,"轮次",-1)),et(h("input",{"onUpdate:modelValue":E[10]||(E[10]=z=>o.value=z),type:"number",min:"1",step:"1",placeholder:"不限",disabled:f.value||e.busy},null,8,YA),[[ut,o.value]])]),h("label",null,[E[35]||(E[35]=h("span",null,"Token",-1)),et(h("input",{"onUpdate:modelValue":E[11]||(E[11]=z=>r.value=z),type:"number",min:"1",step:"1",placeholder:"不限",disabled:f.value||e.busy},null,8,XA),[[ut,r.value]])])]),h("div",JA,[h("label",null,[E[36]||(E[36]=h("span",null,"时间",-1)),et(h("input",{"onUpdate:modelValue":E[12]||(E[12]=z=>i.value=z),type:"number",min:"1",step:"1",placeholder:"不限",disabled:f.value||e.busy},null,8,QA),[[ut,i.value]])]),et(h("select",{"onUpdate:modelValue":E[13]||(E[13]=z=>a.value=z),"aria-label":"时间预算单位",disabled:f.value||e.busy},[...E[37]||(E[37]=[h("option",{value:"minutes"},"分钟",-1),h("option",{value:"hours"},"小时",-1),h("option",{value:"seconds"},"秒",-1),h("option",{value:"milliseconds"},"毫秒",-1)])],8,eM),[[Qu,a.value]])]),h("div",tM,[h("button",{type:"button",class:"secondary",disabled:e.pending,onClick:E[14]||(E[14]=z=>l.value=!1)},"返回",8,nM),h("button",{class:"primary small",type:"submit",disabled:f.value||e.busy},"保存修改",8,sM)])],32)):(g(),v("div",AA,[h("div",MA,[E[26]||(E[26]=h("small",null,"目标",-1)),h("p",null,C(e.goal.objective),1)]),h("div",RA,[E[27]||(E[27]=h("small",null,"完成标准",-1)),h("p",null,C(e.goal.completionCriterion??"未设置,由 Agent 根据目标判断完成。"),1)]),e.goal.terminalReason?(g(),v("div",PA,[E[28]||(E[28]=h("strong",null,"状态原因",-1)),h("span",null,C(e.goal.terminalReason),1)])):N("",!0),h("dl",LA,[h("div",DA,[E[29]||(E[29]=h("dt",null,"轮次",-1)),h("dd",null,C(e.goal.turnsUsed)+" / "+C(e.goal.budget.turnBudget??"不限"),1),e.goal.budget.turnBudget!==null?(g(),v("i",OA,[h("i",{style:yt({width:`${O(e.goal.turnsUsed,e.goal.budget.turnBudget)}%`})},null,4)])):N("",!0)]),h("div",NA,[E[30]||(E[30]=h("dt",null,"Token",-1)),h("dd",null,C(W(e.goal.tokensUsed))+" / "+C(e.goal.budget.tokenBudget===null?"不限":W(e.goal.budget.tokenBudget)),1),e.goal.budget.tokenBudget!==null?(g(),v("i",GA,[h("i",{style:yt({width:`${O(e.goal.tokensUsed,e.goal.budget.tokenBudget)}%`})},null,4)])):N("",!0)]),h("div",BA,[E[31]||(E[31]=h("dt",null,"时间",-1)),h("dd",null,C(F(e.goal.wallClockMs))+" / "+C(e.goal.budget.wallClockBudgetMs===null?"不限":F(e.goal.budget.wallClockBudgetMs)),1),e.goal.budget.wallClockBudgetMs!==null?(g(),v("i",FA,[h("i",{style:yt({width:`${O(e.goal.wallClockMs,e.goal.budget.wallClockBudgetMs)}%`})},null,4)])):N("",!0)])]),e.goal.budget.overBudget?(g(),v("div",jA,"已达到或超过执行预算。")):N("",!0),e.goal.notes.length?(g(),v("details",UA,[h("summary",null,"工作记录("+C(e.goal.notes.length)+")",1),h("ol",null,[(g(!0),v(X,null,Me(e.goal.notes,z=>(g(),v("li",{key:`${z.time}-${z.content}`},[h("time",null,C(ee(z.time)),1),h("span",null,C(z.content),1)]))),128))])])):N("",!0),h("div",zA,[e.goal.status!=="complete"?(g(),v("button",{key:0,class:"secondary",disabled:f.value||e.busy,onClick:B},[K(me,{name:"edit",size:14}),E[32]||(E[32]=Pe("编辑",-1))],8,HA)):N("",!0),e.goal.status==="active"?(g(),v("button",{key:1,class:"secondary",disabled:f.value,onClick:E[6]||(E[6]=z=>A("pause"))},"暂停",8,WA)):N("",!0),e.goal.status==="paused"||e.goal.status==="blocked"?(g(),v("button",{key:2,class:"primary small",disabled:f.value||e.busy,onClick:E[7]||(E[7]=z=>A("resume"))},"继续",8,qA)):N("",!0),h("button",{class:"danger",disabled:f.value,onClick:E[8]||(E[8]=z=>A("cancel"))},"取消 Goal",8,VA)])]))],64)):(g(),v("form",{key:1,class:"goal-form",onSubmit:st(I,["prevent"])},[h("label",null,[E[18]||(E[18]=h("span",null,"目标内容",-1)),et(h("textarea",{"onUpdate:modelValue":E[0]||(E[0]=z=>n.value=z),rows:"3",maxlength:"4000",placeholder:"描述希望 Agent 持续完成的目标",disabled:p.value},null,8,yA),[[ut,n.value]])]),h("div",bA,[h("button",{type:"button",class:"secondary",disabled:p.value||!n.value.trim(),onClick:S},[K(me,{name:"sparkles",size:15}),E[19]||(E[19]=Pe(" AI 优化 ",-1))],8,kA),c.value?(g(),v("small",wA,"已优化,请确认或继续编辑后再创建。")):N("",!0)]),h("label",null,[E[20]||(E[20]=h("span",null,[Pe("完成标准 "),h("small",null,"可选")],-1)),et(h("textarea",{"onUpdate:modelValue":E[1]||(E[1]=z=>s.value=z),rows:"2",placeholder:"例如:聚焦测试、类型检查与 Web 构建全部通过",disabled:p.value},null,8,SA),[[ut,s.value]])]),E[25]||(E[25]=h("div",{class:"budget-title"},[Pe("执行预算 "),h("small",null,"留空表示不限制")],-1)),h("div",_A,[h("label",null,[E[21]||(E[21]=h("span",null,"轮次",-1)),et(h("input",{"onUpdate:modelValue":E[2]||(E[2]=z=>o.value=z),type:"number",min:"1",step:"1",placeholder:"不限",disabled:p.value},null,8,$A),[[ut,o.value]])]),h("label",null,[E[22]||(E[22]=h("span",null,"Token",-1)),et(h("input",{"onUpdate:modelValue":E[3]||(E[3]=z=>r.value=z),type:"number",min:"1",step:"1",placeholder:"不限",disabled:p.value},null,8,CA),[[ut,r.value]])])]),h("div",xA,[h("label",null,[E[23]||(E[23]=h("span",null,"时间",-1)),et(h("input",{"onUpdate:modelValue":E[4]||(E[4]=z=>i.value=z),type:"number",min:"1",step:"1",placeholder:"不限",disabled:p.value},null,8,TA),[[ut,i.value]])]),et(h("select",{"onUpdate:modelValue":E[5]||(E[5]=z=>a.value=z),"aria-label":"时间预算单位",disabled:p.value},[...E[24]||(E[24]=[h("option",{value:"minutes"},"分钟",-1),h("option",{value:"hours"},"小时",-1),h("option",{value:"seconds"},"秒",-1),h("option",{value:"milliseconds"},"毫秒",-1)])],8,IA),[[Qu,a.value]])]),h("button",{class:"primary",type:"submit",disabled:p.value||!n.value.trim()},C(e.pending?"正在创建…":"创建并开始执行"),9,EA)],32)):(g(),v("div",vA,[K(me,{name:"target",size:18}),E[16]||(E[16]=h("span",null,"暂无会话",-1)),E[17]||(E[17]=h("small",null,"选择或新建会话后即可配置目标。",-1))])),u.value||e.error?(g(),v("p",oM,C(u.value??e.error),1)):e.pending?(g(),v("p",rM,"请求处理中,状态将在核心事件到达后同步。")):N("",!0)])]))}}),Fp=De(iM,[["__scopeId","data-v-cf530861"]]),aM={class:"nsm-body"},lM={class:"nsm-section"},uM=["placeholder"],cM={key:0,class:"nsm-error"},dM={key:1,class:"nsm-recents"},fM=["title","onClick"],hM={class:"nsm-section"},pM={class:"nsm-models",role:"radiogroup","aria-label":"选择模型"},gM=["aria-checked"],mM=["aria-checked","onClick"],vM={class:"nsm-model-name"},yM={class:"nsm-model-alias"},bM=Le({__name:"NewSessionModal",props:{open:{type:Boolean},models:{},recentWorkDirs:{},defaultDir:{},currentModel:{}},emits:["close","confirm"],setup(e,{emit:t}){const n=e,s=t,o=M(n.defaultDir),r=M(n.currentModel||null);xe(()=>n.open,c=>{c&&(o.value=n.defaultDir,r.value=n.currentModel||null)},{immediate:!0});const i=P(()=>{const c=o.value.trim();return c?c.startsWith("/"):!0}),a=P(()=>o.value.trim()&&!i.value?"请输入绝对路径(如 /home/user/projects)":"");function l(c){o.value=c}function u(){const c=o.value.trim();s("confirm",{workDir:c||null,model:r.value})}return(c,d)=>(g(),Fe(Gl,{open:e.open,title:"新建会话","max-width":"480px",onClose:d[3]||(d[3]=f=>s("close"))},{footer:it(()=>[K(Wt,{variant:"ghost",onClick:d[2]||(d[2]=f=>s("close"))},{default:it(()=>[...d[7]||(d[7]=[Pe("取消",-1)])]),_:1}),K(Wt,{variant:"primary",disabled:!i.value,onClick:u},{default:it(()=>[...d[8]||(d[8]=[Pe("进入新会话",-1)])]),_:1},8,["disabled"])]),default:it(()=>[h("div",aM,[h("section",lM,[d[4]||(d[4]=h("div",{class:"nsm-label"},"工作区",-1)),et(h("input",{"onUpdate:modelValue":d[0]||(d[0]=f=>o.value=f),class:fe(["nsm-input",{"is-invalid":!!a.value}]),type:"text",spellcheck:"false",placeholder:e.defaultDir||"服务器默认工作区"},null,10,uM),[[ut,o.value]]),a.value?(g(),v("div",cM,C(a.value),1)):N("",!0),e.recentWorkDirs.length?(g(),v("div",dM,[(g(!0),v(X,null,Me(e.recentWorkDirs,f=>(g(),v("button",{key:f,type:"button",class:fe(["nsm-recent",{"is-active":o.value===f}]),title:f,onClick:p=>l(f)},C(f.split("/").filter(Boolean).pop()||f),11,fM))),128))])):N("",!0)]),h("section",hM,[d[6]||(d[6]=h("div",{class:"nsm-label"},"模型",-1)),h("div",pM,[h("button",{type:"button",class:fe(["nsm-model",{"is-active":r.value===null}]),role:"radio","aria-checked":r.value===null,onClick:d[1]||(d[1]=f=>r.value=null)},[...d[5]||(d[5]=[h("span",{class:"nsm-model-name"},"跟随服务器默认",-1)])],10,gM),(g(!0),v(X,null,Me(e.models,f=>(g(),v("button",{key:f.alias,type:"button",class:fe(["nsm-model",{"is-active":r.value===f.alias}]),role:"radio","aria-checked":r.value===f.alias,onClick:p=>r.value=f.alias},[h("span",vM,C(f.displayName||f.model),1),h("span",yM,C(f.provider)+"/"+C(f.model),1)],10,mM))),128))])])])]),_:1},8,["open"]))}}),kM=De(bM,[["__scopeId","data-v-7bb09c54"]]),wM={class:"panel-section like-section"},SM={class:"section-heading"},_M={class:"head-icon"},$M={class:"panel-body"},CM={class:"kv-rows"},xM={class:"dialog"},TM=["onUpdate:modelValue","placeholder"],IM={key:0,class:"dialog-error"},EM={class:"dialog-actions"},AM=["disabled"],MM=Le({__name:"LikePanel",props:{like:{},updateLike:{type:Function}},setup(e){const t=e,n=M(!1),s=M(!1),o=M(""),r=M({}),i=[{key:"nickname",label:"昵称",placeholder:"用户称呼,如:老板"},{key:"tone",label:"语气",placeholder:"AI 风格,如:专业不拖沓"},{key:"other",label:"偏好",placeholder:"其他用户偏好"},{key:"doNot",label:"禁止",placeholder:"用户明确不让做的事"}];function a(){r.value={...t.like},o.value="",n.value=!0}async function l(){s.value=!0,o.value="";const u=await t.updateLike(r.value);s.value=!1,u?n.value=!1:o.value="保存失败"}return(u,c)=>(g(),v("section",wM,[h("div",SM,[h("span",_M,[K(me,{name:"settings",size:14})]),c[2]||(c[2]=h("span",{class:"head-title"},"偏好设置",-1)),c[3]||(c[3]=h("span",{class:"head-hint"},"/like 用户偏好",-1))]),h("div",$M,[h("dl",CM,[(g(),v(X,null,Me(i,d=>h("div",{key:d.key,class:"kv-row"},[h("dt",null,C(d.label),1),h("dd",null,C((e.like[d.key]??"").trim()||"未设置"),1)])),64))]),h("div",{class:"panel-actions"},[h("button",{class:"like-edit",onClick:a},"编辑偏好")])]),n.value?(g(),v("div",{key:0,class:"dialog-overlay",onClick:c[1]||(c[1]=st(d=>n.value=!1,["self"]))},[h("div",xM,[c[4]||(c[4]=h("div",{class:"dialog-title"},"编辑用户偏好",-1)),(g(),v(X,null,Me(i,d=>h("label",{key:d.key,class:"dialog-field"},[h("span",null,C(d.label),1),et(h("input",{"onUpdate:modelValue":f=>r.value[d.key]=f,placeholder:d.placeholder},null,8,TM),[[ut,r.value[d.key]]])])),64)),o.value?(g(),v("div",IM,C(o.value),1)):N("",!0),h("div",EM,[h("button",{onClick:c[0]||(c[0]=d=>n.value=!1)},"取消"),h("button",{disabled:s.value,onClick:l},C(s.value?"保存中…":"确认"),9,AM)])])])):N("",!0)]))}}),jp=De(MM,[["__scopeId","data-v-2eac026c"]]),RM=["aria-expanded"],PM={class:"head-icon"},LM={class:"head-hint"},DM={class:"head-tail"},OM=["title"],NM={class:"panel-body"},GM={class:"stat-grid"},BM={class:"stat"},FM={class:"stat"},jM=["title"],UM={key:1,class:"faint"},zM={class:"stat wide"},HM={class:"mono"},wd="scream-panel-runstatus-open",WM=Le({__name:"RunStatusPanel",props:{status:{},busy:{type:Boolean,default:!1},connectionStatus:{}},setup(e){const t=e,n=M(!0);try{n.value=localStorage.getItem(wd)!=="0"}catch{}function s(){n.value=!n.value;try{localStorage.setItem(wd,n.value?"1":"0")}catch{}}const o=P(()=>{const a=t.status.contextUsage;return a===void 0?null:Math.round((a>1?a/100:a)*100)}),r=P(()=>{var a,l;return`Tokens: ${((a=t.status.contextTokens)==null?void 0:a.toLocaleString())??"-"} / ${((l=t.status.maxContextTokens)==null?void 0:l.toLocaleString())??"-"}`}),i=P(()=>({connected:"已连接",connecting:"连接中",reconnecting:"重连中",disconnected:"已断开",idle:"空闲"})[t.connectionStatus]??"空闲");return xe(()=>t.busy,()=>{t.busy&&!n.value&&(n.value=!0)}),(a,l)=>{var u,c;return g(),v("section",{class:fe(["panel-section","run-status",{"is-open":n.value}])},[h("button",{class:"panel-head","aria-expanded":n.value,onClick:s},[h("span",PM,[K(me,{name:"activity",size:14})]),l[0]||(l[0]=h("span",{class:"head-title"},"运行状态",-1)),h("span",LM,C(e.busy?"正在处理会话":"已就绪,等待任务"),1),h("span",DM,[h("span",{class:fe(["head-dot",{busy:e.busy}]),title:e.busy?"Agent 正在处理":"空闲"},null,10,OM),K(me,{class:fe(["chevron",{rotated:n.value}]),name:"chevron-down",size:14},null,8,["class"])])],8,RM),et(h("div",NM,[h("dl",GM,[h("div",BM,[l[1]||(l[1]=h("dt",null,"连接",-1)),h("dd",null,[h("span",{class:fe(["conn-dot",e.connectionStatus]),"aria-hidden":"true"},null,2),h("span",{class:fe(["conn",e.connectionStatus])},C(i.value),3)])]),h("div",FM,[l[2]||(l[2]=h("dt",null,"上下文占用",-1)),o.value!==null?(g(),v("dd",{key:0,title:r.value},[K(fh,{usage:e.status.contextUsage,size:14},null,8,["usage"]),Pe(C(o.value)+"% ",1)],8,jM)):(g(),v("dd",UM,"未知"))]),h("div",zM,[l[3]||(l[3]=h("dt",null,"Token(输入 / 上限)",-1)),h("dd",HM,C(((u=e.status.contextTokens)==null?void 0:u.toLocaleString())??"-")+" / "+C(((c=e.status.maxContextTokens)==null?void 0:c.toLocaleString())??"-"),1)])])],512),[[Nr,n.value]])],2)}}}),Up=De(WM,[["__scopeId","data-v-59b0c4e7"]]),qM={class:"todo-panel panel-section"},VM={class:"section-heading"},KM={class:"head-icon"},ZM={class:"head-hint"},YM={class:"head-tail"},XM={class:"head-count"},JM={key:0,class:"panel-body"},QM={class:"empty-state"},eR={key:1,class:"panel-body"},tR={class:"progress-row"},nR={class:"bar","aria-hidden":"true"},sR={class:"progress-value"},oR=["title"],rR={class:"todo-title"},iR=Le({__name:"TodoPanel",props:{todos:{}},setup(e){const t=e,n=P(()=>Qv(t.todos)),s=P(()=>t.todos.filter(u=>u.status==="done").length),o=P(()=>t.todos.filter(u=>u.status==="in_progress").length),r=P(()=>t.todos.filter(u=>u.status==="pending").length),i=P(()=>t.todos.length?Math.round(s.value/t.todos.length*100):0),a=P(()=>{if(!t.todos.length)return"直接来自 Agent 核心状态";if(s.value===t.todos.length)return"全部完成";const u=[];return o.value&&u.push(`进行中 ${o.value}`),r.value&&u.push(`待处理 ${r.value}`),u.join(" · ")||"直接来自 Agent 核心状态"}),l={pending:{label:"待处理",symbol:"○"},in_progress:{label:"进行中",symbol:"●"},done:{label:"已完成",symbol:"✓"}};return(u,c)=>(g(),v("section",qM,[h("div",VM,[h("span",KM,[K(me,{name:"clipboard",size:14})]),c[0]||(c[0]=h("span",{class:"head-title"},"核心 Todo",-1)),h("span",ZM,C(a.value),1),h("span",YM,[h("span",XM,C(s.value)+"/"+C(e.todos.length),1)])]),e.todos.length===0?(g(),v("div",JM,[h("div",QM,[K(me,{name:"check",size:18}),c[1]||(c[1]=h("span",null,"暂无 Todo",-1)),c[2]||(c[2]=h("small",null,"Agent 创建任务清单后会在这里实时显示。",-1))])])):(g(),v("div",eR,[h("div",tR,[h("i",nR,[h("i",{style:yt({width:`${i.value}%`})},null,4)]),h("span",sR,C(i.value)+"%",1)]),(g(!0),v(X,null,Me(n.value,(d,f)=>(g(),v("section",{key:d.phase??`unphased-${f}`,class:"todo-group"},[h("h4",null,C(d.phase??"未分阶段"),1),h("ol",null,[(g(!0),v(X,null,Me(d.items,(p,m)=>(g(),v("li",{key:`${f}-${m}-${p.title}`,class:fe(`is-${p.status}`)},[h("span",{class:"status-symbol",title:l[p.status].label},C(l[p.status].symbol),9,oR),h("span",rR,C(p.title),1),h("small",null,C(l[p.status].label),1)],2))),128))])]))),128))]))]))}}),zp=De(iR,[["__scopeId","data-v-6a025f22"]]),aR={class:"detail-view"},lR={class:"git-diff-head"},uR=["title"],cR={class:"git-diff-tools"},dR={key:0,class:"git-diff-stat"},fR={key:0,class:"add"},hR={key:1,class:"del"},pR={key:0,class:"git-diff-body"},gR={key:1,class:"git-diff-empty"},mR=Le({__name:"SessionDetailView",props:{client:{}},setup(e){const t=e,n=M(null),s=M(null);async function o(B){var L,A,W;n.value={...B,lines:[],loading:!0};try{const O=await(await fetch(`/api/v1/git/diff?path=${encodeURIComponent(B.path)}`)).json(),ee=Np(O.patch??""),x=B.adds??(B.dels===void 0?ee.filter(E=>E.type==="add").length:void 0);n.value={...B,adds:x,lines:ee,loading:!1}}catch{n.value={...B,lines:[],loading:!1}}await Ve();const R=((A=(L=globalThis.window)==null?void 0:L.matchMedia)==null?void 0:A.call(L,"(prefers-reduced-motion: reduce)").matches)===!0;(W=s.value)==null||W.scrollIntoView({block:"start",behavior:R?"auto":"smooth"})}const{connectionStatus:r,status:i,sessionId:a,isBusy:l,isArchived:u,goal:c,todos:d,goalRequestPending:f,goalRequestError:p,like:m,gitStatus:y,refineGoal:b,createGoal:k,updateGoal:w,pauseGoal:S,resumeGoal:I,cancelGoal:q}=t.client;return(B,R)=>(g(),v("div",aR,[K(Up,{status:D(i),busy:D(l),"connection-status":D(r)},null,8,["status","busy","connection-status"]),K(Bp,{"git-status":D(y),onRefresh:R[0]||(R[0]=L=>t.client.fetchGitStatus()),onDiff:o},null,8,["git-status"]),n.value?(g(),v("div",{key:0,ref_key:"diffRef",ref:s,class:"git-diff-view"},[h("div",lR,[h("span",{class:"git-diff-title",title:n.value.path},C(n.value.loading?"加载中…":n.value.display),9,uR),h("span",cR,[!n.value.loading&&(n.value.adds||n.value.dels)?(g(),v("span",dR,[n.value.adds?(g(),v("span",fR,"+"+C(n.value.adds),1)):N("",!0),n.value.dels?(g(),v("span",hR,"−"+C(n.value.dels),1)):N("",!0)])):N("",!0),h("button",{class:"git-diff-close",title:"关闭 diff","aria-label":"关闭 diff",onClick:R[1]||(R[1]=L=>n.value=null)},"✕")])]),n.value.lines.length?(g(),v("div",pR,[K(fu,{lines:n.value.lines},null,8,["lines"])])):n.value.loading?N("",!0):(g(),v("p",gR,"该文件无差异内容(可能是二进制文件或已被忽略)。"))],512)):N("",!0),K(zp,{todos:D(d)},null,8,["todos"]),K(jp,{like:D(m),"update-like":t.client.updateLike},null,8,["like","update-like"]),K(Fp,{goal:D(c),"session-id":D(a),"connection-status":D(r),busy:D(l),archived:D(u),pending:D(f),error:D(p),"refine-goal":D(b),"create-goal":D(k),"update-goal":D(w),"pause-goal":D(S),"resume-goal":D(I),"cancel-goal":D(q)},null,8,["goal","session-id","connection-status","busy","archived","pending","error","refine-goal","create-goal","update-goal","pause-goal","resume-goal","cancel-goal"])]))}}),vR=De(mR,[["__scopeId","data-v-caaa7a7a"]]),yR={class:"settings"},bR={class:"settings-layout"},kR={class:"rail","aria-label":"设置分区"},wR=["aria-current","onClick"],SR={class:"pane"},_R={key:0,class:"pane-section"},$R={class:"block"},CR={class:"theme-grid",role:"radiogroup","aria-label":"主题"},xR=["aria-checked","onClick"],TR={class:"block"},IR={class:"like-fields"},ER={class:"like-label"},AR=["onUpdate:modelValue","placeholder","aria-label"],MR={class:"like-actions"},RR={key:0,class:"saved-hint"},PR={key:1,class:"pane-section"},LR={key:0,class:"notice-bar"},DR={key:1,class:"error-row",role:"alert"},OR={class:"error-text"},NR={key:2,class:"empty"},GR={key:3,class:"list"},BR={class:"row-main"},FR={class:"row-title"},jR={class:"row-sub"},UR=["disabled","onClick"],zR={key:2,class:"pane-section"},HR={key:0,class:"empty"},WR={key:1,class:"list"},qR={class:"row-main"},VR={class:"row-title"},KR={class:"row-sub"},ZR={class:"row-actions"},YR=["disabled","onClick"],XR=["disabled","onClick"],JR={key:3,class:"pane-section"},QR={class:"block"},e2={class:"inline-form"},t2={key:0,class:"hint"},n2={key:0,class:"empty"},s2={key:1,class:"list"},o2={class:"row-main"},r2={class:"row-title"},i2={key:0,class:"version"},a2={class:"row-sub"},l2=["disabled","onClick"],u2={key:4,class:"pane-section"},c2={key:0,class:"hint"},d2={key:1,class:"empty"},f2={key:2,class:"list"},h2={class:"row-main"},p2={class:"row-title"},g2={class:"row-sub"},m2={class:"row-actions"},v2=["disabled","onClick"],y2=["disabled","onClick"],b2=["disabled","onClick"],k2={key:5,class:"pane-section"},w2={key:0,class:"hint"},S2={key:1,class:"empty"},_2={key:2,class:"list"},$2={class:"row-main"},C2={class:"row-title"},x2={class:"row-sub"},T2={class:"row-actions"},I2=["disabled","onClick"],E2=["disabled","onClick"],A2=Le({__name:"SettingsView",props:{like:{default:()=>({})},client:{}},emits:["update-like"],setup(e,{emit:t}){const n=e,s=t;function o(J){return J!==null&&typeof J=="object"&&J.__v_isRef===!0?J.value:J}const r=[{id:"general",label:"通用",icon:"settings"},{id:"models",label:"模型",icon:"bot"},{id:"skills",label:"技能",icon:"sparkles"},{id:"plugins",label:"插件",icon:"layers"},{id:"mcp",label:"MCP 服务器",icon:"monitor"},{id:"tasks",label:"后台任务",icon:"activity"}],i=M("general"),a=P(()=>n.client),l=In("theme",M("system")),u=In("setTheme",()=>{}),c=[{id:"light",label:"浅色",icon:"sun"},{id:"dark",label:"深色",icon:"moon"},{id:"system",label:"跟随系统",icon:"monitor"}],d=M({...n.like}),f=M(!1);xe(()=>n.like,J=>{d.value={...J}});const p=[{key:"nickname",label:"称呼",hint:"AI 如何称呼你"},{key:"tone",label:"语气",hint:"回复的语气风格"},{key:"other",label:"偏好",hint:"其他偏好说明"},{key:"doNot",label:"禁止事项",hint:"明确禁止的行为"}];function m(){s("update-like",y()),f.value=!0,setTimeout(()=>f.value=!1,1500)}function y(){const J={};for(const de of p){const Z=d.value[de.key];typeof Z=="string"&&Z.trim()&&(J[de.key]=Z.trim())}return J}const b=P(()=>{var J;return o((J=a.value)==null?void 0:J.models)??[]}),k=P(()=>{var J,de;return((de=o((J=a.value)==null?void 0:J.status))==null?void 0:de.model)??""}),w=P(()=>{var J;return o((J=a.value)==null?void 0:J.modelsError)??""}),S=P(()=>{var J;return!!o((J=a.value)==null?void 0:J.currentSessionId)});function I(){var J,de;(de=(J=a.value)==null?void 0:J.fetchModels)==null||de.call(J)}function q(J){var de,Z;(Z=(de=a.value)==null?void 0:de.switchModel)==null||Z.call(de,J)}const B=P(()=>{var J;return o((J=a.value)==null?void 0:J.skills)??[]}),R=M(!1);async function L(J){var de,Z,Ie,_;R.value=!0;try{await((Z=(de=a.value)==null?void 0:de.activateSkill)==null?void 0:Z.call(de,J))&&await((_=(Ie=a.value)==null?void 0:Ie.fetchSkills)==null?void 0:_.call(Ie))}finally{R.value=!1}}async function A(J){var Z,Ie,_,$;if(!window.confirm(`移除技能「${J}」?`))return;await((Ie=(Z=a.value)==null?void 0:Z.removeSkill)==null?void 0:Ie.call(Z,J))&&await(($=(_=a.value)==null?void 0:_.fetchSkills)==null?void 0:$.call(_))}const W=P(()=>{var J;return o((J=a.value)==null?void 0:J.plugins)??[]}),F=M(!1);async function O(J,de){var Z,Ie,_,$;F.value=!0;try{await((Ie=(Z=a.value)==null?void 0:Z.setPluginEnabled)==null?void 0:Ie.call(Z,J,de))&&await(($=(_=a.value)==null?void 0:_.fetchPlugins)==null?void 0:$.call(_))}finally{F.value=!1}}const ee=M(""),x=M(!1),E=M("");async function z(){var de,Z;const J=ee.value.trim();if(J){x.value=!0,E.value="";try{const Ie=await((Z=(de=a.value)==null?void 0:de.installPlugin)==null?void 0:Z.call(de,J));E.value=Ie?`已安装 ${Ie.displayName}`:"安装失败",Ie&&(ee.value="")}finally{x.value=!1}}}const oe=P(()=>{var J;return o((J=a.value)==null?void 0:J.mcpServers)??[]}),ke=M(!1),Te=M("");async function ge(J,de){var Z,Ie,_,$;ke.value=!0,Te.value="";try{const U=await((Ie=(Z=a.value)==null?void 0:Z[J])==null?void 0:Ie.call(Z,de));Te.value=U?"操作成功":"操作失败",await(($=(_=a.value)==null?void 0:_.fetchMcpServers)==null?void 0:$.call(_))}finally{ke.value=!1}}const le=P(()=>{var J;return o((J=a.value)==null?void 0:J.backgroundTasks)??[]}),ve=M(""),Q=M(!1),ye=M("");async function Ee(J){var de,Z,Ie,_;Q.value=!0,ye.value="";try{const $=await((Z=(de=a.value)==null?void 0:de.stopBackgroundTask)==null?void 0:Z.call(de,J));ye.value=$?"已停止":"取消失败",await((_=(Ie=a.value)==null?void 0:Ie.fetchBackgroundTasks)==null?void 0:_.call(Ie))}finally{Q.value=!1}}async function Ue(J){var de,Z,Ie;Q.value=!0,ye.value="";try{await((Z=(de=a.value)==null?void 0:de.fetchBackgroundTaskOutput)==null?void 0:Z.call(de,J,200)),ve.value=o((Ie=a.value)==null?void 0:Ie.backgroundTaskOutput)??""}finally{Q.value=!1}}rt(()=>{var de,Z,Ie,_,$,U;const J=a.value;(de=J==null?void 0:J.fetchModels)==null||de.call(J),(Z=J==null?void 0:J.fetchConfig)==null||Z.call(J),(Ie=J==null?void 0:J.fetchSkills)==null||Ie.call(J),(_=J==null?void 0:J.fetchPlugins)==null||_.call(J),($=J==null?void 0:J.fetchMcpServers)==null||$.call(J),(U=J==null?void 0:J.fetchBackgroundTasks)==null||U.call(J)});function Ke(J){return J==="connected"||J==="completed"?"ok":J==="failed"||J==="killed"?"bad":J==="running"||J==="pending"?"run":"muted"}return(J,de)=>(g(),v("div",yR,[h("div",bR,[h("nav",kR,[(g(),v(X,null,Me(r,Z=>h("button",{key:Z.id,class:fe(["rail-tab",{active:i.value===Z.id}]),"aria-current":i.value===Z.id?"page":void 0,onClick:Ie=>i.value=Z.id},[K(me,{name:Z.icon,size:16},null,8,["name"]),h("span",null,C(Z.label),1)],10,wR)),64))]),h("div",SR,[i.value==="general"?(g(),v("section",_R,[de[4]||(de[4]=h("h1",{class:"settings-title"},"通用设置",-1)),h("div",$R,[de[1]||(de[1]=h("h2",{class:"block-title"},"外观",-1)),h("div",CR,[(g(),v(X,null,Me(c,Z=>h("button",{key:Z.id,role:"radio","aria-checked":D(l)===Z.id,class:fe(["theme-option",{active:D(l)===Z.id}]),onClick:Ie=>D(u)(Z.id)},[K(me,{name:Z.icon,size:20},null,8,["name"]),h("span",null,C(Z.label),1)],10,xR)),64))])]),h("div",TR,[de[3]||(de[3]=h("h2",{class:"block-title"},"偏好设置",-1)),h("div",IR,[(g(),v(X,null,Me(p,Z=>h("label",{key:Z.key,class:"like-field"},[h("span",ER,C(Z.label),1),et(h("input",{"onUpdate:modelValue":Ie=>d.value[Z.key]=Ie,class:"like-input",placeholder:Z.hint,"aria-label":Z.label},null,8,AR),[[ut,d.value[Z.key]]])])),64)),h("div",MR,[K(Wt,{variant:"primary",onClick:m},{default:it(()=>[...de[2]||(de[2]=[Pe("保存偏好",-1)])]),_:1}),f.value?(g(),v("span",RR,"已保存")):N("",!0)])])])])):i.value==="models"?(g(),v("section",PR,[de[5]||(de[5]=h("h1",{class:"settings-title"},"模型",-1)),S.value?N("",!0):(g(),v("p",LR,"打开一个会话后可在此切换模型")),w.value?(g(),v("div",DR,[h("span",OR,C(w.value),1),h("button",{class:"row-action",onClick:I},"重试")])):b.value.length===0?(g(),v("p",NR,"没有可用的模型")):(g(),v("ul",GR,[(g(!0),v(X,null,Me(b.value,Z=>(g(),v("li",{key:Z.alias,class:fe(["list-row",{selected:Z.alias===k.value}])},[h("div",BR,[h("span",FR,C(Z.displayName||Z.model),1),h("span",jR,C(Z.provider)+" · "+C(Z.alias)+" · "+C(Z.maxContextSize),1)]),h("button",{class:"row-action",disabled:!S.value||Z.alias===k.value,onClick:Ie=>q(Z.alias)},C(Z.alias===k.value?"使用中":"切换"),9,UR)],2))),128))]))])):i.value==="skills"?(g(),v("section",zR,[de[6]||(de[6]=h("h1",{class:"settings-title"},"技能",-1)),B.value.length===0?(g(),v("p",HR,"当前会话没有可用技能")):(g(),v("ul",WR,[(g(!0),v(X,null,Me(B.value,Z=>(g(),v("li",{key:Z.name,class:"list-row"},[h("div",qR,[h("span",VR,C(Z.name),1),h("span",KR,[Pe(C(Z.description||"—")+" ",1),Z.pluginId?(g(),v(X,{key:0},[Pe("· 来自插件 "+C(Z.pluginId),1)],64)):N("",!0)])]),h("div",ZR,[h("button",{class:"row-action",disabled:R.value,onClick:Ie=>L(Z.name)}," 激活 ",8,YR),h("button",{class:"row-action danger",disabled:R.value,onClick:Ie=>A(Z.name)}," 移除 ",8,XR)])]))),128))]))])):i.value==="plugins"?(g(),v("section",JR,[de[9]||(de[9]=h("h1",{class:"settings-title"},"插件",-1)),h("div",QR,[de[8]||(de[8]=h("h2",{class:"block-title"},"安装插件",-1)),h("div",e2,[et(h("input",{"onUpdate:modelValue":de[0]||(de[0]=Z=>ee.value=Z),class:"like-input",placeholder:"本地路径 / zip URL / GitHub 地址","aria-label":"插件来源",spellcheck:"false"},null,512),[[ut,ee.value]]),K(Wt,{variant:"primary",disabled:x.value||!ee.value.trim(),onClick:z},{default:it(()=>[...de[7]||(de[7]=[Pe(" 安装 ",-1)])]),_:1},8,["disabled"])]),E.value?(g(),v("p",t2,C(E.value),1)):N("",!0)]),W.value.length===0?(g(),v("p",n2,"还没有安装插件")):(g(),v("ul",s2,[(g(!0),v(X,null,Me(W.value,Z=>(g(),v("li",{key:Z.id,class:"list-row"},[h("div",o2,[h("span",r2,[Pe(C(Z.displayName)+" ",1),Z.version?(g(),v("span",i2,"v"+C(Z.version),1)):N("",!0)]),h("span",a2,C(Z.skillCount)+" 技能 · "+C(Z.enabledMcpServerCount)+"/"+C(Z.mcpServerCount)+" MCP",1)]),h("button",{class:"row-action",disabled:F.value,onClick:Ie=>O(Z.id,!Z.enabled)},C(Z.enabled?"停用":"启用"),9,l2)]))),128))]))])):i.value==="mcp"?(g(),v("section",u2,[de[10]||(de[10]=h("h1",{class:"settings-title"},"MCP 服务器",-1)),Te.value?(g(),v("p",c2,C(Te.value),1)):N("",!0),oe.value.length===0?(g(),v("p",d2,"没有配置 MCP 服务器")):(g(),v("ul",f2,[(g(!0),v(X,null,Me(oe.value,Z=>(g(),v("li",{key:Z.name,class:"list-row"},[h("div",h2,[h("span",p2,C(Z.name),1),h("span",g2,C(Z.transport)+" · "+C(Z.toolCount)+" 工具",1),h("span",{class:fe(["status-pill",Ke(Z.status)])},C(Z.status),3)]),h("div",m2,[h("button",{class:"row-action",disabled:ke.value,onClick:Ie=>ge("reconnectMcpServer",Z.name)},"重连",8,v2),h("button",{class:"row-action",disabled:ke.value,onClick:Ie=>ge("stopMcpServer",Z.name)},"停止",8,y2),h("button",{class:"row-action danger",disabled:ke.value,onClick:Ie=>ge("removeMcpServer",Z.name)},"移除",8,b2)])]))),128))]))])):i.value==="tasks"?(g(),v("section",k2,[de[11]||(de[11]=h("h1",{class:"settings-title"},"后台任务",-1)),ye.value?(g(),v("p",w2,C(ye.value),1)):N("",!0),le.value.length===0?(g(),v("p",S2,"没有后台任务")):(g(),v("ul",_2,[(g(!0),v(X,null,Me(le.value,Z=>(g(),v("li",{key:Z.taskId,class:"list-row"},[h("div",$2,[h("span",C2,C(Z.command),1),h("span",x2,C(Z.description),1),h("span",{class:fe(["status-pill",Ke(Z.status)])},C(Z.status),3)]),h("div",T2,[h("button",{class:"row-action",disabled:Q.value,onClick:Ie=>Ue(Z.taskId)},"输出",8,I2),Z.status==="running"||Z.status==="awaiting_approval"?(g(),v("button",{key:0,class:"row-action danger",disabled:Q.value,onClick:Ie=>Ee(Z.taskId)}," 停止 ",8,E2)):N("",!0)])]))),128))]))])):N("",!0)])])]))}}),Hp=De(A2,[["__scopeId","data-v-2f2af5c8"]]),M2={class:"settings-modal-body"},R2=Le({__name:"SettingsModal",setup(e){const{open:t}=lh(),n=P(()=>Xf()),s=P(()=>{var r;return((r=n.value)==null?void 0:r.like.value)??{}});function o(r){var i;(i=n.value)==null||i.updateLike(r)}return rt(By),at(()=>{Fy(),Kr()}),(r,i)=>(g(),Fe(Gl,{open:D(t),title:"设置","max-width":"920px",onClose:D(Kr)},{default:it(()=>[h("div",M2,[n.value?(g(),Fe(Hp,{key:0,client:n.value,like:s.value,onUpdateLike:o},null,8,["client","like"])):N("",!0)])]),_:1},8,["open","onClose"]))}}),P2=De(R2,[["__scopeId","data-v-890b7003"]]),Sd=M(""),va=M(new Set),hr=M(new Set),L2=M("sessions"),ya=5;function D2(){function e(o){const r=new Set(va.value);r.has(o)?r.delete(o):r.add(o),va.value=r}function t(o){const r=new Set(hr.value);r.has(o)?r.delete(o):r.add(o),hr.value=r}function n(o){return hr.value.has(o)}function s(){Sd.value=""}return{query:Sd,collapsedSpaces:va,expandedSpaces:hr,section:L2,toggleSpace:e,toggleSpaceExpanded:t,isSpaceExpanded:n,clearSearch:s}}const O2=1440*60*1e3,N2=7,G2="昨天";function _d(e){const t=new Date(e);return Date.UTC(t.getFullYear(),t.getMonth(),t.getDate())/O2}function B2(e){const t=new Date(e),n=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0");return`${n}:${s}`}function F2(e,t=Date.now()){if(!Number.isFinite(e)||e<=0)return"";const n=_d(t)-_d(e);if(n<=0)return B2(e);if(n===1)return G2;if(n<=N2)return`${n} 天前`;const s=new Date(e);return`${s.getMonth()+1}/${s.getDate()}`}const Wp="scream-file-tree-expanded",j2=M("");function U2(){try{const e=localStorage.getItem(Wp);if(!e)return{};const t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t)){const n={};for(const[s,o]of Object.entries(t))Array.isArray(o)&&(n[s]=o.filter(r=>typeof r=="string"));return n}return{}}catch{return{}}}const ns=M(U2()),ho=Wn(new Map),ba=M(null),ka=new Map;function z2(){function e(l){return l?new Set(ns.value[l]??[]):new Set}function t(l){if(!l)return;const u={...ns.value};u[l]=[...e(l)],ns.value=u;try{localStorage.setItem(Wp,JSON.stringify(u))}catch{}}function n(l){ba.value!==l&&(ba.value=l)}function s(l,u){var c;return l?((c=ns.value[l])==null?void 0:c.includes(u))??!1:!1}function o(l,u){if(!l)return!1;const c=ns.value[l]??[],d=c.includes(u)?c.filter(f=>f!==u):[...c,u];return ns.value={...ns.value,[l]:d},t(l),!c.includes(u)}function r(l){return ho.get(l)??[]}async function i(l){const u=(ka.get(l)??0)+1;ka.set(l,u);const c=await Ol(l);return u!==(ka.get(l)??0)?ho.get(l)??[]:(c!==null&&ho.set(l,c),ho.get(l)??[])}function a(l){ho.delete(l)}return{activeWorkDir:ba,query:j2,isExpanded:s,toggleExpand:o,loadedChildren:r,loadChildren:i,invalidate:a,setRoot:n}}const H2={class:"file-tree"},W2={key:0,class:"tree-toolbar"},q2={class:"tree-search"},V2={key:1,class:"tree-empty"},K2={key:2,class:"tree-empty"},Z2={key:3,class:"tree-empty"},Y2={key:4,class:"tree-empty"},X2=["aria-label"],J2=["aria-expanded","onClick"],Q2=["title"],eP=["aria-expanded","onClick"],tP=["title"],nP=Le({__name:"FileTree",props:{workDir:{},gitStatus:{},refreshGit:{type:Function}},setup(e){const t=e,{query:n,isExpanded:s,toggleExpand:o,loadedChildren:r,loadChildren:i,invalidate:a,setRoot:l}=z2(),u=M(!1),c=M(!1);xe(()=>t.workDir,B=>{l(B),B&&d(B)},{immediate:!0});async function d(B){u.value=!0,c.value=!1;try{(await i(B)).length===0&&(c.value=!0)}finally{u.value=!1}}async function f(B){const R=t.workDir;if(!R)return;o(R,B)&&await i(B)}function p(B,R){return`${B.replace(/\/+$/,"")}/${R}`}function m(B){const R=t.workDir;if(!R)return B;const L=R.replace(/\/+$/,"");return B===L?"":B.startsWith(`${L}/`)?B.slice(L.length+1):B}function y(B){var W;const R=(W=t.gitStatus)==null?void 0:W.files;if(!R||R.length===0)return null;const L=m(B),A=R.find(F=>(F.displayPath??F.path)===L);return A?A.status.includes("?")?"?":A.status.includes("A")?"A":A.status.includes("M")?"M":null:null}const b=P(()=>{const B=t.workDir;if(!B)return[];const R=[],L=(A,W)=>{for(const F of r(A)){const O=p(A,F.name);R.push({abs:O,name:F.name,rel:m(O),isDir:F.type==="dir",depth:W,git:y(O)}),F.type==="dir"&&s(B,O)&&L(O,W+1)}};return L(B,0),R}),k=P(()=>b.value),w=P(()=>{const B=n.value.trim();if(!B)return[];const R=new Map(k.value.map(L=>[L.rel,L]));return ch(k.value.map(L=>({path:L.rel,isDir:L.isDir})),B,50).map(L=>R.get(L.path)).filter(L=>L!==void 0)}),S=P(()=>n.value.trim().length>0);function I(B){B.isDir?f(B.abs):vs(B.abs)}function q(){var R;const B=t.workDir;B&&(a(B),hb(B),d(B),(R=t.refreshGit)==null||R.call(t))}return(B,R)=>(g(),v("div",H2,[e.workDir?(g(),v("div",W2,[h("label",q2,[K(me,{name:"search",size:13}),et(h("input",{"onUpdate:modelValue":R[0]||(R[0]=L=>ht(n)?n.value=L:null),type:"text",placeholder:"过滤文件…","aria-label":"过滤文件",spellcheck:"false"},null,512),[[ut,D(n)]])]),h("button",{class:"tree-refresh",title:"刷新文件树与 Git 状态","aria-label":"刷新文件树与 Git 状态",onClick:q},[K(me,{name:"refresh",size:13})])])):N("",!0),e.workDir?u.value&&b.value.length===0?(g(),v("div",K2,"加载中…")):c.value&&b.value.length===0?(g(),v("div",Z2,"工作目录为空")):S.value&&w.value.length===0?(g(),v("div",Y2,"没有匹配的文件")):(g(),v("div",{key:5,class:"tree-scroll",role:"tree","aria-label":"文件树 "+e.workDir},[S.value?(g(!0),v(X,{key:0},Me(w.value,L=>(g(),v("button",{key:L.abs,class:fe(["tree-row",{"is-dir":L.isDir}]),role:"treeitem","aria-expanded":L.isDir?D(s)(e.workDir,L.abs):void 0,onClick:A=>I(L)},[K(me,{name:L.isDir?"folder":"file",size:14,class:"row-icon"},null,8,["name"]),h("span",{class:"row-label mono",title:L.rel},C(L.rel),9,Q2),L.git?(g(),v("span",{key:0,class:fe(["row-git",`g-${L.git}`])},C(L.git),3)):N("",!0)],10,J2))),128)):(g(!0),v(X,{key:1},Me(b.value,L=>(g(),v("button",{key:L.abs,class:fe(["tree-row",{"is-dir":L.isDir}]),style:yt({paddingLeft:`${8+L.depth*14}px`}),role:"treeitem","aria-expanded":L.isDir?D(s)(e.workDir,L.abs):void 0,onClick:A=>I(L)},[K(me,{name:L.isDir?D(s)(e.workDir,L.abs)?"chevron-down":"chevron-right":"file",size:13,class:"row-caret"},null,8,["name"]),K(me,{name:L.isDir?"folder":"file",size:14,class:"row-icon"},null,8,["name"]),h("span",{class:fe(["row-label",{mono:!L.isDir}]),title:L.rel},C(L.name),11,tP),L.git?(g(),v("span",{key:0,class:fe(["row-git",`g-${L.git}`])},C(L.git),3)):N("",!0)],14,eP))),128))],8,X2)):(g(),v("div",V2,"当前会话没有工作目录"))]))}}),sP=De(nP,[["__scopeId","data-v-eb901ba2"]]),qp=""+new URL("logo-v2-ChmPAIbI.svg",import.meta.url).href,oP={class:"sidebar-head"},rP=["src"],iP=["title","aria-label","aria-expanded"],aP=["title"],lP={key:0},uP={key:0,class:"section-switch",role:"tablist","aria-label":"侧栏分区"},cP=["aria-selected"],dP=["aria-selected"],fP={key:0,class:"side-search"},hP=["placeholder"],pP={class:"spaces"},gP=["title"],mP=["title","onClick"],vP={class:"space-name"},yP={class:"space-count"},bP={key:0,class:"space-sessions"},kP=["title","onClick","onDblclick"],wP={key:0,class:"session-run","aria-hidden":"true"},SP={class:"session-text"},_P={key:0,class:"session-rename"},$P=["aria-label","onKeydown","onBlur"],CP={class:"session-title"},xP={class:"session-meta"},TP={class:"session-actions"},IP=["disabled","title","aria-label","onClick"],EP=["title","aria-label","onClick"],AP=["aria-label"],MP={class:"delete-confirm-text"},RP={class:"delete-confirm-actions"},PP=["onClick"],LP=["title","onClick"],DP={key:0,class:"spaces-empty"},OP={class:"sidebar-foot","aria-label":"功能区"},NP=["title"],GP={key:0},BP=["title"],FP={key:0},jP={class:"sidebar-identity"},UP={key:0,class:"identity-text"},zP=Le({__name:"Sidebar",props:{view:{},sessions:{},currentSessionId:{default:null},workDir:{default:null},gitStatus:{default:null},refreshGit:{type:Function,default:void 0},collapsed:{type:Boolean,default:!1},showCollapseToggle:{type:Boolean,default:!0}},emits:["navigate","switch-session","delete-session","create-session","toggle-collapse","open-file","rename-session"],setup(e,{expose:t,emit:n}){const s=e,o=n,r=M(null),{query:i,collapsedSpaces:a,section:l,toggleSpace:u,toggleSpaceExpanded:c,isSpaceExpanded:d}=D2();function f(){var ge,le;(ge=r.value)==null||ge.focus(),(le=r.value)==null||le.select()}const{open:p}=lh();function m(){ah()||o("navigate","settings")}t({focusSearch:f});const y=P(()=>{const ge=i.value.trim().toLowerCase();return ge?s.sessions.filter(le=>Te(le).toLowerCase().includes(ge)||le.workDir.toLowerCase().includes(ge)):s.sessions}),b=P(()=>{var ve;const ge=new Map;for(const Q of y.value){const ye=Q.workDir||"默认空间",Ee=ye.split(/[\\/]/).filter(Boolean),Ue=Ee.length>0?Ee[Ee.length-1]:ye,Ke=ge.get(ye);Ke?Ke.items.push(Q):ge.set(ye,{key:ye,name:Ue,items:[Q]})}const le=(ve=s.sessions.find(Q=>Q.sessionId===s.currentSessionId))==null?void 0:ve.workDir;return[...ge.values()].sort((Q,ye)=>{var Ee,Ue;return Q.key===le?-1:ye.key===le?1:(((Ee=ye.items[0])==null?void 0:Ee.createdAt)??0)-(((Ue=Q.items[0])==null?void 0:Ue.createdAt)??0)})});function k(ge){return i.value.trim()||d(ge.key)?ge.items:ge.items.length>ya?ge.items.slice(0,ya):ge.items}function w(ge){return Math.max(0,ge.items.length-ya)}function S(ge){o("switch-session",ge)}function I(ge){return ge.sessionId===s.currentSessionId}const q=M(null);function B(ge){q.value=q.value===ge.sessionId?null:ge.sessionId}function R(){q.value=null}function L(ge){R(),o("delete-session",ge)}function A(ge){if(!q.value)return;const le=ge.target;le&&typeof le.closest=="function"&&le.closest(".session-actions")||R()}rt(()=>document.addEventListener("pointerdown",A)),at(()=>document.removeEventListener("pointerdown",A));function W(ge){o("open-file",ge)}const F=M(null);function O(ge){F.value=ge}const ee=M(null),x=M("");function E(ge){ee.value=ge.sessionId,x.value=Te(ge),Ve(()=>{var le,ve;(le=F.value)==null||le.focus(),(ve=F.value)==null||ve.select()})}function z(){ee.value=null,x.value=""}function oe(ge){const le=x.value.trim();if(ee.value=null,x.value="",!le)return;const ve=s.sessions.find(Q=>Q.sessionId===ge);!ve||le===Te(ve)||o("rename-session",ge,le)}function ke(ge){return F2(ge)}function Te(ge){const le=(ge.title||"").trim();return le&&le!=="新会话"&&le!=="New Session"?le:"未命名会话"}return(ge,le)=>(g(),v("aside",{class:fe(["sidebar",{"is-collapsed":e.collapsed}])},[h("div",oP,[h("button",{class:"sidebar-brand",title:"回到新对话",onClick:le[0]||(le[0]=ve=>o("navigate","home"))},[h("img",{class:"brand-logo",src:D(qp),alt:"scream"},null,8,rP)]),e.showCollapseToggle?(g(),v("button",{key:0,class:fe(["collapse-btn",{rotated:e.collapsed}]),title:e.collapsed?"展开侧栏":"折叠侧栏","aria-label":e.collapsed?"展开侧栏":"折叠侧栏","aria-expanded":!e.collapsed,onClick:le[1]||(le[1]=ve=>o("toggle-collapse"))},[K(me,{name:"panel-left",size:15})],10,iP)):N("",!0)]),h("button",{class:"new-chat-btn",title:e.collapsed?"新建对话":void 0,onClick:le[2]||(le[2]=ve=>o("create-session"))},[K(me,{name:"plus",size:16}),e.collapsed?N("",!0):(g(),v("span",lP,"新建对话"))],8,aP),e.collapsed?N("",!0):(g(),v("div",uP,[h("button",{class:fe(["section-tab",{active:D(l)==="sessions"}]),role:"tab","aria-selected":D(l)==="sessions",onClick:le[3]||(le[3]=ve=>l.value="sessions")},[K(me,{name:"message-circle",size:13}),le[11]||(le[11]=h("span",null,"会话",-1))],10,cP),h("button",{class:fe(["section-tab",{active:D(l)==="files"}]),role:"tab","aria-selected":D(l)==="files",onClick:le[4]||(le[4]=ve=>l.value="files")},[K(me,{name:"folder",size:13}),le[12]||(le[12]=h("span",null,"文件",-1))],10,dP)])),!e.collapsed&&D(l)==="files"?(g(),Fe(sP,{key:1,"work-dir":e.workDir,"git-status":e.gitStatus,"refresh-git":e.refreshGit,onOpenFile:W},null,8,["work-dir","git-status","refresh-git"])):N("",!0),e.collapsed||D(l)==="sessions"?(g(),v(X,{key:2},[e.collapsed?N("",!0):(g(),v("label",fP,[K(me,{name:"search",size:15}),et(h("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":le[5]||(le[5]=ve=>ht(i)?i.value=ve:null),type:"text",placeholder:`搜索会话… (${D(wr)}K)`,"aria-label":"搜索会话",spellcheck:"false"},null,8,hP),[[ut,D(i)]])])),h("div",pP,[(g(!0),v(X,null,Me(b.value,ve=>(g(),v("div",{key:ve.key,class:"space-group"},[e.collapsed?(g(),v("button",{key:0,class:fe(["space-dot",{active:ve.items.some(Q=>Q.sessionId===e.currentSessionId)}]),title:ve.name,onClick:le[6]||(le[6]=Q=>o("toggle-collapse"))},C(ve.name.slice(0,1).toUpperCase()),11,gP)):(g(),v(X,{key:1},[h("button",{class:"space-head",title:ve.key,onClick:Q=>D(u)(ve.key)},[K(me,{name:D(a).has(ve.key)?"chevron-right":"chevron-down",size:14},null,8,["name"]),h("span",vP,C(ve.name),1),h("span",yP,C(ve.items.length),1)],8,mP),D(a).has(ve.key)?N("",!0):(g(),v("div",bP,[(g(!0),v(X,null,Me(k(ve),Q=>(g(),v("div",{key:Q.sessionId,class:"session-item-wrap"},[h("button",{class:fe(["session-item",{active:Q.sessionId===e.currentSessionId}]),title:Te(Q),onClick:ye=>S(Q.sessionId),onDblclick:ye=>E(Q)},[Q.active?(g(),v("span",wP)):N("",!0),h("span",SP,[ee.value===Q.sessionId?(g(),v("span",_P,[et(h("input",{ref_for:!0,ref:O,"onUpdate:modelValue":le[7]||(le[7]=ye=>x.value=ye),class:"rename-input",spellcheck:"false","aria-label":`重命名会话 ${Te(Q)}`,onClick:le[8]||(le[8]=st(()=>{},["stop"])),onKeydown:[Vn(st(ye=>oe(Q.sessionId),["prevent"]),["enter"]),le[9]||(le[9]=Vn(st(ye=>z(),["prevent"]),["esc"]))],onBlur:ye=>oe(Q.sessionId)},null,40,$P),[[ut,x.value]])])):(g(),v(X,{key:1},[h("span",CP,C(Te(Q)),1),h("span",xP,[h("span",null,C(ke(Q.createdAt)),1),Q.messageCount>=0?(g(),v(X,{key:0},[le[13]||(le[13]=h("span",{class:"meta-sep","aria-hidden":"true"},"·",-1)),h("span",null,C(Q.messageCount)+" 条",1)],64)):N("",!0)])],64))])],42,kP),h("div",TP,[h("button",{type:"button",class:"session-act",disabled:!I(Q),title:I(Q)?"重命名会话":"只有当前打开的会话能重命名","aria-label":`重命名会话:${Te(Q)}`,onClick:st(ye=>E(Q),["stop"])},[K(me,{name:"edit",size:14})],8,IP),h("button",{type:"button",class:"session-act session-act--danger",title:`删除会话:${Te(Q)}`,"aria-label":`删除会话:${Te(Q)}`,onClick:st(ye=>B(Q),["stop"])},[K(me,{name:"trash",size:14})],8,EP),q.value===Q.sessionId?(g(),v("div",{key:0,class:"delete-confirm",role:"alertdialog","aria-label":`确认删除:${Te(Q)}`},[h("div",MP,"删除「"+C(Te(Q))+"」?不可恢复。",1),h("div",RP,[h("button",{type:"button",class:"dc-btn",onClick:st(R,["stop"])},"取消"),h("button",{type:"button",class:"dc-btn dc-btn--danger",onClick:st(ye=>L(Q.sessionId),["stop"])}," 确认删除 ",8,PP)])],8,AP)):N("",!0)])]))),128)),!D(i)&&w(ve)>0?(g(),v("button",{key:0,class:"space-more",type:"button",title:D(d)(ve.key)?"收起,只留最近几条":"展开这个空间的其余会话",onClick:Q=>D(c)(ve.key)},[K(me,{name:"chevron-down",size:12,class:fe({"is-up":D(d)(ve.key)})},null,8,["class"]),h("span",null,C(D(d)(ve.key)?"收起":`显示更多 ${w(ve)} 条`),1)],8,LP)):N("",!0)]))],64))]))),128)),!e.collapsed&&b.value.length===0?(g(),v("p",DP,C(D(i)?"没有匹配的会话":"还没有会话,点击上方「新建对话」开始"),1)):N("",!0)])],64)):N("",!0),h("nav",OP,[h("button",{class:fe(["foot-item",{active:e.view==="skills"}]),title:e.collapsed?"技能中心":void 0,onClick:le[10]||(le[10]=ve=>o("navigate","skills"))},[K(me,{name:"sparkles",size:17}),e.collapsed?N("",!0):(g(),v("span",GP,"技能中心"))],10,NP),h("button",{class:fe(["foot-item",{active:e.view==="settings"||D(p)}]),title:e.collapsed?"设置":void 0,onClick:m},[K(me,{name:"settings",size:17}),e.collapsed?N("",!0):(g(),v("span",FP,"设置"))],10,BP),h("div",jP,[le[14]||(le[14]=h("span",{class:"identity-dot","aria-hidden":"true"},null,-1)),e.collapsed?N("",!0):(g(),v("span",UP,"scream web"))])])],2))}}),$d=De(zP,[["__scopeId","data-v-ab879b57"]]),HP={class:"skills"},WP={class:"skills-head"},qP={class:"skills-head-actions"},VP={key:0,class:"skills-error",role:"alert"},KP={key:1,class:"skills-grid","aria-hidden":"true"},ZP={key:2,class:"skills-empty"},YP={class:"skills-empty-title"},XP={key:3,class:"skills-grid"},JP={class:"skill-card-head"},QP={class:"skill-cmd"},eL={class:"skill-source"},tL={class:"skill-desc"},nL={class:"skill-card-foot"},sL=Le({__name:"SkillsView",props:{client:{default:void 0},injectDraft:{type:Function,default:void 0}},emits:["create"],setup(e,{emit:t}){const n=e,s=t,{showToast:o}=qo(),{activeClient:r}=jv(),i=P(()=>n.client??r.value);function a(k){return k!==null&&typeof k=="object"&&k.__v_isRef===!0?k.value:k}const l=P(()=>{var k;return a((k=i.value)==null?void 0:k.skills)??[]}),u=P(()=>{var k;return a((k=i.value)==null?void 0:k.skillsError)??""}),c=P(()=>{var k,w;return!!a(((k=i.value)==null?void 0:k.currentSessionId)??((w=i.value)==null?void 0:w.sessionId))}),d=M(!1);async function f(){const k=i.value;if(k!=null&&k.fetchSkills){d.value=!0;try{await k.fetchSkills()}finally{d.value=!1}}}rt(f);const p={builtin:"内置",user:"用户",extra:"扩展",project:"项目"};function m(k){return k.pluginId?`插件 ${k.pluginId}`:p[k.source]||k.source||"本地"}async function y(k){try{return await navigator.clipboard.writeText(k),!0}catch{return!1}}async function b(k){var q;const w=`/${k.name} `;let S=!1;try{S=!!await((q=n.injectDraft)==null?void 0:q.call(n,w))}catch{S=!1}if(S)return;const I=await y(w);s("create"),o(I?`已复制 ${w.trim()},在输入框粘贴后回车即可使用`:`在输入框输入 ${w.trim()} 并回车即可使用该技能`,"info")}return(k,w)=>(g(),v("div",HP,[h("div",WP,[w[4]||(w[4]=h("div",null,[h("h1",{class:"skills-title"},"技能中心"),h("p",{class:"skills-sub"},[Pe(" 当前会话的可用技能;在输入框输入 "),h("code",null,"/"),Pe(" 可从菜单调用,命令帮助见 "),h("code",null,"/help")])],-1)),h("div",qP,[K(Wt,{variant:"ghost",disabled:d.value||!c.value,onClick:f},{default:it(()=>[K(me,{name:"refresh",size:16}),w[2]||(w[2]=Pe(" 重新加载 ",-1))]),_:1},8,["disabled"]),K(Wt,{variant:"primary",onClick:w[0]||(w[0]=S=>s("create"))},{default:it(()=>[K(me,{name:"plus",size:16}),w[3]||(w[3]=Pe(" 新建会话 ",-1))]),_:1})])]),u.value?(g(),v("p",VP,[Pe(C(u.value)+" ",1),h("button",{class:"skills-retry",onClick:f},"重试")])):N("",!0),d.value&&l.value.length===0?(g(),v("div",KP,[(g(),v(X,null,Me(6,S=>h("div",{key:S,class:"skill-card skeleton"},[...w[5]||(w[5]=[h("span",{class:"skeleton-line skeleton-line-title"},null,-1),h("span",{class:"skeleton-line"},null,-1),h("span",{class:"skeleton-line skeleton-line-short"},null,-1)])])),64))])):l.value.length===0&&!u.value?(g(),v("div",ZP,[K(me,{name:"sparkles",size:28}),h("p",YP,C(c.value?"这个会话还没有可用技能":"打开会话后可查看技能"),1),w[7]||(w[7]=h("p",{class:"skills-empty-hint"}," 技能可以放在技能目录(用户 / 额外目录),或随插件安装进来;装好后点「重新加载」。 ",-1)),K(Wt,{variant:"primary",onClick:w[1]||(w[1]=S=>s("create"))},{default:it(()=>[K(me,{name:"plus",size:16}),w[6]||(w[6]=Pe(" 新建会话 ",-1))]),_:1})])):(g(),v("div",XP,[(g(!0),v(X,null,Me(l.value,S=>(g(),v("article",{key:S.name,class:"skill-card"},[h("div",JP,[h("span",QP,"/"+C(S.name),1),h("span",eL,C(m(S)),1)]),h("p",tL,C(S.description||"暂无描述"),1),h("div",nL,[K(Wt,{variant:"secondary",onClick:I=>b(S)},{default:it(()=>[K(me,{name:"send",size:14}),w[8]||(w[8]=Pe(" 试用 ",-1))]),_:1},8,["onClick"])])]))),128))]))]))}}),oL=De(sL,[["__scopeId","data-v-60c38852"]]),rL={class:"dock-tabs",role:"tablist","aria-label":"右栏标签"},iL=["aria-selected","title","data-kind","onClick","onAuxclick"],aL={class:"tab-label"},lL=["title","aria-label","onClick"],uL={class:"dock-chrome"},cL=["title","aria-label","aria-pressed"],dL=Le({__name:"TabBar",props:{maximized:{type:Boolean,default:!1},showMaximize:{type:Boolean,default:!0}},emits:["update:maximized","collapse"],setup(e,{emit:t}){const n=t,s=M(null);xe(()=>Ce.activeTabId,async()=>{var i,a;await Ve();const r=(i=s.value)==null?void 0:i.querySelector(".tab-button.active");(a=r==null?void 0:r.scrollIntoView)==null||a.call(r,{block:"nearest",inline:"nearest"})},{immediate:!0});function o(r,i){r.button===1&&(r.preventDefault(),r.stopPropagation(),hc(i))}return(r,i)=>(g(),v("div",{ref_key:"barRef",ref:s,class:"tab-bar"},[h("div",rL,[(g(!0),v(X,null,Me(D(Ce).tabs,a=>(g(),v("div",{key:a.id,class:fe(["tab-button",{active:a.id===D(Ce).activeTabId}]),role:"tab","aria-selected":a.id===D(Ce).activeTabId,title:a.kind==="file"?a.filePath:a.label,"data-kind":a.kind,onClick:l=>D(Oy)(a.id),onMousedown:i[0]||(i[0]=l=>{l.button===1&&l.preventDefault()}),onAuxclick:l=>o(l,a.id)},[K(me,{name:D(nh)(a.kind).icon,size:13,class:"tab-icon"},null,8,["name"]),h("span",aL,C(a.label),1),h("button",{class:"tab-close",title:`关闭 ${a.label}`,"aria-label":`关闭 ${a.label}`,onClick:st(l=>D(hc)(a.id),["stop"])},[K(me,{name:"x",size:11})],8,lL)],42,iL))),128))]),h("div",uL,[e.showMaximize?(g(),v("button",{key:0,class:"dock-chrome-btn dock-chrome-maximize",title:e.maximized?"退出全屏":"全屏","aria-label":e.maximized?"退出全屏":"全屏","aria-pressed":e.maximized,onClick:i[1]||(i[1]=a=>n("update:maximized",!e.maximized))},[K(me,{name:e.maximized?"minimize":"expand",size:14},null,8,["name"])],8,cL)):N("",!0),h("button",{class:"dock-chrome-btn dock-chrome-collapse",title:"折叠右栏","aria-label":"折叠右栏",onClick:i[2]||(i[2]=a=>n("collapse"))},[K(me,{name:"panel-right",size:14})])])],512))}}),fL=De(dL,[["__scopeId","data-v-2277cc5b"]]),hL={class:"mode-switch",role:"group","aria-label":"工作模式"},pL=["aria-pressed","onClick"],gL=Le({__name:"ModeSwitch",props:{modelValue:{default:"chat"}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,s=[{id:"chat",label:"智能工作"},{id:"goal",label:"任务模式"}];return(o,r)=>(g(),v("div",hL,[(g(),v(X,null,Me(s,i=>h("button",{key:i.id,class:fe(["mode-pill",`is-${i.id}`,{active:e.modelValue===i.id}]),"aria-pressed":e.modelValue===i.id,onClick:a=>n("update:modelValue",i.id)},C(i.label),11,pL)),64))]))}}),mL=De(gL,[["__scopeId","data-v-c4ac7862"]]),vL={class:"workspace"},yL={class:"workspace-hero"},bL={class:"workspace-brand"},kL=["src"],wL={class:"workspace-status","aria-label":"连接与模型状态"},SL={class:"status-item"},_L={class:"status-item status-model"},$L={class:"workspace-launch"},CL={class:"mode-hint"},xL={class:"quick-start"},TL={class:"quick-label"},IL={class:"quick-chips"},EL=["title","onClick"],AL={class:"workspace-composer"},ML="scream-recent-prompts",RL=Le({__name:"WorkspaceHome",props:{models:{},status:{default:void 0},busy:{type:Boolean},mode:{default:"chat"},recentWorkDirs:{default:()=>[]}},emits:["send","command","switch-model","switch-thinking","update:mode","abort"],setup(e,{expose:t,emit:n}){const s=e,o=n,r=P(()=>s.mode==="goal"),i=P(()=>r.value?"任务模式:提交后将创建执行目标(Goal),Agent 持续执行到完成或预算耗尽;抽屉「Goal 管理」可查看与暂停。":"直接对话:提问后 Agent 按需调用工具完成你的请求。"),a=P(()=>s.status!==void 0),l=P(()=>{var k;return(k=s.status)==null?void 0:k.model}),u=M([]),{fetchServerWorkDir:c}=Dl();rt(()=>{c();try{const k=localStorage.getItem(ML);if(k){const w=JSON.parse(k);Array.isArray(w)&&(u.value=w.filter(S=>typeof S=="string").slice(0,4))}}catch{u.value=[]}});const d={chat:["梳理当前项目结构","解释最近的代码改动","帮我排查一个报错"],goal:["修复构建并跑通测试","完成一次小型重构","整理项目文档"]},f=P(()=>u.value.length>0),p=P(()=>f.value?u.value:d[s.mode]),m=M(null);function y(k){var w;(w=m.value)==null||w.insertText(k)}function b(k){const w=m.value;return w?(w.insertDraft(k,{activate:!0}),!0):!1}return t({insertDraft:b}),(k,w)=>(g(),v("div",vL,[h("section",yL,[h("h1",bL,[h("img",{class:"brand-logo",src:D(qp),alt:"scream"},null,8,kL)]),w[7]||(w[7]=h("p",{class:"workspace-tagline"},"你的智能协作伙伴",-1)),h("p",wL,[h("span",{class:fe(["status-dot",a.value?"on":"off"]),"aria-hidden":"true"},null,2),h("span",SL,C(a.value?"已连接":"等待连接"),1),l.value?(g(),v(X,{key:0},[w[6]||(w[6]=h("span",{class:"status-sep"},"·",-1)),h("span",_L,C(l.value),1)],64)):N("",!0)])]),h("section",$L,[K(mL,{class:"workspace-mode","model-value":s.mode,"onUpdate:modelValue":w[0]||(w[0]=S=>o("update:mode",S))},null,8,["model-value"]),h("p",CL,[(g(),v("span",{key:String(r.value),class:"hint-fade"},C(i.value),1))]),h("div",xL,[h("span",TL,C(f.value?"最近":"试试"),1),h("div",IL,[(g(!0),v(X,null,Me(p.value,(S,I)=>(g(),v("button",{key:`${I}-${S}`,class:"quick-chip",title:S,onClick:q=>y(S)},C(S),9,EL))),128))])])]),h("section",AL,[K(hh,{ref_key:"composerRef",ref:m,busy:e.busy,status:e.status,models:e.models,"recent-work-dirs":e.recentWorkDirs,variant:"home",placeholder:r.value?"描述你要完成的目标,Enter 创建并开始执行…":"输入 @ 引用知识库 / 使用技能 / 或者直接提问...",onSend:w[1]||(w[1]=S=>o("send",S,s.mode)),onAbort:w[2]||(w[2]=S=>o("abort")),onCommand:w[3]||(w[3]=(S,I)=>o("command",S,I)),onSwitchModel:w[4]||(w[4]=S=>o("switch-model",S)),onSwitchThinking:w[5]||(w[5]=S=>o("switch-thinking",S))},null,8,["busy","status","models","recent-work-dirs","placeholder"])])]))}}),PL=De(RL,[["__scopeId","data-v-1f7fc15b"]]),LL=["aria-valuenow","aria-valuemin","aria-valuemax"],DL={key:2,class:"sidebar-mobile"},OL={class:"canvas"},NL={class:"topbar mobile-only"},GL={class:"topbar-left"},BL={key:0,class:"topbar-running",title:"Agent 运行中"},FL={class:"canvas-body"},jL=["aria-valuenow","aria-valuemin","aria-valuemax"],UL={class:"right-panel-body"},zL={class:"dock-pane dock-pane--file"},HL=["data-dock-tab"],Cd="scream-sidebar-collapsed",xd="scream-workspace-mode",WL=Le({__name:"WebShell",setup(e){var Zn,er;const t=vy(),{showToast:n}=qo(),{connectionStatus:s,status:o,isBusy:r,sessions:i,currentSessionId:a,workDir:l,gitStatus:u,models:c,like:d,sendPrompt:f,sendCommand:p,appendSystemMessage:m,createSession:y,switchSession:b,deleteSession:k,switchModel:w,switchThinking:S,fetchLike:I,fetchGitStatus:q,abort:B}=t,R=M("home"),L=M(!1),A=M(null);function W(pe=8e3){return s.value==="connected"?Promise.resolve(!0):new Promise(be=>{const $e=Date.now(),Gt=window.setInterval(()=>{s.value==="connected"?(window.clearInterval(Gt),be(!0)):Date.now()-$e>pe&&(window.clearInterval(Gt),be(!1))},80)})}function F(pe){pe==="chat"?R.value=a.value?"chat":"home":R.value=pe,L.value=!1}function O(){L.value=!1,Kr(),oe.value=!0}async function ee(pe){oe.value=!1,z(pe.workDir);const be=a.value,$e=pe.model&&pe.model!==o.value.model?pe.model:null;await y(pe.workDir??void 0,()=>{R.value="chat"}),!(!a.value||a.value===be)&&($e&&w($e),R.value="chat")}const{preferredWorkDir:x,serverWorkDir:E,setPreferredWorkDir:z}=Dl(),oe=M(!1),ke=P(()=>{const pe=new Set,be=[];for(const $e of i.value){const Gt=$e.workDir;if(!(!Gt||pe.has(Gt))&&(pe.add(Gt),be.push(Gt),be.length>=6))break}return be}),Te=M(null),ge=M(null);async function le(pe){var Gt,Ts;L.value=!1;const be=!a.value;R.value=be?"home":"chat",await Ve(),await Ve();const $e=be?((Gt=ge.value)==null?void 0:Gt.insertDraft(pe))??!1:((Ts=Te.value)==null?void 0:Ts.insertDraft(pe,{activate:!0}))??!1;return $e&&n(`已把 ${pe.trim()} 放进输入框,补参数后回车`,"success"),$e}function ve(pe){Ve(()=>{var be;return(be=ge.value)==null?void 0:be.insertDraft(pe)})}let Q=!1;async function ye(pe,be){if(L.value=!1,Q){ve(pe);return}Q=!0;try{const $e=a.value;if(await y(x.value??void 0),a.value===$e){ve(pe);return}if(!await W()){ve(pe);return}if(R.value="chat",be==="goal")try{await t.createGoal({objective:pe,budgets:[]})}catch(Ts){m(`Goal 创建失败:${Ee(Ts)}。已保留对话模式,可重新发送。`),f(pe);return}else f(pe)}finally{Q=!1}}function Ee(pe){return pe instanceof Error?pe.message:String(pe)}function Ue(pe){L.value=!1,R.value="chat",b(pe)}function Ke(pe){vs(pe)}function J(pe,be){if(pe!==a.value){n("请先点击该会话,再双击重命名。","warning");return}p("title",be)}const de=M(!1),Z=M("status");function Ie(pe){t.fetchSnapshot(),Z.value=pe,de.value=!0}const{onCommand:_}=Qf({sendCommand:p,clearMessages:t.clearMessages,appendSystemMessage:m,ensureSession:async()=>{a.value||await y(x.value??void 0)},onNew:O,showInfo:Ie,currentModel:()=>o.value.model}),$=M(Wr(Cd)==="1"),U=`(max-width: ${ky-1}px)`,Y=(er=(Zn=globalThis.window)==null?void 0:Zn.matchMedia)==null?void 0:er.call(Zn,U),te=M((Y==null?void 0:Y.matches)??!1);function ne(pe){te.value=pe.matches}const ue=P(()=>te.value||$.value);function ce(){if(te.value){L.value=!L.value;return}$.value=!$.value,qr(Cd,$.value?"1":"0")}const ie=M(window.innerWidth),T=P(()=>ie.value>=Ml);function H(){ie.value=window.innerWidth}const G=dc({storageKey:"scream-sidebar-width",minWidth:uc,maxWidth:()=>$y({viewportWidth:ie.value,rightPanelOpen:Ce.panelOpen,rightPanelWidth:we.value}),defaultWidth:wy,side:"left",canDrag:()=>!ue.value,acceptStoredWidth:pe=>pe<=Hr}),se=G.width,he=G.resizing,Se=P(()=>Cy({viewportWidth:ie.value,sidebarOpen:!$.value,sidebarWidth:ue.value?cc:se.value})),_e=dc({storageKey:"scream-right-panel-width",minWidth:Na,maxWidth:()=>Se.value,defaultWidth:()=>_y(ie.value),side:"right"}),Re=_e.resizing,we=_e.effectiveWidth,Oe=M(!1);function It(){Pl(!1)}xe(T,()=>{Re.value&&_e.release()}),xe(ue,()=>{ue.value&&he.value&&G.release()}),xe(te,pe=>{pe||(L.value=!1)}),xe(()=>Ce.panelOpen,pe=>{pe||(Oe.value=!1)});const bt=P(()=>({"--sidebar-track":`${ue.value?cc:se.value}px`,"--sidebar-width":`${se.value}px`,"--dock-track":`${Ce.panelOpen&&T.value&&!Oe.value?we.value:0}px`})),rn={detail:vR,run:Up,git:Bp,todo:zp,goal:Fp,like:jp},_s=P(()=>Ce.tabs.filter(pe=>pe.kind!=="file")),gt=P(()=>{var pe;return((pe=ih())==null?void 0:pe.kind)??"file"}),Ot=P(()=>gt.value==="file");function $s(pe){vs(pe.path,{modeHint:"diff",label:pe.display})}const Cs={refresh:()=>q(),diff:$s};function Jo(pe){switch(pe){case"detail":return{client:t};case"run":return{status:t.status.value,busy:t.isBusy.value,connectionStatus:t.connectionStatus.value};case"git":return{gitStatus:t.gitStatus.value};case"todo":return{todos:t.todos.value};case"like":return{like:t.like.value,updateLike:t.updateLike};case"goal":return{goal:t.goal.value,sessionId:t.sessionId.value,connectionStatus:t.connectionStatus.value,busy:t.isBusy.value,archived:t.isArchived.value,pending:t.goalRequestPending.value,error:t.goalRequestError.value,refineGoal:t.refineGoal,createGoal:t.createGoal,updateGoal:t.updateGoal,pauseGoal:t.pauseGoal,resumeGoal:t.resumeGoal,cancelGoal:t.cancelGoal}}}function Oi(pe){return pe==="git"?Cs:{}}const Zt=M(Wr(xd)==="goal"?"goal":"chat");function xs(pe){Zt.value=pe,qr(xd,pe)}function Qo(pe){if((pe.metaKey||pe.ctrlKey)&&pe.key==="k")pe.preventDefault(),ue.value&&!L.value&&ce(),Ve(()=>{var be,$e;return($e=(be=A.value)==null?void 0:be.focusSearch)==null?void 0:$e.call(be)});else if((pe.metaKey||pe.ctrlKey)&&pe.key==="n")pe.preventDefault(),O();else if(pe.key==="Escape"&&r.value){const be=pe.target;be&&(be.tagName==="TEXTAREA"||be.tagName==="INPUT")||(pe.preventDefault(),B())}}return rt(()=>{var pe;window.addEventListener("keydown",Qo),window.addEventListener("resize",H),(pe=Y==null?void 0:Y.addEventListener)==null||pe.call(Y,"change",ne),I(),q()}),at(()=>{var pe;window.removeEventListener("keydown",Qo),window.removeEventListener("resize",H),(pe=Y==null?void 0:Y.removeEventListener)==null||pe.call(Y,"change",ne)}),(pe,be)=>(g(),v("div",{class:fe(["shell",{"sidebar-collapsed":ue.value,resizing:D(he)||D(Re),"right-panel-open":D(Ce).panelOpen&&T.value,"dock-maximized":D(Ce).panelOpen&&Oe.value}]),style:yt(bt.value)},[K($d,{ref_key:"sidebarRef",ref:A,view:R.value,sessions:D(i),"current-session-id":D(a),"work-dir":D(l),"git-status":D(u),"refresh-git":D(q),collapsed:ue.value,onNavigate:F,onSwitchSession:Ue,onDeleteSession:D(k),onCreateSession:O,onToggleCollapse:ce,onOpenFile:Ke,onRenameSession:J},null,8,["view","sessions","current-session-id","work-dir","git-status","refresh-git","collapsed","onDeleteSession"]),ue.value?N("",!0):(g(),v("div",{key:0,class:fe(["panel-resize-handle panel-resize-handle--left",{resizing:D(he)}]),role:"separator","aria-orientation":"vertical","aria-label":"调整侧栏宽度","aria-valuenow":D(se),"aria-valuemin":D(uc),"aria-valuemax":D(Hr),tabindex:"0",title:"拖拽调整宽度 · 双击复位",onPointerdown:be[0]||(be[0]=(...$e)=>D(G).onPointerDown&&D(G).onPointerDown(...$e)),onPointermove:be[1]||(be[1]=(...$e)=>D(G).onPointerMove&&D(G).onPointerMove(...$e)),onPointerup:be[2]||(be[2]=(...$e)=>D(G).onPointerUp&&D(G).onPointerUp(...$e)),onPointercancel:be[3]||(be[3]=(...$e)=>D(G).onPointerUp&&D(G).onPointerUp(...$e)),onDblclick:be[4]||(be[4]=(...$e)=>D(G).reset&&D(G).reset(...$e)),onKeydown:be[5]||(be[5]=(...$e)=>D(G).onKeydown&&D(G).onKeydown(...$e))},null,42,LL)),L.value?(g(),v("div",{key:1,class:"sidebar-backdrop","aria-hidden":"true",onClick:be[6]||(be[6]=$e=>L.value=!1)})):N("",!0),L.value?(g(),v("div",DL,[K($d,{view:R.value,sessions:D(i),"current-session-id":D(a),"work-dir":D(l),"git-status":D(u),"refresh-git":D(q),"show-collapse-toggle":!1,onNavigate:F,onSwitchSession:Ue,onDeleteSession:D(k),onCreateSession:O,onOpenFile:Ke,onRenameSession:J},null,8,["view","sessions","current-session-id","work-dir","git-status","refresh-git","onDeleteSession"])])):N("",!0),h("main",OL,[h("header",NL,[h("div",GL,[h("button",{class:"topbar-icon mobile-menu",title:"菜单","aria-label":"打开菜单",onClick:be[7]||(be[7]=$e=>L.value=!0)},[K(me,{name:"menu",size:20})]),D(r)?(g(),v("span",BL,[...be[18]||(be[18]=[h("span",{class:"running-dot","aria-hidden":"true"},null,-1),h("span",{class:"running-text"},"运行中",-1)])])):N("",!0)])]),h("div",FL,[R.value==="home"?(g(),Fe(PL,{key:0,ref_key:"workspaceHomeRef",ref:ge,models:D(c),status:D(o),busy:D(r),mode:Zt.value,"recent-work-dirs":ke.value,"onUpdate:mode":xs,onSend:ye,onAbort:D(B),onCommand:D(_),onSwitchModel:D(w),onSwitchThinking:D(S)},null,8,["models","status","busy","mode","recent-work-dirs","onAbort","onCommand","onSwitchModel","onSwitchThinking"])):R.value==="chat"?(g(),Fe(fE,{key:1,ref_key:"conversationRef",ref:Te,client:D(t),onHome:be[8]||(be[8]=$e=>R.value="home")},null,8,["client"])):R.value==="skills"?(g(),Fe(oL,{key:2,"inject-draft":le,onCreate:O})):R.value==="settings"?(g(),Fe(Hp,{key:3,like:D(d),client:D(t),onUpdateLike:D(t).updateLike},null,8,["like","client","onUpdateLike"])):N("",!0)])]),D(Ce).panelOpen&&!T.value?(g(),v("div",{key:3,class:"right-panel-backdrop","aria-hidden":"true",onClick:It})):N("",!0),D(Ce).panelOpen&&T.value&&!Oe.value?(g(),v("div",{key:4,class:fe(["panel-resize-handle panel-resize-handle--right",{resizing:D(Re)}]),role:"separator","aria-orientation":"vertical","aria-label":"调整右栏宽度","aria-valuenow":D(we),"aria-valuemin":D(Na),"aria-valuemax":Se.value,tabindex:"0",title:"拖拽调整宽度 · 双击复位",onPointerdown:be[9]||(be[9]=(...$e)=>D(_e).onPointerDown&&D(_e).onPointerDown(...$e)),onPointermove:be[10]||(be[10]=(...$e)=>D(_e).onPointerMove&&D(_e).onPointerMove(...$e)),onPointerup:be[11]||(be[11]=(...$e)=>D(_e).onPointerUp&&D(_e).onPointerUp(...$e)),onPointercancel:be[12]||(be[12]=(...$e)=>D(_e).onPointerUp&&D(_e).onPointerUp(...$e)),onDblclick:be[13]||(be[13]=(...$e)=>D(_e).reset&&D(_e).reset(...$e)),onKeydown:be[14]||(be[14]=(...$e)=>D(_e).onKeydown&&D(_e).onKeydown(...$e))},null,42,jL)):N("",!0),D(Ce).panelOpen?(g(),v("aside",{key:5,class:fe(["right-panel",{overlay:!T.value,maximized:Oe.value}]),"aria-label":"右栏"},[K(fL,{maximized:Oe.value,"show-maximize":T.value,"onUpdate:maximized":be[15]||(be[15]=$e=>Oe.value=$e),onCollapse:It},null,8,["maximized","show-maximize"]),h("div",UL,[et(h("div",zL,[K(zE,{client:D(t)},null,8,["client"])],512),[[Nr,Ot.value]]),(g(!0),v(X,null,Me(_s.value,$e=>et((g(),v("div",{key:$e.id,class:fe(["dock-pane",`dock-pane--${$e.kind}`]),"data-dock-tab":$e.kind},[(g(),Fe(yf(rn[$e.kind]),Gf({ref_for:!0},Jo($e.kind),im(Oi($e.kind))),null,16))],10,HL)),[[Nr,$e.id===D(Ce).activeTabId]])),128))])],2)):N("",!0),de.value?(g(),Fe(ph,{key:6,mode:Z.value,status:D(o),"session-id":D(a),"work-dir":D(l),onClose:be[16]||(be[16]=$e=>de.value=!1)},null,8,["mode","status","session-id","work-dir"])):N("",!0),K(P2),K(kM,{open:oe.value,models:D(c),"recent-work-dirs":ke.value,"default-dir":D(E)??"","current-model":D(o).model??"",onClose:be[17]||(be[17]=$e=>oe.value=!1),onConfirm:ee},null,8,["open","models","recent-work-dirs","default-dir","current-model"])],6))}}),qL=De(WL,[["__scopeId","data-v-62878f2b"]]),VL=["src","alt"],KL={key:1,class:"lightbox-note",role:"alert"},ZL=Le({__name:"ImageLightbox",setup(e){const t=M(null),n=M(!1);xe(()=>Un.open,r=>{const i=t.value;i&&(r?(n.value=!1,i.open||i.showModal()):i.open&&i.close())});function s(r){r.preventDefault(),ha()}function o(r){r.target===t.value&&ha()}return(r,i)=>(g(),v("dialog",{ref_key:"dialogRef",ref:t,class:"image-lightbox","aria-label":"图片预览",onCancel:s,onClick:o},[D(Un).open?(g(),v("img",{key:0,class:"lightbox-img",src:D(Un).src,alt:D(Un).alt||"图片预览",onError:i[0]||(i[0]=a=>n.value=!0)},null,40,VL)):N("",!0),n.value?(g(),v("p",KL,"图片加载失败")):N("",!0),h("button",{type:"button",class:"lightbox-close","aria-label":"关闭预览",title:"关闭(Esc)",onClick:i[1]||(i[1]=a=>D(ha)())},[K(me,{name:"x",size:16})])],544))}}),YL=De(ZL,[["__scopeId","data-v-7d7939d6"]]),XL={class:"toast-container"},JL=["onClick"],QL={class:"toast-icon"},eD={class:"toast-msg"},tD=Le({__name:"Toast",setup(e){const{toasts:t,removeToast:n}=qo(),s={info:"ℹ",success:"✓",error:"✗",warning:"⚠"};return(o,r)=>(g(),Fe(Qs,{to:"body"},[h("div",XL,[K(vv,{name:"toast"},{default:it(()=>[(g(!0),v(X,null,Me(D(t),i=>(g(),v("div",{key:i.id,class:fe(["toast",`toast--${i.type}`]),onClick:a=>D(n)(i.id)},[h("span",QL,C(s[i.type]),1),h("span",eD,C(i.message),1)],10,JL))),128))]),_:1})])]))}}),nD=De(tD,[["__scopeId","data-v-a432e638"]]),sD={class:"app"},oD=Le({__name:"App",setup(e){const t=M("system"),n=M("dark");mr("effectiveTheme",n),mr("theme",t);const s={light:"#ffffff",dark:"#101113"};function o(){const l=document.documentElement,u=window.matchMedia("(prefers-color-scheme: dark)").matches,c=t.value==="system"?u?"dark":"light":t.value;n.value=c,l.dataset.theme=c;const d=document.querySelector('meta[name="theme-color"]');d&&d.setAttribute("content",s[c])}let r=null;function i(l){const u=t.value;if(t.value=l,qr("scream-theme",l),u===l)return;const c=document.documentElement,d=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,f=()=>{c.classList.add("theme-transition"),o(),r!==null&&clearTimeout(r),r=window.setTimeout(()=>c.classList.remove("theme-transition"),320)},p=document;if(typeof p.startViewTransition=="function"&&!d){p.startViewTransition(()=>{o()}).finished.then(()=>c.classList.remove("theme-transition"),()=>{c.classList.remove("theme-transition")});return}f()}mr("setTheme",i),rt(()=>{const l=Wr("scream-theme");(l==="light"||l==="dark"||l==="system")&&(t.value=l),o()}),xe(t,o);const a=window.matchMedia("(prefers-color-scheme: dark)");return a.addEventListener("change",o),at(()=>{a.removeEventListener("change",o),r!==null&&clearTimeout(r),document.documentElement.classList.remove("theme-transition")}),(l,u)=>(g(),v("div",sD,[K(qL),K(YL),K(nD)]))}}),rD=De(oD,[["__scopeId","data-v-6c4eed55"]]);Iv(rD).mount("#app");
|
|
240
|
+
//# sourceMappingURL=index-DakPeNBt.js.map
|