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 BB=Object.defineProperty;var $B=(e,t,n)=>t in e?BB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>$B(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Ag=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function J1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var KC={exports:{}},Z1={};/**
 * @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 zB=Symbol.for("react.transitional.element"),PB=Symbol.for("react.fragment");function YC(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var s in t)s!=="key"&&(n[s]=t[s])}else n=t;return t=n.ref,{$$typeof:zB,type:e,key:r,ref:t!==void 0?t:null,props:n}}Z1.Fragment=PB;Z1.jsx=YC;Z1.jsxs=YC;KC.exports=Z1;var h=KC.exports,XC={exports:{}},Ot={};/**
 * @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 l3=Symbol.for("react.transitional.element"),qB=Symbol.for("react.portal"),FB=Symbol.for("react.fragment"),UB=Symbol.for("react.strict_mode"),HB=Symbol.for("react.profiler"),VB=Symbol.for("react.consumer"),WB=Symbol.for("react.context"),GB=Symbol.for("react.forward_ref"),KB=Symbol.for("react.suspense"),YB=Symbol.for("react.memo"),QC=Symbol.for("react.lazy"),XB=Symbol.for("react.activity"),q6=Symbol.iterator;function QB(e){return e===null||typeof e!="object"?null:(e=q6&&e[q6]||e["@@iterator"],typeof e=="function"?e:null)}var JC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ZC=Object.assign,eA={};function ph(e,t,n){this.props=e,this.context=t,this.refs=eA,this.updater=n||JC}ph.prototype.isReactComponent={};ph.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")};ph.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function tA(){}tA.prototype=ph.prototype;function c3(e,t,n){this.props=e,this.context=t,this.refs=eA,this.updater=n||JC}var u3=c3.prototype=new tA;u3.constructor=c3;ZC(u3,ph.prototype);u3.isPureReactComponent=!0;var F6=Array.isArray;function ox(){}var Wn={H:null,A:null,T:null,S:null},nA=Object.prototype.hasOwnProperty;function d3(e,t,n){var r=n.ref;return{$$typeof:l3,type:e,key:t,ref:r!==void 0?r:null,props:n}}function JB(e,t){return d3(e.type,t,e.props)}function h3(e){return typeof e=="object"&&e!==null&&e.$$typeof===l3}function ZB(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var U6=/\/+/g;function Ib(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ZB(""+e.key):t.toString(36)}function e$(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ox,ox):(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 rd(e,t,n,r,s){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 l3:case qB:o=!0;break;case QC:return o=e._init,rd(o(e._payload),t,n,r,s)}}if(o)return s=s(e),o=r===""?"."+Ib(e,0):r,F6(s)?(n="",o!=null&&(n=o.replace(U6,"$&/")+"/"),rd(s,t,n,"",function(c){return c})):s!=null&&(h3(s)&&(s=JB(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(U6,"$&/")+"/")+o)),t.push(s)),1;o=0;var a=r===""?".":r+":";if(F6(e))for(var l=0;l<e.length;l++)r=e[l],i=a+Ib(r,l),o+=rd(r,t,n,i,s);else if(l=QB(e),typeof l=="function")for(e=l.call(e),l=0;!(r=e.next()).done;)r=r.value,i=a+Ib(r,l++),o+=rd(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return rd(e$(e),t,n,r,s);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 Om(e,t,n){if(e==null)return e;var r=[],s=0;return rd(e,r,"","",function(i){return t.call(n,i,s++)}),r}function t$(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 H6=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)},n$={map:Om,forEach:function(e,t,n){Om(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Om(e,function(){t++}),t},toArray:function(e){return Om(e,function(t){return t})||[]},only:function(e){if(!h3(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ot.Activity=XB;Ot.Children=n$;Ot.Component=ph;Ot.Fragment=FB;Ot.Profiler=HB;Ot.PureComponent=c3;Ot.StrictMode=UB;Ot.Suspense=KB;Ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Wn;Ot.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Wn.H.useMemoCache(e)}};Ot.cache=function(e){return function(){return e.apply(null,arguments)}};Ot.cacheSignal=function(){return null};Ot.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=ZC({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!nA.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(r[i]=t[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var o=Array(i),a=0;a<i;a++)o[a]=arguments[a+2];r.children=o}return d3(e.type,s,r)};Ot.createContext=function(e){return e={$$typeof:WB,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:VB,_context:e},e};Ot.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)nA.call(t,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1<o){for(var a=Array(o),l=0;l<o;l++)a[l]=arguments[l+2];s.children=a}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)s[r]===void 0&&(s[r]=o[r]);return d3(e,i,s)};Ot.createRef=function(){return{current:null}};Ot.forwardRef=function(e){return{$$typeof:GB,render:e}};Ot.isValidElement=h3;Ot.lazy=function(e){return{$$typeof:QC,_payload:{_status:-1,_result:e},_init:t$}};Ot.memo=function(e,t){return{$$typeof:YB,type:e,compare:t===void 0?null:t}};Ot.startTransition=function(e){var t=Wn.T,n={};Wn.T=n;try{var r=e(),s=Wn.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(ox,H6)}catch(i){H6(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Wn.T=t}};Ot.unstable_useCacheRefresh=function(){return Wn.H.useCacheRefresh()};Ot.use=function(e){return Wn.H.use(e)};Ot.useActionState=function(e,t,n){return Wn.H.useActionState(e,t,n)};Ot.useCallback=function(e,t){return Wn.H.useCallback(e,t)};Ot.useContext=function(e){return Wn.H.useContext(e)};Ot.useDebugValue=function(){};Ot.useDeferredValue=function(e,t){return Wn.H.useDeferredValue(e,t)};Ot.useEffect=function(e,t){return Wn.H.useEffect(e,t)};Ot.useEffectEvent=function(e){return Wn.H.useEffectEvent(e)};Ot.useId=function(){return Wn.H.useId()};Ot.useImperativeHandle=function(e,t,n){return Wn.H.useImperativeHandle(e,t,n)};Ot.useInsertionEffect=function(e,t){return Wn.H.useInsertionEffect(e,t)};Ot.useLayoutEffect=function(e,t){return Wn.H.useLayoutEffect(e,t)};Ot.useMemo=function(e,t){return Wn.H.useMemo(e,t)};Ot.useOptimistic=function(e,t){return Wn.H.useOptimistic(e,t)};Ot.useReducer=function(e,t,n){return Wn.H.useReducer(e,t,n)};Ot.useRef=function(e){return Wn.H.useRef(e)};Ot.useState=function(e){return Wn.H.useState(e)};Ot.useSyncExternalStore=function(e,t,n){return Wn.H.useSyncExternalStore(e,t,n)};Ot.useTransition=function(){return Wn.H.useTransition()};Ot.version="19.2.4";XC.exports=Ot;var g=XC.exports;const r$=J1(g);var rA={exports:{}},ey={},sA={exports:{}},iA={};/**
 * @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(P,V){var X=P.length;P.push(V);e:for(;0<X;){var te=X-1>>>1,D=P[te];if(0<s(D,V))P[te]=V,P[X]=D,X=te;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var V=P[0],X=P.pop();if(X!==V){P[0]=X;e:for(var te=0,D=P.length,j=D>>>1;te<j;){var B=2*(te+1)-1,I=P[B],ne=B+1,de=P[ne];if(0>s(I,X))ne<D&&0>s(de,I)?(P[te]=de,P[ne]=X,te=ne):(P[te]=I,P[B]=X,te=B);else if(ne<D&&0>s(de,X))P[te]=de,P[ne]=X,te=ne;else break e}}return V}function s(P,V){var X=P.sortIndex-V.sortIndex;return X!==0?X:P.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=[],u=1,d=null,f=3,m=!1,p=!1,y=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function k(P){for(var V=n(c);V!==null;){if(V.callback===null)r(c);else if(V.startTime<=P)r(c),V.sortIndex=V.expirationTime,t(l,V);else break;V=n(c)}}function T(P){if(y=!1,k(P),!p)if(n(l)!==null)p=!0,C||(C=!0,M());else{var V=n(c);V!==null&&J(T,V.startTime-P)}}var C=!1,A=-1,L=5,$=-1;function E(){return v?!0:!(e.unstable_now()-$<L)}function z(){if(v=!1,C){var P=e.unstable_now();$=P;var V=!0;try{e:{p=!1,y&&(y=!1,x(A),A=-1),m=!0;var X=f;try{t:{for(k(P),d=n(l);d!==null&&!(d.expirationTime>P&&E());){var te=d.callback;if(typeof te=="function"){d.callback=null,f=d.priorityLevel;var D=te(d.expirationTime<=P);if(P=e.unstable_now(),typeof D=="function"){d.callback=D,k(P),V=!0;break t}d===n(l)&&r(l),k(P)}else r(l);d=n(l)}if(d!==null)V=!0;else{var j=n(c);j!==null&&J(T,j.startTime-P),V=!1}}break e}finally{d=null,f=X,m=!1}V=void 0}}finally{V?M():C=!1}}}var M;if(typeof w=="function")M=function(){w(z)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,K=U.port2;U.port1.onmessage=z,M=function(){K.postMessage(null)}}else M=function(){b(z,0)};function J(P,V){A=b(function(){P(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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(P){switch(f){case 1:case 2:case 3:var V=3;break;default:V=f}var X=f;f=V;try{return P()}finally{f=X}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(P,V){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var X=f;f=P;try{return V()}finally{f=X}},e.unstable_scheduleCallback=function(P,V,X){var te=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?te+X:te):X=te,P){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=X+D,P={id:u++,callback:V,priorityLevel:P,startTime:X,expirationTime:D,sortIndex:-1},X>te?(P.sortIndex=X,t(c,P),n(l)===null&&P===n(c)&&(y?(x(A),A=-1):y=!0,J(T,X-te))):(P.sortIndex=D,t(l,P),p||m||(p=!0,C||(C=!0,M()))),P},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(P){var V=f;return function(){var X=f;f=V;try{return P.apply(this,arguments)}finally{f=X}}}})(iA);sA.exports=iA;var s$=sA.exports,oA={exports:{}},Ls={};/**
 * @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 i$=g;function aA(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 dl(){}var Ns={d:{f:dl,r:function(){throw Error(aA(522))},D:dl,C:dl,L:dl,m:dl,X:dl,S:dl,M:dl},p:0,findDOMNode:null},o$=Symbol.for("react.portal");function a$(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o$,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var Lf=i$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function ty(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Ls.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ns;Ls.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(aA(299));return a$(e,t,null,n)};Ls.flushSync=function(e){var t=Lf.T,n=Ns.p;try{if(Lf.T=null,Ns.p=2,e)return e()}finally{Lf.T=t,Ns.p=n,Ns.d.f()}};Ls.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Ns.d.C(e,t))};Ls.prefetchDNS=function(e){typeof e=="string"&&Ns.d.D(e)};Ls.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=ty(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Ns.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&Ns.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Ls.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=ty(t.as,t.crossOrigin);Ns.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&&Ns.d.M(e)};Ls.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=ty(n,t.crossOrigin);Ns.d.L(e,n,{crossOrigin:r,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})}};Ls.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=ty(t.as,t.crossOrigin);Ns.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 Ns.d.m(e)};Ls.requestFormReset=function(e){Ns.d.r(e)};Ls.unstable_batchedUpdates=function(e,t){return e(t)};Ls.useFormState=function(e,t,n){return Lf.H.useFormState(e,t,n)};Ls.useFormStatus=function(){return Lf.H.useHostTransitionStatus()};Ls.version="19.2.4";function lA(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lA)}catch(e){console.error(e)}}lA(),oA.exports=Ls;var ny=oA.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=s$,cA=g,l$=ny;function pe(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 uA(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function K0(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 dA(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 hA(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 V6(e){if(K0(e)!==e)throw Error(pe(188))}function c$(e){var t=e.alternate;if(!t){if(t=K0(e),t===null)throw Error(pe(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return V6(s),e;if(i===r)return V6(s),t;i=i.sibling}throw Error(pe(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o){for(a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o)throw Error(pe(189))}}if(n.alternate!==r)throw Error(pe(190))}if(n.tag!==3)throw Error(pe(188));return n.stateNode.current===n?e:t}function fA(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=fA(e),t!==null)return t;e=e.sibling}return null}var Kn=Object.assign,u$=Symbol.for("react.element"),Bm=Symbol.for("react.transitional.element"),bf=Symbol.for("react.portal"),ud=Symbol.for("react.fragment"),mA=Symbol.for("react.strict_mode"),ax=Symbol.for("react.profiler"),pA=Symbol.for("react.consumer"),Ma=Symbol.for("react.context"),f3=Symbol.for("react.forward_ref"),lx=Symbol.for("react.suspense"),cx=Symbol.for("react.suspense_list"),m3=Symbol.for("react.memo"),bl=Symbol.for("react.lazy"),ux=Symbol.for("react.activity"),d$=Symbol.for("react.memo_cache_sentinel"),W6=Symbol.iterator;function Gh(e){return e===null||typeof e!="object"?null:(e=W6&&e[W6]||e["@@iterator"],typeof e=="function"?e:null)}var h$=Symbol.for("react.client.reference");function dx(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===h$?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ud:return"Fragment";case ax:return"Profiler";case mA:return"StrictMode";case lx:return"Suspense";case cx:return"SuspenseList";case ux:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case bf:return"Portal";case Ma:return e.displayName||"Context";case pA:return(e._context.displayName||"Context")+".Consumer";case f3:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case m3:return t=e.displayName||null,t!==null?t:dx(e.type)||"Memo";case bl:t=e._payload,e=e._init;try{return dx(e(t))}catch{}}return null}var xf=Array.isArray,Mt=cA.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xn=l$.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,lu={pending:!1,data:null,method:null,action:null},hx=[],dd=-1;function Xo(e){return{current:e}}function Gr(e){0>dd||(e.current=hx[dd],hx[dd]=null,dd--)}function Fn(e,t){dd++,hx[dd]=e.current,e.current=t}var Go=Xo(null),d0=Xo(null),Pl=Xo(null),Eg=Xo(null);function Mg(e,t){switch(Fn(Pl,t),Fn(d0,e),Fn(Go,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?J8(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=J8(t),e=DM(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Gr(Go),Fn(Go,e)}function Ud(){Gr(Go),Gr(d0),Gr(Pl)}function fx(e){e.memoizedState!==null&&Fn(Eg,e);var t=Go.current,n=DM(t,e.type);t!==n&&(Fn(d0,e),Fn(Go,n))}function Ng(e){d0.current===e&&(Gr(Go),Gr(d0)),Eg.current===e&&(Gr(Eg),_0._currentValue=lu)}var Rb,G6;function Hc(e){if(Rb===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rb=t&&t[1]||"",G6=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Rb+e+G6}var jb=!1;function Lb(e,t){if(!e||jb)return"";jb=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(m){var f=m}Reflect.construct(e,[],d)}else{try{d.call()}catch(m){f=m}e.call(d.prototype)}}else{try{throw Error()}catch(m){f=m}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&f&&typeof m.stack=="string")return[m.stack,f.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],a=i[1];if(o&&a){var l=o.split(`
`),c=a.split(`
`);for(s=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;s<c.length&&!c[s].includes("DetermineComponentFrameRoot");)s++;if(r===l.length||s===c.length)for(r=l.length-1,s=c.length-1;1<=r&&0<=s&&l[r]!==c[s];)s--;for(;1<=r&&0<=s;r--,s--)if(l[r]!==c[s]){if(r!==1||s!==1)do if(r--,s--,0>s||l[r]!==c[s]){var u=`
`+l[r].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=r&&0<=s);break}}}finally{jb=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Hc(n):""}function f$(e,t){switch(e.tag){case 26:case 27:case 5:return Hc(e.type);case 16:return Hc("Lazy");case 13:return e.child!==t&&t!==null?Hc("Suspense Fallback"):Hc("Suspense");case 19:return Hc("SuspenseList");case 0:case 15:return Lb(e.type,!1);case 11:return Lb(e.type.render,!1);case 1:return Lb(e.type,!0);case 31:return Hc("Activity");default:return""}}function K6(e){try{var t="",n=null;do t+=f$(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var mx=Object.prototype.hasOwnProperty,p3=Br.unstable_scheduleCallback,Db=Br.unstable_cancelCallback,m$=Br.unstable_shouldYield,p$=Br.unstable_requestPaint,mi=Br.unstable_now,g$=Br.unstable_getCurrentPriorityLevel,gA=Br.unstable_ImmediatePriority,yA=Br.unstable_UserBlockingPriority,Ig=Br.unstable_NormalPriority,y$=Br.unstable_LowPriority,bA=Br.unstable_IdlePriority,b$=Br.log,x$=Br.unstable_setDisableYieldValue,Y0=null,pi=null;function Nl(e){if(typeof b$=="function"&&x$(e),pi&&typeof pi.setStrictMode=="function")try{pi.setStrictMode(Y0,e)}catch{}}var gi=Math.clz32?Math.clz32:_$,w$=Math.log,v$=Math.LN2;function _$(e){return e>>>=0,e===0?32:31-(w$(e)/v$|0)|0}var $m=256,zm=262144,Pm=4194304;function Vc(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 ry(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var a=r&134217727;return a!==0?(r=a&~i,r!==0?s=Vc(r):(o&=a,o!==0?s=Vc(o):n||(n=a&~e,n!==0&&(s=Vc(n))))):(a=r&~i,a!==0?s=Vc(a):o!==0?s=Vc(o):n||(n=r&~e,n!==0&&(s=Vc(n)))),s===0?0:t!==0&&t!==s&&!(t&i)&&(i=s&-s,n=t&-t,i>=n||i===32&&(n&4194048)!==0)?t:s}function X0(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function k$(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 xA(){var e=Pm;return Pm<<=1,!(Pm&62914560)&&(Pm=4194304),e}function Ob(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Q0(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function S$(e,t,n,r,s,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 u=31-gi(n),d=1<<u;a[u]=0,l[u]=-1;var f=c[u];if(f!==null)for(c[u]=null,u=0;u<f.length;u++){var m=f[u];m!==null&&(m.lane&=-536870913)}n&=~d}r!==0&&wA(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function wA(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-gi(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function vA(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-gi(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}function _A(e,t){var n=t&-t;return n=n&42?1:g3(n),n&(e.suspendedLanes|t)?0:n}function g3(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 y3(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function kA(){var e=xn.p;return e!==0?e:(e=window.event,e===void 0?32:WM(e.type))}function Y6(e,t){var n=xn.p;try{return xn.p=e,t()}finally{xn.p=n}}var mc=Math.random().toString(36).slice(2),ts="__reactFiber$"+mc,Xs="__reactProps$"+mc,gh="__reactContainer$"+mc,px="__reactEvents$"+mc,T$="__reactListeners$"+mc,C$="__reactHandles$"+mc,X6="__reactResources$"+mc,J0="__reactMarker$"+mc;function b3(e){delete e[ts],delete e[Xs],delete e[px],delete e[T$],delete e[C$]}function hd(e){var t=e[ts];if(t)return t;for(var n=e.parentNode;n;){if(t=n[gh]||n[ts]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=rk(e);e!==null;){if(n=e[ts])return n;e=rk(e)}return t}e=n,n=e.parentNode}return null}function yh(e){if(e=e[ts]||e[gh]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wf(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(pe(33))}function Ed(e){var t=e[X6];return t||(t=e[X6]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Vr(e){e[J0]=!0}var SA=new Set,TA={};function Iu(e,t){Hd(e,t),Hd(e+"Capture",t)}function Hd(e,t){for(TA[e]=t,e=0;e<t.length;e++)SA.add(t[e])}var A$=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]*$"),Q6={},J6={};function E$(e){return mx.call(J6,e)?!0:mx.call(Q6,e)?!1:A$.test(e)?J6[e]=!0:(Q6[e]=!0,!1)}function Vp(e,t,n){if(E$(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function qm(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 fa(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+r)}}function Li(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function CA(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function M$(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gx(e){if(!e._valueTracker){var t=CA(e)?"checked":"value";e._valueTracker=M$(e,t,""+e[t])}}function AA(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=CA(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Rg(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 N$=/[\n"\\]/g;function Pi(e){return e.replace(N$,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function yx(e,t,n,r,s,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=""+Li(t)):e.value!==""+Li(t)&&(e.value=""+Li(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?bx(e,o,Li(t)):n!=null?bx(e,o,Li(n)):r!=null&&e.removeAttribute("value"),s==null&&i!=null&&(e.defaultChecked=!!i),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+Li(a):e.removeAttribute("name")}function EA(e,t,n,r,s,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)){gx(e);return}n=n!=null?""+Li(n):"",t=t!=null?""+Li(t):n,a||t===e.value||(e.value=t),e.defaultValue=t}r=r??s,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=a?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),gx(e)}function bx(e,t,n){t==="number"&&Rg(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Md(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Li(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function MA(e,t,n){if(t!=null&&(t=""+Li(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Li(n):""}function NA(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(pe(92));if(xf(r)){if(1<r.length)throw Error(pe(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Li(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),gx(e)}function Vd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var I$=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 Z6(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!="number"||n===0||I$.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function IA(e,t,n){if(t!=null&&typeof t!="object")throw Error(pe(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var s in t)r=t[s],t.hasOwnProperty(s)&&n[s]!==r&&Z6(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&Z6(e,i,t[i])}function x3(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 R$=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"]]),j$=/^[\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 Wp(e){return j$.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Na(){}var xx=null;function w3(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fd=null,Nd=null;function e8(e){var t=yh(e);if(t&&(e=t.stateNode)){var n=e[Xs]||null;e:switch(e=t.stateNode,t.type){case"input":if(yx(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="'+Pi(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[Xs]||null;if(!s)throw Error(pe(90));yx(r,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&AA(r)}break e;case"textarea":MA(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Md(e,!!n.multiple,t,!1)}}}var Bb=!1;function RA(e,t,n){if(Bb)return e(t,n);Bb=!0;try{var r=e(t);return r}finally{if(Bb=!1,(fd!==null||Nd!==null)&&(py(),fd&&(t=fd,e=Nd,Nd=fd=null,e8(t),e)))for(t=0;t<e.length;t++)e8(e[t])}}function h0(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Xs]||null;if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(pe(231,t,typeof n));return n}var qa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wx=!1;if(qa)try{var Kh={};Object.defineProperty(Kh,"passive",{get:function(){wx=!0}}),window.addEventListener("test",Kh,Kh),window.removeEventListener("test",Kh,Kh)}catch{wx=!1}var Il=null,v3=null,Gp=null;function jA(){if(Gp)return Gp;var e,t=v3,n=t.length,r,s="value"in Il?Il.value:Il.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===s[i-r];r++);return Gp=s.slice(e,1<r?1-r:void 0)}function Kp(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 Fm(){return!0}function t8(){return!1}function Zs(e){function t(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,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)?Fm:t8,this.isPropagationStopped=t8,this}return Kn(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=Fm)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Fm)},persist:function(){},isPersistent:Fm}),t}var Ru={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sy=Zs(Ru),Z0=Kn({},Ru,{view:0,detail:0}),L$=Zs(Z0),$b,zb,Yh,iy=Kn({},Z0,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_3,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!==Yh&&(Yh&&e.type==="mousemove"?($b=e.screenX-Yh.screenX,zb=e.screenY-Yh.screenY):zb=$b=0,Yh=e),$b)},movementY:function(e){return"movementY"in e?e.movementY:zb}}),n8=Zs(iy),D$=Kn({},iy,{dataTransfer:0}),O$=Zs(D$),B$=Kn({},Z0,{relatedTarget:0}),Pb=Zs(B$),$$=Kn({},Ru,{animationName:0,elapsedTime:0,pseudoElement:0}),z$=Zs($$),P$=Kn({},Ru,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),q$=Zs(P$),F$=Kn({},Ru,{data:0}),r8=Zs(F$),U$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},H$={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"},V$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function W$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=V$[e])?!!t[e]:!1}function _3(){return W$}var G$=Kn({},Z0,{key:function(e){if(e.key){var t=U$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Kp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?H$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_3,charCode:function(e){return e.type==="keypress"?Kp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Kp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),K$=Zs(G$),Y$=Kn({},iy,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),s8=Zs(Y$),X$=Kn({},Z0,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_3}),Q$=Zs(X$),J$=Kn({},Ru,{propertyName:0,elapsedTime:0,pseudoElement:0}),Z$=Zs(J$),ez=Kn({},iy,{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}),tz=Zs(ez),nz=Kn({},Ru,{newState:0,oldState:0}),rz=Zs(nz),sz=[9,13,27,32],k3=qa&&"CompositionEvent"in window,Df=null;qa&&"documentMode"in document&&(Df=document.documentMode);var iz=qa&&"TextEvent"in window&&!Df,LA=qa&&(!k3||Df&&8<Df&&11>=Df),i8=" ",o8=!1;function DA(e,t){switch(e){case"keyup":return sz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function OA(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var md=!1;function oz(e,t){switch(e){case"compositionend":return OA(t);case"keypress":return t.which!==32?null:(o8=!0,i8);case"textInput":return e=t.data,e===i8&&o8?null:e;default:return null}}function az(e,t){if(md)return e==="compositionend"||!k3&&DA(e,t)?(e=jA(),Gp=v3=Il=null,md=!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 LA&&t.locale!=="ko"?null:t.data;default:return null}}var lz={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 a8(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!lz[e.type]:t==="textarea"}function BA(e,t,n,r){fd?Nd?Nd.push(r):Nd=[r]:fd=r,t=Xg(t,"onChange"),0<t.length&&(n=new sy("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Of=null,f0=null;function cz(e){RM(e,0)}function oy(e){var t=wf(e);if(AA(t))return e}function l8(e,t){if(e==="change")return t}var $A=!1;if(qa){var qb;if(qa){var Fb="oninput"in document;if(!Fb){var c8=document.createElement("div");c8.setAttribute("oninput","return;"),Fb=typeof c8.oninput=="function"}qb=Fb}else qb=!1;$A=qb&&(!document.documentMode||9<document.documentMode)}function u8(){Of&&(Of.detachEvent("onpropertychange",zA),f0=Of=null)}function zA(e){if(e.propertyName==="value"&&oy(f0)){var t=[];BA(t,f0,e,w3(e)),RA(cz,t)}}function uz(e,t,n){e==="focusin"?(u8(),Of=t,f0=n,Of.attachEvent("onpropertychange",zA)):e==="focusout"&&u8()}function dz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oy(f0)}function hz(e,t){if(e==="click")return oy(t)}function fz(e,t){if(e==="input"||e==="change")return oy(t)}function mz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wi=typeof Object.is=="function"?Object.is:mz;function m0(e,t){if(wi(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!mx.call(t,s)||!wi(e[s],t[s]))return!1}return!0}function d8(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function h8(e,t){var n=d8(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=d8(n)}}function PA(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?PA(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qA(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rg(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=Rg(e.document)}return t}function S3(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 pz=qa&&"documentMode"in document&&11>=document.documentMode,pd=null,vx=null,Bf=null,_x=!1;function f8(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_x||pd==null||pd!==Rg(r)||(r=pd,"selectionStart"in r&&S3(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Bf&&m0(Bf,r)||(Bf=r,r=Xg(vx,"onSelect"),0<r.length&&(t=new sy("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=pd)))}function Dc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var gd={animationend:Dc("Animation","AnimationEnd"),animationiteration:Dc("Animation","AnimationIteration"),animationstart:Dc("Animation","AnimationStart"),transitionrun:Dc("Transition","TransitionRun"),transitionstart:Dc("Transition","TransitionStart"),transitioncancel:Dc("Transition","TransitionCancel"),transitionend:Dc("Transition","TransitionEnd")},Ub={},FA={};qa&&(FA=document.createElement("div").style,"AnimationEvent"in window||(delete gd.animationend.animation,delete gd.animationiteration.animation,delete gd.animationstart.animation),"TransitionEvent"in window||delete gd.transitionend.transition);function ju(e){if(Ub[e])return Ub[e];if(!gd[e])return e;var t=gd[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in FA)return Ub[e]=t[n];return e}var UA=ju("animationend"),HA=ju("animationiteration"),VA=ju("animationstart"),gz=ju("transitionrun"),yz=ju("transitionstart"),bz=ju("transitioncancel"),WA=ju("transitionend"),GA=new Map,kx="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(" ");kx.push("scrollEnd");function go(e,t){GA.set(e,t),Iu(t,[e])}var jg=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)},ji=[],yd=0,T3=0;function ay(){for(var e=yd,t=T3=yd=0;t<e;){var n=ji[t];ji[t++]=null;var r=ji[t];ji[t++]=null;var s=ji[t];ji[t++]=null;var i=ji[t];if(ji[t++]=null,r!==null&&s!==null){var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}i!==0&&KA(n,s,i)}}function ly(e,t,n,r){ji[yd++]=e,ji[yd++]=t,ji[yd++]=n,ji[yd++]=r,T3|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function C3(e,t,n,r){return ly(e,t,n,r),Lg(e)}function Lu(e,t){return ly(e,null,null,t),Lg(e)}function KA(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var s=!1,i=e.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(s=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,s&&t!==null&&(s=31-gi(n),e=i.hiddenUpdates,r=e[s],r===null?e[s]=[t]:r.push(t),t.lane=n|536870912),i):null}function Lg(e){if(50<Wf)throw Wf=0,Hx=null,Error(pe(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var bd={};function xz(e,t,n,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ui(e,t,n,r){return new xz(e,t,n,r)}function A3(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Da(e,t){var n=e.alternate;return n===null?(n=ui(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 YA(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 Yp(e,t,n,r,s,i){var o=0;if(r=e,typeof e=="function")A3(e)&&(o=1);else if(typeof e=="string")o=SP(e,n,Go.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ux:return e=ui(31,n,t,s),e.elementType=ux,e.lanes=i,e;case ud:return cu(n.children,s,i,t);case mA:o=8,s|=24;break;case ax:return e=ui(12,n,t,s|2),e.elementType=ax,e.lanes=i,e;case lx:return e=ui(13,n,t,s),e.elementType=lx,e.lanes=i,e;case cx:return e=ui(19,n,t,s),e.elementType=cx,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ma:o=10;break e;case pA:o=9;break e;case f3:o=11;break e;case m3:o=14;break e;case bl:o=16,r=null;break e}o=29,n=Error(pe(130,e===null?"null":typeof e,"")),r=null}return t=ui(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function cu(e,t,n,r){return e=ui(7,e,r,t),e.lanes=n,e}function Hb(e,t,n){return e=ui(6,e,null,t),e.lanes=n,e}function XA(e){var t=ui(18,null,null,0);return t.stateNode=e,t}function Vb(e,t,n){return t=ui(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var m8=new WeakMap;function qi(e,t){if(typeof e=="object"&&e!==null){var n=m8.get(e);return n!==void 0?n:(t={value:e,source:t,stack:K6(t)},m8.set(e,t),t)}return{value:e,source:t,stack:K6(t)}}var xd=[],wd=0,Dg=null,p0=0,Di=[],Oi=0,Zl=null,Po=1,qo="";function ka(e,t){xd[wd++]=p0,xd[wd++]=Dg,Dg=e,p0=t}function QA(e,t,n){Di[Oi++]=Po,Di[Oi++]=qo,Di[Oi++]=Zl,Zl=e;var r=Po;e=qo;var s=32-gi(r)-1;r&=~(1<<s),n+=1;var i=32-gi(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,Po=1<<32-gi(t)+s|n<<s|r,qo=i+e}else Po=1<<i|n<<s|r,qo=e}function E3(e){e.return!==null&&(ka(e,1),QA(e,1,0))}function M3(e){for(;e===Dg;)Dg=xd[--wd],xd[wd]=null,p0=xd[--wd],xd[wd]=null;for(;e===Zl;)Zl=Di[--Oi],Di[Oi]=null,qo=Di[--Oi],Di[Oi]=null,Po=Di[--Oi],Di[Oi]=null}function JA(e,t){Di[Oi++]=Po,Di[Oi++]=qo,Di[Oi++]=Zl,Po=t.id,qo=t.overflow,Zl=e}var ns=null,Vn=null,ln=!1,ql=null,Fi=!1,Sx=Error(pe(519));function ec(e){var t=Error(pe(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw g0(qi(t,e)),Sx}function p8(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ts]=e,t[Xs]=r,n){case"dialog":Xt("cancel",t),Xt("close",t);break;case"iframe":case"object":case"embed":Xt("load",t);break;case"video":case"audio":for(n=0;n<w0.length;n++)Xt(w0[n],t);break;case"source":Xt("error",t);break;case"img":case"image":case"link":Xt("error",t),Xt("load",t);break;case"details":Xt("toggle",t);break;case"input":Xt("invalid",t),EA(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Xt("invalid",t);break;case"textarea":Xt("invalid",t),NA(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||LM(t.textContent,n)?(r.popover!=null&&(Xt("beforetoggle",t),Xt("toggle",t)),r.onScroll!=null&&Xt("scroll",t),r.onScrollEnd!=null&&Xt("scrollend",t),r.onClick!=null&&(t.onclick=Na),t=!0):t=!1,t||ec(e,!0)}function g8(e){for(ns=e.return;ns;)switch(ns.tag){case 5:case 31:case 13:Fi=!1;return;case 27:case 3:Fi=!0;return;default:ns=ns.return}}function Xu(e){if(e!==ns)return!1;if(!ln)return g8(e),ln=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Yx(e.type,e.memoizedProps)),n=!n),n&&Vn&&ec(e),g8(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pe(317));Vn=nk(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pe(317));Vn=nk(e)}else t===27?(t=Vn,pc(e.type)?(e=Zx,Zx=null,Vn=e):Vn=t):Vn=ns?Ki(e.stateNode.nextSibling):null;return!0}function xu(){Vn=ns=null,ln=!1}function Wb(){var e=ql;return e!==null&&(Us===null?Us=e:Us.push.apply(Us,e),ql=null),e}function g0(e){ql===null?ql=[e]:ql.push(e)}var Tx=Xo(null),Du=null,Ia=null;function Sl(e,t,n){Fn(Tx,t._currentValue),t._currentValue=n}function Oa(e){e._currentValue=Tx.current,Gr(Tx)}function Cx(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ax(e,t,n,r){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var i=s.dependencies;if(i!==null){var o=s.child;i=i.firstContext;e:for(;i!==null;){var a=i;i=s;for(var l=0;l<t.length;l++)if(a.context===t[l]){i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Cx(i.return,n,e),r||(o=null);break e}i=a.next}}else if(s.tag===18){if(o=s.return,o===null)throw Error(pe(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),Cx(o,n,e),o=null}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}}function bh(e,t,n,r){e=null;for(var s=t,i=!1;s!==null;){if(!i){if(s.flags&524288)i=!0;else if(s.flags&262144)break}if(s.tag===10){var o=s.alternate;if(o===null)throw Error(pe(387));if(o=o.memoizedProps,o!==null){var a=s.type;wi(s.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(s===Eg.current){if(o=s.alternate,o===null)throw Error(pe(387));o.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(_0):e=[_0])}s=s.return}e!==null&&Ax(t,e,n,r),t.flags|=262144}function Og(e){for(e=e.firstContext;e!==null;){if(!wi(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function wu(e){Du=e,Ia=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rs(e){return ZA(Du,e)}function Um(e,t){return Du===null&&wu(e),ZA(e,t)}function ZA(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ia===null){if(e===null)throw Error(pe(308));Ia=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ia=Ia.next=t;return n}var wz=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},vz=Br.unstable_scheduleCallback,_z=Br.unstable_NormalPriority,Tr={$$typeof:Ma,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function N3(){return{controller:new wz,data:new Map,refCount:0}}function em(e){e.refCount--,e.refCount===0&&vz(_z,function(){e.controller.abort()})}var $f=null,Ex=0,Wd=0,Id=null;function kz(e,t){if($f===null){var n=$f=[];Ex=0,Wd=t5(),Id={status:"pending",value:void 0,then:function(r){n.push(r)}}}return Ex++,t.then(y8,y8),t}function y8(){if(--Ex===0&&$f!==null){Id!==null&&(Id.status="fulfilled");var e=$f;$f=null,Wd=0,Id=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Sz(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(r.status="rejected",r.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),r}var b8=Mt.S;Mt.S=function(e,t){fM=mi(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&kz(e,t),b8!==null&&b8(e,t)};var uu=Xo(null);function I3(){var e=uu.current;return e!==null?e:Dn.pooledCache}function Xp(e,t){t===null?Fn(uu,uu.current):Fn(uu,t.pool)}function eE(){var e=I3();return e===null?null:{parent:Tr._currentValue,pool:e}}var xh=Error(pe(460)),R3=Error(pe(474)),cy=Error(pe(542)),Bg={then:function(){}};function x8(e){return e=e.status,e==="fulfilled"||e==="rejected"}function tE(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Na,Na),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,v8(e),e;default:if(typeof t.status=="string")t.then(Na,Na);else{if(e=Dn,e!==null&&100<e.shellSuspendCounter)throw Error(pe(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=r}},function(r){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,v8(e),e}throw du=t,xh}}function Wc(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(du=n,xh):n}}var du=null;function w8(){if(du===null)throw Error(pe(459));var e=du;return du=null,e}function v8(e){if(e===xh||e===cy)throw Error(pe(483))}var Rd=null,y0=0;function Hm(e){var t=y0;return y0+=1,Rd===null&&(Rd=[]),tE(Rd,e,t)}function Xh(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Vm(e,t){throw t.$$typeof===u$?Error(pe(525)):(e=Object.prototype.toString.call(t),Error(pe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function nE(e){function t(b,x){if(e){var w=b.deletions;w===null?(b.deletions=[x],b.flags|=16):w.push(x)}}function n(b,x){if(!e)return null;for(;x!==null;)t(b,x),x=x.sibling;return null}function r(b){for(var x=new Map;b!==null;)b.key!==null?x.set(b.key,b):x.set(b.index,b),b=b.sibling;return x}function s(b,x){return b=Da(b,x),b.index=0,b.sibling=null,b}function i(b,x,w){return b.index=w,e?(w=b.alternate,w!==null?(w=w.index,w<x?(b.flags|=67108866,x):w):(b.flags|=67108866,x)):(b.flags|=1048576,x)}function o(b){return e&&b.alternate===null&&(b.flags|=67108866),b}function a(b,x,w,k){return x===null||x.tag!==6?(x=Hb(w,b.mode,k),x.return=b,x):(x=s(x,w),x.return=b,x)}function l(b,x,w,k){var T=w.type;return T===ud?u(b,x,w.props.children,k,w.key):x!==null&&(x.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===bl&&Wc(T)===x.type)?(x=s(x,w.props),Xh(x,w),x.return=b,x):(x=Yp(w.type,w.key,w.props,null,b.mode,k),Xh(x,w),x.return=b,x)}function c(b,x,w,k){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=Vb(w,b.mode,k),x.return=b,x):(x=s(x,w.children||[]),x.return=b,x)}function u(b,x,w,k,T){return x===null||x.tag!==7?(x=cu(w,b.mode,k,T),x.return=b,x):(x=s(x,w),x.return=b,x)}function d(b,x,w){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=Hb(""+x,b.mode,w),x.return=b,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Bm:return w=Yp(x.type,x.key,x.props,null,b.mode,w),Xh(w,x),w.return=b,w;case bf:return x=Vb(x,b.mode,w),x.return=b,x;case bl:return x=Wc(x),d(b,x,w)}if(xf(x)||Gh(x))return x=cu(x,b.mode,w,null),x.return=b,x;if(typeof x.then=="function")return d(b,Hm(x),w);if(x.$$typeof===Ma)return d(b,Um(b,x),w);Vm(b,x)}return null}function f(b,x,w,k){var T=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return T!==null?null:a(b,x,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Bm:return w.key===T?l(b,x,w,k):null;case bf:return w.key===T?c(b,x,w,k):null;case bl:return w=Wc(w),f(b,x,w,k)}if(xf(w)||Gh(w))return T!==null?null:u(b,x,w,k,null);if(typeof w.then=="function")return f(b,x,Hm(w),k);if(w.$$typeof===Ma)return f(b,x,Um(b,w),k);Vm(b,w)}return null}function m(b,x,w,k,T){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return b=b.get(w)||null,a(x,b,""+k,T);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Bm:return b=b.get(k.key===null?w:k.key)||null,l(x,b,k,T);case bf:return b=b.get(k.key===null?w:k.key)||null,c(x,b,k,T);case bl:return k=Wc(k),m(b,x,w,k,T)}if(xf(k)||Gh(k))return b=b.get(w)||null,u(x,b,k,T,null);if(typeof k.then=="function")return m(b,x,w,Hm(k),T);if(k.$$typeof===Ma)return m(b,x,w,Um(x,k),T);Vm(x,k)}return null}function p(b,x,w,k){for(var T=null,C=null,A=x,L=x=0,$=null;A!==null&&L<w.length;L++){A.index>L?($=A,A=null):$=A.sibling;var E=f(b,A,w[L],k);if(E===null){A===null&&(A=$);break}e&&A&&E.alternate===null&&t(b,A),x=i(E,x,L),C===null?T=E:C.sibling=E,C=E,A=$}if(L===w.length)return n(b,A),ln&&ka(b,L),T;if(A===null){for(;L<w.length;L++)A=d(b,w[L],k),A!==null&&(x=i(A,x,L),C===null?T=A:C.sibling=A,C=A);return ln&&ka(b,L),T}for(A=r(A);L<w.length;L++)$=m(A,b,L,w[L],k),$!==null&&(e&&$.alternate!==null&&A.delete($.key===null?L:$.key),x=i($,x,L),C===null?T=$:C.sibling=$,C=$);return e&&A.forEach(function(z){return t(b,z)}),ln&&ka(b,L),T}function y(b,x,w,k){if(w==null)throw Error(pe(151));for(var T=null,C=null,A=x,L=x=0,$=null,E=w.next();A!==null&&!E.done;L++,E=w.next()){A.index>L?($=A,A=null):$=A.sibling;var z=f(b,A,E.value,k);if(z===null){A===null&&(A=$);break}e&&A&&z.alternate===null&&t(b,A),x=i(z,x,L),C===null?T=z:C.sibling=z,C=z,A=$}if(E.done)return n(b,A),ln&&ka(b,L),T;if(A===null){for(;!E.done;L++,E=w.next())E=d(b,E.value,k),E!==null&&(x=i(E,x,L),C===null?T=E:C.sibling=E,C=E);return ln&&ka(b,L),T}for(A=r(A);!E.done;L++,E=w.next())E=m(A,b,L,E.value,k),E!==null&&(e&&E.alternate!==null&&A.delete(E.key===null?L:E.key),x=i(E,x,L),C===null?T=E:C.sibling=E,C=E);return e&&A.forEach(function(M){return t(b,M)}),ln&&ka(b,L),T}function v(b,x,w,k){if(typeof w=="object"&&w!==null&&w.type===ud&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Bm:e:{for(var T=w.key;x!==null;){if(x.key===T){if(T=w.type,T===ud){if(x.tag===7){n(b,x.sibling),k=s(x,w.props.children),k.return=b,b=k;break e}}else if(x.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===bl&&Wc(T)===x.type){n(b,x.sibling),k=s(x,w.props),Xh(k,w),k.return=b,b=k;break e}n(b,x);break}else t(b,x);x=x.sibling}w.type===ud?(k=cu(w.props.children,b.mode,k,w.key),k.return=b,b=k):(k=Yp(w.type,w.key,w.props,null,b.mode,k),Xh(k,w),k.return=b,b=k)}return o(b);case bf:e:{for(T=w.key;x!==null;){if(x.key===T)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),k=s(x,w.children||[]),k.return=b,b=k;break e}else{n(b,x);break}else t(b,x);x=x.sibling}k=Vb(w,b.mode,k),k.return=b,b=k}return o(b);case bl:return w=Wc(w),v(b,x,w,k)}if(xf(w))return p(b,x,w,k);if(Gh(w)){if(T=Gh(w),typeof T!="function")throw Error(pe(150));return w=T.call(w),y(b,x,w,k)}if(typeof w.then=="function")return v(b,x,Hm(w),k);if(w.$$typeof===Ma)return v(b,x,Um(b,w),k);Vm(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),k=s(x,w),k.return=b,b=k):(n(b,x),k=Hb(w,b.mode,k),k.return=b,b=k),o(b)):n(b,x)}return function(b,x,w,k){try{y0=0;var T=v(b,x,w,k);return Rd=null,T}catch(A){if(A===xh||A===cy)throw A;var C=ui(29,A,null,b.mode);return C.lanes=k,C.return=b,C}finally{}}}var vu=nE(!0),rE=nE(!1),xl=!1;function j3(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mx(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 Fl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ul(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,yn&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=Lg(e),KA(e,null,n),t}return ly(e,r,t,n),Lg(e)}function zf(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vA(e,n)}}function Gb(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=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?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Nx=!1;function Pf(){if(Nx){var e=Id;if(e!==null)throw e}}function qf(e,t,n,r){Nx=!1;var s=e.updateQueue;xl=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(i!==null){var d=s.baseState;o=0,u=c=l=null,a=i;do{var f=a.lane&-536870913,m=f!==a.lane;if(m?(tn&f)===f:(r&f)===f){f!==0&&f===Wd&&(Nx=!0),u!==null&&(u=u.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var p=e,y=a;f=t;var v=n;switch(y.tag){case 1:if(p=y.payload,typeof p=="function"){d=p.call(v,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=y.payload,f=typeof p=="function"?p.call(v,d,f):p,f==null)break e;d=Kn({},d,f);break e;case 2:xl=!0}}f=a.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=s.callbacks,m===null?s.callbacks=[f]:m.push(f))}else m={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=d):u=u.next=m,o|=f;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;m=a,a=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);u===null&&(l=d),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=u,i===null&&(s.shared.lanes=0),nc|=o,e.lanes=o,e.memoizedState=d}}function sE(e,t){if(typeof e!="function")throw Error(pe(191,e));e.call(t)}function iE(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)sE(n[e],t)}var Gd=Xo(null),$g=Xo(0);function _8(e,t){e=Va,Fn($g,e),Fn(Gd,t),Va=e|t.baseLanes}function Ix(){Fn($g,Va),Fn(Gd,Gd.current)}function L3(){Va=$g.current,Gr(Gd),Gr($g)}var vi=Xo(null),Gi=null;function Tl(e){var t=e.alternate;Fn(br,br.current&1),Fn(vi,e),Gi===null&&(t===null||Gd.current!==null||t.memoizedState!==null)&&(Gi=e)}function Rx(e){Fn(br,br.current),Fn(vi,e),Gi===null&&(Gi=e)}function oE(e){e.tag===22?(Fn(br,br.current),Fn(vi,e),Gi===null&&(Gi=e)):Cl()}function Cl(){Fn(br,br.current),Fn(vi,vi.current)}function ci(e){Gr(vi),Gi===e&&(Gi=null),Gr(br)}var br=Xo(0);function zg(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Qx(n)||Jx(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 Fa=0,$t=null,Mn=null,_r=null,Pg=!1,jd=!1,_u=!1,qg=0,b0=0,Ld=null,Tz=0;function cr(){throw Error(pe(321))}function D3(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wi(e[n],t[n]))return!1;return!0}function O3(e,t,n,r,s,i){return Fa=i,$t=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Mt.H=e===null||e.memoizedState===null?BE:G3,_u=!1,i=n(r,s),_u=!1,jd&&(i=lE(t,n,r,s)),aE(e),i}function aE(e){Mt.H=x0;var t=Mn!==null&&Mn.next!==null;if(Fa=0,_r=Mn=$t=null,Pg=!1,b0=0,Ld=null,t)throw Error(pe(300));e===null||Cr||(e=e.dependencies,e!==null&&Og(e)&&(Cr=!0))}function lE(e,t,n,r){$t=e;var s=0;do{if(jd&&(Ld=null),b0=0,jd=!1,25<=s)throw Error(pe(301));if(s+=1,_r=Mn=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Mt.H=$E,i=t(n,r)}while(jd);return i}function Cz(){var e=Mt.H,t=e.useState()[0];return t=typeof t.then=="function"?tm(t):t,e=e.useState()[0],(Mn!==null?Mn.memoizedState:null)!==e&&($t.flags|=1024),t}function B3(){var e=qg!==0;return qg=0,e}function $3(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function z3(e){if(Pg){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Pg=!1}Fa=0,_r=Mn=$t=null,jd=!1,b0=qg=0,Ld=null}function ks(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _r===null?$t.memoizedState=_r=e:_r=_r.next=e,_r}function xr(){if(Mn===null){var e=$t.alternate;e=e!==null?e.memoizedState:null}else e=Mn.next;var t=_r===null?$t.memoizedState:_r.next;if(t!==null)_r=t,Mn=e;else{if(e===null)throw $t.alternate===null?Error(pe(467)):Error(pe(310));Mn=e,e={memoizedState:Mn.memoizedState,baseState:Mn.baseState,baseQueue:Mn.baseQueue,queue:Mn.queue,next:null},_r===null?$t.memoizedState=_r=e:_r=_r.next=e}return _r}function uy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function tm(e){var t=b0;return b0+=1,Ld===null&&(Ld=[]),e=tE(Ld,e,t),t=$t,(_r===null?t.memoizedState:_r.next)===null&&(t=t.alternate,Mt.H=t===null||t.memoizedState===null?BE:G3),e}function dy(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return tm(e);if(e.$$typeof===Ma)return rs(e)}throw Error(pe(438,String(e)))}function P3(e){var t=null,n=$t.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=$t.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=uy(),$t.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=d$;return t.index++,n}function Ua(e,t){return typeof t=="function"?t(e):t}function Qp(e){var t=xr();return q3(t,Mn,e)}function q3(e,t,n){var r=e.queue;if(r===null)throw Error(pe(311));r.lastRenderedReducer=n;var s=e.baseQueue,i=r.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}t.baseQueue=s=i,r.pending=null}if(i=e.baseState,s===null)e.memoizedState=i;else{t=s.next;var a=o=null,l=null,c=t,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(tn&d)===d:(Fa&d)===d){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}),d===Wd&&(u=!0);else if((Fa&f)===f){c=c.next,f===Wd&&(u=!0);continue}else d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},l===null?(a=l=d,o=i):l=l.next=d,$t.lanes|=f,nc|=f;d=c.action,_u&&n(i,d),i=c.hasEagerState?c.eagerState:n(i,d)}else f={lane:d,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,$t.lanes|=d,nc|=d;c=c.next}while(c!==null&&c!==t);if(l===null?o=i:l.next=a,!wi(i,e.memoizedState)&&(Cr=!0,u&&(n=Id,n!==null)))throw n;e.memoizedState=i,e.baseState=o,e.baseQueue=l,r.lastRenderedState=i}return s===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Kb(e){var t=xr(),n=t.queue;if(n===null)throw Error(pe(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=e(i,o.action),o=o.next;while(o!==s);wi(i,t.memoizedState)||(Cr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function cE(e,t,n){var r=$t,s=xr(),i=ln;if(i){if(n===void 0)throw Error(pe(407));n=n()}else n=t();var o=!wi((Mn||s).memoizedState,n);if(o&&(s.memoizedState=n,Cr=!0),s=s.queue,F3(hE.bind(null,r,s,e),[e]),s.getSnapshot!==t||o||_r!==null&&_r.memoizedState.tag&1){if(r.flags|=2048,Kd(9,{destroy:void 0},dE.bind(null,r,s,n,t),null),Dn===null)throw Error(pe(349));i||Fa&127||uE(r,t,n)}return n}function uE(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=$t.updateQueue,t===null?(t=uy(),$t.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function dE(e,t,n,r){t.value=n,t.getSnapshot=r,fE(t)&&mE(e)}function hE(e,t,n){return n(function(){fE(t)&&mE(e)})}function fE(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wi(e,n)}catch{return!0}}function mE(e){var t=Lu(e,2);t!==null&&Ks(t,e,2)}function jx(e){var t=ks();if(typeof e=="function"){var n=e;if(e=n(),_u){Nl(!0);try{n()}finally{Nl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ua,lastRenderedState:e},t}function pE(e,t,n,r){return e.baseState=n,q3(e,Mn,typeof r=="function"?r:Ua)}function Az(e,t,n,r,s){if(fy(e))throw Error(pe(485));if(e=t.action,e!==null){var i={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){i.listeners.push(o)}};Mt.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,gE(t,i)):(i.next=n.next,t.pending=n.next=i)}}function gE(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=Mt.T,o={};Mt.T=o;try{var a=n(s,r),l=Mt.S;l!==null&&l(o,a),k8(e,t,a)}catch(c){Lx(e,t,c)}finally{i!==null&&o.types!==null&&(i.types=o.types),Mt.T=i}}else try{i=n(s,r),k8(e,t,i)}catch(c){Lx(e,t,c)}}function k8(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){S8(e,t,r)},function(r){return Lx(e,t,r)}):S8(e,t,n)}function S8(e,t,n){t.status="fulfilled",t.value=n,yE(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,gE(e,n)))}function Lx(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,yE(t),t=t.next;while(t!==r)}e.action=null}function yE(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function bE(e,t){return t}function T8(e,t){if(ln){var n=Dn.formState;if(n!==null){e:{var r=$t;if(ln){if(Vn){t:{for(var s=Vn,i=Fi;s.nodeType!==8;){if(!i){s=null;break t}if(s=Ki(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Vn=Ki(s.nextSibling),r=s.data==="F!";break e}}ec(r)}r=!1}r&&(t=n[0])}}return n=ks(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bE,lastRenderedState:t},n.queue=r,n=LE.bind(null,$t,r),r.dispatch=n,r=jx(!1),i=W3.bind(null,$t,!1,r.queue),r=ks(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=Az.bind(null,$t,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function C8(e){var t=xr();return xE(t,Mn,e)}function xE(e,t,n){if(t=q3(e,t,bE)[0],e=Qp(Ua)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=tm(t)}catch(o){throw o===xh?cy:o}else r=t;t=xr();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&($t.flags|=2048,Kd(9,{destroy:void 0},Ez.bind(null,s,n),null)),[r,i,e]}function Ez(e,t){e.action=t}function A8(e){var t=xr(),n=Mn;if(n!==null)return xE(t,n,e);xr(),t=t.memoizedState,n=xr();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Kd(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=$t.updateQueue,t===null&&(t=uy(),$t.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function wE(){return xr().memoizedState}function Jp(e,t,n,r){var s=ks();$t.flags|=e,s.memoizedState=Kd(1|t,{destroy:void 0},n,r===void 0?null:r)}function hy(e,t,n,r){var s=xr();r=r===void 0?null:r;var i=s.memoizedState.inst;Mn!==null&&r!==null&&D3(r,Mn.memoizedState.deps)?s.memoizedState=Kd(t,i,n,r):($t.flags|=e,s.memoizedState=Kd(1|t,i,n,r))}function E8(e,t){Jp(8390656,8,e,t)}function F3(e,t){hy(2048,8,e,t)}function Mz(e){$t.flags|=4;var t=$t.updateQueue;if(t===null)t=uy(),$t.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function vE(e){var t=xr().memoizedState;return Mz({ref:t,nextImpl:e}),function(){if(yn&2)throw Error(pe(440));return t.impl.apply(void 0,arguments)}}function _E(e,t){return hy(4,2,e,t)}function kE(e,t){return hy(4,4,e,t)}function SE(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 TE(e,t,n){n=n!=null?n.concat([e]):null,hy(4,4,SE.bind(null,t,e),n)}function U3(){}function CE(e,t){var n=xr();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&D3(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function AE(e,t){var n=xr();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&D3(t,r[1]))return r[0];if(r=e(),_u){Nl(!0);try{e()}finally{Nl(!1)}}return n.memoizedState=[r,t],r}function H3(e,t,n){return n===void 0||Fa&1073741824&&!(tn&261930)?e.memoizedState=t:(e.memoizedState=n,e=pM(),$t.lanes|=e,nc|=e,n)}function EE(e,t,n,r){return wi(n,t)?n:Gd.current!==null?(e=H3(e,n,r),wi(e,t)||(Cr=!0),e):!(Fa&42)||Fa&1073741824&&!(tn&261930)?(Cr=!0,e.memoizedState=n):(e=pM(),$t.lanes|=e,nc|=e,t)}function ME(e,t,n,r,s){var i=xn.p;xn.p=i!==0&&8>i?i:8;var o=Mt.T,a={};Mt.T=a,W3(e,!1,t,n);try{var l=s(),c=Mt.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=Sz(l,r);Ff(e,t,u,yi(e))}else Ff(e,t,r,yi(e))}catch(d){Ff(e,t,{then:function(){},status:"rejected",reason:d},yi())}finally{xn.p=i,o!==null&&a.types!==null&&(o.types=a.types),Mt.T=o}}function Nz(){}function Dx(e,t,n,r){if(e.tag!==5)throw Error(pe(476));var s=NE(e).queue;ME(e,s,t,lu,n===null?Nz:function(){return IE(e),n(r)})}function NE(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:lu,baseState:lu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ua,lastRenderedState:lu},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ua,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function IE(e){var t=NE(e);t.next===null&&(t=e.alternate.memoizedState),Ff(e,t.next.queue,{},yi())}function V3(){return rs(_0)}function RE(){return xr().memoizedState}function jE(){return xr().memoizedState}function Iz(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=yi();e=Fl(n);var r=Ul(t,e,n);r!==null&&(Ks(r,t,n),zf(r,t,n)),t={cache:N3()},e.payload=t;return}t=t.return}}function Rz(e,t,n){var r=yi();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},fy(e)?DE(t,n):(n=C3(e,t,n,r),n!==null&&(Ks(n,e,r),OE(n,t,r)))}function LE(e,t,n){var r=yi();Ff(e,t,n,r)}function Ff(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(fy(e))DE(t,s);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(s.hasEagerState=!0,s.eagerState=a,wi(a,o))return ly(e,t,s,0),Dn===null&&ay(),!1}catch{}finally{}if(n=C3(e,t,s,r),n!==null)return Ks(n,e,r),OE(n,t,r),!0}return!1}function W3(e,t,n,r){if(r={lane:2,revertLane:t5(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},fy(e)){if(t)throw Error(pe(479))}else t=C3(e,n,r,2),t!==null&&Ks(t,e,2)}function fy(e){var t=e.alternate;return e===$t||t!==null&&t===$t}function DE(e,t){jd=Pg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function OE(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vA(e,n)}}var x0={readContext:rs,use:dy,useCallback:cr,useContext:cr,useEffect:cr,useImperativeHandle:cr,useLayoutEffect:cr,useInsertionEffect:cr,useMemo:cr,useReducer:cr,useRef:cr,useState:cr,useDebugValue:cr,useDeferredValue:cr,useTransition:cr,useSyncExternalStore:cr,useId:cr,useHostTransitionStatus:cr,useFormState:cr,useActionState:cr,useOptimistic:cr,useMemoCache:cr,useCacheRefresh:cr};x0.useEffectEvent=cr;var BE={readContext:rs,use:dy,useCallback:function(e,t){return ks().memoizedState=[e,t===void 0?null:t],e},useContext:rs,useEffect:E8,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Jp(4194308,4,SE.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Jp(4194308,4,e,t)},useInsertionEffect:function(e,t){Jp(4,2,e,t)},useMemo:function(e,t){var n=ks();t=t===void 0?null:t;var r=e();if(_u){Nl(!0);try{e()}finally{Nl(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ks();if(n!==void 0){var s=n(t);if(_u){Nl(!0);try{n(t)}finally{Nl(!1)}}}else s=t;return r.memoizedState=r.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},r.queue=e,e=e.dispatch=Rz.bind(null,$t,e),[r.memoizedState,e]},useRef:function(e){var t=ks();return e={current:e},t.memoizedState=e},useState:function(e){e=jx(e);var t=e.queue,n=LE.bind(null,$t,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:U3,useDeferredValue:function(e,t){var n=ks();return H3(n,e,t)},useTransition:function(){var e=jx(!1);return e=ME.bind(null,$t,e.queue,!0,!1),ks().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=$t,s=ks();if(ln){if(n===void 0)throw Error(pe(407));n=n()}else{if(n=t(),Dn===null)throw Error(pe(349));tn&127||uE(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,E8(hE.bind(null,r,i,e),[e]),r.flags|=2048,Kd(9,{destroy:void 0},dE.bind(null,r,i,n,t),null),n},useId:function(){var e=ks(),t=Dn.identifierPrefix;if(ln){var n=qo,r=Po;n=(r&~(1<<32-gi(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=qg++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Tz++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:V3,useFormState:T8,useActionState:T8,useOptimistic:function(e){var t=ks();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=W3.bind(null,$t,!0,n),n.dispatch=t,[e,t]},useMemoCache:P3,useCacheRefresh:function(){return ks().memoizedState=Iz.bind(null,$t)},useEffectEvent:function(e){var t=ks(),n={impl:e};return t.memoizedState=n,function(){if(yn&2)throw Error(pe(440));return n.impl.apply(void 0,arguments)}}},G3={readContext:rs,use:dy,useCallback:CE,useContext:rs,useEffect:F3,useImperativeHandle:TE,useInsertionEffect:_E,useLayoutEffect:kE,useMemo:AE,useReducer:Qp,useRef:wE,useState:function(){return Qp(Ua)},useDebugValue:U3,useDeferredValue:function(e,t){var n=xr();return EE(n,Mn.memoizedState,e,t)},useTransition:function(){var e=Qp(Ua)[0],t=xr().memoizedState;return[typeof e=="boolean"?e:tm(e),t]},useSyncExternalStore:cE,useId:RE,useHostTransitionStatus:V3,useFormState:C8,useActionState:C8,useOptimistic:function(e,t){var n=xr();return pE(n,Mn,e,t)},useMemoCache:P3,useCacheRefresh:jE};G3.useEffectEvent=vE;var $E={readContext:rs,use:dy,useCallback:CE,useContext:rs,useEffect:F3,useImperativeHandle:TE,useInsertionEffect:_E,useLayoutEffect:kE,useMemo:AE,useReducer:Kb,useRef:wE,useState:function(){return Kb(Ua)},useDebugValue:U3,useDeferredValue:function(e,t){var n=xr();return Mn===null?H3(n,e,t):EE(n,Mn.memoizedState,e,t)},useTransition:function(){var e=Kb(Ua)[0],t=xr().memoizedState;return[typeof e=="boolean"?e:tm(e),t]},useSyncExternalStore:cE,useId:RE,useHostTransitionStatus:V3,useFormState:A8,useActionState:A8,useOptimistic:function(e,t){var n=xr();return Mn!==null?pE(n,Mn,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:P3,useCacheRefresh:jE};$E.useEffectEvent=vE;function Yb(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Kn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ox={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=yi(),s=Fl(r);s.payload=t,n!=null&&(s.callback=n),t=Ul(e,s,r),t!==null&&(Ks(t,e,r),zf(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=yi(),s=Fl(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Ul(e,s,r),t!==null&&(Ks(t,e,r),zf(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=yi(),r=Fl(n);r.tag=2,t!=null&&(r.callback=t),t=Ul(e,r,n),t!==null&&(Ks(t,e,n),zf(t,e,n))}};function M8(e,t,n,r,s,i,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,o):t.prototype&&t.prototype.isPureReactComponent?!m0(n,r)||!m0(s,i):!0}function N8(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ox.enqueueReplaceState(t,t.state,null)}function ku(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=Kn({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function zE(e){jg(e)}function PE(e){console.error(e)}function qE(e){jg(e)}function Fg(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function I8(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function Bx(e,t,n){return n=Fl(n),n.tag=3,n.payload={element:null},n.callback=function(){Fg(e,t)},n}function FE(e){return e=Fl(e),e.tag=3,e}function UE(e,t,n,r){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var i=r.value;e.payload=function(){return s(i)},e.callback=function(){I8(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){I8(t,n,r),typeof s!="function"&&(Hl===null?Hl=new Set([this]):Hl.add(this));var a=r.stack;this.componentDidCatch(r.value,{componentStack:a!==null?a:""})})}function jz(e,t,n,r,s){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&bh(t,n,s,!0),n=vi.current,n!==null){switch(n.tag){case 31:case 13:return Gi===null?Gg():n.alternate===null&&dr===0&&(dr=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===Bg?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),o2(e,r,s)),!1;case 22:return n.flags|=65536,r===Bg?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),o2(e,r,s)),!1}throw Error(pe(435,n.tag))}return o2(e,r,s),Gg(),!1}if(ln)return t=vi.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==Sx&&(e=Error(pe(422),{cause:r}),g0(qi(e,n)))):(r!==Sx&&(t=Error(pe(423),{cause:r}),g0(qi(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=qi(r,n),s=Bx(e.stateNode,r,s),Gb(e,s),dr!==4&&(dr=2)),!1;var i=Error(pe(520),{cause:r});if(i=qi(i,n),Vf===null?Vf=[i]:Vf.push(i),dr!==4&&(dr=2),t===null)return!0;r=qi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=Bx(n.stateNode,r,e),Gb(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"&&(Hl===null||!Hl.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=FE(s),UE(s,e,n,r),Gb(n,s),!1}n=n.return}while(n!==null);return!1}var K3=Error(pe(461)),Cr=!1;function Jr(e,t,n,r){t.child=e===null?rE(t,null,n,r):vu(t,e.child,n,r)}function R8(e,t,n,r,s){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var a in r)a!=="ref"&&(o[a]=r[a])}else o=r;return wu(t),r=O3(e,t,n,o,i,s),a=B3(),e!==null&&!Cr?($3(e,t,s),Ha(e,t,s)):(ln&&a&&E3(t),t.flags|=1,Jr(e,t,r,s),t.child)}function j8(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!A3(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,HE(e,t,i,r,s)):(e=Yp(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!Y3(e,s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:m0,n(o,r)&&e.ref===t.ref)return Ha(e,t,s)}return t.flags|=1,e=Da(i,r),e.ref=t.ref,e.return=t,t.child=e}function HE(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(m0(i,r)&&e.ref===t.ref)if(Cr=!1,t.pendingProps=r=i,Y3(e,s))e.flags&131072&&(Cr=!0);else return t.lanes=e.lanes,Ha(e,t,s)}return $x(e,t,n,r,s)}function VE(e,t,n,r){var s=r.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if(t.flags&128){if(i=i!==null?i.baseLanes|n:n,e!==null){for(r=t.child=e.child,s=0;r!==null;)s=s|r.lanes|r.childLanes,r=r.sibling;r=s&~i}else r=0,t.child=null;return L8(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Xp(t,i!==null?i.cachePool:null),i!==null?_8(t,i):Ix(),oE(t);else return r=t.lanes=536870912,L8(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(Xp(t,i.cachePool),_8(t,i),Cl(),t.memoizedState=null):(e!==null&&Xp(t,null),Ix(),Cl());return Jr(e,t,s,n),t.child}function vf(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function L8(e,t,n,r,s){var i=I3();return i=i===null?null:{parent:Tr._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&Xp(t,null),Ix(),oE(t),e!==null&&bh(e,t,r,!0),t.childLanes=s,null}function Zp(e,t){return t=Ug({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function D8(e,t,n){return vu(t,e.child,null,n),e=Zp(t,t.pendingProps),e.flags|=2,ci(t),t.memoizedState=null,e}function Lz(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ln){if(r.mode==="hidden")return e=Zp(t,r),t.lanes=536870912,vf(null,e);if(Rx(t),(e=Vn)?(e=BM(e,Fi),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zl!==null?{id:Po,overflow:qo}:null,retryLane:536870912,hydrationErrors:null},n=XA(e),n.return=t,t.child=n,ns=t,Vn=null)):e=null,e===null)throw ec(t);return t.lanes=536870912,null}return Zp(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(Rx(t),s)if(t.flags&256)t.flags&=-257,t=D8(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(pe(558));else if(Cr||bh(e,t,n,!1),s=(n&e.childLanes)!==0,Cr||s){if(r=Dn,r!==null&&(o=_A(r,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,Lu(e,o),Ks(r,e,o),K3;Gg(),t=D8(e,t,n)}else e=i.treeContext,Vn=Ki(o.nextSibling),ns=t,ln=!0,ql=null,Fi=!1,e!==null&&JA(t,e),t=Zp(t,r),t.flags|=4096;return t}return e=Da(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function eg(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(pe(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function $x(e,t,n,r,s){return wu(t),n=O3(e,t,n,r,void 0,s),r=B3(),e!==null&&!Cr?($3(e,t,s),Ha(e,t,s)):(ln&&r&&E3(t),t.flags|=1,Jr(e,t,n,s),t.child)}function O8(e,t,n,r,s,i){return wu(t),t.updateQueue=null,n=lE(t,r,n,s),aE(e),r=B3(),e!==null&&!Cr?($3(e,t,i),Ha(e,t,i)):(ln&&r&&E3(t),t.flags|=1,Jr(e,t,n,i),t.child)}function B8(e,t,n,r,s){if(wu(t),t.stateNode===null){var i=bd,o=n.contextType;typeof o=="object"&&o!==null&&(i=rs(o)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Ox,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},j3(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?rs(o):bd,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(Yb(t,n,o,r),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&&Ox.enqueueReplaceState(i,i.state,null),qf(t,r,i,s),Pf(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){i=t.stateNode;var a=t.memoizedProps,l=ku(n,a);i.props=l;var c=i.context,u=n.contextType;o=bd,typeof u=="object"&&u!==null&&(o=rs(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,u||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||c!==o)&&N8(t,i,r,o),xl=!1;var f=t.memoizedState;i.state=f,qf(t,r,i,s),Pf(),c=t.memoizedState,a||f!==c||xl?(typeof d=="function"&&(Yb(t,n,d,r),c=t.memoizedState),(l=xl||M8(t,n,l,r,f,c,o))?(u||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=r,t.memoizedState=c),i.props=r,i.state=c,i.context=o,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Mx(e,t),o=t.memoizedProps,u=ku(n,o),i.props=u,d=t.pendingProps,f=i.context,c=n.contextType,l=bd,typeof c=="object"&&c!==null&&(l=rs(c)),a=n.getDerivedStateFromProps,(c=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==d||f!==l)&&N8(t,i,r,l),xl=!1,f=t.memoizedState,i.state=f,qf(t,r,i,s),Pf();var m=t.memoizedState;o!==d||f!==m||xl||e!==null&&e.dependencies!==null&&Og(e.dependencies)?(typeof a=="function"&&(Yb(t,n,a,r),m=t.memoizedState),(u=xl||M8(t,n,u,r,f,m,l)||e!==null&&e.dependencies!==null&&Og(e.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,m,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,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=r,t.memoizedState=m),i.props=r,i.state=m,i.context=l,r=u):(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),r=!1)}return i=r,eg(e,t),r=(t.flags&128)!==0,i||r?(i=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&r?(t.child=vu(t,e.child,null,s),t.child=vu(t,null,n,s)):Jr(e,t,n,s),t.memoizedState=i.state,e=t.child):e=Ha(e,t,s),e}function $8(e,t,n,r){return xu(),t.flags|=256,Jr(e,t,n,r),t.child}var Xb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qb(e){return{baseLanes:e,cachePool:eE()}}function Jb(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=hi),e}function WE(e,t,n){var r=t.pendingProps,s=!1,i=(t.flags&128)!==0,o;if((o=i)||(o=e!==null&&e.memoizedState===null?!1:(br.current&2)!==0),o&&(s=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(ln){if(s?Tl(t):Cl(),(e=Vn)?(e=BM(e,Fi),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Zl!==null?{id:Po,overflow:qo}:null,retryLane:536870912,hydrationErrors:null},n=XA(e),n.return=t,t.child=n,ns=t,Vn=null)):e=null,e===null)throw ec(t);return Jx(e)?t.lanes=32:t.lanes=536870912,null}var a=r.children;return r=r.fallback,s?(Cl(),s=t.mode,a=Ug({mode:"hidden",children:a},s),r=cu(r,s,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Qb(n),r.childLanes=Jb(e,o,n),t.memoizedState=Xb,vf(null,r)):(Tl(t),zx(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(Tl(t),t.flags&=-257,t=Zb(e,t,n)):t.memoizedState!==null?(Cl(),t.child=e.child,t.flags|=128,t=null):(Cl(),a=r.fallback,s=t.mode,r=Ug({mode:"visible",children:r.children},s),a=cu(a,s,n,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,vu(t,e.child,null,n),r=t.child,r.memoizedState=Qb(n),r.childLanes=Jb(e,o,n),t.memoizedState=Xb,t=vf(null,r));else if(Tl(t),Jx(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,r=Error(pe(419)),r.stack="",r.digest=o,g0({value:r,source:null,stack:null}),t=Zb(e,t,n)}else if(Cr||bh(e,t,n,!1),o=(n&e.childLanes)!==0,Cr||o){if(o=Dn,o!==null&&(r=_A(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Lu(e,r),Ks(o,e,r),K3;Qx(a)||Gg(),t=Zb(e,t,n)}else Qx(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Vn=Ki(a.nextSibling),ns=t,ln=!0,ql=null,Fi=!1,e!==null&&JA(t,e),t=zx(t,r.children),t.flags|=4096);return t}return s?(Cl(),a=r.fallback,s=t.mode,l=e.child,c=l.sibling,r=Da(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=Da(c,a):(a=cu(a,s,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,vf(null,r),r=t.child,a=e.child.memoizedState,a===null?a=Qb(n):(s=a.cachePool,s!==null?(l=Tr._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=eE(),a={baseLanes:a.baseLanes|n,cachePool:s}),r.memoizedState=a,r.childLanes=Jb(e,o,n),t.memoizedState=Xb,vf(e.child,r)):(Tl(t),n=e.child,e=n.sibling,n=Da(n,{mode:"visible",children:r.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 zx(e,t){return t=Ug({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ug(e,t){return e=ui(22,e,null,t),e.lanes=0,e}function Zb(e,t,n){return vu(t,e.child,null,n),e=zx(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function z8(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Cx(e.return,t,n)}function e2(e,t,n,r,s,i){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s,o.treeForkCount=i)}function GE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var o=br.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,Fn(br,o),Jr(e,t,r,n),r=ln?p0:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&z8(e,n,t);else if(e.tag===19)z8(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(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&zg(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),e2(t,!1,s,n,i,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&zg(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}e2(t,!0,n,null,i,r);break;case"together":e2(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ha(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),nc|=t.lanes,!(n&t.childLanes))if(e!==null){if(bh(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(pe(153));if(t.child!==null){for(e=t.child,n=Da(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Da(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Y3(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Og(e)))}function Dz(e,t,n){switch(t.tag){case 3:Mg(t,t.stateNode.containerInfo),Sl(t,Tr,e.memoizedState.cache),xu();break;case 27:case 5:fx(t);break;case 4:Mg(t,t.stateNode.containerInfo);break;case 10:Sl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Rx(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Tl(t),t.flags|=128,null):n&t.child.childLanes?WE(e,t,n):(Tl(t),e=Ha(e,t,n),e!==null?e.sibling:null);Tl(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(bh(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return GE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Fn(br,br.current),r)break;return null;case 22:return t.lanes=0,VE(e,t,n,t.pendingProps);case 24:Sl(t,Tr,e.memoizedState.cache)}return Ha(e,t,n)}function KE(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Cr=!0;else{if(!Y3(e,n)&&!(t.flags&128))return Cr=!1,Dz(e,t,n);Cr=!!(e.flags&131072)}else Cr=!1,ln&&t.flags&1048576&&QA(t,p0,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Wc(t.elementType),t.type=e,typeof e=="function")A3(e)?(r=ku(e,r),t.tag=1,t=B8(null,t,e,r,n)):(t.tag=0,t=$x(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===f3){t.tag=11,t=R8(null,t,e,r,n);break e}else if(s===m3){t.tag=14,t=j8(null,t,e,r,n);break e}}throw t=dx(e)||e,Error(pe(306,t,""))}}return t;case 0:return $x(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=ku(r,t.pendingProps),B8(e,t,r,s,n);case 3:e:{if(Mg(t,t.stateNode.containerInfo),e===null)throw Error(pe(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,Mx(e,t),qf(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Sl(t,Tr,r),r!==i.cache&&Ax(t,[Tr],n,!0),Pf(),r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=$8(e,t,r,n);break e}else if(r!==s){s=qi(Error(pe(424)),t),g0(s),t=$8(e,t,r,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(Vn=Ki(e.firstChild),ns=t,ln=!0,ql=null,Fi=!0,n=rE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(xu(),r===s){t=Ha(e,t,n);break e}Jr(e,t,r,n)}t=t.child}return t;case 26:return eg(e,t),e===null?(n=ik(t.type,null,t.pendingProps,null))?t.memoizedState=n:ln||(n=t.type,e=t.pendingProps,r=Qg(Pl.current).createElement(n),r[ts]=t,r[Xs]=e,is(r,n,e),Vr(r),t.stateNode=r):t.memoizedState=ik(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return fx(t),e===null&&ln&&(r=t.stateNode=$M(t.type,t.pendingProps,Pl.current),ns=t,Fi=!0,s=Vn,pc(t.type)?(Zx=s,Vn=Ki(r.firstChild)):Vn=s),Jr(e,t,t.pendingProps.children,n),eg(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ln&&((s=r=Vn)&&(r=dP(r,t.type,t.pendingProps,Fi),r!==null?(t.stateNode=r,ns=t,Vn=Ki(r.firstChild),Fi=!1,s=!0):s=!1),s||ec(t)),fx(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,Yx(s,i)?r=null:o!==null&&Yx(s,o)&&(t.flags|=32),t.memoizedState!==null&&(s=O3(e,t,Cz,null,null,n),_0._currentValue=s),eg(e,t),Jr(e,t,r,n),t.child;case 6:return e===null&&ln&&((e=n=Vn)&&(n=hP(n,t.pendingProps,Fi),n!==null?(t.stateNode=n,ns=t,Vn=null,e=!0):e=!1),e||ec(t)),null;case 13:return WE(e,t,n);case 4:return Mg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vu(t,null,r,n):Jr(e,t,r,n),t.child;case 11:return R8(e,t,t.type,t.pendingProps,n);case 7:return Jr(e,t,t.pendingProps,n),t.child;case 8:return Jr(e,t,t.pendingProps.children,n),t.child;case 12:return Jr(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Sl(t,t.type,r.value),Jr(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,wu(t),s=rs(s),r=r(s),t.flags|=1,Jr(e,t,r,n),t.child;case 14:return j8(e,t,t.type,t.pendingProps,n);case 15:return HE(e,t,t.type,t.pendingProps,n);case 19:return GE(e,t,n);case 31:return Lz(e,t,n);case 22:return VE(e,t,n,t.pendingProps);case 24:return wu(t),r=rs(Tr),e===null?(s=I3(),s===null&&(s=Dn,i=N3(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},j3(t),Sl(t,Tr,s)):(e.lanes&n&&(Mx(e,t),qf(t,null,null,n),Pf()),s=e.memoizedState,i=t.memoizedState,s.parent!==r?(s={parent:r,cache:r},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Sl(t,Tr,r)):(r=i.cache,Sl(t,Tr,r),r!==s.cache&&Ax(t,[Tr],n,!0))),Jr(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(pe(156,t.tag))}function ma(e){e.flags|=4}function t2(e,t,n,r,s){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(bM())e.flags|=8192;else throw du=Bg,R3}else e.flags&=-16777217}function P8(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!qM(t))if(bM())e.flags|=8192;else throw du=Bg,R3}function Wm(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?xA():536870912,e.lanes|=t,Yd|=t)}function Qh(e,t){if(!ln)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 r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Un(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&65011712,r|=s.flags&65011712,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Oz(e,t,n){var r=t.pendingProps;switch(M3(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Un(t),null;case 1:return Un(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Oa(Tr),Ud(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Xu(t)?ma(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Wb())),Un(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(ma(t),i!==null?(Un(t),P8(t,i)):(Un(t),t2(t,s,null,r,n))):i?i!==e.memoizedState?(ma(t),Un(t),P8(t,i)):(Un(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ma(t),Un(t),t2(t,s,e,r,n)),null;case 27:if(Ng(t),n=Pl.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ma(t);else{if(!r){if(t.stateNode===null)throw Error(pe(166));return Un(t),null}e=Go.current,Xu(t)?p8(t):(e=$M(s,r,n),t.stateNode=e,ma(t))}return Un(t),null;case 5:if(Ng(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ma(t);else{if(!r){if(t.stateNode===null)throw Error(pe(166));return Un(t),null}if(i=Go.current,Xu(t))p8(t);else{var o=Qg(Pl.current);switch(i){case 1:i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":i=o.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":i=o.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":i=o.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?o.createElement(s,{is:r.is}):o.createElement(s)}}i[ts]=t,i[Xs]=r;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(is(i,s,r),s){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ma(t)}}return Un(t),t2(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ma(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(pe(166));if(e=Pl.current,Xu(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=ns,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[ts]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||LM(e.nodeValue,n)),e||ec(t,!0)}else e=Qg(e).createTextNode(r),e[ts]=t,t.stateNode=e}return Un(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Xu(t),n!==null){if(e===null){if(!r)throw Error(pe(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(pe(557));e[ts]=t}else xu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Un(t),e=!1}else n=Wb(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ci(t),t):(ci(t),null);if(t.flags&128)throw Error(pe(558))}return Un(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Xu(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(pe(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(pe(317));s[ts]=t}else xu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Un(t),s=!1}else s=Wb(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(ci(t),t):(ci(t),null)}return ci(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,s=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(s=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==s&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Wm(t,t.updateQueue),Un(t),null);case 4:return Ud(),e===null&&n5(t.stateNode.containerInfo),Un(t),null;case 10:return Oa(t.type),Un(t),null;case 19:if(Gr(br),r=t.memoizedState,r===null)return Un(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)Qh(r,!1);else{if(dr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=zg(e),i!==null){for(t.flags|=128,Qh(r,!1),e=i.updateQueue,t.updateQueue=e,Wm(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)YA(n,e),n=n.sibling;return Fn(br,br.current&1|2),ln&&ka(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&mi()>Vg&&(t.flags|=128,s=!0,Qh(r,!1),t.lanes=4194304)}else{if(!s)if(e=zg(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Wm(t,e),Qh(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!ln)return Un(t),null}else 2*mi()-r.renderingStartTime>Vg&&n!==536870912&&(t.flags|=128,s=!0,Qh(r,!1),t.lanes=4194304);r.isBackwards?(i.sibling=t.child,t.child=i):(e=r.last,e!==null?e.sibling=i:t.child=i,r.last=i)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=mi(),e.sibling=null,n=br.current,Fn(br,s?n&1|2:n&1),ln&&ka(t,r.treeForkCount),e):(Un(t),null);case 22:case 23:return ci(t),L3(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Un(t),t.subtreeFlags&6&&(t.flags|=8192)):Un(t),n=t.updateQueue,n!==null&&Wm(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Gr(uu),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Oa(Tr),Un(t),null;case 25:return null;case 30:return null}throw Error(pe(156,t.tag))}function Bz(e,t){switch(M3(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Oa(Tr),Ud(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ng(t),null;case 31:if(t.memoizedState!==null){if(ci(t),t.alternate===null)throw Error(pe(340));xu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ci(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(pe(340));xu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gr(br),null;case 4:return Ud(),null;case 10:return Oa(t.type),null;case 22:case 23:return ci(t),L3(),e!==null&&Gr(uu),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Oa(Tr),null;case 25:return null;default:return null}}function YE(e,t){switch(M3(t),t.tag){case 3:Oa(Tr),Ud();break;case 26:case 27:case 5:Ng(t);break;case 4:Ud();break;case 31:t.memoizedState!==null&&ci(t);break;case 13:ci(t);break;case 19:Gr(br);break;case 10:Oa(t.type);break;case 22:case 23:ci(t),L3(),e!==null&&Gr(uu);break;case 24:Oa(Tr)}}function nm(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var s=r.next;n=s;do{if((n.tag&e)===e){r=void 0;var i=n.create,o=n.inst;r=i(),o.destroy=r}n=n.next}while(n!==s)}}catch(a){An(t,t.return,a)}}function tc(e,t,n){try{var r=t.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var i=s.next;r=i;do{if((r.tag&e)===e){var o=r.inst,a=o.destroy;if(a!==void 0){o.destroy=void 0,s=t;var l=n,c=a;try{c()}catch(u){An(s,l,u)}}}r=r.next}while(r!==i)}}catch(u){An(t,t.return,u)}}function XE(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{iE(t,n)}catch(r){An(e,e.return,r)}}}function QE(e,t,n){n.props=ku(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){An(e,t,r)}}function Uf(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(s){An(e,t,s)}}function Fo(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){An(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){An(e,t,s)}else n.current=null}function JE(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(s){An(e,e.return,s)}}function n2(e,t,n){try{var r=e.stateNode;iP(r,e.type,n,t),r[Xs]=t}catch(s){An(e,e.return,s)}}function ZE(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pc(e.type)||e.tag===4}function r2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ZE(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&&pc(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 Px(e,t,n){var r=e.tag;if(r===5||r===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=Na));else if(r!==4&&(r===27&&pc(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Px(e,t,n),e=e.sibling;e!==null;)Px(e,t,n),e=e.sibling}function Hg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&pc(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Hg(e,t,n),e=e.sibling;e!==null;)Hg(e,t,n),e=e.sibling}function eM(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);is(t,r,n),t[ts]=e,t[Xs]=n}catch(i){An(e,e.return,i)}}var Ca=!1,kr=!1,s2=!1,q8=typeof WeakSet=="function"?WeakSet:Set,Hr=null;function $z(e,t){if(e=e.containerInfo,Gx=t1,e=qA(e),S3(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=e,f=null;t:for(;;){for(var m;d!==n||s!==0&&d.nodeType!==3||(a=o+s),d!==i||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(m=d.firstChild)!==null;)f=d,d=m;for(;;){if(d===e)break t;if(f===n&&++c===s&&(a=o),f===i&&++u===r&&(l=o),(m=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Kx={focusedElem:e,selectionRange:n},t1=!1,Hr=t;Hr!==null;)if(t=Hr,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Hr=e;else for(;Hr!==null;){switch(t=Hr,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++)s=e[n],s.ref.impl=s.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&i!==null){e=void 0,n=t,s=i.memoizedProps,i=i.memoizedState,r=n.stateNode;try{var p=ku(n.type,s);e=r.getSnapshotBeforeUpdate(p,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(y){An(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Xx(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Xx(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(pe(163))}if(e=t.sibling,e!==null){e.return=t.return,Hr=e;break}Hr=t.return}}function tM(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ga(e,n),r&4&&nm(5,n);break;case 1:if(ga(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){An(n,n.return,o)}else{var s=ku(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){An(n,n.return,o)}}r&64&&XE(n),r&512&&Uf(n,n.return);break;case 3:if(ga(e,n),r&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{iE(e,t)}catch(o){An(n,n.return,o)}}break;case 27:t===null&&r&4&&eM(n);case 26:case 5:ga(e,n),t===null&&r&4&&JE(n),r&512&&Uf(n,n.return);break;case 12:ga(e,n);break;case 31:ga(e,n),r&4&&sM(e,n);break;case 13:ga(e,n),r&4&&iM(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Gz.bind(null,n),fP(e,n))));break;case 22:if(r=n.memoizedState!==null||Ca,!r){t=t!==null&&t.memoizedState!==null||kr,s=Ca;var i=kr;Ca=r,(kr=t)&&!i?_a(e,n,(n.subtreeFlags&8772)!==0):ga(e,n),Ca=s,kr=i}break;case 30:break;default:ga(e,n)}}function nM(e){var t=e.alternate;t!==null&&(e.alternate=null,nM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&b3(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 Yn=null,qs=!1;function pa(e,t,n){for(n=n.child;n!==null;)rM(e,t,n),n=n.sibling}function rM(e,t,n){if(pi&&typeof pi.onCommitFiberUnmount=="function")try{pi.onCommitFiberUnmount(Y0,n)}catch{}switch(n.tag){case 26:kr||Fo(n,t),pa(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:kr||Fo(n,t);var r=Yn,s=qs;pc(n.type)&&(Yn=n.stateNode,qs=!1),pa(e,t,n),Gf(n.stateNode),Yn=r,qs=s;break;case 5:kr||Fo(n,t);case 6:if(r=Yn,s=qs,Yn=null,pa(e,t,n),Yn=r,qs=s,Yn!==null)if(qs)try{(Yn.nodeType===9?Yn.body:Yn.nodeName==="HTML"?Yn.ownerDocument.body:Yn).removeChild(n.stateNode)}catch(i){An(n,t,i)}else try{Yn.removeChild(n.stateNode)}catch(i){An(n,t,i)}break;case 18:Yn!==null&&(qs?(e=Yn,ek(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Zd(e)):ek(Yn,n.stateNode));break;case 4:r=Yn,s=qs,Yn=n.stateNode.containerInfo,qs=!0,pa(e,t,n),Yn=r,qs=s;break;case 0:case 11:case 14:case 15:tc(2,n,t),kr||tc(4,n,t),pa(e,t,n);break;case 1:kr||(Fo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&QE(n,t,r)),pa(e,t,n);break;case 21:pa(e,t,n);break;case 22:kr=(r=kr)||n.memoizedState!==null,pa(e,t,n),kr=r;break;default:pa(e,t,n)}}function sM(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zd(e)}catch(n){An(t,t.return,n)}}}function iM(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zd(e)}catch(n){An(t,t.return,n)}}function zz(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new q8),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new q8),t;default:throw Error(pe(435,e.tag))}}function Gm(e,t){var n=zz(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=Kz.bind(null,e,r);r.then(s,s)}})}function Bs(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r],i=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 27:if(pc(a.type)){Yn=a.stateNode,qs=!1;break e}break;case 5:Yn=a.stateNode,qs=!1;break e;case 3:case 4:Yn=a.stateNode.containerInfo,qs=!0;break e}a=a.return}if(Yn===null)throw Error(pe(160));rM(i,o,s),Yn=null,qs=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)oM(t,e),t=t.sibling}var co=null;function oM(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Bs(t,e),$s(e),r&4&&(tc(3,e,e.return),nm(3,e),tc(5,e,e.return));break;case 1:Bs(t,e),$s(e),r&512&&(kr||n===null||Fo(n,n.return)),r&64&&Ca&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var s=co;if(Bs(t,e),$s(e),r&512&&(kr||n===null||Fo(n,n.return)),r&4){var i=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,s=s.ownerDocument||s;t:switch(r){case"title":i=s.getElementsByTagName("title")[0],(!i||i[J0]||i[ts]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),is(i,r,n),i[ts]=e,Vr(i),r=i;break e;case"link":var o=ak("link","href",s).get(r+(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=s.createElement(r),is(i,r,n),s.head.appendChild(i);break;case"meta":if(o=ak("meta","content",s).get(r+(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=s.createElement(r),is(i,r,n),s.head.appendChild(i);break;default:throw Error(pe(468,r))}i[ts]=e,Vr(i),r=i}e.stateNode=r}else lk(s,e.type,e.stateNode);else e.stateNode=ok(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?lk(s,e.type,e.stateNode):ok(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&n2(e,e.memoizedProps,n.memoizedProps)}break;case 27:Bs(t,e),$s(e),r&512&&(kr||n===null||Fo(n,n.return)),n!==null&&r&4&&n2(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Bs(t,e),$s(e),r&512&&(kr||n===null||Fo(n,n.return)),e.flags&32){s=e.stateNode;try{Vd(s,"")}catch(p){An(e,e.return,p)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,n2(e,s,n!==null?n.memoizedProps:s)),r&1024&&(s2=!0);break;case 6:if(Bs(t,e),$s(e),r&4){if(e.stateNode===null)throw Error(pe(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(p){An(e,e.return,p)}}break;case 3:if(rg=null,s=co,co=Jg(t.containerInfo),Bs(t,e),co=s,$s(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Zd(t.containerInfo)}catch(p){An(e,e.return,p)}s2&&(s2=!1,aM(e));break;case 4:r=co,co=Jg(e.stateNode.containerInfo),Bs(t,e),$s(e),co=r;break;case 12:Bs(t,e),$s(e);break;case 31:Bs(t,e),$s(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Gm(e,r)));break;case 13:Bs(t,e),$s(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(my=mi()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Gm(e,r)));break;case 22:s=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=Ca,u=kr;if(Ca=c||s,kr=u||l,Bs(t,e),kr=u,Ca=c,$s(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||l||Ca||kr||Gc(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(i=l.stateNode,s)o=i.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{a=l.stateNode;var d=l.memoizedProps.style,f=d!=null&&d.hasOwnProperty("display")?d.display:null;a.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(p){An(l,l.return,p)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(p){An(l,l.return,p)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;s?tk(m,!0):tk(l.stateNode,!1)}catch(p){An(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}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,Gm(e,n))));break;case 19:Bs(t,e),$s(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Gm(e,r)));break;case 30:break;case 21:break;default:Bs(t,e),$s(e)}}function $s(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(ZE(r)){n=r;break}r=r.return}if(n==null)throw Error(pe(160));switch(n.tag){case 27:var s=n.stateNode,i=r2(e);Hg(e,i,s);break;case 5:var o=n.stateNode;n.flags&32&&(Vd(o,""),n.flags&=-33);var a=r2(e);Hg(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=r2(e);Px(e,c,l);break;default:throw Error(pe(161))}}catch(u){An(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function aM(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;aM(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ga(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)tM(e,t.alternate,t),t=t.sibling}function Gc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:tc(4,t,t.return),Gc(t);break;case 1:Fo(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&QE(t,t.return,n),Gc(t);break;case 27:Gf(t.stateNode);case 26:case 5:Fo(t,t.return),Gc(t);break;case 22:t.memoizedState===null&&Gc(t);break;case 30:Gc(t);break;default:Gc(t)}e=e.sibling}}function _a(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,s=e,i=t,o=i.flags;switch(i.tag){case 0:case 11:case 15:_a(s,i,n),nm(4,i);break;case 1:if(_a(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(c){An(r,r.return,c)}if(r=i,s=r.updateQueue,s!==null){var a=r.stateNode;try{var l=s.shared.hiddenCallbacks;if(l!==null)for(s.shared.hiddenCallbacks=null,s=0;s<l.length;s++)sE(l[s],a)}catch(c){An(r,r.return,c)}}n&&o&64&&XE(i),Uf(i,i.return);break;case 27:eM(i);case 26:case 5:_a(s,i,n),n&&r===null&&o&4&&JE(i),Uf(i,i.return);break;case 12:_a(s,i,n);break;case 31:_a(s,i,n),n&&o&4&&sM(s,i);break;case 13:_a(s,i,n),n&&o&4&&iM(s,i);break;case 22:i.memoizedState===null&&_a(s,i,n),Uf(i,i.return);break;case 30:break;default:_a(s,i,n)}t=t.sibling}}function X3(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&&em(n))}function Q3(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&em(e))}function io(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)lM(e,t,n,r),t=t.sibling}function lM(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:io(e,t,n,r),s&2048&&nm(9,t);break;case 1:io(e,t,n,r);break;case 3:io(e,t,n,r),s&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&em(e)));break;case 12:if(s&2048){io(e,t,n,r),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){An(t,t.return,l)}}else io(e,t,n,r);break;case 31:io(e,t,n,r);break;case 13:io(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?io(e,t,n,r):Hf(e,t):i._visibility&2?io(e,t,n,r):(i._visibility|=2,sd(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&X3(o,t);break;case 24:io(e,t,n,r),s&2048&&Q3(t.alternate,t);break;default:io(e,t,n,r)}}function sd(e,t,n,r,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,o=t,a=n,l=r,c=o.flags;switch(o.tag){case 0:case 11:case 15:sd(i,o,a,l,s),nm(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState!==null?u._visibility&2?sd(i,o,a,l,s):Hf(i,o):(u._visibility|=2,sd(i,o,a,l,s)),s&&c&2048&&X3(o.alternate,o);break;case 24:sd(i,o,a,l,s),s&&c&2048&&Q3(o.alternate,o);break;default:sd(i,o,a,l,s)}t=t.sibling}}function Hf(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,s=r.flags;switch(r.tag){case 22:Hf(n,r),s&2048&&X3(r.alternate,r);break;case 24:Hf(n,r),s&2048&&Q3(r.alternate,r);break;default:Hf(n,r)}t=t.sibling}}var _f=8192;function Qu(e,t,n){if(e.subtreeFlags&_f)for(e=e.child;e!==null;)cM(e,t,n),e=e.sibling}function cM(e,t,n){switch(e.tag){case 26:Qu(e,t,n),e.flags&_f&&e.memoizedState!==null&&TP(n,co,e.memoizedState,e.memoizedProps);break;case 5:Qu(e,t,n);break;case 3:case 4:var r=co;co=Jg(e.stateNode.containerInfo),Qu(e,t,n),co=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=_f,_f=16777216,Qu(e,t,n),_f=r):Qu(e,t,n));break;default:Qu(e,t,n)}}function uM(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 Jh(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Hr=r,hM(r,e)}uM(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)dM(e),e=e.sibling}function dM(e){switch(e.tag){case 0:case 11:case 15:Jh(e),e.flags&2048&&tc(9,e,e.return);break;case 3:Jh(e);break;case 12:Jh(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,tg(e)):Jh(e);break;default:Jh(e)}}function tg(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Hr=r,hM(r,e)}uM(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:tc(8,t,t.return),tg(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,tg(t));break;default:tg(t)}e=e.sibling}}function hM(e,t){for(;Hr!==null;){var n=Hr;switch(n.tag){case 0:case 11:case 15:tc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:em(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Hr=r;else e:for(n=e;Hr!==null;){r=Hr;var s=r.sibling,i=r.return;if(nM(r),r===n){Hr=null;break e}if(s!==null){s.return=i,Hr=s;break e}Hr=i}}}var Pz={getCacheForType:function(e){var t=rs(Tr),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return rs(Tr).controller.signal}},qz=typeof WeakMap=="function"?WeakMap:Map,yn=0,Dn=null,Qt=null,tn=0,Tn=0,ai=null,Rl=!1,wh=!1,J3=!1,Va=0,dr=0,nc=0,hu=0,Z3=0,hi=0,Yd=0,Vf=null,Us=null,qx=!1,my=0,fM=0,Vg=1/0,Wg=null,Hl=null,Dr=0,Vl=null,Xd=null,Ba=0,Fx=0,Ux=null,mM=null,Wf=0,Hx=null;function yi(){return yn&2&&tn!==0?tn&-tn:Mt.T!==null?t5():kA()}function pM(){if(hi===0)if(!(tn&536870912)||ln){var e=zm;zm<<=1,!(zm&3932160)&&(zm=262144),hi=e}else hi=536870912;return e=vi.current,e!==null&&(e.flags|=32),hi}function Ks(e,t,n){(e===Dn&&(Tn===2||Tn===9)||e.cancelPendingCommit!==null)&&(Qd(e,0),jl(e,tn,hi,!1)),Q0(e,n),(!(yn&2)||e!==Dn)&&(e===Dn&&(!(yn&2)&&(hu|=n),dr===4&&jl(e,tn,hi,!1)),Qo(e))}function gM(e,t,n){if(yn&6)throw Error(pe(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||X0(e,t),s=r?Hz(e,t):i2(e,t,!0),i=r;do{if(s===0){wh&&!r&&jl(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Fz(n)){s=i2(e,t,!1),i=!1;continue}if(s===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;s=Vf;var l=a.current.memoizedState.isDehydrated;if(l&&(Qd(a,o).flags|=256),o=i2(a,o,!1),o!==2){if(J3&&!l){a.errorRecoveryDisabledLanes|=i,hu|=i,s=4;break e}i=Us,Us=s,i!==null&&(Us===null?Us=i:Us.push.apply(Us,i))}s=o}if(i=!1,s!==2)continue}}if(s===1){Qd(e,0),jl(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(pe(345));case 4:if((t&4194048)!==t)break;case 6:jl(r,t,hi,!Rl);break e;case 2:Us=null;break;case 3:case 5:break;default:throw Error(pe(329))}if((t&62914560)===t&&(s=my+300-mi(),10<s)){if(jl(r,t,hi,!Rl),ry(r,0,!0)!==0)break e;Ba=t,r.timeoutHandle=OM(F8.bind(null,r,n,Us,Wg,qx,t,hi,hu,Yd,Rl,i,"Throttled",-0,0),s);break e}F8(r,n,Us,Wg,qx,t,hi,hu,Yd,Rl,i,null,-0,0)}}break}while(!0);Qo(e)}function F8(e,t,n,r,s,i,o,a,l,c,u,d,f,m){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)===16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Na},cM(t,i,d);var p=(i&62914560)===i?my-mi():(i&4194048)===i?fM-mi():0;if(p=CP(d,p),p!==null){Ba=i,e.cancelPendingCommit=p(H8.bind(null,e,t,i,n,r,s,o,a,l,u,d,null,f,m)),jl(e,i,o,!c);return}}H8(e,t,i,n,r,s,o,a,l)}function Fz(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 r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!wi(i(),s))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 jl(e,t,n,r){t&=~Z3,t&=~hu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-gi(s),o=1<<i;r[i]=-1,s&=~o}n!==0&&wA(e,n,t)}function py(){return yn&6?!0:(rm(0),!1)}function e5(){if(Qt!==null){if(Tn===0)var e=Qt.return;else e=Qt,Ia=Du=null,z3(e),Rd=null,y0=0,e=Qt;for(;e!==null;)YE(e.alternate,e),e=e.return;Qt=null}}function Qd(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,lP(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ba=0,e5(),Dn=e,Qt=n=Da(e.current,null),tn=t,Tn=0,ai=null,Rl=!1,wh=X0(e,t),J3=!1,Yd=hi=Z3=hu=nc=dr=0,Us=Vf=null,qx=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var s=31-gi(r),i=1<<s;t|=e[s],r&=~i}return Va=t,ay(),n}function yM(e,t){$t=null,Mt.H=x0,t===xh||t===cy?(t=w8(),Tn=3):t===R3?(t=w8(),Tn=4):Tn=t===K3?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,ai=t,Qt===null&&(dr=1,Fg(e,qi(t,e.current)))}function bM(){var e=vi.current;return e===null?!0:(tn&4194048)===tn?Gi===null:(tn&62914560)===tn||tn&536870912?e===Gi:!1}function xM(){var e=Mt.H;return Mt.H=x0,e===null?x0:e}function wM(){var e=Mt.A;return Mt.A=Pz,e}function Gg(){dr=4,Rl||(tn&4194048)!==tn&&vi.current!==null||(wh=!0),!(nc&134217727)&&!(hu&134217727)||Dn===null||jl(Dn,tn,hi,!1)}function i2(e,t,n){var r=yn;yn|=2;var s=xM(),i=wM();(Dn!==e||tn!==t)&&(Wg=null,Qd(e,t)),t=!1;var o=dr;e:do try{if(Tn!==0&&Qt!==null){var a=Qt,l=ai;switch(Tn){case 8:e5(),o=6;break e;case 3:case 2:case 9:case 6:vi.current===null&&(t=!0);var c=Tn;if(Tn=0,ai=null,vd(e,a,l,c),n&&wh){o=0;break e}break;default:c=Tn,Tn=0,ai=null,vd(e,a,l,c)}}Uz(),o=dr;break}catch(u){yM(e,u)}while(!0);return t&&e.shellSuspendCounter++,Ia=Du=null,yn=r,Mt.H=s,Mt.A=i,Qt===null&&(Dn=null,tn=0,ay()),o}function Uz(){for(;Qt!==null;)vM(Qt)}function Hz(e,t){var n=yn;yn|=2;var r=xM(),s=wM();Dn!==e||tn!==t?(Wg=null,Vg=mi()+500,Qd(e,t)):wh=X0(e,t);e:do try{if(Tn!==0&&Qt!==null){t=Qt;var i=ai;t:switch(Tn){case 1:Tn=0,ai=null,vd(e,t,i,1);break;case 2:case 9:if(x8(i)){Tn=0,ai=null,U8(t);break}t=function(){Tn!==2&&Tn!==9||Dn!==e||(Tn=7),Qo(e)},i.then(t,t);break e;case 3:Tn=7;break e;case 4:Tn=5;break e;case 7:x8(i)?(Tn=0,ai=null,U8(t)):(Tn=0,ai=null,vd(e,t,i,7));break;case 5:var o=null;switch(Qt.tag){case 26:o=Qt.memoizedState;case 5:case 27:var a=Qt;if(o?qM(o):a.stateNode.complete){Tn=0,ai=null;var l=a.sibling;if(l!==null)Qt=l;else{var c=a.return;c!==null?(Qt=c,gy(c)):Qt=null}break t}}Tn=0,ai=null,vd(e,t,i,5);break;case 6:Tn=0,ai=null,vd(e,t,i,6);break;case 8:e5(),dr=6;break e;default:throw Error(pe(462))}}Vz();break}catch(u){yM(e,u)}while(!0);return Ia=Du=null,Mt.H=r,Mt.A=s,yn=n,Qt!==null?0:(Dn=null,tn=0,ay(),dr)}function Vz(){for(;Qt!==null&&!m$();)vM(Qt)}function vM(e){var t=KE(e.alternate,e,Va);e.memoizedProps=e.pendingProps,t===null?gy(e):Qt=t}function U8(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=O8(n,t,t.pendingProps,t.type,void 0,tn);break;case 11:t=O8(n,t,t.pendingProps,t.type.render,t.ref,tn);break;case 5:z3(t);default:YE(n,t),t=Qt=YA(t,Va),t=KE(n,t,Va)}e.memoizedProps=e.pendingProps,t===null?gy(e):Qt=t}function vd(e,t,n,r){Ia=Du=null,z3(t),Rd=null,y0=0;var s=t.return;try{if(jz(e,s,t,n,tn)){dr=1,Fg(e,qi(n,e.current)),Qt=null;return}}catch(i){if(s!==null)throw Qt=s,i;dr=1,Fg(e,qi(n,e.current)),Qt=null;return}t.flags&32768?(ln||r===1?e=!0:wh||tn&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=vi.current,r!==null&&r.tag===13&&(r.flags|=16384))),_M(t,e)):gy(t)}function gy(e){var t=e;do{if(t.flags&32768){_M(t,Rl);return}e=t.return;var n=Oz(t.alternate,t,Va);if(n!==null){Qt=n;return}if(t=t.sibling,t!==null){Qt=t;return}Qt=t=e}while(t!==null);dr===0&&(dr=5)}function _M(e,t){do{var n=Bz(e.alternate,e);if(n!==null){n.flags&=32767,Qt=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Qt=e;return}Qt=e=n}while(e!==null);dr=6,Qt=null}function H8(e,t,n,r,s,i,o,a,l){e.cancelPendingCommit=null;do yy();while(Dr!==0);if(yn&6)throw Error(pe(327));if(t!==null){if(t===e.current)throw Error(pe(177));if(i=t.lanes|t.childLanes,i|=T3,S$(e,n,i,o,a,l),e===Dn&&(Qt=Dn=null,tn=0),Xd=t,Vl=e,Ba=n,Fx=i,Ux=s,mM=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Yz(Ig,function(){return AM(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=Mt.T,Mt.T=null,s=xn.p,xn.p=2,o=yn,yn|=4;try{$z(e,t,n)}finally{yn=o,xn.p=s,Mt.T=r}}Dr=1,kM(),SM(),TM()}}function kM(){if(Dr===1){Dr=0;var e=Vl,t=Xd,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Mt.T,Mt.T=null;var r=xn.p;xn.p=2;var s=yn;yn|=4;try{oM(t,e);var i=Kx,o=qA(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&PA(a.ownerDocument.documentElement,a)){if(l!==null&&S3(a)){var c=l.start,u=l.end;if(u===void 0&&(u=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(u,a.value.length);else{var d=a.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var m=f.getSelection(),p=a.textContent.length,y=Math.min(l.start,p),v=l.end===void 0?y:Math.min(l.end,p);!m.extend&&y>v&&(o=v,v=y,y=o);var b=h8(a,y),x=h8(a,v);if(b&&x&&(m.rangeCount!==1||m.anchorNode!==b.node||m.anchorOffset!==b.offset||m.focusNode!==x.node||m.focusOffset!==x.offset)){var w=d.createRange();w.setStart(b.node,b.offset),m.removeAllRanges(),y>v?(m.addRange(w),m.extend(x.node,x.offset)):(w.setEnd(x.node,x.offset),m.addRange(w))}}}}for(d=[],m=a;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<d.length;a++){var k=d[a];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}t1=!!Gx,Kx=Gx=null}finally{yn=s,xn.p=r,Mt.T=n}}e.current=t,Dr=2}}function SM(){if(Dr===2){Dr=0;var e=Vl,t=Xd,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Mt.T,Mt.T=null;var r=xn.p;xn.p=2;var s=yn;yn|=4;try{tM(e,t.alternate,t)}finally{yn=s,xn.p=r,Mt.T=n}}Dr=3}}function TM(){if(Dr===4||Dr===3){Dr=0,p$();var e=Vl,t=Xd,n=Ba,r=mM;t.subtreeFlags&10256||t.flags&10256?Dr=5:(Dr=0,Xd=Vl=null,CM(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Hl=null),y3(n),t=t.stateNode,pi&&typeof pi.onCommitFiberRoot=="function")try{pi.onCommitFiberRoot(Y0,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=Mt.T,s=xn.p,xn.p=2,Mt.T=null;try{for(var i=e.onRecoverableError,o=0;o<r.length;o++){var a=r[o];i(a.value,{componentStack:a.stack})}}finally{Mt.T=t,xn.p=s}}Ba&3&&yy(),Qo(e),s=e.pendingLanes,n&261930&&s&42?e===Hx?Wf++:(Wf=0,Hx=e):Wf=0,rm(0)}}function CM(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,em(t)))}function yy(){return kM(),SM(),TM(),AM()}function AM(){if(Dr!==5)return!1;var e=Vl,t=Fx;Fx=0;var n=y3(Ba),r=Mt.T,s=xn.p;try{xn.p=32>n?32:n,Mt.T=null,n=Ux,Ux=null;var i=Vl,o=Ba;if(Dr=0,Xd=Vl=null,Ba=0,yn&6)throw Error(pe(331));var a=yn;if(yn|=4,dM(i.current),lM(i,i.current,o,n),yn=a,rm(0,!1),pi&&typeof pi.onPostCommitFiberRoot=="function")try{pi.onPostCommitFiberRoot(Y0,i)}catch{}return!0}finally{xn.p=s,Mt.T=r,CM(e,t)}}function V8(e,t,n){t=qi(n,t),t=Bx(e.stateNode,t,2),e=Ul(e,t,2),e!==null&&(Q0(e,2),Qo(e))}function An(e,t,n){if(e.tag===3)V8(e,e,n);else for(;t!==null;){if(t.tag===3){V8(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Hl===null||!Hl.has(r))){e=qi(n,e),n=FE(2),r=Ul(t,n,2),r!==null&&(UE(n,r,t,e),Q0(r,2),Qo(r));break}}t=t.return}}function o2(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new qz;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(J3=!0,s.add(n),e=Wz.bind(null,e,t,n),t.then(e,e))}function Wz(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Dn===e&&(tn&n)===n&&(dr===4||dr===3&&(tn&62914560)===tn&&300>mi()-my?!(yn&2)&&Qd(e,0):Z3|=n,Yd===tn&&(Yd=0)),Qo(e)}function EM(e,t){t===0&&(t=xA()),e=Lu(e,t),e!==null&&(Q0(e,t),Qo(e))}function Gz(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),EM(e,n)}function Kz(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(pe(314))}r!==null&&r.delete(t),EM(e,n)}function Yz(e,t){return p3(e,t)}var Kg=null,id=null,Vx=!1,Yg=!1,a2=!1,Ll=0;function Qo(e){e!==id&&e.next===null&&(id===null?Kg=id=e:id=id.next=e),Yg=!0,Vx||(Vx=!0,Qz())}function rm(e,t){if(!a2&&Yg){a2=!0;do for(var n=!1,r=Kg;r!==null;){if(e!==0){var s=r.pendingLanes;if(s===0)var i=0;else{var o=r.suspendedLanes,a=r.pingedLanes;i=(1<<31-gi(42|e)+1)-1,i&=s&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,W8(r,i))}else i=tn,i=ry(r,r===Dn?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||X0(r,i)||(n=!0,W8(r,i));r=r.next}while(n);a2=!1}}function Xz(){MM()}function MM(){Yg=Vx=!1;var e=0;Ll!==0&&aP()&&(e=Ll);for(var t=mi(),n=null,r=Kg;r!==null;){var s=r.next,i=NM(r,t);i===0?(r.next=null,n===null?Kg=s:n.next=s,s===null&&(id=n)):(n=r,(e!==0||i&3)&&(Yg=!0)),r=s}Dr!==0&&Dr!==5||rm(e),Ll!==0&&(Ll=0)}function NM(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-gi(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=k$(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=Dn,n=tn,n=ry(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Tn===2||Tn===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Db(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||X0(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Db(r),y3(n)){case 2:case 8:n=yA;break;case 32:n=Ig;break;case 268435456:n=bA;break;default:n=Ig}return r=IM.bind(null,e),n=p3(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Db(r),e.callbackPriority=2,e.callbackNode=null,2}function IM(e,t){if(Dr!==0&&Dr!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(yy()&&e.callbackNode!==n)return null;var r=tn;return r=ry(e,e===Dn?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(gM(e,r,t),NM(e,mi()),e.callbackNode!=null&&e.callbackNode===n?IM.bind(null,e):null)}function W8(e,t){if(yy())return null;gM(e,t,!0)}function Qz(){cP(function(){yn&6?p3(gA,Xz):MM()})}function t5(){if(Ll===0){var e=Wd;e===0&&(e=$m,$m<<=1,!($m&261888)&&($m=256)),Ll=e}return Ll}function G8(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Wp(""+e)}function K8(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 Jz(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=G8((s[Xs]||null).action),o=r.submitter;o&&(t=(t=o[Xs]||null)?G8(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new sy("action","action",null,r,s);e.push({event:a,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Ll!==0){var l=o?K8(s,o):new FormData(s);Dx(n,{pending:!0,data:l,method:s.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?K8(s,o):new FormData(s),Dx(n,{pending:!0,data:l,method:s.method,action:i},i,l))},currentTarget:s}]})}}for(var l2=0;l2<kx.length;l2++){var c2=kx[l2],Zz=c2.toLowerCase(),eP=c2[0].toUpperCase()+c2.slice(1);go(Zz,"on"+eP)}go(UA,"onAnimationEnd");go(HA,"onAnimationIteration");go(VA,"onAnimationStart");go("dblclick","onDoubleClick");go("focusin","onFocus");go("focusout","onBlur");go(gz,"onTransitionRun");go(yz,"onTransitionStart");go(bz,"onTransitionCancel");go(WA,"onTransitionEnd");Hd("onMouseEnter",["mouseout","mouseover"]);Hd("onMouseLeave",["mouseout","mouseover"]);Hd("onPointerEnter",["pointerout","pointerover"]);Hd("onPointerLeave",["pointerout","pointerover"]);Iu("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Iu("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Iu("onBeforeInput",["compositionend","keypress","textInput","paste"]);Iu("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Iu("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Iu("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var w0="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(" "),tP=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(w0));function RM(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=c;try{i(s)}catch(u){jg(u)}s.currentTarget=null,i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=c;try{i(s)}catch(u){jg(u)}s.currentTarget=null,i=l}}}}function Xt(e,t){var n=t[px];n===void 0&&(n=t[px]=new Set);var r=e+"__bubble";n.has(r)||(jM(t,e,2,!1),n.add(r))}function u2(e,t,n){var r=0;t&&(r|=4),jM(n,e,r,t)}var Km="_reactListening"+Math.random().toString(36).slice(2);function n5(e){if(!e[Km]){e[Km]=!0,SA.forEach(function(n){n!=="selectionchange"&&(tP.has(n)||u2(n,!1,e),u2(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Km]||(t[Km]=!0,u2("selectionchange",!1,t))}}function jM(e,t,n,r){switch(WM(t)){case 2:var s=MP;break;case 8:s=NP;break;default:s=o5}n=s.bind(null,t,n,e),s=void 0,!wx||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function d2(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===s)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===s)return;o=o.return}for(;a!==null;){if(o=hd(a),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=i=o;continue e}a=a.parentNode}}r=r.return}RA(function(){var c=i,u=w3(n),d=[];e:{var f=GA.get(e);if(f!==void 0){var m=sy,p=e;switch(e){case"keypress":if(Kp(n)===0)break e;case"keydown":case"keyup":m=K$;break;case"focusin":p="focus",m=Pb;break;case"focusout":p="blur",m=Pb;break;case"beforeblur":case"afterblur":m=Pb;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=n8;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=O$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Q$;break;case UA:case HA:case VA:m=z$;break;case WA:m=Z$;break;case"scroll":case"scrollend":m=L$;break;case"wheel":m=tz;break;case"copy":case"cut":case"paste":m=q$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=s8;break;case"toggle":case"beforetoggle":m=rz}var y=(t&4)!==0,v=!y&&(e==="scroll"||e==="scrollend"),b=y?f!==null?f+"Capture":null:f;y=[];for(var x=c,w;x!==null;){var k=x;if(w=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||w===null||b===null||(k=h0(x,b),k!=null&&y.push(v0(x,k,w))),v)break;x=x.return}0<y.length&&(f=new m(f,p,null,n,u),d.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",f&&n!==xx&&(p=n.relatedTarget||n.fromElement)&&(hd(p)||p[gh]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(p=n.relatedTarget||n.toElement,m=c,p=p?hd(p):null,p!==null&&(v=K0(p),y=p.tag,p!==v||y!==5&&y!==27&&y!==6)&&(p=null)):(m=null,p=c),m!==p)){if(y=n8,k="onMouseLeave",b="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(y=s8,k="onPointerLeave",b="onPointerEnter",x="pointer"),v=m==null?f:wf(m),w=p==null?f:wf(p),f=new y(k,x+"leave",m,n,u),f.target=v,f.relatedTarget=w,k=null,hd(u)===c&&(y=new y(b,x+"enter",p,n,u),y.target=w,y.relatedTarget=v,k=y),v=k,m&&p)t:{for(y=nP,b=m,x=p,w=0,k=b;k;k=y(k))w++;k=0;for(var T=x;T;T=y(T))k++;for(;0<w-k;)b=y(b),w--;for(;0<k-w;)x=y(x),k--;for(;w--;){if(b===x||x!==null&&b===x.alternate){y=b;break t}b=y(b),x=y(x)}y=null}else y=null;m!==null&&Y8(d,f,m,y,!1),p!==null&&v!==null&&Y8(d,v,p,y,!0)}}e:{if(f=c?wf(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var C=l8;else if(a8(f))if($A)C=fz;else{C=dz;var A=uz}else m=f.nodeName,!m||m.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&x3(c.elementType)&&(C=l8):C=hz;if(C&&(C=C(e,c))){BA(d,C,n,u);break e}A&&A(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&bx(f,"number",f.value)}switch(A=c?wf(c):window,e){case"focusin":(a8(A)||A.contentEditable==="true")&&(pd=A,vx=c,Bf=null);break;case"focusout":Bf=vx=pd=null;break;case"mousedown":_x=!0;break;case"contextmenu":case"mouseup":case"dragend":_x=!1,f8(d,n,u);break;case"selectionchange":if(pz)break;case"keydown":case"keyup":f8(d,n,u)}var L;if(k3)e:{switch(e){case"compositionstart":var $="onCompositionStart";break e;case"compositionend":$="onCompositionEnd";break e;case"compositionupdate":$="onCompositionUpdate";break e}$=void 0}else md?DA(e,n)&&($="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&($="onCompositionStart");$&&(LA&&n.locale!=="ko"&&(md||$!=="onCompositionStart"?$==="onCompositionEnd"&&md&&(L=jA()):(Il=u,v3="value"in Il?Il.value:Il.textContent,md=!0)),A=Xg(c,$),0<A.length&&($=new r8($,e,null,n,u),d.push({event:$,listeners:A}),L?$.data=L:(L=OA(n),L!==null&&($.data=L)))),(L=iz?oz(e,n):az(e,n))&&($=Xg(c,"onBeforeInput"),0<$.length&&(A=new r8("onBeforeInput","beforeinput",null,n,u),d.push({event:A,listeners:$}),A.data=L)),Jz(d,e,c,n,u)}RM(d,t)})}function v0(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Xg(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||i===null||(s=h0(e,n),s!=null&&r.unshift(v0(e,s,i)),s=h0(e,t),s!=null&&r.push(v0(e,s,i))),e.tag===3)return r;e=e.return}return[]}function nP(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Y8(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(a=a.tag,l!==null&&l===r)break;a!==5&&a!==26&&a!==27||c===null||(l=c,s?(c=h0(n,i),c!=null&&o.unshift(v0(n,c,l))):s||(c=h0(n,i),c!=null&&o.push(v0(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var rP=/\r\n?/g,sP=/\u0000|\uFFFD/g;function X8(e){return(typeof e=="string"?e:""+e).replace(rP,`
`).replace(sP,"")}function LM(e,t){return t=X8(t),X8(e)===t}function En(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||Vd(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&Vd(e,""+r);break;case"className":qm(e,"class",r);break;case"tabIndex":qm(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":qm(e,n,r);break;case"style":IA(e,r,i);break;case"data":if(t!=="object"){qm(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Wp(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="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"&&En(e,t,"name",s.name,s,null),En(e,t,"formEncType",s.formEncType,s,null),En(e,t,"formMethod",s.formMethod,s,null),En(e,t,"formTarget",s.formTarget,s,null)):(En(e,t,"encType",s.encType,s,null),En(e,t,"method",s.method,s,null),En(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Wp(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Na);break;case"onScroll":r!=null&&Xt("scroll",e);break;case"onScrollEnd":r!=null&&Xt("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(pe(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(pe(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=Wp(""+r),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":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Xt("beforetoggle",e),Xt("toggle",e),Vp(e,"popover",r);break;case"xlinkActuate":fa(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":fa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":fa(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":fa(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":fa(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":fa(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":fa(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":fa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":fa(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Vp(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=R$.get(n)||n,Vp(e,n,r))}}function Wx(e,t,n,r,s,i){switch(n){case"style":IA(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(pe(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(pe(60));e.innerHTML=n}}break;case"children":typeof r=="string"?Vd(e,r):(typeof r=="number"||typeof r=="bigint")&&Vd(e,""+r);break;case"onScroll":r!=null&&Xt("scroll",e);break;case"onScrollEnd":r!=null&&Xt("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Na);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!TA.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),t=n.slice(2,s?n.length-7:void 0),i=e[Xs]||null,i=i!=null?i[n]:null,typeof i=="function"&&e.removeEventListener(t,i,s),typeof r=="function")){typeof i!="function"&&i!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,s);break e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):Vp(e,n,r)}}}function is(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Xt("error",e),Xt("load",e);var r=!1,s=!1,i;for(i in n)if(n.hasOwnProperty(i)){var o=n[i];if(o!=null)switch(i){case"src":r=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(pe(137,t));default:En(e,t,i,o,n,null)}}s&&En(e,t,"srcSet",n.srcSet,n,null),r&&En(e,t,"src",n.src,n,null);return;case"input":Xt("invalid",e);var a=i=o=s=null,l=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var u=n[r];if(u!=null)switch(r){case"name":s=u;break;case"type":o=u;break;case"checked":l=u;break;case"defaultChecked":c=u;break;case"value":i=u;break;case"defaultValue":a=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(pe(137,t));break;default:En(e,t,r,u,n,null)}}EA(e,i,a,l,c,o,s,!1);return;case"select":Xt("invalid",e),r=o=i=null;for(s in n)if(n.hasOwnProperty(s)&&(a=n[s],a!=null))switch(s){case"value":i=a;break;case"defaultValue":o=a;break;case"multiple":r=a;default:En(e,t,s,a,n,null)}t=i,n=o,e.multiple=!!r,t!=null?Md(e,!!r,t,!1):n!=null&&Md(e,!!r,n,!0);return;case"textarea":Xt("invalid",e),i=s=r=null;for(o in n)if(n.hasOwnProperty(o)&&(a=n[o],a!=null))switch(o){case"value":r=a;break;case"defaultValue":s=a;break;case"children":i=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(pe(91));break;default:En(e,t,o,a,n,null)}NA(e,r,s,i);return;case"option":for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:En(e,t,l,r,n,null)}return;case"dialog":Xt("beforetoggle",e),Xt("toggle",e),Xt("cancel",e),Xt("close",e);break;case"iframe":case"object":Xt("load",e);break;case"video":case"audio":for(r=0;r<w0.length;r++)Xt(w0[r],e);break;case"image":Xt("error",e),Xt("load",e);break;case"details":Xt("toggle",e);break;case"embed":case"source":case"link":Xt("error",e),Xt("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)&&(r=n[c],r!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(pe(137,t));default:En(e,t,c,r,n,null)}return;default:if(x3(t)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&Wx(e,t,u,r,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null&&En(e,t,a,r,n,null))}function iP(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,i=null,o=null,a=null,l=null,c=null,u=null;for(m in n){var d=n[m];if(n.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=d;default:r.hasOwnProperty(m)||En(e,t,m,null,r,d)}}for(var f in r){var m=r[f];if(d=n[f],r.hasOwnProperty(f)&&(m!=null||d!=null))switch(f){case"type":i=m;break;case"name":s=m;break;case"checked":c=m;break;case"defaultChecked":u=m;break;case"value":o=m;break;case"defaultValue":a=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(pe(137,t));break;default:m!==d&&En(e,t,f,m,r,d)}}yx(e,o,a,l,c,u,i,s);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:r.hasOwnProperty(i)||En(e,t,i,null,r,l)}for(s in r)if(i=r[s],l=n[s],r.hasOwnProperty(s)&&(i!=null||l!=null))switch(s){case"value":f=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==l&&En(e,t,s,i,r,l)}t=a,n=o,r=m,f!=null?Md(e,!!n,f,!1):!!r!=!!n&&(t!=null?Md(e,!!n,t,!0):Md(e,!!n,n?[]:"",!1));return;case"textarea":m=f=null;for(a in n)if(s=n[a],n.hasOwnProperty(a)&&s!=null&&!r.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:En(e,t,a,null,r,s)}for(o in r)if(s=r[o],i=n[o],r.hasOwnProperty(o)&&(s!=null||i!=null))switch(o){case"value":f=s;break;case"defaultValue":m=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(pe(91));break;default:s!==i&&En(e,t,o,s,r,i)}MA(e,f,m);return;case"option":for(var p in n)if(f=n[p],n.hasOwnProperty(p)&&f!=null&&!r.hasOwnProperty(p))switch(p){case"selected":e.selected=!1;break;default:En(e,t,p,null,r,f)}for(l in r)if(f=r[l],m=n[l],r.hasOwnProperty(l)&&f!==m&&(f!=null||m!=null))switch(l){case"selected":e.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:En(e,t,l,f,r,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&&!r.hasOwnProperty(y)&&En(e,t,y,null,r,f);for(c in r)if(f=r[c],m=n[c],r.hasOwnProperty(c)&&f!==m&&(f!=null||m!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(pe(137,t));break;default:En(e,t,c,f,r,m)}return;default:if(x3(t)){for(var v in n)f=n[v],n.hasOwnProperty(v)&&f!==void 0&&!r.hasOwnProperty(v)&&Wx(e,t,v,void 0,r,f);for(u in r)f=r[u],m=n[u],!r.hasOwnProperty(u)||f===m||f===void 0&&m===void 0||Wx(e,t,u,f,r,m);return}}for(var b in n)f=n[b],n.hasOwnProperty(b)&&f!=null&&!r.hasOwnProperty(b)&&En(e,t,b,null,r,f);for(d in r)f=r[d],m=n[d],!r.hasOwnProperty(d)||f===m||f==null&&m==null||En(e,t,d,f,r,m)}function Q8(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function oP(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var s=n[r],i=s.transferSize,o=s.initiatorType,a=s.duration;if(i&&a&&Q8(o)){for(o=0,a=s.responseEnd,r+=1;r<n.length;r++){var l=n[r],c=l.startTime;if(c>a)break;var u=l.transferSize,d=l.initiatorType;u&&Q8(d)&&(l=l.responseEnd,o+=u*(l<a?1:(a-c)/(l-c)))}if(--r,t+=8*(i+o)/(s.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 Gx=null,Kx=null;function Qg(e){return e.nodeType===9?e:e.ownerDocument}function J8(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 DM(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 Yx(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 h2=null;function aP(){var e=window.event;return e&&e.type==="popstate"?e===h2?!1:(h2=e,!0):(h2=null,!1)}var OM=typeof setTimeout=="function"?setTimeout:void 0,lP=typeof clearTimeout=="function"?clearTimeout:void 0,Z8=typeof Promise=="function"?Promise:void 0,cP=typeof queueMicrotask=="function"?queueMicrotask:typeof Z8<"u"?function(e){return Z8.resolve(null).then(e).catch(uP)}:OM;function uP(e){setTimeout(function(){throw e})}function pc(e){return e==="head"}function ek(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(s),Zd(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Gf(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Gf(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[J0]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&Gf(e.ownerDocument.body);n=s}while(n);Zd(t)}function tk(e,t){var n=e;e=0;do{var r=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||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function Xx(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":Xx(n),b3(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function dP(e,t,n,r){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[J0])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!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=Ki(e.nextSibling),e===null)break}return null}function hP(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ki(e.nextSibling),e===null))return null;return e}function BM(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ki(e.nextSibling),e===null))return null;return e}function Qx(e){return e.data==="$?"||e.data==="$~"}function Jx(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function fP(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Ki(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 Zx=null;function nk(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ki(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function rk(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 $M(e,t,n){switch(t=Qg(n),e){case"html":if(e=t.documentElement,!e)throw Error(pe(452));return e;case"head":if(e=t.head,!e)throw Error(pe(453));return e;case"body":if(e=t.body,!e)throw Error(pe(454));return e;default:throw Error(pe(451))}}function Gf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);b3(e)}var Xi=new Map,sk=new Set;function Jg(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Xa=xn.d;xn.d={f:mP,r:pP,D:gP,C:yP,L:bP,m:xP,X:vP,S:wP,M:_P};function mP(){var e=Xa.f(),t=py();return e||t}function pP(e){var t=yh(e);t!==null&&t.tag===5&&t.type==="form"?IE(t):Xa.r(e)}var vh=typeof document>"u"?null:document;function zM(e,t,n){var r=vh;if(r&&typeof t=="string"&&t){var s=Pi(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),sk.has(s)||(sk.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),is(t,"link",e),Vr(t),r.head.appendChild(t)))}}function gP(e){Xa.D(e),zM("dns-prefetch",e,null)}function yP(e,t){Xa.C(e,t),zM("preconnect",e,t)}function bP(e,t,n){Xa.L(e,t,n);var r=vh;if(r&&e&&t){var s='link[rel="preload"][as="'+Pi(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Pi(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Pi(n.imageSizes)+'"]')):s+='[href="'+Pi(e)+'"]';var i=s;switch(t){case"style":i=Jd(e);break;case"script":i=_h(e)}Xi.has(i)||(e=Kn({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Xi.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(sm(i))||t==="script"&&r.querySelector(im(i))||(t=r.createElement("link"),is(t,"link",e),Vr(t),r.head.appendChild(t)))}}function xP(e,t){Xa.m(e,t);var n=vh;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Pi(r)+'"][href="'+Pi(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=_h(e)}if(!Xi.has(i)&&(e=Kn({rel:"modulepreload",href:e},t),Xi.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(im(i)))return}r=n.createElement("link"),is(r,"link",e),Vr(r),n.head.appendChild(r)}}}function wP(e,t,n){Xa.S(e,t,n);var r=vh;if(r&&e){var s=Ed(r).hoistableStyles,i=Jd(e);t=t||"default";var o=s.get(i);if(!o){var a={loading:0,preload:null};if(o=r.querySelector(sm(i)))a.loading=5;else{e=Kn({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Xi.get(i))&&r5(e,n);var l=o=r.createElement("link");Vr(l),is(l,"link",e),l._p=new Promise(function(c,u){l.onload=c,l.onerror=u}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,ng(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:a},s.set(i,o)}}}function vP(e,t){Xa.X(e,t);var n=vh;if(n&&e){var r=Ed(n).hoistableScripts,s=_h(e),i=r.get(s);i||(i=n.querySelector(im(s)),i||(e=Kn({src:e,async:!0},t),(t=Xi.get(s))&&s5(e,t),i=n.createElement("script"),Vr(i),is(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function _P(e,t){Xa.M(e,t);var n=vh;if(n&&e){var r=Ed(n).hoistableScripts,s=_h(e),i=r.get(s);i||(i=n.querySelector(im(s)),i||(e=Kn({src:e,async:!0,type:"module"},t),(t=Xi.get(s))&&s5(e,t),i=n.createElement("script"),Vr(i),is(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function ik(e,t,n,r){var s=(s=Pl.current)?Jg(s):null;if(!s)throw Error(pe(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Jd(n.href),n=Ed(s).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Jd(n.href);var i=Ed(s).hoistableStyles,o=i.get(e);if(o||(s=s.ownerDocument||s,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,o),(i=s.querySelector(sm(e)))&&!i._p&&(o.instance=i,o.state.loading=5),Xi.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},Xi.set(e,n),i||kP(s,e,n,o.state))),t&&r===null)throw Error(pe(528,""));return o}if(t&&r!==null)throw Error(pe(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=_h(n),n=Ed(s).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(pe(444,e))}}function Jd(e){return'href="'+Pi(e)+'"'}function sm(e){return'link[rel="stylesheet"]['+e+"]"}function PM(e){return Kn({},e,{"data-precedence":e.precedence,precedence:null})}function kP(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),is(t,"link",n),Vr(t),e.head.appendChild(t))}function _h(e){return'[src="'+Pi(e)+'"]'}function im(e){return"script[async]"+e}function ok(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Pi(n.href)+'"]');if(r)return t.instance=r,Vr(r),r;var s=Kn({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Vr(r),is(r,"style",s),ng(r,n.precedence,e),t.instance=r;case"stylesheet":s=Jd(n.href);var i=e.querySelector(sm(s));if(i)return t.state.loading|=4,t.instance=i,Vr(i),i;r=PM(n),(s=Xi.get(s))&&r5(r,s),i=(e.ownerDocument||e).createElement("link"),Vr(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),is(i,"link",r),t.state.loading|=4,ng(i,n.precedence,e),t.instance=i;case"script":return i=_h(n.src),(s=e.querySelector(im(i)))?(t.instance=s,Vr(s),s):(r=n,(s=Xi.get(i))&&(r=Kn({},n),s5(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),Vr(s),is(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(pe(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,ng(r,n.precedence,e));return t.instance}function ng(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=r.length?r[r.length-1]:null,i=s,o=0;o<r.length;o++){var a=r[o];if(a.dataset.precedence===t)i=a;else if(i!==s)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function r5(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function s5(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var rg=null;function ak(e,t,n){if(rg===null){var r=new Map,s=rg=new Map;s.set(n,r)}else s=rg,r=s.get(n),r||(r=new Map,s.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var i=n[s];if(!(i[J0]||i[ts]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var o=i.getAttribute(t)||"";o=e+o;var a=r.get(o);a?a.push(i):r.set(o,[i])}}return r}function lk(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function SP(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 qM(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function TP(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var s=Jd(r.href),i=t.querySelector(sm(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Zg.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,Vr(i);return}i=t.ownerDocument||t,r=PM(r),(s=Xi.get(s))&&r5(r,s),i=i.createElement("link"),Vr(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),is(i,"link",r),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=Zg.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var f2=0;function CP(e,t){return e.stylesheets&&e.count===0&&sg(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&sg(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&f2===0&&(f2=62500*oP());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&sg(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>f2?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function Zg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)sg(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var e1=null;function sg(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,e1=new Map,t.forEach(AP,e),e1=null,Zg.call(e))}function AP(e,t){if(!(t.state.loading&4)){var n=e1.get(e);if(n)var r=n.get(null);else{n=new Map,e1.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<s.length;i++){var o=s[i];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}s=t.instance,o=s.getAttribute("data-precedence"),i=n.get(o)||r,i===r&&n.set(null,s),n.set(o,s),this.count++,r=Zg.bind(this),s.addEventListener("load",r),s.addEventListener("error",r),i?i.parentNode.insertBefore(s,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var _0={$$typeof:Ma,Provider:null,Consumer:null,_currentValue:lu,_currentValue2:lu,_threadCount:0};function EP(e,t,n,r,s,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=Ob(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ob(0),this.hiddenUpdates=Ob(null),this.identifierPrefix=r,this.onUncaughtError=s,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function FM(e,t,n,r,s,i,o,a,l,c,u,d){return e=new EP(e,t,n,o,l,c,u,d,a),t=1,i===!0&&(t|=24),i=ui(3,null,null,t),e.current=i,i.stateNode=e,t=N3(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},j3(i),e}function UM(e){return e?(e=bd,e):bd}function HM(e,t,n,r,s,i){s=UM(s),r.context===null?r.context=s:r.pendingContext=s,r=Fl(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=Ul(e,r,t),n!==null&&(Ks(n,e,t),zf(n,e,t))}function ck(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function i5(e,t){ck(e,t),(e=e.alternate)&&ck(e,t)}function VM(e){if(e.tag===13||e.tag===31){var t=Lu(e,67108864);t!==null&&Ks(t,e,67108864),i5(e,67108864)}}function uk(e){if(e.tag===13||e.tag===31){var t=yi();t=g3(t);var n=Lu(e,t);n!==null&&Ks(n,e,t),i5(e,t)}}var t1=!0;function MP(e,t,n,r){var s=Mt.T;Mt.T=null;var i=xn.p;try{xn.p=2,o5(e,t,n,r)}finally{xn.p=i,Mt.T=s}}function NP(e,t,n,r){var s=Mt.T;Mt.T=null;var i=xn.p;try{xn.p=8,o5(e,t,n,r)}finally{xn.p=i,Mt.T=s}}function o5(e,t,n,r){if(t1){var s=ew(r);if(s===null)d2(e,t,r,n1,n),dk(e,r);else if(RP(s,e,t,n,r))r.stopPropagation();else if(dk(e,r),t&4&&-1<IP.indexOf(e)){for(;s!==null;){var i=yh(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=Vc(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-gi(o);a.entanglements[1]|=l,o&=~l}Qo(i),!(yn&6)&&(Vg=mi()+500,rm(0))}}break;case 31:case 13:a=Lu(i,2),a!==null&&Ks(a,i,2),py(),i5(i,2)}if(i=ew(r),i===null&&d2(e,t,r,n1,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else d2(e,t,r,null,n)}}function ew(e){return e=w3(e),a5(e)}var n1=null;function a5(e){if(n1=null,e=hd(e),e!==null){var t=K0(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=dA(t),e!==null)return e;e=null}else if(n===31){if(e=hA(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 n1=e,null}function WM(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(g$()){case gA:return 2;case yA:return 8;case Ig:case y$:return 32;case bA:return 268435456;default:return 32}default:return 32}}var tw=!1,Wl=null,Gl=null,Kl=null,k0=new Map,S0=new Map,Al=[],IP="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 dk(e,t){switch(e){case"focusin":case"focusout":Wl=null;break;case"dragenter":case"dragleave":Gl=null;break;case"mouseover":case"mouseout":Kl=null;break;case"pointerover":case"pointerout":k0.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":S0.delete(t.pointerId)}}function Zh(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=yh(t),t!==null&&VM(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function RP(e,t,n,r,s){switch(t){case"focusin":return Wl=Zh(Wl,e,t,n,r,s),!0;case"dragenter":return Gl=Zh(Gl,e,t,n,r,s),!0;case"mouseover":return Kl=Zh(Kl,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return k0.set(i,Zh(k0.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,S0.set(i,Zh(S0.get(i)||null,e,t,n,r,s)),!0}return!1}function GM(e){var t=hd(e.target);if(t!==null){var n=K0(t);if(n!==null){if(t=n.tag,t===13){if(t=dA(n),t!==null){e.blockedOn=t,Y6(e.priority,function(){uk(n)});return}}else if(t===31){if(t=hA(n),t!==null){e.blockedOn=t,Y6(e.priority,function(){uk(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 ig(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=ew(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);xx=r,n.target.dispatchEvent(r),xx=null}else return t=yh(n),t!==null&&VM(t),e.blockedOn=n,!1;t.shift()}return!0}function hk(e,t,n){ig(e)&&n.delete(t)}function jP(){tw=!1,Wl!==null&&ig(Wl)&&(Wl=null),Gl!==null&&ig(Gl)&&(Gl=null),Kl!==null&&ig(Kl)&&(Kl=null),k0.forEach(hk),S0.forEach(hk)}function Ym(e,t){e.blockedOn===t&&(e.blockedOn=null,tw||(tw=!0,Br.unstable_scheduleCallback(Br.unstable_NormalPriority,jP)))}var Xm=null;function fk(e){Xm!==e&&(Xm=e,Br.unstable_scheduleCallback(Br.unstable_NormalPriority,function(){Xm===e&&(Xm=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],s=e[t+2];if(typeof r!="function"){if(a5(r||n)===null)continue;break}var i=yh(n);i!==null&&(e.splice(t,3),t-=3,Dx(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function Zd(e){function t(l){return Ym(l,e)}Wl!==null&&Ym(Wl,e),Gl!==null&&Ym(Gl,e),Kl!==null&&Ym(Kl,e),k0.forEach(t),S0.forEach(t);for(var n=0;n<Al.length;n++){var r=Al[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Al.length&&(n=Al[0],n.blockedOn===null);)GM(n),n.blockedOn===null&&Al.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var s=n[r],i=n[r+1],o=s[Xs]||null;if(typeof i=="function")o||fk(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(s=i,o=i[Xs]||null)a=o.formAction;else if(a5(s)!==null)continue}else a=o.action;typeof a=="function"?n[r+1]=a:(n.splice(r,3),r-=3),fk(n)}}}function KM(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(o){return s=o})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),r||setTimeout(n,20)}function n(){if(!r&&!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 r=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function l5(e){this._internalRoot=e}by.prototype.render=l5.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(pe(409));var n=t.current,r=yi();HM(n,r,e,t,null,null)};by.prototype.unmount=l5.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;HM(e.current,2,null,e,null,null),py(),t[gh]=null}};function by(e){this._internalRoot=e}by.prototype.unstable_scheduleHydration=function(e){if(e){var t=kA();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Al.length&&t!==0&&t<Al[n].priority;n++);Al.splice(n,0,e),n===0&&GM(e)}};var mk=cA.version;if(mk!=="19.2.4")throw Error(pe(527,mk,"19.2.4"));xn.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(pe(188)):(e=Object.keys(e).join(","),Error(pe(268,e)));return e=c$(t),e=e!==null?fA(e):null,e=e===null?null:e.stateNode,e};var LP={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Mt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qm.isDisabled&&Qm.supportsFiber)try{Y0=Qm.inject(LP),pi=Qm}catch{}}ey.createRoot=function(e,t){if(!uA(e))throw Error(pe(299));var n=!1,r="",s=zE,i=PE,o=qE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=FM(e,1,!1,null,null,n,r,null,s,i,o,KM),e[gh]=t.current,n5(e),new l5(t)};ey.hydrateRoot=function(e,t,n){if(!uA(e))throw Error(pe(299));var r=!1,s="",i=zE,o=PE,a=qE,l=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=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=FM(e,1,!0,t,n??null,r,s,l,i,o,a,KM),t.context=UM(null),n=t.current,r=yi(),r=g3(r),s=Fl(r),s.callback=null,Ul(n,s,r),n=r,t.current.lanes=n,Q0(t,n),Qo(t),e[gh]=t.current,n5(e),new by(t)};ey.version="19.2.4";function YM(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(YM)}catch(e){console.error(e)}}YM(),rA.exports=ey;var DP=rA.exports;const OP=J1(DP);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const BP="agent";function $P(e){return e===BP}var zP=3e4,PP=new Set(["authorized","expired","error","cancelled"]),qP=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(r={})=>await FP(n,t,e.clientId,r)}}status(e,t){return this.client.getDeviceFlow(e,t)}cancel(e,t){return this.client.cancelDeviceFlow(e,t)}};async function FP(e,t,n,r){return await UP(e,t,n,r)}async function pk(e,t,n,r){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:r})}catch(s){if(s instanceof Su&&s.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 s}}function gk(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function UP(e,t,n,r){var u;let s=r.signal,i=gk(r.timeoutMs,{allowZero:!0}),o=gk(r.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+zP,l=Math.max(1e3,o??t.intervalMs??5e3),c=l;for(;;){if(s!=null&&s.aborted)throw nw(s);if(Date.now()>=a)return await pk(e,t,n,s);let d=await pk(e,t,n,s);if(d.intervalMs&&d.intervalMs!==c&&(c=d.intervalMs,l=d.intervalMs,(u=r.onThrottled)==null||u.call(r,d.intervalMs)),PP.has(d.status))return d;await HP(l,s)}}async function HP(e,t){if(t!=null&&t.aborted)throw nw(t);await new Promise((n,r)=>{let s=setTimeout(()=>{o(),n()},e),i=()=>{o(),r(nw(t))};function o(){clearTimeout(s),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function nw(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var Su=class extends Error{constructor(t,n,r){super(r);oe(this,"status");oe(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},yk=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},VP=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},bk=16*1024*1024;async function*WP(e,t){let n=e.getReader(),r=new TextDecoder,s="",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(s+=r.decode(),s.length>0){let c=xk(s);for(let u of c.frames){let d=m2(u);d&&(yield d)}if(c.tail.length>0){let u=m2(c.tail);u&&(yield u)}}return}if(s+=r.decode(o,{stream:!0}),s.length>bk)throw new VP(`parseSseStream: unread buffer exceeded ${bk} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=xk(s);if(l.frames.length>0)for(let c of l.frames){let u=m2(c);u&&(yield u)}s=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function xk(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`

`,n);if(r===-1){let i=e.indexOf(`\r
\r
`,n);if(i===-1)break;t.push(e.slice(n,i)),n=i+4;continue}let s=e.slice(n,r).indexOf(`\r
\r
`);if(s!==-1){let i=n+s;t.push(e.slice(n,i)),n=i+4}else t.push(e.slice(n,r)),n=r+2}return{frames:t,tail:e.slice(n)}}function m2(e){if(!e)return;let t=[];for(let r of e.split(/\r?\n/)){if(!r.startsWith("data:"))continue;let s=r.slice(5);t.push(s.startsWith(" ")?s.slice(1):s)}if(t.length===0)return;let n=t.join(`
`);try{let r=JSON.parse(n);if(typeof r!="object"||r===null||Array.isArray(r)||r.v!==1||typeof r.type!="string")return;let s=r.id;return s!==void 0&&(!Number.isSafeInteger(s)||s<1)?void 0:r}catch{return}}var GP=class{constructor(e,t,n){oe(this,"baseUrl");oe(this,"token");oe(this,"_fetch");oe(this,"_disposed",!1);oe(this,"type","rest");oe(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 yk;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var u;if(this._disposed)throw new yk;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 r=new AbortController,s,i=t.connectTimeoutMs;i&&Number.isFinite(i)&&(s=setTimeout(()=>r.abort(new DOMException("Initial connect timed out","TimeoutError")),i),typeof s=="object"&&s&&"unref"in s&&s.unref());let o=t.signal?KP([t.signal,r.signal]):r.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{s!==void 0&&clearTimeout(s)}if(!l.ok){let d;try{let m=await l.text();try{d=JSON.parse(m)}catch{d=m}}catch{}let f=d&&typeof d=="object"&&"error"in d?String(d.error):`HTTP ${l.status}`;throw new Su(l.status,d,`GET /session/:id/events: ${f}`)}let c=l.headers.get("content-type")??"";if(!c.toLowerCase().includes("text/event-stream")){try{await((u=l.body)==null?void 0:u.cancel())}catch{}throw new Su(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*WP(l.body,t.signal)}dispose(){this._disposed=!0}};function KP(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}var wk=20,YP=3e4,XP=65e3,QP=9e4,JP=5,ef=33e4,ZP="X-Qwen-Client-Id";function vk(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function XM(e){if(e===void 0)return JP;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 eq(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function tq(){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 r=n.trim();return r.length===0?void 0:r}catch{return}}var _k=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 QM(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var JM=class{constructor(e){oe(this,"baseUrl");oe(this,"token");oe(this,"_fetch");oe(this,"fetchTimeoutMs");oe(this,"promptLimit");oe(this,"promptCounts",Object.create(null));oe(this,"transport");oe(this,"_authFlow");this.baseUrl=eq(e.baseUrl),this.token=e.token??tq(),this._fetch=e.fetch??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??YP;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=XM(e.maxPendingPromptsPerSession),this.transport=e.transport??new GP(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new qP(this)),this._authFlow}get maxPendingPromptsPerSession(){return this.promptLimit}reservePromptSlot(e,t=this.promptLimit){if(t===1/0)return()=>{};let n=this.promptCounts,r=n[e]??0;if(r>=t)throw new _k(e,t,r);n[e]=r+1;let s;return()=>{s||(s=!0,(n[e]??0)<=1?delete n[e]:--n[e])}}async fetchWithTimeout(e,t={},n,r,s="transport"){let i=this.fetchTimeoutMs;if(r!==void 0&&Number.isFinite(r)&&r>=0&&(i=r),!i||!Number.isFinite(i)){let u=s==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(u):u}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?kk([l,o.signal]):o.signal;try{let u=s==="rest"?await this._fetch(e,{...t,signal:c}):await this.transport.fetch(e,{...t,signal:c});return n?await n(u):u}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[ZP]=t),n}async failOnError(e,t,n){let r;try{let i=await e.text();if(i.length>0)try{r=JSON.parse(i)}catch{r=i}}catch{}let s=r&&typeof r=="object"&&"error"in r?String(r.error):`HTTP ${e.status}`;if(n&&e.status===503&&r&&typeof r=="object"){let i=r;if(i.code==="prompt_queue_full")return new _k(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new Su(e.status,r,`${t}: ${s}`)}async jsonRequest(e,t,n={}){let r=n.body!==void 0;return await this.fetchWithTimeout(`${this.baseUrl}${e}`,{...n.method?{method:n.method}:{},headers:this.headers(r?{"Content-Type":"application/json"}:{},n.clientId),...r?{body:JSON.stringify(n.body)}:{}},async s=>{if(!s.ok)throw await this.failOnError(s,t);return await s.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 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/${encodeURIComponent(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/${encodeURIComponent(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/${encodeURIComponent(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/${encodeURIComponent(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/${encodeURIComponent(e)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:t,clientId:n})}async disableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:t,clientId:n})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${encodeURIComponent(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t})}async readWorkspaceFile(e,t={},n){let r=new URL(`${this.baseUrl}/file`);return r.searchParams.set("path",e),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),t.line!==void 0&&r.searchParams.set("line",String(t.line)),t.limit!==void 0&&r.searchParams.set("limit",String(t.limit)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file");return await s.json()})}async readWorkspaceFileBytes(e,t={},n){let r=new URL(`${this.baseUrl}/file/bytes`);return r.searchParams.set("path",e),t.offset!==void 0&&r.searchParams.set("offset",String(t.offset)),t.maxBytes!==void 0&&r.searchParams.set("maxBytes",String(t.maxBytes)),await this.fetchWithTimeout(r.toString(),{headers:this.headers({},n)},async s=>{if(!s.ok)throw await this.failOnError(s,"GET /file/bytes");return await s.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 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()},ef)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${encodeURIComponent(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={},r){let s=n.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}?scope=${encodeURIComponent(n.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}`;return await this.fetchWithTimeout(s,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),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 r=t.scope?`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}?scope=${encodeURIComponent(t.scope)}`:`${this.baseUrl}/workspace/agents/${encodeURIComponent(e)}`;return await this.fetchWithTimeout(r,{method:"DELETE",headers:this.headers({},n)},async s=>{var i;if(s.status===204){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return}if(s.status===404){let o=await this.failOnError(s,"DELETE /workspace/agents/:agentType"),a=o.body;if(a&&a.code==="agent_not_found")return;throw o}throw await this.failOnError(s,"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){let n=(t==null?void 0:t.pageSize)??wk,r=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:wk)));return(await this.jsonRequest(`/workspace/${encodeURIComponent(e)}/sessions?size=${r}`,"GET /workspace/sessions")).sessions}async loadSession(e,t={},n){return this.restoreSession("load",e,t,n)}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/branch`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({name:t.name})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/branch");return await r.json()})}async forkSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/fork`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({directive:t.directive})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/fork");return await r.json()})}async sessionContext(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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 r=new URLSearchParams;t.detail===!0&&r.set("detail","true");let s=r.toString();return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/context-usage${s?`?${s}`:""}`,{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/${encodeURIComponent(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/${encodeURIComponent(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/${encodeURIComponent(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,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({kind:n})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /session/:id/tasks/:taskId/cancel");return await s.json()})}async sessionGoalClear(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(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,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({cwd:n.workspaceCwd})},async s=>{if(!s.ok)throw await this.failOnError(s,`POST /session/:id/${e}`);return await s.json()})}async setSessionApprovalMode(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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 r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/approval-mode");return await r.json()})}async getRewindSnapshots(e){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(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 r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/rewind");return await r.json()})}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(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 r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(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(!r.ok)throw await this.failOnError(r,"POST /session/:id/btw");return await r.json()}async enqueueMidTurnMessage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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 r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/mid-turn-message");return await r.json()})}async shellCommand(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(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(!r.ok)throw await this.failOnError(r,"POST /session/:id/shell");return await r.json()}async setWorkspaceToolEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/tools/${encodeURIComponent(e)}/enable`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:JSON.stringify({enabled:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/tools/:name/enable");return await r.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,r){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/settings`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r==null?void 0:r.clientId),body:JSON.stringify({scope:e,key:t,value:n})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/settings");return await s.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 r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/voice/transcribe");return await r.json()},XP,"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,r){return await this.jsonRequest("/workspace/permissions","POST /workspace/permissions",{method:"POST",body:{scope:e,ruleType:t,rules:[...n]},clientId:r==null?void 0:r.clientId})}async addWorkspacePermissionRule(e,t,n,r){let s=vk(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?i:await this.setWorkspacePermissionRules(e,t,[...o,s],r)}async removeWorkspacePermissionRule(e,t,n,r){let s=vk(n),i=await this.workspacePermissions(r),o=i[e].rules[t];return o.includes(s)?await this.setWorkspacePermissionRules(e,t,o.filter(a=>a!==s),r):i}async restartMcpServer(e,t){let n=(t==null?void 0:t.entryIndex)===void 0?"":`?entryIndex=${encodeURIComponent(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${encodeURIComponent(e)}/restart${n}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/restart");return await r.json()},(t==null?void 0:t.timeoutMs)??ef)}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/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n==null?void 0:n.clientId),body:"{}"},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/mcp/:server/:action");return await r.json()},(n==null?void 0:n.timeoutMs)??ef)}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)??ef)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${encodeURIComponent(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)??ef)}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:QP})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/model`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify({modelId:t})},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/model");return await r.json()})}async setSessionLanguage(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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 r=>{if(!r.ok)throw await this.failOnError(r,"POST /session/:id/language");return await r.json()})}async prompt(e,t,n,r){n==null||n.throwIfAborted();let s=this.reservePromptSlot(e),i=!0;try{let o=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),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,r)}finally{s()}}if(!o.ok)throw await this.failOnError(o,"POST /session/:id/prompt",e);return await o.json()}finally{i&&s()}}async promptNonBlocking(e,t,n,r){let s=await this.transport.fetch(`${this.baseUrl}/session/${encodeURIComponent(e)}/prompt`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(t),signal:n});if(s.status===202)return await s.json();if(!s.ok)throw await this.failOnError(s,"POST /session/:id/prompt",e);return await s.json()}async _awaitTurnComplete(e,t,n,r,s){let i=new AbortController,o=r?kk([r,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let c=c5(l,t);if(c!==void 0)return c}throw new Error("SSE stream ended")}catch(a){throw r!=null&&r.aborted&&a instanceof DOMException&&a.name==="AbortError"&&this.cancel(e,s).catch(()=>{}),a}finally{i.signal.aborted||i.abort()}}async heartbeat(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(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/${encodeURIComponent(e)}/cancel`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:"{}"},async n=>{var r;if(!n.ok&&n.status!==204)throw await this.failOnError(n,"POST /session/:id/cancel");try{await((r=n.body)==null?void 0:r.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/${encodeURIComponent(e)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async r=>{var s,i;if(r.status===200){try{await((s=r.body)==null?void 0:s.cancel())}catch{}return!0}if(r.status===404){try{await((i=r.body)==null?void 0:i.cancel())}catch{}return!1}throw await this.failOnError(r,"POST /permission/:requestId")})}async respondToSessionPermission(e,t,n,r){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/permission/${encodeURIComponent(t)}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify(n)},async s=>{var i,o;if(s.status===200){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return!0}if(s.status===404){try{await((o=s.body)==null?void 0:o.cancel())}catch{}return!1}throw await this.failOnError(s,"POST /session/:id/permission/:requestId")})}async closeSession(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.cancel())}catch{}return}throw await this.failOnError(n,"DELETE /session/:id")})}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 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/${encodeURIComponent(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/${encodeURIComponent(e)}`,{method:"DELETE",headers:this.headers({},t.clientId)},async n=>{var r;if(n.status===204||n.status===404){try{await((r=n.body)==null?void 0:r.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 updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/metadata`,{method:"PATCH",headers:this.headers({"Content-Type":"application/json"},n),body:JSON.stringify(t)},async r=>{if(r.status===200){let s=await r.json();return typeof s.displayName=="string"?{displayName:s.displayName}:{}}throw await this.failOnError(r,"PATCH /session/:id/metadata")})}};function kk(e){let t=AbortSignal.any;if(typeof t=="function")return t.call(AbortSignal,e);let n=new AbortController,r=[],s=()=>{for(;r.length>0;){let i=r.pop();try{i==null||i()}catch{}}};for(let i of e){if(i.aborted)return n.abort(i.reason),s(),n.signal;let o=()=>{n.abort(i.reason),s()};i.addEventListener("abort",o,{once:!0}),r.push(()=>i.removeEventListener("abort",o))}return n.signal.addEventListener("abort",s,{once:!0}),n.signal}function c5(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 Su(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function Sk(e){return"promptId"in e&&"lastEventId"in e}var Jm=class og{constructor(t){oe(this,"client");oe(this,"session");oe(this,"state");oe(this,"replaySnapshot");oe(this,"hasActivePrompt");oe(this,"lastSeenEventId");oe(this,"subscriptionActive",!1);oe(this,"reattaching");oe(this,"promptLimit");oe(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=Zm(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:XM(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},r){let s=await t.createOrAttachSession(n,r),i=!s.attached||n.modelServiceId?0:void 0;return new og({client:t,session:s,hasActivePrompt:s.hasActivePrompt,lastEventId:i})}static async load(t,n,r={},s){let{state:i,hasActivePrompt:o,compactedReplay:a,liveJournal:l,lastEventId:c,...u}=await t.loadSession(n,r,s);return new og({client:t,session:u,hasActivePrompt:o,state:i,lastEventId:c??0,replaySnapshot:{compactedReplay:a??[],liveJournal:l??[]}})}static async resume(t,n,r={},s){let{state:i,hasActivePrompt:o,lastEventId:a,...l}=await t.resumeSession(n,r,s);return new og({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=Zm(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 r=this.client.reservePromptSlot(this.sessionId,this.promptLimit),s;try{if(s=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId)),!Sk(s))return r(),s;if(!this.subscriptionActive)throw Error("SSE stream ended")}catch(i){throw r(),i}return new Promise((i,o)=>{let a=()=>{let c=this._pendingPrompts.get(s.promptId);c&&this._pendingPrompts.delete(s.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(s.promptId,{resolve:c=>{l(),r(),i(c)},reject:c=>{l(),r(),o(c)}}),n!=null&&n.aborted?a():n==null||n.addEventListener("abort",a,{once:!0})})}async submitPrompt(t,n){n==null||n.throwIfAborted();let r=await this.withClientIdSelfHeal(()=>this.client.promptNonBlocking(this.sessionId,t,n,this.clientId));if(!Sk(r))throw new Error("Expected non-blocking prompt acceptance");return r}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!nq(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 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 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 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=Zm(t.lastEventId),r=!1,s=!1,i=()=>{s||(s=!0,this.subscriptionActive=!1)},o=()=>{if(!r){if(this.subscriptionActive)throw new Error("subscription active");this.subscriptionActive=!0,r=!0}},a=this.iterateEvents({...t,lastEventId:n},i);return{next:async l=>(s||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:r=!0,...s}=t,i=s.lastEventId??(r?this.lastSeenEventId:void 0);for await(let o of this.client.subscribeEvents(this.sessionId,{...s,lastEventId:i}))this._dispatchTurnEvent(o),yield o,o.id!==void 0&&(this.lastSeenEventId=Math.max(this.lastSeenEventId??0,Zm(o.id)))}finally{this._rejectAllPending(new Error("SSE stream ended")),n()}}_dispatchTurnEvent(t){var s;if(t.type!=="turn_complete"&&t.type!=="turn_error")return;let n=(s=t.data)==null?void 0:s.promptId;if(!n)return;let r=this._pendingPrompts.get(n);if(r){this._pendingPrompts.delete(n);try{let i=c5(t,n);i!==void 0&&r.resolve(i)}catch(i){r.reject(i)}}}_rejectAllPending(t){for(let[,n]of this._pendingPrompts)n.reject(t);this._pendingPrompts.clear()}};function Zm(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function nq(e){return e instanceof Su&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var ZM="mid_turn_message_injected",rq=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated",ZM,"client_evicted","slow_client_warning","stream_error","state_resync_required","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(rq);var sq=["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"],xy=["plan","default","auto-edit","auto","yolo"],rw="daemon-plan";function it(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Se(e,t){if(!it(e))return;let n=e[t];return typeof n=="string"?n:void 0}function mn(e,t){if(it(e))for(let n of t){let r=e[n];if(typeof r=="string"&&r.trim().length>0)return r}}function rc(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 Wa(e){return rc(Ra(e))}function Ra(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>Ra(n,t+1)):it(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,eN(n)?"[redacted]":Ra(r,t+1)])):e}function eN(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 p2(e){if(typeof e=="string")return e;if(!it(e))return"";let t=e.text;return typeof t=="string"?t:""}function iq(e){if(typeof e=="string")return{kind:"text",text:e};if(!it(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=it(e.source)?e.source:void 0,r,s;return n&&(r=typeof n.url=="string"?n.url:void 0,s=typeof n.data=="string"?n.data:void 0),!r&&!s&&(s=typeof e.data=="string"?e.data:void 0,r=typeof e.url=="string"?e.url:void 0),!r&&!s?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:{...r?{url:r}:{},...s?{data:s}:{}}}}if(t==="audio"){let n=it(e.source)?e.source:void 0;if(!n)return;let r=(typeof e.mediaType=="string"?e.mediaType:void 0)??"audio/*",s=typeof n.url=="string"?n.url:void 0,i=typeof n.data=="string"?n.data:void 0;return!s&&!i?void 0:{kind:"audio",mediaType:r,source:{...s?{url:s}:{},...i?{data:i}:{}}}}if(t==="resource"||t==="resource_link"){let n=typeof e.uri=="string"?e.uri:void 0;if(!n)return;let r=typeof e.mediaType=="string"?e.mediaType:void 0,s=typeof e.description=="string"?e.description:void 0;return{kind:"resource",uri:n,...r?{mediaType:r}:{},...s?{description:s}:{}}}}var oq=64;function r1(e,t=0){if(t>oq)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>r1(r,t+1)).filter(Boolean).join(`
`);if(!it(e))return e===void 0?"":rc(e);for(let r of["text","output","stdout","stderr","rawOutput"]){let s=e[r];if(typeof s=="string")return s}let n=e.content;if(n!==void 0){let r=r1(n,t+1);if(r)return r}return rc(e)}var aq=new Set(sq),tN=new Set(["qwen","qwen-oauth"]),lq=new Set(["in_flight","disabled","budget_would_exceed"]),Tk=4096;function cq(e,t={}){let n=pq(e,t);switch(e.type){case"session_update":return gq(e,n,t);case"shell_output":{let r=r1(e.data),s=iw(e.data),i=ow(e.data);return r?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:r,...s?{stream:s}:{}}]:[]}case"permission_request":return Sq(e,n);case"permission_resolved":case"permission_already_resolved":return Tq(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:Se(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:Se(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=Ak(Se(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:Se(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${Se(e.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:Se(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 r=Ak(Se(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:Se(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=Se(e.data,"code"),s=Se(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...s?{promptId:s}:{},text:Se(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return uq(e,n);case"session_rewound":return dq(e,n);case"session_branched":return hq(e,n);case"prompt_cancelled":{let r=Xq(e.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return fq(e,n);case"mid_turn_message_injected":return mq(e,n);case"user_shell_command":{let r=Se(e.data,"command"),s=Se(e.data,"cwd");return r?[{...n,type:"user.shell.command",command:r,...s?{cwd:s}:{}},{...n,type:"user.text.delta",text:`$ ${r}`}]:[]}case"user_shell_result":{let r=Qn(e.data,"exitCode"),s=it(e.data)&&e.data.aborted===!0?"Shell command was aborted":`Shell command exited with code ${r??"unknown"}`;return[{...n,type:"status",text:s}]}case"replay_complete":{let r=Qn(e.data,"replayedCount")??0,s=Qn(e.data,"lastReplayedEventId")??Qn(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...s!==void 0?{lastReplayedEventId:s}:{}}]}case"session_metadata_updated":return Nq(e,n);case"approval_mode_changed":return Iq(e,n);case"memory_changed":return Rq(e,n);case"agent_changed":return jq(e,n);case"tool_toggled":return Lq(e,n);case"settings_changed":return Dq(e,n);case"trust_change_requested":return Bq(e,n);case"workspace_initialized":return Oq(e,n);case"github_setup_completed":return $q(e,n);case"mcp_budget_warning":return zq(e,n);case"mcp_child_refused_batch":return Pq(e,n);case"mcp_server_restarted":return qq(e,n);case"mcp_server_restart_refused":return Fq(e,n);case"extensions_changed":return Uq(e,n);case"auth_device_flow_started":return Hq(e,n);case"auth_device_flow_throttled":return Vq(e,n);case"auth_device_flow_authorized":return Wq(e,n);case"auth_device_flow_failed":return Gq(e,n);case"auth_device_flow_cancelled":return Yq(e,n);default:return[{...n,type:"debug",text:`${e.type} (unrecognized daemon event): ${Wa(e.data)}`}]}}function uq(e,t){let n=Se(e.data,"reason"),r=Qn(e.data,"lastDeliveredId"),s=Qn(e.data,"earliestAvailableId");return!n||r===void 0||s===void 0?$n(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:s}]}function dq(e,t){let n=Se(e.data,"promptId"),r=Qn(e.data,"targetTurnIndex");if(!n||r===void 0)return $n(e,t,"malformed session_rewound payload");let s=Se(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:r,...s?{sessionId:s}:{}}]}function hq(e,t){let n=Se(e.data,"sourceSessionId"),r=Se(e.data,"newSessionId"),s=Se(e.data,"displayName");return!n||!r||!s?$n(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:r,displayName:s}]}function fq(e,t){let n=Se(e.data,"sessionId"),r=Se(e.data,"suggestion"),s=Se(e.data,"promptId");return!n||!r||!s?$n(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:s}]}function mq(e,t){if(!it(e.data))return $n(e,t,"malformed mid_turn_message_injected");let n=Array.isArray(e.data.messages)?e.data.messages.filter(r=>typeof r=="string"&&r.length>0):[];return n.length===0?$n(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function pq(e,t){let n=nN(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:Ra(e.data)}}:{}}}function nN(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(it(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(it(e.data)){let r=e.data._meta;if(it(r)){let i=r.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let s=e.data.update;if(it(s)){let i=s._meta;if(it(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 gq(e,t,n){let r=Cq(e.data);if(!r)return[{...t,type:"debug",text:`session_update: ${Wa(e.data)}`}];let s=Se(r,"sessionUpdate");switch(s){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=r.content,o=iq(i);if(o){if(o.kind==="image"){let l=o.source.data,c=o.mediaType||"image/*";if(c==="image/*"&&l){let u=(l.startsWith("data:")?l.split(",")[1]??"":l).slice(0,10);u.startsWith("iVBORw0KGg")?c="image/png":u.startsWith("/9j/")?c="image/jpeg":u.startsWith("R0lGOD")?c="image/gif":u.startsWith("UklGR")&&(c="image/webp")}return l?[{...t,type:"user.image.delta",data:l,mimeType:c}]:[]}return o.kind==="text"?o.text?[{...t,type:"user.text.delta",text:o.text}]:[]:[]}let a=p2(i);return a?[{...t,type:"user.text.delta",text:a}]:[]}case"agent_message_chunk":{let i=p2(r.content),o=Ck(r),a=yq(r),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let c=bq(r);return c&&l.push({...t,type:"assistant.usage",usage:c,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=p2(r.content);if(!i)return[];let o=Ck(r);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":return[xq(r,t)];case"shell_output":case"tool_output":{let i=r1(r),o=iw(r)??iw(e.data),a=ow(r)??ow(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(r.availableCommands)?r.availableCommands:[]).filter(it);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[wq(r,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${s??"session_update"}: ${Wa(r)}`}]}}function Ck(e){let t=it(e._meta)?e._meta:void 0;return t?Se(t,"parentToolCallId"):void 0}function yq(e){let t=it(e._meta)?e._meta:void 0;return t?{...t}:void 0}function bq(e){let t=it(e._meta)?e._meta:void 0,n=t&&it(t.usage)?t.usage:void 0;if(!n)return;let r=Qn(n,"inputTokens"),s=Qn(n,"outputTokens");if(r===void 0&&s===void 0)return;let i=Qn(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}function xq(e,t){let n=it(e._meta)?e._meta:void 0,r=Se(e,"toolName")??Se(e,"name")??(n?Se(n,"toolName"):void 0)??(n?Se(n,"name"):void 0),s=Se(e,"kind"),i=Se(e,"title")??r??s,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?Ra(o):void 0,c=a!==void 0?Ra(a):void 0,u=e.content!==void 0?Ra(e.content):void 0,d=e.locations!==void 0?Ra(e.locations):void 0,f=Se(e,"toolCallId"),m=Se(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}=kq(e,r),v=Se(e,"parentToolCallId")??(n?Se(n,"parentToolCallId"):void 0),b=v&&v!==f?v:void 0,x=Se(e,"subagentType")??(n?Se(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:f,...m?{status:m}:{},...i?{title:i}:{},...r?{toolName:r}:{},...s?{toolKind:s}:{},...u!==void 0?{content:u}:{},...d!==void 0?{locations:d}:{},...p?{provenance:p}:{},...y?{serverId:y}:{},...b?{parentToolCallId:b}:{},...x?{subagentType:x}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:sw(Wa(l))}:c!==void 0?{details:sw(Wa(c))}:{}}}function wq(e,t){let n=Array.isArray(e.entries)?e.entries:[],r=sw(vq(n)),s=t.eventId!==void 0?`${rw}-${t.eventId}`:rw,i=it(e._meta)?e._meta:void 0,o=i&&it(i.stats)?i.stats:void 0;return{...t,type:"tool.update",toolCallId:s,title:"Updated Plan",status:"completed",toolName:"todo_write",toolKind:"updated_plan",content:[{type:"content",content:{type:"text",text:r}}],rawOutput:o?{entries:n,stats:o}:{entries:n}}}function vq(e){return e.flatMap(t=>{if(!it(t))return[];let n=Se(t,"content");return n?[`- [${_q(Se(t,"status"))}] ${n}`]:[]}).join(`
`)}function _q(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function kq(e,t){let n=Se(e,"provenance"),r=Se(e,"serverId");if(n==="builtin"||n==="mcp"||n==="subagent")return{provenance:n,...n==="mcp"&&r?{serverId:r}:{}};if(t&&t.startsWith("mcp__")){let s=t.slice(5),i=s.indexOf("__");if(i>0)return{provenance:"mcp",serverId:s.slice(0,i)}}return{}}function Ak(e){if(e)return aq.has(e)?e:void 0}function sw(e){return e.length<=Tk?e:`${e.slice(0,Tk)}... [truncated]`}function Sq(e,t){if(!it(e.data))return[{...t,type:"debug",text:`permission_request: ${Wa(e.data)}`}];let n=Se(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${Wa(e.data)}`}];let r=e.data.toolCall!==void 0?Ra(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:Se(e.data,"sessionId"),title:Mq(r),options:Aq(e.data.options),toolCall:r}]}function Tq(e,t){let n=Se(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${Wa(e.data)}`}];let r=Se(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:Eq(e.data),...r?{voterClientId:r}:{}}]}function Cq(e){if(!it(e))return;let t=e.update;return it(t)?t:e}function Aq(e){return Array.isArray(e)?e.flatMap(t=>{if(!it(t))return[];let n=Se(t,"optionId");return n?[{optionId:n,label:Se(t,"label")??Se(t,"title")??Se(t,"name")??n,...Se(t,"description")?{description:Se(t,"description")}:{},raw:t}]:[]}):[]}function Eq(e){if(!it(e))return rc(e);let t=e.outcome;if(typeof t=="string")return t;if(it(t)){let n=Se(t,"outcome")??"selected",r=Se(t,"optionId");return r?`${n}:${r}`:n}return mn(e,["status","reason"])??rc(e)}function Mq(e){return it(e)?Se(e,"title")??Se(e,"name")??Se(e,"kind")??Se(e,"toolName")??"Tool permission":"Tool permission"}function iw(e){let t=Se(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function ow(e){if(!it(e))return;let t=Se(e,"source");if(t)return t;let n=e._meta;return it(n)?Se(n,"source"):void 0}function $n(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function Nq(e,t){let n=Se(e.data,"sessionId");if(!n)return $n(e,t,"missing sessionId");let r=Se(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function Iq(e,t){let n=Se(e.data,"sessionId"),r=Se(e.data,"previous"),s=Se(e.data,"next");if(!n||!r||!s)return $n(e,t,"missing sessionId / previous / next");let i=it(e.data)&&typeof e.data.persisted=="boolean"?e.data.persisted:!1;return[{...t,type:"session.approval_mode.changed",sessionId:n,previous:r,next:s,persisted:i}]}function Rq(e,t){let n=Se(e.data,"scope"),r=Se(e.data,"filePath"),s=Se(e.data,"mode"),i=Qn(it(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||s!=="append"&&s!=="replace"||i===void 0?$n(e,t,"malformed memory_changed payload"):[{...t,type:"workspace.memory.changed",scope:n,filePath:r,mode:s,bytesWritten:i}]}function jq(e,t){let n=Se(e.data,"change"),r=Se(e.data,"name"),s=Se(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||s!=="project"&&s!=="user"?$n(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:r,level:s}]}function Lq(e,t){let n=Se(e.data,"toolName"),r=it(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||r===void 0?$n(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function Dq(e,t){let n=Se(e.data,"key"),r=Se(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:it(e.data)?e.data.value:void 0}]:$n(e,t,"malformed settings_changed payload")}function Oq(e,t){let n=Se(e.data,"path"),r=Se(e.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?$n(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:r}]}function Bq(e,t){let n=Se(e.data,"workspaceCwd"),r=Se(e.data,"desiredState"),s=Se(e.data,"reason");return!n||r!=="trusted"&&r!=="untrusted"?$n(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:r,...s!==void 0?{reason:s}:{}}]}function $q(e,t){let n=Se(e.data,"releaseTag"),r=Se(e.data,"readmeUrl");if(!n||!r||!it(e.data))return $n(e,t,"malformed github_setup_completed payload");let s=e.data.workflows,i=e.data.warnings;return[{...t,type:"workspace.github.setup.completed",releaseTag:n,readmeUrl:r,...typeof e.data.secretsUrl=="string"?{secretsUrl:e.data.secretsUrl}:{},workflows:Array.isArray(s)?s:[],gitignore:e.data.gitignore,warnings:Array.isArray(i)?i.filter(o=>typeof o=="string"):[]}]}function zq(e,t){if(!it(e.data))return $n(e,t,"non-object payload");let n=Qn(e.data,"liveCount"),r=Qn(e.data,"reservedCount"),s=Qn(e.data,"budget"),i=Qn(e.data,"thresholdRatio"),o=Se(e.data,"mode");return n===void 0||r===void 0||s===void 0||i===void 0||o!=="warn"&&o!=="enforce"?$n(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:s,thresholdRatio:i,mode:o}]}function Pq(e,t){if(!it(e.data))return $n(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(it).map(o=>{let a=Se(o,"name"),l=Se(o,"transport"),c=Se(o,"reason");return!a||!l||c!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],r=Qn(e.data,"budget"),s=Qn(e.data,"liveCount"),i=Qn(e.data,"reservedCount");return n.length===0||r===void 0||s===void 0||i===void 0?$n(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:s,reservedCount:i}]}function qq(e,t){let n=Se(e.data,"serverName"),r=Qn(e.data,"durationMs");return!n||r===void 0?$n(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function Fq(e,t){let n=Se(e.data,"serverName"),r=Se(e.data,"reason");return!n||!r||!lq.has(r)?$n(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function Uq(e,t){let n=Qn(e.data,"refreshed"),r=Qn(e.data,"failed"),s=Se(e.data,"status"),i=Se(e.data,"source"),o=Se(e.data,"name"),a=Se(e.data,"version"),l=Se(e.data,"error");return n===void 0||r===void 0||s!==void 0&&s!=="installed"&&s!=="enabled"&&s!=="disabled"&&s!=="updated"&&s!=="uninstalled"&&s!=="failed"?$n(e,t,"malformed extensions_changed payload"):[{...t,type:"workspace.extensions.changed",refreshed:n,failed:r,...s?{status:s}:{},...i?{source:i}:{},...o?{name:o}:{},...a?{version:a}:{},...l?{error:l}:{}}]}function Hq(e,t){let n=Se(e.data,"deviceFlowId"),r=Se(e.data,"providerId"),s=Qn(e.data,"expiresAt");return!n||!r||!tN.has(r)||s===void 0?$n(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:s}]}function Vq(e,t){let n=Se(e.data,"deviceFlowId"),r=Qn(e.data,"intervalMs");return!n||r===void 0?$n(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function Wq(e,t){let n=Se(e.data,"deviceFlowId"),r=Se(e.data,"providerId");if(!n||!r||!tN.has(r))return $n(e,t,"malformed auth_device_flow_authorized payload");let s=Qn(e.data,"expiresAt"),i=Se(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...s!==void 0?{expiresAt:s}:{},...i?{accountAlias:i}:{}}]}function Gq(e,t){let n=Se(e.data,"deviceFlowId"),r=Se(e.data,"errorKind");if(!n||!Kq(r))return $n(e,t,"malformed auth_device_flow_failed payload");let s=Se(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...s?{hint:s}:{}}]}function Kq(e){return typeof e=="string"&&e.trim().length>0}function Yq(e,t){let n=Se(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:$n(e,t,"malformed auth_device_flow_cancelled payload")}function Qn(e,t){if(!it(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Xq(e,t){if(!it(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var Qq=8;function s1(e,t={},n=0){if(n>Qq){let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}if(it(e)){let p=e.rawInput??e.input??e.args;if(p!==void 0&&p!==e){let y=s1(p,{title:t.title??mn(e,["title"]),toolName:t.toolName??mn(e,["toolName","name"]),toolKind:t.toolKind??mn(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let r=nF(e);if(r.length>0)return{kind:"ask_user_question",questions:r};let s=tF(e,t);if(s)return s;let i=oF(e,t);if(i)return i;let o=aF(e,t);if(o)return o;let a=lF(e,t);if(a)return a;let l=Jq(e,t);if(l)return l;let c=Zq(e,t);if(c)return c;let u=eF(e);if(u)return u;let d=cF(e,t);if(d)return d;let f=uF(e);if(f)return f;if(it(e)){let p=mn(e,["command","cmd"]);if(p){let v=mn(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:p,...v?{cwd:v}:{}}}let y=sF(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 Jq(e,t={}){if(!it(e))return;let n=mn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=mn(e,["oldText","old_text","old_str","oldString"]),s=mn(e,["newText","new_text","new_str","newString"]),i=(t.toolName??"").toLowerCase(),o=/(?:^|[_-])(write|create|edit|replace|save|update|overwrite|modify|patch|generate)(?:$|[_-])/.test(i)||!!r,a=s===void 0&&o?mn(e,["content"]):void 0,l=s??a,c=mn(e,["patch","diff","unified_diff"]);if(!(!r&&!l&&!c))return{kind:"file_diff",path:n,...r?{oldText:r}:{},...l?{newText:l}:{},...c?{patch:c}:{}}}function Zq(e,t){if(!it(e))return;let n=mn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=t.toolName??mn(e,["toolName","name"]),s=r!==void 0&&/read|view|cat/i.test(r),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(!(!s&&!o))return{kind:"file_read",path:n,...o?{range:o}:{}}}function eF(e){if(!it(e))return;let t=mn(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=mn(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function tF(e,t){let n=t.toolName??(it(e)?mn(e,["toolName","name"]):void 0);if(!n||!n.startsWith("mcp__"))return;let r=n.slice(5),s=r.indexOf("__");if(s<=0)return;let i=r.slice(0,s),o=r.slice(s+2),a;if(it(e)){let l=e.arguments??e.args??e;if(it(l)){let c=Object.entries(l).filter(([u])=>u!=="name"&&u!=="toolName").slice(0,1).map(([u,d])=>{let f=typeof d=="string"?d:JSON.stringify(d),m=f.length>60?`${f.slice(0,60)}…`:f;return`${u}=${m}`})[0];c&&(a=c)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function nF(e){return!it(e)||!Array.isArray(e.questions)?[]:e.questions.filter(it).map(t=>{let n=mn(t,["header","title","label"]),r=mn(t,["question","prompt","text"])??"Question",s=Array.isArray(t.options)?t.options.filter(it).map(rF):[];return{...n?{header:n}:{},question:r,options:s,raw:t}})}function rF(e){let t=mn(e,["label","title","value"])??"Option",n=mn(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function sF(e){let t=[],n=[["Path",["path","filePath","file_path","absolutePath"]],["Cwd",["cwd","directory","workingDirectory"]],["Query",["query","pattern","search"]],["Note",["description","reason"]]];for(let[r,s]of n){let i=mn(e,s);i&&t.push({label:r,value:i})}if(t.length>0)return t;for(let[r,s]of Object.entries(e).slice(0,4))s==null||Array.isArray(s)||it(s)||t.push({label:r,value:eN(r)?"[redacted]":Wa(s)});return t}var Ek=50,iF=5;function oF(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!it(e))return;let r=mn(e,["subagent_type","agent","agentName","agent_name","subagent"]),s=mn(e,["prompt","task","description","instruction","query"]);if(!r&&!s)return;let i=mn(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:s??"(no task description)",...i?{parentDelegationId:i}:{}}}function aF(e,t){if(!it(e))return;let n=mn(e,["query","pattern","search","q"]);if(!n)return;let r=t.toolName??"";if(!(/(grep|search|find|ripgrep|rg|glob|lookup)/i.test(r)||typeof e.resultCount=="number"||Array.isArray(e.results)||Array.isArray(e.matches)))return;let s=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,iF).map(a=>typeof a=="string"?a:it(a)?mn(a,["path","file","name","title","text"])??rc(a).slice(0,120):String(a)).filter(Boolean),i.length===0&&(i=void 0)),{kind:"search",query:n,...s!==void 0?{resultCount:s}:{},...i?{top:i}:{}}}function lF(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!it(e))return;let r=mn(e,["prompt","description","query"]);if(!r)return;let s=mn(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=mn(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...s?{thumbnailUrl:s}:{},...i?{model:i}:{}}}function cF(e,t){if(!it(e))return;let n=mn(e,["code","snippet","source"]);if(!n)return;let r=mn(e,["language","lang","codeLanguage","syntax"]),s=t.toolName??"",i=/(repl|format|prettier|eslint|tsc|compile|exec[_-]?code)/i.test(s);if(!r&&!i)return;let o=mn(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...o?{origin:o}:{}}}function uF(e){if(!it(e))return;let t=e.columns,n=e.rows;if(Array.isArray(t)&&Array.isArray(n)){let s=t.filter(o=>typeof o=="string").slice(0,30);if(s.length===0)return;let i=n.slice(0,Ek).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:rc(a).slice(0,80)):[]);return{kind:"tabular",columns:s,rows:i,...n.length>i.length?{totalRows:n.length}:{}}}let r=e.data??e.records;if(Array.isArray(r)&&r.length>0&&it(r[0])){let s=Object.keys(r[0]).slice(0,30);if(s.length===0)return;let i=r.slice(0,Ek).map(o=>{let a=o;return s.map(l=>{let c=a[l];return typeof c=="string"?c:rc(c).slice(0,80)})});return{kind:"tabular",columns:s,rows:i,...r.length>i.length?{totalRows:r.length}:{}}}}var dF=1e3,fu="__trimmed_tool_block__",wy="__trimmed_permission_block__",aw=1e5,Mk=`
[truncated]
`,hF=16;function fF(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??dF}}var u5=new Set(["pending","confirming","running","in_progress"]),mF=new Set(["completed","success","failed","error","canceled","cancelled"]),pF=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function gF(e,t,n={}){let r=oN(e,n);m5(r);let s=p5(r,"user",t);return n.images&&n.images.length>0&&(s.images=[...n.images]),Jo(r,s),r.activeUserBlockId=s.id,aN(r)}function yF(e,t,n={}){if(t.length===0)return e;let r=oN(e,n);for(let i of t)bF(r,i);let s=aN(r);return Object.freeze(s.blocks),s}function d5(e){let t={};return e.forEach((n,r)=>{t[n.id]=r}),t}function bF(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!pF.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),g2(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let r=Qi(e,e.activeUserBlockId);r&&r.kind==="user"&&(r.images=[...r.images??[],{data:t.data,mimeType:t.mimeType}])}else{let r=p5(e,"user","");r.images=[{data:t.data,mimeType:t.mimeType}],Jo(e,r),e.activeUserBlockId=r.id}break}case"assistant.text.delta":g2(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":m5(e,t),(t.reason==="cancelled"||t.reason==="error")&&lw(e);break;case"assistant.usage":vF(e,t);break;case"thought.text.delta":g2(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":iN(e,t);break;case"shell.output":SF(e,t);break;case"user.shell.output":TF(e,t);break;case"permission.request":CF(e,t);break;case"permission.resolved":AF(e,t);break;case"model.changed":Kf(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Kf(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":xF(e,t);break;case"prompt.cancelled":lw(e),t.reason!=="forward_failed"&&EF(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":NF(e,t.targetTurnIndex);break;case"session.branched":Kf(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function xF(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},lw(e),Kf(e,"error",`State resync required: ${wF(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function wF(e,t){let n=e+1,r=t-1;return r<n?"no events lost (resync requested without gap)":r===n?`missed 1 daemon event (id ${n})`:`missed daemon events ${n}-${r}`}function vy(e,t,n){let r=Qi(e,t);((r==null?void 0:r.kind)==="assistant"||(r==null?void 0:r.kind)==="thought")&&(r.streaming=!1,r.updatedAt=e.now,(n==null?void 0:n.eventId)!==void 0&&(r.eventId=n.eventId),r.serverTimestamp===void 0&&(n==null?void 0:n.serverTimestamp)!==void 0&&(r.serverTimestamp=n.serverTimestamp))}function rN(e,t){vy(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function vF(e,t){let n=Qi(e,e.activeAssistantBlockId);if(!n||n.kind!=="assistant")return;let r=n.usage;n.usage={inputTokens:((r==null?void 0:r.inputTokens)??0)+t.usage.inputTokens,outputTokens:((r==null?void 0:r.outputTokens)??0)+t.usage.outputTokens,cachedTokens:((r==null?void 0:r.cachedTokens)??0)+(t.usage.cachedTokens??0)},n.updatedAt=e.now}function sN(e,t){vy(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function h5(e,t,n){vy(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function f5(e,t,n){vy(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function g2(e,t,n,r,s){let i=t!=="user"&&"parentToolCallId"in s?s.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=Qi(e,a);if(l&&l.kind===t&&_F(l,s)){l.text=y5(l.text,r),l.updatedAt=e.now,s.eventId!==void 0&&(l.eventId=s.eventId),s.serverTimestamp!==void 0&&(l.serverTimestamp=s.serverTimestamp),"meta"in s&&s.meta&&(l.meta={...l.meta,...s.meta}),(t==="assistant"||t==="thought")&&(l.streaming=!0);return}let c=p5(e,t,r,s.eventId,s.serverTimestamp,"meta"in s?s.meta:void 0);(t==="assistant"||t==="thought")&&(c.streaming=!0),t==="thought"&&(c.collapsed=!0),i!=null&&(c.parentToolCallId=i),Jo(e,c),o&&i!=null?o[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&f5(e,i),t==="thought"&&h5(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&rN(e),t!=="thought"&&sN(e))}function _F(e,t){var n,r;return e.kind!=="user"&&e.kind!=="assistant"&&e.kind!=="thought"||((n=e.meta)==null?void 0:n.qwenDiscreteMessage)===!0?!1:!("meta"in t)||((r=t.meta)==null?void 0:r.qwenDiscreteMessage)!==!0}function m5(e,t){rN(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))h5(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))f5(e,n,t);sN(e,t)}function iN(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===fu){if(MF(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],iN(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Kf(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let r=Qi(e,n);if((r==null?void 0:r.kind)==="tool"){if(t.title!==void 0&&(r.title=t.title),t.status!==void 0&&(r.status=t.status),t.rawInput!==void 0&&(r.preview=s1(t.rawInput,{title:t.title,toolName:t.toolName,toolKind:t.toolKind})),r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId),t.details&&(r.details=t.details),t.content!==void 0&&(r.content=t.content),t.locations!==void 0&&(r.locations=t.locations),t.rawInput!==void 0&&(r.rawInput=t.rawInput),t.rawOutput!==void 0&&(r.rawOutput=t.rawOutput),t.toolName&&(r.toolName=t.toolName),t.toolKind&&(r.toolKind=t.toolKind),t.parentToolCallId&&!r.parentToolCallId&&(r.parentToolCallId=t.parentToolCallId),r.parentToolCallId&&!r.parentBlockId){let o=e.toolBlockByCallId[r.parentToolCallId];o&&o!==fu&&(r.parentBlockId=o)}t.subagentType&&!r.subagentType&&(r.subagentType=t.subagentType),Nk(e,t.toolCallId,t.status);return}let s=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==fu?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:gc(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:s1(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}:{},...s?{parentBlockId:s}:{}};Jo(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=Qi(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}Nk(e,t.toolCallId,t.status??"pending"),Ou(e,t.parentToolCallId)}function Nk(e,t,n){if(n!==void 0){if(u5.has(n)){e.currentToolCallId=t;return}if(mF.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=kF(e));return}}}function kF(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"&&u5.has(n.status))return n.toolCallId}}function lw(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===fu)continue;let n=Qi(e,t);!n||n.kind!=="tool"||u5.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function SF(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 s=Qi(e,n.id);(s==null?void 0:s.kind)==="shell"&&(s.text=y5(s.text,t.text),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId));return}let r={id:gc(e,"shell"),kind:"shell",text:om(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}:{}};Jo(e,r),Ou(e)}function TF(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=Qi(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=y5(o.text,t.text),o.updatedAt=e.now,t.eventId!==void 0&&(o.eventId=t.eventId));return}let r=e.pendingUserShellCommand,s=(n==null?void 0:n.kind)==="user_shell"?n:void 0,i={id:gc(e,"user-shell"),kind:"user_shell",text:om(t.text),command:(r==null?void 0:r.command)??(s==null?void 0:s.command)??"",...r!=null&&r.cwd||s!=null&&s.cwd?{cwd:(r==null?void 0:r.cwd)??(s==null?void 0:s.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,Jo(e,i),Ou(e)}function CF(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===wy)return;let r=Qi(e,n),s=s1(t.toolCall,{title:t.title});if((r==null?void 0:r.kind)==="permission"){r.title=t.title,r.options=t.options.map(o=>({...o})),r.toolCall=t.toolCall,r.preview=s,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let i={id:gc(e,"permission"),kind:"permission",requestId:t.requestId,title:t.title,options:t.options.map(o=>({...o})),preview:s,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}:{}};Jo(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,Ou(e)}function AF(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===wy)return;let r=Qi(e,n);if((r==null?void 0:r.kind)==="permission"){r.resolved=t.outcome,r.updatedAt=e.now,t.eventId!==void 0&&(r.eventId=t.eventId);return}let s={id:gc(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}:{}};Jo(e,s),e.permissionBlockByRequestId[t.requestId]=s.id,Ou(e)}function Kf(e,t,n,r,s={}){let i={id:gc(e,t),kind:t,text:om(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...(r==null?void 0:r.eventId)!==void 0?{eventId:r.eventId}:{},...(r==null?void 0:r.serverTimestamp)!==void 0?{serverTimestamp:r.serverTimestamp}:{},...(r==null?void 0:r.type)==="error"&&r.code?{code:r.code}:{},...(r==null?void 0:r.type)==="error"&&r.promptId?{promptId:r.promptId}:{},...(r==null?void 0:r.type)==="error"&&r.source?{source:r.source}:{},...((r==null?void 0:r.type)==="status"||(r==null?void 0:r.type)==="debug")&&r.source?{source:r.source}:{},...((r==null?void 0:r.type)==="status"||(r==null?void 0:r.type)==="debug")&&r.data!==void 0?{data:r.data}:{},...(r==null?void 0:r.type)==="session.branched"?{source:"session_branched",data:{sourceSessionId:r.sourceSessionId,newSessionId:r.newSessionId,displayName:r.displayName}}:{}};Jo(e,i),s.clearActiveText!==!1&&Ou(e)}function EF(e,t){let n={id:gc(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}:{}};Jo(e,n),Ou(e)}function p5(e,t,n,r,s,i){return{id:gc(e,t),kind:t,text:om(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...r!==void 0?{eventId:r}:{},...s!==void 0?{serverTimestamp:s}:{},...i?{meta:{...i}}:{}}}function oN(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,r])=>[n,{...r}])),lastResyncRequired:e.lastResyncRequired!==void 0?{...e.lastResyncRequired}:void 0,lastFollowupSuggestion:e.lastFollowupSuggestion}}function aN(e){if(e.blocks.length<=e.maxBlocks)return e;let t=e.blocks.slice(-e.maxBlocks),n=new Set(t.map(r=>r.id));e.blocks=t,e.blockIndexById=d5(t),i1.set(e,e.blocks);for(let[r,s]of Object.entries(e.toolBlockByCallId))n.has(s)||(e.toolBlockByCallId[r]=fu);jF(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==fu&&delete e.trimmedToolNotificationByCallId[r];for(let[r,s]of Object.entries(e.permissionBlockByRequestId))n.has(s)||(e.permissionBlockByRequestId[r]=wy);LF(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let s=Qi(e,r.id);(s==null?void 0:s.kind)==="tool"&&(s.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[r,s]of Object.entries(e.activeAssistantBlockByParent))n.has(s)||delete e.activeAssistantBlockByParent[r];for(let[r,s]of Object.entries(e.activeThoughtBlockByParent))n.has(s)||delete e.activeThoughtBlockByParent[r];return e}function MF(e){return e.toolCallId===rw||e.toolKind==="updated_plan"}var i1=new WeakMap;function g5(e){i1.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},i1.set(e,e.blocks))}function NF(e,t){var s;let n=0,r=-1;for(let i=0;i<e.blocks.length;i+=1)if(((s=e.blocks[i])==null?void 0:s.kind)==="user"){if(r=i,n===t){Ik(e,i);return}n+=1}r>=0&&t>=n&&Ik(e,r)}function Ik(e,t){g5(e),e.blocks=e.blocks.slice(0,t),i1.set(e,e.blocks),IF(e)}function IF(e){e.blockIndexById=d5(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 Jo(e,t){g5(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function Qi(e,t){if(!t)return;let n=e.blockIndexById[t];if(n===void 0)return;let r=e.blocks[n];if(!r||r.id!==t)return;let s=RF(r);return g5(e),e.blocks[n]=s,s}function RF(e){return e.kind==="permission"?{...e,options:e.options.map(t=>Lo(t)),toolCall:Lo(e.toolCall),preview:Lo(e.preview)}:e.kind==="tool"?{...e,preview:Lo(e.preview),content:Lo(e.content),locations:Lo(e.locations),rawInput:Lo(e.rawInput),rawOutput:Lo(e.rawOutput)}:{...e}}function gc(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function Ou(e,t){t?(h5(e,t),f5(e,t)):(m5(e),e.activeUserBlockId=void 0)}function y5(e,t){return e.length>=aw?e:om(e+t)}function om(e){if(e.length<=aw)return e;let t=Math.max(0,aw-Mk.length);return`${e.slice(0,t)}${Mk}`}function jF(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,s])=>s===fu).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.toolBlockByCallId[s],delete e.trimmedToolNotificationByCallId[s]}function LF(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,s])=>s===wy).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.permissionBlockByRequestId[s]}function Lo(e,t=0){return t>hF?e:Array.isArray(e)?e.map(n=>Lo(n,t+1)):it(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Lo(r,t+1)])):e}function DF(e={}){let t=Rk(e),n=new Set,r=!1,s=()=>{for(let o of n)try{o()}catch(a){OF(a)}},i=()=>{r||(r=!0,queueMicrotask(()=>{r=!1,s()}))};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=yF(t,a),i())},appendLocalUserMessage(o,a){t=gF(t,o,{images:a}),i()},reset(o={}){t=Rk({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 OF(e){var r;let t=globalThis.reportError;if(typeof t=="function"){t(e);return}let n=(r=globalThis.console)==null?void 0:r.error;typeof n=="function"&&n.call(globalThis.console,e)}function Rk(e){let t=e.blocks?[...e.blocks]:[];return{...fF({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:d5(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 BF="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function $F(e,t){var n;if(!e)return{models:[]};const r=new Set,s=[];let i=(n=e.current)==null?void 0:n.modelId,o;for(const a of e.providers)for(const l of a.models){!i&&l.isCurrent&&(i=l.modelId),o===void 0&&(i?l.modelId===i:l.isCurrent)&&(o=l.contextLimit);const c=[a.authType,l.modelId,l.baseUrl??"",l.envKey??""].join("\0");r.has(c)||(r.add(c),s.push({id:l.modelId,baseModelId:l.baseModelId,label:l.name||l.modelId,authType:a.authType,...l.contextLimit!==void 0?{contextWindow:l.contextLimit}:{},...l.modalities!==void 0?{modalities:l.modalities}:{},...l.baseUrl!==void 0?{baseUrl:l.baseUrl}:{},...l.envKey!==void 0?{envKey:l.envKey}:{},...l.isRuntime?{isRuntime:!0}:{}}))}return{models:s,currentModel:i,contextWindow:o}}function zF(e){var t;const n=us((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const r=Sr(n,"currentModelId")??Sr(n,"currentModel"),s=n.availableModels,i=[];let o;if(Array.isArray(s))for(const a of s){const l=us(a),c=Sr(l,"modelId")??Sr(l,"id")??Sr(l,"value");if(!c)continue;const u=us(l==null?void 0:l._meta),d=kf(u,"contextLimit")??kf(u,"contextWindow")??kf(l,"contextLimit")??kf(l,"contextWindow");o===void 0&&r!==void 0&&c===r&&(o=d),i.push({id:c,baseModelId:Sr(l,"baseModelId")??VF(c),label:Sr(l,"name")??Sr(l,"label")??c,...d!==void 0?{contextWindow:d}:{}})}if(!(!r&&i.length===0))return{models:i,currentModel:r,contextWindow:o}}function lN(e){if(!e)return{commands:[],skills:[]};const t=e.availableCommands.map(r=>{var s;return{name:r.name,description:r.description||"",...(s=r.input)!=null&&s.hint?{argumentHint:r.input.hint}:{},...dN(r._meta),raw:r}}),n=e.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:cN(t,n),skills:e.availableSkills}}function cN(...e){const t=new Map;for(const n of e)for(const r of n){const s=t.get(r.name);s?t.set(r.name,{...s,...r,description:r.description||s.description,argumentHint:r.argumentHint??s.argumentHint,raw:r.raw}):t.set(r.name,r)}return[...t.values()]}function PF(e,t){var n;if(e.type==="session_update"){const r=us((n=us(e.data))==null?void 0:n.update),s=uN(r);if(s&&t(i=>({...i,tokenUsage:s,tokenCount:b5(s)})),Sr(r,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=HF(r);t(a=>({...a,commands:i.length>0?i:a.commands,skills:o}))}return}switch(e.type){case"session_metadata_updated":{const r=us(e.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&t(s=>({...s,displayName:Sr(r,"displayName")}));break}case"model_switched":{const r=Sr(us(e.data),"modelId");r&&t(s=>({...s,currentModel:r}));break}case"approval_mode_changed":{const r=us(e.data),s=Sr(r,"next")??Sr(r,"mode");s&&t(i=>({...i,currentMode:s}));break}}}function qF(e){const t=Sr(e,"displayName");return t!=null&&t.trim()?t:void 0}function FF(e){var t;const n=us((t=e==null?void 0:e.state)==null?void 0:t.modes);return Sr(n,"currentModeId")??Sr(n,"currentMode")}function b5(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((r,s)=>r+(typeof s=="number"?s:0),0);return n>0?n:void 0}function UF(e){var t;for(let n=e.length-1;n>=0;n--)try{const r=e[n];if(r.type!=="session_update")continue;const s=us((t=us(r.data))==null?void 0:t.update),i=uN(s);if(i)return i}catch{}}function uN(e){const t=us(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=us(t==null?void 0:t.usage),r={...tf(n,"inputTokens"),...tf(n,"outputTokens"),...tf(n,"totalTokens"),...tf(n,"thoughtTokens"),...tf(n,"cachedReadTokens")};return b5(r)!==void 0?r:void 0}function tf(e,t){const n=kf(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function HF(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=us(i),l=Sr(a,"name");if(!l)return[];const c=us(a==null?void 0:a.input),u={name:l,description:Sr(a,"description")??"",input:c?{hint:Sr(c,"hint")??""}:null,_meta:us(a==null?void 0:a._meta)??null};return[{name:l,description:u.description??"",...(o=u.input)!=null&&o.hint?{argumentHint:u.input.hint}:{},...dN(u._meta),raw:u}]}),r=Array.isArray(e.availableSkills)?e.availableSkills.filter(i=>typeof i=="string"):[],s=r.map(i=>({name:i,description:"",raw:{name:i,description:"",input:null,_meta:{source:"skill"}}}));return{commands:cN(n,s),skills:r}}function dN(e){const n=Sr(e??void 0,"source");return{...n?{source:n}:{}}}function us(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Sr(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function kf(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function VF(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 WF(e,t=[]){const n=[{type:"text",text:e}];for(const r of t){const s=r.mimeType??r.mediaType??r.media_type;s&&s!=="image/*"?n.push({type:"image",data:r.data,mimeType:s}):n.push({type:"image",data:r.data})}return n}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const GF=3e4;function KF(e,t,n){const r=Number.isFinite(t)&&t>0?t:1e3,s=Number.isFinite(n)&&n>0?Math.max(r,n):r,i=r*2**Math.max(0,e-1),o=Math.min(i,s),a=.8+Math.random()*.4;return Math.min(s,Math.max(1,Math.round(o*a)))}async function Ye(e,t,n=GF){let r;try{return await Promise.race([e,new Promise((s,i)=>{r=setTimeout(()=>{i(new Error(`${t} after ${n}ms`))},n)})])}finally{r!==void 0&&clearTimeout(r)}}function YF(e,t){return e<=0||t.aborted?Promise.resolve():new Promise(n=>{const r=setTimeout(s,e);function s(){clearTimeout(r),t.removeEventListener("abort",s),n()}t.addEventListener("abort",s,{once:!0})})}function Nr(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function XF(e,t,n="replay",r=80,s){Nr(t),t.current=setTimeout(()=>{t.current=void 0,e.getSnapshot().activeAssistantBlockId&&(e.dispatch({type:"assistant.done",reason:n}),s==null||s())},r)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const QF="qwen-code-webui-client-id:session:";function jk(e,t){if(e)return e;if(typeof window>"u")return y2();try{if(t){const n=window.sessionStorage.getItem(hN(t));if(n)return n}return y2()}catch{return y2()}}function cw(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(hN(t),e)}catch{}}async function Lk(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${JF(e.baseUrl)}/session/${encodeURIComponent(e.sessionId)}/detach`,r=await fetch(n,{method:"POST",headers:t,keepalive:!0});if(!(r.status===204||r.status===404))throw new Error(`Detach client failed (${r.status})`)}function y2(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function hN(e){return`${QF}${encodeURIComponent(e)}`}function JF(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 ZF({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:s,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,passiveAssistantDoneTimerRef:a,getCreateSessionRequest:l,hasSessionActivePrompt:c,resetCurrentSessionActivePrompt:u,addNotice:d,setConnection:f,setPromptStatus:m,setRestoreSessionId:p,setRestoreMode:y,setRestoreSessionNonce:v,setNewSessionNonce:b}){function x(w,k,T){var C,A;const L=i.current+1;i.current=L,s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException(`Session ${k} superseded by a newer request`,"AbortError")));const $=new Promise((M,U)=>{const K=setTimeout(()=>{var J;((J=s.current)==null?void 0:J.id)===L&&(s.current=void 0,U(Sn(d,`${sU(k)} session failed`,new Error(`Session ${k} timed out`),k==="load"?"load_session":"resume_session")))},3e4);s.current={id:L,sessionId:w,mode:k,timeout:K,resolve:M,reject:U}}),E=(C=t.current)==null?void 0:C.sessionId,z=E?n.current.get(E):void 0;return(A=z==null?void 0:z.reject)==null||A.call(z,new DOMException("Session switch interrupted prompt wait","AbortError")),E&&n.current.delete(E),u(),f(M=>({...M,status:"connecting",error:void 0,catchingUp:!0})),m("idle"),r.current.clear(),Nr(a),T!=null&&T.deferTranscriptReset||e.reset(),y(k),p(w),v(M=>M+1),T!=null&&T.deferTranscriptReset?$.catch(M=>{if(!Sf(M)){e.reset();const U=M instanceof Error?M.message:String(M);f(K=>({...K,status:"disconnected",error:U,catchingUp:void 0}))}throw M}):$}return{async sendPrompt(w,k){var T,C,A;const L=Hn(d,t.current,"Prompt failed","send_prompt"),$=L.sessionId;if(n.current.has($))throw Sn(d,"Prompt failed","A prompt is already in progress","send_prompt");Nr(a),m("waiting");const E=new AbortController;n.current.set($,{controller:E});try{const z=((k==null?void 0:k.images)??[]).map(K=>({data:K.data,mimeType:K.mimeType||K.mediaType||K.media_type||"image/*"}));(k==null?void 0:k.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(w,z);const M={prompt:WF(w,z)};k!=null&&k.retry&&(M.retry=!0);const U=await L.submitPrompt(M,E.signal);return await eU(n.current,r.current,$,E,U.promptId)}catch(z){if(Sf(z))return((T=t.current)==null?void 0:T.sessionId)===$&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw QM(z)?z:(((C=t.current)==null?void 0:C.sessionId)===$&&e.dispatch({type:"assistant.done",reason:"error"}),Sn(d,"Prompt failed",z,"send_prompt"))}finally{const z=n.current.get($);(z==null?void 0:z.controller)===E&&n.current.delete($),((A=t.current)==null?void 0:A.sessionId)===$&&!c()&&m("idle")}},async cancel(){var w,k;const T=Hn(d,t.current,"Cancel failed","cancel_prompt"),C=n.current.get(T.sessionId);C==null||C.controller.abort(),Nr(a);const A=C?new AbortController:void 0;A&&n.current.set(T.sessionId,{controller:A});try{await Ye(T.cancel(),"Cancel timed out")}catch(L){throw Sn(d,"Cancel failed",L,"cancel_prompt")}finally{A&&((w=n.current.get(T.sessionId))==null?void 0:w.controller)===A&&n.current.delete(T.sessionId),((k=t.current)==null?void 0:k.sessionId)===T.sessionId&&!c()&&m("idle")}},async setModel(w){const k=Hn(d,t.current,"Set model failed","switch_model");try{const T=await Ye(k.setModel(w),"Set model timed out");return f(C=>({...C,currentModel:w})),T}catch(T){throw Sn(d,"Set model failed",T,"switch_model")}},async setApprovalMode(w,k){const T=Hn(d,t.current,"Set approval mode failed","set_approval_mode");try{const C=await Ye(T.client.setSessionApprovalMode(T.sessionId,w,{persist:k==null?void 0:k.persist,clientId:T.clientId}),"Set approval mode timed out");return f(A=>({...A,currentMode:C.mode||w})),C}catch(C){throw Sn(d,"Set approval mode failed",C,"set_approval_mode")}},async respondToPermission(w,k){const T=Hn(d,t.current,"Permission response failed","submit_permission");try{return await Ye(T.respondToSessionPermission(w,k),"Permission response timed out")}catch(C){throw Sn(d,"Permission response failed",C,"submit_permission")}},async submitPermission(w,k,T){const C=Hn(d,t.current,"Permission response failed","submit_permission"),A=k!==void 0&&k.length>0?{outcome:{outcome:"selected",optionId:k},...T?{answers:T}:{}}:{outcome:{outcome:"cancelled"},...T?{answers:T}:{}};try{return await Ye(C.respondToSessionPermission(w,A),"Permission response timed out")}catch(L){throw Sn(d,"Permission response failed",L,"submit_permission")}},async heartbeat(){const w=t.current;if(!(!w||!o.current))return Ye(w.heartbeat(),"Heartbeat timed out")},async listSessions(w){const k=t.current;if(!k)return[];try{return await Ye(k.client.listWorkspaceSessions(k.workspaceCwd,w),"List sessions timed out")}catch(T){throw Sn(d,"List sessions failed",T,"list_sessions")}},async loadSession(w,k){return x(w,"load",k)},async resumeSession(w,k){return x(w,"resume",k)},async createSession(){const w=Hn(d,t.current,"Create session failed","create_session"),k=await Ye(w.client.createOrAttachSession(l()),"Create session timed out");return cw(k.clientId,k.sessionId),k},async newSession(){for(const[,w]of n.current)w.controller.abort();n.current.clear(),r.current.clear(),m("idle"),Nr(a),s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException("New session requested","AbortError")),s.current=void 0),e.reset(),p(void 0),b(w=>w+1)},async releaseSession(w){try{const k=Hn(d,t.current,"Release session failed","release_session");await Ye(k.client.closeSession(w),"Release session timed out")}catch(k){throw Sn(d,"Release session failed",k,"release_session")}},async closeSession(){const w=Hn(d,t.current,"Close session failed","close_session");try{await Ye(w.close(),"Close session timed out")}catch(k){throw Sn(d,"Close session failed",k,"close_session")}},async refreshCommands(){const w=Hn(d,t.current,"Refresh commands failed","refresh_commands");try{const k=await Ye(w.supportedCommands(),"Refresh commands timed out"),{commands:T,skills:C}=lN(k);f(A=>({...A,commands:T,skills:C,supportedCommands:k}))}catch(k){throw Sn(d,"Refresh commands failed",k,"refresh_commands")}},async getContext(){const w=Hn(d,t.current,"Load context failed","load_context");try{const k=await Ye(w.context(),"Load context timed out");return f(T=>({...T,context:k,currentMode:tU(k)??T.currentMode,currentModel:nU(k)??T.currentModel})),k}catch(k){throw Sn(d,"Load context failed",k,"load_context")}},async getContextUsage(w){const k=Hn(d,t.current,"Load context usage failed","load_context_usage");try{return await Ye(k.contextUsage(w),"Load context usage timed out")}catch(T){throw Sn(d,"Load context usage failed",T,"load_context_usage")}},async renameSession(w){const k=Hn(d,t.current,"Rename session failed","rename_session");try{return await Ye(k.updateMetadata({displayName:w}),"Rename session timed out")}catch(T){throw Sn(d,"Rename session failed",T,"rename_session")}},async recapSession(){const w=Hn(d,t.current,"Recap session failed","recap_session");try{return await Ye(w.recap(),"Recap session timed out")}catch(k){throw Sn(d,"Recap session failed",k,"recap_session")}},async getRewindSnapshots(){const w=Hn(d,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await Ye(w.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(k){throw Sn(d,"Load rewind snapshots failed",k,"rewind_snapshots")}},async rewindSession(w,k){const T=Hn(d,t.current,"Rewind session failed","rewind_session");try{return await Ye(T.rewind(w,k),"Rewind session timed out")}catch(C){throw Sn(d,"Rewind session failed",C,"rewind_session")}},async btwSession(w,k){var T;const C=Hn(d,t.current,"Side question failed","btw_session");try{return await Ye(C.btw(w,k),"Side question timed out")}catch(A){throw(T=k==null?void 0:k.signal)!=null&&T.aborted||Sf(A)?A:Sn(d,"Side question failed",A,"btw_session")}},async enqueueMidTurnMessage(w,k){const T=t.current;if(!T)return{accepted:!1};try{return await T.enqueueMidTurnMessage(w,k)}catch(C){return C instanceof DOMException&&C.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",C),{accepted:!1}}},async sendShellCommand(w){var k,T;const C=Hn(d,t.current,"Shell command failed","send_shell_command"),A=`${C.sessionId}:shell`;m("waiting");const L=new AbortController;n.current.set(A,{controller:L});try{return await C.shellCommand(w,L.signal)}catch($){throw Sn(d,"Shell command failed",$,"send_shell_command")}finally{((k=n.current.get(A))==null?void 0:k.controller)===L&&n.current.delete(A),((T=t.current)==null?void 0:T.sessionId)===C.sessionId&&!c()&&m("idle")}},async getTasks(){const w=Hn(d,t.current,"Get tasks failed","load_tasks");try{return await Ye(w.tasks(),"Get tasks timed out")}catch(k){throw Sn(d,"Get tasks failed",k,"load_tasks")}},async cancelTask(w,k){const T=Hn(d,t.current,"Cancel task failed","cancel_task");try{return await Ye(T.cancelTask(w,k),"Cancel task timed out")}catch(C){throw Sn(d,"Cancel task failed",C,"cancel_task")}},async clearGoal(){const w=Hn(d,t.current,"Clear goal failed","clear_goal");try{return await Ye(w.clearGoal(),"Clear goal timed out")}catch(k){throw Sn(d,"Clear goal failed",k,"clear_goal")}},async getStats(){const w=Hn(d,t.current,"Load stats failed","load_stats");try{return await Ye(w.stats(),"Load stats timed out")}catch(k){throw Sn(d,"Load stats failed",k,"load_stats")}},async respondToGlobalPermission(w,k){const T=Hn(d,t.current,"Global permission response failed","submit_permission");try{return await Ye(T.client.respondToPermission(w,k),"Global permission response timed out")}catch(C){throw Sn(d,"Global permission response failed",C,"submit_permission")}},async branchSession(w){const k=Hn(d,t.current,"Branch session failed","branch_session");try{const T=await Ye(k.client.branchSession(k.sessionId,{name:w},k.clientId),"Branch session timed out");return cw(T.clientId,T.sessionId),x(T.sessionId,"load").catch(C=>{Sf(C)||Sn(d,"Branch session failed",C,"branch_session")}),{sessionId:T.sessionId,displayName:T.displayName}}catch(T){throw Sn(d,"Branch session failed",T,"branch_session")}},async forkSession(w){const k=Hn(d,t.current,"Fork session failed","fork_session");try{return await Ye(k.fork(w),"Fork session timed out")}catch(T){throw Sn(d,"Fork session failed",T,"fork_session")}}}}function eU(e,t,n,r,s){return new Promise((i,o)=>{const a=uw(n,s),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)!==r){o(new DOMException("Aborted","AbortError"));return}if(c.promptId!==void 0&&c.promptId!==s){o(new Error(`Prompt accepted with unexpected id ${s}`));return}if(r.signal.aborted){e.delete(n),o(r.signal.reason??new DOMException("Aborted","AbortError"));return}const u=()=>{r.signal.removeEventListener("abort",d)},d=()=>{const f=e.get(n);(f==null?void 0:f.controller)===r&&e.delete(n),u(),o(r.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...c,promptId:s,resolve:f=>{u(),i(f)},reject:f=>{u(),o(f)}}),r.signal.addEventListener("abort",d,{once:!0})})}function uw(e,t){return JSON.stringify([e,t])}function tU(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 nU(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 Hn(e,t,n,r){if(!t)throw Sn(e,n,"Daemon session is not connected",r);return t}function Sn(e,t,n,r){if(Sf(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 s=n instanceof Error?n.message:String(n);return e({severity:"error",category:"user_action",operation:r,code:`daemon.${r}.failed`,message:`${t}: ${s}`,debugMessage:s,recoverable:!0}),rU(n instanceof Error?n:new Error(s))}function Sf(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function rU(e){return Object.assign(e,{_alreadyDispatched:!0})}function sU(e){return e.charAt(0).toUpperCase()+e.slice(1)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const iU=33e4;function oU({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:r}){return{async listSessions(s){const i=Nt(e,"List sessions failed"),o=t();return o?Ye(i.listWorkspaceSessions(o,s),"List sessions timed out"):[]},async deleteSession(s){const i=Nt(e,"Delete session failed"),o=await Ye(i.deleteSessionsData([s]),"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(s){const i=Nt(e,"Delete sessions failed");return Ye(i.deleteSessionsData(s),"Delete sessions timed out")},async loadMcpStatus(){const s=Nt(e,"Load MCP status failed");return Ye(s.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(s){const i=Nt(e,"Load MCP tools failed");try{return await Ye(i.workspaceMcpTools(s),"Load MCP tools timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,tools:[],errors:[{kind:"mcp_tools",status:"error",error:"The connected daemon does not expose MCP tool details."}]}}},async loadMcpResources(s){const i=Nt(e,"Load MCP resources failed");try{return await Ye(i.workspaceMcpResources(s),"Load MCP resources timed out")}catch{return{v:1,workspaceCwd:"",serverName:s,initialized:!1,acpChannelLive:!1,resources:[],errors:[{kind:"mcp_resources",status:"error",error:"The connected daemon does not expose MCP resource details."}]}}},async restartMcpServer(s){const i=Nt(e,"Restart MCP server failed");return Ye(i.restartMcpServer(s),"Restart MCP server timed out",5*6e4)},async manageMcpServer(s,i){const o=Nt(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return Ye(o.manageMcpServer(s,i),"Manage MCP server timed out",a)},async loadSkillsStatus(){const s=Nt(e,"Load skills failed");return Ye(s.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const s=Nt(e,"Load extensions failed");return Ye(s.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const s=Nt(e,"Load tools failed");return Ye(s.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(s,i){const o=Nt(e,"Set tool enabled failed");return Ye(o.setWorkspaceToolEnabled(s,i),"Set tool enabled timed out")},async loadSettingsStatus(){const s=Nt(e,"Load settings failed");return Ye(s.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(s,i,o){const a=Nt(e,"Set setting failed");return Ye(a.setWorkspaceSetting(s,i,o),"Set setting timed out")},async loadMemoryStatus(){const s=Nt(e,"Load memory failed");return Ye(s.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(s){const i=Nt(e,"Read workspace file failed");return Ye(i.readWorkspaceFile(s),"Read workspace file timed out")},async writeMemory(s){const i=Nt(e,"Write memory failed");return Ye(i.writeWorkspaceMemory(s),"Write memory timed out")},async listAgents(){const s=Nt(e,"List agents failed");return Ye(s.listWorkspaceAgents(),"List agents timed out")},async getAgent(s){const i=Nt(e,"Get agent failed");return Ye(i.getWorkspaceAgent(s),"Get agent timed out")},async createAgent(s){const i=Nt(e,"Create agent failed");return Ye(i.createWorkspaceAgent(s),"Create agent timed out")},async generateAgent(s){const i=Nt(e,"Generate agent failed");return Ye(i.generateWorkspaceAgent(s),"Generate agent timed out",iU)},async deleteAgent(s,i){const o=Nt(e,"Delete agent failed");return Ye(o.deleteWorkspaceAgent(s,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(s,i){Nt(e,"Glob workspace failed");const o=x2(n,"/glob");o.searchParams.set("pattern",s),(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 Ye(fetch(w2(o,n),{headers:b2(r)}),"Glob workspace timed out");if(!a.ok)throw new Error(await v2(a,"GET /glob"));const l=await a.json();return{matches:Array.isArray(l.matches)?l.matches.filter(c=>typeof c=="string"):[]}},async loadProviders(){const s=Nt(e,"Load providers failed");return Ye(s.workspaceProviders(),"Load providers timed out")},async readFileBytes(s,i){const o=Nt(e,"Read file bytes failed");return Ye(o.readWorkspaceFileBytes(s,i??{}),"Read file bytes timed out")},async writeFile(s){const i=Nt(e,"Write file failed");return Ye(i.writeWorkspaceFile(s),"Write file timed out")},async editFile(s){const i=Nt(e,"Edit file failed");return Ye(i.editWorkspaceFile(s),"Edit file timed out")},async stat(s){Nt(e,"Stat file failed");const i=x2(n,"/stat");i.searchParams.set("path",s);const o=await Ye(fetch(w2(i,n),{headers:b2(r)}),"Stat file timed out");if(!o.ok)throw new Error(await v2(o,"GET /stat"));return await o.json()},async listDirectory(s){Nt(e,"List directory failed");const i=x2(n,"/list");i.searchParams.set("path",s);const o=await Ye(fetch(w2(i,n),{headers:b2(r)}),"List directory timed out");if(!o.ok)throw new Error(await v2(o,"GET /list"));return await o.json()},async loadEnv(){const s=Nt(e,"Load env failed");return Ye(s.workspaceEnv(),"Load env timed out")},async loadPreflight(){const s=Nt(e,"Load preflight failed");return Ye(s.workspacePreflight(),"Load preflight timed out")},async initWorkspace(s){const i=Nt(e,"Init workspace failed");return Ye(i.initWorkspace(s),"Init workspace timed out")},async updateAgent(s,i,o){const a=Nt(e,"Update agent failed");return Ye(a.updateWorkspaceAgent(s,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(s,i){const o=Nt(e,"Install extension failed");return Ye(o.installExtension(s,i),"Install extension timed out")},async extensionOperationStatus(s){const i=Nt(e,"Load extension operation failed");return Ye(i.extensionOperationStatus(s),"Load extension operation timed out")},async checkExtensionUpdates(s){const i=Nt(e,"Check extension updates failed");return Ye(i.checkExtensionUpdates(s),"Check extension updates timed out")},async refreshExtensions(s){const i=Nt(e,"Refresh extensions failed");return Ye(i.refreshExtensions(s),"Refresh extensions timed out")},async enableExtension(s,i,o){const a=Nt(e,"Enable extension failed");return Ye(a.enableExtension(s,i,o),"Enable extension timed out")},async disableExtension(s,i,o){const a=Nt(e,"Disable extension failed");return Ye(a.disableExtension(s,i,o),"Disable extension timed out")},async updateExtension(s,i){const o=Nt(e,"Update extension failed");return Ye(o.updateExtension(s,i),"Update extension timed out")},async uninstallExtension(s,i){const o=Nt(e,"Uninstall extension failed");return Ye(o.uninstallExtension(s,i),"Uninstall extension timed out")},async startDeviceFlow(s){const i=Nt(e,"Start device flow failed");return Ye(i.startDeviceFlow({providerId:s}),"Start device flow timed out")},async getDeviceFlow(s,i){const o=Nt(e,"Get device flow failed");return Ye(o.getDeviceFlow(s,i),"Get device flow timed out")},async cancelDeviceFlow(s){const i=Nt(e,"Cancel device flow failed");return Ye(i.cancelDeviceFlow(s),"Cancel device flow timed out")},async getAuthStatus(){const s=Nt(e,"Get auth status failed");return Ye(s.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const s=Nt(e,"Get auth providers failed");return Ye(s.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(s){const i=Nt(e,"Install auth provider failed");return Ye(i.installAuthProvider(s),"Install auth provider timed out")}}}function Nt(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function b2(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function x2(e,t){const n=fN(e),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,r)}function w2(e,t){return fN(t)?e.toString():`${e.pathname}${e.search}`}function fN(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 v2(e,t){try{const n=await e.json(),r=typeof n.error=="string"?n.error:typeof n.message=="string"?n.message:void 0;return r?`${t}: ${r}`:`${t}: HTTP ${e.status}`}catch{return`${t}: HTTP ${e.status}`}}const x5=g.createContext(void 0);let nf;function aU({baseUrl:e,token:t,workspaceCwd:n,autoConnect:r=!0,transport:s,children:i}){const o=g.useMemo(()=>r?new JM({baseUrl:e,token:t,transport:s}):void 0,[r,e,t,s]),a=g.useRef(o);a.current=o;const l=g.useRef(void 0),c=g.useRef(void 0),u=g.useRef(n),[d,f]=g.useState(void 0),[m,p]=g.useState(r?"connecting":"idle"),[y,v]=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 k=o.capabilities().catch(T=>{throw c.current===k&&(c.current=void 0),T});c.current=k}return c.current},[o]);g.useEffect(()=>{if(!o)return;p("connecting"),v(void 0),f(void 0),nf===o&&(nf=void 0);let k=!1;return b().then(T=>{k||(f(T),p("connected"))}).catch(T=>{k||(v(T instanceof Error?T:new Error(String(T))),p("error"))}),()=>{k=!0,nf=o,queueMicrotask(()=>{nf===o&&(nf=void 0,o.dispose())})}},[o,b]),u.current=(d==null?void 0:d.workspaceCwd)??n;const x=g.useMemo(()=>oU({getClient:()=>a.current,getWorkspaceCwd:()=>u.current,baseUrl:e,token:t}),[e,t]),w=g.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(d==null?void 0:d.workspaceCwd)??n,status:m,error:y,capabilities:d,getCapabilities:b,actions:x}},[o,t,e,n,m,y,d,b,x]);return h.jsx(x5.Provider,{value:w,children:i})}function w5(){const e=g.useContext(x5);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function yc(){return w5().actions}function mN(){return g.useContext(x5)}function lU(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&Dk(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&Dk(t)||(t==null?void 0:t.kind)==="tool"&&Ok(t))return"responding";for(let n=e.length-1;n>=0;n--){const r=e[n];if(r.kind==="user")break;if(r.kind==="tool"&&Ok(r))return"responding"}return"idle"}function cU(e,t){const n=lU(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function Dk(e){return e.streaming===!0}function Ok(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const dw=new Set;let o1;function Bk(){return o1}function uU(e){return dw.add(e),()=>{dw.delete(e)}}function dU(e){o1={...e},pN()}function _2(){o1!==void 0&&(o1=void 0,pN())}function pN(){for(const e of dw)e()}function hU(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 r=n,s=r.sessionId,i=r.suggestion,o=r.promptId;if(!(typeof s!="string"||typeof i!="string"||i.length===0||typeof o!="string"))return{sessionId:s,suggestion:i,promptId:o}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const hw=new Set,gN=Object.freeze([]),k2=64;let Dl=gN;function $k(){return Dl}function fU(e){return hw.add(e),()=>{hw.delete(e)}}function mU(e){const t=[...Dl,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>k2){const n=t.length-k2;console.debug(`[mid-turn] sidechannel buffer over ${k2}; evicting ${n} oldest batch(es)`),Dl=t.slice(n)}else Dl=t;yN()}function pU(e){if(e.length===0||Dl.length===0)return;const t=new Set(e),n=Dl.filter(r=>!t.has(r));n.length!==Dl.length&&(Dl=n.length===0?gN:n,yN())}function yN(){for(const e of hw)e()}function gU(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==ZM)return;const n=t.data;if(!n||typeof n!="object")return;const r=n,s=r.sessionId,i=r.messages;if(typeof s!="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:s,messages:o,...typeof a=="string"?{originatorClientId:a}:{}}}function wl(e,t){const n=nN(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const bN=g.createContext(void 0),xN=g.createContext(void 0),v5=g.createContext(void 0),wN=g.createContext(void 0),vN=g.createContext(void 0),_N=g.createContext(void 0),yU=new Set([401,403,404,410]),bU=2e5,xU={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},wU=new Set([401,403]);function vU({baseUrl:e,token:t,workspaceCwd:n,initialSessionId:r,clientId:s,createSessionRequest:i,maxQueued:o=1024,maxBlocks:a=bU,suppressOwnUserEcho:l=!0,includeRawEvent:c=!1,autoConnect:u=!0,autoReconnect:d=!0,missingSessionBehavior:f="create",reconnectDelayMs:m=1e3,maxReconnectDelayMs:p=1e4,heartbeatIntervalMs:y=3e4,heartbeatFailureThreshold:v=3,loadWarnings:b,children:x}){const w=mN(),k=e??(w==null?void 0:w.baseUrl),T=t??(w==null?void 0:w.token),C=n??(w==null?void 0:w.workspaceCwd),A=g.useRef(w==null?void 0:w.client);A.current=w==null?void 0:w.client;const L=g.useRef(w==null?void 0:w.capabilities);L.current=w==null?void 0:w.capabilities;const $=g.useRef(w==null?void 0:w.getCapabilities);$.current=w==null?void 0:w.getCapabilities;const E=g.useRef(C);E.current=C;const z=g.useMemo(()=>DF({maxBlocks:a}),[a]),M=g.useRef(void 0),U=g.useRef(void 0),K=g.useRef(new Map),J=g.useRef(new Map),P=g.useRef(void 0),V=g.useRef(0),X=g.useRef(void 0),te=g.useRef(!1),D=g.useRef(new WeakSet),j=g.useRef({suppressOwnUserEcho:l,includeRawEvent:c}),B=g.useRef({reconnectDelayMs:m,maxReconnectDelayMs:p}),I=g.useRef(b),ne=g.useRef(void 0);(!ne.current||s)&&(ne.current=jk(s)),j.current={suppressOwnUserEcho:l,includeRawEvent:c},B.current={reconnectDelayMs:m,maxReconnectDelayMs:p},I.current=b;const de=i==null?void 0:i.modelServiceId,ce=i==null?void 0:i.sessionScope,Ne=g.useRef(i);Ne.current=i;const[Ce,ze]=g.useState("idle"),[ue,rt]=g.useState(r),[xe,Ee]=g.useState("load"),[Zt,ht]=g.useState(0),[bt,Vt]=g.useState(0),[pn,vt]=g.useState({status:u?"connecting":"idle"}),Wt=g.useRef(0),[Gt,Tt]=g.useState([]),Oe=g.useCallback(Re=>{const nt={...Re,id:Re.id??`daemon-notice-${Date.now()}-${++Wt.current}`,createdAt:Re.createdAt??Date.now()};return Tt(wt=>[...wt.slice(-49),nt]),nt},[]),ot=g.useCallback(Re=>{Tt(nt=>nt.filter(wt=>wt.id!==Re))},[]),ft=g.useCallback(()=>{Tt([])},[]),F=g.useMemo(()=>({notices:Gt,dismissNotice:ot,clearNotices:ft}),[ft,ot,Gt]),[W,re]=g.useState(xU),me=g.useRef(()=>!1);g.useEffect(()=>{if(!u)return;if(!A.current&&!k){vt({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Re=new AbortController;let nt=!1;return(async()=>{var ut,he,Z,ie,fe,Ve,mt,It,ye,at;const Ut=A.current??new JM({baseUrl:k,token:T});let rn,to,ti=ue,kc=!ue&&bt>0,rl=0,Sc=()=>!1,ia=!1;for(;!nt&&!Re.signal.aborted;){try{let Pr=!1,ni=!1,In=!1,zn,bs;if(!rn){vt(fr=>({...fr,status:"connecting",error:void 0}));const ae=$.current,_e=L.current??(ae?await ae():await Ut.capabilities());if(nt||Re.signal.aborted)return;to=_e,te.current=Array.isArray(_e.features)&&_e.features.includes("client_heartbeat");const yt=E.current??_e.workspaceCwd,pt=ue&&xe==="resume"?Jm.resume:Jm.load,en=s?ne.current:jk(void 0,ue??ti),Pt=ue?await pt(Ut,ue,{workspaceCwd:yt},en):ti?await Jm.load(Ut,ti,{workspaceCwd:yt},en):await Jm.createOrAttach(Ut,{...de!==void 0?{modelServiceId:de}:{},...kc?{sessionScope:"thread"}:ce!==void 0?{sessionScope:ce}:{},workspaceCwd:yt},en);if(!s&&Pt.clientId&&(ne.current=Pt.clientId,cw(Pt.clientId,Pt.sessionId)),nt||Re.signal.aborted){Lk({baseUrl:k,token:T,sessionId:Pt.sessionId,clientId:Pt.clientId}).catch(fr=>console.warn("[DaemonSessionProvider] detach failed:",fr));return}const vn=U.current;vn!==Pt.sessionId&&ft(),vn!==void 0&&Pt.sessionId!==vn?(ze("idle"),Nr(X),In=!0):vn!==void 0&&(Pt.replaySnapshot.compactedReplay.length+Pt.replaySnapshot.liveJournal.length>0?(ze("idle"),Nr(X),In=!0):(z.dispatch({type:"assistant.done",reason:"reconnected"}),z.getSnapshot().awaitingResync&&z.clearAwaitingResync())),Pr=vn!==void 0&&vn===Pt.sessionId,ni=Pt.replaySnapshot.compactedReplay.length>0||Pt.replaySnapshot.liveJournal.length>0;const xs=[...Pt.replaySnapshot.compactedReplay,...Pt.replaySnapshot.liveJournal];zn=UF(xs),bs=b5(zn),rn=Pt,ti=rn.sessionId,kc=!1,U.current=rn.sessionId,M.current=rn}const zt=rn,or=D.current.has(zt);let qr=zt.hasActivePrompt===!0&&!or;const sl=()=>{D.current.add(zt),qr=!1},Os=()=>qr||K.current.has(zt.sessionId);Sc=Os,me.current=Os,ze(Os()?"streaming":"idle");const[oa,aa,la]=await Promise.allSettled([Ut.workspaceProviders(),zt.supportedCommands(),zt.context()]),os=oa.status==="fulfilled"?oa.value:void 0,wo=aa.status==="fulfilled"?aa.value:void 0,Ti=la.status==="fulfilled"?la.value:void 0,Ci=[oa.status==="rejected"?(ut=I.current)==null?void 0:ut.models:void 0,aa.status==="rejected"?(he=I.current)==null?void 0:he.commands:void 0,la.status==="rejected"?(Z=I.current)==null?void 0:Z.context:void 0].filter(ae=>!!ae),no=$F(os),Ai=zF(Ti),Cc=Ai&&Ai.models.length>0?Ai.models:no.models,ro=(Ai==null?void 0:Ai.currentModel)??no.currentModel,Ac=ro===no.currentModel?no.contextWindow:(ie=no.models.find(ae=>ae.id===ro))==null?void 0:ie.contextWindow,gn=(Ai==null?void 0:Ai.contextWindow)??((fe=Cc.find(ae=>ae.id===ro))==null?void 0:fe.contextWindow)??Ac,{commands:sn,skills:Ei}=lN(wo),Ec=FF(Ti);vt(ae=>({status:"connected",sessionId:zt.sessionId,...zt.clientId?{clientId:zt.clientId}:{},workspaceCwd:zt.workspaceCwd,commands:sn,skills:Ei,models:Cc,currentModel:ro,currentMode:Ec,displayName:qF(zt.state)??(ae.sessionId===zt.sessionId?ae.displayName:void 0),tokenUsage:zn!==void 0?zn:ae.sessionId===zt.sessionId?ae.tokenUsage:void 0,tokenCount:bs!==void 0?bs:ae.sessionId===zt.sessionId?ae.tokenCount??0:0,contextWindow:gn,providers:os,supportedCommands:wo,context:Ti,capabilities:to,catchingUp:Pr||zt.lastEventId!=null||void 0})),Ci.length>0&&z.dispatch(Ci.map(ae=>({type:"status",text:ae})));const ca=P.current,il=(ca==null?void 0:ca.sessionId)===zt.sessionId?ca:void 0,{compactedReplay:ol,liveJournal:Uu}=zt.replaySnapshot,vo=[...ol,...Uu];if(In&&!(ni&&vo.length>0)&&z.reset(),ni&&vo.length>0){const ae={...j.current,suppressOwnUserEcho:!1},_e=[];for(const yt of vo)try{const pt=Pk(yt,zt.clientId,ae,vt,{updateConnection:!1});if(_e.push(...qk(yt,pt,Oe)),yt.type==="turn_complete"){const _t=((Ve=yt.data)==null?void 0:Ve.stopReason)??"end_turn";_e.push(wl(yt,_t))}else yt.type==="turn_error"&&_e.push(wl(yt,"error"))}catch(pt){const _t=pt instanceof Error?pt.message:String(pt);Oe({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:_t,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",pt)}In&&z.reset(),_e.length>0&&(z.dispatch(_e),Uk(_e,re));for(const yt of vo)zk(K.current,J.current,zt.sessionId,yt,z,ze,X,{requireBoundPromptId:!0});vt(yt=>({...yt,catchingUp:void 0}))}il&&(P.current=void 0,clearTimeout(il.timeout),il.resolve());let al=!1,Q=!1;const le=()=>{const ae=K.current.get(zt.sessionId);ae==null||ae.controller.abort(),K.current.delete(zt.sessionId),qr&&sl(),Nr(X),ze("idle"),z.reset(),zt.setLastEventId(0),ti=zt.sessionId,Q=!0,rn=void 0,M.current=void 0,me.current=()=>!1,vt(_e=>({..._e,status:"connecting",error:void 0}))};for await(const ae of zt.events({signal:Re.signal,maxQueued:o})){al||(al=!0,rl=0);try{const _e=hU(ae);if(_e){dU(_e);continue}const yt=gU(ae);yt&&mU(yt);const pt=Pk(ae,zt.clientId,j.current,vt),_t=qk(ae,pt,Oe);if(ae.type==="state_resync_required"&&(typeof ae.data=="object"&&ae.data!==null?ae.data.reason:void 0)==="epoch_reset"){le();break}if(Uk(_t,re),_t.length>0){const Pn=S2(_t);ze(er=>er==="waiting"||er==="idle"&&Pn?"streaming":er)}const en=zk(K.current,J.current,zt.sessionId,ae,z,ze,X);let Pt=!1;if(!en&&qr&&(ae.type==="turn_complete"||ae.type==="turn_error")){sl(),Pt=!0,Nr(X);const Pn=ae.type==="turn_complete"?((mt=ae.data)==null?void 0:mt.stopReason)??"end_turn":"error";z.dispatch(wl(ae,Pn)),Os()||ze("idle")}const xs=!Os()&&z.getSnapshot().activeAssistantBlockId!=null?_t.filter(Pn=>Pn.type!=="debug"):_t;z.dispatch(xs);for(const Pn of _t)if(Pn.type==="prompt.cancelled"&&(qr||Pn.originatorClientId!==zt.clientId)){z.dispatch(wl(ae,"cancelled"));const er=qr;sl(),Pt=!0,Nr(X),er||K.current.delete(zt.sessionId),Os()||ze("idle")}else Pn.type==="session.replay_complete"&&(vt(er=>({...er,catchingUp:void 0})),z.getSnapshot().awaitingResync&&z.clearAwaitingResync(),Os()||(Nr(X),z.dispatch({type:"assistant.done",reason:"replay_complete"}),ze("idle")));const fr=!en&&!Pt&&!Os();if(fr&&(_t.some(er=>er.type==="user.text.delta")?ze("waiting"):S2(_t)&&ze(er=>er==="idle"?"streaming":er)),fr&&ae.type==="turn_complete"){Nr(X);const Pn=((It=ae.data)==null?void 0:It.stopReason)??"end_turn";z.dispatch(wl(ae,Pn)),ze("idle")}else fr&&ae.type==="turn_error"?(Nr(X),z.dispatch(wl(ae,"error")),ze("idle")):fr&&S2(_t)&&XF(z,X,"passive_observer",3e3,()=>ze("idle"));if(ae.type==="state_resync_required"&&(typeof ae.data=="object"&&ae.data!==null?ae.data.reason:void 0)!=="epoch_reset"){Os()||(ze("idle"),Nr(X)),z.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",zt.sessionId),Q=!0,rn=void 0,M.current=void 0,me.current=()=>!1,vt(er=>({...er,status:"connecting",error:void 0}));break}if(ae.type==="session_closed"&&((ye=ae.data)==null?void 0:ye.reason)==="client_close"){ia=!0;const Pn=zt.sessionId,er=K.current.get(Pn);er==null||er.controller.abort(),K.current.delete(Pn),rn=void 0,M.current=void 0;break}}catch(_e){const yt=_e instanceof Error?_e.message:String(_e);Oe({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:yt,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",_e)}}if(ia){z.dispatch({type:"assistant.done",reason:"cancelled"}),ze("idle"),Nr(X),vt(ae=>({...ae,status:"disconnected",sessionId:void 0,error:void 0}));return}!nt&&!Re.signal.aborted&&!Q&&(((at=M.current)==null?void 0:at.sessionId)===zt.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),Os()||(Nr(X),ze("idle"),z.dispatch({type:"assistant.done",reason:"stream_ended"}))),vt(ae=>({...ae,status:"disconnected",error:void 0})))}catch(Pr){if(nt||Re.signal.aborted)return;const ni=Pr instanceof Error?Pr.message:String(Pr),In=rn==null?void 0:rn.sessionId,zn=IU(Pr),bs=NU(Pr),zt=bs&&!zn&&f==="disconnect";if(In&&(zn||bs)){const qr=K.current.get(In);qr==null||qr.controller.abort(),K.current.delete(In)}(zn||bs||!Sc())&&(Nr(X),ze("idle"));const or=P.current;if(or&&(or.sessionId===ue||or.sessionId===ti)&&(P.current=void 0,clearTimeout(or.timeout),or.reject(Pr)),zn||bs){if(rn=void 0,M.current=void 0,zn){vt({status:"error",error:ni});return}if(zt){vt(qr=>({...qr,status:"disconnected",sessionId:void 0,error:ni,catchingUp:void 0}));return}ti=void 0,ue&&rt(void 0)}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",rn==null?void 0:rn.sessionId);if(!d){rn=void 0,M.current=void 0,vt({status:"error",error:ni});return}vt(qr=>({...qr,status:"disconnected",error:ni}))}if(!d){M.current=void 0,vt(Pr=>({...Pr,status:"disconnected",catchingUp:void 0}));return}rl+=1;const xo=B.current,Tc=KF(rl,xo.reconnectDelayMs,xo.maxReconnectDelayMs);vt(Pr=>({...Pr,status:"disconnected",error:`Reconnecting in ${Tc}ms`})),await YF(Tc,Re.signal)}})(),()=>{const ut=M.current;nt=!0,Re.abort(),me.current=()=>!1,ze("idle"),Nr(X),P.current&&(clearTimeout(P.current.timeout),P.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),P.current=void 0),ut!=null&&ut.clientId&&Lk({baseUrl:k,token:T,sessionId:ut.sessionId,clientId:ut.clientId}).catch(he=>console.warn("[DaemonSessionProvider] detach failed:",he)),M.current=void 0}},[u,d,f,k,T,n,de,ce,o,z,ue,xe,Zt,bt,s,ft,Oe]),g.useEffect(()=>{if(!te.current||y<=0||v<=0||!pn.sessionId)return;let Re=!1,nt=0;const wt=setInterval(()=>{const ut=M.current;ut&&ut.heartbeat().then(()=>{Re||(nt>=v&&vt(he=>he.sessionId===ut.sessionId?{...he,status:"connected",error:void 0}:he),nt=0)}).catch(he=>{if(Re||(nt+=1,nt<v))return;const Z=he instanceof Error?he.message:"Session heartbeat failed";vt(ie=>ie.sessionId===ut.sessionId?{...ie,status:"disconnected",error:Z}:ie)})},y);return()=>{Re=!0,clearInterval(wt)}},[pn.sessionId,v,y]);const Pe=g.useMemo(()=>ZF({store:z,sessionRef:M,activePromptsRef:K,settledPromptsRef:J,pendingSessionLoadRef:P,pendingSessionLoadIdRef:V,heartbeatSupportedRef:te,passiveAssistantDoneTimerRef:X,hasSessionActivePrompt:()=>me.current(),resetCurrentSessionActivePrompt:()=>{me.current=()=>!1},getCreateSessionRequest:()=>{var Re;return{...Ne.current,sessionScope:"thread",workspaceCwd:E.current??((Re=M.current)==null?void 0:Re.workspaceCwd)}},addNotice:Oe,setConnection:vt,setPromptStatus:ze,setRestoreSessionId:rt,setRestoreMode:Ee,setRestoreSessionNonce:ht,setNewSessionNonce:Vt}),[Oe,z]);return h.jsx(bN.Provider,{value:z,children:h.jsx(xN.Provider,{value:pn,children:h.jsx(wN.Provider,{value:Ce,children:h.jsx(vN.Provider,{value:F,children:h.jsx(_N.Provider,{value:W,children:h.jsx(v5.Provider,{value:Pe,children:x})})})})})})}function zk(e,t,n,r,s,i,o,a={}){var l;if(r.type!=="turn_complete"&&r.type!=="turn_error")return!1;const c=(l=r.data)==null?void 0:l.promptId;if(!c)return!1;const u=e.get(n);if(!u||a.requireBoundPromptId&&u.promptId===void 0||u.promptId!==void 0&&u.promptId!==c)return!1;Nr(o);try{const d=c5(r,c);if(!d)return!1;s.dispatch(wl(r,d.stopReason)),i("idle"),u.resolve?(e.delete(n),u.resolve(d)):(e.delete(n),t.set(uw(n,c),{status:"resolved",result:d}))}catch(d){s.dispatch(wl(r,"error")),i("idle"),u.reject?(e.delete(n),u.reject(d)):(e.delete(n),t.set(uw(n,c),{status:"rejected",error:d}))}return!0}function _U(e){return e.type==="turn_complete"}function Pk(e,t,n,r,s={}){s.updateConnection!==!1&&PF(e,r);const i=cq(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=AU(e);return _U(e)?o?[o]:[]:o?[...i,o]:i}function qk(e,t,n){const r=[];for(const s of t){if(s.type!=="error"){r.push(s);continue}if(e.type==="turn_error"){r.push(s);continue}const i=n(kU(e,s));(i.category==="protocol"||i.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",i)}return r}function kU(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 _5(){const e=g.useContext(bN);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function _y(){const e=_5(),t=g.useCallback(()=>e.getSnapshot().blocks,[e]);return g.useSyncExternalStore(e.subscribe,t,t)}function k5(){const e=_y(),t=TU();return g.useMemo(()=>cU(e,t),[e,t])}function ky(){const e=g.useContext(v5);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function SU(){return g.useContext(v5)}function Bu(){return g.useContext(_N)}function TU(){const e=g.useContext(wN);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function bc(){const e=g.useContext(xN);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function CU(){const e=g.useContext(vN);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function S2(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function AU(e){if(e.type!=="session_update")return null;const t=Sa(e.data)?e.data:void 0,n=Sa(t==null?void 0:t.update)?t.update:Sa(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!Sa(r))return null;const s=EU(r.goalStatus);if(s)return Fk(e,s);const i=MU(r.goalTerminal);if(i)return Fk(e,i);const o=r.stopHookLoop;if(!Sa(o))return null;const a=o.goal;return!Sa(a)||!mu(a,"condition"),null}function Fk(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function EU(e){if(!Sa(e))return null;const t=mu(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=mu(e,"condition");if(!n)return null;const r=Yf(e,"iterations"),s=Yf(e,"durationMs"),i=Yf(e,"setAt"),o=mu(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i!==void 0?{setAt:i}:{},...o?{lastReason:o}:{}}}function MU(e){if(!Sa(e))return null;const t=mu(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=mu(e,"condition");if(!n)return null;const r=Yf(e,"iterations"),s=Yf(e,"durationMs"),i=mu(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i?{lastReason:i}:{}}}function mu(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Yf(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Uk(e,t){let n=0,r=0,s=0,i=0,o=0,a=0,l,c=0,u=0;for(const d of e)switch(d.type){case"workspace.memory.changed":n+=1;break;case"workspace.agent.changed":r+=1;break;case"workspace.tool.toggled":s+=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={...d.status?{status:d.status}:{},...d.source?{source:d.source}:{},...d.name?{name:d.name}:{},...d.version?{version:d.version}:{},...d.error?{error:d.error}:{},refreshed:d.refreshed,failed:d.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":u+=1;break}n+r+s+i+o+a+c+u!==0&&t(d=>({memoryVersion:d.memoryVersion+n,agentsVersion:d.agentsVersion+r,toolsVersion:d.toolsVersion+s,settingsVersion:d.settingsVersion+i,mcpVersion:d.mcpVersion+o,extensionsVersion:d.extensionsVersion+a,...l?{lastExtensionChange:l}:{},initVersion:d.initVersion+c,authVersion:d.authVersion+u}))}function NU(e){const t=kN(e);return t!==void 0&&yU.has(t)}function IU(e){const t=kN(e);return t!==void 0&&wU.has(t)}function kN(e){if(e instanceof Su||Sa(e)&&typeof e.status=="number")return e.status}function Sa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function kh(e,t){const{autoLoad:n=!1,enabled:r=!0}=t,[s,i]=g.useState({data:void 0,loading:!1,error:void 0}),o=g.useRef(0),a=g.useCallback(async()=>{if(!r)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 u=c instanceof Error?c:new Error(String(c));i(d=>({...d,loading:!1,error:u}));return}},[r,e]);return g.useEffect(()=>{!n||!r||a()},[n,r,a]),{...s,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function am(e,t,n){const r=g.useRef(!1);g.useEffect(()=>{if(!(e===void 0||!n)){if(!r.current){r.current=!0;return}t()}},[n,t,e])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function RU(e={}){var t;const n=yc(),r=g.useCallback(()=>n.listAgents(),[n]),s=kh(r,e),i=Bu();return am(i==null?void 0:i.agentsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,agents:((t=s.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 SN(e={}){const t=yc(),n=g.useCallback(()=>t.loadMcpStatus(),[t]),r=kh(n,e),s=Bu();return am(s==null?void 0:s.mcpVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.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 jU(e={}){var t;const n=yc(),r=g.useCallback(()=>n.loadMemoryStatus(),[n]),s=kh(r,e),i=Bu();return am(i==null?void 0:i.memoryVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,files:((t=s.data)==null?void 0:t.files)??[],readFile:n.readWorkspaceFile,writeMemory:n.writeMemory}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Sy(e={}){const{pageSize:t,...n}=e,r=w5(),s=SU(),i=g.useCallback(()=>r.actions.listSessions({pageSize:t}),[t,r.actions]),o=!!r.workspaceCwd,a=kh(i,{...n,enabled:(n.enabled??!0)&&o}),{reload:l}=a,c=g.useCallback(async d=>{const f=await r.actions.deleteSession(d);return f&&l(),f},[r.actions,l]),u=g.useCallback(async d=>{const f=await r.actions.deleteSessions(d);return(f.removed.length>0||f.notFound.length>0)&&l(),f},[r.actions,l]);return{...a,sessions:a.data??[],loadSession:s==null?void 0:s.loadSession,resumeSession:s==null?void 0:s.resumeSession,newSession:s==null?void 0:s.newSession,releaseSession:s==null?void 0:s.releaseSession,deleteSession:c,deleteSessions:u}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function TN(e={}){var t;const n=yc(),r=g.useCallback(()=>n.loadToolsStatus(),[n]),s=kh(r,e),i=Bu();return am(i==null?void 0:i.toolsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,tools:((t=s.data)==null?void 0:t.tools)??[],setEnabled:n.setWorkspaceToolEnabled}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function LU(e={}){var t;const n=yc(),r=g.useCallback(()=>n.loadSettingsStatus(),[n]),s=kh(r,e),i=Bu();return am(i==null?void 0:i.settingsVersion,s.reload,e.autoLoad===!0||s.data!==void 0),{...s,status:s.data,settings:((t=s.data)==null?void 0:t.settings)??[],setValue:n.setWorkspaceSetting}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const DU=300,OU=100,od=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function T2(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function BU(e){const{enabled:t=!0,onStateChange:n,getOnAccept:r,getOnOutcome:s}=e;let i=od,o=null,a=!1,l=null;function c(v){i=v,n(v)}function u(){o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:v=>{if(o&&(clearTimeout(o),o=null),!v){c(od);return}t&&(o=setTimeout(()=>{c({suggestion:v,isVisible:!0,shownAt:Date.now()})},DU))},accept:(v,b)=>{var x;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const w=i.suggestion,{shownAt:k}=i;if(!w){a=!1;return}try{(x=s())==null||x({outcome:"accepted",accept_method:v,time_ms:k>0?Date.now()-k:0,suggestion_length:w.length})}catch(T){console.error("[followup] onOutcome callback threw:",T)}c(od),queueMicrotask(()=>{var T;try{b!=null&&b.skipOnAccept||(T=r())==null||T(w)}catch(C){console.error("[followup] onAccept callback threw:",C)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},OU)}})},dismiss:()=>{var v;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(v=s())==null||v({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(od)}},clear:()=>{u(),a=!1,c(od)},cleanup:()=>{u(),a=!1}}}function $U(e={}){const{enabled:t=!0,onAccept:n,onOutcome:r}=e,s=_5(),[i,o]=g.useState(od),a=g.useRef(n);a.current=n;const l=g.useRef(r);l.current=r;const c=g.useSyncExternalStore(s.subscribe,()=>s.getSnapshot().lastFollowupSuggestion,()=>s.getSnapshot().lastFollowupSuggestion),d=g.useSyncExternalStore(uU,Bk,Bk)??c,f=g.useMemo(()=>BU({enabled:t,onStateChange:o,getOnAccept:()=>a.current,getOnOutcome:()=>l.current}),[t]),{setSuggestion:m}=f;g.useEffect(()=>(t||f.clear(),()=>f.cleanup()),[f,t]);const p=g.useRef(void 0);g.useEffect(()=>{const x=d==null?void 0:d.promptId;x!==p.current&&(p.current=x,m((d==null?void 0:d.suggestion)??null))},[d,m]);const y=g.useCallback(()=>{f.clear(),T2(s),_2(),p.current=void 0},[f,s]),v=g.useCallback((x,w)=>{f.accept(x,w),T2(s),_2(),p.current=void 0},[f,s]),b=g.useCallback(()=>{f.dismiss(),T2(s),_2(),p.current=void 0},[f,s]);return g.useMemo(()=>({followupState:i,onAcceptFollowup:v,onDismissFollowup:b,clear:y}),[i,v,b,y])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function zU(){const e=g.useSyncExternalStore(fU,$k,$k),t=g.useCallback(n=>pU(n),[]);return{batches:e,consume:t}}function PU(e){for(const t of e){if(!qU(t))continue;const n=t;if(n.resolved)continue;const r=_d(n.toolCall),s=typeof(r==null?void 0:r.toolCallId)=="string"?r.toolCallId:typeof(r==null?void 0:r.id)=="string"?r.id:void 0,i=typeof(r==null?void 0:r.kind)=="string"?r.kind:void 0,o=_d(r==null?void 0:r._meta),a=typeof(o==null?void 0:o.toolName)=="string"?o.toolName:void 0;return{id:n.requestId,sessionId:n.sessionId,toolCallId:s,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:UU(l.raw)})),rawInput:FU(n.toolCall)}}return null}function qU(e){return e.kind==="permission"}function FU(e){const t=_d(e);return t?_d(t.rawInput)??_d(t.input)??_d(t.args)??t:void 0}function _d(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function UU(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}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function HU(e,t,n,r){const s=[...e];let i=!1;for(const o of t)if(o.sessionId===n&&!(o.originatorClientId!==void 0&&o.originatorClientId!==r))for(const a of o.messages){const l=s.findIndex(c=>c.text===a&&(!c.images||c.images.length===0));l>=0&&(s.splice(l,1),i=!0)}return i?s:null}function VU(e,t,n){const r=new Array(e);return new Proxy(r,{get(s,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=s[l];if(!c){const u=t[l*2];c=s[l]={index:l,key:n(l),start:u,size:t[l*2+1],end:u+t[l*2+1],lane:0}}return c}}if(i==="length")return e}return Reflect.get(s,i,o)}})}function Ju(e,t,n){let r=n.initialDeps??[],s,i=!0;function o(){const a=e();return(a.length!==r.length||a.some((c,u)=>r[u]!==c))&&(r=a,s=t(...a),n!=null&&n.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(s),i=!1),s}return o.updateDeps=a=>{r=a},o}function Hk(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const WU=(e,t)=>Math.abs(e-t)<1.01,GU=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let rf;const C2=()=>{if(rf!==void 0)return rf;if(typeof navigator>"u")return rf=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return rf=!0;const e=navigator.maxTouchPoints;return rf=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Vk=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},KU=e=>e,YU=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,s=new Array(r);for(let i=0;i<r;i++)s[i]=t+i;return s},XU=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(s(Vk(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(Vk(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},a1={passive:!0},QU=typeof window>"u"?!0:"onscrollend"in window,JU=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&QU;let o=0;const a=i?null:GU(s,()=>t(o,!1),e.options.isScrollingResetDelay),l=d=>()=>{o=n(r),a==null||a(),t(o,d)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,a1),i&&r.addEventListener("scrollend",u,a1),()=>{r.removeEventListener("scroll",c),i&&r.removeEventListener("scrollend",u)}},ZU=(e,t)=>JU(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),eH=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),s=n.options.getItemKey(r);return n.itemSizeCache.get(s)??n.options.estimateSize(r)}if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),s=n.options.getItemKey(r),i=n.itemSizeCache.get(s);if(i!==void 0)return i}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},tH=(e,{adjustments:t=0,behavior:n},r)=>{var s,i;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},nH=tH;class rH{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,r,s;return((s=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const o=()=>{const a=i.target,l=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[c,u]of this.elementsCache)if(u===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 s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{var r,s;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:KU,rangeExtractor:YU,onChange:()=>{},measureElement:eH,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?((r=p[0])==null?void 0:r.key)??o.getItemKey(0):null,v=f>0?((s=p[f-1])==null?void 0:s.key)??o.getItemKey(f-1):null;if(m!==f||f>0&&m>0&&(i.getItemKey(0)!==y||i.getItemKey(m-1)!==v)){c=!0;const w=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;w&&(a=[w.key,this.getScrollOffset()-w.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&m>f&&this.isAtEnd(o.scrollEndThreshold)&&(f===0||i.getItemKey(m-1)!==v)&&(l=k)}}this.options=i,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,d=0;if(a&&this.scrollOffset!==null){const[f,m]=a,p=this.getMeasurements(),{count:y,getItemKey:v}=this.options;let b=0;for(;b<y&&v(b)!==f;)b++;if(b<y){const x=p[b];if(x){const w=x.start+m;w!==this.scrollOffset&&(d=w-this.scrollOffset,this.scrollOffset=w,u=!0)}}}(u||l)&&(this.pendingScrollAnchor=[u?a[0]:null,u?a[1]:0,l,d])},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Ju(()=>(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 r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,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,!(!C2()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,a1),i.addEventListener("touchend",a,a1),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 s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[i,o,a,l]=s;i!==null&&!a&&(C2()&&(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(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const s=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=s,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,r)=>{const s=new Map,i=new Map;for(let o=r-1;o>=0;o--){const a=n[o];if(s.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&&s.set(a.lane,!0),s.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=Ju(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,s,i,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Ju(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l},c)=>{const u=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 d=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 v=this._flatMeasurements;if(!v||v.length<y){const w=new Float64Array(y);v&&d>0&&w.set(v.subarray(0,d*2)),v=w,this._flatMeasurements=v}let b;if(d===0)b=r+s;else{const w=d-1;b=v[w*2]+v[w*2+1]+p}for(let w=d;w<n;w++){const k=i(w),T=u.get(k),C=typeof T=="number"?T:this.options.estimateSize(w);v[w*2]=b,v[w*2+1]=C,b+=C+p}const x=VU(n,v,i);return this.measurementsCache=x,x}const f=this.measurementsCache.slice(0,d),m=new Array(a).fill(void 0);for(let p=0;p<d;p++){const y=f[p];y&&(m[y.lane]=p)}for(let p=d;p<n;p++){const y=i(p),v=this.laneAssignments.get(p);let b,x;const w=l==="estimate"||u.has(y);if(v!==void 0&&this.options.lanes>1){b=v;const A=m[b],L=A!==void 0?f[A]:void 0;x=L?L.end+this.options.gap:r+s}else{const A=this.options.lanes===1?f[p-1]:this.getFurthestMeasurement(f,p);x=A?A.end+this.options.gap:r+s,b=A?A.lane:p%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(p,b)}const k=u.get(y),T=typeof k=="number"?k:this.options.estimateSize(p),C=x+T;f[p]={index:p,start:x,size:T,end:C,key:y,lane:b},m[b]=p}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ju(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?sH({measurements:n,outerSize:r,scrollOffset:s,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ju(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,s-i),a=Math.min(this.options.count-1,s+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 r=this.indexFromElement(n),s=this.options.getItemKey(r),i=this.elementsCache.get(s);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(s,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var s,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 u=this.itemSizeCache.get(l)??o,d=r-u;if(d!==0){const f=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.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},d,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,r),this.itemSizeCacheVersion++,f?this.applyScrollAdjustment(this.getTotalSize()-m):p&&this.applyScrollAdjustment(d),this.notify(!1)}},this.getVirtualItems=Ju(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],l=r[a];s.push(l)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const s=this._flatMeasurements,i=this.options.lanes===1&&s!=null,o=CN(0,r.length-1,i?a=>s[a*2]:a=>Hk(r[a]).start,n);return Hk(r[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,r,s=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=n>=o+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[n];if(!o)return;if(r==="auto")if(o.end>=i+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:s="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),o=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:s="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[o,a]=i,l=this.now();this.scrollState={index:n,align:a,behavior:s,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),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 r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,o=this._flatMeasurements;o!=null?s=o[i*2]+o[i*2+1]:s=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&i.some(a=>a===null);){const a=r[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}s=Math.max(...i.filter(a=>a!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const s of r)s&&this.itemSizeCache.has(s.key)&&n.push({index:s.index,key:s.key,start:s.start,size:s.size,end:s.end,lane:s.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:s,adjustments:r},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&&(C2()&&(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 r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,i=1,o=s!==this.scrollState.lastTargetOffset;if(!o&&WU(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==s&&this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,o){const a=this.getSize()||600,l=Math.abs(s-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=s,c||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const CN=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,i=n(s);if(i<r)e=s+1;else if(i>r)t=s-1;else return s}return e>0?e-1:0};function sH({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:s}){const i=e.length-1,o=s?u=>s[u*2]:u=>e[u].start,a=s?u=>s[u*2]+s[u*2+1]:u=>e[u].end;if(e.length<=r)return{startIndex:0,endIndex:i};let l=CN(0,i,o,n),c=l;if(r===1)for(;c<i&&a(c)<n+t;)c++;else if(r>1){const u=Array(r).fill(0);for(;c<i&&u.some(f=>f<n+t);){const f=e[c];u[f.lane]=f.end,c++}const d=Array(r).fill(n+t);for(;l>=0&&d.some(f=>f>=n);){const f=e[l];d[f.lane]=f.start,l--}l=Math.max(0,l-l%r),c=Math.min(i,c+(r-1-c%r))}return{startIndex:l,endIndex:c}}const A2=typeof document<"u"?g.useLayoutEffect:g.useEffect;function iH({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const s=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 u=i.current;if(!u.enabled)return;const d=c.getTotalSize();if(u.container&&d!==u.lastSize){u.lastSize=d;const b=c.options.horizontal?"width":"height";u.container.style[b]=`${d}px`}const f=!!c.options.horizontal,m=u.mode==="transform",p=f?"left":"top",y=c.options.scrollMargin,v=c.getVirtualItems();for(const b of v){const x=b.start-y,w=c.elementsCache.get(b.key);w&&u.lastPositions.get(w)!==x&&(u.lastPositions.set(w,x),m?w.style.transform=f?`translate3d(${x}px, 0, 0)`:`translate3d(0, ${x}px, 0)`:w.style[p]=`${x}px`)}},a={...r,onChange:(c,u)=>{var d;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&&u?ny.flushSync(s):s()),(d=r.onChange)==null||d.call(r,c,u)}},[l]=g.useState(()=>{const c=new rH(a);return Object.assign(c,{containerRef:u=>{const d=i.current;if(d.container=u,d.lastSize=null,u&&d.enabled){const f=c.getTotalSize();d.lastSize=f;const m=c.options.horizontal?"width":"height";u.style[m]=`${f}px`}}})});return l.setOptions(a),A2(()=>l._didMount(),[]),A2(()=>l._willUpdate()),A2(()=>{o(l)}),l}function oH(e){return iH({observeElementRect:XU,observeElementOffset:ZU,scrollToFn:nH,...e})}function AN(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function aH(e){var t;return((t=AN(e))==null?void 0:t.type)==="task_execution"}function Ty(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||aH(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function EN(e){var n;if(!Ty(e))return!1;const t=AN(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const MN=g.createContext({}),lH=MN.Provider;function xc(){return g.useContext(MN)}const cH=["en","zh-CN"],S5={"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.toggleStream":"Toggle agent stream details","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","common.back":"back","common.cancel":"cancel","common.close":"close","common.continue":"continue","common.current":"current","common.disabled":"disabled","common.enabled":"enabled","common.enterSelect":"Enter to select","common.invalid":"invalid","common.loading":"Loading...","common.navigate":"↑↓ to navigate","common.next":"next","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!","markdownTable.blank":"(blank)","markdownTable.toggleAdvanced":"Switch to advanced table","markdownTable.toggleBasic":"Switch to basic table","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.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.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.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","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.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","sidebar.label":"Workspace sidebar","sidebar.newChat":"New chat","sidebar.project":"Project","sidebar.projectFallback":"Project","sidebar.settings":"Settings","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.delete":"Delete","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","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.cleared":"Queued messages cleared","queue.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.insertCommandDisabled":"Commands can't be inserted into the running turn; they run after it finishes.","queue.insertFailed":"Failed to insert 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","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]","local.agents":"Manage subagents","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.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.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.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.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.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"}`},"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`,"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.showAll":e=>`▼ Show all (${(e==null?void 0:e.count)??0} lines)`,"tool.showLess":"▲ Show less","tool.showFullLines":"▼ Show full lines","tool.linesTotal":e=>`▼ ${(e==null?void 0:e.count)??0} lines total`,"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.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`:""}`,"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","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","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:"},uH={...S5,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.grep_search":"Grep","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":"Grep","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.toggleStream":"展开/收起子智能体详情","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":"复制","common.back":"返回","common.cancel":"取消","common.close":"关闭","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.navigate":"↑↓ 导航","common.next":"下一步","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":"已复制！","markdownTable.blank":"(空白)","markdownTable.toggleAdvanced":"切换到高级表格","markdownTable.toggleBasic":"切换到基础表格","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.hideColumn":"隐藏列","markdownTable.showHiddenColumns":e=>`显示 ${(e==null?void 0:e.count)??0} 个隐藏列`,"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.noApiResponse":"尚无 API 响应。发送一条消息后可查看实际使用量。","contextUsage.overLimit":"上下文已超过限制！请使用 /compress 或 /clear 减少占用。","contextUsage.skills":"Skills","contextUsage.systemPrompt":"系统提示词","contextUsage.title":"上下文使用情况","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"按类别统计","contextUsage.used":"已用","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.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":"设置目标","sidebar.label":"工作区侧边栏","sidebar.newChat":"新对话","sidebar.project":"项目","sidebar.projectFallback":"项目","sidebar.settings":"设置","sidebar.collapse":"收起","sidebar.expand":"展开","sidebar.collapseProject":"收起项目","sidebar.expandProject":"展开项目","sidebar.search":"搜索会话","sidebar.searchPlaceholder":"搜索会话","sidebar.searchEmpty":"没有匹配的会话。","sidebar.rename":"重命名","sidebar.renameCurrentOnly":"暂仅支持重命名当前会话","sidebar.delete":"删除","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":"刚完成","quickKeys.cursor":"移动光标","quickKeys.escape":"取消运行","quickKeys.history":"切换历史","quickKeys.retry":"重试失败请求","quickKeys.searchHistory":"搜索历史","quickKeys.tab":"接受补全","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.cleared":"已清空排队消息","queue.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.insertCommandDisabled":"命令无法插入当前回合，会在回合结束后执行。","queue.insertFailed":"插入排队消息失败","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":"未知错误","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]","local.agents":"管理智能体","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.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.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.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 Servers","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.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.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} 次`,"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} 次工具调用`,"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.showAll":e=>`▼ 显示全部（${(e==null?void 0:e.count)??0} 行）`,"tool.showLess":"▲ 显示更少","tool.showFullLines":"▼ 显示完整行","tool.linesTotal":e=>`▼ 共 ${(e==null?void 0:e.count)??0} 行`,"toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":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} 个工具`:""}`,"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":"未知模型","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.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":"提示："},dH={en:S5,"zh-CN":uH},hH={en:"English [en]","zh-CN":"中文 [zh-CN]"},NN=g.createContext({language:"en",t:e=>e});function Yl(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function T5(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Yl(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 C5(e){return hH[e]}function IN(e){const t=dH[e];return(n,r)=>{const s=t[n]??S5[n]??n;return typeof s=="function"?s(r):s}}function fH({language:e,children:t}){const n=g.useMemo(()=>({language:e,t:IN(e)}),[e]);return h.jsx(NN.Provider,{value:n,children:t})}function et(){return g.useContext(NN)}const Wk=[];function mH(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,r)=>!Object.is(n,t[r]))}class RN extends g.Component{constructor(){super(...arguments);oe(this,"state",{error:null,resetKeys:this.props.resetKeys??Wk});oe(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){const s=n.resetKeys??Wk;return mH(r.resetKeys,s)?{error:null,resetKeys:s}:null}componentDidCatch(n,r){console.error(`[web-shell] ${this.props.label??"render"} failed:`,n,r.componentStack)}render(){const{error:n}=this.state;if(n===null)return this.props.children;const{fallback:r}=this.props;return typeof r=="function"?r(n,this.reset):r}}const pH="_row_11f1l_1",gH="_tip_11f1l_12",yH="_chatRow_11f1l_34",bH="_chatTip_11f1l_42",xH="_chatActions_11f1l_55",wH="_copyButton_11f1l_70",hl={row:pH,tip:gH,chatRow:yH,chatTip:bH,chatActions:xH,copyButton:wH};function fw({timestamp:e,children:t,chatMode:n=!1,copyText:r,copyTitle:s="Copy"}){const[i,o]=g.useState(!1),a=g.useCallback(()=>{var c;r&&((c=navigator.clipboard)==null||c.writeText(r).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[r]);if(e===void 0&&!r)return h.jsx(h.Fragment,{children:t});const l=r?h.jsx("button",{type:"button",className:hl.copyButton,title:s,"aria-label":s,onClick:a,children:i?h.jsx(_H,{}):h.jsx(vH,{})}):null;return e===void 0?h.jsxs("div",{className:n?hl.chatRow:hl.row,children:[t,l]}):h.jsxs("div",{className:n?hl.chatRow:hl.row,children:[t,n?h.jsxs("span",{className:hl.chatActions,children:[h.jsx("span",{className:hl.chatTip,"aria-hidden":"true",children:eh(e)}),l]}):h.jsx("span",{className:hl.tip,"aria-hidden":"true",children:eh(e)})]})}function vH(){return h.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[h.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"}),h.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function _H(){return h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function eh(e,t=new Date){const n=new Date(e),r=o=>String(o).padStart(2,"0"),s=`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`;return n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()&&n.getDate()===t.getDate()?s:`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())} ${s}`}const kH="modulepreload",SH=function(e){return"/"+e},Gk={},q=function(t,n,r){let s=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"));s=Promise.allSettled(n.map(l=>{if(l=SH(l),l in Gk)return;Gk[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":kH,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((f,m)=>{d.addEventListener("load",f),d.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 s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},ds={Dark:"dark",Light:"light"},jN=[ds.Dark,ds.Light],LN=g.createContext(ds.Dark),TH=LN.Provider;function A5(){return g.useContext(LN)}const Xc="ui.theme",Xf="general.language";function E5(e,t){return e===ds.Light||e==="Qwen Light"?ds.Light:e===ds.Dark||e==="Qwen Dark"?ds.Dark:t}function CH(e){return e===ds.Light?"Qwen Light":"Qwen Dark"}function Kk(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const o=n.slice(s,r).trim();(o||!i)&&t.push(o),s=r+1,r=n.indexOf(",",s)}return t}function DN(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const AH=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,EH=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,MH={};function Yk(e,t){return(MH.jsx?EH:AH).test(e)}const NH=/[ \t\n\f\r]/g;function Cy(e){return typeof e=="object"?e.type==="text"?Xk(e.value):!1:Xk(e)}function Xk(e){return e.replace(NH,"")===""}class lm{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}lm.prototype.normal={};lm.prototype.property={};lm.prototype.space=void 0;function ON(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new lm(n,r,t)}function T0(e){return e.toLowerCase()}class ei{constructor(t,n){this.attribute=n,this.property=t}}ei.prototype.attribute="";ei.prototype.booleanish=!1;ei.prototype.boolean=!1;ei.prototype.commaOrSpaceSeparated=!1;ei.prototype.commaSeparated=!1;ei.prototype.defined=!1;ei.prototype.mustUseProperty=!1;ei.prototype.number=!1;ei.prototype.overloadedBoolean=!1;ei.prototype.property="";ei.prototype.spaceSeparated=!1;ei.prototype.space=void 0;let IH=0;const Rt=$u(),vr=$u(),mw=$u(),je=$u(),jn=$u(),pu=$u(),ii=$u();function $u(){return 2**++IH}const pw=Object.freeze(Object.defineProperty({__proto__:null,boolean:Rt,booleanish:vr,commaOrSpaceSeparated:ii,commaSeparated:pu,number:je,overloadedBoolean:mw,spaceSeparated:jn},Symbol.toStringTag,{value:"Module"})),E2=Object.keys(pw);class M5 extends ei{constructor(t,n,r,s){let i=-1;if(super(t,n),Qk(this,"space",s),typeof r=="number")for(;++i<E2.length;){const o=E2[i];Qk(this,E2[i],(r&pw[o])===pw[o])}}}M5.prototype.defined=!0;function Qk(e,t,n){n&&(e[t]=n)}function Sh(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new M5(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[T0(r)]=r,n[T0(i.attribute)]=r}return new lm(t,n,e.space)}const BN=Sh({properties:{ariaActiveDescendant:null,ariaAtomic:vr,ariaAutoComplete:null,ariaBusy:vr,ariaChecked:vr,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,ariaControls:jn,ariaCurrent:null,ariaDescribedBy:jn,ariaDetails:null,ariaDisabled:vr,ariaDropEffect:jn,ariaErrorMessage:null,ariaExpanded:vr,ariaFlowTo:jn,ariaGrabbed:vr,ariaHasPopup:null,ariaHidden:vr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jn,ariaLevel:je,ariaLive:null,ariaModal:vr,ariaMultiLine:vr,ariaMultiSelectable:vr,ariaOrientation:null,ariaOwns:jn,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:vr,ariaReadOnly:vr,ariaRelevant:null,ariaRequired:vr,ariaRoleDescription:jn,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:vr,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $N(e,t){return t in e?e[t]:t}function zN(e,t){return $N(e,t.toLowerCase())}const RH=Sh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:pu,acceptCharset:jn,accessKey:jn,action:null,allow:null,allowFullScreen:Rt,allowPaymentRequest:Rt,allowUserMedia:Rt,alpha:Rt,alt:null,as:null,async:Rt,autoCapitalize:null,autoComplete:jn,autoFocus:Rt,autoPlay:Rt,blocking:jn,capture:null,charSet:null,checked:Rt,cite:null,className:jn,closedBy:null,colorSpace:null,cols:je,colSpan:je,command:null,commandFor:null,content:null,contentEditable:vr,controls:Rt,controlsList:jn,coords:je|pu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Rt,defer:Rt,dir:null,dirName:null,disabled:Rt,download:mw,draggable:vr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Rt,formTarget:null,headers:jn,height:je,hidden:mw,high:je,href:null,hrefLang:null,htmlFor:jn,httpEquiv:jn,id:null,imageSizes:null,imageSrcSet:null,inert:Rt,inputMode:null,integrity:null,is:null,isMap:Rt,itemId:null,itemProp:jn,itemRef:jn,itemScope:Rt,itemType:jn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Rt,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:Rt,muted:Rt,name:null,nonce:null,noModule:Rt,noValidate:Rt,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:Rt,optimum:je,pattern:null,ping:jn,placeholder:null,playsInline:Rt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Rt,referrerPolicy:null,rel:jn,required:Rt,reversed:Rt,rows:je,rowSpan:je,sandbox:jn,scope:null,scoped:Rt,seamless:Rt,selected:Rt,shadowRootClonable:Rt,shadowRootCustomElementRegistry:Rt,shadowRootDelegatesFocus:Rt,shadowRootMode:null,shadowRootSerializable:Rt,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:vr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:Rt,useMap:null,value:vr,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jn,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Rt,declare:Rt,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:Rt,noHref:Rt,noShade:Rt,noWrap:Rt,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:vr,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Rt,disablePictureInPicture:Rt,disableRemotePlayback:Rt,exportParts:pu,part:jn,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:zN}),jH=Sh({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:ii,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,className:jn,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:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:Rt,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,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:pu,g2:pu,glyphName:pu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:ii,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,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:je,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:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ii,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ii,rev:ii,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ii,requiredFeatures:ii,requiredFonts:ii,requiredFormats:ii,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:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:ii,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ii,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ii,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$N}),PN=Sh({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()}}),qN=Sh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zN}),FN=Sh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),LH={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"},DH=/[A-Z]/g,Jk=/-[a-z]/g,OH=/^data[-\w.:]+$/i;function N5(e,t){const n=T0(t);let r=t,s=ei;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&OH.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Jk,$H);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Jk.test(i)){let o=i.replace(DH,BH);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=M5}return new s(r,t)}function BH(e){return"-"+e.toLowerCase()}function $H(e){return e.charAt(1).toUpperCase()}const I5=ON([BN,RH,PN,qN,FN],"html"),Th=ON([BN,jH,PN,qN,FN],"svg");function Zk(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function UN(e){return e.join(" ").trim()}var R5={},eS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,zH=/\n/g,PH=/^\s*/,qH=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,FH=/^:\s*/,UH=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,HH=/^[;\s]*/,VH=/^\s+|\s+$/g,WH=`
`,tS="/",nS="*",Qc="",GH="comment",KH="declaration";function YH(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(p){var y=p.match(zH);y&&(n+=y.length);var v=p.lastIndexOf(WH);r=~v?p.length-v:r+p.length}function i(){var p={line:n,column:r};return function(y){return y.position=new o(p),c(),y}}function o(p){this.start=p,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(p){var y=new Error(t.source+":"+n+":"+r+": "+p);if(y.reason=p,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function l(p){var y=p.exec(e);if(y){var v=y[0];return s(v),e=e.slice(v.length),y}}function c(){l(PH)}function u(p){var y;for(p=p||[];y=d();)y!==!1&&p.push(y);return p}function d(){var p=i();if(!(tS!=e.charAt(0)||nS!=e.charAt(1))){for(var y=2;Qc!=e.charAt(y)&&(nS!=e.charAt(y)||tS!=e.charAt(y+1));)++y;if(y+=2,Qc===e.charAt(y-1))return a("End of comment missing");var v=e.slice(2,y-2);return r+=2,s(v),e=e.slice(y),r+=2,p({type:GH,comment:v})}}function f(){var p=i(),y=l(qH);if(y){if(d(),!l(FH))return a("property missing ':'");var v=l(UH),b=p({type:KH,property:rS(y[0].replace(eS,Qc)),value:v?rS(v[0].replace(eS,Qc)):Qc});return l(HH),b}}function m(){var p=[];u(p);for(var y;y=f();)y!==!1&&(p.push(y),u(p));return p}return c(),m()}function rS(e){return e?e.replace(VH,Qc):Qc}var XH=YH,QH=Ag&&Ag.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R5,"__esModule",{value:!0});R5.default=ZH;const JH=QH(XH);function ZH(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,JH.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;s?t(o,a,i):a&&(n=n||{},n[o]=a)}),n}var Ay={};Object.defineProperty(Ay,"__esModule",{value:!0});Ay.camelCase=void 0;var eV=/^--[a-zA-Z0-9_-]+$/,tV=/-([a-z])/g,nV=/^[^-]+$/,rV=/^-(webkit|moz|ms|o|khtml)-/,sV=/^-(ms)-/,iV=function(e){return!e||nV.test(e)||eV.test(e)},oV=function(e,t){return t.toUpperCase()},sS=function(e,t){return"".concat(t,"-")},aV=function(e,t){return t===void 0&&(t={}),iV(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(sV,sS):e=e.replace(rV,sS),e.replace(tV,oV))};Ay.camelCase=aV;var lV=Ag&&Ag.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},cV=lV(R5),uV=Ay;function gw(e,t){var n={};return!e||typeof e!="string"||(0,cV.default)(e,function(r,s){r&&s&&(n[(0,uV.camelCase)(r,t)]=s)}),n}gw.default=gw;var dV=gw;const hV=J1(dV),HN=VN("end"),j5=VN("start");function VN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function fV(e){const t=j5(e),n=HN(e);if(t&&n)return{start:t,end:n}}function Qf(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?iS(e.position):"start"in e||"end"in e?iS(e):"line"in e||"column"in e?yw(e):""}function yw(e){return oS(e&&e.line)+":"+oS(e&&e.column)}function iS(e){return yw(e&&e.start)+"-"+yw(e&&e.end)}function oS(e){return e&&typeof e=="number"?e:1}class gs extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",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"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.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=s,this.line=a?a.line:void 0,this.name=Qf(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}}gs.prototype.file="";gs.prototype.name="";gs.prototype.reason="";gs.prototype.message="";gs.prototype.stack="";gs.prototype.column=void 0;gs.prototype.line=void 0;gs.prototype.ancestors=void 0;gs.prototype.cause=void 0;gs.prototype.fatal=void 0;gs.prototype.place=void 0;gs.prototype.ruleId=void 0;gs.prototype.source=void 0;const L5={}.hasOwnProperty,mV=new Map,pV=/[A-Z]/g,gV=new Set(["table","tbody","thead","tfoot","tr"]),yV=new Set(["td","th"]),WN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bV(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=CV(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");r=TV(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,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"?Th:I5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=GN(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function GN(e,t,n){if(t.type==="element")return xV(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return wV(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return _V(e,t,n);if(t.type==="mdxjsEsm")return vV(e,t);if(t.type==="root")return kV(e,t,n);if(t.type==="text")return SV(e,t)}function xV(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Th,e.schema=s),e.ancestors.push(t);const i=YN(e,t.tagName,!1),o=AV(e,t);let a=O5(e,t);return gV.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Cy(l):!0})),KN(e,o,i,t),D5(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function wV(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}C0(e,t.position)}function vV(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);C0(e,t.position)}function _V(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Th,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:YN(e,t.name,!0),o=EV(e,t),a=O5(e,t);return KN(e,o,i,t),D5(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function kV(e,t,n){const r={};return D5(r,O5(e,t)),e.create(t,e.Fragment,r,n)}function SV(e,t){return t.value}function KN(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function D5(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function TV(e,t,n){return r;function r(s,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function CV(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=j5(r);return t(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function AV(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&L5.call(t.properties,s)){const i=MV(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&yV.has(t.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function EV(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.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 C0(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else C0(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function O5(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:mV;for(;++r<t.children.length;){const i=t.children[r];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=s.get(l)||0;o=l+"-"+c,s.set(l,c+1)}}const a=GN(e,i,o);a!==void 0&&n.push(a)}return n}function MV(e,t,n){const r=N5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?DN(n):UN(n)),r.property==="style"){let s=typeof n=="object"?n:NV(e,String(n));return e.stylePropertyNameCase==="css"&&(s=IV(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?LH[r.property]||r.property:r.attribute,n]}}function NV(e,t){try{return hV(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new gs("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=WN+"#cannot-parse-style-attribute",s}}function YN(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const a=Yk(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=Yk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return L5.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);C0(e)}function C0(e,t){const n=new gs("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=WN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function IV(e){const t={};let n;for(n in e)L5.call(e,n)&&(t[RV(n)]=e[n]);return t}function RV(e){let t=e.replace(pV,jV);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function jV(e){return"-"+e.toLowerCase()}const M2={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"]},LV={};function B5(e,t){const n=LV,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return XN(e,r,s)}function XN(e,t,n){if(DV(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 aS(e.children,t,n)}return Array.isArray(e)?aS(e,t,n):""}function aS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=XN(e[s],t,n);return r.join("")}function DV(e){return!!(e&&typeof e=="object")}const lS=document.createElement("i");function $5(e){const t="&"+e+";";lS.innerHTML=t;const n=lS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function bi(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function Bi(e,t){return e.length>0?(bi(e,e.length,0,t),e):t}const cS={}.hasOwnProperty;function QN(e){const t={};let n=-1;for(;++n<e.length;)OV(t,e[n]);return t}function OV(e,t){let n;for(n in t){const s=(cS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){cS.call(s,o)||(s[o]=[]);const a=i[o];BV(s[o],Array.isArray(a)?a:a?[a]:[])}}}function BV(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);bi(e,0,0,r)}function JN(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 fo(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ms=wc(/[A-Za-z]/),hs=wc(/[\dA-Za-z]/),$V=wc(/[#-'*+\--9=?A-Z^-~]/);function l1(e){return e!==null&&(e<32||e===127)}const bw=wc(/\d/),zV=wc(/[\dA-Fa-f]/),PV=wc(/[!-/:-@[-`{-~]/);function gt(e){return e!==null&&e<-2}function On(e){return e!==null&&(e<0||e===32)}function Jt(e){return e===-2||e===-1||e===32}const Ey=wc(new RegExp("\\p{P}|\\p{S}","u")),Tu=wc(/\s/);function wc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ch(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&hs(e.charCodeAt(n+1))&&hs(e.charCodeAt(n+2)))s=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),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Kt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Jt(l)?(e.enter(n),a(l)):t(l)}function a(l){return Jt(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const qV={tokenize:FV};function FV(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Kt(e,t,"linePrefix")}function s(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 gt(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const UV={tokenize:HV},uS={tokenize:VV};function HV(e){const t=this,n=[];let r=0,s,i,o;return a;function a(w){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,c)(w)}return c(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&x();const k=t.events.length;let T=k,C;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){C=t.events[T][1].end;break}b(r);let A=k;for(;A<t.events.length;)t.events[A][1].end={...C},A++;return bi(t.events,T+1,0,t.events.slice(k)),t.events.length=A,c(w)}return a(w)}function c(w){if(r===n.length){if(!s)return f(w);if(s.currentConstruct&&s.currentConstruct.concrete)return p(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(uS,u,d)(w)}function u(w){return s&&x(),b(r),f(w)}function d(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,p(w)}function f(w){return t.containerState={},e.attempt(uS,m,p)(w)}function m(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function p(w){if(w===null){s&&x(),b(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(w)}function y(w){if(w===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(w);return}return gt(w)?(e.consume(w),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),y)}function v(w,k){const T=t.sliceStream(w);if(k&&T.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(T),t.parser.lazy[w.start.line]){let C=s.events.length;for(;C--;)if(s.events[C][1].start.offset<o&&(!s.events[C][1].end||s.events[C][1].end.offset>o))return;const A=t.events.length;let L=A,$,E;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if($){E=t.events[L][1].end;break}$=!0}for(b(r),C=A;C<t.events.length;)t.events[C][1].end={...E},C++;bi(t.events,L+1,0,t.events.slice(A)),t.events.length=C}}function b(w){let k=n.length;for(;k-- >w;){const T=n[k];t.containerState=T[1],T[0].exit.call(t,e)}n.length=w}function x(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function VV(e,t,n){return Kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function th(e){if(e===null||On(e)||Tu(e))return 1;if(Ey(e))return 2}function My(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const xw={name:"attention",resolveAll:WV,tokenize:GV};function WV(e,t){let n=-1,r,s,i,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};dS(d,-l),dS(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Bi(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Bi(c,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=Bi(c,My(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Bi(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Bi(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,bi(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function GV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=th(r);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"),u=th(l),d=!u||u===2&&s||n.includes(l),f=!s||s===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(s||!f)),c._close=!!(i===42?f:f&&(u||!d)),t(l)}}function dS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const KV={name:"autolink",tokenize:YV};function YV(e,t,n){let r=0;return s;function s(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Ms(m)?(e.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||hs(m)?(r=1,a(m)):c(m)}function a(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||hs(m))&&r++<32?(e.consume(m),a):(r=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||l1(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),u):$V(m)?(e.consume(m),c):n(m)}function u(m){return hs(m)?d(m):n(m)}function d(m){return m===46?(e.consume(m),r=0,u):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||hs(m))&&r++<63){const p=m===45?f:d;return e.consume(m),p}return n(m)}}const cm={partial:!0,tokenize:XV};function XV(e,t,n){return r;function r(i){return Jt(i)?Kt(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||gt(i)?t(i):n(i)}}const ZN={continuation:{tokenize:JV},exit:ZV,name:"blockQuote",tokenize:QV};function QV(e,t,n){const r=this;return s;function s(o){if(o===62){const a=r.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 Jt(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function JV(e,t,n){const r=this;return s;function s(o){return Jt(o)?Kt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(ZN,t,n)(o)}}function ZV(e){e.exit("blockQuote")}const eI={name:"characterEscape",tokenize:eW};function eW(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return PV(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const tI={name:"characterReference",tokenize:tW};function tW(e,t,n){const r=this;let s=0,i,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=hs,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=zV,u):(e.enter("characterReferenceValue"),i=7,o=bw,u(d))}function u(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return o===hs&&!$5(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),u):n(d)}}const hS={partial:!0,tokenize:rW},fS={concrete:!0,name:"codeFenced",tokenize:nW};function nW(e,t,n){const r=this,s={partial:!0,tokenize:T};let i=0,o=0,a;return l;function l(C){return c(C)}function c(C){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(C)}function u(C){return C===a?(o++,e.consume(C),u):o<3?n(C):(e.exit("codeFencedFenceSequence"),Jt(C)?Kt(e,d,"whitespace")(C):d(C))}function d(C){return C===null||gt(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(hS,y,k)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(C))}function f(C){return C===null||gt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(C)):Jt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Kt(e,m,"whitespace")(C)):C===96&&C===a?n(C):(e.consume(C),f)}function m(C){return C===null||gt(C)?d(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||gt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(C)):C===96&&C===a?n(C):(e.consume(C),p)}function y(C){return e.attempt(s,k,v)(C)}function v(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),b}function b(C){return i>0&&Jt(C)?Kt(e,x,"linePrefix",i+1)(C):x(C)}function x(C){return C===null||gt(C)?e.check(hS,y,k)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||gt(C)?(e.exit("codeFlowValue"),x(C)):(e.consume(C),w)}function k(C){return e.exit("codeFenced"),t(C)}function T(C,A,L){let $=0;return E;function E(J){return C.enter("lineEnding"),C.consume(J),C.exit("lineEnding"),z}function z(J){return C.enter("codeFencedFence"),Jt(J)?Kt(C,M,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(J):M(J)}function M(J){return J===a?(C.enter("codeFencedFenceSequence"),U(J)):L(J)}function U(J){return J===a?($++,C.consume(J),U):$>=o?(C.exit("codeFencedFenceSequence"),Jt(J)?Kt(C,K,"whitespace")(J):K(J)):L(J)}function K(J){return J===null||gt(J)?(C.exit("codeFencedFence"),A(J)):L(J)}}}function rW(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const N2={name:"codeIndented",tokenize:iW},sW={partial:!0,tokenize:oW};function iW(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),Kt(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):gt(c)?e.attempt(sW,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||gt(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function oW(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):gt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Kt(e,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):gt(o)?s(o):n(o)}}const aW={name:"codeText",previous:cW,resolve:lW,tokenize:uW};function lW(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function cW(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uW(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),s=0,u(d)):gt(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||gt(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),s++,u):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",c(d))}}class dW{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 r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&sf(this.left,r),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),sf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),sf(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);sf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);sf(this.left,n.reverse())}}}function sf(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 nI(e){const t={};let n=-1,r,s,i,o,a,l,c;const u=new dW(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(t,hW(u,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},a=u.slice(s,n),a.unshift(r),u.splice(s,n-s+1,a))}}return bi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function hW(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,m=n,p=0,y=0;const v=[y];for(;m;){for(;e.get(++s)[1]!==m;);i.push(s),m._tokenizer||(u=r.sliceStream(m),m.next||u.push(null),d&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=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,v.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):v.pop(),f=v.length;f--;){const b=a.slice(v[f],v[f+1]),x=i.pop();l.push([x,x+b.length-1]),e.splice(x,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 fW={resolve:pW,tokenize:gW},mW={partial:!0,tokenize:yW};function pW(e){return nI(e),e}function gW(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):gt(a)?e.check(mW,o,i)(a):(e.consume(a),s)}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,s}}function yW(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Kt(e,i,"linePrefix")}function i(o){if(o===null||gt(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function rI(e,t,n,r,s,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(b),e.exit(i),f):b===null||b===32||b===41||l1(b)?n(b):(e.enter(r),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(s),e.exit(r),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||gt(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!u&&(b===null||b===41||On(b))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,y):b===41?(e.consume(b),u--,y):b===null||b===32||b===40||l1(b)?n(b):(e.consume(b),b===92?v:y)}function v(b){return b===40||b===41||b===92?(e.consume(b),y):y(b)}}function sI(e,t,n,r,s,i){const o=this;let a=0,l;return c;function c(m){return e.enter(r),e.enter(s),e.consume(m),e.exit(s),e.enter(i),u}function u(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(s),e.consume(m),e.exit(s),e.exit(r),t):gt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===null||m===91||m===93||gt(m)||a++>999?(e.exit("chunkString"),u(m)):(e.consume(m),l||(l=!Jt(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}}function iI(e,t,n,r,s,i){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):gt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Kt(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||gt(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Jf(e,t){let n;return r;function r(s){return gt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Jt(s)?Kt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const bW={name:"definition",tokenize:wW},xW={partial:!0,tokenize:vW};function wW(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return sI.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return s=fo(r.sliceSerialize(r.events[r.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 On(m)?Jf(e,c)(m):c(m)}function c(m){return rI(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return e.attempt(xW,d,d)(m)}function d(m){return Jt(m)?Kt(e,f,"whitespace")(m):f(m)}function f(m){return m===null||gt(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function vW(e,t,n){return r;function r(a){return On(a)?Jf(e,s)(a):n(a)}function s(a){return iI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Jt(a)?Kt(e,o,"whitespace")(a):o(a)}function o(a){return a===null||gt(a)?t(a):n(a)}}const _W={name:"hardBreakEscape",tokenize:kW};function kW(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return gt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const SW={name:"headingAtx",resolve:TW,tokenize:CW};function TW(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},bi(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function CW(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||On(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||gt(u)?(e.exit("atxHeading"),t(u)):Jt(u)?Kt(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||On(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const AW=["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"],mS=["pre","script","style","textarea"],EW={concrete:!0,name:"htmlFlow",resolveTo:IW,tokenize:RW},MW={partial:!0,tokenize:LW},NW={partial:!0,tokenize:jW};function IW(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 RW(e,t,n){const r=this;let s,i,o,a,l;return c;function c(I){return u(I)}function u(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),d}function d(I){return I===33?(e.consume(I),f):I===47?(e.consume(I),i=!0,y):I===63?(e.consume(I),s=3,r.interrupt?t:D):Ms(I)?(e.consume(I),o=String.fromCharCode(I),v):n(I)}function f(I){return I===45?(e.consume(I),s=2,m):I===91?(e.consume(I),s=5,a=0,p):Ms(I)?(e.consume(I),s=4,r.interrupt?t:D):n(I)}function m(I){return I===45?(e.consume(I),r.interrupt?t:D):n(I)}function p(I){const ne="CDATA[";return I===ne.charCodeAt(a++)?(e.consume(I),a===ne.length?r.interrupt?t:M:p):n(I)}function y(I){return Ms(I)?(e.consume(I),o=String.fromCharCode(I),v):n(I)}function v(I){if(I===null||I===47||I===62||On(I)){const ne=I===47,de=o.toLowerCase();return!ne&&!i&&mS.includes(de)?(s=1,r.interrupt?t(I):M(I)):AW.includes(o.toLowerCase())?(s=6,ne?(e.consume(I),b):r.interrupt?t(I):M(I)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):i?x(I):w(I))}return I===45||hs(I)?(e.consume(I),o+=String.fromCharCode(I),v):n(I)}function b(I){return I===62?(e.consume(I),r.interrupt?t:M):n(I)}function x(I){return Jt(I)?(e.consume(I),x):E(I)}function w(I){return I===47?(e.consume(I),E):I===58||I===95||Ms(I)?(e.consume(I),k):Jt(I)?(e.consume(I),w):E(I)}function k(I){return I===45||I===46||I===58||I===95||hs(I)?(e.consume(I),k):T(I)}function T(I){return I===61?(e.consume(I),C):Jt(I)?(e.consume(I),T):w(I)}function C(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),l=I,A):Jt(I)?(e.consume(I),C):L(I)}function A(I){return I===l?(e.consume(I),l=null,$):I===null||gt(I)?n(I):(e.consume(I),A)}function L(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||On(I)?T(I):(e.consume(I),L)}function $(I){return I===47||I===62||Jt(I)?w(I):n(I)}function E(I){return I===62?(e.consume(I),z):n(I)}function z(I){return I===null||gt(I)?M(I):Jt(I)?(e.consume(I),z):n(I)}function M(I){return I===45&&s===2?(e.consume(I),P):I===60&&s===1?(e.consume(I),V):I===62&&s===4?(e.consume(I),j):I===63&&s===3?(e.consume(I),D):I===93&&s===5?(e.consume(I),te):gt(I)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(MW,B,U)(I)):I===null||gt(I)?(e.exit("htmlFlowData"),U(I)):(e.consume(I),M)}function U(I){return e.check(NW,K,B)(I)}function K(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),J}function J(I){return I===null||gt(I)?U(I):(e.enter("htmlFlowData"),M(I))}function P(I){return I===45?(e.consume(I),D):M(I)}function V(I){return I===47?(e.consume(I),o="",X):M(I)}function X(I){if(I===62){const ne=o.toLowerCase();return mS.includes(ne)?(e.consume(I),j):M(I)}return Ms(I)&&o.length<8?(e.consume(I),o+=String.fromCharCode(I),X):M(I)}function te(I){return I===93?(e.consume(I),D):M(I)}function D(I){return I===62?(e.consume(I),j):I===45&&s===2?(e.consume(I),D):M(I)}function j(I){return I===null||gt(I)?(e.exit("htmlFlowData"),B(I)):(e.consume(I),j)}function B(I){return e.exit("htmlFlow"),t(I)}}function jW(e,t,n){const r=this;return s;function s(o){return gt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function LW(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(cm,t,n)}}const DW={name:"htmlText",tokenize:OW};function OW(e,t,n){const r=this;let s,i,o;return a;function a(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),c):D===47?(e.consume(D),T):D===63?(e.consume(D),w):Ms(D)?(e.consume(D),L):n(D)}function c(D){return D===45?(e.consume(D),u):D===91?(e.consume(D),i=0,p):Ms(D)?(e.consume(D),x):n(D)}function u(D){return D===45?(e.consume(D),m):n(D)}function d(D){return D===null?n(D):D===45?(e.consume(D),f):gt(D)?(o=d,V(D)):(e.consume(D),d)}function f(D){return D===45?(e.consume(D),m):d(D)}function m(D){return D===62?P(D):D===45?f(D):d(D)}function p(D){const j="CDATA[";return D===j.charCodeAt(i++)?(e.consume(D),i===j.length?y:p):n(D)}function y(D){return D===null?n(D):D===93?(e.consume(D),v):gt(D)?(o=y,V(D)):(e.consume(D),y)}function v(D){return D===93?(e.consume(D),b):y(D)}function b(D){return D===62?P(D):D===93?(e.consume(D),b):y(D)}function x(D){return D===null||D===62?P(D):gt(D)?(o=x,V(D)):(e.consume(D),x)}function w(D){return D===null?n(D):D===63?(e.consume(D),k):gt(D)?(o=w,V(D)):(e.consume(D),w)}function k(D){return D===62?P(D):w(D)}function T(D){return Ms(D)?(e.consume(D),C):n(D)}function C(D){return D===45||hs(D)?(e.consume(D),C):A(D)}function A(D){return gt(D)?(o=A,V(D)):Jt(D)?(e.consume(D),A):P(D)}function L(D){return D===45||hs(D)?(e.consume(D),L):D===47||D===62||On(D)?$(D):n(D)}function $(D){return D===47?(e.consume(D),P):D===58||D===95||Ms(D)?(e.consume(D),E):gt(D)?(o=$,V(D)):Jt(D)?(e.consume(D),$):P(D)}function E(D){return D===45||D===46||D===58||D===95||hs(D)?(e.consume(D),E):z(D)}function z(D){return D===61?(e.consume(D),M):gt(D)?(o=z,V(D)):Jt(D)?(e.consume(D),z):$(D)}function M(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),s=D,U):gt(D)?(o=M,V(D)):Jt(D)?(e.consume(D),M):(e.consume(D),K)}function U(D){return D===s?(e.consume(D),s=void 0,J):D===null?n(D):gt(D)?(o=U,V(D)):(e.consume(D),U)}function K(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||On(D)?$(D):(e.consume(D),K)}function J(D){return D===47||D===62||On(D)?$(D):n(D)}function P(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function V(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),X}function X(D){return Jt(D)?Kt(e,te,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):te(D)}function te(D){return e.enter("htmlTextData"),o(D)}}const z5={name:"labelEnd",resolveAll:PW,resolveTo:qW,tokenize:FW},BW={tokenize:UW},$W={tokenize:HW},zW={tokenize:VW};function PW(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&bi(e,0,e.length,n),e}function qW(e,t){let n=e.length,r=0,s,i,o,a;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.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}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=Bi(a,e.slice(i+1,i+r+3)),a=Bi(a,[["enter",u,t]]),a=Bi(a,My(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=Bi(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=Bi(a,e.slice(o+1)),a=Bi(a,[["exit",l,t]]),bi(e,i,e.length,a),e}function FW(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(f){return i?i._inactive?d(f):(o=r.parser.defined.includes(fo(r.sliceSerialize({start:i.end,end:r.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(BW,u,o?u:d)(f):f===91?e.attempt($W,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(zW,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function UW(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return On(d)?Jf(e,i)(d):i(d)}function i(d){return d===41?u(d):rI(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return On(d)?Jf(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?iI(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return On(d)?Jf(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function HW(e,t,n){const r=this;return s;function s(a){return sI.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(fo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function VW(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const WW={name:"labelStartImage",resolveAll:z5.resolveAll,tokenize:GW};function GW(e,t,n){const r=this;return s;function s(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 r.parser.constructs?n(a):t(a)}}const KW={name:"labelStartLink",resolveAll:z5.resolveAll,tokenize:YW};function YW(e,t,n){const r=this;return s;function s(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 r.parser.constructs?n(o):t(o)}}const I2={name:"lineEnding",tokenize:XW};function XW(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Kt(e,t,"linePrefix")}}const ag={name:"thematicBreak",tokenize:QW};function QW(e,t,n){let r=0,s;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||gt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===s?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Jt(c)?Kt(e,a,"whitespace")(c):a(c))}}const zs={continuation:{tokenize:tG},exit:rG,name:"list",tokenize:eG},JW={partial:!0,tokenize:sG},ZW={partial:!0,tokenize:nG};function eG(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(m){const p=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:bw(m)){if(r.containerState.type||(r.containerState.type=p,e.enter(p,{_container:!0})),p==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(ag,n,c)(m):c(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return bw(m)&&++o<10?(e.consume(m),l):(!r.interrupt||o<2)&&(r.containerState.marker?m===r.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"),r.containerState.marker=r.containerState.marker||m,e.check(cm,r.interrupt?n:u,e.attempt(JW,f,d))}function u(m){return r.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return Jt(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),f):n(m)}function f(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function tG(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(cm,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Kt(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Jt(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ZW,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Kt(e,e.attempt(zs,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function nG(e,t,n){const r=this;return Kt(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function rG(e){e.exit(this.containerState.type)}function sG(e,t,n){const r=this;return Kt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Jt(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const pS={name:"setextUnderline",resolveTo:iG,tokenize:oG};function iG(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=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[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function oG(e,t,n){const r=this;let s;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Jt(c)?Kt(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||gt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const aG={tokenize:lG};function lG(e){const t=this,n=e.attempt(cm,r,e.attempt(this.parser.constructs.flowInitial,s,Kt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(fW,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const cG={resolveAll:aI()},uG=oI("string"),dG=oI("text");function oI(e){return{resolveAll:aI(e==="text"?hG:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,a);return o;function o(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=s[u];let f=-1;if(d)for(;++f<d.length;){const m=d[f];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function aI(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function hG(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 r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const c=s[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:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const fG={42:zs,43:zs,45:zs,48:zs,49:zs,50:zs,51:zs,52:zs,53:zs,54:zs,55:zs,56:zs,57:zs,62:ZN},mG={91:bW},pG={[-2]:N2,[-1]:N2,32:N2},gG={35:SW,42:ag,45:[pS,ag],60:EW,61:pS,95:ag,96:fS,126:fS},yG={38:tI,92:eI},bG={[-5]:I2,[-4]:I2,[-3]:I2,33:WW,38:tI,42:xw,60:[KV,DW],91:KW,92:[_W,eI],93:z5,95:xw,96:aW},xG={null:[xw,cG]},wG={null:[42,95]},vG={null:[]},_G=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:wG,contentInitial:mG,disable:vG,document:fG,flow:gG,flowInitial:pG,insideSpan:xG,string:yG,text:bG},Symbol.toStringTag,{value:"Module"}));function kG(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],a=[];const l={attempt:A(T),check:A(C),consume:x,enter:w,exit:k,interrupt:A(C,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:p,parser:e,previous:null,sliceSerialize:f,sliceStream:m,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function d(z){return o=Bi(o,z),v(),o[o.length-1]!==null?[]:(L(t,0),c.events=My(i,c.events,c),c.events)}function f(z,M){return TG(m(z),M)}function m(z){return SG(o,z)}function p(){const{_bufferIndex:z,_index:M,line:U,column:K,offset:J}=r;return{_bufferIndex:z,_index:M,line:U,column:K,offset:J}}function y(z){s[z.line]=z.column,E()}function v(){let z;for(;r._index<o.length;){const M=o[r._index];if(typeof M=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<M.length;)b(M.charCodeAt(r._bufferIndex));else b(M)}}function b(z){u=u(z)}function x(z){gt(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,E()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=z}function w(z,M){const U=M||{};return U.type=z,U.start=p(),c.events.push(["enter",U,c]),a.push(U),U}function k(z){const M=a.pop();return M.end=p(),c.events.push(["exit",M,c]),M}function T(z,M){L(z,M.from)}function C(z,M){M.restore()}function A(z,M){return U;function U(K,J,P){let V,X,te,D;return Array.isArray(K)?B(K):"tokenize"in K?B([K]):j(K);function j(ce){return Ne;function Ne(Ce){const ze=Ce!==null&&ce[Ce],ue=Ce!==null&&ce.null,rt=[...Array.isArray(ze)?ze:ze?[ze]:[],...Array.isArray(ue)?ue:ue?[ue]:[]];return B(rt)(Ce)}}function B(ce){return V=ce,X=0,ce.length===0?P:I(ce[X])}function I(ce){return Ne;function Ne(Ce){return D=$(),te=ce,ce.partial||(c.currentConstruct=ce),ce.name&&c.parser.constructs.disable.null.includes(ce.name)?de():ce.tokenize.call(M?Object.assign(Object.create(c),M):c,l,ne,de)(Ce)}}function ne(ce){return z(te,D),J}function de(ce){return D.restore(),++X<V.length?I(V[X]):P}}}function L(z,M){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&bi(c.events,M,c.events.length-M,z.resolve(c.events.slice(M),c)),z.resolveTo&&(c.events=z.resolveTo(c.events,c))}function $(){const z=p(),M=c.previous,U=c.currentConstruct,K=c.events.length,J=Array.from(a);return{from:K,restore:P};function P(){r=z,c.previous=M,c.currentConstruct=U,c.events.length=K,a=J,E()}}function E(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function SG(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function TG(e,t){let n=-1;const r=[];let s;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&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function CG(e){const r={constructs:QN([_G,...(e||{}).extensions||[]]),content:s(qV),defined:[],document:s(UV),flow:s(aG),lazy:{},string:s(uG),text:s(dG)};return r;function s(i){return o;function o(a){return kG(r,i,a)}}}function AG(e){for(;!nI(e););return e}const gS=/[\0\t\n\r]/g;function EG(){let e=1,t="",n=!0,r;return s;function s(i,o,a){const l=[];let c,u,d,f,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(gS.lastIndex=d,c=gS.exec(i),f=c&&c.index!==void 0?c.index:i.length,m=i.charCodeAt(f),!c){t=i.slice(d);break}if(m===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),e+=f-d),m){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const MG=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function NG(e){return e.replace(MG,IG)}function IG(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return JN(n.slice(i?2:1),i?16:10)}return $5(n)||e}const lI={}.hasOwnProperty;function RG(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),jG(n)(AG(CG(n).document().write(EG()(e,t,!0))))}function jG(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(vt),autolinkProtocol:$,autolinkEmail:$,atxHeading:i(ht),blockQuote:i(ue),characterEscape:$,characterReference:$,codeFenced:i(rt),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(rt,o),codeText:i(xe,o),codeTextData:$,data:$,codeFlowValue:$,definition:i(Ee),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Zt),hardBreakEscape:i(bt),hardBreakTrailing:i(bt),htmlFlow:i(Vt,o),htmlFlowData:$,htmlText:i(Vt,o),htmlTextData:$,image:i(pn),label:o,link:i(vt),listItem:i(Gt),listItemValue:f,listOrdered:i(Wt,d),listUnordered:i(Wt),paragraph:i(Tt),reference:I,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ht),strong:i(Oe),thematicBreak:i(ft)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:ze,autolinkProtocol:Ce,blockQuote:l(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:ce,characterReference:Ne,codeFenced:l(v),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:E,codeIndented:l(b),codeText:l(J),codeTextData:E,data:E,definition:l(),definitionDestinationString:k,definitionLabelString:x,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(M),hardBreakTrailing:l(M),htmlFlow:l(U),htmlFlowData:E,htmlText:l(K),htmlTextData:E,image:l(V),label:te,labelText:X,lineEnding:z,link:l(P),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:D,resourceTitleString:j,resource:B,setextHeading:l(L),setextHeadingLineSequence:A,setextHeadingText:C,strong:l(),thematicBreak:l()}};cI(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(F){let W={type:"root",children:[]};const re={stack:[W],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},me=[];let Pe=-1;for(;++Pe<F.length;)if(F[Pe][1].type==="listOrdered"||F[Pe][1].type==="listUnordered")if(F[Pe][0]==="enter")me.push(Pe);else{const Re=me.pop();Pe=s(F,Re,Pe)}for(Pe=-1;++Pe<F.length;){const Re=t[F[Pe][0]];lI.call(Re,F[Pe][1].type)&&Re[F[Pe][1].type].call(Object.assign({sliceSerialize:F[Pe][2].sliceSerialize},re),F[Pe][1])}if(re.tokenStack.length>0){const Re=re.tokenStack[re.tokenStack.length-1];(Re[1]||yS).call(re,void 0,Re[0])}for(W.position={start:fl(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:fl(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)W=t.transforms[Pe](W)||W;return W}function s(F,W,re){let me=W-1,Pe=-1,Re=!1,nt,wt,ut,he;for(;++me<=re;){const Z=F[me];switch(Z[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Z[0]==="enter"?Pe++:Pe--,he=void 0;break}case"lineEndingBlank":{Z[0]==="enter"&&(nt&&!he&&!Pe&&!ut&&(ut=me),he=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:he=void 0}if(!Pe&&Z[0]==="enter"&&Z[1].type==="listItemPrefix"||Pe===-1&&Z[0]==="exit"&&(Z[1].type==="listUnordered"||Z[1].type==="listOrdered")){if(nt){let ie=me;for(wt=void 0;ie--;){const fe=F[ie];if(fe[1].type==="lineEnding"||fe[1].type==="lineEndingBlank"){if(fe[0]==="exit")continue;wt&&(F[wt][1].type="lineEndingBlank",Re=!0),fe[1].type="lineEnding",wt=ie}else if(!(fe[1].type==="linePrefix"||fe[1].type==="blockQuotePrefix"||fe[1].type==="blockQuotePrefixWhitespace"||fe[1].type==="blockQuoteMarker"||fe[1].type==="listItemIndent"))break}ut&&(!wt||ut<wt)&&(nt._spread=!0),nt.end=Object.assign({},wt?F[wt][1].start:Z[1].end),F.splice(wt||me,0,["exit",nt,Z[2]]),me++,re++}if(Z[1].type==="listItemPrefix"){const ie={type:"listItem",_spread:!1,start:Object.assign({},Z[1].start),end:void 0};nt=ie,F.splice(me,0,["enter",ie,Z[2]]),me++,re++,ut=void 0,he=!0}}}return F[W][1]._spread=Re,re}function i(F,W){return re;function re(me){a.call(this,F(me),me),W&&W.call(this,me)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(F,W,re){this.stack[this.stack.length-1].children.push(F),this.stack.push(F),this.tokenStack.push([W,re||void 0]),F.position={start:fl(W.start),end:void 0}}function l(F){return W;function W(re){F&&F.call(this,re),c.call(this,re)}}function c(F,W){const re=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==F.type&&(W?W.call(this,F,me[0]):(me[1]||yS).call(this,F,me[0]));else throw new Error("Cannot close `"+F.type+"` ("+Qf({start:F.start,end:F.end})+"): it’s not open");re.position.end=fl(F.end)}function u(){return B5(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(F){if(this.data.expectingFirstListItemValue){const W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(F),10),this.data.expectingFirstListItemValue=void 0}}function m(){const F=this.resume(),W=this.stack[this.stack.length-1];W.lang=F}function p(){const F=this.resume(),W=this.stack[this.stack.length-1];W.meta=F}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F.replace(/(\r?\n|\r)$/g,"")}function x(F){const W=this.resume(),re=this.stack[this.stack.length-1];re.label=W,re.identifier=fo(this.sliceSerialize(F)).toLowerCase()}function w(){const F=this.resume(),W=this.stack[this.stack.length-1];W.title=F}function k(){const F=this.resume(),W=this.stack[this.stack.length-1];W.url=F}function T(F){const W=this.stack[this.stack.length-1];if(!W.depth){const re=this.sliceSerialize(F).length;W.depth=re}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function A(F){const W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(F).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function $(F){const re=this.stack[this.stack.length-1].children;let me=re[re.length-1];(!me||me.type!=="text")&&(me=ot(),me.position={start:fl(F.start),end:void 0},re.push(me)),this.stack.push(me)}function E(F){const W=this.stack.pop();W.value+=this.sliceSerialize(F),W.position.end=fl(F.end)}function z(F){const W=this.stack[this.stack.length-1];if(this.data.atHardBreak){const re=W.children[W.children.length-1];re.position.end=fl(F.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(W.type)&&($.call(this,F),E.call(this,F))}function M(){this.data.atHardBreak=!0}function U(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function K(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function J(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function P(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=W,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function V(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=W,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function X(F){const W=this.sliceSerialize(F),re=this.stack[this.stack.length-2];re.label=NG(W),re.identifier=fo(W).toLowerCase()}function te(){const F=this.stack[this.stack.length-1],W=this.resume(),re=this.stack[this.stack.length-1];if(this.data.inReference=!0,re.type==="link"){const me=F.children;re.children=me}else re.alt=W}function D(){const F=this.resume(),W=this.stack[this.stack.length-1];W.url=F}function j(){const F=this.resume(),W=this.stack[this.stack.length-1];W.title=F}function B(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function ne(F){const W=this.resume(),re=this.stack[this.stack.length-1];re.label=W,re.identifier=fo(this.sliceSerialize(F)).toLowerCase(),this.data.referenceType="full"}function de(F){this.data.characterReferenceType=F.type}function ce(F){const W=this.sliceSerialize(F),re=this.data.characterReferenceType;let me;re?(me=JN(W,re==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=$5(W);const Pe=this.stack[this.stack.length-1];Pe.value+=me}function Ne(F){const W=this.stack.pop();W.position.end=fl(F.end)}function Ce(F){E.call(this,F);const W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(F)}function ze(F){E.call(this,F);const W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(F)}function ue(){return{type:"blockquote",children:[]}}function rt(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function Ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Zt(){return{type:"emphasis",children:[]}}function ht(){return{type:"heading",depth:0,children:[]}}function bt(){return{type:"break"}}function Vt(){return{type:"html",value:""}}function pn(){return{type:"image",title:null,url:"",alt:null}}function vt(){return{type:"link",title:null,url:"",children:[]}}function Wt(F){return{type:"list",ordered:F.type==="listOrdered",start:null,spread:F._spread,children:[]}}function Gt(F){return{type:"listItem",spread:F._spread,checked:null,children:[]}}function Tt(){return{type:"paragraph",children:[]}}function Oe(){return{type:"strong",children:[]}}function ot(){return{type:"text",value:""}}function ft(){return{type:"thematicBreak"}}}function fl(e){return{line:e.line,column:e.column,offset:e.offset}}function cI(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?cI(e,r):LG(e,r)}}function LG(e,t){let n;for(n in t)if(lI.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function yS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qf({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qf({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qf({start:t.start,end:t.end})+") is still open")}function DG(e){const t=this;t.parser=n;function n(r){return RG(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function OG(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 BG(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function $G(e,t){const n=t.value?t.value+`
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,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 zG(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PG(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qG(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Ch(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(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 FG(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 UG(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function uI(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function HG(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uI(e,t);const s={src:Ch(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function VG(e,t){const n={src:Ch(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 r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function WG(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function GG(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uI(e,t);const s={href:Ch(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function KG(e,t){const n={href:Ch(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function YG(e,t,n){const r=e.all(t),s=n?XG(n):dI(t),i={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.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<r.length;){const u=r[a];(s||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(s||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 XG(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=dI(n[r])}return t}function dI(e){const t=e.spread;return t??e.children.length>1}function QG(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];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(r,!0)};return e.patch(t,i),e.applyData(t,i)}function JG(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZG(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function eK(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tK(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=j5(t.children[1]),l=HN(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function nK(e,t,n){const r=n?n.children:void 0,i=(r?r.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 d=t.children[l],f={},m=o?o[l]:void 0;m&&(f.align=m);let p={type:"element",tagName:i,properties:f,children:[]};d&&(p.children=e.all(d),e.patch(d,p),p=e.applyData(d,p)),c.push(p)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function rK(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const bS=9,xS=32;function sK(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(wS(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(wS(t.slice(s),s>0,!1)),i.join("")}function wS(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===bS||i===xS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===bS||i===xS;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function iK(e,t){const n={type:"text",value:sK(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function oK(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const aK={blockquote:OG,break:BG,code:$G,delete:zG,emphasis:PG,footnoteReference:qG,heading:FG,html:UG,imageReference:HG,image:VG,inlineCode:WG,linkReference:GG,link:KG,listItem:YG,list:QG,paragraph:JG,root:ZG,strong:eK,table:tK,tableCell:rK,tableRow:nK,text:iK,thematicBreak:oK,toml:ep,yaml:ep,definition:ep,footnoteDefinition:ep};function ep(){}const hI=-1,Ny=0,Zf=1,c1=2,P5=3,q5=4,F5=5,U5=6,fI=7,mI=8,vS=typeof self=="object"?self:globalThis,lK=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case Ny:case hI:return n(o,s);case Zf:{const a=n([],s);for(const l of o)a.push(r(l));return a}case c1:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case P5:return n(new Date(o),s);case q5:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case F5:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case U5:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case fI:{const{name:a,message:l}=o;return n(new vS[a](l),s)}case mI:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);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 vS[i](o),s)};return r},_S=e=>lK(new Map,e)(0),Zu="",{toString:cK}={},{keys:uK}=Object,of=e=>{const t=typeof e;if(t!=="object"||!e)return[Ny,t];const n=cK.call(e).slice(8,-1);switch(n){case"Array":return[Zf,Zu];case"Object":return[c1,Zu];case"Date":return[P5,Zu];case"RegExp":return[q5,Zu];case"Map":return[F5,Zu];case"Set":return[U5,Zu];case"DataView":return[Zf,n]}return n.includes("Array")?[Zf,n]:n.includes("Error")?[fI,n]:[c1,n]},tp=([e,t])=>e===Ny&&(t==="function"||t==="symbol"),dK=(e,t,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=of(o);switch(a){case Ny:{let u=o;switch(l){case"bigint":a=mI,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([hI],o)}return s([a,u],o)}case Zf:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),s([l,[...f]],o)}const u=[],d=s([a,u],o);for(const f of o)u.push(i(f));return d}case c1:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const u=[],d=s([a,u],o);for(const f of uK(o))(e||!tp(of(o[f])))&&u.push([i(f),i(o[f])]);return d}case P5:return s([a,o.toISOString()],o);case q5:{const{source:u,flags:d}=o;return s([a,{source:u,flags:d}],o)}case F5:{const u=[],d=s([a,u],o);for(const[f,m]of o)(e||!(tp(of(f))||tp(of(m))))&&u.push([i(f),i(m)]);return d}case U5:{const u=[],d=s([a,u],o);for(const f of o)(e||!tp(of(f)))&&u.push(i(f));return d}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},kS=(e,{json:t,lossy:n}={})=>{const r=[];return dK(!(t||n),!!t,new Map,r)(e),r},u1=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?_S(kS(e,t)):structuredClone(e):(e,t)=>_S(kS(e,t));function hK(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 fK(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function mK(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||hK,r=e.options.footnoteBackLabel||fK,s=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 u=e.all(c),d=String(c.identifier).toUpperCase(),f=Ch(d.toLowerCase());let m=0;const p=[],y=e.footnoteCounts.get(d);for(;y!==void 0&&++m<=y;){p.length>0&&p.push({type:"text",value:" "});let x=typeof n=="string"?n:n(l,m);typeof x=="string"&&(x={type:"text",value:x}),p.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,m),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const v=u[u.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const x=v.children[v.children.length-1];x&&x.type==="text"?x.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...p)}else u.push(...p);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!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:{...u1(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
`}]}}const um=function(e){if(e==null)return bK;if(typeof e=="function")return Iy(e);if(typeof e=="object")return Array.isArray(e)?pK(e):gK(e);if(typeof e=="string")return yK(e);throw new Error("Expected function, string, or object as test")};function pK(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=um(e[n]);return Iy(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function gK(e){const t=e;return Iy(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function yK(e){return Iy(t);function t(n){return n&&n.type===e}}function Iy(e){return t;function t(n,r,s){return!!(xK(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function bK(){return!0}function xK(e){return e!==null&&typeof e=="object"&&"type"in e}const pI=[],wK=!0,ww=!1,gI="skip";function H5(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=um(s),o=r?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return f;function f(){let m=pI,p,y,v;if((!t||i(l,c,u[u.length-1]||void 0))&&(m=vK(n(l,u)),m[0]===ww))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!==gI)for(y=(r?b.children.length:-1)+o,v=u.concat(b);y>-1&&y<b.children.length;){const x=b.children[y];if(p=a(x,y,v)(),p[0]===ww)return p;y=typeof p[1]=="number"?p[1]:y+o}}return m}}}function vK(e){return Array.isArray(e)?e:typeof e=="number"?[wK,e]:e==null?pI:[e]}function V5(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),H5(e,i,a,s);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}const vw={}.hasOwnProperty,_K={};function kK(e,t){const n=t||_K,r=new Map,s=new Map,i=new Map,o={...aK,...n.handlers},a={all:c,applyData:TK,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:SK,wrap:AK};return V5(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:s,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,m=a.handlers[f];if(vw.call(a.handlers,f)&&m)return m(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:y,...v}=u,b=u1(v);return b.children=a.all(u),b}return u1(u)}return(a.options.unknownHandler||CK)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let m=-1;for(;++m<f.length;){const p=a.one(f[m],u);if(p){if(m&&f[m-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=SS(p.value)),!Array.isArray(p)&&p.type==="element")){const y=p.children[0];y&&y.type==="text"&&(y.value=SS(y.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function SK(e,t){e.position&&(t.position=fV(e))}function TK(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,u1(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function CK(e,t){const n=t.data||{},r="value"in t&&!(vw.call(n,"hProperties")||vw.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function AK(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
`});++r<e.length;)r&&n.push({type:"text",value:`
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
`}),n}function SS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function TS(e,t){const n=kK(e,t),r=n.one(e,void 0),s=mK(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function EK(e,t){return e&&"run"in e?async function(n,r){const s=TS(n,{file:r,...t});await e.run(s,r)}:function(n,r){return TS(n,{file:r,...e||t})}}function CS(e){if(e)throw e}var lg=Object.prototype.hasOwnProperty,yI=Object.prototype.toString,AS=Object.defineProperty,ES=Object.getOwnPropertyDescriptor,MS=function(t){return typeof Array.isArray=="function"?Array.isArray(t):yI.call(t)==="[object Array]"},NS=function(t){if(!t||yI.call(t)!=="[object Object]")return!1;var n=lg.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&lg.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||lg.call(t,s)},IS=function(t,n){AS&&n.name==="__proto__"?AS(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},RS=function(t,n){if(n==="__proto__")if(lg.call(t,n)){if(ES)return ES(t,n).value}else return;return t[n]},MK=function e(){var t,n,r,s,i,o,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=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)r=RS(a,n),s=RS(t,n),a!==s&&(u&&s&&(NS(s)||(i=MS(s)))?(i?(i=!1,o=r&&MS(r)?r:[]):o=r&&NS(r)?r:{},IS(a,{name:n,newValue:e(u,o,s)})):typeof s<"u"&&IS(a,{name:n,newValue:s}));return a};const R2=J1(MK);function _w(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 NK(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=e[++i];let d=-1;if(l){o(l);return}for(;++d<s.length;)(c[d]===null||c[d]===void 0)&&(c[d]=s[d]);s=c,u?IK(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function IK(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(s);try{l=e.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,t(o,...a))}function i(o){s(null,o)}}const Do={basename:RK,dirname:jK,extname:LK,join:DK,sep:"/"};function RK(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');dm(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function jK(e){if(dm(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function LK(e){dm(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function DK(...e){let t=-1,n;for(;++t<e.length;)dm(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":OK(n)}function OK(e){dm(e);const t=e.codePointAt(0)===47;let n=BK(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function BK(e,t){let n="",r=0,s=-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(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==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="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function dm(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const $K={cwd:zK};function zK(){return"/"}function kw(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function PK(e){if(typeof e=="string")e=new URL(e);else if(!kw(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 qK(e)}function qK(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const j2=["history","path","basename","stem","extname","dirname"];class bI{constructor(t){let n;t?kw(t)?n={path:t}:typeof t=="string"||FK(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":$K.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<j2.length;){const i=j2[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)j2.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Do.basename(this.path):void 0}set basename(t){D2(t,"basename"),L2(t,"basename"),this.path=Do.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Do.dirname(this.path):void 0}set dirname(t){jS(this.basename,"dirname"),this.path=Do.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Do.extname(this.path):void 0}set extname(t){if(L2(t,"extname"),jS(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=Do.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){kw(t)&&(t=PK(t)),D2(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Do.basename(this.path,this.extname):void 0}set stem(t){D2(t,"stem"),L2(t,"stem"),this.path=Do.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new gs(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function L2(e,t){if(e&&e.includes(Do.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Do.sep+"`")}function D2(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function FK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const UK=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},HK={}.hasOwnProperty;class W5 extends UK{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=NK()}copy(){const t=new W5;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(R2(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?($2("data",this.frozen),this.namespace[t]=n,this):HK.call(this.namespace,t)&&this.namespace[t]||void 0:t?($2("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,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=np(t),r=this.parser||this.Parser;return O2("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),O2("process",this.parser||this.Parser),B2("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=np(t),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const m=d,p=r.stringify(m,f);GK(p)?f.value=p:f.result=p,c(u,f)});function c(u,d){u||!d?o(u):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),O2("processSync",this.parser||this.Parser),B2("processSync",this.compiler||this.Compiler),this.process(t,s),DS("processSync","process",n),r;function s(i,o){n=!0,CS(i),r=o}}run(t,n,r){LS(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=np(n);s.run(t,l,c);function c(u,d,f){const m=d||t;u?a(u):o?o(m):r(void 0,m,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),DS("runSync","run",r),s;function i(o,a){CS(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=np(n),s=this.compiler||this.Compiler;return B2("stringify",s),LS(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if($2("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[u,...d]=c;l(u,d)}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&&(s.settings=R2(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[m,...p]=u;const y=r[f][1];_w(y)&&_w(m)&&(m=R2(!0,y,m)),r[f]=[c,m,...p]}}}}const VK=new W5().freeze();function O2(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function B2(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $2(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 LS(e){if(!_w(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function DS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function np(e){return WK(e)?e:new bI(e)}function WK(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function GK(e){return typeof e=="string"||KK(e)}function KK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const YK="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",OS=[],BS={allowDangerousHtml:!0},XK=/^(https?|ircs?|mailto|xmpp)$/i,QK=[{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 JK(e){const t=ZK(e),n=eY(e);return tY(t.runSync(t.parse(n),n),e)}function ZK(e){const t=e.rehypePlugins||OS,n=e.remarkPlugins||OS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...BS}:BS;return VK().use(DG).use(n).use(EK,r).use(t)}function eY(e){const t=e.children||"",n=new bI;return typeof t=="string"&&(n.value=t),n}function tY(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||nY;for(const u of QK)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+YK+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),V5(e,c),bV(e,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let m;for(m in M2)if(Object.hasOwn(M2,m)&&Object.hasOwn(u.properties,m)){const p=u.properties[m],y=M2[m];(y===null||y.includes(u.tagName))&&(u.properties[m]=l(String(p||""),m,u))}}if(u.type==="element"){let m=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!m&&r&&typeof d=="number"&&(m=!r(u,d,f)),m&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function nY(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||XK.test(e.slice(0,t))?e:""}function d1(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function rY(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function sY(e,t,n){const s=um((n||{}).ignore||[]),i=iY(t);let o=-1;for(;++o<i.length;)H5(e,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const m=u[d],p=f?f.children:void 0;if(s(m,p?p.indexOf(m):void 0,f))return;f=m}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=i[o][0],m=i[o][1];let p=0;const v=d.children.indexOf(c);let b=!1,x=[];f.lastIndex=0;let w=f.exec(c.value);for(;w;){const k=w.index,T={index:w.index,input:w.input,stack:[...u,c]};let C=m(...w,T);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?f.lastIndex=k+1:(p!==k&&x.push({type:"text",value:c.value.slice(p,k)}),Array.isArray(C)?x.push(...C):C&&x.push(C),p=k+w[0].length,b=!0),!f.global)break;w=f.exec(c.value)}return b?(p<c.value.length&&x.push({type:"text",value:c.value.slice(p)}),d.children.splice(v,1,...x)):x=[c],v+x.length}}function iY(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 r=-1;for(;++r<n.length;){const s=n[r];t.push([oY(s[0]),aY(s[1])])}return t}function oY(e){return typeof e=="string"?new RegExp(rY(e),"g"):e}function aY(e){return typeof e=="function"?e:function(){return e}}const z2="phrasing",P2=["autolink","link","image","label"];function lY(){return{transforms:[pY],enter:{literalAutolink:uY,literalAutolinkEmail:q2,literalAutolinkHttp:q2,literalAutolinkWww:q2},exit:{literalAutolink:mY,literalAutolinkEmail:fY,literalAutolinkHttp:dY,literalAutolinkWww:hY}}}function cY(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:z2,notInConstruct:P2},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:z2,notInConstruct:P2},{character:":",before:"[ps]",after:"\\/",inConstruct:z2,notInConstruct:P2}]}}function uY(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function q2(e){this.config.enter.autolinkProtocol.call(this,e)}function dY(e){this.config.exit.autolinkProtocol.call(this,e)}function hY(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 fY(e){this.config.exit.autolinkEmail.call(this,e)}function mY(e){this.exit(e)}function pY(e){sY(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,gY],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),yY]],{ignore:["link","linkReference"]})}function gY(e,t,n,r,s){let i="";if(!xI(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!bY(n)))return!1;const o=xY(n+r);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 yY(e,t,n,r){return!xI(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bY(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 xY(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=d1(e,"(");let i=d1(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function xI(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Tu(n)||Ey(n))&&(!t||n!==47)}wI.peek=EY;function wY(){this.buffer()}function vY(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function _Y(){this.buffer()}function kY(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function SY(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fo(this.sliceSerialize(e)).toLowerCase(),n.label=t}function TY(e){this.exit(e)}function CY(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=fo(this.sliceSerialize(e)).toLowerCase(),n.label=t}function AY(e){this.exit(e)}function EY(){return"["}function wI(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function MY(){return{enter:{gfmFootnoteCallString:wY,gfmFootnoteCall:vY,gfmFootnoteDefinitionLabelString:_Y,gfmFootnoteDefinition:kY},exit:{gfmFootnoteCallString:SY,gfmFootnoteCall:TY,gfmFootnoteDefinitionLabelString:CY,gfmFootnoteDefinition:AY}}}function NY(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:wI},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(r,a.current()),t?vI:IY))),c(),l}}function IY(e,t,n){return t===0?e:vI(e,t,n)}function vI(e,t,n){return(n?"":"    ")+e}const RY=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_I.peek=BY;function jY(){return{canContainEols:["delete"],enter:{strikethrough:DY},exit:{strikethrough:OY}}}function LY(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RY}],handlers:{delete:_I}}}function DY(e){this.enter({type:"delete",children:[]},e)}function OY(e){this.exit(e)}function _I(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function BY(){return"~"}function $Y(e){return e.length}function zY(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||$Y,i=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const y=[],v=[];let b=-1;for(e[u].length>c&&(c=e[u].length);++b<e[u].length;){const x=PY(e[u][b]);if(n.alignDelimiters!==!1){const w=s(x);v[b]=w,(l[b]===void 0||w>l[b])&&(l[b]=w)}y.push(x)}o[u]=y,a[u]=v}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=$S(r[d]);else{const y=$S(r);for(;++d<c;)i[d]=y}d=-1;const f=[],m=[];for(;++d<c;){const y=i[d];let v="",b="";y===99?(v=":",b=":"):y===108?v=":":y===114&&(b=":");let x=n.alignDelimiters===!1?1:Math.max(1,l[d]-v.length-b.length);const w=v+"-".repeat(x)+b;n.alignDelimiters!==!1&&(x=v.length+x+b.length,x>l[d]&&(l[d]=x),m[d]=x),f[d]=w}o.splice(1,0,f),a.splice(1,0,m),u=-1;const p=[];for(;++u<o.length;){const y=o[u],v=a[u];d=-1;const b=[];for(;++d<c;){const x=y[d]||"";let w="",k="";if(n.alignDelimiters!==!1){const T=l[d]-(v[d]||0),C=i[d];C===114?w=" ".repeat(T):C===99?T%2?(w=" ".repeat(T/2+.5),k=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),k=w):k=" ".repeat(T)}n.delimiterStart!==!1&&!d&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&x==="")&&(n.delimiterStart!==!1||d)&&b.push(" "),n.alignDelimiters!==!1&&b.push(w),b.push(x),n.alignDelimiters!==!1&&b.push(k),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&b.push("|")}p.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
`)}function PY(e){return e==null?"":String(e)}function $S(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 zS={}.hasOwnProperty;function qY(e,t){const n=t||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&zS.call(s,e)){const l=String(s[e]);o=zS.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function FY(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),UY);return s(),o}function UY(e,t,n){return">"+(n?"":" ")+e}function HY(e,t){return PS(e,t.inConstruct,!0)&&!PS(e,t.notInConstruct,!1)}function PS(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function qS(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&HY(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function kI(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function VY(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 WY(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 GY(e,t,n,r){const s=WY(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(VY(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,KY);return d(),f}const a=n.createTracker(r),l=s.repeat(Math.max(kI(i,s)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:`
`,encode:["`"],...a.current()})),d()}return u+=a.move(`
`),i&&(u+=a.move(i+`
`)),u+=a.move(l),c(),u}function KY(e,t,n){return(n?"":"    ")+e}function G5(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 YY(e,t,n,r){const s=G5(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);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(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),o(),c}function XY(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 A0(e){return"&#x"+e.toString(16).toUpperCase()+";"}function h1(e,t,n){const r=th(e),s=th(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}SI.peek=QY;function SI(e,t,n,r){const s=XY(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=h1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=A0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=h1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+A0(d));const m=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function QY(e,t,n){return n.options.emphasis||"*"}function JY(e,t){let n=!1;return V5(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ww}),!!((!e.depth||e.depth<3)&&B5(e)&&(t.options.setext||n))}function ZY(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(JY(e,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return d(),u(),f+`
`+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
`))+1))}const o="#".repeat(s),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=A0(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}TI.peek=eX;function TI(e){return e.value||""}function eX(){return"<"}CI.peek=tX;function CI(e,t,n,r){const s=G5(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);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(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),c+=l.move(")"),o(),c}function tX(){return"!"}AI.peek=nX;function AI(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function nX(){return"!"}EI.peek=rX;function EI(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return s+r+s}function rX(){return"`"}function MI(e,t){const n=B5(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))}NI.peek=sX;function NI(e,t,n,r){const s=G5(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(MI(e,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}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(" "+s),c+=o.move(n.safe(e.title,{before:c,after:s,...o.current()})),c+=o.move(s),l()),c+=o.move(")"),a(),c}function sX(e,t,n){return MI(e,n)?"<":"["}II.peek=iX;function II(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function iX(){return"["}function K5(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 oX(e){const t=K5(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 aX(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 RI(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 lX(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?aX(n):K5(n);const a=e.ordered?o==="."?")":".":oX(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.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),RI(n)===o&&u){let d=-1;for(;++d<e.children.length;){const f=e.children[d];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,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),c}function cX(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 uX(e,t,n,r){const s=cX(n);let i=n.bulletCurrent||K5(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;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),u);return l(),c;function u(d,f,m){return f?(m?"":" ".repeat(o))+d:(m?i:i+" ".repeat(o-i.length))+d}}function dX(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const hX=um(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fX(e,t,n,r){return(e.children.some(function(o){return hX(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function mX(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}jI.peek=pX;function jI(e,t,n,r){const s=mX(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=h1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=A0(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=h1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+A0(d));const m=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function pX(e,t,n){return n.options.strong||"*"}function gX(e,t,n,r){return n.safe(e.value,r)}function yX(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 bX(e,t,n){const r=(RI(n)+(n.options.ruleSpaces?" ":"")).repeat(yX(n));return n.options.ruleSpaces?r.slice(0,-1):r}const LI={blockquote:FY,break:qS,code:GY,definition:YY,emphasis:SI,hardBreak:qS,heading:ZY,html:TI,image:CI,imageReference:AI,inlineCode:EI,link:NI,linkReference:II,list:lX,listItem:uX,paragraph:dX,root:fX,strong:jI,text:gX,thematicBreak:bX};function xX(){return{enter:{table:wX,tableData:FS,tableHeader:FS,tableRow:_X},exit:{codeText:kX,table:vX,tableData:F2,tableHeader:F2,tableRow:F2}}}function wX(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 vX(e){this.exit(e),this.data.inTable=void 0}function _X(e){this.enter({type:"tableRow",children:[]},e)}function F2(e){this.exit(e)}function FS(e){this.enter({type:"tableCell",children:[]},e)}function kX(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,SX));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function SX(e,t){return t==="|"?t:e}function TX(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=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,v){return c(u(m,y,v),m.align)}function a(m,p,y,v){const b=d(m,y,v),x=c([b]);return x.slice(0,x.indexOf(`
`))}function l(m,p,y,v){const b=y.enter("tableCell"),x=y.enter("phrasing"),w=y.containerPhrasing(m,{...v,before:i,after:i});return x(),b(),w}function c(m,p){return zY(m,{align:p,alignDelimiters:r,padding:n,stringLength:s})}function u(m,p,y){const v=m.children;let b=-1;const x=[],w=p.enter("table");for(;++b<v.length;)x[b]=d(v[b],p,y);return w(),x}function d(m,p,y){const v=m.children;let b=-1;const x=[],w=p.enter("tableRow");for(;++b<v.length;)x[b]=l(v[b],m,p,y);return w(),x}function f(m,p,y){let v=LI.inlineCode(m,p,y);return y.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function CX(){return{exit:{taskListCheckValueChecked:US,taskListCheckValueUnchecked:US,paragraph:EX}}}function AX(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:MX}}}function US(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function EX(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 r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const a=s[i];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function MX(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=LI.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function NX(){return[lY(),MY(),jY(),xX(),CX()]}function IX(e){return{extensions:[cY(),NY(e),LY(),TX(e),AX()]}}const RX={tokenize:$X,partial:!0},DI={tokenize:zX,partial:!0},OI={tokenize:PX,partial:!0},BI={tokenize:qX,partial:!0},jX={tokenize:FX,partial:!0},$I={name:"wwwAutolink",tokenize:OX,previous:PI},zI={name:"protocolAutolink",tokenize:BX,previous:qI},Qa={name:"emailAutolink",tokenize:DX,previous:FI},Zo={};function LX(){return{text:Zo}}let Oc=48;for(;Oc<123;)Zo[Oc]=Qa,Oc++,Oc===58?Oc=65:Oc===91&&(Oc=97);Zo[43]=Qa;Zo[45]=Qa;Zo[46]=Qa;Zo[95]=Qa;Zo[72]=[Qa,zI];Zo[104]=[Qa,zI];Zo[87]=[Qa,$I];Zo[119]=[Qa,$I];function DX(e,t,n){const r=this;let s,i;return o;function o(d){return!Sw(d)||!FI.call(r,r.previous)||Y5(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return Sw(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(jX,u,c)(d):d===45||d===95||hs(d)?(i=!0,e.consume(d),l):u(d)}function c(d){return e.consume(d),s=!0,l}function u(d){return i&&s&&Ms(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function OX(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!PI.call(r,r.previous)||Y5(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(RX,e.attempt(DI,e.attempt(OI,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function BX(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&qI.call(r,r.previous)&&!Y5(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(Ms(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||l1(d)||On(d)||Tu(d)||Ey(d)?n(d):e.attempt(DI,e.attempt(OI,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function $X(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function zX(e,t,n){let r,s,i;return o;function o(c){return c===46||c===95?e.check(BI,l,a)(c):c===null||On(c)||Tu(c)||c!==45&&Ey(c)?l(c):(i=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),e.consume(c),o}function l(c){return s||r||!i?n(c):t(c)}}function PX(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<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(BI,t,i)(o):o===null||On(o)||Tu(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function qX(e,t,n){return r;function r(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),r):a===38?(e.consume(a),i):a===93?(e.consume(a),s):a===60||a===null||On(a)||Tu(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||On(a)||Tu(a)?t(a):r(a)}function i(a){return Ms(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ms(a)?(e.consume(a),o):n(a)}}function FX(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return hs(i)?n(i):t(i)}}function PI(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||On(e)}function qI(e){return!Ms(e)}function FI(e){return!(e===47||Sw(e))}function Sw(e){return e===43||e===45||e===46||e===95||hs(e)}function Y5(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const UX={tokenize:QX,partial:!0};function HX(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:KX,continuation:{tokenize:YX},exit:XX}},text:{91:{name:"gfmFootnoteCall",tokenize:GX},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:VX,resolveTo:WX}}}}function VX(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][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=fo(r.sliceSerialize({start:o.end,end:r.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 WX(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 r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.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",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function GX(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!o||d===null||d===91||On(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(fo(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return On(d)||(o=!0),i++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),i++,c):c(d)}}function KX(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.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",u):n(p)}function u(p){if(o>999||p===93&&!a||p===null||p===91||On(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=fo(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return On(p)||(a=!0),o++,e.consume(p),p===92?d:u}function d(p){return p===91||p===92||p===93?(e.consume(p),o++,u):u(p)}function f(p){return p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),s.includes(i)||s.push(i),Kt(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function YX(e,t,n){return e.check(cm,t,e.attempt(UX,t,n))}function XX(e){e.exit("gfmFootnoteDefinition")}function QX(e,t,n){const r=this;return Kt(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function JX(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(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 u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],m=a.parser.constructs.insideSpan.null;m&&bi(f,f.length,0,My(m,o.slice(c+1,l),a)),bi(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),bi(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,u=this.events;let d=0;return f;function f(p){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),m(p))}function m(p){const y=th(c);if(p===126)return d>1?l(p):(o.consume(p),d++,m);if(d<2&&!n)return l(p);const v=o.exit("strikethroughSequenceTemporary"),b=th(p);return v._open=!b||b===2&&!!y,v._close=!y||y===2&&!!b,a(p)}}}class ZX{constructor(){this.map=[]}add(t,n,r){eQ(this,t,n,r)}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 r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function eQ(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function tQ(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function nQ(){return{flow:{null:{name:"table",tokenize:rQ,resolveAll:sQ}}}}function rQ(e,t,n){const r=this;let s=0,i=0,o;return a;function a(E){let z=r.events.length-1;for(;z>-1;){const K=r.events[z][1].type;if(K==="lineEnding"||K==="linePrefix")z--;else break}const M=z>-1?r.events[z][1].type:null,U=M==="tableHead"||M==="tableRow"?C:l;return U===C&&r.parser.lazy[r.now().line]?n(E):U(E)}function l(E){return e.enter("tableHead"),e.enter("tableRow"),c(E)}function c(E){return E===124||(o=!0,i+=1),u(E)}function u(E){return E===null?n(E):gt(E)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),m):n(E):Jt(E)?Kt(e,u,"whitespace")(E):(i+=1,o&&(o=!1,s+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(E)))}function d(E){return E===null||E===124||On(E)?(e.exit("data"),u(E)):(e.consume(E),E===92?f:d)}function f(E){return E===92||E===124?(e.consume(E),d):d(E)}function m(E){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(E):(e.enter("tableDelimiterRow"),o=!1,Jt(E)?Kt(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):p(E))}function p(E){return E===45||E===58?v(E):E===124?(o=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),y):T(E)}function y(E){return Jt(E)?Kt(e,v,"whitespace")(E):v(E)}function v(E){return E===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),b):E===45?(i+=1,b(E)):E===null||gt(E)?k(E):T(E)}function b(E){return E===45?(e.enter("tableDelimiterFiller"),x(E)):T(E)}function x(E){return E===45?(e.consume(E),x):E===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(E))}function w(E){return Jt(E)?Kt(e,k,"whitespace")(E):k(E)}function k(E){return E===124?p(E):E===null||gt(E)?!o||s!==i?T(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):T(E)}function T(E){return n(E)}function C(E){return e.enter("tableRow"),A(E)}function A(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),A):E===null||gt(E)?(e.exit("tableRow"),t(E)):Jt(E)?Kt(e,A,"whitespace")(E):(e.enter("data"),L(E))}function L(E){return E===null||E===124||On(E)?(e.exit("data"),A(E)):(e.consume(E),E===92?$:L)}function $(E){return E===92||E===124?(e.consume(E),L):L(E)}}function sQ(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new ZX;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(HS(f,t,l,c,u),u=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"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",u,t]])),s=p.type==="tableDelimiterRow"?2:u?3:1):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=rp(f,t,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=rp(f,t,i,s,void 0,d)),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],d=rp(f,t,i,s,n,d)):o[1]!==0&&(d=rp(f,t,o,s,n,d)),s=0):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&HS(f,t,l,c,u),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=tQ(t.events,n))}return e}function rp(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},ad(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=ad(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=ad(t.events,n[2]),u=ad(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==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",d,t]])}return s!==void 0&&(i.end=Object.assign({},ad(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function HS(e,t,n,r,s){const i=[],o=ad(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function ad(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const iQ={name:"tasklistCheck",tokenize:aQ};function oQ(){return{text:{91:iQ}}}function aQ(e,t,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return On(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 gt(l)?t(l):Jt(l)?e.check({tokenize:lQ},t,n)(l):n(l)}}function lQ(e,t,n){return Kt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function cQ(e){return QN([LX(),HX(),JX(e),nQ(),oQ()])}const uQ={};function VS(e){const t=this,n=e||uQ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(cQ(n)),i.push(NX()),o.push(IX(n))}function dQ(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:i},exit:{mathFlow:s,mathFlowFence:r,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 r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c;const d=u.data.hChildren[0];d.type,d.tagName,d.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(),u=this.stack[this.stack.length-1];u.type,this.exit(l),u.value=c,u.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 hQ(e){let t=(e||{}).singleDollarTextMath;return t==null&&(t=!0),r.peek=s,{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:r}};function n(i,o,a,l){const c=i.value||"",u=a.createTracker(l),d="$".repeat(Math.max(kI(c,"$")+1,2)),f=a.enter("mathFlow");let m=u.move(d);if(i.meta){const p=a.enter("mathFlowMeta");m+=u.move(a.safe(i.meta,{after:`
`,before:m,encode:["$"],...u.current()})),p()}return m+=u.move(`
`),c&&(m+=u.move(c+`
`)),m+=u.move(d),f(),m}function r(i,o,a){let l=i.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++d<a.unsafe.length;){const f=a.unsafe[d];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 u+l+u}function s(){return"$"}}const fQ={tokenize:mQ,concrete:!0,name:"mathFlow"},WS={tokenize:pQ,partial:!0};function mQ(e,t,n){const r=this,s=r.events[r.events.length-1],i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0;let o=0;return a;function a(x){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(x)}function l(x){return x===36?(e.consume(x),o++,l):o<2?n(x):(e.exit("mathFlowFenceSequence"),Kt(e,c,"whitespace")(x))}function c(x){return x===null||gt(x)?d(x):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(x))}function u(x){return x===null||gt(x)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),d(x)):x===36?n(x):(e.consume(x),u)}function d(x){return e.exit("mathFlowFence"),r.interrupt?t(x):e.attempt(WS,f,v)(x)}function f(x){return e.attempt({tokenize:b,partial:!0},v,m)(x)}function m(x){return(i?Kt(e,p,"linePrefix",i+1):p)(x)}function p(x){return x===null?v(x):gt(x)?e.attempt(WS,f,v)(x):(e.enter("mathFlowValue"),y(x))}function y(x){return x===null||gt(x)?(e.exit("mathFlowValue"),p(x)):(e.consume(x),y)}function v(x){return e.exit("mathFlow"),t(x)}function b(x,w,k){let T=0;return Kt(x,C,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function C($){return x.enter("mathFlowFence"),x.enter("mathFlowFenceSequence"),A($)}function A($){return $===36?(T++,x.consume($),A):T<o?k($):(x.exit("mathFlowFenceSequence"),Kt(x,L,"whitespace")($))}function L($){return $===null||gt($)?(x.exit("mathFlowFence"),w($)):k($)}}}function pQ(e,t,n){const r=this;return s;function s(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function gQ(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:yQ,previous:bQ,name:"mathText"};function r(s,i,o){let a=0,l,c;return u;function u(y){return s.enter("mathText"),s.enter("mathTextSequence"),d(y)}function d(y){return y===36?(s.consume(y),a++,d):a<2&&!n?o(y):(s.exit("mathTextSequence"),f(y))}function f(y){return y===null?o(y):y===36?(c=s.enter("mathTextSequence"),l=0,p(y)):y===32?(s.enter("space"),s.consume(y),s.exit("space"),f):gt(y)?(s.enter("lineEnding"),s.consume(y),s.exit("lineEnding"),f):(s.enter("mathTextData"),m(y))}function m(y){return y===null||y===32||y===36||gt(y)?(s.exit("mathTextData"),f(y)):(s.consume(y),m)}function p(y){return y===36?(s.consume(y),l++,p):l===a?(s.exit("mathTextSequence"),s.exit("mathText"),i(y)):(c.type="mathTextData",m(y))}}}function yQ(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="mathTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function bQ(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function xQ(e){return{flow:{36:fQ},text:{36:gQ(e)}}}class Ie extends Error{constructor(t,n){var r="KaTeX parse error: "+t,s,i,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;s=o.start,i=o.end,s===a.length?r+=" at end of input: ":r+=" at position "+(s+1)+": ";var l=a.slice(s,i).replace(/[^]/g,"$&̲"),c;s>15?c="…"+a.slice(s-15,s):c=a.slice(0,s);var u;i+15<a.length?u=a.slice(i,i+15)+"…":u=a.slice(i),r+=c+l+u}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,Ie.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=t}}var wQ=/([A-Z])/g,vQ=e=>e.replace(wQ,"-$1").toLowerCase(),_Q={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},kQ=/[&><"']/g,ps=e=>String(e).replace(kQ,t=>_Q[t]),cg=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?cg(e.body[0]):e:e.type==="font"?cg(e.body):e,SQ=new Set(["mathord","textord","atom"]),Ja=e=>SQ.has(cg(e).type),TQ=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"},f1={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 CQ(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 AQ(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return CQ(t)}function EQ(e,t,n,r){var s=n[t];e[t]=s!==void 0?r.processor?r.processor(s):s:AQ(r)}class X5{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(f1)){var r=f1[n];r&&EQ(this,n,t,r)}}reportNonstrict(t,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(t,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new Ie("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+t+"]"),r);s==="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 '"+s+"': "+n+" ["+t+"]"))}}useStrictBehavior(t,n,r){var s=this.strict;if(typeof s=="function")try{s=s(t,n,r)}catch{s="error"}return!s||s==="ignore"?!1:s===!0||s==="error"?!0:s==="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 '"+s+"': "+n+" ["+t+"]")),!1)}isTrusted(t){if("url"in t&&t.url&&!t.protocol){var n=TQ(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}class ml{constructor(t,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=n,this.cramped=r}sup(){return Oo[MQ[this.id]]}sub(){return Oo[NQ[this.id]]}fracNum(){return Oo[IQ[this.id]]}fracDen(){return Oo[RQ[this.id]]}cramp(){return Oo[jQ[this.id]]}text(){return Oo[LQ[this.id]]}isTight(){return this.size>=2}}var Q5=0,m1=1,Dd=2,$a=3,E0=4,Ui=5,nh=6,Is=7,Oo=[new ml(Q5,0,!1),new ml(m1,0,!0),new ml(Dd,1,!1),new ml($a,1,!0),new ml(E0,2,!1),new ml(Ui,2,!0),new ml(nh,3,!1),new ml(Is,3,!0)],MQ=[E0,Ui,E0,Ui,nh,Is,nh,Is],NQ=[Ui,Ui,Ui,Ui,Is,Is,Is,Is],IQ=[Dd,$a,E0,Ui,nh,Is,nh,Is],RQ=[$a,$a,Ui,Ui,Is,Is,Is,Is],jQ=[m1,m1,$a,$a,Ui,Ui,Is,Is],LQ=[Q5,m1,Dd,$a,Dd,$a,Dd,$a],jt={DISPLAY:Oo[Q5],TEXT:Oo[Dd],SCRIPT:Oo[E0],SCRIPTSCRIPT:Oo[nh]},Tw=[{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 DQ(e){for(var t=0;t<Tw.length;t++)for(var n=Tw[t],r=0;r<n.blocks.length;r++){var s=n.blocks[r];if(e>=s[0]&&e<=s[1])return n.name}return null}var ug=[];Tw.forEach(e=>e.blocks.forEach(t=>ug.push(...t)));function UI(e){for(var t=0;t<ug.length;t+=2)if(e>=ug[t]&&e<=ug[t+1])return!0;return!1}var Ir=e=>e+" "+e,ed=80,OQ=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"},BQ=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"},$Q=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"},zQ=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"},PQ=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"},qQ=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},FQ=function(t,n,r){var s=r-54-n-t;return"M702 "+(t+n)+"H400000"+(40+t)+`
H742v`+s+`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"},UQ=function(t,n,r){n=1e3*n;var s="";switch(t){case"sqrtMain":s=OQ(n,ed);break;case"sqrtSize1":s=BQ(n,ed);break;case"sqrtSize2":s=$Q(n,ed);break;case"sqrtSize3":s=zQ(n,ed);break;case"sqrtSize4":s=PQ(n,ed);break;case"sqrtTall":s=FQ(n,ed,r)}return s},HQ=function(t,n){switch(t){case"⎜":return Ir("M291 0 H417 V"+n+" H291z");case"∣":return Ir("M145 0 H188 V"+n+" H145z");case"∥":return Ir("M145 0 H188 V"+n+" H145z")+Ir("M367 0 H410 V"+n+" H367z");case"⎟":return Ir("M457 0 H583 V"+n+" H457z");case"⎢":return Ir("M319 0 H403 V"+n+" H319z");case"⎥":return Ir("M263 0 H347 V"+n+" H263z");case"⎪":return Ir("M384 0 H504 V"+n+" H384z");case"⏐":return Ir("M312 0 H355 V"+n+" H312z");case"‖":return Ir("M257 0 H300 V"+n+" H257z")+Ir("M478 0 H521 V"+n+" H478z");default:return""}},GS={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:Ir("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Ir("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Ir("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Ir("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:Ir("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:Ir("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Ir("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Ir("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`},VQ=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 WQ(e){return"toText"in e}class Ah{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(WQ(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var Cw={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},GQ={ex:!0,em:!0,mu:!0},HI=function(t){return typeof t!="string"&&(t=t.unit),t in Cw||t in GQ||t==="ex"},ir=function(t,n){var r;if(t.unit in Cw)r=Cw[t.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(t.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,t.unit==="ex")r=s.fontMetrics().xHeight;else if(t.unit==="em")r=s.fontMetrics().quad;else throw new Ie("Invalid unit: '"+t.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},$e=function(t){return+t.toFixed(4)+"em"},sc=function(t){return t.filter(n=>n).join(" ")},J5=function(t){var n="";for(var r of Object.keys(t)){var s=t[r];s!==void 0&&(n+=vQ(r)+":"+s+";")}return n},VI=function(t,n,r){if(this.classes=t||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},WI=function(t){var n=document.createElement(t);n.className=sc(this.classes),Object.assign(n.style,this.style);for(var r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n},KQ=/[\s"'>/=\x00-\x1f]/,GI=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+ps(sc(this.classes))+'"');var r=J5(this.style);r&&(n+=' style="'+ps(r)+'"');for(var s of Object.keys(this.attributes)){if(KQ.test(s))throw new Ie("Invalid attribute name '"+s+"'");n+=" "+s+'="'+ps(this.attributes[s])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class Eh{constructor(t,n,r,s){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,VI.call(this,t,r,s),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return WI.call(this,"span")}toMarkup(){return GI.call(this,"span")}}class Ry{constructor(t,n,r,s){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,VI.call(this,n,s),this.children=r||[],this.setAttribute("href",t)}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return WI.call(this,"a")}toMarkup(){return GI.call(this,"a")}}class YQ{constructor(t,n,r){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=r}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="'+ps(this.src)+'"'+(' alt="'+ps(this.alt)+'"'),n=J5(this.style);return n&&(t+=' style="'+ps(n)+'"'),t+="'/>",t}}var XQ={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class _i{constructor(t,n,r,s,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=r||0,this.italic=s||0,this.skew=i||0,this.width=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=DQ(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=XQ[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=$e(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=sc(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+=ps(sc(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+$e(this.italic)+";"),r+=J5(this.style),r&&(t=!0,n+=' style="'+ps(r)+'"');var s=ps(this.text);return t?(n+=">",n+=s,n+="</span>",n):s}}class Ga{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 r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n}toMarkup(){var t='<svg xmlns="http://www.w3.org/2000/svg"';for(var n of Object.keys(this.attributes))t+=" "+n+'="'+ps(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class ic{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",GS[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+ps(this.alternate)+'"/>':'<path d="'+ps(GS[this.pathName])+'"/>'}}class Aw{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 r of Object.keys(this.attributes))n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var t="<line";for(var n of Object.keys(this.attributes))t+=" "+n+'="'+ps(this.attributes[n])+'"';return t+="/>",t}}function QQ(e){if(e instanceof _i)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function JQ(e){if(e instanceof Eh)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var ZQ=e=>e instanceof Eh||e instanceof Ry||e instanceof Ah,Uo={"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]}},sp={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]},KS={Å:"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 KI(e,t){Uo[e]=t}function Z5(e,t,n){if(!Uo[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),s=Uo[t][r];if(!s&&e[0]in KS&&(r=KS[e[0]].charCodeAt(0),s=Uo[t][r]),!s&&n==="text"&&UI(r)&&(s=Uo[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var U2={};function eJ(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!U2[t]){var n=U2[t]={cssEmPerMu:sp.quad[t]/18};for(var r in sp)sp.hasOwnProperty(r)&&(n[r]=sp[r][t])}return U2[t]}var Jn={math:{},text:{}};function _(e,t,n,r,s,i){Jn[e][s]={font:t,group:n,replace:r},i&&r&&(Jn[e][r]=Jn[e][s])}var S="math",ve="text",N="main",G="ams",Zn="accent-token",tt="bin",Ds="close",Mh="inner",St="mathord",Mr="op-token",ki="open",hm="punct",Y="rel",Za="spacing",ee="textord";_(S,N,Y,"≡","\\equiv",!0);_(S,N,Y,"≺","\\prec",!0);_(S,N,Y,"≻","\\succ",!0);_(S,N,Y,"∼","\\sim",!0);_(S,N,Y,"⊥","\\perp");_(S,N,Y,"⪯","\\preceq",!0);_(S,N,Y,"⪰","\\succeq",!0);_(S,N,Y,"≃","\\simeq",!0);_(S,N,Y,"∣","\\mid",!0);_(S,N,Y,"≪","\\ll",!0);_(S,N,Y,"≫","\\gg",!0);_(S,N,Y,"≍","\\asymp",!0);_(S,N,Y,"∥","\\parallel");_(S,N,Y,"⋈","\\bowtie",!0);_(S,N,Y,"⌣","\\smile",!0);_(S,N,Y,"⊑","\\sqsubseteq",!0);_(S,N,Y,"⊒","\\sqsupseteq",!0);_(S,N,Y,"≐","\\doteq",!0);_(S,N,Y,"⌢","\\frown",!0);_(S,N,Y,"∋","\\ni",!0);_(S,N,Y,"∝","\\propto",!0);_(S,N,Y,"⊢","\\vdash",!0);_(S,N,Y,"⊣","\\dashv",!0);_(S,N,Y,"∋","\\owns");_(S,N,hm,".","\\ldotp");_(S,N,hm,"⋅","\\cdotp");_(S,N,hm,"⋅","·");_(ve,N,ee,"⋅","·");_(S,N,ee,"#","\\#");_(ve,N,ee,"#","\\#");_(S,N,ee,"&","\\&");_(ve,N,ee,"&","\\&");_(S,N,ee,"ℵ","\\aleph",!0);_(S,N,ee,"∀","\\forall",!0);_(S,N,ee,"ℏ","\\hbar",!0);_(S,N,ee,"∃","\\exists",!0);_(S,N,ee,"∇","\\nabla",!0);_(S,N,ee,"♭","\\flat",!0);_(S,N,ee,"ℓ","\\ell",!0);_(S,N,ee,"♮","\\natural",!0);_(S,N,ee,"♣","\\clubsuit",!0);_(S,N,ee,"℘","\\wp",!0);_(S,N,ee,"♯","\\sharp",!0);_(S,N,ee,"♢","\\diamondsuit",!0);_(S,N,ee,"ℜ","\\Re",!0);_(S,N,ee,"♡","\\heartsuit",!0);_(S,N,ee,"ℑ","\\Im",!0);_(S,N,ee,"♠","\\spadesuit",!0);_(S,N,ee,"§","\\S",!0);_(ve,N,ee,"§","\\S");_(S,N,ee,"¶","\\P",!0);_(ve,N,ee,"¶","\\P");_(S,N,ee,"†","\\dag");_(ve,N,ee,"†","\\dag");_(ve,N,ee,"†","\\textdagger");_(S,N,ee,"‡","\\ddag");_(ve,N,ee,"‡","\\ddag");_(ve,N,ee,"‡","\\textdaggerdbl");_(S,N,Ds,"⎱","\\rmoustache",!0);_(S,N,ki,"⎰","\\lmoustache",!0);_(S,N,Ds,"⟯","\\rgroup",!0);_(S,N,ki,"⟮","\\lgroup",!0);_(S,N,tt,"∓","\\mp",!0);_(S,N,tt,"⊖","\\ominus",!0);_(S,N,tt,"⊎","\\uplus",!0);_(S,N,tt,"⊓","\\sqcap",!0);_(S,N,tt,"∗","\\ast");_(S,N,tt,"⊔","\\sqcup",!0);_(S,N,tt,"◯","\\bigcirc",!0);_(S,N,tt,"∙","\\bullet",!0);_(S,N,tt,"‡","\\ddagger");_(S,N,tt,"≀","\\wr",!0);_(S,N,tt,"⨿","\\amalg");_(S,N,tt,"&","\\And");_(S,N,Y,"⟵","\\longleftarrow",!0);_(S,N,Y,"⇐","\\Leftarrow",!0);_(S,N,Y,"⟸","\\Longleftarrow",!0);_(S,N,Y,"⟶","\\longrightarrow",!0);_(S,N,Y,"⇒","\\Rightarrow",!0);_(S,N,Y,"⟹","\\Longrightarrow",!0);_(S,N,Y,"↔","\\leftrightarrow",!0);_(S,N,Y,"⟷","\\longleftrightarrow",!0);_(S,N,Y,"⇔","\\Leftrightarrow",!0);_(S,N,Y,"⟺","\\Longleftrightarrow",!0);_(S,N,Y,"↦","\\mapsto",!0);_(S,N,Y,"⟼","\\longmapsto",!0);_(S,N,Y,"↗","\\nearrow",!0);_(S,N,Y,"↩","\\hookleftarrow",!0);_(S,N,Y,"↪","\\hookrightarrow",!0);_(S,N,Y,"↘","\\searrow",!0);_(S,N,Y,"↼","\\leftharpoonup",!0);_(S,N,Y,"⇀","\\rightharpoonup",!0);_(S,N,Y,"↙","\\swarrow",!0);_(S,N,Y,"↽","\\leftharpoondown",!0);_(S,N,Y,"⇁","\\rightharpoondown",!0);_(S,N,Y,"↖","\\nwarrow",!0);_(S,N,Y,"⇌","\\rightleftharpoons",!0);_(S,G,Y,"≮","\\nless",!0);_(S,G,Y,"","\\@nleqslant");_(S,G,Y,"","\\@nleqq");_(S,G,Y,"⪇","\\lneq",!0);_(S,G,Y,"≨","\\lneqq",!0);_(S,G,Y,"","\\@lvertneqq");_(S,G,Y,"⋦","\\lnsim",!0);_(S,G,Y,"⪉","\\lnapprox",!0);_(S,G,Y,"⊀","\\nprec",!0);_(S,G,Y,"⋠","\\npreceq",!0);_(S,G,Y,"⋨","\\precnsim",!0);_(S,G,Y,"⪹","\\precnapprox",!0);_(S,G,Y,"≁","\\nsim",!0);_(S,G,Y,"","\\@nshortmid");_(S,G,Y,"∤","\\nmid",!0);_(S,G,Y,"⊬","\\nvdash",!0);_(S,G,Y,"⊭","\\nvDash",!0);_(S,G,Y,"⋪","\\ntriangleleft");_(S,G,Y,"⋬","\\ntrianglelefteq",!0);_(S,G,Y,"⊊","\\subsetneq",!0);_(S,G,Y,"","\\@varsubsetneq");_(S,G,Y,"⫋","\\subsetneqq",!0);_(S,G,Y,"","\\@varsubsetneqq");_(S,G,Y,"≯","\\ngtr",!0);_(S,G,Y,"","\\@ngeqslant");_(S,G,Y,"","\\@ngeqq");_(S,G,Y,"⪈","\\gneq",!0);_(S,G,Y,"≩","\\gneqq",!0);_(S,G,Y,"","\\@gvertneqq");_(S,G,Y,"⋧","\\gnsim",!0);_(S,G,Y,"⪊","\\gnapprox",!0);_(S,G,Y,"⊁","\\nsucc",!0);_(S,G,Y,"⋡","\\nsucceq",!0);_(S,G,Y,"⋩","\\succnsim",!0);_(S,G,Y,"⪺","\\succnapprox",!0);_(S,G,Y,"≆","\\ncong",!0);_(S,G,Y,"","\\@nshortparallel");_(S,G,Y,"∦","\\nparallel",!0);_(S,G,Y,"⊯","\\nVDash",!0);_(S,G,Y,"⋫","\\ntriangleright");_(S,G,Y,"⋭","\\ntrianglerighteq",!0);_(S,G,Y,"","\\@nsupseteqq");_(S,G,Y,"⊋","\\supsetneq",!0);_(S,G,Y,"","\\@varsupsetneq");_(S,G,Y,"⫌","\\supsetneqq",!0);_(S,G,Y,"","\\@varsupsetneqq");_(S,G,Y,"⊮","\\nVdash",!0);_(S,G,Y,"⪵","\\precneqq",!0);_(S,G,Y,"⪶","\\succneqq",!0);_(S,G,Y,"","\\@nsubseteqq");_(S,G,tt,"⊴","\\unlhd");_(S,G,tt,"⊵","\\unrhd");_(S,G,Y,"↚","\\nleftarrow",!0);_(S,G,Y,"↛","\\nrightarrow",!0);_(S,G,Y,"⇍","\\nLeftarrow",!0);_(S,G,Y,"⇏","\\nRightarrow",!0);_(S,G,Y,"↮","\\nleftrightarrow",!0);_(S,G,Y,"⇎","\\nLeftrightarrow",!0);_(S,G,Y,"△","\\vartriangle");_(S,G,ee,"ℏ","\\hslash");_(S,G,ee,"▽","\\triangledown");_(S,G,ee,"◊","\\lozenge");_(S,G,ee,"Ⓢ","\\circledS");_(S,G,ee,"®","\\circledR");_(ve,G,ee,"®","\\circledR");_(S,G,ee,"∡","\\measuredangle",!0);_(S,G,ee,"∄","\\nexists");_(S,G,ee,"℧","\\mho");_(S,G,ee,"Ⅎ","\\Finv",!0);_(S,G,ee,"⅁","\\Game",!0);_(S,G,ee,"‵","\\backprime");_(S,G,ee,"▲","\\blacktriangle");_(S,G,ee,"▼","\\blacktriangledown");_(S,G,ee,"■","\\blacksquare");_(S,G,ee,"⧫","\\blacklozenge");_(S,G,ee,"★","\\bigstar");_(S,G,ee,"∢","\\sphericalangle",!0);_(S,G,ee,"∁","\\complement",!0);_(S,G,ee,"ð","\\eth",!0);_(ve,N,ee,"ð","ð");_(S,G,ee,"╱","\\diagup");_(S,G,ee,"╲","\\diagdown");_(S,G,ee,"□","\\square");_(S,G,ee,"□","\\Box");_(S,G,ee,"◊","\\Diamond");_(S,G,ee,"¥","\\yen",!0);_(ve,G,ee,"¥","\\yen",!0);_(S,G,ee,"✓","\\checkmark",!0);_(ve,G,ee,"✓","\\checkmark");_(S,G,ee,"ℶ","\\beth",!0);_(S,G,ee,"ℸ","\\daleth",!0);_(S,G,ee,"ℷ","\\gimel",!0);_(S,G,ee,"ϝ","\\digamma",!0);_(S,G,ee,"ϰ","\\varkappa");_(S,G,ki,"┌","\\@ulcorner",!0);_(S,G,Ds,"┐","\\@urcorner",!0);_(S,G,ki,"└","\\@llcorner",!0);_(S,G,Ds,"┘","\\@lrcorner",!0);_(S,G,Y,"≦","\\leqq",!0);_(S,G,Y,"⩽","\\leqslant",!0);_(S,G,Y,"⪕","\\eqslantless",!0);_(S,G,Y,"≲","\\lesssim",!0);_(S,G,Y,"⪅","\\lessapprox",!0);_(S,G,Y,"≊","\\approxeq",!0);_(S,G,tt,"⋖","\\lessdot");_(S,G,Y,"⋘","\\lll",!0);_(S,G,Y,"≶","\\lessgtr",!0);_(S,G,Y,"⋚","\\lesseqgtr",!0);_(S,G,Y,"⪋","\\lesseqqgtr",!0);_(S,G,Y,"≑","\\doteqdot");_(S,G,Y,"≓","\\risingdotseq",!0);_(S,G,Y,"≒","\\fallingdotseq",!0);_(S,G,Y,"∽","\\backsim",!0);_(S,G,Y,"⋍","\\backsimeq",!0);_(S,G,Y,"⫅","\\subseteqq",!0);_(S,G,Y,"⋐","\\Subset",!0);_(S,G,Y,"⊏","\\sqsubset",!0);_(S,G,Y,"≼","\\preccurlyeq",!0);_(S,G,Y,"⋞","\\curlyeqprec",!0);_(S,G,Y,"≾","\\precsim",!0);_(S,G,Y,"⪷","\\precapprox",!0);_(S,G,Y,"⊲","\\vartriangleleft");_(S,G,Y,"⊴","\\trianglelefteq");_(S,G,Y,"⊨","\\vDash",!0);_(S,G,Y,"⊪","\\Vvdash",!0);_(S,G,Y,"⌣","\\smallsmile");_(S,G,Y,"⌢","\\smallfrown");_(S,G,Y,"≏","\\bumpeq",!0);_(S,G,Y,"≎","\\Bumpeq",!0);_(S,G,Y,"≧","\\geqq",!0);_(S,G,Y,"⩾","\\geqslant",!0);_(S,G,Y,"⪖","\\eqslantgtr",!0);_(S,G,Y,"≳","\\gtrsim",!0);_(S,G,Y,"⪆","\\gtrapprox",!0);_(S,G,tt,"⋗","\\gtrdot");_(S,G,Y,"⋙","\\ggg",!0);_(S,G,Y,"≷","\\gtrless",!0);_(S,G,Y,"⋛","\\gtreqless",!0);_(S,G,Y,"⪌","\\gtreqqless",!0);_(S,G,Y,"≖","\\eqcirc",!0);_(S,G,Y,"≗","\\circeq",!0);_(S,G,Y,"≜","\\triangleq",!0);_(S,G,Y,"∼","\\thicksim");_(S,G,Y,"≈","\\thickapprox");_(S,G,Y,"⫆","\\supseteqq",!0);_(S,G,Y,"⋑","\\Supset",!0);_(S,G,Y,"⊐","\\sqsupset",!0);_(S,G,Y,"≽","\\succcurlyeq",!0);_(S,G,Y,"⋟","\\curlyeqsucc",!0);_(S,G,Y,"≿","\\succsim",!0);_(S,G,Y,"⪸","\\succapprox",!0);_(S,G,Y,"⊳","\\vartriangleright");_(S,G,Y,"⊵","\\trianglerighteq");_(S,G,Y,"⊩","\\Vdash",!0);_(S,G,Y,"∣","\\shortmid");_(S,G,Y,"∥","\\shortparallel");_(S,G,Y,"≬","\\between",!0);_(S,G,Y,"⋔","\\pitchfork",!0);_(S,G,Y,"∝","\\varpropto");_(S,G,Y,"◀","\\blacktriangleleft");_(S,G,Y,"∴","\\therefore",!0);_(S,G,Y,"∍","\\backepsilon");_(S,G,Y,"▶","\\blacktriangleright");_(S,G,Y,"∵","\\because",!0);_(S,G,Y,"⋘","\\llless");_(S,G,Y,"⋙","\\gggtr");_(S,G,tt,"⊲","\\lhd");_(S,G,tt,"⊳","\\rhd");_(S,G,Y,"≂","\\eqsim",!0);_(S,N,Y,"⋈","\\Join");_(S,G,Y,"≑","\\Doteq",!0);_(S,G,tt,"∔","\\dotplus",!0);_(S,G,tt,"∖","\\smallsetminus");_(S,G,tt,"⋒","\\Cap",!0);_(S,G,tt,"⋓","\\Cup",!0);_(S,G,tt,"⩞","\\doublebarwedge",!0);_(S,G,tt,"⊟","\\boxminus",!0);_(S,G,tt,"⊞","\\boxplus",!0);_(S,G,tt,"⋇","\\divideontimes",!0);_(S,G,tt,"⋉","\\ltimes",!0);_(S,G,tt,"⋊","\\rtimes",!0);_(S,G,tt,"⋋","\\leftthreetimes",!0);_(S,G,tt,"⋌","\\rightthreetimes",!0);_(S,G,tt,"⋏","\\curlywedge",!0);_(S,G,tt,"⋎","\\curlyvee",!0);_(S,G,tt,"⊝","\\circleddash",!0);_(S,G,tt,"⊛","\\circledast",!0);_(S,G,tt,"⋅","\\centerdot");_(S,G,tt,"⊺","\\intercal",!0);_(S,G,tt,"⋒","\\doublecap");_(S,G,tt,"⋓","\\doublecup");_(S,G,tt,"⊠","\\boxtimes",!0);_(S,G,Y,"⇢","\\dashrightarrow",!0);_(S,G,Y,"⇠","\\dashleftarrow",!0);_(S,G,Y,"⇇","\\leftleftarrows",!0);_(S,G,Y,"⇆","\\leftrightarrows",!0);_(S,G,Y,"⇚","\\Lleftarrow",!0);_(S,G,Y,"↞","\\twoheadleftarrow",!0);_(S,G,Y,"↢","\\leftarrowtail",!0);_(S,G,Y,"↫","\\looparrowleft",!0);_(S,G,Y,"⇋","\\leftrightharpoons",!0);_(S,G,Y,"↶","\\curvearrowleft",!0);_(S,G,Y,"↺","\\circlearrowleft",!0);_(S,G,Y,"↰","\\Lsh",!0);_(S,G,Y,"⇈","\\upuparrows",!0);_(S,G,Y,"↿","\\upharpoonleft",!0);_(S,G,Y,"⇃","\\downharpoonleft",!0);_(S,N,Y,"⊶","\\origof",!0);_(S,N,Y,"⊷","\\imageof",!0);_(S,G,Y,"⊸","\\multimap",!0);_(S,G,Y,"↭","\\leftrightsquigarrow",!0);_(S,G,Y,"⇉","\\rightrightarrows",!0);_(S,G,Y,"⇄","\\rightleftarrows",!0);_(S,G,Y,"↠","\\twoheadrightarrow",!0);_(S,G,Y,"↣","\\rightarrowtail",!0);_(S,G,Y,"↬","\\looparrowright",!0);_(S,G,Y,"↷","\\curvearrowright",!0);_(S,G,Y,"↻","\\circlearrowright",!0);_(S,G,Y,"↱","\\Rsh",!0);_(S,G,Y,"⇊","\\downdownarrows",!0);_(S,G,Y,"↾","\\upharpoonright",!0);_(S,G,Y,"⇂","\\downharpoonright",!0);_(S,G,Y,"⇝","\\rightsquigarrow",!0);_(S,G,Y,"⇝","\\leadsto");_(S,G,Y,"⇛","\\Rrightarrow",!0);_(S,G,Y,"↾","\\restriction");_(S,N,ee,"‘","`");_(S,N,ee,"$","\\$");_(ve,N,ee,"$","\\$");_(ve,N,ee,"$","\\textdollar");_(S,N,ee,"%","\\%");_(ve,N,ee,"%","\\%");_(S,N,ee,"_","\\_");_(ve,N,ee,"_","\\_");_(ve,N,ee,"_","\\textunderscore");_(S,N,ee,"∠","\\angle",!0);_(S,N,ee,"∞","\\infty",!0);_(S,N,ee,"′","\\prime");_(S,N,ee,"△","\\triangle");_(S,N,ee,"Γ","\\Gamma",!0);_(S,N,ee,"Δ","\\Delta",!0);_(S,N,ee,"Θ","\\Theta",!0);_(S,N,ee,"Λ","\\Lambda",!0);_(S,N,ee,"Ξ","\\Xi",!0);_(S,N,ee,"Π","\\Pi",!0);_(S,N,ee,"Σ","\\Sigma",!0);_(S,N,ee,"Υ","\\Upsilon",!0);_(S,N,ee,"Φ","\\Phi",!0);_(S,N,ee,"Ψ","\\Psi",!0);_(S,N,ee,"Ω","\\Omega",!0);_(S,N,ee,"A","Α");_(S,N,ee,"B","Β");_(S,N,ee,"E","Ε");_(S,N,ee,"Z","Ζ");_(S,N,ee,"H","Η");_(S,N,ee,"I","Ι");_(S,N,ee,"K","Κ");_(S,N,ee,"M","Μ");_(S,N,ee,"N","Ν");_(S,N,ee,"O","Ο");_(S,N,ee,"P","Ρ");_(S,N,ee,"T","Τ");_(S,N,ee,"X","Χ");_(S,N,ee,"¬","\\neg",!0);_(S,N,ee,"¬","\\lnot");_(S,N,ee,"⊤","\\top");_(S,N,ee,"⊥","\\bot");_(S,N,ee,"∅","\\emptyset");_(S,G,ee,"∅","\\varnothing");_(S,N,St,"α","\\alpha",!0);_(S,N,St,"β","\\beta",!0);_(S,N,St,"γ","\\gamma",!0);_(S,N,St,"δ","\\delta",!0);_(S,N,St,"ϵ","\\epsilon",!0);_(S,N,St,"ζ","\\zeta",!0);_(S,N,St,"η","\\eta",!0);_(S,N,St,"θ","\\theta",!0);_(S,N,St,"ι","\\iota",!0);_(S,N,St,"κ","\\kappa",!0);_(S,N,St,"λ","\\lambda",!0);_(S,N,St,"μ","\\mu",!0);_(S,N,St,"ν","\\nu",!0);_(S,N,St,"ξ","\\xi",!0);_(S,N,St,"ο","\\omicron",!0);_(S,N,St,"π","\\pi",!0);_(S,N,St,"ρ","\\rho",!0);_(S,N,St,"σ","\\sigma",!0);_(S,N,St,"τ","\\tau",!0);_(S,N,St,"υ","\\upsilon",!0);_(S,N,St,"ϕ","\\phi",!0);_(S,N,St,"χ","\\chi",!0);_(S,N,St,"ψ","\\psi",!0);_(S,N,St,"ω","\\omega",!0);_(S,N,St,"ε","\\varepsilon",!0);_(S,N,St,"ϑ","\\vartheta",!0);_(S,N,St,"ϖ","\\varpi",!0);_(S,N,St,"ϱ","\\varrho",!0);_(S,N,St,"ς","\\varsigma",!0);_(S,N,St,"φ","\\varphi",!0);_(S,N,tt,"∗","*",!0);_(S,N,tt,"+","+");_(S,N,tt,"−","-",!0);_(S,N,tt,"⋅","\\cdot",!0);_(S,N,tt,"∘","\\circ",!0);_(S,N,tt,"÷","\\div",!0);_(S,N,tt,"±","\\pm",!0);_(S,N,tt,"×","\\times",!0);_(S,N,tt,"∩","\\cap",!0);_(S,N,tt,"∪","\\cup",!0);_(S,N,tt,"∖","\\setminus",!0);_(S,N,tt,"∧","\\land");_(S,N,tt,"∨","\\lor");_(S,N,tt,"∧","\\wedge",!0);_(S,N,tt,"∨","\\vee",!0);_(S,N,ee,"√","\\surd");_(S,N,ki,"⟨","\\langle",!0);_(S,N,ki,"∣","\\lvert");_(S,N,ki,"∥","\\lVert");_(S,N,Ds,"?","?");_(S,N,Ds,"!","!");_(S,N,Ds,"⟩","\\rangle",!0);_(S,N,Ds,"∣","\\rvert");_(S,N,Ds,"∥","\\rVert");_(S,N,Y,"=","=");_(S,N,Y,":",":");_(S,N,Y,"≈","\\approx",!0);_(S,N,Y,"≅","\\cong",!0);_(S,N,Y,"≥","\\ge");_(S,N,Y,"≥","\\geq",!0);_(S,N,Y,"←","\\gets");_(S,N,Y,">","\\gt",!0);_(S,N,Y,"∈","\\in",!0);_(S,N,Y,"","\\@not");_(S,N,Y,"⊂","\\subset",!0);_(S,N,Y,"⊃","\\supset",!0);_(S,N,Y,"⊆","\\subseteq",!0);_(S,N,Y,"⊇","\\supseteq",!0);_(S,G,Y,"⊈","\\nsubseteq",!0);_(S,G,Y,"⊉","\\nsupseteq",!0);_(S,N,Y,"⊨","\\models");_(S,N,Y,"←","\\leftarrow",!0);_(S,N,Y,"≤","\\le");_(S,N,Y,"≤","\\leq",!0);_(S,N,Y,"<","\\lt",!0);_(S,N,Y,"→","\\rightarrow",!0);_(S,N,Y,"→","\\to");_(S,G,Y,"≱","\\ngeq",!0);_(S,G,Y,"≰","\\nleq",!0);_(S,N,Za," ","\\ ");_(S,N,Za," ","\\space");_(S,N,Za," ","\\nobreakspace");_(ve,N,Za," ","\\ ");_(ve,N,Za," "," ");_(ve,N,Za," ","\\space");_(ve,N,Za," ","\\nobreakspace");_(S,N,Za,"","\\nobreak");_(S,N,Za,"","\\allowbreak");_(S,N,hm,",",",");_(S,N,hm,";",";");_(S,G,tt,"⊼","\\barwedge",!0);_(S,G,tt,"⊻","\\veebar",!0);_(S,N,tt,"⊙","\\odot",!0);_(S,N,tt,"⊕","\\oplus",!0);_(S,N,tt,"⊗","\\otimes",!0);_(S,N,ee,"∂","\\partial",!0);_(S,N,tt,"⊘","\\oslash",!0);_(S,G,tt,"⊚","\\circledcirc",!0);_(S,G,tt,"⊡","\\boxdot",!0);_(S,N,tt,"△","\\bigtriangleup");_(S,N,tt,"▽","\\bigtriangledown");_(S,N,tt,"†","\\dagger");_(S,N,tt,"⋄","\\diamond");_(S,N,tt,"⋆","\\star");_(S,N,tt,"◃","\\triangleleft");_(S,N,tt,"▹","\\triangleright");_(S,N,ki,"{","\\{");_(ve,N,ee,"{","\\{");_(ve,N,ee,"{","\\textbraceleft");_(S,N,Ds,"}","\\}");_(ve,N,ee,"}","\\}");_(ve,N,ee,"}","\\textbraceright");_(S,N,ki,"{","\\lbrace");_(S,N,Ds,"}","\\rbrace");_(S,N,ki,"[","\\lbrack",!0);_(ve,N,ee,"[","\\lbrack",!0);_(S,N,Ds,"]","\\rbrack",!0);_(ve,N,ee,"]","\\rbrack",!0);_(S,N,ki,"(","\\lparen",!0);_(S,N,Ds,")","\\rparen",!0);_(ve,N,ee,"<","\\textless",!0);_(ve,N,ee,">","\\textgreater",!0);_(S,N,ki,"⌊","\\lfloor",!0);_(S,N,Ds,"⌋","\\rfloor",!0);_(S,N,ki,"⌈","\\lceil",!0);_(S,N,Ds,"⌉","\\rceil",!0);_(S,N,ee,"\\","\\backslash");_(S,N,ee,"∣","|");_(S,N,ee,"∣","\\vert");_(ve,N,ee,"|","\\textbar",!0);_(S,N,ee,"∥","\\|");_(S,N,ee,"∥","\\Vert");_(ve,N,ee,"∥","\\textbardbl");_(ve,N,ee,"~","\\textasciitilde");_(ve,N,ee,"\\","\\textbackslash");_(ve,N,ee,"^","\\textasciicircum");_(S,N,Y,"↑","\\uparrow",!0);_(S,N,Y,"⇑","\\Uparrow",!0);_(S,N,Y,"↓","\\downarrow",!0);_(S,N,Y,"⇓","\\Downarrow",!0);_(S,N,Y,"↕","\\updownarrow",!0);_(S,N,Y,"⇕","\\Updownarrow",!0);_(S,N,Mr,"∐","\\coprod");_(S,N,Mr,"⋁","\\bigvee");_(S,N,Mr,"⋀","\\bigwedge");_(S,N,Mr,"⨄","\\biguplus");_(S,N,Mr,"⋂","\\bigcap");_(S,N,Mr,"⋃","\\bigcup");_(S,N,Mr,"∫","\\int");_(S,N,Mr,"∫","\\intop");_(S,N,Mr,"∬","\\iint");_(S,N,Mr,"∭","\\iiint");_(S,N,Mr,"∏","\\prod");_(S,N,Mr,"∑","\\sum");_(S,N,Mr,"⨂","\\bigotimes");_(S,N,Mr,"⨁","\\bigoplus");_(S,N,Mr,"⨀","\\bigodot");_(S,N,Mr,"∮","\\oint");_(S,N,Mr,"∯","\\oiint");_(S,N,Mr,"∰","\\oiiint");_(S,N,Mr,"⨆","\\bigsqcup");_(S,N,Mr,"∫","\\smallint");_(ve,N,Mh,"…","\\textellipsis");_(S,N,Mh,"…","\\mathellipsis");_(ve,N,Mh,"…","\\ldots",!0);_(S,N,Mh,"…","\\ldots",!0);_(S,N,Mh,"⋯","\\@cdots",!0);_(S,N,Mh,"⋱","\\ddots",!0);_(S,N,ee,"⋮","\\varvdots");_(ve,N,ee,"⋮","\\varvdots");_(S,N,Zn,"ˊ","\\acute");_(S,N,Zn,"ˋ","\\grave");_(S,N,Zn,"¨","\\ddot");_(S,N,Zn,"~","\\tilde");_(S,N,Zn,"ˉ","\\bar");_(S,N,Zn,"˘","\\breve");_(S,N,Zn,"ˇ","\\check");_(S,N,Zn,"^","\\hat");_(S,N,Zn,"⃗","\\vec");_(S,N,Zn,"˙","\\dot");_(S,N,Zn,"˚","\\mathring");_(S,N,St,"","\\@imath");_(S,N,St,"","\\@jmath");_(S,N,ee,"ı","ı");_(S,N,ee,"ȷ","ȷ");_(ve,N,ee,"ı","\\i",!0);_(ve,N,ee,"ȷ","\\j",!0);_(ve,N,ee,"ß","\\ss",!0);_(ve,N,ee,"æ","\\ae",!0);_(ve,N,ee,"œ","\\oe",!0);_(ve,N,ee,"ø","\\o",!0);_(ve,N,ee,"Æ","\\AE",!0);_(ve,N,ee,"Œ","\\OE",!0);_(ve,N,ee,"Ø","\\O",!0);_(ve,N,Zn,"ˊ","\\'");_(ve,N,Zn,"ˋ","\\`");_(ve,N,Zn,"ˆ","\\^");_(ve,N,Zn,"˜","\\~");_(ve,N,Zn,"ˉ","\\=");_(ve,N,Zn,"˘","\\u");_(ve,N,Zn,"˙","\\.");_(ve,N,Zn,"¸","\\c");_(ve,N,Zn,"˚","\\r");_(ve,N,Zn,"ˇ","\\v");_(ve,N,Zn,"¨",'\\"');_(ve,N,Zn,"˝","\\H");_(ve,N,Zn,"◯","\\textcircled");var YI={"--":!0,"---":!0,"``":!0,"''":!0};_(ve,N,ee,"–","--",!0);_(ve,N,ee,"–","\\textendash");_(ve,N,ee,"—","---",!0);_(ve,N,ee,"—","\\textemdash");_(ve,N,ee,"‘","`",!0);_(ve,N,ee,"‘","\\textquoteleft");_(ve,N,ee,"’","'",!0);_(ve,N,ee,"’","\\textquoteright");_(ve,N,ee,"“","``",!0);_(ve,N,ee,"“","\\textquotedblleft");_(ve,N,ee,"”","''",!0);_(ve,N,ee,"”","\\textquotedblright");_(S,N,ee,"°","\\degree",!0);_(ve,N,ee,"°","\\degree");_(ve,N,ee,"°","\\textdegree",!0);_(S,N,ee,"£","\\pounds");_(S,N,ee,"£","\\mathsterling",!0);_(ve,N,ee,"£","\\pounds");_(ve,N,ee,"£","\\textsterling",!0);_(S,G,ee,"✠","\\maltese");_(ve,G,ee,"✠","\\maltese");var YS='0123456789/@."';for(var H2=0;H2<YS.length;H2++){var XS=YS.charAt(H2);_(S,N,ee,XS,XS)}var QS='0123456789!@*()-=+";:?/.,';for(var V2=0;V2<QS.length;V2++){var JS=QS.charAt(V2);_(ve,N,ee,JS,JS)}var p1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var W2=0;W2<p1.length;W2++){var ip=p1.charAt(W2);_(S,N,St,ip,ip),_(ve,N,ee,ip,ip)}_(S,G,ee,"C","ℂ");_(ve,G,ee,"C","ℂ");_(S,G,ee,"H","ℍ");_(ve,G,ee,"H","ℍ");_(S,G,ee,"N","ℕ");_(ve,G,ee,"N","ℕ");_(S,G,ee,"P","ℙ");_(ve,G,ee,"P","ℙ");_(S,G,ee,"Q","ℚ");_(ve,G,ee,"Q","ℚ");_(S,G,ee,"R","ℝ");_(ve,G,ee,"R","ℝ");_(S,G,ee,"Z","ℤ");_(ve,G,ee,"Z","ℤ");_(S,N,St,"h","ℎ");_(ve,N,St,"h","ℎ");var Et;for(var _s=0;_s<p1.length;_s++){var lr=p1.charAt(_s);Et=String.fromCharCode(55349,56320+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56372+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56424+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56580+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56684+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56736+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56788+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56840+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56944+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),_s<26&&(Et=String.fromCharCode(55349,56632+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et),Et=String.fromCharCode(55349,56476+_s),_(S,N,St,lr,Et),_(ve,N,ee,lr,Et))}Et="𝕜";_(S,N,St,"k",Et);_(ve,N,ee,"k",Et);for(var Bc=0;Bc<10;Bc++){var pl=Bc.toString();Et=String.fromCharCode(55349,57294+Bc),_(S,N,St,pl,Et),_(ve,N,ee,pl,Et),Et=String.fromCharCode(55349,57314+Bc),_(S,N,St,pl,Et),_(ve,N,ee,pl,Et),Et=String.fromCharCode(55349,57324+Bc),_(S,N,St,pl,Et),_(ve,N,ee,pl,Et),Et=String.fromCharCode(55349,57334+Bc),_(S,N,St,pl,Et),_(ve,N,ee,pl,Et)}var Ew="ÐÞþ";for(var G2=0;G2<Ew.length;G2++){var op=Ew.charAt(G2);_(S,N,St,op,op),_(ve,N,ee,op,op)}var Mw={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},ZS={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},e7={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},tJ={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},Jc={mathClass:"",textClass:"",font:""},t7={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},n7={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},r7={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Nw={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Iw={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},s7={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Rw={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},i7=[Mw,Mw,ZS,ZS,e7,e7,tJ,Jc,Jc,Jc,t7,t7,n7,n7,r7,r7,Nw,Nw,Iw,Iw,s7,s7,Jc,Jc,Rw,Rw],nJ=[Mw,Jc,Nw,Iw,Rw],rJ=e=>{var t=e.charCodeAt(0),n=e.charCodeAt(1),r=(t-55296)*1024+(n-56320)+65536;if(119808<=r&&r<120484){var s=Math.floor((r-119808)/26);return i7[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return nJ[i]}else{if(r===120485||r===120486)return i7[0];if(120486<r&&r<120782)return Jc;throw new Ie("Unsupported character: "+e)}},jy=function(t,n,r){if(Jn[r][t]){var s=Jn[r][t].replace;s&&(t=s)}return{value:t,metrics:Z5(t,n,r)}},Ts=function(t,n,r,s,i){var o=jy(t,n,r),a=o.metrics;t=o.value;var l;if(a){var c=a.italic;(r==="text"||s&&s.font==="mathit")&&(c=0),l=new _i(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 '"+r+"'")),l=new _i(t,0,0,0,0,0,i);if(s){l.maxFontSize=s.sizeMultiplier,s.style.isTight()&&l.classes.push("mtight");var u=s.getColor();u&&(l.style.color=u)}return l},e_=function(t,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&jy(t,"Main-Bold",n).metrics?Ts(t,"Main-Bold",n,r,s.concat(["mathbf"])):t==="\\"||Jn[n][t].font==="main"?Ts(t,"Main-Regular",n,r,s):Ts(t,"AMS-Regular",n,r,s.concat(["amsrm"]))},sJ=function(t,n,r){return r!=="textord"&&jy(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},Ly=function(t,n,r){var s=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:l,fontWeight:c,fontShape:u}=n,d=s==="math"||s==="text"&&!!a,f=d?a:l,m="",p="";if(i.charCodeAt(0)===55349){var y=rJ(i);m=y.font,p=y[s+"Class"]}if(m)return Ts(i,m,s,n,o.concat(p));if(f){var v,b;if(f==="boldsymbol"){var x=sJ(i,s,r);v=x.fontName,b=[x.fontClass]}else d?(v=jw[a].fontName,b=[a]):(v=ap(l,c,u),b=[l,c,u]);if(jy(i,v,s).metrics)return Ts(i,v,s,n,o.concat(b));if(YI.hasOwnProperty(i)&&v.slice(0,10)==="Typewriter"){for(var w=[],k=0;k<i.length;k++)w.push(Ts(i[k],v,s,n,o.concat(b)));return el(w)}}if(r==="mathord")return Ts(i,"Math-Italic",s,n,o.concat(["mathnormal"]));if(r==="textord"){var T=Jn[s][i]&&Jn[s][i].font;if(T==="ams"){var C=ap("amsrm",c,u);return Ts(i,C,s,n,o.concat("amsrm",c,u))}else if(T==="main"||!T){var A=ap("textrm",c,u);return Ts(i,A,s,n,o.concat(c,u))}else{var L=ap(T,c,u);return Ts(i,L,s,n,o.concat(L,c,u))}}else throw new Error("unexpected type: "+r+" in makeOrd")},iJ=(e,t)=>{if(sc(e.classes)!==sc(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 r of Object.keys(e.style))if(e.style[r]!==t.style[r])return!1;for(var s of Object.keys(t.style))if(e.style[s]!==t.style[s])return!1;return!0},XI=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof _i&&r instanceof _i&&iJ(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,e.splice(t+1,1),t--)}return e},t_=function(t){for(var n=0,r=0,s=0,i=0;i<t.children.length;i++){var o=t.children[i];o.height>n&&(n=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>s&&(s=o.maxFontSize)}t.height=n,t.depth=r,t.maxFontSize=s},Ae=function(t,n,r,s){var i=new Eh(t,n,r,s);return t_(i),i},oc=(e,t,n,r)=>new Eh(e,t,n,r),rh=function(t,n,r){var s=Ae([t],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=$e(s.height),s.maxFontSize=1,s},oJ=function(t,n,r,s){var i=new Ry(t,n,r,s);return t_(i),i},el=function(t){var n=new Ah(t);return t_(n),n},sh=function(t,n){return t instanceof Ah?Ae([],[t],n):t},aJ=function(t){if(t.positionType==="individualShift"){for(var n=t.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,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,r.push({type:"kern",size:l}),r.push(n[o])}return{children:r,depth:s}}var c;if(t.positionType==="top"){for(var u=t.positionData,d=0;d<t.children.length;d++){var f=t.children[d];u-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=u}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}},bn=function(t,n){for(var{children:r,depth:s}=aJ(t),i=0,o=0;o<r.length;o++){var a=r[o];if(a.type==="elem"){var l=a.elem;i=Math.max(i,l.maxFontSize,l.height)}}i+=2;var c=Ae(["pstrut"],[]);c.style.height=$e(i);for(var u=[],d=s,f=s,m=s,p=0;p<r.length;p++){var y=r[p];if(y.type==="kern")m+=y.size;else{var v=y.elem,b=y.wrapperClasses||[],x=y.wrapperStyle||{},w=Ae(b,[c,v],void 0,x);w.style.top=$e(-i-m-v.depth),y.marginLeft&&(w.style.marginLeft=y.marginLeft),y.marginRight&&(w.style.marginRight=y.marginRight),u.push(w),m+=v.height+v.depth}d=Math.min(d,m),f=Math.max(f,m)}var k=Ae(["vlist"],u);k.style.height=$e(f);var T;if(d<0){var C=Ae([],[]),A=Ae(["vlist"],[C]);A.style.height=$e(-d);var L=Ae(["vlist-s"],[new _i("​")]);T=[Ae(["vlist-r"],[k,L]),Ae(["vlist-r"],[A])]}else T=[Ae(["vlist-r"],[k])];var $=Ae(["vlist-t"],T);return T.length===2&&$.classes.push("vlist-t2"),$.height=f,$.depth=-d,$},QI=(e,t)=>{var n=Ae(["mspace"],[],t),r=ir(e,t);return n.style.marginRight=$e(r),n},ap=(e,t,n)=>{var r,s;switch(e){case"amsrm":r="AMS";break;case"textrm":r="Main";break;case"textsf":r="SansSerif";break;case"texttt":r="Typewriter";break;default:r=e}return t==="textbf"&&n==="textit"?s="BoldItalic":t==="textbf"?s="Bold":n==="textit"?s="Italic":s="Regular",r+"-"+s},jw={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"}},JI={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},ZI=function(t,n){var[r,s,i]=JI[t],o=new ic(r),a=new Ga([o],{width:$e(s),height:$e(i),style:"width:"+$e(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=oc(["overlay"],[a],n);return l.height=i,l.style.height=$e(i),l.style.width=$e(s),l},rr={number:3,unit:"mu"},$c={number:4,unit:"mu"},ya={number:5,unit:"mu"},lJ={mord:{mop:rr,mbin:$c,mrel:ya,minner:rr},mop:{mord:rr,mop:rr,mrel:ya,minner:rr},mbin:{mord:$c,mop:$c,mopen:$c,minner:$c},mrel:{mord:ya,mop:ya,mopen:ya,minner:ya},mopen:{},mclose:{mop:rr,mbin:$c,mrel:ya,minner:rr},mpunct:{mord:rr,mop:rr,mrel:ya,mopen:rr,mclose:rr,mpunct:rr,minner:rr},minner:{mord:rr,mop:rr,mbin:$c,mrel:ya,mopen:rr,mpunct:rr,minner:rr}},cJ={mord:{mop:rr},mop:{mord:rr,mop:rr},mbin:{},mrel:{},mopen:{},mclose:{mop:rr},mpunct:{},minner:{mop:rr}},eR={},g1={},y1={};function Ke(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},l=0;l<n.length;++l)eR[n[l]]=a;t&&(i&&(g1[t]=i),o&&(y1[t]=o))}function zu(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;Ke({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var b1=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},Ar=function(t){return t.type==="ordgroup"?t.body:[t]},uJ=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),dJ=new Set(["rightmost","mrel","mclose","mpunct"]),hJ={display:jt.DISPLAY,text:jt.TEXT,script:jt.SCRIPT,scriptscript:jt.SCRIPTSCRIPT},fJ={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},$r=function(t,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=wn(t[o],n);if(a instanceof Ah){var l=a.children;i.push(...l)}else i.push(a)}if(XI(i),!r)return i;var c=n;if(t.length===1){var u=t[0];u.type==="sizing"?c=n.havingSize(u.size):u.type==="styling"&&(c=n.havingStyle(hJ[u.style]))}var d=Ae([s[0]||"leftmost"],[],n),f=Ae([s[1]||"rightmost"],[],n),m=r==="root";return Lw(i,(p,y)=>{var v=y.classes[0],b=p.classes[0];v==="mbin"&&dJ.has(b)?y.classes[0]="mord":b==="mbin"&&uJ.has(v)&&(p.classes[0]="mord")},{node:d},f,m),Lw(i,(p,y)=>{var v,b,x=Ow(y),w=Ow(p),k=x&&w?p.hasClass("mtight")?(v=cJ[x])==null?void 0:v[w]:(b=lJ[x])==null?void 0:b[w]:null;if(k)return QI(k,c)},{node:d},f,m),i},Lw=function(t,n,r,s,i){s&&t.push(s);for(var o=0;o<t.length;o++){var a=t[o],l=tR(a);if(l){Lw(l.children,n,r,null,i);continue}var c=!a.hasClass("mspace");if(c){var u=n(a,r.node);u&&(r.insertAfter?r.insertAfter(u):(t.unshift(u),o++))}c?r.node=a:i&&a.hasClass("newline")&&(r.node=Ae(["leftmost"])),r.insertAfter=(d=>f=>{t.splice(d+1,0,f),o++})(o)}s&&t.pop()},tR=function(t){return t instanceof Ah||t instanceof Ry||t instanceof Eh&&t.hasClass("enclosing")?t:null},Dw=function(t,n){var r=tR(t);if(r){var s=r.children;if(s.length){if(n==="right")return Dw(s[s.length-1],"right");if(n==="left")return Dw(s[0],"left")}}return t},Ow=function(t,n){if(!t)return null;n&&(t=Dw(t,n));var r=t.classes[0];return fJ[r]||null},M0=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return Ae(n.concat(r))},wn=function(t,n,r){if(!t)return Ae();if(g1[t.type]){var s=g1[t.type](t,n);if(r&&n.size!==r.size){s=Ae(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Ie("Got group of unknown type: '"+t.type+"'")};function lp(e,t){var n=Ae(["base"],e,t),r=Ae(["strut"]);return r.style.height=$e(n.height+n.depth),n.depth&&(r.style.verticalAlign=$e(-n.depth)),n.children.unshift(r),n}function Bw(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=$r(e,t,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],o=[],a=0;a<r.length;a++)if(o.push(r[a]),r[a].hasClass("mbin")||r[a].hasClass("mrel")||r[a].hasClass("allowbreak")){for(var l=!1;a<r.length-1&&r[a+1].hasClass("mspace")&&!r[a+1].hasClass("newline");)a++,o.push(r[a]),r[a].hasClass("nobreak")&&(l=!0);l||(i.push(lp(o,t)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(lp(o,t)),o=[]),i.push(r[a]));o.length>0&&i.push(lp(o,t));var c;n?(c=lp($r(n,t,!0),t),c.classes=["tag"],i.push(c)):s&&i.push(s);var u=Ae(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=$e(u.height+u.depth),u.depth&&(d.style.verticalAlign=$e(-u.depth))}return u}function nR(e){return new Ah(e)}class Le{constructor(t,n,r){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=r||[]}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=sc(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Er&&this.children[r+1]instanceof Er){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Er;)s+=this.children[++r].toText();t.appendChild(new Er(s).toNode())}else t.appendChild(this.children[r].toNode());return t}toMarkup(){var t="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(t+=" "+n+'="',t+=ps(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+ps(sc(this.classes))+'"'),t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</"+this.type+">",t}toText(){return this.children.map(t=>t.toText()).join("")}}let Er=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return ps(this.toText())}toText(){return this.text}};class rR{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",$e(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+$e(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var mJ=new Set(["\\imath","\\jmath"]),pJ=new Set(["mrow","mtable"]),Ji=function(t,n,r){return Jn[n][t]&&Jn[n][t].replace&&t.charCodeAt(0)!==55349&&!(YI.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=Jn[n][t].replace),new Er(t)},n_=function(t){return t.length===1?t[0]:new Le("mrow",t)},gJ={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"},r_=(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 r=e.mode,s=gJ[n];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(mJ.has(i))return null;if(Jn[r][i]){var o=Jn[r][i].replace;o&&(i=o)}var a=jw[n].fontName;return Z5(i,a,r)?jw[n].variant:null};function K2(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof Er&&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 Er&&n.text===","}else return!1}var Si=function(t,n,r){if(t.length===1){var s=Bn(t[0],n);return r&&s instanceof Le&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,a=0;a<t.length;a++){var l=Bn(t[a],n);if(l instanceof Le&&o instanceof Le){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(K2(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&K2(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||K2(o))){var c=l.children[0];c instanceof Le&&c.type==="mn"&&(c.children=[...o.children,...c.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof Er&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof Er&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),o=l}return i},ac=function(t,n,r){return n_(Si(t,n,r))},Bn=function(t,n){if(!t)return new Le("mrow");if(y1[t.type])return y1[t.type](t,n);throw new Ie("Got group of unknown type: '"+t.type+"'")};function o7(e,t,n,r,s){var i=Si(e,n),o;i.length===1&&i[0]instanceof Le&&pJ.has(i[0].type)?o=i[0]:o=new Le("mrow",i);var a=new Le("annotation",[new Er(t)]);a.setAttribute("encoding","application/x-tex");var l=new Le("semantics",[o,a]),c=new Le("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=s?"katex":"katex-mathml";return Ae([u],[c])}var yJ=[[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]],a7=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],l7=function(t,n){return n.size<2?t:yJ[t-1][n.size-1]};class Ta{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||Ta.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=a7[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 Ta(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:l7(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:a7[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=l7(Ta.BASESIZE,t);return this.size===n&&this.textSize===Ta.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!==Ta.BASESIZE?["sizing","reset-size"+this.size,"size"+Ta.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=eJ(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ta.BASESIZE=6;var sR=function(t){return new Ta({style:t.displayMode?jt.DISPLAY:jt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},iR=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=Ae(r,[t])}return t},bJ=function(t,n,r){var s=sR(r),i;if(r.output==="mathml")return o7(t,n,s,r.displayMode,!0);if(r.output==="html"){var o=Bw(t,s);i=Ae(["katex"],[o])}else{var a=o7(t,n,s,r.displayMode,!1),l=Bw(t,s);i=Ae(["katex"],[a,l])}return iR(i,r)},xJ=function(t,n,r){var s=sR(r),i=Bw(t,s),o=Ae(["katex"],[i]);return iR(o,r)},wJ={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":"="},Dy=function(t){var n=new Le("mo",[new Er(wJ[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},vJ={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]},_J=new Set(["widehat","widecheck","widetilde","utilde"]),Oy=function(t,n){function r(){var a=4e5,l=t.label.slice(1);if(_J.has(l)&&"base"in t){var c=t.base.type==="ordgroup"?t.base.body.length:1,u,d,f;if(c>5)l==="widehat"||l==="widecheck"?(u=420,a=2364,f=.42,d=l+"4"):(u=312,a=2340,f=.34,d="tilde4");else{var m=[1,1,2,2,3,3][c];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][m],u=[0,239,300,360,420][m],f=[0,.24,.3,.3,.36,.42][m],d=l+m):(a=[0,600,1033,2339,2340][m],u=[0,260,286,306,312][m],f=[0,.26,.286,.3,.306,.34][m],d="tilde"+m)}var p=new ic(d),y=new Ga([p],{width:"100%",height:$e(f),viewBox:"0 0 "+a+" "+u,preserveAspectRatio:"none"});return{span:oc([],[y],n),minWidth:0,height:f}}else{var v=[],b=vJ[l];if(!b)throw new Error('No SVG data for "'+l+'".');var[x,w,k]=b,T=k/1e3,C=x.length,A,L;if(C===1){if(b.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');A=["hide-tail"],L=[b[3]]}else if(C===2)A=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(C===3)A=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+C+" children.");for(var $=0;$<C;$++){var E=new ic(x[$]),z=new Ga([E],{width:"400em",height:$e(T),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:L[$]+" slice"}),M=oc([A[$]],[z],n);if(C===1)return{span:M,minWidth:w,height:T};M.style.height=$e(T),v.push(M)}return{span:Ae(["stretchy"],v,n),minWidth:w,height:T}}}var{span:s,minWidth:i,height:o}=r();return s.height=o,s.style.height=$e(o),i>0&&(s.style.minWidth=$e(i)),s},kJ=function(t,n,r,s,i){var o,a=t.height+t.depth+r+s;if(/fbox|color|angl/.test(n)){if(o=Ae(["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 Aw({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new Aw({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new Ga(c,{width:"100%",height:$e(a)});o=oc([],[u],i)}return o.height=a,o.style.height=$e(a),o},SJ={bin:1,close:1,inner:1,open:1,punct:1,rel:1},TJ={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function CJ(e){return e in SJ}function Ft(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 By(e){var t=$y(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 $y(e){return e&&(e.type==="atom"||TJ.hasOwnProperty(e.type))?e:null}var oR=e=>{if(e instanceof _i)return e;if(ZQ(e)&&e.children.length===1)return oR(e.children[0])},s_=(e,t)=>{var n,r,s;e&&e.type==="supsub"?(r=Ft(e.base,"accent"),n=r.base,e.base=n,s=JQ(wn(e,t)),e.base=r):(r=Ft(e,"accent"),n=r.base);var i=wn(n,t.havingCrampedStyle()),o=r.isShifty&&Ja(n),a=0;if(o){var l,c;a=(l=(c=oR(i))==null?void 0:c.skew)!=null?l:0}var u=r.label==="\\c",d=u?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),f;if(r.isStretchy)f=Oy(r,t),f=bn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+$e(2*a)+")",marginLeft:$e(2*a)}:void 0}]});else{var m,p;r.label==="\\vec"?(m=ZI("vec",t),p=JI.vec[1]):(m=Ly({mode:r.mode,text:r.label},t,"textord"),m=QQ(m),m.italic=0,p=m.width,u&&(d+=m.depth)),f=Ae(["accent-body"],[m]);var y=r.label==="\\textcircled";y&&(f.classes.push("accent-full"),d=i.height);var v=a;y||(v-=p/2),f.style.left=$e(v),r.label==="\\textcircled"&&(f.style.top=".2em"),f=bn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:f}]})}var b=Ae(["mord","accent"],[f],t);return s?(s.children[0]=b,s.height=Math.max(b.height,s.height),s.classes[0]="mord",s):b},aR=(e,t)=>{var n=e.isStretchy?Dy(e.label):new Le("mo",[Ji(e.label,e.mode)]),r=new Le("mover",[Bn(e.base,t),n]);return r.setAttribute("accent","true"),r},AJ=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Ke({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=b1(t[0]),r=!AJ.test(e.funcName),s=!r||e.funcName==="\\widehat"||e.funcName==="\\widetilde"||e.funcName==="\\widecheck";return{type:"accent",mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:s_,mathmlBuilder:aR});Ke({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],r=e.parser.mode;return r==="math"&&(e.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+e.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:s_,mathmlBuilder:aR});Ke({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(e,t)=>{var n=wn(e.base,t),r=Oy(e,t),s=e.label==="\\utilde"?.12:0,i=bn({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]});return Ae(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=Dy(e.label),r=new Le("munder",[Bn(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var cp=e=>{var t=new Le("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Ke({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:r,funcName:s}=e;return{type:"xArrow",mode:r.mode,label:s,body:t[0],below:n[0]}},htmlBuilder(e,t){var n=t.style,r=t.havingStyle(n.sup()),s=sh(wn(e.body,r,t),t),i=e.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var o;e.below&&(r=t.havingStyle(n.sub()),o=sh(wn(e.below,r,t),t),o.classes.push(i+"-arrow-pad"));var a=Oy(e,t),l=-t.fontMetrics().axisHeight+.5*a.height,c=-t.fontMetrics().axisHeight-.5*a.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(c-=s.depth);var u;if(o){var d=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;u=bn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:d}]})}else u=bn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return Ae(["mrel","x-arrow"],[u],t)},mathmlBuilder(e,t){var n=Dy(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=cp(Bn(e.body,t));if(e.below){var i=cp(Bn(e.below,t));r=new Le("munderover",[n,i,s])}else r=new Le("mover",[n,s])}else if(e.below){var o=cp(Bn(e.below,t));r=new Le("munder",[n,o])}else r=cp(),r=new Le("mover",[n,r]);return r}});function lR(e,t){var n=$r(e.body,t,!0);return Ae([e.mclass],n,t)}function cR(e,t){var n,r=Si(e.body,t);return e.mclass==="minner"?n=new Le("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new Le("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new Le("mo",r),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}Ke({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:Ar(s),isCharacterBox:Ja(s)}},htmlBuilder:lR,mathmlBuilder:cR});var zy=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"};Ke({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:zy(t[0]),body:Ar(t[1]),isCharacterBox:Ja(t[1])}}});Ke({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(e,t){var{parser:n,funcName:r}=e,s=t[1],i=t[0],o;r!=="\\stackrel"?o=zy(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Ar(s)},l={type:"supsub",mode:i.mode,base:a,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:Ja(l)}},htmlBuilder:lR,mathmlBuilder:cR});Ke({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:zy(t[0]),body:Ar(t[0])}},htmlBuilder(e,t){var n=$r(e.body,t,!0),r=Ae([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=Si(e.body,t),r=new Le("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var EJ={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},c7=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),u7=e=>e.type==="textord"&&e.text==="@",MJ=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function NJ(e,t,n){var r=EJ[e];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[t[0]],[t[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[t[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},o=n.callFunction("\\Big",[i],[]),a=n.callFunction("\\\\cdright",[t[1]],[]),l={type:"ordgroup",mode:"math",body:[s,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 IJ(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 Ie("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;i<t.length;i++){for(var o=t[i],a=c7(),l=0;l<o.length;l++)if(!u7(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=By(o[l]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var d=0;d<2;d++){for(var f=!0,m=l+1;m<o.length;m++){if(MJ(o[m],c)){f=!1,l=m;break}if(u7(o[m]))throw new Ie("Missing a "+c+" character to complete a CD arrow.",o[m]);u[d].body.push(o[m])}if(f)throw new Ie("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new Ie('Expected one of "<>AV=|." after @',o[l]);var p=NJ(c,u,e),y={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(y),a=c7()}i%2===0?r.push(a):r.shift(),r=[],s.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var v=new Array(s[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:s,arraystretch:1,addJot:!0,rowGaps:[null],cols:v,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Ke({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:t[0]}},htmlBuilder(e,t){var n=t.havingStyle(t.style.sup()),r=sh(wn(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=$e(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Le("mrow",[Bn(e.label,t)]);return n=new Le("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Le("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Ke({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=sh(wn(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Le("mrow",[Bn(e.fragment,t)])}});Ke({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=Ft(t[0],"ordgroup"),s=r.body,i="",o=0;o<s.length;o++){var a=Ft(s[o],"textord");i+=a.text}var l=parseInt(i),c;if(isNaN(l))throw new Ie("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new Ie("\\@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 uR=(e,t)=>{var n=$r(e.body,t.withColor(e.color),!1);return el(n)},dR=(e,t)=>{var n=Si(e.body,t.withColor(e.color)),r=new Le("mstyle",n);return r.setAttribute("mathcolor",e.color),r};Ke({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=Ft(t[0],"color-token").color,s=t[1];return{type:"color",mode:n.mode,color:r,body:Ar(s)}},htmlBuilder:uR,mathmlBuilder:dR});Ke({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,s=Ft(t[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:uR,mathmlBuilder:dR});Ke({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(e,t,n){var{parser:r}=e,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Ft(s,"size").value}},htmlBuilder(e,t){var n=Ae(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=$e(ir(e.size,t)))),n},mathmlBuilder(e,t){var n=new Le("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",$e(ir(e.size,t)))),n}});var $w={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},hR=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Ie("Expected a control sequence",e);return t},RJ=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},fR=(e,t,n,r)=>{var s=e.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,s,r)};Ke({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(e){var{parser:t,funcName:n}=e;t.consumeSpaces();var r=t.fetch();if($w[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=$w[r.text]),Ft(t.parseFunction(),"internal");throw new Ie("Invalid token after macro prefix",r)}});Ke({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=t.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new Ie("Expected a control sequence",r);for(var i=0,o,a=[[]];t.gullet.future().text!=="{";)if(r=t.gullet.popToken(),r.text==="#"){if(t.gullet.future().text==="{"){o=t.gullet.future(),a[i].push("{");break}if(r=t.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Ie('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Ie('Argument number "'+r.text+'" out of order');i++,a.push([])}else{if(r.text==="EOF")throw new Ie("Expected a macro definition");a[i].push(r.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(s,{tokens:l,numArgs:i,delimiters:a},n===$w[n]),{type:"internal",mode:t.mode}}});Ke({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=hR(t.gullet.popToken());t.gullet.consumeSpaces();var s=RJ(t);return fR(t,r,s,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Ke({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=hR(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return fR(t,r,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var Tf=function(t,n,r){var s=Jn.math[t]&&Jn.math[t].replace,i=Z5(s||t,n,r);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},i_=function(t,n,r,s){var i=r.havingBaseStyle(n),o=Ae(s.concat(i.sizingClasses(r)),[t],r),a=i.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},mR=function(t,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;t.classes.push("delimcenter"),t.style.top=$e(i),t.height-=i,t.depth+=i},jJ=function(t,n,r,s,i,o){var a=Ts(t,"Main-Regular",i,s),l=i_(a,n,s,o);return mR(l,s,n),l},LJ=function(t,n,r,s){return Ts(t,"Size"+n+"-Regular",r,s)},pR=function(t,n,r,s,i,o){var a=LJ(t,n,i,s),l=i_(Ae(["delimsizing","size"+n],[a],s),jt.TEXT,s,o);return r&&mR(l,s,jt.TEXT),l},Y2=function(t,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=Ae(["delimsizinginner",s],[Ae([],[Ts(t,n,r)])]);return{type:"elem",elem:i}},X2=function(t,n,r){var s=Uo["Size4-Regular"][t.charCodeAt(0)]?Uo["Size4-Regular"][t.charCodeAt(0)][4]:Uo["Size1-Regular"][t.charCodeAt(0)][4],i=new ic("inner",HQ(t,Math.round(1e3*n))),o=new Ga([i],{width:$e(s),height:$e(n),style:"width:"+$e(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=oc([],[o],r);return a.height=n,a.style.height=$e(n),a.style.width=$e(s),{type:"elem",elem:a}},zw=.008,up={type:"kern",size:-1*zw},DJ=new Set(["|","\\lvert","\\rvert","\\vert"]),OJ=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),gR=function(t,n,r,s,i,o){var a,l,c,u,d="",f=0;a=c=u=t,l=null;var m="Size1-Regular";t==="\\uparrow"?c=u="⏐":t==="\\Uparrow"?c=u="‖":t==="\\downarrow"?a=c="⏐":t==="\\Downarrow"?a=c="‖":t==="\\updownarrow"?(a="\\uparrow",c="⏐",u="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",c="‖",u="\\Downarrow"):DJ.has(t)?(c="∣",d="vert",f=333):OJ.has(t)?(c="∥",d="doublevert",f=556):t==="["||t==="\\lbrack"?(a="⎡",c="⎢",u="⎣",m="Size4-Regular",d="lbrack",f=667):t==="]"||t==="\\rbrack"?(a="⎤",c="⎥",u="⎦",m="Size4-Regular",d="rbrack",f=667):t==="\\lfloor"||t==="⌊"?(c=a="⎢",u="⎣",m="Size4-Regular",d="lfloor",f=667):t==="\\lceil"||t==="⌈"?(a="⎡",c=u="⎢",m="Size4-Regular",d="lceil",f=667):t==="\\rfloor"||t==="⌋"?(c=a="⎥",u="⎦",m="Size4-Regular",d="rfloor",f=667):t==="\\rceil"||t==="⌉"?(a="⎤",c=u="⎥",m="Size4-Regular",d="rceil",f=667):t==="("||t==="\\lparen"?(a="⎛",c="⎜",u="⎝",m="Size4-Regular",d="lparen",f=875):t===")"||t==="\\rparen"?(a="⎞",c="⎟",u="⎠",m="Size4-Regular",d="rparen",f=875):t==="\\{"||t==="\\lbrace"?(a="⎧",l="⎨",u="⎩",c="⎪",m="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",l="⎬",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",u="⎩",c="⎪",m="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",u="⎭",c="⎪",m="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",u="⎭",c="⎪",m="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",u="⎩",c="⎪",m="Size4-Regular");var p=Tf(a,m,i),y=p.height+p.depth,v=Tf(c,m,i),b=v.height+v.depth,x=Tf(u,m,i),w=x.height+x.depth,k=0,T=1;if(l!==null){var C=Tf(l,m,i);k=C.height+C.depth,T=2}var A=y+w+k,L=Math.max(0,Math.ceil((n-A)/(T*b))),$=A+L*T*b,E=s.fontMetrics().axisHeight;r&&(E*=s.sizeMultiplier);var z=$/2-E,M=[];if(d.length>0){var U=$-y-w,K=Math.round($*1e3),J=VQ(d,Math.round(U*1e3)),P=new ic(d,J),V=$e(f/1e3),X=$e(K/1e3),te=new Ga([P],{width:V,height:X,viewBox:"0 0 "+f+" "+K}),D=oc([],[te],s);D.height=K/1e3,D.style.width=V,D.style.height=X,M.push({type:"elem",elem:D})}else{if(M.push(Y2(u,m,i)),M.push(up),l===null){var j=$-y-w+2*zw;M.push(X2(c,j,s))}else{var B=($-y-w-k)/2+2*zw;M.push(X2(c,B,s)),M.push(up),M.push(Y2(l,m,i)),M.push(up),M.push(X2(c,B,s))}M.push(up),M.push(Y2(a,m,i))}var I=s.havingBaseStyle(jt.TEXT),ne=bn({positionType:"bottom",positionData:z,children:M});return i_(Ae(["delimsizing","mult"],[ne],I),jt.TEXT,s,o)},Q2=80,J2=.08,Z2=function(t,n,r,s,i){var o=UQ(t,s,r),a=new ic(t,o),l=new Ga([a],{width:"400em",height:$e(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return oc(["hide-tail"],[l],i)},BJ=function(t,n){var r=n.havingBaseSizing(),s=vR("\\surd",t*r.sizeMultiplier,wR,r),i=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,c,u,d;return s.type==="small"?(u=1e3+1e3*o+Q2,t<1?i=1:t<1.4&&(i=.7),l=(1+o+J2)/i,c=(1+o)/i,a=Z2("sqrtMain",l,u,o,n),a.style.minWidth="0.853em",d=.833/i):s.type==="large"?(u=(1e3+Q2)*e0[s.size],c=(e0[s.size]+o)/i,l=(e0[s.size]+o+J2)/i,a=Z2("sqrtSize"+s.size,l,u,o,n),a.style.minWidth="1.02em",d=1/i):(l=t+o+J2,c=t+o,u=Math.floor(1e3*t+o)+Q2,a=Z2("sqrtTall",l,u,o,n),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=$e(l),{span:a,advanceWidth:d,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},yR=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),$J=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),bR=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),e0=[0,1.2,1.8,2.4,3],xR=function(t,n,r,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),yR.has(t)||bR.has(t))return pR(t,n,!1,r,s,i);if($J.has(t))return gR(t,e0[n],!1,r,s,i);throw new Ie("Illegal delimiter: '"+t+"'")},zJ=[{type:"small",style:jt.SCRIPTSCRIPT},{type:"small",style:jt.SCRIPT},{type:"small",style:jt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],PJ=[{type:"small",style:jt.SCRIPTSCRIPT},{type:"small",style:jt.SCRIPT},{type:"small",style:jt.TEXT},{type:"stack"}],wR=[{type:"small",style:jt.SCRIPTSCRIPT},{type:"small",style:jt.SCRIPT},{type:"small",style:jt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],qJ=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.")},vR=function(t,n,r,s){for(var i=Math.min(2,3-s.style.size),o=i;o<r.length;o++){var a=r[o];if(a.type==="stack")break;var l=Tf(t,qJ(a),"math"),c=l.height+l.depth;if(a.type==="small"){var u=s.havingBaseStyle(a.style);c*=u.sizeMultiplier}if(c>n)return a}return r[r.length-1]},Pw=function(t,n,r,s,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;bR.has(t)?a=zJ:yR.has(t)?a=wR:a=PJ;var l=vR(t,n,a,s);return l.type==="small"?jJ(t,l.style,r,s,i,o):l.type==="large"?pR(t,l.size,r,s,i,o):gR(t,n,r,s,i,o)},e4=function(t,n,r,s,i,o){var a=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,c=5/s.fontMetrics().ptPerEm,u=Math.max(n-a,r+a),d=Math.max(u/500*l,2*u-c);return Pw(t,d,!0,s,i,o)},d7={"\\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}},FJ=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 h7(e){return"isMiddle"in e}function Py(e,t){var n=$y(e);if(n&&FJ.has(n.text))return n;throw n?new Ie("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Ie("Invalid delimiter type '"+e.type+"'",e)}Ke({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=Py(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:d7[e.funcName].size,mclass:d7[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Ae([e.mclass]):xR(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(Ji(e.delim,e.mode));var n=new Le("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=$e(e0[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function f7(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Ke({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 Ie("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Py(t[0],e).text,color:n}}});Ke({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Py(t[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Ft(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{f7(e);for(var n=$r(e.body,t,!0,["mopen","mclose"]),r=0,s=0,i=!1,o=0;o<n.length;o++){var a=n[o];h7(a)?i=!0:(r=Math.max(n[o].height,r),s=Math.max(n[o].depth,s))}r*=t.sizeMultiplier,s*=t.sizeMultiplier;var l;if(e.left==="."?l=M0(t,["mopen"]):l=e4(e.left,r,s,t,e.mode,["mopen"]),n.unshift(l),i)for(var c=1;c<n.length;c++){var u=n[c];if(h7(u)){var d=u.isMiddle;n[c]=e4(d.delim,r,s,d.options,e.mode,[])}}var f;if(e.right===".")f=M0(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;f=e4(e.right,r,s,m,e.mode,["mclose"])}return n.push(f),Ae(["minner"],n,t)},mathmlBuilder:(e,t)=>{f7(e);var n=Si(e.body,t);if(e.left!=="."){var r=new Le("mo",[Ji(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var s=new Le("mo",[Ji(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),n.push(s)}return n_(n)}});Ke({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Py(t[0],e);if(!e.parser.leftrightDepth)throw new Ie("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=M0(t,[]):(n=xR(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?Ji("|","text"):Ji(e.delim,e.mode),r=new Le("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var qy=(e,t)=>{var n=sh(wn(e.body,t),t),r=e.label.slice(1),s=t.sizeMultiplier,i,o,a=Ja(e.body);if(r==="sout")i=Ae(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,o=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var l=ir({number:.6,unit:"pt"},t),c=ir({number:.35,unit:"ex"},t),u=t.havingBaseSizing();s=s/u.sizeMultiplier;var d=n.height+n.depth+l+c;n.style.paddingLeft=$e(d/2+l);var f=Math.floor(1e3*d*s),m=qQ(f),p=new Ga([new ic("phase",m)],{width:"400em",height:$e(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=oc(["hide-tail"],[p],t),i.style.height=$e(d),o=n.depth+l+c}else{/cancel/.test(r)?a||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var y,v,b=0;/box/.test(r)?(b=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),y=t.fontMetrics().fboxsep+(r==="colorbox"?0:b),v=y):r==="angl"?(b=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),y=4*b,v=Math.max(0,.25-n.depth)):(y=a?.2:0,v=y),i=kJ(n,r,y,v,t),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=$e(b)):r==="angl"&&b!==.049&&(i.style.borderTopWidth=$e(b),i.style.borderRightWidth=$e(b)),o=n.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var x;if(e.backgroundColor)x=bn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var w=/cancel|phase/.test(r)?["svg-align"]:[];x=bn({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:w}]})}return/cancel/.test(r)&&(x.height=n.height,x.depth=n.depth),/cancel/.test(r)&&!a?Ae(["mord","cancel-lap"],[x],t):Ae(["mord"],[x],t)},Fy=(e,t)=>{var n,r=new Le(e.label.includes("colorbox")?"mpadded":"menclose",[Bn(e.body,t)]);switch(e.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=t.fontMetrics().fboxsep*t.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),e.label==="\\fcolorbox"){var s=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness);r.setAttribute("style","border: "+$e(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};Ke({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Ft(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:qy,mathmlBuilder:Fy});Ke({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=Ft(t[0],"color-token").color,o=Ft(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:qy,mathmlBuilder:Fy});Ke({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]}}});Ke({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\phase"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:qy,mathmlBuilder:Fy});Ke({type:"enclose",names:["\\sout"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e;n.mode==="math"&&n.settings.reportNonstrict("mathVsSout","LaTeX's \\sout works only in text mode");var s=t[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:qy,mathmlBuilder:Fy});Ke({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 _R={};function ea(e){for(var{type:t,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:o}=e,a={type:t,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},l=0;l<n.length;++l)_R[n[l]]=a;i&&(g1[t]=i),o&&(y1[t]=o)}var kR={};function O(e,t){kR[e]=t}class Hs{constructor(t,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=n,this.end=r}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new Hs(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class xi{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 xi(n,Hs.range(this,t))}}function m7(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 Uy=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Ie("{"+e.envName+"} can be used only in display mode.")},UJ=new Set(["gather","gather*"]);function o_(e){if(!e.includes("ed"))return!e.includes("*")}function vc(e,t,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:u,maxNumCols:d,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 Ie("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var p=[],y=[p],v=[],b=[],x=l!=null?[]:void 0;function w(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){x&&(e.gullet.macros.get("\\df@tag")?(x.push(e.subparse([new xi("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):x.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),b.push(m7(e));;){var T=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var C={type:"ordgroup",mode:e.mode,body:T};n&&(C={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[C]}),p.push(C);var A=e.fetch().text;if(A==="&"){if(d&&p.length===d){if(c||a)throw new Ie("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(A==="\\end"){k(),p.length===1&&C.type==="styling"&&C.body.length===1&&C.body[0].type==="ordgroup"&&C.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),b.length<y.length+1&&b.push([]);break}else if(A==="\\\\"){e.consume();var L=void 0;e.gullet.future().text!==" "&&(L=e.parseSizeGroup(!0)),v.push(L?L.value:null),k(),b.push(m7(e)),p=[],y.push(p),w()}else throw new Ie("Expected & or \\\\ or \\cr or \\end",e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:"array",mode:e.mode,addJot:s,arraystretch:o,body:y,cols:i,rowGaps:v,hskipBeforeAndAfter:r,hLinesBeforeRow:b,colSeparationType:a,tags:x,leqno:f}}function a_(e){return e.slice(0,1)==="d"?"display":"text"}var ta=function(t,n){var r,s,i=t.body.length,o=t.hLinesBeforeRow,a=0,l=new Array(i),c=[],u=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),d=1/n.fontMetrics().ptPerEm,f=5*d;if(t.colSeparationType&&t.colSeparationType==="small"){var m=n.havingStyle(jt.SCRIPT).sizeMultiplier;f=.2778*(m/n.sizeMultiplier)}var p=t.colSeparationType==="CD"?ir({number:3,unit:"ex"},n):12*d,y=3*d,v=t.arraystretch*p,b=.7*v,x=.3*v,w=0;function k(re){for(var me=0;me<re.length;++me)me>0&&(w+=.25),c.push({pos:w,isDashed:re[me]})}for(k(o[0]),r=0;r<t.body.length;++r){var T=t.body[r],C=b,A=x;a<T.length&&(a=T.length);var L={cells:new Array(T.length),height:0,depth:0,pos:0};for(s=0;s<T.length;++s){var $=wn(T[s],n);A<$.depth&&(A=$.depth),C<$.height&&(C=$.height),L.cells[s]=$}var E=t.rowGaps[r],z=0;E&&(z=ir(E,n),z>0&&(z+=x,A<z&&(A=z),z=0)),t.addJot&&r<t.body.length-1&&(A+=y),L.height=C,L.depth=A,w+=C,L.pos=w,w+=A+z,l[r]=L,k(o[r+1])}var M=w/2+n.fontMetrics().axisHeight,U=t.cols||[],K=[],J,P,V=[];if(t.tags&&t.tags.some(re=>re))for(r=0;r<i;++r){var X=l[r],te=X.pos-M,D=t.tags[r],j=void 0;D===!0?j=Ae(["eqn-num"],[],n):D===!1?j=Ae([],[],n):j=Ae([],$r(D,n,!0),n),j.depth=X.depth,j.height=X.height,V.push({type:"elem",elem:j,shift:te})}for(s=0,P=0;s<a||P<U.length;++s,++P){for(var B,I=U[P],ne=!0;((de=I)==null?void 0:de.type)==="separator";){var de;if(ne||(J=Ae(["arraycolsep"],[]),J.style.width=$e(n.fontMetrics().doubleRuleSep),K.push(J)),I.separator==="|"||I.separator===":"){var ce=I.separator==="|"?"solid":"dashed",Ne=Ae(["vertical-separator"],[],n);Ne.style.height=$e(w),Ne.style.borderRightWidth=$e(u),Ne.style.borderRightStyle=ce,Ne.style.margin="0 "+$e(-u/2);var Ce=w-M;Ce&&(Ne.style.verticalAlign=$e(-Ce)),K.push(Ne)}else throw new Ie("Invalid separator type: "+I.separator);P++,I=U[P],ne=!1}if(!(s>=a)){var ze=void 0;if(s>0||t.hskipBeforeAndAfter){var ue,rt;ze=(ue=(rt=I)==null?void 0:rt.pregap)!=null?ue:f,ze!==0&&(J=Ae(["arraycolsep"],[]),J.style.width=$e(ze),K.push(J))}var xe=[];for(r=0;r<i;++r){var Ee=l[r],Zt=Ee.cells[s];if(Zt){var ht=Ee.pos-M;Zt.depth=Ee.depth,Zt.height=Ee.height,xe.push({type:"elem",elem:Zt,shift:ht})}}var bt=bn({positionType:"individualShift",children:xe}),Vt=Ae(["col-align-"+(((B=I)==null?void 0:B.align)||"c")],[bt]);if(K.push(Vt),s<a-1||t.hskipBeforeAndAfter){var pn,vt;ze=(pn=(vt=I)==null?void 0:vt.postgap)!=null?pn:f,ze!==0&&(J=Ae(["arraycolsep"],[]),J.style.width=$e(ze),K.push(J))}}}var Wt=Ae(["mtable"],K);if(c.length>0){for(var Gt=rh("hline",n,u),Tt=rh("hdashline",n,u),Oe=[{type:"elem",elem:Wt,shift:0}];c.length>0;){var ot=c.pop(),ft=ot.pos-M;ot.isDashed?Oe.push({type:"elem",elem:Tt,shift:ft}):Oe.push({type:"elem",elem:Gt,shift:ft})}Wt=bn({positionType:"individualShift",children:Oe})}if(V.length===0)return Ae(["mord"],[Wt],n);var F=bn({positionType:"individualShift",children:V}),W=Ae(["tag"],[F],n);return el([Wt,W])},HJ={c:"center ",l:"left ",r:"right "},na=function(t,n){for(var r=[],s=new Le("mtd",[],["mtr-glue"]),i=new Le("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 Le("mtd",[Bn(a[c],n)]));t.tags&&t.tags[o]&&(l.unshift(s),l.push(s),t.leqno?l.unshift(i):l.push(i)),r.push(new Le("mtr",l))}var u=new Le("mtable",r),d=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);u.setAttribute("rowspacing",$e(d));var f="",m="";if(t.cols&&t.cols.length>0){var p=t.cols,y="",v=!1,b=0,x=p.length;p[0].type==="separator"&&(f+="top ",b=1),p[p.length-1].type==="separator"&&(f+="bottom ",x-=1);for(var w=b;w<x;w++){var k=p[w];k.type==="align"?(m+=HJ[k.align],v&&(y+="none "),v=!0):k.type==="separator"&&v&&(y+=k.separator==="|"?"solid ":"dashed ",v=!1)}u.setAttribute("columnalign",m.trim()),/[sd]/.test(y)&&u.setAttribute("columnlines",y.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],C="",A=1;A<T.length;A++)C+=A%2?"0em ":"1em ";u.setAttribute("columnspacing",C.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var L="",$=t.hLinesBeforeRow;f+=$[0].length>0?"left ":"",f+=$[$.length-1].length>0?"right ":"";for(var E=1;E<$.length-1;E++)L+=$[E].length===0?"none ":$[E][0]?"dashed ":"solid ";return/[sd]/.test(L)&&u.setAttribute("rowlines",L.trim()),f!==""&&(u=new Le("menclose",[u]),u.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(u=new Le("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},SR=function(t,n){t.envName.includes("ed")||Uy(t);var r=[],s=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=vc(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:o_(t.envName),emptySingleRow:!0,colSeparationType:s,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 u="",d=0;d<n[0].body.length;d++){var f=Ft(n[0].body[d],"textord");u+=f.text}a=Number(u),l=a*2}var m=!l;o.body.forEach(function(b){for(var x=1;x<b.length;x+=2){var w=Ft(b[x],"styling"),k=Ft(w.body[0],"ordgroup");k.body.unshift(c)}if(m)l<b.length&&(l=b.length);else{var T=b.length/2;if(a<T)throw new Ie("Too many math in a row: "+("expected "+a+", but got "+T),b[0])}});for(var p=0;p<l;++p){var y="r",v=0;p%2===1?y="l":p>0&&m&&(v=1),r[p]={type:"align",align:y,pregap:v,postgap:0}}return o.colSeparationType=m?"align":"alignat",o};ea({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=$y(t[0]),r=n?[t[0]]:Ft(t[0],"ordgroup").body,s=r.map(function(o){var a=By(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 Ie("Unknown column alignment: "+l,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return vc(e.parser,i,a_(e.envName))},htmlBuilder:ta,mathmlBuilder:na});ea({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",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(e.envName.charAt(e.envName.length-1)==="*"){var s=e.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,!"lcr".includes(n))throw new Ie("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=vc(e.parser,r,a_(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:ta,mathmlBuilder:na});ea({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=vc(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=$y(t[0]),r=n?[t[0]]:Ft(t[0],"ordgroup").body,s=r.map(function(a){var l=By(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new Ie("Unknown column alignment: "+c,a)});if(s.length>1)throw new Ie("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=vc(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new Ie("{subarray} can contain only one column");return o},htmlBuilder:ta,mathmlBuilder:na});ea({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=vc(e.parser,t,a_(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:SR,htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){UJ.has(e.envName)&&Uy(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:o_(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return vc(e.parser,t,"display")},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:SR,htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){Uy(e);var t={autoTag:o_(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return vc(e.parser,t,"display")},htmlBuilder:ta,mathmlBuilder:na});ea({type:"array",names:["CD"],props:{numArgs:0},handler(e){return Uy(e),IJ(e.parser)},htmlBuilder:ta,mathmlBuilder:na});O("\\nonumber","\\gdef\\@eqnsw{0}");O("\\notag","\\nonumber");Ke({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Ie(e.funcName+" valid only within array environment")}});var p7=_R;Ke({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(e,t){var{parser:n,funcName:r}=e,s=t[0];if(s.type!=="ordgroup")throw new Ie("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=Ft(s.body[o],"textord").text;if(r==="\\begin"){if(!p7.hasOwnProperty(i))throw new Ie("No such environment: "+i,s);var a=p7[i],{args:l,optArgs:c}=n.parseArguments("\\begin{"+i+"}",a),u={mode:n.mode,envName:i,parser:n},d=a.handler(u,l,c);n.expect("\\end",!1);var f=n.nextToken,m=Ft(n.parseFunction(),"environment");if(m.name!==i)throw new Ie("Mismatch: \\begin{"+i+"} matched by \\end{"+m.name+"}",f);return d}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var TR=(e,t)=>{var n=e.font,r=t.withFont(n);return wn(e.body,r)},CR=(e,t)=>{var n=e.font,r=t.withFont(n);return Bn(e.body,r)},g7={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};Ke({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:r}=e,s=b1(t[0]),i=r;return i in g7&&(i=g7[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:TR,mathmlBuilder:CR});Ke({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"mclass",mode:n.mode,mclass:zy(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Ja(r)}}});Ke({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,breakOnTokenText:s}=e,{mode:i}=n,o=n.parseExpression(!0,s);return{type:"font",mode:i,font:"math"+r.slice(1),body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:TR,mathmlBuilder:CR});var VJ=(e,t)=>{var n=t.style,r=n.fracNum(),s=n.fracDen(),i;i=t.havingStyle(r);var o=wn(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(s);var c=wn(e.denom,i,t),u,d,f;e.hasBarLine?(e.barSize?(d=ir(e.barSize,t),u=rh("frac-line",t,d)):u=rh("frac-line",t),d=u.height,f=u.height):(u=null,d=0,f=t.fontMetrics().defaultRuleThickness);var m,p,y;n.size===jt.DISPLAY.size?(m=t.fontMetrics().num1,d>0?p=3*f:p=7*f,y=t.fontMetrics().denom1):(d>0?(m=t.fontMetrics().num2,p=f):(m=t.fontMetrics().num3,p=3*f),y=t.fontMetrics().denom2);var v;if(u){var x=t.fontMetrics().axisHeight;m-o.depth-(x+.5*d)<p&&(m+=p-(m-o.depth-(x+.5*d))),x-.5*d-(c.height-y)<p&&(y+=p-(x-.5*d-(c.height-y)));var w=-(x-.5*d);v=bn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:w},{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)),v=bn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:o,shift:-m}]})}i=t.havingStyle(n),v.height*=i.sizeMultiplier/t.sizeMultiplier,v.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===jt.DISPLAY.size?k=t.fontMetrics().delim1:n.size===jt.SCRIPTSCRIPT.size?k=t.havingStyle(jt.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var T,C;return e.leftDelim==null?T=M0(t,["mopen"]):T=Pw(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?C=Ae([]):e.rightDelim==null?C=M0(t,["mclose"]):C=Pw(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),Ae(["mord"].concat(i.sizingClasses(t)),[T,Ae(["mfrac"],[v]),C],t)},WJ=(e,t)=>{var n=new Le("mfrac",[Bn(e.numer,t),Bn(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=ir(e.barSize,t);n.setAttribute("linethickness",$e(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new Le("mo",[new Er(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(n),e.rightDelim!=null){var o=new Le("mo",[new Er(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return n_(s)}return n},AR=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};Ke({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:r}=e,s=t[0],i=t[1],o,a=null,l=null;switch(r){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=r==="\\cfrac",u=null;return c||r.startsWith("\\d")?u="display":r.startsWith("\\t")&&(u="text"),AR({type:"genfrac",mode:n.mode,numer:s,denom:i,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},u)},htmlBuilder:VJ,mathmlBuilder:WJ});Ke({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(e){var{parser:t,funcName:n,token:r}=e,s;switch(n){case"\\over":s="\\frac";break;case"\\choose":s="\\binom";break;case"\\atop":s="\\\\atopfrac";break;case"\\brace":s="\\\\bracefrac";break;case"\\brack":s="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:t.mode,replaceWith:s,token:r}}});var y7=["display","text","script","scriptscript"],b7=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Ke({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(e,t){var{parser:n}=e,r=t[4],s=t[5],i=b1(t[0]),o=i.type==="atom"&&i.family==="open"?b7(i.text):null,a=b1(t[1]),l=a.type==="atom"&&a.family==="close"?b7(a.text):null,c=Ft(t[2],"size"),u,d=null;c.isBlank?u=!0:(d=c.value,u=d.number>0);var f=null,m=t[3];if(m.type==="ordgroup"){if(m.body.length>0){var p=Ft(m.body[0],"textord");f=y7[Number(p.text)]}}else m=Ft(m,"textord"),f=y7[Number(m.text)];return AR({type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:l},f)}});Ke({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(e,t){var{parser:n,funcName:r,token:s}=e;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Ft(t[0],"size").value,token:s}}});Ke({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=Ft(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:s,denom:o,continued:!1,hasBarLine:a,barSize:i,leftDelim:null,rightDelim:null}}});var ER=(e,t)=>{var n=t.style,r,s;e.type==="supsub"?(r=e.sup?wn(e.sup,t.havingStyle(n.sup()),t):wn(e.sub,t.havingStyle(n.sub()),t),s=Ft(e.base,"horizBrace")):s=Ft(e,"horizBrace");var i=wn(s.base,t.havingBaseStyle(jt.DISPLAY)),o=Oy(s,t),a;if(s.isOver?a=bn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=bn({positionType:"bottom",positionData:i.depth+.1+o.height,children:[{type:"elem",elem:o,wrapperClasses:["svg-align"]},{type:"kern",size:.1},{type:"elem",elem:i}]}),r){var l=Ae(["minner",s.isOver?"mover":"munder"],[a],t);s.isOver?a=bn({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=bn({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Ae(["minner",s.isOver?"mover":"munder"],[a],t)},GJ=(e,t)=>{var n=Dy(e.label);return new Le(e.isOver?"mover":"munder",[Bn(e.base,t),n])};Ke({type:"horizBrace",names:["\\overbrace","\\underbrace","\\overbracket","\\underbracket"],props:{numArgs:1},handler(e,t){var{parser:n,funcName:r}=e;return{type:"horizBrace",mode:n.mode,label:r,isOver:r.includes("\\over"),base:t[0]}},htmlBuilder:ER,mathmlBuilder:GJ});Ke({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],s=Ft(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:Ar(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=$r(e.body,t,!1);return oJ(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=ac(e.body,t);return n instanceof Le||(n=new Le("mrow",[n])),n.setAttribute("href",e.href),n}});Ke({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=Ft(t[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i<r.length;i++){var o=r[i];o==="~"&&(o="\\textasciitilde"),s.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:s};return{type:"href",mode:n.mode,href:r,body:Ar(a)}}});Ke({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:Ar(t[0])}},htmlBuilder(e,t){var n=$r(e.body,t.withFont(""),!1);return el(n)},mathmlBuilder(e,t){return new Le("mrow",Si(e.body,t.withFont("")))}});Ke({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r,token:s}=e,i=Ft(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(r){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(","),u=0;u<c.length;u++){var d=c[u],f=d.indexOf("=");if(f<0)throw new Ie("\\htmlData key/value '"+d+"' missing equals sign");var m=d.slice(0,f),p=d.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:Ar(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=$r(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=Ae(r,n,t);for(var i in e.attributes)i!=="class"&&e.attributes.hasOwnProperty(i)&&s.setAttribute(i,e.attributes[i]);return s},mathmlBuilder:(e,t)=>ac(e.body,t)});Ke({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:Ar(t[0]),mathml:Ar(t[1])}},htmlBuilder:(e,t)=>{var n=$r(e.html,t,!1);return el(n)},mathmlBuilder:(e,t)=>ac(e.mathml,t)});var t4=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 Ie("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!HI(r))throw new Ie("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Ke({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(e,t,n)=>{var{parser:r}=e,s={number:0,unit:"em"},i={number:.9,unit:"em"},o={number:0,unit:"em"},a="";if(n[0])for(var l=Ft(n[0],"raw").string,c=l.split(","),u=0;u<c.length;u++){var d=c[u].split("=");if(d.length===2){var f=d[1].trim();switch(d[0].trim()){case"alt":a=f;break;case"width":s=t4(f);break;case"height":i=t4(f);break;case"totalheight":o=t4(f);break;default:throw new Ie("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var m=Ft(t[0],"url").url;return a===""&&(a=m,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:m})?{type:"includegraphics",mode:r.mode,alt:a,width:s,height:i,totalheight:o,src:m}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=ir(e.height,t),r=0;e.totalheight.number>0&&(r=ir(e.totalheight,t)-n);var s=0;e.width.number>0&&(s=ir(e.width,t));var i={height:$e(n+r)};s>0&&(i.width=$e(s)),r>0&&(i.verticalAlign=$e(-r));var o=new YQ(e.src,e.alt,i);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new Le("mglyph",[]);n.setAttribute("alt",e.alt);var r=ir(e.height,t),s=0;if(e.totalheight.number>0&&(s=ir(e.totalheight,t)-r,n.setAttribute("valign",$e(-s))),n.setAttribute("height",$e(r+s)),e.width.number>0){var i=ir(e.width,t);n.setAttribute("width",$e(i))}return n.setAttribute("src",e.src),n}});Ke({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(e,t){var{parser:n,funcName:r}=e,s=Ft(t[0],"size");if(n.settings.strict){var i=r[1]==="m",o=s.value.unit==="mu";i?(o||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(e,t){return QI(e.dimension,t)},mathmlBuilder(e,t){var n=ir(e.dimension,t);return new rR(n)}});Ke({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(e,t)=>{var n;e.alignment==="clap"?(n=Ae([],[wn(e.body,t)]),n=Ae(["inner"],[n],t)):n=Ae(["inner"],[wn(e.body,t)]);var r=Ae(["fix"],[]),s=Ae([e.alignment],[n,r],t),i=Ae(["strut"]);return i.style.height=$e(s.height+s.depth),s.depth&&(i.style.verticalAlign=$e(-s.depth)),s.children.unshift(i),s=Ae(["thinbox"],[s],t),Ae(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Le("mpadded",[Bn(e.body,t)]);if(e.alignment!=="rlap"){var r=e.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Ke({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){var{funcName:n,parser:r}=e,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",o=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",resetFont:!0,body:o}}});Ke({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Ie("Mismatched "+e.funcName)}});var x7=(e,t)=>{switch(t.style.size){case jt.DISPLAY.size:return e.display;case jt.TEXT.size:return e.text;case jt.SCRIPT.size:return e.script;case jt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Ke({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:Ar(t[0]),text:Ar(t[1]),script:Ar(t[2]),scriptscript:Ar(t[3])}},htmlBuilder:(e,t)=>{var n=x7(e,t),r=$r(n,t,!1);return el(r)},mathmlBuilder:(e,t)=>{var n=x7(e,t);return ac(n,t)}});var MR=(e,t,n,r,s,i,o)=>{e=Ae([],[e]);var a=n&&Ja(n),l,c;if(t){var u=wn(t,r.havingStyle(s.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=wn(n,r.havingStyle(s.sub()),r);l={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-d.height)}}var f;if(c&&l){var m=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+o;f=bn({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:$e(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:$e(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=e.height-o;f=bn({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:$e(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+o;f=bn({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:$e(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var v=[f];if(l&&i!==0&&!a){var b=Ae(["mspace"],[],r);b.style.marginRight=$e(i),v.unshift(b)}return Ae(["mop","op-limits"],v,r)},NR=new Set(["\\smallint"]),Nh=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Ft(e.base,"op"),s=!0):i=Ft(e,"op");var o=t.style,a=!1;o.size===jt.DISPLAY.size&&i.symbol&&!NR.has(i.name)&&(a=!0);var l,c;if(i.symbol){var u=a?"Size2-Regular":"Size1-Regular",d="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(d=i.name.slice(1),i.name=d==="oiint"?"\\iint":"\\iiint"),l=Ts(i.name,u,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,d.length>0){var f=ZI(d+"Size"+(a?"2":"1"),t);l=bn({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:f,shift:a?.08:0}]}),i.name="\\"+d,l.classes.unshift("mop"),l.italic=c}}else if(i.body){var m=$r(i.body,t,!0);m.length===1&&m[0]instanceof _i?(l=m[0],l.classes[0]="mop"):l=Ae(["mop"],m,t)}else{for(var p=[],y=1;y<i.name.length;y++)p.push(e_(i.name[y],i.mode,t));l=Ae(["mop"],p,t)}var v=0,b=0;if((l instanceof _i||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var x;v=(l.height-l.depth)/2-t.fontMetrics().axisHeight,b=(x=l.italic)!=null?x:0}return s?MR(l,n,r,t,o,b,v):(v&&(l.style.position="relative",l.style.top=$e(v)),l)},fm=(e,t)=>{var n;if(e.symbol)n=new Le("mo",[Ji(e.name,e.mode)]),NR.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Le("mo",Si(e.body,t));else{n=new Le("mi",[new Er(e.name.slice(1))]);var r=new Le("mo",[Ji("⁡","text")]);e.parentIsSupSub?n=new Le("mrow",[n,r]):n=nR([n,r])}return n},KJ={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Ke({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:r}=e,s=r;return s.length===1&&(s=KJ[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Nh,mathmlBuilder:fm});Ke({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Ar(r)}},htmlBuilder:Nh,mathmlBuilder:fm});var YJ={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Ke({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:Nh,mathmlBuilder:fm});Ke({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:Nh,mathmlBuilder:fm});Ke({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(e){var{parser:t,funcName:n}=e,r=n;return r.length===1&&(r=YJ[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Nh,mathmlBuilder:fm});var IR=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=Ft(e.base,"operatorname"),s=!0):i=Ft(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(d=>{var f="text"in d?d.text:void 0;return typeof f=="string"?{type:"textord",mode:d.mode,text:f}:d}),l=$r(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof _i&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Ae(["mop"],l,t)}else o=Ae(["mop"],[],t);return s?MR(o,n,r,t,t.style,0,0):o},XJ=(e,t)=>{for(var n=Si(e.body,t.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof rR))if(i instanceof Le)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 Er?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(u=>u.toText()).join("");n=[new Er(a)]}var l=new Le("mi",n);l.setAttribute("mathvariant","normal");var c=new Le("mo",[Ji("⁡","text")]);return e.parentIsSupSub?new Le("mrow",[l,c]):nR([l,c])};Ke({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0];return{type:"operatorname",mode:n.mode,body:Ar(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:IR,mathmlBuilder:XJ});O("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");zu({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?el($r(e.body,t,!1)):Ae(["mord"],$r(e.body,t,!0),t)},mathmlBuilder(e,t){return ac(e.body,t,!0)}});Ke({type:"overline",names:["\\overline"],props:{numArgs:1},handler(e,t){var{parser:n}=e,r=t[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(e,t){var n=wn(e.body,t.havingCrampedStyle()),r=rh("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=bn({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return Ae(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Le("mo",[new Er("‾")]);n.setAttribute("stretchy","true");var r=new Le("mover",[Bn(e.body,t),n]);return r.setAttribute("accent","true"),r}});Ke({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"phantom",mode:n.mode,body:Ar(r)}},htmlBuilder:(e,t)=>{var n=$r(e.body,t.withPhantom(),!1);return el(n)},mathmlBuilder:(e,t)=>{var n=Si(e.body,t);return new Le("mphantom",n)}});O("\\hphantom","\\smash{\\phantom{#1}}");Ke({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(e,t)=>{var n=Ae(["inner"],[wn(e.body,t.withPhantom())]),r=Ae(["fix"],[]);return Ae(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=Si(Ar(e.body),t),r=new Le("mphantom",n),s=new Le("mpadded",[r]);return s.setAttribute("width","0px"),s}});Ke({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=Ft(t[0],"size").value,s=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(e,t){var n=wn(e.body,t),r=ir(e.dy,t);return bn({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Le("mpadded",[Bn(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});Ke({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Ke({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(e,t,n){var{parser:r}=e,s=n[0],i=Ft(t[0],"size"),o=Ft(t[1],"size");return{type:"rule",mode:r.mode,shift:s&&Ft(s,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Ae(["mord","rule"],[],t),r=ir(e.width,t),s=ir(e.height,t),i=e.shift?ir(e.shift,t):0;return n.style.borderRightWidth=$e(r),n.style.borderTopWidth=$e(s),n.style.bottom=$e(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=ir(e.width,t),r=ir(e.height,t),s=e.shift?ir(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Le("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",$e(n)),o.setAttribute("height",$e(r));var a=new Le("mpadded",[o]);return s>=0?a.setAttribute("height",$e(s)):(a.setAttribute("height",$e(s)),a.setAttribute("depth",$e(-s))),a.setAttribute("voffset",$e(s)),a}});function RR(e,t,n){for(var r=$r(e,t,!1),s=t.sizeMultiplier/n.sizeMultiplier,i=0;i<r.length;i++){var o=r[i].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[i].classes,t.sizingClasses(n)):r[i].classes[o+1]==="reset-size"+t.size&&(r[i].classes[o+1]="reset-size"+n.size),r[i].height*=s,r[i].depth*=s}return el(r)}var w7=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],QJ=(e,t)=>{var n=t.havingSize(e.size);return RR(e.body,n,t)};Ke({type:"sizing",names:w7,props:{numArgs:0,allowedInText:!0},handler:(e,t)=>{var{breakOnTokenText:n,funcName:r,parser:s}=e,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:w7.indexOf(r)+1,body:i}},htmlBuilder:QJ,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=Si(e.body,n),s=new Le("mstyle",r);return s.setAttribute("mathsize",$e(n.sizeMultiplier)),s}});Ke({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(e,t,n)=>{var{parser:r}=e,s=!1,i=!1,o=n[0]&&Ft(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=By(c).text,a==="t")s=!0;else if(a==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var u=t[0];return{type:"smash",mode:r.mode,body:u,smashHeight:s,smashDepth:i}},htmlBuilder:(e,t)=>{var n=Ae([],[wn(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 Ae(["mord","smash"],[n],t);if(n.children)for(var r=0;r<n.children.length;r++)e.smashHeight&&(n.children[r].height=0),e.smashDepth&&(n.children[r].depth=0);var s=bn({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Ae(["mord"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Le("mpadded",[Bn(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Ke({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(e,t,n){var{parser:r}=e,s=n[0],i=t[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(e,t){var n=wn(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=sh(n,t);var r=t.fontMetrics(),s=r.defaultRuleThickness,i=s;t.style.id<jt.TEXT.id&&(i=t.fontMetrics().xHeight);var o=s+i/4,a=n.height+n.depth+o+s,{span:l,ruleWidth:c,advanceWidth:u}=BJ(a,t),d=l.height-c;d>n.height+n.depth+o&&(o=(o+d-n.height-n.depth)/2);var f=l.height-n.height-o-c;n.style.paddingLeft=$e(u);var m=bn({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(jt.SCRIPTSCRIPT),y=wn(e.index,p,t),v=.6*(m.height-m.depth),b=bn({positionType:"shift",positionData:-v,children:[{type:"elem",elem:y}]}),x=Ae(["root"],[b]);return Ae(["mord","sqrt"],[x,m],t)}else return Ae(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new Le("mroot",[Bn(n,t),Bn(r,t)]):new Le("msqrt",[Bn(n,t)])}});var qw={display:jt.DISPLAY,text:jt.TEXT,script:jt.SCRIPT,scriptscript:jt.SCRIPTSCRIPT};function JJ(e){return e in qw}Ke({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e,t){var{breakOnTokenText:n,funcName:r,parser:s}=e,i=s.parseExpression(!0,n),o=r.slice(1,r.length-5);if(!JJ(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(e,t){var n=qw[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),RR(e.body,r,t)},mathmlBuilder(e,t){var n=qw[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var s=Si(e.body,r),i=new Le("mstyle",s),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 ZJ=function(t,n){var r=t.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===jt.DISPLAY.size||r.alwaysHandleSupSub);return s?Nh:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===jt.DISPLAY.size||r.limits);return i?IR:null}else{if(r.type==="accent")return Ja(r.base)?s_:null;if(r.type==="horizBrace"){var o=!t.sub;return o===r.isOver?ER:null}else return null}else return null};zu({type:"supsub",htmlBuilder(e,t){var n=ZJ(e,t);if(n)return n(e,t);var{base:r,sup:s,sub:i}=e,o=wn(r,t),a,l,c=t.fontMetrics(),u=0,d=0,f=r&&Ja(r);if(s){var m=t.havingStyle(t.style.sup());a=wn(s,m,t),f||(u=o.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(i){var p=t.havingStyle(t.style.sub());l=wn(i,p,t),f||(d=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/t.sizeMultiplier)}var y;t.style===jt.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var v=t.sizeMultiplier,b=$e(.5/c.ptPerEm/v),x=null;if(l){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof _i||w){var k;x=$e(-((k=o.italic)!=null?k:0))}}var T;if(a&&l){u=Math.max(u,y,a.depth+.25*c.xHeight),d=Math.max(d,c.sub2);var C=c.defaultRuleThickness,A=4*C;if(u-a.depth-(l.height-d)<A){d=A-(u-a.depth)+l.height;var L=.8*c.xHeight-(u-a.depth);L>0&&(u+=L,d-=L)}var $=[{type:"elem",elem:l,shift:d,marginRight:b,marginLeft:x},{type:"elem",elem:a,shift:-u,marginRight:b}];T=bn({positionType:"individualShift",children:$})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var E=[{type:"elem",elem:l,marginLeft:x,marginRight:b}];T=bn({positionType:"shift",positionData:d,children:E})}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),T=bn({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:b}]});else throw new Error("supsub must have either sup or sub.");var z=Ow(o,"right")||"mord";return Ae([z],[o,Ae(["msupsub"],[T])],t)},mathmlBuilder(e,t){var n=!1,r,s;e.base&&e.base.type==="horizBrace"&&(s=!!e.sup,s===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&(e.base.type==="op"||e.base.type==="operatorname")&&(e.base.parentIsSupSub=!0);var i=[Bn(e.base,t)];e.sub&&i.push(Bn(e.sub,t)),e.sup&&i.push(Bn(e.sup,t));var o;if(n)o=r?"mover":"munder";else if(e.sub)if(e.sup){var c=e.base;c&&c.type==="op"&&c.limits&&t.style===jt.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===jt.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===jt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===jt.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===jt.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===jt.DISPLAY)?o="mover":o="msup"}return new Le(o,i)}});zu({type:"atom",htmlBuilder(e,t){return e_(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Le("mo",[Ji(e.text,e.mode)]);if(e.family==="bin"){var r=r_(e,t);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else e.family==="punct"?n.setAttribute("separator","true"):(e.family==="open"||e.family==="close")&&n.setAttribute("stretchy","false");return n}});var jR={mi:"italic",mn:"normal",mtext:"normal"};zu({type:"mathord",htmlBuilder(e,t){return Ly(e,t,"mathord")},mathmlBuilder(e,t){var n=new Le("mi",[Ji(e.text,e.mode,t)]),r=r_(e,t)||"italic";return r!==jR[n.type]&&n.setAttribute("mathvariant",r),n}});zu({type:"textord",htmlBuilder(e,t){return Ly(e,t,"textord")},mathmlBuilder(e,t){var n=Ji(e.text,e.mode,t),r=r_(e,t)||"normal",s;return e.mode==="text"?s=new Le("mtext",[n]):/[0-9]/.test(e.text)?s=new Le("mn",[n]):e.text==="\\prime"?s=new Le("mo",[n]):s=new Le("mi",[n]),r!==jR[s.type]&&s.setAttribute("mathvariant",r),s}});var n4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},r4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};zu({type:"spacing",htmlBuilder(e,t){if(r4.hasOwnProperty(e.text)){var n=r4[e.text].className||"";if(e.mode==="text"){var r=Ly(e,t,"textord");return r.classes.push(n),r}else return Ae(["mspace",n],[e_(e.text,e.mode,t)],t)}else{if(n4.hasOwnProperty(e.text))return Ae(["mspace",n4[e.text]],[],t);throw new Ie('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(r4.hasOwnProperty(e.text))n=new Le("mtext",[new Er(" ")]);else{if(n4.hasOwnProperty(e.text))return new Le("mspace");throw new Ie('Unknown type of space "'+e.text+'"')}return n}});var v7=()=>{var e=new Le("mtd",[]);return e.setAttribute("width","50%"),e};zu({type:"tag",mathmlBuilder(e,t){var n=new Le("mtable",[new Le("mtr",[v7(),new Le("mtd",[ac(e.body,t)]),v7(),new Le("mtd",[ac(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var _7={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},k7={"\\textbf":"textbf","\\textmd":"textmd"},eZ={"\\textit":"textit","\\textup":"textup"},S7=(e,t)=>{var n=e.font;if(n){if(_7[n])return t.withTextFontFamily(_7[n]);if(k7[n])return t.withTextFontWeight(k7[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(eZ[n])};Ke({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:r}=e,s=t[0];return{type:"text",mode:n.mode,body:Ar(s),font:r}},htmlBuilder(e,t){var n=S7(e,t),r=$r(e.body,n,!0);return Ae(["mord","text"],r,n)},mathmlBuilder(e,t){var n=S7(e,t);return ac(e.body,n)}});Ke({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=wn(e.body,t),r=rh("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=bn({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]});return Ae(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Le("mo",[new Er("‾")]);n.setAttribute("stretchy","true");var r=new Le("munder",[Bn(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});Ke({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=wn(e.body,t),r=t.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return bn({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Le("mpadded",[Bn(e.body,t)],["vcenter"]);return new Le("mrow",[n])}});Ke({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Ie("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=T7(e),r=[],s=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),r.push(Ts(o,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return Ae(["mord","text"].concat(s.sizingClasses(t)),XI(r),s)},mathmlBuilder(e,t){var n=new Er(T7(e)),r=new Le("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var T7=e=>e.body.replace(/ /g,e.star?"␣":" "),Ol=eR,LR=`[ \r
	]`,tZ="\\\\[a-zA-Z@]+",nZ="\\\\[^\uD800-\uDFFF]",rZ="("+tZ+")"+LR+"*",sZ=`\\\\(
|[ \r	]+
?)[ \r	]*`,Fw="[̀-ͯ]",iZ=new RegExp(Fw+"+$"),oZ="("+LR+"+)|"+(sZ+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(Fw+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(Fw+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+rZ)+("|"+nZ+")");class C7{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(oZ,"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 xi("EOF",new Hs(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new Ie("Unexpected character: '"+t[n]+"'",new xi(t[n],new Hs(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===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 xi(s,new Hs(this,n,this.tokenRegex.lastIndex))}}class aZ{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 Ie("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,r){if(r===void 0&&(r=!1),r){for(var s=0;s<this.undefStack.length;s++)delete this.undefStack[s][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 lZ=kR;O("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});O("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});O("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});O("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});O("\\@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}});O("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");O("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var A7={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};O("\\char",function(e){var t=e.popToken(),n,r=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]==="\\")r=t.text.charCodeAt(1);else{if(t.text==="EOF")throw new Ie("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=A7[t.text],r==null||r>=n)throw new Ie("Invalid base-"+n+" digit "+t.text);for(var s;(s=A7[e.future().text])!=null&&s<n;)r*=n,r+=s,e.popToken()}return"\\@char{"+r+"}"});var l_=(e,t,n,r)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new Ie("\\newcommand's first argument must be a macro name");var i=s[0].text,o=e.isDefined(i);if(o&&!t)throw new Ie("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new Ie("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var a=0;if(s=e.consumeArg().tokens,s.length===1&&s[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 Ie("Invalid number of arguments: "+l);a=parseInt(l),s=e.consumeArg().tokens}return o&&r||e.macros.set(i,{tokens:s,numArgs:a}),""};O("\\newcommand",e=>l_(e,!1,!0,!1));O("\\renewcommand",e=>l_(e,!0,!1,!1));O("\\providecommand",e=>l_(e,!0,!0,!0));O("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});O("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});O("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Ol[n],Jn.math[n],Jn.text[n]),""});O("\\bgroup","{");O("\\egroup","}");O("~","\\nobreakspace");O("\\lq","`");O("\\rq","'");O("\\aa","\\r a");O("\\AA","\\r A");O("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");O("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");O("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");O("ℬ","\\mathscr{B}");O("ℰ","\\mathscr{E}");O("ℱ","\\mathscr{F}");O("ℋ","\\mathscr{H}");O("ℐ","\\mathscr{I}");O("ℒ","\\mathscr{L}");O("ℳ","\\mathscr{M}");O("ℛ","\\mathscr{R}");O("ℭ","\\mathfrak{C}");O("ℌ","\\mathfrak{H}");O("ℨ","\\mathfrak{Z}");O("\\Bbbk","\\Bbb{k}");O("\\llap","\\mathllap{\\textrm{#1}}");O("\\rlap","\\mathrlap{\\textrm{#1}}");O("\\clap","\\mathclap{\\textrm{#1}}");O("\\mathstrut","\\vphantom{(}");O("\\underbar","\\underline{\\text{#1}}");O("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');O("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");O("\\ne","\\neq");O("≠","\\neq");O("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");O("∉","\\notin");O("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");O("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");O("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");O("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");O("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");O("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");O("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");O("⟂","\\perp");O("‼","\\mathclose{!\\mkern-0.8mu!}");O("∌","\\notni");O("⌜","\\ulcorner");O("⌝","\\urcorner");O("⌞","\\llcorner");O("⌟","\\lrcorner");O("©","\\copyright");O("®","\\textregistered");O("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');O("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');O("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');O("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');O("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");O("⋮","\\vdots");O("\\varGamma","\\mathit{\\Gamma}");O("\\varDelta","\\mathit{\\Delta}");O("\\varTheta","\\mathit{\\Theta}");O("\\varLambda","\\mathit{\\Lambda}");O("\\varXi","\\mathit{\\Xi}");O("\\varPi","\\mathit{\\Pi}");O("\\varSigma","\\mathit{\\Sigma}");O("\\varUpsilon","\\mathit{\\Upsilon}");O("\\varPhi","\\mathit{\\Phi}");O("\\varPsi","\\mathit{\\Psi}");O("\\varOmega","\\mathit{\\Omega}");O("\\substack","\\begin{subarray}{c}#1\\end{subarray}");O("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");O("\\boxed","\\fbox{$\\displaystyle{#1}$}");O("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");O("\\implies","\\DOTSB\\;\\Longrightarrow\\;");O("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");O("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");O("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var E7={",":"\\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"},cZ=new Set(["bin","rel"]);O("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in E7?t=E7[n]:(n.slice(0,4)==="\\not"||n in Jn.math&&cZ.has(Jn.math[n].group))&&(t="\\dotsb"),t});var c_={")":!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};O("\\dotso",function(e){var t=e.future().text;return t in c_?"\\ldots\\,":"\\ldots"});O("\\dotsc",function(e){var t=e.future().text;return t in c_&&t!==","?"\\ldots\\,":"\\ldots"});O("\\cdots",function(e){var t=e.future().text;return t in c_?"\\@cdots\\,":"\\@cdots"});O("\\dotsb","\\cdots");O("\\dotsm","\\cdots");O("\\dotsi","\\!\\cdots");O("\\dotsx","\\ldots\\,");O("\\DOTSI","\\relax");O("\\DOTSB","\\relax");O("\\DOTSX","\\relax");O("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");O("\\,","\\tmspace+{3mu}{.1667em}");O("\\thinspace","\\,");O("\\>","\\mskip{4mu}");O("\\:","\\tmspace+{4mu}{.2222em}");O("\\medspace","\\:");O("\\;","\\tmspace+{5mu}{.2777em}");O("\\thickspace","\\;");O("\\!","\\tmspace-{3mu}{.1667em}");O("\\negthinspace","\\!");O("\\negmedspace","\\tmspace-{4mu}{.2222em}");O("\\negthickspace","\\tmspace-{5mu}{.277em}");O("\\enspace","\\kern.5em ");O("\\enskip","\\hskip.5em\\relax");O("\\quad","\\hskip1em\\relax");O("\\qquad","\\hskip2em\\relax");O("\\tag","\\@ifstar\\tag@literal\\tag@paren");O("\\tag@paren","\\tag@literal{({#1})}");O("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Ie("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});O("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");O("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");O("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");O("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");O("\\newline","\\\\\\relax");O("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var DR=$e(Uo["Main-Regular"][84][1]-.7*Uo["Main-Regular"][65][1]);O("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+DR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");O("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+DR+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");O("\\hspace","\\@ifstar\\@hspacer\\@hspace");O("\\@hspace","\\hskip #1\\relax");O("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");O("\\ordinarycolon",":");O("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");O("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');O("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');O("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');O("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');O("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');O("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');O("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');O("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');O("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');O("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');O("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');O("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');O("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');O("∷","\\dblcolon");O("∹","\\eqcolon");O("≔","\\coloneqq");O("≕","\\eqqcolon");O("⩴","\\Coloneqq");O("\\ratio","\\vcentcolon");O("\\coloncolon","\\dblcolon");O("\\colonequals","\\coloneqq");O("\\coloncolonequals","\\Coloneqq");O("\\equalscolon","\\eqqcolon");O("\\equalscoloncolon","\\Eqqcolon");O("\\colonminus","\\coloneq");O("\\coloncolonminus","\\Coloneq");O("\\minuscolon","\\eqcolon");O("\\minuscoloncolon","\\Eqcolon");O("\\coloncolonapprox","\\Colonapprox");O("\\coloncolonsim","\\Colonsim");O("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");O("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");O("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");O("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");O("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");O("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");O("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");O("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");O("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");O("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");O("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");O("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");O("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");O("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");O("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");O("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");O("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");O("\\nleqq","\\html@mathml{\\@nleqq}{≰}");O("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");O("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");O("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");O("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");O("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");O("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");O("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");O("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");O("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");O("\\imath","\\html@mathml{\\@imath}{ı}");O("\\jmath","\\html@mathml{\\@jmath}{ȷ}");O("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");O("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");O("⟦","\\llbracket");O("⟧","\\rrbracket");O("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");O("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");O("⦃","\\lBrace");O("⦄","\\rBrace");O("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");O("⦵","\\minuso");O("\\darr","\\downarrow");O("\\dArr","\\Downarrow");O("\\Darr","\\Downarrow");O("\\lang","\\langle");O("\\rang","\\rangle");O("\\uarr","\\uparrow");O("\\uArr","\\Uparrow");O("\\Uarr","\\Uparrow");O("\\N","\\mathbb{N}");O("\\R","\\mathbb{R}");O("\\Z","\\mathbb{Z}");O("\\alef","\\aleph");O("\\alefsym","\\aleph");O("\\Alpha","\\mathrm{A}");O("\\Beta","\\mathrm{B}");O("\\bull","\\bullet");O("\\Chi","\\mathrm{X}");O("\\clubs","\\clubsuit");O("\\cnums","\\mathbb{C}");O("\\Complex","\\mathbb{C}");O("\\Dagger","\\ddagger");O("\\diamonds","\\diamondsuit");O("\\empty","\\emptyset");O("\\Epsilon","\\mathrm{E}");O("\\Eta","\\mathrm{H}");O("\\exist","\\exists");O("\\harr","\\leftrightarrow");O("\\hArr","\\Leftrightarrow");O("\\Harr","\\Leftrightarrow");O("\\hearts","\\heartsuit");O("\\image","\\Im");O("\\infin","\\infty");O("\\Iota","\\mathrm{I}");O("\\isin","\\in");O("\\Kappa","\\mathrm{K}");O("\\larr","\\leftarrow");O("\\lArr","\\Leftarrow");O("\\Larr","\\Leftarrow");O("\\lrarr","\\leftrightarrow");O("\\lrArr","\\Leftrightarrow");O("\\Lrarr","\\Leftrightarrow");O("\\Mu","\\mathrm{M}");O("\\natnums","\\mathbb{N}");O("\\Nu","\\mathrm{N}");O("\\Omicron","\\mathrm{O}");O("\\plusmn","\\pm");O("\\rarr","\\rightarrow");O("\\rArr","\\Rightarrow");O("\\Rarr","\\Rightarrow");O("\\real","\\Re");O("\\reals","\\mathbb{R}");O("\\Reals","\\mathbb{R}");O("\\Rho","\\mathrm{P}");O("\\sdot","\\cdot");O("\\sect","\\S");O("\\spades","\\spadesuit");O("\\sub","\\subset");O("\\sube","\\subseteq");O("\\supe","\\supseteq");O("\\Tau","\\mathrm{T}");O("\\thetasym","\\vartheta");O("\\weierp","\\wp");O("\\Zeta","\\mathrm{Z}");O("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");O("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");O("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");O("\\bra","\\mathinner{\\langle{#1}|}");O("\\ket","\\mathinner{|{#1}\\rangle}");O("\\braket","\\mathinner{\\langle{#1}\\rangle}");O("\\Bra","\\left\\langle#1\\right|");O("\\Ket","\\left|#1\\right\\rangle");var OR=e=>t=>{var n=t.consumeArg().tokens,r=t.consumeArg().tokens,s=t.consumeArg().tokens,i=t.consumeArg().tokens,o=t.macros.get("|"),a=t.macros.get("\\|");t.macros.beginGroup();var l=d=>f=>{e&&(f.macros.set("|",o),s.length&&f.macros.set("\\|",a));var m=d;if(!d&&s.length){var p=f.future();p.text==="|"&&(f.popToken(),m=!0)}return{tokens:m?s:r,numArgs:0}};t.macros.set("|",l(!1)),s.length&&t.macros.set("\\|",l(!0));var c=t.consumeArg().tokens,u=t.expandTokens([...i,...c,...n]);return t.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};O("\\bra@ket",OR(!1));O("\\bra@set",OR(!0));O("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");O("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");O("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");O("\\angln","{\\angl n}");O("\\blue","\\textcolor{##6495ed}{#1}");O("\\orange","\\textcolor{##ffa500}{#1}");O("\\pink","\\textcolor{##ff00af}{#1}");O("\\red","\\textcolor{##df0030}{#1}");O("\\green","\\textcolor{##28ae7b}{#1}");O("\\gray","\\textcolor{gray}{#1}");O("\\purple","\\textcolor{##9d38bd}{#1}");O("\\blueA","\\textcolor{##ccfaff}{#1}");O("\\blueB","\\textcolor{##80f6ff}{#1}");O("\\blueC","\\textcolor{##63d9ea}{#1}");O("\\blueD","\\textcolor{##11accd}{#1}");O("\\blueE","\\textcolor{##0c7f99}{#1}");O("\\tealA","\\textcolor{##94fff5}{#1}");O("\\tealB","\\textcolor{##26edd5}{#1}");O("\\tealC","\\textcolor{##01d1c1}{#1}");O("\\tealD","\\textcolor{##01a995}{#1}");O("\\tealE","\\textcolor{##208170}{#1}");O("\\greenA","\\textcolor{##b6ffb0}{#1}");O("\\greenB","\\textcolor{##8af281}{#1}");O("\\greenC","\\textcolor{##74cf70}{#1}");O("\\greenD","\\textcolor{##1fab54}{#1}");O("\\greenE","\\textcolor{##0d923f}{#1}");O("\\goldA","\\textcolor{##ffd0a9}{#1}");O("\\goldB","\\textcolor{##ffbb71}{#1}");O("\\goldC","\\textcolor{##ff9c39}{#1}");O("\\goldD","\\textcolor{##e07d10}{#1}");O("\\goldE","\\textcolor{##a75a05}{#1}");O("\\redA","\\textcolor{##fca9a9}{#1}");O("\\redB","\\textcolor{##ff8482}{#1}");O("\\redC","\\textcolor{##f9685d}{#1}");O("\\redD","\\textcolor{##e84d39}{#1}");O("\\redE","\\textcolor{##bc2612}{#1}");O("\\maroonA","\\textcolor{##ffbde0}{#1}");O("\\maroonB","\\textcolor{##ff92c6}{#1}");O("\\maroonC","\\textcolor{##ed5fa6}{#1}");O("\\maroonD","\\textcolor{##ca337c}{#1}");O("\\maroonE","\\textcolor{##9e034e}{#1}");O("\\purpleA","\\textcolor{##ddd7ff}{#1}");O("\\purpleB","\\textcolor{##c6b9fc}{#1}");O("\\purpleC","\\textcolor{##aa87ff}{#1}");O("\\purpleD","\\textcolor{##7854ab}{#1}");O("\\purpleE","\\textcolor{##543b78}{#1}");O("\\mintA","\\textcolor{##f5f9e8}{#1}");O("\\mintB","\\textcolor{##edf2df}{#1}");O("\\mintC","\\textcolor{##e0e5cc}{#1}");O("\\grayA","\\textcolor{##f6f7f7}{#1}");O("\\grayB","\\textcolor{##f0f1f2}{#1}");O("\\grayC","\\textcolor{##e3e5e6}{#1}");O("\\grayD","\\textcolor{##d6d8da}{#1}");O("\\grayE","\\textcolor{##babec2}{#1}");O("\\grayF","\\textcolor{##888d93}{#1}");O("\\grayG","\\textcolor{##626569}{#1}");O("\\grayH","\\textcolor{##3b3e40}{#1}");O("\\grayI","\\textcolor{##21242c}{#1}");O("\\kaBlue","\\textcolor{##314453}{#1}");O("\\kaGreen","\\textcolor{##71B307}{#1}");var BR={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class uZ{constructor(t,n,r){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 aZ(lZ,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new C7(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,r,s;if(t){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new xi("EOF",r.loc)),this.pushTokens(s),new xi("",Hs.range(n,r))}consumeSpaces(){for(;;){var t=this.future();if(t.text===" ")this.stack.pop();else break}}consumeArg(t){var n=[],r=t&&t.length>0;r||this.consumeSpaces();var s=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 Ie("Extra }",i)}else if(i.text==="EOF")throw new Ie("Unexpected end of input in a macro argument, expected '"+(t&&r?t[a]:"}")+"'",i);if(t&&r)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||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(t,n){if(n){if(n.length!==t+1)throw new Ie("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;s<r.length;s++){var i=this.popToken();if(r[s]!==i.text)throw new Ie("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 Ie("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(t){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||t&&s.unexpandable){if(t&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new Ie("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,o=this.consumeArgs(s.numArgs,s.delimiters);if(s.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 Ie("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 Ie("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 xi(t)]):void 0}expandTokens(t){var n=[],r=this.stack.length;for(this.pushTokens(t);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(t){var n=this.expandMacro(t);return n&&n.map(r=>r.text).join("")}_getExpansion(t){var n=this.macros.get(t);if(n==null)return n;if(t.length===1){var r=this.lexer.catcodes[t];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.includes("#"))for(var o=s.replace(/##/g,"");o.includes("#"+(i+1));)++i;for(var a=new C7(s,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var u={tokens:l,numArgs:i};return u}return s}isDefined(t){return this.macros.has(t)||Ol.hasOwnProperty(t)||Jn.math.hasOwnProperty(t)||Jn.text.hasOwnProperty(t)||BR.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Ol.hasOwnProperty(t)&&!Ol[t].primitive}}var M7=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,dp=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),s4={"́":{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"}},N7={á:"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 $R=class zR{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 uZ(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 Ie("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 xi("}")),this.gullet.pushTokens(t);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(t,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(zR.endOfExpression.has(s.text)||n&&s.text===n||t&&Ol[s.text]&&Ol[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(t){for(var n=-1,r,s=0;s<t.length;s++){var i=t[s];if(i.type==="infix"){if(n!==-1)throw new Ie("only one infix operator per group",i.token);n=s,r=i.replaceWith}}if(n!==-1&&r){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 u;return r==="\\\\abovefrac"?u=this.callFunction(r,[o,t[n],a],[]):u=this.callFunction(r,[o,a],[]),[u]}else return t}handleSupSubscript(t){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var s;do{var i;s=this.parseGroup(t)}while(((i=s)==null?void 0:i.type)==="internal");if(!s)throw new Ie("Expected group after '"+r+"'",n);return s}formatUnsupportedCmd(t){for(var n=[],r=0;r<t.length;r++)n.push({type:"textord",mode:"text",text:t[r]});var s={type:"text",mode:this.mode,body:n},i={type:"color",mode:this.mode,color:this.settings.errorColor,body:[s]};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 r,s;;){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 Ie("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new Ie("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new Ie("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new Ie("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")),r={type:"ordgroup",mode:this.mode,body:l}}else if(dp[i.text]){var c=M7.test(i.text),u=[];for(u.push(new xi(dp[i.text])),this.consume();;){var d=this.fetch().text;if(!dp[d]||M7.test(d)!==c)break;u.unshift(new xi(dp[d])),this.consume()}var f=this.subparse(u);c?s={type:"ordgroup",mode:"math",body:f}:r={type:"ordgroup",mode:"math",body:f}}else break}return r||s?{type:"supsub",mode:this.mode,base:n,sup:r,sub:s}:n}parseFunction(t,n){var r=this.fetch(),s=r.text,i=Ol[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Ie("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new Ie("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new Ie("Can't use function '"+s+"' in math mode",r);var{args:o,optArgs:a}=this.parseArguments(s,i);return this.callFunction(s,o,a,r,t)}callFunction(t,n,r,s,i){var o={funcName:t,parser:this,token:s,breakOnTokenText:i},a=Ol[t];if(a&&a.handler)return a.handler(o,n,r);throw new Ie("No function handler for "+t)}parseArguments(t,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var s=[],i=[],o=0;o<r;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)s.push(c);else throw new Ie("Null argument, please report this as a bug")}return{args:s,optArgs:i}}parseGroupOfType(t,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var s=this.parseArgumentGroup(r,"text");return s!=null?{type:"styling",mode:s.mode,body:[s],style:"text",resetFont:!0}:null}case"raw":{var i=this.parseStringGroup("raw",r);return i!=null?{type:"raw",mode:"text",string:i.text}:null}case"primitive":{if(r)throw new Ie("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new Ie("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Ie("Unknown group type as "+t,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(t,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var s="",i;(i=this.fetch()).text!=="EOF";)s+=i.text,this.consume();return this.consume(),r.text=s,r}parseRegexGroup(t,n){for(var r=this.fetch(),s=r,i="",o;(o=this.fetch()).text!=="EOF"&&t.test(i+o.text);)s=o,i+=s.text,this.consume();if(i==="")throw new Ie("Invalid "+n+": '"+r.text+"'",r);return r.range(s,i)}parseColorGroup(t){var n=this.parseStringGroup("color",t);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new Ie("Invalid color: '"+n.text+"'",n);var s=r[0];return/^[0-9a-f]{6}$/i.test(s)&&(s="#"+s),{type:"color-token",mode:this.mode,color:s}}parseSizeGroup(t){var n,r=!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",r=!0);var s=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!s)throw new Ie("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!HI(i))throw new Ie("Invalid unit: '"+i.unit+"'",n);return{type:"size",mode:this.mode,value:i,isBlank:r}}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 r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(t,n){var r=this.gullet.scanArgument(t);if(r==null)return null;var s=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:r.loc,body:i};return n&&this.switchMode(s),o}parseGroup(t,n){var r=this.fetch(),s=r.text,i;if(s==="{"||s==="\\begingroup"){this.consume();var o=s==="{"?"}":"\\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:Hs.range(r,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!BR.hasOwnProperty(s)){if(this.settings.throwOnError)throw new Ie("Undefined control sequence: "+s,r);i=this.formatUnsupportedCmd(s),this.consume()}return i}formLigatures(t){for(var n=t.length-1,r=0;r<n;++r){var s=t[r];if(s.type==="textord"){var i=s.text,o=t[r+1];if(!(!o||o.type!=="textord")){if(i==="-"&&o.text==="-"){var a=t[r+2];r+1<n&&a&&a.type==="textord"&&a.text==="-"?(t.splice(r,3,{type:"textord",mode:"text",loc:Hs.range(s,a),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:Hs.range(s,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:Hs.range(s,o),text:i+i}),n-=1)}}}}parseSymbol(){var t=this.fetch(),n=t.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),s=r.charAt(0)==="*";if(s&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new Ie(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}N7.hasOwnProperty(n[0])&&!Jn[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=N7[n[0]]+n.slice(1));var i=iZ.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(Jn[this.mode][n]){this.settings.strict&&this.mode==="math"&&Ew.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=Jn[this.mode][n].group,l=Hs.range(t),c;CJ(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&&(UI(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:Hs.range(t),text:n};else return null;if(this.consume(),i)for(var u=0;u<i[0].length;u++){var d=i[0][u];if(!s4[d])throw new Ie("Unknown accent ' "+d+"'",t);var f=s4[d][this.mode]||s4[d].text;if(!f)throw new Ie("Accent "+d+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:Hs.range(t),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}};$R.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var u_=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new $R(t,n);delete r.gullet.macros.current["\\df@tag"];var s=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new Ie("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new xi("\\df@tag")])}]}return s},d_=function(t,n,r){n.textContent="";var s=Hy(t,r).toNode();n.appendChild(s)};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."),d_=function(){throw new Ie("KaTeX doesn't work in quirks mode.")});var PR=function(t,n){var r=Hy(t,n).toMarkup();return r},qR=function(t,n){var r=new X5(n);return u_(t,r)},FR=function(t,n,r){if(r.throwOnError||!(t instanceof Ie))throw t;var s=Ae(["katex-error"],[new _i(n)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+r.errorColor),s},Hy=function(t,n){var r=new X5(n);try{var s=u_(t,r);return bJ(s,t,r)}catch(i){return FR(i,t,r)}},UR=function(t,n){var r=new X5(n);try{var s=u_(t,r);return xJ(s,t,r)}catch(i){return FR(i,t,r)}},HR="0.16.47",VR={Span:Eh,Anchor:Ry,SymbolNode:_i,SvgNode:Ga,PathNode:ic,LineNode:Aw},Uw={version:HR,render:d_,renderToString:PR,ParseError:Ie,SETTINGS_SCHEMA:f1,__parse:qR,__renderToDomTree:Hy,__renderToHTMLTree:UR,__setFontMetrics:KI,__defineSymbol:_,__defineFunction:Ke,__defineMacro:O,__domTree:VR};const u9e=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Ie,SETTINGS_SCHEMA:f1,__defineFunction:Ke,__defineMacro:O,__defineSymbol:_,__domTree:VR,__parse:qR,__renderToDomTree:Hy,__renderToHTMLTree:UR,__setFontMetrics:KI,default:Uw,get render(){return d_},renderToString:PR,version:HR},Symbol.toStringTag,{value:"Module"})),dZ={};function I7(e){const t=this,n=e||dZ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(xQ(n)),i.push(dQ()),o.push(hQ(n))}const R7=/[#.]/g;function hZ(e,t){const n=e||"",r={};let s=0,i,o;for(;s<n.length;){R7.lastIndex=s;const a=R7.exec(n),l=n.slice(s,a?a.index:n.length);l&&(i?i==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,s+=l.length),a&&(i=a[0],s++)}return{type:"element",tagName:o||t||"div",properties:r,children:[]}}function WR(e,t,n){const r=n?gZ(n):void 0;function s(i,o,...a){let l;if(i==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=hZ(i,t);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,fZ(o))a.unshift(o);else for(const[d,f]of Object.entries(o))mZ(e,l.properties,d,f)}for(const c of a)Hw(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return s}function fZ(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 r of n){const s=t[r];if(s&&typeof s=="object"){if(!Array.isArray(s))return!0;const i=s;for(const o of i)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function mZ(e,t,n,r){const s=N5(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?s.spaceSeparated?i=Zk(r):s.commaSeparated?i=Kk(r):s.commaOrSpaceSeparated?i=Zk(Kk(r).join(" ")):i=j7(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?pZ(r):String(r);if(Array.isArray(i)){const o=[];for(const a of i)o.push(j7(s,s.property,a));i=o}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function Hw(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)Hw(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?Hw(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function j7(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||T0(n)===T0(t)))return!0}return n}function pZ(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function gZ(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const yZ=["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"],bZ=WR(I5,"div"),xZ=WR(Th,"g",yZ),i4={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function wZ(e,t){return GR(e,{})||{type:"root",children:[]}}function GR(e,t){const n=vZ(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function vZ(e,t){switch(e.nodeType){case 1:return TZ(e,t);case 3:return kZ(e);case 8:return SZ(e);case 9:return L7(e,t);case 10:return _Z();case 11:return L7(e,t);default:return}}function L7(e,t){return{type:"root",children:KR(e,t)}}function _Z(){return{type:"doctype"}}function kZ(e){return{type:"text",value:e.nodeValue||""}}function SZ(e){return{type:"comment",value:e.nodeValue||""}}function TZ(e,t){const n=e.namespaceURI,r=n===i4.svg?xZ:bZ,s=n===i4.html?e.tagName.toLowerCase():e.tagName,i=n===i4.html&&s==="template"?e.content:e,o=e.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=e.getAttribute(o[l])||"";return r(s,a,KR(i,t))}function KR(e,t){const n=e.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=GR(n[s],t);i!==void 0&&r.push(i)}return r}new DOMParser;function CZ(e,t){const n=AZ(e);return wZ(n)}function AZ(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const D7=function(e,t,n){const r=um(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(r(e.children[t],t,e))return e.children[t]},Pu=function(e){if(e==null)return NZ;if(typeof e=="string")return MZ(e);if(typeof e=="object")return EZ(e);if(typeof e=="function")return h_(e);throw new Error("Expected function, string, or array as `test`")};function EZ(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Pu(e[n]);return h_(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function MZ(e){return h_(t);function t(n){return n.tagName===e}}function h_(e){return t;function t(n,r,s){return!!(IZ(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function NZ(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function IZ(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const O7=/\n/g,B7=/[\t ]+/g,Vw=Pu("br"),$7=Pu(zZ),RZ=Pu("p"),z7=Pu("tr"),jZ=Pu(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",$Z,PZ]),YR=Pu(["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 LZ(e,t){const n=t||{},r="children"in e?e.children:[],s=YR(e),i=JR(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...QR(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...XR(r[a],e,{whitespace:i,breakBefore:a?void 0:s,breakAfter:a<r.length-1?Vw(r[a+1]):s}));const l=[];let c;for(a=-1;++a<o.length;){const u=o[a];typeof u=="number"?c!==void 0&&u>c&&(c=u):u&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(u))}return l.join("")}function XR(e,t,n){return e.type==="element"?DZ(e,t,n):e.type==="text"?n.whitespace==="normal"?QR(e,n):OZ(e):[]}function DZ(e,t,n){const r=JR(e,n),s=e.children||[];let i=-1,o=[];if(jZ(e))return o;let a,l;for(Vw(e)||z7(e)&&D7(t,e,z7)?l=`
`:RZ(e)?(a=2,l=2):YR(e)&&(a=1,l=1);++i<s.length;)o=o.concat(XR(s[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<s.length-1?Vw(s[i+1]):l}));return $7(e)&&D7(t,e,$7)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function QR(e,t){const n=String(e.value),r=[],s=[];let i=0;for(;i<=n.length;){O7.lastIndex=i;const l=O7.exec(n),c=l&&"index"in l?l.index:n.length;r.push(BZ(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<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(s.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&s.push(a),s.push(r[o]),a=0):(o===0||o===r.length-1)&&s.push(0);return s}function OZ(e){return[String(e.value)]}function BZ(e,t,n){const r=[];let s=0,i;for(;s<e.length;){B7.lastIndex=s;const o=B7.exec(e);i=o?o.index:e.length,!s&&!i&&o&&!t&&r.push(""),s!==i&&r.push(e.slice(s,i)),s=o?i+o[0].length:i}return s!==i&&!n&&r.push(""),r.join(" ")}function JR(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 $Z(e){return!!(e.properties||{}).hidden}function zZ(e){return e.tagName==="td"||e.tagName==="th"}function PZ(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const qZ={},FZ=[];function P7(e){const t=e||qZ;return function(n,r){H5(n,"element",function(s,i){const o=Array.isArray(s.properties.className)?s.properties.className:FZ,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let u=l;if(!a&&!l&&!c)return;let d=i[i.length-1],f=s;if(s.tagName==="code"&&a&&d&&d.type==="element"&&d.tagName==="pre"&&(f=d,d=i[i.length-2],u=!0),!d)return;const m=LZ(f,{whitespace:"pre"});let p;try{p=Uw.renderToString(m,{...t,displayMode:u,throwOnError:!0})}catch(v){const b=v,x=b.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:b,place:s.position,ruleId:x,source:"rehype-katex"});try{p=Uw.renderToString(m,{...t,displayMode:u,strict:"ignore",throwOnError:!1})}catch{p=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(v)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=CZ(p).children);const y=d.children.indexOf(f);return d.children.splice(y,1,...p),gI})}}const ZR=[{id:"abap",name:"ABAP",import:()=>q(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>q(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>q(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>q(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>q(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>q(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>q(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>q(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>q(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>q(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>q(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>q(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>q(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>q(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>q(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>q(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>q(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>q(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>q(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>q(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>q(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>q(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>q(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>q(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>q(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>q(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>q(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>q(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>q(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>q(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>q(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>q(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>q(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>q(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>q(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>q(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>q(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>q(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>q(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>q(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>q(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>q(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>q(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>q(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>q(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>q(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>q(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>q(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>q(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>q(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>q(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>q(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>q(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>q(()=>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:()=>q(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>q(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>q(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>q(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>q(()=>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:()=>q(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>q(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>q(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>q(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>q(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>q(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>q(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>q(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>q(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>q(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>q(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>q(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>q(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>q(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>q(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>q(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>q(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>q(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>q(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>q(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>q(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>q(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>q(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>q(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>q(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>q(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>q(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>q(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>q(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>q(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>q(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>q(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>q(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>q(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>q(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>q(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>q(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>q(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>q(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>q(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>q(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>q(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>q(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>q(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>q(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>q(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>q(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>q(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>q(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>q(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>q(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>q(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>q(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>q(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>q(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>q(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>q(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>q(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>q(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>q(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>q(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>q(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>q(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>q(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>q(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>q(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>q(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>q(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>q(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>q(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>q(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>q(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>q(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>q(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>q(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>q(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>q(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>q(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>q(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>q(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>q(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>q(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>q(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>q(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>q(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>q(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>q(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>q(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>q(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>q(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>q(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>q(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>q(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>q(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>q(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>q(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>q(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>q(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>q(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>q(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>q(()=>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:()=>q(()=>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:()=>q(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>q(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>q(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>q(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>q(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>q(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>q(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>q(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>q(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>q(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>q(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>q(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>q(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>q(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>q(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>q(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>q(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>q(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>q(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>q(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>q(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>q(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>q(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>q(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>q(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>q(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>q(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>q(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>q(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>q(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>q(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>q(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>q(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>q(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>q(()=>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:()=>q(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>q(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>q(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>q(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>q(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>q(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>q(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>q(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>q(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>q(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>q(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>q(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>q(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>q(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>q(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>q(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>q(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>q(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>q(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>q(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>q(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>q(()=>import("./zig-BVz_zdnA.js"),[])}],UZ=Object.fromEntries(ZR.map(e=>[e.id,e.import])),HZ=Object.fromEntries(ZR.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),VZ={...UZ,...HZ},WZ=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>q(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>q(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>q(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>q(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>q(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>q(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>q(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>q(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>q(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>q(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>q(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>q(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>q(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>q(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>q(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>q(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>q(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>q(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>q(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>q(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>q(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>q(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>q(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>q(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>q(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>q(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>q(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>q(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>q(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>q(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>q(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>q(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>q(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>q(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>q(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>q(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>q(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>q(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>q(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>q(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>q(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>q(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>q(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>q(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>q(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>q(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>q(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>q(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>q(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>q(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>q(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>q(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>q(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>q(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],GZ=Object.fromEntries(WZ.map(e=>[e.id,e.import]));let za=class extends Error{constructor(t){super(t),this.name="ShikiError"}},f_=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function KZ(){return 2147483648}function YZ(){return typeof performance<"u"?performance.now():Date.now()}const XZ=(e,t)=>e+(t-e%t)%t;async function QZ(e){let t,n;const r={};function s(m){n=m,r.HEAPU8=new Uint8Array(m),r.HEAPU32=new Uint32Array(m)}function i(m,p,y){r.HEAPU8.copyWithin(m,p,p+y)}function o(m){try{return t.grow(m-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function a(m){const p=r.HEAPU8.length;m=m>>>0;const y=KZ();if(m>y)return!1;for(let v=1;v<=4;v*=2){let b=p*(1+.2/v);b=Math.min(b,m+100663296);const x=Math.min(y,XZ(Math.max(m,b),65536));if(o(x))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(m,p,y=1024){const v=p+y;let b=p;for(;m[b]&&!(b>=v);)++b;if(b-p>16&&m.buffer&&l)return l.decode(m.subarray(p,b));let x="";for(;p<b;){let w=m[p++];if(!(w&128)){x+=String.fromCharCode(w);continue}const k=m[p++]&63;if((w&224)===192){x+=String.fromCharCode((w&31)<<6|k);continue}const T=m[p++]&63;if((w&240)===224?w=(w&15)<<12|k<<6|T:w=(w&7)<<18|k<<12|T<<6|m[p++]&63,w<65536)x+=String.fromCharCode(w);else{const C=w-65536;x+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return x}function u(m,p){return m?c(r.HEAPU8,m,p):""}const d={emscripten_get_now:YZ,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const p=await e({env:d,wasi_snapshot_preview1:d});t=p.memory,s(t.buffer),Object.assign(r,p),r.UTF8ToString=u}return await f(),r}var JZ=Object.defineProperty,ZZ=(e,t,n)=>t in e?JZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jr=(e,t,n)=>(ZZ(e,typeof t!="symbol"?t+"":t,n),n);let Ur=null;function eee(e){throw new f_(e.UTF8ToString(e.getLastOnigError()))}class Vy{constructor(t){jr(this,"utf16Length"),jr(this,"utf8Length"),jr(this,"utf16Value"),jr(this,"utf8Value"),jr(this,"utf16OffsetToUtf8"),jr(this,"utf8OffsetToUtf16");const n=t.length,r=Vy._utf8ByteLength(t),s=r!==n,i=s?new Uint32Array(n+1):null;s&&(i[n]=r);const o=s?new Uint32Array(r+1):null;s&&(o[r]=n);const a=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=t.charCodeAt(c);let d=u,f=!1;if(u>=55296&&u<=56319&&c+1<n){const m=t.charCodeAt(c+1);m>=56320&&m<=57343&&(d=(u-55296<<10)+65536|m-56320,f=!0)}s&&(i[c]=l,f&&(i[c+1]=l),d<=127?o[l+0]=c:d<=2047?(o[l+0]=c,o[l+1]=c):d<=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)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),f&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let n=0;for(let r=0,s=t.length;r<s;r++){const i=t.charCodeAt(r);let o=i,a=!1;if(i>=55296&&i<=56319&&r+1<s){const l=t.charCodeAt(r+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&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Io=class{constructor(e){if(jr(this,"id",++Io.LAST_ID),jr(this,"_onigBinding"),jr(this,"content"),jr(this,"utf16Length"),jr(this,"utf8Length"),jr(this,"utf16OffsetToUtf8"),jr(this,"utf8OffsetToUtf16"),jr(this,"ptr"),!Ur)throw new f_("Must invoke loadWasm first.");this._onigBinding=Ur,this.content=e;const t=new Vy(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!Io._sharedPtrInUse?(Io._sharedPtr||(Io._sharedPtr=Ur.omalloc(1e4)),Io._sharedPtrInUse=!0,Ur.HEAPU8.set(t.utf8Value,Io._sharedPtr),this.ptr=Io._sharedPtr):this.ptr=t.createString(Ur)}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===Io._sharedPtr?Io._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let mm=Io;jr(mm,"LAST_ID",0);jr(mm,"_sharedPtr",0);jr(mm,"_sharedPtrInUse",!1);class tee{constructor(t){if(jr(this,"_onigBinding"),jr(this,"_ptr"),!Ur)throw new f_("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a<l;a++){const c=new Vy(t[a]);n[a]=c.createString(Ur),r[a]=c.utf8Length}const s=Ur.omalloc(4*t.length);Ur.HEAPU32.set(n,s/4);const i=Ur.omalloc(4*t.length);Ur.HEAPU32.set(r,i/4);const o=Ur.createOnigScanner(s,i,t.length);for(let a=0,l=t.length;a<l;a++)Ur.ofree(n[a]);Ur.ofree(i),Ur.ofree(s),o===0&&eee(Ur),this._onigBinding=Ur,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof t=="string"){t=new mm(t);const i=this._findNextMatchSync(t,n,!1,s);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,s)}_findNextMatchSync(t,n,r,s){const i=this._onigBinding,o=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),s);if(o===0)return null;const a=i.HEAPU32;let l=o/4;const c=a[l++],u=a[l++],d=[];for(let f=0;f<u;f++){const m=t.convertUtf8OffsetToUtf16(a[l++]),p=t.convertUtf8OffsetToUtf16(a[l++]);d[f]={start:m,end:p,length:p-m}}return{index:c,captureIndices:d}}}function nee(e){return typeof e.instantiator=="function"}function ree(e){return typeof e.default=="function"}function see(e){return typeof e.data<"u"}function iee(e){return typeof Response<"u"&&e instanceof Response}function oee(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 hp;function aee(e){if(hp)return hp;async function t(){Ur=await QZ(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),nee(r)?r=await r.instantiator(n):ree(r)?r=await r.default(n):(see(r)&&(r=r.data),iee(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await lee(r)(n):r=await cee(r)(n):oee(r)?r=await o4(r)(n):r instanceof WebAssembly.Module?r=await o4(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await o4(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return hp=t(),hp}function o4(e){return t=>WebAssembly.instantiate(e,t)}function lee(e){return t=>WebAssembly.instantiateStreaming(e,t)}function cee(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let uee;function dee(){return uee}async function ej(e){return e&&await aee(e),{createScanner(t){return new tee(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new mm(t)}}}function hee(e){return m_(e)}function m_(e){return Array.isArray(e)?fee(e):e instanceof RegExp?e:typeof e=="object"?mee(e):e}function fee(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=m_(e[n]);return t}function mee(e){let t={};for(let n in e)t[n]=m_(e[n]);return t}function tj(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function nj(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?nj(e.substring(0,e.length-1)):e.substr(~t+1)}var a4=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,fp=class{static hasCaptures(e){return e===null?!1:(a4.lastIndex=0,a4.test(e))}static replaceCaptures(e,t,n){return e.replace(a4,(r,s,i,o)=>{let a=n[parseInt(s||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 r})}};function rj(e,t){return e<t?-1:e>t?1:0}function sj(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let i=rj(e[s],t[s]);if(i!==0)return i}return 0}return n-r}function q7(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 ij(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var oj=class{constructor(e){oe(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}},x1=class{constructor(e,t,n){oe(this,"_cachedMatchRoot",new oj(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(yee(e),t)}static createFromParsedTheme(e,t){return xee(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>pee(e.parent,s.parentScopes));return r?new aj(r.fontStyle,r.foreground,r.background):null}},l4=class dg{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new dg(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new dg(n,t[r]);return n}push(t){return new dg(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 r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function pee(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!gee(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function gee(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var aj=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function yee(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,i=t.length;s<i;s++){let o=t[s];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let d=o.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),a=d.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let d=o.settings.fontStyle.split(" ");for(let f=0,m=d.length;f<m;f++)switch(d[f]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof o.settings.foreground=="string"&&q7(o.settings.foreground)&&(c=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&q7(o.settings.background)&&(u=o.settings.background);for(let d=0,f=a.length;d<f;d++){let p=a[d].trim().split(" "),y=p[p.length-1],v=null;p.length>1&&(v=p.slice(0,p.length-1),v.reverse()),n[r++]=new bee(y,v,s,l,c,u)}}return n}var bee=class{constructor(e,t,n,r,s,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},ja=(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))(ja||{});function xee(e,t){e.sort((l,c)=>{let u=rj(l.scope,c.scope);return u!==0||(u=sj(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(s=l.background)}let i=new wee(t),o=new aj(n,i.getId(r),i.getId(s)),a=new _ee(new Ww(0,null,-1,0,0),[]);for(let l=0,c=e.length;l<c;l++){let u=e[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new x1(i,o,a)}var wee=class{constructor(e){oe(this,"_isFrozen");oe(this,"_lastColorId");oe(this,"_id2color");oe(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)}},vee=Object.freeze([]),Ww=class lj{constructor(t,n,r,s,i){oe(this,"scopeDepth");oe(this,"parentScopes");oe(this,"fontStyle");oe(this,"foreground");oe(this,"background");this.scopeDepth=t,this.parentScopes=n||vee,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new lj(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},_ee=class Gw{constructor(t,n=[],r={}){oe(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const i=n.parentScopes[s].length-t.parentScopes[r].length;if(i!==0)return i;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,i;if(r===-1?(s=t,i=""):(s=t.substring(0,r),i=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Gw._cmpBySpecificity),n}insert(t,n,r,s,i,o){if(n===""){this._doInsertHere(t,r,s,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 u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Gw(this._mainRule.clone(),Ww.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(t+1,c,r,s,i,o)}_doInsertHere(t,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(t,r,s,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let l=this._rulesWithParentScopes[o];if(sj(l.parentScopes,n)===0){l.acceptOverwrite(t,r,s,i);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Ww(t,n,r,s,i))}},ih=class Ri{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Ri.getLanguageId(t),r=Ri.getTokenType(t),s=Ri.getFontStyle(t),i=Ri.getForeground(t),o=Ri.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,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,r,s,i,o,a){let l=Ri.getLanguageId(t),c=Ri.getTokenType(t),u=Ri.containsBalancedBrackets(t)?1:0,d=Ri.getFontStyle(t),f=Ri.getForeground(t),m=Ri.getBackground(t);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),i!==-1&&(d=i),o!==0&&(f=o),a!==0&&(m=a),(l<<0|c<<8|u<<10|d<<11|f<<15|m<<24)>>>0}};function w1(e,t){const n=[],r=kee(e);let s=r.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=o();if(n.push({matcher:c,priority:l}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();const l=i();return c=>!!l&&!l(c)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(F7(s)){const l=[];do l.push(s),s=r.next();while(F7(s));return c=>t(l,c)}return null}function o(){const l=[];let c=i();for(;c;)l.push(c),c=i();return u=>l.every(d=>d(u))}function a(){const l=[];let c=o();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=o()}return u=>l.some(d=>d(u))}}function F7(e){return!!e&&!!e.match(/[\w\.:]+/)}function kee(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function cj(e){typeof e.dispose=="function"&&e.dispose()}var N0=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},See=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Tee=class{constructor(){oe(this,"_references",[]);oe(this,"_seenReferenceKeys",new Set);oe(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))}},Cee=class{constructor(e,t){oe(this,"seenFullScopeRequests",new Set);oe(this,"seenPartialScopeRequests",new Set);oe(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new N0(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Tee;for(const n of e)Aee(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof N0){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 Aee(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof N0?hg({baseGrammar:i,selfGrammar:s},r):Kw(e.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const o=n.injections(e.scopeName);if(o)for(const a of o)r.add(new N0(a))}function Kw(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];v1([r],t,n)}}function hg(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&v1(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&v1(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function v1(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?tj({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&v1(r.patterns,{...t,repository:s},n);const i=r.include;if(!i)continue;const o=uj(i);switch(o.kind){case 0:hg({...t,selfGrammar:t.baseGrammar},n);break;case 1:hg(t,n);break;case 2:Kw(o.ruleName,{...t,repository:s},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:s};o.kind===4?Kw(o.ruleName,l,n):hg(l,n)}else o.kind===4?n.add(new See(o.scopeName,o.ruleName)):n.add(new N0(o.scopeName));break}}}var Eee=class{constructor(){oe(this,"kind",0)}},Mee=class{constructor(){oe(this,"kind",1)}},Nee=class{constructor(e){oe(this,"kind",2);this.ruleName=e}},Iee=class{constructor(e){oe(this,"kind",3);this.scopeName=e}},Ree=class{constructor(e,t){oe(this,"kind",4);this.scopeName=e,this.ruleName=t}};function uj(e){if(e==="$base")return new Eee;if(e==="$self")return new Mee;const t=e.indexOf("#");if(t===-1)return new Iee(e);if(t===0)return new Nee(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new Ree(n,r)}}var jee=/\\(\d+)/,U7=/\\(\d+)/g,Lee=-1,dj=-2;var pm=class{constructor(t,n,r,s){oe(this,"$location");oe(this,"id");oe(this,"_nameIsCapturing");oe(this,"_name");oe(this,"_contentNameIsCapturing");oe(this,"_contentName");this.$location=t,this.id=n,this._name=r||null,this._nameIsCapturing=fp.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=fp.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${nj(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:fp.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:fp.replaceCaptures(this._contentName,t,n)}},Dee=class extends pm{constructor(t,n,r,s,i){super(t,n,r,s);oe(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,r,s){throw new Error("Not supported!")}},Oee=class extends pm{constructor(t,n,r,s,i){super(t,n,r,null);oe(this,"_match");oe(this,"captures");oe(this,"_cachedCompiledPatterns");this._match=new I0(s,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,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new R0,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},H7=class extends pm{constructor(t,n,r,s,i){super(t,n,r,s);oe(this,"hasMissingPatterns");oe(this,"patterns");oe(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 r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new R0,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Yw=class extends pm{constructor(t,n,r,s,i,o,a,l,c,u){super(t,n,r,s);oe(this,"_begin");oe(this,"beginCaptures");oe(this,"_end");oe(this,"endHasBackReferences");oe(this,"endCaptures");oe(this,"applyEndPatternLast");oe(this,"hasMissingPatterns");oe(this,"patterns");oe(this,"_cachedCompiledPatterns");this._begin=new I0(i,this.id),this.beginCaptures=o,this._end=new I0(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=c||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.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,r,s){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,s)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new R0;for(const r of this.patterns)t.getRule(r).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}},_1=class extends pm{constructor(t,n,r,s,i,o,a,l,c){super(t,n,r,s);oe(this,"_begin");oe(this,"beginCaptures");oe(this,"whileCaptures");oe(this,"_while");oe(this,"whileHasBackReferences");oe(this,"hasMissingPatterns");oe(this,"patterns");oe(this,"_cachedCompiledPatterns");oe(this,"_cachedCompiledWhilePatterns");this._begin=new I0(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new I0(a,dj),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,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new R0;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,r,s){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,s)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new R0,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},hj=class ls{static createCaptureRule(t,n,r,s,i){return t.registerRule(o=>new Dee(n,o,r,s,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new Oee(t.$vscodeTextmateLocation,t.id,t.name,t.match,ls._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=tj({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new H7(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,ls._compilePatterns(i,n,r))}return t.while?new _1(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ls._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,ls._compileCaptures(t.whileCaptures||t.captures,n,r),ls._compilePatterns(t.patterns,n,r)):new Yw(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,ls._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,ls._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,ls._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];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++)s[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let l=0;t[o].patterns&&(l=ls.getCompiledRuleId(t[o],n,r)),s[a]=ls.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let i=0,o=t.length;i<o;i++){const a=t[i];let l=-1;if(a.include){const c=uj(a.include);switch(c.kind){case 0:case 1:l=ls.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=ls.getCompiledRuleId(u,n,r));break;case 3:case 4:const d=c.scopeName,f=c.kind===4?c.ruleName:null,m=n.getExternalGrammar(d,r);if(m)if(f){let p=m.repository[f];p&&(l=ls.getCompiledRuleId(p,n,m.repository))}else l=ls.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=ls.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof H7||c instanceof Yw||c instanceof _1)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},I0=class fj{constructor(t,n){oe(this,"source");oe(this,"ruleId");oe(this,"hasAnchor");oe(this,"hasBackReferences");oe(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let s=0,i=[],o=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const c=t.charAt(a+1);c==="z"?(i.push(t.substring(s,a)),i.push("$(?!\\n)(?<!\\n)"),s=a+2):(c==="A"||c==="G")&&(o=!0),a++}this.hasAnchor=o,s===0?this.source=t:(i.push(t.substring(s,r)),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=jee.test(this.source):this.hasBackReferences=!1}clone(){return new fj(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 r=n.map(s=>t.substring(s.start,s.end));return U7.lastIndex=0,this.source.replace(U7,(s,i)=>ij(r[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=[],r=[],s=[],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,r[i]=a,s[i]=a,a==="\\"&&i+1<o&&(l=this.source.charAt(i+1),l==="A"?(t[i+1]="",n[i+1]="",r[i+1]="A",s[i+1]="A"):l==="G"?(t[i+1]="",n[i+1]="G",r[i+1]="",s[i+1]="G"):(t[i+1]=l,n[i+1]=l,r[i+1]=l,s[i+1]=l),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.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}},R0=class{constructor(){oe(this,"_items");oe(this,"_hasAnchors");oe(this,"_cached");oe(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 V7(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 r=this._items.map(s=>s.resolveAnchors(t,n));return new V7(e,r,this._items.map(s=>s.ruleId))}},V7=class{constructor(e,t,n){oe(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 r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},c4=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Ea,Bee=(Ea=class{constructor(t,n){oe(this,"_defaultAttributes");oe(this,"_embeddedLanguagesMatcher");oe(this,"_getBasicScopeAttributes",new oj(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new c4(n,r)}));this._defaultAttributes=new c4(t,8),this._embeddedLanguagesMatcher=new $ee(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Ea._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Ea.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!")}},oe(Ea,"_NULL_SCOPE_METADATA",new c4(0,0)),oe(Ea,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Ea),$ee=class{constructor(e){oe(this,"values");oe(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>ij(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])}},W7=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function mj(e,t,n,r,s,i,o,a){const l=t.content.length;let c=!1,u=-1;if(o){const m=zee(e,t,n,r,s,i);s=m.stack,r=m.linePos,n=m.isFirstLine,u=m.anchorPosition}const d=Date.now();for(;!c;){if(a!==0&&Date.now()-d>a)return new W7(s,!0);f()}return new W7(s,!1);function f(){const m=Pee(e,t,n,r,s,u);if(!m){i.produce(s,l),c=!0;return}const p=m.captureIndices,y=m.matchedRuleId,v=p&&p.length>0?p[0].end>r:!1;if(y===Lee){const b=s.getRule(e);i.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),Cf(e,t,n,s,i,b.endCaptures,p),i.produce(s,p[0].end);const x=s;if(s=s.parent,u=x.getAnchorPos(),!v&&x.getEnterPos()===r){s=x,i.produce(s,l),c=!0;return}}else{const b=e.getRule(y);i.produce(s,p[0].start);const x=s,w=b.getName(t.content,p),k=s.contentNameScopesList.pushAttributed(w,e);if(s=s.push(y,r,u,p[0].end===l,null,k,k),b instanceof Yw){const T=b;Cf(e,t,n,s,i,T.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const C=T.getContentName(t.content,p),A=k.pushAttributed(C,e);if(s=s.withContentNameScopesList(A),T.endHasBackReferences&&(s=s.withEndRule(T.getEndWithResolvedBackReferences(t.content,p))),!v&&x.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(b instanceof _1){const T=b;Cf(e,t,n,s,i,T.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const C=T.getContentName(t.content,p),A=k.pushAttributed(C,e);if(s=s.withContentNameScopesList(A),T.whileHasBackReferences&&(s=s.withEndRule(T.getWhileWithResolvedBackReferences(t.content,p))),!v&&x.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(Cf(e,t,n,s,i,b.captures,p),i.produce(s,p[0].end),s=s.pop(),!v){s=s.safePop(),i.produce(s,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function zee(e,t,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const c=l.getRule(e);c instanceof _1&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=Uee(l.rule,e,l.stack.endRule,n,r===o),d=c.findNextMatchSync(t,r,u);if(d){if(d.ruleId!==dj){s=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(i.produce(l.stack,d.captureIndices[0].start),Cf(e,t,n,l.stack,i,l.rule.whileCaptures,d.captureIndices),i.produce(l.stack,d.captureIndices[0].end),o=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function Pee(e,t,n,r,s,i){const o=qee(e,t,n,r,s,i),a=e.getInjections();if(a.length===0)return o;const l=Fee(a,e,t,n,r,s,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:o}function qee(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:a,findOptions:l}=pj(o,e,s.endRule,n,r===i),c=a.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Fee(e,t,n,r,s,i,o){let a=Number.MAX_VALUE,l=null,c,u=0;const d=i.contentNameScopesList.getScopeNames();for(let f=0,m=e.length;f<m;f++){const p=e[f];if(!p.matcher(d))continue;const y=t.getRule(p.ruleId),{ruleScanner:v,findOptions:b}=pj(y,t,null,r,s===o),x=v.findNextMatchSync(n,s,b);if(!x)continue;const w=x.captureIndices[0].start;if(!(w>=a)&&(a=w,l=x.captureIndices,c=x.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function pj(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function Uee(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function Cf(e,t,n,r,s,i,o){if(i.length===0)return;const a=t.content,l=Math.min(i.length,o.length),c=[],u=o[0].end;for(let d=0;d<l;d++){const f=i[d];if(f===null)continue;const m=o[d];if(m.length===0)continue;if(m.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=m.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,m.start):s.produce(r,m.start),f.retokenizeCapturedWithRuleId){const y=f.getName(a,o),v=r.contentNameScopesList.pushAttributed(y,e),b=f.getContentName(a,o),x=v.pushAttributed(b,e),w=r.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,v,x),k=e.createOnigString(a.substring(0,m.end));mj(e,k,n&&m.start===0,m.start,w,s,!1,0),cj(k);continue}const p=f.getName(a,o);if(p!==null){const v=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);c.push(new Hee(v,m.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Hee=class{constructor(e,t){oe(this,"scopes");oe(this,"endPos");this.scopes=e,this.endPos=t}};function Vee(e,t,n,r,s,i,o,a){return new Gee(e,t,n,r,s,i,o,a)}function G7(e,t,n,r,s){const i=w1(t,k1),o=hj.getCompiledRuleId(n,r,s.repository);for(const a of i)e.push({debugSelector:t,matcher:a.matcher,ruleId:o,grammar:s,priority:a.priority})}function k1(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(Wee(t[s],r))return n=s+1,!0;return!1})}function Wee(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 Gee=class{constructor(e,t,n,r,s,i,o,a){oe(this,"_rootId");oe(this,"_lastRuleId");oe(this,"_ruleId2desc");oe(this,"_includedGrammars");oe(this,"_grammarRepository");oe(this,"_grammar");oe(this,"_injections");oe(this,"_basicScopeAttributesProvider");oe(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new Bee(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=K7(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=w1(l,k1);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[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:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let o in s)G7(t,o,s[o],this,r);const i=this._grammarRepository.injections(n);i&&i.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const l=a.injectionSelector;l&&G7(t,l,a,this,a)}})}return t.sort((s,i)=>s.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]=K7(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=hj.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===Xw.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=ih.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),f=this.getRule(this._rootId).getName(null,null);let m;f?m=t0.createRootAndLookUpScopeName(f,d,this):m=t0.createRoot("unknown",d),t=new Xw(null,this._rootId,-1,-1,!1,null,m,m)}else s=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new Yee(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=mj(this,i,s,0,t,a,!0,r);return cj(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function K7(e,t){return e=hee(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 t0=class Ro{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,s=(t==null?void 0:t.scopePath)??null;for(const i of n)s=l4.push(s,i.scopeNames),r=new Ro(r,s,i.encodedTokenAttributes);return r}static createRoot(t,n){return new Ro(null,new l4(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new l4(null,t),o=r.themeProvider.themeMatch(i),a=Ro.mergeAttributes(n,s,o);return new Ro(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Ro.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,r){let s=-1,i=0,o=0;return r!==null&&(s=r.fontStyle,i=r.foregroundId,o=r.backgroundId),ih.set(t,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Ro._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const i of r)s=Ro._pushAttributed(s,i,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),i=t.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=Ro.mergeAttributes(t.tokenAttributes,s,o);return new Ro(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var s;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((s=r.parent)==null?void 0:s.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},zi,Xw=(zi=class{constructor(t,n,r,s,i,o,a,l){oe(this,"_stackElementBrand");oe(this,"_enterPos");oe(this,"_anchorPos");oe(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=r,this._anchorPos=s}equals(t){return t===null?!1:zi._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?t0.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(){zi._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,a){return new zi(this,t,n,r,s,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 r,s;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.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 zi(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,r;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:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const r=t0.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new zi(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,t0.fromExtension(r,n.contentNameScopesList))}},oe(zi,"NULL",new zi(null,0,0,0,!1,null,null,null)),zi),Kee=class{constructor(e,t){oe(this,"balancedBracketScopes");oe(this,"unbalancedBracketScopes");oe(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):w1(n,k1).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>w1(n,k1).map(r=>r.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}},Yee=class{constructor(e,t,n,r){oe(this,"_emitBinaryTokens");oe(this,"_lineText");oe(this,"_tokens");oe(this,"_binaryTokens");oe(this,"_lastTokenEndIndex");oe(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,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 r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let s=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((r=this.balancedBracketSelectors)!=null&&r.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)&&(s=ih.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(s=ih.set(s,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),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 r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Xee=class{constructor(e,t){oe(this,"_grammars",new Map);oe(this,"_rawGrammars",new Map);oe(this,"_injectionGrammars",new Map);oe(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,r,s){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,Vee(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},Qee=class{constructor(t){oe(this,"_options");oe(this,"_syncRegistry");oe(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new Xee(x1.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(x1.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new Kee(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,i){const o=new Cee(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,r,s,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 r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,i)}},Qw=Xw.NULL;const Jee=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Zee=/["&'<>`]/g,ete=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,tte=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,nte=/[|\\{}()[\]^$+*?.]/g,Y7=new WeakMap;function rte(e,t){if(e=e.replace(t.subset?ste(t.subset):Zee,r),t.subset||t.escapeOnly)return e;return e.replace(ete,n).replace(tte,r);function n(s,i,o){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function r(s,i,o){return t.format(s.charCodeAt(0),o.charCodeAt(i+1),t)}}function ste(e){let t=Y7.get(e);return t||(t=ite(e),Y7.set(e,t)),t}function ite(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(nte,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const ote=/[\dA-Fa-f]/;function ate(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!ote.test(String.fromCharCode(t))?r:r+";"}const lte=/\d/;function cte(e,t,n){const r="&#"+String(e);return n&&t&&!lte.test(String.fromCharCode(t))?r:r+";"}const ute=["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"],u4={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:"€"},dte=["cent","copy","divide","gt","lt","not","para","times"],gj={}.hasOwnProperty,Jw={};let mp;for(mp in u4)gj.call(u4,mp)&&(Jw[u4[mp]]=mp);const hte=/[^\dA-Za-z]/;function fte(e,t,n,r){const s=String.fromCharCode(e);if(gj.call(Jw,s)){const i=Jw[s],o="&"+i;return n&&ute.includes(i)&&!dte.includes(i)&&(!r||t&&t!==61&&hte.test(String.fromCharCode(t)))?o:o+";"}return""}function mte(e,t,n){let r=ate(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=fte(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=cte(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Od(e,t){return rte(e,Object.assign({format:mte},t))}const pte=/^>|^->|<!--|-->|--!>|<!-$/g,gte=[">"],yte=["<",">"];function bte(e,t,n,r){return r.settings.bogusComments?"<?"+Od(e.value,Object.assign({},r.settings.characterReferences,{subset:gte}))+">":"<!--"+e.value.replace(pte,s)+"-->";function s(i){return Od(i,Object.assign({},r.settings.characterReferences,{subset:yte}))}}function xte(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const zr=bj(1),yj=bj(-1),wte=[];function bj(e){return t;function t(n,r,s){const i=n?n.children:wte;let o=(r||0)+e,a=i[o];if(!s)for(;a&&Cy(a);)o+=e,a=i[o];return a}}const vte={}.hasOwnProperty;function xj(e){return t;function t(n,r,s){return vte.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const p_=xj({body:kte,caption:d4,colgroup:d4,dd:Ate,dt:Cte,head:d4,html:_te,li:Tte,optgroup:Ete,option:Mte,p:Ste,rp:X7,rt:X7,tbody:Ite,td:Q7,tfoot:Rte,th:Q7,thead:Nte,tr:jte});function d4(e,t,n){const r=zr(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Cy(r.value.charAt(0)))}function _te(e,t,n){const r=zr(n,t);return!r||r.type!=="comment"}function kte(e,t,n){const r=zr(n,t);return!r||r.type!=="comment"}function Ste(e,t,n){const r=zr(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.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 Tte(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Cte(e,t,n){const r=zr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Ate(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function X7(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Ete(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Mte(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Nte(e,t,n){const r=zr(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Ite(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Rte(e,t,n){return!zr(n,t)}function jte(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function Q7(e,t,n){const r=zr(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Lte=xj({body:Bte,colgroup:$te,head:Ote,html:Dte,tbody:zte});function Dte(e){const t=zr(e,-1);return!t||t.type!=="comment"}function Ote(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function Bte(e){const t=zr(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Cy(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function $te(e,t,n){const r=yj(n,t),s=zr(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&p_(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function zte(e,t,n){const r=yj(n,t),s=zr(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&p_(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const pp={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 Pte(e,t,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;s.space==="html"&&e.tagName==="svg"&&(r.schema=Th);const c=qte(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(o=!1),(c||!i||!Lte(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!p_(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function qte(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=Fte(e,s,t[s]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function Fte(e,t,n){const r=N5(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Od(r.attribute,Object.assign({},e.settings.characterReferences,{subset:pp.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?DN:UN)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=Od(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:pp.unquoted[s][i]}))),a!==n&&(e.settings.quoteSmart&&d1(n,o)>d1(n,e.alternative)&&(o=e.alternative),a=o+Od(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?pp.single:pp.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const Ute=["<","&"];function wj(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Od(e.value,Object.assign({},r.settings.characterReferences,{subset:Ute}))}function Hte(e,t,n,r){return r.settings.allowDangerousHtml?e.value:wj(e,t,n,r)}function Vte(e,t,n,r){return r.all(e)}const Wte=qY("type",{invalid:Gte,unknown:Kte,handlers:{comment:bte,doctype:xte,element:Pte,raw:Hte,root:Vte,text:wj}});function Gte(e){throw new Error("Expected node, not `"+e+"`")}function Kte(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const Yte={},Xte={},Qte=[];function Jte(e,t){const n=Yte,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Zte,all:ene,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||Jee,characterReferences:n.characterReferences||Xte,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Th:I5,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Zte(e,t,n){return Wte(e,t,n,this)}function ene(e){const t=[],n=e&&e.children||Qte;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function tne(e){return Array.isArray(e)?e:[e]}function Wy(e,t=!1){var i;const n=e.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const a=t?n[o]+(n[o+1]||""):n[o];s.push([a,r]),r+=n[o].length,r+=((i=n[o+1])==null?void 0:i.length)||0}return s}function g_(e){return!e||["plaintext","txt","text","plain"].includes(e)}function vj(e){return e==="ansi"||g_(e)}function y_(e){return e==="none"}function _j(e){return y_(e)}function kj(e,t){var r;if(!t)return e;e.properties||(e.properties={}),(r=e.properties).class||(r.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 s of n)s&&!e.properties.class.includes(s)&&e.properties.class.push(s);return e}function nne(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function rne(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((r,s)=>r-s);return n.length?e.map(r=>r.flatMap(s=>{const i=n.filter(o=>s.offset<o&&o<s.offset+s.content.length).map(o=>o-s.offset).sort((o,a)=>o-a);return i.length?nne(s,i):s})):e}async function Sj(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function S1(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[s,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[s]=i:s===r&&Object.assign(n,i);return n}function nu(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function Tj(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&ja.Italic&&(t["font-style"]="italic"),e.fontStyle&ja.Bold&&(t["font-weight"]="bold"),e.fontStyle&ja.Underline&&(t["text-decoration"]="underline")),t}function sne(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function ine(e){const t=Wy(e,!0).map(([s])=>s);function n(s){if(s===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=s,o=0;for(const a of t){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function r(s,i){let o=0;for(let a=0;a<s;a++)o+=t[a].length;return o+=i,o}return{lines:t,indexToPos:n,posToIndex:r}}class As extends Error{constructor(t){super(t),this.name="ShikiError"}}const Cj=new WeakMap;function Gy(e,t){Cj.set(e,t)}function j0(e){return Cj.get(e)}class Ih{constructor(...t){oe(this,"_stacks",{});oe(this,"lang");if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,s]=t;this.lang=r,this._stacks={[s]: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 Ih(Object.fromEntries(tne(n).map(r=>[r,Qw])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return J7(this._stacks[this.theme])}getScopes(t=this.theme){return J7(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function J7(e){const t=[],n=new Set;function r(s){var o;if(n.has(s))return;n.add(s);const i=(o=s==null?void 0:s.nameScopesList)==null?void 0:o.scopeName;i&&t.push(i),s.parent&&r(s.parent)}return r(e),t}function one(e,t){if(!(e instanceof Ih))throw new As("Invalid grammar state");return e.getInternalStack(t)}function ane(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new As(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...s.indexToPos(o),offset:o}}else{const a=s.lines[o.line];if(a===void 0)throw new As(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);if(o.character<0||o.character>a.length)throw new As(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:s.posToIndex(o.line,o.character)}}};const s=ine(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));lne(i),e.set(n.meta,{decorations:i,converter:s,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 s=t(this).decorations.flatMap(a=>[a.start.offset,a.end.offset]);return rne(n,s)},code(n){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const r=t(this),s=Array.from(n.children).filter(d=>d.type==="element"&&d.tagName==="span");if(s.length!==r.converter.lines.length)throw new As(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(d,f,m,p){const y=s[d];let v="",b=-1,x=-1;if(f===0&&(b=0),m===0&&(x=0),m===Number.POSITIVE_INFINITY&&(x=y.children.length),b===-1||x===-1)for(let k=0;k<y.children.length;k++)v+=Aj(y.children[k]),b===-1&&v.length===f&&(b=k+1),x===-1&&v.length===m&&(x=k+1);if(b===-1)throw new As(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(x===-1)throw new As(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const w=y.children.slice(b,x);if(!p.alwaysWrap&&w.length===y.children.length)a(y,p,"line");else if(!p.alwaysWrap&&w.length===1&&w[0].type==="element")a(w[0],p,"token");else{const k={type:"element",tagName:"span",properties:{},children:w};a(k,p,"wrapper"),y.children.splice(b,w.length,k)}}function o(d,f){s[d]=a(s[d],f,"line")}function a(d,f,m){var v;const p=f.properties||{},y=f.transform||(b=>b);return d.tagName=f.tagName||"span",d.properties={...d.properties,...p,class:d.properties.class},(v=f.properties)!=null&&v.class&&kj(d,f.properties.class),d=y(d,m)||d,d}const l=[],c=r.decorations.sort((d,f)=>f.start.offset-d.start.offset);for(const d of c){const{start:f,end:m}=d;if(f.line===m.line)i(f.line,f.character,m.character,d);else if(f.line<m.line){i(f.line,f.character,Number.POSITIVE_INFINITY,d);for(let p=f.line+1;p<m.line;p++)l.unshift(()=>o(p,d));i(m.line,0,m.character,d)}}l.forEach(d=>d())}}}function lne(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new As(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const s=e[r],i=n.start.offset<s.start.offset&&s.start.offset<n.end.offset,o=n.start.offset<s.end.offset&&s.end.offset<n.end.offset,a=s.start.offset<n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<s.end.offset;if(i||o||a||l){if(o&&o||a&&l)continue;throw new As(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Aj(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Aj).join(""):""}const cne=[ane()];function T1(e){return[...e.transformers||[],...cne]}var ru=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],h4={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function une(e,t){const n=e.indexOf("\x1B[",t);if(n!==-1){const r=e.indexOf("m",n);return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function Z7(e,t){let n=1;const r=e[t+n++];let s;if(r==="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))&&(s={type:"rgb",rgb:i})}else if(r==="5"){const i=Number.parseInt(e[t+n]);Number.isNaN(i)||(s={type:"table",index:Number(i)})}return[n,s]}function dne(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],s=Number.parseInt(r);if(!Number.isNaN(s))if(s===0)t.push({type:"resetAll"});else if(s<=9)h4[s]&&t.push({type:"setDecoration",value:h4[s]});else if(s<=29){const i=h4[s-20];i&&t.push({type:"resetDecoration",value:i})}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:ru[s-30]}});else if(s===38){const[i,o]=Z7(e,n);o&&t.push({type:"setForegroundColor",value:o}),n+=i}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:ru[s-40]}});else if(s===48){const[i,o]=Z7(e,n);o&&t.push({type:"setBackgroundColor",value:o}),n+=i}else s===49?t.push({type:"resetBackgroundColor"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:ru[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:ru[s-100+8]}})}return t}function hne(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=une(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0&&s.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const l=dne(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<r.length);return s}}}var fne={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 mne(e=fne){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 r;function s(){if(r)return r;r=[];for(let c=0;c<ru.length;c++)r.push(t(ru[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let d=0;d<6;d++)r.push(n([a[c],a[u],a[d]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function i(a){return s()[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 pne(e,t,n){const r=S1(e,n),s=Wy(t),i=mne(Object.fromEntries(ru.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=hne();return s.map(a=>o.parse(a[0]).map(l=>{let c,u;l.decorations.has("reverse")?(c=l.background?i.value(l.background):e.bg,u=l.foreground?i.value(l.foreground):e.fg):(c=l.foreground?i.value(l.foreground):e.fg,u=l.background?i.value(l.background):void 0),c=nu(c,r),u=nu(u,r),l.decorations.has("dim")&&(c=gne(c));let d=ja.None;return l.decorations.has("bold")&&(d|=ja.Bold),l.decorations.has("italic")&&(d|=ja.Italic),l.decorations.has("underline")&&(d|=ja.Underline),{content:l.value,offset:a[1],color:c,bgColor:u,fontStyle:d}}))}function gne(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t)if(t[3]){const r=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${r}`}else return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(r=>`${r}${r}`).join("")}80`;const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function b_(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(g_(r)||y_(s))return Wy(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(s);if(r==="ansi")return pne(i,t,n);const a=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new za(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new za(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return bne(t,a,i,o,n)}function yne(...e){if(e.length===2)return j0(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(g_(s)||y_(i))throw new za("Plain language does not have grammar state");if(s==="ansi")throw new za("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(s);return new Ih(C1(n,l,o,a,r).stateStack,l.name,o.name)}function bne(e,t,n,r,s){const i=C1(e,t,n,r,s),o=new Ih(C1(e,t,n,r,s).stateStack,t.name,n.name);return Gy(i.tokens,o),i.tokens}function C1(e,t,n,r,s){const i=S1(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,l=Wy(e);let c=s.grammarState?one(s.grammarState,n.name)??Qw:s.grammarContextCode!=null?C1(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Qw,u=[];const d=[];for(let f=0,m=l.length;f<m;f++){const[p,y]=l[f];if(p===""){u=[],d.push([]);continue}if(o>0&&p.length>=o){u=[],d.push([{content:p,offset:y,color:"",fontStyle:0}]);continue}let v,b,x;s.includeExplanation&&(v=t.tokenizeLine(p,c),b=v.tokens,x=0);const w=t.tokenizeLine2(p,c,a),k=w.tokens.length/2;for(let T=0;T<k;T++){const C=w.tokens[2*T],A=T+1<k?w.tokens[2*T+2]:p.length;if(C===A)continue;const L=w.tokens[2*T+1],$=nu(r[ih.getForeground(L)],i),E=ih.getFontStyle(L),z={content:p.substring(C,A),offset:y+C,color:$,fontStyle:E};if(s.includeExplanation){const M=[];if(s.includeExplanation!=="scopeName")for(const K of n.settings){let J;switch(typeof K.scope){case"string":J=K.scope.split(/,/).map(P=>P.trim());break;case"object":J=K.scope;break;default:continue}M.push({settings:K,selectors:J.map(P=>P.split(/ /))})}z.explanation=[];let U=0;for(;C+U<A;){const K=b[x],J=p.substring(K.startIndex,K.endIndex);U+=J.length,z.explanation.push({content:J,scopes:s.includeExplanation==="scopeName"?xne(K.scopes):wne(M,K.scopes)}),x+=1}}u.push(z)}d.push(u),u=[],c=w.ruleStack}return{tokens:d,stateStack:c}}function xne(e){return e.map(t=>({scopeName:t}))}function wne(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];n[r]={scopeName:i,themeMatches:_ne(e,i,t.slice(0,r))}}return n}function e9(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function vne(e,t,n){if(!e9(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)e9(e[r],n[s])&&(r-=1),s-=1;return r===-1}function _ne(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const o of s)if(vne(o,t,n)){r.push(i);break}return r}function Ej(e,t,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=r.map(l=>{const c=b_(e,t,{...n,theme:l.theme}),u=j0(c),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:d}}),i=kne(...s.map(l=>l.tokens)),o=i[0].map((l,c)=>l.map((u,d)=>{const f={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(f.explanation=u.explanation),i.forEach((m,p)=>{const{content:y,explanation:v,offset:b,...x}=m[c][d];f.variants[r[p].color]=x}),f})),a=s[0].state?new Ih(Object.fromEntries(s.map(l=>{var c;return[l.theme,(c=l.state)==null?void 0:c.getInternalStack(l.theme)]})),s[0].state.lang):void 0;return a&&Gy(o,a),o}function kne(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(l=>l[r]),i=t.map(()=>[]);t.forEach((l,c)=>l.push(i[c]));const o=s.map(()=>0),a=s.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 u=a[c];u.content.length===l?(i[c].push(u),o[c]+=1,a[c]=s[c][o[c]]):(i[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return t}function A1(e,t,n){let r,s,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-"}=n,d=Object.entries(n.themes).filter(v=>v[1]).map(v=>({color:v[0],theme:v[1]})).sort((v,b)=>v.color===c?-1:b.color===c?1:0);if(d.length===0)throw new za("`themes` option must not be empty");const f=Ej(e,t,n);if(l=j0(f),c&&!d.find(v=>v.color===c))throw new za(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=d.map(v=>e.getTheme(v.theme)),p=d.map(v=>v.color);i=f.map(v=>v.map(b=>Sne(b,p,u,c))),l&&Gy(i,l);const y=d.map(v=>S1(v.theme,n));s=d.map((v,b)=>(b===0&&c?"":`${u+v.color}:`)+(nu(m[b].fg,y[b])||"inherit")).join(";"),r=d.map((v,b)=>(b===0&&c?"":`${u+v.color}-bg:`)+(nu(m[b].bg,y[b])||"inherit")).join(";"),o=`shiki-themes ${m.map(v=>v.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else if("theme"in n){const c=S1(n.theme,n);i=b_(e,t,n);const u=e.getTheme(n.theme);r=nu(u.bg,c),s=nu(u.fg,c),o=u.name,l=j0(i)}else throw new za("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:l}}function Sne(e,t,n,r){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>Tj(e.variants[l])),o=new Set(i.flatMap(l=>Object.keys(l))),a={};return i.forEach((l,c)=>{for(const u of o){const d=l[u]||"inherit";if(c===0&&r)a[u]=d;else{const f=u==="color"?"":u==="background-color"?"-bg":`-${u}`,m=n+t[c]+(u==="color"?"":f);a[m]=d}}}),s.htmlStyle=a,s}function E1(e,t,n,r={meta:{},options:n,codeToHast:(s,i)=>E1(e,s,i),codeToTokens:(s,i)=>A1(e,s,i)}){var m,p;let s=t;for(const y of T1(n))s=((m=y.preprocess)==null?void 0:m.call(r,s,n))||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:u}=A1(e,s,n);const{mergeWhitespaces:d=!0}=n;d===!0?i=Cne(i):d==="never"&&(i=Ane(i));const f={...r,get source(){return s}};for(const y of T1(n))i=((p=y.tokens)==null?void 0:p.call(f,i))||i;return Tne(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},f,u)}function Tne(e,t,n,r=j0(e)){var p,y,v;const s=T1(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:[]},u={type:"element",tagName:"code",properties:{},children:i};const d=[],f={...n,structure:a,addClassToHast:kj,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return u},get lines(){return d}};if(e.forEach((b,x)=>{var T,C;x&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let w={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const A of b){let L={type:"element",tagName:"span",properties:{...A.htmlAttrs},children:[{type:"text",value:A.content}]};A.htmlStyle;const $=sne(A.htmlStyle||Tj(A));$&&(L.properties.style=$);for(const E of s)L=((T=E==null?void 0:E.span)==null?void 0:T.call(f,L,x+1,k,w,A))||L;a==="inline"?o.children.push(L):a==="classic"&&w.children.push(L),k+=A.content.length}if(a==="classic"){for(const A of s)w=((C=A==null?void 0:A.line)==null?void 0:C.call(f,w,x+1))||w;d.push(w),i.push(w)}}),a==="classic"){for(const b of s)u=((p=b==null?void 0:b.code)==null?void 0:p.call(f,u))||u;c.children.push(u);for(const b of s)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 s)m=((v=b==null?void 0:b.root)==null?void 0:v.call(f,m))||m;return r&&Gy(m,r),m}function Cne(e){return e.map(t=>{const n=[];let r="",s=0;return t.forEach((i,o)=>{const l=!(i.fontStyle&&i.fontStyle&ja.Underline);l&&i.content.match(/^\s+$/)&&t[o+1]?(s||(s=i.offset),r+=i.content):r?(l?n.push({...i,offset:s,content:r+i.content}):n.push({content:r,offset:s},i),s=0,r=""):n.push(i)}),n})}function Ane(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,i,o]=r;if(!s&&!o)return n;const a=[{...n,offset:n.offset+s.length,content:i}];return s&&a.unshift({content:s,offset:n.offset}),o&&a.push({content:o,offset:n.offset+s.length+i.length}),a}))}function Ene(e,t,n){var i;const r={meta:{},options:n,codeToHast:(o,a)=>E1(e,o,a),codeToTokens:(o,a)=>A1(e,o,a)};let s=Jte(E1(e,t,n,r));for(const o of T1(n))s=((i=o.postprocess)==null?void 0:i.call(r,s,n))||s;return s}const t9={light:"#333333",dark:"#bbbbbb"},n9={light:"#fffffe",dark:"#1e1e1e"},r9="__shiki_resolved";function x_(e){var a,l,c,u,d;if(e!=null&&e[r9])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:r}=t;if(!n||!r){const f=t.settings?t.settings.find(m=>!m.name&&!m.scope):void 0;(a=f==null?void 0:f.settings)!=null&&a.foreground&&(r=f.settings.foreground),(l=f==null?void 0:f.settings)!=null&&l.background&&(n=f.settings.background),!r&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(r=t.colors["editor.foreground"]),!n&&((u=t==null?void 0:t.colors)!=null&&u["editor.background"])&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?t9.light:t9.dark),n||(n=t.type==="light"?n9.light:n9.dark),t.fg=r,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 s=0;const i=new Map;function o(f){var p;if(i.has(f))return i.get(f);s+=1;const m=`#${s.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 v,b;const m=((v=f.settings)==null?void 0:v.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 x=o(f.settings.foreground);t.colorReplacements[x]=f.settings.foreground,y.settings.foreground=x}if(p){const x=o(f.settings.background);t.colorReplacements[x]=f.settings.background,y.settings.background=x}return y});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((d=t.colors[f])!=null&&d.startsWith("#"))){const m=o(t.colors[f]);t.colorReplacements[m]=t.colors[f],t.colors[f]=m}return Object.defineProperty(t,r9,{enumerable:!1,writable:!1,value:!0}),t}async function Mj(e){return Array.from(new Set((await Promise.all(e.filter(t=>!vj(t)).map(async t=>await Sj(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Nj(e){return(await Promise.all(e.map(async n=>_j(n)?null:x_(await Sj(n))))).filter(n=>!!n)}class Mne extends Qee{constructor(n,r,s,i={}){super(n);oe(this,"_resolvedThemes",new Map);oe(this,"_resolvedGrammars",new Map);oe(this,"_langMap",new Map);oe(this,"_langGraph",new Map);oe(this,"_textmateThemeCache",new WeakMap);oe(this,"_loadedThemesCache",null);oe(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=r,this._langs=s,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 r=x_(n);return r.name&&(this._resolvedThemes.set(r.name,r),this._loadedThemesCache=null),r}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let r=this._textmateThemeCache.get(n);r||(r=x1.createFromRawTheme(n),this._textmateThemeCache.set(n,r)),this._syncRegistry.setTheme(r)}getGrammar(n){if(this._alias[n]){const r=new Set([n]);for(;this._alias[n];){if(n=this._alias[n],r.has(n))throw new As(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,l,c;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(u=>{var d;return(d=u.embeddedLangsLazy)==null?void 0:d.includes(n.name)}));this._resolver.addLanguage(n);const s={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,s);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(u=>{this._alias[u]=n.name}),this._loadedLanguagesCache=null,r.size)for(const u of r)this._resolvedGrammars.delete(u.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.delete(u.scopeName),(c=(l=this._syncRegistry)==null?void 0:l._grammars)==null||c.delete(u.scopeName),this.loadLanguage(this._langMap.get(u.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 r=Array.from(this._langGraph.entries()),s=r.filter(([i,o])=>!o);if(s.length){const i=r.filter(([o,a])=>{var l;return a&&((l=a.embeddedLangs)==null?void 0:l.some(c=>s.map(([u])=>u).includes(c)))}).filter(o=>!s.includes(o));throw new As(`Missing languages ${s.map(([o])=>`\`${o}\``).join(", ")}, required by ${i.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[i,o]of r)this._resolver.addLanguage(o);for(const[i,o]of r)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 r of n.embeddedLangs)this._langGraph.set(r,this._langMap.get(r))}}class Nne{constructor(t,n){oe(this,"_langs",new Map);oe(this,"_scopeToLang",new Map);oe(this,"_injections",new Map);oe(this,"_onigLib");this._onigLib={createOnigScanner:r=>t.createScanner(r),createOnigString:r=>t.createString(r)},n.forEach(r=>this.addLanguage(r))}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 r=[];for(let s=1;s<=n.length;s++){const i=n.slice(0,s).join(".");r=[...r,...this._injections.get(i)||[]]}return r}}let af=0;function Ine(e){af+=1,e.warnings!==!1&&af>=10&&af%10===0&&console.warn(`[Shiki] ${af} 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 As("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(x_),s=new Nne(e.engine,n),i=new Mne(s,r,n,e.langAlias);let o;function a(x){v();const w=i.getGrammar(typeof x=="string"?x:x.name);if(!w)throw new As(`Language \`${x}\` not found, you may need to load it first`);return w}function l(x){if(x==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};v();const w=i.getTheme(x);if(!w)throw new As(`Theme \`${x}\` not found, you may need to load it first`);return w}function c(x){v();const w=l(x);o!==x&&(i.setTheme(w),o=x);const k=i.getColorMap();return{theme:w,colorMap:k}}function u(){return v(),i.getLoadedThemes()}function d(){return v(),i.getLoadedLanguages()}function f(...x){v(),i.loadLanguages(x.flat(1))}async function m(...x){return f(await Mj(x))}function p(...x){v();for(const w of x.flat(1))i.loadTheme(w)}async function y(...x){return v(),p(await Nj(x))}function v(){if(t)throw new As("Shiki instance has been disposed")}function b(){t||(t=!0,i.dispose(),af-=1)}return{setTheme:c,getTheme:l,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:d,loadLanguage:m,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:b,[Symbol.dispose]:b}}async function Rne(e={}){e.loadWasm;const[t,n,r]=await Promise.all([Nj(e.themes||[]),Mj(e.langs||[]),e.engine||ej(e.loadWasm||dee())]);return Ine({...e,themes:t,langs:n,engine:r})}async function jne(e={}){const t=await Rne(e);return{getLastGrammarState:(...n)=>yne(t,...n),codeToTokensBase:(n,r)=>b_(t,n,r),codeToTokensWithThemes:(n,r)=>Ej(t,n,r),codeToTokens:(n,r)=>A1(t,n,r),codeToHast:(n,r)=>E1(t,n,r),codeToHtml:(n,r)=>Ene(t,n,r),...t,getInternalContext:()=>t}}function Lne(e,t,n){let r,s,i;{const a=e;r=a.langs,s=a.themes,i=a.engine}async function o(a){function l(m){if(typeof m=="string"){if(vj(m))return[];const p=r[m];if(!p)throw new za(`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(_j(m))return"none";if(typeof m=="string"){const p=s[m];if(!p)throw new za(`Theme \`${m}\` is not included in this bundle. You may want to load it from external source.`);return p}return m}const u=(a.themes??[]).map(m=>c(m)),d=(a.langs??[]).map(m=>l(m)),f=await jne({engine:a.engine??i(),...a,themes:u,langs:d});return{...f,loadLanguage(...m){return f.loadLanguage(...m.map(l))},loadTheme(...m){return f.loadTheme(...m.map(c))}}}return o}const Dne=Lne({langs:VZ,themes:GZ,engine:()=>ej(q(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const One=["github-light-default","github-dark-default"];let gp=null,Zw=null;const ev=new Set,f4=new Map,s9=new Set,Bne=128,Af=new Map;function Ij(e,t,n){return`${t}\0${n}\0${e}`}function $ne(e,t){if(Af.size>=Bne){const n=Af.keys().next().value;n!==void 0&&Af.delete(n)}Af.set(e,t)}function zne(e,t,n){return Af.get(Ij(e,t,n))??null}function Pne(){return gp||(gp=Dne({langs:[],themes:One}).then(e=>(Zw=e,e)).catch(e=>{throw gp=null,e})),gp}async function qne(e){const t=await Pne();if(ev.has(e))return t;if(s9.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=f4.get(e);return n||(n=t.loadLanguage(e).then(()=>{ev.add(e)}).catch(r=>{throw s9.add(e),r}).finally(()=>{f4.delete(e)}),f4.set(e,n)),await n,t}const Fne=1e5,Une=2e4;function Hne(e){if(e.length>Fne)return!0;let t=0;const n=e.length;for(let r=0;r<=n;r++)if(r===n||e.charCodeAt(r)===10){if(r-t>Une)return!0;t=r+1}return!1}function i9(e,t,n,r=!0){if(Zw&&ev.has(t))try{const s=Zw.codeToHtml(e,{lang:t,theme:n});return r&&$ne(Ij(e,t,n),s),s}catch(s){return console.warn("[web-shell] sync highlight failed for lang=%s",t,s),null}return null}const Vne="_tableShell_111ca_1",Wne="_toolbar_111ca_11",Gne="_summary_111ca_22",Kne="_hint_111ca_27",Yne="_selection_111ca_31",Xne="_copyButton_111ca_36",Qne="_secondaryButton_111ca_37",Jne="_primaryButton_111ca_38",Zne="_copyCheck_111ca_47",ere="_scroller_111ca_71",tre="_table_111ca_1",nre="_headerCell_111ca_91",rre="_cell_111ca_92",sre="_headerControls_111ca_115",ire="_headerButton_111ca_121",ore="_filterTrigger_111ca_138",are="_headerText_111ca_142",lre="_sortIcon_111ca_149",cre="_filterTriggerActive_111ca_165",ure="_filterMenu_111ca_170",dre="_filterMenuTitle_111ca_186",hre="_filterMenuSection_111ca_196",fre="_filterMenuAction_111ca_204",mre="_activeAction_111ca_217",pre="_filterSearch_111ca_226",gre="_conditionInput_111ca_227",yre="_conditionSelect_111ca_228",bre="_filterOptionList_111ca_244",xre="_filterOption_111ca_244",wre="_optionLabel_111ca_270",vre="_optionCount_111ca_278",_re="_optionLimitHint_111ca_284",kre="_conditionTitle_111ca_290",Sre="_conditionInputs_111ca_295",Tre="_filterFooter_111ca_300",Cre="_footerSpacer_111ca_307",Are="_dragging_111ca_324",Ere="_evenRow_111ca_328",Mre="_selectedCell_111ca_336",Nre="_actionHeaderCell_111ca_343",Ire="_actionCell_111ca_344",Rre="_rowDetailButton_111ca_357",jre="_detailRow_111ca_372",Lre="_detailCell_111ca_376",Dre="_detailPanel_111ca_383",Ore="_detailTitle_111ca_389",Bre="_detailItem_111ca_394",$re="_detailLabel_111ca_400",zre="_detailValue_111ca_405",Pre="_emptyState_111ca_412",Je={tableShell:Vne,toolbar:Wne,summary:Gne,hint:Kne,selection:Yne,copyButton:Xne,secondaryButton:Qne,primaryButton:Jne,copyCheck:Zne,scroller:ere,table:tre,headerCell:nre,cell:rre,headerControls:sre,headerButton:ire,filterTrigger:ore,headerText:are,sortIcon:lre,filterTriggerActive:cre,filterMenu:ure,filterMenuTitle:dre,filterMenuSection:hre,filterMenuAction:fre,activeAction:mre,filterSearch:pre,conditionInput:gre,conditionSelect:yre,filterOptionList:bre,filterOption:xre,optionLabel:wre,optionCount:vre,optionLimitHint:_re,conditionTitle:kre,conditionInputs:Sre,filterFooter:Tre,footerSpacer:Cre,dragging:Are,evenRow:Ere,selectedCell:Mre,actionHeaderCell:Nre,actionCell:Ire,rowDetailButton:Rre,detailRow:jre,detailCell:Lre,detailPanel:Dre,detailTitle:Ore,detailItem:Bre,detailLabel:$re,detailValue:zre,emptyState:Pre},qre={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"},Fre={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"},Ure=500,Hre=50,Vre='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Wre(e){return Array.from(e.querySelectorAll(Vre)).filter(t=>!t.hasAttribute("hidden"))}function o9(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function Gre(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function su(e,t){return g.isValidElement(e)&&e.type===t}function Kre(e){return e.replace(/\s+/g," ").trim()}function tv(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(tv).join(""):g.isValidElement(e)?e.type==="img"?e.props.alt??"":tv(e.props.children):""}function Yre(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",isHeader:!1}}function Rj(e,t){const n=g.Children.toArray(e.props.children).filter(r=>su(r,"td")||su(r,"th"));return{key:t,cells:n.map((r,s)=>{var i;return{key:`${t}-${s}`,content:r.props.children,text:Kre(tv(r.props.children)),isHeader:r.type==="th",textAlign:(i=r.props.style)==null?void 0:i.textAlign}})}}function m4(e,t){return g.Children.toArray(e.props.children).filter(n=>su(n,"tr")).map((n,r)=>Rj(n,`${t}-${r}`))}function Xre(e,t){return{...e,cells:Array.from({length:t},(n,r)=>e.cells[r]??Yre(e.key,r))}}function Qre(e,t){const n=g.Children.toArray(e),r=[],s=[],i=[];if(n.forEach((u,d)=>{su(u,"thead")?r.push(...m4(u,`head-${d}`)):su(u,"tbody")?s.push(...m4(u,`body-${d}`)):su(u,"tfoot")?s.push(...m4(u,`foot-${d}`)):su(u,"tr")&&i.push(Rj(u,`row-${d}`))}),i.length>0){const[u,...d]=i;u!=null&&u.cells.some(f=>f.isHeader)?(r.push(u),s.push(...d)):s.push(...i)}const o=[...r,...s],a=Math.max(0,...o.map(u=>u.cells.length)),l=r[0];return{headers:Array.from({length:a},(u,d)=>{const f=l==null?void 0:l.cells[d];if(f)return f;const m=t(d);return{key:`header-${d}`,content:m,text:m,isHeader:!0}}),rows:s.map(u=>Xre(u,a)),columnCount:a}}function Xl(e){const t=e.trim(),n=t.endsWith("%"),s=(n?t.slice(0,-1):t).replace(/[$€£¥₹,\s]/g,"");if(!/^-?(\d+(\.\d+)?|\.\d+)$/.test(s))return null;const i=Number(s);return n?i/100:i}function jj(e,t){const n=Xl(e),r=Xl(t);return n!==null&&r!==null&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function w_(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow),minCol:Math.min(e.anchorCol,e.focusCol),maxCol:Math.max(e.anchorCol,e.focusCol)}}function nv(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"");return/^[=+\-@]/.test(t)?`'${e}`:e}function a9(e,t,n){if(!e)return"";const{minRow:r,maxRow:s,minCol:i,maxCol:o}=w_(e),a=n.filter(c=>c>=i&&c<=o);if(a.length===0)return"";const l=[];for(let c=r;c<=s;c++){const u=t[c];u&&l.push(a.map(d=>{var f;return nv(((f=u.cells[d])==null?void 0:f.text)??"")}).join("	"))}return l.join(`
`)}function Jre(e,t,n){return n.length===0?"":[n.map(s=>{var i;return nv(((i=e[s])==null?void 0:i.text)??"")}).join("	"),...t.map(s=>n.map(i=>{var o;return nv(((o=s.cells[i])==null?void 0:o.text)??"")}).join("	"))].join(`
`)}function Zre(e,t){if(!e)return 0;const{minRow:n,maxRow:r,minCol:s,maxCol:i}=w_(e),o=t.filter(a=>a>=s&&a<=i).length;return(r-n+1)*o}function n0(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 ese(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=e.toLowerCase(),r=t.value.trim().toLowerCase();switch(t.operator){case"equals":return n===r;case"notEquals":return n!==r;case"startsWith":return n.startsWith(r);case"endsWith":return n.endsWith(r);case"contains":default:return n.includes(r)}}function tse(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Xl(e),r=Xl(t.value);if(n===null||r===null)return!1;switch(t.operator){case"gt":return n>r;case"gte":return n>=r;case"lt":return n<r;case"lte":return n<=r;case"between":{const s=Xl(t.valueTo??"");if(s===null)return!1;const i=Math.min(r,s),o=Math.max(r,s);return n>=i&&n<=o}default:return!0}}function nse(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:ese(e,t.textFilter)&&tse(e,t.numberFilter)}function l9(e,t,n){const r=Object.entries(t).map(([s,i])=>[Number(s),i]).filter(([s,i])=>s!==n&&n0(i));return r.length===0?e:e.filter(s=>r.every(([i,o])=>{var a;return nse(((a=s.cells[i])==null?void 0:a.text)??"",o)}))}function rse(e,t){return t?e.map((n,r)=>({row:n,index:r})).sort((n,r)=>{var o,a;const s=jj(((o=n.row.cells[t.columnIndex])==null?void 0:o.text)??"",((a=r.row.cells[t.columnIndex])==null?void 0:a.text)??""),i=t.direction==="asc"?s:-s;return i===0?n.index-r.index:i}).map(({row:n})=>n):e}function sse(e,t,n){const r=new Map;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";r.set(i,(r.get(i)??0)+1)}),Array.from(r.entries()).map(([s,i])=>({value:s,label:s||n,count:i})).sort((s,i)=>jj(s.value,i.value))}function ise(e,t){let n=0,r=0;return e.forEach(s=>{var o;const i=((o=s.cells[t])==null?void 0:o.text)??"";i&&(n+=1,Xl(i)!==null&&(r+=1))}),n>0&&r/n>=.7}function ose(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function ase(e,t){var r,s,i;const n={};if(e.selectedValues!==void 0&&!ose(e.selectedValues,t)&&(n.selectedValues=e.selectedValues),(r=e.textFilter)!=null&&r.value.trim()&&(n.textFilter={operator:e.textFilter.operator,value:e.textFilter.value.trim()}),(s=e.numberFilter)!=null&&s.value.trim()){const o=e.numberFilter.value.trim(),a=(i=e.numberFilter.valueTo)==null?void 0:i.trim();Xl(o)!==null&&(e.numberFilter.operator!=="between"||Xl(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return n0(n)?n:void 0}function lse({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:r}=et();return h.jsxs("div",{className:Je.filterMenuSection,children:[h.jsx("button",{className:`${Je.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?Je.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:r("markdownTable.sort.asc")}),h.jsx("button",{className:`${Je.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?Je.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:r("markdownTable.sort.desc")}),h.jsx("button",{className:Je.filterMenuAction,type:"button",onClick:()=>n(e,null),children:r("markdownTable.sort.clear")})]})}function cse({onHideColumn:e}){const{t}=et();return h.jsx("div",{className:Je.filterMenuSection,children:h.jsx("button",{className:Je.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function use({columnIndex:e,columnName:t,search:n,searchInputRef:r,filteredOptions:s,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:l,onFilteredSelectionChange:c,onToggleValue:u}){const{t:d}=et();return h.jsxs("div",{className:Je.filterMenuSection,children:[h.jsx("input",{ref:r,className:Je.filterSearch,value:n,onChange:f=>l(f.currentTarget.value),placeholder:d("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":d("markdownTable.filter.searchAria",{column:t})}),h.jsxs("label",{className:Je.filterOption,children:[h.jsx("input",{type:"checkbox",name:`markdown-table-filter-all-${e}`,checked:a,onChange:f=>c(f.currentTarget.checked)}),h.jsx("span",{children:d("markdownTable.filter.selectVisible")}),h.jsx("span",{className:Je.optionCount,children:s.length})]}),h.jsxs("div",{className:Je.filterOptionList,children:[i.map((f,m)=>h.jsxs("label",{className:Je.filterOption,children:[h.jsx("input",{type:"checkbox",name:`markdown-table-filter-option-${e}-${m}`,checked:o.has(f.value),onChange:()=>u(f.value)}),h.jsx("span",{className:Je.optionLabel,children:f.label}),h.jsx("span",{className:Je.optionCount,children:f.count})]},f.value)),s.length>i.length&&h.jsx("div",{className:Je.optionLimitHint,children:d("markdownTable.filter.optionLimit",{count:i.length})}),s.length===0&&h.jsx("div",{className:Je.optionLimitHint,children:d("markdownTable.filter.noOptions")})]})]})}function dse({columnIndex:e,columnName:t,isNumeric:n,textOperator:r,textValue:s,numberOperator:i,numberValue:o,numberValueTo:a,onTextOperatorChange:l,onTextValueChange:c,onNumberOperatorChange:u,onNumberValueChange:d,onNumberValueToChange:f}){const{t:m}=et();return h.jsxs("div",{className:Je.filterMenuSection,children:[h.jsx("div",{className:Je.conditionTitle,children:m("markdownTable.filter.custom")}),n?h.jsxs(h.Fragment,{children:[h.jsx("select",{className:Je.conditionSelect,value:i,name:`markdown-table-number-operator-${e}`,onChange:p=>u(p.currentTarget.value),"aria-label":m("markdownTable.filter.numberAria",{column:t}),children:Object.entries(Fre).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsxs("div",{className:Je.conditionInputs,children:[h.jsx("input",{className:Je.conditionInput,value:o,onChange:p=>d(p.currentTarget.value),placeholder:m("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${e}`}),i==="between"&&h.jsx("input",{className:Je.conditionInput,value:a,onChange:p=>f(p.currentTarget.value),placeholder:m("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${e}`})]})]}):h.jsxs(h.Fragment,{children:[h.jsx("select",{className:Je.conditionSelect,value:r,name:`markdown-table-text-operator-${e}`,onChange:p=>l(p.currentTarget.value),"aria-label":m("markdownTable.filter.textAria",{column:t}),children:Object.entries(qre).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsx("input",{className:Je.conditionInput,value:s,onChange:p=>c(p.currentTarget.value),placeholder:m("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function hse({onClear:e,onClose:t,onApply:n}){const{t:r}=et();return h.jsxs("div",{className:Je.filterFooter,children:[h.jsx("button",{className:Je.secondaryButton,type:"button",onClick:e,children:r("markdownTable.filter.reset")}),h.jsx("span",{className:Je.footerSpacer}),h.jsx("button",{className:Je.secondaryButton,type:"button",onClick:t,children:r("markdownTable.filter.cancel")}),h.jsx("button",{className:Je.primaryButton,type:"button",onClick:n,children:r("markdownTable.filter.confirm")})]})}function fse({id:e,columnName:t,columnIndex:n,filter:r,isNumeric:s,options:i,sort:o,style:a,menuRef:l,canHideColumn:c,onApply:u,onClose:d,onHideColumn:f,onSort:m}){var B,I,ne,de,ce;const p=g.useMemo(()=>i.map(Ne=>Ne.value),[i]),[y,v]=g.useState(""),[b,x]=g.useState(()=>new Set((r==null?void 0:r.selectedValues)??p)),[w,k]=g.useState(((B=r==null?void 0:r.textFilter)==null?void 0:B.operator)??"contains"),[T,C]=g.useState(((I=r==null?void 0:r.textFilter)==null?void 0:I.value)??""),[A,L]=g.useState(((ne=r==null?void 0:r.numberFilter)==null?void 0:ne.operator)??"gt"),[$,E]=g.useState(((de=r==null?void 0:r.numberFilter)==null?void 0:de.value)??""),[z,M]=g.useState(((ce=r==null?void 0:r.numberFilter)==null?void 0:ce.valueTo)??""),U=g.useRef(null);g.useEffect(()=>{var Ne;(Ne=U.current)==null||Ne.focus()},[]);const K=g.useMemo(()=>{const Ne=y.trim().toLowerCase();return Ne?i.filter(Ce=>Ce.label.toLowerCase().includes(Ne)):i},[i,y]),J=K.slice(0,500),P=K.length>0&&K.every(Ne=>b.has(Ne.value)),V=Ne=>{x(Ce=>{const ze=new Set(Ce);return K.forEach(ue=>{Ne?ze.add(ue.value):ze.delete(ue.value)}),ze})},X=Ne=>{x(Ce=>{const ze=new Set(Ce);return ze.has(Ne)?ze.delete(Ne):ze.add(Ne),ze})},te=()=>{u(n,ase({selectedValues:Array.from(b),textFilter:{operator:w,value:T},numberFilter:{operator:A,value:$,valueTo:z}},p))},D=()=>{u(n,void 0)},j=(o==null?void 0:o.columnIndex)===n?o:null;return h.jsxs("div",{ref:l,id:e,className:Je.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[h.jsx("div",{id:`${e}-title`,className:Je.filterMenuTitle,children:t}),h.jsx(lse,{columnIndex:n,sortedThisColumn:j,onSort:m}),c&&h.jsx(cse,{onHideColumn:()=>f(n)}),h.jsx(use,{columnIndex:n,columnName:t,search:y,searchInputRef:U,filteredOptions:K,visibleOptions:J,selectedValues:b,allFilteredSelected:P,onSearchChange:v,onFilteredSelectionChange:V,onToggleValue:X}),h.jsx(dse,{columnIndex:n,columnName:t,isNumeric:s,textOperator:w,textValue:T,numberOperator:A,numberValue:$,numberValueTo:z,onTextOperatorChange:k,onTextValueChange:C,onNumberOperatorChange:L,onNumberValueChange:E,onNumberValueToChange:M}),h.jsx(hse,{onClear:D,onClose:d,onApply:te})]})}function mse({children:e,fallback:t,toolbarExtra:n}){const{t:r}=et(),s=g.useMemo(()=>Qre(e,i=>r("markdownTable.column",{index:i+1})),[e,r]);return s.columnCount===0?h.jsx(h.Fragment,{children:t??h.jsx("table",{children:e})}):s.rows.length>Ure||s.columnCount>Hre?h.jsx(h.Fragment,{children:t??h.jsx("table",{children:e})}):h.jsx(pse,{table:s,toolbarExtra:n})}function pse({table:e,toolbarExtra:t}){const{t:n}=et(),r=g.useId(),[s,i]=g.useState(null),[o,a]=g.useState({}),[l,c]=g.useState(null),[u,d]=g.useState(null),[f,m]=g.useState(()=>new Set),[p,y]=g.useState(null),[v,b]=g.useState(!1),[x,w]=g.useState(!1),[k,T]=g.useState(!1),C=g.useRef(!1),A=g.useRef(null),L=g.useRef(null),$=g.useRef(0),E=g.useRef(0),z=g.useRef(!0),M=g.useRef(null),U=g.useRef(null),K=g.useRef(null),J=g.useRef(null),P=g.useRef(0),V=g.useRef(null),X=g.useRef(0),te=g.useMemo(()=>`${e.columnCount}\0${e.headers.map(he=>he.text).join("\0")}`,[e.columnCount,e.headers]),D=g.useRef(te),j=g.useCallback(()=>{P.current&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{P.current=0;const he=J.current;he!=null&&he.isConnected&&he.focus()})},[]),B=g.useCallback(()=>{d(null),j()},[j]),I=g.useCallback(()=>{$.current+=1,A.current&&(clearTimeout(A.current),A.current=null),w(!1)},[]),ne=g.useCallback(()=>{E.current+=1,L.current&&(clearTimeout(L.current),L.current=null),T(!1)},[]),de=g.useCallback(()=>{X.current&&(cancelAnimationFrame(X.current),X.current=0);const he=V.current;V.current=null,he&&c(Z=>Z&&{...Z,focusRow:he.rowIndex,focusCol:he.columnIndex})},[]),ce=g.useCallback(()=>{de(),C.current=!1,b(!1)},[de]);g.useEffect(()=>{const he=()=>{document.hidden&&ce()};return window.addEventListener("mouseup",ce),window.addEventListener("blur",ce),document.addEventListener("visibilitychange",he),()=>{window.removeEventListener("mouseup",ce),window.removeEventListener("blur",ce),document.removeEventListener("visibilitychange",he),X.current&&cancelAnimationFrame(X.current),P.current&&cancelAnimationFrame(P.current)}},[ce]),g.useEffect(()=>{D.current!==te&&(D.current=te,i(null),a({}),c(null),d(null),m(new Set),y(null),I(),ne(),C.current=!1,b(!1))},[ne,I,te]),g.useEffect(()=>{ne()},[ne,l]),g.useEffect(()=>(z.current=!0,()=>{z.current=!1,A.current&&(clearTimeout(A.current),A.current=null),L.current&&(clearTimeout(L.current),L.current=null)}),[]),g.useEffect(()=>{if(!u)return;const he=Ve=>{var It,ye;const mt=Ve.target;!((It=K.current)!=null&&It.contains(mt))&&!((ye=J.current)!=null&&ye.contains(mt))&&d(null)},Z=Ve=>{var rn;if(Ve.key==="Escape"){B();return}if(Ve.key!=="Tab")return;const mt=K.current,It=document.activeElement;if(!mt||!(It instanceof Node)||!mt.contains(It))return;const ye=Wre(mt);if(ye.length===0)return;const at=It instanceof HTMLElement?ye.indexOf(It):-1,Ut=Ve.shiftKey?at<=0?ye.length-1:at-1:at===-1||at===ye.length-1?0:at+1;Ve.preventDefault(),(rn=ye[Ut])==null||rn.focus()},ie=Ve=>{var It;const mt=Ve.target;mt instanceof Node&&((It=K.current)!=null&&It.contains(mt))||d(null)},fe=()=>d(null);return document.addEventListener("mousedown",he),document.addEventListener("keydown",Z),document.addEventListener("scroll",ie,!0),window.addEventListener("resize",fe),()=>{document.removeEventListener("mousedown",he),document.removeEventListener("keydown",Z),document.removeEventListener("scroll",ie,!0),window.removeEventListener("resize",fe)}},[B,u]);const Ne=g.useMemo(()=>l9(e.rows,o),[o,e.rows]),Ce=g.useMemo(()=>rse(Ne,s),[Ne,s]),ze=g.useMemo(()=>{if(!u)return[];const he=u.columnIndex;return sse(l9(e.rows,o,he),he,n("markdownTable.blank"))},[o,u,n,e.rows]),ue=g.useMemo(()=>e.headers.map((he,Z)=>ise(e.rows,Z)),[e.headers,e.rows]),rt=g.useMemo(()=>e.headers.map((he,Z)=>Z).filter(he=>!f.has(he)),[f,e.headers]);g.useEffect(()=>{I()},[I,rt,Ce]),g.useEffect(()=>{p&&!Ce.some(he=>he.key===p)&&y(null)},[p,Ce]);const xe=(he,Z)=>{c(null),a(ie=>{const fe={...ie};return Z&&n0(Z)?fe[he]=Z:delete fe[he],fe}),B()},Ee=(he,Z)=>{c(null),i(Z?{columnIndex:he,direction:Z}:null)},Zt=he=>{c(null),i(Z=>(Z==null?void 0:Z.columnIndex)!==he?{columnIndex:he,direction:"asc"}:Z.direction==="asc"?{columnIndex:he,direction:"desc"}:null)},ht=(he,Z)=>{c(null),J.current=he.currentTarget;const ie=he.currentTarget.getBoundingClientRect(),fe=300,Ve=430,mt={columnIndex:Z,left:Math.max(6,Math.min(ie.right-fe,window.innerWidth-fe-6)),top:window.innerHeight-ie.bottom<Ve?Math.max(8,ie.top-Ve-2):ie.bottom+2};d(It=>(It==null?void 0:It.columnIndex)===Z?null:mt)},bt=he=>{rt.length<=1||(c(null),B(),a(Z=>{const ie={...Z};return delete ie[he],ie}),i(Z=>(Z==null?void 0:Z.columnIndex)===he?null:Z),m(Z=>{const ie=new Set(Z);return ie.add(he),ie}))},Vt=()=>{c(null),m(new Set)},pn=he=>{c(null),y(Z=>Z===he?null:he)},vt=g.useMemo(()=>l?w_(l):null,[l]),Wt=(he,Z)=>{if(!vt)return!1;const{minRow:ie,maxRow:fe,minCol:Ve,maxCol:mt}=vt;return he>=ie&&he<=fe&&Z>=Ve&&Z<=mt},Gt=(he,Z)=>{u!==null&&d(null),C.current=!0,c({anchorRow:he,anchorCol:Z,focusRow:he,focusCol:Z})},Tt=(he,Z,ie)=>{var fe;he.button!==0||o9(he.target)||(he.preventDefault(),(fe=U.current)==null||fe.focus({preventScroll:!0}),Gt(Z,ie))},Oe=(he,Z)=>{C.current&&(b(!0),V.current={rowIndex:he,columnIndex:Z},!X.current&&(X.current=requestAnimationFrame(()=>{X.current=0;const ie=V.current;V.current=null,ie&&c(fe=>fe&&{...fe,focusRow:ie.rowIndex,focusCol:ie.columnIndex})})))},ot=he=>{var mt;const Z=document.elementFromPoint(he.clientX,he.clientY),ie=Z==null?void 0:Z.closest("[data-row-index][data-column-index]");if(!ie||!((mt=M.current)!=null&&mt.contains(ie)))return null;const fe=Number(ie.dataset.rowIndex),Ve=Number(ie.dataset.columnIndex);return!Number.isInteger(fe)||!Number.isInteger(Ve)?null:{rowIndex:fe,columnIndex:Ve}},ft=(he,Z,ie)=>{he.touches.length!==1||o9(he.target)||Gt(Z,ie)},F=he=>{if(!C.current||he.touches.length!==1)return;const Z=he.touches[0];if(!Z)return;const ie=ot(Z);ie&&(he.preventDefault(),Oe(ie.rowIndex,ie.columnIndex))},W=()=>{const he=a9(l,Ce,rt);if(!he||!navigator.clipboard)return;const Z=E.current;navigator.clipboard.writeText(he).then(()=>{z.current&&E.current===Z&&(L.current&&clearTimeout(L.current),T(!0),L.current=setTimeout(()=>T(!1),2e3))}).catch(ie=>console.warn("[web-shell] clipboard write failed:",ie))},re=()=>{const he=Jre(e.headers,Ce,rt);if(!he||!navigator.clipboard)return;const Z=$.current;navigator.clipboard.writeText(he).then(()=>{z.current&&$.current===Z&&(A.current&&clearTimeout(A.current),w(!0),A.current=setTimeout(()=>w(!1),2e3))}).catch(ie=>console.warn("[web-shell] clipboard write failed:",ie))},me=he=>{if(Gre())return;const Z=a9(l,Ce,rt);Z&&(he.preventDefault(),he.clipboardData.setData("text/plain",Z))},Pe=Zre(l,rt),Re=Object.values(o).filter(n0).length,nt=Ce.length===e.rows.length?n("markdownTable.rows",{count:e.rows.length}):n("markdownTable.rowsFiltered",{visible:Ce.length,total:e.rows.length}),wt=u===null?void 0:e.headers[u.columnIndex],ut=wt&&u?wt.text||n("markdownTable.column",{index:u.columnIndex+1}):"";return h.jsxs("div",{ref:M,className:`${Je.tableShell} ${v?Je.dragging:""}`,children:[h.jsxs("div",{className:Je.toolbar,children:[h.jsx("span",{className:Je.summary,children:nt}),h.jsx("span",{className:Je.hint,children:n("markdownTable.hint")}),h.jsx("button",{className:Je.copyButton,type:"button",onClick:re,children:x?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Je.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyVisible")}),f.size>0&&h.jsx("button",{className:Je.copyButton,type:"button",onClick:Vt,children:n("markdownTable.showHiddenColumns",{count:f.size})}),Re>0&&h.jsx("span",{className:Je.selection,children:n("markdownTable.filtersActive",{count:Re})}),Pe>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Je.selection,children:n("markdownTable.cellsSelected",{count:Pe})}),h.jsx("button",{className:Je.copyButton,type:"button",onClick:W,children:k?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Je.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyTsv")})]}),t]}),h.jsxs("div",{ref:U,className:Je.scroller,tabIndex:0,onCopy:me,children:[h.jsxs("table",{className:Je.table,children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{className:`${Je.headerCell} ${Je.actionHeaderCell}`,children:n("markdownTable.actions")}),rt.map(he=>{const Z=e.headers[he];if(!Z)return null;const ie=(s==null?void 0:s.columnIndex)===he,fe=n0(o[he]),Ve=(u==null?void 0:u.columnIndex)===he,mt=ie?s.direction==="asc"?"↑":"↓":"↕",It=Z.text||n("markdownTable.column",{index:he+1}),ye=ie?n(s.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:It}):n("markdownTable.sortByColumn",{column:It}),at=ie?s.direction==="asc"?"ascending":"descending":"none",Ut=`${r}-filter-${he}`,rn=Z.textAlign?{textAlign:Z.textAlign}:void 0;return h.jsx("th",{className:Je.headerCell,"aria-sort":at,style:rn,children:h.jsxs("div",{className:Je.headerControls,children:[h.jsxs("button",{className:Je.headerButton,type:"button",onClick:()=>Zt(he),"aria-label":ye,style:rn,children:[h.jsx("span",{className:Je.headerText,style:rn,children:Z.content}),h.jsx("span",{className:Je.sortIcon,"aria-hidden":"true",children:mt})]}),h.jsx("button",{className:`${Je.filterTrigger} ${fe?Je.filterTriggerActive:""}`,type:"button",onClick:to=>ht(to,he),"aria-label":n("markdownTable.filterColumn",{column:It}),"aria-expanded":Ve,"aria-controls":Ve?Ut:void 0,children:"▾"})]})},Z.key)})]})}),h.jsx("tbody",{children:Ce.map((he,Z)=>{const ie=p===he.key,fe=`${r}-detail-${he.key}`;return h.jsxs(g.Fragment,{children:[h.jsxs("tr",{className:Z%2===1?Je.evenRow:void 0,children:[h.jsx("td",{className:`${Je.cell} ${Je.actionCell}`,children:h.jsx("button",{className:Je.rowDetailButton,type:"button",onClick:()=>pn(he.key),"aria-expanded":ie,"aria-controls":fe,"aria-label":n(ie?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:Z+1}),children:n("markdownTable.rowDetails")})}),rt.map(Ve=>{const mt=he.cells[Ve];if(!mt)return null;const It=mt.textAlign?{textAlign:mt.textAlign}:void 0;return h.jsx("td",{className:`${Je.cell} ${Wt(Z,Ve)?Je.selectedCell:""}`,style:It,"data-row-index":Z,"data-column-index":Ve,onMouseDown:ye=>Tt(ye,Z,Ve),onMouseEnter:()=>Oe(Z,Ve),onTouchStart:ye=>ft(ye,Z,Ve),onTouchMove:F,onTouchEnd:ce,onTouchCancel:ce,children:mt.content},mt.key)})]}),ie&&h.jsx("tr",{id:fe,className:Je.detailRow,children:h.jsx("td",{className:Je.detailCell,colSpan:rt.length+1,children:h.jsxs("div",{className:Je.detailPanel,children:[h.jsx("div",{className:Je.detailTitle,children:n("markdownTable.detailsHeader")}),rt.map(Ve=>{const mt=e.headers[Ve],It=he.cells[Ve];if(!mt||!It)return null;const ye=mt.textAlign?{textAlign:mt.textAlign}:void 0,at=It.textAlign?{textAlign:It.textAlign}:void 0;return h.jsxs("div",{className:Je.detailItem,children:[h.jsx("div",{className:Je.detailLabel,style:ye,children:mt.content}),h.jsx("div",{className:Je.detailValue,style:at,children:It.content})]},`${he.key}-detail-${Ve}`)})]})})})]},he.key)})})]}),Ce.length===0&&h.jsx("div",{className:Je.emptyState,children:e.rows.length===0?n("markdownTable.empty"):n("markdownTable.emptyFiltered")})]}),u&&wt&&h.jsx(fse,{id:`${r}-filter-${u.columnIndex}`,columnName:ut,columnIndex:u.columnIndex,filter:o[u.columnIndex],isNumeric:ue[u.columnIndex]??!1,options:ze,sort:s,style:{left:u.left,top:u.top},menuRef:K,canHideColumn:rt.length>1,onApply:xe,onClose:B,onHideColumn:bt,onSort:Ee},u.columnIndex)]})}const gse="_content_v4tyr_1",yse="_inlineCode_v4tyr_58",bse="_link_v4tyr_67",xse="_tableWrapper_v4tyr_76",wse="_tableToggle_v4tyr_82",vse="_tableToggleActive_v4tyr_111",_se="_tableToggleInline_v4tyr_116",kse="_table_v4tyr_76",Sse="_image_v4tyr_154",Tse="_codeBlock_v4tyr_160",Cse="_codeBlockHeader_v4tyr_169",Ase="_codeBlockLang_v4tyr_178",Ese="_codeBlockCopy_v4tyr_184",Mse="_codeBlockContent_v4tyr_200",Nse="_codeBlockPlain_v4tyr_217",Ise="_mermaidBlock_v4tyr_232",Rse="_mermaidInline_v4tyr_244",jse="_mermaidLoading_v4tyr_263",Lse="_mermaidActions_v4tyr_270",Yt={content:gse,inlineCode:yse,link:bse,tableWrapper:xse,tableToggle:wse,tableToggleActive:vse,tableToggleInline:_se,table:kse,image:Sse,codeBlock:Tse,codeBlockHeader:Cse,codeBlockLang:Ase,codeBlockCopy:Ese,codeBlockContent:Mse,codeBlockPlain:Nse,mermaidBlock:Ise,mermaidInline:Rse,mermaidLoading:jse,mermaidActions:Lse},Dse=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","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"]),c9={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 Ose(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(c9,t)?c9[t]:t,r=Dse.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:r}}const Lj=/^(https?:|mailto:)/i,Bse=/^data:image\/(png|jpeg|gif|webp);base64,/i;function $se(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:Lj.test(t):!1}function Dj(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||Bse.test(t)?!0:Lj.test(t):!1}let u9,zse=0;function Pse({code:e}){const{t}=et(),n=A5(),[r,s]=g.useState(null),[i,o]=g.useState(null),[a,l]=g.useState("diagram"),[c,u]=g.useState(!1),d=n==="light"?"default":"dark";g.useEffect(()=>{let m=!1;s(null),o(null);const p=setTimeout(()=>{q(()=>import("./mermaid.core-CPW_4UEF.js").then(y=>y.bm),[]).then(async y=>{if(m)return;const v=y.default;u9!==d&&(v.initialize({startOnLoad:!1,theme:d,securityLevel:"strict",suppressErrorRendering:!0}),u9=d);try{const b=`mermaid-${++zse}`,{svg:x}=await v.render(b,e.trim());m||s(x)}catch(b){m||o(b instanceof Error?b.message:"Mermaid render failed")}})},150);return()=>{m=!0,clearTimeout(p)}},[e,d]);const f=()=>{navigator.clipboard.writeText(e).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)},()=>{})};return i?h.jsxs("div",{className:Yt.codeBlock,children:[h.jsx("div",{className:Yt.codeBlockHeader,children:h.jsx("span",{className:Yt.codeBlockLang,children:"mermaid (error)"})}),h.jsx("pre",{className:`${Yt.codeBlockContent} ${Yt.codeBlockPlain}`,children:h.jsx("code",{children:e})})]}):h.jsxs("div",{className:Yt.codeBlock,children:[h.jsxs("div",{className:Yt.codeBlockHeader,children:[h.jsx("span",{className:Yt.codeBlockLang,children:"mermaid"}),h.jsxs("span",{className:Yt.mermaidActions,children:[h.jsx("button",{className:Yt.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),h.jsx("button",{className:Yt.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),a==="code"?h.jsx("pre",{className:`${Yt.codeBlockContent} ${Yt.codeBlockPlain}`,children:h.jsx("code",{children:e})}):r?h.jsx("div",{className:`${Yt.mermaidBlock} ${Yt.mermaidInline}`,dangerouslySetInnerHTML:{__html:r}}):h.jsx("div",{className:`${Yt.mermaidBlock} ${Yt.mermaidLoading} ${Yt.mermaidInline}`,children:h.jsx("span",{children:t("mermaid.rendering")})})]})}function qse({className:e,children:t,isStreaming:n}){const{t:r}=et(),s=A5(),[i,o]=g.useState(null),[a,l]=g.useState(!1),c=e==null?void 0:e.match(/language-(\w+)/),{label:u,lang:d,resolvedLang:f}=Ose(c==null?void 0:c[1]),m=String(t).replace(/\n$/,""),p=s==="light"?"github-light-default":"github-dark-default";g.useEffect(()=>{if(d==="mermaid"||f==="text"||Hne(m)){o(null);return}const v=zne(m,f,p);if(v!==null){o(v);return}const b=!n,x=i9(m,f,p,b);if(x!==null){o(x);return}o(null);let w=!1;return qne(f).then(()=>{if(w)return;const k=i9(m,f,p,b);k!==null&&o(k)}).catch(k=>{w||(console.warn("[web-shell] highlight failed for lang=%s",f,k),o(null))}),()=>{w=!0}},[m,d,f,p,n]);const y=()=>{navigator.clipboard.writeText(m).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return d==="mermaid"&&!n?h.jsx(Pse,{code:m}):h.jsxs("div",{className:Yt.codeBlock,children:[h.jsxs("div",{className:Yt.codeBlockHeader,children:[h.jsx("span",{className:Yt.codeBlockLang,children:u}),h.jsx("button",{className:Yt.codeBlockCopy,onClick:y,children:r(a?"code.copied":"code.copy")})]}),i!==null?h.jsx("div",{className:Yt.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):h.jsx("pre",{className:`${Yt.codeBlockContent} ${Yt.codeBlockPlain}`,children:h.jsx("code",{children:m})})]})}function Fse({children:e}){return h.jsx("code",{className:Yt.inlineCode,children:e})}function fg({children:e,toggle:t}){return h.jsxs("div",{className:Yt.tableWrapper,children:[t,h.jsx("table",{className:Yt.table,children:e})]})}function rv(){return h.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:[h.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"}),h.jsx("path",{d:"M6 10h12"}),h.jsx("path",{d:"M6 14h12"}),h.jsx("path",{d:"M12 6v12"})]})}const Use=rv;function Hse({children:e,tableResetKey:t}){const[n,r]=g.useState(!1),{t:s}=et();if(n){const o=h.jsx("button",{className:`${Yt.tableToggle} ${Yt.tableToggleActive}`,type:"button",onClick:()=>r(!1),title:s("markdownTable.toggleBasic"),"aria-label":s("markdownTable.toggleBasic"),"aria-pressed":!0,children:h.jsx(rv,{})}),a=h.jsx(fg,{toggle:o,children:e}),l=h.jsx("button",{className:`${Yt.tableToggle} ${Yt.tableToggleInline} ${Yt.tableToggleActive}`,type:"button",onClick:()=>r(!1),title:s("markdownTable.toggleBasic"),"aria-label":s("markdownTable.toggleBasic"),"aria-pressed":!0,children:h.jsx(rv,{})}),c=h.jsx(fg,{children:e});return h.jsx(Vse,{fallback:a,resetKey:t,children:h.jsx(mse,{fallback:c,toolbarExtra:l,children:e})})}const i=h.jsx("button",{className:Yt.tableToggle,type:"button",onClick:()=>r(!0),title:s("markdownTable.toggleAdvanced"),"aria-label":s("markdownTable.toggleAdvanced"),"aria-pressed":!1,children:h.jsx(Use,{})});return h.jsx(fg,{toggle:i,children:e})}class Vse extends g.Component{constructor(){super(...arguments);oe(this,"state",{hasError:!1,resetKey:this.props.resetKey})}static getDerivedStateFromError(){return{hasError:!0}}static getDerivedStateFromProps(n,r){return n.resetKey!==r.resetKey?{hasError:!1,resetKey:n.resetKey}:null}componentDidCatch(n,r){console.error("[web-shell] enhanced markdown table failed:",n,r.componentStack)}render(){return this.state.hasError?this.props.fallback:this.props.children}}const Oj=g.createContext(!1);function Wse({className:e,children:t}){const n=g.useContext(Oj);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?h.jsx(qse,{className:e,isStreaming:n,children:String(t)}):h.jsx(Fse,{children:t})}function Gse({children:e}){return h.jsx(h.Fragment,{children:e})}function Kse({href:e,children:t}){const n=$se(e)?e:void 0;return h.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:Yt.link,children:t})}function Yse({src:e,alt:t}){const n=Dj(e)?e:void 0;return h.jsx("img",{src:n,alt:t||"",className:Yt.image})}function Bj(e,t=""){return{code:Wse,pre:Gse,a:Kse,img:Yse,table({children:n}){return e?h.jsx(Hse,{tableResetKey:t,children:n}):h.jsx(fg,{children:n})}}}const Xse=Bj(),gm=g.memo(function({content:t,source:n,isStreaming:r,enhanceTables:s}){const{markdown:i}=xc(),o=n?i:void 0,a=t&&n&&(o!=null&&o.transformMarkdown)?o.transformMarkdown(t,{source:n}):t,l=g.useMemo(()=>s?Bj(!0,a):Xse,[s,a]),c=o==null?void 0:o.components,u=g.useMemo(()=>c?{...l,...c,...s?{table:l.table}:{}}:l,[l,s,c]);if(!t)return null;const d=o!=null&&o.remarkPlugins?[VS,I7,...o.remarkPlugins]:[VS,I7],f=o!=null&&o.rehypePlugins?[P7,...o.rehypePlugins]:[P7];return h.jsx("div",{className:n!=="thinking"?Yt.content:void 0,"data-markdown-source":n,children:h.jsx(Oj.Provider,{value:!!r,children:h.jsx(JK,{remarkPlugins:d,rehypePlugins:f,components:u,children:a})})})}),Qse="_chatMessageRow_1majp_41",Jse="_chatBubble_1majp_48",Zse="_chatContent_1majp_61",eie="_chatContentCollapsed_1majp_66",tie="_toggleButton_1majp_71",nie="_toggleIcon_1majp_92",rie="_toggleIconExpanded_1majp_99",sie="_chatImages_1majp_103",iie="_chatImageThumb_1majp_110",ba={chatMessageRow:Qse,chatBubble:Jse,chatContent:Zse,chatContentCollapsed:eie,toggleButton:tie,toggleIcon:nie,toggleIconExpanded:rie,chatImages:sie,chatImageThumb:iie},oie=g.memo(function({content:t,images:n}){const{t:r}=et(),s=g.useRef(null),[i,o]=g.useState(!1),[a,l]=g.useState(!1),c=g.useCallback(()=>{const u=s.current;u&&l(u.scrollHeight>400)},[]);return g.useLayoutEffect(()=>{o(!1),c()},[t,n==null?void 0:n.length,c]),g.useEffect(()=>{const u=s.current;if(!u||typeof ResizeObserver>"u")return;const d=new ResizeObserver(c);return d.observe(u),()=>d.disconnect()},[c]),h.jsx("div",{className:ba.chatMessageRow,children:h.jsxs("div",{className:ba.chatBubble,children:[h.jsxs("div",{ref:s,className:`${ba.chatContent} ${a&&!i?ba.chatContentCollapsed:""}`,children:[n&&n.length>0&&h.jsx("div",{className:ba.chatImages,children:n.map((u,d)=>{const f=u.data.startsWith("data:")?u.data:`data:${u.mimeType};base64,${u.data}`;return Dj(f)?h.jsx("img",{src:f,alt:`User uploaded image ${d+1}`,className:ba.chatImageThumb,onLoad:c},d):null})}),t]}),a&&h.jsxs("button",{type:"button",className:ba.toggleButton,onClick:()=>o(u=>!u),children:[h.jsx("span",{children:r(i?"userMessage.showLess":"userMessage.showMore")}),h.jsx("svg",{className:`${ba.toggleIcon} ${i?ba.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})}),aie="_message_1h6f8_1",lie="_messageFooter_1h6f8_7",cie="_copyButton_1h6f8_23",uie="_footerTime_1h6f8_49",die="_thinking_1h6f8_61",hie="_thinkingBody_1h6f8_73",fie="_thinkingSummary_1h6f8_104",mie="_thinkingSummaryIcon_1h6f8_127",pie="_thinkingSummaryText_1h6f8_147",gie="_thinkingSummaryTextActive_1h6f8_157",yie="_thinkingChevronRight_1h6f8_184",bie="_thinkingChevronDown_1h6f8_185",xie="_thinkingExpandedWrap_1h6f8_212",wie="_thinkingExpandedClip_1h6f8_216",vie="_thinkingExpandedCollapsed_1h6f8_224",_ie="_thinkingExpandedInner_1h6f8_228",kie="_content_1h6f8_276",Sie="_contentBody_1h6f8_281",ur={message:aie,messageFooter:lie,copyButton:cie,footerTime:uie,thinking:die,thinkingBody:hie,thinkingSummary:fie,thinkingSummaryIcon:mie,thinkingSummaryText:pie,thinkingSummaryTextActive:gie,thinkingChevronRight:yie,thinkingChevronDown:bie,thinkingExpandedWrap:xie,thinkingExpandedClip:wie,thinkingExpandedCollapsed:vie,thinkingExpandedInner:_ie,content:kie,contentBody:Sie},Tie=g.memo(function({content:t,isStreaming:n,timestamp:r,onBranchSession:s,showFooterActions:i=!1,showBranchAction:o=!1}){const{t:a}=et(),[l,c]=g.useState(!1),u=!!t&&!n&&i,d=g.useCallback(()=>{var m;const f=(m=navigator.clipboard)==null?void 0:m.writeText(t);f&&f.then(()=>{c(!0),window.setTimeout(()=>c(!1),2e3)}).catch(()=>{})},[t]);return h.jsxs("div",{className:ur.message,children:[t&&h.jsx("div",{className:ur.content,children:h.jsx("div",{className:ur.contentBody,children:h.jsx(gm,{content:t,source:"assistant",isStreaming:n,enhanceTables:!n})})}),u&&h.jsxs("div",{className:ur.messageFooter,children:[h.jsx("button",{type:"button",className:ur.copyButton,title:a("assistant.copy"),"aria-label":a("assistant.copy"),onClick:d,children:l?h.jsx(Aie,{}):h.jsx(Cie,{})}),o&&s&&h.jsx("button",{type:"button",className:ur.copyButton,title:a("assistant.branch"),"aria-label":a("assistant.branch"),onClick:s,children:h.jsx(Eie,{})}),r!==void 0&&h.jsx("span",{className:ur.footerTime,"aria-hidden":"true",children:eh(r)})]})]})});function Cie(){return h.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[h.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"}),h.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function Aie(){return h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Eie(){return h.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[h.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"}),h.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"}),h.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),h.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const Mie=g.memo(function({content:t,isStreaming:n,timestamp:r}){const{t:s}=et(),i=g.useContext(Dh),[o,a]=g.useState(!1),l=Nie({isStreaming:n}),c=l==="thinking.running",u=g.useRef(r??Date.now()),d=g.useRef(c),[f,m]=g.useState(()=>Date.now()),[p,y]=g.useState(null);g.useEffect(()=>{if(!t||!c)return;m(Date.now());const x=setInterval(()=>m(Date.now()),1e3);return()=>clearInterval(x)},[t,c]),g.useEffect(()=>{if(t){if(c){d.current=!0,y(null);return}d.current&&p===null&&y(Date.now())}},[t,p,c]);const v=c||p?Iie((c?f:p)-u.current):"",b=g.useCallback(()=>{a(x=>!x)},[]);return h.jsx("div",{className:ur.message,children:t&&!i&&h.jsx("div",{className:ur.thinking,children:h.jsxs("div",{className:ur.thinkingBody,children:[h.jsxs("button",{type:"button",className:ur.thinkingSummary,onClick:b,"aria-expanded":o,title:s(o?"thinking.collapse":"thinking.expand"),children:[h.jsx("span",{className:ur.thinkingSummaryIcon,"aria-hidden":"true",children:h.jsx(Rie,{})}),h.jsx("span",{className:c?`${ur.thinkingSummaryText} ${ur.thinkingSummaryTextActive}`:ur.thinkingSummaryText,children:s(l,{duration:v})}),h.jsx("span",{className:o?ur.thinkingChevronDown:ur.thinkingChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:o?ur.thinkingExpandedClip:`${ur.thinkingExpandedClip} ${ur.thinkingExpandedCollapsed}`,children:h.jsx("div",{className:ur.thinkingExpandedInner,children:h.jsx("div",{className:ur.thinkingExpandedWrap,children:h.jsx(gm,{content:t,source:"thinking",isStreaming:n})})})})]})})})});function Nie({isStreaming:e}){return e?"thinking.running":"thinking.done"}function Iie(e){const t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}function Rie(){return h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[h.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),h.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),h.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"}),h.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 jie="_panel_8ng9u_1",Lie="_title_8ng9u_16",Die="_metaLine_8ng9u_22",Oie="_progress_8ng9u_32",Bie="_spacer_8ng9u_38",$ie="_row_8ng9u_42",zie="_detailRow_8ng9u_43",Pie="_subDetailRow_8ng9u_44",qie="_symbol_8ng9u_65",Fie="_label_8ng9u_69",Uie="_value_8ng9u_73",Hie="_detailName_8ng9u_80",Vie="_sectionTitle_8ng9u_88",Wie="_detailSection_8ng9u_94",Gie="_skillBlock_8ng9u_100",Kie="_hint_8ng9u_105",Yie="_detailCommand_8ng9u_111",Xie="_bodyLoaded_8ng9u_132",Qie="_accent_8ng9u_137",Jie="_secondary_8ng9u_141",Zie="_warning_8ng9u_145",eoe="_error_8ng9u_149",toe="_success_8ng9u_153",Ct={panel:jie,title:Lie,metaLine:Die,progress:Oie,spacer:Bie,row:$ie,detailRow:zie,subDetailRow:Pie,symbol:qie,label:Fie,value:Uie,detailName:Hie,sectionTitle:Vie,detailSection:Wie,skillBlock:Gie,hint:Kie,detailCommand:Yie,bodyLoaded:Xie,accent:Qie,secondary:Jie,warning:Zie,error:eoe,success:toe},sv="web-shell:context-usage:v1:",yl="█",$j="▒",zj="░",Pj=30;function noe(e){return`${sv}${JSON.stringify(e)}`}function roe(e){if(!e.startsWith(sv))return null;try{const t=JSON.parse(e.slice(sv.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function qj(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function oh(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function soe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function ioe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function ooe({usedPercentage:e,bufferPercentage:t}){const r=Math.round(Math.min(e,100)/100*56),s=Math.round(Math.min(t,Math.max(0,100-e))/100*56),i=Math.max(0,56-r-s),o=e>80?Ct.error:e>60?Ct.warning:Ct.accent;return h.jsxs("div",{className:Ct.progress,"aria-hidden":"true",children:[h.jsx("span",{className:o,children:yl.repeat(Math.max(0,r))}),h.jsx("span",{className:Ct.secondary,children:zj.repeat(Math.max(0,i))}),h.jsx("span",{className:Ct.warning,children:$j.repeat(Math.max(0,s))})]})}function xa({symbol:e,label:t,tokens:n,tokenLabel:r,contextWindowSize:s,symbolClassName:i=Ct.secondary,isOverLimit:o}){return h.jsxs("div",{className:Ct.row,children:[h.jsx("span",{className:`${Ct.symbol} ${i}`,children:e}),h.jsx("span",{className:Ct.label,children:t}),h.jsxs("span",{className:o?Ct.error:Ct.value,children:[oh(n)," ",r," (",soe(n,s),"%)"]})]})}const p4="/context detail";function aoe({hint:e,onShowDetail:t}){const n=t?e.indexOf(p4):-1;return n<0?h.jsx("div",{className:Ct.hint,children:e}):h.jsxs("div",{className:Ct.hint,children:[e.slice(0,n),h.jsx("button",{type:"button",className:Ct.detailCommand,onClick:t,children:p4}),e.slice(n+p4.length)]})}function loe({name:e,tokens:t,tokenLabel:n}){return h.jsxs("div",{className:Ct.detailRow,children:[h.jsxs("span",{className:Ct.secondary,children:["└"," "]}),h.jsx("span",{className:Ct.detailName,title:e,children:qj(e,Pj)}),h.jsxs("span",{className:Ct.value,children:[oh(t)," ",n]})]})}function g4({title:e,items:t,getName:n,tokenLabel:r}){const s=ioe(t);return s.length===0?null:h.jsxs("section",{className:Ct.detailSection,children:[h.jsx("div",{className:Ct.sectionTitle,children:e}),s.map(i=>h.jsx(loe,{name:n(i),tokens:i.tokens,tokenLabel:r},n(i)))]})}function coe({skills:e,labels:t}){const n=[...e].sort((r,s)=>r.loaded!==s.loaded?r.loaded?-1:1:s.tokens+(s.bodyTokens??0)-(r.tokens+(r.bodyTokens??0)));return n.length===0?null:h.jsxs("section",{className:Ct.detailSection,children:[h.jsx("div",{className:Ct.sectionTitle,children:t.skills}),n.map(r=>h.jsxs("div",{className:Ct.skillBlock,children:[h.jsxs("div",{className:Ct.detailRow,children:[h.jsxs("span",{className:Ct.secondary,children:["└"," "]}),h.jsxs("span",{className:Ct.detailName,title:r.name,children:[qj(r.name,Pj),r.loaded&&h.jsxs("span",{className:Ct.success,children:[" ",t.active]})]}),h.jsxs("span",{className:Ct.value,children:[oh(r.tokens)," ",t.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&h.jsxs("div",{className:Ct.subDetailRow,children:[h.jsxs("span",{className:Ct.secondary,children:["  └"," "]}),h.jsx("span",{className:Ct.bodyLoaded,children:t.bodyLoaded}),h.jsxs("span",{className:Ct.success,children:["+",oh(r.bodyTokens)," ",t.tokens]})]})]},r.name))]})}function uoe({status:e,onShowDetail:t}){const{t:n}=et(),{usage:r}=e,{breakdown:s,contextWindowSize:i}=r,o=i>0?r.totalTokens/i*100:0,a=o>100,l=i>0?s.autocompactBuffer/i*100:0;return h.jsxs("div",{className:Ct.panel,children:[h.jsx("div",{className:Ct.title,children:n("contextUsage.title")}),r.isEstimated?h.jsx(h.Fragment,{children:h.jsxs("div",{className:Ct.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",oh(i)," ",n("contextUsage.tokens")]})]})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:Ct.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",oh(i)," ",n("contextUsage.tokens")]})]}),a&&h.jsx("div",{className:Ct.error,children:n("contextUsage.overLimit")})]}),h.jsx(ooe,{usedPercentage:Math.min(o,100),bufferPercentage:l}),h.jsx("div",{className:Ct.spacer}),h.jsx(xa,{symbol:yl,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?Ct.error:Ct.accent,isOverLimit:a}),h.jsx(xa,{symbol:zj,label:n("contextUsage.free"),tokens:s.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),h.jsx(xa,{symbol:$j,label:n("contextUsage.autocompactBuffer"),tokens:s.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Ct.warning}),h.jsx("div",{className:Ct.spacer}),h.jsx("div",{className:Ct.sectionTitle,children:n("contextUsage.usageByCategory")}),h.jsx(xa,{symbol:yl,label:n("contextUsage.systemPrompt"),tokens:s.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Ct.accent}),h.jsx(xa,{symbol:yl,label:n("contextUsage.builtinTools"),tokens:s.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Ct.accent}),s.mcpTools>0&&h.jsx(xa,{symbol:yl,label:n("contextUsage.mcpTools"),tokens:s.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Ct.accent}),h.jsx(xa,{symbol:yl,label:n("contextUsage.memoryFiles"),tokens:s.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Ct.accent}),h.jsx(xa,{symbol:yl,label:n("contextUsage.skills"),tokens:s.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Ct.accent}),!r.isEstimated&&h.jsx(xa,{symbol:yl,label:n("contextUsage.messages"),tokens:s.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Ct.accent}),r.showDetails?h.jsxs(h.Fragment,{children:[h.jsx(g4,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(g4,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(g4,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),h.jsx(coe,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):h.jsx(aoe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const doe={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",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 Fj(e){if(!e.trim())return"Tool";const t=doe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function tl(e,t){const n=Fj(e),r=[`toolName.${e}`,`toolName.${e.toLowerCase()}`,`toolName.${n.toLowerCase()}`];for(const s of r){const i=t(s);if(i!==s)return i}return n}function Rh(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function fs(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const iv=2e3;function Uj(e,t){const n=foe(e,t);if(n)return fs(n,iv);const r=moe(e,t);return r?fs(r,iv):""}function Ko(e){var t;if(!e.content)return av(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return av(e.rawOutput)}function hoe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=d9((av(e.rawOutput)??"").trim());if(o)return o}const n=Ko(e);if(!n)return"";const r=n.split(`
`),s=r.length;if(t==="read"||t==="read_file"||t==="readfile")return`${s} line(s)`;if(t==="glob")return`Found ${r.filter(a=>a.trim()).length} matching file(s)`;if(t==="list_directory"||t==="listfiles")return`${r.filter(a=>a.trim()).length} item(s)`;if(lc(t)){if(s>3)return`${s} lines of output`;const o=r[0]||"";return fs(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=d9(n.trim());return o||`${r.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=r[0]||"";return fs(o,80)}if(t==="websearch"||t==="web_search"){const o=r.filter(a=>a.trim()).length;return o>1?`${o} result(s)`:r[0]||""}if(Rh(t))return"";const i=r[0]||"";return fs(i,80)}function foe(e,t){if(!e.title)return null;const n=Fj(e.toolName),r=e.title.trim();if(r===e.toolName||r===n)return null;const s=[n,e.toolName];for(const i of s)if(r.startsWith(i)){const o=r.slice(i.length);if(/^(:\s*|\s+)/.test(o))return h9(o.replace(/^:\s*|\s+/,""),t)}return h9(r,t)}function d9(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function moe(e,t){const n=e.args||{},r=e.toolName.toLowerCase();if(n.command){let s=String(n.command);return n.directory&&r!=="shell"&&(s+=` [in ${kd(String(n.directory),t)}]`),n.is_background?s+=" [background]":n.timeout&&(s+=` [timeout: ${String(n.timeout)}ms]`),n.description&&(s+=` (${String(n.description).replace(/\n/g," ")})`),fs(s,iv)}if(r==="grep_search"||r==="grep"||r==="search"){const s=n.pattern??n.query;if(s){let i=`'${String(s)}'`;return n.path?i+=` in path '${String(n.path)}'`:(r==="grep_search"||r==="grep")&&(i+=" in path './'"),n.glob&&(i+=` (filter: '${String(n.glob)}')`),i}}if(r==="glob"&&n.pattern){let s=`'${String(n.pattern)}'`;return n.path&&(s+=` in path '${String(n.path)}'`),s}if(n.file_path)return n.description?String(n.description):kd(String(n.file_path),t);if(n.url){const s=String(n.url),i=typeof n.prompt=="string"?n.prompt:void 0,o=i?`${s} — "${fs(i,40)}"`:s;return fs(o,80)}if(n.path)return kd(String(n.path),t);if(n.query)return fs(String(n.query),60);if(r==="list_directory"||r==="listfiles"){const s=n.path||n.directory||"";return kd(String(s),t)}return n.description?String(n.description):""}function lc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function Ka(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(r=>Ka(r,t)))??!1}function h9(e,t){const n=e.trim();return Hj(ov(n))?kd(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>kd(r,t))}function kd(e,t){const n=ov(e),r=t?ov(t).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":Hj(n)?poe(n):n}function ov(e){return e.replace(/\\/g,"/")}function Hj(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function poe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function ym(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function v_(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 L0(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():"",r=v_(e);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":e.status}function __(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const goe="general-purpose";function k_(e){var r;const t=ym(e.rawOutput);if(t){const s=t.subagentName;if(typeof s=="string"&&s)return s}const n=(r=e.args)==null?void 0:r.subagent_type;return typeof n=="string"&&n?n:e.toolName==="task"?"task":goe}function S_(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=ym(e.rawOutput),r=n==null?void 0:n.taskDescription;if(typeof r=="string"&&r.trim())return r.trim();const s=(o=e.args)==null?void 0:o.prompt;return typeof s=="string"&&s.trim()?s.trim().split(`
`)[0]??"":""}function yoe(e,t){var i,o;if(e.status!=="in_progress")return"";const n=e.subTools;if(!n||n.length===0)return"";const r=n[n.length-1];if(r.status!=="in_progress"&&r.status!=="pending")return"";let s=tl(r.toolName??"",t);if(r.title){const a=r.title.indexOf(": ");s+=" "+(a>0?r.title.slice(a+2):r.title)}else(i=r.args)!=null&&i.command?s+=" "+String(r.args.command):(o=r.args)!=null&&o.file_path&&(s+=" "+String(r.args.file_path));return fs(s,50)}function av(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 boe="_panel_1xezz_1",xoe="_title_1xezz_17",woe="_sectionTitle_1xezz_23",voe="_spacer_1xezz_29",_oe="_pivotRow_1xezz_35",koe="_metricCell_1xezz_41",Soe="_metricCellSection_1xezz_48",Toe="_metricCellSub_1xezz_56",Coe="_modelCell_1xezz_64",Aoe="_modelCellHeader_1xezz_71",Eoe="_divider_1xezz_79",Moe="_kvRow_1xezz_87",Noe="_kvSubRow_1xezz_94",Ioe="_kvLabel_1xezz_102",Roe="_kvValue_1xezz_106",joe="_tableRow_1xezz_115",Loe="_tableNameCol_1xezz_121",Doe="_tableToolCol_1xezz_129",Ooe="_tableNumCol_1xezz_137",Boe="_success_1xezz_147",$oe="_error_1xezz_151",zoe="_secondary_1xezz_155",Poe="_warning_1xezz_159",Be={panel:boe,title:xoe,sectionTitle:woe,spacer:voe,pivotRow:_oe,metricCell:koe,metricCellSection:Soe,metricCellSub:Toe,modelCell:Coe,modelCellHeader:Aoe,divider:Eoe,kvRow:Moe,kvSubRow:Noe,kvLabel:Ioe,kvValue:Roe,tableRow:joe,tableNameCol:Loe,tableToolCol:Doe,tableNumCol:Ooe,success:Boe,error:$oe,secondary:zoe,warning:Poe},lv="web-shell:session-stats:v1:";function qoe(e,t="overview"){return`${lv}${JSON.stringify({_view:t,...e})}`}function Foe(e){if(!e.startsWith(lv))return null;try{const t=JSON.parse(e.slice(lv.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 Ql(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),r=Math.floor(t%3600/60),s=Math.floor(t%60),i=[];return n>0&&i.push(`${n}h`),r>0&&i.push(`${r}m`),s>0&&i.push(`${s}s`),i.join(" ")||"0s"}function Zc({label:e,children:t}){return h.jsxs("div",{className:Be.kvRow,children:[h.jsx("span",{className:Be.kvLabel,children:e}),h.jsx("span",{className:Be.kvValue,children:t})]})}function r0({label:e,children:t}){return h.jsxs("div",{className:Be.kvSubRow,children:[h.jsxs("span",{className:Be.secondary,children:["»"," ",e]}),h.jsx("span",{className:Be.kvValue,children:t})]})}function Vj(e){return Object.entries(e).filter(([,t])=>t.api.totalRequests>0).map(([t,n])=>{const r=t.split("::"),s=r[0],i=r[1],o=i?`${s} (${i})`:s;return{key:t,label:o,metrics:n}})}function Uoe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function Hoe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function Voe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Co({metric:e,values:t,variant:n="normal"}){const r=n==="section"?Be.metricCellSection:n==="sub"?Be.metricCellSub:Be.metricCell;return h.jsxs("div",{className:Be.pivotRow,children:[h.jsx("span",{className:r,children:n==="sub"?`↳ ${e}`:e}),t.map((s,i)=>h.jsx("span",{className:Be.modelCell,children:s},i))]})}function Woe({status:e}){const{t}=et(),{models:n,tools:r,files:s}=e,i=Object.values(n).reduce((y,v)=>y+v.api.totalLatencyMs,0),o=r.totalDurationMs,a=i+o,l=a>0?i/a*100:0,c=a>0?o/a*100:0,u=r.totalCalls>0?r.totalSuccess/r.totalCalls*100:0,d=Vj(n),f=d.reduce((y,v)=>y+v.metrics.tokens.cached,0),m=d.reduce((y,v)=>y+v.metrics.tokens.prompt,0),p=m>0?f/m*100:0;return h.jsxs("div",{className:Be.panel,children:[h.jsx("div",{className:Be.title,children:t("stats.title")}),h.jsx("div",{className:Be.sectionTitle,children:t("stats.overview")}),h.jsx(Zc,{label:t("stats.duration"),children:Ql(e.durationMs)}),h.jsx(Zc,{label:t("stats.prompts"),children:e.promptCount}),h.jsx(Zc,{label:t("stats.toolCalls"),children:h.jsxs("span",{children:[r.totalCalls," ",h.jsx("span",{className:Be.secondary,children:"("}),h.jsxs("span",{className:Be.success,children:["✓",r.totalSuccess]})," ",h.jsxs("span",{className:Be.error,children:["✗",r.totalFail]}),h.jsx("span",{className:Be.secondary,children:")"})]})}),h.jsx(Zc,{label:t("stats.successRate"),children:h.jsxs("span",{className:u>=90?Be.success:u>=70?Be.warning:Be.error,children:[u.toFixed(1),"%"]})}),(s.totalLinesAdded>0||s.totalLinesRemoved>0)&&h.jsx(Zc,{label:t("stats.codeChanges"),children:h.jsxs("span",{children:[h.jsxs("span",{className:Be.success,children:["+",s.totalLinesAdded]})," ",h.jsxs("span",{className:Be.error,children:["-",s.totalLinesRemoved]})]})}),h.jsx("div",{className:Be.spacer}),h.jsx("div",{className:Be.sectionTitle,children:t("stats.performance")}),h.jsxs(r0,{label:t("stats.apiTime"),children:[Ql(i)," ",h.jsxs("span",{className:Be.secondary,children:["(",l.toFixed(1),"%)"]})]}),h.jsxs(r0,{label:t("stats.toolTime"),children:[Ql(o)," ",h.jsxs("span",{className:Be.secondary,children:["(",c.toFixed(1),"%)"]})]}),d.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Be.spacer}),h.jsx("div",{className:Be.sectionTitle,children:t("stats.modelUsage")}),h.jsx("div",{className:Be.spacer}),h.jsxs("div",{className:Be.tableRow,children:[h.jsx("span",{className:Be.tableNameCol,children:t("stats.modelUsage")}),h.jsx("span",{className:Be.tableNumCol,children:t("stats.reqs")}),h.jsx("span",{className:Be.tableNumCol,children:t("stats.inputTokens")}),h.jsx("span",{className:Be.tableNumCol,children:t("stats.outputTokens")})]}),h.jsx("div",{className:Be.divider}),d.map(y=>h.jsxs("div",{className:Be.tableRow,children:[h.jsx("span",{className:Be.tableNameCol,children:y.label}),h.jsx("span",{className:Be.tableNumCol,children:y.metrics.api.totalRequests}),h.jsx("span",{className:`${Be.tableNumCol} ${Be.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),h.jsx("span",{className:`${Be.tableNumCol} ${Be.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),p>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Be.spacer}),h.jsxs("div",{children:[h.jsx("span",{className:Be.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",p.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),h.jsxs("div",{className:Be.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function Goe({status:e}){const{t}=et(),n=Vj(e.models);if(n.length===0)return h.jsxs("div",{className:Be.panel,children:[h.jsx("div",{className:Be.title,children:t("stats.modelStats")}),h.jsx("div",{children:t("stats.noApiCalls")})]});const r=n.some(o=>o.metrics.tokens.cached>0),s=n.some(o=>o.metrics.tokens.thoughts>0),i=o=>n.map(a=>o(a.metrics));return h.jsxs("div",{className:Be.panel,children:[h.jsx("div",{className:Be.title,children:t("stats.modelStats")}),h.jsx("div",{className:Be.spacer}),h.jsxs("div",{className:Be.pivotRow,children:[h.jsx("span",{className:Be.metricCellSection,children:t("stats.metric")}),n.map(o=>h.jsx("span",{className:Be.modelCellHeader,children:o.label},o.key))]}),h.jsx("div",{className:Be.divider}),h.jsx(Co,{metric:t("stats.api"),values:[],variant:"section"}),h.jsx(Co,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),h.jsx(Co,{metric:t("stats.errors"),values:i(o=>{const a=Uoe(o);return h.jsxs("span",{className:o.api.totalErrors>0?Be.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),h.jsx(Co,{metric:t("stats.avgLatency"),values:i(o=>Ql(Hoe(o)))}),h.jsx("div",{className:Be.spacer}),h.jsx(Co,{metric:t("stats.tokens"),values:[],variant:"section"}),h.jsx(Co,{metric:t("stats.total"),values:i(o=>h.jsx("span",{className:Be.warning,children:o.tokens.total.toLocaleString()}))}),h.jsx(Co,{metric:t("stats.prompt"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),r&&h.jsx(Co,{metric:t("stats.cached"),values:i(o=>h.jsxs("span",{className:Be.success,children:[o.tokens.cached.toLocaleString()," (",Voe(o).toFixed(1),"%)"]})),variant:"sub"}),s&&h.jsx(Co,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"}),h.jsx(Co,{metric:t("stats.output"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"})]})}function Koe(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 Yoe({status:e}){const{t}=et(),n=Koe(e.tools.byName);if(n.length===0)return h.jsxs("div",{className:Be.panel,children:[h.jsx("div",{className:Be.title,children:t("stats.toolStats")}),h.jsx("div",{children:t("stats.noToolCalls")})]});const r=Object.values(e.tools.byName).reduce((o,a)=>{var l,c,u;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+=((u=a.decisions)==null?void 0:u.modify)??0,o},{accept:0,reject:0,modify:0}),s=r.accept+r.reject+r.modify,i=s>0?r.accept/s*100:0;return h.jsxs("div",{className:Be.panel,children:[h.jsx("div",{className:Be.title,children:t("stats.toolStats")}),h.jsx("div",{className:Be.spacer}),h.jsxs("div",{className:Be.tableRow,children:[h.jsx("span",{className:Be.tableToolCol,children:t("stats.toolName")}),h.jsx("span",{className:Be.tableNumCol,children:t("stats.calls")}),h.jsx("span",{className:Be.tableNumCol,children:t("stats.successRate")}),h.jsx("span",{className:Be.tableNumCol,children:t("stats.avgDuration")})]}),h.jsx("div",{className:Be.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 h.jsxs("div",{className:Be.tableRow,children:[h.jsx("span",{className:`${Be.tableToolCol} ${Be.metricCell}`,children:tl(o.name,t)}),h.jsx("span",{className:Be.tableNumCol,children:o.stats.count}),h.jsxs("span",{className:`${Be.tableNumCol} ${a>=90?Be.success:a>=70?Be.warning:Be.error}`,children:[a.toFixed(1),"%"]}),h.jsx("span",{className:Be.tableNumCol,children:Ql(l)})]},o.name)}),h.jsx("div",{className:Be.spacer}),h.jsx("div",{className:Be.sectionTitle,children:t("stats.decisionSummary")}),h.jsx(Zc,{label:t("stats.totalReviewed"),children:s}),h.jsx(r0,{label:t("stats.accepted"),children:h.jsx("span",{className:Be.success,children:r.accept})}),h.jsx(r0,{label:t("stats.rejected"),children:h.jsx("span",{className:Be.error,children:r.reject})}),h.jsx(r0,{label:t("stats.modified"),children:h.jsx("span",{className:Be.warning,children:r.modify})}),h.jsx("div",{className:Be.divider}),h.jsx(Zc,{label:t("stats.agreementRate"),children:h.jsx("span",{className:s>0?i>=90?Be.success:i>=70?Be.warning:Be.error:void 0,children:s>0?`${i.toFixed(1)}%`:"--"})})]})}function Xoe({view:e,status:t}){switch(e){case"model":return h.jsx(Goe,{status:t});case"tools":return h.jsx(Yoe,{status:t});default:return h.jsx(Woe,{status:t})}}function Ky(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 Qoe="_panel_13hcg_1",Joe="_title_13hcg_17",Zoe="_row_13hcg_23",eae="_rowGap_13hcg_31",tae="_label_13hcg_35",nae="_value_13hcg_41",rae="_accent_13hcg_46",iu={panel:Qoe,title:Joe,row:Zoe,rowGap:eae,label:tae,value:nae,accent:rae},{serialize:sae,parse:iae}=Ky("web-shell:status:v1:");function oo({label:e,children:t,gap:n}){return h.jsxs("div",{className:`${iu.row}${n?` ${iu.rowGap}`:""}`,children:[h.jsx("span",{className:iu.label,children:e}),h.jsx("span",{className:iu.value,children:t})]})}function oae({info:e}){const{t}=et();return h.jsxs("div",{className:iu.panel,children:[h.jsx("div",{className:iu.title,children:t("about.title")}),e.cliVersion&&h.jsx(oo,{label:t("about.qwenCode"),children:h.jsx("span",{className:iu.accent,children:e.cliVersion})}),e.runtime&&h.jsx(oo,{label:t("about.runtime"),children:e.runtime}),e.platform&&h.jsx(oo,{label:t("about.platform"),children:e.platform}),e.auth&&h.jsx(oo,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&h.jsx(oo,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&h.jsx(oo,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&h.jsx(oo,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&h.jsx(oo,{label:t("about.sessionId"),children:e.sessionId}),h.jsx(oo,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),h.jsx(oo,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&h.jsx(oo,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function M1(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function aae(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function Wj(e,t,n=50){const r=g.useRef(e);g.useEffect(()=>{r.current=e},[e]),g.useEffect(()=>{const s=o=>{o.defaultPrevented||M1(o.target)&&!aae(o.target)||r.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",s)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",s)}},t)}const lae="_panel_1jx2a_1",cae="_title_1jx2a_13",uae="_header_1jx2a_18",dae="_startup_1jx2a_24",hae="_note_1jx2a_28",fae="_secondary_1jx2a_29",mae="_row_1jx2a_39",pae="_selected_1jx2a_48",gae="_disabled_1jx2a_52",yae="_pointer_1jx2a_56",bae="_nameCell_1jx2a_62",xae="_truncate_1jx2a_69",wae="_separator_1jx2a_75",vae="_sectionTitle_1jx2a_79",_ae="_groupTitle_1jx2a_80",kae="_success_1jx2a_84",Sae="_warning_1jx2a_88",Tae="_error_1jx2a_92",Cae="_group_1jx2a_80",Aae="_list_1jx2a_102",Eae="_description_1jx2a_108",Mae="_schema_1jx2a_113",Nae="_shortcuts_1jx2a_131",Iae="_detail_1jx2a_137",Rae="_serverFields_1jx2a_143",jae="_serverField_1jx2a_143",Lae="_serverFieldLabel_1jx2a_156",Dae="_detailBlock_1jx2a_160",Oae="_parameters_1jx2a_161",Bae="_invalidBlock_1jx2a_162",$ae="_parameterRow_1jx2a_172",zae="_actionMessage_1jx2a_177",Pae="_oauthPage_1jx2a_183",qae="_scrollHint_1jx2a_189",Xe={panel:lae,title:cae,header:uae,startup:dae,note:hae,secondary:fae,row:mae,selected:pae,disabled:gae,pointer:yae,nameCell:bae,truncate:xae,separator:wae,sectionTitle:vae,groupTitle:_ae,success:kae,warning:Sae,error:Tae,group:Cae,list:Aae,description:Eae,schema:Mae,shortcuts:Nae,detail:Iae,serverFields:Rae,serverField:jae,serverFieldLabel:Lae,detailBlock:Dae,parameters:Oae,invalidBlock:Bae,parameterRow:$ae,actionMessage:zae,oauthPage:Pae,scrollHint:qae},cv="web-shell:mcp-panel-active",zc=10,{parse:Fae}=Ky("web-shell:mcp-status:v1:");function Uae(e){const t=Fae(e);return!t||!t.status?null:t}function yp(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:Xe.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:Xe.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:Xe.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:Xe.error}}}function Gj(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 Hae(e){const t=Gj(e);return t?JSON.stringify(t,null,2):""}function Vae(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function Wae(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function Gae(e,t){var r;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 s=((r=n.args)==null?void 0:r.join(" "))??"";return`${n.command} ${s} (stdio)`.trim()}return e.transport?`(${e.transport})`:t("mcp.status.unknown")}function y4(e,t){const n=e.annotations??{},r=[];return n.destructiveHint&&r.push(t("mcp.annotation.destructive")),n.readOnlyHint&&r.push(t("mcp.annotation.readOnly")),n.openWorldHint&&r.push(t("mcp.annotation.openWorld")),n.idempotentHint&&r.push(t("mcp.annotation.idempotent")),r.join(", ")}function f9(e,t){window.dispatchEvent(new CustomEvent(cv,{detail:{id:e,active:t}}))}function m9(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 s=n.details;if(typeof s=="string"&&s)return s}const r=t.error;if(typeof r=="string"&&r)return r}if(e instanceof Error&&e.message)return e.message}return String(e)}function bp(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function Kae(e,t){return e?t("mcp.required"):""}function Yae(e,t){const n=Gj(e),r=n==null?void 0:n.properties,s=Array.isArray(n==null?void 0:n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!r||typeof r!="object"){const o=Hae(e);return o?h.jsx("pre",{className:Xe.schema,children:o}):null}const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:Xe.parameters,children:[h.jsx("div",{className:Xe.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:Xe.parameterRow,children:`• ${o}${Kae(s.has(o),t)}: ${c}${u?` - ${u}`:""}`},o)})]})}function Xae({message:e}){var j;const{t}=et(),n=SN({autoLoad:!1}),[r,s]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(null),[c,u]=g.useState(!1),d=g.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[f,m]=g.useState(!0),[p,y]=g.useState("servers"),[v,b]=g.useState(0),[x,w]=g.useState(0),[k,T]=g.useState(0),C=g.useMemo(()=>r.servers??[],[r.servers]),A=C[v]??null,L=g.useMemo(()=>{var B;return A?((B=i[A.name])==null?void 0:B.tools)??[]:[]},[A,i]),$=L[k]??null,E=g.useMemo(()=>L.length<=zc||k<zc-1?0:Math.min(k-zc+1,L.length-zc),[k,L.length]),z=g.useMemo(()=>L.slice(E,E+zc),[L,E]),M=C.filter(B=>!B.disabled&&B.mcpStatus==="connecting").length,U=g.useMemo(()=>{const B=[];for(const I of C){const ne=Vae(I,t),de=B.find(ce=>ce.label===ne);de?de.servers.push(I):B.push({label:ne,servers:[I]})}return B},[C,t]),K=g.useMemo(()=>C.length===0?20:Math.min(Math.max(...C.map(B=>B.name.length))+2,35),[C]),J=g.useMemo(()=>L.length===0?30:Math.min(Math.max(...L.map(B=>B.name.length))+2,50),[L]),P=g.useMemo(()=>{if(!A)return[];const B=[];return!A.disabled&&L.length>0&&B.push({id:"view-tools",label:t("mcp.action.tools")}),!A.disabled&&A.mcpStatus==="disconnected"&&B.push({id:"reconnect",label:t("mcp.action.reconnect")}),B.push({id:A.disabled?"enable":"disable",label:A.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),A.disabled||(B.push({id:"authenticate",label:A.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),A.hasOAuthTokens&&B.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),B},[A,L.length,t]),V=g.useCallback(async()=>{var I;const B=await n.reload();if(B){s(B);const ne=((I=B.servers)==null?void 0:I.find(de=>de.name===(A==null?void 0:A.name)))??null;if(ne){const de=await n.loadTools(ne.name);o(ce=>({...ce,[ne.name]:de}))}}},[n,A==null?void 0:A.name]),X=g.useCallback(async B=>{if(!(!A||B.disabled||c)){if(B.id==="view-tools"){y("tools"),T(0),l(null);return}u(!0),B.id==="authenticate"&&y("oauth"),l(B.id==="authenticate"?bp(A.name,t):t("mcp.action.running",{action:B.label}));try{let I=null;if(B.id==="reconnect")await n.restartServer(A.name);else{const ne=await n.manageServer(A.name,B.id),de=[...ne.messages??[],...ne.authUrl?[ne.authUrl]:[]].join(`
`);de&&(I=B.id==="authenticate"?bp(A.name,t,de):de)}await V(),l(I??t("mcp.action.done",{action:B.label}))}catch(I){l(B.id==="authenticate"?bp(A.name,t,m9(I)):t("mcp.action.failed",{error:m9(I)}))}finally{u(!1)}}},[c,n,V,A,t]);if(g.useEffect(()=>{const B=d.current;return f9(B,f),()=>f9(B,!1)},[f]),g.useEffect(()=>{const B=I=>{const ne=I.detail;ne!=null&&ne.active&&ne.id&&ne.id!==d.current&&m(!1)};return window.addEventListener(cv,B),()=>window.removeEventListener(cv,B)},[]),Wj(B=>{if(f){if(B.key==="Escape"){B.preventDefault(),B.stopPropagation(),p==="servers"?m(!1):p==="server"?(y("servers"),w(0),l(null)):p==="oauth"?(y("server"),l(null)):p==="tools"?(y("server"),T(0)):y("tools");return}if(B.key==="ArrowUp"||B.key==="ArrowDown"){B.preventDefault(),B.stopPropagation();const I=B.key==="ArrowUp"?-1:1;p==="servers"?(b(ne=>Math.min(Math.max(ne+I,0),C.length-1)),w(0)):p==="server"?w(ne=>Math.min(Math.max(ne+I,0),P.length-1)):p==="tools"&&T(ne=>Math.min(Math.max(ne+I,0),L.length-1));return}if(B.key==="Enter")if(B.preventDefault(),B.stopPropagation(),p==="servers"&&C.length>0)y("server"),w(0);else if(p==="server"&&P.length>0){const I=P[x];I&&X(I)}else p==="tools"&&L.length>0&&y("tool")}},[f,x,L.length,P,X,C.length,p]),!f)return null;if(C.length===0)return h.jsxs("div",{className:Xe.panel,"data-keyboard-scope":!0,children:[h.jsxs("div",{className:Xe.header,children:[h.jsx("div",{className:Xe.title,children:t("mcp.manageServers")}),h.jsx("div",{className:Xe.secondary,children:t("mcp.servers",{count:0})})]}),h.jsx("div",{className:Xe.secondary,children:t("mcp.empty")}),h.jsx("div",{className:Xe.shortcuts,children:t("mcp.shortcut.close")})]});const te=p==="servers"?t("mcp.manageServers"):p==="server"?(A==null?void 0:A.name)??t("mcp.manageServers"):p==="oauth"?t("mcp.oauth.title"):p==="tools"?t("mcp.toolsForServer",{name:(A==null?void 0:A.name)??"Server"}):($==null?void 0:$.name)??t("mcp.toolDetail"),D=p==="servers"?t("mcp.servers",{count:C.length}):p==="server"||p==="oauth"?"":p==="tools"?t(L.length===1?"mcp.toolCount":"mcp.toolsCount",{count:L.length}):($==null?void 0:$.serverToolName)??(A==null?void 0:A.name)??"";return h.jsxs("div",{className:Xe.panel,"data-keyboard-scope":!0,children:[M>0&&h.jsxs("div",{children:[h.jsx("div",{className:Xe.startup,children:t("mcp.starting",{count:M})}),h.jsx("div",{className:Xe.note,children:t("mcp.startingNote")})]}),h.jsxs("div",{className:Xe.header,children:[h.jsx("div",{className:Xe.title,children:te}),D&&h.jsx("div",{className:Xe.secondary,children:D})]}),p==="servers"&&h.jsx("div",{className:Xe.list,children:U.map(B=>{let I=0;for(const ne of U){if(ne===B)break;I+=ne.servers.length}return h.jsxs("div",{className:Xe.group,children:[h.jsx("div",{className:Xe.groupTitle,children:B.label}),B.servers.map((ne,de)=>{const ce=I+de,Ne=ce===v,Ce=yp(ne,t);return h.jsxs("div",{className:Ne?`${Xe.row} ${Xe.selected}`:Xe.row,onClick:()=>{b(ce),y("server"),w(0)},onMouseEnter:()=>b(ce),children:[h.jsx("span",{className:Xe.pointer,children:Ne?"❯":""}),h.jsx("span",{className:Xe.nameCell,style:{width:`${K}ch`},children:ne.name}),h.jsx("span",{className:Xe.separator,children:"·"}),h.jsxs("span",{className:Ce.className,children:[Ce.icon," ",Ce.text]})]},ne.name)})]},B.label)})}),p==="server"&&A&&h.jsxs("div",{className:Xe.detail,children:[h.jsxs("div",{className:Xe.serverFields,children:[h.jsxs("div",{className:Xe.serverField,children:[h.jsxs("span",{className:Xe.serverFieldLabel,children:[t("mcp.status"),":"]}),h.jsxs("span",{className:yp(A,t).className,children:[yp(A,t).icon," ",yp(A,t).text]})]}),h.jsxs("div",{className:Xe.serverField,children:[h.jsxs("span",{className:Xe.serverFieldLabel,children:[t("mcp.source"),":"]}),h.jsx("span",{children:Wae(A,t)})]}),h.jsxs("div",{className:Xe.serverField,children:[h.jsxs("span",{className:Xe.serverFieldLabel,children:[t("mcp.command"),":"]}),h.jsx("span",{className:Xe.truncate,children:Gae(A,t)})]}),((j=A.config)==null?void 0:j.cwd)&&h.jsxs("div",{className:Xe.serverField,children:[h.jsxs("span",{className:Xe.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),h.jsx("span",{className:Xe.truncate,children:A.config.cwd})]}),!A.disabled&&h.jsxs("div",{className:Xe.serverField,children:[h.jsxs("span",{className:Xe.serverFieldLabel,children:[t("mcp.tools"),":"]}),h.jsx("span",{children:t(L.length===1?"mcp.toolCount":"mcp.toolsCount",{count:L.length})})]})]}),h.jsx("div",{className:Xe.list,children:P.map((B,I)=>{const ne=I===x,de=[Xe.row,ne?Xe.selected:"",B.disabled?Xe.disabled:""].filter(Boolean).join(" ");return h.jsxs("div",{className:de,onClick:()=>{w(I),X(B)},children:[h.jsx("span",{className:Xe.pointer,children:ne?"❯":""}),h.jsx("span",{children:B.label})]},B.id)})}),a&&h.jsx("pre",{className:Xe.actionMessage,children:a})]}),p==="oauth"&&h.jsx("div",{className:Xe.oauthPage,children:h.jsx("pre",{className:Xe.actionMessage,children:a??(A?bp(A.name,t):t("mcp.status.unknown"))})}),p==="tools"&&h.jsx("div",{className:Xe.list,children:L.length===0?h.jsx("div",{className:Xe.secondary,children:t("mcp.emptyTools")}):z.map((B,I)=>{const ne=E+I,de=ne===k,ce=y4(B,t);return h.jsxs("div",{className:de?`${Xe.row} ${Xe.selected}`:Xe.row,onClick:()=>{T(ne),y("tool")},onMouseEnter:()=>T(ne),children:[h.jsx("span",{className:Xe.pointer,children:de?"❯":""}),h.jsx("span",{className:Xe.nameCell,style:{width:`${J}ch`},children:B.name}),B.isValid?ce?h.jsx("span",{className:Xe.secondary,children:ce}):null:h.jsx("span",{className:Xe.warning,children:t("mcp.invalidReason",{reason:B.invalidReason||t("mcp.status.unknown")})})]},B.name)})}),p==="tools"&&L.length>zc&&h.jsxs("div",{className:Xe.scrollHint,children:[E>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:L.length}),E+zc<L.length?" ↓":""]}),p==="tool"&&$&&h.jsxs("div",{className:Xe.detail,children:[!$.isValid&&h.jsxs("div",{className:Xe.invalidBlock,children:[h.jsx("div",{className:Xe.sectionTitle,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",$.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:Xe.secondary,children:t("mcp.invalidToolHelp")})]}),$.description&&h.jsxs("div",{className:Xe.detailBlock,children:[h.jsx("div",{className:Xe.sectionTitle,children:t("mcp.description")}),h.jsx("div",{className:Xe.description,children:$.description.trim()})]}),y4($,t)&&h.jsxs("div",{className:Xe.detailBlock,children:[h.jsx("span",{className:Xe.sectionTitle,children:t("mcp.annotations")})," ",h.jsx("span",{children:y4($,t)})]}),Yae($,t)]}),h.jsx("div",{className:Xe.shortcuts,children:t(p==="servers"?"mcp.shortcut.selectClose":p==="server"||p==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}function uv(e){const t=Math.max(0,Math.floor(e/1e3)),n=t%60,r=Math.floor(t/60);if(r===0)return`${n}s`;const s=r%60,i=Math.floor(r/60);return i===0?`${s}m ${n}s`:`${i}h ${s}m`}const Qae="_panel_1n5sf_1",Jae="_embeddedPanel_1n5sf_12",Zae="_title_1n5sf_19",ele="_sectionTitle_1n5sf_24",tle="_overflowHint_1n5sf_28",nle="_header_1n5sf_33",rle="_secondary_1n5sf_39",sle="_row_1n5sf_43",ile="_selected_1n5sf_51",ole="_pointer_1n5sf_55",ale="_nameCell_1n5sf_61",lle="_status_1n5sf_70",cle="_chevronCell_1n5sf_76",ule="_chevron_1n5sf_76",dle="_chevronExpanded_1n5sf_93",hle="_separator_1n5sf_103",fle="_list_1n5sf_107",mle="_task_1n5sf_113",ple="_taskExpanded_1n5sf_119",gle="_success_1n5sf_124",yle="_warning_1n5sf_128",ble="_error_1n5sf_132",xle="_detail_1n5sf_136",wle="_detailTop_1n5sf_145",vle="_detailTopMain_1n5sf_152",_le="_inlineDetail_1n5sf_192",kle="_taskIcon_1n5sf_208",Sle="_detailField_1n5sf_237",Tle="_detailFieldLabel_1n5sf_244",Cle="_detailContent_1n5sf_250",Ale="_compactSummary_1n5sf_257",Ele="_actionBar_1n5sf_266",Mle="_actionHint_1n5sf_275",Nle="_actionButton_1n5sf_280",Ile="_dangerButton_1n5sf_300",Rle="_shortcuts_1n5sf_304",jle="_confirmHint_1n5sf_310",Lle="_statusBadge_1n5sf_314",Dle="_activityCurrent_1n5sf_320",Ole="_activityPast_1n5sf_327",Ble="_promptContent_1n5sf_334",qe={panel:Qae,embeddedPanel:Jae,title:Zae,sectionTitle:ele,overflowHint:tle,header:nle,secondary:rle,row:sle,selected:ile,pointer:ole,nameCell:ale,status:lle,chevronCell:cle,chevron:ule,chevronExpanded:dle,separator:hle,list:fle,task:mle,taskExpanded:ple,success:gle,warning:yle,error:ble,detail:xle,detailTop:wle,detailTopMain:vle,inlineDetail:_le,taskIcon:kle,detailField:Sle,detailFieldLabel:Tle,detailContent:Cle,compactSummary:Ale,actionBar:Ele,actionHint:Mle,actionButton:Nle,dangerButton:Ile,shortcuts:Rle,confirmHint:jle,statusBadge:Lle,activityCurrent:Dle,activityPast:Ole,promptContent:Ble},D0="web-shell:tasks-panel-active",$le=3e3,p9=8,{parse:zle}=Ky("web-shell:tasks-status:v1:");function Ple(e){const t=zle(e);return!t||!t.snapshot?null:t}function g9(e,t){window.dispatchEvent(new CustomEvent(D0,{detail:{id:e,active:t}}))}function y9(e){return e.status==="running"||e.status==="paused"}function b4(e){return[...e].sort((t,n)=>{const r=y9(t),s=y9(n);return r!==s?r?-1:1:r?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function b9(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Kj(e){switch(e){case"running":return qe.success;case"paused":return qe.warning;case"completed":return qe.success;case"failed":return qe.error;case"cancelled":return qe.warning;default:return""}}function qle(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 Fle(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function Ule({expanded:e}){return h.jsx("svg",{className:`${qe.chevron} ${e?qe.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hle(e){switch(e.kind){case"agent":return e.isBackgrounded?e.label:`[blocking] ${e.label}`;case"shell":return`[shell] ${e.command}`;case"monitor":return`[monitor] ${e.description}`}}function Vle(e,t){if(e.length<=p9)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,p9-2),r=Math.max(0,Math.min(t-Math.floor(n/2),e.length-n)),s=Math.min(e.length,r+n);return{visible:e.slice(r,s),windowStart:r,hiddenAbove:r,hiddenBelow:e.length-s}}function Wle(e,t,n){const r=tl(e,n),s=t?t.replace(/\s*\n\s*/g," ").trim():"";return s?`${r}(${s})`:r}function Yj({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:r}){const{t:s}=et(),i=ky(),[o,a]=g.useState(()=>b4(e.snapshot.tasks)),[l,c]=g.useState(!0),[u,d]=g.useState("list"),[f,m]=g.useState(0),[p,y]=g.useState(null),[v,b]=g.useState(!1),[x,w]=g.useState(!1),[k,T]=g.useState(null),C=g.useRef(`tasks-${Math.random().toString(36).slice(2)}`),A=g.useRef(!1),L=g.useRef(null),$=o.length===0?0:Math.min(f,o.length-1),E=o[$]??null;g.useEffect(()=>{if(!l)return;const B=setInterval(()=>{A.current||(A.current=!0,i.getTasks().then(I=>{a(b4(I.tasks)),w(!1)}).catch(I=>{console.warn("[web-shell] failed to refresh tasks:",I),w(!0)}).finally(()=>{A.current=!1}))},$le);return()=>clearInterval(B)},[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||u!=="detail"){L.current=null;return}if(!E){L.current=null,d("list");return}const j=L.current;if(!j||j.taskId!==E.id){L.current={taskId:E.id,status:E.status};return}j.status==="running"&&E.status!=="running"&&(y(null),d("list"))},[l,u,E]),g.useEffect(()=>{if(!n)return;const j=C.current;return g9(j,l),()=>g9(j,!1)},[l,n]),g.useEffect(()=>{if(!n)return;const j=B=>{const I=B.detail;I!=null&&I.active&&I.id&&I.id!==C.current&&c(!1)};return window.addEventListener(D0,j),()=>window.removeEventListener(D0,j)},[n]),g.useEffect(()=>{l||r==null||r()},[l,r]);const z=g.useCallback(async j=>{if(v)return;const B=j.status==="running",I=j.kind==="agent"&&j.status==="paused";if(!B&&!I)return;if(j.kind==="agent"&&!j.isBackgrounded&&p!==j.id){y(j.id);return}y(null),b(!0);try{if(!(await i.cancelTask(j.id,j.kind)).cancelled){T(s("tasks.alreadyStopped"));return}const ce=await i.getTasks();a(b4(ce.tasks)),T(null)}catch(de){console.warn("[web-shell] failed to cancel task:",de),T(s("tasks.cancelFailed"))}finally{b(!1)}},[i,v,p,s]);if(Wj(j=>{if(l){if(j.key==="Escape"){if(j.preventDefault(),j.stopPropagation(),p){y(null);return}u==="detail"?d("list"):c(!1);return}if(j.key==="ArrowLeft"){j.preventDefault(),j.stopPropagation(),u==="detail"?(y(null),d("list")):c(!1);return}if((j.key==="ArrowUp"||j.key==="ArrowDown")&&u==="list"){if(j.preventDefault(),j.stopPropagation(),o.length===0)return;const B=j.key==="ArrowUp"?-1:1;m(I=>Math.min(Math.max(I+B,0),o.length-1)),y(null);return}if(j.key==="Enter"){j.preventDefault(),j.stopPropagation(),u==="list"&&E?d("detail"):u==="detail"&&c(!1);return}if(j.key===" "&&u==="detail"){j.preventDefault(),j.stopPropagation(),c(!1);return}if(j.key==="x"&&!j.ctrlKey&&!j.metaKey){j.preventDefault(),j.stopPropagation(),E&&z(E);return}}},[l,u,o.length,E,z,p]),!l)return null;const M=p!==null&&E!==null&&p===E.id,U=[];M?(U.push(s("tasks.confirmStop")),U.push(s("tasks.shortcut.cancelConfirm"))):(U.push(s("tasks.shortcut.select")),U.push(s("tasks.shortcut.view")),(E==null?void 0:E.status)==="running"?U.push(s("tasks.shortcut.stop")):(E==null?void 0:E.kind)==="agent"&&(E==null?void 0:E.status)==="paused"&&U.push(s("tasks.shortcut.abandon")),U.push(s("tasks.shortcut.listClose")));const K=[];if(M?(K.push(s("tasks.confirmStop")),K.push(s("tasks.shortcut.cancelConfirm"))):(K.push(s("tasks.shortcut.detailBack")),K.push(s("tasks.shortcut.detailClose")),(E==null?void 0:E.status)==="running"?K.push(s("tasks.shortcut.stop")):(E==null?void 0:E.kind)==="agent"&&(E==null?void 0:E.status)==="paused"&&K.push(s("tasks.shortcut.abandon"))),o.length===0)return h.jsxs("div",{className:t?`${qe.panel} ${qe.embeddedPanel}`:qe.panel,"data-keyboard-scope":!0,children:[(x||k||!t)&&h.jsxs("div",{className:qe.header,children:[!t&&h.jsx("div",{className:qe.title,children:s("tasks.title")}),x&&h.jsx("div",{className:qe.warning,children:s("tasks.refreshStale")}),k&&h.jsx("div",{className:qe.error,children:k})]}),h.jsx("div",{children:h.jsx("div",{className:qe.secondary,children:s("tasks.empty")})}),!t&&h.jsx("div",{className:qe.shortcuts,children:s("tasks.shortcut.close")})]});const{visible:J,windowStart:P,hiddenAbove:V,hiddenBelow:X}=Vle(o,$),te=t?o:J,D=t?0:P;return h.jsxs("div",{className:t?`${qe.panel} ${qe.embeddedPanel}`:qe.panel,"data-keyboard-scope":!0,children:[(t||u==="list")&&(x||k||!t)&&h.jsxs("div",{className:qe.header,children:[!t&&h.jsx("div",{className:qe.title,children:s("tasks.title")}),x&&h.jsx("div",{className:qe.warning,children:s("tasks.refreshStale")}),k&&h.jsx("div",{className:qe.error,children:k})]}),(t||u==="list")&&h.jsxs("div",{className:qe.list,children:[!t&&h.jsxs("div",{className:qe.sectionTitle,children:[s("tasks.title")," ",h.jsxs("span",{className:qe.secondary,children:["(",o.length,")"]})]}),!t&&V>0&&h.jsx("div",{className:qe.overflowHint,children:s("tasks.moreAbove",{count:V})}),te.map((j,B)=>{const I=D+B,ne=I===$,de=Kj(j.status),ce=qle(j.status,s),Ne=t&&ne&&u==="detail",Ce=t?Ne:ne;return h.jsxs("div",{className:`${qe.task} ${Ne?qe.taskExpanded:""}`,children:[h.jsxs("div",{className:Ce?`${qe.row} ${qe.selected}`:qe.row,onClick:()=>{m(I),d(t&&Ne?"list":"detail")},onMouseEnter:()=>{t||m(I)},children:[h.jsx("span",{className:qe.pointer,children:Ce?"❯":""}),t&&h.jsx("span",{className:qe.taskIcon,"aria-hidden":"true"}),h.jsx("span",{className:qe.nameCell,children:Hle(j)}),h.jsx("span",{className:`${qe.status} ${de}`,children:ce}),h.jsx("span",{className:qe.chevronCell,children:h.jsx(Ule,{expanded:Ne})})]}),Ne&&h.jsx("div",{className:qe.inlineDetail,children:h.jsx(x9,{task:j,t:s,hideHeader:!0,busy:v,showCancelConfirm:p===j.id,onCancel:()=>void z(j),onCancelConfirmDismiss:()=>y(null)})})]},j.id)}),!t&&X>0&&h.jsx("div",{className:qe.overflowHint,children:s("tasks.moreBelow",{count:X})})]}),!t&&u==="detail"&&E&&h.jsxs(h.Fragment,{children:[k&&h.jsx("div",{className:qe.error,children:k}),h.jsx(x9,{task:E,t:s,busy:v,showCancelConfirm:p===E.id,onCancel:()=>void z(E),onCancelConfirmDismiss:()=>y(null)})]}),!t&&h.jsx("div",{className:M?`${qe.shortcuts} ${qe.confirmHint}`:qe.shortcuts,children:(u==="list"?U:K).join(" · ")})]})}function Gle(e,t){switch(e.kind){case"agent":return`${e.subagentType??"Agent"} › ${e.label}`;case"shell":return`${t("tasks.kind.shell")} › ${e.command}`;case"monitor":return`${t("tasks.kind.monitor")} › ${e.description}`}}function x9({task:e,t,hideHeader:n=!1,busy:r=!1,showCancelConfirm:s=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,w;const a=Fle(e.status),l=Kj(e.status),c=e.kind==="agent"&&e.status==="paused",u=e.status==="running"||c,d=t(c?"tasks.action.abandon":"tasks.action.stop"),f=t(c?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),m=[uv(e.runtimeMs)],p=[{label:t("tasks.detail.runtime"),value:uv(e.runtimeMs)}];e.kind==="agent"&&((x=e.stats)!=null&&x.totalTokens)&&(m.push(t("tasks.detail.tokens",{count:b9(e.stats.totalTokens)})),p.push({label:t("tasks.detail.tokenCount"),value:b9(e.stats.totalTokens)})),e.kind==="agent"&&((w=e.stats)==null?void 0:w.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 y=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],v=u&&i?h.jsx("div",{className:qe.actionBar,children:s?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:qe.actionHint,children:t("tasks.action.confirmHint")}),h.jsx("button",{type:"button",className:`${qe.actionButton} ${qe.dangerButton}`,disabled:r,onClick:i,children:f}),h.jsx("button",{type:"button",className:qe.actionButton,onClick:o,children:t("common.cancel")})]}):h.jsx("button",{type:"button",className:`${qe.actionButton} ${qe.dangerButton}`,disabled:r,onClick:i,children:d})}):null,b=n?p.length>0?h.jsx("div",{className:qe.compactSummary,children:p.map(k=>`${k.label} ${k.value}`).join(" · ")}):null:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:qe.title,children:Gle(e,t)}),h.jsxs("div",{className:qe.statusBadge,children:[a&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),h.jsx("span",{className:qe.separator,children:"·"})]}),h.jsx("span",{className:qe.secondary,children:m.join(" · ")})]})]});return h.jsxs("div",{className:qe.detail,children:[(b||v)&&h.jsxs("div",{className:qe.detailTop,children:[b&&h.jsx("div",{className:qe.detailTopMain,children:b}),v]}),e.kind==="shell"&&h.jsxs(h.Fragment,{children:[h.jsx(lf,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&h.jsx(lf,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&h.jsx(lf,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&h.jsx(lf,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&h.jsxs("div",{className:qe.detailField,children:[h.jsx("div",{className:qe.detailFieldLabel,children:t("tasks.detail.progress")}),h.jsx("div",{className:qe.detailContent,children:e.recentActivities.slice(-5).map((k,T,C)=>{const A=T===C.length-1,L=Wle(k.name,k.description,t);return h.jsxs("div",{className:A?qe.activityCurrent:qe.activityPast,children:[A?"> ":"  ",L]},`${k.at}-${T}`)})})]}),e.kind==="agent"&&e.prompt&&h.jsxs("div",{className:qe.detailField,children:[h.jsx("div",{className:qe.detailFieldLabel,children:t("tasks.detail.prompt")}),h.jsx("div",{className:qe.promptContent,children:y.slice(0,5).map((k,T,C)=>h.jsx("div",{children:T===C.length-1&&y.length>5?`${k}…`:k||" "},T))})]}),e.kind==="agent"&&e.outputFile&&h.jsx(lf,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&h.jsxs("div",{className:qe.detailField,children:[h.jsx("div",{className:`${qe.detailFieldLabel} ${qe.error}`,children:t("tasks.detail.resumeBlocked")}),h.jsx("div",{className:qe.error,children:e.resumeBlockedReason})]}),e.error&&h.jsxs("div",{className:qe.detailField,children:[h.jsx("div",{className:`${qe.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?qe.warning:qe.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),h.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?qe.warning:qe.error,children:e.error})]})]})}function lf({label:e,value:t}){return h.jsxs("div",{className:qe.detailField,children:[h.jsx("div",{className:qe.detailFieldLabel,children:e}),h.jsx("div",{className:qe.detailContent,children:t})]})}const Kle="_message_fm8gc_1",Yle="_prefix_fm8gc_10",Xle="_body_fm8gc_15",Qle="_title_fm8gc_20",Jle="_muted_fm8gc_24",Zle="_accent_fm8gc_28",ece="_success_fm8gc_32",tce="_error_fm8gc_36",nce="_warning_fm8gc_40",rce="_row_fm8gc_44",sce="_label_fm8gc_50",ice="_value_fm8gc_55",Ss={message:Kle,prefix:Yle,body:Xle,title:Qle,muted:Jle,accent:Zle,success:ece,error:tce,warning:nce,row:rce,label:sce,value:ice},dv="web-shell-goal-status-active",{serialize:w9,parse:oce}=Ky(BF),ace=new Set(["set","achieved","cleared","failed","aborted","checking"]);function N1(e){const t=typeof e=="string"?oce(e):e;return lce(t)}function lce(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,r=t.condition;if(typeof n!="string"||!ace.has(n)||typeof r!="string")return null;const s=x4(t.iterations),i=x4(t.durationMs),o=x4(t.setAt),a=typeof t.lastReason=="string"?t.lastReason:void 0;return{kind:n,condition:r,...s!==void 0?{iterations:s}:{},...i!==void 0?{durationMs:i}:{},...o!==void 0?{setAt:o}:{},...a!==void 0?{lastReason:a}:{}}}function x4(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function cce(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function uce(e,t){switch(e.kind){case"checking":return{prefix:"○",title:`${t("goal.check")}${e.iterations&&e.iterations>0?` · ${t("goal.turnLabel",{count:e.iterations})}`:""} · ${t("goal.notYetMet")}`,colorClass:Ss.muted};case"set":return{prefix:"◎",title:t("goal.set"),colorClass:Ss.accent};case"achieved":return{prefix:"✓",title:t("goal.achieved"),colorClass:Ss.success};case"cleared":return{prefix:"○",title:t("goal.cleared"),colorClass:Ss.muted};case"failed":return{prefix:"✖",title:t("goal.failed"),colorClass:Ss.error};case"aborted":return{prefix:"!",title:t("goal.aborted"),colorClass:Ss.warning}}}function dce({status:e,activateFooter:t=!1}){var l;const{t:n}=et();g.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(dv,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const r=uce(e,n),s=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&s.push(cce(e.iterations,n)),typeof e.durationMs=="number"&&s.push(uv(e.durationMs)));const i=s.length>0?` · ${s.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 h.jsxs("div",{className:Ss.message,children:[h.jsx("span",{className:`${Ss.prefix} ${r.colorClass}`,children:r.prefix}),h.jsxs("div",{className:Ss.body,children:[h.jsxs("div",{className:`${Ss.title} ${r.colorClass}`,children:[r.title,i&&h.jsx("span",{className:Ss.muted,children:i})]}),h.jsxs("div",{className:Ss.row,children:[h.jsxs("span",{className:Ss.label,children:[n("goal.label"),":"]}),h.jsx("span",{className:Ss.value,children:e.condition})]}),o&&h.jsxs("div",{className:Ss.muted,children:[a,": ",o]})]})]})}const hce="_message_yx3fo_1",fce="_flushMessage_yx3fo_12",mce="_noMarker_yx3fo_26",pce="_content_yx3fo_30",gce="_info_yx3fo_49",yce="_recap_yx3fo_54",bce="_modelSwitch_yx3fo_67",xce="_error_yx3fo_71",wce="_warning_yx3fo_77",vce="_retryHint_yx3fo_83",_ce="_retryButton_yx3fo_90",ri={message:hce,flushMessage:fce,noMarker:mce,content:pce,info:gce,recap:yce,modelSwitch:bce,error:xce,warning:wce,retryHint:vce,retryButton:_ce},kce=g.memo(function({content:t,variant:n,source:r,data:s,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:c}=et(),u=n==="info"?roe(t):null;if(u)return h.jsx("div",{className:ri.flushMessage,children:h.jsx(uoe,{status:u,onShowDetail:i})});const d=n==="info"?Foe(t):null;if(d)return h.jsx("div",{className:ri.flushMessage,children:h.jsx(Xoe,{view:d.view,status:d.status})});const f=n==="info"?iae(t):null;if(f)return h.jsx("div",{className:ri.flushMessage,children:h.jsx(oae,{info:f})});const m=n==="info"?Uae(t):null;if(m)return h.jsx("div",{className:ri.flushMessage,children:h.jsx(Xae,{message:m})});const p=n==="info"?Ple(t):null;if(p)return h.jsx("div",{className:ri.flushMessage,children:h.jsx(Yj,{message:p})});const y=n==="info"?N1(r==="goal"?s:t):null;if(y)return h.jsx("div",{className:ri.flushMessage,children:h.jsx(dce,{status:y,activateFooter:o})});const v=n==="info"&&r==="model_switch_summary",b=n==="info"&&r==="recap";return h.jsx("div",{className:`${ri.message} ${ri[n]} ${v?ri.modelSwitch:""} ${b?ri.recap:""}`,children:h.jsxs("div",{className:ri.content,children:[v?h.jsx("pre",{children:t}):n==="info"?h.jsx(gm,{content:t}):h.jsx("pre",{children:t}),a&&l&&h.jsx("div",{className:ri.retryHint,children:h.jsx("button",{type:"button",className:ri.retryButton,onClick:l,children:c("retry.hint")})})]})})}),Sce="_group_j2kum_1",Tce="_line_j2kum_14",Cce="_chatGroupWrap_j2kum_19",Ace="_chatSummary_j2kum_23",Ece="_chatSummaryIcon_j2kum_46",Mce="_chatSummaryToolIcon_j2kum_60",Nce="_chatSummaryText_j2kum_66",Ice="_chatSummaryTextActive_j2kum_76",Rce="_chatChevronRight_j2kum_103",jce="_chatChevronDown_j2kum_104",Lce="_chatSummaryContentClip_j2kum_131",Dce="_chatSummaryContentCollapsed_j2kum_139",Oce="_chatSummaryContentInner_j2kum_143",Bce="_lineMain_j2kum_148",$ce="_icon_j2kum_155",zce="_iconDone_j2kum_160",Pce="_iconError_j2kum_164",qce="_iconPending_j2kum_168",Fce="_iconSpin_j2kum_172",Uce="_lineName_j2kum_184",Hce="_lineArg_j2kum_191",Vce="_lineElapsed_j2kum_201",Wce="_lineExpandable_j2kum_208",Gce="_lineOutput_j2kum_223",Kce="_lineFullArg_j2kum_235",Yce="_lineDetail_j2kum_247",Xce="_expandedBash_j2kum_250",Qce="_expandedRead_j2kum_251",Jce="_expandedOutput_j2kum_255",Zce="_expandedEdit_j2kum_268",eue="_expandBtn_j2kum_282",tue="_todoProgress_j2kum_301",nue="_todoBody_j2kum_308",rue="_compactGroup_j2kum_312",sue="_compactHeader_j2kum_319",iue="_compactCount_j2kum_326",oue="_compactHint_j2kum_332",st={group:Sce,line:Tce,chatGroupWrap:Cce,chatSummary:Ace,chatSummaryIcon:Ece,chatSummaryToolIcon:Mce,chatSummaryText:Nce,chatSummaryTextActive:Ice,chatChevronRight:Rce,chatChevronDown:jce,chatSummaryContentClip:Lce,chatSummaryContentCollapsed:Dce,chatSummaryContentInner:Oce,lineMain:Bce,icon:$ce,iconDone:zce,iconError:Pce,iconPending:qce,iconSpin:Fce,lineName:Uce,lineArg:Hce,lineElapsed:Vce,lineExpandable:Wce,lineOutput:Gce,lineFullArg:Kce,lineDetail:Yce,expandedBash:Xce,expandedRead:Qce,expandedOutput:Jce,expandedEdit:Zce,expandBtn:eue,todoProgress:tue,todoBody:nue,compactGroup:rue,compactHeader:sue,compactCount:iue,compactHint:oue};function Cu({status:e}){switch(e){case"completed":case"success":return h.jsx("span",{className:`${st.icon} ${st.iconDone}`,children:"✓"});case"failed":case"error":case"cancelled":case"canceled":return h.jsx("span",{className:`${st.icon} ${st.iconError}`,children:"✗"});case"in_progress":case"running":return h.jsx("span",{className:`${st.icon} ${st.iconSpin}`,children:"⟳"});default:return h.jsx("span",{className:`${st.icon} ${st.iconPending}`,children:"○"})}}function bm(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 r=Math.floor(n/60),s=n%60;return`${r}m ${s}s`}function Xj(e){if(!e)return"";const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return`${n}m ${r}s`}function Qj(e){const t=Math.max(1,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}const aue="_panel_1k01a_1",lue="_header_1k01a_12",cue="_desc_1k01a_24",uue="_toggle_1k01a_33",due="_meta_1k01a_39",hue="_body_1k01a_45",fue="_content_1k01a_56",mue="_stream_1k01a_71",pue="_streamCollapsed_1k01a_81",gue="_scrollWindow_1k01a_88",yue="_expandToggle_1k01a_93",bue="_tabBar_1k01a_108",xue="_tab_1k01a_108",wue="_tabActive_1k01a_130",vue="_tools_1k01a_135",_ue="_toolTimeRow_1k01a_152",kue="_toolTimeTip_1k01a_156",Xn={panel:aue,header:lue,desc:cue,toggle:uue,meta:due,body:hue,content:fue,stream:mue,streamCollapsed:pue,scrollWindow:gue,expandToggle:yue,tabBar:bue,tab:xue,tabActive:wue,tools:vue,toolTimeRow:_ue,toolTimeTip:kue};function Jj(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function Sue({timestamp:e,children:t}){return e===void 0?h.jsx(h.Fragment,{children:t}):h.jsxs("div",{className:Xn.toolTimeRow,children:[t,h.jsx("span",{className:Xn.toolTimeTip,"aria-hidden":"true",children:eh(e)})]})}const Tue=g.memo(function({tool:t}){const n=t.subTools||t.subContent?h.jsx(T_,{tool:t}):h.jsx(mv,{tool:t});return h.jsx(Sue,{timestamp:t.startTime,children:n})});function Cue({tc:e}){const{t}=et(),n=e.description||"";return h.jsx("div",{className:st.line,children:h.jsxs("div",{className:st.lineMain,children:[h.jsx(Cu,{status:e.status}),h.jsx("span",{className:st.lineName,children:tl(e.name,t)}),n&&h.jsx("span",{className:st.lineArg,children:fs(n,70)})]})})}function Aue(e){var t;if(e.rawOutput&&Jj(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 Eue({text:e}){const{compactThinking:t}=xc(),{t:n}=et(),[r,s]=g.useState(!1),[i,o]=g.useState(!1),a=g.useRef(null),l=t&&!r;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 u=()=>o(c.scrollHeight>c.clientHeight),d=new ResizeObserver(u);return d.observe(c),()=>d.disconnect()},[l]),h.jsxs("div",{children:[h.jsx("pre",{ref:a,className:l?`${Xn.stream} ${Xn.streamCollapsed}`:Xn.stream,children:e}),t&&(i||r)&&h.jsx("button",{className:Xn.expandToggle,onClick:()=>s(c=>!c),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function Mue({content:e}){const{compactThinking:t}=xc();return h.jsx("div",{className:t?Xn.scrollWindow:void 0,children:h.jsx(gm,{content:e,source:"assistant"})})}function v9({pinTail:e,itemCount:t,children:n}){const{compactThinking:r}=xc(),s=g.useRef(null);return g.useEffect(()=>{const i=s.current;!i||!r||(i.scrollTop=e?i.scrollHeight:0)},[r,e,t]),h.jsx("div",{ref:s,className:r?`${Xn.tools} ${Xn.scrollWindow}`:Xn.tools,children:n})}function T_({tool:e,defaultExpanded:t,hideHeader:n,inline:r}){var C,A,L,$;const s=e.status==="completed"||e.status==="failed",i=L0(e),[o,a]=g.useState(t??!1),[l,c]=g.useState("result"),u=Jj(e.rawOutput)?e.rawOutput:null,d=((C=e.subTools)==null?void 0:C.length)||((A=u==null?void 0:u.toolCalls)==null?void 0:A.length)||0,f=S_(e),m=k_(e),p=bm(e.startTime,e.endTime)||Xj((L=u==null?void 0:u.executionSummary)==null?void 0:L.totalDurationMs),y=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:($=u==null?void 0:u.executionSummary)==null?void 0:$.totalTokens,v=y?__(y):"",b=s?Aue(e):"",x=g.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),w=!!(e.subContent||b),k=!!(e.subTools&&e.subTools.length>0||x&&x.length>0),T=w&&k;return h.jsxs("div",{className:r?void 0:Xn.panel,children:[!n&&h.jsxs("div",{className:Xn.header,onClick:()=>a(!o),children:[h.jsx(Cu,{status:i}),h.jsxs("span",{className:st.lineName,children:[m,":"]}),f&&h.jsx("span",{className:Xn.desc,children:fs(f,50)}),s&&d>0&&h.jsxs("span",{className:Xn.meta,children:["· ",d," tools"]}),p&&h.jsxs("span",{className:Xn.meta,children:["· ",p]}),v&&h.jsxs("span",{className:Xn.meta,children:["· ",v]}),!s&&h.jsx("span",{className:Xn.toggle,children:o?"▼":"▶"})]}),(o||n)&&h.jsxs("div",{className:Xn.body,children:[T&&h.jsxs("div",{className:Xn.tabBar,children:[h.jsx("button",{className:`${Xn.tab} ${l==="result"?Xn.tabActive:""}`,onClick:()=>c("result"),children:"Result"}),h.jsxs("button",{className:`${Xn.tab} ${l==="tools"?Xn.tabActive:""}`,onClick:()=>c("tools"),children:["Tools (",d,")"]})]}),(!T||l==="result")&&w&&h.jsx("div",{className:Xn.content,children:s?h.jsx(Mue,{content:e.subContent||b}):e.subContent&&h.jsx(Eue,{text:e.subContent})}),(!T||l==="tools")&&h.jsxs(h.Fragment,{children:[e.subTools&&e.subTools.length>0&&h.jsx(v9,{pinTail:!s,itemCount:e.subTools.length,children:e.subTools.map(E=>h.jsx(Tue,{tool:E},E.callId))}),x&&x.length>0&&h.jsx(v9,{pinTail:!s,itemCount:x.length,children:x.map(E=>h.jsx(Cue,{tc:E},E.callId))})]})]})]})}const Nue="_view_13muf_1",Iue="_stats_13muf_9",Rue="_statAdd_13muf_18",jue="_statDel_13muf_22",Lue="_lines_13muf_26",Due="_line_13muf_26",Oue="_lineAdd_13muf_38",Bue="_lineDel_13muf_42",$ue="_lineHeader_13muf_46",zue="_lineContext_13muf_52",Pue="_lineNo_13muf_56",que="_marker_13muf_66",Fue="_content_13muf_81",Ao={view:Nue,stats:Iue,statAdd:Rue,statDel:jue,lines:Lue,line:Due,lineAdd:Oue,lineDel:Bue,lineHeader:$ue,lineContext:zue,lineNo:Pue,marker:que,content:Fue};function Uue(e){let t=0,n=0;const r=[];let s=0,i=0;for(const o of e.split(`
`))if(o.startsWith("@@")){const a=o.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);a&&(s=parseInt(a[1],10),i=parseInt(a[2],10)),r.push({type:"header",content:o})}else o.startsWith("+")&&!o.startsWith("+++ ")?(t++,r.push({type:"add",content:o.slice(1),newLine:i}),i++):o.startsWith("-")&&!o.startsWith("--- ")?(n++,r.push({type:"del",content:o.slice(1),oldLine:s}),s++):(r.push({type:"context",content:o.startsWith(" ")?o.slice(1):o,oldLine:s,newLine:i}),s++,i++);return{lines:r,additions:t,deletions:n}}const Hue=g.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:r,deletions:s}=Uue(t);return h.jsxs("div",{className:Ao.view,children:[h.jsxs("div",{className:Ao.stats,children:[r>0&&h.jsxs("span",{className:Ao.statAdd,children:["+",r]}),s>0&&h.jsxs("span",{className:Ao.statDel,children:["-",s]})]}),h.jsx("div",{className:Ao.lines,children:n.map((i,o)=>h.jsxs("div",{className:`${Ao.line} ${Ao[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[h.jsx("span",{className:Ao.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),h.jsx("span",{className:Ao.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),h.jsx("span",{className:Ao.content,children:i.content})]},o))})]})}),_9={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 Vue(e){const t=[];let n,r=!1,s=!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:r,dim:s}),i=a.index+a[0].length;const l=a[1].split(";").map(Number);for(const c of l)c===0?(n=void 0,r=!1,s=!1):c===1?r=!0:c===2?s=!0:c===22?(r=!1,s=!1):c>=30&&c<=37||c>=90&&c<=97?n=_9[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:r,dim:s}),t}function Wue(e){return new RegExp(String.raw`\x1b\[`).test(e)}function jh(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function w4(e){const t=e.flatMap((n,r)=>{const s=R1(n),i=xp(s,"content");return i?[{id:xp(s,"id")??`plan-${r}`,content:i,status:sde(xp(s,"status")),priority:ide(xp(s,"priority"))}]:[]});return t.length>0?t:void 0}function C_(e){if(!jh(e.toolName)&&e.kind!=="other")return;const t=S9(e.args);if(t)return w4(t);const n=R1(e.rawOutput),r=S9(n);if(r)return w4(r);const s=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return s?w4(s):void 0}function Gue(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function I1(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const k9={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function Kue(e){let t=[],n=null,r=null,s=!1;for(const o of e){if(o.role==="user"){s=!0;continue}if(o.role==="plan"){t=o.todos,n=o.id,r=null,s=!1;continue}if(o.role==="tool_group")for(const a of o.tools){const l=C_(a);l&&(t=l,n=o.id,r=a.callId,s=!1)}}if(t.length===0)return k9;const i=!Gue(t);return i&&s?k9:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:r}}function A_(e){return JSON.stringify([e.id,e.content])}function Yy(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 r=C_(n);r&&t.push({key:n.callId,todos:r,stats:Jue(n)})}return t}return[]}function Yue(e){const t=new Map,n=new Map;for(const r of e)for(const{key:s,todos:i}of Yy(r)){const o=[];for(const a of i){const l=A_(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(s,{events:o})}return t}function Xue(e){const t=[];for(const n of e)for(const{key:r,todos:s}of Yy(n))t.push(JSON.stringify([r,s.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function Que(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const r of n.tools)!jh(r.toolName)&&(r.startTime!==void 0||r.endTime!==void 0)&&t.push(JSON.stringify(["span",r.callId,r.startTime,r.endTime]));for(const{key:r,todos:s,stats:i}of Yy(n))t.push(JSON.stringify([r,n.timestamp,s.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function Jue(e){var o;const t=R1((o=R1(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},r=n("promptTokens"),s=n("cachedTokens"),i=n("candidateTokens");if(!(r===void 0||s===void 0||i===void 0))return{promptTokens:r,cachedTokens:s,candidateTokens:i,apiTimeMs:n("apiTimeMs")??0}}function Zue(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools){if(jh(r.toolName))continue;const{startTime:s,endTime:i}=r;typeof s=="number"&&typeof i=="number"&&i>=s&&t.push({start:s,end:i})}return t.sort((n,r)=>n.start-r.start),t}function ede(e,t,n){let r=0,s=e.length;for(;r<s;){const o=r+s>>>1;e[o].start<t?r=o+1:s=o}let i=0;for(let o=r;o<e.length&&e[o].start<=n;o++)i+=e[o].end-e[o].start;return i}function tde(e,t){const n=(r,s)=>Math.max(0,s-r);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 nde(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 rde(e){var a;const t=new Map,n=new Map,r=new Map,s=new Set,i=Zue(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:u,stats:d}of Yy(l))for(const f of u){const m=A_(f),p=n.get(m);if(f.status==="in_progress"&&p!=="in_progress")s.has(m)&&(s.delete(m),r.delete(m),t.delete(m)),r.get(m)===void 0&&(r.set(m,d),c!==void 0&&(o(m).startTs=c));else if(f.status==="completed"&&p!=="completed"&&p!==void 0){const y=r.get(m),v=y&&d?tde(y,d):void 0,b=(a=t.get(m))==null?void 0:a.startTs,x=b!==void 0&&c!==void 0?ede(i,b,c):void 0,w=nde(v,x);if(c!==void 0||w){const k=o(m);c!==void 0&&(k.endTs=c),w&&(k.resources=w)}}f.status==="completed"&&s.add(m),n.set(m,f.status)}}return t}function S9(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function sde(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function ide(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function R1(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function xp(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const mg=new Set;let cf=null,Zj=Date.now();function ode(){Zj=Date.now();for(const e of mg)e()}function ade(e){return mg.add(e),cf||(cf=setInterval(ode,1e3)),()=>{mg.delete(e),mg.size===0&&cf&&(clearInterval(cf),cf=null)}}function E_(e){const[t,n]=g.useState(()=>Date.now());return g.useEffect(()=>{if(e)return n(Date.now()),ade(()=>n(Zj))},[e]),t}const lde="_list_1d9ry_1",cde="_summary_1d9ry_2",ude="_row_1d9ry_8",dde="_num_1d9ry_16",hde="_icon_1d9ry_23",fde="_text_1d9ry_29",mde="_inProgress_1d9ry_43",pde="_completed_1d9ry_48",gde="_item_1d9ry_62",yde="_rowButton_1d9ry_69",bde="_detailChevron_1d9ry_82",xde="_detail_1d9ry_82",wde="_detailSection_1d9ry_100",vde="_detailSectionTitle_1d9ry_106",_de="_detailRows_1d9ry_114",kde="_detailLabel_1d9ry_122",Sde="_detailValue_1d9ry_126",Tde="_detailDuration_1d9ry_132",Cde="_detailHint_1d9ry_136",un={list:lde,summary:cde,row:ude,num:dde,icon:hde,text:fde,inProgress:mde,completed:pde,item:gde,rowButton:yde,detailChevron:bde,detail:xde,detailSection:wde,detailSectionTitle:vde,detailRows:_de,detailLabel:kde,detailValue:Sde,detailDuration:Tde,detailHint:Cde};function hv(e){switch(e){case"completed":return un.completed;case"in_progress":return un.inProgress;case"pending":return""}}function eL({todos:e,events:t}){const{t:n}=et();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return h.jsx("div",{className:un.summary,children:h.jsxs("div",{className:`${un.row} ${un.completed}`,children:[h.jsx("span",{className:un.icon,"aria-hidden":"true",children:"✓"}),h.jsx("span",{className:un.text,children:n("todo.allDone")})]})});const s=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return s?h.jsx("div",{className:un.summary,children:h.jsxs("div",{className:`${un.row} ${hv(s.status)}`,children:[h.jsx("span",{className:un.icon,"aria-hidden":"true",children:I1(s.status)}),h.jsx("span",{className:un.text,children:s.content})]})}):null}return h.jsx("div",{className:un.summary,children:t.map(r=>h.jsxs("div",{className:`${un.row} ${r.kind==="completed"?un.completed:un.inProgress}`,children:[h.jsx("span",{className:un.icon,"aria-hidden":"true",children:I1(r.kind==="completed"?"completed":"in_progress")}),h.jsx("span",{className:un.text,children:r.content})]},`${r.kind}-${r.id}`))})}function Pc({label:e,value:t,suffix:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:un.detailLabel,children:e}),h.jsxs("span",{className:un.detailValue,children:[t,n]})]})}function v4({title:e,children:t}){return h.jsxs("div",{className:un.detailSection,children:[h.jsx("div",{className:un.detailSectionTitle,children:e}),h.jsx("div",{className:un.detailRows,children:t})]})}function Ade({detail:e}){const{t}=et(),{startTs:n,endTs:r,resources:s}=e,i=n!==void 0||r!==void 0,o=(s==null?void 0:s.inputTokens)!==void 0,a=(s==null?void 0:s.apiTimeMs)!==void 0||(s==null?void 0:s.toolTimeMs)!==void 0;return h.jsxs("div",{className:un.detail,children:[i&&h.jsxs(v4,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&h.jsx(Pc,{label:t("todo.detail.start"),value:eh(n)}),r!==void 0&&h.jsx(Pc,{label:t("todo.detail.end"),value:eh(r),suffix:n!==void 0?h.jsxs("span",{className:un.detailDuration,children:[" ","(",Ql(r-n),")"]}):void 0})]}),o&&h.jsxs(v4,{title:t("todo.detail.sectionTokens"),children:[h.jsx(Pc,{label:t("todo.detail.input"),value:((s==null?void 0:s.inputTokens)??0).toLocaleString()}),h.jsx(Pc,{label:t("todo.detail.output"),value:((s==null?void 0:s.outputTokens)??0).toLocaleString()}),h.jsx(Pc,{label:t("todo.detail.cached"),value:((s==null?void 0:s.cachedTokens)??0).toLocaleString()})]}),a&&h.jsxs(v4,{title:t("todo.detail.sectionSpent"),children:[(s==null?void 0:s.apiTimeMs)!==void 0&&h.jsx(Pc,{label:t("todo.detail.api"),value:Ql(s.apiTimeMs)}),(s==null?void 0:s.toolTimeMs)!==void 0&&h.jsx(Pc,{label:t("todo.detail.tool"),value:Ql(s.toolTimeMs)})]}),!s&&h.jsx("div",{className:un.detailHint,children:t("todo.detail.noResources")})]})}function Ede(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function tL({todos:e,numbered:t=!1}){const{t:n}=et(),r=g.useContext(WO),[s,i]=g.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=l=>i(c=>{const u=new Set(c);return u.has(l)?u.delete(l):u.add(l),u});return h.jsx("div",{className:un.list,children:e.map((l,c)=>{const u=l.id||String(c),d=r.get(A_(l)),f=Ede(d),m=f&&s.has(u),p=h.jsxs(h.Fragment,{children:[t&&h.jsxs("span",{className:un.num,style:{minWidth:o},children:[c+1,"."]}),h.jsx("span",{className:un.icon,"aria-hidden":"true",children:I1(l.status)}),h.jsx("span",{className:un.text,children:l.content}),f&&h.jsx("span",{className:un.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return h.jsxs("div",{className:un.item,children:[f?h.jsx("button",{type:"button",className:`${un.row} ${un.rowButton} ${hv(l.status)}`,onClick:y=>{y.stopPropagation(),a(u)},"aria-expanded":m,title:n(m?"todo.detail.hide":"todo.detail.show"),children:p}):h.jsx("div",{className:`${un.row} ${hv(l.status)}`,children:p}),m&&d&&h.jsx(Ade,{detail:d})]},u)})})}const nL=5;function Mde(e){const t=e.toolName.toLowerCase();if(Rh(e.toolName))return!!Ko(e);if(t==="write_file"||t==="writefile")return!!Pde(e)||T9(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(lc(t)){const n=Ko(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(t==="edit"||t==="write"||t==="editfile")return T9(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Ko(e);return!!n&&n.split(`
`).length>3}return!1}function Nde(e){const t=e.toolName.toLowerCase();return lc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||Rh(e.toolName)}function Ide(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!rL(e)}function T9(e){return Ide(e)||!!Ko(e)}function Rde(e){if(e.content){const t=e.content.find(n=>n.type==="diff");if(t&&t.type==="diff")return Dde(t.oldText||"",t.newText||"")}return rL(e)}function rL(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(jde(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function jde(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const Lde=25e4;function Dde(e,t){const n=e.split(`
`),r=t.split(`
`),s=n.length,i=r.length;if(s*i>Lde){const u=n.map(f=>f?`-${f}`:"-"),d=r.map(f=>f?`+${f}`:"+");return[...u,...d].join(`
`)}const o=Array.from({length:s+1},()=>Array(i+1).fill(0));for(let u=1;u<=s;u++)for(let d=1;d<=i;d++)o[u][d]=n[u-1]===r[d-1]?o[u-1][d-1]+1:Math.max(o[u-1][d],o[u][d-1]);const a=[];let l=s,c=i;for(;l>0||c>0;)l>0&&c>0&&n[l-1]===r[c-1]?(a.push(` ${n[l-1]}`),l--,c--):c>0&&(l===0||o[l][c-1]>=o[l-1][c])?(a.push(`+${r[c-1]}`),c--):(a.push(`-${n[l-1]}`),l--);return a.reverse().join(`
`)}const _4=150,C9=25,Ode=60;function Bde(e){const t=e.find(s=>s.key==="ui.shellOutputMaxLines"),n=t==null?void 0:t.values.effective;return Math.max(0,Math.floor((typeof n=="number"?n:nL)||0))}function A9(e,t){return e.length<=t?e:e.slice(0,t)+" …"}function $de({tool:e,maxLines:t}){const{t:n}=et(),[r,s]=g.useState(!1),i=g.useMemo(()=>Ko(e)||"",[e]),o=g.useMemo(()=>i.split(`
`),[i]),a=t>0&&o.length>t,l=Math.max(0,o.length-t),c=g.useMemo(()=>o.some(m=>m.length>_4),[o]),u=a||c,d=g.useMemo(()=>r?i:a?[`... first ${l} lines hidden ...`,...o.slice(-t).map(m=>A9(m,_4))].join(`
`):o.map(m=>A9(m,_4)).join(`
`),[l,a,o,t,i,r]),f=g.useMemo(()=>Wue(d)?Vue(d):null,[d]);return h.jsxs("div",{className:st.expandedBash,children:[h.jsx("pre",{className:st.expandedOutput,children:f?f.map((m,p)=>h.jsx("span",{style:{color:m.color,fontWeight:m.bold?"bold":void 0,opacity:m.dim?.6:void 0},children:m.text},p)):d}),u&&h.jsx("button",{className:st.expandBtn,onClick:()=>s(!r),"aria-expanded":r,children:r?n("tool.showLess"):a?n("tool.showAll",{count:o.length}):n("tool.showFullLines")})]})}function zde({tool:e}){const{t}=et(),[n,r]=g.useState(!1),s=g.useMemo(()=>Ko(e)||"",[e]),i=g.useMemo(()=>s.split(`
`),[s]),o=i.length>C9,a=g.useMemo(()=>o&&!n?i.slice(0,C9).join(`
`):s,[s,o,i,n]);return h.jsxs("div",{className:st.expandedRead,children:[h.jsx("pre",{className:st.expandedOutput,children:a}),o&&h.jsx("button",{className:st.expandBtn,onClick:()=>r(!n),"aria-expanded":n,children:n?t("tool.showLess"):t("tool.linesTotal",{count:i.length})})]})}function E9({tool:e}){const t=g.useMemo(()=>Rde(e),[e]),n=g.useMemo(()=>Ko(e)||"",[e]);return!t&&!n?null:h.jsx("div",{className:st.expandedEdit,children:t?h.jsx(Hue,{diff:t}):h.jsx("pre",{className:st.expandedOutput,children:n})})}function Pde(e){var n,r;if((n=e.args)!=null&&n.content)return e.args.content;if((r=e.args)!=null&&r.new_string)return e.args.new_string;const t=Ko(e);if(t)return t;if(e.rawOutput&&typeof e.rawOutput=="object"){const s=e.rawOutput;if(typeof s.content=="string")return s.content;if(typeof s.newContent=="string")return s.newContent}return""}function qde({tool:e,todos:t,expanded:n}){var i;const s=((i=g.useContext(d6).get(e.callId))==null?void 0:i.events)??[];return h.jsx("div",{className:st.todoBody,children:n?h.jsx(tL,{todos:t}):h.jsx(eL,{todos:t,events:s})})}function Fde(e,t){var m,p;const n=ym(e.rawOutput),r=v_(e),s=L0(e),i=k_(e),o=Ude(e),a=S_(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,u=c&&typeof c.totalDurationMs=="number"?Xj(c.totalDurationMs):bm(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),d=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:c&&typeof c.totalTokens=="number"&&c.totalTokens>0?c.totalTokens:0,f=d>0?__(d):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:u,tokens:f,status:s,reason:r}}function Ude(e){var s;const t=ym(e.rawOutput),n=t==null?void 0:t.subagentName;if(typeof n=="string"&&n.trim())return n.trim();const r=(s=e.args)==null?void 0:s.subagent_type;return typeof r=="string"&&r.trim()?r.trim():""}function M9(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Rh(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||lc(t))}function Hde({tool:e}){const t=Ko(e)||"";return h.jsx("pre",{className:st.expandedOutput,children:t})}function M_(e){const t=e.toolName.toLowerCase();return Ty(e)?"agent":lc(t)?"shell":I_(t)?"fetch":jh(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 Vde({description:e,elapsed:t}){return h.jsxs(h.Fragment,{children:[e&&h.jsx("span",{className:st.lineArg,children:e}),t&&h.jsx("span",{className:st.lineElapsed,children:t})]})}function fv({info:e}){const{renderToolHeaderExtra:t}=xc(),n=t==null?void 0:t(e);return n?h.jsx(h.Fragment,{children:n}):h.jsx(Vde,{description:e.description,elapsed:e.elapsed})}function Wde(e){return e.length>Ode||e.includes(`
`)}function sL(e){return e==="in_progress"||e==="pending"||e==="running"}function N_(e){return e.find(t=>sL(t.status))??e[e.length-1]}function Gde(e,t,n){if(iL(e)){const r=N_(e);return t("toolGroup.running",{name:tl(r.toolName,t),count:e.length,duration:n??""})}return t("toolGroup.summary",{count:e.length})}function iL(e){return e.some(t=>sL(t.status))}function Kde(){return h.jsxs("svg",{className:st.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:[h.jsx("path",{d:"M12 20h9"}),h.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function oL(){return h.jsxs("svg",{className:st.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[h.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),h.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),h.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function Yde(){return h.jsxs("svg",{className:st.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[h.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),h.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 Xde(){return h.jsxs("svg",{className:st.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[h.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),h.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function Qde(){return h.jsx("svg",{className:st.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:h.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 Jde(){return h.jsx("svg",{className:st.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:h.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 Zde({tool:e}){const t=M_(e);return t==="agent"?h.jsx(Jde,{}):t==="edit"||t==="write"?h.jsx(Kde,{}):t==="fetch"?h.jsx(Yde,{}):t==="read"?h.jsx(Xde,{}):t==="todo"?h.jsx(Qde,{}):h.jsx(oL,{})}function I_(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const ehe=L0;function the({tools:e,workspaceCwd:t}){const{t:n}=et(),r=N_(e),s=tl(r.toolName,n),i=ehe(r),o=Uj(r,t),a=lc(r.toolName)||I_(r.toolName)?"":bm(r.startTime,r.endTime);return h.jsxs("div",{className:st.compactGroup,children:[h.jsxs("div",{className:st.compactHeader,children:[h.jsx(Cu,{status:i}),h.jsx("span",{className:st.lineName,children:s}),e.length>1&&h.jsxs("span",{className:st.compactCount,children:["× ",e.length]}),h.jsx(fv,{info:{kind:M_(r),tool:r,displayName:s,description:o,elapsed:a,workspaceCwd:t}})]}),h.jsx("div",{className:st.compactHint,children:n("compact.hint")})]})}function nhe(e,t){var s,i;if(((s=e.approval)==null?void 0:s.id)!==((i=t.approval)==null?void 0:i.id)||e.workspaceCwd!==t.workspaceCwd||e.shellOutputMaxLines!==t.shellOutputMaxLines)return!1;const n=e.tool,r=t.tool;return n.callId===r.callId&&n.toolName===r.toolName&&n.status===r.status&&n.startTime===r.startTime&&n.endTime===r.endTime&&n.subContent===r.subContent&&n.rawOutput===r.rawOutput&&n.args===r.args&&n.content===r.content&&n.title===r.title&&rhe(n.subTools,r.subTools)}function rhe(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 r=e[n],s=t[n];if(r.callId!==s.callId||r.toolName!==s.toolName||r.status!==s.status||r.endTime!==s.endTime||r.rawOutput!==s.rawOutput||r.args!==s.args||r.subContent!==s.subContent||r.title!==s.title)return!1}return!0}const mv=g.memo(function({tool:t,approval:n,workspaceCwd:r,shellOutputMaxLines:s=nL}){const{t:i}=et(),o=g.useContext(Dh),[a,l]=g.useState(()=>!o&&M9(t)),c=g.useRef(!1);g.useEffect(()=>{l(o?!1:M9(t)),c.current=!1},[o,t.callId,t.toolName]);const u=Ty(t),d=n&&n.toolCallId===t.callId,f=!d&&(n==null?void 0:n.toolCallId)&&u&&Ka(t,n.toolCallId),m=u&&t.status==="in_progress",p=E_(m);if(g.useEffect(()=>{!u&&t.status==="completed"&&!c.current&&l(!1)},[u,t.status]),u){const M=Fde(t,p),U=M.explicitAgentType?`${i("agent.label")} (${M.explicitAgentType})`:i("agent.label"),K=t.status==="completed"||t.status==="failed",P=[t.status==="pending"?"pending":"running",M.elapsed].filter(Boolean).join(" · "),V=[M.subToolCount>0?`${M.subToolCount} tools`:"",M.elapsed,M.tokens,M.reason?fs(M.reason,80):""].filter(Boolean).join(" · "),X=a||!!d||!!f;return h.jsxs("div",{className:st.line,children:[h.jsxs("div",{className:`${st.lineMain} ${st.lineExpandable}`,onClick:()=>l(!a),children:[h.jsx(Cu,{status:K?M.status:t.status}),h.jsx("span",{className:st.lineName,children:U}),h.jsx(fv,{info:{kind:"agent",tool:t,displayName:U,description:M.description?fs(M.description,60):"",elapsed:K?V:P,workspaceCwd:r}})]}),X&&h.jsx("div",{className:st.lineDetail,children:h.jsx(T_,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0})})]})}const y=Uj(t,r),v=hoe(t),b=tl(t.toolName,i),x=lc(t.toolName)||I_(t.toolName)?"":bm(t.startTime,t.endTime),w=t.toolName.toLowerCase(),k=jh(w),T=k?C_(t):void 0,C=!!T&&T.length>0,A=T?T.filter(M=>M.status==="completed").length:0,L=!k&&Wde(y),$=k?C:Mde(t)||L,E=a&&L,z=Nde(t);return h.jsxs("div",{className:st.line,children:[h.jsxs("div",{className:`${st.lineMain} ${$?st.lineExpandable:""}`,title:$?i(a?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":$?a:void 0,role:$?"button":void 0,tabIndex:$?0:void 0,onClick:$?()=>{c.current=!0,l(M=>!M)}:void 0,onKeyDown:$?M=>{M.key!=="Enter"&&M.key!==" "||(M.preventDefault(),c.current=!0,l(U=>!U))}:void 0,children:[h.jsx(Cu,{status:t.status}),h.jsx("span",{className:st.lineName,children:b}),k&&C&&h.jsxs("span",{className:st.todoProgress,children:[A,"/",T.length]}),h.jsx(fv,{info:{kind:M_(t),tool:t,displayName:b,description:k||E?"":y,elapsed:k?"":x,workspaceCwd:r}})]}),k&&C&&h.jsx(qde,{tool:t,todos:T,expanded:a}),k&&!C&&v&&h.jsx("div",{className:st.lineOutput,children:v}),E&&h.jsx("div",{className:st.lineFullArg,children:y}),!k&&v&&(!a||!z)&&h.jsx("div",{className:st.lineOutput,children:v}),!k&&a&&z&&h.jsxs("div",{className:st.lineDetail,children:[lc(w)&&h.jsx($de,{tool:t,maxLines:s}),(w==="write_file"||w==="writefile")&&h.jsx(E9,{tool:t}),(w==="edit"||w==="write"||w==="editfile")&&h.jsx(E9,{tool:t}),(w==="read"||w==="read_file"||w==="readfile")&&h.jsx(zde,{tool:t}),Rh(t.toolName)&&h.jsx(Hde,{tool:t})]})]})},nhe),she=g.memo(function({tools:t,pendingApproval:n,workspaceCwd:r,shellOutputMaxLines:s}){const{t:i}=et(),o=g.useContext(Dh),[a,l]=g.useState(!1),c=iL(t),u=t.length>0?N_(t):void 0,d=t[0]??u,f=g.useRef(Date.now()),m=E_(c),p=(n==null?void 0:n.toolCallId)&&t.some(b=>Ka(b,n.toolCallId)),y=o&&!p,v=c?Qj(m-f.current):void 0;return g.useEffect(()=>{c&&(f.current=Date.now())},[c,u==null?void 0:u.callId]),y?h.jsx(the,{tools:t,workspaceCwd:r}):p?h.jsx("div",{className:st.group,children:t.map(b=>h.jsx(mv,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s},b.callId))}):h.jsxs("div",{className:st.chatGroupWrap,children:[h.jsxs("button",{type:"button",className:st.chatSummary,onClick:()=>l(b=>!b),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[h.jsx("span",{className:st.chatSummaryIcon,"aria-hidden":"true",children:d?h.jsx(Zde,{tool:d}):h.jsx(oL,{})}),h.jsx("span",{className:c?`${st.chatSummaryText} ${st.chatSummaryTextActive}`:st.chatSummaryText,children:Gde(t,i,v)}),h.jsx("span",{className:a?st.chatChevronDown:st.chatChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:a?st.chatSummaryContentClip:`${st.chatSummaryContentClip} ${st.chatSummaryContentCollapsed}`,children:h.jsx("div",{className:st.chatSummaryContentInner,children:h.jsx("div",{className:st.group,children:t.map(b=>h.jsx(mv,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s},b.callId))})})})]})}),ihe="_message_kwepu_1",ohe="_header_kwepu_6",ahe="_chevron_kwepu_20",lhe="_title_kwepu_26",che="_progress_kwepu_35",uf={message:ihe,header:ohe,chevron:ahe,title:lhe,progress:che};function uhe({id:e,todos:t}){var s;const r=((s=g.useContext(d6).get(e))==null?void 0:s.events)??[];return h.jsx(eL,{todos:t,events:r})}const dhe=g.memo(function({id:t,todos:n}){const{t:r}=et(),[s,i]=g.useState(!1);if(n.length===0)return null;const o=n.length,a=n.filter(l=>l.status==="completed").length;return h.jsxs("div",{className:uf.message,children:[h.jsxs("button",{type:"button",className:uf.header,onClick:()=>i(l=>!l),"aria-expanded":s,title:r(s?"todo.collapse":"todo.expand"),children:[h.jsx("span",{className:uf.chevron,"aria-hidden":"true",children:s?"▾":"▸"}),h.jsx("span",{className:uf.title,children:r("plan.title")}),h.jsxs("span",{className:uf.progress,children:[a,"/",o]})]}),s?h.jsx(tL,{todos:n,numbered:!0}):h.jsx(uhe,{id:t,todos:n})]})}),hhe="_message_1abcu_1",fhe="_content_1abcu_11",mhe="_question_1abcu_17",phe="_prefix_1abcu_24",ghe="_answer_1abcu_28",yhe="_pending_1abcu_32",bhe="_shortcuts_1abcu_36",qc={message:hhe,content:fhe,question:mhe,prefix:phe,answer:ghe,pending:yhe,shortcuts:bhe},aL=g.memo(function({question:t,answer:n,isPending:r}){const{t:s}=et();return h.jsxs("div",{className:qc.message,children:[h.jsxs("div",{className:qc.content,children:[h.jsxs("div",{className:qc.question,children:[h.jsx("span",{className:qc.prefix,children:"/btw "}),h.jsx("span",{children:t})]}),h.jsx("div",{className:qc.answer,children:r?h.jsx("span",{className:qc.pending,children:s("btw.answering")}):h.jsx(gm,{content:n})})]}),h.jsx("div",{className:qc.shortcuts,children:s(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),xhe="_message_1d0r1_1",whe="_compact_1d0r1_16",vhe="_header_1d0r1_21",_he="_status_1d0r1_30",khe="_name_1d0r1_35",She="_command_1d0r1_42",The="_output_1d0r1_51",Che="_compactHint_1d0r1_62",wa={message:xhe,compact:whe,header:vhe,status:_he,name:khe,command:She,output:The,compactHint:Che},Ahe=g.memo(function({command:t,output:n}){const r=g.useContext(Dh),{t:s}=et();return h.jsxs("div",{className:r?`${wa.message} ${wa.compact}`:wa.message,children:[h.jsxs("div",{className:wa.header,children:[h.jsx("span",{className:wa.status,children:"✓"}),h.jsx("span",{className:wa.name,children:s("shell.command")}),t&&h.jsx("span",{className:wa.command,children:t})]}),r?h.jsx("div",{className:wa.compactHint,children:s("compact.hint")}):n&&h.jsx("pre",{className:wa.output,children:n})]})}),Ehe="_progress_uyd9u_1",Mhe="_spinner_uyd9u_12",Nhe="_bar_uyd9u_19",Ihe="_stage_uyd9u_25",Rhe="_icon_uyd9u_29",jhe="_done_uyd9u_35",Lhe="_error_uyd9u_43",Dhe="_detail_uyd9u_51",Ohe="_path_uyd9u_56",Fr={progress:Ehe,spinner:Mhe,bar:Nhe,stage:Ihe,icon:Rhe,done:jhe,error:Lhe,detail:Dhe,path:Ohe},N9=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function Bhe({progress:e}){const{stage:t,progress:n,detail:r,isComplete:s,error:i}=e,[o,a]=g.useState(0),l=30,c=Math.round(n/100*l),u=l-c,d="█".repeat(Math.max(0,c))+"░".repeat(Math.max(0,u));return g.useEffect(()=>{if(s||i)return;const f=setInterval(()=>{a(m=>(m+1)%N9.length)},120);return()=>clearInterval(f)},[s,i]),i?h.jsxs("div",{className:`${Fr.progress} ${Fr.error}`,children:[h.jsx("span",{className:Fr.icon,children:"✕"}),h.jsx("span",{className:Fr.stage,children:t}),h.jsx("div",{className:Fr.detail,children:i})]}):s?h.jsxs("div",{className:`${Fr.progress} ${Fr.done}`,children:[h.jsx("span",{className:Fr.icon,children:"✓"}),h.jsx("span",{className:Fr.stage,children:t})]}):h.jsxs("div",{className:Fr.progress,children:[h.jsx("span",{className:Fr.spinner,children:N9[o]}),h.jsx("span",{className:Fr.bar,children:d}),h.jsxs("span",{className:Fr.stage,children:[t,r?` (${r})`:""]})]})}function $he({path:e}){const{t}=et();return h.jsxs("div",{className:`${Fr.progress} ${Fr.done}`,children:[h.jsx("span",{className:Fr.icon,children:"✓"}),h.jsx("span",{className:Fr.stage,children:t("insight.ready")}),h.jsx("span",{className:Fr.path,children:e})]})}const zhe=g.memo(function({message:t,pendingApproval:n,onShowContextDetail:r,workspaceCwd:s,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:l,showAssistantActions:c=!1,showAssistantBranch:u=!1,shellOutputMaxLines:d}){const f=(()=>{switch(t.role){case"user":return h.jsx(oie,{content:t.content,images:t.images});case"assistant":return h.jsx(Tie,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:c,showBranchAction:u});case"thinking":return h.jsx(Mie,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp});case"tool_group":return h.jsx(she,{tools:t.tools,pendingApproval:n,workspaceCwd:s,shellOutputMaxLines:d});case"plan":return h.jsx(dhe,{id:t.id,todos:t.todos});case"system":return h.jsx(kce,{content:t.content,variant:t.variant,source:t.source,data:t.data,onShowContextDetail:r,isLatest:i,showRetryHint:o&&t.retryable===!0,onRetryClick:a});case"user_shell":return h.jsx(Ahe,{command:t.command,output:t.output});case"btw":return h.jsx(aL,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return h.jsx(Bhe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return h.jsx($he,{path:t.path});case"insight_error":return h.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(f===null)return null;const m=h.jsx(RN,{label:`message:${t.role}`,resetKeys:[t],fallback:h.jsx(Phe,{align:t.role==="user"?"end":"start"}),children:f});return t.role==="assistant"?c?m:h.jsx(fw,{timestamp:t.timestamp,children:m}):h.jsx(fw,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:"Copy",children:m})},qhe);function Phe({align:e}){const{t}=et();return h.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:h.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function qhe(e,t){var n,r;return((n=e.pendingApproval)==null?void 0:n.id)!==((r=t.pendingApproval)==null?void 0:r.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.shellOutputMaxLines!==t.shellOutputMaxLines?!1:Fhe(e.message,t.message)}function Fhe(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&&Vhe(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"&&Uhe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,r)=>lL(n,t.tools[r]));default:return!1}}function Uhe(e,t){return e.length===t.length&&e.every((n,r)=>{const s=t[r];return s&&n.id===s.id&&n.content===s.content&&n.status===s.status&&n.priority===s.priority})}function lL(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&&gl(e.args)===gl(t.args)&&gl(e.rawOutput)===gl(t.rawOutput)&&gl(e.locations)===gl(t.locations)&&gl(e.content)===gl(t.content)&&Hhe(e.subTools,t.subTools):!1}function Hhe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>lL(n,t[r]))}const I9=new WeakMap;function Vhe(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>n.data===t[r].data&&n.mimeType===t[r].mimeType)}function gl(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=I9.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return I9.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}const Whe="_wrap_42aql_1",Ghe="_summary_42aql_5",Khe="_summaryIcon_42aql_28",Yhe="_summaryToolIcon_42aql_42",Xhe="_summaryText_42aql_48",Qhe="_summaryTextActive_42aql_58",Jhe="_summaryDot_42aql_85",Zhe="_chevronRight_42aql_89",efe="_chevronDown_42aql_90",tfe="_group_42aql_116",nfe="_list_42aql_145",rfe="_row_42aql_153",sfe="_rowStats_42aql_167",ife="_rowDesc_42aql_175",ofe="_rowTool_42aql_185",afe="_detail_42aql_189",Xr={wrap:Whe,summary:Ghe,summaryIcon:Khe,summaryToolIcon:Yhe,summaryText:Xhe,summaryTextActive:Qhe,summaryDot:Jhe,chevronRight:Zhe,chevronDown:efe,group:tfe,list:nfe,row:rfe,rowStats:sfe,rowDesc:ife,rowTool:ofe,detail:afe};function lfe(e){const t=Math.round(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r>0?`${n}m ${r}s`:`${n}m`}function cfe(e,t){const n=[],r=ym(e.rawOutput),s=r==null?void 0:r.executionSummary,i=s&&typeof s.totalDurationMs=="number"?lfe(s.totalDurationMs):bm(e.startTime,e.endTime??(e.status==="in_progress"?t:void 0));i&&n.push(i);const o=r&&typeof r.tokenCount=="number"&&r.tokenCount>0?r.tokenCount:s&&typeof s.totalTokens=="number"&&s.totalTokens>0?s.totalTokens:0;o>0&&n.push(__(o));const a=v_(e);return a&&n.push(fs(a,80)),n.join(" · ")}function ufe(){return h.jsx("svg",{className:Xr.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:h.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 dfe({agents:e,pendingApproval:t}){const{t:n}=et(),[r,s]=g.useState(!1),[i,o]=g.useState(null),[a,l]=g.useState(()=>Date.now()),c=g.useRef(Date.now()),u=e.some(b=>b.status==="in_progress");g.useEffect(()=>{u&&(c.current=Date.now(),l(Date.now()))},[u]),g.useEffect(()=>{if(!u)return;const b=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(b)},[u]);const d=u?Qj(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=>Ka(b,t.toolCallId)):void 0,y=r||!!p,v=e.some(b=>L0(b)==="failed")?"failed":u?"in_progress":"completed";return h.jsxs("div",{className:Xr.wrap,children:[h.jsxs("button",{type:"button",className:Xr.summary,onClick:()=>s(b=>!b),"aria-expanded":y,title:n(y?"tool.collapseHint":"tool.expand"),children:[h.jsx("span",{className:Xr.summaryIcon,"aria-hidden":"true",children:v==="failed"?h.jsx(Cu,{status:v}):h.jsx(ufe,{})}),h.jsxs("span",{className:u?`${Xr.summaryText} ${Xr.summaryTextActive}`:Xr.summaryText,children:[n("parallelAgents.title"),d&&h.jsxs(h.Fragment,{children:[" ",d]}),h.jsx("span",{className:Xr.summaryDot,children:"·"}),n("parallelAgents.done",{done:f,total:m})]}),h.jsx("span",{className:y?Xr.chevronDown:Xr.chevronRight,"aria-hidden":"true"})]}),y&&h.jsx("div",{className:Xr.group,children:h.jsx("div",{className:Xr.list,children:e.map(b=>{const x=k_(b),w=S_(b),k=yoe(b,n),T=cfe(b,a),C=L0(b),A=i===b.callId;return h.jsxs("div",{children:[h.jsxs("div",{className:Xr.row,onClick:()=>o(A?null:b.callId),children:[h.jsx(Cu,{status:C}),h.jsxs("span",{className:Xr.rowDesc,children:[fs(w||x,50),k&&h.jsx("span",{className:Xr.rowTool,children:` (${k})`})]}),T&&h.jsx("span",{className:Xr.rowStats,children:T})]}),A&&h.jsx("div",{className:Xr.detail,children:h.jsx(T_,{tool:b,hideHeader:!0})})]},b.callId)})})})]})}const hfe="_collapseRow_1yo3i_1",ffe="_collapseRowClickable_1yo3i_14",mfe="_collapseLabel_1yo3i_19",pfe="_processedLabel_1yo3i_36",gfe="_processedMeta_1yo3i_43",yfe="_hiddenMetrics_1yo3i_47",bfe="_summaryMetrics_1yo3i_51",xfe="_collapseIcon_1yo3i_59",wfe="_chevronRight_1yo3i_72",vfe="_chevronDown_1yo3i_73",ao={collapseRow:hfe,collapseRowClickable:ffe,collapseLabel:mfe,processedLabel:pfe,processedMeta:gfe,hiddenMetrics:yfe,summaryMetrics:bfe,collapseIcon:xfe,chevronRight:wfe,chevronDown:vfe},_fe="_list_oybnx_1",kfe="_rowFlash_oybnx_33",Sfe="_turnStatusRow_oybnx_38",Tfe="_turnAnswerRow_oybnx_39",Cfe="_turnContentRow_oybnx_51",Afe="_turnContentClip_oybnx_55",Efe="_turnContentCollapsed_oybnx_63",Mfe="_turnContentInner_oybnx_67",Jl={list:_fe,rowFlash:kfe,turnStatusRow:Sfe,turnAnswerRow:Tfe,turnContentRow:Cfe,turnContentClip:Afe,turnContentCollapsed:Efe,turnContentInner:Mfe};function R9(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="user")return n.id}return null}function j9(e){return e.role==="tool_group"&&e.tools.length===1&&Ty(e.tools[0])}function k4(e){return e.role==="tool_group"&&e.tools.length===1&&EN(e.tools[0])}function L9(e){return e.role==="thinking"}function D9(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>Ka(n,t.toolCallId)))}function O9(e){return e.role==="thinking"}function Nfe(e,t){const n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.role!=="tool_group"||D9(s,t)){O9(s)||n.push(s),r++;continue}const i=[s];let o=r,a=r+1;for(;a<e.length;){const c=e[a];if(O9(c)){a++;continue}if(c.role==="tool_group"&&!D9(c,t)){i.push(c),o=a,a++;continue}break}if(i.length===1){n.push(s),r++;continue}const l=i.flatMap(c=>c.role==="tool_group"?c.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:l}),r=o+1}return n}function Ife(e){const t=[];let n=0;for(;n<e.length;){if(k4(e[n])){const r=[];let s=n;for(;s<e.length;){const i=e[s];if(k4(i)){r.push(i),s++;continue}if(L9(i)){let o=s+1;for(;o<e.length&&L9(e[o]);)o++;if(o<e.length&&k4(e[o])){s=o;continue}}break}if(r.length>=2){t.push({type:"parallel_agents",key:`par-${r[0].id}`,agents:r.map(i=>i.tools[0]),timestamp:r[0].timestamp}),n=s;continue}}if(j9(e[n])){const r=n;for(;n<e.length&&j9(e[n]);)n++;if(n-r>=2){const s=e.slice(r,n);t.push({type:"parallel_agents",key:`par-${s[0].id}`,agents:s.map(i=>i.tools[0]),timestamp:s[0].timestamp})}else t.push({type:"message",key:e[r].id,message:e[r]})}else t.push({type:"message",key:e[n].id,message:e[n]}),n++}return t}function B9(e){return e.type==="parallel_agents"?`group:${e.key}`:e.type==="turn_collapse"?`tc:${e.key}`:e.type==="turn_content"?`turn-content:${e.key}`:`msg:${e.key}`}function Rfe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function jfe(e,t,n){let r=t;for(let s=n;s>t;s--)if(cL(e[s])){r=s;break}for(let s=n;s>r;s--)if(Rfe(e[s]))return s;return-1}function pv(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=>pv(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return Lfe(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 Lfe(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 cL(e){return e.type==="parallel_agents"?!0:e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(cL):e.message.role==="tool_group"||e.message.role==="plan"}function $9(e){return e==="pending"||e==="running"||e==="in_progress"}function uL(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const r=uL(e.items[n]);if(r)return r}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(r=>$9(r.status));return n.length===0?null:`agents:${e.key}:${n.map(r=>r.callId).join(",")}`}if(e.message.role!=="tool_group")return null;const t=e.message.tools.filter(n=>$9(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function Dfe(e){for(let t=e.length-1;t>=0;t--){const n=uL(e[t]);if(n)return n}return null}function Ofe(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 Bfe(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 $fe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function dL(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+dL(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function zfe(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const r=e[n];if(r.type==="message"&&r.message.role==="user")return r.message.id}return null}function Pfe(e,t,n,r){if(!r)return!1;for(let s=t;s<=n;s++){const i=e[s];if(i.type==="parallel_agents"){if(i.agents.some(o=>Ka(o,r)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>Ka(o,r)))return!0}return!1}function qfe(e,{overrides:t,isResponding:n,activeTurnStartedAt:r,pendingApprovalCallId:s,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"&&c.message.role==="user"&&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],u=(l+1<o.length?o[l+1]:e.length)-1,d=e[c],f=d.message.id,m=d.message.timestamp,p=l===o.length-1&&n,y=Pfe(e,c,u,s),v=jfe(e,c,u);let b=0,x,w,k=0,T=0,C=0,A=0,L=0,$=!1;for(let j=c+1;j<=u;j++){const B=e[j];pv(B,j===v)&&b++,A+=dL(B),B.type==="message"&&B.message.role==="thinking"&&L++;const ne=Ofe(B);ne!==void 0&&(x=x===void 0?ne:Math.max(x,ne));const de=Bfe(B);de!==void 0&&(w=w===void 0?de:Math.max(w,de));const ce=$fe(B);ce&&(k+=ce.inputTokens,T+=ce.outputTokens,C+=ce.cachedTokens??0,$=!0)}const E=p?r??m??Date.now():void 0,z=x??w,M=m!==void 0&&z!==void 0&&z>=m?z-m:void 0;if(y||b===0&&!($||M!==void 0||E!==void 0)){for(let j=c;j<=u;j++)a.push(e[j]);continue}const J=!(b===0?!0:t.has(f)?t.get(f):p);let P=0;const V=j=>{j.length!==0&&a.push({type:"turn_content",key:`${f}-content-${P++}`,turnId:f,collapsed:J,items:j})};a.push({type:"message",key:d.key,message:d.message});const X={turnId:f,collapsed:J,hiddenCount:b,...M!==void 0?{elapsedMs:M}:{},...$?{inputTokens:k,outputTokens:T}:{},...C>0?{cachedTokens:C}:{},...A>0?{toolCallCount:A}:{},...L>0?{thinkingCount:L}:{},...E!==void 0?{liveStartedAt:E}:{}};if(a.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:X}),!J){let j=[];for(let B=c+1;B<=u;B++){const I=e[B];B===v&&I.type==="message"&&I.message.role==="assistant"?(V(j),j=[],a.push({...I,turnCollapse:X})):j.push(I)}V(j);continue}const te=[],D=[];for(let j=c+1;j<=u;j++){const B=e[j];if(!(j===v&&p)){if(j===v&&B.type==="message"&&B.message.role==="assistant"){D.push({...B,turnCollapse:X});continue}if(pv(B,j===v)){te.push(B);continue}D.push(B)}}V(te),a.push(...D)}return a}function pg(e,t,n){for(let r=0;r<e.length;r++){const s=e[r];if(s.type==="message"){if(s.message.id===t||n&&s.message.role==="tool_group"&&s.message.tools.some(i=>Ka(i,n)))return r}else{if(s.type==="parallel_agents"&&n&&s.agents.some(i=>Ka(i,n)))return r;if(s.type==="turn_content"&&pg(s.items,t,n)>=0)return r}}return-1}const S4=0,Ffe=120,T4=80,Ufe=32,Hfe=240,hL=200;function Vfe(e,t=hL){return e>t}function Wfe(e){const t=Math.max(0,Math.ceil(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t-n*60;return`${n}m ${r}s`}function C4(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function Gfe(e){return e!==void 0?Wfe(e):""}function Kfe(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,r=n>0&&e.inputTokens>0?` (${C4(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${C4(e.inputTokens)}${r} ↓${C4(e.outputTokens)}`}function z9(e,t){const n=[],r=Kfe(e,t);return r&&n.push(r),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 Yfe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const Xfe=g.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:r}=et(),s=t.hiddenCount>0,i=t.liveStartedAt,o=s||i!==void 0||Yfe(t),a=E_(i!==void 0&&o),l=g.useRef(0);let c;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),c=l.current):o&&t.elapsedMs!==void 0?(l.current=0,c=t.elapsedMs):(l.current=0,c=void 0);const u=Gfe(c),d=z9(t,r),f=z9(t,r),m=r(i!==void 0?"turn.processing":"turn.processed"),p=!!u&&o,y=!!d&&o,v=!!f&&o;if(!o)return null;const b=()=>{if(!s)return;const x=t.collapsed;n(t.turnId,x)};return h.jsxs("div",{className:s?`${ao.collapseRow} ${ao.collapseRowClickable}`:ao.collapseRow,role:s?"button":void 0,tabIndex:s?0:void 0,"aria-expanded":s?!t.collapsed:void 0,"aria-label":s?t.collapsed?r("turn.expand"):r("turn.collapse"):void 0,title:s?t.collapsed?r("turn.expand"):r("turn.collapse"):void 0,onClick:s?b:void 0,onKeyDown:s?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),b())}:void 0,children:[h.jsxs("span",{className:ao.collapseLabel,children:[h.jsxs("span",{className:ao.processedLabel,children:[m,p&&h.jsxs("span",{className:ao.processedMeta,children:[" ",u]})]}),v&&h.jsx("span",{className:ao.summaryMetrics,children:f}),y&&h.jsx("span",{className:ao.hiddenMetrics,children:d})]}),s&&h.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:ao.collapseIcon,onClick:x=>{x.stopPropagation(),b()},children:h.jsx("span",{className:t.collapsed?ao.chevronRight:ao.chevronDown,"aria-hidden":"true"})})]})});function P9(e){if(e.type==="turn_collapse")return Jl.turnStatusRow;if(e.type==="turn_content")return Jl.turnContentRow;if(e.type==="message"&&e.turnCollapse)return Jl.turnAnswerRow}const Qfe=g.memo(function({collapsed:t,children:n}){const r=fL(Jl.turnContentClip,t?Jl.turnContentCollapsed:void 0);return h.jsx("div",{className:r,"data-collapsed":t?"true":"false",children:h.jsx("div",{className:Jl.turnContentInner,children:n})})});function fL(...e){return e.filter(Boolean).join(" ")||void 0}const Jfe=g.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:r,catchingUp:s,isResponding:i=!1,activeTurnStartedAt:o,welcomeHeader:a,workspaceCwd:l,tailContent:c,tailKey:u="tail",virtualScrollThreshold:d=hL,shellOutputMaxLines:f,autoScrollTailIntoView:m=!1,showRetryHint:p=!1,onRetryClick:y,onBranchSession:v,onFollowStateChange:b},x){const w=g.useContext(Dh),k=g.useMemo(()=>w?Nfe(t,n):t,[w,t,n]),T=g.useMemo(()=>Ife(k),[k]),C=g.useMemo(()=>{var W;if(i)return null;for(let re=k.length-1;re>=0;re-=1){const me=k[re];if(me&&(me.role==="tool_group"||me.role==="plan"))return null;if((me==null?void 0:me.role)==="assistant"&&!me.isStreaming&&((W=me.content)!=null&&W.trim()))return me.id}return null},[i,k]),{collapseCompletedTurns:A}=xc(),L=A??!0,[$,E]=g.useState(()=>new Map),z=g.useRef(!0),M=g.useRef(0),U=g.useRef(!1),K=g.useRef(0),J=g.useRef(!0),P=g.useRef(null),V=g.useRef(null),X=g.useRef(s),te=g.useRef(s),D=g.useRef(!1);te.current=s;const j=g.useCallback(W=>{z.current=W,J.current!==W&&(J.current=W,b==null||b(W))},[b]),B=g.useMemo(()=>qfe(T,{overrides:$,isResponding:i,activeTurnStartedAt:o,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:L}),[T,$,i,o,n==null?void 0:n.toolCallId,L]),I=g.useRef(null),ne=c!=null,de=!!a,ce=de?1:0,Ne=ce+B.length,Ce=Ne+(ne?1:0),ze=Vfe(Ce,d),ue=g.useCallback(()=>I.current,[]),rt=g.useCallback((W,re)=>{j(!1),E(me=>{const Pe=new Map(me);return Pe.set(W,re),Pe})},[j]),xe=g.useCallback(W=>{if(de&&W===S4)return"slot:header";if(ne&&W===Ne)return`slot:tail:${u}`;const re=B[W-ce];return re?B9(re):`slot:row:${W}`},[de,ne,Ne,u,B,ce]),Ee=g.useCallback((W="auto")=>{const re=ue();if(!re||re.scrollHeight<=re.clientHeight)return;K.current+=1;const me=K.current;U.current=!0,W==="smooth"?re.scrollTo({top:re.scrollHeight,behavior:W}):re.scrollTop=re.scrollHeight,M.current=Math.max(0,re.scrollHeight-re.clientHeight);const Pe=()=>{K.current===me&&(U.current=!1)};W==="smooth"?setTimeout(Pe,350):requestAnimationFrame(Pe)},[ue]),Zt=g.useCallback((W="smooth")=>{j(!0),Ee(W)},[Ee,j]),ht=oH({count:Ce,enabled:ze,getScrollElement:ue,getItemKey:xe,estimateSize:W=>{if(de&&W===S4)return Ffe;if(ne&&W===Ne)return Hfe;const re=B[W-ce];return(re==null?void 0:re.type)==="turn_collapse"?Ufe:(re==null?void 0:re.type)==="turn_content"?Math.max(T4,re.items.length*T4):T4},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),bt=ht.getVirtualItems(),Vt=ht.getTotalSize(),[pn,vt]=g.useState(null);g.useEffect(()=>{if(!pn)return;const W=setTimeout(()=>vt(null),1600);return()=>clearTimeout(W)},[pn]);const Wt=g.useCallback(W=>{var Pe,Re;j(!1),K.current+=1;const re=K.current;U.current=!0,ze?ht.scrollToIndex(W,{align:"center"}):(Re=(Pe=I.current)==null?void 0:Pe.querySelector(`[data-index="${W}"]`))==null||Re.scrollIntoView({block:"center"}),setTimeout(()=>{K.current===re&&(U.current=!1)},150);const me=xe(W);vt(null),requestAnimationFrame(()=>vt(me))},[ze,ht,xe,j]),Gt=g.useRef(null),Tt=g.useCallback((W,re)=>{const me=pg(B,W,re);if(me>=0){const nt=B[me];return(nt==null?void 0:nt.type)==="turn_content"&&nt.collapsed?(Gt.current={messageId:W,callId:re},E(wt=>{if(wt.get(nt.turnId)===!0)return wt;const ut=new Map(wt);return ut.set(nt.turnId,!0),ut}),!0):(Gt.current=null,Wt(me+ce),!0)}const Pe=pg(T,W,re);if(Pe<0)return!1;const Re=zfe(T,Pe);return Re?(Gt.current={messageId:W,callId:re},E(nt=>{if(nt.get(Re)===!0)return nt;const wt=new Map(nt);return wt.set(Re,!0),wt}),!0):!1},[B,T,ce,Wt]);g.useImperativeHandle(x,()=>({scrollToMessage:Tt,scrollToBottom:Zt}),[Tt,Zt]),g.useEffect(()=>{const W=Gt.current;if(!W)return;const re=pg(B,W.messageId,W.callId);re<0||(Gt.current=null,Wt(re+ce))},[B,ce,Wt]);const Oe=g.useCallback(()=>{const W=ue();if(!W)return;if(U.current){M.current=W.scrollTop;return}const re=M.current,me=W.scrollTop;M.current=me;const Pe=W.scrollHeight-me-W.clientHeight;if(me<re-1){j(Pe<30);return}Pe<30&&j(!0)},[ue,j]);g.useEffect(()=>{const W=ue();if(W)return W.addEventListener("scroll",Oe,{passive:!0}),()=>W.removeEventListener("scroll",Oe)},[ue,Oe]),g.useEffect(()=>{t.length===0&&(j(!0),Gt.current=null,E(W=>W.size?new Map:W))},[t.length,j]),g.useEffect(()=>{const W=I.current;if(!W)return;const re=new ResizeObserver(()=>{te.current||z.current&&requestAnimationFrame(()=>{!te.current&&z.current&&Ee()})});return re.observe(W),()=>re.disconnect()},[Ee]),g.useEffect(()=>{const W=R9(t);if(s){P.current=W;return}W&&W!==P.current&&(j(!0),Gt.current=null),P.current=W},[t,s,j]),g.useEffect(()=>{X.current&&!s&&(j(!0),requestAnimationFrame(()=>Ee())),X.current=s},[s,Ee,j]);const ot=g.useMemo(()=>Dfe(B),[B]);g.useLayoutEffect(()=>{if(!s){if(!ot){V.current=null;return}ot!==V.current&&(V.current=ot,z.current&&requestAnimationFrame(()=>{z.current&&Ee()}))}},[s,ot,Ee]),g.useEffect(()=>{m&&ne&&!D.current&&(j(!0),requestAnimationFrame(()=>{z.current&&Ee()})),D.current=ne},[m,ne,Ee,j]);const ft=g.useCallback(W=>{const re=(Re,nt)=>Re.type==="parallel_agents"?h.jsx(fw,{timestamp:Re.timestamp,children:h.jsx(dfe,{agents:Re.agents,pendingApproval:n})}):Re.type==="turn_collapse"?h.jsx(Xfe,{turnCollapse:Re.turnCollapse,onToggleCollapse:rt}):Re.type==="turn_content"?h.jsx(Qfe,{collapsed:Re.collapsed,children:Re.items.map(wt=>h.jsx("div",{className:P9(wt),children:re(wt,!1)},B9(wt)))}):h.jsx(zhe,{message:Re.message,pendingApproval:n,onShowContextDetail:r,workspaceCwd:l,isLatest:nt,showRetryHint:p,onRetryClick:y,onBranchSession:v,showAssistantActions:Re.message.role==="assistant"&&Re.message.id===C,showAssistantBranch:Re.message.role==="assistant"&&Re.message.id===C,shellOutputMaxLines:f});if(de&&W===S4)return a;if(ne&&W===Ne)return c;const me=W-ce,Pe=B[me];return Pe?re(Pe,me===B.length-1):null},[de,a,ne,c,Ne,n,r,ce,B,C,l,p,y,v,f,rt]),F=g.useCallback((W,re)=>fL(pn===W?Jl.rowFlash:void 0,re?P9(re):void 0),[pn]);return g.useLayoutEffect(()=>{if(!s&&!U.current&&z.current){const W=R9(t),re=W!==null&&W!==P.current;Ee(re?"smooth":"auto")}},[Vt,t,Ce,s,Ee]),h.jsx("div",{ref:I,className:Jl.list,children:ze?h.jsx("div",{style:{height:Vt,width:"100%",position:"relative"},children:bt.map(W=>h.jsx("div",{"data-index":W.index,ref:ht.measureElement,className:F(String(W.key),B[W.index-ce]),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${W.start}px)`},children:ft(W.index)},W.key))}):Array.from({length:Ce},(W,re)=>{const me=xe(re),Pe=B[re-ce];return h.jsx("div",{"data-index":re,className:F(me,Pe),children:ft(re)},me)})})});/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function Zfe(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 e0e(e){const t=new Set,n=[];for(const r of(e==null?void 0:e.providers)??[])for(const s of r.models??[]){const i=s.baseModelId;!i||s.isRuntime||!Zfe(i)||t.has(i)||(t.add(i),n.push({id:i,...s.name?{label:s.name}:{},...r.authType?{authType:r.authType}:{},...s.baseUrl?{baseUrl:s.baseUrl}:{},...typeof s.contextLimit=="number"?{contextWindow:s.contextLimit}:{},modalities:{audio:!0}}))}return n}let gv=[],mL=[];(()=>{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?mL:gv).push(n=n+e[t])})();function t0e(e){if(e<768)return!1;for(let t=0,n=gv.length;;){let r=t+n>>1;if(e<gv[r])n=r;else if(e>=mL[r])t=r+1;else return!0;if(t==n)return!1}}function q9(e){return e>=127462&&e<=127487}const F9=8205;function n0e(e,t,n=!0,r=!0){return(n?pL:r0e)(e,t,r)}function pL(e,t,n){if(t==e.length)return t;t&&gL(e.charCodeAt(t))&&yL(e.charCodeAt(t-1))&&t--;let r=A4(e,t);for(t+=U9(r);t<e.length;){let s=A4(e,t);if(r==F9||s==F9||n&&t0e(s))t+=U9(s),r=s;else if(q9(s)){let i=0,o=t-2;for(;o>=0&&q9(A4(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function r0e(e,t,n){for(;t>0;){let r=pL(e,t-2,n);if(r<t)return r;t--}return 0}function A4(e,t){let n=e.charCodeAt(t);if(!yL(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return gL(r)?(n-55296<<10)+(r-56320)+65536:n}function gL(e){return e>=56320&&e<57344}function yL(e){return e>=55296&&e<56320}function U9(e){return e<65536?1:2}class hn{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,r){[t,n]=ah(this,t,n);let s=[];return this.decompose(0,t,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Bo.from(s,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=ah(this,t,n);let r=[];return this.decompose(t,n,r,0),Bo.from(r,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),r=this.length-this.scanIdentical(t,-1),s=new s0(this),i=new s0(t);for(let o=n,a=n;;){if(s.next(o),i.next(o),o=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(a+=s.value.length,s.done||a>=r)return!0}}iter(t=1){return new s0(this,t)}iterRange(t,n=this.length){return new bL(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(t).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new xL(r)}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]?hn.empty:t.length<=32?new gr(t):Bo.from(gr.split(t,[]))}}class gr extends hn{constructor(t,n=s0e(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.text[i],a=s+o.length;if((n?r:a)>=t)return new i0e(s,a,r,o);s=a+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new gr(H9(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let o=r.pop(),a=gg(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new gr(a,o.length+i.length));else{let l=a.length>>1;r.push(new gr(a.slice(0,l)),new gr(a.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof gr))return super.replace(t,n,r);[t,n]=ah(this,t,n);let s=gg(this.text,gg(r.text,H9(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new gr(s,i):Bo.from(gr.split(s,[]),i)}sliceString(t,n=this.length,r=`
`){[t,n]=ah(this,t,n);let s="";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&&(s+=r),t<l&&n>i&&(s+=a.slice(Math.max(0,t-i),n-i)),i=l+1}return s}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],s=-1;for(let i of t)r.push(i),s+=i.length+1,r.length==32&&(n.push(new gr(r,s)),r=[],s=-1);return s>-1&&n.push(new gr(r,s)),n}}class Bo extends hn{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,s){for(let i=0;;i++){let o=this.children[i],a=s+o.length,l=r+o.lines-1;if((n?l:a)>=t)return o.lineInner(t,n,r,s);s=a+1,r=l+1}}decompose(t,n,r,s){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=s&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!c?r.push(a):a.decompose(t-o,n-o,r,c)}o=l+1}}replace(t,n,r){if([t,n]=ah(this,t,n),r.lines<this.lines)for(let s=0,i=0;s<this.children.length;s++){let o=this.children[s],a=i+o.length;if(t>=i&&n<=a){let l=o.replace(t-i,n-i,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[s]=l,new Bo(u,this.length-(n-t)+r.length)}return super.replace(i,a,l)}i=a+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=`
`){[t,n]=ah(this,t,n);let s="";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&&(s+=r),t<l&&n>o&&(s+=a.sliceString(t-o,n-o,r)),o=l+1}return s}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof Bo))return 0;let r=0,[s,i,o,a]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==o||i==a)return r;let l=this.children[s],c=t.children[i];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(t,n=t.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let m of t)r+=m.lines;if(r<32){let m=[];for(let p of t)p.flatten(m);return new gr(m,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,a=[],l=0,c=-1,u=[];function d(m){let p;if(m.lines>i&&m instanceof Bo)for(let y of m.children)d(y);else m.lines>o&&(l>o||!l)?(f(),a.push(m)):m instanceof gr&&l&&(p=u[u.length-1])instanceof gr&&m.lines+p.lines<=32?(l+=m.lines,c+=m.length+1,u[u.length-1]=new gr(p.text.concat(m.text),p.length+1+m.length)):(l+m.lines>s&&f(),l+=m.lines,c+=m.length+1,u.push(m))}function f(){l!=0&&(a.push(u.length==1?u[0]:Bo.from(u,c)),c=-1,l=u.length=0)}for(let m of t)d(m);return f(),a.length==1?a[0]:new Bo(a,n)}}hn.empty=new gr([""],0);function s0e(e){let t=-1;for(let n of e)t+=n.length+1;return t}function gg(e,t,n=0,r=1e9){for(let s=0,i=0,o=!0;i<e.length&&s<=r;i++){let a=e[i],l=s+a.length;l>=n&&(l>r&&(a=a.slice(0,r-s)),s<n&&(a=a.slice(n-s)),o?(t[t.length-1]+=a,o=!1):t.push(a)),s=l+1}return t}function H9(e,t,n){return gg(e,[""],t,n)}class s0{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 gr?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],o=i>>1,a=s instanceof gr?s.text.length:s.children.length;if(o==(n>0?a:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=`
`,this;t--}else if(s instanceof gr){let l=s.text[o+(n<0?-1:0)];if(this.offsets[r]+=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=s.children[o+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof gr?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 bL{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new s0(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}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 r=n<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:s}=this.cursor.next(t);return this.pos+=(s.length+t)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),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 xL{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:r,value:s}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(hn.prototype[Symbol.iterator]=function(){return this.iter()},s0.prototype[Symbol.iterator]=bL.prototype[Symbol.iterator]=xL.prototype[Symbol.iterator]=function(){return this});class i0e{constructor(t,n,r,s){this.from=t,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function ah(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ms(e,t,n=!0,r=!0){return n0e(e,t,n,r)}function o0e(e){return e>=56320&&e<57344}function a0e(e){return e>=55296&&e<56320}function vl(e,t){let n=e.charCodeAt(t);if(!a0e(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return o0e(r)?(n-55296<<10)+(r-56320)+65536:n}function l0e(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function ld(e){return e<65536?1:2}const yv=/\r\n?|\n/;var di=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(di||(di={}));class Yo{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 r=this.sections[n+1];t+=r<0?this.sections[n]:r}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,r=0,s=0;n<this.sections.length;){let i=this.sections[n++],o=this.sections[n++];o<0?(t(r,s,i),s+=i):s+=o,r+=i}}iterChangedRanges(t,n=!1){bv(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?t.push(r,s):t.push(s,r)}return new Yo(t)}composeDesc(t){return this.empty?t:t.empty?this:wL(this,t)}mapDesc(t,n=!1){return t.empty?this:xv(this,t,n)}mapPos(t,n=-1,r=di.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=s+a;if(l<0){if(c>t)return i+(t-s);i+=a}else{if(r!=di.Simple&&c>=t&&(r==di.TrackDel&&s<t&&c>t||r==di.TrackBefore&&s<t||r==di.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!a)return t==s||n<0?i:i+l;i+=l}s=c}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return i}touchesRange(t,n=t){for(let r=0,s=0;r<this.sections.length&&s<=n;){let i=this.sections[r++],o=this.sections[r++],a=s+i;if(o>=0&&s<=n&&a>=t)return s<t&&a>n?"cover":!0;s=a}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];t+=(t?" ":"")+r+(s>=0?":"+s:"")}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 Yo(t)}static create(t){return new Yo(t)}}class Lr extends Yo{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 bv(this,(n,r,s,i,o)=>t=t.replace(s,s+(r-n),o),!1),t}mapDesc(t,n=!1){return xv(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let s=0,i=0;s<n.length;s+=2){let o=n[s],a=n[s+1];if(a>=0){n[s]=a,n[s+1]=o;let l=s>>1;for(;r.length<l;)r.push(hn.empty);r.push(o?t.slice(i,i+o):hn.empty)}i+=o}return new Lr(n,r)}compose(t){return this.empty?t:t.empty?this:wL(this,t,!0)}map(t,n=!1){return t.empty?this:xv(this,t,n,!0)}iterChanges(t,n=!1){bv(this,t,n)}get desc(){return Yo.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new O0(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 u=Math.min(i.len,l-a);cs(s,u,-1);let d=i.ins==-1?-1:i.off==0?i.ins:0;cs(n,u,d),d>0&&Bl(r,n,i.text),i.forward(u),a+=u}let c=t[o++];for(;a<c;){if(i.done)break e;let u=Math.min(i.len,c-a);cs(n,u,-1),cs(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),a+=u}}return{changes:new Lr(n,r),filtered:Yo.create(s)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?t.push(r):s==0?t.push([r]):t.push([r].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,r){let s=[],i=[],o=0,a=null;function l(u=!1){if(!u&&!s.length)return;o<n&&cs(s,n-o,-1);let d=new Lr(s,i);a=a?a.compose(d.map(a)):d,s=[],i=[],o=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof Lr){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:d,to:f=d,insert:m}=u;if(d>f||d<0||f>n)throw new RangeError(`Invalid change range ${d} to ${f} (in doc of length ${n})`);let p=m?typeof m=="string"?hn.of(m.split(r||yv)):m:hn.empty,y=p.length;if(d==f&&y==0)return;d<o&&l(),d>o&&cs(s,d-o,-1),cs(s,f-d,y),Bl(i,s,p),o=f}}return c(t),l(!a),a}static empty(t){return new Lr(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<t.length;s++){let i=t[s];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(;r.length<s;)r.push(hn.empty);r[s]=hn.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new Lr(n,r)}static createSet(t,n){return new Lr(t,n)}}function cs(e,t,n,r=!1){if(t==0&&n<=0)return;let s=e.length-2;s>=0&&n<=0&&n==e[s+1]?e[s]+=t:s>=0&&t==0&&e[s]==0?e[s+1]+=n:r?(e[s]+=t,e[s+1]+=n):e.push(t,n)}function Bl(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(hn.empty);e.push(n)}}function bv(e,t,n){let r=e.inserted;for(let s=0,i=0,o=0;o<e.sections.length;){let a=e.sections[o++],l=e.sections[o++];if(l<0)s+=a,i+=a;else{let c=s,u=i,d=hn.empty;for(;c+=a,u+=l,l&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(s,c,i,u,d),s=c,i=u}}}function xv(e,t,n,r=!1){let s=[],i=r?[]:null,o=new O0(e),a=new O0(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);cs(s,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(cs(s,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(cs(s,0,o.ins),i&&Bl(i,s,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let d=Math.min(u,a.len);c+=d,u-=d,a.forward(d)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;cs(s,c,l<o.i?o.ins:0),i&&l<o.i&&Bl(i,s,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return i?Lr.createSet(s,i):Yo.create(s);throw new Error("Mismatched change set lengths")}}}function wL(e,t,n=!1){let r=[],s=n?[]:null,i=new O0(e),o=new O0(t);for(let a=!1;;){if(i.done&&o.done)return s?Lr.createSet(r,s):Yo.create(r);if(i.ins==0)cs(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)cs(r,0,o.ins,a),s&&Bl(s,r,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=r.length;if(i.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;cs(r,l,u,a),s&&u&&Bl(s,r,o.text)}else o.ins==-1?(cs(r,i.off?0:i.len,l,a),s&&Bl(s,r,i.textBit(l))):(cs(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&Bl(s,r,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),i.forward2(l),o.forward(l)}}}}class O0{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?hn.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?hn.empty:n[r].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 ou{constructor(t,n,r){this.from=t,this.to=n,this.flags=r}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 r,s;return this.empty?r=s=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new ou(r,s,this.flags)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Me.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Me.range(this.anchor,s,void 0,void 0,r)}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 Me.range(t.anchor,t.head)}static create(t,n,r){return new ou(t,n,r)}}class Me{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Me.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(t.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Me([this.main],0)}addRange(t,n=!0){return Me.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,Me.create(r,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 Me(t.ranges.map(n=>ou.fromJSON(n)),t.main)}static single(t,n=t){return new Me([Me.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 r=0,s=0;s<t.length;s++){let i=t[s];if(i.empty?i.from<=r:i.from<r)return Me.normalized(t.slice(),n);r=i.to}return new Me(t,n)}static cursor(t,n=0,r,s){return ou.create(t,t,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(s??16777215)<<6)}static range(t,n,r,s,i){let o=(r??16777215)<<6|(s==null?7:Math.min(6,s));return!i&&t!=n&&(i=n<t?1:-1),n<t?ou.create(n,t,48|o):ou.create(t,n,(i?i<0?8:16:0)|o)}static normalized(t,n=0){let r=t[n];t.sort((s,i)=>s.from-i.from),n=t.indexOf(r);for(let s=1;s<t.length;s++){let i=t[s],o=t[s-1];if(i.empty?i.from<=o.to:i.from<o.to){let a=o.from,l=Math.max(i.to,o.to);s<=n&&n--,t.splice(--s,2,i.anchor>i.head?Me.range(l,a):Me.range(a,l))}}return new Me(t,n)}}function vL(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let R_=0;class kt{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=R_++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new kt(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:j_),!!t.static,t.enables)}of(t){return new yg([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new yg(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new yg(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function j_(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class yg{constructor(t,n,r,s){this.dependencies=t,this.facet=n,this.type=r,this.value=s,this.id=R_++}dynamicSlot(t){var n;let r=this.value,s=this.facet.compareInput,i=this.id,o=t[i]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:((n=t[d.id])!==null&&n!==void 0?n:1)&1||u.push(t[d.id]);return{create(d){return d.values[o]=r(d),1},update(d,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||wv(d,u)){let m=r(d);if(a?!V9(m,d.values[o],s):!s(m,d.values[o]))return d.values[o]=m,1}return 0},reconfigure:(d,f)=>{let m,p=f.config.address[i];if(p!=null){let y=L1(f,p);if(this.dependencies.every(v=>v instanceof kt?f.facet(v)===d.facet(v):v instanceof ra?f.field(v,!1)==d.field(v,!1):!0)||(a?V9(m=r(d),y,s):s(m=r(d),y)))return d.values[o]=y,0}else m=r(d);return d.values[o]=m,1}}}}function V9(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function wv(e,t){let n=!1;for(let r of t)i0(e,r)&1&&(n=!0);return n}function c0e(e,t,n){let r=n.map(l=>e[l.id]),s=n.map(l=>l.type),i=r.filter(l=>!(l&1)),o=e[t.id]>>1;function a(l){let c=[];for(let u=0;u<r.length;u++){let d=L1(l,r[u]);if(s[u]==2)for(let f of d)c.push(f);else c.push(d)}return t.combine(c)}return{create(l){for(let c of r)i0(l,c);return l.values[o]=a(l),1},update(l,c){if(!wv(l,i))return 0;let u=a(l);return t.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=wv(l,r),d=c.config.facets[t.id],f=c.facet(t);if(d&&!u&&j_(n,d))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 wp=kt.define({static:!0});class ra{constructor(t,n,r,s,i){this.id=t,this.createF=n,this.updateF=r,this.compareF=s,this.spec=i,this.provides=void 0}static define(t){let n=new ra(R_++,t.create,t.update,t.compare||((r,s)=>r===s),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(wp).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],o=this.updateF(i,s);return this.compareF(i,o)?0:(r.values[n]=o,1)},reconfigure:(r,s)=>{let i=r.facet(wp),o=s.facet(wp),a;return(a=i.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,wp.of({field:this,create:t})]}get extension(){return this}}const eu={lowest:4,low:3,default:2,high:1,highest:0};function df(e){return t=>new _L(t,e)}const qu={highest:df(eu.highest),high:df(eu.high),default:df(eu.default),low:df(eu.low),lowest:df(eu.lowest)};class _L{constructor(t,n){this.inner=t,this.prec=n}}class Fu{of(t){return new vv(this,t)}reconfigure(t){return Fu.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class vv{constructor(t,n){this.compartment=t,this.inner=n}}class j1{constructor(t,n,r,s,i,o){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.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,r){let s=[],i=Object.create(null),o=new Map;for(let f of u0e(t,n,o))f instanceof ra?s.push(f):(i[f.facet.id]||(i[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of s)a[f.id]=c.length<<1,c.push(m=>f.slot(m));let u=r==null?void 0:r.config.facets;for(let f in i){let m=i[f],p=m[0].facet,y=u&&u[f]||[];if(m.every(v=>v.type==0))if(a[p.id]=l.length<<1|1,j_(y,m))l.push(r.facet(p));else{let v=p.combine(m.map(b=>b.value));l.push(r&&p.compare(v,r.facet(p))?r.facet(p):v)}else{for(let v of m)v.type==0?(a[v.id]=l.length<<1|1,l.push(v.value)):(a[v.id]=c.length<<1,c.push(b=>v.dynamicSlot(b)));a[p.id]=c.length<<1,c.push(v=>c0e(v,p,m))}}let d=c.map(f=>f(a));return new j1(t,o,d,a,l,i)}}function u0e(e,t,n){let r=[[],[],[],[],[]],s=new Map;function i(o,a){let l=s.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof vv&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof vv){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 _L)i(o.inner,o.prec);else if(o instanceof ra)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof yg)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,eu.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,eu.default),r.reduce((o,a)=>o.concat(a))}function i0(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let s=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|s}function L1(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const kL=kt.define(),_v=kt.define({combine:e=>e.some(t=>t),static:!0}),SL=kt.define({combine:e=>e.length?e[0]:void 0,static:!0}),TL=kt.define(),CL=kt.define(),AL=kt.define(),EL=kt.define({combine:e=>e.length?e[0]:!1});class nl{constructor(t,n){this.type=t,this.value=n}static define(){return new d0e}}class d0e{of(t){return new nl(this,t)}}class h0e{constructor(t){this.map=t}of(t){return new Nn(this,t)}}class Nn{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 Nn(this.type,n)}is(t){return this.type==t}static define(t={}){return new h0e(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let s of t){let i=s.map(n);i&&r.push(i)}return r}}Nn.reconfigure=Nn.define();Nn.appendConfig=Nn.define();class Or{constructor(t,n,r,s,i,o){this.startState=t,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=o,this._doc=null,this._state=null,r&&vL(r,n.newLength),i.some(a=>a.type==Or.time)||(this.annotations=i.concat(Or.time.of(Date.now())))}static create(t,n,r,s,i,o){return new Or(t,n,r,s,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=nl.define();Or.userEvent=nl.define();Or.addToHistory=nl.define();Or.remote=nl.define();function f0e(e,t){let n=[];for(let r=0,s=0;;){let i,o;if(r<e.length&&(s==t.length||t[s]>=e[r]))i=e[r++],o=e[r++];else if(s<t.length)i=t[s++],o=t[s++];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 ML(e,t,n){var r;let s,i,o;return n?(s=t.changes,i=Lr.empty(t.changes.length),o=e.changes.compose(t.changes)):(s=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(i):(r=e.selection)===null||r===void 0?void 0:r.map(s),effects:Nn.mapEffects(e.effects,s).concat(Nn.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function kv(e,t,n){let r=t.selection,s=Bd(t.annotations);return t.userEvent&&(s=s.concat(Or.userEvent.of(t.userEvent))),{changes:t.changes instanceof Lr?t.changes:Lr.of(t.changes||[],n,e.facet(SL)),selection:r&&(r instanceof Me?r:Me.single(r.anchor,r.head)),effects:Bd(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function NL(e,t,n){let r=kv(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;r=ML(r,kv(e,t[i],o?r.changes.newLength:e.doc.length),o)}let s=Or.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return p0e(n?m0e(s):s)}function m0e(e){let t=e.startState,n=!0;for(let s of t.facet(TL)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:f0e(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=Lr.empty(t.doc.length);else{let o=e.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Or.create(t,s,e.selection&&e.selection.map(i),Nn.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(CL);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof Or?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Or?e=i[0]:e=NL(t,Bd(i),!1)}return e}function p0e(e){let t=e.startState,n=t.facet(AL),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=ML(r,kv(t,i,e.changes.newLength),!0))}return r==e?e:Or.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const g0e=[];function Bd(e){return e==null?g0e:Array.isArray(e)?e:[e]}var La=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(La||(La={}));const y0e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Sv;try{Sv=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function b0e(e){if(Sv)return Sv.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||y0e.test(n)))return!0}return!1}function x0e(e){return t=>{if(!/\S/.test(t))return La.Space;if(b0e(t))return La.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return La.Word;return La.Other}}class kn{constructor(t,n,r,s,i,o){this.config=t,this.doc=n,this.selection=r,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=i,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)i0(this,a<<1);this.computeSlot=null}field(t,n=!0){let r=this.config.address[t.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return i0(this,r),L1(this,r)}update(...t){return NL(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let a of t.effects)a.is(Fu.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,c)=>s.set(c,l)),n=null),s.set(a.value.compartment,a.value.extension)):a.is(Nn.reconfigure)?(n=null,r=a.value):a.is(Nn.appendConfig)&&(n=null,r=Bd(r).concat(a.value));let i;n?i=t.startState.values.slice():(n=j1.resolve(r,s,this),i=new kn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=t.startState.facet(_v)?t.newSelection:t.newSelection.asSingle();new kn(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:Me.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),s=this.changes(r.changes),i=[r.range],o=Bd(r.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),c=this.changes(l.changes),u=c.map(s);for(let f=0;f<a;f++)i[f]=i[f].map(u);let d=s.mapDesc(c,!0);i.push(l.range.map(d)),s=s.compose(u),o=Nn.mapEffects(o,u).concat(Nn.mapEffects(Bd(l.effects),d))}return{changes:s,selection:Me.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Lr?t:Lr.of(t,this.doc.length,this.facet(kn.lineSeparator))}toText(t){return hn.of(t.split(this.facet(kn.lineSeparator)||yv))}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:(i0(this,n),L1(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let r in t){let s=t[r];s instanceof ra&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(t[r]),this))}return n}static fromJSON(t,n={},r){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(t,i)){let o=r[i],a=t[i];s.push(o.init(l=>o.spec.fromJSON(a,l)))}}return kn.create({doc:t.doc,selection:Me.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=j1.resolve(t.extensions||[],new Map),r=t.doc instanceof hn?t.doc:hn.of((t.doc||"").split(n.staticFacet(kn.lineSeparator)||yv)),s=t.selection?t.selection instanceof Me?t.selection:Me.single(t.selection.anchor,t.selection.head):Me.single(0);return vL(s,r.length),n.staticFacet(_v)||(s=s.asSingle()),new kn(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(kn.tabSize)}get lineBreak(){return this.facet(kn.lineSeparator)||`
`}get readOnly(){return this.facet(EL)}phrase(t,...n){for(let r of this.facet(kn.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),t}languageDataAt(t,n,r=-1){let s=[];for(let i of this.facet(kL))for(let o of i(this,n,r))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return x0e(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:s}=this.doc.lineAt(t),i=this.charCategorizer(t),o=t-r,a=t-r;for(;o>0;){let l=ms(n,o,!1);if(i(n.slice(l,o))!=La.Word)break;o=l}for(;a<s;){let l=ms(n,a);if(i(n.slice(a,l))!=La.Word)break;a=l}return o==a?null:Me.range(o+r,a+r)}}kn.allowMultipleSelections=_v;kn.tabSize=kt.define({combine:e=>e.length?e[0]:4});kn.lineSeparator=SL;kn.readOnly=EL;kn.phrases=kt.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(s=>e[s]==t[s])}});kn.languageData=kL;kn.changeFilter=TL;kn.transactionFilter=CL;kn.transactionExtender=AL;Fu.reconfigure=Nn.define();function Xy(e,t,n={}){let r={};for(let s of e)for(let i of Object.keys(s)){let o=s[i],a=r[i];if(a===void 0)r[i]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](a,o);else throw new Error("Config merge conflict for field "+i)}for(let s in t)r[s]===void 0&&(r[s]=t[s]);return r}class cc{eq(t){return this==t}range(t,n=t){return Tv.create(t,n,this)}}cc.prototype.startSide=cc.prototype.endSide=0;cc.prototype.point=!1;cc.prototype.mapMode=di.TrackDel;function L_(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let Tv=class IL{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new IL(t,n,r)}};function Cv(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class D_{constructor(t,n,r,s){this.from=t,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,n,r,s=0){let i=r?this.to:this.from;for(let o=s,a=i.length;;){if(o==a)return o;let l=o+a>>1,c=i[l]-t||(r?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,r,s){for(let i=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,i);i<o;i++)if(s(this.from[i]+t,this.to[i]+t,this.value[i])===!1)return!1}map(t,n){let r=[],s=[],i=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+t,d=this.to[l]+t,f,m;if(u==d){let p=n.mapPos(u,c.startSide,c.mapMode);if(p==null||(f=m=p,c.startSide!=c.endSide&&(m=n.mapPos(u,c.endSide),m<f)))continue}else if(f=n.mapPos(u,c.startSide),m=n.mapPos(d,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)),r.push(c),s.push(f-o),i.push(m-o))}return{mapped:r.length?new D_(s,i,r,a):null,pos:o}}}class Cn{constructor(t,n,r,s){this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(t,n,r,s){return new Cn(t,n,r,s)}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:r=!1,filterFrom:s=0,filterTo:i=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Cv)),this.isEmpty)return n.length?Cn.of(n):this;let a=new RL(this,null,-1).goto(0),l=0,c=[],u=new Au;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let d=n[l++];u.addInner(d.from,d.to,d.value)||c.push(d)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==n.length||this.chunkEnd(a.chunkIndex)<n[l].from)&&(!o||s>this.chunkEnd(a.chunkIndex)||i<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||s>a.to||i<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Tv.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Cn.empty:this.nextLayer.update({add:c,filter:o,filterFrom:s,filterTo:i}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],s=-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)s=Math.max(s,l.maxPoint),n.push(l),r.push(t.mapPos(a));else if(c===!0){let{mapped:u,pos:d}=l.map(a,t);u&&(s=Math.max(s,u.maxPoint),n.push(u),r.push(d))}}let i=this.nextLayer.map(t);return n.length==0?i:new Cn(r,n,i||Cn.empty,s)}between(t,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let i=this.chunkPos[s],o=this.chunk[s];if(n>=i&&t<=i+o.length&&o.between(i,t-i,n-i,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return B0.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return B0.from(t).goto(n)}static compare(t,n,r,s,i=-1){let o=t.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),a=n.filter(d=>d.maxPoint>0||!d.isEmpty&&d.maxPoint>=i),l=W9(o,a,r),c=new hf(o,l,i),u=new hf(a,l,i);r.iterGaps((d,f,m)=>G9(c,d,u,f,m,s)),r.empty&&r.length==0&&G9(c,0,u,0,0,s)}static eq(t,n,r=0,s){s==null&&(s=999999999);let i=t.filter(u=>!u.isEmpty&&n.indexOf(u)<0),o=n.filter(u=>!u.isEmpty&&t.indexOf(u)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=W9(i,o),l=new hf(i,a,0).goto(r),c=new hf(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Av(l.active,c.active)||l.point&&(!c.point||!L_(l.point,c.point)))return!1;if(l.to>s)return!0;l.next(),c.next()}}static spans(t,n,r,s,i=-1){let o=new hf(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),d=o.pointFrom<n?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,l);s.point(a,c,o.point,u,d,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(s.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(t,n=!1){let r=new Au;for(let s of t instanceof Tv?[t]:n?w0e(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return Cn.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=Cn.empty;s=s.nextLayer)n=new Cn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}Cn.empty=new Cn([],[],null,-1);function w0e(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Cv(t,r)>0)return e.slice().sort(Cv);t=r}return e}Cn.empty.nextLayer=Cn.empty;class Au{finishChunk(t){this.chunks.push(new D_(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,r){this.addInner(t,n,r)||(this.nextLayer||(this.nextLayer=new Au)).add(t,n,r)}addInner(t,n,r){let s=t-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<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=r,this.lastFrom=t,this.lastTo=n,this.value.push(r),r.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 r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+t,this.lastTo=n.to[r]+t,!0}finish(){return this.finishInner(Cn.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Cn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function W9(e,t,n){let r=new Map;for(let i of e)for(let o=0;o<i.chunk.length;o++)i.chunk[o].maxPoint<=0&&r.set(i.chunk[o],i.chunkPos[o]);let s=new Set;for(let i of t)for(let o=0;o<i.chunk.length;o++){let a=r.get(i.chunk[o]);a!=null&&(n?n.mapPos(a):a)==i.chunkPos[o]&&!(n!=null&&n.touchesRange(a,a+i.chunk[o].length))&&s.add(i.chunk[o])}return s}class RL{constructor(t,n,r,s=0){this.layer=t,this.skip=n,this.minPoint=r,this.rank=s}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,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<t||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}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],r=t+n.from[this.rangeIndex];if(this.from=r,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 B0{constructor(t){this.heap=t}static from(t,n=null,r=-1){let s=[];for(let i=0;i<t.length;i++)for(let o=t[i];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&s.push(new RL(o,n,r,i));return s.length==1?s[0]:new B0(s)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let r of this.heap)r.goto(t,n);for(let r=this.heap.length>>1;r>=0;r--)E4(this.heap,r);return this.next(),this}forward(t,n){for(let r of this.heap)r.forward(t,n);for(let r=this.heap.length>>1;r>=0;r--)E4(this.heap,r);(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(),E4(this.heap,0)}}}function E4(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let s=e[r];if(r+1<e.length&&s.compare(e[r+1])>=0&&(s=e[r+1],r++),n.compare(s)<0)break;e[r]=n,e[t]=s,t=r}}class hf{constructor(t,n,r){this.minPoint=r,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=B0.from(t,n,r)}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){vp(this.active,t),vp(this.activeTo,t),vp(this.activeRank,t),this.minActive=K9(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n<this.activeRank.length&&(i-this.activeRank[n]||s-this.activeTo[n])>0;)n++;_p(this.active,n,r),_p(this.activeTo,n,s),_p(this.activeRank,n,i),t&&_p(t,n,this.cursor.from),this.minActive=K9(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&vp(r,s)}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(r),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(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<t;s--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(t){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)n++;return n}}function G9(e,t,n,r,s,i){e.goto(t),n.goto(r);let o=r+s,a=r,l=r-t,c=!!i.boundChange;for(let u=!1;;){let d=e.to+l-n.to,f=d||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&&L_(e.point,n.point)&&Av(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,p,e.point,n.point),u=!1):(u&&i.boundChange(a),p>a&&!Av(e.active,n.active)&&i.compareRange(a,p,e.active,n.active),c&&p<o&&(d||e.openEnd(m)!=n.openEnd(m))&&(u=!0)),m>o)break;a=m,f<=0&&e.next(),f>=0&&n.next()}}function Av(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!L_(e[n],t[n]))return!1;return!0}function vp(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function _p(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function K9(e,t){let n=-1,r=1e9;for(let s=0;s<t.length;s++)(t[s]-r||e[s].endSide-e[n].endSide)<0&&(n=s,r=t[s]);return n}function xm(e,t,n=e.length){let r=0;for(let s=0;s<n&&s<e.length;)e.charCodeAt(s)==9?(r+=t-r%t,s++):(r++,s=ms(e,s));return r}function v0e(e,t,n,r){for(let s=0,i=0;;){if(i>=t)return s;if(s==e.length)break;i+=e.charCodeAt(s)==9?n-i%n:1,s=ms(e,s)}return e.length}const Ev="ͼ",Y9=typeof Symbol>"u"?"__"+Ev:Symbol.for(Ev),Mv=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),X9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class uc{constructor(t,n){this.rules=[];let{finish:r}=n||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,c){let u=[],d=/^@(\w+)\b/.exec(o[0]),f=d&&d[1]=="keyframes";if(d&&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(v=>y.replace(/&/,v))).reduce((y,v)=>y.concat(v)),p,l);else if(p&&typeof p=="object"){if(!d)throw new RangeError("The value of a property ("+m+") should be a primitive value.");i(s(m),p,u,f)}else p!=null&&u.push(m.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+p+";")}(u.length||f)&&l.push((r&&!d&&!c?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in t)i(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=X9[Y9]||1;return X9[Y9]=t+1,Ev+t.toString(36)}static mount(t,n,r){let s=t[Mv],i=r&&r.nonce;s?i&&s.setNonce(i):s=new _0e(t,i),s.mount(Array.isArray(n)?n:[n],t)}}let Q9=new Map;class _0e{constructor(t,n){let r=t.ownerDocument||t,s=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let i=Q9.get(r);if(i)return t[Mv]=i;this.sheet=new s.CSSStyleSheet,Q9.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[Mv]=this}mount(t,n){let r=this.sheet,s=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),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],s++)}else{for(;i<l;)s+=this.modules[i++].rules.length;s+=a.rules.length,i++}}if(r)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 dc={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:"'"},$0={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},k0e=typeof navigator<"u"&&/Mac/.test(navigator.platform),S0e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var es=0;es<10;es++)dc[48+es]=dc[96+es]=String(es);for(var es=1;es<=24;es++)dc[es+111]="F"+es;for(var es=65;es<=90;es++)dc[es]=String.fromCharCode(es+32),$0[es]=String.fromCharCode(es);for(var M4 in dc)$0.hasOwnProperty(M4)||($0[M4]=dc[M4]);function T0e(e){var t=k0e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||S0e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?$0:dc)[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 Cs=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Nv=typeof document<"u"?document:{documentElement:{style:{}}};const Iv=/Edge\/(\d+)/.exec(Cs.userAgent),jL=/MSIE \d/.test(Cs.userAgent),Rv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Cs.userAgent),Qy=!!(jL||Rv||Iv),J9=!Qy&&/gecko\/(\d+)/i.test(Cs.userAgent),N4=!Qy&&/Chrome\/(\d+)/.exec(Cs.userAgent),Z9="webkitFontSmoothing"in Nv.documentElement.style,jv=!Qy&&/Apple Computer/.test(Cs.vendor),eT=jv&&(/Mobile\/\w+/.test(Cs.userAgent)||Cs.maxTouchPoints>2);var Qe={mac:eT||/Mac/.test(Cs.platform),windows:/Win/.test(Cs.platform),linux:/Linux|X11/.test(Cs.platform),ie:Qy,ie_version:jL?Nv.documentMode||6:Rv?+Rv[1]:Iv?+Iv[1]:0,gecko:J9,gecko_version:J9?+(/Firefox\/(\d+)/.exec(Cs.userAgent)||[0,0])[1]:0,chrome:!!N4,chrome_version:N4?+N4[1]:0,ios:eT,android:/Android\b/.test(Cs.userAgent),webkit:Z9,webkit_version:Z9?+(/\bAppleWebKit\/(\d+)/.exec(Cs.userAgent)||[0,0])[1]:0,safari:jv,safari_version:jv?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Cs.userAgent)||[0,0])[1]:0,tabSize:Nv.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function O_(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 D1=Object.create(null);function B_(e,t,n){if(e==t)return!0;e||(e=D1),t||(t=D1);let r=Object.keys(e),s=Object.keys(t);if(r.length-0!=s.length-0)return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||e[i]!==t[i]))return!1;return!0}function C0e(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]==null&&e.removeAttribute(r)}for(let n in t){let r=t[n];n=="style"?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function tT(e,t,n){let r=!1;if(t)for(let s in t)n&&s in n||(r=!0,s=="style"?e.style.cssText="":e.removeAttribute(s));if(n)for(let s in n)t&&t[s]==n[s]||(r=!0,s=="style"?e.style.cssText=n[s]:e.setAttribute(s,n[s]));return r}function A0e(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}class sa{eq(t){return!1}updateDOM(t,n,r){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,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var Rs=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Rs||(Rs={}));class nn extends cc{constructor(t,n,r,s){super(),this.startSide=t,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(t){return new wm(t)}static widget(t){let n=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return n+=r&&!t.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Eu(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,s;if(t.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:o}=LL(t,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new Eu(t,r,s,n,t.widget||null,!0)}static line(t){return new vm(t)}static set(t,n=!1){return Cn.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}nn.none=Cn.empty;class wm extends nn{constructor(t){let{start:n,end:r}=LL(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?O_(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||D1}eq(t){return this==t||t instanceof wm&&this.tagName==t.tagName&&B_(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)}}wm.prototype.point=!1;class vm extends nn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof vm&&this.spec.class==t.spec.class&&B_(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)}}vm.prototype.mapMode=di.TrackBefore;vm.prototype.point=!0;class Eu extends nn{constructor(t,n,r,s,i,o){super(n,r,i,t),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?di.TrackBefore:di.TrackAfter:di.TrackDel}get type(){return this.startSide!=this.endSide?Rs.WidgetRange:this.startSide<=0?Rs.WidgetBefore:Rs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Eu&&E0e(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)}}Eu.prototype.point=!0;function LL(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function E0e(e,t){return e==t||!!(e&&t&&e.compare(t))}function $d(e,t,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=e?n[s]=Math.max(n[s],t):n.push(e,t)}class z0 extends cc{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof z0&&this.tagName==t.tagName&&B_(this.attributes,t.attributes)}static create(t){return new z0(t.tagName,t.attributes||D1,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Cn.of(t,n)}}z0.prototype.startSide=z0.prototype.endSide=-1;function P0(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function Lv(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function o0(e,t){if(!t.anchorNode)return!1;try{return Lv(e,t.anchorNode)}catch{return!1}}function a0(e){return e.nodeType==3?F0(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function l0(e,t,n,r){return n?nT(e,t,n,r,-1)||nT(e,t,n,r,1):!1}function hc(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function O1(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function nT(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:Ya(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=hc(e)+(s<0?0:1),e=i}else if(e.nodeType==1){if(e=e.childNodes[t+(s<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=s<0?Ya(e):0}else return!1}}function Ya(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function q0(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function M0e(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 DL(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function N0e(e,t,n,r,s,i,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let u=e,d=!1;u&&!d;)if(u.nodeType==1){let f,m=u==l.body,p=1,y=1;if(m)f=M0e(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let x=u.getBoundingClientRect();({scaleX:p,scaleY:y}=DL(u,x)),f={left:x.left,right:x.left+u.clientWidth*p,top:x.top,bottom:x.top+u.clientHeight*y}}let v=0,b=0;if(s=="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 x=t.bottom-t.top,w=f.bottom-f.top;b=(s=="center"&&x<=w?t.top+x/2-w/2:s=="start"||s=="center"&&n<0?t.top-o:t.bottom-w+o)-f.top}if(r=="nearest"?t.left<f.left+i?(v=t.left-(f.left+i),n>0&&t.right>f.right+v&&(v=t.right-f.right+i)):t.right>f.right-i&&(v=t.right-f.right+i,n<0&&t.left<f.left+v&&(v=t.left-(f.left+i))):v=(r=="center"?t.left+(t.right-t.left)/2-(f.right-f.left)/2:r=="start"==a?t.left-i:t.right-(f.right-f.left)+i)-f.left,v||b)if(m)c.scrollBy(v,b);else{let x=0,w=0;if(b){let k=u.scrollTop;u.scrollTop+=b/y,w=(u.scrollTop-k)*y}if(v){let k=u.scrollLeft;u.scrollLeft+=v/p,x=(u.scrollLeft-k)*p}t={left:t.left-x,top:t.top-w,right:t.right-x,bottom:t.bottom-w},x&&Math.abs(x-v)<1&&(r="nearest"),w&&Math.abs(w-b)<1&&(s="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)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function OL(e,t=!0){let n=e.ownerDocument,r=null,s=null;for(let i=e.parentNode;i&&!(i==n.body||(!t||r)&&s);)if(i.nodeType==1)!s&&i.scrollHeight>i.clientHeight&&(s=i),t&&!r&&i.scrollWidth>i.clientWidth&&(r=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:r,y:s}}class I0e{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:r}=t;this.set(n,Math.min(t.anchorOffset,n?Ya(n):0),r,Math.min(t.focusOffset,r?Ya(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Kc=null;Qe.safari&&Qe.safari_version>=26&&(Kc=!1);function BL(e){if(e.setActive)return e.setActive();if(Kc)return e.focus(Kc);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Kc==null?{get preventScroll(){return Kc={preventScroll:!0},!0}}:void 0),!Kc){Kc=!1;for(let n=0;n<t.length;){let r=t[n++],s=t[n++],i=t[n++];r.scrollTop!=s&&(r.scrollTop=s),r.scrollLeft!=i&&(r.scrollLeft=i)}}}let rT;function F0(e,t,n=t){let r=rT||(rT=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function zd(e,t,n,r){let s={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let i=new KeyboardEvent("keydown",s);i.synthetic=!0,e.dispatchEvent(i);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,e.dispatchEvent(o),i.defaultPrevented||o.defaultPrevented}function R0e(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function j0e(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,Ya(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=Ya(n))}else{if(n==e)return!0;r=hc(n),n=n.parentNode}}function $L(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 zL(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=Ya(n)}else if(n.parentNode&&!O1(n))r=hc(n),n=n.parentNode;else return null}}function PL(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!O1(n))r=hc(n)+1,n=n.parentNode;else return null}}class ho{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new ho(t.parentNode,hc(t),n)}static after(t,n){return new ho(t.parentNode,hc(t)+1,n)}}var Gn=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Gn||(Gn={}));const Mu=Gn.LTR,$_=Gn.RTL;function qL(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const L0e=qL("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),D0e=qL("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Dv=Object.create(null),Eo=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Dv[t]=n,Dv[n]=-t}function FL(e){return e<=247?L0e[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?D0e[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const O0e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Ho{get dir(){return this.level%2?$_:Mu}constructor(t,n,r){this.from=t,this.to=n,this.level=r}side(t,n){return this.dir==n==t?this.to:this.from}forward(t,n){return t==(this.dir==n)}static find(t,n,r,s){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==r)return o;(i<0||(s!=0?s<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 UL(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],s=t[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!UL(r.inner,s.inner))return!1}return!0}const Ln=[];function B0e(e,t,n,r,s){for(let i=0;i<=r.length;i++){let o=i?r[i-1].to:t,a=i<r.length?r[i].from:n,l=i?256:s;for(let c=o,u=l,d=l;c<a;c++){let f=FL(e.charCodeAt(c));f==512?f=u:f==8&&d==4&&(f=16),Ln[c]=f==4?2:f,f&7&&(d=f),u=f}for(let c=o,u=l,d=l;c<a;c++){let f=Ln[c];if(f==128)c<a-1&&u==Ln[c+1]&&u&24?f=Ln[c]=u:Ln[c]=256;else if(f==64){let m=c+1;for(;m<a&&Ln[m]==64;)m++;let p=c&&u==8||m<n&&Ln[m]==8?d==1?1:8:256;for(let y=c;y<m;y++)Ln[y]=p;c=m-1}else f==8&&d==1&&(Ln[c]=1);u=f,f&7&&(d=f)}}}function $0e(e,t,n,r,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let d=c,f,m,p;d<u;d++)if(m=Dv[f=e.charCodeAt(d)])if(m<0){for(let y=a-3;y>=0;y-=3)if(Eo[y+1]==-m){let v=Eo[y+2],b=v&2?s:v&4?v&1?i:s:0;b&&(Ln[d]=Ln[Eo[y]]=b),a=y;break}}else{if(Eo.length==189)break;Eo[a++]=d,Eo[a++]=f,Eo[a++]=l}else if((p=Ln[d])==2||p==1){let y=p==s;l=y?0:1;for(let v=a-3;v>=0;v-=3){let b=Eo[v+2];if(b&2)break;if(y)Eo[v+2]|=2;else{if(b&4)break;Eo[v+2]|=4}}}}}function z0e(e,t,n,r){for(let s=0,i=r;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:t;for(let l=o;l<a;){let c=Ln[l];if(c==256){let u=l+1;for(;;)if(u==a){if(s==n.length)break;u=n[s++].to,a=s<n.length?n[s].from:t}else if(Ln[u]==256)u++;else break;let d=i==1,f=(u<t?Ln[u]:r)==1,m=d==f?d?1:2:r;for(let p=u,y=s,v=y?n[y-1].to:e;p>l;)p==v&&(p=n[--y].from,v=y?n[y-1].to:e),Ln[--p]=m;l=u}else i=c,l++}}}function Ov(e,t,n,r,s,i,o){let a=r%2?2:1;if(r%2==s%2)for(let l=t,c=0;l<n;){let u=!0,d=!1;if(c==i.length||l<i[c].from){let y=Ln[l];y!=a&&(u=!1,d=y==16)}let f=!u&&a==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c<i.length&&p==i[c].from){if(d)break e;let y=i[c];if(!u)for(let v=y.to,b=c+1;;){if(v==n)break e;if(b<i.length&&i[b].from==v)v=i[b++].to;else{if(Ln[v]==a)break e;break}}if(c++,f)f.push(y);else{y.from>l&&o.push(new Ho(l,y.from,m));let v=y.direction==Mu!=!(m%2);Bv(e,v?r+1:r,s,y.inner,y.from,y.to,o),l=y.to}p=y.to}else{if(p==n||(u?Ln[p]!=a:Ln[p]==a))break;p++}f?Ov(e,l,p,r+1,s,f,o):l<p&&o.push(new Ho(l,p,m)),l=p}else for(let l=n,c=i.length;l>t;){let u=!0,d=!1;if(!c||l>i[c-1].to){let y=Ln[l-1];y!=a&&(u=!1,d=y==16)}let f=!u&&a==1?[]:null,m=u?r:r+1,p=l;e:for(;;)if(c&&p==i[c-1].to){if(d)break e;let y=i[--c];if(!u)for(let v=y.from,b=c;;){if(v==t)break e;if(b&&i[b-1].to==v)v=i[--b].from;else{if(Ln[v-1]==a)break e;break}}if(f)f.push(y);else{y.to<l&&o.push(new Ho(y.to,l,m));let v=y.direction==Mu!=!(m%2);Bv(e,v?r+1:r,s,y.inner,y.from,y.to,o),l=y.from}p=y.from}else{if(p==t||(u?Ln[p-1]!=a:Ln[p-1]==a))break;p--}f?Ov(e,p,l,r+1,s,f,o):p<l&&o.push(new Ho(p,l,m)),l=p}}function Bv(e,t,n,r,s,i,o){let a=t%2?2:1;B0e(e,s,i,r,a),$0e(e,s,i,r,a),z0e(s,i,r,a),Ov(e,s,i,t,n,r,o)}function P0e(e,t,n){if(!e)return[new Ho(0,0,t==$_?1:0)];if(t==Mu&&!n.length&&!O0e.test(e))return HL(e.length);if(n.length)for(;e.length>Ln.length;)Ln[Ln.length]=256;let r=[],s=t==Mu?0:1;return Bv(e,s,s,n,0,e.length,r),r}function HL(e){return[new Ho(0,e,0)]}let VL="";function q0e(e,t,n,r,s){var i;let o=r.head-e.from,a=Ho.find(t,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),l=t[a],c=l.side(s,n);if(o==c){let f=a+=s?1:-1;if(f<0||f>=t.length)return null;l=t[a=f],o=l.side(!s,n),c=l.side(s,n)}let u=ms(e.text,o,l.forward(s,n));(u<l.from||u>l.to)&&(u=c),VL=e.text.slice(Math.min(o,u),Math.max(o,u));let d=a==(s?t.length-1:0)?null:t[a+(s?1:-1)];return d&&u==c&&d.level+(s?0:1)<l.level?Me.cursor(d.side(!s,n)+e.from,d.forward(s,n)?1:-1,d.level):Me.cursor(u+e.from,l.forward(s,n)?-1:1,l.level)}function F0e(e,t,n){for(let r=t;r<n;r++){let s=FL(e.charCodeAt(r));if(s==1)return Mu;if(s==2||s==4)return $_}return Mu}const WL=kt.define(),GL=kt.define(),KL=kt.define(),YL=kt.define(),$v=kt.define(),XL=kt.define(),QL=kt.define(),z_=kt.define(),P_=kt.define(),JL=kt.define({combine:e=>e.some(t=>t)}),ZL=kt.define({combine:e=>e.some(t=>t)}),eD=kt.define();class Pd{constructor(t,n,r,s,i,o=!1){this.range=t,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=o}map(t){return t.empty?this:new Pd(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 Pd(Me.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const kp=Nn.define({map:(e,t)=>e.map(t)}),tD=Nn.define();function fi(e,t,n){let r=e.facet(YL);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Aa=kt.define({combine:e=>e.length?e[0]:!0});let U0e=0;const Sd=kt.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}});class Qs{constructor(t,n,r,s,i){this.id=t,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(Sd.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(Sd.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new Qs(U0e++,t,r,s,a=>{let l=[];return o&&l.push(Jy.of(c=>{let u=c.plugin(a);return u?o(u):nn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return Qs.define((r,s)=>new t(r,s),n)}}class I4{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(r){if(fi(n.state,r,"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){fi(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(r){fi(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const nD=kt.define(),q_=kt.define(),Jy=kt.define(),rD=kt.define(),F_=kt.define(),_m=kt.define(),sD=kt.define();function sT(e,t){let n=e.state.facet(sD);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return Cn.spans(r,t.from,t.to,{point(){},span(i,o,a,l){let c=i-t.from,u=o-t.from,d=s;for(let f=a.length-1;f>=0;f--,l--){let m=a[f].spec.bidiIsolate,p;if(m==null&&(m=F0e(t.text,c,u)),l>0&&d.length&&(p=d[d.length-1]).to==c&&p.direction==m)p.to=u,d=p.inner;else{let y={from:c,to:u,direction:m,inner:[]};d.push(y),d=y.inner}}}}),s}const iD=kt.define();function U_(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(iD)){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&&(r=Math.max(r,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:t,right:n,top:r,bottom:s}}const Ef=kt.define();class Hi{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new Hi(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,r=this;for(;n>0;n--){let s=t[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),t.splice(n-1,1)}}return t.splice(n,0,r),t}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let s=0,i=0,o=0;;){let a=s<t.length?t[s].fromB:1e9,l=i<n.length?n[i]:1e9,c=Math.min(a,l);if(c==1e9)break;let u=c+o,d=c,f=u;for(;;)if(i<n.length&&n[i]<=d){let m=n[i+1];i+=2,d=Math.max(d,m);for(let p=s;p<t.length&&t[p].fromB<=d;p++)o=t[p].toA-t[p].toB;f=Math.max(f,m+o)}else if(s<t.length&&t[s].fromB<=d){let m=t[s++];d=Math.max(d,m.toB),f=Math.max(f,m.toA),o=m.toA-m.toB}else break;r.push(new Hi(u,f,c,d))}return r}}class B1{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=Lr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,o,a,l)=>s.push(new Hi(i,o,a,l))),this.changedRanges=s}static create(t,n,r){return new B1(t,n,r)}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 H0e=[];class hr{constructor(t,n,r=0){this.dom=t,this.length=n,this.flags=r,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return H0e}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&&C0e(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 r=n;for(let s of this.children){if(s==t)return r;r+=s.length+s.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 r=hc(this.dom),s=this.length?t>0:n>0;return new ho(this.parent.dom,r+(s?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 eb)return t;return null}static get(t){return t.cmTile}}class Zy extends hr{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,r=null,s,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,s=r?r.nextSibling:n.firstChild,i&&s!=a.dom&&(i.written=!0),a.dom.parentNode==n)for(;s&&s!=a.dom;)s=iT(s);else n.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=iT(s);this.length=o}}function iT(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class eb extends Zy{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=hr.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],r=this,s=0,i=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&i++,s=n.pop()}else{let o=r.children[s++];if(o instanceof Pa)n.push(s),r=o,s=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 r,s=-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&&(r=void 0)}(l<t||t==c&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=t-l),(c>t||t==l&&(n>1?a.length:a.covers(-1)))&&(!i||!a.isWidget()&&i.isWidget())&&(i=a,o=t-l)}}),!r&&!i)throw new Error("No tile at position "+t);return r&&n<0||!i?{tile:r,offset:s}:{tile:i,offset:o}}}class Pa extends Zy{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 r=new Pa(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class lh extends Zy{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new lh(n||document.createElement("div"),t);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(t,n,r){let s=null,i=-1,o=null,a=-1;function l(u,d){for(let f=0,m=0;f<u.children.length&&m<=d;f++){let p=u.children[f],y=m+p.length;y>=d&&(p.isComposite()?l(p,d-m):(!o||o.isHidden&&(n>0||r&&W0e(o,p)))&&(y>d||p.flags&32)?(o=p,a=d-m):(m<d||p.flags&16&&!p.isHidden)&&(s=p,i=d-m)),m=y}}l(this,t);let c=(n<0?s:o)||s||o;return c?{tile:c,offset:c==s?i:a}:null}coordsIn(t,n){let r=this.resolveInline(t,n,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),n):V0e(this)}domIn(t,n){let r=this.resolveInline(t,n);if(r){let{tile:s,offset:i}=r;if(this.dom.contains(s.dom))return s.isText()?new ho(s.dom,Math.min(s.dom.nodeValue.length,i)):s.domPosFor(i,s.flags&16?1:s.flags&32?-1:n);let o=r.tile.parent,a=!1;for(let l of o.children){if(a)return new ho(l.dom,0);l==r.tile&&(a=!0)}}return new ho(this.dom,0)}}function V0e(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=a0(t);return n[n.length-1]||null}function W0e(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class Ws extends Zy{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new Ws(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class au extends hr{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 r=this.dom.nodeValue.length;t>r&&(t=r);let s=t,i=t,o=0;t==0&&n<0||t==r&&n>=0?Qe.chrome||Qe.gecko||(t?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let a=F0(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return Qe.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?q0(l,o<0):l||null}static of(t,n){let r=new au(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Nu extends hr{constructor(t,n,r,s){super(t,n,s),this.widget=r}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,r){let s=this.widget.coordsAt(this.dom,t,n);if(s)return s;if(r)return q0(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 q0(o,!a)}}get overrideDOMText(){if(!this.length)return hn.empty;let{root:t}=this;if(!t)return hn.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,r,s,i){return i||(i=t.toDOM(n),t.editable||(i.contentEditable="false")),new Nu(i,r,t,s)}}class $1 extends hr{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 hn.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class G0e{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:s,index:i,beforeBreak:o,parents:a}=this;for(;t||n>0;)if(s.isComposite())if(o){if(!t)break;r&&r.break(),t--,o=!1}else if(i==s.children.length){if(!t&&!a.length)break;r&&r.leave(s),o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++}else{let l=s.children[i],c=l.breakAfter;(n>0?l.length<=t:l.length<t)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!c,i++,t-=l.length):(a.push({tile:s,index:i}),s=l,i=0,r&&l.isComposite()&&r.enter(l))}else if(i==s.length)o=!!s.breakAfter,{tile:s,index:i}=a.pop(),i++;else if(t){let l=Math.min(t,s.length-i);r&&r.skip(s,i,i+l),t-=l,i+=l}else break;return this.tile=s,this.index=i,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class K0e{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class Y0e{constructor(t,n,r){this.cache=t,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(t,n,r,s){var i;this.flushBuffer();let o=this.ensureMarks(n,r),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 au(a.dom,a.text+t);l.parent=o}else o.append(s||au.of(t,(i=this.cache.find(au))===null||i===void 0?void 0:i.dom));this.pos+=t.length,this.afterWidget=null}addComposition(t,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?R4(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let a=n.marks.length-1;a>=0;a--){let l=n.marks[a],c=s.lastChild;if(c instanceof Ws&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(R4(l.dom)),s=c;else{if(this.cache.reused.get(l)){let d=hr.get(l.dom);d&&d.setDOM(R4(l.dom))}let u=Ws.of(l.mark,l.dom);s.append(u),s=u}this.cache.reused.set(l,2)}let i=hr.get(t.text);i&&this.cache.reused.set(i,2);let o=new au(t.text,t.text.nodeValue);o.flags|=8,this.pos=t.range.toB,s.append(o)}addInlineWidget(t,n,r){let s=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);s||this.flushBuffer();let i=this.ensureMarks(n,r);!s&&!(t.flags&16)&&i.append(this.getBuffer(1)),i.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,r){this.flushBuffer(),this.ensureMarks(n,r).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 r;t||(t=oD);let s=lh.start(t,n||((r=this.cache.find(lh))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}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 r;let s=this.curLine;for(let i=t.length-1;i>=0;i--){let o=t[i],a;if(n>0&&(a=s.lastChild)&&a instanceof Ws&&a.mark.eq(o))s=a,n--;else{let l=Ws.of(o,(r=this.cache.find(Ws,c=>c.mark.eq(o)))===null||r===void 0?void 0:r.dom);s.append(l),s=l,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!oT(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Qe.ios&&oT(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(j4,0,32)||new Nu(j4.toDOM(),0,j4,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,r=new K0e(t.from,t.to,t.value,n),s=this.wrappers.length;for(;s>0&&(this.wrappers[s-1].rank-r.rank||this.wrappers[s-1].to-r.to)<0;)s--;this.wrappers.splice(s,0,r)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof Pa&&s.wrapper.eq(r.wrapper))n=s;else{let i=Pa.of(r.wrapper,(t=this.cache.find(Pa,o=>o.wrapper.eq(r.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),r=this.cache.find($1,void 0,1);return r&&(r.flags=n),r||new $1(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class X0e{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:s,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=s;let a=this.textOff=Math.min(t,s.length);return i?null:s.slice(0,a)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const z1=[Nu,lh,au,Ws,$1,Pa,eb];for(let e=0;e<z1.length;e++)z1[e].bucket=e;class Q0e{constructor(t){this.view=t,this.buckets=z1.map(()=>[]),this.index=z1.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,r=this.buckets[n];r.length<6?r.push(t):r[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,r=2){let s=t.bucket,i=this.buckets[s],o=this.index[s];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[s]--,this.reused.set(c,r),c}return null}findWidget(t,n,r){let s=this.buckets[0];if(s.length)for(let i=0,o=0;;i++){if(i==s.length){if(o)return null;o=1,i=0}let a=s[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 s.splice(i,1),i<this.index[0]&&this.index[0]--,a.widget==t&&a.length==n&&(a.flags&497)==r?(this.reused.set(a,1),a):(this.reused.set(a,2),new Nu(a.dom,n,t,a.flags&-498|r))}}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 J0e{constructor(t,n,r,s,i){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new Q0e(t),this.text=new X0e(t.state.doc),this.builder=new Y0e(this.cache,new eb(t,t.contentDOM),Cn.iter(r)),this.cache.reused.set(n,2),this.old=new G0e(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 r=n&&this.getCompositionContext(n.text);for(let s=0,i=0,o=0;;){let a=o<t.length?t[o++]:null,l=a?a.fromA:this.old.root.length;if(l>s){let c=l-s;this.preserve(c,!o,!a),s=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,r),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,s=a.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(t,n,r){let s=tme(this.old),i=this.openMarks;this.old.advance(t,r?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?Nu.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,s,i),i=s.length)}else if(o.isText())this.builder.ensureLine(null),!a&&l==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,i,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(a,l),s,i)),i=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof $1)this.cache.add(o);else if(o instanceof Ws)this.builder.ensureLine(null),this.builder.addMark(o,s,i),this.cache.reused.set(o,1),i=s.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 Ws&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof Ws&&(s.shift(),i=Math.min(i,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let r=null,s=this.builder,i=0,o=Cn.spans(this.decorations,t,n,{point:(a,l,c,u,d,f)=>{if(c instanceof Eu){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=u.length,d>u.length)s.continueWidget(l-a);else{let m=c.widget||(c.block?ch.block:ch.inline),p=Z0e(c),y=this.cache.findWidget(m,l-a,p)||Nu.of(m,this.view,l-a,p);c.block?(c.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(y)):(s.ensureLine(r),s.addInlineWidget(y,u,d))}r=null}else r=eme(r,c);l>a&&this.text.skip(l-a)},span:(a,l,c,u)=>{for(let d=a;d<l;){let f=this.text.next(Math.min(512,l-d));f==null?(s.addLineStartIfNotCovered(r),s.addBreak(),d++):(s.ensureLine(r),s.addText(f,c,d==a?u:c.length),d+=f.length),r=null}}});s.addLineStartIfNotCovered(r),this.openWidget=o>i,this.openMarks=o}forward(t,n,r=1){n-t<=10?this.old.advance(n-t,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(t){let n=[],r=null;for(let s=t.parentNode;;s=s.parentNode){let i=hr.get(s);if(s==this.view.contentDOM)break;i instanceof Ws?n.push(i):i!=null&&i.isLine()?r=i:i instanceof Pa||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new lh(s,oD):r||n.push(Ws.of(new wm({tagName:s.nodeName.toLowerCase(),attributes:A0e(s)}),s)))}return{line:r,marks:n}}}function oT(e,t){let n=r=>{for(let s of r.children)if((t?s.isText():s.length)||n(s))return!0;return!1};return n(e)}function Z0e(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 oD={class:"cm-line"};function eme(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&O_(n,e),r&&(e.class+=" "+r)),e}function tme(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Ws&&t.push(r.mark)}return t}function R4(e){let t=hr.get(e);return t&&t.setDOM(e.cloneNode()),e}class ch extends sa{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}}ch.inline=new ch("span");ch.block=new ch("div");const j4=new class extends sa{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class aT{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=nn.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 eb(t,t.contentDOM),this.updateInner([new Hi(0,0,0,t.state.doc.length)],null)}update(t){var n;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:d})=>d<this.minWidthFrom||u>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 s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!ume(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let i=s>-1?rme(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:d}=this.hasComposition;r=new Hi(u,d,t.changes.mapPos(u,-1),t.changes.mapPos(d,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Qe.ie||Qe.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=ome(o,this.decorations,t.changes);l.length&&(r=Hi.extendWithRanges(r,l));let c=lme(a,this.blockWrappers,t.changes);return c.length&&(r=Hi.extendWithRanges(r,c)),i&&!r.some(u=>u.fromA<=i.range.fromA&&u.toA>=i.range.toA)&&(r=i.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,i),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||t.length){let o=this.tile,a=new J0e(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&hr.get(n.text)&&a.cache.reused.set(hr.get(n.text),2),this.tile=a.run(t,n),zv(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=Qe.chrome||Qe.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),i&&(i.written||r.selectionRange.focusNode!=i.node||!this.tile.dom.contains(i.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];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 L4&&s.push(i.dom);r.updateGaps(s)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let n of t.transactions)for(let r of n.effects)r.is(tD)&&(this.editContextFormatting=r.value)}updateSelection(t=!1,n=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,i=s==r,o=!i&&!(this.view.state.facet(Aa)||r.tabIndex>-1)&&o0(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(i||n||o))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c,u;if(l.empty?u=c=this.inlineDOMNearPos(l.anchor,l.assoc||1):(u=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),c=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),Qe.gecko&&l.empty&&!this.hasComposition&&nme(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new ho(f,0),a=!0}let d=this.view.observer.selectionRange;(a||!d.focusNode||(!l0(c.node,c.offset,d.anchorNode,d.anchorOffset)||!l0(u.node,u.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l))&&(this.view.observer.ignore(()=>{Qe.android&&Qe.chrome&&r.contains(d.focusNode)&&cme(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=P0(this.view.root);if(f)if(l.empty){if(Qe.gecko){let m=sme(c.node,c.offset);if(m&&m!=3){let p=(m==1?zL:PL)(c.node,c.offset);p&&(c=new ho(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(u.node,u.offset)}catch{}}else{let m=document.createRange();l.anchor>l.head&&([c,u]=[u,c]),m.setEnd(u.node,u.offset),m.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(m)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(c,u)),this.impreciseAnchor=c.precise?null:new ho(d.anchorNode,d.anchorOffset),this.impreciseHead=u.precise?null:new ho(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&l0(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,r=P0(t.root),{anchorNode:s,anchorOffset:i}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.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 u=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(u.node,u.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=n.from&&r.collapse(s,i)}posFromDOM(t,n){let r=this.tile.nearest(t);if(!r)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let i;if(t==r.dom)i=r.dom.childNodes[n];else{let o=Ya(t)==0?0:n==0?-1:1;for(;;){let a=t.parentNode;if(a==r.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==r.dom.firstChild)return s;for(;i&&!hr.get(i);)i=i.nextSibling;if(!i)return s+r.length;for(let o=0,a=s;;o++){let l=r.children[o];if(l.dom==i)return a;a+=l.length+l.breakAfter}}else return r.isText()?t==r.dom?s+n:s+(n?r.length:0):s}domAtPos(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.domPosFor(t,n):r.domIn(s,n)}inlineDOMNearPos(t,n){let r,s=-1,i=!1,o,a=-1,l=!1;return this.tile.blockTiles((c,u)=>{if(c.isWidget()){if(c.flags&32&&u>=t)return!0;c.flags&16&&(i=!0)}else{let d=u+c.length;if(u<=t&&(r=c,s=t-u,i=d<t),d>=t&&!o&&(o=c,a=t-u,l=u>t),u>t&&o)return!0}}),!r&&!o?this.domAtPos(t,n):(i&&o?r=null:l&&r&&(o=null),r&&n<0||!o?r.domIn(s,n):o.domIn(a,n))}coordsAt(t,n){let{tile:r,offset:s}=this.tile.resolveBlock(t,n);return r.isWidget()?r.widget instanceof L4?null:r.coordsInWidget(s,n,!0):r.coordsIn(s,n)}lineAt(t,n){let{tile:r}=this.tile.resolveBlock(t,n);return r.isLine()?r:null}coordsForChar(t){let{tile:n,offset:r}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function s(i,o){if(i.isComposite())for(let a of i.children){if(a.length>=o){let l=s(a,o);if(l)return l}if(o-=a.length,o<0)break}else if(i.isText()&&o<i.length){let a=ms(i.text,o);if(a==o)return null;let l=F0(i.dom,o,a).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(c==l.length-1||u.top<u.bottom&&u.left<u.right)return u}}return null}return s(n,r)}measureVisibleLineHeights(t){let n=[],{from:r,to:s}=t,i=this.view.contentDOM.clientWidth,o=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Gn.LTR,c=0,u=(d,f,m)=>{for(let p=0;p<d.children.length&&!(f>s);p++){let y=d.children[p],v=f+y.length,b=y.dom.getBoundingClientRect(),{height:x}=b;if(m&&!p&&(c+=b.top-m.top),y instanceof Pa)v>r&&u(y,f,b);else if(f>=r&&(c>0&&n.push(-c),n.push(x+c),c=0,o)){let w=y.dom.lastChild,k=w?a0(w):[];if(k.length){let T=k[k.length-1],C=l?T.right-b.left:b.right-T.left;C>a&&(a=C,this.minWidth=i,this.minWidthFrom=f,this.minWidthTo=v)}}m&&p==d.children.length-1&&(c+=m.bottom-b.bottom),f=v+y.breakAfter}};return u(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?Gn.RTL:Gn.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 u=a0(c.dom);if(u.length!=1)return;a+=u[0].width,l=u[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"),r,s,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=a0(n.firstChild)[0];r=n.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,i=o&&o.height?o.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:i}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],o=i?i.from-1:this.view.state.doc.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(nn.replace({widget:new L4(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return nn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(Jy).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(F_).map((i,o)=>{let a=typeof i=="function";return a&&(r=!0),a?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[t++]=r,n.push(Cn.join(s))),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(rD).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(t){var n;if(t.isSnapshot){let u=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=u.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let u of this.view.state.facet(eD))try{if(u(this.view,t.range,t))return!0}catch(d){fi(this.view.state,d,"scroll handler")}let{range:r}=t,s=this.coordsAt(r.head,(n=r.assoc)!==null&&n!==void 0?n:r.empty?0:r.head>r.anchor?-1:1),i;if(!s)return;!r.empty&&(i=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(s={left:Math.min(s.left,i.left),top:Math.min(s.top,i.top),right:Math.max(s.right,i.right),bottom:Math.max(s.bottom,i.bottom)});let o=U_(this.view),a={left:s.left-o.left,top:s.top-o.top,right:s.right+o.right,bottom:s.bottom+o.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(N0e(this.view.scrollDOM,a,r.head<r.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==Gn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let u=this.view.docView.lineAt(r.head,1);u&&u.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){zv(this.tile)}}function zv(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)zv(r,t)}}function nme(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 aD(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=zL(n.focusNode,n.focusOffset),s=PL(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=hr.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let l=hr.get(r.node);!l||l.isText()&&l.text!=r.node.nodeValue||(i=s)}}if(e.docView.lastCompositionAfterCursor=i!=r,!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function rme(e,t,n){let r=aD(e,n);if(!r)return null;let{node:s,from:i,to:o}=r,a=s.nodeValue;if(/[\n\r]/.test(a)||e.state.doc.sliceString(r.from,r.to)!=a)return null;let l=t.invertedDesc;return{range:new Hi(l.mapPos(i),l.mapPos(o),i,o),text:s}}function sme(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 ime=class{constructor(){this.changes=[]}compareRange(t,n){$d(t,n,this.changes)}comparePoint(t,n){$d(t,n,this.changes)}boundChange(t){$d(t,t,this.changes)}};function ome(e,t,n){let r=new ime;return Cn.compare(e,t,n,r),r.changes}class ame{constructor(){this.changes=[]}compareRange(t,n){$d(t,n,this.changes)}comparePoint(){}boundChange(t){$d(t,t,this.changes)}}function lme(e,t,n){let r=new ame;return Cn.compare(e,t,n,r),r.changes}function cme(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 ume(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class L4 extends sa{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 dme(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return Me.cursor(t);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=ms(s.text,i,!1):a=ms(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let c=ms(s.text,o,!1);if(r(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=ms(s.text,a);if(r(s.text.slice(a,c))!=l)break;a=c}return Me.range(o+s.from,a+s.from)}function hme(e,t,n,r,s){let i=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let a=e.viewState.heightOracle.textHeight,l=Math.floor((s-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+v0e(o,i,e.state.tabSize)}function Pv(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!s||i.type==Rs.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function fme(e,t,n,r){let s=Pv(e,t.head,t.assoc||-1),i=!r||s.type!=Rs.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>s.from?t.head-1:t.head);if(i){let o=e.dom.getBoundingClientRect(),a=e.textDirectionAt(s.from),l=e.posAtCoords({x:n==(a==Gn.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Me.cursor(l,n?-1:1)}return Me.cursor(n?s.to:s.from,n?-1:1)}function lT(e,t,n,r){let s=e.state.doc.lineAt(t.head),i=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let a=t,l=null;;){let c=q0e(s,i,o,a,n),u=VL;if(!c){if(s.number==(n?e.state.doc.lines:1))return a;u=`
`,s=e.state.doc.line(s.number+(n?1:-1)),i=e.bidiSpans(s),c=e.visualLineSide(s,!n)}if(l){if(!l(u))return a}else{if(!r)return c;l=r(u)}a=c}}function mme(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let o=r(i);return s==La.Space&&(s=o),s==o}}function pme(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return Me.cursor(s,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(c)o==null&&(o=c.left-l.left),a=i<0?c.top:c.bottom;else{let p=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(s-p.from))),a=(i<0?p.top:p.bottom)+u}let d=l.left+o,f=e.viewState.heightOracle.textHeight>>1,m=r??f;for(let p=0;;p+=f){let y=a+(m+p)*i,v=qv(e,{x:d,y},!1,i);if(n?y>l.bottom:y<l.top)return Me.cursor(v.pos,v.assoc);let b=e.coordsAtPos(v.pos,v.assoc),x=b?(b.top+b.bottom)/2:0;if(!b||(n?x>a:x<a))return Me.cursor(v.pos,v.assoc,void 0,o)}}function c0(e,t,n){for(;;){let r=0;for(let s of e)s.between(t-1,t+1,(i,o,a)=>{if(t>i&&t<o){let l=r||n||(t-i<o-t?-1:1);t=l<0?i:o,r=l}});if(!r)return t}}function lD(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let s=t.ranges[r],i=null;if(s.empty){let o=c0(e,s.from,0);o!=s.from&&(i=Me.cursor(o,-1))}else{let o=c0(e,s.from,-1),a=c0(e,s.to,1);(o!=s.from||a!=s.to)&&(i=Me.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?Me.create(n,t.mainIndex):t}function D4(e,t,n){let r=c0(e.state.facet(_m).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Me.cursor(r,r<n.from?1:-1)}class $o{constructor(t,n){this.pos=t,this.assoc=n}}function qv(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),i=s.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,c;for(;;){if(l<0)return new $o(0,1);if(l>e.viewState.docHeight)return new $o(e.state.doc.length,-1);if(c=e.elementAtHeight(l),r==null)break;if(c.type==Rs.Text){if(r<0?c.to<e.viewport.from:c.from>e.viewport.to)break;let f=e.docView.coordsAt(r<0?c.from:c.to,r>0?-1:1);if(f&&(r<0?f.top<=l+i:f.bottom>=l+i))break}let d=e.viewState.heightOracle.textHeight/2;l=r>0?c.bottom+d:c.top-d}if(e.viewport.from>=c.to||e.viewport.to<=c.from){if(n)return null;if(c.type==Rs.Text){let d=hme(e,s,c,o,a);return new $o(d,d==c.from?1:-1)}}if(c.type!=Rs.Text)return l<(c.top+c.bottom)/2?new $o(c.from,1):new $o(c.to,-1);let u=e.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=e.docView.lineAt(c.from,-2)),new gme(e,o,a,e.textDirectionAt(c.from)).scanTile(u,c.from)}class gme{constructor(t,n,r,s){this.view=t,this.x=n,this.y=r,this.baseDir=s,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:r,spans:s}=this.bidiSpansAt(t);return s[Ho.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[Ho.find(s,t-r.from,-1,n)].dir}bidiIn(t,n){let{spans:r,line:s}=this.bidiSpansAt(t);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<n)}scan(t,n,r=!1){let s=0,i=t.length-1,o=new Set,a=this.bidiIn(t[0],t[i]),l,c,u=-1,d=1e9,f;e:for(;s<i;){let p=i-s,y=s+i>>1;t:if(o.has(y)){let b=s+Math.floor(Math.random()*p);for(let x=0;x<p;x++){if(!o.has(b)){y=b;break t}b++,b==i&&(b=s)}break e}o.add(y);let v=n(y);if(v)for(let b=0;b<v.length;b++){let x=v[b],w=0;if(!(x.width==0&&v.length>1)){if(x.bottom<this.y)(!l||l.bottom<x.bottom)&&(l=x),w=1;else if(x.top>this.y)(!c||c.top>x.top)&&(c=x),w=-1;else{let k=x.left>this.x?this.x-x.left:x.right<this.x?this.x-x.right:0,T=Math.abs(k);T<d&&(u=y,d=T,f=x),k&&(w=k<0==(this.baseDir==Gn.LTR)?-1:1)}w==-1&&(!a||this.baseDirAt(t[y],1))?i=y:w==1&&(!a||this.baseDirAt(t[y+1],-1))&&(s=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(d&&!r){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[u],1):this.baseDir)==Gn.LTR;return{i:u,after:this.x>(f.left+f.right)/2==m}}scanText(t,n){let r=[];for(let i=0;i<t.length;i=ms(t.text,i))r.push(n+i);r.push(n+t.length);let s=this.scan(r,i=>{let o=r[i]-n,a=r[i+1]-n;return F0(t.dom,o,a).getClientRects()});return s.after?new $o(r[s.i+1],-1):new $o(r[s.i],1)}scanTile(t,n){if(!t.length)return new $o(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 r=[n];for(let a=0,l=n;a<t.children.length;a++)r.push(l+=t.children[a].length);let s=this.scan(r,a=>{let l=t.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:F0(l.dom,0,l.length)).getClientRects()}),i=t.children[s.i],o=r[s.i];return i.isText()?this.scanText(i,o):i.isComposite()?this.scanTile(i,o):s.after?new $o(r[s.i+1],-1):new $o(o,1)}}const cd="";class yme{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(kn.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=cd}readRange(t,n){if(!t)return this;let r=t.parentNode;for(let s=t;;){this.findPointBefore(r,s);let i=this.text.length;this.readNode(s);let o=hr.get(s),a=s.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=hr.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:O1(s))||O1(a)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!xme(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(t){let n=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,o=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=s.exec(n))&&(i=a.index,o=a[0].length),this.append(n.slice(r,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);r=i+o}}readNode(t){let n=hr.get(t),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.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 r of this.points)r.node==t&&t.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(t,n){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(bme(t,r.node,r.offset)?n:0))}}function bme(e,t,n){for(;;){if(!t||n<Ya(t))return!1;if(t==e)return!0;n=hc(t)+1,t=t.parentNode}}function xme(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=hr.get(e);if(!(r!=null&&r.isWidget()))return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class cT{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class wme{constructor(t,n,r,s){this.typeOver=s,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=cD(t.docView.tile,n,r,0))){let l=i||o?[]:_me(t),c=new yme(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=kme(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!Lv(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Lv(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),d=t.viewport;if((Qe.ios||Qe.chrome)&&a.main.empty&&c!=u&&(d.from>0||d.to<t.state.doc.length)){let f=Math.min(c,u),m=Math.max(c,u),p=d.from-f,y=d.to-m;(p==0||p==1||f==0)&&(y==0||y==-1||m==t.state.doc.length)&&(c=0,u=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Me.range(u,c));else if(t.lineWrapping&&u==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=Me.create([Me.cursor(c,m)])}else this.newSel=Me.single(u,c)}}}function cD(e,t,n,r){if(e.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,c=r,u=r;l<e.children.length;l++){let d=e.children[l],f=c+d.length;if(c<t&&f>n)return cD(d,t,n,c);if(f>=t&&s==-1&&(s=l,i=c),c>n&&d.dom.parentNode==e.dom){o=l,a=u;break}u=f,c=f+d.breakAfter}return{from:i,to:a<0?r+e.length:a,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function uD(e,t){let n,{newSel:r}=t,{state:s}=e,i=s.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,u=null;(o===8||Qe.android&&t.text.length<l-a)&&(c=i.to,u="end");let d=s.doc.sliceString(a,l,cd),f,m;!i.empty&&i.from>=a&&i.to<=l&&(t.typeOver||d!=t.text)&&d.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&d.slice(i.to-a)==t.text.slice(f=t.text.length-(d.length-(i.to-a)))?n={from:i.from,to:i.to,insert:hn.of(t.text.slice(i.from-a,f).split(cd))}:(m=dD(d,t.text,c-a,u))&&(Qe.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==cd+cd&&m.toB--,n={from:a+m.from,to:a+m.toA,insert:hn.of(t.text.slice(m.from,m.toB).split(cd))})}else r&&(!e.hasFocus&&s.facet(Aa)||P1(r,i))&&(r=null);if(!n&&!r)return!1;if((Qe.mac||Qe.android)&&n&&n.from==n.to&&n.from==i.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Me.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:hn.of([n.insert.toString().replace("."," ")])}):s.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:s.toText(e.inputState.insertingText)}:Qe.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(r&&(r=Me.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:hn.of([" "])}),n)return H_(e,n,r,o);if(r&&!P1(r,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"&&(r=lD(s.facet(_m).map(c=>c(e)),r))),e.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function H_(e,t,n,r=-1){if(Qe.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(Qe.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&e.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&zd(e.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>s.head)&&zd(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&zd(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=vme(e,t,n));return e.state.facet(XL).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function vme(e,t,n){let r,s=e.state,i=s.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,u=c0(s.facet(_m).map(d=>d(e)),c,l);t.from==u&&(o=u)}if(o>-1)r={changes:t,selection:Me.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?s.sliceDoc(i.from,t.from):"",c=i.to>t.to?s.sliceDoc(t.to,i.to):"";r=s.replaceSelection(e.state.toText(l+t.insert.sliceString(0,void 0,e.state.lineBreak)+c))}else{let l=s.changes(t),c=n&&n.main.to<=l.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=i.to+10&&t.to>=i.to-10){let u=e.state.sliceDoc(t.from,t.to),d,f=n&&aD(e,n.main.head);if(f){let p=t.insert.length-(t.to-t.from);d={from:f.from,to:f.to-p}}else d=e.state.doc.lineAt(i.head);let m=i.to-t.to;r=s.changeByRange(p=>{if(p.from==i.from&&p.to==i.to)return{changes:l,range:c||p.map(l)};let y=p.to-m,v=y-u.length;if(e.state.sliceDoc(v,y)!=u||y>=d.from&&v<=d.to)return{range:p};let b=s.changes({from:v,to:y,insert:t.insert}),x=p.to-i.to;return{changes:b,range:c?Me.range(Math.max(0,c.anchor+x),Math.max(0,c.head+x)):p.map(b)}})}else r={changes:l,selection:c&&s.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)),s.update(r,{userEvent:a,scrollIntoView:!0})}function dD(e,t,n,r){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)==t.charCodeAt(i);)i++;if(i==s&&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(r=="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 _me(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=e.observer.selectionRange;return n&&(t.push(new cT(n,r)),(s!=n||i!=r)&&t.push(new cT(s,i))),t}function kme(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?Me.single(n+t,r+t):null}function P1(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Sme{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,Qe.safari&&t.contentDOM.addEventListener("input",()=>null),Qe.gecko&&zme(t.contentDOM.ownerDocument)}handleEvent(t){!Rme(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 r=this.handlers[t];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=Tme(t),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let o=!n[i].handlers.length,a=r[i];a&&o!=!a.handlers.length&&(s.removeEventListener(i,this.handleEvent),a=null),a||s.addEventListener(i,this.handleEvent,{passive:o})}for(let i in r)i!="scroll"&&!n[i]&&s.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&&fD.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Qe.android&&Qe.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return Qe.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=hD.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||Cme.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,zd(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:Qe.safari&&!Qe.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 uT(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){fi(n.state,s)}}}function Tme(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let s=r.spec,i=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(uT(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(uT(r.value,l))}}for(let r in mo)n(r).handlers.push(mo[r]);for(let r in Js)n(r).observers.push(Js[r]);return t}const hD=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Cme="dthko",fD=[16,17,18,20,91,92,224,225],Sp=6;function Tp(e){return Math.max(0,e)*.7+8}function Ame(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class Eme{constructor(t,n,r,s){this.view=t,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=OL(t.contentDOM),this.atoms=t.state.facet(_m).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(kn.allowMultipleSelections)&&Mme(t,n),this.dragging=Ime(t,n)&&gD(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&&Ame(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,s=0,i=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=U_(this.view);t.clientX-l.left<=s+Sp?n=-Tp(s-t.clientX):t.clientX+l.right>=o-Sp&&(n=Tp(t.clientX-o)),t.clientY-l.top<=i+Sp?r=-Tp(i-t.clientY):t.clientY+l.bottom>=a-Sp&&(r=Tp(t.clientY-a)),this.setScrollSpeed(n,r)}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,r=lD(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,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 Mme(e,t){let n=e.state.facet(WL);return n.length?n[0](t):Qe.mac?t.metaKey:t.ctrlKey}function Nme(e,t){let n=e.state.facet(GL);return n.length?n[0](t):Qe.mac?!t.altKey:!t.ctrlKey}function Ime(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=P0(e.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i<s.length;i++){let o=s[i];if(o.left<=t.clientX&&o.right>=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function Rme(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=hr.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const mo=Object.create(null),Js=Object.create(null),mD=Qe.ie&&Qe.ie_version<15||Qe.ios&&Qe.webkit_version<604;function jme(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(),pD(e,n.value)},50)}function tb(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function pD(e,t){t=tb(e.state,z_,t);let{state:n}=e,r,s=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(Fv!=null&&n.selection.ranges.every(l=>l.empty)&&Fv==i.toString()){let l=-1;r=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let d=n.toText((o?i.line(s++).text:t)+n.lineBreak);return{changes:{from:u.from,insert:d},range:Me.cursor(c.from+d.length)}})}else o?r=n.changeByRange(l=>{let c=i.line(s++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Me.cursor(l.from+c.length)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Js.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};Js.wheel=Js.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};mo.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Js.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};Js.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};mo.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(KL))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Dme(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Eme(e,t,n,r)),r&&e.observer.ignore(()=>{BL(e.contentDOM);let i=e.root.activeElement;i&&!i.contains(e.contentDOM)&&i.blur()});let s=e.inputState.mouseSelection;if(s)return s.start(t),s.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function dT(e,t,n,r){if(r==1)return Me.cursor(t,n);if(r==2)return dme(e.state,t,n);{let s=e.docView.lineAt(t,n),i=e.state.doc.lineAt(s?s.posAtEnd:t),o=s?s.posAtStart:i.from,a=s?s.posAtEnd:i.to;return a<e.state.doc.length&&a==i.to&&a++,Me.range(o,a)}}const Lme=Qe.ie&&Qe.ie_version<=11;let hT=null,fT=0,mT=0;function gD(e){if(!Lme)return e.detail;let t=hT,n=mT;return hT=e,mT=Date.now(),fT=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(fT+1)%3:1}function Dme(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=gD(t),s=e.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,o,a){let l=e.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,u=dT(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let d=dT(e,n.pos,n.assoc,r),f=Math.min(d.from,u.from),m=Math.max(d.to,u.to);u=f<u.from?Me.range(f,m,u.assoc):Me.range(m,f,u.assoc)}return o?s.replaceRange(s.main.extend(u.from,u.to,u.assoc)):a&&r==1&&s.ranges.length>1&&(c=Ome(s,l.pos))?c:a?s.addRange(u):Me.create([u])}}}function Ome(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:s}=e.ranges[n];if(r<=t&&s>=t)return Me.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}mo.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let s=e.docView.tile.nearest(t.target);if(s&&s.isWidget()){let i=s.posAtStart,o=i+s.length;(i>=n.to||o<=n.from)&&(n=Me.range(i,o))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",tb(e.state,P_,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};mo.dragend=e=>(e.inputState.draggedContent=null,!1);function pT(e,t,n,r){if(n=tb(e.state,z_,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=r&&i&&Nme(e,t)?{from:i.from,to:i.to}:null,a={from:s,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(s,-1),head:l.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}mo.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&pT(e,t,r.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)||(r[o]=a.result),i()},a.readAsText(n[o])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return pT(e,t,r,!0),!0}return!1};mo.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=mD?null:t.clipboardData;return n?(pD(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(jme(e),!1)};function Bme(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function $me(e){let t=[],n=[],r=!1;for(let s of e.selection.ranges)s.empty||(t.push(e.sliceDoc(s.from,s.to)),n.push(s));if(!t.length){let s=-1;for(let{from:i}of e.selection.ranges){let o=e.doc.lineAt(i);o.number>s&&(t.push(o.text),n.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),s=o.number}r=!0}return{text:tb(e,P_,t.join(e.lineBreak)),ranges:n,linewise:r}}let Fv=null;mo.copy=mo.cut=(e,t)=>{if(!o0(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=$me(e.state);if(!n&&!s)return!1;Fv=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=mD?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Bme(e,n),!1)};const yD=nl.define();function bD(e,t){let n=[];for(let r of e.facet(QL)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:yD.of(!0)}):null}function xD(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=bD(e.state,t);n?e.dispatch(n):e.update([])}},10)}Js.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),xD(e)};Js.blur=e=>{e.observer.clearSelectionRange(),xD(e)};Js.compositionstart=Js.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Js.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,Qe.chrome&&Qe.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Js.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};mo.beforeinput=(e,t)=>{var n,r;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 H_(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let s;if(Qe.chrome&&Qe.android&&(s=hD.find(i=>i.inputType==t.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.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 Qe.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),Qe.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Js.compositionend(e,t),20),!1};const gT=new Set;function zme(e){gT.has(e)||(gT.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const yT=["pre-wrap","normal","pre-line","break-spaces"];let uh=!1;function bT(){uh=!1}class Pme{constructor(t){this.lineWrapping=t,this.doc=hn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}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 yT.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let r=0;r<t.length;r++){let s=t[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(t,n,r,s,i,o){let a=yT.indexOf(t)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class qme{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class uo{constructor(t,n,r,s,i){this.from=t,this.length=n,this.top=r,this.height=s,this._content=i}get type(){return typeof this._content=="number"?Rs.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 Eu?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 uo(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var qn=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(qn||(qn={}));const bg=.001;class js{constructor(t,n,r=2){this.length=t,this.height=n,this.flags=r}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)>bg&&(uh=!0),this.height=t)}replace(t,n,r){return js.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,s){let i=this,o=r.doc;for(let a=s.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:d}=s[a],f=i.lineAt(l,qn.ByPosNoHeight,r.setDoc(n),0,0),m=f.to>=c?f:i.lineAt(c,qn.ByPosNoHeight,r,0,0);for(d+=m.to-c,c=m.to;a>0&&f.from<=s[a-1].toA;)l=s[a-1].fromA,u=s[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,qn.ByPosNoHeight,r,0,0));u+=f.from-l,l=f.from;let p=V_.build(r.setDoc(o),t,u,d);i=q1(i,i.replace(l,c,p))}return i.updateHeight(r,0)}static empty(){return new li(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,s=0,i=0;for(;;)if(n==r)if(s>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),r+=1+a.break,s-=a.size}else if(i>s*2){let a=t[r];a.break?t.splice(r,1,a.left,null,a.right):t.splice(r,1,a.left,a.right),r+=2+a.break,i-=a.size}else break;else if(s<i){let a=t[n++];a&&(s+=a.size)}else{let a=t[--r];a&&(i+=a.size)}let o=0;return t[n-1]==null?(o=1,n--):t[n]==null&&(o=1,r++),new Ume(js.of(t.slice(0,n)),o,js.of(t.slice(r)))}}function q1(e,t){return e==t?e:(e.constructor!=t.constructor&&(uh=!0),t)}js.prototype.size=1;const Fme=nn.replace({});class wD extends js{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new uo(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(t,n,r,s){return this.spaceAbove&&t<r+this.spaceAbove?new uo(s,0,r,this.spaceAbove,Fme):this.mainBlock(r,s)}lineAt(t,n,r,s,i){let o=this.mainBlock(s,i);return this.spaceAbove?this.blockAt(0,r,s,i).join(o):o}forEachLine(t,n,r,s,i,o){t<=i+this.length&&n>=i&&o(this.lineAt(0,qn.ByPos,r,s,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,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class li extends wD{constructor(t,n,r){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(t,n){return new uo(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let s=r[0];return r.length==1&&(s instanceof li||s instanceof Zr&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Zr?s=new li(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):js.of(r)}updateHeight(t,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||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 Zr extends js{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,s=t.doc.lineAt(n+this.length).number,i=s-r+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:r,lastLine:s,perLine:o,perChar:a}}blockAt(t,n,r,s){let{firstLine:i,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s);if(n.lineWrapping){let c=s+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length)),u=n.doc.lineAt(c),d=a+u.length*l,f=Math.max(r,t-d/2);return new uo(u.from,u.length,f,d,0)}else{let c=Math.max(0,Math.min(o-i,Math.floor((t-r)/a))),{from:u,length:d}=n.doc.line(i+c);return new uo(u,d,r+a*c,a,0)}}lineAt(t,n,r,s,i){if(n==qn.ByHeight)return this.blockAt(t,r,s,i);if(n==qn.ByPosNoHeight){let{from:m,to:p}=r.doc.lineAt(t);return new uo(m,p-m,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i),c=r.doc.lineAt(t),u=a+c.length*l,d=c.number-o,f=s+a*d+l*(c.from-i-d);return new uo(c.from,c.length,Math.max(s,Math.min(f,s+this.height-u)),u,0)}forEachLine(t,n,r,s,i,o){t=Math.max(t,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,i);for(let u=t,d=s;u<=n;){let f=r.doc.lineAt(u);if(u==t){let p=f.number-a;d+=l*p+c*(t-i-p)}let m=l+c*f.length;o(new uo(f.from,f.length,d,m,0)),d+=m,u=f.to+1}}replace(t,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof Zr?r[r.length-1]=new Zr(i.length+s):r.push(null,new Zr(s-1))}if(t>0){let i=r[0];i instanceof Zr?r[0]=new Zr(t+i.length):r.unshift(new Zr(t-1),null)}return js.of(r)}decomposeLeft(t,n){n.push(new Zr(t-1),null)}decomposeRight(t,n){n.push(null,new Zr(this.length-t-1))}updateHeight(t,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let o=[],a=Math.max(n,s.from),l=-1;for(s.from>n&&o.push(new Zr(s.from-n-1).updateHeight(t,n));a<=i&&s.more;){let u=t.doc.lineAt(a).length;o.length&&o.push(null);let d=s.heights[s.index++],f=0;d<0&&(f=-d,d=s.heights[s.index++]),l==-1?l=d:Math.abs(d-l)>=bg&&(l=-2);let m=new li(u,d,f);m.outdated=!1,o.push(m),a+=u+1}a<=i&&o.push(null,new Zr(i-a).updateHeight(t,a));let c=js.of(o);return(l<0||Math.abs(c.height-this.height)>=bg||Math.abs(l-this.heightMetrics(t,n).perLine)>=bg)&&(uh=!0),q1(this,c)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ume extends js{constructor(t,n,r){super(t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,n,r,s){let i=r+this.left.height;return t<i?this.left.blockAt(t,n,r,s):this.right.blockAt(t,n,i,s+this.left.length+this.break)}lineAt(t,n,r,s,i){let o=s+this.left.height,a=i+this.left.length+this.break,l=n==qn.ByHeight?t<o:t<a,c=l?this.left.lineAt(t,n,r,s,i):this.right.lineAt(t,n,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==qn.ByPosNoHeight?qn.ByPosNoHeight:qn.ByPos;return l?c.join(this.right.lineAt(a,u,r,o,a)):this.left.lineAt(a,u,r,s,i).join(c)}forEachLine(t,n,r,s,i,o){let a=s+this.left.height,l=i+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,n,r,s,i,o),n>=l&&this.right.forEachLine(t,n,r,a,l,o);else{let c=this.lineAt(l,qn.ByPos,r,s,i);t<c.from&&this.left.forEachLine(t,c.from-1,r,s,i,o),c.to>=t&&c.from<=n&&o(c),n>c.to&&this.right.forEachLine(c.to+1,n,r,a,l,o)}}replace(t,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(t,n,r),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,n-s,r));let i=[];t>0&&this.decomposeLeft(t,i);let o=i.length;for(let a of r)i.push(a);if(t>0&&xT(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),xT(i,a)}return js.of(i)}decomposeLeft(t,n){let r=this.left.length;if(t<=r)return this.left.decomposeLeft(t,n);n.push(this.left),this.break&&(r++,t>=r&&n.push(null)),t>r&&this.right.decomposeLeft(t-r,n)}decomposeRight(t,n){let r=this.left.length,s=r+this.break;if(t>=s)return this.right.decomposeRight(t-s,n);t<r&&this.left.decomposeRight(t,n),this.break&&t<s&&n.push(null),n.push(this.right)}balanced(t,n){return t.size>2*n.size||n.size>2*t.size?js.of(this.break?[t,null,n]:[t,n]):(this.left=q1(this.left,t),this.right=q1(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,r=!1,s){let{left:i,right:o}=this,a=n+i.length+this.break,l=null;return s&&s.from<=n+i.length&&s.more?l=i=i.updateHeight(t,n,r,s):i.updateHeight(t,n,r),s&&s.from<=a+o.length&&s.more?l=o=o.updateHeight(t,a,r,s):o.updateHeight(t,a,r),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 xT(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Zr&&(r=e[t+1])instanceof Zr&&e.splice(t-1,3,new Zr(n.length+1+r.length))}const Hme=5;class V_{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 r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof li?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new li(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=n-t;r.block?this.addBlock(new wD(o,s,r)):(o||i||s>=Hme)&&this.addLineDeco(s,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 li(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new Zr(n-t);return this.oracle.doc.lineAt(t).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof li)return t;let n=new li(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,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof li)&&!this.isCovered?this.nodes.push(new li(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=t;for(let s of this.nodes)s instanceof li&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new V_(r,t);return Cn.spans(n,r,s,i,0),i.finish(r)}}function Vme(e,t,n){let r=new Wme;return Cn.compare(e,t,n,r,0),r.changes}class Wme{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&$d(t,n,this.changes,5)}}function Gme(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,s=r.defaultView||window,i=Math.max(0,n.left),o=Math.min(s.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(s.innerHeight,n.bottom);for(let c=e.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,d=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&d.overflow!="visible"){let f=u.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?s.innerHeight:l,f.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.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 Kme(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 Yme(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class O4{constructor(t,n,r,s){this.from=t,this.to=n,this.size=r,this.displaySize=s}static same(t,n){if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let s=t[r],i=n[r];if(s.from!=i.from||s.to!=i.to||s.size!=i.size)return!1}return!0}draw(t,n){return nn.replace({widget:new Xme(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class Xme extends sa{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 wT{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=vT,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Gn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(q_).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new Pme(r),this.stateDeco=_T(n),this.heightMap=js.empty().applyChanges(this.stateDeco,hn.empty,this.heightOracle.setDoc(n.doc),[new Hi(0,0,0,n.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=nn.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!t.some(({from:i,to:o})=>s>=i&&s<=o)){let{from:i,to:o}=this.lineBlockAt(s);t.push(new Cp(i,o))}}return this.viewports=t.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?vT:new W_(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(Mf(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=_T(this.state);let s=t.changedRanges,i=Hi.extendWithRanges(s,Vme(r,this.stateDeco,t?t.changes:Lr.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);bT(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||uh)&&(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(ZL)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Gn.RTL:Gn.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,u=0;if(a.width&&a.height){let{scaleX:T,scaleY:C}=DL(n,a);(T>.005&&Math.abs(this.scaleX-T)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=T,this.scaleY=C,c|=16,o=l=!0)}let d=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=f)&&(this.paddingTop=d,this.paddingBottom=f,c|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,c|=16);let m=OL(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=$L(this.scrollParent||t.win);let y=(this.printing?Yme:Gme)(n,this.paddingTop),v=y.top-this.pixelViewport.top,b=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(l=!0)),!this.inView&&!this.scrollTarget&&!Kme(t.dom))return 0;let w=a.width;if((this.contentDOMWidth!=w||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,c|=16),l){let T=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(o=!0),o||s.lineWrapping&&Math.abs(w-this.contentDOMWidth)>s.charWidth){let{lineHeight:C,charWidth:A,textHeight:L}=t.docView.measureTextSize();o=C>0&&s.refresh(i,C,A,L,Math.max(5,w/A),T),o&&(t.docView.minWidth=0,c|=16)}v>0&&b>0?u=Math.max(v,b):v<0&&b<0&&(u=Math.min(v,b)),bT();for(let C of this.viewports){let A=C.from==this.viewport.from?T:t.docView.measureVisibleLineHeights(C);this.heightMap=(o?js.empty().applyChanges(this.stateDeco,hn.empty,this.heightOracle,[new Hi(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new qme(C.from,A))}uh&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&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 r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Cp(s.lineAt(o-r*1e3,qn.ByHeight,i,0,0).from,s.lineAt(a+(1-r)*1e3,qn.ByHeight,i,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=s.lineAt(c,qn.ByPos,i,0,0),f;n.y=="center"?f=(d.top+d.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=d.top:f=d.bottom-u,l=new Cp(s.lineAt(f-1e3/2,qn.ByHeight,i,0,0).from,s.lineAt(f+u+1e3/2,qn.ByHeight,i,0,0).to)}}return l}mapViewport(t,n){let r=n.mapPos(t.from,-1),s=n.mapPos(t.to,1);return new Cp(this.heightMap.lineAt(r,qn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,qn.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,qn.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,qn.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(t==0||s<=o-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(r,250)))&&s>o-2*1e3&&i<a+2*1e3}mapLineGaps(t,n){if(!t.length||n.empty)return t;let r=[];for(let s of t)n.touchesRange(s.from,s.to)||r.push(new O4(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(t,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,i=s>>1,o=s<<1;if(this.defaultTextDirection!=Gn.LTR&&!r)return[];let a=[],l=(u,d,f,m)=>{if(d-u<i)return;let p=this.state.selection.main,y=[p.from];p.empty||y.push(p.to);for(let b of y)if(b>u&&b<d){l(u,b-10,f,m),l(b+10,d,f,m);return}let v=Jme(t,b=>b.from>=f.from&&b.to<=f.to&&Math.abs(b.from-u)<i&&Math.abs(b.to-d)<i&&!y.some(x=>b.from<x&&b.to>x));if(!v){if(d<f.to&&n&&r&&n.visibleRanges.some(w=>w.from<=d&&w.to>=d)){let w=n.moveToLineBoundary(Me.cursor(d),!1,!0).head;w>u&&(d=w)}let b=this.gapSize(f,u,d,m),x=r||b<2e6?b:2e6;v=new O4(u,d,b,x)}a.push(v)},c=u=>{if(u.length<o||u.type!=Rs.Text)return;let d=Qme(u.from,u.to,this.stateDeco);if(d.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,m,p;if(r){let y=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,b;if(f!=null){let x=Ep(d,f),w=((this.visibleBottom-this.visibleTop)/2+y)/u.height;v=x-w,b=x+w}else v=(this.visibleTop-u.top-y)/u.height,b=(this.visibleBottom-u.top+y)/u.height;m=Ap(d,v),p=Ap(d,b)}else{let y=d.total*this.heightOracle.charWidth,v=s*this.heightOracle.charWidth,b=0;if(y>2e6)for(let C of t)C.from>=u.from&&C.from<u.to&&C.size!=C.displaySize&&C.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=C.size-C.displaySize);let x=this.pixelViewport.left+b,w=this.pixelViewport.right+b,k,T;if(f!=null){let C=Ep(d,f),A=((w-x)/2+v)/y;k=C-A,T=C+A}else k=(x-v)/y,T=(w+v)/y;m=Ap(d,k),p=Ap(d,T)}m>u.from&&l(u.from,m,u,d),p<u.to&&l(p,u.to,u,d)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(t,n,r,s){let i=Ep(s,r)-Ep(s,n);return this.heightOracle.lineWrapping?t.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(t){O4.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=nn.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 r=[];Cn.spans(n,this.viewport.from,this.viewport.to,{span(i,o){r.push({from:i,to:o})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i<r.length&&!(s&8);i++){let o=this.visibleRanges[i],a=r[i];(o.from!=a.from||o.to!=a.to)&&(s|=4,t&&t.mapPos(o.from,-1)==a.from&&t.mapPos(o.to,1)==a.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||Mf(this.heightMap.lineAt(t,qn.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)||Mf(this.heightMap.lineAt(this.scaler.fromDOM(t),qn.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 Mf(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 Cp{constructor(t,n){this.from=t,this.to=n}}function Qme(e,t,n){let r=[],s=e,i=0;return Cn.spans(n,e,t,{span(){},point(o,a){o>s&&(r.push({from:s,to:o}),i+=o-s),s=a}},20),s<t&&(r.push({from:s,to:t}),i+=t-s),{total:i,ranges:r}}function Ap({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let s=0;;s++){let{from:i,to:o}=t[s],a=o-i;if(r<=a)return i+r;r-=a}}function Ep(e,t){let n=0;for(let{from:r,to:s}of e.ranges){if(t<=s){n+=t-r;break}n+=s-r}return n/e.total}function Jme(e,t){for(let n of e)if(t(n))return n}const vT={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function _T(e){let t=e.facet(Jy).filter(r=>typeof r!="function"),n=e.facet(F_).filter(r=>typeof r!="function");return n.length&&t.push(Cn.join(n)),t}class W_{constructor(t,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,qn.ByPos,t,0,0).top,u=n.lineAt(l,qn.ByPos,t,0,0).bottom;return s+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);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,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.top)return s+(t-r)*this.scale;if(t<=i.bottom)return i.domTop+(t-i.top);r=i.bottom,s=i.domBottom}}fromDOM(t){for(let n=0,r=0,s=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||t<i.domTop)return r+(t-s)/this.scale;if(t<=i.domBottom)return i.top+(t-i.domTop);r=i.bottom,s=i.domBottom}}eq(t){return t instanceof W_?this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((n,r)=>n.from==t.viewports[r].from&&n.to==t.viewports[r].to):!1}}function Mf(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new uo(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>Mf(s,t)):e._content)}const Mp=kt.define({combine:e=>e.join(" ")}),Uv=kt.define({combine:e=>e.indexOf(!0)>-1}),Hv=uc.newName(),vD=uc.newName(),_D=uc.newName(),kD={"&light":"."+vD,"&dark":"."+_D};function Vv(e,t,n){return new uc(t,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return e;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):e+" "+r}})}const Zme=Vv("."+Hv,{"&":{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"}},kD),epe={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},B4=Qe.ie&&Qe.ie_version<=11;class tpe{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new I0e,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 r of n)this.queue.push(r);(Qe.ie&&Qe.ie_version<=11||Qe.ios&&t.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Qe.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Qe.chrome&&Qe.chrome_version<126)&&(this.editContext=new rpe(t),t.state.facet(Aa)&&(t.contentDOM.editContext=this.editContext.editContext)),B4&&(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,r)=>n!=t[r]))){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:r}=this,s=this.selectionRange;if(r.state.facet(Aa)?r.root.activeElement!=this.dom:!o0(this.dom,s))return;let i=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(Qe.ie&&Qe.ie_version<=11||Qe.android&&Qe.chrome)&&!r.state.selection.main.empty&&s.focusNode&&l0(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=P0(t.root);if(!n)return!1;let r=Qe.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&npe(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=o0(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&j0e(this.dom,r)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(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 r=this.dom;r;)if(r.nodeType==1)!n&&t<this.scrollTargets.length&&this.scrollTargets[t]==r?t++:n||(n=this.scrollTargets.slice(0,t)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(t<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,t)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.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,epe),B4&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),B4&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,n){var r;if(!this.delayedAndroidKey){let s=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&zd(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.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,r=-1,s=!1;for(let i of t){let o=this.readMutation(i);o&&(o.typeOver&&(s=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&o0(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new wme(this.view,t,n,r);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 r=this.view.state,s=uD(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!P1(this.view.state.selection,n.newSel.main))&&this.view.update([]),s}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 r=kT(n,t.previousSibling||t.target.previousSibling,-1),s=kT(n,t.nextSibling||t.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):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(Aa)!=t.state.facet(Aa)&&(t.view.contentDOM.editContext=t.state.facet(Aa)?this.editContext.editContext:null))}destroy(){var t,n,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.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 kT(e,t,n){for(;t;){let r=hr.get(t);if(r&&r.parent==e)return r;let s=t.parentNode;t=s!=e.dom?s:n>0?t.nextSibling:t.previousSibling}return null}function ST(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return l0(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function npe(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return ST(e,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?ST(e,n):null}class rpe{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=r=>{let s=t.state.selection.main,{anchor:i,head:o}=s,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>r.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let u=dD(t.state.sliceDoc(a,l),r.text,(c?s.from:s.to)-a,c?"end":null);if(!u){let f=Me.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));P1(f,s)||t.dispatch({selection:f,userEvent:"select"});return}let d={from:u.from+a,to:u.toA+a,insert:hn.of(r.text.slice(u.from,u.toB).split(`
`))};if((Qe.mac||Qe.android)&&d.from==o-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:a,to:l,insert:hn.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!t.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);H_(t,d,Me.single(this.toEditorPos(r.selectionStart,f),this.toEditorPos(r.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),d.from<d.to&&!d.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.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,s.push(i)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let i of r.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 u=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(nn.mark({attributes:{style:u}}).range(l,c))}}}t.dispatch({effects:tD.of(nn.set(s))})},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:r}=this.composing;this.composing=null,r&&this.reset(t.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=P0(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,r=!1,s=this.pendingContextChange;return t.changes.iterChanges((i,o,a,l,c)=>{if(r)return;let u=c.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(c)){s=this.pendingContextChange=null,n+=u,this.to+=u;return}else s=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),c.toString()),this.to+=u}n+=u}),s&&!r&&this.revertPending(t.state),!r}update(t){let n=this.pendingContextChange,r=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(r.from,r.to)&&t.transactions.some(s=>!s.isUserEvent("input.type")&&s.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,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}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 r=this.composing;return r&&r.drifted?r.editorBase+(t-r.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 ct{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:r}=t;this.dispatchTransactions=t.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=t.root||R0e(t.parent)||document,this.viewState=new wT(this,t.state||kn.create(t)),t.scrollTo&&t.scrollTo.is(kp)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Sd).map(s=>new I4(s));for(let s of this.plugins)s.update(this);this.observer=new tpe(this),this.inputState=new Sme(this),this.inputState.ensureHandlers(this.plugins),this.docView=new aT(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,r=!1,s,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(yD))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=bD(i,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(kn.phrases)!=this.state.facet(kn.phrases))return this.setState(i);s=B1.create(this,i,t),s.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let f of t){if(d&&(d=d.map(f.changes)),f.scrollIntoView){let{main:m}=f.state.selection,{x:p,y}=this.state.facet(ct.cursorScrollMargin);d=new Pd(m.empty?m:Me.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",y,p)}for(let m of f.effects)m.is(kp)&&(d=m.value.clip(this.state))}this.viewState.update(s,d),this.bidiCache=F1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Ef)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Mp)!=s.state.facet(Mp)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let f of this.state.facet($v))try{f(s)}catch(m){fi(this.state,m,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!uD(this,u)&&c.force&&zd(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 r of this.plugins)r.destroy(this);this.viewState=new wT(this,t),this.plugins=t.facet(Sd).map(r=>new I4(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new aT(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(Sd),r=t.state.facet(Sd);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new I4(i));else{let a=this.plugins[o];a.mustUpdate=t,s.push(a)}}for(let i of this.plugins)i.mustUpdate!=t&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=t;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&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(r){fi(this.state,r,"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,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if($L(r||this.win))i=-1,o=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(s);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 u=c.map(m=>{try{return m.read(this)}catch(p){return fi(this.state,p),TT}}),d=B1.create(this,this.state,[]),f=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),f=this.docView.update(d),f&&this.docViewUpdate());for(let m=0;m<c.length;m++)if(u[m]!=TT)try{let p=c[m];p.write&&p.write(u[m],this)}catch(p){fi(this.state,p)}if(f&&this.docView.updateSelection(!0),!d.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)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,r?r.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($v))a(n)}get themeClasses(){return Hv+" "+(this.state.facet(Uv)?_D:vD)+" "+this.state.facet(Mp)}updateAttrs(){let t=CT(this,nD,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Aa)?"true":"false",class:"cm-content",style:`${Qe.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),CT(this,q_,n);let r=this.observer.ignore(()=>{let s=tT(this.contentDOM,this.contentAttrs,n),i=tT(this.dom,this.editorAttrs,t);return s||i});return this.editorAttrs=t,this.contentAttrs=n,r}showAnnouncements(t){let n=!0;for(let r of t)for(let s of r.effects)if(s.is(ct.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ef);let t=this.state.facet(ct.cspNonce);uc.mount(this.root,this.styleModules.concat(Zme).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(r=>r.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,r){return D4(this,t,lT(this,t,n,r))}moveByGroup(t,n){return D4(this,t,lT(this,t,n,r=>mme(this,t.head,r)))}visualLineSide(t,n){let r=this.bidiSpans(t),s=this.textDirectionAt(t.from),i=r[n?r.length-1:0];return Me.cursor(i.side(n,s)+t.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(t,n,r=!0){return fme(this,t,n,r)}moveVertically(t,n,r){return D4(this,t,pme(this,t,n,r))}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 r=qv(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),qv(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.docView.coordsAt(t,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(t),i=this.bidiSpans(s),o=i[Ho.find(i,t-s.from,-1,n)];return q0(r,o.dir==Gn.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(JL)||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>spe)return HL(t.length);let n=this.textDirectionAt(t.from),r;for(let i of this.bidiCache)if(i.from==t.from&&i.dir==n&&(i.fresh||UL(i.isolates,r=sT(this,t))))return i.order;r||(r=sT(this,t));let s=P0e(t.text,n,r);return this.bidiCache.push(new F1(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Qe.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{BL(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 r,s,i,o;return kp.of(new Pd(typeof t=="number"?Me.cursor(t):t,(r=n.y)!==null&&r!==void 0?r:"nearest",(s=n.x)!==null&&s!==void 0?s:"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,r=this.viewState.scrollAnchorAt(t);return kp.of(new Pd(Me.cursor(r.from),"start","start",r.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 Qs.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Qs.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=uc.newName(),s=[Mp.of(r),Ef.of(Vv(`.${r}`,t))];return n&&n.dark&&s.push(Uv.of(!0)),s}static baseTheme(t){return qu.lowest(Ef.of(Vv("."+Hv,t,kD)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&hr.get(r)||hr.get(t);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}ct.styleModule=Ef;ct.inputHandler=XL;ct.clipboardInputFilter=z_;ct.clipboardOutputFilter=P_;ct.scrollHandler=eD;ct.focusChangeEffect=QL;ct.perLineTextDirection=JL;ct.exceptionSink=YL;ct.updateListener=$v;ct.editable=Aa;ct.mouseSelectionStyle=KL;ct.dragMovesSelection=GL;ct.clickAddsSelectionRange=WL;ct.decorations=Jy;ct.blockWrappers=rD;ct.outerDecorations=F_;ct.atomicRanges=_m;ct.bidiIsolatedRanges=sD;ct.cursorScrollMargin=kt.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r=="number"?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}});ct.scrollMargins=iD;ct.darkTheme=Uv;ct.cspNonce=kt.define({combine:e=>e.length?e[0]:""});ct.contentAttributes=q_;ct.editorAttributes=nD;ct.lineWrapping=ct.contentAttributes.of({class:"cm-lineWrapping"});ct.announce=Nn.define();const spe=4096,TT={};class F1{constructor(t,n,r,s,i,o){this.from=t,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=o}static update(t,n){if(n.empty&&!t.some(i=>i.fresh))return t;let r=[],s=t.length?t[t.length-1].dir:Gn.LTR;for(let i=Math.max(0,t.length-10);i<t.length;i++){let o=t[i];o.dir==s&&!n.touchesRange(o.from,o.to)&&r.push(new F1(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function CT(e,t,n){for(let r=e.state.facet(t),s=r.length-1;s>=0;s--){let i=r[s],o=typeof i=="function"?i(e):i;o&&O_(o,n)}return n}const ipe=Qe.mac?"mac":Qe.windows?"win":Qe.linux?"linux":"key";function ope(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,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))s=!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 s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Np(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 ape=qu.default(ct.domEventHandlers({keydown(e,t){return dpe(lpe(t.state),e,t,"editor")}})),U0=kt.define({enables:ape}),AT=new WeakMap;function lpe(e){let t=e.facet(U0),n=AT.get(t);return n||AT.set(t,n=upe(t.reduce((r,s)=>r.concat(s),[]))),n}let El=null;const cpe=4e3;function upe(e,t=ipe){let n=Object.create(null),r=Object.create(null),s=(o,a)=>{let l=r[o];if(l==null)r[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,u)=>{var d,f;let m=n[o]||(n[o]=Object.create(null)),p=a.split(/ (?!$)/).map(b=>ope(b,t));for(let b=1;b<p.length;b++){let x=p.slice(0,b).join(" ");s(x,!0),m[x]||(m[x]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=El={view:w,prefix:x,scope:o};return setTimeout(()=>{El==k&&(El=null)},cpe),!0}]})}let y=p.join(" ");s(y,!1);let v=m[y]||(m[y]={preventDefault:!1,stopPropagation:!1,run:((f=(d=m._any)===null||d===void 0?void 0:d.run)===null||f===void 0?void 0:f.slice())||[]});l&&v.run.push(l),c&&(v.preventDefault=!0),u&&(v.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=o;for(let f in u)u[f].run.push(m=>d(m,Wv))}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 Wv=null;function dpe(e,t,n,r){Wv=t;let s=T0e(t),i=vl(s,0),o=ld(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;El&&El.view==n&&El.scope==r&&(a=El.prefix+" ",fD.indexOf(t.keyCode)<0&&(c=!0,El=null));let d=new Set,f=v=>{if(v){for(let b of v.run)if(!d.has(b)&&(d.add(b),b(n)))return v.stopPropagation&&(u=!0),!0;v.preventDefault&&(v.stopPropagation&&(u=!0),c=!0)}return!1},m=e[r],p,y;return m&&(f(m[a+Np(s,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Qe.windows&&t.ctrlKey&&t.altKey)&&!(Qe.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=dc[t.keyCode])&&p!=s?(f(m[a+Np(p,t,!0)])||t.shiftKey&&(y=$0[t.keyCode])!=s&&y!=p&&f(m[a+Np(y,t,!1)]))&&(l=!0):o&&t.shiftKey&&f(m[a+Np(s,t,!0)])&&(l=!0),!l&&f(m._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),Wv=null,l}class gu{constructor(t,n,r,s,i){this.className=t,this.left=n,this.top=r,this.width=s,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,r){if(r.empty){let s=t.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=SD(t);return[new gu(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return hpe(t,n,r)}}function SD(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Gn.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function ET(e,t,n,r){let s=e.coordsAtPos(t,n*2);if(!s)return r;let i=e.dom.getBoundingClientRect(),o=(s.top+s.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?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function hpe(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),s=Math.min(n.to,e.viewport.to),i=e.textDirection==Gn.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=SD(e),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=a.right-(u?parseInt(u.paddingRight):0),m=Pv(e,r,1),p=Pv(e,s,-1),y=m.type==Rs.Text?m:null,v=p.type==Rs.Text?p:null;if(y&&(e.lineWrapping||m.widgetLineBreaks)&&(y=ET(e,r,1,y)),v&&(e.lineWrapping||p.widgetLineBreaks)&&(v=ET(e,s,-1,v)),y&&v&&y.from==v.from&&y.to==v.to)return x(w(n.from,n.to,y));{let T=y?w(n.from,null,y):k(m,!1),C=v?w(null,n.to,v):k(p,!0),A=[];return(y||m).to<(v||p).from-(y&&v?1:0)||m.widgetLineBreaks>1&&T.bottom+e.defaultLineHeight/2<C.top?A.push(b(d,T.bottom,f,C.top)):T.bottom<C.top&&e.elementAtHeight((T.bottom+C.top)/2).type==Rs.Text&&(T.bottom=C.top=(T.bottom+C.top)/2),x(T).concat(A).concat(x(C))}function b(T,C,A,L){return new gu(t,T-l.left,C-l.top,Math.max(0,A-T),L-C)}function x({top:T,bottom:C,horizontal:A}){let L=[];for(let $=0;$<A.length;$+=2)L.push(b(A[$],T,A[$+1],C));return L}function w(T,C,A){let L=1e9,$=-1e9,E=[];function z(K,J,P,V,X){let te=e.coordsAtPos(K,K==A.to?-2:2),D=e.coordsAtPos(P,P==A.from?2:-2);!te||!D||(L=Math.min(te.top,D.top,L),$=Math.max(te.bottom,D.bottom,$),X==Gn.LTR?E.push(i&&J?d:te.left,i&&V?f:D.right):E.push(!i&&V?d:D.left,!i&&J?f:te.right))}let M=T??A.from,U=C??A.to;for(let K of e.visibleRanges)if(K.to>M&&K.from<U)for(let J=Math.max(K.from,M),P=Math.min(K.to,U);;){let V=e.state.doc.lineAt(J);for(let X of e.bidiSpans(V)){let te=X.from+V.from,D=X.to+V.from;if(te>=P)break;D>J&&z(Math.max(te,J),T==null&&te<=M,Math.min(D,P),C==null&&D>=U,X.dir)}if(J=V.to+1,J>=P)break}return E.length==0&&z(M,T==null,U,C==null,e.textDirection),{top:L,bottom:$,horizontal:E}}function k(T,C){let A=a.top+(C?T.top:T.bottom);return{top:A,bottom:A,horizontal:[]}}}function fpe(e,t){return e.constructor==t.constructor&&e.eq(t)}class mpe{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(xg)!=t.state.facet(xg)&&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,r=t.facet(xg);for(;n<r.length&&r[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,r)=>!fpe(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of t)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=t,Qe.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const xg=kt.define();function TD(e){return[Qs.define(t=>new mpe(t,e)),xg.of(e)]}const dh=kt.define({combine(e){return Xy(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function ppe(e={}){return[dh.of(e),gpe,ype,bpe,ZL.of(!0)]}function CD(e){return e.startState.facet(dh)!=e.state.facet(dh)}const gpe=TD({above:!0,markers(e){let{state:t}=e,n=t.facet(dh),r=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty||n.drawRangeCursor&&!(i&&Qe.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:Me.cursor(s.head,s.assoc);for(let l of gu.forRange(e,o,a))r.push(l)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=CD(e);return n&&MT(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){MT(t.state,e)},class:"cm-cursorLayer"});function MT(e,t){t.style.animationDuration=e.facet(dh).cursorBlinkRate+"ms"}const ype=TD({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let s of r)if(!s.empty)for(let i of gu.forRange(e,"cm-selectionBackground",s))t.push(i);if(Qe.ios&&!n.empty&&e.state.facet(dh).iosSelectionHandles){for(let s of gu.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Me.cursor(n.from,1)))t.push(s);for(let s of gu.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Me.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||CD(e)},class:"cm-selectionLayer"}),bpe=qu.highest(ct.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 NT(e,t,n,r,s){t.lastIndex=0;for(let i=e.iterRange(n,r),o=n,a;!i.next().done;o+=i.value.length)if(!i.lineBreak)for(;a=t.exec(i.value);)s(o+a.index,a)}function xpe(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 r=[];for(let{from:s,to:i}of n)s=Math.max(e.state.doc.lineAt(s).from,s-t),i=Math.min(e.state.doc.lineAt(i).to,i+t),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class wpe{constructor(t){const{regexp:n,decoration:r,decorate:s,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,s)this.addMatch=(a,l,c,u)=>s(u,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,u)=>{let d=r(a,l,c);d&&u(c,c+a[0].length,d)};else if(r)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=o}createDeco(t){let n=new Au,r=n.add.bind(n);for(let{from:s,to:i}of xpe(t,this.maxLength))NT(t.state.doc,this.regexp,s,i,(o,a)=>this.addMatch(a,t,o,r));return n.finish()}updateDeco(t,n){let r=1e9,s=-1;return t.docChanged&&t.changes.iterChanges((i,o,a,l)=>{l>=t.view.viewport.from&&a<=t.view.viewport.to&&(r=Math.min(a,r),s=Math.max(l,s))}),t.viewportMoved||s-r>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,n.map(t.changes),r,s):n}updateRange(t,n,r,s){for(let i of t.visibleRanges){let o=Math.max(i.from,r),a=Math.min(i.to,s);if(a>=o){let l=t.state.doc.lineAt(o),c=l.to<a?t.state.doc.lineAt(a):l,u=Math.max(i.from,l.from),d=Math.min(i.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){d=a;break}}let f=[],m,p=(y,v,b)=>f.push(b.range(y,v));if(l==c)for(this.regexp.lastIndex=u-l.from;(m=this.regexp.exec(l.text))&&m.index<d-l.from;)this.addMatch(m,t,m.index+l.from,p);else NT(t.state.doc,this.regexp,u,d,(y,v)=>this.addMatch(v,t,y,p));n=n.update({filterFrom:u,filterTo:d,filter:(y,v)=>y<u||v>d,add:f})}}return n}}const Gv=/x/.unicode!=null?"gu":"g",vpe=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,Gv),_pe={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 $4=null;function kpe(){var e;if($4==null&&typeof document<"u"&&document.body){let t=document.body.style;$4=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return $4||!1}const wg=kt.define({combine(e){let t=Xy(e,{render:null,specialChars:vpe,addSpecialChars:null});return(t.replaceTabs=!kpe())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,Gv)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,Gv)),t}});function Spe(e={}){return[wg.of(e),Tpe()]}let IT=null;function Tpe(){return IT||(IT=Qs.fromClass(class{constructor(e){this.view=e,this.decorations=nn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(wg)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new wpe({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:s}=n.state,i=vl(t[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=xm(o.text,a,r-o.from);return nn.replace({widget:new Mpe((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=nn.replace({widget:new Epe(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(wg);e.startState.facet(wg)!=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 Cpe="•";function Ape(e){return e>=32?Cpe:e==10?"␤":String.fromCharCode(9216+e)}class Epe extends sa{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=Ape(this.code),r=t.state.phrase("Control character")+" "+(_pe[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Mpe extends sa{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 Npe extends sa{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?a0(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),s=q0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function RT(e){let t=Qs.fromClass(class{constructor(n){this.view=n,this.placeholder=e?nn.set([nn.widget({widget:new Npe(e),side:1}).range(0)]):nn.none}get decorations(){return this.view.state.doc.length?nn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,ct.contentAttributes.of({"aria-placeholder":e})]:t}const Ip="-10000px";class Ipe{constructor(t,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=t.state.facet(n),this.tooltips=this.input.filter(o=>o);let i=null;this.tooltipViews=this.tooltips.map(o=>i=r(o,i))}update(t,n){var r;let s=t.state.facet(this.facet),i=s.filter(l=>l);if(s===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],u=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let f=this.tooltips[d];f&&f.create==c.create&&(u=d)}if(u<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let d=o[l]=this.tooltipViews[u];a&&(a[l]=n[u]),d.update&&d.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,c)=>n[c]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function Rpe(e={}){return vg.of(e)}function jpe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const vg=kt.define({combine:e=>{var t,n,r;return{position:Qe.ios?"absolute":((t=e.find(s=>s.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=e.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||jpe}}}),jT=new WeakMap,AD=Qs.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(vg);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 Ipe(e,ED,(n,r)=>this.createTooltip(n,r),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,r=e.state.facet(vg);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.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),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=Ip,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),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 r of this.manager.tooltipViews)r.dom.remove(),(e=r.destroy)===null||e===void 0||e.call(r);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(Qe.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 r=this.view.scrollDOM.getBoundingClientRect(),s=U_(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.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(vg).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:r,scaleX:s,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:u}=c,d=e.pos[a],f=e.size[a];if(!d||l.clip!==!1&&(d.bottom<=Math.max(n.top,r.top)||d.top>=Math.min(n.bottom,r.bottom)||d.right<Math.max(n.left,r.left)-.1||d.left>Math.min(n.right,r.right)+.1)){u.style.top=Ip;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=m?7:0,y=f.right-f.left,v=(t=jT.get(c))!==null&&t!==void 0?t:f.bottom-f.top,b=c.offset||Dpe,x=this.view.textDirection==Gn.LTR,w=f.width>r.right-r.left?x?r.left:r.right-f.width:x?Math.max(r.left,Math.min(d.left-(m?14:0)+b.x,r.right-y)):Math.min(Math.max(r.left,d.left-y+(m?14:0)-b.x),r.right-y),k=this.above[a];!l.strictSide&&(k?d.top-v-p-b.y<r.top:d.bottom+v+p+b.y>r.bottom)&&k==r.bottom-d.bottom>d.top-r.top&&(k=this.above[a]=!k);let T=(k?d.top-r.top:r.bottom-d.bottom)-p;if(T<v&&c.resize!==!1){if(T<this.view.defaultLineHeight){u.style.top=Ip;continue}jT.set(c,v),u.style.height=(v=T)/i+"px"}else u.style.height&&(u.style.height="");let C=k?d.top-v-p-b.y:d.bottom+p+b.y,A=w+y;if(c.overlap!==!0)for(let L of o)L.left<A&&L.right>w&&L.top<C+v&&L.bottom>C&&(C=k?L.top-v-2-p:L.bottom+p+2);if(this.position=="absolute"?(u.style.top=(C-e.parent.top)/i+"px",LT(u,(w-e.parent.left)/s)):(u.style.top=C/i+"px",LT(u,w/s)),m){let L=d.left+(x?b.x:-b.x)-(w+14-7);m.style.left=L/s+"px"}c.overlap!==!0&&o.push({left:w,top:C,right:A,bottom:C+v}),u.classList.toggle("cm-tooltip-above",k),u.classList.toggle("cm-tooltip-below",!k),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=Ip}},{eventObservers:{scroll(){this.maybeMeasure()}}});function LT(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Lpe=ct.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"}}}),Dpe={x:0,y:0},ED=kt.define({enables:[AD,Lpe]});function MD(e,t){let n=e.plugin(AD);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}class hh extends cc{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}hh.prototype.elementClass="";hh.prototype.toDOM=void 0;hh.prototype.mapMode=di.TrackBefore;hh.prototype.startSide=hh.prototype.endSide=-1;hh.prototype.point=!0;const Ope=1024;let Bpe=0;class z4{constructor(t,n){this.from=t,this.to=n}}class dn{constructor(t={}){this.id=Bpe++,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=Zi.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}dn.closedBy=new dn({deserialize:e=>e.split(" ")});dn.openedBy=new dn({deserialize:e=>e.split(" ")});dn.group=new dn({deserialize:e=>e.split(" ")});dn.isolate=new dn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});dn.contextHash=new dn({perNode:!0});dn.lookAhead=new dn({perNode:!0});dn.mounted=new dn({perNode:!0});class u0{constructor(t,n,r,s=!1){this.tree=t,this.overlay=n,this.parser=r,this.bracketed=s}static get(t){return t&&t.props&&t.props[dn.mounted.id]}}const $pe=Object.create(null);class Zi{constructor(t,n,r,s=0){this.name=t,this.props=n,this.id=r,this.flags=s}static define(t){let n=t.props&&t.props.length?Object.create(null):$pe,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new Zi(t.name||"",n,t.id,r);if(t.props){for(let i of t.props)if(Array.isArray(i)||(i=i(s)),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 s}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(dn.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let s of r.split(" "))n[s]=t[r];return r=>{for(let s=r.prop(dn.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}Zi.none=new Zi("",Object.create(null),0,8);const Rp=new WeakMap,DT=new WeakMap;var yr;(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"})(yr||(yr={}));class ss{constructor(t,n,r,s,i){if(this.type=t,this.children=n,this.positions=r,this.length=s,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=u0.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}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 Yv(this.topNode,t)}cursorAt(t,n=0,r=0){let s=Rp.get(this)||this.topNode,i=new Yv(s);return i.moveTo(t,n),Rp.set(this,i._tree),i}get topNode(){return new Yi(this,0,0,null)}resolve(t,n=0){let r=H0(Rp.get(this)||this.topNode,t,n,!1);return Rp.set(this,r),r}resolveInner(t,n=0){let r=H0(DT.get(this)||this.topNode,t,n,!0);return DT.set(this,r),r}resolveStack(t,n=0){return qpe(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,o=t.mode||0,a=(o&yr.IncludeAnonymous)>0;for(let l=this.cursor(o|yr.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(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:Y_(Zi.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new ss(this.type,n,r,s,this.propValues),t.makeTree||((n,r,s)=>new ss(Zi.none,n,r,s)))}static build(t){return Fpe(t)}}ss.empty=new ss(Zi.none,[],[],0);class G_{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 G_(this.buffer,this.index)}}class fc{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return Zi.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],r=this.buffer[t+3],s=this.set.types[n],i=s.name;if(/\W/.test(i)&&!s.isError&&(i=JSON.stringify(i)),t+=4,r==t)return i;let o=[];for(;t<r;)o.push(this.childString(t)),t=this.buffer[t+3];return i+"("+o.join(",")+")"}findChild(t,n,r,s,i){let{buffer:o}=this,a=-1;for(let l=t;l!=n&&!(ND(i,s,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(t,n,r){let s=this.buffer,i=new Uint16Array(n-t),o=0;for(let a=t,l=0;a<n;){i[l++]=s[a++],i[l++]=s[a++]-r;let c=i[l++]=s[a++]-r;i[l++]=s[a++]-t,o=Math.max(o,c)}return new fc(i,o,this.set)}}function ND(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function H0(e,t,n,r){for(var s;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let o=!r&&e instanceof Yi&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=r?0:yr.IgnoreOverlays;if(r)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof Yi&&o.index<0&&((s=a.enter(t,n,i))===null||s===void 0?void 0:s.from)!=o.from&&(e=a);for(;;){let o=e.enter(t,n,i);if(!o)return e;e=o}}class ID{cursor(t=0){return new Yv(this,t)}getChild(t,n=null,r=null){let s=OT(this,t,n,r);return s.length?s[0]:null}getChildren(t,n=null,r=null){return OT(this,t,n,r)}resolve(t,n=0){return H0(this,t,n,!1)}resolveInner(t,n=0){return H0(this,t,n,!0)}matchContext(t){return Kv(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class Yi extends ID{constructor(t,n,r,s){super(),this._tree=t,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,s,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 u=a[t],d=l[t]+o.from,f;if(!(!(i&yr.EnterBracketed&&u instanceof ss&&(f=u0.get(u))&&!f.overlay&&f.bracketed&&r>=d&&r<=d+u.length)&&!ND(s,r,d,d+u.length))){if(u instanceof fc){if(i&yr.ExcludeBuffers)continue;let m=u.findChild(0,u.buffer.length,n,r-d,s);if(m>-1)return new $l(new zpe(o,u,t,d),null,m)}else if(i&yr.IncludeAnonymous||!u.type.isAnonymous||K_(u)){let m;if(!(i&yr.IgnoreMounts)&&(m=u0.get(u))&&!m.overlay)return new Yi(m.tree,d,t,o);let p=new Yi(u,d,t,o);return i&yr.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&yr.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,r=0){let s;if(!(r&yr.IgnoreOverlays)&&(s=u0.get(this._tree))&&s.overlay){let i=t-this.from,o=r&yr.EnterBracketed&&s.bracketed;for(let{from:a,to:l}of s.overlay)if((n>0||o?a<=i:a<i)&&(n<0||o?l>=i:l>i))return new Yi(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}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 OT(e,t,n,r){let s=e.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let o=!1;!o;)if(o=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(t)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function Kv(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class zpe{constructor(t,n,r,s){this.parent=t,this.buffer=n,this.index=r,this.start=s}}class $l extends ID{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,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],t,n-this.context.start,r);return i<0?null:new $l(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,r=0){if(r&yr.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new $l(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 $l(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 $l(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let o=r.buffer[this.index+1];t.push(r.slice(s,i,o)),n.push(0)}return new ss(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function RD(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 r=n instanceof Yi&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new Ppe(s,n)}class Ppe{constructor(t,n){this.heads=t,this.node=n}get next(){return RD(this.heads)}}function qpe(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof Yi?r:r.context.parent;i;i=i.parent)if(i.index<0){let o=i.parent;(s||(s=[r])).push(o.resolve(t,n)),i=o}else{let o=u0.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new Yi(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(H0(a,t,n,!1))}}return s?RD(s):r}class Yv{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&~yr.EnterBracketed,t instanceof Yi)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.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:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[t]],this.from=r+s.buffer[t+1],this.to=r+s.buffer[t+2],!0}yield(t){return t?t instanceof Yi?(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,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],t,n-this.buffer.start,r);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,r=this.mode){return this.buffer?r&yr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&yr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&yr.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,r=this.stack.length-1;if(t<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<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,r,{buffer:s}=this;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(s.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+t,o=t<0?-1:r._tree.children.length;i!=o;i+=t){let a=r._tree.children[i];if(this.mode&yr.IncludeAnonymous||a instanceof fc||!a.type.isAnonymous||K_(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,r=0;if(t&&t.context==this.buffer)e:for(let s=this.index,i=this.stack.length;i>=0;){for(let o=t;o;o=o._parent)if(o.index==s){if(s==this.index)return o;n=o,r=i+1;break e}s=this.stack[--i]}for(let s=r;s<this.stack.length;s++)n=new $l(this.buffer,n,this.stack[s]);return this.bufferNode=new $l(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(t){if(!this.buffer)return Kv(this.node.parent,t);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=t.length-1,i=this.stack.length-1;s>=0;i--){if(i<0)return Kv(this._tree,t,s);let o=r[n.buffer[this.stack[i]]];if(!o.isAnonymous){if(t[s]&&t[s]!=o.name)return!1;s--}}return!0}}function K_(e){return e.children.some(t=>t instanceof fc||!t.type.isAnonymous||K_(t))}function Fpe(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=Ope,reused:i=[],minRepeatType:o=r.types.length}=e,a=Array.isArray(n)?new G_(n,n.length):n,l=r.types,c=0,u=0;function d(T,C,A,L,$,E){let{id:z,start:M,end:U,size:K}=a,J=u,P=c;if(K<0)if(a.next(),K==-1){let j=i[z];A.push(j),L.push(M-T);return}else if(K==-3){c=z;return}else if(K==-4){u=z;return}else throw new RangeError(`Unrecognized record size: ${K}`);let V=l[z],X,te,D=M-T;if(U-M<=s&&(te=v(a.pos-C,$))){let j=new Uint16Array(te.size-te.skip),B=a.pos-te.size,I=j.length;for(;a.pos>B;)I=b(te.start,j,I);X=new fc(j,U-te.start,r),D=te.start-T}else{let j=a.pos-K;a.next();let B=[],I=[],ne=z>=o?z:-1,de=0,ce=U;for(;a.pos>j;)ne>=0&&a.id==ne&&a.size>=0?(a.end<=ce-s&&(p(B,I,M,de,a.end,ce,ne,J,P),de=B.length,ce=a.end),a.next()):E>2500?f(M,j,B,I):d(M,j,B,I,ne,E+1);if(ne>=0&&de>0&&de<B.length&&p(B,I,M,de,M,ce,ne,J,P),B.reverse(),I.reverse(),ne>-1&&de>0){let Ne=m(V,P);X=Y_(V,B,I,0,B.length,0,U-M,Ne,Ne)}else X=y(V,B,I,U-M,J-U,P)}A.push(X),L.push(D)}function f(T,C,A,L){let $=[],E=0,z=-1;for(;a.pos>C;){let{id:M,start:U,end:K,size:J}=a;if(J>4)a.next();else{if(z>-1&&U<z)break;z<0&&(z=K-s),$.push(M,U,K),E++,a.next()}}if(E){let M=new Uint16Array(E*4),U=$[$.length-2];for(let K=$.length-3,J=0;K>=0;K-=3)M[J++]=$[K],M[J++]=$[K+1]-U,M[J++]=$[K+2]-U,M[J++]=J;A.push(new fc(M,$[2]-U,r)),L.push(U-T)}}function m(T,C){return(A,L,$)=>{let E=0,z=A.length-1,M,U;if(z>=0&&(M=A[z])instanceof ss){if(!z&&M.type==T&&M.length==$)return M;(U=M.prop(dn.lookAhead))&&(E=L[z]+M.length+U)}return y(T,A,L,$,E,C)}}function p(T,C,A,L,$,E,z,M,U){let K=[],J=[];for(;T.length>L;)K.push(T.pop()),J.push(C.pop()+A-$);T.push(y(r.types[z],K,J,E-$,M-E,U)),C.push($-A)}function y(T,C,A,L,$,E,z){if(E){let M=[dn.contextHash,E];z=z?[M].concat(z):[M]}if($>25){let M=[dn.lookAhead,$];z=z?[M].concat(z):[M]}return new ss(T,C,A,L,z)}function v(T,C){let A=a.fork(),L=0,$=0,E=0,z=A.end-s,M={size:0,start:0,skip:0};e:for(let U=A.pos-T;A.pos>U;){let K=A.size;if(A.id==C&&K>=0){M.size=L,M.start=$,M.skip=E,E+=4,L+=4,A.next();continue}let J=A.pos-K;if(K<0||J<U||A.start<z)break;let P=A.id>=o?4:0,V=A.start;for(A.next();A.pos>J;){if(A.size<0)if(A.size==-3||A.size==-4)P+=4;else break e;else A.id>=o&&(P+=4);A.next()}$=V,L+=K,E+=P}return(C<0||L==T)&&(M.size=L,M.start=$,M.skip=E),M.size>4?M:void 0}function b(T,C,A){let{id:L,start:$,end:E,size:z}=a;if(a.next(),z>=0&&L<o){let M=A;if(z>4){let U=a.pos-(z-4);for(;a.pos>U;)A=b(T,C,A)}C[--A]=M,C[--A]=E-T,C[--A]=$-T,C[--A]=L}else z==-3?c=L:z==-4&&(u=L);return A}let x=[],w=[];for(;a.pos>0;)d(e.start||0,e.bufferStart||0,x,w,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:x.length?w[0]+x[0].length:0;return new ss(l[e.topID],x.reverse(),w.reverse(),k)}const BT=new WeakMap;function _g(e,t){if(!e.isAnonymous||t instanceof fc||t.type!=e)return 1;let n=BT.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof ss)){n=1;break}n+=_g(e,r)}BT.set(t,n)}return n}function Y_(e,t,n,r,s,i,o,a,l){let c=0;for(let p=r;p<s;p++)c+=_g(e,t[p]);let u=Math.ceil(c*1.5/8),d=[],f=[];function m(p,y,v,b,x){for(let w=v;w<b;){let k=w,T=y[w],C=_g(e,p[w]);for(w++;w<b;w++){let A=_g(e,p[w]);if(C+A>=u)break;C+=A}if(w==k+1){if(C>u){let A=p[k];m(A.children,A.positions,0,A.children.length,y[k]+x);continue}d.push(p[k])}else{let A=y[w-1]+p[w-1].length-T;d.push(Y_(e,p,y,k,w,T,A,null,l))}f.push(T+x-i)}}return m(t,n,r,s,0),(a||l)(d,f,o)}class yu{constructor(t,n,r,s,i=!1,o=!1){this.from=t,this.to=n,this.tree=r,this.offset=s,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=[],r=!1){let s=[new yu(0,t.length,t,0,!1,r)];for(let i of n)i.to>t.length&&s.push(i);return s}static applyChanges(t,n,r=128){if(!n.length)return t;let s=[],i=1,o=t.length?t[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;o&&o.from<d;){let f=o;if(l>=f.from||d<=f.to||c){let m=Math.max(f.from,l)-c,p=Math.min(f.to,d)-c;f=m>=p?null:new yu(m,p,f.tree,f.offset+c,a>0,!!u)}if(f&&s.push(f),o.to>d)break;o=i<t.length?t[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return s}}class Upe{startParse(t,n,r){return typeof t=="string"&&(t=new Hpe(t)),r=r?r.length?r.map(s=>new z4(s.from,s.to)):[new z4(0,0)]:[new z4(0,t.length)],this.createParse(t,n||[],r)}parse(t,n,r){let s=this.startParse(t,n,r);for(;;){let i=s.advance();if(i)return i}}}class Hpe{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 dn({perNode:!0});let Vpe=0;class $i{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=Vpe++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let r=typeof t=="string"?t:"?";if(t instanceof $i&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new $i(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(t){let n=new U1(t);return r=>r.modified.indexOf(n)>-1?r:U1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let Wpe=0;class U1{constructor(t){this.name=t,this.instances=[],this.id=Wpe++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(a=>a.base==t&&Gpe(n,a.modified));if(r)return r;let s=[],i=new $i(t.name,s,t,n);for(let a of n)a.instances.push(i);let o=Kpe(n);for(let a of t.set)if(!a.modified.length)for(let l of o)s.push(U1.get(a,l));return i}}function Gpe(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function Kpe(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,s=t.length;r<s;r++)t.push(t[r].concat(e[n]));return t.sort((n,r)=>r.length-n.length)}function Ype(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],o=2,a=s;for(let d=0;;){if(a=="..."&&d>0&&d+3==s.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+s);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),d+=f[0].length,d==s.length)break;let m=s[d++];if(d==s.length&&m=="!"){o=0;break}if(m!="/")throw new RangeError("Invalid path: "+s);a=s.slice(d)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+s);let u=new V0(r,o,l>0?i.slice(0,l):null);t[c]=u.sort(t[c])}}return jD.add(t)}const jD=new dn({combine(e,t){let n,r,s;for(;e||t;){if(!e||t&&e.depth>=t.depth?(s=t,t=t.next):(s=e,e=e.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new V0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class V0{constructor(t,n,r,s){this.tags=t,this.mode=n,this.context=r,this.next=s}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}}V0.empty=new V0([],2,null);function LD(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:r,all:s=null}=t||{};return{style:i=>{let o=s;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:r}}function Xpe(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function Qpe(e,t,n,r=0,s=e.length){let i=new Jpe(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}class Jpe{constructor(t,n,r){this.at=t,this.highlighters=n,this.span=r,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,r,s,i){let{type:o,from:a,to:l}=t;if(a>=r||l<=n)return;o.isTop&&(i=this.highlighters.filter(m=>!m.scope||m.scope(o)));let c=s,u=Zpe(t)||V0.empty,d=Xpe(i,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(s+=(s?" ":"")+d)),this.startSpan(Math.max(n,a),c),u.opaque)return;let f=t.tree&&t.tree.prop(dn.mounted);if(f&&f.overlay){let m=t.node.enter(f.overlay[0].from+a,1),p=this.highlighters.filter(v=>!v.scope||v.scope(f.tree.type)),y=t.firstChild();for(let v=0,b=a;;v++){let x=v<f.overlay.length?f.overlay[v]:null,w=x?x.from+a:l,k=Math.max(n,b),T=Math.min(r,w);if(k<T&&y)for(;t.from<T&&(this.highlightRange(t,k,T,s,i),this.startSpan(Math.min(T,t.to),c),!(t.to>=w||!t.nextSibling())););if(!x||w>r)break;b=x.to+a,b>n&&(this.highlightRange(m.cursor(),Math.max(n,x.from+a),Math.min(r,b),"",p),this.startSpan(Math.min(r,b),c))}y&&t.parent()}else if(t.firstChild()){f&&(s="");do if(!(t.to<=n)){if(t.from>=r)break;this.highlightRange(t,n,r,s,i),this.startSpan(Math.min(r,t.to),c)}while(t.nextSibling());t.parent()}}}function Zpe(e){let t=e.type.prop(jD);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Fe=$i.define,jp=Fe(),_l=Fe(),$T=Fe(_l),zT=Fe(_l),kl=Fe(),Lp=Fe(kl),P4=Fe(kl),jo=Fe(),Fc=Fe(jo),Mo=Fe(),No=Fe(),Xv=Fe(),ff=Fe(Xv),Dp=Fe(),Ge={comment:jp,lineComment:Fe(jp),blockComment:Fe(jp),docComment:Fe(jp),name:_l,variableName:Fe(_l),typeName:$T,tagName:Fe($T),propertyName:zT,attributeName:Fe(zT),className:Fe(_l),labelName:Fe(_l),namespace:Fe(_l),macroName:Fe(_l),literal:kl,string:Lp,docString:Fe(Lp),character:Fe(Lp),attributeValue:Fe(Lp),number:P4,integer:Fe(P4),float:Fe(P4),bool:Fe(kl),regexp:Fe(kl),escape:Fe(kl),color:Fe(kl),url:Fe(kl),keyword:Mo,self:Fe(Mo),null:Fe(Mo),atom:Fe(Mo),unit:Fe(Mo),modifier:Fe(Mo),operatorKeyword:Fe(Mo),controlKeyword:Fe(Mo),definitionKeyword:Fe(Mo),moduleKeyword:Fe(Mo),operator:No,derefOperator:Fe(No),arithmeticOperator:Fe(No),logicOperator:Fe(No),bitwiseOperator:Fe(No),compareOperator:Fe(No),updateOperator:Fe(No),definitionOperator:Fe(No),typeOperator:Fe(No),controlOperator:Fe(No),punctuation:Xv,separator:Fe(Xv),bracket:ff,angleBracket:Fe(ff),squareBracket:Fe(ff),paren:Fe(ff),brace:Fe(ff),content:jo,heading:Fc,heading1:Fe(Fc),heading2:Fe(Fc),heading3:Fe(Fc),heading4:Fe(Fc),heading5:Fe(Fc),heading6:Fe(Fc),contentSeparator:Fe(jo),list:Fe(jo),quote:Fe(jo),emphasis:Fe(jo),strong:Fe(jo),link:Fe(jo),monospace:Fe(jo),strikethrough:Fe(jo),inserted:Fe(),deleted:Fe(),changed:Fe(),invalid:Fe(),meta:Dp,documentMeta:Fe(Dp),annotation:Fe(Dp),processingInstruction:Fe(Dp),definition:$i.defineModifier("definition"),constant:$i.defineModifier("constant"),function:$i.defineModifier("function"),standard:$i.defineModifier("standard"),local:$i.defineModifier("local"),special:$i.defineModifier("special")};for(let e in Ge){let t=Ge[e];t instanceof $i&&(t.name=e)}LD([{tag:Ge.link,class:"tok-link"},{tag:Ge.heading,class:"tok-heading"},{tag:Ge.emphasis,class:"tok-emphasis"},{tag:Ge.strong,class:"tok-strong"},{tag:Ge.keyword,class:"tok-keyword"},{tag:Ge.atom,class:"tok-atom"},{tag:Ge.bool,class:"tok-bool"},{tag:Ge.url,class:"tok-url"},{tag:Ge.labelName,class:"tok-labelName"},{tag:Ge.inserted,class:"tok-inserted"},{tag:Ge.deleted,class:"tok-deleted"},{tag:Ge.literal,class:"tok-literal"},{tag:Ge.string,class:"tok-string"},{tag:Ge.number,class:"tok-number"},{tag:[Ge.regexp,Ge.escape,Ge.special(Ge.string)],class:"tok-string2"},{tag:Ge.variableName,class:"tok-variableName"},{tag:Ge.local(Ge.variableName),class:"tok-variableName tok-local"},{tag:Ge.definition(Ge.variableName),class:"tok-variableName tok-definition"},{tag:Ge.special(Ge.variableName),class:"tok-variableName2"},{tag:Ge.definition(Ge.propertyName),class:"tok-propertyName tok-definition"},{tag:Ge.typeName,class:"tok-typeName"},{tag:Ge.namespace,class:"tok-namespace"},{tag:Ge.className,class:"tok-className"},{tag:Ge.macroName,class:"tok-macroName"},{tag:Ge.propertyName,class:"tok-propertyName"},{tag:Ge.operator,class:"tok-operator"},{tag:Ge.comment,class:"tok-comment"},{tag:Ge.meta,class:"tok-meta"},{tag:Ge.invalid,class:"tok-invalid"},{tag:Ge.punctuation,class:"tok-punctuation"}]);var q4;const Nf=new dn,ege=new dn;class Vo{constructor(t,n,r=[],s=""){this.data=t,this.name=s,kn.prototype.hasOwnProperty("tree")||Object.defineProperty(kn.prototype,"tree",{get(){return po(this)}}),this.parser=n,this.extension=[mh.of(this),kn.languageData.of((i,o,a)=>{let l=PT(i,o,a),c=l.type.prop(Nf);if(!c)return[];let u=i.facet(c),d=l.type.prop(ege);if(d){let f=l.resolve(o-l.from,a);for(let m of d)if(m.test(f,i)){let p=i.facet(m.facet);return m.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(t,n,r=-1){return PT(t,n,r).type.prop(Nf)==this.data}findRegions(t){let n=t.facet(mh);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,o)=>{if(i.prop(Nf)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(dn.mounted);if(a){if(a.tree.prop(Nf)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+i.length});return}else if(a.overlay){let l=r.length;if(s(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof ss&&s(c,i.positions[l]+o)}};return s(po(t),0),r}get allowsNesting(){return!0}}Vo.setState=Nn.define();function PT(e,t,n){let r=e.facet(mh),s=po(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,yr.ExcludeBuffers|yr.EnterBracketed))i.type.isTop&&(s=i);return s}function po(e){let t=e.field(Vo.state,!1);return t?t.tree:ss.empty}class tge{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 r=this.cursorPos-this.string.length;return t<r||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-r,n-r)}}let mf=null;class H1{constructor(t,n,r=[],s,i,o,a,l){this.parser=t,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new H1(t,n,[],ss.empty,0,r,[],null)}startParse(){return this.parser.startParse(new tge(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ss.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t=="number"){let s=Date.now()+t;t=()=>Date.now()>s}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 s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(yu.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,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(yu.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=mf;mf=this;try{return t()}finally{mf=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=qT(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:s,treeLen:i,viewport:o,skipped:a}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((c,u,d,f)=>l.push({fromA:c,toA:u,fromB:d,toB:f})),r=yu.applyChanges(r,l),s=ss.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 u=t.mapPos(c.from,1),d=t.mapPos(c.to,-1);u<d&&a.push({from:u,to:d})}}}return new H1(this.parser,n,r,s,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 r=0;r<this.skipped.length;r++){let{from:s,to:i}=this.skipped[r];s<t.to&&i>t.from&&(this.fragments=qT(this.fragments,s,i),this.skipped.splice(r--,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 Upe{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=mf;if(l){for(let c of s)l.tempSkipped.push(c);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new ss(Zi.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 mf}}function qT(e,t,n){return yu.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class fh{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),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new fh(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=H1.create(t.facet(mh).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new fh(r)}}Vo.state=ra.define({create:fh.init,update(e,t){for(let n of t.effects)if(n.is(Vo.setState))return n.value;return t.startState.facet(mh)!=t.state.facet(mh)?fh.init(t.state):e.apply(t)}});let DD=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(DD=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const F4=typeof navigator<"u"&&(!((q4=navigator.scheduling)===null||q4===void 0)&&q4.isInputPending)?()=>navigator.scheduling.isInputPending():null,nge=Qs.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(Vo.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(Vo.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=DD(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:r,viewport:{to:s}}=this.view,i=r.field(Vo.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!F4?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>F4&&F4()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Vo.setState.of(new fh(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=>fi(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()}}}),mh=kt.define({combine(e){return e.length?e[0]:null},enables:e=>[Vo.state,nge,ct.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),rge=kt.define(),X_=kt.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 V1(e){let t=e.facet(X_);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function W1(e,t){let n="",r=e.tabSize,s=e.facet(X_)[0];if(s=="	"){for(;t>=r;)n+="	",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function OD(e,t){e instanceof kn&&(e=new nb(e));for(let r of e.state.facet(rge)){let s=r(e,t);if(s!==void 0)return s}let n=po(e.state);return n.length>=t?ige(e,n,t):null}class nb{constructor(t,n={}){this.state=t,this.options=n,this.unit=V1(t)}lineAt(t,n=1){let r=this.state.doc.lineAt(t),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==t?{text:"",from:t}:(n<0?s<t:s<=t)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(t,n);return r.slice(t-s,Math.min(r.length,t+100-s))}column(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.countColumn(r,t-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(i+=o-this.countColumn(r,r.search(/\S|$/))),i}countColumn(t,n=t.length){return xm(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:r,from:s}=this.lineAt(t,n),i=this.options.overrideIndentation;if(i){let o=i(s);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const sge=new dn;function ige(e,t,n){let r=t.resolveStack(n),s=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let o=s;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)i.push(o);for(let o=i.length-1;o>=0;o--)r={node:i[o],next:r}}return BD(r,e,n)}function BD(e,t,n){for(let r=e;r;r=r.next){let s=age(r.node);if(s)return s(Q_.create(t,n,r))}return 0}function oge(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function age(e){let t=e.type.prop(sge);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(dn.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>dge(o,!0,1,void 0,i&&!oge(o)?s.from:void 0)}return e.parent==null?lge:null}function lge(){return 0}class Q_ extends nb{constructor(t,n,r){super(t.state,t.options),this.base=t,this.pos=n,this.context=r}get node(){return this.context.node}static create(t,n,r){return new Q_(t,n,r)}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 r=t.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(cge(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return BD(this.context.next,this.base,this.pos)}}function cge(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function uge(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let s=e.options.simulateBreak,i=e.state.doc.lineAt(n.from),o=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let a=n.to;;){let l=t.childAfter(a);if(!l||l==r)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 dge(e,t,n,r,s){let i=e.textAfter,o=i.match(/^\s*/)[0].length,a=r&&i.slice(o,o+r.length)==r||s==e.pos+o,l=uge(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}class rb{constructor(t,n){this.specs=t;let r;function s(a){let l=uc.newName();return(r||(r=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,o=n.scope;this.scope=o instanceof Vo?a=>a.prop(Nf)==o.data:o?a=>a==o:void 0,this.style=LD(t.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new uc(r):null,this.themeType=n.themeType}static define(t,n){return new rb(t,n||{})}}const Qv=kt.define(),$D=kt.define({combine(e){return e.length?[e[0]]:null}});function U4(e){let t=e.facet(Qv);return t.length?t:e.facet($D)}function hge(e,t){let n=[mge],r;return e instanceof rb&&(e.module&&n.push(ct.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push($D.of(e)):r?n.push(Qv.computeN([ct.darkTheme],s=>s.facet(ct.darkTheme)==(r=="dark")?[e]:[])):n.push(Qv.of(e)),n}class fge{constructor(t){this.markCache=Object.create(null),this.tree=po(t.state),this.decorations=this.buildDeco(t,U4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=po(t.state),r=U4(t.state),s=r!=U4(t.startState),{viewport:i}=t.view,o=t.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!s&&n.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(n!=this.tree||t.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=i.to)}buildDeco(t,n){if(!n||!this.tree.length)return nn.none;let r=new Au;for(let{from:s,to:i}of t.visibleRanges)Qpe(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=nn.mark({class:l})))},s,i);return r.finish()}}const mge=qu.high(Qs.fromClass(fge,{decorations:e=>e.decorations})),pge=rb.define([{tag:Ge.meta,color:"#404740"},{tag:Ge.link,textDecoration:"underline"},{tag:Ge.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Ge.emphasis,fontStyle:"italic"},{tag:Ge.strong,fontWeight:"bold"},{tag:Ge.strikethrough,textDecoration:"line-through"},{tag:Ge.keyword,color:"#708"},{tag:[Ge.atom,Ge.bool,Ge.url,Ge.contentSeparator,Ge.labelName],color:"#219"},{tag:[Ge.literal,Ge.inserted],color:"#164"},{tag:[Ge.string,Ge.deleted],color:"#a11"},{tag:[Ge.regexp,Ge.escape,Ge.special(Ge.string)],color:"#e40"},{tag:Ge.definition(Ge.variableName),color:"#00f"},{tag:Ge.local(Ge.variableName),color:"#30a"},{tag:[Ge.typeName,Ge.namespace],color:"#085"},{tag:Ge.className,color:"#167"},{tag:[Ge.special(Ge.variableName),Ge.macroName],color:"#256"},{tag:Ge.definition(Ge.propertyName),color:"#00c"},{tag:Ge.comment,color:"#940"},{tag:Ge.invalid,color:"#f00"}]),gge=1e4,yge="()[]{}",bge=new dn;function Jv(e,t,n){let r=e.prop(t<0?dn.openedBy:dn.closedBy);if(r)return r;if(e.name.length==1){let s=n.indexOf(e.name);if(s>-1&&s%2==(t<0?1:0))return[n[s+t]]}return null}function Zv(e){let t=e.type.prop(bge);return t?t(e.node):e}function Td(e,t,n,r={}){let s=r.maxScanDistance||gge,i=r.brackets||yge,o=po(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=Jv(l.type,n,i);if(c&&l.from<l.to){let u=Zv(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return xge(e,t,n,l,u,c,i)}}return wge(e,t,n,o,a.type,s,i)}function xge(e,t,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let d=Zv(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(Jv(u.type,n,o))c++;else if(Jv(u.type,-n,o)){if(c==0){let d=Zv(u);return{start:l,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function wge(e,t,n,r,s,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},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let f=0;!u.next().done&&f<=i;){let m=u.value;n<0&&(f+=m.length);let p=t+f*n;for(let y=n>0?0:m.length-1,v=n>0?m.length:-1;y!=v;y+=n){let b=o.indexOf(m[y]);if(!(b<0||r.resolveInner(p+y,1).type!=s))if(b%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:p+y,to:p+y+1},matched:b>>1==l>>1};d--}}n>0&&(f+=m.length)}return u.done?{start:c,matched:!1}:null}const vge=Object.create(null),FT=[Zi.none],UT=[],HT=Object.create(null),_ge=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"]])_ge[e]=kge(vge,t);function H4(e,t){UT.indexOf(e)>-1||(UT.push(e),console.warn(t))}function kge(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let u=e[c]||Ge[c];u?typeof u=="function"?l.length?l=l.map(u):H4(c,`Modifier ${c} used at start of tag`):l.length?H4(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:H4(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=HT[s];if(i)return i.id;let o=HT[s]=Zi.define({id:FT.length,name:r,props:[Ype({[r]:n})]});return FT.push(o),o.id}Gn.RTL,Gn.LTR;const Sge=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Z_(e.state,n.from);return r.line?Tge(e):r.block?Age(e):!1};function J_(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=e(t,n);return s?(r(n.update(s)),!0):!1}}const Tge=J_(Nge,0),Cge=J_(zD,0),Age=J_((e,t)=>zD(e,t,Mge(t)),0);function Z_(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const pf=50;function Ege(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-pf,r),o=e.sliceDoc(s,s+pf),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:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let u,d;s-r<=2*pf?u=d=e.sliceDoc(r,s):(u=e.sliceDoc(r,r+pf),d=e.sliceDoc(s-pf,s));let f=/^\s*/.exec(u)[0].length,m=/\s*$/.exec(d)[0].length,p=d.length-m-n.length;return u.slice(f,f+t.length)==t&&d.slice(p,p+n.length)==n?{open:{pos:r+f+t.length,margin:/\s/.test(u.charAt(f+t.length))?1:0},close:{pos:s-m-n.length,margin:/\s/.test(d.charAt(p-1))?1:0}}:null}function Mge(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),s=n.to<=r.to?r:e.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let i=t.length-1;i>=0&&t[i].to>r.from?t[i].to=s.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return t}function zD(e,t,n=t.selection.ranges){let r=n.map(i=>Z_(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>Ege(t,r[o],i.from,i.to));if(e!=2&&!s.every(i=>i))return{changes:t.changes(n.map((i,o)=>s[o]?[]:[{from:i.from,insert:r[o].open+" "},{from:i.to,insert:" "+r[o].close}]))};if(e!=1&&s.some(i=>i)){let i=[];for(let o=0,a;o<s.length;o++)if(a=s[o]){let l=r[o],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function Nge(e,t,n=t.selection.ranges){let r=[],s=-1;e:for(let{from:i,to:o}of n){let a=r.length,l=1e9,c;for(let u=i;u<=o;){let d=t.doc.lineAt(u);if(c==null&&(c=Z_(t,d.from).line,!c))continue e;if(d.from>s&&(i==o||o>d.from)){s=d.from;let f=/^\s*/.exec(d.text)[0].length,m=f==d.length,p=d.text.slice(f,f+c.length)==c?f:-1;f<d.text.length&&f<l&&(l=f),r.push({line:d,comment:p,token:c,indent:f,empty:m,single:!1})}u=d.to+1}if(l<1e9)for(let u=a;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=l);r.length==a+1&&(r[a].single=!0)}if(e!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:d}of r)(d||!u)&&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&&r.some(i=>i.comment>=0)){let i=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const e3=nl.define(),Ige=nl.define(),Rge=kt.define(),PD=kt.define({combine(e){return Xy(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,s)=>t(r,s)||n(r,s)})}}),qD=ra.define({create(){return Wo.empty},update(e,t){let n=t.state.facet(PD),r=t.annotation(e3);if(r){let l=Gs.fromTransaction(t,r.selection),c=r.side,u=c==0?e.undone:e.done;return l?u=G1(u,u.length,n.minDepth,l):u=VD(u,t.startState.selection),new Wo(c==0?r.rest:u,c==0?u:r.rest)}let s=t.annotation(Ige);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Or.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=Gs.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)),(s=="full"||s=="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 Wo(e.done.map(Gs.fromJSON),e.undone.map(Gs.fromJSON))}});function FD(e={}){return[qD,PD.of(e),ct.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?UD:t.inputType=="historyRedo"?t3:null;return r?(t.preventDefault(),r(n)):!1}})]}function sb(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(qD,!1);if(!s)return!1;let i=s.pop(e,n,t);return i?(r(i),!0):!1}}const UD=sb(0,!1),t3=sb(1,!1),jge=sb(0,!0),Lge=sb(1,!0);class Gs{constructor(t,n,r,s,i){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(t){return new Gs(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;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:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(t){return new Gs(t.changes&&Lr.fromJSON(t.changes),[],t.mapped&&Yo.fromJSON(t.mapped),t.startSelection&&Me.fromJSON(t.startSelection),t.selectionsAfter.map(Me.fromJSON))}static fromTransaction(t,n){let r=Vi;for(let s of t.startState.facet(Rge)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new Gs(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Vi)}static selection(t){return new Gs(void 0,Vi,void 0,void 0,t)}}function G1(e,t,n,r){let s=t+1>n+20?t-n-1:0,i=e.slice(s,t);return i.push(r),i}function Dge(e,t){let n=[],r=!1;return e.iterChangedRanges((s,i)=>n.push(s,i)),t.iterChangedRanges((s,i,o,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&o<=u&&(r=!0)}}),r}function Oge(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function HD(e,t){return e.length?t.length?e.concat(t):e:t}const Vi=[],Bge=200;function VD(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Bge));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),G1(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Gs.selection([t])]}function $ge(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 V4(e,t){if(!e.length)return e;let n=e.length,r=Vi;for(;n;){let s=zge(e[n-1],t,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=e.slice(0,n);return i[n-1]=s,i}else t=s.mapped,n--,r=s.selectionsAfter}return r.length?[Gs.selection(r)]:Vi}function zge(e,t,n){let r=HD(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):Vi,n);if(!e.changes)return Gs.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new Gs(s,Nn.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}const Pge=/^(input\.type|delete)($|\.)/;class Wo{constructor(t,n,r=0,s=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Wo(this.done,this.undone):this}addChanges(t,n,r,s,i){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&t.changes&&(!r||Pge.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,Dge(a.changes,t.changes))||r=="input.type.compose")?o=G1(o,o.length-1,s.minDepth,new Gs(t.changes.compose(a.changes),HD(Nn.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,Vi)):o=G1(o,o.length,s.minDepth,t),new Wo(o,Vi,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Vi;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Oge(i[i.length-1],t)?this:new Wo(VD(this.done,t),this.undone,n,r)}addMapping(t){return new Wo(V4(this.done,t),V4(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let s=t==0?this.done:this.undone;if(s.length==0)return null;let i=s[s.length-1],o=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:e3.of({side:t,rest:$ge(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?Vi:s.slice(0,s.length-1);return i.mapped&&(a=V4(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:e3.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Wo.empty=new Wo(Vi,Vi);const WD=[{key:"Mod-z",run:UD,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:t3,preventDefault:!0},{linux:"Ctrl-Shift-z",run:t3,preventDefault:!0},{key:"Mod-u",run:jge,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Lge,preventDefault:!0}];function Lh(e,t){return Me.create(e.ranges.map(t),e.mainIndex)}function yo(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function bo({state:e,dispatch:t},n){let r=Lh(e.selection,n);return r.eq(e.selection,!0)?!1:(t(yo(e,r)),!0)}function ib(e,t){return Me.cursor(t?e.to:e.from)}function GD(e,t){return bo(e,n=>n.empty?e.moveByChar(n,t):ib(n,t))}function ys(e){return e.textDirectionAt(e.state.selection.main.head)==Gn.LTR}const KD=e=>GD(e,!ys(e)),YD=e=>GD(e,ys(e));function XD(e,t){return bo(e,n=>n.empty?e.moveByGroup(n,t):ib(n,t))}const qge=e=>XD(e,!ys(e)),Fge=e=>XD(e,ys(e));function Uge(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function ob(e,t,n){let r=po(e).resolveInner(t.head),s=n?dn.closedBy:dn.openedBy;for(let l=t.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;Uge(e,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?Td(e,r.from,1):Td(e,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Me.cursor(a,n?-1:1)}const Hge=e=>bo(e,t=>ob(e.state,t,!ys(e))),Vge=e=>bo(e,t=>ob(e.state,t,ys(e)));function QD(e,t){return bo(e,n=>{if(!n.empty)return ib(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const JD=e=>QD(e,!1),ZD=e=>QD(e,!0);function eO(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(ct.scrollMargins)){let o=i(e);o!=null&&o.top&&(n=Math.max(o==null?void 0:o.top,n)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}s=e.scrollDOM.clientHeight-n-r}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,s-5)}}function tO(e,t){let n=eO(e),{state:r}=e,s=Lh(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):ib(o,t));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let o=e.coordsAtPos(r.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=ct.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(yo(r,s),{effects:i}),!0}const VT=e=>tO(e,!1),n3=e=>tO(e,!0);function _c(e,t,n){let r=e.lineBlockAt(t.head),s=e.moveToLineBoundary(t,n);if(s.head==t.head&&s.head!=(n?r.to:r.from)&&(s=e.moveToLineBoundary(t,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&t.head!=r.from+i&&(s=Me.cursor(r.from+i))}return s}const Wge=e=>bo(e,t=>_c(e,t,!0)),Gge=e=>bo(e,t=>_c(e,t,!1)),Kge=e=>bo(e,t=>_c(e,t,!ys(e))),Yge=e=>bo(e,t=>_c(e,t,ys(e))),Xge=e=>bo(e,t=>Me.cursor(e.lineBlockAt(t.head).from,1)),Qge=e=>bo(e,t=>Me.cursor(e.lineBlockAt(t.head).to,-1));function Jge(e,t,n){let r=!1,s=Lh(e.selection,i=>{let o=Td(e,i.head,-1)||Td(e,i.head,1)||i.head>0&&Td(e,i.head-1,1)||i.head<e.doc.length&&Td(e,i.head+1,-1);if(!o||!o.end)return i;r=!0;let a=o.start.from==i.head?o.end.to:o.end.from;return Me.cursor(a)});return r?(t(yo(e,s)),!0):!1}const Zge=({state:e,dispatch:t})=>Jge(e,t);function eo(e,t){let n=Lh(e.state.selection,r=>{let s=t(r);return Me.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(yo(e.state,n)),!0)}function nO(e,t){return eo(e,n=>e.moveByChar(n,t))}const rO=e=>nO(e,!ys(e)),sO=e=>nO(e,ys(e));function iO(e,t){return eo(e,n=>e.moveByGroup(n,t))}const e1e=e=>iO(e,!ys(e)),t1e=e=>iO(e,ys(e)),n1e=e=>eo(e,t=>ob(e.state,t,!ys(e))),r1e=e=>eo(e,t=>ob(e.state,t,ys(e)));function oO(e,t){return eo(e,n=>e.moveVertically(n,t))}const aO=e=>oO(e,!1),lO=e=>oO(e,!0);function cO(e,t){return eo(e,n=>e.moveVertically(n,t,eO(e).height))}const WT=e=>cO(e,!1),GT=e=>cO(e,!0),s1e=e=>eo(e,t=>_c(e,t,!0)),i1e=e=>eo(e,t=>_c(e,t,!1)),o1e=e=>eo(e,t=>_c(e,t,!ys(e))),a1e=e=>eo(e,t=>_c(e,t,ys(e))),l1e=e=>eo(e,t=>Me.cursor(e.lineBlockAt(t.head).from)),c1e=e=>eo(e,t=>Me.cursor(e.lineBlockAt(t.head).to)),KT=({state:e,dispatch:t})=>(t(yo(e,{anchor:0})),!0),YT=({state:e,dispatch:t})=>(t(yo(e,{anchor:e.doc.length})),!0),XT=({state:e,dispatch:t})=>(t(yo(e,{anchor:e.selection.main.anchor,head:0})),!0),QT=({state:e,dispatch:t})=>(t(yo(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),u1e=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),d1e=({state:e,dispatch:t})=>{let n=ab(e).map(({from:r,to:s})=>Me.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:Me.create(n),userEvent:"select"})),!0},h1e=({state:e,dispatch:t})=>{let n=Lh(e.selection,r=>{let s=po(e),i=s.resolveStack(r.from,1);if(r.empty){let o=s.resolveStack(r.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<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return Me.range(a.to,a.from)}return r});return n.eq(e.selection)?!1:(t(yo(e,n)),!0)};function uO(e,t){let{state:n}=e,r=n.selection,s=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){s.some(c=>c.head==l.head)||s.push(l);break}else{if(l.head==a.head)break;a=l}}}return s.length==r.ranges.length?!1:(e.dispatch(yo(n,Me.create(s,s.length-1))),!0)}const f1e=e=>uO(e,!1),m1e=e=>uO(e,!0),p1e=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Me.create([n.main]):n.main.empty||(r=Me.create([Me.cursor(n.main.head)])),r?(t(yo(e,r)),!0):!1};function km(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,s=r.changeByRange(i=>{let{from:o,to:a}=i;if(o==a){let l=t(i);l<o?(n="delete.backward",l=Op(e,l,!1)):l>o&&(n="delete.forward",l=Op(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Op(e,o,!1),a=Op(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Me.cursor(o,o<i.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?ct.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Op(e,t,n){if(e instanceof ct)for(let r of e.state.facet(ct.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}const dO=(e,t,n)=>km(e,r=>{let s=r.from,{state:i}=e,o=i.doc.lineAt(s),a,l;if(n&&!t&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,s-o.from))){if(a[a.length-1]=="	")return s-1;let c=xm(a,i.tabSize),u=c%V1(i)||V1(i);for(let d=0;d<u&&a[a.length-1-d]==" ";d++)s--;l=s}else l=ms(o.text,s-o.from,t,t)+o.from,l==s&&o.number!=(t?i.doc.lines:1)?l+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,s-o.from))&&(l=ms(o.text,l-o.from,!1,!1)+o.from);return l}),r3=e=>dO(e,!1,!0),hO=e=>dO(e,!0,!1),fO=(e,t)=>km(e,n=>{let r=n.head,{state:s}=e,i=s.doc.lineAt(r),o=s.charCategorizer(r);for(let a=null;;){if(r==(t?i.to:i.from)){r==n.head&&i.number!=(t?s.doc.lines:1)&&(r+=t?1:-1);break}let l=ms(i.text,r-i.from,t)+i.from,c=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||r!=n.head)&&(a=u),r=l}return r}),mO=e=>fO(e,!1),g1e=e=>fO(e,!0),y1e=e=>km(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),b1e=e=>km(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),x1e=e=>km(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),w1e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:hn.of(["",""])},range:Me.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},v1e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let s=r.from,i=e.doc.lineAt(s),o=s==i.from?s-1:ms(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:ms(i.text,s-i.from,!0)+i.from;return{changes:{from:o,to:a,insert:e.doc.slice(s,a).append(e.doc.slice(o,s))},range:Me.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ab(e){let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.from),i=e.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=e.doc.lineAt(r.to-1)),n>=s.number){let o=t[t.length-1];o.to=i.to,o.ranges.push(r)}else t.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return t}function pO(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of ab(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){r.push({from:i.to,to:o.to},{from:i.from,insert:o.text+e.lineBreak});for(let l of i.ranges)s.push(Me.range(Math.min(e.doc.length,l.anchor+a),Math.min(e.doc.length,l.head+a)))}else{r.push({from:o.from,to:i.from},{from:i.to,insert:e.lineBreak+o.text});for(let l of i.ranges)s.push(Me.range(l.anchor-a,l.head-a))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Me.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const _1e=({state:e,dispatch:t})=>pO(e,t,!1),k1e=({state:e,dispatch:t})=>pO(e,t,!0);function gO(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of ab(e))n?r.push({from:i.from,insert:e.doc.slice(i.from,i.to)+e.lineBreak}):r.push({from:i.to,insert:e.lineBreak+e.doc.slice(i.from,i.to)});let s=e.changes(r);return t(e.update({changes:s,selection:e.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const S1e=({state:e,dispatch:t})=>gO(e,t,!1),T1e=({state:e,dispatch:t})=>gO(e,t,!0),C1e=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(ab(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=Lh(t.selection,s=>{let i;if(e.lineWrapping){let o=e.lineBlockAt(s.head),a=e.coordsAtPos(s.head,s.assoc||1);a&&(i=o.bottom+e.documentTop-a.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,i)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function A1e(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=po(e).resolveInner(t),r=n.childBefore(t),s=n.childAfter(t),i;return r&&s&&r.to<=t&&s.from>=t&&(i=r.type.prop(dn.closedBy))&&i.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const JT=yO(!1),E1e=yO(!0);function yO(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(s=>{let{from:i,to:o}=s,a=t.doc.lineAt(i),l=!e&&i==o&&A1e(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new nb(t,{simulateBreak:i,simulateDoubleBreak:!!l}),u=OD(c,i);for(u==null&&(u=xm(/^\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 d=["",W1(t,u)];return l&&d.push(W1(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:hn.of(d)},range:Me.cursor(i+1+d[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function e6(e,t){let n=-1;return e.changeByRange(r=>{let s=[];for(let o=r.from;o<=r.to;){let a=e.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(t(a,s,r),n=a.number),o=a.to+1}let i=e.changes(s);return{changes:s,range:Me.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const M1e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new nb(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=e6(e,(i,o,a)=>{let l=OD(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=W1(e,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+c.length,insert:u}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},N1e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(e6(e,(n,r)=>{r.push({from:n.from,insert:e.facet(X_)})}),{userEvent:"input.indent"})),!0),I1e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(e6(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=xm(s,e.tabSize),o=0,a=W1(e,Math.max(0,i-V1(e)));for(;o<s.length&&o<a.length&&s.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:n.from+o,to:n.from+s.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),R1e=e=>(e.setTabFocusMode(),!0),j1e=[{key:"Ctrl-b",run:KD,shift:rO,preventDefault:!0},{key:"Ctrl-f",run:YD,shift:sO},{key:"Ctrl-p",run:JD,shift:aO},{key:"Ctrl-n",run:ZD,shift:lO},{key:"Ctrl-a",run:Xge,shift:l1e},{key:"Ctrl-e",run:Qge,shift:c1e},{key:"Ctrl-d",run:hO},{key:"Ctrl-h",run:r3},{key:"Ctrl-k",run:y1e},{key:"Ctrl-Alt-h",run:mO},{key:"Ctrl-o",run:w1e},{key:"Ctrl-t",run:v1e},{key:"Ctrl-v",run:n3}],L1e=[{key:"ArrowLeft",run:KD,shift:rO,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:qge,shift:e1e,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Kge,shift:o1e,preventDefault:!0},{key:"ArrowRight",run:YD,shift:sO,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Fge,shift:t1e,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Yge,shift:a1e,preventDefault:!0},{key:"ArrowUp",run:JD,shift:aO,preventDefault:!0},{mac:"Cmd-ArrowUp",run:KT,shift:XT},{mac:"Ctrl-ArrowUp",run:VT,shift:WT},{key:"ArrowDown",run:ZD,shift:lO,preventDefault:!0},{mac:"Cmd-ArrowDown",run:YT,shift:QT},{mac:"Ctrl-ArrowDown",run:n3,shift:GT},{key:"PageUp",run:VT,shift:WT},{key:"PageDown",run:n3,shift:GT},{key:"Home",run:Gge,shift:i1e,preventDefault:!0},{key:"Mod-Home",run:KT,shift:XT},{key:"End",run:Wge,shift:s1e,preventDefault:!0},{key:"Mod-End",run:YT,shift:QT},{key:"Enter",run:JT,shift:JT},{key:"Mod-a",run:u1e},{key:"Backspace",run:r3,shift:r3,preventDefault:!0},{key:"Delete",run:hO,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:mO,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:g1e,preventDefault:!0},{mac:"Mod-Backspace",run:b1e,preventDefault:!0},{mac:"Mod-Delete",run:x1e,preventDefault:!0}].concat(j1e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),bO=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Hge,shift:n1e},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Vge,shift:r1e},{key:"Alt-ArrowUp",run:_1e},{key:"Shift-Alt-ArrowUp",run:S1e},{key:"Alt-ArrowDown",run:k1e},{key:"Shift-Alt-ArrowDown",run:T1e},{key:"Mod-Alt-ArrowUp",run:f1e},{key:"Mod-Alt-ArrowDown",run:m1e},{key:"Escape",run:p1e},{key:"Mod-Enter",run:E1e},{key:"Alt-l",mac:"Ctrl-l",run:d1e},{key:"Mod-i",run:h1e,preventDefault:!0},{key:"Mod-[",run:I1e},{key:"Mod-]",run:N1e},{key:"Mod-Alt-\\",run:M1e},{key:"Shift-Mod-k",run:C1e},{key:"Shift-Mod-\\",run:Zge},{key:"Mod-/",run:Sge},{key:"Alt-A",run:Cge},{key:"Ctrl-m",mac:"Shift-Alt-m",run:R1e}].concat(L1e);class xO{constructor(t,n,r,s){this.state=t,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=po(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),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(wO(t,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,r){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function ZT(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 D1e(e){let t=Object.create(null),n=Object.create(null);for(let{label:s}of e){t[s[0]]=!0;for(let i=1;i<s.length;i++)n[s[i]]=!0}let r=ZT(t)+ZT(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function O1e(e){let t=e.map(s=>typeof s=="string"?{label:s}:s),[n,r]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:D1e(t);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:t,validFor:n}:null}}class eC{constructor(t,n,r,s){this.completion=t,this.source=n,this.match=r,this.score=s}}function bu(e){return e.selection.main.from}function wO(e,t){var n;let{source:r}=e,s=t&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?e:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const vO=nl.define();function B1e(e,t,n,r){let{main:s}=e.selection,i=n-s.from,o=r-s.from;return{...e.changeByRange(a=>{if(a!=s&&n!=r&&e.sliceDoc(a.from+i,a.from+o)!=e.sliceDoc(n,r))return{range:a};let l=e.toText(t);return{changes:{from:a.from+i,to:r==s.from?a.to:a.from+o,insert:l},range:Me.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const tC=new WeakMap;function $1e(e){if(!Array.isArray(e))return e;let t=tC.get(e);return t||tC.set(e,t=O1e(e)),t}const K1=Nn.define(),W0=Nn.define();class z1e{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 r=vl(t,n),s=ld(r);this.chars.push(r);let i=t.slice(n,n+s),o=i.toUpperCase();this.folded.push(vl(o==i?i.toLowerCase():o,0)),n+=s}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:r,any:s,precise:i,byWord:o}=this;if(n.length==1){let x=vl(t,0),w=ld(x),k=w==t.length?0:-100;if(x!=n[0])if(x==r[0])k+=-200;else return null;return this.ret(k,[0,w])}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 x=0,w=Math.min(t.length,200);x<w&&c<l;){let k=vl(t,x);(k==n[c]||k==r[c])&&(s[c++]=x),x+=ld(k)}if(c<l)return null}let u=0,d=0,f=!1,m=0,p=-1,y=-1,v=/[a-z]/.test(t),b=!0;for(let x=0,w=Math.min(t.length,200),k=0;x<w&&d<l;){let T=vl(t,x);a<0&&(u<l&&T==n[u]&&(i[u++]=x),m<l&&(T==n[m]||T==r[m]?(m==0&&(p=x),y=x+1,m++):m=0));let C,A=T<255?T>=48&&T<=57||T>=97&&T<=122?2:T>=65&&T<=90?1:0:(C=l0e(T))!=C.toLowerCase()?1:C!=C.toUpperCase()?2:0;(!x||A==1&&v||k==0&&A!=0)&&(n[d]==T||r[d]==T&&(f=!0)?o[d++]=x:o.length&&(b=!1)),k=A,x+=ld(T)}return d==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]):d==l?this.result(-100+(f?-200:0)+-700+(b?0:-1100),o,t):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,t)}result(t,n,r){let s=[],i=0;for(let o of n){let a=o+(this.astral?ld(vl(r,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(t-r.length,s)}}class P1e{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),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(t.length==this.pattern.length?0:-100),this)}}const Wr=kt.define({combine(e){return Xy(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:q1e,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)=>r=>nC(t(r),n(r)),optionClass:(t,n)=>r=>nC(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function nC(e,t){return e?t?e+" "+t:e:t}function q1e(e,t,n,r,s,i){let o=e.textDirection==Gn.RTL,a=o,l=!1,c="top",u,d,f=t.left-s.left,m=s.right-t.right,p=r.right-r.left,y=r.bottom-r.top;if(a&&f<Math.min(p,m)?a=!1:!a&&m<Math.min(p,f)&&(a=!0),p<=(a?f:m))u=Math.max(s.top,Math.min(n.top,s.bottom-y))-t.top,d=Math.min(400,a?f:m);else{l=!0,d=Math.min(400,(o?t.right:s.right-t.left)-30);let x=s.bottom-t.bottom;x>=y||x>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let v=(t.bottom-t.top)/i.offsetHeight,b=(t.right-t.left)/i.offsetWidth;return{style:`${c}: ${u/v}px; max-width: ${d/b}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const t6=Nn.define();function F1e(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,s,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 u=i[c++],d=i[c++];u>l&&o.appendChild(document.createTextNode(a.slice(l,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(u,d))),f.className="cm-completionMatchedText",l=d}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),t.sort((n,r)=>n.position-r.position).map(n=>n.render)}function W4(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let s=Math.floor(t/n);return{from:s*n,to:(s+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}class U1e{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=t.state.field(n),{options:i,selected:o}=s.open,a=t.state.facet(Wr);this.optionContent=F1e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=W4(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 u=l.target,d;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(d=/-(\d+)$/.exec(u.id))&&+d[1]<c.length){this.applyCompletion(t,c[+d[1]]),l.preventDefault();return}if(l.target==this.list){let u=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;u!=null&&(t.dispatch({effects:t6.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(Wr).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:W0.of(null)})}),this.showOptions(i,s.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 r=t.state.field(this.stateField),s=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=s){let{options:i,selected:o,disabled:a}=r.open;(!s.open||s.open.options!=i)&&(this.range=W4(i.length,o,t.state.facet(Wr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),a!=((n=s.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 r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);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=W4(n.options.length,n.selected,this.view.state.facet(Wr).maxRenderedOptions),this.showOptions(n.options,t.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,s)}).catch(a=>fi(this.view.state,a,"completion info")):(this.addInfoPane(o,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:s,destroy:i}=t;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&V1e(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=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 s.top>Math.min(i.bottom,n.bottom)-10||s.bottom<Math.max(i.top,n.top)+10?null:this.view.state.facet(Wr).positionInfo(this.view,n,s,r,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,r){const s=document.createElement("ul");s.id=n,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let i=null;for(let o=r.from;o<r.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>r.from||r.from==0))if(i=f,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let m=s.appendChild(document.createElement("completion-section"));m.textContent=f}}const u=s.appendChild(document.createElement("li"));u.id=n+"-"+o,u.setAttribute("role","option");let d=this.optionClass(a);d&&(u.className=d);for(let f of this.optionContent){let m=f(a,this.view.state,this.view,l);m&&u.appendChild(m)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.to<t.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function H1e(e,t){return n=>new U1e(n,e,t)}function V1e(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/s:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/s)}function rC(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function W1e(e,t){let n=[],r=null,s=null,i=u=>{n.push(u);let{section:d}=u.completion;if(d){r||(r=[]);let f=typeof d=="string"?d:d.name;r.some(m=>m.name==f)||r.push(typeof d=="string"?{name:f}:d)}},o=t.facet(Wr);for(let u of e)if(u.hasResult()){let d=u.result.getMatch;if(u.result.filter===!1)for(let f of u.result.options)i(new eC(f,u.source,d?d(f):[],1e9-n.length));else{let f=t.sliceDoc(u.from,u.to),m,p=o.filterStrict?new P1e(f):new z1e(f);for(let y of u.result.options)if(m=p.match(y.label)){let v=y.displayLabel?d?d(y,m.matched):[]:m.matched,b=m.score+(y.boost||0);if(i(new eC(y,u.source,v,b)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:x}=y.section;s||(s=Object.create(null)),s[x]=Math.max(b,s[x]||-1e9)}}}}if(r){let u=Object.create(null),d=0,f=(m,p)=>(m.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[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 r.sort(f))d-=1e5,u[m.name]=d;for(let m of n){let{section:p}=m.completion;p&&(m.score+=u[typeof p=="string"?p:p.name])}}let a=[],l=null,c=o.compareCompletions;for(let u of n.sort((d,f)=>f.score-d.score||c(d.completion,f.completion))){let d=u.completion;!l||l.label!=d.label||l.detail!=d.detail||l.type!=null&&d.type!=null&&l.type!=d.type||l.apply!=d.apply||l.boost!=d.boost?a.push(u):rC(u.completion)>rC(l)&&(a[a.length-1]=u),l=u.completion}return a}class Cd{constructor(t,n,r,s,i,o){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new Cd(this.options,sC(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,s,i,o){if(s&&!o&&t.some(c=>c.isPending))return s.setDisabled();let a=W1e(t,n);if(!a.length)return s&&t.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(Wr).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let u=0;u<a.length;u++)if(a[u].completion==c){l=u;break}}return new Cd(a,sC(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:J1e,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(t){return new Cd(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Cd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Y1{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new Y1(X1e,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Wr),i=(r.override||n.languageDataAt("autocomplete",bu(n)).map($1e)).map(l=>(this.active.find(u=>u.source==l)||new Wi(l,this.active.some(u=>u.state!=0)?1:0)).update(t,r));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(n6));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!G1e(i,this.active)||a?o=Cd.build(i,n,this.id,o,r,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 Wi(l.source,0):l));for(let l of t.effects)l.is(t6)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new Y1(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?K1e:Y1e}}function G1e(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let s=n==e.length,i=r==t.length;if(s||i)return s==i;if(e[n++].result!=t[r++].result)return!1}}const K1e={"aria-autocomplete":"list"},Y1e={};function sC(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const X1e=[];function _O(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(vO);if(r&&t.activateOnCompletion(r))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 Wi{constructor(t,n,r=!1){this.source=t,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=_O(t,n),s=this;(r&8||r&16&&this.touches(t))&&(s=new Wi(s.source,0)),r&4&&s.state==0&&(s=new Wi(this.source,1)),s=s.updateFor(t,r);for(let i of t.effects)if(i.is(K1))s=new Wi(s.source,1,i.value);else if(i.is(W0))s=new Wi(s.source,0);else if(i.is(n6))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(bu(t.state))}}class qd extends Wi{constructor(t,n,r,s,i,o){super(t,3,n),this.limit=r,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let s=this.result;s.map&&!t.changes.empty&&(s=s.map(s,t.changes));let i=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),a=bu(t.state);if(a>o||!s||n&2&&(bu(t.startState)==this.from||a<this.limit))return new Wi(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return Q1e(s.validFor,t.state,i,o)?new qd(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new xO(t.state,a,!1)))?new qd(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:bu(t.state)):new Wi(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 qd(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Wi(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Q1e(e,t,n,r){if(!e)return!1;let s=t.sliceDoc(n,r);return typeof e=="function"?e(s,n,r,t):wO(e,!0).test(s)}const n6=Nn.define({map(e,t){return e.map(n=>n.map(t))}}),Es=ra.define({create(){return Y1.start()},update(e,t){return e.update(t)},provide:e=>[ED.from(e,t=>t.tooltip),ct.contentAttributes.from(e,t=>t.attrs)]});function r6(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Es).active.find(s=>s.source==t.source);return r instanceof qd?(typeof n=="string"?e.dispatch({...B1e(e.state,n,r.from,r.to),annotations:vO.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const J1e=H1e(Es,r6);function zl(e,t="option"){return n=>{let r=n.state.field(Es,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Wr).interactionDelay)return!1;let s=1,i;t=="page"&&(i=MD(n,r.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+s*(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:t6.of(a)}),!0}}const kO=e=>{let t=e.state.field(Es,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Wr).interactionDelay?!1:r6(e,t.open.options[t.open.selected])},Fd=e=>e.state.field(Es,!1)?(e.dispatch({effects:K1.of(!0)}),!0):!1,kg=e=>{let t=e.state.field(Es,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:W0.of(null)}),!0)};class Z1e{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const eye=50,tye=1e3,nye=Qs.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(Es).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Es),n=e.state.facet(Wr);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Es)==t)return;let r=e.transactions.some(i=>{let o=_O(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(r||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>eye&&Date.now()-o.time>tye){for(let a of o.context.abortListeners)try{a()}catch(l){fi(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(K1)))&&(this.pendingStart=!0);let s=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(),s):-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(Es);for(let n of t.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Wr).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=bu(t),r=new xO(t,n,e.explicit,this.view),s=new Z1e(e,r);this.running.push(s),Promise.resolve(e.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:W0.of(null)}),fi(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(Wr).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Wr),r=this.view.state.field(Es);for(let s=0;s<this.running.length;s++){let i=this.running[s];if(i.done===void 0)continue;if(this.running.splice(s--,1),i.done){let a=bu(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new qd(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let u of i.updates)c=c.update(u,n);if(c.hasResult()){t.push(c);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Wi(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||r.open&&r.open.disabled)&&this.view.dispatch({effects:n6.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Es,!1);if(t&&t.tooltip&&this.view.state.facet(Wr).closeOnBlur){let n=t.open&&MD(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:W0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:K1.of(!1)}),20),this.composing=0}}}),rye=typeof navigator=="object"&&/Win/.test(navigator.platform),sye=qu.highest(ct.domEventHandlers({keydown(e,t){let n=t.state.field(Es,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(rye&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(o=>o.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(e.key)>-1&&r6(t,r),!1}})),iye=ct.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"}}}),SO=new class extends cc{};SO.startSide=1;SO.endSide=-1;function oye(e={}){return[sye,Es,Wr.of(e),nye,lye,iye]}const aye=[{key:"Ctrl-Space",run:Fd},{mac:"Alt-`",run:Fd},{mac:"Alt-i",run:Fd},{key:"Escape",run:kg},{key:"ArrowDown",run:zl(!0)},{key:"ArrowUp",run:zl(!1)},{key:"PageDown",run:zl(!0,"page")},{key:"PageUp",run:zl(!1,"page")},{key:"Enter",run:kO}],lye=qu.highest(U0.computeN([Wr],e=>e.facet(Wr).defaultKeymap?[aye]:[]));function si(e){let t=e.field(Es,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const cye=[Spe(),FD(),ppe(),hge(pge,{fallback:!0}),U0.of([...bO,...WD])],G0=["custom","skill","system"];function s3(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function uye(e,t,n=G0){return iC(s3(e),n)-iC(s3(t),n)}function iC(e,t=G0){const n=t.indexOf(e);return n>=0?n:t.length+G0.indexOf(e)}const s6=String.raw`([^\s/]+)`,lb={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:"安装扩展"}]},cb={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"}]},ub={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 文件列表"}]},db={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 dye(e,t,n,r,s){if(e==="skills"&&t.length===0)return!n||n.length===0?null:n.map(a=>({name:a.name,description:a.description}));let o=(r==="zh-CN"?lb:cb)[e];if(o||(o=(r==="zh-CN"?ub:db)[e]),!o&&t.length===0&&(s!=null&&s.length)&&(o=s.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 TO(e,t,n){const r=e.toLowerCase(),s=t.toLowerCase(),i=r.startsWith(n),o=s.startsWith(n);return i!==o?i?-1:1:e.localeCompare(t)}function hye(e,t,n,r){const s=uye(e,t,r);return s!==0?s:n?TO(e.name,t.name,n):0}const fye={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function mye(e,t){if(!e||e.includes(" ")||/^[/@!?]/.test(e))return null;const n=e.toLowerCase(),r=t.find(s=>s.name.toLowerCase().startsWith(n));return r?`/${r.name} `:null}function pye(e,t,n){var c;const r=e.match(new RegExp(`^/${s6}\\s+$`));if(!r)return null;const s=r[1],i=t.find(u=>u.name===s),o=n==="zh-CN"?lb:cb;if((c=i==null?void 0:i.subcommands)!=null&&c.length||o[s]||s==="skills")return null;const l=(n==="zh-CN"?ub:db)[s];return!l||l.length===0?null:`/${s} ${l[0].name} `}function gye(e,t,n){var u,d;const r=e.match(new RegExp(`^/${s6}(\\s*)$`));if(!r)return null;const s=r[1],i=t.find(f=>f.name===s);if(!i)return null;const o=(u=i.argumentHint)==null?void 0:u.trim();if(o)return o;const a=n==="zh-CN"?lb:cb;if((d=i.subcommands)!=null&&d.length||a[s]||s==="skills")return null;const c=(n==="zh-CN"?ub:db)[s];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function yye(e,t){const n=Math.max(0,Math.min(t,e.length)),r=e.lastIndexOf(`
`,Math.max(0,n-1))+1,s=e.indexOf(`
`,n),i=s===-1?e.length:s;return{lineStart:r,lineEnd:i,lineText:e.slice(r,i),textBefore:e.slice(r,n),cursor:n}}function bye(e,t,n,r=[],s="en",i=a=>a,o=G0){var x,w;const{lineStart:a,lineEnd:l,lineText:c,textBefore:u,cursor:d}=yye(e,t),f=u.match(new RegExp(`^/${s6}\\s+(.*)$`));if(f){const[,k,T]=f,C=n.find(D=>D.name===k),A=s==="zh-CN"?lb:cb,L=s==="zh-CN"?ub:db,$=!!A[k]||k==="skills",E=!!L[k];if(!((x=C==null?void 0:C.subcommands)!=null&&x.length)&&!$&&!E)return null;const z=T.split(/\s+/),M=z.pop()||"",U=z;if(!((w=C==null?void 0:C.subcommands)!=null&&w.length)&&!$&&E&&!M)return null;const K=dye(k,U,r,s,C==null?void 0:C.subcommands);if(!K)return null;const J=M.toLowerCase(),P=`/${k} ${U.length>0?U.join(" ")+" ":""}`,V=K.filter(D=>!M||D.name.toLowerCase().includes(J)).sort((D,j)=>M?TO(D.name,j.name,J):0),X=k==="skills"&&U.length===0,te=V.map(D=>{const j=`${P}${D.name}`;return{id:j,label:D.name,detail:D.description||void 0,apply:`${j} `,...X?{type:"skill"}:{}}});return te.length===0?null:{kind:"subcommand",from:a,to:d,query:M,items:te}}const m=c.match(/^\/([^\s/]*)$/);if(!m)return null;const p=m[1],y=p.toLowerCase(),b=n.filter(k=>p?k.name.toLowerCase().includes(y):!0).sort((k,T)=>hye(k,T,y,o)).map(k=>{const T=`/${k.name} `,C=s3(k),A=C==="custom"||C==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:T,category:C,section:i(fye[C]),...A&&k.description?{type:"command-info"}:{}}});return b.length===0?null:{kind:"command",from:a,to:l,query:p,items:b}}function xye(e){return t=>wye(t,e)}function wye(e,t){const n=e.state.doc.lineAt(e.pos),s=n.text.slice(0,e.pos-n.from).match(/@([\w./-]*)$/);if(!s)return null;const i=t();if(!i)return null;const o=s[1],a=e.pos-s[0].length;return vye(o,i).then(l=>l.length===0?null:{from:a,options:l.map(c=>({label:`@${c}`,apply:`@${c} `,type:"file"})),filter:!1})}async function vye(e,t){try{const n=e?`${e}*`:"**/*";return(await t(n,{maxResults:50})).matches.filter(s=>s!==".")}catch{return[]}}const _ye="qwen-web-shell-history",CO=100;function kye(e){try{const t=localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch{return[]}}function Sye(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-CO)))}catch{}}function oC(e=_ye){const t=g.useRef(e);t.current=e;const n=g.useRef(kye(e)),r=g.useRef(-1),s=g.useRef(""),i=g.useRef(-1),[o,a]=g.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=g.useCallback(()=>{const x=n.current,w=r.current;a({canUp:x.length>0&&(w===-1||w>0),canDown:w!==-1})},[]),c=g.useCallback(x=>{const w=n.current;w[w.length-1]!==x&&(w.push(x),w.length>CO&&w.shift(),Sye(t.current,w),r.current=-1,l())},[l]),u=g.useCallback(x=>{const w=n.current;if(w.length===0)return null;if(r.current===-1)s.current=x,r.current=w.length-1;else if(r.current>0)r.current--;else return null;return l(),w[r.current]},[l]),d=g.useCallback(()=>{const x=n.current;return r.current===-1?null:r.current<x.length-1?(r.current++,l(),x[r.current]):(r.current=-1,l(),s.current)},[l]),f=g.useCallback(()=>r.current!==-1,[]),m=g.useCallback(()=>{r.current=-1,i.current=-1,l()},[l]),p=g.useCallback(x=>{const w=n.current;if(w.length===0||!x)return null;const k=i.current===-1?w.length-1:i.current-1;if(k<0)return i.current=-1,null;const T=x.toLowerCase();for(let C=k;C>=0;C--)if(w[C].toLowerCase().includes(T))return i.current=C,w[C];return i.current=-1,null},[]),y=g.useCallback(x=>{const w=x.trim().toLowerCase();return n.current.slice().reverse().filter(k=>!w||k.toLowerCase().includes(w))},[]),v=g.useCallback(x=>{const w=n.current;if(!x)return w.length>0?w[w.length-1]:null;for(let k=w.length-1;k>=0;k--)if(x(w[k]))return w[k];return null},[]),b=g.useCallback(()=>{i.current=-1},[]);return{push:c,navigateUp:u,navigateDown:d,isNavigating:f,reset:m,searchReverse:p,getReverseMatches:y,getLastEntry:v,resetSearch:b,nav:o}}const Tye=nn.mark({class:"cm-input-slash"}),Cye=nn.mark({class:"cm-input-at"}),Aye=nn.mark({class:"cm-input-code"});class Eye extends sa{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 aC(e,t,n){const r=new Au,s=e.state.doc,i=[];for(let o=1;o<=s.lines;o++){const a=s.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:Tye})}const u=gye(l,t(),n());if(u){const p=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:nn.widget({widget:new Eye(`${p}${u}`),side:1})})}const d=/@[^\s]+/g;let f;for(;(f=d.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:Cye});const m=/`[^`]+`/g;for(;(f=m.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:Aye})}i.sort((o,a)=>o.from-a.from||o.to-a.to);for(const{from:o,to:a,deco:l}of i)r.add(o,a,l);return r.finish()}function Mye(e=()=>[],t=()=>"en"){return Qs.fromClass(class{constructor(n){oe(this,"decorations");this.decorations=aC(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=aC(n.view,e,t))}},{decorations:n=>n.decorations})}const Nye=ct.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"}}),Iye=1e3,Rye=10,lC="web-shell-tooltip-styles",jye=`
[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: baseline;
  min-width: 0;
  padding: 4px 8px !important;
  color: var(--foreground, #e4e4e4) !important;
  overflow: hidden;
}

[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: 0;
  margin: 6px 10px 3px;
  padding: 0 !important;
  border-bottom: 1px solid var(--border) !important;
}

[data-web-shell-tooltip-portal] .cm-tooltip-autocomplete completion-section:first-of-type {
  display: none !important;
}

[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 .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 Lye(){if(document.getElementById(lC))return;const e=document.createElement("style");e.id=lC,e.textContent=jye,document.head.appendChild(e)}function Dye(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function Oye(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function i6(e){return Oye(e)}function Bye(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function $ye(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function zye(e,t,n){if(!t.detail||!i6(t))return;const r=e.closest("[data-web-shell-tooltip-portal]");if(!r)return;let s=r.querySelector(".cm-completionInfo-hover");s||(s=document.createElement("div"),s.className="cm-tooltip cm-completionInfo cm-completionInfo-hover cm-completionInfo-right-narrow",r.appendChild(s)),s.textContent=`${Bye(t)}

${t.detail}`;const i=s.dataset.hideTimerId;i&&(window.clearTimeout(Number(i)),delete s.dataset.hideTimerId);const o=s.getBoundingClientRect(),a=18,l=12,c=12,u=window.innerWidth,d=window.innerHeight,f=n.clientX+a,m=f+o.width+c>u?Math.max(c,n.clientX-o.width-a):f,p=Math.min(Math.max(c,n.clientY+l),Math.max(c,d-o.height-c));s.style.position="fixed",s.style.left=`${m}px`,s.style.top=`${p}px`,s.style.right="auto",s.style.bottom="auto"}function Pye(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 qye(e){if(!e.detail||!i6(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",r=>{zye(t,e,r)}),n.addEventListener("mouseleave",()=>{const r=t.closest("[data-web-shell-tooltip-portal]");r&&Pye(r)}))}),t}function Fye(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function Uye(e){return[...e].length>Iye||e.split(`
`).length>Rye}function Hye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vye(e,t,n){const s=`[Pasted Content ${[...n].length} chars]`,i=t===1?s:`${s} #${t}`;return e.set(i,n),{placeholderText:i,nextPasteId:t+1}}function Wye(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function Gye(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((s,i)=>i.length-s.length),r=new RegExp(n.map(Hye).join("|"),"g");return t.replace(r,s=>e.get(s)??s)}function Sg(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function Kye(e){return e.map(Sg).join(`
`)}function o6(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function a6(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function AO(e){return a6(e)||o6(e)||e.id}function G4(e,t){const n=Kye(t);return n?e?`${n}

${e}`:n:e}const i3=Nn.define({map:e=>e}),l6=Nn.define(),Yc=Nn.define();class Yye extends sa{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.removable===t.tag.removable}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 r=o6(this.tag),s=a6(this.tag);if(r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=r,n.appendChild(i)}if(s){const i=document.createElement("span");i.style.cssText="max-width:32ch;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 0.5ch;color:var(--muted-foreground);",i.textContent=s,n.appendChild(i)}else if(!r){const i=document.createElement("span");i.style.cssText="min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:3px 0 3px 7px;color:var(--agent-blue-500);",i.textContent=this.tag.id,n.appendChild(i)}if(this.tag.removable!==!1){const i=document.createElement("button");i.type="button",i.setAttribute("aria-label",`Remove ${AO(this.tag)}`),i.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;",i.textContent="×",i.addEventListener("mousedown",o=>o.preventDefault()),i.addEventListener("click",o=>{o.stopPropagation();const a=[];t.state.field(Ad).between(0,t.state.doc.length,(l,c,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&a.push({from:l,to:c,insert:""})}),a.length!==0&&(t.dispatch({changes:a,effects:l6.of({predicate:l=>l.id===this.tag.id}),scrollIntoView:!0}),t.focus())}),i.addEventListener("mouseenter",()=>{i.style.color="var(--error-color)"}),i.addEventListener("mouseleave",()=>{i.style.color="var(--muted-foreground)"}),n.appendChild(i)}return n}ignoreEvent(){return!1}}function Xye(e){const t={widget:new Yye(e.tag),inclusive:!1,tag:e.tag};return nn.replace(t).range(e.from,e.to)}const Ad=ra.define({create(){return nn.none},update(e,t){let n=e.map(t.changes);for(const r of t.effects)r.is(i3)?n=n.update({add:[Xye(r.value)]}):r.is(l6)?n=n.update({filter:(s,i,o)=>{const a=o.spec.tag;return a&&r.value.predicate?!r.value.predicate(a):!0}}):r.is(Yc)&&(n=nn.none);return n},provide:e=>[ct.decorations.from(e),ct.atomicRanges.of(t=>t.state.field(e))]});function Qye(e){const t=[];return e.state.field(Ad).between(0,e.state.doc.length,(n,r,s)=>{const i=s.spec.tag;i&&t.push(i)}),t}const cC=new Fu,uC=new Fu,dC=new Fu;function Tg(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function Jye(e,t){const n=Tg(e,t);if(!n||e.length===0)return null;const r=n.slice(e.length);return r.length>0?r:null}class Zye extends sa{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 hC(e){return Qs.fromClass(class{constructor(t){oe(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return nn.none;const n=t.state.selection.main,r=t.state.doc.toString(),s=Jye(r,e);return!s||!n.empty||n.head!==r.length?nn.none:nn.set([nn.widget({widget:new Zye(s),side:1}).range(r.length)])}},{decorations:t=>t.decorations})}function fC(e,t){const n=e.state.doc;if(n.lines<=1)return"history";const r=e.state.selection.main;if(!r.empty)return"editor";const s=r.head,i=n.lineAt(s);return t==="up"?i.number>1?"editor":s>i.from?(e.dispatch({selection:{anchor:i.from},scrollIntoView:!0}),"handled"):"history":i.number<n.lines?"editor":s<i.to?(e.dispatch({selection:{anchor:i.to},scrollIntoView:!0}),"handled"):"history"}function ebe(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:r,disabled:s=!1,placeholderText:i="Type a message...",commands:o,skills:a=[],slashCommandCategoryOrder:l,queuedMessages:c=[],onPopQueuedMessages:u,onClearQueuedMessages:d,currentMode:f="default",onFocusFooter:m,dialogOpen:p=!1,followupState:y,onAcceptFollowup:v,onDismissFollowup:b,sessionName:x,composerInput:w,composerInputVersion:k,editorTheme:T}=e,C=mN(),{language:A,t:L}=et(),$=g.useRef(null),E=g.useRef(null),z=g.useRef(t);z.current=t;const M=g.useRef(n);M.current=n;const U=g.useRef(r);U.current=r;const K=g.useRef(s);K.current=s;const J=g.useRef(o);J.current=o;const P=g.useRef(a);P.current=a;const V=g.useRef(l);V.current=l;const X=g.useRef(L);X.current=L;const te=g.useRef(c);te.current=c;const D=g.useRef(u);D.current=u;const j=g.useRef(d);j.current=d;const B=g.useRef(y);B.current=y;const I=g.useRef(v);I.current=v;const ne=g.useRef(b);ne.current=b;const de=g.useRef(m);de.current=m;const ce=g.useRef(A);ce.current=A;const Ne=g.useRef(C==null?void 0:C.actions);Ne.current=C==null?void 0:C.actions;const[Ce,ze]=g.useState(!1),ue=g.useRef(Ce);ue.current=Ce;const rt=g.useCallback(()=>{var Q,le,ae;(Q=B.current)!=null&&Q.isVisible&&((le=ne.current)==null||le.call(ne)),ze(_e=>!_e),(ae=E.current)==null||ae.focus()},[]),[xe,Ee]=g.useState(!1),[Zt,ht]=g.useState(""),[bt,Vt]=g.useState([]),[pn,vt]=g.useState(0),Wt=g.useRef(null),Gt=g.useRef(null),Tt=g.useRef(""),[Oe,ot]=g.useState([]),ft=g.useRef([]),F=g.useRef(new Map),W=g.useRef(1),[re,me]=g.useState([]),Pe=g.useRef([]);Pe.current=re;const Re=g.useRef(w);Re.current=w;const nt=g.useRef(()=>!0),wt=g.useRef(null),[ut,he]=g.useState(null),Z=g.useRef(null),ie=g.useRef(!1),fe=g.useCallback(Q=>{Z.current=Q,he(Q)},[]),Ve=g.useCallback((Q,le)=>{var _t;if(!Q||K.current||ue.current){fe(null);return}if(ie.current){fe(null);return}const ae=Q.state.selection.main;if(!ae.empty){fe(null);return}const _e=bye(Q.state.doc.toString(),ae.head,J.current,P.current,ce.current,en=>X.current(en),V.current??G0);if(!_e){fe(null);return}const yt=le??((_t=Z.current)==null?void 0:_t.selectedIndex)??0,pt=Math.max(0,Math.min(yt,_e.items.length-1));fe({..._e,selectedIndex:pt})},[fe]),mt=g.useCallback(()=>{fe(null)},[fe]),It=g.useCallback(Q=>{const le=Z.current;return!le||Q<0||Q>=le.items.length?!1:(le.selectedIndex===Q||fe({...le,selectedIndex:Q}),!0)},[fe]),ye=g.useCallback(Q=>{const le=Z.current;if(!le)return!1;const ae=Dye(le.selectedIndex,le.items.length,Q);return ae===null?!1:(fe({...le,selectedIndex:ae}),!0)},[fe]),at=g.useCallback(Q=>{const le=E.current,ae=Z.current;if(!le||!ae)return!1;const _e=ae.items[Q??ae.selectedIndex];return _e?(le.dispatch({changes:{from:ae.from,to:ae.to,insert:_e.apply},selection:{anchor:ae.from+_e.apply.length},scrollIntoView:!0}),le.focus(),!0):!1},[]),[Ut,rn]=g.useState(!1);g.useEffect(()=>{const Q=E.current,le=(Q==null?void 0:Q.state.doc.toString().trim())??"";rn(le.length>0||re.length>0||Oe.length>0)},[re,Oe]);const to=oC(),ti=oC("qwen-web-shell-command-history"),{push:kc,navigateUp:rl,navigateDown:Sc,isNavigating:ia,reset:xo,getReverseMatches:Tc,getLastEntry:Pr,resetSearch:ni}=to,In=g.useRef({push:kc,navigateUp:rl,navigateDown:Sc,isNavigating:ia,reset:xo,getReverseMatches:Tc,getLastEntry:Pr,resetSearch:ni});In.current={push:kc,navigateUp:rl,navigateDown:Sc,isNavigating:ia,reset:xo,getReverseMatches:Tc,getLastEntry:Pr,resetSearch:ni};const zn=g.useRef(ti);zn.current=ti,ft.current=Oe;const bs=g.useCallback(Q=>{const le=ue.current,_e=(le?zn.current:In.current).getReverseMatches(Q);return le?_e:_e.filter(yt=>!yt.trimStart().startsWith("/"))},[]),zt=g.useCallback(()=>{if(K.current)return;const Q=E.current;if(!Q)return;mt();const le=Q.state.doc.toString();Tt.current=le,Ee(!0),ht("");const ae=ue.current?zn.current:In.current;Vt(bs("")),vt(0),ae.resetSearch(),setTimeout(()=>{var _e;return(_e=Wt.current)==null?void 0:_e.focus()},0)},[mt,bs]),or=g.useRef(zt);or.current=zt;const qr=g.useCallback(()=>{if(K.current)return;const Q=E.current;if(!Q)return;if(si(Q.state)==="active"){zl(!1)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const le=ue.current?zn.current:In.current,ae=Q.state.doc.toString(),_e=le.navigateUp(ae);_e!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:_e},selection:{anchor:_e.length}}),Q.focus()},[]),sl=g.useCallback(()=>{if(K.current)return;const Q=E.current;if(!Q)return;if(si(Q.state)==="active"){zl(!0)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const ae=(ue.current?zn.current:In.current).navigateDown();ae!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:ae},selection:{anchor:ae.length}}),Q.focus()},[]);g.useEffect(()=>{var Mc,Hu;if(!$.current)return;Lye();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 le=/\b\S*theme(?:Dark|Light)\S*/gi,ae=()=>{var At,Lt;let we=$.current,xt=null;if($.current){const qt=getComputedStyle($.current);for(let Ht=0;Ht<qt.length;Ht+=1){const _n=qt[Ht];_n.startsWith("--")&&Q.style.setProperty(_n,qt.getPropertyValue(_n))}qt.getPropertyValue("--web-shell-tooltip-z-index").trim()||Q.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;we;){const qt=(Lt=(At=we.className)==null?void 0:At.match)==null?void 0:Lt.call(At,le);if(qt){xt=qt[0];break}we=we.parentElement}xt&&(Q.className=xt)};ae(),document.body.appendChild(Q);const _e=new MutationObserver(ae);let yt=$.current;for(;yt&&(_e.observe(yt,{attributes:!0,attributeFilter:["class","style"]}),!((Hu=(Mc=yt.className)==null?void 0:Mc.match)!=null&&Hu.call(Mc,le)));)yt=yt.parentElement;const pt=(we,xt,At)=>{var ua;const Lt=(xt??we.state.doc.toString()).trim(),qt=At??Pe.current;if(!Lt&&qt.length===0)return!0;const Ht=Gye(F.current,Lt),_n=G4(Ht,qt),tr=ft.current,Kr=ue.current;return z.current(Kr?`!${_n}`:_n,tr.length>0?[...tr]:void 0)===!1||(fe(null),(ua=ne.current)==null||ua.call(ne),F.current.clear(),W.current=1,Kr?(zn.current.push(Ht),zn.current.reset()):(In.current.push(Ht),In.current.reset()),ie.current=!1,me([]),ot([]),we.dispatch({changes:{from:0,to:we.state.doc.length,insert:""},effects:Yc.of()})),!0};nt.current=pt;const _t=[xye(()=>{var we;return(we=Ne.current)==null?void 0:we.globWorkspace})],en=we=>(we.dispatch(we.state.replaceSelection(`
`)),!0),Pt=(we,xt)=>{var Ht;const At=B.current,Lt=At==null?void 0:At.suggestion,qt=Tg(we.state.doc.toString(),Lt);return!(At!=null&&At.isVisible)||!qt?!1:(we.dispatch({changes:{from:0,to:we.state.doc.length,insert:qt},selection:{anchor:qt.length},scrollIntoView:!0}),we.focus(),(Ht=I.current)==null||Ht.call(I,xt,{skipOnAccept:!0}),!0)},vn=U0.of([{key:"Backspace",run:we=>{var qt;const xt=we.state.selection.main;if(!xt.empty||xt.from!==0)return!1;let At=!1;if(we.state.field(Ad).between(0,1,Ht=>{Ht===0&&(At=!0)}),At)return!1;let Lt=-1;for(let Ht=Pe.current.length-1;Ht>=0;Ht-=1)if(((qt=Pe.current[Ht])==null?void 0:qt.removable)!==!1){Lt=Ht;break}return Lt<0?!1:(me(Ht=>Ht.filter((_n,tr)=>tr!==Lt)),!0)}},{key:"Delete",run:we=>{const xt=we.state.selection.main;if(!xt.empty||xt.from!==0)return!1;let At=!1;if(we.state.field(Ad).between(0,1,qt=>{qt===0&&(At=!0)}),At)return!1;const Lt=Pe.current.findIndex(qt=>qt.removable!==!1);return Lt<0?!1:(me(qt=>qt.filter((Ht,_n)=>_n!==Lt)),!0)}},{key:"Enter",run:we=>{var Lt;if(Z.current)return at();if(si(we.state)==="active")return!1;const xt=B.current,At=Tg(we.state.doc.toString(),xt==null?void 0:xt.suggestion);return xt!=null&&xt.isVisible&&At?((Lt=I.current)==null||Lt.call(I,"enter",{skipOnAccept:!0}),pt(we,At)):pt(we)}},{key:"Shift-Enter",run:en},{key:"Ctrl-j",run:en},{key:"Mod-Enter",run:en},{key:"Alt-Enter",run:en},{key:"Escape",run:()=>{var we;return Z.current?(mt(),!0):ue.current?(ze(!1),!0):te.current.length===0?!1:((we=j.current)==null?void 0:we.call(j))??!1}},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:we=>{var _n;const xt=ue.current?zn.current:In.current;if(ie.current)kg(we),mt();else{if(ye("up"))return!0;if(si(we.state)==="active")return zl(!1)(we)}const Lt=fC(we,"up");if(Lt==="handled")return!0;if(Lt==="editor")return!1;if(ue.current){const tr=we.state.doc.toString(),Kr=xt.navigateUp(tr);return Kr===null||(ie.current=!0,we.dispatch({changes:{from:0,to:we.state.doc.length,insert:Kr},selection:{anchor:Kr.length}})),!0}if(te.current.length>0){const tr=(_n=D.current)==null?void 0:_n.call(D);if(tr){const Kr=we.state.doc.toString(),so=Kr.trim()?`${tr}
${Kr}`:tr;return we.dispatch({changes:{from:0,to:we.state.doc.length,insert:so},selection:{anchor:so.length}}),!0}}const qt=we.state.doc.toString(),Ht=xt.navigateUp(qt);return Ht===null?!1:(ie.current=!0,we.dispatch({changes:{from:0,to:we.state.doc.length,insert:Ht},selection:{anchor:Ht.length}}),!0)}},{key:"ArrowDown",run:we=>{var Ht;const xt=ue.current?zn.current:In.current;if(ie.current)kg(we),mt();else{if(ye("down"))return!0;if(si(we.state)==="active")return zl(!0)(we)}const Lt=fC(we,"down");if(Lt==="handled")return!0;if(Lt==="editor")return!1;if(ue.current){const _n=xt.navigateDown();return _n===null||(ie.current=xt.isNavigating(),we.dispatch({changes:{from:0,to:we.state.doc.length,insert:_n},selection:{anchor:_n.length}})),!0}const qt=xt.navigateDown();return qt===null?((Ht=de.current)==null?void 0:Ht.call(de))??!1:(ie.current=xt.isNavigating(),we.dispatch({changes:{from:0,to:we.state.doc.length,insert:qt},selection:{anchor:qt.length}}),!0)}},{key:"Ctrl-r",run:()=>(or.current(),!0)},{key:"Tab",run:we=>{if(Pt(we,"tab"))return!0;if(Z.current)return at();if(si(we.state)==="active")return kO(we);const xt=we.state.doc.toString(),At=pye(xt,J.current,ce.current);if(At)return we.dispatch({changes:{from:0,to:we.state.doc.length,insert:At},selection:{anchor:At.length}}),!0;const Lt=mye(xt,J.current);return Lt&&we.dispatch({changes:{from:0,to:we.state.doc.length,insert:Lt},selection:{anchor:Lt.length}}),!0}},{key:"ArrowRight",run:we=>!!(si(we.state)!=="active"&&Pt(we,"right"))},{key:"Shift-Tab",run:()=>{var we;return(we=M.current)==null||we.call(M),!0}}]),xs=ct.updateListener.of(we=>{if(we.docChanged&&F.current.size>0){const At=Wye(F.current,we.state.doc.toString());At!==null&&(W.current=At)}we.transactions.some(At=>At.isUserEvent("input")||At.isUserEvent("delete"))&&(ie.current=!1),(we.docChanged||we.selectionSet)&&Ve(we.view)});let fr=!1;const Pn=ct.updateListener.of(we=>{const xt=wt.current,At=si(we.state)==="active";if(xt){const Lt=we.state.doc;if(!(Lt.length===xt.from+xt.text.length&&Lt.sliceString(xt.from)===xt.text))wt.current=null;else if(fr&&!At){wt.current=null;const{view:Ht}=we,{from:_n}=xt;window.setTimeout(()=>{if(E.current!==Ht)return;const tr=Ht.state.doc;tr.length===_n+xt.text.length&&tr.sliceString(_n)===xt.text&&Ht.dispatch({changes:{from:_n,to:tr.length,insert:""}})},0)}}fr=At,At||$ye(Q)}),er=kn.create({doc:"",extensions:[qu.highest(vn),cye,FD(),U0.of([...bO,...WD]),oye({override:_t,activateOnTyping:!0,icons:!1,optionClass:we=>we.type==="file"?"cm-file-completion":i6(we)?"cm-command-info-completion":"",addToOptions:[{render:qye,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(we,xt,At,Lt,qt)=>{const Ht=Lt.bottom-Lt.top,_n=qt.bottom-xt.bottom,tr=_n>=Ht||_n>xt.top,Kr=tr?"top":"bottom",so=tr?At.bottom-xt.top:xt.bottom-At.top;return{style:`${Kr}: ${so}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:we=>typeof we.apply=="string"&&we.apply.endsWith(" ")}),Rpe({parent:Q}),uC.of(RT("")),dC.of(hC(null)),ct.lineWrapping,cC.of(ct.editable.of(!0)),Mye(()=>J.current,()=>ce.current),Nye,Ad,xs,Pn,ct.updateListener.of(we=>{if(we.docChanged){const xt=we.state.doc.toString().trim();rn(xt.length>0||Pe.current.length>0||ft.current.length>0)}}),ct.inputHandler.of((we,xt,At,Lt)=>{var qt;return Lt==="!"&&we.state.doc.toString()===""&&si(we.state)!=="active"?(rt(),!0):Lt==="?"&&we.state.doc.toString()===""&&si(we.state)!=="active"?((qt=U.current)==null||qt.call(U),!0):!1}),ct.domEventHandlers({blur(){return mt(),!1},paste(we){var tr,Kr,so,ua;const xt=(tr=we.clipboardData)==null?void 0:tr.items;if(!xt)return!1;let At=!1;for(const ll of xt)if(ll.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(ll.type)){At=!0;const Bh=ll.getAsFile();if(!Bh)continue;const Nc=ll.type,Vu=new FileReader;Vu.onload=()=>{const Sm=Vu.result.split(",")[1];ot(Tm=>[...Tm,{data:Sm,media_type:Nc}])},Vu.readAsDataURL(Bh)}if(At)return we.preventDefault(),!0;const Lt=Fye(((Kr=we.clipboardData)==null?void 0:Kr.getData("text/plain"))??"");if(!Lt||!Uye(Lt))return!1;we.preventDefault(),_o.state.doc.toString()===""&&((so=B.current)!=null&&so.isVisible)&&((ua=ne.current)==null||ua.call(ne));const{placeholderText:qt,nextPasteId:Ht}=Vye(F.current,W.current,Lt);W.current=Ht;const _n=_o.state.selection.main;return _o.dispatch({changes:{from:_n.from,to:_n.to,insert:qt},selection:{anchor:_n.from+qt.length},scrollIntoView:!0}),!0}}),ct.theme(T)]}),_o=new ct({state:er,parent:$.current});E.current=_o,_o.focus();const Oh=_o.state.doc.toString().trim();return rn(Oh.length>0||Pe.current.length>0||ft.current.length>0),()=>{_o.destroy(),E.current=null,_e.disconnect(),Q.remove()}},[]),g.useEffect(()=>{const Q=E.current;Q&&(Q.dispatch({effects:cC.reconfigure(ct.editable.of(!s))}),s||Q.focus())},[s]),g.useEffect(()=>{const Q=E.current;if(!Q)return;const le=!s&&(y!=null&&y.isVisible)&&y.suggestion?y.suggestion:null,ae=le??(Ce?L("editor.shellPlaceholder"):i);Q.dispatch({effects:[uC.reconfigure(RT(ae)),dC.reconfigure(hC(le))]})},[s,i,Ce,L,y==null?void 0:y.isVisible,y==null?void 0:y.suggestion]),g.useEffect(()=>{const Q=E.current;!Q||si(Q.state)!=="active"||(kg(Q),window.setTimeout(()=>{E.current===Q&&Fd(Q)},0))},[A]);const Os=[o.map(Q=>{var le;return[Q.name,Q.description??"",Q.source??"",Q.displayCategory??"",Q.argumentHint??"",((le=Q.subcommands)==null?void 0:le.join(","))??""].join("\0")}).join(""),a.map(Q=>[Q.name,Q.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");g.useEffect(()=>{Z.current&&Ve(E.current)},[Os,A,Ve]),g.useEffect(()=>{const Q=E.current;Q&&(p?(mt(),Q.contentDOM.blur()):Q.focus())},[p,mt]),g.useEffect(()=>{const Q=le=>{var vn,xs,fr;if(K.current||xe||p||le.defaultPrevented)return;const ae=le.target,_e=(vn=$.current)==null?void 0:vn.contains(ae),yt=document.activeElement===document.body;if(!_e&&!yt)return;const pt=E.current,_t=B.current,en=Tg((pt==null?void 0:pt.state.doc.toString())??"",_t==null?void 0:_t.suggestion);if(pt&&!pt.hasFocus&&(_t!=null&&_t.isVisible)&&en&&!M1(le.target)){if(le.key==="Tab"&&!le.shiftKey&&!le.metaKey&&!le.ctrlKey&&!le.altKey&&si(pt.state)!=="active"){le.preventDefault(),pt.dispatch({changes:{from:0,to:pt.state.doc.length,insert:en},selection:{anchor:en.length},scrollIntoView:!0}),pt.focus(),(xs=I.current)==null||xs.call(I,"tab",{skipOnAccept:!0});return}if(le.key==="ArrowRight"&&!le.shiftKey&&!le.metaKey&&!le.ctrlKey&&!le.altKey&&si(pt.state)!=="active"){le.preventDefault(),pt.dispatch({changes:{from:0,to:pt.state.doc.length,insert:en},selection:{anchor:en.length},scrollIntoView:!0}),pt.focus(),(fr=I.current)==null||fr.call(I,"right",{skipOnAccept:!0});return}}if(le.metaKey||le.ctrlKey||le.altKey||le.key.length!==1||M1(le.target)||!pt||pt.hasFocus)return;if(le.preventDefault(),le.key==="!"&&pt.state.doc.toString()===""){rt();return}const Pt=pt.state.selection.main;pt.dispatch({changes:{from:Pt.from,to:Pt.to,insert:le.key},selection:{anchor:Pt.from+le.key.length},scrollIntoView:!0}),pt.focus(),le.key==="/"?window.setTimeout(()=>{Ve(E.current)},0):le.key==="@"&&window.setTimeout(()=>{const Pn=E.current;Pn&&Pn.hasFocus&&Fd(Pn)},0)};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[xe,p,Ve,rt]);const oa=g.useCallback(()=>{var Q;(Q=E.current)==null||Q.focus()},[]),aa=g.useCallback((Q,le)=>{const ae=E.current;if(!ae||!Q){ae==null||ae.focus();return}if((le==null?void 0:le.mode)==="replace"){ae.dispatch({changes:{from:0,to:ae.state.doc.length,insert:Q},effects:Yc.of(),selection:{anchor:Q.length},scrollIntoView:!0}),ae.focus();return}const _e=ae.state.selection.main;let yt=Q,pt=!1,_t=null;const en=Q==="@";let Pt=Q==="/";if(Q==="/")ae.state.doc.lineAt(_e.head).text.startsWith("/")?pt=!0:ae.state.doc.length>0&&(pt=!0,Pt=!1);else if(Q==="@"){const vn=_e.from>0?ae.state.doc.sliceString(_e.from-1,_e.from):"";ae.state.doc.sliceString(_e.from,_e.from+1)==="@"?(pt=!0,_t=_e.from+1):vn==="@"?pt=!0:vn&&!/\s/.test(vn)&&(yt=" @")}pt?_t!==null&&ae.dispatch({selection:{anchor:_t},scrollIntoView:!0}):(ae.dispatch({changes:{from:_e.from,to:_e.to,insert:yt},selection:{anchor:_e.from+yt.length},scrollIntoView:!0}),en&&(wt.current={text:yt,from:_e.from})),ae.focus(),Pt?window.setTimeout(()=>{Ve(E.current)},0):en&&window.setTimeout(()=>{const vn=E.current;vn&&vn.hasFocus&&Fd(vn)},0)},[Ve]),la=g.useCallback(()=>{var Q;return((Q=E.current)==null?void 0:Q.state.doc.toString())??""},[]),os=g.useCallback(Q=>{const le=E.current;le&&(le.dispatch({changes:{from:0,to:le.state.doc.length,insert:Q},effects:Yc.of(),selection:{anchor:Q.length},scrollIntoView:!0}),le.focus())},[]),wo=g.useCallback(Q=>{const le=E.current;if(!le)return;const ae=[];le.state.field(Ad).between(0,le.state.doc.length,(_e,yt,pt)=>{const _t=pt.spec.tag;_t&&(!Q||Q(_t))&&ae.push({from:_e,to:yt,insert:""})}),le.dispatch({...ae.length>0?{changes:ae}:{},effects:l6.of({predicate:Q}),scrollIntoView:!0})},[]),Ti=g.useCallback(Q=>{const le=(Q==null?void 0:Q.text)??!0,ae=(Q==null?void 0:Q.tags)??!0,_e=E.current;le&&_e&&_e.state.doc.length>0&&_e.dispatch({changes:{from:0,to:_e.state.doc.length,insert:""},effects:Yc.of()}),le&&(ot([]),F.current.clear(),W.current=1),ae&&(me([]),le||wo())},[wo]),Ci=g.useCallback(()=>{Ti({text:!0,tags:!1})},[Ti]),no=g.useCallback((Q,le)=>{if(Q.length!==0){if((le==null?void 0:le.placement)==="inline"){const ae=E.current;if(!ae)return;const _e=ae.state.selection.main;let yt=_e.from;const pt=[],_t=Q.map(Pt=>{const vn=Sg(Pt);return pt.push({from:yt,to:yt+vn.length,tag:Pt}),yt+=vn.length+1,vn}).join(" "),en=_t?`${_t} `:"";ae.dispatch({changes:{from:_e.from,to:_e.to,insert:en},effects:pt.length>0?pt.map(Pt=>i3.of(Pt)):void 0,selection:{anchor:_e.from+en.length},scrollIntoView:!0}),ae.focus();return}me(ae=>{const _e=[...ae];for(const yt of Q){const pt=_e.findIndex(_t=>_t.id===yt.id);pt>=0?_e[pt]=yt:_e.push(yt)}return _e})}},[]),Ai=g.useCallback(Q=>{me(le=>le.filter(ae=>ae.id!==Q||ae.removable===!1)),wo(le=>le.id===Q&&le.removable!==!1)},[wo]),Cc=g.useCallback(()=>{var Q;return(((Q=E.current)==null?void 0:Q.state.doc.toString().trim().length)??0)>0||Pe.current.length>0||ft.current.length>0},[]),ro=g.useCallback(Q=>{const le=E.current;if(!le)return;const ae=Qye(le);if((Q==null?void 0:Q.tagPlacement)==="inline"){nt.current(le,G4(Q.text??"",Q.tags??ae),[]);return}if((Q==null?void 0:Q.text)!==void 0&&Q.tags===void 0&&ae.length>0){nt.current(le,G4(Q.text,ae),[]);return}nt.current(le,Q==null?void 0:Q.text,Q?Q.tags??[]:void 0)},[]),Ac=g.useCallback(()=>{const Q=In.current.getLastEntry(ae=>!ae.startsWith("/")&&!ae.startsWith("!"));!Q||z.current(Q)===!1||ot([])},[]),gn=g.useCallback(Q=>{const le=E.current;le&&le.dispatch({changes:{from:0,to:le.state.doc.length,insert:Q},selection:{anchor:Q.length},scrollIntoView:!0})},[]);g.useEffect(()=>{const Q=Re.current;if(!Q)return;const le=E.current;if(!le)return;const ae=Q.tagPlacement??"top";if(Q.tags!==void 0&&ae==="top"&&me([...Q.tags]),Q.text!==void 0||ae==="inline"){const yt=ae==="inline"?[...Q.tags??[]]:[],pt=yt.map(Sg).join(" "),_t=ae==="inline"?pt&&Q.text?`${pt} ${Q.text}`:pt||(Q.text??""):Q.text??"",en=[Yc.of()];if(yt.length>0){let Pt=0;for(const vn of yt){const xs=Sg(vn);en.push(i3.of({from:Pt,to:Pt+xs.length,tag:vn})),Pt+=xs.length+1}}le.dispatch({changes:{from:0,to:le.state.doc.length,insert:_t},effects:en,selection:{anchor:_t.length},scrollIntoView:!0})}else le.dispatch({effects:Yc.of()});(Q.text!==void 0||Q.submit)&&le.focus();let _e=null;return Q.submit&&(_e=window.setTimeout(()=>{E.current&&ro(Q)},0)),()=>{_e!==null&&window.clearTimeout(_e)}},[k,ro]);const sn=g.useCallback((Q,le=!0)=>{var _e;Q&&gn(Tt.current),Ee(!1),ht(""),Vt([]),vt(0),(ue.current?zn.current:In.current).resetSearch(),le&&((_e=E.current)==null||_e.focus())},[gn]);g.useEffect(()=>{if(!xe)return;const Q=le=>{if(le instanceof MouseEvent&&le.button!==0||le.defaultPrevented)return;const ae=Gt.current,_e=le.target;ae&&_e instanceof Node&&!ae.contains(_e)&&sn(!0,!1)};return window.addEventListener("mousedown",Q),window.addEventListener("touchstart",Q),()=>{window.removeEventListener("mousedown",Q),window.removeEventListener("touchstart",Q)}},[xe,sn]);const Ei=g.useCallback(Q=>{var _t;if(!E.current)return;sn(!1);const ae=Q.trim();if(!ae)return;const _e=ft.current,yt=ue.current;if(z.current(yt?`!${ae}`:ae,_e.length>0?[..._e]:void 0)===!1){gn(Q);return}(_t=ne.current)==null||_t.call(ne),yt?(zn.current.push(ae),zn.current.reset()):(In.current.push(ae),In.current.reset()),ot([]),gn("")},[sn,gn]),Ec=Q=>{if(!Q.nativeEvent.isComposing)if(Q.key==="Escape")Q.preventDefault(),sn(!0);else if(Q.key==="Tab"){Q.preventDefault();const le=bt[pn];le&&gn(le),sn(!1)}else if(Q.key==="Enter"){Q.preventDefault();const le=bt[pn];le?Ei(le):sn(!1)}else Q.key==="r"&&Q.ctrlKey&&(Q.preventDefault(),bt.length>0&&vt(le=>(le+1)%bt.length))},ca=Q=>{const le=ue.current?zn.current:In.current;Vt(bs(Q)),vt(0),le.resetSearch()},il=Q=>{const le=Q.target.value;ht(le),!Q.nativeEvent.isComposing&&ca(le)},ol=Q=>{const le=Q.currentTarget.value;ht(le),ca(le)},Uu=g.useCallback(Q=>{ot(le=>le.filter((ae,_e)=>_e!==Q))},[]),vo=!Ce&&!xe&&!(y!=null&&y.isVisible)&&!s&&!p,al={clearText:Ci,clear:Ti,focus:oa,getText:la,hasInput:Cc,setText:os,addTags:no,removeTag:Ai,insertText:aa,retryLast:Ac,submit:ro};return{containerRef:$,viewRef:E,focus:oa,submitText:g.useCallback(()=>{const Q=E.current;Q&&nt.current(Q)},[]),clearText:Ci,getText:la,hasInput:Cc,hasContent:Ut,handle:al,pastedImages:Oe,removeImage:Uu,composerTags:re,removeTopTag:Ai,addTags:no,removeInlineTags:wo,insertText:aa,setText:os,submit:ro,clear:Ti,retryLast:Ac,replaceEditorText:gn,shellMode:Ce,setShellMode:ze,toggleShellMode:rt,currentMode:f,sessionName:x,searchState:{searchMode:xe,searchQuery:Zt,searchMatches:bt,searchActiveIndex:pn,searchInputRef:Wt,searchUiRef:Gt,openHistorySearch:zt,closeSearch:sn,submitSearchMatch:Ei,handleSearchKeyDown:Ec,handleSearchInput:il,handleSearchCompositionEnd:ol},navigatePrevHistory:qr,navigateNextHistory:sl,showShortcutHints:vo,followupState:y,disabled:s,onAcceptFollowup:v,onDismissFollowup:b,slashMenu:ut,closeSlashMenu:mt,selectSlashCompletion:It,acceptSlashCompletion:at}}const tbe="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",nbe="/assets/default-aEtf0G7-.svg",EO="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",rbe="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",sbe="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";function If(e,t){return{[e]:`url("${t}")`}}const ibe="_icon_i7y0u_1",obe={icon:ibe},abe={auto:tbe,"auto-edit":EO,default:nbe,plan:rbe,yolo:sbe};function o3({mode:e}){const t=abe[e];return t?h.jsx("span",{className:obe.icon,style:If("--mode-icon-url",t),"aria-hidden":"true"}):h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.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"})})}function X1(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const K4=16e3,lbe=4096,mC=6e4;function cbe(e){const t=new URL(e),n=t.pathname.replace(/\/?$/,"/"),r=new URL("voice/stream",`${t.origin}${n}`);return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}const ube="qwen-bearer.",dbe="qwen-ws";function hbe(e){const t=new TextEncoder().encode(e);let n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);const r=btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${ube}${r}`}function fbe(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 mbe(e){const t=new Int16Array(e.length);let n=0;for(let r=0;r<e.length;r++){let s=e[r];s>1?s=1:s<-1&&(s=-1),t[r]=s<0?s*32768:s*32767,n+=s*s}return{pcm:t.buffer,level:e.length?Math.sqrt(n/e.length):0}}function pbe(e){const{baseUrl:t,token:n,onFinal:r,onError:s}=e,[i,o]=g.useState("idle"),[a,l]=g.useState(""),[c,u]=g.useState(0),[d,f]=g.useState(void 0),m=g.useRef({}),p=g.useRef(!0),y=g.useRef(0),v=g.useRef("idle"),b=g.useRef(r);b.current=r;const x=g.useRef(s);x.current=s;const w=g.useCallback(M=>{v.current=M,o(M)},[]),k=g.useCallback(()=>{const M=m.current;M.transcribeTimeout&&(clearTimeout(M.transcribeTimeout),M.transcribeTimeout=void 0)},[]),T=g.useCallback(()=>{var U;const M=m.current;M.processor&&(M.processor.onaudioprocess=null);for(const K of[M.processor,M.source,M.sink])try{K==null||K.disconnect()}catch{}(U=M.stream)==null||U.getTracks().forEach(K=>K.stop()),M.context&&M.context.state!=="closed"&&M.context.close().catch(()=>{}),M.processor=void 0,M.sink=void 0,M.source=void 0,M.stream=void 0,M.context=void 0},[]),C=g.useCallback(()=>{y.current++,T();const M=m.current;if(k(),M.ws){try{M.ws.onmessage=null,M.ws.onerror=null,M.ws.onclose=null,M.ws.close()}catch{}M.ws=void 0}},[T,k]),A=g.useCallback((M,U)=>{var K;!p.current||U!==void 0&&y.current!==U||(C(),w("error"),l(""),u(0),f(M),(K=x.current)==null||K.call(x,M))},[C,w]),L=g.useCallback((M,U)=>{U!==void 0&&y.current!==U||(C(),p.current&&(w("idle"),l(""),u(0),b.current(M)))},[C,w]),$=g.useCallback(()=>{if(v.current!=="idle"&&v.current!=="error")return;f(void 0),l(""),w("connecting");const M=++y.current,U=()=>!p.current||y.current!==M;(async()=>{var K;try{if(!((K=navigator.mediaDevices)!=null&&K.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 J;try{J=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(j){throw new Error(fbe(j))}if(U()){J.getTracks().forEach(j=>j.stop());return}m.current.stream=J;const P=new AudioContext({sampleRate:K4});if(P.sampleRate!==K4)throw J.getTracks().forEach(j=>j.stop()),P.close().catch(()=>{}),new Error(`Browser audio rate ${P.sampleRate} Hz is not the required ${K4} Hz.`);if(m.current.context=P,P.state==="suspended"&&await P.resume(),U()){J.getTracks().forEach(j=>j.stop()),P.close().catch(()=>{});return}const V=P.createMediaStreamSource(J),X=P.createScriptProcessor(lbe,1,1),te=P.createGain();te.gain.value=0,m.current.source=V,m.current.processor=X,m.current.sink=te;const D=new WebSocket(cbe(t),n?[dbe,hbe(n)]:void 0);D.binaryType="arraybuffer",m.current.ws=D,X.onaudioprocess=j=>{const{pcm:B,level:I}=mbe(j.inputBuffer.getChannelData(0));p.current&&u(I),D.readyState===WebSocket.OPEN&&D.send(B)},D.onopen=()=>{if(U()){X.onaudioprocess=null;for(const B of[X,V,te])try{B.disconnect()}catch{}J.getTracks().forEach(B=>B.stop()),P.state!=="closed"&&P.close().catch(()=>{});const j=m.current;j.ws===D&&(j.ws=void 0),j.processor===X&&(j.processor=void 0),j.source===V&&(j.source=void 0),j.sink===te&&(j.sink=void 0),j.stream===J&&(j.stream=void 0),j.context===P&&(j.context=void 0);try{D.close()}catch{}return}D.send(JSON.stringify({type:"start"})),V.connect(X),X.connect(te),te.connect(P.destination),k(),m.current.transcribeTimeout=setTimeout(()=>{v.current==="recording"&&A("No response from server. Check that the voice model is running.",M)},mC),p.current&&w("recording")},D.onmessage=j=>{(v.current==="connecting"||v.current==="recording")&&k();let B;try{B=JSON.parse(String(j.data))}catch{return}B.type==="interim"?p.current&&l(B.text??""):B.type==="final"?L(B.text??"",M):B.type==="error"&&A(B.message??B.text??"Voice transcription failed.",M)},D.onerror=()=>{},D.onclose=j=>{if(p.current&&(v.current==="recording"||v.current==="connecting"||v.current==="transcribing")){const B=j.code||1006,I=j.reason||"none";A(`Voice connection closed (code=${B}, reason=${I}).`,M)}}}catch(J){A(J instanceof Error?J.message:String(J),M)}})()},[t,n,A,L,w,k]),E=g.useCallback(()=>{const M=m.current.ws;if(!M||M.readyState!==WebSocket.OPEN){C(),w("idle");return}T(),u(0),w("transcribing");const U=y.current;try{M.send(JSON.stringify({type:"stop"})),k(),m.current.transcribeTimeout=setTimeout(()=>{v.current==="transcribing"&&A("Transcription timed out.",U)},mC)}catch{A("Failed to finalize voice transcription.",U)}},[C,T,A,w,k]),z=g.useCallback(()=>{const M=m.current.ws;if(M&&M.readyState===WebSocket.OPEN)try{M.send(JSON.stringify({type:"abort"}))}catch{}C(),w("idle"),l(""),u(0)},[C,w]);return g.useEffect(()=>(p.current=!0,()=>{p.current=!1,C()}),[C]),{status:i,interimText:a,audioLevel:c,errorMessage:d,start:$,stop:E,abort:z}}const gbe="_root_9hwm9_7",ybe="_iconBtn_9hwm9_14",bbe="_error_9hwm9_47",xbe="_connecting_9hwm9_51",wbe="_pill_9hwm9_56",vbe="_transcribing_9hwm9_75",_be="_recDot_9hwm9_79",kbe="_wave_9hwm9_88",Sbe="_bar_9hwm9_95",Tbe="_time_9hwm9_103",Cbe="_stop_9hwm9_111",Abe="_spinner_9hwm9_118",Ebe="_interim_9hwm9_128",as={root:gbe,iconBtn:ybe,error:bbe,connecting:xbe,pill:wbe,transcribing:vbe,recDot:_be,wave:kbe,bar:Sbe,time:Tbe,stop:Cbe,spinner:Abe,interim:Ebe},Mbe="voice_transcribe",pC=16,Nbe=()=>h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[h.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),h.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"})]}),Ibe=()=>h.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:h.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function Rbe(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=String(t%60).padStart(2,"0");return`${n}:${r}`}function jbe({onInsert:e,disabled:t}){var E;const n=w5(),r=((E=n.capabilities)==null?void 0:E.features)??[],[s,i]=g.useState(void 0),{status:o,interimText:a,audioLevel:l,errorMessage:c,start:u,stop:d,abort:f}=pbe({baseUrl:n.baseUrl,token:n.token,onFinal:z=>{const M=z.trim();M?(i(void 0),e(M)):i("No speech detected.")}}),m=o==="recording",[p,y]=g.useState(()=>new Array(pC).fill(0));g.useEffect(()=>{if(!m){y(new Array(pC).fill(0));return}y(z=>[...z.slice(1),Math.min(1,l*8)])},[l,m]);const[v,b]=g.useState(0);if(g.useEffect(()=>{if(!m){b(0);return}const z=performance.now(),M=setInterval(()=>b(performance.now()-z),200);return()=>clearInterval(M)},[m]),!r.includes(Mbe))return null;const x=o==="connecting",w=o==="transcribing",k=o==="error",T=!!s&&!k,C=m||x,A=m?"Stop dictation":w?"Transcribing…":x?"Starting…":k?`Voice error — click to retry${c?`: ${c}`:""}`:T?"No speech detected — click to retry":"Start voice dictation";let L;if(m)L=h.jsxs("button",{type:"button",className:as.pill,onClick:()=>d(),"aria-label":A,title:A,children:[h.jsx("span",{className:as.recDot,"aria-hidden":"true"}),h.jsx("span",{className:as.wave,"aria-hidden":"true",children:p.map((z,M)=>h.jsx("span",{className:as.bar,style:{height:`${2+Math.round(z*14)}px`}},M))}),h.jsx("span",{className:as.time,children:Rbe(v)}),h.jsx("span",{className:as.stop,"aria-hidden":"true",children:h.jsx(Ibe,{})})]});else if(w)L=h.jsxs("span",{className:`${as.pill} ${as.transcribing}`,role:"status","aria-label":A,children:[h.jsx("span",{className:as.spinner,"aria-hidden":"true"}),h.jsx("span",{className:as.time,children:"…"})]});else{const z=[as.iconBtn,k?as.error:"",x?as.connecting:""].filter(Boolean).join(" ");L=h.jsx("button",{type:"button",className:z,onClick:()=>{if(x)f();else{if(t)return;i(void 0),u()}},disabled:!!t&&!C,"aria-label":A,title:c??s??A,children:h.jsx(Nbe,{})})}const $=m&&a||k||T;return h.jsxs("span",{className:as.root,children:[L,$&&h.jsx("span",{role:"status","aria-live":"polite",className:`${as.interim}${k?` ${as.error}`:""}`,children:k?c||"Voice error":T?s:a})]})}const Lbe="_editorShell_1m5lu_1",Dbe="_container_1m5lu_7",Obe="_content_1m5lu_22",Bbe="_dacAura_1m5lu_35",$be="_dacHalo_1m5lu_36",zbe="_slashPortalLayer_1m5lu_177",Pbe="_slashPanel_1m5lu_181",qbe="_slashPanelBody_1m5lu_219",Fbe="_slashList_1m5lu_225",Ube="_slashEntry_1m5lu_253",Hbe="_slashSection_1m5lu_259",Vbe="_slashItem_1m5lu_265",Wbe="_slashItemActive_1m5lu_286",Gbe="_slashCommand_1m5lu_290",Kbe="_slashDetail_1m5lu_295",Ybe="_slashDetailCommand_1m5lu_314",Xbe="_slashDetailText_1m5lu_324",Qbe="_slashDescription_1m5lu_344",Jbe="_tags_1m5lu_373",Zbe="_tag_1m5lu_373",e2e="_tagLabel_1m5lu_394",t2e="_tagValue_1m5lu_395",n2e="_tagRemove_1m5lu_413",r2e="_editorArea_1m5lu_433",s2e="_shellPrefix_1m5lu_448",i2e="_toolbar_1m5lu_485",o2e="_toolbarLeading_1m5lu_494",a2e="_toolbarStart_1m5lu_495",l2e="_toolbarEnd_1m5lu_496",c2e="_toolbarLeft_1m5lu_497",u2e="_toolbarRight_1m5lu_498",d2e="_toolBtn_1m5lu_527",h2e="_toolBtnText_1m5lu_533",f2e="_dropdownWrapper_1m5lu_538",m2e="_dropdown_1m5lu_538",p2e="_dropdownRich_1m5lu_560",g2e="_dropdownCheck_1m5lu_566",y2e="_dropdownItem_1m5lu_572",b2e="_dropdownItemActive_1m5lu_610",x2e="_dropdownItemIcon_1m5lu_615",w2e="_dropdownItemCheck_1m5lu_616",v2e="_dropdownItemContent_1m5lu_633",_2e="_dropdownItemLabel_1m5lu_640",k2e="_dropdownItemDesc_1m5lu_650",S2e="_toolBtnIcon_1m5lu_708",T2e="_widthModeBtn_1m5lu_724",C2e="_quickActionsBtn_1m5lu_733",A2e="_toolBtnModeIcon_1m5lu_742",E2e="_toolBtnModelIcon_1m5lu_743",M2e="_toolBtnArrow_1m5lu_770",N2e="_chevronDown_1m5lu_783",I2e="_quickActionsPanel_1m5lu_792",R2e="_quickActionsHeader_1m5lu_805",j2e="_quickActionsLayout_1m5lu_812",L2e="_quickActionsGrid_1m5lu_819",D2e="_quickAction_1m5lu_733",O2e="_quickActionLabel_1m5lu_850",B2e="_quickKeysGrid_1m5lu_865",$2e="_quickKey_1m5lu_865",z2e="_quickKeyLabel_1m5lu_894",P2e="_sendBtn_1m5lu_917",q2e="_sendBtnRunning_1m5lu_955",F2e="_sendIcon_1m5lu_968",U2e="_stopIcon_1m5lu_974",H2e="_images_1m5lu_981",V2e="_imageThumb_1m5lu_988",W2e="_imageRemove_1m5lu_1003",G2e="_searchPanel_1m5lu_1024",K2e="_searchBar_1m5lu_1041",Y2e="_searchLabel_1m5lu_1049",X2e="_searchInput_1m5lu_1054",Q2e="_searchResults_1m5lu_1068",J2e="_searchResult_1m5lu_1068",Z2e="_searchResultActive_1m5lu_1101",e4e="_searchResultMarker_1m5lu_1106",t4e="_searchResultText_1m5lu_1111",n4e="_searchEmpty_1m5lu_1118",De={editorShell:Lbe,container:Dbe,content:Obe,dacAura:Bbe,dacHalo:$be,slashPortalLayer:zbe,slashPanel:Pbe,slashPanelBody:qbe,slashList:Fbe,slashEntry:Ube,slashSection:Hbe,slashItem:Vbe,slashItemActive:Wbe,slashCommand:Gbe,slashDetail:Kbe,slashDetailCommand:Ybe,slashDetailText:Xbe,slashDescription:Qbe,tags:Jbe,tag:Zbe,tagLabel:e2e,tagValue:t2e,tagRemove:n2e,editorArea:r2e,shellPrefix:s2e,toolbar:i2e,toolbarLeading:o2e,toolbarStart:a2e,toolbarEnd:l2e,toolbarLeft:c2e,toolbarRight:u2e,toolBtn:d2e,toolBtnText:h2e,dropdownWrapper:f2e,dropdown:m2e,dropdownRich:p2e,dropdownCheck:g2e,dropdownItem:y2e,dropdownItemActive:b2e,dropdownItemIcon:x2e,dropdownItemCheck:w2e,dropdownItemContent:v2e,dropdownItemLabel:_2e,dropdownItemDesc:k2e,toolBtnIcon:S2e,widthModeBtn:T2e,quickActionsBtn:C2e,toolBtnModeIcon:A2e,toolBtnModelIcon:E2e,toolBtnArrow:M2e,chevronDown:N2e,quickActionsPanel:I2e,quickActionsHeader:R2e,quickActionsLayout:j2e,quickActionsGrid:L2e,quickAction:D2e,quickActionLabel:O2e,quickKeysGrid:B2e,quickKey:$2e,quickKeyLabel:z2e,sendBtn:P2e,sendBtnRunning:q2e,sendIcon:F2e,stopIcon:U2e,images:H2e,imageThumb:V2e,imageRemove:W2e,searchPanel:G2e,searchBar:K2e,searchLabel:Y2e,searchInput:X2e,searchResults:Q2e,searchResult:J2e,searchResultActive:Z2e,searchResultMarker:e4e,searchResultText:t4e,searchEmpty:n4e},r4e={"&":{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"}},s4e=["--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 i4e(){return h.jsx("svg",{className:De.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:h.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function o4e(){return h.jsx("span",{className:De.stopIcon,"aria-hidden":"true"})}function a4e(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>h.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function l4e(e,t){let n,r,s,i,o=0,a=0;const l=(y,v)=>{e.style.setProperty("--dac-glow-on",y.toFixed(4)),e.style.setProperty("--dac-glow-pulse",v.toFixed(4))},c=y=>{n!==void 0&&window.cancelAnimationFrame(n);const v=o,b=y-v;if(Math.abs(b)<.001){o=y,l(y,a);return}const x=performance.now(),w=k=>{const T=Math.min((k-x)/220,1);o=v+b*(1-(1-T)**2),l(o,a),n=T<1?window.requestAnimationFrame(w):void 0};n=window.requestAnimationFrame(w)},u=()=>{r!==void 0&&window.cancelAnimationFrame(r);const y=a,v=performance.now(),b=x=>{const w=Math.min((x-v)/300,1);a=y*(1-w),l(o,a),r=w<1?window.requestAnimationFrame(b):void 0};r=window.requestAnimationFrame(b)},d=y=>{y?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},f=()=>c(1),m=()=>{c(0),d(!1),i!==void 0&&window.clearTimeout(i)},p=()=>{r!==void 0&&window.cancelAnimationFrame(r),s!==void 0&&window.clearTimeout(s),a=1,l(o,1),s=window.setTimeout(u,100),d(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>d(!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),r!==void 0&&window.cancelAnimationFrame(r),s!==void 0&&window.clearTimeout(s),i!==void 0&&window.clearTimeout(i),t.removeEventListener("focus",f),t.removeEventListener("blur",m),t.removeEventListener("keydown",p),l(0,0),d(!1)}}function c4e({mode:e}){return e==="wide"?h.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[h.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)"}),h.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)"})]}):h.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:h.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 gC(){return h.jsx("span",{className:De.chevronDown,"aria-hidden":"true"})}function u4e(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.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"}),h.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 d4e(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 h4e=[{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 f4e(){return h.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function MO(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 m4e(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]??MO(e,t)}function yC({open:e,items:t,activeId:n,onClose:r,onSelect:s,anchorRef:i,showCheck:o=!1,maxHeight:a}){const l=g.useRef(null);if(g.useEffect(()=>{if(!e)return;const d=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)&&r()};return window.addEventListener("mousedown",d),()=>window.removeEventListener("mousedown",d)},[e,r,i]),g.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),r())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,r]),!e)return null;const c=t.some(d=>d.description||d.icon),u=c||o;return h.jsx("div",{ref:l,className:`${De.dropdown} ${c?De.dropdownRich:o?De.dropdownCheck:""}`,style:a?{maxHeight:a,overflowY:"auto"}:void 0,children:t.map(d=>h.jsx("button",{type:"button",className:`${De.dropdownItem} ${d.id===n?De.dropdownItemActive:""}`,onMouseDown:f=>{f.preventDefault(),s(d.id)},children:u?h.jsxs(h.Fragment,{children:[c&&h.jsx("span",{className:De.dropdownItemIcon,children:d.icon}),h.jsxs("span",{className:De.dropdownItemContent,children:[h.jsx("span",{className:De.dropdownItemLabel,children:d.label}),d.description&&h.jsx("span",{className:De.dropdownItemDesc,children:d.description})]}),h.jsx("span",{className:De.dropdownItemCheck,children:d.id===n?h.jsx(f4e,{}):null})]}):d.label},d.id))})}function p4e({menu:e,anchorRef:t,panelRef:n,onSelect:r,onAccept:s}){const i=g.useRef([]),[o,a]=g.useState(null),[l,c]=g.useState({}),[u,d]=g.useState(null),f=g.useRef(null);g.useEffect(()=>{var k;(k=i.current[e.selectedIndex])==null||k.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),g.useLayoutEffect(()=>{const k=t.current;if(!k)return;const T=()=>{const A=k.getBoundingClientRect(),L=getComputedStyle(k),$=Object.fromEntries(s4e.map(E=>[E,L.getPropertyValue(E)]));a({left:Math.max(12,Math.min(A.left+16,window.innerWidth-252)),bottom:window.innerHeight-A.top+8,width:A.width}),c($)};T();const C=new ResizeObserver(T);return C.observe(k),window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{C.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[t,e.items]),g.useEffect(()=>{d(null)},[e.items]);const m=k=>Array.from(k).length,p=Math.max(...e.items.map(k=>m(k.label)),0),y=Math.max(...e.items.map(k=>m(k.detail??"")),0),v=y>0,b={"--slash-command-col":`${Math.min(Math.max(p+1,10),24)}ch`,"--slash-desc-col":v?`${Math.min(Math.max(y+1,18),36)}ch`:"0px","--slash-column-gap":v?"2ch":"0px"};let x;if(!o)return null;const w={...b,...l,left:o.left,bottom:o.bottom,"--slash-anchor-width":`${o.width}px`};return ny.createPortal(h.jsxs("div",{ref:n,className:De.slashPortalLayer,style:l,children:[h.jsx("div",{className:De.slashPanel,style:w,role:"listbox",onMouseDown:k=>k.preventDefault(),onMouseLeave:k=>{var C;const T=k.relatedTarget;T instanceof Node&&((C=f.current)!=null&&C.contains(T))||d(null)},children:h.jsx("div",{className:De.slashPanelBody,children:h.jsx("div",{className:De.slashList,onScroll:()=>d(null),children:e.items.map((k,T)=>{const C=k.section,A=e.kind==="command"&&T>0&&C!==void 0&&C!==x;return x=C??x,h.jsxs("div",{className:De.slashEntry,children:[A&&h.jsx("div",{className:De.slashSection}),h.jsxs("button",{ref:L=>{i.current[T]=L},type:"button",role:"option","aria-selected":T===e.selectedIndex,className:`${De.slashItem} ${T===e.selectedIndex?De.slashItemActive:""}`,onMouseEnter:L=>{if(r(T),!k.detail){d(null);return}const $=L.currentTarget,E=8,z=180,M=$.getBoundingClientRect(),K=Math.min(M.left+Math.min(220,M.width*.34),window.innerWidth-320-12),J=window.innerHeight-M.bottom-E-12,P=M.top-E-12,V=J>=96||J>=P,X=Math.max(72,Math.min(z,V?J:P));d({label:k.label,detail:k.detail,left:Math.max(12,K),...V?{top:M.bottom+E}:{bottom:window.innerHeight-M.top+E},maxHeight:X})},onMouseDown:L=>{L.preventDefault(),L.stopPropagation(),s(T)},children:[h.jsx("span",{className:De.slashCommand,children:k.label}),k.detail&&h.jsx("span",{className:De.slashDescription,children:k.detail})]})]},`${k.id}:${T}`)})})})}),u&&h.jsxs("div",{ref:f,className:De.slashDetail,style:{...l,left:u.left,top:u.top,bottom:u.bottom,maxHeight:u.maxHeight},children:[h.jsx("div",{className:De.slashDetailCommand,children:u.label}),h.jsx("div",{className:De.slashDetailText,children:u.detail})]})]}),document.body)}function g4e({actions:e,onRun:t,onPressKey:n}){const{t:r}=et();return h.jsxs("div",{className:De.quickActionsPanel,onMouseDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),children:[h.jsx("div",{className:De.quickActionsHeader,children:r("quickActions.title")}),h.jsxs("div",{className:De.quickActionsLayout,children:[h.jsx("div",{className:De.quickActionsGrid,children:e.map(s=>h.jsx("button",{type:"button",className:De.quickAction,onClick:()=>t(s),children:h.jsx("span",{className:De.quickActionLabel,children:s.label})},s.id))}),h.jsx("div",{className:De.quickKeysGrid,children:h4e.map(s=>h.jsx("button",{type:"button",className:De.quickKey,title:r(s.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(s),children:h.jsx("span",{className:De.quickKeyLabel,children:s.label})},s.id))})]})]})}const y4e=g.memo(g.forwardRef(function(t,n){const{onSubmit:r,onCycleMode:s,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,disabled:l=!1,placeholderText:c="Type a message...",commands:u,skills:d=[],slashCommandCategoryOrder:f,queuedMessages:m=[],onPopQueuedMessages:p,onClearQueuedMessages:y,currentMode:v="default",currentModel:b="",chatWidthMode:x="1000",showChatWidthToggle:w=!0,chatWidthToggleMin:k,visibleToolbarActions:T,availableModels:C=[],onSelectMode:A,onSelectModel:L,onChatWidthModeChange:$,onFocusFooter:E,dialogOpen:z=!1,followupState:M,onAcceptFollowup:U,onDismissFollowup:K,sessionName:J,composerInput:P,composerInputVersion:V}=t,X=ebe({onSubmit:r,onCycleMode:s,onToggleShortcuts:i,disabled:l,placeholderText:c,commands:u,skills:d,slashCommandCategoryOrder:f,queuedMessages:m,onPopQueuedMessages:p,onClearQueuedMessages:y,currentMode:v,onFocusFooter:E,dialogOpen:z,followupState:M,onAcceptFollowup:U,onDismissFollowup:K,sessionName:J,composerInput:P,composerInputVersion:V,editorTheme:r4e}),{t:te}=et(),{renderComposerToolbarStart:D,renderComposerToolbarEnd:j}=xc();g.useImperativeHandle(n,()=>X.handle,[X.handle]);const[B,I]=g.useState(!1),[ne,de]=g.useState(!1),[ce,Ne]=g.useState(!1),Ce=g.useRef(null),ze=g.useRef(null),ue=g.useRef(null),rt=g.useRef(null),[xe,Ee]=g.useState(!1),Zt=X.slashMenu,ht=X.closeSlashMenu,bt=X.viewRef;g.useEffect(()=>{if(!Zt)return;const ye=at=>{var to;const Ut=at.target,rn=Ce.current;Ut instanceof Node&&rn&&!rn.contains(Ut)&&!((to=ze.current)!=null&&to.contains(Ut))&&ht()};return window.addEventListener("mousedown",ye),window.addEventListener("touchstart",ye),()=>{window.removeEventListener("mousedown",ye),window.removeEventListener("touchstart",ye)}},[Zt,ht]),g.useEffect(()=>{var Ut;const ye=Ce.current,at=(Ut=bt.current)==null?void 0:Ut.contentDOM;if(!(!ye||!at))return l4e(ye,at)},[bt]),g.useEffect(()=>{const ye=Ce.current,at=k;if(!ye||at===void 0){Ee(!1);return}const Ut=()=>{Ee(ye.getBoundingClientRect().width>=at-50)};Ut();const rn=new ResizeObserver(Ut);return rn.observe(ye),()=>rn.disconnect()},[k]);const Vt=g.useMemo(()=>xy.map(ye=>({id:ye,label:m4e(ye,te),description:te(`mode.desc.${ye}`),icon:h.jsx(o3,{mode:ye})})),[te]),pn=g.useMemo(()=>T?new Set(T):null,[T]),vt=ye=>pn?pn.has(ye):!0,Wt=g.useMemo(()=>new Set(u.map(ye=>ye.name.replace(/^\/+/,""))),[u]),Gt=g.useCallback(ye=>Wt.has(ye),[Wt]),Tt=g.useMemo(()=>[{id:"new",label:te("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:te("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:te("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:te("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:te("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:te("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:te("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:te("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:te("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:te("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:te("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:te("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:te("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:te("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:te("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:te("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:X.shellMode?te("quickActions.exitShellMode"):te("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:te("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(ye=>{const at=d4e(ye);return!at||Gt(at)}),[X.shellMode,Gt,te]),Oe=g.useMemo(()=>C.map(ye=>({id:ye.id,label:X1(ye.label||ye.id)})),[C]),ot=g.useCallback(ye=>{A==null||A(ye),I(!1),X.focus()},[A,X]),ft=g.useCallback(ye=>{L==null||L(ye),de(!1),X.focus()},[L,X]),F=g.useCallback(ye=>{const at=X.viewRef.current;at&&(at.focus(),at.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...ye,bubbles:!0,cancelable:!0})))},[X]),W=g.useCallback(ye=>{if(Ne(!1),I(!1),de(!1),X.closeSlashMenu(),ye.action.type==="insert"){X.insertText(ye.action.text,{mode:"replace"});return}if(ye.action.type==="shell"){X.toggleShellMode();return}if(ye.action.type==="key"){F(ye.action.item.event);return}r(ye.action.command)},[X,F,r]),re=g.useCallback(ye=>{F(ye.event),ye.id==="ctrl-r"&&Ne(!1)},[F]),{searchMode:me,searchQuery:Pe,searchMatches:Re,searchActiveIndex:nt,searchInputRef:wt,searchUiRef:ut,closeSearch:he,handleSearchKeyDown:Z,handleSearchInput:ie,handleSearchCompositionEnd:fe}=X.searchState,Ve=ye=>{const at=o6(ye),Ut=a6(ye);return!at&&!Ut?h.jsx("span",{className:De.tagLabel,children:ye.id}):h.jsxs(h.Fragment,{children:[at&&h.jsx("span",{className:De.tagLabel,children:at}),Ut&&h.jsx("span",{className:De.tagValue,children:Ut})]})},mt=MO(v,te),It=X1(b);return h.jsxs("div",{className:De.editorShell,children:[h.jsxs("div",{ref:Ce,className:De.container,"data-dac-glow":!0,onClick:()=>{I(!1),de(!1),Ne(!1),X.focus()},children:[h.jsx("div",{className:De.dacAura,"aria-hidden":"true"}),h.jsx("div",{className:De.dacHalo,"aria-hidden":"true"}),me&&h.jsxs("div",{ref:ut,className:De.searchPanel,onMouseDown:ye=>ye.stopPropagation(),onClick:ye=>ye.stopPropagation(),children:[h.jsxs("div",{className:De.searchBar,children:[h.jsx("span",{className:De.searchLabel,children:te("editor.searchLabel")}),h.jsx("input",{ref:wt,className:De.searchInput,value:Pe,onChange:ie,onCompositionEnd:fe,onKeyDown:Z,placeholder:te("editor.searchPlaceholder")})]}),Re.length>0&&h.jsx("div",{className:De.searchResults,children:Re.map((ye,at)=>h.jsxs("button",{type:"button",className:`${De.searchResult} ${at===nt?De.searchResultActive:""}`,onMouseDown:Ut=>{Ut.preventDefault(),X.replaceEditorText(ye),he(!1)},children:[h.jsx("span",{className:De.searchResultMarker,children:at===nt?"›":""}),h.jsx("span",{className:De.searchResultText,children:ye})]},`${ye}-${at}`))}),Re.length===0&&h.jsx("div",{className:De.searchEmpty,children:te("editor.noHistory")})]}),h.jsxs("div",{className:De.content,children:[X.composerTags.length>0&&h.jsx("div",{className:De.tags,children:X.composerTags.map(ye=>h.jsxs("span",{className:De.tag,children:[Ve(ye),ye.removable!==!1&&h.jsx("button",{type:"button",className:De.tagRemove,"aria-label":`Remove ${AO(ye)}`,onMouseDown:at=>at.preventDefault(),onClick:at=>{var Ut;at.stopPropagation(),X.removeTopTag(ye.id),(Ut=X.viewRef.current)==null||Ut.focus()},onKeyDown:at=>{var Ut;at.key!=="Backspace"&&at.key!=="Delete"||(at.preventDefault(),X.removeTopTag(ye.id),(Ut=X.viewRef.current)==null||Ut.focus())},children:"×"})]},ye.id))}),X.pastedImages.length>0&&h.jsx("div",{className:De.images,children:X.pastedImages.map((ye,at)=>h.jsxs("div",{className:De.imageThumb,children:[h.jsx("img",{src:`data:${ye.media_type};base64,${ye.data}`,alt:""}),h.jsx("button",{className:De.imageRemove,onClick:Ut=>{Ut.stopPropagation(),X.removeImage(at)},children:"×"})]},at))}),X.slashMenu&&h.jsx(p4e,{menu:X.slashMenu,anchorRef:Ce,panelRef:ze,onSelect:X.selectSlashCompletion,onAccept:X.acceptSlashCompletion}),h.jsxs("div",{className:De.editorArea,children:[X.shellMode&&h.jsx("span",{className:De.shellPrefix,"aria-hidden":"true",children:"!"}),h.jsx("div",{ref:X.containerRef})]}),h.jsxs("div",{className:De.toolbar,children:[h.jsxs("div",{className:De.toolbarLeading,children:[D&&h.jsx("div",{className:De.toolbarStart,children:h.jsx(D,{disabled:l,isRunning:a,currentMode:v,currentModel:b,sessionName:J})}),h.jsxs("div",{className:De.toolbarLeft,children:[vt("approvalMode")&&h.jsxs("div",{className:De.dropdownWrapper,children:[h.jsx(yC,{open:B,items:Vt,activeId:v,onClose:()=>I(!1),onSelect:ot,anchorRef:ue}),h.jsxs("button",{ref:ue,className:De.toolBtn,onClick:ye=>{ye.stopPropagation(),X.closeSlashMenu(),Ne(!1),I(at=>!at),de(!1)},"aria-label":te("status.mode"),children:[h.jsx("span",{className:De.toolBtnModeIcon,children:h.jsx(o3,{mode:v})}),h.jsx("span",{className:De.toolBtnText,children:mt}),h.jsx("span",{className:De.toolBtnArrow,children:h.jsx(gC,{})})]})]}),vt("model")&&h.jsxs("div",{className:De.dropdownWrapper,children:[h.jsx(yC,{open:ne,items:Oe,activeId:b,onClose:()=>de(!1),onSelect:ft,anchorRef:rt,showCheck:!0,maxHeight:300}),h.jsxs("button",{ref:rt,className:De.toolBtn,onClick:ye=>{ye.stopPropagation(),X.closeSlashMenu(),Ne(!1),de(at=>!at),I(!1)},"aria-label":te("model.select"),children:[h.jsx("span",{className:De.toolBtnModelIcon,children:h.jsx(u4e,{})}),h.jsx("span",{className:De.toolBtnText,children:It}),h.jsx("span",{className:De.toolBtnArrow,children:h.jsx(gC,{})})]})]}),j&&h.jsx("div",{className:De.toolbarEnd,children:h.jsx(j,{disabled:l,isRunning:a,currentMode:v,currentModel:b,sessionName:J})})]})]}),h.jsxs("div",{className:De.toolbarRight,children:[vt("commands")&&h.jsx("button",{className:De.toolBtn,onClick:ye=>{ye.stopPropagation(),Ne(!1),X.insertText("/")},"aria-label":te("editor.hintCommands"),title:te("editor.hintCommands"),"data-tooltip":te("editor.hintCommands"),children:h.jsx("span",{className:De.toolBtnIcon,children:"/"})}),vt("files")&&h.jsx("button",{className:De.toolBtn,onClick:ye=>{ye.stopPropagation(),Ne(!1),X.insertText("@")},"aria-label":te("editor.hintFiles"),title:te("editor.hintFiles"),"data-tooltip":te("editor.hintFiles"),children:h.jsx("span",{className:De.toolBtnIcon,children:"@"})}),Tt.length>0&&h.jsx("button",{className:`${De.toolBtn} ${De.quickActionsBtn}`,onClick:ye=>{ye.stopPropagation(),X.closeSlashMenu(),I(!1),de(!1),Ne(at=>!at)},"aria-expanded":ce,"aria-label":te("quickActions.open"),title:te("quickActions.open"),"data-tooltip":te("quickActions.open"),children:h.jsx("span",{className:De.toolBtnIcon,children:h.jsx(a4e,{})})}),w&&xe&&vt("widthMode")&&h.jsx("button",{className:`${De.toolBtn} ${De.widthModeBtn}`,onClick:ye=>{ye.stopPropagation(),$==null||$(x==="wide"?"1000":"wide")},disabled:!$,"aria-label":te(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:te(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":te(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:h.jsx("span",{className:De.toolBtnIcon,children:h.jsx(c4e,{mode:x})})}),vt("voice")&&h.jsx(jbe,{disabled:l,onInsert:ye=>{const at=X.getText(),Ut=at&&!/\s$/.test(at)?" ":"";X.insertText(`${Ut}${ye} `),X.focus()}}),h.jsx("button",{className:a?`${De.sendBtn} ${De.sendBtnRunning}`:De.sendBtn,disabled:a?!o:X.disabled||!X.hasContent,onClick:ye=>{if(ye.stopPropagation(),a){o==null||o();return}X.submitText()},"aria-label":te(a?"stream.cancel":"editor.send"),children:a?h.jsx(o4e,{}):h.jsx(i4e,{})})]})]})]})]}),ce&&Tt.length>0&&h.jsx(g4e,{actions:Tt,onRun:W,onPressKey:re})]})})),b4e="_bar_16h0b_1",x4e="_left_16h0b_12",w4e="_right_16h0b_13",v4e="_settingsButton_16h0b_23",_4e="_modeButton_16h0b_49",k4e="_modeHint_16h0b_62",S4e="_modeLabel_16h0b_67",T4e="_modeDefault_16h0b_71",C4e="_modePlan_16h0b_75",A4e="_modeAutoEdit_16h0b_79",E4e="_modeAuto_16h0b_79",M4e="_modeYolo_16h0b_87",N4e="_shortcutsButton_16h0b_96",I4e="_modelButton_16h0b_114",R4e="_model_16h0b_114",j4e="_escapeHint_16h0b_133",L4e="_contextButton_16h0b_143",D4e="_context_16h0b_143",O4e="_goal_16h0b_166",B4e="_separator_16h0b_172",$4e="_taskPill_16h0b_176",pr={bar:b4e,left:x4e,right:w4e,settingsButton:v4e,modeButton:_4e,modeHint:k4e,modeLabel:S4e,modeDefault:T4e,modePlan:C4e,modeAutoEdit:A4e,modeAuto:E4e,modeYolo:M4e,shortcutsButton:N4e,modelButton:I4e,model:R4e,escapeHint:j4e,contextButton:L4e,context:D4e,goal:O4e,separator:B4e,taskPill:$4e},z4e=1e3;function P4e(e,t){switch(e){case"default":return{label:t("mode.default"),className:pr.modeDefault};case"plan":return{label:t("mode.plan"),className:pr.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:pr.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:pr.modeAuto};case"yolo":return{label:t("mode.yolo"),className:pr.modeYolo};default:return null}}function q4e(){return h.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:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.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 Y4(e,t,n,r){return r(e===1?t:n,{count:e})}function F4e(e,t){if(e.length===0)return"";const n=e.filter(s=>s.status==="running");if(n.length>0){const s={agent:0,shell:0,monitor:0};for(const o of n)s[o.kind]++;const i=[];return s.shell>0&&i.push(Y4(s.shell,"tasks.pill.shell","tasks.pill.shells",t)),s.agent>0&&i.push(Y4(s.agent,"tasks.pill.agent","tasks.pill.agents",t)),s.monitor>0&&i.push(Y4(s.monitor,"tasks.pill.monitor","tasks.pill.monitors",t)),i.join(", ")}const r=e.filter(s=>s.kind==="agent"&&s.status==="paused");return r.length>0?t(r.length===1?"tasks.pill.agentPaused":"tasks.pill.agentsPaused",{count:r.length}):t(e.length===1?"tasks.pill.done":"tasks.pill.doneMany",{count:e.length})}function U4e(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 H4e=g.forwardRef(function({escapeHint:t,onSelectMode:n,onSelectModel:r,onShowContext:s,onOpenSettings:i,onOpenTasks:o,onReturnToInput:a,tasks:l,activeGoal:c,hideSettings:u,onToggleShortcuts:d,compact:f=!1},m){const p=bc(),y=p.status==="connected",v=p.currentModel??"",b=p.currentMode??"",x=p.tokenCount??0,w=p.contextWindow??0,{t:k}=et(),C=(w>0?x/w*100:0).toFixed(1),A=P4e(b,k),[,L]=g.useState(0),$=g.useRef(null);g.useEffect(()=>{if(!c)return;const V=setInterval(()=>L(X=>(X+1)%1e6),z4e);return()=>clearInterval(V)},[c]);const E=g.useMemo(()=>F4e(l,k),[l,k]),z=!!t||!f&&(y||!!A),M=c?U4e(Date.now()-c.setAt):"",U=c?`◎ ${k("goal.statusActive")}${M?` (${M})`:""}`:"",K=!!t||!!E||!f,J=!f&&!!v||!f&&w>0&&x>0||!!U;if(g.useImperativeHandle(m,()=>({focusTaskPill(){var V;return E?((V=$.current)==null||V.focus({preventScroll:!0}),!0):!1}}),[E]),!K&&!J)return null;const P=V=>{if(V.key==="Enter"||V.key==="ArrowDown"||V.key==="n"&&V.ctrlKey){V.preventDefault(),V.stopPropagation(),o==null||o();return}if(V.key==="ArrowUp"||V.key==="Escape"||V.key==="p"&&V.ctrlKey){V.preventDefault(),V.stopPropagation(),a==null||a();return}V.key.length===1&&!V.metaKey&&!V.ctrlKey&&!V.altKey&&(V.preventDefault(),V.stopPropagation(),a==null||a(V.key))};return h.jsxs("div",{className:pr.bar,children:[h.jsxs("div",{className:pr.left,children:[y&&!u&&!f&&h.jsx("button",{type:"button",className:pr.settingsButton,onClick:i,onMouseDown:V=>V.stopPropagation(),onTouchStart:V=>V.stopPropagation(),title:k("settings.title"),"aria-label":k("settings.title"),"aria-haspopup":"dialog",children:h.jsx(q4e,{})}),t?h.jsx("span",{className:pr.escapeHint,children:k("editor.escClearHint")}):h.jsxs(h.Fragment,{children:[A&&!f&&h.jsxs("button",{type:"button",className:pr.modeButton,onClick:n,onMouseDown:V=>V.stopPropagation(),onTouchStart:V=>V.stopPropagation(),title:k("mode.select"),"aria-haspopup":"listbox",children:[h.jsx("span",{className:`${pr.modeLabel} ${A.className}`,children:A.label}),!f&&h.jsx("span",{className:pr.modeHint,children:k("status.modeHint")})]}),!f&&h.jsx(h.Fragment,{children:d?h.jsx("button",{type:"button",className:pr.shortcutsButton,onClick:d,onMouseDown:V=>V.stopPropagation(),onTouchStart:V=>V.stopPropagation(),"aria-haspopup":"dialog","aria-label":k("status.shortcuts"),children:k("status.shortcuts")}):h.jsx("span",{children:k("status.shortcuts")})})]}),E&&h.jsxs(h.Fragment,{children:[z&&h.jsx("span",{className:pr.separator,children:"·"}),h.jsx("button",{ref:$,type:"button",className:pr.taskPill,onClick:o,onKeyDown:P,disabled:!o,children:E})]})]}),h.jsxs("div",{className:pr.right,children:[!f&&v&&h.jsx("button",{type:"button",className:pr.modelButton,onClick:r,onMouseDown:V=>V.stopPropagation(),onTouchStart:V=>V.stopPropagation(),title:k("model.select"),"aria-haspopup":"listbox",children:h.jsx("span",{className:pr.model,children:v})}),!f&&w>0&&x>0&&h.jsx("button",{type:"button",className:pr.contextButton,onClick:s,title:k("contextUsage.title"),children:h.jsx("span",{className:pr.context,children:k("status.contextUsed",{pct:C})})}),U&&h.jsx("span",{className:pr.goal,title:c==null?void 0:c.condition,children:U})]})]})}),V4e=15e3,W4e=["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."],G4e=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function bC(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?G4e:W4e}function K4e(){const e=k5(),t=_y(),n=e!=="idle",r=g.useRef(0),s=g.useRef(0),[i,o]=g.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=g.useMemo(()=>{let c=0,u=0,d=!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&&(d=!0)),y.kind==="tool"&&!y.parentToolCallId){if(y.rawInput!==void 0)try{c+=JSON.stringify(y.rawInput).length}catch{}const v=Y4e(y.rawOutput);v!==void 0&&!f.has(y.toolCallId)&&(u+=v,f.add(y.toolCallId))}}return{chars:c,agentTokens:u,isReceiving:d}},[t]),l=g.useRef(a);return l.current=a,a.chars<s.current&&(r.current=a.chars),s.current=a.chars,g.useEffect(()=>{if(!n){r.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const c=setInterval(()=>{const{chars:u,agentTokens:d,isReceiving:f}=l.current;if(u<r.current){r.current=u,o({estimatedOutputTokens:d+Math.round(u/4),isReceivingContent:f});return}const m=u-r.current;if(m<=0){o(v=>{const b={estimatedOutputTokens:d+Math.round(r.current/4),isReceivingContent:f};return v.estimatedOutputTokens===b.estimatedOutputTokens&&v.isReceivingContent===b.isReceivingContent?v:b});return}let p;m<70?p=3:m<=200?p=Math.max(3,Math.round(m*.2)):p=50;const y=Math.min(r.current+p,u);r.current=y,o({estimatedOutputTokens:d+Math.round(y/4),isReceivingContent:f})},100);return()=>clearInterval(c)},[n]),i}function Y4e(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 r=t.executionSummary;if(typeof r=="object"&&r!==null){const s=r.totalTokens;if(typeof s=="number"&&s>0)return s}}function X4e(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}const Q4e="_status_zld2v_1",J4e="_spinner_zld2v_11",Z4e="_label_zld2v_15",exe="_meta_zld2v_19",Bp={status:Q4e,spinner:J4e,label:Z4e,meta:exe},X4=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function txe({startedAt:e}){const t=k5(),{estimatedOutputTokens:n,isReceivingContent:r}=K4e(),{language:s,t:i}=et(),{loadingPhrases:o}=xc(),a=g.useRef(o);a.current=o;const l=g.useCallback(T=>{var C;try{return((C=a.current)==null?void 0:C.call(a,T))??bC(T)}catch(A){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",A),bC(T)}},[]),[c,u]=g.useState(0),d=g.useRef(Date.now()),[f,m]=g.useState(0),[p,y]=g.useState(()=>l(s)[0]??""),v=t!=="idle";if(g.useEffect(()=>{if(!v){u(0);return}d.current=e??Date.now(),u(xC(d.current));const T=setInterval(()=>{u(xC(d.current))},1e3);return()=>clearInterval(T)},[v,e]),g.useEffect(()=>{if(t==="idle"){y(l(s)[0]??"");return}const T=()=>{const A=l(s),L=Math.floor(Math.random()*A.length);y(A[L]??"")};T();const C=setInterval(T,V4e);return()=>clearInterval(C)},[s,t,l]),g.useEffect(()=>{if(t==="idle")return;const T=setInterval(()=>{m(C=>(C+1)%X4.length)},250);return()=>clearInterval(T)},[t]),t==="idle")return null;const b=X4[f%X4.length],x=r?"↓":"↑",w=c<60?`${c}s`:nxe(c*1e3),k=n>0?` · ${x} ${i("stream.tokens",{count:X4e(n)})}`:"";return h.jsxs("div",{className:Bp.status,children:[h.jsx("span",{className:Bp.spinner,children:b}),p&&h.jsx("span",{className:Bp.label,children:p}),h.jsxs("span",{className:Bp.meta,children:["(",w,k," · ",i("stream.cancel"),")"]})]})}function nxe(e){if(e<=0)return"0s";const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,i=[];return n>0&&i.push(`${n}h`),r>0&&i.push(`${r}m`),s>0&&i.push(`${s}s`),i.length>0?i.join(" "):"0s"}function xC(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const rxe="_host_1njbk_1",sxe="_toast_1njbk_13",ixe="_message_1njbk_31",oxe="_close_1njbk_39",axe="_info_1njbk_58",lxe="_success_1njbk_66",cxe="_warning_1njbk_74",uxe="_error_1njbk_82",Rf={host:rxe,toast:sxe,message:ixe,close:oxe,info:axe,success:lxe,warning:cxe,error:uxe};function dxe({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:h.jsx("div",{className:Rf.host,role:"status","aria-live":"polite",children:e.map(r=>h.jsx(hxe,{toast:r,onDismiss:t,autoDismissMs:n},r.id))})}function hxe({toast:e,onDismiss:t,autoDismissMs:n}){const{t:r}=et();return g.useEffect(()=>{const s=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(s)},[n,t,e.id]),h.jsxs("div",{className:`${Rf.toast} ${Rf[e.tone]}`,children:[h.jsx("div",{className:Rf.message,children:e.message}),h.jsx("button",{type:"button",className:Rf.close,onClick:()=>t(e.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const fxe="_panel_k9l9d_1",mxe="_summary_k9l9d_10",pxe="_progressRing_k9l9d_27",gxe="_stepText_k9l9d_41",yxe="_fullText_k9l9d_48",bxe="_compactText_k9l9d_52",xxe="_detail_k9l9d_71",wxe="_item_k9l9d_103",vxe="_icon_k9l9d_113",_xe="_content_k9l9d_121",kxe="_completed_k9l9d_129",Sxe="_inProgress_k9l9d_134",Txe="_pending_k9l9d_140",oi={panel:fxe,summary:mxe,progressRing:pxe,stepText:gxe,fullText:yxe,compactText:bxe,detail:xxe,item:wxe,icon:vxe,content:_xe,completed:kxe,inProgress:Sxe,pending:Txe};function Cxe(e){switch(e){case"completed":return oi.completed;case"in_progress":return oi.inProgress;case"pending":return oi.pending}}const Axe=g.memo(function({todos:t,title:n}){const{t:r}=et();if(t.length===0)return null;const s=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:s,l=s>0?a/s:0;return h.jsxs("section",{className:oi.panel,"aria-label":n??r("todo.title"),tabIndex:0,children:[h.jsxs("div",{className:oi.summary,"aria-label":r("todo.stepProgress",{current:a,total:s}),children:[h.jsx("span",{className:oi.progressRing,style:{"--todo-progress":String(l)},"aria-hidden":"true"}),h.jsxs("span",{className:oi.stepText,children:[h.jsx("span",{className:oi.fullText,children:r("todo.stepProgress",{current:a,total:s})}),h.jsx("span",{className:oi.compactText,children:r("todo.stepFraction",{current:a,total:s})})]})]}),h.jsx("div",{className:oi.detail,role:"tooltip",children:t.map((c,u)=>h.jsxs("div",{className:`${oi.item} ${Cxe(c.status)}`,children:[h.jsx("span",{className:oi.icon,"aria-hidden":"true",children:I1(c.status)}),h.jsx("span",{className:oi.content,title:c.content,children:c.content})]},`${c.id||u}:${c.content}`))})]})}),Exe="_header_leiy3_1",Mxe="_titleRow_leiy3_11",Nxe="_title_leiy3_11",Ixe="_subtitle_leiy3_31",$p={header:Exe,titleRow:Mxe,title:Nxe,subtitle:Ixe};function Rxe(e){const{t}=et();return h.jsxs("div",{className:$p.header,children:[h.jsxs("div",{className:$p.titleRow,children:[h.jsx("span",{children:t("welcome.titlePrefix")}),h.jsx("span",{className:$p.title,children:"Qwen Code"})]}),h.jsx("div",{className:$p.subtitle,children:t("welcome.prompt")})]})}const jxe="_list_j868d_1",Lxe="_row_j868d_10",Dxe="_selected_j868d_26",Oxe="_modeName_j868d_30",Bxe="_modeIcon_j868d_34",$xe="_modeText_j868d_50",zxe="_modeDesc_j868d_66",Uc={list:jxe,row:Lxe,selected:Dxe,modeName:Oxe,modeIcon:Bxe,modeText:$xe,modeDesc:zxe};function Pxe({currentMode:e,onSelect:t}){const{t:n}=et(),r=g.useRef(null),s=xy.map(o=>({id:o,name:n(`mode.listLabel.${o}`),description:n(`mode.desc.${o}`)})),i=s.findIndex(o=>o.id===e);return g.useEffect(()=>{var a;const o=(a=r.current)==null?void 0:a.children[i];o==null||o.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:Uc.list,ref:r,role:"listbox","aria-label":n("mode.select"),children:s.map(o=>{const a=o.id===e;return h.jsxs("button",{type:"button",role:"option","aria-selected":a,className:`${Uc.row} ${a?Uc.selected:""}`,onClick:()=>t(o.id),children:[h.jsx("span",{className:Uc.modeIcon,children:h.jsx(o3,{mode:o.id})}),h.jsxs("span",{className:Uc.modeText,children:[h.jsx("span",{className:Uc.modeName,children:o.name}),h.jsx("span",{className:Uc.modeDesc,children:o.description})]})]},o.id)})})}const qxe="_selected_1hdqc_154",Fxe="_disabled_1hdqc_175",Uxe={"resume-picker":"_resume-picker_1hdqc_4","resume-picker-in-shell":"_resume-picker-in-shell_1hdqc_15","resume-picker-header":"_resume-picker-header_1hdqc_22","resume-picker-close":"_resume-picker-close_1hdqc_29","resume-picker-title":"_resume-picker-title_1hdqc_69","resume-picker-count":"_resume-picker-count_1hdqc_75","resume-picker-search":"_resume-picker-search_1hdqc_80","resume-picker-search-label":"_resume-picker-search-label_1hdqc_89","resume-picker-search-input":"_resume-picker-search-input_1hdqc_93","resume-picker-search-value":"_resume-picker-search-value_1hdqc_103","resume-picker-search-hint":"_resume-picker-search-hint_1hdqc_107","resume-picker-sep":"_resume-picker-sep_1hdqc_111","resume-picker-list":"_resume-picker-list_1hdqc_116","resume-picker-list-compact":"_resume-picker-list-compact_1hdqc_123","resume-picker-empty":"_resume-picker-empty_1hdqc_127","resume-picker-item":"_resume-picker-item_1hdqc_133","resume-picker-session-item":"_resume-picker-session-item_1hdqc_149",selected:qxe,"resume-picker-item-current":"_resume-picker-item-current_1hdqc_162","resume-picker-keyboard-only":"_resume-picker-keyboard-only_1hdqc_167",disabled:Fxe,"resume-picker-item-row":"_resume-picker-item-row_1hdqc_180","resume-picker-item-prefix":"_resume-picker-item-prefix_1hdqc_189","resume-picker-item-title":"_resume-picker-item-title_1hdqc_199","resume-picker-item-checkbox":"_resume-picker-item-checkbox_1hdqc_212","resume-picker-item-number":"_resume-picker-item-number_1hdqc_224","resume-picker-item-provider":"_resume-picker-item-provider_1hdqc_232","resume-picker-item-meta":"_resume-picker-item-meta_1hdqc_245","resume-picker-item-detail":"_resume-picker-item-detail_1hdqc_253","resume-picker-item-check":"_resume-picker-item-check_1hdqc_212","resume-picker-item-badge":"_resume-picker-item-badge_1hdqc_269","tools-status-badge":"_tools-status-badge_1hdqc_278","tools-status-badge-enabled":"_tools-status-badge-enabled_1hdqc_289","tools-status-badge-disabled":"_tools-status-badge-disabled_1hdqc_293","tools-status-badge-busy":"_tools-status-badge-busy_1hdqc_297","tools-picker-item":"_tools-picker-item_1hdqc_301","tools-picker-item-expanded":"_tools-picker-item-expanded_1hdqc_312","tools-item-icon":"_tools-item-icon_1hdqc_316","tools-item-chevron":"_tools-item-chevron_1hdqc_348","tools-item-chevron-expanded":"_tools-item-chevron-expanded_1hdqc_360","tools-item-detail":"_tools-item-detail_1hdqc_364","mcp-status":"_mcp-status_1hdqc_369","mcp-status-connected":"_mcp-status-connected_1hdqc_373","mcp-status-connecting":"_mcp-status-connecting_1hdqc_377","mcp-status-disconnected":"_mcp-status-disconnected_1hdqc_381","mcp-status-disabled":"_mcp-status-disabled_1hdqc_385","mcp-status-unknown":"_mcp-status-unknown_1hdqc_386","resume-picker-detail-panel":"_resume-picker-detail-panel_1hdqc_389","resume-picker-detail-row":"_resume-picker-detail-row_1hdqc_399","resume-picker-detail-label":"_resume-picker-detail-label_1hdqc_406","resume-picker-detail-value":"_resume-picker-detail-value_1hdqc_411","dialog-inline-button":"_dialog-inline-button_1hdqc_416","dialog-primary-button":"_dialog-primary-button_1hdqc_417","dialog-danger-button":"_dialog-danger-button_1hdqc_418","dialog-inline-actions":"_dialog-inline-actions_1hdqc_441","dialog-footer-actions":"_dialog-footer-actions_1hdqc_447","dialog-form":"_dialog-form_1hdqc_465","dialog-form-row":"_dialog-form-row_1hdqc_493","dialog-textarea":"_dialog-textarea_1hdqc_499","dialog-split":"_dialog-split_1hdqc_504","dialog-split-list":"_dialog-split-list_1hdqc_511","tools-desc-expanded":"_tools-desc-expanded_1hdqc_515","tools-desc-body":"_tools-desc-body_1hdqc_525","extensions-toolbar":"_extensions-toolbar_1hdqc_532","extensions-row-button":"_extensions-row-button_1hdqc_536","extensions-detail":"_extensions-detail_1hdqc_551","extensions-detail-actions":"_extensions-detail-actions_1hdqc_562","extensions-detail-grid":"_extensions-detail-grid_1hdqc_569","extensions-detail-field":"_extensions-detail-field_1hdqc_575","extensions-detail-label":"_extensions-detail-label_1hdqc_582","extensions-detail-value":"_extensions-detail-value_1hdqc_588","extensions-confirm":"_extensions-confirm_1hdqc_595","dialog-detail":"_dialog-detail_1hdqc_605","dialog-detail-title":"_dialog-detail-title_1hdqc_613","dialog-detail-shortcut":"_dialog-detail-shortcut_1hdqc_621","dialog-detail-meta":"_dialog-detail-meta_1hdqc_628","dialog-detail-body":"_dialog-detail-body_1hdqc_633"};function ge(...e){return e.filter(t=>!!t).map(t=>Uxe[t]).filter(Boolean).join(" ")}function hb(e,t){const n=Date.now()-new Date(e).getTime(),r=Math.floor(n/6e4);if(r<1)return t("time.justNow");if(r<60)return t("time.minutesAgo",{count:r});const s=Math.floor(r/60);if(s<24)return t("time.hoursAgo",{count:s});const i=Math.floor(s/24);return i<7?t("time.daysAgo",{count:i}):new Date(e).toLocaleDateString()}function Hxe({onSelect:e,onClose:t}){const{t:n}=et(),r=bc(),{sessions:s,loading:i,error:o}=Sy({autoLoad:!0}),a=r.sessionId,[l,c]=g.useState(0),[u,d]=g.useState(""),f=g.useRef(null),m=g.useRef(null),p=u?s.filter(y=>{const v=u.toLowerCase();return(y.displayName||"").toLowerCase().includes(v)||y.sessionId.toLowerCase().includes(v)}):s;return g.useEffect(()=>{l>=p.length&&p.length>0&&c(p.length-1)},[p.length,l]),g.useEffect(()=>{var v;const y=(v=f.current)==null?void 0:v.children[l];y==null||y.scrollIntoView({block:"nearest"})},[l]),g.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]),h.jsxs("div",{className:ge("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ge("resume-picker-search"),children:[h.jsxs("span",{className:ge("resume-picker-search-label"),children:[n("resume.search"),":"," "]}),h.jsx("input",{ref:m,className:ge("resume-picker-search-input"),value:u,onChange:y=>{d(y.target.value),c(0)},placeholder:""})]}),h.jsx("div",{className:ge("resume-picker-sep")}),h.jsxs("div",{className:ge("resume-picker-list"),ref:f,children:[i&&h.jsx("div",{className:ge("resume-picker-empty"),children:n("common.loading")}),!i&&o&&h.jsx("div",{className:ge("resume-picker-empty"),children:o.message||"Failed to load sessions"}),!i&&!o&&p.length===0&&h.jsx("div",{className:ge("resume-picker-empty"),children:u?n("resume.noMatch",{query:u}):n("resume.none")}),!i&&p.map(y=>{const v=y.sessionId===a;return h.jsxs("div",{className:ge("resume-picker-item","resume-picker-session-item",v?"resume-picker-item-current":void 0),onClick:()=>{e(y.sessionId),t()},children:[h.jsxs("div",{className:ge("resume-picker-item-row"),children:[h.jsx("span",{className:ge("resume-picker-item-title"),children:y.displayName||y.sessionId.slice(0,8)}),v&&h.jsx("span",{className:ge("resume-picker-item-badge"),children:n("resume.current")})]}),h.jsxs("div",{className:ge("resume-picker-item-meta"),children:[h.jsx("span",{children:(y.updatedAt||y.createdAt)&&hb(y.updatedAt||y.createdAt||"",n)}),h.jsx("span",{className:ge("resume-picker-item-detail"),children:n("common.clients",{count:y.clientCount??0})}),y.hasActivePrompt&&h.jsx("span",{className:ge("resume-picker-item-detail"),children:n("resume.activePrompt")})]})]},y.sessionId)})]})]})}const Vxe="_themeDark_1qz6x_1",Wxe="_themeLight_1qz6x_20",Gxe="_backdrop_1qz6x_39",Kxe="_panel_1qz6x_59",Yxe="_sizeSm_1qz6x_71",Xxe="_sizeMd_1qz6x_75",Qxe="_sizeLg_1qz6x_79",Jxe="_sizeXl_1qz6x_83",Zxe="_header_1qz6x_87",ewe="_titleWrap_1qz6x_96",twe="_title_1qz6x_96",nwe="_subtitle_1qz6x_108",rwe="_close_1qz6x_115",swe="_body_1qz6x_154",Fs={themeDark:Vxe,themeLight:Wxe,backdrop:Gxe,panel:Kxe,sizeSm:Yxe,sizeMd:Xxe,sizeLg:Qxe,sizeXl:Jxe,header:Zxe,titleWrap:ewe,title:twe,subtitle:nwe,close:rwe,body:swe},iwe={sm:Fs.sizeSm,md:Fs.sizeMd,lg:Fs.sizeLg,xl:Fs.sizeXl};function Qr({title:e,subtitle:t,size:n="md",onClose:r,children:s}){const{t:i}=et(),a=A5()===ds.Light?Fs.themeLight:Fs.themeDark,l=h.jsx("div",{className:`${Fs.backdrop} ${a}`,"data-keyboard-scope":!0,children:h.jsxs("section",{className:`${Fs.panel} ${iwe[n]}`,role:"dialog","aria-modal":"true","aria-label":e,children:[h.jsxs("header",{className:Fs.header,children:[h.jsxs("div",{className:Fs.titleWrap,children:[h.jsx("div",{className:Fs.title,children:e}),t&&h.jsx("div",{className:Fs.subtitle,children:t})]}),h.jsx("button",{type:"button",className:Fs.close,onClick:r,"aria-label":i("common.close"),title:i("common.close")})]}),h.jsx("div",{className:Fs.body,children:s})]})});return typeof document>"u"?l:ny.createPortal(l,document.body)}const owe="_layout_10a96_1",awe="_list_10a96_9",lwe="_row_10a96_17",cwe="_selected_10a96_33",uwe="_label_10a96_37",dwe="_divider_10a96_41",hwe="_number_10a96_48",fwe="_provider_10a96_54",mwe="_badge_10a96_69",pwe="_detail_10a96_75",gwe="_detailRow_10a96_87",ywe="_detailLabel_10a96_94",bwe="_detailValue_10a96_100",xwe="_empty_10a96_105",Ps={layout:owe,list:awe,row:lwe,selected:cwe,label:uwe,divider:dwe,number:hwe,provider:fwe,badge:mwe,detail:pwe,detailRow:gwe,detailLabel:ywe,detailValue:bwe,empty:xwe};function wwe(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function vwe(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 wC(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function _we(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function kwe(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function Swe(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function zp({label:e,value:t}){return h.jsxs("div",{className:Ps.detailRow,children:[h.jsx("span",{className:Ps.detailLabel,children:e}),h.jsx("span",{className:Ps.detailValue,children:t})]})}function Twe({mode:e="main",onSelect:t,models:n,currentModelId:r}){const s=bc(),i=r??s.currentModel??"",o=g.useMemo(()=>n??s.models??[],[n,s.models]),{t:a}=et(),l=g.useRef(null),c=e==="fast",u=e==="voice",d=o.findIndex(m=>m.id===i),f=d>=0?o[d]:o[0];return g.useEffect(()=>{var p;const m=(p=l.current)==null?void 0:p.children[d];m==null||m.scrollIntoView({block:"nearest"})},[d]),h.jsxs("div",{className:Ps.layout,children:[h.jsxs("div",{className:Ps.list,ref:l,role:"listbox","aria-label":a(c?"model.setFast":u?"model.setVoice":"model.select"),children:[o.length===0?h.jsx("div",{className:Ps.empty,children:a("model.none")}):null,o.map((m,p)=>{const y=m.id===i,v=wC(m);return h.jsxs("button",{type:"button",role:"option","aria-selected":y,className:`${Ps.row} ${y?Ps.selected:""}`,onClick:()=>t(Swe(m,c)),children:[h.jsxs("span",{className:Ps.number,children:[p+1,"."]}),v?h.jsxs("span",{className:Ps.provider,children:["[",v,"]"]}):null,h.jsx("span",{className:Ps.label,children:_we(m)}),m.isRuntime?h.jsx("span",{className:Ps.badge,children:"Runtime"}):null]},kwe(m))})]}),f?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Ps.divider}),h.jsxs("div",{className:Ps.detail,children:[h.jsx(zp,{label:a("model.modality"),value:vwe(f.modalities,a)}),h.jsx(zp,{label:a("model.contextWindow"),value:wwe(f.contextWindow,a)}),wC(f)!=="qwen-oauth"?h.jsxs(h.Fragment,{children:[h.jsx(zp,{label:a("model.baseUrl"),value:f.baseUrl??a("model.default")}),h.jsx(zp,{label:a("model.apiKey"),value:f.envKey??a("model.notSet")})]}):null]})]}):null]})}function c6(e){return e.replace(/[：:\s]+$/u,"")}const Cwe="_panel_irhhk_1",Awe="_embedded_irhhk_13",Ewe="_footer_irhhk_21",Mwe="_titleLine_irhhk_25",Nwe="_icon_irhhk_32",Iwe="_title_irhhk_25",Rwe="_subtitle_irhhk_44",jwe="_text_irhhk_49",Lwe="_options_irhhk_55",Dwe="_option_irhhk_55",Owe="_optionActive_irhhk_77",Bwe="_optionLabel_irhhk_81",$we="_optionIcon_irhhk_86",zwe="_optionContent_irhhk_119",Pwe="_optionDesc_irhhk_129",qwe="_badge_irhhk_135",Fwe="_toolDetail_irhhk_170",Uwe="_toolDetailTitle_irhhk_175",Hwe="_toolDetailBody_irhhk_180",Vwe="_toolList_irhhk_181",Wwe="_textInput_irhhk_193",Gwe="_textArea_irhhk_211",Kwe="_summary_irhhk_231",Ywe="_summaryRow_irhhk_238",Xwe="_summaryLabel_irhhk_244",Qwe="_summaryValue_irhhk_250",Jwe="_summaryBlockTitle_irhhk_255",Zwe="_summaryBlock_irhhk_255",eve="_manageList_irhhk_295",tve="_manageItem_irhhk_301",nve="_manageItemExpanded_irhhk_307",rve="_manageRow_irhhk_312",sve="_manageRowActive_irhhk_329",ive="_manageIcon_irhhk_333",ove="_manageName_irhhk_362",ave="_levelTag_irhhk_370",lve="_manageChevron_irhhk_380",cve="_manageChevronExpanded_irhhk_398",uve="_manageDetail_irhhk_402",dve="_manageDetailInner_irhhk_409",hve="_manageDetailHeader_irhhk_419",fve="_manageActions_irhhk_426",mve="_manageButton_irhhk_433",pve="_dangerButton_irhhk_453",gve="_deleteText_irhhk_457",yve="_viewerRow_irhhk_487",bve="_viewerLabel_irhhk_500",xve="_viewerField_irhhk_507",wve="_viewerSectionTitle_irhhk_512",vve="_viewerBlock_irhhk_518",_ve="_closed_irhhk_524",kve="_closedText_irhhk_528",Sve="_loading_irhhk_534",Tve="_error_irhhk_539",Cve="_createWizard_irhhk_545",Ave="_createSteps_irhhk_551",Eve="_createStepPill_irhhk_559",Mve="_createStepPillActive_irhhk_571",Nve="_createStepPillDone_irhhk_576",Ive="_createStepNumber_irhhk_580",Rve="_createStepLabel_irhhk_591",jve="_createBody_irhhk_597",Lve="_createActions_irhhk_601",be={panel:Cwe,embedded:Awe,footer:Ewe,titleLine:Mwe,icon:Nwe,title:Iwe,subtitle:Rwe,text:jwe,options:Lwe,option:Dwe,optionActive:Owe,optionLabel:Bwe,optionIcon:$we,optionContent:zwe,optionDesc:Pwe,badge:qwe,toolDetail:Fwe,toolDetailTitle:Uwe,toolDetailBody:Hwe,toolList:Vwe,textInput:Wwe,textArea:Gwe,summary:Kwe,summaryRow:Ywe,summaryLabel:Xwe,summaryValue:Qwe,summaryBlockTitle:Jwe,summaryBlock:Zwe,manageList:eve,manageItem:tve,manageItemExpanded:nve,manageRow:rve,manageRowActive:sve,manageIcon:ive,manageName:ove,levelTag:ave,manageChevron:lve,manageChevronExpanded:cve,manageDetail:uve,manageDetailInner:dve,manageDetailHeader:hve,manageActions:fve,manageButton:mve,dangerButton:pve,deleteText:gve,viewerRow:yve,viewerLabel:bve,viewerField:xve,viewerSectionTitle:wve,viewerBlock:vve,closed:_ve,closedText:kve,loading:Sve,error:Tve,createWizard:Cve,createSteps:Ave,createStepPill:Eve,createStepPillActive:Mve,createStepPillDone:Nve,createStepNumber:Ive,createStepLabel:Rve,createBody:jve,createActions:Lve};function NO(e){if(e==="project")return"workspace";if(e==="user")return"global"}function IO(e){return NO(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function Dve(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 zo=c6;function Ove(e){return e.displayName||e.name}function RO(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 jO(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function LO(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function Bve(e,t){if(!t||t.length===0)return 0;const n=new Set(t),r=e.findIndex(s=>s.id==="all"||s.tools.length!==n.size?!1:s.tools.every(i=>n.has(i)));return r>=0?r:0}function $ve({mode:e,embedded:t=!1,onMessage:n,onClose:r}){const{t:s}=et(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:c,generateAgent:u,deleteAgent:d}=RU({autoLoad:!0}),{tools:f}=TN({autoLoad:!0}),[m,p]=g.useState(!1),[y,v]=g.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[b,x]=g.useState(0),[w,k]=g.useState(0),[T,C]=g.useState(null),[A,L]=g.useState(null),[$,E]=g.useState(!1),[z,M]=g.useState(null),[U,K]=g.useState(1),[J,P]=g.useState(()=>e==="create-user"?"global":"workspace"),[V,X]=g.useState("manual"),[te,D]=g.useState(""),[j,B]=g.useState(""),[I,ne]=g.useState(""),[de,ce]=g.useState([]),[Ne,Ce]=g.useState(0),[ze,ue]=g.useState(!1),[rt,xe]=g.useState(!1),Ee=g.useRef(0),Zt=g.useCallback(()=>{p(!0),r()},[r]),ht=g.useMemo(()=>{const Oe=i.filter(W=>W.level==="project"),ot=i.filter(W=>W.level==="user"),ft=i.filter(W=>W.level==="builtin"),F=i.filter(W=>W.level==="extension");return{project:Oe,user:ot,builtin:ft,extension:F}},[i]),bt=g.useMemo(()=>[...ht.project,...ht.user,...ht.builtin,...ht.extension],[ht]),Vt=g.useMemo(()=>{const Oe=f.filter(W=>W.enabled).map(Ove).sort((W,re)=>W.localeCompare(re)),ot=Oe.filter(RO),ft=Oe.filter(jO),F=Oe.filter(LO);return[{id:"all",label:s("agent.create.tools.all"),tools:[]},{id:"read",label:s("agent.create.tools.readOnly"),tools:ot},{id:"edit",label:s("agent.create.tools.readEdit"),tools:[...new Set([...ot,...ft])]},{id:"execute",label:s("agent.create.tools.readEditExecute"),tools:[...new Set([...ot,...ft,...F])]}]},[s,f]);g.useEffect(()=>{if(y!=="manage")return;const Oe=A!==null?bt[A]:void 0;Oe&&l(Oe.name).then(C).catch(ot=>M(ot instanceof Error?ot.message:String(ot)))},[y,bt,A,l]),g.useEffect(()=>{w>=bt.length&&bt.length>0&&k(bt.length-1),A!==null&&A>=bt.length&&L(null)},[A,bt.length,w]);const pn=g.useCallback((Oe=w)=>{const ot=bt[Oe];if(!ot||!IO(ot))return;const ft=NO(ot.level);ft&&(E(!0),d(ot.name,ft).then(()=>{n(s("agent.deleted",{name:ot.name})),C(null),L(null),k(0),a()}).catch(F=>M(F instanceof Error?F.message:String(F))).finally(()=>E(!1)))},[bt,w,d,n,a,s]),vt=g.useCallback(()=>{if(!te.trim()||!j.trim()||!I.trim()){M(s("agent.create.required"));return}E(!0),c({name:te.trim(),description:j.trim(),systemPrompt:I.trim(),scope:J,tools:de}).then(Oe=>{n(s("agent.created",{name:Oe.agent.name})),Zt()}).catch(Oe=>M(Oe instanceof Error?Oe.message:String(Oe))).finally(()=>E(!1))},[te,j,I,J,de,c,n,Zt,s]),Wt=g.useCallback(async()=>{const Oe=j.trim();if(!Oe||ze)return;const ot=Ee.current+1;Ee.current=ot,ue(!0),xe(!1),M(null);try{const ft=await u(Oe);if(Ee.current!==ot)return;D(ft.name),B(ft.description),ne(ft.systemPrompt),K(V==="manual"?6:4),Ce(0)}catch(ft){if(Ee.current!==ot)return;M(s("agent.create.generateFailed",{error:ft instanceof Error?ft.message:String(ft)})),xe(!0)}finally{Ee.current===ot&&ue(!1)}},[j,ze,V,u,s]),Gt=g.useCallback(Oe=>{if(Oe==="name"&&te.trim())K(4),xe(!0);else if(Oe==="prompt"&&I.trim())K(5),xe(!0);else if(Oe==="desc"&&j.trim()){if(V==="qwen"){Wt();return}K(V==="manual"?6:4),Ce(0),xe(!1)}},[te,j,I,V,Wt]);if(m)return h.jsx("div",{className:`${be.panel} ${t?be.embedded:""} ${be.closed}`,children:h.jsx("div",{className:be.closedText,children:s("agents.closed")})});if(o&&i.length===0)return h.jsxs("div",{className:`${be.panel} ${t?be.embedded:""}`,children:[h.jsxs("div",{className:be.titleLine,children:[h.jsx("span",{className:be.icon,children:"?"}),h.jsx("span",{className:be.title,children:s("agents.title")})]}),h.jsx("div",{className:be.loading,children:s("common.loading")})]});const Tt=s("agents.title");return h.jsxs("div",{className:`${be.panel} ${t?be.embedded:""}`,children:[!t&&y!=="create"&&h.jsxs("div",{className:be.titleLine,children:[h.jsx("span",{className:be.icon,children:"?"}),h.jsx("span",{className:be.title,children:Tt}),h.jsx("span",{className:be.subtitle,children:s("agent.count",{count:i.length})})]}),z&&h.jsx("div",{className:be.error,children:z}),y==="menu"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.text,children:s("agent.selectAction")}),h.jsxs("div",{className:be.options,children:[h.jsx(tu,{idx:0,active:b===0,label:s("agent.manage"),desc:s("agent.manage.desc"),onClick:()=>{x(0),v("manage")},onHover:()=>x(0)}),h.jsx(tu,{idx:1,active:b===1,label:s("agent.create"),desc:s("agent.create.desc"),onClick:()=>{x(1),v("create")},onHover:()=>x(1)})]}),h.jsx("div",{className:be.footer,children:s("agent.footer.nav")})]}),y==="manage"&&h.jsx(zve,{agents:bt,expandedAgentIdx:A,selectedAgent:T,busy:$,onToggleAgent:Oe=>{k(Oe),L(ot=>ot===Oe?null:Oe),C(null)},onDelete:Oe=>{$||pn(Oe)},t:s}),y==="create"&&h.jsx(Pve,{step:U,method:V,scope:J,name:te,desc:j,prompt:I,tools:de,toolCategories:Vt,selIdx:Ne,busy:$,generating:ze,inputFocused:rt,onSetName:D,onSetDesc:B,onSetPrompt:ne,onInputNext:Gt,onInputFocus:()=>xe(!0),onInputBlur:()=>xe(!1),onSetStep:K,onSetSelectedIndex:Ce,onSelectLocation:Oe=>{Ce(Oe),P(Oe===0?"workspace":"global")},onSelectMethod:Oe=>{Ce(Oe),X(Oe===0?"qwen":"manual")},onSelectTools:Oe=>{var ot;Ce(Oe),ce(((ot=Vt[Oe])==null?void 0:ot.tools)??[])},onSave:()=>{$||vt()},t:s})]})}function tu({idx:e,active:t,label:n,desc:r,badge:s,numbered:i=!1,onClick:o,onHover:a}){return h.jsxs("div",{className:`${be.option} ${t?be.optionActive:""}`,onClick:o,onMouseEnter:a,children:[h.jsx("span",{className:be.optionIcon,"aria-hidden":"true"}),h.jsxs("span",{className:be.optionContent,children:[h.jsxs("span",{className:be.optionLabel,children:[i?`${e+1}. `:"",n,s&&h.jsx("span",{className:be.badge,children:s})]}),r&&h.jsx("span",{className:be.optionDesc,children:r})]})]})}function zve({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:r,onToggleAgent:s,onDelete:i,t:o}){const[a,l]=g.useState(null),c=g.useMemo(()=>new Set(e.filter(u=>u.level==="project").map(u=>u.name)),[e]);return e.length===0?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.text,children:o("agent.empty")}),h.jsx("div",{className:be.text,children:o("agent.createFirstHint")})]}):h.jsx("div",{className:be.manageList,children:e.map((u,d)=>{const f=t===d,m=f&&(n==null?void 0:n.name)===u.name?n:null,p=IO(u),y=(m==null?void 0:m.tools)??[],v=y.length===0||y.includes("*")?o("agent.create.tools.all"):y.join(", ");return h.jsxs("div",{className:`${be.manageItem} ${f?be.manageItemExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${be.manageRow} ${f?be.manageRowActive:""}`,onClick:()=>{l(null),s(d)},children:[h.jsx("span",{className:be.manageIcon,"aria-hidden":"true"}),h.jsx("span",{className:be.manageName,children:u.name}),h.jsx("span",{className:be.levelTag,children:Dve(u.level,o)}),u.level==="user"&&c.has(u.name)?h.jsx("span",{className:be.levelTag,children:o("agent.overriddenBadge")}):null,h.jsx("span",{className:`${be.manageChevron} ${f?be.manageChevronExpanded:""}`})]}),f?h.jsx("div",{className:be.manageDetail,children:m?h.jsxs("div",{className:be.manageDetailInner,children:[h.jsx("div",{className:be.manageDetailHeader,children:p?h.jsx("div",{className:be.manageActions,children:a===d?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:be.deleteText,children:r?o("agent.delete.loading"):o("agent.delete.confirm",{name:u.name})}),h.jsx("button",{type:"button",className:be.manageButton,onClick:()=>l(null),disabled:r,children:o("common.cancel")}),h.jsx("button",{type:"button",className:`${be.manageButton} ${be.dangerButton}`,onClick:()=>i(d),disabled:r,children:o("agent.action.delete")})]}):h.jsx("button",{type:"button",className:`${be.manageButton} ${be.dangerButton}`,onClick:()=>l(d),disabled:r,children:o("agent.action.delete")})}):null}),h.jsxs("div",{className:be.viewerField,children:[h.jsx("div",{className:be.viewerSectionTitle,children:zo(o("agent.toolsLabel"))}),h.jsx("div",{className:be.viewerBlock,children:v})]}),h.jsxs("div",{className:be.viewerField,children:[h.jsx("div",{className:be.viewerSectionTitle,children:zo(o("agent.filePathLabel"))}),h.jsx("div",{className:be.viewerBlock,children:m.filePath||"—"})]}),m.model?h.jsxs("div",{className:be.viewerRow,children:[h.jsx("span",{className:be.viewerLabel,children:zo(o("agent.modelLabel"))}),h.jsx("span",{children:m.model})]}):null,h.jsxs("div",{className:be.viewerField,children:[h.jsx("div",{className:be.viewerSectionTitle,children:zo(o("agent.descriptionLabel"))}),h.jsx("div",{className:be.viewerBlock,children:m.description||"—"})]}),h.jsxs("div",{className:be.viewerField,children:[h.jsx("div",{className:be.viewerSectionTitle,children:zo(o("agent.systemPromptLabel"))}),h.jsx("div",{className:be.viewerBlock,children:m.systemPrompt||"—"})]})]}):h.jsx("div",{className:be.loading,children:o("common.loading")})}):null]},`${u.level}:${u.name}`)})})}function Pve({step:e,method:t,scope:n,name:r,desc:s,prompt:i,tools:o,toolCategories:a,selIdx:l,busy:c,generating:u,inputFocused:d,onSetName:f,onSetDesc:m,onSetPrompt:p,onInputNext:y,onInputFocus:v,onInputBlur:b,onSetStep:x,onSetSelectedIndex:w,onSelectLocation:k,onSelectMethod:T,onSelectTools:C,onSave:A,t:L}){const $=g.useRef(null),E=g.useRef(null),z=g.useRef(null);g.useEffect(()=>{var j,B,I,ne;d&&(t==="manual"?e===3?(j=$.current)==null||j.focus():e===4?(B=z.current)==null||B.focus():e===5&&((I=E.current)==null||I.focus()):e===3&&((ne=E.current)==null||ne.focus()))},[e,t,d]);const M=t==="manual"?6:4,U=M+1,K=t==="manual"?[L("agent.create.location"),L("agent.create.method"),L("agent.create.name"),L("agent.create.prompt"),L("agent.create.description"),L("agent.create.toolsSelection")]:[L("agent.create.location"),L("agent.create.method"),L("agent.create.describeAgent"),L("agent.create.toolsSelection")],J=j=>j===1?n==="workspace"?0:1:j===2?t==="qwen"?0:1:j===M?Bve(a,o):0,P=j=>{x(j),w(J(j)),t==="manual"&&(j===3||j===4||j===5)||t==="qwen"&&j===3?v():b()},V=()=>{e<=1||u||P(e-1)},X=()=>{if(!u){if(e===1){P(2);return}if(e===2){P(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===M&&(C(l),P(U))}},te=u||t==="manual"&&e===3&&!r.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!s.trim()||t==="qwen"&&e===3&&!s.trim();let D=null;if(e===1&&(D=h.jsx(h.Fragment,{children:h.jsxs("div",{className:be.options,children:[h.jsx(tu,{idx:0,active:l===0,label:L("agent.create.project.cli"),numbered:!0,onClick:()=>k(0)}),h.jsx(tu,{idx:1,active:l===1,label:L("agent.create.user.cli"),numbered:!0,onClick:()=>k(1)})]})})),e===2&&(D=h.jsx(h.Fragment,{children:h.jsxs("div",{className:be.options,children:[h.jsx(tu,{idx:0,active:l===0,label:L("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>T(0)}),h.jsx(tu,{idx:1,active:l===1,label:L("agent.create.method.manual"),numbered:!0,onClick:()=>T(1)})]})})),t==="manual"&&e===3&&(D=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.text,children:L("agent.create.nameHelp")}),h.jsx("input",{ref:$,className:be.textInput,value:r,onChange:j=>f(j.target.value),onFocus:v,onBlur:b,placeholder:L("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(D=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.text,children:L("agent.create.promptHelp")}),h.jsx("textarea",{ref:z,className:be.textArea,value:i,onChange:j=>p(j.target.value),onFocus:v,onBlur:b,placeholder:L("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(D=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.text,children:L("agent.create.manualDescHelp")}),h.jsx("textarea",{ref:E,className:be.textArea,value:s,onChange:j=>m(j.target.value),onFocus:v,onBlur:b,placeholder:L("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(D=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.text,children:L("agent.create.qwenHint")}),u?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.text,children:L("agent.create.generatingConfig")}),h.jsx("div",{className:be.footer,children:L("agent.footer.generating")})]}):h.jsx(h.Fragment,{children:h.jsx("textarea",{ref:E,className:be.textArea,value:s,onChange:j=>m(j.target.value),onFocus:v,onBlur:b,placeholder:L("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===M){const j=a[l]??a[0],B=(j==null?void 0:j.tools)??[],I=(j==null?void 0:j.id)==="all"?L("agent.create.tools.allInfo"):B.length>0?B.join(", "):L("agent.create.tools.none"),ne=B.filter(RO),de=B.filter(jO),ce=B.filter(LO);D=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.options,children:a.map((Ne,Ce)=>h.jsx(tu,{idx:Ce,active:l===Ce,label:Ne.label,numbered:!0,onClick:()=>C(Ce)},Ne.id))}),h.jsx("div",{className:be.toolDetail,children:(j==null?void 0:j.id)==="all"?h.jsx("div",{className:be.toolDetailBody,children:I}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:be.toolDetailTitle,children:L("agent.create.tools.selected")}),h.jsx("div",{className:be.toolList,children:B.length===0?I:h.jsxs(h.Fragment,{children:[ne.length>0&&h.jsxs("div",{children:[L("agent.create.tools.readOnlyLabel")," ",ne.join(", ")]}),de.length>0&&h.jsxs("div",{children:[L("agent.create.tools.editLabel")," ",de.join(", ")]}),ce.length>0&&h.jsxs("div",{children:[L("agent.create.tools.executionLabel")," ",ce.join(", ")]})]})})]})})]})}if(e===U){const j=o.length===0?"*":o.join(", ");D=h.jsx(h.Fragment,{children:h.jsxs("div",{className:be.summary,children:[h.jsxs("div",{className:be.summaryRow,children:[h.jsx("span",{className:be.summaryLabel,children:zo(L("agent.create.name"))}),h.jsx("span",{className:be.summaryValue,children:r||"—"})]}),h.jsxs("div",{className:be.summaryRow,children:[h.jsx("span",{className:be.summaryLabel,children:zo(L("agent.location"))}),h.jsx("span",{className:be.summaryValue,children:L(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),h.jsxs("div",{className:be.summaryRow,children:[h.jsx("span",{className:be.summaryLabel,children:zo(L("agent.toolsLabel"))}),h.jsx("span",{className:be.summaryValue,children:j})]}),h.jsx("div",{className:be.summaryBlockTitle,children:zo(L("agent.descriptionLabel"))}),h.jsx("div",{className:be.summaryBlock,children:s||"—"}),h.jsx("div",{className:be.summaryBlockTitle,children:zo(L("agent.systemPromptLabel"))}),h.jsx("div",{className:be.summaryBlock,children:i||"—"})]})})}return h.jsxs("div",{className:be.createWizard,children:[h.jsx("div",{className:be.createSteps,children:K.map((j,B)=>{const I=B+1;return h.jsxs("div",{className:`${be.createStepPill} ${I===Math.min(e,M)?be.createStepPillActive:""} ${I<Math.min(e,M)?be.createStepPillDone:""}`,children:[h.jsx("span",{className:be.createStepNumber,children:I}),h.jsx("span",{className:be.createStepLabel,children:j})]},`${I}:${j}`)})}),h.jsx("div",{className:be.createBody,children:D}),h.jsxs("div",{className:be.createActions,children:[h.jsx("button",{type:"button",className:be.manageButton,onClick:V,disabled:e<=1||u||c,children:L("common.previous")}),e===U?h.jsx("button",{type:"button",className:be.manageButton,onClick:A,disabled:c,children:L(c?"agent.create.loading":"agent.create.save")}):h.jsx("button",{type:"button",className:be.manageButton,onClick:X,disabled:te,children:L("common.next")})]})]})}const qve="_page_1np31_1",Fve="_tabs_1np31_11",Uve="_memoryCard_1np31_19",Hve="_memoryCardActive_1np31_35",Vve="_memoryTitle_1np31_44",Wve="_detailPath_1np31_48",Gve="_status_1np31_49",Kve="_actionButton_1np31_54",Yve="_primaryButton_1np31_55",Xve="_secondaryButton_1np31_56",Qve="_detail_1np31_48",Jve="_detailHeader_1np31_79",Zve="_detailTitleWrap_1np31_87",e3e="_actions_1np31_91",t3e="_content_1np31_105",n3e="_editor_1np31_106",r3e="_editorFooter_1np31_127",Yr={page:qve,tabs:Fve,memoryCard:Uve,memoryCardActive:Hve,memoryTitle:Vve,detailPath:Wve,status:Gve,actionButton:Kve,primaryButton:Yve,secondaryButton:Xve,detail:Qve,detailHeader:Jve,detailTitleWrap:Zve,actions:e3e,content:t3e,editor:n3e,editorFooter:r3e};function vC(e,t){return e.find(n=>n.scope===t)}function _C(e,t){return t(e==="global"?"memory.global":"memory.project")}function s3e({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:r}){var D,j;const{t:s}=et(),{files:i,loading:o,error:a,readFile:l,reload:c,writeMemory:u}=jU({autoLoad:!0}),d=g.useRef(null),f=g.useRef(0),[m,p]=g.useState("workspace"),[y,v]=g.useState("view"),[b,x]=g.useState(""),[w,k]=g.useState(""),[T,C]=g.useState(!1),[A,L]=g.useState(!1),[$,E]=g.useState(null),z=g.useRef(0),M=g.useMemo(()=>{const B=vC(i,"global"),I=vC(i,"workspace");return[{scope:"workspace",title:s("memory.project"),description:s("memory.project.desc"),fallbackPath:"QWEN.md",file:I},{scope:"global",title:s("memory.global"),description:s("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:B}]},[i,s]),U=M.find(B=>B.scope===m)??M[0],K=g.useCallback((B,I)=>{const ne=++f.current;if(v(I),E(null),x(""),k(""),!(B!=null&&B.file)){I==="edit"&&requestAnimationFrame(()=>{var de;return(de=d.current)==null?void 0:de.focus()});return}C(!0),l(B.file.path).then(de=>{ne===f.current&&(x(de.content),k(de.content),de.truncated&&E(s("memory.fileTruncated")),requestAnimationFrame(()=>{var ce;return(ce=d.current)==null?void 0:ce.focus()}))}).catch(de=>{if(ne!==f.current)return;const ce=de instanceof Error?de.message:String(de);E(ce),B.scope!=="global"&&(r==null||r(ce,"error"))}).finally(()=>{ne===f.current&&C(!1)})},[r,l,s]);g.useEffect(()=>{U&&K(U,y)},[(D=U==null?void 0:U.file)==null?void 0:D.path,U==null?void 0:U.scope]),g.useEffect(()=>{a&&E(a.message)},[a]),g.useEffect(()=>{e<=0||c().then(()=>E(s("memory.refreshed"))).catch(B=>{const I=B instanceof Error?B.message:String(B);E(I),r==null||r(I,"error")})},[r,e,c,s]),g.useEffect(()=>{if(t<=0||z.current===t)return;z.current=t;const B=n==="global"?"global":"workspace";p(B);const I=M.find(ne=>ne.scope===B);K(I,"edit")},[n,t,M,K]);const J=B=>{p(B.scope),K(B,"view")},P=()=>{U&&K(U,"edit")},V=()=>{if(U){if(!w.trim()){E(s("memory.contentEmpty"));return}L(!0),E(null),u({scope:U.scope,mode:"replace",content:w}).then(B=>{const I=s("memory.saved",{scope:_C(U.scope,s),bytes:B.bytesWritten,path:B.filePath});x(w),v("view"),E(I),r==null||r(I,"status"),c().catch(()=>{})}).catch(B=>{const I=B instanceof Error?B.message:String(B);E(I),r==null||r(I,"error")}).finally(()=>L(!1))}},X=((j=U==null?void 0:U.file)==null?void 0:j.path)??(U==null?void 0:U.fallbackPath)??"",te=$??(o?s("memory.loading"):null);return h.jsxs("div",{className:Yr.page,children:[h.jsx("nav",{className:Yr.tabs,"aria-label":s("memory.menu"),children:M.map(B=>{const I=B.scope===m;return h.jsx("button",{type:"button",className:`${Yr.memoryCard} ${I?Yr.memoryCardActive:""}`,onClick:()=>J(B),children:h.jsx("span",{className:Yr.memoryTitle,children:B.title})},B.scope)})}),h.jsxs("section",{className:Yr.detail,children:[h.jsxs("header",{className:Yr.detailHeader,children:[h.jsx("div",{className:Yr.detailTitleWrap,children:h.jsx("div",{className:Yr.detailPath,children:X})}),h.jsx("div",{className:Yr.actions,children:h.jsx("button",{type:"button",className:Yr.actionButton,onClick:P,children:s("settings.action.edit")})})]}),te&&h.jsx("div",{className:Yr.status,children:te}),y==="edit"?h.jsxs(h.Fragment,{children:[h.jsx("textarea",{ref:d,className:Yr.editor,value:w,disabled:A||T,onChange:B=>k(B.target.value),placeholder:s("memory.placeholder",{scope:U?_C(U.scope,s):""})}),h.jsxs("div",{className:Yr.editorFooter,children:[h.jsx("button",{type:"button",className:Yr.secondaryButton,disabled:A,onClick:()=>{k(b),v("view")},children:s("common.cancel")}),h.jsx("button",{type:"button",className:Yr.primaryButton,disabled:A||T,onClick:V,children:s(A?"memory.saving":"memory.save")})]})]}):h.jsx("pre",{className:Yr.content,children:T?s("memory.loadingFile"):b||s("memory.noFiles")})]})]})}const i3e="_panel_cxp6w_1",o3e="_steps_cxp6w_10",a3e="_stepPill_cxp6w_18",l3e="_stepPillActive_cxp6w_29",c3e="_stepPillDone_cxp6w_34",u3e="_stepNumber_cxp6w_38",d3e="_stepLabel_cxp6w_49",h3e="_body_cxp6w_55",f3e="_text_cxp6w_59",m3e="_muted_cxp6w_64",p3e="_options_cxp6w_68",g3e="_option_cxp6w_68",y3e="_optionActive_cxp6w_90",b3e="_label_cxp6w_94",x3e="_optionText_cxp6w_98",w3e="_description_cxp6w_112",v3e="_input_cxp6w_119",_3e="_preview_cxp6w_135",k3e="_error_cxp6w_146",S3e="_link_cxp6w_150",T3e="_terms_cxp6w_161",C3e="_actions_cxp6w_169",A3e="_actionButton_cxp6w_177",fn={panel:i3e,steps:o3e,stepPill:a3e,stepPillActive:l3e,stepPillDone:c3e,stepNumber:u3e,stepLabel:d3e,body:h3e,text:f3e,muted:m3e,options:p3e,option:g3e,optionActive:y3e,label:b3e,optionText:x3e,description:w3e,input:v3e,preview:_3e,error:k3e,link:S3e,terms:T3e,actions:C3e,actionButton:A3e},E3e=[{value:"openai",label:"OpenAI-compatible",description:"Standard OpenAI API format (most common)"},{value:"anthropic",label:"Anthropic-compatible",description:"Anthropic Messages API format"},{value:"gemini",label:"Gemini-compatible",description:"Google Gemini API format"}];function gf(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function kC(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function M3e(e,t,n){var r;return e==="protocol"?n("auth.step.protocol"):e==="baseUrl"?((r=t.uiLabels)==null?void 0:r.baseUrlStepTitle)??n("auth.step.baseUrl"):n(e==="apiKey"?"auth.step.apiKey":e==="models"?"auth.step.models":"auth.step.advanced")}function N3e(e){const t=e.trim();return t?t.length<=6?"***":`${t.slice(0,3)}...${t.slice(-4)}`:"(not set)"}function Q4(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function I3e({onMessage:e,onClose:t}){const{t:n}=et(),r=yc(),[s,i]=g.useState("groups"),[o,a]=g.useState(0),[l,c]=g.useState(0),[u,d]=g.useState("providers"),[f,m]=g.useState(0),[p,y]=g.useState(),[v,b]=g.useState("alibaba"),[x,w]=g.useState(null),[k,T]=g.useState("openai"),[C,A]=g.useState(""),[L,$]=g.useState(""),[E,z]=g.useState(""),[M,U]=g.useState(!1),[K,J]=g.useState(!1),[P,V]=g.useState(!0),[X,te]=g.useState(!0),[D,j]=g.useState(!1),[B,I]=g.useState(!1),[ne,de]=g.useState(""),[ce,Ne]=g.useState(!0),[Ce,ze]=g.useState(!1),[ue,rt]=g.useState(null);g.useEffect(()=>{r.getAuthProviders().then(Z=>{y(Z),Ne(!1)}).catch(Z=>{rt(Z instanceof Error?Z.message:String(Z)),Ne(!1)})},[r]);const xe=g.useMemo(()=>(p==null?void 0:p.groups)??[],[p]),Ee=g.useMemo(()=>{var ie;return(((ie=xe.find(fe=>fe.id===v))==null?void 0:ie.providerIds)??[]).map(fe=>p==null?void 0:p.providers.find(Ve=>Ve.id===fe)).filter(fe=>!!fe)},[p,v,xe]),Zt=g.useMemo(()=>(x==null?void 0:x.steps)??[],[x==null?void 0:x.steps]),ht=Zt[f],bt=(x==null?void 0:x.showAdvancedConfig)===!0,Vt=g.useMemo(()=>K?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[K]),pn=Vt.indexOf("context"),vt=ht==="apiKey"||ht==="models"||ht==="baseUrl"&&!Array.isArray(x==null?void 0:x.baseUrl),[Wt,Gt]=g.useState(0),Tt=g.useCallback((Z,ie="providers")=>{var Ve,mt;w(Z),d(ie);const fe=((Ve=Z.protocolOptions)==null?void 0:Ve[0])??Z.protocol;T(fe),typeof Z.baseUrl=="string"?A(Z.baseUrl):Array.isArray(Z.baseUrl)?A(((mt=Z.baseUrl[0])==null?void 0:mt.url)??""):A(gf(fe)),$(""),z(kC(Z)),U(!1),J(!1),V(!0),te(!0),j(!1),I(!1),de(""),m(0),Gt(0),rt(null),i(Z.steps.length>0?"step":"review")},[]),Oe=g.useCallback(()=>{if(rt(null),s==="groups"){t();return}if(s==="providers"){i("groups");return}if(s==="review"){if(Zt.length===0){i(u);return}i("step"),m(Math.max(0,Zt.length-1));return}if(f>0){m(Z=>Z-1),Gt(0);return}i(u)},[t,u,f,Zt.length,s]),ot=g.useCallback(()=>{if(!x||Ce)return;ze(!0),rt(null);const Z=Number(ne);r.installAuthProvider({providerId:x.id,protocol:k,baseUrl:C,apiKey:L,modelIds:Q4(E),advancedConfig:M||K||Number.isFinite(Z)&&Z>0?{...M?{enableThinking:!0}:{},...K?{multimodal:{...P?{image:!0}:{},...X?{video:!0}:{},...D?{audio:!0}:{},...B?{pdf:!0}:{}}}:{},...Number.isFinite(Z)&&Z>0?{contextWindowSize:Z}:{}}:void 0}).then(ie=>{e(ie.message),t()}).catch(ie=>{const fe=ie instanceof Error?ie.message:String(ie);rt(fe),e(fe,"error")}).finally(()=>ze(!1))},[L,C,ne,K,D,P,B,X,E,t,e,k,x,Ce,M,r]),ft=g.useCallback(()=>{if(x){if(ht==="baseUrl"){const Z=C.trim()||gf(k);if(!Z){rt(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(Z)){rt(n("auth.baseUrlInvalid"));return}C.trim()||A(Z)}if(ht==="apiKey"&&L.trim().length===0){rt(n("auth.apiKeyRequired"));return}if(ht==="models"&&Q4(E).length===0){rt(n("auth.modelsRequired"));return}rt(null),f>=Zt.length-1?bt?i("review"):ot():(m(Z=>Z+1),Gt(0))}},[L,C,ht,E,k,x,ot,bt,f,Zt.length,n]),F=g.useCallback(Z=>{switch(Z){case"thinking":U(ie=>!ie);return;case"modality":J(ie=>!ie);return;case"image":V(ie=>!ie);return;case"video":te(ie=>!ie);return;case"audio":j(ie=>!ie);return;case"pdf":I(ie=>!ie);return;case"context":ft();return;default:return}},[ft]),W=g.useCallback(()=>{if(s==="groups"){const Z=xe[o];if(!Z)return;if(Z.id==="custom"){const ie=Z.providerIds.map(fe=>p==null?void 0:p.providers.find(Ve=>Ve.id===fe)).find(fe=>!!fe);ie&&Tt(ie,"groups");return}b(Z.id),c(0),i("providers");return}if(s==="providers"){const Z=Ee[l];Z&&Tt(Z,"providers");return}if(s==="review"){ot();return}if(!(!x||!ht)){if(ht==="protocol"){const Z=(x.protocolOptions??[x.protocol])[Wt];Z&&(T(Z),x.baseUrl||A(gf(Z))),ft();return}if(ht==="baseUrl"&&Array.isArray(x.baseUrl)){const Z=x.baseUrl[Wt];Z&&A(Z.url),ft();return}if(ht==="advancedConfig"){F(Vt[Wt]);return}ft()}},[ht,p,ft,o,xe,Wt,x,l,Ee,ot,Tt,s,F,Vt]),re=g.useCallback(Z=>{if(s==="groups"){const ie=xe[Z];if(!ie)return;if(ie.id==="custom"){const fe=ie.providerIds.map(Ve=>p==null?void 0:p.providers.find(mt=>mt.id===Ve)).find(Ve=>!!Ve);fe&&Tt(fe,"groups");return}b(ie.id),c(0),i("providers");return}if(s==="providers"){const ie=Ee[Z];ie&&Tt(ie,"providers");return}if(!x||!ht){s==="review"&&ot();return}if(ht==="protocol"){const ie=(x.protocolOptions??[x.protocol])[Z];ie&&(T(ie),x.baseUrl||A(gf(ie))),ft();return}if(ht==="baseUrl"&&Array.isArray(x.baseUrl)){const ie=x.baseUrl[Z];ie&&A(ie.url),ft();return}ht==="advancedConfig"&&F(Vt[Z])},[ht,p,ft,xe,F,Vt,x,Ee,ot,Tt,s]),me=(Z,ie,fe)=>h.jsx("div",{className:fn.options,children:Z.map((Ve,mt)=>h.jsx("button",{type:"button",className:`${fn.option} ${ie===mt?fn.optionActive:""}`,onClick:()=>{fe(mt),re(mt)},children:h.jsxs("div",{className:fn.optionText,children:[h.jsx("div",{className:fn.label,children:Ve.label}),Ve.description&&h.jsx("div",{className:fn.description,children:Ve.description})]})},Ve.value))}),Pe=()=>{if(!x||!ht)return null;if(ht==="protocol"){const fe=x.protocolOptions??[x.protocol];return me(E3e.filter(Ve=>fe.includes(Ve.value)),Wt,Gt)}if(ht==="baseUrl")return Array.isArray(x.baseUrl)?me(x.baseUrl.map(fe=>({value:fe.url,label:fe.label,description:fe.url})),Wt,Gt):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:fn.text,children:n("auth.baseUrlPrompt")}),h.jsx("input",{className:fn.input,value:C,placeholder:gf(k),onChange:fe=>{A(fe.target.value),rt(null)},onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.stopPropagation(),ft())},autoFocus:!0}),x.documentationUrl&&h.jsx("a",{className:fn.link,href:x.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(ht==="apiKey")return h.jsxs(h.Fragment,{children:[x.documentationUrl&&h.jsxs("a",{className:fn.link,href:x.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",x.documentationUrl]}),h.jsx("input",{className:fn.input,type:"password",value:L,placeholder:x.apiKeyPlaceholder??"sk-...",onChange:fe=>{$(fe.target.value),rt(null)},onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.stopPropagation(),ft())},autoFocus:!0})]});if(ht==="models"){const fe=kC(x);return h.jsxs(h.Fragment,{children:[fe&&h.jsx("div",{className:fn.muted,children:n("auth.modelsPrompt",{modelIds:fe})}),h.jsx("input",{className:fn.input,value:E,placeholder:fe||"model-id-1, model-id-2",onChange:Ve=>{z(Ve.target.value),rt(null)},onKeyDown:Ve=>{Ve.key==="Enter"&&(Ve.preventDefault(),Ve.stopPropagation(),ft())},autoFocus:!0})]})}const Z=fe=>fe?"◉":"○",ie=[{value:"thinking",label:`${Z(M)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${Z(K)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return K&&ie.push({value:"image",label:`${Z(P)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${Z(X)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${Z(D)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${Z(B)} ${n("auth.advanced.modalityPdf")}`}),ie.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${ne||"auto"}`,description:n("auth.advanced.contextDesc")}),h.jsxs(h.Fragment,{children:[h.jsx("div",{className:fn.text,children:n("auth.advanced.prompt")}),me(ie,Wt,Gt),h.jsx("input",{className:fn.input,value:ne,placeholder:"auto",onChange:fe=>de(fe.target.value.replace(/[^0-9]/g,"")),onFocus:()=>Gt(pn),onKeyDown:fe=>{fe.key==="Enter"&&(fe.preventDefault(),fe.stopPropagation(),ft())}})]})},Re=g.useMemo(()=>{if(!x)return"";const Z=x.envKey??`${k.toUpperCase()}_API_KEY`,ie=Q4(E),fe={};if(M&&(fe.extra_body={enable_thinking:!0}),K){const It={};P&&(It.image=!0),X&&(It.video=!0),D&&(It.audio=!0),B&&(It.pdf=!0),Object.keys(It).length>0&&(fe.modalities=It)}const Ve=Number(ne);Number.isFinite(Ve)&&Ve>0&&(fe.contextWindowSize=Ve);const mt=Object.keys(fe).length>0;return JSON.stringify({env:{[Z]:N3e(L)},modelProviders:{[k]:ie.map(It=>({id:It,name:It,baseUrl:C.trim(),envKey:Z,...mt?{generationConfig:fe}:{}}))},security:{auth:{selectedType:k}},model:{name:ie[0]}},null,2)},[L,C,ne,K,D,P,B,X,E,k,x,M]),nt=g.useMemo(()=>{const Z=[n("auth.step.group"),n("auth.step.provider")];return x&&(Z.push(...Zt.map(ie=>M3e(ie,x,n))),bt&&Z.push(n("auth.review"))),Z},[x,bt,Zt,n]),wt=g.useMemo(()=>s==="groups"?1:s==="providers"?2:s==="step"?Math.min(3+f,nt.length):nt.length,[f,nt.length,s]),ut=ce?h.jsx("div",{className:fn.muted,children:n("common.loading")}):s==="groups"?h.jsxs(h.Fragment,{children:[me(xe.map(Z=>({value:Z.id,label:n(Z.label),description:n(Z.description)})),o,a),h.jsxs("div",{className:fn.terms,children:[h.jsxs("div",{children:[n("auth.termsTitle"),":"]}),h.jsx("a",{className:fn.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/"})]})]}):s==="providers"?me(Ee.map(Z=>({value:Z.id,label:n(Z.label),description:n(Z.description)})),l,c):s==="step"?Pe():h.jsxs(h.Fragment,{children:[h.jsx("div",{className:fn.text,children:n("auth.reviewText")}),h.jsx("div",{className:fn.preview,children:Re})]}),he=()=>{if(s==="review"){ot();return}if(vt||ht==="advancedConfig"){ft();return}W()};return h.jsxs("div",{className:fn.panel,children:[h.jsx("div",{className:fn.steps,children:nt.map((Z,ie)=>{const fe=ie+1;return h.jsxs("div",{className:`${fn.stepPill} ${fe===wt?fn.stepPillActive:""} ${fe<wt?fn.stepPillDone:""}`,children:[h.jsx("span",{className:fn.stepNumber,children:fe}),h.jsx("span",{className:fn.stepLabel,children:Z})]},`${fe}:${Z}`)})}),h.jsx("div",{className:fn.body,children:ut}),ue&&h.jsx("div",{className:fn.error,children:ue}),h.jsxs("div",{className:fn.actions,children:[h.jsx("button",{type:"button",className:fn.actionButton,onClick:Oe,disabled:s==="groups"||ce||Ce,children:n("common.previous")}),h.jsx("button",{type:"button",className:fn.actionButton,onClick:he,disabled:ce||Ce,children:n(s==="review"?Ce?"auth.saving":"auth.save":"common.next")})]})]})}function R3e(e){return e.displayName||e.name}function j3e(){const{t:e}=et(),{status:t,tools:n,loading:r,error:s}=TN({autoLoad:!0}),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,u]=g.useState(()=>new Set),d=g.useRef(null);g.useEffect(()=>{var p,y;s?l(s.message):(y=(p=t==null?void 0:t.errors)==null?void 0:p[0])!=null&&y.error?l(t.errors[0].error):t&&l(null)},[t,s]);const f=g.useCallback(p=>{u(y=>y.has(p.name)?new Set:new Set([p.name]))},[]);g.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),g.useEffect(()=>{var y;const p=(y=d.current)==null?void 0:y.children[i];p==null||p.scrollIntoView({block:"nearest"})},[i]);const m=g.useMemo(()=>{if(!t)return"";const p=n.filter(y=>y.enabled).length;return e("tools.summary",{enabled:p,total:n.length})},[t,n,e]);return h.jsxs("div",{className:ge("resume-picker","resume-picker-in-shell"),children:[m&&h.jsx("div",{className:ge("resume-picker-search"),children:h.jsx("span",{className:ge("resume-picker-search-hint"),children:m})}),(a||r)&&h.jsx("div",{className:ge("resume-picker-search"),children:h.jsx("span",{className:ge("resume-picker-search-hint"),children:a||e("tools.loading")})}),h.jsx("div",{className:ge("resume-picker-sep")}),h.jsxs("div",{className:ge("resume-picker-list"),ref:d,children:[!r&&n.length===0&&h.jsx("div",{className:ge("resume-picker-empty"),children:e("tools.empty")}),n.map((p,y)=>{const v=c.has(p.name),b=p.description??"";return h.jsxs("div",{className:ge("resume-picker-item","resume-picker-session-item","tools-picker-item",v?"selected":void 0,v?"tools-picker-item-expanded":void 0),onClick:()=>{o(y),p.description&&f(p)},children:[h.jsxs("div",{className:ge("resume-picker-item-row"),children:[h.jsx("span",{className:ge("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:ge("resume-picker-item-title"),children:R3e(p)}),h.jsx("span",{className:ge("tools-status-badge",p.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:p.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),b?h.jsx("svg",{className:ge("tools-item-chevron",v?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),v&&b&&h.jsx("div",{className:ge("tools-desc-expanded"),children:h.jsx("div",{className:ge("tools-desc-body"),children:b})})]},p.name)})]})]})}const DO="update available";function L3e(e){return e.displayName||e.name}function OO(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function D3e(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 td(e){return e&&e.length>0?e.join(", "):"-"}const O3e=c6;function B3e(){const{t:e}=et(),t=bc(),n=yc(),r=Bu(),[s,i]=g.useState([]),[o,a]=g.useState(null),[l,c]=g.useState(null),[u,d]=g.useState({}),[f,m]=g.useState(!1),[p,y]=g.useState(!1),[v,b]=g.useState(null),[x,w]=g.useState(null),k=g.useCallback(()=>(m(!0),n.loadExtensionsStatus().then($=>{var z,M;const E=$.extensions??[];i(E),w(((M=(z=$.errors)==null?void 0:z[0])==null?void 0:M.error)??null),a(U=>U&&E.some(K=>K.name===U)?U:null)}).catch($=>{w($ instanceof Error?$.message:String($))}).finally(()=>m(!1))),[n]),T=g.useCallback(()=>{const $=t.clientId;return $?(y(!0),n.checkExtensionUpdates($).then(E=>d(E.states)).catch(E=>{w(E instanceof Error?E.message:String(E))}).finally(()=>y(!1))):(w(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),C=g.useCallback(()=>{const $=t.clientId;if(!$){w(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions($).then(async E=>{w(e("extensions.manage.refreshed",{refreshed:E.refreshed,failed:E.failed})),await k(),await T()}).catch(E=>{w(E instanceof Error?E.message:String(E))}).finally(()=>y(!1))},[n,T,t.clientId,k,e]);g.useEffect(()=>{k()},[k]),g.useEffect(()=>{s.length>0&&T()},[T,s.length]),g.useEffect(()=>{((r==null?void 0:r.extensionsVersion)??0)>0&&(d({}),k())},[k,r==null?void 0:r.extensionsVersion]);const A=g.useCallback(($,E)=>{const z=t.clientId;if(!z){w(e("extensions.install.waitForSession"));return}b($),w(null),E(z).then(()=>w(e("extensions.manage.queued",{name:$}))).catch(M=>{w(M instanceof Error?M.message:String(M))}).finally(()=>b(null))},[t.clientId,e]),L=g.useMemo(()=>f?e("extensions.manage.loading"):p?e("extensions.manage.checkingUpdates"):e("extensions.manage.count",{count:s.length}),[p,s.length,f,e]);return h.jsxs("div",{className:ge("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ge("resume-picker-search","extensions-toolbar"),children:[h.jsx("span",{className:ge("resume-picker-search-hint"),children:x||L}),h.jsx("button",{type:"button",className:ge("dialog-inline-button"),disabled:f||p,onClick:C,children:e("common.refresh")})]}),h.jsx("div",{className:ge("resume-picker-sep")}),h.jsxs("div",{className:ge("resume-picker-list"),children:[!f&&s.length===0&&h.jsx("div",{className:ge("resume-picker-empty"),children:e("extensions.manage.empty")}),s.map($=>{const E=u[$.name]??$.updateState,z=o===$.name,M=v===$.name;return h.jsxs("div",{className:ge("resume-picker-item","resume-picker-session-item","tools-picker-item",z?"selected":void 0,z?"tools-picker-item-expanded":void 0),children:[h.jsxs("button",{type:"button",className:ge("extensions-row-button"),onClick:()=>{a(z?null:$.name),c(null)},children:[h.jsx("span",{className:ge("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:ge("resume-picker-item-title"),children:L3e($)}),h.jsxs("span",{className:ge("resume-picker-item-badge"),children:["v",$.version]}),h.jsx("span",{className:ge("tools-status-badge",$.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:OO($,e)}),h.jsx("span",{className:ge("tools-status-badge",E===DO?"tools-status-badge-busy":void 0),children:D3e(E,e)}),h.jsx("svg",{className:ge("tools-item-chevron",z?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),z&&h.jsx($3e,{extension:$,updateState:E,busy:M,confirmingUninstall:l===$.name,onUpdate:()=>A($.name,U=>n.updateExtension($.name,U)),onToggleScope:(U,K)=>A($.name,J=>U==="enable"?n.enableExtension($.name,{scope:K},J):n.disableExtension($.name,{scope:K},J)),onRequestUninstall:()=>c($.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{A($.name,U=>n.uninstallExtension($.name,U)),c(null),a(null)}})]},$.id||$.name)})]})]})}function $3e({extension:e,updateState:t,busy:n,confirmingUninstall:r,onUpdate:s,onToggleScope:i,onRequestUninstall:o,onCancelUninstall:a,onConfirmUninstall:l}){const{t:c}=et(),u=e.details,d=e.isActive?"disable":"enable";return h.jsxs("div",{className:ge("extensions-detail"),children:[h.jsxs("div",{className:ge("extensions-detail-actions"),children:[h.jsx("button",{type:"button",className:ge("dialog-inline-button"),disabled:n||t!==DO,onClick:s,children:c("extensions.manage.update")}),h.jsxs("button",{type:"button",className:ge("dialog-inline-button"),disabled:n,onClick:()=>i(d,"user"),children:[c(d==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.user")]}),h.jsxs("button",{type:"button",className:ge("dialog-inline-button"),disabled:n,onClick:()=>i(d,"workspace"),children:[c(d==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",c("settings.scope.workspace")]}),h.jsx("button",{type:"button",className:ge("dialog-danger-button"),disabled:n,onClick:o,children:c("extensions.manage.uninstallAction")})]}),r&&h.jsxs("div",{className:ge("extensions-confirm"),children:[h.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),h.jsxs("div",{className:ge("dialog-inline-actions"),children:[h.jsx("button",{type:"button",className:ge("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),h.jsx("button",{type:"button",className:ge("dialog-inline-button"),onClick:a,children:c("common.cancel")})]})]}),h.jsxs("div",{className:ge("extensions-detail-grid"),children:[h.jsx(lo,{label:c("extensions.manage.name"),value:e.name}),h.jsx(lo,{label:c("extensions.manage.version"),value:e.version}),h.jsx(lo,{label:c("extensions.manage.status"),value:OO(e,c)}),h.jsx(lo,{label:c("extensions.manage.path"),value:e.path}),h.jsx(lo,{label:c("extensions.manage.source"),value:e.source??"-"}),h.jsx(lo,{label:c("extensions.manage.commands"),value:td(u==null?void 0:u.commands)}),h.jsx(lo,{label:c("extensions.manage.skills"),value:td(u==null?void 0:u.skills)}),h.jsx(lo,{label:c("extensions.manage.agents"),value:td(u==null?void 0:u.agents)}),h.jsx(lo,{label:c("extensions.manage.mcpServers"),value:td(u==null?void 0:u.mcpServers)}),h.jsx(lo,{label:c("extensions.manage.contextFiles"),value:td(u==null?void 0:u.contextFiles)}),h.jsx(lo,{label:c("extensions.manage.settings"),value:td(u==null?void 0:u.settings)})]})]})}function lo({label:e,value:t}){return h.jsxs("div",{className:ge("extensions-detail-field"),children:[h.jsx("span",{className:ge("extensions-detail-label"),children:O3e(e)}),h.jsx("span",{className:ge("extensions-detail-value"),children:t})]})}const z3e="_panel_1nmt9_1",P3e="_embeddedPanel_1nmt9_16",q3e="_header_1nmt9_26",F3e="_title_1nmt9_32",U3e="_secondary_1nmt9_36",H3e="_hint_1nmt9_37",V3e="_empty_1nmt9_38",W3e="_busy_1nmt9_39",G3e="_scopeTabs_1nmt9_49",K3e="_scopeTab_1nmt9_49",Y3e="_scopeTabActive_1nmt9_71",X3e="_settingsPage_1nmt9_76",Q3e="_sidebar_1nmt9_83",J3e="_categoryButton_1nmt9_92",Z3e="_categoryButtonActive_1nmt9_110",e5e="_categoryCount_1nmt9_115",t5e="_content_1nmt9_121",n5e="_card_1nmt9_128",r5e="_cardBody_1nmt9_142",s5e="_cardTitle_1nmt9_146",i5e="_cardDescription_1nmt9_155",o5e="_scopeHint_1nmt9_156",a5e="_scopeBadge_1nmt9_164",l5e="_cardControl_1nmt9_174",c5e="_select_1nmt9_180",u5e="_actionButton_1nmt9_181",d5e="_editInput_1nmt9_182",h5e="_editor_1nmt9_219",f5e="_switchOn_1nmt9_241",m5e="_switchKnob_1nmt9_246",p5e="_footer_1nmt9_261",Bt={panel:z3e,embeddedPanel:P3e,header:q3e,title:F3e,secondary:U3e,hint:H3e,empty:V3e,busy:W3e,scopeTabs:G3e,scopeTab:K3e,scopeTabActive:Y3e,settingsPage:X3e,sidebar:Q3e,categoryButton:J3e,categoryButtonActive:Z3e,categoryCount:e5e,content:t5e,card:n5e,cardBody:r5e,cardTitle:s5e,cardDescription:i5e,scopeHint:o5e,scopeBadge:a5e,cardControl:l5e,select:c5e,actionButton:u5e,editInput:d5e,editor:h5e,switch:"_switch_1nmt9_231",switchOn:f5e,switchKnob:m5e,footer:p5e},g5e=new Set(["fastModel"]),y5e=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function fb(e,t,n){const r=e(t);return r===t?n:r}function b5e(e,t){return fb(t,`settings.category.${e}`,e)}function x5e(e,t){return fb(t,`settings.label.${e.key}`,e.label)}function w5e(e,t){if(e.description)return fb(t,`settings.description.${e.key}`,e.description)}function BO(e,t,n,r){return fb(r,`settings.option.${e.key}.${String(t)}`,n)}function J4(e,t,n){const r=zO(e,t);if(r==null)return"";if(e.key===Xc){const i=E5(r,ds.Dark);return n(`theme.${i}`)}if(e.key===Xf){const i=T5(r);return i?C5(i):String(r)}if(e.type==="boolean")return n(r===!0?"settings.value.on":"settings.value.off");if(e.type==="enum"&&e.options){const i=e.options.find(o=>o.value===r);return i?BO(e,i.value,i.label,n):String(r)}const s=String(r);return s.length>24?s.slice(0,21)+"...":s}function $O(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function v5e(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return $O(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function zO(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function _5e(e,t){const n=new Map;for(const r of e){let s=n.get(r.category);s||(s=[],n.set(r.category,s)),s.push(r)}return Array.from(n.entries()).map(([r,s])=>({category:b5e(r,t),items:s}))}function k5e({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:r,chatWidthMode:s,onChatWidthModeChange:i,embedded:o=!1}){const{t:a}=et(),{status:l,settings:c,loading:u,error:d,reload:f,setValue:m}=e,[p,y]=g.useState("workspace"),[v,b]=g.useState(""),[x,w]=g.useState(null),[k,T]=g.useState(null),[C,A]=g.useState(null),L=g.useRef(null),[$,E]=g.useState(!1),z=u&&!l,M=c.find(B=>B.key===Xc),U=E5(M==null?void 0:M.values.effective),K=c.find(B=>B.key===Xf),J=T5(K==null?void 0:K.values.effective),P=g.useMemo(()=>{const B=c.filter(ce=>!y5e.has(ce.key)),I=_5e(B,a).map(ce=>({id:ce.category,label:ce.category,items:ce.items.map(Ne=>({type:"setting",setting:Ne}))})),ne={type:"local",localKey:"chatWidth"},de=I.find(ce=>ce.items.some(Ne=>Ne.type==="setting"&&Ne.setting.key===Xc));if(de){const ce=de.items.findIndex(Ne=>Ne.type==="setting"&&Ne.setting.key===Xc);de.items.splice(ce+1,0,ne)}else I.push({id:a("settings.category.UI"),label:a("settings.category.UI"),items:[ne]});return I},[c,a]);g.useEffect(()=>{P.length!==0&&(P.some(B=>B.id===v)||b(P[0].id))},[v,P]),g.useEffect(()=>{var B;d?T(d.message):(B=l==null?void 0:l.warnings)!=null&&B.length?T(l.warnings.map(I=>a("settings.corrupted",{recovered:I.recovered?"true":"false"})).join("; ")):c.length>0&&!$&&T(null)},[d,c,l,a,$]),g.useEffect(()=>{C&&setTimeout(()=>{var B;return(B=L.current)==null?void 0:B.focus()},0)},[C]);const V=g.useCallback((B,I)=>{$||T(null),w(B),m("workspace",B,I).then(async ne=>{try{await f()}catch{}ne!=null&&ne.requiresRestart&&B!==Xf&&(E(!0),T(a("settings.requiresRestart")))}).catch(ne=>{T(ne instanceof Error?ne.message:String(ne))}).finally(()=>w(null))},[f,$,m,a]),X=g.useCallback(()=>{if(!C)return;const B=c.find(ne=>ne.key===C.key);if(!B){A(null);return}let I=C.draft;if(B.type==="number"){const ne=C.draft.trim();if(ne===""||!Number.isFinite(Number(ne))){T(a("settings.invalidNumber"));return}I=Number(ne)}A(null),V(B.key,I)},[C,c,V,a]),te=P.find(B=>B.id===v)??P[0],D=(B,I,ne,de=!1)=>h.jsx("select",{className:Bt.select,value:B,disabled:de,onChange:ce=>I(ce.target.value),children:ne.map(ce=>h.jsx("option",{value:ce.value,children:ce.label},ce.value))}),j=B=>{var Ne;const I=zO(B,p),ne=x===B.key,de=(C==null?void 0:C.key)===B.key;if(p!=="workspace")return h.jsx("button",{type:"button",className:Bt.actionButton,disabled:!0,title:a("settings.readOnly"),children:J4(B,p,a)||a("settings.readOnly")});if(B.key===Xc)return D(U??ds.Dark,Ce=>{const ze=Ce;r(ze),V(Xc,CH(ze))},jN.map(Ce=>({value:Ce,label:a(`theme.${Ce}`)})),ne);if(B.key===Xf)return D(J??"zh-CN",Ce=>t(Ce),cH.map(Ce=>({value:Ce,label:C5(Ce)})),ne);if(g5e.has(B.key))return h.jsx("button",{type:"button",className:Bt.actionButton,onClick:()=>n(B.key),children:J4(B,p,a)||a("settings.action.edit")});if(B.type==="boolean"){const Ce=I===!0;return h.jsx("button",{type:"button",className:`${Bt.switch} ${Ce?Bt.switchOn:""}`,disabled:ne,onClick:()=>V(B.key,!Ce),"aria-pressed":Ce,children:h.jsx("span",{className:Bt.switchKnob})})}if(B.type==="enum"&&((Ne=B.options)!=null&&Ne.length)){const Ce=B.options.findIndex(ze=>ze.value===I);return D(Ce>=0?String(Ce):"",ze=>{var rt;const ue=(rt=B.options)==null?void 0:rt[Number(ze)];ue&&V(B.key,ue.value)},B.options.map((ze,ue)=>({value:String(ue),label:BO(B,ze.value,ze.label,a)})),ne)}return de?h.jsxs("div",{className:Bt.editor,children:[h.jsx("input",{ref:L,className:Bt.editInput,type:B.type==="number"?"number":"text",value:C.draft,onChange:Ce=>A({key:C.key,draft:Ce.target.value}),onKeyDown:Ce=>{Ce.key==="Enter"&&(Ce.preventDefault(),X()),Ce.key==="Escape"&&(Ce.preventDefault(),A(null))}}),h.jsx("button",{type:"button",className:Bt.actionButton,onClick:X,children:a("settings.action.save")})]}):h.jsx("button",{type:"button",className:Bt.actionButton,disabled:ne,onClick:()=>A({key:B.key,draft:String(I??"")}),children:J4(B,p,a)||a("settings.action.edit")})};return h.jsxs("div",{className:`${Bt.panel} ${o?Bt.embeddedPanel:""}`,"data-keyboard-scope":!0,children:[!o&&h.jsxs("div",{className:Bt.header,children:[h.jsx("span",{className:Bt.title,children:a("settings.title")}),h.jsx("span",{className:Bt.secondary,children:a("settings.scope.workspace")})]}),(k||z)&&h.jsx("div",{className:Bt.hint,children:k||a("settings.loading")}),h.jsxs("div",{className:Bt.scopeTabs,role:"tablist",children:[h.jsx("button",{type:"button",role:"tab","aria-selected":p==="workspace",className:`${Bt.scopeTab} ${p==="workspace"?Bt.scopeTabActive:""}`,onClick:()=>y("workspace"),children:a("settings.scope.workspace")}),h.jsx("button",{type:"button",role:"tab","aria-selected":p==="user",className:`${Bt.scopeTab} ${p==="user"?Bt.scopeTabActive:""}`,onClick:()=>{A(null),y("user")},children:a("settings.scope.user")})]}),h.jsxs("div",{className:Bt.settingsPage,children:[h.jsx("nav",{className:Bt.sidebar,"aria-label":a("settings.title"),children:P.map(B=>h.jsxs("button",{type:"button",className:`${Bt.categoryButton} ${B.id===v?Bt.categoryButtonActive:""}`,onClick:()=>b(B.id),children:[h.jsx("span",{children:B.label}),h.jsx("span",{className:Bt.categoryCount,children:B.items.length})]},B.id))}),h.jsxs("section",{className:Bt.content,children:[!u&&!te&&h.jsx("div",{className:Bt.empty,children:a("settings.empty")}),te==null?void 0:te.items.map(B=>{if(B.type==="local")return h.jsxs("div",{className:Bt.card,children:[h.jsxs("div",{className:Bt.cardBody,children:[h.jsx("div",{className:Bt.cardTitle,children:a("settings.label.ui.chatWidth")}),h.jsx("div",{className:Bt.cardDescription,children:a("settings.description.ui.chatWidth")})]}),h.jsx("div",{className:Bt.cardControl,children:D(s,Ne=>i(Ne),[{value:"1000",label:a("settings.option.ui.chatWidth.1000")},{value:"wide",label:a("settings.option.ui.chatWidth.wide")}])})]},B.localKey);const I=B.setting,ne=w5e(I,a),de=v5e(I,p),ce=$O(I,p);return h.jsxs("div",{className:Bt.card,children:[h.jsxs("div",{className:Bt.cardBody,children:[h.jsxs("div",{className:Bt.cardTitle,children:[x5e(I,a),ce&&h.jsx("span",{className:Bt.scopeBadge,children:a(p==="workspace"?"settings.scope.workspace":"settings.scope.user")})]}),ne&&h.jsx("div",{className:Bt.cardDescription,children:ne}),de&&h.jsx("div",{className:Bt.scopeHint,children:a(de,{scope:a(p==="workspace"?"settings.scope.user":"settings.scope.workspace")})})]}),h.jsx("div",{className:Bt.cardControl,children:x===I.key?h.jsx("span",{className:Bt.busy,children:"..."}):j(I)})]},I.key)})]})]}),!o&&h.jsx("div",{className:Bt.footer,children:a(C?"settings.footer.edit":"settings.footer")})]})}const S5e="_approval_j86la_1",T5e="_floating_j86la_18",C5e="_header_j86la_31",A5e="_icon_j86la_41",E5e="_name_j86la_56",M5e="_desc_j86la_67",N5e="_content_j86la_87",I5e="_code_j86la_105",R5e="_codeBlock_j86la_113",j5e="_question_j86la_133",L5e="_options_j86la_139",D5e="_option_j86la_139",O5e="_optionPlain_j86la_167",B5e="_optionSecondary_j86la_177",$5e="_optionPrimary_j86la_184",z5e="_optionActive_j86la_195",P5e="_pointer_j86la_199",q5e="_num_j86la_203",F5e="_label_j86la_207",mr={approval:S5e,floating:T5e,header:C5e,icon:A5e,name:E5e,desc:M5e,content:N5e,code:I5e,codeBlock:R5e,question:j5e,options:L5e,option:D5e,optionPlain:O5e,optionSecondary:B5e,optionPrimary:$5e,optionActive:z5e,pointer:P5e,num:q5e,label:F5e};function U5e(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 H5e(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function V5e(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 W5e(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 G5e(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function SC(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 TC(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 Pp(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const r=TC(t.option)-TC(n.option);return r===0?t.index-n.index:r}).map(({option:t})=>t)}function K5e(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 Y5e(e){return e.kind==="allow_once"?mr.optionPrimary:e.kind==="allow_always"?mr.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?mr.optionPlain:mr.optionSecondary}function X5e({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=et(),s=g.useMemo(()=>Pp(e.options),[e.options]),[i,o]=g.useState(()=>SC(Pp(e.options))),a=g.useRef(e);a.current=e;const l=g.useRef(i),c=g.useRef(!1),u=g.useRef(!1);g.useEffect(()=>{const T=SC(Pp(a.current.options));c.current=!1,u.current=!1,l.current=T,o(T)},[e.id]);const d=U5e(e.title),f=e.toolName||d.toolName||e.kind||"Tool",m=tl(f,r),p=G5e(e),y=H5e(e),v=g.useCallback(T=>{c.current||(c.current=!0,t(a.current.id,T))},[t]),b=g.useCallback(T=>{if(T.defaultPrevented||M1(T.target))return;const C=a.current,A=Pp(C.options),L=A.length;if(T.key==="ArrowUp"||T.key==="k")T.preventDefault(),u.current=!0,o($=>{const E=($-1+L)%L;return l.current=E,E});else if(T.key==="ArrowDown"||T.key==="j")T.preventDefault(),u.current=!0,o($=>{const E=($+1)%L;return l.current=E,E});else if(T.key==="Enter"){if(T.preventDefault(),!u.current){u.current=!0;return}const $=A[l.current];$&&v($.id)}else if(T.key==="Escape"){T.preventDefault();const $=C.options.find(E=>E.kind==="reject_once"||E.kind==="reject_always");$&&v($.id)}else if(T.key>="1"&&T.key<="9"){const $=parseInt(T.key)-1;$<L&&(T.preventDefault(),u.current=!0,v(A[$].id))}},[v]);g.useEffect(()=>{const T=setTimeout(()=>{window.addEventListener("keydown",b)},250);return()=>{clearTimeout(T),window.removeEventListener("keydown",b)}},[b]);const x=V5e(e),w=$P(e.toolName),k=W5e(e);return h.jsxs("div",{className:n==="floating"?`${mr.approval} ${mr.floating}`:mr.approval,children:[h.jsxs("div",{className:mr.header,children:[h.jsx("span",{className:mr.icon,children:"?"}),h.jsx("span",{className:mr.name,children:m})]}),p&&h.jsx("div",{className:mr.desc,title:p,children:p}),x&&k?h.jsx("div",{className:mr.code,children:h.jsx("pre",{className:mr.codeBlock,title:k,children:k})}):y&&y!==e.title?h.jsx("pre",{className:mr.content,title:y,children:y}):null,h.jsx("div",{className:mr.question,children:w?r("approval.launchAgentQuestion"):x?r("approval.execQuestion",{tool:m}):r("approval.changeQuestion")}),h.jsx("div",{className:mr.options,children:s.map((T,C)=>{const A=C===i,L=K5e(T),$=L?r(L):T.label;return h.jsxs("div",{className:`${mr.option} ${Y5e(T)} ${A?mr.optionActive:""}`,onClick:()=>v(T.id),children:[h.jsx("span",{className:mr.pointer,children:A?"›":" "}),h.jsxs("span",{className:mr.num,children:[C+1,"."]}),h.jsx("span",{className:mr.label,children:$})]},T.id)})})]})}const Q5e="_question_1e2wi_1",J5e="_floating_1e2wi_18",Z5e="_titleLine_1e2wi_30",e_e="_icon_1e2wi_39",t_e="_toolName_1e2wi_43",n_e="_toolDesc_1e2wi_47",r_e="_tabs_1e2wi_54",s_e="_tab_1e2wi_54",i_e="_tabActive_1e2wi_78",o_e="_text_1e2wi_95",a_e="_description_1e2wi_104",l_e="_multiHint_1e2wi_112",c_e="_options_1e2wi_118",u_e="_option_1e2wi_118",d_e="_optionActive_1e2wi_140",h_e="_optionSelected_1e2wi_141",f_e="_optionLabel_1e2wi_146",m_e="_pointer_1e2wi_151",p_e="_optionNum_1e2wi_155",g_e="_editIcon_1e2wi_172",y_e="_optionContent_1e2wi_204",b_e="_optionPlaceholder_1e2wi_220",x_e="_optionDesc_1e2wi_225",w_e="_customInput_1e2wi_232",v_e="_actions_1e2wi_249",__e="_button_1e2wi_257",k_e="_submitButton_1e2wi_283",S_e="_ignoreButton_1e2wi_289",on={question:Q5e,floating:J5e,titleLine:Z5e,icon:e_e,toolName:t_e,toolDesc:n_e,tabs:r_e,tab:s_e,tabActive:i_e,text:o_e,description:a_e,multiHint:l_e,options:c_e,option:u_e,optionActive:d_e,optionSelected:h_e,optionLabel:f_e,pointer:m_e,optionNum:p_e,editIcon:g_e,optionContent:y_e,optionPlaceholder:b_e,optionDesc:x_e,customInput:w_e,actions:v_e,button:__e,submitButton:k_e,ignoreButton:S_e};function T_e({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=et(),s=g.useMemo(()=>{var P;return Array.isArray((P=e.rawInput)==null?void 0:P.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,u]=g.useState({}),[d,f]=g.useState({}),[m,p]=g.useState({}),[y,v]=g.useState(!1),b=g.useRef(!1);g.useEffect(()=>{const P=s[0];b.current=!1,o(0),l(P!=null&&P.options.length?0:null),u(P&&!P.multiSelect&&P.options[0]?{0:P.options[0].label}:{}),f({}),p(P!=null&&P.multiSelect&&P.options[0]?{0:[P.options[0].label]}:{}),v(!1)},[s,e.id]);const x=s[i],w=(x==null?void 0:x.multiSelect)??!1,k=g.useCallback(()=>{const P={};for(let V=0;V<s.length;V++){const X=s[V];if(X)if(X.multiSelect){const te=m[V]||[],D=d[V],j=D?[...te,D]:te;P[String(V)]=j.join(", ")}else P[String(V)]=c[V]||d[V]||""}return P},[s,m,d,c]),T=g.useCallback(()=>{if(b.current)return;const P=e.options.find(V=>V.kind==="allow_once");P&&(b.current=!0,t(e.id,P.id,k()))},[k,e,t]),C=g.useCallback(()=>{if(b.current)return;const P=e.options.find(V=>V.kind==="reject_once"||V.kind==="reject_always");P&&(b.current=!0,t(e.id,P.id,void 0))},[e,t]),A=g.useCallback(P=>{P!==void 0&&f(V=>({...V,[i]:P})),w||u(V=>{if(!(i in V))return V;const X={...V};return delete X[i],X}),v(!0)},[i,w]),L=g.useCallback(P=>{if(!x)return;if(P===x.options.length){A();return}const X=x.options[P].label;if(w){const te=m[i]||[],D=te.includes(X)?te.filter(j=>j!==X):[...te,X];p({...m,[i]:D})}else{const te={...c,[i]:X};u(te),f(D=>{if(!(i in D))return D;const j={...D};return delete j[i],j})}},[x,i,w,m,c,A]),$=g.useCallback(P=>{if(!x||!w)return;if(P===x.options.length){A();return}const V=x.options[P].label,X=m[i]||[],te=X.includes(V)?X.filter(D=>D!==V):[...X,V];p({...m,[i]:te})},[x,w,m,i,A]);if(s.length===0)return null;const E=P=>{const V=s[P];return V?V.multiSelect?(m[P]||[]).length>0||!!d[P]:!!c[P]||!!d[P]:!1},z=s.every((P,V)=>E(V)),M=Math.min(i,s.length-1),U=P=>{const V=s[P];if(o(P),v(!1),!(V!=null&&V.options.length)){l(null);return}if(l(0),V.multiSelect){p(X=>(X[P]||[]).length>0||d[P]?X:{...X,[P]:[V.options[0].label]});return}u(X=>X[P]||d[P]?X:{...X,[P]:V.options[0].label})},K=()=>{i<=0||U(i-1)},J=()=>{i>=s.length-1||U(i+1)};return h.jsxs("div",{className:`${on.question} ${n==="floating"?on.floating:""}`,children:[h.jsxs("div",{className:on.titleLine,children:[h.jsx("span",{className:on.icon,children:"?"}),h.jsx("span",{className:on.toolName,children:tl("ask_user_question",r)}),h.jsx("span",{className:on.toolDesc,children:r("askUser.progress",{current:M+1,total:s.length})})]}),h.jsx("div",{className:on.tabs,children:s.map((P,V)=>h.jsx("span",{className:`${on.tab} ${V===i?on.tabActive:""}`,"aria-hidden":"true"},V))}),x?h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:on.text,children:[x.question,w&&h.jsxs("span",{className:on.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),h.jsx("p",{className:on.description,children:r("askUser.selectAnswer")}),h.jsxs("div",{className:on.options,onMouseLeave:()=>l(null),children:[x.options.map((P,V)=>{const X=V===a,te=w?(m[i]||[]).includes(P.label):c[i]===P.label;return h.jsxs("div",{className:`${on.option} ${X?on.optionActive:""} ${te?on.optionSelected:""}`,onClick:()=>{l(V),w?$(V):L(V)},onMouseEnter:()=>l(V),children:[h.jsx("span",{className:on.pointer,children:X?"›":" "}),h.jsx("span",{className:on.optionNum,children:V+1}),h.jsxs("span",{className:on.optionContent,children:[h.jsx("span",{className:on.optionLabel,children:P.label}),P.description&&h.jsx("span",{className:on.optionDesc,children:P.description})]})]},P.label)}),(()=>{const P=a===x.options.length,V=!!d[i];return h.jsxs("div",{className:`${on.option} ${P?on.optionActive:""} ${V?on.optionSelected:""}`,onClick:()=>{l(x.options.length),A()},onMouseEnter:()=>l(x.options.length),children:[h.jsx("span",{className:on.pointer,children:P?"›":" "}),h.jsx("span",{className:on.editIcon,"aria-hidden":"true",children:h.jsx("svg",{viewBox:"0 0 16 16",children:h.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?h.jsx("input",{type:"text",className:on.customInput,placeholder:r("askUser.typePlaceholder"),value:d[i]||"",onChange:X=>f({...d,[i]:X.target.value}),onBlur:()=>v(!1),autoFocus:!0}):h.jsx("span",{className:`${on.optionLabel} ${d[i]?"":on.optionPlaceholder}`,children:d[i]||r("askUser.typePlaceholder")})]})})()]})]}):null,h.jsxs("div",{className:on.actions,children:[h.jsx("button",{type:"button",className:on.ignoreButton,onClick:C,children:r("askUser.ignore")}),s.length>1&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:on.button,disabled:i<=0,onClick:K,children:r("common.previous")}),h.jsx("button",{type:"button",className:on.button,disabled:i>=s.length-1,onClick:J,children:r("common.next")})]}),h.jsx("button",{type:"button",className:`${on.button} ${on.submitButton}`,disabled:!z,onClick:T,children:r("askUser.submit")})]})]})}const C_e="_dialog_1ymqd_1",A_e="_toolbar_1ymqd_12",E_e="_tabs_1ymqd_21",M_e="_tab_1ymqd_21",N_e="_tabActive_1ymqd_39",I_e="_search_1ymqd_48",R_e="_general_1ymqd_60",j_e="_shortcuts_1ymqd_67",L_e="_shortcut_1ymqd_67",D_e="_shortcutKey_1ymqd_87",O_e="_shortcutDesc_1ymqd_95",B_e="_commandList_1ymqd_101",$_e="_commandCard_1ymqd_108",z_e="_commandCardExpanded_1ymqd_115",P_e="_commandRow_1ymqd_119",q_e="_commandName_1ymqd_135",F_e="_commandTag_1ymqd_142",U_e="_chevron_1ymqd_152",H_e="_chevronExpanded_1ymqd_160",V_e="_commandDetail_1ymqd_164",W_e="_commandDescription_1ymqd_174",G_e="_commandSubcommands_1ymqd_175",K_e="_empty_1ymqd_182",sr={dialog:C_e,toolbar:A_e,tabs:E_e,tab:M_e,tabActive:N_e,search:I_e,general:R_e,shortcuts:j_e,shortcut:L_e,shortcutKey:D_e,shortcutDesc:O_e,commandList:B_e,commandCard:$_e,commandCardExpanded:z_e,commandRow:P_e,commandName:q_e,commandTag:F_e,chevron:U_e,chevronExpanded:H_e,commandDetail:V_e,commandDescription:W_e,commandSubcommands:G_e,empty:K_e},Y_e=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],X_e=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"]),Q_e=[["@","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 J_e(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function a3(e){return!X_e.has(e.name)}function Z_e(e,t){return a3(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function e6e(e,t,n){const r=n.trim().toLowerCase();return e.filter(s=>s.name&&s.description!==void 0).filter(s=>t==="commands"?!a3(s):t==="custom-commands"?a3(s):!0).filter(s=>r?s.name.toLowerCase().includes(r)||(s.description??"").toLowerCase().includes(r)||(s.argumentHint??"").toLowerCase().includes(r):!0).sort((s,i)=>s.name.localeCompare(i.name))}function t6e(){const{t:e}=et();return h.jsx("div",{className:sr.general,children:h.jsx("div",{className:sr.shortcuts,children:Q_e.map(([t,n])=>h.jsxs("div",{className:sr.shortcut,children:[h.jsx("span",{className:sr.shortcutDesc,children:e(n)}),h.jsx("span",{className:sr.shortcutKey,children:t})]},t))})})}function n6e({commands:e,tab:t,query:n}){const{t:r}=et(),[s,i]=g.useState(null),o=g.useMemo(()=>e6e(e,t,n),[e,n,t]);return o.length===0?h.jsx("div",{className:sr.empty,children:r(t==="custom-commands"?"help.emptyCustom":"help.empty")}):h.jsx("div",{className:sr.commandList,children:o.map(a=>{var c;const l=s===a.name;return h.jsxs("article",{className:`${sr.commandCard} ${l?sr.commandCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:sr.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[h.jsx("span",{className:sr.commandName,children:J_e(a)}),h.jsx("span",{className:sr.commandTag,children:Z_e(a,r)}),h.jsx("svg",{className:`${sr.chevron} ${l?sr.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l&&h.jsxs("div",{className:sr.commandDetail,children:[a.description&&h.jsx("div",{className:sr.commandDescription,children:a.description}),!!((c=a.subcommands)!=null&&c.length)&&h.jsxs("div",{className:sr.commandSubcommands,children:[r("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function r6e({commands:e}){const{t}=et(),[n,r]=g.useState("general"),[s,i]=g.useState(""),o=n!=="general";return h.jsxs("div",{className:sr.dialog,children:[h.jsxs("div",{className:sr.toolbar,children:[h.jsx("div",{className:sr.tabs,children:Y_e.map(a=>h.jsx("button",{type:"button",className:`${sr.tab} ${a.id===n?sr.tabActive:""}`,onClick:()=>r(a.id),children:t(a.labelKey)},a.id))}),o&&h.jsx("input",{className:sr.search,value:s,onChange:a=>i(a.target.value),placeholder:t("help.search")})]}),n==="general"?h.jsx(t6e,{}):h.jsx(n6e,{commands:e,tab:n,query:s})]})}function s6e({currentTheme:e,onSelect:t,onClose:n}){const{t:r}=et(),s=jN.map(l=>({id:l,label:r(`theme.${l}`),description:r(`theme.${l}.desc`)})),[i,o]=g.useState(()=>{const l=s.findIndex(c=>c.id===e);return l>=0?l:0}),a=g.useRef(null);return g.useEffect(()=>{var c;const l=(c=a.current)==null?void 0:c.children[i];l==null||l.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:ge("resume-picker-list","resume-picker-list-compact"),ref:a,role:"listbox",children:s.map((l,c)=>{const u=l.id===e;return h.jsxs("button",{type:"button",role:"option","aria-selected":u,className:ge("resume-picker-item","resume-picker-session-item",c===i||u?"selected":void 0),onClick:()=>{t(l.id),n()},onMouseEnter:()=>o(c),children:[h.jsxs("div",{className:ge("resume-picker-item-row"),children:[h.jsx("span",{className:ge("resume-picker-item-title"),children:l.label}),u&&h.jsx("span",{className:ge("resume-picker-item-check"),children:" ✓"})]}),h.jsx("div",{className:ge("resume-picker-item-meta"),children:l.description})]},l.id)})})}function i6e({onDeleted:e,onError:t,onClose:n}){const{t:r}=et(),s=bc(),{sessions:i,loading:o,error:a,deleteSession:l,deleteSessions:c}=Sy({autoLoad:!0}),u=s.sessionId,[d,f]=g.useState(!1),[m,p]=g.useState(0),[y,v]=g.useState(new Set),[b,x]=g.useState(""),[w,k]=g.useState(null),T=g.useRef(null),C=g.useRef(null);g.useEffect(()=>{a&&k(a.message)},[a]);const A=g.useMemo(()=>b?i.filter(M=>{const U=b.toLowerCase();return(M.displayName||"").toLowerCase().includes(U)||M.sessionId.toLowerCase().includes(U)}):i,[i,b]);g.useEffect(()=>{if(b&&y.size>0){const M=new Set(A.map(U=>U.sessionId));v(U=>{const K=new Set([...U].filter(J=>M.has(J)));return K.size===U.size?U:K})}},[b,A,y.size]),g.useEffect(()=>{m>=A.length&&A.length>0&&p(A.length-1)},[A.length,m]),g.useEffect(()=>{var U;const M=(U=T.current)==null?void 0:U.children[m];M==null||M.scrollIntoView({block:"nearest"})},[m]),g.useEffect(()=>{var M;(M=C.current)==null||M.focus()},[]);const L=g.useCallback(M=>{M!==u&&v(U=>{const K=new Set(U);return K.has(M)?K.delete(M):K.add(M),K})},[u]),$=g.useCallback(()=>{if(d)return;if(y.size>0){const U=new Set(A.map(J=>J.sessionId)),K=Array.from(y).filter(J=>U.has(J));if(K.length===0)return;f(!0),c(K).then(J=>{const P=J.removed.length+J.notFound.length,V=J.errors.length;if(V>0&&P>0){t(new Error(r("delete.partialFail",{removed:P,failed:V,detail:J.errors[0].error}))),n();return}if(V>0){k(r("delete.allFailed",{count:V,reason:J.errors[0].error})),f(!1),v(new Set);return}if(P===0){k(r("delete.nonRemoved")),f(!1),v(new Set);return}e([...J.removed,...J.notFound]),n()}).catch(J=>{t(J),f(!1)});return}const M=A[m];if(M){if(M.sessionId===u){k(r("delete.cannotCurrent"));return}f(!0),l(M.sessionId).then(U=>{if(!U){k(r("delete.notFound")),f(!1);return}e([M.sessionId]),n()}).catch(U=>{t(U),f(!1)})}},[u,l,c,d,A,n,e,t,m,y,r]),E=y.size>0,z=!d&&!o&&E;return h.jsxs("div",{className:ge("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ge("resume-picker-search"),children:[h.jsxs("span",{className:ge("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:C,className:ge("resume-picker-search-input"),value:b,onChange:M=>{x(M.target.value),p(0),v(new Set)},placeholder:""}),h.jsx("span",{className:ge("resume-picker-search-hint"),children:w||(d?r("delete.deleting"):o?r("common.loading"):E?r("delete.selected",{count:y.size}):b?r("delete.matches",{count:A.length}):"")})]}),h.jsx("div",{className:ge("resume-picker-sep")}),h.jsxs("div",{className:ge("resume-picker-list"),ref:T,children:[o&&h.jsx("div",{className:ge("resume-picker-empty"),children:r("common.loading")}),!o&&a&&h.jsx("div",{className:ge("resume-picker-empty"),children:a.message}),!o&&!a&&A.length===0&&h.jsx("div",{className:ge("resume-picker-empty"),children:b?r("delete.noMatch",{query:b}):r("delete.none")}),!o&&A.map((M,U)=>{const K=M.sessionId===u,J=y.has(M.sessionId),P=J?"[x] ":"[ ] ";return h.jsxs("div",{className:ge("resume-picker-item","resume-picker-session-item",J?"selected":void 0,K?"resume-picker-item-current":void 0,K?"disabled":void 0),onClick:()=>{p(U),K||L(M.sessionId)},children:[h.jsxs("div",{className:ge("resume-picker-item-row"),children:[h.jsx("span",{className:ge("resume-picker-item-checkbox"),children:P}),h.jsx("span",{className:ge("resume-picker-item-title"),children:M.displayName||M.sessionId.slice(0,8)}),K&&h.jsx("span",{className:ge("resume-picker-item-badge"),children:r("resume.current")})]}),h.jsxs("div",{className:ge("resume-picker-item-meta"),children:[h.jsx("span",{children:(M.updatedAt||M.createdAt)&&hb(M.updatedAt||M.createdAt||"",r)}),h.jsx("span",{className:ge("resume-picker-item-detail"),children:r("common.clients",{count:M.clientCount??0})}),M.hasActivePrompt&&h.jsx("span",{className:ge("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},M.sessionId)})]}),h.jsx("div",{className:ge("resume-picker-sep")}),h.jsxs("div",{className:ge("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:ge("dialog-inline-button"),onClick:n,disabled:d,children:r("common.cancel")}),h.jsx("button",{type:"button",className:ge("dialog-danger-button"),onClick:$,disabled:!z,children:r(d?"delete.deleting":"delete.action")})]})]})}function o6e({onReleased:e,onError:t,onClose:n}){const{t:r}=et(),s=bc(),{sessions:i,loading:o,error:a,releaseSession:l}=Sy({autoLoad:!0}),c=s.sessionId,[u,d]=g.useState(!1),[f,m]=g.useState(0),[p,y]=g.useState(!1),[v,b]=g.useState(""),[x,w]=g.useState(null),k=g.useRef(null),T=g.useRef(null);g.useEffect(()=>{a&&w(a.message)},[a]);const C=v?i.filter(z=>{const M=v.toLowerCase();return(z.displayName||"").toLowerCase().includes(M)||z.sessionId.toLowerCase().includes(M)}):i;g.useEffect(()=>{f>=C.length&&C.length>0&&m(C.length-1)},[C.length,f]),g.useEffect(()=>{var M;const z=(M=k.current)==null?void 0:M.children[f];z==null||z.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var z;(z=T.current)==null||z.focus()},[]);const A=g.useCallback(z=>{const M=z??C[f];if(!M||u)return;if(!((M.clientCount??0)>0||M.hasActivePrompt===!0)){w(r("release.inactive"));return}if(M.sessionId===c){w(r("release.cannotCurrent"));return}l&&(d(!0),l(M.sessionId).then(()=>{e(M.sessionId),n()}).catch(K=>{t(K),d(!1)}))},[c,u,C,n,t,e,l,f,r]),L=C[f],$=L&&((L.clientCount??0)>0||L.hasActivePrompt===!0),E=!u&&!o&&p&&!!L&&L.sessionId!==c&&!!$;return h.jsxs("div",{className:ge("resume-picker","resume-picker-in-shell"),children:[h.jsxs("div",{className:ge("resume-picker-search"),children:[h.jsxs("span",{className:ge("resume-picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:T,className:ge("resume-picker-search-input"),value:v,onChange:z=>{b(z.target.value),m(0),y(!1)},placeholder:""}),h.jsx("span",{className:ge("resume-picker-search-hint"),children:x||(u?r("release.releasing"):o?r("common.loading"):v?r("release.matches",{count:C.length}):"")})]}),h.jsx("div",{className:ge("resume-picker-sep")}),h.jsxs("div",{className:ge("resume-picker-list"),ref:k,children:[o&&h.jsx("div",{className:ge("resume-picker-empty"),children:r("common.loading")}),!o&&C.length===0&&h.jsx("div",{className:ge("resume-picker-empty"),children:v?r("release.noMatch",{query:v}):r("release.none")}),!o&&C.map((z,M)=>{const U=z.sessionId===c,K=(z.clientCount??0)>0||z.hasActivePrompt===!0,J=U||!K;return h.jsxs("div",{className:ge("resume-picker-item","resume-picker-session-item",p&&M===f?"selected":void 0,U?"resume-picker-item-current":void 0,J?"disabled":void 0),onClick:()=>{m(M),y(!0)},children:[h.jsxs("div",{className:ge("resume-picker-item-row"),children:[h.jsx("span",{className:ge("resume-picker-item-title"),children:z.displayName||z.sessionId.slice(0,8)}),U&&h.jsx("span",{className:ge("resume-picker-item-badge"),children:r("resume.current")}),!U&&!K&&h.jsx("span",{className:ge("resume-picker-item-badge"),children:r("release.inactiveBadge")})]}),h.jsxs("div",{className:ge("resume-picker-item-meta"),children:[h.jsx("span",{children:(z.updatedAt||z.createdAt)&&hb(z.updatedAt||z.createdAt||"",r)}),h.jsx("span",{className:ge("resume-picker-item-detail"),children:r("common.clients",{count:z.clientCount??0})}),z.hasActivePrompt&&h.jsx("span",{className:ge("resume-picker-item-detail"),children:r("resume.activePrompt")})]})]},z.sessionId)})]}),h.jsx("div",{className:ge("resume-picker-sep")}),h.jsxs("div",{className:ge("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:ge("dialog-inline-button"),onClick:n,disabled:u,children:r("common.cancel")}),h.jsx("button",{type:"button",className:ge("dialog-danger-button"),onClick:()=>A(),disabled:!E,children:r(u?"release.releasing":"release.action")})]})]})}const a6e="_root_kygee_1",l6e="_list_kygee_8",c6e="_item_kygee_15",u6e="_itemSelected_kygee_33",d6e="_prompt_kygee_42",h6e="_turn_kygee_51",f6e="_time_kygee_56",m6e="_footer_kygee_62",p6e="_dangerButton_kygee_69",va={root:a6e,list:l6e,item:c6e,itemSelected:u6e,prompt:d6e,turn:h6e,time:f6e,footer:m6e,dangerButton:p6e};function g6e(e,t){let n=0;for(const r of e)if(r.kind==="user"){if(n===t)return r.text.trim();n+=1}return""}function y6e(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function b6e({blocks:e,loadSnapshots:t,rewind:n,onError:r,onClose:s}){const{t:i}=et(),[o,a]=g.useState([]),[l,c]=g.useState(!0),[u,d]=g.useState(null),[f,m]=g.useState(null);g.useEffect(()=>{let v=!0;return c(!0),t().then(b=>{v&&a(b.snapshots)}).catch(b=>{v&&r(b)}).finally(()=>{v&&c(!1)}),()=>{v=!1}},[t,r]);const p=g.useMemo(()=>o.map(v=>({snapshot:v,promptText:g6e(e,v.turnIndex)})).sort((v,b)=>v.snapshot.turnIndex-b.snapshot.turnIndex),[e,o]);g.useEffect(()=>{p.length>0&&!f&&m(p[0].snapshot.promptId)},[p,f]);const y=()=>{const v=f;v&&(u||(d(v),n(v).then(()=>{s()}).catch(b=>{r(b),d(null)})))};return l?h.jsx("div",{className:ge("resume-picker-empty"),children:i("rewind.loading")}):p.length===0?h.jsx("div",{className:ge("resume-picker-empty"),children:i("rewind.empty")}):h.jsxs("div",{className:va.root,children:[h.jsx("div",{className:va.list,role:"list",children:p.map(({snapshot:v,promptText:b})=>{const x=f===v.promptId,w=u!==null,k=b||i("rewind.promptFallback",{id:v.promptId.slice(-8)});return h.jsxs("button",{type:"button",className:`${va.item} ${x?va.itemSelected:""}`,disabled:w,onClick:()=>m(v.promptId),children:[h.jsxs("div",{className:va.prompt,title:k,children:[h.jsxs("span",{className:va.turn,children:["#",v.turnIndex+1]})," ",k]}),h.jsx("div",{className:va.time,children:y6e(v.timestamp)})]},v.promptId)})}),h.jsxs("div",{className:va.footer,children:[h.jsx("button",{type:"button",className:ge("dialog-inline-button"),onClick:s,disabled:u!==null,children:i("common.cancel")}),h.jsx("button",{type:"button",className:`${ge("dialog-danger-button")} ${va.dangerButton}`,onClick:y,disabled:!f||u!==null,children:i(u?"rewind.rewinding":"rewind.confirm")})]})]})}const x6e="_sidebar_sfcld_1",w6e="_resizing_sfcld_21",v6e="_collapsed_sfcld_25",_6e="_newChatButton_sfcld_31",k6e="_footerButton_sfcld_32",S6e="_collapseButton_sfcld_33",T6e="_projectRow_sfcld_34",C6e="_sessionRow_sfcld_35",A6e="_retry_sfcld_36",E6e="_projectIconButton_sfcld_38",M6e="_sessionActionButton_sfcld_39",N6e="_secondaryButton_sfcld_40",I6e="_dangerButton_sfcld_41",R6e="_navIcon_sfcld_96",j6e="_settingsIcon_sfcld_119",L6e="_projectFolderIcon_sfcld_125",D6e="_body_sfcld_129",O6e="_sectionTitle_sfcld_138",B6e="_projectName_sfcld_176",$6e="_sessionText_sfcld_177",z6e="_sessionList_sfcld_192",P6e="_currentSession_sfcld_214",q6e="_busySession_sfcld_219",F6e="_floatingTooltip_sfcld_224",U6e="_tooltipContent_sfcld_254",H6e="_tooltipTitle_sfcld_260",V6e="_tooltipTags_sfcld_267",W6e="_tooltipTag_sfcld_267",G6e="_tooltipTagRunning_sfcld_287",K6e="_tooltipTagNew_sfcld_292",Y6e="_tooltipMeta_sfcld_297",X6e="_sessionStatusSlot_sfcld_312",Q6e="_sessionStatusDot_sfcld_322",J6e="_sessionMetaSlot_sfcld_332",Z6e="_sessionTime_sfcld_343",e8e="_sessionLoading_sfcld_350",t8e="_runningSession_sfcld_360",n8e="_sessionActions_sfcld_369",r8e="_searchInput_sfcld_461",s8e="_renameInput_sfcld_475",i8e="_renameForm_sfcld_486",o8e="_notice_sfcld_502",a8e="_confirmContent_sfcld_517",l8e="_confirmDescription_sfcld_523",c8e="_confirmActions_sfcld_530",u8e="_footer_sfcld_32",d8e="_resizeHandle_sfcld_603",dt={sidebar:x6e,resizing:w6e,collapsed:v6e,newChatButton:_6e,footerButton:k6e,collapseButton:S6e,projectRow:T6e,sessionRow:C6e,retry:A6e,projectIconButton:E6e,sessionActionButton:M6e,secondaryButton:N6e,dangerButton:I6e,navIcon:R6e,settingsIcon:j6e,projectFolderIcon:L6e,body:D6e,sectionTitle:O6e,projectName:B6e,sessionText:$6e,sessionList:z6e,currentSession:P6e,busySession:q6e,floatingTooltip:F6e,tooltipContent:U6e,tooltipTitle:H6e,tooltipTags:V6e,tooltipTag:W6e,tooltipTagRunning:G6e,tooltipTagNew:K6e,tooltipMeta:Y6e,sessionStatusSlot:X6e,sessionStatusDot:Q6e,sessionMetaSlot:J6e,sessionTime:Z6e,sessionLoading:e8e,runningSession:t8e,sessionActions:n8e,searchInput:r8e,renameInput:s8e,renameForm:i8e,notice:o8e,confirmContent:a8e,confirmDescription:l8e,confirmActions:c8e,footer:u8e,resizeHandle:d8e},PO="qwen-code-web-shell-sidebar-width",qp=260,h8e=220,f8e=420,m8e=1e3,p8e=2e3,g8e=3e4;function Fp(...e){return e.filter(Boolean).join(" ")}function CC(e){return e instanceof DOMException&&e.name==="AbortError"}function y8e(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function yf(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function b8e(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function Q1(e){return Math.min(f8e,Math.max(h8e,e))}function x8e(){if(typeof window>"u")return qp;try{const e=window.localStorage.getItem(PO),t=e?Number(e):qp;return Number.isFinite(t)?Q1(t):qp}catch{return qp}}function w8e(e){try{window.localStorage.setItem(PO,String(Q1(e)))}catch{}}function v8e(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M12 5v14M5 12h14"})})}function _8e({expanded:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsxs(h.Fragment,{children:[h.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"}),h.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"})]}):h.jsxs(h.Fragment,{children:[h.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"}),h.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 k8e(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{cx:"11",cy:"11",r:"7"}),h.jsx("path",{d:"m16.5 16.5 4 4"})]})}function S8e(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("circle",{cx:"12",cy:"12",r:"3"}),h.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 T8e(){return h.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[h.jsx("path",{d:"M4 20h5l10-10a3 3 0 0 0-5-5L4 15v5Z"}),h.jsx("path",{d:"M13.5 5.5 18.5 10.5"})]})}function C8e(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3"})})}function A8e({collapsed:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsx("path",{d:"M9 6l6 6-6 6"}):h.jsx("path",{d:"M15 6l-6 6 6 6"})})}function E8e({expanded:e}){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?h.jsx("path",{d:"m6 9 6 6 6-6"}):h.jsx("path",{d:"m9 6 6 6-6 6"})})}function M8e({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onNewSession:r,onLoadSession:s,onError:i}){const{t:o}=et(),a=bc(),l=ky(),{sessions:c,loading:u,error:d,reload:f,deleteSession:m}=Sy({autoLoad:!0,pageSize:m8e}),[p,y]=g.useState(null),[v,b]=g.useState(""),[x,w]=g.useState(null),k=g.useRef(null),T=g.useRef(!1),[C,A]=g.useState(null),[L,$]=g.useState(x8e),[E,z]=g.useState(!0),[M,U]=g.useState(!1),[K,J]=g.useState(""),[P,V]=g.useState(!1),[X,te]=g.useState(null),[D,j]=g.useState(()=>new Set),B=g.useRef(null),I=g.useRef(null),ne=g.useRef(!1),de=g.useRef(null),ce=a.sessionId,Ne=y8e(a.workspaceCwd)||o("sidebar.projectFallback"),Ce={"--web-shell-sidebar-width":`${L}px`},ze=g.useCallback(()=>{B.current!==null&&(window.clearTimeout(B.current),B.current=null)},[]),ue=g.useCallback(()=>{ze(),B.current=window.setTimeout(()=>{te(null),B.current=null},240)},[ze]);g.useEffect(()=>()=>{var F;ze(),(F=de.current)==null||F.call(de,!1)},[ze]),g.useEffect(()=>{z(!e),e&&(U(!1),J(""),te(null))},[e]);const rt=g.useMemo(()=>c.some(F=>F.hasActivePrompt),[c]);g.useEffect(()=>{if(!E&&!rt)return;const F=rt&&!d?p8e:g8e,W=window.setInterval(()=>{document.hidden||ne.current||(ne.current=!0,f().finally(()=>{ne.current=!1}))},F);return()=>window.clearInterval(W)},[d,rt,E,f]),g.useEffect(()=>{const F=new Map(c.map(re=>[re.sessionId,!!re.hasActivePrompt])),W=I.current;I.current=F,W!==null&&j(re=>{const me=new Set(re);let Pe=!1;for(const[Re,nt]of W){const wt=F.get(Re);nt&&wt===!1&&Re!==ce&&!me.has(Re)&&(me.add(Re),Pe=!0)}for(const Re of me)(Re===ce||!F.has(Re)||F.get(Re))&&(me.delete(Re),Pe=!0);return Pe?me:re})},[ce,c]);const xe=g.useCallback((F,W)=>{ze();const re=F.currentTarget.getBoundingClientRect();te({content:W,top:re.top+re.height/2,left:re.right+8})},[ze]),Ee=g.useCallback(F=>{const W=yf(F),re=F.sessionId!==ce&&D.has(F.sessionId);return h.jsxs("div",{className:dt.tooltipContent,children:[h.jsx("div",{className:dt.tooltipTitle,children:W}),h.jsxs("div",{className:dt.tooltipTags,children:[F.hasActivePrompt&&h.jsx("span",{className:Fp(dt.tooltipTag,dt.tooltipTagRunning),children:o("sidebar.running")}),re&&h.jsx("span",{className:Fp(dt.tooltipTag,dt.tooltipTagNew),children:o("sidebar.completedUnread")}),h.jsx("span",{className:dt.tooltipTag,children:o("sidebar.clients",{count:F.clientCount??0})})]}),h.jsx("div",{className:dt.tooltipMeta,children:F.sessionId})]})},[D,ce,o]),Zt=g.useCallback(()=>{k.current!==null||T.current||(T.current=!0,(async()=>{try{await r()&&f()}catch(F){CC(F)||i(F,o("sidebar.newSessionFailed"))}finally{T.current=!1}})())},[i,r,f,o]),ht=g.useCallback(F=>{F===ce||F===k.current||(j(W=>{if(!W.has(F))return W;const re=new Set(W);return re.delete(F),re}),k.current=F,w(F),(async()=>{try{await s(F)}catch(W){CC(W)||i(W,o("sidebar.switchFailed"))}finally{k.current===F&&(k.current=null),w(W=>W===F?null:W)}})())},[ce,i,s,o]),bt=g.useCallback(F=>{y(F.sessionId),b(yf(F))},[]),Vt=g.useCallback(()=>{y(null),b("")},[]),pn=g.useCallback(()=>{const F=v.trim();if(!F||p!==ce){Vt();return}const W=p;k.current=W,w(W),l.renameSession(F).then(()=>{Vt(),f()}).catch(re=>{i(re,o("sidebar.renameFailed")),Vt()}).finally(()=>{k.current===W&&(k.current=null),w(re=>re===W?null:re)})},[l,Vt,ce,v,p,i,f,o]),vt=g.useCallback(F=>{F.sessionId!==ce&&A(F)},[ce]),Wt=g.useCallback(()=>{if(!C)return;const F=C.sessionId;if(F===ce){A(null);return}A(null),k.current=F,w(F),m(F).then(W=>{W||f()}).catch(W=>i(W,o("sidebar.deleteFailed"))).finally(()=>{k.current===F&&(k.current=null),w(W=>W===F?null:W)})},[ce,C,m,i,f,o]),Gt=g.useCallback(F=>{F.sessionId===ce&&bt(F)},[ce,bt]),Tt=g.useMemo(()=>{const F=K.trim().toLowerCase(),W=F?c.filter(me=>yf(me).toLowerCase().includes(F)||me.sessionId.toLowerCase().includes(F)):c.slice(),re=new Map(W.map(me=>[me.sessionId,b8e(me)]));return W.sort((me,Pe)=>(re.get(Pe.sessionId)??0)-(re.get(me.sessionId)??0))},[K,c]),Oe=g.useCallback(F=>{var he;if(e)return;F.preventDefault(),(he=de.current)==null||he.call(de,!0),V(!0);const W=F.clientX,re=L,me=document.body.style.cursor,Pe=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{F.currentTarget.setPointerCapture(F.pointerId)}catch{}const Re=Z=>{const ie=Q1(re+Z.clientX-W);$(ie)},nt=Z=>{document.body.style.cursor=me,document.body.style.userSelect=Pe,window.removeEventListener("pointermove",Re),window.removeEventListener("pointerup",wt),window.removeEventListener("pointercancel",ut),de.current=null,Z&&V(!1)},wt=Z=>{const ie=Q1(re+Z.clientX-W);$(ie),w8e(ie),nt(!0)},ut=()=>{nt(!0)};de.current=nt,window.addEventListener("pointermove",Re),window.addEventListener("pointerup",wt,{once:!0}),window.addEventListener("pointercancel",ut,{once:!0})},[e,L]),ot=C?yf(C):"",ft=g.useMemo(()=>E?u&&c.length===0?h.jsx("div",{className:dt.notice,children:o("sidebar.loadingSessions")}):d&&c.length===0?h.jsx("button",{className:dt.retry,type:"button",onClick:f,children:o("sidebar.loadFailed")}):Tt.length===0?h.jsx("div",{className:dt.notice,children:o("sidebar.searchEmpty")}):Tt.map(F=>{const W=F.sessionId===ce,re=p===F.sessionId,me=yf(F),Pe=F.updatedAt||F.createdAt,Re=Pe?hb(Pe,o):"",nt=x===F.sessionId,wt=!W&&D.has(F.sessionId);return h.jsx("div",{className:Fp(dt.sessionRow,W&&dt.currentSession,F.hasActivePrompt&&dt.runningSession,nt&&dt.busySession),role:"button",tabIndex:0,"aria-current":W?"page":void 0,onMouseEnter:ut=>xe(ut,Ee(F)),onMouseLeave:ue,onFocus:ut=>xe(ut,Ee(F)),onBlur:ue,onClick:()=>ht(F.sessionId),onDoubleClick:()=>{W&&!e&&bt(F)},onKeyDown:ut=>{ut.key==="Enter"&&ht(F.sessionId)},children:!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:dt.sessionStatusSlot,"aria-hidden":"true",children:wt&&h.jsx("span",{className:dt.sessionStatusDot})}),re?h.jsx("form",{className:dt.renameForm,onClick:ut=>ut.stopPropagation(),onSubmit:ut=>{ut.preventDefault(),pn()},children:h.jsx("input",{autoFocus:!0,className:dt.renameInput,value:v,onChange:ut=>b(ut.target.value),onBlur:Vt,onKeyDown:ut=>{ut.key==="Escape"&&(ut.preventDefault(),Vt())}})}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:dt.sessionText,children:me}),h.jsxs("div",{className:dt.sessionMetaSlot,children:[F.hasActivePrompt?h.jsx("span",{className:dt.sessionLoading,"aria-label":o("sidebar.running")}):h.jsx("span",{className:dt.sessionTime,children:Re}),h.jsxs("div",{className:dt.sessionActions,onClick:ut=>ut.stopPropagation(),onKeyDown:ut=>ut.stopPropagation(),onMouseEnter:ut=>{ut.stopPropagation(),te(null)},children:[h.jsx("button",{className:dt.sessionActionButton,type:"button",disabled:!W,title:o(W?"sidebar.rename":"sidebar.renameCurrentOnly"),"aria-label":o("sidebar.rename"),onClick:()=>Gt(F),children:h.jsx(T8e,{})}),h.jsx("button",{className:dt.sessionActionButton,type:"button",disabled:W,title:o(W?"sidebar.currentDeleteDisabled":"sidebar.delete"),"aria-label":o("sidebar.delete"),onClick:()=>vt(F),children:h.jsx(C8e,{})})]})]})]})]})},F.sessionId)}):null,[x,Vt,e,D,ce,v,p,d,Tt,vt,ht,Gt,ue,u,E,f,pn,Ee,c.length,xe,bt,o]);return h.jsxs("aside",{className:Fp(dt.sidebar,e&&dt.collapsed,P&&dt.resizing),"aria-label":o("sidebar.label"),style:Ce,children:[X&&h.jsx("div",{className:dt.floatingTooltip,role:"tooltip",style:{top:X.top,left:X.left},onMouseEnter:ze,onMouseLeave:ue,children:X.content}),C&&h.jsx(Qr,{title:o("delete.title"),size:"sm",onClose:()=>A(null),children:h.jsxs("div",{className:dt.confirmContent,children:[h.jsx("p",{className:dt.confirmDescription,children:o("sidebar.deleteConfirmDescription",{name:ot})}),h.jsxs("div",{className:dt.confirmActions,children:[h.jsx("button",{className:dt.secondaryButton,type:"button",onClick:()=>A(null),children:o("common.cancel")}),h.jsx("button",{className:dt.dangerButton,type:"button",onClick:Wt,children:o("sidebar.delete")})]})]})}),h.jsxs("button",{className:dt.newChatButton,type:"button",title:o("sidebar.newChat"),"aria-label":o("sidebar.newChat"),onClick:Zt,children:[h.jsx("span",{className:dt.navIcon,children:h.jsx(v8e,{})}),!e&&h.jsx("span",{children:o("sidebar.newChat")})]}),h.jsxs("div",{className:dt.body,children:[!e&&h.jsx("div",{className:dt.sectionTitle,children:o("sidebar.project")}),h.jsxs("div",{className:dt.projectRow,role:"button",tabIndex:0,"aria-expanded":E,onClick:()=>{e||z(F=>!F)},onKeyDown:F=>{e||(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),z(W=>!W))},onMouseEnter:F=>xe(F,h.jsxs("div",{className:dt.tooltipContent,children:[h.jsx("div",{className:dt.tooltipTitle,children:Ne}),h.jsx("div",{className:dt.tooltipMeta,children:a.workspaceCwd||Ne})]})),onMouseLeave:ue,onFocus:F=>xe(F,h.jsxs("div",{className:dt.tooltipContent,children:[h.jsx("div",{className:dt.tooltipTitle,children:Ne}),h.jsx("div",{className:dt.tooltipMeta,children:a.workspaceCwd||Ne})]})),onBlur:ue,children:[h.jsx("span",{className:`${dt.navIcon} ${dt.projectFolderIcon}`,children:h.jsx(_8e,{expanded:E})}),!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:dt.projectName,children:Ne}),h.jsx("button",{className:dt.projectIconButton,type:"button","aria-label":o("sidebar.search"),onKeyDown:F=>F.stopPropagation(),onClick:F=>{F.stopPropagation(),U(W=>(W&&J(""),!W)),z(!0)},children:h.jsx(k8e,{})}),h.jsx("button",{className:dt.projectIconButton,type:"button","aria-label":o(E?"sidebar.collapseProject":"sidebar.expandProject"),onKeyDown:F=>F.stopPropagation(),onClick:F=>{F.stopPropagation(),z(W=>!W)},children:h.jsx(E8e,{expanded:E})})]})]}),M&&!e&&E&&h.jsx("input",{className:dt.searchInput,value:K,placeholder:o("sidebar.searchPlaceholder"),"aria-label":o("sidebar.search"),autoFocus:!0,onChange:F=>J(F.target.value),onKeyDown:F=>{F.key==="Escape"&&(J(""),U(!1))}}),h.jsx("div",{className:dt.sessionList,children:ft})]}),h.jsxs("div",{className:dt.footer,children:[h.jsxs("button",{className:dt.footerButton,type:"button",title:o("sidebar.settings"),"aria-label":o("sidebar.settings"),onClick:n,children:[h.jsx("span",{className:`${dt.navIcon} ${dt.settingsIcon}`,children:h.jsx(S8e,{})}),!e&&h.jsx("span",{children:o("sidebar.settings")})]}),h.jsx("button",{className:dt.collapseButton,type:"button",title:o(e?"sidebar.expand":"sidebar.collapse"),"aria-label":o(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:h.jsx(A8e,{collapsed:e})})]}),h.jsx("div",{className:dt.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:Oe})]})}function N8e(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] [<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:"extensions",description:e("local.extensions"),argumentHint:"manage|install <source>",subcommands:["manage","install"]}].map(n=>({...n,source:"builtin-command"}))}function I8e(...e){const t=new Map;for(const n of e)for(const r of n){const s=t.get(r.name);s?t.set(r.name,{...s,...r,description:r.description||s.description,argumentHint:r.argumentHint??s.argumentHint}):t.set(r.name,r)}return[...t.values()]}function R8e(e){const[t,n]=g.useState(e);return g.useEffect(()=>{const r=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(r)},[e]),t}const j8e=3e3,L8e=2;function AC(e){return e.some(t=>t.status==="running"||t.status==="paused")}function D8e(e,t,n=0){const r=ky(),[s,i]=g.useState([]),[o,a]=g.useState(!1),[l,c]=g.useState(!1),u=g.useRef(0),d=g.useRef(!1);g.useEffect(()=>{if(!t){i([]),a(!1),u.current=0;return}},[t]),g.useEffect(()=>{!t||!e||(u.current=0,a(!0))},[t,e]),g.useEffect(()=>{!t||n===0||(u.current=0,a(!0))},[t,n]),g.useEffect(()=>{if(l||!t||!o)return;let m=!1;const p=()=>{d.current||(d.current=!0,r.getTasks().then(v=>{if(!m){if(i(v.tasks),v.tasks.length===0){u.current+=1,u.current>=L8e&&a(!1);return}u.current=0,AC(v.tasks)||a(!1)}}).catch(v=>{m||console.warn("[web-shell] failed to refresh tasks:",v)}).finally(()=>{d.current=!1}))};p();const y=setInterval(p,j8e);return()=>{m=!0,clearInterval(y)}},[r,t,o,l]);const f=g.useRef(s);return f.current=s,g.useEffect(()=>{const m=p=>{const y=p.detail,v=(y==null?void 0:y.active)===!0;c(v),!v&&AC(f.current)&&a(!0)};return window.addEventListener(D0,m),()=>window.removeEventListener(D0,m)},[]),s}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function O8e(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function B8e(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 $8e(e){if(!e||typeof e!="object")return null;const t=e.messages;return Array.isArray(t)&&t.filter(r=>typeof r=="string").join(`
`).trim()||null}function z8e(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function P8e(e){return z8e(e)||!e.text&&!e.usage?null:e}function EC(e){return e.text.length===0}function q8e(e){const t=e.flatMap((n,r)=>{const s=Ys(n),i=Vs(s,"content");return i?[{id:Vs(s,"id")??`plan-${r}`,content:i,status:G8e(Vs(s,"status")),...(()=>{const a=K8e(Vs(s,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function MC(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 F8e(e,t={}){var c,u,d;const n=[],r=((c=t.labels)==null?void 0:c.promptCancelled)??"Request cancelled.",s=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,v={id:m.id,role:"user",content:y.text,timestamp:p};y.images&&y.images.length>0&&(v.images=y.images.map(b=>({data:b.data,mimeType:b.mimeType||"image/*"}))),n.push(v);break}case"assistant":{const y=P8e(m);if(!y)break;const v=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(v){NC(v,y.text);break}const b=ake(y.text);if(b){let w=null,k=!1,T=0,C=0;for(const A of b)A.kind==="insight"?A.data.type==="insight_progress"?w=A.data:A.data.type==="insight_ready"?(k=!0,n.push({id:`${m.id}-ir-${T++}`,role:"insight_ready",path:A.data.path,timestamp:p})):A.data.type==="insight_error"&&(k=!0,n.push({id:`${m.id}-ie-${C++}`,role:"insight_error",error:A.data.error,timestamp:p})):(n.push({id:`${m.id}-t-${n.length}`,role:"assistant",content:A.text,timestamp:p}),o=n.length-1,a=null);w&&!k&&n.push({id:`${m.id}-ip`,role:"insight_progress",stage:w.stage,progress:w.progress,detail:w.detail,timestamp:p}),l=!0;break}const x=o!==null?n[o]:void 0;if(x&&x.role==="assistant"&&!l&&!EC(y)){const w=MC(x.usage,y.usage);n[o]={...x,content:x.content+y.text,isStreaming:y.streaming,...w?{usage:w}:{}},l=!1,a=null}else if(!EC(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&&x&&x.role==="assistant"){const w=MC(x.usage,y.usage);n[o]={...x,...w?{usage:w}:{}}}break}case"thought":{const y=m,v=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(v){NC(v,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 v=Y8e(m),b=i.get(v.callId);b!=null&&b.title&&(v.title=b.title),!v.args&&(b!=null&&b.args)&&(v.args=b.args);const x=v.parentToolCallId?s.get(v.parentToolCallId):void 0,w=s.get(v.callId);if(w){IC(w,v);break}if(x){U8e(x,v),s.set(v.callId,v);break}Z4(n,m.id,v,p),s.set(v.callId,v),o=null,a=null,l=!0;break}case"shell":{const y=m,v=n[n.length-1];if(v&&v.role==="tool_group"){const b=H8e(v.tools),x=v.tools[b];if(x){const w=typeof x.rawOutput=="string"?x.rawOutput:"",k={...x,rawOutput:w+y.text};n[n.length-1]={...v,tools:[...v.tools.slice(0,b),k,...v.tools.slice(b+1)]},s.get(x.callId)===x&&s.set(x.callId,k)}}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;Q8e(y,i);const v=X8e(y);if(!v)break;const b=qO(v);if(!y.resolved)break;const x=s.get(v.callId);if(x){const w=x.status;v.toolName=x.toolName,y.resolved&&(ex(y.resolved)?v.status=b?v.status:"in_progress":(v.status="failed",v.endTime=y.updatedAt)),IC(x,v),y.resolved&&b&&ex(y.resolved)&&(x.status=w);break}if(y.resolved){ex(y.resolved)?(b||(v.status="in_progress"),Z4(n,m.id,v,p),s.set(v.callId,v),l=!0):(v.status="failed",v.endTime=y.updatedAt,Z4(n,m.id,v,p),s.set(v.callId,v),l=!0);break}break}case"status":case"debug":{const y=m,v=y.source==="session_branched"?B8e(y.data):null,b=y.source==="mid_turn_message_injected"?$8e(y.data):null,x=v&&((u=t.labels)!=null&&u.branchSuccess)?t.labels.branchSuccess(v):b&&((d=t.labels)!=null&&d.midTurnInserted)?t.labels.midTurnInserted(b):y.text;if(O8e(x))break;const w=W8e(x);if(w){n.push({id:m.id,role:"plan",todos:w,timestamp:p}),l=!0;break}n.push({id:m.id,role:"system",content:x,variant:"info",timestamp:p,...y.source?{source:y.source}:{},...y.data!==void 0?{data:y.data}:{}}),l=!0;break}case"error":{const y=m;n.push({id:m.id,role:"system",content:y.text,variant:"error",retryable:y.source==="turn_error",timestamp:p,...y.source?{source:y.source}:{},...y.data!==void 0?{data:y.data}:{}}),l=!0;break}case"prompt_cancelled":n.push({id:m.id,role:"system",content:r,variant:"info",source:"prompt_cancelled",timestamp:p}),l=!0;break}}return n}function U8e(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function NC(e,t){e.subContent=(e.subContent||"")+t}function Z4(e,t,n,r){const s=o=>qO(o)||jh(o.toolName),i=e[e.length-1];if(i&&i.role==="tool_group"&&i.id.startsWith("tg-")&&!s(n)&&!i.tools.some(s)){i.tools.push(n);return}e.push({id:`tg-${t}`,role:"tool_group",tools:[n],timestamp:r})}function H8e(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 IC(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 qO(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||V8e(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function V8e(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function W8e(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),r=Ys(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:q8e(r.entries)}catch{return}}function Ys(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Vs(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function G8e(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function K8e(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function Y8e(e){const t=Z8e(e),n=J8e(e,t),r=eke(e.content),s={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":s[e.status])||e.status||"in_progress",kind:UO(e.toolName,e.toolKind),rawOutput:t,args:e.rawInput,parentToolCallId:e.parentToolCallId,startTime:e.createdAt,endTime:i&&!n?e.updatedAt:void 0,...r?{content:r}:{}}}function X8e(e){const t=Ys(e.toolCall);if(!t)return;const n=FO(t);if(Array.isArray(n==null?void 0:n.questions))return;const r=Ys(t._meta),s=Vs(t,"kind"),i=Vs(r,"toolName")??Vs(t,"toolName")??Vs(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(s==="fetch"?"web_fetch":s),o=Vs(t,"toolCallId")??Vs(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:Vs(t,"title")??e.title,status:"pending",kind:UO(i,s),args:n,startTime:e.createdAt}}function Q8e(e,t){const n=Ys(e.toolCall),r=Vs(n,"toolCallId")??Vs(n,"id");if(!r)return;const s=Vs(n,"title")??e.title,i=n?FO(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(r,{...s?{title:s}:{},...i?{args:i}:{}})}function ex(e){const[t="",n=""]=e.toLowerCase().split(":",2);return RC(t)?!0:t!=="selected"?!1:RC(n.trim())}function RC(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 FO(e){return Ys(e.rawInput)??Ys(e.input)??Ys(e.args)}function J8e(e,t){var s;const n=(s=e.toolName)==null?void 0:s.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=Ys(t);return(r==null?void 0:r.status)==="background"}function Z8e(e){return tke(e)&&e.status==="failed"?nke(e)??e.details??e.rawOutput:!rke(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 eke(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const r=Ys(n);if(!r)return[];const s=r.type;if(s==="content"){const i=Ys(r.content);return!i||typeof i.type!="string"?[]:[{type:"content",content:{...i,type:i.type}}]}if(s==="diff"){const i=r.newText;if(typeof i!="string")return[];const o=r.path,a=r.oldText;return[{type:"diff",...typeof o=="string"?{path:o}:{},...typeof a=="string"?{oldText:a}:{},newText:i}]}if(s==="terminal"){const i=r.terminalId;return[{type:"terminal",...typeof i=="string"?{terminalId:i}:{}}]}return[]});return t.length>0?t:void 0}function tke(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function nke(e){if(!Array.isArray(e.content))return;const t=e.content.map(n=>{var r;return(r=n==null?void 0:n.content)==null?void 0:r.text}).filter(n=>!!n);if(!(!t||t.length===0))return t.join(`
`)}function rke(e){return e==="cancelled"||e==="canceled"}const ske=['"insight_progress":','"insight_ready":','"insight_error":'];function ike(e){try{const t=JSON.parse(e),n=Ys(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 r=Ys(t.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const s=Ys(t.insight_error);if(s&&typeof s.error=="string")return{type:"insight_error",error:s.error}}catch{}return null}function oke(e,t){if(e[t]!=="{")return null;let n=0,r=!1,s=!1;for(let i=t;i<e.length;i++){const o=e[i];if(s){s=!1;continue}if(o==="\\"&&r){s=!0;continue}if(o==='"'){r=!r;continue}if(!r){if(o==="{")n++;else if(o==="}"&&(n--,n===0))return e.slice(t,i+1)}}return null}function ake(e){const t=[];let n=0,r=0,s=!1;for(;r<e.length;){const o=e.indexOf("{",r);if(o===-1)break;const a=e.slice(o+1).trimStart();if(!ske.some(f=>a.startsWith(f))){r=o+1;continue}const c=oke(e,o);if(!c){r=o+1;continue}const u=ike(c);if(!u){r=o+1;continue}s=!0;const d=e.slice(n,o).trim();d&&t.push({kind:"text",text:d}),t.push({kind:"insight",data:u}),n=o+c.length,r=n}if(!s)return null;const i=e.slice(n).trim();return i&&t.push({kind:"text",text:i}),t.length>0?t:null}function UO(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 lke(e){const t=_y();return g.useMemo(()=>F8e(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n})}}),[t,e])}function cke(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),r=t,s=e;return n.length!==Object.keys(r).length?!1:n.every(i=>{const o=s[i],a=r[i];return o===a?!0:Array.isArray(o)&&Array.isArray(a)?o.length===a.length&&o.every((l,c)=>l===a[c]):!1})}function uke(e){const t=g.useRef(e);return cke(t.current,e)||(t.current=e),t.current}function dke(e,t){const n=g.useRef(e);return e.length!==n.current.length?(n.current=e,e):(e.some((s,i)=>t(s)!==t(n.current[i]))&&(n.current=e),n.current)}const hke="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",fke="/assets/insert-DmRbh9Rv.svg",mke="/assets/queue-DWpnpFgW.svg",Rr={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"},jC=1024,pke=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${jC}}\S\$)([^$\n]{1,${jC}})\$(?![\w$])`,"g");function gke(e){var c,u,d;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=new Map;let i=null,o=null,a=null,l=[];for(const f of n){const m=f.match(r);if(!i){if(m){if(i=m[1]??null,o=((u=(c=m[2])==null?void 0:c.trim().split(/\s+/)[0])==null?void 0:u.toLowerCase())||null,o){const p=(s.get(o)??0)+1;s.set(o,p),a=p}else a=null;l=[]}continue}if(m&&((d=m[1])!=null&&d.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 yke(e){var l;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const c of n){const u=c.match(r);if(i){u&&((l=u[1])!=null&&l.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(!o){if(u){i=u[1]??null;continue}s.test(c)&&(o=!0,a=[]);continue}if(s.test(c)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(c)}return t}function bke(e){var a;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1;for(const l of n){const c=l.match(r);if(i){c&&((a=c[1])!=null&&a.startsWith(i[0]??""))&&c[1].length>=i.length&&(i=null);continue}if(o){s.test(l)&&(o=!1);continue}if(c){i=c[1]??null;continue}if(s.test(l)){o=!0;continue}for(const u of l.matchAll(pke)){const d=u[1];d&&t.push({content:d,index:t.length+1})}}return t}function LC(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function xke(e,t){var u;const n=t.trim().split(/\s+/).filter(Boolean),r=(u=n[0])==null?void 0:u.toLowerCase();if(!r)return;const s=gke(e);if(s.length===0)return null;let i=null,o=null;const a=r==="code"?n.slice(1):n.map(d=>d);r!=="code"&&(i=r);for(const d of a)/^\d+$/.test(d)?o=Number(d):d.toLowerCase()!=="code"&&(i=d.toLowerCase());const l=i?s.filter(d=>d.lang===i):s;if(l.length===0)return null;if(o!==null){const d=i?l.find(f=>f.langIndex===o):s.find(f=>f.index===o);return d?{content:d.content,label:LC(d,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:LC(c,i)}:null}function DC(e,t){const n=bke(e);if(n.length===0)return null;let r=null;for(const i of t)/^\d+$/.test(i)&&(r=Number(i));const s=r!==null?n.find(i=>i.index===r):n[n.length-1];return s?{content:s.content,label:`Inline LaTeX expression ${s.index}`}:null}function wke(e,t){var c;const n=t.trim().split(/\s+/).filter(Boolean),r=(c=n[0])==null?void 0:c.toLowerCase();if(r!=="latex"&&r!=="math"&&r!=="inline-latex")return;if(r==="inline-latex")return DC(e,n.slice(1));const s=n.slice(1),i=s.findIndex(u=>u.toLowerCase()==="inline");if(i!==-1)return DC(e,s.filter((u,d)=>d!==i));const o=yke(e);if(o.length===0)return null;let a=null;for(const u of s)/^\d+$/.test(u)&&(a=Number(u));const l=a!==null?o.find(u=>u.index===a):o[o.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function vke(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 _ke(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 kke(e,t,n=_ke){const r=vke(e);if(r===null)return{status:"info",message:Rr.NO_OUTPUT};if(!r)return{status:"info",message:Rr.NO_TEXT};try{const s=wke(r,t);if(s===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Rr.INLINE_LATEX_MISSING:Rr.LATEX_MISSING};if(s!==void 0)return await n(s.content),{status:"info",message:`${s.label}${Rr.COPIED_SUFFIX}`};const i=xke(r,t);if(i===null)return{status:"info",message:Rr.CODE_MISSING};const o=(i==null?void 0:i.content)??r;return await n(o),{status:"info",message:i?`${i.label}${Rr.COPIED_SUFFIX}`:Rr.OUTPUT_COPIED}}catch(s){const i=s instanceof Error?s.message:String(s);return{status:"error",message:`${Rr.CLIPBOARD_PREFIX}${i}`}}}function Ske(e){return typeof e=="object"&&e!==null}function HO(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function u6(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function Tke(e){if(!u6(e)||!Ske(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function Cke(e){const t=new Set;for(const n of e){if(!u6(n))continue;const r=Tke(n);r&&t.add(r)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=HO(n.content);return!r||!t.has(r)})}function Ake(e){return e.role!=="system"||e.variant!=="info"?!1:HO(e.content)!==null||u6(e)}function Eke(e){const t=e.findIndex(n=>!Ake(n));return t<0?[]:e.slice(t)}function OC(e){return Eke(Cke(e))}function BC(e,t){const n={nodeVersion:"",npmVersion:"",authSource:"",platform:"",arch:"",sandbox:"",proxy:"",memoryUsage:""};if(e)for(const r of e.cells){const s=r.detail;r.kind==="node_version"&&(s!=null&&s.version)?n.nodeVersion=s.version:r.kind==="npm"&&(s!=null&&s.version)?n.npmVersion=String(s.version).replace(/^npm\s*/i,""):r.kind==="auth"&&(s!=null&&s.source)&&(n.authSource=s.source)}if(t)for(const r of t.cells)r.kind==="platform"?(n.platform=r.name,r.value&&(n.arch=r.value)):r.kind==="sandbox"&&r.name==="SANDBOX"?n.sandbox=r.value||"":r.kind==="proxy"&&r.present&&r.value?n.proxy=`${r.name}: ${r.value}`:r.kind==="memory"&&r.value&&(n.memoryUsage=r.value);return n}function Mke(e,t,n,r){return e?(r.enqueue(t,n),!0):(r.append(t),!1)}function VO(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}const Nke="_layout_ghraz_1",Ike="_muted_ghraz_8",Rke="_notice_ghraz_13",jke="_list_ghraz_20",Lke="_group_ghraz_26",Dke="_groupTitle_ghraz_33",Oke="_server_ghraz_39",Bke="_serverCard_ghraz_44",$ke="_serverCardExpanded_ghraz_50",zke="_row_ghraz_55",Pke="_expandedRow_ghraz_72",qke="_serverRow_ghraz_76",Fke="_rowMain_ghraz_81",Uke="_rowIcon_ghraz_96",Hke="_chevronCell_ghraz_125",Vke="_toolRow_ghraz_135",Wke="_chevron_ghraz_125",Gke="_chevronExpanded_ghraz_150",Kke="_disabled_ghraz_154",Yke="_name_ghraz_158",Xke="_serverName_ghraz_166",Qke="_status_ghraz_170",Jke="_badge_ghraz_171",Zke="_toolCount_ghraz_185",eSe="_resourceCount_ghraz_190",tSe="_promptCount_ghraz_191",nSe="_success_ghraz_196",rSe="_warning_ghraz_200",sSe="_error_ghraz_204",iSe="_serverDetail_ghraz_208",oSe="_serverDetailHeader_ghraz_218",aSe="_serverActions_ghraz_223",lSe="_field_ghraz_230",cSe="_label_ghraz_238",uSe="_value_ghraz_244",dSe="_button_ghraz_249",hSe="_message_ghraz_269",fSe="_schema_ghraz_270",mSe="_tools_ghraz_281",pSe="_tool_ghraz_135",gSe="_resources_ghraz_292",ySe="_sectionTitle_ghraz_301",bSe="_resourceUri_ghraz_306",xSe="_resourceLabel_ghraz_314",wSe="_toolDetail_ghraz_324",vSe="_section_ghraz_301",_Se="_description_ghraz_347",kSe="_parameter_ghraz_353",SSe="_empty_ghraz_359",TSe="_emptyTools_ghraz_360",Ue={layout:Nke,muted:Ike,notice:Rke,list:jke,group:Lke,groupTitle:Dke,server:Oke,serverCard:Bke,serverCardExpanded:$ke,row:zke,expandedRow:Pke,serverRow:qke,rowMain:Fke,rowIcon:Uke,chevronCell:Hke,toolRow:Vke,chevron:Wke,chevronExpanded:Gke,disabled:Kke,name:Yke,serverName:Xke,status:Qke,badge:Jke,toolCount:Zke,resourceCount:eSe,promptCount:tSe,success:nSe,warning:rSe,error:sSe,serverDetail:iSe,serverDetailHeader:oSe,serverActions:aSe,field:lSe,label:cSe,value:uSe,button:dSe,message:hSe,schema:fSe,tools:mSe,tool:pSe,resources:gSe,sectionTitle:ySe,resourceUri:bSe,resourceLabel:xSe,toolDetail:wSe,section:vSe,description:_Se,parameter:kSe,empty:SSe,emptyTools:TSe};function $C(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 s=n.details;if(typeof s=="string"&&s)return s}const r=t.error;if(typeof r=="string"&&r)return r}if(e instanceof Error&&e.message)return e.message}return String(e)}function CSe(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:Ue.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:Ue.success};case"connecting":return{text:t("mcp.status.starting"),className:Ue.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:Ue.error}}}function ASe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function tx(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function ESe(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 MSe(e,t){const n=e.annotations??{},r=[];return n.destructiveHint&&r.push(t("mcp.annotation.destructive")),n.readOnlyHint&&r.push(t("mcp.annotation.readOnly")),n.openWorldHint&&r.push(t("mcp.annotation.openWorld")),n.idempotentHint&&r.push(t("mcp.annotation.idempotent")),r.join(", ")}function zC(e,t){return`${e}:${t}`}function PC(e,t){return`${e}\0${t}`}const Ml=c6;function nx({expanded:e}){return h.jsx("svg",{className:`${Ue.chevron} ${e?Ue.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:h.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function NSe(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 ISe({tool:e,t}){const n=ESe(e);if(!n)return h.jsx("div",{className:Ue.muted,children:t("mcp.noSchema")});const r=n.properties,s=Array.isArray(n.required)?new Set(n.required.filter(o=>typeof o=="string")):new Set;if(!r||typeof r!="object")return h.jsx("pre",{className:Ue.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:Ue.section,children:[h.jsx("div",{className:Ue.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},c=typeof l.type=="string"?l.type:"any",u=typeof l.description=="string"?l.description:"";return h.jsx("div",{className:Ue.parameter,children:`- ${o}${s.has(o)?t("mcp.required"):""}: ${c}${u?` - ${u}`:""}`},o)})]})}function jf({label:e,value:t}){return h.jsxs("div",{className:Ue.field,children:[h.jsx("span",{className:Ue.label,children:e}),h.jsx("span",{className:Ue.value,children:t})]})}function RSe({tool:e,t}){const n=MSe(e,t);return h.jsxs("div",{className:Ue.toolDetail,children:[e.isValid?null:h.jsxs("div",{className:Ue.section,children:[h.jsx("div",{className:`${Ue.sectionTitle} ${Ue.error}`,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{className:Ue.muted,children:[Ml(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:Ue.muted,children:t("mcp.invalidToolHelp")})]}),e.description?h.jsxs("div",{className:Ue.section,children:[h.jsx("div",{className:Ue.sectionTitle,children:Ml(t("mcp.description"))}),h.jsx("div",{className:Ue.description,children:e.description.trim()})]}):h.jsx("div",{className:Ue.muted,children:t("mcp.noDescription")}),n?h.jsx(jf,{label:Ml(t("mcp.annotations")),value:n}):null,h.jsx(ISe,{tool:e,t})]})}function jSe({resource:e,t}){const n=e.title||e.name||"",r=n!==""&&n!==e.uri;return h.jsxs("div",{className:Ue.toolDetail,children:[h.jsx(jf,{label:Ml(t("mcp.resource.uriLabel")),value:e.uri}),r?h.jsx(jf,{label:Ml(t("mcp.resource.nameLabel")),value:n}):null,e.mimeType?h.jsx(jf,{label:Ml(t("mcp.resource.mimeTypeLabel")),value:e.mimeType}):null,typeof e.size=="number"?h.jsx(jf,{label:Ml(t("mcp.resource.sizeLabel")),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?h.jsxs("div",{className:Ue.section,children:[h.jsx("div",{className:Ue.sectionTitle,children:Ml(t("mcp.description"))}),h.jsx("div",{className:Ue.description,children:e.description.trim()})]}):null]})}function LSe({message:e}){const{t}=et(),n=SN({autoLoad:!1}),[r,s]=g.useState(e.status),[i,o]=g.useState(e.toolsByServer),[a,l]=g.useState(e.resourcesByServer??{}),c=g.useMemo(()=>r.servers??[],[r.servers]),[u,d]=g.useState(new Set),[f,m]=g.useState(new Set),[p,y]=g.useState(new Set),[v,b]=g.useState(null),[x,w]=g.useState(null);g.useEffect(()=>{d(z=>{const M=new Set(c.map(U=>U.name));return new Set([...z].filter(U=>M.has(U)))})},[c]);const k=c.filter(z=>!z.disabled&&z.mcpStatus==="connecting").length,T=g.useMemo(()=>{var M,U;const z=[];for(const K of c){const J=ASe(K,t),P={server:K,tools:((M=i[K.name])==null?void 0:M.tools)??[],resources:((U=a[K.name])==null?void 0:U.resources)??[]},V=z.find(X=>X.label===J);V?V.items.push(P):z.push({label:J,items:[P]})}return z},[c,t,i,a]),C=g.useCallback(async z=>{var J;const M=await n.reload();if(!M)return;s(M);const U=(J=M.servers)==null?void 0:J.find(P=>P.name===z);if(!U)return;const K=await n.loadTools(U.name);if(o(P=>({...P,[U.name]:K})),U.resourceCount)try{const P=await n.loadResources(U.name);l(V=>({...V,[U.name]:P}))}catch{}else l(P=>{if(!(U.name in P))return P;const V={...P};return delete V[U.name],V})},[n]),A=g.useCallback(async(z,M)=>{if(!x){d(new Set([z.name])),w(z.name),b({serverName:z.name,text:M.id==="authenticate"?tx(z.name,t):t("mcp.action.running",{action:M.label})});try{let U=null;if(M.id==="reconnect")await n.restartServer(z.name);else{const K=await n.manageServer(z.name,M.id),J=[...K.messages??[],...K.authUrl?[K.authUrl]:[]].join(`
`);J&&(U=M.id==="authenticate"?tx(z.name,t,J):J)}await C(z.name),b({serverName:z.name,text:U??t("mcp.action.done",{action:M.label})})}catch(U){b({serverName:z.name,text:M.id==="authenticate"?tx(z.name,t,$C(U)):t("mcp.action.failed",{error:$C(U)})})}finally{w(null)}}},[x,n,C,t]),L=g.useCallback(z=>{d(M=>M.has(z)?new Set:new Set([z])),m(new Set),y(new Set)},[]),$=g.useCallback((z,M)=>{const U=zC(z,M);m(K=>K.has(U)?new Set:new Set([U]))},[]),E=g.useCallback((z,M)=>{const U=PC(z,M);y(K=>K.has(U)?new Set:new Set([U]))},[]);return h.jsxs("div",{className:Ue.layout,"data-keyboard-scope":!0,children:[k>0?h.jsxs("div",{className:Ue.notice,children:[t("mcp.starting",{count:k}),h.jsx("div",{className:Ue.muted,children:t("mcp.startingNote")})]}):null,c.length===0?h.jsx("div",{className:Ue.empty,children:t("mcp.empty")}):h.jsx("div",{className:Ue.list,children:T.map(z=>h.jsxs("div",{className:Ue.group,children:[z.label!==t("mcp.extensionMcp")?h.jsx("div",{className:Ue.groupTitle,children:z.label}):null,z.items.map(({server:M,tools:U,resources:K})=>{var j;const J=CSe(M,t),P=u.has(M.name),V=NSe(M,t),X=((j=i[M.name])==null?void 0:j.tools.length)??0,te=M.resourceCount??0,D=M.promptCount??0;return h.jsx("div",{className:Ue.server,children:h.jsxs("div",{className:`${Ue.serverCard} ${P?Ue.serverCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${Ue.row} ${Ue.serverRow} ${P?Ue.expandedRow:""}`,onClick:()=>L(M.name),"aria-label":t(P?"mcp.collapse":"mcp.expand"),children:[h.jsxs("span",{className:Ue.rowMain,children:[h.jsx("span",{className:Ue.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Ue.name} ${Ue.serverName}`,children:M.name})]}),h.jsx("span",{className:`${Ue.status} ${J.className}`,children:J.text}),h.jsx("span",{className:`${Ue.badge} ${Ue.toolCount}`,children:t(X===1?"mcp.toolCount":"mcp.toolsCount",{count:X})}),te>0?h.jsx("span",{className:`${Ue.badge} ${Ue.resourceCount}`,children:t("mcp.resourceCount",{count:te})}):null,D>0?h.jsx("span",{className:`${Ue.badge} ${Ue.promptCount}`,children:t("mcp.promptCount",{count:D})}):null,h.jsx("span",{className:Ue.chevronCell,"aria-hidden":"true",children:h.jsx(nx,{expanded:P})})]}),P?h.jsxs("div",{className:Ue.serverDetail,children:[V.length>0?h.jsx("div",{className:Ue.serverDetailHeader,children:h.jsx("div",{className:Ue.serverActions,children:V.map(B=>h.jsx("button",{type:"button",className:Ue.button,onClick:()=>void A(M,B),disabled:x!==null,children:B.label},B.id))})}):null,(v==null?void 0:v.serverName)===M.name?h.jsx("pre",{className:Ue.message,children:v.text}):null,U.length===0?h.jsx("div",{className:Ue.emptyTools,children:t("mcp.emptyTools")}):h.jsx("div",{className:Ue.tools,children:U.map(B=>{const I=zC(M.name,B.name),ne=f.has(I);return h.jsxs("div",{className:Ue.tool,children:[h.jsxs("button",{type:"button",className:`${Ue.row} ${Ue.toolRow} ${ne?Ue.expandedRow:""} ${B.isValid?"":Ue.disabled}`,onClick:()=>$(M.name,B.name),children:[h.jsx("span",{className:Ue.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:Ue.name,children:B.name}),h.jsx(nx,{expanded:ne})]}),ne?h.jsx(RSe,{tool:B,t}):null]},B.name)})}),te>0?h.jsxs("div",{className:Ue.resources,children:[h.jsx("div",{className:Ue.sectionTitle,children:t("mcp.resources")}),K.length===0?h.jsx("div",{className:Ue.emptyTools,children:t("mcp.resourcesUnavailable")}):null,K.map(B=>{const I=PC(M.name,B.uri),ne=p.has(I),de=B.title||B.name||"";return h.jsxs("div",{className:Ue.tool,children:[h.jsxs("button",{type:"button",className:`${Ue.row} ${Ue.toolRow} ${ne?Ue.expandedRow:""}`,onClick:()=>E(M.name,B.uri),children:[h.jsx("span",{className:Ue.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Ue.name} ${Ue.resourceUri}`,children:B.uri}),de&&de!==B.uri?h.jsx("span",{className:Ue.resourceLabel,children:de}):null,h.jsx(nx,{expanded:ne})]}),ne?h.jsx(jSe,{resource:B,t}):null]},B.uri)})]}):null]}):null]})},M.name)})]},z.label))})]})}const DSe="_app_1qn9u_1",OSe="_appChat_1qn9u_24",BSe="_appChatEmpty_1qn9u_30",$Se="_appShell_1qn9u_35",zSe="_chatPane_1qn9u_43",PSe="_appWithSidebar_1qn9u_52",qSe="_themeDark_1qn9u_67",FSe="_themeLight_1qn9u_132",USe="_content_1qn9u_197",HSe="_contentHasMessages_1qn9u_205",VSe="_footer_1qn9u_214",WSe="_bottomPanels_1qn9u_224",GSe="_approvalOverlay_1qn9u_239",KSe="_scrollToBottomLayer_1qn9u_248",YSe="_scrollToBottomLayerWithTodos_1qn9u_259",XSe="_scrollToBottomButton_1qn9u_263",QSe="_scrollToBottomIcon_1qn9u_292",JSe="_btwPanel_1qn9u_298",ZSe="_composer_1qn9u_305",e7e="_emptyWelcomeFooter_1qn9u_310",t7e="_queuedPrompts_1qn9u_314",n7e="_queuedPrompt_1qn9u_314",r7e="_queuedPromptIcon_1qn9u_344",s7e="_queuedPromptMaskIcon_1qn9u_354",i7e="_queuedPromptActionIcon_1qn9u_355",o7e="_queuedPromptText_1qn9u_368",a7e="_queuedPromptActions_1qn9u_376",l7e="_queuedPromptAction_1qn9u_355",c7e="_queuedHint_1qn9u_421",an={app:DSe,appChat:OSe,appChatEmpty:BSe,appShell:$Se,chatPane:zSe,appWithSidebar:PSe,themeDark:qSe,themeLight:FSe,content:USe,contentHasMessages:HSe,footer:VSe,bottomPanels:WSe,approvalOverlay:GSe,scrollToBottomLayer:KSe,scrollToBottomLayerWithTodos:YSe,scrollToBottomButton:XSe,scrollToBottomIcon:QSe,btwPanel:JSe,composer:ZSe,emptyWelcomeFooter:e7e,queuedPrompts:t7e,queuedPrompt:n7e,queuedPromptIcon:r7e,queuedPromptMaskIcon:s7e,queuedPromptActionIcon:i7e,queuedPromptText:o7e,queuedPromptActions:a7e,queuedPromptAction:l7e,queuedHint:c7e},Dh=g.createContext(!1),d6=g.createContext(new Map),WO=g.createContext(new Map);function u7e({timeline:e,details:t,children:n}){return h.jsx(d6.Provider,{value:e,children:h.jsx(WO.Provider,{value:t,children:n})})}const Up=xy,qC=240,d7e="ui.compactMode",h7e="ui.hideTips",f7e=new Set(["coder-model(qwen-oauth)"]);function FC(e){return!f7e.has(e.id)}function rx(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const GO=new Set(["clear","stop","off","reset","none","cancel"]);function m7e(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return GO.has(t)}function p7e(e){const t=e;return t.source!=="goal"?null:N1(t.data)??N1(t.text)}function g7e(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const r=p7e(n);if(r)return r.kind==="set"||r.kind==="checking"?{condition:r.condition,setAt:r.setAt??n.serverTimestamp??n.createdAt}:null}return null}const UC={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},KO=1e3,YO="qwen-code-web-shell-chat-width",y7e=40,XO="qwen-code-web-shell-sidebar-collapsed";function b7e(e){return e===!0?{enabled:!0,defaultCollapsed:!1}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1}:{enabled:!1,defaultCollapsed:!1}}function x7e(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(XO);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function w7e(e){try{window.localStorage.setItem(XO,String(e))}catch{}}function Cg(){return`${KO}`}function v7e(){if(typeof window>"u")return Cg();try{return window.localStorage.getItem(YO)==="wide"?"wide":Cg()}catch{return Cg()}}function _7e(e){try{window.localStorage.setItem(YO,e)}catch{}}function QO(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:KO}function k7e(e,t){const n=`${QO(t)}px`,r=`calc(${n} + ${y7e}px)`;return{"--chat-regular-content-width":n,"--chat-regular-shell-width":r,"--chat-content-width":e==="wide"?"100%":n,"--chat-shell-width":e==="wide"?"100%":r}}function HC(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function S7e(e){if(typeof window>"u")return;const t=new URL(window.location.href);t.pathname=`/session/${encodeURIComponent(e)}`,t.searchParams.delete("token"),t.searchParams.delete("daemon"),window.history.replaceState(null,"",t)}function T7e(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Yl(e.get("language")??e.get("lang")??navigator.language)}function C7e(e,t){return e instanceof Error?e.message:t}function sx(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function nd(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function A7e(e){e.length>0&&console.info("[web-shell] useSessionNotices()",{notices:e})}function E7e(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function M7e(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function ix(e){return typeof e=="object"&&e!==null}function N7e(e){const t=e.trim();return t.startsWith("USE_")?t.slice(4).toLowerCase().replace(/_/g,"-"):t.toLowerCase()}function I7e(e){if(!ix(e))return null;const t=e._meta;if(!ix(t))return null;const n=t.qwenModelSwitch;if(!ix(n))return null;const r=n.authType,s=n.modelId,i=n.baseUrl,o=n.apiKey;return typeof r!="string"||typeof s!="string"||typeof i!="string"||typeof o!="string"?null:{authType:r,modelId:s,baseUrl:i,apiKey:o,...typeof n.isRuntime=="boolean"?{isRuntime:n.isRuntime}:{}}}function R7e(e){return`AuthType: ${N7e(e.authType)}
Using ${e.isRuntime?"runtime ":""}model: ${e.modelId}
Base URL: ${e.baseUrl}
API key: ${e.apiKey}`}function VC(e){return xy.includes(e)}function j7e(e){return e.toolKind==="edit"}function WC(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Rh(e.toolName):!0}function L7e(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 D7e(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 O7e(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools)(EN(r)||D7e(r))&&t.push(`${r.callId}:${r.status}`);return t.join("|")}function B7e(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 $7e(e,t){return e===Rr.NO_OUTPUT?t("copy.noOutput"):e===Rr.NO_TEXT?t("copy.noText"):e===Rr.CODE_MISSING?t("copy.codeMissing"):e===Rr.LATEX_MISSING?t("copy.latexMissing"):e===Rr.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Rr.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Rr.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Rr.CLIPBOARD_PREFIX.length)}`:e.endsWith(Rr.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Rr.COPIED_SUFFIX.length)}):e}function z7e({prompts:e,t,onDelete:n,onInsert:r,onEdit:s}){return e.length===0?null:h.jsxs("div",{className:an.queuedPrompts,children:[e.map(i=>{var u;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>qC?`${o.slice(0,qC)}...`:o,l=((u=i.images)==null?void 0:u.length)??0,c=VO(i.text);return h.jsxs("div",{className:an.queuedPrompt,children:[h.jsx("span",{className:an.queuedPromptIcon,"aria-hidden":"true",children:h.jsx("span",{className:an.queuedPromptMaskIcon,style:If("--queued-icon-url",mke)})}),h.jsxs("span",{className:an.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:""]}),h.jsxs("span",{className:an.queuedPromptActions,children:[l===0&&h.jsxs("button",{type:"button",className:an.queuedPromptAction,onClick:()=>r(i.id),disabled:c,title:c?t("queue.insertCommandDisabled"):void 0,children:[h.jsx("span",{className:an.queuedPromptActionIcon,style:If("--queued-icon-url",fke),"aria-hidden":"true"}),t("queue.insert")]}),h.jsx("button",{type:"button",className:an.queuedPromptAction,onClick:()=>n(i.id),"aria-label":t("queue.delete"),title:t("queue.delete"),children:h.jsx("span",{className:an.queuedPromptActionIcon,style:If("--queued-icon-url",hke),"aria-hidden":"true"})}),h.jsx("button",{type:"button",className:an.queuedPromptAction,onClick:()=>s(i.id),"aria-label":t("queue.edit"),title:t("queue.edit"),children:h.jsx("span",{className:an.queuedPromptActionIcon,style:If("--queued-icon-url",EO),"aria-hidden":"true"})})]})]},i.id)}),h.jsx("div",{className:an.queuedHint,children:t("queue.footer")})]})}function P7e({onSessionIdChange:e,theme:t,onThemeChange:n,language:r,onLanguageChange:s,className:i,style:o,onConnectionChange:a,onStreamingStateChange:l,onError:c,onBugReport:u,hiddenSlashCommands:d,slashCommandCategoryOrder:f,renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:v,renderComposerToolbarEnd:b,renderFooter:x,chatMaxWidth:w,sidebar:k,composerToolbarActions:T,compactThinking:C=!1,collapseCompletedTurns:A=!0,virtualScrollThreshold:L,markdown:$,loadingPhrases:E,onTranscriptChange:z,onToast:M,composerRef:U,onComposerReady:K,composerInput:J,composerInputVersion:P}={}){var D6;const[V,X]=g.useState(v7e),[te,D]=g.useState(()=>r===void 0?T7e():Yl(r)),j=g.useMemo(()=>IN(te),[te]),B=g.useMemo(()=>b7e(k),[k]),[I,ne]=g.useState(()=>x7e(B.defaultCollapsed)),[de,ce]=g.useState(null),Ne=g.useCallback(R=>{ne(R),w7e(R)},[]),Ce=g.useMemo(()=>({renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:v,renderComposerToolbarEnd:b,renderFooter:x,compactThinking:C,collapseCompletedTurns:A,markdown:$,loadingPhrases:E}),[m,p,y,v,b,x,C,A,$,E]),ze=x,ue=_5(),rt=_y(),xe=bc(),Ee=ky(),{notices:Zt,dismissNotice:ht}=CU(),bt=yc(),Vt=g.useRef(M);Vt.current=M;const pn=g.useRef(0),[vt,Wt]=g.useState([]),Gt=g.useCallback(R=>{Wt(H=>H.filter(se=>se.id!==R))},[]),Tt=g.useCallback((R,H)=>{if(Vt.current){Vt.current(R,H);return}const se={id:`web-shell-toast-${Date.now()}-${++pn.current}`,tone:R,message:H};Wt(We=>[...We.filter(He=>He.tone!==R||He.message!==H),se].slice(-4))},[]),Oe=lke(j),ot=g.useRef(Oe);ot.current=Oe;const[ft,F]=g.useState(null),[W,re]=g.useState(null),me=g.useRef(1),Pe=g.useRef(1),Re=g.useRef(null),nt=g.useRef(null),wt=g.useRef(xe.sessionId),ut=g.useMemo(()=>{const R=[ft].filter(se=>se!==null);if(R.length===0)return OC(Oe);const H=[...Oe];for(const se of R.sort((We,Ze)=>We.anchorIndex-Ze.anchorIndex)){const We=se.anchorAfterId?H.findIndex(He=>He.id===se.anchorAfterId):-1,Ze=We>=0?We+1:Math.min(se.anchorIndex,H.length);H.splice(Ze,0,se.message)}return OC(H)},[Oe,ft]),he=R8e(rt),Z=g.useMemo(()=>PU(he),[he]),ie=uke(Z),fe=!(xe.catchingUp&&de!==null),Ve=WC(ie)&&fe?ie:null,mt=ie&&!WC(ie)&&fe?ie:null,It=g.useRef(ie);It.current=fe?ie:null;const ye=g.useMemo(()=>Kue(Oe),[Oe]),at=g.useRef(null),Ut=g.useMemo(()=>{const R=Xue(Oe),H=at.current;if(H&&H.signature===R)return H.timeline;const se=Yue(Oe);return at.current={signature:R,timeline:se},se},[Oe]),rn=g.useRef(null),to=g.useMemo(()=>{const R=Que(Oe),H=rn.current;if(H&&H.signature===R)return H.details;const se=rde(Oe);return rn.current={signature:R,details:se},se},[Oe]),ti=dke(ye.todos,R=>`${R.id}:${R.status}:${R.content}`),kc=ye.allCompleted,[rl,Sc]=g.useState("hidden"),ia=xe.catchingUp||ti.length===0||kc?"hidden":"active";ia!==rl&&Sc(ia);const xo=ia!=="hidden",Tc=g.useMemo(()=>O7e(Oe),[Oe]),[Pr,ni]=g.useState(0),In=D8e(Tc,xe.status==="connected",Pr),zn=g.useMemo(()=>x?In.map(B7e):[],[In,x]),bs=g.useRef(null),zt=g.useRef(null),or=g.useRef(null),qr=g.useRef(null),sl=g.useRef(null),[Os,oa]=g.useState(!1),aa=g.useRef(null),la=g.useRef(!1),os=g.useCallback((R="smooth")=>{oa(!1),requestAnimationFrame(()=>{var H;(H=zt.current)==null||H.scrollToBottom(R),requestAnimationFrame(()=>{var se;(se=zt.current)==null||se.scrollToBottom(R)})})},[]),wo=g.useCallback(R=>{or.current=R,HC(U,R??UC),R&&qr.current!==R&&(qr.current=R,K==null||K(R))},[U,K]);g.useEffect(()=>{HC(U,or.current??UC)},[U]);const[Ti,Ci]=g.useState(null),no=g.useRef(null);no.current=Ti;const{followupState:Ai,onAcceptFollowup:Cc,onDismissFollowup:ro,clear:Ac}=$U({onAccept:R=>{var H;(H=or.current)==null||H.insertText(R)}}),gn=g.useCallback((R,H,se)=>{Ac();const We=!R.trimStart().startsWith("/");!(se!=null&&se.retry)&&We&&(ol.current=R,Uu.current=H,al.current=null),le(!1);const Ze={images:H,optimisticUserMessage:se==null?void 0:se.optimisticUserMessage,retry:se==null?void 0:se.retry};return Ee.sendPrompt(R,Ze)},[Ac,Ee]),sn=k5(),Ei=g.useRef(sn),Ec=g.useRef(Date.now()),ca=g.useRef(sn);ca.current==="idle"&&sn!=="idle"&&(Ec.current=Date.now()),ca.current=sn;const il=g.useMemo(()=>{if(sn!=="idle"){for(let R=ut.length-1;R>=0;R--){const H=ut[R];if((H==null?void 0:H.role)==="user")return H.timestamp??Ec.current}return Ec.current}},[ut,sn]),ol=g.useRef(""),Uu=g.useRef(void 0),vo=g.useRef(null),al=g.useRef(null),[Q,le]=g.useState(!1),ae=g.useRef(Q);ae.current=Q;const _e=xe.status==="connected",[yt,pt]=g.useState([]);g.useEffect(()=>{_e&&bt.loadSkillsStatus().then(R=>{pt(((R==null?void 0:R.skills)??[]).map(H=>({name:H.name,description:H.description??""})).sort((H,se)=>H.name.localeCompare(se.name)))}).catch(()=>{})},[_e,bt]);const[_t,en]=g.useState(null),[Pt,vn]=g.useState([]),[xs,fr]=g.useState(!1),[Pn,er]=g.useState(!1),[_o,Oh]=g.useState(!1),[Mc,Hu]=g.useState(!1),[we,xt]=g.useState(!1),[At,Lt]=g.useState(!1),[qt,Ht]=g.useState(!1),[_n,tr]=g.useState(!1),[Kr,so]=g.useState(!1),[ua,ll]=g.useState(null),[Bh,Nc]=g.useState(!1),[Vu,Sm]=g.useState(!1),[Tm,mb]=g.useState(!1),[tB,nB]=g.useState(0),[rB,sB]=g.useState(0),ws=Bu(),h6=g.useRef((ws==null?void 0:ws.extensionsVersion)??0);g.useEffect(()=>{const R=(ws==null?void 0:ws.extensionsVersion)??0;if(R!==h6.current){h6.current=R;const H=ws==null?void 0:ws.lastExtensionChange;if((H==null?void 0:H.status)==="failed"){ue.dispatch([{type:"error",text:j("extensions.action.failed",{name:H.name??"",source:H.source??"",error:H.error??j("error.unknown")})}]);return}if((H==null?void 0:H.status)==="installed"){const se=H.name??H.source??j("extensions.label");ue.dispatch([{type:"status",text:H.version?j("extensions.install.installedWithVersion",{name:se,version:H.version}):j("extensions.install.installed",{name:se})}])}else if(H!=null&&H.status){const se=H.name??H.source??j("extensions.label"),We=H.status==="updated"&&H.version?"extensions.manage.updatedWithVersion":`extensions.manage.${H.status}`;ue.dispatch([{type:"status",text:j(We,{name:se,version:H.version??""})}])}Ee.refreshCommands().catch(()=>{ue.dispatch([{type:"error",text:j("extensions.commands.refreshFailed")}])})}},[ws==null?void 0:ws.extensionsVersion,ws==null?void 0:ws.lastExtensionChange,Ee,ue,j]);const[iB,oB]=g.useState("workspace"),[$h,pb]=g.useState(null),[aB,gb]=g.useState(!1),zh=g.useRef(0),da=g.useRef(null),[yb,Cm]=g.useState(null),[bb,xb]=g.useState(t??ds.Dark),[Wu,wb]=g.useState(""),f6=g.useRef(Wu);f6.current=Wu;const Am=g.useRef(xe);Am.current=xe;const lB=xe.displayName,[cl,vb]=g.useState("default"),[Ic,ha]=g.useState([]),cB=g.useMemo(()=>Ic.map(R=>R.text),[Ic]),uB=g.useMemo(()=>(xe.models??[]).filter(FC).map(R=>({id:R.id,label:X1(R.label||R.id)})),[xe.models]),nr=g.useRef([]),dB=g.useRef(1),Ph=g.useRef(!1),Mi=Pn||_o||Mc||we||At||qt||_n||Kr||_t!==null||xs||yb!==null||ua!==null||$h!==null||Bh||Vu||Tm,lt=g.useCallback((R,H)=>{if(sx(R))return;if(QM(R)){console.debug("[web-shell] turn error rendered in transcript",R);return}if(nd(R)){console.debug("[web-shell] error already handled by notice",R);return}const se=C7e(R,H);console.error("[web-shell]",se,R),Tt("error",se)},[Tt]);g.useEffect(()=>{A7e(Zt);for(const R of Zt)E7e(R)?Tt(M7e(R),R.message):R.category==="lifecycle"?console.debug("[web-shell] daemon notice",R):console.warn("[web-shell] daemon notice",R),ht(R.id)},[ht,Zt,Tt]);const _b=g.useRef(u);_b.current=u,g.useEffect(()=>{var R,H;wt.current=xe.sessionId,nr.current=[],ha([]),Ph.current=!1,(R=nt.current)==null||R.abort(),nt.current=null,(H=Re.current)==null||H.abort(),Re.current=null,F(null),re(null),Cm(null),Im.current=0},[xe.sessionId]);const m6=g.useCallback(()=>{var Ze;const R=`local-recap-${me.current++}`,H=Oe.length,se=(Ze=Oe.at(-1))==null?void 0:Ze.id,We=xe.sessionId;F({anchorAfterId:se,anchorIndex:H,message:{id:R,role:"system",content:`※ recap: ${j("recap.loading")}`,variant:"info",source:"recap"}}),Ee.recapSession().then(He=>{wt.current===We&&F({anchorAfterId:se,anchorIndex:H,message:{id:R,role:"system",content:He.recap?`※ recap: ${He.recap}`:j("recap.empty"),variant:"info",source:"recap"}})},He=>{wt.current===We&&(F(null),!sx(He)&&!nd(He)&&console.warn("[web-shell] unhandled recap failure",He))})},[xe.sessionId,Oe,Ee,j]),p6=g.useCallback(R=>{var He;const H=R.trim();if(!H){Tt("error",j("btw.empty"));return}const se=`local-btw-${Pe.current++}`,We=xe.sessionId;(He=Re.current)==null||He.abort();const Ze=new AbortController;Re.current=Ze,re({id:se,role:"btw",question:H,answer:"",isPending:!0}),Ee.btwSession(H,{signal:Ze.signal}).then(ke=>{wt.current===We&&Re.current===Ze&&(Re.current=null,re({id:se,role:"btw",question:H,answer:ke.answer||j("btw.emptyAnswer"),isPending:!1}))},ke=>{wt.current===We&&Re.current===Ze&&(Re.current=null,re(null),!sx(ke)&&!nd(ke)&&console.warn("[web-shell] unhandled btw failure",ke))})},[xe.sessionId,Tt,Ee,j]),g6=g.useCallback(()=>{var R;(R=Re.current)==null||R.abort(),Re.current=null,re(null)},[]);g.useEffect(()=>{const R=H=>{var ke;if(Mi||ie)return;const se=W;if(!se||se.role!=="btw")return;const We=H.key.toLowerCase(),Ze=H.key==="Escape"&&!H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey,He=H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey&&(We==="c"||We==="d");if(se.isPending){if(!Ze&&!He)return}else{const Te=((ke=or.current)==null?void 0:ke.hasInput())??!1;if(!(!H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey&&(H.key==="Escape"||!Te&&(H.key==="Enter"||H.key===" "))))return}H.preventDefault(),H.stopPropagation(),g6()};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[Mi,W,g6,ie]),g.useEffect(()=>{nr.current=Ic},[Ic]);const ar=g.useCallback((R,H,se)=>{const We=R.trim();if(!We)return!0;const Ze={id:dB.current++,sessionId:wt.current,text:We,images:H?[...H]:void 0,onComplete:se};return nr.current=[...nr.current,Ze],ha(nr.current),!0},[]),ko=g.useCallback((R,H)=>Mke(Ei.current!=="idle",R,H,{append:se=>ue.appendLocalUserMessage(se),enqueue:ar}),[ar,ue]);g.useEffect(()=>{if(sn!=="idle")return;const R=nt.current;R&&(console.debug("[mid-turn] turn settled; cancelling any in-flight push"),R.abort(),nt.current=null)},[sn]);const y6=g.useCallback(()=>{const[R,...H]=nr.current;return R?(nr.current=H,ha(H),R):null},[]),b6=g.useCallback(()=>nr.current[0]??null,[]),Em=g.useCallback(R=>{const H=nr.current;if(H.length===0)return null;const se=R===void 0?H.length-1:H.findIndex(He=>He.id===R);if(se<0)return null;const We=H[se],Ze=H.filter((He,ke)=>ke!==se);return nr.current=Ze,ha(Ze),(We==null?void 0:We.text)??null},[]),hB=g.useCallback(R=>{const H=nr.current.filter(se=>se.id!==R);H.length!==nr.current.length&&(nr.current=H,ha(H))},[]),fB=g.useCallback(async R=>{var He;const H=nr.current.find(ke=>ke.id===R);if(!H||(((He=H.images)==null?void 0:He.length)??0)>0||VO(H.text))return;let se=nt.current;se||(se=new AbortController,nt.current=se);let We;try{We=await Ee.enqueueMidTurnMessage(H.text,{signal:se.signal})}catch(ke){lt(ke,j("queue.insertFailed"));return}if(!We.accepted)return;const Ze=nr.current.filter(ke=>ke.id!==R);nr.current=Ze,ha(Ze)},[lt,Ee,j]),mB=g.useCallback(R=>{var Ze,He,ke;const H=Em(R);if(!H)return;const se=((Ze=or.current)==null?void 0:Ze.getText())??"",We=se.trim()?`${H}
${se}`:H;(He=or.current)==null||He.setText(We),(ke=or.current)==null||ke.focus()},[Em]),pB=g.useCallback(()=>Em(),[Em]),kb=g.useCallback(()=>nr.current.length===0?!1:(nr.current=[],ha([]),ue.dispatch([{type:"status",text:j("queue.cleared")}]),!0),[ue,j]),{batches:qh,consume:x6}=zU();g.useEffect(()=>{const R=xe.sessionId;if(!R||qh.length===0)return;xe.clientId===void 0&&qh.some(se=>se.sessionId===R&&se.originatorClientId!==void 0)&&console.debug("[mid-turn] originator-stamped batches but no client id; dedupe skipped (may resend next turn)");const H=HU(nr.current,qh,R,xe.clientId);H&&(nr.current=H,ha(H)),x6(qh.filter(se=>se.sessionId===R))},[qh,xe.sessionId,xe.clientId,x6]);const Mm=g.useCallback(R=>{xb(R),n==null||n(R)},[n]),Fh=g.useCallback(R=>{D(R),s==null||s(R)},[s]),w6=g.useCallback(()=>{Lt(!0)},[]),v6=LU({autoLoad:!0}),{settings:Uh,setValue:_6,reload:k6}=v6,Gu=Uh.find(R=>R.key===Xc),Ku=Uh.find(R=>R.key===h7e),Yu=Uh.find(R=>R.key===Xf),gB=(()=>{var H;const R=(H=Uh.find(se=>se.key==="voiceModel"))==null?void 0:H.values.effective;return typeof R=="string"&&R.trim()?R.trim():void 0})(),yB=Bde(Uh),[Sb,S6]=g.useState(!1),Tb=g.useRef(Sb);Tb.current=Sb,g.useEffect(()=>{if(t){xb(t);return}const R=E5(Gu==null?void 0:Gu.values.effective);R&&xb(R)},[t,Gu==null?void 0:Gu.values.effective]),g.useEffect(()=>{if(r!==void 0){D(Yl(r));return}const R=T5(Yu==null?void 0:Yu.values.effective);R&&D(R)},[r,Yu==null?void 0:Yu.values.effective]);const bB=g.useCallback(R=>{const H=te,se=`/language ui ${R}`;Fh(R);const We=()=>Promise.all([Ee.refreshCommands(),k6()]);if(Ei.current!=="idle"){ar(se,void 0,We);return}gn(se).then(We).catch(Ze=>{Fh(H),lt(Ze,"Failed to sync /language command")})},[ar,Fh,k6,lt,gn,te,Ee]),T6=g.useCallback(()=>{if(Ei.current!=="idle"){ue.dispatch([{type:"status",text:j("clear.blocked")}]);return}ue.reset()},[ue,j]),C6=g.useCallback(()=>{const R=Tb.current,H=!Tb.current;S6(H),_6("workspace",d7e,H).catch(se=>{S6(R),lt(se,j("compact.saveFailed"))})},[lt,_6,j]),Rc=g.useCallback(R=>{if(!VC(R)){lt(new Error(`Unsupported approval mode: ${R}`),j("local.approvalMode"));return}Ee.setApprovalMode(R).then(H=>{const se=H.mode||R;vb(se);const We=It.current;if(!We)return;if(R==="yolo"||R==="auto-edit"&&j7e(We)){const He=We.options.find(ke=>ke.kind==="allow_once");if(He){const ke=We.title||"";ue.dispatch([{type:"status",text:j("mode.autoApproved",{tool:ke})}]),Ee.submitPermission(We.id,He.id).catch(Te=>{lt(Te,"Failed to auto-approve tool call")})}}}).catch(H=>{lt(H,j("local.approvalMode"))})},[Ee,lt,ue,j]);g.useEffect(()=>{Ei.current=sn},[sn]),g.useEffect(()=>{let R=null;for(let se=rt.length-1;se>=0;se--){const We=rt[se];if((We==null?void 0:We.kind)==="user")break;if((We==null?void 0:We.kind)==="error"&&We.source==="turn_error"){R=We.id;break}if((We==null?void 0:We.kind)!=="debug")break}const H=_e&&R!==null&&R!==al.current&&ol.current.length>0;vo.current=H?R:null,le(H)},[rt,_e]),g.useEffect(()=>{l==null||l(sn)},[sn,l]),g.useEffect(()=>{a==null||a(xe.status)},[xe.status,a]),g.useEffect(()=>{z==null||z(rt)},[rt,z]),g.useEffect(()=>{if(xe.error){const R=new Error(xe.error);c==null||c(R)}},[xe.error,c]),g.useEffect(()=>{wb(xe.currentModel??"")},[xe.currentModel,xe.sessionId]),g.useEffect(()=>{vb(xe.currentMode??"default")},[xe.currentMode,xe.sessionId]),g.useEffect(()=>{xe.sessionId&&(Ci(null),e==null||e(xe.sessionId),e||S7e(xe.sessionId))},[xe.sessionId,e]),g.useEffect(()=>{const R=g7e(rt);Ci(H=>R?(H==null?void 0:H.condition)===R.condition&&H.setAt===R.setAt?H:R:H&&null)},[rt]),g.useEffect(()=>{const R=H=>{const se=H.detail;if(!(se!=null&&se.active)){Ci(null);return}se.condition&&Ci({condition:se.condition,setAt:se.setAt??Date.now()})};return window.addEventListener(dv,R),()=>window.removeEventListener(dv,R)},[]);const Nm=g.useRef(null),Im=g.useRef(0);g.useEffect(()=>{Im.current=0},[xe.sessionId]),g.useEffect(()=>{function se(){if(document.hidden){Nm.current===null&&(Nm.current=Date.now());return}const We=Nm.current;if(Nm.current=null,We===null||Date.now()-We<18e4||Ei.current!=="idle"||!xe.sessionId)return;const Ze=ue.getSnapshot().blocks.length;Ze-Im.current<4||(Im.current=Ze,Ee.recapSession().then(He=>{He.recap&&ue.dispatch([{type:"status",text:`※ recap: ${He.recap}`,source:"recap"}])},He=>{console.error("[auto-recap] failed:",He)}))}return document.addEventListener("visibilitychange",se),()=>document.removeEventListener("visibilitychange",se)},[xe.sessionId,Ee,ue]);const Cb=g.useCallback(()=>{const R=VC(cl)?Up.indexOf(cl):-1,H=Up[(R+1)%Up.length];Rc(H)},[cl,Rc]),Hh=g.useCallback((R,H)=>{ko(R)||Ee.getContextUsage({detail:H}).then(se=>{ue.dispatch([{type:"status",text:noe(se)}]),os("smooth")}).catch(se=>{lt(se,"Failed to load context usage")})},[ko,ue,Ee,lt,os]),xB=g.useCallback(()=>{Hh("/context detail",!0)},[Hh]),Rm=g.useCallback(R=>{Ee.branchSession(R||void 0).then(H=>{ue.dispatch([{type:"status",text:j("branch.success",{name:H.displayName})}])}).catch(H=>{lt(H,j("branch.failed"))})},[lt,Ee,ue,j]),wB=g.useCallback(()=>{Rm()},[Rm]),jm=g.useCallback(async()=>{try{const R=await Ee.createSession();return e?(e(R.sessionId),!0):(Ee.loadSession(R.sessionId).catch(H=>lt(H,"Failed to switch session")),!0)}catch(R){return lt(R,"Failed to create a new session"),!1}},[e,lt,Ee]),vB=g.useCallback(async R=>{ce(R);try{await Ee.loadSession(R,{deferTranscriptReset:!0})}catch(H){throw ce(se=>se===R?null:se),H}},[Ee]);g.useEffect(()=>{de!==null&&xe.sessionId===de&&!xe.catchingUp&&ce(null)},[xe.catchingUp,xe.sessionId,de]);const Ab=g.useCallback(()=>{Ee.getTasks().then(R=>{Cm({snapshot:R})}).catch(R=>{lt(R,"Failed to load tasks")})},[lt,Ee]),A6=g.useCallback((R,H)=>{Ci({condition:R,setAt:H}),ue.dispatch([{type:"status",text:w9({kind:"set",condition:R,setAt:H})}])},[ue]),E6=g.useCallback(R=>{R&&(ue.dispatch([{type:"status",text:w9({kind:"cleared",condition:R.condition,durationMs:Date.now()-R.setAt})}]),Ci(null))},[ue]),Lm=g.useCallback(R=>(ue.appendLocalUserMessage(R),Ee.clearGoal().catch(H=>{lt(H,"Failed to clear /goal")}),!0),[lt,Ee,ue]),_B=g.useCallback(()=>Ee.getRewindSnapshots(),[Ee]),kB=g.useCallback(R=>Ee.rewindSession(R,{rewindFiles:!1}).then(()=>{}),[Ee]),SB=g.useCallback(R=>{if(nd(R))return;const H=R instanceof Error?R.message:String(R);Tt("error",j("rewind.failed",{reason:H}))},[Tt,j]),M6=g.useCallback((R,H,se)=>{const We=R.replace(/^\/goal\b/i,"").trim(),Ze=We.toLowerCase(),He=(se==null?void 0:se.sendToDaemon)??!0;return We&&GO.has(Ze)?He?Lm(R):(ue.appendLocalUserMessage(R),E6(no.current),!0):We?(ue.appendLocalUserMessage(R),He?(gn(R,H,{optimisticUserMessage:!1}).catch(ke=>{lt(ke,"Failed to send /goal command")}),!0):(A6(We,Date.now()),!0)):(ue.appendLocalUserMessage(R),He&&gn(R,H,{optimisticUserMessage:!1}).catch(ke=>lt(ke,"Failed to send /goal command")),!0)},[E6,A6,Lm,lt,gn,ue]),Vh=g.useMemo(()=>new Set((d??[]).map(rx).filter(Boolean)),[d]),TB=Vh.has("settings"),Dm=g.useCallback((R,H)=>{var We;const se=Ei.current!=="idle";if(R.startsWith("/")){const Ze=R.match(/^\/([\w-]+)/);if(Ze){const He=Ze[1];if(Vh.has(rx(He)))return se?ar(R,H):(gn(R,H).catch(ke=>lt(ke,"Failed to send hidden slash command")),!0);if(He==="help")return Lt(!0),!0;if(He==="tasks")return Ab(),!0;if(He==="goal")return se?m7e(R)?Lm(R):ar(R,H):M6(R,H);if(He==="theme"){const ke=R.slice(Ze[0].length).trim().toLowerCase();return ke==="dark"||ke==="light"?Mm(ke):ke?Tt("error",j("error.unsupportedTheme")):Ht(!0),!0}if(He==="language"){const ke=R.slice(Ze[0].length).trim(),[Te,cn]=ke.split(/\s+/);if(!ke)return ue.dispatch([{type:"status",text:[j("language.current",{language:C5(te)}),j("language.usage"),j("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Te==null?void 0:Te.toLowerCase())==="ui"){if(!cn)return ue.dispatch([{type:"status",text:[j("language.set"),"",j("language.usage"),"",j("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const Dt=cn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(Dt))return Tt("error",j("language.invalid")),!0;const wr=Yl(cn);return Fh(wr),se||gn(`/language ui ${wr}`).then(()=>Ee.refreshCommands()).catch(Ni=>{lt(Ni,"Failed to sync /language command")}),!0}}if(He==="copy"){const ke=R.slice(Ze[0].length).trim();return kke(ot.current,ke).then(Te=>{ue.dispatch([{type:Te.status==="error"?"error":"status",text:$7e(Te.message,j)}])}).catch(Te=>{lt(Te,j("copy.failedFallback"))}),!0}if(He==="delete")return Oh(!0),!0;if(He==="release")return Hu(!0),!0;if(He==="rewind")return xt(!0),!0;if(He==="branch"){if(se)return ar(R,H);const ke=R.slice(Ze[0].length).trim();return Rm(ke||void 0),!0}if(He==="fork"){if(se)return ar(R,H);const ke=R.slice(Ze[0].length).trim();return ke?(Ee.forkSession(ke).then(Te=>{if(!Te.launched){Tt("warning",j("fork.notStarted"));return}ni(cn=>cn+1),Tt("success",j("fork.started",{name:Te.description}))}).catch(Te=>{const cn=Te instanceof Error?Te.message:String(Te);lt(Te,j("fork.failed",{reason:cn}))}),!0):(Tt("error",j("fork.empty")),!0)}if(He==="auth")return mb(!0),!0;if(He==="model"){const ke=R.slice(Ze[0].length).trim();return ke==="--fast"?(en("fast"),!0):ke.startsWith("--fast ")?se?ar(R,H):(gn(R,H).catch(Te=>lt(Te,"Failed to send /model --fast")),!0):ke==="--voice"?(ko(R,H)||bt.loadProviders().then(Te=>{vn(e0e(Te)),en("voice")}).catch(Te=>lt(Te,j("model.setVoice"))),!0):ke.startsWith("--voice ")?se?ar(R,H):(gn(R,H).catch(Te=>lt(Te,"Failed to send /model --voice")),!0):(ke?Ee.setModel(ke).then(()=>{wb(ke)}).catch(Te=>{lt(Te,j("model.switch"))}):en("main"),!0)}if(He==="plan"){if(se)return ar(R,H);const ke=R.slice(Ze[0].length).trim();return Ee.setApprovalMode("plan").then(()=>{vb("plan"),ke&&gn(ke,H).catch(Te=>lt(Te,"Failed to send plan prompt"))}).catch(Te=>{lt(Te,j("mode.plan"))}),!0}if(He==="approval-mode"){const ke=R.slice(Ze[0].length).trim();return ke?Rc(ke):fr(!0),!0}if(He==="mcp"){const ke=R.slice(Ze[0].length).trim().toLowerCase();return bt.loadMcpStatus().then(async Te=>{const cn={},Dt={};await Promise.all(((Te==null?void 0:Te.servers)??[]).map(async Rn=>{await Promise.all([(async()=>{try{cn[Rn.name]=await bt.loadMcpTools(Rn.name)}catch{}})(),(async()=>{if(Rn.resourceCount)try{Dt[Rn.name]=await bt.loadMcpResources(Rn.name)}catch{}})()])})),ll({status:Te,toolsByServer:cn,resourcesByServer:Dt,showDescriptions:ke==="desc",showSchema:ke==="schema",showTips:!ke})}).catch(Te=>{lt(Te,"Failed to load MCP status")}),!0}if(He==="skills"){if(R.slice(Ze[0].length).trim()){if(se)return ar(R,H);gn(R,H).catch(Te=>lt(Te,"Failed to send /skills command"))}else{if(ko(R,H))return!0;bt.loadSkillsStatus().then(Te=>{const cn=((Te==null?void 0:Te.skills)??[]).map(Dt=>({name:Dt.name,description:Dt.description??""})).sort((Dt,Rn)=>Dt.name.localeCompare(Rn.name));if(pt(cn),cn.length===0)ue.dispatch([{type:"status",text:j("skills.none")}]);else{const Dt=cn.map(Rn=>`- ${Rn.name}`).join(`
`);ue.dispatch([{type:"status",text:`${j("skills.available")}

${Dt}`}])}os("smooth")}).catch(Te=>{lt(Te,"Failed to load skills")})}return!0}if(He==="tools"){const ke=R.slice(Ze[0].length).trim().toLowerCase();if(ke==="desc"||ke==="descriptions")tr(!0);else{if(ko(R,H))return!0;bt.loadToolsStatus().then(Te=>{const cn=(Te==null?void 0:Te.tools)??[];if(cn.length===0)ue.dispatch([{type:"status",text:j("tools.none")}]);else{const Dt=cn.map(Rn=>`- ${Rn.displayName||Rn.name}`).join(`
`);ue.dispatch([{type:"status",text:`${j("tools.available")}

${Dt}`}])}os("smooth")}).catch(Te=>{lt(Te,"Failed to load tools")})}return!0}if(He==="settings")return Nc(!0),!0;if(He==="context"){const ke=R.slice(Ze[0].length).trim().toLowerCase();if(ke===""||ke==="detail"||ke==="-d")return Hh(R,ke==="detail"||ke==="-d"),!0}if(He==="memory"){const ke=R.slice(Ze[0].length).trim().toLowerCase();if(ke==="refresh")nB(Te=>Te+1);else if(ke==="add"||ke.startsWith("add ")){const Te=ke.slice(3).trim();oB(Te==="user"||Te==="global"?"global":"workspace"),sB(cn=>cn+1)}return Sm(!0),!0}if(He==="agents"){const ke=R.slice(Ze[0].length).trim().toLowerCase();let Te="menu";return ke==="create"?Te="create":ke==="create user"||ke==="create global"?Te="create-user":ke==="create project"||ke==="create workspace"?Te="create-project":ke==="manage"&&(Te="manage"),pb(Te),!0}if(He==="extensions"){const ke=R.slice(Ze[0].length).trim(),Te=(We=ke.split(/\s+/)[0])==null?void 0:We.toLowerCase();if(!Te||Te==="manage")return so(!0),!0;if(Te==="install"){if(se)return ar(R,H);const cn=ke.slice(7).trim().split(/\s+/);let Dt="",Rn,wr,Ni,jc,So=null;for(let Ii=0;Ii<cn.length;Ii++){const vs=cn[Ii];if(vs)if(vs==="--auto-update")Ni=!0;else if(vs==="--pre-release"||vs==="--allow-pre-release")jc=!0;else if(vs==="--ref"||vs==="--registry"){const Lc=cn[Ii+1];if(!Lc||Lc.startsWith("--")){So=j("extensions.install.missingOptionValue",{option:vs});break}vs==="--ref"?Rn=Lc:wr=Lc,Ii+=1}else if(vs.startsWith("--")){So=j("extensions.install.unknownOption",{option:vs});break}else if(!Dt)Dt=vs;else{So=j("extensions.install.usage");break}}if(So)return ue.appendLocalUserMessage(R),ue.dispatch([{type:"error",text:So}]),!0;if(!Dt)return ue.appendLocalUserMessage(R),ue.dispatch([{type:"error",text:j("extensions.install.usage")}]),!0;const To=Am.current.clientId;return To?(ue.appendLocalUserMessage(R),ue.dispatch([{type:"status",text:j("extensions.install.started",{source:Dt})}]),bt.installExtension({source:Dt,...Rn?{ref:Rn}:{},...wr?{registry:wr}:{},...Ni!==void 0?{autoUpdate:Ni}:{},...jc!==void 0?{allowPreRelease:jc}:{},consent:!0},To).then(()=>{}).catch(Ii=>{lt(Ii,j("extensions.install.requestFailed"))}),!0):(ue.appendLocalUserMessage(R),ue.dispatch([{type:"error",text:j("extensions.install.waitForSession")}]),!0)}return ko(R,H)||ue.dispatch([{type:"error",text:j("extensions.install.usage")}]),!0}if(He==="clear"||He==="new"||He==="reset")return jm(),!0;if(He==="rename"){const ke=L7e(R.slice(Ze[0].length));if(ke.type==="auto"||ke.type==="delegate")return se?ar(R,H):(gn(R,H).catch(cn=>lt(cn,"Failed to send /rename command")),!0);const Te=ke.displayName;return Te?(Ee.renameSession(Te).then(()=>{ue.dispatch([{type:"status",text:j("rename.success",{name:Te})}])}).catch(cn=>{lt(cn,"Failed to rename session")}),!0):(Tt("error",j("rename.empty")),!0)}if(He==="resume"){const ke=R.slice(Ze[0].length).trim();return ke?Ee.loadSession(ke).catch(Te=>{lt(Te,"Failed to load session")}):er(!0),!0}if(He==="recap")return m6(),!0;if(He==="btw")return p6(R.slice(Ze[0].length)),!0;if(He==="stats"){const ke=R.slice(Ze[0].length).trim().toLowerCase();let Te="overview";return ke==="model"?Te="model":ke==="tools"&&(Te="tools"),ko(R,H)||Ee.getStats().then(cn=>{ue.dispatch([{type:"status",text:qoe(cn,Te)}]),os("smooth")}).catch(()=>{}),!0}if(He==="status"||He==="about")return ko(R,H)||Promise.all([bt.loadPreflight().catch(()=>null),bt.loadProviders().catch(()=>null),bt.loadEnv().catch(()=>null)]).then(([ke,Te,cn])=>{var Lc,O6,B6,$6,z6,P6;const Dt=BC(ke,cn);let Rn=Dt.authSource;!Rn&&((Lc=Te==null?void 0:Te.current)!=null&&Lc.authType)&&(Rn=Te.current.authType);const wr=[];Dt.nodeVersion&&wr.push(`Node.js v${Dt.nodeVersion}`),Dt.npmVersion&&wr.push(`npm ${Dt.npmVersion}`);let Ni="";Rn&&(Rn.startsWith("oauth")||Rn==="qwen-oauth"?Ni="Qwen OAuth":Ni=`API Key - ${Rn}`);const jc=`${Dt.platform} ${Dt.arch}`.trim(),So=f6.current,To=Am.current,vs={cliVersion:((O6=To.capabilities)==null?void 0:O6.qwenCodeVersion)||"",runtime:wr.join(" / "),platform:jc,auth:Ni,baseUrl:((B6=Te==null?void 0:Te.current)==null?void 0:B6.baseUrl)||"",model:So||To.currentModel||(($6=Te==null?void 0:Te.current)==null?void 0:$6.modelId)||"",fastModel:((z6=Te==null?void 0:Te.current)==null?void 0:z6.fastModelId)||So||To.currentModel||((P6=Te==null?void 0:Te.current)==null?void 0:P6.modelId)||"",sessionId:To.sessionId||"",sandbox:Dt.sandbox,proxy:Dt.proxy,memoryUsage:Dt.memoryUsage};ue.dispatch([{type:"status",text:sae(vs)}]),os("smooth")}),!0;if(He==="bug"){const ke=R.slice(Ze[0].length).trim();return ko(R,H)||Promise.all([bt.loadPreflight().catch(()=>null),bt.loadEnv().catch(()=>null)]).then(([Te,cn])=>{var Ni;const Dt=BC(Te,cn),Rn=((Ni=Am.current.capabilities)==null?void 0:Ni.qwenCodeVersion)||"",wr={};if(Rn&&(wr.cliVersion=Rn),Dt.nodeVersion&&(wr.nodeVersion=Dt.nodeVersion),Dt.npmVersion&&(wr.npmVersion=Dt.npmVersion),Dt.platform&&(wr.platform=Dt.platform),Dt.arch&&(wr.arch=Dt.arch),Dt.sandbox&&(wr.sandbox=Dt.sandbox),Dt.memoryUsage&&(wr.memoryUsage=Dt.memoryUsage),_b.current)_b.current({title:ke,systemInfo:wr}),ue.dispatch([{type:"status",text:j("bug.submitted")}]);else{const jc=Object.entries(wr).filter(([,Ii])=>Ii).map(([Ii,vs])=>`${Ii}: ${vs}`).join(`
`),So=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(ke)}&info=${encodeURIComponent(`
`+jc+`
`)}`,To=window.open(So,"_blank");To?(To.opener=null,ue.dispatch([{type:"status",text:j("bug.submitted")}])):Tt("error",j("bug.popupBlocked"))}}).catch(Te=>{lt(Te,j("bug.failed"))}),!0}}return se?ar(R,H):(gn(R,H).catch(He=>lt(He,"Failed to send command")),!0)}else if(R.startsWith("!")){if(se)return ar(R,H);const Ze=R.slice(1).trim();return Ze?(Ee.sendShellCommand(Ze).catch(He=>{lt(He,"Failed to execute shell command")}),!0):!1}else return se?ar(R,H):(gn(R,H).catch(Ze=>lt(Ze,"Failed to send message")),!0)},[gn,Ee,ue,ar,ko,Rm,jm,Lm,M6,Mm,Rc,Fh,Ab,Vh,Tt,lt,m6,p6,os,te,Hh,j,bt]),CB=g.useCallback((R,H)=>{const se=Dm(R,H);return se!==!1&&os("smooth"),se},[Dm,os]);g.useEffect(()=>{if(Ph.current||!_e||sn!=="idle"||Mi||ie||Ic.length===0)return;const R=b6();if(!R||R.sessionId!==void 0&&R.sessionId!==xe.sessionId)return;y6(),Ph.current=!0;let H=!1;const se=window.setTimeout(()=>{var We;H=!0;try{Dm(R.text,R.images),(We=R.onComplete)==null||We.call(R)}finally{Ph.current=!1}},0);return()=>{H||(nr.current=[R,...nr.current],ha(nr.current)),window.clearTimeout(se),Ph.current=!1}},[_e,xe.sessionId,Mi,Dm,ie,b6,y6,Ic,sn]);const N6=g.useCallback((R,H,se)=>{Ee.submitPermission(R,H,se).catch(We=>{lt(We,"Failed to submit permission choice")})},[Ee,lt]),Eb=g.useCallback(()=>{Ee.cancel().catch(R=>{lt(R,"Failed to cancel request")})},[Ee,lt]),AB=g.useCallback(()=>{var R;return Mi?!1:((R=bs.current)==null?void 0:R.focusTaskPill())??!1},[Mi]),EB=g.useCallback(R=>{var H,se;if(R){(H=or.current)==null||H.insertText(R);return}(se=or.current)==null||se.focus()},[]),MB=g.useCallback(R=>{oa(!R)},[]),Mb=g.useCallback(()=>{ae.current&&_e&&Ei.current==="idle"&&vo.current&&ol.current?(al.current=vo.current,le(!1),gn(ol.current,Uu.current,{optimisticUserMessage:!1,retry:!0}).catch(R=>lt(R,"Failed to retry prompt"))):ue.dispatch([{type:"status",text:j("retry.none")}])},[_e,gn,lt,ue,j]);g.useEffect(()=>{const R=H=>{if(!Mi&&H.ctrlKey&&!H.metaKey&&!H.altKey&&!H.shiftKey){if(H.key==="l"){H.preventDefault(),T6();return}if(H.key==="o"){H.preventDefault(),C6();return}if(H.key==="y"){H.preventDefault(),Mb();return}}};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[Mi,T6,C6,Mb,ue,j]),g.useEffect(()=>{const R=()=>{zh.current=0,gb(!1),da.current&&(clearTimeout(da.current),da.current=null)},H=se=>{var We,Ze;if(!(se.defaultPrevented||se.isComposing)){if(se.key!=="Escape"){zh.current>0&&R(),se.key==="Tab"&&se.shiftKey&&!Mi&&(se.preventDefault(),Cb());return}if(!(ie||Mi)){if(kb()){se.preventDefault(),R();return}if((We=or.current)!=null&&We.hasInput()){se.preventDefault(),zh.current===0?(zh.current=1,gb(!0),da.current&&clearTimeout(da.current),da.current=setTimeout(()=>{R()},500)):((Ze=or.current)==null||Ze.clear(),R());return}if(sn!=="idle"){se.preventDefault(),Eb(),R();return}}}};return window.addEventListener("keydown",H),()=>{window.removeEventListener("keydown",H),zh.current=0,gb(!1),da.current&&(clearTimeout(da.current),da.current=null)}},[sn,Eb,Cb,ie,Mi,kb]);const NB=!_e||xe.catchingUp,Nb=g.useCallback(R=>{Ee.setModel(R).then(H=>{const se=I7e(H);wb((se==null?void 0:se.modelId)??R),se&&ue.dispatch({type:"debug",text:R7e(se),source:"model_switch_summary",data:se})}).catch(H=>{lt(H,j("model.switch"))})},[Ee,ue,lt,j]),IB=g.useCallback(R=>{if(sn!=="idle"){ar(`/model --fast ${R}`);return}gn(`/model --fast ${R}`).catch(H=>{lt(H,"Failed to switch fast model")})},[ar,gn,sn,lt]),RB=g.useCallback(R=>{if(sn!=="idle"){ar(`/model --voice ${R}`);return}gn(`/model --voice ${R}`).catch(H=>{lt(H,j("model.setVoice"))})},[ar,gn,sn,lt,j]),I6=g.useMemo(()=>{const R=new Set(xe.skills??[]);return I8e(xe.commands??[],N8e(j)).filter(H=>!Vh.has(rx(H.name))).map(H=>R.has(H.name)?{...H,displayCategory:"skill",description:H.description||j("skills.run")}:H)},[xe.commands,xe.skills,Vh,j]),Wh=g.useMemo(()=>{var R;return{version:((R=xe.capabilities)==null?void 0:R.qwenCodeVersion)||"",cwd:xe.workspaceCwd||"",currentModel:Wu,currentMode:cl,hideTips:(Ku==null?void 0:Ku.values.effective)===!0}},[(D6=xe.capabilities)==null?void 0:D6.qwenCodeVersion,xe.workspaceCwd,Wu,cl,Ku==null?void 0:Ku.values.effective]),jB=g.useMemo(()=>p?p(Wh):h.jsx(Rxe,{...Wh}),[p,Wh]),R6=g.useMemo(()=>y==null?void 0:y(Wh),[y,Wh]),ul=ut.length===0&&!xo&&!ie&&!W,j6=ul?Cg():V,LB=QO(w),DB=[an.app,an.appChat,ul?an.appChatEmpty:void 0,B.enabled?an.appWithSidebar:void 0,bb===ds.Light?an.themeLight:an.themeDark,i].filter(Boolean).join(" "),OB=g.useMemo(()=>({...o,...k7e(j6,w)}),[w,j6,o]),L6=g.useCallback(R=>{X(R),_7e(R)},[]);return g.useLayoutEffect(()=>{const R=sl.current;if(!R)return;const H=aa.current,se=la.current,We=R.getBoundingClientRect();if(se&&!ul&&H){const Ze=H.top-We.top;Math.abs(Ze)>1&&(R.style.transition="width 320ms ease",R.style.transform=`translateY(${Ze}px)`,requestAnimationFrame(()=>{R.style.transition="width 320ms ease, transform 280ms ease",R.style.transform=""}),window.setTimeout(()=>{R.style.transition=""},320))}aa.current=We,la.current=ul},[ul]),h.jsx(TH,{value:bb,children:h.jsx(fH,{language:te,children:h.jsxs("div",{className:DB,style:OB,"data-web-shell-root":!0,children:[!M&&h.jsx(dxe,{toasts:vt,onDismiss:Gt}),Pn&&h.jsx(Qr,{title:j("resume.title"),size:"lg",onClose:()=>er(!1),children:h.jsx(Hxe,{onSelect:R=>{Ee.loadSession(R).catch(H=>{lt(H,"Failed to load session")})},onClose:()=>er(!1)})}),_t&&h.jsx(Qr,{title:j(_t==="fast"?"model.setFast":_t==="voice"?"model.setVoice":"model.select"),size:"lg",onClose:()=>en(null),children:h.jsx(Twe,{mode:_t,models:_t==="voice"?Pt:void 0,currentModelId:_t==="voice"?gB:void 0,onSelect:R=>{_t==="fast"?IB(R):_t==="voice"?RB(R):Nb(R),en(null)}})}),xs&&h.jsx(Qr,{title:j("mode.select"),size:"sm",onClose:()=>fr(!1),children:h.jsx(Pxe,{currentMode:cl,onSelect:R=>{Rc(R),fr(!1)}})}),_n&&h.jsx(Qr,{title:j("tools.title"),size:"lg",onClose:()=>tr(!1),children:h.jsx(j3e,{})}),Kr&&h.jsx(Qr,{title:j("extensions.manage.title"),size:"lg",onClose:()=>so(!1),children:h.jsx(B3e,{})}),ua&&h.jsx(Qr,{title:j("mcp.manageServers"),size:"lg",onClose:()=>ll(null),children:h.jsx(LSe,{message:ua,onClose:()=>ll(null)})}),yb&&h.jsx(Qr,{title:j("tasks.title"),size:"lg",onClose:()=>Cm(null),children:h.jsx(Yj,{message:yb,embedded:!0,manageActiveEvent:!1,onClose:()=>Cm(null)})}),$h&&h.jsx(Qr,{title:j($h==="manage"?"agent.manage":$h==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>pb(null),children:h.jsx($ve,{mode:$h,embedded:!0,onMessage:R=>ue.dispatch([{type:"status",text:R}]),onClose:()=>pb(null)})}),Bh&&h.jsx(Qr,{title:j("settings.title"),size:"lg",onClose:()=>Nc(!1),children:h.jsx(k5e,{settingsState:v6,embedded:!0,onLanguageChange:bB,onThemeChange:Mm,chatWidthMode:V,onChatWidthModeChange:L6,onSubDialog:R=>{Nc(!1),R==="fastModel"?en("fast"):R==="tools.approvalMode"&&fr(!0)}})}),Vu&&h.jsx(Qr,{title:j("memory.menu"),size:"lg",onClose:()=>Sm(!1),children:h.jsx(s3e,{refreshSignal:tB,addSignal:rB,addScope:iB,onMessage:(R,H="status")=>{ue.dispatch([{type:H,text:R}])}})}),At&&h.jsx(Qr,{title:j("help.title"),size:"md",onClose:()=>Lt(!1),children:h.jsx(r6e,{commands:I6})}),qt&&h.jsx(Qr,{title:j("theme.title"),size:"sm",onClose:()=>Ht(!1),children:h.jsx(s6e,{currentTheme:bb,onSelect:Mm,onClose:()=>Ht(!1)})}),Tm&&h.jsx(Qr,{title:j("auth.title"),size:"lg",onClose:()=>mb(!1),children:h.jsx(I3e,{onMessage:(R,H="status")=>{ue.dispatch([H==="error"?{type:"error",text:R}:{type:"status",text:R}])},onClose:()=>mb(!1)})}),_o&&h.jsx(Qr,{title:j("delete.title"),size:"lg",onClose:()=>Oh(!1),children:h.jsx(i6e,{onDeleted:R=>{ue.dispatch([{type:"status",text:R.length===1?`${j("delete.deleted")} (${R[0].slice(0,8)})`:j("delete.deletedCount",{count:R.length})}])},onError:R=>{if(nd(R))return;const H=R instanceof Error?R.message:String(R);Tt("error",j("delete.failed",{reason:H}))},onClose:()=>Oh(!1)})}),Mc&&h.jsx(Qr,{title:j("release.title"),size:"lg",onClose:()=>Hu(!1),children:h.jsx(o6e,{onReleased:R=>{ue.dispatch([{type:"status",text:`${j("release.released")} (${R.slice(0,8)})`}])},onError:R=>{if(nd(R))return;const H=R instanceof Error?R.message:String(R);Tt("error",j("release.failed",{reason:H}))},onClose:()=>Hu(!1)})}),we&&h.jsx(Qr,{title:j("rewind.title"),subtitle:j("rewind.subtitle"),size:"lg",onClose:()=>xt(!1),children:h.jsx(b6e,{blocks:rt,loadSnapshots:_B,rewind:kB,onError:SB,onClose:()=>xt(!1)})}),h.jsxs("div",{className:an.appShell,children:[B.enabled&&h.jsx(M8e,{collapsed:I,onCollapsedChange:Ne,onOpenSettings:()=>Nc(!0),onNewSession:jm,onLoadSession:vB,onError:lt}),h.jsx("div",{className:an.chatPane,children:h.jsxs(lH,{value:Ce,children:[h.jsx(Dh.Provider,{value:Sb,children:h.jsx(u7e,{timeline:Ut,details:to,children:h.jsxs("div",{className:[an.content,xo||ut.length>0||ie?an.contentHasMessages:void 0].filter(Boolean).join(" "),children:[h.jsx(Jfe,{ref:zt,messages:ut,pendingApproval:mt,onShowContextDetail:xB,catchingUp:xe.catchingUp,isResponding:sn!=="idle",activeTurnStartedAt:il,workspaceCwd:xe.workspaceCwd||"",shellOutputMaxLines:yB,showRetryHint:Q,onRetryClick:Mb,onBranchSession:wB,welcomeHeader:ul?jB:void 0,tailContent:void 0,tailKey:void 0,onFollowStateChange:MB,virtualScrollThreshold:L}),(W==null?void 0:W.role)==="btw"&&h.jsx("div",{className:an.btwPanel,children:h.jsx(aL,{question:W.question,answer:W.answer,isPending:W.isPending})})]})})}),h.jsxs("div",{ref:sl,className:an.footer,children:[Os&&h.jsx("div",{className:xo?`${an.scrollToBottomLayer} ${an.scrollToBottomLayerWithTodos}`:an.scrollToBottomLayer,children:h.jsx("button",{type:"button",className:an.scrollToBottomButton,"aria-label":j("chat.scrollToBottom"),onClick:()=>os("smooth"),children:h.jsx("svg",{className:an.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),xo&&h.jsx("div",{className:an.bottomPanels,children:h.jsx(Axe,{todos:ti})}),mt&&h.jsx("div",{className:an.approvalOverlay,children:h.jsx(X5e,{request:mt,onConfirm:N6,variant:"floating"})}),Ve&&h.jsx("div",{className:an.approvalOverlay,children:h.jsx(T_e,{request:Ve,onConfirm:N6,variant:"floating"})}),h.jsxs("div",{className:an.composer,children:[h.jsx(txe,{startedAt:il}),h.jsx(z7e,{prompts:Ic,t:j,onDelete:hB,onInsert:fB,onEdit:mB}),h.jsx(y4e,{ref:wo,onSubmit:CB,onCycleMode:Cb,onToggleShortcuts:w6,onCancel:Eb,isRunning:sn!=="idle",disabled:NB||ie!==null,commands:I6,skills:yt,slashCommandCategoryOrder:f,queuedMessages:cB,onFocusFooter:AB,onPopQueuedMessages:pB,onClearQueuedMessages:kb,currentMode:cl,currentModel:Wu,chatWidthMode:V,showChatWidthToggle:!ul,chatWidthToggleMin:LB,visibleToolbarActions:T,availableModels:uB,onSelectMode:Rc,onSelectModel:Nb,onChatWidthModeChange:L6,sessionName:lB,dialogOpen:Mi,followupState:Ai,onAcceptFollowup:Cc,onDismissFollowup:ro,composerInput:J,composerInputVersion:P,placeholderText:!_e||xe.catchingUp?j("common.loading"):j(sn!=="idle"?"editor.processing":"editor.placeholder")})]}),ze?h.jsx(ze,{connected:_e,mode:cl,model:Wu,streamingState:sn,contextUsageRatio:(xe.contextWindow??0)>0?(xe.tokenCount??0)/(xe.contextWindow??0):0,activeGoal:Ti,tasks:zn,availableModes:Up,availableModels:(xe.models??[]).filter(FC).map(R=>({id:R.id,label:X1(R.label||R.id),contextWindow:R.contextWindow})),skills:yt,onSelectMode:Rc,onSelectModel:Nb}):h.jsx(H4e,{escapeHint:aB,onSelectMode:()=>fr(R=>!R),onSelectModel:()=>en(R=>R?null:"main"),onShowContext:()=>Hh("/context",!1),onOpenSettings:()=>Nc(!0),ref:bs,onOpenTasks:()=>Ab(),onReturnToInput:EB,tasks:In,activeGoal:Ti,hideSettings:TB,onToggleShortcuts:w6,compact:!0}),ul&&R6&&h.jsx("div",{className:an.emptyWelcomeFooter,children:R6})]})]})})]})]})})})}const GC={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:"重试"}},q7e={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},F7e={margin:0,fontSize:"1rem",fontWeight:600},U7e={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},H7e={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 V7e({error:e,onRetry:t,language:n="en"}){const r=GC[n]??GC.en;return h.jsxs("div",{role:"alert",style:q7e,"data-web-shell-error":!0,children:[h.jsx("p",{style:F7e,children:r.title}),h.jsx("p",{style:U7e,children:r.body}),!1,h.jsx("button",{type:"button",style:H7e,onClick:t,children:r.retry})]})}function W7e(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?Y7e(e):""}let Hp;function G7e(){return Hp||(typeof window>"u"?void 0:(Hp=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,Hp))}function K7e(){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 r=n.toString();e.hash=r?`#${r}`:"",t=!0}}t&&window.history.replaceState(null,"",e)}function Y7e(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 s=window.location.port||(window.location.protocol==="https:"?"443":"80");return(t.port||(t.protocol==="https:"?"443":"80"))!==s?"":t.origin}catch{return""}}const X7e=W7e(),Q7e=G7e();K7e();const JO="qwen-code-web-shell-language",ZO="qwen-code-web-shell-theme";function eB(e){if(e===ds.Dark||e===ds.Light)return e}function J7e(){const e=new URLSearchParams(window.location.search).get("theme");return eB(e)}function Z7e(){try{return eB(window.localStorage.getItem(ZO))}catch{return}}function e9e(e){try{window.localStorage.setItem(ZO,e)}catch{}}function t9e(){return J7e()??Z7e()??ds.Dark}function n9e(){try{const e=window.localStorage.getItem(JO);return e?Yl(e):void 0}catch{return}}function r9e(e){try{window.localStorage.setItem(JO,e)}catch{}}function s9e(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Yl(t||(n9e()??navigator.language))}function i9e(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function o9e(){const[e,t]=g.useState(()=>t9e()),[n,r]=g.useState(()=>s9e()),[s]=g.useState(()=>i9e()),i=X7e||window.location.origin,o=g.useCallback(l=>{t(l),e9e(l)},[]),a=g.useCallback(l=>{r(l),r9e(l)},[]);return h.jsx(RN,{label:"web-shell-root",fallback:(l,c)=>h.jsx(V7e,{error:l,onRetry:c,language:n}),children:h.jsx(aU,{baseUrl:i,token:Q7e,children:h.jsx(vU,{initialSessionId:s,suppressOwnUserEcho:!0,children:h.jsx(P7e,{theme:e,onThemeChange:o,language:n,onLanguageChange:a,sidebar:!0,compactThinking:!0})},s??"new")})})}OP.createRoot(document.getElementById("root")).render(h.jsx(r$.StrictMode,{children:h.jsx(o9e,{})}));export{q as _,Ag as c,J1 as g,u9e as k};
