const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-LfdN0zeE.js","assets/html-C2L_23MC.js","assets/javascript-ySlJ1b_l.js","assets/css-BPhBrDlE.js","assets/angular-ts-CKsD7JZE.js","assets/scss-C31hgJw-.js","assets/apl-BBq3IX1j.js","assets/xml-e3z08dGr.js","assets/java-xI-RfyKK.js","assets/json-BQoSv7ci.js","assets/astro-CqkE3fuf.js","assets/typescript-Dj6nwHGl.js","assets/postcss-B3ZDOciz.js","assets/blade-a8OxSdnT.js","assets/sql-COK4E0Yg.js","assets/bsl-Dgyn0ogV.js","assets/sdbl-BLhTXw86.js","assets/cairo--RitsXJZ.js","assets/python-DhUJRlN_.js","assets/cobol-PTqiYgYu.js","assets/coffee-dyiR41kL.js","assets/cpp-BksuvNSY.js","assets/regexp-DWJ3fJO_.js","assets/glsl-DBO2IWDn.js","assets/c-C3t2pwGQ.js","assets/crystal-DtDmRg-F.js","assets/shellscript-atvbtKCR.js","assets/edge-D5gP-w-T.js","assets/html-derivative-CSfWNPLT.js","assets/elixir-CLiX3zqd.js","assets/elm-CmHSxxaM.js","assets/erb-BYTLMnw6.js","assets/ruby-DeZ3UC14.js","assets/haml-B2EZWmdv.js","assets/graphql-cDcHW_If.js","assets/jsx-BAng5TT0.js","assets/tsx-B6W0miNI.js","assets/lua-CvWAzNxB.js","assets/yaml-CVw76BM1.js","assets/fortran-fixed-form-TqA4NnZg.js","assets/fortran-free-form-DKXYxT9g.js","assets/fsharp-XplgxFYe.js","assets/markdown-UIAJJxZW.js","assets/gdresource-BHYsBjWJ.js","assets/gdshader-SKMF96pI.js","assets/gdscript-DfxzS6Rs.js","assets/git-commit-i4q6IMui.js","assets/diff-BgYniUM_.js","assets/git-rebase-B-v9cOL2.js","assets/glimmer-js-D-cwc0-E.js","assets/glimmer-ts-pgjy16dm.js","assets/hack-D1yCygmZ.js","assets/handlebars-BQGss363.js","assets/http-FRrOvY1W.js","assets/hxml-TIA70rKU.js","assets/haxe-C5wWYbrZ.js","assets/imba-bv_oIlVt.js","assets/jinja-DGy0s7-h.js","assets/jison-BqZprYcd.js","assets/julia-BBuGR-5E.js","assets/r-CwjWoCRV.js","assets/latex-C-cWTeAZ.js","assets/tex-rYs2v40G.js","assets/liquid-D3W5UaiH.js","assets/marko-z0MBrx5-.js","assets/less-BfCpw3nA.js","assets/mdc-DB_EDNY_.js","assets/nginx-D_VnBJ67.js","assets/nim-ZlGxZxc3.js","assets/perl-CHQXSrWU.js","assets/php-B5ebYQev.js","assets/pug-CM9l7STV.js","assets/qml-D8XfuvdV.js","assets/razor-CNLDkMZG.js","assets/csharp-D9R-vmeu.js","assets/rst-4NLicBqY.js","assets/cmake-DbXoA79R.js","assets/sas-BmTFh92c.js","assets/shaderlab-B7qAK45m.js","assets/hlsl-ifBTmRxC.js","assets/shellsession-C_rIy8kc.js","assets/soy-C-lX7w71.js","assets/sparql-bYkjHRlG.js","assets/turtle-BMR_PYu6.js","assets/stata-DorPZHa4.js","assets/svelte-MSaWC3Je.js","assets/templ-dwX3ZSMB.js","assets/go-B1SYOhNW.js","assets/ts-tags-CipyTH0X.js","assets/twig-NC5TFiHP.js","assets/vue-BuYVFjOK.js","assets/vue-html-xdeiXROB.js","assets/xsl-Dd0NUgwM.js"])))=>i.map(i=>d[i]);
var Zq=Object.defineProperty;var eH=(e,t,n)=>t in e?Zq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ye=(e,t,n)=>eH(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();var My=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nI={exports:{}},cv={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var tH=Symbol.for("react.transitional.element"),nH=Symbol.for("react.fragment");function sI(e,t,n){var s=null;if(n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:tH,type:e,key:s,ref:t!==void 0?t:null,props:n}}cv.Fragment=nH;cv.jsx=sI;cv.jsxs=sI;nI.exports=cv;var u=nI.exports,rI={exports:{}},xn={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Zk=Symbol.for("react.transitional.element"),sH=Symbol.for("react.portal"),rH=Symbol.for("react.fragment"),iH=Symbol.for("react.strict_mode"),oH=Symbol.for("react.profiler"),aH=Symbol.for("react.consumer"),lH=Symbol.for("react.context"),cH=Symbol.for("react.forward_ref"),uH=Symbol.for("react.suspense"),dH=Symbol.for("react.memo"),iI=Symbol.for("react.lazy"),hH=Symbol.for("react.activity"),c7=Symbol.iterator;function fH(e){return e===null||typeof e!="object"?null:(e=c7&&e[c7]||e["@@iterator"],typeof e=="function"?e:null)}var oI={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},aI=Object.assign,lI={};function Qf(e,t,n){this.props=e,this.context=t,this.refs=lI,this.updater=n||oI}Qf.prototype.isReactComponent={};Qf.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Qf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function cI(){}cI.prototype=Qf.prototype;function e5(e,t,n){this.props=e,this.context=t,this.refs=lI,this.updater=n||oI}var t5=e5.prototype=new cI;t5.constructor=e5;aI(t5,Qf.prototype);t5.isPureReactComponent=!0;var u7=Array.isArray;function z4(){}var Fs={H:null,A:null,T:null,S:null},uI=Object.prototype.hasOwnProperty;function n5(e,t,n){var s=n.ref;return{$$typeof:Zk,type:e,key:t,ref:s!==void 0?s:null,props:n}}function mH(e,t){return n5(e.type,t,e.props)}function s5(e){return typeof e=="object"&&e!==null&&e.$$typeof===Zk}function pH(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var d7=/\/+/g;function Qw(e,t){return typeof e=="object"&&e!==null&&e.key!=null?pH(""+e.key):t.toString(36)}function gH(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(z4,z4):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function jh(e,t,n,s,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(i){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case Zk:case sH:o=!0;break;case iI:return o=e._init,jh(o(e._payload),t,n,s,r)}}if(o)return r=r(e),o=s===""?"."+Qw(e,0):s,u7(r)?(n="",o!=null&&(n=o.replace(d7,"$&/")+"/"),jh(r,t,n,"",function(c){return c})):r!=null&&(s5(r)&&(r=mH(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(d7,"$&/")+"/")+o)),t.push(r)),1;o=0;var a=s===""?".":s+":";if(u7(e))for(var l=0;l<e.length;l++)s=e[l],i=a+Qw(s,l),o+=jh(s,t,n,i,r);else if(l=fH(e),typeof l=="function")for(e=l.call(e),l=0;!(s=e.next()).done;)s=s.value,i=a+Qw(s,l++),o+=jh(s,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return jh(gH(e),t,n,s,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return o}function Mg(e,t,n){if(e==null)return e;var s=[],r=0;return jh(e,s,"","",function(i){return t.call(n,i,r++)}),s}function yH(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var h7=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},bH={map:Mg,forEach:function(e,t,n){Mg(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Mg(e,function(){t++}),t},toArray:function(e){return Mg(e,function(t){return t})||[]},only:function(e){if(!s5(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};xn.Activity=hH;xn.Children=bH;xn.Component=Qf;xn.Fragment=rH;xn.Profiler=oH;xn.PureComponent=e5;xn.StrictMode=iH;xn.Suspense=uH;xn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Fs;xn.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Fs.H.useMemoCache(e)}};xn.cache=function(e){return function(){return e.apply(null,arguments)}};xn.cacheSignal=function(){return null};xn.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=aI({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!uI.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(s[i]=t[i]);var i=arguments.length-2;if(i===1)s.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];s.children=o}return n5(e.type,r,s)};xn.createContext=function(e){return e={$$typeof:lH,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:aH,_context:e},e};xn.createElement=function(e,t,n){var s,r={},i=null;if(t!=null)for(s in t.key!==void 0&&(i=""+t.key),t)uI.call(t,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(r[s]=t[s]);var o=arguments.length-2;if(o===1)r.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];r.children=a}if(e&&e.defaultProps)for(s in o=e.defaultProps,o)r[s]===void 0&&(r[s]=o[s]);return n5(e,i,r)};xn.createRef=function(){return{current:null}};xn.forwardRef=function(e){return{$$typeof:cH,render:e}};xn.isValidElement=s5;xn.lazy=function(e){return{$$typeof:iI,_payload:{_status:-1,_result:e},_init:yH}};xn.memo=function(e,t){return{$$typeof:dH,type:e,compare:t===void 0?null:t}};xn.startTransition=function(e){var t=Fs.T,n={};Fs.T=n;try{var s=e(),r=Fs.S;r!==null&&r(n,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(z4,h7)}catch(i){h7(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Fs.T=t}};xn.unstable_useCacheRefresh=function(){return Fs.H.useCacheRefresh()};xn.use=function(e){return Fs.H.use(e)};xn.useActionState=function(e,t,n){return Fs.H.useActionState(e,t,n)};xn.useCallback=function(e,t){return Fs.H.useCallback(e,t)};xn.useContext=function(e){return Fs.H.useContext(e)};xn.useDebugValue=function(){};xn.useDeferredValue=function(e,t){return Fs.H.useDeferredValue(e,t)};xn.useEffect=function(e,t){return Fs.H.useEffect(e,t)};xn.useEffectEvent=function(e){return Fs.H.useEffectEvent(e)};xn.useId=function(){return Fs.H.useId()};xn.useImperativeHandle=function(e,t,n){return Fs.H.useImperativeHandle(e,t,n)};xn.useInsertionEffect=function(e,t){return Fs.H.useInsertionEffect(e,t)};xn.useLayoutEffect=function(e,t){return Fs.H.useLayoutEffect(e,t)};xn.useMemo=function(e,t){return Fs.H.useMemo(e,t)};xn.useOptimistic=function(e,t){return Fs.H.useOptimistic(e,t)};xn.useReducer=function(e,t,n){return Fs.H.useReducer(e,t,n)};xn.useRef=function(e){return Fs.H.useRef(e)};xn.useState=function(e){return Fs.H.useState(e)};xn.useSyncExternalStore=function(e,t,n){return Fs.H.useSyncExternalStore(e,t,n)};xn.useTransition=function(){return Fs.H.useTransition()};xn.version="19.2.4";rI.exports=xn;var g=rI.exports;const vH=lv(g);var dI={exports:{}},uv={},hI={exports:{}},fI={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(j,V){var ee=j.length;j.push(V);e:for(;0<ee;){var ce=ee-1>>>1,$=j[ce];if(0<r($,V))j[ce]=V,j[ee]=$,ee=ce;else break e}}function n(j){return j.length===0?null:j[0]}function s(j){if(j.length===0)return null;var V=j[0],ee=j.pop();if(ee!==V){j[0]=ee;e:for(var ce=0,$=j.length,J=$>>>1;ce<J;){var B=2*(ce+1)-1,C=j[B],z=B+1,X=j[z];if(0>r(C,ee))z<$&&0>r(X,C)?(j[ce]=X,j[z]=ee,ce=z):(j[ce]=C,j[B]=ee,ce=B);else if(z<$&&0>r(X,ee))j[ce]=X,j[z]=ee,ce=z;else break e}}return V}function r(j,V){var ee=j.sortIndex-V.sortIndex;return ee!==0?ee:j.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();e.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,h=null,f=3,m=!1,p=!1,y=!1,w=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function _(j){for(var V=n(c);V!==null;){if(V.callback===null)s(c);else if(V.startTime<=j)s(c),V.sortIndex=V.expirationTime,t(l,V);else break;V=n(c)}}function E(j){if(y=!1,_(j),!p)if(n(l)!==null)p=!0,k||(k=!0,I());else{var V=n(c);V!==null&&F(E,V.startTime-j)}}var k=!1,M=-1,R=5,L=-1;function T(){return w?!0:!(e.unstable_now()-L<R)}function N(){if(w=!1,k){var j=e.unstable_now();L=j;var V=!0;try{e:{p=!1,y&&(y=!1,v(M),M=-1),m=!0;var ee=f;try{t:{for(_(j),h=n(l);h!==null&&!(h.expirationTime>j&&T());){var ce=h.callback;if(typeof ce=="function"){h.callback=null,f=h.priorityLevel;var $=ce(h.expirationTime<=j);if(j=e.unstable_now(),typeof $=="function"){h.callback=$,_(j),V=!0;break t}h===n(l)&&s(l),_(j)}else s(l);h=n(l)}if(h!==null)V=!0;else{var J=n(c);J!==null&&F(E,J.startTime-j),V=!1}}break e}finally{h=null,f=ee,m=!1}V=void 0}}finally{V?I():k=!1}}}var I;if(typeof x=="function")I=function(){x(N)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,U=O.port2;O.port1.onmessage=N,I=function(){U.postMessage(null)}}else I=function(){b(N,0)};function F(j,V){M=b(function(){j(e.unstable_now())},V)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(j){switch(f){case 1:case 2:case 3:var V=3;break;default:V=f}var ee=f;f=V;try{return j()}finally{f=ee}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(j,V){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var ee=f;f=j;try{return V()}finally{f=ee}},e.unstable_scheduleCallback=function(j,V,ee){var ce=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?ce+ee:ce):ee=ce,j){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=ee+$,j={id:d++,callback:V,priorityLevel:j,startTime:ee,expirationTime:$,sortIndex:-1},ee>ce?(j.sortIndex=ee,t(c,j),n(l)===null&&j===n(c)&&(y?(v(M),M=-1):y=!0,F(E,ee-ce))):(j.sortIndex=$,t(l,j),p||m||(p=!0,k||(k=!0,I()))),j},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(j){var V=f;return function(){var ee=f;f=V;try{return j.apply(this,arguments)}finally{f=ee}}}})(fI);hI.exports=fI;var wH=hI.exports,mI={exports:{}},Ui={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var xH=g;function pI(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Tc(){}var zi={d:{f:Tc,r:function(){throw Error(pI(522))},D:Tc,C:Tc,L:Tc,m:Tc,X:Tc,S:Tc,M:Tc},p:0,findDOMNode:null},_H=Symbol.for("react.portal");function kH(e,t,n){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_H,key:s==null?null:""+s,children:e,containerInfo:t,implementation:n}}var p0=xH.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function dv(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Ui.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=zi;Ui.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(pI(299));return kH(e,t,null,n)};Ui.flushSync=function(e){var t=p0.T,n=zi.p;try{if(p0.T=null,zi.p=2,e)return e()}finally{p0.T=t,zi.p=n,zi.d.f()}};Ui.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,zi.d.C(e,t))};Ui.prefetchDNS=function(e){typeof e=="string"&&zi.d.D(e)};Ui.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,s=dv(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?zi.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:i}):n==="script"&&zi.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Ui.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=dv(t.as,t.crossOrigin);zi.d.M(e,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&zi.d.M(e)};Ui.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,s=dv(n,t.crossOrigin);zi.d.L(e,n,{crossOrigin:s,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Ui.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=dv(t.as,t.crossOrigin);zi.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else zi.d.m(e)};Ui.requestFormReset=function(e){zi.d.r(e)};Ui.unstable_batchedUpdates=function(e,t){return e(t)};Ui.useFormState=function(e,t,n){return p0.H.useFormState(e,t,n)};Ui.useFormStatus=function(){return p0.H.useHostTransitionStatus()};Ui.version="19.2.4";function gI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gI)}catch(e){console.error(e)}}gI(),mI.exports=Ui;var Op=mI.exports;/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Br=wH,yI=g,SH=Op;function Ce(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function bI(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Bp(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function vI(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function wI(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f7(e){if(Bp(e)!==e)throw Error(Ce(188))}function TH(e){var t=e.alternate;if(!t){if(t=Bp(e),t===null)throw Error(Ce(188));return t!==e?null:e}for(var n=e,s=t;;){var r=n.return;if(r===null)break;var i=r.alternate;if(i===null){if(s=r.return,s!==null){n=s;continue}break}if(r.child===i.child){for(i=r.child;i;){if(i===n)return f7(r),e;if(i===s)return f7(r),t;i=i.sibling}throw Error(Ce(188))}if(n.return!==s.return)n=r,s=i;else{for(var o=!1,a=r.child;a;){if(a===n){o=!0,n=r,s=i;break}if(a===s){o=!0,s=r,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,s=r;break}if(a===s){o=!0,s=i,n=r;break}a=a.sibling}if(!o)throw Error(Ce(189))}}if(n.alternate!==s)throw Error(Ce(190))}if(n.tag!==3)throw Error(Ce(188));return n.stateNode.current===n?e:t}function xI(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=xI(e),t!==null)return t;e=e.sibling}return null}var Hs=Object.assign,CH=Symbol.for("react.element"),Ng=Symbol.for("react.transitional.element"),Qm=Symbol.for("react.portal"),$h=Symbol.for("react.fragment"),_I=Symbol.for("react.strict_mode"),F4=Symbol.for("react.profiler"),kI=Symbol.for("react.consumer"),Kl=Symbol.for("react.context"),r5=Symbol.for("react.forward_ref"),q4=Symbol.for("react.suspense"),H4=Symbol.for("react.suspense_list"),i5=Symbol.for("react.memo"),Bc=Symbol.for("react.lazy"),U4=Symbol.for("react.activity"),AH=Symbol.for("react.memo_cache_sentinel"),m7=Symbol.iterator;function Sm(e){return e===null||typeof e!="object"?null:(e=m7&&e[m7]||e["@@iterator"],typeof e=="function"?e:null)}var EH=Symbol.for("react.client.reference");function V4(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===EH?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case $h:return"Fragment";case F4:return"Profiler";case _I:return"StrictMode";case q4:return"Suspense";case H4:return"SuspenseList";case U4:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Qm:return"Portal";case Kl:return e.displayName||"Context";case kI:return(e._context.displayName||"Context")+".Consumer";case r5:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case i5:return t=e.displayName||null,t!==null?t:V4(e.type)||"Memo";case Bc:t=e._payload,e=e._init;try{return V4(e(t))}catch{}}return null}var Xm=Array.isArray,sn=yI.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,cs=SH.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Cd={pending:!1,data:null,method:null,action:null},W4=[],zh=-1;function gl(e){return{current:e}}function Yr(e){0>zh||(e.current=W4[zh],W4[zh]=null,zh--)}function Ds(e,t){zh++,W4[zh]=e.current,e.current=t}var hl=gl(null),K0=gl(null),lu=gl(null),Ny=gl(null);function Iy(e,t){switch(Ds(lu,t),Ds(K0,e),Ds(hl,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?w9(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=w9(t),e=HR(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Yr(hl),Ds(hl,e)}function kf(){Yr(hl),Yr(K0),Yr(lu)}function G4(e){e.memoizedState!==null&&Ds(Ny,e);var t=hl.current,n=HR(t,e.type);t!==n&&(Ds(K0,e),Ds(hl,n))}function jy(e){K0.current===e&&(Yr(hl),Yr(K0)),Ny.current===e&&(Yr(Ny),ip._currentValue=Cd)}var Xw,p7;function ad(e){if(Xw===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Xw=t&&t[1]||"",p7=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Xw+e+p7}var Jw=!1;function Zw(e,t){if(!e||Jw)return"";Jw=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(m){var f=m}Reflect.construct(e,[],h)}else{try{h.call()}catch(m){f=m}e.call(h.prototype)}}else{try{throw Error()}catch(m){f=m}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(m){if(m&&f&&typeof m.stack=="string")return[m.stack,f.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=s.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var l=o.split(`
`),c=a.split(`
`);for(r=s=0;s<l.length&&!l[s].includes("DetermineComponentFrameRoot");)s++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(s===l.length||r===c.length)for(s=l.length-1,r=c.length-1;1<=s&&0<=r&&l[s]!==c[r];)r--;for(;1<=s&&0<=r;s--,r--)if(l[s]!==c[r]){if(s!==1||r!==1)do if(s--,r--,0>r||l[s]!==c[r]){var d=`
`+l[s].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=s&&0<=r);break}}}finally{Jw=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?ad(n):""}function MH(e,t){switch(e.tag){case 26:case 27:case 5:return ad(e.type);case 16:return ad("Lazy");case 13:return e.child!==t&&t!==null?ad("Suspense Fallback"):ad("Suspense");case 19:return ad("SuspenseList");case 0:case 15:return Zw(e.type,!1);case 11:return Zw(e.type.render,!1);case 1:return Zw(e.type,!0);case 31:return ad("Activity");default:return""}}function g7(e){try{var t="",n=null;do t+=MH(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
Error generating stack: `+s.message+`
`+s.stack}}var K4=Object.prototype.hasOwnProperty,o5=Br.unstable_scheduleCallback,e2=Br.unstable_cancelCallback,NH=Br.unstable_shouldYield,IH=Br.unstable_requestPaint,To=Br.unstable_now,jH=Br.unstable_getCurrentPriorityLevel,SI=Br.unstable_ImmediatePriority,TI=Br.unstable_UserBlockingPriority,Ry=Br.unstable_NormalPriority,RH=Br.unstable_LowPriority,CI=Br.unstable_IdlePriority,LH=Br.log,DH=Br.unstable_setDisableYieldValue,Pp=null,Co=null;function Xc(e){if(typeof LH=="function"&&DH(e),Co&&typeof Co.setStrictMode=="function")try{Co.setStrictMode(Pp,e)}catch{}}var Ao=Math.clz32?Math.clz32:PH,OH=Math.log,BH=Math.LN2;function PH(e){return e>>>=0,e===0?32:31-(OH(e)/BH|0)|0}var Ig=256,jg=262144,Rg=4194304;function ld(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function hv(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=s&134217727;return a!==0?(s=a&~i,s!==0?r=ld(s):(o&=a,o!==0?r=ld(o):n||(n=a&~e,n!==0&&(r=ld(n))))):(a=s&~i,a!==0?r=ld(a):o!==0?r=ld(o):n||(n=s&~e,n!==0&&(r=ld(n)))),r===0?0:t!==0&&t!==r&&!(t&i)&&(i=r&-r,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:r}function $p(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function $H(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function AI(){var e=Rg;return Rg<<=1,!(Rg&62914560)&&(Rg=4194304),e}function t2(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function zp(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function zH(e,t,n,s,r,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var a=e.entanglements,l=e.expirationTimes,c=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Ao(n),h=1<<d;a[d]=0,l[d]=-1;var f=c[d];if(f!==null)for(c[d]=null,d=0;d<f.length;d++){var m=f[d];m!==null&&(m.lane&=-536870913)}n&=~h}s!==0&&EI(e,s,0),i!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function EI(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ao(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function MI(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-Ao(n),r=1<<s;r&t|e[s]&t&&(e[s]|=t),n&=~r}}function NI(e,t){var n=t&-t;return n=n&42?1:a5(n),n&(e.suspendedLanes|t)?0:n}function a5(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function l5(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function II(){var e=cs.p;return e!==0?e:(e=window.event,e===void 0?32:eL(e.type))}function y7(e,t){var n=cs.p;try{return cs.p=e,t()}finally{cs.p=n}}var Bu=Math.random().toString(36).slice(2),si="__reactFiber$"+Bu,ao="__reactProps$"+Bu,Xf="__reactContainer$"+Bu,Y4="__reactEvents$"+Bu,FH="__reactListeners$"+Bu,qH="__reactHandles$"+Bu,b7="__reactResources$"+Bu,Fp="__reactMarker$"+Bu;function c5(e){delete e[si],delete e[ao],delete e[Y4],delete e[FH],delete e[qH]}function Fh(e){var t=e[si];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Xf]||n[si]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=T9(e);e!==null;){if(n=e[si])return n;e=T9(e)}return t}e=n,n=e.parentNode}return null}function Jf(e){if(e=e[si]||e[Xf]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Jm(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Ce(33))}function of(e){var t=e[b7];return t||(t=e[b7]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Gr(e){e[Fp]=!0}var jI=new Set,RI={};function eh(e,t){Sf(e,t),Sf(e+"Capture",t)}function Sf(e,t){for(RI[e]=t,e=0;e<t.length;e++)jI.add(t[e])}var HH=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),v7={},w7={};function UH(e){return K4.call(w7,e)?!0:K4.call(v7,e)?!1:HH.test(e)?w7[e]=!0:(v7[e]=!0,!1)}function W1(e,t,n){if(UH(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Lg(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Ll(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function Vo(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function LI(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function VH(e,t,n){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,i=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Q4(e){if(!e._valueTracker){var t=LI(e)?"checked":"value";e._valueTracker=VH(e,t,""+e[t])}}function DI(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=LI(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Ly(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var WH=/[\n"\\]/g;function Xo(e){return e.replace(WH,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function X4(e,t,n,s,r,i,o,a){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Vo(t)):e.value!==""+Vo(t)&&(e.value=""+Vo(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?J4(e,o,Vo(t)):n!=null?J4(e,o,Vo(n)):s!=null&&e.removeAttribute("value"),r==null&&i!=null&&(e.defaultChecked=!!i),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+Vo(a):e.removeAttribute("name")}function OI(e,t,n,s,r,i,o,a){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){Q4(e);return}n=n!=null?""+Vo(n):"",t=t!=null?""+Vo(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=a?e.checked:!!s,e.defaultChecked=!!s,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),Q4(e)}function J4(e,t,n){t==="number"&&Ly(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function af(e,t,n,s){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Vo(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function BI(e,t,n){if(t!=null&&(t=""+Vo(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Vo(n):""}function PI(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(Ce(92));if(Xm(s)){if(1<s.length)throw Error(Ce(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Vo(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),Q4(e)}function Tf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var GH=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function x7(e,t,n){var s=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,n):typeof n!="number"||n===0||GH.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function $I(e,t,n){if(t!=null&&typeof t!="object")throw Error(Ce(62));if(e=e.style,n!=null){for(var s in n)!n.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var r in t)s=t[r],t.hasOwnProperty(r)&&n[r]!==s&&x7(e,r,s)}else for(var i in t)t.hasOwnProperty(i)&&x7(e,i,t[i])}function u5(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var KH=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),YH=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function G1(e){return YH.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Yl(){}var Z4=null;function d5(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qh=null,lf=null;function _7(e){var t=Jf(e);if(t&&(e=t.stateNode)){var n=e[ao]||null;e:switch(e=t.stateNode,t.type){case"input":if(X4(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Xo(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var r=s[ao]||null;if(!r)throw Error(Ce(90));X4(s,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)s=n[t],s.form===e.form&&DI(s)}break e;case"textarea":BI(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&af(e,!!n.multiple,t,!1)}}}var n2=!1;function zI(e,t,n){if(n2)return e(t,n);n2=!0;try{var s=e(t);return s}finally{if(n2=!1,(qh!==null||lf!==null)&&(Sv(),qh&&(t=qh,e=lf,lf=qh=null,_7(t),e)))for(t=0;t<e.length;t++)_7(e[t])}}function Y0(e,t){var n=e.stateNode;if(n===null)return null;var s=n[ao]||null;if(s===null)return null;n=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Ce(231,t,typeof n));return n}var lc=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),e_=!1;if(lc)try{var Tm={};Object.defineProperty(Tm,"passive",{get:function(){e_=!0}}),window.addEventListener("test",Tm,Tm),window.removeEventListener("test",Tm,Tm)}catch{e_=!1}var Jc=null,h5=null,K1=null;function FI(){if(K1)return K1;var e,t=h5,n=t.length,s,r="value"in Jc?Jc.value:Jc.textContent,i=r.length;for(e=0;e<n&&t[e]===r[e];e++);var o=n-e;for(s=1;s<=o&&t[n-s]===r[i-s];s++);return K1=r.slice(e,1<s?1-s:void 0)}function Y1(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Dg(){return!0}function k7(){return!1}function uo(e){function t(n,s,r,i,o){this._reactName=n,this._targetInst=r,this.type=s,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Dg:k7,this.isPropagationStopped=k7,this}return Hs(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Dg)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Dg)},persist:function(){},isPersistent:Dg}),t}var th={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fv=uo(th),qp=Hs({},th,{view:0,detail:0}),QH=uo(qp),s2,r2,Cm,mv=Hs({},qp,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:f5,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Cm&&(Cm&&e.type==="mousemove"?(s2=e.screenX-Cm.screenX,r2=e.screenY-Cm.screenY):r2=s2=0,Cm=e),s2)},movementY:function(e){return"movementY"in e?e.movementY:r2}}),S7=uo(mv),XH=Hs({},mv,{dataTransfer:0}),JH=uo(XH),ZH=Hs({},qp,{relatedTarget:0}),i2=uo(ZH),eU=Hs({},th,{animationName:0,elapsedTime:0,pseudoElement:0}),tU=uo(eU),nU=Hs({},th,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sU=uo(nU),rU=Hs({},th,{data:0}),T7=uo(rU),iU={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oU={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},aU={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lU(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=aU[e])?!!t[e]:!1}function f5(){return lU}var cU=Hs({},qp,{key:function(e){if(e.key){var t=iU[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Y1(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?oU[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:f5,charCode:function(e){return e.type==="keypress"?Y1(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Y1(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),uU=uo(cU),dU=Hs({},mv,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),C7=uo(dU),hU=Hs({},qp,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:f5}),fU=uo(hU),mU=Hs({},th,{propertyName:0,elapsedTime:0,pseudoElement:0}),pU=uo(mU),gU=Hs({},mv,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),yU=uo(gU),bU=Hs({},th,{newState:0,oldState:0}),vU=uo(bU),wU=[9,13,27,32],m5=lc&&"CompositionEvent"in window,g0=null;lc&&"documentMode"in document&&(g0=document.documentMode);var xU=lc&&"TextEvent"in window&&!g0,qI=lc&&(!m5||g0&&8<g0&&11>=g0),A7=" ",E7=!1;function HI(e,t){switch(e){case"keyup":return wU.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function UI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hh=!1;function _U(e,t){switch(e){case"compositionend":return UI(t);case"keypress":return t.which!==32?null:(E7=!0,A7);case"textInput":return e=t.data,e===A7&&E7?null:e;default:return null}}function kU(e,t){if(Hh)return e==="compositionend"||!m5&&HI(e,t)?(e=FI(),K1=h5=Jc=null,Hh=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return qI&&t.locale!=="ko"?null:t.data;default:return null}}var SU={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function M7(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!SU[e.type]:t==="textarea"}function VI(e,t,n,s){qh?lf?lf.push(s):lf=[s]:qh=s,t=Jy(t,"onChange"),0<t.length&&(n=new fv("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var y0=null,Q0=null;function TU(e){zR(e,0)}function pv(e){var t=Jm(e);if(DI(t))return e}function N7(e,t){if(e==="change")return t}var WI=!1;if(lc){var o2;if(lc){var a2="oninput"in document;if(!a2){var I7=document.createElement("div");I7.setAttribute("oninput","return;"),a2=typeof I7.oninput=="function"}o2=a2}else o2=!1;WI=o2&&(!document.documentMode||9<document.documentMode)}function j7(){y0&&(y0.detachEvent("onpropertychange",GI),Q0=y0=null)}function GI(e){if(e.propertyName==="value"&&pv(Q0)){var t=[];VI(t,Q0,e,d5(e)),zI(TU,t)}}function CU(e,t,n){e==="focusin"?(j7(),y0=t,Q0=n,y0.attachEvent("onpropertychange",GI)):e==="focusout"&&j7()}function AU(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return pv(Q0)}function EU(e,t){if(e==="click")return pv(t)}function MU(e,t){if(e==="input"||e==="change")return pv(t)}function NU(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Io=typeof Object.is=="function"?Object.is:NU;function X0(e,t){if(Io(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(s=0;s<n.length;s++){var r=n[s];if(!K4.call(t,r)||!Io(e[r],t[r]))return!1}return!0}function R7(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function L7(e,t){var n=R7(e);e=0;for(var s;n;){if(n.nodeType===3){if(s=e+n.textContent.length,e<=t&&s>=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=R7(n)}}function KI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?KI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function YI(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ly(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ly(e.document)}return t}function p5(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var IU=lc&&"documentMode"in document&&11>=document.documentMode,Uh=null,t_=null,b0=null,n_=!1;function D7(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;n_||Uh==null||Uh!==Ly(s)||(s=Uh,"selectionStart"in s&&p5(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),b0&&X0(b0,s)||(b0=s,s=Jy(t_,"onSelect"),0<s.length&&(t=new fv("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Uh)))}function Zu(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Vh={animationend:Zu("Animation","AnimationEnd"),animationiteration:Zu("Animation","AnimationIteration"),animationstart:Zu("Animation","AnimationStart"),transitionrun:Zu("Transition","TransitionRun"),transitionstart:Zu("Transition","TransitionStart"),transitioncancel:Zu("Transition","TransitionCancel"),transitionend:Zu("Transition","TransitionEnd")},l2={},QI={};lc&&(QI=document.createElement("div").style,"AnimationEvent"in window||(delete Vh.animationend.animation,delete Vh.animationiteration.animation,delete Vh.animationstart.animation),"TransitionEvent"in window||delete Vh.transitionend.transition);function nh(e){if(l2[e])return l2[e];if(!Vh[e])return e;var t=Vh[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in QI)return l2[e]=t[n];return e}var XI=nh("animationend"),JI=nh("animationiteration"),ZI=nh("animationstart"),jU=nh("transitionrun"),RU=nh("transitionstart"),LU=nh("transitioncancel"),ej=nh("transitionend"),tj=new Map,s_="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");s_.push("scrollEnd");function Na(e,t){tj.set(e,t),eh(t,[e])}var Dy=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ho=[],Wh=0,g5=0;function gv(){for(var e=Wh,t=g5=Wh=0;t<e;){var n=Ho[t];Ho[t++]=null;var s=Ho[t];Ho[t++]=null;var r=Ho[t];Ho[t++]=null;var i=Ho[t];if(Ho[t++]=null,s!==null&&r!==null){var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}i!==0&&nj(n,r,i)}}function yv(e,t,n,s){Ho[Wh++]=e,Ho[Wh++]=t,Ho[Wh++]=n,Ho[Wh++]=s,g5|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function y5(e,t,n,s){return yv(e,t,n,s),Oy(e)}function sh(e,t){return yv(e,null,null,t),Oy(e)}function nj(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var r=!1,i=e.return;i!==null;)i.childLanes|=n,s=i.alternate,s!==null&&(s.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(r=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,r&&t!==null&&(r=31-Ao(n),e=i.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=n|536870912),i):null}function Oy(e){if(50<A0)throw A0=0,S_=null,Error(Ce(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gh={};function DU(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wo(e,t,n,s){return new DU(e,t,n,s)}function b5(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ec(e,t){var n=e.alternate;return n===null?(n=wo(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function sj(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Q1(e,t,n,s,r,i){var o=0;if(s=e,typeof e=="function")b5(e)&&(o=1);else if(typeof e=="string")o=zV(e,n,hl.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case U4:return e=wo(31,n,t,r),e.elementType=U4,e.lanes=i,e;case $h:return Ad(n.children,r,i,t);case _I:o=8,r|=24;break;case F4:return e=wo(12,n,t,r|2),e.elementType=F4,e.lanes=i,e;case q4:return e=wo(13,n,t,r),e.elementType=q4,e.lanes=i,e;case H4:return e=wo(19,n,t,r),e.elementType=H4,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Kl:o=10;break e;case kI:o=9;break e;case r5:o=11;break e;case i5:o=14;break e;case Bc:o=16,s=null;break e}o=29,n=Error(Ce(130,e===null?"null":typeof e,"")),s=null}return t=wo(o,n,t,r),t.elementType=e,t.type=s,t.lanes=i,t}function Ad(e,t,n,s){return e=wo(7,e,s,t),e.lanes=n,e}function c2(e,t,n){return e=wo(6,e,null,t),e.lanes=n,e}function rj(e){var t=wo(18,null,null,0);return t.stateNode=e,t}function u2(e,t,n){return t=wo(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var O7=new WeakMap;function Jo(e,t){if(typeof e=="object"&&e!==null){var n=O7.get(e);return n!==void 0?n:(t={value:e,source:t,stack:g7(t)},O7.set(e,t),t)}return{value:e,source:t,stack:g7(t)}}var Kh=[],Yh=0,By=null,J0=0,Wo=[],Go=0,_u=null,il=1,ol="";function Hl(e,t){Kh[Yh++]=J0,Kh[Yh++]=By,By=e,J0=t}function ij(e,t,n){Wo[Go++]=il,Wo[Go++]=ol,Wo[Go++]=_u,_u=e;var s=il;e=ol;var r=32-Ao(s)-1;s&=~(1<<r),n+=1;var i=32-Ao(t)+r;if(30<i){var o=r-r%5;i=(s&(1<<o)-1).toString(32),s>>=o,r-=o,il=1<<32-Ao(t)+r|n<<r|s,ol=i+e}else il=1<<i|n<<r|s,ol=e}function v5(e){e.return!==null&&(Hl(e,1),ij(e,1,0))}function w5(e){for(;e===By;)By=Kh[--Yh],Kh[Yh]=null,J0=Kh[--Yh],Kh[Yh]=null;for(;e===_u;)_u=Wo[--Go],Wo[Go]=null,ol=Wo[--Go],Wo[Go]=null,il=Wo[--Go],Wo[Go]=null}function oj(e,t){Wo[Go++]=il,Wo[Go++]=ol,Wo[Go++]=_u,il=t.id,ol=t.overflow,_u=e}var ri=null,zs=null,Un=!1,cu=null,Zo=!1,r_=Error(Ce(519));function ku(e){var t=Error(Ce(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Z0(Jo(t,e)),r_}function B7(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[si]=e,t[ao]=s,n){case"dialog":Dn("cancel",t),Dn("close",t);break;case"iframe":case"object":case"embed":Dn("load",t);break;case"video":case"audio":for(n=0;n<sp.length;n++)Dn(sp[n],t);break;case"source":Dn("error",t);break;case"img":case"image":case"link":Dn("error",t),Dn("load",t);break;case"details":Dn("toggle",t);break;case"input":Dn("invalid",t),OI(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Dn("invalid",t);break;case"textarea":Dn("invalid",t),PI(t,s.value,s.defaultValue,s.children)}n=s.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||s.suppressHydrationWarning===!0||qR(t.textContent,n)?(s.popover!=null&&(Dn("beforetoggle",t),Dn("toggle",t)),s.onScroll!=null&&Dn("scroll",t),s.onScrollEnd!=null&&Dn("scrollend",t),s.onClick!=null&&(t.onclick=Yl),t=!0):t=!1,t||ku(e,!0)}function P7(e){for(ri=e.return;ri;)switch(ri.tag){case 5:case 31:case 13:Zo=!1;return;case 27:case 3:Zo=!0;return;default:ri=ri.return}}function _h(e){if(e!==ri)return!1;if(!Un)return P7(e),Un=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||M_(e.type,e.memoizedProps)),n=!n),n&&zs&&ku(e),P7(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ce(317));zs=S9(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ce(317));zs=S9(e)}else t===27?(t=zs,Pu(e.type)?(e=R_,R_=null,zs=e):zs=t):zs=ri?ia(e.stateNode.nextSibling):null;return!0}function Od(){zs=ri=null,Un=!1}function d2(){var e=cu;return e!==null&&(to===null?to=e:to.push.apply(to,e),cu=null),e}function Z0(e){cu===null?cu=[e]:cu.push(e)}var i_=gl(null),rh=null,Ql=null;function Vc(e,t,n){Ds(i_,t._currentValue),t._currentValue=n}function tc(e){e._currentValue=i_.current,Yr(i_)}function o_(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function a_(e,t,n,s){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var i=r.dependencies;if(i!==null){var o=r.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=r;for(var l=0;l<t.length;l++)if(a.context===t[l]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),o_(i.return,n,e),s||(o=null);break e}i=a.next}}else if(r.tag===18){if(o=r.return,o===null)throw Error(Ce(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),o_(o,n,e),o=null}else o=r.child;if(o!==null)o.return=r;else for(o=r;o!==null;){if(o===e){o=null;break}if(r=o.sibling,r!==null){r.return=o.return,o=r;break}o=o.return}r=o}}function Zf(e,t,n,s){e=null;for(var r=t,i=!1;r!==null;){if(!i){if(r.flags&524288)i=!0;else if(r.flags&262144)break}if(r.tag===10){var o=r.alternate;if(o===null)throw Error(Ce(387));if(o=o.memoizedProps,o!==null){var a=r.type;Io(r.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(r===Ny.current){if(o=r.alternate,o===null)throw Error(Ce(387));o.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(ip):e=[ip])}r=r.return}e!==null&&a_(t,e,n,s),t.flags|=262144}function Py(e){for(e=e.firstContext;e!==null;){if(!Io(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Bd(e){rh=e,Ql=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ii(e){return aj(rh,e)}function Og(e,t){return rh===null&&Bd(e),aj(e,t)}function aj(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ql===null){if(e===null)throw Error(Ce(308));Ql=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ql=Ql.next=t;return n}var OU=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},BU=Br.unstable_scheduleCallback,PU=Br.unstable_NormalPriority,kr={$$typeof:Kl,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function x5(){return{controller:new OU,data:new Map,refCount:0}}function Hp(e){e.refCount--,e.refCount===0&&BU(PU,function(){e.controller.abort()})}var v0=null,l_=0,Cf=0,cf=null;function $U(e,t){if(v0===null){var n=v0=[];l_=0,Cf=W5(),cf={status:"pending",value:void 0,then:function(s){n.push(s)}}}return l_++,t.then($7,$7),t}function $7(){if(--l_===0&&v0!==null){cf!==null&&(cf.status="fulfilled");var e=v0;v0=null,Cf=0,cf=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function zU(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(s.status="rejected",s.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),s}var z7=sn.S;sn.S=function(e,t){xR=To(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&$U(e,t),z7!==null&&z7(e,t)};var Ed=gl(null);function _5(){var e=Ed.current;return e!==null?e:Ms.pooledCache}function X1(e,t){t===null?Ds(Ed,Ed.current):Ds(Ed,t.pool)}function lj(){var e=_5();return e===null?null:{parent:kr._currentValue,pool:e}}var em=Error(Ce(460)),k5=Error(Ce(474)),bv=Error(Ce(542)),$y={then:function(){}};function F7(e){return e=e.status,e==="fulfilled"||e==="rejected"}function cj(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yl,Yl),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,H7(e),e;default:if(typeof t.status=="string")t.then(Yl,Yl);else{if(e=Ms,e!==null&&100<e.shellSuspendCounter)throw Error(Ce(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=s}},function(s){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,H7(e),e}throw Md=t,em}}function cd(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Md=n,em):n}}var Md=null;function q7(){if(Md===null)throw Error(Ce(459));var e=Md;return Md=null,e}function H7(e){if(e===em||e===bv)throw Error(Ce(483))}var uf=null,ep=0;function Bg(e){var t=ep;return ep+=1,uf===null&&(uf=[]),cj(uf,e,t)}function Am(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Pg(e,t){throw t.$$typeof===CH?Error(Ce(525)):(e=Object.prototype.toString.call(t),Error(Ce(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function uj(e){function t(b,v){if(e){var x=b.deletions;x===null?(b.deletions=[v],b.flags|=16):x.push(v)}}function n(b,v){if(!e)return null;for(;v!==null;)t(b,v),v=v.sibling;return null}function s(b){for(var v=new Map;b!==null;)b.key!==null?v.set(b.key,b):v.set(b.index,b),b=b.sibling;return v}function r(b,v){return b=ec(b,v),b.index=0,b.sibling=null,b}function i(b,v,x){return b.index=x,e?(x=b.alternate,x!==null?(x=x.index,x<v?(b.flags|=67108866,v):x):(b.flags|=67108866,v)):(b.flags|=1048576,v)}function o(b){return e&&b.alternate===null&&(b.flags|=67108866),b}function a(b,v,x,_){return v===null||v.tag!==6?(v=c2(x,b.mode,_),v.return=b,v):(v=r(v,x),v.return=b,v)}function l(b,v,x,_){var E=x.type;return E===$h?d(b,v,x.props.children,_,x.key):v!==null&&(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Bc&&cd(E)===v.type)?(v=r(v,x.props),Am(v,x),v.return=b,v):(v=Q1(x.type,x.key,x.props,null,b.mode,_),Am(v,x),v.return=b,v)}function c(b,v,x,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=u2(x,b.mode,_),v.return=b,v):(v=r(v,x.children||[]),v.return=b,v)}function d(b,v,x,_,E){return v===null||v.tag!==7?(v=Ad(x,b.mode,_,E),v.return=b,v):(v=r(v,x),v.return=b,v)}function h(b,v,x){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=c2(""+v,b.mode,x),v.return=b,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ng:return x=Q1(v.type,v.key,v.props,null,b.mode,x),Am(x,v),x.return=b,x;case Qm:return v=u2(v,b.mode,x),v.return=b,v;case Bc:return v=cd(v),h(b,v,x)}if(Xm(v)||Sm(v))return v=Ad(v,b.mode,x,null),v.return=b,v;if(typeof v.then=="function")return h(b,Bg(v),x);if(v.$$typeof===Kl)return h(b,Og(b,v),x);Pg(b,v)}return null}function f(b,v,x,_){var E=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return E!==null?null:a(b,v,""+x,_);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Ng:return x.key===E?l(b,v,x,_):null;case Qm:return x.key===E?c(b,v,x,_):null;case Bc:return x=cd(x),f(b,v,x,_)}if(Xm(x)||Sm(x))return E!==null?null:d(b,v,x,_,null);if(typeof x.then=="function")return f(b,v,Bg(x),_);if(x.$$typeof===Kl)return f(b,v,Og(b,x),_);Pg(b,x)}return null}function m(b,v,x,_,E){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return b=b.get(x)||null,a(v,b,""+_,E);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case Ng:return b=b.get(_.key===null?x:_.key)||null,l(v,b,_,E);case Qm:return b=b.get(_.key===null?x:_.key)||null,c(v,b,_,E);case Bc:return _=cd(_),m(b,v,x,_,E)}if(Xm(_)||Sm(_))return b=b.get(x)||null,d(v,b,_,E,null);if(typeof _.then=="function")return m(b,v,x,Bg(_),E);if(_.$$typeof===Kl)return m(b,v,x,Og(v,_),E);Pg(v,_)}return null}function p(b,v,x,_){for(var E=null,k=null,M=v,R=v=0,L=null;M!==null&&R<x.length;R++){M.index>R?(L=M,M=null):L=M.sibling;var T=f(b,M,x[R],_);if(T===null){M===null&&(M=L);break}e&&M&&T.alternate===null&&t(b,M),v=i(T,v,R),k===null?E=T:k.sibling=T,k=T,M=L}if(R===x.length)return n(b,M),Un&&Hl(b,R),E;if(M===null){for(;R<x.length;R++)M=h(b,x[R],_),M!==null&&(v=i(M,v,R),k===null?E=M:k.sibling=M,k=M);return Un&&Hl(b,R),E}for(M=s(M);R<x.length;R++)L=m(M,b,R,x[R],_),L!==null&&(e&&L.alternate!==null&&M.delete(L.key===null?R:L.key),v=i(L,v,R),k===null?E=L:k.sibling=L,k=L);return e&&M.forEach(function(N){return t(b,N)}),Un&&Hl(b,R),E}function y(b,v,x,_){if(x==null)throw Error(Ce(151));for(var E=null,k=null,M=v,R=v=0,L=null,T=x.next();M!==null&&!T.done;R++,T=x.next()){M.index>R?(L=M,M=null):L=M.sibling;var N=f(b,M,T.value,_);if(N===null){M===null&&(M=L);break}e&&M&&N.alternate===null&&t(b,M),v=i(N,v,R),k===null?E=N:k.sibling=N,k=N,M=L}if(T.done)return n(b,M),Un&&Hl(b,R),E;if(M===null){for(;!T.done;R++,T=x.next())T=h(b,T.value,_),T!==null&&(v=i(T,v,R),k===null?E=T:k.sibling=T,k=T);return Un&&Hl(b,R),E}for(M=s(M);!T.done;R++,T=x.next())T=m(M,b,R,T.value,_),T!==null&&(e&&T.alternate!==null&&M.delete(T.key===null?R:T.key),v=i(T,v,R),k===null?E=T:k.sibling=T,k=T);return e&&M.forEach(function(I){return t(b,I)}),Un&&Hl(b,R),E}function w(b,v,x,_){if(typeof x=="object"&&x!==null&&x.type===$h&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Ng:e:{for(var E=x.key;v!==null;){if(v.key===E){if(E=x.type,E===$h){if(v.tag===7){n(b,v.sibling),_=r(v,x.props.children),_.return=b,b=_;break e}}else if(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Bc&&cd(E)===v.type){n(b,v.sibling),_=r(v,x.props),Am(_,x),_.return=b,b=_;break e}n(b,v);break}else t(b,v);v=v.sibling}x.type===$h?(_=Ad(x.props.children,b.mode,_,x.key),_.return=b,b=_):(_=Q1(x.type,x.key,x.props,null,b.mode,_),Am(_,x),_.return=b,b=_)}return o(b);case Qm:e:{for(E=x.key;v!==null;){if(v.key===E)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(b,v.sibling),_=r(v,x.children||[]),_.return=b,b=_;break e}else{n(b,v);break}else t(b,v);v=v.sibling}_=u2(x,b.mode,_),_.return=b,b=_}return o(b);case Bc:return x=cd(x),w(b,v,x,_)}if(Xm(x))return p(b,v,x,_);if(Sm(x)){if(E=Sm(x),typeof E!="function")throw Error(Ce(150));return x=E.call(x),y(b,v,x,_)}if(typeof x.then=="function")return w(b,v,Bg(x),_);if(x.$$typeof===Kl)return w(b,v,Og(b,x),_);Pg(b,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(b,v.sibling),_=r(v,x),_.return=b,b=_):(n(b,v),_=c2(x,b.mode,_),_.return=b,b=_),o(b)):n(b,v)}return function(b,v,x,_){try{ep=0;var E=w(b,v,x,_);return uf=null,E}catch(M){if(M===em||M===bv)throw M;var k=wo(29,M,null,b.mode);return k.lanes=_,k.return=b,k}finally{}}}var Pd=uj(!0),dj=uj(!1),Pc=!1;function S5(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function c_(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function uu(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function du(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,as&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=Oy(e),nj(e,null,n),t}return yv(e,s,t,n),Oy(e)}function w0(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,MI(e,n)}}function h2(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var r=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?r=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?r=i=t:i=i.next=t}else r=i=t;n={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:i,shared:s.shared,callbacks:s.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var u_=!1;function x0(){if(u_){var e=cf;if(e!==null)throw e}}function _0(e,t,n,s){u_=!1;var r=e.updateQueue;Pc=!1;var i=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var h=r.baseState;o=0,d=c=l=null,a=i;do{var f=a.lane&-536870913,m=f!==a.lane;if(m?(Fn&f)===f:(s&f)===f){f!==0&&f===Cf&&(u_=!0),d!==null&&(d=d.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var p=e,y=a;f=t;var w=n;switch(y.tag){case 1:if(p=y.payload,typeof p=="function"){h=p.call(w,h,f);break e}h=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=y.payload,f=typeof p=="function"?p.call(w,h,f):p,f==null)break e;h=Hs({},h,f);break e;case 2:Pc=!0}}f=a.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=r.callbacks,m===null?r.callbacks=[f]:m.push(f))}else m={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=m,l=h):d=d.next=m,o|=f;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;m=a,a=m.next,m.next=null,r.lastBaseUpdate=m,r.shared.pending=null}}while(!0);d===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,i===null&&(r.shared.lanes=0),Tu|=o,e.lanes=o,e.memoizedState=h}}function hj(e,t){if(typeof e!="function")throw Error(Ce(191,e));e.call(t)}function fj(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)hj(n[e],t)}var Af=gl(null),zy=gl(0);function U7(e,t){e=hc,Ds(zy,e),Ds(Af,t),hc=e|t.baseLanes}function d_(){Ds(zy,hc),Ds(Af,Af.current)}function T5(){hc=zy.current,Yr(Af),Yr(zy)}var jo=gl(null),ra=null;function Wc(e){var t=e.alternate;Ds(pr,pr.current&1),Ds(jo,e),ra===null&&(t===null||Af.current!==null||t.memoizedState!==null)&&(ra=e)}function h_(e){Ds(pr,pr.current),Ds(jo,e),ra===null&&(ra=e)}function mj(e){e.tag===22?(Ds(pr,pr.current),Ds(jo,e),ra===null&&(ra=e)):Gc()}function Gc(){Ds(pr,pr.current),Ds(jo,jo.current)}function vo(e){Yr(jo),ra===e&&(ra=null),Yr(pr)}var pr=gl(0);function Fy(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||I_(n)||j_(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var cc=0,Tn=null,xs=null,wr=null,qy=!1,df=!1,$d=!1,Hy=0,tp=0,hf=null,FU=0;function or(){throw Error(Ce(321))}function C5(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Io(e[n],t[n]))return!1;return!0}function A5(e,t,n,s,r,i){return cc=i,Tn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,sn.H=e===null||e.memoizedState===null?Vj:P5,$d=!1,i=n(s,r),$d=!1,df&&(i=gj(t,n,s,r)),pj(e),i}function pj(e){sn.H=np;var t=xs!==null&&xs.next!==null;if(cc=0,wr=xs=Tn=null,qy=!1,tp=0,hf=null,t)throw Error(Ce(300));e===null||Sr||(e=e.dependencies,e!==null&&Py(e)&&(Sr=!0))}function gj(e,t,n,s){Tn=e;var r=0;do{if(df&&(hf=null),tp=0,df=!1,25<=r)throw Error(Ce(301));if(r+=1,wr=xs=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}sn.H=Wj,i=t(n,s)}while(df);return i}function qU(){var e=sn.H,t=e.useState()[0];return t=typeof t.then=="function"?Up(t):t,e=e.useState()[0],(xs!==null?xs.memoizedState:null)!==e&&(Tn.flags|=1024),t}function E5(){var e=Hy!==0;return Hy=0,e}function M5(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function N5(e){if(qy){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}qy=!1}cc=0,wr=xs=Tn=null,df=!1,tp=Hy=0,hf=null}function Ri(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wr===null?Tn.memoizedState=wr=e:wr=wr.next=e,wr}function gr(){if(xs===null){var e=Tn.alternate;e=e!==null?e.memoizedState:null}else e=xs.next;var t=wr===null?Tn.memoizedState:wr.next;if(t!==null)wr=t,xs=e;else{if(e===null)throw Tn.alternate===null?Error(Ce(467)):Error(Ce(310));xs=e,e={memoizedState:xs.memoizedState,baseState:xs.baseState,baseQueue:xs.baseQueue,queue:xs.queue,next:null},wr===null?Tn.memoizedState=wr=e:wr=wr.next=e}return wr}function vv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Up(e){var t=tp;return tp+=1,hf===null&&(hf=[]),e=cj(hf,e,t),t=Tn,(wr===null?t.memoizedState:wr.next)===null&&(t=t.alternate,sn.H=t===null||t.memoizedState===null?Vj:P5),e}function wv(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Up(e);if(e.$$typeof===Kl)return ii(e)}throw Error(Ce(438,String(e)))}function I5(e){var t=null,n=Tn.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=Tn.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=vv(),Tn.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=AH;return t.index++,n}function uc(e,t){return typeof t=="function"?t(e):t}function J1(e){var t=gr();return j5(t,xs,e)}function j5(e,t,n){var s=e.queue;if(s===null)throw Error(Ce(311));s.lastRenderedReducer=n;var r=e.baseQueue,i=s.pending;if(i!==null){if(r!==null){var o=r.next;r.next=i.next,i.next=o}t.baseQueue=r=i,s.pending=null}if(i=e.baseState,r===null)e.memoizedState=i;else{t=r.next;var a=o=null,l=null,c=t,d=!1;do{var h=c.lane&-536870913;if(h!==c.lane?(Fn&h)===h:(cc&h)===h){var f=c.revertLane;if(f===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),h===Cf&&(d=!0);else if((cc&f)===f){c=c.next,f===Cf&&(d=!0);continue}else h={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=h,o=i):l=l.next=h,Tn.lanes|=f,Tu|=f;h=c.action,$d&&n(i,h),i=c.hasEagerState?c.eagerState:n(i,h)}else f={lane:h,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=f,o=i):l=l.next=f,Tn.lanes|=h,Tu|=h;c=c.next}while(c!==null&&c!==t);if(l===null?o=i:l.next=a,!Io(i,e.memoizedState)&&(Sr=!0,d&&(n=cf,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=l,s.lastRenderedState=i}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function f2(e){var t=gr(),n=t.queue;if(n===null)throw Error(Ce(311));n.lastRenderedReducer=e;var s=n.dispatch,r=n.pending,i=t.memoizedState;if(r!==null){n.pending=null;var o=r=r.next;do i=e(i,o.action),o=o.next;while(o!==r);Io(i,t.memoizedState)||(Sr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,s]}function yj(e,t,n){var s=Tn,r=gr(),i=Un;if(i){if(n===void 0)throw Error(Ce(407));n=n()}else n=t();var o=!Io((xs||r).memoizedState,n);if(o&&(r.memoizedState=n,Sr=!0),r=r.queue,R5(wj.bind(null,s,r,e),[e]),r.getSnapshot!==t||o||wr!==null&&wr.memoizedState.tag&1){if(s.flags|=2048,Ef(9,{destroy:void 0},vj.bind(null,s,r,n,t),null),Ms===null)throw Error(Ce(349));i||cc&127||bj(s,t,n)}return n}function bj(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Tn.updateQueue,t===null?(t=vv(),Tn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function vj(e,t,n,s){t.value=n,t.getSnapshot=s,xj(t)&&_j(e)}function wj(e,t,n){return n(function(){xj(t)&&_j(e)})}function xj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Io(e,n)}catch{return!0}}function _j(e){var t=sh(e,2);t!==null&&oo(t,e,2)}function f_(e){var t=Ri();if(typeof e=="function"){var n=e;if(e=n(),$d){Xc(!0);try{n()}finally{Xc(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uc,lastRenderedState:e},t}function kj(e,t,n,s){return e.baseState=n,j5(e,xs,typeof s=="function"?s:uc)}function HU(e,t,n,s,r){if(_v(e))throw Error(Ce(485));if(e=t.action,e!==null){var i={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};sn.T!==null?n(!0):i.isTransition=!1,s(i),n=t.pending,n===null?(i.next=t.pending=i,Sj(t,i)):(i.next=n.next,t.pending=n.next=i)}}function Sj(e,t){var n=t.action,s=t.payload,r=e.state;if(t.isTransition){var i=sn.T,o={};sn.T=o;try{var a=n(r,s),l=sn.S;l!==null&&l(o,a),V7(e,t,a)}catch(c){m_(e,t,c)}finally{i!==null&&o.types!==null&&(i.types=o.types),sn.T=i}}else try{i=n(r,s),V7(e,t,i)}catch(c){m_(e,t,c)}}function V7(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){W7(e,t,s)},function(s){return m_(e,t,s)}):W7(e,t,n)}function W7(e,t,n){t.status="fulfilled",t.value=n,Tj(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Sj(e,n)))}function m_(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,Tj(t),t=t.next;while(t!==s)}e.action=null}function Tj(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Cj(e,t){return t}function G7(e,t){if(Un){var n=Ms.formState;if(n!==null){e:{var s=Tn;if(Un){if(zs){t:{for(var r=zs,i=Zo;r.nodeType!==8;){if(!i){r=null;break t}if(r=ia(r.nextSibling),r===null){r=null;break t}}i=r.data,r=i==="F!"||i==="F"?r:null}if(r){zs=ia(r.nextSibling),s=r.data==="F!";break e}}ku(s)}s=!1}s&&(t=n[0])}}return n=Ri(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cj,lastRenderedState:t},n.queue=s,n=qj.bind(null,Tn,s),s.dispatch=n,s=f_(!1),i=B5.bind(null,Tn,!1,s.queue),s=Ri(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,n=HU.bind(null,Tn,r,i,n),r.dispatch=n,s.memoizedState=e,[t,n,!1]}function K7(e){var t=gr();return Aj(t,xs,e)}function Aj(e,t,n){if(t=j5(e,t,Cj)[0],e=J1(uc)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Up(t)}catch(o){throw o===em?bv:o}else s=t;t=gr();var r=t.queue,i=r.dispatch;return n!==t.memoizedState&&(Tn.flags|=2048,Ef(9,{destroy:void 0},UU.bind(null,r,n),null)),[s,i,e]}function UU(e,t){e.action=t}function Y7(e){var t=gr(),n=xs;if(n!==null)return Aj(t,n,e);gr(),t=t.memoizedState,n=gr();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function Ef(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=Tn.updateQueue,t===null&&(t=vv(),Tn.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function Ej(){return gr().memoizedState}function Z1(e,t,n,s){var r=Ri();Tn.flags|=e,r.memoizedState=Ef(1|t,{destroy:void 0},n,s===void 0?null:s)}function xv(e,t,n,s){var r=gr();s=s===void 0?null:s;var i=r.memoizedState.inst;xs!==null&&s!==null&&C5(s,xs.memoizedState.deps)?r.memoizedState=Ef(t,i,n,s):(Tn.flags|=e,r.memoizedState=Ef(1|t,i,n,s))}function Q7(e,t){Z1(8390656,8,e,t)}function R5(e,t){xv(2048,8,e,t)}function VU(e){Tn.flags|=4;var t=Tn.updateQueue;if(t===null)t=vv(),Tn.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Mj(e){var t=gr().memoizedState;return VU({ref:t,nextImpl:e}),function(){if(as&2)throw Error(Ce(440));return t.impl.apply(void 0,arguments)}}function Nj(e,t){return xv(4,2,e,t)}function Ij(e,t){return xv(4,4,e,t)}function jj(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Rj(e,t,n){n=n!=null?n.concat([e]):null,xv(4,4,jj.bind(null,t,e),n)}function L5(){}function Lj(e,t){var n=gr();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&C5(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function Dj(e,t){var n=gr();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&C5(t,s[1]))return s[0];if(s=e(),$d){Xc(!0);try{e()}finally{Xc(!1)}}return n.memoizedState=[s,t],s}function D5(e,t,n){return n===void 0||cc&1073741824&&!(Fn&261930)?e.memoizedState=t:(e.memoizedState=n,e=kR(),Tn.lanes|=e,Tu|=e,n)}function Oj(e,t,n,s){return Io(n,t)?n:Af.current!==null?(e=D5(e,n,s),Io(e,t)||(Sr=!0),e):!(cc&42)||cc&1073741824&&!(Fn&261930)?(Sr=!0,e.memoizedState=n):(e=kR(),Tn.lanes|=e,Tu|=e,t)}function Bj(e,t,n,s,r){var i=cs.p;cs.p=i!==0&&8>i?i:8;var o=sn.T,a={};sn.T=a,B5(e,!1,t,n);try{var l=r(),c=sn.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var d=zU(l,s);k0(e,t,d,Eo(e))}else k0(e,t,s,Eo(e))}catch(h){k0(e,t,{then:function(){},status:"rejected",reason:h},Eo())}finally{cs.p=i,o!==null&&a.types!==null&&(o.types=a.types),sn.T=o}}function WU(){}function p_(e,t,n,s){if(e.tag!==5)throw Error(Ce(476));var r=Pj(e).queue;Bj(e,r,t,Cd,n===null?WU:function(){return $j(e),n(s)})}function Pj(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Cd,baseState:Cd,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:uc,lastRenderedState:Cd},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:uc,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function $j(e){var t=Pj(e);t.next===null&&(t=e.alternate.memoizedState),k0(e,t.next.queue,{},Eo())}function O5(){return ii(ip)}function zj(){return gr().memoizedState}function Fj(){return gr().memoizedState}function GU(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Eo();e=uu(n);var s=du(t,e,n);s!==null&&(oo(s,t,n),w0(s,t,n)),t={cache:x5()},e.payload=t;return}t=t.return}}function KU(e,t,n){var s=Eo();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},_v(e)?Hj(t,n):(n=y5(e,t,n,s),n!==null&&(oo(n,e,s),Uj(n,t,s)))}function qj(e,t,n){var s=Eo();k0(e,t,n,s)}function k0(e,t,n,s){var r={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(_v(e))Hj(t,r);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(r.hasEagerState=!0,r.eagerState=a,Io(a,o))return yv(e,t,r,0),Ms===null&&gv(),!1}catch{}finally{}if(n=y5(e,t,r,s),n!==null)return oo(n,e,s),Uj(n,t,s),!0}return!1}function B5(e,t,n,s){if(s={lane:2,revertLane:W5(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},_v(e)){if(t)throw Error(Ce(479))}else t=y5(e,n,s,2),t!==null&&oo(t,e,2)}function _v(e){var t=e.alternate;return e===Tn||t!==null&&t===Tn}function Hj(e,t){df=qy=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Uj(e,t,n){if(n&4194048){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,MI(e,n)}}var np={readContext:ii,use:wv,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useLayoutEffect:or,useInsertionEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useSyncExternalStore:or,useId:or,useHostTransitionStatus:or,useFormState:or,useActionState:or,useOptimistic:or,useMemoCache:or,useCacheRefresh:or};np.useEffectEvent=or;var Vj={readContext:ii,use:wv,useCallback:function(e,t){return Ri().memoizedState=[e,t===void 0?null:t],e},useContext:ii,useEffect:Q7,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Z1(4194308,4,jj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Z1(4194308,4,e,t)},useInsertionEffect:function(e,t){Z1(4,2,e,t)},useMemo:function(e,t){var n=Ri();t=t===void 0?null:t;var s=e();if($d){Xc(!0);try{e()}finally{Xc(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=Ri();if(n!==void 0){var r=n(t);if($d){Xc(!0);try{n(t)}finally{Xc(!1)}}}else r=t;return s.memoizedState=s.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=KU.bind(null,Tn,e),[s.memoizedState,e]},useRef:function(e){var t=Ri();return e={current:e},t.memoizedState=e},useState:function(e){e=f_(e);var t=e.queue,n=qj.bind(null,Tn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:L5,useDeferredValue:function(e,t){var n=Ri();return D5(n,e,t)},useTransition:function(){var e=f_(!1);return e=Bj.bind(null,Tn,e.queue,!0,!1),Ri().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=Tn,r=Ri();if(Un){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=t(),Ms===null)throw Error(Ce(349));Fn&127||bj(s,t,n)}r.memoizedState=n;var i={value:n,getSnapshot:t};return r.queue=i,Q7(wj.bind(null,s,i,e),[e]),s.flags|=2048,Ef(9,{destroy:void 0},vj.bind(null,s,i,n,t),null),n},useId:function(){var e=Ri(),t=Ms.identifierPrefix;if(Un){var n=ol,s=il;n=(s&~(1<<32-Ao(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Hy++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=FU++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:O5,useFormState:G7,useActionState:G7,useOptimistic:function(e){var t=Ri();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=B5.bind(null,Tn,!0,n),n.dispatch=t,[e,t]},useMemoCache:I5,useCacheRefresh:function(){return Ri().memoizedState=GU.bind(null,Tn)},useEffectEvent:function(e){var t=Ri(),n={impl:e};return t.memoizedState=n,function(){if(as&2)throw Error(Ce(440));return n.impl.apply(void 0,arguments)}}},P5={readContext:ii,use:wv,useCallback:Lj,useContext:ii,useEffect:R5,useImperativeHandle:Rj,useInsertionEffect:Nj,useLayoutEffect:Ij,useMemo:Dj,useReducer:J1,useRef:Ej,useState:function(){return J1(uc)},useDebugValue:L5,useDeferredValue:function(e,t){var n=gr();return Oj(n,xs.memoizedState,e,t)},useTransition:function(){var e=J1(uc)[0],t=gr().memoizedState;return[typeof e=="boolean"?e:Up(e),t]},useSyncExternalStore:yj,useId:zj,useHostTransitionStatus:O5,useFormState:K7,useActionState:K7,useOptimistic:function(e,t){var n=gr();return kj(n,xs,e,t)},useMemoCache:I5,useCacheRefresh:Fj};P5.useEffectEvent=Mj;var Wj={readContext:ii,use:wv,useCallback:Lj,useContext:ii,useEffect:R5,useImperativeHandle:Rj,useInsertionEffect:Nj,useLayoutEffect:Ij,useMemo:Dj,useReducer:f2,useRef:Ej,useState:function(){return f2(uc)},useDebugValue:L5,useDeferredValue:function(e,t){var n=gr();return xs===null?D5(n,e,t):Oj(n,xs.memoizedState,e,t)},useTransition:function(){var e=f2(uc)[0],t=gr().memoizedState;return[typeof e=="boolean"?e:Up(e),t]},useSyncExternalStore:yj,useId:zj,useHostTransitionStatus:O5,useFormState:Y7,useActionState:Y7,useOptimistic:function(e,t){var n=gr();return xs!==null?kj(n,xs,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:I5,useCacheRefresh:Fj};Wj.useEffectEvent=Mj;function m2(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:Hs({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var g_={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Eo(),r=uu(s);r.payload=t,n!=null&&(r.callback=n),t=du(e,r,s),t!==null&&(oo(t,e,s),w0(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Eo(),r=uu(s);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=du(e,r,s),t!==null&&(oo(t,e,s),w0(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Eo(),s=uu(n);s.tag=2,t!=null&&(s.callback=t),t=du(e,s,n),t!==null&&(oo(t,e,n),w0(t,e,n))}};function X7(e,t,n,s,r,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,o):t.prototype&&t.prototype.isPureReactComponent?!X0(n,s)||!X0(r,i):!0}function J7(e,t,n,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,s),t.state!==e&&g_.enqueueReplaceState(t,t.state,null)}function zd(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=Hs({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function Gj(e){Dy(e)}function Kj(e){console.error(e)}function Yj(e){Dy(e)}function Uy(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Z7(e,t,n){try{var s=e.onCaughtError;s(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function y_(e,t,n){return n=uu(n),n.tag=3,n.payload={element:null},n.callback=function(){Uy(e,t)},n}function Qj(e){return e=uu(e),e.tag=3,e}function Xj(e,t,n,s){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=s.value;e.payload=function(){return r(i)},e.callback=function(){Z7(t,n,s)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){Z7(t,n,s),typeof r!="function"&&(hu===null?hu=new Set([this]):hu.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function YU(e,t,n,s,r){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Zf(t,n,r,!0),n=jo.current,n!==null){switch(n.tag){case 31:case 13:return ra===null?Yy():n.alternate===null&&lr===0&&(lr=3),n.flags&=-257,n.flags|=65536,n.lanes=r,s===$y?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),T2(e,s,r)),!1;case 22:return n.flags|=65536,s===$y?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([s]):n.add(s)),T2(e,s,r)),!1}throw Error(Ce(435,n.tag))}return T2(e,s,r),Yy(),!1}if(Un)return t=jo.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==r_&&(e=Error(Ce(422),{cause:s}),Z0(Jo(e,n)))):(s!==r_&&(t=Error(Ce(423),{cause:s}),Z0(Jo(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=Jo(s,n),r=y_(e.stateNode,s,r),h2(e,r),lr!==4&&(lr=2)),!1;var i=Error(Ce(520),{cause:s});if(i=Jo(i,n),C0===null?C0=[i]:C0.push(i),lr!==4&&(lr=2),t===null)return!0;s=Jo(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=y_(n.stateNode,s,e),h2(n,e),!1;case 1:if(t=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(hu===null||!hu.has(i))))return n.flags|=65536,r&=-r,n.lanes|=r,r=Qj(r),Xj(r,e,n,s),h2(n,r),!1}n=n.return}while(n!==null);return!1}var $5=Error(Ce(461)),Sr=!1;function Zr(e,t,n,s){t.child=e===null?dj(t,null,n,s):Pd(t,e.child,n,s)}function e9(e,t,n,s,r){n=n.render;var i=t.ref;if("ref"in s){var o={};for(var a in s)a!=="ref"&&(o[a]=s[a])}else o=s;return Bd(t),s=A5(e,t,n,o,i,r),a=E5(),e!==null&&!Sr?(M5(e,t,r),dc(e,t,r)):(Un&&a&&v5(t),t.flags|=1,Zr(e,t,s,r),t.child)}function t9(e,t,n,s,r){if(e===null){var i=n.type;return typeof i=="function"&&!b5(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,Jj(e,t,i,s,r)):(e=Q1(n.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!z5(e,r)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:X0,n(o,s)&&e.ref===t.ref)return dc(e,t,r)}return t.flags|=1,e=ec(i,s),e.ref=t.ref,e.return=t,t.child=e}function Jj(e,t,n,s,r){if(e!==null){var i=e.memoizedProps;if(X0(i,s)&&e.ref===t.ref)if(Sr=!1,t.pendingProps=s=i,z5(e,r))e.flags&131072&&(Sr=!0);else return t.lanes=e.lanes,dc(e,t,r)}return b_(e,t,n,s,r)}function Zj(e,t,n,s){var r=s.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(s=t.child=e.child,r=0;s!==null;)r=r|s.lanes|s.childLanes,s=s.sibling;s=r&~i}else s=0,t.child=null;return n9(e,t,i,n,s)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&X1(t,i!==null?i.cachePool:null),i!==null?U7(t,i):d_(),mj(t);else return s=t.lanes=536870912,n9(e,t,i!==null?i.baseLanes|n:n,n,s)}else i!==null?(X1(t,i.cachePool),U7(t,i),Gc(),t.memoizedState=null):(e!==null&&X1(t,null),d_(),Gc());return Zr(e,t,r,n),t.child}function Zm(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function n9(e,t,n,s,r){var i=_5();return i=i===null?null:{parent:kr._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&X1(t,null),d_(),mj(t),e!==null&&Zf(e,t,s,!0),t.childLanes=r,null}function ey(e,t){return t=Vy({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function s9(e,t,n){return Pd(t,e.child,null,n),e=ey(t,t.pendingProps),e.flags|=2,vo(t),t.memoizedState=null,e}function QU(e,t,n){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Un){if(s.mode==="hidden")return e=ey(t,s),t.lanes=536870912,Zm(null,e);if(h_(t),(e=zs)?(e=VR(e,Zo),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_u!==null?{id:il,overflow:ol}:null,retryLane:536870912,hydrationErrors:null},n=rj(e),n.return=t,t.child=n,ri=t,zs=null)):e=null,e===null)throw ku(t);return t.lanes=536870912,null}return ey(t,s)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(h_(t),r)if(t.flags&256)t.flags&=-257,t=s9(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(Ce(558));else if(Sr||Zf(e,t,n,!1),r=(n&e.childLanes)!==0,Sr||r){if(s=Ms,s!==null&&(o=NI(s,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,sh(e,o),oo(s,e,o),$5;Yy(),t=s9(e,t,n)}else e=i.treeContext,zs=ia(o.nextSibling),ri=t,Un=!0,cu=null,Zo=!1,e!==null&&oj(t,e),t=ey(t,s),t.flags|=4096;return t}return e=ec(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ty(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(Ce(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function b_(e,t,n,s,r){return Bd(t),n=A5(e,t,n,s,void 0,r),s=E5(),e!==null&&!Sr?(M5(e,t,r),dc(e,t,r)):(Un&&s&&v5(t),t.flags|=1,Zr(e,t,n,r),t.child)}function r9(e,t,n,s,r,i){return Bd(t),t.updateQueue=null,n=gj(t,s,n,r),pj(e),s=E5(),e!==null&&!Sr?(M5(e,t,i),dc(e,t,i)):(Un&&s&&v5(t),t.flags|=1,Zr(e,t,n,i),t.child)}function i9(e,t,n,s,r){if(Bd(t),t.stateNode===null){var i=Gh,o=n.contextType;typeof o=="object"&&o!==null&&(i=ii(o)),i=new n(s,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=g_,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=s,i.state=t.memoizedState,i.refs={},S5(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?ii(o):Gh,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(m2(t,n,o,s),i.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(o=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),o!==i.state&&g_.enqueueReplaceState(i,i.state,null),_0(t,s,i,r),x0(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,l=zd(n,a);i.props=l;var c=i.context,d=n.contextType;o=Gh,typeof d=="object"&&d!==null&&(o=ii(d));var h=n.getDerivedStateFromProps;d=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||c!==o)&&J7(t,i,s,o),Pc=!1;var f=t.memoizedState;i.state=f,_0(t,s,i,r),x0(),c=t.memoizedState,a||f!==c||Pc?(typeof h=="function"&&(m2(t,n,h,s),c=t.memoizedState),(l=Pc||X7(t,n,l,s,f,c,o))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),i.props=s,i.state=c,i.context=o,s=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{i=t.stateNode,c_(e,t),o=t.memoizedProps,d=zd(n,o),i.props=d,h=t.pendingProps,f=i.context,c=n.contextType,l=Gh,typeof c=="object"&&c!==null&&(l=ii(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==h||f!==l)&&J7(t,i,s,l),Pc=!1,f=t.memoizedState,i.state=f,_0(t,s,i,r),x0();var m=t.memoizedState;o!==h||f!==m||Pc||e!==null&&e.dependencies!==null&&Py(e.dependencies)?(typeof a=="function"&&(m2(t,n,a,s),m=t.memoizedState),(d=Pc||X7(t,n,d,s,f,m,l)||e!==null&&e.dependencies!==null&&Py(e.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,m,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,m,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=m),i.props=s,i.state=m,i.context=l,s=d):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return i=s,ty(e,t),s=(t.flags&128)!==0,i||s?(i=t.stateNode,n=s&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&s?(t.child=Pd(t,e.child,null,r),t.child=Pd(t,null,n,r)):Zr(e,t,n,r),t.memoizedState=i.state,e=t.child):e=dc(e,t,r),e}function o9(e,t,n,s){return Od(),t.flags|=256,Zr(e,t,n,s),t.child}var p2={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function g2(e){return{baseLanes:e,cachePool:lj()}}function y2(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=_o),e}function eR(e,t,n){var s=t.pendingProps,r=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(pr.current&2)!==0),o&&(r=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Un){if(r?Wc(t):Gc(),(e=zs)?(e=VR(e,Zo),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_u!==null?{id:il,overflow:ol}:null,retryLane:536870912,hydrationErrors:null},n=rj(e),n.return=t,t.child=n,ri=t,zs=null)):e=null,e===null)throw ku(t);return j_(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(Gc(),r=t.mode,a=Vy({mode:"hidden",children:a},r),s=Ad(s,r,n,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=g2(n),s.childLanes=y2(e,o,n),t.memoizedState=p2,Zm(null,s)):(Wc(t),v_(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(Wc(t),t.flags&=-257,t=b2(e,t,n)):t.memoizedState!==null?(Gc(),t.child=e.child,t.flags|=128,t=null):(Gc(),a=s.fallback,r=t.mode,s=Vy({mode:"visible",children:s.children},r),a=Ad(a,r,n,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,Pd(t,e.child,null,n),s=t.child,s.memoizedState=g2(n),s.childLanes=y2(e,o,n),t.memoizedState=p2,t=Zm(null,s));else if(Wc(t),j_(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,s=Error(Ce(419)),s.stack="",s.digest=o,Z0({value:s,source:null,stack:null}),t=b2(e,t,n)}else if(Sr||Zf(e,t,n,!1),o=(n&e.childLanes)!==0,Sr||o){if(o=Ms,o!==null&&(s=NI(o,n),s!==0&&s!==l.retryLane))throw l.retryLane=s,sh(e,s),oo(o,e,s),$5;I_(a)||Yy(),t=b2(e,t,n)}else I_(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,zs=ia(a.nextSibling),ri=t,Un=!0,cu=null,Zo=!1,e!==null&&oj(t,e),t=v_(t,s.children),t.flags|=4096);return t}return r?(Gc(),a=s.fallback,r=t.mode,l=e.child,c=l.sibling,s=ec(l,{mode:"hidden",children:s.children}),s.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=ec(c,a):(a=Ad(a,r,n,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,Zm(null,s),s=t.child,a=e.child.memoizedState,a===null?a=g2(n):(r=a.cachePool,r!==null?(l=kr._currentValue,r=r.parent!==l?{parent:l,pool:l}:r):r=lj(),a={baseLanes:a.baseLanes|n,cachePool:r}),s.memoizedState=a,s.childLanes=y2(e,o,n),t.memoizedState=p2,Zm(e.child,s)):(Wc(t),n=e.child,e=n.sibling,n=ec(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function v_(e,t){return t=Vy({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Vy(e,t){return e=wo(22,e,null,t),e.lanes=0,e}function b2(e,t,n){return Pd(t,e.child,null,n),e=v_(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function a9(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),o_(e.return,t,n)}function v2(e,t,n,s,r,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:r,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=s,o.tail=n,o.tailMode=r,o.treeForkCount=i)}function tR(e,t,n){var s=t.pendingProps,r=s.revealOrder,i=s.tail;s=s.children;var o=pr.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,Ds(pr,o),Zr(e,t,s,n),s=Un?J0:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&a9(e,n,t);else if(e.tag===19)a9(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&Fy(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),v2(t,!1,r,n,i,s);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Fy(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}v2(t,!0,n,null,i,s);break;case"together":v2(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function dc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Tu|=t.lanes,!(n&t.childLanes))if(e!==null){if(Zf(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Ce(153));if(t.child!==null){for(e=t.child,n=ec(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ec(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function z5(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Py(e)))}function XU(e,t,n){switch(t.tag){case 3:Iy(t,t.stateNode.containerInfo),Vc(t,kr,e.memoizedState.cache),Od();break;case 27:case 5:G4(t);break;case 4:Iy(t,t.stateNode.containerInfo);break;case 10:Vc(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,h_(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Wc(t),t.flags|=128,null):n&t.child.childLanes?eR(e,t,n):(Wc(t),e=dc(e,t,n),e!==null?e.sibling:null);Wc(t);break;case 19:var r=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Zf(e,t,n,!1),s=(n&t.childLanes)!==0),r){if(s)return tR(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Ds(pr,pr.current),s)break;return null;case 22:return t.lanes=0,Zj(e,t,n,t.pendingProps);case 24:Vc(t,kr,e.memoizedState.cache)}return dc(e,t,n)}function nR(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Sr=!0;else{if(!z5(e,n)&&!(t.flags&128))return Sr=!1,XU(e,t,n);Sr=!!(e.flags&131072)}else Sr=!1,Un&&t.flags&1048576&&ij(t,J0,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cd(t.elementType),t.type=e,typeof e=="function")b5(e)?(s=zd(e,s),t.tag=1,t=i9(null,t,e,s,n)):(t.tag=0,t=b_(null,t,e,s,n));else{if(e!=null){var r=e.$$typeof;if(r===r5){t.tag=11,t=e9(null,t,e,s,n);break e}else if(r===i5){t.tag=14,t=t9(null,t,e,s,n);break e}}throw t=V4(e)||e,Error(Ce(306,t,""))}}return t;case 0:return b_(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,r=zd(s,t.pendingProps),i9(e,t,s,r,n);case 3:e:{if(Iy(t,t.stateNode.containerInfo),e===null)throw Error(Ce(387));s=t.pendingProps;var i=t.memoizedState;r=i.element,c_(e,t),_0(t,s,null,n);var o=t.memoizedState;if(s=o.cache,Vc(t,kr,s),s!==i.cache&&a_(t,[kr],n,!0),x0(),s=o.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=o9(e,t,s,n);break e}else if(s!==r){r=Jo(Error(Ce(424)),t),Z0(r),t=o9(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(zs=ia(e.firstChild),ri=t,Un=!0,cu=null,Zo=!0,n=dj(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Od(),s===r){t=dc(e,t,n);break e}Zr(e,t,s,n)}t=t.child}return t;case 26:return ty(e,t),e===null?(n=A9(t.type,null,t.pendingProps,null))?t.memoizedState=n:Un||(n=t.type,e=t.pendingProps,s=Zy(lu.current).createElement(n),s[si]=t,s[ao]=e,ai(s,n,e),Gr(s),t.stateNode=s):t.memoizedState=A9(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return G4(t),e===null&&Un&&(s=t.stateNode=WR(t.type,t.pendingProps,lu.current),ri=t,Zo=!0,r=zs,Pu(t.type)?(R_=r,zs=ia(s.firstChild)):zs=r),Zr(e,t,t.pendingProps.children,n),ty(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Un&&((r=s=zs)&&(s=AV(s,t.type,t.pendingProps,Zo),s!==null?(t.stateNode=s,ri=t,zs=ia(s.firstChild),Zo=!1,r=!0):r=!1),r||ku(t)),G4(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,M_(r,i)?s=null:o!==null&&M_(r,o)&&(t.flags|=32),t.memoizedState!==null&&(r=A5(e,t,qU,null,null,n),ip._currentValue=r),ty(e,t),Zr(e,t,s,n),t.child;case 6:return e===null&&Un&&((e=n=zs)&&(n=EV(n,t.pendingProps,Zo),n!==null?(t.stateNode=n,ri=t,zs=null,e=!0):e=!1),e||ku(t)),null;case 13:return eR(e,t,n);case 4:return Iy(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Pd(t,null,s,n):Zr(e,t,s,n),t.child;case 11:return e9(e,t,t.type,t.pendingProps,n);case 7:return Zr(e,t,t.pendingProps,n),t.child;case 8:return Zr(e,t,t.pendingProps.children,n),t.child;case 12:return Zr(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Vc(t,t.type,s.value),Zr(e,t,s.children,n),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,Bd(t),r=ii(r),s=s(r),t.flags|=1,Zr(e,t,s,n),t.child;case 14:return t9(e,t,t.type,t.pendingProps,n);case 15:return Jj(e,t,t.type,t.pendingProps,n);case 19:return tR(e,t,n);case 31:return QU(e,t,n);case 22:return Zj(e,t,n,t.pendingProps);case 24:return Bd(t),s=ii(kr),e===null?(r=_5(),r===null&&(r=Ms,i=x5(),r.pooledCache=i,i.refCount++,i!==null&&(r.pooledCacheLanes|=n),r=i),t.memoizedState={parent:s,cache:r},S5(t),Vc(t,kr,r)):(e.lanes&n&&(c_(e,t),_0(t,null,null,n),x0()),r=e.memoizedState,i=t.memoizedState,r.parent!==s?(r={parent:s,cache:s},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Vc(t,kr,s)):(s=i.cache,Vc(t,kr,s),s!==r.cache&&a_(t,[kr],n,!0))),Zr(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Ce(156,t.tag))}function Dl(e){e.flags|=4}function w2(e,t,n,s,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(CR())e.flags|=8192;else throw Md=$y,k5}else e.flags&=-16777217}function l9(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!YR(t))if(CR())e.flags|=8192;else throw Md=$y,k5}function $g(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?AI():536870912,e.lanes|=t,Mf|=t)}function Em(e,t){if(!Un)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function $s(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,s=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags&65011712,s|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=n,t}function JU(e,t,n){var s=t.pendingProps;switch(w5(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $s(t),null;case 1:return $s(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),tc(kr),kf(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(_h(t)?Dl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,d2())),$s(t),null;case 26:var r=t.type,i=t.memoizedState;return e===null?(Dl(t),i!==null?($s(t),l9(t,i)):($s(t),w2(t,r,null,s,n))):i?i!==e.memoizedState?(Dl(t),$s(t),l9(t,i)):($s(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Dl(t),$s(t),w2(t,r,e,s,n)),null;case 27:if(jy(t),n=lu.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Dl(t);else{if(!s){if(t.stateNode===null)throw Error(Ce(166));return $s(t),null}e=hl.current,_h(t)?B7(t):(e=WR(r,s,n),t.stateNode=e,Dl(t))}return $s(t),null;case 5:if(jy(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Dl(t);else{if(!s){if(t.stateNode===null)throw Error(Ce(166));return $s(t),null}if(i=hl.current,_h(t))B7(t);else{var o=Zy(lu.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof s.is=="string"?o.createElement("select",{is:s.is}):o.createElement("select"),s.multiple?i.multiple=!0:s.size&&(i.size=s.size);break;default:i=typeof s.is=="string"?o.createElement(r,{is:s.is}):o.createElement(r)}}i[si]=t,i[ao]=s;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)i.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=i;e:switch(ai(i,r,s),r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Dl(t)}}return $s(t),w2(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Dl(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(Ce(166));if(e=lu.current,_h(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,r=ri,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[si]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||qR(e.nodeValue,n)),e||ku(t,!0)}else e=Zy(e).createTextNode(s),e[si]=t,t.stateNode=e}return $s(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=_h(t),n!==null){if(e===null){if(!s)throw Error(Ce(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ce(557));e[si]=t}else Od(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;$s(t),e=!1}else n=d2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(vo(t),t):(vo(t),null);if(t.flags&128)throw Error(Ce(558))}return $s(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=_h(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(Ce(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(Ce(317));r[si]=t}else Od(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;$s(t),r=!1}else r=d2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(vo(t),t):(vo(t),null)}return vo(t),t.flags&128?(t.lanes=n,t):(n=s!==null,e=e!==null&&e.memoizedState!==null,n&&(s=t.child,r=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(r=s.alternate.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(s.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),$g(t,t.updateQueue),$s(t),null);case 4:return kf(),e===null&&G5(t.stateNode.containerInfo),$s(t),null;case 10:return tc(t.type),$s(t),null;case 19:if(Yr(pr),s=t.memoizedState,s===null)return $s(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)Em(s,!1);else{if(lr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Fy(e),i!==null){for(t.flags|=128,Em(s,!1),e=i.updateQueue,t.updateQueue=e,$g(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)sj(n,e),n=n.sibling;return Ds(pr,pr.current&1|2),Un&&Hl(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&To()>Gy&&(t.flags|=128,r=!0,Em(s,!1),t.lanes=4194304)}else{if(!r)if(e=Fy(i),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,$g(t,e),Em(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!Un)return $s(t),null}else 2*To()-s.renderingStartTime>Gy&&n!==536870912&&(t.flags|=128,r=!0,Em(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(e=s.last,e!==null?e.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=To(),e.sibling=null,n=pr.current,Ds(pr,r?n&1|2:n&1),Un&&Hl(t,s.treeForkCount),e):($s(t),null);case 22:case 23:return vo(t),T5(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?n&536870912&&!(t.flags&128)&&($s(t),t.subtreeFlags&6&&(t.flags|=8192)):$s(t),n=t.updateQueue,n!==null&&$g(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==n&&(t.flags|=2048),e!==null&&Yr(Ed),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),tc(kr),$s(t),null;case 25:return null;case 30:return null}throw Error(Ce(156,t.tag))}function ZU(e,t){switch(w5(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tc(kr),kf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return jy(t),null;case 31:if(t.memoizedState!==null){if(vo(t),t.alternate===null)throw Error(Ce(340));Od()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(vo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Od()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yr(pr),null;case 4:return kf(),null;case 10:return tc(t.type),null;case 22:case 23:return vo(t),T5(),e!==null&&Yr(Ed),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return tc(kr),null;case 25:return null;default:return null}}function sR(e,t){switch(w5(t),t.tag){case 3:tc(kr),kf();break;case 26:case 27:case 5:jy(t);break;case 4:kf();break;case 31:t.memoizedState!==null&&vo(t);break;case 13:vo(t);break;case 19:Yr(pr);break;case 10:tc(t.type);break;case 22:case 23:vo(t),T5(),e!==null&&Yr(Ed);break;case 24:tc(kr)}}function Vp(e,t){try{var n=t.updateQueue,s=n!==null?n.lastEffect:null;if(s!==null){var r=s.next;n=r;do{if((n.tag&e)===e){s=void 0;var i=n.create,o=n.inst;s=i(),o.destroy=s}n=n.next}while(n!==r)}}catch(a){bs(t,t.return,a)}}function Su(e,t,n){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var i=r.next;s=i;do{if((s.tag&e)===e){var o=s.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,r=t;var l=n,c=a;try{c()}catch(d){bs(r,l,d)}}}s=s.next}while(s!==i)}}catch(d){bs(t,t.return,d)}}function rR(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{fj(t,n)}catch(s){bs(e,e.return,s)}}}function iR(e,t,n){n.props=zd(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){bs(e,t,s)}}function S0(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof n=="function"?e.refCleanup=n(s):n.current=s}}catch(r){bs(e,t,r)}}function al(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(r){bs(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){bs(e,t,r)}else n.current=null}function oR(e){var t=e.type,n=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&s.focus();break e;case"img":n.src?s.src=n.src:n.srcSet&&(s.srcset=n.srcSet)}}catch(r){bs(e,e.return,r)}}function x2(e,t,n){try{var s=e.stateNode;xV(s,e.type,n,t),s[ao]=t}catch(r){bs(e,e.return,r)}}function aR(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Pu(e.type)||e.tag===4}function _2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||aR(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Pu(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function w_(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yl));else if(s!==4&&(s===27&&Pu(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(w_(e,t,n),e=e.sibling;e!==null;)w_(e,t,n),e=e.sibling}function Wy(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(s===27&&Pu(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Wy(e,t,n),e=e.sibling;e!==null;)Wy(e,t,n),e=e.sibling}function lR(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ai(t,s,n),t[si]=e,t[ao]=n}catch(i){bs(e,e.return,i)}}var Vl=!1,xr=!1,k2=!1,c9=typeof WeakSet=="function"?WeakSet:Set,Wr=null;function eV(e,t){if(e=e.containerInfo,A_=sb,e=YI(e),p5(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var r=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,d=0,h=e,f=null;t:for(;;){for(var m;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==i||s!==0&&h.nodeType!==3||(l=o+s),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===e)break t;if(f===n&&++c===r&&(a=o),f===i&&++d===s&&(l=o),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(E_={focusedElem:e,selectionRange:n},sb=!1,Wr=t;Wr!==null;)if(t=Wr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Wr=e;else for(;Wr!==null;){switch(t=Wr,i=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)r=e[n],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,r=i.memoizedProps,i=i.memoizedState,s=n.stateNode;try{var p=zd(n.type,r);e=s.getSnapshotBeforeUpdate(p,i),s.__reactInternalSnapshotBeforeUpdate=e}catch(y){bs(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)N_(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":N_(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(Ce(163))}if(e=t.sibling,e!==null){e.return=t.return,Wr=e;break}Wr=t.return}}function cR(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:Bl(e,n),s&4&&Vp(5,n);break;case 1:if(Bl(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){bs(n,n.return,o)}else{var r=zd(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){bs(n,n.return,o)}}s&64&&rR(n),s&512&&S0(n,n.return);break;case 3:if(Bl(e,n),s&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{fj(e,t)}catch(o){bs(n,n.return,o)}}break;case 27:t===null&&s&4&&lR(n);case 26:case 5:Bl(e,n),t===null&&s&4&&oR(n),s&512&&S0(n,n.return);break;case 12:Bl(e,n);break;case 31:Bl(e,n),s&4&&hR(e,n);break;case 13:Bl(e,n),s&4&&fR(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=cV.bind(null,n),MV(e,n))));break;case 22:if(s=n.memoizedState!==null||Vl,!s){t=t!==null&&t.memoizedState!==null||xr,r=Vl;var i=xr;Vl=s,(xr=t)&&!i?ql(e,n,(n.subtreeFlags&8772)!==0):Bl(e,n),Vl=r,xr=i}break;case 30:break;default:Bl(e,n)}}function uR(e){var t=e.alternate;t!==null&&(e.alternate=null,uR(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&c5(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Us=null,eo=!1;function Ol(e,t,n){for(n=n.child;n!==null;)dR(e,t,n),n=n.sibling}function dR(e,t,n){if(Co&&typeof Co.onCommitFiberUnmount=="function")try{Co.onCommitFiberUnmount(Pp,n)}catch{}switch(n.tag){case 26:xr||al(n,t),Ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:xr||al(n,t);var s=Us,r=eo;Pu(n.type)&&(Us=n.stateNode,eo=!1),Ol(e,t,n),E0(n.stateNode),Us=s,eo=r;break;case 5:xr||al(n,t);case 6:if(s=Us,r=eo,Us=null,Ol(e,t,n),Us=s,eo=r,Us!==null)if(eo)try{(Us.nodeType===9?Us.body:Us.nodeName==="HTML"?Us.ownerDocument.body:Us).removeChild(n.stateNode)}catch(i){bs(n,t,i)}else try{Us.removeChild(n.stateNode)}catch(i){bs(n,t,i)}break;case 18:Us!==null&&(eo?(e=Us,_9(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Rf(e)):_9(Us,n.stateNode));break;case 4:s=Us,r=eo,Us=n.stateNode.containerInfo,eo=!0,Ol(e,t,n),Us=s,eo=r;break;case 0:case 11:case 14:case 15:Su(2,n,t),xr||Su(4,n,t),Ol(e,t,n);break;case 1:xr||(al(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&iR(n,t,s)),Ol(e,t,n);break;case 21:Ol(e,t,n);break;case 22:xr=(s=xr)||n.memoizedState!==null,Ol(e,t,n),xr=s;break;default:Ol(e,t,n)}}function hR(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Rf(e)}catch(n){bs(t,t.return,n)}}}function fR(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Rf(e)}catch(n){bs(t,t.return,n)}}function tV(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new c9),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new c9),t;default:throw Error(Ce(435,e.tag))}}function zg(e,t){var n=tV(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var r=uV.bind(null,e,s);s.then(r,r)}})}function Yi(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var r=n[s],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(Pu(a.type)){Us=a.stateNode,eo=!1;break e}break;case 5:Us=a.stateNode,eo=!1;break e;case 3:case 4:Us=a.stateNode.containerInfo,eo=!0;break e}a=a.return}if(Us===null)throw Error(Ce(160));dR(i,o,r),Us=null,eo=!1,i=r.alternate,i!==null&&(i.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)mR(t,e),t=t.sibling}var _a=null;function mR(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Yi(t,e),Qi(e),s&4&&(Su(3,e,e.return),Vp(3,e),Su(5,e,e.return));break;case 1:Yi(t,e),Qi(e),s&512&&(xr||n===null||al(n,n.return)),s&64&&Vl&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?s:n.concat(s))));break;case 26:var r=_a;if(Yi(t,e),Qi(e),s&512&&(xr||n===null||al(n,n.return)),s&4){var i=n!==null?n.memoizedState:null;if(s=e.memoizedState,n===null)if(s===null)if(e.stateNode===null){e:{s=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(s){case"title":i=r.getElementsByTagName("title")[0],(!i||i[Fp]||i[si]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=r.createElement(s),r.head.insertBefore(i,r.querySelector("head > title"))),ai(i,s,n),i[si]=e,Gr(i),s=i;break e;case"link":var o=M9("link","href",r).get(s+(n.href||""));if(o){for(var a=0;a<o.length;a++)if(i=o[a],i.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&i.getAttribute("rel")===(n.rel==null?null:n.rel)&&i.getAttribute("title")===(n.title==null?null:n.title)&&i.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(a,1);break t}}i=r.createElement(s),ai(i,s,n),r.head.appendChild(i);break;case"meta":if(o=M9("meta","content",r).get(s+(n.content||""))){for(a=0;a<o.length;a++)if(i=o[a],i.getAttribute("content")===(n.content==null?null:""+n.content)&&i.getAttribute("name")===(n.name==null?null:n.name)&&i.getAttribute("property")===(n.property==null?null:n.property)&&i.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&i.getAttribute("charset")===(n.charSet==null?null:n.charSet)){o.splice(a,1);break t}}i=r.createElement(s),ai(i,s,n),r.head.appendChild(i);break;default:throw Error(Ce(468,s))}i[si]=e,Gr(i),s=i}e.stateNode=s}else N9(r,e.type,e.stateNode);else e.stateNode=E9(r,s,e.memoizedProps);else i!==s?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,s===null?N9(r,e.type,e.stateNode):E9(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&x2(e,e.memoizedProps,n.memoizedProps)}break;case 27:Yi(t,e),Qi(e),s&512&&(xr||n===null||al(n,n.return)),n!==null&&s&4&&x2(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Yi(t,e),Qi(e),s&512&&(xr||n===null||al(n,n.return)),e.flags&32){r=e.stateNode;try{Tf(r,"")}catch(p){bs(e,e.return,p)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,x2(e,r,n!==null?n.memoizedProps:r)),s&1024&&(k2=!0);break;case 6:if(Yi(t,e),Qi(e),s&4){if(e.stateNode===null)throw Error(Ce(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(p){bs(e,e.return,p)}}break;case 3:if(ry=null,r=_a,_a=eb(t.containerInfo),Yi(t,e),_a=r,Qi(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{Rf(t.containerInfo)}catch(p){bs(e,e.return,p)}k2&&(k2=!1,pR(e));break;case 4:s=_a,_a=eb(e.stateNode.containerInfo),Yi(t,e),Qi(e),_a=s;break;case 12:Yi(t,e),Qi(e);break;case 31:Yi(t,e),Qi(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,zg(e,s)));break;case 13:Yi(t,e),Qi(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(kv=To()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,zg(e,s)));break;case 22:r=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=Vl,d=xr;if(Vl=c||r,xr=d||l,Yi(t,e),xr=d,Vl=c,Qi(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||l||Vl||xr||ud(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,r)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=l.stateNode;var h=l.memoizedProps.style,f=h!=null&&h.hasOwnProperty("display")?h.display:null;a.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(p){bs(l,l.return,p)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=r?"":l.memoizedProps}catch(p){bs(l,l.return,p)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;r?k9(m,!0):k9(l.stateNode,!1)}catch(p){bs(l,l.return,p)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,zg(e,n))));break;case 19:Yi(t,e),Qi(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,zg(e,s)));break;case 30:break;case 21:break;default:Yi(t,e),Qi(e)}}function Qi(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(aR(s)){n=s;break}s=s.return}if(n==null)throw Error(Ce(160));switch(n.tag){case 27:var r=n.stateNode,i=_2(e);Wy(e,i,r);break;case 5:var o=n.stateNode;n.flags&32&&(Tf(o,""),n.flags&=-33);var a=_2(e);Wy(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=_2(e);w_(e,c,l);break;default:throw Error(Ce(161))}}catch(d){bs(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pR(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;pR(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Bl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cR(e,t.alternate,t),t=t.sibling}function ud(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Su(4,t,t.return),ud(t);break;case 1:al(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&iR(t,t.return,n),ud(t);break;case 27:E0(t.stateNode);case 26:case 5:al(t,t.return),ud(t);break;case 22:t.memoizedState===null&&ud(t);break;case 30:ud(t);break;default:ud(t)}e=e.sibling}}function ql(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,r=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:ql(r,i,n),Vp(4,i);break;case 1:if(ql(r,i,n),s=i,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(c){bs(s,s.return,c)}if(s=i,r=s.updateQueue,r!==null){var a=s.stateNode;try{var l=r.shared.hiddenCallbacks;if(l!==null)for(r.shared.hiddenCallbacks=null,r=0;r<l.length;r++)hj(l[r],a)}catch(c){bs(s,s.return,c)}}n&&o&64&&rR(i),S0(i,i.return);break;case 27:lR(i);case 26:case 5:ql(r,i,n),n&&s===null&&o&4&&oR(i),S0(i,i.return);break;case 12:ql(r,i,n);break;case 31:ql(r,i,n),n&&o&4&&hR(r,i);break;case 13:ql(r,i,n),n&&o&4&&fR(r,i);break;case 22:i.memoizedState===null&&ql(r,i,n),S0(i,i.return);break;case 30:break;default:ql(r,i,n)}t=t.sibling}}function F5(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Hp(n))}function q5(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Hp(e))}function ba(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gR(e,t,n,s),t=t.sibling}function gR(e,t,n,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:ba(e,t,n,s),r&2048&&Vp(9,t);break;case 1:ba(e,t,n,s);break;case 3:ba(e,t,n,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Hp(e)));break;case 12:if(r&2048){ba(e,t,n,s),e=t.stateNode;try{var i=t.memoizedProps,o=i.id,a=i.onPostCommit;typeof a=="function"&&a(o,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){bs(t,t.return,l)}}else ba(e,t,n,s);break;case 31:ba(e,t,n,s);break;case 13:ba(e,t,n,s);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?ba(e,t,n,s):T0(e,t):i._visibility&2?ba(e,t,n,s):(i._visibility|=2,Rh(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&F5(o,t);break;case 24:ba(e,t,n,s),r&2048&&q5(t.alternate,t);break;default:ba(e,t,n,s)}}function Rh(e,t,n,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,l=s,c=o.flags;switch(o.tag){case 0:case 11:case 15:Rh(i,o,a,l,r),Vp(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?Rh(i,o,a,l,r):T0(i,o):(d._visibility|=2,Rh(i,o,a,l,r)),r&&c&2048&&F5(o.alternate,o);break;case 24:Rh(i,o,a,l,r),r&&c&2048&&q5(o.alternate,o);break;default:Rh(i,o,a,l,r)}t=t.sibling}}function T0(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,s=t,r=s.flags;switch(s.tag){case 22:T0(n,s),r&2048&&F5(s.alternate,s);break;case 24:T0(n,s),r&2048&&q5(s.alternate,s);break;default:T0(n,s)}t=t.sibling}}var e0=8192;function kh(e,t,n){if(e.subtreeFlags&e0)for(e=e.child;e!==null;)yR(e,t,n),e=e.sibling}function yR(e,t,n){switch(e.tag){case 26:kh(e,t,n),e.flags&e0&&e.memoizedState!==null&&FV(n,_a,e.memoizedState,e.memoizedProps);break;case 5:kh(e,t,n);break;case 3:case 4:var s=_a;_a=eb(e.stateNode.containerInfo),kh(e,t,n),_a=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=e0,e0=16777216,kh(e,t,n),e0=s):kh(e,t,n));break;default:kh(e,t,n)}}function bR(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Mm(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Wr=s,wR(s,e)}bR(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)vR(e),e=e.sibling}function vR(e){switch(e.tag){case 0:case 11:case 15:Mm(e),e.flags&2048&&Su(9,e,e.return);break;case 3:Mm(e);break;case 12:Mm(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ny(e)):Mm(e);break;default:Mm(e)}}function ny(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];Wr=s,wR(s,e)}bR(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Su(8,t,t.return),ny(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ny(t));break;default:ny(t)}e=e.sibling}}function wR(e,t){for(;Wr!==null;){var n=Wr;switch(n.tag){case 0:case 11:case 15:Su(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var s=n.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Hp(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,Wr=s;else e:for(n=e;Wr!==null;){s=Wr;var r=s.sibling,i=s.return;if(uR(s),s===n){Wr=null;break e}if(r!==null){r.return=i,Wr=r;break e}Wr=i}}}var nV={getCacheForType:function(e){var t=ii(kr),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ii(kr).controller.signal}},sV=typeof WeakMap=="function"?WeakMap:Map,as=0,Ms=null,On=null,Fn=0,gs=0,yo=null,Zc=!1,tm=!1,H5=!1,hc=0,lr=0,Tu=0,Nd=0,U5=0,_o=0,Mf=0,C0=null,to=null,x_=!1,kv=0,xR=0,Gy=1/0,Ky=null,hu=null,Lr=0,fu=null,Nf=null,nc=0,__=0,k_=null,_R=null,A0=0,S_=null;function Eo(){return as&2&&Fn!==0?Fn&-Fn:sn.T!==null?W5():II()}function kR(){if(_o===0)if(!(Fn&536870912)||Un){var e=jg;jg<<=1,!(jg&3932160)&&(jg=262144),_o=e}else _o=536870912;return e=jo.current,e!==null&&(e.flags|=32),_o}function oo(e,t,n){(e===Ms&&(gs===2||gs===9)||e.cancelPendingCommit!==null)&&(If(e,0),eu(e,Fn,_o,!1)),zp(e,n),(!(as&2)||e!==Ms)&&(e===Ms&&(!(as&2)&&(Nd|=n),lr===4&&eu(e,Fn,_o,!1)),yl(e))}function SR(e,t,n){if(as&6)throw Error(Ce(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||$p(e,t),r=s?oV(e,t):S2(e,t,!0),i=s;do{if(r===0){tm&&!s&&eu(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!rV(n)){r=S2(e,t,!1),i=!1;continue}if(r===2){if(i=t,e.errorRecoveryDisabledLanes&i)var o=0;else o=e.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){t=o;e:{var a=e;r=C0;var l=a.current.memoizedState.isDehydrated;if(l&&(If(a,o).flags|=256),o=S2(a,o,!1),o!==2){if(H5&&!l){a.errorRecoveryDisabledLanes|=i,Nd|=i,r=4;break e}i=to,to=r,i!==null&&(to===null?to=i:to.push.apply(to,i))}r=o}if(i=!1,r!==2)continue}}if(r===1){If(e,0),eu(e,t,0,!0);break}e:{switch(s=e,i=r,i){case 0:case 1:throw Error(Ce(345));case 4:if((t&4194048)!==t)break;case 6:eu(s,t,_o,!Zc);break e;case 2:to=null;break;case 3:case 5:break;default:throw Error(Ce(329))}if((t&62914560)===t&&(r=kv+300-To(),10<r)){if(eu(s,t,_o,!Zc),hv(s,0,!0)!==0)break e;nc=t,s.timeoutHandle=UR(u9.bind(null,s,n,to,Ky,x_,t,_o,Nd,Mf,Zc,i,"Throttled",-0,0),r);break e}u9(s,n,to,Ky,x_,t,_o,Nd,Mf,Zc,i,null,-0,0)}}break}while(!0);yl(e)}function u9(e,t,n,s,r,i,o,a,l,c,d,h,f,m){if(e.timeoutHandle=-1,h=t.subtreeFlags,h&8192||(h&16785408)===16785408){h={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yl},yR(t,i,h);var p=(i&62914560)===i?kv-To():(i&4194048)===i?xR-To():0;if(p=qV(h,p),p!==null){nc=i,e.cancelPendingCommit=p(h9.bind(null,e,t,i,n,s,r,o,a,l,d,h,null,f,m)),eu(e,i,o,!c);return}}h9(e,t,i,n,s,r,o,a,l)}function rV(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var r=n[s],i=r.getSnapshot;r=r.value;try{if(!Io(i(),r))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function eu(e,t,n,s){t&=~U5,t&=~Nd,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var i=31-Ao(r),o=1<<i;s[i]=-1,r&=~o}n!==0&&EI(e,n,t)}function Sv(){return as&6?!0:(Wp(0),!1)}function V5(){if(On!==null){if(gs===0)var e=On.return;else e=On,Ql=rh=null,N5(e),uf=null,ep=0,e=On;for(;e!==null;)sR(e.alternate,e),e=e.return;On=null}}function If(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,SV(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),nc=0,V5(),Ms=e,On=n=ec(e.current,null),Fn=t,gs=0,yo=null,Zc=!1,tm=$p(e,t),H5=!1,Mf=_o=U5=Nd=Tu=lr=0,to=C0=null,x_=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-Ao(s),i=1<<r;t|=e[r],s&=~i}return hc=t,gv(),n}function TR(e,t){Tn=null,sn.H=np,t===em||t===bv?(t=q7(),gs=3):t===k5?(t=q7(),gs=4):gs=t===$5?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,yo=t,On===null&&(lr=1,Uy(e,Jo(t,e.current)))}function CR(){var e=jo.current;return e===null?!0:(Fn&4194048)===Fn?ra===null:(Fn&62914560)===Fn||Fn&536870912?e===ra:!1}function AR(){var e=sn.H;return sn.H=np,e===null?np:e}function ER(){var e=sn.A;return sn.A=nV,e}function Yy(){lr=4,Zc||(Fn&4194048)!==Fn&&jo.current!==null||(tm=!0),!(Tu&134217727)&&!(Nd&134217727)||Ms===null||eu(Ms,Fn,_o,!1)}function S2(e,t,n){var s=as;as|=2;var r=AR(),i=ER();(Ms!==e||Fn!==t)&&(Ky=null,If(e,t)),t=!1;var o=lr;e:do try{if(gs!==0&&On!==null){var a=On,l=yo;switch(gs){case 8:V5(),o=6;break e;case 3:case 2:case 9:case 6:jo.current===null&&(t=!0);var c=gs;if(gs=0,yo=null,Qh(e,a,l,c),n&&tm){o=0;break e}break;default:c=gs,gs=0,yo=null,Qh(e,a,l,c)}}iV(),o=lr;break}catch(d){TR(e,d)}while(!0);return t&&e.shellSuspendCounter++,Ql=rh=null,as=s,sn.H=r,sn.A=i,On===null&&(Ms=null,Fn=0,gv()),o}function iV(){for(;On!==null;)MR(On)}function oV(e,t){var n=as;as|=2;var s=AR(),r=ER();Ms!==e||Fn!==t?(Ky=null,Gy=To()+500,If(e,t)):tm=$p(e,t);e:do try{if(gs!==0&&On!==null){t=On;var i=yo;t:switch(gs){case 1:gs=0,yo=null,Qh(e,t,i,1);break;case 2:case 9:if(F7(i)){gs=0,yo=null,d9(t);break}t=function(){gs!==2&&gs!==9||Ms!==e||(gs=7),yl(e)},i.then(t,t);break e;case 3:gs=7;break e;case 4:gs=5;break e;case 7:F7(i)?(gs=0,yo=null,d9(t)):(gs=0,yo=null,Qh(e,t,i,7));break;case 5:var o=null;switch(On.tag){case 26:o=On.memoizedState;case 5:case 27:var a=On;if(o?YR(o):a.stateNode.complete){gs=0,yo=null;var l=a.sibling;if(l!==null)On=l;else{var c=a.return;c!==null?(On=c,Tv(c)):On=null}break t}}gs=0,yo=null,Qh(e,t,i,5);break;case 6:gs=0,yo=null,Qh(e,t,i,6);break;case 8:V5(),lr=6;break e;default:throw Error(Ce(462))}}aV();break}catch(d){TR(e,d)}while(!0);return Ql=rh=null,sn.H=s,sn.A=r,as=n,On!==null?0:(Ms=null,Fn=0,gv(),lr)}function aV(){for(;On!==null&&!NH();)MR(On)}function MR(e){var t=nR(e.alternate,e,hc);e.memoizedProps=e.pendingProps,t===null?Tv(e):On=t}function d9(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=r9(n,t,t.pendingProps,t.type,void 0,Fn);break;case 11:t=r9(n,t,t.pendingProps,t.type.render,t.ref,Fn);break;case 5:N5(t);default:sR(n,t),t=On=sj(t,hc),t=nR(n,t,hc)}e.memoizedProps=e.pendingProps,t===null?Tv(e):On=t}function Qh(e,t,n,s){Ql=rh=null,N5(t),uf=null,ep=0;var r=t.return;try{if(YU(e,r,t,n,Fn)){lr=1,Uy(e,Jo(n,e.current)),On=null;return}}catch(i){if(r!==null)throw On=r,i;lr=1,Uy(e,Jo(n,e.current)),On=null;return}t.flags&32768?(Un||s===1?e=!0:tm||Fn&536870912?e=!1:(Zc=e=!0,(s===2||s===9||s===3||s===6)&&(s=jo.current,s!==null&&s.tag===13&&(s.flags|=16384))),NR(t,e)):Tv(t)}function Tv(e){var t=e;do{if(t.flags&32768){NR(t,Zc);return}e=t.return;var n=JU(t.alternate,t,hc);if(n!==null){On=n;return}if(t=t.sibling,t!==null){On=t;return}On=t=e}while(t!==null);lr===0&&(lr=5)}function NR(e,t){do{var n=ZU(e.alternate,e);if(n!==null){n.flags&=32767,On=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){On=e;return}On=e=n}while(e!==null);lr=6,On=null}function h9(e,t,n,s,r,i,o,a,l){e.cancelPendingCommit=null;do Cv();while(Lr!==0);if(as&6)throw Error(Ce(327));if(t!==null){if(t===e.current)throw Error(Ce(177));if(i=t.lanes|t.childLanes,i|=g5,zH(e,n,i,o,a,l),e===Ms&&(On=Ms=null,Fn=0),Nf=t,fu=e,nc=n,__=i,k_=r,_R=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,dV(Ry,function(){return DR(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=sn.T,sn.T=null,r=cs.p,cs.p=2,o=as,as|=4;try{eV(e,t,n)}finally{as=o,cs.p=r,sn.T=s}}Lr=1,IR(),jR(),RR()}}function IR(){if(Lr===1){Lr=0;var e=fu,t=Nf,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=sn.T,sn.T=null;var s=cs.p;cs.p=2;var r=as;as|=4;try{mR(t,e);var i=E_,o=YI(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&KI(a.ownerDocument.documentElement,a)){if(l!==null&&p5(a)){var c=l.start,d=l.end;if(d===void 0&&(d=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(d,a.value.length);else{var h=a.ownerDocument||document,f=h&&h.defaultView||window;if(f.getSelection){var m=f.getSelection(),p=a.textContent.length,y=Math.min(l.start,p),w=l.end===void 0?y:Math.min(l.end,p);!m.extend&&y>w&&(o=w,w=y,y=o);var b=L7(a,y),v=L7(a,w);if(b&&v&&(m.rangeCount!==1||m.anchorNode!==b.node||m.anchorOffset!==b.offset||m.focusNode!==v.node||m.focusOffset!==v.offset)){var x=h.createRange();x.setStart(b.node,b.offset),m.removeAllRanges(),y>w?(m.addRange(x),m.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),m.addRange(x))}}}}for(h=[],m=a;m=m.parentNode;)m.nodeType===1&&h.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<h.length;a++){var _=h[a];_.element.scrollLeft=_.left,_.element.scrollTop=_.top}}sb=!!A_,E_=A_=null}finally{as=r,cs.p=s,sn.T=n}}e.current=t,Lr=2}}function jR(){if(Lr===2){Lr=0;var e=fu,t=Nf,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=sn.T,sn.T=null;var s=cs.p;cs.p=2;var r=as;as|=4;try{cR(e,t.alternate,t)}finally{as=r,cs.p=s,sn.T=n}}Lr=3}}function RR(){if(Lr===4||Lr===3){Lr=0,IH();var e=fu,t=Nf,n=nc,s=_R;t.subtreeFlags&10256||t.flags&10256?Lr=5:(Lr=0,Nf=fu=null,LR(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(hu=null),l5(n),t=t.stateNode,Co&&typeof Co.onCommitFiberRoot=="function")try{Co.onCommitFiberRoot(Pp,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=sn.T,r=cs.p,cs.p=2,sn.T=null;try{for(var i=e.onRecoverableError,o=0;o<s.length;o++){var a=s[o];i(a.value,{componentStack:a.stack})}}finally{sn.T=t,cs.p=r}}nc&3&&Cv(),yl(e),r=e.pendingLanes,n&261930&&r&42?e===S_?A0++:(A0=0,S_=e):A0=0,Wp(0)}}function LR(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Hp(t)))}function Cv(){return IR(),jR(),RR(),DR()}function DR(){if(Lr!==5)return!1;var e=fu,t=__;__=0;var n=l5(nc),s=sn.T,r=cs.p;try{cs.p=32>n?32:n,sn.T=null,n=k_,k_=null;var i=fu,o=nc;if(Lr=0,Nf=fu=null,nc=0,as&6)throw Error(Ce(331));var a=as;if(as|=4,vR(i.current),gR(i,i.current,o,n),as=a,Wp(0,!1),Co&&typeof Co.onPostCommitFiberRoot=="function")try{Co.onPostCommitFiberRoot(Pp,i)}catch{}return!0}finally{cs.p=r,sn.T=s,LR(e,t)}}function f9(e,t,n){t=Jo(n,t),t=y_(e.stateNode,t,2),e=du(e,t,2),e!==null&&(zp(e,2),yl(e))}function bs(e,t,n){if(e.tag===3)f9(e,e,n);else for(;t!==null;){if(t.tag===3){f9(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(hu===null||!hu.has(s))){e=Jo(n,e),n=Qj(2),s=du(t,n,2),s!==null&&(Xj(n,s,t,e),zp(s,2),yl(s));break}}t=t.return}}function T2(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new sV;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(n)||(H5=!0,r.add(n),e=lV.bind(null,e,t,n),t.then(e,e))}function lV(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ms===e&&(Fn&n)===n&&(lr===4||lr===3&&(Fn&62914560)===Fn&&300>To()-kv?!(as&2)&&If(e,0):U5|=n,Mf===Fn&&(Mf=0)),yl(e)}function OR(e,t){t===0&&(t=AI()),e=sh(e,t),e!==null&&(zp(e,t),yl(e))}function cV(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),OR(e,n)}function uV(e,t){var n=0;switch(e.tag){case 31:case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(Ce(314))}s!==null&&s.delete(t),OR(e,n)}function dV(e,t){return o5(e,t)}var Qy=null,Lh=null,T_=!1,Xy=!1,C2=!1,tu=0;function yl(e){e!==Lh&&e.next===null&&(Lh===null?Qy=Lh=e:Lh=Lh.next=e),Xy=!0,T_||(T_=!0,fV())}function Wp(e,t){if(!C2&&Xy){C2=!0;do for(var n=!1,s=Qy;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var i=0;else{var o=s.suspendedLanes,a=s.pingedLanes;i=(1<<31-Ao(42|e)+1)-1,i&=r&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,m9(s,i))}else i=Fn,i=hv(s,s===Ms?i:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(i&3)||$p(s,i)||(n=!0,m9(s,i));s=s.next}while(n);C2=!1}}function hV(){BR()}function BR(){Xy=T_=!1;var e=0;tu!==0&&kV()&&(e=tu);for(var t=To(),n=null,s=Qy;s!==null;){var r=s.next,i=PR(s,t);i===0?(s.next=null,n===null?Qy=r:n.next=r,r===null&&(Lh=n)):(n=s,(e!==0||i&3)&&(Xy=!0)),s=r}Lr!==0&&Lr!==5||Wp(e),tu!==0&&(tu=0)}function PR(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Ao(i),a=1<<o,l=r[o];l===-1?(!(a&n)||a&s)&&(r[o]=$H(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=Ms,n=Fn,n=hv(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(gs===2||gs===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&e2(s),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||$p(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&e2(s),l5(n)){case 2:case 8:n=TI;break;case 32:n=Ry;break;case 268435456:n=CI;break;default:n=Ry}return s=$R.bind(null,e),n=o5(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&e2(s),e.callbackPriority=2,e.callbackNode=null,2}function $R(e,t){if(Lr!==0&&Lr!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Cv()&&e.callbackNode!==n)return null;var s=Fn;return s=hv(e,e===Ms?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(SR(e,s,t),PR(e,To()),e.callbackNode!=null&&e.callbackNode===n?$R.bind(null,e):null)}function m9(e,t){if(Cv())return null;SR(e,t,!0)}function fV(){TV(function(){as&6?o5(SI,hV):BR()})}function W5(){if(tu===0){var e=Cf;e===0&&(e=Ig,Ig<<=1,!(Ig&261888)&&(Ig=256)),tu=e}return tu}function p9(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:G1(""+e)}function g9(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function mV(e,t,n,s,r){if(t==="submit"&&n&&n.stateNode===r){var i=p9((r[ao]||null).action),o=s.submitter;o&&(t=(t=o[ao]||null)?p9(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new fv("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(tu!==0){var l=o?g9(r,o):new FormData(r);p_(n,{pending:!0,data:l,method:r.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?g9(r,o):new FormData(r),p_(n,{pending:!0,data:l,method:r.method,action:i},i,l))},currentTarget:r}]})}}for(var A2=0;A2<s_.length;A2++){var E2=s_[A2],pV=E2.toLowerCase(),gV=E2[0].toUpperCase()+E2.slice(1);Na(pV,"on"+gV)}Na(XI,"onAnimationEnd");Na(JI,"onAnimationIteration");Na(ZI,"onAnimationStart");Na("dblclick","onDoubleClick");Na("focusin","onFocus");Na("focusout","onBlur");Na(jU,"onTransitionRun");Na(RU,"onTransitionStart");Na(LU,"onTransitionCancel");Na(ej,"onTransitionEnd");Sf("onMouseEnter",["mouseout","mouseover"]);Sf("onMouseLeave",["mouseout","mouseover"]);Sf("onPointerEnter",["pointerout","pointerover"]);Sf("onPointerLeave",["pointerout","pointerover"]);eh("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));eh("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));eh("onBeforeInput",["compositionend","keypress","textInput","paste"]);eh("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));eh("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));eh("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var sp="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),yV=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(sp));function zR(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var s=e[n],r=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var o=s.length-1;0<=o;o--){var a=s[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=c;try{i(r)}catch(d){Dy(d)}r.currentTarget=null,i=l}else for(o=0;o<s.length;o++){if(a=s[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&r.isPropagationStopped())break e;i=a,r.currentTarget=c;try{i(r)}catch(d){Dy(d)}r.currentTarget=null,i=l}}}}function Dn(e,t){var n=t[Y4];n===void 0&&(n=t[Y4]=new Set);var s=e+"__bubble";n.has(s)||(FR(t,e,2,!1),n.add(s))}function M2(e,t,n){var s=0;t&&(s|=4),FR(n,e,s,t)}var Fg="_reactListening"+Math.random().toString(36).slice(2);function G5(e){if(!e[Fg]){e[Fg]=!0,jI.forEach(function(n){n!=="selectionchange"&&(yV.has(n)||M2(n,!1,e),M2(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Fg]||(t[Fg]=!0,M2("selectionchange",!1,t))}}function FR(e,t,n,s){switch(eL(t)){case 2:var r=VV;break;case 8:r=WV;break;default:r=X5}n=r.bind(null,t,n,e),r=void 0,!e_||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function N2(e,t,n,s,r){var i=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var o=s.tag;if(o===3||o===4){var a=s.stateNode.containerInfo;if(a===r)break;if(o===4)for(o=s.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===r)return;o=o.return}for(;a!==null;){if(o=Fh(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){s=i=o;continue e}a=a.parentNode}}s=s.return}zI(function(){var c=i,d=d5(n),h=[];e:{var f=tj.get(e);if(f!==void 0){var m=fv,p=e;switch(e){case"keypress":if(Y1(n)===0)break e;case"keydown":case"keyup":m=uU;break;case"focusin":p="focus",m=i2;break;case"focusout":p="blur",m=i2;break;case"beforeblur":case"afterblur":m=i2;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=S7;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=JH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=fU;break;case XI:case JI:case ZI:m=tU;break;case ej:m=pU;break;case"scroll":case"scrollend":m=QH;break;case"wheel":m=yU;break;case"copy":case"cut":case"paste":m=sU;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=C7;break;case"toggle":case"beforetoggle":m=vU}var y=(t&4)!==0,w=!y&&(e==="scroll"||e==="scrollend"),b=y?f!==null?f+"Capture":null:f;y=[];for(var v=c,x;v!==null;){var _=v;if(x=_.stateNode,_=_.tag,_!==5&&_!==26&&_!==27||x===null||b===null||(_=Y0(v,b),_!=null&&y.push(rp(v,_,x))),w)break;v=v.return}0<y.length&&(f=new m(f,p,null,n,d),h.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==Z4&&(p=n.relatedTarget||n.fromElement)&&(Fh(p)||p[Xf]))break e;if((m||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,m?(p=n.relatedTarget||n.toElement,m=c,p=p?Fh(p):null,p!==null&&(w=Bp(p),y=p.tag,p!==w||y!==5&&y!==27&&y!==6)&&(p=null)):(m=null,p=c),m!==p)){if(y=S7,_="onMouseLeave",b="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(y=C7,_="onPointerLeave",b="onPointerEnter",v="pointer"),w=m==null?f:Jm(m),x=p==null?f:Jm(p),f=new y(_,v+"leave",m,n,d),f.target=w,f.relatedTarget=x,_=null,Fh(d)===c&&(y=new y(b,v+"enter",p,n,d),y.target=x,y.relatedTarget=w,_=y),w=_,m&&p)t:{for(y=bV,b=m,v=p,x=0,_=b;_;_=y(_))x++;_=0;for(var E=v;E;E=y(E))_++;for(;0<x-_;)b=y(b),x--;for(;0<_-x;)v=y(v),_--;for(;x--;){if(b===v||v!==null&&b===v.alternate){y=b;break t}b=y(b),v=y(v)}y=null}else y=null;m!==null&&y9(h,f,m,y,!1),p!==null&&w!==null&&y9(h,w,p,y,!0)}}e:{if(f=c?Jm(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var k=N7;else if(M7(f))if(WI)k=MU;else{k=AU;var M=CU}else m=f.nodeName,!m||m.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&u5(c.elementType)&&(k=N7):k=EU;if(k&&(k=k(e,c))){VI(h,k,n,d);break e}M&&M(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&J4(f,"number",f.value)}switch(M=c?Jm(c):window,e){case"focusin":(M7(M)||M.contentEditable==="true")&&(Uh=M,t_=c,b0=null);break;case"focusout":b0=t_=Uh=null;break;case"mousedown":n_=!0;break;case"contextmenu":case"mouseup":case"dragend":n_=!1,D7(h,n,d);break;case"selectionchange":if(IU)break;case"keydown":case"keyup":D7(h,n,d)}var R;if(m5)e:{switch(e){case"compositionstart":var L="onCompositionStart";break e;case"compositionend":L="onCompositionEnd";break e;case"compositionupdate":L="onCompositionUpdate";break e}L=void 0}else Hh?HI(e,n)&&(L="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(L="onCompositionStart");L&&(qI&&n.locale!=="ko"&&(Hh||L!=="onCompositionStart"?L==="onCompositionEnd"&&Hh&&(R=FI()):(Jc=d,h5="value"in Jc?Jc.value:Jc.textContent,Hh=!0)),M=Jy(c,L),0<M.length&&(L=new T7(L,e,null,n,d),h.push({event:L,listeners:M}),R?L.data=R:(R=UI(n),R!==null&&(L.data=R)))),(R=xU?_U(e,n):kU(e,n))&&(L=Jy(c,"onBeforeInput"),0<L.length&&(M=new T7("onBeforeInput","beforeinput",null,n,d),h.push({event:M,listeners:L}),M.data=R)),mV(h,e,c,n,d)}zR(h,t)})}function rp(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jy(e,t){for(var n=t+"Capture",s=[];e!==null;){var r=e,i=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||i===null||(r=Y0(e,n),r!=null&&s.unshift(rp(e,r,i)),r=Y0(e,t),r!=null&&s.push(rp(e,r,i))),e.tag===3)return s;e=e.return}return[]}function bV(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function y9(e,t,n,s,r){for(var i=t._reactName,o=[];n!==null&&n!==s;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===s)break;a!==5&&a!==26&&a!==27||c===null||(l=c,r?(c=Y0(n,i),c!=null&&o.unshift(rp(n,c,l))):r||(c=Y0(n,i),c!=null&&o.push(rp(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var vV=/\r\n?/g,wV=/\u0000|\uFFFD/g;function b9(e){return(typeof e=="string"?e:""+e).replace(vV,`
`).replace(wV,"")}function qR(e,t){return t=b9(t),b9(e)===t}function ws(e,t,n,s,r,i){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Tf(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Tf(e,""+s);break;case"className":Lg(e,"class",s);break;case"tabIndex":Lg(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Lg(e,n,s);break;case"style":$I(e,s,i);break;case"data":if(t!=="object"){Lg(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=G1(""+s),e.setAttribute(n,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(t!=="input"&&ws(e,t,"name",r.name,r,null),ws(e,t,"formEncType",r.formEncType,r,null),ws(e,t,"formMethod",r.formMethod,r,null),ws(e,t,"formTarget",r.formTarget,r,null)):(ws(e,t,"encType",r.encType,r,null),ws(e,t,"method",r.method,r,null),ws(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(n);break}s=G1(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=Yl);break;case"onScroll":s!=null&&Dn("scroll",e);break;case"onScrollEnd":s!=null&&Dn("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(Ce(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(Ce(60));e.innerHTML=n}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}n=G1(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""+s):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":s===!0?e.setAttribute(n,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(n,s):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(n,s):e.removeAttribute(n);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(n):e.setAttribute(n,s);break;case"popover":Dn("beforetoggle",e),Dn("toggle",e),W1(e,"popover",s);break;case"xlinkActuate":Ll(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Ll(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Ll(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Ll(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Ll(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Ll(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Ll(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Ll(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Ll(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":W1(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=KH.get(n)||n,W1(e,n,s))}}function C_(e,t,n,s,r,i){switch(n){case"style":$I(e,s,i);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(Ce(61));if(n=s.__html,n!=null){if(r.children!=null)throw Error(Ce(60));e.innerHTML=n}}break;case"children":typeof s=="string"?Tf(e,s):(typeof s=="number"||typeof s=="bigint")&&Tf(e,""+s);break;case"onScroll":s!=null&&Dn("scroll",e);break;case"onScrollEnd":s!=null&&Dn("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Yl);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!RI.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),i=e[ao]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,r),typeof s=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,s,r);break e}n in e?e[n]=s:s===!0?e.setAttribute(n,""):W1(e,n,s)}}}function ai(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Dn("error",e),Dn("load",e);var s=!1,r=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":s=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Ce(137,t));default:ws(e,t,i,o,n,null)}}r&&ws(e,t,"srcSet",n.srcSet,n,null),s&&ws(e,t,"src",n.src,n,null);return;case"input":Dn("invalid",e);var a=i=o=r=null,l=null,c=null;for(s in n)if(n.hasOwnProperty(s)){var d=n[s];if(d!=null)switch(s){case"name":r=d;break;case"type":o=d;break;case"checked":l=d;break;case"defaultChecked":c=d;break;case"value":i=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(Ce(137,t));break;default:ws(e,t,s,d,n,null)}}OI(e,i,a,l,c,o,r,!1);return;case"select":Dn("invalid",e),s=o=i=null;for(r in n)if(n.hasOwnProperty(r)&&(a=n[r],a!=null))switch(r){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":s=a;default:ws(e,t,r,a,n,null)}t=i,n=o,e.multiple=!!s,t!=null?af(e,!!s,t,!1):n!=null&&af(e,!!s,n,!0);return;case"textarea":Dn("invalid",e),i=r=s=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":s=a;break;case"defaultValue":r=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(Ce(91));break;default:ws(e,t,o,a,n,null)}PI(e,s,r,i);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(s=n[l],s!=null))switch(l){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:ws(e,t,l,s,n,null)}return;case"dialog":Dn("beforetoggle",e),Dn("toggle",e),Dn("cancel",e),Dn("close",e);break;case"iframe":case"object":Dn("load",e);break;case"video":case"audio":for(s=0;s<sp.length;s++)Dn(sp[s],e);break;case"image":Dn("error",e),Dn("load",e);break;case"details":Dn("toggle",e);break;case"embed":case"source":case"link":Dn("error",e),Dn("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(s=n[c],s!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(Ce(137,t));default:ws(e,t,c,s,n,null)}return;default:if(u5(t)){for(d in n)n.hasOwnProperty(d)&&(s=n[d],s!==void 0&&C_(e,t,d,s,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(s=n[a],s!=null&&ws(e,t,a,s,n,null))}function xV(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,i=null,o=null,a=null,l=null,c=null,d=null;for(m in n){var h=n[m];if(n.hasOwnProperty(m)&&h!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=h;default:s.hasOwnProperty(m)||ws(e,t,m,null,s,h)}}for(var f in s){var m=s[f];if(h=n[f],s.hasOwnProperty(f)&&(m!=null||h!=null))switch(f){case"type":i=m;break;case"name":r=m;break;case"checked":c=m;break;case"defaultChecked":d=m;break;case"value":o=m;break;case"defaultValue":a=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(Ce(137,t));break;default:m!==h&&ws(e,t,f,m,s,h)}}X4(e,o,a,l,c,d,i,r);return;case"select":m=o=a=f=null;for(i in n)if(l=n[i],n.hasOwnProperty(i)&&l!=null)switch(i){case"value":break;case"multiple":m=l;default:s.hasOwnProperty(i)||ws(e,t,i,null,s,l)}for(r in s)if(i=s[r],l=n[r],s.hasOwnProperty(r)&&(i!=null||l!=null))switch(r){case"value":f=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==l&&ws(e,t,r,i,s,l)}t=a,n=o,s=m,f!=null?af(e,!!n,f,!1):!!s!=!!n&&(t!=null?af(e,!!n,t,!0):af(e,!!n,n?[]:"",!1));return;case"textarea":m=f=null;for(a in n)if(r=n[a],n.hasOwnProperty(a)&&r!=null&&!s.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:ws(e,t,a,null,s,r)}for(o in s)if(r=s[o],i=n[o],s.hasOwnProperty(o)&&(r!=null||i!=null))switch(o){case"value":f=r;break;case"defaultValue":m=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(Ce(91));break;default:r!==i&&ws(e,t,o,r,s,i)}BI(e,f,m);return;case"option":for(var p in n)if(f=n[p],n.hasOwnProperty(p)&&f!=null&&!s.hasOwnProperty(p))switch(p){case"selected":e.selected=!1;break;default:ws(e,t,p,null,s,f)}for(l in s)if(f=s[l],m=n[l],s.hasOwnProperty(l)&&f!==m&&(f!=null||m!=null))switch(l){case"selected":e.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:ws(e,t,l,f,s,m)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var y in n)f=n[y],n.hasOwnProperty(y)&&f!=null&&!s.hasOwnProperty(y)&&ws(e,t,y,null,s,f);for(c in s)if(f=s[c],m=n[c],s.hasOwnProperty(c)&&f!==m&&(f!=null||m!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(Ce(137,t));break;default:ws(e,t,c,f,s,m)}return;default:if(u5(t)){for(var w in n)f=n[w],n.hasOwnProperty(w)&&f!==void 0&&!s.hasOwnProperty(w)&&C_(e,t,w,void 0,s,f);for(d in s)f=s[d],m=n[d],!s.hasOwnProperty(d)||f===m||f===void 0&&m===void 0||C_(e,t,d,f,s,m);return}}for(var b in n)f=n[b],n.hasOwnProperty(b)&&f!=null&&!s.hasOwnProperty(b)&&ws(e,t,b,null,s,f);for(h in s)f=s[h],m=n[h],!s.hasOwnProperty(h)||f===m||f==null&&m==null||ws(e,t,h,f,s,m)}function v9(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _V(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),s=0;s<n.length;s++){var r=n[s],i=r.transferSize,o=r.initiatorType,a=r.duration;if(i&&a&&v9(o)){for(o=0,a=r.responseEnd,s+=1;s<n.length;s++){var l=n[s],c=l.startTime;if(c>a)break;var d=l.transferSize,h=l.initiatorType;d&&v9(h)&&(l=l.responseEnd,o+=d*(l<a?1:(a-c)/(l-c)))}if(--s,t+=8*(i+o)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var A_=null,E_=null;function Zy(e){return e.nodeType===9?e:e.ownerDocument}function w9(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function HR(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function M_(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var I2=null;function kV(){var e=window.event;return e&&e.type==="popstate"?e===I2?!1:(I2=e,!0):(I2=null,!1)}var UR=typeof setTimeout=="function"?setTimeout:void 0,SV=typeof clearTimeout=="function"?clearTimeout:void 0,x9=typeof Promise=="function"?Promise:void 0,TV=typeof queueMicrotask=="function"?queueMicrotask:typeof x9<"u"?function(e){return x9.resolve(null).then(e).catch(CV)}:UR;function CV(e){setTimeout(function(){throw e})}function Pu(e){return e==="head"}function _9(e,t){var n=t,s=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(s===0){e.removeChild(r),Rf(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")E0(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,E0(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[Fp]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&E0(e.ownerDocument.body);n=r}while(n);Rf(t)}function k9(e,t){var n=e;e=0;do{var s=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=s}while(n)}function N_(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":N_(n),c5(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function AV(e,t,n,s){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Fp])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=ia(e.nextSibling),e===null)break}return null}function EV(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ia(e.nextSibling),e===null))return null;return e}function VR(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ia(e.nextSibling),e===null))return null;return e}function I_(e){return e.data==="$?"||e.data==="$~"}function j_(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function MV(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function ia(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var R_=null;function S9(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ia(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function T9(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function WR(e,t,n){switch(t=Zy(n),e){case"html":if(e=t.documentElement,!e)throw Error(Ce(452));return e;case"head":if(e=t.head,!e)throw Error(Ce(453));return e;case"body":if(e=t.body,!e)throw Error(Ce(454));return e;default:throw Error(Ce(451))}}function E0(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);c5(e)}var aa=new Map,C9=new Set;function eb(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var yc=cs.d;cs.d={f:NV,r:IV,D:jV,C:RV,L:LV,m:DV,X:BV,S:OV,M:PV};function NV(){var e=yc.f(),t=Sv();return e||t}function IV(e){var t=Jf(e);t!==null&&t.tag===5&&t.type==="form"?$j(t):yc.r(e)}var nm=typeof document>"u"?null:document;function GR(e,t,n){var s=nm;if(s&&typeof t=="string"&&t){var r=Xo(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),C9.has(r)||(C9.add(r),e={rel:e,crossOrigin:n,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),ai(t,"link",e),Gr(t),s.head.appendChild(t)))}}function jV(e){yc.D(e),GR("dns-prefetch",e,null)}function RV(e,t){yc.C(e,t),GR("preconnect",e,t)}function LV(e,t,n){yc.L(e,t,n);var s=nm;if(s&&e&&t){var r='link[rel="preload"][as="'+Xo(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+Xo(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+Xo(n.imageSizes)+'"]')):r+='[href="'+Xo(e)+'"]';var i=r;switch(t){case"style":i=jf(e);break;case"script":i=sm(e)}aa.has(i)||(e=Hs({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),aa.set(i,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(Gp(i))||t==="script"&&s.querySelector(Kp(i))||(t=s.createElement("link"),ai(t,"link",e),Gr(t),s.head.appendChild(t)))}}function DV(e,t){yc.m(e,t);var n=nm;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Xo(s)+'"][href="'+Xo(e)+'"]',i=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=sm(e)}if(!aa.has(i)&&(e=Hs({rel:"modulepreload",href:e},t),aa.set(i,e),n.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Kp(i)))return}s=n.createElement("link"),ai(s,"link",e),Gr(s),n.head.appendChild(s)}}}function OV(e,t,n){yc.S(e,t,n);var s=nm;if(s&&e){var r=of(s).hoistableStyles,i=jf(e);t=t||"default";var o=r.get(i);if(!o){var a={loading:0,preload:null};if(o=s.querySelector(Gp(i)))a.loading=5;else{e=Hs({rel:"stylesheet",href:e,"data-precedence":t},n),(n=aa.get(i))&&K5(e,n);var l=o=s.createElement("link");Gr(l),ai(l,"link",e),l._p=new Promise(function(c,d){l.onload=c,l.onerror=d}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,sy(o,t,s)}o={type:"stylesheet",instance:o,count:1,state:a},r.set(i,o)}}}function BV(e,t){yc.X(e,t);var n=nm;if(n&&e){var s=of(n).hoistableScripts,r=sm(e),i=s.get(r);i||(i=n.querySelector(Kp(r)),i||(e=Hs({src:e,async:!0},t),(t=aa.get(r))&&Y5(e,t),i=n.createElement("script"),Gr(i),ai(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function PV(e,t){yc.M(e,t);var n=nm;if(n&&e){var s=of(n).hoistableScripts,r=sm(e),i=s.get(r);i||(i=n.querySelector(Kp(r)),i||(e=Hs({src:e,async:!0,type:"module"},t),(t=aa.get(r))&&Y5(e,t),i=n.createElement("script"),Gr(i),ai(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},s.set(r,i))}}function A9(e,t,n,s){var r=(r=lu.current)?eb(r):null;if(!r)throw Error(Ce(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=jf(n.href),n=of(r).hoistableStyles,s=n.get(t),s||(s={type:"style",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=jf(n.href);var i=of(r).hoistableStyles,o=i.get(e);if(o||(r=r.ownerDocument||r,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=r.querySelector(Gp(e)))&&!i._p&&(o.instance=i,o.state.loading=5),aa.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},aa.set(e,n),i||$V(r,e,n,o.state))),t&&s===null)throw Error(Ce(528,""));return o}if(t&&s!==null)throw Error(Ce(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=sm(n),n=of(r).hoistableScripts,s=n.get(t),s||(s={type:"script",instance:null,count:0,state:null},n.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(Ce(444,e))}}function jf(e){return'href="'+Xo(e)+'"'}function Gp(e){return'link[rel="stylesheet"]['+e+"]"}function KR(e){return Hs({},e,{"data-precedence":e.precedence,precedence:null})}function $V(e,t,n,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),ai(t,"link",n),Gr(t),e.head.appendChild(t))}function sm(e){return'[src="'+Xo(e)+'"]'}function Kp(e){return"script[async]"+e}function E9(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Xo(n.href)+'"]');if(s)return t.instance=s,Gr(s),s;var r=Hs({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Gr(s),ai(s,"style",r),sy(s,n.precedence,e),t.instance=s;case"stylesheet":r=jf(n.href);var i=e.querySelector(Gp(r));if(i)return t.state.loading|=4,t.instance=i,Gr(i),i;s=KR(n),(r=aa.get(r))&&K5(s,r),i=(e.ownerDocument||e).createElement("link"),Gr(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),ai(i,"link",s),t.state.loading|=4,sy(i,n.precedence,e),t.instance=i;case"script":return i=sm(n.src),(r=e.querySelector(Kp(i)))?(t.instance=r,Gr(r),r):(s=n,(r=aa.get(i))&&(s=Hs({},n),Y5(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),Gr(r),ai(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(Ce(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,sy(s,n.precedence,e));return t.instance}function sy(e,t,n){for(var s=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=s.length?s[s.length-1]:null,i=r,o=0;o<s.length;o++){var a=s[o];if(a.dataset.precedence===t)i=a;else if(i!==r)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function K5(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Y5(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ry=null;function M9(e,t,n){if(ry===null){var s=new Map,r=ry=new Map;r.set(n,s)}else r=ry,s=r.get(n),s||(s=new Map,r.set(n,s));if(s.has(e))return s;for(s.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var i=n[r];if(!(i[Fp]||i[si]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=s.get(o);a?a.push(i):s.set(o,[i])}}return s}function N9(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function zV(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function YR(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function FV(e,t,n,s){if(n.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var r=jf(s.href),i=t.querySelector(Gp(r));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=tb.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Gr(i);return}i=t.ownerDocument||t,s=KR(s),(r=aa.get(r))&&K5(s,r),i=i.createElement("link"),Gr(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),ai(i,"link",s),n.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=tb.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var j2=0;function qV(e,t){return e.stylesheets&&e.count===0&&iy(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&iy(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&j2===0&&(j2=62500*_V());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&iy(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>j2?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function tb(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)iy(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var nb=null;function iy(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,nb=new Map,t.forEach(HV,e),nb=null,tb.call(e))}function HV(e,t){if(!(t.state.loading&4)){var n=nb.get(e);if(n)var s=n.get(null);else{n=new Map,nb.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<r.length;i++){var o=r[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),s=o)}s&&n.set(null,s)}r=t.instance,o=r.getAttribute("data-precedence"),i=n.get(o)||s,i===s&&n.set(null,r),n.set(o,r),this.count++,s=tb.bind(this),r.addEventListener("load",s),r.addEventListener("error",s),i?i.parentNode.insertBefore(r,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var ip={$$typeof:Kl,Provider:null,Consumer:null,_currentValue:Cd,_currentValue2:Cd,_threadCount:0};function UV(e,t,n,s,r,i,o,a,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=t2(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=t2(0),this.hiddenUpdates=t2(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function QR(e,t,n,s,r,i,o,a,l,c,d,h){return e=new UV(e,t,n,o,l,c,d,h,a),t=1,i===!0&&(t|=24),i=wo(3,null,null,t),e.current=i,i.stateNode=e,t=x5(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:s,isDehydrated:n,cache:t},S5(i),e}function XR(e){return e?(e=Gh,e):Gh}function JR(e,t,n,s,r,i){r=XR(r),s.context===null?s.context=r:s.pendingContext=r,s=uu(t),s.payload={element:n},i=i===void 0?null:i,i!==null&&(s.callback=i),n=du(e,s,t),n!==null&&(oo(n,e,t),w0(n,e,t))}function I9(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Q5(e,t){I9(e,t),(e=e.alternate)&&I9(e,t)}function ZR(e){if(e.tag===13||e.tag===31){var t=sh(e,67108864);t!==null&&oo(t,e,67108864),Q5(e,67108864)}}function j9(e){if(e.tag===13||e.tag===31){var t=Eo();t=a5(t);var n=sh(e,t);n!==null&&oo(n,e,t),Q5(e,t)}}var sb=!0;function VV(e,t,n,s){var r=sn.T;sn.T=null;var i=cs.p;try{cs.p=2,X5(e,t,n,s)}finally{cs.p=i,sn.T=r}}function WV(e,t,n,s){var r=sn.T;sn.T=null;var i=cs.p;try{cs.p=8,X5(e,t,n,s)}finally{cs.p=i,sn.T=r}}function X5(e,t,n,s){if(sb){var r=L_(s);if(r===null)N2(e,t,s,rb,n),R9(e,s);else if(KV(r,e,t,n,s))s.stopPropagation();else if(R9(e,s),t&4&&-1<GV.indexOf(e)){for(;r!==null;){var i=Jf(r);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=ld(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Ao(o);a.entanglements[1]|=l,o&=~l}yl(i),!(as&6)&&(Gy=To()+500,Wp(0))}}break;case 31:case 13:a=sh(i,2),a!==null&&oo(a,i,2),Sv(),Q5(i,2)}if(i=L_(s),i===null&&N2(e,t,s,rb,n),i===r)break;r=i}r!==null&&s.stopPropagation()}else N2(e,t,s,null,n)}}function L_(e){return e=d5(e),J5(e)}var rb=null;function J5(e){if(rb=null,e=Fh(e),e!==null){var t=Bp(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=vI(t),e!==null)return e;e=null}else if(n===31){if(e=wI(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return rb=e,null}function eL(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(jH()){case SI:return 2;case TI:return 8;case Ry:case RH:return 32;case CI:return 268435456;default:return 32}default:return 32}}var D_=!1,mu=null,pu=null,gu=null,op=new Map,ap=new Map,Kc=[],GV="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function R9(e,t){switch(e){case"focusin":case"focusout":mu=null;break;case"dragenter":case"dragleave":pu=null;break;case"mouseover":case"mouseout":gu=null;break;case"pointerover":case"pointerout":op.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ap.delete(t.pointerId)}}function Nm(e,t,n,s,r,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:s,nativeEvent:i,targetContainers:[r]},t!==null&&(t=Jf(t),t!==null&&ZR(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function KV(e,t,n,s,r){switch(t){case"focusin":return mu=Nm(mu,e,t,n,s,r),!0;case"dragenter":return pu=Nm(pu,e,t,n,s,r),!0;case"mouseover":return gu=Nm(gu,e,t,n,s,r),!0;case"pointerover":var i=r.pointerId;return op.set(i,Nm(op.get(i)||null,e,t,n,s,r)),!0;case"gotpointercapture":return i=r.pointerId,ap.set(i,Nm(ap.get(i)||null,e,t,n,s,r)),!0}return!1}function tL(e){var t=Fh(e.target);if(t!==null){var n=Bp(t);if(n!==null){if(t=n.tag,t===13){if(t=vI(n),t!==null){e.blockedOn=t,y7(e.priority,function(){j9(n)});return}}else if(t===31){if(t=wI(n),t!==null){e.blockedOn=t,y7(e.priority,function(){j9(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function oy(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=L_(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Z4=s,n.target.dispatchEvent(s),Z4=null}else return t=Jf(n),t!==null&&ZR(t),e.blockedOn=n,!1;t.shift()}return!0}function L9(e,t,n){oy(e)&&n.delete(t)}function YV(){D_=!1,mu!==null&&oy(mu)&&(mu=null),pu!==null&&oy(pu)&&(pu=null),gu!==null&&oy(gu)&&(gu=null),op.forEach(L9),ap.forEach(L9)}function qg(e,t){e.blockedOn===t&&(e.blockedOn=null,D_||(D_=!0,Br.unstable_scheduleCallback(Br.unstable_NormalPriority,YV)))}var Hg=null;function D9(e){Hg!==e&&(Hg=e,Br.unstable_scheduleCallback(Br.unstable_NormalPriority,function(){Hg===e&&(Hg=null);for(var t=0;t<e.length;t+=3){var n=e[t],s=e[t+1],r=e[t+2];if(typeof s!="function"){if(J5(s||n)===null)continue;break}var i=Jf(n);i!==null&&(e.splice(t,3),t-=3,p_(i,{pending:!0,data:r,method:n.method,action:s},s,r))}}))}function Rf(e){function t(l){return qg(l,e)}mu!==null&&qg(mu,e),pu!==null&&qg(pu,e),gu!==null&&qg(gu,e),op.forEach(t),ap.forEach(t);for(var n=0;n<Kc.length;n++){var s=Kc[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Kc.length&&(n=Kc[0],n.blockedOn===null);)tL(n),n.blockedOn===null&&Kc.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(s=0;s<n.length;s+=3){var r=n[s],i=n[s+1],o=r[ao]||null;if(typeof i=="function")o||D9(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(r=i,o=i[ao]||null)a=o.formAction;else if(J5(r)!==null)continue}else a=o.action;typeof a=="function"?n[s+1]=a:(n.splice(s,3),s-=3),D9(n)}}}function nL(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return r=o})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),s||setTimeout(n,20)}function n(){if(!s&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Z5(e){this._internalRoot=e}Av.prototype.render=Z5.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ce(409));var n=t.current,s=Eo();JR(n,s,e,t,null,null)};Av.prototype.unmount=Z5.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;JR(e.current,2,null,e,null,null),Sv(),t[Xf]=null}};function Av(e){this._internalRoot=e}Av.prototype.unstable_scheduleHydration=function(e){if(e){var t=II();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kc.length&&t!==0&&t<Kc[n].priority;n++);Kc.splice(n,0,e),n===0&&tL(e)}};var O9=yI.version;if(O9!=="19.2.4")throw Error(Ce(527,O9,"19.2.4"));cs.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Ce(188)):(e=Object.keys(e).join(","),Error(Ce(268,e)));return e=TH(t),e=e!==null?xI(e):null,e=e===null?null:e.stateNode,e};var QV={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:sn,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ug=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ug.isDisabled&&Ug.supportsFiber)try{Pp=Ug.inject(QV),Co=Ug}catch{}}uv.createRoot=function(e,t){if(!bI(e))throw Error(Ce(299));var n=!1,s="",r=Gj,i=Kj,o=Yj;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=QR(e,1,!1,null,null,n,s,null,r,i,o,nL),e[Xf]=t.current,G5(e),new Z5(t)};uv.hydrateRoot=function(e,t,n){if(!bI(e))throw Error(Ce(299));var s=!1,r="",i=Gj,o=Kj,a=Yj,l=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(o=n.onCaughtError),n.onRecoverableError!==void 0&&(a=n.onRecoverableError),n.formState!==void 0&&(l=n.formState)),t=QR(e,1,!0,t,n??null,s,r,l,i,o,a,nL),t.context=XR(null),n=t.current,s=Eo(),s=a5(s),r=uu(s),r.callback=null,du(n,r,s),n=s,t.current.lanes=n,zp(t,n),yl(t),e[Xf]=t.current,G5(e),new Av(t)};uv.version="19.2.4";function sL(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sL)}catch(e){console.error(e)}}sL(),dI.exports=uv;var XV=dI.exports;const JV=lv(XV);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ZV="agent";function eW(e){return e===ZV}var tW=3e4,nW=new Set(["authorized","expired","error","cancelled"]),sW=class{constructor(e){this.client=e}async start(e){let t=await this.client.startDeviceFlow(e),n=this.client;return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,userCode:t.userCode,verificationUri:t.verificationUri,verificationUriComplete:t.verificationUriComplete,expiresAt:t.expiresAt,intervalMs:t.intervalMs,attached:t.attached,cancel:()=>n.cancelDeviceFlow(t.deviceFlowId,{clientId:e.clientId}),awaitCompletion:async(s={})=>await rW(n,t,e.clientId,s)}}status(e,t){return this.client.getDeviceFlow(e,t)}cancel(e,t){return this.client.cancelDeviceFlow(e,t)}};async function rW(e,t,n,s){return await iW(e,t,n,s)}async function B9(e,t,n,s){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:s})}catch(r){if(r instanceof Fd&&r.status===404)return{deviceFlowId:t.deviceFlowId,providerId:t.providerId,status:"error",errorKind:"not_found_or_evicted",hint:"device-flow not found on daemon (evicted past terminal grace, daemon restart, or unknown deviceFlowId)",createdAt:Date.now()};throw r}}function P9(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function iW(e,t,n,s){var d;let r=s.signal,i=P9(s.timeoutMs,{allowZero:!0}),o=P9(s.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+tW,l=Math.max(1e3,o??t.intervalMs??5e3),c=l;for(;;){if(r!=null&&r.aborted)throw O_(r);if(Date.now()>=a)return await B9(e,t,n,r);let h=await B9(e,t,n,r);if(h.intervalMs&&h.intervalMs!==c&&(c=h.intervalMs,l=h.intervalMs,(d=s.onThrottled)==null||d.call(s,h.intervalMs)),nW.has(h.status))return h;await oW(l,r)}}async function oW(e,t){if(t!=null&&t.aborted)throw O_(t);await new Promise((n,s)=>{let r=setTimeout(()=>{o(),n()},e),i=()=>{o(),s(O_(t))};function o(){clearTimeout(r),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function O_(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var Fd=class extends Error{constructor(t,n,s){super(s);ye(this,"status");ye(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},$9=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},aW=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},z9=16*1024*1024;async function*lW(e,t){let n=e.getReader(),s=new TextDecoder,r="",i;t&&(i=()=>{n.cancel().catch(()=>{})},t.aborted?i():t.addEventListener("abort",i,{once:!0}));try{for(;;){if(t!=null&&t.aborted)return;let o,a;try{({value:o,done:a}=await n.read())}catch(c){if(t!=null&&t.aborted)return;throw c}if(a){if(r+=s.decode(),r.length>0){let c=F9(r);for(let d of c.frames){let h=R2(d);h&&(yield h)}if(c.tail.length>0){let d=R2(c.tail);d&&(yield d)}}return}if(r+=s.decode(o,{stream:!0}),r.length>z9)throw new aW(`parseSseStream: unread buffer exceeded ${z9} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=F9(r);if(l.frames.length>0)for(let c of l.frames){let d=R2(c);d&&(yield d)}r=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function F9(e){let t=[],n=0;for(;n<e.length;){let s=e.indexOf(`

`,n);if(s===-1){let i=e.indexOf(`\r
\r
`,n);if(i===-1)break;t.push(e.slice(n,i)),n=i+4;continue}let r=e.slice(n,s).indexOf(`\r
\r
`);if(r!==-1){let i=n+r;t.push(e.slice(n,i)),n=i+4}else t.push(e.slice(n,s)),n=s+2}return{frames:t,tail:e.slice(n)}}function R2(e){if(!e)return;let t=[];for(let s of e.split(/\r?\n/)){if(!s.startsWith("data:"))continue;let r=s.slice(5);t.push(r.startsWith(" ")?r.slice(1):r)}if(t.length===0)return;let n=t.join(`
`);try{let s=JSON.parse(n);if(typeof s!="object"||s===null||Array.isArray(s)||s.v!==1||typeof s.type!="string")return;let r=s.id;return r!==void 0&&(!Number.isSafeInteger(r)||r<1)?void 0:s}catch{return}}var cW=class{constructor(e,t,n){ye(this,"baseUrl");ye(this,"token");ye(this,"_fetch");ye(this,"_disposed",!1);ye(this,"type","rest");ye(this,"supportsReplay",!0);this.baseUrl=e,this.token=t,this._fetch=n}get connected(){return!this._disposed}async fetch(e,t,n){if(this._disposed)throw new $9;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var d;if(this._disposed)throw new $9;let n={Accept:"text/event-stream"};this.token&&(n.Authorization=`Bearer ${this.token}`),t.lastEventId!==void 0&&(n["Last-Event-ID"]=String(t.lastEventId));let s=new AbortController,r,i=t.connectTimeoutMs;i&&Number.isFinite(i)&&(r=setTimeout(()=>s.abort(new DOMException("Initial connect timed out","TimeoutError")),i),typeof r=="object"&&r&&"unref"in r&&r.unref());let o=t.signal?uW([t.signal,s.signal]):s.signal,a=`${this.baseUrl}/session/${encodeURIComponent(e)}/events`;t.maxQueued!==void 0&&(a+=`?maxQueued=${encodeURIComponent(String(t.maxQueued))}`);let l;try{l=await this._fetch(a,{headers:n,signal:o})}finally{r!==void 0&&clearTimeout(r)}if(!l.ok){let h;try{let m=await l.text();try{h=JSON.parse(m)}catch{h=m}}catch{}let f=h&&typeof h=="object"&&"error"in h?String(h.error):`HTTP ${l.status}`;throw new Fd(l.status,h,`GET /session/:id/events: ${f}`)}let c=l.headers.get("content-type")??"";if(!c.toLowerCase().includes("text/event-stream")){try{await((d=l.body)==null?void 0:d.cancel())}catch{}throw new Fd(l.status,c,`GET /session/:id/events: expected content-type text/event-stream, got "${c}"`)}if(!l.body)throw new Error("No SSE body");yield*lW(l.body,t.signal)}dispose(){this._disposed=!0}};function uW(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}var Vg="/workspace/memory/remember",Wg="/workspace/memory/forget",Gg="/workspace/memory/dream",q9=20,dW=3e4,hW=65e3,fW=9e4,mW=5,Im=33e4,pW="X-Qwen-Client-Id",yt=encodeURIComponent;function H9(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function rL(e){if(e===void 0)return mW;if(e===null||e===0||e===1/0)return 1/0;if(!Number.isInteger(e)||e<0)throw new TypeError("bad maxPendingPromptsPerSession");return e}function gW(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function yW(){var e,t;try{let n=(t=(e=globalThis.process)==null?void 0:e.env)==null?void 0:t.QWEN_SERVER_TOKEN;if(typeof n!="string")return;let s=n.trim();return s.length===0?void 0:s}catch{return}}var U9=class extends Error{constructor(e,t,n){super(`Pending prompts full: "${e}" (${n}/${t})`),this.name="DaemonPendingPromptLimitError",this.sessionId=e,this.limit=t,this.pendingCount=n}};function iL(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var B_=class{constructor(e){ye(this,"baseUrl");ye(this,"token");ye(this,"_fetch");ye(this,"fetchTimeoutMs");ye(this,"promptLimit");ye(this,"promptCounts",Object.create(null));ye(this,"transport");ye(this,"_authFlow");this.baseUrl=gW(e.baseUrl),this.token=e.token??yW(),this._fetch=e.fetch??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??dW;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=rL(e.maxPendingPromptsPerSession),this.transport=e.transport??new cW(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new sW(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(e,t=this.promptLimit){if(t===1/0)return()=>{};let n=this.promptCounts,s=n[e]??0;if(s>=t)throw new U9(e,t,s);n[e]=s+1;let r;return()=>{r||(r=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,s,r="transport"){let i=this.fetchTimeoutMs;if(s!==void 0&&Number.isFinite(s)&&s>=0&&(i=s),!i||!Number.isFinite(i)){let d=r==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(d):d}let o=new AbortController,a=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof a=="object"&&a&&"unref"in a&&a.unref();let l=t.signal??void 0,c=l?V9([l,o.signal]):o.signal;try{let d=r==="rest"?await this._fetch(e,{...t,signal:c}):await this.transport.fetch(e,{...t,signal:c});return n?await n(d):d}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[pW]=t),n}async failOnError(e,t,n){let s;try{let i=await e.text();if(i.length>0)try{s=JSON.parse(i)}catch{s=i}}catch{}let r=s&&typeof s=="object"&&"error"in s?String(s.error):`HTTP ${e.status}`;if(n&&e.status===503&&s&&typeof s=="object"){let i=s;if(i.code==="prompt_queue_full")return new U9(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new Fd(e.status,s,`${t}: ${r}`)}async jsonRequest(e,t,n={}){let s=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(s?{"Content-Type":"application/json"}:{},n.clientId),...s?{body:JSON.stringify(n.body)}:{}},async r=>{if(!r.ok)throw await this.failOnError(r,t);return await r.json()},n.timeoutMs)}async health(){return await this.fetchWithTimeout(`${this.baseUrl}/health`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /health");return await e.json()})}async capabilities(){return await this.fetchWithTimeout(`${this.baseUrl}/capabilities`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /capabilities");return await e.json()})}async daemonStatus(e="summary"){let t=e==="summary"?"":`?detail=${e}`;return await this.jsonRequest(`/daemon/status${t}`,"GET /daemon/status")}async usageDashboard(e={}){let t=new URLSearchParams;e.range!==void 0&&t.set("range",e.range),e.heatmapDays!==void 0&&t.set("heatmapDays",String(e.heatmapDays));let n=t.toString();return await this.jsonRequest(`/usage/dashboard${n?`?${n}`:""}`,"GET /usage/dashboard")}async workspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/mcp");return await e.json()})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${yt(e)}/tools`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/tools");return await t.json()})}async workspaceMcpResources(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${yt(e)}/resources`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/mcp/:server/resources");return await t.json()})}async workspaceSkills(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/skills");return await e.json()})}async workspaceProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/providers");return await e.json()})}async workspaceHooks(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/hooks`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/hooks");return await e.json()})}async sessionHooks(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/hooks`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/hooks");return await t.json()})}async workspaceExtensions(){return await this.jsonRequest("/workspace/extensions","GET /workspace/extensions")}async installExtension(e,t){return await this.jsonRequest("/workspace/extensions/install","POST /workspace/extensions/install",{method:"POST",body:e,clientId:t})}async extensionOperationStatus(e){return await this.jsonRequest(`/workspace/extensions/operations/${yt(e)}`,"GET /workspace/extensions/operations/:operationId")}async checkExtensionUpdates(e){return await this.jsonRequest("/workspace/extensions/check-updates","POST /workspace/extensions/check-updates",{method:"POST",body:{},clientId:e})}async refreshExtensions(e){return await this.jsonRequest("/workspace/extensions/refresh","POST /workspace/extensions/refresh",{method:"POST",body:{},clientId:e})}async enableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${yt(e)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:t,clientId:n})}async disableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${yt(e)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:t,clientId:n})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${yt(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${yt(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t})}async readWorkspaceFile(e,t={},n){let s=new URL(`${this.baseUrl}/file`);return s.searchParams.set("path",e),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&s.searchParams.set("line",String(t.line)),t.limit!==void 0&&s.searchParams.set("limit",String(t.limit)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file");return await r.json()})}async readWorkspaceFileBytes(e,t={},n){let s=new URL(`${this.baseUrl}/file/bytes`);return s.searchParams.set("path",e),t.offset!==void 0&&s.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&s.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(s.toString(),{headers:this.headers({},n)},async r=>{if(!r.ok)throw await this.failOnError(r,"GET /file/bytes");return await r.json()})}async fileStat(e){let t=new URL(`${this.baseUrl}/stat`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /stat");return await n.json()})}async dirList(e){let t=new URL(`${this.baseUrl}/list`);return t.searchParams.set("path",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /list");return await n.json()})}async glob(e){let t=new URL(`${this.baseUrl}/glob`);return t.searchParams.set("pattern",e),await this.fetchWithTimeout(t.toString(),{headers:this.headers()},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /glob");return await n.json()})}async writeWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/write`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/write");return await n.json()})}async editWorkspaceFile(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/file/edit`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /file/edit");return await n.json()})}async workspaceMemory(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/memory");return await e.json()})}async writeWorkspaceMemory(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/memory`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/memory");return await n.json()})}async rememberWorkspaceMemory(e,t={}){return await this.jsonRequest(Vg,`POST ${Vg}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${Vg}/${yt(e)}`,`GET ${Vg}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(Wg,`POST ${Wg}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${Wg}/${yt(e)}`,`GET ${Wg}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(Gg,`POST ${Gg}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${Gg}/${yt(e)}`,`GET ${Gg}/:taskId`,{clientId:t==null?void 0:t.clientId})}async listWorkspaceAgents(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/agents");return await e.json()})}async createWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents");return await n.json()})}async generateWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({description:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents/generate");return await n.json()},Im)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${yt(e)}`,{headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/agents/:agentType");return await t.json()})}async updateWorkspaceAgent(e,t,n={},s){let r=n.scope?`${this.baseUrl}/workspace/agents/${yt(e)}?scope=${yt(n.scope)}`:`${this.baseUrl}/workspace/agents/${yt(e)}`;return await this.fetchWithTimeout(r,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t)},async i=>{if(!i.ok)throw await this.failOnError(i,"POST /workspace/agents/:agentType");return await i.json()})}async deleteWorkspaceAgent(e,t={},n){let s=t.scope?`${this.baseUrl}/workspace/agents/${yt(e)}?scope=${yt(t.scope)}`:`${this.baseUrl}/workspace/agents/${yt(e)}`;return await this.fetchWithTimeout(s,{method:"DELETE",headers:this.headers({},n)},async r=>{var i;if(r.status===204){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return}if(r.status===404){let o=await this.failOnError(r,"DELETE /workspace/agents/:agentType"),a=o.body;if(a&&a.code==="agent_not_found")return;throw o}throw await this.failOnError(r,"DELETE /workspace/agents/:agentType")})}async workspaceEnv(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/env`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/env");return await e.json()})}async workspacePreflight(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/preflight`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/preflight");return await e.json()})}async workspaceTools(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/tools");return await e.json()})}async createOrAttachSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({cwd:e.workspaceCwd,...e.modelServiceId?{modelServiceId:e.modelServiceId}:{},...e.sessionScope!==void 0?{sessionScope:e.sessionScope}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session");return await n.json()})}async listWorkspaceSessions(e,t){return(await this.listWorkspaceSessionsPage(e,t)).sessions}async listWorkspaceSessionsPage(e,t){let n=(t==null?void 0:t.pageSize)??q9,s=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:q9))),r=new URLSearchParams({size:String(s)});return(t==null?void 0:t.cursor)!==void 0&&r.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&r.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&r.set("view",t.view),(t==null?void 0:t.group)!==void 0&&r.set("group",t.group),await this.jsonRequest(`/workspace/${yt(e)}/sessions?${r.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${yt(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${yt(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${yt(e)}/session-groups/${yt(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${yt(e)}/session-groups/${yt(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${yt(e)}/organization`,"PATCH /session/:id/organization",{method:"PATCH",body:t,clientId:n})}async loadSession(e,t={},n){return this.restoreSession("load",e,t,n)}async exportSession(e,t={}){let n=t.format??"html",s=t.format?`?format=${yt(t.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/export${s}`,{headers:this.headers({},t.clientId)},async r=>{var l;if(!r.ok)throw await this.failOnError(r,"GET /session/:id/export");let i=await r.text(),o=r.headers.get("content-type")??"",a=((l=/filename="([^"]+)"/i.exec(r.headers.get("content-disposition")??""))==null?void 0:l[1])??`export.${n}`;return{content:i,filename:a,mimeType:o,format:n}},void 0,"rest")}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:t.name})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/branch");return await s.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/fork");return await s.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/context`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/context");return await n.json()})}async sessionContextUsage(e,t={},n){let s=new URLSearchParams;t.detail===!0&&s.set("detail","true");let r=s.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/context-usage${r?`?${r}`:""}`,{headers:this.headers({},n)},async i=>{if(!i.ok)throw await this.failOnError(i,"GET /session/:id/context-usage");return await i.json()})}async sessionSupportedCommands(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/supported-commands`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/supported-commands");return await n.json()})}async sessionTasks(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/tasks`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/tasks");return await n.json()})}async sessionLspStatus(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/lsp`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/lsp");return await n.json()})}async sessionTaskCancel(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/tasks/${yt(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({kind:n})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/tasks/:taskId/cancel");return await r.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/goal/clear`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/goal/clear");return await n.json()})}async sessionStats(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/stats`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/stats");return await n.json()})}async restoreSession(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify({cwd:n.workspaceCwd})},async r=>{if(!r.ok)throw await this.failOnError(r,`POST /session/:id/${e}`);return await r.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/approval-mode`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({mode:t,...(n==null?void 0:n.persist)===!0?{persist:!0}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/approval-mode");return await s.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/rewind/snapshots`,{method:"GET",headers:this.headers()},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /session/:id/rewind/snapshots");return await t.json()})}async rewindSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/rewind`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({promptId:t,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/rewind");return await s.json()})}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${yt(e)}/recap`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}",signal:t==null?void 0:t.signal});if(!n.ok)throw await this.failOnError(n,"POST /session/:id/recap");return await n.json()}async btwSession(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${yt(e)}/btw`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({question:t}),signal:n==null?void 0:n.signal});if(!s.ok)throw await this.failOnError(s,"POST /session/:id/btw");return await s.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/mid-turn-message`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({message:t}),signal:n==null?void 0:n.signal},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/mid-turn-message");return await s.json()})}async getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/pending-prompts`,{method:"GET",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/pending-prompts");return await n.json()})}async removePendingPrompt(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/pending-prompts/${yt(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async s=>{if(!s.ok)throw await this.failOnError(s,"DELETE /session/:id/pending-prompts/:promptId");return await s.json()})}async shellCommand(e,t,n){let s=await this.transport.fetch(`${this.baseUrl}/session/${yt(e)}/shell`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({command:t}),signal:n==null?void 0:n.signal});if(!s.ok)throw await this.failOnError(s,"POST /session/:id/shell");return await s.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${yt(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/tools/:name/enable");return await s.json()})}async workspaceSettings(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/settings");return await t.json()})}async setWorkspaceSetting(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s==null?void 0:s.clientId),body:JSON.stringify({scope:e,key:t,value:n})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/settings");return await r.json()})}async workspaceVoice(e){return await this.jsonRequest("/workspace/voice","GET /workspace/voice",{clientId:e})}async setWorkspaceVoice(e,t){return await this.jsonRequest("/workspace/voice","POST /workspace/voice",{method:"POST",body:e,clientId:t})}async transcribeWorkspaceVoice(e,t){let n=t.voiceModel?`?${new URLSearchParams({voiceModel:t.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}/workspace/voice/transcribe${n}`,{method:"POST",headers:this.headers({"Content-Type":t.mimeType},t.clientId),body:e},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/voice/transcribe");return await s.json()},hW,"rest")}async workspaceTrust(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/trust`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/trust");return await t.json()})}async requestWorkspaceTrustChange(e,t){return await this.jsonRequest("/workspace/trust/request","POST /workspace/trust/request",{method:"POST",body:e,clientId:t})}async workspacePermissions(e){return await this.jsonRequest("/workspace/permissions","GET /workspace/permissions",{clientId:e==null?void 0:e.clientId})}async setWorkspacePermissionRules(e,t,n,s){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:s==null?void 0:s.clientId})}async addWorkspacePermissionRule(e,t,n,s){let r=H9(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?i:await this.setWorkspacePermissionRules(e,t,[...o,r],s)}async removeWorkspacePermissionRule(e,t,n,s){let r=H9(n),i=await this.workspacePermissions(s),o=i[e].rules[t];return o.includes(r)?await this.setWorkspacePermissionRules(e,t,o.filter(a=>a!==r),s):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${yt(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${yt(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/restart");return await s.json()},(t==null?void 0:t.timeoutMs)??Im)}async reload(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:"{}"},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/reload");return await t.json()},e==null?void 0:e.timeoutMs)}async manageMcpServer(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${yt(e)}/${yt(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:"{}"},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/mcp/:server/:action");return await s.json()},(n==null?void 0:n.timeoutMs)??Im)}async addRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/mcp/servers");return await n.json()},(t==null?void 0:t.timeoutMs)??Im)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${yt(e)}`,{method:"DELETE",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"DELETE /workspace/mcp/servers/:name");return await n.json()},(t==null?void 0:t.timeoutMs)??Im)}async initWorkspace(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/init`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e==null?void 0:e.clientId),body:JSON.stringify((e==null?void 0:e.force)===!0?{force:!0}:{})},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/init");return await t.json()})}async setupGithub(e,t){return await this.jsonRequest("/workspace/setup-github","POST /workspace/setup-github",{method:"POST",body:e,clientId:t,timeoutMs:fW})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/model");return await s.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/language`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({language:t,syncOutputLanguage:(n==null?void 0:n.syncOutputLanguage)??!1})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/language");return await s.json()})}async prompt(e,t,n,s){n==null||n.throwIfAborted();let r=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${yt(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(o.status===202){let a=await o.json();i=!1;try{return await this._awaitTurnComplete(e,a.promptId,a.lastEventId,n,s)}finally{r()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&r()}}async promptNonBlocking(e,t,n,s){let r=await this.transport.fetch(`${this.baseUrl}/session/${yt(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(t),signal:n});if(r.status===202)return await r.json();if(!r.ok)throw await this.failOnError(r,"POST /session/:id/prompt",e);return await r.json()}async _awaitTurnComplete(e,t,n,s,r){let i=new AbortController,o=s?V9([s,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let c=eS(l,t);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(a){throw s!=null&&s.aborted&&a instanceof DOMException&&a.name==="AbortError"&&this.cancel(e,r).catch(()=>{}),a}finally{i.signal.aborted||i.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/heartbeat`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session/:id/heartbeat");return await n.json()})}async cancel(e,t){await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var s;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((s=n.body)==null?void 0:s.cancel())}catch{}})}async*subscribeEvents(e,t={}){yield*this.transport.subscribeEvents(e,{lastEventId:t.lastEventId,maxQueued:t.maxQueued,signal:t.signal,connectTimeoutMs:this.fetchTimeoutMs||void 0})}async respondToPermission(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/permission/${yt(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{var r,i;if(s.status===200){try{await((r=s.body)==null?void 0:r.cancel())}catch{}return!0}if(s.status===404){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,s){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/permission/${yt(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},s),body:JSON.stringify(n)},async r=>{var i,o;if(r.status===200){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!0}if(r.status===404){try{await((o=r.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}async detachSession(e,t){if(t)return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/detach`,{method:"POST",headers:this.headers({},t)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"POST /session/:id/detach")})}async deleteSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async archiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/archive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/archive")})}async unarchiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/unarchive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/unarchive")})}async startDeviceFlow(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e.clientId),body:JSON.stringify({providerId:e.providerId})},async t=>{if(t.status!==200&&t.status!==201)throw await this.failOnError(t,"POST /workspace/auth/device-flow");return await t.json()})}async getDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${yt(e)}`,{headers:this.headers({},t.clientId),signal:t.signal},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /workspace/auth/device-flow/:id");return await n.json()})}async cancelDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${yt(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var s;if(n.status===204||n.status===404){try{await((s=n.body)==null?void 0:s.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /workspace/auth/device-flow/:id")})}async getAuthStatus(e={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/status`,{headers:this.headers({},e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/auth/status");return await t.json()})}async getAuthProviders(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/providers`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/auth/providers");return await e.json()})}async installAuthProvider(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/provider`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify(e)},async t=>{if(!t.ok)throw await this.failOnError(t,"POST /workspace/auth/provider");return await t.json()})}dispose(){this.transport.dispose()}async listSessionArtifacts(e,t){return await this.jsonRequest(`/session/${yt(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${yt(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${yt(e)}/artifacts/${yt(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${yt(e)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async s=>{if(s.status===200){let r=await s.json();return typeof r.displayName=="string"?{displayName:r.displayName}:{}}throw await this.failOnError(s,"PATCH /session/:id/metadata")})}};function V9(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,s=[],r=()=>{for(;s.length>0;){let i=s.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),r(),n.signal;let o=()=>{n.abort(i.reason),r()};i.addEventListener("abort",o,{once:!0}),s.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",r,{once:!0}),n.signal}function eS(e,t){if(e.type==="turn_complete"){let n=e.data;if(n.promptId===t)return{stopReason:n.stopReason??"end_turn"}}if(e.type==="turn_error"){let n=e.data;if(n.promptId===t)throw Object.assign(new Fd(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function W9(e){return"promptId"in e&&"lastEventId"in e}var jm=class ay{constructor(t){ye(this,"client");ye(this,"session");ye(this,"state");ye(this,"replaySnapshot");ye(this,"hasActivePrompt");ye(this,"lastSeenEventId");ye(this,"subscriptionActive",!1);ye(this,"reattaching");ye(this,"promptLimit");ye(this,"_pendingPrompts",new Map);this.client=t.client,this.session={...t.session},this.state={...t.state??{}},this.hasActivePrompt=t.hasActivePrompt??!1,this.replaySnapshot=t.replaySnapshot??{compactedReplay:[],liveJournal:[]},this.lastSeenEventId=Kg(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:rL(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},s){let r=await t.createOrAttachSession(n,s),i=!r.attached||n.modelServiceId?0:void 0;return new ay({client:t,session:r,hasActivePrompt:r.hasActivePrompt,lastEventId:i})}static async load(t,n,s={},r){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:l,lastEventId:c,...d}=await t.loadSession(n,s,r);return new ay({client:t,session:d,hasActivePrompt:o,state:i,lastEventId:c??0,replaySnapshot:{compactedReplay:a??[],liveJournal:l??[]}})}static async resume(t,n,s={},r){let{state:i,hasActivePrompt:o,lastEventId:a,...l}=await t.resumeSession(n,s,r);return new ay({client:t,session:l,hasActivePrompt:o,state:i,lastEventId:a??0})}get sessionId(){return this.session.sessionId}get workspaceCwd(){return this.session.workspaceCwd}get attached(){return this.session.attached}get clientId(){return this.session.clientId}get lastEventId(){return this.lastSeenEventId}setLastEventId(t){this.lastSeenEventId=Kg(t)}async prompt(t,n){if(n==null||n.throwIfAborted(),!this.subscriptionActive)return await this.withClientIdSelfHeal(()=>this.client.prompt(this.sessionId,t,n,this.clientId));let s=this.client.reservePromptSlot(this.sessionId,this.promptLimit),r;try{if(r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId)),!W9(r))return s(),r;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw s(),i}return new Promise((i,o)=>{let a=()=>{let c=this._pendingPrompts.get(r.promptId);c&&this._pendingPrompts.delete(r.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),c.reject(n.reason??new DOMException("Aborted","AbortError")))},l=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(r.promptId,{resolve:c=>{l(),s(),i(c)},reject:c=>{l(),s(),o(c)}}),n!=null&&n.aborted?a():n==null||n.addEventListener("abort",a,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let s=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!W9(s))throw new Error("Expected non-blocking prompt acceptance");return s}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!bW(n))throw n;return await this.reattach(),await t()}}async reattach(){if(this.reattaching)return this.reattaching;this.reattaching=this.client.resumeSession(this.sessionId,{workspaceCwd:this.workspaceCwd}).then(t=>{this.session.clientId=t.clientId});try{await this.reattaching}finally{this.reattaching=void 0}}async cancel(){await this.client.cancel(this.sessionId,this.clientId)}async heartbeat(){return await this.client.heartbeat(this.sessionId,this.clientId)}async artifacts(){return await this.client.listSessionArtifacts(this.sessionId,this.clientId)}async addArtifact(t){return await this.client.addSessionArtifact(this.sessionId,t,this.clientId)}async removeArtifact(t){return await this.client.removeSessionArtifact(this.sessionId,t,this.clientId)}async setModel(t){return await this.client.setSessionModel(this.sessionId,t,this.clientId)}async getRewindSnapshots(){return await this.client.getRewindSnapshots(this.sessionId)}async rewind(t,n){return await this.client.rewindSession(this.sessionId,t,{clientId:this.clientId,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})}async fork(t){return await this.client.forkSession(this.sessionId,{directive:t},this.clientId)}async recap(t){return await this.client.recapSession(this.sessionId,{...t!=null&&t.signal?{signal:t.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async btw(t,n){return await this.client.btwSession(this.sessionId,t,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async enqueueMidTurnMessage(t,n){return await this.client.enqueueMidTurnMessage(this.sessionId,t,{...n!=null&&n.signal?{signal:n.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}async getPendingPrompts(){return await this.client.getPendingPrompts(this.sessionId,{...this.clientId?{clientId:this.clientId}:{}})}async removePendingPrompt(t){return await this.client.removePendingPrompt(this.sessionId,t,{...this.clientId?{clientId:this.clientId}:{}})}async shellCommand(t,n){return await this.client.shellCommand(this.sessionId,t,{...n?{signal:n}:{},...this.clientId?{clientId:this.clientId}:{}})}async context(){return await this.client.sessionContext(this.sessionId,this.clientId)}async contextUsage(t={}){return await this.client.sessionContextUsage(this.sessionId,t,this.clientId)}async supportedCommands(){return await this.client.sessionSupportedCommands(this.sessionId,this.clientId)}async tasks(){return await this.client.sessionTasks(this.sessionId,this.clientId)}async lspStatus(){return await this.client.sessionLspStatus(this.sessionId,this.clientId)}async cancelTask(t,n){return await this.client.sessionTaskCancel(this.sessionId,t,n,this.clientId)}async clearGoal(){return await this.client.sessionGoalClear(this.sessionId,this.clientId)}async stats(){return await this.client.sessionStats(this.sessionId,this.clientId)}async respondToPermission(t,n){return await this.client.respondToPermission(t,n,this.clientId)}async respondToSessionPermission(t,n){return await this.client.respondToSessionPermission(this.sessionId,t,n,this.clientId)}async close(){return await this.client.closeSession(this.sessionId,this.clientId)}async detach(){return await this.client.detachSession(this.sessionId,this.clientId)}async updateMetadata(t){return await this.client.updateSessionMetadata(this.sessionId,t,this.clientId)}events(t={}){return this.openEventSubscription(t)}subscribeEvents(t={}){return this.openEventSubscription(t)}openEventSubscription(t){let n=Kg(t.lastEventId),s=!1,r=!1,i=()=>{r||(r=!0,this.subscriptionActive=!1)},o=()=>{if(!s){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,s=!0}},a=this.iterateEvents({...t,lastEventId:n},i);return{next:async l=>(r||o(),await a.next(l)),return:async()=>{try{return await a.return(void 0)}finally{i()}},throw:async l=>{try{return await a.throw(l)}finally{i()}},[Symbol.asyncIterator](){return this}}}async*iterateEvents(t,n){try{let{resume:s=!0,...r}=t,i=r.lastEventId??(s?this.lastSeenEventId:void 0);for await(let o of this.client.subscribeEvents(this.sessionId,{...r,lastEventId:i}))this._dispatchTurnEvent(o),yield o,o.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,Kg(o.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var r;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(r=t.data)==null?void 0:r.promptId;if(!n)return;let s=this._pendingPrompts.get(n);if(s){this._pendingPrompts.delete(n);try{let i=eS(t,n);i!==void 0&&s.resolve(i)}catch(i){s.reject(i)}}}_rejectAllPending(t){for(let[,n]of this._pendingPrompts)n.reject(t);this._pendingPrompts.clear()}};function Kg(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function bW(e){return e instanceof Fd&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var oL="mid_turn_message_injected",tS="pending_prompt_added",nS="pending_prompt_started",sS="pending_prompt_completed",vW=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated","artifact_changed",oL,tS,nS,sS,"client_evicted","slow_client_warning","stream_error","state_resync_required","history_truncated","mcp_budget_warning","mcp_child_refused_batch","memory_changed","agent_changed","auth_device_flow_started","auth_device_flow_throttled","auth_device_flow_authorized","auth_device_flow_failed","auth_device_flow_cancelled","approval_mode_changed","tool_toggled","settings_changed","trust_change_requested","workspace_initialized","github_setup_completed","mcp_server_restarted","mcp_server_restart_refused","settings_reloaded","mcp_server_added","mcp_server_removed","extensions_changed","permission_partial_vote","permission_forbidden","prompt_cancelled","replay_complete","followup_suggestion","user_shell_command","user_shell_result","turn_complete","turn_error","session_rewound","session_branched","session_snapshot"];new Set(vW);var wW=["missing_binary","blocked_egress","auth_env_error","init_timeout","protocol_error","missing_file","parse_error","budget_exhausted","mcp_budget_would_exceed","mcp_server_spawn_failed","invalid_config","prompt_deadline_exceeded","writer_idle_timeout","model_stream_interrupted"],Ev=["plan","default","auto-edit","auto","yolo"],P_="daemon-plan";function Rt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function je(e,t){if(!Rt(e))return;let n=e[t];return typeof n=="string"?n:void 0}function ns(e,t){if(Rt(e))for(let n of t){let s=e[n];if(typeof s=="string"&&s.trim().length>0)return s}}function Cu(e){if(e===void 0)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)??String(e)}catch{return String(e)}}function fc(e){return Cu(Xl(e))}function Xl(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>Xl(n,t+1)):Rt(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,aL(n)?"[redacted]":Xl(s,t+1)])):e}function aL(e){let t=e.toLowerCase().replace(/[^a-z0-9]/g,"");return t==="authorization"||t==="auth"||t==="cookie"||t==="setcookie"||t==="credential"||t==="credentials"||t==="passphrase"||t==="xauthkey"||t.endsWith("password")||t.endsWith("token")||t.endsWith("secret")||t.endsWith("secretkey")||t.endsWith("accesskey")||t.endsWith("apikey")||t.endsWith("privatekey")||t.includes("accesstoken")||t.includes("refreshtoken")||t.includes("bearertoken")||t.includes("personalaccesstoken")}function L2(e){if(typeof e=="string")return e;if(!Rt(e))return"";let t=e.text;return typeof t=="string"?t:""}function xW(e){if(typeof e=="string")return{kind:"text",text:e};if(!Rt(e))return;let t=e.type;if(t==="text"||t===void 0){let n=e.text;return typeof n=="string"?{kind:"text",text:n}:void 0}if(t==="image"){let n=Rt(e.source)?e.source:void 0,s,r;return n&&(s=typeof n.url=="string"?n.url:void 0,r=typeof n.data=="string"?n.data:void 0),!s&&!r&&(r=typeof e.data=="string"?e.data:void 0,s=typeof e.url=="string"?e.url:void 0),!s&&!r?void 0:{kind:"image",mediaType:(typeof e.mediaType=="string"?e.mediaType:void 0)??(typeof e.mimeType=="string"?e.mimeType:void 0)??(typeof e.media_type=="string"?e.media_type:void 0)??(n&&typeof n.mediaType=="string"?n.mediaType:void 0)??"image/*",source:{...s?{url:s}:{},...r?{data:r}:{}}}}if(t==="audio"){let n=Rt(e.source)?e.source:void 0;if(!n)return;let s=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",r=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!r&&!i?void 0:{kind:"audio",mediaType:s,source:{...r?{url:r}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let s=typeof e.mediaType=="string"?e.mediaType:void 0,r=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...s?{mediaType:s}:{},...r?{description:r}:{}}}}var _W=64;function ib(e,t=0){if(t>_W)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(s=>ib(s,t+1)).filter(Boolean).join(`
`);if(!Rt(e))return e===void 0?"":Cu(e);for(let s of["text","output","stdout","stderr","rawOutput"]){let r=e[s];if(typeof r=="string")return r}let n=e.content;if(n!==void 0){let s=ib(n,t+1);if(s)return s}return Cu(e)}var kW=new Set(wW),lL=new Set(["qwen","qwen-oauth"]),SW=new Set(["in_flight","disabled","budget_would_exceed"]),G9="malformed memory_changed payload",K9=4096;function TW(e,t={}){let n=jW(e,t);switch(e.type){case"session_update":return RW(e,n,t);case"shell_output":{let s=ib(e.data),r=z_(e.data),i=F_(e.data);return s?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:s,...r?{stream:r}:{}}]:[]}case"permission_request":return zW(e,n);case"permission_resolved":case"permission_already_resolved":return FW(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:je(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:je(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let s=D2(je(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...s?{errorKind:s}:{},text:je(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${je(e.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:je(e.data,"reason")??"SSE client evicted (no details available)"}];case"slow_client_warning":return[{...n,type:"status",text:"SSE stream is lagging"}];case"stream_error":{let s=D2(je(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...s?{errorKind:s}:{},text:je(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let s=je(e.data,"code"),r=D2(je(e.data,"errorKind")),i=je(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...s?{code:s}:{},...r?{errorKind:r}:{},...i?{promptId:i}:{},text:je(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return CW(e,n);case"history_truncated":return AW(e,n);case"session_rewound":return EW(e,n);case"session_branched":return MW(e,n);case"prompt_cancelled":{let s=fG(e.data,"reason");return[{...n,type:"prompt.cancelled",...s?{reason:s}:{}}]}case"followup_suggestion":return NW(e,n);case"mid_turn_message_injected":return IW(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let s=je(e.data,"command"),r=je(e.data,"cwd");return s?[{...n,type:"user.shell.command",command:s,...r?{cwd:r}:{}},{...n,type:"user.text.delta",text:`$ ${s}`}]:[]}case"user_shell_result":{let s=Es(e.data,"exitCode"),r=Rt(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${s??"unknown"}`;return[{...n,type:"status",text:r}]}case"replay_complete":{let s=Es(e.data,"replayedCount")??0,r=Es(e.data,"lastReplayedEventId")??Es(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:s,...r!==void 0?{lastReplayedEventId:r}:{}}]}case"session_metadata_updated":return WW(e,n);case"approval_mode_changed":return GW(e,n);case"memory_changed":return KW(e,n);case"agent_changed":return YW(e,n);case"tool_toggled":return QW(e,n);case"settings_changed":return XW(e,n);case"settings_reloaded":return JW(e,n);case"trust_change_requested":return eG(e,n);case"workspace_initialized":return ZW(e,n);case"github_setup_completed":return tG(e,n);case"mcp_budget_warning":return nG(e,n);case"mcp_child_refused_batch":return sG(e,n);case"mcp_server_restarted":return rG(e,n);case"mcp_server_restart_refused":return iG(e,n);case"extensions_changed":return oG(e,n);case"auth_device_flow_started":return aG(e,n);case"auth_device_flow_throttled":return lG(e,n);case"auth_device_flow_authorized":return cG(e,n);case"auth_device_flow_failed":return uG(e,n);case"auth_device_flow_cancelled":return hG(e,n);default:return[{...n,type:"debug",text:`${e.type} (unrecognized daemon event): ${fc(e.data)}`}]}}function CW(e,t){let n=je(e.data,"reason"),s=Es(e.data,"lastDeliveredId"),r=Es(e.data,"earliestAvailableId");return!n||s===void 0||r===void 0?ps(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:s,earliestAvailableId:r}]}function AW(e,t){let n=je(e.data,"reason"),s=Es(e.data,"truncatedEvents"),r=Es(e.data,"retainedEvents"),i=Es(e.data,"maxBytes");return n!=="replay_window_exceeded"||s===void 0||r===void 0||i===void 0||Rt(e.data)&&e.data.fullTranscriptAvailable!==!1?ps(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${r}, dropped ${s} (window ${i} bytes).`,source:"history_truncated"}]}function EW(e,t){let n=je(e.data,"promptId"),s=Es(e.data,"targetTurnIndex");if(!n||s===void 0)return ps(e,t,"malformed session_rewound payload");let r=je(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:s,...r?{sessionId:r}:{}}]}function MW(e,t){let n=je(e.data,"sourceSessionId"),s=je(e.data,"newSessionId"),r=je(e.data,"displayName");return!n||!s||!r?ps(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:s,displayName:r}]}function NW(e,t){let n=je(e.data,"sessionId"),s=je(e.data,"suggestion"),r=je(e.data,"promptId");return!n||!s||!r?ps(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:s,promptId:r}]}function IW(e,t){if(!Rt(e.data))return ps(e,t,"malformed mid_turn_message_injected");let n=Array.isArray(e.data.messages)?e.data.messages.filter(s=>typeof s=="string"&&s.length>0):[];return n.length===0?ps(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function jW(e,t){let n=cL(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:Xl(e.data)}}:{}}}function cL(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(Rt(n)){let s=n.serverTimestamp;if(typeof s=="number"&&Number.isFinite(s))return s}if(Rt(e.data)){let s=e.data._meta;if(Rt(s)){let i=s.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let r=e.data.update;if(Rt(r)){let i=r._meta;if(Rt(i)){let o=i.serverTimestamp;if(typeof o=="number"&&Number.isFinite(o))return o;let a=i.timestamp;if(typeof a=="number"&&Number.isFinite(a))return a}}}}function RW(e,t,n){let s=qW(e.data);if(!s)return[{...t,type:"debug",text:`session_update: ${fc(e.data)}`}];let r=je(s,"sessionUpdate");switch(r){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=Q9(s),o=s.content,a=xW(o);if(a){if(a.kind==="image"){let c=a.source.data,d=a.mediaType||"image/*";if(d==="image/*"&&c){let h=(c.startsWith("data:")?c.split(",")[1]??"":c).slice(0,10);h.startsWith("iVBORw0KGg")?d="image/png":h.startsWith("/9j/")?d="image/jpeg":h.startsWith("R0lGOD")?d="image/gif":h.startsWith("UklGR")&&(d="image/webp")}return c?[{...t,type:"user.image.delta",data:c,mimeType:d}]:[]}return a.kind==="text"?a.text?[{...t,type:"user.text.delta",text:a.text,...i?{meta:i}:{}}]:[]:[]}let l=L2(o);return l?[{...t,type:"user.text.delta",text:l,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=L2(s.content),o=Y9(s),a=Q9(s),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let c=LW(s);return c&&l.push({...t,type:"assistant.usage",usage:c,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=L2(s.content);if(!i)return[];let o=Y9(s);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":return[DW(s,t)];case"shell_output":case"tool_output":{let i=ib(s),o=z_(s)??z_(e.data),a=F_(s)??F_(e.data);return i?[{...t,type:a==="user-shell"?"user.shell.output":"shell.output",text:i,...o?{stream:o}:{}}]:[]}case"available_commands_update":{let i=(Array.isArray(s.availableCommands)?s.availableCommands:[]).filter(Rt);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[OW(s,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${r??"session_update"}: ${fc(s)}`}]}}function Y9(e){let t=Rt(e._meta)?e._meta:void 0;return t?je(t,"parentToolCallId"):void 0}function Q9(e){let t=Rt(e._meta)?e._meta:void 0;return t?{...t}:void 0}function LW(e){let t=Rt(e._meta)?e._meta:void 0,n=t&&Rt(t.usage)?t.usage:void 0;if(!n)return;let s=Es(n,"inputTokens"),r=Es(n,"outputTokens");if(s===void 0&&r===void 0)return;let i=Es(n,"cachedReadTokens");return{inputTokens:s??0,outputTokens:r??0,...i!==void 0?{cachedTokens:i}:{}}}function DW(e,t){let n=Rt(e._meta)?e._meta:void 0,s=je(e,"toolName")??je(e,"name")??(n?je(n,"toolName"):void 0)??(n?je(n,"name"):void 0),r=je(e,"kind"),i=je(e,"title")??s??r,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?Xl(o):void 0,c=a!==void 0?Xl(a):void 0,d=e.content!==void 0?Xl(e.content):void 0,h=e.locations!==void 0?Xl(e.locations):void 0,f=je(e,"toolCallId"),m=je(e,"status");if(!f)return{...t,type:"error",code:"daemon.protocol.tool_update_missing_tool_call_id",recoverable:!0,text:`Tool update missing toolCallId${i?` (${i})`:""}`};let{provenance:p,serverId:y}=$W(e,s),w=je(e,"parentToolCallId")??(n?je(n,"parentToolCallId"):void 0),b=w&&w!==f?w:void 0,v=je(e,"subagentType")??(n?je(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:f,...m?{status:m}:{},...i?{title:i}:{},...s?{toolName:s}:{},...r?{toolKind:r}:{},...d!==void 0?{content:d}:{},...h!==void 0?{locations:h}:{},...p?{provenance:p}:{},...y?{serverId:y}:{},...b?{parentToolCallId:b}:{},...v?{subagentType:v}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:$_(fc(l))}:c!==void 0?{details:$_(fc(c))}:{}}}function OW(e,t){let n=Array.isArray(e.entries)?e.entries:[],s=$_(BW(n)),r=t.eventId!==void 0?`${P_}-${t.eventId}`:P_,i=Rt(e._meta)?e._meta:void 0,o=i&&Rt(i.stats)?i.stats:void 0;return{...t,type:"tool.update",toolCallId:r,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:s}}],rawOutput:o?{entries:n,stats:o}:{entries:n}}}function BW(e){return e.flatMap(t=>{if(!Rt(t))return[];let n=je(t,"content");return n?[`- [${PW(je(t,"status"))}] ${n}`]:[]}).join(`
`)}function PW(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function $W(e,t){let n=je(e,"provenance"),s=je(e,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&s?{serverId:s}:{}};if(t&&t.startsWith("mcp__")){let r=t.slice(5),i=r.indexOf("__");if(i>0)return{provenance:"mcp",serverId:r.slice(0,i)}}return{}}function D2(e){if(e)return kW.has(e)?e:void 0}function $_(e){return e.length<=K9?e:`${e.slice(0,K9)}... [truncated]`}function zW(e,t){if(!Rt(e.data))return[{...t,type:"debug",text:`permission_request: ${fc(e.data)}`}];let n=je(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${fc(e.data)}`}];let s=e.data.toolCall!==void 0?Xl(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:je(e.data,"sessionId"),title:VW(s),options:HW(e.data.options),toolCall:s}]}function FW(e,t){let n=je(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${fc(e.data)}`}];let s=je(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:UW(e.data),...s?{voterClientId:s}:{}}]}function qW(e){if(!Rt(e))return;let t=e.update;return Rt(t)?t:e}function HW(e){return Array.isArray(e)?e.flatMap(t=>{if(!Rt(t))return[];let n=je(t,"optionId");return n?[{optionId:n,label:je(t,"label")??je(t,"title")??je(t,"name")??n,...je(t,"description")?{description:je(t,"description")}:{},raw:t}]:[]}):[]}function UW(e){if(!Rt(e))return Cu(e);let t=e.outcome;if(typeof t=="string")return t;if(Rt(t)){let n=je(t,"outcome")??"selected",s=je(t,"optionId");return s?`${n}:${s}`:n}return ns(e,["status","reason"])??Cu(e)}function VW(e){return Rt(e)?je(e,"title")??je(e,"name")??je(e,"kind")??je(e,"toolName")??"Tool permission":"Tool permission"}function z_(e){let t=je(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function F_(e){if(!Rt(e))return;let t=je(e,"source");if(t)return t;let n=e._meta;return Rt(n)?je(n,"source"):void 0}function ps(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function WW(e,t){let n=je(e.data,"sessionId");if(!n)return ps(e,t,"missing sessionId");let s=je(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...s!==void 0?{displayName:s}:{}}]}function GW(e,t){let n=je(e.data,"sessionId"),s=je(e.data,"previous"),r=je(e.data,"next");if(!n||!s||!r)return ps(e,t,"missing sessionId / previous / next");let i=Rt(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:s,next:r,persisted:i}]}function KW(e,t){var o;let n=je(e.data,"scope");if(n==="managed"){let a=je(e.data,"source"),l=je(e.data,"taskId"),c=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&l&&Array.isArray(c))||c.some(d=>d!=="user"&&d!=="project")?ps(e,t,G9):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:l,touchedScopes:c}]}let s=je(e.data,"filePath"),r=je(e.data,"mode"),i=Es(Rt(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!s||r!=="append"&&r!=="replace"||i===void 0?ps(e,t,G9):[{...t,type:"workspace.memory.changed",scope:n,filePath:s,mode:r,bytesWritten:i}]}function YW(e,t){let n=je(e.data,"change"),s=je(e.data,"name"),r=je(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!s||r!=="project"&&r!=="user"?ps(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:s,level:r}]}function QW(e,t){let n=je(e.data,"toolName"),s=Rt(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||s===void 0?ps(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:s}]}function XW(e,t){let n=je(e.data,"key"),s=je(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:s??"workspace",value:Rt(e.data)?e.data.value:void 0}]:ps(e,t,"malformed settings_changed payload")}function JW(e,t){return Rt(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:ps(e,t,"malformed settings_reloaded payload")}function ZW(e,t){let n=je(e.data,"path"),s=je(e.data,"action");return!n||s!=="created"&&s!=="overwrote"&&s!=="noop"?ps(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:s}]}function eG(e,t){let n=je(e.data,"workspaceCwd"),s=je(e.data,"desiredState"),r=je(e.data,"reason");return!n||s!=="trusted"&&s!=="untrusted"?ps(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:s,...r!==void 0?{reason:r}:{}}]}function tG(e,t){let n=je(e.data,"releaseTag"),s=je(e.data,"readmeUrl");if(!n||!s||!Rt(e.data))return ps(e,t,"malformed github_setup_completed payload");let r=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:s,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(r)?r:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function nG(e,t){if(!Rt(e.data))return ps(e,t,"non-object payload");let n=Es(e.data,"liveCount"),s=Es(e.data,"reservedCount"),r=Es(e.data,"budget"),i=Es(e.data,"thresholdRatio"),o=je(e.data,"mode");return n===void 0||s===void 0||r===void 0||i===void 0||o!=="warn"&&o!=="enforce"?ps(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:s,budget:r,thresholdRatio:i,mode:o}]}function sG(e,t){if(!Rt(e.data))return ps(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(Rt).map(o=>{let a=je(o,"name"),l=je(o,"transport"),c=je(o,"reason");return!a||!l||c!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],s=Es(e.data,"budget"),r=Es(e.data,"liveCount"),i=Es(e.data,"reservedCount");return n.length===0||s===void 0||r===void 0||i===void 0?ps(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:s,liveCount:r,reservedCount:i}]}function rG(e,t){let n=je(e.data,"serverName"),s=Es(e.data,"durationMs");return!n||s===void 0?ps(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:s}]}function iG(e,t){let n=je(e.data,"serverName"),s=je(e.data,"reason");return!n||!s||!SW.has(s)?ps(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:s}]}function oG(e,t){let n=Es(e.data,"refreshed"),s=Es(e.data,"failed"),r=je(e.data,"status"),i=je(e.data,"source"),o=je(e.data,"name"),a=je(e.data,"version"),l=je(e.data,"error");return n===void 0||s===void 0||r!==void 0&&r!=="installed"&&r!=="enabled"&&r!=="disabled"&&r!=="updated"&&r!=="uninstalled"&&r!=="failed"?ps(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:s,...r?{status:r}:{},...i?{source:i}:{},...o?{name:o}:{},...a?{version:a}:{},...l?{error:l}:{}}]}function aG(e,t){let n=je(e.data,"deviceFlowId"),s=je(e.data,"providerId"),r=Es(e.data,"expiresAt");return!n||!s||!lL.has(s)||r===void 0?ps(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:s,expiresAt:r}]}function lG(e,t){let n=je(e.data,"deviceFlowId"),s=Es(e.data,"intervalMs");return!n||s===void 0?ps(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:s}]}function cG(e,t){let n=je(e.data,"deviceFlowId"),s=je(e.data,"providerId");if(!n||!s||!lL.has(s))return ps(e,t,"malformed auth_device_flow_authorized payload");let r=Es(e.data,"expiresAt"),i=je(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:s,...r!==void 0?{expiresAt:r}:{},...i?{accountAlias:i}:{}}]}function uG(e,t){let n=je(e.data,"deviceFlowId"),s=je(e.data,"errorKind");if(!n||!dG(s))return ps(e,t,"malformed auth_device_flow_failed payload");let r=je(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:s,...r?{hint:r}:{}}]}function dG(e){return typeof e=="string"&&e.trim().length>0}function hG(e,t){let n=je(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:ps(e,t,"malformed auth_device_flow_cancelled payload")}function Es(e,t){if(!Rt(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function fG(e,t){if(!Rt(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var mG=8;function ob(e,t={},n=0){if(n>mG){let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}if(Rt(e)){let p=e.rawInput??e.input??e.args;if(p!==void 0&&p!==e){let y=ob(p,{title:t.title??ns(e,["title"]),toolName:t.toolName??ns(e,["toolName","name"]),toolKind:t.toolKind??ns(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let s=vG(e);if(s.length>0)return{kind:"ask_user_question",questions:s};let r=bG(e,t);if(r)return r;let i=kG(e,t);if(i)return i;let o=SG(e,t);if(o)return o;let a=TG(e,t);if(a)return a;let l=pG(e,t);if(l)return l;let c=gG(e,t);if(c)return c;let d=yG(e);if(d)return d;let h=CG(e,t);if(h)return h;let f=AG(e);if(f)return f;if(Rt(e)){let p=ns(e,["command","cmd"]);if(p){let w=ns(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:p,...w?{cwd:w}:{}}}let y=xG(e);if(y.length>0)return{kind:"key_value",rows:y}}let m=t.title??t.toolName??t.toolKind;return{kind:"generic",...m?{summary:m}:{}}}function pG(e,t={}){if(!Rt(e))return;let n=ns(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=ns(e,["oldText","old_text","old_str","oldString"]),r=ns(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!s,a=r===void 0&&o?ns(e,["content"]):void 0,l=r??a,c=ns(e,["patch","diff","unified_diff"]);if(!(!s&&!l&&!c))return{kind:"file_diff",path:n,...s?{oldText:s}:{},...l?{newText:l}:{},...c?{patch:c}:{}}}function gG(e,t){if(!Rt(e))return;let n=ns(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let s=t.toolName??ns(e,["toolName","name"]),r=s!==void 0&&/read|view|cat/i.test(s),i=e.lineRange??e.line_range??e.range,o;if(Array.isArray(i)&&i.length===2&&typeof i[0]=="number"&&typeof i[1]=="number")o=[i[0],i[1]];else{let a=e.offset,l=e.limit;typeof a=="number"&&typeof l=="number"&&l>0&&(o=[a+1,a+l])}if(!(!r&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function yG(e){if(!Rt(e))return;let t=ns(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=ns(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function bG(e,t){let n=t.toolName??(Rt(e)?ns(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let s=n.slice(5),r=s.indexOf("__");if(r<=0)return;let i=s.slice(0,r),o=s.slice(r+2),a;if(Rt(e)){let l=e.arguments??e.args??e;if(Rt(l)){let c=Object.entries(l).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,h])=>{let f=typeof h=="string"?h:JSON.stringify(h),m=f.length>60?`${f.slice(0,60)}…`:f;return`${d}=${m}`})[0];c&&(a=c)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function vG(e){return!Rt(e)||!Array.isArray(e.questions)?[]:e.questions.filter(Rt).map(t=>{let n=ns(t,["header","title","label"]),s=ns(t,["question","prompt","text"])??"Question",r=Array.isArray(t.options)?t.options.filter(Rt).map(wG):[];return{...n?{header:n}:{},question:s,options:r,raw:t}})}function wG(e){let t=ns(e,["label","title","value"])??"Option",n=ns(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function xG(e){let t=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[s,r]of n){let i=ns(e,r);i&&t.push({label:s,value:i})}if(t.length>0)return t;for(let[s,r]of Object.entries(e).slice(0,4))r==null||Array.isArray(r)||Rt(r)||t.push({label:s,value:aL(s)?"[redacted]":fc(r)});return t}var X9=50,_G=5;function kG(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!Rt(e))return;let s=ns(e,["subagent_type","agent","agentName","agent_name","subagent"]),r=ns(e,["prompt","task","description","instruction","query"]);if(!s&&!r)return;let i=ns(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:s??"subagent",task:r??"(no task description)",...i?{parentDelegationId:i}:{}}}function SG(e,t){if(!Rt(e))return;let n=ns(e,["query","pattern","search","q"]);if(!n)return;let s=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(s)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let r=typeof e.resultCount=="number"?e.resultCount:typeof e.total=="number"?e.total:Array.isArray(e.results)?e.results.length:Array.isArray(e.matches)?e.matches.length:void 0,i,o=e.results??e.matches;return Array.isArray(o)&&(i=o.slice(0,_G).map(a=>typeof a=="string"?a:Rt(a)?ns(a,["path","file","name","title","text"])??Cu(a).slice(0,120):String(a)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...r!==void 0?{resultCount:r}:{},...i?{top:i}:{}}}function TG(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!Rt(e))return;let s=ns(e,["prompt","description","query"]);if(!s)return;let r=ns(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=ns(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:s,...r?{thumbnailUrl:r}:{},...i?{model:i}:{}}}function CG(e,t){if(!Rt(e))return;let n=ns(e,["code","snippet","source"]);if(!n)return;let s=ns(e,["language","lang","codeLanguage","syntax"]),r=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(r);if(!s&&!i)return;let o=ns(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...s?{language:s}:{},...o?{origin:o}:{}}}function AG(e){if(!Rt(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let r=t.filter(o=>typeof o=="string").slice(0,30);if(r.length===0)return;let i=n.slice(0,X9).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:Cu(a).slice(0,80)):[]);return{kind:"tabular",columns:r,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let s=e.data??e.records;if(Array.isArray(s)&&s.length>0&&Rt(s[0])){let r=Object.keys(s[0]).slice(0,30);if(r.length===0)return;let i=s.slice(0,X9).map(o=>{let a=o;return r.map(l=>{let c=a[l];return typeof c=="string"?c:Cu(c).slice(0,80)})});return{kind:"tabular",columns:r,rows:i,...s.length>i.length?{totalRows:s.length}:{}}}}var EG=1e3,Id="__trimmed_tool_block__",Mv="__trimmed_permission_block__",q_=1e5,J9=`
[truncated]
`,MG=16;function NG(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??EG}}var rS=new Set(["pending","confirming","running","in_progress"]),IG=new Set(["completed","success","failed","error","canceled","cancelled"]),jG=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function RG(e,t,n={}){let s=fL(e,n);lS(s);let r=cS(s,"user",t);return n.images&&n.images.length>0&&(r.images=[...n.images]),bl(s,r),s.activeUserBlockId=r.id,mL(s)}function LG(e,t,n={}){if(t.length===0)return e;let s=fL(e,n);for(let i of t)DG(s,i);let r=mL(s);return Object.freeze(r.blocks),r}function iS(e){let t={};return e.forEach((n,s)=>{t[n.id]=s}),t}function DG(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!jG.has(t.type)){typeof console<"u"&&((n=console.warn)==null||n.call(console,`[daemon-ui] dropping event \`${t.type}\` while awaitingResync; state may be stale until session reconnect (lastResyncRequired: ${e.lastResyncRequired?JSON.stringify(e.lastResyncRequired):"unknown"})`));return}switch(t.type){case"user.shell.command":e.pendingUserShellCommand={command:t.command,...t.cwd?{cwd:t.cwd}:{}};break;case"user.text.delta":e.activeUserBlockId||(e.lastFollowupSuggestion=void 0),O2(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let s=la(e,e.activeUserBlockId);s&&s.kind==="user"&&(s.images=[...s.images??[],{data:t.data,mimeType:t.mimeType}])}else{let s=cS(e,"user","");s.images=[{data:t.data,mimeType:t.mimeType}],bl(e,s),e.activeUserBlockId=s.id}break}case"assistant.text.delta":O2(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":lS(e,t),(t.reason==="cancelled"||t.reason==="error")&&H_(e);break;case"assistant.usage":PG(e,t);break;case"thought.text.delta":O2(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":hL(e,t);break;case"shell.output":FG(e,t);break;case"user.shell.output":qG(e,t);break;case"permission.request":HG(e,t);break;case"permission.resolved":UG(e,t);break;case"model.changed":M0(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":M0(e,t.type,t.text,t);break;case"session.approval_mode.changed":e.approvalMode=t.next;break;case"session.metadata.changed":case"session.available_commands":break;case"session.state_resync_required":OG(e,t);break;case"prompt.cancelled":H_(e),t.reason!=="forward_failed"&&VG(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":GG(e,t.targetTurnIndex);break;case"session.branched":M0(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function OG(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},H_(e),M0(e,"error",`State resync required: ${BG(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function BG(e,t){let n=e+1,s=t-1;return s<n?"no events lost (resync requested without gap)":s===n?`missed 1 daemon event (id ${n})`:`missed daemon events ${n}-${s}`}function Nv(e,t,n){let s=la(e,t);((s==null?void 0:s.kind)==="assistant"||(s==null?void 0:s.kind)==="thought")&&(s.streaming=!1,s.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(s.eventId=n.eventId),s.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(s.serverTimestamp=n.serverTimestamp))}function uL(e,t){Nv(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function PG(e,t){let n=la(e,e.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let s=n.usage;n.usage={inputTokens:((s==null?void 0:s.inputTokens)??0)+t.usage.inputTokens,outputTokens:((s==null?void 0:s.outputTokens)??0)+t.usage.outputTokens,cachedTokens:((s==null?void 0:s.cachedTokens)??0)+(t.usage.cachedTokens??0)},n.updatedAt=e.now}function dL(e,t){Nv(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function oS(e,t,n){Nv(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function aS(e,t,n){Nv(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function O2(e,t,n,s,r){let i=t!=="user"&&"parentToolCallId"in r?r.parentToolCallId:void 0,o=i!=null?t==="assistant"?e.activeAssistantBlockByParent:t==="thought"?e.activeThoughtBlockByParent:void 0:void 0,a=o&&i!=null?o[i]:e[n],l=la(e,a);if(l&&l.kind===t&&$G(l,r)){l.text=dS(l.text,s),l.updatedAt=e.now,r.eventId!==void 0&&(l.eventId=r.eventId),r.serverTimestamp!==void 0&&(l.serverTimestamp=r.serverTimestamp),"meta"in r&&r.meta&&(l.meta={...l.meta,...r.meta}),(t==="assistant"||t==="thought")&&(l.streaming=!0);return}let c=cS(e,t,s,r.eventId,r.serverTimestamp,"meta"in r?r.meta:void 0);(t==="assistant"||t==="thought")&&(c.streaming=!0),t==="thought"&&(c.collapsed=!0),i!=null&&(c.parentToolCallId=i),bl(e,c),o&&i!=null?o[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&aS(e,i),t==="thought"&&oS(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&uL(e),t!=="thought"&&dL(e))}function $G(e,t){var n,s;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0?!1:!("meta"in t)||((s=t.meta)==null?void 0:s.qwenDiscreteMessage)!==!0}function lS(e,t){uL(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))oS(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))aS(e,n,t);dL(e,t)}function hL(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===Id){if(WG(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],hL(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,M0(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let s=la(e,n);if((s==null?void 0:s.kind)==="tool"){if(t.title!==void 0&&(s.title=t.title),t.status!==void 0&&(s.status=t.status),t.rawInput!==void 0&&(s.preview=ob(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId),t.details&&(s.details=t.details),t.content!==void 0&&(s.content=t.content),t.locations!==void 0&&(s.locations=t.locations),t.rawInput!==void 0&&(s.rawInput=t.rawInput),t.rawOutput!==void 0&&(s.rawOutput=t.rawOutput),t.toolName&&(s.toolName=t.toolName),t.toolKind&&(s.toolKind=t.toolKind),t.parentToolCallId&&!s.parentToolCallId&&(s.parentToolCallId=t.parentToolCallId),s.parentToolCallId&&!s.parentBlockId){let o=e.toolBlockByCallId[s.parentToolCallId];o&&o!==Id&&(s.parentBlockId=o)}t.subagentType&&!s.subagentType&&(s.subagentType=t.subagentType),Z9(e,t.toolCallId,t.status);return}let r=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==Id?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:$u(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:ob(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind}),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.details?{details:t.details}:{},...t.content!==void 0?{content:t.content}:{},...t.locations!==void 0?{locations:t.locations}:{},...t.rawInput!==void 0?{rawInput:t.rawInput}:{},...t.rawOutput!==void 0?{rawOutput:t.rawOutput}:{},...t.toolName?{toolName:t.toolName}:{},...t.toolKind?{toolKind:t.toolKind}:{},...t.parentToolCallId?{parentToolCallId:t.parentToolCallId}:{},...t.subagentType?{subagentType:t.subagentType}:{},...r?{parentBlockId:r}:{}};bl(e,i),e.toolBlockByCallId[t.toolCallId]=i.id;for(let o of e.blocks)if(o.kind==="tool"&&o.parentToolCallId===t.toolCallId&&!o.parentBlockId){let a=la(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}Z9(e,t.toolCallId,t.status??"pending"),ih(e,t.parentToolCallId)}function Z9(e,t,n){if(n!==void 0){if(rS.has(n)){e.currentToolCallId=t;return}if(IG.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=zG(e));return}}}function zG(e){for(let t=e.blocks.length-1;t>=0;t-=1){let n=e.blocks[t];if((n==null?void 0:n.kind)==="tool"&&rS.has(n.status))return n.toolCallId}}function H_(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===Id)continue;let n=la(e,t);!n||n.kind!=="tool"||rS.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function FG(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="shell"&&n.stream===t.stream){let r=la(e,n.id);(r==null?void 0:r.kind)==="shell"&&(r.text=dS(r.text,t.text),r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId));return}let s={id:$u(e,"shell"),kind:"shell",text:Yp(t.text),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};bl(e,s),ih(e)}function qG(e,t){if(!t.text)return;let n=e.blocks[e.blocks.length-1];if((n==null?void 0:n.kind)==="user_shell"&&n.stream===t.stream&&!e.pendingUserShellCommand){let o=la(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=dS(o.text,t.text),o.updatedAt=e.now,t.eventId!==void 0&&(o.eventId=t.eventId));return}let s=e.pendingUserShellCommand,r=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i={id:$u(e,"user-shell"),kind:"user_shell",text:Yp(t.text),command:(s==null?void 0:s.command)??(r==null?void 0:r.command)??"",...s!=null&&s.cwd||r!=null&&r.cwd?{cwd:(s==null?void 0:s.cwd)??(r==null?void 0:r.cwd)}:{},clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.stream?{stream:t.stream}:{}};e.pendingUserShellCommand=void 0,bl(e,i),ih(e)}function HG(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===Mv)return;let s=la(e,n),r=ob(t.toolCall,{title:t.title});if((s==null?void 0:s.kind)==="permission"){s.title=t.title,s.options=t.options.map(o=>({...o})),s.toolCall=t.toolCall,s.preview=r,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let i={id:$u(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:r,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{},...t.sessionId?{sessionId:t.sessionId}:{},...t.toolCall!==void 0?{toolCall:t.toolCall}:{}};bl(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,ih(e)}function UG(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===Mv)return;let s=la(e,n);if((s==null?void 0:s.kind)==="permission"){s.resolved=t.outcome,s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId);return}let r={id:$u(e,"permission"),kind:"permission",requestId:t.requestId,title:`Permission resolved: ${t.requestId}`,options:[],preview:{kind:"generic",summary:t.outcome},resolved:t.outcome,clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{}};bl(e,r),e.permissionBlockByRequestId[t.requestId]=r.id,ih(e)}function M0(e,t,n,s,r={}){let i={id:$u(e,t),kind:t,text:Yp(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...(s==null?void 0:s.eventId)!==void 0?{eventId:s.eventId}:{},...(s==null?void 0:s.serverTimestamp)!==void 0?{serverTimestamp:s.serverTimestamp}:{},...(s==null?void 0:s.type)==="error"&&s.code?{code:s.code}:{},...(s==null?void 0:s.type)==="error"&&s.promptId?{promptId:s.promptId}:{},...(s==null?void 0:s.type)==="error"&&s.errorKind?{errorKind:s.errorKind}:{},...(s==null?void 0:s.type)==="error"&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.source?{source:s.source}:{},...((s==null?void 0:s.type)==="status"||(s==null?void 0:s.type)==="debug")&&s.data!==void 0?{data:s.data}:{},...(s==null?void 0:s.type)==="session.branched"?{source:"session_branched",data:{sourceSessionId:s.sourceSessionId,newSessionId:s.newSessionId,displayName:s.displayName}}:{}};bl(e,i),r.clearActiveText!==!1&&ih(e)}function VG(e,t){let n={id:$u(e,"prompt_cancelled"),kind:"prompt_cancelled",clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...t.reason?{reason:t.reason}:{},...t.eventId!==void 0?{eventId:t.eventId}:{},...t.serverTimestamp!==void 0?{serverTimestamp:t.serverTimestamp}:{}};bl(e,n),ih(e)}function cS(e,t,n,s,r,i){return{id:$u(e,t),kind:t,text:Yp(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...s!==void 0?{eventId:s}:{},...r!==void 0?{serverTimestamp:r}:{},...i?{meta:{...i}}:{}}}function fL(e,t){return{...e,now:t.now??Date.now(),maxBlocks:t.maxBlocks??e.maxBlocks,blocks:e.blocks,blockIndexById:e.blockIndexById,toolBlockByCallId:{...e.toolBlockByCallId},activeAssistantBlockByParent:{...e.activeAssistantBlockByParent},activeThoughtBlockByParent:{...e.activeThoughtBlockByParent},trimmedToolNotificationByCallId:{...e.trimmedToolNotificationByCallId},permissionBlockByRequestId:{...e.permissionBlockByRequestId},toolProgress:Object.fromEntries(Object.entries(e.toolProgress).map(([n,s])=>[n,{...s}])),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion}}function mL(e){if(e.blocks.length<=e.maxBlocks)return e;let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(s=>s.id));e.blocks=t,e.blockIndexById=iS(t),ab.set(e,e.blocks);for(let[s,r]of Object.entries(e.toolBlockByCallId))n.has(r)||(e.toolBlockByCallId[s]=Id);QG(e);for(let[s]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[s]!==Id&&delete e.trimmedToolNotificationByCallId[s];for(let[s,r]of Object.entries(e.permissionBlockByRequestId))n.has(r)||(e.permissionBlockByRequestId[s]=Mv);XG(e);for(let s of e.blocks)if(s.kind==="tool"&&s.parentBlockId&&!n.has(s.parentBlockId)){let r=la(e,s.id);(r==null?void 0:r.kind)==="tool"&&(r.parentBlockId=void 0)}n.has(e.activeUserBlockId??"")||(e.activeUserBlockId=void 0),n.has(e.activeAssistantBlockId??"")||(e.activeAssistantBlockId=void 0),n.has(e.activeThoughtBlockId??"")||(e.activeThoughtBlockId=void 0);for(let[s,r]of Object.entries(e.activeAssistantBlockByParent))n.has(r)||delete e.activeAssistantBlockByParent[s];for(let[s,r]of Object.entries(e.activeThoughtBlockByParent))n.has(r)||delete e.activeThoughtBlockByParent[s];return e}function WG(e){return e.toolCallId===P_||e.toolKind==="updated_plan"}var ab=new WeakMap;function uS(e){ab.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},ab.set(e,e.blocks))}function GG(e,t){var r;let n=0,s=-1;for(let i=0;i<e.blocks.length;i+=1)if(((r=e.blocks[i])==null?void 0:r.kind)==="user"){if(s=i,n===t){eT(e,i);return}n+=1}s>=0&&t>=n&&eT(e,s)}function eT(e,t){uS(e),e.blocks=e.blocks.slice(0,t),ab.set(e,e.blocks),KG(e)}function KG(e){e.blockIndexById=iS(e.blocks),e.toolBlockByCallId={},e.permissionBlockByRequestId={},e.trimmedToolNotificationByCallId={},e.activeUserBlockId=void 0,e.activeAssistantBlockId=void 0,e.activeThoughtBlockId=void 0,e.activeAssistantBlockByParent={},e.activeThoughtBlockByParent={},e.currentToolCallId=void 0,e.pendingUserShellCommand=void 0,e.lastFollowupSuggestion=void 0;let t=new Set;for(let n of e.blocks)n.kind==="tool"?(e.toolBlockByCallId[n.toolCallId]=n.id,t.add(n.toolCallId)):n.kind==="permission"&&(e.permissionBlockByRequestId[n.requestId]=n.id);for(let n of Object.keys(e.toolProgress))t.has(n)||delete e.toolProgress[n]}function bl(e,t){uS(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function la(e,t){if(!t)return;let n=e.blockIndexById[t];if(n===void 0)return;let s=e.blocks[n];if(!s||s.id!==t)return;let r=YG(s);return uS(e),e.blocks[n]=r,r}function YG(e){return e.kind==="permission"?{...e,options:e.options.map(t=>Ja(t)),toolCall:Ja(e.toolCall),preview:Ja(e.preview)}:e.kind==="tool"?{...e,preview:Ja(e.preview),content:Ja(e.content),locations:Ja(e.locations),rawInput:Ja(e.rawInput),rawOutput:Ja(e.rawOutput)}:{...e}}function $u(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function ih(e,t){t?(oS(e,t),aS(e,t)):(lS(e),e.activeUserBlockId=void 0)}function dS(e,t){return e.length>=q_?e:Yp(e+t)}function Yp(e){if(e.length<=q_)return e;let t=Math.max(0,q_-J9.length);return`${e.slice(0,t)}${J9}`}function QG(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,r])=>r===Id).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.toolBlockByCallId[r],delete e.trimmedToolNotificationByCallId[r]}function XG(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,r])=>r===Mv).map(([r])=>r),s=n.length-t;if(!(s<=0))for(let r of n.slice(0,s))delete e.permissionBlockByRequestId[r]}function Ja(e,t=0){return t>MG?e:Array.isArray(e)?e.map(n=>Ja(n,t+1)):Rt(e)?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,Ja(s,t+1)])):e}function JG(e={}){let t=tT(e),n=new Set,s=!1,r=()=>{for(let o of n)try{o()}catch(a){ZG(a)}},i=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,r()}))};return{getSnapshot(){return t},subscribe(o){return n.add(o),()=>{n.delete(o)}},dispatch(o){let a=Array.isArray(o)?o:[o];a.length!==0&&(t=LG(t,a),i())},appendLocalUserMessage(o,a){t=RG(t,o,{images:a}),i()},reset(o={}){t=tT({maxBlocks:o.maxBlocks??t.maxBlocks,...o}),i()},clearAwaitingResync(){t.awaitingResync&&(t={...t,awaitingResync:!1},i())},clearFollowupSuggestion(){t.lastFollowupSuggestion!==void 0&&(t={...t,lastFollowupSuggestion:void 0},i())}}}function ZG(e){var s;let t=globalThis.reportError;if(typeof t=="function"){t(e);return}let n=(s=globalThis.console)==null?void 0:s.error;typeof n=="function"&&n.call(globalThis.console,e)}function tT(e){let t=e.blocks?[...e.blocks]:[];return{...NG({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:iS(t),toolBlockByCallId:{...e.toolBlockByCallId??{}},trimmedToolNotificationByCallId:{...e.trimmedToolNotificationByCallId??{}},permissionBlockByRequestId:{...e.permissionBlockByRequestId??{}},toolProgress:{...e.toolProgress??{}},activeAssistantBlockByParent:{...e.activeAssistantBlockByParent??{}},activeThoughtBlockByParent:{...e.activeThoughtBlockByParent??{}},lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion!==void 0?{...e.lastFollowupSuggestion}:void 0}}var eK="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function nT(e,t){var n;if(!e)return{models:[]};const s=new Set,r=[];let i=(n=e.current)==null?void 0:n.modelId;const o=e.approvalMode;let a;for(const l of e.providers)for(const c of l.models){!i&&c.isCurrent&&(i=c.modelId),a===void 0&&(i?c.modelId===i:c.isCurrent)&&(a=c.contextLimit);const d=[l.authType,c.modelId,c.baseUrl??"",c.envKey??""].join("\0");s.has(d)||(s.add(d),r.push({id:c.modelId,baseModelId:c.baseModelId,label:c.name||c.modelId,authType:l.authType,...c.contextLimit!==void 0?{contextWindow:c.contextLimit}:{},...c.modalities!==void 0?{modalities:c.modalities}:{},...c.baseUrl!==void 0?{baseUrl:c.baseUrl}:{},...c.envKey!==void 0?{envKey:c.envKey}:{},...c.isRuntime?{isRuntime:!0}:{}}))}return{models:r,currentModel:i,currentMode:o,contextWindow:a}}function tK(e){var t;const n=gi((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const s=_r(n,"currentModelId")??_r(n,"currentModel"),r=n.availableModels,i=[];let o;if(Array.isArray(r))for(const a of r){const l=gi(a),c=_r(l,"modelId")??_r(l,"id")??_r(l,"value");if(!c)continue;const d=gi(l==null?void 0:l._meta),h=t0(d,"contextLimit")??t0(d,"contextWindow")??t0(l,"contextLimit")??t0(l,"contextWindow");o===void 0&&s!==void 0&&c===s&&(o=h),i.push({id:c,baseModelId:_r(l,"baseModelId")??aK(c),label:_r(l,"name")??_r(l,"label")??c,...h!==void 0?{contextWindow:h}:{}})}if(!(!s&&i.length===0))return{models:i,currentModel:s,contextWindow:o}}function pL(e){if(!e)return{commands:[],skills:[]};const t=e.availableCommands.map(s=>{var r;return{name:s.name,description:s.description||"",...(r=s.input)!=null&&r.hint?{argumentHint:s.input.hint}:{},...bL(s._meta),raw:s}}),n=e.availableSkills.map(s=>({name:s,description:"",raw:{name:s,description:"",input:null,_meta:{source:"skill"}}}));return{commands:gL(t,n),skills:e.availableSkills}}function nK(e){if(!e)return{commands:[],skills:[]};const t=e.skills.filter(s=>s.status==="ok");return{commands:t.map(s=>({name:s.name,description:s.description||"",...s.argumentHint?{argumentHint:s.argumentHint}:{},raw:{name:s.name,description:s.description||"",input:s.argumentHint?{hint:s.argumentHint}:null,_meta:{source:"skill"}}})),skills:t.map(s=>s.name)}}function gL(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint,raw:s.raw}):t.set(s.name,s)}return[...t.values()]}function sK(e,t){var n;if(e.type==="session_update"){const s=gi((n=gi(e.data))==null?void 0:n.update),r=yL(s);if(r&&t(i=>({...i,tokenUsage:r,tokenCount:hS(r)})),_r(s,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=oK(s);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"session_metadata_updated":{const s=gi(e.data);Object.prototype.hasOwnProperty.call(s??{},"displayName")&&t(r=>({...r,displayName:_r(s,"displayName")}));break}case"model_switched":{const s=_r(gi(e.data),"modelId");s&&t(r=>({...r,currentModel:s}));break}case"approval_mode_changed":{const s=gi(e.data),r=_r(s,"next")??_r(s,"mode");r&&t(i=>({...i,currentMode:r}));break}}}function sT(e){const t=_r(e,"displayName");return t!=null&&t.trim()?t:void 0}function rK(e){var t;const n=gi((t=e==null?void 0:e.state)==null?void 0:t.modes);return _r(n,"currentModeId")??_r(n,"currentMode")}function hS(e){const t=(e==null?void 0:e.inputTokens)??(e==null?void 0:e.totalTokens);if(t!==void 0&&t>0)return t;if(!e)return;const n=Object.values(e).reduce((s,r)=>s+(typeof r=="number"?r:0),0);return n>0?n:void 0}function iK(e){var t;for(let n=e.length-1;n>=0;n--)try{const s=e[n];if(s.type!=="session_update")continue;const r=gi((t=gi(s.data))==null?void 0:t.update),i=yL(r);if(i)return i}catch{}}function yL(e){const t=gi(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=gi(t==null?void 0:t.usage),s={...Rm(n,"inputTokens"),...Rm(n,"outputTokens"),...Rm(n,"totalTokens"),...Rm(n,"thoughtTokens"),...Rm(n,"cachedReadTokens")};return hS(s)!==void 0?s:void 0}function Rm(e,t){const n=t0(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function oK(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=gi(i),l=_r(a,"name");if(!l)return[];const c=gi(a==null?void 0:a.input),d={name:l,description:_r(a,"description")??"",input:c?{hint:_r(c,"hint")??""}:null,_meta:gi(a==null?void 0:a._meta)??null};return[{name:l,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...bL(d._meta),raw:d}]}),s=Array.isArray(e.availableSkills)?e.availableSkills.filter(i=>typeof i=="string"):[],r=s.map(i=>({name:i,description:"",raw:{name:i,description:"",input:null,_meta:{source:"skill"}}}));return{commands:gL(n,r),skills:s}}function bL(e){const n=_r(e??void 0,"source");return{...n?{source:n}:{}}}function gi(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function _r(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function t0(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function aK(e){const t=e.lastIndexOf(")"),n=e.lastIndexOf("(");return n>=0&&t===e.length-1&&n<t?e.slice(0,n):e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function rT(e,t=[]){const n=[{type:"text",text:e}];for(const s of t){const r=s.mimeType??s.mediaType??s.media_type;r&&r!=="image/*"?n.push({type:"image",data:s.data,mimeType:r}):n.push({type:"image",data:s.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const lK=3e4;function cK(e,t,n){const s=Number.isFinite(t)&&t>0?t:1e3,r=Number.isFinite(n)&&n>0?Math.max(s,n):s,i=s*2**Math.max(0,e-1),o=Math.min(i,r),a=.8+Math.random()*.4;return Math.min(r,Math.max(1,Math.round(o*a)))}async function Qe(e,t,n=lK){let s;try{return await Promise.race([e,new Promise((r,i)=>{s=setTimeout(()=>{i(new Error(`${t} after ${n}ms`))},n)})])}finally{s!==void 0&&clearTimeout(s)}}function uK(e,t){return e<=0||t.aborted?Promise.resolve():new Promise(n=>{const s=setTimeout(r,e);function r(){clearTimeout(s),t.removeEventListener("abort",r),n()}t.addEventListener("abort",r,{once:!0})})}function hr(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function dK(e,t,n="replay",s=80,r){hr(t),t.current=setTimeout(()=>{t.current=void 0,e.getSnapshot().activeAssistantBlockId&&(e.dispatch({type:"assistant.done",reason:n}),r==null||r())},s)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const hK="qwen-code-webui-client-id:session:";function B2(e,t){if(e)return e;if(typeof window>"u")return P2();try{if(t){const n=window.sessionStorage.getItem(vL(t));if(n)return n}return P2()}catch{return P2()}}function ly(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(vL(t),e)}catch{}}async function iT(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${fK(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,s=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(s.status===204||s.status===404))throw new Error(`Detach client failed (${s.status})`)}function P2(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function vL(e){return`${hK}${encodeURIComponent(e)}`}function fK(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t-=1;return t===e.length?e:e.slice(0,t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function mK(e,t){const n={...e};return(!t||e.sessionId===t)&&(delete n.sessionId,delete n.clientId,delete n.displayName,delete n.tokenUsage,delete n.tokenCount,delete n.supportedCommands,delete n.context),{...n,status:"connected",loadingTranscript:void 0,catchingUp:void 0,error:void 0,errorStatus:void 0,missingSession:!1}}function pK({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:s,pendingSessionLoadRef:r,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:l,passiveAssistantDoneTimerRef:c,getCreateSessionRequest:d,createDetachedSession:h,getConnection:f,hasSessionActivePrompt:m,resetCurrentSessionActivePrompt:p,addNotice:y,setConnection:w,setPromptStatus:b,setRestoreSessionId:v,setRestoreMode:x,setRestoreSessionNonce:_,setAttachSessionNonce:E,setNewSessionNonce:k}){function M(){for(const[,T]of n.current)T.controller.abort();n.current.clear(),s.current.clear(),b("idle"),hr(c),r.current&&(l.current===r.current.sessionId&&(l.current=void 0),clearTimeout(r.current.timeout),r.current.reject(new DOMException("Session cleared","AbortError")),r.current=void 0),e.reset(),v(void 0)}function R(T,N){const I=i.current+1;return i.current=I,r.current&&(clearTimeout(r.current.timeout),r.current.reject(new DOMException(`Session ${N} superseded by a newer request`,"AbortError"))),new Promise((U,F)=>{const j=setTimeout(()=>{var V;((V=r.current)==null?void 0:V.id)===I&&(r.current=void 0,F(fs(y,`${wK(N)} session failed`,new Error(`Session ${N} timed out`),xK(N))))},3e4);r.current={id:I,sessionId:T,mode:N,timeout:j,resolve:U,reject:F}})}function L(T,N){var I;a.current=!1;const O=R(T,N),U=t.current,F=U==null?void 0:U.sessionId,j=F?n.current.get(F):void 0;return(I=j==null?void 0:j.reject)==null||I.call(j,new DOMException("Session switch interrupted prompt wait","AbortError")),F&&n.current.delete(F),p(),U&&U.detach().catch(V=>{console.warn("[DaemonSessionActions] detach before session switch failed:",V)}),t.current=void 0,w(V=>({...V,status:"connecting",sessionId:T,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),b("idle"),s.current.clear(),hr(c),e.reset(),x(N),v(T),_(V=>V+1),O.catch(V=>{throw n0(V)||w(ee=>({...ee,loadingTranscript:void 0,catchingUp:void 0})),V})}return{async sendPrompt(T,N){var I,O,U,F;const j=Rs(y,t.current,"Prompt failed","send_prompt"),V=j.sessionId;if(n.current.has(V))throw fs(y,"Prompt failed","A prompt is already in progress","send_prompt");hr(c),b("waiting");const ee=new AbortController;n.current.set(V,{controller:ee});try{const ce=((N==null?void 0:N.images)??[]).map(B=>({data:B.data,mimeType:B.mimeType||B.mediaType||B.media_type||"image/*"}));(N==null?void 0:N.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(T,ce);const $={prompt:rT(T,ce)};N!=null&&N.retry&&($.retry=!0);const J=await j.submitPrompt($,ee.signal);return(I=N==null?void 0:N.onAdmitted)==null||I.call(N),await gK(n.current,s.current,V,ee,J.promptId)}catch(ce){if(n0(ce))return((O=t.current)==null?void 0:O.sessionId)===V&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw iL(ce)?ce:(((U=t.current)==null?void 0:U.sessionId)===V&&e.dispatch({type:"assistant.done",reason:"error"}),fs(y,"Prompt failed",ce,"send_prompt"))}finally{const ce=n.current.get(V);(ce==null?void 0:ce.controller)===ee&&n.current.delete(V),((F=t.current)==null?void 0:F.sessionId)===V&&!m()&&b("idle")}},async submitPrompt(T,N){var I;const O=Rs(y,t.current,"Prompt failed","send_prompt");if(N!=null&&N.sessionId&&O.sessionId!==N.sessionId)throw new Error("Session changed before prompt submission");const U=((N==null?void 0:N.images)??[]).map(V=>({data:V.data,mimeType:V.mimeType||V.mediaType||V.media_type||"image/*"}));(N==null?void 0:N.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(T,U);const F={prompt:rT(T,U)};N!=null&&N.retry&&(F.retry=!0);const j=await O.submitPrompt(F);if((I=N==null?void 0:N.signal)!=null&&I.aborted)throw await O.removePendingPrompt(j.promptId).catch(V=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",V),y({severity:"error",category:"user_action",operation:"send_prompt",code:"daemon.send_prompt.pending_cleanup_failed",message:"Prompt was accepted after cancellation but could not be removed from the queue.",debugMessage:V instanceof Error?V.message:String(V),recoverable:!0})}),N.signal.reason??new DOMException("Aborted","AbortError");return{promptId:j.promptId}},async cancel(){var T,N;const I=Rs(y,t.current,"Cancel failed","cancel_prompt"),O=n.current.get(I.sessionId);O==null||O.controller.abort(),hr(c);const U=O?new AbortController:void 0;U&&n.current.set(I.sessionId,{controller:U});try{await Qe(I.cancel(),"Cancel timed out")}catch(F){throw fs(y,"Cancel failed",F,"cancel_prompt")}finally{U&&((T=n.current.get(I.sessionId))==null?void 0:T.controller)===U&&n.current.delete(I.sessionId),((N=t.current)==null?void 0:N.sessionId)===I.sessionId&&!m()&&b("idle")}},async setModel(T){const N=Rs(y,t.current,"Set model failed","switch_model");try{const I=await Qe(N.setModel(T),"Set model timed out");return w(O=>({...O,currentModel:T})),I}catch(I){throw fs(y,"Set model failed",I,"switch_model")}},async setApprovalMode(T,N){const I=Rs(y,t.current,"Set approval mode failed","set_approval_mode");try{const O=await Qe(I.client.setSessionApprovalMode(I.sessionId,T,{persist:N==null?void 0:N.persist,clientId:I.clientId}),"Set approval mode timed out");return w(U=>({...U,currentMode:O.mode||T})),O}catch(O){throw fs(y,"Set approval mode failed",O,"set_approval_mode")}},async respondToPermission(T,N){const I=Rs(y,t.current,"Permission response failed","submit_permission");try{return await Qe(I.respondToSessionPermission(T,N),"Permission response timed out")}catch(O){throw fs(y,"Permission response failed",O,"submit_permission")}},async submitPermission(T,N,I){const O=Rs(y,t.current,"Permission response failed","submit_permission"),U=N!==void 0&&N.length>0?{outcome:{outcome:"selected",optionId:N},...I?{answers:I}:{}}:{outcome:{outcome:"cancelled"},...I?{answers:I}:{}};try{return await Qe(O.respondToSessionPermission(T,U),"Permission response timed out")}catch(F){throw fs(y,"Permission response failed",F,"submit_permission")}},async heartbeat(){const T=t.current;if(!(!T||!o.current))return Qe(T.heartbeat(),"Heartbeat timed out")},async listSessions(T){const N=t.current;if(!N)return[];try{return await Qe(N.client.listWorkspaceSessions(N.workspaceCwd,T),"List sessions timed out")}catch(I){throw fs(y,"List sessions failed",I,"list_sessions")}},async loadSession(T){return L(T,"load")},async resumeSession(T){return L(T,"resume")},async createSession(){try{a.current=!1;const T=t.current,N=T&&f().sessionId===T.sessionId?T:void 0;if(N){const O=await Qe(N.client.createOrAttachSession(d()),"Create session timed out");return ly(O.clientId,O.sessionId),O}const I=await Qe(h(),"Create session timed out");if(a.current){try{await Qe(I.detach(),"Detach cleared session timed out")}catch(O){console.warn("[DaemonSessionActions] detach after interrupted create failed:",O)}throw new DOMException("Session creation interrupted","AbortError")}return ly(I.clientId,I.sessionId),t.current=I,l.current=I.sessionId,w(O=>({...O,status:"connected",sessionId:I.sessionId,...I.clientId?{clientId:I.clientId}:{},workspaceCwd:I.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),I}catch(T){throw fs(y,"Create session failed",T,"create_session")}},async attachSession(){const T=Rs(y,t.current,"Attach session failed","attach_session"),N=R(T.sessionId,"attach");return E(I=>I+1),N},async clearSession(){const T=t.current;if(a.current=!0,M(),t.current=void 0,w(N=>mK(N,T==null?void 0:T.sessionId)),T)try{await Qe(T.detach(),"Clear session timed out")}catch(N){console.warn("[DaemonSessionActions] detach on clear failed:",N)}},async newSession(){a.current=!1,M(),w(T=>({...T,missingSession:!1,error:void 0,errorStatus:void 0})),k(T=>T+1)},async releaseSession(T){try{const N=Rs(y,t.current,"Release session failed","release_session");await Qe(N.client.closeSession(T),"Release session timed out")}catch(N){throw fs(y,"Release session failed",N,"release_session")}},async closeSession(){const T=Rs(y,t.current,"Close session failed","close_session");try{await Qe(T.close(),"Close session timed out")}catch(N){throw fs(y,"Close session failed",N,"close_session")}},async refreshCommands(){const T=Rs(y,t.current,"Refresh commands failed","refresh_commands");try{const N=await Qe(T.supportedCommands(),"Refresh commands timed out"),{commands:I,skills:O}=pL(N);w(U=>({...U,commands:I,skills:O,supportedCommands:N}))}catch(N){throw fs(y,"Refresh commands failed",N,"refresh_commands")}},async getContext(){const T=Rs(y,t.current,"Load context failed","load_context");try{const N=await Qe(T.context(),"Load context timed out");return w(I=>({...I,context:N,currentMode:yK(N)??I.currentMode,currentModel:bK(N)??I.currentModel})),N}catch(N){throw fs(y,"Load context failed",N,"load_context")}},async getContextUsage(T){const N=Rs(y,t.current,"Load context usage failed","load_context_usage");try{return await Qe(N.contextUsage(T),"Load context usage timed out")}catch(I){throw fs(y,"Load context usage failed",I,"load_context_usage")}},async renameSession(T){const N=Rs(y,t.current,"Rename session failed","rename_session");try{return await Qe(N.updateMetadata({displayName:T}),"Rename session timed out")}catch(I){throw fs(y,"Rename session failed",I,"rename_session")}},async recapSession(){const T=Rs(y,t.current,"Recap session failed","recap_session");try{return await Qe(T.recap(),"Recap session timed out")}catch(N){throw fs(y,"Recap session failed",N,"recap_session")}},async getRewindSnapshots(){const T=Rs(y,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await Qe(T.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(N){throw fs(y,"Load rewind snapshots failed",N,"rewind_snapshots")}},async rewindSession(T,N){const I=Rs(y,t.current,"Rewind session failed","rewind_session");try{return await Qe(I.rewind(T,N),"Rewind session timed out")}catch(O){throw fs(y,"Rewind session failed",O,"rewind_session")}},async btwSession(T,N){var I;const O=Rs(y,t.current,"Side question failed","btw_session");try{return await Qe(O.btw(T,N),"Side question timed out")}catch(U){throw(I=N==null?void 0:N.signal)!=null&&I.aborted||n0(U)?U:fs(y,"Side question failed",U,"btw_session")}},async enqueueMidTurnMessage(T,N){const I=t.current;if(!I)return{accepted:!1};try{return await I.enqueueMidTurnMessage(T,N)}catch(O){return O instanceof DOMException&&O.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",O),{accepted:!1}}},async getPendingPrompts(T){const N=t.current;if(!N)return{pendingPrompts:[]};if(T!=null&&T.sessionId&&N.sessionId!==T.sessionId)throw new Error("Session changed before pending prompts refresh");return await N.getPendingPrompts()},async removePendingPrompt(T,N){const I=t.current;return I?N!=null&&N.sessionId&&I.sessionId!==N.sessionId?await I.client.removePendingPrompt(N.sessionId,T):await I.removePendingPrompt(T):{removed:!1}},async sendShellCommand(T){var N,I;const O=Rs(y,t.current,"Shell command failed","send_shell_command"),U=`${O.sessionId}:shell`;b("waiting");const F=new AbortController;n.current.set(U,{controller:F});try{return await O.shellCommand(T,F.signal)}catch(j){throw fs(y,"Shell command failed",j,"send_shell_command")}finally{((N=n.current.get(U))==null?void 0:N.controller)===F&&n.current.delete(U),((I=t.current)==null?void 0:I.sessionId)===O.sessionId&&!m()&&b("idle")}},async getTasks(){const T=Rs(y,t.current,"Get tasks failed","load_tasks");try{return await Qe(T.tasks(),"Get tasks timed out")}catch(N){throw fs(y,"Get tasks failed",N,"load_tasks")}},async cancelTask(T,N){const I=Rs(y,t.current,"Cancel task failed","cancel_task");try{return await Qe(I.cancelTask(T,N),"Cancel task timed out")}catch(O){throw fs(y,"Cancel task failed",O,"cancel_task")}},async clearGoal(){const T=Rs(y,t.current,"Clear goal failed","clear_goal");try{return await Qe(T.clearGoal(),"Clear goal timed out")}catch(N){throw fs(y,"Clear goal failed",N,"clear_goal")}},async getStats(){const T=Rs(y,t.current,"Load stats failed","load_stats");try{return await Qe(T.stats(),"Load stats timed out")}catch(N){throw fs(y,"Load stats failed",N,"load_stats")}},async respondToGlobalPermission(T,N){const I=Rs(y,t.current,"Global permission response failed","submit_permission");try{return await Qe(I.client.respondToPermission(T,N),"Global permission response timed out")}catch(O){throw fs(y,"Global permission response failed",O,"submit_permission")}},async branchSession(T){const N=Rs(y,t.current,"Branch session failed","branch_session");try{const I=await Qe(N.client.branchSession(N.sessionId,{name:T},N.clientId),"Branch session timed out");return ly(I.clientId,I.sessionId),L(I.sessionId,"load").catch(O=>{n0(O)||fs(y,"Branch session failed",O,"branch_session")}),{sessionId:I.sessionId,displayName:I.displayName}}catch(I){throw fs(y,"Branch session failed",I,"branch_session")}},async forkSession(T){const N=Rs(y,t.current,"Fork session failed","fork_session");try{return await Qe(N.fork(T),"Fork session timed out")}catch(I){throw fs(y,"Fork session failed",I,"fork_session")}}}}function gK(e,t,n,s,r){return new Promise((i,o)=>{const a=U_(n,r),l=t.get(a);if(l){t.delete(a),l.status==="resolved"?i(l.result):o(l.error);return}const c=e.get(n);if((c==null?void 0:c.controller)!==s){o(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.promptId!==r){o(new Error(`Prompt accepted with unexpected id ${r}`));return}if(s.signal.aborted){e.delete(n),o(s.signal.reason??new DOMException("Aborted","AbortError"));return}const d=()=>{s.signal.removeEventListener("abort",h)},h=()=>{const f=e.get(n);(f==null?void 0:f.controller)===s&&e.delete(n),d(),o(s.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...c,promptId:r,resolve:f=>{d(),i(f)},reject:f=>{d(),o(f)}}),s.signal.addEventListener("abort",h,{once:!0})})}function U_(e,t){return JSON.stringify([e,t])}function yK(e){const t=typeof e.state.modes=="object"&&e.state.modes!==null?e.state.modes:void 0,n=(t==null?void 0:t.currentModeId)??(t==null?void 0:t.currentMode);return typeof n=="string"?n:void 0}function bK(e){const t=typeof e.state.models=="object"&&e.state.models!==null?e.state.models:void 0,n=(t==null?void 0:t.currentModelId)??(t==null?void 0:t.currentModel);return typeof n=="string"?n:void 0}function Rs(e,t,n,s){if(!t)throw fs(e,n,"Daemon session is not connected",s);return t}function fs(e,t,n,s){if(n0(n)){if(n instanceof Error)return n;const i=n instanceof DOMException?n.message:"Aborted",o=new Error(i);return o.name="AbortError",o}const r=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:s,code:`daemon.${s}.failed`,message:`${t}: ${r}`,debugMessage:r,recoverable:!0}),vK(n instanceof Error?n:new Error(r))}function n0(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function vK(e){return Object.assign(e,{_alreadyDispatched:!0})}function wK(e){return e.charAt(0).toUpperCase()+e.slice(1)}function xK(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const _K=33e4;function kK({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:s}){return{async listSessions(r){const i=Lt(e,"List sessions failed"),o=t();return o?Qe(i.listWorkspaceSessionsPage(o,r).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(r){const i=Lt(e,"List sessions failed"),o=t();return o?Qe(i.listWorkspaceSessionsPage(o,r),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const r=Lt(e,"List session groups failed"),i=t();return i?Qe(r.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(r){const i=Lt(e,"Create session group failed"),o=$2(t);return Qe(i.createSessionGroup(o,r),"Create session group timed out")},async updateSessionGroup(r,i){const o=Lt(e,"Update session group failed"),a=$2(t);return Qe(o.updateSessionGroup(a,r,i),"Update session group timed out")},async deleteSessionGroup(r){const i=Lt(e,"Delete session group failed"),o=$2(t);return Qe(i.deleteSessionGroup(o,r),"Delete session group timed out")},async updateSessionOrganization(r,i){const o=Lt(e,"Update session organization failed");return Qe(o.updateSessionOrganization(r,i),"Update session organization timed out")},async deleteSession(r){const i=Lt(e,"Delete session failed"),o=await Qe(i.deleteSessionsData([r]),"Delete session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.removed.length>0||o.notFound.length>0},async deleteSessions(r){const i=Lt(e,"Delete sessions failed");return Qe(i.deleteSessionsData(r),"Delete sessions timed out")},async exportSession(r,i="html"){const o=Lt(e,"Export session failed");return Qe(o.exportSession(r,{format:i}),"Export session timed out")},async archiveSession(r){const i=Lt(e,"Archive session failed"),o=await Qe(i.archiveSessionsData([r]),"Archive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.archived.length>0||o.alreadyArchived.length>0},async unarchiveSession(r){const i=Lt(e,"Unarchive session failed"),o=await Qe(i.unarchiveSessionsData([r]),"Unarchive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.unarchived.length>0||o.alreadyActive.length>0},async loadMcpStatus(){const r=Lt(e,"Load MCP status failed");return Qe(r.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(r){const i=Lt(e,"Load MCP tools failed");try{return await Qe(i.workspaceMcpTools(r),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(r){const i=Lt(e,"Load MCP resources failed");try{return await Qe(i.workspaceMcpResources(r),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:r,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(r){const i=Lt(e,"Restart MCP server failed");return Qe(i.restartMcpServer(r),"Restart MCP server timed out",5*6e4)},async manageMcpServer(r,i){const o=Lt(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return Qe(o.manageMcpServer(r,i),"Manage MCP server timed out",a)},async loadDaemonStatus(r){const i=Lt(e,"Load daemon status failed");return Qe(i.daemonStatus(r),"Load daemon status timed out")},async loadUsageDashboard(r){const i=Lt(e,"Load usage dashboard failed");return Qe(i.usageDashboard(r),"Load usage dashboard timed out")},async loadSkillsStatus(){const r=Lt(e,"Load skills failed");return Qe(r.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const r=Lt(e,"Load extensions failed");return Qe(r.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const r=Lt(e,"Load tools failed");return Qe(r.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(r,i){const o=Lt(e,"Set tool enabled failed");return Qe(o.setWorkspaceToolEnabled(r,i),"Set tool enabled timed out")},async loadSettingsStatus(){const r=Lt(e,"Load settings failed");return Qe(r.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(r,i,o){const a=Lt(e,"Set setting failed");return Qe(a.setWorkspaceSetting(r,i,o),"Set setting timed out")},async loadMemoryStatus(){const r=Lt(e,"Load memory failed");return Qe(r.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(r){const i=Lt(e,"Read workspace file failed");return Qe(i.readWorkspaceFile(r),"Read workspace file timed out")},async writeMemory(r){const i=Lt(e,"Write memory failed");return Qe(i.writeWorkspaceMemory(r),"Write memory timed out")},async listAgents(){const r=Lt(e,"List agents failed");return Qe(r.listWorkspaceAgents(),"List agents timed out")},async getAgent(r){const i=Lt(e,"Get agent failed");return Qe(i.getWorkspaceAgent(r),"Get agent timed out")},async createAgent(r){const i=Lt(e,"Create agent failed");return Qe(i.createWorkspaceAgent(r),"Create agent timed out")},async generateAgent(r){const i=Lt(e,"Generate agent failed");return Qe(i.generateWorkspaceAgent(r),"Generate agent timed out",_K)},async deleteAgent(r,i){const o=Lt(e,"Delete agent failed");return Qe(o.deleteWorkspaceAgent(r,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(r,i){Lt(e,"Glob workspace failed");const o=Cc(n,"/glob");o.searchParams.set("pattern",r),(i==null?void 0:i.maxResults)!==void 0&&o.searchParams.set("maxResults",String(i.maxResults)),(i==null?void 0:i.includeIgnored)!==void 0&&o.searchParams.set("includeIgnored",i.includeIgnored?"1":"0"),(i==null?void 0:i.cwd)!==void 0&&o.searchParams.set("cwd",i.cwd);const a=await Qe(fetch(Ac(o,n),{headers:Lm(s)}),"Glob workspace timed out");if(!a.ok)throw new Error(await Ec(a,"GET /glob"));const l=await a.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const r=Lt(e,"Load providers failed");return Qe(r.workspaceProviders(),"Load providers timed out")},async readFileBytes(r,i){const o=Lt(e,"Read file bytes failed");return Qe(o.readWorkspaceFileBytes(r,i??{}),"Read file bytes timed out")},async writeFile(r){const i=Lt(e,"Write file failed");return Qe(i.writeWorkspaceFile(r),"Write file timed out")},async editFile(r){const i=Lt(e,"Edit file failed");return Qe(i.editWorkspaceFile(r),"Edit file timed out")},async stat(r){Lt(e,"Stat file failed");const i=Cc(n,"/stat");i.searchParams.set("path",r);const o=await Qe(fetch(Ac(i,n),{headers:Lm(s)}),"Stat file timed out");if(!o.ok)throw new Error(await Ec(o,"GET /stat"));return await o.json()},async listDirectory(r){Lt(e,"List directory failed");const i=Cc(n,"/list");i.searchParams.set("path",r);const o=await Qe(fetch(Ac(i,n),{headers:Lm(s)}),"List directory timed out");if(!o.ok)throw new Error(await Ec(o,"GET /list"));return await o.json()},async listScheduledTasks(){Lt(e,"List scheduled tasks failed");const r=Cc(n,"/scheduled-tasks"),i=await Qe(fetch(Ac(r,n),{headers:Lm(s)}),"List scheduled tasks timed out");if(!i.ok)throw new Error(await Ec(i,"GET /scheduled-tasks"));const o=await i.json();return Array.isArray(o.tasks)?o.tasks:[]},async createScheduledTask(r){Lt(e,"Create scheduled task failed");const i=Cc(n,"/scheduled-tasks"),o=await Qe(fetch(Ac(i,n),{method:"POST",headers:z2(s),body:JSON.stringify(r)}),"Create scheduled task timed out");if(!o.ok)throw new Error(await Ec(o,"POST /scheduled-tasks"));return await o.json()},async updateScheduledTask(r,i){Lt(e,"Update scheduled task failed");const o=Cc(n,`/scheduled-tasks/${encodeURIComponent(r)}`),a=await Qe(fetch(Ac(o,n),{method:"PATCH",headers:z2(s),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!a.ok)throw new Error(await Ec(a,`PATCH /scheduled-tasks/${r}`));return await a.json()},async runScheduledTask(r){Lt(e,"Run scheduled task failed");const i=Cc(n,`/scheduled-tasks/${encodeURIComponent(r)}/run`),o=await Qe(fetch(Ac(i,n),{method:"POST",headers:z2(s)}),"Run scheduled task timed out");if(!o.ok)throw new Error(await Ec(o,`POST /scheduled-tasks/${r}/run`));return await o.json()},async deleteScheduledTask(r){Lt(e,"Delete scheduled task failed");const i=Cc(n,`/scheduled-tasks/${encodeURIComponent(r)}`),o=await Qe(fetch(Ac(i,n),{method:"DELETE",headers:Lm(s)}),"Delete scheduled task timed out");if(!o.ok)throw new Error(await Ec(o,`DELETE /scheduled-tasks/${r}`))},async loadEnv(){const r=Lt(e,"Load env failed");return Qe(r.workspaceEnv(),"Load env timed out")},async loadPreflight(){const r=Lt(e,"Load preflight failed");return Qe(r.workspacePreflight(),"Load preflight timed out")},async initWorkspace(r){const i=Lt(e,"Init workspace failed");return Qe(i.initWorkspace(r),"Init workspace timed out")},async updateAgent(r,i,o){const a=Lt(e,"Update agent failed");return Qe(a.updateWorkspaceAgent(r,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(r,i){const o=Lt(e,"Install extension failed");return Qe(o.installExtension(r,i),"Install extension timed out")},async extensionOperationStatus(r){const i=Lt(e,"Load extension operation failed");return Qe(i.extensionOperationStatus(r),"Load extension operation timed out")},async checkExtensionUpdates(r){const i=Lt(e,"Check extension updates failed");return Qe(i.checkExtensionUpdates(r),"Check extension updates timed out")},async refreshExtensions(r){const i=Lt(e,"Refresh extensions failed");return Qe(i.refreshExtensions(r),"Refresh extensions timed out")},async enableExtension(r,i,o){const a=Lt(e,"Enable extension failed");return Qe(a.enableExtension(r,i,o),"Enable extension timed out")},async disableExtension(r,i,o){const a=Lt(e,"Disable extension failed");return Qe(a.disableExtension(r,i,o),"Disable extension timed out")},async updateExtension(r,i){const o=Lt(e,"Update extension failed");return Qe(o.updateExtension(r,i),"Update extension timed out")},async uninstallExtension(r,i){const o=Lt(e,"Uninstall extension failed");return Qe(o.uninstallExtension(r,i),"Uninstall extension timed out")},async startDeviceFlow(r){const i=Lt(e,"Start device flow failed");return Qe(i.startDeviceFlow({providerId:r}),"Start device flow timed out")},async getDeviceFlow(r,i){const o=Lt(e,"Get device flow failed");return Qe(o.getDeviceFlow(r,i),"Get device flow timed out")},async cancelDeviceFlow(r){const i=Lt(e,"Cancel device flow failed");return Qe(i.cancelDeviceFlow(r),"Cancel device flow timed out")},async getAuthStatus(){const r=Lt(e,"Get auth status failed");return Qe(r.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const r=Lt(e,"Get auth providers failed");return Qe(r.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(r){const i=Lt(e,"Install auth provider failed");return Qe(i.installAuthProvider(r),"Install auth provider timed out")}}}function Lt(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function $2(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function Lm(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function z2(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Cc(e,t){const n=wL(e),s=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,s)}function Ac(e,t){return wL(t)?e.toString():`${e.pathname}${e.search}`}function wL(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}async function Ec(e,t){try{const n=await e.json(),s=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return s?`${t}: ${s}`:`${t}: HTTP ${e.status}`}catch{return`${t}: HTTP ${e.status}`}}const fS=g.createContext(void 0);let Dm;function SK({baseUrl:e,token:t,workspaceCwd:n,autoConnect:s=!0,transport:r,children:i}){const o=g.useMemo(()=>s?new B_({baseUrl:e,token:t,transport:r}):void 0,[s,e,t,r]),a=g.useRef(o);a.current=o;const l=g.useRef(void 0),c=g.useRef(void 0),d=g.useRef(n),[h,f]=g.useState(void 0),[m,p]=g.useState(s?"connecting":"idle"),[y,w]=g.useState(void 0),b=g.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(l.current!==o&&(l.current=o,c.current=void 0),!c.current){const _=o.capabilities().catch(E=>{throw c.current===_&&(c.current=void 0),E});c.current=_}return c.current},[o]);g.useEffect(()=>{if(!o)return;p("connecting"),w(void 0),f(void 0),Dm===o&&(Dm=void 0);let _=!1;return b().then(E=>{_||(f(E),p("connected"))}).catch(E=>{_||(w(E instanceof Error?E:new Error(String(E))),p("error"))}),()=>{_=!0,Dm=o,queueMicrotask(()=>{Dm===o&&(Dm=void 0,o.dispose())})}},[o,b]),d.current=(h==null?void 0:h.workspaceCwd)??n;const v=g.useMemo(()=>kK({getClient:()=>a.current,getWorkspaceCwd:()=>d.current,baseUrl:e,token:t}),[e,t]),x=g.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(h==null?void 0:h.workspaceCwd)??n,status:m,error:y,capabilities:h,getCapabilities:b,actions:v}},[o,t,e,n,m,y,h,b,v]);return u.jsx(fS.Provider,{value:x,children:i})}function mS(){const e=g.useContext(fS);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function da(){return mS().actions}function xL(){return g.useContext(fS)}function TK(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&oT(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&oT(t)||(t==null?void 0:t.kind)==="tool"&&aT(t))return"responding";for(let n=e.length-1;n>=0;n--){const s=e[n];if(s.kind==="user")break;if(s.kind==="tool"&&aT(s))return"responding"}return"idle"}function CK(e,t){const n=TK(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function oT(e){return e.streaming===!0}function aT(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const V_=new Set;let lb;function lT(){return lb}function AK(e){return V_.add(e),()=>{V_.delete(e)}}function EK(e){lb={...e},_L()}function Yg(){lb!==void 0&&(lb=void 0,_L())}function _L(){for(const e of V_)e()}function MK(e){if(!e||typeof e!="object")return;const t=e;if(t.type!=="followup_suggestion")return;const n=t.data;if(!n||typeof n!="object")return;const s=n,r=s.sessionId,i=s.suggestion,o=s.promptId;if(!(typeof r!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:r,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const W_=new Set,kL=Object.freeze([]),F2=64;let nu=kL;function cT(){return nu}function NK(e){return W_.add(e),()=>{W_.delete(e)}}function IK(e){const t=[...nu,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>F2){const n=t.length-F2;console.debug(`[mid-turn] sidechannel buffer over ${F2}; evicting ${n} oldest batch(es)`),nu=t.slice(n)}else nu=t;SL()}function jK(e){if(e.length===0||nu.length===0)return;const t=new Set(e),n=nu.filter(s=>!t.has(s));n.length!==nu.length&&(nu=n.length===0?kL:n,SL())}function SL(){for(const e of W_)e()}function RK(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==oL)return;const n=t.data;if(!n||typeof n!="object")return;const s=n,r=s.sessionId,i=s.messages;if(typeof r!="string"||!Array.isArray(i))return;const o=i.filter(l=>typeof l=="string"&&l.length>0);if(o.length===0)return;const a=t.originatorClientId;return{sessionId:r,messages:o,...typeof a=="string"?{originatorClientId:a}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const G_=new Set,K_=new Set;let TL=0,ff=[];function LK(){return TL}function uT(){return ff}function DK(e){return G_.add(e),()=>{G_.delete(e)}}function OK(e){return K_.add(e),()=>{K_.delete(e)}}function BK(){TL++;for(const e of G_)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function CL(){for(const e of K_)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function PK(e){if(e.length===0)return;const t=new Set(e),n=ff.filter(s=>!t.has(s));n.length!==ff.length&&(ff=n,CL())}function $K(e){const t=AL(e);return t?(ff=[...ff,t].slice(-200),CL(),(t.type===tS||t.type===nS||t.type===sS)&&BK(),!0):!1}function zK(e){return AL(e)!==void 0}function AL(e){if(!e||typeof e!="object")return;const t=e,n=t.type,s=t.data;if(!s||typeof s!="object")return;const r=s;if(typeof r.sessionId=="string"&&((n===tS||n===nS||n===sS)&&typeof r.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof r.promptId=="string"))return e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const EL=[404,410],FK=new Set(EL);function N0(e){return e!==void 0&&FK.has(e)}function qa(e,t){return N0(t)&&!N0(e)?t:e}function $c(e,t){const n=cL(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const ML=g.createContext(void 0),NL=g.createContext(void 0),pS=g.createContext(void 0),IL=g.createContext(void 0),jL=g.createContext(void 0),RL=g.createContext(void 0),gS=new Set([401,403]),qK=new Set([...gS,...EL]),HK=2e5,UK={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},VK=Symbol("unhandled session");function LL(e){const{baseUrl:t,token:n,workspaceCwd:s,sessionId:r,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:l=HK,suppressOwnUserEcho:c=!0,includeRawEvent:d=!1,autoConnect:h=!0,autoReconnect:f=!0,reconnectDelayMs:m=1e3,maxReconnectDelayMs:p=1e4,heartbeatIntervalMs:y=3e4,heartbeatFailureThreshold:w=3,loadWarnings:b,children:v}=e,x=xL(),_=t??(x==null?void 0:x.baseUrl),E=n??(x==null?void 0:x.token),k=s??(x==null?void 0:x.workspaceCwd),M=g.useRef(x==null?void 0:x.client);M.current=x==null?void 0:x.client;const R=g.useRef(x==null?void 0:x.capabilities);R.current=x==null?void 0:x.capabilities;const L=g.useRef(x==null?void 0:x.getCapabilities);L.current=x==null?void 0:x.getCapabilities;const N=g.useRef(r).current,I=N===void 0,O=g.useRef(k);O.current=k;const U=g.useRef(k);k&&(U.current=k);const F=g.useMemo(()=>JG({maxBlocks:l}),[l]),j=g.useRef(void 0),V=g.useRef(void 0),ee=g.useRef(new Map),ce=g.useRef(new Map),$=g.useRef(void 0),J=g.useRef(0),B=g.useRef(void 0),C=g.useRef(!1),z=g.useRef({consecutiveFailures:0}),X=g.useRef(!1),ae=g.useRef(void 0),be=g.useRef(new WeakSet),fe=g.useRef({suppressOwnUserEcho:c,includeRawEvent:d}),ie=g.useRef({reconnectDelayMs:m,maxReconnectDelayMs:p}),G=g.useRef(b),q=g.useRef(void 0);(!q.current||i)&&(q.current=B2(i)),fe.current={suppressOwnUserEcho:c,includeRawEvent:d},ie.current={reconnectDelayMs:m,maxReconnectDelayMs:p},G.current=b;const le=o==null?void 0:o.modelServiceId,Se=o==null?void 0:o.sessionScope,$e=g.useRef(o);$e.current=o;const[Ae,we]=g.useState("idle"),[ct,ht]=g.useState(N),[ut,ft]=g.useState("load"),[tt,qt]=g.useState(0),[Ye,ge]=g.useState(0),[st,ne]=g.useState(0),[ue,Re]=g.useState({status:h?"connecting":"idle",...N?{sessionId:N}:{}}),rt=g.useRef(ue);rt.current=ue;const vt=g.useRef(0),[tn,jn]=g.useState([]),ln=g.useCallback(Mt=>{const Cn={...Mt,id:Mt.id??`daemon-notice-${Date.now()}-${++vt.current}`,createdAt:Mt.createdAt??Date.now()};return jn(rn=>[...rn.slice(-49),Cn]),Cn},[]),Pn=g.useCallback(Mt=>{jn(Cn=>Cn.filter(rn=>rn.id!==Mt))},[]),Qt=g.useCallback(()=>{jn([])},[]),ve=g.useMemo(()=>({notices:tn,dismissNotice:Pn,clearNotices:Qt}),[Qt,Pn,tn]),[Be,He]=g.useState(UK),Ht=g.useRef(()=>!1),Yn=g.useRef(!1);g.useEffect(()=>(Yn.current=!0,()=>{Yn.current=!1}),[]),g.useEffect(()=>{if(!h)return;if(!M.current&&!_){Re({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Mt=new AbortController;let Cn=!1;return(async()=>{var Ln,Xn,Nn,_n,Os,ks,Kt,Vn,Te,mt,Xt;const mn=M.current??new B_({baseUrl:_,token:E});let oe,_e,se=ct,pe=!ct&&st>0,Le=0,wt=()=>!1,dt=!1;for(;!Cn&&!Mt.signal.aborted;){let Ft=!1;try{let pn=!1,An=!1,un=!1,rs=!1,Ys,Bs;if(!oe){const ze=j.current;ze&&!ct&&!se&&!pe&&(oe=ze,se=ze.sessionId,V.current=ze.sessionId,rs=!0)}if(!oe){Re(lt=>({...lt,status:"connecting",error:void 0,errorStatus:qa(void 0,lt.errorStatus)}));const ze=L.current,Wn=R.current??(ze?await ze():await mn.capabilities());if(Cn||Mt.signal.aborted)return;_e=Wn,C.current=Array.isArray(Wn.features)&&Wn.features.includes("client_heartbeat");const In=O.current??Wn.workspaceCwd;if(U.current=In,(I||X.current)&&!ct&&!se&&!pe){const[lt,pt]=await Promise.allSettled([mn.workspaceProviders(),mn.workspaceSkills()]);lt.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",lt.reason),pt.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",pt.reason);const At=lt.status==="fulfilled"?lt.value:void 0,cn=nT(At),{commands:Y,skills:xe}=nK(pt.status==="fulfilled"?pt.value:void 0);Re(ke=>({...ke,status:"connected",workspaceCwd:In,models:cn.models,currentModel:cn.currentModel,currentMode:cn.currentMode,contextWindow:cn.contextWindow,providers:At,capabilities:Wn,...Y.length>0?{commands:Y}:{},...xe.length>0?{skills:xe}:{}}));return}const Xs=ct&&ut==="resume"?jm.resume:jm.load,vs=ct??se,Ss=i?q.current:B2(void 0,vs);Ft=!!ct,vs&&Re(lt=>({...lt,sessionId:vs,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const $n=ct?await Xs(mn,ct,{workspaceCwd:In},Ss):se?await jm.load(mn,se,{workspaceCwd:In},Ss):await jm.createOrAttach(mn,{...le!==void 0?{modelServiceId:le}:{},...pe?{sessionScope:"thread"}:Se!==void 0?{sessionScope:Se}:{},workspaceCwd:In},Ss);if(Ft=!1,!i&&$n.clientId&&(q.current=$n.clientId,ly($n.clientId,$n.sessionId)),Cn||Mt.signal.aborted){iT({baseUrl:_,token:E,sessionId:$n.sessionId,clientId:$n.clientId}).catch(lt=>console.warn("[DaemonSessionProvider] detach failed:",lt));return}const Me=V.current;Me!==$n.sessionId&&Qt(),Me!==void 0&&$n.sessionId!==Me?(we("idle"),hr(B),un=!0):Me!==void 0&&($n.replaySnapshot.compactedReplay.length+$n.replaySnapshot.liveJournal.length>0?(we("idle"),hr(B),un=!0):(F.dispatch({type:"assistant.done",reason:"reconnected"}),F.getSnapshot().awaitingResync&&F.clearAwaitingResync())),pn=Me!==void 0&&Me===$n.sessionId,An=$n.replaySnapshot.compactedReplay.length>0||$n.replaySnapshot.liveJournal.length>0;const _t=[...$n.replaySnapshot.compactedReplay,...$n.replaySnapshot.liveJournal];Ys=iK(_t),Bs=hS(Ys),oe=$n,se=oe.sessionId,pe=!1,V.current=oe.sessionId,j.current=oe}const Dt=oe,Ps=be.current.has(Dt);let kn=Dt.hasActivePrompt===!0&&!Ps;const Si=()=>{be.current.add(Dt),kn=!1},yr=()=>kn||ee.current.has(Dt.sessionId);wt=yr,Ht.current=yr,we(yr()?"streaming":"idle");const ma=$.current,Oo=(ma==null?void 0:ma.sessionId)===Dt.sessionId?ma:void 0,{compactedReplay:El,liveJournal:Ra}=Dt.replaySnapshot,rr=[...El,...Ra],pa=An&&rr.length>0;if(un&&!pa&&F.reset(),pa){const ze={...fe.current,suppressOwnUserEcho:!1},Wn=[];for(const In of rr)try{const Xs=hT(In,Dt.clientId,ze,Re,{updateConnection:!1});if(Wn.push(...fT(In,Xs,ln)),In.type==="turn_complete"){const vs=((Ln=In.data)==null?void 0:Ln.stopReason)??"end_turn";Wn.push($c(In,vs))}else In.type==="turn_error"&&Wn.push($c(In,"error"))}catch(Xs){const vs=Xs instanceof Error?Xs.message:String(Xs);ln({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:vs,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",Xs)}un&&F.reset(),Wn.length>0&&(F.dispatch(Wn),pT(Wn,He));for(const In of rr)dT(ee.current,ce.current,Dt.sessionId,In,F,we,B,{requireBoundPromptId:!0});Re(In=>({...In,catchingUp:void 0}))}Re(ze=>({...ze,status:"connected",sessionId:Dt.sessionId,...Dt.clientId?{clientId:Dt.clientId}:{},workspaceCwd:Dt.workspaceCwd,displayName:sT(Dt.state)??(ze.sessionId===Dt.sessionId?ze.displayName:void 0),tokenUsage:Ys!==void 0?Ys:ze.sessionId===Dt.sessionId?ze.tokenUsage:void 0,tokenCount:Bs!==void 0?Bs:ze.sessionId===Dt.sessionId?ze.tokenCount??0:0,loadingTranscript:void 0,catchingUp:pa?ze.catchingUp:pn||Dt.lastEventId!=null||void 0})),Oo&&($.current=void 0,clearTimeout(Oo.timeout),ae.current===Dt.sessionId&&(ae.current=void 0),Oo.resolve());const li=rs&&rt.current.commands!==void 0&&rt.current.skills!==void 0&&rt.current.supportedCommands!==void 0&&rt.current.context!==void 0,[Qs,Ti,Ci]=li?[void 0,void 0,void 0]:await Promise.allSettled([mn.workspaceProviders(),Dt.supportedCommands(),Dt.context()]),Wi=(Qs==null?void 0:Qs.status)==="fulfilled"?Qs.value:void 0,ga=(Ti==null?void 0:Ti.status)==="fulfilled"?Ti.value:void 0,Bo=(Ci==null?void 0:Ci.status)==="fulfilled"?Ci.value:void 0,Ml=[(Qs==null?void 0:Qs.status)==="rejected"?(Xn=G.current)==null?void 0:Xn.models:void 0,(Ti==null?void 0:Ti.status)==="rejected"?(Nn=G.current)==null?void 0:Nn.commands:void 0,(Ci==null?void 0:Ci.status)==="rejected"?(_n=G.current)==null?void 0:_n.context:void 0].filter(ze=>!!ze),Gi=nT(Wi),Ai=tK(Bo),Q=Ai&&Ai.models.length>0?Ai.models:Gi.models,de=(Ai==null?void 0:Ai.currentModel)??Gi.currentModel,Oe=de===Gi.currentModel?Gi.contextWindow:(Os=Gi.models.find(ze=>ze.id===de))==null?void 0:Os.contextWindow,et=(Ai==null?void 0:Ai.contextWindow)??((ks=Q.find(ze=>ze.id===de))==null?void 0:ks.contextWindow)??Oe,{commands:bn,skills:$t}=pL(ga),vn=rK(Bo)??Gi.currentMode;Re(ze=>ze.sessionId!==Dt.sessionId?ze:{...ze,status:"connected",sessionId:Dt.sessionId,...Dt.clientId?{clientId:Dt.clientId}:{},workspaceCwd:Dt.workspaceCwd,commands:ga!==void 0?bn:ze.commands,skills:ga!==void 0?$t:ze.skills,models:Q.length>0?Q:ze.models,currentModel:de??ze.currentModel,currentMode:vn??ze.currentMode,displayName:sT(Dt.state)??ze.displayName,contextWindow:et??ze.contextWindow,providers:Wi??ze.providers,supportedCommands:ga??ze.supportedCommands,context:Bo??ze.context,capabilities:_e??ze.capabilities,loadingTranscript:void 0,catchingUp:pa?ze.catchingUp:pn||Dt.lastEventId!=null||void 0}),Ml.length>0&&F.dispatch(Ml.map(ze=>({type:"status",text:ze})));let is=!1,ds=!1;const hs=()=>{const ze=ee.current.get(Dt.sessionId);ze==null||ze.controller.abort(),ee.current.delete(Dt.sessionId),kn&&Si(),hr(B),we("idle"),F.reset(),Dt.setLastEventId(0),se=Dt.sessionId,ds=!0,oe=void 0,j.current=void 0,Ht.current=()=>!1,Re(Wn=>({...Wn,status:"connecting",error:void 0,errorStatus:qa(void 0,Wn.errorStatus)}))};for await(const ze of Dt.events({signal:Mt.signal,maxQueued:a})){if(((Kt=j.current)==null?void 0:Kt.sessionId)!==Dt.sessionId)break;is||(is=!0,Le=0);try{const Wn=MK(ze);if(Wn){EK(Wn);continue}const In=RK(ze);In&&IK(In),zK(ze)&&($K(ze),ze.type==="pending_prompt_started"&&(hr(B),we("waiting")));const Xs=hT(ze,Dt.clientId,fe.current,Re),vs=fT(ze,Xs,ln);if(ze.type==="state_resync_required"&&(typeof ze.data=="object"&&ze.data!==null?ze.data.reason:void 0)==="epoch_reset"){hs();break}if(pT(vs,He),vs.length>0){const pt=q2(vs);we(At=>At==="waiting"||At==="idle"&&pt?"streaming":At)}const Ss=dT(ee.current,ce.current,Dt.sessionId,ze,F,we,B);let $n=!1;if(!Ss&&kn&&(ze.type==="turn_complete"||ze.type==="turn_error")){Si(),$n=!0,hr(B);const pt=ze.type==="turn_complete"?((Vn=ze.data)==null?void 0:Vn.stopReason)??"end_turn":"error";F.dispatch($c(ze,pt)),yr()||we("idle")}const _t=!yr()&&F.getSnapshot().activeAssistantBlockId!=null?vs.filter(pt=>pt.type!=="debug"):vs;F.dispatch(_t);for(const pt of vs)if(pt.type==="prompt.cancelled"&&(kn||pt.originatorClientId!==Dt.clientId)){F.dispatch($c(ze,"cancelled"));const At=kn;Si(),$n=!0,hr(B),At||ee.current.delete(Dt.sessionId),yr()||we("idle")}else pt.type==="session.replay_complete"&&(Re(At=>({...At,catchingUp:void 0})),F.getSnapshot().awaitingResync&&F.clearAwaitingResync(),yr()||(hr(B),F.dispatch({type:"assistant.done",reason:"replay_complete"}),we("idle")));const lt=!Ss&&!$n&&!yr();if(lt&&(vs.some(At=>At.type==="user.text.delta")?we("waiting"):q2(vs)&&we(At=>At==="idle"?"streaming":At)),lt&&ze.type==="turn_complete"){hr(B);const pt=((Te=ze.data)==null?void 0:Te.stopReason)??"end_turn";F.dispatch($c(ze,pt)),we("idle")}else lt&&ze.type==="turn_error"?(hr(B),F.dispatch($c(ze,"error")),we("idle")):lt&&q2(vs)&&dK(F,B,"passive_observer",3e3,()=>we("idle"));if(ze.type==="state_resync_required"&&(typeof ze.data=="object"&&ze.data!==null?ze.data.reason:void 0)!=="epoch_reset"){yr()||(we("idle"),hr(B)),F.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",Dt.sessionId),ds=!0,oe=void 0,j.current=void 0,Ht.current=()=>!1,Re(At=>({...At,status:"connecting",error:void 0,errorStatus:qa(void 0,At.errorStatus)}));break}if(ze.type==="session_closed"&&((mt=ze.data)==null?void 0:mt.reason)==="client_close"){dt=!0;const pt=Dt.sessionId,At=ee.current.get(pt);At==null||At.controller.abort(),ee.current.delete(pt),oe=void 0,j.current=void 0;break}}catch(Wn){const In=Wn instanceof Error?Wn.message:String(Wn);ln({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:In,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",Wn)}}if(dt){F.dispatch({type:"assistant.done",reason:"cancelled"}),we("idle"),hr(B),Re(ze=>({...ze,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(X.current){oe=void 0,j.current=void 0,Ht.current=()=>!1;return}!Cn&&!Mt.signal.aborted&&!ds&&(((Xt=j.current)==null?void 0:Xt.sessionId)===Dt.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),yr()||(hr(B),we("idle"),F.dispatch({type:"assistant.done",reason:"stream_ended"}))),Re(ze=>({...ze,status:ze.status==="error"?"error":"disconnected",error:ze.status==="error"?ze.error:void 0,errorStatus:qa(void 0,ze.errorStatus)})))}catch(pn){if(Cn||Mt.signal.aborted)return;const An=pn instanceof Error?pn.message:String(pn),un=cb(pn),rs=oe==null?void 0:oe.sessionId,Ys=rY(pn),Bs=sY(pn);if(rs&&(Ys||Bs)){const Ps=ee.current.get(rs);Ps==null||Ps.controller.abort(),ee.current.delete(rs)}(Ys||Bs||!wt())&&(hr(B),we("idle"));const Dt=$.current;if(Dt&&(Dt.sessionId===ct||Dt.sessionId===se)&&(ae.current===Dt.sessionId&&(ae.current=void 0),$.current=void 0,clearTimeout(Dt.timeout),Dt.reject(pn)),Ys||Bs){if(oe=void 0,j.current=void 0,Ys){Re(kn=>({...kn,status:"error",sessionId:void 0,error:An,errorStatus:qa(un,kn.errorStatus),missingSession:!1,capabilities:_e??kn.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const Ps=Ft&&N0(un);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",rs,un,An),Re(kn=>({...kn,status:"disconnected",sessionId:void 0,error:An,errorStatus:qa(un,kn.errorStatus),missingSession:Ps||kn.missingSession===!0,capabilities:_e??kn.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",oe==null?void 0:oe.sessionId);if(!f){oe=void 0,j.current=void 0,Re(Ps=>({...Ps,status:"error",error:An,errorStatus:qa(un,Ps.errorStatus),missingSession:!1}));return}Re(Ps=>({...Ps,status:"disconnected",error:An,errorStatus:qa(un,Ps.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!f){j.current=void 0,Re(pn=>({...pn,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}Le+=1;const on=ie.current,Ks=cK(Le,on.reconnectDelayMs,on.maxReconnectDelayMs);Re(pn=>({...pn,status:"disconnected",error:`Reconnecting in ${Ks}ms`})),await uK(Ks,Mt.signal)}})(),()=>{const Ln=j.current;Cn=!0,Mt.abort(),Ht.current=()=>!1,we("idle"),hr(B);const Xn=(Ln==null?void 0:Ln.sessionId)===ae.current,Nn=!Yn.current;$.current&&(!Xn||Nn)&&(clearTimeout($.current.timeout),$.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),$.current=void 0),(!Xn||Nn)&&(Ln!=null&&Ln.clientId)&&iT({baseUrl:_,token:E,sessionId:Ln.sessionId,clientId:Ln.clientId}).catch(_n=>console.warn("[DaemonSessionProvider] detach failed:",_n)),(!Xn||Nn)&&(j.current=void 0)}},[h,f,_,E,s,le,Se,a,F,ct,ut,tt,Ye,st,i,I,Qt,ln]),g.useEffect(()=>{if(!C.current||ue.status!=="connected"||y<=0||w<=0||!ue.sessionId)return;z.current.sessionId!==ue.sessionId&&(z.current={sessionId:ue.sessionId,consecutiveFailures:0});const Mt=z.current;let Cn=!1;const rn=setInterval(()=>{const Ln=j.current;Ln&&Ln.heartbeat().then(()=>{Cn||(Mt.consecutiveFailures>=w&&Re(Xn=>Xn.sessionId===Ln.sessionId?{...Xn,status:"connected",error:void 0,errorStatus:void 0}:Xn),Mt.consecutiveFailures=0,Mt.lastHttpError=void 0)}).catch(Xn=>{var Nn,_n,Os,ks,Kt;if(Cn)return;Mt.consecutiveFailures+=1;const Vn=Xn instanceof Error?Xn.message:"Session heartbeat failed",Te=cb(Xn);if(Te!==void 0){const _e=(Nn=Mt.lastHttpError)==null?void 0:Nn.status;Mt.lastHttpError={status:qa(Te,_e)??Te,message:N0(_e)?((_n=Mt.lastHttpError)==null?void 0:_n.message)??Vn:Vn}}if(Mt.consecutiveFailures<w)return;const mt=(Os=Mt.lastHttpError)==null?void 0:Os.status,Xt=((ks=Mt.lastHttpError)==null?void 0:ks.message)??Vn,mn=mt!==void 0&&gS.has(mt),oe=N0(mt);if(mn||oe){const _e=Ln.sessionId;console.warn(oe?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",_e,mt);const se=ee.current.get(_e);se==null||se.controller.abort(),ee.current.delete(_e),hr(B),we("idle"),((Kt=j.current)==null?void 0:Kt.sessionId)===_e&&(oe&&(X.current=!0),j.current=void 0)}Re(_e=>_e.sessionId===Ln.sessionId?{..._e,status:mn?"error":"disconnected",error:Xt,errorStatus:qa(mt,_e.errorStatus),missingSession:oe,...mn||oe?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:_e)})},y);return()=>{Cn=!0,clearInterval(rn)}},[ue.sessionId,ue.status,w,y]);const Wt=g.useMemo(()=>pK({store:F,sessionRef:j,activePromptsRef:ee,settledPromptsRef:ce,pendingSessionLoadRef:$,pendingSessionLoadIdRef:J,heartbeatSupportedRef:C,manualSessionClearRef:X,skipNextCleanupDetachSessionIdRef:ae,passiveAssistantDoneTimerRef:B,hasSessionActivePrompt:()=>Ht.current(),resetCurrentSessionActivePrompt:()=>{Ht.current=()=>!1},getCreateSessionRequest:()=>{var Mt;return{...$e.current,sessionScope:"thread",workspaceCwd:U.current??((Mt=j.current)==null?void 0:Mt.workspaceCwd)}},createDetachedSession:()=>{var Mt;const Cn=M.current??new B_({baseUrl:_,token:E}),rn={...$e.current,sessionScope:"thread",workspaceCwd:U.current??((Mt=j.current)==null?void 0:Mt.workspaceCwd)},Ln=i?q.current:B2(void 0);return jm.createOrAttach(Cn,rn,Ln)},getConnection:()=>rt.current,addNotice:ln,setConnection:Re,setPromptStatus:we,setRestoreSessionId:ht,setRestoreMode:ft,setRestoreSessionNonce:qt,setAttachSessionNonce:ge,setNewSessionNonce:ne}),[ln,i,_,E,F]),ss=g.useRef(VK);return g.useEffect(()=>{if(ss.current===r)return;ss.current=r;const Mt=rt.current.sessionId;if(r===Mt)return;const Cn=r?Wt.loadSession(r):Mt?Wt.clearSession():void 0;Cn&&Cn.catch(rn=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",rn)})},[Wt,r]),u.jsx(ML.Provider,{value:F,children:u.jsx(NL.Provider,{value:ue,children:u.jsx(IL.Provider,{value:Ae,children:u.jsx(jL.Provider,{value:ve,children:u.jsx(RL.Provider,{value:Be,children:u.jsx(pS.Provider,{value:Wt,children:v})})})})})})}function dT(e,t,n,s,r,i,o,a={}){var l;if(s.type!=="turn_complete"&&s.type!=="turn_error")return!1;const c=(l=s.data)==null?void 0:l.promptId;if(!c)return!1;const d=e.get(n);if(!d||a.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==c)return!1;hr(o);try{const h=eS(s,c);if(!h)return!1;r.dispatch($c(s,h.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(h)):(e.delete(n),t.set(U_(n,c),{status:"resolved",result:h}))}catch(h){r.dispatch($c(s,"error")),i("idle"),d.reject?(e.delete(n),d.reject(h)):(e.delete(n),t.set(U_(n,c),{status:"rejected",error:h}))}return!0}function WK(e){return e.type==="turn_complete"}function hT(e,t,n,s,r={}){GK(e),r.updateConnection!==!1&&sK(e,s);const i=TW(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=eY(e);return WK(e)?o?[o]:[]:o?[...i,o]:i}function GK(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",KK(e))}function KK(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!ka(e.data))return t.payload="non-object",t;const n=YK(e.data.env),s=I0(e.data.changedKeys),r=I0(e.data.sessionsRefreshed),i=I0(e.data.sessionsSkipped),o=e.data.childReloaded,a=yu(e.data,"childError");return n&&(t.env=n),s&&(t.changedKeys=s),typeof o=="boolean"&&(t.childReloaded=o),r&&(t.sessionsRefreshed=r),i&&(t.sessionsSkipped=i),a&&(t.childError=a),t}function YK(e){if(ka(e))return{updatedKeys:I0(e.updatedKeys)??[],removedKeys:I0(e.removedKeys)??[]}}function I0(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function fT(e,t,n){const s=[];for(const r of t){if(r.type!=="error"){s.push(r);continue}if(e.type==="turn_error"){s.push(r);continue}const i=n(QK(e,r));(i.category==="protocol"||i.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",i)}return s}function QK(e,t){const n={message:t.text,debugMessage:t.text,recoverable:t.recoverable};switch(e.type){case"model_switch_failed":return{...n,severity:"error",category:"user_action",operation:"switch_model",code:"daemon.switch_model.failed"};case"session_died":return{...n,severity:"error",category:"connection",operation:"stream",code:t.errorKind??"daemon.session_died"};case"client_evicted":return{...n,severity:"warning",category:"connection",operation:"stream",code:"daemon.client_evicted"};case"stream_error":return{...n,severity:"warning",category:"connection",operation:"stream",code:t.errorKind??"daemon.stream_error"};default:return{...n,severity:"warning",category:"protocol",operation:"normalize_event",code:t.code??"daemon.protocol.error"}}}function yS(){const e=g.useContext(ML);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function Qp(){const e=yS(),t=g.useCallback(()=>e.getSnapshot().blocks,[e]);return g.useSyncExternalStore(e.subscribe,t,t)}function Iv(){const e=Qp(),t=JK();return g.useMemo(()=>CK(e,t),[e,t])}function Xp(){const e=g.useContext(pS);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function XK(){return g.useContext(pS)}function oh(){return g.useContext(RL)}function JK(){const e=g.useContext(IL);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function ha(){const e=g.useContext(NL);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function ZK(){const e=g.useContext(jL);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function q2(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function eY(e){if(e.type!=="session_update")return null;const t=ka(e.data)?e.data:void 0,n=ka(t==null?void 0:t.update)?t.update:ka(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const s=n._meta;if(!ka(s))return null;const r=tY(s.goalStatus);if(r)return mT(e,r);const i=nY(s.goalTerminal);if(i)return mT(e,i);const o=s.stopHookLoop;if(!ka(o))return null;const a=o.goal;return!ka(a)||!yu(a,"condition"),null}function mT(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function tY(e){if(!ka(e))return null;const t=yu(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=yu(e,"condition");if(!n)return null;const s=j0(e,"iterations"),r=j0(e,"durationMs"),i=j0(e,"setAt"),o=yu(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function nY(e){if(!ka(e))return null;const t=yu(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=yu(e,"condition");if(!n)return null;const s=j0(e,"iterations"),r=j0(e,"durationMs"),i=yu(e,"lastReason");return{kind:t,condition:n,...s!==void 0?{iterations:s}:{},...r!==void 0?{durationMs:r}:{},...i?{lastReason:i}:{}}}function yu(e,t){const n=e[t];return typeof n=="string"?n:void 0}function j0(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function pT(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,l,c=0,d=0;for(const h of e)switch(h.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":s+=1;break;case"workspace.tool.toggled":r+=1;break;case"workspace.settings.changed":i+=1;break;case"workspace.mcp.budget_warning":case"workspace.mcp.child_refused":case"workspace.mcp.server_restarted":case"workspace.mcp.server_restart_refused":o+=1;break;case"workspace.extensions.changed":a+=1,l={...h.status?{status:h.status}:{},...h.source?{source:h.source}:{},...h.name?{name:h.name}:{},...h.version?{version:h.version}:{},...h.error?{error:h.error}:{},refreshed:h.refreshed,failed:h.failed};break;case"workspace.initialized":c+=1;break;case"auth.device_flow.started":case"auth.device_flow.throttled":case"auth.device_flow.authorized":case"auth.device_flow.failed":case"auth.device_flow.cancelled":d+=1;break}n+s+r+i+o+a+c+d!==0&&t(h=>({memoryVersion:h.memoryVersion+n,agentsVersion:h.agentsVersion+s,toolsVersion:h.toolsVersion+r,settingsVersion:h.settingsVersion+i,mcpVersion:h.mcpVersion+o,extensionsVersion:h.extensionsVersion+a,...l?{lastExtensionChange:l}:{},initVersion:h.initVersion+c,authVersion:h.authVersion+d}))}function sY(e){const t=cb(e);return t!==void 0&&qK.has(t)}function rY(e){const t=cb(e);return t!==void 0&&gS.has(t)}function cb(e){if(e instanceof Fd||ka(e)&&typeof e.status=="number")return e.status}function ka(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zu(e,t){const{autoLoad:n=!1,enabled:s=!0}=t,[r,i]=g.useState({data:void 0,loading:!1,error:void 0}),o=g.useRef(0),a=g.useCallback(async()=>{if(!s)return;const l=++o.current;i(c=>({...c,loading:!0,error:void 0}));try{const c=await e();return l!==o.current?void 0:(i({data:c,loading:!1,error:void 0}),c)}catch(c){if(l!==o.current)return;const d=c instanceof Error?c:new Error(String(c));i(h=>({...h,loading:!1,error:d}));return}},[s,e]);return g.useEffect(()=>{!n||!s||a()},[n,s,a]),{...r,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Jp(e,t,n){const s=g.useRef(!1);g.useEffect(()=>{if(!(e===void 0||!n)){if(!s.current){s.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function iY(e={}){var t;const n=da(),s=g.useCallback(()=>n.listAgents(),[n]),r=zu(s,e),i=oh();return Jp(i==null?void 0:i.agentsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,agents:((t=r.data)==null?void 0:t.agents)??[],getAgent:n.getAgent,createAgent:n.createAgent,generateAgent:n.generateAgent,deleteAgent:n.deleteAgent,updateAgent:n.updateAgent}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function DL(e={}){const t=da(),n=g.useCallback(()=>t.loadMcpStatus(),[t]),s=zu(n,e),r=oh();return Jp(r==null?void 0:r.mcpVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,loadTools:t.loadMcpTools,loadResources:t.loadMcpResources,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function oY(e={}){var t;const n=da(),s=g.useCallback(()=>n.loadMemoryStatus(),[n]),r=zu(s,e),i=oh();return Jp(i==null?void 0:i.memoryVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,files:((t=r.data)==null?void 0:t.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function qd(e={}){const{pageSize:t,cursor:n,archiveState:s,view:r,group:i,...o}=e,a=mS(),l=XK(),c=g.useCallback(()=>{const E={...t!==void 0?{pageSize:t}:{},...n!==void 0?{cursor:n}:{},...s!==void 0?{archiveState:s}:{},...r!==void 0?{view:r}:{},...i!==void 0?{group:i}:{}};return a.actions.listSessionsPage(E)},[s,n,i,t,r,a.actions]),d=!!a.workspaceCwd,h=zu(c,{...o,enabled:(o.enabled??!0)&&d}),f=h.reload,m=g.useCallback(async()=>{const E=await f();return E==null?void 0:E.sessions},[f]),p=h.data,y=(p==null?void 0:p.sessions)??[],w=g.useCallback(async E=>{const k=await a.actions.deleteSession(E);return k&&m(),k},[a.actions,m]),b=g.useCallback(async E=>{const k=await a.actions.deleteSessions(E);return(k.removed.length>0||k.notFound.length>0)&&m(),k},[a.actions,m]),v=g.useCallback((E,k="html")=>a.actions.exportSession(E,k),[a.actions]),x=g.useCallback(async E=>{const k=await a.actions.archiveSession(E);return k&&m(),k},[a.actions,m]),_=g.useCallback(async E=>{const k=await a.actions.unarchiveSession(E);return k&&m(),k},[a.actions,m]);return{...h,data:p!==void 0?y:void 0,reload:m,sessions:y,nextCursor:p==null?void 0:p.nextCursor,liveMergeFailed:(p==null?void 0:p.liveMergeFailed)===!0,truncated:(p==null?void 0:p.truncated)===!0,loadSession:l==null?void 0:l.loadSession,resumeSession:l==null?void 0:l.resumeSession,newSession:l==null?void 0:l.newSession,releaseSession:l==null?void 0:l.releaseSession,deleteSession:w,deleteSessions:b,exportSession:v,archiveSession:x,unarchiveSession:_}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Y_(e={}){const{detail:t="summary",...n}=e,s=da(),r=g.useCallback(()=>s.loadDaemonStatus(t),[s,t]),i=zu(r,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function aY(e={}){const{range:t,heatmapDays:n,...s}=e,r=da(),i=g.useCallback(()=>r.loadUsageDashboard({range:t,heatmapDays:n}),[r,t,n]),o=zu(i,s);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function OL(e={}){var t;const n=da(),s=g.useCallback(()=>n.loadToolsStatus(),[n]),r=zu(s,e),i=oh();return Jp(i==null?void 0:i.toolsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,tools:((t=r.data)==null?void 0:t.tools)??[],setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function lY(e={}){var t;const n=da(),s=g.useCallback(()=>n.loadSettingsStatus(),[n]),r=zu(s,e),i=oh();return Jp(i==null?void 0:i.settingsVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,settings:((t=r.data)==null?void 0:t.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const cY=300,uY=100,Dh=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function H2(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function dY(e){const{enabled:t=!0,onStateChange:n,getOnAccept:s,getOnOutcome:r}=e;let i=Dh,o=null,a=!1,l=null;function c(w){i=w,n(w)}function d(){o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:w=>{if(o&&(clearTimeout(o),o=null),!w){c(Dh);return}t&&(o=setTimeout(()=>{c({suggestion:w,isVisible:!0,shownAt:Date.now()})},cY))},accept:(w,b)=>{var v;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const x=i.suggestion,{shownAt:_}=i;if(!x){a=!1;return}try{(v=r())==null||v({outcome:"accepted",accept_method:w,time_ms:_>0?Date.now()-_:0,suggestion_length:x.length})}catch(E){console.error("[followup] onOutcome callback threw:",E)}c(Dh),queueMicrotask(()=>{var E;try{b!=null&&b.skipOnAccept||(E=s())==null||E(x)}catch(k){console.error("[followup] onAccept callback threw:",k)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},uY)}})},dismiss:()=>{var w;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(w=r())==null||w({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(b){console.error("[followup] onOutcome callback threw:",b)}c(Dh)}},clear:()=>{d(),a=!1,c(Dh)},cleanup:()=>{d(),a=!1}}}function hY(e={}){const{enabled:t=!0,onAccept:n,onOutcome:s}=e,r=yS(),i=ha().sessionId,[o,a]=g.useState(Dh),l=g.useRef(n);l.current=n;const c=g.useRef(s);c.current=s;const d=g.useSyncExternalStore(r.subscribe,()=>r.getSnapshot().lastFollowupSuggestion,()=>r.getSnapshot().lastFollowupSuggestion),h=g.useSyncExternalStore(AK,lT,lT),f=(h==null?void 0:h.sessionId)===i?h:d,m=g.useMemo(()=>dY({enabled:t,onStateChange:a,getOnAccept:()=>l.current,getOnOutcome:()=>c.current}),[t]),{setSuggestion:p}=m;g.useEffect(()=>(t||m.clear(),()=>m.cleanup()),[m,t]);const y=g.useRef(void 0),w=g.useRef(i);g.useEffect(()=>{const _=w.current;w.current=i,_!==void 0&&i!==void 0&&_!==i&&(m.clear(),Yg(),y.current=void 0)},[m,i]),g.useEffect(()=>{const _=f==null?void 0:f.promptId;_!==y.current&&(y.current=_,p((f==null?void 0:f.suggestion)??null))},[f,p]);const b=g.useCallback(()=>{m.clear(),H2(r),Yg(),y.current=void 0},[m,r]),v=g.useCallback((_,E)=>{m.accept(_,E),H2(r),Yg(),y.current=void 0},[m,r]),x=g.useCallback(()=>{m.dismiss(),H2(r),Yg(),y.current=void 0},[m,r]);return g.useMemo(()=>({followupState:o,onAcceptFollowup:v,onDismissFollowup:x,clear:b}),[o,v,x,b])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function fY(){const e=g.useSyncExternalStore(NK,cT,cT),t=g.useCallback(n=>jK(n),[]);return{batches:e,consume:t}}function BL(e){for(const t of e){if(!mY(t))continue;const n=t;if(n.resolved)continue;const s=Xh(n.toolCall),r=typeof(s==null?void 0:s.toolCallId)=="string"?s.toolCallId:typeof(s==null?void 0:s.id)=="string"?s.id:void 0,i=typeof(s==null?void 0:s.kind)=="string"?s.kind:void 0,o=Xh(s==null?void 0:s._meta),a=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:r,title:n.title,toolKind:i,toolName:a,content:[{type:"text",text:n.title||"Tool permission"}],options:n.options.map(l=>({id:l.optionId,label:l.label,kind:gY(l.raw)})),rawInput:pY(n.toolCall)}}return null}function mY(e){return e.kind==="permission"}function pY(e){const t=Xh(e);return t?Xh(t.rawInput)??Xh(t.input)??Xh(t.args)??t:void 0}function Xh(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function gY(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.kind;return t==="allow_once"||t==="allow_always"||t==="reject_once"||t==="reject_always"?t:void 0}function yY(e,t,n){const s=new Array(e);return new Proxy(s,{get(r,i,o){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const l=+i;if(Number.isInteger(l)&&l>=0&&l<e){let c=r[l];if(!c){const d=t[l*2];c=r[l]={index:l,key:n(l),start:d,size:t[l*2+1],end:d+t[l*2+1],lane:0}}return c}}if(i==="length")return e}return Reflect.get(r,i,o)}})}function Sh(e,t,n){let s=n.initialDeps??[],r,i=!0;function o(){const a=e();return(a.length!==s.length||a.some((c,d)=>s[d]!==c))&&(s=a,r=t(...a),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(r),i=!1),r}return o.updateDeps=a=>{s=a},o}function gT(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const bY=(e,t)=>Math.abs(e-t)<1.01,vY=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};let Om;const U2=()=>{if(Om!==void 0)return Om;if(typeof navigator>"u")return Om=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Om=!0;const e=navigator.maxTouchPoints;return Om=navigator.platform==="MacIntel"&&e!==void 0&&e>0},yT=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},wY=e=>e,xY=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=new Array(s);for(let i=0;i<s;i++)r[i]=t+i;return r},_Y=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(r(yT(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){r({width:c.inlineSize,height:c.blockSize});return}}r(yT(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},ub={passive:!0},kY=typeof window>"u"?!0:"onscrollend"in window,SY=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const r=e.targetWindow;if(!r)return;const i=e.options.useScrollendEvent&&kY;let o=0;const a=i?null:vY(r,()=>t(o,!1),e.options.isScrollingResetDelay),l=h=>()=>{o=n(s),a==null||a(),t(o,h)},c=l(!0),d=l(!1);return s.addEventListener("scroll",c,ub),i&&s.addEventListener("scrollend",d,ub),()=>{s.removeEventListener("scroll",c),i&&s.removeEventListener("scrollend",d)}},TY=(e,t)=>SY(e,t,n=>{const{horizontal:s,isRtl:r}=e.options;return s?n.scrollLeft*(r&&-1||1):n.scrollTop}),CY=(e,t,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(e),r=n.options.getItemKey(s);return n.itemSizeCache.get(r)??n.options.estimateSize(s)}if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const s=n.indexFromElement(e),r=n.options.getItemKey(s),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},AY=(e,{adjustments:t=0,behavior:n},s)=>{var r,i;(i=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||i.call(r,{[s.options.horizontal?"left":"top"]:e+t,behavior:n})},EY=AY;class MY{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,r;return((r=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:r.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const o=()=>{const a=i.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,d]of this.elementsCache)if(d===a){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(a,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var i;return(i=s())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=s())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{var s,r;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:wY,rangeExtractor:xY,onChange:()=>{},measureElement:CY,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const f in n){const m=n[f];m!==void 0&&(i[f]=m)}const o=this.options;let a=null,l=null,c=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const f=o.count,m=i.count,p=this.getMeasurements(),y=f>0?((s=p[0])==null?void 0:s.key)??o.getItemKey(0):null,w=f>0?((r=p[f-1])==null?void 0:r.key)??o.getItemKey(f-1):null;if(m!==f||f>0&&m>0&&(i.getItemKey(0)!==y||i.getItemKey(m-1)!==w)){c=!0;const x=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.start]);const _=i.followOnAppend===!0?"auto":i.followOnAppend||null;_&&m>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||i.getItemKey(m-1)!==w)&&(l=_)}}this.options=i,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,h=0;if(a&&this.scrollOffset!==null){const[f,m]=a,p=this.getMeasurements(),{count:y,getItemKey:w}=this.options;let b=0;for(;b<y&&w(b)!==f;)b++;if(b<y){const v=p[b];if(v){const x=v.start+m;x!==this.scrollOffset&&(h=x-this.scrollOffset,this.scrollOffset=x,d=!0)}}}(d||l)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,l,h])},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Sh(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!U2()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,ub),i.addEventListener("touchend",a,ub),this.unsubs.push(()=>{i.removeEventListener("touchstart",o),i.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const r=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,r&&this.scrollElement&&this.options.enabled){const[i,o,a,l]=r;i!==null&&!a&&(U2()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const r=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=r,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,i=new Map;for(let o=s-1;o>=0;o--){const a=n[o];if(r.has(a.lane))continue;const l=i.get(a.lane);if(l==null||a.end>l.end?i.set(a.lane,a):a.end<l.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=Sh(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,r,i,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Sh(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{const d=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const p of this.laneAssignments.keys())p>=n&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const p=this.options.gap,y=n*2;let w=this._flatMeasurements;if(!w||w.length<y){const x=new Float64Array(y);w&&h>0&&x.set(w.subarray(0,h*2)),w=x,this._flatMeasurements=w}let b;if(h===0)b=s+r;else{const x=h-1;b=w[x*2]+w[x*2+1]+p}for(let x=h;x<n;x++){const _=i(x),E=d.get(_),k=typeof E=="number"?E:this.options.estimateSize(x);w[x*2]=b,w[x*2+1]=k,b+=k+p}const v=yY(n,w,i);return this.measurementsCache=v,v}const f=this.measurementsCache.slice(0,h),m=new Array(a).fill(void 0);for(let p=0;p<h;p++){const y=f[p];y&&(m[y.lane]=p)}for(let p=h;p<n;p++){const y=i(p),w=this.laneAssignments.get(p);let b,v;const x=l==="estimate"||d.has(y);if(w!==void 0&&this.options.lanes>1){b=w;const M=m[b],R=M!==void 0?f[M]:void 0;v=R?R.end+this.options.gap:s+r}else{const M=this.options.lanes===1?f[p-1]:this.getFurthestMeasurement(f,p);v=M?M.end+this.options.gap:s+r,b=M?M.lane:p%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(p,b)}const _=d.get(y),E=typeof _=="number"?_:this.options.estimateSize(p),k=v+E;f[p]={index:p,start:v,size:E,end:k,key:y,lane:b},m[b]=p}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Sh(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?NY({measurements:n,outerSize:s,scrollOffset:r,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Sh(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(r!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,r-i),a=Math.min(this.options.count-1,r+i);return n>=o&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((o,a)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(a))});return}const s=this.indexFromElement(n),r=this.options.getItemKey(s),i=this.elementsCache.get(r);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(r,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var r,i;if(n<0||n>=this.options.count)return;let o,a,l;const c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),a=c[n*2],o=c[n*2+1];else{const f=this.measurementsCache[n];if(!f)return;l=f.key,a=f.start,o=f.size}const d=this.itemSizeCache.get(l)??o,h=s-d;if(h!==0){const f=this.options.anchorTo==="end"&&((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=f?this.getTotalSize():0,p=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:a,size:o,end:a+o,lane:0},h,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,s),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-m):p&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=Sh(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],l=s[a];r.push(l)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const r=this._flatMeasurements,i=this.options.lanes===1&&r!=null,o=PL(0,s.length-1,i?a=>r[a*2]:a=>gT(s[a]).start,n);return gT(s[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,r=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=n>=o+i?"end":"start"),s==="center"?n+=(r-i)/2:s==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(s==="auto")if(o.end>=i+r-this.options.scrollPaddingEnd)s="end";else if(o.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const a=s==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,o.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:r="auto"}={})=>{const i=this.getOffsetForAlignment(n,s),o=this.now();this.scrollState={index:null,align:s,behavior:r,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:r="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,s);if(!i)return;const[o,a]=i,l=this.now();this.scrollState={index:n,align:a,behavior:r,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const r=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,o=this._flatMeasurements;o!=null?r=o[i*2]+o[i*2+1]:r=((n=s[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&i.some(a=>a===null);){const a=s[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}r=Math.max(...i.filter(a=>a!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const r of s)r&&this.itemSizeCache.has(r.key)&&n.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(U2()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,r=s?s[0]:this.scrollState.lastTargetOffset,i=1,o=r!==this.scrollState.lastTargetOffset;if(!o&&bY(r,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==r&&this._scrollToOffset(r,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(r-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=r,c||(this.scrollState.behavior="auto"),this._scrollToOffset(r,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const PL=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,i=n(r);if(i<s)e=r+1;else if(i>s)t=r-1;else return r}return e>0?e-1:0};function NY({measurements:e,outerSize:t,scrollOffset:n,lanes:s,flat:r}){const i=e.length-1,o=r?d=>r[d*2]:d=>e[d].start,a=r?d=>r[d*2]+r[d*2+1]:d=>e[d].end;if(e.length<=s)return{startIndex:0,endIndex:i};let l=PL(0,i,o,n),c=l;if(s===1)for(;c<i&&a(c)<n+t;)c++;else if(s>1){const d=Array(s).fill(0);for(;c<i&&d.some(f=>f<n+t);){const f=e[c];d[f.lane]=f.end,c++}const h=Array(s).fill(n+t);for(;l>=0&&h.some(f=>f>=n);){const f=e[l];h[f.lane]=f.start,l--}l=Math.max(0,l-l%s),c=Math.min(i,c+(s-1-c%s))}return{startIndex:l,endIndex:c}}const V2=typeof document<"u"?g.useLayoutEffect:g.useEffect;function IY({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...s}){const r=g.useReducer(c=>c+1,0)[1],i=g.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=c=>{const d=i.current;if(!d.enabled)return;const h=c.getTotalSize();if(d.container&&h!==d.lastSize){d.lastSize=h;const b=c.options.horizontal?"width":"height";d.container.style[b]=`${h}px`}const f=!!c.options.horizontal,m=d.mode==="transform",p=f?"left":"top",y=c.options.scrollMargin,w=c.getVirtualItems();for(const b of w){const v=b.start-y,x=c.elementsCache.get(b.key);x&&d.lastPositions.get(x)!==v&&(d.lastPositions.set(x,v),m?x.style.transform=f?`translate3d(${v}px, 0, 0)`:`translate3d(0, ${v}px, 0)`:x.style[p]=`${v}px`)}},a={...s,onChange:(c,d)=>{var h;const f=i.current;let m=!0;if(f.enabled){o(c);const p=c.range,y=f.prevRange;m=!y||y.isScrolling!==c.isScrolling||y.startIndex!==(p==null?void 0:p.startIndex)||y.endIndex!==(p==null?void 0:p.endIndex),m&&(f.prevRange=p?{startIndex:p.startIndex,endIndex:p.endIndex,isScrolling:c.isScrolling}:null)}m&&(e&&d?Op.flushSync(r):r()),(h=s.onChange)==null||h.call(s,c,d)}},[l]=g.useState(()=>{const c=new MY(a);return Object.assign(c,{containerRef:d=>{const h=i.current;if(h.container=d,h.lastSize=null,d&&h.enabled){const f=c.getTotalSize();h.lastSize=f;const m=c.options.horizontal?"width":"height";d.style[m]=`${f}px`}}})});return l.setOptions(a),V2(()=>l._didMount(),[]),V2(()=>l._willUpdate()),V2(()=>{o(l)}),l}function jY(e){return IY({observeElementRect:_Y,observeElementOffset:TY,scrollToFn:EY,...e})}function $L(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function RY(e){var t;return((t=$L(e))==null?void 0:t.type)==="task_execution"}function jv(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||RY(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function zL(e){var n;if(!jv(e))return!1;const t=$L(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const FL=g.createContext({}),bT=FL.Provider;function vl(){return g.useContext(FL)}const LY=["en","zh-CN"],bS={"about.auth":"Auth","about.baseUrl":"Base URL","about.fastModel":"Fast Model","about.memoryUsage":"Memory Usage","about.model":"Model","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"OS","about.proxy":"Proxy","about.qwenCode":"Qwen Code","about.runtime":"Runtime","about.sandbox":"Sandbox","about.sessionId":"Session ID","about.title":"Status","agent.back":"Back","agent.builtInBadge":"(built-in)","agent.action.delete":"Delete Agent","agent.action.edit":"Edit Agent","agent.action.view":"View Agent","agent.chooseAction":e=>`Choose action for ${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"Choose Action","agent.colorLabel":"Color: ","agent.colorUpdated":e=>`Updated color for ${(e==null?void 0:e.name)??""}`,"agent.create":"Create a new subagent","agent.create.button":"Create Agent","agent.create.confirm":"Confirm and Save","agent.create.desc":"Create a new subagent","agent.create.descPlaceholder":"What does this agent do?","agent.create.describeAgent":"Describe Your Subagent","agent.create.description":"Description","agent.create.editAgain":"Edit","agent.create.enterDescription":"Enter Description","agent.create.enterName":"Enter Subagent Name","agent.create.enterPrompt":"Enter System Prompt","agent.create.generateFailed":e=>`Failed to generate subagent: ${(e==null?void 0:e.error)??"Unknown error"}`,"agent.create.generatingConfig":"Generating subagent configuration...","agent.create.loading":"Creating...","agent.create.location":"Choose Location","agent.create.method":"Choose Generation Method","agent.create.method.manual":"Manual Creation","agent.create.method.qwen":"Generate with Qwen Code","agent.create.method.qwen.recommended":"Generate with Qwen Code (Recommended)","agent.create.method.qwen.desc":"LLM generates name, prompt, and description","agent.create.name":"Name","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"Enter a clear, unique name for this subagent.","agent.create.project":"Project","agent.create.project.cli":"Project-level (.qwen/agents/)","agent.create.project.desc":"Create a project-level subagent","agent.create.prompt":"System prompt","agent.create.promptPlaceholder":"You are a specialized agent that...","agent.create.promptPlaceholder.cli":"e.g., You are an expert code reviewer...","agent.create.promptHelp":"Write the system prompt that defines this subagent's behavior. Be comprehensive for best results.","agent.create.preview":"Preview","agent.create.qwenHint":"Describe what this subagent should do and when it should be used. (Be comprehensive for best results)","agent.create.qwenPlaceholder":"> e.g., Expert code reviewer that reviews code based on best practices...","agent.create.required":"Name, description, and system prompt are required.","agent.create.save":"Save Agent","agent.create.scope":"Choose where to save the subagent","agent.create.manualDescHelp":"Describe when and how this subagent should be used.","agent.create.manualDescPlaceholder":"e.g., Reviews code for best practices and potential bugs.","agent.create.toolsSelection":"Select Tools","agent.create.tools.all":"All Tools","agent.create.tools.allDefault":"All Tools (Default)","agent.create.tools.allInfo":"All tools selected, including MCP tools","agent.create.tools.allInfoFallback":"All tools selected, including MCP tools","agent.create.tools.editLabel":"• Edit tools:","agent.create.tools.executionLabel":"• Execution tools:","agent.create.tools.none":"(none)","agent.create.tools.readEdit":"Read & Edit Tools","agent.create.tools.readEditExecute":"Read & Edit & Execution Tools","agent.create.tools.readOnlyLabel":"• Read-only tools:","agent.create.tools.readOnly":"Read-only Tools","agent.create.tools.selected":"Selected tools:","agent.create.user":"User","agent.create.user.cli":"User-level (~/.qwen/agents/)","agent.create.user.desc":"Create a user-level subagent","agent.createFirstHint":"Use '/agents create' to create your first subagent.","agent.created":e=>`Created ${(e==null?void 0:e.name)??""}`,"agent.delete":"Delete","agent.delete.confirm":e=>`Are you sure you want to delete "${(e==null?void 0:e.name)??""}"?`,"agent.delete.loading":"Deleting...","agent.delete.no":"No","agent.delete.title":e=>`Delete ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"Yes, delete","agent.deleted":e=>`Deleted ${(e==null?void 0:e.name)??""}`,"agent.edit":"Edit","agent.edit.color":"Edit Color","agent.edit.tools":"Edit Tools","agent.editColorTitle":e=>`Edit Color: ${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`Edit ${(e==null?void 0:e.name)??""}`,"agent.empty":"No subagents found.","agent.footer.back":"Esc to go back","agent.footer.cliBack":"Enter to select, ↑↓ to navigate, Esc to go back","agent.footer.cliSelect":"Enter to select, ↑↓ to navigate, Esc to close","agent.footer.close":"Esc to close","agent.footer.deleteConfirm":"Enter to confirm, Esc to cancel","agent.footer.enterNext":"Press Enter to continue, Esc to go back","agent.footer.generating":"Esc to cancel","agent.footer.createLocation":"Press Enter to continue, ↑↓ to navigate, Esc to cancel","agent.footer.createContinue":"Press Enter to continue, ↑↓ to navigate, Esc to go back","agent.footer.final":"Press Enter to save, e to save and edit, Esc to go back","agent.footer.nav":"↑↓ navigate · Enter select · Esc back","agent.footer.navBack":"↑↓ navigate · Enter select · Esc back","agent.footer.navSelect":"↑↓ navigate · Enter select · Esc close","agent.footer.viewerBack":"Esc to go back","agent.filePathLabel":"File Path: ","agent.label":"Agent","agent.location":"Location","agent.level.builtin":"Built-in","agent.level.extension":"Extension","agent.level.project":"Project","agent.level.user":"User","agent.manage":"Manage","agent.manage.desc":"Manage existing subagents","agent.modelLabel":"Model: ","agent.overriddenBadge":"(overridden by project level agent)","agent.readonly":"This agent is read-only.","agent.select":"Select an agent.","agent.selectAction":"Select an action","agent.descriptionLabel":"Description:","agent.systemPromptLabel":"System Prompt:","agent.step":e=>`Step ${(e==null?void 0:e.n)??""}`,"agent.tools":"Tools","agent.toolsLabel":"Tools: ","agent.toolsUpdated":e=>`Updated tools for ${(e==null?void 0:e.name)??""}`,"agent.usingCount":e=>`Using: ${(e==null?void 0:e.count)??0} agents`,"agent.view":"View","agents.closed":"Agents panel closed.","agents.title":"Agents","subagent.result":"Result","subagent.tools":e=>`Tools (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"subagent.toggleStream":"Toggle agent stream details","subagent.pending":"pending","subagent.running":"running","timeline.parallelAgents":"Parallel agents","timeline.thinking":"Thinking","timeline.assistantUpdate":"Assistant update","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool call${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.planUpdate":"Plan update","timeline.statusUpdate":"Status update","timeline.userTurn":"User turn","timeline.planDetail":"plan update","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} parallel agent${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.noActivity":"No activity","timeline.sessionTimeline":"Session timeline","timeline.turnPrefix":e=>`Turn ${(e==null?void 0:e.index)??0}`,"timeline.currentTurn":"Current turn","timeline.kind.thought":"thinking","timeline.kind.commentary":"assistant update","timeline.kind.tool":"tool calls","timeline.kind.agents":"parallel agents","timeline.kind.plan":"plan update","timeline.kind.status":"status update","timeline.kind.none":"turn","common.copy":"Copy","common.na":"N/A","common.server":"Server","common.agent":"Agent","common.auto":"auto","common.runtime":"Runtime","common.failedToLoad":"Failed to load","auth.notSet":"(not set)","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"model-id-1, model-id-2","model.usingModel":e=>`Using ${e!=null&&e.isRuntime?"runtime ":""}model: ${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid (error)","user.uploadedImage":e=>`User uploaded image ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"No speech detected.","voice.stopDictation":"Stop dictation","voice.transcribing":"Transcribing…","voice.starting":"Starting…","voice.errorRetry":e=>`Voice error — click to retry${e!=null&&e.message?`: ${e.message}`:""}`,"voice.noSpeechRetry":"No speech detected — click to retry","voice.startDictation":"Start voice dictation","voice.error":"Voice error","resume.failedToLoad":"Failed to load sessions","toast.dismiss":"Dismiss notification","toast.dismissShort":"Dismiss","insight.ready":"Insight report generated successfully!","request.cancelled":"Request cancelled.","approval.execQuestion":e=>`Allow execution of: '${(e==null?void 0:e.tool)??""}'?`,"approval.changeQuestion":"Apply this change?","approval.launchAgentQuestion":"Launch this agent?","approval.option.allowOnce":"Yes, allow once","approval.option.rejectOnce":"Reject","approval.option.allowAllEdits":"Allow All Edits","approval.option.allowAlwaysProject":"Always allow in this project","approval.option.allowAlwaysUser":"Always allow for this user","approval.option.allowAlwaysServer":"Always allow for this server","approval.option.allowAlwaysTool":"Always allow for this tool","assistant.branch":"Branch","assistant.copy":"Copy","at.category.extensions":"Extensions","at.category.extensions.description":"Reference active extensions","at.category.files":"Files","at.category.files.description":"Reference workspace files","at.category.mcpResources":"MCP resources","at.category.mcpResources.description":"Reference MCP server resources","at.menu":"Reference menu","common.back":"back","common.cancel":"cancel","common.close":"close","common.fullscreen":"Fullscreen","common.exitFullscreen":"Exit fullscreen","common.continue":"continue","common.current":"current","common.disabled":"disabled","common.enabled":"enabled","common.enterSelect":"Enter to select","common.invalid":"invalid","common.loading":"Loading...","common.save":"save","common.navigate":"↑↓ to navigate","common.next":"next","common.noResults":"No results","common.previous":"previous","common.refresh":"refresh","common.search":"Search","common.valid":"valid","common.clients":e=>`${(e==null?void 0:e.count)??0} clients`,"agent.count":e=>`${(e==null?void 0:e.count)??0} agents`,"askUser.submit":"Submit","askUser.ignore":"Ignore","askUser.multiHint":"multiple choice","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} questions`,"askUser.selectAnswer":"Select an answer","askUser.typePlaceholder":"Type something...","copy.failedFallback":"Failed to copy to the clipboard","copy.inlineLatexMissing":"No matching inline LaTeX expression found in the last AI output.","copy.latexMissing":"No matching LaTeX block found in the last AI output.","copy.noOutput":"No output in history","copy.noText":"Last AI output contains no text to copy.","copy.codeMissing":"No matching code block found in the last AI output.","copy.outputCopied":"Last output copied to the clipboard","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"Selection"} copied to the clipboard`,"code.copy":"Copy","code.copied":"Copied!","echartsChart.defaultTitle":"Chart Loading","echartsChart.noData":"No data","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows and ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:n>0?`Showing ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows`},"echartsChart.rendering":"Rendering chart","echartsChart.runtimeUnavailable":"Chart runtime is unavailable.","echartsChart.renderFailed":"Chart render failed.","echartsChart.viewMode":"View mode","echartsChart.showChart":"Show chart","echartsChart.showData":"Show data","echartsChart.chart":"Chart","echartsChart.data":"Data","markdownTable.blank":"(blank)","markdownTable.column":e=>`Column ${(e==null?void 0:e.index)??""}`,"markdownTable.rows":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} row${t===1?"":"s"}`},"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} rows`,"markdownTable.hint":"Click headers to sort, open filters from ▾.","markdownTable.filtersActive":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} filter${t===1?"":"s"}`},"markdownTable.cellsSelected":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} cell${t===1?"":"s"} selected`},"markdownTable.copyTsv":"Copy TSV","markdownTable.copyVisible":"Quick copy","markdownTable.freezeFirstColumn":"Freeze first column","markdownTable.unfreezeFirstColumn":"Unfreeze first column","markdownTable.hideColumn":"Hide column","markdownTable.showHiddenColumns":e=>{const t=Number((e==null?void 0:e.count)??0);return`Show ${t} hidden column${t===1?"":"s"}`},"markdownTable.moveColumn":e=>`Move ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`Resize ${(e==null?void 0:e.column)??""}`,"markdownTable.rowDetails":"Details","markdownTable.rowDetailsAria":e=>`View details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.closeRowDetailsAria":e=>`Hide details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.detailsHeader":"Row details","markdownTable.actions":"Actions","markdownTable.sortByColumn":e=>`Sort by ${(e==null?void 0:e.column)??""}`,"markdownTable.sortByColumnAsc":e=>`Sort by ${(e==null?void 0:e.column)??""}, ascending`,"markdownTable.sortByColumnDesc":e=>`Sort by ${(e==null?void 0:e.column)??""}, descending`,"markdownTable.filterColumn":e=>`Filter ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"This table has no data.","markdownTable.emptyFiltered":"No rows match the filters.","markdownTable.sort.asc":"Sort ascending","markdownTable.sort.desc":"Sort descending","markdownTable.sort.clear":"Clear sort","markdownTable.filter.searchPlaceholder":"Search filter values","markdownTable.filter.searchAria":e=>`Search ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"Select current results","markdownTable.filter.optionLimit":e=>`Showing first ${(e==null?void 0:e.count)??0} items. Search to narrow results.`,"markdownTable.filter.noOptions":"No matches","markdownTable.filter.custom":"Custom filter","markdownTable.filter.numberAria":e=>`Number filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`Text filter for ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"Value","markdownTable.filter.toPlaceholder":"To","markdownTable.filter.textPlaceholder":"Enter filter condition","markdownTable.filter.reset":"Reset","markdownTable.filter.cancel":"Cancel","markdownTable.filter.confirm":"Confirm","markdownTable.filter.text.contains":"Contains","markdownTable.filter.text.equals":"Equals","markdownTable.filter.text.notEquals":"Does not equal","markdownTable.filter.text.startsWith":"Starts with","markdownTable.filter.text.endsWith":"Ends with","markdownTable.filter.number.gt":"Greater than","markdownTable.filter.number.gte":"Greater than or equal to","markdownTable.filter.number.lt":"Less than","markdownTable.filter.number.lte":"Less than or equal to","markdownTable.filter.number.between":"Between","mermaid.rendering":"Rendering diagram...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"active","contextUsage.autocompactBuffer":"Autocompact buffer","contextUsage.bodyLoaded":"body loaded","contextUsage.builtinTools":"Built-in tools","contextUsage.contextWindow":"Context window","contextUsage.detailHint":"Run /context detail for per-item breakdown.","contextUsage.estimatedOverhead":"Estimated pre-conversation overhead","contextUsage.free":"Free","contextUsage.memoryFiles":"Memory files","contextUsage.messages":"Messages","contextUsage.mcpTools":"MCP tools","contextUsage.model":"Model","contextUsage.noSession":"No active session yet. Send your first message before viewing context usage.","contextUsage.noApiResponse":"No API response yet. Send a message to see actual usage.","contextUsage.overLimit":"Context exceeds limit! Use /compress or /clear to reduce.","contextUsage.skills":"Skills","contextUsage.systemPrompt":"System prompt","contextUsage.title":"Context Usage","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"Usage by category","contextUsage.used":"Used","daemon.title":"Daemon Status","daemon.details.loading":"Loading diagnostics...","daemon.details.failed":"Failed to load diagnostics.","daemon.refresh":"Refresh","daemon.loading":"Loading daemon status...","daemon.loadFailed":"Failed to load daemon status","daemon.updatedAt":e=>`Updated ${(e==null?void 0:e.time)??""}`,"daemon.none":"none","daemon.level.ok":"OK","daemon.level.warning":"Warning","daemon.level.error":"Error","daemon.level.unavailable":"Unavailable","daemon.issues.title":"Issues","daemon.overview.title":"Daemon","daemon.overview.version":"Version","daemon.overview.pid":"PID","daemon.overview.mode":"Mode","daemon.overview.uptime":"Uptime","daemon.overview.workspace":"Workspace","daemon.runtime.title":"Runtime","daemon.runtime.activeSessions":"Active sessions","daemon.runtime.activePrompts":"Active prompts","daemon.runtime.idle":"Idle for","daemon.runtime.noActivity":"no activity yet","daemon.runtime.pendingPermissions":"Pending permissions","daemon.runtime.permissionPolicy":"Permission policy","daemon.runtime.channel":"ACP channel","daemon.runtime.channelLive":"live","daemon.runtime.channelDown":"down","daemon.runtime.startingUp":"Runtime is starting...","daemon.runtime.startFailed":"Runtime failed to start","daemon.runtime.channelWorker":"Channel worker","daemon.runtime.channelWorkerRestarts":"Worker restarts","daemon.runtime.memory":"Memory (RSS / heap)","daemon.transport.title":"Transport","daemon.transport.restSse":"REST SSE streams","daemon.transport.acpDisabled":"ACP transport disabled","daemon.transport.acpConnections":"ACP connections","daemon.transport.acpStreams":"ACP streams (session/SSE/WS)","daemon.transport.pendingRequests":"Pending client requests","daemon.transport.rateLimitRejected":"Rate-limit rejects","daemon.security.title":"Security","daemon.security.token":"Bearer token","daemon.security.requireAuth":"Require auth","daemon.security.loopback":"Loopback bind","daemon.security.allowOrigin":"Allowed origins","daemon.security.shell":"Session shell commands","daemon.security.configured":"configured","daemon.security.notConfigured":"not configured","daemon.limits.title":"Limits","daemon.limits.unlimited":"unlimited","daemon.limits.maxSessions":"Max sessions","daemon.limits.maxPendingPrompts":"Max pending prompts / session","daemon.limits.maxConnections":"Max listener connections","daemon.limits.eventRing":"Event ring size","daemon.limits.promptDeadline":"Prompt deadline","daemon.limits.sessionIdle":"Session idle timeout","daemon.capabilities.title":"Capabilities","daemon.capabilities.titleCount":e=>`Capabilities (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"Sessions","daemon.full.sessions.empty":"No active sessions","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} pending prompts`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} pending permissions`,"daemon.full.session.prompting":"prompting","daemon.full.workspace.title":"Workspace Diagnostics","daemon.full.workspace.empty":"No workspace diagnostics reported","daemon.full.auth.title":"Auth","daemon.full.auth.providers":"Device-flow providers","daemon.full.auth.pending":"Pending device flows","daemon.full.acp.title":"ACP connections","daemon.tab.overview":"Overview","daemon.tab.usage":"Usage","daemon.tab.metrics":"Metrics","daemon.tab.diagnostics":"Diagnostics","daemon.charts.title":"Metrics","daemon.charts.empty":"Collecting metrics… charts appear after the first sample.","daemon.charts.concurrency":"Concurrency","daemon.charts.activePrompts":"Active tasks","daemon.charts.activeSessions":"Sessions","daemon.charts.requests":"Requests","daemon.charts.reqTotal":"Total","daemon.charts.reqErrors":"Errors","daemon.charts.apiLatency":"API latency","daemon.charts.promptLatency":"Prompt latency","daemon.charts.queueWait":"Queue wait","daemon.charts.promptDuration":"Duration","daemon.charts.eventLoop":"Event-loop lag","daemon.charts.eventLoopLag":"Lag p99","daemon.charts.queuedPrompts":"Queued","daemon.charts.reqRejected":"Rejected","daemon.charts.llmLatency":"LLM API latency","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC pipe","daemon.charts.pipeIn":"In","daemon.charts.pipeOut":"Out","daemon.charts.connections":"Connections","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"Child","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"Child RSS","daemon.charts.memory":"Memory","daemon.charts.heap":"Heap","daemon.charts.tokens":"Token burn","daemon.charts.tokensIn":"Input","daemon.charts.tokensOut":"Output","daemon.charts.peak":"peak","daemon.usage.today":"Today","daemon.usage.period7d":"7D","daemon.usage.period30d":"30D","daemon.usage.rangeWeek":"Last 7 days","daemon.usage.rangeMonth":"Last 30 days","daemon.usage.rangeGroup":"Summary period","daemon.usage.tokensConsumed":"tokens consumed","daemon.usage.sessions":"Sessions","daemon.usage.requests":"Requests","daemon.usage.tools":"Tools","daemon.usage.changes":"Changes","daemon.usage.breakdownTitle":"Token Breakdown","daemon.usage.inputTokens":"Input tokens","daemon.usage.inputHint":"request + cache read","daemon.usage.outputTokens":"Output tokens","daemon.usage.outputHint":"response + reasoning","daemon.usage.cacheRead":"Cache read","daemon.usage.cacheHint":"cache read share","daemon.usage.heatmapTitle":"Token Heatmap","daemon.usage.heatmapSub":e=>`recent ${(e==null?void 0:e.months)??12} months · daily aggregated tokens`,"daemon.usage.low":"Low","daemon.usage.high":"High","daemon.usage.dowMon":"Mon","daemon.usage.dowWed":"Wed","daemon.usage.dowFri":"Fri","daemon.usage.empty":"No token usage recorded yet.","daemon.usage.loading":"Loading usage…","daemon.usage.failed":"Failed to load usage","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"Today","daemon.usage.rangeWordWeek":"7 days","daemon.usage.rangeWordMonth":"30 days","daemon.usage.modelShareTitle":"model share","daemon.usage.modelShareSub":"token share · light green shows cache read","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · cache ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"skill calls","daemon.usage.skillSub":"skill name / count","daemon.usage.skillName":"Skill name","daemon.usage.skillCount":"Count","daemon.usage.dailyTokensTitle":"tokens","daemon.usage.dailyTokensSub":"daily token totals","daemon.usage.dailySessionsTitle":"sessions","daemon.usage.dailySessionsSub":"active session counts per day","delete.cannotCurrent":"Cannot delete the current active session.","delete.action":"Delete","delete.deleted":"Session deleted.","delete.deletedCount":e=>`${(e==null?void 0:e.count)??0} session(s) deleted.`,"delete.deleting":"Deleting...","delete.failed":e=>`Failed to delete session.${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ navigate · Space select · Enter delete · Esc cancel","delete.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"delete.none":"No sessions to delete","delete.allFailed":e=>`Failed to delete ${(e==null?void 0:e.count)??0} session(s): ${(e==null?void 0:e.reason)??"unknown error"}`,"delete.nonRemoved":"No sessions were deleted.","delete.notFound":"Session not found — it may have been deleted already.","delete.partialFail":e=>`${(e==null?void 0:e.removed)??0} deleted, ${(e==null?void 0:e.failed)??0} failed: ${(e==null?void 0:e.detail)??"unknown error"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"delete.pressSearch":"Press / to search; Space to select; Enter to delete","delete.selected":e=>`${(e==null?void 0:e.count)??0} selected`,"delete.title":"Delete Session","time.justNow":"just now","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} min ago`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0}h ago`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0}d ago`,"dialog.footer.close":"Esc to close","dialog.footer.confirmCancel":"Enter to confirm · Esc to cancel","release.cannotCurrent":"Cannot release the current active session.","release.action":"Release","release.released":"Session released successfully.","release.failed":e=>`Failed to release session.${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ to navigate · Enter to release · Esc to cancel","release.inactive":"Only active live sessions can be released.","release.inactiveBadge":"inactive","release.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"release.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"release.none":"No live sessions to release","release.pressSearch":"Press / to search; Enter releases the selected live session","release.releasing":"Releasing...","release.title":"Release Session","dialog.footer.menu":"Esc to menu","dialog.footer.mcpServers":"↑↓ to navigate · Enter details · r refresh · Esc close","dialog.footer.mcpSelect":"↑↓ to navigate · Enter select · Esc back","dialog.footer.modelFast":"↑↓ to navigate · / to search · c for custom · Enter to set fast model · Esc to cancel","dialog.footer.navSelectCancel":"↑↓ to navigate · Enter to select · Esc to cancel","dialog.footer.navSelectClose":"↑↓ to navigate · Enter to select · Esc to close","dialog.footer.navSelectMenu":"↑↓ to navigate · Enter to select · Esc to menu","dialog.footer.navOpenClose":"↑↓ to navigate · Enter to open · Esc to close","dialog.footer.navOpenMenu":"↑↓ to navigate · Enter to open · Esc to menu","dialog.footer.back":"Esc to go back","dialog.footer.backClose":"Esc to close","dialog.footer.saveClose":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to close","dialog.footer.saveMenu":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to menu","dialog.footer.search":"Type to search · Enter to commit · Esc to clear","dialog.footer.select":"Enter to select","editor.escClearHint":"Press Esc again to clear","editor.hintCommands":"commands","editor.hintFiles":"Files","editor.hintNext":"next","editor.hintPrev":"previous","editor.hintSearch":"search","editor.noHistory":"No matching history","editor.placeholder":"Type a message or @ file path","editor.shellPlaceholder":"Enter terminal command","editor.send":"Send message","editor.connectionDisconnected":"Connection interrupted. Please try again after it reconnects.","editor.sessionLoading":"Session is still loading. Try again in a moment.","editor.processing":"Processing. New messages will be queued.","editor.searchHint":"ctrl+r next · tab accept · enter send · esc cancel","editor.searchLabel":"reverse-i-search:","editor.searchPlaceholder":"type to search...","quickActions.open":"more actions","quickActions.title":"more actions","quickActions.mcp":"MCP","quickActions.context":"Context","quickActions.status":"Status","quickActions.stats":"Session","quickActions.memory":"Memory","quickActions.extensions":"Extensions","quickActions.skills":"Skills","quickActions.tools":"Tools","quickActions.agents":"Agents","quickActions.help":"Help","quickActions.theme":"Set theme","quickActions.auth":"Auth","quickActions.settings":"Settings","quickActions.new":"New session","quickActions.resume":"Switch session","quickActions.delete":"Delete session","quickActions.branch":"Copy session","quickActions.rewind":"Rewind session","quickActions.historyQuestion":"Question history","quickActions.recap":"Generate recap","quickActions.copy":"Copy output","quickActions.shellMode":"Shell mode","quickActions.exitShellMode":"Exit Shell","quickActions.setGoal":"Set goal","session.missing":"Current session does not exist","session.new":"New session","scheduledTasks.title":"Scheduled Tasks","scheduledTasks.subtitle":"Run tasks automatically on a schedule, or trigger them manually anytime.","scheduledTasks.loading":"Loading…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} task${Number((e==null?void 0:e.count)??0)===1?"":"s"}`,"scheduledTasks.refresh":"Refresh","scheduledTasks.new":"New scheduled task","scheduledTasks.createViaChat":"Create via chat","scheduledTasks.chatStarter":"Help me set up a recurring scheduled task (keep it long-term). What I want: ","scheduledTasks.name":"Name","scheduledTasks.namePlaceholder":"Optional — defaults to the prompt","scheduledTasks.prompt":"Prompt","scheduledTasks.promptPlaceholder":"What should this task do?","scheduledTasks.frequency":"Frequency","scheduledTasks.freq.daily":"Daily","scheduledTasks.freq.weekdays":"Weekdays","scheduledTasks.freq.weekly":"Weekly","scheduledTasks.freq.hourly":"Hourly","scheduledTasks.freq.minutes":"Every N minutes","scheduledTasks.freq.custom":"Custom (cron)","scheduledTasks.time":"Time","scheduledTasks.weekday":"Weekday","scheduledTasks.interval":"Minutes","scheduledTasks.cron":"Cron expression","scheduledTasks.weekdayNames":"Sun,Mon,Tue,Wed,Thu,Fri,Sat","scheduledTasks.human.daily":e=>`Daily at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`Weekdays at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`Every ${(e==null?void 0:e.day)??""} at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`Hourly at :${(e==null?void 0:e.min)??"00"}`,"scheduledTasks.human.everyMinutes":e=>`Every ${(e==null?void 0:e.n)??""} minutes`,"scheduledTasks.never":"Never run","scheduledTasks.repeats":"Repeats","scheduledTasks.runsOnce":"Runs once","scheduledTasks.lastFired":e=>`Last run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"Run now","scheduledTasks.enable":"Enable","scheduledTasks.disable":"Disable","scheduledTasks.delete":"Delete","scheduledTasks.deleteConfirm":e=>`Delete scheduled task "${(e==null?void 0:e.name)??""}"?`,"scheduledTasks.empty":"No scheduled tasks yet. Create one to get started.","scheduledTasks.create":"Create","scheduledTasks.creating":"Creating…","scheduledTasks.cancel":"Cancel","scheduledTasks.error.invalidSchedule":"Invalid schedule","scheduledTasks.error.emptyPrompt":"Prompt is required","scheduledTasks.error.toggleFailed":"Failed to update task","scheduledTasks.error.deleteFailed":"Failed to delete task","scheduledTasks.edit":"Edit","scheduledTasks.editTitle":"Edit scheduled task","scheduledTasks.save":"Save","scheduledTasks.saving":"Saving…","scheduledTasks.runHistory":e=>`Run history (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistory":e=>`View conversation (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistoryEmpty":"View conversation","scheduledTasks.viewHistoryHint":"Open the task's session to see its runs","scheduledTasks.runKind.catchUp":"late","scheduledTasks.runKind.manual":"manual","scheduledTasks.error.runFailed":"Failed to record the run","scheduledTasks.error.oneShotConsumedButFailed":"The task was deleted but the prompt could not be delivered — it never ran. Recreate it to try again.","scheduledTasks.dueNow":"Due now","scheduledTasks.nextRunTooltip":e=>`Next run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"d","scheduledTasks.dur.h":"h","scheduledTasks.dur.m":"m","scheduledTasks.dur.s":"s","sidebar.label":"Workspace sidebar","sidebar.toggleMenu":"Toggle menu","sidebar.newChat":"New chat","sidebar.project":"Project","sidebar.projectFallback":"Project","sidebar.sessionsOverview":"Session Overview","sidebar.splitView":"Split View","sidebar.settings":"Settings","sidebar.daemonStatus":"Daemon Status","sidebar.scheduledTasks":"Scheduled Tasks","sidebar.collapse":"Collapse","sidebar.expand":"Expand","sidebar.collapseProject":"Collapse project","sidebar.expandProject":"Expand project","sidebar.search":"Search sessions","sidebar.searchPlaceholder":"Search sessions","sidebar.searchEmpty":"No matching sessions.","sidebar.rename":"Rename","sidebar.renameCurrentOnly":"Only the current session can be renamed","sidebar.export":"Export conversation record","sidebar.exportFailed":"Failed to export session","sidebar.delete":"Delete","sidebar.archive":"Archive","sidebar.unarchive":"Restore","sidebar.moreActions":"More actions","sidebar.archiveCurrentDisabled":"The current session cannot be archived","sidebar.archivedTitle":"Archived","sidebar.archivedEmpty":"No archived sessions.","sidebar.archiveFailed":"Failed to archive session","sidebar.unarchiveFailed":"Failed to restore session","sidebar.loadingSessions":"Loading sessions...","sidebar.loadFailed":"Failed to load sessions. Click to retry.","sidebar.renameFailed":"Failed to rename session","sidebar.deleteFailed":"Failed to delete session","sidebar.newSessionFailed":"Failed to create a new chat","sidebar.switchFailed":"Failed to switch session","sidebar.currentDeleteDisabled":"Current session cannot be deleted","sidebar.deleteConfirmDescription":e=>`Delete "${(e==null?void 0:e.name)??""}"? This cannot be undone.`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} client(s)`,"sidebar.running":"Running","sidebar.completedUnread":"Finished","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.sessionGroup":"Group","sidebar.groupFilter":"Session group","sidebar.groupAll":"All","sidebar.groupPinned":"Pinned","sidebar.groupUngrouped":"Ungrouped","sidebar.groupRecent":"Recent","sidebar.groupCreate":"Create group","sidebar.groupRename":"Rename group","sidebar.groupDelete":"Delete group","sidebar.groupColor":"Group color","sidebar.groupNamePrompt":"Group name","sidebar.groupDeleteConfirm":e=>`Delete group "${(e==null?void 0:e.name)??""}"?`,"sidebar.groupsLoadFailed":"Failed to load session groups","sidebar.groupCreateFailed":"Failed to create group","sidebar.groupAssignFailedAfterCreate":"Group created, but failed to move session into it","sidebar.groupUpdateFailed":"Failed to update group","sidebar.groupDeleteFailed":"Failed to delete group","sidebar.organizationFailed":"Failed to update session organization","sidebar.groupColor.red":"Red","sidebar.groupColor.orange":"Orange","sidebar.groupColor.yellow":"Yellow","sidebar.groupColor.green":"Green","sidebar.groupColor.blue":"Blue","sidebar.groupColor.purple":"Purple","quickKeys.cursor":"Move cursor","quickKeys.escape":"Cancel run","quickKeys.history":"History","quickKeys.retry":"Retry failed","quickKeys.searchHistory":"Search history","quickKeys.tab":"Accept completion","error.unsupportedTheme":"Unsupported theme. Use /theme light or /theme dark.","queue.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.cleared":"Queue cleared.","queue.deleteTip":"Remove from queue","queue.editTip":"Remove from queue and edit again","queue.insertTip":"Insert this message into the current session; it takes effect on the next model call.","queue.inserted":"Inserted. It takes effect on the next model call.","queue.insertCommandDisabled":"Commands can't be inserted into the running turn; they run after it finishes.","queue.submitting":"Submitting...","queue.editing":"Editing...","queue.removing":"Updating...","queue.submittingDisabled":"Submitting queued message...","queue.commandBlocked":"Slash commands can't be queued while a turn is running.","queue.shellBlocked":"Shell commands can't be queued while a turn is running.","queue.queueFailed":"Failed to queue message","queue.insertFailed":"Failed to insert queued message","queue.deleteFailed":"Failed to move message out of queue","queue.editFailed":"Failed to edit queued message","queue.footer":"Press ↑ to edit the latest queued message · Esc to clear queue","queue.imageCount":e=>`(+${(e==null?void 0:e.count)??0} images)`,"queue.more":e=>`... (+${(e==null?void 0:e.count)??0} more)`,"midTurn.inserted":e=>`Inserted message: ${(e==null?void 0:e.message)??""}`,"help.builtIn":"Built-in commands","help.commandCount":e=>`${(e==null?void 0:e.count)??0} commands`,"help.commandMeta.builtIn":"built-in","help.commandMeta.custom":"custom","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} subcommands`,"help.commandsIntro":"Browse built-in commands:","help.customGroup":"Custom, skills, plugins, MCP","help.customIntro":"Browse custom, skill, plugin, and MCP commands:","help.empty":"No commands are currently available.","help.emptyCustom":"No custom commands are currently available.","help.footer":"Tab/Shift+Tab to switch tabs · ↑/↓ or PgUp/PgDn to scroll · Esc to close","help.intro":"Qwen Code understands your codebase, makes edits with your permission, and executes commands right from your terminal.","help.section.shortcuts":"Shortcuts","help.search":"Search commands","help.shortcut.addContext":"Add files or folders as context","help.shortcut.altWords":"Jump through words","help.shortcut.clear":"Clear the screen","help.shortcut.commandMenu":"Open command menu","help.shortcut.completion":"Accept completion or switch help tabs","help.shortcut.history":"Cycle prompt history or scroll lists","help.shortcut.searchHistory":"Search prompt history","help.shortcut.newline":"Insert a newline","help.shortcut.pasteImages":"Paste images","help.shortcut.shell":"Run shell commands","help.shortcut.togglePanel":"Toggle this panel","help.shortcut.retry":"Retry last request","help.shortcut.compact":"Toggle compact mode","retry.hint":"Press Ctrl+Y to retry or click to retry","retry.none":"No failed request to retry.","branch.failed":"Failed to branch session.","branch.success":e=>`Copied session. New session name: "${(e==null?void 0:e.name)??""}". Switched to the new session.`,"fork.empty":"Please provide a directive. Usage: /fork <directive>","fork.failed":e=>`Failed to launch fork: ${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"Background agent was not launched.","fork.started":e=>`Started background agent: "${(e==null?void 0:e.name)??""}". Track it in background tasks.`,"command.hidden":"This command is not available.","help.shortcut.approvals":"Cycle approval modes","help.shortcut.cancel":"Close dialogs or cancel operation","bug.failed":"Failed to load system info for bug report.","bug.popupBlocked":"Popup blocked — please allow popups and try again.","bug.submitted":"Bug report opened in a new tab.","clear.blocked":"Cannot clear while streaming — cancel first (Esc).","error.unknown":"Unknown error","error.modelStreamInterrupted":"Model response stream was interrupted. Please retry.","shell.command":"Shell Command","compact.enabled":"Compact mode enabled","compact.disabled":"Compact mode disabled","compact.hint":"Press Ctrl+O to show full tool output","compact.saveFailed":"Failed to save compact mode","help.subcommands":"subcommands","help.tab.commands":"Built-in commands","help.tab.custom":"custom-commands","help.tab.general":"shortcuts","help.title":"Help","slash.category.custom":"Custom commands","slash.category.skill":"Skill commands","slash.category.system":"System commands","language.changed":e=>`UI language changed to ${(e==null?void 0:e.language)??""}`,"language.current":e=>`Current UI language: ${(e==null?void 0:e.language)??""}`,"language.invalid":"Invalid language. Available: en, zh-CN","language.options":"Available options:","language.set":"Set UI language","language.usage":"Usage: /language ui [en|zh-CN]","localCommand.noSession":"No active session yet. Send your first message before using this command.","local.agents":"Manage subagents","local.bug":"Submit a bug report","local.compress":"Compress the context into a summary","local.compressFast":"Fast context compression without AI","local.config":"Get or set any setting by dot-path key","local.diff":"Show working-tree change stats versus HEAD","local.directory":"Manage workspace directories","local.docs":"Open the full Qwen Code documentation","local.doctor":"Run installation and environment diagnostics","local.dream":"Consolidate managed auto-memory topic files","local.effort":"Set reasoning effort for capable models","local.export":"Export the current session history to a file","local.forget":"Remove matching entries from managed auto-memory","local.hooks":"Manage Qwen Code hooks","local.importConfig":"Import MCP servers from Claude configs","local.init":"Analyze the project and create a QWEN.md file","local.insight":"Generate programming insights from chat history","local.lsp":"Show LSP server status","local.remember":"Save a durable memory to the memory system","local.summary":"Generate a project summary file","local.workflows":"List active and completed workflow runs","skilldesc.batch":"Run batch operations across many files in parallel","skilldesc.dataviz":"Design guidance for charts and data visualizations","skilldesc.extensionCreator":"Create, test, and customize Qwen Code extensions","skilldesc.loop":"Run a prompt on a schedule or self-paced wakeups","skilldesc.newApp":"Workflow for building a new app from scratch","skilldesc.qcHelper":"Answer questions about using Qwen Code","skilldesc.review":"Review changed code for bugs, security, and quality","skilldesc.simplify":"Clean up recent changes for reuse and simplicity","skilldesc.stuck":"Diagnose frozen or slow Qwen Code sessions","skilldesc.agentReproduceAlign":"Align a ported Codex/Claude Code feature with the original","skilldesc.agentReproduceFeature":"Reproduce an existing Codex/Claude Code feature","skilldesc.autofix":"Implement approved issues or address PR review feedback","skilldesc.bugfix":"Fix a bug from a GitHub issue, reproduce-first","skilldesc.codegraph":"Analyze the codebase via graph and vector index","skilldesc.createIssue":"Draft and submit a GitHub issue from an idea","skilldesc.desktopPet":"Create a pixel-art desktop pet for Qwen Code","skilldesc.docsAuditAndRefresh":"Audit and refresh docs/ against the codebase","skilldesc.docsUpdateFromDiff":"Update official docs from local git diff","skilldesc.e2eTesting":"Run end-to-end tests of the Qwen Code CLI","skilldesc.featDev":"End-to-end workflow for a non-trivial feature","skilldesc.memoryLeakDebug":"Diagnose CLI memory leaks via heap snapshots","skilldesc.openworkDesktopSync":"Sync packages/desktop with openwork commit-by-commit","skilldesc.preparePr":"Prepare a GitHub PR title and body from the branch","skilldesc.qwenCodeClaw":"Use Qwen Code as a code-understanding agent","skilldesc.structuredDebugging":"Hypothesis-driven methodology for hard bugs","skilldesc.terminalCapture":"Automate terminal UI screenshot testing","skilldesc.tmuxRealUserTesting":"Real-user testing with tmux, saving logs","skilldesc.triage":"Triage and review Qwen Code issues and PRs","local.approvalMode":"Change approval mode","local.auth":"Connect an LLM provider","auth.title":"Connect a Provider","auth.step.group":"Type","auth.step.provider":"Provider","auth.step.protocol":"Protocol","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"Model IDs","auth.step.advanced":"Advanced Config","auth.protocol.openai":"OpenAI-compatible","auth.protocol.openaiDesc":"Standard OpenAI API format (most common)","auth.protocol.anthropic":"Anthropic-compatible","auth.protocol.anthropicDesc":"Anthropic Messages API format","auth.protocol.gemini":"Gemini-compatible","auth.protocol.geminiDesc":"Google Gemini API format","auth.apiKeyRequired":"API key cannot be empty.","auth.baseUrlInvalid":"Base URL must start with http:// or https://.","auth.baseUrlPrompt":"Enter the API endpoint for this protocol.","auth.baseUrlRequired":"Base URL cannot be empty.","auth.documentation":"Documentation","auth.modelsRequired":"Model IDs cannot be empty.","auth.review":"Review","auth.reviewText":"The following JSON will be saved to settings.json:","auth.save":"Save","auth.saving":"Saving...","auth.termsTitle":"Terms of Services and Privacy Notice","auth.continue":"Continue","auth.modelsPrompt":e=>`Enter model IDs separated by commas. Examples: ${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"Optional: configure advanced generation settings.","auth.advanced.thinking":"Enable thinking","auth.advanced.thinkingDesc":"Allows the model to perform extended reasoning before responding.","auth.advanced.modality":"Enable modality","auth.advanced.modalityDesc":"Enables multimodal input capabilities (image, video, etc.).","auth.advanced.modalityImage":"Image","auth.advanced.modalityVideo":"Video","auth.advanced.modalityAudio":"Audio","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"Context window","auth.advanced.contextDesc":"Max input tokens (leave empty to auto-detect from model name).","auth.advanced.contextPlaceholder":"Context window (optional)","local.btw":"Ask a quick side question without affecting the main conversation. Usage: /btw <your question>","btw.empty":"Please provide a question. Usage: /btw <your question>","btw.emptyAnswer":"No response received.","btw.failed":"Failed to answer btw question","btw.answering":"+ Answering...","btw.shortcuts.pending":"Press Escape, Ctrl+C, or Ctrl+D to cancel","btw.shortcuts.done":"Press Space, Enter, or Escape to dismiss","local.clear":"Start a new session with empty context; previous session stays on disk (resumable with /resume)","local.context":'Show context window usage breakdown. Use "/context detail" for per-item breakdown.',"local.copy":"Copy last output or snippet","local.delete":"Delete a session permanently","local.release":"Release a live session","local.rewind":"Rewind the current conversation","local.branch":"Fork the current conversation into a new session","local.fork":"Start a background agent from this conversation","local.help":"Show help and commands","local.language":"Change UI language","local.mcp":"Manage MCP servers","local.memory":"Manage memory","local.model":"Switch model or set fast model","local.new":"Start a new conversation","local.plan":"Enter Plan mode","local.goal":"Set a goal and keep working until it is met","local.recap":"Generate a session recap","recap.label":"Recap","recap.loading":"Generating recap...","recap.empty":"Not enough conversation context for a recap yet.","recap.failed":"Failed to generate recap","rewind.action":"Rewind","rewind.confirm":"Confirm rewind","rewind.empty":"No rewind snapshots are available for this session.","rewind.failed":e=>`Failed to rewind session: ${(e==null?void 0:e.reason)??""}`,"rewind.loading":"Loading rewind snapshots...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"Rewinding...","rewind.subtitle":"Only the conversation is rewound. Files are not changed.","rewind.title":"Rewind Conversation","rewind.turn":e=>`Prompt ${(e==null?void 0:e.turn)??0}`,"local.rename":"Rename current session","rename.empty":"Please enter a session name, for example /rename project debugging, or use /rename --auto.","rename.success":e=>`Session renamed to ${(e==null?void 0:e.name)??""}`,"local.reset":"Reset current conversation","local.resume":"Resume a previous session","local.skills":"View available skills","local.stats":"Show session statistics","local.tasks":"View background tasks","local.status":"Show version info","local.theme":"Change theme","local.settings":"View and edit settings","local.schedule":"Manage scheduled tasks","local.extensions":"Manage extensions. Usage: /extensions manage|install <source>","extensions.label":"extension","extensions.action.failed":e=>`Extension action failed${e!=null&&e.name?` for "${e.name}"`:e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.commands.refreshFailed":"Failed to refresh extension commands.","extensions.install.failed":e=>`Failed to install extension${e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.manage.agents":"Agents:","extensions.manage.checkingUpdates":"Checking for updates...","extensions.manage.commands":"Commands:","extensions.manage.contextFiles":"Context files:","extensions.manage.count":e=>`${(e==null?void 0:e.count)??0} extensions installed`,"extensions.manage.detailsTitle":"Extension Details","extensions.manage.disable":"Disable Extension","extensions.manage.disabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" disabled.`,"extensions.manage.empty":"No extensions installed.","extensions.manage.enable":"Enable Extension","extensions.manage.enabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" enabled.`,"extensions.manage.footer.back":"Esc to go back","extensions.manage.footer.confirm":"Enter confirm · Esc cancel","extensions.manage.footer.list":"↑↓ to navigate · Enter select · r refresh · Esc close","extensions.manage.footer.select":"↑↓ to navigate · Enter select · Esc back","extensions.manage.loading":"Loading extensions...","extensions.manage.mcpServers":"MCP servers:","extensions.manage.name":"Name:","extensions.manage.notUpdatable":"not updatable","extensions.manage.path":"Path:","extensions.manage.queued":e=>`Extension action queued for "${(e==null?void 0:e.name)??"extension"}".`,"extensions.manage.refreshed":e=>`Extensions refreshed in ${(e==null?void 0:e.refreshed)??0} session(s), ${(e==null?void 0:e.failed)??0} failed.`,"extensions.manage.settings":"Settings:","extensions.manage.skills":"Skills:","extensions.manage.source":"Source:","extensions.manage.status":"Status:","extensions.manage.status.disabled":"disabled","extensions.manage.status.enabled":"enabled","extensions.manage.title":"Manage Extensions","extensions.manage.unknownUpdate":"unknown","extensions.manage.uninstalled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" uninstalled.`,"extensions.manage.uninstallAction":"Uninstall Extension","extensions.manage.uninstallConfirm":e=>`Uninstall extension "${(e==null?void 0:e.name)??"extension"}"?`,"extensions.manage.upToDate":"up to date","extensions.manage.update":"Update Extension","extensions.manage.updateAvailable":"update available","extensions.manage.updateError":"update check failed","extensions.manage.updated":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated.`,"extensions.manage.updatedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" updated to v${(e==null?void 0:e.version)??""}.`,"extensions.manage.version":"Version:","extensions.manage.viewDetails":"View Details","extensions.install.installed":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" installed.`,"extensions.install.installedWithVersion":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" v${(e==null?void 0:e.version)??""} installed.`,"extensions.install.missingOptionValue":e=>`Missing value for ${(e==null?void 0:e.option)??"option"}`,"extensions.install.requestFailed":"Failed to install extension","extensions.install.started":e=>`Installing extension from "${(e==null?void 0:e.source)??""}"...`,"extensions.install.unknownOption":e=>`Unknown option ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"Usage: /extensions manage|install <source>","extensions.install.waitForSession":"Wait for the session to connect before installing an extension.","local.tools":"List available tools. Usage: /tools [desc]","loadWarning.commands":"Failed to load command list; slash commands may be incomplete.","loadWarning.context":"Failed to load session context; current mode may be inaccurate.","loadWarning.models":"Failed to load model list; some model details may be unavailable.","mcp.action.auth":"Authenticate","mcp.action.authHint":"Not exposed by daemon yet","mcp.action.authMessage":"Daemon serve does not expose MCP authentication yet.","mcp.action.clearAuth":"Clear Authentication","mcp.action.disable":"Disable","mcp.action.done":e=>`${(e==null?void 0:e.action)??"Action"} complete.`,"mcp.action.enable":"Enable","mcp.action.enableMessage":"Daemon serve does not expose MCP enable/disable yet.","mcp.action.failed":e=>`Failed: ${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"Action"}...`,"mcp.action.reauth":"Re-authenticate","mcp.annotation.destructive":"destructive","mcp.annotation.idempotent":"idempotent","mcp.annotation.openWorld":"open-world","mcp.annotation.readOnly":"read-only","mcp.annotations":"Annotations","mcp.oauth.server":"Server","mcp.oauth.starting":e=>`Starting OAuth authentication for MCP server '${(e==null?void 0:e.name)??""}'...`,"mcp.oauth.title":"OAuth Authentication","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} clients · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"Command","mcp.description":"Description:","mcp.action.reconnect":"Reconnect","mcp.action.restart":"Restart","mcp.action.tools":"View tools","mcp.action.toolsHint":"Enter to inspect","mcp.empty":"No MCP servers configured.","mcp.emptyTools":"No tools discovered.","mcp.expand":"Expand MCP server","mcp.collapse":"Collapse MCP server","mcp.inputSchema":"Input schema","mcp.loadingStatus":"Loading MCP status...","mcp.loadingTools":"Loading tools...","mcp.name":"Name","mcp.noDescription":"No description","mcp.noSchema":"No input schema.","mcp.serverTool":"Server tool","mcp.servers":e=>`${(e==null?void 0:e.count)??0} servers`,"mcp.configuredServers":"Configured MCP servers:","mcp.fromExtension":e=>`(from ${(e==null?void 0:e.name)??""})`,"mcp.extensionMcp":"Extension MCP","mcp.invalidReason":e=>`invalid: ${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"Reason:","mcp.invalidToolHelp":"Tools must have both name and description to be used by the LLM.","mcp.invalidToolWarning":"Warning: This tool cannot be called by the LLM","mcp.manageServers":"Manage MCP servers","mcp.parameters":"Parameters:","mcp.required":" required","mcp.resources":"Resources","mcp.resourcesUnavailable":"Resource details unavailable.","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"resource":"resources"}`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"prompt":"prompts"}`,"mcp.resource.uriLabel":"URI:","mcp.resource.nameLabel":"Name:","mcp.resource.mimeTypeLabel":"MIME Type:","mcp.resource.sizeLabel":"Size:","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} ${(e==null?void 0:e.count)===1?"byte":"bytes"}`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc to back","mcp.shortcut.close":"Esc to close","mcp.shortcut.selectBack":"↑↓ to navigate · Enter to select · Esc to back","mcp.shortcut.selectClose":"↑↓ to navigate · Enter to select · Esc to close","mcp.settings":"Settings","mcp.extension":e=>`Extension: ${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP servers are starting up (${(e==null?void 0:e.count)??0} initializing)...`,"mcp.startingNote":"Note: First startup may take longer. Tool availability will update automatically.","mcp.restartSkipped":e=>`Skipped ${(e==null?void 0:e.name)??""}: ${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`Restarted ${(e==null?void 0:e.name)??""} in ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`Restarted ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} ${(e==null?void 0:e.name)??""} entries${e!=null&&e.failedReasons?` (failed: ${e.failedReasons})`:""}`,"mcp.source":"Source","mcp.source.extension":"Extension","mcp.source.project":"Workspace Settings","mcp.source.user":"User Settings","mcp.status":"Status","mcp.status.blocked":"Blocked","mcp.status.connected":"connected","mcp.status.connecting":"connecting","mcp.status.disconnected":"disconnected","mcp.status.disconnectedTitle":"Disconnected","mcp.status.disabled":"disabled","mcp.status.ready":"Ready","mcp.status.starting":"Starting... (first startup may take longer)","mcp.status.unknown":"unknown","mcp.tipDesc":"to show server and tool descriptions","mcp.tipNodesc":"to hide descriptions","mcp.tipSchema":"to show tool parameter schemas","mcp.tips":"💡 Tips:","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} tool`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"mcp.toolsLabel":"Tools:","mcp.title":"MCP Servers","mcp.toolDetail":"Tool Detail","mcp.tools":"Tools","mcp.toolsForServer":e=>`Tools for ${(e==null?void 0:e.name)??"Server"}`,"mcp.transport":"Transport","mcp.use":"Use","mcp.userMcp":"User MCP","mcp.workingDirectory":"Working Directory","goal.aborted":"Goal aborted","goal.achieved":"Goal achieved","goal.check":"Goal check","goal.cleared":"Goal cleared","goal.failed":"Goal could not be achieved","goal.judge":"Judge","goal.label":"Goal","goal.lastCheck":"Last check","goal.notYetMet":"not yet met","goal.set":"Goal set","goal.statusActive":"/goal active","goal.turn":e=>`${(e==null?void 0:e.count)??0} turn`,"goal.turnLabel":e=>`turn ${(e==null?void 0:e.count)??0}`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} turns`,"memory.add":"Add","memory.add.desc":"Write a durable memory","memory.autoDream":e=>`Auto-dream: ${(e==null?void 0:e.status)??"unknown"} · ${(e==null?void 0:e.lastDream)??"never"} · /dream to run`,"memory.autoDreamUnsupported":"Auto-dream settings are not available from web-shell yet.","memory.autoFolder":"Open auto-memory folder","memory.autoMemory":e=>`Auto-memory: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoMemoryUnsupported":"Auto-memory settings are not available from web-shell yet.","memory.autoSkill":e=>`Auto-skill: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoSkillUnsupported":"Auto-skill settings are not available from web-shell yet.","memory.chooseScope":"Choose where to save the memory","memory.closed":"Memory panel closed.","memory.contentEmpty":"Memory content is empty.","memory.file":"Memory file","memory.fileOpen":"Memory file opened.","memory.fileTruncated":"Memory file opened. Content is truncated.","memory.files":"Memory Files","memory.footer":"Enter to confirm · Esc to cancel","memory.footer.back":"Esc to go back","memory.global":"User","memory.global.desc":"Saved to the global user memory file","memory.globalReadUnsupported":"Global memory is outside the bound workspace, so the current daemon file-read API cannot open its content.","memory.loading":"Loading memory...","memory.loadingFile":"Loading memory file...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"never","memory.noFiles":"No memory files found.","memory.on":"on","memory.openFolderUnsupported":"Opening the auto-memory folder is not available from web-shell yet.","memory.placeholder":e=>`Write ${(e==null?void 0:e.scope)??"memory"} content...`,"memory.project":"Project","memory.project.desc":"Saved to this workspace memory file","memory.refresh":"Refresh","memory.refresh.desc":"Reload memory file information","memory.refreshed":"Memory refreshed.","memory.save":"Save Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} saved: ${(e==null?void 0:e.bytes)??0} bytes -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"Saving...","memory.show":"Show","memory.show.desc":"Show configured memory files","memory.status":"Workspace and user memory files","memory.unknown":"unknown","memory.write":"Write memory content","mode.auto":"Classifier Approval","mode.auto.desc":"Uses a classifier to approve safe tool calls and block or ask for risky ones","mode.auto.notice":"Auto mode enabled. An LLM classifier evaluates each tool call and auto-approves safe actions, blocks risky ones. To exit: Shift+Tab or /approval-mode default.","mode.footer":"(Use Enter to select, Esc to cancel)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"Plan","mode.label.default":"Ask Approval","mode.label.auto-edit":"Auto Edit","mode.label.auto":"Classifier Approval","mode.label.yolo":"Full Access","mode.listLabel.plan":"Plan (plan)","mode.listLabel.default":"Ask Approval (default)","mode.listLabel.auto-edit":"Auto Edit (auto-edit)","mode.listLabel.auto":"Classifier Approval (auto)","mode.listLabel.yolo":"Full Access (yolo)","mode.desc.plan":"Analyze only, do not modify files or execute commands","mode.desc.default":"Ask before running commands, editing files, or accessing external resources","mode.desc.auto-edit":"Automatically approve file edits and ask before command execution or other sensitive actions","mode.desc.auto":"Evaluate tool risk automatically, run safe actions, and confirm risky ones","mode.desc.yolo":"Automatically approve all tool calls in trusted contexts","mode.select":"Approval Mode","mode.autoApproved":e=>e!=null&&e.tool?`Auto-approved: ${e.tool}`:"Pending tool call auto-approved by mode switch.","mode.auto-edit":"Auto-accept edits","mode.auto-edit.desc":"Automatically approve file read/write operations","mode.default":"Default mode","mode.default.desc":"Ask before each tool call","mode.plan":"Plan mode","mode.plan.desc":"Analyze and plan without running tools","mode.unknown":"unknown mode","mode.yolo":"YOLO mode","mode.yolo.desc":"Automatically approve all operations","plan.title":"Plan","model.contextWindow":"Context Window","model.contextWindow.unknown":"(unknown)","model.current":e=>`current: ${(e==null?void 0:e.model)??"unknown"}`,"model.modality":"Modality","model.modality.text":"text","model.modality.textOnly":"text-only","model.modality.image":"image","model.modality.pdf":"pdf","model.modality.audio":"audio","model.modality.video":"video","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"(default)","model.notSet":"(not set)","model.footer":"Enter select, ↑↓ navigate, Esc close","model.searchHint":"Press / to search","model.fastHint":"for suggestions and side tasks","model.noMatch":e=>`No model matching "${(e==null?void 0:e.query)??""}"`,"model.none":"No models available","model.select":"Select Model","model.setFast":"Set Fast Model","model.setVoice":"Set Voice Model","model.setVision":"Set Vision Model","model.switch":"Switch Model","model.unknown":"unknown","resume.current":"current","resume.activePrompt":"active prompt","resume.filter":"Filter","resume.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"resume.none":"No sessions to resume","resume.pressSearch":"Press / to search","resume.search":"Search","resume.title":"Resume Session","parallelAgents.title":"Parallel agents","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} done`,"skills.available":"Available skills:","skills.none":"No skills are currently available.","skills.empty":"No skills available.","skills.footer":e=>e!=null&&e.name?`Use /skills ${e.name} to invoke · r to refresh · Esc to close`:"r to refresh · Esc to close","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} invocable`,"skills.loading":"Loading skills...","skills.run":"Run skill","skills.status.disabled":"disabled","skills.title":"Skills","stats.accepted":"Accepted:","stats.agreementRate":"Overall Agreement Rate:","stats.api":"API","stats.apiTime":"API Time","stats.avgDuration":"Avg Duration","stats.avgLatency":"Avg Latency","stats.cached":"Cached","stats.cacheDesc":"of input tokens were served from the cache, reducing costs.","stats.calls":"Calls","stats.codeChanges":"Code Changes","stats.decisionSummary":"User Decision Summary","stats.duration":"Duration","stats.errors":"Errors","stats.inputTokens":"Input Tokens","stats.metric":"Metric","stats.modelStats":"Model Stats","stats.modelTip":"Tip: For a full token breakdown, run /stats model.","stats.modelUsage":"Model Usage","stats.modified":"Modified:","stats.noApiCalls":"No API calls have been made in this session.","stats.noToolCalls":"No tool calls have been made in this session.","stats.output":"Output","stats.outputTokens":"Output Tokens","stats.overview":"Session Overview","stats.performance":"Performance","stats.prompt":"Prompt","stats.prompts":"Prompts","stats.rejected":"Rejected:","stats.reqs":"Reqs","stats.requests":"Requests","stats.savingsHighlight":"Savings Highlight:","stats.successRate":"Success Rate","stats.thoughts":"Thoughts","stats.title":"Session Stats","stats.tokens":"Tokens","stats.toolCalls":"Tool Calls","stats.toolName":"Tool Name","stats.toolStats":"Tool Stats","stats.toolTime":"Tool Time","stats.total":"Total","stats.totalReviewed":"Total Reviewed Suggestions:","status.contextUsed":e=>`${(e==null?void 0:e.pct)??"0.0"}% context used`,"status.disconnected":"Disconnected","status.modeHint":"(shift + tab or click to switch)","status.shortcuts":"? for shortcuts","stream.cancel":"esc to cancel","stream.cancelArmed":"Press Esc again to stop","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`current: ${(e==null?void 0:e.theme)??""}`,"theme.auto":"Auto","theme.dark":"Dark","theme.dark.desc":"Terminal-style dark skin.","theme.light":"Light","theme.light.desc":"Terminal-style light skin.","theme.title":"Theme","todo.allDone":"All tasks completed","todo.collapse":"Collapse task list","todo.completedAbove":e=>`✓ ${(e==null?void 0:e.count)??0} completed`,"todo.detail.api":"API","todo.detail.cached":"Cached","todo.detail.end":"End","todo.detail.hide":"Hide task detail","todo.detail.input":"Input","todo.detail.noResources":"Token & time usage wasn't captured for this task.","todo.detail.output":"Output","todo.detail.sectionSpent":"Time spent","todo.detail.sectionTime":"Time","todo.detail.sectionTokens":"Tokens","todo.detail.show":"Show task detail","todo.detail.start":"Start","todo.detail.tool":"Tool","todo.expand":"Expand task list","todo.more":e=>`... ${(e==null?void 0:e.count)??0} more`,"todo.moreAbove":e=>`... ${(e==null?void 0:e.count)??0} earlier`,"todo.showLess":"Show less","todo.stepProgress":e=>`Step ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"Current tasks","chat.scrollToBottom":"Scroll to bottom","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","turn.processed":"Processed","turn.processing":"Processing","turn.collapse":"Collapse steps","turn.expand":"Expand steps","turn.cached":"cached","turn.executionSteps":e=>{const t=(e==null?void 0:e.count)??0;return`${t} step${t===1?"":"s"}`},"turn.toolCalls":e=>{const t=(e==null?void 0:e.count)??0;return`${t} tool call${t===1?"":"s"}`},"turn.thinkingCount":e=>{const t=(e==null?void 0:e.count)??0;return`${t} thought${t===1?"":"s"}`},"turn.stopped":"You cancelled this request","message.renderError":"This message could not be displayed.","tasks.title":"Background tasks","tasks.empty":"No tasks currently running","tasks.refreshStale":"Task status may be stale; reconnecting...","tasks.cancelFailed":"Failed to cancel task","tasks.alreadyStopped":"Task already stopped","tasks.moreAbove":e=>`^ ${(e==null?void 0:e.count)??0} more above`,"tasks.moreBelow":e=>`v ${(e==null?void 0:e.count)??0} more below`,"tasks.running":"Running","tasks.completed":"Completed","tasks.failed":"Failed","tasks.cancelled":"Stopped","tasks.paused":"Paused","tasks.kind.shell":"Shell","tasks.kind.monitor":"Monitor","tasks.action.stop":"Stop","tasks.action.abandon":"Abandon","tasks.action.confirmStop":"Confirm stop","tasks.action.confirmAbandon":"Confirm abandon","tasks.action.confirmHint":"This will end the blocking turn.","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} local agent`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} local agents`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} local agent paused`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} local agents paused`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} task done`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} tasks done`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} monitor`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} monitors`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} shells`,"tasks.confirmStop":"x again to confirm stop · ends the blocking turn","tasks.shortcut.select":"↑/↓ select","tasks.shortcut.view":"Enter view","tasks.shortcut.stop":"x stop","tasks.shortcut.abandon":"x abandon","tasks.shortcut.listClose":"←/Esc close","tasks.shortcut.detailBack":"← go back","tasks.shortcut.detailClose":"Esc/Enter/Space close","tasks.shortcut.close":"Esc close","tasks.shortcut.cancelConfirm":"Esc cancel","tasks.detail.workingDir":"Working dir","tasks.detail.outputFile":"Output file","tasks.detail.command":"Command","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} events`,"tasks.detail.exit":e=>`exit ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} dropped`,"tasks.detail.error":"Error","tasks.detail.stoppedBecause":"Stopped because","tasks.detail.resumeBlocked":"Resume blocked","tasks.detail.progress":"Progress","tasks.detail.prompt":"Prompt","tasks.detail.type":"Type","tasks.detail.runtime":"Time","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"Tool calls","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool calls`,"tasks.detail.nesting":"Nesting","tasks.detail.nestingValue":e=>`Level ${(e==null?void 0:e.level)??"?"} · from ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`Level ${(e==null?void 0:e.level)??"?"}`,"tasks.row.from":e=>`from ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"nested","tips.items":"Type / to see all available commands.|Use @ to reference file paths.|Press Esc to cancel an in-flight request.|Use Shift+Enter for a newline.|Press ↑↓ to browse message history.","tools.available":"Available tools:","tools.none":"No tools available.","tools.empty":"No built-in tools available. Open a session first.","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space for details · ":""}t to toggle ${e.name} · r to refresh · Esc to close`:"r to refresh · Esc to close","tools.details.hide":"Hide details","tools.details.show":"Show details","tools.loading":"Loading tools...","tools.status.disabled":"disabled","tools.status.enabled":"enabled","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} enabled`,"tools.title":"Tools","tools.update.disable":"Disable","tools.update.enable":"Enable","tools.updating":"Updating...","tool.collapse":"▲ Collapse","tool.expand":"Expand","tool.collapseHint":"Collapse","tool.status.failed":"Failed","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`Ran ${(e==null?void 0:e.count)??0} tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.editedFiles":e=>`Edited ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.ranCommands":e=>`Ran ${(e==null?void 0:e.count)??0} command${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.readFiles":e=>`Read ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.searched":e=>`Searched ${(e==null?void 0:e.count)??0} time${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.updatedTodos":e=>`Updated task list${(e==null?void 0:e.count)===1?"":` ${(e==null?void 0:e.count)??0} times`}`,"toolGroup.summary.askedUser":"Asked user","toolGroup.summary.otherTools":e=>`Called ${(e==null?void 0:e.count)??0} other tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.running":e=>`Running ${(e==null?void 0:e.name)??"tool"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · ${(e==null?void 0:e.count)??0} tools`:""}`,"toolGroup.runningPrefix":"Running","thinking.expand":"Expand thinking","thinking.collapse":"Collapse thinking","thinking.running":e=>`Thinking${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.done":e=>e!=null&&e.duration?`Thought for ${e.duration}`:"Done thinking","sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} sessions`,"sessionsOverview.current":"Current","sessionsOverview.empty":"No sessions yet","sessionsOverview.loadFailed":"Failed to load sessions","sessionsOverview.loading":"Loading sessions…","sessionsOverview.openElsewhere":"Currently open in another window","sessionsOverview.openInSplit":"Open in split","sessionsOverview.openInSplitHint":"Show the selected sessions side by side in this window","sessionsOverview.openInTab":"Open in new tab","sessionsOverview.openInTabHint":"Open the selected sessions as a split view in a new browser tab","sessionsOverview.popupBlocked":"Pop-up blocked. Allow pop-ups for this site to open sessions in new tabs.","sessionsOverview.refresh":"Refresh","sessionsOverview.selectAll":"Select all","sessionsOverview.splitCap":e=>`Only the first ${(e==null?void 0:e.max)??6} selected sessions will open in the split.`,"sessionsOverview.selectSession":e=>`Select ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"Idle","sessionsOverview.status.needsApproval":"Needs approval","sessionsOverview.status.running":"Running","sessionsOverview.title":"Session Overview","splitView.title":"Split View","splitView.count":e=>`${(e==null?void 0:e.count)??0} panes`,"splitView.addPane":"Add session","splitView.closePane":"Close pane","splitView.paneError":"This session pane hit an error","splitView.paneConnectionError":"Connection lost","splitView.outerApprovalPending":"Your main session is waiting for approval.","splitView.goToApproval":"Go to it","splitView.empty":"No sessions in the split. Add one to get started.","splitView.composerPlaceholder":"Message this session…","settings.title":"Settings","settings.loading":"Loading settings...","settings.empty":"No settings available.","settings.footer":"↑↓ Navigate  Enter Toggle  Tab Scope  r Reload  ESC Close","settings.footer.edit":"Enter Save  ESC Cancel","settings.footer.theme":"↑↓ Navigate  Enter Select  ESC Back","settings.scope.user":"User","settings.scope.workspace":"Workspace","settings.value.on":"ON","settings.value.off":"OFF","settings.action.edit":"Edit","settings.action.save":"Save","settings.modifiedIn":e=>`(Modified in ${(e==null?void 0:e.scope)??""})`,"settings.alsoModifiedIn":e=>`(Also modified in ${(e==null?void 0:e.scope)??""})`,"settings.invalidNumber":"Invalid number","settings.readOnly":"User-scope settings are read-only in daemon mode.","settings.requiresRestart":"This change requires a restart to take effect.","settings.corrupted":e=>`Settings file was corrupted${(e==null?void 0:e.recovered)==="true"?" (recovered from backup)":""}`,"settings.label.ui.chatWidth":"Chat width","settings.description.ui.chatWidth":"Frontend-only chat content width. Stored in this browser.","settings.option.ui.chatWidth.1000":"Regular","settings.option.ui.chatWidth.wide":"Ultra wide","settings.label.visionModel":"Vision Model","settings.description.visionModel":"Image-capable model used as the vision bridge. Leave empty to auto-select.","welcome.changeModel":"(/model to change)","welcome.defaultModel":"unknown model","welcome.modeHint":"Shift+Tab or /approval-mode","welcome.prompt":"What would you like to do?","welcome.titlePrefix":"Welcome to","welcome.tipLabel":"Tips:"},DY={...bS,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.grep":"搜索内容","toolName.grep_search":"搜索内容","toolName.glob":"Glob","toolName.run_shell_command":"运行命令","toolName.todo_write":"任务清单","toolName.save_memory":"保存记忆","toolName.agent":"Agent","toolName.skill":"查看技能","toolName.enter_plan_mode":"进入计划模式","toolName.exit_plan_mode":"退出计划模式","toolName.web_fetch":"网络搜索","toolName.webfetch":"网络搜索","toolName.fetch":"网络搜索","toolName.web_search":"网络搜索","toolName.list_directory":"列出文件","toolName.lsp":"LSP","toolName.ask_user_question":"询问用户","toolName.cron_create":"创建定时任务","toolName.cron_list":"定时任务列表","toolName.cron_delete":"删除定时任务","toolName.task_create":"创建任务","toolName.task_update":"更新任务","toolName.task_list":"任务列表","toolName.task_stop":"停止任务","toolName.team_create":"创建团队","toolName.team_delete":"删除团队","toolName.send_message":"发送消息","toolName.structured_output":"结构化输出","toolName.monitor":"监控","toolName.notebook_edit":"编辑 Notebook","toolName.tool_search":"工具搜索","toolName.enter_worktree":"进入 Worktree","toolName.exit_worktree":"退出 Worktree","toolName.workflow":"工作流","toolName.bash":"运行命令","toolName.shell":"Shell 命令","toolName.read":"读取文件","toolName.readfile":"读取文件","toolName.write":"写入文件","toolName.writefile":"写入文件","toolName.search":"搜索内容","toolName.todowrite":"任务清单","toolName.savememory":"保存记忆","toolName.askuserquestion":"询问用户","toolName.toolsearch":"工具搜索","about.auth":"认证","about.baseUrl":"Base URL","about.fastModel":"快速模型","about.memoryUsage":"内存使用","about.model":"模型","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"操作系统","about.proxy":"代理","about.qwenCode":"Qwen Code","about.runtime":"运行环境","about.sandbox":"沙箱","about.sessionId":"会话 ID","about.title":"状态","agent.back":"返回","agent.builtInBadge":"（内置）","agent.action.delete":"删除智能体","agent.action.edit":"编辑智能体","agent.action.view":"查看智能体","agent.chooseAction":e=>`选择操作：${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"选择操作","agent.colorLabel":"颜色：","agent.colorUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的颜色`,"agent.create":"创建新的智能体","agent.create.button":"创建智能体","agent.create.confirm":"确认并保存","agent.create.desc":"创建新的智能体","agent.create.descPlaceholder":"这个智能体做什么？","agent.create.describeAgent":"描述您的子智能体","agent.create.description":"描述","agent.create.editAgain":"编辑","agent.create.enterDescription":"输入描述","agent.create.enterName":"输入子智能体名称","agent.create.enterPrompt":"输入系统提示词","agent.create.generateFailed":e=>`生成子智能体失败：${(e==null?void 0:e.error)??"未知错误"}`,"agent.create.generatingConfig":"正在生成子智能体配置...","agent.create.loading":"创建中...","agent.create.location":"选择位置","agent.create.method":"选择生成方式","agent.create.method.manual":"手动创建","agent.create.method.qwen":"使用 Qwen Code 生成","agent.create.method.qwen.recommended":"使用 Qwen Code 生成（推荐）","agent.create.method.qwen.desc":"LLM 生成名称、提示词和描述","agent.create.name":"名称","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"输入此子智能体清晰且唯一的名称。","agent.create.project":"项目","agent.create.project.cli":"项目级 (.qwen/agents/)","agent.create.project.desc":"创建项目级智能体","agent.create.prompt":"系统提示词","agent.create.promptPlaceholder":"你是一个专门的智能体...","agent.create.promptPlaceholder.cli":"例如：你是一名专业的代码审查员...","agent.create.promptHelp":"编写定义此子智能体行为的系统提示词。为了获得最佳效果，请全面描述。","agent.create.preview":"预览","agent.create.qwenHint":"描述此子智能体应该做什么以及何时使用它。（为了获得最佳效果，请全面描述）","agent.create.qwenPlaceholder":"> 例如：专业的代码审查员，根据最佳实践审查代码...","agent.create.required":"名称、描述和系统提示词均为必填项。","agent.create.save":"保存智能体","agent.create.scope":"选择智能体的保存位置","agent.create.manualDescHelp":"描述此子智能体应该在何时以及如何使用。","agent.create.manualDescPlaceholder":"例如：根据最佳实践和潜在 bug 审查代码。","agent.create.toolsSelection":"选择工具","agent.create.tools.all":"所有工具","agent.create.tools.allDefault":"所有工具（默认）","agent.create.tools.allInfo":"已选择所有工具，包括 MCP 工具","agent.create.tools.allInfoFallback":"已选择所有工具，包括 MCP 工具","agent.create.tools.editLabel":"• 编辑工具:","agent.create.tools.executionLabel":"• 执行工具:","agent.create.tools.none":"（无）","agent.create.tools.readEdit":"读取和编辑工具","agent.create.tools.readEditExecute":"读取、编辑和执行工具","agent.create.tools.readOnlyLabel":"• 只读工具:","agent.create.tools.readOnly":"只读工具","agent.create.tools.selected":"已选择的工具:","agent.create.user":"用户","agent.create.user.cli":"用户级 (~/.qwen/agents/)","agent.create.user.desc":"创建用户级智能体","agent.createFirstHint":"使用 '/agents create' 创建第一个智能体。","agent.created":e=>`已创建 ${(e==null?void 0:e.name)??""}`,"agent.delete":"删除","agent.delete.confirm":e=>`确定要删除 "${(e==null?void 0:e.name)??""}" 吗？`,"agent.delete.loading":"删除中...","agent.delete.no":"否","agent.delete.title":e=>`删除 ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"是，删除","agent.deleted":e=>`已删除 ${(e==null?void 0:e.name)??""}`,"agent.edit":"编辑","agent.edit.color":"编辑颜色","agent.edit.tools":"编辑工具","agent.editColorTitle":e=>`编辑颜色：${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`编辑 ${(e==null?void 0:e.name)??""}`,"agent.empty":"未找到智能体。","agent.footer.back":"Esc 返回","agent.footer.cliBack":"Enter 选择 · ↑↓ 导航 · Esc 返回","agent.footer.cliSelect":"Enter 选择 · ↑↓ 导航 · Esc 关闭","agent.footer.close":"Esc 关闭","agent.footer.deleteConfirm":"Enter 确认，Esc 取消","agent.footer.enterNext":"按 Enter 继续，Esc 返回","agent.footer.generating":"Esc 取消","agent.footer.createLocation":"按 Enter 继续，↑↓ 导航，Esc 取消","agent.footer.createContinue":"按 Enter 继续，↑↓ 导航，Esc 返回","agent.footer.final":"按 Enter 保存，e 保存并编辑，Esc 返回","agent.footer.nav":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navBack":"↑↓ 导航 · Enter 选择 · Esc 返回","agent.footer.navSelect":"↑↓ 导航 · Enter 选择 · Esc 关闭","agent.footer.viewerBack":"Esc 返回","agent.filePathLabel":"文件路径：","agent.label":"智能体","agent.location":"位置","agent.level.builtin":"内置","agent.level.extension":"扩展","agent.level.project":"项目","agent.level.user":"用户","agent.manage":"管理","agent.manage.desc":"管理已有智能体","agent.modelLabel":"模型：","agent.overriddenBadge":"（已被项目级智能体覆盖）","agent.readonly":"该智能体是只读的。","agent.select":"请选择一个智能体。","agent.selectAction":"选择操作","agent.descriptionLabel":"描述：","agent.systemPromptLabel":"系统提示词：","agent.step":e=>`步骤 ${(e==null?void 0:e.n)??""}`,"agent.tools":"工具","agent.toolsLabel":"工具：","agent.toolsUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的工具`,"agent.usingCount":e=>`使用中：${(e==null?void 0:e.count)??0} 个智能体`,"agent.view":"查看","agents.closed":"智能体面板已关闭。","agents.title":"智能体","subagent.result":"结果","subagent.tools":e=>`工具 (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"subagent.toggleStream":"展开/收起子智能体详情","subagent.pending":"等待中","subagent.running":"运行中","timeline.parallelAgents":"并行智能体","timeline.thinking":"思考","timeline.assistantUpdate":"助手更新","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} 个工具调用`,"timeline.planUpdate":"计划更新","timeline.statusUpdate":"状态更新","timeline.userTurn":"用户轮次","timeline.planDetail":"计划更新","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} 个并行智能体`,"timeline.noActivity":"无活动","timeline.sessionTimeline":"会话时间线","timeline.turnPrefix":e=>`第 ${(e==null?void 0:e.index)??0} 轮`,"timeline.currentTurn":"当前轮次","timeline.kind.thought":"思考","timeline.kind.commentary":"助手更新","timeline.kind.tool":"工具调用","timeline.kind.agents":"并行智能体","timeline.kind.plan":"计划更新","timeline.kind.status":"状态更新","timeline.kind.none":"轮次","common.copy":"复制","common.na":"不适用","common.server":"服务器","common.agent":"智能体","common.auto":"自动","common.runtime":"运行时","common.failedToLoad":"加载失败","auth.notSet":"（未设置）","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"模型ID-1, 模型ID-2","model.usingModel":e=>`正在使用${e!=null&&e.isRuntime?"运行时":""}模型：${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid（错误）","user.uploadedImage":e=>`用户上传的图片 ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"未检测到语音。","voice.stopDictation":"停止语音输入","voice.transcribing":"正在转录…","voice.starting":"正在启动…","voice.errorRetry":e=>`语音错误 — 点击重试${e!=null&&e.message?`：${e.message}`:""}`,"voice.noSpeechRetry":"未检测到语音 — 点击重试","voice.startDictation":"开始语音输入","voice.error":"语音错误","resume.failedToLoad":"加载会话失败","toast.dismiss":"关闭通知","toast.dismissShort":"关闭","insight.ready":"Insight 报告已生成！","request.cancelled":"请求已取消。","approval.execQuestion":e=>`允许执行：'${(e==null?void 0:e.tool)??""}'？`,"approval.changeQuestion":"是否继续？","approval.launchAgentQuestion":"启动这个 agent？","approval.option.allowOnce":"是，允许一次","approval.option.rejectOnce":"拒绝","approval.option.allowAllEdits":"允许所有编辑","approval.option.allowAlwaysProject":"项目内始终允许","approval.option.allowAlwaysUser":"对此用户始终允许","approval.option.allowAlwaysServer":"对此服务始终允许","approval.option.allowAlwaysTool":"对此工具始终允许","assistant.branch":"分叉","assistant.copy":"复制","at.category.extensions":"扩展","at.category.extensions.description":"引用已启用扩展","at.category.files":"文件","at.category.files.description":"引用工作区文件","at.category.mcpResources":"MCP 资源","at.category.mcpResources.description":"引用 MCP server 资源","at.menu":"引用菜单","common.back":"返回","common.cancel":"取消","common.close":"关闭","common.fullscreen":"全屏","common.exitFullscreen":"退出全屏","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.save":"保存","common.navigate":"↑↓ 导航","common.next":"下一步","common.noResults":"无结果","common.previous":"上一步","common.refresh":"刷新","common.search":"搜索","common.valid":"有效","common.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"agent.count":e=>`${(e==null?void 0:e.count)??0} 个智能体`,"askUser.submit":"提交","askUser.ignore":"忽略","askUser.multiHint":"可多选","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} 个问题`,"askUser.selectAnswer":"选择一个答案","askUser.typePlaceholder":"输入内容...","copy.failedFallback":"复制到剪贴板失败","copy.inlineLatexMissing":"最后一条 AI 输出中没有匹配的行内 LaTeX 表达式。","copy.latexMissing":"最后一条 AI 输出中没有匹配的 LaTeX 块。","copy.noOutput":"历史记录中没有可复制的输出","copy.noText":"最后一条 AI 输出没有可复制的文本。","copy.codeMissing":"最后一条 AI 输出中没有匹配的代码块。","copy.outputCopied":"已复制最后一条输出到剪贴板","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"内容"} 已复制到剪贴板`,"code.copy":"复制","code.copied":"已复制！","echartsChart.defaultTitle":"图表加载中","echartsChart.noData":"暂无数据","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行，${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:n>0?`显示 ${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行`},"echartsChart.rendering":"正在渲染图表","echartsChart.runtimeUnavailable":"图表运行时不可用。","echartsChart.renderFailed":"图表渲染失败。","echartsChart.viewMode":"视图模式","echartsChart.showChart":"显示图表","echartsChart.showData":"显示数据","echartsChart.chart":"图表","echartsChart.data":"数据","markdownTable.blank":"(空白)","markdownTable.column":e=>`第 ${(e==null?void 0:e.index)??""} 列`,"markdownTable.rows":e=>`${(e==null?void 0:e.count)??0} 行`,"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} 行`,"markdownTable.hint":"点击表头排序，点击 ▾ 打开筛选。","markdownTable.filtersActive":e=>`${(e==null?void 0:e.count)??0} 个筛选`,"markdownTable.cellsSelected":e=>`${(e==null?void 0:e.count)??0} 个单元格已选中`,"markdownTable.copyTsv":"复制 TSV","markdownTable.copyVisible":"快捷复制","markdownTable.freezeFirstColumn":"冻结首列","markdownTable.unfreezeFirstColumn":"取消冻结首列","markdownTable.hideColumn":"隐藏列","markdownTable.showHiddenColumns":e=>`显示 ${(e==null?void 0:e.count)??0} 个隐藏列`,"markdownTable.moveColumn":e=>`移动 ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`调整 ${(e==null?void 0:e.column)??""} 列宽`,"markdownTable.rowDetails":"详情","markdownTable.rowDetailsAria":e=>`查看第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.closeRowDetailsAria":e=>`收起第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.detailsHeader":"单行详情","markdownTable.actions":"操作","markdownTable.sortByColumn":e=>`按 ${(e==null?void 0:e.column)??""} 排序`,"markdownTable.sortByColumnAsc":e=>`${(e==null?void 0:e.column)??""} 已升序排序`,"markdownTable.sortByColumnDesc":e=>`${(e==null?void 0:e.column)??""} 已降序排序`,"markdownTable.filterColumn":e=>`筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.empty":"此表格没有数据。","markdownTable.emptyFiltered":"没有符合筛选条件的行。","markdownTable.sort.asc":"升序排序","markdownTable.sort.desc":"降序排序","markdownTable.sort.clear":"清除排序","markdownTable.filter.searchPlaceholder":"搜索筛选值","markdownTable.filter.searchAria":e=>`搜索 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.selectVisible":"全选当前结果","markdownTable.filter.optionLimit":e=>`已显示前 ${(e==null?void 0:e.count)??0} 项，请搜索缩小范围`,"markdownTable.filter.noOptions":"没有匹配项","markdownTable.filter.custom":"自定义筛选","markdownTable.filter.numberAria":e=>`数字筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.textAria":e=>`文本筛选 ${(e==null?void 0:e.column)??""}`,"markdownTable.filter.numberPlaceholder":"数值","markdownTable.filter.toPlaceholder":"到","markdownTable.filter.textPlaceholder":"输入筛选条件","markdownTable.filter.reset":"重置","markdownTable.filter.cancel":"取消","markdownTable.filter.confirm":"确认","markdownTable.filter.text.contains":"包含","markdownTable.filter.text.equals":"等于","markdownTable.filter.text.notEquals":"不等于","markdownTable.filter.text.startsWith":"开头是","markdownTable.filter.text.endsWith":"结尾是","markdownTable.filter.number.gt":"大于","markdownTable.filter.number.gte":"大于等于","markdownTable.filter.number.lt":"小于","markdownTable.filter.number.lte":"小于等于","markdownTable.filter.number.between":"区间","mermaid.rendering":"正在渲染图表...","mermaid.viewCode":"</>","mermaid.viewDiagram":"⊞","contextUsage.active":"已激活","contextUsage.autocompactBuffer":"自动压缩缓冲区","contextUsage.bodyLoaded":"已加载正文","contextUsage.builtinTools":"内置工具","contextUsage.contextWindow":"上下文窗口","contextUsage.detailHint":"运行 /context detail 查看逐项明细。","contextUsage.estimatedOverhead":"预估的对话前开销","contextUsage.free":"空闲","contextUsage.memoryFiles":"Memory 文件","contextUsage.messages":"消息","contextUsage.mcpTools":"MCP 工具","contextUsage.model":"模型","contextUsage.noSession":"当前还没有会话。请先发送第一条消息，再查看上下文使用情况。","contextUsage.noApiResponse":"尚无 API 响应。发送一条消息后可查看实际使用量。","contextUsage.overLimit":"上下文已超过限制！请使用 /compress 或 /clear 减少占用。","contextUsage.skills":"Skills","contextUsage.systemPrompt":"系统提示词","contextUsage.title":"上下文使用情况","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"按类别统计","contextUsage.used":"已用","daemon.title":"Daemon 状态","daemon.details.loading":"正在加载诊断信息...","daemon.details.failed":"诊断信息加载失败。","daemon.refresh":"刷新","daemon.loading":"正在加载 Daemon 状态...","daemon.loadFailed":"加载 Daemon 状态失败","daemon.updatedAt":e=>`更新于 ${(e==null?void 0:e.time)??""}`,"daemon.none":"无","daemon.level.ok":"正常","daemon.level.warning":"警告","daemon.level.error":"错误","daemon.level.unavailable":"不可用","daemon.issues.title":"问题","daemon.overview.title":"Daemon","daemon.overview.version":"版本","daemon.overview.pid":"PID","daemon.overview.mode":"模式","daemon.overview.uptime":"运行时长","daemon.overview.workspace":"工作区","daemon.runtime.title":"运行时","daemon.runtime.activeSessions":"活跃会话","daemon.runtime.activePrompts":"执行中的 prompt","daemon.runtime.idle":"空闲时长","daemon.runtime.noActivity":"暂无活动","daemon.runtime.pendingPermissions":"待审批权限","daemon.runtime.permissionPolicy":"权限策略","daemon.runtime.channel":"ACP 通道","daemon.runtime.channelLive":"在线","daemon.runtime.channelDown":"离线","daemon.runtime.startingUp":"运行时启动中...","daemon.runtime.startFailed":"运行时启动失败","daemon.runtime.channelWorker":"通道 Worker","daemon.runtime.channelWorkerRestarts":"Worker 重启次数","daemon.runtime.memory":"内存 (RSS / 堆)","daemon.transport.title":"传输","daemon.transport.restSse":"REST SSE 流","daemon.transport.acpDisabled":"ACP 传输未启用","daemon.transport.acpConnections":"ACP 连接","daemon.transport.acpStreams":"ACP 流 (会话/SSE/WS)","daemon.transport.pendingRequests":"待处理客户端请求","daemon.transport.rateLimitRejected":"限流拒绝数","daemon.security.title":"安全","daemon.security.token":"Bearer 令牌","daemon.security.requireAuth":"强制鉴权","daemon.security.loopback":"回环绑定","daemon.security.allowOrigin":"允许来源","daemon.security.shell":"会话 Shell 命令","daemon.security.configured":"已配置","daemon.security.notConfigured":"未配置","daemon.limits.title":"限制","daemon.limits.unlimited":"无限制","daemon.limits.maxSessions":"最大会话数","daemon.limits.maxPendingPrompts":"每会话最大待处理 prompt 数","daemon.limits.maxConnections":"最大监听连接数","daemon.limits.eventRing":"事件环大小","daemon.limits.promptDeadline":"Prompt 截止时间","daemon.limits.sessionIdle":"会话空闲超时","daemon.capabilities.title":"能力","daemon.capabilities.titleCount":e=>`能力 (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"会话","daemon.full.sessions.empty":"无活跃会话","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} 个待处理 prompt`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} 个待审批权限`,"daemon.full.session.prompting":"执行中","daemon.full.workspace.title":"工作区诊断","daemon.full.workspace.empty":"未上报工作区诊断","daemon.full.auth.title":"认证","daemon.full.auth.providers":"设备码登录提供方","daemon.full.auth.pending":"进行中的设备码登录","daemon.full.acp.title":"ACP 连接","daemon.tab.overview":"概览","daemon.tab.usage":"用量","daemon.tab.metrics":"指标","daemon.tab.diagnostics":"诊断","daemon.charts.title":"指标图表","daemon.charts.empty":"正在采集指标…首次采样后显示图表。","daemon.charts.concurrency":"并发","daemon.charts.activePrompts":"执行中任务","daemon.charts.activeSessions":"会话","daemon.charts.requests":"请求数","daemon.charts.reqTotal":"总数","daemon.charts.reqErrors":"错误","daemon.charts.apiLatency":"API 耗时","daemon.charts.promptLatency":"Prompt 延迟","daemon.charts.queueWait":"排队等待","daemon.charts.promptDuration":"端到端","daemon.charts.eventLoop":"事件循环延迟","daemon.charts.eventLoopLag":"延迟 p99","daemon.charts.queuedPrompts":"排队中","daemon.charts.reqRejected":"限流拒绝","daemon.charts.llmLatency":"LLM 耗时","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC 管道","daemon.charts.pipeIn":"接收","daemon.charts.pipeOut":"发送","daemon.charts.connections":"连接数","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"子进程","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"子进程 RSS","daemon.charts.memory":"内存","daemon.charts.heap":"堆","daemon.charts.tokens":"Token 消耗","daemon.charts.tokensIn":"输入","daemon.charts.tokensOut":"输出","daemon.charts.peak":"峰值","daemon.usage.today":"今日","daemon.usage.period7d":"7天","daemon.usage.period30d":"30天","daemon.usage.rangeWeek":"近 7 天","daemon.usage.rangeMonth":"近 30 天","daemon.usage.rangeGroup":"统计周期","daemon.usage.tokensConsumed":"tokens 消耗","daemon.usage.sessions":"会话","daemon.usage.requests":"请求","daemon.usage.tools":"工具","daemon.usage.changes":"改动","daemon.usage.breakdownTitle":"Token 拆分","daemon.usage.inputTokens":"输入 tokens","daemon.usage.inputHint":"请求 + 缓存读取","daemon.usage.outputTokens":"输出 tokens","daemon.usage.outputHint":"响应 + 推理","daemon.usage.cacheRead":"缓存读取","daemon.usage.cacheHint":"缓存读取占比","daemon.usage.heatmapTitle":"Token 热力图","daemon.usage.heatmapSub":e=>`最近 ${(e==null?void 0:e.months)??12} 个月 · 每日 token 汇总`,"daemon.usage.low":"少","daemon.usage.high":"多","daemon.usage.dowMon":"一","daemon.usage.dowWed":"三","daemon.usage.dowFri":"五","daemon.usage.empty":"暂无 token 使用记录。","daemon.usage.loading":"加载用量中…","daemon.usage.failed":"加载用量失败","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"今日","daemon.usage.rangeWordWeek":"7 天","daemon.usage.rangeWordMonth":"30 天","daemon.usage.modelShareTitle":"模型份额","daemon.usage.modelShareSub":"token 份额 · 浅绿表示缓存读取","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · 缓存 ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"技能调用","daemon.usage.skillSub":"技能名 / 次数","daemon.usage.skillName":"技能名","daemon.usage.skillCount":"次数","daemon.usage.dailyTokensTitle":"Tokens","daemon.usage.dailyTokensSub":"每日 token 总量","daemon.usage.dailySessionsTitle":"会话","daemon.usage.dailySessionsSub":"每日活跃会话数","delete.cannotCurrent":"无法删除当前活动会话。","delete.action":"删除","delete.deleted":"会话已删除。","delete.deletedCount":e=>`已删除 ${(e==null?void 0:e.count)??0} 个会话。`,"delete.deleting":"删除中...","delete.failed":e=>`删除会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ 导航 · Space 选择 · Enter 删除 · Esc 取消","delete.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"delete.none":"没有可删除的会话","delete.allFailed":e=>`删除 ${(e==null?void 0:e.count)??0} 个会话失败: ${(e==null?void 0:e.reason)??"未知错误"}`,"delete.nonRemoved":"没有会话被删除。","delete.notFound":"会话未找到，可能已被删除。","delete.partialFail":e=>`已删除 ${(e==null?void 0:e.removed)??0} 个，${(e==null?void 0:e.failed)??0} 个失败: ${(e==null?void 0:e.detail)??"未知错误"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"delete.pressSearch":"按 / 搜索；Space 选择；Enter 删除","delete.selected":e=>`已选 ${(e==null?void 0:e.count)??0} 个`,"delete.title":"删除会话","time.justNow":"刚刚","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} 分钟前`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0} 小时前`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0} 天前`,"dialog.footer.close":"Esc 关闭","dialog.footer.confirmCancel":"Enter 确认 · Esc 取消","release.cannotCurrent":"不能释放当前活动会话。","release.action":"释放","release.released":"会话已释放。","release.failed":e=>`释放会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ 导航 · Enter 释放 · Esc 取消","release.inactive":"只有活跃的 live session 才能释放。","release.inactiveBadge":"非活跃","release.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"release.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"release.none":"没有可释放的 live session","release.pressSearch":"按 / 搜索；Enter 释放选中的 live session","release.releasing":"释放中...","release.title":"释放会话","dialog.footer.menu":"Esc 返回菜单","dialog.footer.mcpServers":"↑↓ 导航 · Enter 查看详情 · r 刷新 · Esc 关闭","dialog.footer.mcpSelect":"↑↓ 导航 · Enter 选择 · Esc 返回","dialog.footer.modelFast":"↑↓ 导航 · / 搜索 · c 自定义 · Enter 设置 fast model · Esc 取消","dialog.footer.navSelectCancel":"↑↓ 导航 · Enter 选择 · Esc 取消","dialog.footer.navSelectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","dialog.footer.navSelectMenu":"↑↓ 导航 · Enter 选择 · Esc 返回菜单","dialog.footer.navOpenClose":"↑↓ 导航 · Enter 打开 · Esc 关闭","dialog.footer.navOpenMenu":"↑↓ 导航 · Enter 打开 · Esc 返回菜单","dialog.footer.back":"Esc 返回","dialog.footer.backClose":"Esc 关闭","dialog.footer.saveClose":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 关闭","dialog.footer.saveMenu":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 返回菜单","dialog.footer.search":"输入搜索 · Enter 确认 · Esc 清空","dialog.footer.select":"Enter 选择","editor.escClearHint":"再按一次 Esc 清空","editor.hintCommands":"命令","editor.hintFiles":"文件","editor.hintNext":"下一条","editor.hintPrev":"上一条","editor.hintSearch":"搜索","editor.noHistory":"没有匹配的历史记录","editor.placeholder":"输入消息或 @ 文件路径","editor.shellPlaceholder":"请输入终端命令","editor.send":"发送消息","editor.connectionDisconnected":"连接已中断，请在恢复后重试。","editor.sessionLoading":"会话正在加载，请稍后再发送。","editor.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","quickActions.open":"更多操作","quickActions.title":"更多操作","quickActions.mcp":"MCP","quickActions.context":"上下文","quickActions.status":"运行状态","quickActions.stats":"会话统计","quickActions.memory":"记忆管理","quickActions.extensions":"扩展","quickActions.skills":"技能详情","quickActions.tools":"工具详情","quickActions.agents":"智能体","quickActions.help":"帮助","quickActions.theme":"设置主题","quickActions.auth":"认证","quickActions.settings":"设置","quickActions.new":"新建会话","quickActions.resume":"切换会话","quickActions.delete":"删除会话","quickActions.branch":"复制会话","quickActions.rewind":"回退会话","quickActions.historyQuestion":"历史提问","quickActions.recap":"生成摘要","quickActions.copy":"复制输出","quickActions.shellMode":"Shell模式","quickActions.exitShellMode":"退出Shell","quickActions.setGoal":"设置目标","session.missing":"当前会话不存在","session.new":"新建会话","scheduledTasks.title":"定时任务","scheduledTasks.subtitle":"按计划自动执行任务，也可随时手动触发。","scheduledTasks.loading":"加载中…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} 个任务`,"scheduledTasks.refresh":"刷新","scheduledTasks.new":"新建定时任务","scheduledTasks.createViaChat":"通过聊天创建","scheduledTasks.chatStarter":"帮我创建一个长期保留的定时任务，我想：","scheduledTasks.name":"名称","scheduledTasks.namePlaceholder":"可选 —— 默认取提示词","scheduledTasks.prompt":"提示词","scheduledTasks.promptPlaceholder":"这个任务要做什么？","scheduledTasks.frequency":"频率","scheduledTasks.freq.daily":"每天","scheduledTasks.freq.weekdays":"工作日","scheduledTasks.freq.weekly":"每周","scheduledTasks.freq.hourly":"每小时","scheduledTasks.freq.minutes":"每 N 分钟","scheduledTasks.freq.custom":"自定义（cron）","scheduledTasks.time":"时间","scheduledTasks.weekday":"星期","scheduledTasks.interval":"分钟","scheduledTasks.cron":"Cron 表达式","scheduledTasks.weekdayNames":"周日,周一,周二,周三,周四,周五,周六","scheduledTasks.human.daily":e=>`每天 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`工作日 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`每${(e==null?void 0:e.day)??""} ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`每小时 第 ${(e==null?void 0:e.min)??"00"} 分`,"scheduledTasks.human.everyMinutes":e=>`每 ${(e==null?void 0:e.n)??""} 分钟`,"scheduledTasks.never":"尚未运行","scheduledTasks.repeats":"重复","scheduledTasks.runsOnce":"仅一次","scheduledTasks.lastFired":e=>`上次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"立即运行","scheduledTasks.enable":"启用","scheduledTasks.disable":"停用","scheduledTasks.delete":"删除","scheduledTasks.deleteConfirm":e=>`确定删除定时任务「${(e==null?void 0:e.name)??""}」？`,"scheduledTasks.empty":"还没有定时任务，创建一个开始吧。","scheduledTasks.create":"创建","scheduledTasks.creating":"创建中…","scheduledTasks.cancel":"取消","scheduledTasks.error.invalidSchedule":"计划无效","scheduledTasks.error.emptyPrompt":"提示词不能为空","scheduledTasks.error.toggleFailed":"更新任务失败","scheduledTasks.error.deleteFailed":"删除任务失败","scheduledTasks.edit":"编辑","scheduledTasks.editTitle":"编辑定时任务","scheduledTasks.save":"保存","scheduledTasks.saving":"保存中…","scheduledTasks.runHistory":e=>`运行记录（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistory":e=>`查看对话（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistoryEmpty":"查看对话","scheduledTasks.viewHistoryHint":"打开该任务的会话查看运行详情","scheduledTasks.runKind.catchUp":"补跑","scheduledTasks.runKind.manual":"手动","scheduledTasks.error.runFailed":"记录运行失败","scheduledTasks.error.oneShotConsumedButFailed":"任务已删除,但提示词未能送达——它没有运行。请重新创建后重试。","scheduledTasks.dueNow":"即将运行","scheduledTasks.nextRunTooltip":e=>`下次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"天","scheduledTasks.dur.h":"小时","scheduledTasks.dur.m":"分","scheduledTasks.dur.s":"秒","sidebar.label":"工作区侧边栏","sidebar.toggleMenu":"切换菜单","sidebar.newChat":"新对话","sidebar.project":"项目","sidebar.projectFallback":"项目","sidebar.sessionsOverview":"会话总览","sidebar.splitView":"分屏","sidebar.settings":"设置","sidebar.daemonStatus":"Daemon 状态","sidebar.scheduledTasks":"定时任务","sidebar.collapse":"收起","sidebar.expand":"展开","sidebar.collapseProject":"收起项目","sidebar.expandProject":"展开项目","sidebar.search":"搜索会话","sidebar.searchPlaceholder":"搜索会话","sidebar.searchEmpty":"没有匹配的会话。","sidebar.rename":"重命名","sidebar.renameCurrentOnly":"暂仅支持重命名当前会话","sidebar.export":"导出对话记录","sidebar.exportFailed":"导出会话失败","sidebar.delete":"删除","sidebar.archive":"归档","sidebar.unarchive":"恢复","sidebar.moreActions":"更多操作","sidebar.archiveCurrentDisabled":"不能归档当前会话","sidebar.archivedTitle":"已归档","sidebar.archivedEmpty":"没有已归档的会话。","sidebar.archiveFailed":"归档会话失败","sidebar.unarchiveFailed":"恢复会话失败","sidebar.loadingSessions":"正在加载会话...","sidebar.loadFailed":"会话加载失败，点击重试。","sidebar.renameFailed":"重命名会话失败","sidebar.deleteFailed":"删除会话失败","sidebar.newSessionFailed":"创建新对话失败","sidebar.switchFailed":"切换会话失败","sidebar.currentDeleteDisabled":"不能删除当前会话","sidebar.deleteConfirmDescription":e=>`确定删除“${(e==null?void 0:e.name)??""}”吗？删除后不可恢复。`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"sidebar.running":"运行中","sidebar.completedUnread":"刚完成","sidebar.pin":"置顶","sidebar.unpin":"取消置顶","sidebar.sessionGroup":"分组","sidebar.groupFilter":"会话分组","sidebar.groupAll":"全部","sidebar.groupPinned":"已置顶","sidebar.groupUngrouped":"未分组","sidebar.groupRecent":"最近","sidebar.groupCreate":"新建分组","sidebar.groupRename":"重命名分组","sidebar.groupDelete":"删除分组","sidebar.groupColor":"分组颜色","sidebar.groupNamePrompt":"分组名称","sidebar.groupDeleteConfirm":e=>`确定删除分组“${(e==null?void 0:e.name)??""}”吗？`,"sidebar.groupsLoadFailed":"加载会话分组失败","sidebar.groupCreateFailed":"创建分组失败","sidebar.groupAssignFailedAfterCreate":"分组已创建，但移动会话失败","sidebar.groupUpdateFailed":"更新分组失败","sidebar.groupDeleteFailed":"删除分组失败","sidebar.organizationFailed":"更新会话组织失败","sidebar.groupColor.red":"红色","sidebar.groupColor.orange":"橙色","sidebar.groupColor.yellow":"黄色","sidebar.groupColor.green":"绿色","sidebar.groupColor.blue":"蓝色","sidebar.groupColor.purple":"紫色","quickKeys.cursor":"移动光标","quickKeys.escape":"取消运行","quickKeys.history":"切换历史","quickKeys.retry":"重试失败请求","quickKeys.searchHistory":"搜索历史","quickKeys.tab":"接受补全","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.cleared":"队列已清空。","queue.deleteTip":"移出队列","queue.editTip":"移出队列并将内容放回输入框","queue.insertTip":"将信息插入当前会话，下次模型调用生效。","queue.inserted":"已插入，下次模型调用生效。","queue.insertCommandDisabled":"命令无法插入当前回合。","queue.submitting":"提交中...","queue.editing":"编辑中...","queue.removing":"处理中...","queue.submittingDisabled":"排队消息正在提交中...","queue.commandBlocked":"当前回合运行时，Slash 命令不能进入排队。","queue.shellBlocked":"当前回合运行时，Shell 命令不能进入排队。","queue.queueFailed":"排队消息失败","queue.insertFailed":"插入排队消息失败","queue.deleteFailed":"移出队列失败","queue.editFailed":"编辑排队消息失败","queue.footer":"按 ↑ 编辑最后一条排队消息 · Esc 清空队列","queue.imageCount":e=>`（+${(e==null?void 0:e.count)??0} 张图片）`,"queue.more":e=>`...（还有 ${(e==null?void 0:e.count)??0} 条）`,"midTurn.inserted":e=>`已插入消息：${(e==null?void 0:e.message)??""}`,"help.builtIn":"内置命令","help.commandCount":e=>`${(e==null?void 0:e.count)??0} 个命令`,"help.commandMeta.builtIn":"内置","help.commandMeta.custom":"自定义","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} 个子命令`,"help.commandsIntro":"浏览内置命令：","help.customGroup":"自定义、skills、plugins、MCP","help.customIntro":"浏览自定义、skill、plugin 和 MCP 命令：","help.empty":"当前没有可用命令。","help.emptyCustom":"当前没有可用的自定义命令。","help.footer":"Tab/Shift+Tab 切换标签 · ↑/↓ 或 PgUp/PgDn 滚动 · Esc 关闭","help.intro":"Qwen Code 可以理解代码库，在你的许可下修改文件，并直接执行命令。","help.section.shortcuts":"快捷键","help.search":"搜索命令","help.shortcut.addContext":"添加文件或目录作为上下文","help.shortcut.altWords":"按词跳转","help.shortcut.clear":"清屏","help.shortcut.commandMenu":"打开命令菜单","help.shortcut.completion":"接受补全或切换帮助标签","help.shortcut.history":"切换历史 prompt 或滚动列表","help.shortcut.searchHistory":"搜索历史 prompt","help.shortcut.newline":"插入换行","help.shortcut.pasteImages":"粘贴图片","help.shortcut.shell":"运行 shell 命令","help.shortcut.togglePanel":"切换此面板","help.shortcut.retry":"重试上次请求","help.shortcut.compact":"切换紧凑模式","retry.hint":"按 Ctrl+Y 重试或点击重试","retry.none":"没有可重试的失败请求。","branch.failed":"分支会话失败。","branch.success":e=>`已复制会话，新会话名称为： "${(e==null?void 0:e.name)??""}"，当前已切换到新的会话。`,"fork.empty":"请提供任务指令。用法：/fork <指令>","fork.failed":e=>`启动后台智能体失败：${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"后台智能体未启动。","fork.started":e=>`已启动后台智能体："${(e==null?void 0:e.name)??""}"，可在后台任务中查看。`,"command.hidden":"该命令不可用。","help.shortcut.approvals":"切换审批模式","help.shortcut.cancel":"关闭弹窗或取消操作","bug.failed":"加载系统信息失败，无法提交 Bug 报告。","bug.popupBlocked":"弹窗被拦截，请允许弹窗后重试。","bug.submitted":"Bug 报告已在新标签页中打开。","clear.blocked":"流式输出中无法清屏 — 先按 Esc 取消。","error.unknown":"未知错误","error.modelStreamInterrupted":"模型响应流已中断，请重试。","shell.command":"Shell 命令","compact.enabled":"紧凑模式已开启","compact.disabled":"紧凑模式已关闭","compact.hint":"按 Ctrl+O 显示完整工具输出","compact.saveFailed":"保存紧凑模式失败","help.subcommands":"子命令","help.tab.commands":"内置命令","help.tab.custom":"自定义命令","help.tab.general":"快捷键","help.title":"帮助","slash.category.custom":"自定义","slash.category.skill":"Skill","slash.category.system":"系统","language.changed":e=>`UI 语言已切换为 ${(e==null?void 0:e.language)??""}`,"language.current":e=>`当前 UI 语言：${(e==null?void 0:e.language)??""}`,"language.invalid":"语言无效。可用值：en, zh-CN","language.options":"可用选项：","language.set":"设置 UI 语言","language.usage":"用法：/language ui [en|zh-CN]","localCommand.noSession":"当前还没有会话。请先发送第一条消息，再使用这个命令。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","local.directory":"管理工作区目录","local.docs":"打开完整的 Qwen Code 文档","local.doctor":"运行安装和环境诊断","local.dream":"整合托管的自动记忆主题文件","local.effort":"设置推理模型的思考强度","local.export":"将当前会话历史导出到文件","local.forget":"从托管的自动记忆中移除匹配的条目","local.hooks":"管理 Qwen Code 钩子","local.importConfig":"从 Claude 配置导入 MCP 服务器","local.init":"分析项目并创建 QWEN.md 文件","local.insight":"根据聊天历史生成编程洞察","local.lsp":"显示 LSP 服务器状态","local.remember":"将持久记忆保存到记忆系统","local.summary":"生成项目摘要文件","local.workflows":"列出进行中和已完成的工作流运行","skilldesc.batch":"并行批量处理多个文件","skilldesc.dataviz":"图表与数据可视化设计指南","skilldesc.extensionCreator":"创建、测试和定制 Qwen Code 扩展","skilldesc.loop":"按计划或自定节奏循环运行提示词","skilldesc.newApp":"从零构建新应用的工作流","skilldesc.qcHelper":"解答 Qwen Code 使用相关问题","skilldesc.review":"审查代码变更的正确性、安全、质量与性能","skilldesc.simplify":"清理近期代码变更（复用与精简）","skilldesc.stuck":"诊断卡死或缓慢的 Qwen Code 会话","skilldesc.agentReproduceAlign":"将已移植的 Codex/Claude Code 功能与原版对齐","skilldesc.agentReproduceFeature":"复现 Codex/Claude Code 的现有功能","skilldesc.autofix":"实现已批准的 issue 或处理 PR 审查反馈","skilldesc.bugfix":"按先复现流程修复 GitHub issue 中的 bug","skilldesc.codegraph":"通过图数据库和向量索引分析代码库","skilldesc.createIssue":"根据想法或 bug 描述起草并提交 GitHub issue","skilldesc.desktopPet":"为 Qwen Code 创建像素风桌面宠物","skilldesc.docsAuditAndRefresh":"对照代码库审计并刷新 docs/ 文档","skilldesc.docsUpdateFromDiff":"按本地 git diff 更新官方文档","skilldesc.e2eTesting":"运行 Qwen Code CLI 的端到端测试","skilldesc.featDev":"实现非平凡功能的端到端工作流","skilldesc.memoryLeakDebug":"用堆快照诊断 CLI 内存泄漏","skilldesc.openworkDesktopSync":"将 packages/desktop 与 openwork 逐提交同步","skilldesc.preparePr":"从当前分支准备 GitHub PR 标题和正文","skilldesc.qwenCodeClaw":"将 Qwen Code 用作代码理解智能体","skilldesc.structuredDebugging":"假设驱动的疑难 bug 调试方法","skilldesc.terminalCapture":"自动化终端 UI 截图测试","skilldesc.tmuxRealUserTesting":"用 tmux 做真实用户测试并保存日志","skilldesc.triage":"把关和审查 Qwen Code 的 issue 与 PR","local.approvalMode":"切换审批模式","local.auth":"连接 LLM provider","auth.title":"连接 Provider","auth.step.group":"类型","auth.step.provider":"供应商","auth.step.protocol":"协议","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"模型 ID","auth.step.advanced":"高级配置","auth.protocol.openai":"OpenAI 兼容","auth.protocol.openaiDesc":"标准 OpenAI API 格式（最常用）","auth.protocol.anthropic":"Anthropic 兼容","auth.protocol.anthropicDesc":"Anthropic Messages API 格式","auth.protocol.gemini":"Gemini 兼容","auth.protocol.geminiDesc":"Google Gemini API 格式","auth.apiKeyRequired":"API key 不能为空。","auth.baseUrlInvalid":"Base URL 必须以 http:// 或 https:// 开头。","auth.baseUrlPrompt":"输入此协议的 API endpoint。","auth.baseUrlRequired":"Base URL 不能为空。","auth.documentation":"文档","auth.modelsRequired":"模型 ID 不能为空。","auth.review":"确认","auth.reviewText":"以下 JSON 将保存到 settings.json：","auth.save":"保存","auth.saving":"正在保存...","auth.termsTitle":"服务条款和隐私声明","auth.continue":"继续","auth.modelsPrompt":e=>`输入以逗号分隔的模型 ID。例如：${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"可选：配置高级生成设置。","auth.advanced.thinking":"启用 thinking","auth.advanced.thinkingDesc":"允许模型在回复前进行扩展推理。","auth.advanced.modality":"启用多模态","auth.advanced.modalityDesc":"启用图片、视频等多模态输入能力。","auth.advanced.modalityImage":"图片","auth.advanced.modalityVideo":"视频","auth.advanced.modalityAudio":"音频","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"上下文窗口","auth.advanced.contextDesc":"最大输入 token 数（留空则根据模型名称自动检测）。","auth.advanced.contextPlaceholder":"上下文窗口（可选）","local.btw":"快速问一个不影响主对话的侧边问题。用法：/btw <your question>","btw.empty":"请提供一个问题。用法：/btw <你的问题>","btw.emptyAnswer":"未收到回答。","btw.failed":"回答 btw 问题失败","btw.answering":"+ 正在回答...","btw.shortcuts.pending":"按 Escape、Ctrl+C 或 Ctrl+D 取消","btw.shortcuts.done":"按 Space、Enter 或 Escape 关闭","local.clear":"以空上下文开始新会话；之前的会话会保留在磁盘上（可用 /resume 恢复）","local.context":'显示上下文窗口使用情况明细。使用 "/context detail" 查看逐项明细',"local.copy":"复制最后输出或代码片段","local.delete":"永久删除会话","local.release":"释放 live session","local.rewind":"回退当前会话","local.branch":"将当前对话分叉到新会话","local.fork":"基于当前对话启动后台智能体","local.help":"查看帮助和可用命令","local.language":"切换 UI 语言","local.mcp":"管理 MCP servers","local.memory":"管理 memory","local.model":"切换模型或设置 fast model","local.new":"开始新对话","local.plan":"进入 Plan 模式","local.goal":"设置目标并持续工作直到完成","local.recap":"生成会话摘要","recap.label":"回顾","recap.loading":"正在生成摘要...","recap.empty":"对话内容还不够，暂时无法生成摘要。","recap.failed":"生成摘要失败","rewind.action":"回退","rewind.confirm":"确认回退","rewind.empty":"当前会话没有可回退的快照。","rewind.failed":e=>`回退会话失败：${(e==null?void 0:e.reason)??""}`,"rewind.loading":"正在加载可回退的 prompt...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"回退中...","rewind.subtitle":"仅回退会话，不涉及文件。","rewind.title":"回退会话","rewind.turn":e=>`第 ${(e==null?void 0:e.turn)??0} 个 prompt`,"local.rename":"重命名当前会话","rename.empty":"请输入会话名称，例如 /rename 项目调试，或使用 /rename --auto。","rename.success":e=>`会话已重命名为 ${(e==null?void 0:e.name)??""}`,"local.reset":"重置当前对话","local.resume":"恢复历史会话","local.skills":"查看可用 skills","local.stats":"查看会话统计","local.tasks":"查看后台任务","local.status":"查看版本信息","local.theme":"切换主题","local.settings":"查看和编辑设置","local.schedule":"管理定时任务","local.extensions":"管理扩展。用法: /extensions manage|install <source>","extensions.label":"扩展","extensions.action.failed":e=>`扩展操作失败${e!=null&&e.name?`（${e.name}）`:e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.commands.refreshFailed":"刷新扩展命令失败。","extensions.install.failed":e=>`安装扩展失败${e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.manage.agents":"智能体：","extensions.manage.checkingUpdates":"正在检查更新...","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":e=>`已安装 ${(e==null?void 0:e.count)??0} 个扩展`,"extensions.manage.detailsTitle":"扩展详情","extensions.manage.disable":"禁用扩展","extensions.manage.disabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已禁用。`,"extensions.manage.empty":"未安装扩展。","extensions.manage.enable":"启用扩展","extensions.manage.enabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已启用。`,"extensions.manage.footer.back":"Esc 返回","extensions.manage.footer.confirm":"Enter 确认 · Esc 取消","extensions.manage.footer.list":"↑↓ 导航 · Enter 选择 · r 刷新 · Esc 关闭","extensions.manage.footer.select":"↑↓ 导航 · Enter 选择 · Esc 返回","extensions.manage.loading":"正在加载扩展...","extensions.manage.mcpServers":"MCP servers：","extensions.manage.name":"名称：","extensions.manage.notUpdatable":"不可更新","extensions.manage.path":"路径：","extensions.manage.queued":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 的操作已提交。`,"extensions.manage.refreshed":e=>`已刷新 ${(e==null?void 0:e.refreshed)??0} 个 session，${(e==null?void 0:e.failed)??0} 个失败。`,"extensions.manage.settings":"设置：","extensions.manage.skills":"Skills：","extensions.manage.source":"来源：","extensions.manage.status":"状态：","extensions.manage.status.disabled":"已禁用","extensions.manage.status.enabled":"已启用","extensions.manage.title":"管理扩展","extensions.manage.unknownUpdate":"未知","extensions.manage.uninstalled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已卸载。`,"extensions.manage.uninstallAction":"卸载扩展","extensions.manage.uninstallConfirm":e=>`确定卸载扩展 "${(e==null?void 0:e.name)??"扩展"}"？`,"extensions.manage.upToDate":"已是最新","extensions.manage.update":"更新扩展","extensions.manage.updateAvailable":"有可用更新","extensions.manage.updateError":"检查更新失败","extensions.manage.updated":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新。`,"extensions.manage.updatedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已更新到 v${(e==null?void 0:e.version)??""}。`,"extensions.manage.version":"版本：","extensions.manage.viewDetails":"查看详情","extensions.install.installed":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已安装。`,"extensions.install.installedWithVersion":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" v${(e==null?void 0:e.version)??""} 已安装。`,"extensions.install.missingOptionValue":e=>`${(e==null?void 0:e.option)??"选项"} 缺少值`,"extensions.install.requestFailed":"安装扩展失败","extensions.install.started":e=>`正在从 "${(e==null?void 0:e.source)??""}" 安装扩展...`,"extensions.install.unknownOption":e=>`未知选项 ${(e==null?void 0:e.option)??""}`,"extensions.install.usage":"用法: /extensions manage|install <source>","extensions.install.waitForSession":"等待会话连接后再安装扩展。","local.tools":"列出可用工具。用法: /tools [desc]","loadWarning.commands":"命令列表加载失败，斜杠命令可能不完整。","loadWarning.context":"会话上下文加载失败，当前模式可能不准确。","loadWarning.models":"模型列表加载失败，部分模型详情可能不可用。","mcp.action.auth":"认证","mcp.action.authHint":"daemon 尚未暴露","mcp.action.authMessage":"daemon serve 尚未暴露 MCP 认证能力。","mcp.action.clearAuth":"清空认证","mcp.action.disable":"禁用","mcp.action.done":e=>`${(e==null?void 0:e.action)??"操作"}完成。`,"mcp.action.enable":"启用","mcp.action.enableMessage":"daemon serve 尚未暴露 MCP 启用/禁用能力。","mcp.action.failed":e=>`失败：${(e==null?void 0:e.error)??""}`,"mcp.action.running":e=>`${(e==null?void 0:e.action)??"操作"}中...`,"mcp.action.reauth":"重新认证","mcp.annotation.destructive":"破坏性","mcp.annotation.idempotent":"幂等","mcp.annotation.openWorld":"开放世界","mcp.annotation.readOnly":"只读","mcp.annotations":"注解","mcp.oauth.server":"服务器","mcp.oauth.starting":e=>`正在为 MCP server '${(e==null?void 0:e.name)??""}' 启动 OAuth 认证...`,"mcp.oauth.title":"OAuth 认证","mcp.clientBudget":e=>`${(e==null?void 0:e.count)??0}/${(e==null?void 0:e.budget)??0} 个客户端 · ${(e==null?void 0:e.mode)??"off"}`,"mcp.command":"命令","mcp.description":"描述：","mcp.action.reconnect":"重新连接","mcp.action.restart":"重启","mcp.action.tools":"查看工具","mcp.action.toolsHint":"Enter 查看","mcp.empty":"未配置 MCP 服务器。","mcp.emptyTools":"没有发现工具。","mcp.expand":"展开 MCP server","mcp.collapse":"收起 MCP server","mcp.inputSchema":"输入 schema","mcp.loadingStatus":"正在加载 MCP 状态...","mcp.loadingTools":"正在加载工具...","mcp.name":"名称","mcp.noDescription":"没有描述","mcp.noSchema":"没有输入 schema。","mcp.serverTool":"服务器工具","mcp.servers":e=>`${(e==null?void 0:e.count)??0} 个服务器`,"mcp.configuredServers":"已配置的 MCP 服务器：","mcp.fromExtension":e=>`（来自 ${(e==null?void 0:e.name)??""}）`,"mcp.extensionMcp":"扩展 MCP","mcp.invalidReason":e=>`无效：${(e==null?void 0:e.reason)??""}`,"mcp.invalidReasonLabel":"原因：","mcp.invalidToolHelp":"工具必须同时包含 name 和 description 才能被 LLM 使用。","mcp.invalidToolWarning":"警告：这个工具不能被 LLM 调用","mcp.manageServers":"管理 MCP servers","mcp.parameters":"参数：","mcp.required":" 必填","mcp.resources":"资源","mcp.resourcesUnavailable":"无法加载资源详情。","mcp.resourceCount":e=>`${(e==null?void 0:e.count)??0} 个资源`,"mcp.promptCount":e=>`${(e==null?void 0:e.count)??0} 个提示词`,"mcp.resource.uriLabel":"URI：","mcp.resource.nameLabel":"名称：","mcp.resource.mimeTypeLabel":"MIME 类型：","mcp.resource.sizeLabel":"大小：","mcp.resource.bytes":e=>`${(e==null?void 0:e.count)??0} 字节`,"mcp.scrollPosition":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0}`,"mcp.shortcut.back":"Esc 返回","mcp.shortcut.close":"Esc 关闭","mcp.shortcut.selectBack":"↑↓ 导航 · Enter 选择 · Esc 返回","mcp.shortcut.selectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","mcp.settings":"设置","mcp.extension":e=>`扩展：${(e==null?void 0:e.name)??""}`,"mcp.starting":e=>`⏳ MCP 服务器正在启动（${(e==null?void 0:e.count)??0} 个初始化中）...`,"mcp.startingNote":"注意：首次启动可能需要更长时间。工具可用性会自动更新。","mcp.restartSkipped":e=>`已跳过 ${(e==null?void 0:e.name)??""}：${(e==null?void 0:e.reason)??""}`,"mcp.restarted":e=>`已重启 ${(e==null?void 0:e.name)??""}，耗时 ${(e==null?void 0:e.duration)??0}ms`,"mcp.restartEntries":e=>`已重启 ${(e==null?void 0:e.name)??""} 的 ${(e==null?void 0:e.restarted)??0}/${(e==null?void 0:e.total)??0} 个条目${e!=null&&e.failedReasons?`（失败：${e.failedReasons}）`:""}`,"mcp.source":"来源","mcp.source.extension":"扩展","mcp.source.project":"工作区设置","mcp.source.user":"用户设置","mcp.status":"状态","mcp.status.blocked":"已阻止","mcp.status.connected":"已连接","mcp.status.connecting":"连接中","mcp.status.disconnected":"未连接","mcp.status.disconnectedTitle":"已断开","mcp.status.disabled":"已禁用","mcp.status.ready":"就绪","mcp.status.starting":"启动中...（首次启动可能需要更长时间）","mcp.status.unknown":"未知","mcp.tipDesc":"显示 server 和工具描述","mcp.tipNodesc":"隐藏描述","mcp.tipSchema":"显示工具参数 schema","mcp.tips":"💡 提示：","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsLabel":"工具：","mcp.title":"MCP 服务器","mcp.toolDetail":"工具详情","mcp.tools":"工具","mcp.toolsForServer":e=>`${(e==null?void 0:e.name)??"Server"} 的工具`,"mcp.transport":"传输","mcp.use":"使用","mcp.userMcp":"用户 MCP","mcp.workingDirectory":"工作目录","goal.aborted":"目标已中止","goal.achieved":"目标已达成","goal.check":"目标检查","goal.cleared":"目标已清除","goal.failed":"目标未能达成","goal.judge":"判断","goal.label":"目标","goal.lastCheck":"上次检查","goal.notYetMet":"尚未满足","goal.set":"目标已设置","goal.statusActive":"/goal 运行中","goal.turn":e=>`${(e==null?void 0:e.count)??0} 轮`,"goal.turnLabel":e=>`第 ${(e==null?void 0:e.count)??0} 轮`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} 轮`,"memory.add":"添加","memory.add.desc":"写入一条持久 memory","memory.autoDream":e=>`自动整理：${(e==null?void 0:e.status)??"未知"} · ${(e==null?void 0:e.lastDream)??"从未"} · /dream 立即运行`,"memory.autoDreamUnsupported":"web-shell 暂不支持修改自动整理设置。","memory.autoFolder":"打开自动记忆文件夹","memory.autoMemory":e=>`自动记忆：${(e==null?void 0:e.status)??"未知"}`,"memory.autoMemoryUnsupported":"web-shell 暂不支持修改自动记忆设置。","memory.autoSkill":e=>`自动技能：${(e==null?void 0:e.status)??"未知"}`,"memory.autoSkillUnsupported":"web-shell 暂不支持修改自动技能设置。","memory.chooseScope":"选择 memory 的保存位置","memory.closed":"Memory 面板已关闭。","memory.contentEmpty":"Memory 内容为空。","memory.file":"Memory 文件","memory.fileOpen":"Memory 文件已打开。","memory.fileTruncated":"Memory 文件已打开，内容已截断。","memory.files":"Memory 文件","memory.footer":"Enter 确认 · Esc 取消","memory.footer.back":"Esc 返回","memory.global":"用户级","memory.global.desc":"保存到全局用户 memory 文件","memory.globalReadUnsupported":"全局 memory 位于当前 workspace 之外，当前 daemon 文件读取接口不能打开它的内容。","memory.loading":"正在加载 memory...","memory.loadingFile":"正在加载 memory 文件...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"从未","memory.noFiles":"未找到 memory 文件。","memory.on":"开","memory.openFolderUnsupported":"web-shell 暂不支持打开自动记忆文件夹。","memory.placeholder":e=>`写入${(e==null?void 0:e.scope)??"memory"}内容...`,"memory.project":"项目级","memory.project.desc":"保存到当前 workspace memory 文件","memory.refresh":"刷新","memory.refresh.desc":"重新加载 memory 文件信息","memory.refreshed":"Memory 已刷新。","memory.save":"保存 Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} 已保存：${(e==null?void 0:e.bytes)??0} 字节 -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"保存中...","memory.show":"查看","memory.show.desc":"查看已配置的 memory 文件","memory.status":"Workspace 和用户 memory 文件","memory.unknown":"未知","memory.write":"写入 memory 内容","mode.auto":"智能审批","mode.auto.desc":"使用分类器评估工具调用，安全操作自动批准，风险操作阻止或请求确认","mode.auto.notice":"Auto 模式已启用。LLM 分类器会评估每个工具调用，自动批准安全操作，拦截危险操作。退出方式：Shift+Tab 或 /approval-mode default。","mode.footer":"(Enter 选择，Esc 取消)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"计划","mode.label.default":"请求批准","mode.label.auto-edit":"自动编辑","mode.label.auto":"智能审批","mode.label.yolo":"完全访问权限","mode.listLabel.plan":"计划（plan）","mode.listLabel.default":"请求批准（default）","mode.listLabel.auto-edit":"自动编辑（auto-edit）","mode.listLabel.auto":"智能审批（auto）","mode.listLabel.yolo":"完全访问权限（yolo）","mode.desc.plan":"仅分析，不修改文件或执行命令","mode.desc.default":"执行命令、编辑文件或访问外部资源前请求确认","mode.desc.auto-edit":"自动批准文件编辑，命令执行等敏感操作仍会询问","mode.desc.auto":"自动评估工具风险，安全操作直接执行，风险操作再确认","mode.desc.yolo":"自动批准所有工具调用，适合可信任务环境","mode.select":"审批模式","mode.autoApproved":e=>e!=null&&e.tool?`已自动批准：${e.tool}`:"切换模式后自动批准了待处理的工具调用。","mode.auto-edit":"自动编辑","mode.auto-edit.desc":"自动批准文件读写操作","mode.default":"默认模式","mode.default.desc":"每次工具调用都需要确认","mode.plan":"Plan 模式","mode.plan.desc":"仅分析和规划，不执行工具","mode.unknown":"未知模式","mode.yolo":"YOLO 模式","mode.yolo.desc":"自动批准所有操作","plan.title":"计划","model.contextWindow":"上下文窗口","model.contextWindow.unknown":"（未知）","model.current":e=>`当前：${(e==null?void 0:e.model)??"未知"}`,"model.modality":"模态","model.modality.text":"文本","model.modality.textOnly":"仅文本","model.modality.image":"图片","model.modality.pdf":"PDF","model.modality.audio":"音频","model.modality.video":"视频","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"（默认）","model.notSet":"（未设置）","model.footer":"Enter 选择，↑↓ 导航，Esc 关闭","model.searchHint":"按 / 搜索","model.fastHint":"用于建议和旁路任务","model.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的模型`,"model.none":"没有可用模型","model.select":"选择模型","model.setFast":"设置 Fast Model","model.setVoice":"设置语音模型","model.setVision":"设置视觉模型","model.switch":"切换模型","model.unknown":"未知","resume.current":"当前","resume.activePrompt":"正在运行","resume.filter":"筛选","resume.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"resume.none":"没有可恢复的会话","resume.pressSearch":"按 / 搜索","resume.search":"搜索","resume.title":"恢复会话","parallelAgents.title":"并行智能体","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} 完成`,"skills.available":"可用 skills:","skills.none":"当前没有可用 skill。","skills.empty":"没有可用 skill。","skills.footer":e=>e!=null&&e.name?`使用 /skills ${e.name} 调用 · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 可调用`,"skills.loading":"正在加载 skills...","skills.run":"运行 skill","skills.status.disabled":"已禁用","skills.title":"Skills","stats.accepted":"已接受：","stats.agreementRate":"总体同意率：","stats.api":"API","stats.apiTime":"API 耗时","stats.avgDuration":"平均耗时","stats.avgLatency":"平均延迟","stats.cached":"缓存","stats.cacheDesc":"的输入 Token 来自缓存，降低了成本。","stats.calls":"调用次数","stats.codeChanges":"代码变更","stats.decisionSummary":"用户决策摘要","stats.duration":"时长","stats.errors":"错误数","stats.inputTokens":"输入 Token","stats.metric":"指标","stats.modelStats":"模型统计（技术细节）","stats.modelTip":"提示：运行 /stats model 查看完整 Token 明细。","stats.modelUsage":"模型使用","stats.modified":"已修改：","stats.noApiCalls":"本次会话暂无 API 调用。","stats.noToolCalls":"本次会话暂无工具调用。","stats.output":"输出","stats.outputTokens":"输出 Token","stats.overview":"会话概览","stats.performance":"性能","stats.prompt":"提示","stats.prompts":"对话轮次","stats.rejected":"已拒绝：","stats.reqs":"请求","stats.requests":"请求数","stats.savingsHighlight":"节省亮点：","stats.successRate":"成功率","stats.thoughts":"思考","stats.title":"会话统计","stats.tokens":"Token","stats.toolCalls":"工具调用","stats.toolName":"工具名称","stats.toolStats":"工具统计（技术细节）","stats.toolTime":"工具耗时","stats.total":"总计","stats.totalReviewed":"已审核建议总数：","status.contextUsed":e=>`上下文已用 ${(e==null?void 0:e.pct)??"0.0"}%`,"status.disconnected":"断开连接","status.modeHint":"(shift + tab 或点击切换)","status.shortcuts":"? 查看快捷键","stream.cancel":"esc 取消","stream.cancelArmed":"再按一次 Esc 停止","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`当前：${(e==null?void 0:e.theme)??""}`,"theme.auto":"自动","theme.dark":"暗色","theme.dark.desc":"仿终端暗色皮肤。","theme.light":"亮色","theme.light.desc":"仿终端亮色皮肤。","theme.title":"主题","todo.allDone":"任务已全部完成","todo.collapse":"折叠任务列表","todo.completedAbove":e=>`✓ 已完成 ${(e==null?void 0:e.count)??0} 项`,"todo.detail.api":"API","todo.detail.cached":"缓存","todo.detail.end":"结束","todo.detail.hide":"收起任务明细","todo.detail.input":"输入","todo.detail.noResources":"未采集到该任务的 Token 与耗时明细。","todo.detail.output":"输出","todo.detail.sectionSpent":"耗时","todo.detail.sectionTime":"时间","todo.detail.sectionTokens":"Token","todo.detail.show":"查看任务明细","todo.detail.start":"开始","todo.detail.tool":"工具","todo.expand":"展开任务列表","todo.more":e=>`... 还有 ${(e==null?void 0:e.count)??0} 项`,"todo.moreAbove":e=>`... 前面还有 ${(e==null?void 0:e.count)??0} 项`,"todo.showLess":"收起","todo.stepProgress":e=>`第 ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0} 步`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"当前任务","chat.scrollToBottom":"回到底部","userMessage.showMore":"显示更多","userMessage.showLess":"收起","turn.processed":"已处理","turn.processing":"处理中","turn.collapse":"折叠步骤","turn.expand":"展开步骤","turn.cached":"缓存","turn.executionSteps":e=>`${(e==null?void 0:e.count)??0} 步`,"turn.toolCalls":e=>`工具 ${(e==null?void 0:e.count)??0} 次`,"turn.thinkingCount":e=>`思考 ${(e==null?void 0:e.count)??0} 次`,"turn.stopped":"你已取消请求","message.renderError":"此消息无法显示。","tasks.title":"后台任务","tasks.empty":"当前没有运行中的任务","tasks.refreshStale":"任务状态可能已过期，正在重连...","tasks.cancelFailed":"取消任务失败","tasks.alreadyStopped":"任务已停止","tasks.moreAbove":e=>`^ 上方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.moreBelow":e=>`v 下方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.running":"运行中","tasks.completed":"已完成","tasks.failed":"失败","tasks.cancelled":"已停止","tasks.paused":"已暂停","tasks.kind.shell":"Shell","tasks.kind.monitor":"监控","tasks.action.stop":"停止","tasks.action.abandon":"放弃","tasks.action.confirmStop":"确认停止","tasks.action.confirmAbandon":"确认放弃","tasks.action.confirmHint":"这会终结当前阻塞轮次。","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.confirmStop":"再按 x 确认停止 · 会终结当前阻塞轮次","tasks.shortcut.select":"↑/↓ 选择","tasks.shortcut.view":"Enter 查看","tasks.shortcut.stop":"x 停止","tasks.shortcut.abandon":"x 放弃","tasks.shortcut.listClose":"←/Esc 关闭","tasks.shortcut.detailBack":"← 返回","tasks.shortcut.detailClose":"Esc/Enter/Space 关闭","tasks.shortcut.close":"Esc 关闭","tasks.shortcut.cancelConfirm":"Esc 取消","tasks.detail.workingDir":"工作目录","tasks.detail.outputFile":"输出文件","tasks.detail.command":"命令","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} 个事件`,"tasks.detail.exit":e=>`退出码 ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} 个已丢弃`,"tasks.detail.error":"错误","tasks.detail.stoppedBecause":"停止原因","tasks.detail.resumeBlocked":"恢复被阻止","tasks.detail.progress":"执行进度","tasks.detail.prompt":"提示词","tasks.detail.type":"类型","tasks.detail.runtime":"时间","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"工具数量","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} 次工具调用`,"tasks.detail.nesting":"嵌套","tasks.detail.nestingValue":e=>`第 ${(e==null?void 0:e.level)??"?"} 层 · 来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`第 ${(e==null?void 0:e.level)??"?"} 层`,"tasks.row.from":e=>`来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"嵌套","tips.items":"输入 / 查看所有可用命令。|使用 @ 引用文件路径。|按 Esc 取消正在进行的请求。|使用 Shift+Enter 换行。|按 ↑↓ 浏览历史消息。","tools.available":"可用工具:","tools.none":"没有可用工具。","tools.empty":"没有可用的内置工具。请先打开一个会话。","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space 查看详情 · ":""}t 切换 ${e.name} · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","tools.details.hide":"收起详情","tools.details.show":"展开详情","tools.loading":"正在加载工具...","tools.status.disabled":"已禁用","tools.status.enabled":"已启用","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 已启用`,"tools.title":"工具","tools.update.disable":"禁用","tools.update.enable":"启用","tools.updating":"更新中...","tool.collapse":"▲ 收起","tool.expand":"展开","tool.collapseHint":"收起","tool.status.failed":"执行失败","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.summary.editedFiles":e=>`已编辑 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.ranCommands":e=>`已运行 ${(e==null?void 0:e.count)??0} 条命令`,"toolGroup.summary.readFiles":e=>`已读取 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.searched":e=>`已搜索 ${(e==null?void 0:e.count)??0} 次`,"toolGroup.summary.updatedTodos":e=>Number((e==null?void 0:e.count)??0)>1?`已更新任务清单 ${(e==null?void 0:e.count)??0} 次`:"已更新任务清单","toolGroup.summary.askedUser":"已询问用户","toolGroup.summary.otherTools":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.running":e=>`正在执行 ${(e==null?void 0:e.name)??"工具"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · 共 ${(e==null?void 0:e.count)??0} 个工具`:""}`,"toolGroup.runningPrefix":"正在执行","thinking.expand":"展开思考","thinking.collapse":"收起思考","thinking.running":e=>`正在思考${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.done":e=>e!=null&&e.duration?`已思考 ${e.duration}`:"思考完成","welcome.changeModel":"(/model 切换)","welcome.defaultModel":"未知模型","sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} 个会话`,"sessionsOverview.current":"当前","sessionsOverview.empty":"暂无会话","sessionsOverview.loadFailed":"加载会话失败","sessionsOverview.loading":"正在加载会话…","sessionsOverview.openElsewhere":"已在其他窗口打开","sessionsOverview.openInSplit":"打开到分屏","sessionsOverview.openInSplitHint":"在本窗口内并排显示选中的会话","sessionsOverview.openInTab":"在新标签页打开","sessionsOverview.openInTabHint":"在新标签页中以分屏并排打开选中的会话","sessionsOverview.popupBlocked":"弹出窗口被拦截。请允许本站弹窗，以便在新标签页中打开会话。","sessionsOverview.refresh":"刷新","sessionsOverview.selectAll":"全选","sessionsOverview.splitCap":e=>`只有前 ${(e==null?void 0:e.max)??6} 个选中的会话会进入分屏。`,"sessionsOverview.selectSession":e=>`选择 ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"空闲","sessionsOverview.status.needsApproval":"待审批","sessionsOverview.status.running":"运行中","sessionsOverview.title":"会话总览","splitView.title":"分屏","splitView.count":e=>`${(e==null?void 0:e.count)??0} 个窗格`,"splitView.addPane":"添加会话","splitView.closePane":"关闭窗格","splitView.paneError":"此会话窗格出错","splitView.paneConnectionError":"连接已断开","splitView.outerApprovalPending":"主会话正在等待审批。","splitView.goToApproval":"前往处理","splitView.empty":"分屏中还没有会话，添加一个开始。","splitView.composerPlaceholder":"给这个会话发消息…","settings.title":"设置","settings.loading":"正在加载设置...","settings.empty":"暂无可用设置。","settings.footer":"↑↓ 导航  Enter 切换  Tab 切换作用域  r 刷新  ESC 关闭","settings.footer.edit":"Enter 保存  ESC 取消","settings.footer.theme":"↑↓ 导航  Enter 选择  ESC 返回","settings.scope.user":"用户","settings.scope.workspace":"工作区","settings.value.on":"开","settings.value.off":"关","settings.action.edit":"编辑","settings.action.save":"保存","settings.modifiedIn":e=>`（已在${(e==null?void 0:e.scope)??""}中修改）`,"settings.alsoModifiedIn":e=>`（同时在${(e==null?void 0:e.scope)??""}中修改）`,"settings.invalidNumber":"无效数字","settings.readOnly":"User 级别设置在 daemon 模式下为只读。","settings.requiresRestart":"此更改需要重启后才能生效。","settings.corrupted":e=>`设置文件已损坏${(e==null?void 0:e.recovered)==="true"?"（已从备份恢复）":""}`,"settings.label.ui.chatWidth":"屏宽","settings.description.ui.chatWidth":"纯前端的聊天内容宽度设置，保存在当前浏览器中。","settings.option.ui.chatWidth.1000":"常规","settings.option.ui.chatWidth.wide":"超宽","settings.category.General":"通用","settings.category.UI":"界面","settings.category.Privacy":"隐私","settings.category.Model":"模型","settings.category.Context":"上下文","settings.category.Tools":"工具","settings.category.Daemon":"守护进程","settings.category.Experimental":"实验性","settings.category.Advanced":"高级","settings.label.general.enableAutoUpdate":"启用自动更新","settings.description.general.enableAutoUpdate":"启动时自动检查并安装更新。","settings.label.general.showSessionRecap":"显示会话回顾","settings.description.general.showSessionRecap":"离开终端一段时间后返回时，自动显示一行“上次停在这里”的回顾。默认关闭。也可以随时使用 /recap 手动触发。","settings.label.general.sessionRecapAwayThresholdMinutes":"会话回顾离开阈值（分钟）","settings.description.general.sessionRecapAwayThresholdMinutes":"终端失焦多少分钟后，下一次重新聚焦时触发自动回顾。默认与 Claude Code 一致为 5 分钟；如果只是短暂切换窗口，可以调高。","settings.label.general.cleanupPeriodDays":"清理周期（天）","settings.description.general.cleanupPeriodDays":"~/.qwen/file-history/ 中用于 /rewind 的会话备份保留天数。后台清理最多每天运行一次。设为 0 表示最小保留（约 1 小时），仍会保护最近一小时触碰过的会话和当前活动会话。","settings.label.general.gitCoAuthor.commit":"归因：commit","settings.description.general.gitCoAuthor.commit":"通过 Qwen Code 创建 commit 时，添加 Co-authored-by trailer，并写入逐文件 AI 归因 git note。关闭后两者都会跳过。","settings.label.general.gitCoAuthor.pr":"归因：PR","settings.description.general.gitCoAuthor.pr":"运行 gh pr create 时，在 PR 描述中追加 Qwen Code 归因行。","settings.label.general.language":"语言：界面","settings.description.general.language":"用户界面的语言。使用 auto 可根据系统设置自动检测；也可以在 ~/.qwen/locales/ 中放置 JS 语言文件来使用自定义语言代码。","settings.label.general.dynamicCommandTranslation":"语言：动态命令翻译","settings.description.general.dynamicCommandTranslation":"为动态 slash command 描述启用 AI 翻译。关闭后动态命令使用原始描述，也不会触发翻译模型调用。","settings.label.general.preventSystemSleep":"运行时防止系统睡眠","settings.description.general.preventSystemSleep":"当 Qwen Code 正在流式生成模型回复或执行工具时防止系统睡眠。空闲输入状态和权限确认状态不会阻止睡眠。","settings.label.ui.theme":"主题","settings.description.ui.theme":"界面的颜色主题。","settings.label.ui.hideTips":"隐藏提示","settings.description.ui.hideTips":"隐藏界面中的帮助提示。","settings.label.ui.enableWelcomeBack":"显示欢迎回来对话框","settings.description.ui.enableWelcomeBack":"回到有历史会话的项目时显示欢迎回来对话框。选择“开始新的聊天会话”后，在项目摘要变化前不会再次显示。","settings.label.ui.enableUserFeedback":"启用用户反馈","settings.description.ui.enableUserFeedback":"对话结束后显示可选反馈对话框，帮助改进 Qwen 表现。","settings.label.ui.enableFollowupSuggestions":"启用后续建议","settings.description.ui.enableFollowupSuggestions":"任务完成后显示上下文相关的后续建议。按 Tab 或右方向键接受，按 Enter 接受并提交。","settings.label.ui.compactMode":"紧凑模式","settings.description.ui.compactMode":"隐藏工具输出和思考内容，显示更简洁的视图（可用 Ctrl+O 切换）。","settings.label.ui.compactInline":"紧凑内联","settings.description.ui.compactInline":"在每个分组内紧凑显示工具内容，而不是跨分组合并。需要先启用紧凑模式。","settings.label.ui.shellOutputMaxLines":"Shell 输出最大行数","settings.description.ui.shellOutputMaxLines":"内联显示的 shell 输出最大行数。设为 0 可取消限制并显示完整输出；隐藏行数仍会通过 +N lines 指示器展示。","settings.label.privacy.usageStatisticsEnabled":"启用使用统计","settings.description.privacy.usageStatisticsEnabled":"启用使用统计收集。","settings.label.fastModel":"快速模型","settings.description.fastModel":"用于生成提示建议和推测执行的模型。留空则使用主模型。较小/更快的模型（例如 qwen3-coder-flash）可以降低延迟和成本。","settings.label.visionModel":"视觉模型","settings.description.visionModel":"用于视觉桥接的图像能力模型。留空则自动选择。","settings.label.context.fileFiltering.respectGitIgnore":"遵守 .gitignore","settings.description.context.fileFiltering.respectGitIgnore":"搜索时遵守 .gitignore 文件。","settings.label.context.fileFiltering.respectQwenIgnore":"遵守 .qwenignore","settings.description.context.fileFiltering.respectQwenIgnore":"搜索时遵守 .qwenignore 文件。","settings.label.context.fileFiltering.enableFuzzySearch":"启用模糊搜索","settings.description.context.fileFiltering.enableFuzzySearch":"搜索文件时启用模糊搜索。","settings.label.tools.toolSearch.enabled":"启用 ToolSearch","settings.description.tools.toolSearch.enabled":"启用后，MCP 工具会通过 ToolSearch 按需加载，以减少提示词大小。对于依赖前缀 KV 缓存的模型（如 DeepSeek），可关闭此项来保持提示词前缀稳定并提高缓存命中率。","settings.label.tools.shell.enableInteractiveShell":"交互式 Shell（PTY）","settings.description.tools.shell.enableInteractiveShell":"使用 node-pty 提供交互式 shell 体验。PTY 不可用时回退到 child_process。","settings.label.tools.computerUse.enabled":"启用 Computer Use","settings.description.tools.computerUse.enabled":"启用后（默认），会注册 9 个 computer_use__* 延迟内置工具。","settings.label.policy.permissionStrategy":"权限协调策略","settings.description.policy.permissionStrategy":"多个客户端连接时权限请求的决策方式。first-responder 表示任意客户端先响应者生效；designated 表示仅提示发起方决策；consensus 表示需要 N-of-M 投票同意；local-only 表示只有 loopback 客户端可决策。需要重启 daemon 后生效。","settings.option.policy.permissionStrategy.first-responder":"先响应者","settings.option.policy.permissionStrategy.designated":"指定发起方","settings.option.policy.permissionStrategy.consensus":"共识法定人数","settings.option.policy.permissionStrategy.local-only":"仅本机","settings.label.experimental.enableCronTools":"启用 Cron/Loop 工具","settings.description.experimental.enableCronTools":"启用会话内 cron/loop 工具（实验性）。启用后，模型可以用 cron_create、cron_list 和 cron_delete 创建周期性提示。也可通过 QWEN_CODE_ENABLE_CRON=1 环境变量启用。","settings.label.experimental.emitToolUseSummaries":"工具使用摘要","settings.description.experimental.emitToolUseSummaries":"每个工具批次完成后生成一个简短的 LLM 标签。紧凑模式下会替代通用的 Tool × N 标题；完整模式下显示为工具组下方的弱化 ● <label> 行。需要配置快速模型。","settings.label.agents.arena.preserveArtifacts":"保留 Arena 产物","settings.description.agents.arena.preserveArtifacts":"启用后，Arena worktree 和会话状态文件会在会话结束或主智能体退出后保留。","welcome.modeHint":"Shift+Tab 或 /approval-mode","welcome.prompt":"你想构建什么？","welcome.titlePrefix":"欢迎使用","welcome.tipLabel":"提示："},OY={en:bS,"zh-CN":DY},BY={en:"English [en]","zh-CN":"中文 [zh-CN]"},qL=g.createContext({language:"en",t:e=>e});function bu(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function vS(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return bu(typeof navigator<"u"?navigator.language:void 0);if(t==="zh"||t==="zh-cn"||t==="chinese"||t==="中文")return"zh-CN";if(t==="en"||t==="en-us"||t==="english")return"en"}}function wS(e){return BY[e]}function HL(e){const t=OY[e];return(n,s)=>{const r=t[n]??bS[n]??n;return typeof r=="function"?r(s):r}}function PY({language:e,children:t}){const n=g.useMemo(()=>({language:e,t:HL(e)}),[e]);return u.jsx(qL.Provider,{value:n,children:t})}function Xe(){return g.useContext(qL)}const vT=[];function $Y(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,s)=>!Object.is(n,t[s]))}class mc extends g.Component{constructor(){super(...arguments);ye(this,"state",{error:null,resetKeys:this.props.resetKeys??vT});ye(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,s){const r=n.resetKeys??vT;return $Y(s.resetKeys,r)?{error:null,resetKeys:r}:null}componentDidCatch(n,s){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,s.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:s}=this.props;return typeof s=="function"?s(n,this.reset):s}}const zY="_row_19m4s_1",FY="_tip_19m4s_13",qY="_chatRow_19m4s_35",HY="_chatTip_19m4s_43",UY="_chatActions_19m4s_56",VY="_copyButton_19m4s_71",Mc={row:zY,tip:FY,chatRow:qY,chatTip:HY,chatActions:UY,copyButton:VY};function Q_({timestamp:e,children:t,chatMode:n=!1,copyText:s,copyTitle:r="Copy"}){const[i,o]=g.useState(!1),a=g.useCallback(()=>{var c;s&&((c=navigator.clipboard)==null||c.writeText(s).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[s]);if(e===void 0&&!s)return u.jsx(u.Fragment,{children:t});const l=s?u.jsx("button",{type:"button",className:Mc.copyButton,title:r,"aria-label":r,onClick:a,children:i?u.jsx(GY,{}):u.jsx(WY,{})}):null;return e===void 0?u.jsxs("div",{className:n?Mc.chatRow:Mc.row,children:[t,l]}):u.jsxs("div",{className:n?Mc.chatRow:Mc.row,children:[t,n?u.jsxs("span",{className:Mc.chatActions,children:[u.jsx("span",{className:Mc.chatTip,"aria-hidden":"true",children:Lf(e)}),l]}):u.jsx("span",{className:Mc.tip,"aria-hidden":"true",children:Lf(e)})]})}function WY(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 4.4V3.2c0-.7.5-1.2 1.2-1.2h5.4c.7 0 1.2.5 1.2 1.2v5.4c0 .7-.5 1.2-1.2 1.2h-1.2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"}),u.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function GY(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Lf(e,t=new Date){const n=new Date(e),s=o=>String(o).padStart(2,"0"),r=`${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?r:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${r}`}const KY="modulepreload",YY=function(e){return"/"+e},wT={},K=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(l=>{if(l=YY(l),l in wT)return;wT[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":KY,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((f,m)=>{h.addEventListener("load",f),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},yi={Dark:"dark",Light:"light"},UL=[yi.Dark,yi.Light],VL=g.createContext(yi.Dark),QY=VL.Provider;function Rv(){return g.useContext(VL)}const fd="ui.theme",R0="general.language";function xS(e,t){return e===yi.Light||e==="Qwen Light"?yi.Light:e===yi.Dark||e==="Qwen Dark"?yi.Dark:t}function XY(e){return e===yi.Light?"Qwen Light":"Qwen Dark"}function xT(e){const t=[],n=String(e||"");let s=n.indexOf(","),r=0,i=!1;for(;!i;){s===-1&&(s=n.length,i=!0);const o=n.slice(r,s).trim();(o||!i)&&t.push(o),r=s+1,s=n.indexOf(",",r)}return t}function WL(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const JY=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZY=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eQ={};function _T(e,t){return(eQ.jsx?ZY:JY).test(e)}const tQ=/[ \t\n\f\r]/g;function Lv(e){return typeof e=="object"?e.type==="text"?kT(e.value):!1:kT(e)}function kT(e){return e.replace(tQ,"")===""}class Zp{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Zp.prototype.normal={};Zp.prototype.property={};Zp.prototype.space=void 0;function GL(e,t){const n={},s={};for(const r of e)Object.assign(n,r.property),Object.assign(s,r.normal);return new Zp(n,s,t)}function lp(e){return e.toLowerCase()}class ho{constructor(t,n){this.attribute=n,this.property=t}}ho.prototype.attribute="";ho.prototype.booleanish=!1;ho.prototype.boolean=!1;ho.prototype.commaOrSpaceSeparated=!1;ho.prototype.commaSeparated=!1;ho.prototype.defined=!1;ho.prototype.mustUseProperty=!1;ho.prototype.number=!1;ho.prototype.overloadedBoolean=!1;ho.prototype.property="";ho.prototype.spaceSeparated=!1;ho.prototype.space=void 0;let nQ=0;const hn=ah(),vr=ah(),X_=ah(),Ge=ah(),Cs=ah(),jd=ah(),po=ah();function ah(){return 2**++nQ}const J_=Object.freeze(Object.defineProperty({__proto__:null,boolean:hn,booleanish:vr,commaOrSpaceSeparated:po,commaSeparated:jd,number:Ge,overloadedBoolean:X_,spaceSeparated:Cs},Symbol.toStringTag,{value:"Module"})),W2=Object.keys(J_);class _S extends ho{constructor(t,n,s,r){let i=-1;if(super(t,n),ST(this,"space",r),typeof s=="number")for(;++i<W2.length;){const o=W2[i];ST(this,W2[i],(s&J_[o])===J_[o])}}}_S.prototype.defined=!0;function ST(e,t,n){n&&(e[t]=n)}function rm(e){const t={},n={};for(const[s,r]of Object.entries(e.properties)){const i=new _S(s,e.transform(e.attributes||{},s),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[lp(s)]=s,n[lp(i.attribute)]=s}return new Zp(t,n,e.space)}const KL=rm({properties:{ariaActiveDescendant:null,ariaAtomic:vr,ariaAutoComplete:null,ariaBusy:vr,ariaChecked:vr,ariaColCount:Ge,ariaColIndex:Ge,ariaColSpan:Ge,ariaControls:Cs,ariaCurrent:null,ariaDescribedBy:Cs,ariaDetails:null,ariaDisabled:vr,ariaDropEffect:Cs,ariaErrorMessage:null,ariaExpanded:vr,ariaFlowTo:Cs,ariaGrabbed:vr,ariaHasPopup:null,ariaHidden:vr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Cs,ariaLevel:Ge,ariaLive:null,ariaModal:vr,ariaMultiLine:vr,ariaMultiSelectable:vr,ariaOrientation:null,ariaOwns:Cs,ariaPlaceholder:null,ariaPosInSet:Ge,ariaPressed:vr,ariaReadOnly:vr,ariaRelevant:null,ariaRequired:vr,ariaRoleDescription:Cs,ariaRowCount:Ge,ariaRowIndex:Ge,ariaRowSpan:Ge,ariaSelected:vr,ariaSetSize:Ge,ariaSort:null,ariaValueMax:Ge,ariaValueMin:Ge,ariaValueNow:Ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function YL(e,t){return t in e?e[t]:t}function QL(e,t){return YL(e,t.toLowerCase())}const sQ=rm({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:jd,acceptCharset:Cs,accessKey:Cs,action:null,allow:null,allowFullScreen:hn,allowPaymentRequest:hn,allowUserMedia:hn,alpha:hn,alt:null,as:null,async:hn,autoCapitalize:null,autoComplete:Cs,autoFocus:hn,autoPlay:hn,blocking:Cs,capture:null,charSet:null,checked:hn,cite:null,className:Cs,closedBy:null,colorSpace:null,cols:Ge,colSpan:Ge,command:null,commandFor:null,content:null,contentEditable:vr,controls:hn,controlsList:Cs,coords:Ge|jd,crossOrigin:null,data:null,dateTime:null,decoding:null,default:hn,defer:hn,dir:null,dirName:null,disabled:hn,download:X_,draggable:vr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:hn,formTarget:null,headers:Cs,height:Ge,hidden:X_,high:Ge,href:null,hrefLang:null,htmlFor:Cs,httpEquiv:Cs,id:null,imageSizes:null,imageSrcSet:null,inert:hn,inputMode:null,integrity:null,is:null,isMap:hn,itemId:null,itemProp:Cs,itemRef:Cs,itemScope:hn,itemType:Cs,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:hn,low:Ge,manifest:null,max:null,maxLength:Ge,media:null,method:null,min:null,minLength:Ge,multiple:hn,muted:hn,name:null,nonce:null,noModule:hn,noValidate:hn,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:hn,optimum:Ge,pattern:null,ping:Cs,placeholder:null,playsInline:hn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:hn,referrerPolicy:null,rel:Cs,required:hn,reversed:hn,rows:Ge,rowSpan:Ge,sandbox:Cs,scope:null,scoped:hn,seamless:hn,selected:hn,shadowRootClonable:hn,shadowRootCustomElementRegistry:hn,shadowRootDelegatesFocus:hn,shadowRootMode:null,shadowRootSerializable:hn,shape:null,size:Ge,sizes:null,slot:null,span:Ge,spellCheck:vr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ge,step:null,style:null,tabIndex:Ge,target:null,title:null,translate:null,type:null,typeMustMatch:hn,useMap:null,value:vr,width:Ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Cs,axis:null,background:null,bgColor:null,border:Ge,borderColor:null,bottomMargin:Ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:hn,declare:hn,event:null,face:null,frame:null,frameBorder:null,hSpace:Ge,leftMargin:Ge,link:null,longDesc:null,lowSrc:null,marginHeight:Ge,marginWidth:Ge,noResize:hn,noHref:hn,noShade:hn,noWrap:hn,object:null,profile:null,prompt:null,rev:null,rightMargin:Ge,rules:null,scheme:null,scrolling:vr,standby:null,summary:null,text:null,topMargin:Ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ge,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:hn,disablePictureInPicture:hn,disableRemotePlayback:hn,exportParts:jd,part:Cs,prefix:null,property:null,results:Ge,security:null,unselectable:null},space:"html",transform:QL}),rQ=rm({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:po,accentHeight:Ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ge,amplitude:Ge,arabicForm:null,ascent:Ge,attributeName:null,attributeType:null,azimuth:Ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ge,by:null,calcMode:null,capHeight:Ge,className:Cs,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:Ge,diffuseConstant:Ge,direction:null,display:null,dur:null,divisor:Ge,dominantBaseline:null,download:hn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ge,enableBackground:null,end:null,event:null,exponent:Ge,externalResourcesRequired:null,fill:null,fillOpacity:Ge,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:jd,g2:jd,glyphName:jd,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ge,horizOriginX:Ge,horizOriginY:Ge,id:null,ideographic:Ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ge,k:Ge,k1:Ge,k2:Ge,k3:Ge,k4:Ge,kernelMatrix:po,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ge,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:Ge,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:Ge,overlineThickness:Ge,paintOrder:null,panose1:null,path:null,pathLength:Ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Cs,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ge,pointsAtY:Ge,pointsAtZ:Ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:po,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:po,rev:po,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:po,requiredFeatures:po,requiredFonts:po,requiredFormats:po,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:Ge,specularExponent:Ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ge,strikethroughThickness:Ge,string:null,stroke:null,strokeDashArray:po,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ge,strokeOpacity:Ge,strokeWidth:null,style:null,surfaceScale:Ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:po,tabIndex:Ge,tableValues:null,target:null,targetX:Ge,targetY:Ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:po,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ge,underlineThickness:Ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ge,values:null,vAlphabetic:Ge,vMathematical:Ge,vectorEffect:null,vHanging:Ge,vIdeographic:Ge,version:null,vertAdvY:Ge,vertOriginX:Ge,vertOriginY:Ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:YL}),XL=rm({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()}}),JL=rm({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:QL}),ZL=rm({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),iQ={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},oQ=/[A-Z]/g,TT=/-[a-z]/g,aQ=/^data[-\w.:]+$/i;function kS(e,t){const n=lp(t);let s=t,r=ho;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&aQ.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(TT,cQ);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!TT.test(i)){let o=i.replace(oQ,lQ);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}r=_S}return new r(s,t)}function lQ(e){return"-"+e.toLowerCase()}function cQ(e){return e.charAt(1).toUpperCase()}const SS=GL([KL,sQ,XL,JL,ZL],"html"),im=GL([KL,rQ,XL,JL,ZL],"svg");function CT(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function eD(e){return e.join(" ").trim()}var TS={},AT=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,uQ=/\n/g,dQ=/^\s*/,hQ=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,fQ=/^:\s*/,mQ=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,pQ=/^[;\s]*/,gQ=/^\s+|\s+$/g,yQ=`
`,ET="/",MT="*",md="",bQ="comment",vQ="declaration";function wQ(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,s=1;function r(p){var y=p.match(uQ);y&&(n+=y.length);var w=p.lastIndexOf(yQ);s=~w?p.length-w:s+p.length}function i(){var p={line:n,column:s};return function(y){return y.position=new o(p),c(),y}}function o(p){this.start=p,this.end={line:n,column:s},this.source=t.source}o.prototype.content=e;function a(p){var y=new Error(t.source+":"+n+":"+s+": "+p);if(y.reason=p,y.filename=t.source,y.line=n,y.column=s,y.source=e,!t.silent)throw y}function l(p){var y=p.exec(e);if(y){var w=y[0];return r(w),e=e.slice(w.length),y}}function c(){l(dQ)}function d(p){var y;for(p=p||[];y=h();)y!==!1&&p.push(y);return p}function h(){var p=i();if(!(ET!=e.charAt(0)||MT!=e.charAt(1))){for(var y=2;md!=e.charAt(y)&&(MT!=e.charAt(y)||ET!=e.charAt(y+1));)++y;if(y+=2,md===e.charAt(y-1))return a("End of comment missing");var w=e.slice(2,y-2);return s+=2,r(w),e=e.slice(y),s+=2,p({type:bQ,comment:w})}}function f(){var p=i(),y=l(hQ);if(y){if(h(),!l(fQ))return a("property missing ':'");var w=l(mQ),b=p({type:vQ,property:NT(y[0].replace(AT,md)),value:w?NT(w[0].replace(AT,md)):md});return l(pQ),b}}function m(){var p=[];d(p);for(var y;y=f();)y!==!1&&(p.push(y),d(p));return p}return c(),m()}function NT(e){return e?e.replace(gQ,md):md}var xQ=wQ,_Q=My&&My.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(TS,"__esModule",{value:!0});TS.default=SQ;const kQ=_Q(xQ);function SQ(e,t){let n=null;if(!e||typeof e!="string")return n;const s=(0,kQ.default)(e),r=typeof t=="function";return s.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;r?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var Dv={};Object.defineProperty(Dv,"__esModule",{value:!0});Dv.camelCase=void 0;var TQ=/^--[a-zA-Z0-9_-]+$/,CQ=/-([a-z])/g,AQ=/^[^-]+$/,EQ=/^-(webkit|moz|ms|o|khtml)-/,MQ=/^-(ms)-/,NQ=function(e){return!e||AQ.test(e)||TQ.test(e)},IQ=function(e,t){return t.toUpperCase()},IT=function(e,t){return"".concat(t,"-")},jQ=function(e,t){return t===void 0&&(t={}),NQ(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(MQ,IT):e=e.replace(EQ,IT),e.replace(CQ,IQ))};Dv.camelCase=jQ;var RQ=My&&My.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},LQ=RQ(TS),DQ=Dv;function Z_(e,t){var n={};return!e||typeof e!="string"||(0,LQ.default)(e,function(s,r){s&&r&&(n[(0,DQ.camelCase)(s,t)]=r)}),n}Z_.default=Z_;var OQ=Z_;const BQ=lv(OQ),tD=nD("end"),CS=nD("start");function nD(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function PQ(e){const t=CS(e),n=tD(e);if(t&&n)return{start:t,end:n}}function L0(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?jT(e.position):"start"in e||"end"in e?jT(e):"line"in e||"column"in e?e3(e):""}function e3(e){return RT(e&&e.line)+":"+RT(e&&e.column)}function jT(e){return e3(e&&e.start)+"-"+e3(e&&e.end)}function RT(e){return e&&typeof e=="number"?e:1}class _i extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let r="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?r=t:!i.cause&&t&&(o=!0,r=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const l=s.indexOf(":");l===-1?i.ruleId=s:(i.source=s.slice(0,l),i.ruleId=s.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=a?a.line:void 0,this.name=L0(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}_i.prototype.file="";_i.prototype.name="";_i.prototype.reason="";_i.prototype.message="";_i.prototype.stack="";_i.prototype.column=void 0;_i.prototype.line=void 0;_i.prototype.ancestors=void 0;_i.prototype.cause=void 0;_i.prototype.fatal=void 0;_i.prototype.place=void 0;_i.prototype.ruleId=void 0;_i.prototype.source=void 0;const AS={}.hasOwnProperty,$Q=new Map,zQ=/[A-Z]/g,FQ=new Set(["table","tbody","thead","tfoot","tr"]),qQ=new Set(["td","th"]),sD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function HQ(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=XQ(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=QQ(n,t.jsx,t.jsxs)}const r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?im:SS,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=rD(r,e,void 0);return i&&typeof i!="string"?i:r.create(e,r.Fragment,{children:i||void 0},void 0)}function rD(e,t,n){if(t.type==="element")return UQ(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return VQ(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return GQ(e,t,n);if(t.type==="mdxjsEsm")return WQ(e,t);if(t.type==="root")return KQ(e,t,n);if(t.type==="text")return YQ(e,t)}function UQ(e,t,n){const s=e.schema;let r=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(r=im,e.schema=r),e.ancestors.push(t);const i=oD(e,t.tagName,!1),o=JQ(e,t);let a=MS(e,t);return FQ.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Lv(l):!0})),iD(e,o,i,t),ES(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function VQ(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}cp(e,t.position)}function WQ(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cp(e,t.position)}function GQ(e,t,n){const s=e.schema;let r=s;t.name==="svg"&&s.space==="html"&&(r=im,e.schema=r),e.ancestors.push(t);const i=t.name===null?e.Fragment:oD(e,t.name,!0),o=ZQ(e,t),a=MS(e,t);return iD(e,o,i,t),ES(o,a),e.ancestors.pop(),e.schema=s,e.create(t,i,o,n)}function KQ(e,t,n){const s={};return ES(s,MS(e,t)),e.create(t,e.Fragment,s,n)}function YQ(e,t){return t.value}function iD(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function ES(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function QQ(e,t,n){return s;function s(r,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function XQ(e,t){return n;function n(s,r,i,o){const a=Array.isArray(i.children),l=CS(s);return t(r,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function JQ(e,t){const n={};let s,r;for(r in t.properties)if(r!=="children"&&AS.call(t.properties,r)){const i=eX(e,r,t.properties[r]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&qQ.has(t.tagName)?s=a:n[o]=a}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function ZQ(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else cp(e,t.position);else{const r=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const a=s.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else cp(e,t.position);else i=s.value===null?!0:s.value;n[r]=i}return n}function MS(e,t){const n=[];let s=-1;const r=e.passKeys?new Map:$Q;for(;++s<t.children.length;){const i=t.children[s];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=r.get(l)||0;o=l+"-"+c,r.set(l,c+1)}}const a=rD(e,i,o);a!==void 0&&n.push(a)}return n}function eX(e,t,n){const s=kS(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?WL(n):eD(n)),s.property==="style"){let r=typeof n=="object"?n:tX(e,String(n));return e.stylePropertyNameCase==="css"&&(r=nX(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&s.space?iQ[s.property]||s.property:s.attribute,n]}}function tX(e,t){try{return BQ(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,r=new _i("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=sD+"#cannot-parse-style-attribute",r}}function oD(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const r=t.split(".");let i=-1,o;for(;++i<r.length;){const a=_T(r[i])?{type:"Identifier",name:r[i]}:{type:"Literal",value:r[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}s=o}else s=_T(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const r=s.value;return AS.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(s);cp(e)}function cp(e,t){const n=new _i("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=sD+"#cannot-handle-mdx-estrees-without-createevaluater",n}function nX(e){const t={};let n;for(n in e)AS.call(e,n)&&(t[sX(n)]=e[n]);return t}function sX(e){let t=e.replace(zQ,rX);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function rX(e){return"-"+e.toLowerCase()}const G2={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},iX={};function NS(e,t){const n=iX,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,r=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return aD(e,s,r)}function aD(e,t,n){if(oX(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return LT(e.children,t,n)}return Array.isArray(e)?LT(e,t,n):""}function LT(e,t,n){const s=[];let r=-1;for(;++r<e.length;)s[r]=aD(e[r],t,n);return s.join("")}function oX(e){return!!(e&&typeof e=="object")}const DT=document.createElement("i");function IS(e){const t="&"+e+";";DT.innerHTML=t;const n=DT.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mo(e,t,n,s){const r=e.length;let i=0,o;if(t<0?t=-t>r?0:r+t:t=t>r?r:t,n=n>0?n:0,s.length<1e4)o=Array.from(s),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<s.length;)o=s.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Ko(e,t){return e.length>0?(Mo(e,e.length,0,t),e):t}const OT={}.hasOwnProperty;function lD(e){const t={};let n=-1;for(;++n<e.length;)aX(t,e[n]);return t}function aX(e,t){let n;for(n in t){const r=(OT.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){OT.call(r,o)||(r[o]=[]);const a=i[o];lX(r[o],Array.isArray(a)?a:a?[a]:[])}}}function lX(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Mo(e,0,0,s)}function cD(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ca(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $i=Fu(/[A-Za-z]/),bi=Fu(/[\dA-Za-z]/),cX=Fu(/[#-'*+\--9=?A-Z^-~]/);function db(e){return e!==null&&(e<32||e===127)}const t3=Fu(/\d/),uX=Fu(/[\dA-Fa-f]/),dX=Fu(/[!-/:-@[-`{-~]/);function zt(e){return e!==null&&e<-2}function Ns(e){return e!==null&&(e<0||e===32)}function Bn(e){return e===-2||e===-1||e===32}const Ov=Fu(new RegExp("\\p{P}|\\p{S}","u")),Hd=Fu(/\s/);function Fu(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function om(e){const t=[];let n=-1,s=0,r=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&bi(e.charCodeAt(n+1))&&bi(e.charCodeAt(n+2)))r=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),r=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(s,n),encodeURIComponent(o)),s=n+r+1,o=""),r&&(n+=r,r=0)}return t.join("")+e.slice(s)}function Rn(e,t,n,s){const r=s?s-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Bn(l)?(e.enter(n),a(l)):t(l)}function a(l){return Bn(l)&&i++<r?(e.consume(l),a):(e.exit(n),t(l))}}const hX={tokenize:fX};function fX(e){const t=e.attempt(this.parser.constructs.contentInitial,s,r);let n;return t;function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Rn(e,t,"linePrefix")}function r(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return zt(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const mX={tokenize:pX},BT={tokenize:gX};function pX(e){const t=this,n=[];let s=0,r,i,o;return a;function a(x){if(s<n.length){const _=n[s];return t.containerState=_[1],e.attempt(_[0].continuation,l,c)(x)}return c(x)}function l(x){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&v();const _=t.events.length;let E=_,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}b(s);let M=_;for(;M<t.events.length;)t.events[M][1].end={...k},M++;return Mo(t.events,E+1,0,t.events.slice(_)),t.events.length=M,c(x)}return a(x)}function c(x){if(s===n.length){if(!r)return f(x);if(r.currentConstruct&&r.currentConstruct.concrete)return p(x);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(BT,d,h)(x)}function d(x){return r&&v(),b(s),f(x)}function h(x){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,p(x)}function f(x){return t.containerState={},e.attempt(BT,m,p)(x)}function m(x){return s++,n.push([t.currentConstruct,t.containerState]),f(x)}function p(x){if(x===null){r&&v(),b(0),e.consume(x);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:i}),y(x)}function y(x){if(x===null){w(e.exit("chunkFlow"),!0),b(0),e.consume(x);return}return zt(x)?(e.consume(x),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,a):(e.consume(x),y)}function w(x,_){const E=t.sliceStream(x);if(_&&E.push(null),x.previous=i,i&&(i.next=x),i=x,r.defineSkip(x.start),r.write(E),t.parser.lazy[x.start.line]){let k=r.events.length;for(;k--;)if(r.events[k][1].start.offset<o&&(!r.events[k][1].end||r.events[k][1].end.offset>o))return;const M=t.events.length;let R=M,L,T;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(L){T=t.events[R][1].end;break}L=!0}for(b(s),k=M;k<t.events.length;)t.events[k][1].end={...T},k++;Mo(t.events,R+1,0,t.events.slice(M)),t.events.length=k}}function b(x){let _=n.length;for(;_-- >x;){const E=n[_];t.containerState=E[1],E[0].exit.call(t,e)}n.length=x}function v(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function gX(e,t,n){return Rn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Df(e){if(e===null||Ns(e)||Hd(e))return 1;if(Ov(e))return 2}function Bv(e,t,n){const s=[];let r=-1;for(;++r<e.length;){const i=e[r].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const n3={name:"attention",resolveAll:yX,tokenize:bX};function yX(e,t){let n=-1,s,r,i,o,a,l,c,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[s][1].end},f={...e[n][1].start};PT(h,-l),PT(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[s][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},r={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[s][1].end={...o.start},e[n][1].start={...a.end},c=[],e[s][1].end.offset-e[s][1].start.offset&&(c=Ko(c,[["enter",e[s][1],t],["exit",e[s][1],t]])),c=Ko(c,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=Ko(c,Bv(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),c=Ko(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,c=Ko(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Mo(e,s-1,n-s+3,c),n=s+c.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function bX(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,r=Df(s);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),d=Df(l),h=!d||d===2&&r||n.includes(l),f=!r||r===2&&d||n.includes(s);return c._open=!!(i===42?h:h&&(r||!f)),c._close=!!(i===42?f:f&&(d||!h)),t(l)}}function PT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const vX={name:"autolink",tokenize:wX};function wX(e,t,n){let s=0;return r;function r(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return $i(m)?(e.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||bi(m)?(s=1,a(m)):c(m)}function a(m){return m===58?(e.consume(m),s=0,l):(m===43||m===45||m===46||bi(m))&&s++<32?(e.consume(m),a):(s=0,c(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||db(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),d):cX(m)?(e.consume(m),c):n(m)}function d(m){return bi(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),s=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):f(m)}function f(m){if((m===45||bi(m))&&s++<63){const p=m===45?f:h;return e.consume(m),p}return n(m)}}const eg={partial:!0,tokenize:xX};function xX(e,t,n){return s;function s(i){return Bn(i)?Rn(e,r,"linePrefix")(i):r(i)}function r(i){return i===null||zt(i)?t(i):n(i)}}const uD={continuation:{tokenize:kX},exit:SX,name:"blockQuote",tokenize:_X};function _X(e,t,n){const s=this;return r;function r(o){if(o===62){const a=s.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Bn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function kX(e,t,n){const s=this;return r;function r(o){return Bn(o)?Rn(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(uD,t,n)(o)}}function SX(e){e.exit("blockQuote")}const dD={name:"characterEscape",tokenize:TX};function TX(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),r}function r(i){return dX(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const hD={name:"characterReference",tokenize:CX};function CX(e,t,n){const s=this;let r=0,i,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=bi,d(h))}function c(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=uX,d):(e.enter("characterReferenceValue"),i=7,o=t3,d(h))}function d(h){if(h===59&&r){const f=e.exit("characterReferenceValue");return o===bi&&!IS(s.sliceSerialize(f))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&r++<i?(e.consume(h),d):n(h)}}const $T={partial:!0,tokenize:EX},zT={concrete:!0,name:"codeFenced",tokenize:AX};function AX(e,t,n){const s=this,r={partial:!0,tokenize:E};let i=0,o=0,a;return l;function l(k){return c(k)}function c(k){const M=s.events[s.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===a?(o++,e.consume(k),d):o<3?n(k):(e.exit("codeFencedFenceSequence"),Bn(k)?Rn(e,h,"whitespace")(k):h(k))}function h(k){return k===null||zt(k)?(e.exit("codeFencedFence"),s.interrupt?t(k):e.check($T,y,_)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||zt(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):Bn(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Rn(e,m,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function m(k){return k===null||zt(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||zt(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===a?n(k):(e.consume(k),p)}function y(k){return e.attempt(r,_,w)(k)}function w(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),b}function b(k){return i>0&&Bn(k)?Rn(e,v,"linePrefix",i+1)(k):v(k)}function v(k){return k===null||zt(k)?e.check($T,y,_)(k):(e.enter("codeFlowValue"),x(k))}function x(k){return k===null||zt(k)?(e.exit("codeFlowValue"),v(k)):(e.consume(k),x)}function _(k){return e.exit("codeFenced"),t(k)}function E(k,M,R){let L=0;return T;function T(F){return k.enter("lineEnding"),k.consume(F),k.exit("lineEnding"),N}function N(F){return k.enter("codeFencedFence"),Bn(F)?Rn(k,I,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):I(F)}function I(F){return F===a?(k.enter("codeFencedFenceSequence"),O(F)):R(F)}function O(F){return F===a?(L++,k.consume(F),O):L>=o?(k.exit("codeFencedFenceSequence"),Bn(F)?Rn(k,U,"whitespace")(F):U(F)):R(F)}function U(F){return F===null||zt(F)?(k.exit("codeFencedFence"),M(F)):R(F)}}}function EX(e,t,n){const s=this;return r;function r(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}const K2={name:"codeIndented",tokenize:NX},MX={partial:!0,tokenize:IX};function NX(e,t,n){const s=this;return r;function r(c){return e.enter("codeIndented"),Rn(e,i,"linePrefix",5)(c)}function i(c){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):zt(c)?e.attempt(MX,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||zt(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function IX(e,t,n){const s=this;return r;function r(o){return s.parser.lazy[s.now().line]?n(o):zt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):Rn(e,i,"linePrefix",5)(o)}function i(o){const a=s.events[s.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):zt(o)?r(o):n(o)}}const jX={name:"codeText",previous:LX,resolve:RX,tokenize:DX};function RX(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="codeTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function LX(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function DX(e,t,n){let s=0,r,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),s++,a):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),r=0,d(h)):zt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||zt(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),c)}function d(h){return h===96?(e.consume(h),r++,d):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",c(h))}}class OX{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const r=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return s&&Bm(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Bm(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Bm(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Bm(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Bm(this.left,n.reverse())}}}function Bm(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function fD(e){const t={};let n=-1,s,r,i,o,a,l,c;const d=new OX(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(s=d.get(n),n&&s[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=s[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,BX(d,n)),n=t[n],c=!0);else if(s[1]._container){for(i=n,r=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(r&&(d.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;r&&(s[1].end={...d.get(r)[1].start},a=d.slice(r,n),a.unshift(s),d.splice(r,n-r+1,a))}}return Mo(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function BX(e,t){const n=e.get(t)[1],s=e.get(t)[2];let r=t-1;const i=[];let o=n._tokenizer;o||(o=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let d,h,f=-1,m=n,p=0,y=0;const w=[y];for(;m;){for(;e.get(++r)[1]!==m;);i.push(r),m._tokenizer||(d=s.sliceStream(m),m.next||d.push(null),h&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(y=f+1,w.push(y),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):w.pop(),f=w.length;f--;){const b=a.slice(w[f],w[f+1]),v=i.pop();l.push([v,v+b.length-1]),e.splice(v,2,b)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const PX={resolve:zX,tokenize:FX},$X={partial:!0,tokenize:qX};function zX(e){return fD(e),e}function FX(e,t){let n;return s;function s(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(a)}function r(a){return a===null?i(a):zt(a)?e.check($X,o,i)(a):(e.consume(a),r)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}function qX(e,t,n){const s=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Rn(e,i,"linePrefix")}function i(o){if(o===null||zt(o))return n(o);const a=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(s.parser.constructs.flow,n,t)(o)}}function mD(e,t,n,s,r,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(e.enter(s),e.enter(r),e.enter(i),e.consume(b),e.exit(i),f):b===null||b===32||b===41||db(b)?n(b):(e.enter(s),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),y(b))}function f(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(r),e.exit(s),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===62?(e.exit("chunkString"),e.exit(a),f(b)):b===null||b===60||zt(b)?n(b):(e.consume(b),b===92?p:m)}function p(b){return b===60||b===62||b===92?(e.consume(b),m):m(b)}function y(b){return!d&&(b===null||b===41||Ns(b))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(s),t(b)):d<c&&b===40?(e.consume(b),d++,y):b===41?(e.consume(b),d--,y):b===null||b===32||b===40||db(b)?n(b):(e.consume(b),b===92?w:y)}function w(b){return b===40||b===41||b===92?(e.consume(b),y):y(b)}}function pD(e,t,n,s,r,i){const o=this;let a=0,l;return c;function c(m){return e.enter(s),e.enter(r),e.consume(m),e.exit(r),e.enter(i),d}function d(m){return a>999||m===null||m===91||m===93&&!l||m===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(e.exit(i),e.enter(r),e.consume(m),e.exit(r),e.exit(s),t):zt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||zt(m)||a++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Bn(m)),m===92?f:h)}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,h):h(m)}}function gD(e,t,n,s,r,i){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(s),e.enter(r),e.consume(f),e.exit(r),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(r),e.consume(f),e.exit(r),e.exit(s),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):zt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Rn(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===o||f===null||zt(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?h:d)}function h(f){return f===o||f===92?(e.consume(f),d):d(f)}}function D0(e,t){let n;return s;function s(r){return zt(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),n=!0,s):Bn(r)?Rn(e,s,n?"linePrefix":"lineSuffix")(r):t(r)}}const HX={name:"definition",tokenize:VX},UX={partial:!0,tokenize:WX};function VX(e,t,n){const s=this;let r;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return pD.call(s,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return r=Ca(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return Ns(m)?D0(e,c)(m):c(m)}function c(m){return mD(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(UX,h,h)(m)}function h(m){return Bn(m)?Rn(e,f,"whitespace")(m):f(m)}function f(m){return m===null||zt(m)?(e.exit("definition"),s.parser.defined.push(r),t(m)):n(m)}}function WX(e,t,n){return s;function s(a){return Ns(a)?D0(e,r)(a):n(a)}function r(a){return gD(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Bn(a)?Rn(e,o,"whitespace")(a):o(a)}function o(a){return a===null||zt(a)?t(a):n(a)}}const GX={name:"hardBreakEscape",tokenize:KX};function KX(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),r}function r(i){return zt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const YX={name:"headingAtx",resolve:QX,tokenize:XX};function QX(e,t){let n=e.length-2,s=3,r,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(r={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Mo(e,s,n-s+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]])),e}function XX(e,t,n){let s=0;return r;function r(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&s++<6?(e.consume(d),o):d===null||Ns(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||zt(d)?(e.exit("atxHeading"),t(d)):Bn(d)?Rn(e,a,"whitespace")(d):(e.enter("atxHeadingText"),c(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||Ns(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),c)}}const JX=["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","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],FT=["pre","script","style","textarea"],ZX={concrete:!0,name:"htmlFlow",resolveTo:nJ,tokenize:sJ},eJ={partial:!0,tokenize:iJ},tJ={partial:!0,tokenize:rJ};function nJ(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function sJ(e,t,n){const s=this;let r,i,o,a,l;return c;function c(C){return d(C)}function d(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),h}function h(C){return C===33?(e.consume(C),f):C===47?(e.consume(C),i=!0,y):C===63?(e.consume(C),r=3,s.interrupt?t:$):$i(C)?(e.consume(C),o=String.fromCharCode(C),w):n(C)}function f(C){return C===45?(e.consume(C),r=2,m):C===91?(e.consume(C),r=5,a=0,p):$i(C)?(e.consume(C),r=4,s.interrupt?t:$):n(C)}function m(C){return C===45?(e.consume(C),s.interrupt?t:$):n(C)}function p(C){const z="CDATA[";return C===z.charCodeAt(a++)?(e.consume(C),a===z.length?s.interrupt?t:I:p):n(C)}function y(C){return $i(C)?(e.consume(C),o=String.fromCharCode(C),w):n(C)}function w(C){if(C===null||C===47||C===62||Ns(C)){const z=C===47,X=o.toLowerCase();return!z&&!i&&FT.includes(X)?(r=1,s.interrupt?t(C):I(C)):JX.includes(o.toLowerCase())?(r=6,z?(e.consume(C),b):s.interrupt?t(C):I(C)):(r=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(C):i?v(C):x(C))}return C===45||bi(C)?(e.consume(C),o+=String.fromCharCode(C),w):n(C)}function b(C){return C===62?(e.consume(C),s.interrupt?t:I):n(C)}function v(C){return Bn(C)?(e.consume(C),v):T(C)}function x(C){return C===47?(e.consume(C),T):C===58||C===95||$i(C)?(e.consume(C),_):Bn(C)?(e.consume(C),x):T(C)}function _(C){return C===45||C===46||C===58||C===95||bi(C)?(e.consume(C),_):E(C)}function E(C){return C===61?(e.consume(C),k):Bn(C)?(e.consume(C),E):x(C)}function k(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),l=C,M):Bn(C)?(e.consume(C),k):R(C)}function M(C){return C===l?(e.consume(C),l=null,L):C===null||zt(C)?n(C):(e.consume(C),M)}function R(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Ns(C)?E(C):(e.consume(C),R)}function L(C){return C===47||C===62||Bn(C)?x(C):n(C)}function T(C){return C===62?(e.consume(C),N):n(C)}function N(C){return C===null||zt(C)?I(C):Bn(C)?(e.consume(C),N):n(C)}function I(C){return C===45&&r===2?(e.consume(C),j):C===60&&r===1?(e.consume(C),V):C===62&&r===4?(e.consume(C),J):C===63&&r===3?(e.consume(C),$):C===93&&r===5?(e.consume(C),ce):zt(C)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(eJ,B,O)(C)):C===null||zt(C)?(e.exit("htmlFlowData"),O(C)):(e.consume(C),I)}function O(C){return e.check(tJ,U,B)(C)}function U(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),F}function F(C){return C===null||zt(C)?O(C):(e.enter("htmlFlowData"),I(C))}function j(C){return C===45?(e.consume(C),$):I(C)}function V(C){return C===47?(e.consume(C),o="",ee):I(C)}function ee(C){if(C===62){const z=o.toLowerCase();return FT.includes(z)?(e.consume(C),J):I(C)}return $i(C)&&o.length<8?(e.consume(C),o+=String.fromCharCode(C),ee):I(C)}function ce(C){return C===93?(e.consume(C),$):I(C)}function $(C){return C===62?(e.consume(C),J):C===45&&r===2?(e.consume(C),$):I(C)}function J(C){return C===null||zt(C)?(e.exit("htmlFlowData"),B(C)):(e.consume(C),J)}function B(C){return e.exit("htmlFlow"),t(C)}}function rJ(e,t,n){const s=this;return r;function r(o){return zt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function iJ(e,t,n){return s;function s(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(eg,t,n)}}const oJ={name:"htmlText",tokenize:aJ};function aJ(e,t,n){const s=this;let r,i,o;return a;function a($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),l}function l($){return $===33?(e.consume($),c):$===47?(e.consume($),E):$===63?(e.consume($),x):$i($)?(e.consume($),R):n($)}function c($){return $===45?(e.consume($),d):$===91?(e.consume($),i=0,p):$i($)?(e.consume($),v):n($)}function d($){return $===45?(e.consume($),m):n($)}function h($){return $===null?n($):$===45?(e.consume($),f):zt($)?(o=h,V($)):(e.consume($),h)}function f($){return $===45?(e.consume($),m):h($)}function m($){return $===62?j($):$===45?f($):h($)}function p($){const J="CDATA[";return $===J.charCodeAt(i++)?(e.consume($),i===J.length?y:p):n($)}function y($){return $===null?n($):$===93?(e.consume($),w):zt($)?(o=y,V($)):(e.consume($),y)}function w($){return $===93?(e.consume($),b):y($)}function b($){return $===62?j($):$===93?(e.consume($),b):y($)}function v($){return $===null||$===62?j($):zt($)?(o=v,V($)):(e.consume($),v)}function x($){return $===null?n($):$===63?(e.consume($),_):zt($)?(o=x,V($)):(e.consume($),x)}function _($){return $===62?j($):x($)}function E($){return $i($)?(e.consume($),k):n($)}function k($){return $===45||bi($)?(e.consume($),k):M($)}function M($){return zt($)?(o=M,V($)):Bn($)?(e.consume($),M):j($)}function R($){return $===45||bi($)?(e.consume($),R):$===47||$===62||Ns($)?L($):n($)}function L($){return $===47?(e.consume($),j):$===58||$===95||$i($)?(e.consume($),T):zt($)?(o=L,V($)):Bn($)?(e.consume($),L):j($)}function T($){return $===45||$===46||$===58||$===95||bi($)?(e.consume($),T):N($)}function N($){return $===61?(e.consume($),I):zt($)?(o=N,V($)):Bn($)?(e.consume($),N):L($)}function I($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),r=$,O):zt($)?(o=I,V($)):Bn($)?(e.consume($),I):(e.consume($),U)}function O($){return $===r?(e.consume($),r=void 0,F):$===null?n($):zt($)?(o=O,V($)):(e.consume($),O)}function U($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||Ns($)?L($):(e.consume($),U)}function F($){return $===47||$===62||Ns($)?L($):n($)}function j($){return $===62?(e.consume($),e.exit("htmlTextData"),e.exit("htmlText"),t):n($)}function V($){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),ee}function ee($){return Bn($)?Rn(e,ce,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):ce($)}function ce($){return e.enter("htmlTextData"),o($)}}const jS={name:"labelEnd",resolveAll:dJ,resolveTo:hJ,tokenize:fJ},lJ={tokenize:mJ},cJ={tokenize:pJ},uJ={tokenize:gJ};function dJ(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const r=s.type==="labelImage"?4:2;s.type="data",t+=r}}return e.length!==n.length&&Mo(e,0,e.length,n),e}function hJ(e,t){let n=e.length,s=0,r,i,o,a;for(;n--;)if(r=e[n][1],i){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[n][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(i=n,r.type!=="labelLink")){s=2;break}}else r.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=Ko(a,e.slice(i+1,i+s+3)),a=Ko(a,[["enter",d,t]]),a=Ko(a,Bv(t.parser.constructs.insideSpan.null,e.slice(i+s+4,o-3),t)),a=Ko(a,[["exit",d,t],e[o-2],e[o-1],["exit",c,t]]),a=Ko(a,e.slice(o+1)),a=Ko(a,[["exit",l,t]]),Mo(e,i,e.length,a),e}function fJ(e,t,n){const s=this;let r=s.events.length,i,o;for(;r--;)if((s.events[r][1].type==="labelImage"||s.events[r][1].type==="labelLink")&&!s.events[r][1]._balanced){i=s.events[r][1];break}return a;function a(f){return i?i._inactive?h(f):(o=s.parser.defined.includes(Ca(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(lJ,d,o?d:h)(f):f===91?e.attempt(cJ,d,o?c:h)(f):o?d(f):h(f)}function c(f){return e.attempt(uJ,d,h)(f)}function d(f){return t(f)}function h(f){return i._balanced=!0,n(f)}}function mJ(e,t,n){return s;function s(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),r}function r(h){return Ns(h)?D0(e,i)(h):i(h)}function i(h){return h===41?d(h):mD(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Ns(h)?D0(e,l)(h):d(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?gD(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Ns(h)?D0(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function pJ(e,t,n){const s=this;return r;function r(a){return pD.call(s,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return s.parser.defined.includes(Ca(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function gJ(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),r}function r(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const yJ={name:"labelStartImage",resolveAll:jS.resolveAll,tokenize:bJ};function bJ(e,t,n){const s=this;return r;function r(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(a):t(a)}}const vJ={name:"labelStartLink",resolveAll:jS.resolveAll,tokenize:wJ};function wJ(e,t,n){const s=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(o):t(o)}}const Y2={name:"lineEnding",tokenize:xJ};function xJ(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Rn(e,t,"linePrefix")}}const cy={name:"thematicBreak",tokenize:_J};function _J(e,t,n){let s=0,r;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return r=c,a(c)}function a(c){return c===r?(e.enter("thematicBreakSequence"),l(c)):s>=3&&(c===null||zt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===r?(e.consume(c),s++,l):(e.exit("thematicBreakSequence"),Bn(c)?Rn(e,a,"whitespace")(c):a(c))}}const Ji={continuation:{tokenize:CJ},exit:EJ,name:"list",tokenize:TJ},kJ={partial:!0,tokenize:MJ},SJ={partial:!0,tokenize:AJ};function TJ(e,t,n){const s=this,r=s.events[s.events.length-1];let i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return a;function a(m){const p=s.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!s.containerState.marker||m===s.containerState.marker:t3(m)){if(s.containerState.type||(s.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(cy,n,c)(m):c(m);if(!s.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return t3(m)&&++o<10?(e.consume(m),l):(!s.interrupt||o<2)&&(s.containerState.marker?m===s.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),c(m)):n(m)}function c(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||m,e.check(eg,s.interrupt?n:d,e.attempt(kJ,f,h))}function d(m){return s.containerState.initialBlankLine=!0,i++,f(m)}function h(m){return Bn(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function CJ(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(eg,r,i);function r(a){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Rn(e,t,"listItemIndent",s.containerState.size+1)(a)}function i(a){return s.containerState.furtherBlankLines||!Bn(a)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,o(a)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(SJ,t,o)(a))}function o(a){return s.containerState._closeFlow=!0,s.interrupt=void 0,Rn(e,e.attempt(Ji,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function AJ(e,t,n){const s=this;return Rn(e,r,"listItemIndent",s.containerState.size+1);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===s.containerState.size?t(i):n(i)}}function EJ(e){e.exit(this.containerState.type)}function MJ(e,t,n){const s=this;return Rn(e,r,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(i){const o=s.events[s.events.length-1];return!Bn(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const qT={name:"setextUnderline",resolveTo:NJ,tokenize:IJ};function NJ(e,t){let n=e.length,s,r,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(r=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=o,e.push(["exit",o,t]),e}function IJ(e,t,n){const s=this;let r;return i;function i(c){let d=s.events.length,h;for(;d--;)if(s.events[d][1].type!=="lineEnding"&&s.events[d][1].type!=="linePrefix"&&s.events[d][1].type!=="content"){h=s.events[d][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||h)?(e.enter("setextHeadingLine"),r=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===r?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Bn(c)?Rn(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||zt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const jJ={tokenize:RJ};function RJ(e){const t=this,n=e.attempt(eg,s,e.attempt(this.parser.constructs.flowInitial,r,Rn(e,e.attempt(this.parser.constructs.flow,r,e.attempt(PX,r)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function r(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const LJ={resolveAll:bD()},DJ=yD("string"),OJ=yD("text");function yD(e){return{resolveAll:bD(e==="text"?BJ:void 0),tokenize:t};function t(n){const s=this,r=this.parser.constructs[e],i=n.attempt(r,o,a);return o;function o(d){return c(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const h=r[d];let f=-1;if(h)for(;++f<h.length;){const m=h[f];if(!m.previous||m.previous.call(s,s.previous))return!0}return!1}}}function bD(e){return t;function t(n,s){let r=-1,i;for(;++r<=n.length;)i===void 0?n[r]&&n[r][1].type==="data"&&(i=r,r++):(!n[r]||n[r][1].type!=="data")&&(r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(n,s):n}}function BJ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],r=t.sliceStream(s);let i=r.length,o=-1,a=0,l;for(;i--;){const c=r[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:s.start._bufferIndex+o,_index:s.start._index+i,line:s.end.line,column:s.end.column-a,offset:s.end.offset-a},end:{...s.end}};s.end={...c.start},s.start.offset===s.end.offset?Object.assign(s,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const PJ={42:Ji,43:Ji,45:Ji,48:Ji,49:Ji,50:Ji,51:Ji,52:Ji,53:Ji,54:Ji,55:Ji,56:Ji,57:Ji,62:uD},$J={91:HX},zJ={[-2]:K2,[-1]:K2,32:K2},FJ={35:YX,42:cy,45:[qT,cy],60:ZX,61:qT,95:cy,96:zT,126:zT},qJ={38:hD,92:dD},HJ={[-5]:Y2,[-4]:Y2,[-3]:Y2,33:yJ,38:hD,42:n3,60:[vX,oJ],91:vJ,92:[GX,dD],93:jS,95:n3,96:jX},UJ={null:[n3,LJ]},VJ={null:[42,95]},WJ={null:[]},GJ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VJ,contentInitial:$J,disable:WJ,document:PJ,flow:FJ,flowInitial:zJ,insideSpan:UJ,string:qJ,text:HJ},Symbol.toStringTag,{value:"Module"}));function KJ(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const r={},i=[];let o=[],a=[];const l={attempt:M(E),check:M(k),consume:v,enter:x,exit:_,interrupt:M(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:h};let d=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function h(N){return o=Ko(o,N),w(),o[o.length-1]!==null?[]:(R(t,0),c.events=Bv(i,c.events,c),c.events)}function f(N,I){return QJ(m(N),I)}function m(N){return YJ(o,N)}function p(){const{_bufferIndex:N,_index:I,line:O,column:U,offset:F}=s;return{_bufferIndex:N,_index:I,line:O,column:U,offset:F}}function y(N){r[N.line]=N.column,T()}function w(){let N;for(;s._index<o.length;){const I=o[s._index];if(typeof I=="string")for(N=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===N&&s._bufferIndex<I.length;)b(I.charCodeAt(s._bufferIndex));else b(I)}}function b(N){d=d(N)}function v(N){zt(N)?(s.line++,s.column=1,s.offset+=N===-3?2:1,T()):N!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===o[s._index].length&&(s._bufferIndex=-1,s._index++)),c.previous=N}function x(N,I){const O=I||{};return O.type=N,O.start=p(),c.events.push(["enter",O,c]),a.push(O),O}function _(N){const I=a.pop();return I.end=p(),c.events.push(["exit",I,c]),I}function E(N,I){R(N,I.from)}function k(N,I){I.restore()}function M(N,I){return O;function O(U,F,j){let V,ee,ce,$;return Array.isArray(U)?B(U):"tokenize"in U?B([U]):J(U);function J(ae){return be;function be(fe){const ie=fe!==null&&ae[fe],G=fe!==null&&ae.null,q=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(G)?G:G?[G]:[]];return B(q)(fe)}}function B(ae){return V=ae,ee=0,ae.length===0?j:C(ae[ee])}function C(ae){return be;function be(fe){return $=L(),ce=ae,ae.partial||(c.currentConstruct=ae),ae.name&&c.parser.constructs.disable.null.includes(ae.name)?X():ae.tokenize.call(I?Object.assign(Object.create(c),I):c,l,z,X)(fe)}}function z(ae){return N(ce,$),F}function X(ae){return $.restore(),++ee<V.length?C(V[ee]):j}}}function R(N,I){N.resolveAll&&!i.includes(N)&&i.push(N),N.resolve&&Mo(c.events,I,c.events.length-I,N.resolve(c.events.slice(I),c)),N.resolveTo&&(c.events=N.resolveTo(c.events,c))}function L(){const N=p(),I=c.previous,O=c.currentConstruct,U=c.events.length,F=Array.from(a);return{from:U,restore:j};function j(){s=N,c.previous=I,c.currentConstruct=O,c.events.length=U,a=F,T()}}function T(){s.line in r&&s.column<2&&(s.column=r[s.line],s.offset+=r[s.line]-1)}}function YJ(e,t){const n=t.start._index,s=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex;let o;if(n===r)o=[e[n].slice(s,i)];else{if(o=e.slice(n,r),s>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(s):o.shift()}i>0&&o.push(e[r].slice(0,i))}return o}function QJ(e,t){let n=-1;const s=[];let r;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":"	";break}case-1:{if(!t&&r)continue;o=" ";break}default:o=String.fromCharCode(i)}r=i===-2,s.push(o)}return s.join("")}function XJ(e){const s={constructs:lD([GJ,...(e||{}).extensions||[]]),content:r(hX),defined:[],document:r(mX),flow:r(jJ),lazy:{},string:r(DJ),text:r(OJ)};return s;function r(i){return o;function o(a){return KJ(s,i,a)}}}function JJ(e){for(;!fD(e););return e}const HT=/[\0\t\n\r]/g;function ZJ(){let e=1,t="",n=!0,s;return r;function r(i,o,a){const l=[];let c,d,h,f,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(HT.lastIndex=h,c=HT.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){t=i.slice(h);break}if(m===10&&h===f&&s)l.push(-3),s=void 0;else switch(s&&(l.push(-5),s=void 0),h<f&&(l.push(i.slice(h,f)),e+=f-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:s=!0,e=1}h=f+1}return a&&(s&&l.push(-5),t&&l.push(t),l.push(null)),l}}const eZ=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tZ(e){return e.replace(eZ,nZ)}function nZ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const r=n.charCodeAt(1),i=r===120||r===88;return cD(n.slice(i?2:1),i?16:10)}return IS(n)||e}const vD={}.hasOwnProperty;function sZ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),rZ(n)(JJ(XJ(n).document().write(ZJ()(e,t,!0))))}function rZ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ut),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(Ae),blockQuote:i(G),characterEscape:L,characterReference:L,codeFenced:i(q),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(q,o),codeText:i(le,o),codeTextData:L,data:L,codeFlowValue:L,definition:i(Se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i($e),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(ct,o),htmlFlowData:L,htmlText:i(ct,o),htmlTextData:L,image:i(ht),label:o,link:i(ut),listItem:i(tt),listItemValue:f,listOrdered:i(ft,h),listUnordered:i(ft),paragraph:i(qt),reference:C,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ae),strong:i(Ye),thematicBreak:i(st)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:ie,autolinkProtocol:fe,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:X,characterReferenceMarkerNumeric:X,characterReferenceValue:ae,characterReference:be,codeFenced:l(w),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:T,codeIndented:l(b),codeText:l(F),codeTextData:T,data:T,definition:l(),definitionDestinationString:_,definitionLabelString:v,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(O),htmlFlowData:T,htmlText:l(U),htmlTextData:T,image:l(V),label:ce,labelText:ee,lineEnding:N,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:z,resourceDestinationString:$,resourceTitleString:J,resource:B,setextHeading:l(R),setextHeadingLineSequence:M,setextHeadingText:k,strong:l(),thematicBreak:l()}};wD(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ne){let ue={type:"root",children:[]};const Re={stack:[ue],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:d,data:n},rt=[];let vt=-1;for(;++vt<ne.length;)if(ne[vt][1].type==="listOrdered"||ne[vt][1].type==="listUnordered")if(ne[vt][0]==="enter")rt.push(vt);else{const tn=rt.pop();vt=r(ne,tn,vt)}for(vt=-1;++vt<ne.length;){const tn=t[ne[vt][0]];vD.call(tn,ne[vt][1].type)&&tn[ne[vt][1].type].call(Object.assign({sliceSerialize:ne[vt][2].sliceSerialize},Re),ne[vt][1])}if(Re.tokenStack.length>0){const tn=Re.tokenStack[Re.tokenStack.length-1];(tn[1]||UT).call(Re,void 0,tn[0])}for(ue.position={start:Nc(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Nc(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},vt=-1;++vt<t.transforms.length;)ue=t.transforms[vt](ue)||ue;return ue}function r(ne,ue,Re){let rt=ue-1,vt=-1,tn=!1,jn,ln,Pn,Qt;for(;++rt<=Re;){const ve=ne[rt];switch(ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ve[0]==="enter"?vt++:vt--,Qt=void 0;break}case"lineEndingBlank":{ve[0]==="enter"&&(jn&&!Qt&&!vt&&!Pn&&(Pn=rt),Qt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qt=void 0}if(!vt&&ve[0]==="enter"&&ve[1].type==="listItemPrefix"||vt===-1&&ve[0]==="exit"&&(ve[1].type==="listUnordered"||ve[1].type==="listOrdered")){if(jn){let Be=rt;for(ln=void 0;Be--;){const He=ne[Be];if(He[1].type==="lineEnding"||He[1].type==="lineEndingBlank"){if(He[0]==="exit")continue;ln&&(ne[ln][1].type="lineEndingBlank",tn=!0),He[1].type="lineEnding",ln=Be}else if(!(He[1].type==="linePrefix"||He[1].type==="blockQuotePrefix"||He[1].type==="blockQuotePrefixWhitespace"||He[1].type==="blockQuoteMarker"||He[1].type==="listItemIndent"))break}Pn&&(!ln||Pn<ln)&&(jn._spread=!0),jn.end=Object.assign({},ln?ne[ln][1].start:ve[1].end),ne.splice(ln||rt,0,["exit",jn,ve[2]]),rt++,Re++}if(ve[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},ve[1].start),end:void 0};jn=Be,ne.splice(rt,0,["enter",Be,ve[2]]),rt++,Re++,Pn=void 0,Qt=!0}}}return ne[ue][1]._spread=tn,Re}function i(ne,ue){return Re;function Re(rt){a.call(this,ne(rt),rt),ue&&ue.call(this,rt)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ne,ue,Re){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([ue,Re||void 0]),ne.position={start:Nc(ue.start),end:void 0}}function l(ne){return ue;function ue(Re){ne&&ne.call(this,Re),c.call(this,Re)}}function c(ne,ue){const Re=this.stack.pop(),rt=this.tokenStack.pop();if(rt)rt[0].type!==ne.type&&(ue?ue.call(this,ne,rt[0]):(rt[1]||UT).call(this,ne,rt[0]));else throw new Error("Cannot close `"+ne.type+"` ("+L0({start:ne.start,end:ne.end})+"): it’s not open");Re.position.end=Nc(ne.end)}function d(){return NS(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(ne){if(this.data.expectingFirstListItemValue){const ue=this.stack[this.stack.length-2];ue.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.lang=ne}function p(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.meta=ne}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ne.replace(/(\r?\n|\r)$/g,"")}function v(ne){const ue=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ue,Re.identifier=Ca(this.sliceSerialize(ne)).toLowerCase()}function x(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.title=ne}function _(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.url=ne}function E(ne){const ue=this.stack[this.stack.length-1];if(!ue.depth){const Re=this.sliceSerialize(ne).length;ue.depth=Re}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function M(ne){const ue=this.stack[this.stack.length-1];ue.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ne){const Re=this.stack[this.stack.length-1].children;let rt=Re[Re.length-1];(!rt||rt.type!=="text")&&(rt=ge(),rt.position={start:Nc(ne.start),end:void 0},Re.push(rt)),this.stack.push(rt)}function T(ne){const ue=this.stack.pop();ue.value+=this.sliceSerialize(ne),ue.position.end=Nc(ne.end)}function N(ne){const ue=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Re=ue.children[ue.children.length-1];Re.position.end=Nc(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ue.type)&&(L.call(this,ne),T.call(this,ne))}function I(){this.data.atHardBreak=!0}function O(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ne}function U(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ne}function F(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.value=ne}function j(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ue,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function V(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=ue,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function ee(ne){const ue=this.sliceSerialize(ne),Re=this.stack[this.stack.length-2];Re.label=tZ(ue),Re.identifier=Ca(ue).toLowerCase()}function ce(){const ne=this.stack[this.stack.length-1],ue=this.resume(),Re=this.stack[this.stack.length-1];if(this.data.inReference=!0,Re.type==="link"){const rt=ne.children;Re.children=rt}else Re.alt=ue}function $(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.url=ne}function J(){const ne=this.resume(),ue=this.stack[this.stack.length-1];ue.title=ne}function B(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function z(ne){const ue=this.resume(),Re=this.stack[this.stack.length-1];Re.label=ue,Re.identifier=Ca(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function X(ne){this.data.characterReferenceType=ne.type}function ae(ne){const ue=this.sliceSerialize(ne),Re=this.data.characterReferenceType;let rt;Re?(rt=cD(ue,Re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):rt=IS(ue);const vt=this.stack[this.stack.length-1];vt.value+=rt}function be(ne){const ue=this.stack.pop();ue.position.end=Nc(ne.end)}function fe(ne){T.call(this,ne);const ue=this.stack[this.stack.length-1];ue.url=this.sliceSerialize(ne)}function ie(ne){T.call(this,ne);const ue=this.stack[this.stack.length-1];ue.url="mailto:"+this.sliceSerialize(ne)}function G(){return{type:"blockquote",children:[]}}function q(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $e(){return{type:"emphasis",children:[]}}function Ae(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function ct(){return{type:"html",value:""}}function ht(){return{type:"image",title:null,url:"",alt:null}}function ut(){return{type:"link",title:null,url:"",children:[]}}function ft(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[]}}function tt(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[]}}function qt(){return{type:"paragraph",children:[]}}function Ye(){return{type:"strong",children:[]}}function ge(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function Nc(e){return{line:e.line,column:e.column,offset:e.offset}}function wD(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?wD(e,s):iZ(e,s)}}function iZ(e,t){let n;for(n in t)if(vD.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function UT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+L0({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+L0({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+L0({start:t.start,end:t.end})+") is still open")}function oZ(e){const t=this;t.parser=n;function n(s){return sZ(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function aZ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function lZ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function cZ(e,t){const n=t.value?t.value+`
`:"",s={},r=t.lang?t.lang.split(/\s+/):[];r.length>0&&(s.className=["language-"+r[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function uZ(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dZ(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hZ(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),r=om(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let o,a=e.footnoteCounts.get(s);a===void 0?(a=0,e.footnoteOrder.push(s),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(s,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+r,id:n+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function fZ(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mZ(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function xD(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const r=e.all(t),i=r[0];i&&i.type==="text"?i.value="["+i.value:r.unshift({type:"text",value:"["});const o=r[r.length-1];return o&&o.type==="text"?o.value+=s:r.push({type:"text",value:s}),r}function pZ(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return xD(e,t);const r={src:om(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function gZ(e,t){const n={src:om(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function yZ(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function bZ(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return xD(e,t);const r={href:om(s.url||"")};s.title!==null&&s.title!==void 0&&(r.title=s.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function vZ(e,t){const n={href:om(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function wZ(e,t,n){const s=e.all(t),r=n?xZ(n):_D(t),i={},o=[];if(typeof t.checked=="boolean"){const d=s[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},s.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<s.length;){const d=s[a];(r||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!r?o.push(...d.children):o.push(d)}const l=s[s.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,c),e.applyData(t,c)}function xZ(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=_D(n[s])}return t}function _D(e){const t=e.spread;return t??e.children.length>1}function _Z(e,t){const n={},s=e.all(t);let r=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++r<s.length;){const o=s[r];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function kZ(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function SZ(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function TZ(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CZ(e,t){const n=e.all(t),s=n.shift(),r=[];if(s){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],o),r.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=CS(t.children[1]),l=tD(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),r.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function AZ(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const h=t.children[l],f={},m=o?o[l]:void 0;m&&(f.align=m);let p={type:"element",tagName:i,properties:f,children:[]};h&&(p.children=e.all(h),e.patch(h,p),p=e.applyData(h,p)),c.push(p)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,d),e.applyData(t,d)}function EZ(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const VT=9,WT=32;function MZ(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),r=0;const i=[];for(;s;)i.push(GT(t.slice(r,s.index),r>0,!0),s[0]),r=s.index+s[0].length,s=n.exec(t);return i.push(GT(t.slice(r),r>0,!1)),i.join("")}function GT(e,t,n){let s=0,r=e.length;if(t){let i=e.codePointAt(s);for(;i===VT||i===WT;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(r-1);for(;i===VT||i===WT;)r--,i=e.codePointAt(r-1)}return r>s?e.slice(s,r):""}function NZ(e,t){const n={type:"text",value:MZ(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function IZ(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const jZ={blockquote:aZ,break:lZ,code:cZ,delete:uZ,emphasis:dZ,footnoteReference:hZ,heading:fZ,html:mZ,imageReference:pZ,image:gZ,inlineCode:yZ,linkReference:bZ,link:vZ,listItem:wZ,list:_Z,paragraph:kZ,root:SZ,strong:TZ,table:CZ,tableCell:EZ,tableRow:AZ,text:NZ,thematicBreak:IZ,toml:Qg,yaml:Qg,definition:Qg,footnoteDefinition:Qg};function Qg(){}const kD=-1,Pv=0,O0=1,hb=2,RS=3,LS=4,DS=5,OS=6,SD=7,TD=8,KT=typeof self=="object"?self:globalThis,RZ=(e,t)=>{const n=(r,i)=>(e.set(i,r),r),s=r=>{if(e.has(r))return e.get(r);const[i,o]=t[r];switch(i){case Pv:case kD:return n(o,r);case O0:{const a=n([],r);for(const l of o)a.push(s(l));return a}case hb:{const a=n({},r);for(const[l,c]of o)a[s(l)]=s(c);return a}case RS:return n(new Date(o),r);case LS:{const{source:a,flags:l}=o;return n(new RegExp(a,l),r)}case DS:{const a=n(new Map,r);for(const[l,c]of o)a.set(s(l),s(c));return a}case OS:{const a=n(new Set,r);for(const l of o)a.add(s(l));return a}case SD:{const{name:a,message:l}=o;return n(new KT[a](l),r)}case TD:return n(BigInt(o),r);case"BigInt":return n(Object(BigInt(o)),r);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new KT[i](o),r)};return s},YT=e=>RZ(new Map,e)(0),Th="",{toString:LZ}={},{keys:DZ}=Object,Pm=e=>{const t=typeof e;if(t!=="object"||!e)return[Pv,t];const n=LZ.call(e).slice(8,-1);switch(n){case"Array":return[O0,Th];case"Object":return[hb,Th];case"Date":return[RS,Th];case"RegExp":return[LS,Th];case"Map":return[DS,Th];case"Set":return[OS,Th];case"DataView":return[O0,n]}return n.includes("Array")?[O0,n]:n.includes("Error")?[SD,n]:[hb,n]},Xg=([e,t])=>e===Pv&&(t==="function"||t==="symbol"),OZ=(e,t,n,s)=>{const r=(o,a)=>{const l=s.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=Pm(o);switch(a){case Pv:{let d=o;switch(l){case"bigint":a=TD,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return r([kD],o)}return r([a,d],o)}case O0:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),r([l,[...f]],o)}const d=[],h=r([a,d],o);for(const f of o)d.push(i(f));return h}case hb:{if(l)switch(l){case"BigInt":return r([l,o.toString()],o);case"Boolean":case"Number":case"String":return r([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const d=[],h=r([a,d],o);for(const f of DZ(o))(e||!Xg(Pm(o[f])))&&d.push([i(f),i(o[f])]);return h}case RS:return r([a,o.toISOString()],o);case LS:{const{source:d,flags:h}=o;return r([a,{source:d,flags:h}],o)}case DS:{const d=[],h=r([a,d],o);for(const[f,m]of o)(e||!(Xg(Pm(f))||Xg(Pm(m))))&&d.push([i(f),i(m)]);return h}case OS:{const d=[],h=r([a,d],o);for(const f of o)(e||!Xg(Pm(f)))&&d.push(i(f));return h}}const{message:c}=o;return r([a,{name:l,message:c}],o)};return i},QT=(e,{json:t,lossy:n}={})=>{const s=[];return OZ(!(t||n),!!t,new Map,s)(e),s},fb=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?YT(QT(e,t)):structuredClone(e):(e,t)=>YT(QT(e,t));function BZ(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function PZ(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function $Z(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||BZ,s=e.options.footnoteBackLabel||PZ,r=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const d=e.all(c),h=String(c.identifier).toUpperCase(),f=om(h.toLowerCase());let m=0;const p=[],y=e.footnoteCounts.get(h);for(;y!==void 0&&++m<=y;){p.length>0&&p.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,m);typeof v=="string"&&(v={type:"text",value:v}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(l,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...p)}else d.push(...p);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(c,b),a.push(b)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...fb(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const tg=function(e){if(e==null)return HZ;if(typeof e=="function")return $v(e);if(typeof e=="object")return Array.isArray(e)?zZ(e):FZ(e);if(typeof e=="string")return qZ(e);throw new Error("Expected function, string, or object as test")};function zZ(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=tg(e[n]);return $v(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function FZ(e){const t=e;return $v(n);function n(s){const r=s;let i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function qZ(e){return $v(t);function t(n){return n&&n.type===e}}function $v(e){return t;function t(n,s,r){return!!(UZ(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function HZ(){return!0}function UZ(e){return e!==null&&typeof e=="object"&&"type"in e}const CD=[],VZ=!0,s3=!1,AD="skip";function BS(e,t,n,s){let r;typeof t=="function"&&typeof n!="function"?(s=n,n=t):r=t;const i=tg(r),o=s?-1:1;a(e,void 0,[])();function a(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const m=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=CD,p,y,w;if((!t||i(l,c,d[d.length-1]||void 0))&&(m=WZ(n(l,d)),m[0]===s3))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!==AD)for(y=(s?b.children.length:-1)+o,w=d.concat(b);y>-1&&y<b.children.length;){const v=b.children[y];if(p=a(v,y,w)(),p[0]===s3)return p;y=typeof p[1]=="number"?p[1]:y+o}}return m}}}function WZ(e){return Array.isArray(e)?e:typeof e=="number"?[VZ,e]:e==null?CD:[e]}function PS(e,t,n,s){let r,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,r=n):(i=t,o=n,r=s),BS(e,i,a,r);function a(l,c){const d=c[c.length-1],h=d?d.children.indexOf(l):void 0;return o(l,h,d)}}const r3={}.hasOwnProperty,GZ={};function KZ(e,t){const n=t||GZ,s=new Map,r=new Map,i=new Map,o={...jZ,...n.handlers},a={all:c,applyData:QZ,definitionById:s,footnoteById:r,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:YZ,wrap:JZ};return PS(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?s:r,f=String(d.identifier).toUpperCase();h.has(f)||h.set(f,d)}}),a;function l(d,h){const f=d.type,m=a.handlers[f];if(r3.call(a.handlers,f)&&m)return m(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in d){const{children:y,...w}=d,b=fb(w);return b.children=a.all(d),b}return fb(d)}return(a.options.unknownHandler||XZ)(a,d,h)}function c(d){const h=[];if("children"in d){const f=d.children;let m=-1;for(;++m<f.length;){const p=a.one(f[m],d);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=XT(p.value)),!Array.isArray(p)&&p.type==="element")){const y=p.children[0];y&&y.type==="text"&&(y.value=XT(y.value))}Array.isArray(p)?h.push(...p):h.push(p)}}}return h}}function YZ(e,t){e.position&&(t.position=PQ(e))}function QZ(e,t){let n=t;if(e&&e.data){const s=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const o="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,fb(i)),"children"in n&&n.children&&r!==null&&r!==void 0&&(n.children=r)}return n}function XZ(e,t){const n=t.data||{},s="value"in t&&!(r3.call(n,"hProperties")||r3.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function JZ(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
`});++s<e.length;)s&&n.push({type:"text",value:`
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function XT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function JT(e,t){const n=KZ(e,t),s=n.one(e,void 0),r=$Z(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return r&&i.children.push({type:"text",value:`
`},r),i}function ZZ(e,t){return e&&"run"in e?async function(n,s){const r=JT(n,{file:s,...t});await e.run(r,s)}:function(n,s){return JT(n,{file:s,...e||t})}}function ZT(e){if(e)throw e}var uy=Object.prototype.hasOwnProperty,ED=Object.prototype.toString,eC=Object.defineProperty,tC=Object.getOwnPropertyDescriptor,nC=function(t){return typeof Array.isArray=="function"?Array.isArray(t):ED.call(t)==="[object Array]"},sC=function(t){if(!t||ED.call(t)!=="[object Object]")return!1;var n=uy.call(t,"constructor"),s=t.constructor&&t.constructor.prototype&&uy.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!s)return!1;var r;for(r in t);return typeof r>"u"||uy.call(t,r)},rC=function(t,n){eC&&n.name==="__proto__"?eC(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},iC=function(t,n){if(n==="__proto__")if(uy.call(t,n)){if(tC)return tC(t,n).value}else return;return t[n]},eee=function e(){var t,n,s,r,i,o,a=arguments[0],l=1,c=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)s=iC(a,n),r=iC(t,n),a!==r&&(d&&r&&(sC(r)||(i=nC(r)))?(i?(i=!1,o=s&&nC(s)?s:[]):o=s&&sC(s)?s:{},rC(a,{name:n,newValue:e(d,o,r)})):typeof r<"u"&&rC(a,{name:n,newValue:r}));return a};const Q2=lv(eee);function i3(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function tee(){const e=[],t={run:n,use:s};return t;function n(...r){let i=-1;const o=r.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...r);function a(l,...c){const d=e[++i];let h=-1;if(l){o(l);return}for(;++h<r.length;)(c[h]===null||c[h]===void 0)&&(c[h]=r[h]);r=c,d?nee(d,a)(...c):o(null,...c)}}function s(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function nee(e,t){let n;return s;function s(...o){const a=e.length>o.length;let l;a&&o.push(r);try{l=e.apply(this,o)}catch(c){const d=c;if(a&&n)throw d;return r(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,r):l instanceof Error?r(l):i(l))}function r(o,...a){n||(n=!0,t(o,...a))}function i(o){r(null,o)}}const Za={basename:see,dirname:ree,extname:iee,join:oee,sep:"/"};function see(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ng(e);let n=0,s=-1,r=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else s<0&&(i=!0,s=r+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let o=-1,a=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(i){n=r+1;break}}else o<0&&(i=!0,o=r+1),a>-1&&(e.codePointAt(r)===t.codePointAt(a--)?a<0&&(s=r):(a=-1,s=o));return n===s?s=o:s<0&&(s=e.length),e.slice(n,s)}function ree(e){if(ng(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function iee(e){ng(e);let t=e.length,n=-1,s=0,r=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){s=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?r<0?r=t:i!==1&&(i=1):r>-1&&(i=-1)}return r<0||n<0||i===0||i===1&&r===n-1&&r===s+1?"":e.slice(r,n)}function oee(...e){let t=-1,n;for(;++t<e.length;)ng(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":aee(n)}function aee(e){ng(e);const t=e.codePointAt(0)===47;let n=lee(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function lee(e,t){let n="",s=0,r=-1,i=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(r===o-1||i===1))if(r!==o-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",s=0):(n=n.slice(0,l),s=n.length-1-n.lastIndexOf("/")),r=o,i=0;continue}}else if(n.length>0){n="",s=0,r=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(r+1,o):n=e.slice(r+1,o),s=o-r-1;r=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function ng(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const cee={cwd:uee};function uee(){return"/"}function o3(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function dee(e){if(typeof e=="string")e=new URL(e);else if(!o3(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return hee(e)}function hee(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}const X2=["history","path","basename","stem","extname","dirname"];class MD{constructor(t){let n;t?o3(t)?n={path:t}:typeof t=="string"||fee(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":cee.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<X2.length;){const i=X2[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let r;for(r in n)X2.includes(r)||(this[r]=n[r])}get basename(){return typeof this.path=="string"?Za.basename(this.path):void 0}set basename(t){Z2(t,"basename"),J2(t,"basename"),this.path=Za.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Za.dirname(this.path):void 0}set dirname(t){oC(this.basename,"dirname"),this.path=Za.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Za.extname(this.path):void 0}set extname(t){if(J2(t,"extname"),oC(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Za.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){o3(t)&&(t=dee(t)),Z2(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Za.basename(this.path,this.extname):void 0}set stem(t){Z2(t,"stem"),J2(t,"stem"),this.path=Za.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const r=this.message(t,n,s);throw r.fatal=!0,r}info(t,n,s){const r=this.message(t,n,s);return r.fatal=void 0,r}message(t,n,s){const r=new _i(t,n,s);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function J2(e,t){if(e&&e.includes(Za.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Za.sep+"`")}function Z2(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function oC(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function fee(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mee=function(e){const s=this.constructor.prototype,r=s[e],i=function(){return r.apply(i,arguments)};return Object.setPrototypeOf(i,s),i},pee={}.hasOwnProperty;class $S extends mee{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=tee()}copy(){const t=new $S;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Q2(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(nx("data",this.frozen),this.namespace[t]=n,this):pee.call(this.namespace,t)&&this.namespace[t]||void 0:t?(nx("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const r=n.call(t,...s);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Jg(t),s=this.parser||this.Parser;return ex("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),ex("process",this.parser||this.Parser),tx("process",this.compiler||this.Compiler),n?r(void 0,n):new Promise(r);function r(i,o){const a=Jg(t),l=s.parse(a);s.run(l,a,function(d,h,f){if(d||!h||!f)return c(d);const m=h,p=s.stringify(m,f);bee(p)?f.value=p:f.result=p,c(d,f)});function c(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,s;return this.freeze(),ex("processSync",this.parser||this.Parser),tx("processSync",this.compiler||this.Compiler),this.process(t,r),lC("processSync","process",n),s;function r(i,o){n=!0,ZT(i),s=o}}run(t,n,s){aC(t),this.freeze();const r=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(o,a){const l=Jg(n);r.run(t,l,c);function c(d,h,f){const m=h||t;d?a(d):o?o(m):s(void 0,m,f)}}}runSync(t,n){let s=!1,r;return this.run(t,n,i),lC("runSync","run",s),r;function i(o,a){ZT(o),r=a,s=!0}}stringify(t,n){this.freeze();const s=Jg(n),r=this.compiler||this.Compiler;return tx("stringify",r),aC(t),r(t,s)}use(t,...n){const s=this.attachers,r=this.namespace;if(nx("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;l(d,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(r.settings=Q2(!0,r.settings,c.settings))}function a(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let h=-1,f=-1;for(;++h<s.length;)if(s[h][0]===c){f=h;break}if(f===-1)s.push([c,...d]);else if(d.length>0){let[m,...p]=d;const y=s[f][1];i3(y)&&i3(m)&&(m=Q2(!0,y,m)),s[f]=[c,m,...p]}}}}const gee=new $S().freeze();function ex(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function tx(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function nx(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function aC(e){if(!i3(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lC(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Jg(e){return yee(e)?e:new MD(e)}function yee(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function bee(e){return typeof e=="string"||vee(e)}function vee(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wee="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",cC=[],uC={allowDangerousHtml:!0},xee=/^(https?|ircs?|mailto|xmpp)$/i,_ee=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function kee(e){const t=See(e),n=Tee(e);return Cee(t.runSync(t.parse(n),n),e)}function See(e){const t=e.rehypePlugins||cC,n=e.remarkPlugins||cC,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...uC}:uC;return gee().use(oZ).use(n).use(ZZ,s).use(t)}function Tee(e){const t=e.children||"",n=new MD;return typeof t=="string"&&(n.value=t),n}function Cee(e,t){const n=t.allowedElements,s=t.allowElement,r=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||Aee;for(const d of _ee)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+wee+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),PS(e,c),HQ(e,{Fragment:u.Fragment,components:r,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(d,h,f){if(d.type==="raw"&&f&&typeof h=="number")return o?f.children.splice(h,1):f.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let m;for(m in G2)if(Object.hasOwn(G2,m)&&Object.hasOwn(d.properties,m)){const p=d.properties[m],y=G2[m];(y===null||y.includes(d.tagName))&&(d.properties[m]=l(String(p||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!m&&s&&typeof h=="number"&&(m=!s(d,h,f)),m&&f&&typeof h=="number")return a&&d.children?f.children.splice(h,1,...d.children):f.children.splice(h,1),h}}}function Aee(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),r=e.indexOf("/");return t===-1||r!==-1&&t>r||n!==-1&&t>n||s!==-1&&t>s||xee.test(e.slice(0,t))?e:""}function mb(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,r=n.indexOf(t);for(;r!==-1;)s++,r=n.indexOf(t,r+t.length);return s}function Eee(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Mee(e,t,n){const r=tg((n||{}).ignore||[]),i=Nee(t);let o=-1;for(;++o<i.length;)BS(e,"text",a);function a(c,d){let h=-1,f;for(;++h<d.length;){const m=d[h],p=f?f.children:void 0;if(r(m,p?p.indexOf(m):void 0,f))return;f=m}if(f)return l(c,d)}function l(c,d){const h=d[d.length-1],f=i[o][0],m=i[o][1];let p=0;const w=h.children.indexOf(c);let b=!1,v=[];f.lastIndex=0;let x=f.exec(c.value);for(;x;){const _=x.index,E={index:x.index,input:x.input,stack:[...d,c]};let k=m(...x,E);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?f.lastIndex=_+1:(p!==_&&v.push({type:"text",value:c.value.slice(p,_)}),Array.isArray(k)?v.push(...k):k&&v.push(k),p=_+x[0].length,b=!0),!f.global)break;x=f.exec(c.value)}return b?(p<c.value.length&&v.push({type:"text",value:c.value.slice(p)}),h.children.splice(w,1,...v)):v=[c],w+v.length}}function Nee(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const r=n[s];t.push([Iee(r[0]),jee(r[1])])}return t}function Iee(e){return typeof e=="string"?new RegExp(Eee(e),"g"):e}function jee(e){return typeof e=="function"?e:function(){return e}}const sx="phrasing",rx=["autolink","link","image","label"];function Ree(){return{transforms:[zee],enter:{literalAutolink:Dee,literalAutolinkEmail:ix,literalAutolinkHttp:ix,literalAutolinkWww:ix},exit:{literalAutolink:$ee,literalAutolinkEmail:Pee,literalAutolinkHttp:Oee,literalAutolinkWww:Bee}}}function Lee(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sx,notInConstruct:rx},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sx,notInConstruct:rx},{character:":",before:"[ps]",after:"\\/",inConstruct:sx,notInConstruct:rx}]}}function Dee(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ix(e){this.config.enter.autolinkProtocol.call(this,e)}function Oee(e){this.config.exit.autolinkProtocol.call(this,e)}function Bee(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Pee(e){this.config.exit.autolinkEmail.call(this,e)}function $ee(e){this.exit(e)}function zee(e){Mee(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Fee],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),qee]],{ignore:["link","linkReference"]})}function Fee(e,t,n,s,r){let i="";if(!ND(r)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Hee(n)))return!1;const o=Uee(n+s);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function qee(e,t,n,s){return!ND(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Hee(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Uee(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const r=mb(e,"(");let i=mb(e,")");for(;s!==-1&&r>i;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),i++;return[e,n]}function ND(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Hd(n)||Ov(n))&&(!t||n!==47)}ID.peek=Zee;function Vee(){this.buffer()}function Wee(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Gee(){this.buffer()}function Kee(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Yee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ca(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Qee(e){this.exit(e)}function Xee(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ca(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Jee(e){this.exit(e)}function Zee(){return"["}function ID(e,t,n,s){const r=n.createTracker(s);let i=r.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=r.move("]"),i}function ete(){return{enter:{gfmFootnoteCallString:Vee,gfmFootnoteCall:Wee,gfmFootnoteDefinitionLabelString:Gee,gfmFootnoteDefinition:Kee},exit:{gfmFootnoteCallString:Yee,gfmFootnoteCall:Qee,gfmFootnoteDefinitionLabelString:Xee,gfmFootnoteDefinition:Jee}}}function tte(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ID},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,r,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),d=i.enter("label");return l+=a.move(i.safe(i.associationId(s),{before:l,after:"]"})),d(),l+=a.move("]:"),s.children&&s.children.length>0&&(a.shift(4),l+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(s,a.current()),t?jD:nte))),c(),l}}function nte(e,t,n){return t===0?e:jD(e,t,n)}function jD(e,t,n){return(n?"":"    ")+e}const ste=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];RD.peek=lte;function rte(){return{canContainEols:["delete"],enter:{strikethrough:ote},exit:{strikethrough:ate}}}function ite(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ste}],handlers:{delete:RD}}}function ote(e){this.enter({type:"delete",children:[]},e)}function ate(e){this.exit(e)}function RD(e,t,n,s){const r=n.createTracker(s),i=n.enter("strikethrough");let o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),i(),o}function lte(){return"~"}function cte(e){return e.length}function ute(e,t){const n=t||{},s=(n.align||[]).concat(),r=n.stringLength||cte,i=[],o=[],a=[],l=[];let c=0,d=-1;for(;++d<e.length;){const y=[],w=[];let b=-1;for(e[d].length>c&&(c=e[d].length);++b<e[d].length;){const v=dte(e[d][b]);if(n.alignDelimiters!==!1){const x=r(v);w[b]=x,(l[b]===void 0||x>l[b])&&(l[b]=x)}y.push(v)}o[d]=y,a[d]=w}let h=-1;if(typeof s=="object"&&"length"in s)for(;++h<c;)i[h]=dC(s[h]);else{const y=dC(s);for(;++h<c;)i[h]=y}h=-1;const f=[],m=[];for(;++h<c;){const y=i[h];let w="",b="";y===99?(w=":",b=":"):y===108?w=":":y===114&&(b=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[h]-w.length-b.length);const x=w+"-".repeat(v)+b;n.alignDelimiters!==!1&&(v=w.length+v+b.length,v>l[h]&&(l[h]=v),m[h]=v),f[h]=x}o.splice(1,0,f),a.splice(1,0,m),d=-1;const p=[];for(;++d<o.length;){const y=o[d],w=a[d];h=-1;const b=[];for(;++h<c;){const v=y[h]||"";let x="",_="";if(n.alignDelimiters!==!1){const E=l[h]-(w[h]||0),k=i[h];k===114?x=" ".repeat(E):k===99?E%2?(x=" ".repeat(E/2+.5),_=" ".repeat(E/2-.5)):(x=" ".repeat(E/2),_=x):_=" ".repeat(E)}n.delimiterStart!==!1&&!h&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||h)&&b.push(" "),n.alignDelimiters!==!1&&b.push(x),b.push(v),n.alignDelimiters!==!1&&b.push(_),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||h!==c-1)&&b.push("|")}p.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
`)}function dte(e){return e==null?"":String(e)}function dC(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const hC={}.hasOwnProperty;function hte(e,t){const n=t||{};function s(r,...i){let o=s.invalid;const a=s.handlers;if(r&&hC.call(r,e)){const l=String(r[e]);o=hC.call(a,l)?a[l]:s.unknown}if(o)return o.call(this,r,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}function fte(e,t,n,s){const r=n.enter("blockquote"),i=n.createTracker(s);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),mte);return r(),o}function mte(e,t,n){return">"+(n?"":" ")+e}function pte(e,t){return fC(e,t.inConstruct,!0)&&!fC(e,t.notInConstruct,!1)}function fC(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function mC(e,t,n,s){let r=-1;for(;++r<n.unsafe.length;)if(n.unsafe[r].character===`
`&&pte(n.stack,n.unsafe[r]))return/[ \t]/.test(s.before)?"":" ";return`\\
`}function LD(e,t){const n=String(e);let s=n.indexOf(t),r=s,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===r?++i>o&&(o=i):i=1,r=s+t.length,s=n.indexOf(t,r);return o}function gte(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function yte(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function bte(e,t,n,s){const r=yte(n),i=e.value||"",o=r==="`"?"GraveAccent":"Tilde";if(gte(e,n)){const h=n.enter("codeIndented"),f=n.indentLines(i,vte);return h(),f}const a=n.createTracker(s),l=r.repeat(Math.max(LD(i,r)+1,3)),c=n.enter("codeFenced");let d=a.move(l);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
`),i&&(d+=a.move(i+`
`)),d+=a.move(l),c(),d}function vte(e,t,n){return(n?"":"    ")+e}function zS(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function wte(e,t,n,s){const r=zS(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+r),c+=l.move(n.safe(e.title,{before:c,after:r,...l.current()})),c+=l.move(r),a()),o(),c}function xte(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function up(e){return"&#x"+e.toString(16).toUpperCase()+";"}function pb(e,t,n){const s=Df(e),r=Df(t);return s===void 0?r===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:r===void 0?{inside:!1,outside:!1}:r===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}DD.peek=_te;function DD(e,t,n,s){const r=xte(n),i=n.enter("emphasis"),o=n.createTracker(s),a=o.move(r);let l=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const c=l.charCodeAt(0),d=pb(s.before.charCodeAt(s.before.length-1),c,r);d.inside&&(l=up(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=pb(s.after.charCodeAt(0),h,r);f.inside&&(l=l.slice(0,-1)+up(h));const m=o.move(r);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+m}function _te(e,t,n){return n.options.emphasis||"*"}function kte(e,t){let n=!1;return PS(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,s3}),!!((!e.depth||e.depth<3)&&NS(e)&&(t.options.setext||n))}function Ste(e,t,n,s){const r=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(s);if(kte(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return h(),d(),f+`
`+(r===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
`))+1))}const o="#".repeat(r),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(c)&&(c=up(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}OD.peek=Tte;function OD(e){return e.value||""}function Tte(){return"<"}BD.peek=Cte;function BD(e,t,n,s){const r=zS(n),i=r==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(s);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+r),c+=l.move(n.safe(e.title,{before:c,after:r,...l.current()})),c+=l.move(r),a()),c+=l.move(")"),o(),c}function Cte(){return"!"}PD.peek=Ate;function PD(e,t,n,s){const r=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(s);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!c||c!==h?l+=a.move(h+"]"):r==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Ate(){return"!"}$D.peek=Ete;function $D(e,t,n){let s=e.value||"",r="`",i=-1;for(;new RegExp("(^|[^`])"+r+"([^`]|$)").test(s);)r+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(s);){let c=l.index;s.charCodeAt(c)===10&&s.charCodeAt(c-1)===13&&c--,s=s.slice(0,c)+" "+s.slice(l.index+1)}}return r+s+r}function Ete(){return"`"}function zD(e,t){const n=NS(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}FD.peek=Mte;function FD(e,t,n,s){const r=zS(n),i=r==='"'?"Quote":"Apostrophe",o=n.createTracker(s);let a,l;if(zD(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=o.move(" "+r),c+=o.move(n.safe(e.title,{before:c,after:r,...o.current()})),c+=o.move(r),l()),c+=o.move(")"),a(),c}function Mte(e,t,n){return zD(e,n)?"<":"["}qD.peek=Nte;function qD(e,t,n,s){const r=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(s);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),r==="full"||!c||c!==h?l+=a.move(h+"]"):r==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Nte(){return"["}function FS(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Ite(e){const t=FS(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function jte(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function HD(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Rte(e,t,n,s){const r=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?jte(n):FS(n);const a=e.ordered?o==="."?")":".":Ite(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),HD(n)===o&&d){let h=-1;for(;++h<e.children.length;){const f=e.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,s);return n.bulletLastUsed=o,n.bulletCurrent=i,r(),c}function Lte(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Dte(e,t,n,s){const r=Lte(n);let i=n.bulletCurrent||FS(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(r==="tab"||r==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(s);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),d);return l(),c;function d(h,f,m){return f?(m?"":" ".repeat(o))+h:(m?i:i+" ".repeat(o-i.length))+h}}function Ote(e,t,n,s){const r=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,s);return i(),r(),o}const Bte=tg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Pte(e,t,n,s){return(e.children.some(function(o){return Bte(o)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function $te(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}UD.peek=zte;function UD(e,t,n,s){const r=$te(n),i=n.enter("strong"),o=n.createTracker(s),a=o.move(r+r);let l=o.move(n.containerPhrasing(e,{after:r,before:a,...o.current()}));const c=l.charCodeAt(0),d=pb(s.before.charCodeAt(s.before.length-1),c,r);d.inside&&(l=up(c)+l.slice(1));const h=l.charCodeAt(l.length-1),f=pb(s.after.charCodeAt(0),h,r);f.inside&&(l=l.slice(0,-1)+up(h));const m=o.move(r+r);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:d.outside},a+l+m}function zte(e,t,n){return n.options.strong||"*"}function Fte(e,t,n,s){return n.safe(e.value,s)}function qte(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Hte(e,t,n){const s=(HD(n)+(n.options.ruleSpaces?" ":"")).repeat(qte(n));return n.options.ruleSpaces?s.slice(0,-1):s}const VD={blockquote:fte,break:mC,code:bte,definition:wte,emphasis:DD,hardBreak:mC,heading:Ste,html:OD,image:BD,imageReference:PD,inlineCode:$D,link:FD,linkReference:qD,list:Rte,listItem:Dte,paragraph:Ote,root:Pte,strong:UD,text:Fte,thematicBreak:Hte};function Ute(){return{enter:{table:Vte,tableData:pC,tableHeader:pC,tableRow:Gte},exit:{codeText:Kte,table:Wte,tableData:ox,tableHeader:ox,tableRow:ox}}}function Vte(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Wte(e){this.exit(e),this.data.inTable=void 0}function Gte(e){this.enter({type:"tableRow",children:[]},e)}function ox(e){this.exit(e)}function pC(e){this.enter({type:"tableCell",children:[]},e)}function Kte(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Yte));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Yte(e,t){return t==="|"?t:e}function Qte(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,r=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(m,p,y,w){return c(d(m,y,w),m.align)}function a(m,p,y,w){const b=h(m,y,w),v=c([b]);return v.slice(0,v.indexOf(`
`))}function l(m,p,y,w){const b=y.enter("tableCell"),v=y.enter("phrasing"),x=y.containerPhrasing(m,{...w,before:i,after:i});return v(),b(),x}function c(m,p){return ute(m,{align:p,alignDelimiters:s,padding:n,stringLength:r})}function d(m,p,y){const w=m.children;let b=-1;const v=[],x=p.enter("table");for(;++b<w.length;)v[b]=h(w[b],p,y);return x(),v}function h(m,p,y){const w=m.children;let b=-1;const v=[],x=p.enter("tableRow");for(;++b<w.length;)v[b]=l(w[b],m,p,y);return x(),v}function f(m,p,y){let w=VD.inlineCode(m,p,y);return y.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function Xte(){return{exit:{taskListCheckValueChecked:gC,taskListCheckValueUnchecked:gC,paragraph:Zte}}}function Jte(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ene}}}function gC(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Zte(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const r=t.children;let i=-1,o;for(;++i<r.length;){const a=r[i];if(a.type==="paragraph"){o=a;break}}o===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function ene(e,t,n,s){const r=e.children[0],i=typeof e.checked=="boolean"&&r&&r.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(s);i&&a.move(o);let l=VD.listItem(e,t,n,{...s,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(d){return d+o}}function tne(){return[Ree(),ete(),rte(),Ute(),Xte()]}function nne(e){return{extensions:[Lee(),tte(e),ite(),Qte(e),Jte()]}}const sne={tokenize:cne,partial:!0},WD={tokenize:une,partial:!0},GD={tokenize:dne,partial:!0},KD={tokenize:hne,partial:!0},rne={tokenize:fne,partial:!0},YD={name:"wwwAutolink",tokenize:ane,previous:XD},QD={name:"protocolAutolink",tokenize:lne,previous:JD},bc={name:"emailAutolink",tokenize:one,previous:ZD},wl={};function ine(){return{text:wl}}let ed=48;for(;ed<123;)wl[ed]=bc,ed++,ed===58?ed=65:ed===91&&(ed=97);wl[43]=bc;wl[45]=bc;wl[46]=bc;wl[95]=bc;wl[72]=[bc,QD];wl[104]=[bc,QD];wl[87]=[bc,YD];wl[119]=[bc,YD];function one(e,t,n){const s=this;let r,i;return o;function o(h){return!a3(h)||!ZD.call(s,s.previous)||qS(s.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return a3(h)?(e.consume(h),a):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check(rne,d,c)(h):h===45||h===95||bi(h)?(i=!0,e.consume(h),l):d(h)}function c(h){return e.consume(h),r=!0,l}function d(h){return i&&r&&$i(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function ane(e,t,n){const s=this;return r;function r(o){return o!==87&&o!==119||!XD.call(s,s.previous)||qS(s.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(sne,e.attempt(WD,e.attempt(GD,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function lne(e,t,n){const s=this;let r="",i=!1;return o;function o(h){return(h===72||h===104)&&JD.call(s,s.previous)&&!qS(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if($i(h)&&r.length<5)return r+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const f=r.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),i?c:(i=!0,l)):n(h)}function c(h){return h===null||db(h)||Ns(h)||Hd(h)||Ov(h)?n(h):e.attempt(WD,e.attempt(GD,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function cne(e,t,n){let s=0;return r;function r(o){return(o===87||o===119)&&s<3?(s++,e.consume(o),r):o===46&&s===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function une(e,t,n){let s,r,i;return o;function o(c){return c===46||c===95?e.check(KD,l,a)(c):c===null||Ns(c)||Hd(c)||c!==45&&Ov(c)?l(c):(i=!0,e.consume(c),o)}function a(c){return c===95?s=!0:(r=s,s=void 0),e.consume(c),o}function l(c){return r||s||!i?n(c):t(c)}}function dne(e,t){let n=0,s=0;return r;function r(o){return o===40?(n++,e.consume(o),r):o===41&&s<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(KD,t,i)(o):o===null||Ns(o)||Hd(o)?t(o):(e.consume(o),r)}function i(o){return o===41&&s++,e.consume(o),r}}function hne(e,t,n){return s;function s(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),s):a===38?(e.consume(a),i):a===93?(e.consume(a),r):a===60||a===null||Ns(a)||Hd(a)?t(a):n(a)}function r(a){return a===null||a===40||a===91||Ns(a)||Hd(a)?t(a):s(a)}function i(a){return $i(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),s):$i(a)?(e.consume(a),o):n(a)}}function fne(e,t,n){return s;function s(i){return e.consume(i),r}function r(i){return bi(i)?n(i):t(i)}}function XD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ns(e)}function JD(e){return!$i(e)}function ZD(e){return!(e===47||a3(e))}function a3(e){return e===43||e===45||e===46||e===95||bi(e)}function qS(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const mne={tokenize:_ne,partial:!0};function pne(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:vne,continuation:{tokenize:wne},exit:xne}},text:{91:{name:"gfmFootnoteCall",tokenize:bne},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:gne,resolveTo:yne}}}}function gne(e,t,n){const s=this;let r=s.events.length;const i=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let o;for(;r--;){const l=s.events[r][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Ca(s.sliceSerialize({start:o.end,end:s.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function yne(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},r={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};r.end.column++,r.end.offset++,r.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},r.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",r,t],["exit",r,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...a),e}function bne(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(i>999||h===93&&!o||h===null||h===91||Ns(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return r.includes(Ca(s.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Ns(h)||(o=!0),i++,e.consume(h),h===92?d:c}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,c):c(h)}}function vne(e,t,n){const s=this,r=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(p){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(p){return p===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(p)}function d(p){if(o>999||p===93&&!a||p===null||p===91||Ns(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Ca(s.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Ns(p)||(a=!0),o++,e.consume(p),p===92?h:d}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,d):d(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),r.includes(i)||r.push(i),Rn(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function wne(e,t,n){return e.check(eg,t,e.attempt(mne,t,n))}function xne(e){e.exit("gfmFootnoteDefinition")}function _ne(e,t,n){const s=this;return Rn(e,r,"gfmFootnoteDefinitionIndent",5);function r(i){const o=s.events[s.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function kne(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:i,resolveAll:r};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function r(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",d,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",h,a]],m=a.parser.constructs.insideSpan.null;m&&Mo(f,f.length,0,Bv(m,o.slice(c+1,l),a)),Mo(f,f.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",d,a]]),Mo(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const c=this.previous,d=this.events;let h=0;return f;function f(p){return c===126&&d[d.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const y=Df(c);if(p===126)return h>1?l(p):(o.consume(p),h++,m);if(h<2&&!n)return l(p);const w=o.exit("strikethroughSequenceTemporary"),b=Df(p);return w._open=!b||b===2&&!!y,w._close=!y||y===2&&!!b,a(p)}}}class Sne{constructor(){this.map=[]}add(t,n,s){Tne(this,t,n,s)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let r=s.pop();for(;r;){for(const i of r)t.push(i);r=s.pop()}this.map.length=0}}function Tne(e,t,n,s){let r=0;if(!(n===0&&s.length===0)){for(;r<e.map.length;){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...s);return}r+=1}e.map.push([t,n,s])}}function Cne(e,t){let n=!1;const s=[];for(;t<e.length;){const r=e[t];if(n){if(r[0]==="enter")r[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=s.length-1;s[i]=s[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else r[0]==="enter"&&r[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function Ane(){return{flow:{null:{name:"table",tokenize:Ene,resolveAll:Mne}}}}function Ene(e,t,n){const s=this;let r=0,i=0,o;return a;function a(T){let N=s.events.length-1;for(;N>-1;){const U=s.events[N][1].type;if(U==="lineEnding"||U==="linePrefix")N--;else break}const I=N>-1?s.events[N][1].type:null,O=I==="tableHead"||I==="tableRow"?k:l;return O===k&&s.parser.lazy[s.now().line]?n(T):O(T)}function l(T){return e.enter("tableHead"),e.enter("tableRow"),c(T)}function c(T){return T===124||(o=!0,i+=1),d(T)}function d(T){return T===null?n(T):zt(T)?i>1?(i=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),m):n(T):Bn(T)?Rn(e,d,"whitespace")(T):(i+=1,o&&(o=!1,r+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(T)))}function h(T){return T===null||T===124||Ns(T)?(e.exit("data"),d(T)):(e.consume(T),T===92?f:h)}function f(T){return T===92||T===124?(e.consume(T),h):h(T)}function m(T){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(T):(e.enter("tableDelimiterRow"),o=!1,Bn(T)?Rn(e,p,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):p(T))}function p(T){return T===45||T===58?w(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),y):E(T)}function y(T){return Bn(T)?Rn(e,w,"whitespace")(T):w(T)}function w(T){return T===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),b):T===45?(i+=1,b(T)):T===null||zt(T)?_(T):E(T)}function b(T){return T===45?(e.enter("tableDelimiterFiller"),v(T)):E(T)}function v(T){return T===45?(e.consume(T),v):T===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(T))}function x(T){return Bn(T)?Rn(e,_,"whitespace")(T):_(T)}function _(T){return T===124?p(T):T===null||zt(T)?!o||r!==i?E(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):E(T)}function E(T){return n(T)}function k(T){return e.enter("tableRow"),M(T)}function M(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),M):T===null||zt(T)?(e.exit("tableRow"),t(T)):Bn(T)?Rn(e,M,"whitespace")(T):(e.enter("data"),R(T))}function R(T){return T===null||T===124||Ns(T)?(e.exit("data"),M(T)):(e.consume(T),T===92?L:R)}function L(T){return T===92||T===124?(e.consume(T),R):R(T)}}function Mne(e,t){let n=-1,s=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,d,h;const f=new Sne;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(yC(f,t,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,t]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(s=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",d,t]])),r=p.type==="tableDelimiterRow"?2:d?3:1):r&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(s=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=Zg(f,t,i,r,void 0,h),i=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(s?s=!1:(i[1]!==0&&(o[0]=o[1],h=Zg(f,t,i,r,void 0,h)),i=o,o=[i[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],h=Zg(f,t,i,r,n,h)):o[1]!==0&&(h=Zg(f,t,o,r,n,h)),r=0):r&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&yC(f,t,l,c,d),f.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=Cne(t.events,n))}return e}function Zg(e,t,n,s,r,i){const o=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Oh(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=Oh(t.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=Oh(t.events,n[2]),d=Oh(t.events,n[3]),h={type:a,start:Object.assign({},c),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),s!==2){const f=t.events[n[2]],m=t.events[n[3]];if(f[1].end=Object.assign({},m[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,y=n[3]-n[2]-1;e.add(p,y,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return r!==void 0&&(i.end=Object.assign({},Oh(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0),i}function yC(e,t,n,s,r){const i=[],o=Oh(t.events,n);r&&(r.end=Object.assign({},o),i.push(["exit",r,t])),s.end=Object.assign({},o),i.push(["exit",s,t]),e.add(n+1,0,i)}function Oh(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const Nne={name:"tasklistCheck",tokenize:jne};function Ine(){return{text:{91:Nne}}}function jne(e,t,n){const s=this;return r;function r(l){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return Ns(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return zt(l)?t(l):Bn(l)?e.check({tokenize:Rne},t,n)(l):n(l)}}function Rne(e,t,n){return Rn(e,s,"whitespace");function s(r){return r===null?n(r):t(r)}}function Lne(e){return lD([ine(),pne(),kne(e),Ane(),Ine()])}const Dne={};function bC(e){const t=this,n=e||Dne,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(Lne(n)),i.push(tne()),o.push(nne(n))}function One(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:r,mathFlowFence:s,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};function e(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function t(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function s(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function r(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c;const h=d.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function i(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function o(l){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c,d.data.hChildren.push({type:"text",value:c})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function Bne(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),s.peek=r,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:t?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:s}};function n(i,o,a,l){const c=i.value||"",d=a.createTracker(l),h="$".repeat(Math.max(LD(c,"$")+1,2)),f=a.enter("mathFlow");let m=d.move(h);if(i.meta){const p=a.enter("mathFlowMeta");m+=d.move(a.safe(i.meta,{after:`
`,before:m,encode:["$"],...d.current()})),p()}return m+=d.move(`
`),c&&(m+=d.move(c+`
`)),m+=d.move(h),f(),m}function s(i,o,a){let l=i.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const d="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let h=-1;for(;++h<a.unsafe.length;){const f=a.unsafe[h];if(!f.atBreak)continue;const m=a.compilePattern(f);let p;for(;p=m.exec(l);){let y=p.index;l.codePointAt(y)===10&&l.codePointAt(y-1)===13&&y--,l=l.slice(0,y)+" "+l.slice(p.index+1)}}return d+l+d}function r(){return"$"}}const Pne={tokenize:$ne,concrete:!0,name:"mathFlow"},vC={tokenize:zne,partial:!0};function $ne(e,t,n){const s=this,r=s.events[s.events.length-1],i=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0;let o=0;return a;function a(v){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(v)}function l(v){return v===36?(e.consume(v),o++,l):o<2?n(v):(e.exit("mathFlowFenceSequence"),Rn(e,c,"whitespace")(v))}function c(v){return v===null||zt(v)?h(v):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===null||zt(v)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(v)):v===36?n(v):(e.consume(v),d)}function h(v){return e.exit("mathFlowFence"),s.interrupt?t(v):e.attempt(vC,f,w)(v)}function f(v){return e.attempt({tokenize:b,partial:!0},w,m)(v)}function m(v){return(i?Rn(e,p,"linePrefix",i+1):p)(v)}function p(v){return v===null?w(v):zt(v)?e.attempt(vC,f,w)(v):(e.enter("mathFlowValue"),y(v))}function y(v){return v===null||zt(v)?(e.exit("mathFlowValue"),p(v)):(e.consume(v),y)}function w(v){return e.exit("mathFlow"),t(v)}function b(v,x,_){let E=0;return Rn(v,k,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function k(L){return v.enter("mathFlowFence"),v.enter("mathFlowFenceSequence"),M(L)}function M(L){return L===36?(E++,v.consume(L),M):E<o?_(L):(v.exit("mathFlowFenceSequence"),Rn(v,R,"whitespace")(L))}function R(L){return L===null||zt(L)?(v.exit("mathFlowFence"),x(L)):_(L)}}}function zne(e,t,n){const s=this;return r;function r(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return s.parser.lazy[s.now().line]?n(o):t(o)}}function Fne(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:s,resolve:qne,previous:Hne,name:"mathText"};function s(r,i,o){let a=0,l,c;return d;function d(y){return r.enter("mathText"),r.enter("mathTextSequence"),h(y)}function h(y){return y===36?(r.consume(y),a++,h):a<2&&!n?o(y):(r.exit("mathTextSequence"),f(y))}function f(y){return y===null?o(y):y===36?(c=r.enter("mathTextSequence"),l=0,p(y)):y===32?(r.enter("space"),r.consume(y),r.exit("space"),f):zt(y)?(r.enter("lineEnding"),r.consume(y),r.exit("lineEnding"),f):(r.enter("mathTextData"),m(y))}function m(y){return y===null||y===32||y===36||zt(y)?(r.exit("mathTextData"),f(y)):(r.consume(y),m)}function p(y){return y===36?(r.consume(y),l++,p):l===a?(r.exit("mathTextSequence"),r.exit("mathText"),i(y)):(c.type="mathTextData",m(y))}}}function qne(e){let t=e.length-4,n=3,s,r;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)r===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(r=s):(s===t||e[s][1].type==="lineEnding")&&(e[r][1].type="mathTextData",s!==r+2&&(e[r][1].end=e[s-1][1].end,e.splice(r+2,s-r-2),t-=s-r-2,s=r+2),r=void 0);return e}function Hne(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Une(e){return{flow:{36:Pne},text:{36:Fne(e)}}}class We extends Error{constructor(t,n){var s="KaTeX parse error: "+t,r,i,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;r=o.start,i=o.end,r===a.length?s+=" at end of input: ":s+=" at position "+(r+1)+": ";var l=a.slice(r,i).replace(/[^]/g,"$&̲"),c;r>15?c="…"+a.slice(r-15,r):c=a.slice(0,r);var d;i+15<a.length?d=a.slice(i,i+15)+"…":d=a.slice(i),s+=c+l+d}super(s),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,We.prototype),this.position=r,r!=null&&i!=null&&(this.length=i-r),this.rawMessage=t}}var Vne=/([A-Z])/g,Wne=e=>e.replace(Vne,"-$1").toLowerCase(),Gne={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Kne=/[&><"']/g,wi=e=>String(e).replace(Kne,t=>Gne[t]),dy=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?dy(e.body[0]):e:e.type==="font"?dy(e.body):e,Yne=new Set(["mathord","textord","atom"]),vc=e=>Yne.has(dy(e).type),Qne=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},gb={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:e=>"#"+e},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:e=>Math.max(0,e),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:e=>Math.max(0,e),cli:"-e, --max-expand <n>",cliProcessor:e=>e==="Infinity"?1/0:parseInt(e)},globalGroup:{type:"boolean",cli:!1}};function Xne(e){if(typeof e!="string")return e.enum[0];switch(e){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{};default:throw new Error("Unexpected schema type; settings must declare an explicit default.")}}function Jne(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return Xne(t)}function Zne(e,t,n,s){var r=n[t];e[t]=r!==void 0?s.processor?s.processor(r):r:Jne(s)}class HS{constructor(t){t===void 0&&(t={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,t=t||{};for(var n of Object.keys(gb)){var s=gb[n];s&&Zne(this,n,t,s)}}reportNonstrict(t,n,s){var r=this.strict;if(typeof r=="function"&&(r=r(t,n,s)),!(!r||r==="ignore")){if(r===!0||r==="error")throw new We("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),s);r==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+r+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,s){var r=this.strict;if(typeof r=="function")try{r=r(t,n,s)}catch{r="error"}return!r||r==="ignore"?!1:r===!0||r==="error"?!0:r==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+t+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+r+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=Qne(t.url);if(n==null)return!1;t.protocol=n}var s=typeof this.trust=="function"?this.trust(t):this.trust;return!!s}}class Ic{constructor(t,n,s){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=s}sup(){return tl[ese[this.id]]}sub(){return tl[tse[this.id]]}fracNum(){return tl[nse[this.id]]}fracDen(){return tl[sse[this.id]]}cramp(){return tl[rse[this.id]]}text(){return tl[ise[this.id]]}isTight(){return this.size>=2}}var US=0,yb=1,mf=2,sc=3,dp=4,ea=5,Of=6,Fi=7,tl=[new Ic(US,0,!1),new Ic(yb,0,!0),new Ic(mf,1,!1),new Ic(sc,1,!0),new Ic(dp,2,!1),new Ic(ea,2,!0),new Ic(Of,3,!1),new Ic(Fi,3,!0)],ese=[dp,ea,dp,ea,Of,Fi,Of,Fi],tse=[ea,ea,ea,ea,Fi,Fi,Fi,Fi],nse=[mf,sc,dp,ea,Of,Fi,Of,Fi],sse=[sc,sc,ea,ea,Fi,Fi,Fi,Fi],rse=[yb,yb,sc,sc,ea,ea,Fi,Fi],ise=[US,yb,mf,sc,mf,sc,mf,sc],fn={DISPLAY:tl[US],TEXT:tl[mf],SCRIPT:tl[dp],SCRIPTSCRIPT:tl[Of]},l3=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function ose(e){for(var t=0;t<l3.length;t++)for(var n=l3[t],s=0;s<n.blocks.length;s++){var r=n.blocks[s];if(e>=r[0]&&e<=r[1])return n.name}return null}var hy=[];l3.forEach(e=>e.blocks.forEach(t=>hy.push(...t)));function eO(e){for(var t=0;t<hy.length;t+=2)if(e>=hy[t]&&e<=hy[t+1])return!0;return!1}var Nr=e=>e+" "+e,Ch=80,ase=function(t,n){return"M95,"+(622+t+n)+`
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+t/2.075+" -"+t+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+t)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M`+(834+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},lse=function(t,n){return"M263,"+(601+t+n)+`c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+t/2.084+" -"+t+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+t)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},cse=function(t,n){return"M983 "+(10+t+n)+`
l`+t/3.13+" -"+t+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+t)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M`+(1001+t)+" "+n+"h400000v"+(40+t)+"h-400000z"},use=function(t,n){return"M424,"+(2398+t+n)+`
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+t/4.223+" -"+t+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+t)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+t)+" "+n+`
h400000v`+(40+t)+"h-400000z"},dse=function(t,n){return"M473,"+(2713+t+n)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+t/5.298+" -"+t+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+t)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM`+(1001+t)+" "+n+"h400000v"+(40+t)+"H1017.7z"},hse=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},fse=function(t,n,s){var r=s-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
H742v`+r+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+n+"H400000v"+(40+t)+"H742z"},mse=function(t,n,s){n=1e3*n;var r="";switch(t){case"sqrtMain":r=ase(n,Ch);break;case"sqrtSize1":r=lse(n,Ch);break;case"sqrtSize2":r=cse(n,Ch);break;case"sqrtSize3":r=use(n,Ch);break;case"sqrtSize4":r=dse(n,Ch);break;case"sqrtTall":r=fse(n,Ch,s)}return r},pse=function(t,n){switch(t){case"⎜":return Nr("M291 0 H417 V"+n+" H291z");case"∣":return Nr("M145 0 H188 V"+n+" H145z");case"∥":return Nr("M145 0 H188 V"+n+" H145z")+Nr("M367 0 H410 V"+n+" H367z");case"⎟":return Nr("M457 0 H583 V"+n+" H457z");case"⎢":return Nr("M319 0 H403 V"+n+" H319z");case"⎥":return Nr("M263 0 H347 V"+n+" H263z");case"⎪":return Nr("M384 0 H504 V"+n+" H384z");case"⏐":return Nr("M312 0 H355 V"+n+" H312z");case"‖":return Nr("M257 0 H300 V"+n+" H257z")+Nr("M478 0 H521 V"+n+" H478z");default:return""}},wC={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
 l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
 435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:Nr("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Nr("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Nr("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Nr("M40 281 V448H0V74H40V241H400000v40z"),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:Nr("M0 50 h400000 v40H0z m0 194h40000v40H0z"),midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:Nr("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Nr("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Nr("M399995 440 h-120 V150 H0 v-120 H399995z"),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
 -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
 -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},gse=function(t,n){switch(t){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 v84 h347 v-84
H403z M403 1759 V0 H319 V1759 v`+n+" v1759 v84 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};function yse(e){return"toText"in e}class am{constructor(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(t){return this.classes.includes(t)}toNode(){for(var t=document.createDocumentFragment(),n=0;n<this.children.length;n++)t.appendChild(this.children[n].toNode());return t}toMarkup(){for(var t="",n=0;n<this.children.length;n++)t+=this.children[n].toMarkup();return t}toText(){return this.children.map(t=>{if(yse(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var c3={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},bse={ex:!0,em:!0,mu:!0},tO=function(t){return typeof t!="string"&&(t=t.unit),t in c3||t in bse||t==="ex"},nr=function(t,n){var s;if(t.unit in c3)s=c3[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")s=n.fontMetrics().cssEmPerMu;else{var r;if(n.style.isTight()?r=n.havingStyle(n.style.text()):r=n,t.unit==="ex")s=r.fontMetrics().xHeight;else if(t.unit==="em")s=r.fontMetrics().quad;else throw new We("Invalid unit: '"+t.unit+"'");r!==n&&(s*=r.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*s,n.maxSize)},Ze=function(t){return+t.toFixed(4)+"em"},Au=function(t){return t.filter(n=>n).join(" ")},VS=function(t){var n="";for(var s of Object.keys(t)){var r=t[s];r!==void 0&&(n+=Wne(s)+":"+r+";")}return n},nO=function(t,n,s){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=s||{},n){n.style.isTight()&&this.classes.push("mtight");var r=n.getColor();r&&(this.style.color=r)}},sO=function(t){var n=document.createElement(t);n.className=Au(this.classes),Object.assign(n.style,this.style);for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n},vse=/[\s"'>/=\x00-\x1f]/,rO=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+wi(Au(this.classes))+'"');var s=VS(this.style);s&&(n+=' style="'+wi(s)+'"');for(var r of Object.keys(this.attributes)){if(vse.test(r))throw new We("Invalid attribute name '"+r+"'");n+=" "+r+'="'+wi(this.attributes[r])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class lm{constructor(t,n,s,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,nO.call(this,t,s,r),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return sO.call(this,"span")}toMarkup(){return rO.call(this,"span")}}class zv{constructor(t,n,s,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,nO.call(this,n,r),this.children=s||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return sO.call(this,"a")}toMarkup(){return rO.call(this,"a")}}class wse{constructor(t,n,s){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=t,this.classes=["mord"],this.height=0,this.depth=0,this.maxFontSize=0,this.style=s}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createElement("img");return t.src=this.src,t.alt=this.alt,t.className="mord",Object.assign(t.style,this.style),t}toMarkup(){var t='<img src="'+wi(this.src)+'"'+(' alt="'+wi(this.alt)+'"'),n=VS(this.style);return n&&(t+=' style="'+wi(n)+'"'),t+="'/>",t}}var xse={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Ro{constructor(t,n,s,r,i,o,a,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=t,this.height=n||0,this.depth=s||0,this.italic=r||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=ose(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=xse[this.text])}hasClass(t){return this.classes.includes(t)}toNode(){var t=document.createTextNode(this.text),n=null;return this.italic>0&&(n=document.createElement("span"),n.style.marginRight=Ze(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Au(this.classes)),Object.keys(this.style).length>0&&(n=n||document.createElement("span"),Object.assign(n.style,this.style)),n?(n.appendChild(t),n):t}toMarkup(){var t=!1,n="<span";this.classes.length&&(t=!0,n+=' class="',n+=wi(Au(this.classes)),n+='"');var s="";this.italic>0&&(s+="margin-right:"+Ze(this.italic)+";"),s+=VS(this.style),s&&(t=!0,n+=' style="'+wi(s)+'"');var r=wi(this.text);return t?(n+=">",n+=r,n+="</span>",n):r}}class pc{constructor(t,n){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=n||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);for(var r=0;r<this.children.length;r++)n.appendChild(this.children[r].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+wi(this.attributes[n])+'"';t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</svg>",t}}class Eu{constructor(t,n){this.pathName=void 0,this.alternate=void 0,this.pathName=t,this.alternate=n}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",wC[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+wi(this.alternate)+'"/>':'<path d="'+wi(wC[this.pathName])+'"/>'}}class u3{constructor(t){this.attributes=void 0,this.attributes=t||{}}toNode(){var t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"line");for(var s of Object.keys(this.attributes))n.setAttribute(s,this.attributes[s]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+wi(this.attributes[n])+'"';return t+="/>",t}}function _se(e){if(e instanceof Ro)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function kse(e){if(e instanceof lm)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var Sse=e=>e instanceof lm||e instanceof zv||e instanceof am,ll={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},e1={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},xC={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function iO(e,t){ll[e]=t}function WS(e,t,n){if(!ll[t])throw new Error("Font metrics not found for font: "+t+".");var s=e.charCodeAt(0),r=ll[t][s];if(!r&&e[0]in xC&&(s=xC[e[0]].charCodeAt(0),r=ll[t][s]),!r&&n==="text"&&eO(s)&&(r=ll[t][77]),r)return{depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]}}var ax={};function Tse(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!ax[t]){var n=ax[t]={cssEmPerMu:e1.quad[t]/18};for(var s in e1)e1.hasOwnProperty(s)&&(n[s]=e1[s][t])}return ax[t]}var Ws={math:{},text:{}};function S(e,t,n,s,r,i){Ws[e][r]={font:t,group:n,replace:s},i&&s&&(Ws[e][s]=Ws[e][r])}var A="math",De="text",P="main",Z="ams",Gs="accent-token",Ct="bin",Vi="close",cm="inner",Yt="mathord",Ar="op-token",Lo="open",sg="punct",te="rel",wc="spacing",re="textord";S(A,P,te,"≡","\\equiv",!0);S(A,P,te,"≺","\\prec",!0);S(A,P,te,"≻","\\succ",!0);S(A,P,te,"∼","\\sim",!0);S(A,P,te,"⊥","\\perp");S(A,P,te,"⪯","\\preceq",!0);S(A,P,te,"⪰","\\succeq",!0);S(A,P,te,"≃","\\simeq",!0);S(A,P,te,"∣","\\mid",!0);S(A,P,te,"≪","\\ll",!0);S(A,P,te,"≫","\\gg",!0);S(A,P,te,"≍","\\asymp",!0);S(A,P,te,"∥","\\parallel");S(A,P,te,"⋈","\\bowtie",!0);S(A,P,te,"⌣","\\smile",!0);S(A,P,te,"⊑","\\sqsubseteq",!0);S(A,P,te,"⊒","\\sqsupseteq",!0);S(A,P,te,"≐","\\doteq",!0);S(A,P,te,"⌢","\\frown",!0);S(A,P,te,"∋","\\ni",!0);S(A,P,te,"∝","\\propto",!0);S(A,P,te,"⊢","\\vdash",!0);S(A,P,te,"⊣","\\dashv",!0);S(A,P,te,"∋","\\owns");S(A,P,sg,".","\\ldotp");S(A,P,sg,"⋅","\\cdotp");S(A,P,sg,"⋅","·");S(De,P,re,"⋅","·");S(A,P,re,"#","\\#");S(De,P,re,"#","\\#");S(A,P,re,"&","\\&");S(De,P,re,"&","\\&");S(A,P,re,"ℵ","\\aleph",!0);S(A,P,re,"∀","\\forall",!0);S(A,P,re,"ℏ","\\hbar",!0);S(A,P,re,"∃","\\exists",!0);S(A,P,re,"∇","\\nabla",!0);S(A,P,re,"♭","\\flat",!0);S(A,P,re,"ℓ","\\ell",!0);S(A,P,re,"♮","\\natural",!0);S(A,P,re,"♣","\\clubsuit",!0);S(A,P,re,"℘","\\wp",!0);S(A,P,re,"♯","\\sharp",!0);S(A,P,re,"♢","\\diamondsuit",!0);S(A,P,re,"ℜ","\\Re",!0);S(A,P,re,"♡","\\heartsuit",!0);S(A,P,re,"ℑ","\\Im",!0);S(A,P,re,"♠","\\spadesuit",!0);S(A,P,re,"§","\\S",!0);S(De,P,re,"§","\\S");S(A,P,re,"¶","\\P",!0);S(De,P,re,"¶","\\P");S(A,P,re,"†","\\dag");S(De,P,re,"†","\\dag");S(De,P,re,"†","\\textdagger");S(A,P,re,"‡","\\ddag");S(De,P,re,"‡","\\ddag");S(De,P,re,"‡","\\textdaggerdbl");S(A,P,Vi,"⎱","\\rmoustache",!0);S(A,P,Lo,"⎰","\\lmoustache",!0);S(A,P,Vi,"⟯","\\rgroup",!0);S(A,P,Lo,"⟮","\\lgroup",!0);S(A,P,Ct,"∓","\\mp",!0);S(A,P,Ct,"⊖","\\ominus",!0);S(A,P,Ct,"⊎","\\uplus",!0);S(A,P,Ct,"⊓","\\sqcap",!0);S(A,P,Ct,"∗","\\ast");S(A,P,Ct,"⊔","\\sqcup",!0);S(A,P,Ct,"◯","\\bigcirc",!0);S(A,P,Ct,"∙","\\bullet",!0);S(A,P,Ct,"‡","\\ddagger");S(A,P,Ct,"≀","\\wr",!0);S(A,P,Ct,"⨿","\\amalg");S(A,P,Ct,"&","\\And");S(A,P,te,"⟵","\\longleftarrow",!0);S(A,P,te,"⇐","\\Leftarrow",!0);S(A,P,te,"⟸","\\Longleftarrow",!0);S(A,P,te,"⟶","\\longrightarrow",!0);S(A,P,te,"⇒","\\Rightarrow",!0);S(A,P,te,"⟹","\\Longrightarrow",!0);S(A,P,te,"↔","\\leftrightarrow",!0);S(A,P,te,"⟷","\\longleftrightarrow",!0);S(A,P,te,"⇔","\\Leftrightarrow",!0);S(A,P,te,"⟺","\\Longleftrightarrow",!0);S(A,P,te,"↦","\\mapsto",!0);S(A,P,te,"⟼","\\longmapsto",!0);S(A,P,te,"↗","\\nearrow",!0);S(A,P,te,"↩","\\hookleftarrow",!0);S(A,P,te,"↪","\\hookrightarrow",!0);S(A,P,te,"↘","\\searrow",!0);S(A,P,te,"↼","\\leftharpoonup",!0);S(A,P,te,"⇀","\\rightharpoonup",!0);S(A,P,te,"↙","\\swarrow",!0);S(A,P,te,"↽","\\leftharpoondown",!0);S(A,P,te,"⇁","\\rightharpoondown",!0);S(A,P,te,"↖","\\nwarrow",!0);S(A,P,te,"⇌","\\rightleftharpoons",!0);S(A,Z,te,"≮","\\nless",!0);S(A,Z,te,"","\\@nleqslant");S(A,Z,te,"","\\@nleqq");S(A,Z,te,"⪇","\\lneq",!0);S(A,Z,te,"≨","\\lneqq",!0);S(A,Z,te,"","\\@lvertneqq");S(A,Z,te,"⋦","\\lnsim",!0);S(A,Z,te,"⪉","\\lnapprox",!0);S(A,Z,te,"⊀","\\nprec",!0);S(A,Z,te,"⋠","\\npreceq",!0);S(A,Z,te,"⋨","\\precnsim",!0);S(A,Z,te,"⪹","\\precnapprox",!0);S(A,Z,te,"≁","\\nsim",!0);S(A,Z,te,"","\\@nshortmid");S(A,Z,te,"∤","\\nmid",!0);S(A,Z,te,"⊬","\\nvdash",!0);S(A,Z,te,"⊭","\\nvDash",!0);S(A,Z,te,"⋪","\\ntriangleleft");S(A,Z,te,"⋬","\\ntrianglelefteq",!0);S(A,Z,te,"⊊","\\subsetneq",!0);S(A,Z,te,"","\\@varsubsetneq");S(A,Z,te,"⫋","\\subsetneqq",!0);S(A,Z,te,"","\\@varsubsetneqq");S(A,Z,te,"≯","\\ngtr",!0);S(A,Z,te,"","\\@ngeqslant");S(A,Z,te,"","\\@ngeqq");S(A,Z,te,"⪈","\\gneq",!0);S(A,Z,te,"≩","\\gneqq",!0);S(A,Z,te,"","\\@gvertneqq");S(A,Z,te,"⋧","\\gnsim",!0);S(A,Z,te,"⪊","\\gnapprox",!0);S(A,Z,te,"⊁","\\nsucc",!0);S(A,Z,te,"⋡","\\nsucceq",!0);S(A,Z,te,"⋩","\\succnsim",!0);S(A,Z,te,"⪺","\\succnapprox",!0);S(A,Z,te,"≆","\\ncong",!0);S(A,Z,te,"","\\@nshortparallel");S(A,Z,te,"∦","\\nparallel",!0);S(A,Z,te,"⊯","\\nVDash",!0);S(A,Z,te,"⋫","\\ntriangleright");S(A,Z,te,"⋭","\\ntrianglerighteq",!0);S(A,Z,te,"","\\@nsupseteqq");S(A,Z,te,"⊋","\\supsetneq",!0);S(A,Z,te,"","\\@varsupsetneq");S(A,Z,te,"⫌","\\supsetneqq",!0);S(A,Z,te,"","\\@varsupsetneqq");S(A,Z,te,"⊮","\\nVdash",!0);S(A,Z,te,"⪵","\\precneqq",!0);S(A,Z,te,"⪶","\\succneqq",!0);S(A,Z,te,"","\\@nsubseteqq");S(A,Z,Ct,"⊴","\\unlhd");S(A,Z,Ct,"⊵","\\unrhd");S(A,Z,te,"↚","\\nleftarrow",!0);S(A,Z,te,"↛","\\nrightarrow",!0);S(A,Z,te,"⇍","\\nLeftarrow",!0);S(A,Z,te,"⇏","\\nRightarrow",!0);S(A,Z,te,"↮","\\nleftrightarrow",!0);S(A,Z,te,"⇎","\\nLeftrightarrow",!0);S(A,Z,te,"△","\\vartriangle");S(A,Z,re,"ℏ","\\hslash");S(A,Z,re,"▽","\\triangledown");S(A,Z,re,"◊","\\lozenge");S(A,Z,re,"Ⓢ","\\circledS");S(A,Z,re,"®","\\circledR");S(De,Z,re,"®","\\circledR");S(A,Z,re,"∡","\\measuredangle",!0);S(A,Z,re,"∄","\\nexists");S(A,Z,re,"℧","\\mho");S(A,Z,re,"Ⅎ","\\Finv",!0);S(A,Z,re,"⅁","\\Game",!0);S(A,Z,re,"‵","\\backprime");S(A,Z,re,"▲","\\blacktriangle");S(A,Z,re,"▼","\\blacktriangledown");S(A,Z,re,"■","\\blacksquare");S(A,Z,re,"⧫","\\blacklozenge");S(A,Z,re,"★","\\bigstar");S(A,Z,re,"∢","\\sphericalangle",!0);S(A,Z,re,"∁","\\complement",!0);S(A,Z,re,"ð","\\eth",!0);S(De,P,re,"ð","ð");S(A,Z,re,"╱","\\diagup");S(A,Z,re,"╲","\\diagdown");S(A,Z,re,"□","\\square");S(A,Z,re,"□","\\Box");S(A,Z,re,"◊","\\Diamond");S(A,Z,re,"¥","\\yen",!0);S(De,Z,re,"¥","\\yen",!0);S(A,Z,re,"✓","\\checkmark",!0);S(De,Z,re,"✓","\\checkmark");S(A,Z,re,"ℶ","\\beth",!0);S(A,Z,re,"ℸ","\\daleth",!0);S(A,Z,re,"ℷ","\\gimel",!0);S(A,Z,re,"ϝ","\\digamma",!0);S(A,Z,re,"ϰ","\\varkappa");S(A,Z,Lo,"┌","\\@ulcorner",!0);S(A,Z,Vi,"┐","\\@urcorner",!0);S(A,Z,Lo,"└","\\@llcorner",!0);S(A,Z,Vi,"┘","\\@lrcorner",!0);S(A,Z,te,"≦","\\leqq",!0);S(A,Z,te,"⩽","\\leqslant",!0);S(A,Z,te,"⪕","\\eqslantless",!0);S(A,Z,te,"≲","\\lesssim",!0);S(A,Z,te,"⪅","\\lessapprox",!0);S(A,Z,te,"≊","\\approxeq",!0);S(A,Z,Ct,"⋖","\\lessdot");S(A,Z,te,"⋘","\\lll",!0);S(A,Z,te,"≶","\\lessgtr",!0);S(A,Z,te,"⋚","\\lesseqgtr",!0);S(A,Z,te,"⪋","\\lesseqqgtr",!0);S(A,Z,te,"≑","\\doteqdot");S(A,Z,te,"≓","\\risingdotseq",!0);S(A,Z,te,"≒","\\fallingdotseq",!0);S(A,Z,te,"∽","\\backsim",!0);S(A,Z,te,"⋍","\\backsimeq",!0);S(A,Z,te,"⫅","\\subseteqq",!0);S(A,Z,te,"⋐","\\Subset",!0);S(A,Z,te,"⊏","\\sqsubset",!0);S(A,Z,te,"≼","\\preccurlyeq",!0);S(A,Z,te,"⋞","\\curlyeqprec",!0);S(A,Z,te,"≾","\\precsim",!0);S(A,Z,te,"⪷","\\precapprox",!0);S(A,Z,te,"⊲","\\vartriangleleft");S(A,Z,te,"⊴","\\trianglelefteq");S(A,Z,te,"⊨","\\vDash",!0);S(A,Z,te,"⊪","\\Vvdash",!0);S(A,Z,te,"⌣","\\smallsmile");S(A,Z,te,"⌢","\\smallfrown");S(A,Z,te,"≏","\\bumpeq",!0);S(A,Z,te,"≎","\\Bumpeq",!0);S(A,Z,te,"≧","\\geqq",!0);S(A,Z,te,"⩾","\\geqslant",!0);S(A,Z,te,"⪖","\\eqslantgtr",!0);S(A,Z,te,"≳","\\gtrsim",!0);S(A,Z,te,"⪆","\\gtrapprox",!0);S(A,Z,Ct,"⋗","\\gtrdot");S(A,Z,te,"⋙","\\ggg",!0);S(A,Z,te,"≷","\\gtrless",!0);S(A,Z,te,"⋛","\\gtreqless",!0);S(A,Z,te,"⪌","\\gtreqqless",!0);S(A,Z,te,"≖","\\eqcirc",!0);S(A,Z,te,"≗","\\circeq",!0);S(A,Z,te,"≜","\\triangleq",!0);S(A,Z,te,"∼","\\thicksim");S(A,Z,te,"≈","\\thickapprox");S(A,Z,te,"⫆","\\supseteqq",!0);S(A,Z,te,"⋑","\\Supset",!0);S(A,Z,te,"⊐","\\sqsupset",!0);S(A,Z,te,"≽","\\succcurlyeq",!0);S(A,Z,te,"⋟","\\curlyeqsucc",!0);S(A,Z,te,"≿","\\succsim",!0);S(A,Z,te,"⪸","\\succapprox",!0);S(A,Z,te,"⊳","\\vartriangleright");S(A,Z,te,"⊵","\\trianglerighteq");S(A,Z,te,"⊩","\\Vdash",!0);S(A,Z,te,"∣","\\shortmid");S(A,Z,te,"∥","\\shortparallel");S(A,Z,te,"≬","\\between",!0);S(A,Z,te,"⋔","\\pitchfork",!0);S(A,Z,te,"∝","\\varpropto");S(A,Z,te,"◀","\\blacktriangleleft");S(A,Z,te,"∴","\\therefore",!0);S(A,Z,te,"∍","\\backepsilon");S(A,Z,te,"▶","\\blacktriangleright");S(A,Z,te,"∵","\\because",!0);S(A,Z,te,"⋘","\\llless");S(A,Z,te,"⋙","\\gggtr");S(A,Z,Ct,"⊲","\\lhd");S(A,Z,Ct,"⊳","\\rhd");S(A,Z,te,"≂","\\eqsim",!0);S(A,P,te,"⋈","\\Join");S(A,Z,te,"≑","\\Doteq",!0);S(A,Z,Ct,"∔","\\dotplus",!0);S(A,Z,Ct,"∖","\\smallsetminus");S(A,Z,Ct,"⋒","\\Cap",!0);S(A,Z,Ct,"⋓","\\Cup",!0);S(A,Z,Ct,"⩞","\\doublebarwedge",!0);S(A,Z,Ct,"⊟","\\boxminus",!0);S(A,Z,Ct,"⊞","\\boxplus",!0);S(A,Z,Ct,"⋇","\\divideontimes",!0);S(A,Z,Ct,"⋉","\\ltimes",!0);S(A,Z,Ct,"⋊","\\rtimes",!0);S(A,Z,Ct,"⋋","\\leftthreetimes",!0);S(A,Z,Ct,"⋌","\\rightthreetimes",!0);S(A,Z,Ct,"⋏","\\curlywedge",!0);S(A,Z,Ct,"⋎","\\curlyvee",!0);S(A,Z,Ct,"⊝","\\circleddash",!0);S(A,Z,Ct,"⊛","\\circledast",!0);S(A,Z,Ct,"⋅","\\centerdot");S(A,Z,Ct,"⊺","\\intercal",!0);S(A,Z,Ct,"⋒","\\doublecap");S(A,Z,Ct,"⋓","\\doublecup");S(A,Z,Ct,"⊠","\\boxtimes",!0);S(A,Z,te,"⇢","\\dashrightarrow",!0);S(A,Z,te,"⇠","\\dashleftarrow",!0);S(A,Z,te,"⇇","\\leftleftarrows",!0);S(A,Z,te,"⇆","\\leftrightarrows",!0);S(A,Z,te,"⇚","\\Lleftarrow",!0);S(A,Z,te,"↞","\\twoheadleftarrow",!0);S(A,Z,te,"↢","\\leftarrowtail",!0);S(A,Z,te,"↫","\\looparrowleft",!0);S(A,Z,te,"⇋","\\leftrightharpoons",!0);S(A,Z,te,"↶","\\curvearrowleft",!0);S(A,Z,te,"↺","\\circlearrowleft",!0);S(A,Z,te,"↰","\\Lsh",!0);S(A,Z,te,"⇈","\\upuparrows",!0);S(A,Z,te,"↿","\\upharpoonleft",!0);S(A,Z,te,"⇃","\\downharpoonleft",!0);S(A,P,te,"⊶","\\origof",!0);S(A,P,te,"⊷","\\imageof",!0);S(A,Z,te,"⊸","\\multimap",!0);S(A,Z,te,"↭","\\leftrightsquigarrow",!0);S(A,Z,te,"⇉","\\rightrightarrows",!0);S(A,Z,te,"⇄","\\rightleftarrows",!0);S(A,Z,te,"↠","\\twoheadrightarrow",!0);S(A,Z,te,"↣","\\rightarrowtail",!0);S(A,Z,te,"↬","\\looparrowright",!0);S(A,Z,te,"↷","\\curvearrowright",!0);S(A,Z,te,"↻","\\circlearrowright",!0);S(A,Z,te,"↱","\\Rsh",!0);S(A,Z,te,"⇊","\\downdownarrows",!0);S(A,Z,te,"↾","\\upharpoonright",!0);S(A,Z,te,"⇂","\\downharpoonright",!0);S(A,Z,te,"⇝","\\rightsquigarrow",!0);S(A,Z,te,"⇝","\\leadsto");S(A,Z,te,"⇛","\\Rrightarrow",!0);S(A,Z,te,"↾","\\restriction");S(A,P,re,"‘","`");S(A,P,re,"$","\\$");S(De,P,re,"$","\\$");S(De,P,re,"$","\\textdollar");S(A,P,re,"%","\\%");S(De,P,re,"%","\\%");S(A,P,re,"_","\\_");S(De,P,re,"_","\\_");S(De,P,re,"_","\\textunderscore");S(A,P,re,"∠","\\angle",!0);S(A,P,re,"∞","\\infty",!0);S(A,P,re,"′","\\prime");S(A,P,re,"△","\\triangle");S(A,P,re,"Γ","\\Gamma",!0);S(A,P,re,"Δ","\\Delta",!0);S(A,P,re,"Θ","\\Theta",!0);S(A,P,re,"Λ","\\Lambda",!0);S(A,P,re,"Ξ","\\Xi",!0);S(A,P,re,"Π","\\Pi",!0);S(A,P,re,"Σ","\\Sigma",!0);S(A,P,re,"Υ","\\Upsilon",!0);S(A,P,re,"Φ","\\Phi",!0);S(A,P,re,"Ψ","\\Psi",!0);S(A,P,re,"Ω","\\Omega",!0);S(A,P,re,"A","Α");S(A,P,re,"B","Β");S(A,P,re,"E","Ε");S(A,P,re,"Z","Ζ");S(A,P,re,"H","Η");S(A,P,re,"I","Ι");S(A,P,re,"K","Κ");S(A,P,re,"M","Μ");S(A,P,re,"N","Ν");S(A,P,re,"O","Ο");S(A,P,re,"P","Ρ");S(A,P,re,"T","Τ");S(A,P,re,"X","Χ");S(A,P,re,"¬","\\neg",!0);S(A,P,re,"¬","\\lnot");S(A,P,re,"⊤","\\top");S(A,P,re,"⊥","\\bot");S(A,P,re,"∅","\\emptyset");S(A,Z,re,"∅","\\varnothing");S(A,P,Yt,"α","\\alpha",!0);S(A,P,Yt,"β","\\beta",!0);S(A,P,Yt,"γ","\\gamma",!0);S(A,P,Yt,"δ","\\delta",!0);S(A,P,Yt,"ϵ","\\epsilon",!0);S(A,P,Yt,"ζ","\\zeta",!0);S(A,P,Yt,"η","\\eta",!0);S(A,P,Yt,"θ","\\theta",!0);S(A,P,Yt,"ι","\\iota",!0);S(A,P,Yt,"κ","\\kappa",!0);S(A,P,Yt,"λ","\\lambda",!0);S(A,P,Yt,"μ","\\mu",!0);S(A,P,Yt,"ν","\\nu",!0);S(A,P,Yt,"ξ","\\xi",!0);S(A,P,Yt,"ο","\\omicron",!0);S(A,P,Yt,"π","\\pi",!0);S(A,P,Yt,"ρ","\\rho",!0);S(A,P,Yt,"σ","\\sigma",!0);S(A,P,Yt,"τ","\\tau",!0);S(A,P,Yt,"υ","\\upsilon",!0);S(A,P,Yt,"ϕ","\\phi",!0);S(A,P,Yt,"χ","\\chi",!0);S(A,P,Yt,"ψ","\\psi",!0);S(A,P,Yt,"ω","\\omega",!0);S(A,P,Yt,"ε","\\varepsilon",!0);S(A,P,Yt,"ϑ","\\vartheta",!0);S(A,P,Yt,"ϖ","\\varpi",!0);S(A,P,Yt,"ϱ","\\varrho",!0);S(A,P,Yt,"ς","\\varsigma",!0);S(A,P,Yt,"φ","\\varphi",!0);S(A,P,Ct,"∗","*",!0);S(A,P,Ct,"+","+");S(A,P,Ct,"−","-",!0);S(A,P,Ct,"⋅","\\cdot",!0);S(A,P,Ct,"∘","\\circ",!0);S(A,P,Ct,"÷","\\div",!0);S(A,P,Ct,"±","\\pm",!0);S(A,P,Ct,"×","\\times",!0);S(A,P,Ct,"∩","\\cap",!0);S(A,P,Ct,"∪","\\cup",!0);S(A,P,Ct,"∖","\\setminus",!0);S(A,P,Ct,"∧","\\land");S(A,P,Ct,"∨","\\lor");S(A,P,Ct,"∧","\\wedge",!0);S(A,P,Ct,"∨","\\vee",!0);S(A,P,re,"√","\\surd");S(A,P,Lo,"⟨","\\langle",!0);S(A,P,Lo,"∣","\\lvert");S(A,P,Lo,"∥","\\lVert");S(A,P,Vi,"?","?");S(A,P,Vi,"!","!");S(A,P,Vi,"⟩","\\rangle",!0);S(A,P,Vi,"∣","\\rvert");S(A,P,Vi,"∥","\\rVert");S(A,P,te,"=","=");S(A,P,te,":",":");S(A,P,te,"≈","\\approx",!0);S(A,P,te,"≅","\\cong",!0);S(A,P,te,"≥","\\ge");S(A,P,te,"≥","\\geq",!0);S(A,P,te,"←","\\gets");S(A,P,te,">","\\gt",!0);S(A,P,te,"∈","\\in",!0);S(A,P,te,"","\\@not");S(A,P,te,"⊂","\\subset",!0);S(A,P,te,"⊃","\\supset",!0);S(A,P,te,"⊆","\\subseteq",!0);S(A,P,te,"⊇","\\supseteq",!0);S(A,Z,te,"⊈","\\nsubseteq",!0);S(A,Z,te,"⊉","\\nsupseteq",!0);S(A,P,te,"⊨","\\models");S(A,P,te,"←","\\leftarrow",!0);S(A,P,te,"≤","\\le");S(A,P,te,"≤","\\leq",!0);S(A,P,te,"<","\\lt",!0);S(A,P,te,"→","\\rightarrow",!0);S(A,P,te,"→","\\to");S(A,Z,te,"≱","\\ngeq",!0);S(A,Z,te,"≰","\\nleq",!0);S(A,P,wc," ","\\ ");S(A,P,wc," ","\\space");S(A,P,wc," ","\\nobreakspace");S(De,P,wc," ","\\ ");S(De,P,wc," "," ");S(De,P,wc," ","\\space");S(De,P,wc," ","\\nobreakspace");S(A,P,wc,"","\\nobreak");S(A,P,wc,"","\\allowbreak");S(A,P,sg,",",",");S(A,P,sg,";",";");S(A,Z,Ct,"⊼","\\barwedge",!0);S(A,Z,Ct,"⊻","\\veebar",!0);S(A,P,Ct,"⊙","\\odot",!0);S(A,P,Ct,"⊕","\\oplus",!0);S(A,P,Ct,"⊗","\\otimes",!0);S(A,P,re,"∂","\\partial",!0);S(A,P,Ct,"⊘","\\oslash",!0);S(A,Z,Ct,"⊚","\\circledcirc",!0);S(A,Z,Ct,"⊡","\\boxdot",!0);S(A,P,Ct,"△","\\bigtriangleup");S(A,P,Ct,"▽","\\bigtriangledown");S(A,P,Ct,"†","\\dagger");S(A,P,Ct,"⋄","\\diamond");S(A,P,Ct,"⋆","\\star");S(A,P,Ct,"◃","\\triangleleft");S(A,P,Ct,"▹","\\triangleright");S(A,P,Lo,"{","\\{");S(De,P,re,"{","\\{");S(De,P,re,"{","\\textbraceleft");S(A,P,Vi,"}","\\}");S(De,P,re,"}","\\}");S(De,P,re,"}","\\textbraceright");S(A,P,Lo,"{","\\lbrace");S(A,P,Vi,"}","\\rbrace");S(A,P,Lo,"[","\\lbrack",!0);S(De,P,re,"[","\\lbrack",!0);S(A,P,Vi,"]","\\rbrack",!0);S(De,P,re,"]","\\rbrack",!0);S(A,P,Lo,"(","\\lparen",!0);S(A,P,Vi,")","\\rparen",!0);S(De,P,re,"<","\\textless",!0);S(De,P,re,">","\\textgreater",!0);S(A,P,Lo,"⌊","\\lfloor",!0);S(A,P,Vi,"⌋","\\rfloor",!0);S(A,P,Lo,"⌈","\\lceil",!0);S(A,P,Vi,"⌉","\\rceil",!0);S(A,P,re,"\\","\\backslash");S(A,P,re,"∣","|");S(A,P,re,"∣","\\vert");S(De,P,re,"|","\\textbar",!0);S(A,P,re,"∥","\\|");S(A,P,re,"∥","\\Vert");S(De,P,re,"∥","\\textbardbl");S(De,P,re,"~","\\textasciitilde");S(De,P,re,"\\","\\textbackslash");S(De,P,re,"^","\\textasciicircum");S(A,P,te,"↑","\\uparrow",!0);S(A,P,te,"⇑","\\Uparrow",!0);S(A,P,te,"↓","\\downarrow",!0);S(A,P,te,"⇓","\\Downarrow",!0);S(A,P,te,"↕","\\updownarrow",!0);S(A,P,te,"⇕","\\Updownarrow",!0);S(A,P,Ar,"∐","\\coprod");S(A,P,Ar,"⋁","\\bigvee");S(A,P,Ar,"⋀","\\bigwedge");S(A,P,Ar,"⨄","\\biguplus");S(A,P,Ar,"⋂","\\bigcap");S(A,P,Ar,"⋃","\\bigcup");S(A,P,Ar,"∫","\\int");S(A,P,Ar,"∫","\\intop");S(A,P,Ar,"∬","\\iint");S(A,P,Ar,"∭","\\iiint");S(A,P,Ar,"∏","\\prod");S(A,P,Ar,"∑","\\sum");S(A,P,Ar,"⨂","\\bigotimes");S(A,P,Ar,"⨁","\\bigoplus");S(A,P,Ar,"⨀","\\bigodot");S(A,P,Ar,"∮","\\oint");S(A,P,Ar,"∯","\\oiint");S(A,P,Ar,"∰","\\oiiint");S(A,P,Ar,"⨆","\\bigsqcup");S(A,P,Ar,"∫","\\smallint");S(De,P,cm,"…","\\textellipsis");S(A,P,cm,"…","\\mathellipsis");S(De,P,cm,"…","\\ldots",!0);S(A,P,cm,"…","\\ldots",!0);S(A,P,cm,"⋯","\\@cdots",!0);S(A,P,cm,"⋱","\\ddots",!0);S(A,P,re,"⋮","\\varvdots");S(De,P,re,"⋮","\\varvdots");S(A,P,Gs,"ˊ","\\acute");S(A,P,Gs,"ˋ","\\grave");S(A,P,Gs,"¨","\\ddot");S(A,P,Gs,"~","\\tilde");S(A,P,Gs,"ˉ","\\bar");S(A,P,Gs,"˘","\\breve");S(A,P,Gs,"ˇ","\\check");S(A,P,Gs,"^","\\hat");S(A,P,Gs,"⃗","\\vec");S(A,P,Gs,"˙","\\dot");S(A,P,Gs,"˚","\\mathring");S(A,P,Yt,"","\\@imath");S(A,P,Yt,"","\\@jmath");S(A,P,re,"ı","ı");S(A,P,re,"ȷ","ȷ");S(De,P,re,"ı","\\i",!0);S(De,P,re,"ȷ","\\j",!0);S(De,P,re,"ß","\\ss",!0);S(De,P,re,"æ","\\ae",!0);S(De,P,re,"œ","\\oe",!0);S(De,P,re,"ø","\\o",!0);S(De,P,re,"Æ","\\AE",!0);S(De,P,re,"Œ","\\OE",!0);S(De,P,re,"Ø","\\O",!0);S(De,P,Gs,"ˊ","\\'");S(De,P,Gs,"ˋ","\\`");S(De,P,Gs,"ˆ","\\^");S(De,P,Gs,"˜","\\~");S(De,P,Gs,"ˉ","\\=");S(De,P,Gs,"˘","\\u");S(De,P,Gs,"˙","\\.");S(De,P,Gs,"¸","\\c");S(De,P,Gs,"˚","\\r");S(De,P,Gs,"ˇ","\\v");S(De,P,Gs,"¨",'\\"');S(De,P,Gs,"˝","\\H");S(De,P,Gs,"◯","\\textcircled");var oO={"--":!0,"---":!0,"``":!0,"''":!0};S(De,P,re,"–","--",!0);S(De,P,re,"–","\\textendash");S(De,P,re,"—","---",!0);S(De,P,re,"—","\\textemdash");S(De,P,re,"‘","`",!0);S(De,P,re,"‘","\\textquoteleft");S(De,P,re,"’","'",!0);S(De,P,re,"’","\\textquoteright");S(De,P,re,"“","``",!0);S(De,P,re,"“","\\textquotedblleft");S(De,P,re,"”","''",!0);S(De,P,re,"”","\\textquotedblright");S(A,P,re,"°","\\degree",!0);S(De,P,re,"°","\\degree");S(De,P,re,"°","\\textdegree",!0);S(A,P,re,"£","\\pounds");S(A,P,re,"£","\\mathsterling",!0);S(De,P,re,"£","\\pounds");S(De,P,re,"£","\\textsterling",!0);S(A,Z,re,"✠","\\maltese");S(De,Z,re,"✠","\\maltese");var _C='0123456789/@."';for(var lx=0;lx<_C.length;lx++){var kC=_C.charAt(lx);S(A,P,re,kC,kC)}var SC='0123456789!@*()-=+";:?/.,';for(var cx=0;cx<SC.length;cx++){var TC=SC.charAt(cx);S(De,P,re,TC,TC)}var bb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var ux=0;ux<bb.length;ux++){var t1=bb.charAt(ux);S(A,P,Yt,t1,t1),S(De,P,re,t1,t1)}S(A,Z,re,"C","ℂ");S(De,Z,re,"C","ℂ");S(A,Z,re,"H","ℍ");S(De,Z,re,"H","ℍ");S(A,Z,re,"N","ℕ");S(De,Z,re,"N","ℕ");S(A,Z,re,"P","ℙ");S(De,Z,re,"P","ℙ");S(A,Z,re,"Q","ℚ");S(De,Z,re,"Q","ℚ");S(A,Z,re,"R","ℝ");S(De,Z,re,"R","ℝ");S(A,Z,re,"Z","ℤ");S(De,Z,re,"Z","ℤ");S(A,P,Yt,"h","ℎ");S(De,P,Yt,"h","ℎ");var nn;for(var Ni=0;Ni<bb.length;Ni++){var ir=bb.charAt(Ni);nn=String.fromCharCode(55349,56320+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56372+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56424+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56580+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56684+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56736+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56788+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56840+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56944+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),Ni<26&&(nn=String.fromCharCode(55349,56632+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn),nn=String.fromCharCode(55349,56476+Ni),S(A,P,Yt,ir,nn),S(De,P,re,ir,nn))}nn="𝕜";S(A,P,Yt,"k",nn);S(De,P,re,"k",nn);for(var td=0;td<10;td++){var jc=td.toString();nn=String.fromCharCode(55349,57294+td),S(A,P,Yt,jc,nn),S(De,P,re,jc,nn),nn=String.fromCharCode(55349,57314+td),S(A,P,Yt,jc,nn),S(De,P,re,jc,nn),nn=String.fromCharCode(55349,57324+td),S(A,P,Yt,jc,nn),S(De,P,re,jc,nn),nn=String.fromCharCode(55349,57334+td),S(A,P,Yt,jc,nn),S(De,P,re,jc,nn)}var d3="ÐÞþ";for(var dx=0;dx<d3.length;dx++){var n1=d3.charAt(dx);S(A,P,Yt,n1,n1),S(De,P,re,n1,n1)}var h3={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},CC={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},AC={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},Cse={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},pd={mathClass:"",textClass:"",font:""},EC={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},MC={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},NC={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},f3={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},m3={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},IC={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},p3={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},jC=[h3,h3,CC,CC,AC,AC,Cse,pd,pd,pd,EC,EC,MC,MC,NC,NC,f3,f3,m3,m3,IC,IC,pd,pd,p3,p3],Ase=[h3,pd,f3,m3,p3],Ese=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),s=(t-55296)*1024+(n-56320)+65536;if(119808<=s&&s<120484){var r=Math.floor((s-119808)/26);return jC[r]}else if(120782<=s&&s<=120831){var i=Math.floor((s-120782)/10);return Ase[i]}else{if(s===120485||s===120486)return jC[0];if(120486<s&&s<120782)return pd;throw new We("Unsupported character: "+e)}},Fv=function(t,n,s){if(Ws[s][t]){var r=Ws[s][t].replace;r&&(t=r)}return{value:t,metrics:WS(t,n,s)}},Li=function(t,n,s,r,i){var o=Fv(t,n,s),a=o.metrics;t=o.value;var l;if(a){var c=a.italic;(s==="text"||r&&r.font==="mathit")&&(c=0),l=new Ro(t,a.height,a.depth,c,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+s+"'")),l=new Ro(t,0,0,0,0,0,i);if(r){l.maxFontSize=r.sizeMultiplier,r.style.isTight()&&l.classes.push("mtight");var d=r.getColor();d&&(l.style.color=d)}return l},GS=function(t,n,s,r){return r===void 0&&(r=[]),s.font==="boldsymbol"&&Fv(t,"Main-Bold",n).metrics?Li(t,"Main-Bold",n,s,r.concat(["mathbf"])):t==="\\"||Ws[n][t].font==="main"?Li(t,"Main-Regular",n,s,r):Li(t,"AMS-Regular",n,s,r.concat(["amsrm"]))},Mse=function(t,n,s){return s!=="textord"&&Fv(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},qv=function(t,n,s){var r=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:l,fontWeight:c,fontShape:d}=n,h=r==="math"||r==="text"&&!!a,f=h?a:l,m="",p="";if(i.charCodeAt(0)===55349){var y=Ese(i);m=y.font,p=y[r+"Class"]}if(m)return Li(i,m,r,n,o.concat(p));if(f){var w,b;if(f==="boldsymbol"){var v=Mse(i,r,s);w=v.fontName,b=[v.fontClass]}else h?(w=g3[a].fontName,b=[a]):(w=s1(l,c,d),b=[l,c,d]);if(Fv(i,w,r).metrics)return Li(i,w,r,n,o.concat(b));if(oO.hasOwnProperty(i)&&w.slice(0,10)==="Typewriter"){for(var x=[],_=0;_<i.length;_++)x.push(Li(i[_],w,r,n,o.concat(b)));return xc(x)}}if(s==="mathord")return Li(i,"Math-Italic",r,n,o.concat(["mathnormal"]));if(s==="textord"){var E=Ws[r][i]&&Ws[r][i].font;if(E==="ams"){var k=s1("amsrm",c,d);return Li(i,k,r,n,o.concat("amsrm",c,d))}else if(E==="main"||!E){var M=s1("textrm",c,d);return Li(i,M,r,n,o.concat(c,d))}else{var R=s1(E,c,d);return Li(i,R,r,n,o.concat(R,c,d))}}else throw new Error("unexpected type: "+s+" in makeOrd")},Nse=(e,t)=>{if(Au(e.classes)!==Au(t.classes)||e.skew!==t.skew||e.maxFontSize!==t.maxFontSize||e.italic!==0&&e.hasClass("mathnormal"))return!1;if(e.classes.length===1){var n=e.classes[0];if(n==="mbin"||n==="mord")return!1}for(var s of Object.keys(e.style))if(e.style[s]!==t.style[s])return!1;for(var r of Object.keys(t.style))if(e.style[r]!==t.style[r])return!1;return!0},aO=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],s=e[t+1];n instanceof Ro&&s instanceof Ro&&Nse(n,s)&&(n.text+=s.text,n.height=Math.max(n.height,s.height),n.depth=Math.max(n.depth,s.depth),n.italic=s.italic,e.splice(t+1,1),t--)}return e},KS=function(t){for(var n=0,s=0,r=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>s&&(s=o.depth),o.maxFontSize>r&&(r=o.maxFontSize)}t.height=n,t.depth=s,t.maxFontSize=r},qe=function(t,n,s,r){var i=new lm(t,n,s,r);return KS(i),i},Mu=(e,t,n,s)=>new lm(e,t,n,s),Bf=function(t,n,s){var r=qe([t],[],n);return r.height=Math.max(s||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),r.style.borderBottomWidth=Ze(r.height),r.maxFontSize=1,r},Ise=function(t,n,s,r){var i=new zv(t,n,s,r);return KS(i),i},xc=function(t){var n=new am(t);return KS(n),n},Pf=function(t,n){return t instanceof am?qe([],[t],n):t},jse=function(t){if(t.positionType==="individualShift"){for(var n=t.children,s=[n[0]],r=-n[0].shift-n[0].elem.depth,i=r,o=1;o<n.length;o++){var a=-n[o].shift-i-n[o].elem.depth,l=a-(n[o-1].elem.height+n[o-1].elem.depth);i=i+a,s.push({type:"kern",size:l}),s.push(n[o])}return{children:s,depth:r}}var c;if(t.positionType==="top"){for(var d=t.positionData,h=0;h<t.children.length;h++){var f=t.children[h];d-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=d}else if(t.positionType==="bottom")c=-t.positionData;else{var m=t.children[0];if(m.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")c=-m.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")c=-m.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:c}},ls=function(t,n){for(var{children:s,depth:r}=jse(t),i=0,o=0;o<s.length;o++){var a=s[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=qe(["pstrut"],[]);c.style.height=Ze(i);for(var d=[],h=r,f=r,m=r,p=0;p<s.length;p++){var y=s[p];if(y.type==="kern")m+=y.size;else{var w=y.elem,b=y.wrapperClasses||[],v=y.wrapperStyle||{},x=qe(b,[c,w],void 0,v);x.style.top=Ze(-i-m-w.depth),y.marginLeft&&(x.style.marginLeft=y.marginLeft),y.marginRight&&(x.style.marginRight=y.marginRight),d.push(x),m+=w.height+w.depth}h=Math.min(h,m),f=Math.max(f,m)}var _=qe(["vlist"],d);_.style.height=Ze(f);var E;if(h<0){var k=qe([],[]),M=qe(["vlist"],[k]);M.style.height=Ze(-h);var R=qe(["vlist-s"],[new Ro("​")]);E=[qe(["vlist-r"],[_,R]),qe(["vlist-r"],[M])]}else E=[qe(["vlist-r"],[_])];var L=qe(["vlist-t"],E);return E.length===2&&L.classes.push("vlist-t2"),L.height=f,L.depth=-h,L},lO=(e,t)=>{var n=qe(["mspace"],[],t),s=nr(e,t);return n.style.marginRight=Ze(s),n},s1=(e,t,n)=>{var s,r;switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}return t==="textbf"&&n==="textit"?r="BoldItalic":t==="textbf"?r="Bold":n==="textit"?r="Italic":r="Regular",s+"-"+r},g3={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},cO={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},uO=function(t,n){var[s,r,i]=cO[t],o=new Eu(s),a=new pc([o],{width:Ze(r),height:Ze(i),style:"width:"+Ze(r),viewBox:"0 0 "+1e3*r+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=Mu(["overlay"],[a],n);return l.height=i,l.style.height=Ze(i),l.style.width=Ze(r),l},er={number:3,unit:"mu"},nd={number:4,unit:"mu"},Pl={number:5,unit:"mu"},Rse={mord:{mop:er,mbin:nd,mrel:Pl,minner:er},mop:{mord:er,mop:er,mrel:Pl,minner:er},mbin:{mord:nd,mop:nd,mopen:nd,minner:nd},mrel:{mord:Pl,mop:Pl,mopen:Pl,minner:Pl},mopen:{},mclose:{mop:er,mbin:nd,mrel:Pl,minner:er},mpunct:{mord:er,mop:er,mrel:Pl,mopen:er,mclose:er,mpunct:er,minner:er},minner:{mord:er,mop:er,mbin:nd,mrel:Pl,mopen:er,mpunct:er,minner:er}},Lse={mord:{mop:er},mop:{mord:er,mop:er},mbin:{},mrel:{},mopen:{},mclose:{mop:er},mpunct:{},minner:{mop:er}},dO={},vb={},wb={};function xt(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs,argTypes:s.argTypes,allowedInArgument:!!s.allowedInArgument,allowedInText:!!s.allowedInText,allowedInMath:s.allowedInMath===void 0?!0:s.allowedInMath,numOptionalArgs:s.numOptionalArgs||0,infix:!!s.infix,primitive:!!s.primitive,handler:r},l=0;l<n.length;++l)dO[n[l]]=a;t&&(i&&(vb[t]=i),o&&(wb[t]=o))}function lh(e){var{type:t,htmlBuilder:n,mathmlBuilder:s}=e;xt({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:s})}var xb=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Tr=function(t){return t.type==="ordgroup"?t.body:[t]},Dse=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),Ose=new Set(["rightmost","mrel","mclose","mpunct"]),Bse={display:fn.DISPLAY,text:fn.TEXT,script:fn.SCRIPT,scriptscript:fn.SCRIPTSCRIPT},Pse={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},Pr=function(t,n,s,r){r===void 0&&(r=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=us(t[o],n);if(a instanceof am){var l=a.children;i.push(...l)}else i.push(a)}if(aO(i),!s)return i;var c=n;if(t.length===1){var d=t[0];d.type==="sizing"?c=n.havingSize(d.size):d.type==="styling"&&(c=n.havingStyle(Bse[d.style]))}var h=qe([r[0]||"leftmost"],[],n),f=qe([r[1]||"rightmost"],[],n),m=s==="root";return y3(i,(p,y)=>{var w=y.classes[0],b=p.classes[0];w==="mbin"&&Ose.has(b)?y.classes[0]="mord":b==="mbin"&&Dse.has(w)&&(p.classes[0]="mord")},{node:h},f,m),y3(i,(p,y)=>{var w,b,v=v3(y),x=v3(p),_=v&&x?p.hasClass("mtight")?(w=Lse[v])==null?void 0:w[x]:(b=Rse[v])==null?void 0:b[x]:null;if(_)return lO(_,c)},{node:h},f,m),i},y3=function(t,n,s,r,i){r&&t.push(r);for(var o=0;o<t.length;o++){var a=t[o],l=hO(a);if(l){y3(l.children,n,s,null,i);continue}var c=!a.hasClass("mspace");if(c){var d=n(a,s.node);d&&(s.insertAfter?s.insertAfter(d):(t.unshift(d),o++))}c?s.node=a:i&&a.hasClass("newline")&&(s.node=qe(["leftmost"])),s.insertAfter=(h=>f=>{t.splice(h+1,0,f),o++})(o)}r&&t.pop()},hO=function(t){return t instanceof am||t instanceof zv||t instanceof lm&&t.hasClass("enclosing")?t:null},b3=function(t,n){var s=hO(t);if(s){var r=s.children;if(r.length){if(n==="right")return b3(r[r.length-1],"right");if(n==="left")return b3(r[0],"left")}}return t},v3=function(t,n){if(!t)return null;n&&(t=b3(t,n));var s=t.classes[0];return Pse[s]||null},hp=function(t,n){var s=["nulldelimiter"].concat(t.baseSizingClasses());return qe(n.concat(s))},us=function(t,n,s){if(!t)return qe();if(vb[t.type]){var r=vb[t.type](t,n);if(s&&n.size!==s.size){r=qe(n.sizingClasses(s),[r],n);var i=n.sizeMultiplier/s.sizeMultiplier;r.height*=i,r.depth*=i}return r}else throw new We("Got group of unknown type: '"+t.type+"'")};function r1(e,t){var n=qe(["base"],e,t),s=qe(["strut"]);return s.style.height=Ze(n.height+n.depth),n.depth&&(s.style.verticalAlign=Ze(-n.depth)),n.children.unshift(s),n}function w3(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var s=Pr(e,t,"root"),r;s.length===2&&s[1].hasClass("tag")&&(r=s.pop());for(var i=[],o=[],a=0;a<s.length;a++)if(o.push(s[a]),s[a].hasClass("mbin")||s[a].hasClass("mrel")||s[a].hasClass("allowbreak")){for(var l=!1;a<s.length-1&&s[a+1].hasClass("mspace")&&!s[a+1].hasClass("newline");)a++,o.push(s[a]),s[a].hasClass("nobreak")&&(l=!0);l||(i.push(r1(o,t)),o=[])}else s[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(r1(o,t)),o=[]),i.push(s[a]));o.length>0&&i.push(r1(o,t));var c;n?(c=r1(Pr(n,t,!0),t),c.classes=["tag"],i.push(c)):r&&i.push(r);var d=qe(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=Ze(d.height+d.depth),d.depth&&(h.style.verticalAlign=Ze(-d.depth))}return d}function fO(e){return new am(e)}class Ke{constructor(t,n,s){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=t,this.attributes={},this.children=n||[],this.classes=s||[]}setAttribute(t,n){this.attributes[t]=n}getAttribute(t){return this.attributes[t]}toNode(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&t.setAttribute(n,this.attributes[n]);this.classes.length>0&&(t.className=Au(this.classes));for(var s=0;s<this.children.length;s++)if(this.children[s]instanceof Cr&&this.children[s+1]instanceof Cr){for(var r=this.children[s].toText()+this.children[++s].toText();this.children[s+1]instanceof Cr;)r+=this.children[++s].toText();t.appendChild(new Cr(r).toNode())}else t.appendChild(this.children[s].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=wi(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+wi(Au(this.classes))+'"'),t+=">";for(var s=0;s<this.children.length;s++)t+=this.children[s].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}let Cr=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return wi(this.toText())}toText(){return this.text}};class mO{constructor(t){this.width=void 0,this.character=void 0,this.width=t,t>=.05555&&t<=.05556?this.character=" ":t>=.1666&&t<=.1667?this.character=" ":t>=.2222&&t<=.2223?this.character=" ":t>=.2777&&t<=.2778?this.character="  ":t>=-.05556&&t<=-.05555?this.character=" ⁣":t>=-.1667&&t<=-.1666?this.character=" ⁣":t>=-.2223&&t<=-.2222?this.character=" ⁣":t>=-.2778&&t<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",Ze(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ze(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var $se=new Set(["\\imath","\\jmath"]),zse=new Set(["mrow","mtable"]),ca=function(t,n,s){return Ws[n][t]&&Ws[n][t].replace&&t.charCodeAt(0)!==55349&&!(oO.hasOwnProperty(t)&&s&&(s.fontFamily&&s.fontFamily.slice(4,6)==="tt"||s.font&&s.font.slice(4,6)==="tt"))&&(t=Ws[n][t].replace),new Cr(t)},YS=function(t){return t.length===1?t[0]:new Ke("mrow",t)},Fse={mathit:"italic",boldsymbol:e=>e.type==="textord"?"bold":"bold-italic",mathbf:"bold",mathbb:"double-struck",mathsfit:"sans-serif-italic",mathfrak:"fraktur",mathscr:"script",mathcal:"script",mathsf:"sans-serif",mathtt:"monospace"},QS=(e,t)=>{if(e.mode==="text"){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold"}var n=t.font;if(!n||n==="mathnormal")return null;var s=e.mode,r=Fse[n];if(r)return typeof r=="function"?r(e):r;var i=e.text;if($se.has(i))return null;if(Ws[s][i]){var o=Ws[s][i].replace;o&&(i=o)}var a=g3[n].fontName;return WS(i,a,s)?g3[n].variant:null};function hx(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Cr&&t.text==="."}else if(e.type==="mo"&&e.children.length===1&&e.getAttribute("separator")==="true"&&e.getAttribute("lspace")==="0em"&&e.getAttribute("rspace")==="0em"){var n=e.children[0];return n instanceof Cr&&n.text===","}else return!1}var Do=function(t,n,s){if(t.length===1){var r=Is(t[0],n);return s&&r instanceof Ke&&r.type==="mo"&&(r.setAttribute("lspace","0em"),r.setAttribute("rspace","0em")),[r]}for(var i=[],o,a=0;a<t.length;a++){var l=Is(t[a],n);if(l instanceof Ke&&o instanceof Ke){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(hx(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&hx(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||hx(o))){var c=l.children[0];c instanceof Ke&&c.type==="mn"&&(c.children=[...o.children,...c.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof Cr&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Cr&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),i.pop())}}}i.push(l),o=l}return i},Nu=function(t,n,s){return YS(Do(t,n,s))},Is=function(t,n){if(!t)return new Ke("mrow");if(wb[t.type])return wb[t.type](t,n);throw new We("Got group of unknown type: '"+t.type+"'")};function RC(e,t,n,s,r){var i=Do(e,n),o;i.length===1&&i[0]instanceof Ke&&zse.has(i[0].type)?o=i[0]:o=new Ke("mrow",i);var a=new Ke("annotation",[new Cr(t)]);a.setAttribute("encoding","application/x-tex");var l=new Ke("semantics",[o,a]),c=new Ke("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),s&&c.setAttribute("display","block");var d=r?"katex":"katex-mathml";return qe([d],[c])}var qse=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],LC=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],DC=function(t,n){return n.size<2?t:qse[t-1][n.size-1]};class Ul{constructor(t){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=t.style,this.color=t.color,this.size=t.size||Ul.BASESIZE,this.textSize=t.textSize||this.size,this.phantom=!!t.phantom,this.font=t.font||"",this.fontFamily=t.fontFamily||"",this.fontWeight=t.fontWeight||"",this.fontShape=t.fontShape||"",this.sizeMultiplier=LC[this.size-1],this.maxSize=t.maxSize,this.minRuleThickness=t.minRuleThickness,this._fontMetrics=void 0}extend(t){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};return Object.assign(n,t),new Ul(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:DC(this.textSize,t)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(t){return this.size===t&&this.textSize===t?this:this.extend({style:this.style.text(),size:t,textSize:t,sizeMultiplier:LC[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=DC(Ul.BASESIZE,t);return this.size===n&&this.textSize===Ul.BASESIZE&&this.style===t?this:this.extend({style:t,size:n})}havingBaseSizing(){var t;switch(this.style.id){case 4:case 5:t=3;break;case 6:case 7:t=1;break;default:t=6}return this.extend({style:this.style.text(),size:t})}withColor(t){return this.extend({color:t})}withPhantom(){return this.extend({phantom:!0})}withFont(t){return this.extend({font:t})}withTextFontFamily(t){return this.extend({fontFamily:t,font:""})}withTextFontWeight(t){return this.extend({fontWeight:t,font:""})}withTextFontShape(t){return this.extend({fontShape:t,font:""})}sizingClasses(t){return t.size!==this.size?["sizing","reset-size"+t.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Ul.BASESIZE?["sizing","reset-size"+this.size,"size"+Ul.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Tse(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ul.BASESIZE=6;var pO=function(t){return new Ul({style:t.displayMode?fn.DISPLAY:fn.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},gO=function(t,n){if(n.displayMode){var s=["katex-display"];n.leqno&&s.push("leqno"),n.fleqn&&s.push("fleqn"),t=qe(s,[t])}return t},Hse=function(t,n,s){var r=pO(s),i;if(s.output==="mathml")return RC(t,n,r,s.displayMode,!0);if(s.output==="html"){var o=w3(t,r);i=qe(["katex"],[o])}else{var a=RC(t,n,r,s.displayMode,!1),l=w3(t,r);i=qe(["katex"],[a,l])}return gO(i,s)},Use=function(t,n,s){var r=pO(s),i=w3(t,r),o=qe(["katex"],[i]);return gO(o,s)},Vse={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",underbracket:"⎵",overbracket:"⎴",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},Hv=function(t){var n=new Ke("mo",[new Cr(Vse[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Wse={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overbracket:[["leftbracketover","rightbracketover"],1.6,440],underbracket:[["leftbracketunder","rightbracketunder"],1.6,410],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Gse=new Set(["widehat","widecheck","widetilde","utilde"]),Uv=function(t,n){function s(){var a=4e5,l=t.label.slice(1);if(Gse.has(l)&&"base"in t){var c=t.base.type==="ordgroup"?t.base.body.length:1,d,h,f;if(c>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,f=.42,h=l+"4"):(d=312,a=2340,f=.34,h="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],d=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],h=l+m):(a=[0,600,1033,2339,2340][m],d=[0,260,286,306,312][m],f=[0,.26,.286,.3,.306,.34][m],h="tilde"+m)}var p=new Eu(h),y=new pc([p],{width:"100%",height:Ze(f),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:Mu([],[y],n),minWidth:0,height:f}}else{var w=[],b=Wse[l];if(!b)throw new Error('No SVG data for "'+l+'".');var[v,x,_]=b,E=_/1e3,k=v.length,M,R;if(k===1){if(b.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');M=["hide-tail"],R=[b[3]]}else if(k===2)M=["halfarrow-left","halfarrow-right"],R=["xMinYMin","xMaxYMin"];else if(k===3)M=["brace-left","brace-center","brace-right"],R=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+k+" children.");for(var L=0;L<k;L++){var T=new Eu(v[L]),N=new pc([T],{width:"400em",height:Ze(E),viewBox:"0 0 "+a+" "+_,preserveAspectRatio:R[L]+" slice"}),I=Mu([M[L]],[N],n);if(k===1)return{span:I,minWidth:x,height:E};I.style.height=Ze(E),w.push(I)}return{span:qe(["stretchy"],w,n),minWidth:x,height:E}}}var{span:r,minWidth:i,height:o}=s();return r.height=o,r.style.height=Ze(o),i>0&&(r.style.minWidth=Ze(i)),r},Kse=function(t,n,s,r,i){var o,a=t.height+t.depth+s+r;if(/fbox|color|angl/.test(n)){if(o=qe(["stretchy",n],[],i),n==="fbox"){var l=i.color&&i.getColor();l&&(o.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new u3({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new u3({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new pc(c,{width:"100%",height:Ze(a)});o=Mu([],[d],i)}return o.height=a,o.style.height=Ze(a),o},Yse={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Qse={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function Xse(e){return e in Yse}function En(e,t){if(!e||e.type!==t)throw new Error("Expected node of type "+t+", but got "+(e?"node of type "+e.type:String(e)));return e}function Vv(e){var t=Wv(e);if(!t)throw new Error("Expected node of symbol group type, but got "+(e?"node of type "+e.type:String(e)));return t}function Wv(e){return e&&(e.type==="atom"||Qse.hasOwnProperty(e.type))?e:null}var yO=e=>{if(e instanceof Ro)return e;if(Sse(e)&&e.children.length===1)return yO(e.children[0])},XS=(e,t)=>{var n,s,r;e&&e.type==="supsub"?(s=En(e.base,"accent"),n=s.base,e.base=n,r=kse(us(e,t)),e.base=s):(s=En(e,"accent"),n=s.base);var i=us(n,t.havingCrampedStyle()),o=s.isShifty&&vc(n),a=0;if(o){var l,c;a=(l=(c=yO(i))==null?void 0:c.skew)!=null?l:0}var d=s.label==="\\c",h=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),f;if(s.isStretchy)f=Uv(s,t),f=ls({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Ze(2*a)+")",marginLeft:Ze(2*a)}:void 0}]});else{var m,p;s.label==="\\vec"?(m=uO("vec",t),p=cO.vec[1]):(m=qv({mode:s.mode,text:s.label},t,"textord"),m=_se(m),m.italic=0,p=m.width,d&&(h+=m.depth)),f=qe(["accent-body"],[m]);var y=s.label==="\\textcircled";y&&(f.classes.push("accent-full"),h=i.height);var w=a;y||(w-=p/2),f.style.left=Ze(w),s.label==="\\textcircled"&&(f.style.top=".2em"),f=ls({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:f}]})}var b=qe(["mord","accent"],[f],t);return r?(r.children[0]=b,r.height=Math.max(b.height,r.height),r.classes[0]="mord",r):b},bO=(e,t)=>{var n=e.isStretchy?Hv(e.label):new Ke("mo",[ca(e.label,e.mode)]),s=new Ke("mover",[Is(e.base,t),n]);return s.setAttribute("accent","true"),s},Jse=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));xt({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(e,t)=>{var n=xb(t[0]),s=!Jse.test(e.funcName),r=!s||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:s,isShifty:r,base:n}},htmlBuilder:XS,mathmlBuilder:bO});xt({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(e,t)=>{var n=t[0],s=e.parser.mode;return s==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),s="text"),{type:"accent",mode:s,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:XS,mathmlBuilder:bO});xt({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"accentUnder",mode:n.mode,label:s,base:r}},htmlBuilder:(e,t)=>{var n=us(e.base,t),s=Uv(e,t),r=e.label==="\\utilde"?.12:0,i=ls({positionType:"top",positionData:n.height,children:[{type:"elem",elem:s,wrapperClasses:["svg-align"]},{type:"kern",size:r},{type:"elem",elem:n}]});return qe(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=Hv(e.label),s=new Ke("munder",[Is(e.base,t),n]);return s.setAttribute("accentunder","true"),s}});var i1=e=>{var t=new Ke("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};xt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:s,funcName:r}=e;return{type:"xArrow",mode:s.mode,label:r,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,s=t.havingStyle(n.sup()),r=Pf(us(e.body,s,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";r.classes.push(i+"-arrow-pad");var o;e.below&&(s=t.havingStyle(n.sub()),o=Pf(us(e.below,s,t),t),o.classes.push(i+"-arrow-pad"));var a=Uv(e,t),l=-t.fontMetrics().axisHeight+.5*a.height,c=-t.fontMetrics().axisHeight-.5*a.height-.111;(r.depth>.25||e.label==="\\xleftequilibrium")&&(c-=r.depth);var d;if(o){var h=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=ls({positionType:"individualShift",children:[{type:"elem",elem:r,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else d=ls({positionType:"individualShift",children:[{type:"elem",elem:r,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return qe(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=Hv(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var s;if(e.body){var r=i1(Is(e.body,t));if(e.below){var i=i1(Is(e.below,t));s=new Ke("munderover",[n,i,r])}else s=new Ke("mover",[n,r])}else if(e.below){var o=i1(Is(e.below,t));s=new Ke("munder",[n,o])}else s=i1(),s=new Ke("mover",[n,s]);return s}});function vO(e,t){var n=Pr(e.body,t,!0);return qe([e.mclass],n,t)}function wO(e,t){var n,s=Do(e.body,t);return e.mclass==="minner"?n=new Ke("mpadded",s):e.mclass==="mord"?e.isCharacterBox?(n=s[0],n.type="mi"):n=new Ke("mi",s):(e.isCharacterBox?(n=s[0],n.type="mo"):n=new Ke("mo",s),e.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):e.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):e.mclass==="mopen"||e.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):e.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}xt({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+s.slice(5),body:Tr(r),isCharacterBox:vc(r)}},htmlBuilder:vO,mathmlBuilder:wO});var Gv=e=>{var t=e.type==="ordgroup"&&e.body.length?e.body[0]:e;return t.type==="atom"&&(t.family==="bin"||t.family==="rel")?"m"+t.family:"mord"};xt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Gv(t[0]),body:Tr(t[1]),isCharacterBox:vc(t[1])}}});xt({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:s}=e,r=t[1],i=t[0],o;s!=="\\stackrel"?o=Gv(r):o="mrel";var a={type:"op",mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:s!=="\\stackrel",body:Tr(r)},l={type:"supsub",mode:i.mode,base:a,sup:s==="\\underset"?null:i,sub:s==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:vc(l)}},htmlBuilder:vO,mathmlBuilder:wO});xt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Gv(t[0]),body:Tr(t[0])}},htmlBuilder(e,t){var n=Pr(e.body,t,!0),s=qe([e.mclass],n,t);return s.style.textShadow="0.02em 0.01em 0.04px",s},mathmlBuilder(e,t){var n=Do(e.body,t),s=new Ke("mstyle",n);return s.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),s}});var Zse={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},OC=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),BC=e=>e.type==="textord"&&e.text==="@",ere=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function tre(e,t,n){var s=Zse[e];switch(s){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(s,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var r=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:s,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),a=n.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[r,o,a]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function nre(e){var t=[];for(e.gullet.beginGroup(),e.gullet.macros.set("\\cr","\\\\\\relax"),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,"\\\\")),e.gullet.endGroup(),e.gullet.beginGroup();var n=e.fetch().text;if(n==="&"||n==="\\\\")e.consume();else if(n==="\\end"){t[t.length-1].length===0&&t.pop();break}else throw new We("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var s=[],r=[s],i=0;i<t.length;i++){for(var o=t[i],a=OC(),l=0;l<o.length;l++)if(!BC(o[l]))a.body.push(o[l]);else{s.push(a),l+=1;var c=Vv(o[l]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var h=0;h<2;h++){for(var f=!0,m=l+1;m<o.length;m++){if(ere(o[m],c)){f=!1,l=m;break}if(BC(o[m]))throw new We("Missing a "+c+" character to complete a CD arrow.",o[m]);d[h].body.push(o[m])}if(f)throw new We("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new We('Expected one of "<>AV=|." after @',o[l]);var p=tre(c,d,e),y={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};s.push(y),a=OC()}i%2===0?s.push(a):s.shift(),s=[],r.push(s)}e.gullet.endGroup(),e.gullet.endGroup();var w=new Array(r[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:r,arraystretch:1,addJot:!0,rowGaps:[null],cols:w,colSeparationType:"CD",hLinesBeforeRow:new Array(r.length+1).fill([])}}xt({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"cdlabel",mode:n.mode,side:s.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),s=Pf(us(e.label,n,t),t);return s.classes.push("cd-label-"+e.side),s.style.bottom=Ze(.8-s.depth),s.height=0,s.depth=0,s},mathmlBuilder(e,t){var n=new Ke("mrow",[Is(e.label,t)]);return n=new Ke("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ke("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});xt({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(e,t){var{parser:n}=e;return{type:"cdlabelparent",mode:n.mode,fragment:t[0]}},htmlBuilder(e,t){var n=Pf(us(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Ke("mrow",[Is(e.fragment,t)])}});xt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,s=En(t[0],"ordgroup"),r=s.body,i="",o=0;o<r.length;o++){var a=En(r[o],"textord");i+=a.text}var l=parseInt(i),c;if(isNaN(l))throw new We("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new We("\\@char with invalid code point "+i);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:c}}});var xO=(e,t)=>{var n=Pr(e.body,t.withColor(e.color),!1);return xc(n)},_O=(e,t)=>{var n=Do(e.body,t.withColor(e.color)),s=new Ke("mstyle",n);return s.setAttribute("mathcolor",e.color),s};xt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,s=En(t[0],"color-token").color,r=t[1];return{type:"color",mode:n.mode,color:s,body:Tr(r)}},htmlBuilder:xO,mathmlBuilder:_O});xt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:s}=e,r=En(t[0],"color-token").color;n.gullet.macros.set("\\current@color",r);var i=n.parseExpression(!0,s);return{type:"color",mode:n.mode,color:r,body:i}},htmlBuilder:xO,mathmlBuilder:_O});xt({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:s}=e,r=s.gullet.future().text==="["?s.parseSizeGroup(!0):null,i=!s.settings.displayMode||!s.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:s.mode,newLine:i,size:r&&En(r,"size").value}},htmlBuilder(e,t){var n=qe(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Ze(nr(e.size,t)))),n},mathmlBuilder(e,t){var n=new Ke("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Ze(nr(e.size,t)))),n}});var x3={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},kO=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new We("Expected a control sequence",e);return t},sre=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},SO=(e,t,n,s)=>{var r=e.gullet.macros.get(n.text);r==null&&(n.noexpand=!0,r={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,r,s)};xt({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var s=t.fetch();if(x3[s.text])return(n==="\\global"||n==="\\\\globallong")&&(s.text=x3[s.text]),En(t.parseFunction(),"internal");throw new We("Invalid token after macro prefix",s)}});xt({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=t.gullet.popToken(),r=s.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new We("Expected a control sequence",s);for(var i=0,o,a=[[]];t.gullet.future().text!=="{";)if(s=t.gullet.popToken(),s.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),a[i].push("{");break}if(s=t.gullet.popToken(),!/^[1-9]$/.test(s.text))throw new We('Invalid argument number "'+s.text+'"');if(parseInt(s.text)!==i+1)throw new We('Argument number "'+s.text+'" out of order');i++,a.push([])}else{if(s.text==="EOF")throw new We("Expected a macro definition");a[i].push(s.text)}var{tokens:l}=t.gullet.consumeArg();return o&&l.unshift(o),(n==="\\edef"||n==="\\xdef")&&(l=t.gullet.expandTokens(l),l.reverse()),t.gullet.macros.set(r,{tokens:l,numArgs:i,delimiters:a},n===x3[n]),{type:"internal",mode:t.mode}}});xt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=kO(t.gullet.popToken());t.gullet.consumeSpaces();var r=sre(t);return SO(t,s,r,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});xt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,s=kO(t.gullet.popToken()),r=t.gullet.popToken(),i=t.gullet.popToken();return SO(t,s,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(r),{type:"internal",mode:t.mode}}});var s0=function(t,n,s){var r=Ws.math[t]&&Ws.math[t].replace,i=WS(r||t,n,s);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},JS=function(t,n,s,r){var i=s.havingBaseStyle(n),o=qe(r.concat(i.sizingClasses(s)),[t],s),a=i.sizeMultiplier/s.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},TO=function(t,n,s){var r=n.havingBaseStyle(s),i=(1-n.sizeMultiplier/r.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=Ze(i),t.height-=i,t.depth+=i},rre=function(t,n,s,r,i,o){var a=Li(t,"Main-Regular",i,r),l=JS(a,n,r,o);return TO(l,r,n),l},ire=function(t,n,s,r){return Li(t,"Size"+n+"-Regular",s,r)},CO=function(t,n,s,r,i,o){var a=ire(t,n,i,r),l=JS(qe(["delimsizing","size"+n],[a],r),fn.TEXT,r,o);return s&&TO(l,r,fn.TEXT),l},fx=function(t,n,s){var r;n==="Size1-Regular"?r="delim-size1":r="delim-size4";var i=qe(["delimsizinginner",r],[qe([],[Li(t,n,s)])]);return{type:"elem",elem:i}},mx=function(t,n,s){var r=ll["Size4-Regular"][t.charCodeAt(0)]?ll["Size4-Regular"][t.charCodeAt(0)][4]:ll["Size1-Regular"][t.charCodeAt(0)][4],i=new Eu("inner",pse(t,Math.round(1e3*n))),o=new pc([i],{width:Ze(r),height:Ze(n),style:"width:"+Ze(r),viewBox:"0 0 "+1e3*r+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=Mu([],[o],s);return a.height=n,a.style.height=Ze(n),a.style.width=Ze(r),{type:"elem",elem:a}},_3=.008,o1={type:"kern",size:-1*_3},ore=new Set(["|","\\lvert","\\rvert","\\vert"]),are=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),AO=function(t,n,s,r,i,o){var a,l,c,d,h="",f=0;a=c=d=t,l=null;var m="Size1-Regular";t==="\\uparrow"?c=d="⏐":t==="\\Uparrow"?c=d="‖":t==="\\downarrow"?a=c="⏐":t==="\\Downarrow"?a=c="‖":t==="\\updownarrow"?(a="\\uparrow",c="⏐",d="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",c="‖",d="\\Downarrow"):ore.has(t)?(c="∣",h="vert",f=333):are.has(t)?(c="∥",h="doublevert",f=556):t==="["||t==="\\lbrack"?(a="⎡",c="⎢",d="⎣",m="Size4-Regular",h="lbrack",f=667):t==="]"||t==="\\rbrack"?(a="⎤",c="⎥",d="⎦",m="Size4-Regular",h="rbrack",f=667):t==="\\lfloor"||t==="⌊"?(c=a="⎢",d="⎣",m="Size4-Regular",h="lfloor",f=667):t==="\\lceil"||t==="⌈"?(a="⎡",c=d="⎢",m="Size4-Regular",h="lceil",f=667):t==="\\rfloor"||t==="⌋"?(c=a="⎥",d="⎦",m="Size4-Regular",h="rfloor",f=667):t==="\\rceil"||t==="⌉"?(a="⎤",c=d="⎥",m="Size4-Regular",h="rceil",f=667):t==="("||t==="\\lparen"?(a="⎛",c="⎜",d="⎝",m="Size4-Regular",h="lparen",f=875):t===")"||t==="\\rparen"?(a="⎞",c="⎟",d="⎠",m="Size4-Regular",h="rparen",f=875):t==="\\{"||t==="\\lbrace"?(a="⎧",l="⎨",d="⎩",c="⎪",m="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",l="⎬",d="⎭",c="⎪",m="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",d="⎩",c="⎪",m="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",d="⎭",c="⎪",m="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",d="⎭",c="⎪",m="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",d="⎩",c="⎪",m="Size4-Regular");var p=s0(a,m,i),y=p.height+p.depth,w=s0(c,m,i),b=w.height+w.depth,v=s0(d,m,i),x=v.height+v.depth,_=0,E=1;if(l!==null){var k=s0(l,m,i);_=k.height+k.depth,E=2}var M=y+x+_,R=Math.max(0,Math.ceil((n-M)/(E*b))),L=M+R*E*b,T=r.fontMetrics().axisHeight;s&&(T*=r.sizeMultiplier);var N=L/2-T,I=[];if(h.length>0){var O=L-y-x,U=Math.round(L*1e3),F=gse(h,Math.round(O*1e3)),j=new Eu(h,F),V=Ze(f/1e3),ee=Ze(U/1e3),ce=new pc([j],{width:V,height:ee,viewBox:"0 0 "+f+" "+U}),$=Mu([],[ce],r);$.height=U/1e3,$.style.width=V,$.style.height=ee,I.push({type:"elem",elem:$})}else{if(I.push(fx(d,m,i)),I.push(o1),l===null){var J=L-y-x+2*_3;I.push(mx(c,J,r))}else{var B=(L-y-x-_)/2+2*_3;I.push(mx(c,B,r)),I.push(o1),I.push(fx(l,m,i)),I.push(o1),I.push(mx(c,B,r))}I.push(o1),I.push(fx(a,m,i))}var C=r.havingBaseStyle(fn.TEXT),z=ls({positionType:"bottom",positionData:N,children:I});return JS(qe(["delimsizing","mult"],[z],C),fn.TEXT,r,o)},px=80,gx=.08,yx=function(t,n,s,r,i){var o=mse(t,r,s),a=new Eu(t,o),l=new pc([a],{width:"400em",height:Ze(n),viewBox:"0 0 400000 "+s,preserveAspectRatio:"xMinYMin slice"});return Mu(["hide-tail"],[l],i)},lre=function(t,n){var s=n.havingBaseSizing(),r=jO("\\surd",t*s.sizeMultiplier,IO,s),i=s.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,c,d,h;return r.type==="small"?(d=1e3+1e3*o+px,t<1?i=1:t<1.4&&(i=.7),l=(1+o+gx)/i,c=(1+o)/i,a=yx("sqrtMain",l,d,o,n),a.style.minWidth="0.853em",h=.833/i):r.type==="large"?(d=(1e3+px)*B0[r.size],c=(B0[r.size]+o)/i,l=(B0[r.size]+o+gx)/i,a=yx("sqrtSize"+r.size,l,d,o,n),a.style.minWidth="1.02em",h=1/i):(l=t+o+gx,c=t+o,d=Math.floor(1e3*t+o)+px,a=yx("sqrtTall",l,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=c,a.style.height=Ze(l),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},EO=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),cre=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),MO=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),B0=[0,1.2,1.8,2.4,3],NO=function(t,n,s,r,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),EO.has(t)||MO.has(t))return CO(t,n,!1,s,r,i);if(cre.has(t))return AO(t,B0[n],!1,s,r,i);throw new We("Illegal delimiter: '"+t+"'")},ure=[{type:"small",style:fn.SCRIPTSCRIPT},{type:"small",style:fn.SCRIPT},{type:"small",style:fn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],dre=[{type:"small",style:fn.SCRIPTSCRIPT},{type:"small",style:fn.SCRIPT},{type:"small",style:fn.TEXT},{type:"stack"}],IO=[{type:"small",style:fn.SCRIPTSCRIPT},{type:"small",style:fn.SCRIPT},{type:"small",style:fn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],hre=function(t){if(t.type==="small")return"Main-Regular";if(t.type==="large")return"Size"+t.size+"-Regular";if(t.type==="stack")return"Size4-Regular";var n=t.type;throw new Error("Add support for delim type '"+n+"' here.")},jO=function(t,n,s,r){for(var i=Math.min(2,3-r.style.size),o=i;o<s.length;o++){var a=s[o];if(a.type==="stack")break;var l=s0(t,hre(a),"math"),c=l.height+l.depth;if(a.type==="small"){var d=r.havingBaseStyle(a.style);c*=d.sizeMultiplier}if(c>n)return a}return s[s.length-1]},k3=function(t,n,s,r,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;MO.has(t)?a=ure:EO.has(t)?a=IO:a=dre;var l=jO(t,n,a,r);return l.type==="small"?rre(t,l.style,s,r,i,o):l.type==="large"?CO(t,l.size,s,r,i,o):AO(t,n,s,r,i,o)},bx=function(t,n,s,r,i,o){var a=r.fontMetrics().axisHeight*r.sizeMultiplier,l=901,c=5/r.fontMetrics().ptPerEm,d=Math.max(n-a,s+a),h=Math.max(d/500*l,2*d-c);return k3(t,h,!0,r,i,o)},PC={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},fre=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function $C(e){return"isMiddle"in e}function Kv(e,t){var n=Wv(e);if(n&&fre.has(n.text))return n;throw n?new We("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new We("Invalid delimiter type '"+e.type+"'",e)}xt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(e,t)=>{var n=Kv(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:PC[e.funcName].size,mclass:PC[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?qe([e.mclass]):NO(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(ca(e.delim,e.mode));var n=new Ke("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var s=Ze(B0[e.size]);return n.setAttribute("minsize",s),n.setAttribute("maxsize",s),n}});function zC(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}xt({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=e.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new We("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Kv(t[0],e).text,color:n}}});xt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Kv(t[0],e),s=e.parser;++s.leftrightDepth;var r=s.parseExpression(!1);--s.leftrightDepth,s.expect("\\right",!1);var i=En(s.parseFunction(),"leftright-right");return{type:"leftright",mode:s.mode,body:r,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{zC(e);for(var n=Pr(e.body,t,!0,["mopen","mclose"]),s=0,r=0,i=!1,o=0;o<n.length;o++){var a=n[o];$C(a)?i=!0:(s=Math.max(n[o].height,s),r=Math.max(n[o].depth,r))}s*=t.sizeMultiplier,r*=t.sizeMultiplier;var l;if(e.left==="."?l=hp(t,["mopen"]):l=bx(e.left,s,r,t,e.mode,["mopen"]),n.unshift(l),i)for(var c=1;c<n.length;c++){var d=n[c];if($C(d)){var h=d.isMiddle;n[c]=bx(h.delim,s,r,h.options,e.mode,[])}}var f;if(e.right===".")f=hp(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;f=bx(e.right,s,r,m,e.mode,["mclose"])}return n.push(f),qe(["minner"],n,t)},mathmlBuilder:(e,t)=>{zC(e);var n=Do(e.body,t);if(e.left!=="."){var s=new Ke("mo",[ca(e.left,e.mode)]);s.setAttribute("fence","true"),n.unshift(s)}if(e.right!=="."){var r=new Ke("mo",[ca(e.right,e.mode)]);r.setAttribute("fence","true"),e.rightColor&&r.setAttribute("mathcolor",e.rightColor),n.push(r)}return YS(n)}});xt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Kv(t[0],e);if(!e.parser.leftrightDepth)throw new We("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=hp(t,[]):(n=NO(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?ca("|","text"):ca(e.delim,e.mode),s=new Ke("mo",[n]);return s.setAttribute("fence","true"),s.setAttribute("lspace","0.05em"),s.setAttribute("rspace","0.05em"),s}});var Yv=(e,t)=>{var n=Pf(us(e.body,t),t),s=e.label.slice(1),r=t.sizeMultiplier,i,o,a=vc(e.body);if(s==="sout")i=qe(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/r,o=-.5*t.fontMetrics().xHeight;else if(s==="phase"){var l=nr({number:.6,unit:"pt"},t),c=nr({number:.35,unit:"ex"},t),d=t.havingBaseSizing();r=r/d.sizeMultiplier;var h=n.height+n.depth+l+c;n.style.paddingLeft=Ze(h/2+l);var f=Math.floor(1e3*h*r),m=hse(f),p=new pc([new Eu("phase",m)],{width:"400em",height:Ze(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=Mu(["hide-tail"],[p],t),i.style.height=Ze(h),o=n.depth+l+c}else{/cancel/.test(s)?a||n.classes.push("cancel-pad"):s==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var y,w,b=0;/box/.test(s)?(b=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(s==="colorbox"?0:b),w=y):s==="angl"?(b=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*b,w=Math.max(0,.25-n.depth)):(y=a?.2:0,w=y),i=Kse(n,s,y,w,t),/fbox|boxed|fcolorbox/.test(s)?(i.style.borderStyle="solid",i.style.borderWidth=Ze(b)):s==="angl"&&b!==.049&&(i.style.borderTopWidth=Ze(b),i.style.borderRightWidth=Ze(b)),o=n.depth+w,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var v;if(e.backgroundColor)v=ls({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(s)?["svg-align"]:[];v=ls({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(s)&&(v.height=n.height,v.depth=n.depth),/cancel/.test(s)&&!a?qe(["mord","cancel-lap"],[v],t):qe(["mord"],[v],t)},Qv=(e,t)=>{var n,s=new Ke(e.label.includes("colorbox")?"mpadded":"menclose",[Is(e.body,t)]);switch(e.label){case"\\cancel":s.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":s.setAttribute("notation","downdiagonalstrike");break;case"\\phase":s.setAttribute("notation","phasorangle");break;case"\\sout":s.setAttribute("notation","horizontalstrike");break;case"\\fbox":s.setAttribute("notation","box");break;case"\\angl":s.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,s.setAttribute("width","+"+2*n+"pt"),s.setAttribute("height","+"+2*n+"pt"),s.setAttribute("lspace",n+"pt"),s.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var r=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);s.setAttribute("style","border: "+Ze(r)+" solid "+e.borderColor)}break;case"\\xcancel":s.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&s.setAttribute("mathbackground",e.backgroundColor),s};xt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=En(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:s.mode,label:r,backgroundColor:i,body:o}},htmlBuilder:Yv,mathmlBuilder:Qv});xt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:s,funcName:r}=e,i=En(t[0],"color-token").color,o=En(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:s.mode,label:r,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:Yv,mathmlBuilder:Qv});xt({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\fbox",body:t[0]}}});xt({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:Yv,mathmlBuilder:Qv});xt({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var r=t[0];return{type:"enclose",mode:n.mode,label:s,body:r}},htmlBuilder:Yv,mathmlBuilder:Qv});xt({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"enclose",mode:n.mode,label:"\\angl",body:t[0]}}});var RO={};function xl(e){for(var{type:t,names:n,props:s,handler:r,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:s.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r},l=0;l<n.length;++l)RO[n[l]]=a;i&&(vb[t]=i),o&&(wb[t]=o)}var LO={};function H(e,t){LO[e]=t}class so{constructor(t,n,s){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=s}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new so(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class No{constructor(t,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=t,this.loc=n}range(t,n){return new No(n,so.range(this,t))}}function FC(e){var t=[];e.consumeSpaces();var n=e.fetch().text;for(n==="\\relax"&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n==="\\hline"||n==="\\hdashline";)e.consume(),t.push(n==="\\hdashline"),e.consumeSpaces(),n=e.fetch().text;return t}var Xv=e=>{var t=e.parser.settings;if(!t.displayMode)throw new We("{"+e.envName+"} can be used only in display mode.")},mre=new Set(["gather","gather*"]);function ZS(e){if(!e.includes("ed"))return!e.includes("*")}function qu(e,t,n){var{hskipBeforeAndAfter:s,addJot:r,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:h,leqno:f}=t;if(e.gullet.beginGroup(),c||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var m=e.gullet.expandMacroAsText("\\arraystretch");if(m==null)o=1;else if(o=parseFloat(m),!o||o<0)throw new We("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var p=[],y=[p],w=[],b=[],v=l!=null?[]:void 0;function x(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function _(){v&&(e.gullet.macros.get("\\df@tag")?(v.push(e.subparse([new No("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):v.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),b.push(FC(e));;){var E=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var k={type:"ordgroup",mode:e.mode,body:E};n&&(k={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[k]}),p.push(k);var M=e.fetch().text;if(M==="&"){if(h&&p.length===h){if(c||a)throw new We("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(M==="\\end"){_(),p.length===1&&k.type==="styling"&&k.body.length===1&&k.body[0].type==="ordgroup"&&k.body[0].body.length===0&&(y.length>1||!d)&&y.pop(),b.length<y.length+1&&b.push([]);break}else if(M==="\\\\"){e.consume();var R=void 0;e.gullet.future().text!==" "&&(R=e.parseSizeGroup(!0)),w.push(R?R.value:null),_(),b.push(FC(e)),p=[],y.push(p),x()}else throw new We("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:r,arraystretch:o,body:y,cols:i,rowGaps:w,hskipBeforeAndAfter:s,hLinesBeforeRow:b,colSeparationType:a,tags:v,leqno:f}}function e6(e){return e.slice(0,1)==="d"?"display":"text"}var _l=function(t,n){var s,r,i=t.body.length,o=t.hLinesBeforeRow,a=0,l=new Array(i),c=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,f=5*h;if(t.colSeparationType&&t.colSeparationType==="small"){var m=n.havingStyle(fn.SCRIPT).sizeMultiplier;f=.2778*(m/n.sizeMultiplier)}var p=t.colSeparationType==="CD"?nr({number:3,unit:"ex"},n):12*h,y=3*h,w=t.arraystretch*p,b=.7*w,v=.3*w,x=0;function _(Re){for(var rt=0;rt<Re.length;++rt)rt>0&&(x+=.25),c.push({pos:x,isDashed:Re[rt]})}for(_(o[0]),s=0;s<t.body.length;++s){var E=t.body[s],k=b,M=v;a<E.length&&(a=E.length);var R={cells:new Array(E.length),height:0,depth:0,pos:0};for(r=0;r<E.length;++r){var L=us(E[r],n);M<L.depth&&(M=L.depth),k<L.height&&(k=L.height),R.cells[r]=L}var T=t.rowGaps[s],N=0;T&&(N=nr(T,n),N>0&&(N+=v,M<N&&(M=N),N=0)),t.addJot&&s<t.body.length-1&&(M+=y),R.height=k,R.depth=M,x+=k,R.pos=x,x+=M+N,l[s]=R,_(o[s+1])}var I=x/2+n.fontMetrics().axisHeight,O=t.cols||[],U=[],F,j,V=[];if(t.tags&&t.tags.some(Re=>Re))for(s=0;s<i;++s){var ee=l[s],ce=ee.pos-I,$=t.tags[s],J=void 0;$===!0?J=qe(["eqn-num"],[],n):$===!1?J=qe([],[],n):J=qe([],Pr($,n,!0),n),J.depth=ee.depth,J.height=ee.height,V.push({type:"elem",elem:J,shift:ce})}for(r=0,j=0;r<a||j<O.length;++r,++j){for(var B,C=O[j],z=!0;((X=C)==null?void 0:X.type)==="separator";){var X;if(z||(F=qe(["arraycolsep"],[]),F.style.width=Ze(n.fontMetrics().doubleRuleSep),U.push(F)),C.separator==="|"||C.separator===":"){var ae=C.separator==="|"?"solid":"dashed",be=qe(["vertical-separator"],[],n);be.style.height=Ze(x),be.style.borderRightWidth=Ze(d),be.style.borderRightStyle=ae,be.style.margin="0 "+Ze(-d/2);var fe=x-I;fe&&(be.style.verticalAlign=Ze(-fe)),U.push(be)}else throw new We("Invalid separator type: "+C.separator);j++,C=O[j],z=!1}if(!(r>=a)){var ie=void 0;if(r>0||t.hskipBeforeAndAfter){var G,q;ie=(G=(q=C)==null?void 0:q.pregap)!=null?G:f,ie!==0&&(F=qe(["arraycolsep"],[]),F.style.width=Ze(ie),U.push(F))}var le=[];for(s=0;s<i;++s){var Se=l[s],$e=Se.cells[r];if($e){var Ae=Se.pos-I;$e.depth=Se.depth,$e.height=Se.height,le.push({type:"elem",elem:$e,shift:Ae})}}var we=ls({positionType:"individualShift",children:le}),ct=qe(["col-align-"+(((B=C)==null?void 0:B.align)||"c")],[we]);if(U.push(ct),r<a-1||t.hskipBeforeAndAfter){var ht,ut;ie=(ht=(ut=C)==null?void 0:ut.postgap)!=null?ht:f,ie!==0&&(F=qe(["arraycolsep"],[]),F.style.width=Ze(ie),U.push(F))}}}var ft=qe(["mtable"],U);if(c.length>0){for(var tt=Bf("hline",n,d),qt=Bf("hdashline",n,d),Ye=[{type:"elem",elem:ft,shift:0}];c.length>0;){var ge=c.pop(),st=ge.pos-I;ge.isDashed?Ye.push({type:"elem",elem:qt,shift:st}):Ye.push({type:"elem",elem:tt,shift:st})}ft=ls({positionType:"individualShift",children:Ye})}if(V.length===0)return qe(["mord"],[ft],n);var ne=ls({positionType:"individualShift",children:V}),ue=qe(["tag"],[ne],n);return xc([ft,ue])},pre={c:"center ",l:"left ",r:"right "},kl=function(t,n){for(var s=[],r=new Ke("mtd",[],["mtr-glue"]),i=new Ke("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],l=[],c=0;c<a.length;c++)l.push(new Ke("mtd",[Is(a[c],n)]));t.tags&&t.tags[o]&&(l.unshift(r),l.push(r),t.leqno?l.unshift(i):l.push(i)),s.push(new Ke("mtr",l))}var d=new Ke("mtable",s),h=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",Ze(h));var f="",m="";if(t.cols&&t.cols.length>0){var p=t.cols,y="",w=!1,b=0,v=p.length;p[0].type==="separator"&&(f+="top ",b=1),p[p.length-1].type==="separator"&&(f+="bottom ",v-=1);for(var x=b;x<v;x++){var _=p[x];_.type==="align"?(m+=pre[_.align],w&&(y+="none "),w=!0):_.type==="separator"&&w&&(y+=_.separator==="|"?"solid ":"dashed ",w=!1)}d.setAttribute("columnalign",m.trim()),/[sd]/.test(y)&&d.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var E=t.cols||[],k="",M=1;M<E.length;M++)k+=M%2?"0em ":"1em ";d.setAttribute("columnspacing",k.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var R="",L=t.hLinesBeforeRow;f+=L[0].length>0?"left ":"",f+=L[L.length-1].length>0?"right ":"";for(var T=1;T<L.length-1;T++)R+=L[T].length===0?"none ":L[T][0]?"dashed ":"solid ";return/[sd]/.test(R)&&d.setAttribute("rowlines",R.trim()),f!==""&&(d=new Ke("menclose",[d]),d.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(d=new Ke("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},DO=function(t,n){t.envName.includes("ed")||Xv(t);var s=[],r=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=qu(t.parser,{cols:s,addJot:!0,autoTag:i?void 0:ZS(t.envName),emptySingleRow:!0,colSeparationType:r,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,l=0,c={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",h=0;h<n[0].body.length;h++){var f=En(n[0].body[h],"textord");d+=f.text}a=Number(d),l=a*2}var m=!l;o.body.forEach(function(b){for(var v=1;v<b.length;v+=2){var x=En(b[v],"styling"),_=En(x.body[0],"ordgroup");_.body.unshift(c)}if(m)l<b.length&&(l=b.length);else{var E=b.length/2;if(a<E)throw new We("Too many math in a row: "+("expected "+a+", but got "+E),b[0])}});for(var p=0;p<l;++p){var y="r",w=0;p%2===1?y="l":p>0&&m&&(w=1),s[p]={type:"align",align:y,pregap:w,postgap:0}}return o.colSeparationType=m?"align":"alignat",o};xl({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=Wv(t[0]),s=n?[t[0]]:En(t[0],"ordgroup").body,r=s.map(function(o){var a=Vv(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new We("Unknown column alignment: "+l,o)}),i={cols:r,hskipBeforeAndAfter:!0,maxNumCols:r.length};return qu(e.parser,i,e6(e.envName))},htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(e){var t={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[e.envName.replace("*","")],n="c",s={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var r=e.parser;if(r.consumeSpaces(),r.fetch().text==="["){if(r.consume(),r.consumeSpaces(),n=r.fetch().text,!"lcr".includes(n))throw new We("Expected l or c or r",r.nextToken);r.consume(),r.consumeSpaces(),r.expect("]"),r.consume(),s.cols=[{type:"align",align:n}]}}var i=qu(e.parser,s,e6(e.envName)),o=Math.max(0,...i.body.map(a=>a.length));return i.cols=new Array(o).fill({type:"align",align:n}),t?{type:"leftright",mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=qu(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=Wv(t[0]),s=n?[t[0]]:En(t[0],"ordgroup").body,r=s.map(function(a){var l=Vv(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new We("Unknown column alignment: "+c,a)});if(r.length>1)throw new We("{subarray} can contain only one column");var i={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5},o=qu(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new We("{subarray} can contain only one column");return o},htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(e){var t={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=qu(e.parser,t,e6(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:DO,htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){mre.has(e.envName)&&Xv(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:ZS(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return qu(e.parser,t,"display")},htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:DO,htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Xv(e);var t={autoTag:ZS(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return qu(e.parser,t,"display")},htmlBuilder:_l,mathmlBuilder:kl});xl({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Xv(e),nre(e.parser)},htmlBuilder:_l,mathmlBuilder:kl});H("\\nonumber","\\gdef\\@eqnsw{0}");H("\\notag","\\nonumber");xt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new We(e.funcName+" valid only within array environment")}});var qC=RO;xt({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];if(r.type!=="ordgroup")throw new We("Invalid environment name",r);for(var i="",o=0;o<r.body.length;++o)i+=En(r.body[o],"textord").text;if(s==="\\begin"){if(!qC.hasOwnProperty(i))throw new We("No such environment: "+i,r);var a=qC[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},h=a.handler(d,l,c);n.expect("\\end",!1);var f=n.nextToken,m=En(n.parseFunction(),"environment");if(m.name!==i)throw new We("Mismatch: \\begin{"+i+"} matched by \\end{"+m.name+"}",f);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:r}}});var OO=(e,t)=>{var n=e.font,s=t.withFont(n);return us(e.body,s)},BO=(e,t)=>{var n=e.font,s=t.withFont(n);return Is(e.body,s)},HC={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};xt({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=xb(t[0]),i=s;return i in HC&&(i=HC[i]),{type:"font",mode:n.mode,font:i.slice(1),body:r}},htmlBuilder:OO,mathmlBuilder:BO});xt({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"mclass",mode:n.mode,mclass:Gv(s),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:s}],isCharacterBox:vc(s)}}});xt({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,breakOnTokenText:r}=e,{mode:i}=n,o=n.parseExpression(!0,r);return{type:"font",mode:i,font:"math"+s.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:OO,mathmlBuilder:BO});var gre=(e,t)=>{var n=t.style,s=n.fracNum(),r=n.fracDen(),i;i=t.havingStyle(s);var o=us(e.numer,i,t);if(e.continued){var a=8.5/t.fontMetrics().ptPerEm,l=3.5/t.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}i=t.havingStyle(r);var c=us(e.denom,i,t),d,h,f;e.hasBarLine?(e.barSize?(h=nr(e.barSize,t),d=Bf("frac-line",t,h)):d=Bf("frac-line",t),h=d.height,f=d.height):(d=null,h=0,f=t.fontMetrics().defaultRuleThickness);var m,p,y;n.size===fn.DISPLAY.size?(m=t.fontMetrics().num1,h>0?p=3*f:p=7*f,y=t.fontMetrics().denom1):(h>0?(m=t.fontMetrics().num2,p=f):(m=t.fontMetrics().num3,p=3*f),y=t.fontMetrics().denom2);var w;if(d){var v=t.fontMetrics().axisHeight;m-o.depth-(v+.5*h)<p&&(m+=p-(m-o.depth-(v+.5*h))),v-.5*h-(c.height-y)<p&&(y+=p-(v-.5*h-(c.height-y)));var x=-(v-.5*h);w=ls({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:d,shift:x},{type:"elem",elem:o,shift:-m}]})}else{var b=m-o.depth-(c.height-y);b<p&&(m+=.5*(p-b),y+=.5*(p-b)),w=ls({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-m}]})}i=t.havingStyle(n),w.height*=i.sizeMultiplier/t.sizeMultiplier,w.depth*=i.sizeMultiplier/t.sizeMultiplier;var _;n.size===fn.DISPLAY.size?_=t.fontMetrics().delim1:n.size===fn.SCRIPTSCRIPT.size?_=t.havingStyle(fn.SCRIPT).fontMetrics().delim2:_=t.fontMetrics().delim2;var E,k;return e.leftDelim==null?E=hp(t,["mopen"]):E=k3(e.leftDelim,_,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?k=qe([]):e.rightDelim==null?k=hp(t,["mclose"]):k=k3(e.rightDelim,_,!0,t.havingStyle(n),e.mode,["mclose"]),qe(["mord"].concat(i.sizingClasses(t)),[E,qe(["mfrac"],[w]),k],t)},yre=(e,t)=>{var n=new Ke("mfrac",[Is(e.numer,t),Is(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var s=nr(e.barSize,t);n.setAttribute("linethickness",Ze(s))}if(e.leftDelim!=null||e.rightDelim!=null){var r=[];if(e.leftDelim!=null){var i=new Ke("mo",[new Cr(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),r.push(i)}if(r.push(n),e.rightDelim!=null){var o=new Ke("mo",[new Cr(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),r.push(o)}return YS(r)}return n},PO=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};xt({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=t[1],o,a=null,l=null;switch(s){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=s==="\\cfrac",d=null;return c||s.startsWith("\\d")?d="display":s.startsWith("\\t")&&(d="text"),PO({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:gre,mathmlBuilder:yre});xt({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:s}=e,r;switch(n){case"\\over":r="\\frac";break;case"\\choose":r="\\binom";break;case"\\atop":r="\\\\atopfrac";break;case"\\brace":r="\\\\bracefrac";break;case"\\brack":r="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:r,token:s}}});var UC=["display","text","script","scriptscript"],VC=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};xt({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,s=t[4],r=t[5],i=xb(t[0]),o=i.type==="atom"&&i.family==="open"?VC(i.text):null,a=xb(t[1]),l=a.type==="atom"&&a.family==="close"?VC(a.text):null,c=En(t[2],"size"),d,h=null;c.isBlank?d=!0:(h=c.value,d=h.number>0);var f=null,m=t[3];if(m.type==="ordgroup"){if(m.body.length>0){var p=En(m.body[0],"textord");f=UC[Number(p.text)]}}else m=En(m,"textord"),f=UC[Number(m.text)];return PO({type:"genfrac",mode:n.mode,numer:s,denom:r,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,rightDelim:l},f)}});xt({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:s,token:r}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:En(t[0],"size").value,token:r}}});xt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0],i=En(t[1],"infix").size;if(!i)throw new Error("\\\\abovefrac expected size, but got "+String(i));var o=t[2],a=i.number>0;return{type:"genfrac",mode:n.mode,numer:r,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});var $O=(e,t)=>{var n=t.style,s,r;e.type==="supsub"?(s=e.sup?us(e.sup,t.havingStyle(n.sup()),t):us(e.sub,t.havingStyle(n.sub()),t),r=En(e.base,"horizBrace")):r=En(e,"horizBrace");var i=us(r.base,t.havingBaseStyle(fn.DISPLAY)),o=Uv(r,t),a;if(r.isOver?a=ls({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=ls({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),s){var l=qe(["minner",r.isOver?"mover":"munder"],[a],t);r.isOver?a=ls({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:s}]}):a=ls({positionType:"bottom",positionData:l.depth+.2+s.height+s.depth,children:[{type:"elem",elem:s},{type:"kern",size:.2},{type:"elem",elem:l}]})}return qe(["minner",r.isOver?"mover":"munder"],[a],t)},bre=(e,t)=>{var n=Hv(e.label);return new Ke(e.isOver?"mover":"munder",[Is(e.base,t),n])};xt({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:s}=e;return{type:"horizBrace",mode:n.mode,label:s,isOver:s.includes("\\over"),base:t[0]}},htmlBuilder:$O,mathmlBuilder:bre});xt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[1],r=En(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:r})?{type:"href",mode:n.mode,href:r,body:Tr(s)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=Pr(e.body,t,!1);return Ise(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Nu(e.body,t);return n instanceof Ke||(n=new Ke("mrow",[n])),n.setAttribute("href",e.href),n}});xt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=En(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:s}))return n.formatUnsupportedCmd("\\url");for(var r=[],i=0;i<s.length;i++){var o=s[i];o==="~"&&(o="\\textasciitilde"),r.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:r};return{type:"href",mode:n.mode,href:s,body:Tr(a)}}});xt({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(e,t){var{parser:n}=e;return{type:"hbox",mode:n.mode,body:Tr(t[0])}},htmlBuilder(e,t){var n=Pr(e.body,t.withFont(""),!1);return xc(n)},mathmlBuilder(e,t){return new Ke("mrow",Do(e.body,t.withFont("")))}});xt({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s,token:r}=e,i=En(t[0],"raw").string,o=t[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(s){case"\\htmlClass":l.class=i,a={command:"\\htmlClass",class:i};break;case"\\htmlId":l.id=i,a={command:"\\htmlId",id:i};break;case"\\htmlStyle":l.style=i,a={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var c=i.split(","),d=0;d<c.length;d++){var h=c[d],f=h.indexOf("=");if(f<0)throw new We("\\htmlData key/value '"+h+"' missing equals sign");var m=h.slice(0,f),p=h.slice(f+1);l["data-"+m.trim()]=p}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:l,body:Tr(o)}:n.formatUnsupportedCmd(s)},htmlBuilder:(e,t)=>{var n=Pr(e.body,t,!1),s=["enclosing"];e.attributes.class&&s.push(...e.attributes.class.trim().split(/\s+/));var r=qe(s,n,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&r.setAttribute(i,e.attributes[i]);return r},mathmlBuilder:(e,t)=>Nu(e.body,t)});xt({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"htmlmathml",mode:n.mode,html:Tr(t[0]),mathml:Tr(t[1])}},htmlBuilder:(e,t)=>{var n=Pr(e.html,t,!1);return xc(n)},mathmlBuilder:(e,t)=>Nu(e.mathml,t)});var vx=function(t){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(t))return{number:+t,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t);if(!n)throw new We("Invalid size: '"+t+"' in \\includegraphics");var s={number:+(n[1]+n[2]),unit:n[3]};if(!tO(s))throw new We("Invalid unit: '"+s.unit+"' in \\includegraphics.");return s};xt({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:s}=e,r={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var l=En(n[0],"raw").string,c=l.split(","),d=0;d<c.length;d++){var h=c[d].split("=");if(h.length===2){var f=h[1].trim();switch(h[0].trim()){case"alt":a=f;break;case"width":r=vx(f);break;case"height":i=vx(f);break;case"totalheight":o=vx(f);break;default:throw new We("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var m=En(t[0],"url").url;return a===""&&(a=m,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),s.settings.isTrusted({command:"\\includegraphics",url:m})?{type:"includegraphics",mode:s.mode,alt:a,width:r,height:i,totalheight:o,src:m}:s.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=nr(e.height,t),s=0;e.totalheight.number>0&&(s=nr(e.totalheight,t)-n);var r=0;e.width.number>0&&(r=nr(e.width,t));var i={height:Ze(n+s)};r>0&&(i.width=Ze(r)),s>0&&(i.verticalAlign=Ze(-s));var o=new wse(e.src,e.alt,i);return o.height=n,o.depth=s,o},mathmlBuilder:(e,t)=>{var n=new Ke("mglyph",[]);n.setAttribute("alt",e.alt);var s=nr(e.height,t),r=0;if(e.totalheight.number>0&&(r=nr(e.totalheight,t)-s,n.setAttribute("valign",Ze(-r))),n.setAttribute("height",Ze(s+r)),e.width.number>0){var i=nr(e.width,t);n.setAttribute("width",Ze(i))}return n.setAttribute("src",e.src),n}});xt({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e,r=En(t[0],"size");if(n.settings.strict){var i=s[1]==="m",o=r.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" supports only mu units, "+("not "+r.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+s+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:r.value}},htmlBuilder(e,t){return lO(e.dimension,t)},mathmlBuilder(e,t){var n=nr(e.dimension,t);return new mO(n)}});xt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"lap",mode:n.mode,alignment:s.slice(5),body:r}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=qe([],[us(e.body,t)]),n=qe(["inner"],[n],t)):n=qe(["inner"],[us(e.body,t)]);var s=qe(["fix"],[]),r=qe([e.alignment],[n,s],t),i=qe(["strut"]);return i.style.height=Ze(r.height+r.depth),r.depth&&(i.style.verticalAlign=Ze(-r.depth)),r.children.unshift(i),r=qe(["thinbox"],[r],t),qe(["mord","vbox"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Ke("mpadded",[Is(e.body,t)]);if(e.alignment!=="rlap"){var s=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",s+"width")}return n.setAttribute("width","0px"),n}});xt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:s}=e,r=s.mode;s.switchMode("math");var i=n==="\\("?"\\)":"$",o=s.parseExpression(!1,i);return s.expect(i),s.switchMode(r),{type:"styling",mode:s.mode,style:"text",resetFont:!0,body:o}}});xt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new We("Mismatched "+e.funcName)}});var WC=(e,t)=>{switch(t.style.size){case fn.DISPLAY.size:return e.display;case fn.TEXT.size:return e.text;case fn.SCRIPT.size:return e.script;case fn.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};xt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Tr(t[0]),text:Tr(t[1]),script:Tr(t[2]),scriptscript:Tr(t[3])}},htmlBuilder:(e,t)=>{var n=WC(e,t),s=Pr(n,t,!1);return xc(s)},mathmlBuilder:(e,t)=>{var n=WC(e,t);return Nu(n,t)}});var zO=(e,t,n,s,r,i,o)=>{e=qe([],[e]);var a=n&&vc(n),l,c;if(t){var d=us(t,s.havingStyle(r.sup()),s);c={elem:d,kern:Math.max(s.fontMetrics().bigOpSpacing1,s.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=us(n,s.havingStyle(r.sub()),s);l={elem:h,kern:Math.max(s.fontMetrics().bigOpSpacing2,s.fontMetrics().bigOpSpacing4-h.height)}}var f;if(c&&l){var m=s.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+o;f=ls({positionType:"bottom",positionData:m,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ze(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ze(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else if(l){var p=e.height-o;f=ls({positionType:"top",positionData:p,children:[{type:"kern",size:s.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ze(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+o;f=ls({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ze(i)},{type:"kern",size:s.fontMetrics().bigOpSpacing5}]})}else return e;var w=[f];if(l&&i!==0&&!a){var b=qe(["mspace"],[],s);b.style.marginRight=Ze(i),w.unshift(b)}return qe(["mop","op-limits"],w,s)},FO=new Set(["\\smallint"]),um=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=En(e.base,"op"),r=!0):i=En(e,"op");var o=t.style,a=!1;o.size===fn.DISPLAY.size&&i.symbol&&!FO.has(i.name)&&(a=!0);var l,c;if(i.symbol){var d=a?"Size2-Regular":"Size1-Regular",h="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(h=i.name.slice(1),i.name=h==="oiint"?"\\iint":"\\iiint"),l=Li(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,h.length>0){var f=uO(h+"Size"+(a?"2":"1"),t);l=ls({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+h,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var m=Pr(i.body,t,!0);m.length===1&&m[0]instanceof Ro?(l=m[0],l.classes[0]="mop"):l=qe(["mop"],m,t)}else{for(var p=[],y=1;y<i.name.length;y++)p.push(GS(i.name[y],i.mode,t));l=qe(["mop"],p,t)}var w=0,b=0;if((l instanceof Ro||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var v;w=(l.height-l.depth)/2-t.fontMetrics().axisHeight,b=(v=l.italic)!=null?v:0}return r?zO(l,n,s,t,o,b,w):(w&&(l.style.position="relative",l.style.top=Ze(w)),l)},rg=(e,t)=>{var n;if(e.symbol)n=new Ke("mo",[ca(e.name,e.mode)]),FO.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Ke("mo",Do(e.body,t));else{n=new Ke("mi",[new Cr(e.name.slice(1))]);var s=new Ke("mo",[ca("⁡","text")]);e.parentIsSupSub?n=new Ke("mrow",[n,s]):n=fO([n,s])}return n},vre={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};xt({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=s;return r.length===1&&(r=vre[r]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:um,mathmlBuilder:rg});xt({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Tr(s)}},htmlBuilder:um,mathmlBuilder:rg});var wre={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};xt({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:um,mathmlBuilder:rg});xt({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(e){var{parser:t,funcName:n}=e;return{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:um,mathmlBuilder:rg});xt({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,s=n;return s.length===1&&(s=wre[s]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:um,mathmlBuilder:rg});var qO=(e,t)=>{var n,s,r=!1,i;e.type==="supsub"?(n=e.sup,s=e.sub,i=En(e.base,"operatorname"),r=!0):i=En(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(h=>{var f="text"in h?h.text:void 0;return typeof f=="string"?{type:"textord",mode:h.mode,text:f}:h}),l=Pr(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof Ro&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=qe(["mop"],l,t)}else o=qe(["mop"],[],t);return r?zO(o,n,s,t,t.style,0,0):o},xre=(e,t)=>{for(var n=Do(e.body,t.withFont("mathrm")),s=!0,r=0;r<n.length;r++){var i=n[r];if(!(i instanceof mO))if(i instanceof Ke)switch(i.type){case"mi":case"mn":case"mspace":case"mtext":break;case"mo":{var o=i.children[0];i.children.length===1&&o instanceof Cr?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):s=!1;break}default:s=!1}else s=!1}if(s){var a=n.map(d=>d.toText()).join("");n=[new Cr(a)]}var l=new Ke("mi",n);l.setAttribute("mathvariant","normal");var c=new Ke("mo",[ca("⁡","text")]);return e.parentIsSupSub?new Ke("mrow",[l,c]):fO([l,c])};xt({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:s}=e,r=t[0];return{type:"operatorname",mode:n.mode,body:Tr(r),alwaysHandleSupSub:s==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:qO,mathmlBuilder:xre});H("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");lh({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?xc(Pr(e.body,t,!1)):qe(["mord"],Pr(e.body,t,!0),t)},mathmlBuilder(e,t){return Nu(e.body,t,!0)}});xt({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,s=t[0];return{type:"overline",mode:n.mode,body:s}},htmlBuilder(e,t){var n=us(e.body,t.havingCrampedStyle()),s=Bf("overline-line",t),r=t.fontMetrics().defaultRuleThickness,i=ls({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*r},{type:"elem",elem:s},{type:"kern",size:r}]});return qe(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Ke("mo",[new Cr("‾")]);n.setAttribute("stretchy","true");var s=new Ke("mover",[Is(e.body,t),n]);return s.setAttribute("accent","true"),s}});xt({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"phantom",mode:n.mode,body:Tr(s)}},htmlBuilder:(e,t)=>{var n=Pr(e.body,t.withPhantom(),!1);return xc(n)},mathmlBuilder:(e,t)=>{var n=Do(e.body,t);return new Ke("mphantom",n)}});H("\\hphantom","\\smash{\\phantom{#1}}");xt({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,s=t[0];return{type:"vphantom",mode:n.mode,body:s}},htmlBuilder:(e,t)=>{var n=qe(["inner"],[us(e.body,t.withPhantom())]),s=qe(["fix"],[]);return qe(["mord","rlap"],[n,s],t)},mathmlBuilder:(e,t)=>{var n=Do(Tr(e.body),t),s=new Ke("mphantom",n),r=new Ke("mpadded",[s]);return r.setAttribute("width","0px"),r}});xt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,s=En(t[0],"size").value,r=t[1];return{type:"raisebox",mode:n.mode,dy:s,body:r}},htmlBuilder(e,t){var n=us(e.body,t),s=nr(e.dy,t);return ls({positionType:"shift",positionData:-s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ke("mpadded",[Is(e.body,t)]),s=e.dy.number+e.dy.unit;return n.setAttribute("voffset",s),n}});xt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});xt({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:s}=e,r=n[0],i=En(t[0],"size"),o=En(t[1],"size");return{type:"rule",mode:s.mode,shift:r&&En(r,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=qe(["mord","rule"],[],t),s=nr(e.width,t),r=nr(e.height,t),i=e.shift?nr(e.shift,t):0;return n.style.borderRightWidth=Ze(s),n.style.borderTopWidth=Ze(r),n.style.bottom=Ze(i),n.width=s,n.height=r+i,n.depth=-i,n.maxFontSize=r*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=nr(e.width,t),s=nr(e.height,t),r=e.shift?nr(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Ke("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Ze(n)),o.setAttribute("height",Ze(s));var a=new Ke("mpadded",[o]);return r>=0?a.setAttribute("height",Ze(r)):(a.setAttribute("height",Ze(r)),a.setAttribute("depth",Ze(-r))),a.setAttribute("voffset",Ze(r)),a}});function HO(e,t,n){for(var s=Pr(e,t,!1),r=t.sizeMultiplier/n.sizeMultiplier,i=0;i<s.length;i++){var o=s[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(s[i].classes,t.sizingClasses(n)):s[i].classes[o+1]==="reset-size"+t.size&&(s[i].classes[o+1]="reset-size"+n.size),s[i].height*=r,s[i].depth*=r}return xc(s)}var GC=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],_re=(e,t)=>{var n=t.havingSize(e.size);return HO(e.body,n,t)};xt({type:"sizing",names:GC,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!1,n);return{type:"sizing",mode:r.mode,size:GC.indexOf(s)+1,body:i}},htmlBuilder:_re,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),s=Do(e.body,n),r=new Ke("mstyle",s);return r.setAttribute("mathsize",Ze(n.sizeMultiplier)),r}});xt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:s}=e,r=!1,i=!1,o=n[0]&&En(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=Vv(c).text,a==="t")r=!0;else if(a==="b")i=!0;else{r=!1,i=!1;break}}else r=!0,i=!0;var d=t[0];return{type:"smash",mode:s.mode,body:d,smashHeight:r,smashDepth:i}},htmlBuilder:(e,t)=>{var n=qe([],[us(e.body,t)]);if(!e.smashHeight&&!e.smashDepth)return n;if(e.smashHeight&&(n.height=0),e.smashDepth&&(n.depth=0),e.smashHeight&&e.smashDepth)return qe(["mord","smash"],[n],t);if(n.children)for(var s=0;s<n.children.length;s++)e.smashHeight&&(n.children[s].height=0),e.smashDepth&&(n.children[s].depth=0);var r=ls({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return qe(["mord"],[r],t)},mathmlBuilder:(e,t)=>{var n=new Ke("mpadded",[Is(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});xt({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:s}=e,r=n[0],i=t[0];return{type:"sqrt",mode:s.mode,body:i,index:r}},htmlBuilder(e,t){var n=us(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=Pf(n,t);var s=t.fontMetrics(),r=s.defaultRuleThickness,i=r;t.style.id<fn.TEXT.id&&(i=t.fontMetrics().xHeight);var o=r+i/4,a=n.height+n.depth+o+r,{span:l,ruleWidth:c,advanceWidth:d}=lre(a,t),h=l.height-c;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var f=l.height-n.height-o-c;n.style.paddingLeft=Ze(d);var m=ls({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+f)},{type:"elem",elem:l},{type:"kern",size:c}]});if(e.index){var p=t.havingStyle(fn.SCRIPTSCRIPT),y=us(e.index,p,t),w=.6*(m.height-m.depth),b=ls({positionType:"shift",positionData:-w,children:[{type:"elem",elem:y}]}),v=qe(["root"],[b]);return qe(["mord","sqrt"],[v,m],t)}else return qe(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:n,index:s}=e;return s?new Ke("mroot",[Is(n,t),Is(s,t)]):new Ke("msqrt",[Is(n,t)])}});var S3={display:fn.DISPLAY,text:fn.TEXT,script:fn.SCRIPT,scriptscript:fn.SCRIPTSCRIPT};function kre(e){return e in S3}xt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:s,parser:r}=e,i=r.parseExpression(!0,n),o=s.slice(1,s.length-5);if(!kre(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:r.mode,style:o,body:i}},htmlBuilder(e,t){var n=S3[e.style],s=t.havingStyle(n);return e.resetFont&&(s=s.withFont("")),HO(e.body,s,t)},mathmlBuilder(e,t){var n=S3[e.style],s=t.havingStyle(n);e.resetFont&&(s=s.withFont(""));var r=Do(e.body,s),i=new Ke("mstyle",r),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[e.style];return i.setAttribute("scriptlevel",a[0]),i.setAttribute("displaystyle",a[1]),i}});var Sre=function(t,n){var s=t.base;if(s)if(s.type==="op"){var r=s.limits&&(n.style.size===fn.DISPLAY.size||s.alwaysHandleSupSub);return r?um:null}else if(s.type==="operatorname"){var i=s.alwaysHandleSupSub&&(n.style.size===fn.DISPLAY.size||s.limits);return i?qO:null}else{if(s.type==="accent")return vc(s.base)?XS:null;if(s.type==="horizBrace"){var o=!t.sub;return o===s.isOver?$O:null}else return null}else return null};lh({type:"supsub",htmlBuilder(e,t){var n=Sre(e,t);if(n)return n(e,t);var{base:s,sup:r,sub:i}=e,o=us(s,t),a,l,c=t.fontMetrics(),d=0,h=0,f=s&&vc(s);if(r){var m=t.havingStyle(t.style.sup());a=us(r,m,t),f||(d=o.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(i){var p=t.havingStyle(t.style.sub());l=us(i,p,t),f||(h=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/t.sizeMultiplier)}var y;t.style===fn.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var w=t.sizeMultiplier,b=Ze(.5/c.ptPerEm/w),v=null;if(l){var x=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof Ro||x){var _;v=Ze(-((_=o.italic)!=null?_:0))}}var E;if(a&&l){d=Math.max(d,y,a.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var k=c.defaultRuleThickness,M=4*k;if(d-a.depth-(l.height-h)<M){h=M-(d-a.depth)+l.height;var R=.8*c.xHeight-(d-a.depth);R>0&&(d+=R,h-=R)}var L=[{type:"elem",elem:l,shift:h,marginRight:b,marginLeft:v},{type:"elem",elem:a,shift:-d,marginRight:b}];E=ls({positionType:"individualShift",children:L})}else if(l){h=Math.max(h,c.sub1,l.height-.8*c.xHeight);var T=[{type:"elem",elem:l,marginLeft:v,marginRight:b}];E=ls({positionType:"shift",positionData:h,children:T})}else if(a)d=Math.max(d,y,a.depth+.25*c.xHeight),E=ls({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:b}]});else throw new Error("supsub must have either sup or sub.");var N=v3(o,"right")||"mord";return qe([N],[o,qe(["msupsub"],[E])],t)},mathmlBuilder(e,t){var n=!1,s,r;e.base&&e.base.type==="horizBrace"&&(r=!!e.sup,r===e.base.isOver&&(n=!0,s=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[Is(e.base,t)];e.sub&&i.push(Is(e.sub,t)),e.sup&&i.push(Is(e.sup,t));var o;if(n)o=s?"mover":"munder";else if(e.sub)if(e.sup){var c=e.base;c&&c.type==="op"&&c.limits&&t.style===fn.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===fn.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===fn.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===fn.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===fn.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===fn.DISPLAY)?o="mover":o="msup"}return new Ke(o,i)}});lh({type:"atom",htmlBuilder(e,t){return GS(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Ke("mo",[ca(e.text,e.mode)]);if(e.family==="bin"){var s=QS(e,t);s==="bold-italic"&&n.setAttribute("mathvariant",s)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var UO={mi:"italic",mn:"normal",mtext:"normal"};lh({type:"mathord",htmlBuilder(e,t){return qv(e,t,"mathord")},mathmlBuilder(e,t){var n=new Ke("mi",[ca(e.text,e.mode,t)]),s=QS(e,t)||"italic";return s!==UO[n.type]&&n.setAttribute("mathvariant",s),n}});lh({type:"textord",htmlBuilder(e,t){return qv(e,t,"textord")},mathmlBuilder(e,t){var n=ca(e.text,e.mode,t),s=QS(e,t)||"normal",r;return e.mode==="text"?r=new Ke("mtext",[n]):/[0-9]/.test(e.text)?r=new Ke("mn",[n]):e.text==="\\prime"?r=new Ke("mo",[n]):r=new Ke("mi",[n]),s!==UO[r.type]&&r.setAttribute("mathvariant",s),r}});var wx={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},xx={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};lh({type:"spacing",htmlBuilder(e,t){if(xx.hasOwnProperty(e.text)){var n=xx[e.text].className||"";if(e.mode==="text"){var s=qv(e,t,"textord");return s.classes.push(n),s}else return qe(["mspace",n],[GS(e.text,e.mode,t)],t)}else{if(wx.hasOwnProperty(e.text))return qe(["mspace",wx[e.text]],[],t);throw new We('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(xx.hasOwnProperty(e.text))n=new Ke("mtext",[new Cr(" ")]);else{if(wx.hasOwnProperty(e.text))return new Ke("mspace");throw new We('Unknown type of space "'+e.text+'"')}return n}});var KC=()=>{var e=new Ke("mtd",[]);return e.setAttribute("width","50%"),e};lh({type:"tag",mathmlBuilder(e,t){var n=new Ke("mtable",[new Ke("mtr",[KC(),new Ke("mtd",[Nu(e.body,t)]),KC(),new Ke("mtd",[Nu(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var YC={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},QC={"\\textbf":"textbf","\\textmd":"textmd"},Tre={"\\textit":"textit","\\textup":"textup"},XC=(e,t)=>{var n=e.font;if(n){if(YC[n])return t.withTextFontFamily(YC[n]);if(QC[n])return t.withTextFontWeight(QC[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(Tre[n])};xt({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:s}=e,r=t[0];return{type:"text",mode:n.mode,body:Tr(r),font:s}},htmlBuilder(e,t){var n=XC(e,t),s=Pr(e.body,n,!0);return qe(["mord","text"],s,n)},mathmlBuilder(e,t){var n=XC(e,t);return Nu(e.body,n)}});xt({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"underline",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=us(e.body,t),s=Bf("underline-line",t),r=t.fontMetrics().defaultRuleThickness,i=ls({positionType:"top",positionData:n.height,children:[{type:"kern",size:r},{type:"elem",elem:s},{type:"kern",size:3*r},{type:"elem",elem:n}]});return qe(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Ke("mo",[new Cr("‾")]);n.setAttribute("stretchy","true");var s=new Ke("munder",[Is(e.body,t),n]);return s.setAttribute("accentunder","true"),s}});xt({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(e,t){var{parser:n}=e;return{type:"vcenter",mode:n.mode,body:t[0]}},htmlBuilder(e,t){var n=us(e.body,t),s=t.fontMetrics().axisHeight,r=.5*(n.height-s-(n.depth+s));return ls({positionType:"shift",positionData:r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Ke("mpadded",[Is(e.body,t)],["vcenter"]);return new Ke("mrow",[n])}});xt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new We("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=JC(e),s=[],r=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),s.push(Li(o,"Typewriter-Regular",e.mode,r,["mord","texttt"]))}return qe(["mord","text"].concat(r.sizingClasses(t)),aO(s),r)},mathmlBuilder(e,t){var n=new Cr(JC(e)),s=new Ke("mtext",[n]);return s.setAttribute("mathvariant","monospace"),s}});var JC=e=>e.body.replace(/ /g,e.star?"␣":" "),su=dO,VO=`[ \r
	]`,Cre="\\\\[a-zA-Z@]+",Are="\\\\[^\uD800-\uDFFF]",Ere="("+Cre+")"+VO+"*",Mre=`\\\\(
|[ \r	]+
?)[ \r	]*`,T3="[̀-ͯ]",Nre=new RegExp(T3+"+$"),Ire="("+VO+"+)|"+(Mre+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(T3+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(T3+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Ere)+("|"+Are+")");class ZC{constructor(t,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=t,this.settings=n,this.tokenRegex=new RegExp(Ire,"g"),this.catcodes={"%":14,"~":13}}setCatcode(t,n){this.catcodes[t]=n}lex(){var t=this.input,n=this.tokenRegex.lastIndex;if(n===t.length)return new No("EOF",new so(this,n,n));var s=this.tokenRegex.exec(t);if(s===null||s.index!==n)throw new We("Unexpected character: '"+t[n]+"'",new No(t[n],new so(this,n,n+1)));var r=s[6]||s[3]||(s[2]?"\\ ":" ");if(this.catcodes[r]===14){var i=t.indexOf(`
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=t.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=i+1,this.lex()}return new No(r,new so(this,n,this.tokenRegex.lastIndex))}}class jre{constructor(t,n){t===void 0&&(t={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=t,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new We("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var t=this.undefStack.pop();for(var n in t)t.hasOwnProperty(n)&&(t[n]==null?delete this.current[n]:this.current[n]=t[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(t){return this.current.hasOwnProperty(t)||this.builtins.hasOwnProperty(t)}get(t){return this.current.hasOwnProperty(t)?this.current[t]:this.builtins[t]}set(t,n,s){if(s===void 0&&(s=!1),s){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][t];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][t]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(t)&&(i[t]=this.current[t])}n==null?delete this.current[t]:this.current[t]=n}}var Rre=LO;H("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});H("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});H("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});H("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});H("\\@ifnextchar",function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}});H("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");H("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var eA={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};H("\\char",function(e){var t=e.popToken(),n,s=0;if(t.text==="'")n=8,t=e.popToken();else if(t.text==='"')n=16,t=e.popToken();else if(t.text==="`")if(t=e.popToken(),t.text[0]==="\\")s=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new We("\\char` missing argument");s=t.text.charCodeAt(0)}else n=10;if(n){if(s=eA[t.text],s==null||s>=n)throw new We("Invalid base-"+n+" digit "+t.text);for(var r;(r=eA[e.future().text])!=null&&r<n;)s*=n,s+=r,e.popToken()}return"\\@char{"+s+"}"});var t6=(e,t,n,s)=>{var r=e.consumeArg().tokens;if(r.length!==1)throw new We("\\newcommand's first argument must be a macro name");var i=r[0].text,o=e.isDefined(i);if(o&&!t)throw new We("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new We("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(r=e.consumeArg().tokens,r.length===1&&r[0].text==="["){for(var l="",c=e.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new We("Invalid number of arguments: "+l);a=parseInt(l),r=e.consumeArg().tokens}return o&&s||e.macros.set(i,{tokens:r,numArgs:a}),""};H("\\newcommand",e=>t6(e,!1,!0,!1));H("\\renewcommand",e=>t6(e,!0,!1,!1));H("\\providecommand",e=>t6(e,!0,!0,!0));H("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});H("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});H("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),su[n],Ws.math[n],Ws.text[n]),""});H("\\bgroup","{");H("\\egroup","}");H("~","\\nobreakspace");H("\\lq","`");H("\\rq","'");H("\\aa","\\r a");H("\\AA","\\r A");H("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");H("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");H("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");H("ℬ","\\mathscr{B}");H("ℰ","\\mathscr{E}");H("ℱ","\\mathscr{F}");H("ℋ","\\mathscr{H}");H("ℐ","\\mathscr{I}");H("ℒ","\\mathscr{L}");H("ℳ","\\mathscr{M}");H("ℛ","\\mathscr{R}");H("ℭ","\\mathfrak{C}");H("ℌ","\\mathfrak{H}");H("ℨ","\\mathfrak{Z}");H("\\Bbbk","\\Bbb{k}");H("\\llap","\\mathllap{\\textrm{#1}}");H("\\rlap","\\mathrlap{\\textrm{#1}}");H("\\clap","\\mathclap{\\textrm{#1}}");H("\\mathstrut","\\vphantom{(}");H("\\underbar","\\underline{\\text{#1}}");H("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');H("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");H("\\ne","\\neq");H("≠","\\neq");H("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");H("∉","\\notin");H("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");H("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");H("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");H("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");H("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");H("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");H("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");H("⟂","\\perp");H("‼","\\mathclose{!\\mkern-0.8mu!}");H("∌","\\notni");H("⌜","\\ulcorner");H("⌝","\\urcorner");H("⌞","\\llcorner");H("⌟","\\lrcorner");H("©","\\copyright");H("®","\\textregistered");H("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');H("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');H("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');H("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');H("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");H("⋮","\\vdots");H("\\varGamma","\\mathit{\\Gamma}");H("\\varDelta","\\mathit{\\Delta}");H("\\varTheta","\\mathit{\\Theta}");H("\\varLambda","\\mathit{\\Lambda}");H("\\varXi","\\mathit{\\Xi}");H("\\varPi","\\mathit{\\Pi}");H("\\varSigma","\\mathit{\\Sigma}");H("\\varUpsilon","\\mathit{\\Upsilon}");H("\\varPhi","\\mathit{\\Phi}");H("\\varPsi","\\mathit{\\Psi}");H("\\varOmega","\\mathit{\\Omega}");H("\\substack","\\begin{subarray}{c}#1\\end{subarray}");H("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");H("\\boxed","\\fbox{$\\displaystyle{#1}$}");H("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");H("\\implies","\\DOTSB\\;\\Longrightarrow\\;");H("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");H("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");H("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var tA={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Lre=new Set(["bin","rel"]);H("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in tA?t=tA[n]:(n.slice(0,4)==="\\not"||n in Ws.math&&Lre.has(Ws.math[n].group))&&(t="\\dotsb"),t});var n6={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};H("\\dotso",function(e){var t=e.future().text;return t in n6?"\\ldots\\,":"\\ldots"});H("\\dotsc",function(e){var t=e.future().text;return t in n6&&t!==","?"\\ldots\\,":"\\ldots"});H("\\cdots",function(e){var t=e.future().text;return t in n6?"\\@cdots\\,":"\\@cdots"});H("\\dotsb","\\cdots");H("\\dotsm","\\cdots");H("\\dotsi","\\!\\cdots");H("\\dotsx","\\ldots\\,");H("\\DOTSI","\\relax");H("\\DOTSB","\\relax");H("\\DOTSX","\\relax");H("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");H("\\,","\\tmspace+{3mu}{.1667em}");H("\\thinspace","\\,");H("\\>","\\mskip{4mu}");H("\\:","\\tmspace+{4mu}{.2222em}");H("\\medspace","\\:");H("\\;","\\tmspace+{5mu}{.2777em}");H("\\thickspace","\\;");H("\\!","\\tmspace-{3mu}{.1667em}");H("\\negthinspace","\\!");H("\\negmedspace","\\tmspace-{4mu}{.2222em}");H("\\negthickspace","\\tmspace-{5mu}{.277em}");H("\\enspace","\\kern.5em ");H("\\enskip","\\hskip.5em\\relax");H("\\quad","\\hskip1em\\relax");H("\\qquad","\\hskip2em\\relax");H("\\tag","\\@ifstar\\tag@literal\\tag@paren");H("\\tag@paren","\\tag@literal{({#1})}");H("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new We("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});H("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");H("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");H("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");H("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");H("\\newline","\\\\\\relax");H("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var WO=Ze(ll["Main-Regular"][84][1]-.7*ll["Main-Regular"][65][1]);H("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+WO+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");H("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+WO+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");H("\\hspace","\\@ifstar\\@hspacer\\@hspace");H("\\@hspace","\\hskip #1\\relax");H("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");H("\\ordinarycolon",":");H("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");H("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');H("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');H("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');H("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');H("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');H("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');H("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');H("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');H("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');H("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');H("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');H("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');H("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');H("∷","\\dblcolon");H("∹","\\eqcolon");H("≔","\\coloneqq");H("≕","\\eqqcolon");H("⩴","\\Coloneqq");H("\\ratio","\\vcentcolon");H("\\coloncolon","\\dblcolon");H("\\colonequals","\\coloneqq");H("\\coloncolonequals","\\Coloneqq");H("\\equalscolon","\\eqqcolon");H("\\equalscoloncolon","\\Eqqcolon");H("\\colonminus","\\coloneq");H("\\coloncolonminus","\\Coloneq");H("\\minuscolon","\\eqcolon");H("\\minuscoloncolon","\\Eqcolon");H("\\coloncolonapprox","\\Colonapprox");H("\\coloncolonsim","\\Colonsim");H("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");H("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");H("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");H("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");H("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");H("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");H("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");H("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");H("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");H("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");H("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");H("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");H("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");H("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");H("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");H("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");H("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");H("\\nleqq","\\html@mathml{\\@nleqq}{≰}");H("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");H("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");H("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");H("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");H("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");H("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");H("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");H("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");H("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");H("\\imath","\\html@mathml{\\@imath}{ı}");H("\\jmath","\\html@mathml{\\@jmath}{ȷ}");H("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");H("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");H("⟦","\\llbracket");H("⟧","\\rrbracket");H("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");H("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");H("⦃","\\lBrace");H("⦄","\\rBrace");H("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");H("⦵","\\minuso");H("\\darr","\\downarrow");H("\\dArr","\\Downarrow");H("\\Darr","\\Downarrow");H("\\lang","\\langle");H("\\rang","\\rangle");H("\\uarr","\\uparrow");H("\\uArr","\\Uparrow");H("\\Uarr","\\Uparrow");H("\\N","\\mathbb{N}");H("\\R","\\mathbb{R}");H("\\Z","\\mathbb{Z}");H("\\alef","\\aleph");H("\\alefsym","\\aleph");H("\\Alpha","\\mathrm{A}");H("\\Beta","\\mathrm{B}");H("\\bull","\\bullet");H("\\Chi","\\mathrm{X}");H("\\clubs","\\clubsuit");H("\\cnums","\\mathbb{C}");H("\\Complex","\\mathbb{C}");H("\\Dagger","\\ddagger");H("\\diamonds","\\diamondsuit");H("\\empty","\\emptyset");H("\\Epsilon","\\mathrm{E}");H("\\Eta","\\mathrm{H}");H("\\exist","\\exists");H("\\harr","\\leftrightarrow");H("\\hArr","\\Leftrightarrow");H("\\Harr","\\Leftrightarrow");H("\\hearts","\\heartsuit");H("\\image","\\Im");H("\\infin","\\infty");H("\\Iota","\\mathrm{I}");H("\\isin","\\in");H("\\Kappa","\\mathrm{K}");H("\\larr","\\leftarrow");H("\\lArr","\\Leftarrow");H("\\Larr","\\Leftarrow");H("\\lrarr","\\leftrightarrow");H("\\lrArr","\\Leftrightarrow");H("\\Lrarr","\\Leftrightarrow");H("\\Mu","\\mathrm{M}");H("\\natnums","\\mathbb{N}");H("\\Nu","\\mathrm{N}");H("\\Omicron","\\mathrm{O}");H("\\plusmn","\\pm");H("\\rarr","\\rightarrow");H("\\rArr","\\Rightarrow");H("\\Rarr","\\Rightarrow");H("\\real","\\Re");H("\\reals","\\mathbb{R}");H("\\Reals","\\mathbb{R}");H("\\Rho","\\mathrm{P}");H("\\sdot","\\cdot");H("\\sect","\\S");H("\\spades","\\spadesuit");H("\\sub","\\subset");H("\\sube","\\subseteq");H("\\supe","\\supseteq");H("\\Tau","\\mathrm{T}");H("\\thetasym","\\vartheta");H("\\weierp","\\wp");H("\\Zeta","\\mathrm{Z}");H("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");H("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");H("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");H("\\bra","\\mathinner{\\langle{#1}|}");H("\\ket","\\mathinner{|{#1}\\rangle}");H("\\braket","\\mathinner{\\langle{#1}\\rangle}");H("\\Bra","\\left\\langle#1\\right|");H("\\Ket","\\left|#1\\right\\rangle");var GO=e=>t=>{var n=t.consumeArg().tokens,s=t.consumeArg().tokens,r=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=h=>f=>{e&&(f.macros.set("|",o),r.length&&f.macros.set("\\|",a));var m=h;if(!h&&r.length){var p=f.future();p.text==="|"&&(f.popToken(),m=!0)}return{tokens:m?r:s,numArgs:0}};t.macros.set("|",l(!1)),r.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,d=t.expandTokens([...i,...c,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};H("\\bra@ket",GO(!1));H("\\bra@set",GO(!0));H("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");H("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");H("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");H("\\angln","{\\angl n}");H("\\blue","\\textcolor{##6495ed}{#1}");H("\\orange","\\textcolor{##ffa500}{#1}");H("\\pink","\\textcolor{##ff00af}{#1}");H("\\red","\\textcolor{##df0030}{#1}");H("\\green","\\textcolor{##28ae7b}{#1}");H("\\gray","\\textcolor{gray}{#1}");H("\\purple","\\textcolor{##9d38bd}{#1}");H("\\blueA","\\textcolor{##ccfaff}{#1}");H("\\blueB","\\textcolor{##80f6ff}{#1}");H("\\blueC","\\textcolor{##63d9ea}{#1}");H("\\blueD","\\textcolor{##11accd}{#1}");H("\\blueE","\\textcolor{##0c7f99}{#1}");H("\\tealA","\\textcolor{##94fff5}{#1}");H("\\tealB","\\textcolor{##26edd5}{#1}");H("\\tealC","\\textcolor{##01d1c1}{#1}");H("\\tealD","\\textcolor{##01a995}{#1}");H("\\tealE","\\textcolor{##208170}{#1}");H("\\greenA","\\textcolor{##b6ffb0}{#1}");H("\\greenB","\\textcolor{##8af281}{#1}");H("\\greenC","\\textcolor{##74cf70}{#1}");H("\\greenD","\\textcolor{##1fab54}{#1}");H("\\greenE","\\textcolor{##0d923f}{#1}");H("\\goldA","\\textcolor{##ffd0a9}{#1}");H("\\goldB","\\textcolor{##ffbb71}{#1}");H("\\goldC","\\textcolor{##ff9c39}{#1}");H("\\goldD","\\textcolor{##e07d10}{#1}");H("\\goldE","\\textcolor{##a75a05}{#1}");H("\\redA","\\textcolor{##fca9a9}{#1}");H("\\redB","\\textcolor{##ff8482}{#1}");H("\\redC","\\textcolor{##f9685d}{#1}");H("\\redD","\\textcolor{##e84d39}{#1}");H("\\redE","\\textcolor{##bc2612}{#1}");H("\\maroonA","\\textcolor{##ffbde0}{#1}");H("\\maroonB","\\textcolor{##ff92c6}{#1}");H("\\maroonC","\\textcolor{##ed5fa6}{#1}");H("\\maroonD","\\textcolor{##ca337c}{#1}");H("\\maroonE","\\textcolor{##9e034e}{#1}");H("\\purpleA","\\textcolor{##ddd7ff}{#1}");H("\\purpleB","\\textcolor{##c6b9fc}{#1}");H("\\purpleC","\\textcolor{##aa87ff}{#1}");H("\\purpleD","\\textcolor{##7854ab}{#1}");H("\\purpleE","\\textcolor{##543b78}{#1}");H("\\mintA","\\textcolor{##f5f9e8}{#1}");H("\\mintB","\\textcolor{##edf2df}{#1}");H("\\mintC","\\textcolor{##e0e5cc}{#1}");H("\\grayA","\\textcolor{##f6f7f7}{#1}");H("\\grayB","\\textcolor{##f0f1f2}{#1}");H("\\grayC","\\textcolor{##e3e5e6}{#1}");H("\\grayD","\\textcolor{##d6d8da}{#1}");H("\\grayE","\\textcolor{##babec2}{#1}");H("\\grayF","\\textcolor{##888d93}{#1}");H("\\grayG","\\textcolor{##626569}{#1}");H("\\grayH","\\textcolor{##3b3e40}{#1}");H("\\grayI","\\textcolor{##21242c}{#1}");H("\\kaBlue","\\textcolor{##314453}{#1}");H("\\kaGreen","\\textcolor{##71B307}{#1}");var KO={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Dre{constructor(t,n,s){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(t),this.macros=new jre(Rre,n.macros),this.mode=s,this.stack=[]}feed(t){this.lexer=new ZC(t,this.settings)}switchMode(t){this.mode=t}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(t){this.stack.push(t)}pushTokens(t){this.stack.push(...t)}scanArgument(t){var n,s,r;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:r,end:s}=this.consumeArg(["]"])}else({tokens:r,start:n,end:s}=this.consumeArg());return this.pushToken(new No("EOF",s.loc)),this.pushTokens(r),new No("",so.range(n,s))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],s=t&&t.length>0;s||this.consumeSpaces();var r=this.future(),i,o=0,a=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++o;else if(i.text==="}"){if(--o,o===-1)throw new We("Extra }",i)}else if(i.text==="EOF")throw new We("Unexpected end of input in a macro argument, expected '"+(t&&s?t[a]:"}")+"'",i);if(t&&s)if((o===0||o===1&&t[a]==="{")&&i.text===t[a]){if(++a,a===t.length){n.splice(-a,a);break}}else a=0}while(o!==0||s);return r.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:r,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new We("The length of delimiters doesn't match the number of args!");for(var s=n[0],r=0;r<s.length;r++){var i=this.popToken();if(s[r]!==i.text)throw new We("Use of the macro doesn't match its definition",i)}}for(var o=[],a=0;a<t;a++)o.push(this.consumeArg(n&&n[a+1]).tokens);return o}countExpansion(t){if(this.expansionCount+=t,this.expansionCount>this.settings.maxExpand)throw new We("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),s=n.text,r=n.noexpand?null:this._getExpansion(s);if(r==null||t&&r.unexpandable){if(t&&r==null&&s[0]==="\\"&&!this.isDefined(s))throw new We("Undefined control sequence: "+s);return this.pushToken(n),!1}this.countExpansion(1);var i=r.tokens,o=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(var a=i.length-1;a>=0;--a){var l=i[a];if(l.text==="#"){if(a===0)throw new We("Incomplete placeholder at end of macro body",l);if(l=i[--a],l.text==="#")i.splice(a+1,1);else if(/^[1-9]$/.test(l.text))i.splice(a,2,...o[+l.text-1]);else throw new We("Not a valid argument number",l)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var t=this.stack.pop();return t.treatAsRelax&&(t.text="\\relax"),t}}expandMacro(t){return this.macros.has(t)?this.expandTokens([new No(t)]):void 0}expandTokens(t){var n=[],s=this.stack.length;for(this.pushTokens(t);this.stack.length>s;)if(this.expandOnce(!0)===!1){var r=this.stack.pop();r.treatAsRelax&&(r.noexpand=!1,r.treatAsRelax=!1),n.push(r)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(s=>s.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var s=this.lexer.catcodes[t];if(s!=null&&s!==13)return}var r=typeof n=="function"?n(this):n;if(typeof r=="string"){var i=0;if(r.includes("#"))for(var o=r.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new ZC(r,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var d={tokens:l,numArgs:i};return d}return r}isDefined(t){return this.macros.has(t)||su.hasOwnProperty(t)||Ws.math.hasOwnProperty(t)||Ws.text.hasOwnProperty(t)||KO.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:su.hasOwnProperty(t)&&!su[t].primitive}}var nA=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,a1=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),_x={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},sA={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};let YO=class QO{constructor(t,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Dre(t,n,this.mode),this.settings=n,this.leftrightDepth=0,this.nextToken=null}expect(t,n){if(n===void 0&&(n=!0),this.fetch().text!==t)throw new We("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(t){this.mode=t,this.gullet.switchMode(t)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var t=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),t}finally{this.gullet.endGroups()}}subparse(t){var n=this.nextToken;this.consume(),this.gullet.pushToken(new No("}")),this.gullet.pushTokens(t);var s=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,s}parseExpression(t,n){for(var s=[];;){this.mode==="math"&&this.consumeSpaces();var r=this.fetch();if(QO.endOfExpression.has(r.text)||n&&r.text===n||t&&su[r.text]&&su[r.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;s.push(i)}return this.mode==="text"&&this.formLigatures(s),this.handleInfixNodes(s)}handleInfixNodes(t){for(var n=-1,s,r=0;r<t.length;r++){var i=t[r];if(i.type==="infix"){if(n!==-1)throw new We("only one infix operator per group",i.token);n=r,s=i.replaceWith}}if(n!==-1&&s){var o,a,l=t.slice(0,n),c=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},c.length===1&&c[0].type==="ordgroup"?a=c[0]:a={type:"ordgroup",mode:this.mode,body:c};var d;return s==="\\\\abovefrac"?d=this.callFunction(s,[o,t[n],a],[]):d=this.callFunction(s,[o,a],[]),[d]}else return t}handleSupSubscript(t){var n=this.fetch(),s=n.text;this.consume(),this.consumeSpaces();var r;do{var i;r=this.parseGroup(t)}while(((i=r)==null?void 0:i.type)==="internal");if(!r)throw new We("Expected group after '"+s+"'",n);return r}formatUnsupportedCmd(t){for(var n=[],s=0;s<t.length;s++)n.push({type:"textord",mode:"text",text:t[s]});var r={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[r]};return i}parseAtom(t){var n=this.parseGroup("atom",t);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var s,r;;){this.consumeSpaces();var i=this.fetch();if(i.text==="\\limits"||i.text==="\\nolimits"){if(n&&n.type==="op"){var o=i.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=i.text==="\\limits");else throw new We("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(s)throw new We("Double superscript",i);s=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(r)throw new We("Double subscript",i);r=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(s)throw new We("Double superscript",i);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),s={type:"ordgroup",mode:this.mode,body:l}}else if(a1[i.text]){var c=nA.test(i.text),d=[];for(d.push(new No(a1[i.text])),this.consume();;){var h=this.fetch().text;if(!a1[h]||nA.test(h)!==c)break;d.unshift(new No(a1[h])),this.consume()}var f=this.subparse(d);c?r={type:"ordgroup",mode:"math",body:f}:s={type:"ordgroup",mode:"math",body:f}}else break}return s||r?{type:"supsub",mode:this.mode,base:n,sup:s,sub:r}:n}parseFunction(t,n){var s=this.fetch(),r=s.text,i=su[r];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new We("Got function '"+r+"' with no arguments"+(n?" as "+n:""),s);if(this.mode==="text"&&!i.allowedInText)throw new We("Can't use function '"+r+"' in text mode",s);if(this.mode==="math"&&i.allowedInMath===!1)throw new We("Can't use function '"+r+"' in math mode",s);var{args:o,optArgs:a}=this.parseArguments(r,i);return this.callFunction(r,o,a,s,t)}callFunction(t,n,s,r,i){var o={funcName:t,parser:this,token:r,breakOnTokenText:i},a=su[t];if(a&&a.handler)return a.handler(o,n,s);throw new We("No function handler for "+t)}parseArguments(t,n){var s=n.numArgs+n.numOptionalArgs;if(s===0)return{args:[],optArgs:[]};for(var r=[],i=[],o=0;o<s;o++){var a=n.argTypes&&n.argTypes[o],l=o<n.numOptionalArgs;("primitive"in n&&n.primitive&&a==null||n.type==="sqrt"&&o===1&&i[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+t+"'",a,l);if(l)i.push(c);else if(c!=null)r.push(c);else throw new We("Null argument, please report this as a bug")}return{args:r,optArgs:i}}parseGroupOfType(t,n,s){switch(n){case"color":return this.parseColorGroup(s);case"size":return this.parseSizeGroup(s);case"url":return this.parseUrlGroup(s);case"math":case"text":return this.parseArgumentGroup(s,n);case"hbox":{var r=this.parseArgumentGroup(s,"text");return r!=null?{type:"styling",mode:r.mode,body:[r],style:"text",resetFont:!0}:null}case"raw":{var i=this.parseStringGroup("raw",s);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(s)throw new We("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new We("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(s);default:throw new We("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var s=this.gullet.scanArgument(n);if(s==null)return null;for(var r="",i;(i=this.fetch()).text!=="EOF";)r+=i.text,this.consume();return this.consume(),s.text=r,s}parseRegexGroup(t,n){for(var s=this.fetch(),r=s,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)r=o,i+=r.text,this.consume();if(i==="")throw new We("Invalid "+n+": '"+s.text+"'",s);return s.range(r,i)}parseColorGroup(t){var n=this.parseStringGroup("color",t);if(n==null)return null;var s=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!s)throw new We("Invalid color: '"+n.text+"'",n);var r=s[0];return/^[0-9a-f]{6}$/i.test(r)&&(r="#"+r),{type:"color-token",mode:this.mode,color:r}}parseSizeGroup(t){var n,s=!1;if(this.gullet.consumeSpaces(),!t&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",t),!n)return null;!t&&n.text.length===0&&(n.text="0pt",s=!0);var r=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!r)throw new We("Invalid size: '"+n.text+"'",n);var i={number:+(r[1]+r[2]),unit:r[3]};if(!tO(i))throw new We("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:s}}parseUrlGroup(t){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",t);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var s=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:s}}parseArgumentGroup(t,n){var s=this.gullet.scanArgument(t);if(s==null)return null;var r=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var i=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:s.loc,body:i};return n&&this.switchMode(r),o}parseGroup(t,n){var s=this.fetch(),r=s.text,i;if(r==="{"||r==="\\begingroup"){this.consume();var o=r==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),i={type:"ordgroup",mode:this.mode,loc:so.range(s,l),body:a,semisimple:r==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&r[0]==="\\"&&!KO.hasOwnProperty(r)){if(this.settings.throwOnError)throw new We("Undefined control sequence: "+r,s);i=this.formatUnsupportedCmd(r),this.consume()}return i}formLigatures(t){for(var n=t.length-1,s=0;s<n;++s){var r=t[s];if(r.type==="textord"){var i=r.text,o=t[s+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=t[s+2];s+1<n&&a&&a.type==="textord"&&a.text==="-"?(t.splice(s,3,{type:"textord",mode:"text",loc:so.range(r,a),text:"---"}),n-=2):(t.splice(s,2,{type:"textord",mode:"text",loc:so.range(r,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(s,2,{type:"textord",mode:"text",loc:so.range(r,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var s=n.slice(5),r=s.charAt(0)==="*";if(r&&(s=s.slice(1)),s.length<2||s.charAt(0)!==s.slice(-1))throw new We(`\\verb assertion failed --
                    please report what input caused this bug`);return s=s.slice(1,-1),{type:"verb",mode:"text",body:s,star:r}}sA.hasOwnProperty(n[0])&&!Ws[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',t),n=sA[n[0]]+n.slice(1));var i=Nre.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Ws[this.mode][n]){this.settings.strict&&this.mode==="math"&&d3.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=Ws[this.mode][n].group,l=so.range(t),c;Xse(a)?c={type:"atom",mode:this.mode,family:a,loc:l,text:n}:c={type:a,mode:this.mode,loc:l,text:n},o=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(eO(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),t)),o={type:"textord",mode:"text",loc:so.range(t),text:n};else return null;if(this.consume(),i)for(var d=0;d<i[0].length;d++){var h=i[0][d];if(!_x[h])throw new We("Unknown accent ' "+h+"'",t);var f=_x[h][this.mode]||_x[h].text;if(!f)throw new We("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:so.range(t),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}};YO.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var s6=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var s=new YO(t,n);delete s.gullet.macros.current["\\df@tag"];var r=s.parse();if(delete s.gullet.macros.current["\\current@color"],delete s.gullet.macros.current["\\color"],s.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new We("\\tag works only in display equations");r=[{type:"tag",mode:"text",body:r,tag:s.subparse([new No("\\df@tag")])}]}return r},r6=function(t,n,s){n.textContent="";var r=Jv(t,s).toNode();n.appendChild(r)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),r6=function(){throw new We("KaTeX doesn't work in quirks mode.")});var XO=function(t,n){var s=Jv(t,n).toMarkup();return s},JO=function(t,n){var s=new HS(n);return s6(t,s)},ZO=function(t,n,s){if(s.throwOnError||!(t instanceof We))throw t;var r=qe(["katex-error"],[new Ro(n)]);return r.setAttribute("title",t.toString()),r.setAttribute("style","color:"+s.errorColor),r},Jv=function(t,n){var s=new HS(n);try{var r=s6(t,s);return Hse(r,t,s)}catch(i){return ZO(i,t,s)}},eB=function(t,n){var s=new HS(n);try{var r=s6(t,s);return Use(r,t,s)}catch(i){return ZO(i,t,s)}},tB="0.16.47",nB={Span:lm,Anchor:zv,SymbolNode:Ro,SvgNode:pc,PathNode:Eu,LineNode:u3},C3={version:tB,render:r6,renderToString:XO,ParseError:We,SETTINGS_SCHEMA:gb,__parse:JO,__renderToDomTree:Jv,__renderToHTMLTree:eB,__setFontMetrics:iO,__defineSymbol:S,__defineFunction:xt,__defineMacro:H,__domTree:nB};const I$e=Object.freeze(Object.defineProperty({__proto__:null,ParseError:We,SETTINGS_SCHEMA:gb,__defineFunction:xt,__defineMacro:H,__defineSymbol:S,__domTree:nB,__parse:JO,__renderToDomTree:Jv,__renderToHTMLTree:eB,__setFontMetrics:iO,default:C3,get render(){return r6},renderToString:XO,version:tB},Symbol.toStringTag,{value:"Module"})),Ore={};function rA(e){const t=this,n=e||Ore,s=t.data(),r=s.micromarkExtensions||(s.micromarkExtensions=[]),i=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),o=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);r.push(Une(n)),i.push(One()),o.push(Bne(n))}const iA=/[#.]/g;function Bre(e,t){const n=e||"",s={};let r=0,i,o;for(;r<n.length;){iA.lastIndex=r;const a=iA.exec(n),l=n.slice(r,a?a.index:n.length);l&&(i?i==="#"?s.id=l:Array.isArray(s.className)?s.className.push(l):s.className=[l]:o=l,r+=l.length),a&&(i=a[0],r++)}return{type:"element",tagName:o||t||"div",properties:s,children:[]}}function sB(e,t,n){const s=n?Fre(n):void 0;function r(i,o,...a){let l;if(i==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=Bre(i,t);const c=l.tagName.toLowerCase(),d=s?s.get(c):void 0;if(l.tagName=d||c,Pre(o))a.unshift(o);else for(const[h,f]of Object.entries(o))$re(e,l.properties,h,f)}for(const c of a)A3(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return r}function Pre(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const s of n){const r=t[s];if(r&&typeof r=="object"){if(!Array.isArray(r))return!0;const i=r;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function $re(e,t,n,s){const r=kS(e,n);let i;if(s!=null){if(typeof s=="number"){if(Number.isNaN(s))return;i=s}else typeof s=="boolean"?i=s:typeof s=="string"?r.spaceSeparated?i=CT(s):r.commaSeparated?i=xT(s):r.commaOrSpaceSeparated?i=CT(xT(s).join(" ")):i=oA(r,r.property,s):Array.isArray(s)?i=[...s]:i=r.property==="style"?zre(s):String(s);if(Array.isArray(i)){const o=[];for(const a of i)o.push(oA(r,r.property,a));i=o}r.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[r.property]=i}}function A3(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)A3(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?A3(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function oA(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||lp(n)===lp(t)))return!0}return n}function zre(e){const t=[];for(const[n,s]of Object.entries(e))t.push([n,s].join(": "));return t.join("; ")}function Fre(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const qre=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Hre=sB(SS,"div"),Ure=sB(im,"g",qre),kx={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Vre(e,t){return rB(e,{})||{type:"root",children:[]}}function rB(e,t){const n=Wre(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function Wre(e,t){switch(e.nodeType){case 1:return Qre(e,t);case 3:return Kre(e);case 8:return Yre(e);case 9:return aA(e,t);case 10:return Gre();case 11:return aA(e,t);default:return}}function aA(e,t){return{type:"root",children:iB(e,t)}}function Gre(){return{type:"doctype"}}function Kre(e){return{type:"text",value:e.nodeValue||""}}function Yre(e){return{type:"comment",value:e.nodeValue||""}}function Qre(e,t){const n=e.namespaceURI,s=n===kx.svg?Ure:Hre,r=n===kx.html?e.tagName.toLowerCase():e.tagName,i=n===kx.html&&r==="template"?e.content:e,o=e.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=e.getAttribute(o[l])||"";return s(r,a,iB(i,t))}function iB(e,t){const n=e.childNodes,s=[];let r=-1;for(;++r<n.length;){const i=rB(n[r],t);i!==void 0&&s.push(i)}return s}new DOMParser;function Xre(e,t){const n=Jre(e);return Vre(n)}function Jre(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const lA=function(e,t,n){const s=tg(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++t<e.children.length;)if(s(e.children[t],t,e))return e.children[t]},ch=function(e){if(e==null)return tie;if(typeof e=="string")return eie(e);if(typeof e=="object")return Zre(e);if(typeof e=="function")return i6(e);throw new Error("Expected function, string, or array as `test`")};function Zre(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=ch(e[n]);return i6(s);function s(...r){let i=-1;for(;++i<t.length;)if(t[i].apply(this,r))return!0;return!1}}function eie(e){return i6(t);function t(n){return n.tagName===e}}function i6(e){return t;function t(n,s,r){return!!(nie(n)&&e.call(this,n,typeof s=="number"?s:void 0,r||void 0))}}function tie(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function nie(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const cA=/\n/g,uA=/[\t ]+/g,E3=ch("br"),dA=ch(uie),sie=ch("p"),hA=ch("tr"),rie=ch(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",cie,die]),oB=ch(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function iie(e,t){const n=t||{},s="children"in e?e.children:[],r=oB(e),i=cB(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...lB(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<s.length;)o.push(...aB(s[a],e,{whitespace:i,breakBefore:a?void 0:r,breakAfter:a<s.length-1?E3(s[a+1]):r}));const l=[];let c;for(a=-1;++a<o.length;){const d=o[a];typeof d=="number"?c!==void 0&&d>c&&(c=d):d&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(d))}return l.join("")}function aB(e,t,n){return e.type==="element"?oie(e,t,n):e.type==="text"?n.whitespace==="normal"?lB(e,n):aie(e):[]}function oie(e,t,n){const s=cB(e,n),r=e.children||[];let i=-1,o=[];if(rie(e))return o;let a,l;for(E3(e)||hA(e)&&lA(t,e,hA)?l=`
`:sie(e)?(a=2,l=2):oB(e)&&(a=1,l=1);++i<r.length;)o=o.concat(aB(r[i],e,{whitespace:s,breakBefore:i?void 0:a,breakAfter:i<r.length-1?E3(r[i+1]):l}));return dA(e)&&lA(t,e,dA)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function lB(e,t){const n=String(e.value),s=[],r=[];let i=0;for(;i<=n.length;){cA.lastIndex=i;const l=cA.exec(n),c=l&&"index"in l?l.index:n.length;s.push(lie(n.slice(i,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,c===n.length?t.breakAfter:!0)),i=c+1}let o=-1,a;for(;++o<s.length;)s[o].charCodeAt(s[o].length-1)===8203||o<s.length-1&&s[o+1].charCodeAt(0)===8203?(r.push(s[o]),a=void 0):s[o]?(typeof a=="number"&&r.push(a),r.push(s[o]),a=0):(o===0||o===s.length-1)&&r.push(0);return r}function aie(e){return[String(e.value)]}function lie(e,t,n){const s=[];let r=0,i;for(;r<e.length;){uA.lastIndex=r;const o=uA.exec(e);i=o?o.index:e.length,!r&&!i&&o&&!t&&s.push(""),r!==i&&s.push(e.slice(r,i)),r=o?i+o[0].length:i}return r!==i&&!n&&s.push(""),s.join(" ")}function cB(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function cie(e){return!!(e.properties||{}).hidden}function uie(e){return e.tagName==="td"||e.tagName==="th"}function die(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const hie={},fie=[];function fA(e){const t=e||hie;return function(n,s){BS(n,"element",function(r,i){const o=Array.isArray(r.properties.className)?r.properties.className:fie,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let d=l;if(!a&&!l&&!c)return;let h=i[i.length-1],f=r;if(r.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(f=h,h=i[i.length-2],d=!0),!h)return;const m=iie(f,{whitespace:"pre"});let p;try{p=C3.renderToString(m,{...t,displayMode:d,throwOnError:!0})}catch(w){const b=w,v=b.name.toLowerCase();s.message("Could not render math with KaTeX",{ancestors:[...i,r],cause:b,place:r.position,ruleId:v,source:"rehype-katex"});try{p=C3.renderToString(m,{...t,displayMode:d,strict:"ignore",throwOnError:!1})}catch{p=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=Xre(p).children);const y=h.children.indexOf(f);return h.children.splice(y,1,...p),AD})}}const uB=[{id:"abap",name:"ABAP",import:()=>K(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>K(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>K(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>K(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>K(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>K(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>K(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>K(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>K(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>K(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>K(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>K(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>K(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>K(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>K(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>K(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>K(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>K(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>K(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>K(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>K(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>K(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>K(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>K(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>K(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>K(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>K(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>K(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>K(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>K(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>K(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>K(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>K(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>K(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>K(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>K(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>K(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>K(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>K(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>K(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>K(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>K(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>K(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>K(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>K(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>K(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>K(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>K(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>K(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>K(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>K(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>K(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>K(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>K(()=>import("./erb-BYTLMnw6.js"),__vite__mapDeps([31,1,2,3,32,33,7,8,14,34,11,35,36,21,22,23,24,26,37,38]))},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>K(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>K(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>K(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>K(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>K(()=>import("./fortran-fixed-form-TqA4NnZg.js"),__vite__mapDeps([39,40]))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>K(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>K(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>K(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>K(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>K(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>K(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>K(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>K(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>K(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>K(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>K(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>K(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>K(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>K(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>K(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>K(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>K(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>K(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>K(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>K(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>K(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>K(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>K(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>K(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>K(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>K(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>K(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>K(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>K(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>K(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>K(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>K(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>K(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>K(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>K(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>K(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>K(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>K(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>K(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>K(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>K(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>K(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>K(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>K(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>K(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>K(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>K(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>K(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>K(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>K(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>K(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>K(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>K(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>K(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>K(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>K(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>K(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>K(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>K(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>K(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>K(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>K(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>K(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>K(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>K(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>K(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>K(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>K(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>K(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>K(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>K(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>K(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>K(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>K(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>K(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>K(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>K(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>K(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>K(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>K(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>K(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>K(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>K(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>K(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>K(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>K(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>K(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>K(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>K(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>K(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>K(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>K(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>K(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>K(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>K(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>K(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>K(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>K(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>K(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>K(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>K(()=>import("./rst-4NLicBqY.js"),__vite__mapDeps([75,28,1,2,3,21,22,23,24,14,18,26,38,76,32,33,7,8,34,11,35,36,37]))},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>K(()=>import("./ruby-DeZ3UC14.js"),__vite__mapDeps([32,1,2,3,33,7,8,14,34,11,35,36,21,22,23,24,26,37,38]))},{id:"rust",name:"Rust",aliases:["rs"],import:()=>K(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>K(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>K(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>K(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>K(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>K(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>K(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>K(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>K(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>K(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>K(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>K(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>K(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>K(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>K(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>K(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>K(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>K(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>K(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>K(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>K(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>K(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>K(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>K(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>K(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>K(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>K(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>K(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>K(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>K(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>K(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>K(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>K(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>K(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>K(()=>import("./twig-NC5TFiHP.js"),__vite__mapDeps([89,3,2,5,70,1,7,8,14,9,18,32,33,34,11,35,36,21,22,23,24,26,37,38]))},{id:"typescript",name:"TypeScript",aliases:["ts"],import:()=>K(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>K(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>K(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>K(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>K(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>K(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>K(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>K(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>K(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>K(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>K(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>K(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>K(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>K(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>K(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>K(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>K(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>K(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>K(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>K(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>K(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>K(()=>import("./zig-BVz_zdnA.js"),[])}],mie=Object.fromEntries(uB.map(e=>[e.id,e.import])),pie=Object.fromEntries(uB.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),gie={...mie,...pie},yie=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>K(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>K(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>K(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>K(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>K(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>K(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>K(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>K(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>K(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>K(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>K(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>K(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>K(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>K(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>K(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>K(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>K(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>K(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>K(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>K(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>K(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>K(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>K(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>K(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>K(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>K(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>K(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>K(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>K(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>K(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>K(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>K(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>K(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>K(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>K(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>K(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>K(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>K(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>K(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>K(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>K(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>K(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>K(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>K(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>K(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>K(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>K(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>K(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>K(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>K(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>K(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>K(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>K(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>K(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],bie=Object.fromEntries(yie.map(e=>[e.id,e.import]));let rc=class extends Error{constructor(t){super(t),this.name="ShikiError"}},o6=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function vie(){return 2147483648}function wie(){return typeof performance<"u"?performance.now():Date.now()}const xie=(e,t)=>e+(t-e%t)%t;async function _ie(e){let t,n;const s={};function r(m){n=m,s.HEAPU8=new Uint8Array(m),s.HEAPU32=new Uint32Array(m)}function i(m,p,y){s.HEAPU8.copyWithin(m,p,p+y)}function o(m){try{return t.grow(m-n.byteLength+65535>>>16),r(t.buffer),1}catch{}}function a(m){const p=s.HEAPU8.length;m=m>>>0;const y=vie();if(m>y)return!1;for(let w=1;w<=4;w*=2){let b=p*(1+.2/w);b=Math.min(b,m+100663296);const v=Math.min(y,xie(Math.max(m,b),65536));if(o(v))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,p,y=1024){const w=p+y;let b=p;for(;m[b]&&!(b>=w);)++b;if(b-p>16&&m.buffer&&l)return l.decode(m.subarray(p,b));let v="";for(;p<b;){let x=m[p++];if(!(x&128)){v+=String.fromCharCode(x);continue}const _=m[p++]&63;if((x&224)===192){v+=String.fromCharCode((x&31)<<6|_);continue}const E=m[p++]&63;if((x&240)===224?x=(x&15)<<12|_<<6|E:x=(x&7)<<18|_<<12|E<<6|m[p++]&63,x<65536)v+=String.fromCharCode(x);else{const k=x-65536;v+=String.fromCharCode(55296|k>>10,56320|k&1023)}}return v}function d(m,p){return m?c(s.HEAPU8,m,p):""}const h={emscripten_get_now:wie,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const p=await e({env:h,wasi_snapshot_preview1:h});t=p.memory,r(t.buffer),Object.assign(s,p),s.UTF8ToString=d}return await f(),s}var kie=Object.defineProperty,Sie=(e,t,n)=>t in e?kie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jr=(e,t,n)=>(Sie(e,typeof t!="symbol"?t+"":t,n),n);let Vr=null;function Tie(e){throw new o6(e.UTF8ToString(e.getLastOnigError()))}class Zv{constructor(t){jr(this,"utf16Length"),jr(this,"utf8Length"),jr(this,"utf16Value"),jr(this,"utf8Value"),jr(this,"utf16OffsetToUtf8"),jr(this,"utf8OffsetToUtf16");const n=t.length,s=Zv._utf8ByteLength(t),r=s!==n,i=r?new Uint32Array(n+1):null;r&&(i[n]=s);const o=r?new Uint32Array(s+1):null;r&&(o[s]=n);const a=new Uint8Array(s);let l=0;for(let c=0;c<n;c++){const d=t.charCodeAt(c);let h=d,f=!1;if(d>=55296&&d<=56319&&c+1<n){const m=t.charCodeAt(c+1);m>=56320&&m<=57343&&(h=(d-55296<<10)+65536|m-56320,f=!0)}r&&(i[c]=l,f&&(i[c+1]=l),h<=127?o[l+0]=c:h<=2047?(o[l+0]=c,o[l+1]=c):h<=65535?(o[l+0]=c,o[l+1]=c,o[l+2]=c):(o[l+0]=c,o[l+1]=c,o[l+2]=c,o[l+3]=c)),h<=127?a[l++]=h:h<=2047?(a[l++]=192|(h&1984)>>>6,a[l++]=128|(h&63)>>>0):h<=65535?(a[l++]=224|(h&61440)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0):(a[l++]=240|(h&1835008)>>>18,a[l++]=128|(h&258048)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0),f&&c++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let s=0,r=t.length;s<r;s++){const i=t.charCodeAt(s);let o=i,a=!1;if(i>=55296&&i<=56319&&s+1<r){const l=t.charCodeAt(s+1);l>=56320&&l<=57343&&(o=(i-55296<<10)+65536|l-56320,a=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,a&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Ya=class{constructor(e){if(jr(this,"id",++Ya.LAST_ID),jr(this,"_onigBinding"),jr(this,"content"),jr(this,"utf16Length"),jr(this,"utf8Length"),jr(this,"utf16OffsetToUtf8"),jr(this,"utf8OffsetToUtf16"),jr(this,"ptr"),!Vr)throw new o6("Must invoke loadWasm first.");this._onigBinding=Vr,this.content=e;const t=new Zv(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!Ya._sharedPtrInUse?(Ya._sharedPtr||(Ya._sharedPtr=Vr.omalloc(1e4)),Ya._sharedPtrInUse=!0,Vr.HEAPU8.set(t.utf8Value,Ya._sharedPtr),this.ptr=Ya._sharedPtr):this.ptr=t.createString(Vr)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===Ya._sharedPtr?Ya._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let ig=Ya;jr(ig,"LAST_ID",0);jr(ig,"_sharedPtr",0);jr(ig,"_sharedPtrInUse",!1);class Cie{constructor(t){if(jr(this,"_onigBinding"),jr(this,"_ptr"),!Vr)throw new o6("Must invoke loadWasm first.");const n=[],s=[];for(let a=0,l=t.length;a<l;a++){const c=new Zv(t[a]);n[a]=c.createString(Vr),s[a]=c.utf8Length}const r=Vr.omalloc(4*t.length);Vr.HEAPU32.set(n,r/4);const i=Vr.omalloc(4*t.length);Vr.HEAPU32.set(s,i/4);const o=Vr.createOnigScanner(r,i,t.length);for(let a=0,l=t.length;a<l;a++)Vr.ofree(n[a]);Vr.ofree(i),Vr.ofree(r),o===0&&Tie(Vr),this._onigBinding=Vr,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let r=0;if(typeof s=="number"&&(r=s),typeof t=="string"){t=new ig(t);const i=this._findNextMatchSync(t,n,!1,r);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,r)}_findNextMatchSync(t,n,s,r){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),r);if(o===0)return null;const a=i.HEAPU32;let l=o/4;const c=a[l++],d=a[l++],h=[];for(let f=0;f<d;f++){const m=t.convertUtf8OffsetToUtf16(a[l++]),p=t.convertUtf8OffsetToUtf16(a[l++]);h[f]={start:m,end:p,length:p-m}}return{index:c,captureIndices:h}}}function Aie(e){return typeof e.instantiator=="function"}function Eie(e){return typeof e.default=="function"}function Mie(e){return typeof e.data<"u"}function Nie(e){return typeof Response<"u"&&e instanceof Response}function Iie(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let l1;function jie(e){if(l1)return l1;async function t(){Vr=await _ie(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),Aie(s)?s=await s.instantiator(n):Eie(s)?s=await s.default(n):(Mie(s)&&(s=s.data),Nie(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await Rie(s)(n):s=await Lie(s)(n):Iie(s)?s=await Sx(s)(n):s instanceof WebAssembly.Module?s=await Sx(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await Sx(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return l1=t(),l1}function Sx(e){return t=>WebAssembly.instantiate(e,t)}function Rie(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Lie(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Die;function Oie(){return Die}async function dB(e){return e&&await jie(e),{createScanner(t){return new Cie(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new ig(t)}}}function Bie(e){return a6(e)}function a6(e){return Array.isArray(e)?Pie(e):e instanceof RegExp?e:typeof e=="object"?$ie(e):e}function Pie(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=a6(e[n]);return t}function $ie(e){let t={};for(let n in e)t[n]=a6(e[n]);return t}function hB(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function fB(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?fB(e.substring(0,e.length-1)):e.substr(~t+1)}var Tx=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,c1=class{static hasCaptures(e){return e===null?!1:(Tx.lastIndex=0,Tx.test(e))}static replaceCaptures(e,t,n){return e.replace(Tx,(s,r,i,o)=>{let a=n[parseInt(r||i,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return s})}};function mB(e,t){return e<t?-1:e>t?1:0}function pB(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 r=0;r<n;r++){let i=mB(e[r],t[r]);if(i!==0)return i}return 0}return n-s}function mA(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 gB(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var yB=class{constructor(e){ye(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}},_b=class{constructor(e,t,n){ye(this,"_cachedMatchRoot",new yB(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(qie(e),t)}static createFromParsedTheme(e,t){return Uie(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(r=>zie(e.parent,r.parentScopes));return s?new bB(s.fontStyle,s.foreground,s.background):null}},Cx=class fy{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new fy(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new fy(n,t[s]);return n}push(t){return new fy(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 zie(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!Fie(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Fie(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var bB=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function qie(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let h=o.settings.fontStyle.split(" ");for(let f=0,m=h.length;f<m;f++)switch(h[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 c=null;typeof o.settings.foreground=="string"&&mA(o.settings.foreground)&&(c=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&mA(o.settings.background)&&(d=o.settings.background);for(let h=0,f=a.length;h<f;h++){let p=a[h].trim().split(" "),y=p[p.length-1],w=null;p.length>1&&(w=p.slice(0,p.length-1),w.reverse()),n[s++]=new Hie(y,w,r,l,c,d)}}return n}var Hie=class{constructor(e,t,n,s,r,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=i}},Jl=(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))(Jl||{});function Uie(e,t){e.sort((l,c)=>{let d=mB(l.scope,c.scope);return d!==0||(d=pB(l.parentScopes,c.parentScopes),d!==0)?d:l.index-c.index});let n=0,s="#000000",r="#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&&(r=l.background)}let i=new Vie(t),o=new bB(n,i.getId(s),i.getId(r)),a=new Gie(new M3(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let d=e[l];a.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new _b(i,o,a)}var Vie=class{constructor(e){ye(this,"_isFrozen");ye(this,"_lastColorId");ye(this,"_id2color");ye(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)}},Wie=Object.freeze([]),M3=class vB{constructor(t,n,s,r,i){ye(this,"scopeDepth");ye(this,"parentScopes");ye(this,"fontStyle");ye(this,"foreground");ye(this,"background");this.scopeDepth=t,this.parentScopes=n||Wie,this.fontStyle=s,this.foreground=r,this.background=i}clone(){return new vB(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,r=t.length;s<r;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,r){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),r!==0&&(this.background=r)}},Gie=class N3{constructor(t,n=[],s={}){ye(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,r=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[r]===">"&&r++,!(s>=t.parentScopes.length||r>=n.parentScopes.length);){const i=n.parentScopes[r].length-t.parentScopes[s].length;if(i!==0)return i;s++,r++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),r,i;if(s===-1?(r=t,i=""):(r=t.substring(0,s),i=t.substring(s+1)),this._children.hasOwnProperty(r))return this._children[r].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(N3._cmpBySpecificity),n}insert(t,n,s,r,i,o){if(n===""){this._doInsertHere(t,s,r,i,o);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new N3(this._mainRule.clone(),M3.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,c,s,r,i,o)}_doInsertHere(t,n,s,r,i){if(n===null){this._mainRule.acceptOverwrite(t,s,r,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let l=this._rulesWithParentScopes[o];if(pB(l.parentScopes,n)===0){l.acceptOverwrite(t,s,r,i);return}}s===-1&&(s=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new M3(t,n,s,r,i))}},$f=class qo{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=qo.getLanguageId(t),s=qo.getTokenType(t),r=qo.getFontStyle(t),i=qo.getForeground(t),o=qo.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:i,background:o})}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,r,i,o,a){let l=qo.getLanguageId(t),c=qo.getTokenType(t),d=qo.containsBalancedBrackets(t)?1:0,h=qo.getFontStyle(t),f=qo.getForeground(t),m=qo.getBackground(t);return n!==0&&(l=n),s!==8&&(c=s),r!==null&&(d=r?1:0),i!==-1&&(h=i),o!==0&&(f=o),a!==0&&(m=a),(l<<0|c<<8|d<<10|h<<11|f<<15|m<<24)>>>0}};function kb(e,t){const n=[],s=Kie(e);let r=s.next();for(;r!==null;){let l=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let c=o();if(n.push({matcher:c,priority:l}),r!==",")break;r=s.next()}return n;function i(){if(r==="-"){r=s.next();const l=i();return c=>!!l&&!l(c)}if(r==="("){r=s.next();const l=a();return r===")"&&(r=s.next()),l}if(pA(r)){const l=[];do l.push(r),r=s.next();while(pA(r));return c=>t(l,c)}return null}function o(){const l=[];let c=i();for(;c;)l.push(c),c=i();return d=>l.every(h=>h(d))}function a(){const l=[];let c=o();for(;c&&(l.push(c),r==="|"||r===",");){do r=s.next();while(r==="|"||r===",");c=o()}return d=>l.some(h=>h(d))}}function pA(e){return!!e&&!!e.match(/[\w\.:]+/)}function Kie(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 wB(e){typeof e.dispose=="function"&&e.dispose()}var fp=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Yie=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Qie=class{constructor(){ye(this,"_references",[]);ye(this,"_seenReferenceKeys",new Set);ye(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))}},Xie=class{constructor(e,t){ye(this,"seenFullScopeRequests",new Set);ye(this,"seenPartialScopeRequests",new Set);ye(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new fp(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Qie;for(const n of e)Jie(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof fp){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 Jie(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof fp?my({baseGrammar:i,selfGrammar:r},s):I3(e.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},s);const o=n.injections(e.scopeName);if(o)for(const a of o)s.add(new fp(a))}function I3(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];Sb([s],t,n)}}function my(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Sb(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Sb(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Sb(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const r=s.repository?hB({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&Sb(s.patterns,{...t,repository:r},n);const i=s.include;if(!i)continue;const o=xB(i);switch(o.kind){case 0:my({...t,selfGrammar:t.baseGrammar},n);break;case 1:my(t,n);break;case 2:I3(o.ruleName,{...t,repository:r},n);break;case 3:case 4:const a=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:r};o.kind===4?I3(o.ruleName,l,n):my(l,n)}else o.kind===4?n.add(new Yie(o.scopeName,o.ruleName)):n.add(new fp(o.scopeName));break}}}var Zie=class{constructor(){ye(this,"kind",0)}},eoe=class{constructor(){ye(this,"kind",1)}},toe=class{constructor(e){ye(this,"kind",2);this.ruleName=e}},noe=class{constructor(e){ye(this,"kind",3);this.scopeName=e}},soe=class{constructor(e,t){ye(this,"kind",4);this.scopeName=e,this.ruleName=t}};function xB(e){if(e==="$base")return new Zie;if(e==="$self")return new eoe;const t=e.indexOf("#");if(t===-1)return new noe(e);if(t===0)return new toe(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new soe(n,s)}}var roe=/\\(\d+)/,gA=/\\(\d+)/g,ioe=-1,_B=-2;var og=class{constructor(t,n,s,r){ye(this,"$location");ye(this,"id");ye(this,"_nameIsCapturing");ye(this,"_name");ye(this,"_contentNameIsCapturing");ye(this,"_contentName");this.$location=t,this.id=n,this._name=s||null,this._nameIsCapturing=c1.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=c1.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${fB(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,n){return!this._nameIsCapturing||this._name===null||t===null||n===null?this._name:c1.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:c1.replaceCaptures(this._contentName,t,n)}},ooe=class extends og{constructor(t,n,s,r,i){super(t,n,s,r);ye(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,s,r){throw new Error("Not supported!")}},aoe=class extends og{constructor(t,n,s,r,i){super(t,n,s,null);ye(this,"_match");ye(this,"captures");ye(this,"_cachedCompiledPatterns");this._match=new mp(r,this.id),this.captures=i,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,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new pp,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},yA=class extends og{constructor(t,n,s,r,i){super(t,n,s,r);ye(this,"hasMissingPatterns");ye(this,"patterns");ye(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.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,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new pp,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},j3=class extends og{constructor(t,n,s,r,i,o,a,l,c,d){super(t,n,s,r);ye(this,"_begin");ye(this,"beginCaptures");ye(this,"_end");ye(this,"endHasBackReferences");ye(this,"endCaptures");ye(this,"applyEndPatternLast");ye(this,"hasMissingPatterns");ye(this,"patterns");ye(this,"_cachedCompiledPatterns");this._begin=new mp(i,this.id),this.beginCaptures=o,this._end=new mp(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.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,r){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,r)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new pp;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}},Tb=class extends og{constructor(t,n,s,r,i,o,a,l,c){super(t,n,s,r);ye(this,"_begin");ye(this,"beginCaptures");ye(this,"whileCaptures");ye(this,"_while");ye(this,"whileHasBackReferences");ye(this,"hasMissingPatterns");ye(this,"patterns");ye(this,"_cachedCompiledPatterns");ye(this,"_cachedCompiledWhilePatterns");this._begin=new mp(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new mp(a,_B),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.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,r){return this._getCachedCompiledPatterns(t).compileAG(t,s,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new pp;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,r){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,r)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new pp,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},kB=class hi{static createCaptureRule(t,n,s,r,i){return t.registerRule(o=>new ooe(n,o,s,r,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new aoe(t.$vscodeTextmateLocation,t.id,t.name,t.match,hi._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=hB({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new yA(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,hi._compilePatterns(i,n,s))}return t.while?new Tb(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,hi._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,hi._compileCaptures(t.whileCaptures||t.captures,n,s),hi._compilePatterns(t.patterns,n,s)):new j3(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,hi._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,hi._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,hi._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let i=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)r[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let l=0;t[o].patterns&&(l=hi.getCompiledRuleId(t[o],n,s)),r[a]=hi.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let i=0,o=t.length;i<o;i++){const a=t[i];let l=-1;if(a.include){const c=xB(a.include);switch(c.kind){case 0:case 1:l=hi.getCompiledRuleId(s[a.include],n,s);break;case 2:let d=s[c.ruleName];d&&(l=hi.getCompiledRuleId(d,n,s));break;case 3:case 4:const h=c.scopeName,f=c.kind===4?c.ruleName:null,m=n.getExternalGrammar(h,s);if(m)if(f){let p=m.repository[f];p&&(l=hi.getCompiledRuleId(p,n,m.repository))}else l=hi.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=hi.getCompiledRuleId(a,n,s);if(l!==-1){const c=n.getRule(l);let d=!1;if((c instanceof yA||c instanceof j3||c instanceof Tb)&&c.hasMissingPatterns&&c.patterns.length===0&&(d=!0),d)continue;r.push(l)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},mp=class SB{constructor(t,n){ye(this,"source");ye(this,"ruleId");ye(this,"hasAnchor");ye(this,"hasBackReferences");ye(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let r=0,i=[],o=!1;for(let a=0;a<s;a++)if(t.charAt(a)==="\\"&&a+1<s){const c=t.charAt(a+1);c==="z"?(i.push(t.substring(r,a)),i.push("$(?!\\n)(?<!\\n)"),r=a+2):(c==="A"||c==="G")&&(o=!0),a++}this.hasAnchor=o,r===0?this.source=t:(i.push(t.substring(r,s)),this.source=i.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=roe.test(this.source):this.hasBackReferences=!1}clone(){return new SB(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(r=>t.substring(r.start,r.end));return gA.lastIndex=0,this.source.replace(gA,(r,i)=>gB(s[parseInt(i,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=[],r=[],i,o,a,l;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),t[i]=a,n[i]=a,s[i]=a,r[i]=a,a==="\\"&&i+1<o&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",s[i+1]="A",r[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",s[i+1]="",r[i+1]="G"):(t[i+1]=l,n[i+1]=l,s[i+1]=l,r[i+1]=l),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:r.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}},pp=class{constructor(){ye(this,"_items");ye(this,"_hasAnchors");ye(this,"_cached");ye(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 bA(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(r=>r.resolveAnchors(t,n));return new bA(e,s,this._items.map(r=>r.ruleId))}},bA=class{constructor(e,t,n){ye(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(`
`)}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},Ax=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Gl,loe=(Gl=class{constructor(t,n){ye(this,"_defaultAttributes");ye(this,"_embeddedLanguagesMatcher");ye(this,"_getBasicScopeAttributes",new yB(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new Ax(n,s)}));this._defaultAttributes=new Ax(t,8),this._embeddedLanguagesMatcher=new coe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Gl._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Gl.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!")}},ye(Gl,"_NULL_SCOPE_METADATA",new Ax(0,0)),ye(Gl,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Gl),coe=class{constructor(e){ye(this,"values");ye(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>gB(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])}},vA=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function TB(e,t,n,s,r,i,o,a){const l=t.content.length;let c=!1,d=-1;if(o){const m=uoe(e,t,n,s,r,i);r=m.stack,s=m.linePos,n=m.isFirstLine,d=m.anchorPosition}const h=Date.now();for(;!c;){if(a!==0&&Date.now()-h>a)return new vA(r,!0);f()}return new vA(r,!1);function f(){const m=doe(e,t,n,s,r,d);if(!m){i.produce(r,l),c=!0;return}const p=m.captureIndices,y=m.matchedRuleId,w=p&&p.length>0?p[0].end>s:!1;if(y===ioe){const b=r.getRule(e);i.produce(r,p[0].start),r=r.withContentNameScopesList(r.nameScopesList),r0(e,t,n,r,i,b.endCaptures,p),i.produce(r,p[0].end);const v=r;if(r=r.parent,d=v.getAnchorPos(),!w&&v.getEnterPos()===s){r=v,i.produce(r,l),c=!0;return}}else{const b=e.getRule(y);i.produce(r,p[0].start);const v=r,x=b.getName(t.content,p),_=r.contentNameScopesList.pushAttributed(x,e);if(r=r.push(y,s,d,p[0].end===l,null,_,_),b instanceof j3){const E=b;r0(e,t,n,r,i,E.beginCaptures,p),i.produce(r,p[0].end),d=p[0].end;const k=E.getContentName(t.content,p),M=_.pushAttributed(k,e);if(r=r.withContentNameScopesList(M),E.endHasBackReferences&&(r=r.withEndRule(E.getEndWithResolvedBackReferences(t.content,p))),!w&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),c=!0;return}}else if(b instanceof Tb){const E=b;r0(e,t,n,r,i,E.beginCaptures,p),i.produce(r,p[0].end),d=p[0].end;const k=E.getContentName(t.content,p),M=_.pushAttributed(k,e);if(r=r.withContentNameScopesList(M),E.whileHasBackReferences&&(r=r.withEndRule(E.getWhileWithResolvedBackReferences(t.content,p))),!w&&v.hasSameRuleAs(r)){r=r.pop(),i.produce(r,l),c=!0;return}}else if(r0(e,t,n,r,i,b.captures,p),i.produce(r,p[0].end),r=r.pop(),!w){r=r.safePop(),i.produce(r,l),c=!0;return}}p[0].end>s&&(s=p[0].end,n=!1)}}function uoe(e,t,n,s,r,i){let o=r.beginRuleCapturedEOL?0:-1;const a=[];for(let l=r;l;l=l.pop()){const c=l.getRule(e);c instanceof Tb&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:d}=moe(l.rule,e,l.stack.endRule,n,s===o),h=c.findNextMatchSync(t,s,d);if(h){if(h.ruleId!==_B){r=l.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(l.stack,h.captureIndices[0].start),r0(e,t,n,l.stack,i,l.rule.whileCaptures,h.captureIndices),i.produce(l.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>s&&(s=h.captureIndices[0].end,n=!1))}else{r=l.stack.pop();break}}return{stack:r,linePos:s,anchorPosition:o,isFirstLine:n}}function doe(e,t,n,s,r,i){const o=hoe(e,t,n,s,r,i),a=e.getInjections();if(a.length===0)return o;const l=foe(a,e,t,n,s,r,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,d=l.captureIndices[0].start;return d<c||l.priorityMatch&&d===c?l:o}function hoe(e,t,n,s,r,i){const o=r.getRule(e),{ruleScanner:a,findOptions:l}=CB(o,e,r.endRule,n,s===i),c=a.findNextMatchSync(t,s,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function foe(e,t,n,s,r,i,o){let a=Number.MAX_VALUE,l=null,c,d=0;const h=i.contentNameScopesList.getScopeNames();for(let f=0,m=e.length;f<m;f++){const p=e[f];if(!p.matcher(h))continue;const y=t.getRule(p.ruleId),{ruleScanner:w,findOptions:b}=CB(y,t,null,s,r===o),v=w.findNextMatchSync(n,r,b);if(!v)continue;const x=v.captureIndices[0].start;if(!(x>=a)&&(a=x,l=v.captureIndices,c=v.ruleId,d=p.priority,a===r))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:c}:null}function CB(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function moe(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function r0(e,t,n,s,r,i,o){if(i.length===0)return;const a=t.content,l=Math.min(i.length,o.length),c=[],d=o[0].end;for(let h=0;h<l;h++){const f=i[h];if(f===null)continue;const m=o[h];if(m.length===0)continue;if(m.start>d)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)r.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?r.produceFromScopes(c[c.length-1].scopes,m.start):r.produce(s,m.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,o),w=s.contentNameScopesList.pushAttributed(y,e),b=f.getContentName(a,o),v=w.pushAttributed(b,e),x=s.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,w,v),_=e.createOnigString(a.substring(0,m.end));TB(e,_,n&&m.start===0,m.start,x,r,!1,0),wB(_);continue}const p=f.getName(a,o);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:s.contentNameScopesList).pushAttributed(p,e);c.push(new poe(w,m.end))}}for(;c.length>0;)r.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var poe=class{constructor(e,t){ye(this,"scopes");ye(this,"endPos");this.scopes=e,this.endPos=t}};function goe(e,t,n,s,r,i,o,a){return new boe(e,t,n,s,r,i,o,a)}function wA(e,t,n,s,r){const i=kb(t,Cb),o=kB.getCompiledRuleId(n,s,r.repository);for(const a of i)e.push({debugSelector:t,matcher:a.matcher,ruleId:o,grammar:r,priority:a.priority})}function Cb(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let r=n;r<t.length;r++)if(yoe(t[r],s))return n=r+1,!0;return!1})}function yoe(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 boe=class{constructor(e,t,n,s,r,i,o,a){ye(this,"_rootId");ye(this,"_lastRuleId");ye(this,"_ruleId2desc");ye(this,"_includedGrammars");ye(this,"_grammarRepository");ye(this,"_grammar");ye(this,"_injections");ye(this,"_basicScopeAttributesProvider");ye(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new loe(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=xA(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const l of Object.keys(r)){const c=kb(l,Cb);for(const d of c)this._tokenTypeMatchers.push({matcher:d.matcher,type:r[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:r=>r===this._rootScopeName?this._grammar:this.getExternalGrammar(r),injections:r=>this._grammarRepository.injections(r)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const r=s.injections;if(r)for(let o in r)wA(t,o,r[o],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const l=a.injectionSelector;l&&wA(t,l,a,this,a)}})}return t.sort((r,i)=>r.priority-i.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]=xA(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=kB.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let r;if(!t||t===R3.NULL){r=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=$f.set(0,c.languageId,c.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),f=this.getRule(this._rootId).getName(null,null);let m;f?m=P0.createRootAndLookUpScopeName(f,h,this):m=P0.createRoot("unknown",h),t=new R3(null,this._rootId,-1,-1,!1,null,m,m)}else r=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new woe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=TB(this,i,r,0,t,a,!0,s);return wB(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function xA(e,t){return e=Bie(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 P0=class Qa{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,r=(t==null?void 0:t.scopePath)??null;for(const i of n)r=Cx.push(r,i.scopeNames),s=new Qa(s,r,i.encodedTokenAttributes);return s}static createRoot(t,n){return new Qa(null,new Cx(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),i=new Cx(null,t),o=s.themeProvider.themeMatch(i),a=Qa.mergeAttributes(n,r,o);return new Qa(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Qa.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 r=-1,i=0,o=0;return s!==null&&(r=s.fontStyle,i=s.foregroundId,o=s.backgroundId),$f.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Qa._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const i of s)r=Qa._pushAttributed(r,i,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),i=t.scopePath.push(n),o=s.themeProvider.themeMatch(i),a=Qa.mergeAttributes(t.tokenAttributes,r,o);return new Qa(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var r;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((r=s.parent)==null?void 0:r.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},Qo,R3=(Qo=class{constructor(t,n,s,r,i,o,a,l){ye(this,"_stackElementBrand");ye(this,"_enterPos");ye(this,"_anchorPos");ye(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=r}equals(t){return t===null?!1:Qo._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?P0.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(){Qo._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,i,o,a){return new Qo(this,t,n,s,r,i,o,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,r;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(r=this.contentNameScopesList)==null?void 0:r.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 Qo(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=P0.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new Qo(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,P0.fromExtension(s,n.contentNameScopesList))}},ye(Qo,"NULL",new Qo(null,0,0,0,!1,null,null,null)),Qo),voe=class{constructor(e,t){ye(this,"balancedBracketScopes");ye(this,"unbalancedBracketScopes");ye(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):kb(n,Cb).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>kb(n,Cb).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}},woe=class{constructor(e,t,n,s){ye(this,"_emitBinaryTokens");ye(this,"_lineText");ye(this,"_tokens");ye(this,"_binaryTokens");ye(this,"_lastTokenEndIndex");ye(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 r=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((s=this.balancedBracketSelectors)!=null&&s.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const a of this._tokenTypeOverrides)a.matcher(o)&&(r=$f.set(r,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=$f.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),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,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},xoe=class{constructor(e,t){ye(this,"_grammars",new Map);ye(this,"_rawGrammars",new Map);ye(this,"_injectionGrammars",new Map);ye(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,r){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,goe(e,i,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},_oe=class{constructor(t){ye(this,"_options");ye(this,"_syncRegistry");ye(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new xoe(_b.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(_b.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 voe(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,r,i){const o=new Xie(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,s,r,i)}_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,r=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,r)}_grammarForScopeName(t,n=0,s=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,s,r,i)}},L3=R3.NULL;const koe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Soe=/["&'<>`]/g,Toe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Coe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Aoe=/[|\\{}()[\]^$+*?.]/g,_A=new WeakMap;function Eoe(e,t){if(e=e.replace(t.subset?Moe(t.subset):Soe,s),t.subset||t.escapeOnly)return e;return e.replace(Toe,n).replace(Coe,s);function n(r,i,o){return t.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function s(r,i,o){return t.format(r.charCodeAt(0),o.charCodeAt(i+1),t)}}function Moe(e){let t=_A.get(e);return t||(t=Noe(e),_A.set(e,t)),t}function Noe(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Aoe,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Ioe=/[\dA-Fa-f]/;function joe(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!Ioe.test(String.fromCharCode(t))?s:s+";"}const Roe=/\d/;function Loe(e,t,n){const s="&#"+String(e);return n&&t&&!Roe.test(String.fromCharCode(t))?s:s+";"}const Doe=["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"],Ex={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:"€"},Ooe=["cent","copy","divide","gt","lt","not","para","times"],AB={}.hasOwnProperty,D3={};let u1;for(u1 in Ex)AB.call(Ex,u1)&&(D3[Ex[u1]]=u1);const Boe=/[^\dA-Za-z]/;function Poe(e,t,n,s){const r=String.fromCharCode(e);if(AB.call(D3,r)){const i=D3[r],o="&"+i;return n&&Doe.includes(i)&&!Ooe.includes(i)&&(!s||t&&t!==61&&Boe.test(String.fromCharCode(t)))?o:o+";"}return""}function $oe(e,t,n){let s=joe(e,t,n.omitOptionalSemicolons),r;if((n.useNamedReferences||n.useShortestReferences)&&(r=Poe(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const i=Loe(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function pf(e,t){return Eoe(e,Object.assign({format:$oe},t))}const zoe=/^>|^->|<!--|-->|--!>|<!-$/g,Foe=[">"],qoe=["<",">"];function Hoe(e,t,n,s){return s.settings.bogusComments?"<?"+pf(e.value,Object.assign({},s.settings.characterReferences,{subset:Foe}))+">":"<!--"+e.value.replace(zoe,r)+"-->";function r(i){return pf(i,Object.assign({},s.settings.characterReferences,{subset:qoe}))}}function Uoe(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}const $r=MB(1),EB=MB(-1),Voe=[];function MB(e){return t;function t(n,s,r){const i=n?n.children:Voe;let o=(s||0)+e,a=i[o];if(!r)for(;a&&Lv(a);)o+=e,a=i[o];return a}}const Woe={}.hasOwnProperty;function NB(e){return t;function t(n,s,r){return Woe.call(e,n.tagName)&&e[n.tagName](n,s,r)}}const l6=NB({body:Koe,caption:Mx,colgroup:Mx,dd:Joe,dt:Xoe,head:Mx,html:Goe,li:Qoe,optgroup:Zoe,option:eae,p:Yoe,rp:kA,rt:kA,tbody:nae,td:SA,tfoot:sae,th:SA,thead:tae,tr:rae});function Mx(e,t,n){const s=$r(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&Lv(s.value.charAt(0)))}function Goe(e,t,n){const s=$r(n,t);return!s||s.type!=="comment"}function Koe(e,t,n){const s=$r(n,t);return!s||s.type!=="comment"}function Yoe(e,t,n){const s=$r(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 Qoe(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&s.tagName==="li"}function Xoe(e,t,n){const s=$r(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function Joe(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function kA(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function Zoe(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function eae(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function tae(e,t,n){const s=$r(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function nae(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function sae(e,t,n){return!$r(n,t)}function rae(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function SA(e,t,n){const s=$r(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const iae=NB({body:lae,colgroup:cae,head:aae,html:oae,tbody:uae});function oae(e){const t=$r(e,-1);return!t||t.type!=="comment"}function aae(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 lae(e){const t=$r(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Lv(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function cae(e,t,n){const s=EB(n,t),r=$r(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&l6(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function uae(e,t,n){const s=EB(n,t),r=$r(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&l6(s,n.children.indexOf(s),n)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}const d1={name:[[`	
\f\r &/=>`.split(""),`	
\f\r "&'/=>\``.split("")],[`\0	
\f\r "&'/<=>`.split(""),`\0	
\f\r "&'/<=>\``.split("")]],unquoted:[[`	
\f\r &>`.split(""),`\0	
\f\r "&'<=>\``.split("")],[`\0	
\f\r "&'<=>\``.split(""),`\0	
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function dae(e,t,n,s){const r=s.schema,i=r.space==="svg"?!1:s.settings.omitOptionalTags;let o=r.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;r.space==="html"&&e.tagName==="svg"&&(s.schema=im);const c=hae(s,e.properties),d=s.all(r.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=r,d&&(o=!1),(c||!i||!iae(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),o&&(r.space==="svg"||s.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!s.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!o&&(!i||!l6(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function hae(e,t){const n=[];let s=-1,r;if(t){for(r in t)if(t[r]!==null&&t[r]!==void 0){const i=fae(e,r,t[r]);i&&n.push(i)}}for(;++s<n.length;){const i=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&i!=='"'&&i!=="'"&&(n[s]+=" ")}return n.join("")}function fae(e,t,n){const s=kS(e.schema,t),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=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=pf(s.attribute,Object.assign({},e.settings.characterReferences,{subset:d1.name[r][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?WL:eD)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=pf(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:d1.unquoted[r][i]}))),a!==n&&(e.settings.quoteSmart&&mb(n,o)>mb(n,e.alternative)&&(o=e.alternative),a=o+pf(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?d1.single:d1.double)[r][i],attribute:!0}))+o),l+(a&&"="+a))}const mae=["<","&"];function IB(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:pf(e.value,Object.assign({},s.settings.characterReferences,{subset:mae}))}function pae(e,t,n,s){return s.settings.allowDangerousHtml?e.value:IB(e,t,n,s)}function gae(e,t,n,s){return s.all(e)}const yae=hte("type",{invalid:bae,unknown:vae,handlers:{comment:Hoe,doctype:Uoe,element:dae,raw:pae,root:gae,text:IB}});function bae(e){throw new Error("Expected node, not `"+e+"`")}function vae(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const wae={},xae={},_ae=[];function kae(e,t){const n=wae,s=n.quote||'"',r=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:Sae,all:Tae,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||koe,characterReferences:n.characterReferences||xae,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?im:SS,quote:s,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Sae(e,t,n){return yae(e,t,n,this)}function Tae(e){const t=[],n=e&&e.children||_ae;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function Cae(e){return Array.isArray(e)?e:[e]}function ew(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const a=t?n[o]+(n[o+1]||""):n[o];r.push([a,s]),s+=n[o].length,s+=((i=n[o+1])==null?void 0:i.length)||0}return r}function c6(e){return!e||["plaintext","txt","text","plain"].includes(e)}function jB(e){return e==="ansi"||c6(e)}function u6(e){return e==="none"}function RB(e){return u6(e)}function LB(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 r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function Aae(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function Eae(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((s,r)=>s-r);return n.length?e.map(s=>s.flatMap(r=>{const i=n.filter(o=>r.offset<o&&o<r.offset+r.content.length).map(o=>o-r.offset).sort((o,a)=>o-a);return i.length?Aae(r,i):r})):e}async function DB(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function Ab(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[r,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[r]=i:r===s&&Object.assign(n,i);return n}function wd(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function OB(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Jl.Italic&&(t["font-style"]="italic"),e.fontStyle&Jl.Bold&&(t["font-weight"]="bold"),e.fontStyle&Jl.Underline&&(t["text-decoration"]="underline")),t}function Mae(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function Nae(e){const t=ew(e,!0).map(([r])=>r);function n(r){if(r===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=r,o=0;for(const a of t){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function s(r,i){let o=0;for(let a=0;a<r;a++)o+=t[a].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:s}}class Bi extends Error{constructor(t){super(t),this.name="ShikiError"}}const BB=new WeakMap;function tw(e,t){BB.set(e,t)}function gp(e){return BB.get(e)}class dm{constructor(...t){ye(this,"_stacks",{});ye(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,r]=t;this.lang=s,this._stacks={[r]: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 dm(Object.fromEntries(Cae(n).map(s=>[s,L3])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return TA(this._stacks[this.theme])}getScopes(t=this.theme){return TA(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function TA(e){const t=[],n=new Set;function s(r){var o;if(n.has(r))return;n.add(r);const i=(o=r==null?void 0:r.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),r.parent&&s(r.parent)}return s(e),t}function Iae(e,t){if(!(e instanceof dm))throw new Bi("Invalid grammar state");return e.getInternalStack(t)}function jae(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let s=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new Bi(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...r.indexToPos(o),offset:o}}else{const a=r.lines[o.line];if(a===void 0)throw new Bi(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${r.lines.length}`);if(o.character<0||o.character>a.length)throw new Bi(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:r.posToIndex(o.line,o.character)}}};const r=Nae(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));Rae(i),e.set(n.meta,{decorations:i,converter:r,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var o;if(!((o=this.options.decorations)!=null&&o.length))return;const r=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return Eae(n,r)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const s=t(this),r=Array.from(n.children).filter(h=>h.type==="element"&&h.tagName==="span");if(r.length!==s.converter.lines.length)throw new Bi(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(h,f,m,p){const y=r[h];let w="",b=-1,v=-1;if(f===0&&(b=0),m===0&&(v=0),m===Number.POSITIVE_INFINITY&&(v=y.children.length),b===-1||v===-1)for(let _=0;_<y.children.length;_++)w+=PB(y.children[_]),b===-1&&w.length===f&&(b=_+1),v===-1&&w.length===m&&(v=_+1);if(b===-1)throw new Bi(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(v===-1)throw new Bi(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const x=y.children.slice(b,v);if(!p.alwaysWrap&&x.length===y.children.length)a(y,p,"line");else if(!p.alwaysWrap&&x.length===1&&x[0].type==="element")a(x[0],p,"token");else{const _={type:"element",tagName:"span",properties:{},children:x};a(_,p,"wrapper"),y.children.splice(b,x.length,_)}}function o(h,f){r[h]=a(r[h],f,"line")}function a(h,f,m){var w;const p=f.properties||{},y=f.transform||(b=>b);return h.tagName=f.tagName||"span",h.properties={...h.properties,...p,class:h.properties.class},(w=f.properties)!=null&&w.class&&LB(h,f.properties.class),h=y(h,m)||h,h}const l=[],c=s.decorations.sort((h,f)=>f.start.offset-h.start.offset);for(const h of c){const{start:f,end:m}=h;if(f.line===m.line)i(f.line,f.character,m.character,h);else if(f.line<m.line){i(f.line,f.character,Number.POSITIVE_INFINITY,h);for(let p=f.line+1;p<m.line;p++)l.unshift(()=>o(p,h));i(m.line,0,m.character,h)}}l.forEach(h=>h())}}}function Rae(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Bi(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const r=e[s],i=n.start.offset<r.start.offset&&r.start.offset<n.end.offset,o=n.start.offset<r.end.offset&&r.end.offset<n.end.offset,a=r.start.offset<n.start.offset&&n.start.offset<r.end.offset,l=r.start.offset<n.end.offset&&n.end.offset<r.end.offset;if(i||o||a||l){if(o&&o||a&&l)continue;throw new Bi(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(r.start)} intersect.`)}}}}function PB(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(PB).join(""):""}const Lae=[jae()];function Eb(e){return[...e.transformers||[],...Lae]}var xd=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Nx={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function Dae(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const s=e.indexOf("m",n);return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function CA(e,t){let n=1;const s=e[t+n++];let r;if(s==="2"){const i=[e[t+n++],e[t+n++],e[t+n]].map(o=>Number.parseInt(o));i.length===3&&!i.some(o=>Number.isNaN(o))&&(r={type:"rgb",rgb:i})}else if(s==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(r={type:"table",index:Number(i)})}return[n,r]}function Oae(e){const t=[];for(let n=0;n<e.length;n++){const s=e[n],r=Number.parseInt(s);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)Nx[r]&&t.push({type:"setDecoration",value:Nx[r]});else if(r<=29){const i=Nx[r-20];i&&t.push({type:"resetDecoration",value:i})}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:xd[r-30]}});else if(r===38){const[i,o]=CA(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:xd[r-40]}});else if(r===48){const[i,o]=CA(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else r===49?t.push({type:"resetBackgroundColor"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:xd[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:xd[r-100+8]}})}return t}function Bae(){let e=null,t=null,n=new Set;return{parse(s){const r=[];let i=0;do{const o=Dae(s,i),a=o.sequence?s.substring(i,o.startPosition):s.substring(i);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const l=Oae(o.sequence);for(const c of l)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=o.position}while(i<s.length);return r}}}var Pae={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 $ae(e=Pae){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 r(){if(s)return s;s=[];for(let c=0;c<xd.length;c++)s.push(t(xd[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let d=0;d<6;d++)for(let h=0;h<6;h++)s.push(n([a[c],a[d],a[h]]));let l=8;for(let c=0;c<24;c++,l+=10)s.push(n([l,l,l]));return s}function i(a){return r()[a]}function o(a){switch(a.type){case"named":return t(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}function zae(e,t,n){const s=Ab(e,n),r=ew(t),i=$ae(Object.fromEntries(xd.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=Bae();return r.map(a=>o.parse(a[0]).map(l=>{let c,d;l.decorations.has("reverse")?(c=l.background?i.value(l.background):e.bg,d=l.foreground?i.value(l.foreground):e.fg):(c=l.foreground?i.value(l.foreground):e.fg,d=l.background?i.value(l.background):void 0),c=wd(c,s),d=wd(d,s),l.decorations.has("dim")&&(c=Fae(c));let h=Jl.None;return l.decorations.has("bold")&&(h|=Jl.Bold),l.decorations.has("italic")&&(h|=Jl.Italic),l.decorations.has("underline")&&(h|=Jl.Underline),{content:l.value,offset:a[1],color:c,bgColor:d,fontStyle:h}}))}function Fae(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const s=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${s}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(s=>`${s}${s}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function d6(e,t,n={}){const{lang:s="text",theme:r=e.getLoadedThemes()[0]}=n;if(c6(s)||u6(r))return ew(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(r);if(s==="ansi")return zae(i,t,n);const a=e.getLanguage(s);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new rc(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new rc(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Hae(t,a,i,o,n)}function qae(...e){if(e.length===2)return gp(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:i=t.getLoadedThemes()[0]}=s;if(c6(r)||u6(i))throw new rc("Plain language does not have grammar state");if(r==="ansi")throw new rc("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(r);return new dm(Mb(n,l,o,a,s).stateStack,l.name,o.name)}function Hae(e,t,n,s,r){const i=Mb(e,t,n,s,r),o=new dm(Mb(e,t,n,s,r).stateStack,t.name,n.name);return tw(i.tokens,o),i.tokens}function Mb(e,t,n,s,r){const i=Ab(n,r),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=r,l=ew(e);let c=r.grammarState?Iae(r.grammarState,n.name)??L3:r.grammarContextCode!=null?Mb(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:L3,d=[];const h=[];for(let f=0,m=l.length;f<m;f++){const[p,y]=l[f];if(p===""){d=[],h.push([]);continue}if(o>0&&p.length>=o){d=[],h.push([{content:p,offset:y,color:"",fontStyle:0}]);continue}let w,b,v;r.includeExplanation&&(w=t.tokenizeLine(p,c),b=w.tokens,v=0);const x=t.tokenizeLine2(p,c,a),_=x.tokens.length/2;for(let E=0;E<_;E++){const k=x.tokens[2*E],M=E+1<_?x.tokens[2*E+2]:p.length;if(k===M)continue;const R=x.tokens[2*E+1],L=wd(s[$f.getForeground(R)],i),T=$f.getFontStyle(R),N={content:p.substring(k,M),offset:y+k,color:L,fontStyle:T};if(r.includeExplanation){const I=[];if(r.includeExplanation!=="scopeName")for(const U of n.settings){let F;switch(typeof U.scope){case"string":F=U.scope.split(/,/).map(j=>j.trim());break;case"object":F=U.scope;break;default:continue}I.push({settings:U,selectors:F.map(j=>j.split(/ /))})}N.explanation=[];let O=0;for(;k+O<M;){const U=b[v],F=p.substring(U.startIndex,U.endIndex);O+=F.length,N.explanation.push({content:F,scopes:r.includeExplanation==="scopeName"?Uae(U.scopes):Vae(I,U.scopes)}),v+=1}}d.push(N)}h.push(d),d=[],c=x.ruleStack}return{tokens:h,stateStack:c}}function Uae(e){return e.map(t=>({scopeName:t}))}function Vae(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const i=t[s];n[s]={scopeName:i,themeMatches:Gae(e,i,t.slice(0,s))}}return n}function AA(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Wae(e,t,n){if(!AA(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)AA(e[s],n[r])&&(s-=1),r-=1;return s===-1}function Gae(e,t,n){const s=[];for(const{selectors:r,settings:i}of e)for(const o of r)if(Wae(o,t,n)){s.push(i);break}return s}function $B(e,t,n){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),r=s.map(l=>{const c=d6(e,t,{...n,theme:l.theme}),d=gp(c),h=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:d,theme:h}}),i=Kae(...r.map(l=>l.tokens)),o=i[0].map((l,c)=>l.map((d,h)=>{const f={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=d.explanation),i.forEach((m,p)=>{const{content:y,explanation:w,offset:b,...v}=m[c][h];f.variants[s[p].color]=v}),f})),a=r[0].state?new dm(Object.fromEntries(r.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),r[0].state.lang):void 0;return a&&tw(o,a),o}function Kae(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(l=>l[s]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const o=r.map(()=>0),a=r.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const d=a[c];d.content.length===l?(i[c].push(d),o[c]+=1,a[c]=r[c][o[c]]):(i[c].push({...d,content:d.content.slice(0,l)}),a[c]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function Nb(e,t,n){let s,r,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:d="--shiki-"}=n,h=Object.entries(n.themes).filter(w=>w[1]).map(w=>({color:w[0],theme:w[1]})).sort((w,b)=>w.color===c?-1:b.color===c?1:0);if(h.length===0)throw new rc("`themes` option must not be empty");const f=$B(e,t,n);if(l=gp(f),c&&!h.find(w=>w.color===c))throw new rc(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=h.map(w=>e.getTheme(w.theme)),p=h.map(w=>w.color);i=f.map(w=>w.map(b=>Yae(b,p,d,c))),l&&tw(i,l);const y=h.map(w=>Ab(w.theme,n));r=h.map((w,b)=>(b===0&&c?"":`${d+w.color}:`)+(wd(m[b].fg,y[b])||"inherit")).join(";"),s=h.map((w,b)=>(b===0&&c?"":`${d+w.color}-bg:`)+(wd(m[b].bg,y[b])||"inherit")).join(";"),o=`shiki-themes ${m.map(w=>w.name).join(" ")}`,a=c?void 0:[r,s].join(";")}else if("theme"in n){const c=Ab(n.theme,n);i=d6(e,t,n);const d=e.getTheme(n.theme);s=wd(d.bg,c),r=wd(d.fg,c),o=d.name,l=gp(i)}else throw new rc("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:r,bg:s,themeName:o,rootStyle:a,grammarState:l}}function Yae(e,t,n,s){const r={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>OB(e.variants[l])),o=new Set(i.flatMap(l=>Object.keys(l))),a={};return i.forEach((l,c)=>{for(const d of o){const h=l[d]||"inherit";if(c===0&&s)a[d]=h;else{const f=d==="color"?"":d==="background-color"?"-bg":`-${d}`,m=n+t[c]+(d==="color"?"":f);a[m]=h}}}),r.htmlStyle=a,r}function Ib(e,t,n,s={meta:{},options:n,codeToHast:(r,i)=>Ib(e,r,i),codeToTokens:(r,i)=>Nb(e,r,i)}){var m,p;let r=t;for(const y of Eb(n))r=((m=y.preprocess)==null?void 0:m.call(s,r,n))||r;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:d}=Nb(e,r,n);const{mergeWhitespaces:h=!0}=n;h===!0?i=Xae(i):h==="never"&&(i=Jae(i));const f={...s,get source(){return r}};for(const y of Eb(n))i=((p=y.tokens)==null?void 0:p.call(f,i))||i;return Qae(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},f,d)}function Qae(e,t,n,s=gp(e)){var p,y,w;const r=Eb(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t;let c={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...l!==!1&&l!=null?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([b])=>!b.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const h=[],f={...n,structure:a,addClassToHast:LB,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return d},get lines(){return h}};if(e.forEach((b,v)=>{var E,k;v&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},_=0;for(const M of b){let R={type:"element",tagName:"span",properties:{...M.htmlAttrs},children:[{type:"text",value:M.content}]};M.htmlStyle;const L=Mae(M.htmlStyle||OB(M));L&&(R.properties.style=L);for(const T of r)R=((E=T==null?void 0:T.span)==null?void 0:E.call(f,R,v+1,_,x,M))||R;a==="inline"?o.children.push(R):a==="classic"&&x.children.push(R),_+=M.content.length}if(a==="classic"){for(const M of r)x=((k=M==null?void 0:M.line)==null?void 0:k.call(f,x,v+1))||x;h.push(x),i.push(x)}}),a==="classic"){for(const b of r)d=((p=b==null?void 0:b.code)==null?void 0:p.call(f,d))||d;c.children.push(d);for(const b of r)c=((y=b==null?void 0:b.pre)==null?void 0:y.call(f,c))||c;o.children.push(c)}let m=o;for(const b of r)m=((w=b==null?void 0:b.root)==null?void 0:w.call(f,m))||m;return s&&tw(m,s),m}function Xae(e){return e.map(t=>{const n=[];let s="",r=0;return t.forEach((i,o)=>{const l=!(i.fontStyle&&i.fontStyle&Jl.Underline);l&&i.content.match(/^\s+$/)&&t[o+1]?(r||(r=i.offset),s+=i.content):s?(l?n.push({...i,offset:r,content:s+i.content}):n.push({content:s,offset:r},i),r=0,s=""):n.push(i)}),n})}function Jae(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[,r,i,o]=s;if(!r&&!o)return n;const a=[{...n,offset:n.offset+r.length,content:i}];return r&&a.unshift({content:r,offset:n.offset}),o&&a.push({content:o,offset:n.offset+r.length+i.length}),a}))}function Zae(e,t,n){var i;const s={meta:{},options:n,codeToHast:(o,a)=>Ib(e,o,a),codeToTokens:(o,a)=>Nb(e,o,a)};let r=kae(Ib(e,t,n,s));for(const o of Eb(n))r=((i=o.postprocess)==null?void 0:i.call(s,r,n))||r;return r}const EA={light:"#333333",dark:"#bbbbbb"},MA={light:"#fffffe",dark:"#1e1e1e"},NA="__shiki_resolved";function h6(e){var a,l,c,d,h;if(e!=null&&e[NA])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(m=>!m.name&&!m.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&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?EA.light:EA.dark),n||(n=t.type==="light"?MA.light:MA.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 r=0;const i=new Map;function o(f){var p;if(i.has(f))return i.get(f);r+=1;const m=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return(p=t.colorReplacements)!=null&&p[`#${m}`]?o(f):(i.set(f,m),m)}t.settings=t.settings.map(f=>{var w,b;const m=((w=f.settings)==null?void 0:w.foreground)&&!f.settings.foreground.startsWith("#"),p=((b=f.settings)==null?void 0:b.background)&&!f.settings.background.startsWith("#");if(!m&&!p)return f;const y={...f,settings:{...f.settings}};if(m){const v=o(f.settings.foreground);t.colorReplacements[v]=f.settings.foreground,y.settings.foreground=v}if(p){const v=o(f.settings.background);t.colorReplacements[v]=f.settings.background,y.settings.background=v}return y});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((h=t.colors[f])!=null&&h.startsWith("#"))){const m=o(t.colors[f]);t.colorReplacements[m]=t.colors[f],t.colors[f]=m}return Object.defineProperty(t,NA,{enumerable:!1,writable:!1,value:!0}),t}async function zB(e){return Array.from(new Set((await Promise.all(e.filter(t=>!jB(t)).map(async t=>await DB(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function FB(e){return(await Promise.all(e.map(async n=>RB(n)?null:h6(await DB(n))))).filter(n=>!!n)}class ele extends _oe{constructor(n,s,r,i={}){super(n);ye(this,"_resolvedThemes",new Map);ye(this,"_resolvedGrammars",new Map);ye(this,"_langMap",new Map);ye(this,"_langGraph",new Map);ye(this,"_textmateThemeCache",new WeakMap);ye(this,"_loadedThemesCache",null);ye(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=s,this._langs=r,this._alias=i,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const s=h6(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=_b.createFromRawTheme(n),this._textmateThemeCache.set(n,s)),this._syncRegistry.setTheme(s)}getGrammar(n){if(this._alias[n]){const s=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],s.has(n))throw new Bi(`Circular alias \`${Array.from(s).join(" -> ")} -> ${n}\``);s.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,l,c;if(this.getGrammar(n.name))return;const s=new Set([...this._langMap.values()].filter(d=>{var h;return(h=d.embeddedLangsLazy)==null?void 0:h.includes(n.name)}));this._resolver.addLanguage(n);const r={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,r);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(d=>{this._alias[d]=n.name}),this._loadedLanguagesCache=null,s.size)for(const d of s)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.delete(d.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(d.scopeName),this.loadLanguage(this._langMap.get(d.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const s=Array.from(this._langGraph.entries()),r=s.filter(([i,o])=>!o);if(r.length){const i=s.filter(([o,a])=>{var l;return a&&((l=a.embeddedLangs)==null?void 0:l.some(c=>r.map(([d])=>d).includes(c)))}).filter(o=>!r.includes(o));throw new Bi(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of s)this._resolver.addLanguage(o);for(const[i,o]of s)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){if(this._langMap.set(n.name,n),this._langGraph.set(n.name,n),n.embeddedLangs)for(const s of n.embeddedLangs)this._langGraph.set(s,this._langMap.get(s))}}class tle{constructor(t,n){ye(this,"_langs",new Map);ye(this,"_scopeToLang",new Map);ye(this,"_injections",new Map);ye(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 r=1;r<=n.length;r++){const i=n.slice(0,r).join(".");s=[...s,...this._injections.get(i)||[]]}return s}}let $m=0;function nle(e){$m+=1,e.warnings!==!1&&$m>=10&&$m%10===0&&console.warn(`[Shiki] ${$m} 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 Bi("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(h6),r=new tle(e.engine,n),i=new ele(r,s,n,e.langAlias);let o;function a(v){w();const x=i.getGrammar(typeof v=="string"?v:v.name);if(!x)throw new Bi(`Language \`${v}\` not found, you may need to load it first`);return x}function l(v){if(v==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const x=i.getTheme(v);if(!x)throw new Bi(`Theme \`${v}\` not found, you may need to load it first`);return x}function c(v){w();const x=l(v);o!==v&&(i.setTheme(x),o=v);const _=i.getColorMap();return{theme:x,colorMap:_}}function d(){return w(),i.getLoadedThemes()}function h(){return w(),i.getLoadedLanguages()}function f(...v){w(),i.loadLanguages(v.flat(1))}async function m(...v){return f(await zB(v))}function p(...v){w();for(const x of v.flat(1))i.loadTheme(x)}async function y(...v){return w(),p(await FB(v))}function w(){if(t)throw new Bi("Shiki instance has been disposed")}function b(){t||(t=!0,i.dispose(),$m-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:h,loadLanguage:m,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:b,[Symbol.dispose]:b}}async function sle(e={}){e.loadWasm;const[t,n,s]=await Promise.all([FB(e.themes||[]),zB(e.langs||[]),e.engine||dB(e.loadWasm||Oie())]);return nle({...e,themes:t,langs:n,engine:s})}async function rle(e={}){const t=await sle(e);return{getLastGrammarState:(...n)=>qae(t,...n),codeToTokensBase:(n,s)=>d6(t,n,s),codeToTokensWithThemes:(n,s)=>$B(t,n,s),codeToTokens:(n,s)=>Nb(t,n,s),codeToHast:(n,s)=>Ib(t,n,s),codeToHtml:(n,s)=>Zae(t,n,s),...t,getInternalContext:()=>t}}function ile(e,t,n){let s,r,i;{const a=e;s=a.langs,r=a.themes,i=a.engine}async function o(a){function l(m){if(typeof m=="string"){if(jB(m))return[];const p=s[m];if(!p)throw new rc(`Language \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}function c(m){if(RB(m))return"none";if(typeof m=="string"){const p=r[m];if(!p)throw new rc(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}const d=(a.themes??[]).map(m=>c(m)),h=(a.langs??[]).map(m=>l(m)),f=await rle({engine:a.engine??i(),...a,themes:d,langs:h});return{...f,loadLanguage(...m){return f.loadLanguage(...m.map(l))},loadTheme(...m){return f.loadTheme(...m.map(c))}}}return o}const ole=ile({langs:gie,themes:bie,engine:()=>dB(K(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const ale=["github-light-default","github-dark-default"];let h1=null,O3=null;const B3=new Set,Ix=new Map,IA=new Set,lle=128,i0=new Map;function qB(e,t,n){return`${t}\0${n}\0${e}`}function cle(e,t){if(i0.size>=lle){const n=i0.keys().next().value;n!==void 0&&i0.delete(n)}i0.set(e,t)}function ule(e,t,n){return i0.get(qB(e,t,n))??null}function dle(){return h1||(h1=ole({langs:[],themes:ale}).then(e=>(O3=e,e)).catch(e=>{throw h1=null,e})),h1}async function hle(e){const t=await dle();if(B3.has(e))return t;if(IA.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=Ix.get(e);return n||(n=t.loadLanguage(e).then(()=>{B3.add(e)}).catch(s=>{throw IA.add(e),s}).finally(()=>{Ix.delete(e)}),Ix.set(e,n)),await n,t}const fle=1e5,mle=2e4;function ple(e){if(e.length>fle)return!0;let t=0;const n=e.length;for(let s=0;s<=n;s++)if(s===n||e.charCodeAt(s)===10){if(s-t>mle)return!0;t=s+1}return!1}function jA(e,t,n,s=!0){if(O3&&B3.has(t))try{const r=O3.codeToHtml(e,{lang:t,theme:n});return s&&cle(qB(e,t,n),r),r}catch(r){return console.warn("[web-shell] sync highlight failed for lang=%s",t,r),null}return null}const gle="_tableShell_196lm_1",yle="_toolbar_196lm_11",ble="_summary_196lm_22",vle="_hint_196lm_27",wle="_selection_196lm_31",xle="_copyButton_196lm_36",_le="_secondaryButton_196lm_37",kle="_primaryButton_196lm_38",Sle="_copyCheck_196lm_47",Tle="_scroller_196lm_71",Cle="_table_196lm_1",Ale="_headerCell_196lm_93",Ele="_cell_196lm_94",Mle="_frozenHeaderCell_196lm_117",Nle="_headerControls_196lm_122",Ile="_headerButton_196lm_128",jle="_filterTrigger_196lm_145",Rle="_headerText_196lm_149",Lle="_sortIcon_196lm_156",Dle="_activeHeaderCell_196lm_172",Ole="_reorderHandle_196lm_176",Ble="_reorderHandleVisible_196lm_199",Ple="_resizeHandle_196lm_219",$le="_filterTriggerActive_196lm_238",zle="_filterMenu_196lm_243",Fle="_filterMenuTitle_196lm_259",qle="_filterMenuSection_196lm_269",Hle="_filterMenuAction_196lm_277",Ule="_activeAction_196lm_290",Vle="_filterSearch_196lm_299",Wle="_conditionInput_196lm_300",Gle="_conditionSelect_196lm_301",Kle="_filterOptionList_196lm_317",Yle="_filterOption_196lm_317",Qle="_optionLabel_196lm_343",Xle="_optionCount_196lm_351",Jle="_optionLimitHint_196lm_357",Zle="_conditionTitle_196lm_363",ece="_conditionInputs_196lm_368",tce="_filterFooter_196lm_373",nce="_footerSpacer_196lm_380",sce="_dragging_196lm_397",rce="_evenRow_196lm_401",ice="_selectedCell_196lm_409",oce="_actionHeaderCell_196lm_416",ace="_actionCell_196lm_417",lce="_stickyActionHeaderCell_196lm_424",cce="_stickyActionCell_196lm_425",uce="_frozenCell_196lm_441",dce="_rowDetailButton_196lm_485",hce="_detailRow_196lm_500",fce="_detailCell_196lm_504",mce="_detailPanel_196lm_511",pce="_detailTitle_196lm_517",gce="_detailItem_196lm_522",yce="_detailLabel_196lm_528",bce="_detailValue_196lm_533",vce="_emptyState_196lm_540",it={tableShell:gle,toolbar:yle,summary:ble,hint:vle,selection:wle,copyButton:xle,secondaryButton:_le,primaryButton:kle,copyCheck:Sle,scroller:Tle,table:Cle,headerCell:Ale,cell:Ele,frozenHeaderCell:Mle,headerControls:Nle,headerButton:Ile,filterTrigger:jle,headerText:Rle,sortIcon:Lle,activeHeaderCell:Dle,reorderHandle:Ole,reorderHandleVisible:Ble,resizeHandle:Ple,filterTriggerActive:$le,filterMenu:zle,filterMenuTitle:Fle,filterMenuSection:qle,filterMenuAction:Hle,activeAction:Ule,filterSearch:Vle,conditionInput:Wle,conditionSelect:Gle,filterOptionList:Kle,filterOption:Yle,optionLabel:Qle,optionCount:Xle,optionLimitHint:Jle,conditionTitle:Zle,conditionInputs:ece,filterFooter:tce,footerSpacer:nce,dragging:sce,evenRow:rce,selectedCell:ice,actionHeaderCell:oce,actionCell:ace,stickyActionHeaderCell:lce,stickyActionCell:cce,frozenCell:uce,rowDetailButton:dce,detailRow:hce,detailCell:fce,detailPanel:mce,detailTitle:pce,detailItem:gce,detailLabel:yce,detailValue:bce,emptyState:vce},wce={contains:"markdownTable.filter.text.contains",equals:"markdownTable.filter.text.equals",notEquals:"markdownTable.filter.text.notEquals",startsWith:"markdownTable.filter.text.startsWith",endsWith:"markdownTable.filter.text.endsWith"},xce={gt:"markdownTable.filter.number.gt",gte:"markdownTable.filter.number.gte",lt:"markdownTable.filter.number.lt",lte:"markdownTable.filter.number.lte",between:"markdownTable.filter.number.between"},_ce=500,kce=50,vu=160,HB=80,UB=640,RA=16,VB="application/x-qwen-web-shell-table-column",LA={width:vu,minWidth:vu,maxWidth:vu};function DA(e){return Math.min(UB,Math.max(HB,e))}const Sce='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Tce(e){return Array.from(e.querySelectorAll(Sce)).filter(t=>!t.hasAttribute("hidden"))}function OA(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function Cce(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function _d(e,t){return g.isValidElement(e)&&e.type===t}function Ace(e){return e.replace(/\s+/g," ").trim()}function P3(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(P3).join(""):g.isValidElement(e)?e.type==="img"?e.props.alt??"":P3(e.props.children):""}function Ece(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",isHeader:!1}}function WB(e,t){const n=g.Children.toArray(e.props.children).filter(s=>_d(s,"td")||_d(s,"th"));return{key:t,cells:n.map((s,r)=>{var i;return{key:`${t}-${r}`,content:s.props.children,text:Ace(P3(s.props.children)),isHeader:s.type==="th",textAlign:(i=s.props.style)==null?void 0:i.textAlign}})}}function jx(e,t){return g.Children.toArray(e.props.children).filter(n=>_d(n,"tr")).map((n,s)=>WB(n,`${t}-${s}`))}function Mce(e,t){return{...e,cells:Array.from({length:t},(n,s)=>e.cells[s]??Ece(e.key,s))}}function Nce(e,t){const n=g.Children.toArray(e),s=[],r=[],i=[];if(n.forEach((d,h)=>{_d(d,"thead")?s.push(...jx(d,`head-${h}`)):_d(d,"tbody")?r.push(...jx(d,`body-${h}`)):_d(d,"tfoot")?r.push(...jx(d,`foot-${h}`)):_d(d,"tr")&&i.push(WB(d,`row-${h}`))}),i.length>0){const[d,...h]=i;d!=null&&d.cells.some(f=>f.isHeader)?(s.push(d),r.push(...h)):r.push(...i)}const o=[...s,...r],a=Math.max(0,...o.map(d=>d.cells.length)),l=s[0];return{headers:Array.from({length:a},(d,h)=>{const f=l==null?void 0:l.cells[h];if(f)return f;const m=t(h);return{key:`header-${h}`,content:m,text:m,isHeader:!0}}),rows:r.map(d=>Mce(d,a)),columnCount:a}}function wu(e){const t=e.trim(),n=t.endsWith("%"),r=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(r))return null;const i=Number(r);return n?i/100:i}function GB(e,t){const n=wu(e),s=wu(t);return n!==null&&s!==null&&n!==s?n-s:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function f6(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function m6(e,t){if(!e)return[];const n=t.indexOf(e.anchorCol),s=t.indexOf(e.focusCol);if(n===-1||s===-1)return[];const r=Math.min(n,s),i=Math.max(n,s);return t.slice(r,i+1)}function $3(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"");return/^[=+\-@]/.test(t)?`'${e}`:e}function BA(e,t,n){if((e[t]??vu)===n)return e;if(n===vu){const r={...e};return delete r[t],r}return{...e,[t]:n}}function PA(e,t,n){if(!e)return"";const{minRow:s,maxRow:r}=f6(e),i=m6(e,n);if(i.length===0)return"";const o=[];for(let a=s;a<=r;a++){const l=t[a];l&&o.push(i.map(c=>{var d;return $3(((d=l.cells[c])==null?void 0:d.text)??"")}).join("	"))}return o.join(`
`)}function Ice(e,t,n){return n.length===0?"":[n.map(r=>{var i;return $3(((i=e[r])==null?void 0:i.text)??"")}).join("	"),...t.map(r=>n.map(i=>{var o;return $3(((o=r.cells[i])==null?void 0:o.text)??"")}).join("	"))].join(`
`)}function jce(e,t){if(!e)return 0;const{minRow:n,maxRow:s}=f6(e),r=m6(e,t).length;return(s-n+1)*r}function $A(e,t,n){if(t===n)return e;const s=e.indexOf(t),r=e.indexOf(n);if(s===-1||r===-1)return e;const i=[...e],[o]=i.splice(s,1);return o===void 0?e:(i.splice(r,0,o),i)}function Rce(e,t,n,s){if(s.size===0)return $A(e,t,n);const r=e.filter(a=>!s.has(a)),i=$A(r,t,n);if(i===r)return e;let o=0;return e.map(a=>{if(s.has(a))return a;const l=i[o];return o+=1,l??a})}function zA(e){return Array.from({length:e},(t,n)=>n)}function FA(e){return Array.from(e.types).includes(VB)}function $0(e){var t,n;return e?!!(e.selectedValues!==void 0||(t=e.textFilter)!=null&&t.value.trim()||(n=e.numberFilter)!=null&&n.value.trim()):!1}function Lce(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),s=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===s;case"notEquals":return n!==s;case"startsWith":return n.startsWith(s);case"endsWith":return n.endsWith(s);case"contains":default:return n.includes(s)}}function Dce(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=wu(e),s=wu(t.value);if(n===null||s===null)return!1;switch(t.operator){case"gt":return n>s;case"gte":return n>=s;case"lt":return n<s;case"lte":return n<=s;case"between":{const r=wu(t.valueTo??"");if(r===null)return!1;const i=Math.min(s,r),o=Math.max(s,r);return n>=i&&n<=o}default:return!0}}function Oce(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:Lce(e,t.textFilter)&&Dce(e,t.numberFilter)}function qA(e,t,n){const s=Object.entries(t).map(([r,i])=>[Number(r),i]).filter(([r,i])=>r!==n&&$0(i));return s.length===0?e:e.filter(r=>s.every(([i,o])=>{var a;return Oce(((a=r.cells[i])==null?void 0:a.text)??"",o)}))}function Bce(e,t){return t?e.map((n,s)=>({row:n,index:s})).sort((n,s)=>{var o,a;const r=GB(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((a=s.row.cells[t.columnIndex])==null?void 0:a.text)??""),i=t.direction==="asc"?r:-r;return i===0?n.index-s.index:i}).map(({row:n})=>n):e}function Pce(e,t,n){const s=new Map;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";s.set(i,(s.get(i)??0)+1)}),Array.from(s.entries()).map(([r,i])=>({value:r,label:r||n,count:i})).sort((r,i)=>GB(r.value,i.value))}function $ce(e,t){let n=0,s=0;return e.forEach(r=>{var o;const i=((o=r.cells[t])==null?void 0:o.text)??"";i&&(n+=1,wu(i)!==null&&(s+=1))}),n>0&&s/n>=.7}function zce(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(s=>n.has(s))}function Fce(e,t){var s,r,i;const n={};if(e.selectedValues!==void 0&&!zce(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(s=e.textFilter)!=null&&s.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(r=e.numberFilter)!=null&&r.value.trim()){const o=e.numberFilter.value.trim(),a=(i=e.numberFilter.valueTo)==null?void 0:i.trim();wu(o)!==null&&(e.numberFilter.operator!=="between"||wu(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return $0(n)?n:void 0}function qce({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:s}=Xe();return u.jsxs("div",{className:it.filterMenuSection,children:[u.jsx("button",{className:`${it.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?it.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:s("markdownTable.sort.asc")}),u.jsx("button",{className:`${it.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?it.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:s("markdownTable.sort.desc")}),u.jsx("button",{className:it.filterMenuAction,type:"button",onClick:()=>n(e,null),children:s("markdownTable.sort.clear")})]})}function Hce({onHideColumn:e}){const{t}=Xe();return u.jsx("div",{className:it.filterMenuSection,children:u.jsx("button",{className:it.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function Uce({columnIndex:e,columnName:t,search:n,searchInputRef:s,filteredOptions:r,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:l,onFilteredSelectionChange:c,onToggleValue:d}){const{t:h}=Xe();return u.jsxs("div",{className:it.filterMenuSection,children:[u.jsx("input",{ref:s,className:it.filterSearch,value:n,onChange:f=>l(f.currentTarget.value),placeholder:h("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":h("markdownTable.filter.searchAria",{column:t})}),u.jsxs("label",{className:it.filterOption,children:[u.jsx("input",{type:"checkbox",name:`markdown-table-filter-all-${e}`,checked:a,onChange:f=>c(f.currentTarget.checked)}),u.jsx("span",{children:h("markdownTable.filter.selectVisible")}),u.jsx("span",{className:it.optionCount,children:r.length})]}),u.jsxs("div",{className:it.filterOptionList,children:[i.map((f,m)=>u.jsxs("label",{className:it.filterOption,children:[u.jsx("input",{type:"checkbox",name:`markdown-table-filter-option-${e}-${m}`,checked:o.has(f.value),onChange:()=>d(f.value)}),u.jsx("span",{className:it.optionLabel,children:f.label}),u.jsx("span",{className:it.optionCount,children:f.count})]},f.value)),r.length>i.length&&u.jsx("div",{className:it.optionLimitHint,children:h("markdownTable.filter.optionLimit",{count:i.length})}),r.length===0&&u.jsx("div",{className:it.optionLimitHint,children:h("markdownTable.filter.noOptions")})]})]})}function Vce({columnIndex:e,columnName:t,isNumeric:n,textOperator:s,textValue:r,numberOperator:i,numberValue:o,numberValueTo:a,onTextOperatorChange:l,onTextValueChange:c,onNumberOperatorChange:d,onNumberValueChange:h,onNumberValueToChange:f}){const{t:m}=Xe();return u.jsxs("div",{className:it.filterMenuSection,children:[u.jsx("div",{className:it.conditionTitle,children:m("markdownTable.filter.custom")}),n?u.jsxs(u.Fragment,{children:[u.jsx("select",{className:it.conditionSelect,value:i,name:`markdown-table-number-operator-${e}`,onChange:p=>d(p.currentTarget.value),"aria-label":m("markdownTable.filter.numberAria",{column:t}),children:Object.entries(xce).map(([p,y])=>u.jsx("option",{value:p,children:m(y)},p))}),u.jsxs("div",{className:it.conditionInputs,children:[u.jsx("input",{className:it.conditionInput,value:o,onChange:p=>h(p.currentTarget.value),placeholder:m("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${e}`}),i==="between"&&u.jsx("input",{className:it.conditionInput,value:a,onChange:p=>f(p.currentTarget.value),placeholder:m("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${e}`})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("select",{className:it.conditionSelect,value:s,name:`markdown-table-text-operator-${e}`,onChange:p=>l(p.currentTarget.value),"aria-label":m("markdownTable.filter.textAria",{column:t}),children:Object.entries(wce).map(([p,y])=>u.jsx("option",{value:p,children:m(y)},p))}),u.jsx("input",{className:it.conditionInput,value:r,onChange:p=>c(p.currentTarget.value),placeholder:m("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function Wce({onClear:e,onClose:t,onApply:n}){const{t:s}=Xe();return u.jsxs("div",{className:it.filterFooter,children:[u.jsx("button",{className:it.secondaryButton,type:"button",onClick:e,children:s("markdownTable.filter.reset")}),u.jsx("span",{className:it.footerSpacer}),u.jsx("button",{className:it.secondaryButton,type:"button",onClick:t,children:s("markdownTable.filter.cancel")}),u.jsx("button",{className:it.primaryButton,type:"button",onClick:n,children:s("markdownTable.filter.confirm")})]})}function Gce({id:e,columnName:t,columnIndex:n,filter:s,isNumeric:r,options:i,sort:o,style:a,menuRef:l,canHideColumn:c,onApply:d,onClose:h,onHideColumn:f,onSort:m}){var B,C,z,X,ae;const p=g.useMemo(()=>i.map(be=>be.value),[i]),[y,w]=g.useState(""),[b,v]=g.useState(()=>new Set((s==null?void 0:s.selectedValues)??p)),[x,_]=g.useState(((B=s==null?void 0:s.textFilter)==null?void 0:B.operator)??"contains"),[E,k]=g.useState(((C=s==null?void 0:s.textFilter)==null?void 0:C.value)??""),[M,R]=g.useState(((z=s==null?void 0:s.numberFilter)==null?void 0:z.operator)??"gt"),[L,T]=g.useState(((X=s==null?void 0:s.numberFilter)==null?void 0:X.value)??""),[N,I]=g.useState(((ae=s==null?void 0:s.numberFilter)==null?void 0:ae.valueTo)??""),O=g.useRef(null);g.useEffect(()=>{var be;(be=O.current)==null||be.focus()},[]);const U=g.useMemo(()=>{const be=y.trim().toLowerCase();return be?i.filter(fe=>fe.label.toLowerCase().includes(be)):i},[i,y]),F=U.slice(0,500),j=U.length>0&&U.every(be=>b.has(be.value)),V=be=>{v(fe=>{const ie=new Set(fe);return U.forEach(G=>{be?ie.add(G.value):ie.delete(G.value)}),ie})},ee=be=>{v(fe=>{const ie=new Set(fe);return ie.has(be)?ie.delete(be):ie.add(be),ie})},ce=()=>{d(n,Fce({selectedValues:Array.from(b),textFilter:{operator:x,value:E},numberFilter:{operator:M,value:L,valueTo:N}},p))},$=()=>{d(n,void 0)},J=(o==null?void 0:o.columnIndex)===n?o:null;return u.jsxs("div",{ref:l,id:e,className:it.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[u.jsx("div",{id:`${e}-title`,className:it.filterMenuTitle,children:t}),u.jsx(qce,{columnIndex:n,sortedThisColumn:J,onSort:m}),c&&u.jsx(Hce,{onHideColumn:()=>f(n)}),u.jsx(Uce,{columnIndex:n,columnName:t,search:y,searchInputRef:O,filteredOptions:U,visibleOptions:F,selectedValues:b,allFilteredSelected:j,onSearchChange:w,onFilteredSelectionChange:V,onToggleValue:ee}),u.jsx(Vce,{columnIndex:n,columnName:t,isNumeric:r,textOperator:x,textValue:E,numberOperator:M,numberValue:L,numberValueTo:N,onTextOperatorChange:_,onTextValueChange:k,onNumberOperatorChange:R,onNumberValueChange:T,onNumberValueToChange:I}),u.jsx(Wce,{onClear:$,onClose:h,onApply:ce})]})}function Kce({children:e,fallback:t,toolbarExtra:n}){const{t:s}=Xe(),r=g.useMemo(()=>Nce(e,i=>s("markdownTable.column",{index:i+1})),[e,s]);return r.columnCount===0?u.jsx(u.Fragment,{children:t??u.jsx("table",{children:e})}):r.rows.length>_ce||r.columnCount>kce?u.jsx(u.Fragment,{children:t??u.jsx("table",{children:e})}):u.jsx(Yce,{table:r,toolbarExtra:n})}function Yce({table:e,toolbarExtra:t}){const{t:n}=Xe(),s=g.useId(),[r,i]=g.useState(null),[o,a]=g.useState({}),[l,c]=g.useState(null),[d,h]=g.useState(null),[f,m]=g.useState(()=>new Set),[p,y]=g.useState({}),[w,b]=g.useState(()=>zA(e.columnCount)),[v,x]=g.useState(null),[_,E]=g.useState(!1),[k,M]=g.useState(null),[R,L]=g.useState(null),[T,N]=g.useState(!1),[I,O]=g.useState(!1),[U,F]=g.useState(!1),j=g.useRef(!1),V=g.useRef(null),ee=g.useRef(null),ce=g.useRef(0),$=g.useRef(0),J=g.useRef(!0),B=g.useRef(null),C=g.useRef(null),z=g.useRef(null),X=g.useRef(null),ae=g.useRef(0),be=g.useRef(null),fe=g.useRef(0),ie=g.useRef(0),G=g.useRef(null),q=g.useRef(null),le=g.useMemo(()=>`${e.columnCount}\0${e.headers.map(oe=>oe.text).join("\0")}`,[e.columnCount,e.headers]),Se=g.useRef(le),$e=g.useCallback(()=>{ae.current&&cancelAnimationFrame(ae.current),ae.current=requestAnimationFrame(()=>{ae.current=0;const oe=X.current;oe!=null&&oe.isConnected&&oe.focus()})},[]),Ae=g.useCallback(()=>{h(null),$e()},[$e]),we=g.useCallback(()=>{ce.current+=1,V.current&&(clearTimeout(V.current),V.current=null),O(!1)},[]),ct=g.useCallback(()=>{$.current+=1,ee.current&&(clearTimeout(ee.current),ee.current=null),F(!1)},[]),ht=g.useCallback(()=>{fe.current&&(cancelAnimationFrame(fe.current),fe.current=0);const oe=be.current;be.current=null,oe&&c(_e=>_e&&{..._e,focusRow:oe.rowIndex,focusCol:oe.columnIndex})},[]),ut=g.useCallback(()=>{ht(),j.current=!1,N(!1)},[ht]);g.useEffect(()=>{const oe=()=>{document.hidden&&ut()};return window.addEventListener("mouseup",ut),window.addEventListener("blur",ut),document.addEventListener("visibilitychange",oe),()=>{window.removeEventListener("mouseup",ut),window.removeEventListener("blur",ut),document.removeEventListener("visibilitychange",oe),fe.current&&cancelAnimationFrame(fe.current),ae.current&&cancelAnimationFrame(ae.current)}},[ut]),g.useEffect(()=>{Se.current!==le&&(Se.current=le,i(null),a({}),c(null),h(null),m(new Set),y({}),b(zA(e.columnCount)),x(null),E(!1),M(null),L(null),we(),ct(),j.current=!1,q.current=null,N(!1))},[ct,we,e.columnCount,le]),g.useEffect(()=>{ct()},[ct,l]),g.useEffect(()=>(J.current=!0,()=>{J.current=!1,V.current&&(clearTimeout(V.current),V.current=null),ee.current&&(clearTimeout(ee.current),ee.current=null)}),[]),g.useEffect(()=>{if(!d)return;const oe=Le=>{var dt,Ft;const wt=Le.target;!((dt=z.current)!=null&&dt.contains(wt))&&!((Ft=X.current)!=null&&Ft.contains(wt))&&h(null)},_e=Le=>{var pn;if(Le.key==="Escape"){Le.preventDefault(),Ae();return}if(Le.key!=="Tab")return;const wt=z.current,dt=document.activeElement;if(!wt||!(dt instanceof Node)||!wt.contains(dt))return;const Ft=Tce(wt);if(Ft.length===0)return;const on=dt instanceof HTMLElement?Ft.indexOf(dt):-1,Ks=Le.shiftKey?on<=0?Ft.length-1:on-1:on===-1||on===Ft.length-1?0:on+1;Le.preventDefault(),(pn=Ft[Ks])==null||pn.focus()},se=Le=>{var dt;const wt=Le.target;wt instanceof Node&&((dt=z.current)!=null&&dt.contains(wt))||h(null)},pe=()=>h(null);return document.addEventListener("mousedown",oe),document.addEventListener("keydown",_e),document.addEventListener("scroll",se,!0),window.addEventListener("resize",pe),()=>{document.removeEventListener("mousedown",oe),document.removeEventListener("keydown",_e),document.removeEventListener("scroll",se,!0),window.removeEventListener("resize",pe)}},[Ae,d]),g.useEffect(()=>{const oe=se=>{var Le;const pe=se.target;pe instanceof Node&&!((Le=B.current)!=null&&Le.contains(pe))&&x(null)},_e=se=>{se.defaultPrevented||d||se.key==="Escape"&&x(null)};return document.addEventListener("mousedown",oe),document.addEventListener("keydown",_e),()=>{document.removeEventListener("mousedown",oe),document.removeEventListener("keydown",_e)}},[d]);const ft=g.useMemo(()=>qA(e.rows,o),[o,e.rows]),tt=g.useMemo(()=>Bce(ft,r),[ft,r]),qt=g.useMemo(()=>{if(!d)return[];const oe=d.columnIndex;return Pce(qA(e.rows,o,oe),oe,n("markdownTable.blank"))},[o,d,n,e.rows]),Ye=g.useMemo(()=>e.headers.map((oe,_e)=>$ce(e.rows,_e)),[e.headers,e.rows]),ge=g.useMemo(()=>w.filter(oe=>oe>=0&&oe<e.columnCount).filter(oe=>!f.has(oe)),[w,f,e.columnCount]),st=_?ge[0]:void 0;g.useEffect(()=>{we()},[we,ge,tt]),g.useEffect(()=>{if(!k)return;const oe=()=>{const Le=G.current;G.current=null,ie.current&&(cancelAnimationFrame(ie.current),ie.current=0),Le!==null&&y(wt=>BA(wt,k.columnIndex,Le))},_e=Le=>{G.current=DA(k.startWidth+Le.clientX-k.startX),!ie.current&&(ie.current=requestAnimationFrame(oe))},se=()=>{oe(),M(null)},pe=()=>{document.hidden&&se()};return window.addEventListener("mousemove",_e),window.addEventListener("mouseup",se),window.addEventListener("blur",se),document.addEventListener("visibilitychange",pe),()=>{window.removeEventListener("mousemove",_e),window.removeEventListener("mouseup",se),window.removeEventListener("blur",se),document.removeEventListener("visibilitychange",pe),ie.current&&(cancelAnimationFrame(ie.current),ie.current=0),G.current=null}},[k]),g.useEffect(()=>{R&&!tt.some(oe=>oe.key===R)&&L(null)},[R,tt]);const ne=(oe,_e)=>{c(null),a(se=>{const pe={...se};return _e&&$0(_e)?pe[oe]=_e:delete pe[oe],pe}),Ae()},ue=(oe,_e)=>{c(null),x(oe),i(_e?{columnIndex:oe,direction:_e}:null)},Re=oe=>{c(null),x(oe),i(_e=>(_e==null?void 0:_e.columnIndex)!==oe?{columnIndex:oe,direction:"asc"}:_e.direction==="asc"?{columnIndex:oe,direction:"desc"}:null)},rt=(oe,_e)=>{c(null),x(_e),X.current=oe.currentTarget;const se=oe.currentTarget.getBoundingClientRect(),pe=300,Le=430,wt={columnIndex:_e,left:Math.max(6,Math.min(se.right-pe,window.innerWidth-pe-6)),top:window.innerHeight-se.bottom<Le?Math.max(8,se.top-Le-2):se.bottom+2};h(dt=>(dt==null?void 0:dt.columnIndex)===_e?null:wt)},vt=oe=>{ge.length<=1||(c(null),x(_e=>_e===oe?null:_e),Ae(),a(_e=>{const se={..._e};return delete se[oe],se}),i(_e=>(_e==null?void 0:_e.columnIndex)===oe?null:_e),m(_e=>{const se=new Set(_e);return se.add(oe),se}))},tn=()=>{c(null),m(new Set)},jn=()=>{E(oe=>!oe)},ln=oe=>{c(null),L(_e=>_e===oe?null:oe)},Pn=g.useMemo(()=>l?f6(l):null,[l]),Qt=g.useMemo(()=>new Set(m6(l,ge)),[l,ge]),ve=(oe,_e)=>{if(!Pn)return!1;const{minRow:se,maxRow:pe}=Pn;return oe>=se&&oe<=pe&&Qt.has(_e)},Be=(oe,_e)=>{const se=p[oe];return se===void 0?_e?{...LA,..._e}:LA:{width:se,minWidth:se,maxWidth:se,..._e}},He=(oe,_e)=>{oe.preventDefault(),oe.stopPropagation(),M({columnIndex:_e,startX:oe.clientX,startWidth:p[_e]??vu})},Ht=(oe,_e)=>{if(oe.ctrlKey||oe.metaKey||oe.altKey||oe.shiftKey)return;let se=0;oe.key==="ArrowRight"?se=RA:oe.key==="ArrowLeft"&&(se=-RA),se!==0&&(oe.preventDefault(),oe.stopPropagation(),y(pe=>{const Le=pe[_e]??vu,wt=DA(Le+se);return BA(pe,_e,wt)}))},Yn=(oe,_e)=>{oe.stopPropagation(),x(_e),q.current=_e,oe.dataTransfer.effectAllowed="move",oe.dataTransfer.setData(VB,String(_e))},Wt=()=>{q.current=null},ss=oe=>{q.current===null||!FA(oe.dataTransfer)||(oe.preventDefault(),oe.dataTransfer.dropEffect="move")},Mt=(oe,_e)=>{const se=q.current;Wt(),!(se===null||!FA(oe.dataTransfer))&&(oe.preventDefault(),oe.stopPropagation(),c(null),x(se),b(pe=>Rce(pe,se,_e,f)))},Cn=(oe,_e)=>{d!==null&&h(null),x(null),j.current=!0,c({anchorRow:oe,anchorCol:_e,focusRow:oe,focusCol:_e})},rn=(oe,_e,se)=>{var pe;oe.button!==0||OA(oe.target)||(oe.preventDefault(),(pe=C.current)==null||pe.focus({preventScroll:!0}),Cn(_e,se))},Ln=(oe,_e)=>{j.current&&(N(!0),be.current={rowIndex:oe,columnIndex:_e},!fe.current&&(fe.current=requestAnimationFrame(()=>{fe.current=0;const se=be.current;be.current=null,se&&c(pe=>pe&&{...pe,focusRow:se.rowIndex,focusCol:se.columnIndex})})))},Xn=oe=>{var wt;const _e=document.elementFromPoint(oe.clientX,oe.clientY),se=_e==null?void 0:_e.closest("[data-row-index][data-column-index]");if(!se||!((wt=B.current)!=null&&wt.contains(se)))return null;const pe=Number(se.dataset.rowIndex),Le=Number(se.dataset.columnIndex);return!Number.isInteger(pe)||!Number.isInteger(Le)?null:{rowIndex:pe,columnIndex:Le}},Nn=(oe,_e,se)=>{oe.touches.length!==1||OA(oe.target)||Cn(_e,se)},_n=oe=>{if(!j.current||oe.touches.length!==1)return;const _e=oe.touches[0];if(!_e)return;const se=Xn(_e);se&&(oe.preventDefault(),Ln(se.rowIndex,se.columnIndex))},Os=()=>{const oe=PA(l,tt,ge);if(!oe||!navigator.clipboard)return;const _e=$.current;navigator.clipboard.writeText(oe).then(()=>{J.current&&$.current===_e&&(ee.current&&clearTimeout(ee.current),F(!0),ee.current=setTimeout(()=>F(!1),2e3))}).catch(se=>console.warn("[web-shell] clipboard write failed:",se))},ks=()=>{const oe=Ice(e.headers,tt,ge);if(!oe||!navigator.clipboard)return;const _e=ce.current;navigator.clipboard.writeText(oe).then(()=>{J.current&&ce.current===_e&&(V.current&&clearTimeout(V.current),O(!0),V.current=setTimeout(()=>O(!1),2e3))}).catch(se=>console.warn("[web-shell] clipboard write failed:",se))},Kt=oe=>{if(Cce())return;const _e=PA(l,tt,ge);_e&&(oe.preventDefault(),oe.clipboardData.setData("text/plain",_e))},Vn=jce(l,ge),Te=Object.values(o).filter($0).length,mt=tt.length===e.rows.length?n("markdownTable.rows",{count:e.rows.length}):n("markdownTable.rowsFiltered",{visible:tt.length,total:e.rows.length}),Xt=d===null?void 0:e.headers[d.columnIndex],mn=Xt&&d?Xt.text||n("markdownTable.column",{index:d.columnIndex+1}):"";return u.jsxs("div",{ref:B,className:`${it.tableShell} ${T?it.dragging:""}`,children:[u.jsxs("div",{className:it.toolbar,children:[u.jsx("span",{className:it.summary,children:mt}),u.jsx("span",{className:it.hint,children:n("markdownTable.hint")}),u.jsx("button",{className:it.copyButton,type:"button",onClick:ks,children:I?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:it.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyVisible")}),f.size>0&&u.jsx("button",{className:it.copyButton,type:"button",onClick:tn,children:n("markdownTable.showHiddenColumns",{count:f.size})}),ge.length>0&&u.jsx("button",{className:it.copyButton,type:"button",onClick:jn,children:n(_?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")}),Te>0&&u.jsx("span",{className:it.selection,children:n("markdownTable.filtersActive",{count:Te})}),Vn>0&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:it.selection,children:n("markdownTable.cellsSelected",{count:Vn})}),u.jsx("button",{className:it.copyButton,type:"button",onClick:Os,children:U?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:it.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyTsv")})]}),t]}),u.jsxs("div",{ref:C,className:it.scroller,tabIndex:0,onCopy:Kt,children:[u.jsxs("table",{className:it.table,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{className:`${it.headerCell} ${it.actionHeaderCell} ${_?it.stickyActionHeaderCell:""}`,children:n("markdownTable.actions")}),ge.map(oe=>{const _e=e.headers[oe];if(!_e)return null;const se=(r==null?void 0:r.columnIndex)===oe,pe=$0(o[oe]),Le=(d==null?void 0:d.columnIndex)===oe,wt=se?r.direction==="asc"?"↑":"↓":"↕",dt=_e.text||n("markdownTable.column",{index:oe+1}),Ft=se?n(r.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:dt}):n("markdownTable.sortByColumn",{column:dt}),on=se?r.direction==="asc"?"ascending":"descending":"none",Ks=`${s}-filter-${oe}`,pn=_e.textAlign?{textAlign:_e.textAlign}:void 0,An=st===oe,un=v===oe;return u.jsxs("th",{className:`${it.headerCell} ${An?it.frozenHeaderCell:""} ${un?it.activeHeaderCell:""}`,"aria-sort":on,onDragOver:ss,onDrop:rs=>Mt(rs,oe),style:Be(oe,pn),children:[u.jsxs("div",{className:it.headerControls,children:[u.jsxs("button",{className:it.headerButton,type:"button",onClick:()=>Re(oe),"aria-label":Ft,style:pn,children:[u.jsx("span",{className:it.headerText,style:pn,children:_e.content}),u.jsx("span",{className:it.sortIcon,"aria-hidden":"true",children:wt})]}),u.jsx("button",{className:`${it.reorderHandle} ${un?it.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:un?0:-1,onDragStart:rs=>Yn(rs,oe),onDragEnd:Wt,"aria-label":n("markdownTable.moveColumn",{column:dt}),children:"⋮⋮"}),u.jsx("button",{className:`${it.filterTrigger} ${pe?it.filterTriggerActive:""}`,type:"button",onClick:rs=>rt(rs,oe),"aria-label":n("markdownTable.filterColumn",{column:dt}),"aria-expanded":Le,"aria-controls":Le?Ks:void 0,children:"▾"})]}),u.jsx("button",{className:it.resizeHandle,type:"button",onMouseDown:rs=>He(rs,oe),onKeyDown:rs=>Ht(rs,oe),role:"separator","aria-label":n("markdownTable.resizeColumn",{column:dt}),"aria-orientation":"vertical","aria-valuemin":HB,"aria-valuemax":UB,"aria-valuenow":p[oe]??vu})]},_e.key)})]})}),u.jsx("tbody",{children:tt.map((oe,_e)=>{const se=R===oe.key,pe=`${s}-detail-${oe.key}`;return u.jsxs(g.Fragment,{children:[u.jsxs("tr",{className:_e%2===1?it.evenRow:void 0,children:[u.jsx("td",{className:`${it.cell} ${it.actionCell} ${_?it.stickyActionCell:""}`,children:u.jsx("button",{className:it.rowDetailButton,type:"button",onClick:()=>ln(oe.key),"aria-expanded":se,"aria-controls":pe,"aria-label":n(se?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:_e+1}),children:n("markdownTable.rowDetails")})}),ge.map(Le=>{const wt=oe.cells[Le];if(!wt)return null;const dt=wt.textAlign?{textAlign:wt.textAlign}:void 0,Ft=st===Le;return u.jsx("td",{className:`${it.cell} ${ve(_e,Le)?it.selectedCell:""} ${Ft?it.frozenCell:""}`,style:Be(Le,dt),"data-row-index":_e,"data-column-index":Le,onMouseDown:on=>rn(on,_e,Le),onMouseEnter:()=>Ln(_e,Le),onTouchStart:on=>Nn(on,_e,Le),onTouchMove:_n,onTouchEnd:ut,onTouchCancel:ut,children:wt.content},wt.key)})]}),se&&u.jsx("tr",{id:pe,className:it.detailRow,children:u.jsx("td",{className:it.detailCell,colSpan:ge.length+1,children:u.jsxs("div",{className:it.detailPanel,children:[u.jsx("div",{className:it.detailTitle,children:n("markdownTable.detailsHeader")}),ge.map(Le=>{const wt=e.headers[Le],dt=oe.cells[Le];if(!wt||!dt)return null;const Ft=wt.textAlign?{textAlign:wt.textAlign}:void 0,on=dt.textAlign?{textAlign:dt.textAlign}:void 0;return u.jsxs("div",{className:it.detailItem,children:[u.jsx("div",{className:it.detailLabel,style:Ft,children:wt.content}),u.jsx("div",{className:it.detailValue,style:on,children:dt.content})]},`${oe.key}-detail-${Le}`)})]})})})]},oe.key)})})]}),tt.length===0&&u.jsx("div",{className:it.emptyState,children:e.rows.length===0?n("markdownTable.empty"):n("markdownTable.emptyFiltered")})]}),d&&Xt&&u.jsx(Gce,{id:`${s}-filter-${d.columnIndex}`,columnName:mn,columnIndex:d.columnIndex,filter:o[d.columnIndex],isNumeric:Ye[d.columnIndex]??!1,options:qt,sort:r,style:{left:d.left,top:d.top},menuRef:z,canHideColumn:ge.length>1,onApply:ne,onClose:Ae,onHideColumn:vt,onSort:ue},d.columnIndex)]})}const Qce="_content_hisx1_1",Xce="_inlineCode_hisx1_127",Jce="_link_hisx1_139",Zce="_tableWrapper_hisx1_149",eue="_table_hisx1_149",tue="_image_hisx1_179",nue="_codeBlock_hisx1_187",sue="_codeBlockHeader_hisx1_196",rue="_codeBlockLang_hisx1_205",iue="_codeBlockCopy_hisx1_213",oue="_codeBlockContent_hisx1_231",aue="_codeBlockPlain_hisx1_251",lue="_mermaidBlock_hisx1_269",cue="_mermaidInline_hisx1_281",uue="_mermaidLoading_hisx1_300",due="_mermaidActions_hisx1_307",os={content:Qce,inlineCode:Xce,link:Jce,tableWrapper:Zce,table:eue,image:tue,codeBlock:nue,codeBlockHeader:sue,codeBlockLang:rue,codeBlockCopy:iue,codeBlockContent:oue,codeBlockPlain:aue,mermaidBlock:lue,mermaidInline:cue,mermaidLoading:uue,mermaidActions:due},hue=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),HA={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function KB(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(HA,t)?HA[t]:t,s=hue.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:s}}const YB=/^(https?:|mailto:)/i,fue=/^data:image\/(png|jpeg|gif|webp);base64,/i;function mue(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:YB.test(t):!1}function QB(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||fue.test(t)?!0:YB.test(t):!1}let UA,pue=0;function gue({code:e}){const{t}=Xe(),n=Rv(),[s,r]=g.useState(null),[i,o]=g.useState(null),[a,l]=g.useState("diagram"),[c,d]=g.useState(!1),h=n==="light"?"default":"dark";g.useEffect(()=>{let m=!1;r(null),o(null);const p=setTimeout(()=>{K(()=>import("./mermaid.core-JqtkxvCl.js").then(y=>y.bm),[]).then(async y=>{if(m)return;const w=y.default;UA!==h&&(w.initialize({startOnLoad:!1,theme:h,securityLevel:"strict",suppressErrorRendering:!0}),UA=h);try{const b=`mermaid-${++pue}`,{svg:v}=await w.render(b,e.trim());m||r(v)}catch(b){m||o(b instanceof Error?b.message:"Mermaid render failed")}})},150);return()=>{m=!0,clearTimeout(p)}},[e,h]);const f=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?u.jsxs("div",{className:os.codeBlock,children:[u.jsx("div",{className:os.codeBlockHeader,children:u.jsx("span",{className:os.codeBlockLang,children:t("mermaid.errorLabel")})}),u.jsx("pre",{className:`${os.codeBlockContent} ${os.codeBlockPlain}`,children:u.jsx("code",{children:e})})]}):u.jsxs("div",{className:os.codeBlock,children:[u.jsxs("div",{className:os.codeBlockHeader,children:[u.jsx("span",{className:os.codeBlockLang,children:t("mermaid.label")}),u.jsxs("span",{className:os.mermaidActions,children:[u.jsx("button",{className:os.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),u.jsx("button",{className:os.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),a==="code"?u.jsx("pre",{className:`${os.codeBlockContent} ${os.codeBlockPlain}`,children:u.jsx("code",{children:e})}):s?u.jsx("div",{className:`${os.mermaidBlock} ${os.mermaidInline}`,dangerouslySetInnerHTML:{__html:s}}):u.jsx("div",{className:`${os.mermaidBlock} ${os.mermaidLoading} ${os.mermaidInline}`,children:u.jsx("span",{children:t("mermaid.rendering")})})]})}function yue({className:e,children:t,isStreaming:n}){const{t:s}=Xe(),r=Rv(),[i,o]=g.useState(null),[a,l]=g.useState(!1),{label:c,lang:d,resolvedLang:h}=KB(XB(e)),f=String(t).replace(/\n$/,""),m=r==="light"?"github-light-default":"github-dark-default";g.useEffect(()=>{if(d==="mermaid"||h==="text"||ple(f)){o(null);return}const y=ule(f,h,m);if(y!==null){o(y);return}const w=!n,b=jA(f,h,m,w);if(b!==null){o(b);return}o(null);let v=!1;return hle(h).then(()=>{if(v)return;const x=jA(f,h,m,w);x!==null&&o(x)}).catch(x=>{v||(console.warn("[web-shell] highlight failed for lang=%s",h,x),o(null))}),()=>{v=!0}},[f,d,h,m,n]);const p=()=>{navigator.clipboard.writeText(f).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return d==="mermaid"&&!n?u.jsx(gue,{code:f}):u.jsxs("div",{className:os.codeBlock,children:[u.jsxs("div",{className:os.codeBlockHeader,children:[u.jsx("span",{className:os.codeBlockLang,children:c}),u.jsx("button",{className:os.codeBlockCopy,onClick:p,children:s(a?"code.copied":"code.copy")})]}),i!==null?u.jsx("div",{className:os.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):u.jsx("pre",{className:`${os.codeBlockContent} ${os.codeBlockPlain}`,children:u.jsx("code",{children:f})})]})}function XB(e){var i;const t=((i=e==null?void 0:e.match(/(?:^|\s)language-([^\s]+)/))==null?void 0:i[1])??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const s=n[1]??"",r=t[s.length];return!r||r==="{"||r===":"?s:""}function bue({children:e}){return u.jsx("code",{className:os.inlineCode,children:e})}function VA({children:e}){return u.jsx("div",{className:os.tableWrapper,children:u.jsx("table",{className:os.table,children:e})})}const JB=g.createContext(!1),ZB=g.createContext(void 0);function vue({className:e,children:t}){const n=g.useContext(JB);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?u.jsx(wue,{className:e,isStreaming:n,children:t}):u.jsx(bue,{children:t})}function wue({className:e,children:t,isStreaming:n}){var f;const s=g.useContext(ZB),r=Rv(),{markdown:i}=vl(),o=String(t),a=o.replace(/\n$/,""),l=u.jsx(yue,{className:e,isStreaming:n,children:o}),c=XB(e),{resolvedLang:d}=KB(c);if(!!s&&!!e&&!!c)try{const m=(f=i==null?void 0:i.renderCodeBlock)==null?void 0:f.call(i,{language:c,resolvedLanguage:d,className:e,code:a,isStreaming:!!n,source:s,theme:r});if(m!=null&&typeof m!="boolean")return u.jsx(mc,{fallback:l,label:`custom code block component render (lang=${c})`,resetKeys:[c,s,r,n?"streaming":"settled",a],children:m})}catch(m){console.error("[web-shell] custom code block renderer call failed (lang=%s):",c,m)}return l}function xue({children:e}){return u.jsx(u.Fragment,{children:e})}function _ue({href:e,children:t}){const n=mue(e)?e:void 0;return u.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:os.link,children:t})}function kue({src:e,alt:t}){const n=QB(e)?e:void 0;return u.jsx("img",{src:n,alt:t||"",className:os.image})}function eP(e="basic",t=""){return{code:vue,pre:xue,a:_ue,img:kue,table({children:n}){if(e==="advanced"){const s=u.jsx(VA,{children:n});return u.jsx(mc,{fallback:s,label:"enhanced markdown table",resetKeys:[t],children:u.jsx(Kce,{fallback:s,children:n})})}return u.jsx(VA,{children:n})}}}const Sue=eP(),hm=g.memo(function({content:t,source:n,isStreaming:s,tableMode:r}){const{markdown:i,markdownTableMode:o}=vl(),a=n?i:void 0,l=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,c=s?"basic":r??o??"basic",d=g.useMemo(()=>c==="advanced"?eP("advanced",l):Sue,[c,l]),h=a==null?void 0:a.components,f=g.useMemo(()=>h?{...d,...h,...c==="advanced"?{table:d.table}:{}}:d,[d,c,h]);if(!t)return null;const m=a!=null&&a.remarkPlugins?[bC,rA,...a.remarkPlugins]:[bC,rA],p=a!=null&&a.rehypePlugins?[fA,...a.rehypePlugins]:[fA];return u.jsx("div",{className:n!=="thinking"?os.content:void 0,"data-markdown-source":n,children:u.jsx(JB.Provider,{value:!!s,children:u.jsx(ZB.Provider,{value:n,children:u.jsx(kee,{remarkPlugins:m,rehypePlugins:p,components:f,children:l})})})})}),Tue="_flash_96ig5_1",Iu={flash:Tue},Cue="_chatMessageRow_1majp_41",Aue="_chatBubble_1majp_48",Eue="_chatContent_1majp_61",Mue="_chatContentCollapsed_1majp_66",Nue="_toggleButton_1majp_71",Iue="_toggleIcon_1majp_92",jue="_toggleIconExpanded_1majp_99",Rue="_chatImages_1majp_103",Lue="_chatImageThumb_1majp_110",$l={chatMessageRow:Cue,chatBubble:Aue,chatContent:Eue,chatContentCollapsed:Mue,toggleButton:Nue,toggleIcon:Iue,toggleIconExpanded:jue,chatImages:Rue,chatImageThumb:Lue},Due=g.memo(function({content:t,images:n,isLocateFlashing:s=!1}){const{t:r}=Xe(),{renderUserMessageContent:i}=vl(),o=g.useRef(null),[a,l]=g.useState(!1),[c,d]=g.useState(!1),h=g.useMemo(()=>(i==null?void 0:i({content:t,images:n}))??t,[t,n,i]),f=g.useCallback(()=>{const m=o.current;m&&d(m.scrollHeight>400)},[]);return g.useLayoutEffect(()=>{l(!1),f()},[t,n==null?void 0:n.length,f]),g.useEffect(()=>{const m=o.current;if(!m||typeof ResizeObserver>"u")return;const p=new ResizeObserver(f);return p.observe(m),()=>p.disconnect()},[f]),u.jsx("div",{className:$l.chatMessageRow,children:u.jsxs("div",{className:`${$l.chatBubble}${s?` ${Iu.flash}`:""}`,children:[u.jsxs("div",{ref:o,className:`${$l.chatContent} ${c&&!a?$l.chatContentCollapsed:""}`,children:[n&&n.length>0&&u.jsx("div",{className:$l.chatImages,children:n.map((m,p)=>{const y=m.data.startsWith("data:")?m.data:`data:${m.mimeType};base64,${m.data}`;return QB(y)?u.jsx("img",{src:y,alt:r("user.uploadedImage",{index:p+1}),className:$l.chatImageThumb,onLoad:f},p):null})}),h]}),c&&u.jsxs("button",{type:"button",className:$l.toggleButton,onClick:()=>l(m=>!m),children:[u.jsx("span",{children:r(a?"userMessage.showLess":"userMessage.showMore")}),u.jsx("svg",{className:`${$l.toggleIcon} ${a?$l.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})}),Oue="_message_1wh5x_1",Bue="_messageFooter_1wh5x_7",Pue="_copyButton_1wh5x_23",$ue="_footerTime_1wh5x_49",zue="_thinking_1wh5x_61",Fue="_thinkingBody_1wh5x_73",que="_thinkingSummary_1wh5x_104",Hue="_thinkingSummaryTextActive_1wh5x_126",Uue="_thinkingSummaryIcon_1wh5x_132",Vue="_thinkingSummaryText_1wh5x_126",Wue="_thinkingChevronRight_1wh5x_189",Gue="_thinkingChevronDown_1wh5x_190",Kue="_thinkingExpandedWrap_1wh5x_251",Yue="_thinkingExpandedClip_1wh5x_255",Que="_thinkingExpandedCollapsed_1wh5x_263",Xue="_thinkingExpandedInner_1wh5x_267",Jue="_content_1wh5x_315",Zue="_contentBody_1wh5x_320",ar={message:Oue,messageFooter:Bue,copyButton:Pue,footerTime:$ue,thinking:zue,thinkingBody:Fue,thinkingSummary:que,thinkingSummaryTextActive:Hue,thinkingSummaryIcon:Uue,thinkingSummaryText:Vue,thinkingChevronRight:Wue,thinkingChevronDown:Gue,thinkingExpandedWrap:Kue,thinkingExpandedClip:Yue,thinkingExpandedCollapsed:Que,thinkingExpandedInner:Xue,content:Jue,contentBody:Zue},ede=g.memo(function({content:t,isStreaming:n,timestamp:s,onBranchSession:r,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1}){const{t:l}=Xe(),[c,d]=g.useState(!1),h=!!t&&!n&&i,f=g.useCallback(()=>{var p;const m=(p=navigator.clipboard)==null?void 0:p.writeText(t);m&&m.then(()=>{d(!0),window.setTimeout(()=>d(!1),2e3)}).catch(()=>{})},[t]);return u.jsxs("div",{className:ar.message,children:[t&&u.jsx("div",{className:`${ar.content}${a?` ${Iu.flash}`:""}`,children:u.jsx("div",{className:ar.contentBody,children:u.jsx(hm,{content:t,source:"assistant",isStreaming:n})})}),h&&u.jsxs("div",{className:ar.messageFooter,children:[u.jsx("button",{type:"button",className:ar.copyButton,title:l("assistant.copy"),"aria-label":l("assistant.copy"),onClick:f,children:c?u.jsx(nde,{}):u.jsx(tde,{})}),o&&r&&u.jsx("button",{type:"button",className:ar.copyButton,title:l("assistant.branch"),"aria-label":l("assistant.branch"),onClick:r,children:u.jsx(sde,{})}),s!==void 0&&u.jsx("span",{className:ar.footerTime,"aria-hidden":"true",children:Lf(s)})]})]})});function tde(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 4.4V3.2c0-.7.5-1.2 1.2-1.2h5.4c.7 0 1.2.5 1.2 1.2v5.4c0 .7-.5 1.2-1.2 1.2h-1.2",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.3"}),u.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function nde(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function sde(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5 3.5v5.2c0 2.1 1.7 3.8 3.8 3.8H11",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),u.jsx("path",{d:"M5 8.2h3.2c1.5 0 2.8-1.2 2.8-2.8V4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),u.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),u.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const rde=g.memo(function({content:t,isStreaming:n,timestamp:s,isLocateFlashing:r=!1}){const{t:i}=Xe(),o=g.useContext(Zd),[a,l]=g.useState(!1),c=ide({isStreaming:n}),d=c==="thinking.running",h=g.useRef(s??Date.now()),f=g.useRef(d),[m,p]=g.useState(()=>Date.now()),[y,w]=g.useState(null);g.useEffect(()=>{if(!t||!d)return;p(Date.now());const x=setInterval(()=>p(Date.now()),1e3);return()=>clearInterval(x)},[t,d]),g.useEffect(()=>{if(t){if(d){f.current=!0,w(null);return}f.current&&y===null&&w(Date.now())}},[t,y,d]);const b=d||y?ode((d?m:y)-h.current):"",v=g.useCallback(()=>{l(x=>!x)},[]);return u.jsx("div",{className:`${ar.message}${r?` ${Iu.flash}`:""}`,children:t&&!o&&u.jsx("div",{className:ar.thinking,children:u.jsxs("div",{className:ar.thinkingBody,children:[u.jsxs("button",{type:"button",className:ar.thinkingSummary,onClick:v,"aria-expanded":a,title:i(a?"thinking.collapse":"thinking.expand"),children:[u.jsx("span",{className:ar.thinkingSummaryIcon,"aria-hidden":"true",children:u.jsx(ade,{})}),u.jsx("span",{className:d?`${ar.thinkingSummaryText} ${ar.thinkingSummaryTextActive}`:ar.thinkingSummaryText,children:i(c,d?{duration:b}:{})}),u.jsx("span",{className:a?ar.thinkingChevronDown:ar.thinkingChevronRight,"aria-hidden":"true"})]}),u.jsx("div",{className:a?ar.thinkingExpandedClip:`${ar.thinkingExpandedClip} ${ar.thinkingExpandedCollapsed}`,children:u.jsx("div",{className:ar.thinkingExpandedInner,children:u.jsx("div",{className:ar.thinkingExpandedWrap,children:u.jsx(hm,{content:t,source:"thinking",isStreaming:n})})})})]})})})});function ide({isStreaming:e}){return e?"thinking.running":"thinking.done"}function ode(e){const t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function ade(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),u.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),u.jsx("path",{d:"M9.1 2.8c-3 0-5.1 2.3-5.1 5 0 1.7.8 3.1 2.1 4 .5.4.8.8.8 1.4h4.5c0-.6.3-1 .8-1.4 1.3-.9 2.1-2.3 2.1-4 0-.8-.2-1.6-.6-2.3",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M13.2 1.8 14 3.6l1.8.8-1.8.8-.8 1.8-.8-1.8-1.8-.8 1.8-.8.8-1.8Z",fill:"currentColor"})]})}const lde="_panel_8ng9u_1",cde="_title_8ng9u_16",ude="_metaLine_8ng9u_22",dde="_progress_8ng9u_32",hde="_spacer_8ng9u_38",fde="_row_8ng9u_42",mde="_detailRow_8ng9u_43",pde="_subDetailRow_8ng9u_44",gde="_symbol_8ng9u_65",yde="_label_8ng9u_69",bde="_value_8ng9u_73",vde="_detailName_8ng9u_80",wde="_sectionTitle_8ng9u_88",xde="_detailSection_8ng9u_94",_de="_skillBlock_8ng9u_100",kde="_hint_8ng9u_105",Sde="_detailCommand_8ng9u_111",Tde="_bodyLoaded_8ng9u_132",Cde="_accent_8ng9u_137",Ade="_secondary_8ng9u_141",Ede="_warning_8ng9u_145",Mde="_error_8ng9u_149",Nde="_success_8ng9u_153",en={panel:lde,title:cde,metaLine:ude,progress:dde,spacer:hde,row:fde,detailRow:mde,subDetailRow:pde,symbol:gde,label:yde,value:bde,detailName:vde,sectionTitle:wde,detailSection:xde,skillBlock:_de,hint:kde,detailCommand:Sde,bodyLoaded:Tde,accent:Cde,secondary:Ade,warning:Ede,error:Mde,success:Nde},z3="web-shell:context-usage:v1:",Dc="█",tP="▒",nP="░",sP=30;function Ide(e){return`${z3}${JSON.stringify(e)}`}function jde(e){if(!e.startsWith(z3))return null;try{const t=JSON.parse(e.slice(z3.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function rP(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function zf(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Rde(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function Lde(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function Dde({usedPercentage:e,bufferPercentage:t}){const s=Math.round(Math.min(e,100)/100*56),r=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-s-r),o=e>80?en.error:e>60?en.warning:en.accent;return u.jsxs("div",{className:en.progress,"aria-hidden":"true",children:[u.jsx("span",{className:o,children:Dc.repeat(Math.max(0,s))}),u.jsx("span",{className:en.secondary,children:nP.repeat(Math.max(0,i))}),u.jsx("span",{className:en.warning,children:tP.repeat(Math.max(0,r))})]})}function zl({symbol:e,label:t,tokens:n,tokenLabel:s,contextWindowSize:r,symbolClassName:i=en.secondary,isOverLimit:o}){return u.jsxs("div",{className:en.row,children:[u.jsx("span",{className:`${en.symbol} ${i}`,children:e}),u.jsx("span",{className:en.label,children:t}),u.jsxs("span",{className:o?en.error:en.value,children:[zf(n)," ",s," (",Rde(n,r),"%)"]})]})}const Rx="/context detail";function Ode({hint:e,onShowDetail:t}){const n=t?e.indexOf(Rx):-1;return n<0?u.jsx("div",{className:en.hint,children:e}):u.jsxs("div",{className:en.hint,children:[e.slice(0,n),u.jsx("button",{type:"button",className:en.detailCommand,onClick:t,children:Rx}),e.slice(n+Rx.length)]})}function Bde({name:e,tokens:t,tokenLabel:n}){return u.jsxs("div",{className:en.detailRow,children:[u.jsxs("span",{className:en.secondary,children:["└"," "]}),u.jsx("span",{className:en.detailName,title:e,children:rP(e,sP)}),u.jsxs("span",{className:en.value,children:[zf(t)," ",n]})]})}function Lx({title:e,items:t,getName:n,tokenLabel:s}){const r=Lde(t);return r.length===0?null:u.jsxs("section",{className:en.detailSection,children:[u.jsx("div",{className:en.sectionTitle,children:e}),r.map(i=>u.jsx(Bde,{name:n(i),tokens:i.tokens,tokenLabel:s},n(i)))]})}function Pde({skills:e,labels:t}){const n=[...e].sort((s,r)=>s.loaded!==r.loaded?s.loaded?-1:1:r.tokens+(r.bodyTokens??0)-(s.tokens+(s.bodyTokens??0)));return n.length===0?null:u.jsxs("section",{className:en.detailSection,children:[u.jsx("div",{className:en.sectionTitle,children:t.skills}),n.map(s=>u.jsxs("div",{className:en.skillBlock,children:[u.jsxs("div",{className:en.detailRow,children:[u.jsxs("span",{className:en.secondary,children:["└"," "]}),u.jsxs("span",{className:en.detailName,title:s.name,children:[rP(s.name,sP),s.loaded&&u.jsxs("span",{className:en.success,children:[" ",t.active]})]}),u.jsxs("span",{className:en.value,children:[zf(s.tokens)," ",t.tokens]})]}),s.loaded&&s.bodyTokens!=null&&s.bodyTokens>0&&u.jsxs("div",{className:en.subDetailRow,children:[u.jsxs("span",{className:en.secondary,children:["  └"," "]}),u.jsx("span",{className:en.bodyLoaded,children:t.bodyLoaded}),u.jsxs("span",{className:en.success,children:["+",zf(s.bodyTokens)," ",t.tokens]})]})]},s.name))]})}function $de({status:e,onShowDetail:t}){const{t:n}=Xe(),{usage:s}=e,{breakdown:r,contextWindowSize:i}=s,o=i>0?s.totalTokens/i*100:0,a=o>100,l=i>0?r.autocompactBuffer/i*100:0;return u.jsxs("div",{className:en.panel,children:[u.jsx("div",{className:en.title,children:n("contextUsage.title")}),s.isEstimated?u.jsx(u.Fragment,{children:u.jsxs("div",{className:en.metaLine,children:[u.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),u.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",zf(i)," ",n("contextUsage.tokens")]})]})}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:en.metaLine,children:[u.jsxs("span",{children:[n("contextUsage.model"),": ",s.modelName]}),u.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",zf(i)," ",n("contextUsage.tokens")]})]}),a&&u.jsx("div",{className:en.error,children:n("contextUsage.overLimit")})]}),u.jsx(Dde,{usedPercentage:Math.min(o,100),bufferPercentage:l}),u.jsx("div",{className:en.spacer}),u.jsx(zl,{symbol:Dc,label:n("contextUsage.used"),tokens:s.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?en.error:en.accent,isOverLimit:a}),u.jsx(zl,{symbol:nP,label:n("contextUsage.free"),tokens:r.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),u.jsx(zl,{symbol:tP,label:n("contextUsage.autocompactBuffer"),tokens:r.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:en.warning}),u.jsx("div",{className:en.spacer}),u.jsx("div",{className:en.sectionTitle,children:n("contextUsage.usageByCategory")}),u.jsx(zl,{symbol:Dc,label:n("contextUsage.systemPrompt"),tokens:r.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:en.accent}),u.jsx(zl,{symbol:Dc,label:n("contextUsage.builtinTools"),tokens:r.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:en.accent}),r.mcpTools>0&&u.jsx(zl,{symbol:Dc,label:n("contextUsage.mcpTools"),tokens:r.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:en.accent}),u.jsx(zl,{symbol:Dc,label:n("contextUsage.memoryFiles"),tokens:r.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:en.accent}),u.jsx(zl,{symbol:Dc,label:n("contextUsage.skills"),tokens:r.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:en.accent}),!s.isEstimated&&u.jsx(zl,{symbol:Dc,label:n("contextUsage.messages"),tokens:r.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:en.accent}),s.showDetails?u.jsxs(u.Fragment,{children:[u.jsx(Lx,{title:n("contextUsage.builtinTools"),items:s.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),u.jsx(Lx,{title:n("contextUsage.mcpTools"),items:s.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),u.jsx(Lx,{title:n("contextUsage.memoryFiles"),items:s.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),u.jsx(Pde,{skills:s.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):u.jsx(Ode,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const zde={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",grep:"Grep",grep_search:"Grep",glob:"Glob",run_shell_command:"Shell",todo_write:"TodoList",save_memory:"SaveMemory",agent:"Agent",skill:"Skill",exit_plan_mode:"ExitPlanMode",web_fetch:"WebFetch",webfetch:"WebFetch",fetch:"WebFetch",list_directory:"ListFiles",lsp:"Lsp",ask_user_question:"AskUserQuestion",cron_create:"CronCreate",cron_list:"CronList",cron_delete:"CronDelete",task_stop:"TaskStop",send_message:"SendMessage",structured_output:"StructuredOutput",monitor:"Monitor",notebook_edit:"NotebookEdit",tool_search:"ToolSearch",enter_worktree:"EnterWorktree",exit_worktree:"ExitWorktree",enter_plan_mode:"EnterPlanMode",task_create:"TaskCreate",task_update:"TaskUpdate",task_list:"TaskList",team_create:"TeamCreate",team_delete:"TeamDelete",workflow:"Workflow",web_search:"WebSearch",bash:"Shell",shell:"Shell Command",read:"ReadFile",write:"WriteFile",search:"Grep"};function iP(e){if(!e.trim())return"Tool";const t=zde[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function Sl(e,t){const n=iP(e),s=[`toolName.${e}`,`toolName.${e.toLowerCase()}`,`toolName.${n.toLowerCase()}`];for(const r of s){const i=t(r);if(i!==r)return i}return n}function Tl(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Dr(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const gf=2e3;function p6(e,t){if(sw(e.toolName)){const r=nw(e.args,"skill");if(r)return Dr(r,gf)}const n=Hde(e,t);if(n)return Dr(n,gf);const s=aP(e,t);return s?Dr(s,gf):""}function oP(e,t){if(!ko(e.toolName))return p6(e,t);const n=nw(e.args,"description");if(n)return Dr(n,gf);const s=aP(e,t,{includeTimeout:!1});return s?Dr(s,gf):""}function Fde(e){return ko(e.toolName)?nw(e.args,"description"):""}function fl(e){var t;if(!e.content)return q3(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return q3(e.rawOutput)}function qde(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=WA((q3(e.rawOutput)??"").trim());if(o)return o}const n=fl(e);if(!n)return"";const s=n.split(`
`),r=s.length;if(t==="read"||t==="read_file"||t==="readfile")return`${r} line(s)`;if(t==="glob")return`Found ${s.filter(a=>a.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${s.filter(a=>a.trim()).length} item(s)`;if(ko(t)){if(r>3)return`${r} lines of output`;const o=s[0]||"";return Dr(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=WA(n.trim());return o||`${s.filter(l=>l.trim()).length} result(s)`}if(t==="edit"||t==="write"||t==="write_file"||t==="editfile")return"";if(t==="webfetch"||t==="web_fetch"||t==="fetch"){const o=s[0]||"";return Dr(o,80)}if(t==="websearch"||t==="web_search"){const o=s.filter(a=>a.trim()).length;return o>1?`${o} result(s)`:s[0]||""}if(Tl(t))return"";const i=s[0]||"";return Dr(i,80)}function Hde(e,t){if(!e.title)return null;const n=iP(e.toolName),s=e.title.trim();if(s===e.toolName||s===n)return null;const r=[n,e.toolName];for(const i of r)if(s.startsWith(i)){const o=s.slice(i.length);if(/^(:\s*|\s+)/.test(o))return GA(o.replace(/^:\s*|\s+/,""),t)}return GA(s,t)}function WA(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function aP(e,t,n={}){const s=e.args||{},r=e.toolName.toLowerCase(),i=n.includeTimeout??!0;if(s.command){let o=String(s.command);s.directory&&r!=="shell"&&(o+=` [in ${Jh(String(s.directory),t)}]`),s.is_background?o+=" [background]":i&&s.timeout&&(o+=` [timeout: ${String(s.timeout)}ms]`);const a=nw(s,"description");return a&&(o+=` (${a})`),Dr(o,gf)}if(r==="grep_search"||r==="grep"||r==="search"){const o=s.pattern??s.query;if(o){let a=`'${String(o)}'`;return s.path?a+=` in path '${String(s.path)}'`:(r==="grep_search"||r==="grep")&&(a+=" in path './'"),s.glob&&(a+=` (filter: '${String(s.glob)}')`),a}}if(r==="glob"&&s.pattern){let o=`'${String(s.pattern)}'`;return s.path&&(o+=` in path '${String(s.path)}'`),o}if(s.file_path)return s.description?String(s.description):Jh(String(s.file_path),t);if(s.url){const o=String(s.url),a=typeof s.prompt=="string"?s.prompt:void 0,l=a?`${o} — "${Dr(a,40)}"`:o;return Dr(l,80)}if(s.path)return Jh(String(s.path),t);if(s.query)return Dr(String(s.query),60);if(r==="list_directory"||r==="listfiles"){const o=s.path||s.directory||"";return Jh(String(o),t)}return s.description?String(s.description):""}function nw(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function ko(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function sw(e){return e.toLowerCase()==="skill"}function Aa(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(s=>Aa(s,t)))??!1}function GA(e,t){const n=e.trim();return lP(F3(n))?Jh(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,s=>Jh(s,t))}function Jh(e,t){const n=F3(e),s=t?F3(t).replace(/\/+$/,""):"";return s&&(n===s||n.startsWith(`${s}/`))?n.slice(s.length+1)||".":lP(n)?Ude(n):n}function F3(e){return e.replace(/\\/g,"/")}function lP(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Ude(e){return e.replace(/\/+$/,"").split("/").pop()||e}function ag(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function g6(e){if(!e.rawOutput||typeof e.rawOutput!="object")return"";const t=e.rawOutput,n=typeof t.terminateReason=="string"?t.terminateReason:"";return typeof t.reason=="string"&&t.reason||n&&n!=="GOAL"&&n||typeof t.error=="string"&&t.error||""}function yp(e){if(e.status==="failed")return"failed";if(!e.rawOutput||typeof e.rawOutput!="object")return e.status;const t=e.rawOutput,n=typeof t.status=="string"?t.status.toLowerCase():"",s=g6(e);return n==="cancelled"||n==="canceled"||s.toLowerCase().includes("cancel")?"failed":e.status}function y6(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const Vde="general-purpose";function b6(e){var s;const t=ag(e.rawOutput);if(t){const r=t.subagentName;if(typeof r=="string"&&r)return r}const n=(s=e.args)==null?void 0:s.subagent_type;return typeof n=="string"&&n?n:e.toolName==="task"?"task":Vde}function v6(e){var i,o;if(e.title){const a=e.title.indexOf(": ");if(a>0)return e.title.slice(a+2)}const t=(i=e.args)==null?void 0:i.description;if(typeof t=="string"&&t.trim())return t.trim();const n=ag(e.rawOutput),s=n==null?void 0:n.taskDescription;if(typeof s=="string"&&s.trim())return s.trim();const r=(o=e.args)==null?void 0:o.prompt;return typeof r=="string"&&r.trim()?r.trim().split(`
`)[0]??"":""}function Wde(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const s=n[n.length-1];if(s.status!=="in_progress"&&s.status!=="pending")return"";let r=Sl(s.toolName??"",t);if(s.title){const a=s.title.indexOf(": ");r+=" "+(a>0?s.title.slice(a+2):s.title)}else(i=s.args)!=null&&i.command?r+=" "+String(s.args.command):(o=s.args)!=null&&o.file_path&&(r+=" "+String(s.args.file_path));return Dr(r,50)}function q3(e){if(!e)return null;if(typeof e=="string")return e;if(typeof e!="object")return null;const t=e;return typeof t.output=="string"?t.output:typeof t.stdout=="string"?t.stdout:typeof t.content=="string"?t.content:typeof t.reason=="string"?t.reason:typeof t.terminateReason=="string"?t.terminateReason:typeof t.error=="string"?t.error:typeof t.text=="string"?t.text:null}const Gde="_panel_1xezz_1",Kde="_title_1xezz_17",Yde="_sectionTitle_1xezz_23",Qde="_spacer_1xezz_29",Xde="_pivotRow_1xezz_35",Jde="_metricCell_1xezz_41",Zde="_metricCellSection_1xezz_48",ehe="_metricCellSub_1xezz_56",the="_modelCell_1xezz_64",nhe="_modelCellHeader_1xezz_71",she="_divider_1xezz_79",rhe="_kvRow_1xezz_87",ihe="_kvSubRow_1xezz_94",ohe="_kvLabel_1xezz_102",ahe="_kvValue_1xezz_106",lhe="_tableRow_1xezz_115",che="_tableNameCol_1xezz_121",uhe="_tableToolCol_1xezz_129",dhe="_tableNumCol_1xezz_137",hhe="_success_1xezz_147",fhe="_error_1xezz_151",mhe="_secondary_1xezz_155",phe="_warning_1xezz_159",Je={panel:Gde,title:Kde,sectionTitle:Yde,spacer:Qde,pivotRow:Xde,metricCell:Jde,metricCellSection:Zde,metricCellSub:ehe,modelCell:the,modelCellHeader:nhe,divider:she,kvRow:rhe,kvSubRow:ihe,kvLabel:ohe,kvValue:ahe,tableRow:lhe,tableNameCol:che,tableToolCol:uhe,tableNumCol:dhe,success:hhe,error:fhe,secondary:mhe,warning:phe},H3="web-shell:session-stats:v1:";function ghe(e,t="overview"){return`${H3}${JSON.stringify({_view:t,...e})}`}function yhe(e){if(!e.startsWith(H3))return null;try{const t=JSON.parse(e.slice(H3.length));if(!t||typeof t.durationMs!="number")return null;const n=t._view??"overview";return delete t._view,{view:n,status:t}}catch{return null}}function xu(e){if(e<=0)return"0s";if(e<1e3)return`${Math.round(e)}ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=Math.floor(t%60),i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.join(" ")||"0s"}function gd({label:e,children:t}){return u.jsxs("div",{className:Je.kvRow,children:[u.jsx("span",{className:Je.kvLabel,children:e}),u.jsx("span",{className:Je.kvValue,children:t})]})}function z0({label:e,children:t}){return u.jsxs("div",{className:Je.kvSubRow,children:[u.jsxs("span",{className:Je.secondary,children:["»"," ",e]}),u.jsx("span",{className:Je.kvValue,children:t})]})}function cP(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const s=t.split("::"),r=s[0],i=s[1],o=i?`${r} (${i})`:r;return{key:t,label:o,metrics:n}})}function bhe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function vhe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function whe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Ha({metric:e,values:t,variant:n="normal"}){const s=n==="section"?Je.metricCellSection:n==="sub"?Je.metricCellSub:Je.metricCell;return u.jsxs("div",{className:Je.pivotRow,children:[u.jsx("span",{className:s,children:n==="sub"?`↳ ${e}`:e}),t.map((r,i)=>u.jsx("span",{className:Je.modelCell,children:r},i))]})}function xhe({status:e}){const{t}=Xe(),{models:n,tools:s,files:r}=e,i=Object.values(n).reduce((y,w)=>y+w.api.totalLatencyMs,0),o=s.totalDurationMs,a=i+o,l=a>0?i/a*100:0,c=a>0?o/a*100:0,d=s.totalCalls>0?s.totalSuccess/s.totalCalls*100:0,h=cP(n),f=h.reduce((y,w)=>y+w.metrics.tokens.cached,0),m=h.reduce((y,w)=>y+w.metrics.tokens.prompt,0),p=m>0?f/m*100:0;return u.jsxs("div",{className:Je.panel,children:[u.jsx("div",{className:Je.title,children:t("stats.title")}),u.jsx("div",{className:Je.sectionTitle,children:t("stats.overview")}),u.jsx(gd,{label:t("stats.duration"),children:xu(e.durationMs)}),u.jsx(gd,{label:t("stats.prompts"),children:e.promptCount}),u.jsx(gd,{label:t("stats.toolCalls"),children:u.jsxs("span",{children:[s.totalCalls," ",u.jsx("span",{className:Je.secondary,children:"("}),u.jsxs("span",{className:Je.success,children:["✓",s.totalSuccess]})," ",u.jsxs("span",{className:Je.error,children:["✗",s.totalFail]}),u.jsx("span",{className:Je.secondary,children:")"})]})}),u.jsx(gd,{label:t("stats.successRate"),children:u.jsxs("span",{className:d>=90?Je.success:d>=70?Je.warning:Je.error,children:[d.toFixed(1),"%"]})}),(r.totalLinesAdded>0||r.totalLinesRemoved>0)&&u.jsx(gd,{label:t("stats.codeChanges"),children:u.jsxs("span",{children:[u.jsxs("span",{className:Je.success,children:["+",r.totalLinesAdded]})," ",u.jsxs("span",{className:Je.error,children:["-",r.totalLinesRemoved]})]})}),u.jsx("div",{className:Je.spacer}),u.jsx("div",{className:Je.sectionTitle,children:t("stats.performance")}),u.jsxs(z0,{label:t("stats.apiTime"),children:[xu(i)," ",u.jsxs("span",{className:Je.secondary,children:["(",l.toFixed(1),"%)"]})]}),u.jsxs(z0,{label:t("stats.toolTime"),children:[xu(o)," ",u.jsxs("span",{className:Je.secondary,children:["(",c.toFixed(1),"%)"]})]}),h.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Je.spacer}),u.jsx("div",{className:Je.sectionTitle,children:t("stats.modelUsage")}),u.jsx("div",{className:Je.spacer}),u.jsxs("div",{className:Je.tableRow,children:[u.jsx("span",{className:Je.tableNameCol,children:t("stats.modelUsage")}),u.jsx("span",{className:Je.tableNumCol,children:t("stats.reqs")}),u.jsx("span",{className:Je.tableNumCol,children:t("stats.inputTokens")}),u.jsx("span",{className:Je.tableNumCol,children:t("stats.outputTokens")})]}),u.jsx("div",{className:Je.divider}),h.map(y=>u.jsxs("div",{className:Je.tableRow,children:[u.jsx("span",{className:Je.tableNameCol,children:y.label}),u.jsx("span",{className:Je.tableNumCol,children:y.metrics.api.totalRequests}),u.jsx("span",{className:`${Je.tableNumCol} ${Je.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),u.jsx("span",{className:`${Je.tableNumCol} ${Je.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),p>0&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Je.spacer}),u.jsxs("div",{children:[u.jsx("span",{className:Je.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",p.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),u.jsxs("div",{className:Je.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function _he({status:e}){const{t}=Xe(),n=cP(e.models);if(n.length===0)return u.jsxs("div",{className:Je.panel,children:[u.jsx("div",{className:Je.title,children:t("stats.modelStats")}),u.jsx("div",{children:t("stats.noApiCalls")})]});const s=n.some(o=>o.metrics.tokens.cached>0),r=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(a=>o(a.metrics));return u.jsxs("div",{className:Je.panel,children:[u.jsx("div",{className:Je.title,children:t("stats.modelStats")}),u.jsx("div",{className:Je.spacer}),u.jsxs("div",{className:Je.pivotRow,children:[u.jsx("span",{className:Je.metricCellSection,children:t("stats.metric")}),n.map(o=>u.jsx("span",{className:Je.modelCellHeader,children:o.label},o.key))]}),u.jsx("div",{className:Je.divider}),u.jsx(Ha,{metric:t("stats.api"),values:[],variant:"section"}),u.jsx(Ha,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),u.jsx(Ha,{metric:t("stats.errors"),values:i(o=>{const a=bhe(o);return u.jsxs("span",{className:o.api.totalErrors>0?Je.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),u.jsx(Ha,{metric:t("stats.avgLatency"),values:i(o=>xu(vhe(o)))}),u.jsx("div",{className:Je.spacer}),u.jsx(Ha,{metric:t("stats.tokens"),values:[],variant:"section"}),u.jsx(Ha,{metric:t("stats.total"),values:i(o=>u.jsx("span",{className:Je.warning,children:o.tokens.total.toLocaleString()}))}),u.jsx(Ha,{metric:t("stats.prompt"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),s&&u.jsx(Ha,{metric:t("stats.cached"),values:i(o=>u.jsxs("span",{className:Je.success,children:[o.tokens.cached.toLocaleString()," (",whe(o).toFixed(1),"%)"]})),variant:"sub"}),r&&u.jsx(Ha,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"}),u.jsx(Ha,{metric:t("stats.output"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"})]})}function khe(e){return Object.entries(e).filter(([,t])=>t.count>0).sort((t,n)=>n[1].count-t[1].count).map(([t,n])=>({name:t,stats:n}))}function She({status:e}){const{t}=Xe(),n=khe(e.tools.byName);if(n.length===0)return u.jsxs("div",{className:Je.panel,children:[u.jsx("div",{className:Je.title,children:t("stats.toolStats")}),u.jsx("div",{children:t("stats.noToolCalls")})]});const s=Object.values(e.tools.byName).reduce((o,a)=>{var l,c,d;return o.accept+=((l=a.decisions)==null?void 0:l.accept)??0,o.reject+=((c=a.decisions)==null?void 0:c.reject)??0,o.modify+=((d=a.decisions)==null?void 0:d.modify)??0,o},{accept:0,reject:0,modify:0}),r=s.accept+s.reject+s.modify,i=r>0?s.accept/r*100:0;return u.jsxs("div",{className:Je.panel,children:[u.jsx("div",{className:Je.title,children:t("stats.toolStats")}),u.jsx("div",{className:Je.spacer}),u.jsxs("div",{className:Je.tableRow,children:[u.jsx("span",{className:Je.tableToolCol,children:t("stats.toolName")}),u.jsx("span",{className:Je.tableNumCol,children:t("stats.calls")}),u.jsx("span",{className:Je.tableNumCol,children:t("stats.successRate")}),u.jsx("span",{className:Je.tableNumCol,children:t("stats.avgDuration")})]}),u.jsx("div",{className:Je.divider}),n.map(o=>{const a=o.stats.count>0?o.stats.success/o.stats.count*100:0,l=o.stats.count>0?o.stats.durationMs/o.stats.count:0;return u.jsxs("div",{className:Je.tableRow,children:[u.jsx("span",{className:`${Je.tableToolCol} ${Je.metricCell}`,children:Sl(o.name,t)}),u.jsx("span",{className:Je.tableNumCol,children:o.stats.count}),u.jsxs("span",{className:`${Je.tableNumCol} ${a>=90?Je.success:a>=70?Je.warning:Je.error}`,children:[a.toFixed(1),"%"]}),u.jsx("span",{className:Je.tableNumCol,children:xu(l)})]},o.name)}),u.jsx("div",{className:Je.spacer}),u.jsx("div",{className:Je.sectionTitle,children:t("stats.decisionSummary")}),u.jsx(gd,{label:t("stats.totalReviewed"),children:r}),u.jsx(z0,{label:t("stats.accepted"),children:u.jsx("span",{className:Je.success,children:s.accept})}),u.jsx(z0,{label:t("stats.rejected"),children:u.jsx("span",{className:Je.error,children:s.reject})}),u.jsx(z0,{label:t("stats.modified"),children:u.jsx("span",{className:Je.warning,children:s.modify})}),u.jsx("div",{className:Je.divider}),u.jsx(gd,{label:t("stats.agreementRate"),children:u.jsx("span",{className:r>0?i>=90?Je.success:i>=70?Je.warning:Je.error:void 0,children:r>0?`${i.toFixed(1)}%`:"--"})})]})}function The({view:e,status:t}){switch(e){case"model":return u.jsx(_he,{status:t});case"tools":return u.jsx(She,{status:t});default:return u.jsx(xhe,{status:t})}}function rw(e){return{serialize(t){return`${e}${JSON.stringify(t)}`},parse(t){if(!t.startsWith(e))return null;try{const n=JSON.parse(t.slice(e.length));return!n||typeof n!="object"?null:n}catch{return null}}}}const Che="_panel_13hcg_1",Ahe="_title_13hcg_17",Ehe="_row_13hcg_23",Mhe="_rowGap_13hcg_31",Nhe="_label_13hcg_35",Ihe="_value_13hcg_41",jhe="_accent_13hcg_46",kd={panel:Che,title:Ahe,row:Ehe,rowGap:Mhe,label:Nhe,value:Ihe,accent:jhe},{serialize:Rhe,parse:Lhe}=rw("web-shell:status:v1:");function va({label:e,children:t,gap:n}){return u.jsxs("div",{className:`${kd.row}${n?` ${kd.rowGap}`:""}`,children:[u.jsx("span",{className:kd.label,children:e}),u.jsx("span",{className:kd.value,children:t})]})}function Dhe({info:e}){const{t}=Xe();return u.jsxs("div",{className:kd.panel,children:[u.jsx("div",{className:kd.title,children:t("about.title")}),e.cliVersion&&u.jsx(va,{label:t("about.qwenCode"),children:u.jsx("span",{className:kd.accent,children:e.cliVersion})}),e.runtime&&u.jsx(va,{label:t("about.runtime"),children:e.runtime}),e.platform&&u.jsx(va,{label:t("about.platform"),children:e.platform}),e.auth&&u.jsx(va,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&u.jsx(va,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&u.jsx(va,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&u.jsx(va,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&u.jsx(va,{label:t("about.sessionId"),children:e.sessionId}),u.jsx(va,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),u.jsx(va,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&u.jsx(va,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function bp(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function Ohe(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function uP(e,t,n=50){const s=g.useRef(e);g.useEffect(()=>{s.current=e},[e]),g.useEffect(()=>{const r=o=>{o.defaultPrevented||bp(o.target)&&!Ohe(o.target)||s.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",r)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",r)}},t)}const Bhe="_panel_1jx2a_1",Phe="_title_1jx2a_13",$he="_header_1jx2a_18",zhe="_startup_1jx2a_24",Fhe="_note_1jx2a_28",qhe="_secondary_1jx2a_29",Hhe="_row_1jx2a_39",Uhe="_selected_1jx2a_48",Vhe="_disabled_1jx2a_52",Whe="_pointer_1jx2a_56",Ghe="_nameCell_1jx2a_62",Khe="_truncate_1jx2a_69",Yhe="_separator_1jx2a_75",Qhe="_sectionTitle_1jx2a_79",Xhe="_groupTitle_1jx2a_80",Jhe="_success_1jx2a_84",Zhe="_warning_1jx2a_88",efe="_error_1jx2a_92",tfe="_group_1jx2a_80",nfe="_list_1jx2a_102",sfe="_description_1jx2a_108",rfe="_schema_1jx2a_113",ife="_shortcuts_1jx2a_131",ofe="_detail_1jx2a_137",afe="_serverFields_1jx2a_143",lfe="_serverField_1jx2a_143",cfe="_serverFieldLabel_1jx2a_156",ufe="_detailBlock_1jx2a_160",dfe="_parameters_1jx2a_161",hfe="_invalidBlock_1jx2a_162",ffe="_parameterRow_1jx2a_172",mfe="_actionMessage_1jx2a_177",pfe="_oauthPage_1jx2a_183",gfe="_scrollHint_1jx2a_189",kt={panel:Bhe,title:Phe,header:$he,startup:zhe,note:Fhe,secondary:qhe,row:Hhe,selected:Uhe,disabled:Vhe,pointer:Whe,nameCell:Ghe,truncate:Khe,separator:Yhe,sectionTitle:Qhe,groupTitle:Xhe,success:Jhe,warning:Zhe,error:efe,group:tfe,list:nfe,description:sfe,schema:rfe,shortcuts:ife,detail:ofe,serverFields:afe,serverField:lfe,serverFieldLabel:cfe,detailBlock:ufe,parameters:dfe,invalidBlock:hfe,parameterRow:ffe,actionMessage:mfe,oauthPage:pfe,scrollHint:gfe},U3="web-shell:mcp-panel-active",sd=10,{parse:yfe}=rw("web-shell:mcp-status:v1:");function bfe(e){const t=yfe(e);return!t||!t.status?null:t}function f1(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:kt.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:kt.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:kt.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:kt.error}}}function dP(e){const t=e.schema,n=(t==null?void 0:t.parametersJsonSchema)??(t==null?void 0:t.parameters)??t;return n&&typeof n=="object"?n:null}function vfe(e){const t=dP(e);return t?JSON.stringify(t,null,2):""}function wfe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function xfe(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function _fe(e,t){var s;const n=e.config;if(n!=null&&n.httpUrl)return`${n.httpUrl} (http)`;if(n!=null&&n.url)return`${n.url} (sse)`;if(n!=null&&n.command){const r=((s=n.args)==null?void 0:s.join(" "))??"";return`${n.command} ${r} (stdio)`.trim()}return e.transport?`(${e.transport})`:t("mcp.status.unknown")}function Dx(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function KA(e,t){window.dispatchEvent(new CustomEvent(U3,{detail:{id:e,active:t}}))}function YA(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const r=n.details;if(typeof r=="string"&&r)return r}const s=t.error;if(typeof s=="string"&&s)return s}if(e instanceof Error&&e.message)return e.message}return String(e)}function m1(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function kfe(e,t){return e?t("mcp.required"):""}function Sfe(e,t){const n=dP(e),s=n==null?void 0:n.properties,r=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!s||typeof s!="object"){const o=vfe(e);return o?u.jsx("pre",{className:kt.schema,children:o}):null}const i=Object.entries(s);return i.length===0?null:u.jsxs("div",{className:kt.parameters,children:[u.jsx("div",{className:kt.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",d=typeof l.description=="string"?l.description:"";return u.jsx("div",{className:kt.parameterRow,children:`• ${o}${kfe(r.has(o),t)}: ${c}${d?` - ${d}`:""}`},o)})]})}function Tfe({message:e}){var J;const{t}=Xe(),n=DL({autoLoad:!1}),[s,r]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(null),[c,d]=g.useState(!1),h=g.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[f,m]=g.useState(!0),[p,y]=g.useState("servers"),[w,b]=g.useState(0),[v,x]=g.useState(0),[_,E]=g.useState(0),k=g.useMemo(()=>s.servers??[],[s.servers]),M=k[w]??null,R=g.useMemo(()=>{var B;return M?((B=i[M.name])==null?void 0:B.tools)??[]:[]},[M,i]),L=R[_]??null,T=g.useMemo(()=>R.length<=sd||_<sd-1?0:Math.min(_-sd+1,R.length-sd),[_,R.length]),N=g.useMemo(()=>R.slice(T,T+sd),[R,T]),I=k.filter(B=>!B.disabled&&B.mcpStatus==="connecting").length,O=g.useMemo(()=>{const B=[];for(const C of k){const z=wfe(C,t),X=B.find(ae=>ae.label===z);X?X.servers.push(C):B.push({label:z,servers:[C]})}return B},[k,t]),U=g.useMemo(()=>k.length===0?20:Math.min(Math.max(...k.map(B=>B.name.length))+2,35),[k]),F=g.useMemo(()=>R.length===0?30:Math.min(Math.max(...R.map(B=>B.name.length))+2,50),[R]),j=g.useMemo(()=>{if(!M)return[];const B=[];return!M.disabled&&R.length>0&&B.push({id:"view-tools",label:t("mcp.action.tools")}),!M.disabled&&M.mcpStatus==="disconnected"&&B.push({id:"reconnect",label:t("mcp.action.reconnect")}),B.push({id:M.disabled?"enable":"disable",label:M.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),M.disabled||(B.push({id:"authenticate",label:M.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),M.hasOAuthTokens&&B.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),B},[M,R.length,t]),V=g.useCallback(async()=>{var C;const B=await n.reload();if(B){r(B);const z=((C=B.servers)==null?void 0:C.find(X=>X.name===(M==null?void 0:M.name)))??null;if(z){const X=await n.loadTools(z.name);o(ae=>({...ae,[z.name]:X}))}}},[n,M==null?void 0:M.name]),ee=g.useCallback(async B=>{if(!(!M||B.disabled||c)){if(B.id==="view-tools"){y("tools"),E(0),l(null);return}d(!0),B.id==="authenticate"&&y("oauth"),l(B.id==="authenticate"?m1(M.name,t):t("mcp.action.running",{action:B.label}));try{let C=null;if(B.id==="reconnect")await n.restartServer(M.name);else{const z=await n.manageServer(M.name,B.id),X=[...z.messages??[],...z.authUrl?[z.authUrl]:[]].join(`
`);X&&(C=B.id==="authenticate"?m1(M.name,t,X):X)}await V(),l(C??t("mcp.action.done",{action:B.label}))}catch(C){l(B.id==="authenticate"?m1(M.name,t,YA(C)):t("mcp.action.failed",{error:YA(C)}))}finally{d(!1)}}},[c,n,V,M,t]);if(g.useEffect(()=>{const B=h.current;return KA(B,f),()=>KA(B,!1)},[f]),g.useEffect(()=>{const B=C=>{const z=C.detail;z!=null&&z.active&&z.id&&z.id!==h.current&&m(!1)};return window.addEventListener(U3,B),()=>window.removeEventListener(U3,B)},[]),uP(B=>{if(f){if(B.key==="Escape"){B.preventDefault(),B.stopPropagation(),p==="servers"?m(!1):p==="server"?(y("servers"),x(0),l(null)):p==="oauth"?(y("server"),l(null)):p==="tools"?(y("server"),E(0)):y("tools");return}if(B.key==="ArrowUp"||B.key==="ArrowDown"){B.preventDefault(),B.stopPropagation();const C=B.key==="ArrowUp"?-1:1;p==="servers"?(b(z=>Math.min(Math.max(z+C,0),k.length-1)),x(0)):p==="server"?x(z=>Math.min(Math.max(z+C,0),j.length-1)):p==="tools"&&E(z=>Math.min(Math.max(z+C,0),R.length-1));return}if(B.key==="Enter")if(B.preventDefault(),B.stopPropagation(),p==="servers"&&k.length>0)y("server"),x(0);else if(p==="server"&&j.length>0){const C=j[v];C&&ee(C)}else p==="tools"&&R.length>0&&y("tool")}},[f,v,R.length,j,ee,k.length,p]),!f)return null;if(k.length===0)return u.jsxs("div",{className:kt.panel,"data-keyboard-scope":!0,children:[u.jsxs("div",{className:kt.header,children:[u.jsx("div",{className:kt.title,children:t("mcp.manageServers")}),u.jsx("div",{className:kt.secondary,children:t("mcp.servers",{count:0})})]}),u.jsx("div",{className:kt.secondary,children:t("mcp.empty")}),u.jsx("div",{className:kt.shortcuts,children:t("mcp.shortcut.close")})]});const ce=p==="servers"?t("mcp.manageServers"):p==="server"?(M==null?void 0:M.name)??t("mcp.manageServers"):p==="oauth"?t("mcp.oauth.title"):p==="tools"?t("mcp.toolsForServer",{name:(M==null?void 0:M.name)??t("common.server")}):(L==null?void 0:L.name)??t("mcp.toolDetail"),$=p==="servers"?t("mcp.servers",{count:k.length}):p==="server"||p==="oauth"?"":p==="tools"?t(R.length===1?"mcp.toolCount":"mcp.toolsCount",{count:R.length}):(L==null?void 0:L.serverToolName)??(M==null?void 0:M.name)??"";return u.jsxs("div",{className:kt.panel,"data-keyboard-scope":!0,children:[I>0&&u.jsxs("div",{children:[u.jsx("div",{className:kt.startup,children:t("mcp.starting",{count:I})}),u.jsx("div",{className:kt.note,children:t("mcp.startingNote")})]}),u.jsxs("div",{className:kt.header,children:[u.jsx("div",{className:kt.title,children:ce}),$&&u.jsx("div",{className:kt.secondary,children:$})]}),p==="servers"&&u.jsx("div",{className:kt.list,children:O.map(B=>{let C=0;for(const z of O){if(z===B)break;C+=z.servers.length}return u.jsxs("div",{className:kt.group,children:[u.jsx("div",{className:kt.groupTitle,children:B.label}),B.servers.map((z,X)=>{const ae=C+X,be=ae===w,fe=f1(z,t);return u.jsxs("div",{className:be?`${kt.row} ${kt.selected}`:kt.row,onClick:()=>{b(ae),y("server"),x(0)},onMouseEnter:()=>b(ae),children:[u.jsx("span",{className:kt.pointer,children:be?"❯":""}),u.jsx("span",{className:kt.nameCell,style:{width:`${U}ch`},children:z.name}),u.jsx("span",{className:kt.separator,children:"·"}),u.jsxs("span",{className:fe.className,children:[fe.icon," ",fe.text]})]},z.name)})]},B.label)})}),p==="server"&&M&&u.jsxs("div",{className:kt.detail,children:[u.jsxs("div",{className:kt.serverFields,children:[u.jsxs("div",{className:kt.serverField,children:[u.jsxs("span",{className:kt.serverFieldLabel,children:[t("mcp.status"),":"]}),u.jsxs("span",{className:f1(M,t).className,children:[f1(M,t).icon," ",f1(M,t).text]})]}),u.jsxs("div",{className:kt.serverField,children:[u.jsxs("span",{className:kt.serverFieldLabel,children:[t("mcp.source"),":"]}),u.jsx("span",{children:xfe(M,t)})]}),u.jsxs("div",{className:kt.serverField,children:[u.jsxs("span",{className:kt.serverFieldLabel,children:[t("mcp.command"),":"]}),u.jsx("span",{className:kt.truncate,children:_fe(M,t)})]}),((J=M.config)==null?void 0:J.cwd)&&u.jsxs("div",{className:kt.serverField,children:[u.jsxs("span",{className:kt.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),u.jsx("span",{className:kt.truncate,children:M.config.cwd})]}),!M.disabled&&u.jsxs("div",{className:kt.serverField,children:[u.jsxs("span",{className:kt.serverFieldLabel,children:[t("mcp.tools"),":"]}),u.jsx("span",{children:t(R.length===1?"mcp.toolCount":"mcp.toolsCount",{count:R.length})})]})]}),u.jsx("div",{className:kt.list,children:j.map((B,C)=>{const z=C===v,X=[kt.row,z?kt.selected:"",B.disabled?kt.disabled:""].filter(Boolean).join(" ");return u.jsxs("div",{className:X,onClick:()=>{x(C),ee(B)},children:[u.jsx("span",{className:kt.pointer,children:z?"❯":""}),u.jsx("span",{children:B.label})]},B.id)})}),a&&u.jsx("pre",{className:kt.actionMessage,children:a})]}),p==="oauth"&&u.jsx("div",{className:kt.oauthPage,children:u.jsx("pre",{className:kt.actionMessage,children:a??(M?m1(M.name,t):t("mcp.status.unknown"))})}),p==="tools"&&u.jsx("div",{className:kt.list,children:R.length===0?u.jsx("div",{className:kt.secondary,children:t("mcp.emptyTools")}):N.map((B,C)=>{const z=T+C,X=z===_,ae=Dx(B,t);return u.jsxs("div",{className:X?`${kt.row} ${kt.selected}`:kt.row,onClick:()=>{E(z),y("tool")},onMouseEnter:()=>E(z),children:[u.jsx("span",{className:kt.pointer,children:X?"❯":""}),u.jsx("span",{className:kt.nameCell,style:{width:`${F}ch`},children:B.name}),B.isValid?ae?u.jsx("span",{className:kt.secondary,children:ae}):null:u.jsx("span",{className:kt.warning,children:t("mcp.invalidReason",{reason:B.invalidReason||t("mcp.status.unknown")})})]},B.name)})}),p==="tools"&&R.length>sd&&u.jsxs("div",{className:kt.scrollHint,children:[T>0?"↑ ":"  ",t("mcp.scrollPosition",{current:_+1,total:R.length}),T+sd<R.length?" ↓":""]}),p==="tool"&&L&&u.jsxs("div",{className:kt.detail,children:[!L.isValid&&u.jsxs("div",{className:kt.invalidBlock,children:[u.jsx("div",{className:kt.sectionTitle,children:t("mcp.invalidToolWarning")}),u.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",L.invalidReason||t("mcp.status.unknown")]}),u.jsx("div",{className:kt.secondary,children:t("mcp.invalidToolHelp")})]}),L.description&&u.jsxs("div",{className:kt.detailBlock,children:[u.jsx("div",{className:kt.sectionTitle,children:t("mcp.description")}),u.jsx("div",{className:kt.description,children:L.description.trim()})]}),Dx(L,t)&&u.jsxs("div",{className:kt.detailBlock,children:[u.jsx("span",{className:kt.sectionTitle,children:t("mcp.annotations")})," ",u.jsx("span",{children:Dx(L,t)})]}),Sfe(L,t)]}),u.jsx("div",{className:kt.shortcuts,children:t(p==="servers"?"mcp.shortcut.selectClose":p==="server"||p==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Cfe=3;function jb(e){return e.kind==="agent"&&typeof e.id=="string"}function Afe(e){const t=e.filter(jb),n=new Map;for(const c of t)n.set(c.id,c);const s=new Map,r=[];for(const c of t){const d=c.parentAgentId;if(d!=null&&d!==c.id&&n.has(d)){const h=s.get(d);h?h.push(c):s.set(d,[c])}else r.push(c)}if(s.size===0)return[...e];const i=[],o=new Set,a=c=>{if(!o.has(c.id)){o.add(c.id),i.push(c);for(const d of s.get(c.id)??[])a(d)}};for(const c of r)a(c);for(const c of t)o.has(c.id)||(o.add(c.id),i.push(c));let l=0;return e.map(c=>jb(c)?i[l++]:c)}function hP(e,t){const n=[],s=new Set(e.id!=null?[e.id]:[]);let r=e.parentAgentId;for(;;){if(r==null)return{chain:n,terminatedBy:"root"};if(s.has(r))return{chain:n,terminatedBy:"cycle"};const i=t(r);if(!i)return{chain:n,terminatedBy:"missing"};s.add(r),n.push(i),r=i.parentAgentId}}function Efe(e){const t=new Map;for(const s of e)jb(s)&&t.set(s.id,s);const n=new Map;for(const s of t.values()){const{chain:r,terminatedBy:i}=hP(s,o=>t.get(o));n.set(s.id,{visibleDepth:i==="cycle"?0:r.length,orphaned:r.length===0&&i==="missing"})}return n}function Mfe(e){const t=new Map;for(const s of e)jb(s)&&t.set(s.id,s);const n=new Set;for(const s of t.values()){if(s.isBackgrounded!==!1)continue;const{chain:r,terminatedBy:i}=hP(s,o=>t.get(o));i==="root"&&r.every(o=>o.isBackgrounded===!1)&&n.add(s.id)}return n}function V3(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,s=Math.floor(t/60);if(s===0)return`${n}s`;const r=s%60,i=Math.floor(s/60);return i===0?`${r}m ${n}s`:`${i}h ${r}m`}const Nfe="_panel_1c0ra_1",Ife="_embeddedPanel_1c0ra_12",jfe="_title_1c0ra_19",Rfe="_sectionTitle_1c0ra_24",Lfe="_overflowHint_1c0ra_28",Dfe="_header_1c0ra_33",Ofe="_secondary_1c0ra_39",Bfe="_row_1c0ra_43",Pfe="_selected_1c0ra_51",$fe="_pointer_1c0ra_55",zfe="_nameCell_1c0ra_61",Ffe="_treeMarker_1c0ra_70",qfe="_orphanNote_1c0ra_74",Hfe="_status_1c0ra_78",Ufe="_chevronCell_1c0ra_84",Vfe="_chevron_1c0ra_84",Wfe="_chevronExpanded_1c0ra_101",Gfe="_separator_1c0ra_111",Kfe="_list_1c0ra_115",Yfe="_task_1c0ra_121",Qfe="_taskExpanded_1c0ra_127",Xfe="_success_1c0ra_132",Jfe="_warning_1c0ra_136",Zfe="_error_1c0ra_140",eme="_detail_1c0ra_144",tme="_detailTop_1c0ra_153",nme="_detailTopMain_1c0ra_160",sme="_inlineDetail_1c0ra_200",rme="_taskIcon_1c0ra_222",ime="_detailField_1c0ra_251",ome="_detailFieldLabel_1c0ra_258",ame="_detailContent_1c0ra_264",lme="_compactSummary_1c0ra_271",cme="_actionBar_1c0ra_280",ume="_actionHint_1c0ra_289",dme="_actionButton_1c0ra_294",hme="_dangerButton_1c0ra_314",fme="_shortcuts_1c0ra_318",mme="_confirmHint_1c0ra_324",pme="_statusBadge_1c0ra_328",gme="_activityCurrent_1c0ra_334",yme="_activityPast_1c0ra_341",bme="_promptContent_1c0ra_348",nt={panel:Nfe,embeddedPanel:Ife,title:jfe,sectionTitle:Rfe,overflowHint:Lfe,header:Dfe,secondary:Ofe,row:Bfe,selected:Pfe,pointer:$fe,nameCell:zfe,treeMarker:Ffe,orphanNote:qfe,status:Hfe,chevronCell:Ufe,chevron:Vfe,chevronExpanded:Wfe,separator:Gfe,list:Kfe,task:Yfe,taskExpanded:Qfe,success:Xfe,warning:Jfe,error:Zfe,detail:eme,detailTop:tme,detailTopMain:nme,inlineDetail:sme,taskIcon:rme,detailField:ime,detailFieldLabel:ome,detailContent:ame,compactSummary:lme,actionBar:cme,actionHint:ume,actionButton:dme,dangerButton:hme,shortcuts:fme,confirmHint:mme,statusBadge:pme,activityCurrent:gme,activityPast:yme,promptContent:bme},vp="web-shell:tasks-panel-active",vme=3e3,QA=8,{parse:wme}=rw("web-shell:tasks-status:v1:");function xme(e){const t=wme(e);return!t||!t.snapshot?null:t}function XA(e,t){window.dispatchEvent(new CustomEvent(vp,{detail:{id:e,active:t}}))}function JA(e){return e.status==="running"||e.status==="paused"}function _me(e){return[...e].sort((t,n)=>{const s=JA(t),r=JA(n);return s!==r?s?-1:1:s?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function Ox(e){return Afe(_me(e))}function ZA(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function fP(e){switch(e){case"running":return nt.success;case"paused":return nt.warning;case"completed":return nt.success;case"failed":return nt.error;case"cancelled":return nt.warning;default:return""}}function kme(e,t){switch(e){case"running":return t("tasks.running");case"completed":return t("tasks.completed");case"failed":return t("tasks.failed");case"cancelled":return t("tasks.cancelled");case"paused":return t("tasks.paused");default:return e}}function Sme(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function Tme({expanded:e}){return u.jsx("svg",{className:`${nt.chevron} ${e?nt.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function Cme(e,t){switch(e.kind){case"agent":return t?`[blocking] ${e.label}`:e.label;case"shell":return`[shell] ${e.command}`;case"monitor":return`[monitor] ${e.description}`}}function Ame(e,t){if(e.length<=QA)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,QA-2),s=Math.max(0,Math.min(t-Math.floor(n/2),e.length-n)),r=Math.min(e.length,s+n);return{visible:e.slice(s,r),windowStart:s,hiddenAbove:s,hiddenBelow:e.length-r}}function Eme(e,t,n){const s=Sl(e,n),r=t?t.replace(/\s*\n\s*/g," ").trim():"";return r?`${s}(${r})`:s}function mP({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:s}){const{t:r}=Xe(),i=Xp(),[o,a]=g.useState(()=>Ox(e.snapshot.tasks)),[l,c]=g.useState(!0),[d,h]=g.useState("list"),[f,m]=g.useState(0),[p,y]=g.useState(null),[w,b]=g.useState(!1),[v,x]=g.useState(!1),[_,E]=g.useState(null),k=g.useRef(`tasks-${Math.random().toString(36).slice(2)}`),M=g.useRef(!1),R=g.useRef(null),L=o.length===0?0:Math.min(f,o.length-1),T=o[L]??null,N=g.useMemo(()=>Efe(o),[o]),I=g.useMemo(()=>Mfe(o),[o]);g.useEffect(()=>{if(!l)return;const z=setInterval(()=>{M.current||(M.current=!0,i.getTasks().then(X=>{a(Ox(X.tasks)),x(!1)}).catch(X=>{console.warn("[web-shell] failed to refresh tasks:",X),x(!0)}).finally(()=>{M.current=!1}))},vme);return()=>clearInterval(z)},[l,i]),g.useEffect(()=>{o.length===0&&f!==0&&m(0),f>=o.length&&o.length>0&&m(o.length-1)},[o.length,f]),g.useEffect(()=>{if(!l||d!=="detail"){R.current=null;return}if(!T){R.current=null,h("list");return}const C=R.current;if(!C||C.taskId!==T.id){R.current={taskId:T.id,status:T.status};return}C.status==="running"&&T.status!=="running"&&(y(null),h("list"))},[l,d,T]),g.useEffect(()=>{if(!n)return;const C=k.current;return XA(C,l),()=>XA(C,!1)},[l,n]),g.useEffect(()=>{if(!n)return;const C=z=>{const X=z.detail;X!=null&&X.active&&X.id&&X.id!==k.current&&c(!1)};return window.addEventListener(vp,C),()=>window.removeEventListener(vp,C)},[n]),g.useEffect(()=>{l||s==null||s()},[l,s]);const O=g.useCallback(async C=>{if(w)return;const z=C.status==="running",X=C.kind==="agent"&&C.status==="paused";if(!z&&!X)return;if(C.kind==="agent"&&I.has(C.id)&&p!==C.id){y(C.id);return}y(null),b(!0);try{if(!(await i.cancelTask(C.id,C.kind)).cancelled){E(r("tasks.alreadyStopped"));return}const fe=await i.getTasks();a(Ox(fe.tasks)),E(null)}catch(be){console.warn("[web-shell] failed to cancel task:",be),E(r("tasks.cancelFailed"))}finally{b(!1)}},[i,w,I,p,r]);if(uP(C=>{if(l){if(C.key==="Escape"){if(C.preventDefault(),C.stopPropagation(),p){y(null);return}d==="detail"?h("list"):c(!1);return}if(C.key==="ArrowLeft"){C.preventDefault(),C.stopPropagation(),d==="detail"?(y(null),h("list")):c(!1);return}if((C.key==="ArrowUp"||C.key==="ArrowDown")&&d==="list"){if(C.preventDefault(),C.stopPropagation(),o.length===0)return;const z=C.key==="ArrowUp"?-1:1;m(X=>Math.min(Math.max(X+z,0),o.length-1)),y(null);return}if(C.key==="Enter"){C.preventDefault(),C.stopPropagation(),d==="list"&&T?h("detail"):d==="detail"&&c(!1);return}if(C.key===" "&&d==="detail"){C.preventDefault(),C.stopPropagation(),c(!1);return}if(C.key==="x"&&!C.ctrlKey&&!C.metaKey){C.preventDefault(),C.stopPropagation(),T&&O(T);return}}},[l,d,o.length,T,O,p]),!l)return null;const U=p!==null&&T!==null&&p===T.id,F=[];U?(F.push(r("tasks.confirmStop")),F.push(r("tasks.shortcut.cancelConfirm"))):(F.push(r("tasks.shortcut.select")),F.push(r("tasks.shortcut.view")),(T==null?void 0:T.status)==="running"?F.push(r("tasks.shortcut.stop")):(T==null?void 0:T.kind)==="agent"&&(T==null?void 0:T.status)==="paused"&&F.push(r("tasks.shortcut.abandon")),F.push(r("tasks.shortcut.listClose")));const j=[];if(U?(j.push(r("tasks.confirmStop")),j.push(r("tasks.shortcut.cancelConfirm"))):(j.push(r("tasks.shortcut.detailBack")),j.push(r("tasks.shortcut.detailClose")),(T==null?void 0:T.status)==="running"?j.push(r("tasks.shortcut.stop")):(T==null?void 0:T.kind)==="agent"&&(T==null?void 0:T.status)==="paused"&&j.push(r("tasks.shortcut.abandon"))),o.length===0)return u.jsxs("div",{className:t?`${nt.panel} ${nt.embeddedPanel}`:nt.panel,"data-keyboard-scope":!0,children:[(v||_||!t)&&u.jsxs("div",{className:nt.header,children:[!t&&u.jsx("div",{className:nt.title,children:r("tasks.title")}),v&&u.jsx("div",{className:nt.warning,children:r("tasks.refreshStale")}),_&&u.jsx("div",{className:nt.error,children:_})]}),u.jsx("div",{children:u.jsx("div",{className:nt.secondary,children:r("tasks.empty")})}),!t&&u.jsx("div",{className:nt.shortcuts,children:r("tasks.shortcut.close")})]});const{visible:V,windowStart:ee,hiddenAbove:ce,hiddenBelow:$}=Ame(o,L),J=t?o:V,B=t?0:ee;return u.jsxs("div",{className:t?`${nt.panel} ${nt.embeddedPanel}`:nt.panel,"data-keyboard-scope":!0,children:[(t||d==="list")&&(v||_||!t)&&u.jsxs("div",{className:nt.header,children:[!t&&u.jsx("div",{className:nt.title,children:r("tasks.title")}),v&&u.jsx("div",{className:nt.warning,children:r("tasks.refreshStale")}),_&&u.jsx("div",{className:nt.error,children:_})]}),(t||d==="list")&&u.jsxs("div",{className:nt.list,children:[!t&&u.jsxs("div",{className:nt.sectionTitle,children:[r("tasks.title")," ",u.jsxs("span",{className:nt.secondary,children:["(",o.length,")"]})]}),!t&&ce>0&&u.jsx("div",{className:nt.overflowHint,children:r("tasks.moreAbove",{count:ce})}),J.map((C,z)=>{const X=B+z,ae=X===L,be=fP(C.status),fe=kme(C.status,r),ie=t&&ae&&d==="detail",G=t?ie:ae,q=C.kind==="agent"?N.get(C.id):void 0,le=Math.min((q==null?void 0:q.visibleDepth)??0,Cfe),Se=C.kind==="agent"&&C.parentAgentId!=null,$e=q!=null&&q.orphaned?C.kind==="agent"&&C.parentName?r("tasks.row.from",{parent:C.parentName}):r("tasks.row.nested"):null;return u.jsxs("div",{className:`${nt.task} ${ie?nt.taskExpanded:""}`,children:[u.jsxs("div",{className:G?`${nt.row} ${nt.selected}`:nt.row,onClick:()=>{m(X),h(t&&ie?"list":"detail")},onMouseEnter:()=>{t||m(X)},children:[u.jsx("span",{className:nt.pointer,children:G?"❯":""}),t&&u.jsx("span",{className:nt.taskIcon,"aria-hidden":"true"}),u.jsxs("span",{className:nt.nameCell,style:le>0?{paddingLeft:`${le*16}px`}:void 0,children:[Se&&u.jsx("span",{className:nt.treeMarker,"aria-hidden":"true",children:"↳ "}),Cme(C,I.has(C.id)),$e&&u.jsxs("span",{className:nt.orphanNote,children:[" · ",$e]})]}),u.jsx("span",{className:`${nt.status} ${be}`,children:fe}),u.jsx("span",{className:nt.chevronCell,children:u.jsx(Tme,{expanded:ie})})]}),ie&&u.jsx("div",{className:nt.inlineDetail,children:u.jsx(eE,{task:C,t:r,hideHeader:!0,busy:w,showCancelConfirm:p===C.id,onCancel:()=>void O(C),onCancelConfirmDismiss:()=>y(null)})})]},C.id)}),!t&&$>0&&u.jsx("div",{className:nt.overflowHint,children:r("tasks.moreBelow",{count:$})})]}),!t&&d==="detail"&&T&&u.jsxs(u.Fragment,{children:[_&&u.jsx("div",{className:nt.error,children:_}),u.jsx(eE,{task:T,t:r,busy:w,showCancelConfirm:p===T.id,onCancel:()=>void O(T),onCancelConfirmDismiss:()=>y(null)})]}),!t&&u.jsx("div",{className:U?`${nt.shortcuts} ${nt.confirmHint}`:nt.shortcuts,children:(d==="list"?F:j).join(" · ")})]})}function Mme(e,t){switch(e.kind){case"agent":return`${e.subagentType??t("common.agent")} › ${e.label}`;case"shell":return`${t("tasks.kind.shell")} › ${e.command}`;case"monitor":return`${t("tasks.kind.monitor")} › ${e.description}`}}function eE({task:e,t,hideHeader:n=!1,busy:s=!1,showCancelConfirm:r=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,_,E;const a=Sme(e.status),l=fP(e.status),c=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||c,h=t(c?"tasks.action.abandon":"tasks.action.stop"),f=t(c?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),m=[V3(e.runtimeMs)],p=[{label:t("tasks.detail.runtime"),value:V3(e.runtimeMs)}],y=e.kind==="agent"?((x=e.stats)==null?void 0:x.outputTokens)??((_=e.stats)==null?void 0:_.totalTokens):void 0;y&&(m.push(t("tasks.detail.tokens",{count:ZA(y)})),p.push({label:t("tasks.detail.tokenCount"),value:ZA(y)})),e.kind==="agent"&&((E=e.stats)==null?void 0:E.toolUses)!==void 0&&(m.push(t("tasks.detail.toolCalls",{count:e.stats.toolUses})),p.push({label:t("tasks.detail.toolCallCount"),value:String(e.stats.toolUses)})),e.kind!=="agent"&&e.pid!==void 0&&m.push(`pid ${e.pid}`),e.kind==="shell"&&e.exitCode!==void 0&&m.push(t("tasks.detail.exit",{exitCode:e.exitCode})),e.kind==="monitor"&&(m.push(t("tasks.detail.events",{count:e.eventCount})),e.droppedLines>0&&m.push(t("tasks.detail.dropped",{count:e.droppedLines})),e.exitCode!==void 0&&m.push(t("tasks.detail.exit",{exitCode:e.exitCode})));const w=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],b=d&&i?u.jsx("div",{className:nt.actionBar,children:r?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:nt.actionHint,children:t("tasks.action.confirmHint")}),u.jsx("button",{type:"button",className:`${nt.actionButton} ${nt.dangerButton}`,disabled:s,onClick:i,children:f}),u.jsx("button",{type:"button",className:nt.actionButton,onClick:o,children:t("common.cancel")})]}):u.jsx("button",{type:"button",className:`${nt.actionButton} ${nt.dangerButton}`,disabled:s,onClick:i,children:h})}):null,v=n?p.length>0?u.jsx("div",{className:nt.compactSummary,children:p.map(k=>`${k.label} ${k.value}`).join(" · ")}):null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:nt.title,children:Mme(e,t)}),u.jsxs("div",{className:nt.statusBadge,children:[a&&u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),u.jsx("span",{className:nt.separator,children:"·"})]}),u.jsx("span",{className:nt.secondary,children:m.join(" · ")})]})]});return u.jsxs("div",{className:nt.detail,children:[(v||b)&&u.jsxs("div",{className:nt.detailTop,children:[v&&u.jsx("div",{className:nt.detailTopMain,children:v}),b]}),e.kind==="shell"&&u.jsxs(u.Fragment,{children:[u.jsx(Ah,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&u.jsx(Ah,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&u.jsx(Ah,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&u.jsx(Ah,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&u.jsx(Ah,{label:t("tasks.detail.nesting"),value:e.parentName?t("tasks.detail.nestingValue",{level:(e.depth??0)+1,parent:e.parentName}):t("tasks.detail.nestingLevel",{level:(e.depth??0)+1})}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&u.jsxs("div",{className:nt.detailField,children:[u.jsx("div",{className:nt.detailFieldLabel,children:t("tasks.detail.progress")}),u.jsx("div",{className:nt.detailContent,children:e.recentActivities.slice(-5).map((k,M,R)=>{const L=M===R.length-1,T=Eme(k.name,k.description,t);return u.jsxs("div",{className:L?nt.activityCurrent:nt.activityPast,children:[L?"> ":"  ",T]},`${k.at}-${M}`)})})]}),e.kind==="agent"&&e.prompt&&u.jsxs("div",{className:nt.detailField,children:[u.jsx("div",{className:nt.detailFieldLabel,children:t("tasks.detail.prompt")}),u.jsx("div",{className:nt.promptContent,children:w.slice(0,5).map((k,M,R)=>u.jsx("div",{children:M===R.length-1&&w.length>5?`${k}…`:k||" "},M))})]}),e.kind==="agent"&&e.outputFile&&u.jsx(Ah,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&u.jsxs("div",{className:nt.detailField,children:[u.jsx("div",{className:`${nt.detailFieldLabel} ${nt.error}`,children:t("tasks.detail.resumeBlocked")}),u.jsx("div",{className:nt.error,children:e.resumeBlockedReason})]}),e.error&&u.jsxs("div",{className:nt.detailField,children:[u.jsx("div",{className:`${nt.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?nt.warning:nt.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),u.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?nt.warning:nt.error,children:e.error})]})]})}function Ah({label:e,value:t}){return u.jsxs("div",{className:nt.detailField,children:[u.jsx("div",{className:nt.detailFieldLabel,children:e}),u.jsx("div",{className:nt.detailContent,children:t})]})}const Nme="_message_fm8gc_1",Ime="_body_fm8gc_15",jme="_title_fm8gc_20",Rme="_muted_fm8gc_24",Lme="_accent_fm8gc_28",Dme="_success_fm8gc_32",Ome="_error_fm8gc_36",Bme="_warning_fm8gc_40",Pme="_row_fm8gc_44",$me="_label_fm8gc_50",zme="_value_fm8gc_55",no={message:Nme,body:Ime,title:jme,muted:Rme,accent:Lme,success:Dme,error:Ome,warning:Bme,row:Pme,label:$me,value:zme},W3="web-shell-goal-status-active",{serialize:tE,parse:Fme}=rw(eK),qme=new Set(["set","achieved","cleared","failed","aborted","checking"]);function Rb(e){const t=typeof e=="string"?Fme(e):e;return Hme(t)}function Hme(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,s=t.condition;if(typeof n!="string"||!qme.has(n)||typeof s!="string")return null;const r=Bx(t.iterations),i=Bx(t.durationMs),o=Bx(t.setAt),a=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:s,...r!==void 0?{iterations:r}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...a!==void 0?{lastReason:a}:{}}}function Bx(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Ume(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function Vme(e,t){switch(e.kind){case"checking":return{title:`${t("goal.check")}${e.iterations&&e.iterations>0?` · ${t("goal.turnLabel",{count:e.iterations})}`:""} · ${t("goal.notYetMet")}`,colorClass:no.muted};case"set":return{title:t("goal.set"),colorClass:no.accent};case"achieved":return{title:t("goal.achieved"),colorClass:no.success};case"cleared":return{title:t("goal.cleared"),colorClass:no.muted};case"failed":return{title:t("goal.failed"),colorClass:no.error};case"aborted":return{title:t("goal.aborted"),colorClass:no.warning}}}function Wme({status:e,activateFooter:t=!1}){var l;const{t:n}=Xe();g.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(W3,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const s=Vme(e,n),r=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&r.push(Ume(e.iterations,n)),typeof e.durationMs=="number"&&r.push(V3(e.durationMs)));const i=r.length>0?` · ${r.join(" · ")}`:"",o=(e.kind==="checking"||e.kind==="achieved"||e.kind==="failed"||e.kind==="aborted")&&((l=e.lastReason)==null?void 0:l.trim()),a=e.kind==="checking"?n("goal.judge"):n("goal.lastCheck");return u.jsx("div",{className:no.message,children:u.jsxs("div",{className:no.body,children:[u.jsxs("div",{className:`${no.title} ${s.colorClass}`,children:[s.title,i&&u.jsx("span",{className:no.muted,children:i})]}),u.jsxs("div",{className:no.row,children:[u.jsxs("span",{className:no.label,children:[n("goal.label"),":"]}),u.jsx("span",{className:no.value,children:e.condition})]}),o&&u.jsxs("div",{className:no.muted,children:[a,": ",o]})]})})}const Gme="_message_u8kmd_1",Kme="_flushMessage_u8kmd_12",Yme="_noMarker_u8kmd_26",Qme="_content_u8kmd_30",Xme="_info_u8kmd_49",Jme="_recap_u8kmd_54",Zme="_modelSwitch_u8kmd_67",e0e="_error_u8kmd_71",t0e="_warning_u8kmd_77",n0e="_retryHint_u8kmd_83",s0e="_retryButton_u8kmd_90",r0e="_cancelled_u8kmd_108",Xi={message:Gme,flushMessage:Kme,noMarker:Yme,content:Qme,info:Xme,recap:Jme,modelSwitch:Zme,error:e0e,warning:t0e,retryHint:n0e,retryButton:s0e,cancelled:r0e},i0e=g.memo(function({content:t,variant:n,source:s,data:r,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:c}=Xe();if(s==="prompt_cancelled")return u.jsx("div",{className:Xi.cancelled,role:"status",children:u.jsx("span",{children:c("turn.stopped")})});const d=n==="info"?jde(t):null;if(d)return u.jsx("div",{className:Xi.flushMessage,children:u.jsx($de,{status:d,onShowDetail:i})});const h=n==="info"?yhe(t):null;if(h)return u.jsx("div",{className:Xi.flushMessage,children:u.jsx(The,{view:h.view,status:h.status})});const f=n==="info"?Lhe(t):null;if(f)return u.jsx("div",{className:Xi.flushMessage,children:u.jsx(Dhe,{info:f})});const m=n==="info"?bfe(t):null;if(m)return u.jsx("div",{className:Xi.flushMessage,children:u.jsx(Tfe,{message:m})});const p=n==="info"?xme(t):null;if(p)return u.jsx("div",{className:Xi.flushMessage,children:u.jsx(mP,{message:p})});const y=n==="info"?Rb(s==="goal"?r:t):null;if(y)return u.jsx("div",{className:Xi.flushMessage,children:u.jsx(Wme,{status:y,activateFooter:o})});const w=n==="info"&&s==="model_switch_summary",b=n==="info"&&s==="recap";return u.jsx("div",{className:`${Xi.message} ${Xi[n]} ${w?Xi.modelSwitch:""} ${b?Xi.recap:""}`,children:u.jsxs("div",{className:Xi.content,children:[w?u.jsx("pre",{children:t}):n==="info"?u.jsx(hm,{content:t}):u.jsx("pre",{children:t}),a&&l&&u.jsx("div",{className:Xi.retryHint,children:u.jsx("button",{type:"button",className:Xi.retryButton,onClick:l,children:c("retry.hint")})})]})})}),o0e="_group_emvwk_1",a0e="_chatSummaryGroup_emvwk_14",l0e="_line_emvwk_22",c0e="_chatSummary_emvwk_14",u0e="_chatSummaryTextActive_emvwk_49",d0e="_chatSummaryIcon_emvwk_55",h0e="_chatSummaryToolIcon_emvwk_69",f0e="_chatSummaryText_emvwk_49",m0e="_chatSummaryInline_emvwk_85",p0e="_chatChevronRight_emvwk_122",g0e="_chatChevronDown_emvwk_123",y0e="_chatSummaryContentClip_emvwk_184",b0e="_chatSummaryContentCollapsed_emvwk_192",v0e="_chatSummaryContentInner_emvwk_196",w0e="_lineMain_emvwk_201",x0e="_icon_emvwk_211",_0e="_iconError_emvwk_216",k0e="_lineName_emvwk_220",S0e="_lineArg_emvwk_224",T0e="_lineElapsed_emvwk_232",C0e="_lineExpandable_emvwk_238",A0e="_lineChevronRight_emvwk_258",E0e="_lineChevronDown_emvwk_259",M0e="_lineOutput_emvwk_296",N0e="_expandedCard_emvwk_305",I0e="_expandedCardHeader_emvwk_315",j0e="_expandedCardTitle_emvwk_324",R0e="_expandedCardDetail_emvwk_331",L0e="_expandedCardBody_emvwk_341",D0e="_expandedAgentCard_emvwk_346",O0e="_expandedLineOutput_emvwk_356",B0e="_lineDetail_emvwk_360",P0e="_markdownLineDetail_emvwk_366",$0e="_expandedBash_emvwk_374",z0e="_expandedRead_emvwk_375",F0e="_expandedOutput_emvwk_379",q0e="_expandedEdit_emvwk_393",H0e="_todoProgress_emvwk_407",U0e="_todoBody_emvwk_414",V0e="_compactGroup_emvwk_422",W0e="_compactHeader_emvwk_429",G0e="_compactCount_emvwk_439",K0e="_compactHint_emvwk_445",gt={group:o0e,chatSummaryGroup:a0e,line:l0e,chatSummary:c0e,chatSummaryTextActive:u0e,chatSummaryIcon:d0e,chatSummaryToolIcon:h0e,chatSummaryText:f0e,chatSummaryInline:m0e,chatChevronRight:p0e,chatChevronDown:g0e,chatSummaryContentClip:y0e,chatSummaryContentCollapsed:b0e,chatSummaryContentInner:v0e,lineMain:w0e,icon:x0e,iconError:_0e,lineName:k0e,lineArg:S0e,lineElapsed:T0e,lineExpandable:C0e,lineChevronRight:A0e,lineChevronDown:E0e,lineOutput:M0e,expandedCard:N0e,expandedCardHeader:I0e,expandedCardTitle:j0e,expandedCardDetail:R0e,expandedCardBody:L0e,expandedAgentCard:D0e,expandedLineOutput:O0e,lineDetail:B0e,markdownLineDetail:P0e,expandedBash:$0e,expandedRead:z0e,expandedOutput:F0e,expandedEdit:q0e,todoProgress:H0e,todoBody:U0e,compactGroup:V0e,compactHeader:W0e,compactCount:G0e,compactHint:K0e};function Ud({status:e}){const{t}=Xe();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return u.jsx("span",{className:`${gt.icon} ${gt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function lg(e,t){if(!e)return"";const n=Math.round(((t||Date.now())-e)/1e3);if(n<3)return"";if(n<60)return`${n}s`;const s=Math.floor(n/60),r=n%60;return`${s}m ${r}s`}function pP(e){if(!e)return"";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return`${n}m ${s}s`}function gP(e){const t=Math.max(1,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}const Y0e="_panel_3zg2e_1",Q0e="_header_3zg2e_11",X0e="_desc_3zg2e_23",J0e="_toggle_3zg2e_32",Z0e="_meta_3zg2e_38",epe="_body_3zg2e_44",tpe="_content_3zg2e_55",npe="_stream_3zg2e_70",spe="_streamCollapsed_3zg2e_80",rpe="_scrollWindow_3zg2e_87",ipe="_expandToggle_3zg2e_92",ope="_tabBar_3zg2e_107",ape="_tab_3zg2e_107",lpe="_tabActive_3zg2e_129",cpe="_tools_3zg2e_134",upe="_toolTimeRow_3zg2e_151",dpe="_toolTimeTip_3zg2e_155",Vs={panel:Y0e,header:Q0e,desc:X0e,toggle:J0e,meta:Z0e,body:epe,content:tpe,stream:npe,streamCollapsed:spe,scrollWindow:rpe,expandToggle:ipe,tabBar:ope,tab:ape,tabActive:lpe,tools:cpe,toolTimeRow:upe,toolTimeTip:dpe};function yP(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function hpe({timestamp:e,children:t}){return e===void 0?u.jsx(u.Fragment,{children:t}):u.jsxs("div",{className:Vs.toolTimeRow,children:[t,u.jsx("span",{className:Vs.toolTimeTip,"aria-hidden":"true",children:Lf(e)})]})}const fpe=g.memo(function({tool:t}){const n=t.subTools||t.subContent?u.jsx(w6,{tool:t}):u.jsx(Y3,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return u.jsx(hpe,{timestamp:t.startTime,children:n})});function mpe({tc:e}){const{t}=Xe();return u.jsx("div",{className:gt.line,children:u.jsxs("div",{className:gt.lineMain,children:[u.jsx(Ud,{status:e.status}),u.jsx("span",{className:gt.lineName,children:Sl(e.name,t)})]})})}function ppe(e){var t;if(e.rawOutput&&yP(e.rawOutput)&&e.rawOutput.result)return e.rawOutput.result;if(e.content){for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text}if(e.rawOutput){if(typeof e.rawOutput=="string")return e.rawOutput;const n=e.rawOutput;if(typeof n.output=="string")return n.output;if(typeof n.result=="string")return n.result;if(typeof n.content=="string")return n.content;if(typeof n.reason=="string")return n.reason;if(typeof n.terminateReason=="string"&&n.terminateReason!=="GOAL")return n.terminateReason;if(typeof n.error=="string")return n.error;if(typeof n.text=="string")return n.text}return""}function gpe({text:e}){const{compactThinking:t}=vl(),{t:n}=Xe(),[s,r]=g.useState(!1),[i,o]=g.useState(!1),a=g.useRef(null),l=t&&!s;return g.useEffect(()=>{const c=a.current;!c||!l||(o(c.scrollHeight>c.clientHeight),c.scrollTop=c.scrollHeight)},[l,e]),g.useEffect(()=>{const c=a.current;if(!c||!l)return;const d=()=>o(c.scrollHeight>c.clientHeight),h=new ResizeObserver(d);return h.observe(c),()=>h.disconnect()},[l]),u.jsxs("div",{children:[u.jsx("pre",{ref:a,className:l?`${Vs.stream} ${Vs.streamCollapsed}`:Vs.stream,children:e}),t&&(i||s)&&u.jsx("button",{className:Vs.expandToggle,onClick:()=>r(c=>!c),"aria-expanded":s,"aria-label":n("subagent.toggleStream"),children:s?"▲":"▼"})]})}function ype({content:e}){const{compactThinking:t}=vl();return u.jsx("div",{className:t?Vs.scrollWindow:void 0,children:u.jsx(hm,{content:e,source:"assistant"})})}function nE({pinTail:e,itemCount:t,children:n}){const{compactThinking:s}=vl(),r=g.useRef(null);return g.useEffect(()=>{const i=r.current;!i||!s||(i.scrollTop=e?i.scrollHeight:0)},[s,e,t]),u.jsx("div",{ref:r,className:s?`${Vs.tools} ${Vs.scrollWindow}`:Vs.tools,children:n})}function w6({tool:e,defaultExpanded:t,hideHeader:n,inline:s}){var M,R,L,T;const{t:r}=Xe(),i=e.status==="completed"||e.status==="failed",o=yp(e),[a,l]=g.useState(t??!1),[c,d]=g.useState("result"),h=yP(e.rawOutput)?e.rawOutput:null,f=((M=e.subTools)==null?void 0:M.length)||((R=h==null?void 0:h.toolCalls)==null?void 0:R.length)||0,m=v6(e),p=b6(e),y=lg(e.startTime,e.endTime)||pP((L=h==null?void 0:h.executionSummary)==null?void 0:L.totalDurationMs),w=h!=null&&h.tokenCount&&h.tokenCount>0?h.tokenCount:(T=h==null?void 0:h.executionSummary)==null?void 0:T.outputTokens,b=w?y6(w):"",v=i?ppe(e):"",x=g.useMemo(()=>e.subTools&&e.subTools.length>0?null:(h==null?void 0:h.toolCalls)||null,[e.subTools,h]),_=!!(e.subContent||v),E=!!(e.subTools&&e.subTools.length>0||x&&x.length>0),k=_&&E;return u.jsxs("div",{className:s?void 0:Vs.panel,children:[!n&&u.jsxs("div",{className:Vs.header,onClick:()=>l(!a),children:[u.jsx(Ud,{status:o}),u.jsxs("span",{className:gt.lineName,children:[p,":"]}),m&&u.jsx("span",{className:Vs.desc,children:Dr(m,50)}),i&&f>0&&u.jsxs("span",{className:Vs.meta,children:["· ",r("subagent.toolsCount",{count:f})]}),y&&u.jsxs("span",{className:Vs.meta,children:["· ",y]}),b&&u.jsxs("span",{className:Vs.meta,children:["· ",b]}),!i&&u.jsx("span",{className:Vs.toggle,children:a?"▼":"▶"})]}),(a||n)&&u.jsxs("div",{className:Vs.body,children:[k&&u.jsxs("div",{className:Vs.tabBar,children:[u.jsx("button",{className:`${Vs.tab} ${c==="result"?Vs.tabActive:""}`,onClick:()=>d("result"),children:r("subagent.result")}),u.jsx("button",{className:`${Vs.tab} ${c==="tools"?Vs.tabActive:""}`,onClick:()=>d("tools"),children:r("subagent.tools",{count:f})})]}),(!k||c==="result")&&_&&u.jsx("div",{className:Vs.content,children:i?u.jsx(ype,{content:e.subContent||v}):e.subContent&&u.jsx(gpe,{text:e.subContent})}),(!k||c==="tools")&&u.jsxs(u.Fragment,{children:[e.subTools&&e.subTools.length>0&&u.jsx(nE,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(N=>u.jsx(fpe,{tool:N},N.callId))}),x&&x.length>0&&u.jsx(nE,{pinTail:!i,itemCount:x.length,children:x.map(N=>u.jsx(mpe,{tc:N},N.callId))})]})]})]})}const bpe="_view_1ycry_1",vpe="_stats_1ycry_7",wpe="_statAdd_1ycry_16",xpe="_statDel_1ycry_20",_pe="_lines_1ycry_24",kpe="_line_1ycry_24",Spe="_lineAdd_1ycry_36",Tpe="_lineDel_1ycry_40",Cpe="_lineHeader_1ycry_44",Ape="_lineContext_1ycry_50",Epe="_lineNo_1ycry_54",Mpe="_marker_1ycry_64",Npe="_content_1ycry_79",Ua={view:bpe,stats:vpe,statAdd:wpe,statDel:xpe,lines:_pe,line:kpe,lineAdd:Spe,lineDel:Tpe,lineHeader:Cpe,lineContext:Ape,lineNo:Epe,marker:Mpe,content:Npe};function Ipe(e){let t=0,n=0;const s=[];let r=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const a=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(r=parseInt(a[1],10),i=parseInt(a[2],10)),s.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,s.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,s.push({type:"del",content:o.slice(1),oldLine:r}),r++):(s.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:r,newLine:i}),r++,i++);return{lines:s,additions:t,deletions:n}}const jpe=g.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:s,deletions:r}=Ipe(t);return u.jsxs("div",{className:Ua.view,children:[u.jsxs("div",{className:Ua.stats,children:[s>0&&u.jsxs("span",{className:Ua.statAdd,children:["+",s]}),r>0&&u.jsxs("span",{className:Ua.statDel,children:["-",r]})]}),u.jsx("div",{className:Ua.lines,children:n.map((i,o)=>u.jsxs("div",{className:`${Ua.line} ${Ua[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[u.jsx("span",{className:Ua.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),u.jsx("span",{className:Ua.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),u.jsx("span",{className:Ua.content,children:i.content})]},o))})]})}),sE={30:"#4a4a4a",31:"#fc8181",32:"#48bb78",33:"#ecc94b",34:"#4a9eff",35:"#b794f4",36:"#76e4f7",37:"#e0e6f0",90:"#5a6a8a",91:"#feb2b2",92:"#9ae6b4",93:"#fefcbf",94:"#90cdf4",95:"#d6bcfa",96:"#b2f5ea",97:"#ffffff"};function Rpe(e){const t=[];let n,s=!1,r=!1,i=0;const o=new RegExp(String.raw`\x1b\[([0-9;]*)m`,"g");let a;for(;(a=o.exec(e))!==null;){a.index>i&&t.push({text:e.slice(i,a.index),color:n,bold:s,dim:r}),i=a.index+a[0].length;const l=a[1].split(";").map(Number);for(const c of l)c===0?(n=void 0,s=!1,r=!1):c===1?s=!0:c===2?r=!0:c===22?(s=!1,r=!1):c>=30&&c<=37||c>=90&&c<=97?n=sE[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:s,dim:r}),t}function Lpe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function _c(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function Px(e){const t=e.flatMap((n,s)=>{const r=Db(n),i=p1(r,"content");return i?[{id:p1(r,"id")??`plan-${s}`,content:i,status:Wpe(p1(r,"status")),priority:Gpe(p1(r,"priority"))}]:[]});return t.length>0?t:void 0}function x6(e){if(!_c(e.toolName)&&e.kind!=="other")return;const t=iE(e.args);if(t)return Px(t);const n=Db(e.rawOutput),s=iE(n);if(s)return Px(s);const r=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return r?Px(r):void 0}function Dpe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function Lb(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const rE={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function Ope(e){let t=[],n=null,s=null,r=!1;for(const o of e){if(o.role==="user"||o.role==="user_shell"){r=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,s=null,r=!1;continue}if(o.role==="tool_group")for(const a of o.tools){const l=x6(a);l&&(t=l,n=o.id,s=a.callId,r=!1)}}if(t.length===0)return rE;const i=!Dpe(t);return r?rE:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:s}}function _6(e){return JSON.stringify([e.id,e.content])}function iw(e){if(e.role==="plan")return[{key:e.id,todos:e.todos}];if(e.role==="tool_group"){const t=[];for(const n of e.tools){const s=x6(n);s&&t.push({key:n.callId,todos:s,stats:zpe(n)})}return t}return[]}function Bpe(e){const t=new Map,n=new Map;for(const s of e)for(const{key:r,todos:i}of iw(s)){const o=[];for(const a of i){const l=_6(a),c=n.get(l);a.status==="in_progress"&&c!=="in_progress"?o.push({kind:"started",id:a.id,content:a.content}):a.status==="completed"&&c!=="completed"&&c!==void 0&&o.push({kind:"completed",id:a.id,content:a.content}),n.set(l,a.status)}t.set(r,{events:o})}return t}function Ppe(e){const t=[];for(const n of e)for(const{key:s,todos:r}of iw(n))t.push(JSON.stringify([s,r.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function $pe(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const s of n.tools)!_c(s.toolName)&&(s.startTime!==void 0||s.endTime!==void 0)&&t.push(JSON.stringify(["span",s.callId,s.startTime,s.endTime]));for(const{key:s,todos:r,stats:i}of iw(n))t.push(JSON.stringify([s,n.timestamp,r.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function zpe(e){var o;const t=Db((o=Db(e.rawOutput))==null?void 0:o.stats);if(!t)return;const n=a=>{const l=t[a];return typeof l=="number"&&Number.isFinite(l)?l:void 0},s=n("promptTokens"),r=n("cachedTokens"),i=n("candidateTokens");if(!(s===void 0||r===void 0||i===void 0))return{promptTokens:s,cachedTokens:r,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function Fpe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools){if(_c(s.toolName))continue;const{startTime:r,endTime:i}=s;typeof r=="number"&&typeof i=="number"&&i>=r&&t.push({start:r,end:i})}return t.sort((n,s)=>n.start-s.start),t}function qpe(e,t,n){let s=0,r=e.length;for(;s<r;){const o=s+r>>>1;e[o].start<t?s=o+1:r=o}let i=0;for(let o=s;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function Hpe(e,t){const n=(s,r)=>Math.max(0,r-s);return{inputTokens:n(e.promptTokens,t.promptTokens),cachedTokens:n(e.cachedTokens,t.cachedTokens),outputTokens:n(e.candidateTokens,t.candidateTokens),apiTimeMs:n(e.apiTimeMs,t.apiTimeMs)}}function Upe(e,t){const n={};return e&&(e.inputTokens>0||e.outputTokens>0||e.cachedTokens>0||e.apiTimeMs>0)&&(n.inputTokens=e.inputTokens,n.cachedTokens=e.cachedTokens,n.outputTokens=e.outputTokens,e.apiTimeMs>0&&(n.apiTimeMs=e.apiTimeMs)),t!==void 0&&t>0&&(n.toolTimeMs=t),Object.keys(n).length>0?n:void 0}function Vpe(e){var a;const t=new Map,n=new Map,s=new Map,r=new Set,i=Fpe(e),o=l=>{let c=t.get(l);return c||(c={},t.set(l,c)),c};for(const l of e){const c=l.timestamp;for(const{todos:d,stats:h}of iw(l))for(const f of d){const m=_6(f),p=n.get(m);if(f.status==="in_progress"&&p!=="in_progress")r.has(m)&&(r.delete(m),s.delete(m),t.delete(m)),s.get(m)===void 0&&(s.set(m,h),c!==void 0&&(o(m).startTs=c));else if(f.status==="completed"&&p!=="completed"&&p!==void 0){const y=s.get(m),w=y&&h?Hpe(y,h):void 0,b=(a=t.get(m))==null?void 0:a.startTs,v=b!==void 0&&c!==void 0?qpe(i,b,c):void 0,x=Upe(w,v);if(c!==void 0||x){const _=o(m);c!==void 0&&(_.endTs=c),x&&(_.resources=x)}}f.status==="completed"&&r.add(m),n.set(m,f.status)}}return t}function iE(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function Wpe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function Gpe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function Db(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function p1(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const py=new Set;let zm=null,bP=Date.now();function Kpe(){bP=Date.now();for(const e of py)e()}function Ype(e){return py.add(e),zm||(zm=setInterval(Kpe,1e3)),()=>{py.delete(e),py.size===0&&zm&&(clearInterval(zm),zm=null)}}function k6(e){const[t,n]=g.useState(()=>Date.now());return g.useEffect(()=>{if(e)return n(Date.now()),Ype(()=>n(bP))},[e]),t}const Qpe="_list_1bo8s_1",Xpe="_summary_1bo8s_2",Jpe="_row_1bo8s_8",Zpe="_num_1bo8s_16",ege="_icon_1bo8s_23",tge="_text_1bo8s_29",nge="_inProgress_1bo8s_43",sge="_completed_1bo8s_48",rge="_item_1bo8s_62",ige="_rowButton_1bo8s_69",oge="_detailChevron_1bo8s_82",age="_detail_1bo8s_82",lge="_detailSection_1bo8s_100",cge="_detailSectionTitle_1bo8s_106",uge="_detailRows_1bo8s_114",dge="_detailLabel_1bo8s_122",hge="_detailValue_1bo8s_126",fge="_detailDuration_1bo8s_132",mge="_detailHint_1bo8s_136",Gn={list:Qpe,summary:Xpe,row:Jpe,num:Zpe,icon:ege,text:tge,inProgress:nge,completed:sge,item:rge,rowButton:ige,detailChevron:oge,detail:age,detailSection:lge,detailSectionTitle:cge,detailRows:uge,detailLabel:dge,detailValue:hge,detailDuration:fge,detailHint:mge};function G3(e){switch(e){case"completed":return Gn.completed;case"in_progress":return Gn.inProgress;case"pending":return""}}function vP({todos:e,events:t}){const{t:n}=Xe();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return u.jsx("div",{className:Gn.summary,children:u.jsxs("div",{className:`${Gn.row} ${Gn.completed}`,children:[u.jsx("span",{className:Gn.icon,"aria-hidden":"true",children:"✓"}),u.jsx("span",{className:Gn.text,children:n("todo.allDone")})]})});const r=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return r?u.jsx("div",{className:Gn.summary,children:u.jsxs("div",{className:`${Gn.row} ${G3(r.status)}`,children:[u.jsx("span",{className:Gn.icon,"aria-hidden":"true",children:Lb(r.status)}),u.jsx("span",{className:Gn.text,children:r.content})]})}):null}return u.jsx("div",{className:Gn.summary,children:t.map(s=>u.jsxs("div",{className:`${Gn.row} ${s.kind==="completed"?Gn.completed:Gn.inProgress}`,children:[u.jsx("span",{className:Gn.icon,"aria-hidden":"true",children:Lb(s.kind==="completed"?"completed":"in_progress")}),u.jsx("span",{className:Gn.text,children:s.content})]},`${s.kind}-${s.id}`))})}function rd({label:e,value:t,suffix:n}){return u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Gn.detailLabel,children:e}),u.jsxs("span",{className:Gn.detailValue,children:[t,n]})]})}function $x({title:e,children:t}){return u.jsxs("div",{className:Gn.detailSection,children:[u.jsx("div",{className:Gn.detailSectionTitle,children:e}),u.jsx("div",{className:Gn.detailRows,children:t})]})}function pge({detail:e}){const{t}=Xe(),{startTs:n,endTs:s,resources:r}=e,i=n!==void 0||s!==void 0,o=(r==null?void 0:r.inputTokens)!==void 0,a=(r==null?void 0:r.apiTimeMs)!==void 0||(r==null?void 0:r.toolTimeMs)!==void 0;return u.jsxs("div",{className:Gn.detail,children:[i&&u.jsxs($x,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&u.jsx(rd,{label:t("todo.detail.start"),value:Lf(n)}),s!==void 0&&u.jsx(rd,{label:t("todo.detail.end"),value:Lf(s),suffix:n!==void 0?u.jsxs("span",{className:Gn.detailDuration,children:[" ","(",xu(s-n),")"]}):void 0})]}),o&&u.jsxs($x,{title:t("todo.detail.sectionTokens"),children:[u.jsx(rd,{label:t("todo.detail.input"),value:((r==null?void 0:r.inputTokens)??0).toLocaleString()}),u.jsx(rd,{label:t("todo.detail.output"),value:((r==null?void 0:r.outputTokens)??0).toLocaleString()}),u.jsx(rd,{label:t("todo.detail.cached"),value:((r==null?void 0:r.cachedTokens)??0).toLocaleString()})]}),a&&u.jsxs($x,{title:t("todo.detail.sectionSpent"),children:[(r==null?void 0:r.apiTimeMs)!==void 0&&u.jsx(rd,{label:t("todo.detail.api"),value:xu(r.apiTimeMs)}),(r==null?void 0:r.toolTimeMs)!==void 0&&u.jsx(rd,{label:t("todo.detail.tool"),value:xu(r.toolTimeMs)})]}),!r&&u.jsx("div",{className:Gn.detailHint,children:t("todo.detail.noResources")})]})}function gge(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function wP({todos:e,numbered:t=!1}){const{t:n}=Xe(),s=g.useContext(XF),[r,i]=g.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=l=>i(c=>{const d=new Set(c);return d.has(l)?d.delete(l):d.add(l),d});return u.jsx("div",{className:Gn.list,children:e.map((l,c)=>{const d=l.id||String(c),h=s.get(_6(l)),f=gge(h),m=f&&r.has(d),p=u.jsxs(u.Fragment,{children:[t&&u.jsxs("span",{className:Gn.num,style:{minWidth:o},children:[c+1,"."]}),u.jsx("span",{className:Gn.icon,"aria-hidden":"true",children:Lb(l.status)}),u.jsx("span",{className:Gn.text,children:l.content}),f&&u.jsx("span",{className:Gn.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return u.jsxs("div",{className:Gn.item,children:[f?u.jsx("button",{type:"button",className:`${Gn.row} ${Gn.rowButton} ${G3(l.status)}`,onClick:y=>{y.stopPropagation(),a(d)},"aria-expanded":m,title:n(m?"todo.detail.hide":"todo.detail.show"),children:p}):u.jsx("div",{className:`${Gn.row} ${G3(l.status)}`,children:p}),m&&h&&u.jsx(pge,{detail:h})]},d)})})}function yge(e){const t=e.toolName.toLowerCase();if(Tl(e.toolName))return!!fl(e);if(t==="write_file"||t==="writefile")return!!Lge(e)||oE(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(ko(t)){const n=fl(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(sw(t))return!!_P(e);if(t==="edit"||t==="write"||t==="editfile")return oE(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=fl(e);return!!n&&n.split(`
`).length>3}return!1}function bge(e){const t=e.toolName.toLowerCase();return ko(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||sw(t)||Tl(e.toolName)}function vge(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!xP(e)}function oE(e){return vge(e)||!!fl(e)}function wge(e){const t=xP(e);if(t)return t;if(e.content){const n=e.content.find(s=>s.type==="diff");if(n&&n.type==="diff")return kge(n.oldText||"",n.newText||"")}return""}function xP(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(xge(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function xge(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const _ge=25e4;function kge(e,t){const n=e.split(`
`),s=t.split(`
`),r=n.length,i=s.length;if(r*i>_ge){const d=n.map(f=>f?`-${f}`:"-"),h=s.map(f=>f?`+${f}`:"+");return[...d,...h].join(`
`)}const o=Array.from({length:r+1},()=>Array(i+1).fill(0));for(let d=1;d<=r;d++)for(let h=1;h<=i;h++)o[d][h]=n[d-1]===s[h-1]?o[d-1][h-1]+1:Math.max(o[d-1][h],o[d][h-1]);const a=[];let l=r,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===s[c-1]?(a.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||o[l][c-1]>=o[l-1][c])?(a.push(`+${s[c-1]}`),c--):(a.push(`-${n[l-1]}`),l--);return a.reverse().join(`
`)}const Sge=60,Tge=2e5,Cge=1e3,Age={cjs:"javascript",cts:"typescript",h:"c",hpp:"cpp",js:"javascript",jsx:"jsx",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",ts:"typescript",tsx:"tsx",yml:"yaml"};function Ege({tool:e}){const t=g.useMemo(()=>fl(e)||"",[e]),n=g.useMemo(()=>Lpe(t)?Rpe(t):null,[t]);return u.jsx("div",{className:gt.expandedBash,children:u.jsx("pre",{className:gt.expandedOutput,children:n?n.map((s,r)=>u.jsx("span",{style:{color:s.color,fontWeight:s.bold?"bold":void 0,opacity:s.dim?.6:void 0},children:s.text},r)):t})})}function Mge({tool:e}){const t=g.useMemo(()=>fl(e)||"",[e]),n=jge(Nge(e)),s=n==="text"||t.length>Tge||Ige(t,Cge);return u.jsx("div",{className:gt.expandedRead,children:s?u.jsx("pre",{className:gt.expandedOutput,children:t}):u.jsx(hm,{content:Rge(n,t)})})}function Nge(e){var n,s;const t=((n=e.args)==null?void 0:n.file_path)??((s=e.args)==null?void 0:s.path);return typeof t=="string"?t:""}function Ige(e,t){let n=1;for(let s=0;s<e.length;s++)if(e.charCodeAt(s)===10&&++n>t)return!0;return!1}function jge(e){var s,r;const t=(r=(s=e.split(/[?#]/,1)[0])==null?void 0:s.split(".").pop())==null?void 0:r.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";const n=Age[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function Rge(e,t){var r;const n=((r=t.match(/~{3,}/g))==null?void 0:r.reduce((i,o)=>Math.max(i,o.length),0))??0,s="~".repeat(Math.max(3,n+1));return`${s}${e}
${t}
${s}`}function aE({tool:e}){const t=g.useMemo(()=>wge(e),[e]),n=g.useMemo(()=>fl(e)||"",[e]);return!t&&!n?null:u.jsx("div",{className:gt.expandedEdit,children:t?u.jsx(jpe,{diff:t}):u.jsx("pre",{className:gt.expandedOutput,children:n})})}function K3({title:e,detail:t,children:n}){return u.jsxs("div",{className:gt.expandedCard,children:[u.jsxs("div",{className:gt.expandedCardHeader,children:[u.jsx("span",{className:gt.expandedCardTitle,children:e}),t&&u.jsx("span",{className:gt.expandedCardDetail,children:t})]}),n&&u.jsx("div",{className:gt.expandedCardBody,children:n})]})}function Lge(e){var n,s;if((n=e.args)!=null&&n.content)return e.args.content;if((s=e.args)!=null&&s.new_string)return e.args.new_string;const t=fl(e);if(t)return t;if(e.rawOutput&&typeof e.rawOutput=="object"){const r=e.rawOutput;if(typeof r.content=="string")return r.content;if(typeof r.newContent=="string")return r.newContent}return""}function Dge({tool:e,todos:t,expanded:n,title:s}){var o;const i=((o=g.useContext(y8).get(e.callId))==null?void 0:o.events)??[];return n?u.jsx(K3,{title:s,children:u.jsx("div",{className:gt.todoBody,children:u.jsx(wP,{todos:t})})}):u.jsx("div",{className:gt.todoBody,children:u.jsx(vP,{todos:t,events:i})})}function Oge(e,t){var m,p;const n=ag(e.rawOutput),s=g6(e),r=yp(e),i=b6(e),o=Bge(e),a=v6(e),l=((m=e.subTools)==null?void 0:m.length)||((p=n==null?void 0:n.toolCalls)==null?void 0:p.length)||0,c=n==null?void 0:n.executionSummary,d=c&&typeof c.totalDurationMs=="number"?pP(c.totalDurationMs):lg(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),h=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:c&&typeof c.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,f=h>0?y6(h):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:d,tokens:f,status:r,reason:s}}function Bge(e){var r;const t=ag(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const s=(r=e.args)==null?void 0:r.subagent_type;return typeof s=="string"&&s.trim()?s.trim():""}function lE(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Tl(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||ko(t))}function Pge({tool:e}){const t=fl(e)||"";return u.jsx("pre",{className:gt.expandedOutput,children:t})}function $ge({tool:e}){var n;const t=_P(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return u.jsx("pre",{className:gt.expandedOutput,children:t})}function _P(e){var n,s;const t=(n=e.content)==null?void 0:n[0];return(t==null?void 0:t.type)!=="content"?"":typeof((s=t.content)==null?void 0:s.text)=="string"?t.content.text:""}function ow(e){const t=e.toolName.toLowerCase();return jv(e)?"agent":Tl(e.toolName)?"ask":ko(t)?"shell":C6(t)?"fetch":_c(t)?"todo":t==="read"||t==="read_file"||t==="readfile"?"read":t==="edit"||t==="editfile"?"edit":t==="write"||t==="write_file"||t==="writefile"?"write":"other"}function zge({description:e,elapsed:t}){return u.jsxs(u.Fragment,{children:[e&&u.jsx("span",{className:gt.lineArg,children:e}),t&&u.jsx("span",{className:gt.lineElapsed,children:t})]})}function Ob({info:e}){const{renderToolHeaderExtra:t}=vl(),n=t==null?void 0:t(e);return n?u.jsx(u.Fragment,{children:n}):u.jsx(zge,{description:e.description,elapsed:e.elapsed})}function Fge(e){return e.length>Sge||e.includes(`
`)}function S6(e){return e==="in_progress"||e==="pending"||e==="running"}function T6(e){return e.find(t=>S6(t.status))??e[e.length-1]}function qge(e,t,n){if(SP(e)){const r=T6(e);return t("toolGroup.running",{name:Sl(r.toolName,t),count:e.length,duration:n??""})}const s=Vge(e,t);return s||t("toolGroup.summary",{count:e.length})}function Hge(e,t,n){if(_c(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(Tl(e.toolName))return t("toolGroup.summary.askedUser",{count:1});const{displayName:s,description:r,hideDisplayName:i}=kP(e,t,n);return[i?"":s,r].filter(Boolean).join(" ")}function kP(e,t,n){const s=Sl(e.toolName,t),r=Dr(oP(e,n),120);return{kind:ow(e),tool:e,displayName:s,description:r,elapsed:"",workspaceCwd:n,hideDisplayName:!!Fde(e)}}function Uge({tool:e,runningDuration:t,workspaceCwd:n}){const{t:s}=Xe(),r=S6(e.status)&&s("toolGroup.runningPrefix").trim();if(_c(e.toolName)||Tl(e.toolName))return u.jsxs(u.Fragment,{children:[r&&u.jsxs("span",{children:[r," "]}),Hge(e,s,n),t&&u.jsxs("span",{children:[" ",t]})]});const i=kP(e,s,n);return u.jsxs(u.Fragment,{children:[r&&u.jsxs("span",{children:[r," "]}),u.jsxs("span",{className:gt.chatSummaryInline,children:[!i.hideDisplayName&&u.jsx("span",{className:gt.lineName,children:i.displayName}),u.jsx(Ob,{info:i})]}),t&&u.jsxs("span",{children:[" ",t]})]})}function Vge(e,t){let n=0,s=0,r=0,i=0,o=0,a=0,l=0;for(const d of e){const h=d.toolName.toLowerCase();ko(h)?s++:h==="edit"||h==="editfile"||h==="write"||h==="write_file"||h==="writefile"?n++:h==="read"||h==="read_file"||h==="readfile"?r++:h==="grep"||h==="grep_search"||h==="search"||h==="glob"||h==="web_search"||h==="websearch"?i++:_c(h)?o++:Tl(h)?a++:l++}return[n?t("toolGroup.summary.editedFiles",{count:n}):"",s?t("toolGroup.summary.ranCommands",{count:s}):"",r?t("toolGroup.summary.readFiles",{count:r}):"",i?t("toolGroup.summary.searched",{count:i}):"",o?t("toolGroup.summary.updatedTodos",{count:o}):"",a?t("toolGroup.summary.askedUser"):"",l?t("toolGroup.summary.otherTools",{count:l}):""].filter(Boolean).join(" ")}function SP(e){return e.some(t=>S6(t.status))}function Wge(){return u.jsxs("svg",{className:gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("path",{d:"M12 20h9"}),u.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function TP(){return u.jsxs("svg",{className:gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function Gge(){return u.jsxs("svg",{className:gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M1.8 7h10.4M7 1.5c1.3 1.5 2 3.3 2 5.5s-.7 4-2 5.5M7 1.5C5.7 3 5 4.8 5 7s.7 4 2 5.5",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function Kge(){return u.jsxs("svg",{className:gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function Yge(){return u.jsx("svg",{className:gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.2 4.2 5.4 6.1 3.3M7.5 4.5h3.6M3 9.1l1.2 1.2 1.9-2.1M7.5 9.4h3.6",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qge(){return u.jsx("svg",{className:gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Xge(){return u.jsx("svg",{className:gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:u.jsx("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function Jge({tool:e}){const t=ow(e);return t==="agent"?u.jsx(Xge,{}):t==="ask"?u.jsx(Qge,{}):t==="edit"||t==="write"?u.jsx(Wge,{}):t==="fetch"?u.jsx(Gge,{}):t==="read"?u.jsx(Kge,{}):t==="todo"?u.jsx(Yge,{}):u.jsx(TP,{})}function C6(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const Zge=yp;function e1e({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:s}=Xe(),r=T6(e),i=Sl(r.toolName,s),o=Zge(r),a=p6(r,t),l=ko(r.toolName)||C6(r.toolName)?"":lg(r.startTime,r.endTime);return u.jsxs("div",{className:`${gt.compactGroup}${n?` ${Iu.flash}`:""}`,children:[u.jsxs("div",{className:gt.compactHeader,children:[u.jsx(Ud,{status:o}),u.jsx("span",{className:gt.lineName,children:i}),e.length>1&&u.jsxs("span",{className:gt.compactCount,children:["× ",e.length]}),u.jsx(Ob,{info:{kind:ow(r),tool:r,displayName:i,description:a,elapsed:l,workspaceCwd:t}})]}),u.jsx("div",{className:gt.compactHint,children:s("compact.hint")})]})}function t1e(e,t){var r,i;if(((r=e.approval)==null?void 0:r.id)!==((i=t.approval)==null?void 0:i.id)||e.workspaceCwd!==t.workspaceCwd||e.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.forceExpandable!==t.forceExpandable||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;const n=e.tool,s=t.tool;return n.callId===s.callId&&n.toolName===s.toolName&&n.status===s.status&&n.startTime===s.startTime&&n.endTime===s.endTime&&n.subContent===s.subContent&&n.rawOutput===s.rawOutput&&n.args===s.args&&n.content===s.content&&n.title===s.title&&n1e(n.subTools,s.subTools)}function n1e(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],r=t[n];if(s.callId!==r.callId||s.toolName!==r.toolName||s.status!==r.status||s.endTime!==r.endTime||s.rawOutput!==r.rawOutput||s.args!==r.args||s.subContent!==r.subContent||s.title!==r.title)return!1}return!0}const Y3=g.memo(function({tool:t,approval:n,workspaceCwd:s,summaryOnly:r=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:a=!1,hideCollapsedOutput:l=!1}){const{t:c}=Xe(),d=g.useContext(Zd),[h,f]=g.useState(()=>i||!d&&lE(t)),m=g.useRef(!1);g.useEffect(()=>{f(i||(d?!1:lE(t))),m.current=!1},[d,i,t.callId,t.toolName]);const p=jv(t),y=n&&n.toolCallId===t.callId,w=!y&&(n==null?void 0:n.toolCallId)&&p&&Aa(t,n.toolCallId),b=p&&t.status==="in_progress",v=k6(b);if(g.useEffect(()=>{!i&&!p&&t.status==="completed"&&!m.current&&f(!1)},[i,p,t.status]),p){const X=Oge(t,v),ae=X.explicitAgentType?`${c("agent.label")} (${X.explicitAgentType})`:c("agent.label"),be=t.status==="completed"||t.status==="failed",ie=[t.status==="pending"?c("subagent.pending"):c("subagent.running"),X.elapsed].filter(Boolean).join(" · "),G=[X.subToolCount>0?c("subagent.toolsCount",{count:X.subToolCount}):"",X.elapsed,X.tokens,X.reason?Dr(X.reason,80):""].filter(Boolean).join(" · "),q=i||h||!!y||!!w,le=u.jsx(w6,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return u.jsxs("div",{className:gt.line,children:[!a&&u.jsxs("div",{className:`${gt.lineMain} ${gt.lineExpandable}`,onClick:()=>f(!h),children:[u.jsx(Ud,{status:be?X.status:t.status}),u.jsx("span",{className:gt.lineName,children:ae}),u.jsx(Ob,{info:{kind:"agent",tool:t,displayName:ae,description:X.description?Dr(X.description,60):"",elapsed:be?G:ie,workspaceCwd:s}}),u.jsx("span",{className:h?gt.lineChevronDown:gt.lineChevronRight,"aria-hidden":"true"})]}),q&&u.jsx("div",{className:gt.lineDetail,children:a?u.jsx("div",{className:gt.expandedAgentCard,children:le}):le})]})}const x=p6(t,s),_=qde(t),k=r&&ko(t.toolName)?oP(t,s):x,M=Sl(t.toolName,c),R=ko(t.toolName)||C6(t.toolName)?"":lg(t.startTime,t.endTime),L=t.toolName.toLowerCase(),T=_c(L),N=T?x6(t):void 0,I=!!N&&N.length>0,O=N?N.filter(X=>X.status==="completed").length:0,U=ko(L),F=L==="grep"||L==="grep_search"||L==="search"||L==="glob",j=L==="read"||L==="read_file"||L==="readfile",V=!T&&Fge(k),ee=!i&&(o||(T?I:yge(t)||V)),ce=bge(t),$=h&&V,J=j,B=$&&!U&&!F&&!j,C=x,z=!T&&h&&!ce&&($||_);return u.jsxs("div",{className:gt.line,children:[!a&&u.jsxs("div",{className:`${gt.lineMain} ${ee?gt.lineExpandable:""}`,title:ee?c(h?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":ee?h:void 0,role:ee?"button":void 0,tabIndex:ee?0:void 0,onClick:ee?()=>{m.current=!0,f(X=>!X)}:void 0,onKeyDown:ee?X=>{X.key!=="Enter"&&X.key!==" "||(X.preventDefault(),m.current=!0,f(ae=>!ae))}:void 0,children:[u.jsx(Ud,{status:t.status}),u.jsx("span",{className:gt.lineName,children:M}),T&&I&&u.jsxs("span",{className:gt.todoProgress,children:[O,"/",N.length]}),u.jsx(Ob,{info:{kind:ow(t),tool:t,displayName:M,description:T||B?"":k,elapsed:T?"":R,workspaceCwd:s}}),ee&&u.jsx("span",{className:h?gt.lineChevronDown:gt.lineChevronRight,"aria-hidden":"true"})]}),(!r||h)&&T&&I&&u.jsx(Dge,{tool:t,todos:N,expanded:h,title:M}),(!r||h)&&T&&!I&&_&&u.jsx("div",{className:gt.lineOutput,children:_}),z&&u.jsx(K3,{title:M,detail:C,children:_&&u.jsx("div",{className:`${gt.lineOutput} ${gt.expandedLineOutput}`,children:_})}),!T&&!l&&_&&!z&&(!h||!ce)&&(!r||h)&&u.jsx("div",{className:h?`${gt.lineOutput} ${gt.expandedLineOutput}`:gt.lineOutput,children:_}),!T&&h&&ce&&u.jsx("div",{className:J?`${gt.lineDetail} ${gt.markdownLineDetail}`:gt.lineDetail,children:j?u.jsx(Mge,{tool:t}):u.jsxs(K3,{title:M,detail:C,children:[ko(L)&&u.jsx(Ege,{tool:t}),(L==="write_file"||L==="writefile")&&u.jsx(aE,{tool:t}),(L==="edit"||L==="write"||L==="editfile")&&u.jsx(aE,{tool:t}),Tl(t.toolName)&&u.jsx(Pge,{tool:t}),sw(L)&&u.jsx($ge,{tool:t})]})})]})},t1e),s1e=g.memo(function({tools:t,pendingApproval:n,workspaceCwd:s,isLocateFlashing:r=!1}){const{t:i}=Xe(),o=g.useContext(Zd),[a,l]=g.useState(!1),c=SP(t),d=t.length>0?T6(t):void 0,h=t.length===1?t[0]:void 0,f=t[0]??d,m=g.useRef(Date.now()),p=k6(c),y=(n==null?void 0:n.toolCallId)&&t.some(v=>Aa(v,n.toolCallId)),w=o&&!y,b=c?gP(p-m.current):void 0;return g.useEffect(()=>{c&&(m.current=Date.now())},[c,d==null?void 0:d.callId]),w?u.jsx(e1e,{tools:t,workspaceCwd:s,isLocateFlashing:r}):y?u.jsx("div",{className:`${gt.group}${r?` ${Iu.flash}`:""}`,children:t.map(v=>u.jsx(Y3,{tool:v,approval:n,workspaceCwd:s},v.callId))}):u.jsxs("div",{className:r?Iu.flash:void 0,children:[u.jsxs("button",{type:"button",className:gt.chatSummary,onClick:()=>l(v=>!v),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[u.jsx("span",{className:gt.chatSummaryIcon,"aria-hidden":"true",children:f?u.jsx(Jge,{tool:f}):u.jsx(TP,{})}),u.jsx("span",{className:c?`${gt.chatSummaryText} ${gt.chatSummaryTextActive}`:gt.chatSummaryText,children:h?u.jsx(Uge,{tool:h,runningDuration:c?b:void 0,workspaceCwd:s}):qge(t,i,b)}),u.jsx("span",{className:a?gt.chatChevronDown:gt.chatChevronRight,"aria-hidden":"true"})]}),u.jsx("div",{className:a?gt.chatSummaryContentClip:`${gt.chatSummaryContentClip} ${gt.chatSummaryContentCollapsed}`,children:u.jsx("div",{className:gt.chatSummaryContentInner,children:u.jsx("div",{className:`${gt.group} ${gt.chatSummaryGroup}`,children:t.map(v=>u.jsx(Y3,{tool:v,approval:n,workspaceCwd:s,summaryOnly:!h,forceExpanded:!!h,hideHeader:!!h},v.callId))})})})]})}),r1e="_message_kwepu_1",i1e="_header_kwepu_6",o1e="_chevron_kwepu_20",a1e="_title_kwepu_26",l1e="_progress_kwepu_35",Fm={message:r1e,header:i1e,chevron:o1e,title:a1e,progress:l1e};function c1e({id:e,todos:t}){var r;const s=((r=g.useContext(y8).get(e))==null?void 0:r.events)??[];return u.jsx(vP,{todos:t,events:s})}const u1e=g.memo(function({id:t,todos:n,isLocateFlashing:s=!1}){const{t:r}=Xe(),[i,o]=g.useState(!1);if(n.length===0)return null;const a=n.length,l=n.filter(c=>c.status==="completed").length;return u.jsxs("div",{className:`${Fm.message}${s?` ${Iu.flash}`:""}`,children:[u.jsxs("button",{type:"button",className:Fm.header,onClick:()=>o(c=>!c),"aria-expanded":i,title:r(i?"todo.collapse":"todo.expand"),children:[u.jsx("span",{className:Fm.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),u.jsx("span",{className:Fm.title,children:r("plan.title")}),u.jsxs("span",{className:Fm.progress,children:[l,"/",a]})]}),i?u.jsx(wP,{todos:n,numbered:!0}):u.jsx(c1e,{id:t,todos:n})]})}),d1e="_message_1abcu_1",h1e="_content_1abcu_11",f1e="_question_1abcu_17",m1e="_prefix_1abcu_24",p1e="_answer_1abcu_28",g1e="_pending_1abcu_32",y1e="_shortcuts_1abcu_36",id={message:d1e,content:h1e,question:f1e,prefix:m1e,answer:p1e,pending:g1e,shortcuts:y1e},CP=g.memo(function({question:t,answer:n,isPending:s}){const{t:r}=Xe();return u.jsxs("div",{className:id.message,children:[u.jsxs("div",{className:id.content,children:[u.jsxs("div",{className:id.question,children:[u.jsx("span",{className:id.prefix,children:"/btw "}),u.jsx("span",{children:t})]}),u.jsx("div",{className:id.answer,children:s?u.jsx("span",{className:id.pending,children:r("btw.answering")}):u.jsx(hm,{content:n})})]}),u.jsx("div",{className:id.shortcuts,children:r(s?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),b1e="_message_1q4dw_1",v1e="_compact_1q4dw_16",w1e="_header_1q4dw_21",x1e="_status_1q4dw_30",_1e="_name_1q4dw_35",k1e="_command_1q4dw_42",S1e="_output_1q4dw_51",T1e="_compactHint_1q4dw_62",Fl={message:b1e,compact:v1e,header:w1e,status:x1e,name:_1e,command:k1e,output:S1e,compactHint:T1e},C1e=g.memo(function({command:t,output:n}){const s=g.useContext(Zd),{t:r}=Xe();return u.jsxs("div",{className:s?`${Fl.message} ${Fl.compact}`:Fl.message,children:[u.jsxs("div",{className:Fl.header,children:[u.jsx("span",{className:Fl.status,children:"✓"}),u.jsx("span",{className:Fl.name,children:r("shell.command")}),t&&u.jsx("span",{className:Fl.command,children:t})]}),s?u.jsx("div",{className:Fl.compactHint,children:r("compact.hint")}):n&&u.jsx("pre",{className:Fl.output,children:n})]})}),A1e="_progress_1j3ys_1",E1e="_spinner_1j3ys_12",M1e="_bar_1j3ys_19",N1e="_stage_1j3ys_25",I1e="_icon_1j3ys_29",j1e="_done_1j3ys_35",R1e="_error_1j3ys_43",L1e="_detail_1j3ys_51",D1e="_path_1j3ys_56",Ur={progress:A1e,spinner:E1e,bar:M1e,stage:N1e,icon:I1e,done:j1e,error:R1e,detail:L1e,path:D1e},cE=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function O1e({progress:e}){const{stage:t,progress:n,detail:s,isComplete:r,error:i}=e,[o,a]=g.useState(0),l=30,c=Math.round(n/100*l),d=l-c,h="█".repeat(Math.max(0,c))+"░".repeat(Math.max(0,d));return g.useEffect(()=>{if(r||i)return;const f=setInterval(()=>{a(m=>(m+1)%cE.length)},120);return()=>clearInterval(f)},[r,i]),i?u.jsxs("div",{className:`${Ur.progress} ${Ur.error}`,children:[u.jsx("span",{className:Ur.icon,children:"✕"}),u.jsx("span",{className:Ur.stage,children:t}),u.jsx("div",{className:Ur.detail,children:i})]}):r?u.jsxs("div",{className:`${Ur.progress} ${Ur.done}`,children:[u.jsx("span",{className:Ur.icon,children:"✓"}),u.jsx("span",{className:Ur.stage,children:t})]}):u.jsxs("div",{className:Ur.progress,children:[u.jsx("span",{className:Ur.spinner,children:cE[o]}),u.jsx("span",{className:Ur.bar,children:h}),u.jsxs("span",{className:Ur.stage,children:[t,s?` (${s})`:""]})]})}function B1e({path:e}){const{t}=Xe();return u.jsxs("div",{className:`${Ur.progress} ${Ur.done}`,children:[u.jsx("span",{className:Ur.icon,children:"✓"}),u.jsx("span",{className:Ur.stage,children:t("insight.ready")}),u.jsx("span",{className:Ur.path,children:e})]})}const P1e=g.memo(function({message:t,pendingApproval:n,onShowContextDetail:s,workspaceCwd:r,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:l,showAssistantActions:c=!1,showAssistantBranch:d=!1,isLocateFlashing:h=!1}){const{t:f}=Xe(),m=(()=>{switch(t.role){case"user":return u.jsx(Due,{content:t.content,images:t.images,isLocateFlashing:h});case"assistant":return u.jsx(ede,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:c,showBranchAction:d,isLocateFlashing:h});case"thinking":return u.jsx(rde,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:h});case"tool_group":return u.jsx(s1e,{tools:t.tools,pendingApproval:n,workspaceCwd:r,isLocateFlashing:h});case"plan":return u.jsx(u1e,{id:t.id,todos:t.todos,isLocateFlashing:h});case"system":return u.jsx(i0e,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:s,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:a});case"user_shell":return u.jsx(C1e,{command:t.command,output:t.output});case"btw":return u.jsx(CP,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return u.jsx(O1e,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return u.jsx(B1e,{path:t.path});case"insight_error":return u.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(m===null)return null;const p=u.jsx(mc,{label:`message:${t.role}`,resetKeys:[t],fallback:u.jsx($1e,{align:t.role==="user"?"end":"start"}),children:m}),y=u.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:p});return t.role==="assistant"?c?y:u.jsx(Q_,{timestamp:t.timestamp,children:y}):t.role==="system"&&t.source==="prompt_cancelled"?y:u.jsx(Q_,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:f("common.copy"),children:y})},z1e);function $1e({align:e}){const{t}=Xe();return u.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:u.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function z1e(e,t){var n,s;return((n=e.pendingApproval)==null?void 0:n.id)!==((s=t.pendingApproval)==null?void 0:s.id)||e.onShowContextDetail!==t.onShowContextDetail||e.workspaceCwd!==t.workspaceCwd||e.isLatest!==t.isLatest||e.showRetryHint!==t.showRetryHint||e.onRetryClick!==t.onRetryClick||e.onBranchSession!==t.onBranchSession||e.showAssistantActions!==t.showAssistantActions||e.showAssistantBranch!==t.showAssistantBranch||e.isLocateFlashing!==t.isLocateFlashing?!1:F1e(e.message,t.message)}function F1e(e,t){if(e===t)return!0;if(e.id!==t.id||e.role!==t.role||e.timestamp!==t.timestamp)return!1;switch(e.role){case"user":return t.role==="user"&&e.content===t.content&&U1e(e.images,t.images);case"assistant":return t.role==="assistant"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"thinking":return t.role==="thinking"&&e.content===t.content&&e.isStreaming===t.isStreaming;case"system":return t.role==="system"&&e.content===t.content&&e.variant===t.variant&&e.retryable===t.retryable&&e.source===t.source&&e.data===t.data;case"user_shell":return t.role==="user_shell"&&e.command===t.command&&e.output===t.output&&e.cwd===t.cwd;case"btw":return t.role==="btw"&&e.question===t.question&&e.answer===t.answer&&e.isPending===t.isPending;case"insight_progress":return t.role==="insight_progress"&&e.stage===t.stage&&e.progress===t.progress&&e.detail===t.detail;case"insight_ready":return t.role==="insight_ready"&&e.path===t.path;case"insight_error":return t.role==="insight_error"&&e.error===t.error;case"plan":return t.role==="plan"&&q1e(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,s)=>AP(n,t.tools[s]));default:return!1}}function q1e(e,t){return e.length===t.length&&e.every((n,s)=>{const r=t[s];return r&&n.id===r.id&&n.content===r.content&&n.status===r.status&&n.priority===r.priority})}function AP(e,t){return t?e.callId===t.callId&&e.toolName===t.toolName&&e.status===t.status&&e.title===t.title&&e.kind===t.kind&&e.startTime===t.startTime&&e.endTime===t.endTime&&e.subContent===t.subContent&&Rc(e.args)===Rc(t.args)&&Rc(e.rawOutput)===Rc(t.rawOutput)&&Rc(e.locations)===Rc(t.locations)&&Rc(e.content)===Rc(t.content)&&H1e(e.subTools,t.subTools):!1}function H1e(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>AP(n,t[s]))}const uE=new WeakMap;function U1e(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n.data===t[s].data&&n.mimeType===t[s].mimeType)}function Rc(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=uE.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return uE.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}const V1e="_wrap_1yq18_1",W1e="_summary_1yq18_5",G1e="_summaryTextActive_1yq18_27",K1e="_summaryIcon_1yq18_33",Y1e="_summaryStatus_1yq18_47",Q1e="_summaryToolIcon_1yq18_54",X1e="_summaryText_1yq18_27",J1e="_summaryDot_1yq18_96",Z1e="_chevronRight_1yq18_100",eye="_chevronDown_1yq18_101",tye="_group_1yq18_161",nye="_list_1yq18_190",sye="_row_1yq18_196",rye="_rowStats_1yq18_210",iye="_rowDesc_1yq18_218",oye="_rowTool_1yq18_228",aye="_detail_1yq18_232",Hr={wrap:V1e,summary:W1e,summaryTextActive:G1e,summaryIcon:K1e,summaryStatus:Y1e,summaryToolIcon:Q1e,summaryText:X1e,summaryDot:J1e,chevronRight:Z1e,chevronDown:eye,group:tye,list:nye,row:sye,rowStats:rye,rowDesc:iye,rowTool:oye,detail:aye};function lye(e){const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t%60;return s>0?`${n}m ${s}s`:`${n}m`}function cye(e,t){const n=[],s=ag(e.rawOutput),r=s==null?void 0:s.executionSummary,i=r&&typeof r.totalDurationMs=="number"?lye(r.totalDurationMs):lg(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=s&&typeof s.tokenCount=="number"&&s.tokenCount>0?s.tokenCount:r&&typeof r.outputTokens=="number"&&r.outputTokens>0?r.outputTokens:0;o>0&&n.push(y6(o));const a=g6(e);return a&&n.push(Dr(a,80)),n.join(" · ")}function uye(){return u.jsx("svg",{className:Hr.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:u.jsx("path",{d:"M770.08 96.32c1.728.64 3.072 1.984 3.712 3.712l38.848 107.584c.64 1.728 1.984 3.104 3.712 3.712l107.584 38.848a6.144 6.144 0 0 1 0 11.584l-107.584 38.848a6.144 6.144 0 0 0-3.712 3.712l-38.848 107.584a6.144 6.144 0 0 1-11.584 0L723.36 304.32a6.144 6.144 0 0 0-3.712-3.712L612.064 261.76a6.144 6.144 0 0 1 0-11.584l107.584-38.848a6.144 6.144 0 0 0 3.712-3.712l38.848-107.584c1.184-3.2 4.704-4.8 7.872-3.68zM576 160H384q-119.296 0-203.648 84.352Q96 328.704 96 448v192q0 119.296 84.352 203.648Q264.704 928 384 928h256q119.296 0 203.648-84.352Q928 759.296 928 640V512h-64v128q0 92.8-65.6 158.4Q732.8 864 640 864H384q-92.8 0-158.4-65.6Q160 732.8 160 640V448q0-92.8 65.6-158.4Q291.2 224 384 224h192v-64zm96 248.224L568.224 512 672 615.776l45.248-45.28L658.752 512l58.496-58.496L672 408.224zM320 608V448h64v160h-64z",stroke:"currentColor",strokeWidth:"28",strokeLinejoin:"round"})})}function dye({agents:e,pendingApproval:t}){const{t:n}=Xe(),[s,r]=g.useState(!1),[i,o]=g.useState(null),[a,l]=g.useState(()=>Date.now()),c=g.useRef(Date.now()),d=e.some(b=>b.status==="in_progress");g.useEffect(()=>{d&&(c.current=Date.now(),l(Date.now()))},[d]),g.useEffect(()=>{if(!d)return;const b=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(b)},[d]);const h=d?gP(a-c.current):"",f=e.filter(b=>b.status==="completed"||b.status==="failed").length,m=e.length,p=t!=null&&t.toolCallId?e.find(b=>Aa(b,t.toolCallId)):void 0,y=s||!!p,w=e.some(b=>yp(b)==="failed")?"failed":d?"in_progress":"completed";return u.jsxs("div",{className:Hr.wrap,children:[u.jsxs("button",{type:"button",className:Hr.summary,onClick:()=>r(b=>!b),"aria-expanded":y,title:n(y?"tool.collapseHint":"tool.expand"),children:[w==="failed"?u.jsx("span",{className:Hr.summaryStatus,children:u.jsx(Ud,{status:w})}):u.jsx("span",{className:Hr.summaryIcon,"aria-hidden":"true",children:u.jsx(uye,{})}),u.jsxs("span",{className:d?`${Hr.summaryText} ${Hr.summaryTextActive}`:Hr.summaryText,children:[n("parallelAgents.title"),h&&u.jsxs(u.Fragment,{children:[" ",h]}),u.jsx("span",{className:Hr.summaryDot,children:"·"}),n("parallelAgents.done",{done:f,total:m})]}),u.jsx("span",{className:y?Hr.chevronDown:Hr.chevronRight,"aria-hidden":"true"})]}),y&&u.jsx("div",{className:Hr.group,children:u.jsx("div",{className:Hr.list,children:e.map(b=>{const v=b6(b),x=v6(b),_=Wde(b,n),E=cye(b,a),k=yp(b),M=i===b.callId;return u.jsxs("div",{children:[u.jsxs("div",{className:Hr.row,onClick:()=>o(M?null:b.callId),children:[u.jsx(Ud,{status:k}),u.jsxs("span",{className:Hr.rowDesc,children:[Dr(x||v,50),_&&u.jsx("span",{className:Hr.rowTool,children:` (${_})`})]}),E&&u.jsx("span",{className:Hr.rowStats,children:E})]}),M&&u.jsx("div",{className:Hr.detail,children:u.jsx(w6,{tool:b,hideHeader:!0})})]},b.callId)})})})]})}const hye="_collapseRow_d7f01_1",fye="_collapseRowClickable_d7f01_14",mye="_collapseLabel_d7f01_19",pye="_processedLabel_d7f01_36",gye="_processedMeta_d7f01_43",yye="_hiddenMetrics_d7f01_47",bye="_summaryMetrics_d7f01_51",vye="_collapseIcon_d7f01_59",wye="_chevronRight_d7f01_72",xye="_chevronDown_d7f01_73",wa={collapseRow:hye,collapseRowClickable:fye,collapseLabel:mye,processedLabel:pye,processedMeta:gye,hiddenMetrics:yye,summaryMetrics:bye,collapseIcon:vye,chevronRight:wye,chevronDown:xye},_ye="_list_14olq_1",kye="_virtualSizer_14olq_33",Sye="_virtualRow_14olq_42",Tye="_loadingSkeleton_14olq_52",Cye="_srOnly_14olq_60",Aye="_loadingSkeletonUserRow_14olq_72",Eye="_loadingSkeletonAssistantRow_14olq_78",Mye="_loadingSkeletonUserBubble_14olq_84",Nye="_loadingSkeletonUserBubbleCompact_14olq_85",Iye="_loadingSkeletonAssistantBlock_14olq_99",jye="_loadingSkeletonLineWide_14olq_107",Rye="_loadingSkeletonLineMedium_14olq_108",Lye="_loadingSkeletonLineShort_14olq_109",Dye="_loadingSkeletonLineNarrow_14olq_110",Oye="_turnStatusRow_14olq_150",Bye="_turnAnswerRow_14olq_151",Pye="_turnContentRow_14olq_162",$ye="_turnContentClip_14olq_166",zye="_turnContentCollapsed_14olq_174",Fye="_turnContentInner_14olq_178",qye="_sessionTimelineLayer_14olq_183",Hye="_sessionTimelinePanel_14olq_196",Uye="_sessionTimelineList_14olq_207",Vye="_sessionTimelineItem_14olq_217",Wye="_sessionTimelineButton_14olq_222",Gye="_sessionTimelineTick_14olq_241",Kye="_sessionTimelineButtonInRange_14olq_328",Yye="_sessionTimelineButtonCurrent_14olq_332",Qye="_sessionTimelineDetails_14olq_343",Xye="_sessionTimelineDetailsTitle_14olq_373",Jye="_sessionTimelineDetailsIcon_14olq_380",Zye="_sessionTimelineDetailsTitleText_14olq_392",ebe="_sessionTimelineDetailsDetail_14olq_402",Mn={list:_ye,virtualSizer:kye,virtualRow:Sye,loadingSkeleton:Tye,srOnly:Cye,loadingSkeletonUserRow:Aye,loadingSkeletonAssistantRow:Eye,loadingSkeletonUserBubble:Mye,loadingSkeletonUserBubbleCompact:Nye,loadingSkeletonAssistantBlock:Iye,loadingSkeletonLineWide:jye,loadingSkeletonLineMedium:Rye,loadingSkeletonLineShort:Lye,loadingSkeletonLineNarrow:Dye,turnStatusRow:Oye,turnAnswerRow:Bye,turnContentRow:Pye,turnContentClip:$ye,turnContentCollapsed:zye,turnContentInner:Fye,sessionTimelineLayer:qye,sessionTimelinePanel:Hye,sessionTimelineList:Uye,sessionTimelineItem:Vye,sessionTimelineButton:Wye,sessionTimelineTick:Gye,sessionTimelineButtonInRange:Kye,sessionTimelineButtonCurrent:Yye,sessionTimelineDetails:Qye,sessionTimelineDetailsTitle:Xye,sessionTimelineDetailsIcon:Jye,sessionTimelineDetailsTitleText:Zye,sessionTimelineDetailsDetail:ebe};function tbe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if((n==null?void 0:n.role)==="user")return n.id}return null}function nbe(e){return e[e.length-1]}function sbe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&fm(n))return n.id}return null}function dE(e){return e.role==="tool_group"&&e.tools.length===1&&jv(e.tools[0])}function zx(e){return e.role==="tool_group"&&e.tools.length===1&&zL(e.tools[0])}function hE(e){return e.role==="thinking"}function fE(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Aa(n,t.toolCallId)))}function mE(e){return e.role==="thinking"}function rbe(e,t){const n=[];let s=0;for(;s<e.length;){const r=e[s];if(r.role!=="tool_group"||fE(r,t)){mE(r)||n.push(r),s++;continue}const i=[r];let o=s,a=s+1;for(;a<e.length;){const c=e[a];if(mE(c)){a++;continue}if(c.role==="tool_group"&&!fE(c,t)){i.push(c),o=a,a++;continue}break}if(i.length===1){n.push(r),s++;continue}const l=i.flatMap(c=>c.role==="tool_group"?c.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:l}),s=o+1}return n}function EP(e){const t=[];let n=0;for(;n<e.length;){if(zx(e[n])){const s=[];let r=n;for(;r<e.length;){const i=e[r];if(zx(i)){s.push(i),r++;continue}if(hE(i)){let o=r+1;for(;o<e.length&&hE(e[o]);)o++;if(o<e.length&&zx(e[o])){r=o;continue}}break}if(s.length>=2){t.push({type:"parallel_agents",key:`par-${s[0].id}`,agents:s.map(i=>i.tools[0]),timestamp:s[0].timestamp}),n=r;continue}}if(dE(e[n])){const s=n;for(;n<e.length&&dE(e[n]);)n++;if(n-s>=2){const r=e.slice(s,n);t.push({type:"parallel_agents",key:`par-${r[0].id}`,agents:r.map(i=>i.tools[0]),timestamp:r[0].timestamp})}else t.push({type:"message",key:e[s].id,message:e[s]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n++}return t}function pE(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_collapse"){const t=e.turnCollapse.liveStartedAt;return t===void 0?`tc:${e.key}`:`tc:${e.key}:${t}`}return e.type==="turn_content"?`turn-content:${e.key}`:`msg:${e.key}`}function ibe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function A6(e,t,n){let s=t;for(let r=n;r>t;r--)if(MP(e[r])){s=r;break}for(let r=n;r>s;r--)if(ibe(e[r]))return r;return-1}function obe(e,t){const n=[];for(let r=0;r<e.length;r++){const i=e[r];i.type==="message"&&fm(i.message)&&n.push(r)}const s=new Set;for(let r=0;r<n.length;r++){if(r===n.length-1&&t)continue;const i=n[r],o=(r+1<n.length?n[r+1]:e.length)-1,a=A6(e,i,o);if(a<0)continue;const l=e[a];l.type==="message"&&l.message.role==="assistant"&&s.add(l.message.id)}return s}function Q3(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_collapse")return!1;if(e.type==="turn_content")return e.items.some(n=>Q3(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return E6(e.message);case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return!1;default:return e.message,!1}}function E6(e){var t;return e.source==="mid_turn_message_injected"||((t=e.content)==null?void 0:t.startsWith("mid_turn_message_injected (unrecognized daemon event):"))===!0}function abe(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type!=="message")return{kind:"none"};const{message:n}=e;switch(n.role){case"thinking":return{kind:"thought",timestamp:n.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:n.timestamp}:Vd(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{const s=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:s}):`${s} tool call${s===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return E6(n)?{kind:"status",timestamp:n.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:n.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:n.timestamp};default:return{kind:"none"}}}function Vd(e,t,n={}){const r=(n.stripMarkdown===!0?lbe(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!r)return"";const i=Array.from(r);return i.length>t?`${i.slice(0,t-1).join("")}…`:r}function lbe(e){if(!e)return"";const t=[],n=r=>{const i=`\0${t.length}\0`;return t.push(r),i};let s=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(r,i)=>n(i)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(r,i)=>n(i)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");s=Fx(s,"~~"),s=Fx(s,"**"),s=Fx(s,"__"),s=s.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(const[r,i]of t.entries())s=s.split(`\0${r}\0`).join(i);return s}function Fx(e,t){let n="",s=0;for(;s<e.length;){const r=e.indexOf(t,s);if(r===-1)return n+e.slice(s);const i=r+t.length,o=e.indexOf(t,i);if(o===-1)return n+e.slice(s);const a=e.slice(i,o);n+=a.trim().length===0?e.slice(s,o+t.length):e.slice(s,r)+a,s=o+t.length}return n}function cbe(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",s=Vd(n,32);return s||(t?t("timeline.userTurn"):"User turn")}function ube(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function fm(e){return e.role==="user"||e.role==="user_shell"}function dbe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return Vd(e.content,120,{stripMarkdown:!0});case"tool_group":{const n=e.tools.length;return t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return E6(e)?Vd(e.content,120,{stripMarkdown:!0}):"";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return"";default:return""}}function hbe(e,t){if(e.type==="parallel_agents"){const n=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:n}):`${n} parallel agent${n===1?"":"s"}`}return e.type!=="message"?"":dbe(e.message,t)}function fbe(e,t){return t?t(`timeline.kind.${e}`):Pbe[e]}function mbe(e,t,n,s){if(t!==null)for(const o of e){if(o.type!=="message")continue;const{message:a}=o;if(a.id!==t||a.role!=="assistant")continue;const l=Vd(a.content,180,{stripMarkdown:!0});if(l)return l}const r=[];for(let o=0;o<e.length;o+=1){const a=e[o];if(a.type==="message"&&t!==null&&a.message.id===t)continue;const l=hbe(a,s);l&&r.push(l)}const i=Vd(r.join(" · "),180);return i||(n.length>0?n.map(o=>fbe(o,s)).join(" · "):s?s("timeline.noActivity"):"No activity")}function pbe(e,t){const n=[];let s=null,r=[];const i=()=>{if(!s)return;const o=EP(r),a=A6(o,-1,o.length-1),l=a>=0?o[a]:null,c=(l==null?void 0:l.type)==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&Vd(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(const h of o){if(h.type==="message"&&c!==null&&h.message.id===c)continue;const f=abe(h,t);f.kind!=="none"&&!d.includes(f.kind)&&d.push(f.kind)}n.push({id:s.id,label:cbe(s,t),detail:mbe(o,c,d,t),timestamp:s.timestamp,nodeKinds:d,...ube(s)?{isScheduledTask:!0}:{}})};for(const o of e){if(fm(o)){i(),s=o,r=[];continue}s&&r.push(o)}return i(),n}function gbe(){return u.jsxs("svg",{className:Mn.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),u.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function ybe(e){var n,s,r;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",((n=e.subTools)==null?void 0:n.length)??0,String(((s=e.args)==null?void 0:s.subagent_type)??""),((r=e.args)==null?void 0:r.run_in_background)===!0?"background":"",String((t==null?void 0:t.type)??""),String((t==null?void 0:t.status)??"")].join(":")}function bbe(e){return e.map(t=>{const n=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${n}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${n}:${t.tools.map(ybe).join(",")}`;case"system":return`${n}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${n}:${t.content}`;case"user_shell":return`${n}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return n;default:return n}}).join("|")}function MP(e){return e.type==="parallel_agents"?!0:e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(MP):e.message.role==="tool_group"||e.message.role==="plan"}function gE(e){return e==="pending"||e==="running"||e==="in_progress"}function NP(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const s=NP(e.items[n]);if(s)return s}return null}if(e.type==="turn_collapse")return e.turnCollapse.liveStartedAt===void 0||e.turnCollapse.toolCallCount===void 0||e.turnCollapse.toolCallCount<=0?null:`turn:${e.turnCollapse.turnId}:${e.turnCollapse.toolCallCount}`;if(e.type==="parallel_agents"){const n=e.agents.filter(s=>gE(s.status));return n.length===0?null:`agents:${e.key}:${n.map(s=>s.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>gE(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function vbe(e){for(let t=e.length-1;t>=0;t--){const n=NP(e[t]);if(n)return n}return null}function wbe(e){if(!(e.type!=="message"||e.message.role!=="system"))return e.message.source==="prompt_cancelled"||e.message.source==="turn_error"?e.message.timestamp:void 0}function xbe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function _be(e){var t;if(!(e.type!=="message"||e.message.role!=="assistant"))return(t=e.message.content)!=null&&t.trim()?e.message.timestamp:void 0}function kbe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function IP(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+IP(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function jP(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const s=e[n];if(s.type==="message"&&fm(s.message))return s.message.id}return null}function RP(e){const t=[];let n=null;for(const s of e)s.type==="message"&&fm(s.message)&&(n=s.message.id),t.push(n);return t}function yE(e,t,n,s){const r=s===void 0?jP(e,t):s[t]??null;return r?n.get(r)??null:null}function Sbe(e,t,n,s,r=RP(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const l of t){if(l<0||l>=e.length)continue;const c=yE(e,l,n,r);c!==null&&(i=Math.min(i,c),o=Math.max(o,c))}if(o<0)return null;const a=s==null?null:yE(e,s,n,r);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function Tbe(e,t,n,s){if(!s)return!1;for(let r=t;r<=n;r++){const i=e[r];if(i.type==="parallel_agents"){if(i.agents.some(o=>Aa(o,s)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Aa(o,s)))return!0}return!1}function Cbe(e,{overrides:t,isResponding:n,activeTurnStartedAt:s,pendingApprovalCallId:r,enabled:i}){if(!i||e.length===0)return e;const o=[];for(let l=0;l<e.length;l++){const c=e[l];c.type==="message"&&fm(c.message)&&o.push(l)}if(o.length===0)return e;const a=[];for(let l=0;l<o[0];l++)a.push(e[l]);for(let l=0;l<o.length;l++){const c=o[l],d=(l+1<o.length?o[l+1]:e.length)-1,h=e[c],f=h.message.id,m=h.message.timestamp,p=l===o.length-1&&n,y=Tbe(e,c,d,r),w=A6(e,c,d);let b=0,v,x,_=0,E=0,k=0,M=0,R=0,L=!1,T=!1;for(let C=c+1;C<=d;C++){const z=e[C];Q3(z,C===w)&&b++,xbe(z)&&(T=!0),M+=IP(z),z.type==="message"&&z.message.role==="thinking"&&R++;const ae=wbe(z);ae!==void 0&&(v=v===void 0?ae:Math.max(v,ae));const be=_be(z);be!==void 0&&(x=x===void 0?be:Math.max(x,be));const fe=kbe(z);fe&&(_+=fe.inputTokens,E+=fe.outputTokens,k+=fe.cachedTokens??0,L=!0)}const N=p?s??m??Date.now():void 0,I=v??x,O=m!==void 0&&I!==void 0&&I>=m?I-m:void 0;if(y||b===0&&!(L||O!==void 0||N!==void 0)){for(let C=c;C<=d;C++)a.push(e[C]);continue}const F=p||T||w<0,V=!(b===0?!0:t.has(f)?t.get(f):F);let ee=0;const ce=C=>{C.length!==0&&a.push({type:"turn_content",key:`${f}-content-${ee++}`,turnId:f,collapsed:V,items:C})};a.push({type:"message",key:h.key,message:h.message});const $={turnId:f,collapsed:V,hiddenCount:b,...O!==void 0?{elapsedMs:O}:{},...L?{inputTokens:_,outputTokens:E}:{},...k>0?{cachedTokens:k}:{},...M>0?{toolCallCount:M}:{},...R>0?{thinkingCount:R}:{},...N!==void 0?{liveStartedAt:N}:{}};if(a.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:$}),!V){let C=[];for(let z=c+1;z<=d;z++){const X=e[z];z===w&&X.type==="message"&&X.message.role==="assistant"?(ce(C),C=[],a.push({...X,turnCollapse:$})):C.push(X)}ce(C);continue}const J=[],B=[];for(let C=c+1;C<=d;C++){const z=e[C];if(!(C===w&&p)){if(C===w&&z.type==="message"&&z.message.role==="assistant"){B.push({...z,turnCollapse:$});continue}if(Q3(z,C===w)){J.push(z);continue}B.push(z)}}ce(J),a.push(...B)}return a}function gy(e,t,n){for(let s=0;s<e.length;s++){const r=e[s];if(r.type==="message"){if(r.message.id===t||n&&r.message.role==="tool_group"&&r.message.tools.some(i=>Aa(i,n)))return s}else{if(r.type==="parallel_agents"&&n&&r.agents.some(i=>Aa(i,n)))return s;if(r.type==="turn_content"&&gy(r.items,t,n)>=0)return s}}return-1}function X3(e,t){if(!t)return!1;const n=t.callId;return e.type==="message"?e.message.id===t.messageId?!0:!!n&&e.message.role==="tool_group"&&e.message.tools.some(s=>Aa(s,n)):e.type==="parallel_agents"?!!n&&e.agents.some(s=>Aa(s,n)):e.type==="turn_content"?e.items.some(s=>X3(s,t)):!1}const qx=0,Abe=120,Hx=80,Ebe=32,Mbe=240,Ux=30,LP=200,Nbe=4;function Ibe(e,t=LP){return e>t}function jbe(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),s=t-n*60;return`${n}m ${s}s`}function Vx(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Rbe(e){return e!==void 0?jbe(e):""}function Lbe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,s=n>0&&e.inputTokens>0?` (${Vx(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${Vx(e.inputTokens)}${s} ↓${Vx(e.outputTokens)}`}function bE(e,t){const n=[],s=Lbe(e,t);return s&&n.push(s),e.toolCallCount!==void 0&&e.toolCallCount>0&&n.push(t("turn.toolCalls",{count:e.toolCallCount})),e.thinkingCount!==void 0&&e.thinkingCount>0&&n.push(t("turn.thinkingCount",{count:e.thinkingCount})),n.join(" · ")}function Dbe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const Obe=g.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:s}=Xe(),r=t.hiddenCount>0,i=t.liveStartedAt,o=r||i!==void 0||Dbe(t),a=k6(i!==void 0&&o),l=g.useRef(0),c=g.useRef(i);c.current!==i&&(c.current=i,l.current=0);let d;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),d=l.current):o&&t.elapsedMs!==void 0?(l.current=0,d=t.elapsedMs):(l.current=0,d=void 0);const h=Rbe(d),f=bE(t,s),m=bE(t,s),p=s(i!==void 0?"turn.processing":"turn.processed"),y=!!h&&o,w=!!f&&o,b=!!m&&o;if(!o)return null;const v=()=>{if(!r)return;const x=t.collapsed;n(t.turnId,x)};return u.jsxs("div",{className:r?`${wa.collapseRow} ${wa.collapseRowClickable}`:wa.collapseRow,role:r?"button":void 0,tabIndex:r?0:void 0,"aria-expanded":r?!t.collapsed:void 0,"aria-label":r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,title:r?t.collapsed?s("turn.expand"):s("turn.collapse"):void 0,onClick:r?v:void 0,onKeyDown:r?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),v())}:void 0,children:[u.jsxs("span",{className:wa.collapseLabel,children:[u.jsxs("span",{className:wa.processedLabel,children:[p,y&&u.jsxs("span",{className:wa.processedMeta,children:[" ",h]})]}),b&&u.jsx("span",{className:wa.summaryMetrics,children:m}),w&&u.jsx("span",{className:wa.hiddenMetrics,children:f})]}),r&&u.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:wa.collapseIcon,onClick:x=>{x.stopPropagation(),v()},children:u.jsx("span",{className:t.collapsed?wa.chevronRight:wa.chevronDown,"aria-hidden":"true"})})]})});function vE(e){if(e.type==="turn_collapse")return Mn.turnStatusRow;if(e.type==="turn_content")return Mn.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Mn.turnAnswerRow}const Bbe=g.memo(function({collapsed:t,children:n}){const s=M6(Mn.turnContentClip,t?Mn.turnContentCollapsed:void 0);return u.jsx("div",{className:s,"data-collapsed":t?"true":"false",children:u.jsx("div",{className:Mn.turnContentInner,children:n})})}),Pbe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},$be=g.memo(function({entries:t,currentTurnId:n,currentRange:s,hidden:r,onSelect:i}){const{t:o}=Xe();return r||t.length===0?null:u.jsx("div",{className:Mn.sessionTimelineLayer,"aria-hidden":"false",children:u.jsx("nav",{className:Mn.sessionTimelinePanel,"aria-label":o("timeline.sessionTimeline"),"data-testid":"session-timeline",children:u.jsx("ol",{className:Mn.sessionTimelineList,children:t.map((a,l)=>{const c=s!==null&&l>=s.startIndex&&l<=s.endIndex,d=s!==null?l===s.currentIndex:a.id===n,h=a.nodeKinds.join(","),f=[`${o("timeline.turnPrefix",{index:l+1})}: ${a.label}`,d?o("timeline.currentTurn"):null].filter(Boolean).join(". ");return u.jsx("li",{className:Mn.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":a.id,"data-node-kinds":h,"data-in-current-range":c?"true":void 0,children:u.jsxs("button",{type:"button",className:M6(Mn.sessionTimelineButton,c?Mn.sessionTimelineButtonInRange:void 0,d?Mn.sessionTimelineButtonCurrent:void 0),"aria-current":d?"step":void 0,"aria-label":f,onClick:()=>i(a.id),children:[u.jsx("span",{className:Mn.sessionTimelineTick}),u.jsxs("span",{className:Mn.sessionTimelineDetails,"data-testid":"session-timeline-detail","data-title":a.label,"data-detail":a.detail,"data-scheduled-task":a.isScheduledTask?"true":void 0,"aria-hidden":"true",children:[u.jsxs("span",{className:Mn.sessionTimelineDetailsTitle,children:[a.isScheduledTask&&u.jsx(gbe,{}),u.jsx("span",{className:Mn.sessionTimelineDetailsTitleText,children:a.label})]}),u.jsx("span",{className:Mn.sessionTimelineDetailsDetail,children:a.detail})]})]})},a.id)})})})})});function M6(...e){return e.filter(Boolean).join(" ")||void 0}const zbe=[];function Fbe({label:e}){return u.jsxs(u.Fragment,{children:[u.jsx("div",{role:"status","aria-live":"polite",className:Mn.srOnly,children:e}),u.jsxs("div",{className:Mn.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[u.jsx("div",{className:Mn.loadingSkeletonUserRow,children:u.jsxs("div",{className:Mn.loadingSkeletonUserBubble,children:[u.jsx("span",{className:Mn.loadingSkeletonLineWide}),u.jsx("span",{className:Mn.loadingSkeletonLineShort})]})}),u.jsx("div",{className:Mn.loadingSkeletonAssistantRow,children:u.jsxs("div",{className:Mn.loadingSkeletonAssistantBlock,children:[u.jsx("span",{className:Mn.loadingSkeletonLineMedium}),u.jsx("span",{className:Mn.loadingSkeletonLineWide}),u.jsx("span",{className:Mn.loadingSkeletonLineNarrow})]})}),u.jsx("div",{className:Mn.loadingSkeletonUserRow,children:u.jsx("div",{className:Mn.loadingSkeletonUserBubbleCompact,children:u.jsx("span",{className:Mn.loadingSkeletonLineMedium})})}),u.jsx("div",{className:Mn.loadingSkeletonAssistantRow,children:u.jsxs("div",{className:Mn.loadingSkeletonAssistantBlock,children:[u.jsx("span",{className:Mn.loadingSkeletonLineWide}),u.jsx("span",{className:Mn.loadingSkeletonLineMedium})]})})]})]})}const DP=g.memo(g.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:s,loadingTranscript:r,catchingUp:i,isResponding:o=!1,activeTurnStartedAt:a,welcomeHeader:l,workspaceCwd:c,tailContent:d,tailKey:h="tail",virtualScrollThreshold:f=LP,autoScrollTailIntoView:m=!1,hideSessionTimeline:p=!1,showRetryHint:y=!1,onRetryClick:w,onBranchSession:b,onCanScrollToBottomChange:v},x){var _e;const{t:_}=Xe(),E=g.useContext(Zd),k=g.useMemo(()=>E?rbe(t,n):t,[E,t,n]),M=g.useMemo(()=>EP(k),[k]),[R,L]=g.useState(!1),T=g.useRef(null),N=g.useMemo(()=>{var pe,Le;if(!R)return zbe;const se=bbe(k);return(((pe=T.current)==null?void 0:pe.signature)!==se||((Le=T.current)==null?void 0:Le.t)!==_)&&(T.current={signature:se,t:_,entries:pbe(k,_)}),T.current.entries},[R,k,_]),I=g.useMemo(()=>new Map(N.map((se,pe)=>[se.id,pe])),[N]),O=g.useMemo(()=>sbe(k),[k]),[U,F]=g.useState(null),j=U!==null?((_e=N[U.currentIndex])==null?void 0:_e.id)??O:O,V=g.useMemo(()=>{var se;if(o)return null;for(let pe=k.length-1;pe>=0;pe-=1){const Le=k[pe];if(Le&&(Le.role==="tool_group"||Le.role==="plan"))return null;if((Le==null?void 0:Le.role)==="assistant"&&!Le.isStreaming&&((se=Le.content)!=null&&se.trim()))return Le.id}return null},[o,k]),ee=g.useMemo(()=>obe(M,o),[M,o]),{collapseCompletedTurns:ce}=vl(),$=ce??!0,[J,B]=g.useState(()=>new Map),C=g.useRef(!0),z=g.useRef(0),X=g.useRef(!1),ae=g.useRef(0),be=g.useRef(null),fe=g.useRef(null),ie=g.useRef(!1),G=g.useRef(null),q=g.useRef(!1),le=g.useRef(r),Se=g.useRef(null),$e=g.useRef(i),Ae=g.useRef(i),we=g.useRef(!1),ct=g.useRef(!1),ht=g.useRef(void 0),ut=g.useRef(void 0),ft=g.useRef(void 0);Ae.current=i;const tt=g.useRef(null),qt=g.useCallback(()=>{const se=tt.current,pe=se?se.scrollHeight-se.scrollTop-se.clientHeight:0,Le=!C.current&&pe>1;fe.current!==Le&&(fe.current=Le,v==null||v(Le))},[v]),Ye=g.useCallback(()=>{ft.current!==void 0&&window.cancelAnimationFrame(ft.current),ft.current=window.requestAnimationFrame(qt)},[qt]),ge=g.useCallback(se=>{C.current!==se&&(C.current=se,Ye())},[Ye]),st=g.useMemo(()=>Cbe(M,{overrides:J,isResponding:o,activeTurnStartedAt:a,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:$}),[M,J,o,a,n==null?void 0:n.toolCallId,$]),ne=g.useMemo(()=>RP(st),[st]),ue=N.length>=Nbe;g.useLayoutEffect(()=>{if(p){L(wt=>wt&&!1);return}const se=tt.current;if(!se)return;const pe=()=>{const dt=se.getBoundingClientRect().width>=1160;L(Ft=>Ft===dt?Ft:dt)};if(pe(),typeof ResizeObserver>"u")return;const Le=new ResizeObserver(pe);return Le.observe(se),()=>Le.disconnect()},[p]);const Re=d!=null,rt=!!r,vt=!!l,tn=vt?1:0,jn=tn+st.length,ln=jn+(Re?1:0),Pn=Ibe(ln,f),Qt=g.useCallback(()=>tt.current,[]),ve=g.useCallback(()=>{const se=tt.current;if(!se)return;const pe=se.scrollHeight-se.scrollTop-se.clientHeight;ge(pe<Ux),Ye()},[Ye,ge]),Be=g.useCallback(()=>{ct.current=!0,ht.current!==void 0&&window.cancelAnimationFrame(ht.current),ut.current!==void 0&&window.clearTimeout(ut.current),ht.current=window.requestAnimationFrame(ve),ut.current=window.setTimeout(()=>{ct.current=!1,ht.current=void 0,ut.current=void 0,ve()},220)},[ve]);g.useEffect(()=>()=>{ht.current!==void 0&&window.cancelAnimationFrame(ht.current),ut.current!==void 0&&window.clearTimeout(ut.current),ft.current!==void 0&&window.cancelAnimationFrame(ft.current)},[]);const He=g.useCallback((se,pe)=>{const Le=tt.current;(!Le||Le.scrollHeight>Le.clientHeight+1)&&ge(!1),Be(),B(wt=>{const dt=new Map(wt);return dt.set(se,pe),dt})},[Be,ge]),Ht=g.useCallback(se=>{const pe=se.target;pe instanceof HTMLElement&&pe.closest("[aria-expanded]")&&(ge(!1),Be())},[Be,ge]),Yn=g.useCallback(se=>{if(vt&&se===qx)return"slot:header";if(Re&&se===jn)return`slot:tail:${h}`;const pe=st[se-tn];return pe?pE(pe):`slot:row:${se}`},[vt,Re,jn,h,st,tn]),Wt=g.useCallback((se="auto")=>{const pe=Qt();if(!pe||pe.scrollHeight<=pe.clientHeight)return;ae.current+=1;const Le=ae.current;X.current=!0,se==="smooth"?pe.scrollTo({top:pe.scrollHeight,behavior:se}):pe.scrollTop=pe.scrollHeight,Ye(),z.current=Math.max(0,pe.scrollHeight-pe.clientHeight),qt();const wt=()=>{ae.current===Le&&(X.current=!1)};se==="smooth"?setTimeout(wt,350):requestAnimationFrame(wt)},[Qt,qt,Ye]),ss=g.useCallback((se="smooth")=>{ge(!0),Wt(se)},[Wt,ge]),Mt=jY({count:ln,enabled:Pn,getScrollElement:Qt,getItemKey:Yn,estimateSize:se=>{if(vt&&se===qx)return Abe;if(Re&&se===jn)return Mbe;const pe=st[se-tn];return(pe==null?void 0:pe.type)==="turn_collapse"?Ebe:(pe==null?void 0:pe.type)==="turn_content"?Math.max(Hx,pe.items.length*Hx):Hx},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Cn=Mt.getVirtualItems(),rn=Mt.getTotalSize(),Ln=g.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});Ln.current={entryIndexById:I,headerOffset:tn,isVisible:R,turnIdByDisplayIndex:ne,visibleItems:st};const Xn=g.useCallback(()=>{const se=Qt(),pe=Ln.current;if(!se||!pe.isVisible||pe.entryIndexById.size===0){F(un=>un===null?un:null);return}const Le=se.getBoundingClientRect(),wt=Le.top,dt=Le.bottom,Ft=wt+(dt-wt)/2,on=[];let Ks=null,pn=Number.POSITIVE_INFINITY;se.querySelectorAll("[data-index]").forEach(un=>{const rs=un.dataset.index;if(rs===void 0)return;const Ys=Number(rs);if(!Number.isFinite(Ys))return;const Bs=Ys-pe.headerOffset;if(Bs<0||Bs>=pe.visibleItems.length)return;const Dt=un.getBoundingClientRect();if(Dt.bottom<wt||Dt.top>dt)return;on.push(Bs);const Ps=Dt.top+(Dt.bottom-Dt.top)/2,kn=Math.abs(Ps-Ft);kn<pn&&(pn=kn,Ks=Bs)});const An=Sbe(pe.visibleItems,on,pe.entryIndexById,Ks,pe.turnIdByDisplayIndex);F(un=>(un==null?void 0:un.startIndex)===(An==null?void 0:An.startIndex)&&(un==null?void 0:un.endIndex)===(An==null?void 0:An.endIndex)&&(un==null?void 0:un.currentIndex)===(An==null?void 0:An.currentIndex)?un:An)},[Qt]),Nn=g.useCallback(()=>{be.current!==null&&cancelAnimationFrame(be.current),be.current=requestAnimationFrame(()=>{be.current=null,Xn()})},[Xn]);g.useEffect(()=>()=>{be.current!==null&&(cancelAnimationFrame(be.current),be.current=null)},[]),g.useEffect(()=>{Nn()},[Nn,ln,rn,Pn,Cn.length,R]);const[_n,Os]=g.useState(null);g.useEffect(()=>{if(!_n)return;const se=setTimeout(()=>Os(null),1600);return()=>clearTimeout(se)},[_n]);const ks=g.useCallback((se,pe)=>{var wt,dt;ge(!1),ae.current+=1;const Le=ae.current;X.current=!0,Pn?Mt.scrollToIndex(se,{align:"center"}):(dt=(wt=tt.current)==null?void 0:wt.querySelector(`[data-index="${se}"]`))==null||dt.scrollIntoView({block:"center"}),setTimeout(()=>{ae.current===Le&&(X.current=!1,Nn(),Ye())},150),Os(null),requestAnimationFrame(()=>Os(pe))},[Pn,Mt,ge,Nn,Ye]),Kt=g.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Kt.current={visibleItems:st,displayItems:M,headerOffset:tn,performScrollToRow:ks};const Vn=g.useRef(null),Te=g.useCallback((se,pe)=>{const{visibleItems:Le,displayItems:wt,headerOffset:dt,performScrollToRow:Ft}=Kt.current,on=gy(Le,se,pe);if(on>=0){const An=Le[on];return(An==null?void 0:An.type)==="turn_content"&&An.collapsed?(Vn.current={messageId:se,callId:pe},B(un=>{if(un.get(An.turnId)===!0)return un;const rs=new Map(un);return rs.set(An.turnId,!0),rs}),!0):(Vn.current=null,Ft(on+dt,{messageId:se,callId:pe}),!0)}const Ks=gy(wt,se,pe);if(Ks<0)return!1;const pn=jP(wt,Ks);return pn?(Vn.current={messageId:se,callId:pe},B(An=>{if(An.get(pn)===!0)return An;const un=new Map(An);return un.set(pn,!0),un}),!0):!1},[]);g.useImperativeHandle(x,()=>({scrollToMessage:Te,scrollToBottom:ss}),[Te,ss]),g.useEffect(()=>{const se=Vn.current;if(!se)return;const pe=gy(st,se.messageId,se.callId);pe<0||(Vn.current=null,ks(pe+tn,se))},[st,tn,ks]);const mt=g.useCallback(()=>{const se=Qt();if(!se)return;if(X.current){z.current=se.scrollTop;return}Nn();const pe=z.current,Le=se.scrollTop;z.current=Le;const wt=se.scrollHeight-Le-se.clientHeight;if(Ye(),Le<pe-1){ge(wt<Ux);return}wt<Ux&&ge(!0)},[Qt,Ye,Nn,ge]);g.useEffect(()=>{const se=Qt();if(se)return se.addEventListener("scroll",mt,{passive:!0}),()=>se.removeEventListener("scroll",mt)},[Qt,mt]),g.useEffect(()=>{const se=Qt();if(!se||typeof ResizeObserver>"u")return;const pe=new ResizeObserver(Ye);pe.observe(se);for(const wt of Array.from(se.children))pe.observe(wt);const Le=new MutationObserver(wt=>{for(const dt of wt){for(const Ft of Array.from(dt.addedNodes))Ft instanceof HTMLElement&&pe.observe(Ft);for(const Ft of Array.from(dt.removedNodes))Ft instanceof HTMLElement&&pe.unobserve(Ft)}Ye()});return Le.observe(se,{childList:!0}),Ye(),()=>{pe.disconnect(),Le.disconnect()}},[Qt,Ye]),g.useEffect(()=>{t.length===0&&(ge(!0),Vn.current=null,B(se=>se.size?new Map:se))},[t.length,ge]),g.useEffect(()=>{const se=tt.current;if(!se)return;const pe=new ResizeObserver(()=>{Nn(),!Ae.current&&C.current&&requestAnimationFrame(()=>{!Ae.current&&C.current&&Wt()})});return pe.observe(se),()=>pe.disconnect()},[Wt,Nn]),g.useLayoutEffect(()=>{const se=tbe(t);if(i||r||le.current){G.current=se,ie.current=!0,q.current=!1,le.current=r;return}if(le.current=r,!ie.current){G.current=se,ie.current=!0,q.current=!1;return}const pe=nbe(t);se&&(pe==null?void 0:pe.role)==="user"&&se!==G.current?(ge(!0),Vn.current=null,q.current=!0):q.current=!1,G.current=se},[t,i,r,ge]),g.useLayoutEffect(()=>{$e.current&&!i&&(ge(!0),Wt("auto")),$e.current=i},[i,Wt,ge]);const Xt=g.useMemo(()=>vbe(st),[st]);g.useLayoutEffect(()=>{if(!i){if(!Xt){Se.current=null;return}Xt!==Se.current&&(Se.current=Xt,C.current&&requestAnimationFrame(()=>{C.current&&Wt()}))}},[i,Xt,Wt]),g.useEffect(()=>{m&&Re&&!we.current&&(ge(!0),requestAnimationFrame(()=>{C.current&&Wt()})),we.current=Re},[m,Re,Wt,ge]);const mn=g.useCallback(se=>{const pe=(dt,Ft)=>dt.type==="parallel_agents"?u.jsx(Q_,{timestamp:dt.timestamp,children:u.jsx("div",{className:X3(dt,_n)?Iu.flash:void 0,children:u.jsx(dye,{agents:dt.agents,pendingApproval:n})})}):dt.type==="turn_collapse"?u.jsx(Obe,{turnCollapse:dt.turnCollapse,onToggleCollapse:He}):dt.type==="turn_content"?u.jsx(Bbe,{collapsed:dt.collapsed,children:dt.items.map(on=>u.jsx("div",{className:vE(on),children:pe(on,!1)},pE(on)))}):u.jsx(P1e,{message:dt.message,pendingApproval:n,onShowContextDetail:s,workspaceCwd:c,isLatest:Ft,showRetryHint:y,onRetryClick:w,onBranchSession:b,showAssistantActions:dt.message.role==="assistant"&&ee.has(dt.message.id),showAssistantBranch:dt.message.role==="assistant"&&dt.message.id===V,isLocateFlashing:X3(dt,_n)});if(vt&&se===qx)return l;if(Re&&se===jn)return d;const Le=se-tn,wt=st[Le];return wt?pe(wt,Le===st.length-1):null},[vt,l,Re,d,jn,n,s,tn,st,_n,ee,V,c,y,w,b,He]),oe=g.useCallback(se=>se?vE(se):void 0,[]);return g.useLayoutEffect(()=>{if(i)return;const se=q.current;X.current&&!se||ct.current&&!se||(C.current||se)&&(Wt(se?"smooth":"auto"),q.current=!1)},[rn,t,ln,i,Wt]),g.useLayoutEffect(()=>{Ye()},[t,Ye,ln,rn]),u.jsxs("div",{ref:tt,className:Mn.list,onClickCapture:Ht,children:[rt&&u.jsx(Fbe,{label:_("editor.sessionLoading")}),u.jsx($be,{entries:N,currentTurnId:j,currentRange:U,hidden:!R||!ue,onSelect:Te}),Pn?u.jsx("div",{className:Mn.virtualSizer,style:{height:rn},children:Cn.map(se=>u.jsx("div",{"data-index":se.index,ref:Mt.measureElement,className:M6(Mn.virtualRow,oe(st[se.index-tn])),style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${se.start}px)`},children:mn(se.index)},se.key))}):Array.from({length:ln},(se,pe)=>{const Le=Yn(pe),wt=st[pe-tn];return u.jsx("div",{"data-index":pe,className:oe(wt),children:mn(pe)},Le)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function qbe(e){const t=e.toLowerCase();return/^qwen3-asr-flash-realtime(?:-|$)/.test(t)||/^qwen3-asr-flash(?:-\d{4}-\d{2}-\d{2})?$/.test(t)||/^(fun-asr|paraformer).*realtime(?:-|$)/.test(t)}function Hbe(e){const t=new Set,n=[];for(const s of(e==null?void 0:e.providers)??[])for(const r of s.models??[]){const i=r.baseModelId;!i||r.isRuntime||!qbe(i)||t.has(i)||(t.add(i),n.push({id:i,...r.name?{label:r.name}:{},...s.authType?{authType:s.authType}:{},...r.baseUrl?{baseUrl:r.baseUrl}:{},...typeof r.contextLimit=="number"?{contextWindow:r.contextLimit}:{},modalities:{audio:!0}}))}return n}let J3=[],OP=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?OP:J3).push(n=n+e[t])})();function Ube(e){if(e<768)return!1;for(let t=0,n=J3.length;;){let s=t+n>>1;if(e<J3[s])n=s;else if(e>=OP[s])t=s+1;else return!0;if(t==n)return!1}}function wE(e){return e>=127462&&e<=127487}const xE=8205;function Vbe(e,t,n=!0,s=!0){return(n?BP:Wbe)(e,t,s)}function BP(e,t,n){if(t==e.length)return t;t&&PP(e.charCodeAt(t))&&$P(e.charCodeAt(t-1))&&t--;let s=Wx(e,t);for(t+=_E(s);t<e.length;){let r=Wx(e,t);if(s==xE||r==xE||n&&Ube(r))t+=_E(r),s=r;else if(wE(r)){let i=0,o=t-2;for(;o>=0&&wE(Wx(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function Wbe(e,t,n){for(;t>0;){let s=BP(e,t-2,n);if(s<t)return s;t--}return 0}function Wx(e,t){let n=e.charCodeAt(t);if(!$P(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return PP(s)?(n-55296<<10)+(s-56320)+65536:n}function PP(e){return e>=56320&&e<57344}function $P(e){return e>=55296&&e<56320}function _E(e){return e<65536?1:2}class Qn{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,s){[t,n]=Ff(this,t,n);let r=[];return this.decompose(0,t,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(n,this.length,r,1),nl.from(r,this.length-(n-t)+s.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=Ff(this,t,n);let s=[];return this.decompose(t,n,s,0),nl.from(s,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),s=this.length-this.scanIdentical(t,-1),r=new F0(this),i=new F0(t);for(let o=n,a=n;;){if(r.next(o),i.next(o),o=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=s)return!0}}iter(t=1){return new F0(this,t)}iterRange(t,n=this.length){return new zP(this,t,n)}iterLines(t,n){let s;if(t==null)s=this.iter();else{n==null&&(n=this.lines+1);let r=this.line(t).from;s=this.iterRange(r,Math.max(r,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new FP(s)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?Qn.empty:t.length<=32?new fr(t):nl.from(fr.split(t,[]))}}class fr extends Qn{constructor(t,n=Gbe(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.text[i],a=r+o.length;if((n?s:a)>=t)return new Kbe(r,a,s,o);r=a+1,s++}}decompose(t,n,s,r){let i=t<=0&&n>=this.length?this:new fr(kE(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(r&1){let o=s.pop(),a=yy(i.text,o.text.slice(),0,i.length);if(a.length<=32)s.push(new fr(a,o.length+i.length));else{let l=a.length>>1;s.push(new fr(a.slice(0,l)),new fr(a.slice(l)))}}else s.push(i)}replace(t,n,s){if(!(s instanceof fr))return super.replace(t,n,s);[t,n]=Ff(this,t,n);let r=yy(this.text,yy(s.text,kE(this.text,0,t)),n),i=this.length+s.length-(n-t);return r.length<=32?new fr(r,i):nl.from(fr.split(r,[]),i)}sliceString(t,n=this.length,s=`
`){[t,n]=Ff(this,t,n);let r="";for(let i=0,o=0;i<=n&&o<this.text.length;o++){let a=this.text[o],l=i+a.length;i>t&&o&&(r+=s),t<l&&n>i&&(r+=a.slice(Math.max(0,t-i),n-i)),i=l+1}return r}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let s=[],r=-1;for(let i of t)s.push(i),r+=i.length+1,s.length==32&&(n.push(new fr(s,r)),s=[],r=-1);return r>-1&&n.push(new fr(s,r)),n}}class nl extends Qn{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let s of t)this.lines+=s.lines}lineInner(t,n,s,r){for(let i=0;;i++){let o=this.children[i],a=r+o.length,l=s+o.lines-1;if((n?l:a)>=t)return o.lineInner(t,n,s,r);r=a+1,s=l+1}}decompose(t,n,s,r){for(let i=0,o=0;o<=n&&i<this.children.length;i++){let a=this.children[i],l=o+a.length;if(t<=l&&n>=o){let c=r&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!c?s.push(a):a.decompose(t-o,n-o,s,c)}o=l+1}}replace(t,n,s){if([t,n]=Ff(this,t,n),s.lines<this.lines)for(let r=0,i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.length;if(t>=i&&n<=a){let l=o.replace(t-i,n-i,s),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[r]=l,new nl(d,this.length-(n-t)+s.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,s)}sliceString(t,n=this.length,s=`
`){[t,n]=Ff(this,t,n);let r="";for(let i=0,o=0;i<this.children.length&&o<=n;i++){let a=this.children[i],l=o+a.length;o>t&&i&&(r+=s),t<l&&n>o&&(r+=a.sliceString(t-o,n-o,s)),o=l+1}return r}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof nl))return 0;let s=0,[r,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;r+=n,i+=n){if(r==o||i==a)return s;let l=this.children[r],c=t.children[i];if(l!=c)return s+l.scanIdentical(c,n);s+=l.length+1}}static from(t,n=t.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let m of t)s+=m.lines;if(s<32){let m=[];for(let p of t)p.flatten(m);return new fr(m,n)}let r=Math.max(32,s>>5),i=r<<1,o=r>>1,a=[],l=0,c=-1,d=[];function h(m){let p;if(m.lines>i&&m instanceof nl)for(let y of m.children)h(y);else m.lines>o&&(l>o||!l)?(f(),a.push(m)):m instanceof fr&&l&&(p=d[d.length-1])instanceof fr&&m.lines+p.lines<=32?(l+=m.lines,c+=m.length+1,d[d.length-1]=new fr(p.text.concat(m.text),p.length+1+m.length)):(l+m.lines>r&&f(),l+=m.lines,c+=m.length+1,d.push(m))}function f(){l!=0&&(a.push(d.length==1?d[0]:nl.from(d,c)),c=-1,l=d.length=0)}for(let m of t)h(m);return f(),a.length==1?a[0]:new nl(a,n)}}Qn.empty=new fr([""],0);function Gbe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function yy(e,t,n=0,s=1e9){for(let r=0,i=0,o=!0;i<e.length&&r<=s;i++){let a=e[i],l=r+a.length;l>=n&&(l>s&&(a=a.slice(0,s-r)),r<n&&(a=a.slice(n-r)),o?(t[t.length-1]+=a,o=!1):t.push(a)),r=l+1}return t}function kE(e,t,n){return yy(e,[""],t,n)}class F0{constructor(t,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[n>0?1:(t instanceof fr?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let s=this.nodes.length-1,r=this.nodes[s],i=this.offsets[s],o=i>>1,a=r instanceof fr?r.text.length:r.children.length;if(o==(n>0?a:0)){if(s==0)return this.done=!0,this.value="",this;n>0&&this.offsets[s-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[s]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(r instanceof fr){let l=r.text[o+(n<0?-1:0)];if(this.offsets[s]+=n,l.length>Math.max(0,t))return this.value=t==0?l:n>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=r.children[o+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[s]+=n):(n<0&&this.offsets[s]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof fr?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class zP{constructor(t,n,s){this.value="",this.done=!1,this.cursor=new F0(t,n>s?-1:1),this.pos=n>s?t.length:0,this.from=Math.min(n,s),this.to=Math.max(n,s)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let s=n<0?this.pos-this.from:this.to-this.pos;t>s&&(t=s),s-=t;let{value:r}=this.cursor.next(t);return this.pos+=(r.length+t)*n,this.value=r.length<=s?r:n<0?r.slice(r.length-s):r.slice(0,s),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class FP{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:s,value:r}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):s?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Qn.prototype[Symbol.iterator]=function(){return this.iter()},F0.prototype[Symbol.iterator]=zP.prototype[Symbol.iterator]=FP.prototype[Symbol.iterator]=function(){return this});class Kbe{constructor(t,n,s,r){this.from=t,this.to=n,this.number=s,this.text=r}get length(){return this.to-this.from}}function Ff(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function vi(e,t,n=!0,s=!0){return Vbe(e,t,n,s)}function Ybe(e){return e>=56320&&e<57344}function Qbe(e){return e>=55296&&e<56320}function zc(e,t){let n=e.charCodeAt(t);if(!Qbe(n)||t+1==e.length)return n;let s=e.charCodeAt(t+1);return Ybe(s)?(n-55296<<10)+(s-56320)+65536:n}function Xbe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Bh(e){return e<65536?1:2}const Z3=/\r\n?|\n/;var xo=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(xo||(xo={}));class ml{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let s=this.sections[n+1];t+=s<0?this.sections[n]:s}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,s=0,r=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(s,r,i),r+=i):r+=o,s+=i}}iterChangedRanges(t,n=!1){ek(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];r<0?t.push(s,r):t.push(r,s)}return new ml(t)}composeDesc(t){return this.empty?t:t.empty?this:qP(this,t)}mapDesc(t,n=!1){return t.empty?this:tk(this,t,n)}mapPos(t,n=-1,s=xo.Simple){let r=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=r+a;if(l<0){if(c>t)return i+(t-r);i+=a}else{if(s!=xo.Simple&&c>=t&&(s==xo.TrackDel&&r<t&&c>t||s==xo.TrackBefore&&r<t||s==xo.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!a)return t==r||n<0?i:i+l;i+=l}r=c}if(t>r)throw new RangeError(`Position ${t} is out of range for changeset of length ${r}`);return i}touchesRange(t,n=t){for(let s=0,r=0;s<this.sections.length&&r<=n;){let i=this.sections[s++],o=this.sections[s++],a=r+i;if(o>=0&&r<=n&&a>=t)return r<t&&a>n?"cover":!0;r=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let s=this.sections[n++],r=this.sections[n++];t+=(t?" ":"")+s+(r>=0?":"+r:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ml(t)}static create(t){return new ml(t)}}class Rr extends ml{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return ek(this,(n,s,r,i,o)=>t=t.replace(r,r+(s-n),o),!1),t}mapDesc(t,n=!1){return tk(this,t,n,!0)}invert(t){let n=this.sections.slice(),s=[];for(let r=0,i=0;r<n.length;r+=2){let o=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=o;let l=r>>1;for(;s.length<l;)s.push(Qn.empty);s.push(o?t.slice(i,i+o):Qn.empty)}i+=o}return new Rr(n,s)}compose(t){return this.empty?t:t.empty?this:qP(this,t,!0)}map(t,n=!1){return t.empty?this:tk(this,t,n,!0)}iterChanges(t,n=!1){ek(this,t,n)}get desc(){return ml.create(this.sections)}filter(t){let n=[],s=[],r=[],i=new wp(this);e:for(let o=0,a=0;;){let l=o==t.length?1e9:t[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,l-a);pi(r,d,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;pi(n,d,h),h>0&&ru(s,n,i.text),i.forward(d),a+=d}let c=t[o++];for(;a<c;){if(i.done)break e;let d=Math.min(i.len,c-a);pi(n,d,-1),pi(r,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new Rr(n,s),filtered:ml.create(r)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let s=this.sections[n],r=this.sections[n+1];r<0?t.push(s):r==0?t.push([s]):t.push([s].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,s){let r=[],i=[],o=0,a=null;function l(d=!1){if(!d&&!r.length)return;o<n&&pi(r,n-o,-1);let h=new Rr(r,i);a=a?a.compose(h.map(a)):h,r=[],i=[],o=0}function c(d){if(Array.isArray(d))for(let h of d)c(h);else if(d instanceof Rr){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:f=h,insert:m}=d;if(h>f||h<0||f>n)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${n})`);let p=m?typeof m=="string"?Qn.of(m.split(s||Z3)):m:Qn.empty,y=p.length;if(h==f&&y==0)return;h<o&&l(),h>o&&pi(r,h-o,-1),pi(r,f-h,y),ru(i,r,p),o=f}}return c(t),l(!a),a}static empty(t){return new Rr(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],s=[];for(let r=0;r<t.length;r++){let i=t[r];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;s.length<r;)s.push(Qn.empty);s[r]=Qn.of(i.slice(1)),n.push(i[0],s[r].length)}}}return new Rr(n,s)}static createSet(t,n){return new Rr(t,n)}}function pi(e,t,n,s=!1){if(t==0&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&t==0&&e[r]==0?e[r+1]+=n:s?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function ru(e,t,n){if(n.length==0)return;let s=t.length-2>>1;if(s<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<s;)e.push(Qn.empty);e.push(n)}}function ek(e,t,n){let s=e.inserted;for(let r=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)r+=a,i+=a;else{let c=r,d=i,h=Qn.empty;for(;c+=a,d+=l,l&&s&&(h=h.append(s[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(r,c,i,d,h),r=c,i=d}}}function tk(e,t,n,s=!1){let r=[],i=s?[]:null,o=new wp(e),a=new wp(t);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);pi(r,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let c=a.len;for(pi(r,a.ins,-1);c;){let d=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=d&&(pi(r,0,o.ins),i&&ru(i,r,o.text),l=o.i),o.forward(d),c-=d}a.next()}else if(o.ins>=0){let c=0,d=o.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);c+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;pi(r,c,l<o.i?o.ins:0),i&&l<o.i&&ru(i,r,o.text),l=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?Rr.createSet(r,i):ml.create(r);throw new Error("Mismatched change set lengths")}}}function qP(e,t,n=!1){let s=[],r=n?[]:null,i=new wp(e),o=new wp(t);for(let a=!1;;){if(i.done&&o.done)return r?Rr.createSet(s,r):ml.create(s);if(i.ins==0)pi(s,i.len,0,a),i.next();else if(o.len==0&&!o.done)pi(s,0,o.ins,a),r&&ru(r,s,o.text),o.next();else{if(i.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(i.len2,o.len),c=s.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;pi(s,l,d,a),r&&d&&ru(r,s,o.text)}else o.ins==-1?(pi(s,i.off?0:i.len,l,a),r&&ru(r,s,i.textBit(l))):(pi(s,i.off?0:i.len,o.off?0:o.ins,a),r&&!o.off&&ru(r,s,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||s.length>c),i.forward2(l),o.forward(l)}}}}class wp{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length?Qn.empty:t[n]}textBit(t){let{inserted:n}=this.set,s=this.i-2>>1;return s>=n.length&&!t?Qn.empty:n[s].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class Sd{constructor(t,n,s){this.from=t,this.to=n,this.flags=s}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,n=-1){let s,r;return this.empty?s=r=t.mapPos(this.from,n):(s=t.mapPos(this.from,1),r=t.mapPos(this.to,-1)),s==this.from&&r==this.to?this:new Sd(s,r,this.flags)}extend(t,n=t,s=0){if(t<=this.anchor&&n>=this.anchor)return Ve.range(t,n,void 0,void 0,s);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Ve.range(this.anchor,r,void 0,void 0,s)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ve.range(t.anchor,t.head)}static create(t,n,s){return new Sd(t,n,s)}}class Ve{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Ve.create(this.ranges.map(s=>s.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let s=0;s<this.ranges.length;s++)if(!this.ranges[s].eq(t.ranges[s],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ve([this.main],0)}addRange(t,n=!0){return Ve.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let s=this.ranges.slice();return s[n]=t,Ve.create(s,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ve(t.ranges.map(n=>Sd.fromJSON(n)),t.main)}static single(t,n=t){return new Ve([Ve.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let s=0,r=0;r<t.length;r++){let i=t[r];if(i.empty?i.from<=s:i.from<s)return Ve.normalized(t.slice(),n);s=i.to}return new Ve(t,n)}static cursor(t,n=0,s,r){return Sd.create(t,t,(n==0?0:n<0?8:16)|(s==null?7:Math.min(6,s))|(r??16777215)<<6)}static range(t,n,s,r,i){let o=(s??16777215)<<6|(r==null?7:Math.min(6,r));return!i&&t!=n&&(i=n<t?1:-1),n<t?Sd.create(n,t,48|o):Sd.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let s=t[n];t.sort((r,i)=>r.from-i.from),n=t.indexOf(s);for(let r=1;r<t.length;r++){let i=t[r],o=t[r-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?Ve.range(l,a):Ve.range(a,l))}}return new Ve(t,n)}}function HP(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let N6=0;class Gt{constructor(t,n,s,r,i){this.combine=t,this.compareInput=n,this.compare=s,this.isStatic=r,this.id=N6++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new Gt(t.combine||(n=>n),t.compareInput||((n,s)=>n===s),t.compare||(t.combine?(n,s)=>n===s:I6),!!t.static,t.enables)}of(t){return new by([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new by(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new by(t,this,2,n)}from(t,n){return n||(n=s=>s),this.compute([t],s=>n(s.field(t)))}}function I6(e,t){return e==t||e.length==t.length&&e.every((n,s)=>n===t[s])}class by{constructor(t,n,s,r){this.dependencies=t,this.facet=n,this.type=s,this.value=r,this.id=N6++}dynamicSlot(t){var n;let s=this.value,r=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,l=!1,c=!1,d=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((n=t[h.id])!==null&&n!==void 0?n:1)&1||d.push(t[h.id]);return{create(h){return h.values[o]=s(h),1},update(h,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||nk(h,d)){let m=s(h);if(a?!SE(m,h.values[o],r):!r(m,h.values[o]))return h.values[o]=m,1}return 0},reconfigure:(h,f)=>{let m,p=f.config.address[i];if(p!=null){let y=Pb(f,p);if(this.dependencies.every(w=>w instanceof Gt?f.facet(w)===h.facet(w):w instanceof Cl?f.field(w,!1)==h.field(w,!1):!0)||(a?SE(m=s(h),y,r):r(m=s(h),y)))return h.values[o]=y,0}else m=s(h);return h.values[o]=m,1}}}}function SE(e,t,n){if(e.length!=t.length)return!1;for(let s=0;s<e.length;s++)if(!n(e[s],t[s]))return!1;return!0}function nk(e,t){let n=!1;for(let s of t)q0(e,s)&1&&(n=!0);return n}function Jbe(e,t,n){let s=n.map(l=>e[l.id]),r=n.map(l=>l.type),i=s.filter(l=>!(l&1)),o=e[t.id]>>1;function a(l){let c=[];for(let d=0;d<s.length;d++){let h=Pb(l,s[d]);if(r[d]==2)for(let f of h)c.push(f);else c.push(h)}return t.combine(c)}return{create(l){for(let c of s)q0(l,c);return l.values[o]=a(l),1},update(l,c){if(!nk(l,i))return 0;let d=a(l);return t.compare(d,l.values[o])?0:(l.values[o]=d,1)},reconfigure(l,c){let d=nk(l,s),h=c.config.facets[t.id],f=c.facet(t);if(h&&!d&&I6(n,h))return l.values[o]=f,0;let m=a(l);return t.compare(m,f)?(l.values[o]=f,0):(l.values[o]=m,1)}}}const g1=Gt.define({static:!0});class Cl{constructor(t,n,s,r,i){this.id=t,this.createF=n,this.updateF=s,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new Cl(N6++,t.create,t.update,t.compare||((s,r)=>s===r),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(g1).find(s=>s.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:s=>(s.values[n]=this.create(s),1),update:(s,r)=>{let i=s.values[n],o=this.updateF(i,r);return this.compareF(i,o)?0:(s.values[n]=o,1)},reconfigure:(s,r)=>{let i=s.facet(g1),o=r.facet(g1),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(s.values[n]=a.create(s),1):r.config.address[this.id]!=null?(s.values[n]=r.field(this),0):(s.values[n]=this.create(s),1)}}}init(t){return[this,g1.of({field:this,create:t})]}get extension(){return this}}const yd={lowest:4,low:3,default:2,high:1,highest:0};function qm(e){return t=>new UP(t,e)}const uh={highest:qm(yd.highest),high:qm(yd.high),default:qm(yd.default),low:qm(yd.low),lowest:qm(yd.lowest)};class UP{constructor(t,n){this.inner=t,this.prec=n}}class dh{of(t){return new sk(this,t)}reconfigure(t){return dh.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class sk{constructor(t,n){this.compartment=t,this.inner=n}}class Bb{constructor(t,n,s,r,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=s,this.address=r,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<s.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,s){let r=[],i=Object.create(null),o=new Map;for(let f of Zbe(t,n,o))f instanceof Cl?r.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of r)a[f.id]=c.length<<1,c.push(m=>f.slot(m));let d=s==null?void 0:s.config.facets;for(let f in i){let m=i[f],p=m[0].facet,y=d&&d[f]||[];if(m.every(w=>w.type==0))if(a[p.id]=l.length<<1|1,I6(y,m))l.push(s.facet(p));else{let w=p.combine(m.map(b=>b.value));l.push(s&&p.compare(w,s.facet(p))?s.facet(p):w)}else{for(let w of m)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(b=>w.dynamicSlot(b)));a[p.id]=c.length<<1,c.push(w=>Jbe(w,p,m))}}let h=c.map(f=>f(a));return new Bb(t,o,h,a,l,i)}}function Zbe(e,t,n){let s=[[],[],[],[],[]],r=new Map;function i(o,a){let l=r.get(o);if(l!=null){if(l<=a)return;let c=s[l].indexOf(o);c>-1&&s[l].splice(c,1),o instanceof sk&&n.delete(o.compartment)}if(r.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof sk){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(o.compartment)||o.inner;n.set(o.compartment,c),i(c,a)}else if(o instanceof UP)i(o.inner,o.prec);else if(o instanceof Cl)s[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof by)s[a].push(o),o.facet.extensions&&i(o.facet.extensions,yd.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(c,a)}}return i(e,yd.default),s.reduce((o,a)=>o.concat(a))}function q0(e,t){if(t&1)return 2;let n=t>>1,s=e.status[n];if(s==4)throw new Error("Cyclic dependency between fields and/or facets");if(s&2)return s;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function Pb(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const VP=Gt.define(),rk=Gt.define({combine:e=>e.some(t=>t),static:!0}),WP=Gt.define({combine:e=>e.length?e[0]:void 0,static:!0}),GP=Gt.define(),KP=Gt.define(),YP=Gt.define(),QP=Gt.define({combine:e=>e.length?e[0]:!1});class kc{constructor(t,n){this.type=t,this.value=n}static define(){return new eve}}class eve{of(t){return new kc(this,t)}}class tve{constructor(t){this.map=t}of(t){return new _s(this,t)}}class _s{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new _s(this.type,n)}is(t){return this.type==t}static define(t={}){return new tve(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let s=[];for(let r of t){let i=r.map(n);i&&s.push(i)}return s}}_s.reconfigure=_s.define();_s.appendConfig=_s.define();class Or{constructor(t,n,s,r,i,o){this.startState=t,this.changes=n,this.selection=s,this.effects=r,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,s&&HP(s,n.newLength),i.some(a=>a.type==Or.time)||(this.annotations=i.concat(Or.time.of(Date.now())))}static create(t,n,s,r,i,o){return new Or(t,n,s,r,i,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Or.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Or.time=kc.define();Or.userEvent=kc.define();Or.addToHistory=kc.define();Or.remote=kc.define();function nve(e,t){let n=[];for(let s=0,r=0;;){let i,o;if(s<e.length&&(r==t.length||t[r]>=e[s]))i=e[s++],o=e[s++];else if(r<t.length)i=t[r++],o=t[r++];else return n;!n.length||n[n.length-1]<i?n.push(i,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function XP(e,t,n){var s;let r,i,o;return n?(r=t.changes,i=Rr.empty(t.changes.length),o=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(i):(s=e.selection)===null||s===void 0?void 0:s.map(r),effects:_s.mapEffects(e.effects,r).concat(_s.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function ik(e,t,n){let s=t.selection,r=yf(t.annotations);return t.userEvent&&(r=r.concat(Or.userEvent.of(t.userEvent))),{changes:t.changes instanceof Rr?t.changes:Rr.of(t.changes||[],n,e.facet(WP)),selection:s&&(s instanceof Ve?s:Ve.single(s.anchor,s.head)),effects:yf(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function JP(e,t,n){let s=ik(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let o=!!t[i].sequential;s=XP(s,ik(e,t[i],o?s.changes.newLength:e.doc.length),o)}let r=Or.create(e,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return rve(n?sve(r):r)}function sve(e){let t=e.startState,n=!0;for(let r of t.facet(GP)){let i=r(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:nve(n,i))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Rr.empty(t.doc.length);else{let o=e.changes.filter(n);r=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Or.create(t,r,e.selection&&e.selection.map(i),_s.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let s=t.facet(KP);for(let r=s.length-1;r>=0;r--){let i=s[r](e);i instanceof Or?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Or?e=i[0]:e=JP(t,yf(i),!1)}return e}function rve(e){let t=e.startState,n=t.facet(YP),s=e;for(let r=n.length-1;r>=0;r--){let i=n[r](e);i&&Object.keys(i).length&&(s=XP(s,ik(t,i,e.changes.newLength),!0))}return s==e?e:Or.create(t,e.changes,e.selection,s.effects,s.annotations,s.scrollIntoView)}const ive=[];function yf(e){return e==null?ive:Array.isArray(e)?e:[e]}var Zl=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Zl||(Zl={}));const ove=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ok;try{ok=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ave(e){if(ok)return ok.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||ove.test(n)))return!0}return!1}function lve(e){return t=>{if(!/\S/.test(t))return Zl.Space;if(ave(t))return Zl.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Zl.Word;return Zl.Other}}class ms{constructor(t,n,s,r,i,o){this.config=t,this.doc=n,this.selection=s,this.values=r,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)q0(this,a<<1);this.computeSlot=null}field(t,n=!0){let s=this.config.address[t.id];if(s==null){if(n)throw new RangeError("Field is not present in this state");return}return q0(this,s),Pb(this,s)}update(...t){return JP(this,t,!0)}applyTransaction(t){let n=this.config,{base:s,compartments:r}=n;for(let a of t.effects)a.is(dh.reconfigure)?(n&&(r=new Map,n.compartments.forEach((l,c)=>r.set(c,l)),n=null),r.set(a.value.compartment,a.value.extension)):a.is(_s.reconfigure)?(n=null,s=a.value):a.is(_s.appendConfig)&&(n=null,s=yf(s).concat(a.value));let i;n?i=t.startState.values.slice():(n=Bb.resolve(s,r,this),i=new ms(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=t.startState.facet(rk)?t.newSelection:t.newSelection.asSingle();new ms(n,t.newDoc,o,i,(a,l)=>l.update(a,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:Ve.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,s=t(n.ranges[0]),r=this.changes(s.changes),i=[s.range],o=yf(s.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),c=this.changes(l.changes),d=c.map(r);for(let f=0;f<a;f++)i[f]=i[f].map(d);let h=r.mapDesc(c,!0);i.push(l.range.map(h)),r=r.compose(d),o=_s.mapEffects(o,d).concat(_s.mapEffects(yf(l.effects),h))}return{changes:r,selection:Ve.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Rr?t:Rr.of(t,this.doc.length,this.facet(ms.lineSeparator))}toText(t){return Qn.of(t.split(this.facet(ms.lineSeparator)||Z3))}sliceDoc(t=0,n=this.doc.length){return this.doc.sliceString(t,n,this.lineBreak)}facet(t){let n=this.config.address[t.id];return n==null?t.default:(q0(this,n),Pb(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let s in t){let r=t[s];r instanceof Cl&&this.config.address[r.id]!=null&&(n[s]=r.spec.toJSON(this.field(t[s]),this))}return n}static fromJSON(t,n={},s){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(s){for(let i in s)if(Object.prototype.hasOwnProperty.call(t,i)){let o=s[i],a=t[i];r.push(o.init(l=>o.spec.fromJSON(a,l)))}}return ms.create({doc:t.doc,selection:Ve.fromJSON(t.selection),extensions:n.extensions?r.concat([n.extensions]):r})}static create(t={}){let n=Bb.resolve(t.extensions||[],new Map),s=t.doc instanceof Qn?t.doc:Qn.of((t.doc||"").split(n.staticFacet(ms.lineSeparator)||Z3)),r=t.selection?t.selection instanceof Ve?t.selection:Ve.single(t.selection.anchor,t.selection.head):Ve.single(0);return HP(r,s.length),n.staticFacet(rk)||(r=r.asSingle()),new ms(n,s,r,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(ms.tabSize)}get lineBreak(){return this.facet(ms.lineSeparator)||`
`}get readOnly(){return this.facet(QP)}phrase(t,...n){for(let s of this.facet(ms.phrases))if(Object.prototype.hasOwnProperty.call(s,t)){t=s[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(s,r)=>{if(r=="$")return"$";let i=+(r||1);return!i||i>n.length?s:n[i-1]})),t}languageDataAt(t,n,s=-1){let r=[];for(let i of this.facet(VP))for(let o of i(this,n,s))Object.prototype.hasOwnProperty.call(o,t)&&r.push(o[t]);return r}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return lve(n.length?n[0]:"")}wordAt(t){let{text:n,from:s,length:r}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-s,a=t-s;for(;o>0;){let l=vi(n,o,!1);if(i(n.slice(l,o))!=Zl.Word)break;o=l}for(;a<r;){let l=vi(n,a);if(i(n.slice(a,l))!=Zl.Word)break;a=l}return o==a?null:Ve.range(o+s,a+s)}}ms.allowMultipleSelections=rk;ms.tabSize=Gt.define({combine:e=>e.length?e[0]:4});ms.lineSeparator=WP;ms.readOnly=QP;ms.phrases=Gt.define({compare(e,t){let n=Object.keys(e),s=Object.keys(t);return n.length==s.length&&n.every(r=>e[r]==t[r])}});ms.languageData=VP;ms.changeFilter=GP;ms.transactionFilter=KP;ms.transactionExtender=YP;dh.reconfigure=_s.define();function aw(e,t,n={}){let s={};for(let r of e)for(let i of Object.keys(r)){let o=r[i],a=s[i];if(a===void 0)s[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))s[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let r in t)s[r]===void 0&&(s[r]=t[r]);return s}class ju{eq(t){return this==t}range(t,n=t){return ak.create(t,n,this)}}ju.prototype.startSide=ju.prototype.endSide=0;ju.prototype.point=!1;ju.prototype.mapMode=xo.TrackDel;function j6(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let ak=class ZP{constructor(t,n,s){this.from=t,this.to=n,this.value=s}static create(t,n,s){return new ZP(t,n,s)}};function lk(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class R6{constructor(t,n,s,r){this.from=t,this.to=n,this.value=s,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(t,n,s,r=0){let i=s?this.to:this.from;for(let o=r,a=i.length;;){if(o==a)return o;let l=o+a>>1,c=i[l]-t||(s?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(t,n,s,r){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(s,1e9,!1,i);i<o;i++)if(r(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let s=[],r=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+t,h=this.to[l]+t,f,m;if(d==h){let p=n.mapPos(d,c.startSide,c.mapMode);if(p==null||(f=m=p,c.startSide!=c.endSide&&(m=n.mapPos(d,c.endSide),m<f)))continue}else if(f=n.mapPos(d,c.startSide),m=n.mapPos(h,c.endSide),f>m||f==m&&c.startSide>0&&c.endSide<=0)continue;(m-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,m-f)),s.push(c),r.push(f-o),i.push(m-o))}return{mapped:s.length?new R6(r,i,s,a):null,pos:o}}}class ys{constructor(t,n,s,r){this.chunkPos=t,this.chunk=n,this.nextLayer=s,this.maxPoint=r}static create(t,n,s,r){return new ys(t,n,s,r)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:s=!1,filterFrom:r=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(s&&(n=n.slice().sort(lk)),this.isEmpty)return n.length?ys.of(n):this;let a=new e$(this,null,-1).goto(0),l=0,c=[],d=new Wd;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let h=n[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||r>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||r>a.to||i<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(ak.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?ys.empty:this.nextLayer.update({add:c,filter:o,filterFrom:r,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],s=[],r=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=t.touchesRange(a,a+l.length);if(c===!1)r=Math.max(r,l.maxPoint),n.push(l),s.push(t.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,t);d&&(r=Math.max(r,d.maxPoint),n.push(d),s.push(h))}}let i=this.nextLayer.map(t);return n.length==0?i:new ys(s,n,i||ys.empty,r)}between(t,n,s){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],o=this.chunk[r];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,s)===!1)return}this.nextLayer.between(t,n,s)}}iter(t=0){return xp.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return xp.from(t).goto(n)}static compare(t,n,s,r,i=-1){let o=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),a=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),l=TE(o,a,s),c=new Hm(o,l,i),d=new Hm(a,l,i);s.iterGaps((h,f,m)=>CE(c,h,d,f,m,r)),s.empty&&s.length==0&&CE(c,0,d,0,0,r)}static eq(t,n,s=0,r){r==null&&(r=999999999);let i=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=TE(i,o),l=new Hm(i,a,0).goto(s),c=new Hm(o,a,0).goto(s);for(;;){if(l.to!=c.to||!ck(l.active,c.active)||l.point&&(!c.point||!j6(l.point,c.point)))return!1;if(l.to>r)return!0;l.next(),c.next()}}static spans(t,n,s,r,i=-1){let o=new Hm(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,s);if(o.point){let d=o.activeForPoint(o.to),h=o.pointFrom<n?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,l);r.point(a,c,o.point,d,h,o.pointRank),l=Math.min(o.openEnd(c),d.length)}else c>a&&(r.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>s)return l+(o.point&&o.to>s?1:0);a=o.to,o.next()}}static of(t,n=!1){let s=new Wd;for(let r of t instanceof ak?[t]:n?cve(t):t)s.add(r.from,r.to,r.value);return s.finish()}static join(t){if(!t.length)return ys.empty;let n=t[t.length-1];for(let s=t.length-2;s>=0;s--)for(let r=t[s];r!=ys.empty;r=r.nextLayer)n=new ys(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}ys.empty=new ys([],[],null,-1);function cve(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let s=e[n];if(lk(t,s)>0)return e.slice().sort(lk);t=s}return e}ys.empty.nextLayer=ys.empty;class Wd{finishChunk(t){this.chunks.push(new R6(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,s){this.addInner(t,n,s)||(this.nextLayer||(this.nextLayer=new Wd)).add(t,n,s)}addInner(t,n,s){let r=t-this.lastTo||s.startSide-this.last.endSide;if(r<=0&&(t-this.lastFrom||s.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=s,this.lastFrom=t,this.lastTo=n,this.value.push(s),s.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let s=n.value.length-1;return this.last=n.value[s],this.lastFrom=n.from[s]+t,this.lastTo=n.to[s]+t,!0}finish(){return this.finishInner(ys.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=ys.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function TE(e,t,n){let s=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&s.set(i.chunk[o],i.chunkPos[o]);let r=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=s.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+i.chunk[o].length))&&r.add(i.chunk[o])}return r}class e${constructor(t,n,s,r=0){this.layer=t,this.skip=n,this.minPoint=s,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,n,!1),this}gotoInner(t,n,s){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<t||r.maxPoint<this.minPoint))break;this.chunkIndex++,s=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],n,!0);(!s||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(t,n){(this.to-t||this.endSide-n)<0&&this.gotoInner(t,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],s=t+n.from[this.rangeIndex];if(this.from=s,this.to=t+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}class xp{constructor(t){this.heap=t}static from(t,n=null,s=-1){let r=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=s&&r.push(new e$(o,n,s,i));return r.length==1?r[0]:new xp(r)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let s of this.heap)s.goto(t,n);for(let s=this.heap.length>>1;s>=0;s--)Gx(this.heap,s);return this.next(),this}forward(t,n){for(let s of this.heap)s.forward(t,n);for(let s=this.heap.length>>1;s>=0;s--)Gx(this.heap,s);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Gx(this.heap,0)}}}function Gx(e,t){for(let n=e[t];;){let s=(t<<1)+1;if(s>=e.length)break;let r=e[s];if(s+1<e.length&&r.compare(e[s+1])>=0&&(r=e[s+1],s++),n.compare(r)<0)break;e[s]=n,e[t]=r,t=s}}class Hm{constructor(t,n,s){this.minPoint=s,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=xp.from(t,n,s)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){y1(this.active,t),y1(this.activeTo,t),y1(this.activeRank,t),this.minActive=AE(this.active,this.activeTo)}addActive(t){let n=0,{value:s,to:r,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||r-this.activeTo[n])>0;)n++;b1(this.active,n,s),b1(this.activeTo,n,r),b1(this.activeRank,n,i),t&&b1(t,n,this.cursor.from),this.minActive=AE(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let s=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>t){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),s&&y1(s,r)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(s),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(s){this.openStart=0;for(let r=s.length-1;r>=0&&s[r]<t;r--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let s=this.active.length-1;s>=0&&!(this.activeRank[s]<this.pointRank);s--)(this.activeTo[s]>t||this.activeTo[s]==t&&this.active[s].endSide>=this.point.endSide)&&n.push(this.active[s]);return n.reverse()}openEnd(t){let n=0;for(let s=this.activeTo.length-1;s>=0&&this.activeTo[s]>t;s--)n++;return n}}function CE(e,t,n,s,r,i){e.goto(t),n.goto(s);let o=s+r,a=s,l=s-t,c=!!i.boundChange;for(let d=!1;;){let h=e.to+l-n.to,f=h||e.endSide-n.endSide,m=f<0?e.to+l:n.to,p=Math.min(m,o);if(e.point||n.point?(e.point&&n.point&&j6(e.point,n.point)&&ck(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,p,e.point,n.point),d=!1):(d&&i.boundChange(a),p>a&&!ck(e.active,n.active)&&i.compareRange(a,p,e.active,n.active),c&&p<o&&(h||e.openEnd(m)!=n.openEnd(m))&&(d=!0)),m>o)break;a=m,f<=0&&e.next(),f>=0&&n.next()}}function ck(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!j6(e[n],t[n]))return!1;return!0}function y1(e,t){for(let n=t,s=e.length-1;n<s;n++)e[n]=e[n+1];e.pop()}function b1(e,t,n){for(let s=e.length-1;s>=t;s--)e[s+1]=e[s];e[t]=n}function AE(e,t){let n=-1,s=1e9;for(let r=0;r<t.length;r++)(t[r]-s||e[r].endSide-e[n].endSide)<0&&(n=r,s=t[r]);return n}function cg(e,t,n=e.length){let s=0;for(let r=0;r<n&&r<e.length;)e.charCodeAt(r)==9?(s+=t-s%t,r++):(s++,r=vi(e,r));return s}function uve(e,t,n,s){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=vi(e,r)}return e.length}const uk="ͼ",EE=typeof Symbol>"u"?"__"+uk:Symbol.for(uk),dk=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ME=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ru{constructor(t,n){this.rules=[];let{finish:s}=n||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,c){let d=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let m in a){let p=a[m];if(/&/.test(m))i(m.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),p,l);else if(p&&typeof p=="object"){if(!h)throw new RangeError("The value of a property ("+m+") should be a primitive value.");i(r(m),p,d,f)}else p!=null&&d.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(d.length||f)&&l.push((s&&!h&&!c?o.map(s):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)i(r(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=ME[EE]||1;return ME[EE]=t+1,uk+t.toString(36)}static mount(t,n,s){let r=t[dk],i=s&&s.nonce;r?i&&r.setNonce(i):r=new dve(t,i),r.mount(Array.isArray(n)?n:[n],t)}}let NE=new Map;class dve{constructor(t,n){let s=t.ownerDocument||t,r=s.defaultView;if(!t.head&&t.adoptedStyleSheets&&r.CSSStyleSheet){let i=NE.get(s);if(i)return t[dk]=i;this.sheet=new r.CSSStyleSheet,NE.set(s,this)}else this.styleTag=s.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[dk]=this}mount(t,n){let s=this.sheet,r=0,i=0;for(let o=0;o<t.length;o++){let a=t[o],l=this.modules.indexOf(a);if(l<i&&l>-1&&(this.modules.splice(l,1),i--,l=-1),l==-1){if(this.modules.splice(i++,0,a),s)for(let c=0;c<a.rules.length;c++)s.insertRule(a.rules[c],r++)}else{for(;i<l;)r+=this.modules[i++].rules.length;r+=a.rules.length,i++}}if(s)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
`;this.styleTag.textContent=o;let a=n.head||n;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}var Lu={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},_p={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hve=typeof navigator<"u"&&/Mac/.test(navigator.platform),fve=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ni=0;ni<10;ni++)Lu[48+ni]=Lu[96+ni]=String(ni);for(var ni=1;ni<=24;ni++)Lu[ni+111]="F"+ni;for(var ni=65;ni<=90;ni++)Lu[ni]=String.fromCharCode(ni+32),_p[ni]=String.fromCharCode(ni);for(var Kx in Lu)_p.hasOwnProperty(Kx)||(_p[Kx]=Lu[Kx]);function mve(e){var t=hve&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||fve&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?_p:Lu)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}let Di=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},hk=typeof document<"u"?document:{documentElement:{style:{}}};const fk=/Edge\/(\d+)/.exec(Di.userAgent),t$=/MSIE \d/.test(Di.userAgent),mk=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Di.userAgent),lw=!!(t$||mk||fk),IE=!lw&&/gecko\/(\d+)/i.test(Di.userAgent),Yx=!lw&&/Chrome\/(\d+)/.exec(Di.userAgent),jE="webkitFontSmoothing"in hk.documentElement.style,pk=!lw&&/Apple Computer/.test(Di.vendor),RE=pk&&(/Mobile\/\w+/.test(Di.userAgent)||Di.maxTouchPoints>2);var St={mac:RE||/Mac/.test(Di.platform),windows:/Win/.test(Di.platform),linux:/Linux|X11/.test(Di.platform),ie:lw,ie_version:t$?hk.documentMode||6:mk?+mk[1]:fk?+fk[1]:0,gecko:IE,gecko_version:IE?+(/Firefox\/(\d+)/.exec(Di.userAgent)||[0,0])[1]:0,chrome:!!Yx,chrome_version:Yx?+Yx[1]:0,ios:RE,android:/Android\b/.test(Di.userAgent),webkit:jE,webkit_version:jE?+(/\bAppleWebKit\/(\d+)/.exec(Di.userAgent)||[0,0])[1]:0,safari:pk,safari_version:pk?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Di.userAgent)||[0,0])[1]:0,tabSize:hk.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function L6(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const $b=Object.create(null);function D6(e,t,n){if(e==t)return!0;e||(e=$b),t||(t=$b);let s=Object.keys(e),r=Object.keys(t);if(s.length-0!=r.length-0)return!1;for(let i of s)if(i!=n&&(r.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function pve(e,t){for(let n=e.attributes.length-1;n>=0;n--){let s=e.attributes[n].name;t[s]==null&&e.removeAttribute(s)}for(let n in t){let s=t[n];n=="style"?e.style.cssText=s:e.getAttribute(n)!=s&&e.setAttribute(n,s)}}function LE(e,t,n){let s=!1;if(t)for(let r in t)n&&r in n||(s=!0,r=="style"?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(s=!0,r=="style"?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return s}function gve(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let s=e.attributes[n];t[s.name]=s.value}return t}class Al{eq(t){return!1}updateDOM(t,n,s){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,n,s){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var qi=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(qi||(qi={}));class qn extends ju{constructor(t,n,s,r){super(),this.startSide=t,this.endSide=n,this.widget=s,this.spec=r}get heightRelevant(){return!1}static mark(t){return new ug(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),s=!!t.block;return n+=s&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Gd(t,n,n,s,t.widget||null,!1)}static replace(t){let n=!!t.block,s,r;if(t.isBlockGap)s=-5e8,r=4e8;else{let{start:i,end:o}=n$(t,n);s=(i?n?-3e8:-1:5e8)-1,r=(o?n?2e8:1:-6e8)+1}return new Gd(t,s,r,n,t.widget||null,!0)}static line(t){return new dg(t)}static set(t,n=!1){return ys.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}qn.none=ys.empty;class ug extends qn{constructor(t){let{start:n,end:s}=n$(t);super(n?-1:5e8,s?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?L6(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||$b}eq(t){return this==t||t instanceof ug&&this.tagName==t.tagName&&D6(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}ug.prototype.point=!1;class dg extends qn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof dg&&this.spec.class==t.spec.class&&D6(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}dg.prototype.mapMode=xo.TrackBefore;dg.prototype.point=!0;class Gd extends qn{constructor(t,n,s,r,i,o){super(n,s,i,t),this.block=r,this.isReplace=o,this.mapMode=r?n<=0?xo.TrackBefore:xo.TrackAfter:xo.TrackDel}get type(){return this.startSide!=this.endSide?qi.WidgetRange:this.startSide<=0?qi.WidgetBefore:qi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Gd&&yve(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}Gd.prototype.point=!0;function n$(e,t=!1){let{inclusiveStart:n,inclusiveEnd:s}=e;return n==null&&(n=e.inclusive),s==null&&(s=e.inclusive),{start:n??t,end:s??t}}function yve(e,t){return e==t||!!(e&&t&&e.compare(t))}function bf(e,t,n,s=0){let r=n.length-1;r>=0&&n[r]+s>=e?n[r]=Math.max(n[r],t):n.push(e,t)}class kp extends ju{constructor(t,n,s){super(),this.tagName=t,this.attributes=n,this.rank=s}eq(t){return t==this||t instanceof kp&&this.tagName==t.tagName&&D6(this.attributes,t.attributes)}static create(t){return new kp(t.tagName,t.attributes||$b,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return ys.of(t,n)}}kp.prototype.startSide=kp.prototype.endSide=-1;function Sp(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function gk(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function H0(e,t){if(!t.anchorNode)return!1;try{return gk(e,t.anchorNode)}catch{return!1}}function U0(e){return e.nodeType==3?Cp(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function V0(e,t,n,s){return n?DE(e,t,n,s,-1)||DE(e,t,n,s,1):!1}function Du(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function zb(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function DE(e,t,n,s,r){for(;;){if(e==n&&t==s)return!0;if(t==(r<0?0:gc(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Du(e)+(r<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(r<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=r<0?gc(e):0}else return!1}}function gc(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Tp(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function bve(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function s$(e,t){let n=t.width/e.offsetWidth,s=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(t.height-e.offsetHeight)<1)&&(s=1),{scaleX:n,scaleY:s}}function vve(e,t,n,s,r,i,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let d=e,h=!1;d&&!h;)if(d.nodeType==1){let f,m=d==l.body,p=1,y=1;if(m)f=bve(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(h=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let v=d.getBoundingClientRect();({scaleX:p,scaleY:y}=s$(d,v)),f={left:v.left,right:v.left+d.clientWidth*p,top:v.top,bottom:v.top+d.clientHeight*y}}let w=0,b=0;if(r=="nearest")t.top<f.top+o?(b=t.top-(f.top+o),n>0&&t.bottom>f.bottom+b&&(b=t.bottom-f.bottom+o)):t.bottom>f.bottom-o&&(b=t.bottom-f.bottom+o,n<0&&t.top-b<f.top&&(b=t.top-(f.top+o)));else{let v=t.bottom-t.top,x=f.bottom-f.top;b=(r=="center"&&v<=x?t.top+v/2-x/2:r=="start"||r=="center"&&n<0?t.top-o:t.bottom-x+o)-f.top}if(s=="nearest"?t.left<f.left+i?(w=t.left-(f.left+i),n>0&&t.right>f.right+w&&(w=t.right-f.right+i)):t.right>f.right-i&&(w=t.right-f.right+i,n<0&&t.left<f.left+w&&(w=t.left-(f.left+i))):w=(s=="center"?t.left+(t.right-t.left)/2-(f.right-f.left)/2:s=="start"==a?t.left-i:t.right-(f.right-f.left)+i)-f.left,w||b)if(m)c.scrollBy(w,b);else{let v=0,x=0;if(b){let _=d.scrollTop;d.scrollTop+=b/y,x=(d.scrollTop-_)*y}if(w){let _=d.scrollLeft;d.scrollLeft+=w/p,v=(d.scrollLeft-_)*p}t={left:t.left-v,top:t.top-x,right:t.right-v,bottom:t.bottom-x},v&&Math.abs(v-w)<1&&(s="nearest"),x&&Math.abs(x-b)<1&&(r="nearest")}if(m)break;(t.top<f.top||t.bottom>f.bottom||t.left<f.left||t.right>f.right)&&(t={left:Math.max(t.left,f.left),right:Math.min(t.right,f.right),top:Math.max(t.top,f.top),bottom:Math.min(t.bottom,f.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function r$(e,t=!0){let n=e.ownerDocument,s=null,r=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||s)&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),t&&!s&&i.scrollWidth>i.clientWidth&&(s=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:s,y:r}}class wve{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:s}=t;this.set(n,Math.min(t.anchorOffset,n?gc(n):0),s,Math.min(t.focusOffset,s?gc(s):0))}set(t,n,s,r){this.anchorNode=t,this.anchorOffset=n,this.focusNode=s,this.focusOffset=r}}let dd=null;St.safari&&St.safari_version>=26&&(dd=!1);function i$(e){if(e.setActive)return e.setActive();if(dd)return e.focus(dd);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(dd==null?{get preventScroll(){return dd={preventScroll:!0},!0}}:void 0),!dd){dd=!1;for(let n=0;n<t.length;){let s=t[n++],r=t[n++],i=t[n++];s.scrollTop!=r&&(s.scrollTop=r),s.scrollLeft!=i&&(s.scrollLeft=i)}}}let OE;function Cp(e,t,n=t){let s=OE||(OE=document.createRange());return s.setEnd(e,n),s.setStart(e,t),s}function vf(e,t,n,s){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};s&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=s);let i=new KeyboardEvent("keydown",r);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function xve(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function _ve(e,t){let n=t.focusNode,s=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=s)return!1;for(s=Math.min(s,gc(n));;)if(s){if(n.nodeType!=1)return!1;let r=n.childNodes[s-1];r.contentEditable=="false"?s--:(n=r,s=gc(n))}else{if(n==e)return!0;s=Du(n),n=n.parentNode}}function o$(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function a$(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s>0)return{node:n,offset:s};if(n.nodeType==1&&s>0){if(n.contentEditable=="false")return null;n=n.childNodes[s-1],s=gc(n)}else if(n.parentNode&&!zb(n))s=Du(n),n=n.parentNode;else return null}}function l$(e,t){for(let n=e,s=t;;){if(n.nodeType==3&&s<n.nodeValue.length)return{node:n,offset:s};if(n.nodeType==1&&s<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[s],s=0}else if(n.parentNode&&!zb(n))s=Du(n)+1,n=n.parentNode;else return null}}class Ta{constructor(t,n,s=!0){this.node=t,this.offset=n,this.precise=s}static before(t,n){return new Ta(t.parentNode,Du(t),n)}static after(t,n){return new Ta(t.parentNode,Du(t)+1,n)}}var qs=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(qs||(qs={}));const Kd=qs.LTR,O6=qs.RTL;function c$(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const kve=c$("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Sve=c$("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),yk=Object.create(null),Va=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);yk[t]=n,yk[n]=-t}function u$(e){return e<=247?kve[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Sve[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const Tve=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class cl{get dir(){return this.level%2?O6:Kd}constructor(t,n,s){this.from=t,this.to=n,this.level=s}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,s,r){let i=-1;for(let o=0;o<t.length;o++){let a=t[o];if(a.from<=n&&a.to>=n){if(a.level==s)return o;(i<0||(r!=0?r<0?a.from<n:a.to>n:t[i].level>a.level))&&(i=o)}}if(i<0)throw new RangeError("Index out of range");return i}}function d$(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.from!=r.from||s.to!=r.to||s.direction!=r.direction||!d$(s.inner,r.inner))return!1}return!0}const As=[];function Cve(e,t,n,s,r){for(let i=0;i<=s.length;i++){let o=i?s[i-1].to:t,a=i<s.length?s[i].from:n,l=i?256:r;for(let c=o,d=l,h=l;c<a;c++){let f=u$(e.charCodeAt(c));f==512?f=d:f==8&&h==4&&(f=16),As[c]=f==4?2:f,f&7&&(h=f),d=f}for(let c=o,d=l,h=l;c<a;c++){let f=As[c];if(f==128)c<a-1&&d==As[c+1]&&d&24?f=As[c]=d:As[c]=256;else if(f==64){let m=c+1;for(;m<a&&As[m]==64;)m++;let p=c&&d==8||m<n&&As[m]==8?h==1?1:8:256;for(let y=c;y<m;y++)As[y]=p;c=m-1}else f==8&&h==1&&(As[c]=1);d=f,f&7&&(h=f)}}}function Ave(e,t,n,s,r){let i=r==1?2:1;for(let o=0,a=0,l=0;o<=s.length;o++){let c=o?s[o-1].to:t,d=o<s.length?s[o].from:n;for(let h=c,f,m,p;h<d;h++)if(m=yk[f=e.charCodeAt(h)])if(m<0){for(let y=a-3;y>=0;y-=3)if(Va[y+1]==-m){let w=Va[y+2],b=w&2?r:w&4?w&1?i:r:0;b&&(As[h]=As[Va[y]]=b),a=y;break}}else{if(Va.length==189)break;Va[a++]=h,Va[a++]=f,Va[a++]=l}else if((p=As[h])==2||p==1){let y=p==r;l=y?0:1;for(let w=a-3;w>=0;w-=3){let b=Va[w+2];if(b&2)break;if(y)Va[w+2]|=2;else{if(b&4)break;Va[w+2]|=4}}}}}function Eve(e,t,n,s){for(let r=0,i=s;r<=n.length;r++){let o=r?n[r-1].to:e,a=r<n.length?n[r].from:t;for(let l=o;l<a;){let c=As[l];if(c==256){let d=l+1;for(;;)if(d==a){if(r==n.length)break;d=n[r++].to,a=r<n.length?n[r].from:t}else if(As[d]==256)d++;else break;let h=i==1,f=(d<t?As[d]:s)==1,m=h==f?h?1:2:s;for(let p=d,y=r,w=y?n[y-1].to:e;p>l;)p==w&&(p=n[--y].from,w=y?n[y-1].to:e),As[--p]=m;l=d}else i=c,l++}}}function bk(e,t,n,s,r,i,o){let a=s%2?2:1;if(s%2==r%2)for(let l=t,c=0;l<n;){let d=!0,h=!1;if(c==i.length||l<i[c].from){let y=As[l];y!=a&&(d=!1,h=y==16)}let f=!d&&a==1?[]:null,m=d?s:s+1,p=l;e:for(;;)if(c<i.length&&p==i[c].from){if(h)break e;let y=i[c];if(!d)for(let w=y.to,b=c+1;;){if(w==n)break e;if(b<i.length&&i[b].from==w)w=i[b++].to;else{if(As[w]==a)break e;break}}if(c++,f)f.push(y);else{y.from>l&&o.push(new cl(l,y.from,m));let w=y.direction==Kd!=!(m%2);vk(e,w?s+1:s,r,y.inner,y.from,y.to,o),l=y.to}p=y.to}else{if(p==n||(d?As[p]!=a:As[p]==a))break;p++}f?bk(e,l,p,s+1,r,f,o):l<p&&o.push(new cl(l,p,m)),l=p}else for(let l=n,c=i.length;l>t;){let d=!0,h=!1;if(!c||l>i[c-1].to){let y=As[l-1];y!=a&&(d=!1,h=y==16)}let f=!d&&a==1?[]:null,m=d?s:s+1,p=l;e:for(;;)if(c&&p==i[c-1].to){if(h)break e;let y=i[--c];if(!d)for(let w=y.from,b=c;;){if(w==t)break e;if(b&&i[b-1].to==w)w=i[--b].from;else{if(As[w-1]==a)break e;break}}if(f)f.push(y);else{y.to<l&&o.push(new cl(y.to,l,m));let w=y.direction==Kd!=!(m%2);vk(e,w?s+1:s,r,y.inner,y.from,y.to,o),l=y.from}p=y.from}else{if(p==t||(d?As[p-1]!=a:As[p-1]==a))break;p--}f?bk(e,p,l,s+1,r,f,o):p<l&&o.push(new cl(p,l,m)),l=p}}function vk(e,t,n,s,r,i,o){let a=t%2?2:1;Cve(e,r,i,s,a),Ave(e,r,i,s,a),Eve(r,i,s,a),bk(e,r,i,t,n,s,o)}function Mve(e,t,n){if(!e)return[new cl(0,0,t==O6?1:0)];if(t==Kd&&!n.length&&!Tve.test(e))return h$(e.length);if(n.length)for(;e.length>As.length;)As[As.length]=256;let s=[],r=t==Kd?0:1;return vk(e,r,r,n,0,e.length,s),s}function h$(e){return[new cl(0,e,0)]}let f$="";function Nve(e,t,n,s,r){var i;let o=s.head-e.from,a=cl.find(t,o,(i=s.bidiLevel)!==null&&i!==void 0?i:-1,s.assoc),l=t[a],c=l.side(r,n);if(o==c){let f=a+=r?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],o=l.side(!r,n),c=l.side(r,n)}let d=vi(e.text,o,l.forward(r,n));(d<l.from||d>l.to)&&(d=c),f$=e.text.slice(Math.min(o,d),Math.max(o,d));let h=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return h&&d==c&&h.level+(r?0:1)<l.level?Ve.cursor(h.side(!r,n)+e.from,h.forward(r,n)?1:-1,h.level):Ve.cursor(d+e.from,l.forward(r,n)?-1:1,l.level)}function Ive(e,t,n){for(let s=t;s<n;s++){let r=u$(e.charCodeAt(s));if(r==1)return Kd;if(r==2||r==4)return O6}return Kd}const m$=Gt.define(),p$=Gt.define(),g$=Gt.define(),y$=Gt.define(),wk=Gt.define(),b$=Gt.define(),v$=Gt.define(),B6=Gt.define(),P6=Gt.define(),w$=Gt.define({combine:e=>e.some(t=>t)}),x$=Gt.define({combine:e=>e.some(t=>t)}),_$=Gt.define();class wf{constructor(t,n,s,r,i,o=!1){this.range=t,this.y=n,this.x=s,this.yMargin=r,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new wf(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new wf(Ve.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const v1=_s.define({map:(e,t)=>e.map(t)}),k$=_s.define();function So(e,t,n){let s=e.facet(y$);s.length?s[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Wl=Gt.define({combine:e=>e.length?e[0]:!0});let jve=0;const Zh=Gt.define({combine(e){return e.filter((t,n)=>{for(let s=0;s<n;s++)if(e[s].plugin==t.plugin)return!1;return!0})}});class lo{constructor(t,n,s,r,i){this.id=t,this.create=n,this.domEventHandlers=s,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Zh.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Zh.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:s,eventObservers:r,provide:i,decorations:o}=n||{};return new lo(jve++,t,s,r,a=>{let l=[];return o&&l.push(cw.of(c=>{let d=c.plugin(a);return d?o(d):qn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return lo.define((s,r)=>new t(s,r),n)}}class Qx{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(s){if(So(n.state,s,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){So(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(s){So(t.state,s,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const S$=Gt.define(),$6=Gt.define(),cw=Gt.define(),T$=Gt.define(),z6=Gt.define(),hg=Gt.define(),C$=Gt.define();function BE(e,t){let n=e.state.facet(C$);if(!n.length)return n;let s=n.map(i=>i instanceof Function?i(e):i),r=[];return ys.spans(s,t.from,t.to,{point(){},span(i,o,a,l){let c=i-t.from,d=o-t.from,h=r;for(let f=a.length-1;f>=0;f--,l--){let m=a[f].spec.bidiIsolate,p;if(m==null&&(m=Ive(t.text,c,d)),l>0&&h.length&&(p=h[h.length-1]).to==c&&p.direction==m)p.to=d,h=p.inner;else{let y={from:c,to:d,direction:m,inner:[]};h.push(y),h=y.inner}}}}),r}const A$=Gt.define();function F6(e){let t=0,n=0,s=0,r=0;for(let i of e.state.facet(A$)){let o=i(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(s=Math.max(s,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:s,bottom:r}}const o0=Gt.define();class ta{constructor(t,n,s,r){this.fromA=t,this.toA=n,this.fromB=s,this.toB=r}join(t){return new ta(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,s=this;for(;n>0;n--){let r=t[n-1];if(!(r.fromA>s.toA)){if(r.toA<s.fromA)break;s=s.join(r),t.splice(n-1,1)}}return t.splice(n,0,s),t}static extendWithRanges(t,n){if(n.length==0)return t;let s=[];for(let r=0,i=0,o=0;;){let a=r<t.length?t[r].fromB:1e9,l=i<n.length?n[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let d=c+o,h=c,f=d;for(;;)if(i<n.length&&n[i]<=h){let m=n[i+1];i+=2,h=Math.max(h,m);for(let p=r;p<t.length&&t[p].fromB<=h;p++)o=t[p].toA-t[p].toB;f=Math.max(f,m+o)}else if(r<t.length&&t[r].fromB<=h){let m=t[r++];h=Math.max(h,m.toB),f=Math.max(f,m.toA),o=m.toA-m.toB}else break;s.push(new ta(d,f,c,h))}return s}}class Fb{constructor(t,n,s){this.view=t,this.state=n,this.transactions=s,this.flags=0,this.startState=t.state,this.changes=Rr.empty(this.startState.doc.length);for(let i of s)this.changes=this.changes.compose(i.changes);let r=[];this.changes.iterChangedRanges((i,o,a,l)=>r.push(new ta(i,o,a,l))),this.changedRanges=r}static create(t,n,s){return new Fb(t,n,s)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Rve=[];class cr{constructor(t,n,s=0){this.dom=t,this.length=n,this.flags=s,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Rve}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&pve(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let s=n;for(let r of this.children){if(r==t)return s;s+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n){return null}domPosFor(t,n){let s=Du(this.dom),r=this.length?t>0:n>0;return new Ta(this.parent.dom,s+(r?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof dw)return t;return null}static get(t){return t.cmTile}}class uw extends cr{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,s=null,r,i=(t==null?void 0:t.node)==n?t:null,o=0;for(let a of this.children){if(a.sync(t),o+=a.length+a.breakAfter,r=s?s.nextSibling:n.firstChild,i&&r!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;r&&r!=a.dom;)r=PE(r);else n.insertBefore(a.dom,r);s=a.dom}for(r=s?s.nextSibling:n.firstChild,i&&r&&(i.written=!0);r;)r=PE(r);this.length=o}}function PE(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class dw extends uw{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=cr.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],s=this,r=0,i=0;;)if(r==s.children.length){if(!n.length)return;s=s.parent,s.breakAfter&&i++,r=n.pop()}else{let o=s.children[r++];if(o instanceof ic)n.push(r),s=o,r=0;else{let a=i+o.length,l=t(o,i);if(l!==void 0)return l;i=a+o.breakAfter}}}resolveBlock(t,n){let s,r=-1,i,o=-1;if(this.blockTiles((a,l)=>{let c=l+a.length;if(t>=l&&t<=c){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(s=void 0)}(l<t||t==c&&(n<-1?a.length:a.covers(1)))&&(!s||!a.isWidget()&&s.isWidget())&&(s=a,r=t-l),(c>t||t==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-l)}}),!s&&!i)throw new Error("No tile at position "+t);return s&&n<0||!i?{tile:s,offset:r}:{tile:i,offset:o}}}class ic extends uw{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let s=new ic(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class qf extends uw{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,s){let r=new qf(n||document.createElement("div"),t);return(!n||!s)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(t,n,s){let r=null,i=-1,o=null,a=-1;function l(d,h){for(let f=0,m=0;f<d.children.length&&m<=h;f++){let p=d.children[f],y=m+p.length;y>=h&&(p.isComposite()?l(p,h-m):(!o||o.isHidden&&(n>0||s&&Dve(o,p)))&&(y>h||p.flags&32)?(o=p,a=h-m):(m<h||p.flags&16&&!p.isHidden)&&(r=p,i=h-m)),m=y}}l(this,t);let c=(n<0?r:o)||r||o;return c?{tile:c,offset:c==r?i:a}:null}coordsIn(t,n){let s=this.resolveInline(t,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n):Lve(this)}domIn(t,n){let s=this.resolveInline(t,n);if(s){let{tile:r,offset:i}=s;if(this.dom.contains(r.dom))return r.isText()?new Ta(r.dom,Math.min(r.dom.nodeValue.length,i)):r.domPosFor(i,r.flags&16?1:r.flags&32?-1:n);let o=s.tile.parent,a=!1;for(let l of o.children){if(a)return new Ta(l.dom,0);l==s.tile&&(a=!0)}}return new Ta(this.dom,0)}}function Lve(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=U0(t);return n[n.length-1]||null}function Dve(e,t){let n=e.coordsIn(0,1),s=t.coordsIn(0,1);return n&&s&&s.top<n.bottom}class ro extends uw{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let s=new ro(n||document.createElement(t.tagName),t);return n||(s.flags|=4),s}}class Td extends cr{constructor(t,n){super(t,n.length),this.text=n}sync(t){this.flags&2||(super.sync(t),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(t,n){let s=this.dom.nodeValue.length;t>s&&(t=s);let r=t,i=t,o=0;t==0&&n<0||t==s&&n>=0?St.chrome||St.gecko||(t?(r--,o=1):i<s&&(i++,o=-1)):n<0?r--:i<s&&i++;let a=Cp(this.dom,r,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return St.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Tp(l,o<0):l||null}static of(t,n){let s=new Td(n||document.createTextNode(t),t);return n||(s.flags|=2),s}}class Yd extends cr{constructor(t,n,s,r){super(t,n,r),this.widget=s}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,s){let r=this.widget.coordsAt(this.dom,t,n);if(r)return r;if(s)return Tp(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let a=this.flags&16?!0:this.flags&32?!1:t>0;for(let l=a?i.length-1:0;o=i[l],!(t>0?l==0:l==i.length-1||o.top<o.bottom);l+=a?-1:1);return Tp(o,!a)}}get overrideDOMText(){if(!this.length)return Qn.empty;let{root:t}=this;if(!t)return Qn.empty;let n=this.posAtStart;return t.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,s,r,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new Yd(i,s,t,r)}}class qb extends cr{constructor(t){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,t)}get isHidden(){return!0}get overrideDOMText(){return Qn.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class Ove{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,s){let{tile:r,index:i,beforeBreak:o,parents:a}=this;for(;t||n>0;)if(r.isComposite())if(o){if(!t)break;s&&s.break(),t--,o=!1}else if(i==r.children.length){if(!t&&!a.length)break;s&&s.leave(r),o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++}else{let l=r.children[i],c=l.breakAfter;(n>0?l.length<=t:l.length<t)&&(!s||s.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,i++,t-=l.length):(a.push({tile:r,index:i}),r=l,i=0,s&&l.isComposite()&&s.enter(l))}else if(i==r.length)o=!!r.breakAfter,{tile:r,index:i}=a.pop(),i++;else if(t){let l=Math.min(t,r.length-i);s&&s.skip(r,i,i+l),t-=l,i+=l}else break;return this.tile=r,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class Bve{constructor(t,n,s,r){this.from=t,this.to=n,this.wrapper=s,this.rank=r}}class Pve{constructor(t,n,s){this.cache=t,this.root=n,this.blockWrappers=s,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,s,r){var i;this.flushBuffer();let o=this.ensureMarks(n,s),a=o.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+t.length<512){this.cache.reused.set(a,2);let l=o.children[o.children.length-1]=new Td(a.dom,a.text+t);l.parent=o}else o.append(r||Td.of(t,(i=this.cache.find(Td))===null||i===void 0?void 0:i.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let s=this.curLine;s.dom!=n.line.dom&&(s.setDOM(this.cache.reused.has(n.line)?Xx(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let r=s;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=r.lastChild;if(c instanceof ro&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(Xx(l.dom)),r=c;else{if(this.cache.reused.get(l)){let h=cr.get(l.dom);h&&h.setDOM(Xx(l.dom))}let d=ro.of(l.mark,l.dom);r.append(d),r=d}this.cache.reused.set(l,2)}let i=cr.get(t.text);i&&this.cache.reused.set(i,2);let o=new Td(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,r.append(o)}addInlineWidget(t,n,s){let r=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);r||this.flushBuffer();let i=this.ensureMarks(n,s);!r&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,s){this.flushBuffer(),this.ensureMarks(n,s).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var s;t||(t=E$);let r=qf.start(t,n||((s=this.cache.find(qf))===null||s===void 0?void 0:s.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var s;let r=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],a;if(n>0&&(a=r.lastChild)&&a instanceof ro&&a.mark.eq(o))r=a,n--;else{let l=ro.of(o,(s=this.cache.find(ro,c=>c.mark.eq(o)))===null||s===void 0?void 0:s.dom);r.append(l),r=l,n=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!$E(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(St.ios&&$E(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Jx,0,32)||new Yd(Jx.toDOM(),0,Jx,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to<this.pos&&this.wrappers.splice(t,1);for(let t=this.blockWrappers;t.value&&t.from<=this.pos;t.next())if(t.to>=this.pos){let n=t.rank*102+t.value.rank,s=new Bve(t.from,t.to,t.value,n),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-s.rank||this.wrappers[r-1].to-s.to)<0;)r--;this.wrappers.splice(r,0,s)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let s of this.wrappers){let r=n.lastChild;if(s.from<this.pos&&r instanceof ic&&r.wrapper.eq(s.wrapper))n=r;else{let i=ic.of(s.wrapper,(t=this.cache.find(ic,o=>o.wrapper.eq(s.wrapper)))===null||t===void 0?void 0:t.dom);n.append(i),n=i}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),s=this.cache.find(qb,void 0,1);return s&&(s.flags=n),s||new qb(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class $ve{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:r,lineBreak:i,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let a=this.textOff=Math.min(t,r.length);return i?null:r.slice(0,a)}let n=Math.min(this.text.length,this.textOff+t),s=this.text.slice(this.textOff,n);return this.textOff=n,s}}const Hb=[Yd,qf,Td,ro,qb,ic,dw];for(let e=0;e<Hb.length;e++)Hb[e].bucket=e;class zve{constructor(t){this.view=t,this.buckets=Hb.map(()=>[]),this.index=Hb.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,s=this.buckets[n];s.length<6?s.push(t):s[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,s=2){let r=t.bucket,i=this.buckets[r],o=this.index[r];for(let a=i.length-1;a>=0;a--){let l=(a+o)%i.length,c=i[l];if((!n||n(c))&&!this.reused.has(c))return i.splice(l,1),l<o&&this.index[r]--,this.reused.set(c,s),c}return null}findWidget(t,n,s){let r=this.buckets[0];if(r.length)for(let i=0,o=0;;i++){if(i==r.length){if(o)return null;o=1,i=0}let a=r[i];if(!this.reused.has(a)&&(o==0?a.widget.compare(t):a.widget.constructor==t.constructor&&t.updateDOM(a.dom,this.view,a.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==t&&a.length==n&&(a.flags&497)==s?(this.reused.set(a,1),a):(this.reused.set(a,2),new Yd(a.dom,n,t,a.flags&-498|s))}}reuse(t){return this.reused.set(t,1),t}maybeReuse(t,n=2){if(!this.reused.has(t))return this.reused.set(t,n),t.dom}clear(){for(let t=0;t<this.buckets.length;t++)this.buckets[t].length=this.index[t]=0}}class Fve{constructor(t,n,s,r,i){this.view=t,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new zve(t),this.text=new $ve(t.state.doc),this.builder=new Pve(this.cache,new dw(t,t.contentDOM),ys.iter(s)),this.cache.reused.set(n,2),this.old=new Ove(n),this.reuseWalker={skip:(o,a,l)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(t,n){let s=n&&this.getCompositionContext(n.text);for(let r=0,i=0,o=0;;){let a=o<t.length?t[o++]:null,l=a?a.fromA:this.old.root.length;if(l>r){let c=l-r;this.preserve(c,!o,!a),r=l,i+=c}if(!a)break;n&&a.fromA<=n.range.fromA&&a.toA>=n.range.toA?(this.forward(a.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(i,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,s),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,a.toA),this.emit(n.range.toB,a.toB)):(this.forward(a.fromA,a.toA),this.emit(i,a.toB)),i=a.toB,r=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,s){let r=Uve(this.old),i=this.openMarks;this.old.advance(t,s?1:-1,{skip:(o,a,l)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(l-a);else{let c=l>0||a<o.length?Yd.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);c.flags&256?(c.flags&=-2,this.builder.addBlockWidget(c)):(this.builder.ensureLine(null),this.builder.addInlineWidget(c,r,i),i=r.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,r,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),r,i)),i=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof qb)this.cache.add(o);else if(o instanceof ro)this.builder.ensureLine(null),this.builder.addMark(o,r,i),this.cache.reused.set(o,1),i=r.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof ro&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=i=0):o instanceof ro&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let s=null,r=this.builder,i=0,o=ys.spans(this.decorations,t,n,{point:(a,l,c,d,h,f)=>{if(c instanceof Gd){if(this.disallowBlockEffectsFor[f]){if(c.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=d.length,h>d.length)r.continueWidget(l-a);else{let m=c.widget||(c.block?Hf.block:Hf.inline),p=qve(c),y=this.cache.findWidget(m,l-a,p)||Yd.of(m,this.view,l-a,p);c.block?(c.startSide>0&&r.addLineStartIfNotCovered(s),r.addBlockWidget(y)):(r.ensureLine(s),r.addInlineWidget(y,d,h))}s=null}else s=Hve(s,c);l>a&&this.text.skip(l-a)},span:(a,l,c,d)=>{for(let h=a;h<l;){let f=this.text.next(Math.min(512,l-h));f==null?(r.addLineStartIfNotCovered(s),r.addBreak(),h++):(r.ensureLine(s),r.addText(f,c,h==a?d:c.length),h+=f.length),s=null}}});r.addLineStartIfNotCovered(s),this.openWidget=o>i,this.openMarks=o}forward(t,n,s=1){n-t<=10?this.old.advance(n-t,s,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,s,this.reuseWalker))}getCompositionContext(t){let n=[],s=null;for(let r=t.parentNode;;r=r.parentNode){let i=cr.get(r);if(r==this.view.contentDOM)break;i instanceof ro?n.push(i):i!=null&&i.isLine()?s=i:i instanceof ic||(r.nodeName=="DIV"&&!s&&r!=this.view.contentDOM?s=new qf(r,E$):s||n.push(ro.of(new ug({tagName:r.nodeName.toLowerCase(),attributes:gve(r)}),r)))}return{line:s,marks:n}}}function $E(e,t){let n=s=>{for(let r of s.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function qve(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const E$={class:"cm-line"};function Hve(e,t){let n=t.spec.attributes,s=t.spec.class;return!n&&!s||(e||(e={class:"cm-line"}),n&&L6(n,e),s&&(e.class+=" "+s)),e}function Uve(e){let t=[];for(let n=e.parents.length;n>1;n--){let s=n==e.parents.length?e.tile:e.parents[n].tile;s instanceof ro&&t.push(s.mark)}return t}function Xx(e){let t=cr.get(e);return t&&t.setDOM(e.cloneNode()),e}class Hf extends Al{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Hf.inline=new Hf("span");Hf.block=new Hf("div");const Jx=new class extends Al{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class zE{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=qn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new dw(t,t.contentDOM),this.updateInner([new ta(0,0,0,t.state.doc.length)],null)}update(t){var n;let s=t.changedRanges;this.minWidth>0&&s.length&&(s.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?r=this.domChanged.newSel.head:!Zve(t.changes,this.hasComposition)&&!t.selectionSet&&(r=t.state.selection.main.head));let i=r>-1?Wve(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;s=new ta(d,h,t.changes.mapPos(d,-1),t.changes.mapPos(h,1)).addToSet(s.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(St.ie||St.chrome)&&!i&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.blockWrappers;this.updateDeco();let l=Yve(o,this.decorations,t.changes);l.length&&(s=ta.extendWithRanges(s,l));let c=Xve(a,this.blockWrappers,t.changes);return c.length&&(s=ta.extendWithRanges(s,c)),i&&!s.some(d=>d.fromA<=i.range.fromA&&d.toA>=i.range.toA)&&(s=i.range.addToSet(s.slice())),this.tile.flags&2&&s.length==0?!1:(this.updateInner(s,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:s}=this.view;s.ignore(()=>{if(n||t.length){let o=this.tile,a=new Fve(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&cr.get(n.text)&&a.cache.reused.set(cr.get(n.text),2),this.tile=a.run(t,n),xk(o,a.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=St.chrome||St.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||s.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let i of this.tile.children)i.isWidget()&&i.widget instanceof Zx&&r.push(i.dom);s.updateGaps(r)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let s of n.effects)s.is(k$)&&(this.editContextFormatting=s.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:s}=this.tile,r=this.view.root.activeElement,i=r==s,o=!i&&!(this.view.state.facet(Wl)||s.tabIndex>-1)&&H0(s,this.view.observer.selectionRange)&&!(r&&s.contains(r));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,d;if(l.empty?d=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(d=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),St.gecko&&l.empty&&!this.hasComposition&&Vve(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=d=new Ta(f,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!V0(c.node,c.offset,h.anchorNode,h.anchorOffset)||!V0(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{St.android&&St.chrome&&s.contains(h.focusNode)&&Jve(h.focusNode,s)&&(s.blur(),s.focus({preventScroll:!0}));let f=Sp(this.view.root);if(f)if(l.empty){if(St.gecko){let m=Gve(c.node,c.offset);if(m&&m!=3){let p=(m==1?a$:l$)(c.node,c.offset);p&&(c=new Ta(p.node,p.offset))}}f.collapse(c.node,c.offset),l.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(c.node,c.offset);try{f.extend(d.node,d.offset)}catch{}}else{let m=document.createRange();l.anchor>l.head&&([c,d]=[d,c]),m.setEnd(d.node,d.offset),m.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(m)}o&&this.view.root.activeElement==s&&(s.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,d)),this.impreciseAnchor=c.precise?null:new Ta(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Ta(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&V0(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,s=Sp(t.root),{anchorNode:r,anchorOffset:i}=t.observer.selectionRange;if(!s||!n.empty||!n.assoc||!s.modify)return;let o=this.lineAt(n.head,n.assoc);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),c=this.coordsAt(n.head,1);if(!l||!c||l.bottom>c.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);s.collapse(d.node,d.offset),s.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let h=t.observer.selectionRange;t.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&s.collapse(r,i)}posFromDOM(t,n){let s=this.tile.nearest(t);if(!s)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let r=s.posAtStart;if(s.isComposite()){let i;if(t==s.dom)i=s.dom.childNodes[n];else{let o=gc(t)==0?0:n==0?-1:1;for(;;){let a=t.parentNode;if(a==s.dom)break;o==0&&a.firstChild!=a.lastChild&&(t==a.firstChild?o=-1:o=1),t=a}o<0?i=t:i=t.nextSibling}if(i==s.dom.firstChild)return r;for(;i&&!cr.get(i);)i=i.nextSibling;if(!i)return r+s.length;for(let o=0,a=r;;o++){let l=s.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return s.isText()?t==s.dom?r+n:r+(n?s.length:0):r}domAtPos(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.domPosFor(t,n):s.domIn(r,n)}inlineDOMNearPos(t,n){let s,r=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,d)=>{if(c.isWidget()){if(c.flags&32&&d>=t)return!0;c.flags&16&&(i=!0)}else{let h=d+c.length;if(d<=t&&(s=c,r=t-d,i=h<t),h>=t&&!o&&(o=c,a=t-d,l=d>t),d>t&&o)return!0}}),!s&&!o?this.domAtPos(t,n):(i&&o?s=null:l&&s&&(o=null),s&&n<0||!o?s.domIn(r,n):o.domIn(a,n))}coordsAt(t,n){let{tile:s,offset:r}=this.tile.resolveBlock(t,n);return s.isWidget()?s.widget instanceof Zx?null:s.coordsInWidget(r,n,!0):s.coordsIn(r,n)}lineAt(t,n){let{tile:s}=this.tile.resolveBlock(t,n);return s.isLine()?s:null}coordsForChar(t){let{tile:n,offset:s}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function r(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=r(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=vi(i.text,o);if(a==o)return null;let l=Cp(i.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(c==l.length-1||d.top<d.bottom&&d.left<d.right)return d}}return null}return r(n,s)}measureVisibleLineHeights(t){let n=[],{from:s,to:r}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==qs.LTR,c=0,d=(h,f,m)=>{for(let p=0;p<h.children.length&&!(f>r);p++){let y=h.children[p],w=f+y.length,b=y.dom.getBoundingClientRect(),{height:v}=b;if(m&&!p&&(c+=b.top-m.top),y instanceof ic)w>s&&d(y,f,b);else if(f>=s&&(c>0&&n.push(-c),n.push(v+c),c=0,o)){let x=y.dom.lastChild,_=x?U0(x):[];if(_.length){let E=_[_.length-1],k=l?E.right-b.left:b.right-E.left;k>a&&(a=k,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=w)}}m&&p==h.children.length-1&&(c+=m.bottom-b.bottom),f=w+y.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?qs.RTL:qs.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let c of o.children){if(!c.isText()||/[^ -~]/.test(c.text))return;let d=U0(c.dom);if(d.length!=1)return;a+=d[0].width,l=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(t)return t;let n=document.createElement("div"),s,r,i;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let o=U0(n.firstChild)[0];s=n.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,i=o&&o.height?o.height:s,n.remove()}),{lineHeight:s,charWidth:r,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let s=0,r=0;;r++){let i=r==n.viewports.length?null:n.viewports[r],o=i?i.from-1:this.view.state.doc.length;if(o>s){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(s).top)/this.view.scaleY;t.push(qn.replace({widget:new Zx(a),block:!0,inclusive:!0,isBlockGap:!0}).range(s,o))}if(!i)break;s=i.to+1}return qn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(cw).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),s=!1,r=this.view.state.facet(z6).map((i,o)=>{let a=typeof i=="function";return a&&(s=!0),a?i(this.view):i});for(r.length&&(this.dynamicDecorationMap[t++]=s,n.push(ys.join(r))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;this.blockWrappers=this.view.state.facet(T$).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(t){var n;if(t.isSnapshot){let d=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=d.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let d of this.view.state.facet(_$))try{if(d(this.view,t.range,t))return!0}catch(h){So(this.view.state,h,"scroll handler")}let{range:s}=t,r=this.coordsAt(s.head,(n=s.assoc)!==null&&n!==void 0?n:s.empty?0:s.head>s.anchor?-1:1),i;if(!r)return;!s.empty&&(i=this.coordsAt(s.anchor,s.anchor>s.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let o=F6(this.view),a={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(vve(this.view.scrollDOM,a,s.head<s.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,l),-l),Math.max(Math.min(t.yMargin,c),-c),this.view.textDirection==qs.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(s.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=s=>s.isWidget()||s.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){xk(this.tile)}}function xk(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let s of e.children)xk(s,t)}}function Vve(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function M$(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let s=a$(n.focusNode,n.focusOffset),r=l$(n.focusNode,n.focusOffset),i=s||r;if(r&&s&&r.node!=s.node){let a=cr.get(r.node);if(!a||a.isText()&&a.text!=r.node.nodeValue)i=r;else if(e.docView.lastCompositionAfterCursor){let l=cr.get(s.node);!l||l.isText()&&l.text!=s.node.nodeValue||(i=r)}}if(e.docView.lastCompositionAfterCursor=i!=s,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function Wve(e,t,n){let s=M$(e,n);if(!s)return null;let{node:r,from:i,to:o}=s,a=r.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(s.from,s.to)!=a)return null;let l=t.invertedDesc;return{range:new ta(l.mapPos(i),l.mapPos(o),i,o),text:r}}function Gve(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable=="false"?2:0)}let Kve=class{constructor(){this.changes=[]}compareRange(t,n){bf(t,n,this.changes)}comparePoint(t,n){bf(t,n,this.changes)}boundChange(t){bf(t,t,this.changes)}};function Yve(e,t,n){let s=new Kve;return ys.compare(e,t,n,s),s.changes}class Qve{constructor(){this.changes=[]}compareRange(t,n){bf(t,n,this.changes)}comparePoint(){}boundChange(t){bf(t,t,this.changes)}}function Xve(e,t,n){let s=new Qve;return ys.compare(e,t,n,s),s.changes}function Jve(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function Zve(e,t){let n=!1;return t&&e.iterChangedRanges((s,r)=>{s<t.to&&r>t.from&&(n=!0)}),n}class Zx extends Al{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function ewe(e,t,n=1){let s=e.charCategorizer(t),r=e.doc.lineAt(t),i=t-r.from;if(r.length==0)return Ve.cursor(t);i==0?n=1:i==r.length&&(n=-1);let o=i,a=i;n<0?o=vi(r.text,i,!1):a=vi(r.text,i);let l=s(r.text.slice(o,a));for(;o>0;){let c=vi(r.text,o,!1);if(s(r.text.slice(c,o))!=l)break;o=c}for(;a<r.length;){let c=vi(r.text,a);if(s(r.text.slice(a,c))!=l)break;a=c}return Ve.range(o+r.from,a+r.from)}function twe(e,t,n,s,r){let i=Math.round((s-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,l=Math.floor((r-n.top-(e.defaultLineHeight-a)*.5)/a);i+=l*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+uve(o,i,e.state.tabSize)}function _k(e,t,n){let s=e.lineBlockAt(t);if(Array.isArray(s.type)){let r;for(let i of s.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!r||i.type==qi.Text&&(r.type!=i.type||(n<0?i.from<t:i.to>t)))&&(r=i)}}return r||s}return s}function nwe(e,t,n,s){let r=_k(e,t.head,t.assoc||-1),i=!s||r.type!=qi.Text||!(e.lineWrapping||r.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(r.from),l=e.posAtCoords({x:n==(a==qs.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Ve.cursor(l,n?-1:1)}return Ve.cursor(n?r.to:r.from,n?-1:1)}function FE(e,t,n,s){let r=e.state.doc.lineAt(t.head),i=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let a=t,l=null;;){let c=Nve(r,i,o,a,n),d=f$;if(!c){if(r.number==(n?e.state.doc.lines:1))return a;d=`
`,r=e.state.doc.line(r.number+(n?1:-1)),i=e.bidiSpans(r),c=e.visualLineSide(r,!n)}if(l){if(!l(d))return a}else{if(!s)return c;l=s(d)}a=c}}function swe(e,t,n){let s=e.state.charCategorizer(t),r=s(n);return i=>{let o=s(i);return r==Zl.Space&&(r=o),r==o}}function rwe(e,t,n,s){let r=t.head,i=n?1:-1;if(r==(n?e.state.doc.length:0))return Ve.cursor(r,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let p=e.viewState.lineBlockAt(r);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(r-p.from))),a=(i<0?p.top:p.bottom)+d}let h=l.left+o,f=e.viewState.heightOracle.textHeight>>1,m=s??f;for(let p=0;;p+=f){let y=a+(m+p)*i,w=kk(e,{x:h,y},!1,i);if(n?y>l.bottom:y<l.top)return Ve.cursor(w.pos,w.assoc);let b=e.coordsAtPos(w.pos,w.assoc),v=b?(b.top+b.bottom)/2:0;if(!b||(n?v>a:v<a))return Ve.cursor(w.pos,w.assoc,void 0,o)}}function W0(e,t,n){for(;;){let s=0;for(let r of e)r.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let l=s||n||(t-i<o-t?-1:1);t=l<0?i:o,s=l}});if(!s)return t}}function N$(e,t){let n=null;for(let s=0;s<t.ranges.length;s++){let r=t.ranges[s],i=null;if(r.empty){let o=W0(e,r.from,0);o!=r.from&&(i=Ve.cursor(o,-1))}else{let o=W0(e,r.from,-1),a=W0(e,r.to,1);(o!=r.from||a!=r.to)&&(i=Ve.range(r.from==r.anchor?o:a,r.from==r.head?o:a))}i&&(n||(n=t.ranges.slice()),n[s]=i)}return n?Ve.create(n,t.mainIndex):t}function e4(e,t,n){let s=W0(e.state.facet(hg).map(r=>r(e)),n.from,t.head>n.from?-1:1);return s==n.from?n:Ve.cursor(s,s<n.from?1:-1)}class sl{constructor(t,n){this.pos=t,this.assoc=n}}function kk(e,t,n,s){let r=e.contentDOM.getBoundingClientRect(),i=r.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,c;for(;;){if(l<0)return new sl(0,1);if(l>e.viewState.docHeight)return new sl(e.state.doc.length,-1);if(c=e.elementAtHeight(l),s==null)break;if(c.type==qi.Text){if(s<0?c.to<e.viewport.from:c.from>e.viewport.to)break;let f=e.docView.coordsAt(s<0?c.from:c.to,s>0?-1:1);if(f&&(s<0?f.top<=l+i:f.bottom>=l+i))break}let h=e.viewState.heightOracle.textHeight/2;l=s>0?c.bottom+h:c.top-h}if(e.viewport.from>=c.to||e.viewport.to<=c.from){if(n)return null;if(c.type==qi.Text){let h=twe(e,r,c,o,a);return new sl(h,h==c.from?1:-1)}}if(c.type!=qi.Text)return l<(c.top+c.bottom)/2?new sl(c.from,1):new sl(c.to,-1);let d=e.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=e.docView.lineAt(c.from,-2)),new iwe(e,o,a,e.textDirectionAt(c.from)).scanTile(d,c.from)}class iwe{constructor(t,n,s,r){this.view=t,this.x=n,this.y=s,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to<t)&&(this.line=this.view.state.doc.lineAt(t),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[cl.find(r,t-s.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:s,spans:r}=this.bidiSpansAt(t);return r[cl.find(r,t-s.from,-1,n)].dir}bidiIn(t,n){let{spans:s,line:r}=this.bidiSpansAt(t);return s.length>1||s.length&&(s[0].level!=this.baseDir||s[0].to+r.from<n)}scan(t,n,s=!1){let r=0,i=t.length-1,o=new Set,a=this.bidiIn(t[0],t[i]),l,c,d=-1,h=1e9,f;e:for(;r<i;){let p=i-r,y=r+i>>1;t:if(o.has(y)){let b=r+Math.floor(Math.random()*p);for(let v=0;v<p;v++){if(!o.has(b)){y=b;break t}b++,b==i&&(b=r)}break e}o.add(y);let w=n(y);if(w)for(let b=0;b<w.length;b++){let v=w[b],x=0;if(!(v.width==0&&w.length>1)){if(v.bottom<this.y)(!l||l.bottom<v.bottom)&&(l=v),x=1;else if(v.top>this.y)(!c||c.top>v.top)&&(c=v),x=-1;else{let _=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,E=Math.abs(_);E<h&&(d=y,h=E,f=v),_&&(x=_<0==(this.baseDir==qs.LTR)?-1:1)}x==-1&&(!a||this.baseDirAt(t[y],1))?i=y:x==1&&(!a||this.baseDirAt(t[y+1],-1))&&(r=y+1)}}}if(!f){if(!c&&!l)return{i:t[0],after:!1};let p=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(p.top+p.bottom)/2,this.scan(t,n,!0)}if(h&&!s){let{top:p,bottom:y}=f;if(l&&l.bottom>(p+p+y)/3)return this.y=l.bottom-1,this.scan(t,n,!0);if(c&&c.top<(p+y+y)/3)return this.y=c.top+1,this.scan(t,n,!0)}let m=(a?this.dirAt(t[d],1):this.baseDir)==qs.LTR;return{i:d,after:this.x>(f.left+f.right)/2==m}}scanText(t,n){let s=[];for(let i=0;i<t.length;i=vi(t.text,i))s.push(n+i);s.push(n+t.length);let r=this.scan(s,i=>{let o=s[i]-n,a=s[i+1]-n;return Cp(t.dom,o,a).getClientRects()});return r.after?new sl(s[r.i+1],-1):new sl(s[r.i],1)}scanTile(t,n){if(!t.length)return new sl(n,1);if(t.children.length==1){let a=t.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let s=[n];for(let a=0,l=n;a<t.children.length;a++)s.push(l+=t.children[a].length);let r=this.scan(s,a=>{let l=t.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Cp(l.dom,0,l.length)).getClientRects()}),i=t.children[r.i],o=s[r.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):r.after?new sl(s[r.i+1],-1):new sl(o,1)}}const Ph="";class owe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(ms.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Ph}readRange(t,n){if(!t)return this;let s=t.parentNode;for(let r=t;;){this.findPointBefore(s,r);let i=this.text.length;this.readNode(r);let o=cr.get(r),a=r.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&s!=this.view.contentDOM&&this.lineBreak();break}let l=cr.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:zb(r))||zb(a)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!lwe(a,n)&&this.lineBreak(),r=a}return this.findPointBefore(s,n),this}readTextNode(t){let n=t.nodeValue;for(let s of this.points)s.node==t&&(s.pos=this.text.length+Math.min(s.offset,n.length));for(let s=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,s),o=this.lineSeparator.length):(a=r.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(s,i<0?n.length:i)),i<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==t&&l.pos>this.text.length&&(l.pos-=o-1);s=i+o}}readNode(t){let n=cr.get(t),s=n&&n.overrideDOMText;if(s!=null){this.findPointInside(t,s.length);for(let r=s.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let s of this.points)s.node==t&&t.childNodes[s.offset]==n&&(s.pos=this.text.length)}findPointInside(t,n){for(let s of this.points)(t.nodeType==3?s.node==t:t.contains(s.node))&&(s.pos=this.text.length+(awe(t,s.node,s.offset)?n:0))}}function awe(e,t,n){for(;;){if(!t||n<gc(t))return!1;if(t==e)return!0;n=Du(t)+1,t=t.parentNode}}function lwe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let s=cr.get(e);if(!(s!=null&&s.isWidget()))return!1;s&&(n||(n=[])).push(s)}if(n)for(let s of n){let r=s.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class qE{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class cwe{constructor(t,n,s,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:o}=t.docView,a=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=I$(t.docView.tile,n,s,0))){let l=i||o?[]:dwe(t),c=new owe(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=hwe(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!gk(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),d=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!gk(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=t.viewport;if((St.ios||St.chrome)&&a.main.empty&&c!=d&&(h.from>0||h.to<t.state.doc.length)){let f=Math.min(c,d),m=Math.max(c,d),p=h.from-f,y=h.to-m;(p==0||p==1||f==0)&&(y==0||y==-1||m==t.state.doc.length)&&(c=0,d=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Ve.range(d,c));else if(t.lineWrapping&&d==c&&!(a.main.empty&&a.main.head==c)&&t.inputState.lastTouchTime>Date.now()-100){let f=t.coordsAtPos(c,-1),m=0;f&&(m=t.inputState.lastTouchY<=f.bottom?-1:1),this.newSel=Ve.create([Ve.cursor(c,m)])}else this.newSel=Ve.single(d,c)}}}function I$(e,t,n,s){if(e.isComposite()){let r=-1,i=-1,o=-1,a=-1;for(let l=0,c=s,d=s;l<e.children.length;l++){let h=e.children[l],f=c+h.length;if(c<t&&f>n)return I$(h,t,n,c);if(f>=t&&r==-1&&(r=l,i=c),c>n&&h.dom.parentNode==e.dom){o=l,a=d;break}d=f,c=f+h.breakAfter}return{from:i,to:a<0?s+e.length:a,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:s,to:s+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function j$(e,t){let n,{newSel:s}=t,{state:r}=e,i=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:a,to:l}=t.bounds,c=i.from,d=null;(o===8||St.android&&t.text.length<l-a)&&(c=i.to,d="end");let h=r.doc.sliceString(a,l,Ph),f,m;!i.empty&&i.from>=a&&i.to<=l&&(t.typeOver||h!=t.text)&&h.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&h.slice(i.to-a)==t.text.slice(f=t.text.length-(h.length-(i.to-a)))?n={from:i.from,to:i.to,insert:Qn.of(t.text.slice(i.from-a,f).split(Ph))}:(m=R$(h,t.text,c-a,d))&&(St.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==Ph+Ph&&m.toB--,n={from:a+m.from,to:a+m.toA,insert:Qn.of(t.text.slice(m.from,m.toB).split(Ph))})}else s&&(!e.hasFocus&&r.facet(Wl)||Ub(s,i))&&(s=null);if(!n&&!s)return!1;if((St.mac||St.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(s&&n.insert.length==2&&(s=Ve.single(s.main.anchor-1,s.main.head-1)),n={from:n.from,to:n.to,insert:Qn.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(i.from).to<i.to&&e.docView.lineHasWidget(i.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:i.from,to:i.to,insert:r.toText(e.inputState.insertingText)}:St.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(s&&(s=Ve.single(s.main.anchor-1,s.main.head-1)),n={from:i.from,to:i.to,insert:Qn.of([" "])}),n)return q6(e,n,s,o);if(s&&!Ub(s,i)){let a=!1,l="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(a=!0),l=e.inputState.lastSelectionOrigin,l=="select.pointer"&&(s=N$(r.facet(hg).map(c=>c(e)),s))),e.dispatch({selection:s,scrollIntoView:a,userEvent:l}),!0}else return!1}function q6(e,t,n,s=-1){if(St.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(St.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&e.state.sliceDoc(t.from,r.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&vf(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&t.insert.length==0||s==8&&t.insert.length<t.to-t.from&&t.to>r.head)&&vf(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&t.insert.length==0&&vf(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=uwe(e,t,n));return e.state.facet(b$).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function uwe(e,t,n){let s,r=e.state,i=r.selection.main,o=-1;if(t.from==t.to&&t.from<i.from||t.from>i.to){let l=t.from<i.from?-1:1,c=l<0?i.from:i.to,d=W0(r.facet(hg).map(h=>h(e)),c,l);t.from==d&&(o=d)}if(o>-1)s={changes:t,selection:Ve.cursor(t.from+t.insert.length,-1)};else if(t.from>=i.from&&t.to<=i.to&&t.to-t.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let l=i.from<t.from?r.sliceDoc(i.from,t.from):"",c=i.to>t.to?r.sliceDoc(t.to,i.to):"";s=r.replaceSelection(e.state.toText(l+t.insert.sliceString(0,void 0,e.state.lineBreak)+c))}else{let l=r.changes(t),c=n&&n.main.to<=l.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let d=e.state.sliceDoc(t.from,t.to),h,f=n&&M$(e,n.main.head);if(f){let p=t.insert.length-(t.to-t.from);h={from:f.from,to:f.to-p}}else h=e.state.doc.lineAt(i.head);let m=i.to-t.to;s=r.changeByRange(p=>{if(p.from==i.from&&p.to==i.to)return{changes:l,range:c||p.map(l)};let y=p.to-m,w=y-d.length;if(e.state.sliceDoc(w,y)!=d||y>=h.from&&w<=h.to)return{range:p};let b=r.changes({from:w,to:y,insert:t.insert}),v=p.to-i.to;return{changes:b,range:c?Ve.range(Math.max(0,c.anchor+v),Math.max(0,c.head+v)):p.map(b)}})}else s={changes:l,selection:c&&r.selection.replaceRange(c)}}let a="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,a+=".compose",e.inputState.compositionFirstChange&&(a+=".start",e.inputState.compositionFirstChange=!1)),r.update(s,{userEvent:a,scrollIntoView:!0})}function R$(e,t,n,s){let r=Math.min(e.length,t.length),i=0;for(;i<r&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==r&&e.length==t.length)return null;let o=e.length,a=t.length;for(;o>0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if(s=="end"){let l=Math.max(0,i-Math.min(o,a));n-=o+l-i}if(o<i&&e.length<t.length){let l=n<=i&&n>=o?i-n:0;i-=l,a=i+(a-o),o=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,o=i+(o-a),a=i}return{from:i,toA:o,toB:a}}function dwe(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new qE(n,s)),(r!=n||i!=s)&&t.push(new qE(r,i))),t}function hwe(e,t){if(e.length==0)return null;let n=e[0].pos,s=e.length==2?e[1].pos:n;return n>-1&&s>-1?Ve.single(n+t,s+t):null}function Ub(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class fwe{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,St.safari&&t.contentDOM.addEventListener("input",()=>null),St.gecko&&Ewe(t.contentDOM.ownerDocument)}handleEvent(t){!xwe(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let s=this.handlers[t];if(s){for(let r of s.observers)r(this.view,n);for(let r of s.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=mwe(t),s=this.handlers,r=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=s[i];a&&o!=!a.handlers.length&&(r.removeEventListener(i,this.handleEvent),a=null),a||r.addEventListener(i,this.handleEvent,{passive:o})}for(let i in s)i!="scroll"&&!n[i]&&r.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&D$.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),St.android&&St.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return St.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=L$.find(s=>s.keyCode==t.keyCode))&&!t.ctrlKey||pwe.indexOf(t.key)>-1&&t.ctrlKey)?(this.pendingIOSKey=n||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString())?!1:(this.pendingIOSKey=void 0,vf(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(t){return!/^key/.test(t.type)||t.synthetic?!1:this.composing>0?!0:St.safari&&!St.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function HE(e,t){return(n,s)=>{try{return t.call(e,s,n)}catch(r){So(n.state,r)}}}function mwe(e){let t=Object.create(null);function n(s){return t[s]||(t[s]={observers:[],handlers:[]})}for(let s of e){let r=s.spec,i=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(HE(s.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(HE(s.value,l))}}for(let s in Ea)n(s).handlers.push(Ea[s]);for(let s in co)n(s).observers.push(co[s]);return t}const L$=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],pwe="dthko",D$=[16,17,18,20,91,92,224,225],w1=6;function x1(e){return Math.max(0,e)*.7+8}function gwe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class ywe{constructor(t,n,s,r){this.view=t,this.startEvent=n,this.style=s,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=r$(t.contentDOM),this.atoms=t.state.facet(hg).map(o=>o(t));let i=t.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(ms.allowMultipleSelections)&&bwe(t,n),this.dragging=wwe(t,n)&&P$(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&gwe(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,s=0,r=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=F6(this.view);t.clientX-l.left<=r+w1?n=-x1(r-t.clientX):t.clientX+l.right>=o-w1&&(n=x1(t.clientX-o)),t.clientY-l.top<=i+w1?s=-x1(i-t.clientY):t.clientY+l.bottom>=a-w1&&(s=x1(t.clientY-a)),this.setScrollSpeed(n,s)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,s=N$(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!s.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:s,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function bwe(e,t){let n=e.state.facet(m$);return n.length?n[0](t):St.mac?t.metaKey:t.ctrlKey}function vwe(e,t){let n=e.state.facet(p$);return n.length?n[0](t):St.mac?!t.altKey:!t.ctrlKey}function wwe(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let s=Sp(e.root);if(!s||s.rangeCount==0)return!0;let r=s.getRangeAt(0).getClientRects();for(let i=0;i<r.length;i++){let o=r[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function xwe(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,s;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(s=cr.get(n))&&s.isWidget()&&!s.isHidden&&s.widget.ignoreEvent(t))return!1;return!0}const Ea=Object.create(null),co=Object.create(null),O$=St.ie&&St.ie_version<15||St.ios&&St.webkit_version<604;function _we(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),B$(e,n.value)},50)}function hw(e,t,n){for(let s of e.facet(t))n=s(n,e);return n}function B$(e,t){t=hw(e.state,B6,t);let{state:n}=e,s,r=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(Sk!=null&&n.selection.ranges.every(l=>l.empty)&&Sk==i.toString()){let l=-1;s=n.changeByRange(c=>{let d=n.doc.lineAt(c.from);if(d.from==l)return{range:c};l=d.from;let h=n.toText((o?i.line(r++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:h},range:Ve.cursor(c.from+h.length)}})}else o?s=n.changeByRange(l=>{let c=i.line(r++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Ve.cursor(l.from+c.length)}}):s=n.replaceSelection(i);e.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}co.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};co.wheel=co.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Ea.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);co.touchstart=(e,t)=>{let n=e.inputState,s=t.targetTouches[0];n.lastTouchTime=Date.now(),s&&(n.lastTouchX=s.clientX,n.lastTouchY=s.clientY),n.setSelectionOrigin("select.pointer")};co.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Ea.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let s of e.state.facet(g$))if(n=s(e,t),n)break;if(!n&&t.button==0&&(n=Swe(e,t)),n){let s=!e.hasFocus;e.inputState.startMouseSelection(new ywe(e,t,n,s)),s&&e.observer.ignore(()=>{i$(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),r.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function UE(e,t,n,s){if(s==1)return Ve.cursor(t,n);if(s==2)return ewe(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),o=r?r.posAtStart:i.from,a=r?r.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,Ve.range(o,a)}}const kwe=St.ie&&St.ie_version<=11;let VE=null,WE=0,GE=0;function P$(e){if(!kwe)return e.detail;let t=VE,n=GE;return VE=e,GE=Date.now(),WE=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(WE+1)%3:1}function Swe(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),s=P$(t),r=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),r=r.map(i.changes))},get(i,o,a){let l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,d=UE(e,l.pos,l.assoc,s);if(n.pos!=l.pos&&!o){let h=UE(e,n.pos,n.assoc,s),f=Math.min(h.from,d.from),m=Math.max(h.to,d.to);d=f<d.from?Ve.range(f,m,d.assoc):Ve.range(m,f,d.assoc)}return o?r.replaceRange(r.main.extend(d.from,d.to,d.assoc)):a&&s==1&&r.ranges.length>1&&(c=Twe(r,l.pos))?c:a?r.addRange(d):Ve.create([d])}}}function Twe(e,t){for(let n=0;n<e.ranges.length;n++){let{from:s,to:r}=e.ranges[n];if(s<=t&&r>=t)return Ve.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}Ea.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let i=r.posAtStart,o=i+r.length;(i>=n.to||o<=n.from)&&(n=Ve.range(i,o))}}let{inputState:s}=e;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",hw(e.state,P6,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Ea.dragend=e=>(e.inputState.draggedContent=null,!1);function KE(e,t,n,s){if(n=hw(e.state,B6,n),!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=s&&i&&vwe(e,t)?{from:i.from,to:i.to}:null,a={from:r,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Ea.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let s=Array(n.length),r=0,i=()=>{++r==n.length&&KE(e,t,s.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<n.length;o++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(s[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let s=t.dataTransfer.getData("Text");if(s)return KE(e,t,s,!0),!0}return!1};Ea.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=O$?null:t.clipboardData;return n?(B$(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(_we(e),!1)};function Cwe(e,t){let n=e.dom.parentNode;if(!n)return;let s=n.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=t,s.focus(),s.selectionEnd=t.length,s.selectionStart=0,setTimeout(()=>{s.remove(),e.focus()},50)}function Awe(e){let t=[],n=[],s=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>r&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),r=o.number}s=!0}return{text:hw(e,P6,t.join(e.lineBreak)),ranges:n,linewise:s}}let Sk=null;Ea.copy=Ea.cut=(e,t)=>{if(!H0(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:s,linewise:r}=Awe(e.state);if(!n&&!r)return!1;Sk=r?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});let i=O$?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Cwe(e,n),!1)};const $$=kc.define();function z$(e,t){let n=[];for(let s of e.facet(v$)){let r=s(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:$$.of(!0)}):null}function F$(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=z$(e.state,t);n?e.dispatch(n):e.update([])}},10)}co.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),F$(e)};co.blur=e=>{e.observer.clearSelectionRange(),F$(e)};co.compositionstart=co.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};co.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,St.chrome&&St.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};co.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Ea.beforeinput=(e,t)=>{var n,s;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let i=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=t.getTargetRanges();if(i&&o.length){let a=o[0],l=e.posAtDOM(a.startContainer,a.startOffset),c=e.posAtDOM(a.endContainer,a.endOffset);return q6(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let r;if(St.chrome&&St.android&&(r=L$.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>i+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return St.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),St.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>co.compositionend(e,t),20),!1};const YE=new Set;function Ewe(e){YE.has(e)||(YE.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const QE=["pre-wrap","normal","pre-line","break-spaces"];let Uf=!1;function XE(){Uf=!1}class Mwe{constructor(t){this.lineWrapping=t,this.doc=Qn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let s=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(s+=Math.max(0,Math.ceil((n-t-s*this.lineLength*.5)/this.lineLength))),this.lineHeight*s}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return QE.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let s=0;s<t.length;s++){let r=t[s];r<0?s++:this.heightSamples[Math.floor(r*10)]||(n=!0,this.heightSamples[Math.floor(r*10)]=!0)}return n}refresh(t,n,s,r,i,o){let a=QE.indexOf(t)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=s,this.textHeight=r,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<o.length;c++){let d=o[c];d<0?c++:this.heightSamples[Math.floor(d*10)]=!0}}return l}}class Nwe{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Sa{constructor(t,n,s,r,i){this.from=t,this.length=n,this.top=s,this.height=r,this._content=i}get type(){return typeof this._content=="number"?qi.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Gd?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new Sa(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Ls=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Ls||(Ls={}));const vy=.001;class Hi{constructor(t,n,s=2){this.length=t,this.height=n,this.flags=s}get outdated(){return(this.flags&2)>0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>vy&&(Uf=!0),this.height=t)}replace(t,n,s){return Hi.of(s)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,s,r){let i=this,o=s.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:d,toB:h}=r[a],f=i.lineAt(l,Ls.ByPosNoHeight,s.setDoc(n),0,0),m=f.to>=c?f:i.lineAt(c,Ls.ByPosNoHeight,s,0,0);for(h+=m.to-c,c=m.to;a>0&&f.from<=r[a-1].toA;)l=r[a-1].fromA,d=r[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,Ls.ByPosNoHeight,s,0,0));d+=f.from-l,l=f.from;let p=H6.build(s.setDoc(o),t,d,h);i=Vb(i,i.replace(l,c,p))}return i.updateHeight(s,0)}static empty(){return new bo(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,s=t.length,r=0,i=0;for(;;)if(n==s)if(r>i*2){let a=t[n-1];a.break?t.splice(--n,1,a.left,null,a.right):t.splice(--n,1,a.left,a.right),s+=1+a.break,r-=a.size}else if(i>r*2){let a=t[s];a.break?t.splice(s,1,a.left,null,a.right):t.splice(s,1,a.left,a.right),s+=2+a.break,i-=a.size}else break;else if(r<i){let a=t[n++];a&&(r+=a.size)}else{let a=t[--s];a&&(i+=a.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,s++),new jwe(Hi.of(t.slice(0,n)),o,Hi.of(t.slice(s)))}}function Vb(e,t){return e==t?e:(e.constructor!=t.constructor&&(Uf=!0),t)}Hi.prototype.size=1;const Iwe=qn.replace({});class q$ extends Hi{constructor(t,n,s){super(t,n),this.deco=s,this.spaceAbove=0}mainBlock(t,n){return new Sa(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,s,r){return this.spaceAbove&&t<s+this.spaceAbove?new Sa(r,0,s,this.spaceAbove,Iwe):this.mainBlock(s,r)}lineAt(t,n,s,r,i){let o=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,s,r,i).join(o):o}forEachLine(t,n,s,r,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,Ls.ByPos,s,r,i))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,s=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class bo extends q${constructor(t,n,s){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=s}mainBlock(t,n){return new Sa(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,s){let r=s[0];return s.length==1&&(r instanceof bo||r instanceof ei&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ei?r=new bo(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):Hi.of(s)}updateHeight(t,n=0,s=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(s||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ei extends Hi{constructor(t){super(t,0)}heightMetrics(t,n){let s=t.doc.lineAt(n).number,r=t.doc.lineAt(n+this.length).number,i=r-s+1,o,a=0;if(t.lineWrapping){let l=Math.min(this.height,t.lineHeight*i);o=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else o=this.height/i;return{firstLine:s,lastLine:r,perLine:o,perChar:a}}blockAt(t,n,s,r){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,r);if(n.lineWrapping){let c=r+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-s)/this.height))*this.length)),d=n.doc.lineAt(c),h=a+d.length*l,f=Math.max(s,t-h/2);return new Sa(d.from,d.length,f,h,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((t-s)/a))),{from:d,length:h}=n.doc.line(i+c);return new Sa(d,h,s+a*c,a,0)}}lineAt(t,n,s,r,i){if(n==Ls.ByHeight)return this.blockAt(t,s,r,i);if(n==Ls.ByPosNoHeight){let{from:m,to:p}=s.doc.lineAt(t);return new Sa(m,p-m,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(s,i),c=s.doc.lineAt(t),d=a+c.length*l,h=c.number-o,f=r+a*h+l*(c.from-i-h);return new Sa(c.from,c.length,Math.max(r,Math.min(f,r+this.height-d)),d,0)}forEachLine(t,n,s,r,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(s,i);for(let d=t,h=r;d<=n;){let f=s.doc.lineAt(d);if(d==t){let p=f.number-a;h+=l*p+c*(t-i-p)}let m=l+c*f.length;o(new Sa(f.from,f.length,h,m,0)),h+=m,d=f.to+1}}replace(t,n,s){let r=this.length-n;if(r>0){let i=s[s.length-1];i instanceof ei?s[s.length-1]=new ei(i.length+r):s.push(null,new ei(r-1))}if(t>0){let i=s[0];i instanceof ei?s[0]=new ei(t+i.length):s.unshift(new ei(t-1),null)}return Hi.of(s)}decomposeLeft(t,n){n.push(new ei(t-1),null)}decomposeRight(t,n){n.push(null,new ei(this.length-t-1))}updateHeight(t,n=0,s=!1,r){let i=n+this.length;if(r&&r.from<=n+this.length&&r.more){let o=[],a=Math.max(n,r.from),l=-1;for(r.from>n&&o.push(new ei(r.from-n-1).updateHeight(t,n));a<=i&&r.more;){let d=t.doc.lineAt(a).length;o.length&&o.push(null);let h=r.heights[r.index++],f=0;h<0&&(f=-h,h=r.heights[r.index++]),l==-1?l=h:Math.abs(h-l)>=vy&&(l=-2);let m=new bo(d,h,f);m.outdated=!1,o.push(m),a+=d+1}a<=i&&o.push(null,new ei(i-a).updateHeight(t,a));let c=Hi.of(o);return(l<0||Math.abs(c.height-this.height)>=vy||Math.abs(l-this.heightMetrics(t,n).perLine)>=vy)&&(Uf=!0),Vb(this,c)}else(s||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class jwe extends Hi{constructor(t,n,s){super(t.length+n+s.length,t.height+s.height,n|(t.outdated||s.outdated?2:0)),this.left=t,this.right=s,this.size=t.size+s.size}get break(){return this.flags&1}blockAt(t,n,s,r){let i=s+this.left.height;return t<i?this.left.blockAt(t,n,s,r):this.right.blockAt(t,n,i,r+this.left.length+this.break)}lineAt(t,n,s,r,i){let o=r+this.left.height,a=i+this.left.length+this.break,l=n==Ls.ByHeight?t<o:t<a,c=l?this.left.lineAt(t,n,s,r,i):this.right.lineAt(t,n,s,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let d=n==Ls.ByPosNoHeight?Ls.ByPosNoHeight:Ls.ByPos;return l?c.join(this.right.lineAt(a,d,s,o,a)):this.left.lineAt(a,d,s,r,i).join(c)}forEachLine(t,n,s,r,i,o){let a=r+this.left.height,l=i+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,n,s,r,i,o),n>=l&&this.right.forEachLine(t,n,s,a,l,o);else{let c=this.lineAt(l,Ls.ByPos,s,r,i);t<c.from&&this.left.forEachLine(t,c.from-1,s,r,i,o),c.to>=t&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,s,a,l,o)}}replace(t,n,s){let r=this.left.length+this.break;if(n<r)return this.balanced(this.left.replace(t,n,s),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-r,n-r,s));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let a of s)i.push(a);if(t>0&&JE(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),JE(i,a)}return Hi.of(i)}decomposeLeft(t,n){let s=this.left.length;if(t<=s)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(s++,t>=s&&n.push(null)),t>s&&this.right.decomposeLeft(t-s,n)}decomposeRight(t,n){let s=this.left.length,r=s+this.break;if(t>=r)return this.right.decomposeRight(t-r,n);t<s&&this.left.decomposeRight(t,n),this.break&&t<r&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?Hi.of(this.break?[t,null,n]:[t,n]):(this.left=Vb(this.left,t),this.right=Vb(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,s=!1,r){let{left:i,right:o}=this,a=n+i.length+this.break,l=null;return r&&r.from<=n+i.length&&r.more?l=i=i.updateHeight(t,n,s,r):i.updateHeight(t,n,s),r&&r.from<=a+o.length&&r.more?l=o=o.updateHeight(t,a,s,r):o.updateHeight(t,a,s),l?this.balanced(i,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function JE(e,t){let n,s;e[t]==null&&(n=e[t-1])instanceof ei&&(s=e[t+1])instanceof ei&&e.splice(t-1,3,new ei(n.length+1+s.length))}const Rwe=5;class H6{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let s=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof bo?r.length+=s-this.pos:(s>this.pos||!this.isCovered)&&this.nodes.push(new bo(s-this.pos,-1,0)),this.writtenTo=s,n>s&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,s){if(t<n||s.heightRelevant){let r=s.widget?s.widget.estimatedHeight:0,i=s.widget?s.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=n-t;s.block?this.addBlock(new q$(o,r,s)):(o||i||r>=Rwe)&&this.addLineDeco(r,i,o)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTo<t&&((this.writtenTo<t-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new bo(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let s=new ei(n-t);return this.oracle.doc.lineAt(t).to==n&&(s.flags|=4),s}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof bo)return t;let n=new bo(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,s){let r=this.ensureLine();r.length+=s,r.collapsed+=s,r.widgetHeight=Math.max(r.widgetHeight,t),r.breaks+=n,this.writtenTo=this.pos=this.pos+s}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof bo)&&!this.isCovered?this.nodes.push(new bo(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let s=t;for(let r of this.nodes)r instanceof bo&&r.updateHeight(this.oracle,s),s+=r?r.length:1;return this.nodes}static build(t,n,s,r){let i=new H6(s,t);return ys.spans(n,s,r,i,0),i.finish(s)}}function Lwe(e,t,n){let s=new Dwe;return ys.compare(e,t,n,s,0),s.changes}class Dwe{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,s,r){(t<n||s&&s.heightRelevant||r&&r.heightRelevant)&&bf(t,n,this.changes,5)}}function Owe(e,t){let n=e.getBoundingClientRect(),s=e.ownerDocument,r=s.defaultView||window,i=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(r.innerHeight,n.bottom);for(let c=e.parentNode;c&&c!=s.body;)if(c.nodeType==1){let d=c,h=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&h.overflow!="visible"){let f=d.getBoundingClientRect();i=Math.max(i,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=Math.min(c==e.parentNode?r.innerHeight:l,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?d.offsetParent:d.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:i-n.left,right:Math.max(i,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function Bwe(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function Pwe(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class t4{constructor(t,n,s,r){this.from=t,this.to=n,this.size=s,this.displaySize=r}static same(t,n){if(t.length!=n.length)return!1;for(let s=0;s<t.length;s++){let r=t[s],i=n[s];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(t,n){return qn.replace({widget:new $we(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class $we extends Al{constructor(t,n){super(),this.size=t,this.vertical=n}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class ZE{constructor(t,n){this.view=t,this.state=n,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=eM,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=qs.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let s=n.facet($6).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Mwe(s),this.stateDeco=tM(n),this.heightMap=Hi.empty().applyChanges(this.stateDeco,Qn.empty,this.heightOracle.setDoc(n.doc),[new ta(0,0,0,n.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=qn.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let s=0;s<=1;s++){let r=s?n.head:n.anchor;if(!t.some(({from:i,to:o})=>r>=i&&r<=o)){let{from:i,to:o}=this.lineBlockAt(r);t.push(new _1(i,o))}}return this.viewports=t.sort((s,r)=>s.from-r.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?eM:new U6(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(a0(t,this.scaler))})}update(t,n=null){this.state=t.state;let s=this.stateDeco;this.stateDeco=tM(this.state);let r=t.changedRanges,i=ta.extendWithRanges(r,Lwe(s,this.stateDeco,t?t.changes:Rr.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);XE(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||Uf)&&(t.flags|=2),a?(this.scrollAnchorPos=t.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=i.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(c||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(x$)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,s=window.getComputedStyle(n),r=this.heightOracle,i=s.whiteSpace;this.defaultTextDirection=s.direction=="rtl"?qs.RTL:qs.LTR;let o=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,d=0;if(a.width&&a.height){let{scaleX:E,scaleY:k}=s$(n,a);(E>.005&&Math.abs(this.scaleX-E)>.005||k>.005&&Math.abs(this.scaleY-k)>.005)&&(this.scaleX=E,this.scaleY=k,c|=16,o=l=!0)}let h=(parseInt(s.paddingTop)||0)*this.scaleY,f=(parseInt(s.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,c|=16);let m=r$(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=o$(this.scrollParent||t.win);let y=(this.printing?Pwe:Owe)(n,this.paddingTop),w=y.top-this.pixelViewport.top,b=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget&&!Bwe(t.dom))return 0;let x=a.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,c|=16),l){let E=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(E)&&(o=!0),o||r.lineWrapping&&Math.abs(x-this.contentDOMWidth)>r.charWidth){let{lineHeight:k,charWidth:M,textHeight:R}=t.docView.measureTextSize();o=k>0&&r.refresh(i,k,M,R,Math.max(5,x/M),E),o&&(t.docView.minWidth=0,c|=16)}w>0&&b>0?d=Math.max(w,b):w<0&&b<0&&(d=Math.min(w,b)),XE();for(let k of this.viewports){let M=k.from==this.viewport.from?E:t.docView.measureVisibleLineHeights(k);this.heightMap=(o?Hi.empty().applyChanges(this.stateDeco,Qn.empty,this.heightOracle,[new ta(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new Nwe(k.from,M))}Uf&&(c|=2)}let _=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return _&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),c|=this.updateForViewport()),(c&2||_)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let s=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new _1(r.lineAt(o-s*1e3,Ls.ByHeight,i,0,0).from,r.lineAt(a+(1-s)*1e3,Ls.ByHeight,i,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=r.lineAt(c,Ls.ByPos,i,0,0),f;n.y=="center"?f=(h.top+h.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=h.top:f=h.bottom-d,l=new _1(r.lineAt(f-1e3/2,Ls.ByHeight,i,0,0).from,r.lineAt(f+d+1e3/2,Ls.ByHeight,i,0,0).to)}}return l}mapViewport(t,n){let s=n.mapPos(t.from,-1),r=n.mapPos(t.to,1);return new _1(this.heightMap.lineAt(s,Ls.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Ls.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},s=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(t,Ls.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Ls.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||r<=o-Math.max(10,Math.min(-s,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(s,250)))&&r>o-2*1e3&&i<a+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let s=[];for(let r of t)n.touchesRange(r.from,r.to)||s.push(new t4(n.mapPos(r.from),n.mapPos(r.to),r.size,r.displaySize));return s}ensureLineGaps(t,n){let s=this.heightOracle.lineWrapping,r=s?1e4:2e3,i=r>>1,o=r<<1;if(this.defaultTextDirection!=qs.LTR&&!s)return[];let a=[],l=(d,h,f,m)=>{if(h-d<i)return;let p=this.state.selection.main,y=[p.from];p.empty||y.push(p.to);for(let b of y)if(b>d&&b<h){l(d,b-10,f,m),l(b+10,h,f,m);return}let w=Fwe(t,b=>b.from>=f.from&&b.to<=f.to&&Math.abs(b.from-d)<i&&Math.abs(b.to-h)<i&&!y.some(v=>b.from<v&&b.to>v));if(!w){if(h<f.to&&n&&s&&n.visibleRanges.some(x=>x.from<=h&&x.to>=h)){let x=n.moveToLineBoundary(Ve.cursor(h),!1,!0).head;x>d&&(h=x)}let b=this.gapSize(f,d,h,m),v=s||b<2e6?b:2e6;w=new t4(d,h,b,v)}a.push(w)},c=d=>{if(d.length<o||d.type!=qi.Text)return;let h=zwe(d.from,d.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,m,p;if(s){let y=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,w,b;if(f!=null){let v=S1(h,f),x=((this.visibleBottom-this.visibleTop)/2+y)/d.height;w=v-x,b=v+x}else w=(this.visibleTop-d.top-y)/d.height,b=(this.visibleBottom-d.top+y)/d.height;m=k1(h,w),p=k1(h,b)}else{let y=h.total*this.heightOracle.charWidth,w=r*this.heightOracle.charWidth,b=0;if(y>2e6)for(let k of t)k.from>=d.from&&k.from<d.to&&k.size!=k.displaySize&&k.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=k.size-k.displaySize);let v=this.pixelViewport.left+b,x=this.pixelViewport.right+b,_,E;if(f!=null){let k=S1(h,f),M=((x-v)/2+w)/y;_=k-M,E=k+M}else _=(v-w)/y,E=(x+w)/y;m=k1(h,_),p=k1(h,E)}m>d.from&&l(d.from,m,d,h),p<d.to&&l(p,d.to,d,h)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(c):c(d);return a}gapSize(t,n,s,r){let i=S1(r,s)-S1(r,n);return this.heightOracle.lineWrapping?t.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(t){t4.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=qn.set(t.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let s=[];ys.spans(n,this.viewport.from,this.viewport.to,{span(i,o){s.push({from:i,to:o})},point(){}},20);let r=0;if(s.length!=this.visibleRanges.length)r=12;else for(let i=0;i<s.length&&!(r&8);i++){let o=this.visibleRanges[i],a=s[i];(o.from!=a.from||o.to!=a.to)&&(r|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(r|=8))}return this.visibleRanges=s,r}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||a0(this.heightMap.lineAt(t,Ls.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||a0(this.heightMap.lineAt(this.scaler.fromDOM(t),Ls.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return a0(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class _1{constructor(t,n){this.from=t,this.to=n}}function zwe(e,t,n){let s=[],r=e,i=0;return ys.spans(n,e,t,{span(){},point(o,a){o>r&&(s.push({from:r,to:o}),i+=o-r),r=a}},20),r<t&&(s.push({from:r,to:t}),i+=t-r),{total:i,ranges:s}}function k1({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let s=Math.floor(e*n);for(let r=0;;r++){let{from:i,to:o}=t[r],a=o-i;if(s<=a)return i+s;s-=a}}function S1(e,t){let n=0;for(let{from:s,to:r}of e.ranges){if(t<=r){n+=t-s;break}n+=r-s}return n/e.total}function Fwe(e,t){for(let n of e)if(t(n))return n}const eM={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function tM(e){let t=e.facet(cw).filter(s=>typeof s!="function"),n=e.facet(z6).filter(s=>typeof s!="function");return n.length&&t.push(ys.join(n)),t}class U6{constructor(t,n,s){let r=0,i=0,o=0;this.viewports=s.map(({from:a,to:l})=>{let c=n.lineAt(a,Ls.ByPos,t,0,0).top,d=n.lineAt(l,Ls.ByPos,t,0,0).bottom;return r+=d-c,{from:a,to:l,top:c,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let a of this.viewports)a.domTop=o+(a.top-i)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return r+(t-s)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);s=i.bottom,r=i.domBottom}}fromDOM(t){for(let n=0,s=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return s+(t-r)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);s=i.bottom,r=i.domBottom}}eq(t){return t instanceof U6?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,s)=>n.from==t.viewports[s].from&&n.to==t.viewports[s].to):!1}}function a0(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),s=t.toDOM(e.bottom);return new Sa(e.from,e.length,n,s-n,Array.isArray(e._content)?e._content.map(r=>a0(r,t)):e._content)}const T1=Gt.define({combine:e=>e.join(" ")}),Tk=Gt.define({combine:e=>e.indexOf(!0)>-1}),Ck=Ru.newName(),H$=Ru.newName(),U$=Ru.newName(),V$={"&light":"."+H$,"&dark":"."+U$};function Ak(e,t,n){return new Ru(t,{finish(s){return/&/.test(s)?s.replace(/&\w*/,r=>{if(r=="&")return e;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):e+" "+s}})}const qwe=Ak("."+Ck,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},V$),Hwe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},n4=St.ie&&St.ie_version<=11;class Uwe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new wve,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let s of n)this.queue.push(s);(St.ie&&St.ie_version<=11||St.ios&&t.composing)&&n.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&St.android&&t.constructor.EDIT_CONTEXT!==!1&&!(St.chrome&&St.chrome_version<126)&&(this.editContext=new Wwe(t),t.state.facet(Wl)&&(t.contentDOM.editContext=this.editContext.editContext)),n4&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,s)=>n!=t[s]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:s}=this,r=this.selectionRange;if(s.state.facet(Wl)?s.root.activeElement!=this.dom:!H0(this.dom,r))return;let i=r.anchorNode&&s.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(St.ie&&St.ie_version<=11||St.android&&St.chrome)&&!s.state.selection.main.empty&&r.focusNode&&V0(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Sp(t.root);if(!n)return!1;let s=St.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&Vwe(this.view,n)||n;if(!s||this.selectionRange.eq(s))return!1;let r=H0(this.dom,s);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&_ve(this.dom,s)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(s),r&&(this.selectionChanged=!0),!0)}setSelectionRange(t,n){this.selectionRange.set(t.node,t.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,n=null;for(let s=this.dom;s;)if(s.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==s?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);for(let s of this.scrollTargets=n)s.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Hwe),n4&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),n4&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var s;if(!this.delayedAndroidKey){let r=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&vf(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((s=this.delayedAndroidKey)===null||s===void 0)&&s.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,s=-1,r=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(r=!0),n==-1?{from:n,to:s}=o:(n=Math.min(o.from,n),s=Math.max(o.to,s)))}return{from:n,to:s,typeOver:r}}readChange(){let{from:t,to:n,typeOver:s}=this.processRecords(),r=this.selectionChanged&&H0(this.dom,this.selectionRange);if(t<0&&!r)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new cwe(this.view,t,n,s);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let s=this.view.state,r=j$(this.view,n);return this.view.state==s&&(n.domChanged||n.newSel&&!Ub(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let s=nM(n,t.previousSibling||t.target.previousSibling,-1),r=nM(n,t.nextSibling||t.target.nextSibling,1);return{from:s?n.posAfter(s):n.posAtStart,to:r?n.posBefore(r):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(Wl)!=t.state.facet(Wl)&&(t.view.contentDOM.editContext=t.state.facet(Wl)?this.editContext.editContext:null))}destroy(){var t,n,s;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(s=this.resizeScroll)===null||s===void 0||s.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function nM(e,t,n){for(;t;){let s=cr.get(t);if(s&&s.parent==e)return s;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function sM(e,t){let n=t.startContainer,s=t.startOffset,r=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return V0(o.node,o.offset,r,i)&&([n,s,r,i]=[r,i,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:i}}function Vwe(e,t){if(t.getComposedRanges){let r=t.getComposedRanges(e.root)[0];if(r)return sM(e,r)}let n=null;function s(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",s,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",s,!0),n?sM(e,n):null}class Wwe{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=s=>{let r=t.state.selection.main,{anchor:i,head:o}=r,a=this.toEditorPos(s.updateRangeStart),l=this.toEditorPos(s.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:s.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>s.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let d=R$(t.state.sliceDoc(a,l),s.text,(c?r.from:r.to)-a,c?"end":null);if(!d){let f=Ve.single(this.toEditorPos(s.selectionStart),this.toEditorPos(s.selectionEnd));Ub(f,r)||t.dispatch({selection:f,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:Qn.of(s.text.slice(d.from,d.toB).split(`
`))};if((St.mac||St.android)&&h.from==o-1&&/^\. ?$/.test(s.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Qn.of([s.text.replace("."," ")])}),this.pendingContextChange=h,!t.state.readOnly){let f=this.to-this.from+(h.to-h.from+h.insert.length);q6(t,h,Ve.single(this.toEditorPos(s.selectionStart,f),this.toEditorPos(s.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),h.from<h.to&&!h.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,s.updateRangeStart-1),Math.min(n.text.length,s.updateRangeStart+1)))&&this.handlers.compositionend(s)},this.handlers.characterboundsupdate=s=>{let r=[],i=null;for(let o=this.toEditorPos(s.rangeStart),a=this.toEditorPos(s.rangeEnd);o<a;o++){let l=t.coordsForChar(o);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,r.push(i)}n.updateCharacterBounds(s.rangeStart,r)},this.handlers.textformatupdate=s=>{let r=[];for(let i of s.getTextFormats()){let o=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;r.push(qn.mark({attributes:{style:d}}).range(l,c))}}}t.dispatch({effects:k$.of(qn.set(r))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:s}=this.composing;this.composing=null,s&&this.reset(t.state)}};for(let s in this.handlers)n.addEventListener(s,this.handlers[s]);this.measureReq={read:s=>{this.editContext.updateControlBounds(s.contentDOM.getBoundingClientRect());let r=Sp(s.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,s=!1,r=this.pendingContextChange;return t.changes.iterChanges((i,o,a,l,c)=>{if(s)return;let d=c.length-(o-i);if(r&&o>=r.to)if(r.from==i&&r.to==o&&r.insert.eq(c)){r=this.pendingContextChange=null,n+=d,this.to+=d;return}else r=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){s=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=d}n+=d}),r&&!s&&this.revertPending(t.state),!s}update(t){let n=this.pendingContextChange,s=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(s.from,s.to)&&t.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,s=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=s||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(s,r)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to<t.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let s=this.composing;return s&&s.drifted?s.editorBase+(t-s.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Pt{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:s}=t;this.dispatchTransactions=t.dispatchTransactions||s&&(r=>r.forEach(i=>s(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||xve(t.parent)||document,this.viewState=new ZE(this,t.state||ms.create(t)),t.scrollTo&&t.scrollTo.is(v1)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Zh).map(r=>new Qx(r));for(let r of this.plugins)r.update(this);this.observer=new Uwe(this),this.inputState=new fwe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new zE(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof Or?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,s=!1,r,i=this.state;for(let f of t){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;t.some(f=>f.annotation($$))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=z$(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,d=null;if(c?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(d=null)):this.observer.clear(),i.facet(ms.phrases)!=this.state.facet(ms.phrases))return this.setState(i);r=Fb.create(this,i,t),r.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:m}=f.state.selection,{x:p,y}=this.state.facet(Pt.cursorScrollMargin);h=new wf(m.empty?m:Ve.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",y,p)}for(let m of f.effects)m.is(v1)&&(h=m.value.clip(this.state))}this.viewState.update(r,h),this.bidiCache=Wb.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(o0)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(T1)!=r.state.facet(T1)&&(this.viewState.mustMeasureContent=!0),(n||s||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(wk))try{f(r)}catch(m){So(this.state,m,"update listener")}(l||d)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),d&&!j$(this,d)&&c.force&&vf(this.contentDOM,c.key,c.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let s of this.plugins)s.destroy(this);this.viewState=new ZE(this,t),this.plugins=t.facet(Zh).map(s=>new Qx(s)),this.pluginMap.clear();for(let s of this.plugins)s.update(this);this.docView.destroy(),this.docView=new zE(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Zh),s=t.state.facet(Zh);if(n!=s){let r=[];for(let i of s){let o=n.indexOf(i);if(o<0)r.push(new Qx(i));else{let a=this.plugins[o];a.mustUpdate=t,r.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=t;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);n!=s&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(s){So(this.state,s,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,s=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(o$(s||this.win))i=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(r);i=m.from,o=m.top}this.updateState=1;let l=this.viewState.measure();if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let d=c.map(m=>{try{return m.read(this)}catch(p){return So(this.state,p),rM}}),h=Fb.create(this,this.state,[]),f=!1;h.flags|=l,n?n.flags|=l:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let m=0;m<c.length;m++)if(d[m]!=rM)try{let p=c[m];p.write&&p.write(d[m],this)}catch(p){So(this.state,p)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o)/this.scaleY;if((p>1||p<-1)&&(s==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+p,s?s.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(wk))a(n)}get themeClasses(){return Ck+" "+(this.state.facet(Tk)?U$:H$)+" "+this.state.facet(T1)}updateAttrs(){let t=iM(this,S$,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Wl)?"true":"false",class:"cm-content",style:`${St.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),iM(this,$6,n);let s=this.observer.ignore(()=>{let r=LE(this.contentDOM,this.contentAttrs,n),i=LE(this.dom,this.editorAttrs,t);return r||i});return this.editorAttrs=t,this.contentAttrs=n,s}showAnnouncements(t){let n=!0;for(let s of t)for(let r of s.effects)if(r.is(Pt.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(o0);let t=this.state.facet(Pt.cspNonce);Ru.mount(this.root,this.styleModules.concat(qwe).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key){this.measureRequests[n]=t;return}}this.measureRequests.push(t)}}plugin(t){let n=this.pluginMap.get(t);return(n===void 0||n&&n.plugin!=t)&&this.pluginMap.set(t,n=this.plugins.find(s=>s.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,s){return e4(this,t,FE(this,t,n,s))}moveByGroup(t,n){return e4(this,t,FE(this,t,n,s=>swe(this,t.head,s)))}visualLineSide(t,n){let s=this.bidiSpans(t),r=this.textDirectionAt(t.from),i=s[n?s.length-1:0];return Ve.cursor(i.side(n,r)+t.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(t,n,s=!0){return nwe(this,t,n,s)}moveVertically(t,n,s){return e4(this,t,rwe(this,t,n,s))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let s=kk(this,t,n);return s&&s.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),kk(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let s=this.docView.coordsAt(t,n);if(!s||s.left==s.right)return s;let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),o=i[cl.find(i,t-r.from,-1,n)];return Tp(s,o.dir==qs.LTR==n>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(w$)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Gwe)return h$(t.length);let n=this.textDirectionAt(t.from),s;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||d$(i.isolates,s=BE(this,t))))return i.order;s||(s=BE(this,t));let r=Mve(t.text,n,s);return this.bidiCache.push(new Wb(t.from,t.to,n,s,!0,r)),r}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||St.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{i$(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var s,r,i,o;return v1.of(new wf(typeof t=="number"?Ve.cursor(t):t,(s=n.y)!==null&&s!==void 0?s:"nearest",(r=n.x)!==null&&r!==void 0?r:"nearest",(i=n.yMargin)!==null&&i!==void 0?i:5,(o=n.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,s=this.viewState.scrollAnchorAt(t);return v1.of(new wf(Ve.cursor(s.from),"start","start",s.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return lo.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return lo.define(()=>({}),{eventObservers:t})}static theme(t,n){let s=Ru.newName(),r=[T1.of(s),o0.of(Ak(`.${s}`,t))];return n&&n.dark&&r.push(Tk.of(!0)),r}static baseTheme(t){return uh.lowest(o0.of(Ak("."+Ck,t,V$)))}static findFromDOM(t){var n;let s=t.querySelector(".cm-content"),r=s&&cr.get(s)||cr.get(t);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}Pt.styleModule=o0;Pt.inputHandler=b$;Pt.clipboardInputFilter=B6;Pt.clipboardOutputFilter=P6;Pt.scrollHandler=_$;Pt.focusChangeEffect=v$;Pt.perLineTextDirection=w$;Pt.exceptionSink=y$;Pt.updateListener=wk;Pt.editable=Wl;Pt.mouseSelectionStyle=g$;Pt.dragMovesSelection=p$;Pt.clickAddsSelectionRange=m$;Pt.decorations=cw;Pt.blockWrappers=T$;Pt.outerDecorations=z6;Pt.atomicRanges=hg;Pt.bidiIsolatedRanges=C$;Pt.cursorScrollMargin=Gt.define({combine:e=>{let t=5,n=5;for(let s of e)typeof s=="number"?t=n=s:{x:t,y:n}=s;return{x:t,y:n}}});Pt.scrollMargins=A$;Pt.darkTheme=Tk;Pt.cspNonce=Gt.define({combine:e=>e.length?e[0]:""});Pt.contentAttributes=$6;Pt.editorAttributes=S$;Pt.lineWrapping=Pt.contentAttributes.of({class:"cm-lineWrapping"});Pt.announce=_s.define();const Gwe=4096,rM={};class Wb{constructor(t,n,s,r,i,o){this.from=t,this.to=n,this.dir=s,this.isolates=r,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let s=[],r=t.length?t[t.length-1].dir:qs.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==r&&!n.touchesRange(o.from,o.to)&&s.push(new Wb(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return s}}function iM(e,t,n){for(let s=e.state.facet(t),r=s.length-1;r>=0;r--){let i=s[r],o=typeof i=="function"?i(e):i;o&&L6(o,n)}return n}const Kwe=St.mac?"mac":St.windows?"win":St.linux?"linux":"key";function Ywe(e,t){const n=e.split(/-(?!$)/);let s=n[n.length-1];s=="Space"&&(s=" ");let r,i,o,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))t=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(s="Alt-"+s),i&&(s="Ctrl-"+s),a&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function C1(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n!==!1&&t.shiftKey&&(e="Shift-"+e),e}const Qwe=uh.default(Pt.domEventHandlers({keydown(e,t){return e2e(Xwe(t.state),e,t,"editor")}})),Ap=Gt.define({enables:Qwe}),oM=new WeakMap;function Xwe(e){let t=e.facet(Ap),n=oM.get(t);return n||oM.set(t,n=Zwe(t.reduce((s,r)=>s.concat(r),[]))),n}let Yc=null;const Jwe=4e3;function Zwe(e,t=Kwe){let n=Object.create(null),s=Object.create(null),r=(o,a)=>{let l=s[o];if(l==null)s[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},i=(o,a,l,c,d)=>{var h,f;let m=n[o]||(n[o]=Object.create(null)),p=a.split(/ (?!$)/).map(b=>Ywe(b,t));for(let b=1;b<p.length;b++){let v=p.slice(0,b).join(" ");r(v,!0),m[v]||(m[v]={preventDefault:!0,stopPropagation:!1,run:[x=>{let _=Yc={view:x,prefix:v,scope:o};return setTimeout(()=>{Yc==_&&(Yc=null)},Jwe),!0}]})}let y=p.join(" ");r(y,!1);let w=m[y]||(m[y]={preventDefault:!1,stopPropagation:!1,run:((f=(h=m._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),d&&(w.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let d=n[c]||(n[c]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in d)d[f].run.push(m=>h(m,Ek))}let l=o[t]||o.key;if(l)for(let c of a)i(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let Ek=null;function e2e(e,t,n,s){Ek=t;let r=mve(t),i=zc(r,0),o=Bh(i)==r.length&&r!=" ",a="",l=!1,c=!1,d=!1;Yc&&Yc.view==n&&Yc.scope==s&&(a=Yc.prefix+" ",D$.indexOf(t.keyCode)<0&&(c=!0,Yc=null));let h=new Set,f=w=>{if(w){for(let b of w.run)if(!h.has(b)&&(h.add(b),b(n)))return w.stopPropagation&&(d=!0),!0;w.preventDefault&&(w.stopPropagation&&(d=!0),c=!0)}return!1},m=e[s],p,y;return m&&(f(m[a+C1(r,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(St.windows&&t.ctrlKey&&t.altKey)&&!(St.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Lu[t.keyCode])&&p!=r?(f(m[a+C1(p,t,!0)])||t.shiftKey&&(y=_p[t.keyCode])!=r&&y!=p&&f(m[a+C1(y,t,!1)]))&&(l=!0):o&&t.shiftKey&&f(m[a+C1(r,t,!0)])&&(l=!0),!l&&f(m._any)&&(l=!0)),c&&(l=!0),l&&d&&t.stopPropagation(),Ek=null,l}class Rd{constructor(t,n,s,r,i){this.className=t,this.left=n,this.top=s,this.width=r,this.height=i}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,s){if(s.empty){let r=t.coordsAtPos(s.head,s.assoc||1);if(!r)return[];let i=W$(t);return[new Rd(n,r.left-i.left,r.top-i.top,null,r.bottom-r.top)]}else return t2e(t,n,s)}}function W$(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==qs.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function aM(e,t,n,s){let r=e.coordsAtPos(t,n*2);if(!r)return s;let i=e.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,a=e.posAtCoords({x:i.left+1,y:o}),l=e.posAtCoords({x:i.right-1,y:o});return a==null||l==null?s:{from:Math.max(s.from,Math.min(a,l)),to:Math.min(s.to,Math.max(a,l))}}function t2e(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let s=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),i=e.textDirection==qs.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=W$(e),c=o.querySelector(".cm-line"),d=c&&window.getComputedStyle(c),h=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),f=a.right-(d?parseInt(d.paddingRight):0),m=_k(e,s,1),p=_k(e,r,-1),y=m.type==qi.Text?m:null,w=p.type==qi.Text?p:null;if(y&&(e.lineWrapping||m.widgetLineBreaks)&&(y=aM(e,s,1,y)),w&&(e.lineWrapping||p.widgetLineBreaks)&&(w=aM(e,r,-1,w)),y&&w&&y.from==w.from&&y.to==w.to)return v(x(n.from,n.to,y));{let E=y?x(n.from,null,y):_(m,!1),k=w?x(null,n.to,w):_(p,!0),M=[];return(y||m).to<(w||p).from-(y&&w?1:0)||m.widgetLineBreaks>1&&E.bottom+e.defaultLineHeight/2<k.top?M.push(b(h,E.bottom,f,k.top)):E.bottom<k.top&&e.elementAtHeight((E.bottom+k.top)/2).type==qi.Text&&(E.bottom=k.top=(E.bottom+k.top)/2),v(E).concat(M).concat(v(k))}function b(E,k,M,R){return new Rd(t,E-l.left,k-l.top,Math.max(0,M-E),R-k)}function v({top:E,bottom:k,horizontal:M}){let R=[];for(let L=0;L<M.length;L+=2)R.push(b(M[L],E,M[L+1],k));return R}function x(E,k,M){let R=1e9,L=-1e9,T=[];function N(U,F,j,V,ee){let ce=e.coordsAtPos(U,U==M.to?-2:2),$=e.coordsAtPos(j,j==M.from?2:-2);!ce||!$||(R=Math.min(ce.top,$.top,R),L=Math.max(ce.bottom,$.bottom,L),ee==qs.LTR?T.push(i&&F?h:ce.left,i&&V?f:$.right):T.push(!i&&V?h:$.left,!i&&F?f:ce.right))}let I=E??M.from,O=k??M.to;for(let U of e.visibleRanges)if(U.to>I&&U.from<O)for(let F=Math.max(U.from,I),j=Math.min(U.to,O);;){let V=e.state.doc.lineAt(F);for(let ee of e.bidiSpans(V)){let ce=ee.from+V.from,$=ee.to+V.from;if(ce>=j)break;$>F&&N(Math.max(ce,F),E==null&&ce<=I,Math.min($,j),k==null&&$>=O,ee.dir)}if(F=V.to+1,F>=j)break}return T.length==0&&N(I,E==null,O,k==null,e.textDirection),{top:R,bottom:L,horizontal:T}}function _(E,k){let M=a.top+(k?E.top:E.bottom);return{top:M,bottom:M,horizontal:[]}}}function n2e(e,t){return e.constructor==t.constructor&&e.eq(t)}class s2e{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(wy)!=t.state.facet(wy)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,s=t.facet(wy);for(;n<s.length&&s[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:n}=this.view;(t!=this.scaleX||n!=this.scaleY)&&(this.scaleX=t,this.scaleY=n,this.dom.style.transform=`scale(${1/t}, ${1/n})`)}draw(t){if(t.length!=this.drawn.length||t.some((n,s)=>!n2e(n,this.drawn[s]))){let n=this.dom.firstChild,s=0;for(let r of t)r.update&&n&&r.constructor&&this.drawn[s].constructor&&r.update(n,this.drawn[s])?(n=n.nextSibling,s++):this.dom.insertBefore(r.draw(),n);for(;n;){let r=n.nextSibling;n.remove(),n=r}this.drawn=t,St.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const wy=Gt.define();function G$(e){return[lo.define(t=>new s2e(t,e)),wy.of(e)]}const Vf=Gt.define({combine(e){return aw(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function r2e(e={}){return[Vf.of(e),i2e,o2e,a2e,x$.of(!0)]}function K$(e){return e.startState.facet(Vf)!=e.state.facet(Vf)}const i2e=G$({above:!0,markers(e){let{state:t}=e,n=t.facet(Vf),s=[];for(let r of t.selection.ranges){let i=r==t.selection.main;if(r.empty||n.drawRangeCursor&&!(i&&St.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=r.empty?r:Ve.cursor(r.head,r.assoc);for(let l of Rd.forRange(e,o,a))s.push(l)}}return s},update(e,t){e.transactions.some(s=>s.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=K$(e);return n&&lM(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){lM(t.state,e)},class:"cm-cursorLayer"});function lM(e,t){t.style.animationDuration=e.facet(Vf).cursorBlinkRate+"ms"}const o2e=G$({above:!1,markers(e){let t=[],{main:n,ranges:s}=e.state.selection;for(let r of s)if(!r.empty)for(let i of Rd.forRange(e,"cm-selectionBackground",r))t.push(i);if(St.ios&&!n.empty&&e.state.facet(Vf).iosSelectionHandles){for(let r of Rd.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Ve.cursor(n.from,1)))t.push(r);for(let r of Rd.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Ve.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||K$(e)},class:"cm-selectionLayer"}),a2e=uh.highest(Pt.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function cM(e,t,n,s,r){t.lastIndex=0;for(let i=e.iterRange(n,s),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=t.exec(i.value);)r(o+a.index,a)}function l2e(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let s=[];for(let{from:r,to:i}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),s.length&&s[s.length-1].to>=r?s[s.length-1].to=i:s.push({from:r,to:i});return s}class c2e{constructor(t){const{regexp:n,decoration:s,decorate:r,boundary:i,maxLength:o=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=(a,l,c,d)=>r(d,c,c+a[0].length,a,l);else if(typeof s=="function")this.addMatch=(a,l,c,d)=>{let h=s(a,l,c);h&&d(c,c+a[0].length,h)};else if(s)this.addMatch=(a,l,c,d)=>d(c,c+a[0].length,s);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new Wd,s=n.add.bind(n);for(let{from:r,to:i}of l2e(t,this.maxLength))cM(t.state.doc,this.regexp,r,i,(o,a)=>this.addMatch(a,t,o,s));return n.finish()}updateDeco(t,n){let s=1e9,r=-1;return t.docChanged&&t.changes.iterChanges((i,o,a,l)=>{l>=t.view.viewport.from&&a<=t.view.viewport.to&&(s=Math.min(a,s),r=Math.max(l,r))}),t.viewportMoved||r-s>1e3?this.createDeco(t.view):r>-1?this.updateRange(t.view,n.map(t.changes),s,r):n}updateRange(t,n,s,r){for(let i of t.visibleRanges){let o=Math.max(i.from,s),a=Math.min(i.to,r);if(a>=o){let l=t.state.doc.lineAt(o),c=l.to<a?t.state.doc.lineAt(a):l,d=Math.max(i.from,l.from),h=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){d=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let f=[],m,p=(y,w,b)=>f.push(b.range(y,w));if(l==c)for(this.regexp.lastIndex=d-l.from;(m=this.regexp.exec(l.text))&&m.index<h-l.from;)this.addMatch(m,t,m.index+l.from,p);else cM(t.state.doc,this.regexp,d,h,(y,w)=>this.addMatch(w,t,y,p));n=n.update({filterFrom:d,filterTo:h,filter:(y,w)=>y<d||w>h,add:f})}}return n}}const Mk=/x/.unicode!=null?"gu":"g",u2e=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,Mk),d2e={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let s4=null;function h2e(){var e;if(s4==null&&typeof document<"u"&&document.body){let t=document.body.style;s4=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return s4||!1}const xy=Gt.define({combine(e){let t=aw(e,{render:null,specialChars:u2e,addSpecialChars:null});return(t.replaceTabs=!h2e())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,Mk)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Mk)),t}});function f2e(e={}){return[xy.of(e),m2e()]}let uM=null;function m2e(){return uM||(uM=lo.fromClass(class{constructor(e){this.view=e,this.decorations=qn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(xy)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new c2e({regexp:e.specialChars,decoration:(t,n,s)=>{let{doc:r}=n.state,i=zc(t[0],0);if(i==9){let o=r.lineAt(s),a=n.state.tabSize,l=cg(o.text,a,s-o.from);return qn.replace({widget:new b2e((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=qn.replace({widget:new y2e(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(xy);e.startState.facet(xy)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const p2e="•";function g2e(e){return e>=32?p2e:e==10?"␤":String.fromCharCode(9216+e)}class y2e extends Al{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=g2e(this.code),s=t.state.phrase("Control character")+" "+(d2e[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,s,n);if(r)return r;let i=document.createElement("span");return i.textContent=n,i.title=s,i.setAttribute("aria-label",s),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class b2e extends Al{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="	",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}class v2e extends Al{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?U0(t.firstChild):[];if(!n.length)return null;let s=window.getComputedStyle(t.parentNode),r=Tp(n[0],s.direction!="rtl"),i=parseInt(s.lineHeight);return r.bottom-r.top>i*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+i}:r}ignoreEvent(){return!1}}function dM(e){let t=lo.fromClass(class{constructor(n){this.view=n,this.placeholder=e?qn.set([qn.widget({widget:new v2e(e),side:1}).range(0)]):qn.none}get decorations(){return this.view.state.doc.length?qn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Pt.contentAttributes.of({"aria-placeholder":e})]:t}const A1="-10000px";class w2e{constructor(t,n,s,r){this.facet=n,this.createTooltipView=s,this.removeTooltipView=r,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=s(o,i))}update(t,n){var s;let r=t.state.facet(this.facet),i=r.filter(l=>l);if(r===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let o=[],a=n?[]:null;for(let l=0;l<i.length;l++){let c=i[l],d=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(d=h)}if(d<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[d];a&&(a[l]=n[d]),h.update&&h.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(s=l.destroy)===null||s===void 0||s.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=r,this.tooltips=i,this.tooltipViews=o,!0}}function x2e(e={}){return _y.of(e)}function _2e(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const _y=Gt.define({combine:e=>{var t,n,s;return{position:St.ios?"absolute":((t=e.find(r=>r.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(r=>r.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((s=e.find(r=>r.tooltipSpace))===null||s===void 0?void 0:s.tooltipSpace)||_2e}}}),hM=new WeakMap,Y$=lo.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(_y);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new w2e(e,Q$,(n,s)=>this.createTooltip(n,s),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,s=e.state.facet(_y);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;n=!0}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),s=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=A1,n.dom.style.left="0px",this.container.insertBefore(n.dom,s),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let s of this.manager.tooltipViews)s.dom.remove(),(e=s.destroy)===null||e===void 0||e.call(s);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(St.safari){let o=i.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let s=this.view.scrollDOM.getBoundingClientRect(),r=F6(this.view);return{visible:{left:s.left+r.left,top:s.top+r.top,right:s.right-r.right,bottom:s.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(_y).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:s,scaleX:r,scaleY:i}=e,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:d}=c,h=e.pos[a],f=e.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(n.top,s.top)||h.top>=Math.min(n.bottom,s.bottom)||h.right<Math.max(n.left,s.left)-.1||h.left>Math.min(n.right,s.right)+.1)){d.style.top=A1;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=m?7:0,y=f.right-f.left,w=(t=hM.get(c))!==null&&t!==void 0?t:f.bottom-f.top,b=c.offset||S2e,v=this.view.textDirection==qs.LTR,x=f.width>s.right-s.left?v?s.left:s.right-f.width:v?Math.max(s.left,Math.min(h.left-(m?14:0)+b.x,s.right-y)):Math.min(Math.max(s.left,h.left-y+(m?14:0)-b.x),s.right-y),_=this.above[a];!l.strictSide&&(_?h.top-w-p-b.y<s.top:h.bottom+w+p+b.y>s.bottom)&&_==s.bottom-h.bottom>h.top-s.top&&(_=this.above[a]=!_);let E=(_?h.top-s.top:s.bottom-h.bottom)-p;if(E<w&&c.resize!==!1){if(E<this.view.defaultLineHeight){d.style.top=A1;continue}hM.set(c,w),d.style.height=(w=E)/i+"px"}else d.style.height&&(d.style.height="");let k=_?h.top-w-p-b.y:h.bottom+p+b.y,M=x+y;if(c.overlap!==!0)for(let R of o)R.left<M&&R.right>x&&R.top<k+w&&R.bottom>k&&(k=_?R.top-w-2-p:R.bottom+p+2);if(this.position=="absolute"?(d.style.top=(k-e.parent.top)/i+"px",fM(d,(x-e.parent.left)/r)):(d.style.top=k/i+"px",fM(d,x/r)),m){let R=h.left+(v?b.x:-b.x)-(x+14-7);m.style.left=R/r+"px"}c.overlap!==!0&&o.push({left:x,top:k,right:M,bottom:k+w}),d.classList.toggle("cm-tooltip-above",_),d.classList.toggle("cm-tooltip-below",!_),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=A1}},{eventObservers:{scroll(){this.maybeMeasure()}}});function fM(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const k2e=Pt.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),S2e={x:0,y:0},Q$=Gt.define({enables:[Y$,k2e]});function X$(e,t){let n=e.plugin(Y$);if(!n)return null;let s=n.manager.tooltips.indexOf(t);return s<0?null:n.manager.tooltipViews[s]}class Wf extends ju{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Wf.prototype.elementClass="";Wf.prototype.toDOM=void 0;Wf.prototype.mapMode=xo.TrackBefore;Wf.prototype.startSide=Wf.prototype.endSide=-1;Wf.prototype.point=!0;const T2e=1024;let C2e=0;class r4{constructor(t,n){this.from=t,this.to=n}}class Kn{constructor(t={}){this.id=C2e++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=ua.match(t)),n=>{let s=t(n);return s===void 0?null:[this,s]}}}Kn.closedBy=new Kn({deserialize:e=>e.split(" ")});Kn.openedBy=new Kn({deserialize:e=>e.split(" ")});Kn.group=new Kn({deserialize:e=>e.split(" ")});Kn.isolate=new Kn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Kn.contextHash=new Kn({perNode:!0});Kn.lookAhead=new Kn({perNode:!0});Kn.mounted=new Kn({perNode:!0});class G0{constructor(t,n,s,r=!1){this.tree=t,this.overlay=n,this.parser=s,this.bracketed=r}static get(t){return t&&t.props&&t.props[Kn.mounted.id]}}const A2e=Object.create(null);class ua{constructor(t,n,s,r=0){this.name=t,this.props=n,this.id=s,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):A2e,s=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),r=new ua(t.name||"",n,t.id,s);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(r)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return r}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(Kn.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let s in t)for(let r of s.split(" "))n[r]=t[s];return s=>{for(let r=s.prop(Kn.group),i=-1;i<(r?r.length:0);i++){let o=n[i<0?s.name:r[i]];if(o)return o}}}}ua.none=new ua("",Object.create(null),0,8);const E1=new WeakMap,mM=new WeakMap;var mr;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(mr||(mr={}));class oi{constructor(t,n,s,r,i){if(this.type=t,this.children=n,this.positions=s,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[o,a]of i)this.props[typeof o=="number"?o:o.id]=a}}toString(){let t=G0.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let s of this.children){let r=s.toString();r&&(n&&(n+=","),n+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new Ik(this.topNode,t)}cursorAt(t,n=0,s=0){let r=E1.get(this)||this.topNode,i=new Ik(r);return i.moveTo(t,n),E1.set(this,i._tree),i}get topNode(){return new oa(this,0,0,null)}resolve(t,n=0){let s=Ep(E1.get(this)||this.topNode,t,n,!1);return E1.set(this,s),s}resolveInner(t,n=0){let s=Ep(mM.get(this)||this.topNode,t,n,!0);return mM.set(this,s),s}resolveStack(t,n=0){return N2e(this,t,n)}iterate(t){let{enter:n,leave:s,from:r=0,to:i=this.length}=t,o=t.mode||0,a=(o&mr.IncludeAnonymous)>0;for(let l=this.cursor(o|mr.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=r&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&s&&(a||!l.type.isAnonymous)&&s(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:G6(ua.none,this.children,this.positions,0,this.children.length,0,this.length,(n,s,r)=>new oi(this.type,n,s,r,this.propValues),t.makeTree||((n,s,r)=>new oi(ua.none,n,s,r)))}static build(t){return I2e(t)}}oi.empty=new oi(ua.none,[],[],0);class V6{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new V6(this.buffer,this.index)}}class Ou{constructor(t,n,s){this.buffer=t,this.length=n,this.set=s}get type(){return ua.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],s=this.buffer[t+3],r=this.set.types[n],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),t+=4,s==t)return i;let o=[];for(;t<s;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,s,r,i){let{buffer:o}=this,a=-1;for(let l=t;l!=n&&!(J$(i,r,o[l+1],o[l+2])&&(a=l,s>0));l=o[l+3]);return a}slice(t,n,s){let r=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,l=0;a<n;){i[l++]=r[a++],i[l++]=r[a++]-s;let c=i[l++]=r[a++]-s;i[l++]=r[a++]-t,o=Math.max(o,c)}return new Ou(i,o,this.set)}}function J$(e,t,n,s){switch(e){case-2:return n<t;case-1:return s>=t&&n<t;case 0:return n<t&&s>t;case 1:return n<=t&&s>t;case 2:return s>t;case 4:return!0}}function Ep(e,t,n,s){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!s&&e instanceof oa&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=s?0:mr.IgnoreOverlays;if(s)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof oa&&o.index<0&&((r=a.enter(t,n,i))===null||r===void 0?void 0:r.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class Z${cursor(t=0){return new Ik(this,t)}getChild(t,n=null,s=null){let r=pM(this,t,n,s);return r.length?r[0]:null}getChildren(t,n=null,s=null){return pM(this,t,n,s)}resolve(t,n=0){return Ep(this,t,n,!1)}resolveInner(t,n=0){return Ep(this,t,n,!0)}matchContext(t){return Nk(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),s=this;for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(s=n,n=r.prevSibling):n=r}return s}get node(){return this}get next(){return this.parent}}class oa extends Z${constructor(t,n,s,r){super(),this._tree=t,this.from=n,this.index=s,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,s,r,i=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=n>0?a.length:-1;t!=c;t+=n){let d=a[t],h=l[t]+o.from,f;if(!(!(i&mr.EnterBracketed&&d instanceof oi&&(f=G0.get(d))&&!f.overlay&&f.bracketed&&s>=h&&s<=h+d.length)&&!J$(r,s,h,h+d.length))){if(d instanceof Ou){if(i&mr.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,s-h,r);if(m>-1)return new iu(new E2e(o,d,t,h),null,m)}else if(i&mr.IncludeAnonymous||!d.type.isAnonymous||W6(d)){let m;if(!(i&mr.IgnoreMounts)&&(m=G0.get(d))&&!m.overlay)return new oa(m.tree,h,t,o);let p=new oa(d,h,t,o);return i&mr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?d.children.length-1:0,n,s,r,i)}}}if(i&mr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+n:t=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,s=0){let r;if(!(s&mr.IgnoreOverlays)&&(r=G0.get(this._tree))&&r.overlay){let i=t-this.from,o=s&mr.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new oa(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,s)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function pM(e,t,n,s){let r=e.cursor(),i=[];if(!r.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=r.type.is(n),!r.nextSibling())return i}for(;;){if(s!=null&&r.type.is(s))return i;if(r.type.is(t)&&i.push(r.node),!r.nextSibling())return s==null?i:[]}}function Nk(e,t,n=t.length-1){for(let s=e;n>=0;s=s.parent){if(!s)return!1;if(!s.type.isAnonymous){if(t[n]&&t[n]!=s.name)return!1;n--}}return!0}class E2e{constructor(t,n,s,r){this.parent=t,this.buffer=n,this.index=s,this.start=r}}class iu extends Z${get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,s){super(),this.context=t,this._parent=n,this.index=s,this.type=t.buffer.set.types[t.buffer.buffer[s]]}child(t,n,s){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,s);return i<0?null:new iu(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,s=0){if(s&mr.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new iu(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new iu(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new iu(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:s}=this.context,r=this.index+4,i=s.buffer[this.index+3];if(i>r){let o=s.buffer[this.index+1];t.push(s.slice(r,i,o)),n.push(0)}return new oi(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ez(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let s=n instanceof oa&&n.index<0?null:n.parent,r=e.slice();return s?r[t]=s:r.splice(t,1),new M2e(r,n)}class M2e{constructor(t,n){this.heads=t,this.node=n}get next(){return ez(this.heads)}}function N2e(e,t,n){let s=e.resolveInner(t,n),r=null;for(let i=s instanceof oa?s:s.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(r||(r=[s])).push(o.resolve(t,n)),i=o}else{let o=G0.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new oa(o.tree,o.overlay[0].from+i.from,-1,i);(r||(r=[s])).push(Ep(a,t,n,!1))}}return r?ez(r):s}class Ik{get name(){return this.type.name}constructor(t,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~mr.EnterBracketed,t instanceof oa)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let s=t._parent;s;s=s._parent)this.stack.unshift(s.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:s,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[t]],this.from=s+r.buffer[t+1],this.to=s+r.buffer[t+2],!0}yield(t){return t?t instanceof oa?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,s){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,s,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.buffer.start,s);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,s=this.mode){return this.buffer?s&mr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,s))}parent(){if(!this.buffer)return this.yieldNode(this.mode&mr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&mr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,s=this.stack.length-1;if(t<0){let r=s<0?0:this.stack[s]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(s<0?n.buffer.length:n.buffer[this.stack[s]+3]))return this.yieldBuf(r)}return s<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,s,{buffer:r}=this;if(r){if(t>0){if(this.index<r.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(r.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:s}=r)}else({index:n,_parent:s}=this._tree);for(;s;{index:n,_parent:s}=s)if(n>-1)for(let i=n+t,o=t<0?-1:s._tree.children.length;i!=o;i+=t){let a=s._tree.children[i];if(this.mode&mr.IncludeAnonymous||a instanceof Ou||!a.type.isAnonymous||W6(a))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,n););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,n=null,s=0;if(t&&t.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==r){if(r==this.index)return o;n=o,s=i+1;break e}r=this.stack[--i]}for(let r=s;r<this.stack.length;r++)n=new iu(this.buffer,n,this.stack[r]);return this.bufferNode=new iu(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let s=0;;){let r=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){s++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&n&&n(this),r=this.type.isAnonymous,!s)return;if(this.nextSibling())break;this.parent(),s--,r=!0}}}matchContext(t){if(!this.buffer)return Nk(this.node.parent,t);let{buffer:n}=this.buffer,{types:s}=n.set;for(let r=t.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return Nk(this._tree,t,r);let o=s[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[r]&&t[r]!=o.name)return!1;r--}}return!0}}function W6(e){return e.children.some(t=>t instanceof Ou||!t.type.isAnonymous||W6(t))}function I2e(e){var t;let{buffer:n,nodeSet:s,maxBufferLength:r=T2e,reused:i=[],minRepeatType:o=s.types.length}=e,a=Array.isArray(n)?new V6(n,n.length):n,l=s.types,c=0,d=0;function h(E,k,M,R,L,T){let{id:N,start:I,end:O,size:U}=a,F=d,j=c;if(U<0)if(a.next(),U==-1){let J=i[N];M.push(J),R.push(I-E);return}else if(U==-3){c=N;return}else if(U==-4){d=N;return}else throw new RangeError(`Unrecognized record size: ${U}`);let V=l[N],ee,ce,$=I-E;if(O-I<=r&&(ce=w(a.pos-k,L))){let J=new Uint16Array(ce.size-ce.skip),B=a.pos-ce.size,C=J.length;for(;a.pos>B;)C=b(ce.start,J,C);ee=new Ou(J,O-ce.start,s),$=ce.start-E}else{let J=a.pos-U;a.next();let B=[],C=[],z=N>=o?N:-1,X=0,ae=O;for(;a.pos>J;)z>=0&&a.id==z&&a.size>=0?(a.end<=ae-r&&(p(B,C,I,X,a.end,ae,z,F,j),X=B.length,ae=a.end),a.next()):T>2500?f(I,J,B,C):h(I,J,B,C,z,T+1);if(z>=0&&X>0&&X<B.length&&p(B,C,I,X,I,ae,z,F,j),B.reverse(),C.reverse(),z>-1&&X>0){let be=m(V,j);ee=G6(V,B,C,0,B.length,0,O-I,be,be)}else ee=y(V,B,C,O-I,F-O,j)}M.push(ee),R.push($)}function f(E,k,M,R){let L=[],T=0,N=-1;for(;a.pos>k;){let{id:I,start:O,end:U,size:F}=a;if(F>4)a.next();else{if(N>-1&&O<N)break;N<0&&(N=U-r),L.push(I,O,U),T++,a.next()}}if(T){let I=new Uint16Array(T*4),O=L[L.length-2];for(let U=L.length-3,F=0;U>=0;U-=3)I[F++]=L[U],I[F++]=L[U+1]-O,I[F++]=L[U+2]-O,I[F++]=F;M.push(new Ou(I,L[2]-O,s)),R.push(O-E)}}function m(E,k){return(M,R,L)=>{let T=0,N=M.length-1,I,O;if(N>=0&&(I=M[N])instanceof oi){if(!N&&I.type==E&&I.length==L)return I;(O=I.prop(Kn.lookAhead))&&(T=R[N]+I.length+O)}return y(E,M,R,L,T,k)}}function p(E,k,M,R,L,T,N,I,O){let U=[],F=[];for(;E.length>R;)U.push(E.pop()),F.push(k.pop()+M-L);E.push(y(s.types[N],U,F,T-L,I-T,O)),k.push(L-M)}function y(E,k,M,R,L,T,N){if(T){let I=[Kn.contextHash,T];N=N?[I].concat(N):[I]}if(L>25){let I=[Kn.lookAhead,L];N=N?[I].concat(N):[I]}return new oi(E,k,M,R,N)}function w(E,k){let M=a.fork(),R=0,L=0,T=0,N=M.end-r,I={size:0,start:0,skip:0};e:for(let O=M.pos-E;M.pos>O;){let U=M.size;if(M.id==k&&U>=0){I.size=R,I.start=L,I.skip=T,T+=4,R+=4,M.next();continue}let F=M.pos-U;if(U<0||F<O||M.start<N)break;let j=M.id>=o?4:0,V=M.start;for(M.next();M.pos>F;){if(M.size<0)if(M.size==-3||M.size==-4)j+=4;else break e;else M.id>=o&&(j+=4);M.next()}L=V,R+=U,T+=j}return(k<0||R==E)&&(I.size=R,I.start=L,I.skip=T),I.size>4?I:void 0}function b(E,k,M){let{id:R,start:L,end:T,size:N}=a;if(a.next(),N>=0&&R<o){let I=M;if(N>4){let O=a.pos-(N-4);for(;a.pos>O;)M=b(E,k,M)}k[--M]=I,k[--M]=T-E,k[--M]=L-E,k[--M]=R}else N==-3?c=R:N==-4&&(d=R);return M}let v=[],x=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,v,x,-1,0);let _=(t=e.length)!==null&&t!==void 0?t:v.length?x[0]+v[0].length:0;return new oi(l[e.topID],v.reverse(),x.reverse(),_)}const gM=new WeakMap;function ky(e,t){if(!e.isAnonymous||t instanceof Ou||t.type!=e)return 1;let n=gM.get(t);if(n==null){n=1;for(let s of t.children){if(s.type!=e||!(s instanceof oi)){n=1;break}n+=ky(e,s)}gM.set(t,n)}return n}function G6(e,t,n,s,r,i,o,a,l){let c=0;for(let p=s;p<r;p++)c+=ky(e,t[p]);let d=Math.ceil(c*1.5/8),h=[],f=[];function m(p,y,w,b,v){for(let x=w;x<b;){let _=x,E=y[x],k=ky(e,p[x]);for(x++;x<b;x++){let M=ky(e,p[x]);if(k+M>=d)break;k+=M}if(x==_+1){if(k>d){let M=p[_];m(M.children,M.positions,0,M.children.length,y[_]+v);continue}h.push(p[_])}else{let M=y[x-1]+p[x-1].length-E;h.push(G6(e,p,y,_,x,E,M,null,l))}f.push(E+v-i)}}return m(t,n,s,r,0),(a||l)(h,f,o)}class Ld{constructor(t,n,s,r,i=!1,o=!1){this.from=t,this.to=n,this.tree=s,this.offset=r,this.open=(i?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],s=!1){let r=[new Ld(0,t.length,t,0,!1,s)];for(let i of n)i.to>t.length&&r.push(i);return r}static applyChanges(t,n,s=128){if(!n.length)return t;let r=[],i=1,o=t.length?t[0]:null;for(let a=0,l=0,c=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=s)for(;o&&o.from<h;){let f=o;if(l>=f.from||h<=f.to||c){let m=Math.max(f.from,l)-c,p=Math.min(f.to,h)-c;f=m>=p?null:new Ld(m,p,f.tree,f.offset+c,a>0,!!d)}if(f&&r.push(f),o.to>h)break;o=i<t.length?t[i++]:null}if(!d)break;l=d.toA,c=d.toA-d.toB}return r}}class j2e{startParse(t,n,s){return typeof t=="string"&&(t=new R2e(t)),s=s?s.length?s.map(r=>new r4(r.from,r.to)):[new r4(0,0)]:[new r4(0,t.length)],this.createParse(t,n||[],s)}parse(t,n,s){let r=this.startParse(t,n,s);for(;;){let i=r.advance();if(i)return i}}}class R2e{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}new Kn({perNode:!0});let L2e=0;class Yo{constructor(t,n,s,r){this.name=t,this.set=n,this.base=s,this.modified=r,this.id=L2e++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let s=typeof t=="string"?t:"?";if(t instanceof Yo&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new Yo(s,[],null,[]);if(r.set.push(r),n)for(let i of n.set)r.set.push(i);return r}static defineModifier(t){let n=new Gb(t);return s=>s.modified.indexOf(n)>-1?s:Gb.get(s.base||s,s.modified.concat(n).sort((r,i)=>r.id-i.id))}}let D2e=0;class Gb{constructor(t){this.name=t,this.instances=[],this.id=D2e++}static get(t,n){if(!n.length)return t;let s=n[0].instances.find(a=>a.base==t&&O2e(n,a.modified));if(s)return s;let r=[],i=new Yo(t.name,r,t,n);for(let a of n)a.instances.push(i);let o=B2e(n);for(let a of t.set)if(!a.modified.length)for(let l of o)r.push(Gb.get(a,l));return i}}function O2e(e,t){return e.length==t.length&&e.every((n,s)=>n==t[s])}function B2e(e){let t=[[]];for(let n=0;n<e.length;n++)for(let s=0,r=t.length;s<r;s++)t.push(t[s].concat(e[n]));return t.sort((n,s)=>s.length-n.length)}function P2e(e){let t=Object.create(null);for(let n in e){let s=e[n];Array.isArray(s)||(s=[s]);for(let r of n.split(" "))if(r){let i=[],o=2,a=r;for(let h=0;;){if(a=="..."&&h>0&&h+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+r);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==r.length)break;let m=r[h++];if(h==r.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+r);a=r.slice(h)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+r);let d=new Mp(s,o,l>0?i.slice(0,l):null);t[c]=d.sort(t[c])}}return tz.add(t)}const tz=new Kn({combine(e,t){let n,s,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let i=new Mp(r.tags,r.mode,r.context);n?n.next=i:s=i,n=i}return s}});class Mp{constructor(t,n,s,r){this.tags=t,this.mode=n,this.context=s,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}}Mp.empty=new Mp([],2,null);function nz(e,t){let n=Object.create(null);for(let i of e)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let o of i.tag)n[o.id]=i.class;let{scope:s,all:r=null}=t||{};return{style:i=>{let o=r;for(let a of i)for(let l of a.set){let c=n[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:s}}function $2e(e,t){let n=null;for(let s of e){let r=s.style(t);r&&(n=n?n+" "+r:r)}return n}function z2e(e,t,n,s=0,r=e.length){let i=new F2e(s,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),s,r,"",i.highlighters),i.flush(r)}class F2e{constructor(t,n,s){this.at=t,this.highlighters=n,this.span=s,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,s,r,i){let{type:o,from:a,to:l}=t;if(a>=s||l<=n)return;o.isTop&&(i=this.highlighters.filter(m=>!m.scope||m.scope(o)));let c=r,d=q2e(t)||Mp.empty,h=$2e(i,d.tags);if(h&&(c&&(c+=" "),c+=h,d.mode==1&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(n,a),c),d.opaque)return;let f=t.tree&&t.tree.prop(Kn.mounted);if(f&&f.overlay){let m=t.node.enter(f.overlay[0].from+a,1),p=this.highlighters.filter(w=>!w.scope||w.scope(f.tree.type)),y=t.firstChild();for(let w=0,b=a;;w++){let v=w<f.overlay.length?f.overlay[w]:null,x=v?v.from+a:l,_=Math.max(n,b),E=Math.min(s,x);if(_<E&&y)for(;t.from<E&&(this.highlightRange(t,_,E,r,i),this.startSpan(Math.min(E,t.to),c),!(t.to>=x||!t.nextSibling())););if(!v||x>s)break;b=v.to+a,b>n&&(this.highlightRange(m.cursor(),Math.max(n,v.from+a),Math.min(s,b),"",p),this.startSpan(Math.min(s,b),c))}y&&t.parent()}else if(t.firstChild()){f&&(r="");do if(!(t.to<=n)){if(t.from>=s)break;this.highlightRange(t,n,s,r,i),this.startSpan(Math.min(s,t.to),c)}while(t.nextSibling());t.parent()}}}function q2e(e){let t=e.type.prop(tz);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const ot=Yo.define,M1=ot(),Fc=ot(),yM=ot(Fc),bM=ot(Fc),qc=ot(),N1=ot(qc),i4=ot(qc),Xa=ot(),od=ot(Xa),Wa=ot(),Ga=ot(),jk=ot(),Um=ot(jk),I1=ot(),bt={comment:M1,lineComment:ot(M1),blockComment:ot(M1),docComment:ot(M1),name:Fc,variableName:ot(Fc),typeName:yM,tagName:ot(yM),propertyName:bM,attributeName:ot(bM),className:ot(Fc),labelName:ot(Fc),namespace:ot(Fc),macroName:ot(Fc),literal:qc,string:N1,docString:ot(N1),character:ot(N1),attributeValue:ot(N1),number:i4,integer:ot(i4),float:ot(i4),bool:ot(qc),regexp:ot(qc),escape:ot(qc),color:ot(qc),url:ot(qc),keyword:Wa,self:ot(Wa),null:ot(Wa),atom:ot(Wa),unit:ot(Wa),modifier:ot(Wa),operatorKeyword:ot(Wa),controlKeyword:ot(Wa),definitionKeyword:ot(Wa),moduleKeyword:ot(Wa),operator:Ga,derefOperator:ot(Ga),arithmeticOperator:ot(Ga),logicOperator:ot(Ga),bitwiseOperator:ot(Ga),compareOperator:ot(Ga),updateOperator:ot(Ga),definitionOperator:ot(Ga),typeOperator:ot(Ga),controlOperator:ot(Ga),punctuation:jk,separator:ot(jk),bracket:Um,angleBracket:ot(Um),squareBracket:ot(Um),paren:ot(Um),brace:ot(Um),content:Xa,heading:od,heading1:ot(od),heading2:ot(od),heading3:ot(od),heading4:ot(od),heading5:ot(od),heading6:ot(od),contentSeparator:ot(Xa),list:ot(Xa),quote:ot(Xa),emphasis:ot(Xa),strong:ot(Xa),link:ot(Xa),monospace:ot(Xa),strikethrough:ot(Xa),inserted:ot(),deleted:ot(),changed:ot(),invalid:ot(),meta:I1,documentMeta:ot(I1),annotation:ot(I1),processingInstruction:ot(I1),definition:Yo.defineModifier("definition"),constant:Yo.defineModifier("constant"),function:Yo.defineModifier("function"),standard:Yo.defineModifier("standard"),local:Yo.defineModifier("local"),special:Yo.defineModifier("special")};for(let e in bt){let t=bt[e];t instanceof Yo&&(t.name=e)}nz([{tag:bt.link,class:"tok-link"},{tag:bt.heading,class:"tok-heading"},{tag:bt.emphasis,class:"tok-emphasis"},{tag:bt.strong,class:"tok-strong"},{tag:bt.keyword,class:"tok-keyword"},{tag:bt.atom,class:"tok-atom"},{tag:bt.bool,class:"tok-bool"},{tag:bt.url,class:"tok-url"},{tag:bt.labelName,class:"tok-labelName"},{tag:bt.inserted,class:"tok-inserted"},{tag:bt.deleted,class:"tok-deleted"},{tag:bt.literal,class:"tok-literal"},{tag:bt.string,class:"tok-string"},{tag:bt.number,class:"tok-number"},{tag:[bt.regexp,bt.escape,bt.special(bt.string)],class:"tok-string2"},{tag:bt.variableName,class:"tok-variableName"},{tag:bt.local(bt.variableName),class:"tok-variableName tok-local"},{tag:bt.definition(bt.variableName),class:"tok-variableName tok-definition"},{tag:bt.special(bt.variableName),class:"tok-variableName2"},{tag:bt.definition(bt.propertyName),class:"tok-propertyName tok-definition"},{tag:bt.typeName,class:"tok-typeName"},{tag:bt.namespace,class:"tok-namespace"},{tag:bt.className,class:"tok-className"},{tag:bt.macroName,class:"tok-macroName"},{tag:bt.propertyName,class:"tok-propertyName"},{tag:bt.operator,class:"tok-operator"},{tag:bt.comment,class:"tok-comment"},{tag:bt.meta,class:"tok-meta"},{tag:bt.invalid,class:"tok-invalid"},{tag:bt.punctuation,class:"tok-punctuation"}]);var o4;const l0=new Kn,H2e=new Kn;class ul{constructor(t,n,s=[],r=""){this.data=t,this.name=r,ms.prototype.hasOwnProperty("tree")||Object.defineProperty(ms.prototype,"tree",{get(){return Ma(this)}}),this.parser=n,this.extension=[Kf.of(this),ms.languageData.of((i,o,a)=>{let l=vM(i,o,a),c=l.type.prop(l0);if(!c)return[];let d=i.facet(c),h=l.type.prop(H2e);if(h){let f=l.resolve(o-l.from,a);for(let m of h)if(m.test(f,i)){let p=i.facet(m.facet);return m.type=="replace"?p:p.concat(d)}}return d})].concat(s)}isActiveAt(t,n,s=-1){return vM(t,n,s).type.prop(l0)==this.data}findRegions(t){let n=t.facet(Kf);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let s=[],r=(i,o)=>{if(i.prop(l0)==this.data){s.push({from:o,to:o+i.length});return}let a=i.prop(Kn.mounted);if(a){if(a.tree.prop(l0)==this.data){if(a.overlay)for(let l of a.overlay)s.push({from:l.from+o,to:l.to+o});else s.push({from:o,to:o+i.length});return}else if(a.overlay){let l=s.length;if(r(a.tree,a.overlay[0].from+o),s.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof oi&&r(c,i.positions[l]+o)}};return r(Ma(t),0),s}get allowsNesting(){return!0}}ul.setState=_s.define();function vM(e,t,n){let s=e.facet(Kf),r=Ma(e).topNode;if(!s||s.allowsNesting)for(let i=r;i;i=i.enter(t,n,mr.ExcludeBuffers|mr.EnterBracketed))i.type.isTop&&(r=i);return r}function Ma(e){let t=e.field(ul.state,!1);return t?t.tree:oi.empty}class U2e{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let s=this.cursorPos-this.string.length;return t<s||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-s,n-s)}}let Vm=null;class Kb{constructor(t,n,s=[],r,i,o,a,l){this.parser=t,this.state=n,this.fragments=s,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,s){return new Kb(t,n,[],oi.empty,0,s,[],null)}startParse(){return this.parser.startParse(new U2e(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=oi.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var s;if(typeof t=="number"){let r=Date.now()+t;t=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Ld.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(s=this.parse.stoppedAt)!==null&&s!==void 0?s:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,n;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Ld.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Vm;Vm=this;try{return t()}finally{Vm=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=wM(t,n.from,n.to);return t}changes(t,n){let{fragments:s,tree:r,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((c,d,h,f)=>l.push({fromA:c,toA:d,fromB:h,toB:f})),s=Ld.applyChanges(s,l),r=oi.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let d=t.mapPos(c.from,1),h=t.mapPos(c.to,-1);d<h&&a.push({from:d,to:h})}}}return new Kb(this.parser,n,s,r,i,o,a,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let n=this.skipped.length;for(let s=0;s<this.skipped.length;s++){let{from:r,to:i}=this.skipped[s];r<t.to&&i>t.from&&(this.fragments=wM(this.fragments,r,i),this.skipped.splice(s--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends j2e{createParse(n,s,r){let i=r[0].from,o=r[r.length-1].to;return{parsedPos:i,advance(){let l=Vm;if(l){for(let c of r)l.tempSkipped.push(c);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new oi(ua.none,[],[],o-i)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return Vm}}function wM(e,t,n){return Ld.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Gf{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),s=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,s)||n.takeTree(),new Gf(n)}static init(t){let n=Math.min(3e3,t.doc.length),s=Kb.create(t.facet(Kf).parser,t,{from:0,to:n});return s.work(20,n)||s.takeTree(),new Gf(s)}}ul.state=Cl.define({create:Gf.init,update(e,t){for(let n of t.effects)if(n.is(ul.setState))return n.value;return t.startState.facet(Kf)!=t.state.facet(Kf)?Gf.init(t.state):e.apply(t)}});let sz=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(sz=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const a4=typeof navigator<"u"&&(!((o4=navigator.scheduling)===null||o4===void 0)&&o4.isInputPending)?()=>navigator.scheduling.isInputPending():null,V2e=lo.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(ul.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(ul.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=sz(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:s,viewport:{to:r}}=this.view,i=s.field(ul.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!a4?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<r&&s.doc.length>r+1e3,l=i.context.work(()=>a4&&a4()||Date.now()>o,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:ul.setState.of(new Gf(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>So(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Kf=Gt.define({combine(e){return e.length?e[0]:null},enables:e=>[ul.state,V2e,Pt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),W2e=Gt.define(),K6=Gt.define({combine:e=>{if(!e.length)return"  ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Yb(e){let t=e.facet(K6);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Qb(e,t){let n="",s=e.tabSize,r=e.facet(K6)[0];if(r=="	"){for(;t>=s;)n+="	",t-=s;r=" "}for(let i=0;i<t;i++)n+=r;return n}function rz(e,t){e instanceof ms&&(e=new fw(e));for(let s of e.state.facet(W2e)){let r=s(e,t);if(r!==void 0)return r}let n=Ma(e.state);return n.length>=t?K2e(e,n,t):null}class fw{constructor(t,n={}){this.state=t,this.options=n,this.unit=Yb(t)}lineAt(t,n=1){let s=this.state.doc.lineAt(t),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=s.from&&r<=s.to?i&&r==t?{text:"",from:t}:(n<0?r<t:r<=t)?{text:s.text.slice(r-s.from),from:r}:{text:s.text.slice(0,r-s.from),from:s.from}:s}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:s,from:r}=this.lineAt(t,n);return s.slice(t-r,Math.min(s.length,t+100-r))}column(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.countColumn(s,t-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(s,s.search(/\S|$/))),i}countColumn(t,n=t.length){return cg(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:s,from:r}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(r);if(o>-1)return o}return this.countColumn(s,s.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const G2e=new Kn;function K2e(e,t,n){let s=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=s.node){let i=[];for(let o=r;o&&!(o.from<s.node.from||o.to>s.node.to||o.from==s.node.from&&o.type==s.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)s={node:i[o],next:s}}return iz(s,e,n)}function iz(e,t,n){for(let s=e;s;s=s.next){let r=Q2e(s.node);if(r)return r(Y6.create(t,n,s))}return 0}function Y2e(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Q2e(e){let t=e.type.prop(G2e);if(t)return t;let n=e.firstChild,s;if(n&&(s=n.type.prop(Kn.closedBy))){let r=e.lastChild,i=r&&s.indexOf(r.name)>-1;return o=>exe(o,!0,1,void 0,i&&!Y2e(o)?r.from:void 0)}return e.parent==null?X2e:null}function X2e(){return 0}class Y6 extends fw{constructor(t,n,s){super(t.state,t.options),this.base=t,this.pos=n,this.context=s}get node(){return this.context.node}static create(t,n,s){return new Y6(t,n,s)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let s=t.resolve(n.from);for(;s.parent&&s.parent.from==s.from;)s=s.parent;if(J2e(s,t))break;n=this.state.doc.lineAt(s.from)}return this.lineIndent(n.from)}continue(){return iz(this.context.next,this.base,this.pos)}}function J2e(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Z2e(e){let t=e.node,n=t.childAfter(t.from),s=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=r==null||r<=i.from?i.to:Math.min(i.to,r);for(let a=n.to;;){let l=t.childAfter(a);if(!l||l==s)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function exe(e,t,n,s,r){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=s&&i.slice(o,o+s.length)==s||r==e.pos+o,l=Z2e(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}class mw{constructor(t,n){this.specs=t;let s;function r(a){let l=Ru.newName();return(s||(s=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,o=n.scope;this.scope=o instanceof ul?a=>a.prop(l0)==o.data:o?a=>a==o:void 0,this.style=nz(t.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=s?new Ru(s):null,this.themeType=n.themeType}static define(t,n){return new mw(t,n||{})}}const Rk=Gt.define(),oz=Gt.define({combine(e){return e.length?[e[0]]:null}});function l4(e){let t=e.facet(Rk);return t.length?t:e.facet(oz)}function txe(e,t){let n=[sxe],s;return e instanceof mw&&(e.module&&n.push(Pt.styleModule.of(e.module)),s=e.themeType),t!=null&&t.fallback?n.push(oz.of(e)):s?n.push(Rk.computeN([Pt.darkTheme],r=>r.facet(Pt.darkTheme)==(s=="dark")?[e]:[])):n.push(Rk.of(e)),n}class nxe{constructor(t){this.markCache=Object.create(null),this.tree=Ma(t.state),this.decorations=this.buildDeco(t,l4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Ma(t.state),s=l4(t.state),r=s!=l4(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!r&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(t.view,s),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return qn.none;let s=new Wd;for(let{from:r,to:i}of t.visibleRanges)z2e(this.tree,n,(o,a,l)=>{s.add(o,a,this.markCache[l]||(this.markCache[l]=qn.mark({class:l})))},r,i);return s.finish()}}const sxe=uh.high(lo.fromClass(nxe,{decorations:e=>e.decorations})),rxe=mw.define([{tag:bt.meta,color:"#404740"},{tag:bt.link,textDecoration:"underline"},{tag:bt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:bt.emphasis,fontStyle:"italic"},{tag:bt.strong,fontWeight:"bold"},{tag:bt.strikethrough,textDecoration:"line-through"},{tag:bt.keyword,color:"#708"},{tag:[bt.atom,bt.bool,bt.url,bt.contentSeparator,bt.labelName],color:"#219"},{tag:[bt.literal,bt.inserted],color:"#164"},{tag:[bt.string,bt.deleted],color:"#a11"},{tag:[bt.regexp,bt.escape,bt.special(bt.string)],color:"#e40"},{tag:bt.definition(bt.variableName),color:"#00f"},{tag:bt.local(bt.variableName),color:"#30a"},{tag:[bt.typeName,bt.namespace],color:"#085"},{tag:bt.className,color:"#167"},{tag:[bt.special(bt.variableName),bt.macroName],color:"#256"},{tag:bt.definition(bt.propertyName),color:"#00c"},{tag:bt.comment,color:"#940"},{tag:bt.invalid,color:"#f00"}]),ixe=1e4,oxe="()[]{}",axe=new Kn;function Lk(e,t,n){let s=e.prop(t<0?Kn.openedBy:Kn.closedBy);if(s)return s;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function Dk(e){let t=e.type.prop(axe);return t?t(e.node):e}function ef(e,t,n,s={}){let r=s.maxScanDistance||ixe,i=s.brackets||oxe,o=Ma(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=Lk(l.type,n,i);if(c&&l.from<l.to){let d=Dk(l);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return lxe(e,t,n,l,d,c,i)}}return cxe(e,t,n,o,a.type,r,i)}function lxe(e,t,n,s,r,i,o){let a=s.parent,l={from:r.from,to:r.to},c=0,d=a==null?void 0:a.cursor();if(d&&(n<0?d.childBefore(s.from):d.childAfter(s.to)))do if(n<0?d.to<=s.from:d.from>=s.to){if(c==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let h=Dk(d);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Lk(d.type,n,o))c++;else if(Lk(d.type,-n,o)){if(c==0){let h=Dk(d);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(n<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function cxe(e,t,n,s,r,i,o){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let f=0;!d.next().done&&f<=i;){let m=d.value;n<0&&(f+=m.length);let p=t+f*n;for(let y=n>0?0:m.length-1,w=n>0?m.length:-1;y!=w;y+=n){let b=o.indexOf(m[y]);if(!(b<0||s.resolveInner(p+y,1).type!=r))if(b%2==0==n>0)h++;else{if(h==1)return{start:c,end:{from:p+y,to:p+y+1},matched:b>>1==l>>1};h--}}n>0&&(f+=m.length)}return d.done?{start:c,matched:!1}:null}const uxe=Object.create(null),xM=[ua.none],_M=[],kM=Object.create(null),dxe=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])dxe[e]=hxe(uxe,t);function c4(e,t){_M.indexOf(e)>-1||(_M.push(e),console.warn(t))}function hxe(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let d=e[c]||bt[c];d?typeof d=="function"?l.length?l=l.map(d):c4(c,`Modifier ${c} used at start of tag`):l.length?c4(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:c4(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let s=t.replace(/ /g,"_"),r=s+" "+n.map(a=>a.id),i=kM[r];if(i)return i.id;let o=kM[r]=ua.define({id:xM.length,name:s,props:[P2e({[s]:n})]});return xM.push(o),o.id}qs.RTL,qs.LTR;const fxe=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),s=X6(e.state,n.from);return s.line?mxe(e):s.block?gxe(e):!1};function Q6(e,t){return({state:n,dispatch:s})=>{if(n.readOnly)return!1;let r=e(t,n);return r?(s(n.update(r)),!0):!1}}const mxe=Q6(vxe,0),pxe=Q6(az,0),gxe=Q6((e,t)=>az(e,t,bxe(t)),0);function X6(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Wm=50;function yxe(e,{open:t,close:n},s,r){let i=e.sliceDoc(s-Wm,s),o=e.sliceDoc(r,r+Wm),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,c=i.length-a;if(i.slice(c-t.length,c)==t&&o.slice(l,l+n.length)==n)return{open:{pos:s-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let d,h;r-s<=2*Wm?d=h=e.sliceDoc(s,r):(d=e.sliceDoc(s,s+Wm),h=e.sliceDoc(r-Wm,r));let f=/^\s*/.exec(d)[0].length,m=/\s*$/.exec(h)[0].length,p=h.length-m-n.length;return d.slice(f,f+t.length)==t&&h.slice(p,p+n.length)==n?{open:{pos:s+f+t.length,margin:/\s/.test(d.charAt(f+t.length))?1:0},close:{pos:r-m-n.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function bxe(e){let t=[];for(let n of e.selection.ranges){let s=e.doc.lineAt(n.from),r=n.to<=s.to?s:e.doc.lineAt(n.to);r.from>s.from&&r.from==n.to&&(r=n.to==s.to+1?s:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>s.from?t[i].to=r.to:t.push({from:s.from+/^\s*/.exec(s.text)[0].length,to:r.to})}return t}function az(e,t,n=t.selection.ranges){let s=n.map(i=>X6(t,i.from).block);if(!s.every(i=>i))return null;let r=n.map((i,o)=>yxe(t,s[o],i.from,i.to));if(e!=2&&!r.every(i=>i))return{changes:t.changes(n.map((i,o)=>r[o]?[]:[{from:i.from,insert:s[o].open+" "},{from:i.to,insert:" "+s[o].close}]))};if(e!=1&&r.some(i=>i)){let i=[];for(let o=0,a;o<r.length;o++)if(a=r[o]){let l=s[o],{open:c,close:d}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:i}}return null}function vxe(e,t,n=t.selection.ranges){let s=[],r=-1;e:for(let{from:i,to:o}of n){let a=s.length,l=1e9,c;for(let d=i;d<=o;){let h=t.doc.lineAt(d);if(c==null&&(c=X6(t,h.from).line,!c))continue e;if(h.from>r&&(i==o||o>h.from)){r=h.from;let f=/^\s*/.exec(h.text)[0].length,m=f==h.length,p=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<l&&(l=f),s.push({line:h,comment:p,token:c,indent:f,empty:m,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<s.length;d++)s[d].indent<s[d].line.text.length&&(s[d].indent=l);s.length==a+1&&(s[a].single=!0)}if(e!=2&&s.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of s)(h||!d)&&i.push({from:a.from+c,insert:l+" "});let o=t.changes(i);return{changes:o,selection:t.selection.map(o,1)}}else if(e!=1&&s.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of s)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,i.push({from:c,to:d})}return{changes:i}}return null}const Ok=kc.define(),wxe=kc.define(),xxe=Gt.define(),lz=Gt.define({combine(e){return aw(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(s,r)=>t(s,r)||n(s,r)})}}),cz=Cl.define({create(){return dl.empty},update(e,t){let n=t.state.facet(lz),s=t.annotation(Ok);if(s){let l=io.fromTransaction(t,s.selection),c=s.side,d=c==0?e.undone:e.done;return l?d=Xb(d,d.length,n.minDepth,l):d=fz(d,t.startState.selection),new dl(c==0?s.rest:d,c==0?d:s.rest)}let r=t.annotation(wxe);if((r=="full"||r=="before")&&(e=e.isolate()),t.annotation(Or.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=io.fromTransaction(t),o=t.annotation(Or.time),a=t.annotation(Or.userEvent);return i?e=e.addChanges(i,o,a,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),(r=="full"||r=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new dl(e.done.map(io.fromJSON),e.undone.map(io.fromJSON))}});function uz(e={}){return[cz,lz.of(e),Pt.domEventHandlers({beforeinput(t,n){let s=t.inputType=="historyUndo"?dz:t.inputType=="historyRedo"?Bk:null;return s?(t.preventDefault(),s(n)):!1}})]}function pw(e,t){return function({state:n,dispatch:s}){if(!t&&n.readOnly)return!1;let r=n.field(cz,!1);if(!r)return!1;let i=r.pop(e,n,t);return i?(s(i),!0):!1}}const dz=pw(0,!1),Bk=pw(1,!1),_xe=pw(0,!0),kxe=pw(1,!0);class io{constructor(t,n,s,r,i){this.changes=t,this.effects=n,this.mapped=s,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new io(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,s;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(s=this.startSelection)===null||s===void 0?void 0:s.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(t){return new io(t.changes&&Rr.fromJSON(t.changes),[],t.mapped&&ml.fromJSON(t.mapped),t.startSelection&&Ve.fromJSON(t.startSelection),t.selectionsAfter.map(Ve.fromJSON))}static fromTransaction(t,n){let s=na;for(let r of t.startState.facet(xxe)){let i=r(t);i.length&&(s=s.concat(i))}return!s.length&&t.changes.empty?null:new io(t.changes.invert(t.startState.doc),s,void 0,n||t.startState.selection,na)}static selection(t){return new io(void 0,na,void 0,void 0,t)}}function Xb(e,t,n,s){let r=t+1>n+20?t-n-1:0,i=e.slice(r,t);return i.push(s),i}function Sxe(e,t){let n=[],s=!1;return e.iterChangedRanges((r,i)=>n.push(r,i)),t.iterChangedRanges((r,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],d=n[l++];a>=c&&o<=d&&(s=!0)}}),s}function Txe(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,s)=>n.empty!=t.ranges[s].empty).length===0}function hz(e,t){return e.length?t.length?e.concat(t):e:t}const na=[],Cxe=200;function fz(e,t){if(e.length){let n=e[e.length-1],s=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Cxe));return s.length&&s[s.length-1].eq(t)?e:(s.push(t),Xb(e,e.length-1,1e9,n.setSelAfter(s)))}else return[io.selection([t])]}function Axe(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function u4(e,t){if(!e.length)return e;let n=e.length,s=na;for(;n;){let r=Exe(e[n-1],t,s);if(r.changes&&!r.changes.empty||r.effects.length){let i=e.slice(0,n);return i[n-1]=r,i}else t=r.mapped,n--,s=r.selectionsAfter}return s.length?[io.selection(s)]:na}function Exe(e,t,n){let s=hz(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):na,n);if(!e.changes)return io.selection(s);let r=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new io(r,_s.mapEffects(e.effects,t),o,e.startSelection.map(i),s)}const Mxe=/^(input\.type|delete)($|\.)/;class dl{constructor(t,n,s=0,r=void 0){this.done=t,this.undone=n,this.prevTime=s,this.prevUserEvent=r}isolate(){return this.prevTime?new dl(this.done,this.undone):this}addChanges(t,n,s,r,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!s||Mxe.test(s))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,Sxe(a.changes,t.changes))||s=="input.type.compose")?o=Xb(o,o.length-1,r.minDepth,new io(t.changes.compose(a.changes),hz(_s.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,na)):o=Xb(o,o.length,r.minDepth,t),new dl(o,na,n,s)}addSelection(t,n,s,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:na;return i.length>0&&n-this.prevTime<r&&s==this.prevUserEvent&&s&&/^select($|\.)/.test(s)&&Txe(i[i.length-1],t)?this:new dl(fz(this.done,t),this.undone,n,s)}addMapping(t){return new dl(u4(this.done,t),u4(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,s){let r=t==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(s&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Ok.of({side:t,rest:Axe(r),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?na:r.slice(0,r.length-1);return i.mapped&&(a=u4(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Ok.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}dl.empty=new dl(na,na);const mz=[{key:"Mod-z",run:dz,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Bk,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Bk,preventDefault:!0},{key:"Mod-u",run:_xe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:kxe,preventDefault:!0}];function mm(e,t){return Ve.create(e.ranges.map(t),e.mainIndex)}function Ia(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function ja({state:e,dispatch:t},n){let s=mm(e.selection,n);return s.eq(e.selection,!0)?!1:(t(Ia(e,s)),!0)}function gw(e,t){return Ve.cursor(t?e.to:e.from)}function pz(e,t){return ja(e,n=>n.empty?e.moveByChar(n,t):gw(n,t))}function ki(e){return e.textDirectionAt(e.state.selection.main.head)==qs.LTR}const gz=e=>pz(e,!ki(e)),yz=e=>pz(e,ki(e));function bz(e,t){return ja(e,n=>n.empty?e.moveByGroup(n,t):gw(n,t))}const Nxe=e=>bz(e,!ki(e)),Ixe=e=>bz(e,ki(e));function jxe(e,t,n){if(t.type.prop(n))return!0;let s=t.to-t.from;return s&&(s>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function yw(e,t,n){let s=Ma(e).resolveInner(t.head),r=n?Kn.closedBy:Kn.openedBy;for(let l=t.head;;){let c=n?s.childAfter(l):s.childBefore(l);if(!c)break;jxe(e,c,r)?s=c:l=n?c.to:c.from}let i=s.type.prop(r),o,a;return i&&(o=n?ef(e,s.from,1):ef(e,s.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?s.to:s.from,Ve.cursor(a,n?-1:1)}const Rxe=e=>ja(e,t=>yw(e.state,t,!ki(e))),Lxe=e=>ja(e,t=>yw(e.state,t,ki(e)));function vz(e,t){return ja(e,n=>{if(!n.empty)return gw(n,t);let s=e.moveVertically(n,t);return s.head!=n.head?s:e.moveToLineBoundary(n,t)})}const wz=e=>vz(e,!1),xz=e=>vz(e,!0);function _z(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,s=0,r;if(t){for(let i of e.state.facet(Pt.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(s=Math.max(o==null?void 0:o.bottom,s))}r=e.scrollDOM.clientHeight-n-s}else r=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:s,selfScroll:t,height:Math.max(e.defaultLineHeight,r-5)}}function kz(e,t){let n=_z(e),{state:s}=e,r=mm(s.selection,o=>o.empty?e.moveVertically(o,t,n.height):gw(o,t));if(r.eq(s.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(s.selection.main.head),a=e.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<c&&(i=Pt.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(Ia(s,r),{effects:i}),!0}const SM=e=>kz(e,!1),Pk=e=>kz(e,!0);function Hu(e,t,n){let s=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?s.to:s.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==s.from&&s.length){let i=/^\s*/.exec(e.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;i&&t.head!=s.from+i&&(r=Ve.cursor(s.from+i))}return r}const Dxe=e=>ja(e,t=>Hu(e,t,!0)),Oxe=e=>ja(e,t=>Hu(e,t,!1)),Bxe=e=>ja(e,t=>Hu(e,t,!ki(e))),Pxe=e=>ja(e,t=>Hu(e,t,ki(e))),$xe=e=>ja(e,t=>Ve.cursor(e.lineBlockAt(t.head).from,1)),zxe=e=>ja(e,t=>Ve.cursor(e.lineBlockAt(t.head).to,-1));function Fxe(e,t,n){let s=!1,r=mm(e.selection,i=>{let o=ef(e,i.head,-1)||ef(e,i.head,1)||i.head>0&&ef(e,i.head-1,1)||i.head<e.doc.length&&ef(e,i.head+1,-1);if(!o||!o.end)return i;s=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Ve.cursor(a)});return s?(t(Ia(e,r)),!0):!1}const qxe=({state:e,dispatch:t})=>Fxe(e,t);function fa(e,t){let n=mm(e.state.selection,s=>{let r=t(s);return Ve.range(s.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Ia(e.state,n)),!0)}function Sz(e,t){return fa(e,n=>e.moveByChar(n,t))}const Tz=e=>Sz(e,!ki(e)),Cz=e=>Sz(e,ki(e));function Az(e,t){return fa(e,n=>e.moveByGroup(n,t))}const Hxe=e=>Az(e,!ki(e)),Uxe=e=>Az(e,ki(e)),Vxe=e=>fa(e,t=>yw(e.state,t,!ki(e))),Wxe=e=>fa(e,t=>yw(e.state,t,ki(e)));function Ez(e,t){return fa(e,n=>e.moveVertically(n,t))}const Mz=e=>Ez(e,!1),Nz=e=>Ez(e,!0);function Iz(e,t){return fa(e,n=>e.moveVertically(n,t,_z(e).height))}const TM=e=>Iz(e,!1),CM=e=>Iz(e,!0),Gxe=e=>fa(e,t=>Hu(e,t,!0)),Kxe=e=>fa(e,t=>Hu(e,t,!1)),Yxe=e=>fa(e,t=>Hu(e,t,!ki(e))),Qxe=e=>fa(e,t=>Hu(e,t,ki(e))),Xxe=e=>fa(e,t=>Ve.cursor(e.lineBlockAt(t.head).from)),Jxe=e=>fa(e,t=>Ve.cursor(e.lineBlockAt(t.head).to)),AM=({state:e,dispatch:t})=>(t(Ia(e,{anchor:0})),!0),EM=({state:e,dispatch:t})=>(t(Ia(e,{anchor:e.doc.length})),!0),MM=({state:e,dispatch:t})=>(t(Ia(e,{anchor:e.selection.main.anchor,head:0})),!0),NM=({state:e,dispatch:t})=>(t(Ia(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Zxe=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),e4e=({state:e,dispatch:t})=>{let n=bw(e).map(({from:s,to:r})=>Ve.range(s,Math.min(r+1,e.doc.length)));return t(e.update({selection:Ve.create(n),userEvent:"select"})),!0},t4e=({state:e,dispatch:t})=>{let n=mm(e.selection,s=>{let r=Ma(e),i=r.resolveStack(s.from,1);if(s.empty){let o=r.resolveStack(s.from,-1);o.node.from>=i.node.from&&o.node.to<=i.node.to&&(i=o)}for(let o=i;o;o=o.next){let{node:a}=o;if((a.from<s.from&&a.to>=s.to||a.to>s.to&&a.from<=s.from)&&o.next)return Ve.range(a.to,a.from)}return s});return n.eq(e.selection)?!1:(t(Ia(e,n)),!0)};function jz(e,t){let{state:n}=e,s=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let o=n.doc.lineAt(i.head);if(t?o.to<e.state.doc.length:o.from>0)for(let a=i;;){let l=e.moveVertically(a,t);if(l.head<o.from||l.head>o.to){r.some(c=>c.head==l.head)||r.push(l);break}else{if(l.head==a.head)break;a=l}}}return r.length==s.ranges.length?!1:(e.dispatch(Ia(n,Ve.create(r,r.length-1))),!0)}const n4e=e=>jz(e,!1),s4e=e=>jz(e,!0),r4e=({state:e,dispatch:t})=>{let n=e.selection,s=null;return n.ranges.length>1?s=Ve.create([n.main]):n.main.empty||(s=Ve.create([Ve.cursor(n.main.head)])),s?(t(Ia(e,s)),!0):!1};function fg(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:s}=e,r=s.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=t(i);l<o?(n="delete.backward",l=j1(e,l,!1)):l>o&&(n="delete.forward",l=j1(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=j1(e,o,!1),a=j1(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Ve.cursor(o,o<i.head?-1:1)}});return r.changes.empty?!1:(e.dispatch(s.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Pt.announce.of(s.phrase("Selection deleted")):void 0})),!0)}function j1(e,t,n){if(e instanceof Pt)for(let s of e.state.facet(Pt.atomicRanges).map(r=>r(e)))s.between(t,t,(r,i)=>{r<t&&i>t&&(t=n?i:r)});return t}const Rz=(e,t,n)=>fg(e,s=>{let r=s.from,{state:i}=e,o=i.doc.lineAt(r),a,l;if(n&&!t&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,r-o.from))){if(a[a.length-1]=="	")return r-1;let c=cg(a,i.tabSize),d=c%Yb(i)||Yb(i);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)r--;l=r}else l=vi(o.text,r-o.from,t,t)+o.from,l==r&&o.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,r-o.from))&&(l=vi(o.text,l-o.from,!1,!1)+o.from);return l}),$k=e=>Rz(e,!1,!0),Lz=e=>Rz(e,!0,!1),Dz=(e,t)=>fg(e,n=>{let s=n.head,{state:r}=e,i=r.doc.lineAt(s),o=r.charCategorizer(s);for(let a=null;;){if(s==(t?i.to:i.from)){s==n.head&&i.number!=(t?r.doc.lines:1)&&(s+=t?1:-1);break}let l=vi(i.text,s-i.from,t)+i.from,c=i.text.slice(Math.min(s,l)-i.from,Math.max(s,l)-i.from),d=o(c);if(a!=null&&d!=a)break;(c!=" "||s!=n.head)&&(a=d),s=l}return s}),Oz=e=>Dz(e,!1),i4e=e=>Dz(e,!0),o4e=e=>fg(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),a4e=e=>fg(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),l4e=e=>fg(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),c4e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>({changes:{from:s.from,to:s.to,insert:Qn.of(["",""])},range:Ve.cursor(s.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},u4e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(s=>{if(!s.empty||s.from==0||s.from==e.doc.length)return{range:s};let r=s.from,i=e.doc.lineAt(r),o=r==i.from?r-1:vi(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:vi(i.text,r-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(r,a).append(e.doc.slice(o,r))},range:Ve.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bw(e){let t=[],n=-1;for(let s of e.selection.ranges){let r=e.doc.lineAt(s.from),i=e.doc.lineAt(s.to);if(!s.empty&&s.to==i.from&&(i=e.doc.lineAt(s.to-1)),n>=r.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(s)}else t.push({from:r.from,to:i.to,ranges:[s]});n=i.number+1}return t}function Bz(e,t,n){if(e.readOnly)return!1;let s=[],r=[];for(let i of bw(e)){if(n?i.to==e.doc.length:i.from==0)continue;let o=e.doc.lineAt(n?i.to+1:i.from-1),a=o.length+1;if(n){s.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let l of i.ranges)r.push(Ve.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{s.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let l of i.ranges)r.push(Ve.range(l.anchor-a,l.head-a))}}return s.length?(t(e.update({changes:s,scrollIntoView:!0,selection:Ve.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const d4e=({state:e,dispatch:t})=>Bz(e,t,!1),h4e=({state:e,dispatch:t})=>Bz(e,t,!0);function Pz(e,t,n){if(e.readOnly)return!1;let s=[];for(let i of bw(e))n?s.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):s.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let r=e.changes(s);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const f4e=({state:e,dispatch:t})=>Pz(e,t,!1),m4e=({state:e,dispatch:t})=>Pz(e,t,!0),p4e=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(bw(t).map(({from:r,to:i})=>(r>0?r--:i<t.doc.length&&i++,{from:r,to:i}))),s=mm(t.selection,r=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(r.head),a=e.coordsAtPos(r.head,r.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(r,!0,i)}).map(n);return e.dispatch({changes:n,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0};function g4e(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Ma(e).resolveInner(t),s=n.childBefore(t),r=n.childAfter(t),i;return s&&r&&s.to<=t&&r.from>=t&&(i=s.type.prop(Kn.closedBy))&&i.indexOf(r.name)>-1&&e.doc.lineAt(s.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}const IM=$z(!1),y4e=$z(!0);function $z(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let s=t.changeByRange(r=>{let{from:i,to:o}=r,a=t.doc.lineAt(i),l=!e&&i==o&&g4e(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new fw(t,{simulateBreak:i,simulateDoubleBreak:!!l}),d=rz(c,i);for(d==null&&(d=cg(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",Qb(t,d)];return l&&h.push(Qb(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Qn.of(h)},range:Ve.cursor(i+1+h[1].length)}});return n(t.update(s,{scrollIntoView:!0,userEvent:"input"})),!0}}function J6(e,t){let n=-1;return e.changeByRange(s=>{let r=[];for(let o=s.from;o<=s.to;){let a=e.doc.lineAt(o);a.number>n&&(s.empty||s.to>a.from)&&(t(a,r,s),n=a.number),o=a.to+1}let i=e.changes(r);return{changes:r,range:Ve.range(i.mapPos(s.anchor,1),i.mapPos(s.head,1))}})}const b4e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),s=new fw(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),r=J6(e,(i,o,a)=>{let l=rz(s,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],d=Qb(e,l);(c!=d||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:d}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0},v4e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(J6(e,(n,s)=>{s.push({from:n.from,insert:e.facet(K6)})}),{userEvent:"input.indent"})),!0),w4e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(J6(e,(n,s)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=cg(r,e.tabSize),o=0,a=Qb(e,Math.max(0,i-Yb(e)));for(;o<r.length&&o<a.length&&r.charCodeAt(o)==a.charCodeAt(o);)o++;s.push({from:n.from+o,to:n.from+r.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),x4e=e=>(e.setTabFocusMode(),!0),_4e=[{key:"Ctrl-b",run:gz,shift:Tz,preventDefault:!0},{key:"Ctrl-f",run:yz,shift:Cz},{key:"Ctrl-p",run:wz,shift:Mz},{key:"Ctrl-n",run:xz,shift:Nz},{key:"Ctrl-a",run:$xe,shift:Xxe},{key:"Ctrl-e",run:zxe,shift:Jxe},{key:"Ctrl-d",run:Lz},{key:"Ctrl-h",run:$k},{key:"Ctrl-k",run:o4e},{key:"Ctrl-Alt-h",run:Oz},{key:"Ctrl-o",run:c4e},{key:"Ctrl-t",run:u4e},{key:"Ctrl-v",run:Pk}],k4e=[{key:"ArrowLeft",run:gz,shift:Tz,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Nxe,shift:Hxe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Bxe,shift:Yxe,preventDefault:!0},{key:"ArrowRight",run:yz,shift:Cz,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ixe,shift:Uxe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Pxe,shift:Qxe,preventDefault:!0},{key:"ArrowUp",run:wz,shift:Mz,preventDefault:!0},{mac:"Cmd-ArrowUp",run:AM,shift:MM},{mac:"Ctrl-ArrowUp",run:SM,shift:TM},{key:"ArrowDown",run:xz,shift:Nz,preventDefault:!0},{mac:"Cmd-ArrowDown",run:EM,shift:NM},{mac:"Ctrl-ArrowDown",run:Pk,shift:CM},{key:"PageUp",run:SM,shift:TM},{key:"PageDown",run:Pk,shift:CM},{key:"Home",run:Oxe,shift:Kxe,preventDefault:!0},{key:"Mod-Home",run:AM,shift:MM},{key:"End",run:Dxe,shift:Gxe,preventDefault:!0},{key:"Mod-End",run:EM,shift:NM},{key:"Enter",run:IM,shift:IM},{key:"Mod-a",run:Zxe},{key:"Backspace",run:$k,shift:$k,preventDefault:!0},{key:"Delete",run:Lz,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Oz,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:i4e,preventDefault:!0},{mac:"Mod-Backspace",run:a4e,preventDefault:!0},{mac:"Mod-Delete",run:l4e,preventDefault:!0}].concat(_4e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),zz=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Rxe,shift:Vxe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Lxe,shift:Wxe},{key:"Alt-ArrowUp",run:d4e},{key:"Shift-Alt-ArrowUp",run:f4e},{key:"Alt-ArrowDown",run:h4e},{key:"Shift-Alt-ArrowDown",run:m4e},{key:"Mod-Alt-ArrowUp",run:n4e},{key:"Mod-Alt-ArrowDown",run:s4e},{key:"Escape",run:r4e},{key:"Mod-Enter",run:y4e},{key:"Alt-l",mac:"Ctrl-l",run:e4e},{key:"Mod-i",run:t4e,preventDefault:!0},{key:"Mod-[",run:w4e},{key:"Mod-]",run:v4e},{key:"Mod-Alt-\\",run:b4e},{key:"Shift-Mod-k",run:p4e},{key:"Shift-Mod-\\",run:qxe},{key:"Mod-/",run:fxe},{key:"Alt-A",run:pxe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:x4e}].concat(k4e);class Fz{constructor(t,n,s,r){this.state=t,this.pos=n,this.explicit=s,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=Ma(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),s=Math.max(n.from,this.pos-250),r=n.text.slice(s-n.from,this.pos-n.from),i=r.search(qz(t,!1));return i<0?null:{from:s+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,s){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),s&&s.onDocChange&&(this.abortOnDocChange=!0))}}function jM(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function S4e(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let i=1;i<r.length;i++)n[r[i]]=!0}let s=jM(t)+jM(n)+"*$";return[new RegExp("^"+s),new RegExp(s)]}function T4e(e){let t=e.map(r=>typeof r=="string"?{label:r}:r),[n,s]=t.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:S4e(t);return r=>{let i=r.matchBefore(s);return i||r.explicit?{from:i?i.from:r.pos,options:t,validFor:n}:null}}class RM{constructor(t,n,s,r){this.completion=t,this.source=n,this.match=s,this.score=r}}function Dd(e){return e.selection.main.from}function qz(e,t){var n;let{source:s}=e,r=t&&s[0]!="^",i=s[s.length-1]!="$";return!r&&!i?e:new RegExp(`${r?"^":""}(?:${s})${i?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const Hz=kc.define();function C4e(e,t,n,s){let{main:r}=e.selection,i=n-r.from,o=s-r.from;return{...e.changeByRange(a=>{if(a!=r&&n!=s&&e.sliceDoc(a.from+i,a.from+o)!=e.sliceDoc(n,s))return{range:a};let l=e.toText(t);return{changes:{from:a.from+i,to:s==r.from?a.to:a.from+o,insert:l},range:Ve.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const LM=new WeakMap;function A4e(e){if(!Array.isArray(e))return e;let t=LM.get(e);return t||LM.set(e,t=T4e(e)),t}const Jb=_s.define(),Np=_s.define();class E4e{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let s=zc(t,n),r=Bh(s);this.chars.push(s);let i=t.slice(n,n+r),o=i.toUpperCase();this.folded.push(zc(o==i?i.toLowerCase():o,0)),n+=r}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:s,any:r,precise:i,byWord:o}=this;if(n.length==1){let v=zc(t,0),x=Bh(v),_=x==t.length?0:-100;if(v!=n[0])if(v==s[0])_+=-200;else return null;return this.ret(_,[0,x])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let v=0,x=Math.min(t.length,200);v<x&&c<l;){let _=zc(t,v);(_==n[c]||_==s[c])&&(r[c++]=v),v+=Bh(_)}if(c<l)return null}let d=0,h=0,f=!1,m=0,p=-1,y=-1,w=/[a-z]/.test(t),b=!0;for(let v=0,x=Math.min(t.length,200),_=0;v<x&&h<l;){let E=zc(t,v);a<0&&(d<l&&E==n[d]&&(i[d++]=v),m<l&&(E==n[m]||E==s[m]?(m==0&&(p=v),y=v+1,m++):m=0));let k,M=E<255?E>=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(k=Xbe(E))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!v||M==1&&w||_==0&&M!=0)&&(n[h]==E||s[h]==E&&(f=!0)?o[h++]=v:o.length&&(b=!1)),_=M,v+=Bh(E)}return h==l&&o[0]==0&&b?this.result(-100+(f?-200:0),o,t):m==l&&p==0?this.ret(-200-t.length+(y==t.length?0:-100),[0,y]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):m==l?this.ret(-900-t.length,[p,y]):h==l?this.result(-100+(f?-200:0)+-700+(b?0:-1100),o,t):n.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,t)}result(t,n,s){let r=[],i=0;for(let o of n){let a=o+(this.astral?Bh(zc(s,o)):1);i&&r[i-1]==o?r[i-1]=a:(r[i++]=o,r[i++]=a)}return this.ret(t-s.length,r)}}class M4e{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let n=t.slice(0,this.pattern.length),s=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return s==null?null:(this.matched=[0,n.length],this.score=s+(t.length==this.pattern.length?0:-100),this)}}const Kr=Gt.define({combine(e){return aw(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:N4e,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>s=>DM(t(s),n(s)),optionClass:(t,n)=>s=>DM(t(s),n(s)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function DM(e,t){return e?t?e+" "+t:e:t}function N4e(e,t,n,s,r,i){let o=e.textDirection==qs.RTL,a=o,l=!1,c="top",d,h,f=t.left-r.left,m=r.right-t.right,p=s.right-s.left,y=s.bottom-s.top;if(a&&f<Math.min(p,m)?a=!1:!a&&m<Math.min(p,f)&&(a=!0),p<=(a?f:m))d=Math.max(r.top,Math.min(n.top,r.bottom-y))-t.top,h=Math.min(400,a?f:m);else{l=!0,h=Math.min(400,(o?t.right:r.right-t.left)-30);let v=r.bottom-t.bottom;v>=y||v>t.top?d=n.bottom-t.top:(c="bottom",d=t.bottom-n.top)}let w=(t.bottom-t.top)/i.offsetHeight,b=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${d/w}px; max-width: ${h/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const Z6=_s.define();function I4e(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let s=document.createElement("div");return s.classList.add("cm-completionIcon"),n.type&&s.classList.add(...n.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),s.setAttribute("aria-hidden","true"),s},position:20}),t.push({render(n,s,r,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let c=0;c<i.length;){let d=i[c++],h=i[c++];d>l&&o.appendChild(document.createTextNode(a.slice(l,d)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(d,h))),f.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let s=document.createElement("span");return s.className="cm-completionDetail",s.textContent=n.detail,s},position:80}),t.sort((n,s)=>n.position-s.position).map(n=>n.render)}function d4(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let r=Math.floor(t/n);return{from:r*n,to:(r+1)*n}}let s=Math.ceil((e-t)/n);return{from:e-s*n,to:e-(s-1)*n}}class j4e{constructor(t,n,s){this.view=t,this.stateField=n,this.applyCompletion=s,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let r=t.state.field(n),{options:i,selected:o}=r.open,a=t.state.facet(Kr);this.optionContent=I4e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=d4(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=t.state.field(n).open;for(let d=l.target,h;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(h=/-(\d+)$/.exec(d.id))&&+h[1]<c.length){this.applyCompletion(t,c[+h[1]]),l.preventDefault();return}if(l.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:Z6.of(d)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(Kr).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:Np.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let s=t.state.field(this.stateField),r=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),s!=r){let{options:i,selected:o,disabled:a}=s.open;(!r.open||r.open.options!=i)&&(this.range=d4(i.length,o,t.state.facet(Kr).maxRenderedOptions),this.showOptions(i,s.id)),this.updateSel(),a!=((n=r.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let s of this.currentClass.split(" "))s&&this.dom.classList.remove(s);for(let s of n.split(" "))s&&this.dom.classList.add(s);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=d4(n.options.length,n.selected,this.view.state.facet(Kr).maxRenderedOptions),this.showOptions(n.options,t.id));let s=this.updateSelectedOption(n.selected);if(s){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(r);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,r)}).catch(a=>So(this.view.state,a,"completion info")):(this.addInfoPane(o,r),s.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let s=this.info=document.createElement("div");if(s.className="cm-tooltip cm-completionInfo",s.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)s.appendChild(t),this.infoDestroy=null;else{let{dom:r,destroy:i}=t;s.appendChild(r),this.infoDestroy=i||null}this.dom.appendChild(s),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let s=this.list.firstChild,r=this.range.from;s;s=s.nextSibling,r++)s.nodeName!="LI"||!s.id?r--:r==t?s.hasAttribute("aria-selected")||(s.setAttribute("aria-selected","true"),n=s):s.hasAttribute("aria-selected")&&(s.removeAttribute("aria-selected"),s.removeAttribute("aria-describedby"));return n&&L4e(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),s=this.info.getBoundingClientRect(),r=t.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(i.bottom,n.bottom)-10||r.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(Kr).positionInfo(this.view,n,r,s,i,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,s){const r=document.createElement("ul");r.id=n,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let i=null;for(let o=s.from;o<s.to;o++){let{completion:a,match:l}=t[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=i&&(o>s.from||s.from==0))if(i=f,typeof c!="string"&&c.header)r.appendChild(c.header(c));else{let m=r.appendChild(document.createElement("completion-section"));m.textContent=f}}const d=r.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let h=this.optionClass(a);h&&(d.className=h);for(let f of this.optionContent){let m=f(a,this.view.state,this.view,l);m&&d.appendChild(m)}}return s.from&&r.classList.add("cm-completionListIncompleteTop"),s.to<t.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function R4e(e,t){return n=>new j4e(n,e,t)}function L4e(e,t){let n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),r=n.height/e.offsetHeight;s.top<n.top?e.scrollTop-=(n.top-s.top)/r:s.bottom>n.bottom&&(e.scrollTop+=(s.bottom-n.bottom)/r)}function OM(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function D4e(e,t){let n=[],s=null,r=null,i=d=>{n.push(d);let{section:h}=d.completion;if(h){s||(s=[]);let f=typeof h=="string"?h:h.name;s.some(m=>m.name==f)||s.push(typeof h=="string"?{name:f}:h)}},o=t.facet(Kr);for(let d of e)if(d.hasResult()){let h=d.result.getMatch;if(d.result.filter===!1)for(let f of d.result.options)i(new RM(f,d.source,h?h(f):[],1e9-n.length));else{let f=t.sliceDoc(d.from,d.to),m,p=o.filterStrict?new M4e(f):new E4e(f);for(let y of d.result.options)if(m=p.match(y.label)){let w=y.displayLabel?h?h(y,m.matched):[]:m.matched,b=m.score+(y.boost||0);if(i(new RM(y,d.source,w,b)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:v}=y.section;r||(r=Object.create(null)),r[v]=Math.max(b,r[v]||-1e9)}}}}if(s){let d=Object.create(null),h=0,f=(m,p)=>(m.rank==="dynamic"&&p.rank==="dynamic"?r[p.name]-r[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(m.name<p.name?-1:1);for(let m of s.sort(f))h-=1e5,d[m.name]=h;for(let m of n){let{section:p}=m.completion;p&&(m.score+=d[typeof p=="string"?p:p.name])}}let a=[],l=null,c=o.compareCompletions;for(let d of n.sort((h,f)=>f.score-h.score||c(h.completion,f.completion))){let h=d.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(d):OM(d.completion)>OM(l)&&(a[a.length-1]=d),l=d.completion}return a}class tf{constructor(t,n,s,r,i,o){this.options=t,this.attrs=n,this.tooltip=s,this.timestamp=r,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new tf(this.options,BM(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,s,r,i,o){if(r&&!o&&t.some(c=>c.isPending))return r.setDisabled();let a=D4e(t,n);if(!a.length)return r&&t.some(c=>c.isPending)?r.setDisabled():null;let l=n.facet(Kr).selectOnOpen?0:-1;if(r&&r.selected!=l&&r.selected!=-1){let c=r.options[r.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==c){l=d;break}}return new tf(a,BM(s,l),{pos:t.reduce((c,d)=>d.hasResult()?Math.min(c,d.from):c,1e8),create:F4e,above:i.aboveCursor},r?r.timestamp:Date.now(),l,!1)}map(t){return new tf(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new tf(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Zb{constructor(t,n,s){this.active=t,this.id=n,this.open=s}static start(){return new Zb($4e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,s=n.facet(Kr),i=(s.override||n.languageDataAt("autocomplete",Dd(n)).map(A4e)).map(l=>(this.active.find(d=>d.source==l)||new sa(l,this.active.some(d=>d.state!=0)?1:0)).update(t,s));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=t.effects.some(l=>l.is(e8));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!O4e(i,this.active)||a?o=tf.build(i,n,this.id,o,s,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new sa(l.source,0):l));for(let l of t.effects)l.is(Z6)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new Zb(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?B4e:P4e}}function O4e(e,t){if(e==t)return!0;for(let n=0,s=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;s<t.length&&!t[s].hasResult();)s++;let r=n==e.length,i=s==t.length;if(r||i)return r==i;if(e[n++].result!=t[s++].result)return!1}}const B4e={"aria-autocomplete":"list"},P4e={};function BM(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const $4e=[];function Uz(e,t){if(e.isUserEvent("input.complete")){let s=e.annotation(Hz);if(s&&t.activateOnCompletion(s))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class sa{constructor(t,n,s=!1){this.source=t,this.state=n,this.explicit=s}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let s=Uz(t,n),r=this;(s&8||s&16&&this.touches(t))&&(r=new sa(r.source,0)),s&4&&r.state==0&&(r=new sa(this.source,1)),r=r.updateFor(t,s);for(let i of t.effects)if(i.is(Jb))r=new sa(r.source,1,i.value);else if(i.is(Np))r=new sa(r.source,0);else if(i.is(e8))for(let o of i.value)o.source==r.source&&(r=o);return r}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Dd(t.state))}}class xf extends sa{constructor(t,n,s,r,i,o){super(t,3,n),this.limit=s,this.result=r,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var s;if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=Dd(t.state);if(a>o||!r||n&2&&(Dd(t.startState)==this.from||a<this.limit))return new sa(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return z4e(r.validFor,t.state,i,o)?new xf(this.source,this.explicit,l,r,i,o):r.update&&(r=r.update(r,i,o,new Fz(t.state,a,!1)))?new xf(this.source,this.explicit,l,r,r.from,(s=r.to)!==null&&s!==void 0?s:Dd(t.state)):new sa(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new xf(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new sa(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function z4e(e,t,n,s){if(!e)return!1;let r=t.sliceDoc(n,s);return typeof e=="function"?e(r,n,s,t):qz(e,!0).test(r)}const e8=_s.define({map(e,t){return e.map(n=>n.map(t))}}),Pi=Cl.define({create(){return Zb.start()},update(e,t){return e.update(t)},provide:e=>[Q$.from(e,t=>t.tooltip),Pt.contentAttributes.from(e,t=>t.attrs)]});function t8(e,t){const n=t.completion.apply||t.completion.label;let s=e.state.field(Pi).active.find(r=>r.source==t.source);return s instanceof xf?(typeof n=="string"?e.dispatch({...C4e(e.state,n,s.from,s.to),annotations:Hz.of(t.completion)}):n(e,t.completion,s.from,s.to),!0):!1}const F4e=R4e(Pi,t8);function ou(e,t="option"){return n=>{let s=n.state.field(Pi,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<n.state.facet(Kr).interactionDelay)return!1;let r=1,i;t=="page"&&(i=X$(n,s.open.tooltip))&&(r=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=s.open.options,a=s.open.selected>-1?s.open.selected+r*(e?1:-1):e?0:o-1;return a<0?a=t=="page"?0:o-1:a>=o&&(a=t=="page"?o-1:0),n.dispatch({effects:Z6.of(a)}),!0}}const Vz=e=>{let t=e.state.field(Pi,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Kr).interactionDelay?!1:t8(e,t.open.options[t.open.selected])},Sy=e=>e.state.field(Pi,!1)?(e.dispatch({effects:Jb.of(!0)}),!0):!1,Ty=e=>{let t=e.state.field(Pi,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Np.of(null)}),!0)};class q4e{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const H4e=50,U4e=1e3,V4e=lo.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Pi).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Pi),n=e.state.facet(Kr);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Pi)==t)return;let s=e.transactions.some(i=>{let o=Uz(i,n);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i<this.running.length;i++){let o=this.running[i];if(s||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>H4e&&Date.now()-o.time>U4e){for(let a of o.context.abortListeners)try{a()}catch(l){So(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(i=>i.effects.some(o=>o.is(Jb)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let i of e.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Pi);for(let n of t.active)n.isPending&&!this.running.some(s=>s.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Kr).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Dd(t),s=new Fz(t,n,e.explicit,this.view),r=new q4e(e,s);this.running.push(r),Promise.resolve(e.source(s)).then(i=>{r.context.aborted||(r.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:Np.of(null)}),So(this.view.state,i)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Kr).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Kr),s=this.view.state.field(Pi);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let a=Dd(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new xf(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let d of i.updates)c=c.update(d,n);if(c.hasResult()){t.push(c);continue}}let o=s.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new sa(i.active.source,0);for(let l of i.updates)a=a.update(l,n);a.isPending||t.push(a)}else this.startQuery(o)}(t.length||s.open&&s.open.disabled)&&this.view.dispatch({effects:e8.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Pi,!1);if(t&&t.tooltip&&this.view.state.facet(Kr).closeOnBlur){let n=t.open&&X$(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Np.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Jb.of(!1)}),20),this.composing=0}}}),W4e=typeof navigator=="object"&&/Win/.test(navigator.platform),G4e=uh.highest(Pt.domEventHandlers({keydown(e,t){let n=t.state.field(Pi,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(W4e&&e.altKey)||e.metaKey)return!1;let s=n.open.options[n.open.selected],r=n.active.find(o=>o.source==s.source),i=s.completion.commitCharacters||r.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&t8(t,s),!1}})),K4e=Pt.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Wz=new class extends ju{};Wz.startSide=1;Wz.endSide=-1;function Y4e(e={}){return[G4e,Pi,Kr.of(e),V4e,X4e,K4e]}const Q4e=[{key:"Ctrl-Space",run:Sy},{mac:"Alt-`",run:Sy},{mac:"Alt-i",run:Sy},{key:"Escape",run:Ty},{key:"ArrowDown",run:ou(!0)},{key:"ArrowUp",run:ou(!1)},{key:"PageDown",run:ou(!0,"page")},{key:"PageUp",run:ou(!1,"page")},{key:"Enter",run:Vz}],X4e=uh.highest(Ap.computeN([Kr],e=>e.facet(Kr).defaultKeymap?[Q4e]:[]));function fo(e){let t=e.field(Pi,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const J4e=[f2e(),uz(),r2e(),txe(rxe,{fallback:!0}),Ap.of([...zz,...mz])];/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const n8={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let e="̀".codePointAt(0);e<="ͯ".codePointAt(0);++e){const t=String.fromCodePoint(e);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const r=(n+t).normalize().codePointAt(0);r>126&&(n8[r]=n)}}const h4={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(h4)){const t=e.toUpperCase();for(let n=h4[e][0];n<=h4[e][1];++n)n8[n]=n%2===0?t:e}function mg(e){if(e<192||e>8580)return e;const t=n8[e];return t!==void 0?t.codePointAt(0):e}function Hc(e,t){return e>t?e:t}const Gz=e=>e.split("").map(t=>t.codePointAt(0)),Z4e=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)Z4e.add(e);const Yf="".codePointAt(0),Ip="A".codePointAt(0),jp="Z".codePointAt(0),Kz="a".codePointAt(0),Yz="z".codePointAt(0),e_e="0".codePointAt(0),t_e="9".codePointAt(0);function nf(e,t,n){return n?e:t-e-1}const Rp=16,zk=-3,ev=-1,Qd=Rp/2,n_e=Rp/2,s_e=Qd+ev,Qz=4,Xz=2;function Fk(e){return e?new Set:null}function Gm(e,t,n){if(t!==null&&t.i16.length>e+n){const s=t.i16.subarray(e,e+n);return[e+n,s]}return[e,new Int16Array(n)]}function PM(e,t,n){if(t!==null&&t.i32.length>e+n){const s=t.i32.subarray(e,e+n);return[e+n,s]}return[e,new Int32Array(n)]}function Jz(e){return e>=Kz&&e<=Yz?1:e>=Ip&&e<=jp?2:e>=e_e&&e<=t_e?4:0}function Zz(e){const t=String.fromCodePoint(e);return t!==t.toUpperCase()?1:t!==t.toLowerCase()?2:t.match(new RegExp("\\p{Number}","gu"))!==null?4:t.match(new RegExp("\\p{Letter}","gu"))!==null?3:0}function tv(e){return e<=Yf?Jz(e):Zz(e)}function s8(e,t){return e===0&&t!==0?Qd:e===1&&t===2||e!==4&&t===4?s_e:t===0?n_e:0}function r_e(e,t){return t===0?Qd:s8(tv(e[t-1]),tv(e[t]))}function i_e(e,t,n,s){let r=e.slice(s),i=r.indexOf(n);if(i===0)return s;if(!t&&n>=Kz&&n<=Yz){i>0&&(r=r.slice(0,i));const o=r.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:s+i}function $M(e){for(const t of e)if(t>=128)return!1;return!0}function r8(e,t,n){if(!$M(e))return 0;if(!$M(t))return-1;let s=0,r=0;for(let i=0;i<t.length;i++){if(r=i_e(e,n,t[i],r),r<0)return-1;i===0&&r>0&&(s=r-1),r++}return s}const o_e=(e,t,n,s,r,i,o)=>{const a=r.length;if(a===0)return[{start:0,end:0,score:0},Fk(i)];const l=s.length;if(o!==null&&l*a>o.i16.length)return tF(e,t,n,s,r,i);const c=r8(s,r,e);if(c<0)return[{start:-1,end:-1,score:0},null];let d=0,h=0,f=null,m=null,p=null,y=null;[d,f]=Gm(d,o,l),[d,m]=Gm(d,o,l),[d,p]=Gm(d,o,l),[h,y]=PM(h,o,a);const[,w]=PM(h,o,l);for(let B=0;B<w.length;B++)w[B]=s[B];let b=0,v=0,x=0,_=0;const E=r[0];let k=r[0],M=0,R=0,L=!1,T=w.subarray(c),N=f.subarray(c).subarray(0,T.length),I=m.subarray(c).subarray(0,T.length),O=p.subarray(c).subarray(0,T.length);for(let[B,C]of T.entries()){let z=null;C<=Yf?(z=Jz(C),!e&&z===2&&(C+=32)):(z=Zz(C),!e&&z===2&&(C=String.fromCodePoint(C).toLowerCase().codePointAt(0)),t&&(C=mg(C))),T[B]=C;const X=s8(R,z);if(O[B]=X,R=z,C===k&&(x<a&&(y[x]=c+B,x++,k=r[Math.min(x,a-1)]),_=c+B),C===E){const ae=Rp+X*Xz;if(N[B]=ae,I[B]=1,a===1&&(n&&ae>b||!n&&ae>=b)&&(b=ae,v=c+B,n&&X===Qd))break;L=!1}else L?N[B]=Hc(M+ev,0):N[B]=Hc(M+zk,0),I[B]=0,L=!0;M=N[B]}if(x!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const B={start:v,end:v+1,score:b};if(!i)return[B,null];const C=new Set;return C.add(v),[B,C]}const U=y[0],F=_-U+1;let j=null;[d,j]=Gm(d,o,F*a);{const B=f.subarray(U,_+1);for(const[C,z]of B.entries())j[C]=z}let[,V]=Gm(d,o,F*a);{const B=m.subarray(U,_+1);for(const[C,z]of B.entries())V[C]=z}const ee=y.subarray(1),ce=r.slice(1).slice(0,ee.length);for(const[B,C]of ee.entries()){let z=!1;const X=ce[B],ae=B+1,be=ae*F,fe=w.subarray(C,_+1),ie=p.subarray(C).subarray(0,fe.length),G=V.subarray(be+C-U).subarray(0,fe.length),q=V.subarray(be+C-U-1-F).subarray(0,fe.length),le=j.subarray(be+C-U).subarray(0,fe.length),Se=j.subarray(be+C-U-1-F).subarray(0,fe.length),$e=j.subarray(be+C-U-1).subarray(0,fe.length);$e[0]=0;for(const[Ae,we]of fe.entries()){const ct=Ae+C;let ht=0,ut=0,ft=0;if(z?ut=$e[Ae]+ev:ut=$e[Ae]+zk,X===we){ht=Se[Ae]+Rp;let qt=ie[Ae];ft=q[Ae]+1,qt===Qd?ft=1:ft>1&&(qt=Hc(qt,Hc(Qz,p[ct-ft+1]))),ht+qt<ut?(ht+=ie[Ae],ft=0):ht+=qt}G[Ae]=ft,z=ht<ut;const tt=Hc(Hc(ht,ut),0);ae===a-1&&(n&&tt>b||!n&&tt>=b)&&(b=tt,v=ct),le[Ae]=tt}}const $=Fk(i);let J=U;if(i&&$!==null){let B=a-1;J=v;let C=!0;for(;;){const z=B*F,X=J-U,ae=j[z+X];let be=0,fe=0;if(B>0&&J>=y[B]&&(be=j[z-F+X-1]),J>y[B]&&(fe=j[z+X-1]),ae>be&&(ae>fe||ae===fe&&C)){if($.add(J),B===0)break;B--}C=V[z+X]>1||z+F+X+1<V.length&&V[z+F+X+1]>0,J--}}return[{start:J,end:v+1,score:b},$]};function eF(e,t,n,s,r,i,o){let a=0,l=0,c=!1,d=0,h=0;const f=Fk(o);let m=0;r>0&&(m=tv(n[r-1]));for(let p=r;p<i;p++){let y=n[p];const w=tv(y);if(e||(y>=Ip&&y<=jp?y+=32:y>Yf&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=mg(y)),y===s[a]){o&&f!==null&&f.add(p),l+=Rp;let b=s8(m,w);d===0?h=b:(b===Qd&&(h=b),b=Hc(Hc(b,h),Qz)),a===0?l+=b*Xz:l+=b,c=!1,d++,a++}else c?l+=ev:l+=zk,c=!0,d=0,h=0;m=w}return[l,f]}const tF=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];if(r8(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,l=-1,c=-1;const d=s.length,h=r.length;for(let f=0;f<d;f++){let m=s[nf(f,d,n)];e||(m>=Ip&&m<=jp?m+=32:m>Yf&&(m=String.fromCodePoint(m).toLowerCase().codePointAt(0))),t&&(m=mg(m));const p=r[nf(a,h,n)];if(m===p&&(l<0&&(l=f),a++,a===h)){c=f+1;break}}if(l>=0&&c>=0){a--;for(let p=c-1;p>=l;p--){const y=nf(p,d,n);let w=s[y];e||(w>=Ip&&w<=jp?w+=32:w>Yf&&(w=String.fromCodePoint(w).toLowerCase().codePointAt(0)));const b=nf(a,h,n),v=r[b];if(w===v&&(a--,a<0)){l=p;break}}if(!n){const p=l;l=d-c,c=d-p}const[f,m]=eF(e,t,s,r,l,c,i);return[{start:l,end:c,score:f},m]}return[{start:-1,end:-1,score:0},null]},a_e=(e,t,n,s,r,i,o)=>{if(r.length===0)return[{start:0,end:0,score:0},null];const a=s.length,l=r.length;if(a<l)return[{start:-1,end:-1,score:0},null];if(r8(s,r,e)<0)return[{start:-1,end:-1,score:0},null];let c=0,d=-1,h=0,f=-1;for(let m=0;m<a;m++){const p=nf(m,a,n);let y=s[p];e||(y>=Ip&&y<=jp?y+=32:y>Yf&&(y=String.fromCodePoint(y).toLowerCase().codePointAt(0))),t&&(y=mg(y));const w=nf(c,l,n);if(r[w]===y){if(w===0&&(h=r_e(s,p)),c++,c===l){if(h>f&&(d=m,f=h),h===Qd)break;m-=c-1,c=0,h=0}}else m-=c,c=0,h=0}if(d>=0){let m=0,p=0;n?(m=d-l+1,p=d+1):(m=a-(d+1),p=a-(d-l+1));const[y]=eF(e,t,s,r,m,p,!1);return[{start:m,end:p,score:y},null]}return[{start:-1,end:-1,score:0},null]},l_e=100*1024,c_e=2048;function u_e(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const d_e=u_e(l_e,c_e),h_e=(e,t,n)=>{let s=!1;switch(t){case"smart-case":e.toLowerCase()!==e&&(s=!0);break;case"case-sensitive":s=!0;break;case"case-insensitive":e=e.toLowerCase(),s=!1;break}let r=Gz(e);return n&&(r=r.map(mg)),{queryRunes:r,caseSensitive:s}};function f_e(e,t){const n=Object.keys(e).map(r=>parseInt(r,10)).sort((r,i)=>i-r);let s=[];for(const r of n)if(s=s.concat(e[r]),s.length>=t)break;return s}function m_e(e,t,n){return s=>{const r=this.runesList[s];if(t.length>r.length)return;let[i,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,r,t,!0,d_e);if(i.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let l=i.start;l<i.end;++l)o.add(l)}const a=this.opts.sort?i.score:0;e[a]===void 0&&(e[a]=[]),e[a].push({item:this.items[s],...i,positions:o??new Set})}}function p_e(e){const{queryRunes:t,caseSensitive:n}=h_e(e,this.opts.casing,this.opts.normalize),s={},r=m_e.bind(this)(s,t,n);for(let i=0,o=this.runesList.length;i<o;++i)r(i);return f_e(s,this.opts.limit)}const nF={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class g_e{constructor(t,...n){switch(this.opts={...nF,...n[0]},this.items=t,this.runesList=t.map(s=>Gz(this.opts.selector(s).normalize())),this.algoFn=a_e,this.opts.fuzzy){case"v2":this.algoFn=o_e;break;case"v1":this.algoFn=tF;break}}}const y_e={...nF,match:p_e};class b_e extends g_e{constructor(t,...n){super(t,...n),this.opts={...y_e,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(v_e);t=t.normalize();let n=this.opts.match.bind(this)(t);return w_e(n,this.opts)}}const v_e=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function w_e(e,t){if(t.sort){const{selector:n}=t;e.sort((s,r)=>{if(s.score===r.score)for(const i of t.tiebreakers){const o=i(s,r,n);if(o!==0)return o}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}class x_e{constructor(t,...n){this.finder=new b_e(t,...n),this.find=this.finder.find.bind(this.finder)}}const Lp=["custom","skill","system"];function qk(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function __e(e,t,n=Lp){return zM(qk(e),n)-zM(qk(t),n)}function zM(e,t=Lp){const n=t.indexOf(e);return n>=0?n:t.length+Lp.indexOf(e)}const i8=String.raw`([^\s/]+)`,vw={agents:[{name:"manage",description:"管理现有 subagents"},{name:"create",description:"创建新的 subagent"}],theme:[{name:"light",description:"切换到浅色主题"},{name:"dark",description:"切换到深色主题"}],export:[{name:"md",description:"将会话导出为 Markdown 文件"},{name:"html",description:"将会话导出为 HTML 文件"},{name:"json",description:"将会话导出为 JSON 文件"},{name:"jsonl",description:"将会话导出为 JSONL 文件（每行一条消息）"}],language:[{name:"ui",description:"设置 UI 语言",children:[{name:"en",description:"English"},{name:"zh-CN",description:"中文"}]},{name:"output",description:"设置 LLM 输出语言"}],extensions:[{name:"manage",description:"管理扩展"},{name:"install",description:"安装扩展"}]},ww={agents:[{name:"manage",description:"Manage existing subagents"},{name:"create",description:"Create a new subagent"}],theme:[{name:"light",description:"Switch to light theme"},{name:"dark",description:"Switch to dark theme"}],export:[{name:"md",description:"Export as Markdown"},{name:"html",description:"Export as HTML"},{name:"json",description:"Export as JSON"},{name:"jsonl",description:"Export as JSONL"}],language:[{name:"ui",description:"Set UI language",children:[{name:"en",description:"English"},{name:"zh-CN",description:"中文"}]},{name:"output",description:"Set LLM output language"}],extensions:[{name:"manage",description:"Manage installed extensions"},{name:"install",description:"Install an extension from a source"}]},xw={context:[{name:"detail",description:"显示详细上下文信息"}],copy:[{name:"code",description:"复制代码块"},{name:"latex",description:"复制 LaTeX 公式"},{name:"inline-latex",description:"复制行内 LaTeX 公式"}],tools:[{name:"desc",description:"显示工具详细描述"}],stats:[{name:"model",description:"显示各模型使用统计"},{name:"tools",description:"显示工具使用统计"}],mcp:[{name:"desc",description:"显示 MCP server 和工具描述"},{name:"nodesc",description:"隐藏 MCP server 和工具描述"},{name:"schema",description:"显示工具参数 schema"}],memory:[{name:"show",description:"查看 memory 文件"},{name:"add",description:"新增 memory"},{name:"refresh",description:"刷新 memory 文件列表"}]},_w={context:[{name:"detail",description:"Show detailed context info"}],copy:[{name:"code",description:"Copy code blocks"},{name:"latex",description:"Copy LaTeX formula"},{name:"inline-latex",description:"Copy inline LaTeX formula"}],tools:[{name:"desc",description:"Show tool descriptions"}],stats:[{name:"model",description:"Show per-model usage statistics"},{name:"tools",description:"Show tool usage statistics"}],mcp:[{name:"desc",description:"Show MCP server and tool descriptions"},{name:"nodesc",description:"Hide MCP server and tool descriptions"},{name:"schema",description:"Show tool parameter schemas"}],memory:[{name:"show",description:"Show memory files"},{name:"add",description:"Add memory"},{name:"refresh",description:"Refresh memory files"}]};function k_e(e,t,n,s,r){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let o=(s==="zh-CN"?vw:ww)[e];if(o||(o=(s==="zh-CN"?xw:_w)[e]),!o&&t.length===0&&(r!=null&&r.length)&&(o=r.map(a=>({name:a,description:""}))),!o)return null;for(const a of t){const l=o.find(c=>c.name===a);if(!(l!=null&&l.children))return null;o=l.children}return o}function S_e(e,t,n){const s=e.toLowerCase(),r=t.toLowerCase(),i=s.startsWith(n),o=r.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function T_e(e,t,n,s){const r=__e(e,t,s);return r!==0?r:0}const C_e={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function A_e(e,t){if(!e||e.includes(" ")||/^[/@!?]/.test(e))return null;const n=e.toLowerCase(),s=t.find(r=>r.name.toLowerCase().startsWith(n));return s?`/${s.name} `:null}function E_e(e,t,n){var c;const s=e.match(new RegExp(`^/${i8}\\s+$`));if(!s)return null;const r=s[1],i=t.find(d=>d.name===r),o=n==="zh-CN"?vw:ww;if((c=i==null?void 0:i.subcommands)!=null&&c.length||o[r]||r==="skills")return null;const l=(n==="zh-CN"?xw:_w)[r];return!l||l.length===0?null:`/${r} ${l[0].name} `}function M_e(e,t,n){var d,h;const s=e.match(new RegExp(`^/${i8}(\\s*)$`));if(!s)return null;const r=s[1],i=t.find(f=>f.name===r);if(!i)return null;const o=(d=i.argumentHint)==null?void 0:d.trim();if(o)return o;const a=n==="zh-CN"?vw:ww;if((h=i.subcommands)!=null&&h.length||a[r]||r==="skills")return null;const c=(n==="zh-CN"?xw:_w)[r];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function N_e(e,t){const n=Math.max(0,Math.min(t,e.length)),s=e.lastIndexOf(`
`,Math.max(0,n-1))+1,r=e.indexOf(`
`,n),i=r===-1?e.length:r;return{lineStart:s,lineEnd:i,lineText:e.slice(s,i),textBefore:e.slice(s,n),cursor:n}}const FM=new WeakMap;function I_e(e){let t=FM.get(e);if(!t){const n=[],s=new Map;for(const r of e)s.has(r.name)||(n.push(r.name),s.set(r.name,r));t={fzf:new x_e(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:s},FM.set(e,t)}return t}function j_e(e,t){try{const{fzf:n,byName:s}=I_e(e),r=[];for(const i of n.find(t)){const o=s.get(i.item);o&&r.push(o)}return r}catch(n){console.warn("[web-shell] slash fuzzy search failed, falling back to substring match:",n);const s=t.toLowerCase();return e.filter(r=>r.name.toLowerCase().includes(s))}}function R_e(e,t,n,s=[],r="en",i=a=>a,o=Lp){var v,x;const{lineStart:a,lineEnd:l,lineText:c,textBefore:d,cursor:h}=N_e(e,t),f=d.match(new RegExp(`^/${i8}\\s+(.*)$`));if(f){const[,_,E]=f,k=n.find($=>$.name===_),M=r==="zh-CN"?vw:ww,R=r==="zh-CN"?xw:_w,L=!!M[_]||_==="skills",T=!!R[_];if(!((v=k==null?void 0:k.subcommands)!=null&&v.length)&&!L&&!T)return null;const N=E.split(/\s+/),I=N.pop()||"",O=N;if(!((x=k==null?void 0:k.subcommands)!=null&&x.length)&&!L&&T&&!I)return null;const U=k_e(_,O,s,r,k==null?void 0:k.subcommands);if(!U)return null;const F=I.toLowerCase(),j=`/${_} ${O.length>0?O.join(" ")+" ":""}`,V=U.filter($=>!I||$.name.toLowerCase().includes(F)).sort(($,J)=>I?S_e($.name,J.name,F):0),ee=_==="skills"&&O.length===0,ce=V.map($=>{const J=`${j}${$.name}`;return{id:J,label:$.name,detail:$.description||void 0,apply:`${J} `,...ee?{type:"skill"}:{}}});return ce.length===0?null:{kind:"subcommand",from:a,to:h,query:I,items:ce}}const m=c.match(/^\/([^\s/]*)$/);if(!m)return null;const p=m[1],y=p.length===0,b=(y?[...n].sort((_,E)=>T_e(_,E,"",o)):j_e(n,p)).map(_=>{const E=`/${_.name} `,k=qk(_),M=k==="custom"||k==="skill";return{id:_.name,label:`/${_.name}`,detail:_.description||void 0,apply:E,category:k,...y?{section:i(C_e[k])}:{},...M&&_.description?{type:"command-info"}:{}}});return b.length===0?null:{kind:"command",from:a,to:l,query:p,items:b}}const L_e="qwen-web-shell-history",sF=100;function D_e(e){try{const t=localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.filter(s=>typeof s=="string"):[]}catch{return[]}}function O_e(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-sF)))}catch{}}function qM(e=L_e){const t=g.useRef(e);t.current=e;const n=g.useRef(D_e(e)),s=g.useRef(-1),r=g.useRef(""),i=g.useRef(-1),[o,a]=g.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=g.useCallback(()=>{const v=n.current,x=s.current;a({canUp:v.length>0&&(x===-1||x>0),canDown:x!==-1})},[]),c=g.useCallback(v=>{const x=n.current;x[x.length-1]!==v&&(x.push(v),x.length>sF&&x.shift(),O_e(t.current,x),s.current=-1,l())},[l]),d=g.useCallback(v=>{const x=n.current;if(x.length===0)return null;if(s.current===-1)r.current=v,s.current=x.length-1;else if(s.current>0)s.current--;else return null;return l(),x[s.current]},[l]),h=g.useCallback(()=>{const v=n.current;return s.current===-1?null:s.current<v.length-1?(s.current++,l(),v[s.current]):(s.current=-1,l(),r.current)},[l]),f=g.useCallback(()=>s.current!==-1,[]),m=g.useCallback(()=>{s.current=-1,i.current=-1,l()},[l]),p=g.useCallback(v=>{const x=n.current;if(x.length===0||!v)return null;const _=i.current===-1?x.length-1:i.current-1;if(_<0)return i.current=-1,null;const E=v.toLowerCase();for(let k=_;k>=0;k--)if(x[k].toLowerCase().includes(E))return i.current=k,x[k];return i.current=-1,null},[]),y=g.useCallback(v=>{const x=v.trim().toLowerCase();return n.current.slice().reverse().filter(_=>!x||_.toLowerCase().includes(x))},[]),w=g.useCallback(v=>{const x=n.current;if(!v)return x.length>0?x[x.length-1]:null;for(let _=x.length-1;_>=0;_--)if(v(x[_]))return x[_];return null},[]),b=g.useCallback(()=>{i.current=-1},[]);return{push:c,navigateUp:d,navigateDown:h,isNavigating:f,reset:m,searchReverse:p,getReverseMatches:y,getLastEntry:w,resetSearch:b,nav:o}}function f4(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function Hk(e,t,n){let s=e.get(t);return s||(s=n().catch(r=>{throw e.delete(t),r}),e.set(t,s)),s}const B_e=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,P_e=[],HM=150,Xd=50,rF=Xd+1,Jr="files",pm="extensions",ti="mcp-resources",$_e="\x1B",iF=new RegExp(`${$_e}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),oF=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,nv="[invalid]",z_e=/[^\p{L}\p{N}_./-]/gu;function Cy(e){return e===Jr||e===pm||e===ti}function aF(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function oc(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){t.pop();continue}t.push(n)}return t.length>0?t.join("/"):"."}function lF(e){return e.replace(/[\\*?[{\]}]/g,"\\$&")}function sv(e,...t){const n=e.toLowerCase();return t.some(s=>s==null?void 0:s.toLowerCase().includes(n))}function UM(e){const t=oc(e),n=pl(t);return t==="."?"@./ ":`@${Jd(n)}/ `}function F_e(e,t){return`${e}:${t}`}function Jd(e){return e.replace(z_e,"\\$&")}function o8(e){return e.replace(/\\(.)/g,"$1")}function cF(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function q_e(e,t){return`@${Jd(F_e(pl(e),pl(t)))} `}function H_e(e,t,n){const s=o8(e);return t===ti&&n&&s.startsWith(`${n}:`)?{providerId:ti,serverName:n,itemQuery:s.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:pm,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:ti,itemQuery:e.slice(4)}:null}function U_e(e,t,n){if(e===pm&&t.startsWith("ext:")||e===ti&&t.startsWith("mcp:"))return t.slice(4);const s=o8(t);return e===ti&&n&&s.startsWith(`${n}:`)?s.slice(n.length+1):!Cy(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function V_e(e,t,n,s){if(n!=null&&n.aborted)return!1;const r=s??(e==null?void 0:e.loadMcpStatus);if(!r)return!1;try{const i=await r();return n!=null&&n.aborted?!1:i.servers.some(o=>o.name===t&&!o.disabled)}catch(i){return console.warn(`Failed to verify @ MCP server "${t}" status`,i),!1}}function W_e(e){const t=oc(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function uF(e,t){const n=o8(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),s=n.lastIndexOf("/");if(s<0)return{dirPath:oc(t),entryQuery:n};const r=n.slice(0,s),i=oc(t),o=i==="."?r:aF(i,r);return{dirPath:oc(o),entryQuery:n.slice(s+1)}}function G_e(e){if(!e)return null;const t=e.state.selection.main;if(!t.empty)return null;const n=e.state.doc.lineAt(t.head),r=n.text.slice(0,t.head-n.from).match(B_e);if(!r)return null;const i=t.head-r[0].length;if(i>n.from){const o=e.state.doc.sliceString(i-1,i);if(!/[\s([{'"]/.test(o))return null}return{from:i,to:t.head,query:r[1]??""}}function sr(e){const t=e.replace(iF,"").replace(oF,"").split("").filter(cF).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function pl(e){const t=e.replace(iF,"").replace(oF,"").split("").filter(cF).join("");return t.length>0?t:nv}function ac(e){return e===void 0?nv:sr(e)??nv}function K_e(e){if(e!==void 0)return pl(e).trim()}function Y_e(e){if(!e)return;const t=e.kind===void 0?void 0:sr(e.kind);return{id:sr(e.id)??nv,label:e.label===void 0?void 0:sr(e.label),value:e.value===void 0?void 0:sr(e.value),removable:e.removable,kind:t,serialized:K_e(e.serialized)}}function Q_e(e,t){const n={...e,label:sr(e.label)??ac(e.id),description:e.description===void 0?void 0:sr(e.description),detail:e.detail===void 0?void 0:sr(e.detail),insertText:e.insertText===void 0?void 0:pl(e.insertText),composerTag:Y_e(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const s={...n};return delete s.targetPath,delete s.serverName,{...s,kind:"insert"}}function X_e(e,t,n){var r;const s=n.trim();return s?t.composerTag?{...t.composerTag,serialized:((r=t.composerTag.serialized)==null?void 0:r.trim())||s}:e===pm?{id:`extension:${s}`,kind:"extension",value:t.label,serialized:s}:e===ti?{id:`mcp:${s}`,kind:"mcp",value:t.label,serialized:s}:e===Jr?{id:`file:${s}`,kind:"file",value:t.description??t.label,serialized:s}:null:null}function J_e(e,t,n,s,r){return{id:Jr,label:s,description:r,order:1,async search({query:i,signal:o}){const a=e(),l=oc(t()),c=a==null?void 0:a.listDirectory;if(c)try{const{dirPath:h,entryQuery:f}=uF(i,l),m=f.toLowerCase(),p=await Hk(n().directories,h,()=>c(h,{signal:o}));if(o.aborted)return[];const y=p.entries.filter(b=>!b.ignored).filter(b=>b.name.toLowerCase().includes(m)).sort((b,v)=>b.kind==="directory"&&v.kind!=="directory"?-1:b.kind!=="directory"&&v.kind==="directory"?1:b.name.localeCompare(v.name)),w={id:`current:${h}`,label:UM(h).trim(),description:sr(h),insertText:UM(h),kind:"insert"};return[...f?[]:[w],...y.map(b=>{const v=aF(h,b.name),x=ac(b.name),_=sr(v),E=pl(v);return b.kind==="directory"?{id:`dir:${v}`,label:`${x}/`,description:_,kind:"directory",targetPath:v}:{id:`file:${v}`,label:x,description:_,insertText:`@${Jd(E)} `,kind:"insert"}})].slice(0,f?Xd:rF)}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}const d=a==null?void 0:a.globWorkspace;if(!d)return console.warn("[@mention] file provider unavailable: workspace actions are not configured"),[];try{const h=i?`${lF(i)}*`:"**/*",f=await Hk(n().globResults,h,()=>d(h,{maxResults:Xd,signal:o}));return o.aborted?[]:f.matches.filter(m=>m!==".").map(m=>({id:m,label:ac(m),insertText:`@${Jd(pl(m))} `,kind:"insert"}))}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}}}}function Z_e(e,t,n,s){return{id:pm,label:n,description:s,order:2,async search({query:r,signal:i}){var a;const o=(a=e())==null?void 0:a.loadExtensionsStatus;if(!o)return[];try{const l=t();l.extensionsStatus??(l.extensionsStatus=o().catch(h=>{throw l.extensionsStatus=void 0,h}));const c=await l.extensionsStatus;if(i.aborted)return[];const d=r.toLowerCase();return c.extensions.filter(h=>h.isActive).map(h=>{const f=ac(h.name),m=Jd(pl(h.name)),p=sr(h.displayName??""),y=sr(h.description??"");return{id:h.name,label:f,description:p&&p!==f?p:y,detail:p&&y?`${p} - ${y}`:p??y,insertText:`@ext:${m} `}}).filter(h=>sv(d,h.label,h.description)).sort((h,f)=>{const m=h.label.toLowerCase(),p=f.label.toLowerCase(),y=m.startsWith(d)?0:1,w=p.startsWith(d)?0:1;return y!==w?y-w:m.localeCompare(p)}).slice(0,Xd)}catch(l){return i.aborted||console.warn("Failed to load @ extension suggestions",l),[]}}}}function e3e(e,t,n,s,r){return{id:ti,label:n,description:s,order:3,async search({query:i,signal:o}){var l;const a=(l=e())==null?void 0:l.loadMcpStatus;if(!a)return[];try{const c=t();c.mcpStatus??(c.mcpStatus=a().catch(f=>{throw c.mcpStatus=void 0,f}));const d=await c.mcpStatus;if(o.aborted)return[];const h=i.toLowerCase();return d.servers.filter(f=>!f.disabled).map(f=>{const m=pl(f.name),p=f.resourceCount===void 0?void 0:r(f.resourceCount);return f.resourceCount===0?{id:`mcp-server-ref:${f.name}`,label:ac(f.name),description:sr(f.description??""),detail:sr(f.description??""),insertText:`@mcp:${Jd(m)} `,kind:"insert"}:{id:`mcp-server:${f.name}`,label:ac(f.name),description:p===void 0?sr(f.description??""):p,detail:sr(f.description??""),kind:"mcp-server",serverName:f.name}}).filter(f=>sv(h,f.label,f.description)).sort((f,m)=>f.label.localeCompare(m.label)).slice(0,Xd)}catch(c){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",c),[]}}}}function t3e(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function n3e({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:s,providers:r=P_e,createInlineTagEffect:i}){const{t:o}=Xe(),[a,l]=g.useState(null),c=g.useRef(null),d=g.useRef(0),h=g.useRef(null),f=g.useRef(null),m=g.useRef("."),p=g.useRef(f4()),y=g.useRef(null),w=g.useRef(null),b=g.useRef(!1),v=g.useMemo(()=>{const C=[J_e(()=>s.current,()=>m.current,()=>p.current,o("at.category.files"),o("at.category.files.description")),Z_e(()=>s.current,()=>p.current,o("at.category.extensions"),o("at.category.extensions.description")),e3e(()=>s.current,()=>p.current,o("at.category.mcpResources"),o("at.category.mcpResources.description"),X=>o("mcp.resourceCount",{count:X}))],z=new Set(C.map(X=>X.id));return[...C,...r.filter(X=>!z.has(X.id))].sort((X,ae)=>(X.order??0)-(ae.order??0))},[r,o,s]),x=g.useRef(v);x.current=v;const _=g.useMemo(()=>v.map(C=>({id:C.id,label:sr(C.label)??ac(C.id),description:C.description===void 0?void 0:sr(C.description)})),[v]),E=g.useRef(_);E.current=_;const k=g.useCallback(C=>{const z=typeof C=="function"?C(c.current):C;c.current=z,l(z)},[]),M=g.useCallback(()=>{var C;(C=h.current)==null||C.abort(),h.current=null,f.current&&(clearTimeout(f.current),f.current=null)},[]),R=g.useCallback((C={})=>{M(),p.current=f4();const z=C.preserveProviderSelection||b.current;b.current=!1,z||(y.current=null,w.current=null),k(null)},[M,k]),L=g.useCallback(()=>{const C=c.current;return C?C.level==="items"?(M(),k({...C,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0}),"categories"):(R(),"closed"):!1},[M,R,k]);g.useEffect(()=>()=>{var C;f.current&&clearTimeout(f.current),(C=h.current)==null||C.abort(),h.current=null,m.current=".",p.current=f4()},[]);const T=g.useCallback((C,z,X)=>{const ae=c.current;return(ae==null?void 0:ae.level)!=="items"||ae.selectedProviderId!==C||ae.itemMode!==X.itemMode||ae.mcpServerName!==X.mcpServerName||ae.fileDirectory!==X.fileDirectory?[]:ae.query!==z&&!Cy(C)?[]:C===Jr&&z===""&&m.current==="."?[]:ae.items},[]),N=g.useCallback((C,z)=>{const X=s.current,ae=p.current;if(C===Jr){if(X!=null&&X.listDirectory){const{dirPath:fe}=uF(z,oc(m.current));return ae.directories.has(fe)}const be=z?`${lF(z)}*`:"**/*";return!!(X!=null&&X.globWorkspace)&&ae.globResults.has(be)}return C===pm?ae.extensionsStatus!==void 0:C===ti?ae.mcpStatus!==void 0:!1},[s]),I=g.useCallback((C,z,X,ae={})=>{var q;const be=x.current.find(le=>le.id===C);if(!be){console.warn(`[@mention] provider="${C}" not found (may have been removed)`),k(null);return}(q=h.current)==null||q.abort();const fe=new AbortController;h.current=fe;const ie=d.current+1;d.current=ie;const G=T(C,z,X);ae.loadingAlreadySet||k({...X,items:G,loading:!0}),Promise.resolve().then(()=>be.search({query:z,signal:fe.signal})).then(le=>{fe.signal.aborted||d.current!==ie||k(Se=>{if(!Se||Se.level!=="items")return Se;const $e=C===Jr&&z.length===0?rF:Xd;return{...Se,items:le.slice(0,$e).map(Ae=>Q_e(Ae,{customProvider:!Cy(C)})),selectedIndex:0,loading:!1}})}).catch(le=>{fe.signal.aborted||d.current!==ie||(console.warn(`[@mention] provider="${C}" query=<redacted> failed`,le),k(Se=>!Se||Se.level!=="items"?Se:{...Se,items:[],selectedIndex:0,loading:!1}))})},[T,k]),O=g.useCallback((C,z,X)=>{var be;f.current&&clearTimeout(f.current),(be=h.current)==null||be.abort(),h.current=null;const ae=T(C,z,X);if(k({...X,items:ae,loading:!0}),N(C,z)){I(C,z,X,{loadingAlreadySet:!0});return}f.current=setTimeout(()=>{f.current=null,I(C,z,X,{loadingAlreadySet:!0})},HM)},[T,N,I,k]),U=g.useCallback((C,z,X,ae={})=>{var $e,Ae;const be=s.current,fe=be==null?void 0:be.loadMcpResources;if(!fe){console.warn(`[@mention] loadMcpResources not available for server="${C}"`),k({...X,items:[],loading:!1});return}($e=h.current)==null||$e.abort();const ie=new AbortController;h.current=ie;const G=d.current+1;d.current=G;const q=((Ae=c.current)==null?void 0:Ae.level)==="items"&&c.current.itemMode==="mcpResources"&&c.current.mcpServerName===C?c.current.items:[];ae.loadingAlreadySet||k({...X,items:q,loading:!0});const le=be==null?void 0:be.loadMcpStatus;(ae.validateServer?V_e(be,C,ie.signal,le?()=>{const we=p.current;return we.mcpStatus??(we.mcpStatus=le().catch(ct=>{throw we.mcpStatus=void 0,ct})),we.mcpStatus}:void 0):Promise.resolve(!0)).then(we=>ie.signal.aborted?{resources:[]}:we?Hk(p.current.mcpResources,C,()=>fe(C,{signal:ie.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:C}),{resources:[]})).then(we=>{if(ie.signal.aborted||d.current!==G)return;const ct=we.resources.map(ht=>{const ut=sr(ht.title??"")??sr(ht.name??"")??ac(ht.uri);return{id:`mcp-resource:${C}:${ht.uri}`,label:ut,description:sr(ht.description??"")??sr(ht.mimeType??""),detail:ac(ht.uri),insertText:q_e(C,ht.uri),kind:"insert"}}).filter(ht=>sv(z,ht.label,ht.description,ht.detail)).sort((ht,ut)=>ht.label.localeCompare(ut.label)).slice(0,Xd);k(ht=>!ht||ht.level!=="items"?ht:{...ht,items:ct,selectedIndex:0,loading:!1})}).catch(we=>{ie.signal.aborted||d.current!==G||(console.warn("Failed to load @ MCP resources",we),k(ct=>!ct||ct.level!=="items"?ct:{...ct,items:[],selectedIndex:0,loading:!1}))})},[k,s]),F=g.useCallback((C,z,X,ae={})=>{var fe,ie;f.current&&clearTimeout(f.current),(fe=h.current)==null||fe.abort(),h.current=null;const be=((ie=c.current)==null?void 0:ie.level)==="items"&&c.current.itemMode==="mcpResources"&&c.current.mcpServerName===C&&X.itemMode==="mcpResources"?c.current.items:[];if(k({...X,items:be,loading:!0}),p.current.mcpResources.has(C)){U(C,z,X,{...ae,loadingAlreadySet:!0});return}f.current=setTimeout(()=>{f.current=null,U(C,z,X,{...ae,loadingAlreadySet:!0})},HM)},[U,k]),j=g.useCallback(C=>{if(t.current||n.current)return R(),!1;const z=G_e(C);if(!z)return R(),!1;const X=c.current;if((X==null?void 0:X.level)==="items"&&X.from===z.from&&(X.to===z.to||X.inputMode==="search"&&z.to>=X.to||X.inputMode==="context"&&z.to>=X.to)&&X.selectedProviderId!==void 0&&E.current.some(fe=>fe.id===X.selectedProviderId)){if(!X.selectedProviderId)return!0;const fe=X.selectedProviderId,ie=X.inputMode==="context"?U_e(fe,z.query,X.mcpServerName):X.query;if(ie!==X.query){const G={...X,from:z.from,to:z.to,query:ie,selectedIndex:0,providers:E.current};return fe===ti&&X.itemMode==="mcpResources"&&X.mcpServerName?(F(X.mcpServerName,ie,G,{validateServer:X.validateMcpServer}),!0):(O(fe,ie,G),!0)}return k({...X,from:z.from,to:z.to,query:ie,providers:E.current}),!0}const be=E.current.filter(fe=>sv(z.query,fe.label,fe.description));if(be.length===0&&z.query){const fe=H_e(z.query,y.current,w.current);if(fe&&E.current.some(G=>G.id===fe.providerId))return fe.providerId===ti&&fe.serverName?(w.current=fe.serverName,F(fe.serverName,fe.itemQuery,{from:z.from,to:z.to,query:fe.itemQuery,level:"items",selectedProviderId:ti,selectedIndex:0,providers:E.current,itemMode:"mcpResources",mcpServerName:fe.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:fe.validateServer},{validateServer:fe.validateServer}),!0):(O(fe.providerId,fe.itemQuery,{from:z.from,to:z.to,query:fe.itemQuery,level:"items",selectedProviderId:fe.providerId,selectedIndex:0,providers:E.current,itemMode:"default",mcpServerName:void 0,fileDirectory:fe.providerId===Jr?m.current:void 0,inputMode:"context"}),!0);const ie=E.current.find(G=>!Cy(G.id)&&z.query.startsWith(`${G.id}:`));if(ie){const G=z.query.slice(ie.id.length+1);return O(ie.id,G,{from:z.from,to:z.to,query:G,level:"items",selectedProviderId:ie.id,selectedIndex:0,providers:E.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(E.current.some(G=>G.id===Jr))return m.current=".",O(Jr,z.query,{from:z.from,to:z.to,query:z.query,level:"items",selectedProviderId:Jr,selectedIndex:0,providers:E.current,itemMode:"default",mcpServerName:void 0,fileDirectory:m.current,inputMode:"context"}),!0}return k({from:z.from,to:z.to,query:z.query,level:"categories",selectedIndex:0,providers:be,items:[],loading:!1,inputMode:void 0}),!0},[R,t,O,F,k,n]),V=g.useCallback(C=>{const z=c.current;if(!z)return!1;const X=z.level==="categories"?z.providers.length:z.items.length;if(X<=0)return!0;const ae=t3e(z.selectedIndex,X,C);return ae===null||k({...z,selectedIndex:ae}),!0},[k]),ee=g.useCallback(C=>{const z=c.current;if(!z)return!1;const X=z.level==="categories"?z.providers.length:z.items.length;return C<0||C>=X?!1:(k({...z,selectedIndex:C}),!0)},[k]),ce=g.useCallback(C=>{const z=c.current;if(!z||z.level!=="categories")return!1;const X=z.providers[C??z.selectedIndex];return X?(y.current=X.id,X.id===Jr&&(m.current="."),O(X.id,z.query,{...z,level:"items",selectedProviderId:X.id,selectedIndex:0,itemMode:X.id===ti?"mcpServers":"default",mcpServerName:void 0,fileDirectory:X.id===Jr?m.current:void 0,inputMode:"search"}),!0):!1},[O]),$=g.useCallback(C=>{const z=c.current;if(!z||z.level!=="items"||!z.selectedProviderId)return!1;const X={...z,query:C,selectedIndex:0,inputMode:"search"};return z.selectedProviderId===ti&&z.itemMode==="mcpResources"&&z.mcpServerName?(F(z.mcpServerName,C,X,{validateServer:z.validateMcpServer}),!0):(O(z.selectedProviderId,C,X),!0)},[O,F]),J=g.useCallback(()=>{const C=c.current;if(!C||C.level!=="items")return!1;if(C.selectedProviderId===ti&&C.itemMode==="mcpResources")return O(ti,"",{...C,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(C.selectedProviderId===Jr){const z=oc(C.fileDirectory??m.current);if(z!==".")return m.current=W_e(z),O(Jr,"",{...C,query:"",selectedIndex:0,fileDirectory:m.current,inputMode:"search"}),"items"}return k({...C,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0}),M(),"categories"},[M,O,k]),B=g.useCallback(C=>{const z=c.current;if(!z)return!1;if(z.level==="categories")return ce(C);const X=e.current;if(!X)return!1;if(z.loading)return!0;const ae=z.items[C??z.selectedIndex];if(!ae)return!1;if(z.selectedProviderId&&(y.current=z.selectedProviderId),z.selectedProviderId===Jr&&ae.kind==="directory"&&ae.targetPath)return m.current=oc(ae.targetPath),O(Jr,"",{...z,query:"",selectedIndex:0,fileDirectory:m.current,inputMode:"search"}),!0;if(z.selectedProviderId===ti&&ae.kind==="mcp-server"&&ae.serverName)return w.current=ae.serverName,F(ae.serverName,"",{...z,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:ae.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const be=ae.insertText??`@${Jd(pl(ae.label))} `,fe=X.state.doc.length;if(z.from<0||z.to<z.from||z.to>fe)return console.warn("[@mention] stale insertion range",{from:z.from,to:z.to,docLength:fe}),R(),!0;if(!X.state.doc.sliceString(z.from,z.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:z.from,to:z.to}),R(),!0;b.current=!0;const G=X_e(z.selectedProviderId,ae,be),q=be.trimEnd(),le=G&&i?[i({from:z.from,to:z.from+q.length,tag:G})]:void 0;return X.dispatch({changes:{from:z.from,to:z.to,insert:be},...le?{effects:le}:{},selection:{anchor:z.from+be.length},scrollIntoView:!0}),X.focus(),R({preserveProviderSelection:!0}),!0},[R,ce,i,O,F,e]);return{state:a,close:R,closeIfOpen:L,refreshForView:j,moveSelection:V,select:ee,accept:B,enterCategory:ce,backToCategories:J,updateSearch:$}}const s3e=qn.mark({class:"cm-input-slash"}),r3e=qn.mark({class:"cm-input-at"}),i3e=qn.mark({class:"cm-input-code"});class o3e extends Al{constructor(t){super(),this.text=t}eq(t){return t.text===this.text}toDOM(){const t=document.createElement("span");return t.className="cm-input-slash-argument-hint",t.textContent=this.text,t}ignoreEvent(){return!0}}function VM(e,t,n){const s=new Wd,r=e.state.doc,i=[];for(let o=1;o<=r.lines;o++){const a=r.line(o),l=a.text,c=a.from;if(l.startsWith("/")){const p=l.indexOf(" "),y=p===-1?l.length:p;i.push({from:c,to:c+y,deco:s3e})}const d=M_e(l,t(),n());if(d){const p=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:qn.widget({widget:new o3e(`${p}${d}`),side:1})})}const h=/@[^\s]+/g;let f;for(;(f=h.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:r3e});const m=/`[^`]+`/g;for(;(f=m.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:i3e})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:l}of i)s.add(o,a,l);return s.finish()}function a3e(e=()=>[],t=()=>"en"){return lo.fromClass(class{constructor(n){ye(this,"decorations");this.decorations=VM(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=VM(n.view,e,t))}},{decorations:n=>n.decorations})}const l3e=Pt.baseTheme({".cm-input-slash":{color:"var(--agent-blue-500, #4a9eff)",fontWeight:"bold"},".cm-input-at":{color:"var(--success-color, #48bb78)"},".cm-input-code":{background:"rgba(255, 255, 255, 0.06)",borderRadius:"3px",color:"var(--muted-foreground, #a0aec0)"},".cm-input-slash-argument-hint":{color:"color-mix(in srgb, var(--muted-foreground) 70%, transparent)",pointerEvents:"none"}});function dF(e){return`url("${e.replace(/["\\\n\r\f]/g,n=>{switch(n){case'"':case"\\":return`\\${n}`;case`
`:return"\\A ";case"\r":return"\\D ";case"\f":return"\\C ";default:return""}})}")`}function sf(e,t){return{[e]:dF(t)}}const c3e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3crect%20x='1.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3crect%20x='1.2'%20y='2.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3cg%20transform='matrix(0.86602545%200.50000006%20-0.50000006%200.86602545%202.21032266%20-5.24903863)'%3e%3crect%20x='10.9'%20y='1.5'%20width='4.3'%20height='4.3'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/g%3e%3crect%20x='7.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/svg%3e",u3e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2020%2020'%3e%3cpath%20d='M18%2018V5H9.5L7.5%202H2L2%2018H5M18%2018H5M18%2018V8.5H5V18'%20stroke='currentColor'%20stroke-linecap='square'/%3e%3c/svg%3e",d3e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M5.4%201.2v3.2M10.6%201.2v3.2M3.8%204.4h8.4v2.2a4.2%204.2%200%200%201-4.2%204.2%204.2%204.2%200%200%201-4.2-4.2V4.4ZM8%2011v3.8'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",h3e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M9.333333480718995,0.4848014130697632L8.909069580718995,0.9090693330697632L8.666668880718994,1.1514702030697632L7.818136680718994,2.000002323069763L6.000002380718994,3.8181367730697633L4.909069780718994,4.909069373069763L4.484801580718994,5.333333373069763L5.333333480718994,6.181865073069763L5.757597480718994,5.757597373069763L6.002225380718994,5.5129693730697635Q6.399448880718994,5.902126173069763,6.835733380718994,6.315723273069763L0.6516202707189941,12.497309373069763L3.5001483807189944,15.345837373069763L9.749393980718994,9.099145273069762L10.000080580718993,9.349833873069763L10.848612280718994,8.501302173069764L10.424344580718994,8.077038173069763Q9.527247880718994,7.179941973069763,8.407596580718995,6.143646073069763Q7.564285280718994,5.3631170730697635,6.850798580718994,4.664396173069763L8.666666480718995,2.848528273069763L13.151472080718994,7.333333873069763L10.242402580718995,10.242403373069763L9.818134780718994,10.666667373069764L10.666666480718995,11.515199373069763L11.090930480718994,11.090931273069764L13.999998080718994,8.181864173069762L14.848531080718994,7.333333373069763L15.090931080718994,7.090931273069764L15.515198080718994,6.666666873069763L14.666666080718993,5.818134673069763L14.242402080718994,6.242402873069763L14.000000080718994,6.484805973069763L9.515194380718993,2.0000002430697634L9.757597480718994,1.7575974430697632L10.181865180718994,1.3333333730697632L9.333333480718995,0.4848014130697632ZM8.895271280718994,8.256209773069763Q8.340813180718994,7.719207673069763,7.712720380718994,7.1358045730697635L2.348849830718994,12.497482373069763L3.5003215807189942,13.648954373069763L8.895271280718994,8.256209773069763Z'%20fill-rule='evenodd'%20fill='currentColor'/%3e%3c/svg%3e",f3e={extension:c3e,file:u3e,mcp:d3e,skill:h3e};function WM(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function a8(e,t){if(e)return WM(t,e)??WM(f3e,e)}const m3e=1e3,p3e=10,GM="web-shell-tooltip-styles",g3e=`
[data-web-shell-tooltip-portal] {
  pointer-events: none;
}

[data-web-shell-tooltip-portal] .cm-tooltip {
  z-index: var(--web-shell-tooltip-z-index, 1000);
  pointer-events: auto;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete {
  --web-shell-completion-label-width: 20ch;
  --web-shell-completion-column-gap: 2ch;
  --web-shell-completion-detail-start: calc(
    var(--web-shell-completion-label-width) +
      var(--web-shell-completion-column-gap)
  );
  min-width: 500px !important;
  max-width: 700px !important;
  max-height: 400px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  background: var(--background, #0d0d0d) !important;
  border: 1px solid var(--border, #2a2a2a) !important;
  border-radius: 6px !important;
  overflow: visible;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul {
  max-height: 380px !important;
  overflow: auto;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul::-webkit-scrollbar-track {
  background: transparent;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete > ul::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li {
  display: flex !important;
  align-items: center;
  min-width: 0;
  padding: 4px 8px !important;
  color: var(--foreground, #e4e4e4) !important;
  overflow: hidden;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete .cm-at-ref-completion-icon {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-right: 10px;
  background: currentColor;
  mask: var(--composer-tag-icon-url) center / contain no-repeat;
  -webkit-mask: var(--composer-tag-icon-url) center / contain no-repeat;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li:hover {
  background: var(--secondary, #1e1e1e) !important;
  color: var(--foreground, #e4e4e4) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li[aria-selected] {
  background: var(--secondary, #1e1e1e) !important;
  color: var(--foreground, #e4e4e4) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li:is(:hover, [aria-selected]) .cm-completionLabel {
  color: var(--agent-blue-500, #4a9eff);
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section {
  display: block !important;
  height: auto;
  margin: 6px 10px 4px;
  padding: 2px 0 4px !important;
  line-height: 1.2;
  color: var(--muted-foreground, #a1a1aa) !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section:first-of-type {
  margin-top: 6px;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete .cm-completionLabel {
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
  width: var(--web-shell-completion-label-width);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-extension .cm-completionLabel,
[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-mcp .cm-completionLabel,
[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-at-ref-completion-file .cm-completionLabel {
  width: calc(var(--web-shell-completion-label-width) - 20px);
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete .cm-completionDetail {
  flex: 1 1 auto;
  min-width: 0;
  font-style: normal;
  color: var(--muted-foreground);
  font-size: 13px;
  margin-left: var(--web-shell-completion-column-gap);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-file-completion .cm-completionLabel {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: none;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-command-info-completion {
  display: grid !important;
  grid-template-columns: var(--web-shell-completion-label-width) minmax(0, 1fr);
  column-gap: var(--web-shell-completion-column-gap);
  align-items: baseline !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-command-info-completion .cm-completionLabel {
  min-width: 0;
  max-width: none;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete ul li.cm-command-info-completion .cm-completionDetail {
  margin-left: 0;
  white-space: nowrap;
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo {
  z-index: calc(var(--web-shell-tooltip-z-index, 1000) + 1);
  width: min(320px, calc(100vw - 32px));
  max-width: min(320px, calc(100vw - 32px)) !important;
  max-height: min(280px, calc(100vh - 32px));
  padding: 8px 10px;
  overflow: auto;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  background: var(--muted, #161616);
  color: var(--foreground, #e4e4e4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

[data-web-shell-tooltip-portal] .cm-completionInfo-hover {
  pointer-events: auto;
  z-index: calc(var(--web-shell-tooltip-z-index, 1000) + 1);
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo::-webkit-scrollbar-track {
  background: transparent;
}

[data-web-shell-tooltip-portal] .cm-tooltip.cm-completionInfo::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-right {
  margin-left: var(--web-shell-completion-column-gap);
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-right-narrow {
  left: var(--web-shell-completion-detail-start);
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-left {
  margin-right: var(--web-shell-completion-column-gap);
}

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-left-narrow {
  right: var(--web-shell-completion-detail-start);
}
`;function y3e(){if(document.getElementById(GM))return;const e=document.createElement("style");e.id=GM,e.textContent=g3e,document.head.appendChild(e)}function b3e(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function v3e(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function l8(e){return v3e(e)}function w3e(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function x3e(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function _3e(e,t,n){if(!t.detail||!l8(t))return;const s=e.closest("[data-web-shell-tooltip-portal]");if(!s)return;let r=s.querySelector(".cm-completionInfo-hover");r||(r=document.createElement("div"),r.className="cm-tooltip cm-completionInfo cm-completionInfo-hover cm-completionInfo-right-narrow",s.appendChild(r)),r.textContent=`${w3e(t)}

${t.detail}`;const i=r.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete r.dataset.hideTimerId);const o=r.getBoundingClientRect(),a=18,l=12,c=12,d=window.innerWidth,h=window.innerHeight,f=n.clientX+a,m=f+o.width+c>d?Math.max(c,n.clientX-o.width-a):f,p=Math.min(Math.max(c,n.clientY+l),Math.max(c,h-o.height-c));r.style.position="fixed",r.style.left=`${m}px`,r.style.top=`${p}px`,r.style.right="auto",r.style.bottom="auto"}function k3e(e){const t=e.querySelector(".cm-completionInfo-hover");if(!t)return;const n=window.setTimeout(()=>{t.remove()},180);t.dataset.hideTimerId=String(n),t.addEventListener("mouseenter",()=>{window.clearTimeout(n),delete t.dataset.hideTimerId},{once:!0}),t.addEventListener("mouseleave",()=>{t.remove()},{once:!0})}function S3e(e){if(!e.detail||!l8(e))return null;const t=document.createElement("span");return t.className="cm-command-hover-info-anchor",t.setAttribute("aria-hidden","true"),queueMicrotask(()=>{const n=t.closest("li");!n||n.hasAttribute("data-web-shell-hover-info")||(n.setAttribute("data-web-shell-hover-info","true"),n.addEventListener("mouseenter",s=>{_3e(t,e,s)}),n.addEventListener("mouseleave",()=>{const s=t.closest("[data-web-shell-tooltip-portal]");s&&k3e(s)}))}),t}function T3e(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function C3e(e){return[...e].length>m3e||e.split(`
`).length>p3e}function A3e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E3e(e,t,n){const r=`[Pasted Content ${[...n].length} chars]`,i=t===1?r:`${r} #${t}`;return e.set(i,n),{placeholderText:i,nextPasteId:t+1}}function M3e(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function N3e(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((r,i)=>i.length-r.length),s=new RegExp(n.map(A3e).join("|"),"g");return t.replace(s,r=>e.get(r)??r)}function Ay(e){var t,n,s;return((t=e.serialized)==null?void 0:t.trim())||((n=e.value)==null?void 0:n.trim())||((s=e.label)==null?void 0:s.trim())||e.id}function I3e(e){return e.map(Ay).join(`
`)}function c8(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function u8(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function hF(e){return u8(e)||c8(e)||e.id}function m4(e,t){const n=I3e(t);return n?e?`${n}

${e}`:n:e}function fF(e){const t={...e};return delete t.iconUrl,t}const c0=_s.define({map:e=>e}),d8=_s.define(),Oc=_s.define();class j3e extends Al{constructor(t){super(),this.tag=t}eq(t){return this.tag.id===t.tag.id&&this.tag.label===t.tag.label&&this.tag.value===t.tag.value&&this.tag.kind===t.tag.kind&&this.tag.serialized===t.tag.serialized&&this.tag.removable===t.tag.removable&&this.tag.iconUrl===t.tag.iconUrl}toDOM(t){const n=document.createElement("span");n.style.cssText="display:inline-flex;align-items:center;max-width:min(44ch,100%);min-height:20px;margin:0 0.25ch;border:1px solid var(--border);border-radius:4px;background:var(--secondary);color:var(--foreground);font-family:var(--font-mono,monospace);font-size:12px;line-height:1.2;vertical-align:baseline;";const s=c8(this.tag),r=u8(this.tag),i=this.tag.kind?"":s,o=this.tag.iconUrl??a8(this.tag.kind);if(o){const a=document.createElement("span");a.style.cssText="display:block;width:12px;height:12px;flex:0 0 auto;margin-left:7px;background:currentColor;mask:var(--composer-tag-icon-url) center / contain no-repeat;-webkit-mask:var(--composer-tag-icon-url) center / contain no-repeat;",a.style.setProperty("--composer-tag-icon-url",dF(o)),n.appendChild(a)}if(i){const a=document.createElement("span");a.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",a.textContent=i,n.appendChild(a)}if(r){const a=document.createElement("span");a.style.cssText="max-width:32ch;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 0.5ch;color:var(--foreground, #e4e4e4);",a.textContent=r,n.appendChild(a)}else if(!i){const a=document.createElement("span");a.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",a.textContent=this.tag.id,n.appendChild(a)}if(this.tag.removable!==!1){const a=document.createElement("button");a.type="button",a.setAttribute("aria-label",`Remove ${hF(this.tag)}`),a.style.cssText="flex:0 0 auto;width:22px;height:22px;padding:0;border:0;background:transparent;color:var(--muted-foreground);font:inherit;line-height:22px;cursor:pointer;",a.textContent="×",a.addEventListener("mousedown",l=>l.preventDefault()),a.addEventListener("click",l=>{l.stopPropagation();const c=[];t.state.field(bd).between(0,t.state.doc.length,(d,h,f)=>{const m=f.spec.tag;(m==null?void 0:m.id)===this.tag.id&&m.removable!==!1&&c.push({from:d,to:h,insert:""})}),c.length!==0&&(t.dispatch({changes:c,effects:d8.of({predicate:d=>d.id===this.tag.id}),scrollIntoView:!0}),t.focus())}),a.addEventListener("mouseenter",()=>{a.style.color="var(--error-color)"}),a.addEventListener("mouseleave",()=>{a.style.color="var(--muted-foreground)"}),n.appendChild(a)}return n}ignoreEvent(){return!1}}function R3e(e){const t={widget:new j3e(e.tag),inclusive:!1,tag:e.tag};return qn.replace(t).range(e.from,e.to)}const bd=Cl.define({create(){return qn.none},update(e,t){let n=e.map(t.changes);for(const s of t.effects)s.is(c0)?n=n.update({add:[R3e(s.value)]}):s.is(d8)?n=n.update({filter:(r,i,o)=>{const a=o.spec.tag;return a&&s.value.predicate?!s.value.predicate(a):!0}}):s.is(Oc)&&(n=qn.none);return n},provide:e=>[Pt.decorations.from(e),Pt.atomicRanges.of(t=>t.state.field(e))]});function L3e(e){const t=[];return e.state.field(bd).between(0,e.state.doc.length,(n,s,r)=>{const i=r.spec.tag;i&&t.push(fF(i))}),t}const KM=new dh,YM=new dh,QM=new dh;function hd(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function D3e(e,t){const n=hd(e,t);if(!n||e.length===0)return null;const s=n.slice(e.length);return s.length>0?s:null}class O3e extends Al{constructor(t){super(),this.text=t}eq(t){return this.text===t.text}toDOM(){const t=document.createElement("span");return t.className="cm-followup-ghost",t.textContent=this.text,t}ignoreEvent(){return!0}}function XM(e){return lo.fromClass(class{constructor(t){ye(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return qn.none;const n=t.state.selection.main,s=t.state.doc.toString(),r=D3e(s,e);return!r||!n.empty||n.head!==s.length?qn.none:qn.set([qn.widget({widget:new O3e(r),side:1}).range(s.length)])}},{decorations:t=>t.decorations})}function JM(e,t){const n=e.state.doc;if(n.lines<=1)return"history";const s=e.state.selection.main;if(!s.empty)return"editor";const r=s.head,i=n.lineAt(r);return t==="up"?i.number>1?"editor":r>i.from?(e.dispatch({selection:{anchor:i.from},scrollIntoView:!0}),"handled"):"history":i.number<n.lines?"editor":r<i.to?(e.dispatch({selection:{anchor:i.to},scrollIntoView:!0}),"handled"):"history"}function B3e(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:s,disabled:r=!1,placeholderText:i="Type a message...",commands:o,skills:a=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:d,currentMode:h="default",onFocusFooter:f,dialogOpen:m=!1,followupState:p,onAcceptFollowup:y,onDismissFollowup:w,sessionName:b,composerInput:v,composerInputVersion:x,atProviders:_,composerTagIcons:E,editorTheme:k}=e,M=xL(),{language:R,t:L}=Xe(),T=g.useRef(null),N=g.useRef(null),I=g.useRef(t);I.current=t;const O=g.useRef(n);O.current=n;const U=g.useRef(s);U.current=s;const F=g.useRef(r);F.current=r;const j=g.useRef(o);j.current=o;const V=g.useRef(a);V.current=a;const ee=g.useRef(l);ee.current=l;const ce=g.useRef(L);ce.current=L;const $=g.useRef(c);$.current=c;const J=g.useRef(d);J.current=d;const B=g.useRef(p);B.current=p;const C=g.useRef(y);C.current=y;const z=g.useRef(w);z.current=w;const X=g.useRef(f);X.current=f;const ae=g.useRef(R);ae.current=R;const be=g.useRef(M==null?void 0:M.actions);be.current=M==null?void 0:M.actions;const fe=g.useRef(E);fe.current=E;const ie=g.useCallback(Q=>{const de=a8(Q.kind,fe.current);return de?{...Q,iconUrl:de}:Q},[]),[G,q]=g.useState(!1),le=g.useRef(G);le.current=G;const Se=n3e({viewRef:N,disabledRef:F,shellModeRef:le,workspaceActionsRef:be,providers:_,createInlineTagEffect:Q=>c0.of({...Q,tag:ie(Q.tag)})}),$e=Se.close,Ae=Se.refreshForView;g.useEffect(()=>{const Q=N.current;if(!Q)return;const de=[Oc.of()];Q.state.field(bd).between(0,Q.state.doc.length,(Oe,et,bn)=>{const $t=bn.spec.tag;$t&&de.push(c0.of({from:Oe,to:et,tag:ie(fF($t))}))}),de.length!==1&&Q.dispatch({effects:de})},[E,ie]);const we=g.useCallback(()=>{var Q,de,Oe;(Q=B.current)!=null&&Q.isVisible&&((de=z.current)==null||de.call(z)),q(et=>!et),(Oe=N.current)==null||Oe.focus()},[]),[ct,ht]=g.useState(!1),[ut,ft]=g.useState(""),[tt,qt]=g.useState([]),[Ye,ge]=g.useState(0),st=g.useRef(null),ne=g.useRef(null),ue=g.useRef(""),[Re,rt]=g.useState([]),vt=g.useRef([]),tn=g.useRef(new Map),jn=g.useRef(1),[ln,Pn]=g.useState([]),Qt=g.useRef([]);Qt.current=ln;const ve=g.useRef(v);ve.current=v;const Be=g.useRef(()=>!0),He=g.useRef(null),[Ht,Yn]=g.useState(null),Wt=g.useRef(null),ss=g.useRef(!1),Mt=g.useCallback(Q=>{Wt.current=Q,Yn(Q)},[]),Cn=g.useCallback(()=>{const Q=He.current,de=N.current;if(!Q||!de)return;const Oe=de.state.doc,et=Q.from+Q.text.length;Oe.length===et&&Oe.sliceString(Q.from,et)===Q.text&&de.dispatch({changes:{from:Q.from,to:et,insert:""}}),He.current=null},[]),rn=g.useCallback(()=>{Cn(),$e()},[Cn,$e]),Ln=Se.closeIfOpen,Xn=g.useCallback(()=>{const Q=Ln();return Q?(Q==="closed"&&Cn(),!0):!1},[Cn,Ln]),Nn=g.useCallback((Q,de)=>{var vn;if(!Q||F.current||le.current){Mt(null);return}if(ss.current){Mt(null);return}const Oe=Q.state.selection.main;if(!Oe.empty){Mt(null);return}const et=R_e(Q.state.doc.toString(),Oe.head,j.current,V.current,ae.current,is=>ce.current(is),ee.current??Lp);if(!et){Mt(null);return}rn();const bn=de??((vn=Wt.current)==null?void 0:vn.selectedIndex)??0,$t=Math.max(0,Math.min(bn,et.items.length-1));Mt({...et,selectedIndex:$t})},[rn,Mt]),_n=g.useCallback(()=>{Mt(null)},[Mt]),Os=g.useCallback(Q=>{const de=Wt.current;return!de||Q<0||Q>=de.items.length?!1:(de.selectedIndex===Q||Mt({...de,selectedIndex:Q}),!0)},[Mt]),ks=g.useCallback(Q=>{const de=Wt.current;if(!de)return!1;const Oe=b3e(de.selectedIndex,de.items.length,Q);return Oe===null?!1:(Mt({...de,selectedIndex:Oe}),!0)},[Mt]),Kt=g.useCallback(Q=>{const de=N.current,Oe=Wt.current;if(!de||!Oe)return!1;const et=Oe.items[Q??Oe.selectedIndex];return et?(de.dispatch({changes:{from:Oe.from,to:Oe.to,insert:et.apply},selection:{anchor:Oe.from+et.apply.length},scrollIntoView:!0}),de.focus(),!0):!1},[]),[Vn,Te]=g.useState(!1);g.useEffect(()=>{const Q=N.current,de=(Q==null?void 0:Q.state.doc.toString())??"",Oe=hd(de,p!=null&&p.isVisible?p.suggestion:null);Te(de.trim().length>0||!!Oe||ln.length>0||Re.length>0)},[ln,Re,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]);const mt=qM(),Xt=qM("qwen-web-shell-command-history"),{push:mn,navigateUp:oe,navigateDown:_e,isNavigating:se,reset:pe,getReverseMatches:Le,getLastEntry:wt,resetSearch:dt}=mt,Ft=g.useRef({push:mn,navigateUp:oe,navigateDown:_e,isNavigating:se,reset:pe,getReverseMatches:Le,getLastEntry:wt,resetSearch:dt});Ft.current={push:mn,navigateUp:oe,navigateDown:_e,isNavigating:se,reset:pe,getReverseMatches:Le,getLastEntry:wt,resetSearch:dt};const on=g.useRef(Xt);on.current=Xt,vt.current=Re;const Ks=g.useCallback(Q=>{const de=le.current,et=(de?on.current:Ft.current).getReverseMatches(Q);return de?et:et.filter(bn=>!bn.trimStart().startsWith("/"))},[]),pn=g.useCallback(()=>{if(F.current)return;const Q=N.current;if(!Q)return;_n(),rn();const de=Q.state.doc.toString();ue.current=de,ht(!0),ft("");const Oe=le.current?on.current:Ft.current;qt(Ks("")),ge(0),Oe.resetSearch(),setTimeout(()=>{var et;return(et=st.current)==null?void 0:et.focus()},0)},[rn,_n,Ks]),An=g.useRef(pn);An.current=pn;const un=g.useCallback(()=>{if(F.current)return;const Q=N.current;if(!Q)return;if(fo(Q.state)==="active"){ou(!1)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const de=le.current?on.current:Ft.current,Oe=Q.state.doc.toString(),et=de.navigateUp(Oe);et!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:et},selection:{anchor:et.length}}),Q.focus()},[]),rs=g.useCallback(()=>{if(F.current)return;const Q=N.current;if(!Q)return;if(fo(Q.state)==="active"){ou(!0)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const Oe=(le.current?on.current:Ft.current).navigateDown();Oe!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:Oe},selection:{anchor:Oe.length}}),Q.focus()},[]);g.useEffect(()=>{var Ss,$n;if(!T.current)return;y3e();const Q=document.createElement("div");Q.setAttribute("data-web-shell-tooltip-portal",""),Q.style.position="fixed",Q.style.inset="0",Q.style.zIndex="var(--web-shell-tooltip-z-index)",Q.style.pointerEvents="none";const de=/\b\S*theme(?:Dark|Light)\S*/gi,Oe=()=>{var lt,pt;let Me=T.current,_t=null;if(T.current){const At=getComputedStyle(T.current);for(let cn=0;cn<At.length;cn+=1){const Y=At[cn];Y.startsWith("--")&&Q.style.setProperty(Y,At.getPropertyValue(Y))}At.getPropertyValue("--web-shell-tooltip-z-index").trim()||Q.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;Me;){const At=(pt=(lt=Me.className)==null?void 0:lt.match)==null?void 0:pt.call(lt,de);if(At){_t=At[0];break}Me=Me.parentElement}_t&&(Q.className=_t)};Oe(),document.body.appendChild(Q);const et=new MutationObserver(Oe);let bn=T.current;for(;bn&&(et.observe(bn,{attributes:!0,attributeFilter:["class","style"]}),!(($n=(Ss=bn.className)==null?void 0:Ss.match)!=null&&$n.call(Ss,de)));)bn=bn.parentElement;const $t=(Me,_t,lt)=>{const pt=Me.state.doc.toString(),At=B.current,cn=_t===void 0&&(At!=null&&At.isVisible)?hd(pt,At.suggestion):null,Y=(_t??cn??pt).trim(),xe=lt??Qt.current;if(!Y&&xe.length===0)return!0;const ke=N3e(tn.current,Y),Ot=m4(ke,xe),gn=vt.current,wn=le.current;let Zt=!1;const Jn=()=>{var zr,Po;Zt||(Zt=!0,Mt(null),cn&&((zr=C.current)==null||zr.call(C,"enter",{skipOnAccept:!0})),(Po=z.current)==null||Po.call(z),tn.current.clear(),jn.current=1,wn?(on.current.push(ke),on.current.reset()):(Ft.current.push(ke),Ft.current.reset()),ss.current=!1,Pn([]),rt([]),Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:""},effects:Oc.of()}))};return I.current(wn?`!${Ot}`:Ot,gn.length>0?[...gn]:void 0,Jn)===!1||Jn(),!0};Be.current=$t;const vn=Me=>(Me.dispatch(Me.state.replaceSelection(`
`)),!0),is=(Me,_t)=>{var cn;const lt=B.current,pt=lt==null?void 0:lt.suggestion,At=hd(Me.state.doc.toString(),pt);return!(lt!=null&&lt.isVisible)||!At?!1:(Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:At},selection:{anchor:At.length},scrollIntoView:!0}),Me.focus(),(cn=C.current)==null||cn.call(C,_t,{skipOnAccept:!0}),!0)},ds=Ap.of([{key:"Backspace",run:Me=>{var At;const _t=Me.state.selection.main;if(!_t.empty||_t.from!==0)return!1;let lt=!1;if(Me.state.field(bd).between(0,1,cn=>{cn===0&&(lt=!0)}),lt)return!1;let pt=-1;for(let cn=Qt.current.length-1;cn>=0;cn-=1)if(((At=Qt.current[cn])==null?void 0:At.removable)!==!1){pt=cn;break}return pt<0?!1:(Pn(cn=>cn.filter((Y,xe)=>xe!==pt)),!0)}},{key:"Delete",run:Me=>{const _t=Me.state.selection.main;if(!_t.empty||_t.from!==0)return!1;let lt=!1;if(Me.state.field(bd).between(0,1,At=>{At===0&&(lt=!0)}),lt)return!1;const pt=Qt.current.findIndex(At=>At.removable!==!1);return pt<0?!1:(Pn(At=>At.filter((cn,Y)=>Y!==pt)),!0)}},{key:"Enter",run:Me=>{var pt;if(Se.accept())return!0;if(Wt.current)return Kt();if(fo(Me.state)==="active")return!1;const _t=B.current,lt=hd(Me.state.doc.toString(),_t==null?void 0:_t.suggestion);return _t!=null&&_t.isVisible&&lt?((pt=C.current)==null||pt.call(C,"enter",{skipOnAccept:!0}),$t(Me,lt)):$t(Me)}},{key:"Shift-Enter",run:vn},{key:"Ctrl-j",run:vn},{key:"Mod-Enter",run:vn},{key:"Alt-Enter",run:vn},{key:"Escape",run:()=>Xn()?!0:Wt.current?(_n(),!0):le.current?(q(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:Me=>{var Y;const _t=le.current?on.current:Ft.current;if(ss.current)Ty(Me),_n(),rn();else{if(Se.moveSelection("up")||ks("up"))return!0;if(fo(Me.state)==="active")return ou(!1)(Me)}const pt=JM(Me,"up");if(pt==="handled")return!0;if(pt==="editor")return!1;if(le.current){const xe=Me.state.doc.toString(),ke=_t.navigateUp(xe);return ke===null||(ss.current=!0,Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:ke},selection:{anchor:ke.length}})),!0}if($.current.length>0&&(Y=J.current)!=null&&Y.call(J))return!0;const At=Me.state.doc.toString(),cn=_t.navigateUp(At);return cn===null?!1:(ss.current=!0,Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:cn},selection:{anchor:cn.length}}),!0)}},{key:"ArrowDown",run:Me=>{var cn;const _t=le.current?on.current:Ft.current;if(ss.current)Ty(Me),_n(),rn();else{if(Se.moveSelection("down")||ks("down"))return!0;if(fo(Me.state)==="active")return ou(!0)(Me)}const pt=JM(Me,"down");if(pt==="handled")return!0;if(pt==="editor")return!1;if(le.current){const Y=_t.navigateDown();return Y===null||(ss.current=_t.isNavigating(),Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:Y},selection:{anchor:Y.length}})),!0}const At=_t.navigateDown();return At===null?((cn=X.current)==null?void 0:cn.call(X))??!1:(ss.current=_t.isNavigating(),Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:At},selection:{anchor:At.length}}),!0)}},{key:"Ctrl-r",run:()=>(An.current(),!0)},{key:"Tab",run:Me=>{if(Se.accept()||is(Me,"tab"))return!0;if(Wt.current)return Kt();if(fo(Me.state)==="active")return Vz(Me);const _t=Me.state.doc.toString(),lt=E_e(_t,j.current,ae.current);if(lt)return Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:lt},selection:{anchor:lt.length}}),!0;const pt=A_e(_t,j.current);return pt&&Me.dispatch({changes:{from:0,to:Me.state.doc.length,insert:pt},selection:{anchor:pt.length}}),!0}},{key:"ArrowRight",run:Me=>!!(fo(Me.state)!=="active"&&is(Me,"right"))},{key:"Shift-Tab",run:()=>{var Me;return(Me=O.current)==null||Me.call(O),!0}}]),hs=Pt.updateListener.of(Me=>{if(Me.docChanged&&tn.current.size>0){const lt=M3e(tn.current,Me.state.doc.toString());lt!==null&&(jn.current=lt)}Me.transactions.some(lt=>lt.isUserEvent("input")||lt.isUserEvent("delete"))&&(ss.current=!1),(Me.docChanged||Me.selectionSet)&&(Nn(Me.view),ss.current?rn():Ae(Me.view)&&_n())});let ze=!1;const Wn=Pt.updateListener.of(Me=>{const _t=He.current,lt=fo(Me.state)==="active";if(_t){const pt=Me.state.doc;if(!(pt.length===_t.from+_t.text.length&&pt.sliceString(_t.from)===_t.text))He.current=null;else if(ze&&!lt){He.current=null;const{view:cn}=Me,{from:Y}=_t;window.setTimeout(()=>{if(N.current!==cn)return;const xe=cn.state.doc;xe.length===Y+_t.text.length&&xe.sliceString(Y)===_t.text&&cn.dispatch({changes:{from:Y,to:Y+_t.text.length,insert:""}})},0)}}ze=lt,lt||x3e(Q)}),In=ms.create({doc:"",extensions:[uh.highest(ds),J4e,uz(),Ap.of([...zz,...mz]),Y4e({override:[],activateOnTyping:!0,icons:!1,optionClass:Me=>{const _t=[];return Me.type==="file"&&_t.push("cm-file-completion"),l8(Me)&&_t.push("cm-command-info-completion"),_t.join(" ")},addToOptions:[{render:S3e,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(Me,_t,lt,pt,At)=>{const cn=pt.bottom-pt.top,Y=At.bottom-_t.bottom,xe=Y>=cn||Y>_t.top,ke=xe?"top":"bottom",Ot=xe?lt.bottom-_t.top:_t.bottom-lt.top;return{style:`${ke}: ${Ot}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:Me=>typeof Me.apply=="string"&&Me.apply.endsWith(" ")}),x2e({parent:Q}),YM.of(dM("")),QM.of(XM(null)),Pt.lineWrapping,KM.of(Pt.editable.of(!0)),a3e(()=>j.current,()=>ae.current),l3e,bd,hs,Wn,Pt.updateListener.of(Me=>{if(Me.docChanged){const _t=Me.state.doc.toString(),lt=B.current,pt=hd(_t,lt!=null&&lt.isVisible?lt.suggestion:null);Te(_t.trim().length>0||!!pt||Qt.current.length>0||vt.current.length>0)}}),Pt.inputHandler.of((Me,_t,lt,pt)=>{var At;return pt==="!"&&Me.state.doc.toString()===""&&fo(Me.state)!=="active"?(we(),!0):pt==="?"&&Me.state.doc.toString()===""&&fo(Me.state)!=="active"?((At=U.current)==null||At.call(U),!0):!1}),Pt.domEventHandlers({blur(Me){return _n(),Me.relatedTarget instanceof Element&&Me.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const _t=N.current;_t!=null&&_t.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||rn()},0),!1},paste(Me){var xe,ke,Ot,gn;const _t=(xe=Me.clipboardData)==null?void 0:xe.items;if(!_t)return!1;let lt=!1;for(const wn of _t)if(wn.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(wn.type)){lt=!0;const Zt=wn.getAsFile();if(!Zt)continue;const Jn=wn.type,Er=new FileReader;Er.onload=()=>{const zr=Er.result.split(",")[1];rt(Po=>[...Po,{data:zr,media_type:Jn}])},Er.readAsDataURL(Zt)}if(lt)return Me.preventDefault(),!0;const pt=T3e(((ke=Me.clipboardData)==null?void 0:ke.getData("text/plain"))??"");if(!pt||!C3e(pt))return!1;Me.preventDefault(),Xs.state.doc.toString()===""&&((Ot=B.current)!=null&&Ot.isVisible)&&((gn=z.current)==null||gn.call(z));const{placeholderText:At,nextPasteId:cn}=E3e(tn.current,jn.current,pt);jn.current=cn;const Y=Xs.state.selection.main;return Xs.dispatch({changes:{from:Y.from,to:Y.to,insert:At},selection:{anchor:Y.from+At.length},scrollIntoView:!0}),!0}}),Pt.theme(k)]}),Xs=new Pt({state:In,parent:T.current});N.current=Xs,Xs.focus();const vs=Xs.state.doc.toString().trim();return Te(vs.length>0||Qt.current.length>0||vt.current.length>0),()=>{Xs.destroy(),N.current=null,et.disconnect(),Q.remove()}},[]),g.useEffect(()=>{const Q=N.current;Q&&(Q.dispatch({effects:KM.reconfigure(Pt.editable.of(!r))}),r||Q.focus())},[r]),g.useEffect(()=>{const Q=N.current;if(!Q)return;const de=!r&&(p!=null&&p.isVisible)&&p.suggestion?p.suggestion:null,Oe=de??(G?L("editor.shellPlaceholder"):i);Q.dispatch({effects:[YM.reconfigure(dM(Oe)),QM.reconfigure(XM(de))]})},[r,i,G,L,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]),g.useEffect(()=>{const Q=N.current;!Q||fo(Q.state)!=="active"||(Ty(Q),window.setTimeout(()=>{N.current===Q&&Sy(Q)},0))},[R]);const Ys=[o.map(Q=>{var de;return[Q.name,Q.description??"",Q.source??"",Q.displayCategory??"",Q.argumentHint??"",((de=Q.subcommands)==null?void 0:de.join(","))??""].join("\0")}).join(""),a.map(Q=>[Q.name,Q.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");g.useEffect(()=>{Wt.current&&Nn(N.current)},[Ys,R,Nn]),g.useEffect(()=>{const Q=N.current;Q&&(m?(_n(),rn(),Q.contentDOM.blur()):Q.focus())},[rn,m,_n]),g.useEffect(()=>{const Q=de=>{var hs,ze,Wn;if(F.current||ct||m||de.defaultPrevented)return;const Oe=de.target,et=(hs=T.current)==null?void 0:hs.contains(Oe),bn=document.activeElement===document.body;if(!et&&!bn)return;const $t=N.current,vn=B.current,is=hd(($t==null?void 0:$t.state.doc.toString())??"",vn==null?void 0:vn.suggestion);if($t&&!$t.hasFocus&&(vn!=null&&vn.isVisible)&&is&&!bp(de.target)){if(de.key==="Tab"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&fo($t.state)!=="active"){de.preventDefault(),$t.dispatch({changes:{from:0,to:$t.state.doc.length,insert:is},selection:{anchor:is.length},scrollIntoView:!0}),$t.focus(),(ze=C.current)==null||ze.call(C,"tab",{skipOnAccept:!0});return}if(de.key==="ArrowRight"&&!de.shiftKey&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&fo($t.state)!=="active"){de.preventDefault(),$t.dispatch({changes:{from:0,to:$t.state.doc.length,insert:is},selection:{anchor:is.length},scrollIntoView:!0}),$t.focus(),(Wn=C.current)==null||Wn.call(C,"right",{skipOnAccept:!0});return}}if(de.metaKey||de.ctrlKey||de.altKey||de.key.length!==1||bp(de.target)||!$t||$t.hasFocus)return;if(de.preventDefault(),de.key==="!"&&$t.state.doc.toString()===""){we();return}const ds=$t.state.selection.main;$t.dispatch({changes:{from:ds.from,to:ds.to,insert:de.key},selection:{anchor:ds.from+de.key.length},scrollIntoView:!0}),$t.focus(),de.key==="/"?window.setTimeout(()=>{Nn(N.current)},0):de.key==="@"&&window.setTimeout(()=>{const In=N.current;In&&In.hasFocus&&(_n(),Ae(In))},0)};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[Ae,_n,ct,m,Nn,we]);const Bs=g.useCallback(()=>{var Q;(Q=N.current)==null||Q.focus()},[]),Dt=g.useCallback((Q,de)=>{const Oe=N.current;if(!Oe||!Q){Oe==null||Oe.focus();return}if((de==null?void 0:de.mode)==="replace"){Oe.dispatch({changes:{from:0,to:Oe.state.doc.length,insert:Q},effects:Oc.of(),selection:{anchor:Q.length},scrollIntoView:!0}),Oe.focus();return}const et=Oe.state.selection.main;let bn=Q,$t=!1,vn=null;const is=Q==="@";let ds=Q==="/";if(Q==="/")Oe.state.doc.lineAt(et.head).text.startsWith("/")?$t=!0:Oe.state.doc.length>0&&($t=!0,ds=!1);else if(Q==="@"){const hs=et.from>0?Oe.state.doc.sliceString(et.from-1,et.from):"";Oe.state.doc.sliceString(et.from,et.from+1)==="@"?($t=!0,vn=et.from+1):hs==="@"?$t=!0:hs&&!/\s/.test(hs)&&(bn=" @")}$t?vn!==null&&Oe.dispatch({selection:{anchor:vn},scrollIntoView:!0}):(Oe.dispatch({changes:{from:et.from,to:et.to,insert:bn},selection:{anchor:et.from+bn.length},scrollIntoView:!0}),is&&(He.current={text:bn,from:et.from})),Oe.focus(),ds?window.setTimeout(()=>{Nn(N.current)},0):is&&window.setTimeout(()=>{const hs=N.current;hs&&hs.hasFocus&&(_n(),Ae(hs))},0)},[_n,Ae,Nn]),Ps=g.useCallback(()=>{var Q;return((Q=N.current)==null?void 0:Q.state.doc.toString())??""},[]),kn=g.useCallback(Q=>{const de=N.current;de&&(de.dispatch({changes:{from:0,to:de.state.doc.length,insert:Q},effects:Oc.of(),selection:{anchor:Q.length},scrollIntoView:!0}),de.focus())},[]),Si=g.useCallback(Q=>{const de=N.current;if(!de)return;const Oe=[];de.state.field(bd).between(0,de.state.doc.length,(et,bn,$t)=>{const vn=$t.spec.tag;vn&&(!Q||Q(vn))&&Oe.push({from:et,to:bn,insert:""})}),de.dispatch({...Oe.length>0?{changes:Oe}:{},effects:d8.of({predicate:Q}),scrollIntoView:!0})},[]),yr=g.useCallback(Q=>{const de=(Q==null?void 0:Q.text)??!0,Oe=(Q==null?void 0:Q.tags)??!0,et=N.current;de&&et&&et.state.doc.length>0&&et.dispatch({changes:{from:0,to:et.state.doc.length,insert:""},effects:Oc.of()}),de&&(rt([]),tn.current.clear(),jn.current=1),Oe&&(Pn([]),de||Si())},[Si]),ma=g.useCallback(()=>{yr({text:!0,tags:!1})},[yr]),Oo=g.useCallback((Q,de)=>{if(Q.length!==0){if((de==null?void 0:de.placement)==="inline"){const Oe=N.current;if(!Oe)return;const et=Oe.state.selection.main;let bn=et.from;const $t=[],vn=Q.map(ds=>{const hs=Ay(ds);return $t.push({from:bn,to:bn+hs.length,tag:ds}),bn+=hs.length+1,hs}).join(" "),is=vn?`${vn} `:"";Oe.dispatch({changes:{from:et.from,to:et.to,insert:is},effects:$t.length>0?$t.map(ds=>c0.of({...ds,tag:ie(ds.tag)})):void 0,selection:{anchor:et.from+is.length},scrollIntoView:!0}),Oe.focus();return}Pn(Oe=>{const et=[...Oe];for(const bn of Q){const $t=et.findIndex(vn=>vn.id===bn.id);$t>=0?et[$t]=bn:et.push(bn)}return et})}},[ie]),El=g.useCallback(Q=>{Pn(de=>de.filter(Oe=>Oe.id!==Q||Oe.removable===!1)),Si(de=>de.id===Q&&de.removable!==!1)},[Si]),Ra=g.useCallback(()=>{var Q;return(((Q=N.current)==null?void 0:Q.state.doc.toString().trim().length)??0)>0||Qt.current.length>0||vt.current.length>0},[]),rr=g.useCallback(Q=>{const de=N.current;if(!de)return;const Oe=L3e(de);if((Q==null?void 0:Q.tagPlacement)==="inline"){Be.current(de,m4(Q.text??"",Q.tags??Oe),[]);return}if((Q==null?void 0:Q.text)!==void 0&&Q.tags===void 0&&Oe.length>0){Be.current(de,m4(Q.text,Oe),[]);return}Be.current(de,Q==null?void 0:Q.text,Q?Q.tags??[]:void 0)},[]),pa=g.useCallback(()=>{const Q=Ft.current.getLastEntry(Oe=>!Oe.startsWith("/")&&!Oe.startsWith("!"));!Q||I.current(Q)===!1||rt([])},[]),li=g.useCallback(Q=>{const de=N.current;de&&de.dispatch({changes:{from:0,to:de.state.doc.length,insert:Q},selection:{anchor:Q.length},scrollIntoView:!0})},[]);g.useEffect(()=>{const Q=ve.current;if(!Q)return;const de=N.current;if(!de)return;const Oe=Q.tagPlacement??"top";if(Q.tags!==void 0&&Oe==="top"&&Pn([...Q.tags]),Q.text!==void 0||Oe==="inline"){const bn=Oe==="inline"?[...Q.tags??[]]:[],$t=bn.map(Ay).join(" "),vn=Oe==="inline"?$t&&Q.text?`${$t} ${Q.text}`:$t||(Q.text??""):Q.text??"",is=[Oc.of()];if(bn.length>0){let ds=0;for(const hs of bn){const ze=Ay(hs);is.push(c0.of({from:ds,to:ds+ze.length,tag:ie(hs)})),ds+=ze.length+1}}de.dispatch({changes:{from:0,to:de.state.doc.length,insert:vn},effects:is,selection:{anchor:vn.length},scrollIntoView:!0})}else de.dispatch({effects:Oc.of()});(Q.text!==void 0||Q.submit)&&de.focus();let et=null;return Q.submit&&(et=window.setTimeout(()=>{N.current&&rr(Q)},0)),()=>{et!==null&&window.clearTimeout(et)}},[x,ie,rr]);const Qs=g.useCallback((Q,de=!0)=>{var et;Q&&li(ue.current),ht(!1),ft(""),qt([]),ge(0),(le.current?on.current:Ft.current).resetSearch(),de&&((et=N.current)==null||et.focus())},[li]);g.useEffect(()=>{if(!ct)return;const Q=de=>{if(de instanceof MouseEvent&&de.button!==0||de.defaultPrevented)return;const Oe=ne.current,et=de.target;Oe&&et instanceof Node&&!Oe.contains(et)&&Qs(!0,!1)};return window.addEventListener("mousedown",Q),window.addEventListener("touchstart",Q),()=>{window.removeEventListener("mousedown",Q),window.removeEventListener("touchstart",Q)}},[ct,Qs]);const Ti=g.useCallback(Q=>{var vn;if(!N.current)return;Qs(!1);const Oe=Q.trim();if(!Oe)return;const et=vt.current,bn=le.current;if(I.current(bn?`!${Oe}`:Oe,et.length>0?[...et]:void 0)===!1){li(Q);return}(vn=z.current)==null||vn.call(z),bn?(on.current.push(Oe),on.current.reset()):(Ft.current.push(Oe),Ft.current.reset()),rt([]),li("")},[Qs,li]),Ci=Q=>{if(!Q.nativeEvent.isComposing)if(Q.key==="Escape")Q.preventDefault(),Qs(!0);else if(Q.key==="Tab"){Q.preventDefault();const de=tt[Ye];de&&li(de),Qs(!1)}else if(Q.key==="Enter"){Q.preventDefault();const de=tt[Ye];de?Ti(de):Qs(!1)}else Q.key==="r"&&Q.ctrlKey&&(Q.preventDefault(),tt.length>0&&ge(de=>(de+1)%tt.length))},Wi=Q=>{const de=le.current?on.current:Ft.current;qt(Ks(Q)),ge(0),de.resetSearch()},ga=Q=>{const de=Q.target.value;ft(de),!Q.nativeEvent.isComposing&&Wi(de)},Bo=Q=>{const de=Q.currentTarget.value;ft(de),Wi(de)},Ml=g.useCallback(Q=>{rt(de=>de.filter((Oe,et)=>et!==Q))},[]),Gi=!G&&!ct&&!(p!=null&&p.isVisible)&&!r&&!m,Ai={clearText:ma,clear:yr,focus:Bs,getText:Ps,hasInput:Ra,setText:kn,addTags:Oo,removeTag:El,insertText:Dt,retryLast:pa,restoreImages:Q=>{rt(de=>[...de,...Q])},submit:rr};return{containerRef:T,viewRef:N,focus:Bs,submitText:g.useCallback(()=>{const Q=N.current;Q&&Be.current(Q)},[]),clearText:ma,getText:Ps,hasInput:Ra,hasContent:Vn,handle:Ai,pastedImages:Re,removeImage:Ml,composerTags:ln,removeTopTag:El,addTags:Oo,removeInlineTags:Si,insertText:Dt,setText:kn,submit:rr,clear:yr,retryLast:pa,replaceEditorText:li,shellMode:G,setShellMode:q,toggleShellMode:we,currentMode:h,sessionName:b,searchState:{searchMode:ct,searchQuery:ut,searchMatches:tt,searchActiveIndex:Ye,searchInputRef:st,searchUiRef:ne,openHistorySearch:pn,closeSearch:Qs,submitSearchMatch:Ti,handleSearchKeyDown:Ci,handleSearchInput:ga,handleSearchCompositionEnd:Bo},navigatePrevHistory:un,navigateNextHistory:rs,showShortcutHints:Gi,followupState:p,disabled:r,onAcceptFollowup:y,onDismissFollowup:w,slashMenu:Ht,closeSlashMenu:_n,selectSlashCompletion:Os,acceptSlashCompletion:Kt,atMenu:Se.state,closeAtMenu:rn,selectAtCompletion:Se.select,acceptAtCompletion:Se.accept,enterAtCategory:Se.enterCategory,backAtCategories:Se.backToCategories,updateAtSearch:Se.updateSearch}}const P3e="_editorShell_9228r_1",$3e="_container_9228r_7",z3e="_content_9228r_22",F3e="_dacAura_9228r_35",q3e="_dacHalo_9228r_36",H3e="_slashPortalLayer_9228r_177",U3e="_atPortalLayer_9228r_181",V3e="_slashPanel_9228r_185",W3e="_slashPanelBody_9228r_220",G3e="_slashList_9228r_226",K3e="_slashEntry_9228r_255",Y3e="_slashSection_9228r_261",Q3e="_slashSectionHeader_9228r_267",X3e="_slashSectionCount_9228r_280",J3e="_slashItem_9228r_288",Z3e="_slashItemActive_9228r_309",eke="_slashCommand_9228r_313",tke="_slashDetail_9228r_318",nke="_slashDetailCommand_9228r_337",ske="_slashDetailText_9228r_347",rke="_slashDescription_9228r_367",ike="_atPanel_9228r_378",oke="_atPanelHeaderWrap_9228r_402",ake="_atPanelHeader_9228r_402",lke="_atBackButton_9228r_417",cke="_atPanelTitle_9228r_439",uke="_atSearchInput_9228r_448",dke="_atList_9228r_467",hke="_atItem_9228r_495",fke="_atItemActive_9228r_517",mke="_atItemSingleLine_9228r_521",pke="_atItemLabel_9228r_527",gke="_atItemDescription_9228r_538",yke="_atItemTrailing_9228r_549",bke="_atEmpty_9228r_556",vke="_tags_9228r_580",wke="_tag_9228r_580",xke="_tagLabel_9228r_601",_ke="_tagValue_9228r_602",kke="_tagIcon_9228r_606",Ske="_tagRemove_9228r_641",Tke="_editorArea_9228r_661",Cke="_shellPrefix_9228r_676",Ake="_toolbar_9228r_713",Eke="_toolbarLeading_9228r_722",Mke="_toolbarStart_9228r_723",Nke="_toolbarEnd_9228r_724",Ike="_toolbarLeft_9228r_725",jke="_toolbarRight_9228r_726",Rke="_toolbarRightCustom_9228r_754",Lke="_toolBtn_9228r_761",Dke="_toolBtnText_9228r_767",Oke="_dropdownWrapper_9228r_772",Bke="_dropdown_9228r_772",Pke="_dropdownRich_9228r_794",$ke="_dropdownCheck_9228r_800",zke="_dropdownItem_9228r_806",Fke="_dropdownItemActive_9228r_844",qke="_dropdownItemIcon_9228r_849",Hke="_dropdownItemCheck_9228r_850",Uke="_dropdownItemContent_9228r_867",Vke="_dropdownItemLabel_9228r_874",Wke="_dropdownItemDesc_9228r_884",Gke="_toolBtnIcon_9228r_942",Kke="_widthModeBtn_9228r_958",Yke="_quickActionsBtn_9228r_967",Qke="_toolBtnModeIcon_9228r_976",Xke="_toolBtnModelIcon_9228r_977",Jke="_toolBtnArrow_9228r_1004",Zke="_chevronDown_9228r_1017",e5e="_quickActionsPanel_9228r_1026",t5e="_quickActionsHeader_9228r_1039",n5e="_quickActionsLayout_9228r_1046",s5e="_quickActionsGrid_9228r_1053",r5e="_quickAction_9228r_967",i5e="_quickActionLabel_9228r_1084",o5e="_quickKeysGrid_9228r_1099",a5e="_quickKey_9228r_1099",l5e="_quickKeyLabel_9228r_1128",c5e="_sendBtn_9228r_1141",u5e="_sendBtnRunning_9228r_1179",d5e="_sendIcon_9228r_1192",h5e="_stopIcon_9228r_1198",f5e="_loadingIcon_9228r_1205",m5e="_sendBtnArmed_9228r_1217",p5e="_escLabel_9228r_1285",g5e="_srOnly_9228r_1293",y5e="_images_9228r_1315",b5e="_imageThumb_9228r_1322",v5e="_imageRemove_9228r_1337",w5e="_searchPanel_9228r_1358",x5e="_searchBar_9228r_1375",_5e="_searchLabel_9228r_1383",k5e="_searchInput_9228r_1388",S5e="_searchResults_9228r_1402",T5e="_searchResult_9228r_1402",C5e="_searchResultActive_9228r_1435",A5e="_searchResultMarker_9228r_1440",E5e="_searchResultText_9228r_1445",M5e="_searchEmpty_9228r_1452",Ee={editorShell:P3e,container:$3e,content:z3e,dacAura:F3e,dacHalo:q3e,slashPortalLayer:H3e,atPortalLayer:U3e,slashPanel:V3e,slashPanelBody:W3e,slashList:G3e,slashEntry:K3e,slashSection:Y3e,slashSectionHeader:Q3e,slashSectionCount:X3e,slashItem:J3e,slashItemActive:Z3e,slashCommand:eke,slashDetail:tke,slashDetailCommand:nke,slashDetailText:ske,slashDescription:rke,atPanel:ike,atPanelHeaderWrap:oke,atPanelHeader:ake,atBackButton:lke,atPanelTitle:cke,atSearchInput:uke,atList:dke,atItem:hke,atItemActive:fke,atItemSingleLine:mke,atItemLabel:pke,atItemDescription:gke,atItemTrailing:yke,atEmpty:bke,tags:vke,tag:wke,tagLabel:xke,tagValue:_ke,tagIcon:kke,tagRemove:Ske,editorArea:Tke,shellPrefix:Cke,toolbar:Ake,toolbarLeading:Eke,toolbarStart:Mke,toolbarEnd:Nke,toolbarLeft:Ike,toolbarRight:jke,toolbarRightCustom:Rke,toolBtn:Lke,toolBtnText:Dke,dropdownWrapper:Oke,dropdown:Bke,dropdownRich:Pke,dropdownCheck:$ke,dropdownItem:zke,dropdownItemActive:Fke,dropdownItemIcon:qke,dropdownItemCheck:Hke,dropdownItemContent:Uke,dropdownItemLabel:Vke,dropdownItemDesc:Wke,toolBtnIcon:Gke,widthModeBtn:Kke,quickActionsBtn:Yke,toolBtnModeIcon:Qke,toolBtnModelIcon:Xke,toolBtnArrow:Jke,chevronDown:Zke,quickActionsPanel:e5e,quickActionsHeader:t5e,quickActionsLayout:n5e,quickActionsGrid:s5e,quickAction:r5e,quickActionLabel:i5e,quickKeysGrid:o5e,quickKey:a5e,quickKeyLabel:l5e,sendBtn:c5e,sendBtnRunning:u5e,sendIcon:d5e,stopIcon:h5e,loadingIcon:f5e,sendBtnArmed:m5e,escLabel:p5e,srOnly:g5e,images:y5e,imageThumb:b5e,imageRemove:v5e,searchPanel:w5e,searchBar:x5e,searchLabel:_5e,searchInput:k5e,searchResults:S5e,searchResult:T5e,searchResultActive:C5e,searchResultMarker:A5e,searchResultText:E5e,searchEmpty:M5e},N5e=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function I5e({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r,onBack:i,onSearch:o}){const{t:a}=Xe(),l=g.useRef([]),c=g.useRef(null),[d,h]=g.useState(null),[f,m]=g.useState({});g.useEffect(()=>{var _;(_=l.current[e.selectedIndex])==null||_.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),g.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===c.current)return;const _=()=>{var M;return(M=c.current)==null?void 0:M.focus()},E=window.requestAnimationFrame(_),k=window.setTimeout(_,0);return()=>{window.cancelAnimationFrame(E),window.clearTimeout(k)}},[e.inputMode,e.level,e.selectedProviderId]),g.useLayoutEffect(()=>{const _=t.current;if(!_)return;const E=getComputedStyle(_);m(Object.fromEntries(N5e.map(k=>[k,E.getPropertyValue(k)])))},[t]),g.useLayoutEffect(()=>{const _=t.current;if(!_)return;let E=null;const k=()=>{var I;const L=_.getBoundingClientRect(),T=((I=n.current)==null?void 0:I.offsetWidth)??360,N={left:Math.max(12,Math.min(L.left+16,window.innerWidth-T-12)),bottom:window.innerHeight-L.top+8,width:L.width};h(O=>O&&O.left===N.left&&O.bottom===N.bottom&&O.width===N.width?O:N)},M=()=>{E===null&&(E=window.requestAnimationFrame(()=>{E=null,k()}))};k();const R=new ResizeObserver(M);return R.observe(_),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0),()=>{E!==null&&window.cancelAnimationFrame(E),R.disconnect(),window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0)}},[t,n]);const p=e.level==="categories"?e.providers.map(_=>({id:_.id,label:_.label,description:_.description,trailing:"›"})):e.items.map(_=>({id:_.id,label:_.label,description:e.selectedProviderId===Jr?void 0:_.description??_.detail,trailing:_.kind==="directory"||_.kind==="mcp-server"?"›":""}));if(g.useEffect(()=>{l.current.length=p.length},[p.length]),!d)return null;const y=e.providers.find(_=>_.id===e.selectedProviderId),w=e.itemMode==="mcpResources"&&e.mcpServerName?sr(e.mcpServerName)??"[invalid]":(y==null?void 0:y.label)??"",b=e.level==="items"?(y==null?void 0:y.label)??a("at.menu"):a("at.menu"),v="at-mention-listbox",x=e.selectedIndex>=0&&e.selectedIndex<p.length?`at-mention-option-${e.selectedIndex}`:void 0;return Op.createPortal(u.jsx("div",{className:Ee.atPortalLayer,style:f,children:u.jsxs("div",{ref:n,className:Ee.atPanel,"data-at-mention-panel":"true",style:{...f,left:d.left,bottom:d.bottom,"--at-anchor-width":`${d.width}px`},role:"region","aria-label":b,onMouseDown:_=>{_.target instanceof HTMLInputElement||_.preventDefault()},children:[e.level==="items"&&u.jsxs("div",{className:Ee.atPanelHeaderWrap,children:[u.jsxs("div",{className:Ee.atPanelHeader,children:[u.jsx("button",{type:"button",className:Ee.atBackButton,"aria-label":a("common.back"),onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},onClick:_=>{_.preventDefault(),_.stopPropagation(),i()},children:"‹"}),u.jsx("span",{className:Ee.atPanelTitle,children:w})]}),u.jsx("input",{ref:c,className:Ee.atSearchInput,value:e.query,placeholder:a("common.search"),"aria-label":a("common.search"),"aria-controls":v,"aria-activedescendant":x,onMouseDown:_=>_.stopPropagation(),onClick:_=>_.stopPropagation(),onChange:_=>o(_.currentTarget.value),onKeyDown:_=>{if(!(_.nativeEvent.isComposing||_.nativeEvent.keyCode===229)){if(_.key==="Escape")_.preventDefault(),_.stopPropagation(),i();else if(_.key==="Enter")_.preventDefault(),_.stopPropagation(),r();else if(_.key==="Tab"&&!_.shiftKey&&!_.altKey&&!_.ctrlKey&&!_.metaKey)_.preventDefault(),_.stopPropagation(),r();else if(_.key==="ArrowUp"){if(_.preventDefault(),_.stopPropagation(),p.length===0)return;s(Math.max(0,e.selectedIndex-1))}else if(_.key==="ArrowDown"){if(_.preventDefault(),_.stopPropagation(),p.length===0)return;s(Math.min(p.length-1,e.selectedIndex+1))}}}})]}),u.jsx("div",{id:v,className:Ee.atList,role:p.length>0?"listbox":void 0,"aria-label":p.length>0?b:void 0,children:e.loading&&p.length===0?u.jsx("div",{className:Ee.atEmpty,role:"status","aria-live":"polite",children:a("common.loading")}):p.length===0?u.jsx("div",{className:Ee.atEmpty,role:"status","aria-live":"polite",children:a("common.noResults")}):p.map((_,E)=>u.jsxs("button",{ref:k=>{l.current[E]=k},type:"button",id:`at-mention-option-${E}`,role:"option","aria-selected":E===e.selectedIndex,className:`${Ee.atItem} ${E===e.selectedIndex?Ee.atItemActive:""} ${_.description?"":Ee.atItemSingleLine}`,onMouseEnter:()=>s(E),onMouseDown:k=>{k.preventDefault(),k.stopPropagation()},onClick:k=>{k.preventDefault(),k.stopPropagation(),r(E)},children:[u.jsx("span",{className:Ee.atItemLabel,children:_.label}),_.description&&u.jsx("span",{className:Ee.atItemDescription,children:_.description}),_.trailing&&u.jsx("span",{className:Ee.atItemTrailing,"aria-hidden":"true",children:_.trailing})]},_.id))})]})}),document.body)}const j5e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_46_02846'%3e%3crect%20x='-1.2000000476837158'%20y='-1.2000000476837158'%20width='18.40000009536743'%20height='18.40000009536743'%20rx='0'/%3e%3c/clipPath%3e%3cclipPath%20id='master_svg1_46_02850'%3e%3crect%20x='3.299999952316284'%20y='3.299999952316284'%20width='9.400000095367432'%20height='9.400000095367432'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_46_02846)'%3e%3cpath%20d='M2.40314639,2.758413L2.40292972,3.1950147L2.40178722,5.4973922L2.4000000999999997,8.3332543Q2.39999998,10.5420713,3.90192288,12.266657Q5.402200000000001,13.989353,8.1462374,14.904664L8.3362594,14.968048L8.526247999999999,14.904564Q11.2532721,13.993322,12.7668409,12.240547Q14.266665,10.5036879,14.266665,8.333632L14.266147,5.4975739L14.262505,2.7582424000000003L13.847304,2.6242929Q9.977867100000001,1.37595743,8.6663413,0.50089496L8.3334417,0.27878135000000004L8.0004754,0.5007948Q6.6891963,1.37512314,2.81864448,2.624314L2.40314639,2.758413ZM3.60271364,3.6308396L3.60178709,5.4979882L3.5999999000000003,8.3340111Q3.60000002,10.0927849,4.8068562,11.47856Q6.0415909,12.896347,8.3358369,13.701283Q10.6119351,12.899953,11.8586035,11.45626Q13.066666,10.0572739,13.066666,8.333632L13.066147,5.4977932L13.063664,3.6310089Q9.7833066,2.5506459,8.3332324,1.70592678Q6.8834386,2.5499707000000003,3.60271364,3.6308396Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3cg%20clip-path='url(%23master_svg1_46_02850)'%3e%3cg%20transform='matrix(0,-0.9999712705612183,0.9999712705612183,0,-4.155969887971878,15.343589294701815)'%3e%3cpath%20d='M4.74521804,9.75L5.16948596,10.1742641L7.3436494,12.3484278L9.5178127,10.1742641L9.9420805,9.75L9.0935488,8.90146804L8.669284600000001,9.32573596L7.3436494,10.65137106L6.0180141,9.3257359L5.59375,8.90146804L4.74521804,9.75Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3cline%20x1='8.299999952316284'%20y1='9.587499976158142'%20x2='11.362499952316284'%20y2='9.587499976158142'%20fill-opacity='0'%20stroke-opacity='1'%20stroke='%230A0A0B'%20fill='none'%20stroke-width='1.2000000476837158'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",R5e="/assets/default-aEtf0G7-.svg",mF="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='13.101718187332153'%20height='12.118681192398071'%20viewBox='0%200%2013.101718187332153%2012.118681192398071'%3e%3cpath%20d='M3.728619923841858,11.142287023841858L11.844652023841858,3.025579823841858L12.268880023841858,2.6013156238418578L9.419035523841858,-0.24852800615814208L0.8780930338418579,8.292414323841857L-0.27773314615814204,12.298048023841858L3.728619923841858,11.142287023841858ZM10.571859023841858,2.6013509238418577L3.098784523841858,10.075047123841857L1.4777333738418579,10.542690823841857L1.945311323841858,8.922252323841859L9.419035523841858,1.448528053841858L10.571859023841858,2.6013509238418577ZM5.901715423841858,12.118684023841858L6.501718123841858,12.118682023841858L12.501718023841859,12.118682023841858L13.101720023841859,12.118684023841858L13.101720023841859,10.918678023841858L12.501718023841859,10.918681023841858L6.501718123841858,10.918682023841859L5.901715423841858,10.918678023841858L5.901715423841858,12.118684023841858Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/svg%3e",L5e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cclipPath%20id='master_svg0_26_21323'%3e%3crect%20x='-0.6000000238418579'%20y='-0.6000000238418579'%20width='17.200000047683716'%20height='17.200000047683716'%20rx='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23master_svg0_26_21323)'%3e%3cpath%20d='M6,2.484801532279053L5.5757358,2.9090694522790526L3.3333334,5.151471992279053L2.42426407,4.242402732279053L2,3.818134902279053L1.1514680400000001,4.666666892279053L1.57573596,5.090930892279053L3.3333334,6.848528392279053L6.424264,3.7575975622790527L6.8485317,3.3333334922790527L6,2.484801532279053ZM8.0666642,4.600002992279053L8.666667,4.600000192279053L14,4.600000292279053L14.600002,4.600002992279053L14.600002,3.3999974132790527L14,3.4000001552790526L8.666667499999999,3.4000001922790526L8.0666642,3.3999974132790527L8.0666642,4.600002992279053ZM8.0666642,8.600003292279052L8.666667,8.600000392279053L14,8.600000892279052L14.600002,8.600003292279052L14.600002,7.399997692279053L14,7.400000592279053L8.666667499999999,7.400000592279053L8.0666642,7.399997692279053L8.0666642,8.600003292279052ZM6,9.151468792279053L5.5757358,9.575736492279052L3.3333335,11.818139592279053L2.42426419,10.909069992279052L2,10.484801292279052L1.15146798,11.333333492279053L1.57573584,11.757597492279054L3.3333334,13.515196492279053L6.424264,10.424265392279054L6.8485317,10.000000492279053L6,9.151468792279053ZM8.0666642,12.600003692279053L8.666667,12.600000892279052L14,12.600000892279052L14.600002,12.600003692279053L14.600002,11.399997192279052L14,11.400000092279052L8.666667499999999,11.400001092279053L8.0666642,11.399997192279052L8.0666642,12.600003692279053Z'%20fill-rule='evenodd'%20fill='%230A0A0B'%20fill-opacity='1'/%3e%3c/g%3e%3c/svg%3e",D5e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='11.86667275428772'%20height='14.535494089126587'%20viewBox='0%200%2011.86667275428772%2014.535494089126587'%3e%3cpath%20d='M5.933441723841858,-0.12121862615814205L5.600475423841858,0.1007948238418579Q4.289196323841858,0.9751231638418579,0.4186445038418579,2.224314023841858L0.0031464138418578758,2.358413023841858L0.0017872438418579106,5.097392223841858L1.2384185787972513e-7,7.933254323841858Q3.8418579428878274e-9,10.142071323841858,1.5019229038418578,11.866657023841858Q3.002200023841858,13.589353023841857,5.746237423841858,14.504664023841858L5.936259423841858,14.568048023841857L6.126248023841858,14.504564023841858Q8.853272123841858,13.593322023841857,10.366840923841858,11.840547023841857Q11.866665023841858,10.103687923841857,11.866665023841858,7.933632023841858L11.866147023841858,5.097573923841858L11.862505023841859,2.3582424238418582L11.447304023841857,2.224292923841858Q7.577867123841858,0.9759574538418578,6.266341323841858,0.10089498384185791L5.933441723841858,-0.12121862615814205ZM5.933233823841858,1.3059267438418578Q4.483438623841858,2.149970723841858,1.202713663841858,3.2308396238418577L1.2017871138418579,5.097988223841858L1.199999923841858,7.934011123841858Q1.2000000438418579,9.692784923841858,2.406856223841858,11.078560023841858Q3.641590923841858,12.496347023841858,5.935836923841858,13.301283023841858Q8.211935123841858,12.499953023841858,9.458603523841857,11.056260023841858Q10.666666023841858,9.657273923841858,10.666666023841858,7.933632023841858L10.666147023841859,5.097793223841858L10.663664023841857,3.231008923841858Q7.383306623841858,2.150645923841858,5.933233823841858,1.3059267438418578ZM5.333330723841858,4.000322923841858L5.333333623841858,4.600325723841858L5.333333623841858,7.266992223841858L5.333330723841858,7.866995023841858L6.533336323841858,7.866995023841858L6.533333423841858,7.266992223841858L6.533333923841858,4.600325723841858L6.533336323841858,4.000322923841858L5.333330723841858,4.000322923841858ZM5.333330723841858,10.533662423841857L5.933333523841858,10.533659623841858L5.940000223841858,10.533659623841858L6.5400029238418576,10.533662423841857L6.5400029238418576,9.333655923841858L5.940000223841858,9.333658823841859L5.933333523841858,9.333659723841858L5.333330723841858,9.333655923841858L5.333330723841858,10.533662423841857Z'%20fill-rule='evenodd'%20fill='%230A0A0A'%20fill-opacity='1'/%3e%3c/svg%3e",O5e="_icon_i7y0u_1",B5e={icon:O5e},P5e={auto:j5e,"auto-edit":mF,default:R5e,plan:L5e,yolo:D5e};function Uk({mode:e}){const t=P5e[e];return t?u.jsx("span",{className:B5e.icon,style:sf("--mode-icon-url",t),"aria-hidden":"true"}):u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M6 18c.7-2.7 2.2-4 4.5-4H12M7 6h10M7 10h7M17.5 14.5l2 2-2 2",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function $5e(e,t){const n=new Map;if(t==="command")for(const r of e)r.section&&n.set(r.section,(n.get(r.section)??0)+1);let s;return e.map((r,i)=>{const o=r.section,a=t==="command"&&o!==void 0&&o!==s,l=a&&i>0;return s=o??s,{showHeader:a,showDivider:l,count:a&&o?n.get(o)??0:0}})}function Dp(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const p4=16e3,z5e=4096,ZM=6e4;function F5e(e){const t=new URL(e),n=t.pathname.replace(/\/?$/,"/"),s=new URL("voice/stream",`${t.origin}${n}`);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.toString()}const q5e="qwen-bearer.",H5e="qwen-ws";function U5e(e){const t=new TextEncoder().encode(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);const s=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${q5e}${s}`}function V5e(e){switch(e==null?void 0:e.name){case"NotAllowedError":case"SecurityError":return"Microphone blocked. Click the camera/lock icon in the address bar to allow the mic for this site, and enable your browser under System Settings → Privacy → Microphone, then retry.";case"NotFoundError":case"DevicesNotFoundError":case"OverconstrainedError":return"No microphone found. Connect one and retry.";case"NotReadableError":case"TrackStartError":return"Microphone is in use by another app. Close it and retry.";default:return e instanceof Error?e.message:String(e)}}function W5e(e){const t=new Int16Array(e.length);let n=0;for(let s=0;s<e.length;s++){let r=e[s];r>1?r=1:r<-1&&(r=-1),t[s]=r<0?r*32768:r*32767,n+=r*r}return{pcm:t.buffer,level:e.length?Math.sqrt(n/e.length):0}}function G5e(e){const{baseUrl:t,token:n,onFinal:s,onError:r}=e,[i,o]=g.useState("idle"),[a,l]=g.useState(""),[c,d]=g.useState(0),[h,f]=g.useState(void 0),m=g.useRef({}),p=g.useRef(!0),y=g.useRef(0),w=g.useRef("idle"),b=g.useRef(s);b.current=s;const v=g.useRef(r);v.current=r;const x=g.useCallback(I=>{w.current=I,o(I)},[]),_=g.useCallback(()=>{const I=m.current;I.transcribeTimeout&&(clearTimeout(I.transcribeTimeout),I.transcribeTimeout=void 0)},[]),E=g.useCallback(()=>{var O;const I=m.current;I.processor&&(I.processor.onaudioprocess=null);for(const U of[I.processor,I.source,I.sink])try{U==null||U.disconnect()}catch{}(O=I.stream)==null||O.getTracks().forEach(U=>U.stop()),I.context&&I.context.state!=="closed"&&I.context.close().catch(()=>{}),I.processor=void 0,I.sink=void 0,I.source=void 0,I.stream=void 0,I.context=void 0},[]),k=g.useCallback(()=>{y.current++,E();const I=m.current;if(_(),I.ws){try{I.ws.onmessage=null,I.ws.onerror=null,I.ws.onclose=null,I.ws.close()}catch{}I.ws=void 0}},[E,_]),M=g.useCallback((I,O)=>{var U;!p.current||O!==void 0&&y.current!==O||(k(),x("error"),l(""),d(0),f(I),(U=v.current)==null||U.call(v,I))},[k,x]),R=g.useCallback((I,O)=>{O!==void 0&&y.current!==O||(k(),p.current&&(x("idle"),l(""),d(0),b.current(I)))},[k,x]),L=g.useCallback(()=>{if(w.current!=="idle"&&w.current!=="error")return;f(void 0),l(""),x("connecting");const I=++y.current,O=()=>!p.current||y.current!==I;(async()=>{var U;try{if(!((U=navigator.mediaDevices)!=null&&U.getUserMedia))throw new Error(window.isSecureContext?"Microphone capture is not supported in this browser.":"Microphone needs a secure context — open the Web Shell via localhost/127.0.0.1 or https.");let F;try{F=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(J){throw new Error(V5e(J))}if(O()){F.getTracks().forEach(J=>J.stop());return}m.current.stream=F;const j=new AudioContext({sampleRate:p4});if(j.sampleRate!==p4)throw F.getTracks().forEach(J=>J.stop()),j.close().catch(()=>{}),new Error(`Browser audio rate ${j.sampleRate} Hz is not the required ${p4} Hz.`);if(m.current.context=j,j.state==="suspended"&&await j.resume(),O()){F.getTracks().forEach(J=>J.stop()),j.close().catch(()=>{});return}const V=j.createMediaStreamSource(F),ee=j.createScriptProcessor(z5e,1,1),ce=j.createGain();ce.gain.value=0,m.current.source=V,m.current.processor=ee,m.current.sink=ce;const $=new WebSocket(F5e(t),n?[H5e,U5e(n)]:void 0);$.binaryType="arraybuffer",m.current.ws=$,ee.onaudioprocess=J=>{const{pcm:B,level:C}=W5e(J.inputBuffer.getChannelData(0));p.current&&d(C),$.readyState===WebSocket.OPEN&&$.send(B)},$.onopen=()=>{if(O()){ee.onaudioprocess=null;for(const B of[ee,V,ce])try{B.disconnect()}catch{}F.getTracks().forEach(B=>B.stop()),j.state!=="closed"&&j.close().catch(()=>{});const J=m.current;J.ws===$&&(J.ws=void 0),J.processor===ee&&(J.processor=void 0),J.source===V&&(J.source=void 0),J.sink===ce&&(J.sink=void 0),J.stream===F&&(J.stream=void 0),J.context===j&&(J.context=void 0);try{$.close()}catch{}return}$.send(JSON.stringify({type:"start"})),V.connect(ee),ee.connect(ce),ce.connect(j.destination),_(),m.current.transcribeTimeout=setTimeout(()=>{w.current==="recording"&&M("No response from server. Check that the voice model is running.",I)},ZM),p.current&&x("recording")},$.onmessage=J=>{(w.current==="connecting"||w.current==="recording")&&_();let B;try{B=JSON.parse(String(J.data))}catch{return}B.type==="interim"?p.current&&l(B.text??""):B.type==="final"?R(B.text??"",I):B.type==="error"&&M(B.message??B.text??"Voice transcription failed.",I)},$.onerror=()=>{},$.onclose=J=>{if(p.current&&(w.current==="recording"||w.current==="connecting"||w.current==="transcribing")){const B=J.code||1006,C=J.reason||"none";M(`Voice connection closed (code=${B}, reason=${C}).`,I)}}}catch(F){M(F instanceof Error?F.message:String(F),I)}})()},[t,n,M,R,x,_]),T=g.useCallback(()=>{const I=m.current.ws;if(!I||I.readyState!==WebSocket.OPEN){k(),x("idle");return}E(),d(0),x("transcribing");const O=y.current;try{I.send(JSON.stringify({type:"stop"})),_(),m.current.transcribeTimeout=setTimeout(()=>{w.current==="transcribing"&&M("Transcription timed out.",O)},ZM)}catch{M("Failed to finalize voice transcription.",O)}},[k,E,M,x,_]),N=g.useCallback(()=>{const I=m.current.ws;if(I&&I.readyState===WebSocket.OPEN)try{I.send(JSON.stringify({type:"abort"}))}catch{}k(),x("idle"),l(""),d(0)},[k,x]);return g.useEffect(()=>(p.current=!0,()=>{p.current=!1,k()}),[k]),{status:i,interimText:a,audioLevel:c,errorMessage:h,start:L,stop:T,abort:N}}const K5e="_root_9hwm9_7",Y5e="_iconBtn_9hwm9_14",Q5e="_error_9hwm9_47",X5e="_connecting_9hwm9_51",J5e="_pill_9hwm9_56",Z5e="_transcribing_9hwm9_75",eSe="_recDot_9hwm9_79",tSe="_wave_9hwm9_88",nSe="_bar_9hwm9_95",sSe="_time_9hwm9_103",rSe="_stop_9hwm9_111",iSe="_spinner_9hwm9_118",oSe="_interim_9hwm9_128",ui={root:K5e,iconBtn:Y5e,error:Q5e,connecting:X5e,pill:J5e,transcribing:Z5e,recDot:eSe,wave:tSe,bar:nSe,time:sSe,stop:rSe,spinner:iSe,interim:oSe},aSe="voice_transcribe",eN=16,lSe=()=>u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[u.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),u.jsx("path",{d:"M17 11a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2Z"})]}),cSe=()=>u.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function uSe(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),s=String(t%60).padStart(2,"0");return`${n}:${s}`}function dSe({onInsert:e,disabled:t}){var N;const n=mS(),{t:s}=Xe(),r=((N=n.capabilities)==null?void 0:N.features)??[],[i,o]=g.useState(void 0),{status:a,interimText:l,audioLevel:c,errorMessage:d,start:h,stop:f,abort:m}=G5e({baseUrl:n.baseUrl,token:n.token,onFinal:I=>{const O=I.trim();O?(o(void 0),e(O)):o(s("voice.noSpeech"))}}),p=a==="recording",[y,w]=g.useState(()=>new Array(eN).fill(0));g.useEffect(()=>{if(!p){w(new Array(eN).fill(0));return}w(I=>[...I.slice(1),Math.min(1,c*8)])},[c,p]);const[b,v]=g.useState(0);if(g.useEffect(()=>{if(!p){v(0);return}const I=performance.now(),O=setInterval(()=>v(performance.now()-I),200);return()=>clearInterval(O)},[p]),!r.includes(aSe))return null;const x=a==="connecting",_=a==="transcribing",E=a==="error",k=!!i&&!E,M=p||x,R=p?s("voice.stopDictation"):_?s("voice.transcribing"):x?s("voice.starting"):E?s("voice.errorRetry",{message:d??""}):s(k?"voice.noSpeechRetry":"voice.startDictation");let L;if(p)L=u.jsxs("button",{type:"button",className:ui.pill,onClick:()=>f(),"aria-label":R,title:R,children:[u.jsx("span",{className:ui.recDot,"aria-hidden":"true"}),u.jsx("span",{className:ui.wave,"aria-hidden":"true",children:y.map((I,O)=>u.jsx("span",{className:ui.bar,style:{height:`${2+Math.round(I*14)}px`}},O))}),u.jsx("span",{className:ui.time,children:uSe(b)}),u.jsx("span",{className:ui.stop,"aria-hidden":"true",children:u.jsx(cSe,{})})]});else if(_)L=u.jsxs("span",{className:`${ui.pill} ${ui.transcribing}`,role:"status","aria-label":R,children:[u.jsx("span",{className:ui.spinner,"aria-hidden":"true"}),u.jsx("span",{className:ui.time,children:"…"})]});else{const I=[ui.iconBtn,E?ui.error:"",x?ui.connecting:""].filter(Boolean).join(" ");L=u.jsx("button",{type:"button",className:I,onClick:()=>{if(x)m();else{if(t)return;o(void 0),h()}},disabled:!!t&&!M,"aria-label":R,title:d??i??R,children:u.jsx(lSe,{})})}const T=p&&l||E||k;return u.jsxs("span",{className:ui.root,children:[L,T&&u.jsx("span",{role:"status","aria-live":"polite",className:`${ui.interim}${E?` ${ui.error}`:""}`,children:E?d||s("voice.error"):k?i:l})]})}const hSe=["approvalMode","model","widthMode","voice"],fSe=new Set(hSe),mSe={"&":{fontSize:"14px",background:"transparent",border:"none"},"&.cm-focused":{outline:"none"},".cm-scroller":{maxHeight:"var(--chat-editor-input-max-height, 300px)",overflowX:"hidden",overflowY:"auto"},".cm-content":{padding:"0",fontFamily:"var(--font-sans, system-ui, sans-serif)",color:"var(--chat-editor-text-primary, #e0e0e0)",caretColor:"var(--chat-editor-accent-color, #4a9eff)",fontSize:"14px",lineHeight:"1.6"},".cm-line":{padding:"0"},".cm-placeholder":{color:"var(--chat-editor-text-dimmed, #666)"},".cm-followup-ghost":{color:"var(--chat-editor-text-dimmed, #666)",opacity:"0.72",pointerEvents:"none",userSelect:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused .cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-cursor":{borderLeftColor:"var(--chat-editor-accent-color, #4a9eff)",borderLeftWidth:"2px"}};function tN(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}const pSe=["--chat-editor-accent-color","--accent","--background","--chat-editor-bg-tertiary","--chat-editor-border-color","--foreground","--font-mono","--font-sans","--muted-foreground","--chat-editor-text-primary","--chat-editor-text-secondary"];function gSe(){return u.jsx("svg",{className:Ee.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:u.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ySe(){return u.jsx("span",{className:Ee.stopIcon,"aria-hidden":"true"})}function bSe(){return u.jsx("span",{className:Ee.loadingIcon,"aria-hidden":"true"})}function vSe(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>u.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function wSe(e,t){let n,s,r,i,o=0,a=0;const l=(y,w)=>{e.style.setProperty("--dac-glow-on",y.toFixed(4)),e.style.setProperty("--dac-glow-pulse",w.toFixed(4))},c=y=>{n!==void 0&&window.cancelAnimationFrame(n);const w=o,b=y-w;if(Math.abs(b)<.001){o=y,l(y,a);return}const v=performance.now(),x=_=>{const E=Math.min((_-v)/220,1);o=w+b*(1-(1-E)**2),l(o,a),n=E<1?window.requestAnimationFrame(x):void 0};n=window.requestAnimationFrame(x)},d=()=>{s!==void 0&&window.cancelAnimationFrame(s);const y=a,w=performance.now(),b=v=>{const x=Math.min((v-w)/300,1);a=y*(1-x),l(o,a),s=x<1?window.requestAnimationFrame(b):void 0};s=window.requestAnimationFrame(b)},h=y=>{y?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},f=()=>c(1),m=()=>{c(0),h(!1),i!==void 0&&window.clearTimeout(i)},p=()=>{s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),a=1,l(o,1),r=window.setTimeout(d,100),h(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>h(!1),650)};return t.addEventListener("focus",f),t.addEventListener("blur",m),t.addEventListener("keydown",p),document.activeElement===t&&c(1),()=>{n!==void 0&&window.cancelAnimationFrame(n),s!==void 0&&window.cancelAnimationFrame(s),r!==void 0&&window.clearTimeout(r),i!==void 0&&window.clearTimeout(i),t.removeEventListener("focus",f),t.removeEventListener("blur",m),t.removeEventListener("keydown",p),l(0,0),h(!1)}}function xSe({mode:e}){return e==="wide"?u.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[u.jsx("path",{d:"M550.012 486.537a8.16 8.16 0 0 1 8.17-8.17h305.36l-111.88-111.89c-3.19-3.19-3.19-8.4 0-11.59l25.08-25.08c3.19-3.19 8.4-3.19 11.59 0l168.61 168.6c3.19 3.19 3.19 8.4 0 11.59l-164.47 168.67c-3.19 3.19-8.4 3.19-11.59 0l-25.61-25.61c-3.19-3.19-3.19-8.4 0-11.59l106.58-110.78-303.62 0.11c-4.52 0-8.23-3.71-8.23-8.23v-36.03z",fill:"currentColor",transform:"translate(-483.41 0)"}),u.jsx("path",{d:"M473.532 524.327a8.16 8.16 0 0 1-8.17 8.17h-305.36l111.88 111.88c3.19 3.19 3.19 8.4 0 11.59l-25.09 25.09c-3.19 3.19-8.4 3.19-11.59 0l-168.6-168.61c-3.19-3.19-3.19-8.4 0-11.59l164.47-168.67c3.19-3.19 8.4-3.19 11.59 0l25.61 25.61c3.19 3.19 3.19 8.4 0 11.59l-106.59 110.78 303.62-0.11c4.52 0 8.23 3.71 8.23 8.23v36.04z",fill:"currentColor",transform:"translate(483.41 0)"})]}):u.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:u.jsx("path",{d:"M473.532 524.327a8.16 8.16 0 0 1-8.17 8.17h-305.36l111.88 111.88c3.19 3.19 3.19 8.4 0 11.59l-25.09 25.09c-3.19 3.19-8.4 3.19-11.59 0l-168.6-168.61c-3.19-3.19-3.19-8.4 0-11.59l164.47-168.67c3.19-3.19 8.4-3.19 11.59 0l25.61 25.61c3.19 3.19 3.19 8.4 0 11.59l-106.59 110.78 303.62-0.11c4.52 0 8.23 3.71 8.23 8.23v36.04zM550.012 486.537a8.16 8.16 0 0 1 8.17-8.17h305.36l-111.88-111.89c-3.19-3.19-3.19-8.4 0-11.59l25.08-25.08c3.19-3.19 8.4-3.19 11.59 0l168.61 168.6c3.19 3.19 3.19 8.4 0 11.59l-164.47 168.67c-3.19 3.19-8.4 3.19-11.59 0l-25.61-25.61c-3.19-3.19-3.19-8.4 0-11.59l106.58-110.78-303.62 0.11c-4.52 0-8.23-3.71-8.23-8.23v-36.03z",fill:"currentColor"})})}function nN(){return u.jsx("span",{className:Ee.chevronDown,"aria-hidden":"true"})}function _Se(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M12 3.5 19.4 7.8v8.4L12 20.5l-7.4-4.3V7.8L12 3.5Z",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"}),u.jsx("path",{d:"m8.2 9.7 3.8 2.2 3.8-2.2M12 11.9v4.4",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function kSe(e){const n=(e.action.type==="run"?e.action.command:e.action.type==="insert"?e.action.text:"").trimStart().match(/^\/([^\s]+)/);return(n==null?void 0:n[1])??null}const SSe=[{id:"tab",label:"Tab",descriptionKey:"quickKeys.tab",event:{key:"Tab",code:"Tab"}},{id:"escape",label:"Esc",descriptionKey:"quickKeys.escape",event:{key:"Escape",code:"Escape"}},{id:"arrow-up",label:"↑",descriptionKey:"quickKeys.history",event:{key:"ArrowUp",code:"ArrowUp"}},{id:"arrow-down",label:"↓",descriptionKey:"quickKeys.history",event:{key:"ArrowDown",code:"ArrowDown"}},{id:"arrow-left",label:"←",descriptionKey:"quickKeys.cursor",event:{key:"ArrowLeft",code:"ArrowLeft"}},{id:"arrow-right",label:"→",descriptionKey:"quickKeys.cursor",event:{key:"ArrowRight",code:"ArrowRight"}}];function TSe(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function pF(e,t){return{plan:t("mode.label.plan"),default:t("mode.label.default"),"auto-edit":t("mode.label.auto-edit"),auto:t("mode.label.auto"),yolo:t("mode.label.yolo")}[e]??e}function CSe(e,t){return{plan:t("mode.listLabel.plan"),default:t("mode.listLabel.default"),"auto-edit":t("mode.listLabel.auto-edit"),auto:t("mode.listLabel.auto"),yolo:t("mode.listLabel.yolo")}[e]??pF(e,t)}function sN({open:e,items:t,activeId:n,onClose:s,onSelect:r,anchorRef:i,showCheck:o=!1,maxHeight:a}){const l=g.useRef(null);if(g.useEffect(()=>{if(!e)return;const h=f=>{if(f instanceof MouseEvent&&f.button!==0||f.defaultPrevented)return;const m=l.current,p=i.current,y=f.target;m&&y instanceof Node&&!m.contains(y)&&p&&!p.contains(y)&&s()};return window.addEventListener("mousedown",h),()=>window.removeEventListener("mousedown",h)},[e,s,i]),g.useEffect(()=>{if(!e)return;const h=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),s())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[e,s]),!e)return null;const c=t.some(h=>h.description||h.icon),d=c||o;return u.jsx("div",{ref:l,className:`${Ee.dropdown} ${c?Ee.dropdownRich:o?Ee.dropdownCheck:""}`,style:a?{maxHeight:a,overflowY:"auto"}:void 0,children:t.map(h=>u.jsx("button",{type:"button",className:`${Ee.dropdownItem} ${h.id===n?Ee.dropdownItemActive:""}`,onMouseDown:f=>{f.preventDefault(),r(h.id)},children:d?u.jsxs(u.Fragment,{children:[c&&u.jsx("span",{className:Ee.dropdownItemIcon,children:h.icon}),u.jsxs("span",{className:Ee.dropdownItemContent,children:[u.jsx("span",{className:Ee.dropdownItemLabel,children:h.label}),h.description&&u.jsx("span",{className:Ee.dropdownItemDesc,children:h.description})]}),u.jsx("span",{className:Ee.dropdownItemCheck,children:h.id===n?u.jsx(TSe,{}):null})]}):h.label},h.id))})}function ASe({menu:e,anchorRef:t,panelRef:n,onSelect:s,onAccept:r}){const i=g.useRef([]),[o,a]=g.useState(null),[l,c]=g.useState({}),[d,h]=g.useState(null),f=g.useRef(null);g.useEffect(()=>{var _;(_=i.current[e.selectedIndex])==null||_.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),g.useLayoutEffect(()=>{const _=t.current;if(!_)return;const E=()=>{const M=_.getBoundingClientRect(),R=getComputedStyle(_),L=Object.fromEntries(pSe.map(T=>[T,R.getPropertyValue(T)]));a({left:Math.max(12,Math.min(M.left+16,window.innerWidth-252)),bottom:window.innerHeight-M.top+8,width:M.width}),c(L)};E();const k=new ResizeObserver(E);return k.observe(_),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{k.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[t,e.items]),g.useEffect(()=>{h(null)},[e.items]);const m=_=>Array.from(_).length,p=Math.max(...e.items.map(_=>m(_.label)),0),y=Math.max(...e.items.map(_=>m(_.detail??"")),0),w=y>0,b={"--slash-command-col":`${Math.min(Math.max(p+1,10),24)}ch`,"--slash-desc-col":w?`${Math.min(Math.max(y+1,18),36)}ch`:"0px","--slash-column-gap":w?"2ch":"0px"};if(!o)return null;const v=$5e(e.items,e.kind),x={...b,...l,left:o.left,bottom:o.bottom,"--slash-anchor-width":`${o.width}px`};return Op.createPortal(u.jsxs("div",{ref:n,className:Ee.slashPortalLayer,style:l,children:[u.jsx("div",{className:Ee.slashPanel,style:x,role:"listbox",onMouseDown:_=>_.preventDefault(),onMouseLeave:_=>{var k;const E=_.relatedTarget;E instanceof Node&&((k=f.current)!=null&&k.contains(E))||h(null)},children:u.jsx("div",{className:Ee.slashPanelBody,children:u.jsx("div",{className:Ee.slashList,onScroll:()=>h(null),children:e.items.map((_,E)=>{const k=v[E];return u.jsxs("div",{className:Ee.slashEntry,children:[k.showHeader&&u.jsxs(u.Fragment,{children:[k.showDivider&&u.jsx("div",{className:Ee.slashSection}),u.jsxs("div",{className:Ee.slashSectionHeader,children:[u.jsx("span",{children:_.section}),k.count>0?u.jsx("span",{className:Ee.slashSectionCount,children:k.count}):null]})]}),u.jsxs("button",{ref:M=>{i.current[E]=M},type:"button",role:"option","aria-selected":E===e.selectedIndex,className:`${Ee.slashItem} ${E===e.selectedIndex?Ee.slashItemActive:""}`,onMouseEnter:M=>{if(s(E),!_.detail){h(null);return}const R=M.currentTarget,L=8,T=180,N=R.getBoundingClientRect(),O=Math.min(N.left+Math.min(220,N.width*.34),window.innerWidth-320-12),U=window.innerHeight-N.bottom-L-12,F=N.top-L-12,j=U>=96||U>=F,V=Math.max(72,Math.min(T,j?U:F));h({label:_.label,detail:_.detail,left:Math.max(12,O),...j?{top:N.bottom+L}:{bottom:window.innerHeight-N.top+L},maxHeight:V})},onMouseDown:M=>{M.preventDefault(),M.stopPropagation(),r(E)},children:[u.jsx("span",{className:Ee.slashCommand,children:_.label}),_.detail&&u.jsx("span",{className:Ee.slashDescription,children:_.detail})]})]},`${_.id}:${E}`)})})})}),d&&u.jsxs("div",{ref:f,className:Ee.slashDetail,style:{...l,left:d.left,top:d.top,bottom:d.bottom,maxHeight:d.maxHeight},children:[u.jsx("div",{className:Ee.slashDetailCommand,children:d.label}),u.jsx("div",{className:Ee.slashDetailText,children:d.detail})]})]}),document.body)}function ESe({actions:e,onRun:t,onPressKey:n}){const{t:s}=Xe();return u.jsxs("div",{className:Ee.quickActionsPanel,onMouseDown:r=>r.stopPropagation(),onClick:r=>r.stopPropagation(),children:[u.jsx("div",{className:Ee.quickActionsHeader,children:s("quickActions.title")}),u.jsxs("div",{className:Ee.quickActionsLayout,children:[u.jsx("div",{className:Ee.quickActionsGrid,children:e.map(r=>u.jsx("button",{type:"button",className:Ee.quickAction,onClick:()=>t(r),children:u.jsx("span",{className:Ee.quickActionLabel,children:r.label})},r.id))}),u.jsx("div",{className:Ee.quickKeysGrid,children:SSe.map(r=>u.jsx("button",{type:"button",className:Ee.quickKey,title:s(r.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(r),children:u.jsx("span",{className:Ee.quickKeyLabel,children:r.label})},r.id))})]})]})}const gF=g.memo(g.forwardRef(function(t,n){const{onSubmit:s,onCycleMode:r,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,isPreparing:l=!1,cancelArmed:c=!1,disabled:d=!1,placeholderText:h="Type a message...",commands:f,skills:m=[],slashCommandCategoryOrder:p,queuedMessages:y=[],onPopQueuedMessages:w,currentMode:b="default",currentModel:v="",chatWidthMode:x="1000",showChatWidthToggle:_=!0,chatWidthToggleMin:E,visibleToolbarActions:k,availableModels:M=[],onSelectMode:R,onSelectModel:L,onChatWidthModeChange:T,onFocusFooter:N,dialogOpen:I=!1,followupState:O,onAcceptFollowup:U,onDismissFollowup:F,sessionName:j,composerInput:V,composerInputVersion:ee,atProviders:ce,composerTagIcons:$}=t,J=B3e({onSubmit:s,onCycleMode:r,onToggleShortcuts:i,disabled:d,placeholderText:h,commands:f,skills:m,slashCommandCategoryOrder:p,queuedMessages:y,onPopQueuedMessages:w,currentMode:b,onFocusFooter:N,dialogOpen:I,followupState:O,onAcceptFollowup:U,onDismissFollowup:F,sessionName:j,composerInput:V,composerInputVersion:ee,atProviders:ce,composerTagIcons:$,editorTheme:mSe}),{t:B}=Xe(),{renderComposerToolbarStart:C,renderComposerToolbarEnd:z,renderComposerToolbarRight:X}=vl();g.useImperativeHandle(n,()=>J.handle,[J.handle]);const[ae,be]=g.useState(!1),[fe,ie]=g.useState(!1),[G,q]=g.useState(!1),[le,Se]=g.useState(tN),$e=g.useRef(null),Ae=g.useRef(null),we=g.useRef(null),ct=g.useRef(null),ht=g.useRef(null),[ut,ft]=g.useState(!1),tt=J.slashMenu,qt=J.closeSlashMenu,Ye=J.atMenu,ge=J.closeAtMenu,st=!!tt,ne=!!Ye,ue=J.viewRef;g.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Te=window.matchMedia("(hover: none), (pointer: coarse)"),mt=()=>Se(tN());return mt(),Te.addEventListener("change",mt),()=>Te.removeEventListener("change",mt)},[]),g.useEffect(()=>{le||q(!1)},[le]),g.useEffect(()=>{if(!st&&!ne)return;const Te=mt=>{var oe,_e;const Xt=mt.target,mn=$e.current;Xt instanceof Node&&mn&&!mn.contains(Xt)&&!((oe=Ae.current)!=null&&oe.contains(Xt))&&!((_e=we.current)!=null&&_e.contains(Xt))&&(qt(),ge())};return window.addEventListener("mousedown",Te),window.addEventListener("touchstart",Te),()=>{window.removeEventListener("mousedown",Te),window.removeEventListener("touchstart",Te)}},[ne,st,ge,qt]),g.useEffect(()=>{var Xt;const Te=$e.current,mt=(Xt=ue.current)==null?void 0:Xt.contentDOM;if(!(!Te||!mt))return wSe(Te,mt)},[ue]),g.useEffect(()=>{const Te=$e.current,mt=E;if(!Te||mt===void 0){ft(!1);return}const Xt=()=>{ft(Te.getBoundingClientRect().width>=mt-50)};Xt();const mn=new ResizeObserver(Xt);return mn.observe(Te),()=>mn.disconnect()},[E]);const Re=g.useMemo(()=>Ev.map(Te=>({id:Te,label:CSe(Te,B),description:B(`mode.desc.${Te}`),icon:u.jsx(Uk,{mode:Te})})),[B]),rt=g.useMemo(()=>{if(!k)return null;const Te=k.filter(mt=>fSe.has(mt));return new Set(Te)},[k]),vt=Te=>rt?rt.has(Te):!0,tn=g.useMemo(()=>new Set(f.map(Te=>Te.name.replace(/^\/+/,""))),[f]),jn=g.useCallback(Te=>tn.has(Te),[tn]),ln=g.useMemo(()=>[{id:"new",label:B("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:B("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:B("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:B("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:B("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:B("quickActions.historyQuestion"),action:{type:"key",item:{id:"ctrl-r",label:"Ctrl+R",descriptionKey:"quickKeys.searchHistory",event:{key:"r",code:"KeyR",ctrlKey:!0}}}},{id:"recap",label:B("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:B("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:B("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:B("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:B("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:B("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:B("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:B("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:B("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:B("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:J.shellMode?B("quickActions.exitShellMode"):B("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:B("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Te=>{const mt=kSe(Te);return!mt||jn(mt)}),[J.shellMode,jn,B]),Pn=g.useMemo(()=>M.map(Te=>({id:Te.id,label:Dp(Te.label||Te.id)})),[M]),Qt=g.useCallback(Te=>{R==null||R(Te),be(!1),J.focus()},[R,J]),ve=g.useCallback(Te=>{L==null||L(Te),ie(!1),J.focus()},[L,J]),Be=g.useCallback(Te=>{const mt=J.viewRef.current;mt&&(mt.focus(),mt.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Te,bubbles:!0,cancelable:!0})))},[J]),He=g.useCallback(Te=>{if(q(!1),be(!1),ie(!1),J.closeSlashMenu(),J.closeAtMenu(),Te.action.type==="insert"){J.insertText(Te.action.text,{mode:"replace"});return}if(Te.action.type==="shell"){J.toggleShellMode();return}if(Te.action.type==="key"){Be(Te.action.item.event);return}s(Te.action.command)},[J,Be,s]),Ht=g.useCallback(Te=>{Be(Te.event),Te.id==="ctrl-r"&&q(!1)},[Be]),{searchMode:Yn,searchQuery:Wt,searchMatches:ss,searchActiveIndex:Mt,searchInputRef:Cn,searchUiRef:rn,closeSearch:Ln,handleSearchKeyDown:Xn,handleSearchInput:Nn,handleSearchCompositionEnd:_n}=J.searchState,Os=Te=>{const mt=c8(Te),Xt=u8(Te),mn=Te.kind?"":mt,oe=a8(Te.kind,$);return!mn&&!Xt?u.jsx("span",{className:Ee.tagLabel,children:Te.id}):u.jsxs(u.Fragment,{children:[oe&&u.jsx("span",{className:Ee.tagIcon,style:sf("--composer-tag-icon-url",oe),"aria-hidden":"true"}),mn&&u.jsx("span",{className:Ee.tagLabel,children:mn}),Xt&&u.jsx("span",{className:Ee.tagValue,children:Xt})]})},ks=pF(b,B),Kt=Dp(v),Vn=a&&!J.hasContent;return u.jsxs("div",{className:Ee.editorShell,"data-composer":!0,children:[u.jsxs("div",{ref:$e,className:Ee.container,"data-dac-glow":!0,onClick:()=>{be(!1),ie(!1),q(!1),J.focus()},children:[u.jsx("div",{className:Ee.dacAura,"aria-hidden":"true"}),u.jsx("div",{className:Ee.dacHalo,"aria-hidden":"true"}),Yn&&u.jsxs("div",{ref:rn,className:Ee.searchPanel,onMouseDown:Te=>Te.stopPropagation(),onClick:Te=>Te.stopPropagation(),children:[u.jsxs("div",{className:Ee.searchBar,children:[u.jsx("span",{className:Ee.searchLabel,children:B("editor.searchLabel")}),u.jsx("input",{ref:Cn,className:Ee.searchInput,value:Wt,onChange:Nn,onCompositionEnd:_n,onKeyDown:Xn,placeholder:B("editor.searchPlaceholder")})]}),ss.length>0&&u.jsx("div",{className:Ee.searchResults,children:ss.map((Te,mt)=>u.jsxs("button",{type:"button",className:`${Ee.searchResult} ${mt===Mt?Ee.searchResultActive:""}`,onMouseDown:Xt=>{Xt.preventDefault(),J.replaceEditorText(Te),Ln(!1)},children:[u.jsx("span",{className:Ee.searchResultMarker,children:mt===Mt?"›":""}),u.jsx("span",{className:Ee.searchResultText,children:Te})]},`${Te}-${mt}`))}),ss.length===0&&u.jsx("div",{className:Ee.searchEmpty,children:B("editor.noHistory")})]}),u.jsxs("div",{className:Ee.content,children:[J.composerTags.length>0&&u.jsx("div",{className:Ee.tags,children:J.composerTags.map(Te=>u.jsxs("span",{className:Ee.tag,children:[Os(Te),Te.removable!==!1&&u.jsx("button",{type:"button",className:Ee.tagRemove,"aria-label":`Remove ${hF(Te)}`,onMouseDown:mt=>mt.preventDefault(),onClick:mt=>{var Xt;mt.stopPropagation(),J.removeTopTag(Te.id),(Xt=J.viewRef.current)==null||Xt.focus()},onKeyDown:mt=>{var Xt;mt.key!=="Backspace"&&mt.key!=="Delete"||(mt.preventDefault(),J.removeTopTag(Te.id),(Xt=J.viewRef.current)==null||Xt.focus())},children:"×"})]},Te.id))}),J.pastedImages.length>0&&u.jsx("div",{className:Ee.images,children:J.pastedImages.map((Te,mt)=>u.jsxs("div",{className:Ee.imageThumb,children:[u.jsx("img",{src:`data:${Te.media_type};base64,${Te.data}`,alt:""}),u.jsx("button",{className:Ee.imageRemove,onClick:Xt=>{Xt.stopPropagation(),J.removeImage(mt)},children:"×"})]},mt))}),J.slashMenu&&u.jsx(ASe,{menu:J.slashMenu,anchorRef:$e,panelRef:Ae,onSelect:J.selectSlashCompletion,onAccept:J.acceptSlashCompletion}),J.atMenu&&u.jsx(I5e,{menu:J.atMenu,anchorRef:$e,panelRef:we,onSelect:J.selectAtCompletion,onAccept:J.acceptAtCompletion,onBack:()=>{const Te=J.backAtCategories();return Te==="categories"&&window.setTimeout(()=>J.focus(),0),!!Te},onSearch:J.updateAtSearch}),u.jsxs("div",{className:Ee.editorArea,children:[J.shellMode&&u.jsx("span",{className:Ee.shellPrefix,"aria-hidden":"true",children:"!"}),u.jsx("div",{ref:J.containerRef})]}),u.jsxs("div",{className:Ee.toolbar,children:[u.jsxs("div",{className:Ee.toolbarLeading,children:[C&&u.jsx("div",{className:Ee.toolbarStart,children:u.jsx(C,{disabled:d,isRunning:a,currentMode:b,currentModel:v,sessionName:j})}),u.jsxs("div",{className:Ee.toolbarLeft,children:[vt("approvalMode")&&u.jsxs("div",{className:Ee.dropdownWrapper,children:[u.jsx(sN,{open:ae,items:Re,activeId:b,onClose:()=>be(!1),onSelect:Qt,anchorRef:ct}),u.jsxs("button",{ref:ct,className:Ee.toolBtn,onClick:Te=>{Te.stopPropagation(),J.closeSlashMenu(),J.closeAtMenu(),q(!1),be(mt=>!mt),ie(!1)},"aria-label":B("status.mode"),children:[u.jsx("span",{className:Ee.toolBtnModeIcon,children:u.jsx(Uk,{mode:b})}),u.jsx("span",{className:Ee.toolBtnText,children:ks}),u.jsx("span",{className:Ee.toolBtnArrow,children:u.jsx(nN,{})})]})]}),vt("model")&&u.jsxs("div",{className:Ee.dropdownWrapper,children:[u.jsx(sN,{open:fe,items:Pn,activeId:v,onClose:()=>ie(!1),onSelect:ve,anchorRef:ht,showCheck:!0,maxHeight:300}),u.jsxs("button",{ref:ht,className:Ee.toolBtn,onClick:Te=>{Te.stopPropagation(),J.closeSlashMenu(),J.closeAtMenu(),q(!1),ie(mt=>!mt),be(!1)},"aria-label":B("model.select"),children:[u.jsx("span",{className:Ee.toolBtnModelIcon,children:u.jsx(_Se,{})}),u.jsx("span",{className:Ee.toolBtnText,children:Kt}),u.jsx("span",{className:Ee.toolBtnArrow,children:u.jsx(nN,{})})]})]}),z&&u.jsx("div",{className:Ee.toolbarEnd,children:u.jsx(z,{disabled:d,isRunning:a,currentMode:b,currentModel:v,sessionName:j})})]})]}),u.jsxs("div",{className:Ee.toolbarRight,children:[le&&ln.length>0&&u.jsx("button",{className:`${Ee.toolBtn} ${Ee.quickActionsBtn}`,onClick:Te=>{Te.stopPropagation(),J.closeSlashMenu(),J.closeAtMenu(),be(!1),ie(!1),q(mt=>!mt)},"aria-expanded":G,"aria-label":B("quickActions.open"),title:B("quickActions.open"),"data-tooltip":B("quickActions.open"),children:u.jsx("span",{className:Ee.toolBtnIcon,children:u.jsx(vSe,{})})}),X&&u.jsx("div",{className:Ee.toolbarRightCustom,children:u.jsx(X,{disabled:d,isRunning:a,currentMode:b,currentModel:v,sessionName:j})}),_&&ut&&vt("widthMode")&&u.jsx("button",{className:`${Ee.toolBtn} ${Ee.widthModeBtn}`,onClick:Te=>{Te.stopPropagation(),T==null||T(x==="wide"?"1000":"wide")},disabled:!T,"aria-label":B(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:B(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":B(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:u.jsx("span",{className:Ee.toolBtnIcon,children:u.jsx(xSe,{mode:x})})}),vt("voice")&&u.jsx(dSe,{disabled:d,onInsert:Te=>{const mt=J.getText(),Xt=mt&&!/\s$/.test(mt)?" ":"";J.insertText(`${Xt}${Te} `),J.focus()}}),u.jsx("button",{className:l||Vn?`${Ee.sendBtn} ${Ee.sendBtnRunning}${c?` ${Ee.sendBtnArmed}`:""}`:Ee.sendBtn,disabled:l?!0:Vn?!o:J.disabled||!J.hasContent,onClick:Te=>{if(Te.stopPropagation(),!l){if(Vn){o==null||o();return}J.submitText()}},"aria-label":B(l?"common.loading":Vn?c?"stream.cancelArmed":"stream.cancel":"editor.send"),title:a&&c?B("stream.cancelArmed"):void 0,children:l?u.jsx(bSe,{}):Vn?c?u.jsx("span",{className:Ee.escLabel,"aria-hidden":"true",children:"Esc"}):u.jsx(ySe,{}):u.jsx(gSe,{})}),u.jsx("span",{role:"status","aria-live":"polite",className:Ee.srOnly,children:a&&c?B("stream.cancelArmed"):""})]})]})]})]}),le&&G&&ln.length>0&&u.jsx(ESe,{actions:ln,onRun:He,onPressKey:Ht})]})})),MSe="_bar_agzxl_1",NSe="_left_agzxl_12",ISe="_right_agzxl_13",jSe="_settingsButton_agzxl_23",RSe="_modeButton_agzxl_49",LSe="_modeHint_agzxl_62",DSe="_modeLabel_agzxl_67",OSe="_modeDefault_agzxl_71",BSe="_modePlan_agzxl_75",PSe="_modeAutoEdit_agzxl_79",$Se="_modeAuto_agzxl_79",zSe="_modeYolo_agzxl_87",FSe="_shortcutsButton_agzxl_96",qSe="_modelButton_agzxl_114",HSe="_model_agzxl_114",USe="_contextButton_agzxl_138",VSe="_context_agzxl_138",WSe="_goal_agzxl_161",GSe="_separator_agzxl_167",KSe="_taskPill_agzxl_171",br={bar:MSe,left:NSe,right:ISe,settingsButton:jSe,modeButton:RSe,modeHint:LSe,modeLabel:DSe,modeDefault:OSe,modePlan:BSe,modeAutoEdit:PSe,modeAuto:$Se,modeYolo:zSe,shortcutsButton:FSe,modelButton:qSe,model:HSe,contextButton:USe,context:VSe,goal:WSe,separator:GSe,taskPill:KSe},YSe=1e3;function QSe(e,t){switch(e){case"default":return{label:t("mode.default"),className:br.modeDefault};case"plan":return{label:t("mode.plan"),className:br.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:br.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:br.modeAuto};case"yolo":return{label:t("mode.yolo"),className:br.modeYolo};default:return null}}function XSe(){return u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function g4(e,t,n,s){return s(e===1?t:n,{count:e})}function JSe(e,t){if(e.length===0)return"";const n=e.filter(r=>r.status==="running");if(n.length>0){const r={agent:0,shell:0,monitor:0};for(const o of n)r[o.kind]++;const i=[];return r.shell>0&&i.push(g4(r.shell,"tasks.pill.shell","tasks.pill.shells",t)),r.agent>0&&i.push(g4(r.agent,"tasks.pill.agent","tasks.pill.agents",t)),r.monitor>0&&i.push(g4(r.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}const s=e.filter(r=>r.kind==="agent"&&r.status==="paused");return s.length>0?t(s.length===1?"tasks.pill.agentPaused":"tasks.pill.agentsPaused",{count:s.length}):t(e.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:e.length})}function ZSe(e){if(e<1e3)return"";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}const e6e=g.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:s,onOpenSettings:r,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:l,hideSettings:c,onToggleShortcuts:d,compact:h=!1},f){const m=ha(),p=m.status==="connected",y=m.currentModel??"",w=m.currentMode??"",b=m.tokenCount??0,v=m.contextWindow??0,{t:x}=Xe(),E=(v>0?b/v*100:0).toFixed(1),k=QSe(w,x),[,M]=g.useState(0),R=g.useRef(null);g.useEffect(()=>{if(!l)return;const j=setInterval(()=>M(V=>(V+1)%1e6),YSe);return()=>clearInterval(j)},[l]);const L=g.useMemo(()=>JSe(a,x),[a,x]),T=!h&&(p||!!k),N=l?ZSe(Date.now()-l.setAt):"",I=l?`◎ ${x("goal.statusActive")}${N?` (${N})`:""}`:"",O=!!L||!h,U=!h&&!!y||!h&&v>0&&b>0||!!I;if(g.useImperativeHandle(f,()=>({focusTaskPill(){var j;return L?((j=R.current)==null||j.focus({preventScroll:!0}),!0):!1}}),[L]),!O&&!U)return null;const F=j=>{if(j.key==="Enter"||j.key==="ArrowDown"||j.key==="n"&&j.ctrlKey){j.preventDefault(),j.stopPropagation(),i==null||i();return}if(j.key==="ArrowUp"||j.key==="Escape"||j.key==="p"&&j.ctrlKey){j.preventDefault(),j.stopPropagation(),o==null||o();return}j.key.length===1&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&(j.preventDefault(),j.stopPropagation(),o==null||o(j.key))};return u.jsxs("div",{className:br.bar,children:[u.jsxs("div",{className:br.left,children:[p&&!c&&!h&&u.jsx("button",{type:"button",className:br.settingsButton,onClick:r,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:x("settings.title"),"aria-label":x("settings.title"),"aria-haspopup":"dialog",children:u.jsx(XSe,{})}),k&&!h&&u.jsxs("button",{type:"button",className:br.modeButton,onClick:t,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:x("mode.select"),"aria-haspopup":"listbox",children:[u.jsx("span",{className:`${br.modeLabel} ${k.className}`,children:k.label}),!h&&u.jsx("span",{className:br.modeHint,children:x("status.modeHint")})]}),!h&&u.jsx(u.Fragment,{children:d?u.jsx("button",{type:"button",className:br.shortcutsButton,onClick:d,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),"aria-haspopup":"dialog","aria-label":x("status.shortcuts"),children:x("status.shortcuts")}):u.jsx("span",{children:x("status.shortcuts")})}),L&&u.jsxs(u.Fragment,{children:[T&&u.jsx("span",{className:br.separator,children:"·"}),u.jsx("button",{ref:R,type:"button",className:br.taskPill,onClick:i,onKeyDown:F,disabled:!i,children:L})]})]}),u.jsxs("div",{className:br.right,children:[!h&&y&&u.jsx("button",{type:"button",className:br.modelButton,onClick:n,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:x("model.select"),"aria-haspopup":"listbox",children:u.jsx("span",{className:br.model,children:y})}),!h&&v>0&&b>0&&u.jsx("button",{type:"button",className:br.contextButton,onClick:s,title:x("contextUsage.title"),children:u.jsx("span",{className:br.context,children:x("status.contextUsed",{pct:E})})}),I&&u.jsx("span",{className:br.goal,title:l==null?void 0:l.condition,children:I})]})]})}),t6e=15e3,n6e=["I'm Feeling Lucky","Shipping awesomeness... ","Painting the serifs back on...","Consulting the digital spirits...","Reticulating splines...","Generating witty retort...","Polishing the algorithms...","Don't rush perfection (or my code)...","Brewing fresh bytes...","Counting electrons...","Engaging cognitive processors...","Checking for syntax errors in the universe...","One moment, optimizing humor...","Untangling neural nets...","Compiling brilliance...","Loading wit.exe...","Preparing a witty response...","Just a sec, I'm debugging reality...","Crafting a response worthy of your patience...","Resolving dependencies... and existential crises...","Garbage collecting... be right back...","Converting coffee into code...","Looking for a misplaced semicolon...","Pre-heating the servers...","Loading the next great idea...","Just a moment, I'm in the zone...","Hold tight, I'm crafting a masterpiece...","Warp speed engaged...","Don't panic...","Following the white rabbit...","The truth is in here... somewhere...","Loading... Do a barrel roll!","Finding a suitable loading screen pun...","Distracting you with this witty phrase...","Almost there... probably...","Hmmm... let me think...","That's not a bug, it's an undocumented feature...","Engage.","I'll be back... with an answer.","Letting the thoughts marinate...","Initiating thoughtful gaze...","Dividing by zero... just kidding!","Buffering... because even AIs need a moment.","Entangling quantum particles for a faster response...","Recalibrating the humor-o-meter.","Enhancing... Enhancing... Still loading.","Have you tried turning it off and on again? (The loading screen, not me.)","Constructing additional pylons...","New line? That's Ctrl+J."],s6e=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function rN(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?s6e:n6e}function r6e(){const e=Iv(),t=Qp(),n=e!=="idle",s=g.useRef(0),r=g.useRef(0),[i,o]=g.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=g.useMemo(()=>{let c=0,d=0,h=!1;const f=new Set;let m=-1;for(let p=t.length-1;p>=0;p--)if(t[p].kind==="user"){m=p;break}for(let p=m+1;p<t.length;p++){const y=t[p];if(y.kind==="assistant"&&!y.parentToolCallId&&(c+=y.text.length,y.streaming&&(h=!0)),y.kind==="tool"&&!y.parentToolCallId){if(y.rawInput!==void 0)try{c+=JSON.stringify(y.rawInput).length}catch{}const w=i6e(y.rawOutput);w!==void 0&&!f.has(y.toolCallId)&&(d+=w,f.add(y.toolCallId))}}return{chars:c,agentTokens:d,isReceiving:h}},[t]),l=g.useRef(a);return l.current=a,a.chars<r.current&&(s.current=a.chars),r.current=a.chars,g.useEffect(()=>{if(!n){s.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:d,agentTokens:h,isReceiving:f}=l.current;if(d<s.current){s.current=d,o({estimatedOutputTokens:h+Math.round(d/4),isReceivingContent:f});return}const m=d-s.current;if(m<=0){o(w=>{const b={estimatedOutputTokens:h+Math.round(s.current/4),isReceivingContent:f};return w.estimatedOutputTokens===b.estimatedOutputTokens&&w.isReceivingContent===b.isReceivingContent?w:b});return}let p;m<70?p=3:m<=200?p=Math.max(3,Math.round(m*.2)):p=50;const y=Math.min(s.current+p,d);s.current=y,o({estimatedOutputTokens:h+Math.round(y/4),isReceivingContent:f})},100);return()=>clearInterval(c)},[n]),i}function i6e(e){if(typeof e!="object"||e===null||!("type"in e)||e.type!=="task_execution")return;const t=e,n=t.tokenCount;if(typeof n=="number"&&n>0)return n;const s=t.executionSummary;if(typeof s=="object"&&s!==null){const r=s.outputTokens;if(typeof r=="number"&&r>0)return r}}function o6e(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function rf(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const a6e="_status_zld2v_1",l6e="_spinner_zld2v_11",c6e="_label_zld2v_15",u6e="_meta_zld2v_19",R1={status:a6e,spinner:l6e,label:c6e,meta:u6e},y4=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function yF({startedAt:e,showPhrase:t=!0}){const n=Iv(),{estimatedOutputTokens:s,isReceivingContent:r}=r6e(),{language:i,t:o}=Xe(),{loadingPhrases:a}=vl(),l=g.useRef(a);l.current=a;const c=g.useCallback(k=>{var M;try{return((M=l.current)==null?void 0:M.call(l,k))??rN(k)}catch(R){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",R),rN(k)}},[]),[d,h]=g.useState(0),f=g.useRef(Date.now()),[m,p]=g.useState(0),[y,w]=g.useState(()=>c(i)[0]??""),b=n!=="idle";if(g.useEffect(()=>{if(!b){h(0);return}f.current=e??Date.now(),h(iN(f.current));const k=setInterval(()=>{h(iN(f.current))},1e3);return()=>clearInterval(k)},[b,e]),g.useEffect(()=>{if(!t)return;if(n==="idle"){w(c(i)[0]??"");return}const k=()=>{const R=c(i),L=Math.floor(Math.random()*R.length);w(R[L]??"")};k();const M=setInterval(k,t6e);return()=>clearInterval(M)},[i,n,c,t]),g.useEffect(()=>{if(n==="idle")return;const k=setInterval(()=>{p(M=>(M+1)%y4.length)},250);return()=>clearInterval(k)},[n]),n==="idle")return null;const v=y4[m%y4.length],x=r?"↓":"↑",_=d<60?`${d}s`:d6e(d*1e3),E=s>0?` · ${x} ${o("stream.tokens",{count:o6e(s)})}`:"";return u.jsxs("div",{className:R1.status,children:[u.jsx("span",{className:R1.spinner,children:v}),t&&y&&u.jsx("span",{className:R1.label,children:y}),u.jsxs("span",{className:R1.meta,children:["(",_,E," · ",o("stream.cancel"),")"]})]})}function d6e(e){if(e<=0)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/3600),s=Math.floor(t%3600/60),r=t%60,i=[];return n>0&&i.push(`${n}h`),s>0&&i.push(`${s}m`),r>0&&i.push(`${r}s`),i.length>0?i.join(" "):"0s"}function iN(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const h6e="_host_1scjy_1",f6e="_toast_1scjy_13",m6e="_message_1scjy_31",p6e="_close_1scjy_39",g6e="_info_1scjy_58",y6e="_success_1scjy_62",b6e="_warning_1scjy_66",v6e="_error_1scjy_70",u0={host:h6e,toast:f6e,message:m6e,close:p6e,info:g6e,success:y6e,warning:b6e,error:v6e};function w6e({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:u.jsx("div",{className:u0.host,role:"status","aria-live":"polite",children:e.map(s=>u.jsx(x6e,{toast:s,onDismiss:t,autoDismissMs:n},s.id))})}function x6e({toast:e,onDismiss:t,autoDismissMs:n}){const{t:s}=Xe();return g.useEffect(()=>{const r=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(r)},[n,t,e.id]),u.jsxs("div",{className:`${u0.toast} ${u0[e.tone]}`,children:[u.jsx("div",{className:u0.message,children:e.message}),u.jsx("button",{type:"button",className:u0.close,onClick:()=>t(e.id),"aria-label":s("toast.dismiss"),title:s("toast.dismissShort"),children:"x"})]})}const _6e="_panel_k9l9d_1",k6e="_summary_k9l9d_10",S6e="_progressRing_k9l9d_27",T6e="_stepText_k9l9d_41",C6e="_fullText_k9l9d_48",A6e="_compactText_k9l9d_52",E6e="_detail_k9l9d_71",M6e="_item_k9l9d_103",N6e="_icon_k9l9d_113",I6e="_content_k9l9d_121",j6e="_completed_k9l9d_129",R6e="_inProgress_k9l9d_134",L6e="_pending_k9l9d_140",go={panel:_6e,summary:k6e,progressRing:S6e,stepText:T6e,fullText:C6e,compactText:A6e,detail:E6e,item:M6e,icon:N6e,content:I6e,completed:j6e,inProgress:R6e,pending:L6e};function D6e(e){switch(e){case"completed":return go.completed;case"in_progress":return go.inProgress;case"pending":return go.pending}}const O6e=g.memo(function({todos:t,title:n}){const{t:s}=Xe();if(t.length===0)return null;const r=t.length,i=t.findIndex(c=>c.status==="in_progress"),o=i>=0?i:t.findIndex(c=>c.status==="pending"),a=o>=0?o+1:r,l=r>0?a/r:0;return u.jsxs("section",{className:go.panel,"aria-label":n??s("todo.title"),tabIndex:0,children:[u.jsxs("div",{className:go.summary,"aria-label":s("todo.stepProgress",{current:a,total:r}),children:[u.jsx("span",{className:go.progressRing,style:{"--todo-progress":String(l)},"aria-hidden":"true"}),u.jsxs("span",{className:go.stepText,children:[u.jsx("span",{className:go.fullText,children:s("todo.stepProgress",{current:a,total:r})}),u.jsx("span",{className:go.compactText,children:s("todo.stepFraction",{current:a,total:r})})]})]}),u.jsx("div",{className:go.detail,role:"tooltip",children:t.map((c,d)=>u.jsxs("div",{className:`${go.item} ${D6e(c.status)}`,children:[u.jsx("span",{className:go.icon,"aria-hidden":"true",children:Lb(c.status)}),u.jsx("span",{className:go.content,title:c.content,children:c.content})]},`${c.id||d}:${c.content}`))})]})}),B6e="_header_leiy3_1",P6e="_titleRow_leiy3_11",$6e="_title_leiy3_11",z6e="_subtitle_leiy3_31",L1={header:B6e,titleRow:P6e,title:$6e,subtitle:z6e};function F6e(e){const{t}=Xe();return u.jsxs("div",{className:L1.header,children:[u.jsxs("div",{className:L1.titleRow,children:[u.jsx("span",{children:t("welcome.titlePrefix")}),u.jsx("span",{className:L1.title,children:"Qwen Code"})]}),u.jsx("div",{className:L1.subtitle,children:t("welcome.prompt")})]})}const q6e="_themeDark_11y3q_1",H6e="_themeLight_11y3q_25",U6e="_backdrop_11y3q_47",V6e="_panel_11y3q_67",W6e="_sizeSm_11y3q_85",G6e="_sizeMd_11y3q_89",K6e="_sizeLg_11y3q_93",Y6e="_sizeXl_11y3q_97",Q6e="_header_11y3q_101",X6e="_titleWrap_11y3q_110",J6e="_title_11y3q_110",Z6e="_subtitle_11y3q_122",e8e="_close_11y3q_129",t8e="_iconButton_11y3q_170",n8e="_body_11y3q_10",s8e="_panelFullscreen_11y3q_202",mi={themeDark:q6e,themeLight:H6e,backdrop:U6e,panel:V6e,sizeSm:W6e,sizeMd:G6e,sizeLg:K6e,sizeXl:Y6e,header:Q6e,titleWrap:X6e,title:J6e,subtitle:Z6e,close:e8e,iconButton:t8e,body:n8e,panelFullscreen:s8e},r8e={sm:mi.sizeSm,md:mi.sizeMd,lg:mi.sizeLg,xl:mi.sizeXl},i8e=["a[href]:not([hidden])","button:not([disabled]):not([hidden])","input:not([disabled]):not([hidden])","select:not([disabled]):not([hidden])","textarea:not([disabled]):not([hidden])",'[tabindex]:not([tabindex="-1"]):not([hidden])'].join(",");function b4(e){return e?Array.from(e.querySelectorAll(i8e)):[]}const Uc=[],bF=g.createContext(null);function o8e(e){return e===null?!0:Uc[Uc.length-1]===e}function Mr({title:e,subtitle:t,size:n="md",allowFullscreen:s=!1,onClose:r,children:i}){const{t:o}=Xe(),[a,l]=g.useState(!1),d=Rv()===yi.Light?mi.themeLight:mi.themeDark,h=g.useRef(null),f=g.useRef(r);f.current=r;const[m]=g.useState(()=>typeof document<"u"?document.activeElement:null),p=g.useRef(!1),y=g.useRef(!1),w=g.useRef(null);w.current===null&&(w.current={}),g.useEffect(()=>{const E=h.current,k=w.current;Uc.push(k),E&&!E.contains(document.activeElement)&&(b4(E).find(T=>!T.hasAttribute("data-dialog-close"))??E).focus();const M=R=>{var L;if(Uc[Uc.length-1]===k&&!R.defaultPrevented&&!(R.isComposing||R.keyCode===229)){if(R.key==="Escape"){R.preventDefault(),R.stopPropagation(),f.current();return}if(R.key==="Tab"){const T=b4(h.current);if(T.length===0){R.preventDefault(),(L=h.current)==null||L.focus();return}const N=T[0],I=T[T.length-1],O=document.activeElement;T.includes(O)?R.shiftKey&&O===N?(R.preventDefault(),I.focus()):!R.shiftKey&&O===I&&(R.preventDefault(),N.focus()):(R.preventDefault(),(R.shiftKey?I:N).focus())}}};return document.addEventListener("keydown",M),()=>{var O,U,F;document.removeEventListener("keydown",M);const R=Uc.indexOf(k);if(R>=0&&Uc.splice(R,1),Uc.length===0){(O=m==null?void 0:m.focus)==null||O.call(m);return}const L=Array.from(document.querySelectorAll("[data-keyboard-scope]")),T=(U=L[L.length-1])==null?void 0:U.querySelector('[role="dialog"]');(F=b4(T).find(j=>!j.hasAttribute("data-dialog-close"))??T)==null||F.focus()}},[m]);const b=E=>{p.current=E.target===E.currentTarget,y.current=!1},v=E=>{y.current=E.target===E.currentTarget},x=E=>{const k=p.current&&y.current&&E.target===E.currentTarget;p.current=!1,y.current=!1,k&&r()},_=u.jsx("div",{className:`${mi.backdrop} ${d}`,"data-keyboard-scope":!0,onMouseDown:b,onMouseUp:v,onClick:x,children:u.jsx(bF.Provider,{value:w.current,children:u.jsxs("section",{ref:h,className:`${mi.panel} ${a?mi.panelFullscreen:r8e[n]}`,role:"dialog","aria-modal":"true","aria-label":e,tabIndex:-1,children:[u.jsxs("header",{className:mi.header,children:[u.jsxs("div",{className:mi.titleWrap,children:[u.jsx("div",{className:mi.title,children:e}),t&&u.jsx("div",{className:mi.subtitle,children:t})]}),s&&u.jsx("button",{type:"button",className:mi.iconButton,onClick:()=>l(E=>!E),"aria-label":o(a?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":a,title:o(a?"common.exitFullscreen":"common.fullscreen"),children:u.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a?u.jsx("path",{d:"M6 2v4H2M14 6h-4V2M6 14v-4H2M14 10h-4v4"}):u.jsx("path",{d:"M2 6V2h4M10 2h4v4M2 10v4h4M10 14h4v-4"})})}),u.jsx("button",{type:"button",className:mi.close,onClick:r,"aria-label":o("common.close"),title:o("common.close"),"data-dialog-close":!0})]}),u.jsx("div",{className:mi.body,"data-dialog-fullscreen":a?"":void 0,children:i})]})})});return typeof document>"u"?_:Op.createPortal(_,document.body)}function D1(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const a8e=new Set(["button","submit","reset"]),l8e=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function oN(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;if(t==="BUTTON"||t==="A"||t==="TEXTAREA")return!0;if(t==="INPUT")return a8e.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function v4(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!l8e.has(e.type):e.isContentEditable===!0}function Uu({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s,enabled:r=!0}){const i=g.useContext(bF),o=g.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:s};const[a,l]=g.useState(!1);return g.useEffect(()=>{if(!r)return;const c=()=>l(!0),d=()=>l(!1),h=f=>{if(!o8e(i)||f.defaultPrevented||f.isComposing||f.keyCode===229||f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;const{itemCount:m,activeIndex:p}=o.current;if(!(m<=0))switch(f.key){case"ArrowDown":f.preventDefault(),c(),o.current.onActiveIndexChange(D1(p+1,m));break;case"ArrowUp":f.preventDefault(),c(),o.current.onActiveIndexChange(D1(p-1,m));break;case"Home":if(v4())return;f.preventDefault(),c(),o.current.onActiveIndexChange(0);break;case"End":if(v4())return;f.preventDefault(),c(),o.current.onActiveIndexChange(m-1);break;case"Enter":{if(oN()||p<0)return;f.preventDefault(),o.current.onConfirm(D1(p,m));break}case" ":{if(oN()||v4()||p<0)return;f.preventDefault(),o.current.onConfirm(D1(p,m));break}}};return window.addEventListener("keydown",h),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",h),window.removeEventListener("mousemove",d)}},[i,r]),{keyboardMode:a}}const c8e="_picker_5cmbf_4",u8e="_selected_5cmbf_98",d8e="_disabled_5cmbf_114",h8e={picker:c8e,"picker-in-shell":"_picker-in-shell_5cmbf_15","picker-search":"_picker-search_5cmbf_22","picker-search-label":"_picker-search-label_5cmbf_31","picker-search-input":"_picker-search-input_5cmbf_35","picker-search-hint":"_picker-search-hint_5cmbf_45","picker-sep":"_picker-sep_5cmbf_49","picker-list":"_picker-list_5cmbf_54","picker-list-compact":"_picker-list-compact_5cmbf_67","picker-empty":"_picker-empty_5cmbf_71","picker-item":"_picker-item_5cmbf_77","picker-session-item":"_picker-session-item_5cmbf_93",selected:u8e,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:d8e,"picker-item-row":"_picker-item-row_5cmbf_119","picker-item-title":"_picker-item-title_5cmbf_128","picker-item-checkbox":"_picker-item-checkbox_5cmbf_139","picker-item-checkbox-checked":"_picker-item-checkbox-checked_5cmbf_153","picker-item-meta":"_picker-item-meta_5cmbf_163","picker-item-detail":"_picker-item-detail_5cmbf_171","dialog-current":"_dialog-current_5cmbf_185","picker-item-confirmed":"_picker-item-confirmed_5cmbf_186","picker-item-badge":"_picker-item-badge_5cmbf_217","tools-status-badge":"_tools-status-badge_5cmbf_226","tools-status-badge-enabled":"_tools-status-badge-enabled_5cmbf_237","tools-status-badge-disabled":"_tools-status-badge-disabled_5cmbf_241","tools-status-badge-busy":"_tools-status-badge-busy_5cmbf_245","tools-picker-item":"_tools-picker-item_5cmbf_249","tools-picker-item-expanded":"_tools-picker-item-expanded_5cmbf_260","tools-item-icon":"_tools-item-icon_5cmbf_264","tools-item-chevron":"_tools-item-chevron_5cmbf_296","tools-item-chevron-expanded":"_tools-item-chevron-expanded_5cmbf_308","tools-item-detail":"_tools-item-detail_5cmbf_312","mcp-status":"_mcp-status_5cmbf_317","mcp-status-connected":"_mcp-status-connected_5cmbf_321","mcp-status-connecting":"_mcp-status-connecting_5cmbf_325","mcp-status-disconnected":"_mcp-status-disconnected_5cmbf_329","mcp-status-disabled":"_mcp-status-disabled_5cmbf_333","mcp-status-unknown":"_mcp-status-unknown_5cmbf_334","dialog-inline-button":"_dialog-inline-button_5cmbf_338","dialog-primary-button":"_dialog-primary-button_5cmbf_339","dialog-danger-button":"_dialog-danger-button_5cmbf_340","dialog-inline-actions":"_dialog-inline-actions_5cmbf_363","dialog-footer-actions":"_dialog-footer-actions_5cmbf_369","dialog-form":"_dialog-form_5cmbf_387","dialog-form-row":"_dialog-form-row_5cmbf_415","dialog-textarea":"_dialog-textarea_5cmbf_421","dialog-split":"_dialog-split_5cmbf_426","dialog-split-list":"_dialog-split-list_5cmbf_433","tools-desc-expanded":"_tools-desc-expanded_5cmbf_437","tools-desc-body":"_tools-desc-body_5cmbf_447","extensions-toolbar":"_extensions-toolbar_5cmbf_454","extensions-row-button":"_extensions-row-button_5cmbf_458","extensions-detail":"_extensions-detail_5cmbf_473","extensions-detail-actions":"_extensions-detail-actions_5cmbf_484","extensions-detail-grid":"_extensions-detail-grid_5cmbf_491","extensions-detail-field":"_extensions-detail-field_5cmbf_497","extensions-detail-label":"_extensions-detail-label_5cmbf_504","extensions-detail-value":"_extensions-detail-value_5cmbf_510","extensions-confirm":"_extensions-confirm_5cmbf_517","dialog-detail":"_dialog-detail_5cmbf_527","dialog-detail-title":"_dialog-detail-title_5cmbf_535","dialog-detail-shortcut":"_dialog-detail-shortcut_5cmbf_543","dialog-detail-meta":"_dialog-detail-meta_5cmbf_550","dialog-detail-body":"_dialog-detail-body_5cmbf_555"};function Pe(...e){return e.filter(t=>!!t).map(t=>h8e[t]).filter(Boolean).join(" ")}const f8e="_list_jbgdx_1",m8e="_row_jbgdx_16",p8e="_selected_jbgdx_32",g8e="_keyboardOnly_jbgdx_39",y8e="_modeName_jbgdx_47",b8e="_modeIcon_jbgdx_51",v8e="_modeText_jbgdx_67",w8e="_modeDesc_jbgdx_83",Lc={list:f8e,row:m8e,selected:p8e,keyboardOnly:g8e,modeName:y8e,modeIcon:b8e,modeText:v8e,modeDesc:w8e};function x8e({currentMode:e,onSelect:t}){const{t:n}=Xe(),s=g.useRef(null),r=Ev.map(f=>({id:f,name:n(`mode.listLabel.${f}`),description:n(`mode.desc.${f}`)})),i=r.findIndex(f=>f.id===e),[o,a]=g.useState(i>=0?i:0),l=g.useRef(!1);g.useEffect(()=>{l.current||i<0||a(i)},[i]);const c=f=>{l.current=!0,a(f)},d=f=>{const m=r[f];m&&t(m.id)},{keyboardMode:h}=Uu({itemCount:r.length,activeIndex:o,onActiveIndexChange:c,onConfirm:d});return g.useEffect(()=>{var m;const f=(m=s.current)==null?void 0:m.children[o];f==null||f.scrollIntoView({block:"nearest"})},[o]),u.jsx("div",{className:`${Lc.list} ${h?Lc.keyboardOnly:""}`,ref:s,role:"listbox",tabIndex:0,"aria-activedescendant":r.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),children:r.map((f,m)=>{const p=m===o,y=f.id===e;return u.jsxs("div",{id:`mode-opt-${m}`,role:"option","aria-selected":y,className:`${Lc.row} ${p?Lc.selected:""} ${y?Pe("dialog-current"):""}`,onClick:()=>d(m),onMouseMove:()=>c(m),children:[u.jsx("span",{className:Lc.modeIcon,children:u.jsx(Uk,{mode:f.id})}),u.jsxs("span",{className:Lc.modeText,children:[u.jsx("span",{className:Lc.modeName,children:f.name}),u.jsx("span",{className:Lc.modeDesc,children:f.description})]})]},f.id)})})}function kw(e){const[t,n]=g.useState(""),[s,r]=g.useState(""),i=g.useRef(!1),o=g.useRef(""),a=g.useRef(e);a.current=e;const l=g.useCallback(f=>{var m;f!==o.current&&(o.current=f,r(f),(m=a.current)==null||m.call(a,f))},[]),c=g.useCallback(f=>{const m=f.target.value;n(m),i.current||l(m)},[l]),d=g.useCallback(()=>{i.current=!0},[]),h=g.useCallback(f=>{i.current=!1;const m=f.currentTarget.value;n(m),l(m)},[l]);return{filterValue:s,inputProps:{value:t,onChange:c,onCompositionStart:d,onCompositionEnd:h}}}function h8(e,t){const n=Date.now()-new Date(e).getTime(),s=Math.floor(n/6e4);if(s<1)return t("time.justNow");if(s<60)return t("time.minutesAgo",{count:s});const r=Math.floor(s/60);if(r<24)return t("time.hoursAgo",{count:r});const i=Math.floor(r/24);return i<7?t("time.daysAgo",{count:i}):new Date(e).toLocaleDateString()}function f8({session:e,active:t,current:n,confirmed:s,disabled:r,currentLabel:i,optionId:o,ariaSelected:a,leading:l,trailing:c,onClick:d,onActivate:h}){const{t:f}=Xe(),m=e.updatedAt||e.createdAt;return u.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":r||void 0,className:Pe("picker-item","picker-session-item",t?"selected":void 0,n?"dialog-current":void 0,s?"picker-item-confirmed":void 0,r?"disabled":void 0),title:n?i:void 0,onClick:d,onMouseMove:h,children:[u.jsxs("div",{className:Pe("picker-item-row"),children:[l,u.jsx("span",{className:Pe("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),c]}),u.jsxs("div",{className:Pe("picker-item-meta"),children:[u.jsx("span",{children:m&&h8(m,f)}),u.jsx("span",{className:Pe("picker-item-detail"),children:f("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&u.jsx("span",{className:Pe("picker-item-detail"),children:f("resume.activePrompt")})]})]})}const Vk="resume-session-list",aN=e=>`${Vk}-opt-${e}`;function _8e({onSelect:e,onClose:t}){const{t:n}=Xe(),s=ha(),{sessions:r,loading:i,error:o}=qd({autoLoad:!0}),a=s.sessionId,[l,c]=g.useState(-1),{filterValue:d,inputProps:h}=kw(()=>c(-1)),f=g.useRef(null),m=g.useRef(null),p=d?r.filter(b=>{const v=d.toLowerCase();return(b.displayName||"").toLowerCase().includes(v)||b.sessionId.toLowerCase().includes(v)}):r;g.useEffect(()=>{l>=p.length&&p.length>0&&c(p.length-1)},[p.length,l]),g.useEffect(()=>{var v;const b=(v=f.current)==null?void 0:v.children[l];b==null||b.scrollIntoView({block:"nearest"})},[l]);const y=b=>{const v=p[b];v&&(e(v.sessionId),t())},{keyboardMode:w}=Uu({itemCount:p.length,activeIndex:l,onActiveIndexChange:c,onConfirm:y});return g.useEffect(()=>{var b;(b=m.current)==null||b.focus()},[]),u.jsxs("div",{className:Pe("picker","picker-in-shell"),children:[u.jsxs("div",{className:Pe("picker-search"),children:[u.jsxs("span",{className:Pe("picker-search-label"),children:[n("resume.search"),":"," "]}),u.jsx("input",{ref:m,className:Pe("picker-search-input"),"aria-label":n("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":Vk,"aria-activedescendant":l>=0&&l<p.length?aN(l):void 0,...h,placeholder:""})]}),u.jsx("div",{className:Pe("picker-sep")}),u.jsxs("div",{id:Vk,role:"listbox",className:Pe("picker-list",w?"picker-keyboard-only":void 0),ref:f,children:[i&&u.jsx("div",{className:Pe("picker-empty"),children:n("common.loading")}),!i&&o&&u.jsx("div",{className:Pe("picker-empty"),children:o.message||n("resume.failedToLoad")}),!i&&!o&&p.length===0&&u.jsx("div",{className:Pe("picker-empty"),children:d?n("resume.noMatch",{query:d}):n("resume.none")}),!i&&p.map((b,v)=>u.jsx(f8,{session:b,optionId:aN(v),active:v===l,current:b.sessionId===a,currentLabel:n("resume.current"),onClick:()=>y(v),onActivate:()=>c(v)},b.sessionId))]})]})}const k8e="_layout_1sigx_1",S8e="_list_1sigx_9",T8e="_row_1sigx_23",C8e="_selected_1sigx_39",A8e="_keyboardOnly_1sigx_46",E8e="_label_1sigx_54",M8e="_divider_1sigx_58",N8e="_number_1sigx_65",I8e="_provider_1sigx_71",j8e="_badge_1sigx_86",R8e="_detail_1sigx_92",L8e="_detailRow_1sigx_104",D8e="_detailLabel_1sigx_111",O8e="_detailValue_1sigx_117",B8e="_empty_1sigx_122",ji={layout:k8e,list:S8e,row:T8e,selected:C8e,keyboardOnly:A8e,label:E8e,divider:M8e,number:N8e,provider:I8e,badge:j8e,detail:R8e,detailRow:L8e,detailLabel:D8e,detailValue:O8e,empty:B8e};function P8e(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function $8e(e,t){if(!e)return t("model.modality.textOnly");const n=[];return e.image&&n.push(t("model.modality.image")),e.pdf&&n.push(t("model.modality.pdf")),e.audio&&n.push(t("model.modality.audio")),e.video&&n.push(t("model.modality.video")),n.length===0?t("model.modality.textOnly"):`${t("model.modality.text")} · ${n.join(" · ")}`}function lN(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function z8e(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function F8e(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function q8e(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function O1({label:e,value:t}){return u.jsxs("div",{className:ji.detailRow,children:[u.jsx("span",{className:ji.detailLabel,children:e}),u.jsx("span",{className:ji.detailValue,children:t})]})}function H8e({mode:e="main",onSelect:t,models:n,currentModelId:s}){const r=ha(),i=s??r.currentModel??"",o=g.useMemo(()=>n??r.models??[],[n,r.models]),{t:a}=Xe(),l=g.useRef(null),c=e==="fast",d=e==="voice",h=e==="vision",f=o.findIndex(_=>_.id===i),[m,p]=g.useState(f>=0?f:0),y=g.useRef(!1);g.useEffect(()=>{y.current||o.length===0||p(f>=0?f:0)},[o.length,f]);const w=_=>{y.current=!0,p(_)};g.useEffect(()=>{m>=o.length&&o.length>0&&p(o.length-1)},[o.length,m]);const b=o[m]??o[0],v=_=>{const E=o[_];E&&t(q8e(E,c))},{keyboardMode:x}=Uu({itemCount:o.length,activeIndex:m,onActiveIndexChange:w,onConfirm:v});return g.useEffect(()=>{var E;const _=(E=l.current)==null?void 0:E.children[m];_==null||_.scrollIntoView({block:"nearest"})},[m]),u.jsxs("div",{className:ji.layout,children:[u.jsxs("div",{className:`${ji.list} ${x?ji.keyboardOnly:""}`,ref:l,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${m}`:void 0,"aria-label":a(c?"model.setFast":d?"model.setVoice":h?"model.setVision":"model.select"),children:[o.length===0?u.jsx("div",{className:ji.empty,children:a("model.none")}):null,o.map((_,E)=>{const k=E===m,M=E===f,R=lN(_);return u.jsxs("div",{id:`model-opt-${E}`,role:"option","aria-selected":M,className:`${ji.row} ${k?ji.selected:""} ${M?Pe("dialog-current"):""}`,onClick:()=>v(E),onMouseMove:()=>w(E),children:[u.jsxs("span",{className:ji.number,children:[E+1,"."]}),R?u.jsxs("span",{className:ji.provider,children:["[",R,"]"]}):null,u.jsx("span",{className:ji.label,children:z8e(_)}),_.isRuntime?u.jsx("span",{className:ji.badge,children:a("common.runtime")}):null]},F8e(_))})]}),b?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:ji.divider}),u.jsxs("div",{className:ji.detail,children:[u.jsx(O1,{label:a("model.modality"),value:$8e(b.modalities,a)}),u.jsx(O1,{label:a("model.contextWindow"),value:P8e(b.contextWindow,a)}),lN(b)!=="qwen-oauth"?u.jsxs(u.Fragment,{children:[u.jsx(O1,{label:a("model.baseUrl"),value:b.baseUrl??a("model.default")}),u.jsx(O1,{label:a("model.apiKey"),value:b.envKey??a("model.notSet")})]}):null]})]}):null]})}function m8(e){return e.replace(/[：:\s]+$/u,"")}const U8e="_panel_irhhk_1",V8e="_embedded_irhhk_13",W8e="_footer_irhhk_21",G8e="_titleLine_irhhk_25",K8e="_icon_irhhk_32",Y8e="_title_irhhk_25",Q8e="_subtitle_irhhk_44",X8e="_text_irhhk_49",J8e="_options_irhhk_55",Z8e="_option_irhhk_55",e7e="_optionActive_irhhk_77",t7e="_optionLabel_irhhk_81",n7e="_optionIcon_irhhk_86",s7e="_optionContent_irhhk_119",r7e="_optionDesc_irhhk_129",i7e="_badge_irhhk_135",o7e="_toolDetail_irhhk_170",a7e="_toolDetailTitle_irhhk_175",l7e="_toolDetailBody_irhhk_180",c7e="_toolList_irhhk_181",u7e="_textInput_irhhk_193",d7e="_textArea_irhhk_211",h7e="_summary_irhhk_231",f7e="_summaryRow_irhhk_238",m7e="_summaryLabel_irhhk_244",p7e="_summaryValue_irhhk_250",g7e="_summaryBlockTitle_irhhk_255",y7e="_summaryBlock_irhhk_255",b7e="_manageList_irhhk_295",v7e="_manageItem_irhhk_301",w7e="_manageItemExpanded_irhhk_307",x7e="_manageRow_irhhk_312",_7e="_manageRowActive_irhhk_329",k7e="_manageIcon_irhhk_333",S7e="_manageName_irhhk_362",T7e="_levelTag_irhhk_370",C7e="_manageChevron_irhhk_380",A7e="_manageChevronExpanded_irhhk_398",E7e="_manageDetail_irhhk_402",M7e="_manageDetailInner_irhhk_409",N7e="_manageDetailHeader_irhhk_419",I7e="_manageActions_irhhk_426",j7e="_manageButton_irhhk_433",R7e="_dangerButton_irhhk_453",L7e="_deleteText_irhhk_457",D7e="_viewerRow_irhhk_487",O7e="_viewerLabel_irhhk_500",B7e="_viewerField_irhhk_507",P7e="_viewerSectionTitle_irhhk_512",$7e="_viewerBlock_irhhk_518",z7e="_closed_irhhk_524",F7e="_closedText_irhhk_528",q7e="_loading_irhhk_534",H7e="_error_irhhk_539",U7e="_createWizard_irhhk_545",V7e="_createSteps_irhhk_551",W7e="_createStepPill_irhhk_559",G7e="_createStepPillActive_irhhk_571",K7e="_createStepPillDone_irhhk_576",Y7e="_createStepNumber_irhhk_580",Q7e="_createStepLabel_irhhk_591",X7e="_createBody_irhhk_597",J7e="_createActions_irhhk_601",Ie={panel:U8e,embedded:V8e,footer:W8e,titleLine:G8e,icon:K8e,title:Y8e,subtitle:Q8e,text:X8e,options:J8e,option:Z8e,optionActive:e7e,optionLabel:t7e,optionIcon:n7e,optionContent:s7e,optionDesc:r7e,badge:i7e,toolDetail:o7e,toolDetailTitle:a7e,toolDetailBody:l7e,toolList:c7e,textInput:u7e,textArea:d7e,summary:h7e,summaryRow:f7e,summaryLabel:m7e,summaryValue:p7e,summaryBlockTitle:g7e,summaryBlock:y7e,manageList:b7e,manageItem:v7e,manageItemExpanded:w7e,manageRow:x7e,manageRowActive:_7e,manageIcon:k7e,manageName:S7e,levelTag:T7e,manageChevron:C7e,manageChevronExpanded:A7e,manageDetail:E7e,manageDetailInner:M7e,manageDetailHeader:N7e,manageActions:I7e,manageButton:j7e,dangerButton:R7e,deleteText:L7e,viewerRow:D7e,viewerLabel:O7e,viewerField:B7e,viewerSectionTitle:P7e,viewerBlock:$7e,closed:z7e,closedText:F7e,loading:q7e,error:H7e,createWizard:U7e,createSteps:V7e,createStepPill:W7e,createStepPillActive:G7e,createStepPillDone:K7e,createStepNumber:Y7e,createStepLabel:Q7e,createBody:X7e,createActions:J7e};function vF(e){if(e==="project")return"workspace";if(e==="user")return"global"}function wF(e){return vF(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function Z7e(e,t){return e==="project"?t("agent.level.project"):e==="user"?t("agent.level.user"):e==="builtin"?t("agent.level.builtin"):e==="extension"?t("agent.level.extension"):e}const rl=m8;function e9e(e){return e.displayName||e.name}function xF(e){const t=e.toLowerCase();return["read","grep","glob","ls","list","search","fetch","webfetch","web_fetch","websearch","web_search","think","todo","context"].some(n=>t.includes(n))}function _F(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function kF(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function t9e(e,t){if(!t||t.length===0)return 0;const n=new Set(t),s=e.findIndex(r=>r.id==="all"||r.tools.length!==n.size?!1:r.tools.every(i=>n.has(i)));return s>=0?s:0}function n9e({mode:e,embedded:t=!1,onMessage:n,onClose:s}){const{t:r}=Xe(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:c,generateAgent:d,deleteAgent:h}=iY({autoLoad:!0}),{tools:f}=OL({autoLoad:!0}),[m,p]=g.useState(!1),[y,w]=g.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[b,v]=g.useState(0),[x,_]=g.useState(0),[E,k]=g.useState(null),[M,R]=g.useState(null),[L,T]=g.useState(!1),[N,I]=g.useState(null),[O,U]=g.useState(1),[F,j]=g.useState(()=>e==="create-user"?"global":"workspace"),[V,ee]=g.useState("manual"),[ce,$]=g.useState(""),[J,B]=g.useState(""),[C,z]=g.useState(""),[X,ae]=g.useState([]),[be,fe]=g.useState(0),[ie,G]=g.useState(!1),[q,le]=g.useState(!1),Se=g.useRef(0),$e=g.useCallback(()=>{p(!0),s()},[s]),Ae=g.useMemo(()=>{const Ye=i.filter(ue=>ue.level==="project"),ge=i.filter(ue=>ue.level==="user"),st=i.filter(ue=>ue.level==="builtin"),ne=i.filter(ue=>ue.level==="extension");return{project:Ye,user:ge,builtin:st,extension:ne}},[i]),we=g.useMemo(()=>[...Ae.project,...Ae.user,...Ae.builtin,...Ae.extension],[Ae]),ct=g.useMemo(()=>{const Ye=f.filter(ue=>ue.enabled).map(e9e).sort((ue,Re)=>ue.localeCompare(Re)),ge=Ye.filter(xF),st=Ye.filter(_F),ne=Ye.filter(kF);return[{id:"all",label:r("agent.create.tools.all"),tools:[]},{id:"read",label:r("agent.create.tools.readOnly"),tools:ge},{id:"edit",label:r("agent.create.tools.readEdit"),tools:[...new Set([...ge,...st])]},{id:"execute",label:r("agent.create.tools.readEditExecute"),tools:[...new Set([...ge,...st,...ne])]}]},[r,f]);g.useEffect(()=>{if(y!=="manage")return;const Ye=M!==null?we[M]:void 0;Ye&&l(Ye.name).then(k).catch(ge=>I(ge instanceof Error?ge.message:String(ge)))},[y,we,M,l]),g.useEffect(()=>{x>=we.length&&we.length>0&&_(we.length-1),M!==null&&M>=we.length&&R(null)},[M,we.length,x]);const ht=g.useCallback((Ye=x)=>{const ge=we[Ye];if(!ge||!wF(ge))return;const st=vF(ge.level);st&&(T(!0),h(ge.name,st).then(()=>{n(r("agent.deleted",{name:ge.name})),k(null),R(null),_(0),a()}).catch(ne=>I(ne instanceof Error?ne.message:String(ne))).finally(()=>T(!1)))},[we,x,h,n,a,r]),ut=g.useCallback(()=>{if(!ce.trim()||!J.trim()||!C.trim()){I(r("agent.create.required"));return}T(!0),c({name:ce.trim(),description:J.trim(),systemPrompt:C.trim(),scope:F,tools:X}).then(Ye=>{n(r("agent.created",{name:Ye.agent.name})),$e()}).catch(Ye=>I(Ye instanceof Error?Ye.message:String(Ye))).finally(()=>T(!1))},[ce,J,C,F,X,c,n,$e,r]),ft=g.useCallback(async()=>{const Ye=J.trim();if(!Ye||ie)return;const ge=Se.current+1;Se.current=ge,G(!0),le(!1),I(null);try{const st=await d(Ye);if(Se.current!==ge)return;$(st.name),B(st.description),z(st.systemPrompt),U(V==="manual"?6:4),fe(0)}catch(st){if(Se.current!==ge)return;I(r("agent.create.generateFailed",{error:st instanceof Error?st.message:String(st)})),le(!0)}finally{Se.current===ge&&G(!1)}},[J,ie,V,d,r]),tt=g.useCallback(Ye=>{if(Ye==="name"&&ce.trim())U(4),le(!0);else if(Ye==="prompt"&&C.trim())U(5),le(!0);else if(Ye==="desc"&&J.trim()){if(V==="qwen"){ft();return}U(V==="manual"?6:4),fe(0),le(!1)}},[ce,J,C,V,ft]);if(m)return u.jsx("div",{className:`${Ie.panel} ${t?Ie.embedded:""} ${Ie.closed}`,children:u.jsx("div",{className:Ie.closedText,children:r("agents.closed")})});if(o&&i.length===0)return u.jsxs("div",{className:`${Ie.panel} ${t?Ie.embedded:""}`,children:[u.jsxs("div",{className:Ie.titleLine,children:[u.jsx("span",{className:Ie.icon,children:"?"}),u.jsx("span",{className:Ie.title,children:r("agents.title")})]}),u.jsx("div",{className:Ie.loading,children:r("common.loading")})]});const qt=r("agents.title");return u.jsxs("div",{className:`${Ie.panel} ${t?Ie.embedded:""}`,children:[!t&&y!=="create"&&u.jsxs("div",{className:Ie.titleLine,children:[u.jsx("span",{className:Ie.icon,children:"?"}),u.jsx("span",{className:Ie.title,children:qt}),u.jsx("span",{className:Ie.subtitle,children:r("agent.count",{count:i.length})})]}),N&&u.jsx("div",{className:Ie.error,children:N}),y==="menu"&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.text,children:r("agent.selectAction")}),u.jsxs("div",{className:Ie.options,children:[u.jsx(vd,{idx:0,active:b===0,label:r("agent.manage"),desc:r("agent.manage.desc"),onClick:()=>{v(0),w("manage")},onHover:()=>v(0)}),u.jsx(vd,{idx:1,active:b===1,label:r("agent.create"),desc:r("agent.create.desc"),onClick:()=>{v(1),w("create")},onHover:()=>v(1)})]}),u.jsx("div",{className:Ie.footer,children:r("agent.footer.nav")})]}),y==="manage"&&u.jsx(s9e,{agents:we,expandedAgentIdx:M,selectedAgent:E,busy:L,onToggleAgent:Ye=>{_(Ye),R(ge=>ge===Ye?null:Ye),k(null)},onDelete:Ye=>{L||ht(Ye)},t:r}),y==="create"&&u.jsx(r9e,{step:O,method:V,scope:F,name:ce,desc:J,prompt:C,tools:X,toolCategories:ct,selIdx:be,busy:L,generating:ie,inputFocused:q,onSetName:$,onSetDesc:B,onSetPrompt:z,onInputNext:tt,onInputFocus:()=>le(!0),onInputBlur:()=>le(!1),onSetStep:U,onSetSelectedIndex:fe,onSelectLocation:Ye=>{fe(Ye),j(Ye===0?"workspace":"global")},onSelectMethod:Ye=>{fe(Ye),ee(Ye===0?"qwen":"manual")},onSelectTools:Ye=>{var ge;fe(Ye),ae(((ge=ct[Ye])==null?void 0:ge.tools)??[])},onSave:()=>{L||ut()},t:r})]})}function vd({idx:e,active:t,label:n,desc:s,badge:r,numbered:i=!1,onClick:o,onHover:a}){return u.jsxs("div",{className:`${Ie.option} ${t?Ie.optionActive:""}`,onClick:o,onMouseEnter:a,children:[u.jsx("span",{className:Ie.optionIcon,"aria-hidden":"true"}),u.jsxs("span",{className:Ie.optionContent,children:[u.jsxs("span",{className:Ie.optionLabel,children:[i?`${e+1}. `:"",n,r&&u.jsx("span",{className:Ie.badge,children:r})]}),s&&u.jsx("span",{className:Ie.optionDesc,children:s})]})]})}function s9e({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:s,onToggleAgent:r,onDelete:i,t:o}){const[a,l]=g.useState(null),c=g.useMemo(()=>new Set(e.filter(d=>d.level==="project").map(d=>d.name)),[e]);return e.length===0?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.text,children:o("agent.empty")}),u.jsx("div",{className:Ie.text,children:o("agent.createFirstHint")})]}):u.jsx("div",{className:Ie.manageList,children:e.map((d,h)=>{const f=t===h,m=f&&(n==null?void 0:n.name)===d.name?n:null,p=wF(d),y=(m==null?void 0:m.tools)??[],w=y.length===0||y.includes("*")?o("agent.create.tools.all"):y.join(", ");return u.jsxs("div",{className:`${Ie.manageItem} ${f?Ie.manageItemExpanded:""}`,children:[u.jsxs("button",{type:"button",className:`${Ie.manageRow} ${f?Ie.manageRowActive:""}`,onClick:()=>{l(null),r(h)},children:[u.jsx("span",{className:Ie.manageIcon,"aria-hidden":"true"}),u.jsx("span",{className:Ie.manageName,children:d.name}),u.jsx("span",{className:Ie.levelTag,children:Z7e(d.level,o)}),d.level==="user"&&c.has(d.name)?u.jsx("span",{className:Ie.levelTag,children:o("agent.overriddenBadge")}):null,u.jsx("span",{className:`${Ie.manageChevron} ${f?Ie.manageChevronExpanded:""}`})]}),f?u.jsx("div",{className:Ie.manageDetail,children:m?u.jsxs("div",{className:Ie.manageDetailInner,children:[u.jsx("div",{className:Ie.manageDetailHeader,children:p?u.jsx("div",{className:Ie.manageActions,children:a===h?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Ie.deleteText,children:s?o("agent.delete.loading"):o("agent.delete.confirm",{name:d.name})}),u.jsx("button",{type:"button",className:Ie.manageButton,onClick:()=>l(null),disabled:s,children:o("common.cancel")}),u.jsx("button",{type:"button",className:`${Ie.manageButton} ${Ie.dangerButton}`,onClick:()=>i(h),disabled:s,children:o("agent.action.delete")})]}):u.jsx("button",{type:"button",className:`${Ie.manageButton} ${Ie.dangerButton}`,onClick:()=>l(h),disabled:s,children:o("agent.action.delete")})}):null}),u.jsxs("div",{className:Ie.viewerField,children:[u.jsx("div",{className:Ie.viewerSectionTitle,children:rl(o("agent.toolsLabel"))}),u.jsx("div",{className:Ie.viewerBlock,children:w})]}),u.jsxs("div",{className:Ie.viewerField,children:[u.jsx("div",{className:Ie.viewerSectionTitle,children:rl(o("agent.filePathLabel"))}),u.jsx("div",{className:Ie.viewerBlock,children:m.filePath||"—"})]}),m.model?u.jsxs("div",{className:Ie.viewerRow,children:[u.jsx("span",{className:Ie.viewerLabel,children:rl(o("agent.modelLabel"))}),u.jsx("span",{children:m.model})]}):null,u.jsxs("div",{className:Ie.viewerField,children:[u.jsx("div",{className:Ie.viewerSectionTitle,children:rl(o("agent.descriptionLabel"))}),u.jsx("div",{className:Ie.viewerBlock,children:m.description||"—"})]}),u.jsxs("div",{className:Ie.viewerField,children:[u.jsx("div",{className:Ie.viewerSectionTitle,children:rl(o("agent.systemPromptLabel"))}),u.jsx("div",{className:Ie.viewerBlock,children:m.systemPrompt||"—"})]})]}):u.jsx("div",{className:Ie.loading,children:o("common.loading")})}):null]},`${d.level}:${d.name}`)})})}function r9e({step:e,method:t,scope:n,name:s,desc:r,prompt:i,tools:o,toolCategories:a,selIdx:l,busy:c,generating:d,inputFocused:h,onSetName:f,onSetDesc:m,onSetPrompt:p,onInputNext:y,onInputFocus:w,onInputBlur:b,onSetStep:v,onSetSelectedIndex:x,onSelectLocation:_,onSelectMethod:E,onSelectTools:k,onSave:M,t:R}){const L=g.useRef(null),T=g.useRef(null),N=g.useRef(null);g.useEffect(()=>{var J,B,C,z;h&&(t==="manual"?e===3?(J=L.current)==null||J.focus():e===4?(B=N.current)==null||B.focus():e===5&&((C=T.current)==null||C.focus()):e===3&&((z=T.current)==null||z.focus()))},[e,t,h]);const I=t==="manual"?6:4,O=I+1,U=t==="manual"?[R("agent.create.location"),R("agent.create.method"),R("agent.create.name"),R("agent.create.prompt"),R("agent.create.description"),R("agent.create.toolsSelection")]:[R("agent.create.location"),R("agent.create.method"),R("agent.create.describeAgent"),R("agent.create.toolsSelection")],F=J=>J===1?n==="workspace"?0:1:J===2?t==="qwen"?0:1:J===I?t9e(a,o):0,j=J=>{v(J),x(F(J)),t==="manual"&&(J===3||J===4||J===5)||t==="qwen"&&J===3?w():b()},V=()=>{e<=1||d||j(e-1)},ee=()=>{if(!d){if(e===1){j(2);return}if(e===2){j(3);return}if(t==="manual"&&e===3){y("name");return}if(t==="manual"&&e===4){y("prompt");return}if(t==="manual"&&e===5||t==="qwen"&&e===3){y("desc");return}e===I&&(k(l),j(O))}},ce=d||t==="manual"&&e===3&&!s.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!r.trim()||t==="qwen"&&e===3&&!r.trim();let $=null;if(e===1&&($=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Ie.options,children:[u.jsx(vd,{idx:0,active:l===0,label:R("agent.create.project.cli"),numbered:!0,onClick:()=>_(0)}),u.jsx(vd,{idx:1,active:l===1,label:R("agent.create.user.cli"),numbered:!0,onClick:()=>_(1)})]})})),e===2&&($=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Ie.options,children:[u.jsx(vd,{idx:0,active:l===0,label:R("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>E(0)}),u.jsx(vd,{idx:1,active:l===1,label:R("agent.create.method.manual"),numbered:!0,onClick:()=>E(1)})]})})),t==="manual"&&e===3&&($=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.text,children:R("agent.create.nameHelp")}),u.jsx("input",{ref:L,className:Ie.textInput,value:s,onChange:J=>f(J.target.value),onFocus:w,onBlur:b,placeholder:R("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&($=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.text,children:R("agent.create.promptHelp")}),u.jsx("textarea",{ref:N,className:Ie.textArea,value:i,onChange:J=>p(J.target.value),onFocus:w,onBlur:b,placeholder:R("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&($=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.text,children:R("agent.create.manualDescHelp")}),u.jsx("textarea",{ref:T,className:Ie.textArea,value:r,onChange:J=>m(J.target.value),onFocus:w,onBlur:b,placeholder:R("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&($=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.text,children:R("agent.create.qwenHint")}),d?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.text,children:R("agent.create.generatingConfig")}),u.jsx("div",{className:Ie.footer,children:R("agent.footer.generating")})]}):u.jsx(u.Fragment,{children:u.jsx("textarea",{ref:T,className:Ie.textArea,value:r,onChange:J=>m(J.target.value),onFocus:w,onBlur:b,placeholder:R("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===I){const J=a[l]??a[0],B=(J==null?void 0:J.tools)??[],C=(J==null?void 0:J.id)==="all"?R("agent.create.tools.allInfo"):B.length>0?B.join(", "):R("agent.create.tools.none"),z=B.filter(xF),X=B.filter(_F),ae=B.filter(kF);$=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.options,children:a.map((be,fe)=>u.jsx(vd,{idx:fe,active:l===fe,label:be.label,numbered:!0,onClick:()=>k(fe)},be.id))}),u.jsx("div",{className:Ie.toolDetail,children:(J==null?void 0:J.id)==="all"?u.jsx("div",{className:Ie.toolDetailBody,children:C}):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:Ie.toolDetailTitle,children:R("agent.create.tools.selected")}),u.jsx("div",{className:Ie.toolList,children:B.length===0?C:u.jsxs(u.Fragment,{children:[z.length>0&&u.jsxs("div",{children:[R("agent.create.tools.readOnlyLabel")," ",z.join(", ")]}),X.length>0&&u.jsxs("div",{children:[R("agent.create.tools.editLabel")," ",X.join(", ")]}),ae.length>0&&u.jsxs("div",{children:[R("agent.create.tools.executionLabel")," ",ae.join(", ")]})]})})]})})]})}if(e===O){const J=o.length===0?"*":o.join(", ");$=u.jsx(u.Fragment,{children:u.jsxs("div",{className:Ie.summary,children:[u.jsxs("div",{className:Ie.summaryRow,children:[u.jsx("span",{className:Ie.summaryLabel,children:rl(R("agent.create.name"))}),u.jsx("span",{className:Ie.summaryValue,children:s||"—"})]}),u.jsxs("div",{className:Ie.summaryRow,children:[u.jsx("span",{className:Ie.summaryLabel,children:rl(R("agent.location"))}),u.jsx("span",{className:Ie.summaryValue,children:R(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),u.jsxs("div",{className:Ie.summaryRow,children:[u.jsx("span",{className:Ie.summaryLabel,children:rl(R("agent.toolsLabel"))}),u.jsx("span",{className:Ie.summaryValue,children:J})]}),u.jsx("div",{className:Ie.summaryBlockTitle,children:rl(R("agent.descriptionLabel"))}),u.jsx("div",{className:Ie.summaryBlock,children:r||"—"}),u.jsx("div",{className:Ie.summaryBlockTitle,children:rl(R("agent.systemPromptLabel"))}),u.jsx("div",{className:Ie.summaryBlock,children:i||"—"})]})})}return u.jsxs("div",{className:Ie.createWizard,children:[u.jsx("div",{className:Ie.createSteps,children:U.map((J,B)=>{const C=B+1;return u.jsxs("div",{className:`${Ie.createStepPill} ${C===Math.min(e,I)?Ie.createStepPillActive:""} ${C<Math.min(e,I)?Ie.createStepPillDone:""}`,children:[u.jsx("span",{className:Ie.createStepNumber,children:C}),u.jsx("span",{className:Ie.createStepLabel,children:J})]},`${C}:${J}`)})}),u.jsx("div",{className:Ie.createBody,children:$}),u.jsxs("div",{className:Ie.createActions,children:[u.jsx("button",{type:"button",className:Ie.manageButton,onClick:V,disabled:e<=1||d||c,children:R("common.previous")}),e===O?u.jsx("button",{type:"button",className:Ie.manageButton,onClick:M,disabled:c,children:R(c?"agent.create.loading":"agent.create.save")}):u.jsx("button",{type:"button",className:Ie.manageButton,onClick:ee,disabled:ce,children:R("common.next")})]})]})}const i9e="_page_1np31_1",o9e="_tabs_1np31_11",a9e="_memoryCard_1np31_19",l9e="_memoryCardActive_1np31_35",c9e="_memoryTitle_1np31_44",u9e="_detailPath_1np31_48",d9e="_status_1np31_49",h9e="_actionButton_1np31_54",f9e="_primaryButton_1np31_55",m9e="_secondaryButton_1np31_56",p9e="_detail_1np31_48",g9e="_detailHeader_1np31_79",y9e="_detailTitleWrap_1np31_87",b9e="_actions_1np31_91",v9e="_content_1np31_105",w9e="_editor_1np31_106",x9e="_editorFooter_1np31_127",Xr={page:i9e,tabs:o9e,memoryCard:a9e,memoryCardActive:l9e,memoryTitle:c9e,detailPath:u9e,status:d9e,actionButton:h9e,primaryButton:f9e,secondaryButton:m9e,detail:p9e,detailHeader:g9e,detailTitleWrap:y9e,actions:b9e,content:v9e,editor:w9e,editorFooter:x9e};function cN(e,t){return e.find(n=>n.scope===t)}function uN(e,t){return t(e==="global"?"memory.global":"memory.project")}function _9e({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:s}){var $,J;const{t:r}=Xe(),{files:i,loading:o,error:a,readFile:l,reload:c,writeMemory:d}=oY({autoLoad:!0}),h=g.useRef(null),f=g.useRef(0),[m,p]=g.useState("workspace"),[y,w]=g.useState("view"),[b,v]=g.useState(""),[x,_]=g.useState(""),[E,k]=g.useState(!1),[M,R]=g.useState(!1),[L,T]=g.useState(null),N=g.useRef(0),I=g.useMemo(()=>{const B=cN(i,"global"),C=cN(i,"workspace");return[{scope:"workspace",title:r("memory.project"),description:r("memory.project.desc"),fallbackPath:"QWEN.md",file:C},{scope:"global",title:r("memory.global"),description:r("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:B}]},[i,r]),O=I.find(B=>B.scope===m)??I[0],U=g.useCallback((B,C)=>{const z=++f.current;if(w(C),T(null),v(""),_(""),!(B!=null&&B.file)){C==="edit"&&requestAnimationFrame(()=>{var X;return(X=h.current)==null?void 0:X.focus()});return}k(!0),l(B.file.path).then(X=>{z===f.current&&(v(X.content),_(X.content),X.truncated&&T(r("memory.fileTruncated")),requestAnimationFrame(()=>{var ae;return(ae=h.current)==null?void 0:ae.focus()}))}).catch(X=>{if(z!==f.current)return;const ae=X instanceof Error?X.message:String(X);T(ae),B.scope!=="global"&&(s==null||s(ae,"error"))}).finally(()=>{z===f.current&&k(!1)})},[s,l,r]);g.useEffect(()=>{O&&U(O,y)},[($=O==null?void 0:O.file)==null?void 0:$.path,O==null?void 0:O.scope]),g.useEffect(()=>{a&&T(a.message)},[a]),g.useEffect(()=>{e<=0||c().then(()=>T(r("memory.refreshed"))).catch(B=>{const C=B instanceof Error?B.message:String(B);T(C),s==null||s(C,"error")})},[s,e,c,r]),g.useEffect(()=>{if(t<=0||N.current===t)return;N.current=t;const B=n==="global"?"global":"workspace";p(B);const C=I.find(z=>z.scope===B);U(C,"edit")},[n,t,I,U]);const F=B=>{p(B.scope),U(B,"view")},j=()=>{O&&U(O,"edit")},V=()=>{if(O){if(!x.trim()){T(r("memory.contentEmpty"));return}R(!0),T(null),d({scope:O.scope,mode:"replace",content:x}).then(B=>{const C=r("memory.saved",{scope:uN(O.scope,r),bytes:B.bytesWritten,path:B.filePath});v(x),w("view"),T(C),s==null||s(C,"status"),c().catch(()=>{})}).catch(B=>{const C=B instanceof Error?B.message:String(B);T(C),s==null||s(C,"error")}).finally(()=>R(!1))}},ee=((J=O==null?void 0:O.file)==null?void 0:J.path)??(O==null?void 0:O.fallbackPath)??"",ce=L??(o?r("memory.loading"):null);return u.jsxs("div",{className:Xr.page,children:[u.jsx("nav",{className:Xr.tabs,"aria-label":r("memory.menu"),children:I.map(B=>{const C=B.scope===m;return u.jsx("button",{type:"button",className:`${Xr.memoryCard} ${C?Xr.memoryCardActive:""}`,onClick:()=>F(B),children:u.jsx("span",{className:Xr.memoryTitle,children:B.title})},B.scope)})}),u.jsxs("section",{className:Xr.detail,children:[u.jsxs("header",{className:Xr.detailHeader,children:[u.jsx("div",{className:Xr.detailTitleWrap,children:u.jsx("div",{className:Xr.detailPath,children:ee})}),u.jsx("div",{className:Xr.actions,children:u.jsx("button",{type:"button",className:Xr.actionButton,onClick:j,children:r("settings.action.edit")})})]}),ce&&u.jsx("div",{className:Xr.status,children:ce}),y==="edit"?u.jsxs(u.Fragment,{children:[u.jsx("textarea",{ref:h,className:Xr.editor,value:x,disabled:M||E,onChange:B=>_(B.target.value),placeholder:r("memory.placeholder",{scope:O?uN(O.scope,r):""})}),u.jsxs("div",{className:Xr.editorFooter,children:[u.jsx("button",{type:"button",className:Xr.secondaryButton,disabled:M,onClick:()=>{_(b),w("view")},children:r("common.cancel")}),u.jsx("button",{type:"button",className:Xr.primaryButton,disabled:M||E,onClick:V,children:r(M?"memory.saving":"memory.save")})]})]}):u.jsx("pre",{className:Xr.content,children:E?r("memory.loadingFile"):b||r("memory.noFiles")})]})]})}const k9e="_panel_cxp6w_1",S9e="_steps_cxp6w_10",T9e="_stepPill_cxp6w_18",C9e="_stepPillActive_cxp6w_29",A9e="_stepPillDone_cxp6w_34",E9e="_stepNumber_cxp6w_38",M9e="_stepLabel_cxp6w_49",N9e="_body_cxp6w_55",I9e="_text_cxp6w_59",j9e="_muted_cxp6w_64",R9e="_options_cxp6w_68",L9e="_option_cxp6w_68",D9e="_optionActive_cxp6w_90",O9e="_label_cxp6w_94",B9e="_optionText_cxp6w_98",P9e="_description_cxp6w_112",$9e="_input_cxp6w_119",z9e="_preview_cxp6w_135",F9e="_error_cxp6w_146",q9e="_link_cxp6w_150",H9e="_terms_cxp6w_161",U9e="_actions_cxp6w_169",V9e="_actionButton_cxp6w_177",es={panel:k9e,steps:S9e,stepPill:T9e,stepPillActive:C9e,stepPillDone:A9e,stepNumber:E9e,stepLabel:M9e,body:N9e,text:I9e,muted:j9e,options:R9e,option:L9e,optionActive:D9e,label:O9e,optionText:B9e,description:P9e,input:$9e,preview:z9e,error:F9e,link:q9e,terms:H9e,actions:U9e,actionButton:V9e};function W9e(e){return[{value:"openai",label:e("auth.protocol.openai"),description:e("auth.protocol.openaiDesc")},{value:"anthropic",label:e("auth.protocol.anthropic"),description:e("auth.protocol.anthropicDesc")},{value:"gemini",label:e("auth.protocol.gemini"),description:e("auth.protocol.geminiDesc")}]}function Km(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function dN(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function G9e(e,t,n){var s;return e==="protocol"?n("auth.step.protocol"):e==="baseUrl"?((s=t.uiLabels)==null?void 0:s.baseUrlStepTitle)??n("auth.step.baseUrl"):n(e==="apiKey"?"auth.step.apiKey":e==="models"?"auth.step.models":"auth.step.advanced")}function K9e(e,t){const n=e.trim();return n?n.length<=6?"***":`${n.slice(0,3)}...${n.slice(-4)}`:t?t("auth.notSet"):"(not set)"}function w4(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function Y9e({onMessage:e,onClose:t}){const{t:n}=Xe(),s=da(),[r,i]=g.useState("groups"),[o,a]=g.useState(0),[l,c]=g.useState(0),[d,h]=g.useState("providers"),[f,m]=g.useState(0),[p,y]=g.useState(),[w,b]=g.useState("alibaba"),[v,x]=g.useState(null),[_,E]=g.useState("openai"),[k,M]=g.useState(""),[R,L]=g.useState(""),[T,N]=g.useState(""),[I,O]=g.useState(!1),[U,F]=g.useState(!1),[j,V]=g.useState(!0),[ee,ce]=g.useState(!0),[$,J]=g.useState(!1),[B,C]=g.useState(!1),[z,X]=g.useState(""),[ae,be]=g.useState(!0),[fe,ie]=g.useState(!1),[G,q]=g.useState(null);g.useEffect(()=>{s.getAuthProviders().then(ve=>{y(ve),be(!1)}).catch(ve=>{q(ve instanceof Error?ve.message:String(ve)),be(!1)})},[s]);const le=g.useMemo(()=>(p==null?void 0:p.groups)??[],[p]),Se=g.useMemo(()=>{var Be;return(((Be=le.find(He=>He.id===w))==null?void 0:Be.providerIds)??[]).map(He=>p==null?void 0:p.providers.find(Ht=>Ht.id===He)).filter(He=>!!He)},[p,w,le]),$e=g.useMemo(()=>(v==null?void 0:v.steps)??[],[v==null?void 0:v.steps]),Ae=$e[f],we=(v==null?void 0:v.showAdvancedConfig)===!0,ct=g.useMemo(()=>U?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[U]),ht=ct.indexOf("context"),ut=Ae==="apiKey"||Ae==="models"||Ae==="baseUrl"&&!Array.isArray(v==null?void 0:v.baseUrl),[ft,tt]=g.useState(0),qt=g.useCallback((ve,Be="providers")=>{var Ht,Yn;x(ve),h(Be);const He=((Ht=ve.protocolOptions)==null?void 0:Ht[0])??ve.protocol;E(He),typeof ve.baseUrl=="string"?M(ve.baseUrl):Array.isArray(ve.baseUrl)?M(((Yn=ve.baseUrl[0])==null?void 0:Yn.url)??""):M(Km(He)),L(""),N(dN(ve)),O(!1),F(!1),V(!0),ce(!0),J(!1),C(!1),X(""),m(0),tt(0),q(null),i(ve.steps.length>0?"step":"review")},[]),Ye=g.useCallback(()=>{if(q(null),r==="groups"){t();return}if(r==="providers"){i("groups");return}if(r==="review"){if($e.length===0){i(d);return}i("step"),m(Math.max(0,$e.length-1));return}if(f>0){m(ve=>ve-1),tt(0);return}i(d)},[t,d,f,$e.length,r]),ge=g.useCallback(()=>{if(!v||fe)return;ie(!0),q(null);const ve=Number(z);s.installAuthProvider({providerId:v.id,protocol:_,baseUrl:k,apiKey:R,modelIds:w4(T),advancedConfig:I||U||Number.isFinite(ve)&&ve>0?{...I?{enableThinking:!0}:{},...U?{multimodal:{...j?{image:!0}:{},...ee?{video:!0}:{},...$?{audio:!0}:{},...B?{pdf:!0}:{}}}:{},...Number.isFinite(ve)&&ve>0?{contextWindowSize:ve}:{}}:void 0}).then(Be=>{e(Be.message),t()}).catch(Be=>{const He=Be instanceof Error?Be.message:String(Be);q(He),e(He,"error")}).finally(()=>ie(!1))},[R,k,z,U,$,j,B,ee,T,t,e,_,v,fe,I,s]),st=g.useCallback(()=>{if(v){if(Ae==="baseUrl"){const ve=k.trim()||Km(_);if(!ve){q(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(ve)){q(n("auth.baseUrlInvalid"));return}k.trim()||M(ve)}if(Ae==="apiKey"&&R.trim().length===0){q(n("auth.apiKeyRequired"));return}if(Ae==="models"&&w4(T).length===0){q(n("auth.modelsRequired"));return}q(null),f>=$e.length-1?we?i("review"):ge():(m(ve=>ve+1),tt(0))}},[R,k,Ae,T,_,v,ge,we,f,$e.length,n]),ne=g.useCallback(ve=>{switch(ve){case"thinking":O(Be=>!Be);return;case"modality":F(Be=>!Be);return;case"image":V(Be=>!Be);return;case"video":ce(Be=>!Be);return;case"audio":J(Be=>!Be);return;case"pdf":C(Be=>!Be);return;case"context":st();return;default:return}},[st]),ue=g.useCallback(()=>{if(r==="groups"){const ve=le[o];if(!ve)return;if(ve.id==="custom"){const Be=ve.providerIds.map(He=>p==null?void 0:p.providers.find(Ht=>Ht.id===He)).find(He=>!!He);Be&&qt(Be,"groups");return}b(ve.id),c(0),i("providers");return}if(r==="providers"){const ve=Se[l];ve&&qt(ve,"providers");return}if(r==="review"){ge();return}if(!(!v||!Ae)){if(Ae==="protocol"){const ve=(v.protocolOptions??[v.protocol])[ft];ve&&(E(ve),v.baseUrl||M(Km(ve))),st();return}if(Ae==="baseUrl"&&Array.isArray(v.baseUrl)){const ve=v.baseUrl[ft];ve&&M(ve.url),st();return}if(Ae==="advancedConfig"){ne(ct[ft]);return}st()}},[Ae,p,st,o,le,ft,v,l,Se,ge,qt,r,ne,ct]),Re=g.useCallback(ve=>{if(r==="groups"){const Be=le[ve];if(!Be)return;if(Be.id==="custom"){const He=Be.providerIds.map(Ht=>p==null?void 0:p.providers.find(Yn=>Yn.id===Ht)).find(Ht=>!!Ht);He&&qt(He,"groups");return}b(Be.id),c(0),i("providers");return}if(r==="providers"){const Be=Se[ve];Be&&qt(Be,"providers");return}if(!v||!Ae){r==="review"&&ge();return}if(Ae==="protocol"){const Be=(v.protocolOptions??[v.protocol])[ve];Be&&(E(Be),v.baseUrl||M(Km(Be))),st();return}if(Ae==="baseUrl"&&Array.isArray(v.baseUrl)){const Be=v.baseUrl[ve];Be&&M(Be.url),st();return}Ae==="advancedConfig"&&ne(ct[ve])},[Ae,p,st,le,ne,ct,v,Se,ge,qt,r]),rt=(ve,Be,He)=>u.jsx("div",{className:es.options,children:ve.map((Ht,Yn)=>u.jsx("button",{type:"button",className:`${es.option} ${Be===Yn?es.optionActive:""}`,onClick:()=>{He(Yn),Re(Yn)},children:u.jsxs("div",{className:es.optionText,children:[u.jsx("div",{className:es.label,children:Ht.label}),Ht.description&&u.jsx("div",{className:es.description,children:Ht.description})]})},Ht.value))}),vt=()=>{if(!v||!Ae)return null;if(Ae==="protocol"){const He=v.protocolOptions??[v.protocol];return rt(W9e(n).filter(Ht=>He.includes(Ht.value)),ft,tt)}if(Ae==="baseUrl")return Array.isArray(v.baseUrl)?rt(v.baseUrl.map(He=>({value:He.url,label:He.label,description:He.url})),ft,tt):u.jsxs(u.Fragment,{children:[u.jsx("div",{className:es.text,children:n("auth.baseUrlPrompt")}),u.jsx("input",{className:es.input,value:k,placeholder:Km(_),onChange:He=>{M(He.target.value),q(null)},onKeyDown:He=>{He.key==="Enter"&&(He.preventDefault(),He.stopPropagation(),st())},autoFocus:!0}),v.documentationUrl&&u.jsx("a",{className:es.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(Ae==="apiKey")return u.jsxs(u.Fragment,{children:[v.documentationUrl&&u.jsxs("a",{className:es.link,href:v.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",v.documentationUrl]}),u.jsx("input",{className:es.input,type:"password",value:R,placeholder:v.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:He=>{L(He.target.value),q(null)},onKeyDown:He=>{He.key==="Enter"&&(He.preventDefault(),He.stopPropagation(),st())},autoFocus:!0})]});if(Ae==="models"){const He=dN(v);return u.jsxs(u.Fragment,{children:[He&&u.jsx("div",{className:es.muted,children:n("auth.modelsPrompt",{modelIds:He})}),u.jsx("input",{className:es.input,value:T,placeholder:He||n("auth.modelsPlaceholder"),onChange:Ht=>{N(Ht.target.value),q(null)},onKeyDown:Ht=>{Ht.key==="Enter"&&(Ht.preventDefault(),Ht.stopPropagation(),st())},autoFocus:!0})]})}const ve=He=>He?"◉":"○",Be=[{value:"thinking",label:`${ve(I)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${ve(U)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return U&&Be.push({value:"image",label:`${ve(j)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${ve(ee)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${ve($)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${ve(B)} ${n("auth.advanced.modalityPdf")}`}),Be.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${z||"auto"}`,description:n("auth.advanced.contextDesc")}),u.jsxs(u.Fragment,{children:[u.jsx("div",{className:es.text,children:n("auth.advanced.prompt")}),rt(Be,ft,tt),u.jsx("input",{className:es.input,value:z,placeholder:n("common.auto"),onChange:He=>X(He.target.value.replace(/[^0-9]/g,"")),onFocus:()=>tt(ht),onKeyDown:He=>{He.key==="Enter"&&(He.preventDefault(),He.stopPropagation(),st())}})]})},tn=g.useMemo(()=>{if(!v)return"";const ve=v.envKey??`${_.toUpperCase()}_API_KEY`,Be=w4(T),He={};if(I&&(He.extra_body={enable_thinking:!0}),U){const Wt={};j&&(Wt.image=!0),ee&&(Wt.video=!0),$&&(Wt.audio=!0),B&&(Wt.pdf=!0),Object.keys(Wt).length>0&&(He.modalities=Wt)}const Ht=Number(z);Number.isFinite(Ht)&&Ht>0&&(He.contextWindowSize=Ht);const Yn=Object.keys(He).length>0;return JSON.stringify({env:{[ve]:K9e(R,n)},modelProviders:{[_]:Be.map(Wt=>({id:Wt,name:Wt,baseUrl:k.trim(),envKey:ve,...Yn?{generationConfig:He}:{}}))},security:{auth:{selectedType:_}},model:{name:Be[0]}},null,2)},[R,k,z,U,$,j,B,ee,T,_,v,n,I]),jn=g.useMemo(()=>{const ve=[n("auth.step.group"),n("auth.step.provider")];return v&&(ve.push(...$e.map(Be=>G9e(Be,v,n))),we&&ve.push(n("auth.review"))),ve},[v,we,$e,n]),ln=g.useMemo(()=>r==="groups"?1:r==="providers"?2:r==="step"?Math.min(3+f,jn.length):jn.length,[f,jn.length,r]),Pn=ae?u.jsx("div",{className:es.muted,children:n("common.loading")}):r==="groups"?u.jsxs(u.Fragment,{children:[rt(le.map(ve=>({value:ve.id,label:n(ve.label),description:n(ve.description)})),o,a),u.jsxs("div",{className:es.terms,children:[u.jsxs("div",{children:[n("auth.termsTitle"),":"]}),u.jsx("a",{className:es.link,href:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/",target:"_blank",rel:"noreferrer",children:"https://qwenlm.github.io/qwen-code-docs/en/users/support/tos-privacy/"})]})]}):r==="providers"?rt(Se.map(ve=>({value:ve.id,label:n(ve.label),description:n(ve.description)})),l,c):r==="step"?vt():u.jsxs(u.Fragment,{children:[u.jsx("div",{className:es.text,children:n("auth.reviewText")}),u.jsx("div",{className:es.preview,children:tn})]}),Qt=()=>{if(r==="review"){ge();return}if(ut||Ae==="advancedConfig"){st();return}ue()};return u.jsxs("div",{className:es.panel,children:[u.jsx("div",{className:es.steps,children:jn.map((ve,Be)=>{const He=Be+1;return u.jsxs("div",{className:`${es.stepPill} ${He===ln?es.stepPillActive:""} ${He<ln?es.stepPillDone:""}`,children:[u.jsx("span",{className:es.stepNumber,children:He}),u.jsx("span",{className:es.stepLabel,children:ve})]},`${He}:${ve}`)})}),u.jsx("div",{className:es.body,children:Pn}),G&&u.jsx("div",{className:es.error,children:G}),u.jsxs("div",{className:es.actions,children:[u.jsx("button",{type:"button",className:es.actionButton,onClick:Ye,disabled:r==="groups"||ae||fe,children:n("common.previous")}),u.jsx("button",{type:"button",className:es.actionButton,onClick:Qt,disabled:ae||fe,children:n(r==="review"?fe?"auth.saving":"auth.save":"common.next")})]})]})}function Q9e(e){return e.displayName||e.name}const SF="tools-list",hN=e=>`${SF}-opt-${e}`;function X9e(){const{t:e}=Xe(),{status:t,tools:n,loading:s,error:r}=OL({autoLoad:!0}),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,d]=g.useState(()=>new Set),h=g.useRef(null);g.useEffect(()=>{var y,w;r?l(r.message):(w=(y=t==null?void 0:t.errors)==null?void 0:y[0])!=null&&w.error?l(t.errors[0].error):t&&l(null)},[t,r]);const f=g.useCallback(y=>{d(w=>w.has(y.name)?new Set:new Set([y.name]))},[]);g.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),g.useEffect(()=>{var w;const y=(w=h.current)==null?void 0:w.children[i];y==null||y.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:m}=Uu({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:y=>{const w=n[y];w!=null&&w.description&&f(w)}}),p=g.useMemo(()=>{if(!t)return"";const y=n.filter(w=>w.enabled).length;return e("tools.summary",{enabled:y,total:n.length})},[t,n,e]);return u.jsxs("div",{className:Pe("picker","picker-in-shell"),children:[p&&u.jsx("div",{className:Pe("picker-search"),children:u.jsx("span",{className:Pe("picker-search-hint"),children:p})}),(a||s)&&u.jsx("div",{className:Pe("picker-search"),children:u.jsx("span",{className:Pe("picker-search-hint"),children:a||e("tools.loading")})}),u.jsx("div",{className:Pe("picker-sep")}),u.jsxs("div",{id:SF,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?hN(i):void 0,className:Pe("picker-list",m?"picker-keyboard-only":void 0),ref:h,children:[!s&&n.length===0&&u.jsx("div",{className:Pe("picker-empty"),children:e("tools.empty")}),n.map((y,w)=>{const b=c.has(y.name),v=y.description??"";return u.jsxs("div",{id:hN(w),role:"option","aria-selected":!1,"aria-expanded":v?b:void 0,className:Pe("picker-item","picker-session-item","tools-picker-item",w===i?"selected":void 0,b?"tools-picker-item-expanded":void 0),onClick:()=>{o(w),y.description&&f(y)},onMouseMove:()=>o(w),children:[u.jsxs("div",{className:Pe("picker-item-row"),children:[u.jsx("span",{className:Pe("tools-item-icon"),"aria-hidden":"true"}),u.jsx("span",{className:Pe("picker-item-title"),children:Q9e(y)}),u.jsx("span",{className:Pe("tools-status-badge",y.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:y.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),v?u.jsx("svg",{className:Pe("tools-item-chevron",b?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),b&&v&&u.jsx("div",{className:Pe("tools-desc-expanded"),children:u.jsx("div",{className:Pe("tools-desc-body"),children:v})})]},y.name)})]})]})}const J9e="_chart_1xbk4_1",Z9e="_plot_1xbk4_8",eTe="_svg_1xbk4_13",tTe="_cursor_1xbk4_30",nTe="_tooltip_1xbk4_40",sTe="_tooltipBelow_1xbk4_62",rTe="_tooltipTime_1xbk4_67",iTe="_tooltipRow_1xbk4_73",oTe="_tooltipLabel_1xbk4_79",aTe="_tooltipValue_1xbk4_83",lTe="_axis_1xbk4_91",cTe="_legend_1xbk4_96",uTe="_legendItem_1xbk4_105",dTe="_swatch_1xbk4_112",hTe="_legendLabel_1xbk4_118",fTe="_legendValue_1xbk4_123",mTe="_peak_1xbk4_131",qr={chart:J9e,plot:Z9e,svg:eTe,cursor:tTe,tooltip:nTe,tooltipBelow:sTe,tooltipTime:rTe,tooltipRow:iTe,tooltipLabel:oTe,tooltipValue:aTe,axis:lTe,legend:cTe,legendItem:uTe,swatch:dTe,legendLabel:hTe,legendValue:fTe,peak:mTe},Wk=320,d0=64,Zi=3,B1=Wk-Zi*2,P1=d0-Zi*2;function fN(e,t){return Number.isFinite(e)?e:t}const pTe=84;function gTe(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}function yTe(e){return new Date(e).toLocaleTimeString()}function TF({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:s=yTe,zeroBased:r=!0,ariaLabel:i,peakLabel:o="peak"}){const a=g.useRef(null),[l,c]=g.useState(null),[d,h]=g.useState(!1),f=g.useRef(void 0),{paths:m,maxV:p,maxLen:y,min:w,span:b}=g.useMemo(()=>{const T=e.reduce((V,ee)=>Math.max(V,ee.values.length),0);let N=0,I=r?0:Number.POSITIVE_INFINITY;for(const V of e)for(const ee of V.values)Number.isFinite(ee)&&(ee>N&&(N=ee),ee<I&&(I=ee));Number.isFinite(I)||(I=0);const O=N-I||1,U=V=>T<=1?Zi+B1/2:Zi+V/(T-1)*B1,F=V=>Zi+P1-(fN(V,I)-I)/O*P1;return{paths:e.map(V=>{const ee=V.values.map((J,B)=>`${B===0?"M":"L"}${U(B).toFixed(1)},${F(J).toFixed(1)}`).join(" "),ce=V.values.length-1,$=ce>=0?{cx:U(ce),cy:F(V.values[ce]),color:V.color}:void 0;return{key:V.label,d:ee,color:V.color,dot:$}}),maxV:N,maxLen:T,min:I,span:O}},[e,r]),v=y>0,x=T=>y<=1?Zi+B1/2:Zi+T/(y-1)*B1,_=T=>Zi+P1-(fN(T,w)-w)/b*P1,E=T=>{const N=a.current;if(!N||y===0)return;const I=N.getBoundingClientRect();if(I.width===0)return;const O=(T.clientX-I.left)/I.width,U=Math.max(0,Math.min(y-1,Math.round(O*(y-1))));c(U),f.current===void 0&&(f.current=gTe(N));const F=f.current,j=F?F.getBoundingClientRect().top:0;h(I.top-j<pTe)},k=()=>c(null),M=l!=null&&l>=0&&l<y?l:null,R=M!=null?x(M):0,L=M!=null&&y>1?M/(y-1)*100:50;return u.jsxs("div",{className:qr.chart,children:[u.jsxs("div",{className:qr.plot,children:[u.jsxs("svg",{ref:a,viewBox:`0 0 ${Wk} ${d0}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:qr.svg,onPointerMove:E,onPointerLeave:k,children:[u.jsx("line",{x1:Zi,y1:d0-Zi,x2:Wk-Zi,y2:d0-Zi,className:qr.axis,vectorEffect:"non-scaling-stroke"}),m.map(T=>u.jsx("path",{d:T.d,fill:"none",stroke:T.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},T.key)),M!=null&&u.jsxs(u.Fragment,{children:[u.jsx("line",{x1:R,y1:Zi,x2:R,y2:d0-Zi,className:qr.cursor,vectorEffect:"non-scaling-stroke"}),e.map(T=>M<T.values.length?u.jsx("circle",{cx:R,cy:_(T.values[M]),r:2.5,fill:T.color,vectorEffect:"non-scaling-stroke"},`${T.label}-hover`):null)]}),M==null&&m.map(T=>T.dot?u.jsx("circle",{cx:T.dot.cx,cy:T.dot.cy,r:2,fill:T.dot.color,vectorEffect:"non-scaling-stroke"},`${T.key}-dot`):null)]}),M!=null&&u.jsxs("div",{className:`${qr.tooltip} ${d?qr.tooltipBelow:""}`,style:{left:`${L}%`},role:"tooltip",children:[t&&t[M]!=null&&u.jsx("div",{className:qr.tooltipTime,children:s(t[M])}),e.map(T=>M<T.values.length?u.jsxs("div",{className:qr.tooltipRow,children:[u.jsx("svg",{className:qr.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:u.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:T.color})}),u.jsx("span",{className:qr.tooltipLabel,children:T.label}),u.jsx("span",{className:qr.tooltipValue,children:n(T.values[M])})]},T.label):null)]})]}),u.jsxs("div",{className:qr.legend,children:[e.map(T=>{const N=T.values.length?T.values[T.values.length-1]:void 0;return u.jsxs("span",{className:qr.legendItem,children:[u.jsx("svg",{className:qr.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:u.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:T.color})}),u.jsx("span",{className:qr.legendLabel,children:T.label}),N!==void 0&&u.jsx("span",{className:qr.legendValue,children:n(N)})]},T.label)}),v&&u.jsx("span",{className:qr.peak,children:`${o} ${n(p)}`})]})]})}const bTe="_wrap_1icv6_1",vTe="_tooltip_1icv6_11",wTe="_legend_1icv6_27",xTe="_legendLabel_1icv6_35",_Te="_scroll_1icv6_39",kTe="_grid_1icv6_44",STe="_month_1icv6_51",TTe="_weekday_1icv6_59",CTe="_cell_1icv6_69",ATe="_legendCell_1icv6_75",ETe="_lvl0_1icv6_82",MTe="_lvl1_1icv6_85",NTe="_lvl2_1icv6_88",ITe="_lvl3_1icv6_91",jTe="_lvl4_1icv6_94",RTe="_today_1icv6_98",Ii={wrap:bTe,tooltip:vTe,legend:wTe,legendLabel:xTe,scroll:_Te,grid:kTe,month:STe,weekday:TTe,cell:CTe,legendCell:ATe,lvl0:ETe,lvl1:MTe,lvl2:NTe,lvl3:ITe,lvl4:jTe,today:RTe},x4=864e5,LTe=4;function _4(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function mN(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${s}`}function DTe(e){const t=e.filter(s=>s>0).sort((s,r)=>s-r);if(t.length===0)return[0,0,0];const n=s=>t[Math.min(t.length-1,Math.floor(s*(t.length-1)))];return[n(.25),n(.5),n(.75)]}function OTe(e,[t,n,s]){return e<=0?0:e<=t?1:e<=n?2:e<=s?3:LTe}function BTe(e,t,n){const s=Math.max(1,Math.floor(t)),r=_4(Date.now()),i=_4(r.getTime()-(s-1)*x4),o=(i.getDay()+6)%7,a=_4(i.getTime()-o*x4),l=Math.round((r.getTime()-a.getTime())/x4)+1,c=[],d=[],h=mN(r),f=new Date(a.getTime());for(let x=0;x<l;x++){const _=mN(f),E=e[_],k=(E==null?void 0:E.tokens)??0;d.push(k),c.push({dateKey:_,tokens:k,cacheReadRate:(E==null?void 0:E.cacheReadRate)??0,isToday:_===h,weekday:x%7,week:Math.floor(x/7)}),f.setDate(f.getDate()+1)}const m=DTe(d),p=c.map(x=>({...x,level:OTe(x.tokens,m)})),y=Math.ceil(l/7),w=[];let b=-1;const v=new Date(a.getTime());for(let x=0;x<y;x++){const _=v.getMonth();_!==b&&(w.push({week:x,text:v.toLocaleDateString(n,{month:"short"})}),b=_),v.setDate(v.getDate()+7)}return{cells:p,months:w,weeks:y}}function PTe({heatmap:e,days:t}){const{t:n,language:s}=Xe(),r=g.useMemo(()=>BTe(e,t,s),[e,t,s]),i=g.useRef(null),[o,a]=g.useState(null),l={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},c=d=>{const h=d.target.closest("[data-date]"),f=i.current;if(!h||!f)return;const m=h.dataset.date??"",p=Number(h.dataset.tokens??"0"),y=Number(h.dataset.cache??"0"),w=h.getBoundingClientRect(),b=f.getBoundingClientRect();a({left:w.left-b.left+w.width/2,top:w.top-b.top,text:n("daemon.usage.cellTokens",{date:m,tokens:rf(p),cache:Math.round(y*100)})})};return u.jsxs("div",{className:Ii.wrap,ref:i,children:[u.jsxs("div",{className:Ii.legend,children:[u.jsx("span",{className:Ii.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>u.jsx("span",{className:`${Ii.cell} ${Ii.legendCell} ${Ii[`lvl${d}`]}`},d)),u.jsx("span",{className:Ii.legendLabel,children:n("daemon.usage.high")})]}),u.jsx("div",{className:Ii.scroll,onMouseOver:c,onMouseLeave:()=>a(null),children:u.jsxs("div",{className:Ii.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${r.weeks}, var(--hm-cell))`},children:[r.months.map(d=>u.jsx("div",{className:Ii.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>u.jsx("div",{className:Ii.weekday,style:{gridColumn:1,gridRow:d+2},children:l[d]},`wd-${d}`)),r.cells.map(d=>u.jsx("div",{className:`${Ii.cell} ${Ii[`lvl${d.level}`]} ${d.isToday?Ii.today:""}`,style:{gridColumn:d.week+2,gridRow:d.weekday+2},"data-date":d.dateKey,"data-tokens":d.tokens,"data-cache":d.cacheReadRate},d.dateKey))]})}),o&&u.jsx("div",{className:Ii.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const $Te="_usage_1kfmt_1",zTe="_toolbar_1kfmt_9",FTe="_segmented_1kfmt_14",qTe="_segment_1kfmt_14",HTe="_segmentActive_1kfmt_41",UTe="_hero_1kfmt_48",VTe="_heroMain_1kfmt_59",WTe="_heroLabel_1kfmt_63",GTe="_heroNumber_1kfmt_71",KTe="_heroSub_1kfmt_82",YTe="_refresh_1kfmt_87",QTe="_stats_1kfmt_109",XTe="_stat_1kfmt_109",JTe="_statValue_1kfmt_121",ZTe="_statLabel_1kfmt_130",eCe="_section_1kfmt_139",tCe="_sectionTitle_1kfmt_145",nCe="_sectionSub_1kfmt_154",sCe="_breakdown_1kfmt_161",rCe="_metric_1kfmt_167",iCe="_metricHead_1kfmt_173",oCe="_tick_1kfmt_179",aCe="_tick_input_1kfmt_186",lCe="_tick_output_1kfmt_190",cCe="_tick_cache_1kfmt_198",uCe="_metricLabel_1kfmt_202",dCe="_metricValue_1kfmt_209",hCe="_metricHint_1kfmt_219",fCe="_state_1kfmt_225",mCe="_modelList_1kfmt_233",pCe="_modelRow_1kfmt_239",gCe="_modelHead_1kfmt_245",yCe="_modelRank_1kfmt_251",bCe="_modelMeta_1kfmt_262",vCe="_modelName_1kfmt_267",wCe="_modelSub_1kfmt_277",xCe="_modelShare_1kfmt_282",_Ce="_modelTrack_1kfmt_289",kCe="_modelFill_1kfmt_296",SCe="_modelFillCache_1kfmt_303",TCe="_skillTable_1kfmt_310",CCe="_right_1kfmt_334",ACe="_bars_1kfmt_339",ECe="_barsBody_1kfmt_345",MCe="_barCol_1kfmt_352",NCe="_bar_1kfmt_339",ICe="_barsCaption_1kfmt_371",It={usage:$Te,toolbar:zTe,segmented:FTe,segment:qTe,segmentActive:HTe,hero:UTe,heroMain:VTe,heroLabel:WTe,heroNumber:GTe,heroSub:KTe,refresh:YTe,stats:QTe,stat:XTe,statValue:JTe,statLabel:ZTe,section:eCe,sectionTitle:tCe,sectionSub:nCe,breakdown:sCe,metric:rCe,metricHead:iCe,tick:oCe,tick_input:aCe,tick_output:lCe,tick_cache:cCe,metricLabel:uCe,metricValue:dCe,metricHint:hCe,state:fCe,modelList:mCe,modelRow:pCe,modelHead:gCe,modelRank:yCe,modelMeta:bCe,modelName:vCe,modelSub:wCe,modelShare:xCe,modelTrack:_Ce,modelFill:kCe,modelFillCache:SCe,skillTable:TCe,right:CCe,bars:ACe,barsBody:ECe,barCol:MCe,bar:NCe,barsCaption:ICe},CF=12,jCe=Math.round(CF*30.44),RCe=["today","week","month"],LCe={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},DCe={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},OCe={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},pN=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function BCe(e){return new Date(`${e}T00:00:00`).getTime()}function k4(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function PCe(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function $1({label:e,value:t}){return u.jsxs("div",{className:It.stat,children:[u.jsx("div",{className:It.statValue,children:t.toLocaleString()}),u.jsx("div",{className:It.statLabel,children:e})]})}function S4({accent:e,value:t,label:n,hint:s}){return u.jsxs("div",{className:It.metric,children:[u.jsxs("div",{className:It.metricHead,children:[u.jsx("span",{className:`${It.tick} ${It[`tick_${e}`]}`}),u.jsx("span",{className:It.metricLabel,children:n})]}),u.jsx("div",{className:It.metricValue,children:t}),u.jsx("div",{className:It.metricHint,children:s})]})}function $Ce({rank:e,model:t,color:n}){const{t:s}=Xe(),r=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return u.jsxs("div",{className:It.modelRow,children:[u.jsxs("div",{className:It.modelHead,children:[u.jsx("span",{className:It.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),u.jsxs("div",{className:It.modelMeta,children:[u.jsx("div",{className:It.modelName,children:t.model}),u.jsx("div",{className:It.modelSub,children:s("daemon.usage.modelMeta",{tokens:rf(t.totalTokens),cache:Math.round(i)})})]}),u.jsxs("span",{className:It.modelShare,style:{color:n},children:[Math.round(r),"%"]})]}),u.jsx("div",{className:It.modelTrack,children:u.jsx("div",{className:It.modelFill,style:{width:`${r}%`,background:n},children:u.jsx("div",{className:It.modelFillCache,style:{width:`${i}%`}})})})]})}function zCe({points:e,format:t,locale:n}){const s=Math.max(1,...e.map(r=>r.value));return u.jsxs("div",{className:It.bars,children:[u.jsx("div",{className:It.barsBody,children:e.map((r,i)=>u.jsx("div",{className:It.barCol,title:`${k4(r.label,n)} · ${t(r.value)}`,children:u.jsx("div",{className:It.bar,style:{height:`${r.value/s*100}%`}})},`${r.label}-${i}`))}),e.length>1&&u.jsxs("div",{className:It.barsCaption,children:[u.jsx("span",{children:k4(e[0].label,n)}),u.jsx("span",{children:k4(e[e.length-1].label,n)})]})]})}function FCe(){const{t:e,language:t}=Xe(),[n,s]=g.useState("today"),{dashboard:r,loading:i,error:o,reload:a}=aY({range:n,heatmapDays:jCe,autoLoad:!0}),l=u.jsx("div",{className:It.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:RCe.map(v=>u.jsx("button",{type:"button",className:`${It.segment} ${v===n?It.segmentActive:""}`,"aria-pressed":v===n,onClick:()=>s(v),children:e(LCe[v])},v))});if(!r)return u.jsxs("div",{className:It.usage,children:[u.jsx("div",{className:It.toolbar,children:l}),i?u.jsx("div",{className:It.state,children:e("daemon.usage.loading")}):o?u.jsxs("div",{className:It.state,children:[e("daemon.usage.failed"),": ",o.message]}):u.jsx("div",{className:It.state,children:e("daemon.usage.empty")})]});const{summary:c,models:d,skills:h,daily:f,heatmap:m,heatmapDays:p}=r,y=c.linesAdded+c.linesRemoved,w=c.totalTokens>0||Object.keys(m).length>0,b=e(OCe[r.range]);return u.jsxs("div",{className:It.usage,"aria-busy":i,children:[u.jsx("div",{className:It.toolbar,children:l}),u.jsxs("header",{className:It.hero,children:[u.jsxs("div",{className:It.heroMain,children:[u.jsx("div",{className:It.heroLabel,children:e(DCe[r.range])}),u.jsx("div",{className:It.heroNumber,children:rf(c.totalTokens)}),u.jsx("div",{className:It.heroSub,children:e("daemon.usage.tokensConsumed")})]}),u.jsx("button",{type:"button",className:It.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),u.jsxs("div",{className:It.stats,children:[u.jsx($1,{label:e("daemon.usage.sessions"),value:c.sessions}),u.jsx($1,{label:e("daemon.usage.requests"),value:c.requests}),u.jsx($1,{label:e("daemon.usage.tools"),value:c.toolCalls}),u.jsx($1,{label:e("daemon.usage.changes"),value:y})]}),u.jsxs("section",{className:It.section,children:[u.jsx("h4",{className:It.sectionTitle,children:e("daemon.usage.breakdownTitle")}),u.jsxs("div",{className:It.breakdown,children:[u.jsx(S4,{accent:"input",value:rf(c.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),u.jsx(S4,{accent:"output",value:rf(c.outputTokens+c.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),u.jsx(S4,{accent:"cache",value:`${Math.round(c.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),u.jsxs("section",{className:It.section,children:[u.jsx("h4",{className:It.sectionTitle,children:e("daemon.usage.heatmapTitle")}),u.jsx("div",{className:It.sectionSub,children:e("daemon.usage.heatmapSub",{months:CF})}),w?u.jsx(PTe,{heatmap:m,days:p}):u.jsx("div",{className:It.state,children:e("daemon.usage.empty")})]}),d.length>0&&u.jsxs("section",{className:It.section,children:[u.jsxs("h4",{className:It.sectionTitle,children:[b," ",e("daemon.usage.modelShareTitle")]}),u.jsx("div",{className:It.sectionSub,children:e("daemon.usage.modelShareSub")}),u.jsx("div",{className:It.modelList,children:d.map((v,x)=>u.jsx($Ce,{rank:x+1,model:v,color:pN[x%pN.length]},v.model))})]}),h.length>0&&u.jsxs("section",{className:It.section,children:[u.jsxs("h4",{className:It.sectionTitle,children:[b," ",e("daemon.usage.skillTitle")]}),u.jsx("div",{className:It.sectionSub,children:e("daemon.usage.skillSub")}),u.jsxs("table",{className:It.skillTable,children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:e("daemon.usage.skillName")}),u.jsx("th",{className:It.right,children:e("daemon.usage.skillCount")})]})}),u.jsx("tbody",{children:h.map(v=>u.jsxs("tr",{children:[u.jsx("td",{children:v.name}),u.jsx("td",{className:It.right,children:v.count.toLocaleString()})]},v.name))})]})]}),f.length>1&&u.jsxs("section",{className:It.section,children:[u.jsxs("h4",{className:It.sectionTitle,children:[b," ",e("daemon.usage.dailyTokensTitle")]}),u.jsx("div",{className:It.sectionSub,children:e("daemon.usage.dailyTokensSub")}),u.jsx(TF,{series:[{label:e("daemon.usage.tokensConsumed"),values:f.map(v=>v.tokens),color:"var(--agent-blue-400)"}],timestamps:f.map(v=>BCe(v.date)),format:rf,formatTime:v=>PCe(v,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),f.length>1&&u.jsxs("section",{className:It.section,children:[u.jsxs("h4",{className:It.sectionTitle,children:[b," ",e("daemon.usage.dailySessionsTitle")]}),u.jsx("div",{className:It.sectionSub,children:e("daemon.usage.dailySessionsSub")}),u.jsx(zCe,{points:f.map(v=>({label:v.date,value:v.sessions})),format:v=>v.toLocaleString(),locale:t})]})]})}const qCe="_dialog_1c9dv_4",HCe="_toolbar_1c9dv_12",UCe="_toolbarActions_1c9dv_19",VCe="_updatedAt_1c9dv_26",WCe="_refreshError_1c9dv_31",GCe="_refreshButton_1c9dv_36",KCe="_badge_1c9dv_51",YCe="_levelOk_1c9dv_61",QCe="_levelWarning_1c9dv_66",XCe="_levelError_1c9dv_71",JCe="_levelUnavailable_1c9dv_76",ZCe="_tabs_1c9dv_81",eAe="_tab_1c9dv_81",tAe="_tabActive_1c9dv_106",nAe="_grid_1c9dv_114",sAe="_chartsGrid_1c9dv_113",rAe="_card_1c9dv_128",iAe="_cardTitle_1c9dv_135",oAe="_row_1c9dv_144",aAe="_rowLabel_1c9dv_153",lAe="_rowValue_1c9dv_157",cAe="_pathRow_1c9dv_166",uAe="_pathValue_1c9dv_160",dAe="_empty_1c9dv_187",hAe="_issueRow_1c9dv_192",fAe="_issueMessage_1c9dv_199",mAe="_featureChips_1c9dv_203",pAe="_featureChip_1c9dv_203",gAe="_summaryChip_1c9dv_224",yAe="_sessionRow_1c9dv_233",bAe="_sessionName_1c9dv_242",vAe="_sessionMeta_1c9dv_248",wAe="_activePrompt_1c9dv_257",xAe="_workspaceRow_1c9dv_261",_Ae="_workspaceRowHead_1c9dv_270",kAe="_workspaceName_1c9dv_276",SAe="_workspaceDuration_1c9dv_280",TAe="_workspaceError_1c9dv_287",CAe="_workspaceSummary_1c9dv_294",AAe="_workspaceCell_1c9dv_301",EAe="_workspaceCellLabel_1c9dv_310",MAe="_workspaceCellMessage_1c9dv_315",jt={dialog:qCe,toolbar:HCe,toolbarActions:UCe,updatedAt:VCe,refreshError:WCe,refreshButton:GCe,badge:KCe,levelOk:YCe,levelWarning:QCe,levelError:XCe,levelUnavailable:JCe,tabs:ZCe,tab:eAe,tabActive:tAe,grid:nAe,chartsGrid:sAe,card:rAe,cardTitle:iAe,row:oAe,rowLabel:aAe,rowValue:lAe,pathRow:cAe,pathValue:uAe,empty:dAe,issueRow:hAe,issueMessage:fAe,featureChips:mAe,featureChip:pAe,summaryChip:gAe,sessionRow:yAe,sessionName:bAe,sessionMeta:vAe,activePrompt:wAe,workspaceRow:xAe,workspaceRowHead:_Ae,workspaceName:kAe,workspaceDuration:SAe,workspaceError:TAe,workspaceSummary:CAe,workspaceCell:AAe,workspaceCellLabel:EAe,workspaceCellMessage:MAe},NAe=5e3,Eh=[{id:"overview",labelKey:"daemon.tab.overview"},{id:"usage",labelKey:"daemon.tab.usage"},{id:"metrics",labelKey:"daemon.tab.metrics"},{id:"diagnostics",labelKey:"daemon.tab.diagnostics"}];function AF(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),s=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${s}h ${r}m`:s>0?`${s}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function au(e){return e=Math.max(0,e),e>=6e4?AF(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function rv(e){const t=e/1024;if(t<1)return`${Math.round(e)} B`;const n=t/1024;return n<1?`${t.toFixed(t<10?1:0)} KB`:n>=1024?`${(n/1024).toFixed(2)} GB`:`${n.toFixed(1)} MB`}function z1(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function IAe(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function jAe(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function gN(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const RAe=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function LAe(e){if(!gN(e))return[];const t=[];for(const n of RAe){const s=e[n];if(Array.isArray(s))for(const r of s){if(!gN(r))continue;const i=r.status;if(i!=="warning"&&i!=="error")continue;const o=String(r.kind??r.name??r.serverName??n),a=typeof r.error=="string"?r.error:typeof r.hint=="string"?r.hint:void 0;t.push({label:o,status:i,message:a})}}return t}function Gk(e){switch(e){case"ok":return jt.levelOk;case"warning":return jt.levelWarning;case"error":return jt.levelError;default:return jt.levelUnavailable}}function ts({label:e,value:t}){return u.jsxs("div",{className:jt.row,children:[u.jsx("span",{className:jt.rowLabel,children:e}),u.jsx("span",{className:jt.rowValue,children:t})]})}function Uo({title:e,children:t}){return u.jsxs("section",{className:jt.card,children:[u.jsx("h3",{className:jt.cardTitle,children:e}),t]})}function DAe({name:e,section:t}){const{t:n}=Xe(),s=Object.entries(t.summary??{}),r=LAe(t.data);return u.jsxs("div",{className:jt.workspaceRow,children:[u.jsxs("div",{className:jt.workspaceRowHead,children:[u.jsx("span",{className:`${jt.badge} ${Gk(t.status)}`,children:n(`daemon.level.${t.status}`)}),u.jsx("span",{className:jt.workspaceName,children:e}),u.jsx("span",{className:jt.workspaceDuration,children:au(t.durationMs)})]}),t.error&&u.jsx("div",{className:jt.workspaceError,children:t.error.message}),r.map((i,o)=>u.jsxs("div",{className:jt.workspaceCell,children:[u.jsx("span",{className:`${jt.badge} ${Gk(i.status)}`,children:n(`daemon.level.${i.status}`)}),u.jsx("span",{className:jt.workspaceCellLabel,children:i.label}),i.message&&u.jsx("span",{className:jt.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),s.length>0&&u.jsx("div",{className:jt.workspaceSummary,children:s.map(([i,o])=>u.jsxs("span",{className:jt.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function OAe({report:e}){const{t}=Xe(),n=e.full;if(!n)return null;const s=Object.entries(n.workspace).sort(([r],[i])=>r.localeCompare(i));return u.jsxs(u.Fragment,{children:[u.jsx(Uo,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?u.jsx("div",{className:jt.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(r=>u.jsxs("div",{className:jt.sessionRow,children:[u.jsx("div",{className:jt.sessionName,children:r.displayName||r.sessionId}),u.jsxs("div",{className:jt.sessionMeta,children:[u.jsx("span",{children:t("common.clients",{count:r.clientCount})}),u.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:r.pendingPromptCount})}),u.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:r.pendingPermissionCount})}),r.hasActivePrompt&&u.jsx("span",{className:jt.activePrompt,children:t("daemon.full.session.prompting")})]})]},r.sessionId))}),u.jsx(Uo,{title:t("daemon.full.workspace.title"),children:s.length===0?u.jsx("div",{className:jt.empty,children:t("daemon.full.workspace.empty")}):s.map(([r,i])=>u.jsx(DAe,{name:r,section:i},r))}),u.jsxs(Uo,{title:t("daemon.full.auth.title"),children:[u.jsx(ts,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),u.jsx(ts,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),u.jsx(ts,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function BAe({series:e}){const{t}=Xe();if(e.length===0)return u.jsx(Uo,{title:t("daemon.charts.title"),children:u.jsx("div",{className:jt.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),s=e.map(i=>i.t),r=(i,o,a)=>u.jsx(Uo,{title:t(i),children:u.jsx(TF,{series:a,timestamps:s,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return u.jsxs("div",{className:`${jt.grid} ${jt.chartsGrid}`,children:[r("daemon.charts.concurrency",z1,[{label:t("daemon.charts.activePrompts"),values:n(i=>i.activePrompts),color:"var(--primary)"},{label:t("daemon.charts.queuedPrompts"),values:n(i=>i.queuedPrompts),color:"var(--warning-color)"},{label:t("daemon.charts.activeSessions"),values:n(i=>i.activeSessions),color:"var(--muted-foreground)"}]),r("daemon.charts.requests",z1,[{label:t("daemon.charts.reqTotal"),values:n(i=>i.requests),color:"var(--success-color)"},{label:t("daemon.charts.reqErrors"),values:n(i=>i.errors),color:"var(--error-color)"},{label:t("daemon.charts.reqRejected"),values:n(i=>i.rateLimitRejected),color:"var(--warning-color)"}]),r("daemon.charts.apiLatency",au,[{label:"p50",values:n(i=>i.latencyP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.latencyP95Ms),color:"var(--warning-color)"}]),r("daemon.charts.llmLatency",au,[{label:"p50",values:n(i=>i.llmApiP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.llmApiP95Ms),color:"var(--primary)"}]),r("daemon.charts.promptLatency",au,[{label:t("daemon.charts.queueWait"),values:n(i=>i.promptQueueWaitP95Ms),color:"var(--warning-color)"},{label:t("daemon.charts.promptDuration"),values:n(i=>i.promptDurationP95Ms),color:"var(--primary)"}]),r("daemon.charts.eventLoop",au,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}]),r("daemon.charts.cpu",IAe,[{label:t("daemon.charts.cpuDaemon"),values:n(i=>i.cpuPercent),color:"var(--muted-foreground)"},{label:t("daemon.charts.cpuChild"),values:n(i=>i.childCpuPercent),color:"var(--primary)"}]),r("daemon.charts.memory",rv,[{label:t("daemon.charts.rssDaemon"),values:n(i=>i.rssBytes),color:"var(--muted-foreground)"},{label:t("daemon.charts.heap"),values:n(i=>i.heapUsedBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.rssChild"),values:n(i=>i.childRssBytes),color:"var(--primary)"}]),r("daemon.charts.pipe",rv,[{label:t("daemon.charts.pipeIn"),values:n(i=>i.pipeInBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.pipeOut"),values:n(i=>i.pipeOutBytes),color:"var(--success-color)"}]),r("daemon.charts.connections",z1,[{label:"SSE",values:n(i=>i.sseConnections),color:"var(--primary)"},{label:"WS",values:n(i=>i.wsConnections),color:"var(--agent-blue-400)"},{label:"ACP",values:n(i=>i.acpConnections),color:"var(--muted-foreground)"}]),r("daemon.charts.tokens",z1,[{label:t("daemon.charts.tokensIn"),values:n(i=>i.tokensIn),color:"var(--agent-blue-400)"},{label:t("daemon.charts.tokensOut"),values:n(i=>i.tokensOut),color:"var(--success-color)"}])]})}function PAe(){var R;const{t:e}=Xe(),[t,n]=g.useState("overview"),s=g.useRef([]),r=(L,T)=>{var I;let N;if(L.key==="ArrowRight"||L.key==="ArrowDown")N=(T+1)%Eh.length;else if(L.key==="ArrowLeft"||L.key==="ArrowUp")N=(T-1+Eh.length)%Eh.length;else if(L.key==="Home")N=0;else if(L.key==="End")N=Eh.length-1;else return;L.preventDefault(),n(Eh[N].id),(I=s.current[N])==null||I.focus()},i=Y_({autoLoad:!0,detail:"summary"}),o=Y_({autoLoad:!0,detail:"full"}),a=i.reload,l=o.reload,c=g.useRef(!1);g.useEffect(()=>{const L=window.setInterval(()=>{document.hidden||c.current||(c.current=!0,a().finally(()=>{c.current=!1}))},NAe);return()=>window.clearInterval(L)},[a]);const d=g.useCallback(()=>{a(),l()},[a,l]),h=i.report??o.report,f=o.report,m=i.loading||o.loading,p=i.error??o.error;if(!h)return u.jsx("div",{className:jt.dialog,children:u.jsx("div",{className:jt.empty,children:p?`${e("daemon.loadFailed")}: ${p.message}`:e("daemon.loading")})});const y=f??h,{daemon:w,runtime:b,security:v,limits:x,capabilities:_}=h,E=b.transport.acp,k=Object.values(b.rateLimit.rejectedSinceStart).reduce((L,T)=>L+T,0),M=L=>L===null?e("daemon.limits.unlimited"):L;return u.jsxs("div",{className:jt.dialog,children:[u.jsxs("div",{className:jt.toolbar,children:[u.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${y.status}`)}`,className:`${jt.badge} ${Gk(y.status)}`,children:e(`daemon.level.${y.status}`)}),u.jsx("span",{className:jt.updatedAt,children:e("daemon.updatedAt",{time:new Date(h.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&u.jsx("span",{className:jt.refreshError,children:e("daemon.loadFailed")}),u.jsx("div",{className:jt.toolbarActions,children:u.jsx("button",{type:"button",className:jt.refreshButton,onClick:d,disabled:m,children:e("daemon.refresh")})})]}),y.issues.length>0&&u.jsx(Uo,{title:e("daemon.issues.title"),children:y.issues.map((L,T)=>u.jsxs("div",{className:jt.issueRow,children:[u.jsx("span",{className:`${jt.badge} ${L.severity==="error"?jt.levelError:jt.levelWarning}`,children:L.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),u.jsx("span",{className:jt.issueMessage,children:L.message})]},`${L.code}-${T}`))}),u.jsx("div",{className:jt.tabs,role:"tablist","aria-label":e("daemon.title"),children:Eh.map((L,T)=>u.jsx("button",{ref:N=>{s.current[T]=N},type:"button",role:"tab",id:`daemon-tab-${L.id}`,"aria-selected":L.id===t,"aria-controls":`daemon-tabpanel-${L.id}`,tabIndex:L.id===t?0:-1,className:`${jt.tab} ${L.id===t?jt.tabActive:""}`,onClick:()=>n(L.id),onKeyDown:N=>r(N,T),children:e(L.labelKey)},L.id))}),t==="overview"&&u.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:jt.grid,children:[u.jsxs(Uo,{title:e("daemon.overview.title"),children:[w.qwenCodeVersion&&u.jsx(ts,{label:e("daemon.overview.version"),value:w.qwenCodeVersion}),u.jsx(ts,{label:e("daemon.overview.pid"),value:w.pid}),u.jsx(ts,{label:e("daemon.overview.mode"),value:w.mode}),u.jsx(ts,{label:e("daemon.overview.uptime"),value:AF(w.uptimeMs)}),u.jsxs("div",{className:jt.pathRow,children:[u.jsx("span",{className:jt.rowLabel,children:e("daemon.overview.workspace")}),u.jsx("span",{className:jt.pathValue,title:w.workspaceCwd,children:u.jsx("bdi",{children:w.workspaceCwd})})]})]}),u.jsxs(Uo,{title:e("daemon.runtime.title"),children:[b.error?u.jsxs("div",{className:jt.workspaceError,children:[e("daemon.runtime.startFailed"),": ",b.error]}):b.loading?u.jsx("div",{className:jt.empty,children:e("daemon.runtime.startingUp")}):null,u.jsx(ts,{label:e("daemon.runtime.activeSessions"),value:b.sessions.active}),b.activity&&u.jsxs(u.Fragment,{children:[u.jsx(ts,{label:e("daemon.runtime.activePrompts"),value:b.activity.activePrompts}),u.jsx(ts,{label:e("daemon.runtime.idle"),value:b.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):au(b.activity.idleSinceMs)})]}),u.jsx(ts,{label:e("daemon.runtime.pendingPermissions"),value:b.permissions.pending}),u.jsx(ts,{label:e("daemon.runtime.permissionPolicy"),value:b.permissions.policy}),u.jsx(ts,{label:e("daemon.runtime.channel"),value:b.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),b.channelWorker.enabled&&u.jsxs(u.Fragment,{children:[u.jsx(ts,{label:e("daemon.runtime.channelWorker"),value:jAe(b.channelWorker)}),b.channelWorker.error&&u.jsx("div",{className:jt.workspaceError,children:b.channelWorker.error}),(b.channelWorker.restartCount??0)>0&&u.jsx(ts,{label:e("daemon.runtime.channelWorkerRestarts"),value:b.channelWorker.restartCount})]}),u.jsx(ts,{label:e("daemon.runtime.memory"),value:`${rv(b.process.rss)} / ${rv(b.process.heapUsed)}`})]}),u.jsxs(Uo,{title:e("daemon.transport.title"),children:[u.jsx(ts,{label:e("daemon.transport.restSse"),value:b.transport.restSseActive}),E.enabled?u.jsxs(u.Fragment,{children:[u.jsx(ts,{label:e("daemon.transport.acpConnections"),value:E.connections}),u.jsx(ts,{label:e("daemon.transport.acpStreams"),value:`${E.sessionStreams} / ${E.sseStreams} / ${E.wsStreams}`}),u.jsx(ts,{label:e("daemon.transport.pendingRequests"),value:E.pendingClientRequests})]}):u.jsx("div",{className:jt.empty,children:e("daemon.transport.acpDisabled")}),u.jsx(ts,{label:e("daemon.transport.rateLimitRejected"),value:b.rateLimit.enabled?k:e("common.disabled")})]}),u.jsxs(Uo,{title:e("daemon.security.title"),children:[u.jsx(ts,{label:e("daemon.security.token"),value:v.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),u.jsx(ts,{label:e("daemon.security.requireAuth"),value:v.requireAuth?e("common.enabled"):e("common.disabled")}),u.jsx(ts,{label:e("daemon.security.loopback"),value:v.loopbackBind?e("common.enabled"):e("common.disabled")}),u.jsx(ts,{label:e("daemon.security.allowOrigin"),value:v.allowOriginMode}),u.jsx(ts,{label:e("daemon.security.shell"),value:v.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),u.jsxs(Uo,{title:e("daemon.limits.title"),children:[u.jsx(ts,{label:e("daemon.limits.maxSessions"),value:M(x.maxSessions)}),u.jsx(ts,{label:e("daemon.limits.maxPendingPrompts"),value:M(x.maxPendingPromptsPerSession)}),u.jsx(ts,{label:e("daemon.limits.maxConnections"),value:M(x.listenerMaxConnections)}),u.jsx(ts,{label:e("daemon.limits.eventRing"),value:x.eventRingSize}),u.jsx(ts,{label:e("daemon.limits.promptDeadline"),value:x.promptDeadlineMs===null?e("daemon.limits.unlimited"):au(x.promptDeadlineMs)}),u.jsx(ts,{label:e("daemon.limits.sessionIdle"),value:au(x.sessionIdleTimeoutMs)})]}),u.jsx(Uo,{title:_.features.length?e("daemon.capabilities.titleCount",{count:_.features.length}):e("daemon.capabilities.title"),children:_.features.length===0?u.jsx("span",{className:jt.empty,children:e("daemon.none")}):u.jsx("div",{className:jt.featureChips,children:[..._.features].sort().map(L=>u.jsx("span",{className:jt.featureChip,children:L},L))})})]}),t==="usage"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:u.jsx(mc,{label:"daemon-usage",fallback:u.jsx("div",{className:jt.empty,children:e("daemon.usage.failed")}),children:u.jsx(FCe,{})})}),t==="metrics"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:u.jsx(BAe,{series:((R=h.runtime.metrics)==null?void 0:R.series)??[]})}),t==="diagnostics"&&u.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:u.jsx(mc,{label:"daemon-status-detail",fallback:u.jsx("div",{className:jt.empty,children:e("daemon.details.failed")}),children:f!=null&&f.full?u.jsx(OAe,{report:f}):o.loading?u.jsx("div",{className:jt.empty,children:e("daemon.details.loading")}):o.error?u.jsxs("div",{className:jt.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):u.jsx("div",{className:jt.empty,children:e("daemon.details.failed")})})})]})}function $Ae(){const{t:e}=Xe();return u.jsx(mc,{label:"daemon-status",fallback:t=>u.jsx("div",{className:jt.dialog,children:u.jsxs("div",{className:jt.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:u.jsx(PAe,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const EF="split",_f=6;function zAe(e,t,n){const s=new URL(t);return s.pathname="/",s.searchParams.set(EF,e.join(",")),n&&(s.hash=new URLSearchParams({token:n}).toString()),s.toString()}function FAe(e){const t=new URLSearchParams(e).get(EF);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}function qAe(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?GAe(e):""}let h0;const HAe="qwen-daemon-auth",UAe=2500;function MF(){return h0||(typeof window>"u"?void 0:(h0=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,h0))}function VAe(e=UAe){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const s=o=>{n||(n=!0,window.removeEventListener("message",r),clearTimeout(i),h0=o,t(o))},r=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const a=o.data;if((a==null?void 0:a.type)!==HAe)return;const l=typeof a.token=="string"?a.token:"";s(l.trim()||void 0)},i=setTimeout(()=>s(void 0),e);window.addEventListener("message",r)})}function WAe(){if(typeof window>"u")return;const e=new URL(window.location.href);let t=!1;if(e.searchParams.has("token")&&(e.searchParams.delete("token"),t=!0),e.hash){const n=new URLSearchParams(e.hash.replace(/^#/,""));if(n.has("token")){n.delete("token");const s=n.toString();e.hash=s?`#${s}`:"",t=!0}}t&&window.history.replaceState(null,"",e)}function GAe(e){try{const t=new URL(e,window.location.origin);if(!(t.protocol==="http:"||t.protocol==="https:"))return"";if(t.origin===window.location.origin)return t.origin;if(!(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"))return"";const r=window.location.port||(window.location.protocol==="https:"?"443":"80");return(t.port||(t.protocol==="https:"?"443":"80"))!==r?"":t.origin}catch{return""}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const iv=1e3,p8="session_organization",KAe="_panel_1e9jm_1",YAe="_toolbar_1e9jm_9",QAe="_count_1e9jm_16",XAe="_selectAll_1e9jm_21",JAe="_actionButton_1e9jm_30",ZAe="_refreshButton_1e9jm_46",eEe="_notice_1e9jm_57",tEe="_grid_1e9jm_67",nEe="_card_1e9jm_76",sEe="_cardCurrent_1e9jm_87",rEe="_cardTop_1e9jm_92",iEe="_cardCheckbox_1e9jm_99",oEe="_colorDot_1e9jm_104",aEe="_cardLabel_1e9jm_111",lEe="_currentBadge_1e9jm_131",cEe="_cardMeta_1e9jm_141",uEe="_metaItem_1e9jm_149",dEe="_statusBadge_1e9jm_158",hEe="_statusApproval_1e9jm_168",fEe="_statusRunning_1e9jm_177",mEe="_statusIdle_1e9jm_186",pEe="_empty_1e9jm_195",gEe="_colorRed_1e9jm_203",yEe="_colorOrange_1e9jm_206",bEe="_colorYellow_1e9jm_209",vEe="_colorGreen_1e9jm_212",wEe="_colorBlue_1e9jm_215",xEe="_colorPurple_1e9jm_218",zn={panel:KAe,toolbar:YAe,count:QAe,selectAll:XAe,actionButton:JAe,refreshButton:ZAe,notice:eEe,grid:tEe,card:nEe,cardCurrent:sEe,cardTop:rEe,cardCheckbox:iEe,colorDot:oEe,cardLabel:aEe,currentBadge:lEe,cardMeta:cEe,metaItem:uEe,statusBadge:dEe,statusApproval:hEe,statusRunning:fEe,statusIdle:mEe,empty:pEe,colorRed:gEe,colorOrange:yEe,colorYellow:bEe,colorGreen:vEe,colorBlue:wEe,colorPurple:xEe},_Ee=3e3,kEe=1e4,yN={needsApproval:0,running:1,idle:2};function SEe(e,t,n){const s=new Map(t.map(i=>[i.sessionId,i])),r=e.map(i=>{var c;const o=s.get(i.sessionId),a=i.hasActivePrompt??(o==null?void 0:o.hasActivePrompt)??!1,l=((o==null?void 0:o.pendingPermissionCount)??0)>0;return{sessionId:i.sessionId,label:((c=i.displayName)==null?void 0:c.trim())||i.sessionId.slice(0,8),status:l?"needsApproval":a?"running":"idle",clientCount:i.clientCount??(o==null?void 0:o.clientCount)??0,model:o==null?void 0:o.currentModelId,updatedAt:i.updatedAt||i.createdAt,color:i.color,isCurrent:i.sessionId===n}});return r.sort((i,o)=>{const a=yN[i.status]-yN[o.status];return a!==0?a:(o.updatedAt??"").localeCompare(i.updatedAt??"")}),r}function T4(...e){return e.filter(Boolean).join(" ")}function TEe(e){switch(e){case"red":return zn.colorRed;case"orange":return zn.colorOrange;case"yellow":return zn.colorYellow;case"green":return zn.colorGreen;case"blue":return zn.colorBlue;case"purple":return zn.colorPurple;default:return}}function bN(e){switch(e){case"needsApproval":return zn.statusApproval;case"running":return zn.statusRunning;default:return zn.statusIdle}}function CEe({onOpenSession:e,onOpenSplit:t}){var O,U;const{t:n}=Xe(),s=ha(),r=s.sessionId,i=((U=(O=s.capabilities)==null?void 0:O.features)==null?void 0:U.includes(p8))??!1,{sessions:o,loading:a,error:l,reload:c}=qd({autoLoad:!0,pageSize:iv,archiveState:"active",...i?{view:"organized",group:"all"}:{}}),d=Y_({autoLoad:!0,detail:"full"}),h=d.reload,f=d.report,[m,p]=g.useState(()=>new Set),[y,w]=g.useState(!1),b=g.useRef(!1);g.useEffect(()=>{const F=window.setInterval(()=>{document.hidden||b.current||(b.current=!0,c().finally(()=>{b.current=!1}))},_Ee);return()=>window.clearInterval(F)},[c]);const v=g.useRef(!1);g.useEffect(()=>{const F=window.setInterval(()=>{document.hidden||v.current||(v.current=!0,h().finally(()=>{v.current=!1}))},kEe);return()=>window.clearInterval(F)},[h]);const x=g.useMemo(()=>{var F;return SEe(o,((F=f==null?void 0:f.full)==null?void 0:F.sessions)??[],r)},[o,f,r]),_=g.useCallback(F=>{p(j=>{const V=new Set(j);return V.has(F)?V.delete(F):V.add(F),V})},[]),E=x.map(F=>F.sessionId).filter(F=>m.has(F)),k=E.length,M=x.length>0&&k===x.length,R=E.slice(0,_f),L=k>_f,T=g.useCallback(()=>{p(F=>{const j=x.map(ee=>ee.sessionId);return j.length>0&&j.every(ee=>F.has(ee))?new Set:new Set(j)})},[x]);g.useEffect(()=>{p(F=>{if(F.size===0)return F;const j=new Set(x.map(ce=>ce.sessionId));let V=!1;const ee=new Set;for(const ce of F)j.has(ce)?ee.add(ce):V=!0;return V?ee:F})},[x]);const N=g.useCallback(()=>{if(R.length===0)return;const F=zAe(R,window.location.href,MF()),j=window.open(F,"_blank");j&&(j.opener=null,j.focus()),w(!j)},[R]),I=g.useCallback(()=>{c(),h()},[c,h]);return x.length===0?u.jsx("div",{className:zn.panel,children:u.jsx("div",{className:zn.empty,children:a?n("sessionsOverview.loading"):l?`${n("sessionsOverview.loadFailed")}: ${l.message}`:n("sessionsOverview.empty")})}):u.jsxs("div",{className:zn.panel,children:[u.jsxs("div",{className:zn.toolbar,children:[u.jsx("span",{className:zn.count,children:n("sessionsOverview.count",{count:x.length})}),u.jsxs("label",{className:zn.selectAll,children:[u.jsx("input",{type:"checkbox",checked:M,onChange:T}),n("sessionsOverview.selectAll")]}),u.jsx("button",{type:"button",className:zn.actionButton,disabled:k===0,onClick:N,title:n("sessionsOverview.openInTabHint"),children:n("sessionsOverview.openInTab")}),t&&u.jsx("button",{type:"button",className:zn.actionButton,disabled:k===0,onClick:()=>t(R),title:n("sessionsOverview.openInSplitHint"),children:n("sessionsOverview.openInSplit")}),u.jsx("button",{type:"button",className:zn.refreshButton,onClick:I,children:n("sessionsOverview.refresh")})]}),L&&u.jsx("div",{className:zn.notice,role:"status",children:n("sessionsOverview.splitCap",{max:_f})}),y&&u.jsx("div",{className:zn.notice,role:"alert",children:n("sessionsOverview.popupBlocked")}),l&&u.jsxs("div",{className:zn.notice,role:"alert",children:[n("sessionsOverview.loadFailed"),": ",l.message]}),u.jsx("ul",{className:zn.grid,children:x.map(F=>u.jsxs("li",{className:T4(zn.card,bN(F.status),F.isCurrent&&zn.cardCurrent),children:[u.jsxs("div",{className:zn.cardTop,children:[u.jsx("input",{type:"checkbox",className:zn.cardCheckbox,checked:m.has(F.sessionId),onChange:()=>_(F.sessionId),"aria-label":n("sessionsOverview.selectSession",{name:F.label})}),F.color&&u.jsx("span",{className:T4(zn.colorDot,TEe(F.color)),"aria-hidden":"true"}),u.jsx("button",{type:"button",className:zn.cardLabel,onClick:()=>e(F.sessionId),title:F.label,children:F.label}),F.isCurrent&&u.jsx("span",{className:zn.currentBadge,children:n("sessionsOverview.current")})]}),u.jsxs("div",{className:zn.cardMeta,children:[u.jsx("span",{className:T4(zn.statusBadge,bN(F.status)),children:n(`sessionsOverview.status.${F.status}`)}),F.model&&u.jsx("span",{className:zn.metaItem,title:F.model,children:F.model}),F.clientCount>0&&u.jsx("span",{className:zn.metaItem,title:n("sessionsOverview.openElsewhere"),children:n("common.clients",{count:F.clientCount})}),F.updatedAt&&u.jsx("span",{className:zn.metaItem,children:h8(F.updatedAt,n)})]})]},F.sessionId))})]})}function AEe({onOpenSession:e,onOpenSplit:t}){const{t:n}=Xe();return u.jsx(mc,{label:"session-overview",fallback:s=>u.jsx("div",{className:zn.panel,children:u.jsxs("div",{className:zn.empty,children:[n("sessionsOverview.loadFailed"),": ",s.message]})}),children:u.jsx(CEe,{onOpenSession:e,onOpenSplit:t})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function EEe(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function MEe(e,t){return e.errorKind==="model_stream_interrupted"||e.source==="turn_error"&&e.text.trim().toLowerCase()==="terminated"?(t==null?void 0:t.modelStreamInterrupted)??e.text:e.text}function NEe(e,t){return e===void 0?{}:t?{data:{...xi(e)??{value:e},errorKind:t}}:{data:e}}function IEe(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.newSessionId=="string"?t.newSessionId.slice(0,8):null}function jEe(e){if(!e||typeof e!="object")return null;const t=e.messages;return Array.isArray(t)&&t.filter(s=>typeof s=="string").join(`
`).trim()||null}function REe(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function LEe(e){return REe(e)||!e.text&&!e.usage?null:e}function vN(e){return e.text.length===0}function DEe(e){const t=e.flatMap((n,s)=>{const r=xi(n),i=Oi(r,"content");return i?[{id:Oi(r,"id")??`plan-${s}`,content:i,status:FEe(Oi(r,"status")),...(()=>{const a=qEe(Oi(r,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function wN(e,t){if(!e)return t;if(!t)return e;const n=(e.cachedTokens??0)+(t.cachedTokens??0);return{inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,...n>0?{cachedTokens:n}:{}}}function OEe(e,t={}){var c,d,h;const n=[],s=((c=t.labels)==null?void 0:c.promptCancelled)??"Request cancelled.",r=new Map,i=new Map;let o=null,a=null,l=!1;for(let f=0;f<e.length;f++){const m=e[f],p=m.serverTimestamp??m.clientReceivedAt;switch(m.kind){case"user":{o=null,a=null,l=!1;const y=m,w=xi(y.meta),b=Oi(w,"source"),v={id:m.id,role:"user",content:y.text,timestamp:p,...b?{source:b}:{}};y.images&&y.images.length>0&&(v.images=y.images.map(x=>({data:x.data,mimeType:x.mimeType||"image/*"}))),n.push(v);break}case"assistant":{const y=LEe(m);if(!y)break;const w=y.parentToolCallId?r.get(y.parentToolCallId):void 0;if(w){xN(w,y.text);break}const b=tMe(y.text);if(b){let x=null,_=!1,E=0,k=0;for(const M of b)M.kind==="insight"?M.data.type==="insight_progress"?x=M.data:M.data.type==="insight_ready"?(_=!0,n.push({id:`${m.id}-ir-${E++}`,role:"insight_ready",path:M.data.path,timestamp:p})):M.data.type==="insight_error"&&(_=!0,n.push({id:`${m.id}-ie-${k++}`,role:"insight_error",error:M.data.error,timestamp:p})):(n.push({id:`${m.id}-t-${n.length}`,role:"assistant",content:M.text,timestamp:p}),o=n.length-1,a=null);x&&!_&&n.push({id:`${m.id}-ip`,role:"insight_progress",stage:x.stage,progress:x.progress,detail:x.detail,timestamp:p}),l=!0;break}const v=o!==null?n[o]:void 0;if(v&&v.role==="assistant"&&!l&&!vN(y)){const x=wN(v.usage,y.usage);n[o]={...v,content:v.content+y.text,isStreaming:y.streaming,...x?{usage:x}:{}},l=!1,a=null}else if(!vN(y))n.push({id:m.id,role:"assistant",content:y.text,isStreaming:y.streaming,timestamp:p,...y.usage?{usage:y.usage}:{}}),o=n.length-1,a=null,l=!1;else if(y.usage&&v&&v.role==="assistant"){const x=wN(v.usage,y.usage);n[o]={...v,...x?{usage:x}:{}}}break}case"thought":{const y=m,w=y.parentToolCallId?r.get(y.parentToolCallId):void 0;if(w){xN(w,y.text);break}const b=a!==null?n[a]:void 0;b&&b.role==="thinking"&&!l?(n[a]={...b,content:b.content+y.text,isStreaming:y.streaming},l=!1):(n.push({id:m.id,role:"thinking",content:y.text,isStreaming:y.streaming,timestamp:p}),a=n.length-1,l=!1),o=null;break}case"tool":{const w=HEe(m),b=i.get(w.callId);b!=null&&b.title&&(w.title=b.title),!w.args&&(b!=null&&b.args)&&(w.args=b.args);const v=w.parentToolCallId?r.get(w.parentToolCallId):void 0,x=r.get(w.callId);if(x){_N(x,w);break}if(v){BEe(v,w),r.set(w.callId,w);break}C4(n,m.id,w,p),r.set(w.callId,w),o=null,a=null,l=!0;break}case"shell":{const y=m,w=n[n.length-1];if(w&&w.role==="tool_group"){const b=PEe(w.tools),v=w.tools[b];if(v){const x=typeof v.rawOutput=="string"?v.rawOutput:"",_={...v,rawOutput:x+y.text};n[n.length-1]={...w,tools:[...w.tools.slice(0,b),_,...w.tools.slice(b+1)]},r.get(v.callId)===v&&r.set(v.callId,_)}}else n.push({id:m.id,role:"tool_group",tools:[{callId:m.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:y.text}],timestamp:p}),l=!0;break}case"user_shell":{const y=m;n.push({id:m.id,role:"user_shell",command:y.command,output:y.text,...y.cwd?{cwd:y.cwd}:{},timestamp:p}),l=!0;break}case"permission":{const y=m;VEe(y,i);const w=UEe(y);if(!w)break;const b=NF(w);if(!y.resolved)break;const v=r.get(w.callId);if(v){const x=v.status;w.toolName=v.toolName,y.resolved&&(A4(y.resolved)?w.status=b?w.status:"in_progress":(w.status="failed",w.endTime=y.updatedAt)),_N(v,w),y.resolved&&b&&A4(y.resolved)&&(v.status=x);break}if(y.resolved){A4(y.resolved)?(b||(w.status="in_progress"),C4(n,m.id,w,p),r.set(w.callId,w),l=!0):(w.status="failed",w.endTime=y.updatedAt,C4(n,m.id,w,p),r.set(w.callId,w),l=!0);break}break}case"status":case"debug":{const y=m,w=y.source==="session_branched"?IEe(y.data):null,b=y.source==="mid_turn_message_injected"?jEe(y.data):null,v=w&&((d=t.labels)!=null&&d.branchSuccess)?t.labels.branchSuccess(w):b&&((h=t.labels)!=null&&h.midTurnInserted)?t.labels.midTurnInserted(b):y.text;if(EEe(v))break;const x=zEe(v);if(x){n.push({id:m.id,role:"plan",todos:x,timestamp:p}),l=!0;break}n.push({id:m.id,role:"system",content:v,variant:"info",timestamp:p,...y.source?{source:y.source}:{},...y.data!==void 0?{data:y.data}:{}}),l=!0;break}case"error":{const y=m,w=y.errorKind;n.push({id:m.id,role:"system",content:MEe(y,t.labels),variant:"error",retryable:y.source==="turn_error",timestamp:p,...y.source?{source:y.source}:{},...NEe(y.data,w)}),l=!0;break}case"prompt_cancelled":n.push({id:m.id,role:"system",content:s,variant:"info",source:"prompt_cancelled",timestamp:p}),l=!0;break}}return n}function BEe(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function xN(e,t){e.subContent=(e.subContent||"")+t}function C4(e,t,n,s){const r=o=>NF(o)||_c(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!r(n)&&!i.tools.some(r)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:s})}function PEe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind==="execute"&&n.status==="in_progress")return t}for(let t=e.length-1;t>=0;t--)if(e[t].kind==="execute")return t;return e.length-1}function _N(e,t){e.status=t.status??e.status,e.title=t.title??e.title,e.toolName=t.toolName??e.toolName,e.kind=t.kind??e.kind,e.content=t.content??e.content,e.endTime=t.endTime??e.endTime,e.rawOutput=t.rawOutput??e.rawOutput,e.args=t.args??e.args,e.locations=t.locations??e.locations}function NF(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||$Ee(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function $Ee(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function zEe(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),s=xi(n);return(s==null?void 0:s.sessionUpdate)!=="plan"||!Array.isArray(s.entries)?void 0:DEe(s.entries)}catch{return}}function xi(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Oi(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function FEe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function qEe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function HEe(e){const t=GEe(e),n=WEe(e,t),s=KEe(e.content),r={running:"in_progress",pending:"pending",confirming:"pending",background:"pending",completed:"completed",failed:"failed",cancelled:"completed",canceled:"completed",in_progress:"in_progress"},i=e.status==="completed"||e.status==="failed"||e.status==="cancelled"||e.status==="canceled";return{callId:e.toolCallId,toolName:e.toolName||"unknown",title:e.title,status:(n?"pending":r[e.status])||e.status||"in_progress",kind:jF(e.toolName,e.toolKind),rawOutput:t,args:e.rawInput,parentToolCallId:e.parentToolCallId,startTime:e.createdAt,endTime:i&&!n?e.updatedAt:void 0,...s?{content:s}:{}}}function UEe(e){const t=xi(e.toolCall);if(!t)return;const n=IF(t);if(Array.isArray(n==null?void 0:n.questions))return;const s=xi(t._meta),r=Oi(t,"kind"),i=Oi(s,"toolName")??Oi(t,"toolName")??Oi(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(r==="fetch"?"web_fetch":r),o=Oi(t,"toolCallId")??Oi(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:Oi(t,"title")??e.title,status:"pending",kind:jF(i,r),args:n,startTime:e.createdAt}}function VEe(e,t){const n=xi(e.toolCall),s=Oi(n,"toolCallId")??Oi(n,"id");if(!s)return;const r=Oi(n,"title")??e.title,i=n?IF(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(s,{...r?{title:r}:{},...i?{args:i}:{}})}function A4(e){const[t="",n=""]=e.toLowerCase().split(":",2);return kN(t)?!0:t!=="selected"?!1:kN(n.trim())}function kN(e){return e==="allow"||e==="allowed"||e==="approve"||e==="approved"||e==="accept"||e==="accepted"||e==="confirm"||e==="confirmed"||e==="proceed"||e==="proceed_once"||e==="proceed_always_project"||e==="proceed_always_user"||e==="allow_once"||e==="allow_always"||e==="success"||e==="succeeded"}function IF(e){return xi(e.rawInput)??xi(e.input)??xi(e.args)}function WEe(e,t){var r;const n=(r=e.toolName)==null?void 0:r.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const s=xi(t);return(s==null?void 0:s.status)==="background"}function GEe(e){return YEe(e)&&e.status==="failed"?QEe(e)??e.details??e.rawOutput:!XEe(e.status)||!e.details?e.rawOutput??e.details:e.rawOutput&&typeof e.rawOutput=="object"&&!Array.isArray(e.rawOutput)?{...e.rawOutput,status:e.status,reason:e.details}:{status:e.status,reason:e.details,text:typeof e.rawOutput=="string"&&e.rawOutput?e.rawOutput:e.details}}function KEe(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const s=xi(n);if(!s)return[];const r=s.type;if(r==="content"){const i=xi(s.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(r==="diff"){const i=s.newText;if(typeof i!="string")return[];const o=s.path,a=s.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof a=="string"?{oldText:a}:{},newText:i}]}if(r==="terminal"){const i=s.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function YEe(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function QEe(e){if(!Array.isArray(e.content))return;const t=e.content.map(n=>{var s;return(s=n==null?void 0:n.content)==null?void 0:s.text}).filter(n=>!!n);if(!(!t||t.length===0))return t.join(`
`)}function XEe(e){return e==="cancelled"||e==="canceled"}const JEe=['"insight_progress":','"insight_ready":','"insight_error":'];function ZEe(e){try{const t=JSON.parse(e),n=xi(t.insight_progress);if(n&&typeof n.stage=="string"&&typeof n.progress=="number")return{type:"insight_progress",stage:n.stage,progress:n.progress,detail:typeof n.detail=="string"?n.detail:void 0};const s=xi(t.insight_ready);if(s&&typeof s.path=="string")return{type:"insight_ready",path:s.path};const r=xi(t.insight_error);if(r&&typeof r.error=="string")return{type:"insight_error",error:r.error}}catch{}return null}function eMe(e,t){if(e[t]!=="{")return null;let n=0,s=!1,r=!1;for(let i=t;i<e.length;i++){const o=e[i];if(r){r=!1;continue}if(o==="\\"&&s){r=!0;continue}if(o==='"'){s=!s;continue}if(!s){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function tMe(e){const t=[];let n=0,s=0,r=!1;for(;s<e.length;){const o=e.indexOf("{",s);if(o===-1)break;const a=e.slice(o+1).trimStart();if(!JEe.some(f=>a.startsWith(f))){s=o+1;continue}const c=eMe(e,o);if(!c){s=o+1;continue}const d=ZEe(c);if(!d){s=o+1;continue}r=!0;const h=e.slice(n,o).trim();h&&t.push({kind:"text",text:h}),t.push({kind:"insight",data:d}),n=o+c.length,s=n}if(!r)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function jF(e,t){if(t)return t;if(!e)return;const n=e.toLowerCase();if(n==="bash"||n==="execute")return"execute";if(n==="read")return"read";if(n==="edit"||n==="write")return"edit";if(n.includes("search")||n==="grep"||n==="glob")return"search";if(n==="agent"||n==="task")return"other"}function RF(e){const t=Qp();return g.useMemo(()=>OEe(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n}),modelStreamInterrupted:e("error.modelStreamInterrupted")}}),[t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Kk(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Tl(e.toolName):!0}function ov(e){return Ev.includes(e)}async function nMe({sessionActions:e,modelId:t,modeId:n,warn:s=console.warn}){await e.createSession();try{await e.attachSession()}catch(r){throw s("[WebShell] failed to attach new session:",r),await e.closeSession().catch(i=>{s("[WebShell] failed to close unattached session:",i)}),await e.clearSession().catch(i=>{s("[WebShell] failed to clear unattached session:",i)}),r}await Promise.all([t?e.setModel(t).catch(r=>{s("[WebShell] failed to set model for new session:",r)}):Promise.resolve(),n&&ov(n)?e.setApprovalMode(n).catch(r=>{s("[WebShell] failed to set approval mode for new session:",r)}):Promise.resolve()])}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const sMe=new Set(["coder-model(qwen-oauth)"]);function Yk(e){return!sMe.has(e.id)}function LF(e){return[{name:"help",description:e("local.help")},{name:"theme",description:e("local.theme"),argumentHint:"light|dark",subcommands:["light","dark"]},{name:"language",description:e("local.language"),argumentHint:"ui [en|zh-CN]",subcommands:["ui"]},{name:"plan",description:e("local.plan"),argumentHint:"<prompt>"},{name:"btw",description:e("local.btw"),argumentHint:"<your question>"},{name:"copy",description:e("local.copy"),argumentHint:"[code|<lang>|latex|inline-latex] [index]"},{name:"delete",description:e("local.delete")},{name:"release",description:e("local.release")},{name:"auth",description:e("local.auth")},{name:"approval-mode",description:e("local.approvalMode"),argumentHint:"<mode>"},{name:"model",description:e("local.model"),argumentHint:"[--fast|--voice|--vision] [<model>]"},{name:"mcp",description:e("local.mcp"),argumentHint:"desc|nodesc|schema"},{name:"skills",description:e("local.skills")},{name:"status",description:e("local.status")},{name:"stats",description:e("local.stats"),argumentHint:"[model|tools]",subcommands:["model","tools"]},{name:"tools",description:e("local.tools"),argumentHint:"[desc]"},{name:"memory",description:e("local.memory")},{name:"context",description:e("local.context"),argumentHint:"[detail]"},{name:"agents",description:e("local.agents"),argumentHint:"manage|create"},{name:"goal",description:e("local.goal"),argumentHint:"[<condition> | clear]"},{name:"tasks",description:e("local.tasks")},{name:"recap",description:e("local.recap")},{name:"rewind",description:e("local.rewind")},{name:"branch",description:e("local.branch"),argumentHint:"[<name>]"},{name:"fork",description:e("local.fork"),argumentHint:"<directive>"},{name:"clear",description:e("local.clear")},{name:"new",description:e("local.new")},{name:"reset",description:e("local.reset")},{name:"rename",description:e("local.rename"),argumentHint:"[--auto] [<name>]"},{name:"resume",description:e("local.resume"),argumentHint:"<session-id>"},{name:"settings",description:e("local.settings")},{name:"schedule",description:e("local.schedule")},{name:"extensions",description:e("local.extensions"),argumentHint:"manage|install <source>",subcommands:["manage","install"]}].map(n=>({...n,source:"builtin-command"}))}const rMe={bug:"local.bug",compress:"local.compress","compress-fast":"local.compressFast",config:"local.config",diff:"local.diff",directory:"local.directory",docs:"local.docs",doctor:"local.doctor",dream:"local.dream",effort:"local.effort",export:"local.export",forget:"local.forget",hooks:"local.hooks","import-config":"local.importConfig",init:"local.init",insight:"local.insight",lsp:"local.lsp",remember:"local.remember",summary:"local.summary",workflows:"local.workflows"},iMe={batch:"skilldesc.batch",dataviz:"skilldesc.dataviz","extension-creator":"skilldesc.extensionCreator",loop:"skilldesc.loop","new-app":"skilldesc.newApp","qc-helper":"skilldesc.qcHelper",review:"skilldesc.review",simplify:"skilldesc.simplify",stuck:"skilldesc.stuck","agent-reproduce-align":"skilldesc.agentReproduceAlign","agent-reproduce-feature":"skilldesc.agentReproduceFeature",autofix:"skilldesc.autofix",bugfix:"skilldesc.bugfix",codegraph:"skilldesc.codegraph","create-issue":"skilldesc.createIssue","desktop-pet":"skilldesc.desktopPet","docs-audit-and-refresh":"skilldesc.docsAuditAndRefresh","docs-update-from-diff":"skilldesc.docsUpdateFromDiff","e2e-testing":"skilldesc.e2eTesting","feat-dev":"skilldesc.featDev","memory-leak-debug":"skilldesc.memoryLeakDebug","openwork-desktop-sync":"skilldesc.openworkDesktopSync","prepare-pr":"skilldesc.preparePr","qwen-code-claw":"skilldesc.qwenCodeClaw","structured-debugging":"skilldesc.structuredDebugging","terminal-capture":"skilldesc.terminalCapture","tmux-real-user-testing":"skilldesc.tmuxRealUserTesting",triage:"skilldesc.triage"};function DF(e){return iMe[e]}function OF(e,t){return e.map(n=>{const s=rMe[n.name];return!s||n.source&&n.source!=="builtin-command"?n:{...n,description:t(s)}})}function BF(...e){const t=new Map;for(const n of e)for(const s of n){const r=t.get(s.name);r?t.set(s.name,{...r,...s,description:s.description||r.description,argumentHint:s.argumentHint??r.argumentHint}):t.set(s.name,s)}return[...t.values()]}const oMe="_approval_j86la_1",aMe="_floating_j86la_18",lMe="_header_j86la_31",cMe="_icon_j86la_41",uMe="_name_j86la_56",dMe="_desc_j86la_67",hMe="_content_j86la_87",fMe="_code_j86la_105",mMe="_codeBlock_j86la_113",pMe="_question_j86la_133",gMe="_options_j86la_139",yMe="_option_j86la_139",bMe="_optionPlain_j86la_167",vMe="_optionSecondary_j86la_177",wMe="_optionPrimary_j86la_184",xMe="_optionActive_j86la_195",_Me="_pointer_j86la_199",kMe="_num_j86la_203",SMe="_label_j86la_207",dr={approval:oMe,floating:aMe,header:lMe,icon:cMe,name:uMe,desc:dMe,content:hMe,code:fMe,codeBlock:mMe,question:pMe,options:gMe,option:yMe,optionPlain:bMe,optionSecondary:vMe,optionPrimary:wMe,optionActive:xMe,pointer:_Me,num:kMe,label:SMe};function TMe(e){if(!e)return{toolName:"",description:""};const t=e.indexOf(": ");if(t>0){const n=e.slice(0,t);return/^[A-Za-z][\w.-]{0,40}$/.test(n)?{toolName:n,description:e.slice(t+2)}:{toolName:e,description:""}}return{toolName:e,description:""}}function CMe(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function AMe(e){var n;const t=(n=e.toolName)==null?void 0:n.toLowerCase();return e.kind==="bash"||e.kind==="exec"||e.kind==="execute"||e.kind==="shell"||t==="run_shell_command"}function EMe(e){if(!e.rawInput)return null;const t=e.rawInput;return typeof t.command=="string"?t.command:typeof t.input=="string"?t.input:null}function MMe(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function SN(e){if(e.length>1&&(e[0].kind==="allow_always"||e[0].kind==="reject_always")){const t=e.findIndex(n=>n.kind==="allow_once"||n.kind==="reject_once");return t>=0?t:1}return 0}function TN(e){return e.kind==="reject_once"||e.kind==="reject_always"?0:e.kind==="allow_always"&&e.id==="proceed_always_user"?1:e.kind==="allow_always"&&e.id==="proceed_always_project"?2:e.kind==="allow_always"&&(e.id==="proceed_always_server"||e.id==="proceed_always_tool")||e.kind==="allow_always"?3:e.kind==="allow_once"?4:5}function F1(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const s=TN(t.option)-TN(n.option);return s===0?t.index-n.index:s}).map(({option:t})=>t)}function NMe(e){if(e.kind==="allow_once")return"approval.option.allowOnce";if(e.kind==="reject_once")return"approval.option.rejectOnce";if(e.kind==="allow_always"){if(e.id==="proceed_always_project")return"approval.option.allowAlwaysProject";if(e.id==="proceed_always_user")return"approval.option.allowAlwaysUser";if(e.id==="proceed_always_server")return"approval.option.allowAlwaysServer";if(e.id==="proceed_always_tool")return"approval.option.allowAlwaysTool";if(e.id==="proceed_always")return"approval.option.allowAllEdits"}}function IMe(e){return e.kind==="allow_once"?dr.optionPrimary:e.kind==="allow_always"?dr.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?dr.optionPlain:dr.optionSecondary}function PF({request:e,onConfirm:t,variant:n="inline",keyboardActive:s=!0}){const{t:r}=Xe(),i=g.useMemo(()=>F1(e.options),[e.options]),[o,a]=g.useState(()=>SN(F1(e.options))),l=g.useRef(e);l.current=e;const c=g.useRef(o),d=g.useRef(!1),h=g.useRef(!1);g.useEffect(()=>{const k=SN(F1(l.current.options));d.current=!1,h.current=!1,c.current=k,a(k)},[e.id]);const f=TMe(e.title),m=e.toolName||f.toolName||e.kind||"Tool",p=Sl(m,r),y=MMe(e),w=CMe(e),b=g.useCallback(k=>{d.current||(d.current=!0,t(l.current.id,k))},[t]),v=g.useCallback(k=>{if(k.defaultPrevented||bp(k.target))return;const M=l.current,R=F1(M.options),L=R.length;if(k.key==="ArrowUp"||k.key==="k")k.preventDefault(),h.current=!0,a(T=>{const N=(T-1+L)%L;return c.current=N,N});else if(k.key==="ArrowDown"||k.key==="j")k.preventDefault(),h.current=!0,a(T=>{const N=(T+1)%L;return c.current=N,N});else if(k.key==="Enter"){if(k.preventDefault(),!h.current){h.current=!0;return}const T=R[c.current];T&&b(T.id)}else if(k.key==="Escape"){k.preventDefault();const T=M.options.find(N=>N.kind==="reject_once"||N.kind==="reject_always");T&&b(T.id)}else if(k.key>="1"&&k.key<="9"){const T=parseInt(k.key)-1;T<L&&(k.preventDefault(),h.current=!0,b(R[T].id))}},[b]);g.useEffect(()=>{if(!s)return;const k=setTimeout(()=>{window.addEventListener("keydown",v)},250);return()=>{clearTimeout(k),window.removeEventListener("keydown",v)}},[v,s]);const x=AMe(e),_=eW(e.toolName),E=EMe(e);return u.jsxs("div",{className:n==="floating"?`${dr.approval} ${dr.floating}`:dr.approval,children:[u.jsxs("div",{className:dr.header,children:[u.jsx("span",{className:dr.icon,children:"?"}),u.jsx("span",{className:dr.name,children:p})]}),y&&u.jsx("div",{className:dr.desc,title:y,children:y}),x&&E?u.jsx("div",{className:dr.code,children:u.jsx("pre",{className:dr.codeBlock,title:E,children:E})}):w&&w!==e.title?u.jsx("pre",{className:dr.content,title:w,children:w}):null,u.jsx("div",{className:dr.question,children:_?r("approval.launchAgentQuestion"):x?r("approval.execQuestion",{tool:p}):r("approval.changeQuestion")}),u.jsx("div",{className:dr.options,children:i.map((k,M)=>{const R=M===o,L=NMe(k),T=L?r(L):k.label;return u.jsxs("div",{className:`${dr.option} ${IMe(k)} ${R?dr.optionActive:""}`,onClick:()=>b(k.id),children:[u.jsx("span",{className:dr.pointer,children:R?"›":" "}),u.jsxs("span",{className:dr.num,children:[M+1,"."]}),u.jsx("span",{className:dr.label,children:T})]},k.id)})})]})}const jMe="_question_1e2wi_1",RMe="_floating_1e2wi_18",LMe="_titleLine_1e2wi_30",DMe="_icon_1e2wi_39",OMe="_toolName_1e2wi_43",BMe="_toolDesc_1e2wi_47",PMe="_tabs_1e2wi_54",$Me="_tab_1e2wi_54",zMe="_tabActive_1e2wi_78",FMe="_text_1e2wi_95",qMe="_description_1e2wi_104",HMe="_multiHint_1e2wi_112",UMe="_options_1e2wi_118",VMe="_option_1e2wi_118",WMe="_optionActive_1e2wi_140",GMe="_optionSelected_1e2wi_141",KMe="_optionLabel_1e2wi_146",YMe="_pointer_1e2wi_151",QMe="_optionNum_1e2wi_155",XMe="_editIcon_1e2wi_172",JMe="_optionContent_1e2wi_204",ZMe="_optionPlaceholder_1e2wi_220",eNe="_optionDesc_1e2wi_225",tNe="_customInput_1e2wi_232",nNe="_actions_1e2wi_249",sNe="_button_1e2wi_257",rNe="_submitButton_1e2wi_283",iNe="_ignoreButton_1e2wi_289",Hn={question:jMe,floating:RMe,titleLine:LMe,icon:DMe,toolName:OMe,toolDesc:BMe,tabs:PMe,tab:$Me,tabActive:zMe,text:FMe,description:qMe,multiHint:HMe,options:UMe,option:VMe,optionActive:WMe,optionSelected:GMe,optionLabel:KMe,pointer:YMe,optionNum:QMe,editIcon:XMe,optionContent:JMe,optionPlaceholder:ZMe,optionDesc:eNe,customInput:tNe,actions:nNe,button:sNe,submitButton:rNe,ignoreButton:iNe};function $F({request:e,onConfirm:t,variant:n="inline"}){const{t:s}=Xe(),r=g.useMemo(()=>{var j;return Array.isArray((j=e.rawInput)==null?void 0:j.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,d]=g.useState({}),[h,f]=g.useState({}),[m,p]=g.useState({}),[y,w]=g.useState(!1),b=g.useRef(!1);g.useEffect(()=>{const j=r[0];b.current=!1,o(0),l(j!=null&&j.options.length?0:null),d(j&&!j.multiSelect&&j.options[0]?{0:j.options[0].label}:{}),f({}),p(j!=null&&j.multiSelect&&j.options[0]?{0:[j.options[0].label]}:{}),w(!1)},[r,e.id]);const v=r[i],x=(v==null?void 0:v.multiSelect)??!1,_=g.useCallback(()=>{const j={};for(let V=0;V<r.length;V++){const ee=r[V];if(ee)if(ee.multiSelect){const ce=m[V]||[],$=h[V],J=$?[...ce,$]:ce;j[String(V)]=J.join(", ")}else j[String(V)]=c[V]||h[V]||""}return j},[r,m,h,c]),E=g.useCallback(()=>{if(b.current)return;const j=e.options.find(V=>V.kind==="allow_once");j&&(b.current=!0,t(e.id,j.id,_()))},[_,e,t]),k=g.useCallback(()=>{if(b.current)return;const j=e.options.find(V=>V.kind==="reject_once"||V.kind==="reject_always");j&&(b.current=!0,t(e.id,j.id,void 0))},[e,t]),M=g.useCallback(j=>{j!==void 0&&f(V=>({...V,[i]:j})),x||d(V=>{if(!(i in V))return V;const ee={...V};return delete ee[i],ee}),w(!0)},[i,x]),R=g.useCallback(j=>{if(!v)return;if(j===v.options.length){M();return}const ee=v.options[j].label;if(x){const ce=m[i]||[],$=ce.includes(ee)?ce.filter(J=>J!==ee):[...ce,ee];p({...m,[i]:$})}else{const ce={...c,[i]:ee};d(ce),f($=>{if(!(i in $))return $;const J={...$};return delete J[i],J})}},[v,i,x,m,c,M]),L=g.useCallback(j=>{if(!v||!x)return;if(j===v.options.length){M();return}const V=v.options[j].label,ee=m[i]||[],ce=ee.includes(V)?ee.filter($=>$!==V):[...ee,V];p({...m,[i]:ce})},[v,x,m,i,M]);if(r.length===0)return null;const T=j=>{const V=r[j];return V?V.multiSelect?(m[j]||[]).length>0||!!h[j]:!!c[j]||!!h[j]:!1},N=r.every((j,V)=>T(V)),I=Math.min(i,r.length-1),O=j=>{const V=r[j];if(o(j),w(!1),!(V!=null&&V.options.length)){l(null);return}if(l(0),V.multiSelect){p(ee=>(ee[j]||[]).length>0||h[j]?ee:{...ee,[j]:[V.options[0].label]});return}d(ee=>ee[j]||h[j]?ee:{...ee,[j]:V.options[0].label})},U=()=>{i<=0||O(i-1)},F=()=>{i>=r.length-1||O(i+1)};return u.jsxs("div",{className:`${Hn.question} ${n==="floating"?Hn.floating:""}`,children:[u.jsxs("div",{className:Hn.titleLine,children:[u.jsx("span",{className:Hn.icon,children:"?"}),u.jsx("span",{className:Hn.toolName,children:Sl("ask_user_question",s)}),u.jsx("span",{className:Hn.toolDesc,children:s("askUser.progress",{current:I+1,total:r.length})})]}),u.jsx("div",{className:Hn.tabs,children:r.map((j,V)=>u.jsx("span",{className:`${Hn.tab} ${V===i?Hn.tabActive:""}`,"aria-hidden":"true"},V))}),v?u.jsxs(u.Fragment,{children:[u.jsxs("p",{className:Hn.text,children:[v.question,x&&u.jsxs("span",{className:Hn.multiHint,children:[" ","(",s("askUser.multiHint"),")"]})]}),u.jsx("p",{className:Hn.description,children:s("askUser.selectAnswer")}),u.jsxs("div",{className:Hn.options,onMouseLeave:()=>l(null),children:[v.options.map((j,V)=>{const ee=V===a,ce=x?(m[i]||[]).includes(j.label):c[i]===j.label;return u.jsxs("div",{className:`${Hn.option} ${ee?Hn.optionActive:""} ${ce?Hn.optionSelected:""}`,onClick:()=>{l(V),x?L(V):R(V)},onMouseEnter:()=>l(V),children:[u.jsx("span",{className:Hn.pointer,children:ee?"›":" "}),u.jsx("span",{className:Hn.optionNum,children:V+1}),u.jsxs("span",{className:Hn.optionContent,children:[u.jsx("span",{className:Hn.optionLabel,children:j.label}),j.description&&u.jsx("span",{className:Hn.optionDesc,children:j.description})]})]},j.label)}),(()=>{const j=a===v.options.length,V=!!h[i];return u.jsxs("div",{className:`${Hn.option} ${j?Hn.optionActive:""} ${V?Hn.optionSelected:""}`,onClick:()=>{l(v.options.length),M()},onMouseEnter:()=>l(v.options.length),children:[u.jsx("span",{className:Hn.pointer,children:j?"›":" "}),u.jsx("span",{className:Hn.editIcon,"aria-hidden":"true",children:u.jsx("svg",{viewBox:"0 0 16 16",children:u.jsx("path",{d:"M3.2 10.9 4 7.8 10.8 1l3.2 3.2-6.8 6.8-3 .8zM10 1.8l3.2 3.2M3 14h10",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}),y?u.jsx("input",{type:"text",className:Hn.customInput,placeholder:s("askUser.typePlaceholder"),value:h[i]||"",onChange:ee=>f({...h,[i]:ee.target.value}),onBlur:()=>w(!1),autoFocus:!0}):u.jsx("span",{className:`${Hn.optionLabel} ${h[i]?"":Hn.optionPlaceholder}`,children:h[i]||s("askUser.typePlaceholder")})]})})()]})]}):null,u.jsxs("div",{className:Hn.actions,children:[u.jsx("button",{type:"button",className:Hn.ignoreButton,onClick:k,children:s("askUser.ignore")}),r.length>1&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:Hn.button,disabled:i<=0,onClick:U,children:s("common.previous")}),u.jsx("button",{type:"button",className:Hn.button,disabled:i>=r.length-1,onClick:F,children:s("common.next")})]}),u.jsx("button",{type:"button",className:`${Hn.button} ${Hn.submitButton}`,disabled:!N,onClick:E,children:s("askUser.submit")})]})]})}const oNe="_pane_3wqlw_1",aNe="_header_3wqlw_13",lNe="_connectionError_3wqlw_25",cNe="_connectionErrorText_3wqlw_33",uNe="_title_3wqlw_40",dNe="_closeButton_3wqlw_51",hNe="_body_3wqlw_71",fNe="_footer_3wqlw_79",mNe="_approval_3wqlw_86",Ka={pane:oNe,header:aNe,connectionError:lNe,connectionErrorText:cNe,title:uNe,closeButton:dNe,body:hNe,footer:fNe,approval:mNe},pNe=["approvalMode","model","voice"];function gNe({title:e,onClose:t,onError:n}){var T;const{t:s}=Xe(),r=ha(),i=Xp(),o=RF(s),a=Qp(),l=Iv(),c=g.useCallback((N,I)=>{n?n(N,I):console.error(I,N)},[n]),d=g.useMemo(()=>BL(a),[a]),h=Kk(d),f=d&&!h?d:null,m=d&&h?d:null,p=g.useRef(f);p.current=f;const y=f!==null||m!==null,w=l!=="idle",b=g.useMemo(()=>{if(w)for(let N=o.length-1;N>=0;N--){const I=o[N];if((I==null?void 0:I.role)==="user")return I.timestamp}},[o,w]),v=g.useCallback((N,I,O)=>{const U=N.trim();return U&&i.sendPrompt(U,{...I&&I.length?{images:I}:{},onAdmitted:O}).catch(F=>c(F,"Failed to send prompt")),!1},[i,c]),x=g.useCallback((N,I,O)=>{i.submitPermission(N,I,O).catch(U=>c(U,"Failed to submit permission choice"))},[i,c]),_=g.useCallback(()=>{i.cancel().catch(N=>c(N,"Failed to cancel request"))},[i,c]),E=g.useMemo(()=>OF(BF(r.commands??[],LF(s)),s).map(N=>{const I=DF(N.name);return I?{...N,displayCategory:"skill",description:s(I)}:N}),[r.commands,s]),k=g.useMemo(()=>(r.models??[]).filter(Yk).map(N=>({id:N.id,label:Dp(N.label||N.id)})),[r.models]),M=g.useCallback(N=>{if(!ov(N)){c(new Error(`Unsupported approval mode: ${N}`),"Failed to set approval mode");return}i.setApprovalMode(N).then(()=>{const I=p.current;if(!I||!(N==="yolo"||N==="auto-edit"&&I.toolKind==="edit"))return;const U=I.options.find(F=>F.kind==="allow_once");U&&i.submitPermission(I.id,U.id).catch(F=>c(F,"Failed to auto-approve tool call"))}).catch(I=>c(I,"Failed to set approval mode"))},[i,c]),R=g.useCallback(N=>{i.setModel(N).catch(I=>c(I,"Failed to switch model"))},[i,c]),L=e||r.displayName||((T=r.sessionId)==null?void 0:T.slice(0,8))||"";return u.jsxs("section",{className:Ka.pane,"data-testid":"chat-pane","aria-label":L,children:[u.jsxs("header",{className:Ka.header,children:[u.jsx("span",{className:Ka.title,title:L,children:L}),t&&u.jsx("button",{type:"button",className:Ka.closeButton,onClick:t,"aria-label":s("splitView.closePane"),title:s("splitView.closePane"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:u.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),r.error&&u.jsx("div",{className:Ka.connectionError,role:"alert",children:u.jsxs("span",{className:Ka.connectionErrorText,children:[s("splitView.paneConnectionError"),": ",r.error]})}),u.jsx("div",{className:Ka.body,children:u.jsx(DP,{messages:o,pendingApproval:f,loadingTranscript:r.loadingTranscript,catchingUp:r.catchingUp,isResponding:w,workspaceCwd:r.workspaceCwd||"",hideSessionTimeline:!0})}),u.jsxs("div",{className:Ka.footer,children:[f&&u.jsx("div",{className:Ka.approval,"data-testid":"pane-approval",children:u.jsx(PF,{request:f,onConfirm:x,variant:"floating",keyboardActive:!1})}),m&&u.jsx("div",{className:Ka.approval,"data-testid":"pane-approval",children:u.jsx($F,{request:m,onConfirm:x,variant:"floating"})}),u.jsx(yF,{startedAt:b,showPhrase:!1}),u.jsx(gF,{onSubmit:v,onCancel:_,isRunning:w,commands:E,visibleToolbarActions:pNe,currentMode:r.currentMode??"default",currentModel:r.currentModel??"",availableModels:k,onSelectMode:M,onSelectModel:R,dialogOpen:y,placeholderText:s("splitView.composerPlaceholder")})]})]})}const yNe="_split_1h4i3_1",bNe="_toolbar_1h4i3_9",vNe="_backButton_1h4i3_18",wNe="_title_1h4i3_35",xNe="_count_1h4i3_40",_Ne="_addWrap_1h4i3_45",kNe="_addButton_1h4i3_50",SNe="_picker_1h4i3_69",TNe="_pickerItem_1h4i3_86",CNe="_panes_1h4i3_108",ANe="_paneSlot_1h4i3_117",ENe="_empty_1h4i3_124",MNe="_paneError_1h4i3_133",NNe="_paneErrorTitle_1h4i3_146",INe="_paneErrorMessage_1h4i3_151",jNe="_paneErrorClose_1h4i3_156",di={split:yNe,toolbar:bNe,backButton:vNe,title:wNe,count:xNe,addWrap:_Ne,addButton:kNe,picker:SNe,pickerItem:TNe,panes:CNe,paneSlot:ANe,empty:ENe,paneError:MNe,paneErrorTitle:NNe,paneErrorMessage:INe,paneErrorClose:jNe},E4=_f;function RNe({sessionIds:e,onPanesChange:t,onExit:n,onError:s,sessionListReloadToken:r}){var N,I;const{t:i}=Xe(),o=ha(),a=o.sessionId,l=((I=(N=o.capabilities)==null?void 0:N.features)==null?void 0:I.includes(p8))??!1,{sessions:c,reload:d}=qd({autoLoad:!0,pageSize:iv,archiveState:"active",...l?{view:"organized",group:"all"}:{}}),h=e!==void 0,f=g.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,E4),[e]),[m,p]=g.useState(()=>f.length>0?f:a?[a]:[]),[y,w]=g.useState(!1),b=g.useRef(null),[v]=g.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));g.useEffect(()=>{h&&p(O=>O.length===f.length&&O.every((U,F)=>U===f[F])?O:f)},[f,h]);const x=g.useRef(m);x.current=m,g.useEffect(()=>{if(!y)return;const O=F=>{var j;(j=b.current)!=null&&j.contains(F.target)||w(!1)},U=F=>{F.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",O),document.addEventListener("keydown",U),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",U)}},[y]),g.useEffect(()=>{y&&d()},[y,d]);const _=g.useRef(r);g.useEffect(()=>{r!==void 0&&r!==_.current&&(_.current=r,d())},[r,d]);const E=g.useMemo(()=>{var U;const O=new Map;for(const F of c)O.set(F.sessionId,((U=F.displayName)==null?void 0:U.trim())||F.sessionId.slice(0,8));return O},[c]),k=g.useCallback(O=>{const U=x.current;if(U.includes(O)||U.length>=E4){w(!1);return}const F=[...U,O];h?t==null||t(F):p(F),w(!1)},[t,h]),M=g.useRef(!1);g.useEffect(()=>{m.length>0?M.current=!0:M.current&&n()},[m,n]),g.useEffect(()=>{h||t==null||t(m)},[m,t,h]);const R=g.useCallback(O=>{const U=x.current;if(!U.includes(O))return;const F=U.filter(j=>j!==O);h?t==null||t(F):p(F)},[t,h]),L=g.useMemo(()=>c.filter(O=>!m.includes(O.sessionId)),[c,m]),T=m.length<E4&&L.length>0;return u.jsxs("div",{className:di.split,"data-testid":"split-view",children:[u.jsxs("header",{className:di.toolbar,children:[u.jsx("button",{type:"button",className:di.backButton,onClick:n,"aria-label":i("common.back"),title:i("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:u.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u.jsx("span",{className:di.title,children:i("splitView.title")}),u.jsx("span",{className:di.count,children:i("splitView.count",{count:m.length})}),u.jsxs("div",{className:di.addWrap,ref:b,children:[u.jsxs("button",{type:"button",className:di.addButton,disabled:!T,"aria-haspopup":"listbox","aria-expanded":y,onClick:()=>w(O=>!O),children:["+ ",i("splitView.addPane")]}),y&&L.length>0&&u.jsx("ul",{className:di.picker,role:"listbox",children:L.map(O=>u.jsx("li",{role:"option","aria-selected":"false",children:u.jsx("button",{type:"button",className:di.pickerItem,onClick:()=>k(O.sessionId),children:E.get(O.sessionId)??O.sessionId.slice(0,8)})},O.sessionId))})]})]}),u.jsx("div",{className:di.panes,children:m.length===0?u.jsx("div",{className:di.empty,children:i("splitView.empty")}):m.map(O=>u.jsx("div",{className:di.paneSlot,children:u.jsx(mc,{label:`split-pane:${O}`,resetKeys:[O],fallback:U=>u.jsxs("div",{className:di.paneError,role:"alert",children:[u.jsx("div",{className:di.paneErrorTitle,children:E.get(O)??O.slice(0,8)}),u.jsxs("div",{className:di.paneErrorMessage,children:[i("splitView.paneError"),": ",U.message]}),u.jsx("button",{type:"button",className:di.paneErrorClose,onClick:()=>R(O),children:i("splitView.closePane")})]}),children:u.jsx(LL,{sessionId:O,clientId:`split-pane:${v}:${O}`,suppressOwnUserEcho:!0,children:u.jsx(gNe,{title:E.get(O),onClose:()=>R(O),onError:s})})})},O))})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const LNe="(min-width: 1024px)";function DNe(e=LNe){const[t,n]=g.useState(()=>ONe(e));return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const s=window.matchMedia(e);n(s.matches);const r=i=>n(i.matches);return s.addEventListener("change",r),()=>s.removeEventListener("change",r)},[e]),t}function ONe(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function BNe(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;const n=Number(t[1]),s=Number(t[2]);return n<0||n>23||s<0||s>59?null:{hh:n,mm:s}}function CN(e){if(e.frequency==="custom"){const n=e.customCron.trim();return n.length>0?n:null}if(e.frequency==="minutes"){const n=Math.floor(e.minuteInterval);return!Number.isFinite(n)||n<1||n>30||60%n!==0?null:`*/${n} * * * *`}const t=BNe(e.time);if(!t)return null;switch(e.frequency){case"daily":return`${t.mm} ${t.hh} * * *`;case"weekdays":return`${t.mm} ${t.hh} * * 1-5`;case"weekly":return`${t.mm} ${t.hh} * * ${e.weekday}`;case"hourly":return`${t.mm} * * * *`;default:return null}}function AN(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[s,r,i,o,a]=n,l=d=>/^\d+$/.test(d),c=d=>d.padStart(2,"0");if(/^\*\/\d+$/.test(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*"){const d=Number(s.slice(2));return Number.isInteger(d)&&d>=1&&d<=30&&60%d===0?t("scheduledTasks.human.everyMinutes",{n:d}):e}if(l(s)&&r==="*"&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.hourly",{min:c(s)});if(l(s)&&l(r)&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.daily",{time:`${c(r)}:${c(s)}`});if(l(s)&&l(r)&&i==="*"&&o==="*"&&a==="1-5")return t("scheduledTasks.human.weekdays",{time:`${c(r)}:${c(s)}`});if(l(s)&&l(r)&&i==="*"&&o==="*"&&l(a)&&Number(a)>=0&&Number(a)<=7){const d=t("scheduledTasks.weekdayNames").split(","),h=Number(a)===7?0:Number(a),f=d[h]??a;return t("scheduledTasks.human.weekly",{day:f,time:`${c(r)}:${c(s)}`})}return e}const el={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function PNe(e){const t=e.trim(),n={...el,frequency:"custom",customCron:t.length>0?t:el.customCron},s=t.split(/\s+/);if(s.length!==5)return n;const[r,i,o,a,l]=s,c=y=>/^\d+$/.test(y),d=y=>String(y).padStart(2,"0"),h=o==="*"&&a==="*";if(/^\*\/\d+$/.test(r)&&i==="*"&&h&&l==="*"){const y=Number(r.slice(2));return Number.isInteger(y)&&y>=1&&y<=30&&60%y===0?{...el,frequency:"minutes",minuteInterval:y}:n}if(!c(r))return n;const f=Number(r);if(f>59)return n;if(i==="*"&&h&&l==="*")return{...el,frequency:"hourly",time:`00:${d(f)}`};if(!c(i))return n;const m=Number(i);if(m>23)return n;const p=`${d(m)}:${d(f)}`;if(h&&l==="*")return{...el,frequency:"daily",time:p};if(h&&l==="1-5")return{...el,frequency:"weekdays",time:p};if(h&&c(l)){const y=Number(l);if(y>=0&&y<=7)return{...el,frequency:"weekly",time:p,weekday:y===7?0:y}}return n}function $Ne(e,t){if(e<=0)return t("scheduledTasks.dueNow");const n=Math.floor(e/1e3),s=Math.floor(n/86400),r=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),o=n%60,a=(c,d)=>`${d}${t(`scheduledTasks.dur.${c}`)}`;let l;return s>0?l=r>0?[a("d",s),a("h",r)]:[a("d",s)]:r>0?l=i>0?[a("h",r),a("m",i)]:[a("h",r)]:i>0?l=o>0?[a("m",i),a("s",o)]:[a("m",i)]:l=[a("s",o)],l.join(" ")}function zNe(e,t){const n=e.createdAt-e.createdAt%6e4;if(e.lastFiredAt===null||e.lastFiredAt<=n)return t("scheduledTasks.never");let s;try{s=new Date(e.lastFiredAt).toLocaleString()}catch{return t("scheduledTasks.never")}return t("scheduledTasks.lastFired",{when:s})}const FNe="_root_1f03y_1",qNe="_intro_1f03y_8",HNe="_toolbar_1f03y_14",UNe="_count_1f03y_22",VNe="_toolbarActions_1f03y_28",WNe="_primaryButton_1f03y_34",GNe="_secondaryButton_1f03y_35",KNe="_formFields_1f03y_73",YNe="_field_1f03y_79",QNe="_fieldGrow_1f03y_86",XNe="_fieldLabel_1f03y_90",JNe="_required_1f03y_96",ZNe="_input_1f03y_101",eIe="_textarea_1f03y_102",tIe="_select_1f03y_103",nIe="_scheduleRow_1f03y_128",sIe="_preview_1f03y_140",rIe="_previewLabel_1f03y_148",iIe="_previewCron_1f03y_153",oIe="_previewInvalid_1f03y_163",aIe="_formError_1f03y_168",lIe="_loadError_1f03y_169",cIe="_formActions_1f03y_175",uIe="_empty_1f03y_183",dIe="_list_1f03y_190",hIe="_card_1f03y_198",fIe="_cardDisabled_1f03y_209",mIe="_cardHeader_1f03y_213",pIe="_cardTitle_1f03y_219",gIe="_cardMenu_1f03y_230",yIe="_iconAction_1f03y_237",bIe="_toggle_1f03y_263",vIe="_toggleOn_1f03y_282",wIe="_toggleKnob_1f03y_286",xIe="_cardPrompt_1f03y_301",_Ie="_cardFooter_1f03y_314",kIe="_schedulePill_1f03y_323",SIe="_clockIcon_1f03y_335",TIe="_recurringTag_1f03y_340",CIe="_countdown_1f03y_345",AIe="_hourglassIcon_1f03y_356",EIe="_lastFired_1f03y_361",MIe="_runsToggle_1f03y_369",NIe="_runsList_1f03y_386",IIe="_runsItem_1f03y_400",Et={root:FNe,intro:qNe,toolbar:HNe,count:UNe,toolbarActions:VNe,primaryButton:WNe,secondaryButton:GNe,formFields:KNe,field:YNe,fieldGrow:QNe,fieldLabel:XNe,required:JNe,input:ZNe,textarea:eIe,select:tIe,scheduleRow:nIe,preview:sIe,previewLabel:rIe,previewCron:iIe,previewInvalid:oIe,formError:aIe,loadError:lIe,formActions:cIe,empty:uIe,list:dIe,card:hIe,cardDisabled:fIe,cardHeader:mIe,cardTitle:pIe,cardMenu:gIe,iconAction:yIe,toggle:bIe,toggleOn:vIe,toggleKnob:wIe,cardPrompt:xIe,cardFooter:_Ie,schedulePill:kIe,clockIcon:SIe,recurringTag:TIe,countdown:CIe,hourglassIcon:AIe,lastFired:EIe,runsToggle:MIe,runsList:NIe,runsItem:IIe};function zF(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function jIe(e,t){const n=e.kind==="catch-up"?` · ${t("scheduledTasks.runKind.catchUp")}`:e.kind==="manual"?` · ${t("scheduledTasks.runKind.manual")}`:"";return`${zF(e.at)}${n}`}const RIe=["daily","weekdays","weekly","hourly","minutes","custom"],LIe=[1,2,3,4,5,6,10,12,15,20,30],DIe=2147483647,OIe=3,BIe=3e4;function PIe({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,onError:s}){const{t:r}=Xe(),i=da(),[o,a]=g.useState(null),[l,c]=g.useState(null),[d,h]=g.useState(null),[f,m]=g.useState(null),[p,y]=g.useState(!1),[w,b]=g.useState(null),[v,x]=g.useState(""),[_,E]=g.useState(""),[k,M]=g.useState(el),[R,L]=g.useState(!1),[T,N]=g.useState(null),[I,O]=g.useState(null),[U,F]=g.useState(()=>Date.now()),j=g.useRef(!0),V=g.useRef(0);g.useEffect(()=>(j.current=!0,()=>{j.current=!1}),[]);const ee=g.useCallback(async()=>{const G=++V.current;try{const q=await i.listScheduledTasks();if(!j.current||G!==V.current)return;const le=[...q].sort((Se,$e)=>$e.createdAt-Se.createdAt);a(le),c(null)}catch(q){if(!j.current||G!==V.current)return;c(q instanceof Error?q.message:String(q)),a(le=>le??[])}},[i]);g.useEffect(()=>{ee()},[ee]);const ce=!!(o!=null&&o.some(G=>G.nextRunAt!=null));g.useEffect(()=>{if(!ce)return;const G=window.setInterval(()=>F(Date.now()),1e3);return()=>window.clearInterval(G)},[ce]);const $=g.useRef(0);g.useEffect(()=>{if(!o)return;let G=1/0;for(const $e of o)$e.nextRunAt!=null&&$e.nextRunAt<G&&(G=$e.nextRunAt);if(!Number.isFinite(G))return;const q=G-Date.now();let le;q>0?($.current=0,le=Math.min(q+2e3,DIe)):le=$.current++<OIe?1e3:BIe;const Se=window.setTimeout(()=>void ee(),le);return()=>window.clearTimeout(Se)},[o,ee]);const J=CN(k),B=J?AN(J,r):null,C=g.useCallback(()=>{x(""),E(""),M(el),N(null),y(!1),b(null)},[]),z=g.useCallback(()=>{b(null),x(""),E(""),M(el),N(null),y(!0)},[]),X=g.useCallback(G=>{b(G.id),x(G.name??""),E(G.prompt),M(PNe(G.cron)),N(null),y(!0)},[]),ae=g.useCallback(async()=>{const G=CN(k);if(!G){N(r("scheduledTasks.error.invalidSchedule"));return}if(_.trim().length===0){N(r("scheduledTasks.error.emptyPrompt"));return}L(!0),N(null);try{if(w?await i.updateScheduledTask(w,{cron:G,prompt:_.trim(),name:v.trim()||null}):await i.createScheduledTask({cron:G,prompt:_.trim(),name:v.trim()||null,recurring:!0,enabled:!0}),!j.current)return;C(),await ee()}catch(q){if(!j.current)return;N(q instanceof Error?q.message:String(q))}finally{j.current&&L(!1)}},[i,k,w,v,_,ee,C,r]),be=g.useCallback(async G=>{h(G.id);try{await i.updateScheduledTask(G.id,{enabled:!G.enabled}),await ee()}catch(q){s(q,r("scheduledTasks.error.toggleFailed"))}finally{j.current&&h(null)}},[i,s,ee,r]),fe=g.useCallback(async G=>{if(!(!G.enabled||f!==null)){m(G.id);try{const q=(await i.listScheduledTasks()).find(le=>le.id===G.id);if(!q||!q.enabled){await ee().catch(()=>{}),s(new Error("This task is no longer runnable."),r("scheduledTasks.error.runFailed"));return}if(q.recurring){await e(q.prompt,q.sessionId);try{await i.runScheduledTask(q.id),await ee()}catch(le){s(le,r("scheduledTasks.error.runFailed"))}}else{await i.runScheduledTask(q.id),await ee();try{await e(q.prompt,q.sessionId)}catch(le){s(le,r("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(q){s(q,r("scheduledTasks.error.runFailed"))}finally{m(null)}}},[i,s,e,ee,f,r]),ie=g.useCallback(async G=>{const q=G.name||G.prompt,le=q.length>60?`${q.slice(0,57)}…`:q;if(window.confirm(r("scheduledTasks.deleteConfirm",{name:le}))){h(G.id);try{await i.deleteScheduledTask(G.id),await ee()}catch(Se){s(Se,r("scheduledTasks.error.deleteFailed"))}finally{j.current&&h(null)}}},[i,s,ee,r]);return u.jsxs("div",{className:Et.root,children:[u.jsx("div",{className:Et.intro,children:r("scheduledTasks.subtitle")}),u.jsxs("div",{className:Et.toolbar,children:[u.jsx("div",{className:Et.count,children:o===null?r("scheduledTasks.loading"):r("scheduledTasks.count",{count:o.length})}),u.jsxs("div",{className:Et.toolbarActions,children:[u.jsx("button",{type:"button",className:Et.secondaryButton,onClick:()=>void ee(),children:r("scheduledTasks.refresh")}),u.jsx("button",{type:"button",className:Et.secondaryButton,onClick:t,children:r("scheduledTasks.createViaChat")}),u.jsx("button",{type:"button",className:Et.primaryButton,onClick:z,children:r("scheduledTasks.new")})]})]}),p&&u.jsx(Mr,{title:r(w?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:C,children:u.jsxs("div",{className:Et.formFields,children:[u.jsxs("label",{className:Et.field,children:[u.jsx("span",{className:Et.fieldLabel,children:r("scheduledTasks.name")}),u.jsx("input",{className:Et.input,type:"text",value:v,maxLength:200,placeholder:r("scheduledTasks.namePlaceholder"),onChange:G=>x(G.target.value)})]}),u.jsxs("label",{className:Et.field,children:[u.jsxs("span",{className:Et.fieldLabel,children:[r("scheduledTasks.prompt"),u.jsx("span",{className:Et.required,children:"*"})]}),u.jsx("textarea",{className:Et.textarea,value:_,rows:4,maxLength:1e5,placeholder:r("scheduledTasks.promptPlaceholder"),onChange:G=>E(G.target.value)})]}),u.jsxs("div",{className:Et.scheduleRow,children:[u.jsxs("label",{className:Et.field,children:[u.jsx("span",{className:Et.fieldLabel,children:r("scheduledTasks.frequency")}),u.jsx("select",{className:Et.select,value:k.frequency,onChange:G=>{const q=G.target.value;M(le=>({...le,frequency:q,...q==="hourly"?{time:"00:00"}:{}}))},children:RIe.map(G=>u.jsx("option",{value:G,children:r(`scheduledTasks.freq.${G}`)},G))})]}),(k.frequency==="daily"||k.frequency==="weekdays"||k.frequency==="weekly")&&u.jsxs("label",{className:Et.field,children:[u.jsx("span",{className:Et.fieldLabel,children:r("scheduledTasks.time")}),u.jsx("input",{className:Et.input,type:"time",value:k.time,onChange:G=>M(q=>({...q,time:G.target.value}))})]}),k.frequency==="weekly"&&u.jsxs("label",{className:Et.field,children:[u.jsx("span",{className:Et.fieldLabel,children:r("scheduledTasks.weekday")}),u.jsx("select",{className:Et.select,value:k.weekday,onChange:G=>M(q=>({...q,weekday:Number(G.target.value)})),children:r("scheduledTasks.weekdayNames").split(",").map((G,q)=>u.jsx("option",{value:q,children:G},q))})]}),k.frequency==="minutes"&&u.jsxs("label",{className:Et.field,children:[u.jsx("span",{className:Et.fieldLabel,children:r("scheduledTasks.interval")}),u.jsx("select",{className:Et.select,value:k.minuteInterval,onChange:G=>M(q=>({...q,minuteInterval:Number(G.target.value)})),children:LIe.map(G=>u.jsx("option",{value:G,children:G},G))})]}),k.frequency==="custom"&&u.jsxs("label",{className:`${Et.field} ${Et.fieldGrow}`,children:[u.jsx("span",{className:Et.fieldLabel,children:r("scheduledTasks.cron")}),u.jsx("input",{className:Et.input,type:"text",value:k.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:G=>M(q=>({...q,customCron:G.target.value}))})]})]}),u.jsx("div",{className:Et.preview,children:B?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:Et.previewLabel,children:B}),u.jsx("code",{className:Et.previewCron,children:J})]}):u.jsx("span",{className:Et.previewInvalid,children:r("scheduledTasks.error.invalidSchedule")})}),T&&u.jsx("div",{className:Et.formError,children:T}),u.jsxs("div",{className:Et.formActions,children:[u.jsx("button",{type:"button",className:Et.secondaryButton,onClick:C,disabled:R,children:r("scheduledTasks.cancel")}),u.jsx("button",{type:"button",className:Et.primaryButton,onClick:()=>void ae(),disabled:R,children:r(R?w?"scheduledTasks.saving":"scheduledTasks.creating":w?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),l&&u.jsx("div",{className:Et.loadError,children:l}),o!==null&&o.length===0&&!l&&u.jsx("div",{className:Et.empty,children:r("scheduledTasks.empty")}),u.jsx("div",{className:Et.list,children:(o??[]).map(G=>{const q=G.name||G.prompt,le=d===G.id;return u.jsxs("div",{className:`${Et.card} ${G.enabled?"":Et.cardDisabled}`,children:[u.jsxs("div",{className:Et.cardHeader,children:[u.jsx("button",{type:"button",role:"switch","aria-checked":G.enabled,"aria-label":G.enabled?r("scheduledTasks.disable"):r("scheduledTasks.enable"),className:`${Et.toggle} ${G.enabled?Et.toggleOn:""}`,onClick:()=>void be(G),disabled:le,children:u.jsx("span",{className:Et.toggleKnob})}),u.jsx("div",{className:Et.cardTitle,title:q,children:q}),u.jsxs("div",{className:Et.cardMenu,children:[u.jsx("button",{type:"button",className:Et.iconAction,onClick:()=>void fe(G),disabled:!G.enabled||f!==null,title:r("scheduledTasks.runNow"),"aria-label":r("scheduledTasks.runNow"),children:"▶"}),u.jsx("button",{type:"button",className:Et.iconAction,onClick:()=>X(G),disabled:le,title:r("scheduledTasks.edit"),"aria-label":r("scheduledTasks.edit"),children:"✎"}),u.jsx("button",{type:"button",className:Et.iconAction,onClick:()=>void ie(G),disabled:le,title:r("scheduledTasks.delete"),"aria-label":r("scheduledTasks.delete"),children:"✕"})]})]}),G.name&&u.jsx("div",{className:Et.cardPrompt,title:G.prompt,children:G.prompt}),u.jsxs("div",{className:Et.cardFooter,children:[u.jsxs("span",{className:Et.schedulePill,children:[u.jsx("span",{className:Et.clockIcon,"aria-hidden":"true",children:"◷"}),AN(G.cron,r)]}),u.jsx("span",{className:Et.recurringTag,children:r(G.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),G.nextRunAt!=null&&u.jsxs("span",{className:Et.countdown,"data-testid":"scheduled-task-next-run",title:r("scheduledTasks.nextRunTooltip",{when:zF(G.nextRunAt)}),children:[u.jsx("span",{className:Et.hourglassIcon,"aria-hidden":"true",children:"⏳"}),$Ne(G.nextRunAt-U,r)]}),u.jsx("span",{className:Et.lastFired,children:zNe(G,r)}),G.sessionId&&n?u.jsx("button",{type:"button",className:Et.runsToggle,onClick:()=>n(G.sessionId),title:r("scheduledTasks.viewHistoryHint"),children:G.runs.length>0?r("scheduledTasks.viewHistory",{count:G.runs.length}):r("scheduledTasks.viewHistoryEmpty")}):G.runs.length>0&&u.jsx("button",{type:"button",className:Et.runsToggle,"aria-expanded":I===G.id,onClick:()=>O(Se=>Se===G.id?null:G.id),children:r("scheduledTasks.runHistory",{count:G.runs.length})})]}),I===G.id&&G.runs.length>0&&u.jsx("ul",{className:Et.runsList,children:[...G.runs].reverse().map((Se,$e)=>u.jsx("li",{className:Et.runsItem,children:jIe(Se,r)},`${Se.at}-${$e}`))})]},G.id)})})]})}const FF="update available";function $Ie(e){return e.displayName||e.name}function qF(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function zIe(e,t){switch(e){case"update available":return t("extensions.manage.updateAvailable");case"up to date":return t("extensions.manage.upToDate");case"not updatable":return t("extensions.manage.notUpdatable");case"checking for updates":return t("extensions.manage.checkingUpdates");case"error":return t("extensions.manage.updateError");default:return t("extensions.manage.unknownUpdate")}}function Mh(e){return e&&e.length>0?e.join(", "):"-"}const FIe=m8;function qIe(){const{t:e}=Xe(),t=ha(),n=da(),s=oh(),[r,i]=g.useState([]),[o,a]=g.useState(null),[l,c]=g.useState(null),[d,h]=g.useState({}),[f,m]=g.useState(!1),[p,y]=g.useState(!1),[w,b]=g.useState(null),[v,x]=g.useState(null),_=g.useCallback(()=>(m(!0),n.loadExtensionsStatus().then(L=>{var N,I;const T=L.extensions??[];i(T),x(((I=(N=L.errors)==null?void 0:N[0])==null?void 0:I.error)??null),a(O=>O&&T.some(U=>U.name===O)?O:null)}).catch(L=>{x(L instanceof Error?L.message:String(L))}).finally(()=>m(!1))),[n]),E=g.useCallback(()=>{const L=t.clientId;return L?(y(!0),n.checkExtensionUpdates(L).then(T=>h(T.states)).catch(T=>{x(T instanceof Error?T.message:String(T))}).finally(()=>y(!1))):(x(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),k=g.useCallback(()=>{const L=t.clientId;if(!L){x(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions(L).then(async T=>{x(e("extensions.manage.refreshed",{refreshed:T.refreshed,failed:T.failed})),await _(),await E()}).catch(T=>{x(T instanceof Error?T.message:String(T))}).finally(()=>y(!1))},[n,E,t.clientId,_,e]);g.useEffect(()=>{_()},[_]),g.useEffect(()=>{r.length>0&&E()},[E,r.length]),g.useEffect(()=>{((s==null?void 0:s.extensionsVersion)??0)>0&&(h({}),_())},[_,s==null?void 0:s.extensionsVersion]);const M=g.useCallback((L,T)=>{const N=t.clientId;if(!N){x(e("extensions.install.waitForSession"));return}b(L),x(null),T(N).then(()=>x(e("extensions.manage.queued",{name:L}))).catch(I=>{x(I instanceof Error?I.message:String(I))}).finally(()=>b(null))},[t.clientId,e]),R=g.useMemo(()=>f?e("extensions.manage.loading"):p?e("extensions.manage.checkingUpdates"):e("extensions.manage.count",{count:r.length}),[p,r.length,f,e]);return u.jsxs("div",{className:Pe("picker","picker-in-shell"),children:[u.jsxs("div",{className:Pe("picker-search","extensions-toolbar"),children:[u.jsx("span",{className:Pe("picker-search-hint"),children:v||R}),u.jsx("button",{type:"button",className:Pe("dialog-inline-button"),disabled:f||p,onClick:k,children:e("common.refresh")})]}),u.jsx("div",{className:Pe("picker-sep")}),u.jsxs("div",{className:Pe("picker-list"),children:[!f&&r.length===0&&u.jsx("div",{className:Pe("picker-empty"),children:e("extensions.manage.empty")}),r.map(L=>{const T=d[L.name]??L.updateState,N=o===L.name,I=w===L.name;return u.jsxs("div",{className:Pe("picker-item","picker-session-item","tools-picker-item",N?"selected":void 0,N?"tools-picker-item-expanded":void 0),children:[u.jsxs("button",{type:"button",className:Pe("extensions-row-button"),onClick:()=>{a(N?null:L.name),c(null)},children:[u.jsx("span",{className:Pe("tools-item-icon"),"aria-hidden":"true"}),u.jsx("span",{className:Pe("picker-item-title"),children:$Ie(L)}),u.jsxs("span",{className:Pe("picker-item-badge"),children:["v",L.version]}),u.jsx("span",{className:Pe("tools-status-badge",L.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:qF(L,e)}),u.jsx("span",{className:Pe("tools-status-badge",T===FF?"tools-status-badge-busy":void 0),children:zIe(T,e)}),u.jsx("svg",{className:Pe("tools-item-chevron",N?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),N&&u.jsx(HIe,{extension:L,updateState:T,busy:I,confirmingUninstall:l===L.name,onUpdate:()=>M(L.name,O=>n.updateExtension(L.name,O)),onToggleScope:(O,U)=>M(L.name,F=>O==="enable"?n.enableExtension(L.name,{scope:U},F):n.disableExtension(L.name,{scope:U},F)),onRequestUninstall:()=>c(L.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{M(L.name,O=>n.uninstallExtension(L.name,O)),c(null),a(null)}})]},L.id||L.name)})]})]})}function HIe({extension:e,updateState:t,busy:n,confirmingUninstall:s,onUpdate:r,onToggleScope:i,onRequestUninstall:o,onCancelUninstall:a,onConfirmUninstall:l}){const{t:c}=Xe(),d=e.details,h=e.isActive?"disable":"enable";return u.jsxs("div",{className:Pe("extensions-detail"),children:[u.jsxs("div",{className:Pe("extensions-detail-actions"),children:[u.jsx("button",{type:"button",className:Pe("dialog-inline-button"),disabled:n||t!==FF,onClick:r,children:c("extensions.manage.update")}),u.jsxs("button",{type:"button",className:Pe("dialog-inline-button"),disabled:n,onClick:()=>i(h,"user"),children:[c(h==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.user")]}),u.jsxs("button",{type:"button",className:Pe("dialog-inline-button"),disabled:n,onClick:()=>i(h,"workspace"),children:[c(h==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.workspace")]}),u.jsx("button",{type:"button",className:Pe("dialog-danger-button"),disabled:n,onClick:o,children:c("extensions.manage.uninstallAction")})]}),s&&u.jsxs("div",{className:Pe("extensions-confirm"),children:[u.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),u.jsxs("div",{className:Pe("dialog-inline-actions"),children:[u.jsx("button",{type:"button",className:Pe("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),u.jsx("button",{type:"button",className:Pe("dialog-inline-button"),onClick:a,children:c("common.cancel")})]})]}),u.jsxs("div",{className:Pe("extensions-detail-grid"),children:[u.jsx(xa,{label:c("extensions.manage.name"),value:e.name}),u.jsx(xa,{label:c("extensions.manage.version"),value:e.version}),u.jsx(xa,{label:c("extensions.manage.status"),value:qF(e,c)}),u.jsx(xa,{label:c("extensions.manage.path"),value:e.path}),u.jsx(xa,{label:c("extensions.manage.source"),value:e.source??"-"}),u.jsx(xa,{label:c("extensions.manage.commands"),value:Mh(d==null?void 0:d.commands)}),u.jsx(xa,{label:c("extensions.manage.skills"),value:Mh(d==null?void 0:d.skills)}),u.jsx(xa,{label:c("extensions.manage.agents"),value:Mh(d==null?void 0:d.agents)}),u.jsx(xa,{label:c("extensions.manage.mcpServers"),value:Mh(d==null?void 0:d.mcpServers)}),u.jsx(xa,{label:c("extensions.manage.contextFiles"),value:Mh(d==null?void 0:d.contextFiles)}),u.jsx(xa,{label:c("extensions.manage.settings"),value:Mh(d==null?void 0:d.settings)})]})]})}function xa({label:e,value:t}){return u.jsxs("div",{className:Pe("extensions-detail-field"),children:[u.jsx("span",{className:Pe("extensions-detail-label"),children:FIe(e)}),u.jsx("span",{className:Pe("extensions-detail-value"),children:t})]})}const UIe="_panel_1nmt9_1",VIe="_embeddedPanel_1nmt9_16",WIe="_header_1nmt9_26",GIe="_title_1nmt9_32",KIe="_secondary_1nmt9_36",YIe="_hint_1nmt9_37",QIe="_empty_1nmt9_38",XIe="_busy_1nmt9_39",JIe="_scopeTabs_1nmt9_49",ZIe="_scopeTab_1nmt9_49",eje="_scopeTabActive_1nmt9_71",tje="_settingsPage_1nmt9_76",nje="_sidebar_1nmt9_83",sje="_categoryButton_1nmt9_92",rje="_categoryButtonActive_1nmt9_110",ije="_categoryCount_1nmt9_115",oje="_content_1nmt9_121",aje="_card_1nmt9_128",lje="_cardBody_1nmt9_142",cje="_cardTitle_1nmt9_146",uje="_cardDescription_1nmt9_155",dje="_scopeHint_1nmt9_156",hje="_scopeBadge_1nmt9_164",fje="_cardControl_1nmt9_174",mje="_select_1nmt9_180",pje="_actionButton_1nmt9_181",gje="_editInput_1nmt9_182",yje="_editor_1nmt9_219",bje="_switchOn_1nmt9_241",vje="_switchKnob_1nmt9_246",wje="_footer_1nmt9_261",Sn={panel:UIe,embeddedPanel:VIe,header:WIe,title:GIe,secondary:KIe,hint:YIe,empty:QIe,busy:XIe,scopeTabs:JIe,scopeTab:ZIe,scopeTabActive:eje,settingsPage:tje,sidebar:nje,categoryButton:sje,categoryButtonActive:rje,categoryCount:ije,content:oje,card:aje,cardBody:lje,cardTitle:cje,cardDescription:uje,scopeHint:dje,scopeBadge:hje,cardControl:fje,select:mje,actionButton:pje,editInput:gje,editor:yje,switch:"_switch_1nmt9_231",switchOn:bje,switchKnob:vje,footer:wje},xje=new Set(["fastModel","visionModel"]),_je=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function Sw(e,t,n){const s=e(t);return s===t?n:s}function kje(e,t){return Sw(t,`settings.category.${e}`,e)}function Sje(e,t){return Sw(t,`settings.label.${e.key}`,e.label)}function Tje(e,t){if(e.description)return Sw(t,`settings.description.${e.key}`,e.description)}function HF(e,t,n,s){return Sw(s,`settings.option.${e.key}.${String(t)}`,n)}function M4(e,t,n){const s=VF(e,t);if(s==null)return"";if(e.key===fd){const i=xS(s,yi.Dark);return n(`theme.${i}`)}if(e.key===R0){const i=vS(s);return i?wS(i):String(s)}if(e.type==="boolean")return n(s===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===s);return i?HF(e,i.value,i.label,n):String(s)}const r=String(s);return r.length>24?r.slice(0,21)+"...":r}function UF(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function Cje(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return UF(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function VF(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function Aje(e,t){const n=new Map;for(const s of e){let r=n.get(s.category);r||(r=[],n.set(s.category,r)),r.push(s)}return Array.from(n.entries()).map(([s,r])=>({category:kje(s,t),items:r}))}function Eje({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:s,chatWidthMode:r,onChatWidthModeChange:i,embedded:o=!1}){const{t:a}=Xe(),{status:l,settings:c,loading:d,error:h,reload:f,setValue:m}=e,[p,y]=g.useState("workspace"),[w,b]=g.useState(""),[v,x]=g.useState(null),[_,E]=g.useState(null),[k,M]=g.useState(null),R=g.useRef(null),[L,T]=g.useState(!1),N=d&&!l,I=c.find(B=>B.key===fd),O=xS(I==null?void 0:I.values.effective),U=c.find(B=>B.key===R0),F=vS(U==null?void 0:U.values.effective),j=g.useMemo(()=>{const B=c.filter(ae=>!_je.has(ae.key)),C=Aje(B,a).map(ae=>({id:ae.category,label:ae.category,items:ae.items.map(be=>({type:"setting",setting:be}))})),z={type:"local",localKey:"chatWidth"},X=C.find(ae=>ae.items.some(be=>be.type==="setting"&&be.setting.key===fd));if(X){const ae=X.items.findIndex(be=>be.type==="setting"&&be.setting.key===fd);X.items.splice(ae+1,0,z)}else C.push({id:a("settings.category.UI"),label:a("settings.category.UI"),items:[z]});return C},[c,a]);g.useEffect(()=>{j.length!==0&&(j.some(B=>B.id===w)||b(j[0].id))},[w,j]),g.useEffect(()=>{var B;h?E(h.message):(B=l==null?void 0:l.warnings)!=null&&B.length?E(l.warnings.map(C=>a("settings.corrupted",{recovered:C.recovered?"true":"false"})).join("; ")):c.length>0&&!L&&E(null)},[h,c,l,a,L]),g.useEffect(()=>{k&&setTimeout(()=>{var B;return(B=R.current)==null?void 0:B.focus()},0)},[k]);const V=g.useCallback((B,C)=>{L||E(null),x(B),m("workspace",B,C).then(async z=>{try{await f()}catch{}z!=null&&z.requiresRestart&&B!==R0&&(T(!0),E(a("settings.requiresRestart")))}).catch(z=>{E(z instanceof Error?z.message:String(z))}).finally(()=>x(null))},[f,L,m,a]),ee=g.useCallback(()=>{if(!k)return;const B=c.find(z=>z.key===k.key);if(!B){M(null);return}let C=k.draft;if(B.type==="number"){const z=k.draft.trim();if(z===""||!Number.isFinite(Number(z))){E(a("settings.invalidNumber"));return}C=Number(z)}M(null),V(B.key,C)},[k,c,V,a]),ce=j.find(B=>B.id===w)??j[0],$=(B,C,z,X=!1)=>u.jsx("select",{className:Sn.select,value:B,disabled:X,onChange:ae=>C(ae.target.value),children:z.map(ae=>u.jsx("option",{value:ae.value,children:ae.label},ae.value))}),J=B=>{var be;const C=VF(B,p),z=v===B.key,X=(k==null?void 0:k.key)===B.key;if(p!=="workspace")return u.jsx("button",{type:"button",className:Sn.actionButton,disabled:!0,title:a("settings.readOnly"),children:M4(B,p,a)||a("settings.readOnly")});if(B.key===fd)return $(O??yi.Dark,fe=>{const ie=fe;s(ie),V(fd,XY(ie))},UL.map(fe=>({value:fe,label:a(`theme.${fe}`)})),z);if(B.key===R0)return $(F??"zh-CN",fe=>t(fe),LY.map(fe=>({value:fe,label:wS(fe)})),z);if(xje.has(B.key))return u.jsx("button",{type:"button",className:Sn.actionButton,onClick:()=>n(B.key),children:M4(B,p,a)||a("settings.action.edit")});if(B.type==="boolean"){const fe=C===!0;return u.jsx("button",{type:"button",className:`${Sn.switch} ${fe?Sn.switchOn:""}`,disabled:z,onClick:()=>V(B.key,!fe),"aria-pressed":fe,children:u.jsx("span",{className:Sn.switchKnob})})}if(B.type==="enum"&&((be=B.options)!=null&&be.length)){const fe=B.options.findIndex(ie=>ie.value===C);return $(fe>=0?String(fe):"",ie=>{var q;const G=(q=B.options)==null?void 0:q[Number(ie)];G&&V(B.key,G.value)},B.options.map((ie,G)=>({value:String(G),label:HF(B,ie.value,ie.label,a)})),z)}return X?u.jsxs("div",{className:Sn.editor,children:[u.jsx("input",{ref:R,className:Sn.editInput,type:B.type==="number"?"number":"text",value:k.draft,onChange:fe=>M({key:k.key,draft:fe.target.value}),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),ee()),fe.key==="Escape"&&(fe.preventDefault(),M(null))}}),u.jsx("button",{type:"button",className:Sn.actionButton,onClick:ee,children:a("settings.action.save")})]}):u.jsx("button",{type:"button",className:Sn.actionButton,disabled:z,onClick:()=>M({key:B.key,draft:String(C??"")}),children:M4(B,p,a)||a("settings.action.edit")})};return u.jsxs("div",{className:`${Sn.panel} ${o?Sn.embeddedPanel:""}`,"data-keyboard-scope":!0,children:[!o&&u.jsxs("div",{className:Sn.header,children:[u.jsx("span",{className:Sn.title,children:a("settings.title")}),u.jsx("span",{className:Sn.secondary,children:a("settings.scope.workspace")})]}),(_||N)&&u.jsx("div",{className:Sn.hint,children:_||a("settings.loading")}),u.jsxs("div",{className:Sn.scopeTabs,role:"tablist",children:[u.jsx("button",{type:"button",role:"tab","aria-selected":p==="workspace",className:`${Sn.scopeTab} ${p==="workspace"?Sn.scopeTabActive:""}`,onClick:()=>y("workspace"),children:a("settings.scope.workspace")}),u.jsx("button",{type:"button",role:"tab","aria-selected":p==="user",className:`${Sn.scopeTab} ${p==="user"?Sn.scopeTabActive:""}`,onClick:()=>{M(null),y("user")},children:a("settings.scope.user")})]}),u.jsxs("div",{className:Sn.settingsPage,children:[u.jsx("nav",{className:Sn.sidebar,"aria-label":a("settings.title"),children:j.map(B=>u.jsxs("button",{type:"button",className:`${Sn.categoryButton} ${B.id===w?Sn.categoryButtonActive:""}`,onClick:()=>b(B.id),children:[u.jsx("span",{children:B.label}),u.jsx("span",{className:Sn.categoryCount,children:B.items.length})]},B.id))}),u.jsxs("section",{className:Sn.content,children:[!d&&!ce&&u.jsx("div",{className:Sn.empty,children:a("settings.empty")}),ce==null?void 0:ce.items.map(B=>{if(B.type==="local")return u.jsxs("div",{className:Sn.card,children:[u.jsxs("div",{className:Sn.cardBody,children:[u.jsx("div",{className:Sn.cardTitle,children:a("settings.label.ui.chatWidth")}),u.jsx("div",{className:Sn.cardDescription,children:a("settings.description.ui.chatWidth")})]}),u.jsx("div",{className:Sn.cardControl,children:$(r,be=>i(be),[{value:"1000",label:a("settings.option.ui.chatWidth.1000")},{value:"wide",label:a("settings.option.ui.chatWidth.wide")}])})]},B.localKey);const C=B.setting,z=Tje(C,a),X=Cje(C,p),ae=UF(C,p);return u.jsxs("div",{className:Sn.card,children:[u.jsxs("div",{className:Sn.cardBody,children:[u.jsxs("div",{className:Sn.cardTitle,children:[Sje(C,a),ae&&u.jsx("span",{className:Sn.scopeBadge,children:a(p==="workspace"?"settings.scope.workspace":"settings.scope.user")})]}),z&&u.jsx("div",{className:Sn.cardDescription,children:z}),X&&u.jsx("div",{className:Sn.scopeHint,children:a(X,{scope:a(p==="workspace"?"settings.scope.user":"settings.scope.workspace")})})]}),u.jsx("div",{className:Sn.cardControl,children:v===C.key?u.jsx("span",{className:Sn.busy,children:"..."}):J(C)})]},C.key)})]})]}),!o&&u.jsx("div",{className:Sn.footer,children:a(k?"settings.footer.edit":"settings.footer")})]})}const Mje="_dialog_1ymqd_1",Nje="_toolbar_1ymqd_12",Ije="_tabs_1ymqd_21",jje="_tab_1ymqd_21",Rje="_tabActive_1ymqd_39",Lje="_search_1ymqd_48",Dje="_general_1ymqd_60",Oje="_shortcuts_1ymqd_67",Bje="_shortcut_1ymqd_67",Pje="_shortcutKey_1ymqd_87",$je="_shortcutDesc_1ymqd_95",zje="_commandList_1ymqd_101",Fje="_commandCard_1ymqd_108",qje="_commandCardExpanded_1ymqd_115",Hje="_commandRow_1ymqd_119",Uje="_commandName_1ymqd_135",Vje="_commandTag_1ymqd_142",Wje="_chevron_1ymqd_152",Gje="_chevronExpanded_1ymqd_160",Kje="_commandDetail_1ymqd_164",Yje="_commandDescription_1ymqd_174",Qje="_commandSubcommands_1ymqd_175",Xje="_empty_1ymqd_182",tr={dialog:Mje,toolbar:Nje,tabs:Ije,tab:jje,tabActive:Rje,search:Lje,general:Dje,shortcuts:Oje,shortcut:Bje,shortcutKey:Pje,shortcutDesc:$je,commandList:zje,commandCard:Fje,commandCardExpanded:qje,commandRow:Hje,commandName:Uje,commandTag:Vje,chevron:Wje,chevronExpanded:Gje,commandDetail:Kje,commandDescription:Yje,commandSubcommands:Qje,empty:Xje},Jje=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],Zje=new Set(["about","agents","approval-mode","arena","auth","branch","btw","bug","clear","compress","context","copy","release","diff","directory","docs","doctor","dream","editor","export","extensions","forget","goal","help","hooks","ide","init","insight","language","lsp","mcp","memory","model","new","permissions","plan","quit","recap","remember","rename","reset","restore","resume","rewind","settings","setup-github","skills","stats","status","statusline","summary","tasks","terminal-setup","theme","tools","trust","vim"]),eRe=[["@","help.shortcut.addContext"],["!","help.shortcut.shell"],["/","help.shortcut.commandMenu"],["Tab","help.shortcut.completion"],["Esc","help.shortcut.cancel"],["Ctrl+J","help.shortcut.newline"],["Ctrl+L","help.shortcut.clear"],["Ctrl+Y","help.shortcut.retry"],["Shift+Tab","help.shortcut.approvals"],["Alt+Left/Right","help.shortcut.altWords"],["Up/Down","help.shortcut.history"]];function tRe(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function Qk(e){return!Zje.has(e.name)}function nRe(e,t){return Qk(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function sRe(e,t,n){const s=n.trim().toLowerCase();return e.filter(r=>r.name&&r.description!==void 0).filter(r=>t==="commands"?!Qk(r):t==="custom-commands"?Qk(r):!0).filter(r=>s?r.name.toLowerCase().includes(s)||(r.description??"").toLowerCase().includes(s)||(r.argumentHint??"").toLowerCase().includes(s):!0).sort((r,i)=>r.name.localeCompare(i.name))}function rRe(){const{t:e}=Xe();return u.jsx("div",{className:tr.general,children:u.jsx("div",{className:tr.shortcuts,children:eRe.map(([t,n])=>u.jsxs("div",{className:tr.shortcut,children:[u.jsx("span",{className:tr.shortcutDesc,children:e(n)}),u.jsx("span",{className:tr.shortcutKey,children:t})]},t))})})}function iRe({commands:e,tab:t,query:n}){const{t:s}=Xe(),[r,i]=g.useState(null),o=g.useMemo(()=>sRe(e,t,n),[e,n,t]);return o.length===0?u.jsx("div",{className:tr.empty,children:s(t==="custom-commands"?"help.emptyCustom":"help.empty")}):u.jsx("div",{className:tr.commandList,children:o.map(a=>{var c;const l=r===a.name;return u.jsxs("article",{className:`${tr.commandCard} ${l?tr.commandCardExpanded:""}`,children:[u.jsxs("button",{type:"button",className:tr.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[u.jsx("span",{className:tr.commandName,children:tRe(a)}),u.jsx("span",{className:tr.commandTag,children:nRe(a,s)}),u.jsx("svg",{className:`${tr.chevron} ${l?tr.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l&&u.jsxs("div",{className:tr.commandDetail,children:[a.description&&u.jsx("div",{className:tr.commandDescription,children:a.description}),!!((c=a.subcommands)!=null&&c.length)&&u.jsxs("div",{className:tr.commandSubcommands,children:[s("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function oRe({commands:e}){const{t}=Xe(),[n,s]=g.useState("general"),{filterValue:r,inputProps:i}=kw(),o=n!=="general";return u.jsxs("div",{className:tr.dialog,children:[u.jsxs("div",{className:tr.toolbar,children:[u.jsx("div",{className:tr.tabs,children:Jje.map(a=>u.jsx("button",{type:"button",className:`${tr.tab} ${a.id===n?tr.tabActive:""}`,onClick:()=>s(a.id),children:t(a.labelKey)},a.id))}),o&&u.jsx("input",{className:tr.search,...i,placeholder:t("help.search")})]}),n==="general"?u.jsx(rRe,{}):u.jsx(iRe,{commands:e,tab:n,query:r})]})}function aRe({currentTheme:e,onSelect:t,onClose:n}){const{t:s}=Xe(),r=UL.map(d=>({id:d,label:s(`theme.${d}`),description:s(`theme.${d}.desc`)})),[i,o]=g.useState(()=>{const d=r.findIndex(h=>h.id===e);return d>=0?d:0}),a=g.useRef(null),l=d=>{const h=r[d];h&&(t(h.id),n())},{keyboardMode:c}=Uu({itemCount:r.length,activeIndex:i,onActiveIndexChange:o,onConfirm:l});return g.useEffect(()=>{var h;const d=(h=a.current)==null?void 0:h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),u.jsx("div",{className:Pe("picker-list","picker-list-compact",c?"picker-keyboard-only":void 0),ref:a,role:"listbox","aria-label":s("theme.title"),tabIndex:0,"aria-activedescendant":r.length>0?`theme-opt-${i}`:void 0,children:r.map((d,h)=>{const f=d.id===e;return u.jsxs("div",{id:`theme-opt-${h}`,role:"option","aria-selected":f,className:Pe("picker-item","picker-session-item",h===i?"selected":void 0,f?"dialog-current":void 0),onClick:()=>l(h),onMouseMove:()=>o(h),children:[u.jsx("div",{className:Pe("picker-item-row"),children:u.jsx("span",{className:Pe("picker-item-title"),children:d.label})}),u.jsx("div",{className:Pe("picker-item-meta"),children:d.description})]},d.id)})})}const Xk="delete-session-list",EN=e=>`${Xk}-opt-${e}`;function lRe({onDeleted:e,onError:t,onClose:n}){const{t:s}=Xe(),r=ha(),{sessions:i,loading:o,error:a,deleteSession:l,deleteSessions:c}=qd({autoLoad:!0}),d=r.sessionId,[h,f]=g.useState(!1),[m,p]=g.useState(-1),[y,w]=g.useState(new Set),{filterValue:b,inputProps:v}=kw(()=>{p(-1),w(new Set)}),[x,_]=g.useState(null),E=g.useRef(null),k=g.useRef(null);g.useEffect(()=>{a&&_(a.message)},[a]);const M=g.useMemo(()=>b?i.filter(O=>{const U=b.toLowerCase();return(O.displayName||"").toLowerCase().includes(U)||O.sessionId.toLowerCase().includes(U)}):i,[i,b]),R=g.useCallback(O=>{O!==d&&w(U=>{const F=new Set(U);return F.has(O)?F.delete(O):F.add(O),F})},[d]);g.useEffect(()=>{if(y.size===0)return;const O=new Set(M.map(U=>U.sessionId));w(U=>{const F=new Set([...U].filter(j=>O.has(j)));return F.size===U.size?U:F})},[M,y.size]),g.useEffect(()=>{m>=M.length&&M.length>0&&p(M.length-1)},[M.length,m]),g.useEffect(()=>{var U;const O=(U=E.current)==null?void 0:U.children[m];O==null||O.scrollIntoView({block:"nearest"})},[m]),g.useEffect(()=>{var O;(O=k.current)==null||O.focus()},[]);const{keyboardMode:L}=Uu({itemCount:M.length,activeIndex:m,onActiveIndexChange:p,onConfirm:O=>{const U=M[O];U&&R(U.sessionId)}}),T=g.useCallback(()=>{if(h)return;if(y.size>0){const U=new Set(M.map(j=>j.sessionId)),F=Array.from(y).filter(j=>U.has(j));if(F.length===0)return;f(!0),c(F).then(j=>{const V=j.removed.length+j.notFound.length,ee=j.errors.length;if(ee>0&&V>0){t(new Error(s("delete.partialFail",{removed:V,failed:ee,detail:j.errors[0].error}))),n();return}if(ee>0){_(s("delete.allFailed",{count:ee,reason:j.errors[0].error})),f(!1),w(new Set);return}if(V===0){_(s("delete.nonRemoved")),f(!1),w(new Set);return}e([...j.removed,...j.notFound]),n()}).catch(j=>{t(j),f(!1)});return}const O=M[m];if(O){if(O.sessionId===d){_(s("delete.cannotCurrent"));return}f(!0),l(O.sessionId).then(U=>{if(!U){_(s("delete.notFound")),f(!1);return}e([O.sessionId]),n()}).catch(U=>{t(U),f(!1)})}},[d,l,c,h,M,n,e,t,m,y,s]),N=y.size>0,I=!h&&!o&&N;return u.jsxs("div",{className:Pe("picker","picker-in-shell"),children:[u.jsxs("div",{className:Pe("picker-search"),children:[u.jsxs("span",{className:Pe("picker-search-label"),children:[s("resume.search"),":"," "]}),u.jsx("input",{ref:k,className:Pe("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":Xk,"aria-activedescendant":m>=0&&m<M.length?EN(m):void 0,...v,placeholder:""}),u.jsx("span",{className:Pe("picker-search-hint"),children:x||(h?s("delete.deleting"):o?s("common.loading"):N?s("delete.selected",{count:y.size}):b?s("delete.matches",{count:M.length}):"")})]}),u.jsx("div",{className:Pe("picker-sep")}),u.jsxs("div",{id:Xk,role:"listbox","aria-multiselectable":"true",className:Pe("picker-list",L?"picker-keyboard-only":void 0),ref:E,children:[o&&u.jsx("div",{className:Pe("picker-empty"),children:s("common.loading")}),!o&&a&&u.jsx("div",{className:Pe("picker-empty"),children:a.message}),!o&&!a&&M.length===0&&u.jsx("div",{className:Pe("picker-empty"),children:b?s("delete.noMatch",{query:b}):s("delete.none")}),!o&&M.map((O,U)=>{const F=O.sessionId===d,j=y.has(O.sessionId);return u.jsx(f8,{session:O,optionId:EN(U),active:U===m,ariaSelected:j,current:!1,disabled:F,leading:u.jsx("span",{className:Pe("picker-item-checkbox",j?"picker-item-checkbox-checked":void 0),children:j?"[x] ":"[ ] "}),trailing:F?u.jsx("span",{className:Pe("picker-item-badge"),children:s("resume.current")}):void 0,onClick:()=>{p(U),F||R(O.sessionId)},onActivate:()=>p(U)},O.sessionId)})]}),u.jsx("div",{className:Pe("picker-sep")}),u.jsxs("div",{className:Pe("dialog-footer-actions"),children:[u.jsx("button",{type:"button",className:Pe("dialog-inline-button"),onClick:n,disabled:h,children:s("common.cancel")}),u.jsx("button",{type:"button",className:Pe("dialog-danger-button"),onClick:T,disabled:!I,children:s(h?"delete.deleting":"delete.action")})]})]})}const Jk="release-session-list",MN=e=>`${Jk}-opt-${e}`;function cRe({onReleased:e,onError:t,onClose:n}){const{t:s}=Xe(),r=ha(),{sessions:i,loading:o,error:a,releaseSession:l}=qd({autoLoad:!0}),c=r.sessionId,[d,h]=g.useState(!1),[f,m]=g.useState(-1),[p,y]=g.useState(null),{filterValue:w,inputProps:b}=kw(()=>{m(-1),y(null)}),[v,x]=g.useState(null),_=g.useRef(null),E=g.useRef(null);g.useEffect(()=>{a&&x(a.message)},[a]);const k=w?i.filter(O=>{const U=w.toLowerCase();return(O.displayName||"").toLowerCase().includes(U)||O.sessionId.toLowerCase().includes(U)}):i,M=O=>{const U=k[O];if(!U)return;const F=U.sessionId===c,j=(U.clientCount??0)>0||U.hasActivePrompt===!0;F||!j||(m(O),y(U.sessionId))};g.useEffect(()=>{f>=k.length&&k.length>0&&m(k.length-1)},[k.length,f]),g.useEffect(()=>{var U;const O=(U=_.current)==null?void 0:U.children[f];O==null||O.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var O;(O=E.current)==null||O.focus()},[]);const{keyboardMode:R}=Uu({itemCount:k.length,activeIndex:f,onActiveIndexChange:m,onConfirm:M}),L=g.useCallback(O=>{const U=O??k.find(j=>j.sessionId===p)??void 0;if(!U||d)return;if(!((U.clientCount??0)>0||U.hasActivePrompt===!0)){x(s("release.inactive"));return}if(U.sessionId===c){x(s("release.cannotCurrent"));return}l&&(h(!0),l(U.sessionId).then(()=>{e(U.sessionId),n()}).catch(j=>{t(j),h(!1)}))},[c,d,k,n,t,e,l,p,s]),T=k.find(O=>O.sessionId===p)??void 0,N=T&&((T.clientCount??0)>0||T.hasActivePrompt===!0),I=!d&&!o&&!!T&&T.sessionId!==c&&!!N;return u.jsxs("div",{className:Pe("picker","picker-in-shell"),children:[u.jsxs("div",{className:Pe("picker-search"),children:[u.jsxs("span",{className:Pe("picker-search-label"),children:[s("resume.search"),":"," "]}),u.jsx("input",{ref:E,className:Pe("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":Jk,"aria-activedescendant":f>=0&&f<k.length?MN(f):void 0,...b,placeholder:""}),u.jsx("span",{className:Pe("picker-search-hint"),children:v||(d?s("release.releasing"):o?s("common.loading"):w?s("release.matches",{count:k.length}):"")})]}),u.jsx("div",{className:Pe("picker-sep")}),u.jsxs("div",{id:Jk,role:"listbox",className:Pe("picker-list",R?"picker-keyboard-only":void 0),ref:_,children:[o&&u.jsx("div",{className:Pe("picker-empty"),children:s("common.loading")}),!o&&k.length===0&&u.jsx("div",{className:Pe("picker-empty"),children:w?s("release.noMatch",{query:w}):s("release.none")}),!o&&k.map((O,U)=>{const F=O.sessionId===c,j=(O.clientCount??0)>0||O.hasActivePrompt===!0,V=F||!j;return u.jsx(f8,{session:O,optionId:MN(U),active:U===f,confirmed:O.sessionId===p,ariaSelected:O.sessionId===p,current:!1,disabled:V,trailing:F?u.jsx("span",{className:Pe("picker-item-badge"),children:s("resume.current")}):j?void 0:u.jsx("span",{className:Pe("picker-item-badge"),children:s("release.inactiveBadge")}),onClick:()=>M(U),onActivate:()=>m(U)},O.sessionId)})]}),u.jsx("div",{className:Pe("picker-sep")}),u.jsxs("div",{className:Pe("dialog-footer-actions"),children:[u.jsx("button",{type:"button",className:Pe("dialog-inline-button"),onClick:n,disabled:d,children:s("common.cancel")}),u.jsx("button",{type:"button",className:Pe("dialog-danger-button"),onClick:()=>L(),disabled:!I,children:s(d?"release.releasing":"release.action")})]})]})}const uRe="_root_ieg2d_1",dRe="_list_ieg2d_8",hRe="_item_ieg2d_21",fRe="_itemCursor_ieg2d_42",mRe="_itemSelected_ieg2d_49",pRe="_prompt_ieg2d_61",gRe="_keyboardOnly_ieg2d_68",yRe="_itemDisabled_ieg2d_77",bRe="_turn_ieg2d_91",vRe="_time_ieg2d_96",wRe="_footer_ieg2d_102",xRe="_footerMessage_ieg2d_112",_Re="_dangerButton_ieg2d_118",mo={root:uRe,list:dRe,item:hRe,itemCursor:fRe,itemSelected:mRe,prompt:pRe,keyboardOnly:gRe,itemDisabled:yRe,turn:bRe,time:vRe,footer:wRe,footerMessage:xRe,dangerButton:_Re},kRe="rewind-snapshot-list",NN=e=>`${kRe}-opt-${e}`;function SRe(e,t){let n=0;for(const s of e)if(s.kind==="user"){if(n===t)return s.text.trim();n+=1}return""}function TRe(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function CRe({blocks:e,loadSnapshots:t,rewind:n,onError:s,onClose:r}){const{t:i}=Xe(),[o,a]=g.useState([]),[l,c]=g.useState(!0),[d,h]=g.useState(null),[f,m]=g.useState(0),[p,y]=g.useState(null),[w,b]=g.useState(null);g.useEffect(()=>{let R=!0;return c(!0),t().then(L=>{R&&a(L.snapshots)}).catch(L=>{R&&s(L)}).finally(()=>{R&&c(!1)}),()=>{R=!1}},[t,s]);const v=g.useMemo(()=>o.map(R=>({snapshot:R,promptText:SRe(e,R.turnIndex)})).sort((R,L)=>R.snapshot.turnIndex-L.snapshot.turnIndex),[e,o]);g.useEffect(()=>{f>=v.length&&v.length>0&&m(v.length-1)},[v.length,f]);const x=g.useRef(null),_=d!==null,E=R=>{!R||d||(h(R),b(null),n(R).then(()=>{r()}).catch(L=>{s(L),b(i("rewind.failed",{reason:L instanceof Error?L.message:String(L)})),h(null)}))},k=R=>{const L=v[R];L&&(m(R),y(L.snapshot.promptId))},{keyboardMode:M}=Uu({itemCount:v.length,activeIndex:f,onActiveIndexChange:m,onConfirm:k,enabled:!_});return g.useEffect(()=>{var L;const R=(L=x.current)==null?void 0:L.children[f];R==null||R.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var L;if(l||v.length===0)return;const R=document.activeElement;(R==null?void 0:R.getAttribute("role"))==="dialog"&&((L=x.current)==null||L.focus())},[l,v.length]),l?u.jsx("div",{className:Pe("picker-empty"),children:i("rewind.loading")}):v.length===0?u.jsx("div",{className:Pe("picker-empty"),children:i("rewind.empty")}):u.jsxs("div",{className:mo.root,children:[u.jsx("div",{className:`${mo.list} ${M?mo.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":v.length>0?NN(f):void 0,children:v.map(({snapshot:R,promptText:L},T)=>{const N=T===f,I=p===R.promptId,O=L||i("rewind.promptFallback",{id:R.promptId.slice(-8)});return u.jsxs("div",{id:NN(T),role:"option","aria-selected":I,"aria-disabled":_||void 0,className:`${mo.item} ${N?mo.itemCursor:""} ${I?mo.itemSelected:""} ${_?mo.itemDisabled:""}`,onClick:()=>{_||k(T)},onMouseMove:()=>m(T),children:[u.jsxs("div",{className:mo.prompt,title:O,children:[u.jsxs("span",{className:mo.turn,children:["#",R.turnIndex+1]})," ",O]}),u.jsx("div",{className:mo.time,children:TRe(R.timestamp)})]},R.promptId)})}),u.jsxs("div",{className:mo.footer,children:[w&&u.jsx("span",{className:mo.footerMessage,role:"alert",children:w}),u.jsx("button",{type:"button",className:Pe("dialog-inline-button"),onClick:r,disabled:d!==null,children:i("common.cancel")}),u.jsx("button",{type:"button",className:`${Pe("dialog-danger-button")} ${mo.dangerButton}`,onClick:()=>E(p),disabled:!p||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const ARe="_sidebar_kn159_1",ERe="_resizing_kn159_21",MRe="_collapsed_kn159_25",NRe="_newChatButton_kn159_31",IRe="_footerButton_kn159_32",jRe="_collapseButton_kn159_33",RRe="_projectRow_kn159_34",LRe="_sessionRow_kn159_35",DRe="_sessionGroupHeader_kn159_36",ORe="_sessionGroupActionButton_kn159_37",BRe="_retry_kn159_38",PRe="_projectIconButton_kn159_40",$Re="_sessionActionButton_kn159_41",zRe="_groupMenuItem_kn159_42",FRe="_secondaryButton_kn159_43",qRe="_dangerButton_kn159_44",HRe="_navIcon_kn159_110",URe="_settingsIcon_kn159_133",VRe="_projectFolderIcon_kn159_139",WRe="_topRow_kn159_143",GRe="_brandLogo_kn159_156",KRe="_body_kn159_181",YRe="_sectionTitle_kn159_190",QRe="_projectName_kn159_228",XRe="_sessionText_kn159_229",JRe="_sessionList_kn159_244",ZRe="_sessionGroupSection_kn159_254",eLe="_sessionGroupHeaderRow_kn159_260",tLe="_sessionGroupDot_kn159_284",nLe="_sessionGroupTitle_kn159_291",sLe="_sessionGroupCount_kn159_298",rLe="_sessionGroupChevron_kn159_303",iLe="_sessionPinnedIndicator_kn159_314",oLe="_sessionGroupHeaderActions_kn159_325",aLe="_sessionGroupList_kn159_355",lLe="_groupedSessionRow_kn159_373",cLe="_currentSession_kn159_380",uLe="_pinnedSession_kn159_390",dLe="_busySession_kn159_394",hLe="_floatingTooltip_kn159_399",fLe="_tooltipContent_kn159_429",mLe="_tooltipTitle_kn159_435",pLe="_tooltipTags_kn159_442",gLe="_tooltipTag_kn159_442",yLe="_tooltipTagRunning_kn159_462",bLe="_tooltipTagNew_kn159_467",vLe="_tooltipMeta_kn159_472",wLe="_sessionStatusSlot_kn159_487",xLe="_sessionStatusDot_kn159_497",_Le="_sessionPinMarker_kn159_507",kLe="_sessionMetaSlot_kn159_533",SLe="_sessionTime_kn159_544",TLe="_sessionLoading_kn159_551",CLe="_runningSession_kn159_561",ALe="_sessionActions_kn159_570",ELe="_activeSessionActionButton_kn159_647",MLe="_searchInput_kn159_666",NLe="_renameInput_kn159_680",ILe="_dialogSelect_kn159_686",jLe="_dialogInput_kn159_696",RLe="_groupMenu_kn159_42",LLe="_groupMenuItemActive_kn159_738",DLe="_groupMenuName_kn159_744",OLe="_groupMenuDot_kn159_752",BLe="_groupMenuEmptyDot_kn159_753",PLe="_groupMenuIcon_kn159_754",$Le="_groupMenuCheck_kn159_782",zLe="_groupMenuSeparator_kn159_789",FLe="_groupColorRed_kn159_795",qLe="_groupColorOrange_kn159_799",HLe="_groupColorYellow_kn159_803",ULe="_groupColorGreen_kn159_807",VLe="_groupColorBlue_kn159_811",WLe="_groupColorPurple_kn159_815",GLe="_renameForm_kn159_824",KLe="_notice_kn159_840",YLe="_confirmContent_kn159_855",QLe="_confirmDescription_kn159_861",XLe="_confirmActions_kn159_868",JLe="_groupForm_kn159_874",ZLe="_fieldStack_kn159_881",eDe="_footer_kn159_32",tDe="_footerButtonLabel_kn159_952",nDe="_footerCompact_kn159_959",sDe="_footerTight_kn159_960",rDe="_version_kn159_988",iDe="_resizeHandle_kn159_1020",oDe="_sessionActionButtonActive_kn159_1048",aDe="_menuActive_kn159_1054",lDe="_actionMenu_kn159_1058",cDe="_actionMenuItem_kn159_1075",uDe="_actionMenuItemDanger_kn159_1106",dDe="_actionMenuIcon_kn159_1116",hDe="_actionMenuLabel_kn159_1135",fDe="_archivedSection_kn159_1143",mDe="_archivedHeader_kn159_1151",pDe="_archivedChevron_kn159_1177",gDe="_archivedTitle_kn159_1196",yDe="_archivedCount_kn159_1205",bDe="_archivedList_kn159_1220",vDe="_archivedRow_kn159_1227",wDe="_mobileOpen_kn159_1236",me={sidebar:ARe,resizing:ERe,collapsed:MRe,newChatButton:NRe,footerButton:IRe,collapseButton:jRe,projectRow:RRe,sessionRow:LRe,sessionGroupHeader:DRe,sessionGroupActionButton:ORe,retry:BRe,projectIconButton:PRe,sessionActionButton:$Re,groupMenuItem:zRe,secondaryButton:FRe,dangerButton:qRe,navIcon:HRe,settingsIcon:URe,projectFolderIcon:VRe,topRow:WRe,brandLogo:GRe,body:KRe,sectionTitle:YRe,projectName:QRe,sessionText:XRe,sessionList:JRe,sessionGroupSection:ZRe,sessionGroupHeaderRow:eLe,sessionGroupDot:tLe,sessionGroupTitle:nLe,sessionGroupCount:sLe,sessionGroupChevron:rLe,sessionPinnedIndicator:iLe,sessionGroupHeaderActions:oLe,sessionGroupList:aLe,groupedSessionRow:lLe,currentSession:cLe,pinnedSession:uLe,busySession:dLe,floatingTooltip:hLe,tooltipContent:fLe,tooltipTitle:mLe,tooltipTags:pLe,tooltipTag:gLe,tooltipTagRunning:yLe,tooltipTagNew:bLe,tooltipMeta:vLe,sessionStatusSlot:wLe,sessionStatusDot:xLe,sessionPinMarker:_Le,sessionMetaSlot:kLe,sessionTime:SLe,sessionLoading:TLe,runningSession:CLe,sessionActions:ALe,activeSessionActionButton:ELe,searchInput:MLe,renameInput:NLe,dialogSelect:ILe,dialogInput:jLe,groupMenu:RLe,groupMenuItemActive:LLe,groupMenuName:DLe,groupMenuDot:OLe,groupMenuEmptyDot:BLe,groupMenuIcon:PLe,groupMenuCheck:$Le,groupMenuSeparator:zLe,groupColorRed:FLe,groupColorOrange:qLe,groupColorYellow:HLe,groupColorGreen:ULe,groupColorBlue:VLe,groupColorPurple:WLe,renameForm:GLe,notice:KLe,confirmContent:YLe,confirmDescription:QLe,confirmActions:XLe,groupForm:JLe,fieldStack:ZLe,footer:eDe,footerButtonLabel:tDe,footerCompact:nDe,footerTight:sDe,version:rDe,resizeHandle:iDe,sessionActionButtonActive:oDe,menuActive:aDe,actionMenu:lDe,actionMenuItem:cDe,actionMenuItemDanger:uDe,actionMenuIcon:dDe,actionMenuLabel:hDe,archivedSection:fDe,archivedHeader:mDe,archivedChevron:pDe,archivedTitle:gDe,archivedCount:yDe,archivedList:bDe,archivedRow:vDe,mobileOpen:wDe},WF="qwen-code-web-shell-sidebar-width",q1=260,xDe=220,GF=420,_De=344,kDe=250,KF=200,SDe=56,IN=KF-SDe,TDe=2e3,CDe=3e4,jN=96,ADe="recent",N4=240,Nh=8,Ym=["red","orange","yellow","green","blue","purple"];function fi(...e){return e.filter(Boolean).join(" ")}function RN(e){return e instanceof DOMException&&e.name==="AbortError"}function EDe(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function f0(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function MDe(e){const t=f0(e).replace(/\s+/g," ").trim();return t.length<=jN?t:`${t.slice(0,jN-3).trimEnd()}...`}function NDe(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function I4(e){return e[0]??"blue"}function j4(e){switch(e){case"red":return me.groupColorRed;case"orange":return me.groupColorOrange;case"yellow":return me.groupColorYellow;case"green":return me.groupColorGreen;case"blue":return me.groupColorBlue;case"purple":return me.groupColorPurple}return e}function av(e){return Math.min(GF,Math.max(xDe,e))}function IDe(e){return Math.min(GF,Math.max(KF,e))}function jDe(){if(typeof window>"u")return q1;try{const e=window.localStorage.getItem(WF),t=e?Number(e):q1;return Number.isFinite(t)?av(t):q1}catch{return q1}}function LN(e){try{window.localStorage.setItem(WF,String(av(e)))}catch{}}function H1(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M12 5v14M5 12h14"})})}function RDe(){return u.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:u.jsx("path",{fill:"#6D44E8",d:"m140.93 85-16.35-28.33-1.93-3.34 8.66-15a3.323 3.323 0 0 0 0-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33 3.33 0 0 0-2.89-1.67H51.43c-.59 0-1.17.16-1.66.45-.5.29-.92.71-1.22 1.22L32.19 29.98l-1.92 3.33H12.96c-.59 0-1.17.16-1.66.45-.5.29-.93.71-1.22 1.22L.45 51.66a3.323 3.323 0 0 0 0 3.34l18.28 31.67-8.66 15a3.32 3.32 0 0 0 0 3.34l9.62 16.67c.3.51.72.93 1.22 1.22s1.07.45 1.67.45h36.56l8.66 15a3.35 3.35 0 0 0 2.89 1.67h19.25a3.34 3.34 0 0 0 2.89-1.67l18.28-31.67h17.32c.6 0 1.17-.16 1.67-.45s.92-.71 1.22-1.22l9.62-16.67a3.323 3.323 0 0 0 0-3.34ZM51.44 3.33 61.07 20l-9.63 16.66h76.98l-9.62 16.66H45.67l-11.54-20zM57.21 120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62 16.67L68.78 100l-11.55 20Zm61.59-33.34-9.62-16.67-38.49 66.67-9.63-16.67 9.63-16.66 26.94-46.67h23.1l17.32 30z"})})}function LDe({expanded:e}){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3.25 8.6V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v1.1"}),u.jsx("path",{d:"M4.3 10.6h14.9a1.75 1.75 0 0 1 1.68 2.24l-1.32 4.5A2.4 2.4 0 0 1 17.25 19H5.05a2.4 2.4 0 0 1-2.34-2.94l.86-3.75A2.2 2.2 0 0 1 5.72 10.6"})]}):u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3.25 8.2V7.4A2.4 2.4 0 0 1 5.65 5h4.1l2.1 2.1h6.5a2.4 2.4 0 0 1 2.4 2.4v.7"}),u.jsx("path",{d:"M3.25 8.2h17.5v7.9a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V8.2Z"})]})})}function DDe(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m16.5 16.5 4 4"})]})}function ODe(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.9.3l-.1.1A2 2 0 1 1 4.2 17l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.9L4.2 7A2 2 0 1 1 7 4.2l.1.1a1.7 1.7 0 0 0 1.9.3h.1a1.7 1.7 0 0 0 .9-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1A2 2 0 1 1 19.8 7l-.1.1a1.7 1.7 0 0 0-.3 1.9v.1a1.7 1.7 0 0 0 1.5.9h.1a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1Z"})]})}function BDe(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M3 12h4l3-8 4 16 3-8h4"})})}function PDe(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("path",{d:"M12 7v5l3 2"})]})}function $De(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),u.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function zDe(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"4",width:"8",height:"16",rx:"1"}),u.jsx("rect",{x:"13",y:"4",width:"8",height:"16",rx:"1"})]})}function DN(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M4 20h5l10-10a3 3 0 0 0-5-5L4 15v5Z"}),u.jsx("path",{d:"M13.5 5.5 18.5 10.5"})]})}function FDe(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M12 3v12"}),u.jsx("path",{d:"m7 10 5 5 5-5"}),u.jsx("path",{d:"M5 21h14"})]})}function R4(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"})})}function U1(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"m14 4 6 6-4 1.5-3.5 3.5.5 4-8-8 4 .5 3.5-3.5L14 4Z"}),u.jsx("path",{d:"m5 19 4.5-4.5"})]})}function ON(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),u.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),u.jsx("path",{d:"M10 12h4"})]})}function BN(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("path",{d:"M4 10.5 12 5l8 5.5V19a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 19v-8.5Z"}),u.jsx("path",{d:"M9 20.5v-6h6v6"})]})}function PN(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),u.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),u.jsx("path",{d:"M12 18v-6M9 15l3-3 3 3"})]})}function $N(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"5",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"12",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"}),u.jsx("circle",{cx:"19",cy:"12",r:"1.4",fill:"currentColor",stroke:"none"})]})}function qDe({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?u.jsx("path",{d:"M9 6l6 6-6 6"}):u.jsx("path",{d:"M15 6l-6 6 6 6"})})}function L4({expanded:e}){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?u.jsx("path",{d:"m6 9 6 6 6-6"}):u.jsx("path",{d:"m9 6 6 6-6 6"})})}function HDe({anchorEl:e,items:t,onClose:n}){const s=g.useRef(null);g.useEffect(()=>{const l=d=>{var f;const h=d.target;h&&((f=s.current)!=null&&f.contains(h)||e.contains(h)||n())},c=d=>{d.key==="Escape"&&(d.stopPropagation(),n())};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",c,!0),window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",c,!0),window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n)}},[e,n]);const r=e.getBoundingClientRect(),i=t.length*34+8,o=r.bottom+i>window.innerHeight-8,a={right:Math.max(8,window.innerWidth-r.right),...o?{bottom:window.innerHeight-r.top+4}:{top:r.bottom+4}};return u.jsx("div",{ref:s,className:me.actionMenu,role:"menu",style:a,children:t.map(l=>u.jsxs("button",{type:"button",role:"menuitem",className:fi(me.actionMenuItem,l.danger&&me.actionMenuItemDanger),disabled:l.disabled,title:l.disabled?l.disabledTitle:void 0,onClick:()=>{l.disabled||(n(),l.onSelect())},children:[u.jsx("span",{className:me.actionMenuIcon,"aria-hidden":"true",children:l.icon}),u.jsx("span",{className:me.actionMenuLabel,children:l.label})]},l.key))})}function UDe({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenDaemonStatus:s,onOpenScheduledTasks:r,onOpenSessions:i,canOpenSessionsOverview:o,onOpenSplitView:a,canOpenSplitView:l,onNewSession:c,onLoadSession:d,onError:h,mobileOpen:f,sessionListReloadToken:m}){var _t,lt,pt,At,cn;const{t:p}=Xe(),y=ha(),w=Xp(),b=da(),v=!!((lt=(_t=y.capabilities)==null?void 0:_t.features)!=null&&lt.includes(p8)),{sessions:x,loading:_,error:E,reload:k,deleteSession:M,exportSession:R,archiveSession:L}=qd({autoLoad:!0,pageSize:iv,archiveState:"active",...v?{view:"organized",group:"all"}:{}}),[T,N]=g.useState(!1),{sessions:I,loading:O,error:U,reload:F,deleteSession:j,unarchiveSession:V}=qd({autoLoad:!0,enabled:T,pageSize:iv,archiveState:"archived",...v?{view:"organized",group:"all"}:{}}),[ee,ce]=g.useState(null),[$,J]=g.useState([]),[B,C]=g.useState([]),[z,X]=g.useState(!1),[ae,be]=g.useState(null),[fe,ie]=g.useState(""),[G,q]=g.useState(()=>new Set),le=g.useRef(new Set),[Se,$e]=g.useState(()=>new Set),Ae=g.useRef(new Set),[we,ct]=g.useState(!1),ht=g.useRef(!1),[ut,ft]=g.useState(null),[tt,qt]=g.useState(null),[Ye,ge]=g.useState(null),[st,ne]=g.useState(""),[ue,Re]=g.useState("blue"),[rt,vt]=g.useState(null),[tn,jn]=g.useState(()=>new Set),[ln,Pn]=g.useState(jDe),[Qt,ve]=g.useState(!0),[Be,He]=g.useState(!1),[Ht,Yn]=g.useState(""),[Wt,ss]=g.useState(!1),[Mt,Cn]=g.useState(null),[rn,Ln]=g.useState(()=>new Set),Xn=g.useRef(null),Nn=g.useRef(null),_n=g.useRef(null),Os=g.useRef(!1),ks=g.useRef(null),Kt=y.sessionId,Vn=((At=(pt=y.capabilities)==null?void 0:pt.features)==null?void 0:At.includes("session_export"))??!1,Te=EDe(y.workspaceCwd)||p("sidebar.projectFallback"),mt=((cn=y.capabilities)==null?void 0:cn.qwenCodeVersion)||"",Xt=mt?/^\d/.test(mt)?`v${mt}`:mt:"",mn=!e&&ln<_De,oe=!e&&ln<kDe,_e={"--web-shell-sidebar-width":`${ln}px`},se=we,pe=g.useCallback((Y,xe)=>{const ke=new Set(le.current);xe?ke.add(Y):ke.delete(Y),le.current=ke,q(ke)},[]),Le=g.useCallback(async()=>{if(!v){J([]),C([]);return}try{const Y=await b.listSessionGroups();J(Y.groups),C(Y.colorOptions)}catch(Y){h(Y,p("sidebar.groupsLoadFailed"))}},[h,v,p,b]);g.useEffect(()=>{if(!v){J([]),C([]);return}Le()},[v,Le]),g.useEffect(()=>{if(!tt)return;const Y=ke=>{var Ot;(Ot=Xn.current)!=null&&Ot.contains(ke.target)||qt(null)},xe=ke=>{ke.key==="Escape"&&qt(null)};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",xe),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",xe)}},[tt]),g.useEffect(()=>{if(!tt)return;const Y=window.requestAnimationFrame(()=>{var Ot;const xe=Array.from(((Ot=Xn.current)==null?void 0:Ot.querySelectorAll("button:not(:disabled)"))??[]),ke=xe.find(gn=>gn.getAttribute("aria-checked")==="true")??xe[0];ke==null||ke.focus()});return()=>window.cancelAnimationFrame(Y)},[tt]);const wt=g.useCallback(Y=>{var wn,Zt;const xe=Array.from(((wn=Xn.current)==null?void 0:wn.querySelectorAll("button:not(:disabled)"))??[]);if(xe.length===0)return;const ke=xe.indexOf(document.activeElement),Ot=ke>=0?ke:-1;let gn;if(Y.key==="ArrowDown")gn=(Ot+1)%xe.length;else if(Y.key==="ArrowUp")gn=(Ot-1+xe.length)%xe.length;else if(Y.key==="Home")gn=0;else if(Y.key==="End")gn=xe.length-1;else if(Y.key==="Escape"){Y.preventDefault(),qt(null);return}gn!==void 0&&(Y.preventDefault(),(Zt=xe[gn])==null||Zt.focus())},[]),dt=g.useCallback(()=>{Nn.current!==null&&(window.clearTimeout(Nn.current),Nn.current=null)},[]),Ft=g.useCallback(()=>{dt(),Nn.current=window.setTimeout(()=>{Cn(null),Nn.current=null},240)},[dt]);g.useEffect(()=>()=>{var Y;dt(),(Y=ks.current)==null||Y.call(ks,!1)},[dt]),g.useEffect(()=>{ve(!e),e&&(He(!1),Yn(""),Cn(null))},[e]);const on=g.useMemo(()=>x.some(Y=>Y.hasActivePrompt),[x]);g.useEffect(()=>{if(!Qt&&!on)return;const Y=on&&!E?TDe:CDe,xe=window.setInterval(()=>{document.hidden||Os.current||(Os.current=!0,k().finally(()=>{Os.current=!1}))},Y);return()=>window.clearInterval(xe)},[E,on,Qt,k]);const Ks=g.useRef(m);g.useEffect(()=>{m!==void 0&&m!==Ks.current&&!document.hidden&&!Os.current&&(Ks.current=m,Os.current=!0,k().finally(()=>{Os.current=!1}))},[m,k]),g.useEffect(()=>{const Y=new Map(x.map(ke=>[ke.sessionId,!!ke.hasActivePrompt])),xe=_n.current;_n.current=Y,xe!==null&&Ln(ke=>{const Ot=new Set(ke);let gn=!1;for(const[wn,Zt]of xe){const Jn=Y.get(wn);Zt&&Jn===!1&&wn!==Kt&&!Ot.has(wn)&&(Ot.add(wn),gn=!0)}for(const wn of Ot)(wn===Kt||!Y.has(wn)||Y.get(wn))&&(Ot.delete(wn),gn=!0);return gn?Ot:ke})},[Kt,x]);const pn=g.useCallback((Y,xe)=>{dt();const ke=Y.currentTarget.getBoundingClientRect();Cn({content:xe,top:ke.top+ke.height/2,left:ke.right+8})},[dt]),An=g.useCallback(Y=>{const xe=f0(Y),ke=Y.sessionId!==Kt&&rn.has(Y.sessionId);return u.jsxs("div",{className:me.tooltipContent,children:[u.jsx("div",{className:me.tooltipTitle,children:xe}),u.jsxs("div",{className:me.tooltipTags,children:[Y.hasActivePrompt&&u.jsx("span",{className:fi(me.tooltipTag,me.tooltipTagRunning),children:p("sidebar.running")}),ke&&u.jsx("span",{className:fi(me.tooltipTag,me.tooltipTagNew),children:p("sidebar.completedUnread")}),u.jsx("span",{className:me.tooltipTag,children:p("sidebar.clients",{count:Y.clientCount??0})})]}),u.jsx("div",{className:me.tooltipMeta,children:Y.sessionId})]})},[rn,Kt,p]),un=g.useCallback(()=>{ht.current||(ht.current=!0,ct(!0),(async()=>{try{await c()&&k().catch(()=>{})}catch(Y){RN(Y)||h(Y,p("sidebar.newSessionFailed"))}finally{ht.current=!1,ct(!1)}})())},[h,c,k,p]),rs=g.useCallback(Y=>{Y===Kt||le.current.has(Y)||(Ln(xe=>{if(!xe.has(Y))return xe;const ke=new Set(xe);return ke.delete(Y),ke}),pe(Y,!0),(async()=>{try{await d(Y)}catch(xe){RN(xe)||h(xe,p("sidebar.switchFailed"))}finally{pe(Y,!1)}})())},[Kt,h,d,pe,p]),Ys=g.useCallback(Y=>{be(Y.sessionId),ie(f0(Y))},[]),Bs=g.useCallback(()=>{be(null),ie("")},[]),Dt=g.useCallback(()=>{const Y=fe.trim();if(!Y||ae!==Kt){Bs();return}const xe=ae;le.current.has(xe)||(pe(xe,!0),w.renameSession(Y).then(()=>{Bs(),k()}).catch(ke=>{h(ke,p("sidebar.renameFailed")),Bs()}).finally(()=>{pe(xe,!1)}))},[w,Bs,Kt,fe,ae,h,k,pe,p]),Ps=g.useCallback(Y=>{Y.sessionId!==Kt&&ft(Y)},[Kt]),kn=g.useCallback((Y,xe)=>{const ke=new Set(Ae.current);xe?ke.add(Y):ke.delete(Y),Ae.current=ke,$e(ke)},[]),Si=g.useCallback(Y=>{const xe=Y.sessionId;!Vn||Ae.current.has(xe)||(kn(xe,!0),(async()=>{try{const ke=await R(xe,"html"),Ot=new Blob([ke.content],{type:ke.mimeType||"text/html"}),gn=URL.createObjectURL(Ot);try{const wn=document.createElement("a");wn.href=gn,wn.download=ke.filename,document.body.appendChild(wn),wn.click(),wn.remove()}finally{URL.revokeObjectURL(gn)}}catch(ke){h(ke,p("sidebar.exportFailed"))}finally{kn(xe,!1)}})())},[Vn,R,h,kn,p]),yr=g.useCallback(()=>{if(!ut)return;const Y=ut.sessionId;if(Y===Kt){ft(null);return}const xe=!!ut.isArchived;if(ft(null),le.current.has(Y))return;pe(Y,!0),(xe?j:M)(Y).then(()=>{k(),F()}).catch(Ot=>h(Ot,p("sidebar.deleteFailed"))).finally(()=>{pe(Y,!1)})},[Kt,j,ut,M,h,k,F,pe,p]),ma=g.useCallback(Y=>{Y.sessionId===Kt&&Ys(Y)},[Kt,Ys]),Oo=g.useCallback(()=>{qt(null),ne(""),Re(I4(B)),ge({mode:"create"})},[B]),El=g.useCallback(Y=>{qt(null),ne(""),Re(I4(B)),ge({mode:"create",targetSession:Y})},[B]),Ra=g.useCallback(Y=>{ne(Y.name),Re(Y.color),ge({mode:"edit",group:Y})},[]),rr=g.useCallback(()=>{z||(ge(null),ne(""),Re(I4(B)))},[B,z]),pa=g.useCallback(()=>{if(!Ye)return;const Y=st.trim();Y&&(async()=>{X(!0);try{const xe=Ye.mode==="create"?await b.createSessionGroup({name:Y,color:ue}):await b.updateSessionGroup(Ye.group.id,{name:Y,color:ue});if(Ye.mode==="create"&&Ye.targetSession)try{await b.updateSessionOrganization(Ye.targetSession.sessionId,{groupId:xe.id,color:null}),k().catch(()=>{})}catch(ke){ge(null),ne(""),Le().catch(()=>{}),h(ke,p("sidebar.groupAssignFailedAfterCreate"));return}ge(null),ne(""),Le().catch(()=>{})}catch(xe){h(xe,Ye.mode==="create"?p("sidebar.groupCreateFailed"):p("sidebar.groupUpdateFailed"))}finally{X(!1)}})()},[ue,Ye,st,h,k,Le,p,b]),li=g.useCallback(Y=>{vt(Y)},[]),Qs=g.useCallback(()=>{rt&&(X(!0),b.deleteSessionGroup(rt.id).then(()=>{vt(null),k().catch(()=>{})}).catch(Y=>h(Y,p("sidebar.groupDeleteFailed"))).then(()=>Le().catch(()=>{})).finally(()=>X(!1)))},[rt,h,k,Le,p,b]),Ti=g.useCallback(Y=>{const xe=Y.sessionId;!v||le.current.has(xe)||(pe(xe,!0),b.updateSessionOrganization(xe,{isPinned:!Y.isPinned}).then(()=>{k().catch(()=>{})}).catch(ke=>h(ke,p("sidebar.organizationFailed"))).finally(()=>{pe(xe,!1)}))},[h,v,k,pe,p,b]),Ci=g.useCallback(Y=>{const xe=Y.sessionId;xe!==Kt&&(le.current.has(xe)||(pe(xe,!0),L(xe).then(()=>{F()}).catch(ke=>h(ke,p("sidebar.archiveFailed"))).finally(()=>{pe(xe,!1)})))},[L,Kt,h,F,pe,p]),Wi=g.useCallback(Y=>{const xe=Y.sessionId;le.current.has(xe)||(pe(xe,!0),V(xe).then(()=>{k()}).catch(ke=>h(ke,p("sidebar.unarchiveFailed"))).finally(()=>{pe(xe,!1)}))},[h,k,pe,p,V]),ga=g.useCallback(()=>ce(null),[]),Bo=g.useCallback((Y,xe)=>{const ke=Y.getBoundingClientRect(),Ot=typeof window>"u"?ke.right+N4:window.innerWidth,gn=typeof window>"u"?ke.top+320:window.innerHeight,wn=Math.min(320,34*($.length+Ym.length+2)+25),Zt=ke.right+Nh+N4<=Ot?ke.right+Nh:Math.max(Nh,ke.left-N4-Nh),Jn=Math.max(Nh,Math.min(ke.top,gn-wn-Nh));Cn(null),qt({session:xe,top:Jn,left:Zt})},[$.length]),Ml=g.useCallback((Y,xe)=>{Y.stopPropagation(),Bo(Y.currentTarget,xe)},[Bo]),Gi=g.useCallback((Y,xe,ke)=>{Y.stopPropagation();const Ot=Y.currentTarget;ce(gn=>gn&&gn.session.sessionId===xe.sessionId&&gn.isArchived===ke?null:{session:xe,isArchived:ke,anchorEl:Ot})},[]),Ai=g.useCallback((Y,xe)=>{const ke=Y.sessionId;!v||le.current.has(ke)||(qt(null),pe(ke,!0),b.updateSessionOrganization(ke,{groupId:xe,color:null}).then(()=>{k().catch(()=>{})}).catch(Ot=>h(Ot,p("sidebar.organizationFailed"))).finally(()=>{pe(ke,!1)}))},[h,v,k,pe,p,b]),Q=g.useCallback((Y,xe)=>{const ke=Y.sessionId;!v||le.current.has(ke)||(qt(null),pe(ke,!0),b.updateSessionOrganization(ke,{color:xe,groupId:null}).then(()=>{k().catch(()=>{})}).catch(Ot=>h(Ot,p("sidebar.organizationFailed"))).finally(()=>{pe(ke,!1)}))},[h,v,k,pe,p,b]),de=g.useMemo(()=>{const Y=Ht.trim().toLowerCase(),xe=Y?x.filter(Ot=>f0(Ot).toLowerCase().includes(Y)||Ot.sessionId.toLowerCase().includes(Y)):x.slice();if(v)return xe;const ke=new Map(xe.map(Ot=>[Ot.sessionId,NDe(Ot)]));return xe.sort((Ot,gn)=>(ke.get(gn.sessionId)??0)-(ke.get(Ot.sessionId)??0))},[v,Ht,x]),Oe=g.useMemo(()=>{if(!v)return[];const Y=Ht.trim().length>0,xe=new Set($.map(Zt=>Zt.id)),ke=new Map,Ot=new Map;for(const Zt of $)Ot.set(Zt.id,[]);const gn=[];for(const Zt of de){if(Zt.color&&Ym.includes(Zt.color)){const Er=ke.get(Zt.color)??[];Er.push(Zt),ke.set(Zt.color,Er);continue}const Jn=Zt.groupId&&xe.has(Zt.groupId)?Ot.get(Zt.groupId):void 0;Jn?Jn.push(Zt):gn.push(Zt)}const wn=[];for(const Zt of Ym){const Jn=ke.get(Zt);!Jn||Jn.length===0||wn.push({id:`color:${Zt}`,kind:"color",label:p(`sidebar.groupColor.${Zt}`),countLabel:String(Jn.length),color:Zt,sessions:Jn})}for(const Zt of $){const Jn=Ot.get(Zt.id)??[];Y&&Jn.length===0||wn.push({id:`group:${Zt.id}`,kind:"group",label:Zt.name,countLabel:String(Jn.length),color:Zt.color,group:Zt,sessions:Jn})}return gn.length>0&&wn.push({id:ADe,kind:"recent",label:p("sidebar.groupRecent"),sessions:gn}),wn},[de,$,v,Ht,p]),et=g.useCallback(Y=>{jn(xe=>{const ke=new Set(xe);return ke.has(Y)?ke.delete(Y):ke.add(Y),ke})},[]),bn=g.useCallback(Y=>{var ur;if(e)return;Y.preventDefault(),(ur=ks.current)==null||ur.call(ks,!0),ss(!0);const xe=Y.clientX,ke=ln,Ot=document.body.style.cursor,gn=document.body.style.userSelect;let wn=!1,Zt=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{Y.currentTarget.setPointerCapture(Y.pointerId)}catch{}function Jn(dn){return ke+dn-xe}function Er(){const dn=av(ke);Pn(dn),LN(dn)}function zr(){wn||(wn=!0,Er(),Zt(!0),t(!0))}function Po(dn){const ya=Jn(dn.clientX);if(ya<=IN){zr();return}Pn(IDe(ya))}Zt=function(ya){document.body.style.cursor=Ot,document.body.style.userSelect=gn,window.removeEventListener("pointermove",Po),window.removeEventListener("pointerup",Vu),window.removeEventListener("pointercancel",Js),ks.current=null,ya&&ss(!1)};function Vu(dn){const ya=Jn(dn.clientX);if(ya<=IN){zr();return}const gm=av(ya);Pn(gm),LN(gm),Zt(!0)}function Js(){Zt(!0)}ks.current=Zt,window.addEventListener("pointermove",Po),window.addEventListener("pointerup",Vu,{once:!0}),window.addEventListener("pointercancel",Js,{once:!0})},[e,t,ln]),$t=ut?MDe(ut):"",vn=tt!=null&&tt.session.color&&Ym.includes(tt.session.color)?tt.session.color:null,is=!vn&&(tt!=null&&tt.session.groupId)&&$.some(Y=>Y.id===tt.session.groupId)?tt.session.groupId:null,ds=B.length>0?B:Ym,hs=is===null&&vn===null,ze=(rt==null?void 0:rt.name)??"",Wn=st.trim().length>0&&!z,In=(Ye==null?void 0:Ye.mode)==="create"?p("sidebar.groupCreate"):p("sidebar.groupRename"),Xs=B.length>0?B:["blue"],vs=g.useCallback((Y,xe={})=>{const{isArchived:ke=!1,grouped:Ot=!1}=xe,gn=f0(Y),wn=Y.updatedAt||Y.createdAt,Zt=wn?h8(wn,p):"",Jn=G.has(Y.sessionId),Er=(ee==null?void 0:ee.session.sessionId)===Y.sessionId&&ee.isArchived===ke;if(ke)return u.jsxs("div",{className:fi(me.sessionRow,me.archivedRow,Jn&&me.busySession,Er&&me.menuActive),title:gn,children:[u.jsx("span",{className:me.sessionText,children:gn}),u.jsxs("div",{className:me.sessionMetaSlot,children:[u.jsx("span",{className:me.sessionTime,children:Zt}),u.jsxs("div",{className:me.sessionActions,onClick:dn=>dn.stopPropagation(),onKeyDown:dn=>dn.stopPropagation(),children:[u.jsx("button",{className:me.sessionActionButton,type:"button",title:p("sidebar.unarchive"),"aria-label":p("sidebar.unarchive"),onClick:()=>Wi(Y),children:u.jsx(PN,{})}),u.jsx("button",{className:fi(me.sessionActionButton,Er&&me.sessionActionButtonActive),type:"button","aria-label":p("sidebar.moreActions"),"aria-haspopup":"menu","aria-expanded":Er,title:p("sidebar.moreActions"),onClick:dn=>Gi(dn,Y,!0),children:u.jsx($N,{})})]})]})]},Y.sessionId);const zr=Y.sessionId===Kt,Po=ae===Y.sessionId,Vu=Se.has(Y.sessionId),Js=!zr&&rn.has(Y.sessionId),ur=Ot&&Y.isPinned&&!Y.hasActivePrompt;return u.jsx("div",{className:fi(me.sessionRow,Ot&&me.groupedSessionRow,zr&&me.currentSession,Y.isPinned&&me.pinnedSession,Y.hasActivePrompt&&me.runningSession,Jn&&me.busySession,Er&&me.menuActive),role:"button",tabIndex:0,"aria-current":zr?"page":void 0,onMouseEnter:dn=>pn(dn,An(Y)),onMouseLeave:Ft,onFocus:dn=>pn(dn,An(Y)),onBlur:Ft,onClick:()=>rs(Y.sessionId),onDoubleClick:()=>{zr&&!e&&Ys(Y)},onKeyDown:dn=>{dn.key==="Enter"&&rs(Y.sessionId)},children:!e&&u.jsxs(u.Fragment,{children:[u.jsxs("span",{className:me.sessionStatusSlot,"aria-hidden":"true",children:[Js&&u.jsx("span",{className:me.sessionStatusDot}),!Js&&Y.isPinned&&!Ot&&u.jsx("span",{className:me.sessionPinMarker,children:u.jsx(U1,{})})]}),Po?u.jsx("form",{className:me.renameForm,onClick:dn=>dn.stopPropagation(),onSubmit:dn=>{dn.preventDefault(),Dt()},children:u.jsx("input",{autoFocus:!0,className:me.renameInput,value:fe,onChange:dn=>ie(dn.target.value),onBlur:Bs,onKeyDown:dn=>{dn.key==="Escape"&&(dn.preventDefault(),Bs())}})}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:me.sessionText,children:gn}),u.jsxs("div",{className:me.sessionMetaSlot,children:[Y.hasActivePrompt?u.jsx("span",{className:me.sessionLoading,"aria-label":p("sidebar.running")}):ur?u.jsx("span",{className:me.sessionPinnedIndicator,"aria-label":p("sidebar.pin"),children:u.jsx(U1,{})}):u.jsx("span",{className:me.sessionTime,children:Zt}),u.jsxs("div",{className:me.sessionActions,onClick:dn=>dn.stopPropagation(),onKeyDown:dn=>dn.stopPropagation(),onMouseEnter:dn=>{dn.stopPropagation(),Cn(null)},children:[v&&u.jsxs(u.Fragment,{children:[u.jsx("button",{className:fi(me.sessionActionButton,Y.isPinned&&me.activeSessionActionButton),type:"button",disabled:Jn,title:Y.isPinned?p("sidebar.unpin"):p("sidebar.pin"),"aria-label":Y.isPinned?p("sidebar.unpin"):p("sidebar.pin"),onClick:()=>Ti(Y),children:u.jsx(U1,{})}),u.jsx("button",{className:me.sessionActionButton,type:"button",disabled:Jn,title:p("sidebar.sessionGroup"),"aria-label":p("sidebar.sessionGroup"),onClick:dn=>Ml(dn,Y),children:u.jsx(BN,{})})]}),u.jsx("button",{className:me.sessionActionButton,type:"button",disabled:zr,title:p(zr?"sidebar.archiveCurrentDisabled":"sidebar.archive"),"aria-label":p("sidebar.archive"),onClick:()=>Ci(Y),children:u.jsx(ON,{})}),Vn&&u.jsx("button",{className:me.sessionActionButton,type:"button",disabled:Vu,title:p("sidebar.export"),"aria-label":p("sidebar.export"),onClick:()=>Si(Y),children:u.jsx(FDe,{})}),u.jsx("button",{className:fi(me.sessionActionButton,Er&&me.sessionActionButtonActive),type:"button","aria-label":p("sidebar.moreActions"),"aria-haspopup":"menu","aria-expanded":Er,title:p("sidebar.moreActions"),onClick:dn=>Gi(dn,Y,!1),children:u.jsx($N,{})})]})]})]})]})},Y.sessionId)},[G,Vn,Bs,e,rn,Kt,fe,ae,Se,Ci,Si,rs,Ti,Wi,Ft,ee,Ml,Gi,v,An,Dt,pn,Ys,p]),Ss=g.useMemo(()=>Qt?_&&x.length===0?u.jsx("div",{className:me.notice,children:p("sidebar.loadingSessions")}):E&&x.length===0?u.jsx("button",{className:me.retry,type:"button",onClick:k,children:p("sidebar.loadFailed")}):de.length===0&&(Ht.trim()||!v||Oe.length===0)?u.jsx("div",{className:me.notice,children:p("sidebar.searchEmpty")}):v?Oe.map(Y=>{const xe=!tn.has(Y.id),ke=Y.group;return u.jsxs("section",{className:me.sessionGroupSection,"aria-label":Y.label,children:[u.jsxs("div",{className:me.sessionGroupHeaderRow,children:[u.jsxs("button",{type:"button",className:me.sessionGroupHeader,"aria-expanded":xe,onClick:()=>et(Y.id),children:[Y.color?u.jsx("span",{className:fi(me.sessionGroupDot,j4(Y.color)),"aria-hidden":"true"}):null,u.jsx("span",{className:me.sessionGroupTitle,children:Y.label}),Y.countLabel?u.jsxs("span",{className:me.sessionGroupCount,children:["· ",Y.countLabel]}):null,u.jsx("span",{className:me.sessionGroupChevron,"aria-hidden":"true",children:u.jsx(L4,{expanded:xe})})]}),u.jsx("div",{className:me.sessionGroupHeaderActions,children:Y.kind==="group"&&ke?u.jsxs(u.Fragment,{children:[u.jsx("button",{className:me.sessionGroupActionButton,type:"button",title:p("sidebar.groupCreate"),"aria-label":p("sidebar.groupCreate"),disabled:z,onClick:Oo,children:u.jsx(H1,{})}),u.jsx("button",{className:me.sessionGroupActionButton,type:"button",title:p("sidebar.groupRename"),"aria-label":p("sidebar.groupRename"),disabled:z,onClick:()=>Ra(ke),children:u.jsx(DN,{})}),u.jsx("button",{className:me.sessionGroupActionButton,type:"button",title:p("sidebar.groupDelete"),"aria-label":p("sidebar.groupDelete"),disabled:z,onClick:()=>li(ke),children:u.jsx(R4,{})})]}):Y.kind==="recent"?u.jsx("button",{className:me.sessionGroupActionButton,type:"button",title:p("sidebar.groupCreate"),"aria-label":p("sidebar.groupCreate"),disabled:z,onClick:Oo,children:u.jsx(H1,{})}):null})]}),xe&&u.jsx("div",{className:me.sessionGroupList,children:Y.sessions.map(Ot=>vs(Ot,{grouped:!0}))})]},Y.id)}):de.map(Y=>vs(Y)):null,[tn,E,de,z,Oo,li,Ra,_,v,Qt,k,vs,Ht,Oe,x.length,p,et]),$n=g.useMemo(()=>{if(e||!Qt||Ht.trim())return null;const Y=u.jsxs("button",{type:"button",className:me.archivedHeader,"aria-expanded":T,onClick:()=>N(ke=>!ke),children:[u.jsx("span",{className:me.archivedChevron,"aria-hidden":"true",children:u.jsx(L4,{expanded:T})}),u.jsx("span",{className:me.archivedTitle,children:p("sidebar.archivedTitle")}),T&&I.length>0&&u.jsx("span",{className:me.archivedCount,children:I.length})]});if(!T)return u.jsx("div",{className:me.archivedSection,children:Y});let xe;return O&&I.length===0?xe=u.jsx("div",{className:me.notice,children:p("sidebar.loadingSessions")}):U&&I.length===0?xe=u.jsx("button",{className:me.retry,type:"button",onClick:()=>F(),children:p("sidebar.loadFailed")}):I.length===0?xe=u.jsx("div",{className:me.notice,children:p("sidebar.archivedEmpty")}):xe=I.map(ke=>vs(ke,{isArchived:!0})),u.jsxs("div",{className:me.archivedSection,children:[Y,u.jsx("div",{className:me.archivedList,children:xe})]})},[U,T,O,I,e,Qt,F,vs,Ht,p]),Me=g.useMemo(()=>{if(!ee)return[];const{session:Y,isArchived:xe}=ee;if(xe)return[{key:"unarchive",label:p("sidebar.unarchive"),icon:u.jsx(PN,{}),onSelect:()=>Wi(Y)},{key:"delete",label:p("sidebar.delete"),icon:u.jsx(R4,{}),danger:!0,onSelect:()=>Ps(Y)}];const ke=Y.sessionId===Kt,Ot=G.has(Y.sessionId);return[{key:"rename",label:p("sidebar.rename"),icon:u.jsx(DN,{}),disabled:!ke,disabledTitle:p("sidebar.renameCurrentOnly"),onSelect:()=>ma(Y)},...v?[{key:"pin",label:Y.isPinned?p("sidebar.unpin"):p("sidebar.pin"),icon:u.jsx(U1,{}),disabled:Ot,onSelect:()=>Ti(Y)},{key:"group",label:p("sidebar.sessionGroup"),icon:u.jsx(BN,{}),disabled:Ot,onSelect:()=>Bo(ee.anchorEl,Y)}]:[],{key:"archive",label:p("sidebar.archive"),icon:u.jsx(ON,{}),disabled:ke,disabledTitle:p("sidebar.archiveCurrentDisabled"),onSelect:()=>Ci(Y)},{key:"delete",label:p("sidebar.delete"),icon:u.jsx(R4,{}),danger:!0,disabled:ke,disabledTitle:p("sidebar.currentDeleteDisabled"),onSelect:()=>Ps(Y)}]},[G,Kt,Ci,Ps,ma,Ti,Wi,ee,Bo,v,p]);return u.jsxs("aside",{className:fi(me.sidebar,e&&me.collapsed,Wt&&me.resizing,f&&me.mobileOpen),"aria-label":p("sidebar.label"),style:_e,children:[Mt&&u.jsx("div",{className:me.floatingTooltip,role:"tooltip",style:{top:Mt.top,left:Mt.left},onMouseEnter:dt,onMouseLeave:Ft,children:Mt.content}),tt&&u.jsxs("div",{ref:Xn,className:me.groupMenu,role:"menu","aria-label":p("sidebar.sessionGroup"),style:{top:tt.top,left:tt.left},onClick:Y=>Y.stopPropagation(),onKeyDown:wt,onMouseDown:Y=>Y.stopPropagation(),children:[u.jsxs("button",{className:fi(me.groupMenuItem,hs&&me.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":hs,onClick:()=>Ai(tt.session,null),children:[u.jsx("span",{className:me.groupMenuEmptyDot}),u.jsx("span",{className:me.groupMenuName,children:p("sidebar.groupUngrouped")}),hs&&u.jsx("span",{className:me.groupMenuCheck,children:"✓"})]}),ds.map(Y=>{const xe=vn===Y;return u.jsxs("button",{className:fi(me.groupMenuItem,xe&&me.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":xe,onClick:()=>Q(tt.session,Y),children:[u.jsx("span",{className:fi(me.groupMenuDot,j4(Y))}),u.jsx("span",{className:me.groupMenuName,children:p(`sidebar.groupColor.${Y}`)}),xe&&u.jsx("span",{className:me.groupMenuCheck,children:"✓"})]},`color:${Y}`)}),$.map(Y=>{const xe=is===Y.id;return u.jsxs("button",{className:fi(me.groupMenuItem,xe&&me.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":xe,onClick:()=>Ai(tt.session,Y.id),children:[u.jsx("span",{className:fi(me.groupMenuDot,j4(Y.color))}),u.jsx("span",{className:me.groupMenuName,children:Y.name}),xe&&u.jsx("span",{className:me.groupMenuCheck,children:"✓"})]},Y.id)}),u.jsx("div",{className:me.groupMenuSeparator}),u.jsxs("button",{className:me.groupMenuItem,type:"button",role:"menuitem",onClick:()=>El(tt.session),children:[u.jsx("span",{className:me.groupMenuIcon,children:u.jsx(H1,{})}),u.jsx("span",{className:me.groupMenuName,children:p("sidebar.groupCreate")})]})]}),ee&&u.jsx(HDe,{anchorEl:ee.anchorEl,items:Me,onClose:ga}),ut&&u.jsx(Mr,{title:p("delete.title"),size:"sm",onClose:()=>ft(null),children:u.jsxs("div",{className:me.confirmContent,children:[u.jsx("p",{className:me.confirmDescription,children:p("sidebar.deleteConfirmDescription",{name:$t})}),u.jsxs("div",{className:me.confirmActions,children:[u.jsx("button",{className:me.secondaryButton,type:"button",onClick:()=>ft(null),children:p("common.cancel")}),u.jsx("button",{className:me.dangerButton,type:"button",onClick:yr,children:p("sidebar.delete")})]})]})}),Ye&&u.jsx(Mr,{title:In,size:"sm",onClose:rr,children:u.jsxs("form",{className:me.groupForm,onSubmit:Y=>{Y.preventDefault(),pa()},children:[u.jsxs("label",{className:me.fieldStack,children:[u.jsx("span",{children:p("sidebar.groupNamePrompt")}),u.jsx("input",{className:me.dialogInput,value:st,autoFocus:!0,maxLength:64,onChange:Y=>ne(Y.target.value)})]}),u.jsxs("label",{className:me.fieldStack,children:[u.jsx("span",{children:p("sidebar.groupColor")}),u.jsx("select",{className:me.dialogSelect,value:ue,onChange:Y=>Re(Y.target.value),children:Xs.map(Y=>u.jsx("option",{value:Y,children:p(`sidebar.groupColor.${Y}`)},Y))})]}),u.jsxs("div",{className:me.confirmActions,children:[u.jsx("button",{className:me.secondaryButton,type:"button",disabled:z,onClick:rr,children:p("common.cancel")}),u.jsx("button",{className:me.secondaryButton,type:"submit",disabled:!Wn,children:p("common.save")})]})]})}),rt&&u.jsx(Mr,{title:p("sidebar.groupDelete"),size:"sm",onClose:()=>{z||vt(null)},children:u.jsxs("div",{className:me.confirmContent,children:[u.jsx("p",{className:me.confirmDescription,children:p("sidebar.groupDeleteConfirm",{name:ze})}),u.jsxs("div",{className:me.confirmActions,children:[u.jsx("button",{className:me.secondaryButton,type:"button",disabled:z,onClick:()=>vt(null),children:p("common.cancel")}),u.jsx("button",{className:me.dangerButton,type:"button",disabled:z,onClick:Qs,children:p("sidebar.groupDelete")})]})]})}),u.jsxs("div",{className:me.topRow,children:[!e&&u.jsx("span",{className:me.brandLogo,"aria-hidden":"true",children:u.jsx(RDe,{})}),u.jsxs("button",{className:me.newChatButton,type:"button",title:p("sidebar.newChat"),"aria-label":p("sidebar.newChat"),disabled:se,onClick:un,children:[u.jsx("span",{className:me.navIcon,children:u.jsx(H1,{})}),!e&&u.jsx("span",{children:p("sidebar.newChat")})]})]}),u.jsxs("div",{className:me.body,children:[!e&&u.jsx("div",{className:me.sectionTitle,children:p("sidebar.project")}),u.jsxs("div",{className:me.projectRow,role:"button",tabIndex:0,"aria-expanded":Qt,onClick:()=>{e||ve(Y=>!Y)},onKeyDown:Y=>{e||(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),ve(xe=>!xe))},onMouseEnter:Y=>pn(Y,u.jsxs("div",{className:me.tooltipContent,children:[u.jsx("div",{className:me.tooltipTitle,children:Te}),u.jsx("div",{className:me.tooltipMeta,children:y.workspaceCwd||Te})]})),onMouseLeave:Ft,onFocus:Y=>pn(Y,u.jsxs("div",{className:me.tooltipContent,children:[u.jsx("div",{className:me.tooltipTitle,children:Te}),u.jsx("div",{className:me.tooltipMeta,children:y.workspaceCwd||Te})]})),onBlur:Ft,children:[u.jsx("span",{className:`${me.navIcon} ${me.projectFolderIcon}`,children:u.jsx(LDe,{expanded:Qt})}),!e&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:me.projectName,children:Te}),u.jsx("button",{className:me.projectIconButton,type:"button","aria-label":p("sidebar.search"),onKeyDown:Y=>Y.stopPropagation(),onClick:Y=>{Y.stopPropagation(),He(xe=>(xe&&Yn(""),!xe)),ve(!0)},children:u.jsx(DDe,{})}),u.jsx("button",{className:me.projectIconButton,type:"button","aria-label":p(Qt?"sidebar.collapseProject":"sidebar.expandProject"),onKeyDown:Y=>Y.stopPropagation(),onClick:Y=>{Y.stopPropagation(),ve(xe=>!xe)},children:u.jsx(L4,{expanded:Qt})})]})]}),Be&&!e&&Qt&&u.jsx("input",{className:me.searchInput,value:Ht,placeholder:p("sidebar.searchPlaceholder"),"aria-label":p("sidebar.search"),autoFocus:!0,onChange:Y=>Yn(Y.target.value),onKeyDown:Y=>{Y.key==="Escape"&&(Yn(""),He(!1))}}),u.jsxs("div",{className:me.sessionList,children:[Ss,$n]})]}),u.jsxs("div",{className:fi(me.footer,mn&&me.footerCompact,oe&&me.footerTight),children:[u.jsxs("button",{className:me.footerButton,type:"button",title:p("sidebar.settings"),"aria-label":p("sidebar.settings"),onClick:n,children:[u.jsx("span",{className:`${me.navIcon} ${me.settingsIcon}`,children:u.jsx(ODe,{})}),!e&&!mn&&u.jsx("span",{className:me.footerButtonLabel,children:p("sidebar.settings")})]}),!e&&!oe&&Xt&&u.jsx("span",{className:me.version,title:`Qwen Code ${Xt}`,children:Xt}),u.jsx("button",{className:me.collapseButton,type:"button",title:p("sidebar.scheduledTasks"),"aria-label":p("sidebar.scheduledTasks"),onClick:r,children:u.jsx(PDe,{})}),o&&u.jsx("button",{className:me.collapseButton,type:"button",title:p("sidebar.sessionsOverview"),"aria-label":p("sidebar.sessionsOverview"),onClick:i,children:u.jsx($De,{})}),l&&u.jsx("button",{className:me.collapseButton,type:"button",title:p("sidebar.splitView"),"aria-label":p("sidebar.splitView"),onClick:a,children:u.jsx(zDe,{})}),u.jsx("button",{className:me.collapseButton,type:"button",title:p("sidebar.daemonStatus"),"aria-label":p("sidebar.daemonStatus"),onClick:s,children:u.jsx(BDe,{})}),!f&&u.jsx("button",{className:me.collapseButton,type:"button",title:p(e?"sidebar.expand":"sidebar.collapse"),"aria-label":p(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:u.jsx(qDe,{collapsed:e})})]}),u.jsx("div",{className:me.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:bn})]})}function VDe(e){const[t,n]=g.useState(e);return g.useEffect(()=>{const s=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(s)},[e]),t}const WDe=3e3,GDe=2;function zN(e){return e.some(t=>t.status==="running"||t.status==="paused")}function KDe(e,t,n=0){const s=Xp(),[r,i]=g.useState([]),[o,a]=g.useState(!1),[l,c]=g.useState(!1),d=g.useRef(0),h=g.useRef(!1);g.useEffect(()=>{if(!t){i([]),a(!1),d.current=0;return}},[t]),g.useEffect(()=>{!t||!e||(d.current=0,a(!0))},[t,e]),g.useEffect(()=>{!t||n===0||(d.current=0,a(!0))},[t,n]),g.useEffect(()=>{if(l||!t||!o)return;let m=!1;const p=()=>{h.current||(h.current=!0,s.getTasks().then(w=>{if(!m){if(i(w.tasks),w.tasks.length===0){d.current+=1,d.current>=GDe&&a(!1);return}d.current=0,zN(w.tasks)||a(!1)}}).catch(w=>{m||console.warn("[web-shell] failed to refresh tasks:",w)}).finally(()=>{h.current=!1}))};p();const y=setInterval(p,WDe);return()=>{m=!0,clearInterval(y)}},[s,t,o,l]);const f=g.useRef(r);return f.current=r,g.useEffect(()=>{const m=p=>{const y=p.detail,w=(y==null?void 0:y.active)===!0;c(w),!w&&zN(f.current)&&a(!0)};return window.addEventListener(vp,m),()=>window.removeEventListener(vp,m)},[]),r}function YDe(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!="object"||typeof t!="object")return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((i,o)=>i===t[o]);const n=Object.keys(e),s=t,r=e;return n.length!==Object.keys(s).length?!1:n.every(i=>{const o=r[i],a=s[i];return o===a?!0:Array.isArray(o)&&Array.isArray(a)?o.length===a.length&&o.every((l,c)=>l===a[c]):!1})}function QDe(e){const t=g.useRef(e);return YDe(t.current,e)||(t.current=e),t.current}function XDe(e,t){const n=g.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((r,i)=>t(r)!==t(n.current[i]))&&(n.current=e),n.current)}const Ir={NO_OUTPUT:"No output in history",NO_TEXT:"Last AI output contains no text to copy.",CODE_MISSING:"No matching code block found in the last AI output.",LATEX_MISSING:"No matching LaTeX block found in the last AI output.",INLINE_LATEX_MISSING:"No matching inline LaTeX expression found in the last AI output.",OUTPUT_COPIED:"Last output copied to the clipboard",CLIPBOARD_PREFIX:"Failed to copy to the clipboard. ",COPIED_SUFFIX:" copied to the clipboard"},FN=1024,JDe=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${FN}}\S\$)([^$\n]{1,${FN}})\$(?![\w$])`,"g");function ZDe(e){var c,d,h;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=new Map;let i=null,o=null,a=null,l=[];for(const f of n){const m=f.match(s);if(!i){if(m){if(i=m[1]??null,o=((d=(c=m[2])==null?void 0:c.trim().split(/\s+/)[0])==null?void 0:d.toLowerCase())||null,o){const p=(r.get(o)??0)+1;r.set(o,p),a=p}else a=null;l=[]}continue}if(m&&((h=m[1])!=null&&h.startsWith(i[0]??""))&&m[1].length>=i.length){t.push({lang:o,content:l.join(`
`),index:t.length+1,langIndex:a}),i=null,o=null,a=null,l=[];continue}l.push(f)}return t}function eOe(e){var l;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const c of n){const d=c.match(s);if(i){d&&((l=d[1])!=null&&l.startsWith(i[0]??""))&&d[1].length>=i.length&&(i=null);continue}if(!o){if(d){i=d[1]??null;continue}r.test(c)&&(o=!0,a=[]);continue}if(r.test(c)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(c)}return t}function tOe(e){var a;const t=[],n=e.split(/\r?\n/),s=/^ *(`{3,}|~{3,}) *([^`]*)$/,r=/^ *\$\$ *$/;let i=null,o=!1;for(const l of n){const c=l.match(s);if(i){c&&((a=c[1])!=null&&a.startsWith(i[0]??""))&&c[1].length>=i.length&&(i=null);continue}if(o){r.test(l)&&(o=!1);continue}if(c){i=c[1]??null;continue}if(r.test(l)){o=!0;continue}for(const d of l.matchAll(JDe)){const h=d[1];h&&t.push({content:h,index:t.length+1})}}return t}function qN(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function nOe(e,t){var d;const n=t.trim().split(/\s+/).filter(Boolean),s=(d=n[0])==null?void 0:d.toLowerCase();if(!s)return;const r=ZDe(e);if(r.length===0)return null;let i=null,o=null;const a=s==="code"?n.slice(1):n.map(h=>h);s!=="code"&&(i=s);for(const h of a)/^\d+$/.test(h)?o=Number(h):h.toLowerCase()!=="code"&&(i=h.toLowerCase());const l=i?r.filter(h=>h.lang===i):r;if(l.length===0)return null;if(o!==null){const h=i?l.find(f=>f.langIndex===o):r.find(f=>f.index===o);return h?{content:h.content,label:qN(h,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:qN(c,i)}:null}function HN(e,t){const n=tOe(e);if(n.length===0)return null;let s=null;for(const i of t)/^\d+$/.test(i)&&(s=Number(i));const r=s!==null?n.find(i=>i.index===s):n[n.length-1];return r?{content:r.content,label:`Inline LaTeX expression ${r.index}`}:null}function sOe(e,t){var c;const n=t.trim().split(/\s+/).filter(Boolean),s=(c=n[0])==null?void 0:c.toLowerCase();if(s!=="latex"&&s!=="math"&&s!=="inline-latex")return;if(s==="inline-latex")return HN(e,n.slice(1));const r=n.slice(1),i=r.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return HN(e,r.filter((d,h)=>h!==i));const o=eOe(e);if(o.length===0)return null;let a=null;for(const d of r)/^\d+$/.test(d)&&(a=Number(d));const l=a!==null?o.find(d=>d.index===a):o[o.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function rOe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="assistant"&&n.content)return n.content}return null}function iOe(e){var t;return typeof navigator>"u"||!((t=navigator.clipboard)!=null&&t.writeText)?Promise.reject(new Error("Clipboard API is not available")):navigator.clipboard.writeText(e)}async function oOe(e,t,n=iOe){const s=rOe(e);if(s===null)return{status:"info",message:Ir.NO_OUTPUT};if(!s)return{status:"info",message:Ir.NO_TEXT};try{const r=sOe(s,t);if(r===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Ir.INLINE_LATEX_MISSING:Ir.LATEX_MISSING};if(r!==void 0)return await n(r.content),{status:"info",message:`${r.label}${Ir.COPIED_SUFFIX}`};const i=nOe(s,t);if(i===null)return{status:"info",message:Ir.CODE_MISSING};const o=(i==null?void 0:i.content)??s;return await n(o),{status:"info",message:i?`${i.label}${Ir.COPIED_SUFFIX}`:Ir.OUTPUT_COPIED}}catch(r){const i=r instanceof Error?r.message:String(r);return{status:"error",message:`${Ir.CLIPBOARD_PREFIX}${i}`}}}function aOe(e){return typeof e=="object"&&e!==null}function YF(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function g8(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function lOe(e){if(!g8(e)||!aOe(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function cOe(e){const t=new Set;for(const n of e){if(!g8(n))continue;const s=lOe(n);s&&t.add(s)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const s=YF(n.content);return!s||!t.has(s)})}function uOe(e){return e.role!=="system"||e.variant!=="info"?!1:YF(e.content)!==null||g8(e)}function dOe(e){const t=e.findIndex(n=>!uOe(n));return t<0?[]:e.slice(t)}function UN(e){return dOe(cOe(e))}function hOe(e){return e.blocked?{kind:"ignore"}:e.streaming?e.armed==="cancel"?{kind:"cancel"}:{kind:"arm",action:"cancel"}:e.hasInput?e.armed==="clear"?{kind:"clear"}:{kind:"arm",action:"clear"}:{kind:"ignore"}}function VN(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const s of e.cells){const r=s.detail;s.kind==="node_version"&&(r!=null&&r.version)?n.nodeVersion=r.version:s.kind==="npm"&&(r!=null&&r.version)?n.npmVersion=String(r.version).replace(/^npm\s*/i,""):s.kind==="auth"&&(r!=null&&r.source)&&(n.authSource=r.source)}if(t)for(const s of t.cells)s.kind==="platform"?(n.platform=s.name,s.value&&(n.arch=s.value)):s.kind==="sandbox"&&s.name==="SANDBOX"?n.sandbox=s.value||"":s.kind==="proxy"&&s.present&&s.value?n.proxy=`${s.name}: ${s.value}`:s.kind==="memory"&&s.value&&(n.memoryUsage=s.value);return n}function fOe(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function mOe(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function pOe(e){const t=e.indexOf("\0"),n=t>=0?e.slice(0,t):e,s=n.indexOf(":");return s>0?`${n.slice(s+1)}(${n.slice(0,s)})`:n}function gOe(e,t,n,s){return e?!0:(s.append(t),!1)}function QF(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}const yOe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='none'%20version='1.1'%20width='12.400195360183716'%20height='13.973437547683716'%20viewBox='0%200%2012.400195360183716%2013.973437547683716'%3e%3cpath%20d='M8.200192523841858,3.504687623841858L4.200002823841858,3.504687623841858L2.999997223841858,3.504690323841858L2.400195323841858,3.504687623841858L2.400195323841858,10.305688523841859L2.400198123841858,10.905691023841857L1.200192573841858,10.905691023841857L1.200195313841858,10.305688523841859L1.2001953738418578,3.504687623841858L0.6000000238418579,3.504687623841858L-0.0000027461581421084347,3.504690323841858L-0.0000027461581421084347,2.304684723841858L0.6000000238418579,2.304687523841858L2.999999923841858,2.304687523841858L2.999999923841858,3.8418579428878274e-9L9.400195723841858,3.8418579428878274e-9L9.400195723841858,2.304687523841858L11.800195023841859,2.304687523841858L12.400198023841858,2.304684723841858L12.400198023841858,3.504690323841858L11.800195023841859,3.5046874238418577L11.200000023841858,3.504687623841858L11.200000023841858,13.973437023841857L1.800195323841858,13.973437023841857L1.200192573841858,13.973440023841858L1.200192573841858,12.773435023841857L1.800195323841858,12.773437023841858L10.000000623841858,12.773437023841858L10.000000623841858,3.504687623841858L9.400197623841859,3.504687623841858L8.200192523841858,3.504690323841858L8.200192523841858,3.504687623841858ZM8.200195423841858,2.304687523841858L8.200195423841858,1.2000000438418579L4.199999923841858,1.2000000438418579L4.199999923841858,2.304687523841858L8.200195423841858,2.304687523841858ZM4.266598823841858,6.2031222238418575L4.266601723841858,6.803125023841858L4.266601723841858,9.482812523841858L4.266598823841858,10.082814823841858L5.466604323841858,10.082814823841858L5.466601523841858,9.482812523841858L5.466601523841858,6.803125023841858L5.466604323841858,6.2031222238418575L4.266598823841858,6.2031222238418575ZM6.933591023841858,6.2031222238418575L6.933593823841858,6.803125023841858L6.933593823841858,9.482812523841858L6.933591023841858,10.082814823841858L8.133596523841858,10.082814823841858L8.133593723841859,9.482812523841858L8.133593723841859,6.803125023841858L8.133596523841858,6.2031222238418575L6.933591023841858,6.2031222238418575Z'%20fill-rule='evenodd'%20fill='%23747476'%20fill-opacity='1'/%3e%3c/svg%3e",bOe="/assets/insert-DmRbh9Rv.svg",vOe="/assets/queue-DWpnpFgW.svg",wOe="_app_we0e7_1",xOe="_appChat_we0e7_36",_Oe="_appChatEmpty_we0e7_42",kOe="_appShell_we0e7_47",SOe="_chatPane_we0e7_55",TOe="_chatPaneShowingPage_we0e7_67",COe="_fullPage_we0e7_73",AOe="_fullPageHeader_we0e7_82",EOe="_splitApprovalNotice_we0e7_92",MOe="_fullPageBack_we0e7_118",NOe="_fullPageTitle_we0e7_135",IOe="_fullPageBody_we0e7_140",jOe="_mobileDrawer_we0e7_147",ROe="_mobileBackdrop_we0e7_151",LOe="_hamburgerButton_we0e7_155",DOe="_mobileDrawerOpen_we0e7_194",OOe="_hamburgerButtonFloating_we0e7_229",BOe="_appWithSidebar_we0e7_237",POe="_themeDark_we0e7_277",$Oe="_themeLight_we0e7_345",zOe="_content_we0e7_413",FOe="_contentHasMessages_we0e7_421",qOe="_missingSessionState_we0e7_430",HOe="_missingSessionMessage_we0e7_443",UOe="_missingSessionButton_we0e7_450",VOe="_panelHost_we0e7_485",WOe="_panelHeader_we0e7_493",GOe="_panelBack_we0e7_503",KOe="_panelTitle_we0e7_529",YOe="_panelBody_we0e7_538",QOe="_chatViewWrap_we0e7_548",XOe="_chatViewHidden_we0e7_556",JOe="_chatSubtree_we0e7_560",ZOe="_chatSubtreeHidden_we0e7_564",eBe="_footer_we0e7_577",tBe="_bottomPanels_we0e7_587",nBe="_approvalOverlay_we0e7_602",sBe="_scrollToBottomLayer_we0e7_616",rBe="_scrollToBottomLayerWithTodos_we0e7_627",iBe="_scrollToBottomButton_we0e7_631",oBe="_scrollToBottomIcon_we0e7_660",aBe="_btwPanel_we0e7_666",lBe="_composer_we0e7_673",cBe="_escClearStatus_we0e7_680",uBe="_emptyWelcomeFooter_we0e7_687",dBe="_queuedPrompts_we0e7_691",hBe="_queuedPrompt_we0e7_691",fBe="_queuedPromptIcon_we0e7_721",mBe="_queuedPromptMaskIcon_we0e7_731",pBe="_queuedPromptActionIcon_we0e7_732",gBe="_queuedPromptText_we0e7_745",yBe="_queuedPromptState_we0e7_753",bBe="_queuedPromptSpinner_we0e7_761",vBe="_queuedPromptActions_we0e7_776",wBe="_queuedPromptAction_we0e7_732",xBe="_queuedHint_we0e7_821",Nt={app:wOe,appChat:xOe,appChatEmpty:_Oe,appShell:kOe,chatPane:SOe,chatPaneShowingPage:TOe,fullPage:COe,fullPageHeader:AOe,splitApprovalNotice:EOe,fullPageBack:MOe,fullPageTitle:NOe,fullPageBody:IOe,mobileDrawer:jOe,mobileBackdrop:ROe,hamburgerButton:LOe,mobileDrawerOpen:DOe,hamburgerButtonFloating:OOe,appWithSidebar:BOe,themeDark:POe,themeLight:$Oe,content:zOe,contentHasMessages:FOe,missingSessionState:qOe,missingSessionMessage:HOe,missingSessionButton:UOe,panelHost:VOe,panelHeader:WOe,panelBack:GOe,panelTitle:KOe,panelBody:YOe,chatViewWrap:QOe,chatViewHidden:XOe,chatSubtree:JOe,chatSubtreeHidden:ZOe,footer:eBe,bottomPanels:tBe,approvalOverlay:nBe,scrollToBottomLayer:sBe,scrollToBottomLayerWithTodos:rBe,scrollToBottomButton:iBe,scrollToBottomIcon:oBe,btwPanel:aBe,composer:lBe,escClearStatus:cBe,emptyWelcomeFooter:uBe,queuedPrompts:dBe,queuedPrompt:hBe,queuedPromptIcon:fBe,queuedPromptMaskIcon:mBe,queuedPromptActionIcon:pBe,queuedPromptText:gBe,queuedPromptState:yBe,queuedPromptSpinner:bBe,queuedPromptActions:vBe,queuedPromptAction:wBe,queuedHint:xBe},WN=240;function _Be({prompts:e,t,onDelete:n,onInsert:s,onEdit:r}){return e.length===0?null:u.jsxs("div",{className:Nt.queuedPrompts,children:[e.map(i=>{var b;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>WN?`${o.slice(0,WN)}...`:o,l=((b=i.images)==null?void 0:b.length)??0,c=QF(i.text),d=i.serverState==="submitting",h=i.serverState==="running",f=i.isRemoving===!0,m=d||h||i.isEditing===!0||f;let p=t("queue.insertTip");m?p=t("queue.submittingDisabled"):c&&(p=t("queue.insertCommandDisabled"));let y=t("queue.editTip");m&&(y=t("queue.submittingDisabled"));const w=t(m?"queue.submittingDisabled":"queue.deleteTip");return u.jsxs("div",{className:Nt.queuedPrompt,children:[u.jsx("span",{className:Nt.queuedPromptIcon,"aria-hidden":"true",children:u.jsx("span",{className:Nt.queuedPromptMaskIcon,style:sf("--queued-icon-url",vOe)})}),u.jsxs("span",{className:Nt.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:"",d||i.isEditing||f?u.jsxs("span",{className:Nt.queuedPromptState,children:[u.jsx("span",{className:Nt.queuedPromptSpinner}),f?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),u.jsxs("span",{className:Nt.queuedPromptActions,children:[l===0&&u.jsxs("button",{type:"button",className:Nt.queuedPromptAction,onClick:()=>s(i.id),disabled:c||m,title:p,children:[u.jsx("span",{className:Nt.queuedPromptActionIcon,style:sf("--queued-icon-url",bOe),"aria-hidden":"true"}),t("queue.insert")]}),u.jsx("button",{type:"button",className:Nt.queuedPromptAction,onClick:()=>n(i.id),disabled:m,"aria-label":t("queue.delete"),title:w,children:u.jsx("span",{className:Nt.queuedPromptActionIcon,style:sf("--queued-icon-url",yOe),"aria-hidden":"true"})}),u.jsx("button",{type:"button",className:Nt.queuedPromptAction,onClick:()=>r(i.id),disabled:m,"aria-label":t("queue.edit"),title:y,children:u.jsx("span",{className:Nt.queuedPromptActionIcon,style:sf("--queued-icon-url",mF),"aria-hidden":"true"})})]})]},i.id)}),u.jsx("div",{className:Nt.queuedHint,children:t("queue.footer")})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function kBe(e,t,n,s){const r=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==s))for(const a of o.messages){const l=r.findIndex(c=>c.text===a&&(!c.images||c.images.length===0));l>=0&&(r.splice(l,1),i=!0)}return i?r:null}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const SBe=100;function GN(e,t){return e.length!==t.length?!1:e.every((n,s)=>{var i,o;const r=t[s];return r!==void 0&&n.id===r.id&&n.sessionId===r.sessionId&&n.text===r.text&&n.serverPromptId===r.serverPromptId&&n.serverState===r.serverState&&n.isEditing===r.isEditing&&n.isRemoving===r.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=r.images)==null?void 0:o.length)??0)})}function KN(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function TBe({connected:e,sessionId:t,clientId:n,streamingState:s,sessionActions:r,store:i,editorRef:o,reportError:a,notifySuccess:l,t:c}){const[d,h]=g.useState([]),f=g.useRef([]),m=g.useRef(1),p=g.useRef(t),y=g.useRef(null),w=g.useRef(new Set),b=g.useRef(new Set),v=g.useRef(new Set),x=g.useRef(new Map),_=g.useRef(new Set),E=g.useRef([]),k=g.useRef(s),M=g.useRef(0);p.current=t,k.current=s;const R=g.useMemo(()=>d.map(ie=>ie.text),[d]);g.useEffect(()=>{f.current=d},[d]),g.useEffect(()=>{var ie;f.current=[],h([]),x.current.clear(),_.current.clear(),E.current=[];for(const G of w.current)G.abort();w.current.clear(),b.current.clear(),v.current.clear(),F.current=void 0,(ie=y.current)==null||ie.abort(),y.current=null},[t]);const L=g.useCallback((ie,G)=>{const q=f.current.filter(le=>le.serverPromptId?ie.some(Se=>Se.promptId===le.serverPromptId):!0);for(const le of ie){if(b.current.has(le.promptId))continue;const Se=q.findIndex(we=>we.serverPromptId===le.promptId),$e=v.current.has(le.promptId);if(Se!==-1){if($e){q.splice(Se,1);continue}q[Se]={...q[Se],text:le.text,serverState:le.state};continue}const Ae=q.filter(we=>!we.serverPromptId&&we.serverState==="submitting"&&we.text===le.text);if(Ae.length===1){const we=q.indexOf(Ae[0]);if($e){q.splice(we,1);continue}q[we]={...Ae[0],serverPromptId:le.promptId,serverState:le.state};continue}le.state==="running"||$e||q.push({id:m.current++,sessionId:G,text:le.text,serverPromptId:le.promptId,serverState:le.state})}GN(f.current,q)||(f.current=q,h(q))},[]),T=g.useCallback(async(ie=t)=>{if(!e||!ie||p.current!==ie)return"skipped";const G=++M.current;try{const q=await r.getPendingPrompts({sessionId:ie});return G!==M.current?"superseded":p.current!==ie?"skipped":(L(q.pendingPrompts.filter(le=>le.state==="queued"||le.state==="running"),ie),"refreshed")}catch(q){return console.warn("Failed to refresh pending prompts",q),"failed"}},[e,r,t,L]),N=g.useCallback(ie=>{const G=p.current,q=ie.filter(Ae=>Ae.sessionId===void 0||Ae.sessionId===G);if(q.length===0)return;const le=new Set(f.current.map(Ae=>Ae.id)),Se=q.filter(Ae=>!le.has(Ae.id));if(Se.length===0)return;const $e=[...f.current,...Se].sort((Ae,we)=>Ae.id-we.id);f.current=$e,h($e)},[]),I=g.useCallback((ie,G,q)=>{var $e,Ae,we,ct;if(q!==void 0&&p.current!==q)return;const le=(($e=o.current)==null?void 0:$e.getText())??"",Se=le.trim()?`${ie}
${le}`:ie;(Ae=o.current)==null||Ae.setText(Se),G&&G.length>0&&((we=o.current)==null||we.restoreImages(G)),(ct=o.current)==null||ct.focus()},[o]),O=g.useSyncExternalStore(DK,LK),U=g.useRef(O),F=g.useRef(void 0);g.useEffect(()=>{if(!e||!t)return;const ie=U.current!==O;if(U.current=O,!ie){if(f.current.length>0||s==="idle"||F.current===t)return;F.current=t}T()},[O,e,t,s,T]);const j=g.useSyncExternalStore(OK,uT,uT);g.useEffect(()=>{if(!t||j.length===0)return;const ie=[];for(const G of j){if(G.data.sessionId!==t)continue;ie.push(G);const q=G.data.promptId;if(q){if(G.type==="pending_prompt_started"){if(b.current.has(q))continue;if((G.originatorClientId===void 0||G.originatorClientId===n)&&!v.current.has(q)){const Se=typeof G.data.text=="string"?G.data.text:"",$e=f.current.find(we=>we.serverPromptId===q)??f.current.find(we=>!we.serverPromptId&&we.serverState==="submitting"&&we.text===Se),Ae=($e==null?void 0:$e.text)??"";Ae&&(v.current.add(q),i.appendLocalUserMessage(Ae,KN($e==null?void 0:$e.images)))}T()}else if(G.type==="turn_complete"){v.current.delete(q);const le=x.current.get(q);if(x.current.delete(q),le)le();else if(!_.current.has(q))for(_.current.add(q),E.current.push(q);E.current.length>SBe;){const Se=E.current.shift();Se&&_.current.delete(Se)}}else if(G.type==="turn_error"||G.type==="pending_prompt_completed"&&G.data.state==="removed"){v.current.delete(q);const le=x.current.get(q);x.current.delete(q),le==null||le(),_.current.delete(q),E.current=E.current.filter(Se=>Se!==q)}}}PK(ie)},[j,t,n,i,T]);const V=g.useCallback((ie,G)=>{if(_.current.delete(ie)){E.current=E.current.filter(q=>q!==ie),G();return}x.current.set(ie,G)},[]),ee=g.useCallback((ie,G,q)=>{const le=ie.trim();if(!le)return!0;const Se=m.current++,$e=p.current,Ae=new AbortController;w.current.add(Ae);const we=G?[...G]:void 0,ct={id:Se,sessionId:$e,text:le,images:we,onComplete:q,serverState:"submitting"};return f.current=[...f.current,ct],h(f.current),r.submitPrompt(le,{images:G,optimisticUserMessage:!1,sessionId:$e,signal:Ae.signal}).then(ht=>{if(w.current.delete(Ae),p.current!==$e){r.removePendingPrompt(ht.promptId,{sessionId:$e}).catch(qt=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:$e,promptId:ht.promptId,error:qt})});return}if(k.current==="idle"){v.current.has(ht.promptId)||(v.current.add(ht.promptId),i.appendLocalUserMessage(le,KN(we)));const qt=f.current.filter(Ye=>Ye.id!==Se);f.current=qt,h(qt),q&&V(ht.promptId,q);return}const ut=f.current,ft=ut.findIndex(qt=>qt.id===Se);if(ft===-1){r.removePendingPrompt(ht.promptId,{sessionId:$e}).then(qt=>{qt.removed||T($e)},()=>{T($e)});return}const tt=[...ut];tt[ft]={...tt[ft],serverPromptId:ht.promptId,serverState:"queued"},f.current=tt,h(tt),q&&V(ht.promptId,q)}).catch(ht=>{if(w.current.delete(Ae),p.current!==$e||!f.current.some(ft=>ft.id===Se))return;const ut=f.current.filter(ft=>ft.id!==Se);f.current=ut,h(ut),I(le,we,$e),a(ht,c("queue.queueFailed"))}),!0},[T,a,I,r,V,i,c]);g.useEffect(()=>{if(s!=="idle")return;const ie=y.current;ie&&(console.debug("[mid-turn] turn settled; cancelling any in-flight push"),ie.abort(),y.current=null)},[s]);const ce=g.useCallback(ie=>{const G=f.current;if(G.length===0)return null;const q=ie===void 0?G.length-1:G.findIndex($e=>$e.id===ie);if(q<0)return null;const le=G[q],Se=G.filter(($e,Ae)=>Ae!==q);return f.current=Se,h(Se),(le==null?void 0:le.text)??null},[]),$=g.useCallback((ie,G)=>{const q=f.current.map(le=>le.id===ie?{...le,...G}:le);GN(q,f.current)||(f.current=q,h(q))},[]),J=g.useCallback(async(ie,G,q)=>{if(!ie.serverPromptId)return!0;if(ie.serverState!=="queued"||b.current.has(ie.serverPromptId))return!1;const le=ie.sessionId;b.current.add(ie.serverPromptId),$(ie.id,G);try{const Se=await r.removePendingPrompt(ie.serverPromptId,{sessionId:le});return b.current.delete(ie.serverPromptId),Se.removed?(x.current.delete(ie.serverPromptId),await T(le)==="failed"&&($(ie.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),q)),!0):($(ie.id,{isEditing:!1,isRemoving:!1}),await T(le),a(new Error("Prompt could not be removed from queue"),q),!1)}catch(Se){return b.current.delete(ie.serverPromptId),$(ie.id,{isEditing:!1,isRemoving:!1}),await T(le)!=="refreshed"&&N([ie]),a(Se,q),!1}},[T,a,N,r,$]),B=g.useCallback(ie=>{const G=f.current.find(q=>q.id===ie);if((G==null?void 0:G.serverState)!=="submitting"&&G){if(!G.serverPromptId){const q=f.current.filter(le=>le.id!==ie);f.current=q,h(q);return}J(G,{isRemoving:!0},c("queue.deleteFailed"))}},[J,c]),C=g.useCallback(async ie=>{var Ae;const G=f.current.find(we=>we.id===ie);if(!G||(((Ae=G.images)==null?void 0:Ae.length)??0)>0||G.serverState==="submitting"||G.isEditing||G.isRemoving||QF(G.text))return;const q=G.serverPromptId?G.onComplete??x.current.get(G.serverPromptId):void 0,le=()=>{G.serverPromptId&&x.current.delete(G.serverPromptId),q==null||q()};if(G.serverPromptId&&!await J(G,{isRemoving:!0},c("queue.insertFailed")))return;let Se=y.current;Se||(Se=new AbortController,y.current=Se);let $e;try{$e=await r.enqueueMidTurnMessage(G.text,{signal:Se.signal})}catch(we){G.serverPromptId&&(I(G.text,G.images,G.sessionId),le()),a(we,c("queue.insertFailed"));return}if(!$e.accepted){G.serverPromptId&&(I(G.text,G.images,G.sessionId),le()),a(new Error("Queued message was not accepted for insertion"),c("queue.insertFailed"));return}if(le(),!G.serverPromptId){const we=f.current.filter(ct=>ct.id!==ie);f.current=we,h(we)}l(c("queue.inserted"))},[J,l,a,I,r,c]),z=g.useCallback(async ie=>{const G=f.current.find(le=>le.id===ie);if(!G||G.serverState==="submitting"||G.isEditing||G.isRemoving)return;if(G.serverPromptId){if(!await J(G,{isEditing:!0},c("queue.editFailed")))return;I(G.text,G.images,G.sessionId);return}const q=ce(ie);q&&I(q,G.images,G.sessionId)},[ce,J,I,c]),X=g.useCallback(()=>{const ie=f.current;if(ie.length===0)return!1;const G=ie[ie.length-1];if(!G)return!1;if(G.serverState==="submitting"||G.isEditing||G.isRemoving)return!0;if(!G.serverPromptId){const q=ce(G.id);return q?(I(q,G.images,G.sessionId),!0):!1}return G.serverState!=="queued"?!1:((async()=>{await J(G,{isEditing:!0},c("queue.editFailed"))&&I(G.text,G.images,G.sessionId)})().catch(q=>{a(q,c("queue.editFailed"))}),!0)},[ce,J,a,I,c]),ae=g.useCallback(()=>{if(f.current.length===0)return!1;const ie=p.current,G=f.current.filter(we=>we.serverState==="submitting"),q=f.current.filter(we=>we.serverState!=="submitting");for(const we of[...G].reverse())I(we.text,we.images,we.sessionId);for(const we of w.current)we.abort();const le=q.filter(we=>we.serverPromptId);if(le.length===0)return f.current=[],h([]),i.dispatch([{type:"status",text:c("queue.cleared")}]),!0;const Se=new Set(f.current.map(we=>we.id)),$e=new Set(le.map(we=>we.serverPromptId).filter(we=>!!we));for(const we of $e)b.current.add(we);const Ae=f.current.filter(we=>!Se.has(we.id)).concat(le.map(we=>({...we,isRemoving:!0})));return f.current=Ae,h(Ae),(async()=>{var ut;const we=[];if(await Promise.all(le.map(async ft=>{const tt=ft.serverPromptId;try{if((await r.removePendingPrompt(tt,{sessionId:ft.sessionId})).removed){x.current.delete(tt);return}we.push(ft)}catch{we.push(ft)}finally{b.current.delete(tt)}})),p.current!==ie)return;const ct=we.map(ft=>({...ft,isRemoving:!1})),ht=f.current.filter(ft=>ft.serverPromptId?!$e.has(ft.serverPromptId):!Se.has(ft.id)).concat(ct);if(f.current=ht,h(ht),we.length>0){a(new Error("Some prompts could not be removed from queue"),c("queue.deleteFailed")),T((ut=we[0])==null?void 0:ut.sessionId);return}i.dispatch([{type:"status",text:c("queue.cleared")}])})(),!0},[T,a,I,i,c,r]),{batches:be,consume:fe}=fY();return g.useEffect(()=>{if(!t||be.length===0)return;n===void 0&&be.some(G=>G.sessionId===t&&G.originatorClientId!==void 0)&&console.debug("[mid-turn] originator-stamped batches but no client id; dedupe skipped (may resend next turn)");const ie=kBe(f.current,be,t,n);ie&&(f.current=ie,h(ie)),fe(be.filter(G=>G.sessionId===t))},[be,t,n,fe]),{queuedPrompts:d,queuedTexts:R,enqueuePrompt:ee,removeQueuedPrompt:B,insertQueuedPrompt:C,editQueuedPrompt:z,editLastQueuedPrompt:X,clearQueuedPrompts:ae}}const CBe="_layout_ghraz_1",ABe="_muted_ghraz_8",EBe="_notice_ghraz_13",MBe="_list_ghraz_20",NBe="_group_ghraz_26",IBe="_groupTitle_ghraz_33",jBe="_server_ghraz_39",RBe="_serverCard_ghraz_44",LBe="_serverCardExpanded_ghraz_50",DBe="_row_ghraz_55",OBe="_expandedRow_ghraz_72",BBe="_serverRow_ghraz_76",PBe="_rowMain_ghraz_81",$Be="_rowIcon_ghraz_96",zBe="_chevronCell_ghraz_125",FBe="_toolRow_ghraz_135",qBe="_chevron_ghraz_125",HBe="_chevronExpanded_ghraz_150",UBe="_disabled_ghraz_154",VBe="_name_ghraz_158",WBe="_serverName_ghraz_166",GBe="_status_ghraz_170",KBe="_badge_ghraz_171",YBe="_toolCount_ghraz_185",QBe="_resourceCount_ghraz_190",XBe="_promptCount_ghraz_191",JBe="_success_ghraz_196",ZBe="_warning_ghraz_200",ePe="_error_ghraz_204",tPe="_serverDetail_ghraz_208",nPe="_serverDetailHeader_ghraz_218",sPe="_serverActions_ghraz_223",rPe="_field_ghraz_230",iPe="_label_ghraz_238",oPe="_value_ghraz_244",aPe="_button_ghraz_249",lPe="_message_ghraz_269",cPe="_schema_ghraz_270",uPe="_tools_ghraz_281",dPe="_tool_ghraz_135",hPe="_resources_ghraz_292",fPe="_sectionTitle_ghraz_301",mPe="_resourceUri_ghraz_306",pPe="_resourceLabel_ghraz_314",gPe="_toolDetail_ghraz_324",yPe="_section_ghraz_301",bPe="_description_ghraz_347",vPe="_parameter_ghraz_353",wPe="_empty_ghraz_359",xPe="_emptyTools_ghraz_360",at={layout:CBe,muted:ABe,notice:EBe,list:MBe,group:NBe,groupTitle:IBe,server:jBe,serverCard:RBe,serverCardExpanded:LBe,row:DBe,expandedRow:OBe,serverRow:BBe,rowMain:PBe,rowIcon:$Be,chevronCell:zBe,toolRow:FBe,chevron:qBe,chevronExpanded:HBe,disabled:UBe,name:VBe,serverName:WBe,status:GBe,badge:KBe,toolCount:YBe,resourceCount:QBe,promptCount:XBe,success:JBe,warning:ZBe,error:ePe,serverDetail:tPe,serverDetailHeader:nPe,serverActions:sPe,field:rPe,label:iPe,value:oPe,button:aPe,message:lPe,schema:cPe,tools:uPe,tool:dPe,resources:hPe,sectionTitle:fPe,resourceUri:mPe,resourceLabel:pPe,toolDetail:gPe,section:yPe,description:bPe,parameter:vPe,empty:wPe,emptyTools:xPe};function YN(e){if(e&&typeof e=="object"){const t=e.body;if(t&&typeof t=="object"){const n=t.data;if(n&&typeof n=="object"){const r=n.details;if(typeof r=="string"&&r)return r}const s=t.error;if(typeof s=="string"&&s)return s}if(e instanceof Error&&e.message)return e.message}return String(e)}function _Pe(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:at.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:at.success};case"connecting":return{text:t("mcp.status.starting"),className:at.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:at.error}}}function kPe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function D4(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function SPe(e){const t=e.schema,n=(t==null?void 0:t.parametersJsonSchema)??(t==null?void 0:t.parameters)??t;return n&&typeof n=="object"?n:null}function TPe(e,t){const n=e.annotations??{},s=[];return n.destructiveHint&&s.push(t("mcp.annotation.destructive")),n.readOnlyHint&&s.push(t("mcp.annotation.readOnly")),n.openWorldHint&&s.push(t("mcp.annotation.openWorld")),n.idempotentHint&&s.push(t("mcp.annotation.idempotent")),s.join(", ")}function QN(e,t){return`${e}:${t}`}function XN(e,t){return`${e}\0${t}`}const Qc=m8;function O4({expanded:e}){return u.jsx("svg",{className:`${at.chevron} ${e?at.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function CPe(e,t){const n=[];return!e.disabled&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),e.disabled||(n.push({id:"authenticate",label:e.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),e.hasOAuthTokens&&n.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),n}function APe({tool:e,t}){const n=SPe(e);if(!n)return u.jsx("div",{className:at.muted,children:t("mcp.noSchema")});const s=n.properties,r=Array.isArray(n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!s||typeof s!="object")return u.jsx("pre",{className:at.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(s);return i.length===0?null:u.jsxs("div",{className:at.section,children:[u.jsx("div",{className:at.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",d=typeof l.description=="string"?l.description:"";return u.jsx("div",{className:at.parameter,children:`- ${o}${r.has(o)?t("mcp.required"):""}: ${c}${d?` - ${d}`:""}`},o)})]})}function m0({label:e,value:t}){return u.jsxs("div",{className:at.field,children:[u.jsx("span",{className:at.label,children:e}),u.jsx("span",{className:at.value,children:t})]})}function EPe({tool:e,t}){const n=TPe(e,t);return u.jsxs("div",{className:at.toolDetail,children:[e.isValid?null:u.jsxs("div",{className:at.section,children:[u.jsx("div",{className:`${at.sectionTitle} ${at.error}`,children:t("mcp.invalidToolWarning")}),u.jsxs("div",{className:at.muted,children:[Qc(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),u.jsx("div",{className:at.muted,children:t("mcp.invalidToolHelp")})]}),e.description?u.jsxs("div",{className:at.section,children:[u.jsx("div",{className:at.sectionTitle,children:Qc(t("mcp.description"))}),u.jsx("div",{className:at.description,children:e.description.trim()})]}):u.jsx("div",{className:at.muted,children:t("mcp.noDescription")}),n?u.jsx(m0,{label:Qc(t("mcp.annotations")),value:n}):null,u.jsx(APe,{tool:e,t})]})}function MPe({resource:e,t}){const n=e.title||e.name||"",s=n!==""&&n!==e.uri;return u.jsxs("div",{className:at.toolDetail,children:[u.jsx(m0,{label:Qc(t("mcp.resource.uriLabel")),value:e.uri}),s?u.jsx(m0,{label:Qc(t("mcp.resource.nameLabel")),value:n}):null,e.mimeType?u.jsx(m0,{label:Qc(t("mcp.resource.mimeTypeLabel")),value:e.mimeType}):null,typeof e.size=="number"?u.jsx(m0,{label:Qc(t("mcp.resource.sizeLabel")),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?u.jsxs("div",{className:at.section,children:[u.jsx("div",{className:at.sectionTitle,children:Qc(t("mcp.description"))}),u.jsx("div",{className:at.description,children:e.description.trim()})]}):null]})}function NPe({message:e}){const{t}=Xe(),n=DL({autoLoad:!1}),[s,r]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(e.resourcesByServer??{}),c=g.useMemo(()=>s.servers??[],[s.servers]),[d,h]=g.useState(new Set),[f,m]=g.useState(new Set),[p,y]=g.useState(new Set),[w,b]=g.useState(null),[v,x]=g.useState(null);g.useEffect(()=>{h(N=>{const I=new Set(c.map(O=>O.name));return new Set([...N].filter(O=>I.has(O)))})},[c]);const _=c.filter(N=>!N.disabled&&N.mcpStatus==="connecting").length,E=g.useMemo(()=>{var I,O;const N=[];for(const U of c){const F=kPe(U,t),j={server:U,tools:((I=i[U.name])==null?void 0:I.tools)??[],resources:((O=a[U.name])==null?void 0:O.resources)??[]},V=N.find(ee=>ee.label===F);V?V.items.push(j):N.push({label:F,items:[j]})}return N},[c,t,i,a]),k=g.useCallback(async N=>{var F;const I=await n.reload();if(!I)return;r(I);const O=(F=I.servers)==null?void 0:F.find(j=>j.name===N);if(!O)return;const U=await n.loadTools(O.name);if(o(j=>({...j,[O.name]:U})),O.resourceCount)try{const j=await n.loadResources(O.name);l(V=>({...V,[O.name]:j}))}catch{}else l(j=>{if(!(O.name in j))return j;const V={...j};return delete V[O.name],V})},[n]),M=g.useCallback(async(N,I)=>{if(!v){h(new Set([N.name])),x(N.name),b({serverName:N.name,text:I.id==="authenticate"?D4(N.name,t):t("mcp.action.running",{action:I.label})});try{let O=null;if(I.id==="reconnect")await n.restartServer(N.name);else{const U=await n.manageServer(N.name,I.id),F=[...U.messages??[],...U.authUrl?[U.authUrl]:[]].join(`
`);F&&(O=I.id==="authenticate"?D4(N.name,t,F):F)}await k(N.name),b({serverName:N.name,text:O??t("mcp.action.done",{action:I.label})})}catch(O){b({serverName:N.name,text:I.id==="authenticate"?D4(N.name,t,YN(O)):t("mcp.action.failed",{error:YN(O)})})}finally{x(null)}}},[v,n,k,t]),R=g.useCallback(N=>{h(I=>I.has(N)?new Set:new Set([N])),m(new Set),y(new Set)},[]),L=g.useCallback((N,I)=>{const O=QN(N,I);m(U=>U.has(O)?new Set:new Set([O]))},[]),T=g.useCallback((N,I)=>{const O=XN(N,I);y(U=>U.has(O)?new Set:new Set([O]))},[]);return u.jsxs("div",{className:at.layout,"data-keyboard-scope":!0,children:[_>0?u.jsxs("div",{className:at.notice,children:[t("mcp.starting",{count:_}),u.jsx("div",{className:at.muted,children:t("mcp.startingNote")})]}):null,c.length===0?u.jsx("div",{className:at.empty,children:t("mcp.empty")}):u.jsx("div",{className:at.list,children:E.map(N=>u.jsxs("div",{className:at.group,children:[N.label!==t("mcp.extensionMcp")?u.jsx("div",{className:at.groupTitle,children:N.label}):null,N.items.map(({server:I,tools:O,resources:U})=>{var J;const F=_Pe(I,t),j=d.has(I.name),V=CPe(I,t),ee=((J=i[I.name])==null?void 0:J.tools.length)??0,ce=I.resourceCount??0,$=I.promptCount??0;return u.jsx("div",{className:at.server,children:u.jsxs("div",{className:`${at.serverCard} ${j?at.serverCardExpanded:""}`,children:[u.jsxs("button",{type:"button",className:`${at.row} ${at.serverRow} ${j?at.expandedRow:""}`,onClick:()=>R(I.name),"aria-label":t(j?"mcp.collapse":"mcp.expand"),children:[u.jsxs("span",{className:at.rowMain,children:[u.jsx("span",{className:at.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:`${at.name} ${at.serverName}`,children:I.name})]}),u.jsx("span",{className:`${at.status} ${F.className}`,children:F.text}),u.jsx("span",{className:`${at.badge} ${at.toolCount}`,children:t(ee===1?"mcp.toolCount":"mcp.toolsCount",{count:ee})}),ce>0?u.jsx("span",{className:`${at.badge} ${at.resourceCount}`,children:t("mcp.resourceCount",{count:ce})}):null,$>0?u.jsx("span",{className:`${at.badge} ${at.promptCount}`,children:t("mcp.promptCount",{count:$})}):null,u.jsx("span",{className:at.chevronCell,"aria-hidden":"true",children:u.jsx(O4,{expanded:j})})]}),j?u.jsxs("div",{className:at.serverDetail,children:[V.length>0?u.jsx("div",{className:at.serverDetailHeader,children:u.jsx("div",{className:at.serverActions,children:V.map(B=>u.jsx("button",{type:"button",className:at.button,onClick:()=>void M(I,B),disabled:v!==null,children:B.label},B.id))})}):null,(w==null?void 0:w.serverName)===I.name?u.jsx("pre",{className:at.message,children:w.text}):null,O.length===0?u.jsx("div",{className:at.emptyTools,children:t("mcp.emptyTools")}):u.jsx("div",{className:at.tools,children:O.map(B=>{const C=QN(I.name,B.name),z=f.has(C);return u.jsxs("div",{className:at.tool,children:[u.jsxs("button",{type:"button",className:`${at.row} ${at.toolRow} ${z?at.expandedRow:""} ${B.isValid?"":at.disabled}`,onClick:()=>L(I.name,B.name),children:[u.jsx("span",{className:at.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:at.name,children:B.name}),u.jsx(O4,{expanded:z})]}),z?u.jsx(EPe,{tool:B,t}):null]},B.name)})}),ce>0?u.jsxs("div",{className:at.resources,children:[u.jsx("div",{className:at.sectionTitle,children:t("mcp.resources")}),U.length===0?u.jsx("div",{className:at.emptyTools,children:t("mcp.resourcesUnavailable")}):null,U.map(B=>{const C=XN(I.name,B.uri),z=p.has(C),X=B.title||B.name||"";return u.jsxs("div",{className:at.tool,children:[u.jsxs("button",{type:"button",className:`${at.row} ${at.toolRow} ${z?at.expandedRow:""}`,onClick:()=>T(I.name,B.uri),children:[u.jsx("span",{className:at.rowIcon,"aria-hidden":"true"}),u.jsx("span",{className:`${at.name} ${at.resourceUri}`,children:B.uri}),X&&X!==B.uri?u.jsx("span",{className:at.resourceLabel,children:X}):null,u.jsx(O4,{expanded:z})]}),z?u.jsx(MPe,{resource:B,t}):null]},B.uri)})]}):null]}):null]})},I.name)})]},N.label))})]})}function IPe({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function jPe({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"common.loading":t||n?"editor.processing":"editor.placeholder"}function RPe({connectionStatus:e}){return e==="disconnected"||e==="error"}const Zd=g.createContext(!1),y8=g.createContext(new Map),XF=g.createContext(new Map);function LPe({timeline:e,details:t,children:n}){return u.jsx(y8.Provider,{value:e,children:u.jsx(XF.Provider,{value:t,children:n})})}const V1=Ev,DPe=3e4,OPe="ui.compactMode",BPe="ui.hideTips",PPe={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function B4(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const JF=new Set(["clear","stop","off","reset","none","cancel"]);function $Pe(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return JF.has(t)}function zPe(e){const t=e;return t.source!=="goal"?null:Rb(t.data)??Rb(t.text)}function FPe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const s=zPe(n);if(s)return s.kind==="set"||s.kind==="checking"?{condition:s.condition,setAt:s.setAt??n.serverTimestamp??n.createdAt}:null}return null}const JN={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},ZF=1e3,eq="qwen-code-web-shell-chat-width",qPe=40,tq="qwen-code-web-shell-sidebar-collapsed";function HPe(e){return e===!0?{enabled:!0,defaultCollapsed:!1}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1}:{enabled:!1,defaultCollapsed:!1}}function UPe(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(tq);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function VPe(e){try{window.localStorage.setItem(tq,String(e))}catch{}}function Ey(){return`${ZF}`}function WPe(){if(typeof window>"u")return Ey();try{return window.localStorage.getItem(eq)==="wide"?"wide":Ey()}catch{return Ey()}}function GPe(e){try{window.localStorage.setItem(eq,e)}catch{}}function nq(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:ZF}function KPe(e,t){const n=`${nq(t)}px`,s=`calc(${n} + ${qPe}px)`;return{"--chat-regular-content-width":n,"--chat-regular-shell-width":s,"--chat-content-width":e==="wide"?"100%":n,"--chat-shell-width":e==="wide"?"100%":s}}function ZN(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function eI(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function YPe(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function QPe(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return bu(e.get("language")??e.get("lang")??navigator.language)}function XPe(e,t){return e instanceof Error?e.message:t}function P4(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Ih(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function JPe(e){e.length>0&&console.info("[web-shell] useSessionNotices()",{notices:e})}function ZPe(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function e$e(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function $4(e){return typeof e=="object"&&e!==null}function t$e(e){if(!$4(e))return null;const t=e._meta;if(!$4(t))return null;const n=t.qwenModelSwitch;if(!$4(n))return null;const s=n.authType,r=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof s!="string"||typeof r!="string"||typeof i!="string"||typeof o!="string"?null:{authType:s,modelId:r,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function n$e(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function s$e(e){return e.toolKind==="edit"}function r$e(e){const t=e.trim().replace(/[\r\n]+/g," ");return t?t==="--"?{type:"manual",displayName:""}:t.startsWith("-- ")?{type:"manual",displayName:t.slice(3).trim()}:t.toLowerCase()==="--auto"?{type:"auto"}:t.startsWith("--")?{type:"delegate"}:{type:"manual",displayName:t}:{type:"auto"}}function i$e(e){var n;if(((n=e.args)==null?void 0:n.is_background)!==!0)return!1;const t=e.toolName.toLowerCase();return t==="shell"||t==="bash"||t==="run_shell_command"||t==="exec"}function o$e(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const s of n.tools)(zL(s)||i$e(s))&&t.push(`${s.callId}:${s.status}`);return t.join("|")}function a$e(e){const t={id:e.id,label:e.label,description:e.description,runtimeMs:e.runtimeMs,startTime:e.startTime,endTime:e.endTime,error:e.error};switch(e.kind){case"agent":return{...t,kind:"agent",status:e.status,subagentType:e.subagentType,isBackgrounded:e.isBackgrounded,prompt:e.prompt};case"shell":return{...t,kind:"shell",status:e.status,command:e.command,cwd:e.cwd,pid:e.pid,exitCode:e.exitCode};case"monitor":return{...t,kind:"monitor",status:e.status,command:e.command,pid:e.pid,exitCode:e.exitCode};default:return e}}function l$e(e,t){return e===Ir.NO_OUTPUT?t("copy.noOutput"):e===Ir.NO_TEXT?t("copy.noText"):e===Ir.CODE_MISSING?t("copy.codeMissing"):e===Ir.LATEX_MISSING?t("copy.latexMissing"):e===Ir.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Ir.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Ir.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Ir.CLIPBOARD_PREFIX.length)}`:e.endsWith(Ir.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Ir.COPIED_SUFFIX.length)}):e}function c$e({onSessionIdChange:e,theme:t,onThemeChange:n,language:s,onLanguageChange:r,className:i,style:o,onConnectionChange:a,onStreamingStateChange:l,onError:c,onBugReport:d,hiddenSlashCommands:h,slashCommandCategoryOrder:f,atProviders:m,composerTagIcons:p,renderToolHeaderExtra:y,renderWelcomeHeader:w,renderWelcomeFooter:b,renderUserMessageContent:v,renderComposerToolbarStart:x,renderComposerToolbarEnd:_,renderComposerToolbarRight:E,renderFooter:k,chatMaxWidth:M,sidebar:R,splitSessionIds:L,onSplitSessionIdsChange:T,shellRef:N,composerToolbarActions:I,compactThinking:O=!1,collapseCompletedTurns:U=!0,markdownTableMode:F="basic",virtualScrollThreshold:j,markdown:V,loadingPhrases:ee,onTranscriptChange:ce,onToast:$,composerRef:J,onComposerReady:B,composerInput:C,composerInputVersion:z,onSessionChange:X,onSubmitBefore:ae}={}){var s7;const[be,fe]=g.useState(WPe),[ie,G]=g.useState(()=>s===void 0?QPe():bu(s)),q=g.useMemo(()=>HL(ie),[ie]),le=g.useMemo(()=>HPe(R),[R]),[Se,$e]=g.useState(()=>UPe(le.defaultCollapsed)),[Ae,we]=g.useState(null),[ct,ht]=g.useState(!1),ut=g.useCallback(()=>ht(!1),[]),ft=DNe();g.useEffect(()=>{const D=window.matchMedia("(max-width: 760px)"),W=he=>{he.matches||ht(!1)};return D.addEventListener("change",W),()=>D.removeEventListener("change",W)},[]),g.useEffect(()=>{if(!ct)return;const D=Ue=>{if(Ue.key!=="Escape"||Xt.current)return;const Tt=Ue.target;bp(Tt)&&!(Tt!=null&&Tt.closest("[data-sidebar-shell]"))||(Ue.stopPropagation(),Ue.preventDefault(),ut())},W=document.body.style.overflow;document.body.style.overflow="hidden";const he=Ue=>{const Tt=Ue.target;Tt!=null&&Tt.closest("[data-sidebar-shell]")&&!Tt.closest(`.${Nt.mobileBackdrop}`)||Ue.preventDefault()};return document.addEventListener("touchmove",he,{passive:!1}),window.addEventListener("keydown",D,!0),()=>{document.body.style.overflow=W,document.removeEventListener("touchmove",he),window.removeEventListener("keydown",D,!0)}},[ct,ut]);const tt=g.useCallback(D=>{$e(D),VPe(D)},[]),qt=g.useMemo(()=>({renderToolHeaderExtra:y,renderWelcomeHeader:w,renderWelcomeFooter:b,renderUserMessageContent:v,renderComposerToolbarStart:x,renderComposerToolbarEnd:_,renderComposerToolbarRight:E,renderFooter:k,compactThinking:O,collapseCompletedTurns:U,markdownTableMode:F,markdown:V,loadingPhrases:ee}),[y,w,b,v,x,_,E,k,O,U,F,V,ee]),Ye=k,ge=yS(),st=Qp(),ne=ha(),ue=Xp(),{notices:Re,dismissNotice:rt}=ZK(),vt=da(),tn=g.useRef($);tn.current=$;const jn=g.useRef(0),[ln,Pn]=g.useState([]),Qt=g.useCallback(D=>{Pn(W=>W.filter(he=>he.id!==D))},[]),ve=g.useCallback((D,W)=>{if(tn.current){tn.current(D,W);return}const he={id:`web-shell-toast-${Date.now()}-${++jn.current}`,tone:D,message:W};Pn(Ue=>[...Ue.filter(Jt=>Jt.tone!==D||Jt.message!==W),he].slice(-4))},[]),Be=RF(q),He=g.useRef(Be);He.current=Be;const[Ht,Yn]=g.useState(null),[Wt,ss]=g.useState(null),Mt=g.useRef(1),Cn=g.useRef(1),rn=g.useRef(null),Ln=g.useRef(ne.sessionId),Xn=g.useRef(void 0),Nn=g.useRef(ne.sessionId),_n=g.useMemo(()=>{const D=[Ht].filter(he=>he!==null);if(D.length===0)return UN(Be);const W=[...Be];for(const he of D.sort((Ue,Tt)=>Ue.anchorIndex-Tt.anchorIndex)){const Ue=he.anchorAfterId?W.findIndex(Jt=>Jt.id===he.anchorAfterId):-1,Tt=Ue>=0?Ue+1:Math.min(he.anchorIndex,W.length);W.splice(Tt,0,he.message)}return UN(W)},[Be,Ht]),Os=VDe(st),ks=g.useMemo(()=>BL(Os),[Os]),Kt=QDe(ks),Vn=!(ne.catchingUp&&Ae!==null),Te=Kk(Kt)&&Vn?Kt:null,mt=Kt&&!Kk(Kt)&&Vn?Kt:null,Xt=g.useRef(Kt);Xt.current=Vn?Kt:null;const mn=mt!==null||Te!==null,oe=g.useMemo(()=>Ope(Be),[Be]),_e=g.useRef(null),se=g.useMemo(()=>{const D=Ppe(Be),W=_e.current;if(W&&W.signature===D)return W.timeline;const he=Bpe(Be);return _e.current={signature:D,timeline:he},he},[Be]),pe=g.useRef(null),Le=g.useMemo(()=>{const D=$pe(Be),W=pe.current;if(W&&W.signature===D)return W.details;const he=Vpe(Be);return pe.current={signature:D,details:he},he},[Be]),wt=XDe(oe.todos,D=>`${D.id}:${D.status}:${D.content}`),dt=oe.allCompleted,[Ft,on]=g.useState("hidden"),Ks=ne.catchingUp||wt.length===0||dt?"hidden":"active";Ks!==Ft&&on(Ks);const pn=Ks!=="hidden",An=g.useMemo(()=>o$e(Be),[Be]),[un,rs]=g.useState(0),Ys=KDe(An,ne.status==="connected",un),Bs=g.useMemo(()=>k?Ys.map(a$e):[],[Ys,k]),Dt=g.useRef(null),Ps=g.useRef(null),kn=g.useRef(null),Si=g.useRef(null),yr=g.useRef(null),[ma,Oo]=g.useState(!1),El=g.useRef(null),Ra=g.useRef(!1),rr=g.useCallback((D="smooth")=>{requestAnimationFrame(()=>{var W;(W=Ps.current)==null||W.scrollToBottom(D),requestAnimationFrame(()=>{var he;(he=Ps.current)==null||he.scrollToBottom(D)})})},[]),pa=g.useCallback(D=>{kn.current=D,ZN(J,D??JN),D&&Si.current!==D&&(Si.current=D,B==null||B(D))},[J,B]);g.useEffect(()=>{ZN(J,kn.current??JN)},[J]);const[li,Qs]=g.useState(null),[Ti,Ci]=g.useState(!1),Wi=g.useRef(!1),ga=g.useRef(null);ga.current=li;const{followupState:Bo,onAcceptFollowup:Ml,onDismissFollowup:Gi,clear:Ai}=hY({onAccept:D=>{var W;(W=kn.current)==null||W.insertText(D)}}),Q=Iv(),de=g.useRef(Q),Oe=g.useRef(Date.now()),et=g.useRef(Q);et.current==="idle"&&Q!=="idle"&&(Oe.current=Date.now()),et.current=Q;const bn=g.useMemo(()=>{if(Q!=="idle"){for(let D=_n.length-1;D>=0;D--){const W=_n[D];if((W==null?void 0:W.role)==="user")return W.timestamp??Oe.current}return Oe.current}},[_n,Q]),$t=g.useRef(""),vn=g.useRef(void 0),is=g.useRef(null),ds=g.useRef(null),[hs,ze]=g.useState(!1),Wn=g.useRef(hs);Wn.current=hs;const In=ne.status==="connected",[Xs,vs]=g.useState([]);g.useEffect(()=>{In&&vt.loadSkillsStatus().then(D=>{vs(((D==null?void 0:D.skills)??[]).map(W=>({name:W.name,description:W.description??""})).sort((W,he)=>W.name.localeCompare(he.name)))}).catch(()=>{})},[In,vt]);const[Ss,$n]=g.useState(null),[Me,_t]=g.useState([]),[lt,pt]=g.useState(!1),[At,cn]=g.useState(!1),[Y,xe]=g.useState(!1),[ke,Ot]=g.useState(!1),[gn,wn]=g.useState(!1),[Zt,Jn]=g.useState(!1),[Er,zr]=g.useState(!1),[Po,Vu]=g.useState(!1),[Js,ur]=g.useState("chat"),[dn,ya]=g.useState([]),[gm,b8]=g.useState(!1),[Tw,Cw]=g.useState(null),[js,Wu]=g.useState(null),$o=g.useCallback(()=>Wu(null),[]),La=g.useCallback(D=>{ur("chat"),Wu(D)},[]),Aw=g.useCallback(()=>{Wu(null),ur("scheduledTasks")},[]),hh=g.useCallback(D=>{Wu(null),ya(W=>{const he=Array.from(new Set((D??[]).filter(Boolean))).slice(0,_f);return he.length>0?he:W.length>0?W:ne.sessionId?[ne.sessionId]:[]}),ur("split")},[ne.sessionId]),Ew=g.useMemo(()=>Array.from(new Set((L??[]).filter(Boolean))).slice(0,_f).join("\0"),[L]),Da=L!==void 0,Oa=g.useRef(T);Oa.current=T;const v8=g.useCallback(()=>{var W;if(!Da){hh();return}const D=dn.length>0?dn:ne.sessionId?[ne.sessionId]:[];(W=Oa.current)==null||W.call(Oa,D)},[ne.sessionId,Da,hh,dn]),w8=g.useMemo(()=>({openSplitView:()=>v8(),openSessionOverview:()=>La("sessions")}),[La,v8]);g.useEffect(()=>{eI(N,w8)},[w8,N]),g.useEffect(()=>()=>{eI(N,null)},[N]),g.useEffect(()=>{if(!Da)return;const D=Ew?Ew.split("\0"):[];ya(W=>YPe(W,D)?W:D),D.length>0?(Wu(W=>W===null?W:null),ur(W=>W==="split"?W:"split")):ur(W=>W==="split"?"chat":W)},[Da,Ew]);const oq=g.useCallback(D=>{var W;Da||ya(D),(W=Oa.current)==null||W.call(Oa,D)},[Da]),pg=g.useCallback(()=>{var D;Da&&((D=Oa.current)==null||D.call(Oa,[]))},[Da]),aq=g.useCallback(()=>{pg(),La("sessions")},[pg,La]);g.useEffect(()=>{const D=FAe(window.location.search);if(D.length===0)return;const W=new URL(window.location.href);W.searchParams.delete("split"),window.history.replaceState(null,"",W),Da||hh(D)},[Da,hh]);const Mw=g.useRef(!1);g.useEffect(()=>{!ft&&js==="sessions"&&Wu(null),!ft&&Js==="split"&&(pg(),ur("chat"),Mw.current=!0)},[ft,js,Js,pg]),g.useEffect(()=>{var D;Js!=="chat"||!Mw.current||(Mw.current=!1,!js&&!mn&&((D=kn.current)==null||D.focus()))},[Js,js,mn]);const x8=g.useRef(null),_8=g.useRef(js),k8=g.useRef(mn);g.useEffect(()=>{var he,Ue,Tt;const D=_8.current,W=k8.current;_8.current=js,k8.current=mn,js?(he=x8.current)==null||he.focus():D?mn||(Ue=kn.current)==null||Ue.focus():W&&!mn&&((Tt=kn.current)==null||Tt.focus())},[js,mn]),g.useEffect(()=>{mn&&(js&&Wu(null),Ss&&$n(null),lt&&pt(!1),Js==="scheduledTasks"&&ur("chat"))},[mn,js,Ss,lt,Js]);const Nw=g.useRef(null),gg=mt!==null&&!js&&Ss===null&&!lt&&Js==="chat",S8=g.useRef(gg);g.useEffect(()=>{var W;const D=S8.current;S8.current=gg,gg&&!D&&((W=Nw.current)==null||W.focus())},[gg]);const[T8,C8]=g.useState(!1),[A8,Iw]=g.useState(!1),[lq,cq]=g.useState(0),[uq,dq]=g.useState(0),Ei=oh(),E8=g.useRef((Ei==null?void 0:Ei.extensionsVersion)??0);g.useEffect(()=>{const D=(Ei==null?void 0:Ei.extensionsVersion)??0;if(D!==E8.current){E8.current=D;const W=Ei==null?void 0:Ei.lastExtensionChange;if((W==null?void 0:W.status)==="failed"){ge.dispatch([{type:"error",text:q("extensions.action.failed",{name:W.name??"",source:W.source??"",error:W.error??q("error.unknown")})}]);return}if((W==null?void 0:W.status)==="installed"){const he=W.name??W.source??q("extensions.label");ge.dispatch([{type:"status",text:W.version?q("extensions.install.installedWithVersion",{name:he,version:W.version}):q("extensions.install.installed",{name:he})}])}else if(W!=null&&W.status){const he=W.name??W.source??q("extensions.label"),Ue=W.status==="updated"&&W.version?"extensions.manage.updatedWithVersion":`extensions.manage.${W.status}`;ge.dispatch([{type:"status",text:q(Ue,{name:he,version:W.version??""})}])}ue.refreshCommands().catch(()=>{ge.dispatch([{type:"error",text:q("extensions.commands.refreshFailed")}])})}},[Ei==null?void 0:Ei.extensionsVersion,Ei==null?void 0:Ei.lastExtensionChange,ue,ge,q]);const[hq,fq]=g.useState("workspace"),[ym,jw]=g.useState(null),[mq,M8]=g.useState(!1),[pq,N8]=g.useState(!1),yg=g.useRef(null),fh=g.useRef(null),[Rw,bg]=g.useState(null),[Lw,Dw]=g.useState(t??yi.Dark),[mh,I8]=g.useState(""),vg=g.useRef(mh);vg.current=mh;const ph=g.useCallback(D=>{vg.current=D,I8(D)},[]),Ts=g.useRef(ne);Ts.current=ne;const Fr=g.useCallback(()=>Ts.current.sessionId?!0:(ve("info",q("localCommand.noSession")),!1),[ve,q]),gq=ne.displayName,[Ba,Ow]=g.useState("default"),Bw=g.useRef(Ba);Bw.current=Ba;const bm=g.useCallback(D=>{Bw.current=D,Ow(D)},[]),[Pw,Gu]=g.useState(!1),vm=g.useRef(null);g.useEffect(()=>{ne.sessionId&&(vm.current=null)},[ne.sessionId]);const j8=g.useCallback(()=>Ts.current.sessionId?Promise.resolve():(vm.current||(vm.current=(async()=>{const D=vg.current||Ts.current.currentModel,W=Bw.current||Ts.current.currentMode;await nMe({sessionActions:ue,modelId:D,modeId:W})})().catch(D=>{throw vm.current=null,D})),vm.current),[ue]),Nl=g.useRef(ae);Nl.current=ae;const[R8,L8]=g.useState(0),wm=g.useRef(null);g.useEffect(()=>()=>{wm.current!==null&&clearTimeout(wm.current)},[]);const D8=g.useCallback(D=>{X==null||X(D),L8(W=>W+1)},[X]),ci=g.useRef(D8);ci.current=D8;const Ki=g.useCallback(async(D,W,he)=>{var Zn,Zs;const Ue=!D.trimStart().startsWith("/"),Tt=$t.current,Jt=vn.current,Ut=ds.current,Vt=Wn.current;!(he!=null&&he.retry)&&Ue&&($t.current=D,vn.current=W,ds.current=null),ze(!1);const Fe=!Ts.current.sessionId;if(Nl.current){Gu(!0);try{await Nl.current({sessionId:Ts.current.sessionId,prompt:D})}catch(Qr){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",Qr),Gu(!1),$t.current=Tt,vn.current=Jt,ds.current=Ut,ze(Vt);return}Fe||Gu(!1)}!Nl.current&&Fe&&Gu(!0),Ai();try{await j8()}finally{Fe&&Gu(!1)}const Ne={images:W,optimisticUserMessage:he==null?void 0:he.optimisticUserMessage,retry:he==null?void 0:he.retry,...he!=null&&he.onAdmitted?{onAdmitted:he.onAdmitted}:{}};he!=null&&he.commitComposerAccepted?he.commitComposerAccepted():he!=null&&he.clearComposerOnPromptStart&&((Zn=kn.current)==null||Zn.clear());const yn=Ts.current.sessionId;return yn&&D.trim()&&((Zs=ci.current)==null||Zs.call(ci,{type:"submit",sessionId:yn,prompt:D,queued:!1}),wm.current!==null&&clearTimeout(wm.current),wm.current=setTimeout(()=>{L8(Qr=>Qr+1)},2e3)),await ue.sendPrompt(D,Ne)},[Ai,j8,ue]),yq=g.useMemo(()=>(ne.models??[]).filter(Yk).map(D=>({id:D.id,label:Dp(D.label||D.id)})),[ne.models]),Il=At||Y||ke||gn||Zt||Er||Po||gm||Ss!==null||lt||Rw!==null||Tw!==null||ym!==null||T8||A8||js!==null||Js!=="chat",Bt=g.useCallback((D,W)=>{if(P4(D))return;if(iL(D)){console.debug("[web-shell] turn error rendered in transcript",D);return}if(Ih(D)){console.debug("[web-shell] error already handled by notice",D);return}const he=XPe(D,W);console.error("[web-shell]",he,D),ve("error",he)},[ve]),bq=g.useCallback(D=>ve("success",D),[ve]),{queuedPrompts:vq,queuedTexts:wq,enqueuePrompt:$w,removeQueuedPrompt:xq,insertQueuedPrompt:_q,editQueuedPrompt:kq,editLastQueuedPrompt:Sq,clearQueuedPrompts:Tq}=TBe({connected:In,sessionId:ne.sessionId,clientId:ne.clientId,streamingState:Q,sessionActions:ue,store:ge,editorRef:kn,reportError:Bt,notifySuccess:bq,t:q}),Ku=g.useCallback((D,W,he,Ue)=>{var Ut;if(Nl.current)return Nl.current({sessionId:Ts.current.sessionId,prompt:D}).then(()=>{var Ne,yn;$w(D,W,he)!==!1&&(Ue?Ue():(Ne=kn.current)==null||Ne.clear());const Fe=Ts.current.sessionId;Fe&&D.trim()&&((yn=ci.current)==null||yn.call(ci,{type:"submit",sessionId:Fe,prompt:D,queued:!0}))}).catch(Vt=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",Vt)}),!1;const Tt=$w(D,W,he),Jt=Ts.current.sessionId;return Jt&&D.trim()&&((Ut=ci.current)==null||Ut.call(ci,{type:"submit",sessionId:Jt,prompt:D,queued:!0})),Tt},[$w]);g.useEffect(()=>{JPe(Re);for(const D of Re)ZPe(D)?ve(e$e(D),D.message):D.category==="lifecycle"?console.debug("[web-shell] daemon notice",D):console.warn("[web-shell] daemon notice",D),rt(D.id)},[rt,Re,ve]);const zw=g.useRef(d);zw.current=d,g.useEffect(()=>{var D;Ln.current=ne.sessionId,(D=rn.current)==null||D.abort(),rn.current=null,Yn(null),ss(null),bg(null),Sg.current=0},[ne.sessionId]);const O8=g.useCallback(()=>{var Tt;if(!Fr())return;const D=`local-recap-${Mt.current++}`,W=Be.length,he=(Tt=Be.at(-1))==null?void 0:Tt.id,Ue=ne.sessionId;Yn({anchorAfterId:he,anchorIndex:W,message:{id:D,role:"system",content:`※ ${q("recap.label")}: ${q("recap.loading")}`,variant:"info",source:"recap"}}),ue.recapSession().then(Jt=>{Ln.current===Ue&&Yn({anchorAfterId:he,anchorIndex:W,message:{id:D,role:"system",content:Jt.recap?`※ ${q("recap.label")}: ${Jt.recap}`:q("recap.empty"),variant:"info",source:"recap"}})},Jt=>{Ln.current===Ue&&(Yn(null),!P4(Jt)&&!Ih(Jt)&&console.warn("[web-shell] unhandled recap failure",Jt))})},[ne.sessionId,Be,Fr,ue,q]),B8=g.useCallback(D=>{var Jt;const W=D.trim();if(!W){ve("error",q("btw.empty"));return}if(!Fr())return;const he=`local-btw-${Cn.current++}`,Ue=ne.sessionId;(Jt=rn.current)==null||Jt.abort();const Tt=new AbortController;rn.current=Tt,ss({id:he,role:"btw",question:W,answer:"",isPending:!0}),ue.btwSession(W,{signal:Tt.signal}).then(Ut=>{Ln.current===Ue&&rn.current===Tt&&(rn.current=null,ss({id:he,role:"btw",question:W,answer:Ut.answer||q("btw.emptyAnswer"),isPending:!1}))},Ut=>{Ln.current===Ue&&rn.current===Tt&&(rn.current=null,ss(null),!P4(Ut)&&!Ih(Ut)&&console.warn("[web-shell] unhandled btw failure",Ut))})},[ne.sessionId,ve,Fr,ue,q]),P8=g.useCallback(()=>{var D;(D=rn.current)==null||D.abort(),rn.current=null,ss(null)},[]);g.useEffect(()=>{const D=W=>{var Ut;if(Il||Kt)return;const he=Wt;if(!he||he.role!=="btw")return;const Ue=W.key.toLowerCase(),Tt=W.key==="Escape"&&!W.ctrlKey&&!W.metaKey&&!W.altKey&&!W.shiftKey,Jt=W.ctrlKey&&!W.metaKey&&!W.altKey&&!W.shiftKey&&(Ue==="c"||Ue==="d");if(he.isPending){if(!Tt&&!Jt)return}else{const Vt=((Ut=kn.current)==null?void 0:Ut.hasInput())??!1;if(!(!W.ctrlKey&&!W.metaKey&&!W.altKey&&!W.shiftKey&&(W.key==="Escape"||!Vt&&(W.key==="Enter"||W.key===" "))))return}W.preventDefault(),W.stopPropagation(),P8()};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[Il,Wt,P8,Kt]);const Pa=g.useCallback((D,W)=>gOe(de.current!=="idle",D,W,{append:he=>ge.appendLocalUserMessage(he)}),[ge]),$a=g.useCallback(()=>(ve("error",q("queue.commandBlocked")),!1),[ve,q]),wg=g.useCallback(D=>{Dw(D),n==null||n(D)},[n]),gh=g.useCallback(D=>{G(D),r==null||r(D)},[r]),$8=g.useCallback(()=>{Jn(!0)},[]),z8=lY({autoLoad:!0}),{settings:yh,setValue:jl,reload:xg}=z8,bh=yh.find(D=>D.key===fd),vh=yh.find(D=>D.key===BPe),wh=yh.find(D=>D.key===R0),Cq=(()=>{var W;const D=(W=yh.find(he=>he.key==="voiceModel"))==null?void 0:W.values.effective;return typeof D=="string"&&D.trim()?D.trim():void 0})(),Aq=(()=>{var W;const D=(W=yh.find(he=>he.key==="visionModel"))==null?void 0:W.values.effective;if(!(typeof D!="string"||!D.trim()))return pOe(D.trim())})(),Eq=(()=>{var W;const D=(W=yh.find(he=>he.key==="fastModel"))==null?void 0:W.values.effective;return typeof D=="string"&&D.trim()?D.trim():void 0})(),[_g,F8]=g.useState(!1),Fw=g.useRef(_g);Fw.current=_g,g.useEffect(()=>{if(t){Dw(t);return}const D=xS(bh==null?void 0:bh.values.effective);D&&Dw(D)},[t,bh==null?void 0:bh.values.effective]),g.useEffect(()=>{if(s!==void 0){G(bu(s));return}const D=vS(wh==null?void 0:wh.values.effective);D&&G(D)},[s,wh==null?void 0:wh.values.effective]);const Mq=g.useCallback(D=>{const W=ie,he=`/language ui ${D}`;gh(D);const Ue=()=>Promise.all([ue.refreshCommands(),xg()]);if(de.current!=="idle"){gh(W),$a();return}Ki(he,void 0).then(Ue).catch(Tt=>{gh(W),Bt(Tt,"Failed to sync /language command")})},[$a,gh,xg,Bt,Ki,ie,ue]),q8=g.useCallback(()=>{if(de.current!=="idle"){ge.dispatch([{type:"status",text:q("clear.blocked")}]);return}ge.reset()},[ge,q]),H8=g.useCallback(()=>{const D=Fw.current,W=!Fw.current;F8(W),jl("workspace",OPe,W).catch(he=>{F8(D),Bt(he,q("compact.saveFailed"))})},[Bt,jl,q]),Yu=g.useCallback(D=>{if(!ov(D)){Bt(new Error(`Unsupported approval mode: ${D}`),q("local.approvalMode"));return}if(!Ts.current.sessionId){bm(D);return}ue.setApprovalMode(D).then(W=>{const he=W.mode||D;Ow(he);const Ue=Xt.current;if(!Ue)return;if(D==="yolo"||D==="auto-edit"&&s$e(Ue)){const Jt=Ue.options.find(Ut=>Ut.kind==="allow_once");if(Jt){const Ut=Ue.title||"";ge.dispatch([{type:"status",text:q("mode.autoApproved",{tool:Ut})}]),ue.submitPermission(Ue.id,Jt.id).catch(Vt=>{Bt(Vt,"Failed to auto-approve tool call")})}}}).catch(W=>{Bt(W,q("local.approvalMode"))})},[ue,Bt,ge,q,bm]);g.useEffect(()=>{de.current=Q},[Q]),g.useEffect(()=>{let D=null;for(let he=st.length-1;he>=0;he--){const Ue=st[he];if((Ue==null?void 0:Ue.kind)==="user")break;if((Ue==null?void 0:Ue.kind)==="error"&&Ue.source==="turn_error"){D=Ue.id;break}if((Ue==null?void 0:Ue.kind)!=="debug")break}const W=In&&D!==null&&D!==ds.current&&$t.current.length>0;is.current=W?D:null,ze(W)},[st,In]),g.useEffect(()=>{l==null||l(Q)},[Q,l]);const U8=g.useRef(Q),V8=g.useRef(void 0);g.useEffect(()=>{var W;const D=U8.current;if(U8.current=Q,Q!=="idle"&&(V8.current=Ts.current.sessionId),D!=="idle"&&Q==="idle"){const he=Ts.current.sessionId;if(!he||he!==V8.current)return;const Ue=is.current!=null?new Error(`Turn error (block ${is.current})`):void 0;(W=ci.current)==null||W.call(ci,{type:"turn_complete",sessionId:he,error:Ue})}},[Q]),g.useEffect(()=>{a==null||a(ne.status)},[ne.status,a]),g.useEffect(()=>{ce==null||ce(st)},[st,ce]),g.useEffect(()=>{if(ne.error){const D=new Error(ne.error);c==null||c(D)}},[ne.error,c]),g.useEffect(()=>{I8(ne.currentModel??"")},[ne.currentModel,ne.sessionId]),g.useEffect(()=>{Ow(ne.currentMode??"default")},[ne.currentMode,ne.sessionId]),g.useEffect(()=>{const D=Nn.current;if(ne.sessionId&&ne.sessionId!==D&&Qs(null),Nn.current=ne.sessionId,!ne.sessionId&&ne.missingSession){Xn.current=ne.sessionId;return}Xn.current!==ne.sessionId&&(Xn.current=ne.sessionId,e==null||e(ne.sessionId))},[ne.missingSession,ne.sessionId,e]);const W8=g.useRef(void 0),qw=g.useRef(void 0);g.useEffect(()=>{var he;const D=ne.sessionId,W=ne.displayName;if(!(!D||!W)){if(D!==W8.current){W8.current=D,qw.current=W;return}W!==qw.current&&(qw.current=W,(he=ci.current)==null||he.call(ci,{type:"rename",sessionId:D,newName:W}))}},[ne.sessionId,ne.displayName]),g.useEffect(()=>{const D=FPe(st);Qs(W=>D?(W==null?void 0:W.condition)===D.condition&&W.setAt===D.setAt?W:D:W&&null)},[st]),g.useEffect(()=>{const D=W=>{const he=W.detail;if(!(he!=null&&he.active)){Qs(null);return}he.condition&&Qs({condition:he.condition,setAt:he.setAt??Date.now()})};return window.addEventListener(W3,D),()=>window.removeEventListener(W3,D)},[]);const kg=g.useRef(null),Sg=g.useRef(0);g.useEffect(()=>{Sg.current=0},[ne.sessionId]),g.useEffect(()=>{function he(){if(document.hidden){kg.current===null&&(kg.current=Date.now());return}const Ue=kg.current;if(kg.current=null,Ue===null||Date.now()-Ue<18e4||de.current!=="idle"||!ne.sessionId)return;const Tt=ge.getSnapshot().blocks.length;Tt-Sg.current<4||(Sg.current=Tt,ue.recapSession().then(Jt=>{Jt.recap&&ge.dispatch([{type:"status",text:`※ ${q("recap.label")}: ${Jt.recap}`,source:"recap"}])},Jt=>{console.error("[auto-recap] failed:",Jt)}))}return document.addEventListener("visibilitychange",he),()=>document.removeEventListener("visibilitychange",he)},[ne.sessionId,ue,ge,q]);const Hw=g.useCallback(()=>{const D=ov(Ba)?V1.indexOf(Ba):-1,W=V1[(D+1)%V1.length];Yu(W)},[Ba,Yu]),xm=g.useCallback((D,W)=>{Fr()&&(Pa(D)||ue.getContextUsage({detail:W}).then(he=>{ge.dispatch([{type:"status",text:Ide(he)}]),rr("smooth")}).catch(he=>{Bt(he,"Failed to load context usage")}))},[Pa,ge,Fr,ue,Bt,rr]),Nq=g.useCallback(()=>{xm("/context detail",!0)},[xm]),Tg=g.useCallback(D=>{Fr()&&ue.branchSession(D||void 0).then(W=>{ge.dispatch([{type:"status",text:q("branch.success",{name:W.displayName})}])}).catch(W=>{Bt(W,q("branch.failed"))})},[Bt,Fr,ue,ge,q]),Iq=g.useCallback(()=>{Tg()},[Tg]),Qu=g.useCallback(async()=>{ut(),$o();try{return await ue.clearSession(),!0}catch(D){return Bt(D,"Failed to start a new chat"),!1}},[ut,$o,Bt,ue]),jq=g.useCallback(async()=>{if(!Wi.current){Wi.current=!0,Ci(!0),ur("chat");try{await Qu()&&(e==null||e(void 0))}finally{Wi.current=!1,Ci(!1)}}},[Qu,e]),xh=g.useCallback(async D=>{we(D),ut(),$o();try{await ue.loadSession(D)}catch(W){throw we(he=>he===D?null:he),W}},[ut,$o,ue]),Rq=g.useCallback(D=>{ur("chat"),xh(D).catch(W=>{Bt(W,"Failed to open session")})},[xh,Bt]);g.useEffect(()=>{Ae!==null&&ne.sessionId===Ae&&!ne.loadingTranscript&&!ne.catchingUp&&we(null)},[ne.catchingUp,ne.loadingTranscript,ne.sessionId,Ae]);const Xu=g.useRef(null),Uw=g.useCallback(D=>{const W=Xu.current;W&&W.sessionId===D&&(clearTimeout(W.timer),Xu.current=null)},[]),Cg=g.useCallback(D=>new Promise((W,he)=>{let Ue=!1;Ki(D,void 0,{onAdmitted:()=>{Ue||(Ue=!0,W())}}).then(()=>{Ue||he(new Error("Run was cancelled before it started"))},Jt=>{Ue||he(Jt)})}),[Ki]),Ag=g.useCallback(()=>{const D=Xu.current,W=Ts.current;!D||W.sessionId!==D.sessionId||W.loadingTranscript||W.catchingUp||(clearTimeout(D.timer),Xu.current=null,Cg(D.prompt).then(()=>D.resolve(),he=>D.reject(he)))},[Cg]),Lq=g.useCallback((D,W)=>{if(ur("chat"),!W)return Cg(D);const he=Xu.current;return he&&(clearTimeout(he.timer),Xu.current=null,he.reject(new Error("superseded by another run"))),new Promise((Ue,Tt)=>{const Jt=setTimeout(()=>{Uw(W),Tt(new Error("Timed out switching to the task session"))},DPe);Xu.current={sessionId:W,prompt:D,resolve:Ue,reject:Tt,timer:Jt},xh(W).then(()=>Ag()).catch(Ut=>{Uw(W),Tt(Ut)})})},[Cg,xh,Uw,Ag]);g.useEffect(()=>{Ag()},[ne.sessionId,ne.loadingTranscript,ne.catchingUp,Ag]);const Vw=g.useCallback(()=>{Fr()&&ue.getTasks().then(D=>{bg({snapshot:D})}).catch(D=>{Bt(D,"Failed to load tasks")})},[Bt,Fr,ue]),G8=g.useCallback((D,W)=>{Qs({condition:D,setAt:W}),ge.dispatch([{type:"status",text:tE({kind:"set",condition:D,setAt:W})}])},[ge]),K8=g.useCallback(D=>{D&&(ge.dispatch([{type:"status",text:tE({kind:"cleared",condition:D.condition,durationMs:Date.now()-D.setAt})}]),Qs(null))},[ge]),Eg=g.useCallback(D=>Fr()?(ge.appendLocalUserMessage(D),ue.clearGoal().catch(W=>{Bt(W,"Failed to clear /goal")}),!0):!1,[Bt,Fr,ue,ge]),Dq=g.useCallback(()=>ue.getRewindSnapshots(),[ue]),Oq=g.useCallback(D=>ue.rewindSession(D,{rewindFiles:!1}).then(()=>{}),[ue]),Bq=g.useCallback(D=>{if(Ih(D))return;const W=D instanceof Error?D.message:String(D);ve("error",q("rewind.failed",{reason:W}))},[ve,q]),Y8=g.useCallback((D,W,he)=>{const Ue=D.replace(/^\/goal\b/i,"").trim(),Tt=Ue.toLowerCase(),Jt=(he==null?void 0:he.sendToDaemon)??!0,Ut=()=>{const Vt=!!Nl.current,Fe=!Ts.current.sessionId||Vt;return Ki(D,W,{clearComposerOnPromptStart:Fe,commitComposerAccepted:Vt?he==null?void 0:he.commitComposerAccepted:void 0}).catch(Ne=>{Bt(Ne,"Failed to send /goal command")}),!Fe};return Ue&&JF.has(Tt)?Jt?Eg(D):(ge.appendLocalUserMessage(D),K8(ga.current),!0):Ue?Jt?Ut():(ge.appendLocalUserMessage(D),G8(Ue,Date.now()),!0):Jt?Ut():(ge.appendLocalUserMessage(D),!0)},[K8,G8,Eg,Bt,Ki,ge,Ts]),_m=g.useMemo(()=>new Set((h??[]).map(B4).filter(Boolean)),[h]),Pq=_m.has("settings"),Q8=g.useCallback((D,W,he)=>{var Jt;if(Ts.current.loadingTranscript)return ve("warning",q("editor.sessionLoading")),!1;if(RPe({connectionStatus:Ts.current.status}))return ve("warning",q("editor.connectionDisconnected")),!1;const Ue=de.current!=="idle",Tt=(Ut,Vt,Fe,Ne)=>{const yn=!!Nl.current,an=!Ts.current.sessionId||yn;return Ki(Ut,Vt,{...Ne,clearComposerOnPromptStart:an,commitComposerAccepted:yn?he:void 0}).catch(Zn=>Bt(Zn,Fe)),!an};if(D.startsWith("/")){const Ut=D.match(/^\/([\w-]+)/);if(Ut){const Vt=Ut[1];if(_m.has(B4(Vt)))return Ue?Ku(D,W,void 0,he):Tt(D,W,"Failed to send hidden slash command");if(Vt==="help")return Jn(!0),!0;if(Vt==="tasks")return Vw(),!0;if(Vt==="goal")return Ue?$Pe(D)?Eg(D):$a():Y8(D,W,{commitComposerAccepted:he});if(Vt==="theme"){const Fe=D.slice(Ut[0].length).trim().toLowerCase();return Fe==="dark"||Fe==="light"?wg(Fe):Fe?ve("error",q("error.unsupportedTheme")):zr(!0),!0}if(Vt==="language"){const Fe=D.slice(Ut[0].length).trim(),[Ne,yn]=Fe.split(/\s+/);if(!Fe)return ge.dispatch([{type:"status",text:[q("language.current",{language:wS(ie)}),q("language.usage"),q("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Ne==null?void 0:Ne.toLowerCase())==="ui"){if(!yn)return ge.dispatch([{type:"status",text:[q("language.set"),"",q("language.usage"),"",q("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const an=yn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(an))return ve("error",q("language.invalid")),!0;const Zs=bu(yn);if(gh(Zs),!Ue){const Qr=!!Nl.current,za=!Ts.current.sessionId||Qr;return Ki(`/language ui ${Zs}`,void 0,{clearComposerOnPromptStart:za,commitComposerAccepted:Qr?he:void 0}).then(()=>ue.refreshCommands()).catch(zo=>{Bt(zo,"Failed to sync /language command")}),!za}return!0}}if(Vt==="copy"){const Fe=D.slice(Ut[0].length).trim();return oOe(He.current,Fe).then(Ne=>{ge.dispatch([{type:Ne.status==="error"?"error":"status",text:l$e(Ne.message,q)}])}).catch(Ne=>{Bt(Ne,q("copy.failedFallback"))}),!0}if(Vt==="delete")return xe(!0),!0;if(Vt==="release")return Ot(!0),!0;if(Vt==="rewind")return Fr()?(wn(!0),!0):!1;if(Vt==="branch"){if(Ue)return $a();const Fe=D.slice(Ut[0].length).trim();return Tg(Fe||void 0),!0}if(Vt==="fork"){if(Ue)return $a();if(!Fr())return!1;const Fe=D.slice(Ut[0].length).trim();return Fe?(ue.forkSession(Fe).then(Ne=>{if(!Ne.launched){ve("warning",q("fork.notStarted"));return}rs(yn=>yn+1),ve("success",q("fork.started",{name:Ne.description}))}).catch(Ne=>{const yn=Ne instanceof Error?Ne.message:String(Ne);Bt(Ne,q("fork.failed",{reason:yn}))}),!0):(ve("error",q("fork.empty")),!0)}if(Vt==="auth")return Iw(!0),!0;if(Vt==="model"){const Fe=D.slice(Ut[0].length).trim();if(Fe==="--fast")return $n("fast"),!0;if(Fe.startsWith("--fast "))return Ue?Ku(D,W,void 0,he):Tt(D,W,"Failed to send /model --fast");if(Fe==="--voice")return Pa(D,W)||vt.loadProviders().then(Ne=>{_t(Hbe(Ne)),$n("voice")}).catch(Ne=>Bt(Ne,q("model.setVoice"))),!0;if(Fe.startsWith("--voice ")){const Ne=Fe.replace(/^--voice\s+/,"");return jl("workspace","voiceModel",Ne).catch(yn=>Bt(yn,q("model.setVoice"))),!0}if(Fe==="--vision")return $n("vision"),!0;if(Fe.startsWith("--vision ")){const Ne=Fe.replace(/^--vision\s+/,"");return jl("workspace","visionModel",Ne).catch(yn=>Bt(yn,q("model.setVision"))),!0}if(Fe){if(!Ts.current.sessionId)return ph(Fe),!0;ue.setModel(Fe).then(()=>{ph(Fe)}).catch(Ne=>{Bt(Ne,q("model.switch"))})}else $n("main");return!0}if(Vt==="plan"){if(Ue)return $a();const Fe=D.slice(Ut[0].length).trim();return Ts.current.sessionId?(Fe&&Gu(!0),ue.setApprovalMode("plan").then(()=>{if(bm("plan"),Fe)return Ki(Fe,W,{clearComposerOnPromptStart:!0}).catch(Ne=>Bt(Ne,"Failed to send plan prompt"))}).catch(Ne=>{Bt(Ne,q("mode.plan"))}).finally(()=>{Fe&&Gu(!1)}),!Fe):(bm("plan"),Fe?Tt(Fe,W,"Failed to send plan prompt"):!0)}if(Vt==="approval-mode"){const Fe=D.slice(Ut[0].length).trim();return Fe?Yu(Fe):pt(!0),!0}if(Vt==="mcp"){const Fe=D.slice(Ut[0].length).trim().toLowerCase();return vt.loadMcpStatus().then(async Ne=>{const yn={},an={};await Promise.all(((Ne==null?void 0:Ne.servers)??[]).map(async Zn=>{await Promise.all([(async()=>{try{yn[Zn.name]=await vt.loadMcpTools(Zn.name)}catch{}})(),(async()=>{if(Zn.resourceCount)try{an[Zn.name]=await vt.loadMcpResources(Zn.name)}catch{}})()])})),Cw({status:Ne,toolsByServer:yn,resourcesByServer:an,showDescriptions:Fe==="desc",showSchema:Fe==="schema",showTips:!Fe})}).catch(Ne=>{Bt(Ne,"Failed to load MCP status")}),!0}if(Vt==="skills")return D.slice(Ut[0].length).trim()?Ue?Ku(D,W,void 0,he):Tt(D,W,"Failed to send /skills command"):(Pa(D,W)||vt.loadSkillsStatus().then(Ne=>{const yn=((Ne==null?void 0:Ne.skills)??[]).map(an=>({name:an.name,description:an.description??""})).sort((an,Zn)=>an.name.localeCompare(Zn.name));if(vs(yn),yn.length===0)ge.dispatch([{type:"status",text:q("skills.none")}]);else{const an=yn.map(Zn=>`- ${Zn.name}`).join(`
`);ge.dispatch([{type:"status",text:`${q("skills.available")}

${an}`}])}rr("smooth")}).catch(Ne=>{Bt(Ne,"Failed to load skills")}),!0);if(Vt==="tools"){const Fe=D.slice(Ut[0].length).trim().toLowerCase();if(Fe==="desc"||Fe==="descriptions")Vu(!0);else{if(Pa(D,W))return!0;vt.loadToolsStatus().then(Ne=>{const yn=(Ne==null?void 0:Ne.tools)??[];if(yn.length===0)ge.dispatch([{type:"status",text:q("tools.none")}]);else{const an=yn.map(Zn=>`- ${Zn.displayName||Zn.name}`).join(`
`);ge.dispatch([{type:"status",text:`${q("tools.available")}

${an}`}])}rr("smooth")}).catch(Ne=>{Bt(Ne,"Failed to load tools")})}return!0}if(Vt==="settings")return La("settings"),!0;if(Vt==="schedule")return Aw(),!0;if(Vt==="context"){const Fe=D.slice(Ut[0].length).trim().toLowerCase();if(Fe===""||Fe==="detail"||Fe==="-d")return xm(D,Fe==="detail"||Fe==="-d"),!0}if(Vt==="memory"){const Fe=D.slice(Ut[0].length).trim().toLowerCase();if(Fe==="refresh")cq(Ne=>Ne+1);else if(Fe==="add"||Fe.startsWith("add ")){const Ne=Fe.slice(3).trim();fq(Ne==="user"||Ne==="global"?"global":"workspace"),dq(yn=>yn+1)}return C8(!0),!0}if(Vt==="agents"){const Fe=D.slice(Ut[0].length).trim().toLowerCase();let Ne="menu";return Fe==="create"?Ne="create":Fe==="create user"||Fe==="create global"?Ne="create-user":Fe==="create project"||Fe==="create workspace"?Ne="create-project":Fe==="manage"&&(Ne="manage"),jw(Ne),!0}if(Vt==="extensions"){const Fe=D.slice(Ut[0].length).trim(),Ne=(Jt=Fe.split(/\s+/)[0])==null?void 0:Jt.toLowerCase();if(!Ne||Ne==="manage")return b8(!0),!0;if(Ne==="install"){if(Ue)return $a();const yn=Fe.slice(7).trim().split(/\s+/);let an="",Zn,Zs,Qr,za,zo=null;for(let Fo=0;Fo<yn.length;Fo++){const Mi=yn[Fo];if(Mi)if(Mi==="--auto-update")Qr=!0;else if(Mi==="--pre-release"||Mi==="--allow-pre-release")za=!0;else if(Mi==="--ref"||Mi==="--registry"){const Ju=yn[Fo+1];if(!Ju||Ju.startsWith("--")){zo=q("extensions.install.missingOptionValue",{option:Mi});break}Mi==="--ref"?Zn=Ju:Zs=Ju,Fo+=1}else if(Mi.startsWith("--")){zo=q("extensions.install.unknownOption",{option:Mi});break}else if(!an)an=Mi;else{zo=q("extensions.install.usage");break}}if(zo)return ge.appendLocalUserMessage(D),ge.dispatch([{type:"error",text:zo}]),!0;if(!an)return ge.appendLocalUserMessage(D),ge.dispatch([{type:"error",text:q("extensions.install.usage")}]),!0;const Fa=Ts.current.clientId;return Fa?(ge.appendLocalUserMessage(D),ge.dispatch([{type:"status",text:q("extensions.install.started",{source:an})}]),vt.installExtension({source:an,...Zn?{ref:Zn}:{},...Zs?{registry:Zs}:{},...Qr!==void 0?{autoUpdate:Qr}:{},...za!==void 0?{allowPreRelease:za}:{},consent:!0},Fa).then(()=>{}).catch(Fo=>{Bt(Fo,q("extensions.install.requestFailed"))}),!0):(ve("warning",q("extensions.install.waitForSession")),!0)}return Pa(D,W)||ge.dispatch([{type:"error",text:q("extensions.install.usage")}]),!0}if(Vt==="clear"||Vt==="new"||Vt==="reset")return Qu(),!0;if(Vt==="rename"){const Fe=r$e(D.slice(Ut[0].length));if(Fe.type==="auto"||Fe.type==="delegate")return Ue?Ku(D,W,void 0,he):Tt(D,W,"Failed to send /rename command");const Ne=Fe.displayName;return Ne?Fr()?(ue.renameSession(Ne).then(()=>{ge.dispatch([{type:"status",text:q("rename.success",{name:Ne})}])}).catch(yn=>{Bt(yn,"Failed to rename session")}),!0):!1:(ve("error",q("rename.empty")),!0)}if(Vt==="resume"){const Fe=D.slice(Ut[0].length).trim();return Fe?(ut(),$o(),ue.loadSession(Fe).catch(Ne=>{Bt(Ne,"Failed to load session")})):(ut(),cn(!0)),!0}if(Vt==="recap")return O8(),!0;if(Vt==="btw")return B8(D.slice(Ut[0].length)),!0;if(Vt==="stats"){const Fe=D.slice(Ut[0].length).trim().toLowerCase();let Ne="overview";return Fe==="model"?Ne="model":Fe==="tools"&&(Ne="tools"),Fr()?(Pa(D,W)||ue.getStats().then(yn=>{ge.dispatch([{type:"status",text:ghe(yn,Ne)}]),rr("smooth")}).catch(()=>{}),!0):!1}if(Vt==="status"||Vt==="about")return Pa(D,W)||Promise.all([vt.loadPreflight().catch(()=>null),vt.loadProviders().catch(()=>null),vt.loadEnv().catch(()=>null)]).then(([Fe,Ne,yn])=>{var Ju,r7,i7,o7,a7,l7;const an=VN(Fe,yn);let Zn=an.authSource;!Zn&&((Ju=Ne==null?void 0:Ne.current)!=null&&Ju.authType)&&(Zn=Ne.current.authType);const Zs=[];an.nodeVersion&&Zs.push(`Node.js v${an.nodeVersion}`),an.npmVersion&&Zs.push(`npm ${an.npmVersion}`);let Qr="";Zn&&(Zn.startsWith("oauth")||Zn==="qwen-oauth"?Qr="Qwen OAuth":Qr=`API Key - ${Zn}`);const za=`${an.platform} ${an.arch}`.trim(),zo=vg.current,Fa=Ts.current,Mi={cliVersion:((r7=Fa.capabilities)==null?void 0:r7.qwenCodeVersion)||"",runtime:Zs.join(" / "),platform:za,auth:Qr,baseUrl:((i7=Ne==null?void 0:Ne.current)==null?void 0:i7.baseUrl)||"",model:zo||Fa.currentModel||((o7=Ne==null?void 0:Ne.current)==null?void 0:o7.modelId)||"",fastModel:((a7=Ne==null?void 0:Ne.current)==null?void 0:a7.fastModelId)||zo||Fa.currentModel||((l7=Ne==null?void 0:Ne.current)==null?void 0:l7.modelId)||"",sessionId:Fa.sessionId||"",sandbox:an.sandbox,proxy:an.proxy,memoryUsage:an.memoryUsage};ge.dispatch([{type:"status",text:Rhe(Mi)}]),rr("smooth")}),!0;if(Vt==="bug"){const Fe=D.slice(Ut[0].length).trim();return Pa(D,W)||Promise.all([vt.loadPreflight().catch(()=>null),vt.loadEnv().catch(()=>null)]).then(([Ne,yn])=>{var Qr;const an=VN(Ne,yn),Zn=((Qr=Ts.current.capabilities)==null?void 0:Qr.qwenCodeVersion)||"",Zs={};if(Zn&&(Zs.cliVersion=Zn),an.nodeVersion&&(Zs.nodeVersion=an.nodeVersion),an.npmVersion&&(Zs.npmVersion=an.npmVersion),an.platform&&(Zs.platform=an.platform),an.arch&&(Zs.arch=an.arch),an.sandbox&&(Zs.sandbox=an.sandbox),an.memoryUsage&&(Zs.memoryUsage=an.memoryUsage),zw.current)zw.current({title:Fe,systemInfo:Zs}),ge.dispatch([{type:"status",text:q("bug.submitted")}]);else{const za=Object.entries(Zs).filter(([,Fo])=>Fo).map(([Fo,Mi])=>`${Fo}: ${Mi}`).join(`
`),zo=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(Fe)}&info=${encodeURIComponent(`
`+za+`
`)}`,Fa=window.open(zo,"_blank");Fa?(Fa.opener=null,ge.dispatch([{type:"status",text:q("bug.submitted")}])):ve("error",q("bug.popupBlocked"))}}).catch(Ne=>{Bt(Ne,q("bug.failed"))}),!0}}return Ue?Ku(D,W,void 0,he):Tt(D,W,"Failed to send command")}else if(D.startsWith("!")){if(Ue)return ve("error",q("queue.shellBlocked")),!1;const Ut=D.slice(1).trim();return!Ut||!Fr()?!1:(ue.sendShellCommand(Ut).catch(Vt=>{Bt(Vt,"Failed to execute shell command")}),!0)}else return Ue?Ku(D,W,void 0,he):Tt(D,W,"Failed to send message")},[Ki,ue,ge,Ku,Pa,Tg,ut,$o,La,Aw,Qu,Eg,Y8,wg,Yu,gh,$a,Vw,_m,ve,Bt,O8,B8,Fr,rr,ie,ph,bm,jl,xm,q,vt]),$q=g.useCallback((D,W,he)=>{const Ue=Q8(D,W,he);return Ue!==!1&&rr("smooth"),Ue},[Q8,rr]),X8=g.useCallback((D,W,he)=>{ue.submitPermission(D,W,he).catch(Ue=>{Bt(Ue,"Failed to submit permission choice")})},[ue,Bt]),Ww=g.useCallback(()=>{ue.cancel().catch(D=>{Bt(D,"Failed to cancel request")})},[ue,Bt]),zq=g.useCallback(()=>{var D;return Il?!1:((D=Dt.current)==null?void 0:D.focusTaskPill())??!1},[Il]),Fq=g.useCallback(D=>{var W,he;if(D){(W=kn.current)==null||W.insertText(D);return}(he=kn.current)==null||he.focus()},[]),qq=g.useCallback(D=>{Oo(D)},[]),Gw=g.useCallback(()=>{Wn.current&&In&&de.current==="idle"&&is.current&&$t.current?(ds.current=is.current,ze(!1),Ki($t.current,vn.current,{optimisticUserMessage:!1,retry:!0}).catch(D=>Bt(D,"Failed to retry prompt"))):ge.dispatch([{type:"status",text:q("retry.none")}])},[In,Ki,Bt,ge,q]);g.useEffect(()=>{const D=W=>{if(!Il&&W.ctrlKey&&!W.metaKey&&!W.altKey&&!W.shiftKey){if(W.key==="l"){W.preventDefault(),q8();return}if(W.key==="o"){W.preventDefault(),H8();return}if(W.key==="y"){W.preventDefault(),Gw();return}}};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[Il,q8,H8,Gw,ge,q]);const Sc=g.useCallback(()=>{yg.current=null,M8(!1),N8(!1),fh.current&&(clearTimeout(fh.current),fh.current=null)},[]),J8=g.useRef({streamingState:Q,pendingApproval:Kt,interactionBlocked:Il,activePanel:js,closePanel:$o,handleCancel:Ww,handleCycleMode:Hw});J8.current={streamingState:Q,pendingApproval:Kt,interactionBlocked:Il,activePanel:js,closePanel:$o,handleCancel:Ww,handleCycleMode:Hw};const Hq=Q!=="idle";g.useEffect(()=>{Sc()},[Hq,Sc]),g.useEffect(()=>{const he=(Tt,Jt)=>{yg.current=Tt,Tt==="cancel"?N8(!0):M8(!0),fh.current&&clearTimeout(fh.current),fh.current=setTimeout(Sc,Jt)},Ue=Tt=>{var Vt,Fe;if(Tt.defaultPrevented||Tt.isComposing)return;const Jt=J8.current;if(Tt.key==="Escape"&&Jt.activePanel){const Ne=Tt.target;Ne!=null&&Ne.closest("[data-sidebar-shell]")||(Tt.preventDefault(),Jt.closePanel());return}if(Tt.key!=="Escape"){yg.current!==null&&Sc(),Tt.key==="Tab"&&Tt.shiftKey&&!Jt.interactionBlocked&&(Tt.preventDefault(),Jt.handleCycleMode());return}const Ut=hOe({blocked:!!Jt.pendingApproval||Jt.interactionBlocked,streaming:Jt.streamingState!=="idle",hasInput:!!((Vt=kn.current)!=null&&Vt.hasInput()),armed:yg.current});if(Ut.kind!=="ignore")switch(Tt.preventDefault(),Ut.kind){case"cancel":Jt.handleCancel(),Sc();break;case"clear":(Fe=kn.current)==null||Fe.clear(),Sc();break;case"arm":he(Ut.action,Ut.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",Ue),()=>{window.removeEventListener("keydown",Ue),Sc()}},[Sc]);const Uq=IPe({catchingUp:!!ne.catchingUp,pendingApproval:Kt!==null,isPreparingPrompt:Pw}),Kw=g.useCallback(D=>{if(!Ts.current.sessionId){ph(D);return}ue.setModel(D).then(W=>{const he=t$e(W);ph((he==null?void 0:he.modelId)??D),he&&ge.dispatch({type:"debug",text:n$e(he,q),source:"model_switch_summary",data:he})}).catch(W=>{Bt(W,q("model.switch"))})},[ue,ge,Bt,q,ph]),Vq=g.useCallback(D=>{if(Q!=="idle"){$a();return}$o(),Ki(`/model --fast ${D}`).then(()=>{xg().catch(W=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",W)})}).catch(W=>{Bt(W,"Failed to switch fast model")})},[$a,$o,Ki,Q,Bt,xg]),Wq=g.useCallback(D=>{const W=mOe(D);jl("workspace","voiceModel",W).catch(he=>Bt(he,q("model.setVoice")))},[Bt,jl,q]),Gq=g.useCallback(D=>{const W=fOe(D);jl("workspace","visionModel",W).catch(he=>Bt(he,q("model.setVision")))},[Bt,jl,q]),Kq={main:Kw,fast:Vq,voice:Wq,vision:Gq},Z8=g.useMemo(()=>OF(BF(ne.commands??[],LF(q)),q).filter(D=>!_m.has(B4(D.name))).map(D=>{const W=DF(D.name);return W?{...D,displayCategory:"skill",description:q(W)}:D}),[ne.commands,_m,q]),km=g.useMemo(()=>{var D;return{version:((D=ne.capabilities)==null?void 0:D.qwenCodeVersion)||"",cwd:ne.workspaceCwd||"",currentModel:mh,currentMode:Ba,hideTips:(vh==null?void 0:vh.values.effective)===!0}},[(s7=ne.capabilities)==null?void 0:s7.qwenCodeVersion,ne.workspaceCwd,mh,Ba,vh==null?void 0:vh.values.effective]),Yq=g.useMemo(()=>w?w(km):u.jsx(F6e,{...km}),[w,km]),e7=g.useMemo(()=>b==null?void 0:b(km),[b,km]),Rl=!ne.sessionId&&_n.length===0&&!pn&&!Kt&&!Wt,t7=ne.status!=="connecting"&&!ne.sessionId&&ne.missingSession===!0&&!js&&Js==="chat",Yw=Rl?Ey():be,Qq=nq(M),Xq=[Nt.app,Nt.appChat,Rl?Nt.appChatEmpty:void 0,le.enabled?Nt.appWithSidebar:void 0,Lw===yi.Light?Nt.themeLight:Nt.themeDark,i].filter(Boolean).join(" "),Jq=g.useMemo(()=>({...o,...KPe(Yw,M)}),[M,Yw,o]),n7=g.useCallback(D=>{fe(D),GPe(D)},[]);return g.useLayoutEffect(()=>{const D=yr.current;if(!D)return;const W=El.current,he=Ra.current,Ue=D.getBoundingClientRect();if(he&&!Rl&&W){const Tt=W.top-Ue.top;Math.abs(Tt)>1&&(D.style.transition="width 320ms ease",D.style.transform=`translateY(${Tt}px)`,requestAnimationFrame(()=>{D.style.transition="width 320ms ease, transform 280ms ease",D.style.transform=""}),window.setTimeout(()=>{D.style.transition=""},320))}El.current=Ue,Ra.current=Rl},[Rl]),u.jsx(QY,{value:Lw,children:u.jsx(PY,{language:ie,children:u.jsxs("div",{className:Xq,style:Jq,"data-web-shell-root":!0,children:[!$&&u.jsx(w6e,{toasts:ln,onDismiss:Qt}),At&&u.jsx(Mr,{title:q("resume.title"),size:"lg",onClose:()=>cn(!1),children:u.jsx(_8e,{onSelect:D=>{ut(),$o(),ue.loadSession(D).catch(W=>{Bt(W,"Failed to load session")})},onClose:()=>cn(!1)})}),Ss&&u.jsx(Mr,{title:q(PPe[Ss]),size:"lg",onClose:()=>$n(null),children:u.jsx(H8e,{mode:Ss,models:Ss==="voice"?Me:void 0,currentModelId:Ss==="voice"?Cq:Ss==="vision"?Aq:Ss==="fast"?Eq:void 0,onSelect:D=>{Ss&&Kq[Ss](D),$n(null)}})}),lt&&u.jsx(Mr,{title:q("mode.select"),size:"sm",onClose:()=>pt(!1),children:u.jsx(x8e,{currentMode:Ba,onSelect:D=>{Yu(D),pt(!1)}})}),Po&&u.jsx(Mr,{title:q("tools.title"),size:"lg",onClose:()=>Vu(!1),children:u.jsx(X9e,{})}),gm&&u.jsx(Mr,{title:q("extensions.manage.title"),size:"lg",onClose:()=>b8(!1),children:u.jsx(qIe,{})}),Tw&&u.jsx(Mr,{title:q("mcp.manageServers"),size:"lg",onClose:()=>Cw(null),children:u.jsx(NPe,{message:Tw,onClose:()=>Cw(null)})}),Rw&&u.jsx(Mr,{title:q("tasks.title"),size:"lg",onClose:()=>bg(null),children:u.jsx(mP,{message:Rw,embedded:!0,manageActiveEvent:!1,onClose:()=>bg(null)})}),ym&&u.jsx(Mr,{title:q(ym==="manage"?"agent.manage":ym==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>jw(null),children:u.jsx(n9e,{mode:ym,embedded:!0,onMessage:D=>ge.dispatch([{type:"status",text:D}]),onClose:()=>jw(null)})}),T8&&u.jsx(Mr,{title:q("memory.menu"),size:"lg",onClose:()=>C8(!1),children:u.jsx(_9e,{refreshSignal:lq,addSignal:uq,addScope:hq,onMessage:(D,W="status")=>{ge.dispatch([{type:W,text:D}])}})}),Zt&&u.jsx(Mr,{title:q("help.title"),size:"md",onClose:()=>Jn(!1),children:u.jsx(oRe,{commands:Z8})}),Er&&u.jsx(Mr,{title:q("theme.title"),size:"sm",onClose:()=>zr(!1),children:u.jsx(aRe,{currentTheme:Lw,onSelect:wg,onClose:()=>zr(!1)})}),A8&&u.jsx(Mr,{title:q("auth.title"),size:"lg",onClose:()=>Iw(!1),children:u.jsx(Y9e,{onMessage:(D,W="status")=>{ge.dispatch([W==="error"?{type:"error",text:D}:{type:"status",text:D}])},onClose:()=>Iw(!1)})}),Y&&u.jsx(Mr,{title:q("delete.title"),size:"lg",onClose:()=>xe(!1),children:u.jsx(lRe,{onDeleted:D=>{ge.dispatch([{type:"status",text:D.length===1?`${q("delete.deleted")} (${D[0].slice(0,8)})`:q("delete.deletedCount",{count:D.length})}])},onError:D=>{if(Ih(D))return;const W=D instanceof Error?D.message:String(D);ve("error",q("delete.failed",{reason:W}))},onClose:()=>xe(!1)})}),ke&&u.jsx(Mr,{title:q("release.title"),size:"lg",onClose:()=>Ot(!1),children:u.jsx(cRe,{onReleased:D=>{ge.dispatch([{type:"status",text:`${q("release.released")} (${D.slice(0,8)})`}])},onError:D=>{if(Ih(D))return;const W=D instanceof Error?D.message:String(D);ve("error",q("release.failed",{reason:W}))},onClose:()=>Ot(!1)})}),gn&&u.jsx(Mr,{title:q("rewind.title"),subtitle:q("rewind.subtitle"),size:"lg",onClose:()=>wn(!1),children:u.jsx(CRe,{blocks:st,loadSnapshots:Dq,rewind:Oq,onError:Bq,onClose:()=>wn(!1)})}),u.jsxs("div",{className:Nt.appShell,children:[le.enabled&&u.jsxs("div",{"data-sidebar-shell":"",...ct?{role:"dialog","aria-modal":"true"}:{},"aria-label":q("sidebar.label"),className:[Nt.mobileDrawer,ct?Nt.mobileDrawerOpen:void 0].filter(Boolean).join(" "),children:[u.jsx("div",{className:Nt.mobileBackdrop,onClick:ut,"aria-hidden":"true"}),u.jsx(UDe,{collapsed:Se&&!ct,onCollapsedChange:tt,onOpenSettings:()=>{ut(),La("settings")},onOpenDaemonStatus:()=>{ut(),La("status")},onOpenScheduledTasks:()=>{ut(),Aw()},onOpenSessions:()=>{ut(),La("sessions")},canOpenSessionsOverview:ft,onOpenSplitView:()=>{ut(),hh()},canOpenSplitView:ft,onNewSession:()=>(ur("chat"),Qu()),onLoadSession:D=>(ur("chat"),xh(D)),onError:Bt,mobileOpen:ct,sessionListReloadToken:R8})]}),u.jsxs("div",{className:Js!=="chat"?`${Nt.chatPane} ${Nt.chatPaneShowingPage}`:Nt.chatPane,children:[le.enabled&&!js&&Js==="chat"&&u.jsx("button",{type:"button",className:[Nt.hamburgerButton,Rl?Nt.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>ht(D=>!D),"aria-label":q("sidebar.toggleMenu"),"aria-expanded":ct,children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),u.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),u.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),js&&u.jsxs("section",{className:Nt.panelHost,role:"region","data-testid":"inline-panel","aria-label":q(js==="settings"?"settings.title":js==="status"?"daemon.title":"sessionsOverview.title"),children:[u.jsxs("div",{className:Nt.panelHeader,children:[u.jsx("button",{ref:x8,type:"button",className:Nt.panelBack,"data-testid":"panel-back",onClick:$o,"aria-label":q("common.back"),title:q("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),u.jsx("div",{className:Nt.panelTitle,children:q(js==="settings"?"settings.title":js==="status"?"daemon.title":"sessionsOverview.title")})]}),u.jsx("div",{className:Nt.panelBody,children:js==="settings"?u.jsx(Eje,{settingsState:z8,embedded:!0,onLanguageChange:Mq,onThemeChange:wg,chatWidthMode:be,onChatWidthModeChange:n7,onSubDialog:D=>{D==="fastModel"?$n("fast"):D==="visionModel"?$n("vision"):D==="tools.approvalMode"&&pt(!0)}}):js==="status"?u.jsx($Ae,{}):u.jsx(AEe,{onOpenSession:Rq,onOpenSplit:hh})},js)]}),Js==="scheduledTasks"&&u.jsxs("div",{className:Nt.fullPage,"data-testid":"scheduled-tasks-page",children:[u.jsxs("div",{className:Nt.fullPageHeader,children:[u.jsx("button",{type:"button",className:Nt.fullPageBack,onClick:()=>ur("chat"),"aria-label":q("common.back"),title:q("common.back"),children:u.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u.jsx("path",{d:"M15 18l-6-6 6-6"})})}),u.jsx("div",{className:Nt.fullPageTitle,children:q("scheduledTasks.title")})]}),u.jsx("div",{className:Nt.fullPageBody,children:u.jsx(PIe,{onRunPrompt:Lq,onCreateViaChat:()=>{ur("chat"),Qu().then(D=>{D&&(e==null||e(void 0),window.setTimeout(()=>{var W,he;(W=kn.current)==null||W.insertText(q("scheduledTasks.chatStarter"),{mode:"replace"}),(he=kn.current)==null||he.focus()},0))})},onOpenSession:D=>{ur("chat"),xh(D).catch(W=>{Bt(W,"Failed to open session")})},onError:Bt})})]}),Js==="split"&&u.jsxs("div",{className:Nt.fullPage,"data-testid":"split-view-page",children:[mn&&u.jsxs("div",{className:Nt.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[u.jsx("span",{children:q("splitView.outerApprovalPending")}),u.jsx("button",{type:"button",onClick:()=>ur("chat"),children:q("splitView.goToApproval")})]}),u.jsx(bT,{value:qt,children:u.jsx(Zd.Provider,{value:_g,children:u.jsx(RNe,{sessionIds:dn,onPanesChange:oq,sessionListReloadToken:R8,onExit:aq,onError:Bt})})})]}),u.jsxs("div",{className:js||Js!=="chat"?`${Nt.chatViewWrap} ${Nt.chatViewHidden}`:Nt.chatViewWrap,"aria-hidden":js||Js!=="chat"?!0:void 0,children:[t7&&u.jsxs("div",{className:Nt.missingSessionState,children:[u.jsx("div",{className:Nt.missingSessionMessage,children:q("session.missing")}),u.jsx("button",{type:"button",className:Nt.missingSessionButton,disabled:Ti,onClick:jq,children:q("session.new")})]}),u.jsx("div",{className:t7?Nt.chatSubtreeHidden:Nt.chatSubtree,children:u.jsxs(bT,{value:qt,children:[u.jsx(Zd.Provider,{value:_g,children:u.jsx(LPe,{timeline:se,details:Le,children:u.jsxs("div",{className:[Nt.content,pn||_n.length>0||Kt?Nt.contentHasMessages:void 0].filter(Boolean).join(" "),children:[u.jsx(DP,{ref:Ps,messages:_n,pendingApproval:mt,onShowContextDetail:Nq,loadingTranscript:ne.loadingTranscript,catchingUp:ne.catchingUp,isResponding:Q!=="idle",activeTurnStartedAt:bn,workspaceCwd:ne.workspaceCwd||"",hideSessionTimeline:Yw==="wide",showRetryHint:hs,onRetryClick:Gw,onBranchSession:Iq,welcomeHeader:Rl?Yq:void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:qq,virtualScrollThreshold:j}),(Wt==null?void 0:Wt.role)==="btw"&&u.jsx("div",{className:Nt.btwPanel,children:u.jsx(CP,{question:Wt.question,answer:Wt.answer,isPending:Wt.isPending})})]})})}),u.jsxs("div",{ref:yr,className:Nt.footer,children:[ma&&u.jsx("div",{className:pn?`${Nt.scrollToBottomLayer} ${Nt.scrollToBottomLayerWithTodos}`:Nt.scrollToBottomLayer,children:u.jsx("button",{type:"button",className:Nt.scrollToBottomButton,"aria-label":q("chat.scrollToBottom"),onClick:()=>rr("smooth"),children:u.jsx("svg",{className:Nt.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),pn&&u.jsx("div",{className:Nt.bottomPanels,children:u.jsx(O6e,{todos:wt})}),mt&&Js==="chat"&&u.jsx("div",{ref:Nw,tabIndex:-1,"data-testid":"approval-overlay",className:Nt.approvalOverlay,children:u.jsx(PF,{request:mt,onConfirm:X8,variant:"floating"})}),Te&&Js==="chat"&&u.jsx("div",{ref:Nw,tabIndex:-1,"data-testid":"approval-overlay",className:Nt.approvalOverlay,children:u.jsx($F,{request:Te,onConfirm:X8,variant:"floating"})}),u.jsxs("div",{className:Nt.composer,children:[u.jsx(yF,{startedAt:bn}),mq&&Q==="idle"&&u.jsx("div",{className:Nt.escClearStatus,role:"status",children:q("editor.escClearHint")}),u.jsx(_Be,{prompts:vq,t:q,onDelete:xq,onInsert:_q,onEdit:kq}),u.jsx(gF,{ref:pa,onSubmit:$q,onCycleMode:Hw,onToggleShortcuts:$8,onCancel:Ww,isRunning:Q!=="idle",isPreparing:Pw,cancelArmed:pq,disabled:Uq,commands:Z8,skills:Xs,slashCommandCategoryOrder:f,atProviders:m,composerTagIcons:p,queuedMessages:wq,onFocusFooter:zq,onPopQueuedMessages:Sq,onClearQueuedMessages:Tq,currentMode:Ba,currentModel:mh,chatWidthMode:be,showChatWidthToggle:!Rl,chatWidthToggleMin:Qq,visibleToolbarActions:I,availableModels:yq,onSelectMode:Yu,onSelectModel:Kw,onChatWidthModeChange:n7,sessionName:gq,dialogOpen:Il||mn,followupState:Bo,onAcceptFollowup:Ml,onDismissFollowup:Gi,composerInput:C,composerInputVersion:z,placeholderText:q(jPe({catchingUp:!!ne.catchingUp,isPreparingPrompt:Pw,isStreaming:Q!=="idle"}))})]}),Ye?u.jsx(Ye,{connected:In,mode:Ba,model:mh,streamingState:Q,contextUsageRatio:(ne.contextWindow??0)>0?(ne.tokenCount??0)/(ne.contextWindow??0):0,activeGoal:li,tasks:Bs,availableModes:V1,availableModels:(ne.models??[]).filter(Yk).map(D=>({id:D.id,label:Dp(D.label||D.id),contextWindow:D.contextWindow})),skills:Xs,onSelectMode:Yu,onSelectModel:Kw}):u.jsx(e6e,{onSelectMode:()=>pt(D=>!D),onSelectModel:()=>$n(D=>D?null:"main"),onShowContext:()=>xm("/context",!1),onOpenSettings:()=>La("settings"),ref:Dt,onOpenTasks:()=>Vw(),onReturnToInput:Fq,tasks:Ys,activeGoal:li,hideSettings:Pq,onToggleShortcuts:$8,compact:!0}),Rl&&e7&&u.jsx("div",{className:Nt.emptyWelcomeFooter,children:e7})]})]})})]})]})]})]})})})}const tI={en:{title:"Something went wrong",body:"An unexpected error occurred and this content could not be displayed.",retry:"Try again"},"zh-CN":{title:"出了点问题",body:"发生意外错误，无法显示此内容。",retry:"重试"}},u$e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},d$e={margin:0,fontSize:"1rem",fontWeight:600},h$e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},f$e={appearance:"none",cursor:"pointer",padding:"0.4rem 1rem",fontSize:"0.85rem",borderRadius:"6px",border:"1px solid rgba(128, 128, 128, 0.4)",background:"transparent",color:"inherit"};function m$e({error:e,onRetry:t,language:n="en"}){const s=tI[n]??tI.en;return u.jsxs("div",{role:"alert",style:u$e,"data-web-shell-error":!0,children:[u.jsx("p",{style:d$e,children:s.title}),u.jsx("p",{style:h$e,children:s.body}),!1,u.jsx("button",{type:"button",style:f$e,onClick:t,children:s.retry})]})}const p$e=qAe(),sq="qwen-code-web-shell-language",rq="qwen-code-web-shell-theme";function iq(e){if(e===yi.Dark||e===yi.Light)return e}function g$e(){const e=new URLSearchParams(window.location.search).get("theme");return iq(e)}function y$e(){try{return iq(window.localStorage.getItem(rq))}catch{return}}function b$e(e){try{window.localStorage.setItem(rq,e)}catch{}}function v$e(){return g$e()??y$e()??yi.Dark}function w$e(){try{const e=window.localStorage.getItem(sq);return e?bu(e):void 0}catch{return}}function x$e(e){try{window.localStorage.setItem(sq,e)}catch{}}function _$e(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return bu(t||(w$e()??navigator.language))}function k$e(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function S$e(e){const t=new URL(window.location.href);t.pathname=e?`/session/${encodeURIComponent(e)}`:"/",t.searchParams.delete("theme"),t.searchParams.delete("language"),t.searchParams.delete("lang"),t.searchParams.delete("token"),t.searchParams.delete("daemon"),window.history.replaceState(null,"",t)}function T$e({daemonToken:e}){const[t,n]=g.useState(()=>v$e()),[s,r]=g.useState(()=>_$e()),[i]=g.useState(()=>k$e()),o=p$e||window.location.origin;g.useEffect(()=>{const d=document.documentElement;d.classList.remove("theme-dark","theme-light"),d.classList.add(`theme-${t}`);const h=document.querySelector('meta[name="theme-color"]');h&&h.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const a=g.useCallback(d=>{n(d),b$e(d)},[]),l=g.useCallback(d=>{r(d),x$e(d)},[]),c=g.useCallback(d=>{S$e(d)},[]);return u.jsx(mc,{label:"web-shell-root",fallback:(d,h)=>u.jsx(m$e,{error:d,onRetry:h,language:s}),children:u.jsx(SK,{baseUrl:o,token:e,children:u.jsx(LL,{sessionId:i,suppressOwnUserEcho:!0,children:u.jsx(c$e,{theme:t,onThemeChange:a,language:s,onLanguageChange:l,onSessionIdChange:c,sidebar:!0,compactThinking:!0})},i??"new")})})}async function C$e(){const e=MF()??await VAe();WAe(),JV.createRoot(document.getElementById("root")).render(u.jsx(vH.StrictMode,{children:u.jsx(T$e,{daemonToken:e})}))}C$e();export{K as _,My as c,lv as g,I$e as k};
