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 FP=Object.defineProperty;var qP=(e,t,n)=>t in e?FP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var le=(e,t,n)=>qP(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 $g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zA={exports:{}},uy={};/**
 * @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 UP=Symbol.for("react.transitional.element"),HP=Symbol.for("react.fragment");function FA(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:UP,type:e,key:r,ref:t!==void 0?t:null,props:n}}uy.Fragment=HP;uy.jsx=FA;uy.jsxs=FA;zA.exports=uy;var h=zA.exports,qA={exports:{}},Xt={};/**
 * @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 M3=Symbol.for("react.transitional.element"),VP=Symbol.for("react.portal"),WP=Symbol.for("react.fragment"),GP=Symbol.for("react.strict_mode"),KP=Symbol.for("react.profiler"),YP=Symbol.for("react.consumer"),XP=Symbol.for("react.context"),QP=Symbol.for("react.forward_ref"),JP=Symbol.for("react.suspense"),ZP=Symbol.for("react.memo"),UA=Symbol.for("react.lazy"),e$=Symbol.for("react.activity"),w6=Symbol.iterator;function t$(e){return e===null||typeof e!="object"?null:(e=w6&&e[w6]||e["@@iterator"],typeof e=="function"?e:null)}var HA={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},VA=Object.assign,WA={};function Ch(e,t,n){this.props=e,this.context=t,this.refs=WA,this.updater=n||HA}Ch.prototype.isReactComponent={};Ch.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")};Ch.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function GA(){}GA.prototype=Ch.prototype;function I3(e,t,n){this.props=e,this.context=t,this.refs=WA,this.updater=n||HA}var N3=I3.prototype=new GA;N3.constructor=I3;VA(N3,Ch.prototype);N3.isPureReactComponent=!0;var v6=Array.isArray;function _4(){}var rr={H:null,A:null,T:null,S:null},KA=Object.prototype.hasOwnProperty;function R3(e,t,n){var r=n.ref;return{$$typeof:M3,type:e,key:t,ref:r!==void 0?r:null,props:n}}function n$(e,t){return R3(e.type,t,e.props)}function L3(e){return typeof e=="object"&&e!==null&&e.$$typeof===M3}function r$(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var x6=/\/+/g;function Ub(e,t){return typeof e=="object"&&e!==null&&e.key!=null?r$(""+e.key):t.toString(36)}function s$(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(_4,_4):(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 fd(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 M3:case VP:o=!0;break;case UA:return o=e._init,fd(o(e._payload),t,n,r,s)}}if(o)return s=s(e),o=r===""?"."+Ub(e,0):r,v6(s)?(n="",o!=null&&(n=o.replace(x6,"$&/")+"/"),fd(s,t,n,"",function(c){return c})):s!=null&&(L3(s)&&(s=n$(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(x6,"$&/")+"/")+o)),t.push(s)),1;o=0;var a=r===""?".":r+":";if(v6(e))for(var l=0;l<e.length;l++)r=e[l],i=a+Ub(r,l),o+=fd(r,t,n,i,s);else if(l=t$(e),typeof l=="function")for(e=l.call(e),l=0;!(r=e.next()).done;)r=r.value,i=a+Ub(r,l++),o+=fd(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return fd(s$(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 K0(e,t,n){if(e==null)return e;var r=[],s=0;return fd(e,r,"","",function(i){return t.call(n,i,s++)}),r}function i$(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 _6=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)},o$={map:K0,forEach:function(e,t,n){K0(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return K0(e,function(){t++}),t},toArray:function(e){return K0(e,function(t){return t})||[]},only:function(e){if(!L3(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Xt.Activity=e$;Xt.Children=o$;Xt.Component=Ch;Xt.Fragment=WP;Xt.Profiler=KP;Xt.PureComponent=I3;Xt.StrictMode=GP;Xt.Suspense=JP;Xt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=rr;Xt.__COMPILER_RUNTIME={__proto__:null,c:function(e){return rr.H.useMemoCache(e)}};Xt.cache=function(e){return function(){return e.apply(null,arguments)}};Xt.cacheSignal=function(){return null};Xt.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=VA({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!KA.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 R3(e.type,s,r)};Xt.createContext=function(e){return e={$$typeof:XP,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:YP,_context:e},e};Xt.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)KA.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 R3(e,i,s)};Xt.createRef=function(){return{current:null}};Xt.forwardRef=function(e){return{$$typeof:QP,render:e}};Xt.isValidElement=L3;Xt.lazy=function(e){return{$$typeof:UA,_payload:{_status:-1,_result:e},_init:i$}};Xt.memo=function(e,t){return{$$typeof:ZP,type:e,compare:t===void 0?null:t}};Xt.startTransition=function(e){var t=rr.T,n={};rr.T=n;try{var r=e(),s=rr.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(_4,_6)}catch(i){_6(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),rr.T=t}};Xt.unstable_useCacheRefresh=function(){return rr.H.useCacheRefresh()};Xt.use=function(e){return rr.H.use(e)};Xt.useActionState=function(e,t,n){return rr.H.useActionState(e,t,n)};Xt.useCallback=function(e,t){return rr.H.useCallback(e,t)};Xt.useContext=function(e){return rr.H.useContext(e)};Xt.useDebugValue=function(){};Xt.useDeferredValue=function(e,t){return rr.H.useDeferredValue(e,t)};Xt.useEffect=function(e,t){return rr.H.useEffect(e,t)};Xt.useEffectEvent=function(e){return rr.H.useEffectEvent(e)};Xt.useId=function(){return rr.H.useId()};Xt.useImperativeHandle=function(e,t,n){return rr.H.useImperativeHandle(e,t,n)};Xt.useInsertionEffect=function(e,t){return rr.H.useInsertionEffect(e,t)};Xt.useLayoutEffect=function(e,t){return rr.H.useLayoutEffect(e,t)};Xt.useMemo=function(e,t){return rr.H.useMemo(e,t)};Xt.useOptimistic=function(e,t){return rr.H.useOptimistic(e,t)};Xt.useReducer=function(e,t,n){return rr.H.useReducer(e,t,n)};Xt.useRef=function(e){return rr.H.useRef(e)};Xt.useState=function(e){return rr.H.useState(e)};Xt.useSyncExternalStore=function(e,t,n){return rr.H.useSyncExternalStore(e,t,n)};Xt.useTransition=function(){return rr.H.useTransition()};Xt.version="19.2.4";qA.exports=Xt;var g=qA.exports;const a$=cy(g);var YA={exports:{}},dy={},XA={exports:{}},QA={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(j,K){var J=j.length;j.push(K);e:for(;0<J;){var ee=J-1>>>1,N=j[ee];if(0<s(N,K))j[ee]=K,j[J]=N,J=ee;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var K=j[0],J=j.pop();if(J!==K){j[0]=J;e:for(var ee=0,N=j.length,q=N>>>1;ee<q;){var P=2*(ee+1)-1,E=j[P],ne=P+1,pe=j[ne];if(0>s(E,J))ne<N&&0>s(pe,E)?(j[ee]=pe,j[ne]=J,ee=ne):(j[ee]=E,j[P]=J,ee=P);else if(ne<N&&0>s(pe,J))j[ee]=pe,j[ne]=J,ee=ne;else break e}}return K}function s(j,K){var J=j.sortIndex-K.sortIndex;return J!==0?J:j.id-K.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,w=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function k(j){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=j)r(c),K.sortIndex=K.expirationTime,t(l,K);else break;K=n(c)}}function T(j){if(y=!1,k(j),!p)if(n(l)!==null)p=!0,A||(A=!0,I());else{var K=n(c);K!==null&&W(T,K.startTime-j)}}var A=!1,M=-1,D=5,O=-1;function C(){return v?!0:!(e.unstable_now()-O<D)}function L(){if(v=!1,A){var j=e.unstable_now();O=j;var K=!0;try{e:{p=!1,y&&(y=!1,w(M),M=-1),m=!0;var J=f;try{t:{for(k(j),d=n(l);d!==null&&!(d.expirationTime>j&&C());){var ee=d.callback;if(typeof ee=="function"){d.callback=null,f=d.priorityLevel;var N=ee(d.expirationTime<=j);if(j=e.unstable_now(),typeof N=="function"){d.callback=N,k(j),K=!0;break t}d===n(l)&&r(l),k(j)}else r(l);d=n(l)}if(d!==null)K=!0;else{var q=n(c);q!==null&&W(T,q.startTime-j),K=!1}}break e}finally{d=null,f=J,m=!1}K=void 0}}finally{K?I():A=!1}}}var I;if(typeof x=="function")I=function(){x(L)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,F=B.port2;B.port1.onmessage=L,I=function(){F.postMessage(null)}}else I=function(){b(L,0)};function W(j,K){M=b(function(){j(e.unstable_now())},K)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(j){switch(f){case 1:case 2:case 3:var K=3;break;default:K=f}var J=f;f=K;try{return j()}finally{f=J}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(j,K){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var J=f;f=j;try{return K()}finally{f=J}},e.unstable_scheduleCallback=function(j,K,J){var ee=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ee+J:ee):J=ee,j){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=J+N,j={id:u++,callback:K,priorityLevel:j,startTime:J,expirationTime:N,sortIndex:-1},J>ee?(j.sortIndex=J,t(c,j),n(l)===null&&j===n(c)&&(y?(w(M),M=-1):y=!0,W(T,J-ee))):(j.sortIndex=N,t(l,j),p||m||(p=!0,A||(A=!0,I()))),j},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(j){var K=f;return function(){var J=f;f=K;try{return j.apply(this,arguments)}finally{f=J}}}})(QA);XA.exports=QA;var l$=XA.exports,JA={exports:{}},ti={};/**
 * @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 c$=g;function ZA(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 Tl(){}var Qs={d:{f:Tl,r:function(){throw Error(ZA(522))},D:Tl,C:Tl,L:Tl,m:Tl,X:Tl,S:Tl,M:Tl},p:0,findDOMNode:null},u$=Symbol.for("react.portal");function d$(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u$,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var Gf=c$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function hy(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}ti.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Qs;ti.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(ZA(299));return d$(e,t,null,n)};ti.flushSync=function(e){var t=Gf.T,n=Qs.p;try{if(Gf.T=null,Qs.p=2,e)return e()}finally{Gf.T=t,Qs.p=n,Qs.d.f()}};ti.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,Qs.d.C(e,t))};ti.prefetchDNS=function(e){typeof e=="string"&&Qs.d.D(e)};ti.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=hy(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?Qs.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&Qs.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};ti.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=hy(t.as,t.crossOrigin);Qs.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&&Qs.d.M(e)};ti.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=hy(n,t.crossOrigin);Qs.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})}};ti.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=hy(t.as,t.crossOrigin);Qs.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 Qs.d.m(e)};ti.requestFormReset=function(e){Qs.d.r(e)};ti.unstable_batchedUpdates=function(e,t){return e(t)};ti.useFormState=function(e,t,n){return Gf.H.useFormState(e,t,n)};ti.useFormStatus=function(){return Gf.H.useHostTransitionStatus()};ti.version="19.2.4";function eE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eE)}catch(e){console.error(e)}}eE(),JA.exports=ti;var fy=JA.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 Zr=l$,tE=g,h$=fy;function ve(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 nE(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l0(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 rE(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 sE(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 k6(e){if(l0(e)!==e)throw Error(ve(188))}function f$(e){var t=e.alternate;if(!t){if(t=l0(e),t===null)throw Error(ve(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 k6(s),e;if(i===r)return k6(s),t;i=i.sibling}throw Error(ve(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(ve(189))}}if(n.alternate!==r)throw Error(ve(190))}if(n.tag!==3)throw Error(ve(188));return n.stateNode.current===n?e:t}function iE(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=iE(e),t!==null)return t;e=e.sibling}return null}var ir=Object.assign,m$=Symbol.for("react.element"),Y0=Symbol.for("react.transitional.element"),If=Symbol.for("react.portal"),vd=Symbol.for("react.fragment"),oE=Symbol.for("react.strict_mode"),k4=Symbol.for("react.profiler"),aE=Symbol.for("react.consumer"),Ka=Symbol.for("react.context"),j3=Symbol.for("react.forward_ref"),S4=Symbol.for("react.suspense"),T4=Symbol.for("react.suspense_list"),D3=Symbol.for("react.memo"),Ll=Symbol.for("react.lazy"),C4=Symbol.for("react.activity"),p$=Symbol.for("react.memo_cache_sentinel"),S6=Symbol.iterator;function sf(e){return e===null||typeof e!="object"?null:(e=S6&&e[S6]||e["@@iterator"],typeof e=="function"?e:null)}var g$=Symbol.for("react.client.reference");function A4(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===g$?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case vd:return"Fragment";case k4:return"Profiler";case oE:return"StrictMode";case S4:return"Suspense";case T4:return"SuspenseList";case C4:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case If:return"Portal";case Ka:return e.displayName||"Context";case aE:return(e._context.displayName||"Context")+".Consumer";case j3:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case D3:return t=e.displayName||null,t!==null?t:A4(e.type)||"Memo";case Ll:t=e._payload,e=e._init;try{return A4(e(t))}catch{}}return null}var Nf=Array.isArray,zt=tE.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,In=h$.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,mu={pending:!1,data:null,method:null,action:null},E4=[],xd=-1;function wa(e){return{current:e}}function fs(e){0>xd||(e.current=E4[xd],E4[xd]=null,xd--)}function er(e,t){xd++,E4[xd]=e.current,e.current=t}var ga=wa(null),Sm=wa(null),nc=wa(null),zg=wa(null);function Fg(e,t){switch(er(nc,t),er(Sm,e),er(ga,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?I8(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=I8(t),e=AI(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}fs(ga),er(ga,e)}function eh(){fs(ga),fs(Sm),fs(nc)}function M4(e){e.memoizedState!==null&&er(zg,e);var t=ga.current,n=AI(t,e.type);t!==n&&(er(Sm,e),er(ga,n))}function qg(e){Sm.current===e&&(fs(ga),fs(Sm)),zg.current===e&&(fs(zg),Dm._currentValue=mu)}var Hb,T6;function Yc(e){if(Hb===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Hb=t&&t[1]||"",T6=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Hb+e+T6}var Vb=!1;function Wb(e,t){if(!e||Vb)return"";Vb=!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{Vb=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Yc(n):""}function y$(e,t){switch(e.tag){case 26:case 27:case 5:return Yc(e.type);case 16:return Yc("Lazy");case 13:return e.child!==t&&t!==null?Yc("Suspense Fallback"):Yc("Suspense");case 19:return Yc("SuspenseList");case 0:case 15:return Wb(e.type,!1);case 11:return Wb(e.type.render,!1);case 1:return Wb(e.type,!0);case 31:return Yc("Activity");default:return""}}function C6(e){try{var t="",n=null;do t+=y$(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var I4=Object.prototype.hasOwnProperty,O3=Zr.unstable_scheduleCallback,Gb=Zr.unstable_cancelCallback,b$=Zr.unstable_shouldYield,w$=Zr.unstable_requestPaint,Bi=Zr.unstable_now,v$=Zr.unstable_getCurrentPriorityLevel,lE=Zr.unstable_ImmediatePriority,cE=Zr.unstable_UserBlockingPriority,Ug=Zr.unstable_NormalPriority,x$=Zr.unstable_LowPriority,uE=Zr.unstable_IdlePriority,_$=Zr.log,k$=Zr.unstable_setDisableYieldValue,c0=null,Pi=null;function Wl(e){if(typeof _$=="function"&&k$(e),Pi&&typeof Pi.setStrictMode=="function")try{Pi.setStrictMode(c0,e)}catch{}}var $i=Math.clz32?Math.clz32:C$,S$=Math.log,T$=Math.LN2;function C$(e){return e>>>=0,e===0?32:31-(S$(e)/T$|0)|0}var X0=256,Q0=262144,J0=4194304;function Xc(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 my(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=Xc(r):(o&=a,o!==0?s=Xc(o):n||(n=a&~e,n!==0&&(s=Xc(n))))):(a=r&~i,a!==0?s=Xc(a):o!==0?s=Xc(o):n||(n=r&~e,n!==0&&(s=Xc(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 u0(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function A$(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 dE(){var e=J0;return J0<<=1,!(J0&62914560)&&(J0=4194304),e}function Kb(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function d0(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function E$(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-$i(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&&hE(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function hE(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-$i(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function fE(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-$i(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}function mE(e,t){var n=t&-t;return n=n&42?1:B3(n),n&(e.suspendedLanes|t)?0:n}function B3(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 P3(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function pE(){var e=In.p;return e!==0?e:(e=window.event,e===void 0?32:PI(e.type))}function A6(e,t){var n=In.p;try{return In.p=e,t()}finally{In.p=n}}var Mc=Math.random().toString(36).slice(2),xs="__reactFiber$"+Mc,wi="__reactProps$"+Mc,Ah="__reactContainer$"+Mc,N4="__reactEvents$"+Mc,M$="__reactListeners$"+Mc,I$="__reactHandles$"+Mc,E6="__reactResources$"+Mc,h0="__reactMarker$"+Mc;function $3(e){delete e[xs],delete e[wi],delete e[N4],delete e[M$],delete e[I$]}function _d(e){var t=e[xs];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ah]||n[xs]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=D8(e);e!==null;){if(n=e[xs])return n;e=D8(e)}return t}e=n,n=e.parentNode}return null}function Eh(e){if(e=e[xs]||e[Ah]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Rf(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(ve(33))}function Pd(e){var t=e[E6];return t||(t=e[E6]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ds(e){e[h0]=!0}var gE=new Set,yE={};function Pu(e,t){th(e,t),th(e+"Capture",t)}function th(e,t){for(yE[e]=t,e=0;e<t.length;e++)gE.add(t[e])}var N$=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]*$"),M6={},I6={};function R$(e){return I4.call(I6,e)?!0:I4.call(M6,e)?!1:N$.test(e)?I6[e]=!0:(M6[e]=!0,!1)}function sg(e,t,n){if(R$(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 Z0(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 La(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 to(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function L$(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 R4(e){if(!e._valueTracker){var t=bE(e)?"checked":"value";e._valueTracker=L$(e,t,""+e[t])}}function wE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=bE(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Hg(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 j$=/[\n"\\]/g;function ao(e){return e.replace(j$,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function L4(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=""+to(t)):e.value!==""+to(t)&&(e.value=""+to(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?j4(e,o,to(t)):n!=null?j4(e,o,to(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=""+to(a):e.removeAttribute("name")}function vE(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)){R4(e);return}n=n!=null?""+to(n):"",t=t!=null?""+to(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),R4(e)}function j4(e,t,n){t==="number"&&Hg(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function $d(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=""+to(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 xE(e,t,n){if(t!=null&&(t=""+to(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+to(n):""}function _E(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(ve(92));if(Nf(r)){if(1<r.length)throw Error(ve(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=to(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),R4(e)}function nh(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var D$=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 N6(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||D$.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function kE(e,t,n){if(t!=null&&typeof t!="object")throw Error(ve(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&&N6(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&N6(e,i,t[i])}function z3(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 O$=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"]]),B$=/^[\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 ig(e){return B$.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ya(){}var D4=null;function F3(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var kd=null,zd=null;function R6(e){var t=Eh(e);if(t&&(e=t.stateNode)){var n=e[wi]||null;e:switch(e=t.stateNode,t.type){case"input":if(L4(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="'+ao(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[wi]||null;if(!s)throw Error(ve(90));L4(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&&wE(r)}break e;case"textarea":xE(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&$d(e,!!n.multiple,t,!1)}}}var Yb=!1;function SE(e,t,n){if(Yb)return e(t,n);Yb=!0;try{var r=e(t);return r}finally{if(Yb=!1,(kd!==null||zd!==null)&&(Cy(),kd&&(t=kd,e=zd,zd=kd=null,R6(t),e)))for(t=0;t<e.length;t++)R6(e[t])}}function Tm(e,t){var n=e.stateNode;if(n===null)return null;var r=n[wi]||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(ve(231,t,typeof n));return n}var ol=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),O4=!1;if(ol)try{var of={};Object.defineProperty(of,"passive",{get:function(){O4=!0}}),window.addEventListener("test",of,of),window.removeEventListener("test",of,of)}catch{O4=!1}var Gl=null,q3=null,og=null;function TE(){if(og)return og;var e,t=q3,n=t.length,r,s="value"in Gl?Gl.value:Gl.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 og=s.slice(e,1<r?1-r:void 0)}function ag(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 ep(){return!0}function L6(){return!1}function _i(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)?ep:L6,this.isPropagationStopped=L6,this}return ir(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=ep)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ep)},persist:function(){},isPersistent:ep}),t}var $u={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},py=_i($u),f0=ir({},$u,{view:0,detail:0}),P$=_i(f0),Xb,Qb,af,gy=ir({},f0,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:U3,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!==af&&(af&&e.type==="mousemove"?(Xb=e.screenX-af.screenX,Qb=e.screenY-af.screenY):Qb=Xb=0,af=e),Xb)},movementY:function(e){return"movementY"in e?e.movementY:Qb}}),j6=_i(gy),$$=ir({},gy,{dataTransfer:0}),z$=_i($$),F$=ir({},f0,{relatedTarget:0}),Jb=_i(F$),q$=ir({},$u,{animationName:0,elapsedTime:0,pseudoElement:0}),U$=_i(q$),H$=ir({},$u,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),V$=_i(H$),W$=ir({},$u,{data:0}),D6=_i(W$),G$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},K$={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"},Y$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function X$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Y$[e])?!!t[e]:!1}function U3(){return X$}var Q$=ir({},f0,{key:function(e){if(e.key){var t=G$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ag(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?K$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:U3,charCode:function(e){return e.type==="keypress"?ag(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ag(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),J$=_i(Q$),Z$=ir({},gy,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),O6=_i(Z$),ez=ir({},f0,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:U3}),tz=_i(ez),nz=ir({},$u,{propertyName:0,elapsedTime:0,pseudoElement:0}),rz=_i(nz),sz=ir({},gy,{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}),iz=_i(sz),oz=ir({},$u,{newState:0,oldState:0}),az=_i(oz),lz=[9,13,27,32],H3=ol&&"CompositionEvent"in window,Kf=null;ol&&"documentMode"in document&&(Kf=document.documentMode);var cz=ol&&"TextEvent"in window&&!Kf,CE=ol&&(!H3||Kf&&8<Kf&&11>=Kf),B6=" ",P6=!1;function AE(e,t){switch(e){case"keyup":return lz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function EE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sd=!1;function uz(e,t){switch(e){case"compositionend":return EE(t);case"keypress":return t.which!==32?null:(P6=!0,B6);case"textInput":return e=t.data,e===B6&&P6?null:e;default:return null}}function dz(e,t){if(Sd)return e==="compositionend"||!H3&&AE(e,t)?(e=TE(),og=q3=Gl=null,Sd=!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 CE&&t.locale!=="ko"?null:t.data;default:return null}}var hz={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 $6(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!hz[e.type]:t==="textarea"}function ME(e,t,n,r){kd?zd?zd.push(r):zd=[r]:kd=r,t=l1(t,"onChange"),0<t.length&&(n=new py("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Yf=null,Cm=null;function fz(e){SI(e,0)}function yy(e){var t=Rf(e);if(wE(t))return e}function z6(e,t){if(e==="change")return t}var IE=!1;if(ol){var Zb;if(ol){var e2="oninput"in document;if(!e2){var F6=document.createElement("div");F6.setAttribute("oninput","return;"),e2=typeof F6.oninput=="function"}Zb=e2}else Zb=!1;IE=Zb&&(!document.documentMode||9<document.documentMode)}function q6(){Yf&&(Yf.detachEvent("onpropertychange",NE),Cm=Yf=null)}function NE(e){if(e.propertyName==="value"&&yy(Cm)){var t=[];ME(t,Cm,e,F3(e)),SE(fz,t)}}function mz(e,t,n){e==="focusin"?(q6(),Yf=t,Cm=n,Yf.attachEvent("onpropertychange",NE)):e==="focusout"&&q6()}function pz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return yy(Cm)}function gz(e,t){if(e==="click")return yy(t)}function yz(e,t){if(e==="input"||e==="change")return yy(t)}function bz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ui=typeof Object.is=="function"?Object.is:bz;function Am(e,t){if(Ui(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(!I4.call(t,s)||!Ui(e[s],t[s]))return!1}return!0}function U6(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function H6(e,t){var n=U6(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=U6(n)}}function RE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?RE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function LE(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Hg(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=Hg(e.document)}return t}function V3(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 wz=ol&&"documentMode"in document&&11>=document.documentMode,Td=null,B4=null,Xf=null,P4=!1;function V6(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;P4||Td==null||Td!==Hg(r)||(r=Td,"selectionStart"in r&&V3(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}),Xf&&Am(Xf,r)||(Xf=r,r=l1(B4,"onSelect"),0<r.length&&(t=new py("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Td)))}function Fc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Cd={animationend:Fc("Animation","AnimationEnd"),animationiteration:Fc("Animation","AnimationIteration"),animationstart:Fc("Animation","AnimationStart"),transitionrun:Fc("Transition","TransitionRun"),transitionstart:Fc("Transition","TransitionStart"),transitioncancel:Fc("Transition","TransitionCancel"),transitionend:Fc("Transition","TransitionEnd")},t2={},jE={};ol&&(jE=document.createElement("div").style,"AnimationEvent"in window||(delete Cd.animationend.animation,delete Cd.animationiteration.animation,delete Cd.animationstart.animation),"TransitionEvent"in window||delete Cd.transitionend.transition);function zu(e){if(t2[e])return t2[e];if(!Cd[e])return e;var t=Cd[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jE)return t2[e]=t[n];return e}var DE=zu("animationend"),OE=zu("animationiteration"),BE=zu("animationstart"),vz=zu("transitionrun"),xz=zu("transitionstart"),_z=zu("transitioncancel"),PE=zu("transitionend"),$E=new Map,$4="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(" ");$4.push("scrollEnd");function Oo(e,t){$E.set(e,t),Pu(t,[e])}var Vg=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)},eo=[],Ad=0,W3=0;function by(){for(var e=Ad,t=W3=Ad=0;t<e;){var n=eo[t];eo[t++]=null;var r=eo[t];eo[t++]=null;var s=eo[t];eo[t++]=null;var i=eo[t];if(eo[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&&zE(n,s,i)}}function wy(e,t,n,r){eo[Ad++]=e,eo[Ad++]=t,eo[Ad++]=n,eo[Ad++]=r,W3|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function G3(e,t,n,r){return wy(e,t,n,r),Wg(e)}function Fu(e,t){return wy(e,null,null,t),Wg(e)}function zE(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-$i(n),e=i.hiddenUpdates,r=e[s],r===null?e[s]=[t]:r.push(t),t.lane=n|536870912),i):null}function Wg(e){if(50<im)throw im=0,ov=null,Error(ve(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ed={};function kz(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 Li(e,t,n,r){return new kz(e,t,n,r)}function K3(e){return e=e.prototype,!(!e||!e.isReactComponent)}function el(e,t){var n=e.alternate;return n===null?(n=Li(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 FE(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 lg(e,t,n,r,s,i){var o=0;if(r=e,typeof e=="function")K3(e)&&(o=1);else if(typeof e=="string")o=EF(e,n,ga.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case C4:return e=Li(31,n,t,s),e.elementType=C4,e.lanes=i,e;case vd:return pu(n.children,s,i,t);case oE:o=8,s|=24;break;case k4:return e=Li(12,n,t,s|2),e.elementType=k4,e.lanes=i,e;case S4:return e=Li(13,n,t,s),e.elementType=S4,e.lanes=i,e;case T4:return e=Li(19,n,t,s),e.elementType=T4,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ka:o=10;break e;case aE:o=9;break e;case j3:o=11;break e;case D3:o=14;break e;case Ll:o=16,r=null;break e}o=29,n=Error(ve(130,e===null?"null":typeof e,"")),r=null}return t=Li(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function pu(e,t,n,r){return e=Li(7,e,r,t),e.lanes=n,e}function n2(e,t,n){return e=Li(6,e,null,t),e.lanes=n,e}function qE(e){var t=Li(18,null,null,0);return t.stateNode=e,t}function r2(e,t,n){return t=Li(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var W6=new WeakMap;function lo(e,t){if(typeof e=="object"&&e!==null){var n=W6.get(e);return n!==void 0?n:(t={value:e,source:t,stack:C6(t)},W6.set(e,t),t)}return{value:e,source:t,stack:C6(t)}}var Md=[],Id=0,Gg=null,Em=0,no=[],ro=0,mc=null,ca=1,ua="";function qa(e,t){Md[Id++]=Em,Md[Id++]=Gg,Gg=e,Em=t}function UE(e,t,n){no[ro++]=ca,no[ro++]=ua,no[ro++]=mc,mc=e;var r=ca;e=ua;var s=32-$i(r)-1;r&=~(1<<s),n+=1;var i=32-$i(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,ca=1<<32-$i(t)+s|n<<s|r,ua=i+e}else ca=1<<i|n<<s|r,ua=e}function Y3(e){e.return!==null&&(qa(e,1),UE(e,1,0))}function X3(e){for(;e===Gg;)Gg=Md[--Id],Md[Id]=null,Em=Md[--Id],Md[Id]=null;for(;e===mc;)mc=no[--ro],no[ro]=null,ua=no[--ro],no[ro]=null,ca=no[--ro],no[ro]=null}function HE(e,t){no[ro++]=ca,no[ro++]=ua,no[ro++]=mc,ca=t.id,ua=t.overflow,mc=e}var _s=null,nr=null,yn=!1,rc=null,co=!1,z4=Error(ve(519));function pc(e){var t=Error(ve(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mm(lo(t,e)),z4}function G6(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[xs]=e,t[wi]=r,n){case"dialog":cn("cancel",t),cn("close",t);break;case"iframe":case"object":case"embed":cn("load",t);break;case"video":case"audio":for(n=0;n<Lm.length;n++)cn(Lm[n],t);break;case"source":cn("error",t);break;case"img":case"image":case"link":cn("error",t),cn("load",t);break;case"details":cn("toggle",t);break;case"input":cn("invalid",t),vE(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":cn("invalid",t);break;case"textarea":cn("invalid",t),_E(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||CI(t.textContent,n)?(r.popover!=null&&(cn("beforetoggle",t),cn("toggle",t)),r.onScroll!=null&&cn("scroll",t),r.onScrollEnd!=null&&cn("scrollend",t),r.onClick!=null&&(t.onclick=Ya),t=!0):t=!1,t||pc(e,!0)}function K6(e){for(_s=e.return;_s;)switch(_s.tag){case 5:case 31:case 13:co=!1;return;case 27:case 3:co=!0;return;default:_s=_s.return}}function od(e){if(e!==_s)return!1;if(!yn)return K6(e),yn=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||dv(e.type,e.memoizedProps)),n=!n),n&&nr&&pc(e),K6(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ve(317));nr=j8(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ve(317));nr=j8(e)}else t===27?(t=nr,Ic(e.type)?(e=pv,pv=null,nr=e):nr=t):nr=_s?go(e.stateNode.nextSibling):null;return!0}function Tu(){nr=_s=null,yn=!1}function s2(){var e=rc;return e!==null&&(di===null?di=e:di.push.apply(di,e),rc=null),e}function Mm(e){rc===null?rc=[e]:rc.push(e)}var F4=wa(null),qu=null,Xa=null;function zl(e,t,n){er(F4,t._currentValue),t._currentValue=n}function tl(e){e._currentValue=F4.current,fs(F4)}function q4(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 U4(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),q4(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(ve(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),q4(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 Mh(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(ve(387));if(o=o.memoizedProps,o!==null){var a=s.type;Ui(s.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(s===zg.current){if(o=s.alternate,o===null)throw Error(ve(387));o.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(Dm):e=[Dm])}s=s.return}e!==null&&U4(t,e,n,r),t.flags|=262144}function Kg(e){for(e=e.firstContext;e!==null;){if(!Ui(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Cu(e){qu=e,Xa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ks(e){return VE(qu,e)}function tp(e,t){return qu===null&&Cu(e),VE(e,t)}function VE(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Xa===null){if(e===null)throw Error(ve(308));Xa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xa=Xa.next=t;return n}var Sz=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()})}},Tz=Zr.unstable_scheduleCallback,Cz=Zr.unstable_NormalPriority,Br={$$typeof:Ka,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Q3(){return{controller:new Sz,data:new Map,refCount:0}}function m0(e){e.refCount--,e.refCount===0&&Tz(Cz,function(){e.controller.abort()})}var Qf=null,H4=0,rh=0,Fd=null;function Az(e,t){if(Qf===null){var n=Qf=[];H4=0,rh=__(),Fd={status:"pending",value:void 0,then:function(r){n.push(r)}}}return H4++,t.then(Y6,Y6),t}function Y6(){if(--H4===0&&Qf!==null){Fd!==null&&(Fd.status="fulfilled");var e=Qf;Qf=null,rh=0,Fd=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ez(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 X6=zt.S;zt.S=function(e,t){iI=Bi(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Az(e,t),X6!==null&&X6(e,t)};var gu=wa(null);function J3(){var e=gu.current;return e!==null?e:Gn.pooledCache}function cg(e,t){t===null?er(gu,gu.current):er(gu,t.pool)}function WE(){var e=J3();return e===null?null:{parent:Br._currentValue,pool:e}}var Ih=Error(ve(460)),Z3=Error(ve(474)),vy=Error(ve(542)),Yg={then:function(){}};function Q6(e){return e=e.status,e==="fulfilled"||e==="rejected"}function GE(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ya,Ya),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Z6(e),e;default:if(typeof t.status=="string")t.then(Ya,Ya);else{if(e=Gn,e!==null&&100<e.shellSuspendCounter)throw Error(ve(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,Z6(e),e}throw yu=t,Ih}}function Qc(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(yu=n,Ih):n}}var yu=null;function J6(){if(yu===null)throw Error(ve(459));var e=yu;return yu=null,e}function Z6(e){if(e===Ih||e===vy)throw Error(ve(483))}var qd=null,Im=0;function np(e){var t=Im;return Im+=1,qd===null&&(qd=[]),GE(qd,e,t)}function lf(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function rp(e,t){throw t.$$typeof===m$?Error(ve(525)):(e=Object.prototype.toString.call(t),Error(ve(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function KE(e){function t(b,w){if(e){var x=b.deletions;x===null?(b.deletions=[w],b.flags|=16):x.push(w)}}function n(b,w){if(!e)return null;for(;w!==null;)t(b,w),w=w.sibling;return null}function r(b){for(var w=new Map;b!==null;)b.key!==null?w.set(b.key,b):w.set(b.index,b),b=b.sibling;return w}function s(b,w){return b=el(b,w),b.index=0,b.sibling=null,b}function i(b,w,x){return b.index=x,e?(x=b.alternate,x!==null?(x=x.index,x<w?(b.flags|=67108866,w):x):(b.flags|=67108866,w)):(b.flags|=1048576,w)}function o(b){return e&&b.alternate===null&&(b.flags|=67108866),b}function a(b,w,x,k){return w===null||w.tag!==6?(w=n2(x,b.mode,k),w.return=b,w):(w=s(w,x),w.return=b,w)}function l(b,w,x,k){var T=x.type;return T===vd?u(b,w,x.props.children,k,x.key):w!==null&&(w.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ll&&Qc(T)===w.type)?(w=s(w,x.props),lf(w,x),w.return=b,w):(w=lg(x.type,x.key,x.props,null,b.mode,k),lf(w,x),w.return=b,w)}function c(b,w,x,k){return w===null||w.tag!==4||w.stateNode.containerInfo!==x.containerInfo||w.stateNode.implementation!==x.implementation?(w=r2(x,b.mode,k),w.return=b,w):(w=s(w,x.children||[]),w.return=b,w)}function u(b,w,x,k,T){return w===null||w.tag!==7?(w=pu(x,b.mode,k,T),w.return=b,w):(w=s(w,x),w.return=b,w)}function d(b,w,x){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=n2(""+w,b.mode,x),w.return=b,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Y0:return x=lg(w.type,w.key,w.props,null,b.mode,x),lf(x,w),x.return=b,x;case If:return w=r2(w,b.mode,x),w.return=b,w;case Ll:return w=Qc(w),d(b,w,x)}if(Nf(w)||sf(w))return w=pu(w,b.mode,x,null),w.return=b,w;if(typeof w.then=="function")return d(b,np(w),x);if(w.$$typeof===Ka)return d(b,tp(b,w),x);rp(b,w)}return null}function f(b,w,x,k){var T=w!==null?w.key:null;if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return T!==null?null:a(b,w,""+x,k);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Y0:return x.key===T?l(b,w,x,k):null;case If:return x.key===T?c(b,w,x,k):null;case Ll:return x=Qc(x),f(b,w,x,k)}if(Nf(x)||sf(x))return T!==null?null:u(b,w,x,k,null);if(typeof x.then=="function")return f(b,w,np(x),k);if(x.$$typeof===Ka)return f(b,w,tp(b,x),k);rp(b,x)}return null}function m(b,w,x,k,T){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return b=b.get(x)||null,a(w,b,""+k,T);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Y0:return b=b.get(k.key===null?x:k.key)||null,l(w,b,k,T);case If:return b=b.get(k.key===null?x:k.key)||null,c(w,b,k,T);case Ll:return k=Qc(k),m(b,w,x,k,T)}if(Nf(k)||sf(k))return b=b.get(x)||null,u(w,b,k,T,null);if(typeof k.then=="function")return m(b,w,x,np(k),T);if(k.$$typeof===Ka)return m(b,w,x,tp(w,k),T);rp(w,k)}return null}function p(b,w,x,k){for(var T=null,A=null,M=w,D=w=0,O=null;M!==null&&D<x.length;D++){M.index>D?(O=M,M=null):O=M.sibling;var C=f(b,M,x[D],k);if(C===null){M===null&&(M=O);break}e&&M&&C.alternate===null&&t(b,M),w=i(C,w,D),A===null?T=C:A.sibling=C,A=C,M=O}if(D===x.length)return n(b,M),yn&&qa(b,D),T;if(M===null){for(;D<x.length;D++)M=d(b,x[D],k),M!==null&&(w=i(M,w,D),A===null?T=M:A.sibling=M,A=M);return yn&&qa(b,D),T}for(M=r(M);D<x.length;D++)O=m(M,b,D,x[D],k),O!==null&&(e&&O.alternate!==null&&M.delete(O.key===null?D:O.key),w=i(O,w,D),A===null?T=O:A.sibling=O,A=O);return e&&M.forEach(function(L){return t(b,L)}),yn&&qa(b,D),T}function y(b,w,x,k){if(x==null)throw Error(ve(151));for(var T=null,A=null,M=w,D=w=0,O=null,C=x.next();M!==null&&!C.done;D++,C=x.next()){M.index>D?(O=M,M=null):O=M.sibling;var L=f(b,M,C.value,k);if(L===null){M===null&&(M=O);break}e&&M&&L.alternate===null&&t(b,M),w=i(L,w,D),A===null?T=L:A.sibling=L,A=L,M=O}if(C.done)return n(b,M),yn&&qa(b,D),T;if(M===null){for(;!C.done;D++,C=x.next())C=d(b,C.value,k),C!==null&&(w=i(C,w,D),A===null?T=C:A.sibling=C,A=C);return yn&&qa(b,D),T}for(M=r(M);!C.done;D++,C=x.next())C=m(M,b,D,C.value,k),C!==null&&(e&&C.alternate!==null&&M.delete(C.key===null?D:C.key),w=i(C,w,D),A===null?T=C:A.sibling=C,A=C);return e&&M.forEach(function(I){return t(b,I)}),yn&&qa(b,D),T}function v(b,w,x,k){if(typeof x=="object"&&x!==null&&x.type===vd&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Y0:e:{for(var T=x.key;w!==null;){if(w.key===T){if(T=x.type,T===vd){if(w.tag===7){n(b,w.sibling),k=s(w,x.props.children),k.return=b,b=k;break e}}else if(w.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Ll&&Qc(T)===w.type){n(b,w.sibling),k=s(w,x.props),lf(k,x),k.return=b,b=k;break e}n(b,w);break}else t(b,w);w=w.sibling}x.type===vd?(k=pu(x.props.children,b.mode,k,x.key),k.return=b,b=k):(k=lg(x.type,x.key,x.props,null,b.mode,k),lf(k,x),k.return=b,b=k)}return o(b);case If:e:{for(T=x.key;w!==null;){if(w.key===T)if(w.tag===4&&w.stateNode.containerInfo===x.containerInfo&&w.stateNode.implementation===x.implementation){n(b,w.sibling),k=s(w,x.children||[]),k.return=b,b=k;break e}else{n(b,w);break}else t(b,w);w=w.sibling}k=r2(x,b.mode,k),k.return=b,b=k}return o(b);case Ll:return x=Qc(x),v(b,w,x,k)}if(Nf(x))return p(b,w,x,k);if(sf(x)){if(T=sf(x),typeof T!="function")throw Error(ve(150));return x=T.call(x),y(b,w,x,k)}if(typeof x.then=="function")return v(b,w,np(x),k);if(x.$$typeof===Ka)return v(b,w,tp(b,x),k);rp(b,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,w!==null&&w.tag===6?(n(b,w.sibling),k=s(w,x),k.return=b,b=k):(n(b,w),k=n2(x,b.mode,k),k.return=b,b=k),o(b)):n(b,w)}return function(b,w,x,k){try{Im=0;var T=v(b,w,x,k);return qd=null,T}catch(M){if(M===Ih||M===vy)throw M;var A=Li(29,M,null,b.mode);return A.lanes=k,A.return=b,A}finally{}}}var Au=KE(!0),YE=KE(!1),jl=!1;function e_(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function V4(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 sc(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ic(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,En&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=Wg(e),zE(e,null,n),t}return wy(e,r,t,n),Wg(e)}function Jf(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,fE(e,n)}}function i2(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 W4=!1;function Zf(){if(W4){var e=Fd;if(e!==null)throw e}}function em(e,t,n,r){W4=!1;var s=e.updateQueue;jl=!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?(fn&f)===f:(r&f)===f){f!==0&&f===rh&&(W4=!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=ir({},d,f);break e;case 2:jl=!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),yc|=o,e.lanes=o,e.memoizedState=d}}function XE(e,t){if(typeof e!="function")throw Error(ve(191,e));e.call(t)}function QE(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)XE(n[e],t)}var sh=wa(null),Xg=wa(0);function e8(e,t){e=ul,er(Xg,e),er(sh,t),ul=e|t.baseLanes}function G4(){er(Xg,ul),er(sh,sh.current)}function t_(){ul=Xg.current,fs(sh),fs(Xg)}var Hi=wa(null),po=null;function Fl(e){var t=e.alternate;er(Er,Er.current&1),er(Hi,e),po===null&&(t===null||sh.current!==null||t.memoizedState!==null)&&(po=e)}function K4(e){er(Er,Er.current),er(Hi,e),po===null&&(po=e)}function JE(e){e.tag===22?(er(Er,Er.current),er(Hi,e),po===null&&(po=e)):ql()}function ql(){er(Er,Er.current),er(Hi,Hi.current)}function Ri(e){fs(Hi),po===e&&(po=null),fs(Er)}var Er=wa(0);function Qg(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||fv(n)||mv(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 al=0,Zt=null,Fn=null,jr=null,Jg=!1,Ud=!1,Eu=!1,Zg=0,Nm=0,Hd=null,Mz=0;function vr(){throw Error(ve(321))}function n_(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ui(e[n],t[n]))return!1;return!0}function r_(e,t,n,r,s,i){return al=i,Zt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,zt.H=e===null||e.memoizedState===null?MM:m_,Eu=!1,i=n(r,s),Eu=!1,Ud&&(i=eM(t,n,r,s)),ZE(e),i}function ZE(e){zt.H=Rm;var t=Fn!==null&&Fn.next!==null;if(al=0,jr=Fn=Zt=null,Jg=!1,Nm=0,Hd=null,t)throw Error(ve(300));e===null||Pr||(e=e.dependencies,e!==null&&Kg(e)&&(Pr=!0))}function eM(e,t,n,r){Zt=e;var s=0;do{if(Ud&&(Hd=null),Nm=0,Ud=!1,25<=s)throw Error(ve(301));if(s+=1,jr=Fn=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}zt.H=IM,i=t(n,r)}while(Ud);return i}function Iz(){var e=zt.H,t=e.useState()[0];return t=typeof t.then=="function"?p0(t):t,e=e.useState()[0],(Fn!==null?Fn.memoizedState:null)!==e&&(Zt.flags|=1024),t}function s_(){var e=Zg!==0;return Zg=0,e}function i_(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function o_(e){if(Jg){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Jg=!1}al=0,jr=Fn=Zt=null,Ud=!1,Nm=Zg=0,Hd=null}function Vs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jr===null?Zt.memoizedState=jr=e:jr=jr.next=e,jr}function Mr(){if(Fn===null){var e=Zt.alternate;e=e!==null?e.memoizedState:null}else e=Fn.next;var t=jr===null?Zt.memoizedState:jr.next;if(t!==null)jr=t,Fn=e;else{if(e===null)throw Zt.alternate===null?Error(ve(467)):Error(ve(310));Fn=e,e={memoizedState:Fn.memoizedState,baseState:Fn.baseState,baseQueue:Fn.baseQueue,queue:Fn.queue,next:null},jr===null?Zt.memoizedState=jr=e:jr=jr.next=e}return jr}function xy(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function p0(e){var t=Nm;return Nm+=1,Hd===null&&(Hd=[]),e=GE(Hd,e,t),t=Zt,(jr===null?t.memoizedState:jr.next)===null&&(t=t.alternate,zt.H=t===null||t.memoizedState===null?MM:m_),e}function _y(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return p0(e);if(e.$$typeof===Ka)return ks(e)}throw Error(ve(438,String(e)))}function a_(e){var t=null,n=Zt.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Zt.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=xy(),Zt.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]=p$;return t.index++,n}function ll(e,t){return typeof t=="function"?t(e):t}function ug(e){var t=Mr();return l_(t,Fn,e)}function l_(e,t,n){var r=e.queue;if(r===null)throw Error(ve(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?(fn&d)===d:(al&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===rh&&(u=!0);else if((al&f)===f){c=c.next,f===rh&&(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,Zt.lanes|=f,yc|=f;d=c.action,Eu&&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,Zt.lanes|=d,yc|=d;c=c.next}while(c!==null&&c!==t);if(l===null?o=i:l.next=a,!Ui(i,e.memoizedState)&&(Pr=!0,u&&(n=Fd,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 o2(e){var t=Mr(),n=t.queue;if(n===null)throw Error(ve(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);Ui(i,t.memoizedState)||(Pr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function tM(e,t,n){var r=Zt,s=Mr(),i=yn;if(i){if(n===void 0)throw Error(ve(407));n=n()}else n=t();var o=!Ui((Fn||s).memoizedState,n);if(o&&(s.memoizedState=n,Pr=!0),s=s.queue,c_(sM.bind(null,r,s,e),[e]),s.getSnapshot!==t||o||jr!==null&&jr.memoizedState.tag&1){if(r.flags|=2048,ih(9,{destroy:void 0},rM.bind(null,r,s,n,t),null),Gn===null)throw Error(ve(349));i||al&127||nM(r,t,n)}return n}function nM(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Zt.updateQueue,t===null?(t=xy(),Zt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function rM(e,t,n,r){t.value=n,t.getSnapshot=r,iM(t)&&oM(e)}function sM(e,t,n){return n(function(){iM(t)&&oM(e)})}function iM(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ui(e,n)}catch{return!0}}function oM(e){var t=Fu(e,2);t!==null&&yi(t,e,2)}function Y4(e){var t=Vs();if(typeof e=="function"){var n=e;if(e=n(),Eu){Wl(!0);try{n()}finally{Wl(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:e},t}function aM(e,t,n,r){return e.baseState=n,l_(e,Fn,typeof r=="function"?r:ll)}function Nz(e,t,n,r,s){if(Sy(e))throw Error(ve(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)}};zt.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,lM(t,i)):(i.next=n.next,t.pending=n.next=i)}}function lM(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=zt.T,o={};zt.T=o;try{var a=n(s,r),l=zt.S;l!==null&&l(o,a),t8(e,t,a)}catch(c){X4(e,t,c)}finally{i!==null&&o.types!==null&&(i.types=o.types),zt.T=i}}else try{i=n(s,r),t8(e,t,i)}catch(c){X4(e,t,c)}}function t8(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){n8(e,t,r)},function(r){return X4(e,t,r)}):n8(e,t,n)}function n8(e,t,n){t.status="fulfilled",t.value=n,cM(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,lM(e,n)))}function X4(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,cM(t),t=t.next;while(t!==r)}e.action=null}function cM(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function uM(e,t){return t}function r8(e,t){if(yn){var n=Gn.formState;if(n!==null){e:{var r=Zt;if(yn){if(nr){t:{for(var s=nr,i=co;s.nodeType!==8;){if(!i){s=null;break t}if(s=go(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){nr=go(s.nextSibling),r=s.data==="F!";break e}}pc(r)}r=!1}r&&(t=n[0])}}return n=Vs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uM,lastRenderedState:t},n.queue=r,n=CM.bind(null,Zt,r),r.dispatch=n,r=Y4(!1),i=f_.bind(null,Zt,!1,r.queue),r=Vs(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=Nz.bind(null,Zt,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function s8(e){var t=Mr();return dM(t,Fn,e)}function dM(e,t,n){if(t=l_(e,t,uM)[0],e=ug(ll)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=p0(t)}catch(o){throw o===Ih?vy:o}else r=t;t=Mr();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&(Zt.flags|=2048,ih(9,{destroy:void 0},Rz.bind(null,s,n),null)),[r,i,e]}function Rz(e,t){e.action=t}function i8(e){var t=Mr(),n=Fn;if(n!==null)return dM(t,n,e);Mr(),t=t.memoizedState,n=Mr();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ih(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Zt.updateQueue,t===null&&(t=xy(),Zt.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 hM(){return Mr().memoizedState}function dg(e,t,n,r){var s=Vs();Zt.flags|=e,s.memoizedState=ih(1|t,{destroy:void 0},n,r===void 0?null:r)}function ky(e,t,n,r){var s=Mr();r=r===void 0?null:r;var i=s.memoizedState.inst;Fn!==null&&r!==null&&n_(r,Fn.memoizedState.deps)?s.memoizedState=ih(t,i,n,r):(Zt.flags|=e,s.memoizedState=ih(1|t,i,n,r))}function o8(e,t){dg(8390656,8,e,t)}function c_(e,t){ky(2048,8,e,t)}function Lz(e){Zt.flags|=4;var t=Zt.updateQueue;if(t===null)t=xy(),Zt.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function fM(e){var t=Mr().memoizedState;return Lz({ref:t,nextImpl:e}),function(){if(En&2)throw Error(ve(440));return t.impl.apply(void 0,arguments)}}function mM(e,t){return ky(4,2,e,t)}function pM(e,t){return ky(4,4,e,t)}function gM(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 yM(e,t,n){n=n!=null?n.concat([e]):null,ky(4,4,gM.bind(null,t,e),n)}function u_(){}function bM(e,t){var n=Mr();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&n_(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function wM(e,t){var n=Mr();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&n_(t,r[1]))return r[0];if(r=e(),Eu){Wl(!0);try{e()}finally{Wl(!1)}}return n.memoizedState=[r,t],r}function d_(e,t,n){return n===void 0||al&1073741824&&!(fn&261930)?e.memoizedState=t:(e.memoizedState=n,e=aI(),Zt.lanes|=e,yc|=e,n)}function vM(e,t,n,r){return Ui(n,t)?n:sh.current!==null?(e=d_(e,n,r),Ui(e,t)||(Pr=!0),e):!(al&42)||al&1073741824&&!(fn&261930)?(Pr=!0,e.memoizedState=n):(e=aI(),Zt.lanes|=e,yc|=e,t)}function xM(e,t,n,r,s){var i=In.p;In.p=i!==0&&8>i?i:8;var o=zt.T,a={};zt.T=a,f_(e,!1,t,n);try{var l=s(),c=zt.S;if(c!==null&&c(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=Ez(l,r);tm(e,t,u,zi(e))}else tm(e,t,r,zi(e))}catch(d){tm(e,t,{then:function(){},status:"rejected",reason:d},zi())}finally{In.p=i,o!==null&&a.types!==null&&(o.types=a.types),zt.T=o}}function jz(){}function Q4(e,t,n,r){if(e.tag!==5)throw Error(ve(476));var s=_M(e).queue;xM(e,s,t,mu,n===null?jz:function(){return kM(e),n(r)})}function _M(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:mu,baseState:mu,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:mu},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function kM(e){var t=_M(e);t.next===null&&(t=e.alternate.memoizedState),tm(e,t.next.queue,{},zi())}function h_(){return ks(Dm)}function SM(){return Mr().memoizedState}function TM(){return Mr().memoizedState}function Dz(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=zi();e=sc(n);var r=ic(t,e,n);r!==null&&(yi(r,t,n),Jf(r,t,n)),t={cache:Q3()},e.payload=t;return}t=t.return}}function Oz(e,t,n){var r=zi();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Sy(e)?AM(t,n):(n=G3(e,t,n,r),n!==null&&(yi(n,e,r),EM(n,t,r)))}function CM(e,t,n){var r=zi();tm(e,t,n,r)}function tm(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Sy(e))AM(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,Ui(a,o))return wy(e,t,s,0),Gn===null&&by(),!1}catch{}finally{}if(n=G3(e,t,s,r),n!==null)return yi(n,e,r),EM(n,t,r),!0}return!1}function f_(e,t,n,r){if(r={lane:2,revertLane:__(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Sy(e)){if(t)throw Error(ve(479))}else t=G3(e,n,r,2),t!==null&&yi(t,e,2)}function Sy(e){var t=e.alternate;return e===Zt||t!==null&&t===Zt}function AM(e,t){Ud=Jg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function EM(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fE(e,n)}}var Rm={readContext:ks,use:_y,useCallback:vr,useContext:vr,useEffect:vr,useImperativeHandle:vr,useLayoutEffect:vr,useInsertionEffect:vr,useMemo:vr,useReducer:vr,useRef:vr,useState:vr,useDebugValue:vr,useDeferredValue:vr,useTransition:vr,useSyncExternalStore:vr,useId:vr,useHostTransitionStatus:vr,useFormState:vr,useActionState:vr,useOptimistic:vr,useMemoCache:vr,useCacheRefresh:vr};Rm.useEffectEvent=vr;var MM={readContext:ks,use:_y,useCallback:function(e,t){return Vs().memoizedState=[e,t===void 0?null:t],e},useContext:ks,useEffect:o8,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,dg(4194308,4,gM.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dg(4194308,4,e,t)},useInsertionEffect:function(e,t){dg(4,2,e,t)},useMemo:function(e,t){var n=Vs();t=t===void 0?null:t;var r=e();if(Eu){Wl(!0);try{e()}finally{Wl(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Vs();if(n!==void 0){var s=n(t);if(Eu){Wl(!0);try{n(t)}finally{Wl(!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=Oz.bind(null,Zt,e),[r.memoizedState,e]},useRef:function(e){var t=Vs();return e={current:e},t.memoizedState=e},useState:function(e){e=Y4(e);var t=e.queue,n=CM.bind(null,Zt,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:u_,useDeferredValue:function(e,t){var n=Vs();return d_(n,e,t)},useTransition:function(){var e=Y4(!1);return e=xM.bind(null,Zt,e.queue,!0,!1),Vs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Zt,s=Vs();if(yn){if(n===void 0)throw Error(ve(407));n=n()}else{if(n=t(),Gn===null)throw Error(ve(349));fn&127||nM(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,o8(sM.bind(null,r,i,e),[e]),r.flags|=2048,ih(9,{destroy:void 0},rM.bind(null,r,i,n,t),null),n},useId:function(){var e=Vs(),t=Gn.identifierPrefix;if(yn){var n=ua,r=ca;n=(r&~(1<<32-$i(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Zg++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Mz++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:h_,useFormState:r8,useActionState:r8,useOptimistic:function(e){var t=Vs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=f_.bind(null,Zt,!0,n),n.dispatch=t,[e,t]},useMemoCache:a_,useCacheRefresh:function(){return Vs().memoizedState=Dz.bind(null,Zt)},useEffectEvent:function(e){var t=Vs(),n={impl:e};return t.memoizedState=n,function(){if(En&2)throw Error(ve(440));return n.impl.apply(void 0,arguments)}}},m_={readContext:ks,use:_y,useCallback:bM,useContext:ks,useEffect:c_,useImperativeHandle:yM,useInsertionEffect:mM,useLayoutEffect:pM,useMemo:wM,useReducer:ug,useRef:hM,useState:function(){return ug(ll)},useDebugValue:u_,useDeferredValue:function(e,t){var n=Mr();return vM(n,Fn.memoizedState,e,t)},useTransition:function(){var e=ug(ll)[0],t=Mr().memoizedState;return[typeof e=="boolean"?e:p0(e),t]},useSyncExternalStore:tM,useId:SM,useHostTransitionStatus:h_,useFormState:s8,useActionState:s8,useOptimistic:function(e,t){var n=Mr();return aM(n,Fn,e,t)},useMemoCache:a_,useCacheRefresh:TM};m_.useEffectEvent=fM;var IM={readContext:ks,use:_y,useCallback:bM,useContext:ks,useEffect:c_,useImperativeHandle:yM,useInsertionEffect:mM,useLayoutEffect:pM,useMemo:wM,useReducer:o2,useRef:hM,useState:function(){return o2(ll)},useDebugValue:u_,useDeferredValue:function(e,t){var n=Mr();return Fn===null?d_(n,e,t):vM(n,Fn.memoizedState,e,t)},useTransition:function(){var e=o2(ll)[0],t=Mr().memoizedState;return[typeof e=="boolean"?e:p0(e),t]},useSyncExternalStore:tM,useId:SM,useHostTransitionStatus:h_,useFormState:i8,useActionState:i8,useOptimistic:function(e,t){var n=Mr();return Fn!==null?aM(n,Fn,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:a_,useCacheRefresh:TM};IM.useEffectEvent=fM;function a2(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:ir({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var J4={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=zi(),s=sc(r);s.payload=t,n!=null&&(s.callback=n),t=ic(e,s,r),t!==null&&(yi(t,e,r),Jf(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=zi(),s=sc(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=ic(e,s,r),t!==null&&(yi(t,e,r),Jf(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=zi(),r=sc(n);r.tag=2,t!=null&&(r.callback=t),t=ic(e,r,n),t!==null&&(yi(t,e,n),Jf(t,e,n))}};function a8(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?!Am(n,r)||!Am(s,i):!0}function l8(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&&J4.enqueueReplaceState(t,t.state,null)}function Mu(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=ir({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function NM(e){Vg(e)}function RM(e){console.error(e)}function LM(e){Vg(e)}function e1(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function c8(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 Z4(e,t,n){return n=sc(n),n.tag=3,n.payload={element:null},n.callback=function(){e1(e,t)},n}function jM(e){return e=sc(e),e.tag=3,e}function DM(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(){c8(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){c8(t,n,r),typeof s!="function"&&(oc===null?oc=new Set([this]):oc.add(this));var a=r.stack;this.componentDidCatch(r.value,{componentStack:a!==null?a:""})})}function Bz(e,t,n,r,s){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&Mh(t,n,s,!0),n=Hi.current,n!==null){switch(n.tag){case 31:case 13:return po===null?i1():n.alternate===null&&_r===0&&(_r=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===Yg?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),b2(e,r,s)),!1;case 22:return n.flags|=65536,r===Yg?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)),b2(e,r,s)),!1}throw Error(ve(435,n.tag))}return b2(e,r,s),i1(),!1}if(yn)return t=Hi.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==z4&&(e=Error(ve(422),{cause:r}),Mm(lo(e,n)))):(r!==z4&&(t=Error(ve(423),{cause:r}),Mm(lo(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=lo(r,n),s=Z4(e.stateNode,r,s),i2(e,s),_r!==4&&(_r=2)),!1;var i=Error(ve(520),{cause:r});if(i=lo(i,n),sm===null?sm=[i]:sm.push(i),_r!==4&&(_r=2),t===null)return!0;r=lo(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=Z4(n.stateNode,r,e),i2(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"&&(oc===null||!oc.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=jM(s),DM(s,e,n,r),i2(n,s),!1}n=n.return}while(n!==null);return!1}var p_=Error(ve(461)),Pr=!1;function ys(e,t,n,r){t.child=e===null?YE(t,null,n,r):Au(t,e.child,n,r)}function u8(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 Cu(t),r=r_(e,t,n,o,i,s),a=s_(),e!==null&&!Pr?(i_(e,t,s),cl(e,t,s)):(yn&&a&&Y3(t),t.flags|=1,ys(e,t,r,s),t.child)}function d8(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!K3(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,OM(e,t,i,r,s)):(e=lg(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!g_(e,s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Am,n(o,r)&&e.ref===t.ref)return cl(e,t,s)}return t.flags|=1,e=el(i,r),e.ref=t.ref,e.return=t,t.child=e}function OM(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Am(i,r)&&e.ref===t.ref)if(Pr=!1,t.pendingProps=r=i,g_(e,s))e.flags&131072&&(Pr=!0);else return t.lanes=e.lanes,cl(e,t,s)}return ev(e,t,n,r,s)}function BM(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 h8(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&cg(t,i!==null?i.cachePool:null),i!==null?e8(t,i):G4(),JE(t);else return r=t.lanes=536870912,h8(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(cg(t,i.cachePool),e8(t,i),ql(),t.memoizedState=null):(e!==null&&cg(t,null),G4(),ql());return ys(e,t,s,n),t.child}function Lf(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function h8(e,t,n,r,s){var i=J3();return i=i===null?null:{parent:Br._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&cg(t,null),G4(),JE(t),e!==null&&Mh(e,t,r,!0),t.childLanes=s,null}function hg(e,t){return t=t1({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function f8(e,t,n){return Au(t,e.child,null,n),e=hg(t,t.pendingProps),e.flags|=2,Ri(t),t.memoizedState=null,e}function Pz(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(yn){if(r.mode==="hidden")return e=hg(t,r),t.lanes=536870912,Lf(null,e);if(K4(t),(e=nr)?(e=MI(e,co),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mc!==null?{id:ca,overflow:ua}:null,retryLane:536870912,hydrationErrors:null},n=qE(e),n.return=t,t.child=n,_s=t,nr=null)):e=null,e===null)throw pc(t);return t.lanes=536870912,null}return hg(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(K4(t),s)if(t.flags&256)t.flags&=-257,t=f8(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(ve(558));else if(Pr||Mh(e,t,n,!1),s=(n&e.childLanes)!==0,Pr||s){if(r=Gn,r!==null&&(o=mE(r,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,Fu(e,o),yi(r,e,o),p_;i1(),t=f8(e,t,n)}else e=i.treeContext,nr=go(o.nextSibling),_s=t,yn=!0,rc=null,co=!1,e!==null&&HE(t,e),t=hg(t,r),t.flags|=4096;return t}return e=el(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fg(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(ve(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function ev(e,t,n,r,s){return Cu(t),n=r_(e,t,n,r,void 0,s),r=s_(),e!==null&&!Pr?(i_(e,t,s),cl(e,t,s)):(yn&&r&&Y3(t),t.flags|=1,ys(e,t,n,s),t.child)}function m8(e,t,n,r,s,i){return Cu(t),t.updateQueue=null,n=eM(t,r,n,s),ZE(e),r=s_(),e!==null&&!Pr?(i_(e,t,i),cl(e,t,i)):(yn&&r&&Y3(t),t.flags|=1,ys(e,t,n,i),t.child)}function p8(e,t,n,r,s){if(Cu(t),t.stateNode===null){var i=Ed,o=n.contextType;typeof o=="object"&&o!==null&&(i=ks(o)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=J4,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},e_(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?ks(o):Ed,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(a2(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&&J4.enqueueReplaceState(i,i.state,null),em(t,r,i,s),Zf(),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=Mu(n,a);i.props=l;var c=i.context,u=n.contextType;o=Ed,typeof u=="object"&&u!==null&&(o=ks(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)&&l8(t,i,r,o),jl=!1;var f=t.memoizedState;i.state=f,em(t,r,i,s),Zf(),c=t.memoizedState,a||f!==c||jl?(typeof d=="function"&&(a2(t,n,d,r),c=t.memoizedState),(l=jl||a8(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,V4(e,t),o=t.memoizedProps,u=Mu(n,o),i.props=u,d=t.pendingProps,f=i.context,c=n.contextType,l=Ed,typeof c=="object"&&c!==null&&(l=ks(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)&&l8(t,i,r,l),jl=!1,f=t.memoizedState,i.state=f,em(t,r,i,s),Zf();var m=t.memoizedState;o!==d||f!==m||jl||e!==null&&e.dependencies!==null&&Kg(e.dependencies)?(typeof a=="function"&&(a2(t,n,a,r),m=t.memoizedState),(u=jl||a8(t,n,u,r,f,m,l)||e!==null&&e.dependencies!==null&&Kg(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,fg(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=Au(t,e.child,null,s),t.child=Au(t,null,n,s)):ys(e,t,n,s),t.memoizedState=i.state,e=t.child):e=cl(e,t,s),e}function g8(e,t,n,r){return Tu(),t.flags|=256,ys(e,t,n,r),t.child}var l2={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function c2(e){return{baseLanes:e,cachePool:WE()}}function u2(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Di),e}function PM(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:(Er.current&2)!==0),o&&(s=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(yn){if(s?Fl(t):ql(),(e=nr)?(e=MI(e,co),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:mc!==null?{id:ca,overflow:ua}:null,retryLane:536870912,hydrationErrors:null},n=qE(e),n.return=t,t.child=n,_s=t,nr=null)):e=null,e===null)throw pc(t);return mv(e)?t.lanes=32:t.lanes=536870912,null}var a=r.children;return r=r.fallback,s?(ql(),s=t.mode,a=t1({mode:"hidden",children:a},s),r=pu(r,s,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=c2(n),r.childLanes=u2(e,o,n),t.memoizedState=l2,Lf(null,r)):(Fl(t),tv(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(Fl(t),t.flags&=-257,t=d2(e,t,n)):t.memoizedState!==null?(ql(),t.child=e.child,t.flags|=128,t=null):(ql(),a=r.fallback,s=t.mode,r=t1({mode:"visible",children:r.children},s),a=pu(a,s,n,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,Au(t,e.child,null,n),r=t.child,r.memoizedState=c2(n),r.childLanes=u2(e,o,n),t.memoizedState=l2,t=Lf(null,r));else if(Fl(t),mv(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var c=o.dgst;o=c,r=Error(ve(419)),r.stack="",r.digest=o,Mm({value:r,source:null,stack:null}),t=d2(e,t,n)}else if(Pr||Mh(e,t,n,!1),o=(n&e.childLanes)!==0,Pr||o){if(o=Gn,o!==null&&(r=mE(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Fu(e,r),yi(o,e,r),p_;fv(a)||i1(),t=d2(e,t,n)}else fv(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,nr=go(a.nextSibling),_s=t,yn=!0,rc=null,co=!1,e!==null&&HE(t,e),t=tv(t,r.children),t.flags|=4096);return t}return s?(ql(),a=r.fallback,s=t.mode,l=e.child,c=l.sibling,r=el(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,c!==null?a=el(c,a):(a=pu(a,s,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,Lf(null,r),r=t.child,a=e.child.memoizedState,a===null?a=c2(n):(s=a.cachePool,s!==null?(l=Br._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=WE(),a={baseLanes:a.baseLanes|n,cachePool:s}),r.memoizedState=a,r.childLanes=u2(e,o,n),t.memoizedState=l2,Lf(e.child,r)):(Fl(t),n=e.child,e=n.sibling,n=el(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 tv(e,t){return t=t1({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function t1(e,t){return e=Li(22,e,null,t),e.lanes=0,e}function d2(e,t,n){return Au(t,e.child,null,n),e=tv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function y8(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),q4(e.return,t,n)}function h2(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 $M(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var o=Er.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,er(Er,o),ys(e,t,r,n),r=yn?Em:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&y8(e,n,t);else if(e.tag===19)y8(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&&Qg(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),h2(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&&Qg(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}h2(t,!0,n,null,i,r);break;case"together":h2(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function cl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),yc|=t.lanes,!(n&t.childLanes))if(e!==null){if(Mh(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(ve(153));if(t.child!==null){for(e=t.child,n=el(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=el(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function g_(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Kg(e)))}function $z(e,t,n){switch(t.tag){case 3:Fg(t,t.stateNode.containerInfo),zl(t,Br,e.memoizedState.cache),Tu();break;case 27:case 5:M4(t);break;case 4:Fg(t,t.stateNode.containerInfo);break;case 10:zl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,K4(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(Fl(t),t.flags|=128,null):n&t.child.childLanes?PM(e,t,n):(Fl(t),e=cl(e,t,n),e!==null?e.sibling:null);Fl(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(Mh(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return $M(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),er(Er,Er.current),r)break;return null;case 22:return t.lanes=0,BM(e,t,n,t.pendingProps);case 24:zl(t,Br,e.memoizedState.cache)}return cl(e,t,n)}function zM(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Pr=!0;else{if(!g_(e,n)&&!(t.flags&128))return Pr=!1,$z(e,t,n);Pr=!!(e.flags&131072)}else Pr=!1,yn&&t.flags&1048576&&UE(t,Em,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Qc(t.elementType),t.type=e,typeof e=="function")K3(e)?(r=Mu(e,r),t.tag=1,t=p8(null,t,e,r,n)):(t.tag=0,t=ev(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===j3){t.tag=11,t=u8(null,t,e,r,n);break e}else if(s===D3){t.tag=14,t=d8(null,t,e,r,n);break e}}throw t=A4(e)||e,Error(ve(306,t,""))}}return t;case 0:return ev(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=Mu(r,t.pendingProps),p8(e,t,r,s,n);case 3:e:{if(Fg(t,t.stateNode.containerInfo),e===null)throw Error(ve(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,V4(e,t),em(t,r,null,n);var o=t.memoizedState;if(r=o.cache,zl(t,Br,r),r!==i.cache&&U4(t,[Br],n,!0),Zf(),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=g8(e,t,r,n);break e}else if(r!==s){s=lo(Error(ve(424)),t),Mm(s),t=g8(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(nr=go(e.firstChild),_s=t,yn=!0,rc=null,co=!0,n=YE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Tu(),r===s){t=cl(e,t,n);break e}ys(e,t,r,n)}t=t.child}return t;case 26:return fg(e,t),e===null?(n=B8(t.type,null,t.pendingProps,null))?t.memoizedState=n:yn||(n=t.type,e=t.pendingProps,r=c1(nc.current).createElement(n),r[xs]=t,r[wi]=e,Ts(r,n,e),ds(r),t.stateNode=r):t.memoizedState=B8(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return M4(t),e===null&&yn&&(r=t.stateNode=II(t.type,t.pendingProps,nc.current),_s=t,co=!0,s=nr,Ic(t.type)?(pv=s,nr=go(r.firstChild)):nr=s),ys(e,t,t.pendingProps.children,n),fg(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&yn&&((s=r=nr)&&(r=pF(r,t.type,t.pendingProps,co),r!==null?(t.stateNode=r,_s=t,nr=go(r.firstChild),co=!1,s=!0):s=!1),s||pc(t)),M4(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,dv(s,i)?r=null:o!==null&&dv(s,o)&&(t.flags|=32),t.memoizedState!==null&&(s=r_(e,t,Iz,null,null,n),Dm._currentValue=s),fg(e,t),ys(e,t,r,n),t.child;case 6:return e===null&&yn&&((e=n=nr)&&(n=gF(n,t.pendingProps,co),n!==null?(t.stateNode=n,_s=t,nr=null,e=!0):e=!1),e||pc(t)),null;case 13:return PM(e,t,n);case 4:return Fg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Au(t,null,r,n):ys(e,t,r,n),t.child;case 11:return u8(e,t,t.type,t.pendingProps,n);case 7:return ys(e,t,t.pendingProps,n),t.child;case 8:return ys(e,t,t.pendingProps.children,n),t.child;case 12:return ys(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,zl(t,t.type,r.value),ys(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,Cu(t),s=ks(s),r=r(s),t.flags|=1,ys(e,t,r,n),t.child;case 14:return d8(e,t,t.type,t.pendingProps,n);case 15:return OM(e,t,t.type,t.pendingProps,n);case 19:return $M(e,t,n);case 31:return Pz(e,t,n);case 22:return BM(e,t,n,t.pendingProps);case 24:return Cu(t),r=ks(Br),e===null?(s=J3(),s===null&&(s=Gn,i=Q3(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},e_(t),zl(t,Br,s)):(e.lanes&n&&(V4(e,t),em(t,null,null,n),Zf()),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),zl(t,Br,r)):(r=i.cache,zl(t,Br,r),r!==s.cache&&U4(t,[Br],n,!0))),ys(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(ve(156,t.tag))}function ja(e){e.flags|=4}function f2(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(uI())e.flags|=8192;else throw yu=Yg,Z3}else e.flags&=-16777217}function b8(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!LI(t))if(uI())e.flags|=8192;else throw yu=Yg,Z3}function sp(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?dE():536870912,e.lanes|=t,oh|=t)}function cf(e,t){if(!yn)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 tr(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 zz(e,t,n){var r=t.pendingProps;switch(X3(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tr(t),null;case 1:return tr(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),tl(Br),eh(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(od(t)?ja(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,s2())),tr(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(ja(t),i!==null?(tr(t),b8(t,i)):(tr(t),f2(t,s,null,r,n))):i?i!==e.memoizedState?(ja(t),tr(t),b8(t,i)):(tr(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ja(t),tr(t),f2(t,s,e,r,n)),null;case 27:if(qg(t),n=nc.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ja(t);else{if(!r){if(t.stateNode===null)throw Error(ve(166));return tr(t),null}e=ga.current,od(t)?G6(t):(e=II(s,r,n),t.stateNode=e,ja(t))}return tr(t),null;case 5:if(qg(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ja(t);else{if(!r){if(t.stateNode===null)throw Error(ve(166));return tr(t),null}if(i=ga.current,od(t))G6(t);else{var o=c1(nc.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[xs]=t,i[wi]=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(Ts(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&&ja(t)}}return tr(t),f2(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ja(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ve(166));if(e=nc.current,od(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=_s,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[xs]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||CI(e.nodeValue,n)),e||pc(t,!0)}else e=c1(e).createTextNode(r),e[xs]=t,t.stateNode=e}return tr(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=od(t),n!==null){if(e===null){if(!r)throw Error(ve(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ve(557));e[xs]=t}else Tu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;tr(t),e=!1}else n=s2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ri(t),t):(Ri(t),null);if(t.flags&128)throw Error(ve(558))}return tr(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=od(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(ve(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ve(317));s[xs]=t}else Tu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;tr(t),s=!1}else s=s2(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Ri(t),t):(Ri(t),null)}return Ri(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),sp(t,t.updateQueue),tr(t),null);case 4:return eh(),e===null&&k_(t.stateNode.containerInfo),tr(t),null;case 10:return tl(t.type),tr(t),null;case 19:if(fs(Er),r=t.memoizedState,r===null)return tr(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)cf(r,!1);else{if(_r!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Qg(e),i!==null){for(t.flags|=128,cf(r,!1),e=i.updateQueue,t.updateQueue=e,sp(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)FE(n,e),n=n.sibling;return er(Er,Er.current&1|2),yn&&qa(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Bi()>r1&&(t.flags|=128,s=!0,cf(r,!1),t.lanes=4194304)}else{if(!s)if(e=Qg(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,sp(t,e),cf(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!yn)return tr(t),null}else 2*Bi()-r.renderingStartTime>r1&&n!==536870912&&(t.flags|=128,s=!0,cf(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=Bi(),e.sibling=null,n=Er.current,er(Er,s?n&1|2:n&1),yn&&qa(t,r.treeForkCount),e):(tr(t),null);case 22:case 23:return Ri(t),t_(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(tr(t),t.subtreeFlags&6&&(t.flags|=8192)):tr(t),n=t.updateQueue,n!==null&&sp(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&&fs(gu),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),tl(Br),tr(t),null;case 25:return null;case 30:return null}throw Error(ve(156,t.tag))}function Fz(e,t){switch(X3(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tl(Br),eh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return qg(t),null;case 31:if(t.memoizedState!==null){if(Ri(t),t.alternate===null)throw Error(ve(340));Tu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ri(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ve(340));Tu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fs(Er),null;case 4:return eh(),null;case 10:return tl(t.type),null;case 22:case 23:return Ri(t),t_(),e!==null&&fs(gu),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return tl(Br),null;case 25:return null;default:return null}}function FM(e,t){switch(X3(t),t.tag){case 3:tl(Br),eh();break;case 26:case 27:case 5:qg(t);break;case 4:eh();break;case 31:t.memoizedState!==null&&Ri(t);break;case 13:Ri(t);break;case 19:fs(Er);break;case 10:tl(t.type);break;case 22:case 23:Ri(t),t_(),e!==null&&fs(gu);break;case 24:tl(Br)}}function g0(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){Bn(t,t.return,a)}}function gc(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){Bn(s,l,u)}}}r=r.next}while(r!==i)}}catch(u){Bn(t,t.return,u)}}function qM(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{QE(t,n)}catch(r){Bn(e,e.return,r)}}}function UM(e,t,n){n.props=Mu(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Bn(e,t,r)}}function nm(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){Bn(e,t,s)}}function da(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){Bn(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){Bn(e,t,s)}else n.current=null}function HM(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){Bn(e,e.return,s)}}function m2(e,t,n){try{var r=e.stateNode;cF(r,e.type,n,t),r[wi]=t}catch(s){Bn(e,e.return,s)}}function VM(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ic(e.type)||e.tag===4}function p2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||VM(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&&Ic(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 nv(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=Ya));else if(r!==4&&(r===27&&Ic(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(nv(e,t,n),e=e.sibling;e!==null;)nv(e,t,n),e=e.sibling}function n1(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&&Ic(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(n1(e,t,n),e=e.sibling;e!==null;)n1(e,t,n),e=e.sibling}function WM(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Ts(t,r,n),t[xs]=e,t[wi]=n}catch(i){Bn(e,e.return,i)}}var Va=!1,Dr=!1,g2=!1,w8=typeof WeakSet=="function"?WeakSet:Set,us=null;function qz(e,t){if(e=e.containerInfo,cv=f1,e=LE(e),V3(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(uv={focusedElem:e,selectionRange:n},f1=!1,us=t;us!==null;)if(t=us,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,us=e;else for(;us!==null;){switch(t=us,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=Mu(n.type,s);e=r.getSnapshotBeforeUpdate(p,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(y){Bn(n,n.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)hv(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":hv(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(ve(163))}if(e=t.sibling,e!==null){e.return=t.return,us=e;break}us=t.return}}function GM(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Oa(e,n),r&4&&g0(5,n);break;case 1:if(Oa(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){Bn(n,n.return,o)}else{var s=Mu(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){Bn(n,n.return,o)}}r&64&&qM(n),r&512&&nm(n,n.return);break;case 3:if(Oa(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{QE(e,t)}catch(o){Bn(n,n.return,o)}}break;case 27:t===null&&r&4&&WM(n);case 26:case 5:Oa(e,n),t===null&&r&4&&HM(n),r&512&&nm(n,n.return);break;case 12:Oa(e,n);break;case 31:Oa(e,n),r&4&&XM(e,n);break;case 13:Oa(e,n),r&4&&QM(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Qz.bind(null,n),yF(e,n))));break;case 22:if(r=n.memoizedState!==null||Va,!r){t=t!==null&&t.memoizedState!==null||Dr,s=Va;var i=Dr;Va=r,(Dr=t)&&!i?Fa(e,n,(n.subtreeFlags&8772)!==0):Oa(e,n),Va=s,Dr=i}break;case 30:break;default:Oa(e,n)}}function KM(e){var t=e.alternate;t!==null&&(e.alternate=null,KM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&$3(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 ar=null,ci=!1;function Da(e,t,n){for(n=n.child;n!==null;)YM(e,t,n),n=n.sibling}function YM(e,t,n){if(Pi&&typeof Pi.onCommitFiberUnmount=="function")try{Pi.onCommitFiberUnmount(c0,n)}catch{}switch(n.tag){case 26:Dr||da(n,t),Da(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Dr||da(n,t);var r=ar,s=ci;Ic(n.type)&&(ar=n.stateNode,ci=!1),Da(e,t,n),om(n.stateNode),ar=r,ci=s;break;case 5:Dr||da(n,t);case 6:if(r=ar,s=ci,ar=null,Da(e,t,n),ar=r,ci=s,ar!==null)if(ci)try{(ar.nodeType===9?ar.body:ar.nodeName==="HTML"?ar.ownerDocument.body:ar).removeChild(n.stateNode)}catch(i){Bn(n,t,i)}else try{ar.removeChild(n.stateNode)}catch(i){Bn(n,t,i)}break;case 18:ar!==null&&(ci?(e=ar,R8(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),uh(e)):R8(ar,n.stateNode));break;case 4:r=ar,s=ci,ar=n.stateNode.containerInfo,ci=!0,Da(e,t,n),ar=r,ci=s;break;case 0:case 11:case 14:case 15:gc(2,n,t),Dr||gc(4,n,t),Da(e,t,n);break;case 1:Dr||(da(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&UM(n,t,r)),Da(e,t,n);break;case 21:Da(e,t,n);break;case 22:Dr=(r=Dr)||n.memoizedState!==null,Da(e,t,n),Dr=r;break;default:Da(e,t,n)}}function XM(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{uh(e)}catch(n){Bn(t,t.return,n)}}}function QM(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{uh(e)}catch(n){Bn(t,t.return,n)}}function Uz(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new w8),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new w8),t;default:throw Error(ve(435,e.tag))}}function ip(e,t){var n=Uz(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=Jz.bind(null,e,r);r.then(s,s)}})}function ii(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(Ic(a.type)){ar=a.stateNode,ci=!1;break e}break;case 5:ar=a.stateNode,ci=!1;break e;case 3:case 4:ar=a.stateNode.containerInfo,ci=!0;break e}a=a.return}if(ar===null)throw Error(ve(160));YM(i,o,s),ar=null,ci=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)JM(t,e),t=t.sibling}var Io=null;function JM(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ii(t,e),oi(e),r&4&&(gc(3,e,e.return),g0(3,e),gc(5,e,e.return));break;case 1:ii(t,e),oi(e),r&512&&(Dr||n===null||da(n,n.return)),r&64&&Va&&(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=Io;if(ii(t,e),oi(e),r&512&&(Dr||n===null||da(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[h0]||i[xs]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),Ts(i,r,n),i[xs]=e,ds(i),r=i;break e;case"link":var o=$8("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),Ts(i,r,n),s.head.appendChild(i);break;case"meta":if(o=$8("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),Ts(i,r,n),s.head.appendChild(i);break;default:throw Error(ve(468,r))}i[xs]=e,ds(i),r=i}e.stateNode=r}else z8(s,e.type,e.stateNode);else e.stateNode=P8(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?z8(s,e.type,e.stateNode):P8(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&m2(e,e.memoizedProps,n.memoizedProps)}break;case 27:ii(t,e),oi(e),r&512&&(Dr||n===null||da(n,n.return)),n!==null&&r&4&&m2(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ii(t,e),oi(e),r&512&&(Dr||n===null||da(n,n.return)),e.flags&32){s=e.stateNode;try{nh(s,"")}catch(p){Bn(e,e.return,p)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,m2(e,s,n!==null?n.memoizedProps:s)),r&1024&&(g2=!0);break;case 6:if(ii(t,e),oi(e),r&4){if(e.stateNode===null)throw Error(ve(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(p){Bn(e,e.return,p)}}break;case 3:if(gg=null,s=Io,Io=u1(t.containerInfo),ii(t,e),Io=s,oi(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{uh(t.containerInfo)}catch(p){Bn(e,e.return,p)}g2&&(g2=!1,ZM(e));break;case 4:r=Io,Io=u1(e.stateNode.containerInfo),ii(t,e),oi(e),Io=r;break;case 12:ii(t,e),oi(e);break;case 31:ii(t,e),oi(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ip(e,r)));break;case 13:ii(t,e),oi(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ty=Bi()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ip(e,r)));break;case 22:s=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,c=Va,u=Dr;if(Va=c||s,Dr=u||l,ii(t,e),Dr=u,Va=c,oi(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||l||Va||Dr||Jc(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){Bn(l,l.return,p)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(p){Bn(l,l.return,p)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;s?L8(m,!0):L8(l.stateNode,!1)}catch(p){Bn(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,ip(e,n))));break;case 19:ii(t,e),oi(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ip(e,r)));break;case 30:break;case 21:break;default:ii(t,e),oi(e)}}function oi(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(VM(r)){n=r;break}r=r.return}if(n==null)throw Error(ve(160));switch(n.tag){case 27:var s=n.stateNode,i=p2(e);n1(e,i,s);break;case 5:var o=n.stateNode;n.flags&32&&(nh(o,""),n.flags&=-33);var a=p2(e);n1(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,c=p2(e);nv(e,c,l);break;default:throw Error(ve(161))}}catch(u){Bn(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ZM(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ZM(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Oa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)GM(e,t.alternate,t),t=t.sibling}function Jc(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:gc(4,t,t.return),Jc(t);break;case 1:da(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&UM(t,t.return,n),Jc(t);break;case 27:om(t.stateNode);case 26:case 5:da(t,t.return),Jc(t);break;case 22:t.memoizedState===null&&Jc(t);break;case 30:Jc(t);break;default:Jc(t)}e=e.sibling}}function Fa(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:Fa(s,i,n),g0(4,i);break;case 1:if(Fa(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(c){Bn(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++)XE(l[s],a)}catch(c){Bn(r,r.return,c)}}n&&o&64&&qM(i),nm(i,i.return);break;case 27:WM(i);case 26:case 5:Fa(s,i,n),n&&r===null&&o&4&&HM(i),nm(i,i.return);break;case 12:Fa(s,i,n);break;case 31:Fa(s,i,n),n&&o&4&&XM(s,i);break;case 13:Fa(s,i,n),n&&o&4&&QM(s,i);break;case 22:i.memoizedState===null&&Fa(s,i,n),nm(i,i.return);break;case 30:break;default:Fa(s,i,n)}t=t.sibling}}function y_(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&&m0(n))}function b_(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&m0(e))}function Co(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)eI(e,t,n,r),t=t.sibling}function eI(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Co(e,t,n,r),s&2048&&g0(9,t);break;case 1:Co(e,t,n,r);break;case 3:Co(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&&m0(e)));break;case 12:if(s&2048){Co(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){Bn(t,t.return,l)}}else Co(e,t,n,r);break;case 31:Co(e,t,n,r);break;case 13:Co(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?Co(e,t,n,r):rm(e,t):i._visibility&2?Co(e,t,n,r):(i._visibility|=2,md(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&y_(o,t);break;case 24:Co(e,t,n,r),s&2048&&b_(t.alternate,t);break;default:Co(e,t,n,r)}}function md(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:md(i,o,a,l,s),g0(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState!==null?u._visibility&2?md(i,o,a,l,s):rm(i,o):(u._visibility|=2,md(i,o,a,l,s)),s&&c&2048&&y_(o.alternate,o);break;case 24:md(i,o,a,l,s),s&&c&2048&&b_(o.alternate,o);break;default:md(i,o,a,l,s)}t=t.sibling}}function rm(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:rm(n,r),s&2048&&y_(r.alternate,r);break;case 24:rm(n,r),s&2048&&b_(r.alternate,r);break;default:rm(n,r)}t=t.sibling}}var jf=8192;function ad(e,t,n){if(e.subtreeFlags&jf)for(e=e.child;e!==null;)tI(e,t,n),e=e.sibling}function tI(e,t,n){switch(e.tag){case 26:ad(e,t,n),e.flags&jf&&e.memoizedState!==null&&MF(n,Io,e.memoizedState,e.memoizedProps);break;case 5:ad(e,t,n);break;case 3:case 4:var r=Io;Io=u1(e.stateNode.containerInfo),ad(e,t,n),Io=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=jf,jf=16777216,ad(e,t,n),jf=r):ad(e,t,n));break;default:ad(e,t,n)}}function nI(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 uf(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];us=r,sI(r,e)}nI(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)rI(e),e=e.sibling}function rI(e){switch(e.tag){case 0:case 11:case 15:uf(e),e.flags&2048&&gc(9,e,e.return);break;case 3:uf(e);break;case 12:uf(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,mg(e)):uf(e);break;default:uf(e)}}function mg(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];us=r,sI(r,e)}nI(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:gc(8,t,t.return),mg(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,mg(t));break;default:mg(t)}e=e.sibling}}function sI(e,t){for(;us!==null;){var n=us;switch(n.tag){case 0:case 11:case 15:gc(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:m0(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,us=r;else e:for(n=e;us!==null;){r=us;var s=r.sibling,i=r.return;if(KM(r),r===n){us=null;break e}if(s!==null){s.return=i,us=s;break e}us=i}}}var Hz={getCacheForType:function(e){var t=ks(Br),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ks(Br).controller.signal}},Vz=typeof WeakMap=="function"?WeakMap:Map,En=0,Gn=null,un=null,fn=0,Dn=0,Ii=null,Kl=!1,Nh=!1,w_=!1,ul=0,_r=0,yc=0,bu=0,v_=0,Di=0,oh=0,sm=null,di=null,rv=!1,Ty=0,iI=0,r1=1/0,s1=null,oc=null,Qr=0,ac=null,ah=null,nl=0,sv=0,iv=null,oI=null,im=0,ov=null;function zi(){return En&2&&fn!==0?fn&-fn:zt.T!==null?__():pE()}function aI(){if(Di===0)if(!(fn&536870912)||yn){var e=Q0;Q0<<=1,!(Q0&3932160)&&(Q0=262144),Di=e}else Di=536870912;return e=Hi.current,e!==null&&(e.flags|=32),Di}function yi(e,t,n){(e===Gn&&(Dn===2||Dn===9)||e.cancelPendingCommit!==null)&&(lh(e,0),Yl(e,fn,Di,!1)),d0(e,n),(!(En&2)||e!==Gn)&&(e===Gn&&(!(En&2)&&(bu|=n),_r===4&&Yl(e,fn,Di,!1)),va(e))}function lI(e,t,n){if(En&6)throw Error(ve(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||u0(e,t),s=r?Kz(e,t):y2(e,t,!0),i=r;do{if(s===0){Nh&&!r&&Yl(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Wz(n)){s=y2(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=sm;var l=a.current.memoizedState.isDehydrated;if(l&&(lh(a,o).flags|=256),o=y2(a,o,!1),o!==2){if(w_&&!l){a.errorRecoveryDisabledLanes|=i,bu|=i,s=4;break e}i=di,di=s,i!==null&&(di===null?di=i:di.push.apply(di,i))}s=o}if(i=!1,s!==2)continue}}if(s===1){lh(e,0),Yl(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(ve(345));case 4:if((t&4194048)!==t)break;case 6:Yl(r,t,Di,!Kl);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(ve(329))}if((t&62914560)===t&&(s=Ty+300-Bi(),10<s)){if(Yl(r,t,Di,!Kl),my(r,0,!0)!==0)break e;nl=t,r.timeoutHandle=EI(v8.bind(null,r,n,di,s1,rv,t,Di,bu,oh,Kl,i,"Throttled",-0,0),s);break e}v8(r,n,di,s1,rv,t,Di,bu,oh,Kl,i,null,-0,0)}}break}while(!0);va(e)}function v8(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:Ya},tI(t,i,d);var p=(i&62914560)===i?Ty-Bi():(i&4194048)===i?iI-Bi():0;if(p=IF(d,p),p!==null){nl=i,e.cancelPendingCommit=p(_8.bind(null,e,t,i,n,r,s,o,a,l,u,d,null,f,m)),Yl(e,i,o,!c);return}}_8(e,t,i,n,r,s,o,a,l)}function Wz(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(!Ui(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 Yl(e,t,n,r){t&=~v_,t&=~bu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-$i(s),o=1<<i;r[i]=-1,s&=~o}n!==0&&hE(e,n,t)}function Cy(){return En&6?!0:(y0(0),!1)}function x_(){if(un!==null){if(Dn===0)var e=un.return;else e=un,Xa=qu=null,o_(e),qd=null,Im=0,e=un;for(;e!==null;)FM(e.alternate,e),e=e.return;un=null}}function lh(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,hF(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),nl=0,x_(),Gn=e,un=n=el(e.current,null),fn=t,Dn=0,Ii=null,Kl=!1,Nh=u0(e,t),w_=!1,oh=Di=v_=bu=yc=_r=0,di=sm=null,rv=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var s=31-$i(r),i=1<<s;t|=e[s],r&=~i}return ul=t,by(),n}function cI(e,t){Zt=null,zt.H=Rm,t===Ih||t===vy?(t=J6(),Dn=3):t===Z3?(t=J6(),Dn=4):Dn=t===p_?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ii=t,un===null&&(_r=1,e1(e,lo(t,e.current)))}function uI(){var e=Hi.current;return e===null?!0:(fn&4194048)===fn?po===null:(fn&62914560)===fn||fn&536870912?e===po:!1}function dI(){var e=zt.H;return zt.H=Rm,e===null?Rm:e}function hI(){var e=zt.A;return zt.A=Hz,e}function i1(){_r=4,Kl||(fn&4194048)!==fn&&Hi.current!==null||(Nh=!0),!(yc&134217727)&&!(bu&134217727)||Gn===null||Yl(Gn,fn,Di,!1)}function y2(e,t,n){var r=En;En|=2;var s=dI(),i=hI();(Gn!==e||fn!==t)&&(s1=null,lh(e,t)),t=!1;var o=_r;e:do try{if(Dn!==0&&un!==null){var a=un,l=Ii;switch(Dn){case 8:x_(),o=6;break e;case 3:case 2:case 9:case 6:Hi.current===null&&(t=!0);var c=Dn;if(Dn=0,Ii=null,Nd(e,a,l,c),n&&Nh){o=0;break e}break;default:c=Dn,Dn=0,Ii=null,Nd(e,a,l,c)}}Gz(),o=_r;break}catch(u){cI(e,u)}while(!0);return t&&e.shellSuspendCounter++,Xa=qu=null,En=r,zt.H=s,zt.A=i,un===null&&(Gn=null,fn=0,by()),o}function Gz(){for(;un!==null;)fI(un)}function Kz(e,t){var n=En;En|=2;var r=dI(),s=hI();Gn!==e||fn!==t?(s1=null,r1=Bi()+500,lh(e,t)):Nh=u0(e,t);e:do try{if(Dn!==0&&un!==null){t=un;var i=Ii;t:switch(Dn){case 1:Dn=0,Ii=null,Nd(e,t,i,1);break;case 2:case 9:if(Q6(i)){Dn=0,Ii=null,x8(t);break}t=function(){Dn!==2&&Dn!==9||Gn!==e||(Dn=7),va(e)},i.then(t,t);break e;case 3:Dn=7;break e;case 4:Dn=5;break e;case 7:Q6(i)?(Dn=0,Ii=null,x8(t)):(Dn=0,Ii=null,Nd(e,t,i,7));break;case 5:var o=null;switch(un.tag){case 26:o=un.memoizedState;case 5:case 27:var a=un;if(o?LI(o):a.stateNode.complete){Dn=0,Ii=null;var l=a.sibling;if(l!==null)un=l;else{var c=a.return;c!==null?(un=c,Ay(c)):un=null}break t}}Dn=0,Ii=null,Nd(e,t,i,5);break;case 6:Dn=0,Ii=null,Nd(e,t,i,6);break;case 8:x_(),_r=6;break e;default:throw Error(ve(462))}}Yz();break}catch(u){cI(e,u)}while(!0);return Xa=qu=null,zt.H=r,zt.A=s,En=n,un!==null?0:(Gn=null,fn=0,by(),_r)}function Yz(){for(;un!==null&&!b$();)fI(un)}function fI(e){var t=zM(e.alternate,e,ul);e.memoizedProps=e.pendingProps,t===null?Ay(e):un=t}function x8(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=m8(n,t,t.pendingProps,t.type,void 0,fn);break;case 11:t=m8(n,t,t.pendingProps,t.type.render,t.ref,fn);break;case 5:o_(t);default:FM(n,t),t=un=FE(t,ul),t=zM(n,t,ul)}e.memoizedProps=e.pendingProps,t===null?Ay(e):un=t}function Nd(e,t,n,r){Xa=qu=null,o_(t),qd=null,Im=0;var s=t.return;try{if(Bz(e,s,t,n,fn)){_r=1,e1(e,lo(n,e.current)),un=null;return}}catch(i){if(s!==null)throw un=s,i;_r=1,e1(e,lo(n,e.current)),un=null;return}t.flags&32768?(yn||r===1?e=!0:Nh||fn&536870912?e=!1:(Kl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Hi.current,r!==null&&r.tag===13&&(r.flags|=16384))),mI(t,e)):Ay(t)}function Ay(e){var t=e;do{if(t.flags&32768){mI(t,Kl);return}e=t.return;var n=zz(t.alternate,t,ul);if(n!==null){un=n;return}if(t=t.sibling,t!==null){un=t;return}un=t=e}while(t!==null);_r===0&&(_r=5)}function mI(e,t){do{var n=Fz(e.alternate,e);if(n!==null){n.flags&=32767,un=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){un=e;return}un=e=n}while(e!==null);_r=6,un=null}function _8(e,t,n,r,s,i,o,a,l){e.cancelPendingCommit=null;do Ey();while(Qr!==0);if(En&6)throw Error(ve(327));if(t!==null){if(t===e.current)throw Error(ve(177));if(i=t.lanes|t.childLanes,i|=W3,E$(e,n,i,o,a,l),e===Gn&&(un=Gn=null,fn=0),ah=t,ac=e,nl=n,sv=i,iv=s,oI=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Zz(Ug,function(){return wI(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=zt.T,zt.T=null,s=In.p,In.p=2,o=En,En|=4;try{qz(e,t,n)}finally{En=o,In.p=s,zt.T=r}}Qr=1,pI(),gI(),yI()}}function pI(){if(Qr===1){Qr=0;var e=ac,t=ah,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=zt.T,zt.T=null;var r=In.p;In.p=2;var s=En;En|=4;try{JM(t,e);var i=uv,o=LE(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&RE(a.ownerDocument.documentElement,a)){if(l!==null&&V3(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=H6(a,y),w=H6(a,v);if(b&&w&&(m.rangeCount!==1||m.anchorNode!==b.node||m.anchorOffset!==b.offset||m.focusNode!==w.node||m.focusOffset!==w.offset)){var x=d.createRange();x.setStart(b.node,b.offset),m.removeAllRanges(),y>v?(m.addRange(x),m.extend(w.node,w.offset)):(x.setEnd(w.node,w.offset),m.addRange(x))}}}}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}}f1=!!cv,uv=cv=null}finally{En=s,In.p=r,zt.T=n}}e.current=t,Qr=2}}function gI(){if(Qr===2){Qr=0;var e=ac,t=ah,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=zt.T,zt.T=null;var r=In.p;In.p=2;var s=En;En|=4;try{GM(e,t.alternate,t)}finally{En=s,In.p=r,zt.T=n}}Qr=3}}function yI(){if(Qr===4||Qr===3){Qr=0,w$();var e=ac,t=ah,n=nl,r=oI;t.subtreeFlags&10256||t.flags&10256?Qr=5:(Qr=0,ah=ac=null,bI(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(oc=null),P3(n),t=t.stateNode,Pi&&typeof Pi.onCommitFiberRoot=="function")try{Pi.onCommitFiberRoot(c0,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=zt.T,s=In.p,In.p=2,zt.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{zt.T=t,In.p=s}}nl&3&&Ey(),va(e),s=e.pendingLanes,n&261930&&s&42?e===ov?im++:(im=0,ov=e):im=0,y0(0)}}function bI(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,m0(t)))}function Ey(){return pI(),gI(),yI(),wI()}function wI(){if(Qr!==5)return!1;var e=ac,t=sv;sv=0;var n=P3(nl),r=zt.T,s=In.p;try{In.p=32>n?32:n,zt.T=null,n=iv,iv=null;var i=ac,o=nl;if(Qr=0,ah=ac=null,nl=0,En&6)throw Error(ve(331));var a=En;if(En|=4,rI(i.current),eI(i,i.current,o,n),En=a,y0(0,!1),Pi&&typeof Pi.onPostCommitFiberRoot=="function")try{Pi.onPostCommitFiberRoot(c0,i)}catch{}return!0}finally{In.p=s,zt.T=r,bI(e,t)}}function k8(e,t,n){t=lo(n,t),t=Z4(e.stateNode,t,2),e=ic(e,t,2),e!==null&&(d0(e,2),va(e))}function Bn(e,t,n){if(e.tag===3)k8(e,e,n);else for(;t!==null;){if(t.tag===3){k8(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(oc===null||!oc.has(r))){e=lo(n,e),n=jM(2),r=ic(t,n,2),r!==null&&(DM(n,r,t,e),d0(r,2),va(r));break}}t=t.return}}function b2(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Vz;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)||(w_=!0,s.add(n),e=Xz.bind(null,e,t,n),t.then(e,e))}function Xz(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Gn===e&&(fn&n)===n&&(_r===4||_r===3&&(fn&62914560)===fn&&300>Bi()-Ty?!(En&2)&&lh(e,0):v_|=n,oh===fn&&(oh=0)),va(e)}function vI(e,t){t===0&&(t=dE()),e=Fu(e,t),e!==null&&(d0(e,t),va(e))}function Qz(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vI(e,n)}function Jz(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(ve(314))}r!==null&&r.delete(t),vI(e,n)}function Zz(e,t){return O3(e,t)}var o1=null,pd=null,av=!1,a1=!1,w2=!1,Xl=0;function va(e){e!==pd&&e.next===null&&(pd===null?o1=pd=e:pd=pd.next=e),a1=!0,av||(av=!0,tF())}function y0(e,t){if(!w2&&a1){w2=!0;do for(var n=!1,r=o1;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-$i(42|e)+1)-1,i&=s&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,S8(r,i))}else i=fn,i=my(r,r===Gn?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||u0(r,i)||(n=!0,S8(r,i));r=r.next}while(n);w2=!1}}function eF(){xI()}function xI(){a1=av=!1;var e=0;Xl!==0&&dF()&&(e=Xl);for(var t=Bi(),n=null,r=o1;r!==null;){var s=r.next,i=_I(r,t);i===0?(r.next=null,n===null?o1=s:n.next=s,s===null&&(pd=n)):(n=r,(e!==0||i&3)&&(a1=!0)),r=s}Qr!==0&&Qr!==5||y0(e),Xl!==0&&(Xl=0)}function _I(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-$i(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=A$(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=Gn,n=fn,n=my(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Dn===2||Dn===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Gb(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||u0(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Gb(r),P3(n)){case 2:case 8:n=cE;break;case 32:n=Ug;break;case 268435456:n=uE;break;default:n=Ug}return r=kI.bind(null,e),n=O3(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Gb(r),e.callbackPriority=2,e.callbackNode=null,2}function kI(e,t){if(Qr!==0&&Qr!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ey()&&e.callbackNode!==n)return null;var r=fn;return r=my(e,e===Gn?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(lI(e,r,t),_I(e,Bi()),e.callbackNode!=null&&e.callbackNode===n?kI.bind(null,e):null)}function S8(e,t){if(Ey())return null;lI(e,t,!0)}function tF(){fF(function(){En&6?O3(lE,eF):xI()})}function __(){if(Xl===0){var e=rh;e===0&&(e=X0,X0<<=1,!(X0&261888)&&(X0=256)),Xl=e}return Xl}function T8(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ig(""+e)}function C8(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 nF(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=T8((s[wi]||null).action),o=r.submitter;o&&(t=(t=o[wi]||null)?T8(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new py("action","action",null,r,s);e.push({event:a,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Xl!==0){var l=o?C8(s,o):new FormData(s);Q4(n,{pending:!0,data:l,method:s.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?C8(s,o):new FormData(s),Q4(n,{pending:!0,data:l,method:s.method,action:i},i,l))},currentTarget:s}]})}}for(var v2=0;v2<$4.length;v2++){var x2=$4[v2],rF=x2.toLowerCase(),sF=x2[0].toUpperCase()+x2.slice(1);Oo(rF,"on"+sF)}Oo(DE,"onAnimationEnd");Oo(OE,"onAnimationIteration");Oo(BE,"onAnimationStart");Oo("dblclick","onDoubleClick");Oo("focusin","onFocus");Oo("focusout","onBlur");Oo(vz,"onTransitionRun");Oo(xz,"onTransitionStart");Oo(_z,"onTransitionCancel");Oo(PE,"onTransitionEnd");th("onMouseEnter",["mouseout","mouseover"]);th("onMouseLeave",["mouseout","mouseover"]);th("onPointerEnter",["pointerout","pointerover"]);th("onPointerLeave",["pointerout","pointerover"]);Pu("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Pu("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Pu("onBeforeInput",["compositionend","keypress","textInput","paste"]);Pu("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Pu("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Pu("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Lm="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(" "),iF=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Lm));function SI(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){Vg(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){Vg(u)}s.currentTarget=null,i=l}}}}function cn(e,t){var n=t[N4];n===void 0&&(n=t[N4]=new Set);var r=e+"__bubble";n.has(r)||(TI(t,e,2,!1),n.add(r))}function _2(e,t,n){var r=0;t&&(r|=4),TI(n,e,r,t)}var op="_reactListening"+Math.random().toString(36).slice(2);function k_(e){if(!e[op]){e[op]=!0,gE.forEach(function(n){n!=="selectionchange"&&(iF.has(n)||_2(n,!1,e),_2(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[op]||(t[op]=!0,_2("selectionchange",!1,t))}}function TI(e,t,n,r){switch(PI(t)){case 2:var s=LF;break;case 8:s=jF;break;default:s=A_}n=s.bind(null,t,n,e),s=void 0,!O4||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 k2(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=_d(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}SE(function(){var c=i,u=F3(n),d=[];e:{var f=$E.get(e);if(f!==void 0){var m=py,p=e;switch(e){case"keypress":if(ag(n)===0)break e;case"keydown":case"keyup":m=J$;break;case"focusin":p="focus",m=Jb;break;case"focusout":p="blur",m=Jb;break;case"beforeblur":case"afterblur":m=Jb;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=j6;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=z$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=tz;break;case DE:case OE:case BE:m=U$;break;case PE:m=rz;break;case"scroll":case"scrollend":m=P$;break;case"wheel":m=iz;break;case"copy":case"cut":case"paste":m=V$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=O6;break;case"toggle":case"beforetoggle":m=az}var y=(t&4)!==0,v=!y&&(e==="scroll"||e==="scrollend"),b=y?f!==null?f+"Capture":null:f;y=[];for(var w=c,x;w!==null;){var k=w;if(x=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||x===null||b===null||(k=Tm(w,b),k!=null&&y.push(jm(w,k,x))),v)break;w=w.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!==D4&&(p=n.relatedTarget||n.fromElement)&&(_d(p)||p[Ah]))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?_d(p):null,p!==null&&(v=l0(p),y=p.tag,p!==v||y!==5&&y!==27&&y!==6)&&(p=null)):(m=null,p=c),m!==p)){if(y=j6,k="onMouseLeave",b="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(y=O6,k="onPointerLeave",b="onPointerEnter",w="pointer"),v=m==null?f:Rf(m),x=p==null?f:Rf(p),f=new y(k,w+"leave",m,n,u),f.target=v,f.relatedTarget=x,k=null,_d(u)===c&&(y=new y(b,w+"enter",p,n,u),y.target=x,y.relatedTarget=v,k=y),v=k,m&&p)t:{for(y=oF,b=m,w=p,x=0,k=b;k;k=y(k))x++;k=0;for(var T=w;T;T=y(T))k++;for(;0<x-k;)b=y(b),x--;for(;0<k-x;)w=y(w),k--;for(;x--;){if(b===w||w!==null&&b===w.alternate){y=b;break t}b=y(b),w=y(w)}y=null}else y=null;m!==null&&A8(d,f,m,y,!1),p!==null&&v!==null&&A8(d,v,p,y,!0)}}e:{if(f=c?Rf(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var A=z6;else if($6(f))if(IE)A=yz;else{A=pz;var M=mz}else m=f.nodeName,!m||m.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&z3(c.elementType)&&(A=z6):A=gz;if(A&&(A=A(e,c))){ME(d,A,n,u);break e}M&&M(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&j4(f,"number",f.value)}switch(M=c?Rf(c):window,e){case"focusin":($6(M)||M.contentEditable==="true")&&(Td=M,B4=c,Xf=null);break;case"focusout":Xf=B4=Td=null;break;case"mousedown":P4=!0;break;case"contextmenu":case"mouseup":case"dragend":P4=!1,V6(d,n,u);break;case"selectionchange":if(wz)break;case"keydown":case"keyup":V6(d,n,u)}var D;if(H3)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else Sd?AE(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(CE&&n.locale!=="ko"&&(Sd||O!=="onCompositionStart"?O==="onCompositionEnd"&&Sd&&(D=TE()):(Gl=u,q3="value"in Gl?Gl.value:Gl.textContent,Sd=!0)),M=l1(c,O),0<M.length&&(O=new D6(O,e,null,n,u),d.push({event:O,listeners:M}),D?O.data=D:(D=EE(n),D!==null&&(O.data=D)))),(D=cz?uz(e,n):dz(e,n))&&(O=l1(c,"onBeforeInput"),0<O.length&&(M=new D6("onBeforeInput","beforeinput",null,n,u),d.push({event:M,listeners:O}),M.data=D)),nF(d,e,c,n,u)}SI(d,t)})}function jm(e,t,n){return{instance:e,listener:t,currentTarget:n}}function l1(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=Tm(e,n),s!=null&&r.unshift(jm(e,s,i)),s=Tm(e,t),s!=null&&r.push(jm(e,s,i))),e.tag===3)return r;e=e.return}return[]}function oF(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function A8(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=Tm(n,i),c!=null&&o.unshift(jm(n,c,l))):s||(c=Tm(n,i),c!=null&&o.push(jm(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var aF=/\r\n?/g,lF=/\u0000|\uFFFD/g;function E8(e){return(typeof e=="string"?e:""+e).replace(aF,`
`).replace(lF,"")}function CI(e,t){return t=E8(t),E8(e)===t}function zn(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||nh(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&nh(e,""+r);break;case"className":Z0(e,"class",r);break;case"tabIndex":Z0(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Z0(e,n,r);break;case"style":kE(e,r,i);break;case"data":if(t!=="object"){Z0(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=ig(""+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"&&zn(e,t,"name",s.name,s,null),zn(e,t,"formEncType",s.formEncType,s,null),zn(e,t,"formMethod",s.formMethod,s,null),zn(e,t,"formTarget",s.formTarget,s,null)):(zn(e,t,"encType",s.encType,s,null),zn(e,t,"method",s.method,s,null),zn(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=ig(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=Ya);break;case"onScroll":r!=null&&cn("scroll",e);break;case"onScrollEnd":r!=null&&cn("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(ve(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(ve(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=ig(""+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":cn("beforetoggle",e),cn("toggle",e),sg(e,"popover",r);break;case"xlinkActuate":La(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":La(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":La(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":La(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":La(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":La(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":La(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":La(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":La(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":sg(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=O$.get(n)||n,sg(e,n,r))}}function lv(e,t,n,r,s,i){switch(n){case"style":kE(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(ve(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(ve(60));e.innerHTML=n}}break;case"children":typeof r=="string"?nh(e,r):(typeof r=="number"||typeof r=="bigint")&&nh(e,""+r);break;case"onScroll":r!=null&&cn("scroll",e);break;case"onScrollEnd":r!=null&&cn("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Ya);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yE.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[wi]||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,""):sg(e,n,r)}}}function Ts(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":cn("error",e),cn("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(ve(137,t));default:zn(e,t,i,o,n,null)}}s&&zn(e,t,"srcSet",n.srcSet,n,null),r&&zn(e,t,"src",n.src,n,null);return;case"input":cn("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(ve(137,t));break;default:zn(e,t,r,u,n,null)}}vE(e,i,a,l,c,o,s,!1);return;case"select":cn("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:zn(e,t,s,a,n,null)}t=i,n=o,e.multiple=!!r,t!=null?$d(e,!!r,t,!1):n!=null&&$d(e,!!r,n,!0);return;case"textarea":cn("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(ve(91));break;default:zn(e,t,o,a,n,null)}_E(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:zn(e,t,l,r,n,null)}return;case"dialog":cn("beforetoggle",e),cn("toggle",e),cn("cancel",e),cn("close",e);break;case"iframe":case"object":cn("load",e);break;case"video":case"audio":for(r=0;r<Lm.length;r++)cn(Lm[r],e);break;case"image":cn("error",e),cn("load",e);break;case"details":cn("toggle",e);break;case"embed":case"source":case"link":cn("error",e),cn("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(ve(137,t));default:zn(e,t,c,r,n,null)}return;default:if(z3(t)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&lv(e,t,u,r,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null&&zn(e,t,a,r,n,null))}function cF(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)||zn(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(ve(137,t));break;default:m!==d&&zn(e,t,f,m,r,d)}}L4(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)||zn(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&&zn(e,t,s,i,r,l)}t=a,n=o,r=m,f!=null?$d(e,!!n,f,!1):!!r!=!!n&&(t!=null?$d(e,!!n,t,!0):$d(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:zn(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(ve(91));break;default:s!==i&&zn(e,t,o,s,r,i)}xE(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:zn(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:zn(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)&&zn(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(ve(137,t));break;default:zn(e,t,c,f,r,m)}return;default:if(z3(t)){for(var v in n)f=n[v],n.hasOwnProperty(v)&&f!==void 0&&!r.hasOwnProperty(v)&&lv(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||lv(e,t,u,f,r,m);return}}for(var b in n)f=n[b],n.hasOwnProperty(b)&&f!=null&&!r.hasOwnProperty(b)&&zn(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||zn(e,t,d,f,r,m)}function M8(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function uF(){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&&M8(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&&M8(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 cv=null,uv=null;function c1(e){return e.nodeType===9?e:e.ownerDocument}function I8(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 AI(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 dv(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 S2=null;function dF(){var e=window.event;return e&&e.type==="popstate"?e===S2?!1:(S2=e,!0):(S2=null,!1)}var EI=typeof setTimeout=="function"?setTimeout:void 0,hF=typeof clearTimeout=="function"?clearTimeout:void 0,N8=typeof Promise=="function"?Promise:void 0,fF=typeof queueMicrotask=="function"?queueMicrotask:typeof N8<"u"?function(e){return N8.resolve(null).then(e).catch(mF)}:EI;function mF(e){setTimeout(function(){throw e})}function Ic(e){return e==="head"}function R8(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),uh(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")om(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,om(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[h0]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&om(e.ownerDocument.body);n=s}while(n);uh(t)}function L8(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 hv(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":hv(n),$3(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function pF(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[h0])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=go(e.nextSibling),e===null)break}return null}function gF(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=go(e.nextSibling),e===null))return null;return e}function MI(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=go(e.nextSibling),e===null))return null;return e}function fv(e){return e.data==="$?"||e.data==="$~"}function mv(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function yF(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 go(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 pv=null;function j8(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return go(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function D8(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 II(e,t,n){switch(t=c1(n),e){case"html":if(e=t.documentElement,!e)throw Error(ve(452));return e;case"head":if(e=t.head,!e)throw Error(ve(453));return e;case"body":if(e=t.body,!e)throw Error(ve(454));return e;default:throw Error(ve(451))}}function om(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);$3(e)}var bo=new Map,O8=new Set;function u1(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var pl=In.d;In.d={f:bF,r:wF,D:vF,C:xF,L:_F,m:kF,X:TF,S:SF,M:CF};function bF(){var e=pl.f(),t=Cy();return e||t}function wF(e){var t=Eh(e);t!==null&&t.tag===5&&t.type==="form"?kM(t):pl.r(e)}var Rh=typeof document>"u"?null:document;function NI(e,t,n){var r=Rh;if(r&&typeof t=="string"&&t){var s=ao(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),O8.has(s)||(O8.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),Ts(t,"link",e),ds(t),r.head.appendChild(t)))}}function vF(e){pl.D(e),NI("dns-prefetch",e,null)}function xF(e,t){pl.C(e,t),NI("preconnect",e,t)}function _F(e,t,n){pl.L(e,t,n);var r=Rh;if(r&&e&&t){var s='link[rel="preload"][as="'+ao(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+ao(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+ao(n.imageSizes)+'"]')):s+='[href="'+ao(e)+'"]';var i=s;switch(t){case"style":i=ch(e);break;case"script":i=Lh(e)}bo.has(i)||(e=ir({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),bo.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(b0(i))||t==="script"&&r.querySelector(w0(i))||(t=r.createElement("link"),Ts(t,"link",e),ds(t),r.head.appendChild(t)))}}function kF(e,t){pl.m(e,t);var n=Rh;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+ao(r)+'"][href="'+ao(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=Lh(e)}if(!bo.has(i)&&(e=ir({rel:"modulepreload",href:e},t),bo.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(w0(i)))return}r=n.createElement("link"),Ts(r,"link",e),ds(r),n.head.appendChild(r)}}}function SF(e,t,n){pl.S(e,t,n);var r=Rh;if(r&&e){var s=Pd(r).hoistableStyles,i=ch(e);t=t||"default";var o=s.get(i);if(!o){var a={loading:0,preload:null};if(o=r.querySelector(b0(i)))a.loading=5;else{e=ir({rel:"stylesheet",href:e,"data-precedence":t},n),(n=bo.get(i))&&S_(e,n);var l=o=r.createElement("link");ds(l),Ts(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,pg(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:a},s.set(i,o)}}}function TF(e,t){pl.X(e,t);var n=Rh;if(n&&e){var r=Pd(n).hoistableScripts,s=Lh(e),i=r.get(s);i||(i=n.querySelector(w0(s)),i||(e=ir({src:e,async:!0},t),(t=bo.get(s))&&T_(e,t),i=n.createElement("script"),ds(i),Ts(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function CF(e,t){pl.M(e,t);var n=Rh;if(n&&e){var r=Pd(n).hoistableScripts,s=Lh(e),i=r.get(s);i||(i=n.querySelector(w0(s)),i||(e=ir({src:e,async:!0,type:"module"},t),(t=bo.get(s))&&T_(e,t),i=n.createElement("script"),ds(i),Ts(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function B8(e,t,n,r){var s=(s=nc.current)?u1(s):null;if(!s)throw Error(ve(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=ch(n.href),n=Pd(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=ch(n.href);var i=Pd(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(b0(e)))&&!i._p&&(o.instance=i,o.state.loading=5),bo.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},bo.set(e,n),i||AF(s,e,n,o.state))),t&&r===null)throw Error(ve(528,""));return o}if(t&&r!==null)throw Error(ve(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Lh(n),n=Pd(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(ve(444,e))}}function ch(e){return'href="'+ao(e)+'"'}function b0(e){return'link[rel="stylesheet"]['+e+"]"}function RI(e){return ir({},e,{"data-precedence":e.precedence,precedence:null})}function AF(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}),Ts(t,"link",n),ds(t),e.head.appendChild(t))}function Lh(e){return'[src="'+ao(e)+'"]'}function w0(e){return"script[async]"+e}function P8(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+ao(n.href)+'"]');if(r)return t.instance=r,ds(r),r;var s=ir({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),ds(r),Ts(r,"style",s),pg(r,n.precedence,e),t.instance=r;case"stylesheet":s=ch(n.href);var i=e.querySelector(b0(s));if(i)return t.state.loading|=4,t.instance=i,ds(i),i;r=RI(n),(s=bo.get(s))&&S_(r,s),i=(e.ownerDocument||e).createElement("link"),ds(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ts(i,"link",r),t.state.loading|=4,pg(i,n.precedence,e),t.instance=i;case"script":return i=Lh(n.src),(s=e.querySelector(w0(i)))?(t.instance=s,ds(s),s):(r=n,(s=bo.get(i))&&(r=ir({},n),T_(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),ds(s),Ts(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(ve(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,pg(r,n.precedence,e));return t.instance}function pg(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 S_(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function T_(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var gg=null;function $8(e,t,n){if(gg===null){var r=new Map,s=gg=new Map;s.set(n,r)}else s=gg,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[h0]||i[xs]||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 z8(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function EF(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 LI(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function MF(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=ch(r.href),i=t.querySelector(b0(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=d1.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,ds(i);return}i=t.ownerDocument||t,r=RI(r),(s=bo.get(s))&&S_(r,s),i=i.createElement("link"),ds(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),Ts(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=d1.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var T2=0;function IF(e,t){return e.stylesheets&&e.count===0&&yg(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&yg(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&T2===0&&(T2=62500*uF());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&yg(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>T2?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function d1(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yg(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var h1=null;function yg(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,h1=new Map,t.forEach(NF,e),h1=null,d1.call(e))}function NF(e,t){if(!(t.state.loading&4)){var n=h1.get(e);if(n)var r=n.get(null);else{n=new Map,h1.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=d1.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 Dm={$$typeof:Ka,Provider:null,Consumer:null,_currentValue:mu,_currentValue2:mu,_threadCount:0};function RF(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=Kb(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kb(0),this.hiddenUpdates=Kb(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 jI(e,t,n,r,s,i,o,a,l,c,u,d){return e=new RF(e,t,n,o,l,c,u,d,a),t=1,i===!0&&(t|=24),i=Li(3,null,null,t),e.current=i,i.stateNode=e,t=Q3(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},e_(i),e}function DI(e){return e?(e=Ed,e):Ed}function OI(e,t,n,r,s,i){s=DI(s),r.context===null?r.context=s:r.pendingContext=s,r=sc(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=ic(e,r,t),n!==null&&(yi(n,e,t),Jf(n,e,t))}function F8(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function C_(e,t){F8(e,t),(e=e.alternate)&&F8(e,t)}function BI(e){if(e.tag===13||e.tag===31){var t=Fu(e,67108864);t!==null&&yi(t,e,67108864),C_(e,67108864)}}function q8(e){if(e.tag===13||e.tag===31){var t=zi();t=B3(t);var n=Fu(e,t);n!==null&&yi(n,e,t),C_(e,t)}}var f1=!0;function LF(e,t,n,r){var s=zt.T;zt.T=null;var i=In.p;try{In.p=2,A_(e,t,n,r)}finally{In.p=i,zt.T=s}}function jF(e,t,n,r){var s=zt.T;zt.T=null;var i=In.p;try{In.p=8,A_(e,t,n,r)}finally{In.p=i,zt.T=s}}function A_(e,t,n,r){if(f1){var s=gv(r);if(s===null)k2(e,t,r,m1,n),U8(e,r);else if(OF(s,e,t,n,r))r.stopPropagation();else if(U8(e,r),t&4&&-1<DF.indexOf(e)){for(;s!==null;){var i=Eh(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=Xc(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-$i(o);a.entanglements[1]|=l,o&=~l}va(i),!(En&6)&&(r1=Bi()+500,y0(0))}}break;case 31:case 13:a=Fu(i,2),a!==null&&yi(a,i,2),Cy(),C_(i,2)}if(i=gv(r),i===null&&k2(e,t,r,m1,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else k2(e,t,r,null,n)}}function gv(e){return e=F3(e),E_(e)}var m1=null;function E_(e){if(m1=null,e=_d(e),e!==null){var t=l0(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=rE(t),e!==null)return e;e=null}else if(n===31){if(e=sE(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 m1=e,null}function PI(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(v$()){case lE:return 2;case cE:return 8;case Ug:case x$:return 32;case uE:return 268435456;default:return 32}default:return 32}}var yv=!1,lc=null,cc=null,uc=null,Om=new Map,Bm=new Map,Ul=[],DF="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 U8(e,t){switch(e){case"focusin":case"focusout":lc=null;break;case"dragenter":case"dragleave":cc=null;break;case"mouseover":case"mouseout":uc=null;break;case"pointerover":case"pointerout":Om.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bm.delete(t.pointerId)}}function df(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=Eh(t),t!==null&&BI(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function OF(e,t,n,r,s){switch(t){case"focusin":return lc=df(lc,e,t,n,r,s),!0;case"dragenter":return cc=df(cc,e,t,n,r,s),!0;case"mouseover":return uc=df(uc,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Om.set(i,df(Om.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Bm.set(i,df(Bm.get(i)||null,e,t,n,r,s)),!0}return!1}function $I(e){var t=_d(e.target);if(t!==null){var n=l0(t);if(n!==null){if(t=n.tag,t===13){if(t=rE(n),t!==null){e.blockedOn=t,A6(e.priority,function(){q8(n)});return}}else if(t===31){if(t=sE(n),t!==null){e.blockedOn=t,A6(e.priority,function(){q8(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 bg(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gv(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);D4=r,n.target.dispatchEvent(r),D4=null}else return t=Eh(n),t!==null&&BI(t),e.blockedOn=n,!1;t.shift()}return!0}function H8(e,t,n){bg(e)&&n.delete(t)}function BF(){yv=!1,lc!==null&&bg(lc)&&(lc=null),cc!==null&&bg(cc)&&(cc=null),uc!==null&&bg(uc)&&(uc=null),Om.forEach(H8),Bm.forEach(H8)}function ap(e,t){e.blockedOn===t&&(e.blockedOn=null,yv||(yv=!0,Zr.unstable_scheduleCallback(Zr.unstable_NormalPriority,BF)))}var lp=null;function V8(e){lp!==e&&(lp=e,Zr.unstable_scheduleCallback(Zr.unstable_NormalPriority,function(){lp===e&&(lp=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(E_(r||n)===null)continue;break}var i=Eh(n);i!==null&&(e.splice(t,3),t-=3,Q4(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function uh(e){function t(l){return ap(l,e)}lc!==null&&ap(lc,e),cc!==null&&ap(cc,e),uc!==null&&ap(uc,e),Om.forEach(t),Bm.forEach(t);for(var n=0;n<Ul.length;n++){var r=Ul[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ul.length&&(n=Ul[0],n.blockedOn===null);)$I(n),n.blockedOn===null&&Ul.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[wi]||null;if(typeof i=="function")o||V8(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(s=i,o=i[wi]||null)a=o.formAction;else if(E_(s)!==null)continue}else a=o.action;typeof a=="function"?n[r+1]=a:(n.splice(r,3),r-=3),V8(n)}}}function zI(){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 M_(e){this._internalRoot=e}My.prototype.render=M_.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ve(409));var n=t.current,r=zi();OI(n,r,e,t,null,null)};My.prototype.unmount=M_.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;OI(e.current,2,null,e,null,null),Cy(),t[Ah]=null}};function My(e){this._internalRoot=e}My.prototype.unstable_scheduleHydration=function(e){if(e){var t=pE();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ul.length&&t!==0&&t<Ul[n].priority;n++);Ul.splice(n,0,e),n===0&&$I(e)}};var W8=tE.version;if(W8!=="19.2.4")throw Error(ve(527,W8,"19.2.4"));In.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ve(188)):(e=Object.keys(e).join(","),Error(ve(268,e)));return e=f$(t),e=e!==null?iE(e):null,e=e===null?null:e.stateNode,e};var PF={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:zt,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cp.isDisabled&&cp.supportsFiber)try{c0=cp.inject(PF),Pi=cp}catch{}}dy.createRoot=function(e,t){if(!nE(e))throw Error(ve(299));var n=!1,r="",s=NM,i=RM,o=LM;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=jI(e,1,!1,null,null,n,r,null,s,i,o,zI),e[Ah]=t.current,k_(e),new M_(t)};dy.hydrateRoot=function(e,t,n){if(!nE(e))throw Error(ve(299));var r=!1,s="",i=NM,o=RM,a=LM,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=jI(e,1,!0,t,n??null,r,s,l,i,o,a,zI),t.context=DI(null),n=t.current,r=zi(),r=B3(r),s=sc(r),s.callback=null,ic(n,s,r),n=r,t.current.lanes=n,d0(t,n),va(t),e[Ah]=t.current,k_(e),new My(t)};dy.version="19.2.4";function FI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(FI)}catch(e){console.error(e)}}FI(),YA.exports=dy;var $F=YA.exports;const zF=cy($F);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const FF="agent";function qF(e){return e===FF}var UF=3e4,HF=new Set(["authorized","expired","error","cancelled"]),VF=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 WF(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 WF(e,t,n,r){return await GF(e,t,n,r)}async function G8(e,t,n,r){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:r})}catch(s){if(s instanceof Iu&&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 K8(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function GF(e,t,n,r){var u;let s=r.signal,i=K8(r.timeoutMs,{allowZero:!0}),o=K8(r.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+UF,l=Math.max(1e3,o??t.intervalMs??5e3),c=l;for(;;){if(s!=null&&s.aborted)throw bv(s);if(Date.now()>=a)return await G8(e,t,n,s);let d=await G8(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)),HF.has(d.status))return d;await KF(l,s)}}async function KF(e,t){if(t!=null&&t.aborted)throw bv(t);await new Promise((n,r)=>{let s=setTimeout(()=>{o(),n()},e),i=()=>{o(),r(bv(t))};function o(){clearTimeout(s),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function bv(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var Iu=class extends Error{constructor(n,r,s){super(s);le(this,"status");le(this,"body");this.name="DaemonHttpError",this.status=n,this.body=r}},Y8=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},YF=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},X8=16*1024*1024;async function*XF(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=Q8(s);for(let u of c.frames){let d=C2(u);d&&(yield d)}if(c.tail.length>0){let u=C2(c.tail);u&&(yield u)}}return}if(s+=r.decode(o,{stream:!0}),s.length>X8)throw new YF(`parseSseStream: unread buffer exceeded ${X8} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=Q8(s);if(l.frames.length>0)for(let c of l.frames){let u=C2(c);u&&(yield u)}s=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function Q8(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 C2(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 QF=class{constructor(e,t,n){le(this,"baseUrl");le(this,"token");le(this,"_fetch");le(this,"_disposed",!1);le(this,"type","rest");le(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 Y8;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var u;if(this._disposed)throw new Y8;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?JF([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 Iu(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 Iu(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*XF(l.body,t.signal)}dispose(){this._disposed=!0}};function JF(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 up="/workspace/memory/remember",J8=20,ZF=3e4,eq=65e3,tq=9e4,nq=5,hf=33e4,rq="X-Qwen-Client-Id";function Z8(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function qI(e){if(e===void 0)return nq;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 sq(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function iq(){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 eS=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 UI(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var wv=class{constructor(e){le(this,"baseUrl");le(this,"token");le(this,"_fetch");le(this,"fetchTimeoutMs");le(this,"promptLimit");le(this,"promptCounts",Object.create(null));le(this,"transport");le(this,"_authFlow");this.baseUrl=sq(e.baseUrl),this.token=e.token??iq(),this._fetch=e.fetch??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??ZF;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=qI(e.maxPendingPromptsPerSession),this.transport=e.transport??new QF(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new VF(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 eS(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?tS([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[rq]=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 eS(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new Iu(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 rememberWorkspaceMemory(e,t={}){return await this.jsonRequest(up,`POST ${up}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${up}/${encodeURIComponent(e)}`,`GET ${up}/:taskId`,{clientId:t==null?void 0:t.clientId})}async listWorkspaceAgents(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/agents");return await e.json()})}async createWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify(e)},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents");return await n.json()})}async generateWorkspaceAgent(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({description:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspace/agents/generate");return await n.json()},hf)}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)??J8,r=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:J8))),s=new URLSearchParams({size:String(r)});return(t==null?void 0:t.archiveState)!==void 0&&s.set("archiveState",t.archiveState),(await this.jsonRequest(`/workspace/${encodeURIComponent(e)}/sessions?${s.toString()}`,"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 getPendingPrompts(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/pending-prompts`,{method:"GET",headers:this.headers({},t==null?void 0:t.clientId)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/pending-prompts");return await n.json()})}async removePendingPrompt(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/pending-prompts/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.headers({},n==null?void 0:n.clientId)},async r=>{if(!r.ok)throw await this.failOnError(r,"DELETE /session/:id/pending-prompts/:promptId");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()},eq,"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=Z8(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=Z8(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)??hf)}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)??hf)}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)??hf)}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)??hf)}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:tq})}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?tS([r,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let c=I_(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 detachSession(e,t){if(t)return await this.fetchWithTimeout(`${this.baseUrl}/session/${encodeURIComponent(e)}/detach`,{method:"POST",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,"POST /session/:id/detach")})}async deleteSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/delete`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/delete")})}async archiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/archive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/archive")})}async unarchiveSessionsData(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/sessions/unarchive`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},t),body:JSON.stringify({sessionIds:e})},async n=>{if(n.ok)return await n.json();throw await this.failOnError(n,"POST /sessions/unarchive")})}async startDeviceFlow(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},e.clientId),body:JSON.stringify({providerId:e.providerId})},async t=>{if(t.status!==200&&t.status!==201)throw await this.failOnError(t,"POST /workspace/auth/device-flow");return await t.json()})}async getDeviceFlow(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/auth/device-flow/${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 tS(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 I_(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 Iu(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function nS(e){return"promptId"in e&&"lastEventId"in e}var ff=class wg{constructor(t){le(this,"client");le(this,"session");le(this,"state");le(this,"replaySnapshot");le(this,"hasActivePrompt");le(this,"lastSeenEventId");le(this,"subscriptionActive",!1);le(this,"reattaching");le(this,"promptLimit");le(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=dp(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:qI(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 wg({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 wg({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 wg({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=dp(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)),!nS(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(!nS(r))throw new Error("Expected non-blocking prompt acceptance");return r}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!oq(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 getPendingPrompts(){return await this.client.getPendingPrompts(this.sessionId,{...this.clientId?{clientId:this.clientId}:{}})}async removePendingPrompt(t){return await this.client.removePendingPrompt(this.sessionId,t,{...this.clientId?{clientId:this.clientId}:{}})}async shellCommand(t,n){return await this.client.shellCommand(this.sessionId,t,{...n?{signal:n}:{},...this.clientId?{clientId:this.clientId}:{}})}async context(){return await this.client.sessionContext(this.sessionId,this.clientId)}async contextUsage(t={}){return await this.client.sessionContextUsage(this.sessionId,t,this.clientId)}async supportedCommands(){return await this.client.sessionSupportedCommands(this.sessionId,this.clientId)}async tasks(){return await this.client.sessionTasks(this.sessionId,this.clientId)}async lspStatus(){return await this.client.sessionLspStatus(this.sessionId,this.clientId)}async cancelTask(t,n){return await this.client.sessionTaskCancel(this.sessionId,t,n,this.clientId)}async clearGoal(){return await this.client.sessionGoalClear(this.sessionId,this.clientId)}async stats(){return await this.client.sessionStats(this.sessionId,this.clientId)}async respondToPermission(t,n){return await this.client.respondToPermission(t,n,this.clientId)}async respondToSessionPermission(t,n){return await this.client.respondToSessionPermission(this.sessionId,t,n,this.clientId)}async close(){return await this.client.closeSession(this.sessionId,this.clientId)}async detach(){return await this.client.detachSession(this.sessionId,this.clientId)}async updateMetadata(t){return await this.client.updateSessionMetadata(this.sessionId,t,this.clientId)}events(t={}){return this.openEventSubscription(t)}subscribeEvents(t={}){return this.openEventSubscription(t)}openEventSubscription(t){let n=dp(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,dp(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=I_(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 dp(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function oq(e){return e instanceof Iu&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var HI="mid_turn_message_injected",N_="pending_prompt_added",R_="pending_prompt_started",L_="pending_prompt_completed",aq=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated",HI,N_,R_,L_,"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(aq);var lq=["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"],Iy=["plan","default","auto-edit","auto","yolo"],vv="daemon-plan";function mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ce(e,t){if(!mt(e))return;let n=e[t];return typeof n=="string"?n:void 0}function Sn(e,t){if(mt(e))for(let n of t){let r=e[n];if(typeof r=="string"&&r.trim().length>0)return r}}function bc(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 dl(e){return bc(Qa(e))}function Qa(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>Qa(n,t+1)):mt(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,VI(n)?"[redacted]":Qa(r,t+1)])):e}function VI(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 A2(e){if(typeof e=="string")return e;if(!mt(e))return"";let t=e.text;return typeof t=="string"?t:""}function cq(e){if(typeof e=="string")return{kind:"text",text:e};if(!mt(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=mt(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=mt(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 uq=64;function p1(e,t=0){if(t>uq)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>p1(r,t+1)).filter(Boolean).join(`
`);if(!mt(e))return e===void 0?"":bc(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=p1(n,t+1);if(r)return r}return bc(e)}var dq=new Set(lq),WI=new Set(["qwen","qwen-oauth"]),hq=new Set(["in_flight","disabled","budget_would_exceed"]),rS="malformed memory_changed payload",sS=4096;function fq(e,t={}){let n=wq(e,t);switch(e.type){case"session_update":return vq(e,n,t);case"shell_output":{let r=p1(e.data),s=_v(e.data),i=kv(e.data);return r?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:r,...s?{stream:s}:{}}]:[]}case"permission_request":return Eq(e,n);case"permission_resolved":case"permission_already_resolved":return Mq(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:Ce(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:Ce(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=oS(Ce(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:Ce(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${Ce(e.data,"reason")??"closed"}`}];case"client_evicted":return[{...n,type:"error",recoverable:!0,text:Ce(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=oS(Ce(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:Ce(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=Ce(e.data,"code"),s=Ce(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...s?{promptId:s}:{},text:Ce(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return mq(e,n);case"session_rewound":return pq(e,n);case"session_branched":return gq(e,n);case"prompt_cancelled":{let r=eU(e.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return yq(e,n);case"mid_turn_message_injected":return bq(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let r=Ce(e.data,"command"),s=Ce(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=cr(e.data,"exitCode"),s=mt(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=cr(e.data,"replayedCount")??0,s=cr(e.data,"lastReplayedEventId")??cr(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...s!==void 0?{lastReplayedEventId:s}:{}}]}case"session_metadata_updated":return jq(e,n);case"approval_mode_changed":return Dq(e,n);case"memory_changed":return Oq(e,n);case"agent_changed":return Bq(e,n);case"tool_toggled":return Pq(e,n);case"settings_changed":return $q(e,n);case"trust_change_requested":return Fq(e,n);case"workspace_initialized":return zq(e,n);case"github_setup_completed":return qq(e,n);case"mcp_budget_warning":return Uq(e,n);case"mcp_child_refused_batch":return Hq(e,n);case"mcp_server_restarted":return Vq(e,n);case"mcp_server_restart_refused":return Wq(e,n);case"extensions_changed":return Gq(e,n);case"auth_device_flow_started":return Kq(e,n);case"auth_device_flow_throttled":return Yq(e,n);case"auth_device_flow_authorized":return Xq(e,n);case"auth_device_flow_failed":return Qq(e,n);case"auth_device_flow_cancelled":return Zq(e,n);default:return[{...n,type:"debug",text:`${e.type} (unrecognized daemon event): ${dl(e.data)}`}]}}function mq(e,t){let n=Ce(e.data,"reason"),r=cr(e.data,"lastDeliveredId"),s=cr(e.data,"earliestAvailableId");return!n||r===void 0||s===void 0?Un(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:s}]}function pq(e,t){let n=Ce(e.data,"promptId"),r=cr(e.data,"targetTurnIndex");if(!n||r===void 0)return Un(e,t,"malformed session_rewound payload");let s=Ce(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:r,...s?{sessionId:s}:{}}]}function gq(e,t){let n=Ce(e.data,"sourceSessionId"),r=Ce(e.data,"newSessionId"),s=Ce(e.data,"displayName");return!n||!r||!s?Un(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:r,displayName:s}]}function yq(e,t){let n=Ce(e.data,"sessionId"),r=Ce(e.data,"suggestion"),s=Ce(e.data,"promptId");return!n||!r||!s?Un(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:s}]}function bq(e,t){if(!mt(e.data))return Un(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?Un(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function wq(e,t){let n=GI(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:Qa(e.data)}}:{}}}function GI(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(mt(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(mt(e.data)){let r=e.data._meta;if(mt(r)){let i=r.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let s=e.data.update;if(mt(s)){let i=s._meta;if(mt(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 vq(e,t,n){let r=Iq(e.data);if(!r)return[{...t,type:"debug",text:`session_update: ${dl(e.data)}`}];let s=Ce(r,"sessionUpdate");switch(s){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=r.content,o=cq(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=A2(i);return a?[{...t,type:"user.text.delta",text:a}]:[]}case"agent_message_chunk":{let i=A2(r.content),o=iS(r),a=xq(r),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let c=_q(r);return c&&l.push({...t,type:"assistant.usage",usage:c,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=A2(r.content);if(!i)return[];let o=iS(r);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":return[kq(r,t)];case"shell_output":case"tool_output":{let i=p1(r),o=_v(r)??_v(e.data),a=kv(r)??kv(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(mt);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[Sq(r,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${s??"session_update"}: ${dl(r)}`}]}}function iS(e){let t=mt(e._meta)?e._meta:void 0;return t?Ce(t,"parentToolCallId"):void 0}function xq(e){let t=mt(e._meta)?e._meta:void 0;return t?{...t}:void 0}function _q(e){let t=mt(e._meta)?e._meta:void 0,n=t&&mt(t.usage)?t.usage:void 0;if(!n)return;let r=cr(n,"inputTokens"),s=cr(n,"outputTokens");if(r===void 0&&s===void 0)return;let i=cr(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}function kq(e,t){let n=mt(e._meta)?e._meta:void 0,r=Ce(e,"toolName")??Ce(e,"name")??(n?Ce(n,"toolName"):void 0)??(n?Ce(n,"name"):void 0),s=Ce(e,"kind"),i=Ce(e,"title")??r??s,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?Qa(o):void 0,c=a!==void 0?Qa(a):void 0,u=e.content!==void 0?Qa(e.content):void 0,d=e.locations!==void 0?Qa(e.locations):void 0,f=Ce(e,"toolCallId"),m=Ce(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}=Aq(e,r),v=Ce(e,"parentToolCallId")??(n?Ce(n,"parentToolCallId"):void 0),b=v&&v!==f?v:void 0,w=Ce(e,"subagentType")??(n?Ce(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}:{},...w?{subagentType:w}:{},...l!==void 0?{rawInput:l}:{},...c!==void 0?{rawOutput:c}:{},...l!==void 0?{details:xv(dl(l))}:c!==void 0?{details:xv(dl(c))}:{}}}function Sq(e,t){let n=Array.isArray(e.entries)?e.entries:[],r=xv(Tq(n)),s=t.eventId!==void 0?`${vv}-${t.eventId}`:vv,i=mt(e._meta)?e._meta:void 0,o=i&&mt(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 Tq(e){return e.flatMap(t=>{if(!mt(t))return[];let n=Ce(t,"content");return n?[`- [${Cq(Ce(t,"status"))}] ${n}`]:[]}).join(`
`)}function Cq(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function Aq(e,t){let n=Ce(e,"provenance"),r=Ce(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 oS(e){if(e)return dq.has(e)?e:void 0}function xv(e){return e.length<=sS?e:`${e.slice(0,sS)}... [truncated]`}function Eq(e,t){if(!mt(e.data))return[{...t,type:"debug",text:`permission_request: ${dl(e.data)}`}];let n=Ce(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${dl(e.data)}`}];let r=e.data.toolCall!==void 0?Qa(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:Ce(e.data,"sessionId"),title:Lq(r),options:Nq(e.data.options),toolCall:r}]}function Mq(e,t){let n=Ce(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${dl(e.data)}`}];let r=Ce(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:Rq(e.data),...r?{voterClientId:r}:{}}]}function Iq(e){if(!mt(e))return;let t=e.update;return mt(t)?t:e}function Nq(e){return Array.isArray(e)?e.flatMap(t=>{if(!mt(t))return[];let n=Ce(t,"optionId");return n?[{optionId:n,label:Ce(t,"label")??Ce(t,"title")??Ce(t,"name")??n,...Ce(t,"description")?{description:Ce(t,"description")}:{},raw:t}]:[]}):[]}function Rq(e){if(!mt(e))return bc(e);let t=e.outcome;if(typeof t=="string")return t;if(mt(t)){let n=Ce(t,"outcome")??"selected",r=Ce(t,"optionId");return r?`${n}:${r}`:n}return Sn(e,["status","reason"])??bc(e)}function Lq(e){return mt(e)?Ce(e,"title")??Ce(e,"name")??Ce(e,"kind")??Ce(e,"toolName")??"Tool permission":"Tool permission"}function _v(e){let t=Ce(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function kv(e){if(!mt(e))return;let t=Ce(e,"source");if(t)return t;let n=e._meta;return mt(n)?Ce(n,"source"):void 0}function Un(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function jq(e,t){let n=Ce(e.data,"sessionId");if(!n)return Un(e,t,"missing sessionId");let r=Ce(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function Dq(e,t){let n=Ce(e.data,"sessionId"),r=Ce(e.data,"previous"),s=Ce(e.data,"next");if(!n||!r||!s)return Un(e,t,"missing sessionId / previous / next");let i=mt(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 Oq(e,t){var o;let n=Ce(e.data,"scope");if(n==="managed"){let a=Ce(e.data,"source"),l=Ce(e.data,"taskId"),c=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&l&&Array.isArray(c))||c.some(u=>u!=="user"&&u!=="project")?Un(e,t,rS):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:l,touchedScopes:c}]}let r=Ce(e.data,"filePath"),s=Ce(e.data,"mode"),i=cr(mt(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||s!=="append"&&s!=="replace"||i===void 0?Un(e,t,rS):[{...t,type:"workspace.memory.changed",scope:n,filePath:r,mode:s,bytesWritten:i}]}function Bq(e,t){let n=Ce(e.data,"change"),r=Ce(e.data,"name"),s=Ce(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||s!=="project"&&s!=="user"?Un(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:r,level:s}]}function Pq(e,t){let n=Ce(e.data,"toolName"),r=mt(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||r===void 0?Un(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function $q(e,t){let n=Ce(e.data,"key"),r=Ce(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:mt(e.data)?e.data.value:void 0}]:Un(e,t,"malformed settings_changed payload")}function zq(e,t){let n=Ce(e.data,"path"),r=Ce(e.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?Un(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:r}]}function Fq(e,t){let n=Ce(e.data,"workspaceCwd"),r=Ce(e.data,"desiredState"),s=Ce(e.data,"reason");return!n||r!=="trusted"&&r!=="untrusted"?Un(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:r,...s!==void 0?{reason:s}:{}}]}function qq(e,t){let n=Ce(e.data,"releaseTag"),r=Ce(e.data,"readmeUrl");if(!n||!r||!mt(e.data))return Un(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 Uq(e,t){if(!mt(e.data))return Un(e,t,"non-object payload");let n=cr(e.data,"liveCount"),r=cr(e.data,"reservedCount"),s=cr(e.data,"budget"),i=cr(e.data,"thresholdRatio"),o=Ce(e.data,"mode");return n===void 0||r===void 0||s===void 0||i===void 0||o!=="warn"&&o!=="enforce"?Un(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:s,thresholdRatio:i,mode:o}]}function Hq(e,t){if(!mt(e.data))return Un(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(mt).map(o=>{let a=Ce(o,"name"),l=Ce(o,"transport"),c=Ce(o,"reason");return!a||!l||c!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],r=cr(e.data,"budget"),s=cr(e.data,"liveCount"),i=cr(e.data,"reservedCount");return n.length===0||r===void 0||s===void 0||i===void 0?Un(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:s,reservedCount:i}]}function Vq(e,t){let n=Ce(e.data,"serverName"),r=cr(e.data,"durationMs");return!n||r===void 0?Un(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function Wq(e,t){let n=Ce(e.data,"serverName"),r=Ce(e.data,"reason");return!n||!r||!hq.has(r)?Un(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function Gq(e,t){let n=cr(e.data,"refreshed"),r=cr(e.data,"failed"),s=Ce(e.data,"status"),i=Ce(e.data,"source"),o=Ce(e.data,"name"),a=Ce(e.data,"version"),l=Ce(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"?Un(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 Kq(e,t){let n=Ce(e.data,"deviceFlowId"),r=Ce(e.data,"providerId"),s=cr(e.data,"expiresAt");return!n||!r||!WI.has(r)||s===void 0?Un(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:s}]}function Yq(e,t){let n=Ce(e.data,"deviceFlowId"),r=cr(e.data,"intervalMs");return!n||r===void 0?Un(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function Xq(e,t){let n=Ce(e.data,"deviceFlowId"),r=Ce(e.data,"providerId");if(!n||!r||!WI.has(r))return Un(e,t,"malformed auth_device_flow_authorized payload");let s=cr(e.data,"expiresAt"),i=Ce(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...s!==void 0?{expiresAt:s}:{},...i?{accountAlias:i}:{}}]}function Qq(e,t){let n=Ce(e.data,"deviceFlowId"),r=Ce(e.data,"errorKind");if(!n||!Jq(r))return Un(e,t,"malformed auth_device_flow_failed payload");let s=Ce(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...s?{hint:s}:{}}]}function Jq(e){return typeof e=="string"&&e.trim().length>0}function Zq(e,t){let n=Ce(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Un(e,t,"malformed auth_device_flow_cancelled payload")}function cr(e,t){if(!mt(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function eU(e,t){if(!mt(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var tU=8;function g1(e,t={},n=0){if(n>tU){let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}if(mt(e)){let p=e.rawInput??e.input??e.args;if(p!==void 0&&p!==e){let y=g1(p,{title:t.title??Sn(e,["title"]),toolName:t.toolName??Sn(e,["toolName","name"]),toolKind:t.toolKind??Sn(e,["kind"])},n+1);if(y.kind!=="generic"||!y.summary)return y}}let r=oU(e);if(r.length>0)return{kind:"ask_user_question",questions:r};let s=iU(e,t);if(s)return s;let i=uU(e,t);if(i)return i;let o=dU(e,t);if(o)return o;let a=hU(e,t);if(a)return a;let l=nU(e,t);if(l)return l;let c=rU(e,t);if(c)return c;let u=sU(e);if(u)return u;let d=fU(e,t);if(d)return d;let f=mU(e);if(f)return f;if(mt(e)){let p=Sn(e,["command","cmd"]);if(p){let v=Sn(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:p,...v?{cwd:v}:{}}}let y=lU(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 nU(e,t={}){if(!mt(e))return;let n=Sn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=Sn(e,["oldText","old_text","old_str","oldString"]),s=Sn(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?Sn(e,["content"]):void 0,l=s??a,c=Sn(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 rU(e,t){if(!mt(e))return;let n=Sn(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=t.toolName??Sn(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 sU(e){if(!mt(e))return;let t=Sn(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=Sn(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function iU(e,t){let n=t.toolName??(mt(e)?Sn(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(mt(e)){let l=e.arguments??e.args??e;if(mt(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 oU(e){return!mt(e)||!Array.isArray(e.questions)?[]:e.questions.filter(mt).map(t=>{let n=Sn(t,["header","title","label"]),r=Sn(t,["question","prompt","text"])??"Question",s=Array.isArray(t.options)?t.options.filter(mt).map(aU):[];return{...n?{header:n}:{},question:r,options:s,raw:t}})}function aU(e){let t=Sn(e,["label","title","value"])??"Option",n=Sn(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function lU(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=Sn(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)||mt(s)||t.push({label:r,value:VI(r)?"[redacted]":dl(s)});return t}var aS=50,cU=5;function uU(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!mt(e))return;let r=Sn(e,["subagent_type","agent","agentName","agent_name","subagent"]),s=Sn(e,["prompt","task","description","instruction","query"]);if(!r&&!s)return;let i=Sn(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:s??"(no task description)",...i?{parentDelegationId:i}:{}}}function dU(e,t){if(!mt(e))return;let n=Sn(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,cU).map(a=>typeof a=="string"?a:mt(a)?Sn(a,["path","file","name","title","text"])??bc(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 hU(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!mt(e))return;let r=Sn(e,["prompt","description","query"]);if(!r)return;let s=Sn(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=Sn(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...s?{thumbnailUrl:s}:{},...i?{model:i}:{}}}function fU(e,t){if(!mt(e))return;let n=Sn(e,["code","snippet","source"]);if(!n)return;let r=Sn(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=Sn(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...o?{origin:o}:{}}}function mU(e){if(!mt(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,aS).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:bc(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&&mt(r[0])){let s=Object.keys(r[0]).slice(0,30);if(s.length===0)return;let i=r.slice(0,aS).map(o=>{let a=o;return s.map(l=>{let c=a[l];return typeof c=="string"?c:bc(c).slice(0,80)})});return{kind:"tabular",columns:s,rows:i,...r.length>i.length?{totalRows:r.length}:{}}}}var pU=1e3,wu="__trimmed_tool_block__",Ny="__trimmed_permission_block__",Sv=1e5,lS=`
[truncated]
`,gU=16;function yU(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??pU}}var j_=new Set(["pending","confirming","running","in_progress"]),bU=new Set(["completed","success","failed","error","canceled","cancelled"]),wU=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function vU(e,t,n={}){let r=QI(e,n);P_(r);let s=$_(r,"user",t);return n.images&&n.images.length>0&&(s.images=[...n.images]),xa(r,s),r.activeUserBlockId=s.id,JI(r)}function xU(e,t,n={}){if(t.length===0)return e;let r=QI(e,n);for(let i of t)_U(r,i);let s=JI(r);return Object.freeze(s.blocks),s}function D_(e){let t={};return e.forEach((n,r)=>{t[n.id]=r}),t}function _U(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!wU.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),E2(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let r=wo(e,e.activeUserBlockId);r&&r.kind==="user"&&(r.images=[...r.images??[],{data:t.data,mimeType:t.mimeType}])}else{let r=$_(e,"user","");r.images=[{data:t.data,mimeType:t.mimeType}],xa(e,r),e.activeUserBlockId=r.id}break}case"assistant.text.delta":E2(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":P_(e,t),(t.reason==="cancelled"||t.reason==="error")&&Tv(e);break;case"assistant.usage":TU(e,t);break;case"thought.text.delta":E2(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":XI(e,t);break;case"shell.output":EU(e,t);break;case"user.shell.output":MU(e,t);break;case"permission.request":IU(e,t);break;case"permission.resolved":NU(e,t);break;case"model.changed":am(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":am(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":kU(e,t);break;case"prompt.cancelled":Tv(e),t.reason!=="forward_failed"&&RU(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":jU(e,t.targetTurnIndex);break;case"session.branched":am(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function kU(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},Tv(e),am(e,"error",`State resync required: ${SU(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function SU(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 Ry(e,t,n){let r=wo(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 KI(e,t){Ry(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function TU(e,t){let n=wo(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 YI(e,t){Ry(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function O_(e,t,n){Ry(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function B_(e,t,n){Ry(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function E2(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=wo(e,a);if(l&&l.kind===t&&CU(l,s)){l.text=F_(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=$_(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),xa(e,c),o&&i!=null?o[i]=c.id:e[n]=c.id,i!=null?(t==="assistant"&&B_(e,i),t==="thought"&&O_(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&KI(e),t!=="thought"&&YI(e))}function CU(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 P_(e,t){KI(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))O_(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))B_(e,n,t);YI(e,t)}function XI(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===wu){if(LU(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],XI(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,am(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let r=wo(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=g1(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!==wu&&(r.parentBlockId=o)}t.subagentType&&!r.subagentType&&(r.subagentType=t.subagentType),cS(e,t.toolCallId,t.status);return}let s=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==wu?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:Nc(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:g1(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}:{}};xa(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=wo(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}cS(e,t.toolCallId,t.status??"pending"),Uu(e,t.parentToolCallId)}function cS(e,t,n){if(n!==void 0){if(j_.has(n)){e.currentToolCallId=t;return}if(bU.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=AU(e));return}}}function AU(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"&&j_.has(n.status))return n.toolCallId}}function Tv(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===wu)continue;let n=wo(e,t);!n||n.kind!=="tool"||j_.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function EU(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=wo(e,n.id);(s==null?void 0:s.kind)==="shell"&&(s.text=F_(s.text,t.text),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId));return}let r={id:Nc(e,"shell"),kind:"shell",text:v0(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}:{}};xa(e,r),Uu(e)}function MU(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=wo(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=F_(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:Nc(e,"user-shell"),kind:"user_shell",text:v0(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,xa(e,i),Uu(e)}function IU(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===Ny)return;let r=wo(e,n),s=g1(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:Nc(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}:{}};xa(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,Uu(e)}function NU(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===Ny)return;let r=wo(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:Nc(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}:{}};xa(e,s),e.permissionBlockByRequestId[t.requestId]=s.id,Uu(e)}function am(e,t,n,r,s={}){let i={id:Nc(e,t),kind:t,text:v0(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}}:{}};xa(e,i),s.clearActiveText!==!1&&Uu(e)}function RU(e,t){let n={id:Nc(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}:{}};xa(e,n),Uu(e)}function $_(e,t,n,r,s,i){return{id:Nc(e,t),kind:t,text:v0(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...r!==void 0?{eventId:r}:{},...s!==void 0?{serverTimestamp:s}:{},...i?{meta:{...i}}:{}}}function QI(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 JI(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=D_(t),y1.set(e,e.blocks);for(let[r,s]of Object.entries(e.toolBlockByCallId))n.has(s)||(e.toolBlockByCallId[r]=wu);BU(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==wu&&delete e.trimmedToolNotificationByCallId[r];for(let[r,s]of Object.entries(e.permissionBlockByRequestId))n.has(s)||(e.permissionBlockByRequestId[r]=Ny);PU(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let s=wo(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 LU(e){return e.toolCallId===vv||e.toolKind==="updated_plan"}var y1=new WeakMap;function z_(e){y1.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},y1.set(e,e.blocks))}function jU(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){uS(e,i);return}n+=1}r>=0&&t>=n&&uS(e,r)}function uS(e,t){z_(e),e.blocks=e.blocks.slice(0,t),y1.set(e,e.blocks),DU(e)}function DU(e){e.blockIndexById=D_(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 xa(e,t){z_(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function wo(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=OU(r);return z_(e),e.blocks[n]=s,s}function OU(e){return e.kind==="permission"?{...e,options:e.options.map(t=>ra(t)),toolCall:ra(e.toolCall),preview:ra(e.preview)}:e.kind==="tool"?{...e,preview:ra(e.preview),content:ra(e.content),locations:ra(e.locations),rawInput:ra(e.rawInput),rawOutput:ra(e.rawOutput)}:{...e}}function Nc(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function Uu(e,t){t?(O_(e,t),B_(e,t)):(P_(e),e.activeUserBlockId=void 0)}function F_(e,t){return e.length>=Sv?e:v0(e+t)}function v0(e){if(e.length<=Sv)return e;let t=Math.max(0,Sv-lS.length);return`${e.slice(0,t)}${lS}`}function BU(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,s])=>s===wu).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 PU(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,s])=>s===Ny).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.permissionBlockByRequestId[s]}function ra(e,t=0){return t>gU?e:Array.isArray(e)?e.map(n=>ra(n,t+1)):mt(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,ra(r,t+1)])):e}function $U(e={}){let t=dS(e),n=new Set,r=!1,s=()=>{for(let o of n)try{o()}catch(a){zU(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=xU(t,a),i())},appendLocalUserMessage(o,a){t=vU(t,o,{images:a}),i()},reset(o={}){t=dS({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 zU(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 dS(e){let t=e.blocks?[...e.blocks]:[];return{...yU({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:D_(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 FU="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function hS(e,t){var n;if(!e)return{models:[]};const r=new Set,s=[];let i=(n=e.current)==null?void 0:n.modelId;const o=e.approvalMode;let a;for(const l of e.providers)for(const c of l.models){!i&&c.isCurrent&&(i=c.modelId),a===void 0&&(i?c.modelId===i:c.isCurrent)&&(a=c.contextLimit);const u=[l.authType,c.modelId,c.baseUrl??"",c.envKey??""].join("\0");r.has(u)||(r.add(u),s.push({id:c.modelId,baseModelId:c.baseModelId,label:c.name||c.modelId,authType:l.authType,...c.contextLimit!==void 0?{contextWindow:c.contextLimit}:{},...c.modalities!==void 0?{modalities:c.modalities}:{},...c.baseUrl!==void 0?{baseUrl:c.baseUrl}:{},...c.envKey!==void 0?{envKey:c.envKey}:{},...c.isRuntime?{isRuntime:!0}:{}}))}return{models:s,currentModel:i,currentMode:o,contextWindow:a}}function qU(e){var t;const n=Is((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const r=Or(n,"currentModelId")??Or(n,"currentModel"),s=n.availableModels,i=[];let o;if(Array.isArray(s))for(const a of s){const l=Is(a),c=Or(l,"modelId")??Or(l,"id")??Or(l,"value");if(!c)continue;const u=Is(l==null?void 0:l._meta),d=Df(u,"contextLimit")??Df(u,"contextWindow")??Df(l,"contextLimit")??Df(l,"contextWindow");o===void 0&&r!==void 0&&c===r&&(o=d),i.push({id:c,baseModelId:Or(l,"baseModelId")??YU(c),label:Or(l,"name")??Or(l,"label")??c,...d!==void 0?{contextWindow:d}:{}})}if(!(!r&&i.length===0))return{models:i,currentModel:r,contextWindow:o}}function ZI(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}:{},...nN(r._meta),raw:r}}),n=e.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:eN(t,n),skills:e.availableSkills}}function UU(e){return e?{commands:e.skills.map(n=>({name:n.name,description:n.description||"",...n.argumentHint?{argumentHint:n.argumentHint}:{},raw:{name:n.name,description:n.description||"",input:n.argumentHint?{hint:n.argumentHint}:null,_meta:{source:"skill"}}})),skills:e.skills.map(n=>n.name)}:{commands:[],skills:[]}}function eN(...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 HU(e,t){var n;if(e.type==="session_update"){const r=Is((n=Is(e.data))==null?void 0:n.update),s=tN(r);if(s&&t(i=>({...i,tokenUsage:s,tokenCount:q_(s)})),Or(r,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=KU(r);t(a=>({...a,commands:i.length>0?i:a.commands,skills:o}))}return}switch(e.type){case"session_metadata_updated":{const r=Is(e.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&t(s=>({...s,displayName:Or(r,"displayName")}));break}case"model_switched":{const r=Or(Is(e.data),"modelId");r&&t(s=>({...s,currentModel:r}));break}case"approval_mode_changed":{const r=Is(e.data),s=Or(r,"next")??Or(r,"mode");s&&t(i=>({...i,currentMode:s}));break}}}function VU(e){const t=Or(e,"displayName");return t!=null&&t.trim()?t:void 0}function WU(e){var t;const n=Is((t=e==null?void 0:e.state)==null?void 0:t.modes);return Or(n,"currentModeId")??Or(n,"currentMode")}function q_(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 GU(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=Is((t=Is(r.data))==null?void 0:t.update),i=tN(s);if(i)return i}catch{}}function tN(e){const t=Is(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=Is(t==null?void 0:t.usage),r={...mf(n,"inputTokens"),...mf(n,"outputTokens"),...mf(n,"totalTokens"),...mf(n,"thoughtTokens"),...mf(n,"cachedReadTokens")};return q_(r)!==void 0?r:void 0}function mf(e,t){const n=Df(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function KU(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=Is(i),l=Or(a,"name");if(!l)return[];const c=Is(a==null?void 0:a.input),u={name:l,description:Or(a,"description")??"",input:c?{hint:Or(c,"hint")??""}:null,_meta:Is(a==null?void 0:a._meta)??null};return[{name:l,description:u.description??"",...(o=u.input)!=null&&o.hint?{argumentHint:u.input.hint}:{},...nN(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:eN(n,s),skills:r}}function nN(e){const n=Or(e??void 0,"source");return{...n?{source:n}:{}}}function Is(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Or(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function Df(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function YU(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 fS(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 XU=3e4;function QU(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 Je(e,t,n=XU){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 JU(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 Rr(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function ZU(e,t,n="replay",r=80,s){Rr(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 eH="qwen-code-webui-client-id:session:";function M2(e,t){if(e)return e;if(typeof window>"u")return I2();try{if(t){const n=window.sessionStorage.getItem(rN(t));if(n)return n}return I2()}catch{return I2()}}function vg(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(rN(t),e)}catch{}}async function mS(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${tH(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 I2(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function rN(e){return`${eH}${encodeURIComponent(e)}`}function tH(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 nH(e,t){const n={...e};return(!t||e.sessionId===t)&&(delete n.sessionId,delete n.clientId,delete n.displayName,delete n.tokenUsage,delete n.tokenCount,delete n.commands,delete n.skills,delete n.supportedCommands,delete n.context),{...n,status:"connected",catchingUp:void 0,error:void 0}}function rH({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:s,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:l,passiveAssistantDoneTimerRef:c,getCreateSessionRequest:u,createDetachedSession:d,getConnection:f,hasSessionActivePrompt:m,resetCurrentSessionActivePrompt:p,addNotice:y,setConnection:v,setPromptStatus:b,setRestoreSessionId:w,setRestoreMode:x,setRestoreSessionNonce:k,setAttachSessionNonce:T,setNewSessionNonce:A}){function M(){for(const[,C]of n.current)C.controller.abort();n.current.clear(),r.current.clear(),b("idle"),Rr(c),s.current&&(l.current===s.current.sessionId&&(l.current=void 0),clearTimeout(s.current.timeout),s.current.reject(new DOMException("Session cleared","AbortError")),s.current=void 0),e.reset(),w(void 0)}function D(C,L){const I=i.current+1;return i.current=I,s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException(`Session ${L} superseded by a newer request`,"AbortError"))),new Promise((F,W)=>{const j=setTimeout(()=>{var K;((K=s.current)==null?void 0:K.id)===I&&(s.current=void 0,W(Ln(y,`${lH(L)} session failed`,new Error(`Session ${L} timed out`),cH(L))))},3e4);s.current={id:I,sessionId:C,mode:L,timeout:j,resolve:F,reject:W}})}function O(C,L,I){var B,F;a.current=!1;const W=D(C,L),j=(B=t.current)==null?void 0:B.sessionId,K=j?n.current.get(j):void 0;return(F=K==null?void 0:K.reject)==null||F.call(K,new DOMException("Session switch interrupted prompt wait","AbortError")),j&&n.current.delete(j),p(),v(J=>({...J,status:"connecting",error:void 0,catchingUp:!0})),b("idle"),r.current.clear(),Rr(c),I!=null&&I.deferTranscriptReset||e.reset(),x(L),w(C),k(J=>J+1),I!=null&&I.deferTranscriptReset?W.catch(J=>{if(!Of(J)){e.reset();const ee=J instanceof Error?J.message:String(J);v(N=>({...N,status:"disconnected",error:ee,catchingUp:void 0}))}throw J}):W}return{async sendPrompt(C,L){var I,B,F;const W=Jn(y,t.current,"Prompt failed","send_prompt"),j=W.sessionId;if(n.current.has(j))throw Ln(y,"Prompt failed","A prompt is already in progress","send_prompt");Rr(c),b("waiting");const K=new AbortController;n.current.set(j,{controller:K});try{const J=((L==null?void 0:L.images)??[]).map(q=>({data:q.data,mimeType:q.mimeType||q.mediaType||q.media_type||"image/*"}));(L==null?void 0:L.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(C,J);const ee={prompt:fS(C,J)};L!=null&&L.retry&&(ee.retry=!0);const N=await W.submitPrompt(ee,K.signal);return await sH(n.current,r.current,j,K,N.promptId)}catch(J){if(Of(J))return((I=t.current)==null?void 0:I.sessionId)===j&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw UI(J)?J:(((B=t.current)==null?void 0:B.sessionId)===j&&e.dispatch({type:"assistant.done",reason:"error"}),Ln(y,"Prompt failed",J,"send_prompt"))}finally{const J=n.current.get(j);(J==null?void 0:J.controller)===K&&n.current.delete(j),((F=t.current)==null?void 0:F.sessionId)===j&&!m()&&b("idle")}},async submitPrompt(C,L){var I;const B=Jn(y,t.current,"Prompt failed","send_prompt");if(L!=null&&L.sessionId&&B.sessionId!==L.sessionId)throw new Error("Session changed before prompt submission");const F=((L==null?void 0:L.images)??[]).map(K=>({data:K.data,mimeType:K.mimeType||K.mediaType||K.media_type||"image/*"}));(L==null?void 0:L.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(C,F);const W={prompt:fS(C,F)};L!=null&&L.retry&&(W.retry=!0);const j=await B.submitPrompt(W);if((I=L==null?void 0:L.signal)!=null&&I.aborted)throw await B.removePendingPrompt(j.promptId).catch(K=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",K),y({severity:"error",category:"user_action",operation:"send_prompt",code:"daemon.send_prompt.pending_cleanup_failed",message:"Prompt was accepted after cancellation but could not be removed from the queue.",debugMessage:K instanceof Error?K.message:String(K),recoverable:!0})}),L.signal.reason??new DOMException("Aborted","AbortError");return{promptId:j.promptId}},async cancel(){var C,L;const I=Jn(y,t.current,"Cancel failed","cancel_prompt"),B=n.current.get(I.sessionId);B==null||B.controller.abort(),Rr(c);const F=B?new AbortController:void 0;F&&n.current.set(I.sessionId,{controller:F});try{await Je(I.cancel(),"Cancel timed out")}catch(W){throw Ln(y,"Cancel failed",W,"cancel_prompt")}finally{F&&((C=n.current.get(I.sessionId))==null?void 0:C.controller)===F&&n.current.delete(I.sessionId),((L=t.current)==null?void 0:L.sessionId)===I.sessionId&&!m()&&b("idle")}},async setModel(C){const L=Jn(y,t.current,"Set model failed","switch_model");try{const I=await Je(L.setModel(C),"Set model timed out");return v(B=>({...B,currentModel:C})),I}catch(I){throw Ln(y,"Set model failed",I,"switch_model")}},async setApprovalMode(C,L){const I=Jn(y,t.current,"Set approval mode failed","set_approval_mode");try{const B=await Je(I.client.setSessionApprovalMode(I.sessionId,C,{persist:L==null?void 0:L.persist,clientId:I.clientId}),"Set approval mode timed out");return v(F=>({...F,currentMode:B.mode||C})),B}catch(B){throw Ln(y,"Set approval mode failed",B,"set_approval_mode")}},async respondToPermission(C,L){const I=Jn(y,t.current,"Permission response failed","submit_permission");try{return await Je(I.respondToSessionPermission(C,L),"Permission response timed out")}catch(B){throw Ln(y,"Permission response failed",B,"submit_permission")}},async submitPermission(C,L,I){const B=Jn(y,t.current,"Permission response failed","submit_permission"),F=L!==void 0&&L.length>0?{outcome:{outcome:"selected",optionId:L},...I?{answers:I}:{}}:{outcome:{outcome:"cancelled"},...I?{answers:I}:{}};try{return await Je(B.respondToSessionPermission(C,F),"Permission response timed out")}catch(W){throw Ln(y,"Permission response failed",W,"submit_permission")}},async heartbeat(){const C=t.current;if(!(!C||!o.current))return Je(C.heartbeat(),"Heartbeat timed out")},async listSessions(C){const L=t.current;if(!L)return[];try{return await Je(L.client.listWorkspaceSessions(L.workspaceCwd,C),"List sessions timed out")}catch(I){throw Ln(y,"List sessions failed",I,"list_sessions")}},async loadSession(C,L){return O(C,"load",L)},async resumeSession(C,L){return O(C,"resume",L)},async createSession(){try{a.current=!1;const C=t.current,L=C&&f().sessionId===C.sessionId?C:void 0;if(L){const B=await Je(L.client.createOrAttachSession(u()),"Create session timed out");return vg(B.clientId,B.sessionId),B}const I=await Je(d(),"Create session timed out");if(a.current){try{await Je(I.detach(),"Detach cleared session timed out")}catch(B){console.warn("[DaemonSessionActions] detach after interrupted create failed:",B)}throw new DOMException("Session creation interrupted","AbortError")}return vg(I.clientId,I.sessionId),t.current=I,l.current=I.sessionId,v(B=>({...B,status:"connected",sessionId:I.sessionId,...I.clientId?{clientId:I.clientId}:{},workspaceCwd:I.workspaceCwd,error:void 0})),I}catch(C){throw Ln(y,"Create session failed",C,"create_session")}},async attachSession(){const C=Jn(y,t.current,"Attach session failed","attach_session"),L=D(C.sessionId,"attach");return T(I=>I+1),L},async clearSession(){const C=t.current;if(a.current=!0,M(),t.current=void 0,v(L=>nH(L,C==null?void 0:C.sessionId)),C)try{await Je(C.detach(),"Clear session timed out")}catch(L){console.warn("[DaemonSessionActions] detach on clear failed:",L)}},async newSession(){a.current=!1,M(),A(C=>C+1)},async releaseSession(C){try{const L=Jn(y,t.current,"Release session failed","release_session");await Je(L.client.closeSession(C),"Release session timed out")}catch(L){throw Ln(y,"Release session failed",L,"release_session")}},async closeSession(){const C=Jn(y,t.current,"Close session failed","close_session");try{await Je(C.close(),"Close session timed out")}catch(L){throw Ln(y,"Close session failed",L,"close_session")}},async refreshCommands(){const C=Jn(y,t.current,"Refresh commands failed","refresh_commands");try{const L=await Je(C.supportedCommands(),"Refresh commands timed out"),{commands:I,skills:B}=ZI(L);v(F=>({...F,commands:I,skills:B,supportedCommands:L}))}catch(L){throw Ln(y,"Refresh commands failed",L,"refresh_commands")}},async getContext(){const C=Jn(y,t.current,"Load context failed","load_context");try{const L=await Je(C.context(),"Load context timed out");return v(I=>({...I,context:L,currentMode:iH(L)??I.currentMode,currentModel:oH(L)??I.currentModel})),L}catch(L){throw Ln(y,"Load context failed",L,"load_context")}},async getContextUsage(C){const L=Jn(y,t.current,"Load context usage failed","load_context_usage");try{return await Je(L.contextUsage(C),"Load context usage timed out")}catch(I){throw Ln(y,"Load context usage failed",I,"load_context_usage")}},async renameSession(C){const L=Jn(y,t.current,"Rename session failed","rename_session");try{return await Je(L.updateMetadata({displayName:C}),"Rename session timed out")}catch(I){throw Ln(y,"Rename session failed",I,"rename_session")}},async recapSession(){const C=Jn(y,t.current,"Recap session failed","recap_session");try{return await Je(C.recap(),"Recap session timed out")}catch(L){throw Ln(y,"Recap session failed",L,"recap_session")}},async getRewindSnapshots(){const C=Jn(y,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await Je(C.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(L){throw Ln(y,"Load rewind snapshots failed",L,"rewind_snapshots")}},async rewindSession(C,L){const I=Jn(y,t.current,"Rewind session failed","rewind_session");try{return await Je(I.rewind(C,L),"Rewind session timed out")}catch(B){throw Ln(y,"Rewind session failed",B,"rewind_session")}},async btwSession(C,L){var I;const B=Jn(y,t.current,"Side question failed","btw_session");try{return await Je(B.btw(C,L),"Side question timed out")}catch(F){throw(I=L==null?void 0:L.signal)!=null&&I.aborted||Of(F)?F:Ln(y,"Side question failed",F,"btw_session")}},async enqueueMidTurnMessage(C,L){const I=t.current;if(!I)return{accepted:!1};try{return await I.enqueueMidTurnMessage(C,L)}catch(B){return B instanceof DOMException&&B.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",B),{accepted:!1}}},async getPendingPrompts(C){const L=t.current;if(!L)return{pendingPrompts:[]};if(C!=null&&C.sessionId&&L.sessionId!==C.sessionId)throw new Error("Session changed before pending prompts refresh");return await L.getPendingPrompts()},async removePendingPrompt(C,L){const I=t.current;return I?L!=null&&L.sessionId&&I.sessionId!==L.sessionId?await I.client.removePendingPrompt(L.sessionId,C):await I.removePendingPrompt(C):{removed:!1}},async sendShellCommand(C){var L,I;const B=Jn(y,t.current,"Shell command failed","send_shell_command"),F=`${B.sessionId}:shell`;b("waiting");const W=new AbortController;n.current.set(F,{controller:W});try{return await B.shellCommand(C,W.signal)}catch(j){throw Ln(y,"Shell command failed",j,"send_shell_command")}finally{((L=n.current.get(F))==null?void 0:L.controller)===W&&n.current.delete(F),((I=t.current)==null?void 0:I.sessionId)===B.sessionId&&!m()&&b("idle")}},async getTasks(){const C=Jn(y,t.current,"Get tasks failed","load_tasks");try{return await Je(C.tasks(),"Get tasks timed out")}catch(L){throw Ln(y,"Get tasks failed",L,"load_tasks")}},async cancelTask(C,L){const I=Jn(y,t.current,"Cancel task failed","cancel_task");try{return await Je(I.cancelTask(C,L),"Cancel task timed out")}catch(B){throw Ln(y,"Cancel task failed",B,"cancel_task")}},async clearGoal(){const C=Jn(y,t.current,"Clear goal failed","clear_goal");try{return await Je(C.clearGoal(),"Clear goal timed out")}catch(L){throw Ln(y,"Clear goal failed",L,"clear_goal")}},async getStats(){const C=Jn(y,t.current,"Load stats failed","load_stats");try{return await Je(C.stats(),"Load stats timed out")}catch(L){throw Ln(y,"Load stats failed",L,"load_stats")}},async respondToGlobalPermission(C,L){const I=Jn(y,t.current,"Global permission response failed","submit_permission");try{return await Je(I.client.respondToPermission(C,L),"Global permission response timed out")}catch(B){throw Ln(y,"Global permission response failed",B,"submit_permission")}},async branchSession(C){const L=Jn(y,t.current,"Branch session failed","branch_session");try{const I=await Je(L.client.branchSession(L.sessionId,{name:C},L.clientId),"Branch session timed out");return vg(I.clientId,I.sessionId),O(I.sessionId,"load").catch(B=>{Of(B)||Ln(y,"Branch session failed",B,"branch_session")}),{sessionId:I.sessionId,displayName:I.displayName}}catch(I){throw Ln(y,"Branch session failed",I,"branch_session")}},async forkSession(C){const L=Jn(y,t.current,"Fork session failed","fork_session");try{return await Je(L.fork(C),"Fork session timed out")}catch(I){throw Ln(y,"Fork session failed",I,"fork_session")}}}}function sH(e,t,n,r,s){return new Promise((i,o)=>{const a=Cv(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 Cv(e,t){return JSON.stringify([e,t])}function iH(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 oH(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 Jn(e,t,n,r){if(!t)throw Ln(e,n,"Daemon session is not connected",r);return t}function Ln(e,t,n,r){if(Of(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}),aH(n instanceof Error?n:new Error(s))}function Of(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function aH(e){return Object.assign(e,{_alreadyDispatched:!0})}function lH(e){return e.charAt(0).toUpperCase()+e.slice(1)}function cH(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const uH=33e4;function dH({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:r}){return{async listSessions(s){const i=Ft(e,"List sessions failed"),o=t();return o?Je(i.listWorkspaceSessions(o,s),"List sessions timed out"):[]},async deleteSession(s){const i=Ft(e,"Delete session failed"),o=await Je(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=Ft(e,"Delete sessions failed");return Je(i.deleteSessionsData(s),"Delete sessions timed out")},async loadMcpStatus(){const s=Ft(e,"Load MCP status failed");return Je(s.workspaceMcp(),"Load MCP status timed out")},async loadMcpTools(s){const i=Ft(e,"Load MCP tools failed");try{return await Je(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=Ft(e,"Load MCP resources failed");try{return await Je(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=Ft(e,"Restart MCP server failed");return Je(i.restartMcpServer(s),"Restart MCP server timed out",5*6e4)},async manageMcpServer(s,i){const o=Ft(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return Je(o.manageMcpServer(s,i),"Manage MCP server timed out",a)},async loadSkillsStatus(){const s=Ft(e,"Load skills failed");return Je(s.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const s=Ft(e,"Load extensions failed");return Je(s.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const s=Ft(e,"Load tools failed");return Je(s.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(s,i){const o=Ft(e,"Set tool enabled failed");return Je(o.setWorkspaceToolEnabled(s,i),"Set tool enabled timed out")},async loadSettingsStatus(){const s=Ft(e,"Load settings failed");return Je(s.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(s,i,o){const a=Ft(e,"Set setting failed");return Je(a.setWorkspaceSetting(s,i,o),"Set setting timed out")},async loadMemoryStatus(){const s=Ft(e,"Load memory failed");return Je(s.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(s){const i=Ft(e,"Read workspace file failed");return Je(i.readWorkspaceFile(s),"Read workspace file timed out")},async writeMemory(s){const i=Ft(e,"Write memory failed");return Je(i.writeWorkspaceMemory(s),"Write memory timed out")},async listAgents(){const s=Ft(e,"List agents failed");return Je(s.listWorkspaceAgents(),"List agents timed out")},async getAgent(s){const i=Ft(e,"Get agent failed");return Je(i.getWorkspaceAgent(s),"Get agent timed out")},async createAgent(s){const i=Ft(e,"Create agent failed");return Je(i.createWorkspaceAgent(s),"Create agent timed out")},async generateAgent(s){const i=Ft(e,"Generate agent failed");return Je(i.generateWorkspaceAgent(s),"Generate agent timed out",uH)},async deleteAgent(s,i){const o=Ft(e,"Delete agent failed");return Je(o.deleteWorkspaceAgent(s,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(s,i){Ft(e,"Glob workspace failed");const o=R2(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 Je(fetch(L2(o,n),{headers:N2(r)}),"Glob workspace timed out");if(!a.ok)throw new Error(await j2(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=Ft(e,"Load providers failed");return Je(s.workspaceProviders(),"Load providers timed out")},async readFileBytes(s,i){const o=Ft(e,"Read file bytes failed");return Je(o.readWorkspaceFileBytes(s,i??{}),"Read file bytes timed out")},async writeFile(s){const i=Ft(e,"Write file failed");return Je(i.writeWorkspaceFile(s),"Write file timed out")},async editFile(s){const i=Ft(e,"Edit file failed");return Je(i.editWorkspaceFile(s),"Edit file timed out")},async stat(s){Ft(e,"Stat file failed");const i=R2(n,"/stat");i.searchParams.set("path",s);const o=await Je(fetch(L2(i,n),{headers:N2(r)}),"Stat file timed out");if(!o.ok)throw new Error(await j2(o,"GET /stat"));return await o.json()},async listDirectory(s){Ft(e,"List directory failed");const i=R2(n,"/list");i.searchParams.set("path",s);const o=await Je(fetch(L2(i,n),{headers:N2(r)}),"List directory timed out");if(!o.ok)throw new Error(await j2(o,"GET /list"));return await o.json()},async loadEnv(){const s=Ft(e,"Load env failed");return Je(s.workspaceEnv(),"Load env timed out")},async loadPreflight(){const s=Ft(e,"Load preflight failed");return Je(s.workspacePreflight(),"Load preflight timed out")},async initWorkspace(s){const i=Ft(e,"Init workspace failed");return Je(i.initWorkspace(s),"Init workspace timed out")},async updateAgent(s,i,o){const a=Ft(e,"Update agent failed");return Je(a.updateWorkspaceAgent(s,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(s,i){const o=Ft(e,"Install extension failed");return Je(o.installExtension(s,i),"Install extension timed out")},async extensionOperationStatus(s){const i=Ft(e,"Load extension operation failed");return Je(i.extensionOperationStatus(s),"Load extension operation timed out")},async checkExtensionUpdates(s){const i=Ft(e,"Check extension updates failed");return Je(i.checkExtensionUpdates(s),"Check extension updates timed out")},async refreshExtensions(s){const i=Ft(e,"Refresh extensions failed");return Je(i.refreshExtensions(s),"Refresh extensions timed out")},async enableExtension(s,i,o){const a=Ft(e,"Enable extension failed");return Je(a.enableExtension(s,i,o),"Enable extension timed out")},async disableExtension(s,i,o){const a=Ft(e,"Disable extension failed");return Je(a.disableExtension(s,i,o),"Disable extension timed out")},async updateExtension(s,i){const o=Ft(e,"Update extension failed");return Je(o.updateExtension(s,i),"Update extension timed out")},async uninstallExtension(s,i){const o=Ft(e,"Uninstall extension failed");return Je(o.uninstallExtension(s,i),"Uninstall extension timed out")},async startDeviceFlow(s){const i=Ft(e,"Start device flow failed");return Je(i.startDeviceFlow({providerId:s}),"Start device flow timed out")},async getDeviceFlow(s,i){const o=Ft(e,"Get device flow failed");return Je(o.getDeviceFlow(s,i),"Get device flow timed out")},async cancelDeviceFlow(s){const i=Ft(e,"Cancel device flow failed");return Je(i.cancelDeviceFlow(s),"Cancel device flow timed out")},async getAuthStatus(){const s=Ft(e,"Get auth status failed");return Je(s.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const s=Ft(e,"Get auth providers failed");return Je(s.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(s){const i=Ft(e,"Install auth provider failed");return Je(i.installAuthProvider(s),"Install auth provider timed out")}}}function Ft(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function N2(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function R2(e,t){const n=sN(e),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,r)}function L2(e,t){return sN(t)?e.toString():`${e.pathname}${e.search}`}function sN(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 j2(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 U_=g.createContext(void 0);let pf;function hH({baseUrl:e,token:t,workspaceCwd:n,autoConnect:r=!0,transport:s,children:i}){const o=g.useMemo(()=>r?new wv({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),pf===o&&(pf=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,pf=o,queueMicrotask(()=>{pf===o&&(pf=void 0,o.dispose())})}},[o,b]),u.current=(d==null?void 0:d.workspaceCwd)??n;const w=g.useMemo(()=>dH({getClient:()=>a.current,getWorkspaceCwd:()=>u.current,baseUrl:e,token:t}),[e,t]),x=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:w}},[o,t,e,n,m,y,d,b,w]);return h.jsx(U_.Provider,{value:x,children:i})}function H_(){const e=g.useContext(U_);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function Rc(){return H_().actions}function iN(){return g.useContext(U_)}function fH(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&pS(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&pS(t)||(t==null?void 0:t.kind)==="tool"&&gS(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"&&gS(r))return"responding"}return"idle"}function mH(e,t){const n=fH(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function pS(e){return e.streaming===!0}function gS(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Av=new Set;let b1;function yS(){return b1}function pH(e){return Av.add(e),()=>{Av.delete(e)}}function gH(e){b1={...e},oN()}function hp(){b1!==void 0&&(b1=void 0,oN())}function oN(){for(const e of Av)e()}function yH(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 Ev=new Set,aN=Object.freeze([]),D2=64;let Ql=aN;function bS(){return Ql}function bH(e){return Ev.add(e),()=>{Ev.delete(e)}}function wH(e){const t=[...Ql,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>D2){const n=t.length-D2;console.debug(`[mid-turn] sidechannel buffer over ${D2}; evicting ${n} oldest batch(es)`),Ql=t.slice(n)}else Ql=t;lN()}function vH(e){if(e.length===0||Ql.length===0)return;const t=new Set(e),n=Ql.filter(r=>!t.has(r));n.length!==Ql.length&&(Ql=n.length===0?aN:n,lN())}function lN(){for(const e of Ev)e()}function xH(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==HI)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}:{}}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Mv=new Set,Iv=new Set;let cN=0,Vd=[];function _H(){return cN}function wS(){return Vd}function kH(e){return Mv.add(e),()=>{Mv.delete(e)}}function SH(e){return Iv.add(e),()=>{Iv.delete(e)}}function TH(){cN++;for(const e of Mv)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function uN(){for(const e of Iv)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function CH(e){if(e.length===0)return;const t=new Set(e),n=Vd.filter(r=>!t.has(r));n.length!==Vd.length&&(Vd=n,uN())}function AH(e){const t=dN(e);return t?(Vd=[...Vd,t].slice(-200),uN(),(t.type===N_||t.type===R_||t.type===L_)&&TH(),!0):!1}function EH(e){return dN(e)!==void 0}function dN(e){if(!e||typeof e!="object")return;const t=e,n=t.type,r=t.data;if(!r||typeof r!="object")return;const s=r;if(typeof s.sessionId=="string"&&((n===N_||n===R_||n===L_)&&typeof s.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof s.promptId=="string"))return e}function Dl(e,t){const n=GI(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const hN=g.createContext(void 0),fN=g.createContext(void 0),V_=g.createContext(void 0),mN=g.createContext(void 0),pN=g.createContext(void 0),gN=g.createContext(void 0),MH=new Set([401,403,404,410]),IH=2e5,NH={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,initVersion:0,authVersion:0},RH=new Set([401,403]),LH=Symbol("unhandled session");function jH(e){const{baseUrl:t,token:n,workspaceCwd:r,sessionId:s,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:l=IH,suppressOwnUserEcho:c=!0,includeRawEvent:u=!1,autoConnect:d=!0,autoReconnect:f=!0,reconnectDelayMs:m=1e3,maxReconnectDelayMs:p=1e4,heartbeatIntervalMs:y=3e4,heartbeatFailureThreshold:v=3,loadWarnings:b,children:w}=e,x=iN(),k=t??(x==null?void 0:x.baseUrl),T=n??(x==null?void 0:x.token),A=r??(x==null?void 0:x.workspaceCwd),M=g.useRef(x==null?void 0:x.client);M.current=x==null?void 0:x.client;const D=g.useRef(x==null?void 0:x.capabilities);D.current=x==null?void 0:x.capabilities;const O=g.useRef(x==null?void 0:x.getCapabilities);O.current=x==null?void 0:x.getCapabilities;const L=g.useRef(s).current,I=L===void 0,B=g.useRef(A);B.current=A;const F=g.useRef(A);A&&(F.current=A);const W=g.useMemo(()=>$U({maxBlocks:l}),[l]),j=g.useRef(void 0),K=g.useRef(void 0),J=g.useRef(new Map),ee=g.useRef(new Map),N=g.useRef(void 0),q=g.useRef(0),P=g.useRef(void 0),E=g.useRef(!1),ne=g.useRef(!1),pe=g.useRef(void 0),be=g.useRef(new WeakSet),xe=g.useRef({suppressOwnUserEcho:c,includeRawEvent:u}),we=g.useRef({reconnectDelayMs:m,maxReconnectDelayMs:p}),de=g.useRef(b),se=g.useRef(void 0);(!se.current||i)&&(se.current=M2(i)),xe.current={suppressOwnUserEcho:c,includeRawEvent:u},we.current={reconnectDelayMs:m,maxReconnectDelayMs:p},de.current=b;const ae=o==null?void 0:o.modelServiceId,_e=o==null?void 0:o.sessionScope,qe=g.useRef(o);qe.current=o;const[He,re]=g.useState("idle"),[ye,Te]=g.useState(L),[ke,vt]=g.useState("load"),[rt,Mt]=g.useState(0),[Pt,Ze]=g.useState(0),[bt,ft]=g.useState(0),[ie,H]=g.useState({status:d?"connecting":"idle",...L?{sessionId:L}:{}}),oe=g.useRef(ie);oe.current=ie;const De=g.useRef(0),[tt,Ct]=g.useState([]),Et=g.useCallback(dt=>{const Wt={...dt,id:dt.id??`daemon-notice-${Date.now()}-${++De.current}`,createdAt:dt.createdAt??Date.now()};return Ct(Rn=>[...Rn.slice(-49),Wt]),Wt},[]),Qt=g.useCallback(dt=>{Ct(Wt=>Wt.filter(Rn=>Rn.id!==dt))},[]),on=g.useCallback(()=>{Ct([])},[]),he=g.useMemo(()=>({notices:tt,dismissNotice:Qt,clearNotices:on}),[on,Qt,tt]),[X,ue]=g.useState(NH),me=g.useRef(()=>!1),We=g.useRef(!1);g.useEffect(()=>(We.current=!0,()=>{We.current=!1}),[]),g.useEffect(()=>{if(!d)return;if(!M.current&&!k){H({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const dt=new AbortController;let Wt=!1;return(async()=>{var ln,xn,Ee,ht,en,ns,ri,Si,$o,gr,Sr;const rs=M.current??new wv({baseUrl:k,token:T});let fe,ze,St=ye,sn=!ye&&bt>0,nn=0,yr=()=>!1,qr=!1;for(;!Wt&&!dt.signal.aborted;){try{let Gt=!1,rn=!1,Ur=!1,$s=!1,Hr,br;if(!fe){const te=j.current;te&&!ye&&!St&&!sn&&(fe=te,St=te.sessionId,K.current=te.sessionId,$s=!0)}if(!fe){H(Qn=>({...Qn,status:"connecting",error:void 0}));const te=O.current,Ve=D.current??(te?await te():await rs.capabilities());if(Wt||dt.signal.aborted)return;ze=Ve,E.current=Array.isArray(Ve.features)&&Ve.features.includes("client_heartbeat");const Xe=B.current??Ve.workspaceCwd;if(F.current=Xe,(I||ne.current)&&!ye&&!St&&!sn){const[Qn,Cn]=await Promise.allSettled([rs.workspaceProviders(),rs.workspaceSkills()]);Qn.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",Qn.reason),Cn.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",Cn.reason);const _n=Qn.status==="fulfilled"?Qn.value:void 0,To=hS(_n),{commands:Uo,skills:Xi}=UU(Cn.status==="fulfilled"?Cn.value:void 0);H(Qu=>({...Qu,status:"connected",workspaceCwd:Xe,models:To.models,currentModel:To.currentModel,currentMode:To.currentMode,contextWindow:To.contextWindow,providers:_n,capabilities:Ve,...Uo.length>0?{commands:Uo}:{},...Xi.length>0?{skills:Xi}:{}}));return}const Tt=ye&&ke==="resume"?ff.resume:ff.load,qt=i?se.current:M2(void 0,ye??St),Ot=ye?await Tt(rs,ye,{workspaceCwd:Xe},qt):St?await ff.load(rs,St,{workspaceCwd:Xe},qt):await ff.createOrAttach(rs,{...ae!==void 0?{modelServiceId:ae}:{},...sn?{sessionScope:"thread"}:_e!==void 0?{sessionScope:_e}:{},workspaceCwd:Xe},qt);if(!i&&Ot.clientId&&(se.current=Ot.clientId,vg(Ot.clientId,Ot.sessionId)),Wt||dt.signal.aborted){mS({baseUrl:k,token:T,sessionId:Ot.sessionId,clientId:Ot.clientId}).catch(Qn=>console.warn("[DaemonSessionProvider] detach failed:",Qn));return}const $n=K.current;$n!==Ot.sessionId&&on(),$n!==void 0&&Ot.sessionId!==$n?(re("idle"),Rr(P),Ur=!0):$n!==void 0&&(Ot.replaySnapshot.compactedReplay.length+Ot.replaySnapshot.liveJournal.length>0?(re("idle"),Rr(P),Ur=!0):(W.dispatch({type:"assistant.done",reason:"reconnected"}),W.getSnapshot().awaitingResync&&W.clearAwaitingResync())),Gt=$n!==void 0&&$n===Ot.sessionId,rn=Ot.replaySnapshot.compactedReplay.length>0||Ot.replaySnapshot.liveJournal.length>0;const Wr=[...Ot.replaySnapshot.compactedReplay,...Ot.replaySnapshot.liveJournal];Hr=GU(Wr),br=q_(Hr),fe=Ot,St=fe.sessionId,sn=!1,K.current=fe.sessionId,j.current=fe}const xt=fe,Ea=be.current.has(xt);let ss=xt.hasActivePrompt===!0&&!Ea;const Vr=()=>{be.current.add(xt),ss=!1},Cs=()=>ss||J.current.has(xt.sessionId);yr=Cs,me.current=Cs,re(Cs()?"streaming":"idle");const Kh=$s&&oe.current.commands!==void 0&&oe.current.skills!==void 0&&oe.current.supportedCommands!==void 0&&oe.current.context!==void 0,[zo,Ma,Fo]=Kh?[void 0,void 0,void 0]:await Promise.allSettled([rs.workspaceProviders(),xt.supportedCommands(),xt.context()]),Xn=(zo==null?void 0:zo.status)==="fulfilled"?zo.value:void 0,Ki=(Ma==null?void 0:Ma.status)==="fulfilled"?Ma.value:void 0,Ia=(Fo==null?void 0:Fo.status)==="fulfilled"?Fo.value:void 0,Q=[(zo==null?void 0:zo.status)==="rejected"?(ln=de.current)==null?void 0:ln.models:void 0,(Ma==null?void 0:Ma.status)==="rejected"?(xn=de.current)==null?void 0:xn.commands:void 0,(Fo==null?void 0:Fo.status)==="rejected"?(Ee=de.current)==null?void 0:Ee.context:void 0].filter(te=>!!te),ce=hS(Xn),Ie=qU(Ia),Qe=Ie&&Ie.models.length>0?Ie.models:ce.models,Kt=(Ie==null?void 0:Ie.currentModel)??ce.currentModel,Dt=Kt===ce.currentModel?ce.contextWindow:(ht=ce.models.find(te=>te.id===Kt))==null?void 0:ht.contextWindow,pn=(Ie==null?void 0:Ie.contextWindow)??((en=Qe.find(te=>te.id===Kt))==null?void 0:en.contextWindow)??Dt,{commands:Pn,skills:or}=ZI(Ki),Tn=WU(Ia)??ce.currentMode;H(te=>({status:"connected",sessionId:xt.sessionId,...xt.clientId?{clientId:xt.clientId}:{},workspaceCwd:xt.workspaceCwd,commands:Pn.length>0?Pn:te.commands,skills:or.length>0?or:te.skills,models:Qe.length>0?Qe:te.models,currentModel:Kt??te.currentModel,currentMode:Tn??te.currentMode,displayName:VU(xt.state)??(te.sessionId===xt.sessionId?te.displayName:void 0),tokenUsage:Hr!==void 0?Hr:te.sessionId===xt.sessionId?te.tokenUsage:void 0,tokenCount:br!==void 0?br:te.sessionId===xt.sessionId?te.tokenCount??0:0,contextWindow:pn??te.contextWindow,providers:Xn??te.providers,supportedCommands:Ki??te.supportedCommands,context:Ia??te.context,capabilities:ze??te.capabilities,catchingUp:Gt||xt.lastEventId!=null||void 0})),Q.length>0&&W.dispatch(Q.map(te=>({type:"status",text:te})));const zs=N.current,Yi=(zs==null?void 0:zs.sessionId)===xt.sessionId?zs:void 0,{compactedReplay:ms,liveJournal:ko}=xt.replaySnapshot,si=[...ms,...ko];if(Ur&&!(rn&&si.length>0)&&W.reset(),rn&&si.length>0){const te={...xe.current,suppressOwnUserEcho:!1},Ve=[];for(const Xe of si)try{const Tt=xS(Xe,xt.clientId,te,H,{updateConnection:!1});if(Ve.push(..._S(Xe,Tt,Et)),Xe.type==="turn_complete"){const _t=((ns=Xe.data)==null?void 0:ns.stopReason)??"end_turn";Ve.push(Dl(Xe,_t))}else Xe.type==="turn_error"&&Ve.push(Dl(Xe,"error"))}catch(Tt){const _t=Tt instanceof Error?Tt.message:String(Tt);Et({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:",Tt)}Ur&&W.reset(),Ve.length>0&&(W.dispatch(Ve),SS(Ve,ue));for(const Xe of si)vS(J.current,ee.current,xt.sessionId,Xe,W,re,P,{requireBoundPromptId:!0});H(Xe=>({...Xe,catchingUp:void 0}))}Yi&&(N.current=void 0,clearTimeout(Yi.timeout),pe.current===xt.sessionId&&(pe.current=void 0),Yi.resolve());let Xu=!1,So=!1;const qo=()=>{const te=J.current.get(xt.sessionId);te==null||te.controller.abort(),J.current.delete(xt.sessionId),ss&&Vr(),Rr(P),re("idle"),W.reset(),xt.setLastEventId(0),St=xt.sessionId,So=!0,fe=void 0,j.current=void 0,me.current=()=>!1,H(Ve=>({...Ve,status:"connecting",error:void 0}))};for await(const te of xt.events({signal:dt.signal,maxQueued:a})){if(((ri=j.current)==null?void 0:ri.sessionId)!==xt.sessionId)break;Xu||(Xu=!0,nn=0);try{const Ve=yH(te);if(Ve){gH(Ve);continue}const Xe=xH(te);Xe&&wH(Xe),EH(te)&&(AH(te),te.type==="pending_prompt_started"&&(Rr(P),re("waiting")));const Tt=xS(te,xt.clientId,xe.current,H),_t=_S(te,Tt,Et);if(te.type==="state_resync_required"&&(typeof te.data=="object"&&te.data!==null?te.data.reason:void 0)==="epoch_reset"){qo();break}if(SS(_t,ue),_t.length>0){const Cn=O2(_t);re(_n=>_n==="waiting"||_n==="idle"&&Cn?"streaming":_n)}const qt=vS(J.current,ee.current,xt.sessionId,te,W,re,P);let Ot=!1;if(!qt&&ss&&(te.type==="turn_complete"||te.type==="turn_error")){Vr(),Ot=!0,Rr(P);const Cn=te.type==="turn_complete"?((Si=te.data)==null?void 0:Si.stopReason)??"end_turn":"error";W.dispatch(Dl(te,Cn)),Cs()||re("idle")}const Wr=!Cs()&&W.getSnapshot().activeAssistantBlockId!=null?_t.filter(Cn=>Cn.type!=="debug"):_t;W.dispatch(Wr);for(const Cn of _t)if(Cn.type==="prompt.cancelled"&&(ss||Cn.originatorClientId!==xt.clientId)){W.dispatch(Dl(te,"cancelled"));const _n=ss;Vr(),Ot=!0,Rr(P),_n||J.current.delete(xt.sessionId),Cs()||re("idle")}else Cn.type==="session.replay_complete"&&(H(_n=>({..._n,catchingUp:void 0})),W.getSnapshot().awaitingResync&&W.clearAwaitingResync(),Cs()||(Rr(P),W.dispatch({type:"assistant.done",reason:"replay_complete"}),re("idle")));const Qn=!qt&&!Ot&&!Cs();if(Qn&&(_t.some(_n=>_n.type==="user.text.delta")?re("waiting"):O2(_t)&&re(_n=>_n==="idle"?"streaming":_n)),Qn&&te.type==="turn_complete"){Rr(P);const Cn=(($o=te.data)==null?void 0:$o.stopReason)??"end_turn";W.dispatch(Dl(te,Cn)),re("idle")}else Qn&&te.type==="turn_error"?(Rr(P),W.dispatch(Dl(te,"error")),re("idle")):Qn&&O2(_t)&&ZU(W,P,"passive_observer",3e3,()=>re("idle"));if(te.type==="state_resync_required"&&(typeof te.data=="object"&&te.data!==null?te.data.reason:void 0)!=="epoch_reset"){Cs()||(re("idle"),Rr(P)),W.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",xt.sessionId),So=!0,fe=void 0,j.current=void 0,me.current=()=>!1,H(_n=>({..._n,status:"connecting",error:void 0}));break}if(te.type==="session_closed"&&((gr=te.data)==null?void 0:gr.reason)==="client_close"){qr=!0;const Cn=xt.sessionId,_n=J.current.get(Cn);_n==null||_n.controller.abort(),J.current.delete(Cn),fe=void 0,j.current=void 0;break}}catch(Ve){const Xe=Ve instanceof Error?Ve.message:String(Ve);Et({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:Xe,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",Ve)}}if(qr){W.dispatch({type:"assistant.done",reason:"cancelled"}),re("idle"),Rr(P),H(te=>({...te,status:"disconnected",sessionId:void 0,error:void 0}));return}if(ne.current){fe=void 0,j.current=void 0,me.current=()=>!1;return}!Wt&&!dt.signal.aborted&&!So&&(((Sr=j.current)==null?void 0:Sr.sessionId)===xt.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),Cs()||(Rr(P),re("idle"),W.dispatch({type:"assistant.done",reason:"stream_ended"}))),H(te=>({...te,status:"disconnected",error:void 0})))}catch(Gt){if(Wt||dt.signal.aborted)return;const rn=Gt instanceof Error?Gt.message:String(Gt),Ur=fe==null?void 0:fe.sessionId,$s=HH(Gt),Hr=UH(Gt);if(Ur&&($s||Hr)){const xt=J.current.get(Ur);xt==null||xt.controller.abort(),J.current.delete(Ur)}($s||Hr||!yr())&&(Rr(P),re("idle"));const br=N.current;if(br&&(br.sessionId===ye||br.sessionId===St)&&(pe.current===br.sessionId&&(pe.current=void 0),N.current=void 0,clearTimeout(br.timeout),br.reject(Gt)),$s||Hr){if(fe=void 0,j.current=void 0,$s){H({status:"error",error:rn});return}H(xt=>({...xt,status:"disconnected",sessionId:void 0,error:rn,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",fe==null?void 0:fe.sessionId);if(!f){fe=void 0,j.current=void 0,H({status:"error",error:rn});return}H(xt=>({...xt,status:"disconnected",error:rn}))}if(!f){j.current=void 0,H(Gt=>({...Gt,status:"disconnected",catchingUp:void 0}));return}nn+=1;const Ps=we.current,hr=QU(nn,Ps.reconnectDelayMs,Ps.maxReconnectDelayMs);H(Gt=>({...Gt,status:"disconnected",error:`Reconnecting in ${hr}ms`})),await JU(hr,dt.signal)}})(),()=>{const ln=j.current;Wt=!0,dt.abort(),me.current=()=>!1,re("idle"),Rr(P);const xn=(ln==null?void 0:ln.sessionId)===pe.current,Ee=!We.current;N.current&&(!xn||Ee)&&(clearTimeout(N.current.timeout),N.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),N.current=void 0),(!xn||Ee)&&(ln!=null&&ln.clientId)&&mS({baseUrl:k,token:T,sessionId:ln.sessionId,clientId:ln.clientId}).catch(ht=>console.warn("[DaemonSessionProvider] detach failed:",ht)),(!xn||Ee)&&(j.current=void 0)}},[d,f,k,T,r,ae,_e,a,W,ye,ke,rt,Pt,bt,i,I,on,Et]),g.useEffect(()=>{if(!E.current||ie.status!=="connected"||y<=0||v<=0||!ie.sessionId)return;let dt=!1,Wt=0;const Rn=setInterval(()=>{const ln=j.current;ln&&ln.heartbeat().then(()=>{dt||(Wt>=v&&H(xn=>xn.sessionId===ln.sessionId?{...xn,status:"connected",error:void 0}:xn),Wt=0)}).catch(xn=>{if(dt||(Wt+=1,Wt<v))return;const Ee=xn instanceof Error?xn.message:"Session heartbeat failed";H(ht=>ht.sessionId===ln.sessionId?{...ht,status:"disconnected",error:Ee}:ht)})},y);return()=>{dt=!0,clearInterval(Rn)}},[ie.sessionId,ie.status,v,y]);const At=g.useMemo(()=>rH({store:W,sessionRef:j,activePromptsRef:J,settledPromptsRef:ee,pendingSessionLoadRef:N,pendingSessionLoadIdRef:q,heartbeatSupportedRef:E,manualSessionClearRef:ne,skipNextCleanupDetachSessionIdRef:pe,passiveAssistantDoneTimerRef:P,hasSessionActivePrompt:()=>me.current(),resetCurrentSessionActivePrompt:()=>{me.current=()=>!1},getCreateSessionRequest:()=>{var dt;return{...qe.current,sessionScope:"thread",workspaceCwd:F.current??((dt=j.current)==null?void 0:dt.workspaceCwd)}},createDetachedSession:()=>{var dt;const Wt=M.current??new wv({baseUrl:k,token:T}),Rn={...qe.current,sessionScope:"thread",workspaceCwd:F.current??((dt=j.current)==null?void 0:dt.workspaceCwd)},ln=i?se.current:M2(void 0);return ff.createOrAttach(Wt,Rn,ln)},getConnection:()=>oe.current,addNotice:Et,setConnection:H,setPromptStatus:re,setRestoreSessionId:Te,setRestoreMode:vt,setRestoreSessionNonce:Mt,setAttachSessionNonce:Ze,setNewSessionNonce:ft}),[Et,i,k,T,W]),jt=g.useRef(LH);return g.useEffect(()=>{if(jt.current===s)return;jt.current=s;const dt=oe.current.sessionId;if(s===dt)return;const Wt=s?At.loadSession(s,{deferTranscriptReset:!0}):dt?At.clearSession():void 0;Wt&&Wt.catch(Rn=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",Rn)})},[At,s]),h.jsx(hN.Provider,{value:W,children:h.jsx(fN.Provider,{value:ie,children:h.jsx(mN.Provider,{value:He,children:h.jsx(pN.Provider,{value:he,children:h.jsx(gN.Provider,{value:X,children:h.jsx(V_.Provider,{value:At,children:w})})})})})})}function vS(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;Rr(o);try{const d=I_(r,c);if(!d)return!1;s.dispatch(Dl(r,d.stopReason)),i("idle"),u.resolve?(e.delete(n),u.resolve(d)):(e.delete(n),t.set(Cv(n,c),{status:"resolved",result:d}))}catch(d){s.dispatch(Dl(r,"error")),i("idle"),u.reject?(e.delete(n),u.reject(d)):(e.delete(n),t.set(Cv(n,c),{status:"rejected",error:d}))}return!0}function DH(e){return e.type==="turn_complete"}function xS(e,t,n,r,s={}){s.updateConnection!==!1&&HU(e,r);const i=fq(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=zH(e);return DH(e)?o?[o]:[]:o?[...i,o]:i}function _S(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(OH(e,s));(i.category==="protocol"||i.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",i)}return r}function OH(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 W_(){const e=g.useContext(hN);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function Ly(){const e=W_(),t=g.useCallback(()=>e.getSnapshot().blocks,[e]);return g.useSyncExternalStore(e.subscribe,t,t)}function G_(){const e=Ly(),t=PH();return g.useMemo(()=>mH(e,t),[e,t])}function jy(){const e=g.useContext(V_);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function BH(){return g.useContext(V_)}function Hu(){return g.useContext(gN)}function PH(){const e=g.useContext(mN);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function gl(){const e=g.useContext(fN);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function $H(){const e=g.useContext(pN);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function O2(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function zH(e){if(e.type!=="session_update")return null;const t=Ua(e.data)?e.data:void 0,n=Ua(t==null?void 0:t.update)?t.update:Ua(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!Ua(r))return null;const s=FH(r.goalStatus);if(s)return kS(e,s);const i=qH(r.goalTerminal);if(i)return kS(e,i);const o=r.stopHookLoop;if(!Ua(o))return null;const a=o.goal;return!Ua(a)||!vu(a,"condition"),null}function kS(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function FH(e){if(!Ua(e))return null;const t=vu(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=vu(e,"condition");if(!n)return null;const r=lm(e,"iterations"),s=lm(e,"durationMs"),i=lm(e,"setAt"),o=vu(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 qH(e){if(!Ua(e))return null;const t=vu(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=vu(e,"condition");if(!n)return null;const r=lm(e,"iterations"),s=lm(e,"durationMs"),i=vu(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i?{lastReason:i}:{}}}function vu(e,t){const n=e[t];return typeof n=="string"?n:void 0}function lm(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function SS(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 UH(e){const t=yN(e);return t!==void 0&&MH.has(t)}function HH(e){const t=yN(e);return t!==void 0&&RH.has(t)}function yN(e){if(e instanceof Iu||Ua(e)&&typeof e.status=="number")return e.status}function Ua(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function jh(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 x0(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 VH(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.listAgents(),[n]),s=jh(r,e),i=Hu();return x0(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 bN(e={}){const t=Rc(),n=g.useCallback(()=>t.loadMcpStatus(),[t]),r=jh(n,e),s=Hu();return x0(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 WH(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.loadMemoryStatus(),[n]),s=jh(r,e),i=Hu();return x0(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 Dy(e={}){const{pageSize:t,...n}=e,r=H_(),s=BH(),i=g.useCallback(()=>r.actions.listSessions({pageSize:t}),[t,r.actions]),o=!!r.workspaceCwd,a=jh(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 wN(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.loadToolsStatus(),[n]),s=jh(r,e),i=Hu();return x0(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 GH(e={}){var t;const n=Rc(),r=g.useCallback(()=>n.loadSettingsStatus(),[n]),s=jh(r,e),i=Hu();return x0(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 KH=300,YH=100,gd=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function B2(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function XH(e){const{enabled:t=!0,onStateChange:n,getOnAccept:r,getOnOutcome:s}=e;let i=gd,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(gd);return}t&&(o=setTimeout(()=>{c({suggestion:v,isVisible:!0,shownAt:Date.now()})},KH))},accept:(v,b)=>{var w;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const x=i.suggestion,{shownAt:k}=i;if(!x){a=!1;return}try{(w=s())==null||w({outcome:"accepted",accept_method:v,time_ms:k>0?Date.now()-k:0,suggestion_length:x.length})}catch(T){console.error("[followup] onOutcome callback threw:",T)}c(gd),queueMicrotask(()=>{var T;try{b!=null&&b.skipOnAccept||(T=r())==null||T(x)}catch(A){console.error("[followup] onAccept callback threw:",A)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},YH)}})},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(gd)}},clear:()=>{u(),a=!1,c(gd)},cleanup:()=>{u(),a=!1}}}function QH(e={}){const{enabled:t=!0,onAccept:n,onOutcome:r}=e,s=W_(),i=gl().sessionId,[o,a]=g.useState(gd),l=g.useRef(n);l.current=n;const c=g.useRef(r);c.current=r;const u=g.useSyncExternalStore(s.subscribe,()=>s.getSnapshot().lastFollowupSuggestion,()=>s.getSnapshot().lastFollowupSuggestion),d=g.useSyncExternalStore(pH,yS,yS),f=(d==null?void 0:d.sessionId)===i?d:u,m=g.useMemo(()=>XH({enabled:t,onStateChange:a,getOnAccept:()=>l.current,getOnOutcome:()=>c.current}),[t]),{setSuggestion:p}=m;g.useEffect(()=>(t||m.clear(),()=>m.cleanup()),[m,t]);const y=g.useRef(void 0),v=g.useRef(i);g.useEffect(()=>{const k=v.current;v.current=i,k!==void 0&&i!==void 0&&k!==i&&(m.clear(),hp(),y.current=void 0)},[m,i]),g.useEffect(()=>{const k=f==null?void 0:f.promptId;k!==y.current&&(y.current=k,p((f==null?void 0:f.suggestion)??null))},[f,p]);const b=g.useCallback(()=>{m.clear(),B2(s),hp(),y.current=void 0},[m,s]),w=g.useCallback((k,T)=>{m.accept(k,T),B2(s),hp(),y.current=void 0},[m,s]),x=g.useCallback(()=>{m.dismiss(),B2(s),hp(),y.current=void 0},[m,s]);return g.useMemo(()=>({followupState:o,onAcceptFollowup:w,onDismissFollowup:x,clear:b}),[o,w,x,b])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function JH(){const e=g.useSyncExternalStore(bH,bS,bS),t=g.useCallback(n=>vH(n),[]);return{batches:e,consume:t}}function ZH(e){for(const t of e){if(!eV(t))continue;const n=t;if(n.resolved)continue;const r=Rd(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=Rd(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:nV(l.raw)})),rawInput:tV(n.toolCall)}}return null}function eV(e){return e.kind==="permission"}function tV(e){const t=Rd(e);return t?Rd(t.rawInput)??Rd(t.input)??Rd(t.args)??t:void 0}function Rd(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function nV(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e.kind;return t==="allow_once"||t==="allow_always"||t==="reject_once"||t==="reject_always"?t:void 0}function rV(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 ld(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 TS(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const sV=(e,t)=>Math.abs(e-t)<1.01,iV=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let gf;const P2=()=>{if(gf!==void 0)return gf;if(typeof navigator>"u")return gf=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return gf=!0;const e=navigator.maxTouchPoints;return gf=navigator.platform==="MacIntel"&&e!==void 0&&e>0},CS=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},oV=e=>e,aV=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},lV=(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(CS(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(CS(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},w1={passive:!0},cV=typeof window>"u"?!0:"onscrollend"in window,uV=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&cV;let o=0;const a=i?null:iV(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,w1),i&&r.addEventListener("scrollend",u,w1),()=>{r.removeEventListener("scroll",c),i&&r.removeEventListener("scrollend",u)}},dV=(e,t)=>uV(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),hV=(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"]},fV=(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})},mV=fV;class pV{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:oV,rangeExtractor:aV,onChange:()=>{},measureElement:hV,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 x=f>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.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 w=p[b];if(w){const x=w.start+m;x!==this.scrollOffset&&(d=x-this.scrollOffset,this.scrollOffset=x,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=ld(()=>(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,!(!P2()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,w1),i.addEventListener("touchend",a,w1),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&&(P2()&&(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=ld(()=>[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=ld(()=>[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 x=new Float64Array(y);v&&d>0&&x.set(v.subarray(0,d*2)),v=x,this._flatMeasurements=v}let b;if(d===0)b=r+s;else{const x=d-1;b=v[x*2]+v[x*2+1]+p}for(let x=d;x<n;x++){const k=i(x),T=u.get(k),A=typeof T=="number"?T:this.options.estimateSize(x);v[x*2]=b,v[x*2+1]=A,b+=A+p}const w=rV(n,v,i);return this.measurementsCache=w,w}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,w;const x=l==="estimate"||u.has(y);if(v!==void 0&&this.options.lanes>1){b=v;const M=m[b],D=M!==void 0?f[M]:void 0;w=D?D.end+this.options.gap:r+s}else{const M=this.options.lanes===1?f[p-1]:this.getFurthestMeasurement(f,p);w=M?M.end+this.options.gap:r+s,b=M?M.lane:p%this.options.lanes,this.options.lanes>1&&x&&this.laneAssignments.set(p,b)}const k=u.get(y),T=typeof k=="number"?k:this.options.estimateSize(p),A=w+T;f[p]={index:p,start:w,size:T,end:A,key:y,lane:b},m[b]=p}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ld(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?gV({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=ld(()=>{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=ld(()=>[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=vN(0,r.length-1,i?a=>s[a*2]:a=>TS(r[a]).start,n);return TS(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&&(P2()&&(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&&sV(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 vN=(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 gV({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=vN(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 $2=typeof document<"u"?g.useLayoutEffect:g.useEffect;function yV({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 w=b.start-y,x=c.elementsCache.get(b.key);x&&u.lastPositions.get(x)!==w&&(u.lastPositions.set(x,w),m?x.style.transform=f?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:x.style[p]=`${w}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?fy.flushSync(s):s()),(d=r.onChange)==null||d.call(r,c,u)}},[l]=g.useState(()=>{const c=new pV(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),$2(()=>l._didMount(),[]),$2(()=>l._willUpdate()),$2(()=>{o(l)}),l}function bV(e){return yV({observeElementRect:lV,observeElementOffset:dV,scrollToFn:mV,...e})}function xN(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function wV(e){var t;return((t=xN(e))==null?void 0:t.type)==="task_execution"}function Oy(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||wV(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function _N(e){var n;if(!Oy(e))return!1;const t=xN(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const kN=g.createContext({}),vV=kN.Provider;function Lc(){return g.useContext(kN)}const xV=["en","zh-CN"],K_={"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.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.noSession":"No active session yet. Send your first message before viewing context usage.","contextUsage.noApiResponse":"No API response yet. Send a message to see actual usage.","contextUsage.overLimit":"Context exceeds limit! Use /compress or /clear to reduce.","contextUsage.skills":"Skills","contextUsage.systemPrompt":"System prompt","contextUsage.title":"Context Usage","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"Usage by category","contextUsage.used":"Used","delete.cannotCurrent":"Cannot delete the current active session.","delete.action":"Delete","delete.deleted":"Session deleted.","delete.deletedCount":e=>`${(e==null?void 0:e.count)??0} session(s) deleted.`,"delete.deleting":"Deleting...","delete.failed":e=>`Failed to delete session.${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ navigate · Space select · Enter delete · Esc cancel","delete.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"delete.none":"No sessions to delete","delete.allFailed":e=>`Failed to delete ${(e==null?void 0:e.count)??0} session(s): ${(e==null?void 0:e.reason)??"unknown error"}`,"delete.nonRemoved":"No sessions were deleted.","delete.notFound":"Session not found — it may have been deleted already.","delete.partialFail":e=>`${(e==null?void 0:e.removed)??0} deleted, ${(e==null?void 0:e.failed)??0} failed: ${(e==null?void 0:e.detail)??"unknown error"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"delete.pressSearch":"Press / to search; Space to select; Enter to delete","delete.selected":e=>`${(e==null?void 0:e.count)??0} selected`,"delete.title":"Delete Session","time.justNow":"just now","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} min ago`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0}h ago`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0}d ago`,"dialog.footer.close":"Esc to close","dialog.footer.confirmCancel":"Enter to confirm · Esc to cancel","release.cannotCurrent":"Cannot release the current active session.","release.action":"Release","release.released":"Session released successfully.","release.failed":e=>`Failed to release session.${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ to navigate · Enter to release · Esc to cancel","release.inactive":"Only active live sessions can be released.","release.inactiveBadge":"inactive","release.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"release.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"release.none":"No live sessions to release","release.pressSearch":"Press / to search; Enter releases the selected live session","release.releasing":"Releasing...","release.title":"Release Session","dialog.footer.menu":"Esc to menu","dialog.footer.mcpServers":"↑↓ to navigate · Enter details · r refresh · Esc close","dialog.footer.mcpSelect":"↑↓ to navigate · Enter select · Esc back","dialog.footer.modelFast":"↑↓ to navigate · / to search · c for custom · Enter to set fast model · Esc to cancel","dialog.footer.navSelectCancel":"↑↓ to navigate · Enter to select · Esc to cancel","dialog.footer.navSelectClose":"↑↓ to navigate · Enter to select · Esc to close","dialog.footer.navSelectMenu":"↑↓ to navigate · Enter to select · Esc to menu","dialog.footer.navOpenClose":"↑↓ to navigate · Enter to open · Esc to close","dialog.footer.navOpenMenu":"↑↓ to navigate · Enter to open · Esc to menu","dialog.footer.back":"Esc to go back","dialog.footer.backClose":"Esc to close","dialog.footer.saveClose":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to close","dialog.footer.saveMenu":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to menu","dialog.footer.search":"Type to search · Enter to commit · Esc to clear","dialog.footer.select":"Enter to select","editor.escClearHint":"Press Esc again to clear","editor.hintCommands":"commands","editor.hintFiles":"files","editor.hintNext":"next","editor.hintPrev":"previous","editor.hintSearch":"search","editor.noHistory":"No matching history","editor.placeholder":"Type a message or @ file path","editor.shellPlaceholder":"Enter terminal command","editor.send":"Send message","editor.connectionDisconnected":"Connection interrupted. Please try again after it reconnects.","editor.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.toggleMenu":"Toggle menu","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.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.cleared":"Queue cleared.","queue.deleteTip":"Remove from queue","queue.editTip":"Remove from queue and edit again","queue.insertTip":"Insert this message into the current session; it takes effect on the next model call.","queue.inserted":"Inserted. It takes effect on the next model call.","queue.insertCommandDisabled":"Commands can't be inserted into the running turn; they run after it finishes.","queue.submitting":"Submitting...","queue.editing":"Editing...","queue.removing":"Updating...","queue.submittingDisabled":"Submitting queued message...","queue.commandBlocked":"Slash commands can't be queued while a turn is running.","queue.shellBlocked":"Shell commands can't be queued while a turn is running.","queue.queueFailed":"Failed to queue message","queue.insertFailed":"Failed to insert queued message","queue.deleteFailed":"Failed to move message out of queue","queue.editFailed":"Failed to edit queued message","queue.footer":"Press ↑ to edit the latest queued message · Esc to clear queue","queue.imageCount":e=>`(+${(e==null?void 0:e.count)??0} images)`,"queue.more":e=>`... (+${(e==null?void 0:e.count)??0} more)`,"midTurn.inserted":e=>`Inserted message: ${(e==null?void 0:e.message)??""}`,"help.builtIn":"Built-in commands","help.commandCount":e=>`${(e==null?void 0:e.count)??0} commands`,"help.commandMeta.builtIn":"built-in","help.commandMeta.custom":"custom","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} subcommands`,"help.commandsIntro":"Browse built-in commands:","help.customGroup":"Custom, skills, plugins, MCP","help.customIntro":"Browse custom, skill, plugin, and MCP commands:","help.empty":"No commands are currently available.","help.emptyCustom":"No custom commands are currently available.","help.footer":"Tab/Shift+Tab to switch tabs · ↑/↓ or PgUp/PgDn to scroll · Esc to close","help.intro":"Qwen Code understands your codebase, makes edits with your permission, and executes commands right from your terminal.","help.section.shortcuts":"Shortcuts","help.search":"Search commands","help.shortcut.addContext":"Add files or folders as context","help.shortcut.altWords":"Jump through words","help.shortcut.clear":"Clear the screen","help.shortcut.commandMenu":"Open command menu","help.shortcut.completion":"Accept completion or switch help tabs","help.shortcut.history":"Cycle prompt history or scroll lists","help.shortcut.searchHistory":"Search prompt history","help.shortcut.newline":"Insert a newline","help.shortcut.pasteImages":"Paste images","help.shortcut.shell":"Run shell commands","help.shortcut.togglePanel":"Toggle this panel","help.shortcut.retry":"Retry last request","help.shortcut.compact":"Toggle compact mode","retry.hint":"Press Ctrl+Y to retry or click to retry","retry.none":"No failed request to retry.","branch.failed":"Failed to branch session.","branch.success":e=>`Copied session. New session name: "${(e==null?void 0:e.name)??""}". Switched to the new session.`,"fork.empty":"Please provide a directive. Usage: /fork <directive>","fork.failed":e=>`Failed to launch fork: ${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"Background agent was not launched.","fork.started":e=>`Started background agent: "${(e==null?void 0:e.name)??""}". Track it in background tasks.`,"command.hidden":"This command is not available.","help.shortcut.approvals":"Cycle approval modes","help.shortcut.cancel":"Close dialogs or cancel operation","bug.failed":"Failed to load system info for bug report.","bug.popupBlocked":"Popup blocked — please allow popups and try again.","bug.submitted":"Bug report opened in a new tab.","clear.blocked":"Cannot clear while streaming — cancel first (Esc).","error.unknown":"Unknown error","shell.command":"Shell Command","compact.enabled":"Compact mode enabled","compact.disabled":"Compact mode disabled","compact.hint":"Press Ctrl+O to show full tool output","compact.saveFailed":"Failed to save compact mode","help.subcommands":"subcommands","help.tab.commands":"Built-in commands","help.tab.custom":"custom-commands","help.tab.general":"shortcuts","help.title":"Help","slash.category.custom":"Custom commands","slash.category.skill":"Skill commands","slash.category.system":"System commands","language.changed":e=>`UI language changed to ${(e==null?void 0:e.language)??""}`,"language.current":e=>`Current UI language: ${(e==null?void 0:e.language)??""}`,"language.invalid":"Invalid language. Available: en, zh-CN","language.options":"Available options:","language.set":"Set UI language","language.usage":"Usage: /language ui [en|zh-CN]","localCommand.noSession":"No active session yet. Send your first message before using this command.","local.agents":"Manage subagents","local.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.label":"Recap","recap.loading":"Generating recap...","recap.empty":"Not enough conversation context for a recap yet.","recap.failed":"Failed to generate recap","rewind.action":"Rewind","rewind.confirm":"Confirm rewind","rewind.empty":"No rewind snapshots are available for this session.","rewind.failed":e=>`Failed to rewind session: ${(e==null?void 0:e.reason)??""}`,"rewind.loading":"Loading rewind snapshots...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"Rewinding...","rewind.subtitle":"Only the conversation is rewound. Files are not changed.","rewind.title":"Rewind Conversation","rewind.turn":e=>`Prompt ${(e==null?void 0:e.turn)??0}`,"local.rename":"Rename current session","rename.empty":"Please enter a session name, for example /rename project debugging, or use /rename --auto.","rename.success":e=>`Session renamed to ${(e==null?void 0:e.name)??""}`,"local.reset":"Reset current conversation","local.resume":"Resume a previous session","local.skills":"View available skills","local.stats":"Show session statistics","local.tasks":"View background tasks","local.status":"Show version info","local.theme":"Change theme","local.settings":"View and edit settings","local.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.cancelArmed":"Press Esc again to stop","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`current: ${(e==null?void 0:e.theme)??""}`,"theme.auto":"Auto","theme.dark":"Dark","theme.dark.desc":"Terminal-style dark skin.","theme.light":"Light","theme.light.desc":"Terminal-style light skin.","theme.title":"Theme","todo.allDone":"All tasks completed","todo.collapse":"Collapse task list","todo.completedAbove":e=>`✓ ${(e==null?void 0:e.count)??0} completed`,"todo.detail.api":"API","todo.detail.cached":"Cached","todo.detail.end":"End","todo.detail.hide":"Hide task detail","todo.detail.input":"Input","todo.detail.noResources":"Token & time usage wasn't captured for this task.","todo.detail.output":"Output","todo.detail.sectionSpent":"Time spent","todo.detail.sectionTime":"Time","todo.detail.sectionTokens":"Tokens","todo.detail.show":"Show task detail","todo.detail.start":"Start","todo.detail.tool":"Tool","todo.expand":"Expand task list","todo.more":e=>`... ${(e==null?void 0:e.count)??0} more`,"todo.moreAbove":e=>`... ${(e==null?void 0:e.count)??0} earlier`,"todo.showLess":"Show less","todo.stepProgress":e=>`Step ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"Current tasks","chat.scrollToBottom":"Scroll to bottom","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","turn.processed":"Processed","turn.processing":"Processing","turn.collapse":"Collapse steps","turn.expand":"Expand steps","turn.cached":"cached","turn.executionSteps":e=>{const t=(e==null?void 0:e.count)??0;return`${t} step${t===1?"":"s"}`},"turn.toolCalls":e=>{const t=(e==null?void 0:e.count)??0;return`${t} tool call${t===1?"":"s"}`},"turn.thinkingCount":e=>{const t=(e==null?void 0:e.count)??0;return`${t} thought${t===1?"":"s"}`},"turn.stopped":"You cancelled this request","message.renderError":"This message could not be displayed.","tasks.title":"Background tasks","tasks.empty":"No tasks currently running","tasks.refreshStale":"Task status may be stale; reconnecting...","tasks.cancelFailed":"Failed to cancel task","tasks.alreadyStopped":"Task already stopped","tasks.moreAbove":e=>`^ ${(e==null?void 0:e.count)??0} more above`,"tasks.moreBelow":e=>`v ${(e==null?void 0:e.count)??0} more below`,"tasks.running":"Running","tasks.completed":"Completed","tasks.failed":"Failed","tasks.cancelled":"Stopped","tasks.paused":"Paused","tasks.kind.shell":"Shell","tasks.kind.monitor":"Monitor","tasks.action.stop":"Stop","tasks.action.abandon":"Abandon","tasks.action.confirmStop":"Confirm stop","tasks.action.confirmAbandon":"Confirm abandon","tasks.action.confirmHint":"This will end the blocking turn.","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} local agent`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} local agents`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} local agent paused`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} local agents paused`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} task done`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} tasks done`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} monitor`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} monitors`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} shells`,"tasks.confirmStop":"x again to confirm stop · ends the blocking turn","tasks.shortcut.select":"↑/↓ select","tasks.shortcut.view":"Enter view","tasks.shortcut.stop":"x stop","tasks.shortcut.abandon":"x abandon","tasks.shortcut.listClose":"←/Esc close","tasks.shortcut.detailBack":"← go back","tasks.shortcut.detailClose":"Esc/Enter/Space close","tasks.shortcut.close":"Esc close","tasks.shortcut.cancelConfirm":"Esc cancel","tasks.detail.workingDir":"Working dir","tasks.detail.outputFile":"Output file","tasks.detail.command":"Command","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} events`,"tasks.detail.exit":e=>`exit ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} dropped`,"tasks.detail.error":"Error","tasks.detail.stoppedBecause":"Stopped because","tasks.detail.resumeBlocked":"Resume blocked","tasks.detail.progress":"Progress","tasks.detail.prompt":"Prompt","tasks.detail.type":"Type","tasks.detail.runtime":"Time","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"Tool calls","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool calls`,"tips.items":"Type / to see all available commands.|Use @ to reference file paths.|Press Esc to cancel an in-flight request.|Use Shift+Enter for a newline.|Press ↑↓ to browse message history.","tools.available":"Available tools:","tools.none":"No tools available.","tools.empty":"No built-in tools available. Open a session first.","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space for details · ":""}t to toggle ${e.name} · r to refresh · Esc to close`:"r to refresh · Esc to close","tools.details.hide":"Hide details","tools.details.show":"Show details","tools.loading":"Loading tools...","tools.status.disabled":"disabled","tools.status.enabled":"enabled","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} enabled`,"tools.title":"Tools","tools.update.disable":"Disable","tools.update.enable":"Enable","tools.updating":"Updating...","tool.collapse":"▲ Collapse","tool.expand":"Expand","tool.collapseHint":"Collapse","tool.status.failed":"Failed","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:"},_V={...K_,"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.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.noSession":"当前还没有会话。请先发送第一条消息，再查看上下文使用情况。","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.connectionDisconnected":"连接已中断，请在恢复后重试。","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.toggleMenu":"切换菜单","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.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.cleared":"队列已清空。","queue.deleteTip":"移出队列","queue.editTip":"移出队列并将内容放回输入框","queue.insertTip":"将信息插入当前会话，下次模型调用生效。","queue.inserted":"已插入，下次模型调用生效。","queue.insertCommandDisabled":"命令无法插入当前回合。","queue.submitting":"提交中...","queue.editing":"编辑中...","queue.removing":"处理中...","queue.submittingDisabled":"排队消息正在提交中...","queue.commandBlocked":"当前回合运行时，Slash 命令不能进入排队。","queue.shellBlocked":"当前回合运行时，Shell 命令不能进入排队。","queue.queueFailed":"排队消息失败","queue.insertFailed":"插入排队消息失败","queue.deleteFailed":"移出队列失败","queue.editFailed":"编辑排队消息失败","queue.footer":"按 ↑ 编辑最后一条排队消息 · Esc 清空队列","queue.imageCount":e=>`（+${(e==null?void 0:e.count)??0} 张图片）`,"queue.more":e=>`...（还有 ${(e==null?void 0:e.count)??0} 条）`,"midTurn.inserted":e=>`已插入消息：${(e==null?void 0:e.message)??""}`,"help.builtIn":"内置命令","help.commandCount":e=>`${(e==null?void 0:e.count)??0} 个命令`,"help.commandMeta.builtIn":"内置","help.commandMeta.custom":"自定义","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} 个子命令`,"help.commandsIntro":"浏览内置命令：","help.customGroup":"自定义、skills、plugins、MCP","help.customIntro":"浏览自定义、skill、plugin 和 MCP 命令：","help.empty":"当前没有可用命令。","help.emptyCustom":"当前没有可用的自定义命令。","help.footer":"Tab/Shift+Tab 切换标签 · ↑/↓ 或 PgUp/PgDn 滚动 · Esc 关闭","help.intro":"Qwen Code 可以理解代码库，在你的许可下修改文件，并直接执行命令。","help.section.shortcuts":"快捷键","help.search":"搜索命令","help.shortcut.addContext":"添加文件或目录作为上下文","help.shortcut.altWords":"按词跳转","help.shortcut.clear":"清屏","help.shortcut.commandMenu":"打开命令菜单","help.shortcut.completion":"接受补全或切换帮助标签","help.shortcut.history":"切换历史 prompt 或滚动列表","help.shortcut.searchHistory":"搜索历史 prompt","help.shortcut.newline":"插入换行","help.shortcut.pasteImages":"粘贴图片","help.shortcut.shell":"运行 shell 命令","help.shortcut.togglePanel":"切换此面板","help.shortcut.retry":"重试上次请求","help.shortcut.compact":"切换紧凑模式","retry.hint":"按 Ctrl+Y 重试或点击重试","retry.none":"没有可重试的失败请求。","branch.failed":"分支会话失败。","branch.success":e=>`已复制会话，新会话名称为： "${(e==null?void 0:e.name)??""}"，当前已切换到新的会话。`,"fork.empty":"请提供任务指令。用法：/fork <指令>","fork.failed":e=>`启动后台智能体失败：${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"后台智能体未启动。","fork.started":e=>`已启动后台智能体："${(e==null?void 0:e.name)??""}"，可在后台任务中查看。`,"command.hidden":"该命令不可用。","help.shortcut.approvals":"切换审批模式","help.shortcut.cancel":"关闭弹窗或取消操作","bug.failed":"加载系统信息失败，无法提交 Bug 报告。","bug.popupBlocked":"弹窗被拦截，请允许弹窗后重试。","bug.submitted":"Bug 报告已在新标签页中打开。","clear.blocked":"流式输出中无法清屏 — 先按 Esc 取消。","error.unknown":"未知错误","shell.command":"Shell 命令","compact.enabled":"紧凑模式已开启","compact.disabled":"紧凑模式已关闭","compact.hint":"按 Ctrl+O 显示完整工具输出","compact.saveFailed":"保存紧凑模式失败","help.subcommands":"子命令","help.tab.commands":"内置命令","help.tab.custom":"自定义命令","help.tab.general":"快捷键","help.title":"帮助","slash.category.custom":"自定义","slash.category.skill":"Skill","slash.category.system":"系统","language.changed":e=>`UI 语言已切换为 ${(e==null?void 0:e.language)??""}`,"language.current":e=>`当前 UI 语言：${(e==null?void 0:e.language)??""}`,"language.invalid":"语言无效。可用值：en, zh-CN","language.options":"可用选项：","language.set":"设置 UI 语言","language.usage":"用法：/language ui [en|zh-CN]","localCommand.noSession":"当前还没有会话。请先发送第一条消息，再使用这个命令。","local.agents":"管理智能体","local.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.label":"回顾","recap.loading":"正在生成摘要...","recap.empty":"对话内容还不够，暂时无法生成摘要。","recap.failed":"生成摘要失败","rewind.action":"回退","rewind.confirm":"确认回退","rewind.empty":"当前会话没有可回退的快照。","rewind.failed":e=>`回退会话失败：${(e==null?void 0:e.reason)??""}`,"rewind.loading":"正在加载可回退的 prompt...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"回退中...","rewind.subtitle":"仅回退会话，不涉及文件。","rewind.title":"回退会话","rewind.turn":e=>`第 ${(e==null?void 0:e.turn)??0} 个 prompt`,"local.rename":"重命名当前会话","rename.empty":"请输入会话名称，例如 /rename 项目调试，或使用 /rename --auto。","rename.success":e=>`会话已重命名为 ${(e==null?void 0:e.name)??""}`,"local.reset":"重置当前对话","local.resume":"恢复历史会话","local.skills":"查看可用 skills","local.stats":"查看会话统计","local.tasks":"查看后台任务","local.status":"查看版本信息","local.theme":"切换主题","local.settings":"查看和编辑设置","local.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.cancelArmed":"再按一次 Esc 停止","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`当前：${(e==null?void 0:e.theme)??""}`,"theme.auto":"自动","theme.dark":"暗色","theme.dark.desc":"仿终端暗色皮肤。","theme.light":"亮色","theme.light.desc":"仿终端亮色皮肤。","theme.title":"主题","todo.allDone":"任务已全部完成","todo.collapse":"折叠任务列表","todo.completedAbove":e=>`✓ 已完成 ${(e==null?void 0:e.count)??0} 项`,"todo.detail.api":"API","todo.detail.cached":"缓存","todo.detail.end":"结束","todo.detail.hide":"收起任务明细","todo.detail.input":"输入","todo.detail.noResources":"未采集到该任务的 Token 与耗时明细。","todo.detail.output":"输出","todo.detail.sectionSpent":"耗时","todo.detail.sectionTime":"时间","todo.detail.sectionTokens":"Token","todo.detail.show":"查看任务明细","todo.detail.start":"开始","todo.detail.tool":"工具","todo.expand":"展开任务列表","todo.more":e=>`... 还有 ${(e==null?void 0:e.count)??0} 项`,"todo.moreAbove":e=>`... 前面还有 ${(e==null?void 0:e.count)??0} 项`,"todo.showLess":"收起","todo.stepProgress":e=>`第 ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0} 步`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"当前任务","chat.scrollToBottom":"回到底部","userMessage.showMore":"显示更多","userMessage.showLess":"收起","turn.processed":"已处理","turn.processing":"处理中","turn.collapse":"折叠步骤","turn.expand":"展开步骤","turn.cached":"缓存","turn.executionSteps":e=>`${(e==null?void 0:e.count)??0} 步`,"turn.toolCalls":e=>`工具 ${(e==null?void 0:e.count)??0} 次`,"turn.thinkingCount":e=>`思考 ${(e==null?void 0:e.count)??0} 次`,"turn.stopped":"你已取消请求","message.renderError":"此消息无法显示。","tasks.title":"后台任务","tasks.empty":"当前没有运行中的任务","tasks.refreshStale":"任务状态可能已过期，正在重连...","tasks.cancelFailed":"取消任务失败","tasks.alreadyStopped":"任务已停止","tasks.moreAbove":e=>`^ 上方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.moreBelow":e=>`v 下方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.running":"运行中","tasks.completed":"已完成","tasks.failed":"失败","tasks.cancelled":"已停止","tasks.paused":"已暂停","tasks.kind.shell":"Shell","tasks.kind.monitor":"监控","tasks.action.stop":"停止","tasks.action.abandon":"放弃","tasks.action.confirmStop":"确认停止","tasks.action.confirmAbandon":"确认放弃","tasks.action.confirmHint":"这会终结当前阻塞轮次。","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.confirmStop":"再按 x 确认停止 · 会终结当前阻塞轮次","tasks.shortcut.select":"↑/↓ 选择","tasks.shortcut.view":"Enter 查看","tasks.shortcut.stop":"x 停止","tasks.shortcut.abandon":"x 放弃","tasks.shortcut.listClose":"←/Esc 关闭","tasks.shortcut.detailBack":"← 返回","tasks.shortcut.detailClose":"Esc/Enter/Space 关闭","tasks.shortcut.close":"Esc 关闭","tasks.shortcut.cancelConfirm":"Esc 取消","tasks.detail.workingDir":"工作目录","tasks.detail.outputFile":"输出文件","tasks.detail.command":"命令","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} 个事件`,"tasks.detail.exit":e=>`退出码 ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} 个已丢弃`,"tasks.detail.error":"错误","tasks.detail.stoppedBecause":"停止原因","tasks.detail.resumeBlocked":"恢复被阻止","tasks.detail.progress":"执行进度","tasks.detail.prompt":"提示词","tasks.detail.type":"类型","tasks.detail.runtime":"时间","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"工具数量","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} 次工具调用`,"tips.items":"输入 / 查看所有可用命令。|使用 @ 引用文件路径。|按 Esc 取消正在进行的请求。|使用 Shift+Enter 换行。|按 ↑↓ 浏览历史消息。","tools.available":"可用工具:","tools.none":"没有可用工具。","tools.empty":"没有可用的内置工具。请先打开一个会话。","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space 查看详情 · ":""}t 切换 ${e.name} · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","tools.details.hide":"收起详情","tools.details.show":"展开详情","tools.loading":"正在加载工具...","tools.status.disabled":"已禁用","tools.status.enabled":"已启用","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 已启用`,"tools.title":"工具","tools.update.disable":"禁用","tools.update.enable":"启用","tools.updating":"更新中...","tool.collapse":"▲ 收起","tool.expand":"展开","tool.collapseHint":"收起","tool.status.failed":"执行失败","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":"提示："},kV={en:K_,"zh-CN":_V},SV={en:"English [en]","zh-CN":"中文 [zh-CN]"},SN=g.createContext({language:"en",t:e=>e});function dc(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function Y_(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return dc(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 X_(e){return SV[e]}function TN(e){const t=kV[e];return(n,r)=>{const s=t[n]??K_[n]??n;return typeof s=="function"?s(r):s}}function TV({language:e,children:t}){const n=g.useMemo(()=>({language:e,t:TN(e)}),[e]);return h.jsx(SN.Provider,{value:n,children:t})}function lt(){return g.useContext(SN)}const AS=[];function CV(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,r)=>!Object.is(n,t[r]))}class CN extends g.Component{constructor(){super(...arguments);le(this,"state",{error:null,resetKeys:this.props.resetKeys??AS});le(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){const s=n.resetKeys??AS;return CV(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 AV="_row_19m4s_1",EV="_tip_19m4s_13",MV="_chatRow_19m4s_35",IV="_chatTip_19m4s_43",NV="_chatActions_19m4s_56",RV="_copyButton_19m4s_71",Cl={row:AV,tip:EV,chatRow:MV,chatTip:IV,chatActions:NV,copyButton:RV};function Nv({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:Cl.copyButton,title:s,"aria-label":s,onClick:a,children:i?h.jsx(jV,{}):h.jsx(LV,{})}):null;return e===void 0?h.jsxs("div",{className:n?Cl.chatRow:Cl.row,children:[t,l]}):h.jsxs("div",{className:n?Cl.chatRow:Cl.row,children:[t,n?h.jsxs("span",{className:Cl.chatActions,children:[h.jsx("span",{className:Cl.chatTip,"aria-hidden":"true",children:dh(e)}),l]}):h.jsx("span",{className:Cl.tip,"aria-hidden":"true",children:dh(e)})]})}function LV(){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 jV(){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 dh(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 DV="modulepreload",OV=function(e){return"/"+e},ES={},U=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=OV(l),l in ES)return;ES[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":DV,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)})},Ns={Dark:"dark",Light:"light"},AN=[Ns.Dark,Ns.Light],EN=g.createContext(Ns.Dark),BV=EN.Provider;function Q_(){return g.useContext(EN)}const nu="ui.theme",cm="general.language";function J_(e,t){return e===Ns.Light||e==="Qwen Light"?Ns.Light:e===Ns.Dark||e==="Qwen Dark"?Ns.Dark:t}function PV(e){return e===Ns.Light?"Qwen Light":"Qwen Dark"}function MS(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 MN(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $V=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FV={};function IS(e,t){return(FV.jsx?zV:$V).test(e)}const qV=/[ \t\n\f\r]/g;function By(e){return typeof e=="object"?e.type==="text"?NS(e.value):!1:NS(e)}function NS(e){return e.replace(qV,"")===""}class _0{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}_0.prototype.normal={};_0.prototype.property={};_0.prototype.space=void 0;function IN(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new _0(n,r,t)}function Pm(e){return e.toLowerCase()}class ki{constructor(t,n){this.attribute=n,this.property=t}}ki.prototype.attribute="";ki.prototype.booleanish=!1;ki.prototype.boolean=!1;ki.prototype.commaOrSpaceSeparated=!1;ki.prototype.commaSeparated=!1;ki.prototype.defined=!1;ki.prototype.mustUseProperty=!1;ki.prototype.number=!1;ki.prototype.overloadedBoolean=!1;ki.prototype.property="";ki.prototype.spaceSeparated=!1;ki.prototype.space=void 0;let UV=0;const Ht=Vu(),Lr=Vu(),Rv=Vu(),Be=Vu(),Vn=Vu(),xu=Vu(),Ei=Vu();function Vu(){return 2**++UV}const Lv=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ht,booleanish:Lr,commaOrSpaceSeparated:Ei,commaSeparated:xu,number:Be,overloadedBoolean:Rv,spaceSeparated:Vn},Symbol.toStringTag,{value:"Module"})),z2=Object.keys(Lv);class Z_ extends ki{constructor(t,n,r,s){let i=-1;if(super(t,n),RS(this,"space",s),typeof r=="number")for(;++i<z2.length;){const o=z2[i];RS(this,z2[i],(r&Lv[o])===Lv[o])}}}Z_.prototype.defined=!0;function RS(e,t,n){n&&(e[t]=n)}function Dh(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Z_(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Pm(r)]=r,n[Pm(i.attribute)]=r}return new _0(t,n,e.space)}const NN=Dh({properties:{ariaActiveDescendant:null,ariaAtomic:Lr,ariaAutoComplete:null,ariaBusy:Lr,ariaChecked:Lr,ariaColCount:Be,ariaColIndex:Be,ariaColSpan:Be,ariaControls:Vn,ariaCurrent:null,ariaDescribedBy:Vn,ariaDetails:null,ariaDisabled:Lr,ariaDropEffect:Vn,ariaErrorMessage:null,ariaExpanded:Lr,ariaFlowTo:Vn,ariaGrabbed:Lr,ariaHasPopup:null,ariaHidden:Lr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vn,ariaLevel:Be,ariaLive:null,ariaModal:Lr,ariaMultiLine:Lr,ariaMultiSelectable:Lr,ariaOrientation:null,ariaOwns:Vn,ariaPlaceholder:null,ariaPosInSet:Be,ariaPressed:Lr,ariaReadOnly:Lr,ariaRelevant:null,ariaRequired:Lr,ariaRoleDescription:Vn,ariaRowCount:Be,ariaRowIndex:Be,ariaRowSpan:Be,ariaSelected:Lr,ariaSetSize:Be,ariaSort:null,ariaValueMax:Be,ariaValueMin:Be,ariaValueNow:Be,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function RN(e,t){return t in e?e[t]:t}function LN(e,t){return RN(e,t.toLowerCase())}const HV=Dh({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xu,acceptCharset:Vn,accessKey:Vn,action:null,allow:null,allowFullScreen:Ht,allowPaymentRequest:Ht,allowUserMedia:Ht,alpha:Ht,alt:null,as:null,async:Ht,autoCapitalize:null,autoComplete:Vn,autoFocus:Ht,autoPlay:Ht,blocking:Vn,capture:null,charSet:null,checked:Ht,cite:null,className:Vn,closedBy:null,colorSpace:null,cols:Be,colSpan:Be,command:null,commandFor:null,content:null,contentEditable:Lr,controls:Ht,controlsList:Vn,coords:Be|xu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ht,defer:Ht,dir:null,dirName:null,disabled:Ht,download:Rv,draggable:Lr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ht,formTarget:null,headers:Vn,height:Be,hidden:Rv,high:Be,href:null,hrefLang:null,htmlFor:Vn,httpEquiv:Vn,id:null,imageSizes:null,imageSrcSet:null,inert:Ht,inputMode:null,integrity:null,is:null,isMap:Ht,itemId:null,itemProp:Vn,itemRef:Vn,itemScope:Ht,itemType:Vn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ht,low:Be,manifest:null,max:null,maxLength:Be,media:null,method:null,min:null,minLength:Be,multiple:Ht,muted:Ht,name:null,nonce:null,noModule:Ht,noValidate:Ht,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:Ht,optimum:Be,pattern:null,ping:Vn,placeholder:null,playsInline:Ht,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ht,referrerPolicy:null,rel:Vn,required:Ht,reversed:Ht,rows:Be,rowSpan:Be,sandbox:Vn,scope:null,scoped:Ht,seamless:Ht,selected:Ht,shadowRootClonable:Ht,shadowRootCustomElementRegistry:Ht,shadowRootDelegatesFocus:Ht,shadowRootMode:null,shadowRootSerializable:Ht,shape:null,size:Be,sizes:null,slot:null,span:Be,spellCheck:Lr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Be,step:null,style:null,tabIndex:Be,target:null,title:null,translate:null,type:null,typeMustMatch:Ht,useMap:null,value:Lr,width:Be,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vn,axis:null,background:null,bgColor:null,border:Be,borderColor:null,bottomMargin:Be,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ht,declare:Ht,event:null,face:null,frame:null,frameBorder:null,hSpace:Be,leftMargin:Be,link:null,longDesc:null,lowSrc:null,marginHeight:Be,marginWidth:Be,noResize:Ht,noHref:Ht,noShade:Ht,noWrap:Ht,object:null,profile:null,prompt:null,rev:null,rightMargin:Be,rules:null,scheme:null,scrolling:Lr,standby:null,summary:null,text:null,topMargin:Be,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Be,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ht,disablePictureInPicture:Ht,disableRemotePlayback:Ht,exportParts:xu,part:Vn,prefix:null,property:null,results:Be,security:null,unselectable:null},space:"html",transform:LN}),VV=Dh({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:Ei,accentHeight:Be,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Be,amplitude:Be,arabicForm:null,ascent:Be,attributeName:null,attributeType:null,azimuth:Be,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Be,by:null,calcMode:null,capHeight:Be,className:Vn,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:Be,diffuseConstant:Be,direction:null,display:null,dur:null,divisor:Be,dominantBaseline:null,download:Ht,dx:null,dy:null,edgeMode:null,editable:null,elevation:Be,enableBackground:null,end:null,event:null,exponent:Be,externalResourcesRequired:null,fill:null,fillOpacity:Be,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:xu,g2:xu,glyphName:xu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Be,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Be,horizOriginX:Be,horizOriginY:Be,id:null,ideographic:Be,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Be,k:Be,k1:Be,k2:Be,k3:Be,k4:Be,kernelMatrix:Ei,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Be,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:Be,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:Be,overlineThickness:Be,paintOrder:null,panose1:null,path:null,pathLength:Be,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Be,pointsAtY:Be,pointsAtZ:Be,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ei,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ei,rev:Ei,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ei,requiredFeatures:Ei,requiredFonts:Ei,requiredFormats:Ei,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:Be,specularExponent:Be,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Be,strikethroughThickness:Be,string:null,stroke:null,strokeDashArray:Ei,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Be,strokeOpacity:Be,strokeWidth:null,style:null,surfaceScale:Be,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ei,tabIndex:Be,tableValues:null,target:null,targetX:Be,targetY:Be,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ei,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Be,underlineThickness:Be,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Be,values:null,vAlphabetic:Be,vMathematical:Be,vectorEffect:null,vHanging:Be,vIdeographic:Be,version:null,vertAdvY:Be,vertOriginX:Be,vertOriginY:Be,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Be,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RN}),jN=Dh({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()}}),DN=Dh({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:LN}),ON=Dh({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),WV={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"},GV=/[A-Z]/g,LS=/-[a-z]/g,KV=/^data[-\w.:]+$/i;function e5(e,t){const n=Pm(t);let r=t,s=ki;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&KV.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(LS,XV);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!LS.test(i)){let o=i.replace(GV,YV);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Z_}return new s(r,t)}function YV(e){return"-"+e.toLowerCase()}function XV(e){return e.charAt(1).toUpperCase()}const t5=IN([NN,HV,jN,DN,ON],"html"),Oh=IN([NN,VV,jN,DN,ON],"svg");function jS(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function BN(e){return e.join(" ").trim()}var n5={},DS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,QV=/\n/g,JV=/^\s*/,ZV=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,eW=/^:\s*/,tW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,nW=/^[;\s]*/,rW=/^\s+|\s+$/g,sW=`
`,OS="/",BS="*",ru="",iW="comment",oW="declaration";function aW(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(QV);y&&(n+=y.length);var v=p.lastIndexOf(sW);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(JV)}function u(p){var y;for(p=p||[];y=d();)y!==!1&&p.push(y);return p}function d(){var p=i();if(!(OS!=e.charAt(0)||BS!=e.charAt(1))){for(var y=2;ru!=e.charAt(y)&&(BS!=e.charAt(y)||OS!=e.charAt(y+1));)++y;if(y+=2,ru===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:iW,comment:v})}}function f(){var p=i(),y=l(ZV);if(y){if(d(),!l(eW))return a("property missing ':'");var v=l(tW),b=p({type:oW,property:PS(y[0].replace(DS,ru)),value:v?PS(v[0].replace(DS,ru)):ru});return l(nW),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 PS(e){return e?e.replace(rW,ru):ru}var lW=aW,cW=$g&&$g.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n5,"__esModule",{value:!0});n5.default=dW;const uW=cW(lW);function dW(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,uW.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 Py={};Object.defineProperty(Py,"__esModule",{value:!0});Py.camelCase=void 0;var hW=/^--[a-zA-Z0-9_-]+$/,fW=/-([a-z])/g,mW=/^[^-]+$/,pW=/^-(webkit|moz|ms|o|khtml)-/,gW=/^-(ms)-/,yW=function(e){return!e||mW.test(e)||hW.test(e)},bW=function(e,t){return t.toUpperCase()},$S=function(e,t){return"".concat(t,"-")},wW=function(e,t){return t===void 0&&(t={}),yW(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(gW,$S):e=e.replace(pW,$S),e.replace(fW,bW))};Py.camelCase=wW;var vW=$g&&$g.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},xW=vW(n5),_W=Py;function jv(e,t){var n={};return!e||typeof e!="string"||(0,xW.default)(e,function(r,s){r&&s&&(n[(0,_W.camelCase)(r,t)]=s)}),n}jv.default=jv;var kW=jv;const SW=cy(kW),PN=$N("end"),r5=$N("start");function $N(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 TW(e){const t=r5(e),n=PN(e);if(t&&n)return{start:t,end:n}}function um(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?zS(e.position):"start"in e||"end"in e?zS(e):"line"in e||"column"in e?Dv(e):""}function Dv(e){return FS(e&&e.line)+":"+FS(e&&e.column)}function zS(e){return Dv(e&&e.start)+"-"+Dv(e&&e.end)}function FS(e){return e&&typeof e=="number"?e:1}class Os 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=um(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}}Os.prototype.file="";Os.prototype.name="";Os.prototype.reason="";Os.prototype.message="";Os.prototype.stack="";Os.prototype.column=void 0;Os.prototype.line=void 0;Os.prototype.ancestors=void 0;Os.prototype.cause=void 0;Os.prototype.fatal=void 0;Os.prototype.place=void 0;Os.prototype.ruleId=void 0;Os.prototype.source=void 0;const s5={}.hasOwnProperty,CW=new Map,AW=/[A-Z]/g,EW=new Set(["table","tbody","thead","tfoot","tr"]),MW=new Set(["td","th"]),zN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function IW(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=PW(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=BW(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"?Oh:t5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=FN(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function FN(e,t,n){if(t.type==="element")return NW(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return RW(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jW(e,t,n);if(t.type==="mdxjsEsm")return LW(e,t);if(t.type==="root")return DW(e,t,n);if(t.type==="text")return OW(e,t)}function NW(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Oh,e.schema=s),e.ancestors.push(t);const i=UN(e,t.tagName,!1),o=$W(e,t);let a=o5(e,t);return EW.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!By(l):!0})),qN(e,o,i,t),i5(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function RW(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)}$m(e,t.position)}function LW(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$m(e,t.position)}function jW(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Oh,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:UN(e,t.name,!0),o=zW(e,t),a=o5(e,t);return qN(e,o,i,t),i5(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function DW(e,t,n){const r={};return i5(r,o5(e,t)),e.create(t,e.Fragment,r,n)}function OW(e,t){return t.value}function qN(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function i5(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function BW(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 PW(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=r5(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 $W(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&s5.call(t.properties,s)){const i=FW(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&MW.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 zW(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 $m(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 $m(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:CW;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=FN(e,i,o);a!==void 0&&n.push(a)}return n}function FW(e,t,n){const r=e5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?MN(n):BN(n)),r.property==="style"){let s=typeof n=="object"?n:qW(e,String(n));return e.stylePropertyNameCase==="css"&&(s=UW(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?WV[r.property]||r.property:r.attribute,n]}}function qW(e,t){try{return SW(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Os("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=zN+"#cannot-parse-style-attribute",s}}function UN(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=IS(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=IS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return s5.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);$m(e)}function $m(e,t){const n=new Os("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=zN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function UW(e){const t={};let n;for(n in e)s5.call(e,n)&&(t[HW(n)]=e[n]);return t}function HW(e){let t=e.replace(AW,VW);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function VW(e){return"-"+e.toLowerCase()}const F2={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"]},WW={};function a5(e,t){const n=WW,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return HN(e,r,s)}function HN(e,t,n){if(GW(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 qS(e.children,t,n)}return Array.isArray(e)?qS(e,t,n):""}function qS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=HN(e[s],t,n);return r.join("")}function GW(e){return!!(e&&typeof e=="object")}const US=document.createElement("i");function l5(e){const t="&"+e+";";US.innerHTML=t;const n=US.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Fi(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 so(e,t){return e.length>0?(Fi(e,e.length,0,t),e):t}const HS={}.hasOwnProperty;function VN(e){const t={};let n=-1;for(;++n<e.length;)KW(t,e[n]);return t}function KW(e,t){let n;for(n in t){const s=(HS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){HS.call(s,o)||(s[o]=[]);const a=i[o];YW(s[o],Array.isArray(a)?a:a?[a]:[])}}}function YW(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Fi(e,0,0,r)}function WN(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 Lo(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Xs=jc(/[A-Za-z]/),Rs=jc(/[\dA-Za-z]/),XW=jc(/[#-'*+\--9=?A-Z^-~]/);function v1(e){return e!==null&&(e<32||e===127)}const Ov=jc(/\d/),QW=jc(/[\dA-Fa-f]/),JW=jc(/[!-/:-@[-`{-~]/);function wt(e){return e!==null&&e<-2}function Kn(e){return e!==null&&(e<0||e===32)}function dn(e){return e===-2||e===-1||e===32}const $y=jc(new RegExp("\\p{P}|\\p{S}","u")),Nu=jc(/\s/);function jc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Bh(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&Rs(e.charCodeAt(n+1))&&Rs(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 an(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return dn(l)?(e.enter(n),a(l)):t(l)}function a(l){return dn(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const ZW={tokenize:eG};function eG(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"),an(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 wt(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const tG={tokenize:nG},VS={tokenize:rG};function nG(e){const t=this,n=[];let r=0,s,i,o;return a;function a(x){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,c)(x)}return c(x)}function l(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&w();const k=t.events.length;let T=k,A;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){A=t.events[T][1].end;break}b(r);let M=k;for(;M<t.events.length;)t.events[M][1].end={...A},M++;return Fi(t.events,T+1,0,t.events.slice(k)),t.events.length=M,c(x)}return a(x)}function c(x){if(r===n.length){if(!s)return f(x);if(s.currentConstruct&&s.currentConstruct.concrete)return p(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(VS,u,d)(x)}function u(x){return s&&w(),b(r),f(x)}function d(x){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,p(x)}function f(x){return t.containerState={},e.attempt(VS,m,p)(x)}function m(x){return r++,n.push([t.currentConstruct,t.containerState]),f(x)}function p(x){if(x===null){s&&w(),b(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),y(x)}function y(x){if(x===null){v(e.exit("chunkFlow"),!0),b(0),e.consume(x);return}return wt(x)?(e.consume(x),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(x),y)}function v(x,k){const T=t.sliceStream(x);if(k&&T.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(T),t.parser.lazy[x.start.line]){let A=s.events.length;for(;A--;)if(s.events[A][1].start.offset<o&&(!s.events[A][1].end||s.events[A][1].end.offset>o))return;const M=t.events.length;let D=M,O,C;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(O){C=t.events[D][1].end;break}O=!0}for(b(r),A=M;A<t.events.length;)t.events[A][1].end={...C},A++;Fi(t.events,D+1,0,t.events.slice(M)),t.events.length=A}}function b(x){let k=n.length;for(;k-- >x;){const T=n[k];t.containerState=T[1],T[0].exit.call(t,e)}n.length=x}function w(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function rG(e,t,n){return an(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hh(e){if(e===null||Kn(e)||Nu(e))return 1;if($y(e))return 2}function zy(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 Bv={name:"attention",resolveAll:sG,tokenize:iG};function sG(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};WS(d,-l),WS(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=so(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=so(c,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=so(c,zy(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=so(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=so(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Fi(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 iG(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=hh(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=hh(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 WS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const oG={name:"autolink",tokenize:aG};function aG(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 Xs(m)?(e.consume(m),o):m===64?n(m):c(m)}function o(m){return m===43||m===45||m===46||Rs(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||Rs(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||v1(m)?n(m):(e.consume(m),l)}function c(m){return m===64?(e.consume(m),u):XW(m)?(e.consume(m),c):n(m)}function u(m){return Rs(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||Rs(m))&&r++<63){const p=m===45?f:d;return e.consume(m),p}return n(m)}}const k0={partial:!0,tokenize:lG};function lG(e,t,n){return r;function r(i){return dn(i)?an(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||wt(i)?t(i):n(i)}}const GN={continuation:{tokenize:uG},exit:dG,name:"blockQuote",tokenize:cG};function cG(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 dn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function uG(e,t,n){const r=this;return s;function s(o){return dn(o)?an(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(GN,t,n)(o)}}function dG(e){e.exit("blockQuote")}const KN={name:"characterEscape",tokenize:hG};function hG(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 JW(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const YN={name:"characterReference",tokenize:fG};function fG(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=Rs,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=QW,u):(e.enter("characterReferenceValue"),i=7,o=Ov,u(d))}function u(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return o===Rs&&!l5(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 GS={partial:!0,tokenize:pG},KS={concrete:!0,name:"codeFenced",tokenize:mG};function mG(e,t,n){const r=this,s={partial:!0,tokenize:T};let i=0,o=0,a;return l;function l(A){return c(A)}function c(A){const M=r.events[r.events.length-1];return i=M&&M[1].type==="linePrefix"?M[2].sliceSerialize(M[1],!0).length:0,a=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(A)}function u(A){return A===a?(o++,e.consume(A),u):o<3?n(A):(e.exit("codeFencedFenceSequence"),dn(A)?an(e,d,"whitespace")(A):d(A))}function d(A){return A===null||wt(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(GS,y,k)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(A))}function f(A){return A===null||wt(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(A)):dn(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),an(e,m,"whitespace")(A)):A===96&&A===a?n(A):(e.consume(A),f)}function m(A){return A===null||wt(A)?d(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(A))}function p(A){return A===null||wt(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(A)):A===96&&A===a?n(A):(e.consume(A),p)}function y(A){return e.attempt(s,k,v)(A)}function v(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),b}function b(A){return i>0&&dn(A)?an(e,w,"linePrefix",i+1)(A):w(A)}function w(A){return A===null||wt(A)?e.check(GS,y,k)(A):(e.enter("codeFlowValue"),x(A))}function x(A){return A===null||wt(A)?(e.exit("codeFlowValue"),w(A)):(e.consume(A),x)}function k(A){return e.exit("codeFenced"),t(A)}function T(A,M,D){let O=0;return C;function C(W){return A.enter("lineEnding"),A.consume(W),A.exit("lineEnding"),L}function L(W){return A.enter("codeFencedFence"),dn(W)?an(A,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):I(W)}function I(W){return W===a?(A.enter("codeFencedFenceSequence"),B(W)):D(W)}function B(W){return W===a?(O++,A.consume(W),B):O>=o?(A.exit("codeFencedFenceSequence"),dn(W)?an(A,F,"whitespace")(W):F(W)):D(W)}function F(W){return W===null||wt(W)?(A.exit("codeFencedFence"),M(W)):D(W)}}}function pG(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 q2={name:"codeIndented",tokenize:yG},gG={partial:!0,tokenize:bG};function yG(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),an(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):wt(c)?e.attempt(gG,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||wt(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function bG(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):wt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):an(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):wt(o)?s(o):n(o)}}const wG={name:"codeText",previous:xG,resolve:vG,tokenize:_G};function vG(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 xG(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _G(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)):wt(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||wt(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 kG{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&&yf(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),yf(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yf(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);yf(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yf(this.left,n.reverse())}}}function yf(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 XN(e){const t={};let n=-1,r,s,i,o,a,l,c;const u=new kG(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,SG(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 Fi(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function SG(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]),w=i.pop();l.push([w,w+b.length-1]),e.splice(w,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 TG={resolve:AG,tokenize:EG},CG={partial:!0,tokenize:MG};function AG(e){return XN(e),e}function EG(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):wt(a)?e.check(CG,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 MG(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),an(e,i,"linePrefix")}function i(o){if(o===null||wt(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 QN(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||v1(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||wt(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||Kn(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||v1(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 JN(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):wt(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||wt(m)||a++>999?(e.exit("chunkString"),u(m)):(e.consume(m),l||(l=!dn(m)),m===92?f:d)}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}}function ZN(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):wt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),an(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||wt(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 dm(e,t){let n;return r;function r(s){return wt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):dn(s)?an(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const IG={name:"definition",tokenize:RG},NG={partial:!0,tokenize:LG};function RG(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),o(m)}function o(m){return JN.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return s=Lo(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 Kn(m)?dm(e,c)(m):c(m)}function c(m){return QN(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function u(m){return e.attempt(NG,d,d)(m)}function d(m){return dn(m)?an(e,f,"whitespace")(m):f(m)}function f(m){return m===null||wt(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function LG(e,t,n){return r;function r(a){return Kn(a)?dm(e,s)(a):n(a)}function s(a){return ZN(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return dn(a)?an(e,o,"whitespace")(a):o(a)}function o(a){return a===null||wt(a)?t(a):n(a)}}const jG={name:"hardBreakEscape",tokenize:DG};function DG(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return wt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const OG={name:"headingAtx",resolve:BG,tokenize:PG};function BG(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"},Fi(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function PG(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||Kn(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||wt(u)?(e.exit("atxHeading"),t(u)):dn(u)?an(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||Kn(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const $G=["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"],YS=["pre","script","style","textarea"],zG={concrete:!0,name:"htmlFlow",resolveTo:UG,tokenize:HG},FG={partial:!0,tokenize:WG},qG={partial:!0,tokenize:VG};function UG(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 HG(e,t,n){const r=this;let s,i,o,a,l;return c;function c(E){return u(E)}function u(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),d}function d(E){return E===33?(e.consume(E),f):E===47?(e.consume(E),i=!0,y):E===63?(e.consume(E),s=3,r.interrupt?t:N):Xs(E)?(e.consume(E),o=String.fromCharCode(E),v):n(E)}function f(E){return E===45?(e.consume(E),s=2,m):E===91?(e.consume(E),s=5,a=0,p):Xs(E)?(e.consume(E),s=4,r.interrupt?t:N):n(E)}function m(E){return E===45?(e.consume(E),r.interrupt?t:N):n(E)}function p(E){const ne="CDATA[";return E===ne.charCodeAt(a++)?(e.consume(E),a===ne.length?r.interrupt?t:I:p):n(E)}function y(E){return Xs(E)?(e.consume(E),o=String.fromCharCode(E),v):n(E)}function v(E){if(E===null||E===47||E===62||Kn(E)){const ne=E===47,pe=o.toLowerCase();return!ne&&!i&&YS.includes(pe)?(s=1,r.interrupt?t(E):I(E)):$G.includes(o.toLowerCase())?(s=6,ne?(e.consume(E),b):r.interrupt?t(E):I(E)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):i?w(E):x(E))}return E===45||Rs(E)?(e.consume(E),o+=String.fromCharCode(E),v):n(E)}function b(E){return E===62?(e.consume(E),r.interrupt?t:I):n(E)}function w(E){return dn(E)?(e.consume(E),w):C(E)}function x(E){return E===47?(e.consume(E),C):E===58||E===95||Xs(E)?(e.consume(E),k):dn(E)?(e.consume(E),x):C(E)}function k(E){return E===45||E===46||E===58||E===95||Rs(E)?(e.consume(E),k):T(E)}function T(E){return E===61?(e.consume(E),A):dn(E)?(e.consume(E),T):x(E)}function A(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,M):dn(E)?(e.consume(E),A):D(E)}function M(E){return E===l?(e.consume(E),l=null,O):E===null||wt(E)?n(E):(e.consume(E),M)}function D(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||Kn(E)?T(E):(e.consume(E),D)}function O(E){return E===47||E===62||dn(E)?x(E):n(E)}function C(E){return E===62?(e.consume(E),L):n(E)}function L(E){return E===null||wt(E)?I(E):dn(E)?(e.consume(E),L):n(E)}function I(E){return E===45&&s===2?(e.consume(E),j):E===60&&s===1?(e.consume(E),K):E===62&&s===4?(e.consume(E),q):E===63&&s===3?(e.consume(E),N):E===93&&s===5?(e.consume(E),ee):wt(E)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(FG,P,B)(E)):E===null||wt(E)?(e.exit("htmlFlowData"),B(E)):(e.consume(E),I)}function B(E){return e.check(qG,F,P)(E)}function F(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),W}function W(E){return E===null||wt(E)?B(E):(e.enter("htmlFlowData"),I(E))}function j(E){return E===45?(e.consume(E),N):I(E)}function K(E){return E===47?(e.consume(E),o="",J):I(E)}function J(E){if(E===62){const ne=o.toLowerCase();return YS.includes(ne)?(e.consume(E),q):I(E)}return Xs(E)&&o.length<8?(e.consume(E),o+=String.fromCharCode(E),J):I(E)}function ee(E){return E===93?(e.consume(E),N):I(E)}function N(E){return E===62?(e.consume(E),q):E===45&&s===2?(e.consume(E),N):I(E)}function q(E){return E===null||wt(E)?(e.exit("htmlFlowData"),P(E)):(e.consume(E),q)}function P(E){return e.exit("htmlFlow"),t(E)}}function VG(e,t,n){const r=this;return s;function s(o){return wt(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 WG(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(k0,t,n)}}const GG={name:"htmlText",tokenize:KG};function KG(e,t,n){const r=this;let s,i,o;return a;function a(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),c):N===47?(e.consume(N),T):N===63?(e.consume(N),x):Xs(N)?(e.consume(N),D):n(N)}function c(N){return N===45?(e.consume(N),u):N===91?(e.consume(N),i=0,p):Xs(N)?(e.consume(N),w):n(N)}function u(N){return N===45?(e.consume(N),m):n(N)}function d(N){return N===null?n(N):N===45?(e.consume(N),f):wt(N)?(o=d,K(N)):(e.consume(N),d)}function f(N){return N===45?(e.consume(N),m):d(N)}function m(N){return N===62?j(N):N===45?f(N):d(N)}function p(N){const q="CDATA[";return N===q.charCodeAt(i++)?(e.consume(N),i===q.length?y:p):n(N)}function y(N){return N===null?n(N):N===93?(e.consume(N),v):wt(N)?(o=y,K(N)):(e.consume(N),y)}function v(N){return N===93?(e.consume(N),b):y(N)}function b(N){return N===62?j(N):N===93?(e.consume(N),b):y(N)}function w(N){return N===null||N===62?j(N):wt(N)?(o=w,K(N)):(e.consume(N),w)}function x(N){return N===null?n(N):N===63?(e.consume(N),k):wt(N)?(o=x,K(N)):(e.consume(N),x)}function k(N){return N===62?j(N):x(N)}function T(N){return Xs(N)?(e.consume(N),A):n(N)}function A(N){return N===45||Rs(N)?(e.consume(N),A):M(N)}function M(N){return wt(N)?(o=M,K(N)):dn(N)?(e.consume(N),M):j(N)}function D(N){return N===45||Rs(N)?(e.consume(N),D):N===47||N===62||Kn(N)?O(N):n(N)}function O(N){return N===47?(e.consume(N),j):N===58||N===95||Xs(N)?(e.consume(N),C):wt(N)?(o=O,K(N)):dn(N)?(e.consume(N),O):j(N)}function C(N){return N===45||N===46||N===58||N===95||Rs(N)?(e.consume(N),C):L(N)}function L(N){return N===61?(e.consume(N),I):wt(N)?(o=L,K(N)):dn(N)?(e.consume(N),L):O(N)}function I(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),s=N,B):wt(N)?(o=I,K(N)):dn(N)?(e.consume(N),I):(e.consume(N),F)}function B(N){return N===s?(e.consume(N),s=void 0,W):N===null?n(N):wt(N)?(o=B,K(N)):(e.consume(N),B)}function F(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||Kn(N)?O(N):(e.consume(N),F)}function W(N){return N===47||N===62||Kn(N)?O(N):n(N)}function j(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function K(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),J}function J(N){return dn(N)?an(e,ee,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):ee(N)}function ee(N){return e.enter("htmlTextData"),o(N)}}const c5={name:"labelEnd",resolveAll:JG,resolveTo:ZG,tokenize:eK},YG={tokenize:tK},XG={tokenize:nK},QG={tokenize:rK};function JG(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&&Fi(e,0,e.length,n),e}function ZG(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=so(a,e.slice(i+1,i+r+3)),a=so(a,[["enter",u,t]]),a=so(a,zy(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=so(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=so(a,e.slice(o+1)),a=so(a,[["exit",l,t]]),Fi(e,i,e.length,a),e}function eK(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(Lo(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(YG,u,o?u:d)(f):f===91?e.attempt(XG,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(QG,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function tK(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 Kn(d)?dm(e,i)(d):i(d)}function i(d){return d===41?u(d):QN(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Kn(d)?dm(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?ZN(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Kn(d)?dm(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 nK(e,t,n){const r=this;return s;function s(a){return JN.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Lo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function rK(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 sK={name:"labelStartImage",resolveAll:c5.resolveAll,tokenize:iK};function iK(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 oK={name:"labelStartLink",resolveAll:c5.resolveAll,tokenize:aK};function aK(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 U2={name:"lineEnding",tokenize:lK};function lK(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),an(e,t,"linePrefix")}}const xg={name:"thematicBreak",tokenize:cK};function cK(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||wt(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===s?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),dn(c)?an(e,a,"whitespace")(c):a(c))}}const li={continuation:{tokenize:fK},exit:pK,name:"list",tokenize:hK},uK={partial:!0,tokenize:gK},dK={partial:!0,tokenize:mK};function hK(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:Ov(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(xg,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 Ov(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(k0,r.interrupt?n:u,e.attempt(uK,f,d))}function u(m){return r.containerState.initialBlankLine=!0,i++,f(m)}function d(m){return dn(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 fK(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(k0,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,an(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!dn(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(dK,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,an(e,e.attempt(li,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function mK(e,t,n){const r=this;return an(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 pK(e){e.exit(this.containerState.type)}function gK(e,t,n){const r=this;return an(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!dn(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const XS={name:"setextUnderline",resolveTo:yK,tokenize:bK};function yK(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 bK(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"),dn(c)?an(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||wt(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const wK={tokenize:vK};function vK(e){const t=this,n=e.attempt(k0,r,e.attempt(this.parser.constructs.flowInitial,s,an(e,e.attempt(this.parser.constructs.flow,s,e.attempt(TG,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 xK={resolveAll:tR()},_K=eR("string"),kK=eR("text");function eR(e){return{resolveAll:tR(e==="text"?SK: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 tR(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 SK(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 TK={42:li,43:li,45:li,48:li,49:li,50:li,51:li,52:li,53:li,54:li,55:li,56:li,57:li,62:GN},CK={91:IG},AK={[-2]:q2,[-1]:q2,32:q2},EK={35:OG,42:xg,45:[XS,xg],60:zG,61:XS,95:xg,96:KS,126:KS},MK={38:YN,92:KN},IK={[-5]:U2,[-4]:U2,[-3]:U2,33:sK,38:YN,42:Bv,60:[oG,GG],91:oK,92:[jG,KN],93:c5,95:Bv,96:wG},NK={null:[Bv,xK]},RK={null:[42,95]},LK={null:[]},jK=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:RK,contentInitial:CK,disable:LK,document:TK,flow:EK,flowInitial:AK,insideSpan:NK,string:MK,text:IK},Symbol.toStringTag,{value:"Module"}));function DK(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:M(T),check:M(A),consume:w,enter:x,exit:k,interrupt:M(A,{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(L){return o=so(o,L),v(),o[o.length-1]!==null?[]:(D(t,0),c.events=zy(i,c.events,c),c.events)}function f(L,I){return BK(m(L),I)}function m(L){return OK(o,L)}function p(){const{_bufferIndex:L,_index:I,line:B,column:F,offset:W}=r;return{_bufferIndex:L,_index:I,line:B,column:F,offset:W}}function y(L){s[L.line]=L.column,C()}function v(){let L;for(;r._index<o.length;){const I=o[r._index];if(typeof I=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<I.length;)b(I.charCodeAt(r._bufferIndex));else b(I)}}function b(L){u=u(L)}function w(L){wt(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,C()):L!==-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=L}function x(L,I){const B=I||{};return B.type=L,B.start=p(),c.events.push(["enter",B,c]),a.push(B),B}function k(L){const I=a.pop();return I.end=p(),c.events.push(["exit",I,c]),I}function T(L,I){D(L,I.from)}function A(L,I){I.restore()}function M(L,I){return B;function B(F,W,j){let K,J,ee,N;return Array.isArray(F)?P(F):"tokenize"in F?P([F]):q(F);function q(be){return xe;function xe(we){const de=we!==null&&be[we],se=we!==null&&be.null,ae=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(se)?se:se?[se]:[]];return P(ae)(we)}}function P(be){return K=be,J=0,be.length===0?j:E(be[J])}function E(be){return xe;function xe(we){return N=O(),ee=be,be.partial||(c.currentConstruct=be),be.name&&c.parser.constructs.disable.null.includes(be.name)?pe():be.tokenize.call(I?Object.assign(Object.create(c),I):c,l,ne,pe)(we)}}function ne(be){return L(ee,N),W}function pe(be){return N.restore(),++J<K.length?E(K[J]):j}}}function D(L,I){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&Fi(c.events,I,c.events.length-I,L.resolve(c.events.slice(I),c)),L.resolveTo&&(c.events=L.resolveTo(c.events,c))}function O(){const L=p(),I=c.previous,B=c.currentConstruct,F=c.events.length,W=Array.from(a);return{from:F,restore:j};function j(){r=L,c.previous=I,c.currentConstruct=B,c.events.length=F,a=W,C()}}function C(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function OK(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 BK(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 PK(e){const r={constructs:VN([jK,...(e||{}).extensions||[]]),content:s(ZW),defined:[],document:s(tG),flow:s(wK),lazy:{},string:s(_K),text:s(kK)};return r;function s(i){return o;function o(a){return DK(r,i,a)}}}function $K(e){for(;!XN(e););return e}const QS=/[\0\t\n\r]/g;function zK(){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(QS.lastIndex=d,c=QS.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 FK=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qK(e){return e.replace(FK,UK)}function UK(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return WN(n.slice(i?2:1),i?16:10)}return l5(n)||e}const nR={}.hasOwnProperty;function HK(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),VK(n)($K(PK(n).document().write(zK()(e,t,!0))))}function VK(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(vt),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(re),blockQuote:i(se),characterEscape:O,characterReference:O,codeFenced:i(ae),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(ae,o),codeText:i(_e,o),codeTextData:O,data:O,codeFlowValue:O,definition:i(qe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(He),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Te,o),htmlFlowData:O,htmlText:i(Te,o),htmlTextData:O,image:i(ke),label:o,link:i(vt),listItem:i(Mt),listItemValue:f,listOrdered:i(rt,d),listUnordered:i(rt),paragraph:i(Pt),reference:E,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(re),strong:i(Ze),thematicBreak:i(ft)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:de,autolinkProtocol:we,blockQuote:l(),characterEscapeValue:C,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:be,characterReference:xe,codeFenced:l(v),codeFencedFence:y,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:C,codeIndented:l(b),codeText:l(W),codeTextData:C,data:C,definition:l(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:x,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(B),htmlFlowData:C,htmlText:l(F),htmlTextData:C,image:l(K),label:ee,labelText:J,lineEnding:L,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ne,resourceDestinationString:N,resourceTitleString:q,resource:P,setextHeading:l(D),setextHeadingLineSequence:M,setextHeadingText:A,strong:l(),thematicBreak:l()}};rR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ie){let H={type:"root",children:[]};const oe={stack:[H],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},De=[];let tt=-1;for(;++tt<ie.length;)if(ie[tt][1].type==="listOrdered"||ie[tt][1].type==="listUnordered")if(ie[tt][0]==="enter")De.push(tt);else{const Ct=De.pop();tt=s(ie,Ct,tt)}for(tt=-1;++tt<ie.length;){const Ct=t[ie[tt][0]];nR.call(Ct,ie[tt][1].type)&&Ct[ie[tt][1].type].call(Object.assign({sliceSerialize:ie[tt][2].sliceSerialize},oe),ie[tt][1])}if(oe.tokenStack.length>0){const Ct=oe.tokenStack[oe.tokenStack.length-1];(Ct[1]||JS).call(oe,void 0,Ct[0])}for(H.position={start:Al(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:Al(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<t.transforms.length;)H=t.transforms[tt](H)||H;return H}function s(ie,H,oe){let De=H-1,tt=-1,Ct=!1,Et,Qt,on,he;for(;++De<=oe;){const X=ie[De];switch(X[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{X[0]==="enter"?tt++:tt--,he=void 0;break}case"lineEndingBlank":{X[0]==="enter"&&(Et&&!he&&!tt&&!on&&(on=De),he=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:he=void 0}if(!tt&&X[0]==="enter"&&X[1].type==="listItemPrefix"||tt===-1&&X[0]==="exit"&&(X[1].type==="listUnordered"||X[1].type==="listOrdered")){if(Et){let ue=De;for(Qt=void 0;ue--;){const me=ie[ue];if(me[1].type==="lineEnding"||me[1].type==="lineEndingBlank"){if(me[0]==="exit")continue;Qt&&(ie[Qt][1].type="lineEndingBlank",Ct=!0),me[1].type="lineEnding",Qt=ue}else if(!(me[1].type==="linePrefix"||me[1].type==="blockQuotePrefix"||me[1].type==="blockQuotePrefixWhitespace"||me[1].type==="blockQuoteMarker"||me[1].type==="listItemIndent"))break}on&&(!Qt||on<Qt)&&(Et._spread=!0),Et.end=Object.assign({},Qt?ie[Qt][1].start:X[1].end),ie.splice(Qt||De,0,["exit",Et,X[2]]),De++,oe++}if(X[1].type==="listItemPrefix"){const ue={type:"listItem",_spread:!1,start:Object.assign({},X[1].start),end:void 0};Et=ue,ie.splice(De,0,["enter",ue,X[2]]),De++,oe++,on=void 0,he=!0}}}return ie[H][1]._spread=Ct,oe}function i(ie,H){return oe;function oe(De){a.call(this,ie(De),De),H&&H.call(this,De)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ie,H,oe){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([H,oe||void 0]),ie.position={start:Al(H.start),end:void 0}}function l(ie){return H;function H(oe){ie&&ie.call(this,oe),c.call(this,oe)}}function c(ie,H){const oe=this.stack.pop(),De=this.tokenStack.pop();if(De)De[0].type!==ie.type&&(H?H.call(this,ie,De[0]):(De[1]||JS).call(this,ie,De[0]));else throw new Error("Cannot close `"+ie.type+"` ("+um({start:ie.start,end:ie.end})+"): it’s not open");oe.position.end=Al(ie.end)}function u(){return a5(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(ie){if(this.data.expectingFirstListItemValue){const H=this.stack[this.stack.length-2];H.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function m(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.lang=ie}function p(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.meta=ie}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.value=ie.replace(/(\r?\n|\r)$/g,"")}function w(ie){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.label=H,oe.identifier=Lo(this.sliceSerialize(ie)).toLowerCase()}function x(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.title=ie}function k(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.url=ie}function T(ie){const H=this.stack[this.stack.length-1];if(!H.depth){const oe=this.sliceSerialize(ie).length;H.depth=oe}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function M(ie){const H=this.stack[this.stack.length-1];H.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function O(ie){const oe=this.stack[this.stack.length-1].children;let De=oe[oe.length-1];(!De||De.type!=="text")&&(De=bt(),De.position={start:Al(ie.start),end:void 0},oe.push(De)),this.stack.push(De)}function C(ie){const H=this.stack.pop();H.value+=this.sliceSerialize(ie),H.position.end=Al(ie.end)}function L(ie){const H=this.stack[this.stack.length-1];if(this.data.atHardBreak){const oe=H.children[H.children.length-1];oe.position.end=Al(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(H.type)&&(O.call(this,ie),C.call(this,ie))}function I(){this.data.atHardBreak=!0}function B(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.value=ie}function F(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.value=ie}function W(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.value=ie}function j(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=H,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function K(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const H=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=H,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function J(ie){const H=this.sliceSerialize(ie),oe=this.stack[this.stack.length-2];oe.label=qK(H),oe.identifier=Lo(H).toLowerCase()}function ee(){const ie=this.stack[this.stack.length-1],H=this.resume(),oe=this.stack[this.stack.length-1];if(this.data.inReference=!0,oe.type==="link"){const De=ie.children;oe.children=De}else oe.alt=H}function N(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.url=ie}function q(){const ie=this.resume(),H=this.stack[this.stack.length-1];H.title=ie}function P(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function ne(ie){const H=this.resume(),oe=this.stack[this.stack.length-1];oe.label=H,oe.identifier=Lo(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function pe(ie){this.data.characterReferenceType=ie.type}function be(ie){const H=this.sliceSerialize(ie),oe=this.data.characterReferenceType;let De;oe?(De=WN(H,oe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):De=l5(H);const tt=this.stack[this.stack.length-1];tt.value+=De}function xe(ie){const H=this.stack.pop();H.position.end=Al(ie.end)}function we(ie){C.call(this,ie);const H=this.stack[this.stack.length-1];H.url=this.sliceSerialize(ie)}function de(ie){C.call(this,ie);const H=this.stack[this.stack.length-1];H.url="mailto:"+this.sliceSerialize(ie)}function se(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function He(){return{type:"emphasis",children:[]}}function re(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Te(){return{type:"html",value:""}}function ke(){return{type:"image",title:null,url:"",alt:null}}function vt(){return{type:"link",title:null,url:"",children:[]}}function rt(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function Mt(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function Pt(){return{type:"paragraph",children:[]}}function Ze(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function ft(){return{type:"thematicBreak"}}}function Al(e){return{line:e.line,column:e.column,offset:e.offset}}function rR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?rR(e,r):WK(e,r)}}function WK(e,t){let n;for(n in t)if(nR.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 JS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+um({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+um({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+um({start:t.start,end:t.end})+") is still open")}function GK(e){const t=this;t.parser=n;function n(r){return HK(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function KK(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 YK(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function XK(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 QK(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JK(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZK(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Bh(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 eY(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 tY(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function sR(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 nY(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return sR(e,t);const s={src:Bh(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 rY(e,t){const n={src:Bh(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 sY(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 iY(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return sR(e,t);const s={href:Bh(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 oY(e,t){const n={href:Bh(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 aY(e,t,n){const r=e.all(t),s=n?lY(n):iR(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 lY(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=iR(n[r])}return t}function iR(e){const t=e.spread;return t??e.children.length>1}function cY(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 uY(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dY(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function hY(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fY(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=r5(t.children[1]),l=PN(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 mY(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 pY(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ZS=9,e7=32;function gY(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(t7(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(t7(t.slice(s),s>0,!1)),i.join("")}function t7(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===ZS||i===e7;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===ZS||i===e7;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function yY(e,t){const n={type:"text",value:gY(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bY(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wY={blockquote:KK,break:YK,code:XK,delete:QK,emphasis:JK,footnoteReference:ZK,heading:eY,html:tY,imageReference:nY,image:rY,inlineCode:sY,linkReference:iY,link:oY,listItem:aY,list:cY,paragraph:uY,root:dY,strong:hY,table:fY,tableCell:pY,tableRow:mY,text:yY,thematicBreak:bY,toml:fp,yaml:fp,definition:fp,footnoteDefinition:fp};function fp(){}const oR=-1,Fy=0,hm=1,x1=2,u5=3,d5=4,h5=5,f5=6,aR=7,lR=8,n7=typeof self=="object"?self:globalThis,vY=(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 Fy:case oR:return n(o,s);case hm:{const a=n([],s);for(const l of o)a.push(r(l));return a}case x1:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case u5:return n(new Date(o),s);case d5:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case h5:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case f5:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case aR:{const{name:a,message:l}=o;return n(new n7[a](l),s)}case lR: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 n7[i](o),s)};return r},r7=e=>vY(new Map,e)(0),cd="",{toString:xY}={},{keys:_Y}=Object,bf=e=>{const t=typeof e;if(t!=="object"||!e)return[Fy,t];const n=xY.call(e).slice(8,-1);switch(n){case"Array":return[hm,cd];case"Object":return[x1,cd];case"Date":return[u5,cd];case"RegExp":return[d5,cd];case"Map":return[h5,cd];case"Set":return[f5,cd];case"DataView":return[hm,n]}return n.includes("Array")?[hm,n]:n.includes("Error")?[aR,n]:[x1,n]},mp=([e,t])=>e===Fy&&(t==="function"||t==="symbol"),kY=(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]=bf(o);switch(a){case Fy:{let u=o;switch(l){case"bigint":a=lR,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([oR],o)}return s([a,u],o)}case hm:{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 x1:{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 _Y(o))(e||!mp(bf(o[f])))&&u.push([i(f),i(o[f])]);return d}case u5:return s([a,o.toISOString()],o);case d5:{const{source:u,flags:d}=o;return s([a,{source:u,flags:d}],o)}case h5:{const u=[],d=s([a,u],o);for(const[f,m]of o)(e||!(mp(bf(f))||mp(bf(m))))&&u.push([i(f),i(m)]);return d}case f5:{const u=[],d=s([a,u],o);for(const f of o)(e||!mp(bf(f)))&&u.push(i(f));return d}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},s7=(e,{json:t,lossy:n}={})=>{const r=[];return kY(!(t||n),!!t,new Map,r)(e),r},_1=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?r7(s7(e,t)):structuredClone(e):(e,t)=>r7(s7(e,t));function SY(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 TY(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function CY(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||SY,r=e.options.footnoteBackLabel||TY,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=Bh(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 w=typeof n=="string"?n:n(l,m);typeof w=="string"&&(w={type:"text",value:w}),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(w)?w:[w]})}const v=u[u.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const w=v.children[v.children.length-1];w&&w.type==="text"?w.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:{..._1(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 S0=function(e){if(e==null)return IY;if(typeof e=="function")return qy(e);if(typeof e=="object")return Array.isArray(e)?AY(e):EY(e);if(typeof e=="string")return MY(e);throw new Error("Expected function, string, or object as test")};function AY(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=S0(e[n]);return qy(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function EY(e){const t=e;return qy(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function MY(e){return qy(t);function t(n){return n&&n.type===e}}function qy(e){return t;function t(n,r,s){return!!(NY(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function IY(){return!0}function NY(e){return e!==null&&typeof e=="object"&&"type"in e}const cR=[],RY=!0,Pv=!1,uR="skip";function m5(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=S0(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=cR,p,y,v;if((!t||i(l,c,u[u.length-1]||void 0))&&(m=LY(n(l,u)),m[0]===Pv))return m;if("children"in l&&l.children){const b=l;if(b.children&&m[0]!==uR)for(y=(r?b.children.length:-1)+o,v=u.concat(b);y>-1&&y<b.children.length;){const w=b.children[y];if(p=a(w,y,v)(),p[0]===Pv)return p;y=typeof p[1]=="number"?p[1]:y+o}}return m}}}function LY(e){return Array.isArray(e)?e:typeof e=="number"?[RY,e]:e==null?cR:[e]}function p5(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),m5(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 $v={}.hasOwnProperty,jY={};function DY(e,t){const n=t||jY,r=new Map,s=new Map,i=new Map,o={...wY,...n.handlers},a={all:c,applyData:BY,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:OY,wrap:$Y};return p5(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($v.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=_1(v);return b.children=a.all(u),b}return _1(u)}return(a.options.unknownHandler||PY)(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=i7(p.value)),!Array.isArray(p)&&p.type==="element")){const y=p.children[0];y&&y.type==="text"&&(y.value=i7(y.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function OY(e,t){e.position&&(t.position=TW(e))}function BY(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,_1(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function PY(e,t){const n=t.data||{},r="value"in t&&!($v.call(n,"hProperties")||$v.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 $Y(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 i7(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function o7(e,t){const n=DY(e,t),r=n.one(e,void 0),s=CY(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function zY(e,t){return e&&"run"in e?async function(n,r){const s=o7(n,{file:r,...t});await e.run(s,r)}:function(n,r){return o7(n,{file:r,...e||t})}}function a7(e){if(e)throw e}var _g=Object.prototype.hasOwnProperty,dR=Object.prototype.toString,l7=Object.defineProperty,c7=Object.getOwnPropertyDescriptor,u7=function(t){return typeof Array.isArray=="function"?Array.isArray(t):dR.call(t)==="[object Array]"},d7=function(t){if(!t||dR.call(t)!=="[object Object]")return!1;var n=_g.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&_g.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||_g.call(t,s)},h7=function(t,n){l7&&n.name==="__proto__"?l7(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},f7=function(t,n){if(n==="__proto__")if(_g.call(t,n)){if(c7)return c7(t,n).value}else return;return t[n]},FY=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=f7(a,n),s=f7(t,n),a!==s&&(u&&s&&(d7(s)||(i=u7(s)))?(i?(i=!1,o=r&&u7(r)?r:[]):o=r&&d7(r)?r:{},h7(a,{name:n,newValue:e(u,o,s)})):typeof s<"u"&&h7(a,{name:n,newValue:s}));return a};const H2=cy(FY);function zv(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 qY(){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?UY(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 UY(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 sa={basename:HY,dirname:VY,extname:WY,join:GY,sep:"/"};function HY(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');T0(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 VY(e){if(T0(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 WY(e){T0(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 GY(...e){let t=-1,n;for(;++t<e.length;)T0(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":KY(n)}function KY(e){T0(e);const t=e.codePointAt(0)===47;let n=YY(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function YY(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 T0(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const XY={cwd:QY};function QY(){return"/"}function Fv(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function JY(e){if(typeof e=="string")e=new URL(e);else if(!Fv(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 ZY(e)}function ZY(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 V2=["history","path","basename","stem","extname","dirname"];class hR{constructor(t){let n;t?Fv(t)?n={path:t}:typeof t=="string"||eX(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":XY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<V2.length;){const i=V2[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)V2.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?sa.basename(this.path):void 0}set basename(t){G2(t,"basename"),W2(t,"basename"),this.path=sa.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?sa.dirname(this.path):void 0}set dirname(t){m7(this.basename,"dirname"),this.path=sa.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?sa.extname(this.path):void 0}set extname(t){if(W2(t,"extname"),m7(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=sa.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Fv(t)&&(t=JY(t)),G2(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?sa.basename(this.path,this.extname):void 0}set stem(t){G2(t,"stem"),W2(t,"stem"),this.path=sa.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 Os(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 W2(e,t){if(e&&e.includes(sa.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+sa.sep+"`")}function G2(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function m7(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function eX(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const tX=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},nX={}.hasOwnProperty;class g5 extends tX{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=qY()}copy(){const t=new g5;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(H2(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(X2("data",this.frozen),this.namespace[t]=n,this):nX.call(this.namespace,t)&&this.namespace[t]||void 0:t?(X2("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=pp(t),r=this.parser||this.Parser;return K2("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),K2("process",this.parser||this.Parser),Y2("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=pp(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);iX(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(),K2("processSync",this.parser||this.Parser),Y2("processSync",this.compiler||this.Compiler),this.process(t,s),g7("processSync","process",n),r;function s(i,o){n=!0,a7(i),r=o}}run(t,n,r){p7(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=pp(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),g7("runSync","run",r),s;function i(o,a){a7(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=pp(n),s=this.compiler||this.Compiler;return Y2("stringify",s),p7(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(X2("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=H2(!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];zv(y)&&zv(m)&&(m=H2(!0,y,m)),r[f]=[c,m,...p]}}}}const rX=new g5().freeze();function K2(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Y2(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function X2(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 p7(e){if(!zv(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function g7(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function pp(e){return sX(e)?e:new hR(e)}function sX(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function iX(e){return typeof e=="string"||oX(e)}function oX(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const aX="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",y7=[],b7={allowDangerousHtml:!0},lX=/^(https?|ircs?|mailto|xmpp)$/i,cX=[{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 uX(e){const t=dX(e),n=hX(e);return fX(t.runSync(t.parse(n),n),e)}function dX(e){const t=e.rehypePlugins||y7,n=e.remarkPlugins||y7,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...b7}:b7;return rX().use(GK).use(n).use(zY,r).use(t)}function hX(e){const t=e.children||"",n=new hR;return typeof t=="string"&&(n.value=t),n}function fX(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||mX;for(const u of cX)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+aX+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),p5(e,c),IW(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 F2)if(Object.hasOwn(F2,m)&&Object.hasOwn(u.properties,m)){const p=u.properties[m],y=F2[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 mX(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||lX.test(e.slice(0,t))?e:""}function k1(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 pX(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function gX(e,t,n){const s=S0((n||{}).ignore||[]),i=yX(t);let o=-1;for(;++o<i.length;)m5(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,w=[];f.lastIndex=0;let x=f.exec(c.value);for(;x;){const k=x.index,T={index:x.index,input:x.input,stack:[...u,c]};let A=m(...x,T);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?f.lastIndex=k+1:(p!==k&&w.push({type:"text",value:c.value.slice(p,k)}),Array.isArray(A)?w.push(...A):A&&w.push(A),p=k+x[0].length,b=!0),!f.global)break;x=f.exec(c.value)}return b?(p<c.value.length&&w.push({type:"text",value:c.value.slice(p)}),d.children.splice(v,1,...w)):w=[c],v+w.length}}function yX(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([bX(s[0]),wX(s[1])])}return t}function bX(e){return typeof e=="string"?new RegExp(pX(e),"g"):e}function wX(e){return typeof e=="function"?e:function(){return e}}const Q2="phrasing",J2=["autolink","link","image","label"];function vX(){return{transforms:[AX],enter:{literalAutolink:_X,literalAutolinkEmail:Z2,literalAutolinkHttp:Z2,literalAutolinkWww:Z2},exit:{literalAutolink:CX,literalAutolinkEmail:TX,literalAutolinkHttp:kX,literalAutolinkWww:SX}}}function xX(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Q2,notInConstruct:J2},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Q2,notInConstruct:J2},{character:":",before:"[ps]",after:"\\/",inConstruct:Q2,notInConstruct:J2}]}}function _X(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Z2(e){this.config.enter.autolinkProtocol.call(this,e)}function kX(e){this.config.exit.autolinkProtocol.call(this,e)}function SX(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 TX(e){this.config.exit.autolinkEmail.call(this,e)}function CX(e){this.exit(e)}function AX(e){gX(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,EX],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),MX]],{ignore:["link","linkReference"]})}function EX(e,t,n,r,s){let i="";if(!fR(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!IX(n)))return!1;const o=NX(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 MX(e,t,n,r){return!fR(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function IX(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 NX(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=k1(e,"(");let i=k1(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 fR(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Nu(n)||$y(n))&&(!t||n!==47)}mR.peek=zX;function RX(){this.buffer()}function LX(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function jX(){this.buffer()}function DX(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function OX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Lo(this.sliceSerialize(e)).toLowerCase(),n.label=t}function BX(e){this.exit(e)}function PX(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Lo(this.sliceSerialize(e)).toLowerCase(),n.label=t}function $X(e){this.exit(e)}function zX(){return"["}function mR(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 FX(){return{enter:{gfmFootnoteCallString:RX,gfmFootnoteCall:LX,gfmFootnoteDefinitionLabelString:jX,gfmFootnoteDefinition:DX},exit:{gfmFootnoteCallString:OX,gfmFootnoteCall:BX,gfmFootnoteDefinitionLabelString:PX,gfmFootnoteDefinition:$X}}}function qX(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:mR},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?pR:UX))),c(),l}}function UX(e,t,n){return t===0?e:pR(e,t,n)}function pR(e,t,n){return(n?"":"    ")+e}const HX=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];gR.peek=YX;function VX(){return{canContainEols:["delete"],enter:{strikethrough:GX},exit:{strikethrough:KX}}}function WX(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:HX}],handlers:{delete:gR}}}function GX(e){this.enter({type:"delete",children:[]},e)}function KX(e){this.exit(e)}function gR(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 YX(){return"~"}function XX(e){return e.length}function QX(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||XX,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 w=JX(e[u][b]);if(n.alignDelimiters!==!1){const x=s(w);v[b]=x,(l[b]===void 0||x>l[b])&&(l[b]=x)}y.push(w)}o[u]=y,a[u]=v}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=w7(r[d]);else{const y=w7(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 w=n.alignDelimiters===!1?1:Math.max(1,l[d]-v.length-b.length);const x=v+"-".repeat(w)+b;n.alignDelimiters!==!1&&(w=v.length+w+b.length,w>l[d]&&(l[d]=w),m[d]=w),f[d]=x}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 w=y[d]||"";let x="",k="";if(n.alignDelimiters!==!1){const T=l[d]-(v[d]||0),A=i[d];A===114?x=" ".repeat(T):A===99?T%2?(x=" ".repeat(T/2+.5),k=" ".repeat(T/2-.5)):(x=" ".repeat(T/2),k=x):k=" ".repeat(T)}n.delimiterStart!==!1&&!d&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||d)&&b.push(" "),n.alignDelimiters!==!1&&b.push(x),b.push(w),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 JX(e){return e==null?"":String(e)}function w7(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 v7={}.hasOwnProperty;function ZX(e,t){const n=t||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&v7.call(s,e)){const l=String(s[e]);o=v7.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 eQ(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()),tQ);return s(),o}function tQ(e,t,n){return">"+(n?"":" ")+e}function nQ(e,t){return x7(e,t.inConstruct,!0)&&!x7(e,t.notInConstruct,!1)}function x7(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 _7(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&nQ(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function yR(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 rQ(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 sQ(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 iQ(e,t,n,r){const s=sQ(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(rQ(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,oQ);return d(),f}const a=n.createTracker(r),l=s.repeat(Math.max(yR(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 oQ(e,t,n){return(n?"":"    ")+e}function y5(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 aQ(e,t,n,r){const s=y5(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 lQ(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 zm(e){return"&#x"+e.toString(16).toUpperCase()+";"}function S1(e,t,n){const r=hh(e),s=hh(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}}bR.peek=cQ;function bR(e,t,n,r){const s=lQ(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=S1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=zm(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=S1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+zm(d));const m=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function cQ(e,t,n){return n.options.emphasis||"*"}function uQ(e,t){let n=!1;return p5(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Pv}),!!((!e.depth||e.depth<3)&&a5(e)&&(t.options.setext||n))}function dQ(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(uQ(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=zm(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}wR.peek=hQ;function wR(e){return e.value||""}function hQ(){return"<"}vR.peek=fQ;function vR(e,t,n,r){const s=y5(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 fQ(){return"!"}xR.peek=mQ;function xR(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 mQ(){return"!"}_R.peek=pQ;function _R(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 pQ(){return"`"}function kR(e,t){const n=a5(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))}SR.peek=gQ;function SR(e,t,n,r){const s=y5(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(kR(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 gQ(e,t,n){return kR(e,n)?"<":"["}TR.peek=yQ;function TR(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 yQ(){return"["}function b5(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 bQ(e){const t=b5(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 wQ(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 CR(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 vQ(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?wQ(n):b5(n);const a=e.ordered?o==="."?")":".":bQ(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),CR(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 xQ(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 _Q(e,t,n,r){const s=xQ(n);let i=n.bulletCurrent||b5(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 kQ(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const SQ=S0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function TQ(e,t,n,r){return(e.children.some(function(o){return SQ(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function CQ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}AR.peek=AQ;function AR(e,t,n,r){const s=CQ(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=S1(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=zm(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=S1(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+zm(d));const m=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+m}function AQ(e,t,n){return n.options.strong||"*"}function EQ(e,t,n,r){return n.safe(e.value,r)}function MQ(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 IQ(e,t,n){const r=(CR(n)+(n.options.ruleSpaces?" ":"")).repeat(MQ(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ER={blockquote:eQ,break:_7,code:iQ,definition:aQ,emphasis:bR,hardBreak:_7,heading:dQ,html:wR,image:vR,imageReference:xR,inlineCode:_R,link:SR,linkReference:TR,list:vQ,listItem:_Q,paragraph:kQ,root:TQ,strong:AR,text:EQ,thematicBreak:IQ};function NQ(){return{enter:{table:RQ,tableData:k7,tableHeader:k7,tableRow:jQ},exit:{codeText:DQ,table:LQ,tableData:ew,tableHeader:ew,tableRow:ew}}}function RQ(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 LQ(e){this.exit(e),this.data.inTable=void 0}function jQ(e){this.enter({type:"tableRow",children:[]},e)}function ew(e){this.exit(e)}function k7(e){this.enter({type:"tableCell",children:[]},e)}function DQ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,OQ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function OQ(e,t){return t==="|"?t:e}function BQ(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),w=c([b]);return w.slice(0,w.indexOf(`
`))}function l(m,p,y,v){const b=y.enter("tableCell"),w=y.enter("phrasing"),x=y.containerPhrasing(m,{...v,before:i,after:i});return w(),b(),x}function c(m,p){return QX(m,{align:p,alignDelimiters:r,padding:n,stringLength:s})}function u(m,p,y){const v=m.children;let b=-1;const w=[],x=p.enter("table");for(;++b<v.length;)w[b]=d(v[b],p,y);return x(),w}function d(m,p,y){const v=m.children;let b=-1;const w=[],x=p.enter("tableRow");for(;++b<v.length;)w[b]=l(v[b],m,p,y);return x(),w}function f(m,p,y){let v=ER.inlineCode(m,p,y);return y.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function PQ(){return{exit:{taskListCheckValueChecked:S7,taskListCheckValueUnchecked:S7,paragraph:zQ}}}function $Q(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:FQ}}}function S7(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function zQ(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 FQ(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=ER.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 qQ(){return[vX(),FX(),VX(),NQ(),PQ()]}function UQ(e){return{extensions:[xX(),qX(e),WX(),BQ(e),$Q()]}}const HQ={tokenize:XQ,partial:!0},MR={tokenize:QQ,partial:!0},IR={tokenize:JQ,partial:!0},NR={tokenize:ZQ,partial:!0},VQ={tokenize:eJ,partial:!0},RR={name:"wwwAutolink",tokenize:KQ,previous:jR},LR={name:"protocolAutolink",tokenize:YQ,previous:DR},yl={name:"emailAutolink",tokenize:GQ,previous:OR},_a={};function WQ(){return{text:_a}}let qc=48;for(;qc<123;)_a[qc]=yl,qc++,qc===58?qc=65:qc===91&&(qc=97);_a[43]=yl;_a[45]=yl;_a[46]=yl;_a[95]=yl;_a[72]=[yl,LR];_a[104]=[yl,LR];_a[87]=[yl,RR];_a[119]=[yl,RR];function GQ(e,t,n){const r=this;let s,i;return o;function o(d){return!qv(d)||!OR.call(r,r.previous)||w5(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return qv(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(VQ,u,c)(d):d===45||d===95||Rs(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&&Xs(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function KQ(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!jR.call(r,r.previous)||w5(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(HQ,e.attempt(MR,e.attempt(IR,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function YQ(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&DR.call(r,r.previous)&&!w5(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(Xs(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||v1(d)||Kn(d)||Nu(d)||$y(d)?n(d):e.attempt(MR,e.attempt(IR,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function XQ(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 QQ(e,t,n){let r,s,i;return o;function o(c){return c===46||c===95?e.check(NR,l,a)(c):c===null||Kn(c)||Nu(c)||c!==45&&$y(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 JQ(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(NR,t,i)(o):o===null||Kn(o)||Nu(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function ZQ(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||Kn(a)||Nu(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||Kn(a)||Nu(a)?t(a):r(a)}function i(a){return Xs(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Xs(a)?(e.consume(a),o):n(a)}}function eJ(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return Rs(i)?n(i):t(i)}}function jR(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Kn(e)}function DR(e){return!Xs(e)}function OR(e){return!(e===47||qv(e))}function qv(e){return e===43||e===45||e===46||e===95||Rs(e)}function w5(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 tJ={tokenize:cJ,partial:!0};function nJ(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:oJ,continuation:{tokenize:aJ},exit:lJ}},text:{91:{name:"gfmFootnoteCall",tokenize:iJ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:rJ,resolveTo:sJ}}}}function rJ(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=Lo(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 sJ(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 iJ(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||Kn(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(Lo(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Kn(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 oJ(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||Kn(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Lo(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(p),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Kn(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),an(e,m,"gfmFootnoteDefinitionWhitespace")):n(p)}function m(p){return t(p)}}function aJ(e,t,n){return e.check(k0,t,e.attempt(tJ,t,n))}function lJ(e){e.exit("gfmFootnoteDefinition")}function cJ(e,t,n){const r=this;return an(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 uJ(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&&Fi(f,f.length,0,zy(m,o.slice(c+1,l),a)),Fi(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Fi(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=hh(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=hh(p);return v._open=!b||b===2&&!!y,v._close=!y||y===2&&!!b,a(p)}}}class dJ{constructor(){this.map=[]}add(t,n,r){hJ(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 hJ(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 fJ(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 mJ(){return{flow:{null:{name:"table",tokenize:pJ,resolveAll:gJ}}}}function pJ(e,t,n){const r=this;let s=0,i=0,o;return a;function a(C){let L=r.events.length-1;for(;L>-1;){const F=r.events[L][1].type;if(F==="lineEnding"||F==="linePrefix")L--;else break}const I=L>-1?r.events[L][1].type:null,B=I==="tableHead"||I==="tableRow"?A:l;return B===A&&r.parser.lazy[r.now().line]?n(C):B(C)}function l(C){return e.enter("tableHead"),e.enter("tableRow"),c(C)}function c(C){return C===124||(o=!0,i+=1),u(C)}function u(C){return C===null?n(C):wt(C)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),m):n(C):dn(C)?an(e,u,"whitespace")(C):(i+=1,o&&(o=!1,s+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(C)))}function d(C){return C===null||C===124||Kn(C)?(e.exit("data"),u(C)):(e.consume(C),C===92?f:d)}function f(C){return C===92||C===124?(e.consume(C),d):d(C)}function m(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),o=!1,dn(C)?an(e,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):p(C))}function p(C){return C===45||C===58?v(C):C===124?(o=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),y):T(C)}function y(C){return dn(C)?an(e,v,"whitespace")(C):v(C)}function v(C){return C===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),b):C===45?(i+=1,b(C)):C===null||wt(C)?k(C):T(C)}function b(C){return C===45?(e.enter("tableDelimiterFiller"),w(C)):T(C)}function w(C){return C===45?(e.consume(C),w):C===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(C))}function x(C){return dn(C)?an(e,k,"whitespace")(C):k(C)}function k(C){return C===124?p(C):C===null||wt(C)?!o||s!==i?T(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):T(C)}function T(C){return n(C)}function A(C){return e.enter("tableRow"),M(C)}function M(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),M):C===null||wt(C)?(e.exit("tableRow"),t(C)):dn(C)?an(e,M,"whitespace")(C):(e.enter("data"),D(C))}function D(C){return C===null||C===124||Kn(C)?(e.exit("data"),M(C)):(e.consume(C),C===92?O:D)}function O(C){return C===92||C===124?(e.consume(C),D):D(C)}}function gJ(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 dJ;for(;++n<e.length;){const m=e[n],p=m[1];m[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(T7(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=gp(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=gp(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=gp(f,t,i,s,n,d)):o[1]!==0&&(d=gp(f,t,o,s,n,d)),s=0):s&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&T7(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=fJ(t.events,n))}return e}function gp(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},yd(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=yd(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=yd(t.events,n[2]),u=yd(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({},yd(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function T7(e,t,n,r,s){const i=[],o=yd(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 yd(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const yJ={name:"tasklistCheck",tokenize:wJ};function bJ(){return{text:{91:yJ}}}function wJ(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 Kn(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 wt(l)?t(l):dn(l)?e.check({tokenize:vJ},t,n)(l):n(l)}}function vJ(e,t,n){return an(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function xJ(e){return VN([WQ(),nJ(),uJ(e),mJ(),bJ()])}const _J={};function C7(e){const t=this,n=e||_J,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(xJ(n)),i.push(qQ()),o.push(UQ(n))}function kJ(){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 SJ(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(yR(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 TJ={tokenize:CJ,concrete:!0,name:"mathFlow"},A7={tokenize:AJ,partial:!0};function CJ(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(w){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(w)}function l(w){return w===36?(e.consume(w),o++,l):o<2?n(w):(e.exit("mathFlowFenceSequence"),an(e,c,"whitespace")(w))}function c(w){return w===null||wt(w)?d(w):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(w))}function u(w){return w===null||wt(w)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),d(w)):w===36?n(w):(e.consume(w),u)}function d(w){return e.exit("mathFlowFence"),r.interrupt?t(w):e.attempt(A7,f,v)(w)}function f(w){return e.attempt({tokenize:b,partial:!0},v,m)(w)}function m(w){return(i?an(e,p,"linePrefix",i+1):p)(w)}function p(w){return w===null?v(w):wt(w)?e.attempt(A7,f,v)(w):(e.enter("mathFlowValue"),y(w))}function y(w){return w===null||wt(w)?(e.exit("mathFlowValue"),p(w)):(e.consume(w),y)}function v(w){return e.exit("mathFlow"),t(w)}function b(w,x,k){let T=0;return an(w,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function A(O){return w.enter("mathFlowFence"),w.enter("mathFlowFenceSequence"),M(O)}function M(O){return O===36?(T++,w.consume(O),M):T<o?k(O):(w.exit("mathFlowFenceSequence"),an(w,D,"whitespace")(O))}function D(O){return O===null||wt(O)?(w.exit("mathFlowFence"),x(O)):k(O)}}}function AJ(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 EJ(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:MJ,previous:IJ,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):wt(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||wt(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 MJ(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 IJ(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function NJ(e){return{flow:{36:TJ},text:{36:EJ(e)}}}class Oe 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,Oe.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=t}}var RJ=/([A-Z])/g,LJ=e=>e.replace(RJ,"-$1").toLowerCase(),jJ={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},DJ=/[&><"']/g,Ds=e=>String(e).replace(DJ,t=>jJ[t]),kg=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?kg(e.body[0]):e:e.type==="font"?kg(e.body):e,OJ=new Set(["mathord","textord","atom"]),bl=e=>OJ.has(kg(e).type),BJ=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"},T1={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 PJ(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 $J(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return PJ(t)}function zJ(e,t,n,r){var s=n[t];e[t]=s!==void 0?r.processor?r.processor(s):s:$J(r)}class v5{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(T1)){var r=T1[n];r&&zJ(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 Oe("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=BJ(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}class El{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 ia[FJ[this.id]]}sub(){return ia[qJ[this.id]]}fracNum(){return ia[UJ[this.id]]}fracDen(){return ia[HJ[this.id]]}cramp(){return ia[VJ[this.id]]}text(){return ia[WJ[this.id]]}isTight(){return this.size>=2}}var x5=0,C1=1,Wd=2,rl=3,Fm=4,uo=5,fh=6,Js=7,ia=[new El(x5,0,!1),new El(C1,0,!0),new El(Wd,1,!1),new El(rl,1,!0),new El(Fm,2,!1),new El(uo,2,!0),new El(fh,3,!1),new El(Js,3,!0)],FJ=[Fm,uo,Fm,uo,fh,Js,fh,Js],qJ=[uo,uo,uo,uo,Js,Js,Js,Js],UJ=[Wd,rl,Fm,uo,fh,Js,fh,Js],HJ=[rl,rl,uo,uo,Js,Js,Js,Js],VJ=[C1,C1,rl,rl,uo,uo,Js,Js],WJ=[x5,C1,Wd,rl,Wd,rl,Wd,rl],Vt={DISPLAY:ia[x5],TEXT:ia[Wd],SCRIPT:ia[Fm],SCRIPTSCRIPT:ia[fh]},Uv=[{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 GJ(e){for(var t=0;t<Uv.length;t++)for(var n=Uv[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 Sg=[];Uv.forEach(e=>e.blocks.forEach(t=>Sg.push(...t)));function BR(e){for(var t=0;t<Sg.length;t+=2)if(e>=Sg[t]&&e<=Sg[t+1])return!0;return!1}var Gr=e=>e+" "+e,ud=80,KJ=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"},YJ=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"},XJ=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"},QJ=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"},JJ=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"},ZJ=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},eZ=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"},tZ=function(t,n,r){n=1e3*n;var s="";switch(t){case"sqrtMain":s=KJ(n,ud);break;case"sqrtSize1":s=YJ(n,ud);break;case"sqrtSize2":s=XJ(n,ud);break;case"sqrtSize3":s=QJ(n,ud);break;case"sqrtSize4":s=JJ(n,ud);break;case"sqrtTall":s=eZ(n,ud,r)}return s},nZ=function(t,n){switch(t){case"⎜":return Gr("M291 0 H417 V"+n+" H291z");case"∣":return Gr("M145 0 H188 V"+n+" H145z");case"∥":return Gr("M145 0 H188 V"+n+" H145z")+Gr("M367 0 H410 V"+n+" H367z");case"⎟":return Gr("M457 0 H583 V"+n+" H457z");case"⎢":return Gr("M319 0 H403 V"+n+" H319z");case"⎥":return Gr("M263 0 H347 V"+n+" H263z");case"⎪":return Gr("M384 0 H504 V"+n+" H384z");case"⏐":return Gr("M312 0 H355 V"+n+" H312z");case"‖":return Gr("M257 0 H300 V"+n+" H257z")+Gr("M478 0 H521 V"+n+" H478z");default:return""}},E7={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:Gr("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:Gr("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:Gr("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:Gr("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:Gr("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:Gr("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:Gr("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:Gr("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`},rZ=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 sZ(e){return"toText"in e}class Ph{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(sZ(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}}var Hv={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},iZ={ex:!0,em:!0,mu:!0},PR=function(t){return typeof t!="string"&&(t=t.unit),t in Hv||t in iZ||t==="ex"},pr=function(t,n){var r;if(t.unit in Hv)r=Hv[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 Oe("Invalid unit: '"+t.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},Ue=function(t){return+t.toFixed(4)+"em"},wc=function(t){return t.filter(n=>n).join(" ")},_5=function(t){var n="";for(var r of Object.keys(t)){var s=t[r];s!==void 0&&(n+=LJ(r)+":"+s+";")}return n},$R=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)}},zR=function(t){var n=document.createElement(t);n.className=wc(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},oZ=/[\s"'>/=\x00-\x1f]/,FR=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+Ds(wc(this.classes))+'"');var r=_5(this.style);r&&(n+=' style="'+Ds(r)+'"');for(var s of Object.keys(this.attributes)){if(oZ.test(s))throw new Oe("Invalid attribute name '"+s+"'");n+=" "+s+'="'+Ds(this.attributes[s])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class $h{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,$R.call(this,t,r,s),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return zR.call(this,"span")}toMarkup(){return FR.call(this,"span")}}class Uy{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,$R.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 zR.call(this,"a")}toMarkup(){return FR.call(this,"a")}}class aZ{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="'+Ds(this.src)+'"'+(' alt="'+Ds(this.alt)+'"'),n=_5(this.style);return n&&(t+=' style="'+Ds(n)+'"'),t+="'/>",t}}var lZ={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Vi{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=GJ(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=lZ[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=Ue(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=wc(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+=Ds(wc(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+Ue(this.italic)+";"),r+=_5(this.style),r&&(t=!0,n+=' style="'+Ds(r)+'"');var s=Ds(this.text);return t?(n+=">",n+=s,n+="</span>",n):s}}class hl{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+'="'+Ds(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class vc{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",E7[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+Ds(this.alternate)+'"/>':'<path d="'+Ds(E7[this.pathName])+'"/>'}}class Vv{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+'="'+Ds(this.attributes[n])+'"';return t+="/>",t}}function cZ(e){if(e instanceof Vi)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function uZ(e){if(e instanceof $h)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var dZ=e=>e instanceof $h||e instanceof Uy||e instanceof Ph,ha={"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]}},yp={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]},M7={Å:"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 qR(e,t){ha[e]=t}function k5(e,t,n){if(!ha[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),s=ha[t][r];if(!s&&e[0]in M7&&(r=M7[e[0]].charCodeAt(0),s=ha[t][r]),!s&&n==="text"&&BR(r)&&(s=ha[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var tw={};function hZ(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!tw[t]){var n=tw[t]={cssEmPerMu:yp.quad[t]/18};for(var r in yp)yp.hasOwnProperty(r)&&(n[r]=yp[r][t])}return tw[t]}var ur={math:{},text:{}};function _(e,t,n,r,s,i){ur[e][s]={font:t,group:n,replace:r},i&&r&&(ur[e][r]=ur[e][s])}var S="math",Ae="text",R="main",V="ams",dr="accent-token",ct="bin",ni="close",zh="inner",Lt="mathord",Fr="op-token",Wi="open",C0="punct",G="rel",wl="spacing",Z="textord";_(S,R,G,"≡","\\equiv",!0);_(S,R,G,"≺","\\prec",!0);_(S,R,G,"≻","\\succ",!0);_(S,R,G,"∼","\\sim",!0);_(S,R,G,"⊥","\\perp");_(S,R,G,"⪯","\\preceq",!0);_(S,R,G,"⪰","\\succeq",!0);_(S,R,G,"≃","\\simeq",!0);_(S,R,G,"∣","\\mid",!0);_(S,R,G,"≪","\\ll",!0);_(S,R,G,"≫","\\gg",!0);_(S,R,G,"≍","\\asymp",!0);_(S,R,G,"∥","\\parallel");_(S,R,G,"⋈","\\bowtie",!0);_(S,R,G,"⌣","\\smile",!0);_(S,R,G,"⊑","\\sqsubseteq",!0);_(S,R,G,"⊒","\\sqsupseteq",!0);_(S,R,G,"≐","\\doteq",!0);_(S,R,G,"⌢","\\frown",!0);_(S,R,G,"∋","\\ni",!0);_(S,R,G,"∝","\\propto",!0);_(S,R,G,"⊢","\\vdash",!0);_(S,R,G,"⊣","\\dashv",!0);_(S,R,G,"∋","\\owns");_(S,R,C0,".","\\ldotp");_(S,R,C0,"⋅","\\cdotp");_(S,R,C0,"⋅","·");_(Ae,R,Z,"⋅","·");_(S,R,Z,"#","\\#");_(Ae,R,Z,"#","\\#");_(S,R,Z,"&","\\&");_(Ae,R,Z,"&","\\&");_(S,R,Z,"ℵ","\\aleph",!0);_(S,R,Z,"∀","\\forall",!0);_(S,R,Z,"ℏ","\\hbar",!0);_(S,R,Z,"∃","\\exists",!0);_(S,R,Z,"∇","\\nabla",!0);_(S,R,Z,"♭","\\flat",!0);_(S,R,Z,"ℓ","\\ell",!0);_(S,R,Z,"♮","\\natural",!0);_(S,R,Z,"♣","\\clubsuit",!0);_(S,R,Z,"℘","\\wp",!0);_(S,R,Z,"♯","\\sharp",!0);_(S,R,Z,"♢","\\diamondsuit",!0);_(S,R,Z,"ℜ","\\Re",!0);_(S,R,Z,"♡","\\heartsuit",!0);_(S,R,Z,"ℑ","\\Im",!0);_(S,R,Z,"♠","\\spadesuit",!0);_(S,R,Z,"§","\\S",!0);_(Ae,R,Z,"§","\\S");_(S,R,Z,"¶","\\P",!0);_(Ae,R,Z,"¶","\\P");_(S,R,Z,"†","\\dag");_(Ae,R,Z,"†","\\dag");_(Ae,R,Z,"†","\\textdagger");_(S,R,Z,"‡","\\ddag");_(Ae,R,Z,"‡","\\ddag");_(Ae,R,Z,"‡","\\textdaggerdbl");_(S,R,ni,"⎱","\\rmoustache",!0);_(S,R,Wi,"⎰","\\lmoustache",!0);_(S,R,ni,"⟯","\\rgroup",!0);_(S,R,Wi,"⟮","\\lgroup",!0);_(S,R,ct,"∓","\\mp",!0);_(S,R,ct,"⊖","\\ominus",!0);_(S,R,ct,"⊎","\\uplus",!0);_(S,R,ct,"⊓","\\sqcap",!0);_(S,R,ct,"∗","\\ast");_(S,R,ct,"⊔","\\sqcup",!0);_(S,R,ct,"◯","\\bigcirc",!0);_(S,R,ct,"∙","\\bullet",!0);_(S,R,ct,"‡","\\ddagger");_(S,R,ct,"≀","\\wr",!0);_(S,R,ct,"⨿","\\amalg");_(S,R,ct,"&","\\And");_(S,R,G,"⟵","\\longleftarrow",!0);_(S,R,G,"⇐","\\Leftarrow",!0);_(S,R,G,"⟸","\\Longleftarrow",!0);_(S,R,G,"⟶","\\longrightarrow",!0);_(S,R,G,"⇒","\\Rightarrow",!0);_(S,R,G,"⟹","\\Longrightarrow",!0);_(S,R,G,"↔","\\leftrightarrow",!0);_(S,R,G,"⟷","\\longleftrightarrow",!0);_(S,R,G,"⇔","\\Leftrightarrow",!0);_(S,R,G,"⟺","\\Longleftrightarrow",!0);_(S,R,G,"↦","\\mapsto",!0);_(S,R,G,"⟼","\\longmapsto",!0);_(S,R,G,"↗","\\nearrow",!0);_(S,R,G,"↩","\\hookleftarrow",!0);_(S,R,G,"↪","\\hookrightarrow",!0);_(S,R,G,"↘","\\searrow",!0);_(S,R,G,"↼","\\leftharpoonup",!0);_(S,R,G,"⇀","\\rightharpoonup",!0);_(S,R,G,"↙","\\swarrow",!0);_(S,R,G,"↽","\\leftharpoondown",!0);_(S,R,G,"⇁","\\rightharpoondown",!0);_(S,R,G,"↖","\\nwarrow",!0);_(S,R,G,"⇌","\\rightleftharpoons",!0);_(S,V,G,"≮","\\nless",!0);_(S,V,G,"","\\@nleqslant");_(S,V,G,"","\\@nleqq");_(S,V,G,"⪇","\\lneq",!0);_(S,V,G,"≨","\\lneqq",!0);_(S,V,G,"","\\@lvertneqq");_(S,V,G,"⋦","\\lnsim",!0);_(S,V,G,"⪉","\\lnapprox",!0);_(S,V,G,"⊀","\\nprec",!0);_(S,V,G,"⋠","\\npreceq",!0);_(S,V,G,"⋨","\\precnsim",!0);_(S,V,G,"⪹","\\precnapprox",!0);_(S,V,G,"≁","\\nsim",!0);_(S,V,G,"","\\@nshortmid");_(S,V,G,"∤","\\nmid",!0);_(S,V,G,"⊬","\\nvdash",!0);_(S,V,G,"⊭","\\nvDash",!0);_(S,V,G,"⋪","\\ntriangleleft");_(S,V,G,"⋬","\\ntrianglelefteq",!0);_(S,V,G,"⊊","\\subsetneq",!0);_(S,V,G,"","\\@varsubsetneq");_(S,V,G,"⫋","\\subsetneqq",!0);_(S,V,G,"","\\@varsubsetneqq");_(S,V,G,"≯","\\ngtr",!0);_(S,V,G,"","\\@ngeqslant");_(S,V,G,"","\\@ngeqq");_(S,V,G,"⪈","\\gneq",!0);_(S,V,G,"≩","\\gneqq",!0);_(S,V,G,"","\\@gvertneqq");_(S,V,G,"⋧","\\gnsim",!0);_(S,V,G,"⪊","\\gnapprox",!0);_(S,V,G,"⊁","\\nsucc",!0);_(S,V,G,"⋡","\\nsucceq",!0);_(S,V,G,"⋩","\\succnsim",!0);_(S,V,G,"⪺","\\succnapprox",!0);_(S,V,G,"≆","\\ncong",!0);_(S,V,G,"","\\@nshortparallel");_(S,V,G,"∦","\\nparallel",!0);_(S,V,G,"⊯","\\nVDash",!0);_(S,V,G,"⋫","\\ntriangleright");_(S,V,G,"⋭","\\ntrianglerighteq",!0);_(S,V,G,"","\\@nsupseteqq");_(S,V,G,"⊋","\\supsetneq",!0);_(S,V,G,"","\\@varsupsetneq");_(S,V,G,"⫌","\\supsetneqq",!0);_(S,V,G,"","\\@varsupsetneqq");_(S,V,G,"⊮","\\nVdash",!0);_(S,V,G,"⪵","\\precneqq",!0);_(S,V,G,"⪶","\\succneqq",!0);_(S,V,G,"","\\@nsubseteqq");_(S,V,ct,"⊴","\\unlhd");_(S,V,ct,"⊵","\\unrhd");_(S,V,G,"↚","\\nleftarrow",!0);_(S,V,G,"↛","\\nrightarrow",!0);_(S,V,G,"⇍","\\nLeftarrow",!0);_(S,V,G,"⇏","\\nRightarrow",!0);_(S,V,G,"↮","\\nleftrightarrow",!0);_(S,V,G,"⇎","\\nLeftrightarrow",!0);_(S,V,G,"△","\\vartriangle");_(S,V,Z,"ℏ","\\hslash");_(S,V,Z,"▽","\\triangledown");_(S,V,Z,"◊","\\lozenge");_(S,V,Z,"Ⓢ","\\circledS");_(S,V,Z,"®","\\circledR");_(Ae,V,Z,"®","\\circledR");_(S,V,Z,"∡","\\measuredangle",!0);_(S,V,Z,"∄","\\nexists");_(S,V,Z,"℧","\\mho");_(S,V,Z,"Ⅎ","\\Finv",!0);_(S,V,Z,"⅁","\\Game",!0);_(S,V,Z,"‵","\\backprime");_(S,V,Z,"▲","\\blacktriangle");_(S,V,Z,"▼","\\blacktriangledown");_(S,V,Z,"■","\\blacksquare");_(S,V,Z,"⧫","\\blacklozenge");_(S,V,Z,"★","\\bigstar");_(S,V,Z,"∢","\\sphericalangle",!0);_(S,V,Z,"∁","\\complement",!0);_(S,V,Z,"ð","\\eth",!0);_(Ae,R,Z,"ð","ð");_(S,V,Z,"╱","\\diagup");_(S,V,Z,"╲","\\diagdown");_(S,V,Z,"□","\\square");_(S,V,Z,"□","\\Box");_(S,V,Z,"◊","\\Diamond");_(S,V,Z,"¥","\\yen",!0);_(Ae,V,Z,"¥","\\yen",!0);_(S,V,Z,"✓","\\checkmark",!0);_(Ae,V,Z,"✓","\\checkmark");_(S,V,Z,"ℶ","\\beth",!0);_(S,V,Z,"ℸ","\\daleth",!0);_(S,V,Z,"ℷ","\\gimel",!0);_(S,V,Z,"ϝ","\\digamma",!0);_(S,V,Z,"ϰ","\\varkappa");_(S,V,Wi,"┌","\\@ulcorner",!0);_(S,V,ni,"┐","\\@urcorner",!0);_(S,V,Wi,"└","\\@llcorner",!0);_(S,V,ni,"┘","\\@lrcorner",!0);_(S,V,G,"≦","\\leqq",!0);_(S,V,G,"⩽","\\leqslant",!0);_(S,V,G,"⪕","\\eqslantless",!0);_(S,V,G,"≲","\\lesssim",!0);_(S,V,G,"⪅","\\lessapprox",!0);_(S,V,G,"≊","\\approxeq",!0);_(S,V,ct,"⋖","\\lessdot");_(S,V,G,"⋘","\\lll",!0);_(S,V,G,"≶","\\lessgtr",!0);_(S,V,G,"⋚","\\lesseqgtr",!0);_(S,V,G,"⪋","\\lesseqqgtr",!0);_(S,V,G,"≑","\\doteqdot");_(S,V,G,"≓","\\risingdotseq",!0);_(S,V,G,"≒","\\fallingdotseq",!0);_(S,V,G,"∽","\\backsim",!0);_(S,V,G,"⋍","\\backsimeq",!0);_(S,V,G,"⫅","\\subseteqq",!0);_(S,V,G,"⋐","\\Subset",!0);_(S,V,G,"⊏","\\sqsubset",!0);_(S,V,G,"≼","\\preccurlyeq",!0);_(S,V,G,"⋞","\\curlyeqprec",!0);_(S,V,G,"≾","\\precsim",!0);_(S,V,G,"⪷","\\precapprox",!0);_(S,V,G,"⊲","\\vartriangleleft");_(S,V,G,"⊴","\\trianglelefteq");_(S,V,G,"⊨","\\vDash",!0);_(S,V,G,"⊪","\\Vvdash",!0);_(S,V,G,"⌣","\\smallsmile");_(S,V,G,"⌢","\\smallfrown");_(S,V,G,"≏","\\bumpeq",!0);_(S,V,G,"≎","\\Bumpeq",!0);_(S,V,G,"≧","\\geqq",!0);_(S,V,G,"⩾","\\geqslant",!0);_(S,V,G,"⪖","\\eqslantgtr",!0);_(S,V,G,"≳","\\gtrsim",!0);_(S,V,G,"⪆","\\gtrapprox",!0);_(S,V,ct,"⋗","\\gtrdot");_(S,V,G,"⋙","\\ggg",!0);_(S,V,G,"≷","\\gtrless",!0);_(S,V,G,"⋛","\\gtreqless",!0);_(S,V,G,"⪌","\\gtreqqless",!0);_(S,V,G,"≖","\\eqcirc",!0);_(S,V,G,"≗","\\circeq",!0);_(S,V,G,"≜","\\triangleq",!0);_(S,V,G,"∼","\\thicksim");_(S,V,G,"≈","\\thickapprox");_(S,V,G,"⫆","\\supseteqq",!0);_(S,V,G,"⋑","\\Supset",!0);_(S,V,G,"⊐","\\sqsupset",!0);_(S,V,G,"≽","\\succcurlyeq",!0);_(S,V,G,"⋟","\\curlyeqsucc",!0);_(S,V,G,"≿","\\succsim",!0);_(S,V,G,"⪸","\\succapprox",!0);_(S,V,G,"⊳","\\vartriangleright");_(S,V,G,"⊵","\\trianglerighteq");_(S,V,G,"⊩","\\Vdash",!0);_(S,V,G,"∣","\\shortmid");_(S,V,G,"∥","\\shortparallel");_(S,V,G,"≬","\\between",!0);_(S,V,G,"⋔","\\pitchfork",!0);_(S,V,G,"∝","\\varpropto");_(S,V,G,"◀","\\blacktriangleleft");_(S,V,G,"∴","\\therefore",!0);_(S,V,G,"∍","\\backepsilon");_(S,V,G,"▶","\\blacktriangleright");_(S,V,G,"∵","\\because",!0);_(S,V,G,"⋘","\\llless");_(S,V,G,"⋙","\\gggtr");_(S,V,ct,"⊲","\\lhd");_(S,V,ct,"⊳","\\rhd");_(S,V,G,"≂","\\eqsim",!0);_(S,R,G,"⋈","\\Join");_(S,V,G,"≑","\\Doteq",!0);_(S,V,ct,"∔","\\dotplus",!0);_(S,V,ct,"∖","\\smallsetminus");_(S,V,ct,"⋒","\\Cap",!0);_(S,V,ct,"⋓","\\Cup",!0);_(S,V,ct,"⩞","\\doublebarwedge",!0);_(S,V,ct,"⊟","\\boxminus",!0);_(S,V,ct,"⊞","\\boxplus",!0);_(S,V,ct,"⋇","\\divideontimes",!0);_(S,V,ct,"⋉","\\ltimes",!0);_(S,V,ct,"⋊","\\rtimes",!0);_(S,V,ct,"⋋","\\leftthreetimes",!0);_(S,V,ct,"⋌","\\rightthreetimes",!0);_(S,V,ct,"⋏","\\curlywedge",!0);_(S,V,ct,"⋎","\\curlyvee",!0);_(S,V,ct,"⊝","\\circleddash",!0);_(S,V,ct,"⊛","\\circledast",!0);_(S,V,ct,"⋅","\\centerdot");_(S,V,ct,"⊺","\\intercal",!0);_(S,V,ct,"⋒","\\doublecap");_(S,V,ct,"⋓","\\doublecup");_(S,V,ct,"⊠","\\boxtimes",!0);_(S,V,G,"⇢","\\dashrightarrow",!0);_(S,V,G,"⇠","\\dashleftarrow",!0);_(S,V,G,"⇇","\\leftleftarrows",!0);_(S,V,G,"⇆","\\leftrightarrows",!0);_(S,V,G,"⇚","\\Lleftarrow",!0);_(S,V,G,"↞","\\twoheadleftarrow",!0);_(S,V,G,"↢","\\leftarrowtail",!0);_(S,V,G,"↫","\\looparrowleft",!0);_(S,V,G,"⇋","\\leftrightharpoons",!0);_(S,V,G,"↶","\\curvearrowleft",!0);_(S,V,G,"↺","\\circlearrowleft",!0);_(S,V,G,"↰","\\Lsh",!0);_(S,V,G,"⇈","\\upuparrows",!0);_(S,V,G,"↿","\\upharpoonleft",!0);_(S,V,G,"⇃","\\downharpoonleft",!0);_(S,R,G,"⊶","\\origof",!0);_(S,R,G,"⊷","\\imageof",!0);_(S,V,G,"⊸","\\multimap",!0);_(S,V,G,"↭","\\leftrightsquigarrow",!0);_(S,V,G,"⇉","\\rightrightarrows",!0);_(S,V,G,"⇄","\\rightleftarrows",!0);_(S,V,G,"↠","\\twoheadrightarrow",!0);_(S,V,G,"↣","\\rightarrowtail",!0);_(S,V,G,"↬","\\looparrowright",!0);_(S,V,G,"↷","\\curvearrowright",!0);_(S,V,G,"↻","\\circlearrowright",!0);_(S,V,G,"↱","\\Rsh",!0);_(S,V,G,"⇊","\\downdownarrows",!0);_(S,V,G,"↾","\\upharpoonright",!0);_(S,V,G,"⇂","\\downharpoonright",!0);_(S,V,G,"⇝","\\rightsquigarrow",!0);_(S,V,G,"⇝","\\leadsto");_(S,V,G,"⇛","\\Rrightarrow",!0);_(S,V,G,"↾","\\restriction");_(S,R,Z,"‘","`");_(S,R,Z,"$","\\$");_(Ae,R,Z,"$","\\$");_(Ae,R,Z,"$","\\textdollar");_(S,R,Z,"%","\\%");_(Ae,R,Z,"%","\\%");_(S,R,Z,"_","\\_");_(Ae,R,Z,"_","\\_");_(Ae,R,Z,"_","\\textunderscore");_(S,R,Z,"∠","\\angle",!0);_(S,R,Z,"∞","\\infty",!0);_(S,R,Z,"′","\\prime");_(S,R,Z,"△","\\triangle");_(S,R,Z,"Γ","\\Gamma",!0);_(S,R,Z,"Δ","\\Delta",!0);_(S,R,Z,"Θ","\\Theta",!0);_(S,R,Z,"Λ","\\Lambda",!0);_(S,R,Z,"Ξ","\\Xi",!0);_(S,R,Z,"Π","\\Pi",!0);_(S,R,Z,"Σ","\\Sigma",!0);_(S,R,Z,"Υ","\\Upsilon",!0);_(S,R,Z,"Φ","\\Phi",!0);_(S,R,Z,"Ψ","\\Psi",!0);_(S,R,Z,"Ω","\\Omega",!0);_(S,R,Z,"A","Α");_(S,R,Z,"B","Β");_(S,R,Z,"E","Ε");_(S,R,Z,"Z","Ζ");_(S,R,Z,"H","Η");_(S,R,Z,"I","Ι");_(S,R,Z,"K","Κ");_(S,R,Z,"M","Μ");_(S,R,Z,"N","Ν");_(S,R,Z,"O","Ο");_(S,R,Z,"P","Ρ");_(S,R,Z,"T","Τ");_(S,R,Z,"X","Χ");_(S,R,Z,"¬","\\neg",!0);_(S,R,Z,"¬","\\lnot");_(S,R,Z,"⊤","\\top");_(S,R,Z,"⊥","\\bot");_(S,R,Z,"∅","\\emptyset");_(S,V,Z,"∅","\\varnothing");_(S,R,Lt,"α","\\alpha",!0);_(S,R,Lt,"β","\\beta",!0);_(S,R,Lt,"γ","\\gamma",!0);_(S,R,Lt,"δ","\\delta",!0);_(S,R,Lt,"ϵ","\\epsilon",!0);_(S,R,Lt,"ζ","\\zeta",!0);_(S,R,Lt,"η","\\eta",!0);_(S,R,Lt,"θ","\\theta",!0);_(S,R,Lt,"ι","\\iota",!0);_(S,R,Lt,"κ","\\kappa",!0);_(S,R,Lt,"λ","\\lambda",!0);_(S,R,Lt,"μ","\\mu",!0);_(S,R,Lt,"ν","\\nu",!0);_(S,R,Lt,"ξ","\\xi",!0);_(S,R,Lt,"ο","\\omicron",!0);_(S,R,Lt,"π","\\pi",!0);_(S,R,Lt,"ρ","\\rho",!0);_(S,R,Lt,"σ","\\sigma",!0);_(S,R,Lt,"τ","\\tau",!0);_(S,R,Lt,"υ","\\upsilon",!0);_(S,R,Lt,"ϕ","\\phi",!0);_(S,R,Lt,"χ","\\chi",!0);_(S,R,Lt,"ψ","\\psi",!0);_(S,R,Lt,"ω","\\omega",!0);_(S,R,Lt,"ε","\\varepsilon",!0);_(S,R,Lt,"ϑ","\\vartheta",!0);_(S,R,Lt,"ϖ","\\varpi",!0);_(S,R,Lt,"ϱ","\\varrho",!0);_(S,R,Lt,"ς","\\varsigma",!0);_(S,R,Lt,"φ","\\varphi",!0);_(S,R,ct,"∗","*",!0);_(S,R,ct,"+","+");_(S,R,ct,"−","-",!0);_(S,R,ct,"⋅","\\cdot",!0);_(S,R,ct,"∘","\\circ",!0);_(S,R,ct,"÷","\\div",!0);_(S,R,ct,"±","\\pm",!0);_(S,R,ct,"×","\\times",!0);_(S,R,ct,"∩","\\cap",!0);_(S,R,ct,"∪","\\cup",!0);_(S,R,ct,"∖","\\setminus",!0);_(S,R,ct,"∧","\\land");_(S,R,ct,"∨","\\lor");_(S,R,ct,"∧","\\wedge",!0);_(S,R,ct,"∨","\\vee",!0);_(S,R,Z,"√","\\surd");_(S,R,Wi,"⟨","\\langle",!0);_(S,R,Wi,"∣","\\lvert");_(S,R,Wi,"∥","\\lVert");_(S,R,ni,"?","?");_(S,R,ni,"!","!");_(S,R,ni,"⟩","\\rangle",!0);_(S,R,ni,"∣","\\rvert");_(S,R,ni,"∥","\\rVert");_(S,R,G,"=","=");_(S,R,G,":",":");_(S,R,G,"≈","\\approx",!0);_(S,R,G,"≅","\\cong",!0);_(S,R,G,"≥","\\ge");_(S,R,G,"≥","\\geq",!0);_(S,R,G,"←","\\gets");_(S,R,G,">","\\gt",!0);_(S,R,G,"∈","\\in",!0);_(S,R,G,"","\\@not");_(S,R,G,"⊂","\\subset",!0);_(S,R,G,"⊃","\\supset",!0);_(S,R,G,"⊆","\\subseteq",!0);_(S,R,G,"⊇","\\supseteq",!0);_(S,V,G,"⊈","\\nsubseteq",!0);_(S,V,G,"⊉","\\nsupseteq",!0);_(S,R,G,"⊨","\\models");_(S,R,G,"←","\\leftarrow",!0);_(S,R,G,"≤","\\le");_(S,R,G,"≤","\\leq",!0);_(S,R,G,"<","\\lt",!0);_(S,R,G,"→","\\rightarrow",!0);_(S,R,G,"→","\\to");_(S,V,G,"≱","\\ngeq",!0);_(S,V,G,"≰","\\nleq",!0);_(S,R,wl," ","\\ ");_(S,R,wl," ","\\space");_(S,R,wl," ","\\nobreakspace");_(Ae,R,wl," ","\\ ");_(Ae,R,wl," "," ");_(Ae,R,wl," ","\\space");_(Ae,R,wl," ","\\nobreakspace");_(S,R,wl,"","\\nobreak");_(S,R,wl,"","\\allowbreak");_(S,R,C0,",",",");_(S,R,C0,";",";");_(S,V,ct,"⊼","\\barwedge",!0);_(S,V,ct,"⊻","\\veebar",!0);_(S,R,ct,"⊙","\\odot",!0);_(S,R,ct,"⊕","\\oplus",!0);_(S,R,ct,"⊗","\\otimes",!0);_(S,R,Z,"∂","\\partial",!0);_(S,R,ct,"⊘","\\oslash",!0);_(S,V,ct,"⊚","\\circledcirc",!0);_(S,V,ct,"⊡","\\boxdot",!0);_(S,R,ct,"△","\\bigtriangleup");_(S,R,ct,"▽","\\bigtriangledown");_(S,R,ct,"†","\\dagger");_(S,R,ct,"⋄","\\diamond");_(S,R,ct,"⋆","\\star");_(S,R,ct,"◃","\\triangleleft");_(S,R,ct,"▹","\\triangleright");_(S,R,Wi,"{","\\{");_(Ae,R,Z,"{","\\{");_(Ae,R,Z,"{","\\textbraceleft");_(S,R,ni,"}","\\}");_(Ae,R,Z,"}","\\}");_(Ae,R,Z,"}","\\textbraceright");_(S,R,Wi,"{","\\lbrace");_(S,R,ni,"}","\\rbrace");_(S,R,Wi,"[","\\lbrack",!0);_(Ae,R,Z,"[","\\lbrack",!0);_(S,R,ni,"]","\\rbrack",!0);_(Ae,R,Z,"]","\\rbrack",!0);_(S,R,Wi,"(","\\lparen",!0);_(S,R,ni,")","\\rparen",!0);_(Ae,R,Z,"<","\\textless",!0);_(Ae,R,Z,">","\\textgreater",!0);_(S,R,Wi,"⌊","\\lfloor",!0);_(S,R,ni,"⌋","\\rfloor",!0);_(S,R,Wi,"⌈","\\lceil",!0);_(S,R,ni,"⌉","\\rceil",!0);_(S,R,Z,"\\","\\backslash");_(S,R,Z,"∣","|");_(S,R,Z,"∣","\\vert");_(Ae,R,Z,"|","\\textbar",!0);_(S,R,Z,"∥","\\|");_(S,R,Z,"∥","\\Vert");_(Ae,R,Z,"∥","\\textbardbl");_(Ae,R,Z,"~","\\textasciitilde");_(Ae,R,Z,"\\","\\textbackslash");_(Ae,R,Z,"^","\\textasciicircum");_(S,R,G,"↑","\\uparrow",!0);_(S,R,G,"⇑","\\Uparrow",!0);_(S,R,G,"↓","\\downarrow",!0);_(S,R,G,"⇓","\\Downarrow",!0);_(S,R,G,"↕","\\updownarrow",!0);_(S,R,G,"⇕","\\Updownarrow",!0);_(S,R,Fr,"∐","\\coprod");_(S,R,Fr,"⋁","\\bigvee");_(S,R,Fr,"⋀","\\bigwedge");_(S,R,Fr,"⨄","\\biguplus");_(S,R,Fr,"⋂","\\bigcap");_(S,R,Fr,"⋃","\\bigcup");_(S,R,Fr,"∫","\\int");_(S,R,Fr,"∫","\\intop");_(S,R,Fr,"∬","\\iint");_(S,R,Fr,"∭","\\iiint");_(S,R,Fr,"∏","\\prod");_(S,R,Fr,"∑","\\sum");_(S,R,Fr,"⨂","\\bigotimes");_(S,R,Fr,"⨁","\\bigoplus");_(S,R,Fr,"⨀","\\bigodot");_(S,R,Fr,"∮","\\oint");_(S,R,Fr,"∯","\\oiint");_(S,R,Fr,"∰","\\oiiint");_(S,R,Fr,"⨆","\\bigsqcup");_(S,R,Fr,"∫","\\smallint");_(Ae,R,zh,"…","\\textellipsis");_(S,R,zh,"…","\\mathellipsis");_(Ae,R,zh,"…","\\ldots",!0);_(S,R,zh,"…","\\ldots",!0);_(S,R,zh,"⋯","\\@cdots",!0);_(S,R,zh,"⋱","\\ddots",!0);_(S,R,Z,"⋮","\\varvdots");_(Ae,R,Z,"⋮","\\varvdots");_(S,R,dr,"ˊ","\\acute");_(S,R,dr,"ˋ","\\grave");_(S,R,dr,"¨","\\ddot");_(S,R,dr,"~","\\tilde");_(S,R,dr,"ˉ","\\bar");_(S,R,dr,"˘","\\breve");_(S,R,dr,"ˇ","\\check");_(S,R,dr,"^","\\hat");_(S,R,dr,"⃗","\\vec");_(S,R,dr,"˙","\\dot");_(S,R,dr,"˚","\\mathring");_(S,R,Lt,"","\\@imath");_(S,R,Lt,"","\\@jmath");_(S,R,Z,"ı","ı");_(S,R,Z,"ȷ","ȷ");_(Ae,R,Z,"ı","\\i",!0);_(Ae,R,Z,"ȷ","\\j",!0);_(Ae,R,Z,"ß","\\ss",!0);_(Ae,R,Z,"æ","\\ae",!0);_(Ae,R,Z,"œ","\\oe",!0);_(Ae,R,Z,"ø","\\o",!0);_(Ae,R,Z,"Æ","\\AE",!0);_(Ae,R,Z,"Œ","\\OE",!0);_(Ae,R,Z,"Ø","\\O",!0);_(Ae,R,dr,"ˊ","\\'");_(Ae,R,dr,"ˋ","\\`");_(Ae,R,dr,"ˆ","\\^");_(Ae,R,dr,"˜","\\~");_(Ae,R,dr,"ˉ","\\=");_(Ae,R,dr,"˘","\\u");_(Ae,R,dr,"˙","\\.");_(Ae,R,dr,"¸","\\c");_(Ae,R,dr,"˚","\\r");_(Ae,R,dr,"ˇ","\\v");_(Ae,R,dr,"¨",'\\"');_(Ae,R,dr,"˝","\\H");_(Ae,R,dr,"◯","\\textcircled");var UR={"--":!0,"---":!0,"``":!0,"''":!0};_(Ae,R,Z,"–","--",!0);_(Ae,R,Z,"–","\\textendash");_(Ae,R,Z,"—","---",!0);_(Ae,R,Z,"—","\\textemdash");_(Ae,R,Z,"‘","`",!0);_(Ae,R,Z,"‘","\\textquoteleft");_(Ae,R,Z,"’","'",!0);_(Ae,R,Z,"’","\\textquoteright");_(Ae,R,Z,"“","``",!0);_(Ae,R,Z,"“","\\textquotedblleft");_(Ae,R,Z,"”","''",!0);_(Ae,R,Z,"”","\\textquotedblright");_(S,R,Z,"°","\\degree",!0);_(Ae,R,Z,"°","\\degree");_(Ae,R,Z,"°","\\textdegree",!0);_(S,R,Z,"£","\\pounds");_(S,R,Z,"£","\\mathsterling",!0);_(Ae,R,Z,"£","\\pounds");_(Ae,R,Z,"£","\\textsterling",!0);_(S,V,Z,"✠","\\maltese");_(Ae,V,Z,"✠","\\maltese");var I7='0123456789/@."';for(var nw=0;nw<I7.length;nw++){var N7=I7.charAt(nw);_(S,R,Z,N7,N7)}var R7='0123456789!@*()-=+";:?/.,';for(var rw=0;rw<R7.length;rw++){var L7=R7.charAt(rw);_(Ae,R,Z,L7,L7)}var A1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var sw=0;sw<A1.length;sw++){var bp=A1.charAt(sw);_(S,R,Lt,bp,bp),_(Ae,R,Z,bp,bp)}_(S,V,Z,"C","ℂ");_(Ae,V,Z,"C","ℂ");_(S,V,Z,"H","ℍ");_(Ae,V,Z,"H","ℍ");_(S,V,Z,"N","ℕ");_(Ae,V,Z,"N","ℕ");_(S,V,Z,"P","ℙ");_(Ae,V,Z,"P","ℙ");_(S,V,Z,"Q","ℚ");_(Ae,V,Z,"Q","ℚ");_(S,V,Z,"R","ℝ");_(Ae,V,Z,"R","ℝ");_(S,V,Z,"Z","ℤ");_(Ae,V,Z,"Z","ℤ");_(S,R,Lt,"h","ℎ");_(Ae,R,Lt,"h","ℎ");var $t;for(var Us=0;Us<A1.length;Us++){var wr=A1.charAt(Us);$t=String.fromCharCode(55349,56320+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56372+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56424+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56580+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56684+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56736+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56788+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56840+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56944+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),Us<26&&($t=String.fromCharCode(55349,56632+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t),$t=String.fromCharCode(55349,56476+Us),_(S,R,Lt,wr,$t),_(Ae,R,Z,wr,$t))}$t="𝕜";_(S,R,Lt,"k",$t);_(Ae,R,Z,"k",$t);for(var Uc=0;Uc<10;Uc++){var Ml=Uc.toString();$t=String.fromCharCode(55349,57294+Uc),_(S,R,Lt,Ml,$t),_(Ae,R,Z,Ml,$t),$t=String.fromCharCode(55349,57314+Uc),_(S,R,Lt,Ml,$t),_(Ae,R,Z,Ml,$t),$t=String.fromCharCode(55349,57324+Uc),_(S,R,Lt,Ml,$t),_(Ae,R,Z,Ml,$t),$t=String.fromCharCode(55349,57334+Uc),_(S,R,Lt,Ml,$t),_(Ae,R,Z,Ml,$t)}var Wv="ÐÞþ";for(var iw=0;iw<Wv.length;iw++){var wp=Wv.charAt(iw);_(S,R,Lt,wp,wp),_(Ae,R,Z,wp,wp)}var Gv={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},j7={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},D7={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},fZ={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},su={mathClass:"",textClass:"",font:""},O7={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},B7={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},P7={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},Kv={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},Yv={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},$7={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},Xv={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},z7=[Gv,Gv,j7,j7,D7,D7,fZ,su,su,su,O7,O7,B7,B7,P7,P7,Kv,Kv,Yv,Yv,$7,$7,su,su,Xv,Xv],mZ=[Gv,su,Kv,Yv,Xv],pZ=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 z7[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return mZ[i]}else{if(r===120485||r===120486)return z7[0];if(120486<r&&r<120782)return su;throw new Oe("Unsupported character: "+e)}},Hy=function(t,n,r){if(ur[r][t]){var s=ur[r][t].replace;s&&(t=s)}return{value:t,metrics:k5(t,n,r)}},Ws=function(t,n,r,s,i){var o=Hy(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 Vi(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 Vi(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},S5=function(t,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&Hy(t,"Main-Bold",n).metrics?Ws(t,"Main-Bold",n,r,s.concat(["mathbf"])):t==="\\"||ur[n][t].font==="main"?Ws(t,"Main-Regular",n,r,s):Ws(t,"AMS-Regular",n,r,s.concat(["amsrm"]))},gZ=function(t,n,r){return r!=="textord"&&Hy(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},Vy=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=pZ(i);m=y.font,p=y[s+"Class"]}if(m)return Ws(i,m,s,n,o.concat(p));if(f){var v,b;if(f==="boldsymbol"){var w=gZ(i,s,r);v=w.fontName,b=[w.fontClass]}else d?(v=Qv[a].fontName,b=[a]):(v=vp(l,c,u),b=[l,c,u]);if(Hy(i,v,s).metrics)return Ws(i,v,s,n,o.concat(b));if(UR.hasOwnProperty(i)&&v.slice(0,10)==="Typewriter"){for(var x=[],k=0;k<i.length;k++)x.push(Ws(i[k],v,s,n,o.concat(b)));return vl(x)}}if(r==="mathord")return Ws(i,"Math-Italic",s,n,o.concat(["mathnormal"]));if(r==="textord"){var T=ur[s][i]&&ur[s][i].font;if(T==="ams"){var A=vp("amsrm",c,u);return Ws(i,A,s,n,o.concat("amsrm",c,u))}else if(T==="main"||!T){var M=vp("textrm",c,u);return Ws(i,M,s,n,o.concat(c,u))}else{var D=vp(T,c,u);return Ws(i,D,s,n,o.concat(D,c,u))}}else throw new Error("unexpected type: "+r+" in makeOrd")},yZ=(e,t)=>{if(wc(e.classes)!==wc(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},HR=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof Vi&&r instanceof Vi&&yZ(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},T5=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},Re=function(t,n,r,s){var i=new $h(t,n,r,s);return T5(i),i},xc=(e,t,n,r)=>new $h(e,t,n,r),mh=function(t,n,r){var s=Re([t],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ue(s.height),s.maxFontSize=1,s},bZ=function(t,n,r,s){var i=new Uy(t,n,r,s);return T5(i),i},vl=function(t){var n=new Ph(t);return T5(n),n},ph=function(t,n){return t instanceof Ph?Re([],[t],n):t},wZ=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}},Mn=function(t,n){for(var{children:r,depth:s}=wZ(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=Re(["pstrut"],[]);c.style.height=Ue(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||[],w=y.wrapperStyle||{},x=Re(b,[c,v],void 0,w);x.style.top=Ue(-i-m-v.depth),y.marginLeft&&(x.style.marginLeft=y.marginLeft),y.marginRight&&(x.style.marginRight=y.marginRight),u.push(x),m+=v.height+v.depth}d=Math.min(d,m),f=Math.max(f,m)}var k=Re(["vlist"],u);k.style.height=Ue(f);var T;if(d<0){var A=Re([],[]),M=Re(["vlist"],[A]);M.style.height=Ue(-d);var D=Re(["vlist-s"],[new Vi("​")]);T=[Re(["vlist-r"],[k,D]),Re(["vlist-r"],[M])]}else T=[Re(["vlist-r"],[k])];var O=Re(["vlist-t"],T);return T.length===2&&O.classes.push("vlist-t2"),O.height=f,O.depth=-d,O},VR=(e,t)=>{var n=Re(["mspace"],[],t),r=pr(e,t);return n.style.marginRight=Ue(r),n},vp=(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},Qv={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"}},WR={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},GR=function(t,n){var[r,s,i]=WR[t],o=new vc(r),a=new hl([o],{width:Ue(s),height:Ue(i),style:"width:"+Ue(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=xc(["overlay"],[a],n);return l.height=i,l.style.height=Ue(i),l.style.width=Ue(s),l},fr={number:3,unit:"mu"},Hc={number:4,unit:"mu"},Ba={number:5,unit:"mu"},vZ={mord:{mop:fr,mbin:Hc,mrel:Ba,minner:fr},mop:{mord:fr,mop:fr,mrel:Ba,minner:fr},mbin:{mord:Hc,mop:Hc,mopen:Hc,minner:Hc},mrel:{mord:Ba,mop:Ba,mopen:Ba,minner:Ba},mopen:{},mclose:{mop:fr,mbin:Hc,mrel:Ba,minner:fr},mpunct:{mord:fr,mop:fr,mrel:Ba,mopen:fr,mclose:fr,mpunct:fr,minner:fr},minner:{mord:fr,mop:fr,mbin:Hc,mrel:Ba,mopen:fr,mpunct:fr,minner:fr}},xZ={mord:{mop:fr},mop:{mord:fr,mop:fr},mbin:{},mrel:{},mopen:{},mclose:{mop:fr},mpunct:{},minner:{mop:fr}},KR={},E1={},M1={};function nt(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)KR[n[l]]=a;t&&(i&&(E1[t]=i),o&&(M1[t]=o))}function Wu(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;nt({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var I1=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},$r=function(t){return t.type==="ordgroup"?t.body:[t]},_Z=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),kZ=new Set(["rightmost","mrel","mclose","mpunct"]),SZ={display:Vt.DISPLAY,text:Vt.TEXT,script:Vt.SCRIPT,scriptscript:Vt.SCRIPTSCRIPT},TZ={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},es=function(t,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=Nn(t[o],n);if(a instanceof Ph){var l=a.children;i.push(...l)}else i.push(a)}if(HR(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(SZ[u.style]))}var d=Re([s[0]||"leftmost"],[],n),f=Re([s[1]||"rightmost"],[],n),m=r==="root";return Jv(i,(p,y)=>{var v=y.classes[0],b=p.classes[0];v==="mbin"&&kZ.has(b)?y.classes[0]="mord":b==="mbin"&&_Z.has(v)&&(p.classes[0]="mord")},{node:d},f,m),Jv(i,(p,y)=>{var v,b,w=ex(y),x=ex(p),k=w&&x?p.hasClass("mtight")?(v=xZ[w])==null?void 0:v[x]:(b=vZ[w])==null?void 0:b[x]:null;if(k)return VR(k,c)},{node:d},f,m),i},Jv=function(t,n,r,s,i){s&&t.push(s);for(var o=0;o<t.length;o++){var a=t[o],l=YR(a);if(l){Jv(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=Re(["leftmost"])),r.insertAfter=(d=>f=>{t.splice(d+1,0,f),o++})(o)}s&&t.pop()},YR=function(t){return t instanceof Ph||t instanceof Uy||t instanceof $h&&t.hasClass("enclosing")?t:null},Zv=function(t,n){var r=YR(t);if(r){var s=r.children;if(s.length){if(n==="right")return Zv(s[s.length-1],"right");if(n==="left")return Zv(s[0],"left")}}return t},ex=function(t,n){if(!t)return null;n&&(t=Zv(t,n));var r=t.classes[0];return TZ[r]||null},qm=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return Re(n.concat(r))},Nn=function(t,n,r){if(!t)return Re();if(E1[t.type]){var s=E1[t.type](t,n);if(r&&n.size!==r.size){s=Re(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Oe("Got group of unknown type: '"+t.type+"'")};function xp(e,t){var n=Re(["base"],e,t),r=Re(["strut"]);return r.style.height=Ue(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ue(-n.depth)),n.children.unshift(r),n}function tx(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=es(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(xp(o,t)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(xp(o,t)),o=[]),i.push(r[a]));o.length>0&&i.push(xp(o,t));var c;n?(c=xp(es(n,t,!0),t),c.classes=["tag"],i.push(c)):s&&i.push(s);var u=Re(["katex-html"],i);if(u.setAttribute("aria-hidden","true"),c){var d=c.children[0];d.style.height=Ue(u.height+u.depth),u.depth&&(d.style.verticalAlign=Ue(-u.depth))}return u}function XR(e){return new Ph(e)}class Pe{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=wc(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof zr&&this.children[r+1]instanceof zr){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof zr;)s+=this.children[++r].toText();t.appendChild(new zr(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+=Ds(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+Ds(wc(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 zr=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return Ds(this.toText())}toText(){return this.text}};class QR{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",Ue(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Ue(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var CZ=new Set(["\\imath","\\jmath"]),AZ=new Set(["mrow","mtable"]),vo=function(t,n,r){return ur[n][t]&&ur[n][t].replace&&t.charCodeAt(0)!==55349&&!(UR.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=ur[n][t].replace),new zr(t)},C5=function(t){return t.length===1?t[0]:new Pe("mrow",t)},EZ={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"},A5=(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=EZ[n];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(CZ.has(i))return null;if(ur[r][i]){var o=ur[r][i].replace;o&&(i=o)}var a=Qv[n].fontName;return k5(i,a,r)?Qv[n].variant:null};function ow(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof zr&&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 zr&&n.text===","}else return!1}var Gi=function(t,n,r){if(t.length===1){var s=Yn(t[0],n);return r&&s instanceof Pe&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,a=0;a<t.length;a++){var l=Yn(t[a],n);if(l instanceof Pe&&o instanceof Pe){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(ow(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&ow(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||ow(o))){var c=l.children[0];c instanceof Pe&&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 zr&&u.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var d=l.children[0];d instanceof zr&&d.text.length>0&&(d.text=d.text.slice(0,1)+"̸"+d.text.slice(1),i.pop())}}}i.push(l),o=l}return i},_c=function(t,n,r){return C5(Gi(t,n,r))},Yn=function(t,n){if(!t)return new Pe("mrow");if(M1[t.type])return M1[t.type](t,n);throw new Oe("Got group of unknown type: '"+t.type+"'")};function F7(e,t,n,r,s){var i=Gi(e,n),o;i.length===1&&i[0]instanceof Pe&&AZ.has(i[0].type)?o=i[0]:o=new Pe("mrow",i);var a=new Pe("annotation",[new zr(t)]);a.setAttribute("encoding","application/x-tex");var l=new Pe("semantics",[o,a]),c=new Pe("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=s?"katex":"katex-mathml";return Re([u],[c])}var MZ=[[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]],q7=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],U7=function(t,n){return n.size<2?t:MZ[t-1][n.size-1]};class Ha{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||Ha.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=q7[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 Ha(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:U7(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:q7[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=U7(Ha.BASESIZE,t);return this.size===n&&this.textSize===Ha.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!==Ha.BASESIZE?["sizing","reset-size"+this.size,"size"+Ha.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=hZ(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ha.BASESIZE=6;var JR=function(t){return new Ha({style:t.displayMode?Vt.DISPLAY:Vt.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},ZR=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=Re(r,[t])}return t},IZ=function(t,n,r){var s=JR(r),i;if(r.output==="mathml")return F7(t,n,s,r.displayMode,!0);if(r.output==="html"){var o=tx(t,s);i=Re(["katex"],[o])}else{var a=F7(t,n,s,r.displayMode,!1),l=tx(t,s);i=Re(["katex"],[a,l])}return ZR(i,r)},NZ=function(t,n,r){var s=JR(r),i=tx(t,s),o=Re(["katex"],[i]);return ZR(o,r)},RZ={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":"="},Wy=function(t){var n=new Pe("mo",[new zr(RZ[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},LZ={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]},jZ=new Set(["widehat","widecheck","widetilde","utilde"]),Gy=function(t,n){function r(){var a=4e5,l=t.label.slice(1);if(jZ.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 vc(d),y=new hl([p],{width:"100%",height:Ue(f),viewBox:"0 0 "+a+" "+u,preserveAspectRatio:"none"});return{span:xc([],[y],n),minWidth:0,height:f}}else{var v=[],b=LZ[l];if(!b)throw new Error('No SVG data for "'+l+'".');var[w,x,k]=b,T=k/1e3,A=w.length,M,D;if(A===1){if(b.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');M=["hide-tail"],D=[b[3]]}else if(A===2)M=["halfarrow-left","halfarrow-right"],D=["xMinYMin","xMaxYMin"];else if(A===3)M=["brace-left","brace-center","brace-right"],D=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+A+" children.");for(var O=0;O<A;O++){var C=new vc(w[O]),L=new hl([C],{width:"400em",height:Ue(T),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:D[O]+" slice"}),I=xc([M[O]],[L],n);if(A===1)return{span:I,minWidth:x,height:T};I.style.height=Ue(T),v.push(I)}return{span:Re(["stretchy"],v,n),minWidth:x,height:T}}}var{span:s,minWidth:i,height:o}=r();return s.height=o,s.style.height=Ue(o),i>0&&(s.style.minWidth=Ue(i)),s},DZ=function(t,n,r,s,i){var o,a=t.height+t.depth+r+s;if(/fbox|color|angl/.test(n)){if(o=Re(["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 Vv({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new Vv({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new hl(c,{width:"100%",height:Ue(a)});o=xc([],[u],i)}return o.height=a,o.style.height=Ue(a),o},OZ={bin:1,close:1,inner:1,open:1,punct:1,rel:1},BZ={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function PZ(e){return e in OZ}function tn(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 Ky(e){var t=Yy(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 Yy(e){return e&&(e.type==="atom"||BZ.hasOwnProperty(e.type))?e:null}var eL=e=>{if(e instanceof Vi)return e;if(dZ(e)&&e.children.length===1)return eL(e.children[0])},E5=(e,t)=>{var n,r,s;e&&e.type==="supsub"?(r=tn(e.base,"accent"),n=r.base,e.base=n,s=uZ(Nn(e,t)),e.base=r):(r=tn(e,"accent"),n=r.base);var i=Nn(n,t.havingCrampedStyle()),o=r.isShifty&&bl(n),a=0;if(o){var l,c;a=(l=(c=eL(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=Gy(r,t),f=Mn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Ue(2*a)+")",marginLeft:Ue(2*a)}:void 0}]});else{var m,p;r.label==="\\vec"?(m=GR("vec",t),p=WR.vec[1]):(m=Vy({mode:r.mode,text:r.label},t,"textord"),m=cZ(m),m.italic=0,p=m.width,u&&(d+=m.depth)),f=Re(["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=Ue(v),r.label==="\\textcircled"&&(f.style.top=".2em"),f=Mn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-d},{type:"elem",elem:f}]})}var b=Re(["mord","accent"],[f],t);return s?(s.children[0]=b,s.height=Math.max(b.height,s.height),s.classes[0]="mord",s):b},tL=(e,t)=>{var n=e.isStretchy?Wy(e.label):new Pe("mo",[vo(e.label,e.mode)]),r=new Pe("mover",[Yn(e.base,t),n]);return r.setAttribute("accent","true"),r},$Z=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));nt({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=I1(t[0]),r=!$Z.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:E5,mathmlBuilder:tL});nt({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:E5,mathmlBuilder:tL});nt({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=Nn(e.base,t),r=Gy(e,t),s=e.label==="\\utilde"?.12:0,i=Mn({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]});return Re(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=Wy(e.label),r=new Pe("munder",[Yn(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var _p=e=>{var t=new Pe("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};nt({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=ph(Nn(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=ph(Nn(e.below,r,t),t),o.classes.push(i+"-arrow-pad"));var a=Gy(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=Mn({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=Mn({positionType:"individualShift",children:[{type:"elem",elem:s,shift:c},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return Re(["mrel","x-arrow"],[u],t)},mathmlBuilder(e,t){var n=Wy(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=_p(Yn(e.body,t));if(e.below){var i=_p(Yn(e.below,t));r=new Pe("munderover",[n,i,s])}else r=new Pe("mover",[n,s])}else if(e.below){var o=_p(Yn(e.below,t));r=new Pe("munder",[n,o])}else r=_p(),r=new Pe("mover",[n,r]);return r}});function nL(e,t){var n=es(e.body,t,!0);return Re([e.mclass],n,t)}function rL(e,t){var n,r=Gi(e.body,t);return e.mclass==="minner"?n=new Pe("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new Pe("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new Pe("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}nt({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:$r(s),isCharacterBox:bl(s)}},htmlBuilder:nL,mathmlBuilder:rL});var Xy=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"};nt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:Xy(t[0]),body:$r(t[1]),isCharacterBox:bl(t[1])}}});nt({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=Xy(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:$r(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:bl(l)}},htmlBuilder:nL,mathmlBuilder:rL});nt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:Xy(t[0]),body:$r(t[0])}},htmlBuilder(e,t){var n=es(e.body,t,!0),r=Re([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=Gi(e.body,t),r=new Pe("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var zZ={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},H7=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),V7=e=>e.type==="textord"&&e.text==="@",FZ=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function qZ(e,t,n){var r=zZ[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 UZ(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 Oe("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;i<t.length;i++){for(var o=t[i],a=H7(),l=0;l<o.length;l++)if(!V7(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=Ky(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(FZ(o[m],c)){f=!1,l=m;break}if(V7(o[m]))throw new Oe("Missing a "+c+" character to complete a CD arrow.",o[m]);u[d].body.push(o[m])}if(f)throw new Oe("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new Oe('Expected one of "<>AV=|." after @',o[l]);var p=qZ(c,u,e),y={type:"styling",body:[p],mode:"math",style:"display",resetFont:!0};r.push(y),a=H7()}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([])}}nt({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=ph(Nn(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=Ue(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new Pe("mrow",[Yn(e.label,t)]);return n=new Pe("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Pe("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});nt({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=ph(Nn(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new Pe("mrow",[Yn(e.fragment,t)])}});nt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=tn(t[0],"ordgroup"),s=r.body,i="",o=0;o<s.length;o++){var a=tn(s[o],"textord");i+=a.text}var l=parseInt(i),c;if(isNaN(l))throw new Oe("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new Oe("\\@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 sL=(e,t)=>{var n=es(e.body,t.withColor(e.color),!1);return vl(n)},iL=(e,t)=>{var n=Gi(e.body,t.withColor(e.color)),r=new Pe("mstyle",n);return r.setAttribute("mathcolor",e.color),r};nt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=tn(t[0],"color-token").color,s=t[1];return{type:"color",mode:n.mode,color:r,body:$r(s)}},htmlBuilder:sL,mathmlBuilder:iL});nt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,s=tn(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:sL,mathmlBuilder:iL});nt({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&&tn(s,"size").value}},htmlBuilder(e,t){var n=Re(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Ue(pr(e.size,t)))),n},mathmlBuilder(e,t){var n=new Pe("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Ue(pr(e.size,t)))),n}});var nx={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},oL=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new Oe("Expected a control sequence",e);return t},HZ=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},aL=(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)};nt({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(nx[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=nx[r.text]),tn(t.parseFunction(),"internal");throw new Oe("Invalid token after macro prefix",r)}});nt({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 Oe("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 Oe('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Oe('Argument number "'+r.text+'" out of order');i++,a.push([])}else{if(r.text==="EOF")throw new Oe("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===nx[n]),{type:"internal",mode:t.mode}}});nt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=oL(t.gullet.popToken());t.gullet.consumeSpaces();var s=HZ(t);return aL(t,r,s,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});nt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=oL(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return aL(t,r,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var Bf=function(t,n,r){var s=ur.math[t]&&ur.math[t].replace,i=k5(s||t,n,r);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},M5=function(t,n,r,s){var i=r.havingBaseStyle(n),o=Re(s.concat(i.sizingClasses(r)),[t],r),a=i.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},lL=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=Ue(i),t.height-=i,t.depth+=i},VZ=function(t,n,r,s,i,o){var a=Ws(t,"Main-Regular",i,s),l=M5(a,n,s,o);return lL(l,s,n),l},WZ=function(t,n,r,s){return Ws(t,"Size"+n+"-Regular",r,s)},cL=function(t,n,r,s,i,o){var a=WZ(t,n,i,s),l=M5(Re(["delimsizing","size"+n],[a],s),Vt.TEXT,s,o);return r&&lL(l,s,Vt.TEXT),l},aw=function(t,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=Re(["delimsizinginner",s],[Re([],[Ws(t,n,r)])]);return{type:"elem",elem:i}},lw=function(t,n,r){var s=ha["Size4-Regular"][t.charCodeAt(0)]?ha["Size4-Regular"][t.charCodeAt(0)][4]:ha["Size1-Regular"][t.charCodeAt(0)][4],i=new vc("inner",nZ(t,Math.round(1e3*n))),o=new hl([i],{width:Ue(s),height:Ue(n),style:"width:"+Ue(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=xc([],[o],r);return a.height=n,a.style.height=Ue(n),a.style.width=Ue(s),{type:"elem",elem:a}},rx=.008,kp={type:"kern",size:-1*rx},GZ=new Set(["|","\\lvert","\\rvert","\\vert"]),KZ=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),uL=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"):GZ.has(t)?(c="∣",d="vert",f=333):KZ.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=Bf(a,m,i),y=p.height+p.depth,v=Bf(c,m,i),b=v.height+v.depth,w=Bf(u,m,i),x=w.height+w.depth,k=0,T=1;if(l!==null){var A=Bf(l,m,i);k=A.height+A.depth,T=2}var M=y+x+k,D=Math.max(0,Math.ceil((n-M)/(T*b))),O=M+D*T*b,C=s.fontMetrics().axisHeight;r&&(C*=s.sizeMultiplier);var L=O/2-C,I=[];if(d.length>0){var B=O-y-x,F=Math.round(O*1e3),W=rZ(d,Math.round(B*1e3)),j=new vc(d,W),K=Ue(f/1e3),J=Ue(F/1e3),ee=new hl([j],{width:K,height:J,viewBox:"0 0 "+f+" "+F}),N=xc([],[ee],s);N.height=F/1e3,N.style.width=K,N.style.height=J,I.push({type:"elem",elem:N})}else{if(I.push(aw(u,m,i)),I.push(kp),l===null){var q=O-y-x+2*rx;I.push(lw(c,q,s))}else{var P=(O-y-x-k)/2+2*rx;I.push(lw(c,P,s)),I.push(kp),I.push(aw(l,m,i)),I.push(kp),I.push(lw(c,P,s))}I.push(kp),I.push(aw(a,m,i))}var E=s.havingBaseStyle(Vt.TEXT),ne=Mn({positionType:"bottom",positionData:L,children:I});return M5(Re(["delimsizing","mult"],[ne],E),Vt.TEXT,s,o)},cw=80,uw=.08,dw=function(t,n,r,s,i){var o=tZ(t,s,r),a=new vc(t,o),l=new hl([a],{width:"400em",height:Ue(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return xc(["hide-tail"],[l],i)},YZ=function(t,n){var r=n.havingBaseSizing(),s=pL("\\surd",t*r.sizeMultiplier,mL,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+cw,t<1?i=1:t<1.4&&(i=.7),l=(1+o+uw)/i,c=(1+o)/i,a=dw("sqrtMain",l,u,o,n),a.style.minWidth="0.853em",d=.833/i):s.type==="large"?(u=(1e3+cw)*fm[s.size],c=(fm[s.size]+o)/i,l=(fm[s.size]+o+uw)/i,a=dw("sqrtSize"+s.size,l,u,o,n),a.style.minWidth="1.02em",d=1/i):(l=t+o+uw,c=t+o,u=Math.floor(1e3*t+o)+cw,a=dw("sqrtTall",l,u,o,n),a.style.minWidth="0.742em",d=1.056),a.height=c,a.style.height=Ue(l),{span:a,advanceWidth:d,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},dL=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),XZ=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),hL=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),fm=[0,1.2,1.8,2.4,3],fL=function(t,n,r,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),dL.has(t)||hL.has(t))return cL(t,n,!1,r,s,i);if(XZ.has(t))return uL(t,fm[n],!1,r,s,i);throw new Oe("Illegal delimiter: '"+t+"'")},QZ=[{type:"small",style:Vt.SCRIPTSCRIPT},{type:"small",style:Vt.SCRIPT},{type:"small",style:Vt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],JZ=[{type:"small",style:Vt.SCRIPTSCRIPT},{type:"small",style:Vt.SCRIPT},{type:"small",style:Vt.TEXT},{type:"stack"}],mL=[{type:"small",style:Vt.SCRIPTSCRIPT},{type:"small",style:Vt.SCRIPT},{type:"small",style:Vt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],ZZ=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.")},pL=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=Bf(t,ZZ(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]},sx=function(t,n,r,s,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;hL.has(t)?a=QZ:dL.has(t)?a=mL:a=JZ;var l=pL(t,n,a,s);return l.type==="small"?VZ(t,l.style,r,s,i,o):l.type==="large"?cL(t,l.size,r,s,i,o):uL(t,n,r,s,i,o)},hw=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 sx(t,d,!0,s,i,o)},W7={"\\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}},eee=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 G7(e){return"isMiddle"in e}function Qy(e,t){var n=Yy(e);if(n&&eee.has(n.text))return n;throw n?new Oe("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new Oe("Invalid delimiter type '"+e.type+"'",e)}nt({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=Qy(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:W7[e.funcName].size,mclass:W7[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?Re([e.mclass]):fL(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push(vo(e.delim,e.mode));var n=new Pe("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ue(fm[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function K7(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}nt({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 Oe("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:Qy(t[0],e).text,color:n}}});nt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Qy(t[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=tn(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{K7(e);for(var n=es(e.body,t,!0,["mopen","mclose"]),r=0,s=0,i=!1,o=0;o<n.length;o++){var a=n[o];G7(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=qm(t,["mopen"]):l=hw(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(G7(u)){var d=u.isMiddle;n[c]=hw(d.delim,r,s,d.options,e.mode,[])}}var f;if(e.right===".")f=qm(t,["mclose"]);else{var m=e.rightColor?t.withColor(e.rightColor):t;f=hw(e.right,r,s,m,e.mode,["mclose"])}return n.push(f),Re(["minner"],n,t)},mathmlBuilder:(e,t)=>{K7(e);var n=Gi(e.body,t);if(e.left!=="."){var r=new Pe("mo",[vo(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var s=new Pe("mo",[vo(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),n.push(s)}return C5(n)}});nt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=Qy(t[0],e);if(!e.parser.leftrightDepth)throw new Oe("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=qm(t,[]):(n=fL(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?vo("|","text"):vo(e.delim,e.mode),r=new Pe("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Jy=(e,t)=>{var n=ph(Nn(e.body,t),t),r=e.label.slice(1),s=t.sizeMultiplier,i,o,a=bl(e.body);if(r==="sout")i=Re(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,o=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var l=pr({number:.6,unit:"pt"},t),c=pr({number:.35,unit:"ex"},t),u=t.havingBaseSizing();s=s/u.sizeMultiplier;var d=n.height+n.depth+l+c;n.style.paddingLeft=Ue(d/2+l);var f=Math.floor(1e3*d*s),m=ZJ(f),p=new hl([new vc("phase",m)],{width:"400em",height:Ue(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});i=xc(["hide-tail"],[p],t),i.style.height=Ue(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=DZ(n,r,y,v,t),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ue(b)):r==="angl"&&b!==.049&&(i.style.borderTopWidth=Ue(b),i.style.borderRightWidth=Ue(b)),o=n.depth+v,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var w;if(e.backgroundColor)w=Mn({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var x=/cancel|phase/.test(r)?["svg-align"]:[];w=Mn({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:x}]})}return/cancel/.test(r)&&(w.height=n.height,w.depth=n.depth),/cancel/.test(r)&&!a?Re(["mord","cancel-lap"],[w],t):Re(["mord"],[w],t)},Zy=(e,t)=>{var n,r=new Pe(e.label.includes("colorbox")?"mpadded":"menclose",[Yn(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: "+Ue(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};nt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=tn(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:Jy,mathmlBuilder:Zy});nt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=tn(t[0],"color-token").color,o=tn(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:Jy,mathmlBuilder:Zy});nt({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]}}});nt({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:Jy,mathmlBuilder:Zy});nt({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:Jy,mathmlBuilder:Zy});nt({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 gL={};function ka(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)gL[n[l]]=a;i&&(E1[t]=i),o&&(M1[t]=o)}var yL={};function $(e,t){yL[e]=t}class fi{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 fi(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class qi{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 qi(n,fi.range(this,t))}}function Y7(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 eb=e=>{var t=e.parser.settings;if(!t.displayMode)throw new Oe("{"+e.envName+"} can be used only in display mode.")},tee=new Set(["gather","gather*"]);function I5(e){if(!e.includes("ed"))return!e.includes("*")}function Dc(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 Oe("Invalid \\arraystretch: "+m)}e.gullet.beginGroup();var p=[],y=[p],v=[],b=[],w=l!=null?[]:void 0;function x(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){w&&(e.gullet.macros.get("\\df@tag")?(w.push(e.subparse([new qi("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):w.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(x(),b.push(Y7(e));;){var T=e.parseExpression(!1,c?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var A={type:"ordgroup",mode:e.mode,body:T};n&&(A={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[A]}),p.push(A);var M=e.fetch().text;if(M==="&"){if(d&&p.length===d){if(c||a)throw new Oe("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(M==="\\end"){k(),p.length===1&&A.type==="styling"&&A.body.length===1&&A.body[0].type==="ordgroup"&&A.body[0].body.length===0&&(y.length>1||!u)&&y.pop(),b.length<y.length+1&&b.push([]);break}else if(M==="\\\\"){e.consume();var D=void 0;e.gullet.future().text!==" "&&(D=e.parseSizeGroup(!0)),v.push(D?D.value:null),k(),b.push(Y7(e)),p=[],y.push(p),x()}else throw new Oe("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:w,leqno:f}}function N5(e){return e.slice(0,1)==="d"?"display":"text"}var Sa=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(Vt.SCRIPT).sizeMultiplier;f=.2778*(m/n.sizeMultiplier)}var p=t.colSeparationType==="CD"?pr({number:3,unit:"ex"},n):12*d,y=3*d,v=t.arraystretch*p,b=.7*v,w=.3*v,x=0;function k(oe){for(var De=0;De<oe.length;++De)De>0&&(x+=.25),c.push({pos:x,isDashed:oe[De]})}for(k(o[0]),r=0;r<t.body.length;++r){var T=t.body[r],A=b,M=w;a<T.length&&(a=T.length);var D={cells:new Array(T.length),height:0,depth:0,pos:0};for(s=0;s<T.length;++s){var O=Nn(T[s],n);M<O.depth&&(M=O.depth),A<O.height&&(A=O.height),D.cells[s]=O}var C=t.rowGaps[r],L=0;C&&(L=pr(C,n),L>0&&(L+=w,M<L&&(M=L),L=0)),t.addJot&&r<t.body.length-1&&(M+=y),D.height=A,D.depth=M,x+=A,D.pos=x,x+=M+L,l[r]=D,k(o[r+1])}var I=x/2+n.fontMetrics().axisHeight,B=t.cols||[],F=[],W,j,K=[];if(t.tags&&t.tags.some(oe=>oe))for(r=0;r<i;++r){var J=l[r],ee=J.pos-I,N=t.tags[r],q=void 0;N===!0?q=Re(["eqn-num"],[],n):N===!1?q=Re([],[],n):q=Re([],es(N,n,!0),n),q.depth=J.depth,q.height=J.height,K.push({type:"elem",elem:q,shift:ee})}for(s=0,j=0;s<a||j<B.length;++s,++j){for(var P,E=B[j],ne=!0;((pe=E)==null?void 0:pe.type)==="separator";){var pe;if(ne||(W=Re(["arraycolsep"],[]),W.style.width=Ue(n.fontMetrics().doubleRuleSep),F.push(W)),E.separator==="|"||E.separator===":"){var be=E.separator==="|"?"solid":"dashed",xe=Re(["vertical-separator"],[],n);xe.style.height=Ue(x),xe.style.borderRightWidth=Ue(u),xe.style.borderRightStyle=be,xe.style.margin="0 "+Ue(-u/2);var we=x-I;we&&(xe.style.verticalAlign=Ue(-we)),F.push(xe)}else throw new Oe("Invalid separator type: "+E.separator);j++,E=B[j],ne=!1}if(!(s>=a)){var de=void 0;if(s>0||t.hskipBeforeAndAfter){var se,ae;de=(se=(ae=E)==null?void 0:ae.pregap)!=null?se:f,de!==0&&(W=Re(["arraycolsep"],[]),W.style.width=Ue(de),F.push(W))}var _e=[];for(r=0;r<i;++r){var qe=l[r],He=qe.cells[s];if(He){var re=qe.pos-I;He.depth=qe.depth,He.height=qe.height,_e.push({type:"elem",elem:He,shift:re})}}var ye=Mn({positionType:"individualShift",children:_e}),Te=Re(["col-align-"+(((P=E)==null?void 0:P.align)||"c")],[ye]);if(F.push(Te),s<a-1||t.hskipBeforeAndAfter){var ke,vt;de=(ke=(vt=E)==null?void 0:vt.postgap)!=null?ke:f,de!==0&&(W=Re(["arraycolsep"],[]),W.style.width=Ue(de),F.push(W))}}}var rt=Re(["mtable"],F);if(c.length>0){for(var Mt=mh("hline",n,u),Pt=mh("hdashline",n,u),Ze=[{type:"elem",elem:rt,shift:0}];c.length>0;){var bt=c.pop(),ft=bt.pos-I;bt.isDashed?Ze.push({type:"elem",elem:Pt,shift:ft}):Ze.push({type:"elem",elem:Mt,shift:ft})}rt=Mn({positionType:"individualShift",children:Ze})}if(K.length===0)return Re(["mord"],[rt],n);var ie=Mn({positionType:"individualShift",children:K}),H=Re(["tag"],[ie],n);return vl([rt,H])},nee={c:"center ",l:"left ",r:"right "},Ta=function(t,n){for(var r=[],s=new Pe("mtd",[],["mtr-glue"]),i=new Pe("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 Pe("mtd",[Yn(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 Pe("mtr",l))}var u=new Pe("mtable",r),d=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);u.setAttribute("rowspacing",Ue(d));var f="",m="";if(t.cols&&t.cols.length>0){var p=t.cols,y="",v=!1,b=0,w=p.length;p[0].type==="separator"&&(f+="top ",b=1),p[p.length-1].type==="separator"&&(f+="bottom ",w-=1);for(var x=b;x<w;x++){var k=p[x];k.type==="align"?(m+=nee[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||[],A="",M=1;M<T.length;M++)A+=M%2?"0em ":"1em ";u.setAttribute("columnspacing",A.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 D="",O=t.hLinesBeforeRow;f+=O[0].length>0?"left ":"",f+=O[O.length-1].length>0?"right ":"";for(var C=1;C<O.length-1;C++)D+=O[C].length===0?"none ":O[C][0]?"dashed ":"solid ";return/[sd]/.test(D)&&u.setAttribute("rowlines",D.trim()),f!==""&&(u=new Pe("menclose",[u]),u.setAttribute("notation",f.trim())),t.arraystretch&&t.arraystretch<1&&(u=new Pe("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},bL=function(t,n){t.envName.includes("ed")||eb(t);var r=[],s=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=Dc(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:I5(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=tn(n[0].body[d],"textord");u+=f.text}a=Number(u),l=a*2}var m=!l;o.body.forEach(function(b){for(var w=1;w<b.length;w+=2){var x=tn(b[w],"styling"),k=tn(x.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 Oe("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};ka({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=Yy(t[0]),r=n?[t[0]]:tn(t[0],"ordgroup").body,s=r.map(function(o){var a=Ky(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 Oe("Unknown column alignment: "+l,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Dc(e.parser,i,N5(e.envName))},htmlBuilder:Sa,mathmlBuilder:Ta});ka({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 Oe("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Dc(e.parser,r,N5(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:Sa,mathmlBuilder:Ta});ka({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=Dc(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:Sa,mathmlBuilder:Ta});ka({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=Yy(t[0]),r=n?[t[0]]:tn(t[0],"ordgroup").body,s=r.map(function(a){var l=Ky(a),c=l.text;if("lc".includes(c))return{type:"align",align:c};throw new Oe("Unknown column alignment: "+c,a)});if(s.length>1)throw new Oe("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=Dc(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new Oe("{subarray} can contain only one column");return o},htmlBuilder:Sa,mathmlBuilder:Ta});ka({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=Dc(e.parser,t,N5(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Sa,mathmlBuilder:Ta});ka({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:bL,htmlBuilder:Sa,mathmlBuilder:Ta});ka({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){tee.has(e.envName)&&eb(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:I5(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return Dc(e.parser,t,"display")},htmlBuilder:Sa,mathmlBuilder:Ta});ka({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:bL,htmlBuilder:Sa,mathmlBuilder:Ta});ka({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){eb(e);var t={autoTag:I5(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return Dc(e.parser,t,"display")},htmlBuilder:Sa,mathmlBuilder:Ta});ka({type:"array",names:["CD"],props:{numArgs:0},handler(e){return eb(e),UZ(e.parser)},htmlBuilder:Sa,mathmlBuilder:Ta});$("\\nonumber","\\gdef\\@eqnsw{0}");$("\\notag","\\nonumber");nt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new Oe(e.funcName+" valid only within array environment")}});var X7=gL;nt({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 Oe("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=tn(s.body[o],"textord").text;if(r==="\\begin"){if(!X7.hasOwnProperty(i))throw new Oe("No such environment: "+i,s);var a=X7[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=tn(n.parseFunction(),"environment");if(m.name!==i)throw new Oe("Mismatch: \\begin{"+i+"} matched by \\end{"+m.name+"}",f);return d}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var wL=(e,t)=>{var n=e.font,r=t.withFont(n);return Nn(e.body,r)},vL=(e,t)=>{var n=e.font,r=t.withFont(n);return Yn(e.body,r)},Q7={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};nt({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=I1(t[0]),i=r;return i in Q7&&(i=Q7[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:wL,mathmlBuilder:vL});nt({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:Xy(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:bl(r)}}});nt({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:wL,mathmlBuilder:vL});var ree=(e,t)=>{var n=t.style,r=n.fracNum(),s=n.fracDen(),i;i=t.havingStyle(r);var o=Nn(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=Nn(e.denom,i,t),u,d,f;e.hasBarLine?(e.barSize?(d=pr(e.barSize,t),u=mh("frac-line",t,d)):u=mh("frac-line",t),d=u.height,f=u.height):(u=null,d=0,f=t.fontMetrics().defaultRuleThickness);var m,p,y;n.size===Vt.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 w=t.fontMetrics().axisHeight;m-o.depth-(w+.5*d)<p&&(m+=p-(m-o.depth-(w+.5*d))),w-.5*d-(c.height-y)<p&&(y+=p-(w-.5*d-(c.height-y)));var x=-(w-.5*d);v=Mn({positionType:"individualShift",children:[{type:"elem",elem:c,shift:y},{type:"elem",elem:u,shift:x},{type:"elem",elem:o,shift:-m}]})}else{var b=m-o.depth-(c.height-y);b<p&&(m+=.5*(p-b),y+=.5*(p-b)),v=Mn({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===Vt.DISPLAY.size?k=t.fontMetrics().delim1:n.size===Vt.SCRIPTSCRIPT.size?k=t.havingStyle(Vt.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var T,A;return e.leftDelim==null?T=qm(t,["mopen"]):T=sx(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?A=Re([]):e.rightDelim==null?A=qm(t,["mclose"]):A=sx(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),Re(["mord"].concat(i.sizingClasses(t)),[T,Re(["mfrac"],[v]),A],t)},see=(e,t)=>{var n=new Pe("mfrac",[Yn(e.numer,t),Yn(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=pr(e.barSize,t);n.setAttribute("linethickness",Ue(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new Pe("mo",[new zr(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(n),e.rightDelim!=null){var o=new Pe("mo",[new zr(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return C5(s)}return n},xL=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};nt({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"),xL({type:"genfrac",mode:n.mode,numer:s,denom:i,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},u)},htmlBuilder:ree,mathmlBuilder:see});nt({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 J7=["display","text","script","scriptscript"],Z7=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};nt({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=I1(t[0]),o=i.type==="atom"&&i.family==="open"?Z7(i.text):null,a=I1(t[1]),l=a.type==="atom"&&a.family==="close"?Z7(a.text):null,c=tn(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=tn(m.body[0],"textord");f=J7[Number(p.text)]}}else m=tn(m,"textord"),f=J7[Number(m.text)];return xL({type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:u,barSize:d,leftDelim:o,rightDelim:l},f)}});nt({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:tn(t[0],"size").value,token:s}}});nt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=tn(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 _L=(e,t)=>{var n=t.style,r,s;e.type==="supsub"?(r=e.sup?Nn(e.sup,t.havingStyle(n.sup()),t):Nn(e.sub,t.havingStyle(n.sub()),t),s=tn(e.base,"horizBrace")):s=tn(e,"horizBrace");var i=Nn(s.base,t.havingBaseStyle(Vt.DISPLAY)),o=Gy(s,t),a;if(s.isOver?a=Mn({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=Mn({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=Re(["minner",s.isOver?"mover":"munder"],[a],t);s.isOver?a=Mn({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Mn({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Re(["minner",s.isOver?"mover":"munder"],[a],t)},iee=(e,t)=>{var n=Wy(e.label);return new Pe(e.isOver?"mover":"munder",[Yn(e.base,t),n])};nt({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:_L,mathmlBuilder:iee});nt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],s=tn(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:$r(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=es(e.body,t,!1);return bZ(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=_c(e.body,t);return n instanceof Pe||(n=new Pe("mrow",[n])),n.setAttribute("href",e.href),n}});nt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=tn(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:$r(a)}}});nt({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:$r(t[0])}},htmlBuilder(e,t){var n=es(e.body,t.withFont(""),!1);return vl(n)},mathmlBuilder(e,t){return new Pe("mrow",Gi(e.body,t.withFont("")))}});nt({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=tn(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 Oe("\\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:$r(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=es(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=Re(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)=>_c(e.body,t)});nt({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:$r(t[0]),mathml:$r(t[1])}},htmlBuilder:(e,t)=>{var n=es(e.html,t,!1);return vl(n)},mathmlBuilder:(e,t)=>_c(e.mathml,t)});var fw=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 Oe("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!PR(r))throw new Oe("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};nt({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=tn(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=fw(f);break;case"height":i=fw(f);break;case"totalheight":o=fw(f);break;default:throw new Oe("Invalid key: '"+d[0]+"' in \\includegraphics.")}}}var m=tn(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=pr(e.height,t),r=0;e.totalheight.number>0&&(r=pr(e.totalheight,t)-n);var s=0;e.width.number>0&&(s=pr(e.width,t));var i={height:Ue(n+r)};s>0&&(i.width=Ue(s)),r>0&&(i.verticalAlign=Ue(-r));var o=new aZ(e.src,e.alt,i);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new Pe("mglyph",[]);n.setAttribute("alt",e.alt);var r=pr(e.height,t),s=0;if(e.totalheight.number>0&&(s=pr(e.totalheight,t)-r,n.setAttribute("valign",Ue(-s))),n.setAttribute("height",Ue(r+s)),e.width.number>0){var i=pr(e.width,t);n.setAttribute("width",Ue(i))}return n.setAttribute("src",e.src),n}});nt({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=tn(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 VR(e.dimension,t)},mathmlBuilder(e,t){var n=pr(e.dimension,t);return new QR(n)}});nt({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=Re([],[Nn(e.body,t)]),n=Re(["inner"],[n],t)):n=Re(["inner"],[Nn(e.body,t)]);var r=Re(["fix"],[]),s=Re([e.alignment],[n,r],t),i=Re(["strut"]);return i.style.height=Ue(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ue(-s.depth)),s.children.unshift(i),s=Re(["thinbox"],[s],t),Re(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Pe("mpadded",[Yn(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}});nt({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}}});nt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new Oe("Mismatched "+e.funcName)}});var e9=(e,t)=>{switch(t.style.size){case Vt.DISPLAY.size:return e.display;case Vt.TEXT.size:return e.text;case Vt.SCRIPT.size:return e.script;case Vt.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};nt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:$r(t[0]),text:$r(t[1]),script:$r(t[2]),scriptscript:$r(t[3])}},htmlBuilder:(e,t)=>{var n=e9(e,t),r=es(n,t,!1);return vl(r)},mathmlBuilder:(e,t)=>{var n=e9(e,t);return _c(n,t)}});var kL=(e,t,n,r,s,i,o)=>{e=Re([],[e]);var a=n&&bl(n),l,c;if(t){var u=Nn(t,r.havingStyle(s.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(n){var d=Nn(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=Mn({positionType:"bottom",positionData:m,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ue(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ue(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var p=e.height-o;f=Mn({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Ue(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(c){var y=e.depth+o;f=Mn({positionType:"bottom",positionData:y,children:[{type:"elem",elem:e},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Ue(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var v=[f];if(l&&i!==0&&!a){var b=Re(["mspace"],[],r);b.style.marginRight=Ue(i),v.unshift(b)}return Re(["mop","op-limits"],v,r)},SL=new Set(["\\smallint"]),Fh=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=tn(e.base,"op"),s=!0):i=tn(e,"op");var o=t.style,a=!1;o.size===Vt.DISPLAY.size&&i.symbol&&!SL.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=Ws(i.name,u,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),c=l.italic,d.length>0){var f=GR(d+"Size"+(a?"2":"1"),t);l=Mn({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=es(i.body,t,!0);m.length===1&&m[0]instanceof Vi?(l=m[0],l.classes[0]="mop"):l=Re(["mop"],m,t)}else{for(var p=[],y=1;y<i.name.length;y++)p.push(S5(i.name[y],i.mode,t));l=Re(["mop"],p,t)}var v=0,b=0;if((l instanceof Vi||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var w;v=(l.height-l.depth)/2-t.fontMetrics().axisHeight,b=(w=l.italic)!=null?w:0}return s?kL(l,n,r,t,o,b,v):(v&&(l.style.position="relative",l.style.top=Ue(v)),l)},A0=(e,t)=>{var n;if(e.symbol)n=new Pe("mo",[vo(e.name,e.mode)]),SL.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new Pe("mo",Gi(e.body,t));else{n=new Pe("mi",[new zr(e.name.slice(1))]);var r=new Pe("mo",[vo("⁡","text")]);e.parentIsSupSub?n=new Pe("mrow",[n,r]):n=XR([n,r])}return n},oee={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};nt({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=oee[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Fh,mathmlBuilder:A0});nt({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:$r(r)}},htmlBuilder:Fh,mathmlBuilder:A0});var aee={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};nt({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:Fh,mathmlBuilder:A0});nt({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:Fh,mathmlBuilder:A0});nt({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=aee[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Fh,mathmlBuilder:A0});var TL=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=tn(e.base,"operatorname"),s=!0):i=tn(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=es(a,t.withFont("mathrm"),!0),c=0;c<l.length;c++){var u=l[c];u instanceof Vi&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Re(["mop"],l,t)}else o=Re(["mop"],[],t);return s?kL(o,n,r,t,t.style,0,0):o},lee=(e,t)=>{for(var n=Gi(e.body,t.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof QR))if(i instanceof Pe)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 zr?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 zr(a)]}var l=new Pe("mi",n);l.setAttribute("mathvariant","normal");var c=new Pe("mo",[vo("⁡","text")]);return e.parentIsSupSub?new Pe("mrow",[l,c]):XR([l,c])};nt({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:$r(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:TL,mathmlBuilder:lee});$("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Wu({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?vl(es(e.body,t,!1)):Re(["mord"],es(e.body,t,!0),t)},mathmlBuilder(e,t){return _c(e.body,t,!0)}});nt({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=Nn(e.body,t.havingCrampedStyle()),r=mh("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=Mn({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return Re(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new Pe("mo",[new zr("‾")]);n.setAttribute("stretchy","true");var r=new Pe("mover",[Yn(e.body,t),n]);return r.setAttribute("accent","true"),r}});nt({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:$r(r)}},htmlBuilder:(e,t)=>{var n=es(e.body,t.withPhantom(),!1);return vl(n)},mathmlBuilder:(e,t)=>{var n=Gi(e.body,t);return new Pe("mphantom",n)}});$("\\hphantom","\\smash{\\phantom{#1}}");nt({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=Re(["inner"],[Nn(e.body,t.withPhantom())]),r=Re(["fix"],[]);return Re(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=Gi($r(e.body),t),r=new Pe("mphantom",n),s=new Pe("mpadded",[r]);return s.setAttribute("width","0px"),s}});nt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=tn(t[0],"size").value,s=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(e,t){var n=Nn(e.body,t),r=pr(e.dy,t);return Mn({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Pe("mpadded",[Yn(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});nt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});nt({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=tn(t[0],"size"),o=tn(t[1],"size");return{type:"rule",mode:r.mode,shift:s&&tn(s,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=Re(["mord","rule"],[],t),r=pr(e.width,t),s=pr(e.height,t),i=e.shift?pr(e.shift,t):0;return n.style.borderRightWidth=Ue(r),n.style.borderTopWidth=Ue(s),n.style.bottom=Ue(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=pr(e.width,t),r=pr(e.height,t),s=e.shift?pr(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new Pe("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Ue(n)),o.setAttribute("height",Ue(r));var a=new Pe("mpadded",[o]);return s>=0?a.setAttribute("height",Ue(s)):(a.setAttribute("height",Ue(s)),a.setAttribute("depth",Ue(-s))),a.setAttribute("voffset",Ue(s)),a}});function CL(e,t,n){for(var r=es(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 vl(r)}var t9=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],cee=(e,t)=>{var n=t.havingSize(e.size);return CL(e.body,n,t)};nt({type:"sizing",names:t9,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:t9.indexOf(r)+1,body:i}},htmlBuilder:cee,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=Gi(e.body,n),s=new Pe("mstyle",r);return s.setAttribute("mathsize",Ue(n.sizeMultiplier)),s}});nt({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]&&tn(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var c=o.body[l];if(a=Ky(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=Re([],[Nn(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 Re(["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=Mn({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Re(["mord"],[s],t)},mathmlBuilder:(e,t)=>{var n=new Pe("mpadded",[Yn(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});nt({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=Nn(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=ph(n,t);var r=t.fontMetrics(),s=r.defaultRuleThickness,i=s;t.style.id<Vt.TEXT.id&&(i=t.fontMetrics().xHeight);var o=s+i/4,a=n.height+n.depth+o+s,{span:l,ruleWidth:c,advanceWidth:u}=YZ(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=Ue(u);var m=Mn({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(Vt.SCRIPTSCRIPT),y=Nn(e.index,p,t),v=.6*(m.height-m.depth),b=Mn({positionType:"shift",positionData:-v,children:[{type:"elem",elem:y}]}),w=Re(["root"],[b]);return Re(["mord","sqrt"],[w,m],t)}else return Re(["mord","sqrt"],[m],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new Pe("mroot",[Yn(n,t),Yn(r,t)]):new Pe("msqrt",[Yn(n,t)])}});var ix={display:Vt.DISPLAY,text:Vt.TEXT,script:Vt.SCRIPT,scriptscript:Vt.SCRIPTSCRIPT};function uee(e){return e in ix}nt({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(!uee(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(e,t){var n=ix[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),CL(e.body,r,t)},mathmlBuilder(e,t){var n=ix[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var s=Gi(e.body,r),i=new Pe("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 dee=function(t,n){var r=t.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===Vt.DISPLAY.size||r.alwaysHandleSupSub);return s?Fh:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===Vt.DISPLAY.size||r.limits);return i?TL:null}else{if(r.type==="accent")return bl(r.base)?E5:null;if(r.type==="horizBrace"){var o=!t.sub;return o===r.isOver?_L:null}else return null}else return null};Wu({type:"supsub",htmlBuilder(e,t){var n=dee(e,t);if(n)return n(e,t);var{base:r,sup:s,sub:i}=e,o=Nn(r,t),a,l,c=t.fontMetrics(),u=0,d=0,f=r&&bl(r);if(s){var m=t.havingStyle(t.style.sup());a=Nn(s,m,t),f||(u=o.height-m.fontMetrics().supDrop*m.sizeMultiplier/t.sizeMultiplier)}if(i){var p=t.havingStyle(t.style.sub());l=Nn(i,p,t),f||(d=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/t.sizeMultiplier)}var y;t.style===Vt.DISPLAY?y=c.sup1:t.style.cramped?y=c.sup3:y=c.sup2;var v=t.sizeMultiplier,b=Ue(.5/c.ptPerEm/v),w=null;if(l){var x=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof Vi||x){var k;w=Ue(-((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 A=c.defaultRuleThickness,M=4*A;if(u-a.depth-(l.height-d)<M){d=M-(u-a.depth)+l.height;var D=.8*c.xHeight-(u-a.depth);D>0&&(u+=D,d-=D)}var O=[{type:"elem",elem:l,shift:d,marginRight:b,marginLeft:w},{type:"elem",elem:a,shift:-u,marginRight:b}];T=Mn({positionType:"individualShift",children:O})}else if(l){d=Math.max(d,c.sub1,l.height-.8*c.xHeight);var C=[{type:"elem",elem:l,marginLeft:w,marginRight:b}];T=Mn({positionType:"shift",positionData:d,children:C})}else if(a)u=Math.max(u,y,a.depth+.25*c.xHeight),T=Mn({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:b}]});else throw new Error("supsub must have either sup or sub.");var L=ex(o,"right")||"mord";return Re([L],[o,Re(["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=[Yn(e.base,t)];e.sub&&i.push(Yn(e.sub,t)),e.sup&&i.push(Yn(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===Vt.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(t.style===Vt.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===Vt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===Vt.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===Vt.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===Vt.DISPLAY)?o="mover":o="msup"}return new Pe(o,i)}});Wu({type:"atom",htmlBuilder(e,t){return S5(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new Pe("mo",[vo(e.text,e.mode)]);if(e.family==="bin"){var r=A5(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 AL={mi:"italic",mn:"normal",mtext:"normal"};Wu({type:"mathord",htmlBuilder(e,t){return Vy(e,t,"mathord")},mathmlBuilder(e,t){var n=new Pe("mi",[vo(e.text,e.mode,t)]),r=A5(e,t)||"italic";return r!==AL[n.type]&&n.setAttribute("mathvariant",r),n}});Wu({type:"textord",htmlBuilder(e,t){return Vy(e,t,"textord")},mathmlBuilder(e,t){var n=vo(e.text,e.mode,t),r=A5(e,t)||"normal",s;return e.mode==="text"?s=new Pe("mtext",[n]):/[0-9]/.test(e.text)?s=new Pe("mn",[n]):e.text==="\\prime"?s=new Pe("mo",[n]):s=new Pe("mi",[n]),r!==AL[s.type]&&s.setAttribute("mathvariant",r),s}});var mw={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},pw={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Wu({type:"spacing",htmlBuilder(e,t){if(pw.hasOwnProperty(e.text)){var n=pw[e.text].className||"";if(e.mode==="text"){var r=Vy(e,t,"textord");return r.classes.push(n),r}else return Re(["mspace",n],[S5(e.text,e.mode,t)],t)}else{if(mw.hasOwnProperty(e.text))return Re(["mspace",mw[e.text]],[],t);throw new Oe('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(pw.hasOwnProperty(e.text))n=new Pe("mtext",[new zr(" ")]);else{if(mw.hasOwnProperty(e.text))return new Pe("mspace");throw new Oe('Unknown type of space "'+e.text+'"')}return n}});var n9=()=>{var e=new Pe("mtd",[]);return e.setAttribute("width","50%"),e};Wu({type:"tag",mathmlBuilder(e,t){var n=new Pe("mtable",[new Pe("mtr",[n9(),new Pe("mtd",[_c(e.body,t)]),n9(),new Pe("mtd",[_c(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var r9={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},s9={"\\textbf":"textbf","\\textmd":"textmd"},hee={"\\textit":"textit","\\textup":"textup"},i9=(e,t)=>{var n=e.font;if(n){if(r9[n])return t.withTextFontFamily(r9[n]);if(s9[n])return t.withTextFontWeight(s9[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(hee[n])};nt({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:$r(s),font:r}},htmlBuilder(e,t){var n=i9(e,t),r=es(e.body,n,!0);return Re(["mord","text"],r,n)},mathmlBuilder(e,t){var n=i9(e,t);return _c(e.body,n)}});nt({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=Nn(e.body,t),r=mh("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=Mn({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]});return Re(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new Pe("mo",[new zr("‾")]);n.setAttribute("stretchy","true");var r=new Pe("munder",[Yn(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});nt({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=Nn(e.body,t),r=t.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return Mn({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new Pe("mpadded",[Yn(e.body,t)],["vcenter"]);return new Pe("mrow",[n])}});nt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new Oe("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=o9(e),r=[],s=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),r.push(Ws(o,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return Re(["mord","text"].concat(s.sizingClasses(t)),HR(r),s)},mathmlBuilder(e,t){var n=new zr(o9(e)),r=new Pe("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var o9=e=>e.body.replace(/ /g,e.star?"␣":" "),Jl=KR,EL=`[ \r
	]`,fee="\\\\[a-zA-Z@]+",mee="\\\\[^\uD800-\uDFFF]",pee="("+fee+")"+EL+"*",gee=`\\\\(
|[ \r	]+
?)[ \r	]*`,ox="[̀-ͯ]",yee=new RegExp(ox+"+$"),bee="("+EL+"+)|"+(gee+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(ox+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(ox+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+pee)+("|"+mee+")");class a9{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(bee,"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 qi("EOF",new fi(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new Oe("Unexpected character: '"+t[n]+"'",new qi(t[n],new fi(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 qi(s,new fi(this,n,this.tokenRegex.lastIndex))}}class wee{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 Oe("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 vee=yL;$("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});$("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});$("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});$("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});$("\\@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}});$("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");$("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var l9={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};$("\\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 Oe("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=l9[t.text],r==null||r>=n)throw new Oe("Invalid base-"+n+" digit "+t.text);for(var s;(s=l9[e.future().text])!=null&&s<n;)r*=n,r+=s,e.popToken()}return"\\@char{"+r+"}"});var R5=(e,t,n,r)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new Oe("\\newcommand's first argument must be a macro name");var i=s[0].text,o=e.isDefined(i);if(o&&!t)throw new Oe("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new Oe("\\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 Oe("Invalid number of arguments: "+l);a=parseInt(l),s=e.consumeArg().tokens}return o&&r||e.macros.set(i,{tokens:s,numArgs:a}),""};$("\\newcommand",e=>R5(e,!1,!0,!1));$("\\renewcommand",e=>R5(e,!0,!1,!1));$("\\providecommand",e=>R5(e,!0,!0,!0));$("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});$("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});$("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),Jl[n],ur.math[n],ur.text[n]),""});$("\\bgroup","{");$("\\egroup","}");$("~","\\nobreakspace");$("\\lq","`");$("\\rq","'");$("\\aa","\\r a");$("\\AA","\\r A");$("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");$("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");$("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");$("ℬ","\\mathscr{B}");$("ℰ","\\mathscr{E}");$("ℱ","\\mathscr{F}");$("ℋ","\\mathscr{H}");$("ℐ","\\mathscr{I}");$("ℒ","\\mathscr{L}");$("ℳ","\\mathscr{M}");$("ℛ","\\mathscr{R}");$("ℭ","\\mathfrak{C}");$("ℌ","\\mathfrak{H}");$("ℨ","\\mathfrak{Z}");$("\\Bbbk","\\Bbb{k}");$("\\llap","\\mathllap{\\textrm{#1}}");$("\\rlap","\\mathrlap{\\textrm{#1}}");$("\\clap","\\mathclap{\\textrm{#1}}");$("\\mathstrut","\\vphantom{(}");$("\\underbar","\\underline{\\text{#1}}");$("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');$("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");$("\\ne","\\neq");$("≠","\\neq");$("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");$("∉","\\notin");$("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");$("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");$("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");$("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");$("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");$("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");$("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");$("⟂","\\perp");$("‼","\\mathclose{!\\mkern-0.8mu!}");$("∌","\\notni");$("⌜","\\ulcorner");$("⌝","\\urcorner");$("⌞","\\llcorner");$("⌟","\\lrcorner");$("©","\\copyright");$("®","\\textregistered");$("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');$("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');$("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');$("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');$("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");$("⋮","\\vdots");$("\\varGamma","\\mathit{\\Gamma}");$("\\varDelta","\\mathit{\\Delta}");$("\\varTheta","\\mathit{\\Theta}");$("\\varLambda","\\mathit{\\Lambda}");$("\\varXi","\\mathit{\\Xi}");$("\\varPi","\\mathit{\\Pi}");$("\\varSigma","\\mathit{\\Sigma}");$("\\varUpsilon","\\mathit{\\Upsilon}");$("\\varPhi","\\mathit{\\Phi}");$("\\varPsi","\\mathit{\\Psi}");$("\\varOmega","\\mathit{\\Omega}");$("\\substack","\\begin{subarray}{c}#1\\end{subarray}");$("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");$("\\boxed","\\fbox{$\\displaystyle{#1}$}");$("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");$("\\implies","\\DOTSB\\;\\Longrightarrow\\;");$("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");$("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");$("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var c9={",":"\\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"},xee=new Set(["bin","rel"]);$("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in c9?t=c9[n]:(n.slice(0,4)==="\\not"||n in ur.math&&xee.has(ur.math[n].group))&&(t="\\dotsb"),t});var L5={")":!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};$("\\dotso",function(e){var t=e.future().text;return t in L5?"\\ldots\\,":"\\ldots"});$("\\dotsc",function(e){var t=e.future().text;return t in L5&&t!==","?"\\ldots\\,":"\\ldots"});$("\\cdots",function(e){var t=e.future().text;return t in L5?"\\@cdots\\,":"\\@cdots"});$("\\dotsb","\\cdots");$("\\dotsm","\\cdots");$("\\dotsi","\\!\\cdots");$("\\dotsx","\\ldots\\,");$("\\DOTSI","\\relax");$("\\DOTSB","\\relax");$("\\DOTSX","\\relax");$("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");$("\\,","\\tmspace+{3mu}{.1667em}");$("\\thinspace","\\,");$("\\>","\\mskip{4mu}");$("\\:","\\tmspace+{4mu}{.2222em}");$("\\medspace","\\:");$("\\;","\\tmspace+{5mu}{.2777em}");$("\\thickspace","\\;");$("\\!","\\tmspace-{3mu}{.1667em}");$("\\negthinspace","\\!");$("\\negmedspace","\\tmspace-{4mu}{.2222em}");$("\\negthickspace","\\tmspace-{5mu}{.277em}");$("\\enspace","\\kern.5em ");$("\\enskip","\\hskip.5em\\relax");$("\\quad","\\hskip1em\\relax");$("\\qquad","\\hskip2em\\relax");$("\\tag","\\@ifstar\\tag@literal\\tag@paren");$("\\tag@paren","\\tag@literal{({#1})}");$("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new Oe("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});$("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");$("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");$("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");$("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");$("\\newline","\\\\\\relax");$("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var ML=Ue(ha["Main-Regular"][84][1]-.7*ha["Main-Regular"][65][1]);$("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+ML+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");$("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+ML+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");$("\\hspace","\\@ifstar\\@hspacer\\@hspace");$("\\@hspace","\\hskip #1\\relax");$("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");$("\\ordinarycolon",":");$("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");$("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');$("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');$("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');$("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');$("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');$("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');$("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');$("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');$("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');$("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');$("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');$("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');$("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');$("∷","\\dblcolon");$("∹","\\eqcolon");$("≔","\\coloneqq");$("≕","\\eqqcolon");$("⩴","\\Coloneqq");$("\\ratio","\\vcentcolon");$("\\coloncolon","\\dblcolon");$("\\colonequals","\\coloneqq");$("\\coloncolonequals","\\Coloneqq");$("\\equalscolon","\\eqqcolon");$("\\equalscoloncolon","\\Eqqcolon");$("\\colonminus","\\coloneq");$("\\coloncolonminus","\\Coloneq");$("\\minuscolon","\\eqcolon");$("\\minuscoloncolon","\\Eqcolon");$("\\coloncolonapprox","\\Colonapprox");$("\\coloncolonsim","\\Colonsim");$("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");$("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");$("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");$("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");$("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");$("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");$("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");$("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");$("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");$("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");$("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");$("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");$("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");$("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");$("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");$("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");$("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");$("\\nleqq","\\html@mathml{\\@nleqq}{≰}");$("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");$("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");$("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");$("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");$("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");$("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");$("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");$("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");$("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");$("\\imath","\\html@mathml{\\@imath}{ı}");$("\\jmath","\\html@mathml{\\@jmath}{ȷ}");$("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");$("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");$("⟦","\\llbracket");$("⟧","\\rrbracket");$("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");$("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");$("⦃","\\lBrace");$("⦄","\\rBrace");$("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");$("⦵","\\minuso");$("\\darr","\\downarrow");$("\\dArr","\\Downarrow");$("\\Darr","\\Downarrow");$("\\lang","\\langle");$("\\rang","\\rangle");$("\\uarr","\\uparrow");$("\\uArr","\\Uparrow");$("\\Uarr","\\Uparrow");$("\\N","\\mathbb{N}");$("\\R","\\mathbb{R}");$("\\Z","\\mathbb{Z}");$("\\alef","\\aleph");$("\\alefsym","\\aleph");$("\\Alpha","\\mathrm{A}");$("\\Beta","\\mathrm{B}");$("\\bull","\\bullet");$("\\Chi","\\mathrm{X}");$("\\clubs","\\clubsuit");$("\\cnums","\\mathbb{C}");$("\\Complex","\\mathbb{C}");$("\\Dagger","\\ddagger");$("\\diamonds","\\diamondsuit");$("\\empty","\\emptyset");$("\\Epsilon","\\mathrm{E}");$("\\Eta","\\mathrm{H}");$("\\exist","\\exists");$("\\harr","\\leftrightarrow");$("\\hArr","\\Leftrightarrow");$("\\Harr","\\Leftrightarrow");$("\\hearts","\\heartsuit");$("\\image","\\Im");$("\\infin","\\infty");$("\\Iota","\\mathrm{I}");$("\\isin","\\in");$("\\Kappa","\\mathrm{K}");$("\\larr","\\leftarrow");$("\\lArr","\\Leftarrow");$("\\Larr","\\Leftarrow");$("\\lrarr","\\leftrightarrow");$("\\lrArr","\\Leftrightarrow");$("\\Lrarr","\\Leftrightarrow");$("\\Mu","\\mathrm{M}");$("\\natnums","\\mathbb{N}");$("\\Nu","\\mathrm{N}");$("\\Omicron","\\mathrm{O}");$("\\plusmn","\\pm");$("\\rarr","\\rightarrow");$("\\rArr","\\Rightarrow");$("\\Rarr","\\Rightarrow");$("\\real","\\Re");$("\\reals","\\mathbb{R}");$("\\Reals","\\mathbb{R}");$("\\Rho","\\mathrm{P}");$("\\sdot","\\cdot");$("\\sect","\\S");$("\\spades","\\spadesuit");$("\\sub","\\subset");$("\\sube","\\subseteq");$("\\supe","\\supseteq");$("\\Tau","\\mathrm{T}");$("\\thetasym","\\vartheta");$("\\weierp","\\wp");$("\\Zeta","\\mathrm{Z}");$("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");$("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");$("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");$("\\bra","\\mathinner{\\langle{#1}|}");$("\\ket","\\mathinner{|{#1}\\rangle}");$("\\braket","\\mathinner{\\langle{#1}\\rangle}");$("\\Bra","\\left\\langle#1\\right|");$("\\Ket","\\left|#1\\right\\rangle");var IL=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}};$("\\bra@ket",IL(!1));$("\\bra@set",IL(!0));$("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");$("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");$("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");$("\\angln","{\\angl n}");$("\\blue","\\textcolor{##6495ed}{#1}");$("\\orange","\\textcolor{##ffa500}{#1}");$("\\pink","\\textcolor{##ff00af}{#1}");$("\\red","\\textcolor{##df0030}{#1}");$("\\green","\\textcolor{##28ae7b}{#1}");$("\\gray","\\textcolor{gray}{#1}");$("\\purple","\\textcolor{##9d38bd}{#1}");$("\\blueA","\\textcolor{##ccfaff}{#1}");$("\\blueB","\\textcolor{##80f6ff}{#1}");$("\\blueC","\\textcolor{##63d9ea}{#1}");$("\\blueD","\\textcolor{##11accd}{#1}");$("\\blueE","\\textcolor{##0c7f99}{#1}");$("\\tealA","\\textcolor{##94fff5}{#1}");$("\\tealB","\\textcolor{##26edd5}{#1}");$("\\tealC","\\textcolor{##01d1c1}{#1}");$("\\tealD","\\textcolor{##01a995}{#1}");$("\\tealE","\\textcolor{##208170}{#1}");$("\\greenA","\\textcolor{##b6ffb0}{#1}");$("\\greenB","\\textcolor{##8af281}{#1}");$("\\greenC","\\textcolor{##74cf70}{#1}");$("\\greenD","\\textcolor{##1fab54}{#1}");$("\\greenE","\\textcolor{##0d923f}{#1}");$("\\goldA","\\textcolor{##ffd0a9}{#1}");$("\\goldB","\\textcolor{##ffbb71}{#1}");$("\\goldC","\\textcolor{##ff9c39}{#1}");$("\\goldD","\\textcolor{##e07d10}{#1}");$("\\goldE","\\textcolor{##a75a05}{#1}");$("\\redA","\\textcolor{##fca9a9}{#1}");$("\\redB","\\textcolor{##ff8482}{#1}");$("\\redC","\\textcolor{##f9685d}{#1}");$("\\redD","\\textcolor{##e84d39}{#1}");$("\\redE","\\textcolor{##bc2612}{#1}");$("\\maroonA","\\textcolor{##ffbde0}{#1}");$("\\maroonB","\\textcolor{##ff92c6}{#1}");$("\\maroonC","\\textcolor{##ed5fa6}{#1}");$("\\maroonD","\\textcolor{##ca337c}{#1}");$("\\maroonE","\\textcolor{##9e034e}{#1}");$("\\purpleA","\\textcolor{##ddd7ff}{#1}");$("\\purpleB","\\textcolor{##c6b9fc}{#1}");$("\\purpleC","\\textcolor{##aa87ff}{#1}");$("\\purpleD","\\textcolor{##7854ab}{#1}");$("\\purpleE","\\textcolor{##543b78}{#1}");$("\\mintA","\\textcolor{##f5f9e8}{#1}");$("\\mintB","\\textcolor{##edf2df}{#1}");$("\\mintC","\\textcolor{##e0e5cc}{#1}");$("\\grayA","\\textcolor{##f6f7f7}{#1}");$("\\grayB","\\textcolor{##f0f1f2}{#1}");$("\\grayC","\\textcolor{##e3e5e6}{#1}");$("\\grayD","\\textcolor{##d6d8da}{#1}");$("\\grayE","\\textcolor{##babec2}{#1}");$("\\grayF","\\textcolor{##888d93}{#1}");$("\\grayG","\\textcolor{##626569}{#1}");$("\\grayH","\\textcolor{##3b3e40}{#1}");$("\\grayI","\\textcolor{##21242c}{#1}");$("\\kaBlue","\\textcolor{##314453}{#1}");$("\\kaGreen","\\textcolor{##71B307}{#1}");var NL={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class _ee{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 wee(vee,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new a9(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 qi("EOF",r.loc)),this.pushTokens(s),new qi("",fi.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 Oe("Extra }",i)}else if(i.text==="EOF")throw new Oe("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 Oe("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 Oe("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 Oe("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 Oe("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 Oe("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 Oe("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 qi(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 a9(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)||Jl.hasOwnProperty(t)||ur.math.hasOwnProperty(t)||ur.text.hasOwnProperty(t)||NL.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:Jl.hasOwnProperty(t)&&!Jl[t].primitive}}var u9=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Sp=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),gw={"́":{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"}},d9={á:"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 RL=class LL{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 _ee(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 Oe("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 qi("}")),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(LL.endOfExpression.has(s.text)||n&&s.text===n||t&&Jl[s.text]&&Jl[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 Oe("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 Oe("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 Oe("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new Oe("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new Oe("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new Oe("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(Sp[i.text]){var c=u9.test(i.text),u=[];for(u.push(new qi(Sp[i.text])),this.consume();;){var d=this.fetch().text;if(!Sp[d]||u9.test(d)!==c)break;u.unshift(new qi(Sp[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=Jl[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new Oe("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new Oe("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new Oe("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=Jl[t];if(a&&a.handler)return a.handler(o,n,r);throw new Oe("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 Oe("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 Oe("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new Oe("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Oe("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 Oe("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 Oe("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 Oe("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!PR(i))throw new Oe("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:fi.range(r,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!NL.hasOwnProperty(s)){if(this.settings.throwOnError)throw new Oe("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:fi.range(s,a),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:fi.range(s,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:fi.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 Oe(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}d9.hasOwnProperty(n[0])&&!ur[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=d9[n[0]]+n.slice(1));var i=yee.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(ur[this.mode][n]){this.settings.strict&&this.mode==="math"&&Wv.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=ur[this.mode][n].group,l=fi.range(t),c;PZ(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&&(BR(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:fi.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(!gw[d])throw new Oe("Unknown accent ' "+d+"'",t);var f=gw[d][this.mode]||gw[d].text;if(!f)throw new Oe("Accent "+d+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:fi.range(t),label:f,isStretchy:!1,isShifty:!0,base:o}}return o}};RL.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var j5=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new RL(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 Oe("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new qi("\\df@tag")])}]}return s},D5=function(t,n,r){n.textContent="";var s=tb(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."),D5=function(){throw new Oe("KaTeX doesn't work in quirks mode.")});var jL=function(t,n){var r=tb(t,n).toMarkup();return r},DL=function(t,n){var r=new v5(n);return j5(t,r)},OL=function(t,n,r){if(r.throwOnError||!(t instanceof Oe))throw t;var s=Re(["katex-error"],[new Vi(n)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+r.errorColor),s},tb=function(t,n){var r=new v5(n);try{var s=j5(t,r);return IZ(s,t,r)}catch(i){return OL(i,t,r)}},BL=function(t,n){var r=new v5(n);try{var s=j5(t,r);return NZ(s,t,r)}catch(i){return OL(i,t,r)}},PL="0.16.47",$L={Span:$h,Anchor:Uy,SymbolNode:Vi,SvgNode:hl,PathNode:vc,LineNode:Vv},ax={version:PL,render:D5,renderToString:jL,ParseError:Oe,SETTINGS_SCHEMA:T1,__parse:DL,__renderToDomTree:tb,__renderToHTMLTree:BL,__setFontMetrics:qR,__defineSymbol:_,__defineFunction:nt,__defineMacro:$,__domTree:$L};const kCe=Object.freeze(Object.defineProperty({__proto__:null,ParseError:Oe,SETTINGS_SCHEMA:T1,__defineFunction:nt,__defineMacro:$,__defineSymbol:_,__domTree:$L,__parse:DL,__renderToDomTree:tb,__renderToHTMLTree:BL,__setFontMetrics:qR,default:ax,get render(){return D5},renderToString:jL,version:PL},Symbol.toStringTag,{value:"Module"})),kee={};function h9(e){const t=this,n=e||kee,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(NJ(n)),i.push(kJ()),o.push(SJ(n))}const f9=/[#.]/g;function See(e,t){const n=e||"",r={};let s=0,i,o;for(;s<n.length;){f9.lastIndex=s;const a=f9.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 zL(e,t,n){const r=n?Eee(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=See(i,t);const c=l.tagName.toLowerCase(),u=r?r.get(c):void 0;if(l.tagName=u||c,Tee(o))a.unshift(o);else for(const[d,f]of Object.entries(o))Cee(e,l.properties,d,f)}for(const c of a)lx(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return s}function Tee(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 Cee(e,t,n,r){const s=e5(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=jS(r):s.commaSeparated?i=MS(r):s.commaOrSpaceSeparated?i=jS(MS(r).join(" ")):i=m9(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?Aee(r):String(r);if(Array.isArray(i)){const o=[];for(const a of i)o.push(m9(s,s.property,a));i=o}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function lx(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)lx(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?lx(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function m9(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Pm(n)===Pm(t)))return!0}return n}function Aee(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function Eee(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Mee=["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"],Iee=zL(t5,"div"),Nee=zL(Oh,"g",Mee),yw={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Ree(e,t){return FL(e,{})||{type:"root",children:[]}}function FL(e,t){const n=Lee(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function Lee(e,t){switch(e.nodeType){case 1:return Bee(e,t);case 3:return Dee(e);case 8:return Oee(e);case 9:return p9(e,t);case 10:return jee();case 11:return p9(e,t);default:return}}function p9(e,t){return{type:"root",children:qL(e,t)}}function jee(){return{type:"doctype"}}function Dee(e){return{type:"text",value:e.nodeValue||""}}function Oee(e){return{type:"comment",value:e.nodeValue||""}}function Bee(e,t){const n=e.namespaceURI,r=n===yw.svg?Nee:Iee,s=n===yw.html?e.tagName.toLowerCase():e.tagName,i=n===yw.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,qL(i,t))}function qL(e,t){const n=e.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=FL(n[s],t);i!==void 0&&r.push(i)}return r}new DOMParser;function Pee(e,t){const n=$ee(e);return Ree(n)}function $ee(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const g9=function(e,t,n){const r=S0(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]},Gu=function(e){if(e==null)return qee;if(typeof e=="string")return Fee(e);if(typeof e=="object")return zee(e);if(typeof e=="function")return O5(e);throw new Error("Expected function, string, or array as `test`")};function zee(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Gu(e[n]);return O5(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function Fee(e){return O5(t);function t(n){return n.tagName===e}}function O5(e){return t;function t(n,r,s){return!!(Uee(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function qee(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function Uee(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const y9=/\n/g,b9=/[\t ]+/g,cx=Gu("br"),w9=Gu(Qee),Hee=Gu("p"),v9=Gu("tr"),Vee=Gu(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Xee,Jee]),UL=Gu(["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 Wee(e,t){const n=t||{},r="children"in e?e.children:[],s=UL(e),i=WL(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...VL(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...HL(r[a],e,{whitespace:i,breakBefore:a?void 0:s,breakAfter:a<r.length-1?cx(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 HL(e,t,n){return e.type==="element"?Gee(e,t,n):e.type==="text"?n.whitespace==="normal"?VL(e,n):Kee(e):[]}function Gee(e,t,n){const r=WL(e,n),s=e.children||[];let i=-1,o=[];if(Vee(e))return o;let a,l;for(cx(e)||v9(e)&&g9(t,e,v9)?l=`
`:Hee(e)?(a=2,l=2):UL(e)&&(a=1,l=1);++i<s.length;)o=o.concat(HL(s[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<s.length-1?cx(s[i+1]):l}));return w9(e)&&g9(t,e,w9)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function VL(e,t){const n=String(e.value),r=[],s=[];let i=0;for(;i<=n.length;){y9.lastIndex=i;const l=y9.exec(n),c=l&&"index"in l?l.index:n.length;r.push(Yee(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 Kee(e){return[String(e.value)]}function Yee(e,t,n){const r=[];let s=0,i;for(;s<e.length;){b9.lastIndex=s;const o=b9.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 WL(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 Xee(e){return!!(e.properties||{}).hidden}function Qee(e){return e.tagName==="td"||e.tagName==="th"}function Jee(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const Zee={},ete=[];function x9(e){const t=e||Zee;return function(n,r){m5(n,"element",function(s,i){const o=Array.isArray(s.properties.className)?s.properties.className:ete,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=Wee(f,{whitespace:"pre"});let p;try{p=ax.renderToString(m,{...t,displayMode:u,throwOnError:!0})}catch(v){const b=v,w=b.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:b,place:s.position,ruleId:w,source:"rehype-katex"});try{p=ax.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=Pee(p).children);const y=d.children.indexOf(f);return d.children.splice(y,1,...p),uR})}}const GL=[{id:"abap",name:"ABAP",import:()=>U(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>U(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>U(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>U(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>U(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>U(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>U(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>U(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>U(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>U(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>U(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>U(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>U(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>U(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>U(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>U(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>U(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>U(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>U(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>U(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>U(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>U(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>U(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>U(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>U(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>U(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>U(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>U(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>U(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>U(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>U(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>U(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>U(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>U(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>U(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>U(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>U(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>U(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>U(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>U(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>U(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>U(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>U(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>U(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>U(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>U(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>U(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>U(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>U(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>U(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>U(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>U(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>U(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>U(()=>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:()=>U(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>U(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>U(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>U(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>U(()=>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:()=>U(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>U(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>U(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>U(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>U(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>U(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>U(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>U(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>U(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>U(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>U(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>U(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>U(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>U(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>U(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>U(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>U(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>U(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>U(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>U(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>U(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>U(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>U(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>U(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>U(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>U(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>U(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>U(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>U(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>U(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>U(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>U(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>U(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>U(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>U(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>U(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>U(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>U(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>U(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>U(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>U(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>U(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>U(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>U(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>U(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>U(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>U(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>U(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>U(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>U(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>U(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>U(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>U(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>U(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>U(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>U(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>U(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>U(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>U(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>U(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>U(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>U(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>U(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>U(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>U(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>U(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>U(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>U(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>U(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>U(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>U(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>U(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>U(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>U(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>U(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>U(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>U(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>U(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>U(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>U(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>U(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>U(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>U(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>U(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>U(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>U(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>U(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>U(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>U(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>U(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>U(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>U(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>U(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>U(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>U(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>U(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>U(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>U(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>U(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>U(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>U(()=>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:()=>U(()=>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:()=>U(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>U(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>U(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>U(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>U(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>U(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>U(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>U(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>U(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>U(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>U(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>U(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>U(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>U(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>U(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>U(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>U(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>U(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>U(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>U(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>U(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>U(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>U(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>U(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>U(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>U(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>U(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>U(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>U(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>U(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>U(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>U(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>U(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>U(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>U(()=>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:()=>U(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>U(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>U(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>U(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>U(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>U(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>U(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>U(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>U(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>U(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>U(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>U(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>U(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>U(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>U(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>U(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>U(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>U(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>U(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>U(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>U(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>U(()=>import("./zig-BVz_zdnA.js"),[])}],tte=Object.fromEntries(GL.map(e=>[e.id,e.import])),nte=Object.fromEntries(GL.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),rte={...tte,...nte},ste=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>U(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>U(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>U(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>U(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>U(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>U(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>U(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>U(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>U(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>U(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>U(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>U(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>U(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>U(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>U(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>U(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>U(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>U(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>U(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>U(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>U(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>U(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>U(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>U(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>U(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>U(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>U(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>U(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>U(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>U(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>U(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>U(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>U(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>U(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>U(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>U(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>U(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>U(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>U(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>U(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>U(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>U(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>U(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>U(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>U(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>U(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>U(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>U(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>U(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>U(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>U(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>U(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>U(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>U(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],ite=Object.fromEntries(ste.map(e=>[e.id,e.import]));let sl=class extends Error{constructor(t){super(t),this.name="ShikiError"}},B5=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function ote(){return 2147483648}function ate(){return typeof performance<"u"?performance.now():Date.now()}const lte=(e,t)=>e+(t-e%t)%t;async function cte(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=ote();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 w=Math.min(y,lte(Math.max(m,b),65536));if(o(w))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 w="";for(;p<b;){let x=m[p++];if(!(x&128)){w+=String.fromCharCode(x);continue}const k=m[p++]&63;if((x&224)===192){w+=String.fromCharCode((x&31)<<6|k);continue}const T=m[p++]&63;if((x&240)===224?x=(x&15)<<12|k<<6|T:x=(x&7)<<18|k<<12|T<<6|m[p++]&63,x<65536)w+=String.fromCharCode(x);else{const A=x-65536;w+=String.fromCharCode(55296|A>>10,56320|A&1023)}}return w}function u(m,p){return m?c(r.HEAPU8,m,p):""}const d={emscripten_get_now:ate,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 ute=Object.defineProperty,dte=(e,t,n)=>t in e?ute(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yr=(e,t,n)=>(dte(e,typeof t!="symbol"?t+"":t,n),n);let cs=null;function hte(e){throw new B5(e.UTF8ToString(e.getLastOnigError()))}class nb{constructor(t){Yr(this,"utf16Length"),Yr(this,"utf8Length"),Yr(this,"utf16Value"),Yr(this,"utf8Value"),Yr(this,"utf16OffsetToUtf8"),Yr(this,"utf8OffsetToUtf16");const n=t.length,r=nb._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 ea=class{constructor(e){if(Yr(this,"id",++ea.LAST_ID),Yr(this,"_onigBinding"),Yr(this,"content"),Yr(this,"utf16Length"),Yr(this,"utf8Length"),Yr(this,"utf16OffsetToUtf8"),Yr(this,"utf8OffsetToUtf16"),Yr(this,"ptr"),!cs)throw new B5("Must invoke loadWasm first.");this._onigBinding=cs,this.content=e;const t=new nb(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!ea._sharedPtrInUse?(ea._sharedPtr||(ea._sharedPtr=cs.omalloc(1e4)),ea._sharedPtrInUse=!0,cs.HEAPU8.set(t.utf8Value,ea._sharedPtr),this.ptr=ea._sharedPtr):this.ptr=t.createString(cs)}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===ea._sharedPtr?ea._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let E0=ea;Yr(E0,"LAST_ID",0);Yr(E0,"_sharedPtr",0);Yr(E0,"_sharedPtrInUse",!1);class fte{constructor(t){if(Yr(this,"_onigBinding"),Yr(this,"_ptr"),!cs)throw new B5("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a<l;a++){const c=new nb(t[a]);n[a]=c.createString(cs),r[a]=c.utf8Length}const s=cs.omalloc(4*t.length);cs.HEAPU32.set(n,s/4);const i=cs.omalloc(4*t.length);cs.HEAPU32.set(r,i/4);const o=cs.createOnigScanner(s,i,t.length);for(let a=0,l=t.length;a<l;a++)cs.ofree(n[a]);cs.ofree(i),cs.ofree(s),o===0&&hte(cs),this._onigBinding=cs,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 E0(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 mte(e){return typeof e.instantiator=="function"}function pte(e){return typeof e.default=="function"}function gte(e){return typeof e.data<"u"}function yte(e){return typeof Response<"u"&&e instanceof Response}function bte(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 Tp;function wte(e){if(Tp)return Tp;async function t(){cs=await cte(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),mte(r)?r=await r.instantiator(n):pte(r)?r=await r.default(n):(gte(r)&&(r=r.data),yte(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await vte(r)(n):r=await xte(r)(n):bte(r)?r=await bw(r)(n):r instanceof WebAssembly.Module?r=await bw(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await bw(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Tp=t(),Tp}function bw(e){return t=>WebAssembly.instantiate(e,t)}function vte(e){return t=>WebAssembly.instantiateStreaming(e,t)}function xte(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let _te;function kte(){return _te}async function KL(e){return e&&await wte(e),{createScanner(t){return new fte(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new E0(t)}}}function Ste(e){return P5(e)}function P5(e){return Array.isArray(e)?Tte(e):e instanceof RegExp?e:typeof e=="object"?Cte(e):e}function Tte(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=P5(e[n]);return t}function Cte(e){let t={};for(let n in e)t[n]=P5(e[n]);return t}function YL(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function XL(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?XL(e.substring(0,e.length-1)):e.substr(~t+1)}var ww=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Cp=class{static hasCaptures(e){return e===null?!1:(ww.lastIndex=0,ww.test(e))}static replaceCaptures(e,t,n){return e.replace(ww,(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 QL(e,t){return e<t?-1:e>t?1:0}function JL(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=QL(e[s],t[s]);if(i!==0)return i}return 0}return n-r}function _9(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 ZL(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var ej=class{constructor(e){le(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}},N1=class{constructor(e,t,n){le(this,"_cachedMatchRoot",new ej(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Mte(e),t)}static createFromParsedTheme(e,t){return Nte(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=>Ate(e.parent,s.parentScopes));return r?new tj(r.fontStyle,r.foreground,r.background):null}},vw=class Tg{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Tg(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Tg(n,t[r]);return n}push(t){return new Tg(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 Ate(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&&!Ete(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Ete(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var tj=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Mte(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"&&_9(o.settings.foreground)&&(c=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&_9(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 Ite(y,v,s,l,c,u)}}return n}var Ite=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 Nte(e,t){e.sort((l,c)=>{let u=QL(l.scope,c.scope);return u!==0||(u=JL(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 Rte(t),o=new tj(n,i.getId(r),i.getId(s)),a=new jte(new ux(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 N1(i,o,a)}var Rte=class{constructor(e){le(this,"_isFrozen");le(this,"_lastColorId");le(this,"_id2color");le(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)}},Lte=Object.freeze([]),ux=class nj{constructor(t,n,r,s,i){le(this,"scopeDepth");le(this,"parentScopes");le(this,"fontStyle");le(this,"foreground");le(this,"background");this.scopeDepth=t,this.parentScopes=n||Lte,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new nj(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)}},jte=class dx{constructor(t,n=[],r={}){le(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(dx._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 dx(this._mainRule.clone(),ux.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(JL(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 ux(t,n,r,s,i))}},gh=class Zi{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Zi.getLanguageId(t),r=Zi.getTokenType(t),s=Zi.getFontStyle(t),i=Zi.getForeground(t),o=Zi.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=Zi.getLanguageId(t),c=Zi.getTokenType(t),u=Zi.containsBalancedBrackets(t)?1:0,d=Zi.getFontStyle(t),f=Zi.getForeground(t),m=Zi.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 R1(e,t){const n=[],r=Dte(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(k9(s)){const l=[];do l.push(s),s=r.next();while(k9(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 k9(e){return!!e&&!!e.match(/[\w\.:]+/)}function Dte(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 rj(e){typeof e.dispose=="function"&&e.dispose()}var Um=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Ote=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Bte=class{constructor(){le(this,"_references",[]);le(this,"_seenReferenceKeys",new Set);le(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))}},Pte=class{constructor(e,t){le(this,"seenFullScopeRequests",new Set);le(this,"seenPartialScopeRequests",new Set);le(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Um(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new Bte;for(const n of e)$te(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Um){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 $te(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 Um?Cg({baseGrammar:i,selfGrammar:s},r):hx(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 Um(a))}function hx(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];L1([r],t,n)}}function Cg(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&L1(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&L1(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function L1(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?YL({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&L1(r.patterns,{...t,repository:s},n);const i=r.include;if(!i)continue;const o=sj(i);switch(o.kind){case 0:Cg({...t,selfGrammar:t.baseGrammar},n);break;case 1:Cg(t,n);break;case 2:hx(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?hx(o.ruleName,l,n):Cg(l,n)}else o.kind===4?n.add(new Ote(o.scopeName,o.ruleName)):n.add(new Um(o.scopeName));break}}}var zte=class{constructor(){le(this,"kind",0)}},Fte=class{constructor(){le(this,"kind",1)}},qte=class{constructor(e){le(this,"kind",2);this.ruleName=e}},Ute=class{constructor(e){le(this,"kind",3);this.scopeName=e}},Hte=class{constructor(e,t){le(this,"kind",4);this.scopeName=e,this.ruleName=t}};function sj(e){if(e==="$base")return new zte;if(e==="$self")return new Fte;const t=e.indexOf("#");if(t===-1)return new Ute(e);if(t===0)return new qte(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new Hte(n,r)}}var Vte=/\\(\d+)/,S9=/\\(\d+)/g,Wte=-1,ij=-2;var M0=class{constructor(t,n,r,s){le(this,"$location");le(this,"id");le(this,"_nameIsCapturing");le(this,"_name");le(this,"_contentNameIsCapturing");le(this,"_contentName");this.$location=t,this.id=n,this._name=r||null,this._nameIsCapturing=Cp.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=Cp.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${XL(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:Cp.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Cp.replaceCaptures(this._contentName,t,n)}},Gte=class extends M0{constructor(t,n,r,s,i){super(t,n,r,s);le(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!")}},Kte=class extends M0{constructor(t,n,r,s,i){super(t,n,r,null);le(this,"_match");le(this,"captures");le(this,"_cachedCompiledPatterns");this._match=new Hm(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 Vm,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},T9=class extends M0{constructor(t,n,r,s,i){super(t,n,r,s);le(this,"hasMissingPatterns");le(this,"patterns");le(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 Vm,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},fx=class extends M0{constructor(t,n,r,s,i,o,a,l,c,u){super(t,n,r,s);le(this,"_begin");le(this,"beginCaptures");le(this,"_end");le(this,"endHasBackReferences");le(this,"endCaptures");le(this,"applyEndPatternLast");le(this,"hasMissingPatterns");le(this,"patterns");le(this,"_cachedCompiledPatterns");this._begin=new Hm(i,this.id),this.beginCaptures=o,this._end=new Hm(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 Vm;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}},j1=class extends M0{constructor(t,n,r,s,i,o,a,l,c){super(t,n,r,s);le(this,"_begin");le(this,"beginCaptures");le(this,"whileCaptures");le(this,"_while");le(this,"whileHasBackReferences");le(this,"hasMissingPatterns");le(this,"patterns");le(this,"_cachedCompiledPatterns");le(this,"_cachedCompiledWhilePatterns");this._begin=new Hm(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new Hm(a,ij),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 Vm;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 Vm,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},oj=class Es{static createCaptureRule(t,n,r,s,i){return t.registerRule(o=>new Gte(n,o,r,s,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new Kte(t.$vscodeTextmateLocation,t.id,t.name,t.match,Es._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=YL({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new T9(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Es._compilePatterns(i,n,r))}return t.while?new j1(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Es._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Es._compileCaptures(t.whileCaptures||t.captures,n,r),Es._compilePatterns(t.patterns,n,r)):new fx(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Es._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Es._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Es._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=Es.getCompiledRuleId(t[o],n,r)),s[a]=Es.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=sj(a.include);switch(c.kind){case 0:case 1:l=Es.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=Es.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=Es.getCompiledRuleId(p,n,m.repository))}else l=Es.getCompiledRuleId(m.repository.$self,n,m.repository);break}}else l=Es.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof T9||c instanceof fx||c instanceof j1)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},Hm=class aj{constructor(t,n){le(this,"source");le(this,"ruleId");le(this,"hasAnchor");le(this,"hasBackReferences");le(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=Vte.test(this.source):this.hasBackReferences=!1}clone(){return new aj(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 S9.lastIndex=0,this.source.replace(S9,(s,i)=>ZL(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}},Vm=class{constructor(){le(this,"_items");le(this,"_hasAnchors");le(this,"_cached");le(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 C9(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 C9(e,r,this._items.map(s=>s.ruleId))}},C9=class{constructor(e,t,n){le(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}},xw=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Ga,Yte=(Ga=class{constructor(t,n){le(this,"_defaultAttributes");le(this,"_embeddedLanguagesMatcher");le(this,"_getBasicScopeAttributes",new ej(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new xw(n,r)}));this._defaultAttributes=new xw(t,8),this._embeddedLanguagesMatcher=new Xte(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Ga._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Ga.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!")}},le(Ga,"_NULL_SCOPE_METADATA",new xw(0,0)),le(Ga,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Ga),Xte=class{constructor(e){le(this,"values");le(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>ZL(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])}},A9=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function lj(e,t,n,r,s,i,o,a){const l=t.content.length;let c=!1,u=-1;if(o){const m=Qte(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 A9(s,!0);f()}return new A9(s,!1);function f(){const m=Jte(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===Wte){const b=s.getRule(e);i.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),Pf(e,t,n,s,i,b.endCaptures,p),i.produce(s,p[0].end);const w=s;if(s=s.parent,u=w.getAnchorPos(),!v&&w.getEnterPos()===r){s=w,i.produce(s,l),c=!0;return}}else{const b=e.getRule(y);i.produce(s,p[0].start);const w=s,x=b.getName(t.content,p),k=s.contentNameScopesList.pushAttributed(x,e);if(s=s.push(y,r,u,p[0].end===l,null,k,k),b instanceof fx){const T=b;Pf(e,t,n,s,i,T.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const A=T.getContentName(t.content,p),M=k.pushAttributed(A,e);if(s=s.withContentNameScopesList(M),T.endHasBackReferences&&(s=s.withEndRule(T.getEndWithResolvedBackReferences(t.content,p))),!v&&w.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(b instanceof j1){const T=b;Pf(e,t,n,s,i,T.beginCaptures,p),i.produce(s,p[0].end),u=p[0].end;const A=T.getContentName(t.content,p),M=k.pushAttributed(A,e);if(s=s.withContentNameScopesList(M),T.whileHasBackReferences&&(s=s.withEndRule(T.getWhileWithResolvedBackReferences(t.content,p))),!v&&w.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),c=!0;return}}else if(Pf(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 Qte(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 j1&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=tne(l.rule,e,l.stack.endRule,n,r===o),d=c.findNextMatchSync(t,r,u);if(d){if(d.ruleId!==ij){s=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(i.produce(l.stack,d.captureIndices[0].start),Pf(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 Jte(e,t,n,r,s,i){const o=Zte(e,t,n,r,s,i),a=e.getInjections();if(a.length===0)return o;const l=ene(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 Zte(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:a,findOptions:l}=cj(o,e,s.endRule,n,r===i),c=a.findNextMatchSync(t,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function ene(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}=cj(y,t,null,r,s===o),w=v.findNextMatchSync(n,s,b);if(!w)continue;const x=w.captureIndices[0].start;if(!(x>=a)&&(a=x,l=w.captureIndices,c=w.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function cj(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function tne(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function Pf(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),w=v.pushAttributed(b,e),x=r.push(f.retokenizeCapturedWithRuleId,m.start,-1,!1,null,v,w),k=e.createOnigString(a.substring(0,m.end));lj(e,k,n&&m.start===0,m.start,x,s,!1,0),rj(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 nne(v,m.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var nne=class{constructor(e,t){le(this,"scopes");le(this,"endPos");this.scopes=e,this.endPos=t}};function rne(e,t,n,r,s,i,o,a){return new ine(e,t,n,r,s,i,o,a)}function E9(e,t,n,r,s){const i=R1(t,D1),o=oj.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 D1(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(sne(t[s],r))return n=s+1,!0;return!1})}function sne(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 ine=class{constructor(e,t,n,r,s,i,o,a){le(this,"_rootId");le(this,"_lastRuleId");le(this,"_ruleId2desc");le(this,"_includedGrammars");le(this,"_grammarRepository");le(this,"_grammar");le(this,"_injections");le(this,"_basicScopeAttributesProvider");le(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new Yte(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=M9(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=R1(l,D1);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)E9(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&&E9(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]=M9(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=oj.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===mx.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=gh.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=mm.createRootAndLookUpScopeName(f,d,this):m=mm.createRoot("unknown",d),t=new mx(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 ane(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=lj(this,i,s,0,t,a,!0,r);return rj(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function M9(e,t){return e=Ste(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 mm=class ta{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=vw.push(s,i.scopeNames),r=new ta(r,s,i.encodedTokenAttributes);return r}static createRoot(t,n){return new ta(null,new vw(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new vw(null,t),o=r.themeProvider.themeMatch(i),a=ta.mergeAttributes(n,s,o);return new ta(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return ta.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),gh.set(t,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return ta._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const i of r)s=ta._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=ta.mergeAttributes(t.tokenAttributes,s,o);return new ta(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}},oo,mx=(oo=class{constructor(t,n,r,s,i,o,a,l){le(this,"_stackElementBrand");le(this,"_enterPos");le(this,"_anchorPos");le(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:oo._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?mm.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(){oo._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,a){return new oo(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 oo(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=mm.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new oo(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,mm.fromExtension(r,n.contentNameScopesList))}},le(oo,"NULL",new oo(null,0,0,0,!1,null,null,null)),oo),one=class{constructor(e,t){le(this,"balancedBracketScopes");le(this,"unbalancedBracketScopes");le(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):R1(n,D1).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>R1(n,D1).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}},ane=class{constructor(e,t,n,r){le(this,"_emitBinaryTokens");le(this,"_lineText");le(this,"_tokens");le(this,"_binaryTokens");le(this,"_lastTokenEndIndex");le(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=gh.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(s=gh.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}},lne=class{constructor(e,t){le(this,"_grammars",new Map);le(this,"_rawGrammars",new Map);le(this,"_injectionGrammars",new Map);le(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,rne(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},cne=class{constructor(t){le(this,"_options");le(this,"_syncRegistry");le(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new lne(N1.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(N1.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 one(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,i){const o=new Pte(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)}},px=mx.NULL;const une=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],dne=/["&'<>`]/g,hne=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,fne=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,mne=/[|\\{}()[\]^$+*?.]/g,I9=new WeakMap;function pne(e,t){if(e=e.replace(t.subset?gne(t.subset):dne,r),t.subset||t.escapeOnly)return e;return e.replace(hne,n).replace(fne,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 gne(e){let t=I9.get(e);return t||(t=yne(e),I9.set(e,t)),t}function yne(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(mne,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const bne=/[\dA-Fa-f]/;function wne(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!bne.test(String.fromCharCode(t))?r:r+";"}const vne=/\d/;function xne(e,t,n){const r="&#"+String(e);return n&&t&&!vne.test(String.fromCharCode(t))?r:r+";"}const _ne=["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"],_w={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:"€"},kne=["cent","copy","divide","gt","lt","not","para","times"],uj={}.hasOwnProperty,gx={};let Ap;for(Ap in _w)uj.call(_w,Ap)&&(gx[_w[Ap]]=Ap);const Sne=/[^\dA-Za-z]/;function Tne(e,t,n,r){const s=String.fromCharCode(e);if(uj.call(gx,s)){const i=gx[s],o="&"+i;return n&&_ne.includes(i)&&!kne.includes(i)&&(!r||t&&t!==61&&Sne.test(String.fromCharCode(t)))?o:o+";"}return""}function Cne(e,t,n){let r=wne(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Tne(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=xne(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Gd(e,t){return pne(e,Object.assign({format:Cne},t))}const Ane=/^>|^->|<!--|-->|--!>|<!-$/g,Ene=[">"],Mne=["<",">"];function Ine(e,t,n,r){return r.settings.bogusComments?"<?"+Gd(e.value,Object.assign({},r.settings.characterReferences,{subset:Ene}))+">":"<!--"+e.value.replace(Ane,s)+"-->";function s(i){return Gd(i,Object.assign({},r.settings.characterReferences,{subset:Mne}))}}function Nne(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const ts=hj(1),dj=hj(-1),Rne=[];function hj(e){return t;function t(n,r,s){const i=n?n.children:Rne;let o=(r||0)+e,a=i[o];if(!s)for(;a&&By(a);)o+=e,a=i[o];return a}}const Lne={}.hasOwnProperty;function fj(e){return t;function t(n,r,s){return Lne.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const $5=fj({body:Dne,caption:kw,colgroup:kw,dd:$ne,dt:Pne,head:kw,html:jne,li:Bne,optgroup:zne,option:Fne,p:One,rp:N9,rt:N9,tbody:Une,td:R9,tfoot:Hne,th:R9,thead:qne,tr:Vne});function kw(e,t,n){const r=ts(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&By(r.value.charAt(0)))}function jne(e,t,n){const r=ts(n,t);return!r||r.type!=="comment"}function Dne(e,t,n){const r=ts(n,t);return!r||r.type!=="comment"}function One(e,t,n){const r=ts(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 Bne(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Pne(e,t,n){const r=ts(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function $ne(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function N9(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function zne(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Fne(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function qne(e,t,n){const r=ts(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Une(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Hne(e,t,n){return!ts(n,t)}function Vne(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function R9(e,t,n){const r=ts(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Wne=fj({body:Yne,colgroup:Xne,head:Kne,html:Gne,tbody:Qne});function Gne(e){const t=ts(e,-1);return!t||t.type!=="comment"}function Kne(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 Yne(e){const t=ts(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&By(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Xne(e,t,n){const r=dj(n,t),s=ts(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&$5(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Qne(e,t,n){const r=dj(n,t),s=ts(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&$5(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ep={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 Jne(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=Oh);const c=Zne(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(o=!1),(c||!i||!Wne(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||!$5(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function Zne(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=ere(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 ere(e,t,n){const r=e5(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=Gd(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Ep.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?MN:BN)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=Gd(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Ep.unquoted[s][i]}))),a!==n&&(e.settings.quoteSmart&&k1(n,o)>k1(n,e.alternative)&&(o=e.alternative),a=o+Gd(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?Ep.single:Ep.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const tre=["<","&"];function mj(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Gd(e.value,Object.assign({},r.settings.characterReferences,{subset:tre}))}function nre(e,t,n,r){return r.settings.allowDangerousHtml?e.value:mj(e,t,n,r)}function rre(e,t,n,r){return r.all(e)}const sre=ZX("type",{invalid:ire,unknown:ore,handlers:{comment:Ine,doctype:Nne,element:Jne,raw:nre,root:rre,text:mj}});function ire(e){throw new Error("Expected node, not `"+e+"`")}function ore(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const are={},lre={},cre=[];function ure(e,t){const n=are,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:dre,all:hre,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||une,characterReferences:n.characterReferences||lre,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Oh:t5,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function dre(e,t,n){return sre(e,t,n,this)}function hre(e){const t=[],n=e&&e.children||cre;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function fre(e){return Array.isArray(e)?e:[e]}function rb(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 z5(e){return!e||["plaintext","txt","text","plain"].includes(e)}function pj(e){return e==="ansi"||z5(e)}function F5(e){return e==="none"}function gj(e){return F5(e)}function yj(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 mre(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 pre(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?mre(s,i):s})):e}async function bj(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function O1(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 lu(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function wj(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 gre(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function yre(e){const t=rb(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 Ks extends Error{constructor(t){super(t),this.name="ShikiError"}}const vj=new WeakMap;function sb(e,t){vj.set(e,t)}function Wm(e){return vj.get(e)}class qh{constructor(...t){le(this,"_stacks",{});le(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 qh(Object.fromEntries(fre(n).map(r=>[r,px])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return L9(this._stacks[this.theme])}getScopes(t=this.theme){return L9(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function L9(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 bre(e,t){if(!(e instanceof qh))throw new Ks("Invalid grammar state");return e.getInternalStack(t)}function wre(){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 Ks(`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 Ks(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);if(o.character<0||o.character>a.length)throw new Ks(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:s.posToIndex(o.line,o.character)}}};const s=yre(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));vre(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 pre(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 Ks(`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,w=-1;if(f===0&&(b=0),m===0&&(w=0),m===Number.POSITIVE_INFINITY&&(w=y.children.length),b===-1||w===-1)for(let k=0;k<y.children.length;k++)v+=xj(y.children[k]),b===-1&&v.length===f&&(b=k+1),w===-1&&v.length===m&&(w=k+1);if(b===-1)throw new Ks(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(w===-1)throw new Ks(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const x=y.children.slice(b,w);if(!p.alwaysWrap&&x.length===y.children.length)a(y,p,"line");else if(!p.alwaysWrap&&x.length===1&&x[0].type==="element")a(x[0],p,"token");else{const k={type:"element",tagName:"span",properties:{},children:x};a(k,p,"wrapper"),y.children.splice(b,x.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&&yj(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 vre(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Ks(`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 Ks(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function xj(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(xj).join(""):""}const xre=[wre()];function B1(e){return[...e.transformers||[],...xre]}var cu=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Sw={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function _re(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 j9(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 kre(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)Sw[s]&&t.push({type:"setDecoration",value:Sw[s]});else if(s<=29){const i=Sw[s-20];i&&t.push({type:"resetDecoration",value:i})}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:cu[s-30]}});else if(s===38){const[i,o]=j9(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:cu[s-40]}});else if(s===48){const[i,o]=j9(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:cu[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:cu[s-100+8]}})}return t}function Sre(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=_re(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=kre(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 Tre={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 Cre(e=Tre){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<cu.length;c++)r.push(t(cu[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 Are(e,t,n){const r=O1(e,n),s=rb(t),i=Cre(Object.fromEntries(cu.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=Sre();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=lu(c,r),u=lu(u,r),l.decorations.has("dim")&&(c=Ere(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 Ere(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 q5(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(z5(r)||F5(s))return rb(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(s);if(r==="ansi")return Are(i,t,n);const a=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new sl(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new sl(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Ire(t,a,i,o,n)}function Mre(...e){if(e.length===2)return Wm(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(z5(s)||F5(i))throw new sl("Plain language does not have grammar state");if(s==="ansi")throw new sl("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(s);return new qh(P1(n,l,o,a,r).stateStack,l.name,o.name)}function Ire(e,t,n,r,s){const i=P1(e,t,n,r,s),o=new qh(P1(e,t,n,r,s).stateStack,t.name,n.name);return sb(i.tokens,o),i.tokens}function P1(e,t,n,r,s){const i=O1(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,l=rb(e);let c=s.grammarState?bre(s.grammarState,n.name)??px:s.grammarContextCode!=null?P1(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:px,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,w;s.includeExplanation&&(v=t.tokenizeLine(p,c),b=v.tokens,w=0);const x=t.tokenizeLine2(p,c,a),k=x.tokens.length/2;for(let T=0;T<k;T++){const A=x.tokens[2*T],M=T+1<k?x.tokens[2*T+2]:p.length;if(A===M)continue;const D=x.tokens[2*T+1],O=lu(r[gh.getForeground(D)],i),C=gh.getFontStyle(D),L={content:p.substring(A,M),offset:y+A,color:O,fontStyle:C};if(s.includeExplanation){const I=[];if(s.includeExplanation!=="scopeName")for(const F of n.settings){let W;switch(typeof F.scope){case"string":W=F.scope.split(/,/).map(j=>j.trim());break;case"object":W=F.scope;break;default:continue}I.push({settings:F,selectors:W.map(j=>j.split(/ /))})}L.explanation=[];let B=0;for(;A+B<M;){const F=b[w],W=p.substring(F.startIndex,F.endIndex);B+=W.length,L.explanation.push({content:W,scopes:s.includeExplanation==="scopeName"?Nre(F.scopes):Rre(I,F.scopes)}),w+=1}}u.push(L)}d.push(u),u=[],c=x.ruleStack}return{tokens:d,stateStack:c}}function Nre(e){return e.map(t=>({scopeName:t}))}function Rre(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];n[r]={scopeName:i,themeMatches:jre(e,i,t.slice(0,r))}}return n}function D9(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Lre(e,t,n){if(!D9(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)D9(e[r],n[s])&&(r-=1),s-=1;return r===-1}function jre(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const o of s)if(Lre(o,t,n)){r.push(i);break}return r}function _j(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=q5(e,t,{...n,theme:l.theme}),u=Wm(c),d=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:d}}),i=Dre(...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,...w}=m[c][d];f.variants[r[p].color]=w}),f})),a=s[0].state?new qh(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&&sb(o,a),o}function Dre(...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 $1(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 sl("`themes` option must not be empty");const f=_j(e,t,n);if(l=Wm(f),c&&!d.find(v=>v.color===c))throw new sl(`\`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=>Ore(b,p,u,c))),l&&sb(i,l);const y=d.map(v=>O1(v.theme,n));s=d.map((v,b)=>(b===0&&c?"":`${u+v.color}:`)+(lu(m[b].fg,y[b])||"inherit")).join(";"),r=d.map((v,b)=>(b===0&&c?"":`${u+v.color}-bg:`)+(lu(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=O1(n.theme,n);i=q5(e,t,n);const u=e.getTheme(n.theme);r=lu(u.bg,c),s=lu(u.fg,c),o=u.name,l=Wm(i)}else throw new sl("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:l}}function Ore(e,t,n,r){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>wj(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 z1(e,t,n,r={meta:{},options:n,codeToHast:(s,i)=>z1(e,s,i),codeToTokens:(s,i)=>$1(e,s,i)}){var m,p;let s=t;for(const y of B1(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}=$1(e,s,n);const{mergeWhitespaces:d=!0}=n;d===!0?i=Pre(i):d==="never"&&(i=$re(i));const f={...r,get source(){return s}};for(const y of B1(n))i=((p=y.tokens)==null?void 0:p.call(f,i))||i;return Bre(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},f,u)}function Bre(e,t,n,r=Wm(e)){var p,y,v;const s=B1(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:yj,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,w)=>{var T,A;w&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let x={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const M of b){let D={type:"element",tagName:"span",properties:{...M.htmlAttrs},children:[{type:"text",value:M.content}]};M.htmlStyle;const O=gre(M.htmlStyle||wj(M));O&&(D.properties.style=O);for(const C of s)D=((T=C==null?void 0:C.span)==null?void 0:T.call(f,D,w+1,k,x,M))||D;a==="inline"?o.children.push(D):a==="classic"&&x.children.push(D),k+=M.content.length}if(a==="classic"){for(const M of s)x=((A=M==null?void 0:M.line)==null?void 0:A.call(f,x,w+1))||x;d.push(x),i.push(x)}}),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&&sb(m,r),m}function Pre(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 $re(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 zre(e,t,n){var i;const r={meta:{},options:n,codeToHast:(o,a)=>z1(e,o,a),codeToTokens:(o,a)=>$1(e,o,a)};let s=ure(z1(e,t,n,r));for(const o of B1(n))s=((i=o.postprocess)==null?void 0:i.call(r,s,n))||s;return s}const O9={light:"#333333",dark:"#bbbbbb"},B9={light:"#fffffe",dark:"#1e1e1e"},P9="__shiki_resolved";function U5(e){var a,l,c,u,d;if(e!=null&&e[P9])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"?O9.light:O9.dark),n||(n=t.type==="light"?B9.light:B9.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 w=o(f.settings.foreground);t.colorReplacements[w]=f.settings.foreground,y.settings.foreground=w}if(p){const w=o(f.settings.background);t.colorReplacements[w]=f.settings.background,y.settings.background=w}return y});for(const f of Object.keys(t.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((d=t.colors[f])!=null&&d.startsWith("#"))){const m=o(t.colors[f]);t.colorReplacements[m]=t.colors[f],t.colors[f]=m}return Object.defineProperty(t,P9,{enumerable:!1,writable:!1,value:!0}),t}async function kj(e){return Array.from(new Set((await Promise.all(e.filter(t=>!pj(t)).map(async t=>await bj(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Sj(e){return(await Promise.all(e.map(async n=>gj(n)?null:U5(await bj(n))))).filter(n=>!!n)}class Fre extends cne{constructor(n,r,s,i={}){super(n);le(this,"_resolvedThemes",new Map);le(this,"_resolvedGrammars",new Map);le(this,"_langMap",new Map);le(this,"_langGraph",new Map);le(this,"_textmateThemeCache",new WeakMap);le(this,"_loadedThemesCache",null);le(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=U5(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=N1.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 Ks(`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 Ks(`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 qre{constructor(t,n){le(this,"_langs",new Map);le(this,"_scopeToLang",new Map);le(this,"_injections",new Map);le(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 wf=0;function Ure(e){wf+=1,e.warnings!==!1&&wf>=10&&wf%10===0&&console.warn(`[Shiki] ${wf} 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 Ks("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(U5),s=new qre(e.engine,n),i=new Fre(s,r,n,e.langAlias);let o;function a(w){v();const x=i.getGrammar(typeof w=="string"?w:w.name);if(!x)throw new Ks(`Language \`${w}\` not found, you may need to load it first`);return x}function l(w){if(w==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};v();const x=i.getTheme(w);if(!x)throw new Ks(`Theme \`${w}\` not found, you may need to load it first`);return x}function c(w){v();const x=l(w);o!==w&&(i.setTheme(x),o=w);const k=i.getColorMap();return{theme:x,colorMap:k}}function u(){return v(),i.getLoadedThemes()}function d(){return v(),i.getLoadedLanguages()}function f(...w){v(),i.loadLanguages(w.flat(1))}async function m(...w){return f(await kj(w))}function p(...w){v();for(const x of w.flat(1))i.loadTheme(x)}async function y(...w){return v(),p(await Sj(w))}function v(){if(t)throw new Ks("Shiki instance has been disposed")}function b(){t||(t=!0,i.dispose(),wf-=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 Hre(e={}){e.loadWasm;const[t,n,r]=await Promise.all([Sj(e.themes||[]),kj(e.langs||[]),e.engine||KL(e.loadWasm||kte())]);return Ure({...e,themes:t,langs:n,engine:r})}async function Vre(e={}){const t=await Hre(e);return{getLastGrammarState:(...n)=>Mre(t,...n),codeToTokensBase:(n,r)=>q5(t,n,r),codeToTokensWithThemes:(n,r)=>_j(t,n,r),codeToTokens:(n,r)=>$1(t,n,r),codeToHast:(n,r)=>z1(t,n,r),codeToHtml:(n,r)=>zre(t,n,r),...t,getInternalContext:()=>t}}function Wre(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(pj(m))return[];const p=r[m];if(!p)throw new sl(`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(gj(m))return"none";if(typeof m=="string"){const p=s[m];if(!p)throw new sl(`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 Vre({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 Gre=Wre({langs:rte,themes:ite,engine:()=>KL(U(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Kre=["github-light-default","github-dark-default"];let Mp=null,yx=null;const bx=new Set,Tw=new Map,$9=new Set,Yre=128,$f=new Map;function Tj(e,t,n){return`${t}\0${n}\0${e}`}function Xre(e,t){if($f.size>=Yre){const n=$f.keys().next().value;n!==void 0&&$f.delete(n)}$f.set(e,t)}function Qre(e,t,n){return $f.get(Tj(e,t,n))??null}function Jre(){return Mp||(Mp=Gre({langs:[],themes:Kre}).then(e=>(yx=e,e)).catch(e=>{throw Mp=null,e})),Mp}async function Zre(e){const t=await Jre();if(bx.has(e))return t;if($9.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=Tw.get(e);return n||(n=t.loadLanguage(e).then(()=>{bx.add(e)}).catch(r=>{throw $9.add(e),r}).finally(()=>{Tw.delete(e)}),Tw.set(e,n)),await n,t}const ese=1e5,tse=2e4;function nse(e){if(e.length>ese)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>tse)return!0;t=r+1}return!1}function z9(e,t,n,r=!0){if(yx&&bx.has(t))try{const s=yx.codeToHtml(e,{lang:t,theme:n});return r&&Xre(Tj(e,t,n),s),s}catch(s){return console.warn("[web-shell] sync highlight failed for lang=%s",t,s),null}return null}const rse="_tableShell_111ca_1",sse="_toolbar_111ca_11",ise="_summary_111ca_22",ose="_hint_111ca_27",ase="_selection_111ca_31",lse="_copyButton_111ca_36",cse="_secondaryButton_111ca_37",use="_primaryButton_111ca_38",dse="_copyCheck_111ca_47",hse="_scroller_111ca_71",fse="_table_111ca_1",mse="_headerCell_111ca_91",pse="_cell_111ca_92",gse="_headerControls_111ca_115",yse="_headerButton_111ca_121",bse="_filterTrigger_111ca_138",wse="_headerText_111ca_142",vse="_sortIcon_111ca_149",xse="_filterTriggerActive_111ca_165",_se="_filterMenu_111ca_170",kse="_filterMenuTitle_111ca_186",Sse="_filterMenuSection_111ca_196",Tse="_filterMenuAction_111ca_204",Cse="_activeAction_111ca_217",Ase="_filterSearch_111ca_226",Ese="_conditionInput_111ca_227",Mse="_conditionSelect_111ca_228",Ise="_filterOptionList_111ca_244",Nse="_filterOption_111ca_244",Rse="_optionLabel_111ca_270",Lse="_optionCount_111ca_278",jse="_optionLimitHint_111ca_284",Dse="_conditionTitle_111ca_290",Ose="_conditionInputs_111ca_295",Bse="_filterFooter_111ca_300",Pse="_footerSpacer_111ca_307",$se="_dragging_111ca_324",zse="_evenRow_111ca_328",Fse="_selectedCell_111ca_336",qse="_actionHeaderCell_111ca_343",Use="_actionCell_111ca_344",Hse="_rowDetailButton_111ca_357",Vse="_detailRow_111ca_372",Wse="_detailCell_111ca_376",Gse="_detailPanel_111ca_383",Kse="_detailTitle_111ca_389",Yse="_detailItem_111ca_394",Xse="_detailLabel_111ca_400",Qse="_detailValue_111ca_405",Jse="_emptyState_111ca_412",at={tableShell:rse,toolbar:sse,summary:ise,hint:ose,selection:ase,copyButton:lse,secondaryButton:cse,primaryButton:use,copyCheck:dse,scroller:hse,table:fse,headerCell:mse,cell:pse,headerControls:gse,headerButton:yse,filterTrigger:bse,headerText:wse,sortIcon:vse,filterTriggerActive:xse,filterMenu:_se,filterMenuTitle:kse,filterMenuSection:Sse,filterMenuAction:Tse,activeAction:Cse,filterSearch:Ase,conditionInput:Ese,conditionSelect:Mse,filterOptionList:Ise,filterOption:Nse,optionLabel:Rse,optionCount:Lse,optionLimitHint:jse,conditionTitle:Dse,conditionInputs:Ose,filterFooter:Bse,footerSpacer:Pse,dragging:$se,evenRow:zse,selectedCell:Fse,actionHeaderCell:qse,actionCell:Use,rowDetailButton:Hse,detailRow:Vse,detailCell:Wse,detailPanel:Gse,detailTitle:Kse,detailItem:Yse,detailLabel:Xse,detailValue:Qse,emptyState:Jse},Zse={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"},eie={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"},tie=500,nie=50,rie='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function sie(e){return Array.from(e.querySelectorAll(rie)).filter(t=>!t.hasAttribute("hidden"))}function F9(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function iie(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function uu(e,t){return g.isValidElement(e)&&e.type===t}function oie(e){return e.replace(/\s+/g," ").trim()}function wx(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(wx).join(""):g.isValidElement(e)?e.type==="img"?e.props.alt??"":wx(e.props.children):""}function aie(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",isHeader:!1}}function Cj(e,t){const n=g.Children.toArray(e.props.children).filter(r=>uu(r,"td")||uu(r,"th"));return{key:t,cells:n.map((r,s)=>{var i;return{key:`${t}-${s}`,content:r.props.children,text:oie(wx(r.props.children)),isHeader:r.type==="th",textAlign:(i=r.props.style)==null?void 0:i.textAlign}})}}function Cw(e,t){return g.Children.toArray(e.props.children).filter(n=>uu(n,"tr")).map((n,r)=>Cj(n,`${t}-${r}`))}function lie(e,t){return{...e,cells:Array.from({length:t},(n,r)=>e.cells[r]??aie(e.key,r))}}function cie(e,t){const n=g.Children.toArray(e),r=[],s=[],i=[];if(n.forEach((u,d)=>{uu(u,"thead")?r.push(...Cw(u,`head-${d}`)):uu(u,"tbody")?s.push(...Cw(u,`body-${d}`)):uu(u,"tfoot")?s.push(...Cw(u,`foot-${d}`)):uu(u,"tr")&&i.push(Cj(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=>lie(u,a)),columnCount:a}}function hc(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 Aj(e,t){const n=hc(e),r=hc(t);return n!==null&&r!==null&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function H5(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 vx(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"");return/^[=+\-@]/.test(t)?`'${e}`:e}function q9(e,t,n){if(!e)return"";const{minRow:r,maxRow:s,minCol:i,maxCol:o}=H5(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 vx(((f=u.cells[d])==null?void 0:f.text)??"")}).join("	"))}return l.join(`
`)}function uie(e,t,n){return n.length===0?"":[n.map(s=>{var i;return vx(((i=e[s])==null?void 0:i.text)??"")}).join("	"),...t.map(s=>n.map(i=>{var o;return vx(((o=s.cells[i])==null?void 0:o.text)??"")}).join("	"))].join(`
`)}function die(e,t){if(!e)return 0;const{minRow:n,maxRow:r,minCol:s,maxCol:i}=H5(e),o=t.filter(a=>a>=s&&a<=i).length;return(r-n+1)*o}function pm(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 hie(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 fie(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=hc(e),r=hc(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=hc(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 mie(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:hie(e,t.textFilter)&&fie(e,t.numberFilter)}function U9(e,t,n){const r=Object.entries(t).map(([s,i])=>[Number(s),i]).filter(([s,i])=>s!==n&&pm(i));return r.length===0?e:e.filter(s=>r.every(([i,o])=>{var a;return mie(((a=s.cells[i])==null?void 0:a.text)??"",o)}))}function pie(e,t){return t?e.map((n,r)=>({row:n,index:r})).sort((n,r)=>{var o,a;const s=Aj(((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 gie(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)=>Aj(s.value,i.value))}function yie(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,hc(i)!==null&&(r+=1))}),n>0&&r/n>=.7}function bie(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function wie(e,t){var r,s,i;const n={};if(e.selectedValues!==void 0&&!bie(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();hc(o)!==null&&(e.numberFilter.operator!=="between"||hc(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return pm(n)?n:void 0}function vie({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:r}=lt();return h.jsxs("div",{className:at.filterMenuSection,children:[h.jsx("button",{className:`${at.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?at.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:r("markdownTable.sort.asc")}),h.jsx("button",{className:`${at.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?at.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:r("markdownTable.sort.desc")}),h.jsx("button",{className:at.filterMenuAction,type:"button",onClick:()=>n(e,null),children:r("markdownTable.sort.clear")})]})}function xie({onHideColumn:e}){const{t}=lt();return h.jsx("div",{className:at.filterMenuSection,children:h.jsx("button",{className:at.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function _ie({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}=lt();return h.jsxs("div",{className:at.filterMenuSection,children:[h.jsx("input",{ref:r,className:at.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:at.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:at.optionCount,children:s.length})]}),h.jsxs("div",{className:at.filterOptionList,children:[i.map((f,m)=>h.jsxs("label",{className:at.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:at.optionLabel,children:f.label}),h.jsx("span",{className:at.optionCount,children:f.count})]},f.value)),s.length>i.length&&h.jsx("div",{className:at.optionLimitHint,children:d("markdownTable.filter.optionLimit",{count:i.length})}),s.length===0&&h.jsx("div",{className:at.optionLimitHint,children:d("markdownTable.filter.noOptions")})]})]})}function kie({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}=lt();return h.jsxs("div",{className:at.filterMenuSection,children:[h.jsx("div",{className:at.conditionTitle,children:m("markdownTable.filter.custom")}),n?h.jsxs(h.Fragment,{children:[h.jsx("select",{className:at.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(eie).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsxs("div",{className:at.conditionInputs,children:[h.jsx("input",{className:at.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:at.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:at.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(Zse).map(([p,y])=>h.jsx("option",{value:p,children:m(y)},p))}),h.jsx("input",{className:at.conditionInput,value:s,onChange:p=>c(p.currentTarget.value),placeholder:m("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function Sie({onClear:e,onClose:t,onApply:n}){const{t:r}=lt();return h.jsxs("div",{className:at.filterFooter,children:[h.jsx("button",{className:at.secondaryButton,type:"button",onClick:e,children:r("markdownTable.filter.reset")}),h.jsx("span",{className:at.footerSpacer}),h.jsx("button",{className:at.secondaryButton,type:"button",onClick:t,children:r("markdownTable.filter.cancel")}),h.jsx("button",{className:at.primaryButton,type:"button",onClick:n,children:r("markdownTable.filter.confirm")})]})}function Tie({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 P,E,ne,pe,be;const p=g.useMemo(()=>i.map(xe=>xe.value),[i]),[y,v]=g.useState(""),[b,w]=g.useState(()=>new Set((r==null?void 0:r.selectedValues)??p)),[x,k]=g.useState(((P=r==null?void 0:r.textFilter)==null?void 0:P.operator)??"contains"),[T,A]=g.useState(((E=r==null?void 0:r.textFilter)==null?void 0:E.value)??""),[M,D]=g.useState(((ne=r==null?void 0:r.numberFilter)==null?void 0:ne.operator)??"gt"),[O,C]=g.useState(((pe=r==null?void 0:r.numberFilter)==null?void 0:pe.value)??""),[L,I]=g.useState(((be=r==null?void 0:r.numberFilter)==null?void 0:be.valueTo)??""),B=g.useRef(null);g.useEffect(()=>{var xe;(xe=B.current)==null||xe.focus()},[]);const F=g.useMemo(()=>{const xe=y.trim().toLowerCase();return xe?i.filter(we=>we.label.toLowerCase().includes(xe)):i},[i,y]),W=F.slice(0,500),j=F.length>0&&F.every(xe=>b.has(xe.value)),K=xe=>{w(we=>{const de=new Set(we);return F.forEach(se=>{xe?de.add(se.value):de.delete(se.value)}),de})},J=xe=>{w(we=>{const de=new Set(we);return de.has(xe)?de.delete(xe):de.add(xe),de})},ee=()=>{u(n,wie({selectedValues:Array.from(b),textFilter:{operator:x,value:T},numberFilter:{operator:M,value:O,valueTo:L}},p))},N=()=>{u(n,void 0)},q=(o==null?void 0:o.columnIndex)===n?o:null;return h.jsxs("div",{ref:l,id:e,className:at.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[h.jsx("div",{id:`${e}-title`,className:at.filterMenuTitle,children:t}),h.jsx(vie,{columnIndex:n,sortedThisColumn:q,onSort:m}),c&&h.jsx(xie,{onHideColumn:()=>f(n)}),h.jsx(_ie,{columnIndex:n,columnName:t,search:y,searchInputRef:B,filteredOptions:F,visibleOptions:W,selectedValues:b,allFilteredSelected:j,onSearchChange:v,onFilteredSelectionChange:K,onToggleValue:J}),h.jsx(kie,{columnIndex:n,columnName:t,isNumeric:s,textOperator:x,textValue:T,numberOperator:M,numberValue:O,numberValueTo:L,onTextOperatorChange:k,onTextValueChange:A,onNumberOperatorChange:D,onNumberValueChange:C,onNumberValueToChange:I}),h.jsx(Sie,{onClear:N,onClose:d,onApply:ee})]})}function Cie({children:e,fallback:t,toolbarExtra:n}){const{t:r}=lt(),s=g.useMemo(()=>cie(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>tie||s.columnCount>nie?h.jsx(h.Fragment,{children:t??h.jsx("table",{children:e})}):h.jsx(Aie,{table:s,toolbarExtra:n})}function Aie({table:e,toolbarExtra:t}){const{t:n}=lt(),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),[w,x]=g.useState(!1),[k,T]=g.useState(!1),A=g.useRef(!1),M=g.useRef(null),D=g.useRef(null),O=g.useRef(0),C=g.useRef(0),L=g.useRef(!0),I=g.useRef(null),B=g.useRef(null),F=g.useRef(null),W=g.useRef(null),j=g.useRef(0),K=g.useRef(null),J=g.useRef(0),ee=g.useMemo(()=>`${e.columnCount}\0${e.headers.map(he=>he.text).join("\0")}`,[e.columnCount,e.headers]),N=g.useRef(ee),q=g.useCallback(()=>{j.current&&cancelAnimationFrame(j.current),j.current=requestAnimationFrame(()=>{j.current=0;const he=W.current;he!=null&&he.isConnected&&he.focus()})},[]),P=g.useCallback(()=>{d(null),q()},[q]),E=g.useCallback(()=>{O.current+=1,M.current&&(clearTimeout(M.current),M.current=null),x(!1)},[]),ne=g.useCallback(()=>{C.current+=1,D.current&&(clearTimeout(D.current),D.current=null),T(!1)},[]),pe=g.useCallback(()=>{J.current&&(cancelAnimationFrame(J.current),J.current=0);const he=K.current;K.current=null,he&&c(X=>X&&{...X,focusRow:he.rowIndex,focusCol:he.columnIndex})},[]),be=g.useCallback(()=>{pe(),A.current=!1,b(!1)},[pe]);g.useEffect(()=>{const he=()=>{document.hidden&&be()};return window.addEventListener("mouseup",be),window.addEventListener("blur",be),document.addEventListener("visibilitychange",he),()=>{window.removeEventListener("mouseup",be),window.removeEventListener("blur",be),document.removeEventListener("visibilitychange",he),J.current&&cancelAnimationFrame(J.current),j.current&&cancelAnimationFrame(j.current)}},[be]),g.useEffect(()=>{N.current!==ee&&(N.current=ee,i(null),a({}),c(null),d(null),m(new Set),y(null),E(),ne(),A.current=!1,b(!1))},[ne,E,ee]),g.useEffect(()=>{ne()},[ne,l]),g.useEffect(()=>(L.current=!0,()=>{L.current=!1,M.current&&(clearTimeout(M.current),M.current=null),D.current&&(clearTimeout(D.current),D.current=null)}),[]),g.useEffect(()=>{if(!u)return;const he=We=>{var jt,dt;const At=We.target;!((jt=F.current)!=null&&jt.contains(At))&&!((dt=W.current)!=null&&dt.contains(At))&&d(null)},X=We=>{var ln;if(We.key==="Escape"){P();return}if(We.key!=="Tab")return;const At=F.current,jt=document.activeElement;if(!At||!(jt instanceof Node)||!At.contains(jt))return;const dt=sie(At);if(dt.length===0)return;const Wt=jt instanceof HTMLElement?dt.indexOf(jt):-1,Rn=We.shiftKey?Wt<=0?dt.length-1:Wt-1:Wt===-1||Wt===dt.length-1?0:Wt+1;We.preventDefault(),(ln=dt[Rn])==null||ln.focus()},ue=We=>{var jt;const At=We.target;At instanceof Node&&((jt=F.current)!=null&&jt.contains(At))||d(null)},me=()=>d(null);return document.addEventListener("mousedown",he),document.addEventListener("keydown",X),document.addEventListener("scroll",ue,!0),window.addEventListener("resize",me),()=>{document.removeEventListener("mousedown",he),document.removeEventListener("keydown",X),document.removeEventListener("scroll",ue,!0),window.removeEventListener("resize",me)}},[P,u]);const xe=g.useMemo(()=>U9(e.rows,o),[o,e.rows]),we=g.useMemo(()=>pie(xe,s),[xe,s]),de=g.useMemo(()=>{if(!u)return[];const he=u.columnIndex;return gie(U9(e.rows,o,he),he,n("markdownTable.blank"))},[o,u,n,e.rows]),se=g.useMemo(()=>e.headers.map((he,X)=>yie(e.rows,X)),[e.headers,e.rows]),ae=g.useMemo(()=>e.headers.map((he,X)=>X).filter(he=>!f.has(he)),[f,e.headers]);g.useEffect(()=>{E()},[E,ae,we]),g.useEffect(()=>{p&&!we.some(he=>he.key===p)&&y(null)},[p,we]);const _e=(he,X)=>{c(null),a(ue=>{const me={...ue};return X&&pm(X)?me[he]=X:delete me[he],me}),P()},qe=(he,X)=>{c(null),i(X?{columnIndex:he,direction:X}:null)},He=he=>{c(null),i(X=>(X==null?void 0:X.columnIndex)!==he?{columnIndex:he,direction:"asc"}:X.direction==="asc"?{columnIndex:he,direction:"desc"}:null)},re=(he,X)=>{c(null),W.current=he.currentTarget;const ue=he.currentTarget.getBoundingClientRect(),me=300,We=430,At={columnIndex:X,left:Math.max(6,Math.min(ue.right-me,window.innerWidth-me-6)),top:window.innerHeight-ue.bottom<We?Math.max(8,ue.top-We-2):ue.bottom+2};d(jt=>(jt==null?void 0:jt.columnIndex)===X?null:At)},ye=he=>{ae.length<=1||(c(null),P(),a(X=>{const ue={...X};return delete ue[he],ue}),i(X=>(X==null?void 0:X.columnIndex)===he?null:X),m(X=>{const ue=new Set(X);return ue.add(he),ue}))},Te=()=>{c(null),m(new Set)},ke=he=>{c(null),y(X=>X===he?null:he)},vt=g.useMemo(()=>l?H5(l):null,[l]),rt=(he,X)=>{if(!vt)return!1;const{minRow:ue,maxRow:me,minCol:We,maxCol:At}=vt;return he>=ue&&he<=me&&X>=We&&X<=At},Mt=(he,X)=>{u!==null&&d(null),A.current=!0,c({anchorRow:he,anchorCol:X,focusRow:he,focusCol:X})},Pt=(he,X,ue)=>{var me;he.button!==0||F9(he.target)||(he.preventDefault(),(me=B.current)==null||me.focus({preventScroll:!0}),Mt(X,ue))},Ze=(he,X)=>{A.current&&(b(!0),K.current={rowIndex:he,columnIndex:X},!J.current&&(J.current=requestAnimationFrame(()=>{J.current=0;const ue=K.current;K.current=null,ue&&c(me=>me&&{...me,focusRow:ue.rowIndex,focusCol:ue.columnIndex})})))},bt=he=>{var At;const X=document.elementFromPoint(he.clientX,he.clientY),ue=X==null?void 0:X.closest("[data-row-index][data-column-index]");if(!ue||!((At=I.current)!=null&&At.contains(ue)))return null;const me=Number(ue.dataset.rowIndex),We=Number(ue.dataset.columnIndex);return!Number.isInteger(me)||!Number.isInteger(We)?null:{rowIndex:me,columnIndex:We}},ft=(he,X,ue)=>{he.touches.length!==1||F9(he.target)||Mt(X,ue)},ie=he=>{if(!A.current||he.touches.length!==1)return;const X=he.touches[0];if(!X)return;const ue=bt(X);ue&&(he.preventDefault(),Ze(ue.rowIndex,ue.columnIndex))},H=()=>{const he=q9(l,we,ae);if(!he||!navigator.clipboard)return;const X=C.current;navigator.clipboard.writeText(he).then(()=>{L.current&&C.current===X&&(D.current&&clearTimeout(D.current),T(!0),D.current=setTimeout(()=>T(!1),2e3))}).catch(ue=>console.warn("[web-shell] clipboard write failed:",ue))},oe=()=>{const he=uie(e.headers,we,ae);if(!he||!navigator.clipboard)return;const X=O.current;navigator.clipboard.writeText(he).then(()=>{L.current&&O.current===X&&(M.current&&clearTimeout(M.current),x(!0),M.current=setTimeout(()=>x(!1),2e3))}).catch(ue=>console.warn("[web-shell] clipboard write failed:",ue))},De=he=>{if(iie())return;const X=q9(l,we,ae);X&&(he.preventDefault(),he.clipboardData.setData("text/plain",X))},tt=die(l,ae),Ct=Object.values(o).filter(pm).length,Et=we.length===e.rows.length?n("markdownTable.rows",{count:e.rows.length}):n("markdownTable.rowsFiltered",{visible:we.length,total:e.rows.length}),Qt=u===null?void 0:e.headers[u.columnIndex],on=Qt&&u?Qt.text||n("markdownTable.column",{index:u.columnIndex+1}):"";return h.jsxs("div",{ref:I,className:`${at.tableShell} ${v?at.dragging:""}`,children:[h.jsxs("div",{className:at.toolbar,children:[h.jsx("span",{className:at.summary,children:Et}),h.jsx("span",{className:at.hint,children:n("markdownTable.hint")}),h.jsx("button",{className:at.copyButton,type:"button",onClick:oe,children:w?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:at.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyVisible")}),f.size>0&&h.jsx("button",{className:at.copyButton,type:"button",onClick:Te,children:n("markdownTable.showHiddenColumns",{count:f.size})}),Ct>0&&h.jsx("span",{className:at.selection,children:n("markdownTable.filtersActive",{count:Ct})}),tt>0&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:at.selection,children:n("markdownTable.cellsSelected",{count:tt})}),h.jsx("button",{className:at.copyButton,type:"button",onClick:H,children:k?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:at.copyCheck,children:"✓"}),n("code.copied")]}):n("markdownTable.copyTsv")})]}),t]}),h.jsxs("div",{ref:B,className:at.scroller,tabIndex:0,onCopy:De,children:[h.jsxs("table",{className:at.table,children:[h.jsx("thead",{children:h.jsxs("tr",{children:[h.jsx("th",{className:`${at.headerCell} ${at.actionHeaderCell}`,children:n("markdownTable.actions")}),ae.map(he=>{const X=e.headers[he];if(!X)return null;const ue=(s==null?void 0:s.columnIndex)===he,me=pm(o[he]),We=(u==null?void 0:u.columnIndex)===he,At=ue?s.direction==="asc"?"↑":"↓":"↕",jt=X.text||n("markdownTable.column",{index:he+1}),dt=ue?n(s.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:jt}):n("markdownTable.sortByColumn",{column:jt}),Wt=ue?s.direction==="asc"?"ascending":"descending":"none",Rn=`${r}-filter-${he}`,ln=X.textAlign?{textAlign:X.textAlign}:void 0;return h.jsx("th",{className:at.headerCell,"aria-sort":Wt,style:ln,children:h.jsxs("div",{className:at.headerControls,children:[h.jsxs("button",{className:at.headerButton,type:"button",onClick:()=>He(he),"aria-label":dt,style:ln,children:[h.jsx("span",{className:at.headerText,style:ln,children:X.content}),h.jsx("span",{className:at.sortIcon,"aria-hidden":"true",children:At})]}),h.jsx("button",{className:`${at.filterTrigger} ${me?at.filterTriggerActive:""}`,type:"button",onClick:xn=>re(xn,he),"aria-label":n("markdownTable.filterColumn",{column:jt}),"aria-expanded":We,"aria-controls":We?Rn:void 0,children:"▾"})]})},X.key)})]})}),h.jsx("tbody",{children:we.map((he,X)=>{const ue=p===he.key,me=`${r}-detail-${he.key}`;return h.jsxs(g.Fragment,{children:[h.jsxs("tr",{className:X%2===1?at.evenRow:void 0,children:[h.jsx("td",{className:`${at.cell} ${at.actionCell}`,children:h.jsx("button",{className:at.rowDetailButton,type:"button",onClick:()=>ke(he.key),"aria-expanded":ue,"aria-controls":me,"aria-label":n(ue?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:X+1}),children:n("markdownTable.rowDetails")})}),ae.map(We=>{const At=he.cells[We];if(!At)return null;const jt=At.textAlign?{textAlign:At.textAlign}:void 0;return h.jsx("td",{className:`${at.cell} ${rt(X,We)?at.selectedCell:""}`,style:jt,"data-row-index":X,"data-column-index":We,onMouseDown:dt=>Pt(dt,X,We),onMouseEnter:()=>Ze(X,We),onTouchStart:dt=>ft(dt,X,We),onTouchMove:ie,onTouchEnd:be,onTouchCancel:be,children:At.content},At.key)})]}),ue&&h.jsx("tr",{id:me,className:at.detailRow,children:h.jsx("td",{className:at.detailCell,colSpan:ae.length+1,children:h.jsxs("div",{className:at.detailPanel,children:[h.jsx("div",{className:at.detailTitle,children:n("markdownTable.detailsHeader")}),ae.map(We=>{const At=e.headers[We],jt=he.cells[We];if(!At||!jt)return null;const dt=At.textAlign?{textAlign:At.textAlign}:void 0,Wt=jt.textAlign?{textAlign:jt.textAlign}:void 0;return h.jsxs("div",{className:at.detailItem,children:[h.jsx("div",{className:at.detailLabel,style:dt,children:At.content}),h.jsx("div",{className:at.detailValue,style:Wt,children:jt.content})]},`${he.key}-detail-${We}`)})]})})})]},he.key)})})]}),we.length===0&&h.jsx("div",{className:at.emptyState,children:e.rows.length===0?n("markdownTable.empty"):n("markdownTable.emptyFiltered")})]}),u&&Qt&&h.jsx(Tie,{id:`${r}-filter-${u.columnIndex}`,columnName:on,columnIndex:u.columnIndex,filter:o[u.columnIndex],isNumeric:se[u.columnIndex]??!1,options:de,sort:s,style:{left:u.left,top:u.top},menuRef:F,canHideColumn:ae.length>1,onApply:_e,onClose:P,onHideColumn:ye,onSort:qe},u.columnIndex)]})}const Eie="_content_n5mo3_1",Mie="_inlineCode_n5mo3_127",Iie="_link_n5mo3_139",Nie="_tableWrapper_n5mo3_149",Rie="_table_n5mo3_149",Lie="_image_n5mo3_179",jie="_codeBlock_n5mo3_187",Die="_codeBlockHeader_n5mo3_196",Oie="_codeBlockLang_n5mo3_206",Bie="_codeBlockCopy_n5mo3_214",Pie="_codeBlockContent_n5mo3_232",$ie="_codeBlockPlain_n5mo3_251",zie="_mermaidBlock_n5mo3_269",Fie="_mermaidInline_n5mo3_281",qie="_mermaidLoading_n5mo3_300",Uie="_mermaidActions_n5mo3_307",An={content:Eie,inlineCode:Mie,link:Iie,tableWrapper:Nie,table:Rie,image:Lie,codeBlock:jie,codeBlockHeader:Die,codeBlockLang:Oie,codeBlockCopy:Bie,codeBlockContent:Pie,codeBlockPlain:$ie,mermaidBlock:zie,mermaidInline:Fie,mermaidLoading:qie,mermaidActions:Uie},Hie=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"]),H9={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 Vie(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(H9,t)?H9[t]:t,r=Hie.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:r}}const Ej=/^(https?:|mailto:)/i,Wie=/^data:image\/(png|jpeg|gif|webp);base64,/i;function Gie(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:Ej.test(t):!1}function Mj(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||Wie.test(t)?!0:Ej.test(t):!1}let V9,Kie=0;function Yie({code:e}){const{t}=lt(),n=Q_(),[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(()=>{U(()=>import("./mermaid.core-xe6bvMRz.js").then(y=>y.bm),[]).then(async y=>{if(m)return;const v=y.default;V9!==d&&(v.initialize({startOnLoad:!1,theme:d,securityLevel:"strict",suppressErrorRendering:!0}),V9=d);try{const b=`mermaid-${++Kie}`,{svg:w}=await v.render(b,e.trim());m||s(w)}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:An.codeBlock,children:[h.jsx("div",{className:An.codeBlockHeader,children:h.jsx("span",{className:An.codeBlockLang,children:"mermaid (error)"})}),h.jsx("pre",{className:`${An.codeBlockContent} ${An.codeBlockPlain}`,children:h.jsx("code",{children:e})})]}):h.jsxs("div",{className:An.codeBlock,children:[h.jsxs("div",{className:An.codeBlockHeader,children:[h.jsx("span",{className:An.codeBlockLang,children:"mermaid"}),h.jsxs("span",{className:An.mermaidActions,children:[h.jsx("button",{className:An.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),h.jsx("button",{className:An.codeBlockCopy,onClick:f,children:t(c?"code.copied":"code.copy")})]})]}),a==="code"?h.jsx("pre",{className:`${An.codeBlockContent} ${An.codeBlockPlain}`,children:h.jsx("code",{children:e})}):r?h.jsx("div",{className:`${An.mermaidBlock} ${An.mermaidInline}`,dangerouslySetInnerHTML:{__html:r}}):h.jsx("div",{className:`${An.mermaidBlock} ${An.mermaidLoading} ${An.mermaidInline}`,children:h.jsx("span",{children:t("mermaid.rendering")})})]})}function Xie({className:e,children:t,isStreaming:n}){const{t:r}=lt(),s=Q_(),[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}=Vie(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"||nse(m)){o(null);return}const v=Qre(m,f,p);if(v!==null){o(v);return}const b=!n,w=z9(m,f,p,b);if(w!==null){o(w);return}o(null);let x=!1;return Zre(f).then(()=>{if(x)return;const k=z9(m,f,p,b);k!==null&&o(k)}).catch(k=>{x||(console.warn("[web-shell] highlight failed for lang=%s",f,k),o(null))}),()=>{x=!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(Yie,{code:m}):h.jsxs("div",{className:An.codeBlock,children:[h.jsxs("div",{className:An.codeBlockHeader,children:[h.jsx("span",{className:An.codeBlockLang,children:u}),h.jsx("button",{className:An.codeBlockCopy,onClick:y,children:r(a?"code.copied":"code.copy")})]}),i!==null?h.jsx("div",{className:An.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):h.jsx("pre",{className:`${An.codeBlockContent} ${An.codeBlockPlain}`,children:h.jsx("code",{children:m})})]})}function Qie({children:e}){return h.jsx("code",{className:An.inlineCode,children:e})}function W9({children:e}){return h.jsx("div",{className:An.tableWrapper,children:h.jsx("table",{className:An.table,children:e})})}class Jie extends g.Component{constructor(){super(...arguments);le(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 Ij=g.createContext(!1);function Zie({className:e,children:t}){const n=g.useContext(Ij);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?h.jsx(Xie,{className:e,isStreaming:n,children:String(t)}):h.jsx(Qie,{children:t})}function eoe({children:e}){return h.jsx(h.Fragment,{children:e})}function toe({href:e,children:t}){const n=Gie(e)?e:void 0;return h.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:An.link,children:t})}function noe({src:e,alt:t}){const n=Mj(e)?e:void 0;return h.jsx("img",{src:n,alt:t||"",className:An.image})}function Nj(e="basic",t=""){return{code:Zie,pre:eoe,a:toe,img:noe,table({children:n}){if(e==="advanced"){const r=h.jsx(W9,{children:n});return h.jsx(Jie,{fallback:r,resetKey:t,children:h.jsx(Cie,{fallback:r,children:n})})}return h.jsx(W9,{children:n})}}}const roe=Nj(),I0=g.memo(function({content:t,source:n,isStreaming:r,tableMode:s}){const{markdown:i,markdownTableMode:o}=Lc(),a=n?i:void 0,l=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,c=r?"basic":s??o??"basic",u=g.useMemo(()=>c==="advanced"?Nj("advanced",l):roe,[c,l]),d=a==null?void 0:a.components,f=g.useMemo(()=>d?{...u,...d,...c==="advanced"?{table:u.table}:{}}:u,[u,c,d]);if(!t)return null;const m=a!=null&&a.remarkPlugins?[C7,h9,...a.remarkPlugins]:[C7,h9],p=a!=null&&a.rehypePlugins?[x9,...a.rehypePlugins]:[x9];return h.jsx("div",{className:n!=="thinking"?An.content:void 0,"data-markdown-source":n,children:h.jsx(Ij.Provider,{value:!!r,children:h.jsx(uX,{remarkPlugins:m,rehypePlugins:p,components:f,children:l})})})}),soe="_chatMessageRow_1majp_41",ioe="_chatBubble_1majp_48",ooe="_chatContent_1majp_61",aoe="_chatContentCollapsed_1majp_66",loe="_toggleButton_1majp_71",coe="_toggleIcon_1majp_92",uoe="_toggleIconExpanded_1majp_99",doe="_chatImages_1majp_103",hoe="_chatImageThumb_1majp_110",Pa={chatMessageRow:soe,chatBubble:ioe,chatContent:ooe,chatContentCollapsed:aoe,toggleButton:loe,toggleIcon:coe,toggleIconExpanded:uoe,chatImages:doe,chatImageThumb:hoe},foe=g.memo(function({content:t,images:n}){const{t:r}=lt(),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:Pa.chatMessageRow,children:h.jsxs("div",{className:Pa.chatBubble,children:[h.jsxs("div",{ref:s,className:`${Pa.chatContent} ${a&&!i?Pa.chatContentCollapsed:""}`,children:[n&&n.length>0&&h.jsx("div",{className:Pa.chatImages,children:n.map((u,d)=>{const f=u.data.startsWith("data:")?u.data:`data:${u.mimeType};base64,${u.data}`;return Mj(f)?h.jsx("img",{src:f,alt:`User uploaded image ${d+1}`,className:Pa.chatImageThumb,onLoad:c},d):null})}),t]}),a&&h.jsxs("button",{type:"button",className:Pa.toggleButton,onClick:()=>o(u=>!u),children:[h.jsx("span",{children:r(i?"userMessage.showLess":"userMessage.showMore")}),h.jsx("svg",{className:`${Pa.toggleIcon} ${i?Pa.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"})})]})]})})}),moe="_message_1hsrm_1",poe="_messageFooter_1hsrm_7",goe="_copyButton_1hsrm_23",yoe="_footerTime_1hsrm_49",boe="_thinking_1hsrm_61",woe="_thinkingBody_1hsrm_73",voe="_thinkingSummary_1hsrm_104",xoe="_thinkingSummaryTextActive_1hsrm_126",_oe="_thinkingSummaryIcon_1hsrm_132",koe="_thinkingSummaryText_1hsrm_126",Soe="_thinkingChevronRight_1hsrm_189",Toe="_thinkingChevronDown_1hsrm_190",Coe="_thinkingExpandedWrap_1hsrm_217",Aoe="_thinkingExpandedClip_1hsrm_221",Eoe="_thinkingExpandedCollapsed_1hsrm_229",Moe="_thinkingExpandedInner_1hsrm_233",Ioe="_content_1hsrm_281",Noe="_contentBody_1hsrm_286",xr={message:moe,messageFooter:poe,copyButton:goe,footerTime:yoe,thinking:boe,thinkingBody:woe,thinkingSummary:voe,thinkingSummaryTextActive:xoe,thinkingSummaryIcon:_oe,thinkingSummaryText:koe,thinkingChevronRight:Soe,thinkingChevronDown:Toe,thinkingExpandedWrap:Coe,thinkingExpandedClip:Aoe,thinkingExpandedCollapsed:Eoe,thinkingExpandedInner:Moe,content:Ioe,contentBody:Noe},Roe=g.memo(function({content:t,isStreaming:n,timestamp:r,onBranchSession:s,showFooterActions:i=!1,showBranchAction:o=!1}){const{t:a}=lt(),[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:xr.message,children:[t&&h.jsx("div",{className:xr.content,children:h.jsx("div",{className:xr.contentBody,children:h.jsx(I0,{content:t,source:"assistant",isStreaming:n})})}),u&&h.jsxs("div",{className:xr.messageFooter,children:[h.jsx("button",{type:"button",className:xr.copyButton,title:a("assistant.copy"),"aria-label":a("assistant.copy"),onClick:d,children:l?h.jsx(joe,{}):h.jsx(Loe,{})}),o&&s&&h.jsx("button",{type:"button",className:xr.copyButton,title:a("assistant.branch"),"aria-label":a("assistant.branch"),onClick:s,children:h.jsx(Doe,{})}),r!==void 0&&h.jsx("span",{className:xr.footerTime,"aria-hidden":"true",children:dh(r)})]})]})});function Loe(){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 joe(){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 Doe(){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 Ooe=g.memo(function({content:t,isStreaming:n,timestamp:r}){const{t:s}=lt(),i=g.useContext(Gh),[o,a]=g.useState(!1),l=Boe({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 w=setInterval(()=>m(Date.now()),1e3);return()=>clearInterval(w)},[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?Poe((c?f:p)-u.current):"",b=g.useCallback(()=>{a(w=>!w)},[]);return h.jsx("div",{className:xr.message,children:t&&!i&&h.jsx("div",{className:xr.thinking,children:h.jsxs("div",{className:xr.thinkingBody,children:[h.jsxs("button",{type:"button",className:xr.thinkingSummary,onClick:b,"aria-expanded":o,title:s(o?"thinking.collapse":"thinking.expand"),children:[h.jsx("span",{className:xr.thinkingSummaryIcon,"aria-hidden":"true",children:h.jsx($oe,{})}),h.jsx("span",{className:c?`${xr.thinkingSummaryText} ${xr.thinkingSummaryTextActive}`:xr.thinkingSummaryText,children:s(l,c?{duration:v}:{})}),h.jsx("span",{className:o?xr.thinkingChevronDown:xr.thinkingChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:o?xr.thinkingExpandedClip:`${xr.thinkingExpandedClip} ${xr.thinkingExpandedCollapsed}`,children:h.jsx("div",{className:xr.thinkingExpandedInner,children:h.jsx("div",{className:xr.thinkingExpandedWrap,children:h.jsx(I0,{content:t,source:"thinking",isStreaming:n})})})})]})})})});function Boe({isStreaming:e}){return e?"thinking.running":"thinking.done"}function Poe(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 $oe(){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 zoe="_panel_8ng9u_1",Foe="_title_8ng9u_16",qoe="_metaLine_8ng9u_22",Uoe="_progress_8ng9u_32",Hoe="_spacer_8ng9u_38",Voe="_row_8ng9u_42",Woe="_detailRow_8ng9u_43",Goe="_subDetailRow_8ng9u_44",Koe="_symbol_8ng9u_65",Yoe="_label_8ng9u_69",Xoe="_value_8ng9u_73",Qoe="_detailName_8ng9u_80",Joe="_sectionTitle_8ng9u_88",Zoe="_detailSection_8ng9u_94",eae="_skillBlock_8ng9u_100",tae="_hint_8ng9u_105",nae="_detailCommand_8ng9u_111",rae="_bodyLoaded_8ng9u_132",sae="_accent_8ng9u_137",iae="_secondary_8ng9u_141",oae="_warning_8ng9u_145",aae="_error_8ng9u_149",lae="_success_8ng9u_153",Bt={panel:zoe,title:Foe,metaLine:qoe,progress:Uoe,spacer:Hoe,row:Voe,detailRow:Woe,subDetailRow:Goe,symbol:Koe,label:Yoe,value:Xoe,detailName:Qoe,sectionTitle:Joe,detailSection:Zoe,skillBlock:eae,hint:tae,detailCommand:nae,bodyLoaded:rae,accent:sae,secondary:iae,warning:oae,error:aae,success:lae},xx="web-shell:context-usage:v1:",Rl="█",Rj="▒",Lj="░",jj=30;function cae(e){return`${xx}${JSON.stringify(e)}`}function uae(e){if(!e.startsWith(xx))return null;try{const t=JSON.parse(e.slice(xx.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function Dj(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function yh(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function dae(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function hae(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function fae({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?Bt.error:e>60?Bt.warning:Bt.accent;return h.jsxs("div",{className:Bt.progress,"aria-hidden":"true",children:[h.jsx("span",{className:o,children:Rl.repeat(Math.max(0,r))}),h.jsx("span",{className:Bt.secondary,children:Lj.repeat(Math.max(0,i))}),h.jsx("span",{className:Bt.warning,children:Rj.repeat(Math.max(0,s))})]})}function $a({symbol:e,label:t,tokens:n,tokenLabel:r,contextWindowSize:s,symbolClassName:i=Bt.secondary,isOverLimit:o}){return h.jsxs("div",{className:Bt.row,children:[h.jsx("span",{className:`${Bt.symbol} ${i}`,children:e}),h.jsx("span",{className:Bt.label,children:t}),h.jsxs("span",{className:o?Bt.error:Bt.value,children:[yh(n)," ",r," (",dae(n,s),"%)"]})]})}const Aw="/context detail";function mae({hint:e,onShowDetail:t}){const n=t?e.indexOf(Aw):-1;return n<0?h.jsx("div",{className:Bt.hint,children:e}):h.jsxs("div",{className:Bt.hint,children:[e.slice(0,n),h.jsx("button",{type:"button",className:Bt.detailCommand,onClick:t,children:Aw}),e.slice(n+Aw.length)]})}function pae({name:e,tokens:t,tokenLabel:n}){return h.jsxs("div",{className:Bt.detailRow,children:[h.jsxs("span",{className:Bt.secondary,children:["└"," "]}),h.jsx("span",{className:Bt.detailName,title:e,children:Dj(e,jj)}),h.jsxs("span",{className:Bt.value,children:[yh(t)," ",n]})]})}function Ew({title:e,items:t,getName:n,tokenLabel:r}){const s=hae(t);return s.length===0?null:h.jsxs("section",{className:Bt.detailSection,children:[h.jsx("div",{className:Bt.sectionTitle,children:e}),s.map(i=>h.jsx(pae,{name:n(i),tokens:i.tokens,tokenLabel:r},n(i)))]})}function gae({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:Bt.detailSection,children:[h.jsx("div",{className:Bt.sectionTitle,children:t.skills}),n.map(r=>h.jsxs("div",{className:Bt.skillBlock,children:[h.jsxs("div",{className:Bt.detailRow,children:[h.jsxs("span",{className:Bt.secondary,children:["└"," "]}),h.jsxs("span",{className:Bt.detailName,title:r.name,children:[Dj(r.name,jj),r.loaded&&h.jsxs("span",{className:Bt.success,children:[" ",t.active]})]}),h.jsxs("span",{className:Bt.value,children:[yh(r.tokens)," ",t.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&h.jsxs("div",{className:Bt.subDetailRow,children:[h.jsxs("span",{className:Bt.secondary,children:["  └"," "]}),h.jsx("span",{className:Bt.bodyLoaded,children:t.bodyLoaded}),h.jsxs("span",{className:Bt.success,children:["+",yh(r.bodyTokens)," ",t.tokens]})]})]},r.name))]})}function yae({status:e,onShowDetail:t}){const{t:n}=lt(),{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:Bt.panel,children:[h.jsx("div",{className:Bt.title,children:n("contextUsage.title")}),r.isEstimated?h.jsx(h.Fragment,{children:h.jsxs("div",{className:Bt.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",yh(i)," ",n("contextUsage.tokens")]})]})}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:Bt.metaLine,children:[h.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),h.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",yh(i)," ",n("contextUsage.tokens")]})]}),a&&h.jsx("div",{className:Bt.error,children:n("contextUsage.overLimit")})]}),h.jsx(fae,{usedPercentage:Math.min(o,100),bufferPercentage:l}),h.jsx("div",{className:Bt.spacer}),h.jsx($a,{symbol:Rl,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?Bt.error:Bt.accent,isOverLimit:a}),h.jsx($a,{symbol:Lj,label:n("contextUsage.free"),tokens:s.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),h.jsx($a,{symbol:Rj,label:n("contextUsage.autocompactBuffer"),tokens:s.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bt.warning}),h.jsx("div",{className:Bt.spacer}),h.jsx("div",{className:Bt.sectionTitle,children:n("contextUsage.usageByCategory")}),h.jsx($a,{symbol:Rl,label:n("contextUsage.systemPrompt"),tokens:s.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bt.accent}),h.jsx($a,{symbol:Rl,label:n("contextUsage.builtinTools"),tokens:s.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bt.accent}),s.mcpTools>0&&h.jsx($a,{symbol:Rl,label:n("contextUsage.mcpTools"),tokens:s.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bt.accent}),h.jsx($a,{symbol:Rl,label:n("contextUsage.memoryFiles"),tokens:s.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bt.accent}),h.jsx($a,{symbol:Rl,label:n("contextUsage.skills"),tokens:s.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bt.accent}),!r.isEstimated&&h.jsx($a,{symbol:Rl,label:n("contextUsage.messages"),tokens:s.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bt.accent}),r.showDetails?h.jsxs(h.Fragment,{children:[h.jsx(Ew,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(Ew,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:c=>"name"in c?c.name:c.path,tokenLabel:n("contextUsage.tokens")}),h.jsx(Ew,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:c=>"path"in c?c.path:c.name,tokenLabel:n("contextUsage.tokens")}),h.jsx(gae,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):h.jsx(mae,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const bae={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 Oj(e){if(!e.trim())return"Tool";const t=bae[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function xl(e,t){const n=Oj(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 Uh(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Ls(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const _x=2e3;function Bj(e,t){const n=vae(e,t);if(n)return Ls(n,_x);const r=xae(e,t);return r?Ls(r,_x):""}function ya(e){var t;if(!e.content)return Sx(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return Sx(e.rawOutput)}function wae(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=G9((Sx(e.rawOutput)??"").trim());if(o)return o}const n=ya(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(kc(t)){if(s>3)return`${s} lines of output`;const o=r[0]||"";return Ls(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=G9(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 Ls(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(Uh(t))return"";const i=r[0]||"";return Ls(i,80)}function vae(e,t){if(!e.title)return null;const n=Oj(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 K9(o.replace(/^:\s*|\s+/,""),t)}return K9(r,t)}function G9(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function xae(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 ${Ld(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," ")})`),Ls(s,_x)}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):Ld(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} — "${Ls(i,40)}"`:s;return Ls(o,80)}if(n.path)return Ld(String(n.path),t);if(n.query)return Ls(String(n.query),60);if(r==="list_directory"||r==="listfiles"){const s=n.path||n.directory||"";return Ld(String(s),t)}return n.description?String(n.description):""}function kc(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function fl(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(r=>fl(r,t)))??!1}function K9(e,t){const n=e.trim();return Pj(kx(n))?Ld(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>Ld(r,t))}function Ld(e,t){const n=kx(e),r=t?kx(t).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":Pj(n)?_ae(n):n}function kx(e){return e.replace(/\\/g,"/")}function Pj(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function _ae(e){return e.replace(/\/+$/,"").split("/").pop()||e}function N0(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function V5(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 Gm(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=V5(e);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":e.status}function W5(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const kae="general-purpose";function G5(e){var r;const t=N0(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":kae}function K5(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=N0(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 Sae(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=xl(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 Ls(s,50)}function Sx(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 Tae="_panel_1xezz_1",Cae="_title_1xezz_17",Aae="_sectionTitle_1xezz_23",Eae="_spacer_1xezz_29",Mae="_pivotRow_1xezz_35",Iae="_metricCell_1xezz_41",Nae="_metricCellSection_1xezz_48",Rae="_metricCellSub_1xezz_56",Lae="_modelCell_1xezz_64",jae="_modelCellHeader_1xezz_71",Dae="_divider_1xezz_79",Oae="_kvRow_1xezz_87",Bae="_kvSubRow_1xezz_94",Pae="_kvLabel_1xezz_102",$ae="_kvValue_1xezz_106",zae="_tableRow_1xezz_115",Fae="_tableNameCol_1xezz_121",qae="_tableToolCol_1xezz_129",Uae="_tableNumCol_1xezz_137",Hae="_success_1xezz_147",Vae="_error_1xezz_151",Wae="_secondary_1xezz_155",Gae="_warning_1xezz_159",Fe={panel:Tae,title:Cae,sectionTitle:Aae,spacer:Eae,pivotRow:Mae,metricCell:Iae,metricCellSection:Nae,metricCellSub:Rae,modelCell:Lae,modelCellHeader:jae,divider:Dae,kvRow:Oae,kvSubRow:Bae,kvLabel:Pae,kvValue:$ae,tableRow:zae,tableNameCol:Fae,tableToolCol:qae,tableNumCol:Uae,success:Hae,error:Vae,secondary:Wae,warning:Gae},Tx="web-shell:session-stats:v1:";function Kae(e,t="overview"){return`${Tx}${JSON.stringify({_view:t,...e})}`}function Yae(e){if(!e.startsWith(Tx))return null;try{const t=JSON.parse(e.slice(Tx.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 fc(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 iu({label:e,children:t}){return h.jsxs("div",{className:Fe.kvRow,children:[h.jsx("span",{className:Fe.kvLabel,children:e}),h.jsx("span",{className:Fe.kvValue,children:t})]})}function gm({label:e,children:t}){return h.jsxs("div",{className:Fe.kvSubRow,children:[h.jsxs("span",{className:Fe.secondary,children:["»"," ",e]}),h.jsx("span",{className:Fe.kvValue,children:t})]})}function $j(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 Xae(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function Qae(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function Jae(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function Yo({metric:e,values:t,variant:n="normal"}){const r=n==="section"?Fe.metricCellSection:n==="sub"?Fe.metricCellSub:Fe.metricCell;return h.jsxs("div",{className:Fe.pivotRow,children:[h.jsx("span",{className:r,children:n==="sub"?`↳ ${e}`:e}),t.map((s,i)=>h.jsx("span",{className:Fe.modelCell,children:s},i))]})}function Zae({status:e}){const{t}=lt(),{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=$j(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:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.title")}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.overview")}),h.jsx(iu,{label:t("stats.duration"),children:fc(e.durationMs)}),h.jsx(iu,{label:t("stats.prompts"),children:e.promptCount}),h.jsx(iu,{label:t("stats.toolCalls"),children:h.jsxs("span",{children:[r.totalCalls," ",h.jsx("span",{className:Fe.secondary,children:"("}),h.jsxs("span",{className:Fe.success,children:["✓",r.totalSuccess]})," ",h.jsxs("span",{className:Fe.error,children:["✗",r.totalFail]}),h.jsx("span",{className:Fe.secondary,children:")"})]})}),h.jsx(iu,{label:t("stats.successRate"),children:h.jsxs("span",{className:u>=90?Fe.success:u>=70?Fe.warning:Fe.error,children:[u.toFixed(1),"%"]})}),(s.totalLinesAdded>0||s.totalLinesRemoved>0)&&h.jsx(iu,{label:t("stats.codeChanges"),children:h.jsxs("span",{children:[h.jsxs("span",{className:Fe.success,children:["+",s.totalLinesAdded]})," ",h.jsxs("span",{className:Fe.error,children:["-",s.totalLinesRemoved]})]})}),h.jsx("div",{className:Fe.spacer}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.performance")}),h.jsxs(gm,{label:t("stats.apiTime"),children:[fc(i)," ",h.jsxs("span",{className:Fe.secondary,children:["(",l.toFixed(1),"%)"]})]}),h.jsxs(gm,{label:t("stats.toolTime"),children:[fc(o)," ",h.jsxs("span",{className:Fe.secondary,children:["(",c.toFixed(1),"%)"]})]}),d.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Fe.spacer}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.modelUsage")}),h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{className:Fe.tableRow,children:[h.jsx("span",{className:Fe.tableNameCol,children:t("stats.modelUsage")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.reqs")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.inputTokens")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.outputTokens")})]}),h.jsx("div",{className:Fe.divider}),d.map(y=>h.jsxs("div",{className:Fe.tableRow,children:[h.jsx("span",{className:Fe.tableNameCol,children:y.label}),h.jsx("span",{className:Fe.tableNumCol,children:y.metrics.api.totalRequests}),h.jsx("span",{className:`${Fe.tableNumCol} ${Fe.warning}`,children:y.metrics.tokens.prompt.toLocaleString()}),h.jsx("span",{className:`${Fe.tableNumCol} ${Fe.warning}`,children:y.metrics.tokens.candidates.toLocaleString()})]},y.key)),p>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{children:[h.jsx("span",{className:Fe.success,children:t("stats.savingsHighlight")})," ",f.toLocaleString()," (",p.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),h.jsxs("div",{className:Fe.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function ele({status:e}){const{t}=lt(),n=$j(e.models);if(n.length===0)return h.jsxs("div",{className:Fe.panel,children:[h.jsx("div",{className:Fe.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:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.modelStats")}),h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{className:Fe.pivotRow,children:[h.jsx("span",{className:Fe.metricCellSection,children:t("stats.metric")}),n.map(o=>h.jsx("span",{className:Fe.modelCellHeader,children:o.label},o.key))]}),h.jsx("div",{className:Fe.divider}),h.jsx(Yo,{metric:t("stats.api"),values:[],variant:"section"}),h.jsx(Yo,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),h.jsx(Yo,{metric:t("stats.errors"),values:i(o=>{const a=Xae(o);return h.jsxs("span",{className:o.api.totalErrors>0?Fe.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),h.jsx(Yo,{metric:t("stats.avgLatency"),values:i(o=>fc(Qae(o)))}),h.jsx("div",{className:Fe.spacer}),h.jsx(Yo,{metric:t("stats.tokens"),values:[],variant:"section"}),h.jsx(Yo,{metric:t("stats.total"),values:i(o=>h.jsx("span",{className:Fe.warning,children:o.tokens.total.toLocaleString()}))}),h.jsx(Yo,{metric:t("stats.prompt"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),r&&h.jsx(Yo,{metric:t("stats.cached"),values:i(o=>h.jsxs("span",{className:Fe.success,children:[o.tokens.cached.toLocaleString()," (",Jae(o).toFixed(1),"%)"]})),variant:"sub"}),s&&h.jsx(Yo,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"}),h.jsx(Yo,{metric:t("stats.output"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"})]})}function tle(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 nle({status:e}){const{t}=lt(),n=tle(e.tools.byName);if(n.length===0)return h.jsxs("div",{className:Fe.panel,children:[h.jsx("div",{className:Fe.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:Fe.panel,children:[h.jsx("div",{className:Fe.title,children:t("stats.toolStats")}),h.jsx("div",{className:Fe.spacer}),h.jsxs("div",{className:Fe.tableRow,children:[h.jsx("span",{className:Fe.tableToolCol,children:t("stats.toolName")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.calls")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.successRate")}),h.jsx("span",{className:Fe.tableNumCol,children:t("stats.avgDuration")})]}),h.jsx("div",{className:Fe.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:Fe.tableRow,children:[h.jsx("span",{className:`${Fe.tableToolCol} ${Fe.metricCell}`,children:xl(o.name,t)}),h.jsx("span",{className:Fe.tableNumCol,children:o.stats.count}),h.jsxs("span",{className:`${Fe.tableNumCol} ${a>=90?Fe.success:a>=70?Fe.warning:Fe.error}`,children:[a.toFixed(1),"%"]}),h.jsx("span",{className:Fe.tableNumCol,children:fc(l)})]},o.name)}),h.jsx("div",{className:Fe.spacer}),h.jsx("div",{className:Fe.sectionTitle,children:t("stats.decisionSummary")}),h.jsx(iu,{label:t("stats.totalReviewed"),children:s}),h.jsx(gm,{label:t("stats.accepted"),children:h.jsx("span",{className:Fe.success,children:r.accept})}),h.jsx(gm,{label:t("stats.rejected"),children:h.jsx("span",{className:Fe.error,children:r.reject})}),h.jsx(gm,{label:t("stats.modified"),children:h.jsx("span",{className:Fe.warning,children:r.modify})}),h.jsx("div",{className:Fe.divider}),h.jsx(iu,{label:t("stats.agreementRate"),children:h.jsx("span",{className:s>0?i>=90?Fe.success:i>=70?Fe.warning:Fe.error:void 0,children:s>0?`${i.toFixed(1)}%`:"--"})})]})}function rle({view:e,status:t}){switch(e){case"model":return h.jsx(ele,{status:t});case"tools":return h.jsx(nle,{status:t});default:return h.jsx(Zae,{status:t})}}function ib(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 sle="_panel_13hcg_1",ile="_title_13hcg_17",ole="_row_13hcg_23",ale="_rowGap_13hcg_31",lle="_label_13hcg_35",cle="_value_13hcg_41",ule="_accent_13hcg_46",du={panel:sle,title:ile,row:ole,rowGap:ale,label:lle,value:cle,accent:ule},{serialize:dle,parse:hle}=ib("web-shell:status:v1:");function Ao({label:e,children:t,gap:n}){return h.jsxs("div",{className:`${du.row}${n?` ${du.rowGap}`:""}`,children:[h.jsx("span",{className:du.label,children:e}),h.jsx("span",{className:du.value,children:t})]})}function fle({info:e}){const{t}=lt();return h.jsxs("div",{className:du.panel,children:[h.jsx("div",{className:du.title,children:t("about.title")}),e.cliVersion&&h.jsx(Ao,{label:t("about.qwenCode"),children:h.jsx("span",{className:du.accent,children:e.cliVersion})}),e.runtime&&h.jsx(Ao,{label:t("about.runtime"),children:e.runtime}),e.platform&&h.jsx(Ao,{label:t("about.platform"),children:e.platform}),e.auth&&h.jsx(Ao,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&h.jsx(Ao,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&h.jsx(Ao,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&h.jsx(Ao,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&h.jsx(Ao,{label:t("about.sessionId"),children:e.sessionId}),h.jsx(Ao,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),h.jsx(Ao,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&h.jsx(Ao,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function Km(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function mle(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function zj(e,t,n=50){const r=g.useRef(e);g.useEffect(()=>{r.current=e},[e]),g.useEffect(()=>{const s=o=>{o.defaultPrevented||Km(o.target)&&!mle(o.target)||r.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",s)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",s)}},t)}const ple="_panel_1jx2a_1",gle="_title_1jx2a_13",yle="_header_1jx2a_18",ble="_startup_1jx2a_24",wle="_note_1jx2a_28",vle="_secondary_1jx2a_29",xle="_row_1jx2a_39",_le="_selected_1jx2a_48",kle="_disabled_1jx2a_52",Sle="_pointer_1jx2a_56",Tle="_nameCell_1jx2a_62",Cle="_truncate_1jx2a_69",Ale="_separator_1jx2a_75",Ele="_sectionTitle_1jx2a_79",Mle="_groupTitle_1jx2a_80",Ile="_success_1jx2a_84",Nle="_warning_1jx2a_88",Rle="_error_1jx2a_92",Lle="_group_1jx2a_80",jle="_list_1jx2a_102",Dle="_description_1jx2a_108",Ole="_schema_1jx2a_113",Ble="_shortcuts_1jx2a_131",Ple="_detail_1jx2a_137",$le="_serverFields_1jx2a_143",zle="_serverField_1jx2a_143",Fle="_serverFieldLabel_1jx2a_156",qle="_detailBlock_1jx2a_160",Ule="_parameters_1jx2a_161",Hle="_invalidBlock_1jx2a_162",Vle="_parameterRow_1jx2a_172",Wle="_actionMessage_1jx2a_177",Gle="_oauthPage_1jx2a_183",Kle="_scrollHint_1jx2a_189",it={panel:ple,title:gle,header:yle,startup:ble,note:wle,secondary:vle,row:xle,selected:_le,disabled:kle,pointer:Sle,nameCell:Tle,truncate:Cle,separator:Ale,sectionTitle:Ele,groupTitle:Mle,success:Ile,warning:Nle,error:Rle,group:Lle,list:jle,description:Dle,schema:Ole,shortcuts:Ble,detail:Ple,serverFields:$le,serverField:zle,serverFieldLabel:Fle,detailBlock:qle,parameters:Ule,invalidBlock:Hle,parameterRow:Vle,actionMessage:Wle,oauthPage:Gle,scrollHint:Kle},Cx="web-shell:mcp-panel-active",Vc=10,{parse:Yle}=ib("web-shell:mcp-status:v1:");function Xle(e){const t=Yle(e);return!t||!t.status?null:t}function Ip(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:it.error};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:it.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:it.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:it.error}}}function Fj(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 Qle(e){const t=Fj(e);return t?JSON.stringify(t,null,2):""}function Jle(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function Zle(e,t){return e.source==="project"?t("mcp.source.project"):e.source==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function ece(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 Mw(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 Y9(e,t){window.dispatchEvent(new CustomEvent(Cx,{detail:{id:e,active:t}}))}function X9(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 Np(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function tce(e,t){return e?t("mcp.required"):""}function nce(e,t){const n=Fj(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=Qle(e);return o?h.jsx("pre",{className:it.schema,children:o}):null}const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:it.parameters,children:[h.jsx("div",{className:it.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:it.parameterRow,children:`• ${o}${tce(s.has(o),t)}: ${c}${u?` - ${u}`:""}`},o)})]})}function rce({message:e}){var q;const{t}=lt(),n=bN({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),[w,x]=g.useState(0),[k,T]=g.useState(0),A=g.useMemo(()=>r.servers??[],[r.servers]),M=A[v]??null,D=g.useMemo(()=>{var P;return M?((P=i[M.name])==null?void 0:P.tools)??[]:[]},[M,i]),O=D[k]??null,C=g.useMemo(()=>D.length<=Vc||k<Vc-1?0:Math.min(k-Vc+1,D.length-Vc),[k,D.length]),L=g.useMemo(()=>D.slice(C,C+Vc),[D,C]),I=A.filter(P=>!P.disabled&&P.mcpStatus==="connecting").length,B=g.useMemo(()=>{const P=[];for(const E of A){const ne=Jle(E,t),pe=P.find(be=>be.label===ne);pe?pe.servers.push(E):P.push({label:ne,servers:[E]})}return P},[A,t]),F=g.useMemo(()=>A.length===0?20:Math.min(Math.max(...A.map(P=>P.name.length))+2,35),[A]),W=g.useMemo(()=>D.length===0?30:Math.min(Math.max(...D.map(P=>P.name.length))+2,50),[D]),j=g.useMemo(()=>{if(!M)return[];const P=[];return!M.disabled&&D.length>0&&P.push({id:"view-tools",label:t("mcp.action.tools")}),!M.disabled&&M.mcpStatus==="disconnected"&&P.push({id:"reconnect",label:t("mcp.action.reconnect")}),P.push({id:M.disabled?"enable":"disable",label:M.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),M.disabled||(P.push({id:"authenticate",label:M.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),M.hasOAuthTokens&&P.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),P},[M,D.length,t]),K=g.useCallback(async()=>{var E;const P=await n.reload();if(P){s(P);const ne=((E=P.servers)==null?void 0:E.find(pe=>pe.name===(M==null?void 0:M.name)))??null;if(ne){const pe=await n.loadTools(ne.name);o(be=>({...be,[ne.name]:pe}))}}},[n,M==null?void 0:M.name]),J=g.useCallback(async P=>{if(!(!M||P.disabled||c)){if(P.id==="view-tools"){y("tools"),T(0),l(null);return}u(!0),P.id==="authenticate"&&y("oauth"),l(P.id==="authenticate"?Np(M.name,t):t("mcp.action.running",{action:P.label}));try{let E=null;if(P.id==="reconnect")await n.restartServer(M.name);else{const ne=await n.manageServer(M.name,P.id),pe=[...ne.messages??[],...ne.authUrl?[ne.authUrl]:[]].join(`
`);pe&&(E=P.id==="authenticate"?Np(M.name,t,pe):pe)}await K(),l(E??t("mcp.action.done",{action:P.label}))}catch(E){l(P.id==="authenticate"?Np(M.name,t,X9(E)):t("mcp.action.failed",{error:X9(E)}))}finally{u(!1)}}},[c,n,K,M,t]);if(g.useEffect(()=>{const P=d.current;return Y9(P,f),()=>Y9(P,!1)},[f]),g.useEffect(()=>{const P=E=>{const ne=E.detail;ne!=null&&ne.active&&ne.id&&ne.id!==d.current&&m(!1)};return window.addEventListener(Cx,P),()=>window.removeEventListener(Cx,P)},[]),zj(P=>{if(f){if(P.key==="Escape"){P.preventDefault(),P.stopPropagation(),p==="servers"?m(!1):p==="server"?(y("servers"),x(0),l(null)):p==="oauth"?(y("server"),l(null)):p==="tools"?(y("server"),T(0)):y("tools");return}if(P.key==="ArrowUp"||P.key==="ArrowDown"){P.preventDefault(),P.stopPropagation();const E=P.key==="ArrowUp"?-1:1;p==="servers"?(b(ne=>Math.min(Math.max(ne+E,0),A.length-1)),x(0)):p==="server"?x(ne=>Math.min(Math.max(ne+E,0),j.length-1)):p==="tools"&&T(ne=>Math.min(Math.max(ne+E,0),D.length-1));return}if(P.key==="Enter")if(P.preventDefault(),P.stopPropagation(),p==="servers"&&A.length>0)y("server"),x(0);else if(p==="server"&&j.length>0){const E=j[w];E&&J(E)}else p==="tools"&&D.length>0&&y("tool")}},[f,w,D.length,j,J,A.length,p]),!f)return null;if(A.length===0)return h.jsxs("div",{className:it.panel,"data-keyboard-scope":!0,children:[h.jsxs("div",{className:it.header,children:[h.jsx("div",{className:it.title,children:t("mcp.manageServers")}),h.jsx("div",{className:it.secondary,children:t("mcp.servers",{count:0})})]}),h.jsx("div",{className:it.secondary,children:t("mcp.empty")}),h.jsx("div",{className:it.shortcuts,children:t("mcp.shortcut.close")})]});const ee=p==="servers"?t("mcp.manageServers"):p==="server"?(M==null?void 0:M.name)??t("mcp.manageServers"):p==="oauth"?t("mcp.oauth.title"):p==="tools"?t("mcp.toolsForServer",{name:(M==null?void 0:M.name)??"Server"}):(O==null?void 0:O.name)??t("mcp.toolDetail"),N=p==="servers"?t("mcp.servers",{count:A.length}):p==="server"||p==="oauth"?"":p==="tools"?t(D.length===1?"mcp.toolCount":"mcp.toolsCount",{count:D.length}):(O==null?void 0:O.serverToolName)??(M==null?void 0:M.name)??"";return h.jsxs("div",{className:it.panel,"data-keyboard-scope":!0,children:[I>0&&h.jsxs("div",{children:[h.jsx("div",{className:it.startup,children:t("mcp.starting",{count:I})}),h.jsx("div",{className:it.note,children:t("mcp.startingNote")})]}),h.jsxs("div",{className:it.header,children:[h.jsx("div",{className:it.title,children:ee}),N&&h.jsx("div",{className:it.secondary,children:N})]}),p==="servers"&&h.jsx("div",{className:it.list,children:B.map(P=>{let E=0;for(const ne of B){if(ne===P)break;E+=ne.servers.length}return h.jsxs("div",{className:it.group,children:[h.jsx("div",{className:it.groupTitle,children:P.label}),P.servers.map((ne,pe)=>{const be=E+pe,xe=be===v,we=Ip(ne,t);return h.jsxs("div",{className:xe?`${it.row} ${it.selected}`:it.row,onClick:()=>{b(be),y("server"),x(0)},onMouseEnter:()=>b(be),children:[h.jsx("span",{className:it.pointer,children:xe?"❯":""}),h.jsx("span",{className:it.nameCell,style:{width:`${F}ch`},children:ne.name}),h.jsx("span",{className:it.separator,children:"·"}),h.jsxs("span",{className:we.className,children:[we.icon," ",we.text]})]},ne.name)})]},P.label)})}),p==="server"&&M&&h.jsxs("div",{className:it.detail,children:[h.jsxs("div",{className:it.serverFields,children:[h.jsxs("div",{className:it.serverField,children:[h.jsxs("span",{className:it.serverFieldLabel,children:[t("mcp.status"),":"]}),h.jsxs("span",{className:Ip(M,t).className,children:[Ip(M,t).icon," ",Ip(M,t).text]})]}),h.jsxs("div",{className:it.serverField,children:[h.jsxs("span",{className:it.serverFieldLabel,children:[t("mcp.source"),":"]}),h.jsx("span",{children:Zle(M,t)})]}),h.jsxs("div",{className:it.serverField,children:[h.jsxs("span",{className:it.serverFieldLabel,children:[t("mcp.command"),":"]}),h.jsx("span",{className:it.truncate,children:ece(M,t)})]}),((q=M.config)==null?void 0:q.cwd)&&h.jsxs("div",{className:it.serverField,children:[h.jsxs("span",{className:it.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),h.jsx("span",{className:it.truncate,children:M.config.cwd})]}),!M.disabled&&h.jsxs("div",{className:it.serverField,children:[h.jsxs("span",{className:it.serverFieldLabel,children:[t("mcp.tools"),":"]}),h.jsx("span",{children:t(D.length===1?"mcp.toolCount":"mcp.toolsCount",{count:D.length})})]})]}),h.jsx("div",{className:it.list,children:j.map((P,E)=>{const ne=E===w,pe=[it.row,ne?it.selected:"",P.disabled?it.disabled:""].filter(Boolean).join(" ");return h.jsxs("div",{className:pe,onClick:()=>{x(E),J(P)},children:[h.jsx("span",{className:it.pointer,children:ne?"❯":""}),h.jsx("span",{children:P.label})]},P.id)})}),a&&h.jsx("pre",{className:it.actionMessage,children:a})]}),p==="oauth"&&h.jsx("div",{className:it.oauthPage,children:h.jsx("pre",{className:it.actionMessage,children:a??(M?Np(M.name,t):t("mcp.status.unknown"))})}),p==="tools"&&h.jsx("div",{className:it.list,children:D.length===0?h.jsx("div",{className:it.secondary,children:t("mcp.emptyTools")}):L.map((P,E)=>{const ne=C+E,pe=ne===k,be=Mw(P,t);return h.jsxs("div",{className:pe?`${it.row} ${it.selected}`:it.row,onClick:()=>{T(ne),y("tool")},onMouseEnter:()=>T(ne),children:[h.jsx("span",{className:it.pointer,children:pe?"❯":""}),h.jsx("span",{className:it.nameCell,style:{width:`${W}ch`},children:P.name}),P.isValid?be?h.jsx("span",{className:it.secondary,children:be}):null:h.jsx("span",{className:it.warning,children:t("mcp.invalidReason",{reason:P.invalidReason||t("mcp.status.unknown")})})]},P.name)})}),p==="tools"&&D.length>Vc&&h.jsxs("div",{className:it.scrollHint,children:[C>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:D.length}),C+Vc<D.length?" ↓":""]}),p==="tool"&&O&&h.jsxs("div",{className:it.detail,children:[!O.isValid&&h.jsxs("div",{className:it.invalidBlock,children:[h.jsx("div",{className:it.sectionTitle,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",O.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:it.secondary,children:t("mcp.invalidToolHelp")})]}),O.description&&h.jsxs("div",{className:it.detailBlock,children:[h.jsx("div",{className:it.sectionTitle,children:t("mcp.description")}),h.jsx("div",{className:it.description,children:O.description.trim()})]}),Mw(O,t)&&h.jsxs("div",{className:it.detailBlock,children:[h.jsx("span",{className:it.sectionTitle,children:t("mcp.annotations")})," ",h.jsx("span",{children:Mw(O,t)})]}),nce(O,t)]}),h.jsx("div",{className:it.shortcuts,children:t(p==="servers"?"mcp.shortcut.selectClose":p==="server"||p==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}function Ax(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 sce="_panel_1n5sf_1",ice="_embeddedPanel_1n5sf_12",oce="_title_1n5sf_19",ace="_sectionTitle_1n5sf_24",lce="_overflowHint_1n5sf_28",cce="_header_1n5sf_33",uce="_secondary_1n5sf_39",dce="_row_1n5sf_43",hce="_selected_1n5sf_51",fce="_pointer_1n5sf_55",mce="_nameCell_1n5sf_61",pce="_status_1n5sf_70",gce="_chevronCell_1n5sf_76",yce="_chevron_1n5sf_76",bce="_chevronExpanded_1n5sf_93",wce="_separator_1n5sf_103",vce="_list_1n5sf_107",xce="_task_1n5sf_113",_ce="_taskExpanded_1n5sf_119",kce="_success_1n5sf_124",Sce="_warning_1n5sf_128",Tce="_error_1n5sf_132",Cce="_detail_1n5sf_136",Ace="_detailTop_1n5sf_145",Ece="_detailTopMain_1n5sf_152",Mce="_inlineDetail_1n5sf_192",Ice="_taskIcon_1n5sf_208",Nce="_detailField_1n5sf_237",Rce="_detailFieldLabel_1n5sf_244",Lce="_detailContent_1n5sf_250",jce="_compactSummary_1n5sf_257",Dce="_actionBar_1n5sf_266",Oce="_actionHint_1n5sf_275",Bce="_actionButton_1n5sf_280",Pce="_dangerButton_1n5sf_300",$ce="_shortcuts_1n5sf_304",zce="_confirmHint_1n5sf_310",Fce="_statusBadge_1n5sf_314",qce="_activityCurrent_1n5sf_320",Uce="_activityPast_1n5sf_327",Hce="_promptContent_1n5sf_334",Ge={panel:sce,embeddedPanel:ice,title:oce,sectionTitle:ace,overflowHint:lce,header:cce,secondary:uce,row:dce,selected:hce,pointer:fce,nameCell:mce,status:pce,chevronCell:gce,chevron:yce,chevronExpanded:bce,separator:wce,list:vce,task:xce,taskExpanded:_ce,success:kce,warning:Sce,error:Tce,detail:Cce,detailTop:Ace,detailTopMain:Ece,inlineDetail:Mce,taskIcon:Ice,detailField:Nce,detailFieldLabel:Rce,detailContent:Lce,compactSummary:jce,actionBar:Dce,actionHint:Oce,actionButton:Bce,dangerButton:Pce,shortcuts:$ce,confirmHint:zce,statusBadge:Fce,activityCurrent:qce,activityPast:Uce,promptContent:Hce},Ym="web-shell:tasks-panel-active",Vce=3e3,Q9=8,{parse:Wce}=ib("web-shell:tasks-status:v1:");function Gce(e){const t=Wce(e);return!t||!t.snapshot?null:t}function J9(e,t){window.dispatchEvent(new CustomEvent(Ym,{detail:{id:e,active:t}}))}function Z9(e){return e.status==="running"||e.status==="paused"}function Iw(e){return[...e].sort((t,n)=>{const r=Z9(t),s=Z9(n);return r!==s?r?-1:1:r?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function eT(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function qj(e){switch(e){case"running":return Ge.success;case"paused":return Ge.warning;case"completed":return Ge.success;case"failed":return Ge.error;case"cancelled":return Ge.warning;default:return""}}function Kce(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 Yce(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function Xce({expanded:e}){return h.jsx("svg",{className:`${Ge.chevron} ${e?Ge.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 Qce(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 Jce(e,t){if(e.length<=Q9)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,Q9-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 Zce(e,t,n){const r=xl(e,n),s=t?t.replace(/\s*\n\s*/g," ").trim():"";return s?`${r}(${s})`:r}function Uj({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:r}){const{t:s}=lt(),i=jy(),[o,a]=g.useState(()=>Iw(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),[w,x]=g.useState(!1),[k,T]=g.useState(null),A=g.useRef(`tasks-${Math.random().toString(36).slice(2)}`),M=g.useRef(!1),D=g.useRef(null),O=o.length===0?0:Math.min(f,o.length-1),C=o[O]??null;g.useEffect(()=>{if(!l)return;const P=setInterval(()=>{M.current||(M.current=!0,i.getTasks().then(E=>{a(Iw(E.tasks)),x(!1)}).catch(E=>{console.warn("[web-shell] failed to refresh tasks:",E),x(!0)}).finally(()=>{M.current=!1}))},Vce);return()=>clearInterval(P)},[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"){D.current=null;return}if(!C){D.current=null,d("list");return}const q=D.current;if(!q||q.taskId!==C.id){D.current={taskId:C.id,status:C.status};return}q.status==="running"&&C.status!=="running"&&(y(null),d("list"))},[l,u,C]),g.useEffect(()=>{if(!n)return;const q=A.current;return J9(q,l),()=>J9(q,!1)},[l,n]),g.useEffect(()=>{if(!n)return;const q=P=>{const E=P.detail;E!=null&&E.active&&E.id&&E.id!==A.current&&c(!1)};return window.addEventListener(Ym,q),()=>window.removeEventListener(Ym,q)},[n]),g.useEffect(()=>{l||r==null||r()},[l,r]);const L=g.useCallback(async q=>{if(v)return;const P=q.status==="running",E=q.kind==="agent"&&q.status==="paused";if(!P&&!E)return;if(q.kind==="agent"&&!q.isBackgrounded&&p!==q.id){y(q.id);return}y(null),b(!0);try{if(!(await i.cancelTask(q.id,q.kind)).cancelled){T(s("tasks.alreadyStopped"));return}const be=await i.getTasks();a(Iw(be.tasks)),T(null)}catch(pe){console.warn("[web-shell] failed to cancel task:",pe),T(s("tasks.cancelFailed"))}finally{b(!1)}},[i,v,p,s]);if(zj(q=>{if(l){if(q.key==="Escape"){if(q.preventDefault(),q.stopPropagation(),p){y(null);return}u==="detail"?d("list"):c(!1);return}if(q.key==="ArrowLeft"){q.preventDefault(),q.stopPropagation(),u==="detail"?(y(null),d("list")):c(!1);return}if((q.key==="ArrowUp"||q.key==="ArrowDown")&&u==="list"){if(q.preventDefault(),q.stopPropagation(),o.length===0)return;const P=q.key==="ArrowUp"?-1:1;m(E=>Math.min(Math.max(E+P,0),o.length-1)),y(null);return}if(q.key==="Enter"){q.preventDefault(),q.stopPropagation(),u==="list"&&C?d("detail"):u==="detail"&&c(!1);return}if(q.key===" "&&u==="detail"){q.preventDefault(),q.stopPropagation(),c(!1);return}if(q.key==="x"&&!q.ctrlKey&&!q.metaKey){q.preventDefault(),q.stopPropagation(),C&&L(C);return}}},[l,u,o.length,C,L,p]),!l)return null;const I=p!==null&&C!==null&&p===C.id,B=[];I?(B.push(s("tasks.confirmStop")),B.push(s("tasks.shortcut.cancelConfirm"))):(B.push(s("tasks.shortcut.select")),B.push(s("tasks.shortcut.view")),(C==null?void 0:C.status)==="running"?B.push(s("tasks.shortcut.stop")):(C==null?void 0:C.kind)==="agent"&&(C==null?void 0:C.status)==="paused"&&B.push(s("tasks.shortcut.abandon")),B.push(s("tasks.shortcut.listClose")));const F=[];if(I?(F.push(s("tasks.confirmStop")),F.push(s("tasks.shortcut.cancelConfirm"))):(F.push(s("tasks.shortcut.detailBack")),F.push(s("tasks.shortcut.detailClose")),(C==null?void 0:C.status)==="running"?F.push(s("tasks.shortcut.stop")):(C==null?void 0:C.kind)==="agent"&&(C==null?void 0:C.status)==="paused"&&F.push(s("tasks.shortcut.abandon"))),o.length===0)return h.jsxs("div",{className:t?`${Ge.panel} ${Ge.embeddedPanel}`:Ge.panel,"data-keyboard-scope":!0,children:[(w||k||!t)&&h.jsxs("div",{className:Ge.header,children:[!t&&h.jsx("div",{className:Ge.title,children:s("tasks.title")}),w&&h.jsx("div",{className:Ge.warning,children:s("tasks.refreshStale")}),k&&h.jsx("div",{className:Ge.error,children:k})]}),h.jsx("div",{children:h.jsx("div",{className:Ge.secondary,children:s("tasks.empty")})}),!t&&h.jsx("div",{className:Ge.shortcuts,children:s("tasks.shortcut.close")})]});const{visible:W,windowStart:j,hiddenAbove:K,hiddenBelow:J}=Jce(o,O),ee=t?o:W,N=t?0:j;return h.jsxs("div",{className:t?`${Ge.panel} ${Ge.embeddedPanel}`:Ge.panel,"data-keyboard-scope":!0,children:[(t||u==="list")&&(w||k||!t)&&h.jsxs("div",{className:Ge.header,children:[!t&&h.jsx("div",{className:Ge.title,children:s("tasks.title")}),w&&h.jsx("div",{className:Ge.warning,children:s("tasks.refreshStale")}),k&&h.jsx("div",{className:Ge.error,children:k})]}),(t||u==="list")&&h.jsxs("div",{className:Ge.list,children:[!t&&h.jsxs("div",{className:Ge.sectionTitle,children:[s("tasks.title")," ",h.jsxs("span",{className:Ge.secondary,children:["(",o.length,")"]})]}),!t&&K>0&&h.jsx("div",{className:Ge.overflowHint,children:s("tasks.moreAbove",{count:K})}),ee.map((q,P)=>{const E=N+P,ne=E===O,pe=qj(q.status),be=Kce(q.status,s),xe=t&&ne&&u==="detail",we=t?xe:ne;return h.jsxs("div",{className:`${Ge.task} ${xe?Ge.taskExpanded:""}`,children:[h.jsxs("div",{className:we?`${Ge.row} ${Ge.selected}`:Ge.row,onClick:()=>{m(E),d(t&&xe?"list":"detail")},onMouseEnter:()=>{t||m(E)},children:[h.jsx("span",{className:Ge.pointer,children:we?"❯":""}),t&&h.jsx("span",{className:Ge.taskIcon,"aria-hidden":"true"}),h.jsx("span",{className:Ge.nameCell,children:Qce(q)}),h.jsx("span",{className:`${Ge.status} ${pe}`,children:be}),h.jsx("span",{className:Ge.chevronCell,children:h.jsx(Xce,{expanded:xe})})]}),xe&&h.jsx("div",{className:Ge.inlineDetail,children:h.jsx(tT,{task:q,t:s,hideHeader:!0,busy:v,showCancelConfirm:p===q.id,onCancel:()=>void L(q),onCancelConfirmDismiss:()=>y(null)})})]},q.id)}),!t&&J>0&&h.jsx("div",{className:Ge.overflowHint,children:s("tasks.moreBelow",{count:J})})]}),!t&&u==="detail"&&C&&h.jsxs(h.Fragment,{children:[k&&h.jsx("div",{className:Ge.error,children:k}),h.jsx(tT,{task:C,t:s,busy:v,showCancelConfirm:p===C.id,onCancel:()=>void L(C),onCancelConfirmDismiss:()=>y(null)})]}),!t&&h.jsx("div",{className:I?`${Ge.shortcuts} ${Ge.confirmHint}`:Ge.shortcuts,children:(u==="list"?B:F).join(" · ")})]})}function eue(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 tT({task:e,t,hideHeader:n=!1,busy:r=!1,showCancelConfirm:s=!1,onCancel:i,onCancelConfirmDismiss:o}){var x,k,T;const a=Yce(e.status),l=qj(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=[Ax(e.runtimeMs)],p=[{label:t("tasks.detail.runtime"),value:Ax(e.runtimeMs)}],y=e.kind==="agent"?((x=e.stats)==null?void 0:x.outputTokens)??((k=e.stats)==null?void 0:k.totalTokens):void 0;y&&(m.push(t("tasks.detail.tokens",{count:eT(y)})),p.push({label:t("tasks.detail.tokenCount"),value:eT(y)})),e.kind==="agent"&&((T=e.stats)==null?void 0:T.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 v=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],b=u&&i?h.jsx("div",{className:Ge.actionBar,children:s?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Ge.actionHint,children:t("tasks.action.confirmHint")}),h.jsx("button",{type:"button",className:`${Ge.actionButton} ${Ge.dangerButton}`,disabled:r,onClick:i,children:f}),h.jsx("button",{type:"button",className:Ge.actionButton,onClick:o,children:t("common.cancel")})]}):h.jsx("button",{type:"button",className:`${Ge.actionButton} ${Ge.dangerButton}`,disabled:r,onClick:i,children:d})}):null,w=n?p.length>0?h.jsx("div",{className:Ge.compactSummary,children:p.map(A=>`${A.label} ${A.value}`).join(" · ")}):null:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Ge.title,children:eue(e,t)}),h.jsxs("div",{className:Ge.statusBadge,children:[a&&h.jsxs(h.Fragment,{children:[h.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),h.jsx("span",{className:Ge.separator,children:"·"})]}),h.jsx("span",{className:Ge.secondary,children:m.join(" · ")})]})]});return h.jsxs("div",{className:Ge.detail,children:[(w||b)&&h.jsxs("div",{className:Ge.detailTop,children:[w&&h.jsx("div",{className:Ge.detailTopMain,children:w}),b]}),e.kind==="shell"&&h.jsxs(h.Fragment,{children:[h.jsx(vf,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&h.jsx(vf,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&h.jsx(vf,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&h.jsx(vf,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:t("tasks.detail.progress")}),h.jsx("div",{className:Ge.detailContent,children:e.recentActivities.slice(-5).map((A,M,D)=>{const O=M===D.length-1,C=Zce(A.name,A.description,t);return h.jsxs("div",{className:O?Ge.activityCurrent:Ge.activityPast,children:[O?"> ":"  ",C]},`${A.at}-${M}`)})})]}),e.kind==="agent"&&e.prompt&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:t("tasks.detail.prompt")}),h.jsx("div",{className:Ge.promptContent,children:v.slice(0,5).map((A,M,D)=>h.jsx("div",{children:M===D.length-1&&v.length>5?`${A}…`:A||" "},M))})]}),e.kind==="agent"&&e.outputFile&&h.jsx(vf,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:`${Ge.detailFieldLabel} ${Ge.error}`,children:t("tasks.detail.resumeBlocked")}),h.jsx("div",{className:Ge.error,children:e.resumeBlockedReason})]}),e.error&&h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:`${Ge.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?Ge.warning:Ge.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"?Ge.warning:Ge.error,children:e.error})]})]})}function vf({label:e,value:t}){return h.jsxs("div",{className:Ge.detailField,children:[h.jsx("div",{className:Ge.detailFieldLabel,children:e}),h.jsx("div",{className:Ge.detailContent,children:t})]})}const tue="_message_fm8gc_1",nue="_body_fm8gc_15",rue="_title_fm8gc_20",sue="_muted_fm8gc_24",iue="_accent_fm8gc_28",oue="_success_fm8gc_32",aue="_error_fm8gc_36",lue="_warning_fm8gc_40",cue="_row_fm8gc_44",uue="_label_fm8gc_50",due="_value_fm8gc_55",hi={message:tue,body:nue,title:rue,muted:sue,accent:iue,success:oue,error:aue,warning:lue,row:cue,label:uue,value:due},Ex="web-shell-goal-status-active",{serialize:nT,parse:hue}=ib(FU),fue=new Set(["set","achieved","cleared","failed","aborted","checking"]);function F1(e){const t=typeof e=="string"?hue(e):e;return mue(t)}function mue(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,r=t.condition;if(typeof n!="string"||!fue.has(n)||typeof r!="string")return null;const s=Nw(t.iterations),i=Nw(t.durationMs),o=Nw(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 Nw(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function pue(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function gue(e,t){switch(e.kind){case"checking":return{title:`${t("goal.check")}${e.iterations&&e.iterations>0?` · ${t("goal.turnLabel",{count:e.iterations})}`:""} · ${t("goal.notYetMet")}`,colorClass:hi.muted};case"set":return{title:t("goal.set"),colorClass:hi.accent};case"achieved":return{title:t("goal.achieved"),colorClass:hi.success};case"cleared":return{title:t("goal.cleared"),colorClass:hi.muted};case"failed":return{title:t("goal.failed"),colorClass:hi.error};case"aborted":return{title:t("goal.aborted"),colorClass:hi.warning}}}function yue({status:e,activateFooter:t=!1}){var l;const{t:n}=lt();g.useEffect(()=>{if(!t)return;const c=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(Ex,{detail:{active:c,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const r=gue(e,n),s=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&s.push(pue(e.iterations,n)),typeof e.durationMs=="number"&&s.push(Ax(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.jsx("div",{className:hi.message,children:h.jsxs("div",{className:hi.body,children:[h.jsxs("div",{className:`${hi.title} ${r.colorClass}`,children:[r.title,i&&h.jsx("span",{className:hi.muted,children:i})]}),h.jsxs("div",{className:hi.row,children:[h.jsxs("span",{className:hi.label,children:[n("goal.label"),":"]}),h.jsx("span",{className:hi.value,children:e.condition})]}),o&&h.jsxs("div",{className:hi.muted,children:[a,": ",o]})]})})}const bue="_message_u8kmd_1",wue="_flushMessage_u8kmd_12",vue="_noMarker_u8kmd_26",xue="_content_u8kmd_30",_ue="_info_u8kmd_49",kue="_recap_u8kmd_54",Sue="_modelSwitch_u8kmd_67",Tue="_error_u8kmd_71",Cue="_warning_u8kmd_77",Aue="_retryHint_u8kmd_83",Eue="_retryButton_u8kmd_90",Mue="_cancelled_u8kmd_108",ai={message:bue,flushMessage:wue,noMarker:vue,content:xue,info:_ue,recap:kue,modelSwitch:Sue,error:Tue,warning:Cue,retryHint:Aue,retryButton:Eue,cancelled:Mue},Iue=g.memo(function({content:t,variant:n,source:r,data:s,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:c}=lt();if(r==="prompt_cancelled")return h.jsx("div",{className:ai.cancelled,role:"status",children:h.jsx("span",{children:c("turn.stopped")})});const u=n==="info"?uae(t):null;if(u)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(yae,{status:u,onShowDetail:i})});const d=n==="info"?Yae(t):null;if(d)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(rle,{view:d.view,status:d.status})});const f=n==="info"?hle(t):null;if(f)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(fle,{info:f})});const m=n==="info"?Xle(t):null;if(m)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(rce,{message:m})});const p=n==="info"?Gce(t):null;if(p)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(Uj,{message:p})});const y=n==="info"?F1(r==="goal"?s:t):null;if(y)return h.jsx("div",{className:ai.flushMessage,children:h.jsx(yue,{status:y,activateFooter:o})});const v=n==="info"&&r==="model_switch_summary",b=n==="info"&&r==="recap";return h.jsx("div",{className:`${ai.message} ${ai[n]} ${v?ai.modelSwitch:""} ${b?ai.recap:""}`,children:h.jsxs("div",{className:ai.content,children:[v?h.jsx("pre",{children:t}):n==="info"?h.jsx(I0,{content:t}):h.jsx("pre",{children:t}),a&&l&&h.jsx("div",{className:ai.retryHint,children:h.jsx("button",{type:"button",className:ai.retryButton,onClick:l,children:c("retry.hint")})})]})})}),Nue="_group_9dxmn_1",Rue="_chatSummaryGroup_9dxmn_14",Lue="_line_9dxmn_22",jue="_chatSummary_9dxmn_14",Due="_chatSummaryTextActive_9dxmn_49",Oue="_chatSummaryIcon_9dxmn_55",Bue="_chatSummaryToolIcon_9dxmn_69",Pue="_chatSummaryText_9dxmn_49",$ue="_chatChevronRight_9dxmn_112",zue="_chatChevronDown_9dxmn_113",Fue="_chatSummaryContentClip_9dxmn_140",que="_chatSummaryContentCollapsed_9dxmn_148",Uue="_chatSummaryContentInner_9dxmn_152",Hue="_lineMain_9dxmn_157",Vue="_icon_9dxmn_164",Wue="_iconError_9dxmn_172",Gue="_lineName_9dxmn_176",Kue="_lineArg_9dxmn_183",Yue="_lineElapsed_9dxmn_193",Xue="_lineExpandable_9dxmn_200",Que="_lineOutput_9dxmn_215",Jue="_lineFullArg_9dxmn_227",Zue="_lineDetail_9dxmn_239",ede="_expandedBash_9dxmn_242",tde="_expandedRead_9dxmn_243",nde="_expandedOutput_9dxmn_247",rde="_expandedEdit_9dxmn_260",sde="_expandBtn_9dxmn_274",ide="_todoProgress_9dxmn_293",ode="_todoBody_9dxmn_300",ade="_compactGroup_9dxmn_304",lde="_compactHeader_9dxmn_311",cde="_compactCount_9dxmn_318",ude="_compactHint_9dxmn_324",kt={group:Nue,chatSummaryGroup:Rue,line:Lue,chatSummary:jue,chatSummaryTextActive:Due,chatSummaryIcon:Oue,chatSummaryToolIcon:Bue,chatSummaryText:Pue,chatChevronRight:$ue,chatChevronDown:zue,chatSummaryContentClip:Fue,chatSummaryContentCollapsed:que,chatSummaryContentInner:Uue,lineMain:Hue,icon:Vue,iconError:Wue,lineName:Gue,lineArg:Kue,lineElapsed:Yue,lineExpandable:Xue,lineOutput:Que,lineFullArg:Jue,lineDetail:Zue,expandedBash:ede,expandedRead:tde,expandedOutput:nde,expandedEdit:rde,expandBtn:sde,todoProgress:ide,todoBody:ode,compactGroup:ade,compactHeader:lde,compactCount:cde,compactHint:ude};function Ru({status:e}){const{t}=lt();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return h.jsx("span",{className:`${kt.icon} ${kt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function R0(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 Hj(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 Vj(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 dde="_panel_1k01a_1",hde="_header_1k01a_12",fde="_desc_1k01a_24",mde="_toggle_1k01a_33",pde="_meta_1k01a_39",gde="_body_1k01a_45",yde="_content_1k01a_56",bde="_stream_1k01a_71",wde="_streamCollapsed_1k01a_81",vde="_scrollWindow_1k01a_88",xde="_expandToggle_1k01a_93",_de="_tabBar_1k01a_108",kde="_tab_1k01a_108",Sde="_tabActive_1k01a_130",Tde="_tools_1k01a_135",Cde="_toolTimeRow_1k01a_152",Ade="_toolTimeTip_1k01a_156",lr={panel:dde,header:hde,desc:fde,toggle:mde,meta:pde,body:gde,content:yde,stream:bde,streamCollapsed:wde,scrollWindow:vde,expandToggle:xde,tabBar:_de,tab:kde,tabActive:Sde,tools:Tde,toolTimeRow:Cde,toolTimeTip:Ade};function Wj(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function Ede({timestamp:e,children:t}){return e===void 0?h.jsx(h.Fragment,{children:t}):h.jsxs("div",{className:lr.toolTimeRow,children:[t,h.jsx("span",{className:lr.toolTimeTip,"aria-hidden":"true",children:dh(e)})]})}const Mde=g.memo(function({tool:t}){const n=t.subTools||t.subContent?h.jsx(Y5,{tool:t}):h.jsx(Nx,{tool:t});return h.jsx(Ede,{timestamp:t.startTime,children:n})});function Ide({tc:e}){const{t}=lt(),n=e.description||"";return h.jsx("div",{className:kt.line,children:h.jsxs("div",{className:kt.lineMain,children:[h.jsx(Ru,{status:e.status}),h.jsx("span",{className:kt.lineName,children:xl(e.name,t)}),n&&h.jsx("span",{className:kt.lineArg,children:Ls(n,70)})]})})}function Nde(e){var t;if(e.rawOutput&&Wj(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 Rde({text:e}){const{compactThinking:t}=Lc(),{t:n}=lt(),[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?`${lr.stream} ${lr.streamCollapsed}`:lr.stream,children:e}),t&&(i||r)&&h.jsx("button",{className:lr.expandToggle,onClick:()=>s(c=>!c),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function Lde({content:e}){const{compactThinking:t}=Lc();return h.jsx("div",{className:t?lr.scrollWindow:void 0,children:h.jsx(I0,{content:e,source:"assistant"})})}function rT({pinTail:e,itemCount:t,children:n}){const{compactThinking:r}=Lc(),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?`${lr.tools} ${lr.scrollWindow}`:lr.tools,children:n})}function Y5({tool:e,defaultExpanded:t,hideHeader:n,inline:r}){var A,M,D,O;const s=e.status==="completed"||e.status==="failed",i=Gm(e),[o,a]=g.useState(t??!1),[l,c]=g.useState("result"),u=Wj(e.rawOutput)?e.rawOutput:null,d=((A=e.subTools)==null?void 0:A.length)||((M=u==null?void 0:u.toolCalls)==null?void 0:M.length)||0,f=K5(e),m=G5(e),p=R0(e.startTime,e.endTime)||Hj((D=u==null?void 0:u.executionSummary)==null?void 0:D.totalDurationMs),y=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(O=u==null?void 0:u.executionSummary)==null?void 0:O.outputTokens,v=y?W5(y):"",b=s?Nde(e):"",w=g.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),x=!!(e.subContent||b),k=!!(e.subTools&&e.subTools.length>0||w&&w.length>0),T=x&&k;return h.jsxs("div",{className:r?void 0:lr.panel,children:[!n&&h.jsxs("div",{className:lr.header,onClick:()=>a(!o),children:[h.jsx(Ru,{status:i}),h.jsxs("span",{className:kt.lineName,children:[m,":"]}),f&&h.jsx("span",{className:lr.desc,children:Ls(f,50)}),s&&d>0&&h.jsxs("span",{className:lr.meta,children:["· ",d," tools"]}),p&&h.jsxs("span",{className:lr.meta,children:["· ",p]}),v&&h.jsxs("span",{className:lr.meta,children:["· ",v]}),!s&&h.jsx("span",{className:lr.toggle,children:o?"▼":"▶"})]}),(o||n)&&h.jsxs("div",{className:lr.body,children:[T&&h.jsxs("div",{className:lr.tabBar,children:[h.jsx("button",{className:`${lr.tab} ${l==="result"?lr.tabActive:""}`,onClick:()=>c("result"),children:"Result"}),h.jsxs("button",{className:`${lr.tab} ${l==="tools"?lr.tabActive:""}`,onClick:()=>c("tools"),children:["Tools (",d,")"]})]}),(!T||l==="result")&&x&&h.jsx("div",{className:lr.content,children:s?h.jsx(Lde,{content:e.subContent||b}):e.subContent&&h.jsx(Rde,{text:e.subContent})}),(!T||l==="tools")&&h.jsxs(h.Fragment,{children:[e.subTools&&e.subTools.length>0&&h.jsx(rT,{pinTail:!s,itemCount:e.subTools.length,children:e.subTools.map(C=>h.jsx(Mde,{tool:C},C.callId))}),w&&w.length>0&&h.jsx(rT,{pinTail:!s,itemCount:w.length,children:w.map(C=>h.jsx(Ide,{tc:C},C.callId))})]})]})]})}const jde="_view_13muf_1",Dde="_stats_13muf_9",Ode="_statAdd_13muf_18",Bde="_statDel_13muf_22",Pde="_lines_13muf_26",$de="_line_13muf_26",zde="_lineAdd_13muf_38",Fde="_lineDel_13muf_42",qde="_lineHeader_13muf_46",Ude="_lineContext_13muf_52",Hde="_lineNo_13muf_56",Vde="_marker_13muf_66",Wde="_content_13muf_81",Xo={view:jde,stats:Dde,statAdd:Ode,statDel:Bde,lines:Pde,line:$de,lineAdd:zde,lineDel:Fde,lineHeader:qde,lineContext:Ude,lineNo:Hde,marker:Vde,content:Wde};function Gde(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 Kde=g.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:r,deletions:s}=Gde(t);return h.jsxs("div",{className:Xo.view,children:[h.jsxs("div",{className:Xo.stats,children:[r>0&&h.jsxs("span",{className:Xo.statAdd,children:["+",r]}),s>0&&h.jsxs("span",{className:Xo.statDel,children:["-",s]})]}),h.jsx("div",{className:Xo.lines,children:n.map((i,o)=>h.jsxs("div",{className:`${Xo.line} ${Xo[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[h.jsx("span",{className:Xo.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),h.jsx("span",{className:Xo.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),h.jsx("span",{className:Xo.content,children:i.content})]},o))})]})}),sT={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 Yde(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=sT[c]:c===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:r,dim:s}),t}function Xde(e){return new RegExp(String.raw`\x1b\[`).test(e)}function Hh(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function Rw(e){const t=e.flatMap((n,r)=>{const s=U1(n),i=Rp(s,"content");return i?[{id:Rp(s,"id")??`plan-${r}`,content:i,status:lhe(Rp(s,"status")),priority:che(Rp(s,"priority"))}]:[]});return t.length>0?t:void 0}function X5(e){if(!Hh(e.toolName)&&e.kind!=="other")return;const t=oT(e.args);if(t)return Rw(t);const n=U1(e.rawOutput),r=oT(n);if(r)return Rw(r);const s=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return s?Rw(s):void 0}function Qde(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function q1(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const iT={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function Jde(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=X5(a);l&&(t=l,n=o.id,r=a.callId,s=!1)}}if(t.length===0)return iT;const i=!Qde(t);return i&&s?iT:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:r}}function Q5(e){return JSON.stringify([e.id,e.content])}function ob(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=X5(n);r&&t.push({key:n.callId,todos:r,stats:nhe(n)})}return t}return[]}function Zde(e){const t=new Map,n=new Map;for(const r of e)for(const{key:s,todos:i}of ob(r)){const o=[];for(const a of i){const l=Q5(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 ehe(e){const t=[];for(const n of e)for(const{key:r,todos:s}of ob(n))t.push(JSON.stringify([r,s.map(i=>[i.id,i.status,i.content])]));return t.join(`
`)}function the(e){const t=[];for(const n of e){if(n.role==="tool_group")for(const r of n.tools)!Hh(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 ob(n))t.push(JSON.stringify([r,n.timestamp,s.map(o=>[o.id,o.status,o.content]),i]))}return t.join(`
`)}function nhe(e){var o;const t=U1((o=U1(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 rhe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools){if(Hh(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 she(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 ihe(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 ohe(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 ahe(e){var a;const t=new Map,n=new Map,r=new Map,s=new Set,i=rhe(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 ob(l))for(const f of u){const m=Q5(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?ihe(y,d):void 0,b=(a=t.get(m))==null?void 0:a.startTs,w=b!==void 0&&c!==void 0?she(i,b,c):void 0,x=ohe(v,w);if(c!==void 0||x){const k=o(m);c!==void 0&&(k.endTs=c),x&&(k.resources=x)}}f.status==="completed"&&s.add(m),n.set(m,f.status)}}return t}function oT(e){const t=e==null?void 0:e.todos;return Array.isArray(t)?t:void 0}function lhe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function che(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function U1(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Rp(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const Ag=new Set;let xf=null,Gj=Date.now();function uhe(){Gj=Date.now();for(const e of Ag)e()}function dhe(e){return Ag.add(e),xf||(xf=setInterval(uhe,1e3)),()=>{Ag.delete(e),Ag.size===0&&xf&&(clearInterval(xf),xf=null)}}function J5(e){const[t,n]=g.useState(()=>Date.now());return g.useEffect(()=>{if(e)return n(Date.now()),dhe(()=>n(Gj))},[e]),t}const hhe="_list_1bo8s_1",fhe="_summary_1bo8s_2",mhe="_row_1bo8s_8",phe="_num_1bo8s_16",ghe="_icon_1bo8s_23",yhe="_text_1bo8s_29",bhe="_inProgress_1bo8s_43",whe="_completed_1bo8s_48",vhe="_item_1bo8s_62",xhe="_rowButton_1bo8s_69",_he="_detailChevron_1bo8s_82",khe="_detail_1bo8s_82",She="_detailSection_1bo8s_100",The="_detailSectionTitle_1bo8s_106",Che="_detailRows_1bo8s_114",Ahe="_detailLabel_1bo8s_122",Ehe="_detailValue_1bo8s_126",Mhe="_detailDuration_1bo8s_132",Ihe="_detailHint_1bo8s_136",bn={list:hhe,summary:fhe,row:mhe,num:phe,icon:ghe,text:yhe,inProgress:bhe,completed:whe,item:vhe,rowButton:xhe,detailChevron:_he,detail:khe,detailSection:She,detailSectionTitle:The,detailRows:Che,detailLabel:Ahe,detailValue:Ehe,detailDuration:Mhe,detailHint:Ihe};function Mx(e){switch(e){case"completed":return bn.completed;case"in_progress":return bn.inProgress;case"pending":return""}}function Kj({todos:e,events:t}){const{t:n}=lt();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return h.jsx("div",{className:bn.summary,children:h.jsxs("div",{className:`${bn.row} ${bn.completed}`,children:[h.jsx("span",{className:bn.icon,"aria-hidden":"true",children:"✓"}),h.jsx("span",{className:bn.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:bn.summary,children:h.jsxs("div",{className:`${bn.row} ${Mx(s.status)}`,children:[h.jsx("span",{className:bn.icon,"aria-hidden":"true",children:q1(s.status)}),h.jsx("span",{className:bn.text,children:s.content})]})}):null}return h.jsx("div",{className:bn.summary,children:t.map(r=>h.jsxs("div",{className:`${bn.row} ${r.kind==="completed"?bn.completed:bn.inProgress}`,children:[h.jsx("span",{className:bn.icon,"aria-hidden":"true",children:q1(r.kind==="completed"?"completed":"in_progress")}),h.jsx("span",{className:bn.text,children:r.content})]},`${r.kind}-${r.id}`))})}function Wc({label:e,value:t,suffix:n}){return h.jsxs(h.Fragment,{children:[h.jsx("span",{className:bn.detailLabel,children:e}),h.jsxs("span",{className:bn.detailValue,children:[t,n]})]})}function Lw({title:e,children:t}){return h.jsxs("div",{className:bn.detailSection,children:[h.jsx("div",{className:bn.detailSectionTitle,children:e}),h.jsx("div",{className:bn.detailRows,children:t})]})}function Nhe({detail:e}){const{t}=lt(),{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:bn.detail,children:[i&&h.jsxs(Lw,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&h.jsx(Wc,{label:t("todo.detail.start"),value:dh(n)}),r!==void 0&&h.jsx(Wc,{label:t("todo.detail.end"),value:dh(r),suffix:n!==void 0?h.jsxs("span",{className:bn.detailDuration,children:[" ","(",fc(r-n),")"]}):void 0})]}),o&&h.jsxs(Lw,{title:t("todo.detail.sectionTokens"),children:[h.jsx(Wc,{label:t("todo.detail.input"),value:((s==null?void 0:s.inputTokens)??0).toLocaleString()}),h.jsx(Wc,{label:t("todo.detail.output"),value:((s==null?void 0:s.outputTokens)??0).toLocaleString()}),h.jsx(Wc,{label:t("todo.detail.cached"),value:((s==null?void 0:s.cachedTokens)??0).toLocaleString()})]}),a&&h.jsxs(Lw,{title:t("todo.detail.sectionSpent"),children:[(s==null?void 0:s.apiTimeMs)!==void 0&&h.jsx(Wc,{label:t("todo.detail.api"),value:fc(s.apiTimeMs)}),(s==null?void 0:s.toolTimeMs)!==void 0&&h.jsx(Wc,{label:t("todo.detail.tool"),value:fc(s.toolTimeMs)})]}),!s&&h.jsx("div",{className:bn.detailHint,children:t("todo.detail.noResources")})]})}function Rhe(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function Yj({todos:e,numbered:t=!1}){const{t:n}=lt(),r=g.useContext(WB),[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:bn.list,children:e.map((l,c)=>{const u=l.id||String(c),d=r.get(Q5(l)),f=Rhe(d),m=f&&s.has(u),p=h.jsxs(h.Fragment,{children:[t&&h.jsxs("span",{className:bn.num,style:{minWidth:o},children:[c+1,"."]}),h.jsx("span",{className:bn.icon,"aria-hidden":"true",children:q1(l.status)}),h.jsx("span",{className:bn.text,children:l.content}),f&&h.jsx("span",{className:bn.detailChevron,"aria-hidden":"true",children:m?"▾":"▸"})]});return h.jsxs("div",{className:bn.item,children:[f?h.jsx("button",{type:"button",className:`${bn.row} ${bn.rowButton} ${Mx(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:`${bn.row} ${Mx(l.status)}`,children:p}),m&&d&&h.jsx(Nhe,{detail:d})]},u)})})}const Xj=5;function Lhe(e){const t=e.toolName.toLowerCase();if(Uh(e.toolName))return!!ya(e);if(t==="write_file"||t==="writefile")return!!Hhe(e)||aT(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(kc(t)){const n=ya(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(t==="edit"||t==="write"||t==="editfile")return aT(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=ya(e);return!!n&&n.split(`
`).length>3}return!1}function jhe(e){const t=e.toolName.toLowerCase();return kc(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||Uh(e.toolName)}function Dhe(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!Qj(e)}function aT(e){return Dhe(e)||!!ya(e)}function Ohe(e){const t=Qj(e);if(t)return t;if(e.content){const n=e.content.find(r=>r.type==="diff");if(n&&n.type==="diff")return $he(n.oldText||"",n.newText||"")}return""}function Qj(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(Bhe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function Bhe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const Phe=25e4;function $he(e,t){const n=e.split(`
`),r=t.split(`
`),s=n.length,i=r.length;if(s*i>Phe){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 jw=150,lT=25,zhe=60;function Fhe(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:Xj)||0))}function cT(e,t){return e.length<=t?e:e.slice(0,t)+" …"}function qhe({tool:e,maxLines:t}){const{t:n}=lt(),[r,s]=g.useState(!1),i=g.useMemo(()=>ya(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>jw),[o]),u=a||c,d=g.useMemo(()=>r?i:a?[`... first ${l} lines hidden ...`,...o.slice(-t).map(m=>cT(m,jw))].join(`
`):o.map(m=>cT(m,jw)).join(`
`),[l,a,o,t,i,r]),f=g.useMemo(()=>Xde(d)?Yde(d):null,[d]);return h.jsxs("div",{className:kt.expandedBash,children:[h.jsx("pre",{className:kt.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:kt.expandBtn,onClick:()=>s(!r),"aria-expanded":r,children:r?n("tool.showLess"):a?n("tool.showAll",{count:o.length}):n("tool.showFullLines")})]})}function Uhe({tool:e}){const{t}=lt(),[n,r]=g.useState(!1),s=g.useMemo(()=>ya(e)||"",[e]),i=g.useMemo(()=>s.split(`
`),[s]),o=i.length>lT,a=g.useMemo(()=>o&&!n?i.slice(0,lT).join(`
`):s,[s,o,i,n]);return h.jsxs("div",{className:kt.expandedRead,children:[h.jsx("pre",{className:kt.expandedOutput,children:a}),o&&h.jsx("button",{className:kt.expandBtn,onClick:()=>r(!n),"aria-expanded":n,children:n?t("tool.showLess"):t("tool.linesTotal",{count:i.length})})]})}function uT({tool:e}){const t=g.useMemo(()=>Ohe(e),[e]),n=g.useMemo(()=>ya(e)||"",[e]);return!t&&!n?null:h.jsx("div",{className:kt.expandedEdit,children:t?h.jsx(Kde,{diff:t}):h.jsx("pre",{className:kt.expandedOutput,children:n})})}function Hhe(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=ya(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 Vhe({tool:e,todos:t,expanded:n}){var i;const s=((i=g.useContext($k).get(e.callId))==null?void 0:i.events)??[];return h.jsx("div",{className:kt.todoBody,children:n?h.jsx(Yj,{todos:t}):h.jsx(Kj,{todos:t,events:s})})}function Whe(e,t){var m,p;const n=N0(e.rawOutput),r=V5(e),s=Gm(e),i=G5(e),o=Ghe(e),a=K5(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"?Hj(c.totalDurationMs):R0(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.outputTokens=="number"&&c.outputTokens>0?c.outputTokens:0,f=d>0?W5(d):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:u,tokens:f,status:s,reason:r}}function Ghe(e){var s;const t=N0(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 dT(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(Uh(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||kc(t))}function Khe({tool:e}){const t=ya(e)||"";return h.jsx("pre",{className:kt.expandedOutput,children:t})}function Z5(e){const t=e.toolName.toLowerCase();return Oy(e)?"agent":kc(t)?"shell":tk(t)?"fetch":Hh(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 Yhe({description:e,elapsed:t}){return h.jsxs(h.Fragment,{children:[e&&h.jsx("span",{className:kt.lineArg,children:e}),t&&h.jsx("span",{className:kt.lineElapsed,children:t})]})}function Ix({info:e}){const{renderToolHeaderExtra:t}=Lc(),n=t==null?void 0:t(e);return n?h.jsx(h.Fragment,{children:n}):h.jsx(Yhe,{description:e.description,elapsed:e.elapsed})}function Xhe(e){return e.length>zhe||e.includes(`
`)}function Jj(e){return e==="in_progress"||e==="pending"||e==="running"}function ek(e){return e.find(t=>Jj(t.status))??e[e.length-1]}function Qhe(e,t,n){if(Zj(e)){const r=ek(e);return t("toolGroup.running",{name:xl(r.toolName,t),count:e.length,duration:n??""})}return t("toolGroup.summary",{count:e.length})}function Zj(e){return e.some(t=>Jj(t.status))}function Jhe(){return h.jsxs("svg",{className:kt.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 eD(){return h.jsxs("svg",{className:kt.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 Zhe(){return h.jsxs("svg",{className:kt.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 efe(){return h.jsxs("svg",{className:kt.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 tfe(){return h.jsx("svg",{className:kt.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 nfe(){return h.jsx("svg",{className:kt.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 rfe({tool:e}){const t=Z5(e);return t==="agent"?h.jsx(nfe,{}):t==="edit"||t==="write"?h.jsx(Jhe,{}):t==="fetch"?h.jsx(Zhe,{}):t==="read"?h.jsx(efe,{}):t==="todo"?h.jsx(tfe,{}):h.jsx(eD,{})}function tk(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const sfe=Gm;function ife({tools:e,workspaceCwd:t}){const{t:n}=lt(),r=ek(e),s=xl(r.toolName,n),i=sfe(r),o=Bj(r,t),a=kc(r.toolName)||tk(r.toolName)?"":R0(r.startTime,r.endTime);return h.jsxs("div",{className:kt.compactGroup,children:[h.jsxs("div",{className:kt.compactHeader,children:[h.jsx(Ru,{status:i}),h.jsx("span",{className:kt.lineName,children:s}),e.length>1&&h.jsxs("span",{className:kt.compactCount,children:["× ",e.length]}),h.jsx(Ix,{info:{kind:Z5(r),tool:r,displayName:s,description:o,elapsed:a,workspaceCwd:t}})]}),h.jsx("div",{className:kt.compactHint,children:n("compact.hint")})]})}function ofe(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||e.summaryOnly!==t.summaryOnly)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&&afe(n.subTools,r.subTools)}function afe(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 Nx=g.memo(function({tool:t,approval:n,workspaceCwd:r,shellOutputMaxLines:s=Xj,summaryOnly:i=!1}){const{t:o}=lt(),a=g.useContext(Gh),[l,c]=g.useState(()=>!a&&dT(t)),u=g.useRef(!1);g.useEffect(()=>{c(a?!1:dT(t)),u.current=!1},[a,t.callId,t.toolName]);const d=Oy(t),f=n&&n.toolCallId===t.callId,m=!f&&(n==null?void 0:n.toolCallId)&&d&&fl(t,n.toolCallId),p=d&&t.status==="in_progress",y=J5(p);if(g.useEffect(()=>{!d&&t.status==="completed"&&!u.current&&c(!1)},[d,t.status]),d){const B=Whe(t,y),F=B.explicitAgentType?`${o("agent.label")} (${B.explicitAgentType})`:o("agent.label"),W=t.status==="completed"||t.status==="failed",K=[t.status==="pending"?"pending":"running",B.elapsed].filter(Boolean).join(" · "),J=[B.subToolCount>0?`${B.subToolCount} tools`:"",B.elapsed,B.tokens,B.reason?Ls(B.reason,80):""].filter(Boolean).join(" · "),ee=l||!!f||!!m;return h.jsxs("div",{className:kt.line,children:[h.jsxs("div",{className:`${kt.lineMain} ${kt.lineExpandable}`,onClick:()=>c(!l),children:[h.jsx(Ru,{status:W?B.status:t.status}),h.jsx("span",{className:kt.lineName,children:F}),h.jsx(Ix,{info:{kind:"agent",tool:t,displayName:F,description:B.description?Ls(B.description,60):"",elapsed:W?J:K,workspaceCwd:r}})]}),ee&&h.jsx("div",{className:kt.lineDetail,children:h.jsx(Y5,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0})})]})}const v=Bj(t,r),b=wae(t),w=xl(t.toolName,o),x=kc(t.toolName)||tk(t.toolName)?"":R0(t.startTime,t.endTime),k=t.toolName.toLowerCase(),T=Hh(k),A=T?X5(t):void 0,M=!!A&&A.length>0,D=A?A.filter(B=>B.status==="completed").length:0,O=!T&&Xhe(v),C=T?M:Lhe(t)||O,L=l&&O,I=jhe(t);return h.jsxs("div",{className:kt.line,children:[h.jsxs("div",{className:`${kt.lineMain} ${C?kt.lineExpandable:""}`,title:C?o(l?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":C?l:void 0,role:C?"button":void 0,tabIndex:C?0:void 0,onClick:C?()=>{u.current=!0,c(B=>!B)}:void 0,onKeyDown:C?B=>{B.key!=="Enter"&&B.key!==" "||(B.preventDefault(),u.current=!0,c(F=>!F))}:void 0,children:[h.jsx(Ru,{status:t.status}),h.jsx("span",{className:kt.lineName,children:w}),T&&M&&h.jsxs("span",{className:kt.todoProgress,children:[D,"/",A.length]}),h.jsx(Ix,{info:{kind:Z5(t),tool:t,displayName:w,description:T||L?"":v,elapsed:T?"":x,workspaceCwd:r}})]}),(!i||l)&&T&&M&&h.jsx(Vhe,{tool:t,todos:A,expanded:l}),(!i||l)&&T&&!M&&b&&h.jsx("div",{className:kt.lineOutput,children:b}),L&&h.jsx("div",{className:kt.lineFullArg,children:v}),!T&&b&&(!l||!I)&&(!i||l)&&h.jsx("div",{className:kt.lineOutput,children:b}),!T&&l&&I&&h.jsxs("div",{className:kt.lineDetail,children:[kc(k)&&h.jsx(qhe,{tool:t,maxLines:s}),(k==="write_file"||k==="writefile")&&h.jsx(uT,{tool:t}),(k==="edit"||k==="write"||k==="editfile")&&h.jsx(uT,{tool:t}),(k==="read"||k==="read_file"||k==="readfile")&&h.jsx(Uhe,{tool:t}),Uh(t.toolName)&&h.jsx(Khe,{tool:t})]})]})},ofe),lfe=g.memo(function({tools:t,pendingApproval:n,workspaceCwd:r,shellOutputMaxLines:s}){const{t:i}=lt(),o=g.useContext(Gh),[a,l]=g.useState(!1),c=Zj(t),u=t.length>0?ek(t):void 0,d=t[0]??u,f=g.useRef(Date.now()),m=J5(c),p=(n==null?void 0:n.toolCallId)&&t.some(b=>fl(b,n.toolCallId)),y=o&&!p,v=c?Vj(m-f.current):void 0;return g.useEffect(()=>{c&&(f.current=Date.now())},[c,u==null?void 0:u.callId]),y?h.jsx(ife,{tools:t,workspaceCwd:r}):p?h.jsx("div",{className:kt.group,children:t.map(b=>h.jsx(Nx,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s},b.callId))}):h.jsxs("div",{children:[h.jsxs("button",{type:"button",className:kt.chatSummary,onClick:()=>l(b=>!b),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[h.jsx("span",{className:kt.chatSummaryIcon,"aria-hidden":"true",children:d?h.jsx(rfe,{tool:d}):h.jsx(eD,{})}),h.jsx("span",{className:c?`${kt.chatSummaryText} ${kt.chatSummaryTextActive}`:kt.chatSummaryText,children:Qhe(t,i,v)}),h.jsx("span",{className:a?kt.chatChevronDown:kt.chatChevronRight,"aria-hidden":"true"})]}),h.jsx("div",{className:a?kt.chatSummaryContentClip:`${kt.chatSummaryContentClip} ${kt.chatSummaryContentCollapsed}`,children:h.jsx("div",{className:kt.chatSummaryContentInner,children:h.jsx("div",{className:`${kt.group} ${kt.chatSummaryGroup}`,children:t.map(b=>h.jsx(Nx,{tool:b,approval:n,workspaceCwd:r,shellOutputMaxLines:s,summaryOnly:!0},b.callId))})})})]})}),cfe="_message_kwepu_1",ufe="_header_kwepu_6",dfe="_chevron_kwepu_20",hfe="_title_kwepu_26",ffe="_progress_kwepu_35",_f={message:cfe,header:ufe,chevron:dfe,title:hfe,progress:ffe};function mfe({id:e,todos:t}){var s;const r=((s=g.useContext($k).get(e))==null?void 0:s.events)??[];return h.jsx(Kj,{todos:t,events:r})}const pfe=g.memo(function({id:t,todos:n}){const{t:r}=lt(),[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:_f.message,children:[h.jsxs("button",{type:"button",className:_f.header,onClick:()=>i(l=>!l),"aria-expanded":s,title:r(s?"todo.collapse":"todo.expand"),children:[h.jsx("span",{className:_f.chevron,"aria-hidden":"true",children:s?"▾":"▸"}),h.jsx("span",{className:_f.title,children:r("plan.title")}),h.jsxs("span",{className:_f.progress,children:[a,"/",o]})]}),s?h.jsx(Yj,{todos:n,numbered:!0}):h.jsx(mfe,{id:t,todos:n})]})}),gfe="_message_1abcu_1",yfe="_content_1abcu_11",bfe="_question_1abcu_17",wfe="_prefix_1abcu_24",vfe="_answer_1abcu_28",xfe="_pending_1abcu_32",_fe="_shortcuts_1abcu_36",Gc={message:gfe,content:yfe,question:bfe,prefix:wfe,answer:vfe,pending:xfe,shortcuts:_fe},tD=g.memo(function({question:t,answer:n,isPending:r}){const{t:s}=lt();return h.jsxs("div",{className:Gc.message,children:[h.jsxs("div",{className:Gc.content,children:[h.jsxs("div",{className:Gc.question,children:[h.jsx("span",{className:Gc.prefix,children:"/btw "}),h.jsx("span",{children:t})]}),h.jsx("div",{className:Gc.answer,children:r?h.jsx("span",{className:Gc.pending,children:s("btw.answering")}):h.jsx(I0,{content:n})})]}),h.jsx("div",{className:Gc.shortcuts,children:s(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),kfe="_message_1q4dw_1",Sfe="_compact_1q4dw_16",Tfe="_header_1q4dw_21",Cfe="_status_1q4dw_30",Afe="_name_1q4dw_35",Efe="_command_1q4dw_42",Mfe="_output_1q4dw_51",Ife="_compactHint_1q4dw_62",za={message:kfe,compact:Sfe,header:Tfe,status:Cfe,name:Afe,command:Efe,output:Mfe,compactHint:Ife},Nfe=g.memo(function({command:t,output:n}){const r=g.useContext(Gh),{t:s}=lt();return h.jsxs("div",{className:r?`${za.message} ${za.compact}`:za.message,children:[h.jsxs("div",{className:za.header,children:[h.jsx("span",{className:za.status,children:"✓"}),h.jsx("span",{className:za.name,children:s("shell.command")}),t&&h.jsx("span",{className:za.command,children:t})]}),r?h.jsx("div",{className:za.compactHint,children:s("compact.hint")}):n&&h.jsx("pre",{className:za.output,children:n})]})}),Rfe="_progress_1j3ys_1",Lfe="_spinner_1j3ys_12",jfe="_bar_1j3ys_19",Dfe="_stage_1j3ys_25",Ofe="_icon_1j3ys_29",Bfe="_done_1j3ys_35",Pfe="_error_1j3ys_43",$fe="_detail_1j3ys_51",zfe="_path_1j3ys_56",ls={progress:Rfe,spinner:Lfe,bar:jfe,stage:Dfe,icon:Ofe,done:Bfe,error:Pfe,detail:$fe,path:zfe},hT=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function Ffe({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)%hT.length)},120);return()=>clearInterval(f)},[s,i]),i?h.jsxs("div",{className:`${ls.progress} ${ls.error}`,children:[h.jsx("span",{className:ls.icon,children:"✕"}),h.jsx("span",{className:ls.stage,children:t}),h.jsx("div",{className:ls.detail,children:i})]}):s?h.jsxs("div",{className:`${ls.progress} ${ls.done}`,children:[h.jsx("span",{className:ls.icon,children:"✓"}),h.jsx("span",{className:ls.stage,children:t})]}):h.jsxs("div",{className:ls.progress,children:[h.jsx("span",{className:ls.spinner,children:hT[o]}),h.jsx("span",{className:ls.bar,children:d}),h.jsxs("span",{className:ls.stage,children:[t,r?` (${r})`:""]})]})}function qfe({path:e}){const{t}=lt();return h.jsxs("div",{className:`${ls.progress} ${ls.done}`,children:[h.jsx("span",{className:ls.icon,children:"✓"}),h.jsx("span",{className:ls.stage,children:t("insight.ready")}),h.jsx("span",{className:ls.path,children:e})]})}const Ufe=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(foe,{content:t.content,images:t.images});case"assistant":return h.jsx(Roe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:c,showBranchAction:u});case"thinking":return h.jsx(Ooe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp});case"tool_group":return h.jsx(lfe,{tools:t.tools,pendingApproval:n,workspaceCwd:s,shellOutputMaxLines:d});case"plan":return h.jsx(pfe,{id:t.id,todos:t.todos});case"system":return h.jsx(Iue,{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(Nfe,{command:t.command,output:t.output});case"btw":return h.jsx(tD,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return h.jsx(Ffe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return h.jsx(qfe,{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(CN,{label:`message:${t.role}`,resetKeys:[t],fallback:h.jsx(Hfe,{align:t.role==="user"?"end":"start"}),children:f}),p=h.jsx("div",{"data-user-selectable":"true",children:m});return t.role==="assistant"?c?p:h.jsx(Nv,{timestamp:t.timestamp,children:p}):t.role==="system"&&t.source==="prompt_cancelled"?p:h.jsx(Nv,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:"Copy",children:p})},Vfe);function Hfe({align:e}){const{t}=lt();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 Vfe(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:Wfe(e.message,t.message)}function Wfe(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&&Yfe(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"&&Gfe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,r)=>nD(n,t.tools[r]));default:return!1}}function Gfe(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 nD(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&&Il(e.args)===Il(t.args)&&Il(e.rawOutput)===Il(t.rawOutput)&&Il(e.locations)===Il(t.locations)&&Il(e.content)===Il(t.content)&&Kfe(e.subTools,t.subTools):!1}function Kfe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>nD(n,t[r]))}const fT=new WeakMap;function Yfe(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 Il(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=fT.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return fT.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}const Xfe="_wrap_wsysp_1",Qfe="_summary_wsysp_5",Jfe="_summaryTextActive_wsysp_27",Zfe="_summaryIcon_wsysp_33",eme="_summaryStatus_wsysp_47",tme="_summaryToolIcon_wsysp_54",nme="_summaryText_wsysp_27",rme="_summaryDot_wsysp_96",sme="_chevronRight_wsysp_100",ime="_chevronDown_wsysp_101",ome="_group_wsysp_127",ame="_list_wsysp_156",lme="_row_wsysp_164",cme="_rowStats_wsysp_178",ume="_rowDesc_wsysp_186",dme="_rowTool_wsysp_196",hme="_detail_wsysp_200",as={wrap:Xfe,summary:Qfe,summaryTextActive:Jfe,summaryIcon:Zfe,summaryStatus:eme,summaryToolIcon:tme,summaryText:nme,summaryDot:rme,chevronRight:sme,chevronDown:ime,group:ome,list:ame,row:lme,rowStats:cme,rowDesc:ume,rowTool:dme,detail:hme};function fme(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 mme(e,t){const n=[],r=N0(e.rawOutput),s=r==null?void 0:r.executionSummary,i=s&&typeof s.totalDurationMs=="number"?fme(s.totalDurationMs):R0(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.outputTokens=="number"&&s.outputTokens>0?s.outputTokens:0;o>0&&n.push(W5(o));const a=V5(e);return a&&n.push(Ls(a,80)),n.join(" · ")}function pme(){return h.jsx("svg",{className:as.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 gme({agents:e,pendingApproval:t}){const{t:n}=lt(),[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?Vj(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=>fl(b,t.toolCallId)):void 0,y=r||!!p,v=e.some(b=>Gm(b)==="failed")?"failed":u?"in_progress":"completed";return h.jsxs("div",{className:as.wrap,children:[h.jsxs("button",{type:"button",className:as.summary,onClick:()=>s(b=>!b),"aria-expanded":y,title:n(y?"tool.collapseHint":"tool.expand"),children:[v==="failed"?h.jsx("span",{className:as.summaryStatus,children:h.jsx(Ru,{status:v})}):h.jsx("span",{className:as.summaryIcon,"aria-hidden":"true",children:h.jsx(pme,{})}),h.jsxs("span",{className:u?`${as.summaryText} ${as.summaryTextActive}`:as.summaryText,children:[n("parallelAgents.title"),d&&h.jsxs(h.Fragment,{children:[" ",d]}),h.jsx("span",{className:as.summaryDot,children:"·"}),n("parallelAgents.done",{done:f,total:m})]}),h.jsx("span",{className:y?as.chevronDown:as.chevronRight,"aria-hidden":"true"})]}),y&&h.jsx("div",{className:as.group,children:h.jsx("div",{className:as.list,children:e.map(b=>{const w=G5(b),x=K5(b),k=Sae(b,n),T=mme(b,a),A=Gm(b),M=i===b.callId;return h.jsxs("div",{children:[h.jsxs("div",{className:as.row,onClick:()=>o(M?null:b.callId),children:[h.jsx(Ru,{status:A}),h.jsxs("span",{className:as.rowDesc,children:[Ls(x||w,50),k&&h.jsx("span",{className:as.rowTool,children:` (${k})`})]}),T&&h.jsx("span",{className:as.rowStats,children:T})]}),M&&h.jsx("div",{className:as.detail,children:h.jsx(Y5,{tool:b,hideHeader:!0})})]},b.callId)})})})]})}const yme="_collapseRow_d7f01_1",bme="_collapseRowClickable_d7f01_14",wme="_collapseLabel_d7f01_19",vme="_processedLabel_d7f01_36",xme="_processedMeta_d7f01_43",_me="_hiddenMetrics_d7f01_47",kme="_summaryMetrics_d7f01_51",Sme="_collapseIcon_d7f01_59",Tme="_chevronRight_d7f01_72",Cme="_chevronDown_d7f01_73",Eo={collapseRow:yme,collapseRowClickable:bme,collapseLabel:wme,processedLabel:vme,processedMeta:xme,hiddenMetrics:_me,summaryMetrics:kme,collapseIcon:Sme,chevronRight:Tme,chevronDown:Cme},Ame="_list_nr8ju_1",Eme="_rowFlash_nr8ju_33",Mme="_turnStatusRow_nr8ju_38",Ime="_turnAnswerRow_nr8ju_39",Nme="_turnContentRow_nr8ju_47",Rme="_turnContentClip_nr8ju_51",Lme="_turnContentCollapsed_nr8ju_59",jme="_turnContentInner_nr8ju_63",Dme="_sessionTimelineLayer_nr8ju_68",Ome="_sessionTimelinePanel_nr8ju_81",Bme="_sessionTimelineList_nr8ju_92",Pme="_sessionTimelineItem_nr8ju_102",$me="_sessionTimelineButton_nr8ju_107",zme="_sessionTimelineTick_nr8ju_126",Fme="_sessionTimelineButtonInRange_nr8ju_213",qme="_sessionTimelineButtonCurrent_nr8ju_217",Ume="_sessionTimelineDetails_nr8ju_228",ws={list:Ame,rowFlash:Eme,turnStatusRow:Mme,turnAnswerRow:Ime,turnContentRow:Nme,turnContentClip:Rme,turnContentCollapsed:Lme,turnContentInner:jme,sessionTimelineLayer:Dme,sessionTimelinePanel:Ome,sessionTimelineList:Bme,sessionTimelineItem:Pme,sessionTimelineButton:$me,sessionTimelineTick:zme,sessionTimelineButtonInRange:Fme,sessionTimelineButtonCurrent:qme,sessionTimelineDetails:Ume};function mT(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if((n==null?void 0:n.role)==="user")return n.id}return null}function Hme(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&Vh(n))return n.id}return null}function pT(e){return e.role==="tool_group"&&e.tools.length===1&&Oy(e.tools[0])}function Dw(e){return e.role==="tool_group"&&e.tools.length===1&&_N(e.tools[0])}function gT(e){return e.role==="thinking"}function yT(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>fl(n,t.toolCallId)))}function bT(e){return e.role==="thinking"}function Vme(e,t){const n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.role!=="tool_group"||yT(s,t)){bT(s)||n.push(s),r++;continue}const i=[s];let o=r,a=r+1;for(;a<e.length;){const c=e[a];if(bT(c)){a++;continue}if(c.role==="tool_group"&&!yT(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 rD(e){const t=[];let n=0;for(;n<e.length;){if(Dw(e[n])){const r=[];let s=n;for(;s<e.length;){const i=e[s];if(Dw(i)){r.push(i),s++;continue}if(gT(i)){let o=s+1;for(;o<e.length&&gT(e[o]);)o++;if(o<e.length&&Dw(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(pT(e[n])){const r=n;for(;n<e.length&&pT(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 wT(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_collapse"){const t=e.turnCollapse.liveStartedAt;return t===void 0?`tc:${e.key}`:`tc:${e.key}:${t}`}return e.type==="turn_content"?`turn-content:${e.key}`:`msg:${e.key}`}function Wme(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function nk(e,t,n){let r=t;for(let s=n;s>t;s--)if(sD(e[s])){r=s;break}for(let s=n;s>r;s--)if(Wme(e[s]))return s;return-1}function Gme(e,t){const n=[];for(let s=0;s<e.length;s++){const i=e[s];i.type==="message"&&Vh(i.message)&&n.push(s)}const r=new Set;for(let s=0;s<n.length;s++){if(s===n.length-1&&t)continue;const i=n[s],o=(s+1<n.length?n[s+1]:e.length)-1,a=nk(e,i,o);if(a<0)continue;const l=e[a];l.type==="message"&&l.message.role==="assistant"&&r.add(l.message.id)}return r}function Rx(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=>Rx(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return rk(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 rk(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 Kme(e){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:"Parallel agents"};if(e.type!=="message")return{kind:"none"};const{message:t}=e;switch(t.role){case"thinking":return{kind:"thought",timestamp:t.timestamp,label:"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:t.timestamp}:Lu(t.content,1)?{kind:"commentary",timestamp:t.timestamp,label:"Assistant update"}:{kind:"none",timestamp:t.timestamp};case"tool_group":{const n=t.tools.length;return{kind:"tool",timestamp:t.timestamp,label:`${n} tool call${n===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:t.timestamp,label:"Plan update"};case"system":return rk(t)?{kind:"status",timestamp:t.timestamp,label:"Status update"}:{kind:"none",timestamp:t.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:t.timestamp};default:return{kind:"none"}}}function Lu(e,t,n={}){const s=(n.stripMarkdown===!0?Yme(e):e??"").replace(/\s+/g," ").trim();if(t<=0||!s)return"";const i=Array.from(s);return i.length>t?`${i.slice(0,t-1).join("")}…`:s}function Yme(e){if(!e)return"";const t=[],n=s=>{const i=`\0${t.length}\0`;return t.push(s),i};let r=e.replace(/```[^\n`]*\n?([\s\S]*?)```/g,(s,i)=>n(i)).replace(/!\[([^\]]*)\]\([^)]+\)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/`([^`\n]+)`/g,(s,i)=>n(i)).replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"");r=Ow(r,"~~"),r=Ow(r,"**"),r=Ow(r,"__"),r=r.replace(/\*([^*\s][^*]*?\S)\*/g,"$1").replace(/(^|[^\p{L}\p{N}_])_([^_\s][^_]*?\S)_(?=$|[^\p{L}\p{N}_])/gu,"$1$2");for(const[s,i]of t.entries())r=r.split(`\0${s}\0`).join(i);return r}function Ow(e,t){let n="",r=0;for(;r<e.length;){const s=e.indexOf(t,r);if(s===-1)return n+e.slice(r);const i=s+t.length,o=e.indexOf(t,i);if(o===-1)return n+e.slice(r);const a=e.slice(i,o);n+=a.trim().length===0?e.slice(r,o+t.length):e.slice(r,s)+a,r=o+t.length}return n}function Xme(e){const t=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",n=Lu(t,32);return n||"User turn"}function Vh(e){return e.role==="user"||e.role==="user_shell"}function Qme(e){switch(e.role){case"thinking":return uD.thought;case"assistant":return Lu(e.content,120,{stripMarkdown:!0});case"tool_group":{const t=e.tools.length;return`${t} tool call${t===1?"":"s"}`}case"plan":return"plan update";case"system":return rk(e)?Lu(e.content,120,{stripMarkdown:!0}):"";case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return"";default:return""}}function Jme(e){if(e.type==="parallel_agents"){const t=e.agents.length;return`${t} parallel agent${t===1?"":"s"}`}return e.type!=="message"?"":Qme(e.message)}function Zme(e,t,n){if(t!==null)for(const i of e){if(i.type!=="message")continue;const{message:o}=i;if(o.id!==t||o.role!=="assistant")continue;const a=Lu(o.content,180,{stripMarkdown:!0});if(a)return a}const r=[];for(let i=0;i<e.length;i+=1){const o=e[i];if(o.type==="message"&&t!==null&&o.message.id===t)continue;const a=Jme(o);a&&r.push(a)}const s=Lu(r.join(" · "),180);return s||(n.length>0?n.map(i=>uD[i]).join(" · "):"No activity")}function e0e(e){const t=[];let n=null,r=[];const s=()=>{if(!n)return;const i=rD(r),o=nk(i,-1,i.length-1),a=o>=0?i[o]:null,l=(a==null?void 0:a.type)==="message"&&a.message.role==="assistant"&&!a.message.isStreaming&&Lu(a.message.content,1,{stripMarkdown:!0}).length>0?a.message.id:null,c=[];for(const u of i){if(u.type==="message"&&l!==null&&u.message.id===l)continue;const d=Kme(u);d.kind!=="none"&&!c.includes(d.kind)&&c.push(d.kind)}t.push({id:n.id,label:Xme(n),detail:Zme(i,l,c),timestamp:n.timestamp,nodeKinds:c})};for(const i of e){if(Vh(i)){s(),n=i,r=[];continue}n&&r.push(i)}return s(),t}function t0e(e){var n,r,s;const t=e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0;return[e.callId,e.toolName,e.kind??"",e.status,e.parentToolCallId??"",e.subContent?"sub-content":"",((n=e.subTools)==null?void 0:n.length)??0,String(((r=e.args)==null?void 0:r.subagent_type)??""),((s=e.args)==null?void 0:s.run_in_background)===!0?"background":"",String((t==null?void 0:t.type)??""),String((t==null?void 0:t.status)??"")].join(":")}function n0e(e){return e.map(t=>{const n=`${t.id}:${t.role}:${t.timestamp??""}`;switch(t.role){case"assistant":case"thinking":return`${n}:${t.isStreaming?"streaming":t.content}`;case"tool_group":return`${n}:${t.tools.map(t0e).join(",")}`;case"system":return`${n}:${t.variant}:${t.source??""}:${t.content}`;case"user":return`${n}:${t.content}`;case"user_shell":return`${n}:${t.command}`;case"plan":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return n;default:return n}}).join("|")}function sD(e){return e.type==="parallel_agents"?!0:e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(sD):e.message.role==="tool_group"||e.message.role==="plan"}function vT(e){return e==="pending"||e==="running"||e==="in_progress"}function iD(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const r=iD(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=>vT(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=>vT(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function r0e(e){for(let t=e.length-1;t>=0;t--){const n=iD(e[t]);if(n)return n}return null}function s0e(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 i0e(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 o0e(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function oD(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+oD(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function aD(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const r=e[n];if(r.type==="message"&&Vh(r.message))return r.message.id}return null}function lD(e){const t=[];let n=null;for(const r of e)r.type==="message"&&Vh(r.message)&&(n=r.message.id),t.push(n);return t}function xT(e,t,n,r){const s=r===void 0?aD(e,t):r[t]??null;return s?n.get(s)??null:null}function a0e(e,t,n,r,s=lD(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const l of t){if(l<0||l>=e.length)continue;const c=xT(e,l,n,s);c!==null&&(i=Math.min(i,c),o=Math.max(o,c))}if(o<0)return null;const a=r==null?null:xT(e,r,n,s);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function l0e(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=>fl(o,r)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>fl(o,r)))return!0}return!1}function c0e(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"&&Vh(c.message)&&o.push(l)}if(o.length===0)return e;const a=[];for(let l=0;l<o[0];l++)a.push(e[l]);for(let l=0;l<o.length;l++){const c=o[l],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=l0e(e,c,u,s),v=nk(e,c,u);let b=0,w,x,k=0,T=0,A=0,M=0,D=0,O=!1;for(let q=c+1;q<=u;q++){const P=e[q];Rx(P,q===v)&&b++,M+=oD(P),P.type==="message"&&P.message.role==="thinking"&&D++;const ne=s0e(P);ne!==void 0&&(w=w===void 0?ne:Math.max(w,ne));const pe=i0e(P);pe!==void 0&&(x=x===void 0?pe:Math.max(x,pe));const be=o0e(P);be&&(k+=be.inputTokens,T+=be.outputTokens,A+=be.cachedTokens??0,O=!0)}const C=p?r??m??Date.now():void 0,L=w??x,I=m!==void 0&&L!==void 0&&L>=m?L-m:void 0;if(y||b===0&&!(O||I!==void 0||C!==void 0)){for(let q=c;q<=u;q++)a.push(e[q]);continue}const W=!(b===0?!0:t.has(f)?t.get(f):p);let j=0;const K=q=>{q.length!==0&&a.push({type:"turn_content",key:`${f}-content-${j++}`,turnId:f,collapsed:W,items:q})};a.push({type:"message",key:d.key,message:d.message});const J={turnId:f,collapsed:W,hiddenCount:b,...I!==void 0?{elapsedMs:I}:{},...O?{inputTokens:k,outputTokens:T}:{},...A>0?{cachedTokens:A}:{},...M>0?{toolCallCount:M}:{},...D>0?{thinkingCount:D}:{},...C!==void 0?{liveStartedAt:C}:{}};if(a.push({type:"turn_collapse",key:`tc-${f}`,turnCollapse:J}),!W){let q=[];for(let P=c+1;P<=u;P++){const E=e[P];P===v&&E.type==="message"&&E.message.role==="assistant"?(K(q),q=[],a.push({...E,turnCollapse:J})):q.push(E)}K(q);continue}const ee=[],N=[];for(let q=c+1;q<=u;q++){const P=e[q];if(!(q===v&&p)){if(q===v&&P.type==="message"&&P.message.role==="assistant"){N.push({...P,turnCollapse:J});continue}if(Rx(P,q===v)){ee.push(P);continue}N.push(P)}}K(ee),a.push(...N)}return a}function Eg(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=>fl(i,n)))return r}else{if(s.type==="parallel_agents"&&n&&s.agents.some(i=>fl(i,n)))return r;if(s.type==="turn_content"&&Eg(s.items,t,n)>=0)return r}}return-1}const Bw=0,u0e=120,Pw=80,d0e=32,h0e=240,$w=30,cD=200,f0e=4;function m0e(e,t=cD){return e>t}function p0e(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 zw(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function g0e(e){return e!==void 0?p0e(e):""}function y0e(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,r=n>0&&e.inputTokens>0?` (${zw(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${zw(e.inputTokens)}${r} ↓${zw(e.outputTokens)}`}function _T(e,t){const n=[],r=y0e(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 b0e(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const w0e=g.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:r}=lt(),s=t.hiddenCount>0,i=t.liveStartedAt,o=s||i!==void 0||b0e(t),a=J5(i!==void 0&&o),l=g.useRef(0),c=g.useRef(i);c.current!==i&&(c.current=i,l.current=0);let u;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),u=l.current):o&&t.elapsedMs!==void 0?(l.current=0,u=t.elapsedMs):(l.current=0,u=void 0);const d=g0e(u),f=_T(t,r),m=_T(t,r),p=r(i!==void 0?"turn.processing":"turn.processed"),y=!!d&&o,v=!!f&&o,b=!!m&&o;if(!o)return null;const w=()=>{if(!s)return;const x=t.collapsed;n(t.turnId,x)};return h.jsxs("div",{className:s?`${Eo.collapseRow} ${Eo.collapseRowClickable}`:Eo.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?w:void 0,onKeyDown:s?x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),w())}:void 0,children:[h.jsxs("span",{className:Eo.collapseLabel,children:[h.jsxs("span",{className:Eo.processedLabel,children:[p,y&&h.jsxs("span",{className:Eo.processedMeta,children:[" ",d]})]}),b&&h.jsx("span",{className:Eo.summaryMetrics,children:m}),v&&h.jsx("span",{className:Eo.hiddenMetrics,children:f})]}),s&&h.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:Eo.collapseIcon,onClick:x=>{x.stopPropagation(),w()},children:h.jsx("span",{className:t.collapsed?Eo.chevronRight:Eo.chevronDown,"aria-hidden":"true"})})]})});function kT(e){if(e.type==="turn_collapse")return ws.turnStatusRow;if(e.type==="turn_content")return ws.turnContentRow;if(e.type==="message"&&e.turnCollapse)return ws.turnAnswerRow}const v0e=g.memo(function({collapsed:t,children:n}){const r=sk(ws.turnContentClip,t?ws.turnContentCollapsed:void 0);return h.jsx("div",{className:r,"data-collapsed":t?"true":"false",children:h.jsx("div",{className:ws.turnContentInner,children:n})})}),uD={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},x0e=g.memo(function({entries:t,currentTurnId:n,currentRange:r,hidden:s,onSelect:i}){return s||t.length===0?null:h.jsx("div",{className:ws.sessionTimelineLayer,"aria-hidden":"false",children:h.jsx("nav",{className:ws.sessionTimelinePanel,"aria-label":"Session timeline","data-testid":"session-timeline",children:h.jsx("ol",{className:ws.sessionTimelineList,children:t.map((o,a)=>{const l=r!==null&&a>=r.startIndex&&a<=r.endIndex,c=r!==null?a===r.currentIndex:o.id===n,u=o.nodeKinds.join(","),d=[`Turn ${a+1}: ${o.label}`,c?"Current turn":null].filter(Boolean).join(". ");return h.jsx("li",{className:ws.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":o.id,"data-node-kinds":u,"data-in-current-range":l?"true":void 0,children:h.jsxs("button",{type:"button",className:sk(ws.sessionTimelineButton,l?ws.sessionTimelineButtonInRange:void 0,c?ws.sessionTimelineButtonCurrent:void 0),"aria-current":c?"step":void 0,"aria-label":d,onClick:()=>i(o.id),children:[h.jsx("span",{className:ws.sessionTimelineTick}),h.jsx("span",{className:ws.sessionTimelineDetails,"data-testid":"session-timeline-detail","data-title":o.label,"data-detail":o.detail,"aria-hidden":"true"})]})},o.id)})})})})});function sk(...e){return e.filter(Boolean).join(" ")||void 0}const _0e=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=cD,shellOutputMaxLines:f,autoScrollTailIntoView:m=!1,hideSessionTimeline:p=!1,showRetryHint:y=!1,onRetryClick:v,onBranchSession:b,onCanScrollToBottomChange:w},x){var Sr,rs;const k=g.useContext(Gh),T=g.useMemo(()=>k?Vme(t,n):t,[k,t,n]),A=g.useMemo(()=>rD(T),[T]),M=n0e(T),D=g.useRef(null);((Sr=D.current)==null?void 0:Sr.signature)!==M&&(D.current={signature:M,entries:e0e(T)});const O=D.current.entries,C=g.useMemo(()=>new Map(O.map((fe,ze)=>[fe.id,ze])),[O]),L=g.useMemo(()=>Hme(T),[T]),[I,B]=g.useState(null),F=I!==null?((rs=O[I.currentIndex])==null?void 0:rs.id)??L:L,W=g.useMemo(()=>{var fe;if(i)return null;for(let ze=T.length-1;ze>=0;ze-=1){const St=T[ze];if(St&&(St.role==="tool_group"||St.role==="plan"))return null;if((St==null?void 0:St.role)==="assistant"&&!St.isStreaming&&((fe=St.content)!=null&&fe.trim()))return St.id}return null},[i,T]),j=g.useMemo(()=>Gme(A,i),[A,i]),{collapseCompletedTurns:K}=Lc(),J=K??!0,[ee,N]=g.useState(()=>new Map),q=g.useRef(!0),P=g.useRef(0),E=g.useRef(!1),ne=g.useRef(0),pe=g.useRef(null),be=g.useRef(null),xe=g.useRef(null),we=g.useRef(null),de=g.useRef(s),se=g.useRef(s),ae=g.useRef(!1),_e=g.useRef(!1),qe=g.useRef(void 0),He=g.useRef(void 0),re=g.useRef(void 0);se.current=s;const ye=g.useRef(null),Te=g.useCallback(()=>{const fe=ye.current,ze=fe?fe.scrollHeight-fe.scrollTop-fe.clientHeight:0,St=!q.current&&ze>1;be.current!==St&&(be.current=St,w==null||w(St))},[w]),ke=g.useCallback(()=>{re.current!==void 0&&window.cancelAnimationFrame(re.current),re.current=window.requestAnimationFrame(Te)},[Te]),vt=g.useCallback(fe=>{q.current!==fe&&(q.current=fe,ke())},[ke]),rt=g.useMemo(()=>c0e(A,{overrides:ee,isResponding:i,activeTurnStartedAt:o,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:J}),[A,ee,i,o,n==null?void 0:n.toolCallId,J]),Mt=g.useMemo(()=>lD(rt),[rt]),[Pt,Ze]=g.useState(!1),bt=O.length>=f0e;g.useLayoutEffect(()=>{if(p||!bt){Ze(sn=>sn&&!1);return}const fe=ye.current;if(!fe)return;const ze=()=>{const nn=fe.getBoundingClientRect().width>=1160;Ze(yr=>yr===nn?yr:nn)};if(ze(),typeof ResizeObserver>"u")return;const St=new ResizeObserver(ze);return St.observe(fe),()=>St.disconnect()},[bt,p]);const ft=c!=null,ie=!!a,H=ie?1:0,oe=H+rt.length,De=oe+(ft?1:0),tt=m0e(De,d),Ct=g.useCallback(()=>ye.current,[]),Et=g.useCallback(()=>{const fe=ye.current;if(!fe)return;const ze=fe.scrollHeight-fe.scrollTop-fe.clientHeight;vt(ze<$w),ke()},[ke,vt]),Qt=g.useCallback(()=>{_e.current=!0,qe.current!==void 0&&window.cancelAnimationFrame(qe.current),He.current!==void 0&&window.clearTimeout(He.current),qe.current=window.requestAnimationFrame(Et),He.current=window.setTimeout(()=>{_e.current=!1,qe.current=void 0,He.current=void 0,Et()},220)},[Et]);g.useEffect(()=>()=>{qe.current!==void 0&&window.cancelAnimationFrame(qe.current),He.current!==void 0&&window.clearTimeout(He.current),re.current!==void 0&&window.cancelAnimationFrame(re.current)},[]);const on=g.useCallback((fe,ze)=>{const St=ye.current;(!St||St.scrollHeight>St.clientHeight+1)&&vt(!1),Qt(),N(sn=>{const nn=new Map(sn);return nn.set(fe,ze),nn})},[Qt,vt]),he=g.useCallback(fe=>{const ze=fe.target;ze instanceof HTMLElement&&ze.closest("[aria-expanded]")&&(vt(!1),Qt())},[Qt,vt]),X=g.useCallback(fe=>{if(ie&&fe===Bw)return"slot:header";if(ft&&fe===oe)return`slot:tail:${u}`;const ze=rt[fe-H];return ze?wT(ze):`slot:row:${fe}`},[ie,ft,oe,u,rt,H]),ue=g.useCallback((fe="auto")=>{const ze=Ct();if(!ze||ze.scrollHeight<=ze.clientHeight)return;ne.current+=1;const St=ne.current;E.current=!0,fe==="smooth"?ze.scrollTo({top:ze.scrollHeight,behavior:fe}):ze.scrollTop=ze.scrollHeight,ke(),P.current=Math.max(0,ze.scrollHeight-ze.clientHeight),Te();const sn=()=>{ne.current===St&&(E.current=!1)};fe==="smooth"?setTimeout(sn,350):requestAnimationFrame(sn)},[Ct,Te,ke]),me=g.useCallback((fe="smooth")=>{vt(!0),ue(fe)},[ue,vt]),We=bV({count:De,enabled:tt,getScrollElement:Ct,getItemKey:X,estimateSize:fe=>{if(ie&&fe===Bw)return u0e;if(ft&&fe===oe)return h0e;const ze=rt[fe-H];return(ze==null?void 0:ze.type)==="turn_collapse"?d0e:(ze==null?void 0:ze.type)==="turn_content"?Math.max(Pw,ze.items.length*Pw):Pw},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),At=We.getVirtualItems(),jt=We.getTotalSize(),dt=g.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});dt.current={entryIndexById:C,headerOffset:H,isVisible:Pt,turnIdByDisplayIndex:Mt,visibleItems:rt};const Wt=g.useCallback(()=>{const fe=Ct(),ze=dt.current;if(!fe||!ze.isVisible||ze.entryIndexById.size===0){B(rn=>rn===null?rn:null);return}const St=fe.getBoundingClientRect(),sn=St.top,nn=St.bottom,yr=sn+(nn-sn)/2,qr=[];let Ps=null,hr=Number.POSITIVE_INFINITY;fe.querySelectorAll("[data-index]").forEach(rn=>{const Ur=rn.dataset.index;if(Ur===void 0)return;const $s=Number(Ur);if(!Number.isFinite($s))return;const Hr=$s-ze.headerOffset;if(Hr<0||Hr>=ze.visibleItems.length)return;const br=rn.getBoundingClientRect();if(br.bottom<sn||br.top>nn)return;qr.push(Hr);const xt=br.top+(br.bottom-br.top)/2,Ea=Math.abs(xt-yr);Ea<hr&&(hr=Ea,Ps=Hr)});const Gt=a0e(ze.visibleItems,qr,ze.entryIndexById,Ps,ze.turnIdByDisplayIndex);B(rn=>(rn==null?void 0:rn.startIndex)===(Gt==null?void 0:Gt.startIndex)&&(rn==null?void 0:rn.endIndex)===(Gt==null?void 0:Gt.endIndex)&&(rn==null?void 0:rn.currentIndex)===(Gt==null?void 0:Gt.currentIndex)?rn:Gt)},[Ct]),Rn=g.useCallback(()=>{pe.current!==null&&cancelAnimationFrame(pe.current),pe.current=requestAnimationFrame(()=>{pe.current=null,Wt()})},[Wt]);g.useEffect(()=>()=>{pe.current!==null&&(cancelAnimationFrame(pe.current),pe.current=null)},[]),g.useEffect(()=>{Rn()},[Rn,De,jt,tt,At.length,Pt]);const[ln,xn]=g.useState(null);g.useEffect(()=>{if(!ln)return;const fe=setTimeout(()=>xn(null),1600);return()=>clearTimeout(fe)},[ln]);const Ee=g.useCallback(fe=>{var sn,nn;vt(!1),ne.current+=1;const ze=ne.current;E.current=!0,tt?We.scrollToIndex(fe,{align:"center"}):(nn=(sn=ye.current)==null?void 0:sn.querySelector(`[data-index="${fe}"]`))==null||nn.scrollIntoView({block:"center"}),setTimeout(()=>{ne.current===ze&&(E.current=!1,Rn(),ke())},150);const St=X(fe);xn(null),requestAnimationFrame(()=>xn(St))},[tt,We,X,vt,Rn,ke]),ht=g.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});ht.current={visibleItems:rt,displayItems:A,headerOffset:H,performScrollToRow:Ee};const en=g.useRef(null),ns=g.useCallback((fe,ze)=>{const{visibleItems:St,displayItems:sn,headerOffset:nn,performScrollToRow:yr}=ht.current,qr=Eg(St,fe,ze);if(qr>=0){const Gt=St[qr];return(Gt==null?void 0:Gt.type)==="turn_content"&&Gt.collapsed?(en.current={messageId:fe,callId:ze},N(rn=>{if(rn.get(Gt.turnId)===!0)return rn;const Ur=new Map(rn);return Ur.set(Gt.turnId,!0),Ur}),!0):(en.current=null,yr(qr+nn),!0)}const Ps=Eg(sn,fe,ze);if(Ps<0)return!1;const hr=aD(sn,Ps);return hr?(en.current={messageId:fe,callId:ze},N(Gt=>{if(Gt.get(hr)===!0)return Gt;const rn=new Map(Gt);return rn.set(hr,!0),rn}),!0):!1},[]);g.useImperativeHandle(x,()=>({scrollToMessage:ns,scrollToBottom:me}),[ns,me]),g.useEffect(()=>{const fe=en.current;if(!fe)return;const ze=Eg(rt,fe.messageId,fe.callId);ze<0||(en.current=null,Ee(ze+H))},[rt,H,Ee]);const ri=g.useCallback(()=>{const fe=Ct();if(!fe)return;if(E.current){P.current=fe.scrollTop;return}Rn();const ze=P.current,St=fe.scrollTop;P.current=St;const sn=fe.scrollHeight-St-fe.clientHeight;if(ke(),St<ze-1){vt(sn<$w);return}sn<$w&&vt(!0)},[Ct,ke,Rn,vt]);g.useEffect(()=>{const fe=Ct();if(fe)return fe.addEventListener("scroll",ri,{passive:!0}),()=>fe.removeEventListener("scroll",ri)},[Ct,ri]),g.useEffect(()=>{const fe=Ct();if(!fe||typeof ResizeObserver>"u")return;const ze=new ResizeObserver(ke);ze.observe(fe);for(const sn of Array.from(fe.children))ze.observe(sn);const St=new MutationObserver(sn=>{for(const nn of sn){for(const yr of Array.from(nn.addedNodes))yr instanceof HTMLElement&&ze.observe(yr);for(const yr of Array.from(nn.removedNodes))yr instanceof HTMLElement&&ze.unobserve(yr)}ke()});return St.observe(fe,{childList:!0}),ke(),()=>{ze.disconnect(),St.disconnect()}},[Ct,ke]),g.useEffect(()=>{t.length===0&&(vt(!0),en.current=null,N(fe=>fe.size?new Map:fe))},[t.length,vt]),g.useEffect(()=>{const fe=ye.current;if(!fe)return;const ze=new ResizeObserver(()=>{Rn(),!se.current&&q.current&&requestAnimationFrame(()=>{!se.current&&q.current&&ue()})});return ze.observe(fe),()=>ze.disconnect()},[ue,Rn]),g.useEffect(()=>{const fe=mT(t);if(s){xe.current=fe;return}fe&&fe!==xe.current&&(vt(!0),en.current=null),xe.current=fe},[t,s,vt]),g.useEffect(()=>{de.current&&!s&&(vt(!0),requestAnimationFrame(()=>ue())),de.current=s},[s,ue,vt]);const Si=g.useMemo(()=>r0e(rt),[rt]);g.useLayoutEffect(()=>{if(!s){if(!Si){we.current=null;return}Si!==we.current&&(we.current=Si,q.current&&requestAnimationFrame(()=>{q.current&&ue()}))}},[s,Si,ue]),g.useEffect(()=>{m&&ft&&!ae.current&&(vt(!0),requestAnimationFrame(()=>{q.current&&ue()})),ae.current=ft},[m,ft,ue,vt]);const $o=g.useCallback(fe=>{const ze=(nn,yr)=>nn.type==="parallel_agents"?h.jsx(Nv,{timestamp:nn.timestamp,children:h.jsx(gme,{agents:nn.agents,pendingApproval:n})}):nn.type==="turn_collapse"?h.jsx(w0e,{turnCollapse:nn.turnCollapse,onToggleCollapse:on}):nn.type==="turn_content"?h.jsx(v0e,{collapsed:nn.collapsed,children:nn.items.map(qr=>h.jsx("div",{className:kT(qr),children:ze(qr,!1)},wT(qr)))}):h.jsx(Ufe,{message:nn.message,pendingApproval:n,onShowContextDetail:r,workspaceCwd:l,isLatest:yr,showRetryHint:y,onRetryClick:v,onBranchSession:b,showAssistantActions:nn.message.role==="assistant"&&j.has(nn.message.id),showAssistantBranch:nn.message.role==="assistant"&&nn.message.id===W,shellOutputMaxLines:f});if(ie&&fe===Bw)return a;if(ft&&fe===oe)return c;const St=fe-H,sn=rt[St];return sn?ze(sn,St===rt.length-1):null},[ie,a,ft,c,oe,n,r,H,rt,j,W,l,y,v,b,f,on]),gr=g.useCallback((fe,ze)=>sk(ln===fe?ws.rowFlash:void 0,ze?kT(ze):void 0),[ln]);return g.useLayoutEffect(()=>{if(!s&&!E.current&&!_e.current&&q.current){const fe=mT(t),ze=fe!==null&&fe!==xe.current;ue(ze?"smooth":"auto")}},[jt,t,De,s,ue]),g.useLayoutEffect(()=>{ke()},[t,ke,De,jt]),h.jsxs("div",{ref:ye,className:ws.list,onClickCapture:he,children:[h.jsx(x0e,{entries:O,currentTurnId:F,currentRange:I,hidden:!Pt,onSelect:ns}),tt?h.jsx("div",{style:{height:jt,width:"100%",position:"relative"},children:At.map(fe=>h.jsx("div",{"data-index":fe.index,ref:We.measureElement,className:gr(String(fe.key),rt[fe.index-H]),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${fe.start}px)`},children:$o(fe.index)},fe.key))}):Array.from({length:De},(fe,ze)=>{const St=X(ze),sn=rt[ze-H];return h.jsx("div",{"data-index":ze,className:gr(St,sn),children:$o(ze)},St)})]})});/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function k0e(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 S0e(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||!k0e(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 Lx=[],dD=[];(()=>{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?dD:Lx).push(n=n+e[t])})();function T0e(e){if(e<768)return!1;for(let t=0,n=Lx.length;;){let r=t+n>>1;if(e<Lx[r])n=r;else if(e>=dD[r])t=r+1;else return!0;if(t==n)return!1}}function ST(e){return e>=127462&&e<=127487}const TT=8205;function C0e(e,t,n=!0,r=!0){return(n?hD:A0e)(e,t,r)}function hD(e,t,n){if(t==e.length)return t;t&&fD(e.charCodeAt(t))&&mD(e.charCodeAt(t-1))&&t--;let r=Fw(e,t);for(t+=CT(r);t<e.length;){let s=Fw(e,t);if(r==TT||s==TT||n&&T0e(s))t+=CT(s),r=s;else if(ST(s)){let i=0,o=t-2;for(;o>=0&&ST(Fw(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function A0e(e,t,n){for(;t>0;){let r=hD(e,t-2,n);if(r<t)return r;t--}return 0}function Fw(e,t){let n=e.charCodeAt(t);if(!mD(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return fD(r)?(n-55296<<10)+(r-56320)+65536:n}function fD(e){return e>=56320&&e<57344}function mD(e){return e>=55296&&e<56320}function CT(e){return e<65536?1:2}class vn{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]=bh(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),oa.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]=bh(this,t,n);let r=[];return this.decompose(t,n,r,0),oa.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 ym(this),i=new ym(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 ym(this,t)}iterRange(t,n=this.length){return new pD(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 gD(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]?vn.empty:t.length<=32?new Cr(t):oa.from(Cr.split(t,[]))}}class Cr extends vn{constructor(t,n=E0e(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 M0e(s,a,r,o);s=a+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new Cr(AT(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let o=r.pop(),a=Mg(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new Cr(a,o.length+i.length));else{let l=a.length>>1;r.push(new Cr(a.slice(0,l)),new Cr(a.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof Cr))return super.replace(t,n,r);[t,n]=bh(this,t,n);let s=Mg(this.text,Mg(r.text,AT(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new Cr(s,i):oa.from(Cr.split(s,[]),i)}sliceString(t,n=this.length,r=`
`){[t,n]=bh(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 Cr(r,s)),r=[],s=-1);return s>-1&&n.push(new Cr(r,s)),n}}class oa extends vn{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]=bh(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 oa(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]=bh(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 oa))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 Cr(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 oa)for(let y of m.children)d(y);else m.lines>o&&(l>o||!l)?(f(),a.push(m)):m instanceof Cr&&l&&(p=u[u.length-1])instanceof Cr&&m.lines+p.lines<=32?(l+=m.lines,c+=m.length+1,u[u.length-1]=new Cr(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]:oa.from(u,c)),c=-1,l=u.length=0)}for(let m of t)d(m);return f(),a.length==1?a[0]:new oa(a,n)}}vn.empty=new Cr([""],0);function E0e(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Mg(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 AT(e,t,n){return Mg(e,[""],t,n)}class ym{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 Cr?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 Cr?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 Cr){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 Cr?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 pD{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new ym(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 gD{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"&&(vn.prototype[Symbol.iterator]=function(){return this.iter()},ym.prototype[Symbol.iterator]=pD.prototype[Symbol.iterator]=gD.prototype[Symbol.iterator]=function(){return this});class M0e{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 bh(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function js(e,t,n=!0,r=!0){return C0e(e,t,n,r)}function I0e(e){return e>=56320&&e<57344}function N0e(e){return e>=55296&&e<56320}function Ol(e,t){let n=e.charCodeAt(t);if(!N0e(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return I0e(r)?(n-55296<<10)+(r-56320)+65536:n}function R0e(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function bd(e){return e<65536?1:2}const jx=/\r\n?|\n/;var ji=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(ji||(ji={}));class ba{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){Dx(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 ba(t)}composeDesc(t){return this.empty?t:t.empty?this:yD(this,t)}mapDesc(t,n=!1){return t.empty?this:Ox(this,t,n)}mapPos(t,n=-1,r=ji.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!=ji.Simple&&c>=t&&(r==ji.TrackDel&&s<t&&c>t||r==ji.TrackBefore&&s<t||r==ji.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 ba(t)}static create(t){return new ba(t)}}class Xr extends ba{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 Dx(this,(n,r,s,i,o)=>t=t.replace(s,s+(r-n),o),!1),t}mapDesc(t,n=!1){return Ox(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(vn.empty);r.push(o?t.slice(i,i+o):vn.empty)}i+=o}return new Xr(n,r)}compose(t){return this.empty?t:t.empty?this:yD(this,t,!0)}map(t,n=!1){return t.empty?this:Ox(this,t,n,!0)}iterChanges(t,n=!1){Dx(this,t,n)}get desc(){return ba.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new Xm(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);Ms(s,u,-1);let d=i.ins==-1?-1:i.off==0?i.ins:0;Ms(n,u,d),d>0&&Zl(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);Ms(n,u,-1),Ms(s,u,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(u),a+=u}}return{changes:new Xr(n,r),filtered:ba.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&&Ms(s,n-o,-1);let d=new Xr(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 Xr){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"?vn.of(m.split(r||jx)):m:vn.empty,y=p.length;if(d==f&&y==0)return;d<o&&l(),d>o&&Ms(s,d-o,-1),Ms(s,f-d,y),Zl(i,s,p),o=f}}return c(t),l(!a),a}static empty(t){return new Xr(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(vn.empty);r[s]=vn.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new Xr(n,r)}static createSet(t,n){return new Xr(t,n)}}function Ms(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 Zl(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(vn.empty);e.push(n)}}function Dx(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=vn.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 Ox(e,t,n,r=!1){let s=[],i=r?[]:null,o=new Xm(e),a=new Xm(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);Ms(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(Ms(s,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Ms(s,0,o.ins),i&&Zl(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;Ms(s,c,l<o.i?o.ins:0),i&&l<o.i&&Zl(i,s,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return i?Xr.createSet(s,i):ba.create(s);throw new Error("Mismatched change set lengths")}}}function yD(e,t,n=!1){let r=[],s=n?[]:null,i=new Xm(e),o=new Xm(t);for(let a=!1;;){if(i.done&&o.done)return s?Xr.createSet(r,s):ba.create(r);if(i.ins==0)Ms(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)Ms(r,0,o.ins,a),s&&Zl(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;Ms(r,l,u,a),s&&u&&Zl(s,r,o.text)}else o.ins==-1?(Ms(r,i.off?0:i.len,l,a),s&&Zl(s,r,i.textBit(l))):(Ms(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&Zl(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 Xm{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?vn.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?vn.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 hu{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 hu(r,s,this.flags)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Le.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Le.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 Le.range(t.anchor,t.head)}static create(t,n,r){return new hu(t,n,r)}}class Le{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Le.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 Le([this.main],0)}addRange(t,n=!0){return Le.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,Le.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 Le(t.ranges.map(n=>hu.fromJSON(n)),t.main)}static single(t,n=t){return new Le([Le.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 Le.normalized(t.slice(),n);r=i.to}return new Le(t,n)}static cursor(t,n=0,r,s){return hu.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?hu.create(n,t,48|o):hu.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?Le.range(l,a):Le.range(a,l))}}return new Le(t,n)}}function bD(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let ik=0;class It{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=ik++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new It(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:ok),!!t.static,t.enables)}of(t){return new Ig([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ig(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ig(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function ok(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class Ig{constructor(t,n,r,s){this.dependencies=t,this.facet=n,this.type=r,this.value=s,this.id=ik++}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)||Bx(d,u)){let m=r(d);if(a?!ET(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=V1(f,p);if(this.dependencies.every(v=>v instanceof It?f.facet(v)===d.facet(v):v instanceof Ca?f.field(v,!1)==d.field(v,!1):!0)||(a?ET(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 ET(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 Bx(e,t){let n=!1;for(let r of t)bm(e,r)&1&&(n=!0);return n}function L0e(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=V1(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)bm(l,c);return l.values[o]=a(l),1},update(l,c){if(!Bx(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=Bx(l,r),d=c.config.facets[t.id],f=c.facet(t);if(d&&!u&&ok(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 Lp=It.define({static:!0});class Ca{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 Ca(ik++,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(Lp).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(Lp),o=s.facet(Lp),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,Lp.of({field:this,create:t})]}get extension(){return this}}const ou={lowest:4,low:3,default:2,high:1,highest:0};function kf(e){return t=>new wD(t,e)}const Ku={highest:kf(ou.highest),high:kf(ou.high),default:kf(ou.default),low:kf(ou.low),lowest:kf(ou.lowest)};class wD{constructor(t,n){this.inner=t,this.prec=n}}class Yu{of(t){return new Px(this,t)}reconfigure(t){return Yu.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class Px{constructor(t,n){this.compartment=t,this.inner=n}}class H1{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 j0e(t,n,o))f instanceof Ca?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,ok(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=>L0e(v,p,m))}}let d=c.map(f=>f(a));return new H1(t,o,d,a,l,i)}}function j0e(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 Px&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let c of o)i(c,a);else if(o instanceof Px){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 wD)i(o.inner,o.prec);else if(o instanceof Ca)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof Ig)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,ou.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,ou.default),r.reduce((o,a)=>o.concat(a))}function bm(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 V1(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const vD=It.define(),$x=It.define({combine:e=>e.some(t=>t),static:!0}),xD=It.define({combine:e=>e.length?e[0]:void 0,static:!0}),_D=It.define(),kD=It.define(),SD=It.define(),TD=It.define({combine:e=>e.length?e[0]:!1});class _l{constructor(t,n){this.type=t,this.value=n}static define(){return new D0e}}class D0e{of(t){return new _l(this,t)}}class O0e{constructor(t){this.map=t}of(t){return new qn(this,t)}}class qn{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 qn(this.type,n)}is(t){return this.type==t}static define(t={}){return new O0e(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}}qn.reconfigure=qn.define();qn.appendConfig=qn.define();class Jr{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&&bD(r,n.newLength),i.some(a=>a.type==Jr.time)||(this.annotations=i.concat(Jr.time.of(Date.now())))}static create(t,n,r,s,i,o){return new Jr(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(Jr.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Jr.time=_l.define();Jr.userEvent=_l.define();Jr.addToHistory=_l.define();Jr.remote=_l.define();function B0e(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 CD(e,t,n){var r;let s,i,o;return n?(s=t.changes,i=Xr.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:qn.mapEffects(e.effects,s).concat(qn.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function zx(e,t,n){let r=t.selection,s=Kd(t.annotations);return t.userEvent&&(s=s.concat(Jr.userEvent.of(t.userEvent))),{changes:t.changes instanceof Xr?t.changes:Xr.of(t.changes||[],n,e.facet(xD)),selection:r&&(r instanceof Le?r:Le.single(r.anchor,r.head)),effects:Kd(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function AD(e,t,n){let r=zx(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=CD(r,zx(e,t[i],o?r.changes.newLength:e.doc.length),o)}let s=Jr.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return $0e(n?P0e(s):s)}function P0e(e){let t=e.startState,n=!0;for(let s of t.facet(_D)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:B0e(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=Xr.empty(t.doc.length);else{let o=e.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Jr.create(t,s,e.selection&&e.selection.map(i),qn.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(kD);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof Jr?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Jr?e=i[0]:e=AD(t,Kd(i),!1)}return e}function $0e(e){let t=e.startState,n=t.facet(SD),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=CD(r,zx(t,i,e.changes.newLength),!0))}return r==e?e:Jr.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const z0e=[];function Kd(e){return e==null?z0e:Array.isArray(e)?e:[e]}var Za=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Za||(Za={}));const F0e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Fx;try{Fx=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function q0e(e){if(Fx)return Fx.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||F0e.test(n)))return!0}return!1}function U0e(e){return t=>{if(!/\S/.test(t))return Za.Space;if(q0e(t))return Za.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Za.Word;return Za.Other}}class jn{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++)bm(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 bm(this,r),V1(this,r)}update(...t){return AD(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let a of t.effects)a.is(Yu.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(qn.reconfigure)?(n=null,r=a.value):a.is(qn.appendConfig)&&(n=null,r=Kd(r).concat(a.value));let i;n?i=t.startState.values.slice():(n=H1.resolve(r,s,this),i=new jn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=t.startState.facet($x)?t.newSelection:t.newSelection.asSingle();new jn(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:Le.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=Kd(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=qn.mapEffects(o,u).concat(qn.mapEffects(Kd(l.effects),d))}return{changes:s,selection:Le.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Xr?t:Xr.of(t,this.doc.length,this.facet(jn.lineSeparator))}toText(t){return vn.of(t.split(this.facet(jn.lineSeparator)||jx))}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:(bm(this,n),V1(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 Ca&&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 jn.create({doc:t.doc,selection:Le.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=H1.resolve(t.extensions||[],new Map),r=t.doc instanceof vn?t.doc:vn.of((t.doc||"").split(n.staticFacet(jn.lineSeparator)||jx)),s=t.selection?t.selection instanceof Le?t.selection:Le.single(t.selection.anchor,t.selection.head):Le.single(0);return bD(s,r.length),n.staticFacet($x)||(s=s.asSingle()),new jn(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(jn.tabSize)}get lineBreak(){return this.facet(jn.lineSeparator)||`
`}get readOnly(){return this.facet(TD)}phrase(t,...n){for(let r of this.facet(jn.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(vD))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 U0e(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=js(n,o,!1);if(i(n.slice(l,o))!=Za.Word)break;o=l}for(;a<s;){let l=js(n,a);if(i(n.slice(a,l))!=Za.Word)break;a=l}return o==a?null:Le.range(o+r,a+r)}}jn.allowMultipleSelections=$x;jn.tabSize=It.define({combine:e=>e.length?e[0]:4});jn.lineSeparator=xD;jn.readOnly=TD;jn.phrases=It.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])}});jn.languageData=vD;jn.changeFilter=_D;jn.transactionFilter=kD;jn.transactionExtender=SD;Yu.reconfigure=qn.define();function ab(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 Sc{eq(t){return this==t}range(t,n=t){return qx.create(t,n,this)}}Sc.prototype.startSide=Sc.prototype.endSide=0;Sc.prototype.point=!1;Sc.prototype.mapMode=ji.TrackDel;function ak(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let qx=class ED{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new ED(t,n,r)}};function Ux(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class lk{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 lk(s,i,r,a):null,pos:o}}}class On{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 On(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(Ux)),this.isEmpty)return n.length?On.of(n):this;let a=new MD(this,null,-1).goto(0),l=0,c=[],u=new ju;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(qx.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?On.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 On(r,n,i||On.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 Qm.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return Qm.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=MT(o,a,r),c=new Sf(o,l,i),u=new Sf(a,l,i);r.iterGaps((d,f,m)=>IT(c,d,u,f,m,s)),r.empty&&r.length==0&&IT(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=MT(i,o),l=new Sf(i,a,0).goto(r),c=new Sf(o,a,0).goto(r);for(;;){if(l.to!=c.to||!Hx(l.active,c.active)||l.point&&(!c.point||!ak(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 Sf(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 ju;for(let s of t instanceof qx?[t]:n?H0e(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return On.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=On.empty;s=s.nextLayer)n=new On(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}On.empty=new On([],[],null,-1);function H0e(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Ux(t,r)>0)return e.slice().sort(Ux);t=r}return e}On.empty.nextLayer=On.empty;class ju{finishChunk(t){this.chunks.push(new lk(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 ju)).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(On.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=On.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function MT(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 MD{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 Qm{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 MD(o,n,r,i));return s.length==1?s[0]:new Qm(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--)qw(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--)qw(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(),qw(this.heap,0)}}}function qw(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 Sf{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=Qm.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){jp(this.active,t),jp(this.activeTo,t),jp(this.activeRank,t),this.minActive=NT(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++;Dp(this.active,n,r),Dp(this.activeTo,n,s),Dp(this.activeRank,n,i),t&&Dp(t,n,this.cursor.from),this.minActive=NT(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&&jp(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 IT(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&&ak(e.point,n.point)&&Hx(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,p,e.point,n.point),u=!1):(u&&i.boundChange(a),p>a&&!Hx(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 Hx(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!ak(e[n],t[n]))return!1;return!0}function jp(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function Dp(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function NT(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 L0(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=js(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=js(e,s)}return e.length}const Vx="ͼ",RT=typeof Symbol>"u"?"__"+Vx:Symbol.for(Vx),Wx=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),LT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Tc{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=LT[RT]||1;return LT[RT]=t+1,Vx+t.toString(36)}static mount(t,n,r){let s=t[Wx],i=r&&r.nonce;s?i&&s.setNonce(i):s=new W0e(t,i),s.mount(Array.isArray(n)?n:[n],t)}}let jT=new Map;class W0e{constructor(t,n){let r=t.ownerDocument||t,s=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let i=jT.get(r);if(i)return t[Wx]=i;this.sheet=new s.CSSStyleSheet,jT.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[Wx]=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 Cc={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:"'"},Jm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},G0e=typeof navigator<"u"&&/Mac/.test(navigator.platform),K0e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var vs=0;vs<10;vs++)Cc[48+vs]=Cc[96+vs]=String(vs);for(var vs=1;vs<=24;vs++)Cc[vs+111]="F"+vs;for(var vs=65;vs<=90;vs++)Cc[vs]=String.fromCharCode(vs+32),Jm[vs]=String.fromCharCode(vs);for(var Uw in Cc)Jm.hasOwnProperty(Uw)||(Jm[Uw]=Cc[Uw]);function Y0e(e){var t=G0e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||K0e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Jm:Cc)[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 Gs=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Gx=typeof document<"u"?document:{documentElement:{style:{}}};const Kx=/Edge\/(\d+)/.exec(Gs.userAgent),ID=/MSIE \d/.test(Gs.userAgent),Yx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Gs.userAgent),lb=!!(ID||Yx||Kx),DT=!lb&&/gecko\/(\d+)/i.test(Gs.userAgent),Hw=!lb&&/Chrome\/(\d+)/.exec(Gs.userAgent),OT="webkitFontSmoothing"in Gx.documentElement.style,Xx=!lb&&/Apple Computer/.test(Gs.vendor),BT=Xx&&(/Mobile\/\w+/.test(Gs.userAgent)||Gs.maxTouchPoints>2);var ot={mac:BT||/Mac/.test(Gs.platform),windows:/Win/.test(Gs.platform),linux:/Linux|X11/.test(Gs.platform),ie:lb,ie_version:ID?Gx.documentMode||6:Yx?+Yx[1]:Kx?+Kx[1]:0,gecko:DT,gecko_version:DT?+(/Firefox\/(\d+)/.exec(Gs.userAgent)||[0,0])[1]:0,chrome:!!Hw,chrome_version:Hw?+Hw[1]:0,ios:BT,android:/Android\b/.test(Gs.userAgent),webkit:OT,webkit_version:OT?+(/\bAppleWebKit\/(\d+)/.exec(Gs.userAgent)||[0,0])[1]:0,safari:Xx,safari_version:Xx?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Gs.userAgent)||[0,0])[1]:0,tabSize:Gx.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ck(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 W1=Object.create(null);function uk(e,t,n){if(e==t)return!0;e||(e=W1),t||(t=W1);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 X0e(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 PT(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 Q0e(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 Aa{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 Zs=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(Zs||(Zs={}));class mn extends Sc{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 j0(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 Du(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}=ND(t,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new Du(t,r,s,n,t.widget||null,!0)}static line(t){return new D0(t)}static set(t,n=!1){return On.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}mn.none=On.empty;class j0 extends mn{constructor(t){let{start:n,end:r}=ND(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?ck(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||W1}eq(t){return this==t||t instanceof j0&&this.tagName==t.tagName&&uk(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)}}j0.prototype.point=!1;class D0 extends mn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof D0&&this.spec.class==t.spec.class&&uk(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)}}D0.prototype.mapMode=ji.TrackBefore;D0.prototype.point=!0;class Du extends mn{constructor(t,n,r,s,i,o){super(n,r,i,t),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?ji.TrackBefore:ji.TrackAfter:ji.TrackDel}get type(){return this.startSide!=this.endSide?Zs.WidgetRange:this.startSide<=0?Zs.WidgetBefore:Zs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Du&&J0e(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)}}Du.prototype.point=!0;function ND(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 J0e(e,t){return e==t||!!(e&&t&&e.compare(t))}function Yd(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 Zm extends Sc{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof Zm&&this.tagName==t.tagName&&uk(this.attributes,t.attributes)}static create(t){return new Zm(t.tagName,t.attributes||W1,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return On.of(t,n)}}Zm.prototype.startSide=Zm.prototype.endSide=-1;function e0(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function Qx(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function wm(e,t){if(!t.anchorNode)return!1;try{return Qx(e,t.anchorNode)}catch{return!1}}function vm(e){return e.nodeType==3?n0(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function xm(e,t,n,r){return n?$T(e,t,n,r,-1)||$T(e,t,n,r,1):!1}function Ac(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function G1(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function $T(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:ml(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=Ac(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?ml(e):0}else return!1}}function ml(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function t0(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Z0e(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 RD(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 epe(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=Z0e(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 w=u.getBoundingClientRect();({scaleX:p,scaleY:y}=RD(u,w)),f={left:w.left,right:w.left+u.clientWidth*p,top:w.top,bottom:w.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 w=t.bottom-t.top,x=f.bottom-f.top;b=(s=="center"&&w<=x?t.top+w/2-x/2:s=="start"||s=="center"&&n<0?t.top-o:t.bottom-x+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 w=0,x=0;if(b){let k=u.scrollTop;u.scrollTop+=b/y,x=(u.scrollTop-k)*y}if(v){let k=u.scrollLeft;u.scrollLeft+=v/p,w=(u.scrollLeft-k)*p}t={left:t.left-w,top:t.top-x,right:t.right-w,bottom:t.bottom-x},w&&Math.abs(w-v)<1&&(r="nearest"),x&&Math.abs(x-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 LD(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 tpe{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?ml(n):0),r,Math.min(t.focusOffset,r?ml(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let Zc=null;ot.safari&&ot.safari_version>=26&&(Zc=!1);function jD(e){if(e.setActive)return e.setActive();if(Zc)return e.focus(Zc);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Zc==null?{get preventScroll(){return Zc={preventScroll:!0},!0}}:void 0),!Zc){Zc=!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 zT;function n0(e,t,n=t){let r=zT||(zT=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function Xd(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 npe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function rpe(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,ml(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=ml(n))}else{if(n==e)return!0;r=Ac(n),n=n.parentNode}}function DD(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 OD(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=ml(n)}else if(n.parentNode&&!G1(n))r=Ac(n),n=n.parentNode;else return null}}function BD(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&&!G1(n))r=Ac(n)+1,n=n.parentNode;else return null}}class Ro{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new Ro(t.parentNode,Ac(t),n)}static after(t,n){return new Ro(t.parentNode,Ac(t)+1,n)}}var sr=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(sr||(sr={}));const Ou=sr.LTR,dk=sr.RTL;function PD(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const spe=PD("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ipe=PD("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Jx=Object.create(null),Qo=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Jx[t]=n,Jx[n]=-t}function $D(e){return e<=247?spe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?ipe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const ope=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class fa{get dir(){return this.level%2?dk:Ou}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 zD(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||!zD(r.inner,s.inner))return!1}return!0}const Wn=[];function ape(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=$D(e.charCodeAt(c));f==512?f=u:f==8&&d==4&&(f=16),Wn[c]=f==4?2:f,f&7&&(d=f),u=f}for(let c=o,u=l,d=l;c<a;c++){let f=Wn[c];if(f==128)c<a-1&&u==Wn[c+1]&&u&24?f=Wn[c]=u:Wn[c]=256;else if(f==64){let m=c+1;for(;m<a&&Wn[m]==64;)m++;let p=c&&u==8||m<n&&Wn[m]==8?d==1?1:8:256;for(let y=c;y<m;y++)Wn[y]=p;c=m-1}else f==8&&d==1&&(Wn[c]=1);u=f,f&7&&(d=f)}}}function lpe(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=Jx[f=e.charCodeAt(d)])if(m<0){for(let y=a-3;y>=0;y-=3)if(Qo[y+1]==-m){let v=Qo[y+2],b=v&2?s:v&4?v&1?i:s:0;b&&(Wn[d]=Wn[Qo[y]]=b),a=y;break}}else{if(Qo.length==189)break;Qo[a++]=d,Qo[a++]=f,Qo[a++]=l}else if((p=Wn[d])==2||p==1){let y=p==s;l=y?0:1;for(let v=a-3;v>=0;v-=3){let b=Qo[v+2];if(b&2)break;if(y)Qo[v+2]|=2;else{if(b&4)break;Qo[v+2]|=4}}}}}function cpe(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=Wn[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(Wn[u]==256)u++;else break;let d=i==1,f=(u<t?Wn[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),Wn[--p]=m;l=u}else i=c,l++}}}function Zx(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=Wn[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(Wn[v]==a)break e;break}}if(c++,f)f.push(y);else{y.from>l&&o.push(new fa(l,y.from,m));let v=y.direction==Ou!=!(m%2);e3(e,v?r+1:r,s,y.inner,y.from,y.to,o),l=y.to}p=y.to}else{if(p==n||(u?Wn[p]!=a:Wn[p]==a))break;p++}f?Zx(e,l,p,r+1,s,f,o):l<p&&o.push(new fa(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=Wn[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(Wn[v-1]==a)break e;break}}if(f)f.push(y);else{y.to<l&&o.push(new fa(y.to,l,m));let v=y.direction==Ou!=!(m%2);e3(e,v?r+1:r,s,y.inner,y.from,y.to,o),l=y.from}p=y.from}else{if(p==t||(u?Wn[p-1]!=a:Wn[p-1]==a))break;p--}f?Zx(e,p,l,r+1,s,f,o):p<l&&o.push(new fa(p,l,m)),l=p}}function e3(e,t,n,r,s,i,o){let a=t%2?2:1;ape(e,s,i,r,a),lpe(e,s,i,r,a),cpe(s,i,r,a),Zx(e,s,i,t,n,r,o)}function upe(e,t,n){if(!e)return[new fa(0,0,t==dk?1:0)];if(t==Ou&&!n.length&&!ope.test(e))return FD(e.length);if(n.length)for(;e.length>Wn.length;)Wn[Wn.length]=256;let r=[],s=t==Ou?0:1;return e3(e,s,s,n,0,e.length,r),r}function FD(e){return[new fa(0,e,0)]}let qD="";function dpe(e,t,n,r,s){var i;let o=r.head-e.from,a=fa.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=js(e.text,o,l.forward(s,n));(u<l.from||u>l.to)&&(u=c),qD=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?Le.cursor(d.side(!s,n)+e.from,d.forward(s,n)?1:-1,d.level):Le.cursor(u+e.from,l.forward(s,n)?-1:1,l.level)}function hpe(e,t,n){for(let r=t;r<n;r++){let s=$D(e.charCodeAt(r));if(s==1)return Ou;if(s==2||s==4)return dk}return Ou}const UD=It.define(),HD=It.define(),VD=It.define(),WD=It.define(),t3=It.define(),GD=It.define(),KD=It.define(),hk=It.define(),fk=It.define(),YD=It.define({combine:e=>e.some(t=>t)}),XD=It.define({combine:e=>e.some(t=>t)}),QD=It.define();class Qd{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 Qd(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 Qd(Le.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Op=qn.define({map:(e,t)=>e.map(t)}),JD=qn.define();function Oi(e,t,n){let r=e.facet(WD);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 Wa=It.define({combine:e=>e.length?e[0]:!0});let fpe=0;const jd=It.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 vi{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(jd.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(jd.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new vi(fpe++,t,r,s,a=>{let l=[];return o&&l.push(cb.of(c=>{let u=c.plugin(a);return u?o(u):mn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return vi.define((r,s)=>new t(r,s),n)}}class Vw{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(Oi(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){Oi(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){Oi(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const ZD=It.define(),mk=It.define(),cb=It.define(),eO=It.define(),pk=It.define(),O0=It.define(),tO=It.define();function FT(e,t){let n=e.state.facet(tO);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return On.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=hpe(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 nO=It.define();function gk(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(nO)){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 zf=It.define();class ho{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new ho(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 ho(u,f,c,d))}return r}}class K1{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=Xr.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 ho(i,o,a,l))),this.changedRanges=s}static create(t,n,r){return new K1(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 mpe=[];class kr{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 mpe}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&&X0e(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=Ac(this.dom),s=this.length?t>0:n>0;return new Ro(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 db)return t;return null}static get(t){return t.cmTile}}class ub extends kr{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=qT(s);else n.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=qT(s);this.length=o}}function qT(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class db extends ub{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=kr.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 il)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 il extends ub{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 il(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class wh extends ub{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new wh(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&&gpe(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):ppe(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 Ro(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 Ro(l.dom,0);l==r.tile&&(a=!0)}}return new Ro(this.dom,0)}}function ppe(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=vm(t);return n[n.length-1]||null}function gpe(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class pi extends ub{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new pi(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class fu extends kr{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?ot.chrome||ot.gecko||(t?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let a=n0(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return ot.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?t0(l,o<0):l||null}static of(t,n){let r=new fu(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Bu extends kr{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 t0(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 t0(o,!a)}}get overrideDOMText(){if(!this.length)return vn.empty;let{root:t}=this;if(!t)return vn.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 Bu(i,r,t,s)}}class Y1 extends kr{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 vn.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class ype{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 bpe{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class wpe{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 fu(a.dom,a.text+t);l.parent=o}else o.append(s||fu.of(t,(i=this.cache.find(fu))===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)?Ww(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 pi&&c.mark.eq(l.mark))c.dom!=l.dom&&c.setDOM(Ww(l.dom)),s=c;else{if(this.cache.reused.get(l)){let d=kr.get(l.dom);d&&d.setDOM(Ww(l.dom))}let u=pi.of(l.mark,l.dom);s.append(u),s=u}this.cache.reused.set(l,2)}let i=kr.get(t.text);i&&this.cache.reused.set(i,2);let o=new fu(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=rO);let s=wh.start(t,n||((r=this.cache.find(wh))===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 pi&&a.mark.eq(o))s=a,n--;else{let l=pi.of(o,(r=this.cache.find(pi,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||!UT(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(ot.ios&&UT(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Gw,0,32)||new Bu(Gw.toDOM(),0,Gw,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 bpe(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 il&&s.wrapper.eq(r.wrapper))n=s;else{let i=il.of(r.wrapper,(t=this.cache.find(il,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(Y1,void 0,1);return r&&(r.flags=n),r||new Y1(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class vpe{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 X1=[Bu,wh,fu,pi,Y1,il,db];for(let e=0;e<X1.length;e++)X1[e].bucket=e;class xpe{constructor(t){this.view=t,this.buckets=X1.map(()=>[]),this.index=X1.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 Bu(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 _pe{constructor(t,n,r,s,i){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new xpe(t),this.text=new vpe(t.state.doc),this.builder=new wpe(this.cache,new db(t,t.contentDOM),On.iter(r)),this.cache.reused.set(n,2),this.old=new ype(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=Tpe(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?Bu.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 Y1)this.cache.add(o);else if(o instanceof pi)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 pi&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof pi&&(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=On.spans(this.decorations,t,n,{point:(a,l,c,u,d,f)=>{if(c instanceof Du){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?vh.block:vh.inline),p=kpe(c),y=this.cache.findWidget(m,l-a,p)||Bu.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=Spe(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=kr.get(s);if(s==this.view.contentDOM)break;i instanceof pi?n.push(i):i!=null&&i.isLine()?r=i:i instanceof il||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new wh(s,rO):r||n.push(pi.of(new j0({tagName:s.nodeName.toLowerCase(),attributes:Q0e(s)}),s)))}return{line:r,marks:n}}}function UT(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 kpe(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 rO={class:"cm-line"};function Spe(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&ck(n,e),r&&(e.class+=" "+r)),e}function Tpe(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 pi&&t.push(r.mark)}return t}function Ww(e){let t=kr.get(e);return t&&t.setDOM(e.cloneNode()),e}class vh extends Aa{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}}vh.inline=new vh("span");vh.block=new vh("div");const Gw=new class extends Aa{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class HT{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=mn.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 db(t,t.contentDOM),this.updateInner([new ho(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:!jpe(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let i=s>-1?Ape(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:u,to:d}=this.hasComposition;r=new ho(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,(ot.ie||ot.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=Ipe(o,this.decorations,t.changes);l.length&&(r=ho.extendWithRanges(r,l));let c=Rpe(a,this.blockWrappers,t.changes);return c.length&&(r=ho.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 _pe(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&kr.get(n.text)&&a.cache.reused.set(kr.get(n.text),2),this.tile=a.run(t,n),n3(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=ot.chrome||ot.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 Kw&&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(JD)&&(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(Wa)||r.tabIndex>-1)&&wm(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)),ot.gecko&&l.empty&&!this.hasComposition&&Cpe(c)){let f=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(f,c.node.childNodes[c.offset]||null)),c=u=new Ro(f,0),a=!0}let d=this.view.observer.selectionRange;(a||!d.focusNode||(!xm(c.node,c.offset,d.anchorNode,d.anchorOffset)||!xm(u.node,u.offset,d.focusNode,d.focusOffset))&&!this.suppressWidgetCursorChange(d,l))&&(this.view.observer.ignore(()=>{ot.android&&ot.chrome&&r.contains(d.focusNode)&&Lpe(d.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let f=e0(this.view.root);if(f)if(l.empty){if(ot.gecko){let m=Epe(c.node,c.offset);if(m&&m!=3){let p=(m==1?OD:BD)(c.node,c.offset);p&&(c=new Ro(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 Ro(d.anchorNode,d.anchorOffset),this.impreciseHead=u.precise?null:new Ro(d.focusNode,d.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&xm(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=e0(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=ml(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&&!kr.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 Kw?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=js(i.text,o);if(a==o)return null;let l=n0(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==sr.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:w}=b;if(m&&!p&&(c+=b.top-m.top),y instanceof il)v>r&&u(y,f,b);else if(f>=r&&(c>0&&n.push(-c),n.push(w+c),c=0,o)){let x=y.dom.lastChild,k=x?vm(x):[];if(k.length){let T=k[k.length-1],A=l?T.right-b.left:b.right-T.left;A>a&&(a=A,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"?sr.RTL:sr.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=vm(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=vm(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(mn.replace({widget:new Kw(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return mn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(cb).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(pk).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(On.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(eO).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(QD))try{if(u(this.view,t.range,t))return!0}catch(d){Oi(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=gk(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(epe(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==sr.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(){n3(this.tile)}}function n3(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)n3(r,t)}}function Cpe(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 sO(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=OD(n.focusNode,n.focusOffset),s=BD(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=kr.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let l=kr.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 Ape(e,t,n){let r=sO(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 ho(l.mapPos(i),l.mapPos(o),i,o),text:s}}function Epe(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 Mpe=class{constructor(){this.changes=[]}compareRange(t,n){Yd(t,n,this.changes)}comparePoint(t,n){Yd(t,n,this.changes)}boundChange(t){Yd(t,t,this.changes)}};function Ipe(e,t,n){let r=new Mpe;return On.compare(e,t,n,r),r.changes}class Npe{constructor(){this.changes=[]}compareRange(t,n){Yd(t,n,this.changes)}comparePoint(){}boundChange(t){Yd(t,t,this.changes)}}function Rpe(e,t,n){let r=new Npe;return On.compare(e,t,n,r),r.changes}function Lpe(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 jpe(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class Kw extends Aa{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 Dpe(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return Le.cursor(t);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=js(s.text,i,!1):a=js(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let c=js(s.text,o,!1);if(r(s.text.slice(c,o))!=l)break;o=c}for(;a<s.length;){let c=js(s.text,a);if(r(s.text.slice(a,c))!=l)break;a=c}return Le.range(o+s.from,a+s.from)}function Ope(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 r3(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==Zs.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function Bpe(e,t,n,r){let s=r3(e,t.head,t.assoc||-1),i=!r||s.type!=Zs.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==sr.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Le.cursor(l,n?-1:1)}return Le.cursor(n?s.to:s.from,n?-1:1)}function VT(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=dpe(s,i,o,a,n),u=qD;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 Ppe(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let o=r(i);return s==Za.Space&&(s=o),s==o}}function $pe(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return Le.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=s3(e,{x:d,y},!1,i);if(n?y>l.bottom:y<l.top)return Le.cursor(v.pos,v.assoc);let b=e.coordsAtPos(v.pos,v.assoc),w=b?(b.top+b.bottom)/2:0;if(!b||(n?w>a:w<a))return Le.cursor(v.pos,v.assoc,void 0,o)}}function _m(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 iO(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=_m(e,s.from,0);o!=s.from&&(i=Le.cursor(o,-1))}else{let o=_m(e,s.from,-1),a=_m(e,s.to,1);(o!=s.from||a!=s.to)&&(i=Le.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?Le.create(n,t.mainIndex):t}function Yw(e,t,n){let r=_m(e.state.facet(O0).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Le.cursor(r,r<n.from?1:-1)}class aa{constructor(t,n){this.pos=t,this.assoc=n}}function s3(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 aa(0,1);if(l>e.viewState.docHeight)return new aa(e.state.doc.length,-1);if(c=e.elementAtHeight(l),r==null)break;if(c.type==Zs.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==Zs.Text){let d=Ope(e,s,c,o,a);return new aa(d,d==c.from?1:-1)}}if(c.type!=Zs.Text)return l<(c.top+c.bottom)/2?new aa(c.from,1):new aa(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 zpe(e,o,a,e.textDirectionAt(c.from)).scanTile(u,c.from)}class zpe{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[fa.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[fa.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 w=0;w<p;w++){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 w=v[b],x=0;if(!(w.width==0&&v.length>1)){if(w.bottom<this.y)(!l||l.bottom<w.bottom)&&(l=w),x=1;else if(w.top>this.y)(!c||c.top>w.top)&&(c=w),x=-1;else{let k=w.left>this.x?this.x-w.left:w.right<this.x?this.x-w.right:0,T=Math.abs(k);T<d&&(u=y,d=T,f=w),k&&(x=k<0==(this.baseDir==sr.LTR)?-1:1)}x==-1&&(!a||this.baseDirAt(t[y],1))?i=y:x==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)==sr.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=js(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 n0(t.dom,o,a).getClientRects()});return s.after?new aa(r[s.i+1],-1):new aa(r[s.i],1)}scanTile(t,n){if(!t.length)return new aa(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:n0(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 aa(r[s.i+1],-1):new aa(o,1)}}const wd="";class Fpe{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(jn.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=wd}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=kr.get(s),a=s.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=kr.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:G1(s))||G1(a)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!Upe(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=kr.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+(qpe(t,r.node,r.offset)?n:0))}}function qpe(e,t,n){for(;;){if(!t||n<ml(t))return!1;if(t==e)return!0;n=Ac(t)+1,t=t.parentNode}}function Upe(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=kr.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 WT{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class Hpe{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=oO(t.docView.tile,n,r,0))){let l=i||o?[]:Wpe(t),c=new Fpe(l,t);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Gpe(l,this.bounds.from)}else{let l=t.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!Qx(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),u=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Qx(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),d=t.viewport;if((ot.ios||ot.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(Le.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=Le.create([Le.cursor(c,m)])}else this.newSel=Le.single(u,c)}}}function oO(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 oO(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 aO(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||ot.android&&t.text.length<l-a)&&(c=i.to,u="end");let d=s.doc.sliceString(a,l,wd),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:vn.of(t.text.slice(i.from-a,f).split(wd))}:(m=lO(d,t.text,c-a,u))&&(ot.chrome&&o==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==wd+wd&&m.toB--,n={from:a+m.from,to:a+m.toA,insert:vn.of(t.text.slice(m.from,m.toB).split(wd))})}else r&&(!e.hasFocus&&s.facet(Wa)||Q1(r,i))&&(r=null);if(!n&&!r)return!1;if((ot.mac||ot.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=Le.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:vn.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)}:ot.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(r&&(r=Le.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:vn.of([" "])}),n)return yk(e,n,r,o);if(r&&!Q1(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=iO(s.facet(O0).map(c=>c(e)),r))),e.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function yk(e,t,n,r=-1){if(ot.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(ot.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&&Xd(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)&&Xd(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&Xd(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=Vpe(e,t,n));return e.state.facet(GD).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function Vpe(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=_m(s.facet(O0).map(d=>d(e)),c,l);t.from==u&&(o=u)}if(o>-1)r={changes:t,selection:Le.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&&sO(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}),w=p.to-i.to;return{changes:b,range:c?Le.range(Math.max(0,c.anchor+w),Math.max(0,c.head+w)):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 lO(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 Wpe(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 WT(n,r)),(s!=n||i!=r)&&t.push(new WT(s,i))),t}function Gpe(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?Le.single(n+t,r+t):null}function Q1(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Kpe{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,ot.safari&&t.contentDOM.addEventListener("input",()=>null),ot.gecko&&cge(t.contentDOM.ownerDocument)}handleEvent(t){!nge(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=Ype(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&&uO.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),ot.android&&ot.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return ot.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=cO.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||Xpe.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,Xd(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:ot.safari&&!ot.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 GT(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){Oi(n.state,s)}}}function Ype(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(GT(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(GT(r.value,l))}}for(let r in jo)n(r).handlers.push(jo[r]);for(let r in xi)n(r).observers.push(xi[r]);return t}const cO=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Xpe="dthko",uO=[16,17,18,20,91,92,224,225],Bp=6;function Pp(e){return Math.max(0,e)*.7+8}function Qpe(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class Jpe{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=LD(t.contentDOM),this.atoms=t.state.facet(O0).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(jn.allowMultipleSelections)&&Zpe(t,n),this.dragging=tge(t,n)&&fO(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&&Qpe(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=gk(this.view);t.clientX-l.left<=s+Bp?n=-Pp(s-t.clientX):t.clientX+l.right>=o-Bp&&(n=Pp(t.clientX-o)),t.clientY-l.top<=i+Bp?r=-Pp(i-t.clientY):t.clientY+l.bottom>=a-Bp&&(r=Pp(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=iO(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 Zpe(e,t){let n=e.state.facet(UD);return n.length?n[0](t):ot.mac?t.metaKey:t.ctrlKey}function ege(e,t){let n=e.state.facet(HD);return n.length?n[0](t):ot.mac?!t.altKey:!t.ctrlKey}function tge(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=e0(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 nge(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=kr.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const jo=Object.create(null),xi=Object.create(null),dO=ot.ie&&ot.ie_version<15||ot.ios&&ot.webkit_version<604;function rge(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(),hO(e,n.value)},50)}function hb(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function hO(e,t){t=hb(e.state,hk,t);let{state:n}=e,r,s=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(i3!=null&&n.selection.ranges.every(l=>l.empty)&&i3==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:Le.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:Le.cursor(l.from+c.length)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}xi.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};xi.wheel=xi.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};jo.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);xi.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")};xi.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};jo.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(VD))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=ige(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new Jpe(e,t,n,r)),r&&e.observer.ignore(()=>{jD(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 KT(e,t,n,r){if(r==1)return Le.cursor(t,n);if(r==2)return Dpe(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++,Le.range(o,a)}}const sge=ot.ie&&ot.ie_version<=11;let YT=null,XT=0,QT=0;function fO(e){if(!sge)return e.detail;let t=YT,n=QT;return YT=e,QT=Date.now(),XT=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(XT+1)%3:1}function ige(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=fO(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=KT(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let d=KT(e,n.pos,n.assoc,r),f=Math.min(d.from,u.from),m=Math.max(d.to,u.to);u=f<u.from?Le.range(f,m,u.assoc):Le.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=oge(s,l.pos))?c:a?s.addRange(u):Le.create([u])}}}function oge(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 Le.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}jo.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=Le.range(i,o))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",hb(e.state,fk,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};jo.dragend=e=>(e.inputState.draggedContent=null,!1);function JT(e,t,n,r){if(n=hb(e.state,hk,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=r&&i&&ege(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}jo.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&&JT(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 JT(e,t,r,!0),!0}return!1};jo.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=dO?null:t.clipboardData;return n?(hO(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(rge(e),!1)};function age(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 lge(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:hb(e,fk,t.join(e.lineBreak)),ranges:n,linewise:r}}let i3=null;jo.copy=jo.cut=(e,t)=>{if(!wm(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=lge(e.state);if(!n&&!s)return!1;i3=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=dO?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(age(e,n),!1)};const mO=_l.define();function pO(e,t){let n=[];for(let r of e.facet(KD)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:mO.of(!0)}):null}function gO(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=pO(e.state,t);n?e.dispatch(n):e.update([])}},10)}xi.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),gO(e)};xi.blur=e=>{e.observer.clearSelectionRange(),gO(e)};xi.compositionstart=xi.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};xi.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,ot.chrome&&ot.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};xi.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};jo.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 yk(e,{from:l,to:c,insert:e.state.toText(i)},null),!0}}let s;if(ot.chrome&&ot.android&&(s=cO.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 ot.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),ot.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>xi.compositionend(e,t),20),!1};const ZT=new Set;function cge(e){ZT.has(e)||(ZT.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const eC=["pre-wrap","normal","pre-line","break-spaces"];let xh=!1;function tC(){xh=!1}class uge{constructor(t){this.lineWrapping=t,this.doc=vn.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 eC.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=eC.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 dge{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class No{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"?Zs.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 Du?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 No(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Zn=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Zn||(Zn={}));const Ng=.001;class ei{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)>Ng&&(xh=!0),this.height=t)}replace(t,n,r){return ei.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,Zn.ByPosNoHeight,r.setDoc(n),0,0),m=f.to>=c?f:i.lineAt(c,Zn.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,Zn.ByPosNoHeight,r,0,0));u+=f.from-l,l=f.from;let p=bk.build(r.setDoc(o),t,u,d);i=J1(i,i.replace(l,c,p))}return i.updateHeight(r,0)}static empty(){return new Ni(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 fge(ei.of(t.slice(0,n)),o,ei.of(t.slice(r)))}}function J1(e,t){return e==t?e:(e.constructor!=t.constructor&&(xh=!0),t)}ei.prototype.size=1;const hge=mn.replace({});class yO extends ei{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new No(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 No(s,0,r,this.spaceAbove,hge):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,Zn.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 Ni extends yO{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 No(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 Ni||s instanceof bs&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof bs?s=new Ni(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):ei.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 bs extends ei{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 No(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 No(u,d,r+a*c,a,0)}}lineAt(t,n,r,s,i){if(n==Zn.ByHeight)return this.blockAt(t,r,s,i);if(n==Zn.ByPosNoHeight){let{from:m,to:p}=r.doc.lineAt(t);return new No(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 No(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 No(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 bs?r[r.length-1]=new bs(i.length+s):r.push(null,new bs(s-1))}if(t>0){let i=r[0];i instanceof bs?r[0]=new bs(t+i.length):r.unshift(new bs(t-1),null)}return ei.of(r)}decomposeLeft(t,n){n.push(new bs(t-1),null)}decomposeRight(t,n){n.push(null,new bs(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 bs(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)>=Ng&&(l=-2);let m=new Ni(u,d,f);m.outdated=!1,o.push(m),a+=u+1}a<=i&&o.push(null,new bs(i-a).updateHeight(t,a));let c=ei.of(o);return(l<0||Math.abs(c.height-this.height)>=Ng||Math.abs(l-this.heightMetrics(t,n).perLine)>=Ng)&&(xh=!0),J1(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 fge extends ei{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==Zn.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==Zn.ByPosNoHeight?Zn.ByPosNoHeight:Zn.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,Zn.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&&nC(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),nC(i,a)}return ei.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?ei.of(this.break?[t,null,n]:[t,n]):(this.left=J1(this.left,t),this.right=J1(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 nC(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof bs&&(r=e[t+1])instanceof bs&&e.splice(t-1,3,new bs(n.length+1+r.length))}const mge=5;class bk{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 Ni?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ni(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 yO(o,s,r)):(o||i||s>=mge)&&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 Ni(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new bs(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 Ni)return t;let n=new Ni(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 Ni)&&!this.isCovered?this.nodes.push(new Ni(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 Ni&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new bk(r,t);return On.spans(n,r,s,i,0),i.finish(r)}}function pge(e,t,n){let r=new gge;return On.compare(e,t,n,r,0),r.changes}class gge{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&Yd(t,n,this.changes,5)}}function yge(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 bge(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 wge(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Xw{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 mn.replace({widget:new vge(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class vge extends Aa{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 rC{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=sC,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=sr.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(mk).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new uge(r),this.stateDeco=iC(n),this.heightMap=ei.empty().applyChanges(this.stateDeco,vn.empty,this.heightOracle.setDoc(n.doc),[new ho(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=mn.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 $p(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?sC:new wk(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(Ff(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=iC(this.state);let s=t.changedRanges,i=ho.extendWithRanges(s,pge(r,this.stateDeco,t?t.changes:Xr.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);tC(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||xh)&&(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(XD)&&(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"?sr.RTL:sr.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:A}=RD(n,a);(T>.005&&Math.abs(this.scaleX-T)>.005||A>.005&&Math.abs(this.scaleY-A)>.005)&&(this.scaleX=T,this.scaleY=A,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=LD(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=DD(this.scrollParent||t.win);let y=(this.printing?wge:yge)(n,this.paddingTop),v=y.top-this.pixelViewport.top,b=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(l=!0)),!this.inView&&!this.scrollTarget&&!bge(t.dom))return 0;let x=a.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,c|=16),l){let T=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(o=!0),o||s.lineWrapping&&Math.abs(x-this.contentDOMWidth)>s.charWidth){let{lineHeight:A,charWidth:M,textHeight:D}=t.docView.measureTextSize();o=A>0&&s.refresh(i,A,M,D,Math.max(5,x/M),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)),tC();for(let A of this.viewports){let M=A.from==this.viewport.from?T:t.docView.measureVisibleLineHeights(A);this.heightMap=(o?ei.empty().applyChanges(this.stateDeco,vn.empty,this.heightOracle,[new ho(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new dge(A.from,M))}xh&&(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 $p(s.lineAt(o-r*1e3,Zn.ByHeight,i,0,0).from,s.lineAt(a+(1-r)*1e3,Zn.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,Zn.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 $p(s.lineAt(f-1e3/2,Zn.ByHeight,i,0,0).from,s.lineAt(f+u+1e3/2,Zn.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 $p(this.heightMap.lineAt(r,Zn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Zn.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,Zn.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Zn.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 Xw(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!=sr.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=_ge(t,b=>b.from>=f.from&&b.to<=f.to&&Math.abs(b.from-u)<i&&Math.abs(b.to-d)<i&&!y.some(w=>b.from<w&&b.to>w));if(!v){if(d<f.to&&n&&r&&n.visibleRanges.some(x=>x.from<=d&&x.to>=d)){let x=n.moveToLineBoundary(Le.cursor(d),!1,!0).head;x>u&&(d=x)}let b=this.gapSize(f,u,d,m),w=r||b<2e6?b:2e6;v=new Xw(u,d,b,w)}a.push(v)},c=u=>{if(u.length<o||u.type!=Zs.Text)return;let d=xge(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 w=Fp(d,f),x=((this.visibleBottom-this.visibleTop)/2+y)/u.height;v=w-x,b=w+x}else v=(this.visibleTop-u.top-y)/u.height,b=(this.visibleBottom-u.top+y)/u.height;m=zp(d,v),p=zp(d,b)}else{let y=d.total*this.heightOracle.charWidth,v=s*this.heightOracle.charWidth,b=0;if(y>2e6)for(let A of t)A.from>=u.from&&A.from<u.to&&A.size!=A.displaySize&&A.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=A.size-A.displaySize);let w=this.pixelViewport.left+b,x=this.pixelViewport.right+b,k,T;if(f!=null){let A=Fp(d,f),M=((x-w)/2+v)/y;k=A-M,T=A+M}else k=(w-v)/y,T=(x+v)/y;m=zp(d,k),p=zp(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=Fp(s,r)-Fp(s,n);return this.heightOracle.lineWrapping?t.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(t){Xw.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=mn.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=[];On.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)||Ff(this.heightMap.lineAt(t,Zn.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)||Ff(this.heightMap.lineAt(this.scaler.fromDOM(t),Zn.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 Ff(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 $p{constructor(t,n){this.from=t,this.to=n}}function xge(e,t,n){let r=[],s=e,i=0;return On.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 zp({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 Fp(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 _ge(e,t){for(let n of e)if(t(n))return n}const sC={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function iC(e){let t=e.facet(cb).filter(r=>typeof r!="function"),n=e.facet(pk).filter(r=>typeof r!="function");return n.length&&t.push(On.join(n)),t}class wk{constructor(t,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=n.lineAt(a,Zn.ByPos,t,0,0).top,u=n.lineAt(l,Zn.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 wk?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 Ff(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new No(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>Ff(s,t)):e._content)}const qp=It.define({combine:e=>e.join(" ")}),o3=It.define({combine:e=>e.indexOf(!0)>-1}),a3=Tc.newName(),bO=Tc.newName(),wO=Tc.newName(),vO={"&light":"."+bO,"&dark":"."+wO};function l3(e,t,n){return new Tc(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 kge=l3("."+a3,{"&":{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"}},vO),Sge={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Qw=ot.ie&&ot.ie_version<=11;class Tge{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new tpe,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);(ot.ie&&ot.ie_version<=11||ot.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&&ot.android&&t.constructor.EDIT_CONTEXT!==!1&&!(ot.chrome&&ot.chrome_version<126)&&(this.editContext=new Age(t),t.state.facet(Wa)&&(t.contentDOM.editContext=this.editContext.editContext)),Qw&&(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(Wa)?r.root.activeElement!=this.dom:!wm(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}(ot.ie&&ot.ie_version<=11||ot.android&&ot.chrome)&&!r.state.selection.main.empty&&s.focusNode&&xm(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=e0(t.root);if(!n)return!1;let r=ot.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&Cge(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=wm(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&rpe(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,Sge),Qw&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Qw&&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&&Xd(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&&wm(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 Hpe(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=aO(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!Q1(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=oC(n,t.previousSibling||t.target.previousSibling,-1),s=oC(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(Wa)!=t.state.facet(Wa)&&(t.view.contentDOM.editContext=t.state.facet(Wa)?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 oC(e,t,n){for(;t;){let r=kr.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 aC(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 xm(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function Cge(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return aC(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?aC(e,n):null}class Age{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=lO(t.state.sliceDoc(a,l),r.text,(c?s.from:s.to)-a,c?"end":null);if(!u){let f=Le.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));Q1(f,s)||t.dispatch({selection:f,userEvent:"select"});return}let d={from:u.from+a,to:u.toA+a,insert:vn.of(r.text.slice(u.from,u.toB).split(`
`))};if((ot.mac||ot.android)&&d.from==o-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:a,to:l,insert:vn.of([r.text.replace("."," ")])}),this.pendingContextChange=d,!t.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);yk(t,d,Le.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(mn.mark({attributes:{style:u}}).range(l,c))}}}t.dispatch({effects:JD.of(mn.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=e0(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 yt{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||npe(t.parent)||document,this.viewState=new rC(this,t.state||jn.create(t)),t.scrollTo&&t.scrollTo.is(Op)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(jd).map(s=>new Vw(s));for(let s of this.plugins)s.update(this);this.observer=new Tge(this),this.inputState=new Kpe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new HT(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 Jr?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(mO))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=pO(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(jn.phrases)!=this.state.facet(jn.phrases))return this.setState(i);s=K1.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(yt.cursorScrollMargin);d=new Qd(m.empty?m:Le.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",y,p)}for(let m of f.effects)m.is(Op)&&(d=m.value.clip(this.state))}this.viewState.update(s,d),this.bidiCache=Z1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(zf)!=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(qp)!=s.state.facet(qp)&&(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(t3))try{f(s)}catch(m){Oi(this.state,m,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!aO(this,u)&&c.force&&Xd(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 rC(this,t),this.plugins=t.facet(jd).map(r=>new Vw(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new HT(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(jd),r=t.state.facet(jd);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new Vw(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){Oi(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(DD(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 Oi(this.state,p),lC}}),d=K1.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]!=lC)try{let p=c[m];p.write&&p.write(u[m],this)}catch(p){Oi(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(t3))a(n)}get themeClasses(){return a3+" "+(this.state.facet(o3)?wO:bO)+" "+this.state.facet(qp)}updateAttrs(){let t=cC(this,ZD,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Wa)?"true":"false",class:"cm-content",style:`${ot.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),cC(this,mk,n);let r=this.observer.ignore(()=>{let s=PT(this.contentDOM,this.contentAttrs,n),i=PT(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(yt.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(zf);let t=this.state.facet(yt.cspNonce);Tc.mount(this.root,this.styleModules.concat(kge).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 Yw(this,t,VT(this,t,n,r))}moveByGroup(t,n){return Yw(this,t,VT(this,t,n,r=>Ppe(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 Le.cursor(i.side(n,s)+t.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(t,n,r=!0){return Bpe(this,t,n,r)}moveVertically(t,n,r){return Yw(this,t,$pe(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=s3(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),s3(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[fa.find(i,t-s.from,-1,n)];return t0(r,o.dir==sr.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(YD)||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>Ege)return FD(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||zD(i.isolates,r=FT(this,t))))return i.order;r||(r=FT(this,t));let s=upe(t.text,n,r);return this.bidiCache.push(new Z1(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||ot.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{jD(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 Op.of(new Qd(typeof t=="number"?Le.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 Op.of(new Qd(Le.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 vi.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return vi.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=Tc.newName(),s=[qp.of(r),zf.of(l3(`.${r}`,t))];return n&&n.dark&&s.push(o3.of(!0)),s}static baseTheme(t){return Ku.lowest(zf.of(l3("."+a3,t,vO)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&kr.get(r)||kr.get(t);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}yt.styleModule=zf;yt.inputHandler=GD;yt.clipboardInputFilter=hk;yt.clipboardOutputFilter=fk;yt.scrollHandler=QD;yt.focusChangeEffect=KD;yt.perLineTextDirection=YD;yt.exceptionSink=WD;yt.updateListener=t3;yt.editable=Wa;yt.mouseSelectionStyle=VD;yt.dragMovesSelection=HD;yt.clickAddsSelectionRange=UD;yt.decorations=cb;yt.blockWrappers=eO;yt.outerDecorations=pk;yt.atomicRanges=O0;yt.bidiIsolatedRanges=tO;yt.cursorScrollMargin=It.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}}});yt.scrollMargins=nO;yt.darkTheme=o3;yt.cspNonce=It.define({combine:e=>e.length?e[0]:""});yt.contentAttributes=mk;yt.editorAttributes=ZD;yt.lineWrapping=yt.contentAttributes.of({class:"cm-lineWrapping"});yt.announce=qn.define();const Ege=4096,lC={};class Z1{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:sr.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 Z1(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function cC(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&&ck(o,n)}return n}const Mge=ot.mac?"mac":ot.windows?"win":ot.linux?"linux":"key";function Ige(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 Up(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 Nge=Ku.default(yt.domEventHandlers({keydown(e,t){return Dge(Rge(t.state),e,t,"editor")}})),r0=It.define({enables:Nge}),uC=new WeakMap;function Rge(e){let t=e.facet(r0),n=uC.get(t);return n||uC.set(t,n=jge(t.reduce((r,s)=>r.concat(s),[]))),n}let Hl=null;const Lge=4e3;function jge(e,t=Mge){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=>Ige(b,t));for(let b=1;b<p.length;b++){let w=p.slice(0,b).join(" ");s(w,!0),m[w]||(m[w]={preventDefault:!0,stopPropagation:!1,run:[x=>{let k=Hl={view:x,prefix:w,scope:o};return setTimeout(()=>{Hl==k&&(Hl=null)},Lge),!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,c3))}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 c3=null;function Dge(e,t,n,r){c3=t;let s=Y0e(t),i=Ol(s,0),o=bd(i)==s.length&&s!=" ",a="",l=!1,c=!1,u=!1;Hl&&Hl.view==n&&Hl.scope==r&&(a=Hl.prefix+" ",uO.indexOf(t.keyCode)<0&&(c=!0,Hl=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+Up(s,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(ot.windows&&t.ctrlKey&&t.altKey)&&!(ot.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Cc[t.keyCode])&&p!=s?(f(m[a+Up(p,t,!0)])||t.shiftKey&&(y=Jm[t.keyCode])!=s&&y!=p&&f(m[a+Up(y,t,!1)]))&&(l=!0):o&&t.shiftKey&&f(m[a+Up(s,t,!0)])&&(l=!0),!l&&f(m._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),c3=null,l}class _u{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=xO(t);return[new _u(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Oge(t,n,r)}}function xO(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==sr.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function dC(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 Oge(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==sr.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=xO(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=r3(e,r,1),p=r3(e,s,-1),y=m.type==Zs.Text?m:null,v=p.type==Zs.Text?p:null;if(y&&(e.lineWrapping||m.widgetLineBreaks)&&(y=dC(e,r,1,y)),v&&(e.lineWrapping||p.widgetLineBreaks)&&(v=dC(e,s,-1,v)),y&&v&&y.from==v.from&&y.to==v.to)return w(x(n.from,n.to,y));{let T=y?x(n.from,null,y):k(m,!1),A=v?x(null,n.to,v):k(p,!0),M=[];return(y||m).to<(v||p).from-(y&&v?1:0)||m.widgetLineBreaks>1&&T.bottom+e.defaultLineHeight/2<A.top?M.push(b(d,T.bottom,f,A.top)):T.bottom<A.top&&e.elementAtHeight((T.bottom+A.top)/2).type==Zs.Text&&(T.bottom=A.top=(T.bottom+A.top)/2),w(T).concat(M).concat(w(A))}function b(T,A,M,D){return new _u(t,T-l.left,A-l.top,Math.max(0,M-T),D-A)}function w({top:T,bottom:A,horizontal:M}){let D=[];for(let O=0;O<M.length;O+=2)D.push(b(M[O],T,M[O+1],A));return D}function x(T,A,M){let D=1e9,O=-1e9,C=[];function L(F,W,j,K,J){let ee=e.coordsAtPos(F,F==M.to?-2:2),N=e.coordsAtPos(j,j==M.from?2:-2);!ee||!N||(D=Math.min(ee.top,N.top,D),O=Math.max(ee.bottom,N.bottom,O),J==sr.LTR?C.push(i&&W?d:ee.left,i&&K?f:N.right):C.push(!i&&K?d:N.left,!i&&W?f:ee.right))}let I=T??M.from,B=A??M.to;for(let F of e.visibleRanges)if(F.to>I&&F.from<B)for(let W=Math.max(F.from,I),j=Math.min(F.to,B);;){let K=e.state.doc.lineAt(W);for(let J of e.bidiSpans(K)){let ee=J.from+K.from,N=J.to+K.from;if(ee>=j)break;N>W&&L(Math.max(ee,W),T==null&&ee<=I,Math.min(N,j),A==null&&N>=B,J.dir)}if(W=K.to+1,W>=j)break}return C.length==0&&L(I,T==null,B,A==null,e.textDirection),{top:D,bottom:O,horizontal:C}}function k(T,A){let M=a.top+(A?T.top:T.bottom);return{top:M,bottom:M,horizontal:[]}}}function Bge(e,t){return e.constructor==t.constructor&&e.eq(t)}class Pge{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(Rg)!=t.state.facet(Rg)&&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(Rg);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)=>!Bge(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,ot.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Rg=It.define();function _O(e){return[vi.define(t=>new Pge(t,e)),Rg.of(e)]}const _h=It.define({combine(e){return ab(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function $ge(e={}){return[_h.of(e),zge,Fge,qge,XD.of(!0)]}function kO(e){return e.startState.facet(_h)!=e.state.facet(_h)}const zge=_O({above:!0,markers(e){let{state:t}=e,n=t.facet(_h),r=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty||n.drawRangeCursor&&!(i&&ot.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:Le.cursor(s.head,s.assoc);for(let l of _u.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=kO(e);return n&&hC(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){hC(t.state,e)},class:"cm-cursorLayer"});function hC(e,t){t.style.animationDuration=e.facet(_h).cursorBlinkRate+"ms"}const Fge=_O({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 _u.forRange(e,"cm-selectionBackground",s))t.push(i);if(ot.ios&&!n.empty&&e.state.facet(_h).iosSelectionHandles){for(let s of _u.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Le.cursor(n.from,1)))t.push(s);for(let s of _u.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Le.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||kO(e)},class:"cm-selectionLayer"}),qge=Ku.highest(yt.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 fC(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 Uge(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 Hge{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 ju,r=n.add.bind(n);for(let{from:s,to:i}of Uge(t,this.maxLength))fC(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 fC(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 u3=/x/.unicode!=null?"gu":"g",Vge=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,u3),Wge={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 Jw=null;function Gge(){var e;if(Jw==null&&typeof document<"u"&&document.body){let t=document.body.style;Jw=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return Jw||!1}const Lg=It.define({combine(e){let t=ab(e,{render:null,specialChars:Vge,addSpecialChars:null});return(t.replaceTabs=!Gge())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,u3)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,u3)),t}});function Kge(e={}){return[Lg.of(e),Yge()]}let mC=null;function Yge(){return mC||(mC=vi.fromClass(class{constructor(e){this.view=e,this.decorations=mn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Lg)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Hge({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:s}=n.state,i=Ol(t[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=L0(o.text,a,r-o.from);return mn.replace({widget:new Zge((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=mn.replace({widget:new Jge(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Lg);e.startState.facet(Lg)!=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 Xge="•";function Qge(e){return e>=32?Xge:e==10?"␤":String.fromCharCode(9216+e)}class Jge extends Aa{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=Qge(this.code),r=t.state.phrase("Control character")+" "+(Wge[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 Zge extends Aa{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 e1e extends Aa{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?vm(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),s=t0(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 pC(e){let t=vi.fromClass(class{constructor(n){this.view=n,this.placeholder=e?mn.set([mn.widget({widget:new e1e(e),side:1}).range(0)]):mn.none}get decorations(){return this.view.state.doc.length?mn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,yt.contentAttributes.of({"aria-placeholder":e})]:t}const Hp="-10000px";class t1e{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 n1e(e={}){return jg.of(e)}function r1e(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const jg=It.define({combine:e=>{var t,n,r;return{position:ot.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)||r1e}}}),gC=new WeakMap,SO=vi.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(jg);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 t1e(e,TO,(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(jg);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=Hp,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(ot.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=gk(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(jg).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=Hp;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=m?7:0,y=f.right-f.left,v=(t=gC.get(c))!==null&&t!==void 0?t:f.bottom-f.top,b=c.offset||i1e,w=this.view.textDirection==sr.LTR,x=f.width>r.right-r.left?w?r.left:r.right-f.width:w?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=Hp;continue}gC.set(c,v),u.style.height=(v=T)/i+"px"}else u.style.height&&(u.style.height="");let A=k?d.top-v-p-b.y:d.bottom+p+b.y,M=x+y;if(c.overlap!==!0)for(let D of o)D.left<M&&D.right>x&&D.top<A+v&&D.bottom>A&&(A=k?D.top-v-2-p:D.bottom+p+2);if(this.position=="absolute"?(u.style.top=(A-e.parent.top)/i+"px",yC(u,(x-e.parent.left)/s)):(u.style.top=A/i+"px",yC(u,x/s)),m){let D=d.left+(w?b.x:-b.x)-(x+14-7);m.style.left=D/s+"px"}c.overlap!==!0&&o.push({left:x,top:A,right:M,bottom:A+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=Hp}},{eventObservers:{scroll(){this.maybeMeasure()}}});function yC(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const s1e=yt.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"}}}),i1e={x:0,y:0},TO=It.define({enables:[SO,s1e]});function CO(e,t){let n=e.plugin(SO);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}class kh extends Sc{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}kh.prototype.elementClass="";kh.prototype.toDOM=void 0;kh.prototype.mapMode=ji.TrackBefore;kh.prototype.startSide=kh.prototype.endSide=-1;kh.prototype.point=!0;const o1e=1024;let a1e=0;class Zw{constructor(t,n){this.from=t,this.to=n}}class wn{constructor(t={}){this.id=a1e++,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=xo.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}wn.closedBy=new wn({deserialize:e=>e.split(" ")});wn.openedBy=new wn({deserialize:e=>e.split(" ")});wn.group=new wn({deserialize:e=>e.split(" ")});wn.isolate=new wn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});wn.contextHash=new wn({perNode:!0});wn.lookAhead=new wn({perNode:!0});wn.mounted=new wn({perNode:!0});class km{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[wn.mounted.id]}}const l1e=Object.create(null);class xo{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):l1e,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new xo(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(wn.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(wn.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}xo.none=new xo("",Object.create(null),0,8);const Vp=new WeakMap,bC=new WeakMap;var Ar;(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"})(Ar||(Ar={}));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=km.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 h3(this.topNode,t)}cursorAt(t,n=0,r=0){let s=Vp.get(this)||this.topNode,i=new h3(s);return i.moveTo(t,n),Vp.set(this,i._tree),i}get topNode(){return new yo(this,0,0,null)}resolve(t,n=0){let r=s0(Vp.get(this)||this.topNode,t,n,!1);return Vp.set(this,r),r}resolveInner(t,n=0){let r=s0(bC.get(this)||this.topNode,t,n,!0);return bC.set(this,r),r}resolveStack(t,n=0){return d1e(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,o=t.mode||0,a=(o&Ar.IncludeAnonymous)>0;for(let l=this.cursor(o|Ar.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:_k(xo.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(xo.none,n,r,s)))}static build(t){return h1e(t)}}Ss.empty=new Ss(xo.none,[],[],0);class vk{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 vk(this.buffer,this.index)}}class Ec{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return xo.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&&!(AO(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 Ec(i,o,this.set)}}function AO(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 s0(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 yo&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=r?0:Ar.IgnoreOverlays;if(r)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof yo&&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 EO{cursor(t=0){return new h3(this,t)}getChild(t,n=null,r=null){let s=wC(this,t,n,r);return s.length?s[0]:null}getChildren(t,n=null,r=null){return wC(this,t,n,r)}resolve(t,n=0){return s0(this,t,n,!1)}resolveInner(t,n=0){return s0(this,t,n,!0)}matchContext(t){return d3(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 yo extends EO{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&Ar.EnterBracketed&&u instanceof Ss&&(f=km.get(u))&&!f.overlay&&f.bracketed&&r>=d&&r<=d+u.length)&&!AO(s,r,d,d+u.length))){if(u instanceof Ec){if(i&Ar.ExcludeBuffers)continue;let m=u.findChild(0,u.buffer.length,n,r-d,s);if(m>-1)return new ec(new c1e(o,u,t,d),null,m)}else if(i&Ar.IncludeAnonymous||!u.type.isAnonymous||xk(u)){let m;if(!(i&Ar.IgnoreMounts)&&(m=km.get(u))&&!m.overlay)return new yo(m.tree,d,t,o);let p=new yo(u,d,t,o);return i&Ar.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?u.children.length-1:0,n,r,s,i)}}}if(i&Ar.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&Ar.IgnoreOverlays)&&(s=km.get(this._tree))&&s.overlay){let i=t-this.from,o=r&Ar.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 yo(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 wC(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 d3(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 c1e{constructor(t,n,r,s){this.parent=t,this.buffer=n,this.index=r,this.start=s}}class ec extends EO{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 ec(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&Ar.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 ec(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 ec(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 ec(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 MO(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 yo&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new u1e(s,n)}class u1e{constructor(t,n){this.heads=t,this.node=n}get next(){return MO(this.heads)}}function d1e(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof yo?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=km.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new yo(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(s0(a,t,n,!1))}}return s?MO(s):r}class h3{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&~Ar.EnterBracketed,t instanceof yo)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 yo?(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&Ar.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ar.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ar.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&Ar.IncludeAnonymous||a instanceof Ec||!a.type.isAnonymous||xk(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 ec(this.buffer,n,this.stack[s]);return this.bufferNode=new ec(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 d3(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 d3(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 xk(e){return e.children.some(t=>t instanceof Ec||!t.type.isAnonymous||xk(t))}function h1e(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=o1e,reused:i=[],minRepeatType:o=r.types.length}=e,a=Array.isArray(n)?new vk(n,n.length):n,l=r.types,c=0,u=0;function d(T,A,M,D,O,C){let{id:L,start:I,end:B,size:F}=a,W=u,j=c;if(F<0)if(a.next(),F==-1){let q=i[L];M.push(q),D.push(I-T);return}else if(F==-3){c=L;return}else if(F==-4){u=L;return}else throw new RangeError(`Unrecognized record size: ${F}`);let K=l[L],J,ee,N=I-T;if(B-I<=s&&(ee=v(a.pos-A,O))){let q=new Uint16Array(ee.size-ee.skip),P=a.pos-ee.size,E=q.length;for(;a.pos>P;)E=b(ee.start,q,E);J=new Ec(q,B-ee.start,r),N=ee.start-T}else{let q=a.pos-F;a.next();let P=[],E=[],ne=L>=o?L:-1,pe=0,be=B;for(;a.pos>q;)ne>=0&&a.id==ne&&a.size>=0?(a.end<=be-s&&(p(P,E,I,pe,a.end,be,ne,W,j),pe=P.length,be=a.end),a.next()):C>2500?f(I,q,P,E):d(I,q,P,E,ne,C+1);if(ne>=0&&pe>0&&pe<P.length&&p(P,E,I,pe,I,be,ne,W,j),P.reverse(),E.reverse(),ne>-1&&pe>0){let xe=m(K,j);J=_k(K,P,E,0,P.length,0,B-I,xe,xe)}else J=y(K,P,E,B-I,W-B,j)}M.push(J),D.push(N)}function f(T,A,M,D){let O=[],C=0,L=-1;for(;a.pos>A;){let{id:I,start:B,end:F,size:W}=a;if(W>4)a.next();else{if(L>-1&&B<L)break;L<0&&(L=F-s),O.push(I,B,F),C++,a.next()}}if(C){let I=new Uint16Array(C*4),B=O[O.length-2];for(let F=O.length-3,W=0;F>=0;F-=3)I[W++]=O[F],I[W++]=O[F+1]-B,I[W++]=O[F+2]-B,I[W++]=W;M.push(new Ec(I,O[2]-B,r)),D.push(B-T)}}function m(T,A){return(M,D,O)=>{let C=0,L=M.length-1,I,B;if(L>=0&&(I=M[L])instanceof Ss){if(!L&&I.type==T&&I.length==O)return I;(B=I.prop(wn.lookAhead))&&(C=D[L]+I.length+B)}return y(T,M,D,O,C,A)}}function p(T,A,M,D,O,C,L,I,B){let F=[],W=[];for(;T.length>D;)F.push(T.pop()),W.push(A.pop()+M-O);T.push(y(r.types[L],F,W,C-O,I-C,B)),A.push(O-M)}function y(T,A,M,D,O,C,L){if(C){let I=[wn.contextHash,C];L=L?[I].concat(L):[I]}if(O>25){let I=[wn.lookAhead,O];L=L?[I].concat(L):[I]}return new Ss(T,A,M,D,L)}function v(T,A){let M=a.fork(),D=0,O=0,C=0,L=M.end-s,I={size:0,start:0,skip:0};e:for(let B=M.pos-T;M.pos>B;){let F=M.size;if(M.id==A&&F>=0){I.size=D,I.start=O,I.skip=C,C+=4,D+=4,M.next();continue}let W=M.pos-F;if(F<0||W<B||M.start<L)break;let j=M.id>=o?4:0,K=M.start;for(M.next();M.pos>W;){if(M.size<0)if(M.size==-3||M.size==-4)j+=4;else break e;else M.id>=o&&(j+=4);M.next()}O=K,D+=F,C+=j}return(A<0||D==T)&&(I.size=D,I.start=O,I.skip=C),I.size>4?I:void 0}function b(T,A,M){let{id:D,start:O,end:C,size:L}=a;if(a.next(),L>=0&&D<o){let I=M;if(L>4){let B=a.pos-(L-4);for(;a.pos>B;)M=b(T,A,M)}A[--M]=I,A[--M]=C-T,A[--M]=O-T,A[--M]=D}else L==-3?c=D:L==-4&&(u=D);return M}let w=[],x=[];for(;a.pos>0;)d(e.start||0,e.bufferStart||0,w,x,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:w.length?x[0]+w[0].length:0;return new Ss(l[e.topID],w.reverse(),x.reverse(),k)}const vC=new WeakMap;function Dg(e,t){if(!e.isAnonymous||t instanceof Ec||t.type!=e)return 1;let n=vC.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Ss)){n=1;break}n+=Dg(e,r)}vC.set(t,n)}return n}function _k(e,t,n,r,s,i,o,a,l){let c=0;for(let p=r;p<s;p++)c+=Dg(e,t[p]);let u=Math.ceil(c*1.5/8),d=[],f=[];function m(p,y,v,b,w){for(let x=v;x<b;){let k=x,T=y[x],A=Dg(e,p[x]);for(x++;x<b;x++){let M=Dg(e,p[x]);if(A+M>=u)break;A+=M}if(x==k+1){if(A>u){let M=p[k];m(M.children,M.positions,0,M.children.length,y[k]+w);continue}d.push(p[k])}else{let M=y[x-1]+p[x-1].length-T;d.push(_k(e,p,y,k,x,T,M,null,l))}f.push(T+w-i)}}return m(t,n,r,s,0),(a||l)(d,f,o)}class ku{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 ku(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 ku(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 f1e{startParse(t,n,r){return typeof t=="string"&&(t=new m1e(t)),r=r?r.length?r.map(s=>new Zw(s.from,s.to)):[new Zw(0,0)]:[new Zw(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 m1e{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 wn({perNode:!0});let p1e=0;class io{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=p1e++}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 io&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new io(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 ey(t);return r=>r.modified.indexOf(n)>-1?r:ey.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let g1e=0;class ey{constructor(t){this.name=t,this.instances=[],this.id=g1e++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(a=>a.base==t&&y1e(n,a.modified));if(r)return r;let s=[],i=new io(t.name,s,t,n);for(let a of n)a.instances.push(i);let o=b1e(n);for(let a of t.set)if(!a.modified.length)for(let l of o)s.push(ey.get(a,l));return i}}function y1e(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function b1e(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 w1e(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 i0(r,o,l>0?i.slice(0,l):null);t[c]=u.sort(t[c])}}return IO.add(t)}const IO=new wn({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 i0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class i0{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}}i0.empty=new i0([],2,null);function NO(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 v1e(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function x1e(e,t,n,r=0,s=e.length){let i=new _1e(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}class _1e{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=k1e(t)||i0.empty,d=v1e(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(wn.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 w=v<f.overlay.length?f.overlay[v]:null,x=w?w.from+a:l,k=Math.max(n,b),T=Math.min(r,x);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>=x||!t.nextSibling())););if(!w||x>r)break;b=w.to+a,b>n&&(this.highlightRange(m.cursor(),Math.max(n,w.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 k1e(e){let t=e.type.prop(IO);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Ke=io.define,Wp=Ke(),Bl=Ke(),xC=Ke(Bl),_C=Ke(Bl),Pl=Ke(),Gp=Ke(Pl),e4=Ke(Pl),na=Ke(),Kc=Ke(na),Jo=Ke(),Zo=Ke(),f3=Ke(),Tf=Ke(f3),Kp=Ke(),et={comment:Wp,lineComment:Ke(Wp),blockComment:Ke(Wp),docComment:Ke(Wp),name:Bl,variableName:Ke(Bl),typeName:xC,tagName:Ke(xC),propertyName:_C,attributeName:Ke(_C),className:Ke(Bl),labelName:Ke(Bl),namespace:Ke(Bl),macroName:Ke(Bl),literal:Pl,string:Gp,docString:Ke(Gp),character:Ke(Gp),attributeValue:Ke(Gp),number:e4,integer:Ke(e4),float:Ke(e4),bool:Ke(Pl),regexp:Ke(Pl),escape:Ke(Pl),color:Ke(Pl),url:Ke(Pl),keyword:Jo,self:Ke(Jo),null:Ke(Jo),atom:Ke(Jo),unit:Ke(Jo),modifier:Ke(Jo),operatorKeyword:Ke(Jo),controlKeyword:Ke(Jo),definitionKeyword:Ke(Jo),moduleKeyword:Ke(Jo),operator:Zo,derefOperator:Ke(Zo),arithmeticOperator:Ke(Zo),logicOperator:Ke(Zo),bitwiseOperator:Ke(Zo),compareOperator:Ke(Zo),updateOperator:Ke(Zo),definitionOperator:Ke(Zo),typeOperator:Ke(Zo),controlOperator:Ke(Zo),punctuation:f3,separator:Ke(f3),bracket:Tf,angleBracket:Ke(Tf),squareBracket:Ke(Tf),paren:Ke(Tf),brace:Ke(Tf),content:na,heading:Kc,heading1:Ke(Kc),heading2:Ke(Kc),heading3:Ke(Kc),heading4:Ke(Kc),heading5:Ke(Kc),heading6:Ke(Kc),contentSeparator:Ke(na),list:Ke(na),quote:Ke(na),emphasis:Ke(na),strong:Ke(na),link:Ke(na),monospace:Ke(na),strikethrough:Ke(na),inserted:Ke(),deleted:Ke(),changed:Ke(),invalid:Ke(),meta:Kp,documentMeta:Ke(Kp),annotation:Ke(Kp),processingInstruction:Ke(Kp),definition:io.defineModifier("definition"),constant:io.defineModifier("constant"),function:io.defineModifier("function"),standard:io.defineModifier("standard"),local:io.defineModifier("local"),special:io.defineModifier("special")};for(let e in et){let t=et[e];t instanceof io&&(t.name=e)}NO([{tag:et.link,class:"tok-link"},{tag:et.heading,class:"tok-heading"},{tag:et.emphasis,class:"tok-emphasis"},{tag:et.strong,class:"tok-strong"},{tag:et.keyword,class:"tok-keyword"},{tag:et.atom,class:"tok-atom"},{tag:et.bool,class:"tok-bool"},{tag:et.url,class:"tok-url"},{tag:et.labelName,class:"tok-labelName"},{tag:et.inserted,class:"tok-inserted"},{tag:et.deleted,class:"tok-deleted"},{tag:et.literal,class:"tok-literal"},{tag:et.string,class:"tok-string"},{tag:et.number,class:"tok-number"},{tag:[et.regexp,et.escape,et.special(et.string)],class:"tok-string2"},{tag:et.variableName,class:"tok-variableName"},{tag:et.local(et.variableName),class:"tok-variableName tok-local"},{tag:et.definition(et.variableName),class:"tok-variableName tok-definition"},{tag:et.special(et.variableName),class:"tok-variableName2"},{tag:et.definition(et.propertyName),class:"tok-propertyName tok-definition"},{tag:et.typeName,class:"tok-typeName"},{tag:et.namespace,class:"tok-namespace"},{tag:et.className,class:"tok-className"},{tag:et.macroName,class:"tok-macroName"},{tag:et.propertyName,class:"tok-propertyName"},{tag:et.operator,class:"tok-operator"},{tag:et.comment,class:"tok-comment"},{tag:et.meta,class:"tok-meta"},{tag:et.invalid,class:"tok-invalid"},{tag:et.punctuation,class:"tok-punctuation"}]);var t4;const qf=new wn,S1e=new wn;class ma{constructor(t,n,r=[],s=""){this.data=t,this.name=s,jn.prototype.hasOwnProperty("tree")||Object.defineProperty(jn.prototype,"tree",{get(){return Do(this)}}),this.parser=n,this.extension=[Th.of(this),jn.languageData.of((i,o,a)=>{let l=kC(i,o,a),c=l.type.prop(qf);if(!c)return[];let u=i.facet(c),d=l.type.prop(S1e);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 kC(t,n,r).type.prop(qf)==this.data}findRegions(t){let n=t.facet(Th);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(qf)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(wn.mounted);if(a){if(a.tree.prop(qf)==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(Do(t),0),r}get allowsNesting(){return!0}}ma.setState=qn.define();function kC(e,t,n){let r=e.facet(Th),s=Do(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,Ar.ExcludeBuffers|Ar.EnterBracketed))i.type.isTop&&(s=i);return s}function Do(e){let t=e.field(ma.state,!1);return t?t.tree:Ss.empty}class T1e{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 Cf=null;class ty{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 ty(t,n,[],Ss.empty,0,r,[],null)}startParse(){return this.parser.startParse(new T1e(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(ku.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(ku.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Cf;Cf=this;try{return t()}finally{Cf=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=SC(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=ku.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 ty(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=SC(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 f1e{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=Cf;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(xo.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 Cf}}function SC(e,t,n){return ku.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Sh{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 Sh(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=ty.create(t.facet(Th).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Sh(r)}}ma.state=Ca.define({create:Sh.init,update(e,t){for(let n of t.effects)if(n.is(ma.setState))return n.value;return t.startState.facet(Th)!=t.state.facet(Th)?Sh.init(t.state):e.apply(t)}});let RO=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(RO=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const n4=typeof navigator<"u"&&(!((t4=navigator.scheduling)===null||t4===void 0)&&t4.isInputPending)?()=>navigator.scheduling.isInputPending():null,C1e=vi.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(ma.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(ma.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=RO(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(ma.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!n4?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>n4&&n4()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:ma.setState.of(new Sh(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=>Oi(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()}}}),Th=It.define({combine(e){return e.length?e[0]:null},enables:e=>[ma.state,C1e,yt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),A1e=It.define(),kk=It.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 ny(e){let t=e.facet(kk);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function ry(e,t){let n="",r=e.tabSize,s=e.facet(kk)[0];if(s=="	"){for(;t>=r;)n+="	",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function LO(e,t){e instanceof jn&&(e=new fb(e));for(let r of e.state.facet(A1e)){let s=r(e,t);if(s!==void 0)return s}let n=Do(e.state);return n.length>=t?M1e(e,n,t):null}class fb{constructor(t,n={}){this.state=t,this.options=n,this.unit=ny(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 L0(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 E1e=new wn;function M1e(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 jO(r,e,n)}function jO(e,t,n){for(let r=e;r;r=r.next){let s=N1e(r.node);if(s)return s(Sk.create(t,n,r))}return 0}function I1e(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function N1e(e){let t=e.type.prop(E1e);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(wn.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>D1e(o,!0,1,void 0,i&&!I1e(o)?s.from:void 0)}return e.parent==null?R1e:null}function R1e(){return 0}class Sk extends fb{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 Sk(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(L1e(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return jO(this.context.next,this.base,this.pos)}}function L1e(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function j1e(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 D1e(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=j1e(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}class mb{constructor(t,n){this.specs=t;let r;function s(a){let l=Tc.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 ma?a=>a.prop(qf)==o.data:o?a=>a==o:void 0,this.style=NO(t.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new Tc(r):null,this.themeType=n.themeType}static define(t,n){return new mb(t,n||{})}}const m3=It.define(),DO=It.define({combine(e){return e.length?[e[0]]:null}});function r4(e){let t=e.facet(m3);return t.length?t:e.facet(DO)}function O1e(e,t){let n=[P1e],r;return e instanceof mb&&(e.module&&n.push(yt.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(DO.of(e)):r?n.push(m3.computeN([yt.darkTheme],s=>s.facet(yt.darkTheme)==(r=="dark")?[e]:[])):n.push(m3.of(e)),n}class B1e{constructor(t){this.markCache=Object.create(null),this.tree=Do(t.state),this.decorations=this.buildDeco(t,r4(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Do(t.state),r=r4(t.state),s=r!=r4(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 mn.none;let r=new ju;for(let{from:s,to:i}of t.visibleRanges)x1e(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=mn.mark({class:l})))},s,i);return r.finish()}}const P1e=Ku.high(vi.fromClass(B1e,{decorations:e=>e.decorations})),$1e=mb.define([{tag:et.meta,color:"#404740"},{tag:et.link,textDecoration:"underline"},{tag:et.heading,textDecoration:"underline",fontWeight:"bold"},{tag:et.emphasis,fontStyle:"italic"},{tag:et.strong,fontWeight:"bold"},{tag:et.strikethrough,textDecoration:"line-through"},{tag:et.keyword,color:"#708"},{tag:[et.atom,et.bool,et.url,et.contentSeparator,et.labelName],color:"#219"},{tag:[et.literal,et.inserted],color:"#164"},{tag:[et.string,et.deleted],color:"#a11"},{tag:[et.regexp,et.escape,et.special(et.string)],color:"#e40"},{tag:et.definition(et.variableName),color:"#00f"},{tag:et.local(et.variableName),color:"#30a"},{tag:[et.typeName,et.namespace],color:"#085"},{tag:et.className,color:"#167"},{tag:[et.special(et.variableName),et.macroName],color:"#256"},{tag:et.definition(et.propertyName),color:"#00c"},{tag:et.comment,color:"#940"},{tag:et.invalid,color:"#f00"}]),z1e=1e4,F1e="()[]{}",q1e=new wn;function p3(e,t,n){let r=e.prop(t<0?wn.openedBy:wn.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 g3(e){let t=e.type.prop(q1e);return t?t(e.node):e}function Dd(e,t,n,r={}){let s=r.maxScanDistance||z1e,i=r.brackets||F1e,o=Do(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let c=p3(l.type,n,i);if(c&&l.from<l.to){let u=g3(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return U1e(e,t,n,l,u,c,i)}}return H1e(e,t,n,o,a.type,s,i)}function U1e(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=g3(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(p3(u.type,n,o))c++;else if(p3(u.type,-n,o)){if(c==0){let d=g3(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 H1e(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 V1e=Object.create(null),TC=[xo.none],CC=[],AC=Object.create(null),W1e=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"]])W1e[e]=G1e(V1e,t);function s4(e,t){CC.indexOf(e)>-1||(CC.push(e),console.warn(t))}function G1e(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let c of a.split(".")){let u=e[c]||et[c];u?typeof u=="function"?l.length?l=l.map(u):s4(c,`Modifier ${c} used at start of tag`):l.length?s4(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:s4(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=AC[s];if(i)return i.id;let o=AC[s]=xo.define({id:TC.length,name:r,props:[w1e({[r]:n})]});return TC.push(o),o.id}sr.RTL,sr.LTR;const K1e=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ck(e.state,n.from);return r.line?Y1e(e):r.block?Q1e(e):!1};function Tk(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 Y1e=Tk(eye,0),X1e=Tk(OO,0),Q1e=Tk((e,t)=>OO(e,t,Z1e(t)),0);function Ck(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Af=50;function J1e(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-Af,r),o=e.sliceDoc(s,s+Af),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*Af?u=d=e.sliceDoc(r,s):(u=e.sliceDoc(r,r+Af),d=e.sliceDoc(s-Af,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 Z1e(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 OO(e,t,n=t.selection.ranges){let r=n.map(i=>Ck(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>J1e(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 eye(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=Ck(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 y3=_l.define(),tye=_l.define(),nye=It.define(),BO=It.define({combine(e){return ab(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)})}}),PO=Ca.define({create(){return pa.empty},update(e,t){let n=t.state.facet(BO),r=t.annotation(y3);if(r){let l=gi.fromTransaction(t,r.selection),c=r.side,u=c==0?e.undone:e.done;return l?u=sy(u,u.length,n.minDepth,l):u=qO(u,t.startState.selection),new pa(c==0?r.rest:u,c==0?u:r.rest)}let s=t.annotation(tye);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Jr.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=gi.fromTransaction(t),o=t.annotation(Jr.time),a=t.annotation(Jr.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 pa(e.done.map(gi.fromJSON),e.undone.map(gi.fromJSON))}});function $O(e={}){return[PO,BO.of(e),yt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?zO:t.inputType=="historyRedo"?b3:null;return r?(t.preventDefault(),r(n)):!1}})]}function pb(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(PO,!1);if(!s)return!1;let i=s.pop(e,n,t);return i?(r(i),!0):!1}}const zO=pb(0,!1),b3=pb(1,!1),rye=pb(0,!0),sye=pb(1,!0);class gi{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 gi(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 gi(t.changes&&Xr.fromJSON(t.changes),[],t.mapped&&ba.fromJSON(t.mapped),t.startSelection&&Le.fromJSON(t.startSelection),t.selectionsAfter.map(Le.fromJSON))}static fromTransaction(t,n){let r=fo;for(let s of t.startState.facet(nye)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new gi(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,fo)}static selection(t){return new gi(void 0,fo,void 0,void 0,t)}}function sy(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 iye(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 oye(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function FO(e,t){return e.length?t.length?e.concat(t):e:t}const fo=[],aye=200;function qO(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-aye));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),sy(e,e.length-1,1e9,n.setSelAfter(r)))}else return[gi.selection([t])]}function lye(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 i4(e,t){if(!e.length)return e;let n=e.length,r=fo;for(;n;){let s=cye(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?[gi.selection(r)]:fo}function cye(e,t,n){let r=FO(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):fo,n);if(!e.changes)return gi.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new gi(s,qn.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}const uye=/^(input\.type|delete)($|\.)/;class pa{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 pa(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||uye.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,iye(a.changes,t.changes))||r=="input.type.compose")?o=sy(o,o.length-1,s.minDepth,new gi(t.changes.compose(a.changes),FO(qn.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,fo)):o=sy(o,o.length,s.minDepth,t),new pa(o,fo,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:fo;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&oye(i[i.length-1],t)?this:new pa(qO(this.done,t),this.undone,n,r)}addMapping(t){return new pa(i4(this.done,t),i4(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:y3.of({side:t,rest:lye(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?fo:s.slice(0,s.length-1);return i.mapped&&(a=i4(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:y3.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}pa.empty=new pa(fo,fo);const UO=[{key:"Mod-z",run:zO,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:b3,preventDefault:!0},{linux:"Ctrl-Shift-z",run:b3,preventDefault:!0},{key:"Mod-u",run:rye,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:sye,preventDefault:!0}];function Wh(e,t){return Le.create(e.ranges.map(t),e.mainIndex)}function Bo(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Po({state:e,dispatch:t},n){let r=Wh(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Bo(e,r)),!0)}function gb(e,t){return Le.cursor(t?e.to:e.from)}function HO(e,t){return Po(e,n=>n.empty?e.moveByChar(n,t):gb(n,t))}function Bs(e){return e.textDirectionAt(e.state.selection.main.head)==sr.LTR}const VO=e=>HO(e,!Bs(e)),WO=e=>HO(e,Bs(e));function GO(e,t){return Po(e,n=>n.empty?e.moveByGroup(n,t):gb(n,t))}const dye=e=>GO(e,!Bs(e)),hye=e=>GO(e,Bs(e));function fye(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 yb(e,t,n){let r=Do(e).resolveInner(t.head),s=n?wn.closedBy:wn.openedBy;for(let l=t.head;;){let c=n?r.childAfter(l):r.childBefore(l);if(!c)break;fye(e,c,s)?r=c:l=n?c.to:c.from}let i=r.type.prop(s),o,a;return i&&(o=n?Dd(e,r.from,1):Dd(e,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Le.cursor(a,n?-1:1)}const mye=e=>Po(e,t=>yb(e.state,t,!Bs(e))),pye=e=>Po(e,t=>yb(e.state,t,Bs(e)));function KO(e,t){return Po(e,n=>{if(!n.empty)return gb(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const YO=e=>KO(e,!1),XO=e=>KO(e,!0);function QO(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(yt.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 JO(e,t){let n=QO(e),{state:r}=e,s=Wh(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):gb(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=yt.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(Bo(r,s),{effects:i}),!0}const EC=e=>JO(e,!1),w3=e=>JO(e,!0);function Oc(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=Le.cursor(r.from+i))}return s}const gye=e=>Po(e,t=>Oc(e,t,!0)),yye=e=>Po(e,t=>Oc(e,t,!1)),bye=e=>Po(e,t=>Oc(e,t,!Bs(e))),wye=e=>Po(e,t=>Oc(e,t,Bs(e))),vye=e=>Po(e,t=>Le.cursor(e.lineBlockAt(t.head).from,1)),xye=e=>Po(e,t=>Le.cursor(e.lineBlockAt(t.head).to,-1));function _ye(e,t,n){let r=!1,s=Wh(e.selection,i=>{let o=Dd(e,i.head,-1)||Dd(e,i.head,1)||i.head>0&&Dd(e,i.head-1,1)||i.head<e.doc.length&&Dd(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 Le.cursor(a)});return r?(t(Bo(e,s)),!0):!1}const kye=({state:e,dispatch:t})=>_ye(e,t);function _o(e,t){let n=Wh(e.state.selection,r=>{let s=t(r);return Le.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(Bo(e.state,n)),!0)}function ZO(e,t){return _o(e,n=>e.moveByChar(n,t))}const eB=e=>ZO(e,!Bs(e)),tB=e=>ZO(e,Bs(e));function nB(e,t){return _o(e,n=>e.moveByGroup(n,t))}const Sye=e=>nB(e,!Bs(e)),Tye=e=>nB(e,Bs(e)),Cye=e=>_o(e,t=>yb(e.state,t,!Bs(e))),Aye=e=>_o(e,t=>yb(e.state,t,Bs(e)));function rB(e,t){return _o(e,n=>e.moveVertically(n,t))}const sB=e=>rB(e,!1),iB=e=>rB(e,!0);function oB(e,t){return _o(e,n=>e.moveVertically(n,t,QO(e).height))}const MC=e=>oB(e,!1),IC=e=>oB(e,!0),Eye=e=>_o(e,t=>Oc(e,t,!0)),Mye=e=>_o(e,t=>Oc(e,t,!1)),Iye=e=>_o(e,t=>Oc(e,t,!Bs(e))),Nye=e=>_o(e,t=>Oc(e,t,Bs(e))),Rye=e=>_o(e,t=>Le.cursor(e.lineBlockAt(t.head).from)),Lye=e=>_o(e,t=>Le.cursor(e.lineBlockAt(t.head).to)),NC=({state:e,dispatch:t})=>(t(Bo(e,{anchor:0})),!0),RC=({state:e,dispatch:t})=>(t(Bo(e,{anchor:e.doc.length})),!0),LC=({state:e,dispatch:t})=>(t(Bo(e,{anchor:e.selection.main.anchor,head:0})),!0),jC=({state:e,dispatch:t})=>(t(Bo(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),jye=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Dye=({state:e,dispatch:t})=>{let n=bb(e).map(({from:r,to:s})=>Le.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:Le.create(n),userEvent:"select"})),!0},Oye=({state:e,dispatch:t})=>{let n=Wh(e.selection,r=>{let s=Do(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 Le.range(a.to,a.from)}return r});return n.eq(e.selection)?!1:(t(Bo(e,n)),!0)};function aB(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(Bo(n,Le.create(s,s.length-1))),!0)}const Bye=e=>aB(e,!1),Pye=e=>aB(e,!0),$ye=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Le.create([n.main]):n.main.empty||(r=Le.create([Le.cursor(n.main.head)])),r?(t(Bo(e,r)),!0):!1};function B0(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=Yp(e,l,!1)):l>o&&(n="delete.forward",l=Yp(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Yp(e,o,!1),a=Yp(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Le.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"?yt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Yp(e,t,n){if(e instanceof yt)for(let r of e.state.facet(yt.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}const lB=(e,t,n)=>B0(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=L0(a,i.tabSize),u=c%ny(i)||ny(i);for(let d=0;d<u&&a[a.length-1-d]==" ";d++)s--;l=s}else l=js(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=js(o.text,l-o.from,!1,!1)+o.from);return l}),v3=e=>lB(e,!1,!0),cB=e=>lB(e,!0,!1),uB=(e,t)=>B0(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=js(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}),dB=e=>uB(e,!1),zye=e=>uB(e,!0),Fye=e=>B0(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),qye=e=>B0(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Uye=e=>B0(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Hye=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:vn.of(["",""])},range:Le.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},Vye=({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:js(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:js(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:Le.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bb(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 hB(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of bb(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(Le.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(Le.range(l.anchor-a,l.head-a))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Le.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Wye=({state:e,dispatch:t})=>hB(e,t,!1),Gye=({state:e,dispatch:t})=>hB(e,t,!0);function fB(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of bb(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 Kye=({state:e,dispatch:t})=>fB(e,t,!1),Yye=({state:e,dispatch:t})=>fB(e,t,!0),Xye=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(bb(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=Wh(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 Qye(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Do(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(wn.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 DC=mB(!1),Jye=mB(!0);function mB(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&&Qye(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let c=new fb(t,{simulateBreak:i,simulateDoubleBreak:!!l}),u=LO(c,i);for(u==null&&(u=L0(/^\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=["",ry(t,u)];return l&&d.push(ry(t,c.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:vn.of(d)},range:Le.cursor(i+1+d[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ak(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:Le.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const Zye=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new fb(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=Ak(e,(i,o,a)=>{let l=LO(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=ry(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},ebe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Ak(e,(n,r)=>{r.push({from:n.from,insert:e.facet(kk)})}),{userEvent:"input.indent"})),!0),tbe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Ak(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=L0(s,e.tabSize),o=0,a=ry(e,Math.max(0,i-ny(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),nbe=e=>(e.setTabFocusMode(),!0),rbe=[{key:"Ctrl-b",run:VO,shift:eB,preventDefault:!0},{key:"Ctrl-f",run:WO,shift:tB},{key:"Ctrl-p",run:YO,shift:sB},{key:"Ctrl-n",run:XO,shift:iB},{key:"Ctrl-a",run:vye,shift:Rye},{key:"Ctrl-e",run:xye,shift:Lye},{key:"Ctrl-d",run:cB},{key:"Ctrl-h",run:v3},{key:"Ctrl-k",run:Fye},{key:"Ctrl-Alt-h",run:dB},{key:"Ctrl-o",run:Hye},{key:"Ctrl-t",run:Vye},{key:"Ctrl-v",run:w3}],sbe=[{key:"ArrowLeft",run:VO,shift:eB,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:dye,shift:Sye,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:bye,shift:Iye,preventDefault:!0},{key:"ArrowRight",run:WO,shift:tB,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:hye,shift:Tye,preventDefault:!0},{mac:"Cmd-ArrowRight",run:wye,shift:Nye,preventDefault:!0},{key:"ArrowUp",run:YO,shift:sB,preventDefault:!0},{mac:"Cmd-ArrowUp",run:NC,shift:LC},{mac:"Ctrl-ArrowUp",run:EC,shift:MC},{key:"ArrowDown",run:XO,shift:iB,preventDefault:!0},{mac:"Cmd-ArrowDown",run:RC,shift:jC},{mac:"Ctrl-ArrowDown",run:w3,shift:IC},{key:"PageUp",run:EC,shift:MC},{key:"PageDown",run:w3,shift:IC},{key:"Home",run:yye,shift:Mye,preventDefault:!0},{key:"Mod-Home",run:NC,shift:LC},{key:"End",run:gye,shift:Eye,preventDefault:!0},{key:"Mod-End",run:RC,shift:jC},{key:"Enter",run:DC,shift:DC},{key:"Mod-a",run:jye},{key:"Backspace",run:v3,shift:v3,preventDefault:!0},{key:"Delete",run:cB,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:dB,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:zye,preventDefault:!0},{mac:"Mod-Backspace",run:qye,preventDefault:!0},{mac:"Mod-Delete",run:Uye,preventDefault:!0}].concat(rbe.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),pB=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:mye,shift:Cye},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:pye,shift:Aye},{key:"Alt-ArrowUp",run:Wye},{key:"Shift-Alt-ArrowUp",run:Kye},{key:"Alt-ArrowDown",run:Gye},{key:"Shift-Alt-ArrowDown",run:Yye},{key:"Mod-Alt-ArrowUp",run:Bye},{key:"Mod-Alt-ArrowDown",run:Pye},{key:"Escape",run:$ye},{key:"Mod-Enter",run:Jye},{key:"Alt-l",mac:"Ctrl-l",run:Dye},{key:"Mod-i",run:Oye,preventDefault:!0},{key:"Mod-[",run:tbe},{key:"Mod-]",run:ebe},{key:"Mod-Alt-\\",run:Zye},{key:"Shift-Mod-k",run:Xye},{key:"Shift-Mod-\\",run:kye},{key:"Mod-/",run:K1e},{key:"Alt-A",run:X1e},{key:"Ctrl-m",mac:"Shift-Alt-m",run:nbe}].concat(sbe);class gB{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=Do(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(yB(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 OC(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 ibe(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=OC(t)+OC(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function obe(e){let t=e.map(s=>typeof s=="string"?{label:s}:s),[n,r]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:ibe(t);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:t,validFor:n}:null}}class BC{constructor(t,n,r,s){this.completion=t,this.source=n,this.match=r,this.score=s}}function Su(e){return e.selection.main.from}function yB(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 bB=_l.define();function abe(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:Le.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const PC=new WeakMap;function lbe(e){if(!Array.isArray(e))return e;let t=PC.get(e);return t||PC.set(e,t=obe(e)),t}const iy=qn.define(),o0=qn.define();class cbe{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=Ol(t,n),s=bd(r);this.chars.push(r);let i=t.slice(n,n+s),o=i.toUpperCase();this.folded.push(Ol(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 w=Ol(t,0),x=bd(w),k=x==t.length?0:-100;if(w!=n[0])if(w==r[0])k+=-200;else return null;return this.ret(k,[0,x])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(a<0){for(let w=0,x=Math.min(t.length,200);w<x&&c<l;){let k=Ol(t,w);(k==n[c]||k==r[c])&&(s[c++]=w),w+=bd(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 w=0,x=Math.min(t.length,200),k=0;w<x&&d<l;){let T=Ol(t,w);a<0&&(u<l&&T==n[u]&&(i[u++]=w),m<l&&(T==n[m]||T==r[m]?(m==0&&(p=w),y=w+1,m++):m=0));let A,M=T<255?T>=48&&T<=57||T>=97&&T<=122?2:T>=65&&T<=90?1:0:(A=R0e(T))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!w||M==1&&v||k==0&&M!=0)&&(n[d]==T||r[d]==T&&(f=!0)?o[d++]=w:o.length&&(b=!1)),k=M,w+=bd(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?bd(Ol(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 ube{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 hs=It.define({combine(e){return ab(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:dbe,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=>$C(t(r),n(r)),optionClass:(t,n)=>r=>$C(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function $C(e,t){return e?t?e+" "+t:e:t}function dbe(e,t,n,r,s,i){let o=e.textDirection==sr.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 w=s.bottom-t.bottom;w>=y||w>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 Ek=qn.define();function hbe(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 o4(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 fbe{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(hs);this.optionContent=hbe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=o4(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:Ek.of(u)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(hs).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:o0.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=o4(i.length,o,t.state.facet(hs).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=o4(n.options.length,n.selected,this.view.state.facet(hs).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=>Oi(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&&pbe(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(hs).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 mbe(e,t){return n=>new fbe(n,e,t)}function pbe(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 zC(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function gbe(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(hs);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 BC(f,u.source,d?d(f):[],1e9-n.length));else{let f=t.sliceDoc(u.from,u.to),m,p=o.filterStrict?new ube(f):new cbe(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 BC(y,u.source,v,b)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:w}=y.section;s||(s=Object.create(null)),s[w]=Math.max(b,s[w]||-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):zC(u.completion)>zC(l)&&(a[a.length-1]=u),l=u.completion}return a}class Od{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 Od(this.options,FC(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=gbe(t,n);if(!a.length)return s&&t.some(c=>c.isPending)?s.setDisabled():null;let l=n.facet(hs).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 Od(a,FC(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:_be,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(t){return new Od(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Od(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class oy{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new oy(vbe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(hs),i=(r.override||n.languageDataAt("autocomplete",Su(n)).map(lbe)).map(l=>(this.active.find(u=>u.source==l)||new mo(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(Mk));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!ybe(i,this.active)||a?o=Od.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 mo(l.source,0):l));for(let l of t.effects)l.is(Ek)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new oy(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?bbe:wbe}}function ybe(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 bbe={"aria-autocomplete":"list"},wbe={};function FC(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const vbe=[];function wB(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(bB);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 mo{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=wB(t,n),s=this;(r&8||r&16&&this.touches(t))&&(s=new mo(s.source,0)),r&4&&s.state==0&&(s=new mo(this.source,1)),s=s.updateFor(t,r);for(let i of t.effects)if(i.is(iy))s=new mo(s.source,1,i.value);else if(i.is(o0))s=new mo(s.source,0);else if(i.is(Mk))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(Su(t.state))}}class Jd extends mo{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=Su(t.state);if(a>o||!s||n&2&&(Su(t.startState)==this.from||a<this.limit))return new mo(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return xbe(s.validFor,t.state,i,o)?new Jd(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new gB(t.state,a,!1)))?new Jd(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:Su(t.state)):new mo(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 Jd(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new mo(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function xbe(e,t,n,r){if(!e)return!1;let s=t.sliceDoc(n,r);return typeof e=="function"?e(s,n,r,t):yB(e,!0).test(s)}const Mk=qn.define({map(e,t){return e.map(n=>n.map(t))}}),Ys=Ca.define({create(){return oy.start()},update(e,t){return e.update(t)},provide:e=>[TO.from(e,t=>t.tooltip),yt.contentAttributes.from(e,t=>t.attrs)]});function Ik(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Ys).active.find(s=>s.source==t.source);return r instanceof Jd?(typeof n=="string"?e.dispatch({...abe(e.state,n,r.from,r.to),annotations:bB.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const _be=mbe(Ys,Ik);function tc(e,t="option"){return n=>{let r=n.state.field(Ys,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(hs).interactionDelay)return!1;let s=1,i;t=="page"&&(i=CO(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:Ek.of(a)}),!0}}const vB=e=>{let t=e.state.field(Ys,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(hs).interactionDelay?!1:Ik(e,t.open.options[t.open.selected])},Zd=e=>e.state.field(Ys,!1)?(e.dispatch({effects:iy.of(!0)}),!0):!1,Og=e=>{let t=e.state.field(Ys,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:o0.of(null)}),!0)};class kbe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Sbe=50,Tbe=1e3,Cbe=vi.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(Ys).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Ys),n=e.state.facet(hs);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ys)==t)return;let r=e.transactions.some(i=>{let o=wB(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>Sbe&&Date.now()-o.time>Tbe){for(let a of o.context.abortListeners)try{a()}catch(l){Oi(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(iy)))&&(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(Ys);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(hs).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Su(t),r=new gB(t,n,e.explicit,this.view),s=new kbe(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:o0.of(null)}),Oi(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(hs).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(hs),r=this.view.state.field(Ys);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=Su(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),c=new Jd(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 mo(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:Mk.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ys,!1);if(t&&t.tooltip&&this.view.state.facet(hs).closeOnBlur){let n=t.open&&CO(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:o0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:iy.of(!1)}),20),this.composing=0}}}),Abe=typeof navigator=="object"&&/Win/.test(navigator.platform),Ebe=Ku.highest(yt.domEventHandlers({keydown(e,t){let n=t.state.field(Ys,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Abe&&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&&Ik(t,r),!1}})),Mbe=yt.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"}}}),xB=new class extends Sc{};xB.startSide=1;xB.endSide=-1;function Ibe(e={}){return[Ebe,Ys,hs.of(e),Cbe,Rbe,Mbe]}const Nbe=[{key:"Ctrl-Space",run:Zd},{mac:"Alt-`",run:Zd},{mac:"Alt-i",run:Zd},{key:"Escape",run:Og},{key:"ArrowDown",run:tc(!0)},{key:"ArrowUp",run:tc(!1)},{key:"PageDown",run:tc(!0,"page")},{key:"PageUp",run:tc(!1,"page")},{key:"Enter",run:vB}],Rbe=Ku.highest(r0.computeN([hs],e=>e.facet(hs).defaultKeymap?[Nbe]:[]));function Ci(e){let t=e.field(Ys,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const Lbe=[Kge(),$O(),$ge(),O1e($1e,{fallback:!0}),r0.of([...pB,...UO])],a0=["custom","skill","system"];function x3(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function jbe(e,t,n=a0){return qC(x3(e),n)-qC(x3(t),n)}function qC(e,t=a0){const n=t.indexOf(e);return n>=0?n:t.length+a0.indexOf(e)}const Nk=String.raw`([^\s/]+)`,wb={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:"安装扩展"}]},vb={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"}]},xb={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 文件列表"}]},_b={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 Dbe(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"?wb:vb)[e];if(o||(o=(r==="zh-CN"?xb:_b)[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 _B(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 Obe(e,t,n,r){const s=jbe(e,t,r);return s!==0?s:n?_B(e.name,t.name,n):0}const Bbe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function Pbe(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 $be(e,t,n){var c;const r=e.match(new RegExp(`^/${Nk}\\s+$`));if(!r)return null;const s=r[1],i=t.find(u=>u.name===s),o=n==="zh-CN"?wb:vb;if((c=i==null?void 0:i.subcommands)!=null&&c.length||o[s]||s==="skills")return null;const l=(n==="zh-CN"?xb:_b)[s];return!l||l.length===0?null:`/${s} ${l[0].name} `}function zbe(e,t,n){var u,d;const r=e.match(new RegExp(`^/${Nk}(\\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"?wb:vb;if((d=i.subcommands)!=null&&d.length||a[s]||s==="skills")return null;const c=(n==="zh-CN"?xb:_b)[s];return!c||c.length===0?null:`[${c.map(f=>f.name).join("|")}]`}function Fbe(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 qbe(e,t,n,r=[],s="en",i=a=>a,o=a0){var w,x;const{lineStart:a,lineEnd:l,lineText:c,textBefore:u,cursor:d}=Fbe(e,t),f=u.match(new RegExp(`^/${Nk}\\s+(.*)$`));if(f){const[,k,T]=f,A=n.find(N=>N.name===k),M=s==="zh-CN"?wb:vb,D=s==="zh-CN"?xb:_b,O=!!M[k]||k==="skills",C=!!D[k];if(!((w=A==null?void 0:A.subcommands)!=null&&w.length)&&!O&&!C)return null;const L=T.split(/\s+/),I=L.pop()||"",B=L;if(!((x=A==null?void 0:A.subcommands)!=null&&x.length)&&!O&&C&&!I)return null;const F=Dbe(k,B,r,s,A==null?void 0:A.subcommands);if(!F)return null;const W=I.toLowerCase(),j=`/${k} ${B.length>0?B.join(" ")+" ":""}`,K=F.filter(N=>!I||N.name.toLowerCase().includes(W)).sort((N,q)=>I?_B(N.name,q.name,W):0),J=k==="skills"&&B.length===0,ee=K.map(N=>{const q=`${j}${N.name}`;return{id:q,label:N.name,detail:N.description||void 0,apply:`${q} `,...J?{type:"skill"}:{}}});return ee.length===0?null:{kind:"subcommand",from:a,to:d,query:I,items:ee}}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)=>Obe(k,T,y,o)).map(k=>{const T=`/${k.name} `,A=x3(k),M=A==="custom"||A==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:T,category:A,section:i(Bbe[A]),...M&&k.description?{type:"command-info"}:{}}});return b.length===0?null:{kind:"command",from:a,to:l,query:p,items:b}}function Ube(e,t=()=>{}){return n=>Hbe(n,e,t)}function Hbe(e,t,n=()=>{}){const r=e.state.doc.lineAt(e.pos),i=r.text.slice(0,e.pos-r.from).match(/@([\w./:-]*)$/);if(!i)return null;const o=i[1],a=e.pos-i[0].length,l=o.startsWith("ext:"),c=l?o.slice(4):o,u=l?void 0:t(),d=n();return Promise.all([Wbe(c,d),u?Vbe(o,u):Promise.resolve([])]).then(([f,m])=>f.length===0&&m.length===0?null:{from:a,options:[...f.map(p=>({label:`@ext:${p.name}`,apply:`@ext:${p.name} `,detail:Gbe(p),type:"keyword",section:"Extensions",boost:20})),...m.map(p=>({label:`@${p}`,apply:`@${p} `,type:"file",section:"Files"}))],filter:!1})}async function Vbe(e,t){try{const n=e?`${e}*`:"**/*";return(await t(n,{maxResults:50})).matches.filter(s=>s!==".")}catch{return[]}}async function Wbe(e,t){if(!t)return[];try{const n=await t(),r=e.toLowerCase();return n.extensions.filter(s=>s.isActive).map(s=>({...s,displayName:UC(s.displayName??"")??void 0,description:UC(s.description??"")??void 0})).filter(s=>{var a;const i=s.name.toLowerCase(),o=((a=s.displayName)==null?void 0:a.toLowerCase())??"";return i.includes(r)||o.includes(r)}).sort((s,i)=>{const o=(s.displayName||s.name).toLowerCase(),a=(i.displayName||i.name).toLowerCase(),l=o.startsWith(r)?0:1,c=a.startsWith(r)?0:1;return l!==c?l-c:o.localeCompare(a)}).slice(0,50)}catch{return[]}}function Gbe(e){const t=e.displayName&&e.displayName!==e.name?e.displayName:void 0;return t&&e.description?`${t} - ${e.description}`:t??e.description}const Kbe="\x1B",Ybe=new RegExp(`${Kbe}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),Xbe=/[‎‏؜⁦⁧⁨⁩‪‫‬‭‮]/g;function UC(e){const t=e.replace(Ybe,"").replace(Xbe,"").replace(/\s+/g," ").trim();return t.length>0?t:null}const Qbe="qwen-web-shell-history",kB=100;function Jbe(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 Zbe(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-kB)))}catch{}}function HC(e=Qbe){const t=g.useRef(e);t.current=e;const n=g.useRef(Jbe(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 w=n.current,x=r.current;a({canUp:w.length>0&&(x===-1||x>0),canDown:x!==-1})},[]),c=g.useCallback(w=>{const x=n.current;x[x.length-1]!==w&&(x.push(w),x.length>kB&&x.shift(),Zbe(t.current,x),r.current=-1,l())},[l]),u=g.useCallback(w=>{const x=n.current;if(x.length===0)return null;if(r.current===-1)s.current=w,r.current=x.length-1;else if(r.current>0)r.current--;else return null;return l(),x[r.current]},[l]),d=g.useCallback(()=>{const w=n.current;return r.current===-1?null:r.current<w.length-1?(r.current++,l(),w[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(w=>{const x=n.current;if(x.length===0||!w)return null;const k=i.current===-1?x.length-1:i.current-1;if(k<0)return i.current=-1,null;const T=w.toLowerCase();for(let A=k;A>=0;A--)if(x[A].toLowerCase().includes(T))return i.current=A,x[A];return i.current=-1,null},[]),y=g.useCallback(w=>{const x=w.trim().toLowerCase();return n.current.slice().reverse().filter(k=>!x||k.toLowerCase().includes(x))},[]),v=g.useCallback(w=>{const x=n.current;if(!w)return x.length>0?x[x.length-1]:null;for(let k=x.length-1;k>=0;k--)if(w(x[k]))return x[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 e2e=mn.mark({class:"cm-input-slash"}),t2e=mn.mark({class:"cm-input-at"}),n2e=mn.mark({class:"cm-input-code"});class r2e extends Aa{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 VC(e,t,n){const r=new ju,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:e2e})}const u=zbe(l,t(),n());if(u){const p=l.endsWith(" ")?"":" ";i.push({from:c+l.length,to:c+l.length,deco:mn.widget({widget:new r2e(`${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:t2e});const m=/`[^`]+`/g;for(;(f=m.exec(l))!==null;)i.push({from:c+f.index,to:c+f.index+f[0].length,deco:n2e})}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 s2e(e=()=>[],t=()=>"en"){return vi.fromClass(class{constructor(n){le(this,"decorations");this.decorations=VC(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=VC(n.view,e,t))}},{decorations:n=>n.decorations})}const i2e=yt.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"}}),o2e=1e3,a2e=10,WC="web-shell-tooltip-styles",l2e=`
[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 c2e(){if(document.getElementById(WC))return;const e=document.createElement("style");e.id=WC,e.textContent=l2e,document.head.appendChild(e)}function u2e(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function d2e(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function Rk(e){return d2e(e)}function h2e(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function f2e(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function m2e(e,t,n){if(!t.detail||!Rk(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=`${h2e(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 p2e(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 g2e(e){if(!e.detail||!Rk(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=>{m2e(t,e,r)}),n.addEventListener("mouseleave",()=>{const r=t.closest("[data-web-shell-tooltip-portal]");r&&p2e(r)}))}),t}function y2e(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function b2e(e){return[...e].length>o2e||e.split(`
`).length>a2e}function w2e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v2e(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 x2e(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function _2e(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((s,i)=>i.length-s.length),r=new RegExp(n.map(w2e).join("|"),"g");return t.replace(r,s=>e.get(s)??s)}function Bg(e){var t,n;return((t=e.value)==null?void 0:t.trim())||((n=e.label)==null?void 0:n.trim())||e.id}function k2e(e){return e.map(Bg).join(`
`)}function Lk(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function jk(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function SB(e){return jk(e)||Lk(e)||e.id}function a4(e,t){const n=k2e(t);return n?e?`${n}

${e}`:n:e}const _3=qn.define({map:e=>e}),Dk=qn.define(),eu=qn.define();class S2e extends Aa{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=Lk(this.tag),s=jk(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 ${SB(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(Bd).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:Dk.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 T2e(e){const t={widget:new S2e(e.tag),inclusive:!1,tag:e.tag};return mn.replace(t).range(e.from,e.to)}const Bd=Ca.define({create(){return mn.none},update(e,t){let n=e.map(t.changes);for(const r of t.effects)r.is(_3)?n=n.update({add:[T2e(r.value)]}):r.is(Dk)?n=n.update({filter:(s,i,o)=>{const a=o.spec.tag;return a&&r.value.predicate?!r.value.predicate(a):!0}}):r.is(eu)&&(n=mn.none);return n},provide:e=>[yt.decorations.from(e),yt.atomicRanges.of(t=>t.state.field(e))]});function C2e(e){const t=[];return e.state.field(Bd).between(0,e.state.doc.length,(n,r,s)=>{const i=s.spec.tag;i&&t.push(i)}),t}const GC=new Yu,KC=new Yu,YC=new Yu;function tu(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function A2e(e,t){const n=tu(e,t);if(!n||e.length===0)return null;const r=n.slice(e.length);return r.length>0?r:null}class E2e extends Aa{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 XC(e){return vi.fromClass(class{constructor(t){le(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return mn.none;const n=t.state.selection.main,r=t.state.doc.toString(),s=A2e(r,e);return!s||!n.empty||n.head!==r.length?mn.none:mn.set([mn.widget({widget:new E2e(s),side:1}).range(r.length)])}},{decorations:t=>t.decorations})}function QC(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 M2e(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,currentMode:d="default",onFocusFooter:f,dialogOpen:m=!1,followupState:p,onAcceptFollowup:y,onDismissFollowup:v,sessionName:b,composerInput:w,composerInputVersion:x,editorTheme:k}=e,T=iN(),{language:A,t:M}=lt(),D=g.useRef(null),O=g.useRef(null),C=g.useRef(t);C.current=t;const L=g.useRef(n);L.current=n;const I=g.useRef(r);I.current=r;const B=g.useRef(s);B.current=s;const F=g.useRef(o);F.current=o;const W=g.useRef(a);W.current=a;const j=g.useRef(l);j.current=l;const K=g.useRef(M);K.current=M;const J=g.useRef(c);J.current=c;const ee=g.useRef(u);ee.current=u;const N=g.useRef(p);N.current=p;const q=g.useRef(y);q.current=y;const P=g.useRef(v);P.current=v;const E=g.useRef(f);E.current=f;const ne=g.useRef(A);ne.current=A;const pe=g.useRef(T==null?void 0:T.actions);pe.current=T==null?void 0:T.actions;const[be,xe]=g.useState(!1),we=g.useRef(be);we.current=be;const de=g.useCallback(()=>{var Q,ce,Ie;(Q=N.current)!=null&&Q.isVisible&&((ce=P.current)==null||ce.call(P)),xe(Qe=>!Qe),(Ie=O.current)==null||Ie.focus()},[]),[se,ae]=g.useState(!1),[_e,qe]=g.useState(""),[He,re]=g.useState([]),[ye,Te]=g.useState(0),ke=g.useRef(null),vt=g.useRef(null),rt=g.useRef(""),[Mt,Pt]=g.useState([]),Ze=g.useRef([]),bt=g.useRef(new Map),ft=g.useRef(1),[ie,H]=g.useState([]),oe=g.useRef([]);oe.current=ie;const De=g.useRef(w);De.current=w;const tt=g.useRef(()=>!0),Ct=g.useRef(null),[Et,Qt]=g.useState(null),on=g.useRef(null),he=g.useRef(!1),X=g.useCallback(Q=>{on.current=Q,Qt(Q)},[]),ue=g.useCallback((Q,ce)=>{var pn;if(!Q||B.current||we.current){X(null);return}if(he.current){X(null);return}const Ie=Q.state.selection.main;if(!Ie.empty){X(null);return}const Qe=qbe(Q.state.doc.toString(),Ie.head,F.current,W.current,ne.current,Pn=>K.current(Pn),j.current??a0);if(!Qe){X(null);return}const Kt=ce??((pn=on.current)==null?void 0:pn.selectedIndex)??0,Dt=Math.max(0,Math.min(Kt,Qe.items.length-1));X({...Qe,selectedIndex:Dt})},[X]),me=g.useCallback(()=>{X(null)},[X]),We=g.useCallback(Q=>{const ce=on.current;return!ce||Q<0||Q>=ce.items.length?!1:(ce.selectedIndex===Q||X({...ce,selectedIndex:Q}),!0)},[X]),At=g.useCallback(Q=>{const ce=on.current;if(!ce)return!1;const Ie=u2e(ce.selectedIndex,ce.items.length,Q);return Ie===null?!1:(X({...ce,selectedIndex:Ie}),!0)},[X]),jt=g.useCallback(Q=>{const ce=O.current,Ie=on.current;if(!ce||!Ie)return!1;const Qe=Ie.items[Q??Ie.selectedIndex];return Qe?(ce.dispatch({changes:{from:Ie.from,to:Ie.to,insert:Qe.apply},selection:{anchor:Ie.from+Qe.apply.length},scrollIntoView:!0}),ce.focus(),!0):!1},[]),[dt,Wt]=g.useState(!1);g.useEffect(()=>{const Q=O.current,ce=(Q==null?void 0:Q.state.doc.toString())??"",Ie=tu(ce,p!=null&&p.isVisible?p.suggestion:null);Wt(ce.trim().length>0||!!Ie||ie.length>0||Mt.length>0)},[ie,Mt,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]);const Rn=HC(),ln=HC("qwen-web-shell-command-history"),{push:xn,navigateUp:Ee,navigateDown:ht,isNavigating:en,reset:ns,getReverseMatches:ri,getLastEntry:Si,resetSearch:$o}=Rn,gr=g.useRef({push:xn,navigateUp:Ee,navigateDown:ht,isNavigating:en,reset:ns,getReverseMatches:ri,getLastEntry:Si,resetSearch:$o});gr.current={push:xn,navigateUp:Ee,navigateDown:ht,isNavigating:en,reset:ns,getReverseMatches:ri,getLastEntry:Si,resetSearch:$o};const Sr=g.useRef(ln);Sr.current=ln,Ze.current=Mt;const rs=g.useCallback(Q=>{const ce=we.current,Qe=(ce?Sr.current:gr.current).getReverseMatches(Q);return ce?Qe:Qe.filter(Kt=>!Kt.trimStart().startsWith("/"))},[]),fe=g.useCallback(()=>{if(B.current)return;const Q=O.current;if(!Q)return;me();const ce=Q.state.doc.toString();rt.current=ce,ae(!0),qe("");const Ie=we.current?Sr.current:gr.current;re(rs("")),Te(0),Ie.resetSearch(),setTimeout(()=>{var Qe;return(Qe=ke.current)==null?void 0:Qe.focus()},0)},[me,rs]),ze=g.useRef(fe);ze.current=fe;const St=g.useCallback(()=>{if(B.current)return;const Q=O.current;if(!Q)return;if(Ci(Q.state)==="active"){tc(!1)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const ce=we.current?Sr.current:gr.current,Ie=Q.state.doc.toString(),Qe=ce.navigateUp(Ie);Qe!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:Qe},selection:{anchor:Qe.length}}),Q.focus()},[]),sn=g.useCallback(()=>{if(B.current)return;const Q=O.current;if(!Q)return;if(Ci(Q.state)==="active"){tc(!0)(Q),Q.focus();return}if(Q.state.doc.lines>1){Q.focus();return}const Ie=(we.current?Sr.current:gr.current).navigateDown();Ie!==null&&Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:Ie},selection:{anchor:Ie.length}}),Q.focus()},[]);g.useEffect(()=>{var So,qo;if(!D.current)return;c2e();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 ce=/\b\S*theme(?:Dark|Light)\S*/gi,Ie=()=>{var Xe,Tt;let te=D.current,Ve=null;if(D.current){const _t=getComputedStyle(D.current);for(let qt=0;qt<_t.length;qt+=1){const Ot=_t[qt];Ot.startsWith("--")&&Q.style.setProperty(Ot,_t.getPropertyValue(Ot))}_t.getPropertyValue("--web-shell-tooltip-z-index").trim()||Q.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;te;){const _t=(Tt=(Xe=te.className)==null?void 0:Xe.match)==null?void 0:Tt.call(Xe,ce);if(_t){Ve=_t[0];break}te=te.parentElement}Ve&&(Q.className=Ve)};Ie(),document.body.appendChild(Q);const Qe=new MutationObserver(Ie);let Kt=D.current;for(;Kt&&(Qe.observe(Kt,{attributes:!0,attributeFilter:["class","style"]}),!((qo=(So=Kt.className)==null?void 0:So.match)!=null&&qo.call(So,ce)));)Kt=Kt.parentElement;const Dt=(te,Ve,Xe)=>{var Uo,Xi;const Tt=te.state.doc.toString(),_t=N.current,qt=Ve===void 0&&(_t!=null&&_t.isVisible)?tu(Tt,_t.suggestion):null,Ot=(Ve??qt??Tt).trim(),$n=Xe??oe.current;if(!Ot&&$n.length===0)return!0;const Wr=_2e(bt.current,Ot),Qn=a4(Wr,$n),Cn=Ze.current,_n=we.current;return C.current(_n?`!${Qn}`:Qn,Cn.length>0?[...Cn]:void 0)===!1||(X(null),qt&&((Uo=q.current)==null||Uo.call(q,"enter",{skipOnAccept:!0})),(Xi=P.current)==null||Xi.call(P),bt.current.clear(),ft.current=1,_n?(Sr.current.push(Wr),Sr.current.reset()):(gr.current.push(Wr),gr.current.reset()),he.current=!1,H([]),Pt([]),te.dispatch({changes:{from:0,to:te.state.doc.length,insert:""},effects:eu.of()})),!0};tt.current=Dt;const pn=[Ube(()=>{var te;return(te=pe.current)==null?void 0:te.globWorkspace},()=>{var te;return(te=pe.current)==null?void 0:te.loadExtensionsStatus})],Pn=te=>(te.dispatch(te.state.replaceSelection(`
`)),!0),or=(te,Ve)=>{var qt;const Xe=N.current,Tt=Xe==null?void 0:Xe.suggestion,_t=tu(te.state.doc.toString(),Tt);return!(Xe!=null&&Xe.isVisible)||!_t?!1:(te.dispatch({changes:{from:0,to:te.state.doc.length,insert:_t},selection:{anchor:_t.length},scrollIntoView:!0}),te.focus(),(qt=q.current)==null||qt.call(q,Ve,{skipOnAccept:!0}),!0)},Tn=r0.of([{key:"Backspace",run:te=>{var _t;const Ve=te.state.selection.main;if(!Ve.empty||Ve.from!==0)return!1;let Xe=!1;if(te.state.field(Bd).between(0,1,qt=>{qt===0&&(Xe=!0)}),Xe)return!1;let Tt=-1;for(let qt=oe.current.length-1;qt>=0;qt-=1)if(((_t=oe.current[qt])==null?void 0:_t.removable)!==!1){Tt=qt;break}return Tt<0?!1:(H(qt=>qt.filter((Ot,$n)=>$n!==Tt)),!0)}},{key:"Delete",run:te=>{const Ve=te.state.selection.main;if(!Ve.empty||Ve.from!==0)return!1;let Xe=!1;if(te.state.field(Bd).between(0,1,_t=>{_t===0&&(Xe=!0)}),Xe)return!1;const Tt=oe.current.findIndex(_t=>_t.removable!==!1);return Tt<0?!1:(H(_t=>_t.filter((qt,Ot)=>Ot!==Tt)),!0)}},{key:"Enter",run:te=>{var Tt;if(on.current)return jt();if(Ci(te.state)==="active")return!1;const Ve=N.current,Xe=tu(te.state.doc.toString(),Ve==null?void 0:Ve.suggestion);return Ve!=null&&Ve.isVisible&&Xe?((Tt=q.current)==null||Tt.call(q,"enter",{skipOnAccept:!0}),Dt(te,Xe)):Dt(te)}},{key:"Shift-Enter",run:Pn},{key:"Ctrl-j",run:Pn},{key:"Mod-Enter",run:Pn},{key:"Alt-Enter",run:Pn},{key:"Escape",run:()=>on.current?(me(),!0):we.current?(xe(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:te=>{var Ot;const Ve=we.current?Sr.current:gr.current;if(he.current)Og(te),me();else{if(At("up"))return!0;if(Ci(te.state)==="active")return tc(!1)(te)}const Tt=QC(te,"up");if(Tt==="handled")return!0;if(Tt==="editor")return!1;if(we.current){const $n=te.state.doc.toString(),Wr=Ve.navigateUp($n);return Wr===null||(he.current=!0,te.dispatch({changes:{from:0,to:te.state.doc.length,insert:Wr},selection:{anchor:Wr.length}})),!0}if(J.current.length>0&&(Ot=ee.current)!=null&&Ot.call(ee))return!0;const _t=te.state.doc.toString(),qt=Ve.navigateUp(_t);return qt===null?!1:(he.current=!0,te.dispatch({changes:{from:0,to:te.state.doc.length,insert:qt},selection:{anchor:qt.length}}),!0)}},{key:"ArrowDown",run:te=>{var qt;const Ve=we.current?Sr.current:gr.current;if(he.current)Og(te),me();else{if(At("down"))return!0;if(Ci(te.state)==="active")return tc(!0)(te)}const Tt=QC(te,"down");if(Tt==="handled")return!0;if(Tt==="editor")return!1;if(we.current){const Ot=Ve.navigateDown();return Ot===null||(he.current=Ve.isNavigating(),te.dispatch({changes:{from:0,to:te.state.doc.length,insert:Ot},selection:{anchor:Ot.length}})),!0}const _t=Ve.navigateDown();return _t===null?((qt=E.current)==null?void 0:qt.call(E))??!1:(he.current=Ve.isNavigating(),te.dispatch({changes:{from:0,to:te.state.doc.length,insert:_t},selection:{anchor:_t.length}}),!0)}},{key:"Ctrl-r",run:()=>(ze.current(),!0)},{key:"Tab",run:te=>{if(or(te,"tab"))return!0;if(on.current)return jt();if(Ci(te.state)==="active")return vB(te);const Ve=te.state.doc.toString(),Xe=$be(Ve,F.current,ne.current);if(Xe)return te.dispatch({changes:{from:0,to:te.state.doc.length,insert:Xe},selection:{anchor:Xe.length}}),!0;const Tt=Pbe(Ve,F.current);return Tt&&te.dispatch({changes:{from:0,to:te.state.doc.length,insert:Tt},selection:{anchor:Tt.length}}),!0}},{key:"ArrowRight",run:te=>!!(Ci(te.state)!=="active"&&or(te,"right"))},{key:"Shift-Tab",run:()=>{var te;return(te=L.current)==null||te.call(L),!0}}]),zs=yt.updateListener.of(te=>{if(te.docChanged&&bt.current.size>0){const Xe=x2e(bt.current,te.state.doc.toString());Xe!==null&&(ft.current=Xe)}te.transactions.some(Xe=>Xe.isUserEvent("input")||Xe.isUserEvent("delete"))&&(he.current=!1),(te.docChanged||te.selectionSet)&&ue(te.view)});let Yi=!1;const ms=yt.updateListener.of(te=>{const Ve=Ct.current,Xe=Ci(te.state)==="active";if(Ve){const Tt=te.state.doc;if(!(Tt.length===Ve.from+Ve.text.length&&Tt.sliceString(Ve.from)===Ve.text))Ct.current=null;else if(Yi&&!Xe){Ct.current=null;const{view:qt}=te,{from:Ot}=Ve;window.setTimeout(()=>{if(O.current!==qt)return;const $n=qt.state.doc;$n.length===Ot+Ve.text.length&&$n.sliceString(Ot)===Ve.text&&qt.dispatch({changes:{from:Ot,to:$n.length,insert:""}})},0)}}Yi=Xe,Xe||f2e(Q)}),ko=jn.create({doc:"",extensions:[Ku.highest(Tn),Lbe,$O(),r0.of([...pB,...UO]),Ibe({override:pn,activateOnTyping:!0,icons:!1,optionClass:te=>te.type==="file"?"cm-file-completion":Rk(te)?"cm-command-info-completion":"",addToOptions:[{render:g2e,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:(te,Ve,Xe,Tt,_t)=>{const qt=Tt.bottom-Tt.top,Ot=_t.bottom-Ve.bottom,$n=Ot>=qt||Ot>Ve.top,Wr=$n?"top":"bottom",Qn=$n?Xe.bottom-Ve.top:Ve.bottom-Xe.top;return{style:`${Wr}: ${Qn}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:te=>typeof te.apply=="string"&&te.apply.endsWith(" ")}),n1e({parent:Q}),KC.of(pC("")),YC.of(XC(null)),yt.lineWrapping,GC.of(yt.editable.of(!0)),s2e(()=>F.current,()=>ne.current),i2e,Bd,zs,ms,yt.updateListener.of(te=>{if(te.docChanged){const Ve=te.state.doc.toString(),Xe=N.current,Tt=tu(Ve,Xe!=null&&Xe.isVisible?Xe.suggestion:null);Wt(Ve.trim().length>0||!!Tt||oe.current.length>0||Ze.current.length>0)}}),yt.inputHandler.of((te,Ve,Xe,Tt)=>{var _t;return Tt==="!"&&te.state.doc.toString()===""&&Ci(te.state)!=="active"?(de(),!0):Tt==="?"&&te.state.doc.toString()===""&&Ci(te.state)!=="active"?((_t=I.current)==null||_t.call(I),!0):!1}),yt.domEventHandlers({blur(){return me(),!1},paste(te){var $n,Wr,Qn,Cn;const Ve=($n=te.clipboardData)==null?void 0:$n.items;if(!Ve)return!1;let Xe=!1;for(const _n of Ve)if(_n.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(_n.type)){Xe=!0;const To=_n.getAsFile();if(!To)continue;const Uo=_n.type,Xi=new FileReader;Xi.onload=()=>{const Qu=Xi.result.split(",")[1];Pt(Yh=>[...Yh,{data:Qu,media_type:Uo}])},Xi.readAsDataURL(To)}if(Xe)return te.preventDefault(),!0;const Tt=y2e(((Wr=te.clipboardData)==null?void 0:Wr.getData("text/plain"))??"");if(!Tt||!b2e(Tt))return!1;te.preventDefault(),si.state.doc.toString()===""&&((Qn=N.current)!=null&&Qn.isVisible)&&((Cn=P.current)==null||Cn.call(P));const{placeholderText:_t,nextPasteId:qt}=v2e(bt.current,ft.current,Tt);ft.current=qt;const Ot=si.state.selection.main;return si.dispatch({changes:{from:Ot.from,to:Ot.to,insert:_t},selection:{anchor:Ot.from+_t.length},scrollIntoView:!0}),!0}}),yt.theme(k)]}),si=new yt({state:ko,parent:D.current});O.current=si,si.focus();const Xu=si.state.doc.toString().trim();return Wt(Xu.length>0||oe.current.length>0||Ze.current.length>0),()=>{si.destroy(),O.current=null,Qe.disconnect(),Q.remove()}},[]),g.useEffect(()=>{const Q=O.current;Q&&(Q.dispatch({effects:GC.reconfigure(yt.editable.of(!s))}),s||Q.focus())},[s]),g.useEffect(()=>{const Q=O.current;if(!Q)return;const ce=!s&&(p!=null&&p.isVisible)&&p.suggestion?p.suggestion:null,Ie=ce??(be?M("editor.shellPlaceholder"):i);Q.dispatch({effects:[KC.reconfigure(pC(Ie)),YC.reconfigure(XC(ce))]})},[s,i,be,M,p==null?void 0:p.isVisible,p==null?void 0:p.suggestion]),g.useEffect(()=>{const Q=O.current;!Q||Ci(Q.state)!=="active"||(Og(Q),window.setTimeout(()=>{O.current===Q&&Zd(Q)},0))},[A]);const nn=[o.map(Q=>{var ce;return[Q.name,Q.description??"",Q.source??"",Q.displayCategory??"",Q.argumentHint??"",((ce=Q.subcommands)==null?void 0:ce.join(","))??""].join("\0")}).join(""),a.map(Q=>[Q.name,Q.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");g.useEffect(()=>{on.current&&ue(O.current)},[nn,A,ue]),g.useEffect(()=>{const Q=O.current;Q&&(m?(me(),Q.contentDOM.blur()):Q.focus())},[m,me]),g.useEffect(()=>{const Q=ce=>{var Tn,zs,Yi;if(B.current||se||m||ce.defaultPrevented)return;const Ie=ce.target,Qe=(Tn=D.current)==null?void 0:Tn.contains(Ie),Kt=document.activeElement===document.body;if(!Qe&&!Kt)return;const Dt=O.current,pn=N.current,Pn=tu((Dt==null?void 0:Dt.state.doc.toString())??"",pn==null?void 0:pn.suggestion);if(Dt&&!Dt.hasFocus&&(pn!=null&&pn.isVisible)&&Pn&&!Km(ce.target)){if(ce.key==="Tab"&&!ce.shiftKey&&!ce.metaKey&&!ce.ctrlKey&&!ce.altKey&&Ci(Dt.state)!=="active"){ce.preventDefault(),Dt.dispatch({changes:{from:0,to:Dt.state.doc.length,insert:Pn},selection:{anchor:Pn.length},scrollIntoView:!0}),Dt.focus(),(zs=q.current)==null||zs.call(q,"tab",{skipOnAccept:!0});return}if(ce.key==="ArrowRight"&&!ce.shiftKey&&!ce.metaKey&&!ce.ctrlKey&&!ce.altKey&&Ci(Dt.state)!=="active"){ce.preventDefault(),Dt.dispatch({changes:{from:0,to:Dt.state.doc.length,insert:Pn},selection:{anchor:Pn.length},scrollIntoView:!0}),Dt.focus(),(Yi=q.current)==null||Yi.call(q,"right",{skipOnAccept:!0});return}}if(ce.metaKey||ce.ctrlKey||ce.altKey||ce.key.length!==1||Km(ce.target)||!Dt||Dt.hasFocus)return;if(ce.preventDefault(),ce.key==="!"&&Dt.state.doc.toString()===""){de();return}const or=Dt.state.selection.main;Dt.dispatch({changes:{from:or.from,to:or.to,insert:ce.key},selection:{anchor:or.from+ce.key.length},scrollIntoView:!0}),Dt.focus(),ce.key==="/"?window.setTimeout(()=>{ue(O.current)},0):ce.key==="@"&&window.setTimeout(()=>{const ms=O.current;ms&&ms.hasFocus&&Zd(ms)},0)};return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[se,m,ue,de]);const yr=g.useCallback(()=>{var Q;(Q=O.current)==null||Q.focus()},[]),qr=g.useCallback((Q,ce)=>{const Ie=O.current;if(!Ie||!Q){Ie==null||Ie.focus();return}if((ce==null?void 0:ce.mode)==="replace"){Ie.dispatch({changes:{from:0,to:Ie.state.doc.length,insert:Q},effects:eu.of(),selection:{anchor:Q.length},scrollIntoView:!0}),Ie.focus();return}const Qe=Ie.state.selection.main;let Kt=Q,Dt=!1,pn=null;const Pn=Q==="@";let or=Q==="/";if(Q==="/")Ie.state.doc.lineAt(Qe.head).text.startsWith("/")?Dt=!0:Ie.state.doc.length>0&&(Dt=!0,or=!1);else if(Q==="@"){const Tn=Qe.from>0?Ie.state.doc.sliceString(Qe.from-1,Qe.from):"";Ie.state.doc.sliceString(Qe.from,Qe.from+1)==="@"?(Dt=!0,pn=Qe.from+1):Tn==="@"?Dt=!0:Tn&&!/\s/.test(Tn)&&(Kt=" @")}Dt?pn!==null&&Ie.dispatch({selection:{anchor:pn},scrollIntoView:!0}):(Ie.dispatch({changes:{from:Qe.from,to:Qe.to,insert:Kt},selection:{anchor:Qe.from+Kt.length},scrollIntoView:!0}),Pn&&(Ct.current={text:Kt,from:Qe.from})),Ie.focus(),or?window.setTimeout(()=>{ue(O.current)},0):Pn&&window.setTimeout(()=>{const Tn=O.current;Tn&&Tn.hasFocus&&Zd(Tn)},0)},[ue]),Ps=g.useCallback(()=>{var Q;return((Q=O.current)==null?void 0:Q.state.doc.toString())??""},[]),hr=g.useCallback(Q=>{const ce=O.current;ce&&(ce.dispatch({changes:{from:0,to:ce.state.doc.length,insert:Q},effects:eu.of(),selection:{anchor:Q.length},scrollIntoView:!0}),ce.focus())},[]),Gt=g.useCallback(Q=>{const ce=O.current;if(!ce)return;const Ie=[];ce.state.field(Bd).between(0,ce.state.doc.length,(Qe,Kt,Dt)=>{const pn=Dt.spec.tag;pn&&(!Q||Q(pn))&&Ie.push({from:Qe,to:Kt,insert:""})}),ce.dispatch({...Ie.length>0?{changes:Ie}:{},effects:Dk.of({predicate:Q}),scrollIntoView:!0})},[]),rn=g.useCallback(Q=>{const ce=(Q==null?void 0:Q.text)??!0,Ie=(Q==null?void 0:Q.tags)??!0,Qe=O.current;ce&&Qe&&Qe.state.doc.length>0&&Qe.dispatch({changes:{from:0,to:Qe.state.doc.length,insert:""},effects:eu.of()}),ce&&(Pt([]),bt.current.clear(),ft.current=1),Ie&&(H([]),ce||Gt())},[Gt]),Ur=g.useCallback(()=>{rn({text:!0,tags:!1})},[rn]),$s=g.useCallback((Q,ce)=>{if(Q.length!==0){if((ce==null?void 0:ce.placement)==="inline"){const Ie=O.current;if(!Ie)return;const Qe=Ie.state.selection.main;let Kt=Qe.from;const Dt=[],pn=Q.map(or=>{const Tn=Bg(or);return Dt.push({from:Kt,to:Kt+Tn.length,tag:or}),Kt+=Tn.length+1,Tn}).join(" "),Pn=pn?`${pn} `:"";Ie.dispatch({changes:{from:Qe.from,to:Qe.to,insert:Pn},effects:Dt.length>0?Dt.map(or=>_3.of(or)):void 0,selection:{anchor:Qe.from+Pn.length},scrollIntoView:!0}),Ie.focus();return}H(Ie=>{const Qe=[...Ie];for(const Kt of Q){const Dt=Qe.findIndex(pn=>pn.id===Kt.id);Dt>=0?Qe[Dt]=Kt:Qe.push(Kt)}return Qe})}},[]),Hr=g.useCallback(Q=>{H(ce=>ce.filter(Ie=>Ie.id!==Q||Ie.removable===!1)),Gt(ce=>ce.id===Q&&ce.removable!==!1)},[Gt]),br=g.useCallback(()=>{var Q;return(((Q=O.current)==null?void 0:Q.state.doc.toString().trim().length)??0)>0||oe.current.length>0||Ze.current.length>0},[]),xt=g.useCallback(Q=>{const ce=O.current;if(!ce)return;const Ie=C2e(ce);if((Q==null?void 0:Q.tagPlacement)==="inline"){tt.current(ce,a4(Q.text??"",Q.tags??Ie),[]);return}if((Q==null?void 0:Q.text)!==void 0&&Q.tags===void 0&&Ie.length>0){tt.current(ce,a4(Q.text,Ie),[]);return}tt.current(ce,Q==null?void 0:Q.text,Q?Q.tags??[]:void 0)},[]),Ea=g.useCallback(()=>{const Q=gr.current.getLastEntry(Ie=>!Ie.startsWith("/")&&!Ie.startsWith("!"));!Q||C.current(Q)===!1||Pt([])},[]),ss=g.useCallback(Q=>{const ce=O.current;ce&&ce.dispatch({changes:{from:0,to:ce.state.doc.length,insert:Q},selection:{anchor:Q.length},scrollIntoView:!0})},[]);g.useEffect(()=>{const Q=De.current;if(!Q)return;const ce=O.current;if(!ce)return;const Ie=Q.tagPlacement??"top";if(Q.tags!==void 0&&Ie==="top"&&H([...Q.tags]),Q.text!==void 0||Ie==="inline"){const Kt=Ie==="inline"?[...Q.tags??[]]:[],Dt=Kt.map(Bg).join(" "),pn=Ie==="inline"?Dt&&Q.text?`${Dt} ${Q.text}`:Dt||(Q.text??""):Q.text??"",Pn=[eu.of()];if(Kt.length>0){let or=0;for(const Tn of Kt){const zs=Bg(Tn);Pn.push(_3.of({from:or,to:or+zs.length,tag:Tn})),or+=zs.length+1}}ce.dispatch({changes:{from:0,to:ce.state.doc.length,insert:pn},effects:Pn,selection:{anchor:pn.length},scrollIntoView:!0})}else ce.dispatch({effects:eu.of()});(Q.text!==void 0||Q.submit)&&ce.focus();let Qe=null;return Q.submit&&(Qe=window.setTimeout(()=>{O.current&&xt(Q)},0)),()=>{Qe!==null&&window.clearTimeout(Qe)}},[x,xt]);const Vr=g.useCallback((Q,ce=!0)=>{var Qe;Q&&ss(rt.current),ae(!1),qe(""),re([]),Te(0),(we.current?Sr.current:gr.current).resetSearch(),ce&&((Qe=O.current)==null||Qe.focus())},[ss]);g.useEffect(()=>{if(!se)return;const Q=ce=>{if(ce instanceof MouseEvent&&ce.button!==0||ce.defaultPrevented)return;const Ie=vt.current,Qe=ce.target;Ie&&Qe instanceof Node&&!Ie.contains(Qe)&&Vr(!0,!1)};return window.addEventListener("mousedown",Q),window.addEventListener("touchstart",Q),()=>{window.removeEventListener("mousedown",Q),window.removeEventListener("touchstart",Q)}},[se,Vr]);const Cs=g.useCallback(Q=>{var pn;if(!O.current)return;Vr(!1);const Ie=Q.trim();if(!Ie)return;const Qe=Ze.current,Kt=we.current;if(C.current(Kt?`!${Ie}`:Ie,Qe.length>0?[...Qe]:void 0)===!1){ss(Q);return}(pn=P.current)==null||pn.call(P),Kt?(Sr.current.push(Ie),Sr.current.reset()):(gr.current.push(Ie),gr.current.reset()),Pt([]),ss("")},[Vr,ss]),Kh=Q=>{if(!Q.nativeEvent.isComposing)if(Q.key==="Escape")Q.preventDefault(),Vr(!0);else if(Q.key==="Tab"){Q.preventDefault();const ce=He[ye];ce&&ss(ce),Vr(!1)}else if(Q.key==="Enter"){Q.preventDefault();const ce=He[ye];ce?Cs(ce):Vr(!1)}else Q.key==="r"&&Q.ctrlKey&&(Q.preventDefault(),He.length>0&&Te(ce=>(ce+1)%He.length))},zo=Q=>{const ce=we.current?Sr.current:gr.current;re(rs(Q)),Te(0),ce.resetSearch()},Ma=Q=>{const ce=Q.target.value;qe(ce),!Q.nativeEvent.isComposing&&zo(ce)},Fo=Q=>{const ce=Q.currentTarget.value;qe(ce),zo(ce)},Xn=g.useCallback(Q=>{Pt(ce=>ce.filter((Ie,Qe)=>Qe!==Q))},[]),Ki=!be&&!se&&!(p!=null&&p.isVisible)&&!s&&!m,Ia={clearText:Ur,clear:rn,focus:yr,getText:Ps,hasInput:br,setText:hr,addTags:$s,removeTag:Hr,insertText:qr,retryLast:Ea,restoreImages:Q=>{Pt(ce=>[...ce,...Q])},submit:xt};return{containerRef:D,viewRef:O,focus:yr,submitText:g.useCallback(()=>{const Q=O.current;Q&&tt.current(Q)},[]),clearText:Ur,getText:Ps,hasInput:br,hasContent:dt,handle:Ia,pastedImages:Mt,removeImage:Xn,composerTags:ie,removeTopTag:Hr,addTags:$s,removeInlineTags:Gt,insertText:qr,setText:hr,submit:xt,clear:rn,retryLast:Ea,replaceEditorText:ss,shellMode:be,setShellMode:xe,toggleShellMode:de,currentMode:d,sessionName:b,searchState:{searchMode:se,searchQuery:_e,searchMatches:He,searchActiveIndex:ye,searchInputRef:ke,searchUiRef:vt,openHistorySearch:fe,closeSearch:Vr,submitSearchMatch:Cs,handleSearchKeyDown:Kh,handleSearchInput:Ma,handleSearchCompositionEnd:Fo},navigatePrevHistory:St,navigateNextHistory:sn,showShortcutHints:Ki,followupState:p,disabled:s,onAcceptFollowup:y,onDismissFollowup:v,slashMenu:Et,closeSlashMenu:me,selectSlashCompletion:We,acceptSlashCompletion:jt}}const I2e="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",N2e="/assets/default-aEtf0G7-.svg",TB="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",R2e="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",L2e="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 Uf(e,t){return{[e]:`url("${t}")`}}const j2e="_icon_i7y0u_1",D2e={icon:j2e},O2e={auto:I2e,"auto-edit":TB,default:N2e,plan:R2e,yolo:L2e};function k3({mode:e}){const t=O2e[e];return t?h.jsx("span",{className:D2e.icon,style:Uf("--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 ay(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const l4=16e3,B2e=4096,JC=6e4;function P2e(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 $2e="qwen-bearer.",z2e="qwen-ws";function F2e(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`${$2e}${r}`}function q2e(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 U2e(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 H2e(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 w=g.useRef(s);w.current=s;const x=g.useCallback(I=>{v.current=I,o(I)},[]),k=g.useCallback(()=>{const I=m.current;I.transcribeTimeout&&(clearTimeout(I.transcribeTimeout),I.transcribeTimeout=void 0)},[]),T=g.useCallback(()=>{var B;const I=m.current;I.processor&&(I.processor.onaudioprocess=null);for(const F of[I.processor,I.source,I.sink])try{F==null||F.disconnect()}catch{}(B=I.stream)==null||B.getTracks().forEach(F=>F.stop()),I.context&&I.context.state!=="closed"&&I.context.close().catch(()=>{}),I.processor=void 0,I.sink=void 0,I.source=void 0,I.stream=void 0,I.context=void 0},[]),A=g.useCallback(()=>{y.current++,T();const I=m.current;if(k(),I.ws){try{I.ws.onmessage=null,I.ws.onerror=null,I.ws.onclose=null,I.ws.close()}catch{}I.ws=void 0}},[T,k]),M=g.useCallback((I,B)=>{var F;!p.current||B!==void 0&&y.current!==B||(A(),x("error"),l(""),u(0),f(I),(F=w.current)==null||F.call(w,I))},[A,x]),D=g.useCallback((I,B)=>{B!==void 0&&y.current!==B||(A(),p.current&&(x("idle"),l(""),u(0),b.current(I)))},[A,x]),O=g.useCallback(()=>{if(v.current!=="idle"&&v.current!=="error")return;f(void 0),l(""),x("connecting");const I=++y.current,B=()=>!p.current||y.current!==I;(async()=>{var F;try{if(!((F=navigator.mediaDevices)!=null&&F.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 W;try{W=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(q){throw new Error(q2e(q))}if(B()){W.getTracks().forEach(q=>q.stop());return}m.current.stream=W;const j=new AudioContext({sampleRate:l4});if(j.sampleRate!==l4)throw W.getTracks().forEach(q=>q.stop()),j.close().catch(()=>{}),new Error(`Browser audio rate ${j.sampleRate} Hz is not the required ${l4} Hz.`);if(m.current.context=j,j.state==="suspended"&&await j.resume(),B()){W.getTracks().forEach(q=>q.stop()),j.close().catch(()=>{});return}const K=j.createMediaStreamSource(W),J=j.createScriptProcessor(B2e,1,1),ee=j.createGain();ee.gain.value=0,m.current.source=K,m.current.processor=J,m.current.sink=ee;const N=new WebSocket(P2e(t),n?[z2e,F2e(n)]:void 0);N.binaryType="arraybuffer",m.current.ws=N,J.onaudioprocess=q=>{const{pcm:P,level:E}=U2e(q.inputBuffer.getChannelData(0));p.current&&u(E),N.readyState===WebSocket.OPEN&&N.send(P)},N.onopen=()=>{if(B()){J.onaudioprocess=null;for(const P of[J,K,ee])try{P.disconnect()}catch{}W.getTracks().forEach(P=>P.stop()),j.state!=="closed"&&j.close().catch(()=>{});const q=m.current;q.ws===N&&(q.ws=void 0),q.processor===J&&(q.processor=void 0),q.source===K&&(q.source=void 0),q.sink===ee&&(q.sink=void 0),q.stream===W&&(q.stream=void 0),q.context===j&&(q.context=void 0);try{N.close()}catch{}return}N.send(JSON.stringify({type:"start"})),K.connect(J),J.connect(ee),ee.connect(j.destination),k(),m.current.transcribeTimeout=setTimeout(()=>{v.current==="recording"&&M("No response from server. Check that the voice model is running.",I)},JC),p.current&&x("recording")},N.onmessage=q=>{(v.current==="connecting"||v.current==="recording")&&k();let P;try{P=JSON.parse(String(q.data))}catch{return}P.type==="interim"?p.current&&l(P.text??""):P.type==="final"?D(P.text??"",I):P.type==="error"&&M(P.message??P.text??"Voice transcription failed.",I)},N.onerror=()=>{},N.onclose=q=>{if(p.current&&(v.current==="recording"||v.current==="connecting"||v.current==="transcribing")){const P=q.code||1006,E=q.reason||"none";M(`Voice connection closed (code=${P}, reason=${E}).`,I)}}}catch(W){M(W instanceof Error?W.message:String(W),I)}})()},[t,n,M,D,x,k]),C=g.useCallback(()=>{const I=m.current.ws;if(!I||I.readyState!==WebSocket.OPEN){A(),x("idle");return}T(),u(0),x("transcribing");const B=y.current;try{I.send(JSON.stringify({type:"stop"})),k(),m.current.transcribeTimeout=setTimeout(()=>{v.current==="transcribing"&&M("Transcription timed out.",B)},JC)}catch{M("Failed to finalize voice transcription.",B)}},[A,T,M,x,k]),L=g.useCallback(()=>{const I=m.current.ws;if(I&&I.readyState===WebSocket.OPEN)try{I.send(JSON.stringify({type:"abort"}))}catch{}A(),x("idle"),l(""),u(0)},[A,x]);return g.useEffect(()=>(p.current=!0,()=>{p.current=!1,A()}),[A]),{status:i,interimText:a,audioLevel:c,errorMessage:d,start:O,stop:C,abort:L}}const V2e="_root_9hwm9_7",W2e="_iconBtn_9hwm9_14",G2e="_error_9hwm9_47",K2e="_connecting_9hwm9_51",Y2e="_pill_9hwm9_56",X2e="_transcribing_9hwm9_75",Q2e="_recDot_9hwm9_79",J2e="_wave_9hwm9_88",Z2e="_bar_9hwm9_95",ewe="_time_9hwm9_103",twe="_stop_9hwm9_111",nwe="_spinner_9hwm9_118",rwe="_interim_9hwm9_128",As={root:V2e,iconBtn:W2e,error:G2e,connecting:K2e,pill:Y2e,transcribing:X2e,recDot:Q2e,wave:J2e,bar:Z2e,time:ewe,stop:twe,spinner:nwe,interim:rwe},swe="voice_transcribe",ZC=16,iwe=()=>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"})]}),owe=()=>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 awe(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=String(t%60).padStart(2,"0");return`${n}:${r}`}function lwe({onInsert:e,disabled:t}){var C;const n=H_(),r=((C=n.capabilities)==null?void 0:C.features)??[],[s,i]=g.useState(void 0),{status:o,interimText:a,audioLevel:l,errorMessage:c,start:u,stop:d,abort:f}=H2e({baseUrl:n.baseUrl,token:n.token,onFinal:L=>{const I=L.trim();I?(i(void 0),e(I)):i("No speech detected.")}}),m=o==="recording",[p,y]=g.useState(()=>new Array(ZC).fill(0));g.useEffect(()=>{if(!m){y(new Array(ZC).fill(0));return}y(L=>[...L.slice(1),Math.min(1,l*8)])},[l,m]);const[v,b]=g.useState(0);if(g.useEffect(()=>{if(!m){b(0);return}const L=performance.now(),I=setInterval(()=>b(performance.now()-L),200);return()=>clearInterval(I)},[m]),!r.includes(swe))return null;const w=o==="connecting",x=o==="transcribing",k=o==="error",T=!!s&&!k,A=m||w,M=m?"Stop dictation":x?"Transcribing…":w?"Starting…":k?`Voice error — click to retry${c?`: ${c}`:""}`:T?"No speech detected — click to retry":"Start voice dictation";let D;if(m)D=h.jsxs("button",{type:"button",className:As.pill,onClick:()=>d(),"aria-label":M,title:M,children:[h.jsx("span",{className:As.recDot,"aria-hidden":"true"}),h.jsx("span",{className:As.wave,"aria-hidden":"true",children:p.map((L,I)=>h.jsx("span",{className:As.bar,style:{height:`${2+Math.round(L*14)}px`}},I))}),h.jsx("span",{className:As.time,children:awe(v)}),h.jsx("span",{className:As.stop,"aria-hidden":"true",children:h.jsx(owe,{})})]});else if(x)D=h.jsxs("span",{className:`${As.pill} ${As.transcribing}`,role:"status","aria-label":M,children:[h.jsx("span",{className:As.spinner,"aria-hidden":"true"}),h.jsx("span",{className:As.time,children:"…"})]});else{const L=[As.iconBtn,k?As.error:"",w?As.connecting:""].filter(Boolean).join(" ");D=h.jsx("button",{type:"button",className:L,onClick:()=>{if(w)f();else{if(t)return;i(void 0),u()}},disabled:!!t&&!A,"aria-label":M,title:c??s??M,children:h.jsx(iwe,{})})}const O=m&&a||k||T;return h.jsxs("span",{className:As.root,children:[D,O&&h.jsx("span",{role:"status","aria-live":"polite",className:`${As.interim}${k?` ${As.error}`:""}`,children:k?c||"Voice error":T?s:a})]})}const cwe="_editorShell_ywag1_1",uwe="_container_ywag1_7",dwe="_content_ywag1_22",hwe="_dacAura_ywag1_35",fwe="_dacHalo_ywag1_36",mwe="_slashPortalLayer_ywag1_177",pwe="_slashPanel_ywag1_181",gwe="_slashPanelBody_ywag1_219",ywe="_slashList_ywag1_225",bwe="_slashEntry_ywag1_253",wwe="_slashSection_ywag1_259",vwe="_slashItem_ywag1_265",xwe="_slashItemActive_ywag1_286",_we="_slashCommand_ywag1_290",kwe="_slashDetail_ywag1_295",Swe="_slashDetailCommand_ywag1_314",Twe="_slashDetailText_ywag1_324",Cwe="_slashDescription_ywag1_344",Awe="_tags_ywag1_373",Ewe="_tag_ywag1_373",Mwe="_tagLabel_ywag1_394",Iwe="_tagValue_ywag1_395",Nwe="_tagRemove_ywag1_413",Rwe="_editorArea_ywag1_433",Lwe="_shellPrefix_ywag1_448",jwe="_toolbar_ywag1_485",Dwe="_toolbarLeading_ywag1_494",Owe="_toolbarStart_ywag1_495",Bwe="_toolbarEnd_ywag1_496",Pwe="_toolbarLeft_ywag1_497",$we="_toolbarRight_ywag1_498",zwe="_toolbarRightCustom_ywag1_526",Fwe="_toolBtn_ywag1_533",qwe="_toolBtnText_ywag1_539",Uwe="_dropdownWrapper_ywag1_544",Hwe="_dropdown_ywag1_544",Vwe="_dropdownRich_ywag1_566",Wwe="_dropdownCheck_ywag1_572",Gwe="_dropdownItem_ywag1_578",Kwe="_dropdownItemActive_ywag1_616",Ywe="_dropdownItemIcon_ywag1_621",Xwe="_dropdownItemCheck_ywag1_622",Qwe="_dropdownItemContent_ywag1_639",Jwe="_dropdownItemLabel_ywag1_646",Zwe="_dropdownItemDesc_ywag1_656",e4e="_toolBtnIcon_ywag1_714",t4e="_widthModeBtn_ywag1_730",n4e="_quickActionsBtn_ywag1_739",r4e="_toolBtnModeIcon_ywag1_748",s4e="_toolBtnModelIcon_ywag1_749",i4e="_toolBtnArrow_ywag1_776",o4e="_chevronDown_ywag1_789",a4e="_quickActionsPanel_ywag1_798",l4e="_quickActionsHeader_ywag1_811",c4e="_quickActionsLayout_ywag1_818",u4e="_quickActionsGrid_ywag1_825",d4e="_quickAction_ywag1_739",h4e="_quickActionLabel_ywag1_856",f4e="_quickKeysGrid_ywag1_871",m4e="_quickKey_ywag1_871",p4e="_quickKeyLabel_ywag1_900",g4e="_sendBtn_ywag1_913",y4e="_sendBtnRunning_ywag1_951",b4e="_sendIcon_ywag1_964",w4e="_stopIcon_ywag1_970",v4e="_loadingIcon_ywag1_977",x4e="_sendBtnArmed_ywag1_989",_4e="_escLabel_ywag1_1057",k4e="_srOnly_ywag1_1065",S4e="_images_ywag1_1087",T4e="_imageThumb_ywag1_1094",C4e="_imageRemove_ywag1_1109",A4e="_searchPanel_ywag1_1130",E4e="_searchBar_ywag1_1147",M4e="_searchLabel_ywag1_1155",I4e="_searchInput_ywag1_1160",N4e="_searchResults_ywag1_1174",R4e="_searchResult_ywag1_1174",L4e="_searchResultActive_ywag1_1207",j4e="_searchResultMarker_ywag1_1212",D4e="_searchResultText_ywag1_1217",O4e="_searchEmpty_ywag1_1224",$e={editorShell:cwe,container:uwe,content:dwe,dacAura:hwe,dacHalo:fwe,slashPortalLayer:mwe,slashPanel:pwe,slashPanelBody:gwe,slashList:ywe,slashEntry:bwe,slashSection:wwe,slashItem:vwe,slashItemActive:xwe,slashCommand:_we,slashDetail:kwe,slashDetailCommand:Swe,slashDetailText:Twe,slashDescription:Cwe,tags:Awe,tag:Ewe,tagLabel:Mwe,tagValue:Iwe,tagRemove:Nwe,editorArea:Rwe,shellPrefix:Lwe,toolbar:jwe,toolbarLeading:Dwe,toolbarStart:Owe,toolbarEnd:Bwe,toolbarLeft:Pwe,toolbarRight:$we,toolbarRightCustom:zwe,toolBtn:Fwe,toolBtnText:qwe,dropdownWrapper:Uwe,dropdown:Hwe,dropdownRich:Vwe,dropdownCheck:Wwe,dropdownItem:Gwe,dropdownItemActive:Kwe,dropdownItemIcon:Ywe,dropdownItemCheck:Xwe,dropdownItemContent:Qwe,dropdownItemLabel:Jwe,dropdownItemDesc:Zwe,toolBtnIcon:e4e,widthModeBtn:t4e,quickActionsBtn:n4e,toolBtnModeIcon:r4e,toolBtnModelIcon:s4e,toolBtnArrow:i4e,chevronDown:o4e,quickActionsPanel:a4e,quickActionsHeader:l4e,quickActionsLayout:c4e,quickActionsGrid:u4e,quickAction:d4e,quickActionLabel:h4e,quickKeysGrid:f4e,quickKey:m4e,quickKeyLabel:p4e,sendBtn:g4e,sendBtnRunning:y4e,sendIcon:b4e,stopIcon:w4e,loadingIcon:v4e,sendBtnArmed:x4e,escLabel:_4e,srOnly:k4e,images:S4e,imageThumb:T4e,imageRemove:C4e,searchPanel:A4e,searchBar:E4e,searchLabel:M4e,searchInput:I4e,searchResults:N4e,searchResult:R4e,searchResultActive:L4e,searchResultMarker:j4e,searchResultText:D4e,searchEmpty:O4e},B4e=["approvalMode","model","widthMode","voice"],P4e=new Set(B4e),$4e={"&":{fontSize:"14px",background:"transparent",border:"none"},"&.cm-focused":{outline:"none"},".cm-scroller":{maxHeight:"var(--chat-editor-input-max-height, 300px)",overflowX:"hidden",overflowY:"auto"},".cm-content":{padding:"0",fontFamily:"var(--font-sans, system-ui, sans-serif)",color:"var(--chat-editor-text-primary, #e0e0e0)",caretColor:"var(--chat-editor-accent-color, #4a9eff)",fontSize:"14px",lineHeight:"1.6"},".cm-line":{padding:"0"},".cm-placeholder":{color:"var(--chat-editor-text-dimmed, #666)"},".cm-followup-ghost":{color:"var(--chat-editor-text-dimmed, #666)",opacity:"0.72",pointerEvents:"none",userSelect:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"var(--chat-editor-selection-bg) !important"},"&.cm-focused .cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-content ::selection":{backgroundColor:"var(--chat-editor-selection-bg)",color:"var(--chat-editor-selection-color)"},".cm-cursor":{borderLeftColor:"var(--chat-editor-accent-color, #4a9eff)",borderLeftWidth:"2px"}};function eA(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}const z4e=["--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 F4e(){return h.jsx("svg",{className:$e.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 q4e(){return h.jsx("span",{className:$e.stopIcon,"aria-hidden":"true"})}function U4e(){return h.jsx("span",{className:$e.loadingIcon,"aria-hidden":"true"})}function H4e(){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 V4e(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 w=performance.now(),x=k=>{const T=Math.min((k-w)/220,1);o=v+b*(1-(1-T)**2),l(o,a),n=T<1?window.requestAnimationFrame(x):void 0};n=window.requestAnimationFrame(x)},u=()=>{r!==void 0&&window.cancelAnimationFrame(r);const y=a,v=performance.now(),b=w=>{const x=Math.min((w-v)/300,1);a=y*(1-x),l(o,a),r=x<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 W4e({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 tA(){return h.jsx("span",{className:$e.chevronDown,"aria-hidden":"true"})}function G4e(){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 K4e(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 Y4e=[{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 X4e(){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 CB(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 Q4e(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]??CB(e,t)}function nA({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:`${$e.dropdown} ${c?$e.dropdownRich:o?$e.dropdownCheck:""}`,style:a?{maxHeight:a,overflowY:"auto"}:void 0,children:t.map(d=>h.jsx("button",{type:"button",className:`${$e.dropdownItem} ${d.id===n?$e.dropdownItemActive:""}`,onMouseDown:f=>{f.preventDefault(),s(d.id)},children:u?h.jsxs(h.Fragment,{children:[c&&h.jsx("span",{className:$e.dropdownItemIcon,children:d.icon}),h.jsxs("span",{className:$e.dropdownItemContent,children:[h.jsx("span",{className:$e.dropdownItemLabel,children:d.label}),d.description&&h.jsx("span",{className:$e.dropdownItemDesc,children:d.description})]}),h.jsx("span",{className:$e.dropdownItemCheck,children:d.id===n?h.jsx(X4e,{}):null})]}):d.label},d.id))})}function J4e({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 M=k.getBoundingClientRect(),D=getComputedStyle(k),O=Object.fromEntries(z4e.map(C=>[C,D.getPropertyValue(C)]));a({left:Math.max(12,Math.min(M.left+16,window.innerWidth-252)),bottom:window.innerHeight-M.top+8,width:M.width}),c(O)};T();const A=new ResizeObserver(T);return A.observe(k),window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{A.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 w;if(!o)return null;const x={...b,...l,left:o.left,bottom:o.bottom,"--slash-anchor-width":`${o.width}px`};return fy.createPortal(h.jsxs("div",{ref:n,className:$e.slashPortalLayer,style:l,children:[h.jsx("div",{className:$e.slashPanel,style:x,role:"listbox",onMouseDown:k=>k.preventDefault(),onMouseLeave:k=>{var A;const T=k.relatedTarget;T instanceof Node&&((A=f.current)!=null&&A.contains(T))||d(null)},children:h.jsx("div",{className:$e.slashPanelBody,children:h.jsx("div",{className:$e.slashList,onScroll:()=>d(null),children:e.items.map((k,T)=>{const A=k.section,M=e.kind==="command"&&T>0&&A!==void 0&&A!==w;return w=A??w,h.jsxs("div",{className:$e.slashEntry,children:[M&&h.jsx("div",{className:$e.slashSection}),h.jsxs("button",{ref:D=>{i.current[T]=D},type:"button",role:"option","aria-selected":T===e.selectedIndex,className:`${$e.slashItem} ${T===e.selectedIndex?$e.slashItemActive:""}`,onMouseEnter:D=>{if(r(T),!k.detail){d(null);return}const O=D.currentTarget,C=8,L=180,I=O.getBoundingClientRect(),F=Math.min(I.left+Math.min(220,I.width*.34),window.innerWidth-320-12),W=window.innerHeight-I.bottom-C-12,j=I.top-C-12,K=W>=96||W>=j,J=Math.max(72,Math.min(L,K?W:j));d({label:k.label,detail:k.detail,left:Math.max(12,F),...K?{top:I.bottom+C}:{bottom:window.innerHeight-I.top+C},maxHeight:J})},onMouseDown:D=>{D.preventDefault(),D.stopPropagation(),s(T)},children:[h.jsx("span",{className:$e.slashCommand,children:k.label}),k.detail&&h.jsx("span",{className:$e.slashDescription,children:k.detail})]})]},`${k.id}:${T}`)})})})}),u&&h.jsxs("div",{ref:f,className:$e.slashDetail,style:{...l,left:u.left,top:u.top,bottom:u.bottom,maxHeight:u.maxHeight},children:[h.jsx("div",{className:$e.slashDetailCommand,children:u.label}),h.jsx("div",{className:$e.slashDetailText,children:u.detail})]})]}),document.body)}function Z4e({actions:e,onRun:t,onPressKey:n}){const{t:r}=lt();return h.jsxs("div",{className:$e.quickActionsPanel,onMouseDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),children:[h.jsx("div",{className:$e.quickActionsHeader,children:r("quickActions.title")}),h.jsxs("div",{className:$e.quickActionsLayout,children:[h.jsx("div",{className:$e.quickActionsGrid,children:e.map(s=>h.jsx("button",{type:"button",className:$e.quickAction,onClick:()=>t(s),children:h.jsx("span",{className:$e.quickActionLabel,children:s.label})},s.id))}),h.jsx("div",{className:$e.quickKeysGrid,children:Y4e.map(s=>h.jsx("button",{type:"button",className:$e.quickKey,title:r(s.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(s),children:h.jsx("span",{className:$e.quickKeyLabel,children:s.label})},s.id))})]})]})}const eve=g.memo(g.forwardRef(function(t,n){const{onSubmit:r,onCycleMode:s,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,isPreparing:l=!1,cancelArmed:c=!1,disabled:u=!1,placeholderText:d="Type a message...",commands:f,skills:m=[],slashCommandCategoryOrder:p,queuedMessages:y=[],onPopQueuedMessages:v,currentMode:b="default",currentModel:w="",chatWidthMode:x="1000",showChatWidthToggle:k=!0,chatWidthToggleMin:T,visibleToolbarActions:A,availableModels:M=[],onSelectMode:D,onSelectModel:O,onChatWidthModeChange:C,onFocusFooter:L,dialogOpen:I=!1,followupState:B,onAcceptFollowup:F,onDismissFollowup:W,sessionName:j,composerInput:K,composerInputVersion:J}=t,ee=M2e({onSubmit:r,onCycleMode:s,onToggleShortcuts:i,disabled:u,placeholderText:d,commands:f,skills:m,slashCommandCategoryOrder:p,queuedMessages:y,onPopQueuedMessages:v,currentMode:b,onFocusFooter:L,dialogOpen:I,followupState:B,onAcceptFollowup:F,onDismissFollowup:W,sessionName:j,composerInput:K,composerInputVersion:J,editorTheme:$4e}),{t:N}=lt(),{renderComposerToolbarStart:q,renderComposerToolbarEnd:P,renderComposerToolbarRight:E}=Lc();g.useImperativeHandle(n,()=>ee.handle,[ee.handle]);const[ne,pe]=g.useState(!1),[be,xe]=g.useState(!1),[we,de]=g.useState(!1),[se,ae]=g.useState(eA),_e=g.useRef(null),qe=g.useRef(null),He=g.useRef(null),re=g.useRef(null),[ye,Te]=g.useState(!1),ke=ee.slashMenu,vt=ee.closeSlashMenu,rt=ee.viewRef;g.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Ee=window.matchMedia("(hover: none), (pointer: coarse)"),ht=()=>ae(eA());return ht(),Ee.addEventListener("change",ht),()=>Ee.removeEventListener("change",ht)},[]),g.useEffect(()=>{se||de(!1)},[se]),g.useEffect(()=>{if(!ke)return;const Ee=ht=>{var ri;const en=ht.target,ns=_e.current;en instanceof Node&&ns&&!ns.contains(en)&&!((ri=qe.current)!=null&&ri.contains(en))&&vt()};return window.addEventListener("mousedown",Ee),window.addEventListener("touchstart",Ee),()=>{window.removeEventListener("mousedown",Ee),window.removeEventListener("touchstart",Ee)}},[ke,vt]),g.useEffect(()=>{var en;const Ee=_e.current,ht=(en=rt.current)==null?void 0:en.contentDOM;if(!(!Ee||!ht))return V4e(Ee,ht)},[rt]),g.useEffect(()=>{const Ee=_e.current,ht=T;if(!Ee||ht===void 0){Te(!1);return}const en=()=>{Te(Ee.getBoundingClientRect().width>=ht-50)};en();const ns=new ResizeObserver(en);return ns.observe(Ee),()=>ns.disconnect()},[T]);const Mt=g.useMemo(()=>Iy.map(Ee=>({id:Ee,label:Q4e(Ee,N),description:N(`mode.desc.${Ee}`),icon:h.jsx(k3,{mode:Ee})})),[N]),Pt=g.useMemo(()=>{if(!A)return null;const Ee=A.filter(ht=>P4e.has(ht));return new Set(Ee)},[A]),Ze=Ee=>Pt?Pt.has(Ee):!0,bt=g.useMemo(()=>new Set(f.map(Ee=>Ee.name.replace(/^\/+/,""))),[f]),ft=g.useCallback(Ee=>bt.has(Ee),[bt]),ie=g.useMemo(()=>[{id:"new",label:N("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:N("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:N("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:N("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:N("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:N("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:N("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:N("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:N("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:N("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:N("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:N("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:N("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:N("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:N("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:N("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:ee.shellMode?N("quickActions.exitShellMode"):N("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:N("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(Ee=>{const ht=K4e(Ee);return!ht||ft(ht)}),[ee.shellMode,ft,N]),H=g.useMemo(()=>M.map(Ee=>({id:Ee.id,label:ay(Ee.label||Ee.id)})),[M]),oe=g.useCallback(Ee=>{D==null||D(Ee),pe(!1),ee.focus()},[D,ee]),De=g.useCallback(Ee=>{O==null||O(Ee),xe(!1),ee.focus()},[O,ee]),tt=g.useCallback(Ee=>{const ht=ee.viewRef.current;ht&&(ht.focus(),ht.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...Ee,bubbles:!0,cancelable:!0})))},[ee]),Ct=g.useCallback(Ee=>{if(de(!1),pe(!1),xe(!1),ee.closeSlashMenu(),Ee.action.type==="insert"){ee.insertText(Ee.action.text,{mode:"replace"});return}if(Ee.action.type==="shell"){ee.toggleShellMode();return}if(Ee.action.type==="key"){tt(Ee.action.item.event);return}r(Ee.action.command)},[ee,tt,r]),Et=g.useCallback(Ee=>{tt(Ee.event),Ee.id==="ctrl-r"&&de(!1)},[tt]),{searchMode:Qt,searchQuery:on,searchMatches:he,searchActiveIndex:X,searchInputRef:ue,searchUiRef:me,closeSearch:We,handleSearchKeyDown:At,handleSearchInput:jt,handleSearchCompositionEnd:dt}=ee.searchState,Wt=Ee=>{const ht=Lk(Ee),en=jk(Ee);return!ht&&!en?h.jsx("span",{className:$e.tagLabel,children:Ee.id}):h.jsxs(h.Fragment,{children:[ht&&h.jsx("span",{className:$e.tagLabel,children:ht}),en&&h.jsx("span",{className:$e.tagValue,children:en})]})},Rn=CB(b,N),ln=ay(w),xn=a&&!ee.hasContent;return h.jsxs("div",{className:$e.editorShell,"data-composer":!0,children:[h.jsxs("div",{ref:_e,className:$e.container,"data-dac-glow":!0,onClick:()=>{pe(!1),xe(!1),de(!1),ee.focus()},children:[h.jsx("div",{className:$e.dacAura,"aria-hidden":"true"}),h.jsx("div",{className:$e.dacHalo,"aria-hidden":"true"}),Qt&&h.jsxs("div",{ref:me,className:$e.searchPanel,onMouseDown:Ee=>Ee.stopPropagation(),onClick:Ee=>Ee.stopPropagation(),children:[h.jsxs("div",{className:$e.searchBar,children:[h.jsx("span",{className:$e.searchLabel,children:N("editor.searchLabel")}),h.jsx("input",{ref:ue,className:$e.searchInput,value:on,onChange:jt,onCompositionEnd:dt,onKeyDown:At,placeholder:N("editor.searchPlaceholder")})]}),he.length>0&&h.jsx("div",{className:$e.searchResults,children:he.map((Ee,ht)=>h.jsxs("button",{type:"button",className:`${$e.searchResult} ${ht===X?$e.searchResultActive:""}`,onMouseDown:en=>{en.preventDefault(),ee.replaceEditorText(Ee),We(!1)},children:[h.jsx("span",{className:$e.searchResultMarker,children:ht===X?"›":""}),h.jsx("span",{className:$e.searchResultText,children:Ee})]},`${Ee}-${ht}`))}),he.length===0&&h.jsx("div",{className:$e.searchEmpty,children:N("editor.noHistory")})]}),h.jsxs("div",{className:$e.content,children:[ee.composerTags.length>0&&h.jsx("div",{className:$e.tags,children:ee.composerTags.map(Ee=>h.jsxs("span",{className:$e.tag,children:[Wt(Ee),Ee.removable!==!1&&h.jsx("button",{type:"button",className:$e.tagRemove,"aria-label":`Remove ${SB(Ee)}`,onMouseDown:ht=>ht.preventDefault(),onClick:ht=>{var en;ht.stopPropagation(),ee.removeTopTag(Ee.id),(en=ee.viewRef.current)==null||en.focus()},onKeyDown:ht=>{var en;ht.key!=="Backspace"&&ht.key!=="Delete"||(ht.preventDefault(),ee.removeTopTag(Ee.id),(en=ee.viewRef.current)==null||en.focus())},children:"×"})]},Ee.id))}),ee.pastedImages.length>0&&h.jsx("div",{className:$e.images,children:ee.pastedImages.map((Ee,ht)=>h.jsxs("div",{className:$e.imageThumb,children:[h.jsx("img",{src:`data:${Ee.media_type};base64,${Ee.data}`,alt:""}),h.jsx("button",{className:$e.imageRemove,onClick:en=>{en.stopPropagation(),ee.removeImage(ht)},children:"×"})]},ht))}),ee.slashMenu&&h.jsx(J4e,{menu:ee.slashMenu,anchorRef:_e,panelRef:qe,onSelect:ee.selectSlashCompletion,onAccept:ee.acceptSlashCompletion}),h.jsxs("div",{className:$e.editorArea,children:[ee.shellMode&&h.jsx("span",{className:$e.shellPrefix,"aria-hidden":"true",children:"!"}),h.jsx("div",{ref:ee.containerRef})]}),h.jsxs("div",{className:$e.toolbar,children:[h.jsxs("div",{className:$e.toolbarLeading,children:[q&&h.jsx("div",{className:$e.toolbarStart,children:h.jsx(q,{disabled:u,isRunning:a,currentMode:b,currentModel:w,sessionName:j})}),h.jsxs("div",{className:$e.toolbarLeft,children:[Ze("approvalMode")&&h.jsxs("div",{className:$e.dropdownWrapper,children:[h.jsx(nA,{open:ne,items:Mt,activeId:b,onClose:()=>pe(!1),onSelect:oe,anchorRef:He}),h.jsxs("button",{ref:He,className:$e.toolBtn,onClick:Ee=>{Ee.stopPropagation(),ee.closeSlashMenu(),de(!1),pe(ht=>!ht),xe(!1)},"aria-label":N("status.mode"),children:[h.jsx("span",{className:$e.toolBtnModeIcon,children:h.jsx(k3,{mode:b})}),h.jsx("span",{className:$e.toolBtnText,children:Rn}),h.jsx("span",{className:$e.toolBtnArrow,children:h.jsx(tA,{})})]})]}),Ze("model")&&h.jsxs("div",{className:$e.dropdownWrapper,children:[h.jsx(nA,{open:be,items:H,activeId:w,onClose:()=>xe(!1),onSelect:De,anchorRef:re,showCheck:!0,maxHeight:300}),h.jsxs("button",{ref:re,className:$e.toolBtn,onClick:Ee=>{Ee.stopPropagation(),ee.closeSlashMenu(),de(!1),xe(ht=>!ht),pe(!1)},"aria-label":N("model.select"),children:[h.jsx("span",{className:$e.toolBtnModelIcon,children:h.jsx(G4e,{})}),h.jsx("span",{className:$e.toolBtnText,children:ln}),h.jsx("span",{className:$e.toolBtnArrow,children:h.jsx(tA,{})})]})]}),P&&h.jsx("div",{className:$e.toolbarEnd,children:h.jsx(P,{disabled:u,isRunning:a,currentMode:b,currentModel:w,sessionName:j})})]})]}),h.jsxs("div",{className:$e.toolbarRight,children:[se&&ie.length>0&&h.jsx("button",{className:`${$e.toolBtn} ${$e.quickActionsBtn}`,onClick:Ee=>{Ee.stopPropagation(),ee.closeSlashMenu(),pe(!1),xe(!1),de(ht=>!ht)},"aria-expanded":we,"aria-label":N("quickActions.open"),title:N("quickActions.open"),"data-tooltip":N("quickActions.open"),children:h.jsx("span",{className:$e.toolBtnIcon,children:h.jsx(H4e,{})})}),E&&h.jsx("div",{className:$e.toolbarRightCustom,children:h.jsx(E,{disabled:u,isRunning:a,currentMode:b,currentModel:w,sessionName:j})}),k&&ye&&Ze("widthMode")&&h.jsx("button",{className:`${$e.toolBtn} ${$e.widthModeBtn}`,onClick:Ee=>{Ee.stopPropagation(),C==null||C(x==="wide"?"1000":"wide")},disabled:!C,"aria-label":N(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:N(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":N(x==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:h.jsx("span",{className:$e.toolBtnIcon,children:h.jsx(W4e,{mode:x})})}),Ze("voice")&&h.jsx(lwe,{disabled:u,onInsert:Ee=>{const ht=ee.getText(),en=ht&&!/\s$/.test(ht)?" ":"";ee.insertText(`${en}${Ee} `),ee.focus()}}),h.jsx("button",{className:l||xn?`${$e.sendBtn} ${$e.sendBtnRunning}${c?` ${$e.sendBtnArmed}`:""}`:$e.sendBtn,disabled:l?!0:xn?!o:ee.disabled||!ee.hasContent,onClick:Ee=>{if(Ee.stopPropagation(),!l){if(xn){o==null||o();return}ee.submitText()}},"aria-label":N(l?"common.loading":xn?c?"stream.cancelArmed":"stream.cancel":"editor.send"),title:a&&c?N("stream.cancelArmed"):void 0,children:l?h.jsx(U4e,{}):xn?c?h.jsx("span",{className:$e.escLabel,"aria-hidden":"true",children:"Esc"}):h.jsx(q4e,{}):h.jsx(F4e,{})}),h.jsx("span",{role:"status","aria-live":"polite",className:$e.srOnly,children:a&&c?N("stream.cancelArmed"):""})]})]})]})]}),se&&we&&ie.length>0&&h.jsx(Z4e,{actions:ie,onRun:Ct,onPressKey:Et})]})})),tve="_bar_agzxl_1",nve="_left_agzxl_12",rve="_right_agzxl_13",sve="_settingsButton_agzxl_23",ive="_modeButton_agzxl_49",ove="_modeHint_agzxl_62",ave="_modeLabel_agzxl_67",lve="_modeDefault_agzxl_71",cve="_modePlan_agzxl_75",uve="_modeAutoEdit_agzxl_79",dve="_modeAuto_agzxl_79",hve="_modeYolo_agzxl_87",fve="_shortcutsButton_agzxl_96",mve="_modelButton_agzxl_114",pve="_model_agzxl_114",gve="_contextButton_agzxl_138",yve="_context_agzxl_138",bve="_goal_agzxl_161",wve="_separator_agzxl_167",vve="_taskPill_agzxl_171",Nr={bar:tve,left:nve,right:rve,settingsButton:sve,modeButton:ive,modeHint:ove,modeLabel:ave,modeDefault:lve,modePlan:cve,modeAutoEdit:uve,modeAuto:dve,modeYolo:hve,shortcutsButton:fve,modelButton:mve,model:pve,contextButton:gve,context:yve,goal:bve,separator:wve,taskPill:vve},xve=1e3;function _ve(e,t){switch(e){case"default":return{label:t("mode.default"),className:Nr.modeDefault};case"plan":return{label:t("mode.plan"),className:Nr.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:Nr.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:Nr.modeAuto};case"yolo":return{label:t("mode.yolo"),className:Nr.modeYolo};default:return null}}function kve(){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 c4(e,t,n,r){return r(e===1?t:n,{count:e})}function Sve(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(c4(s.shell,"tasks.pill.shell","tasks.pill.shells",t)),s.agent>0&&i.push(c4(s.agent,"tasks.pill.agent","tasks.pill.agents",t)),s.monitor>0&&i.push(c4(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 Tve(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 Cve=g.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:r,onOpenSettings:s,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:l,hideSettings:c,onToggleShortcuts:u,compact:d=!1},f){const m=gl(),p=m.status==="connected",y=m.currentModel??"",v=m.currentMode??"",b=m.tokenCount??0,w=m.contextWindow??0,{t:x}=lt(),T=(w>0?b/w*100:0).toFixed(1),A=_ve(v,x),[,M]=g.useState(0),D=g.useRef(null);g.useEffect(()=>{if(!l)return;const j=setInterval(()=>M(K=>(K+1)%1e6),xve);return()=>clearInterval(j)},[l]);const O=g.useMemo(()=>Sve(a,x),[a,x]),C=!d&&(p||!!A),L=l?Tve(Date.now()-l.setAt):"",I=l?`◎ ${x("goal.statusActive")}${L?` (${L})`:""}`:"",B=!!O||!d,F=!d&&!!y||!d&&w>0&&b>0||!!I;if(g.useImperativeHandle(f,()=>({focusTaskPill(){var j;return O?((j=D.current)==null||j.focus({preventScroll:!0}),!0):!1}}),[O]),!B&&!F)return null;const W=j=>{if(j.key==="Enter"||j.key==="ArrowDown"||j.key==="n"&&j.ctrlKey){j.preventDefault(),j.stopPropagation(),i==null||i();return}if(j.key==="ArrowUp"||j.key==="Escape"||j.key==="p"&&j.ctrlKey){j.preventDefault(),j.stopPropagation(),o==null||o();return}j.key.length===1&&!j.metaKey&&!j.ctrlKey&&!j.altKey&&(j.preventDefault(),j.stopPropagation(),o==null||o(j.key))};return h.jsxs("div",{className:Nr.bar,children:[h.jsxs("div",{className:Nr.left,children:[p&&!c&&!d&&h.jsx("button",{type:"button",className:Nr.settingsButton,onClick:s,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:x("settings.title"),"aria-label":x("settings.title"),"aria-haspopup":"dialog",children:h.jsx(kve,{})}),A&&!d&&h.jsxs("button",{type:"button",className:Nr.modeButton,onClick:t,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:x("mode.select"),"aria-haspopup":"listbox",children:[h.jsx("span",{className:`${Nr.modeLabel} ${A.className}`,children:A.label}),!d&&h.jsx("span",{className:Nr.modeHint,children:x("status.modeHint")})]}),!d&&h.jsx(h.Fragment,{children:u?h.jsx("button",{type:"button",className:Nr.shortcutsButton,onClick:u,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),"aria-haspopup":"dialog","aria-label":x("status.shortcuts"),children:x("status.shortcuts")}):h.jsx("span",{children:x("status.shortcuts")})}),O&&h.jsxs(h.Fragment,{children:[C&&h.jsx("span",{className:Nr.separator,children:"·"}),h.jsx("button",{ref:D,type:"button",className:Nr.taskPill,onClick:i,onKeyDown:W,disabled:!i,children:O})]})]}),h.jsxs("div",{className:Nr.right,children:[!d&&y&&h.jsx("button",{type:"button",className:Nr.modelButton,onClick:n,onMouseDown:j=>j.stopPropagation(),onTouchStart:j=>j.stopPropagation(),title:x("model.select"),"aria-haspopup":"listbox",children:h.jsx("span",{className:Nr.model,children:y})}),!d&&w>0&&b>0&&h.jsx("button",{type:"button",className:Nr.contextButton,onClick:r,title:x("contextUsage.title"),children:h.jsx("span",{className:Nr.context,children:x("status.contextUsed",{pct:T})})}),I&&h.jsx("span",{className:Nr.goal,title:l==null?void 0:l.condition,children:I})]})]})}),Ave=15e3,Eve=["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."],Mve=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function rA(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?Mve:Eve}function Ive(){const e=G_(),t=Ly(),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=Nve(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 Nve(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.outputTokens;if(typeof s=="number"&&s>0)return s}}function Rve(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}const Lve="_status_zld2v_1",jve="_spinner_zld2v_11",Dve="_label_zld2v_15",Ove="_meta_zld2v_19",Xp={status:Lve,spinner:jve,label:Dve,meta:Ove},u4=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Bve({startedAt:e}){const t=G_(),{estimatedOutputTokens:n,isReceivingContent:r}=Ive(),{language:s,t:i}=lt(),{loadingPhrases:o}=Lc(),a=g.useRef(o);a.current=o;const l=g.useCallback(T=>{var A;try{return((A=a.current)==null?void 0:A.call(a,T))??rA(T)}catch(M){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",M),rA(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(sA(d.current));const T=setInterval(()=>{u(sA(d.current))},1e3);return()=>clearInterval(T)},[v,e]),g.useEffect(()=>{if(t==="idle"){y(l(s)[0]??"");return}const T=()=>{const M=l(s),D=Math.floor(Math.random()*M.length);y(M[D]??"")};T();const A=setInterval(T,Ave);return()=>clearInterval(A)},[s,t,l]),g.useEffect(()=>{if(t==="idle")return;const T=setInterval(()=>{m(A=>(A+1)%u4.length)},250);return()=>clearInterval(T)},[t]),t==="idle")return null;const b=u4[f%u4.length],w=r?"↓":"↑",x=c<60?`${c}s`:Pve(c*1e3),k=n>0?` · ${w} ${i("stream.tokens",{count:Rve(n)})}`:"";return h.jsxs("div",{className:Xp.status,children:[h.jsx("span",{className:Xp.spinner,children:b}),p&&h.jsx("span",{className:Xp.label,children:p}),h.jsxs("span",{className:Xp.meta,children:["(",x,k," · ",i("stream.cancel"),")"]})]})}function Pve(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 sA(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const $ve="_host_1scjy_1",zve="_toast_1scjy_13",Fve="_message_1scjy_31",qve="_close_1scjy_39",Uve="_info_1scjy_58",Hve="_success_1scjy_62",Vve="_warning_1scjy_66",Wve="_error_1scjy_70",Hf={host:$ve,toast:zve,message:Fve,close:qve,info:Uve,success:Hve,warning:Vve,error:Wve};function Gve({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:h.jsx("div",{className:Hf.host,role:"status","aria-live":"polite",children:e.map(r=>h.jsx(Kve,{toast:r,onDismiss:t,autoDismissMs:n},r.id))})}function Kve({toast:e,onDismiss:t,autoDismissMs:n}){const{t:r}=lt();return g.useEffect(()=>{const s=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(s)},[n,t,e.id]),h.jsxs("div",{className:`${Hf.toast} ${Hf[e.tone]}`,children:[h.jsx("div",{className:Hf.message,children:e.message}),h.jsx("button",{type:"button",className:Hf.close,onClick:()=>t(e.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const Yve="_panel_k9l9d_1",Xve="_summary_k9l9d_10",Qve="_progressRing_k9l9d_27",Jve="_stepText_k9l9d_41",Zve="_fullText_k9l9d_48",exe="_compactText_k9l9d_52",txe="_detail_k9l9d_71",nxe="_item_k9l9d_103",rxe="_icon_k9l9d_113",sxe="_content_k9l9d_121",ixe="_completed_k9l9d_129",oxe="_inProgress_k9l9d_134",axe="_pending_k9l9d_140",Mi={panel:Yve,summary:Xve,progressRing:Qve,stepText:Jve,fullText:Zve,compactText:exe,detail:txe,item:nxe,icon:rxe,content:sxe,completed:ixe,inProgress:oxe,pending:axe};function lxe(e){switch(e){case"completed":return Mi.completed;case"in_progress":return Mi.inProgress;case"pending":return Mi.pending}}const cxe=g.memo(function({todos:t,title:n}){const{t:r}=lt();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:Mi.panel,"aria-label":n??r("todo.title"),tabIndex:0,children:[h.jsxs("div",{className:Mi.summary,"aria-label":r("todo.stepProgress",{current:a,total:s}),children:[h.jsx("span",{className:Mi.progressRing,style:{"--todo-progress":String(l)},"aria-hidden":"true"}),h.jsxs("span",{className:Mi.stepText,children:[h.jsx("span",{className:Mi.fullText,children:r("todo.stepProgress",{current:a,total:s})}),h.jsx("span",{className:Mi.compactText,children:r("todo.stepFraction",{current:a,total:s})})]})]}),h.jsx("div",{className:Mi.detail,role:"tooltip",children:t.map((c,u)=>h.jsxs("div",{className:`${Mi.item} ${lxe(c.status)}`,children:[h.jsx("span",{className:Mi.icon,"aria-hidden":"true",children:q1(c.status)}),h.jsx("span",{className:Mi.content,title:c.content,children:c.content})]},`${c.id||u}:${c.content}`))})]})}),uxe="_header_leiy3_1",dxe="_titleRow_leiy3_11",hxe="_title_leiy3_11",fxe="_subtitle_leiy3_31",Qp={header:uxe,titleRow:dxe,title:hxe,subtitle:fxe};function mxe(e){const{t}=lt();return h.jsxs("div",{className:Qp.header,children:[h.jsxs("div",{className:Qp.titleRow,children:[h.jsx("span",{children:t("welcome.titlePrefix")}),h.jsx("span",{className:Qp.title,children:"Qwen Code"})]}),h.jsx("div",{className:Qp.subtitle,children:t("welcome.prompt")})]})}const pxe="_themeDark_e0gve_1",gxe="_themeLight_e0gve_20",yxe="_backdrop_e0gve_39",bxe="_panel_e0gve_59",wxe="_sizeSm_e0gve_77",vxe="_sizeMd_e0gve_81",xxe="_sizeLg_e0gve_85",_xe="_sizeXl_e0gve_89",kxe="_header_e0gve_93",Sxe="_titleWrap_e0gve_102",Txe="_title_e0gve_102",Cxe="_subtitle_e0gve_114",Axe="_close_e0gve_121",Exe="_body_e0gve_160",ui={themeDark:pxe,themeLight:gxe,backdrop:yxe,panel:bxe,sizeSm:wxe,sizeMd:vxe,sizeLg:xxe,sizeXl:_xe,header:kxe,titleWrap:Sxe,title:Txe,subtitle:Cxe,close:Axe,body:Exe},Mxe={sm:ui.sizeSm,md:ui.sizeMd,lg:ui.sizeLg,xl:ui.sizeXl},Ixe=["a[href]:not([hidden])","button:not([disabled]):not([hidden])","input:not([disabled]):not([hidden])","select:not([disabled]):not([hidden])","textarea:not([disabled]):not([hidden])",'[tabindex]:not([tabindex="-1"]):not([hidden])'].join(",");function d4(e){return e?Array.from(e.querySelectorAll(Ixe)):[]}const $l=[],AB=g.createContext(null);function Nxe(e){return e===null?!0:$l[$l.length-1]===e}function gs({title:e,subtitle:t,size:n="md",onClose:r,children:s}){const{t:i}=lt(),a=Q_()===Ns.Light?ui.themeLight:ui.themeDark,l=g.useRef(null),c=g.useRef(r);c.current=r;const[u]=g.useState(()=>typeof document<"u"?document.activeElement:null),d=g.useRef(!1),f=g.useRef(!1),m=g.useRef(null);m.current===null&&(m.current={}),g.useEffect(()=>{const w=l.current,x=m.current;$l.push(x),w&&!w.contains(document.activeElement)&&(d4(w).find(M=>!M.hasAttribute("data-dialog-close"))??w).focus();const k=T=>{var A;if($l[$l.length-1]===x&&!T.defaultPrevented&&!(T.isComposing||T.keyCode===229)){if(T.key==="Escape"){T.preventDefault(),T.stopPropagation(),c.current();return}if(T.key==="Tab"){const M=d4(l.current);if(M.length===0){T.preventDefault(),(A=l.current)==null||A.focus();return}const D=M[0],O=M[M.length-1],C=document.activeElement;M.includes(C)?T.shiftKey&&C===D?(T.preventDefault(),O.focus()):!T.shiftKey&&C===O&&(T.preventDefault(),D.focus()):(T.preventDefault(),(T.shiftKey?O:D).focus())}}};return document.addEventListener("keydown",k),()=>{var C,L,I;document.removeEventListener("keydown",k);const T=$l.indexOf(x);if(T>=0&&$l.splice(T,1),$l.length===0){(C=u==null?void 0:u.focus)==null||C.call(u);return}const A=Array.from(document.querySelectorAll("[data-keyboard-scope]")),M=(L=A[A.length-1])==null?void 0:L.querySelector('[role="dialog"]');(I=d4(M).find(B=>!B.hasAttribute("data-dialog-close"))??M)==null||I.focus()}},[u]);const p=w=>{d.current=w.target===w.currentTarget,f.current=!1},y=w=>{f.current=w.target===w.currentTarget},v=w=>{const x=d.current&&f.current&&w.target===w.currentTarget;d.current=!1,f.current=!1,x&&r()},b=h.jsx("div",{className:`${ui.backdrop} ${a}`,"data-keyboard-scope":!0,onMouseDown:p,onMouseUp:y,onClick:v,children:h.jsx(AB.Provider,{value:m.current,children:h.jsxs("section",{ref:l,className:`${ui.panel} ${Mxe[n]}`,role:"dialog","aria-modal":"true","aria-label":e,tabIndex:-1,children:[h.jsxs("header",{className:ui.header,children:[h.jsxs("div",{className:ui.titleWrap,children:[h.jsx("div",{className:ui.title,children:e}),t&&h.jsx("div",{className:ui.subtitle,children:t})]}),h.jsx("button",{type:"button",className:ui.close,onClick:r,"aria-label":i("common.close"),title:i("common.close"),"data-dialog-close":!0})]}),h.jsx("div",{className:ui.body,children:s})]})})});return typeof document>"u"?b:fy.createPortal(b,document.body)}function Jp(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const Rxe=new Set(["button","submit","reset"]),Lxe=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function iA(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;if(t==="BUTTON"||t==="A"||t==="TEXTAREA")return!0;if(t==="INPUT")return Rxe.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function h4(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!Lxe.has(e.type):e.isContentEditable===!0}function Bc({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r,enabled:s=!0}){const i=g.useContext(AB),o=g.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r};const[a,l]=g.useState(!1);return g.useEffect(()=>{if(!s)return;const c=()=>l(!0),u=()=>l(!1),d=f=>{if(!Nxe(i)||f.defaultPrevented||f.isComposing||f.keyCode===229||f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;const{itemCount:m,activeIndex:p}=o.current;if(!(m<=0))switch(f.key){case"ArrowDown":f.preventDefault(),c(),o.current.onActiveIndexChange(Jp(p+1,m));break;case"ArrowUp":f.preventDefault(),c(),o.current.onActiveIndexChange(Jp(p-1,m));break;case"Home":if(h4())return;f.preventDefault(),c(),o.current.onActiveIndexChange(0);break;case"End":if(h4())return;f.preventDefault(),c(),o.current.onActiveIndexChange(m-1);break;case"Enter":{if(iA()||p<0)return;f.preventDefault(),o.current.onConfirm(Jp(p,m));break}case" ":{if(iA()||h4()||p<0)return;f.preventDefault(),o.current.onConfirm(Jp(p,m));break}}};return window.addEventListener("keydown",d),window.addEventListener("mousemove",u),()=>{window.removeEventListener("keydown",d),window.removeEventListener("mousemove",u)}},[i,s]),{keyboardMode:a}}const jxe="_picker_5cmbf_4",Dxe="_selected_5cmbf_98",Oxe="_disabled_5cmbf_114",Bxe={picker:jxe,"picker-in-shell":"_picker-in-shell_5cmbf_15","picker-search":"_picker-search_5cmbf_22","picker-search-label":"_picker-search-label_5cmbf_31","picker-search-input":"_picker-search-input_5cmbf_35","picker-search-hint":"_picker-search-hint_5cmbf_45","picker-sep":"_picker-sep_5cmbf_49","picker-list":"_picker-list_5cmbf_54","picker-list-compact":"_picker-list-compact_5cmbf_67","picker-empty":"_picker-empty_5cmbf_71","picker-item":"_picker-item_5cmbf_77","picker-session-item":"_picker-session-item_5cmbf_93",selected:Dxe,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:Oxe,"picker-item-row":"_picker-item-row_5cmbf_119","picker-item-title":"_picker-item-title_5cmbf_128","picker-item-checkbox":"_picker-item-checkbox_5cmbf_139","picker-item-checkbox-checked":"_picker-item-checkbox-checked_5cmbf_153","picker-item-meta":"_picker-item-meta_5cmbf_163","picker-item-detail":"_picker-item-detail_5cmbf_171","dialog-current":"_dialog-current_5cmbf_185","picker-item-confirmed":"_picker-item-confirmed_5cmbf_186","picker-item-badge":"_picker-item-badge_5cmbf_217","tools-status-badge":"_tools-status-badge_5cmbf_226","tools-status-badge-enabled":"_tools-status-badge-enabled_5cmbf_237","tools-status-badge-disabled":"_tools-status-badge-disabled_5cmbf_241","tools-status-badge-busy":"_tools-status-badge-busy_5cmbf_245","tools-picker-item":"_tools-picker-item_5cmbf_249","tools-picker-item-expanded":"_tools-picker-item-expanded_5cmbf_260","tools-item-icon":"_tools-item-icon_5cmbf_264","tools-item-chevron":"_tools-item-chevron_5cmbf_296","tools-item-chevron-expanded":"_tools-item-chevron-expanded_5cmbf_308","tools-item-detail":"_tools-item-detail_5cmbf_312","mcp-status":"_mcp-status_5cmbf_317","mcp-status-connected":"_mcp-status-connected_5cmbf_321","mcp-status-connecting":"_mcp-status-connecting_5cmbf_325","mcp-status-disconnected":"_mcp-status-disconnected_5cmbf_329","mcp-status-disabled":"_mcp-status-disabled_5cmbf_333","mcp-status-unknown":"_mcp-status-unknown_5cmbf_334","dialog-inline-button":"_dialog-inline-button_5cmbf_338","dialog-primary-button":"_dialog-primary-button_5cmbf_339","dialog-danger-button":"_dialog-danger-button_5cmbf_340","dialog-inline-actions":"_dialog-inline-actions_5cmbf_363","dialog-footer-actions":"_dialog-footer-actions_5cmbf_369","dialog-form":"_dialog-form_5cmbf_387","dialog-form-row":"_dialog-form-row_5cmbf_415","dialog-textarea":"_dialog-textarea_5cmbf_421","dialog-split":"_dialog-split_5cmbf_426","dialog-split-list":"_dialog-split-list_5cmbf_433","tools-desc-expanded":"_tools-desc-expanded_5cmbf_437","tools-desc-body":"_tools-desc-body_5cmbf_447","extensions-toolbar":"_extensions-toolbar_5cmbf_454","extensions-row-button":"_extensions-row-button_5cmbf_458","extensions-detail":"_extensions-detail_5cmbf_473","extensions-detail-actions":"_extensions-detail-actions_5cmbf_484","extensions-detail-grid":"_extensions-detail-grid_5cmbf_491","extensions-detail-field":"_extensions-detail-field_5cmbf_497","extensions-detail-label":"_extensions-detail-label_5cmbf_504","extensions-detail-value":"_extensions-detail-value_5cmbf_510","extensions-confirm":"_extensions-confirm_5cmbf_517","dialog-detail":"_dialog-detail_5cmbf_527","dialog-detail-title":"_dialog-detail-title_5cmbf_535","dialog-detail-shortcut":"_dialog-detail-shortcut_5cmbf_543","dialog-detail-meta":"_dialog-detail-meta_5cmbf_550","dialog-detail-body":"_dialog-detail-body_5cmbf_555"};function Me(...e){return e.filter(t=>!!t).map(t=>Bxe[t]).filter(Boolean).join(" ")}const Pxe="_list_jbgdx_1",$xe="_row_jbgdx_16",zxe="_selected_jbgdx_32",Fxe="_keyboardOnly_jbgdx_39",qxe="_modeName_jbgdx_47",Uxe="_modeIcon_jbgdx_51",Hxe="_modeText_jbgdx_67",Vxe="_modeDesc_jbgdx_83",Nl={list:Pxe,row:$xe,selected:zxe,keyboardOnly:Fxe,modeName:qxe,modeIcon:Uxe,modeText:Hxe,modeDesc:Vxe};function Wxe({currentMode:e,onSelect:t}){const{t:n}=lt(),r=g.useRef(null),s=Iy.map(f=>({id:f,name:n(`mode.listLabel.${f}`),description:n(`mode.desc.${f}`)})),i=s.findIndex(f=>f.id===e),[o,a]=g.useState(i>=0?i:0),l=g.useRef(!1);g.useEffect(()=>{l.current||i<0||a(i)},[i]);const c=f=>{l.current=!0,a(f)},u=f=>{const m=s[f];m&&t(m.id)},{keyboardMode:d}=Bc({itemCount:s.length,activeIndex:o,onActiveIndexChange:c,onConfirm:u});return g.useEffect(()=>{var m;const f=(m=r.current)==null?void 0:m.children[o];f==null||f.scrollIntoView({block:"nearest"})},[o]),h.jsx("div",{className:`${Nl.list} ${d?Nl.keyboardOnly:""}`,ref:r,role:"listbox",tabIndex:0,"aria-activedescendant":s.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),children:s.map((f,m)=>{const p=m===o,y=f.id===e;return h.jsxs("div",{id:`mode-opt-${m}`,role:"option","aria-selected":y,className:`${Nl.row} ${p?Nl.selected:""} ${y?Me("dialog-current"):""}`,onClick:()=>u(m),onMouseMove:()=>c(m),children:[h.jsx("span",{className:Nl.modeIcon,children:h.jsx(k3,{mode:f.id})}),h.jsxs("span",{className:Nl.modeText,children:[h.jsx("span",{className:Nl.modeName,children:f.name}),h.jsx("span",{className:Nl.modeDesc,children:f.description})]})]},f.id)})})}function kb(e){const[t,n]=g.useState(""),[r,s]=g.useState(""),i=g.useRef(!1),o=g.useRef(""),a=g.useRef(e);a.current=e;const l=g.useCallback(f=>{var m;f!==o.current&&(o.current=f,s(f),(m=a.current)==null||m.call(a,f))},[]),c=g.useCallback(f=>{const m=f.target.value;n(m),i.current||l(m)},[l]),u=g.useCallback(()=>{i.current=!0},[]),d=g.useCallback(f=>{i.current=!1;const m=f.currentTarget.value;n(m),l(m)},[l]);return{filterValue:r,inputProps:{value:t,onChange:c,onCompositionStart:u,onCompositionEnd:d}}}function EB(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 Ok({session:e,active:t,current:n,confirmed:r,disabled:s,currentLabel:i,optionId:o,ariaSelected:a,leading:l,trailing:c,onClick:u,onActivate:d}){const{t:f}=lt(),m=e.updatedAt||e.createdAt;return h.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":s||void 0,className:Me("picker-item","picker-session-item",t?"selected":void 0,n?"dialog-current":void 0,r?"picker-item-confirmed":void 0,s?"disabled":void 0),title:n?i:void 0,onClick:u,onMouseMove:d,children:[h.jsxs("div",{className:Me("picker-item-row"),children:[l,h.jsx("span",{className:Me("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),c]}),h.jsxs("div",{className:Me("picker-item-meta"),children:[h.jsx("span",{children:m&&EB(m,f)}),h.jsx("span",{className:Me("picker-item-detail"),children:f("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&h.jsx("span",{className:Me("picker-item-detail"),children:f("resume.activePrompt")})]})]})}const S3="resume-session-list",oA=e=>`${S3}-opt-${e}`;function Gxe({onSelect:e,onClose:t}){const{t:n}=lt(),r=gl(),{sessions:s,loading:i,error:o}=Dy({autoLoad:!0}),a=r.sessionId,[l,c]=g.useState(-1),{filterValue:u,inputProps:d}=kb(()=>c(-1)),f=g.useRef(null),m=g.useRef(null),p=u?s.filter(b=>{const w=u.toLowerCase();return(b.displayName||"").toLowerCase().includes(w)||b.sessionId.toLowerCase().includes(w)}):s;g.useEffect(()=>{l>=p.length&&p.length>0&&c(p.length-1)},[p.length,l]),g.useEffect(()=>{var w;const b=(w=f.current)==null?void 0:w.children[l];b==null||b.scrollIntoView({block:"nearest"})},[l]);const y=b=>{const w=p[b];w&&(e(w.sessionId),t())},{keyboardMode:v}=Bc({itemCount:p.length,activeIndex:l,onActiveIndexChange:c,onConfirm:y});return g.useEffect(()=>{var b;(b=m.current)==null||b.focus()},[]),h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search"),children:[h.jsxs("span",{className:Me("picker-search-label"),children:[n("resume.search"),":"," "]}),h.jsx("input",{ref:m,className:Me("picker-search-input"),"aria-label":n("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":S3,"aria-activedescendant":l>=0&&l<p.length?oA(l):void 0,...d,placeholder:""})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:S3,role:"listbox",className:Me("picker-list",v?"picker-keyboard-only":void 0),ref:f,children:[i&&h.jsx("div",{className:Me("picker-empty"),children:n("common.loading")}),!i&&o&&h.jsx("div",{className:Me("picker-empty"),children:o.message||"Failed to load sessions"}),!i&&!o&&p.length===0&&h.jsx("div",{className:Me("picker-empty"),children:u?n("resume.noMatch",{query:u}):n("resume.none")}),!i&&p.map((b,w)=>h.jsx(Ok,{session:b,optionId:oA(w),active:w===l,current:b.sessionId===a,currentLabel:n("resume.current"),onClick:()=>y(w),onActivate:()=>c(w)},b.sessionId))]})]})}const Kxe="_layout_1sigx_1",Yxe="_list_1sigx_9",Xxe="_row_1sigx_23",Qxe="_selected_1sigx_39",Jxe="_keyboardOnly_1sigx_46",Zxe="_label_1sigx_54",e3e="_divider_1sigx_58",t3e="_number_1sigx_65",n3e="_provider_1sigx_71",r3e="_badge_1sigx_86",s3e="_detail_1sigx_92",i3e="_detailRow_1sigx_104",o3e="_detailLabel_1sigx_111",a3e="_detailValue_1sigx_117",l3e="_empty_1sigx_122",Hs={layout:Kxe,list:Yxe,row:Xxe,selected:Qxe,keyboardOnly:Jxe,label:Zxe,divider:e3e,number:t3e,provider:n3e,badge:r3e,detail:s3e,detailRow:i3e,detailLabel:o3e,detailValue:a3e,empty:l3e};function c3e(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function u3e(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 aA(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function d3e(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function h3e(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function f3e(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function Zp({label:e,value:t}){return h.jsxs("div",{className:Hs.detailRow,children:[h.jsx("span",{className:Hs.detailLabel,children:e}),h.jsx("span",{className:Hs.detailValue,children:t})]})}function m3e({mode:e="main",onSelect:t,models:n,currentModelId:r}){const s=gl(),i=r??s.currentModel??"",o=g.useMemo(()=>n??s.models??[],[n,s.models]),{t:a}=lt(),l=g.useRef(null),c=e==="fast",u=e==="voice",d=o.findIndex(x=>x.id===i),[f,m]=g.useState(d>=0?d:0),p=g.useRef(!1);g.useEffect(()=>{p.current||o.length===0||m(d>=0?d:0)},[o.length,d]);const y=x=>{p.current=!0,m(x)};g.useEffect(()=>{f>=o.length&&o.length>0&&m(o.length-1)},[o.length,f]);const v=o[f]??o[0],b=x=>{const k=o[x];k&&t(f3e(k,c))},{keyboardMode:w}=Bc({itemCount:o.length,activeIndex:f,onActiveIndexChange:y,onConfirm:b});return g.useEffect(()=>{var k;const x=(k=l.current)==null?void 0:k.children[f];x==null||x.scrollIntoView({block:"nearest"})},[f]),h.jsxs("div",{className:Hs.layout,children:[h.jsxs("div",{className:`${Hs.list} ${w?Hs.keyboardOnly:""}`,ref:l,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${f}`:void 0,"aria-label":a(c?"model.setFast":u?"model.setVoice":"model.select"),children:[o.length===0?h.jsx("div",{className:Hs.empty,children:a("model.none")}):null,o.map((x,k)=>{const T=k===f,A=k===d,M=aA(x);return h.jsxs("div",{id:`model-opt-${k}`,role:"option","aria-selected":A,className:`${Hs.row} ${T?Hs.selected:""} ${A?Me("dialog-current"):""}`,onClick:()=>b(k),onMouseMove:()=>y(k),children:[h.jsxs("span",{className:Hs.number,children:[k+1,"."]}),M?h.jsxs("span",{className:Hs.provider,children:["[",M,"]"]}):null,h.jsx("span",{className:Hs.label,children:d3e(x)}),x.isRuntime?h.jsx("span",{className:Hs.badge,children:"Runtime"}):null]},h3e(x))})]}),v?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Hs.divider}),h.jsxs("div",{className:Hs.detail,children:[h.jsx(Zp,{label:a("model.modality"),value:u3e(v.modalities,a)}),h.jsx(Zp,{label:a("model.contextWindow"),value:c3e(v.contextWindow,a)}),aA(v)!=="qwen-oauth"?h.jsxs(h.Fragment,{children:[h.jsx(Zp,{label:a("model.baseUrl"),value:v.baseUrl??a("model.default")}),h.jsx(Zp,{label:a("model.apiKey"),value:v.envKey??a("model.notSet")})]}):null]})]}):null]})}function Bk(e){return e.replace(/[：:\s]+$/u,"")}const p3e="_panel_irhhk_1",g3e="_embedded_irhhk_13",y3e="_footer_irhhk_21",b3e="_titleLine_irhhk_25",w3e="_icon_irhhk_32",v3e="_title_irhhk_25",x3e="_subtitle_irhhk_44",_3e="_text_irhhk_49",k3e="_options_irhhk_55",S3e="_option_irhhk_55",T3e="_optionActive_irhhk_77",C3e="_optionLabel_irhhk_81",A3e="_optionIcon_irhhk_86",E3e="_optionContent_irhhk_119",M3e="_optionDesc_irhhk_129",I3e="_badge_irhhk_135",N3e="_toolDetail_irhhk_170",R3e="_toolDetailTitle_irhhk_175",L3e="_toolDetailBody_irhhk_180",j3e="_toolList_irhhk_181",D3e="_textInput_irhhk_193",O3e="_textArea_irhhk_211",B3e="_summary_irhhk_231",P3e="_summaryRow_irhhk_238",$3e="_summaryLabel_irhhk_244",z3e="_summaryValue_irhhk_250",F3e="_summaryBlockTitle_irhhk_255",q3e="_summaryBlock_irhhk_255",U3e="_manageList_irhhk_295",H3e="_manageItem_irhhk_301",V3e="_manageItemExpanded_irhhk_307",W3e="_manageRow_irhhk_312",G3e="_manageRowActive_irhhk_329",K3e="_manageIcon_irhhk_333",Y3e="_manageName_irhhk_362",X3e="_levelTag_irhhk_370",Q3e="_manageChevron_irhhk_380",J3e="_manageChevronExpanded_irhhk_398",Z3e="_manageDetail_irhhk_402",e_e="_manageDetailInner_irhhk_409",t_e="_manageDetailHeader_irhhk_419",n_e="_manageActions_irhhk_426",r_e="_manageButton_irhhk_433",s_e="_dangerButton_irhhk_453",i_e="_deleteText_irhhk_457",o_e="_viewerRow_irhhk_487",a_e="_viewerLabel_irhhk_500",l_e="_viewerField_irhhk_507",c_e="_viewerSectionTitle_irhhk_512",u_e="_viewerBlock_irhhk_518",d_e="_closed_irhhk_524",h_e="_closedText_irhhk_528",f_e="_loading_irhhk_534",m_e="_error_irhhk_539",p_e="_createWizard_irhhk_545",g_e="_createSteps_irhhk_551",y_e="_createStepPill_irhhk_559",b_e="_createStepPillActive_irhhk_571",w_e="_createStepPillDone_irhhk_576",v_e="_createStepNumber_irhhk_580",x_e="_createStepLabel_irhhk_591",__e="_createBody_irhhk_597",k_e="_createActions_irhhk_601",Se={panel:p3e,embedded:g3e,footer:y3e,titleLine:b3e,icon:w3e,title:v3e,subtitle:x3e,text:_3e,options:k3e,option:S3e,optionActive:T3e,optionLabel:C3e,optionIcon:A3e,optionContent:E3e,optionDesc:M3e,badge:I3e,toolDetail:N3e,toolDetailTitle:R3e,toolDetailBody:L3e,toolList:j3e,textInput:D3e,textArea:O3e,summary:B3e,summaryRow:P3e,summaryLabel:$3e,summaryValue:z3e,summaryBlockTitle:F3e,summaryBlock:q3e,manageList:U3e,manageItem:H3e,manageItemExpanded:V3e,manageRow:W3e,manageRowActive:G3e,manageIcon:K3e,manageName:Y3e,levelTag:X3e,manageChevron:Q3e,manageChevronExpanded:J3e,manageDetail:Z3e,manageDetailInner:e_e,manageDetailHeader:t_e,manageActions:n_e,manageButton:r_e,dangerButton:s_e,deleteText:i_e,viewerRow:o_e,viewerLabel:a_e,viewerField:l_e,viewerSectionTitle:c_e,viewerBlock:u_e,closed:d_e,closedText:h_e,loading:f_e,error:m_e,createWizard:p_e,createSteps:g_e,createStepPill:y_e,createStepPillActive:b_e,createStepPillDone:w_e,createStepNumber:v_e,createStepLabel:x_e,createBody:__e,createActions:k_e};function MB(e){if(e==="project")return"workspace";if(e==="user")return"global"}function IB(e){return MB(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function S_e(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 la=Bk;function T_e(e){return e.displayName||e.name}function NB(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 RB(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function LB(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function C_e(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 A_e({mode:e,embedded:t=!1,onMessage:n,onClose:r}){const{t:s}=lt(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:c,generateAgent:u,deleteAgent:d}=VH({autoLoad:!0}),{tools:f}=wN({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,w]=g.useState(0),[x,k]=g.useState(0),[T,A]=g.useState(null),[M,D]=g.useState(null),[O,C]=g.useState(!1),[L,I]=g.useState(null),[B,F]=g.useState(1),[W,j]=g.useState(()=>e==="create-user"?"global":"workspace"),[K,J]=g.useState("manual"),[ee,N]=g.useState(""),[q,P]=g.useState(""),[E,ne]=g.useState(""),[pe,be]=g.useState([]),[xe,we]=g.useState(0),[de,se]=g.useState(!1),[ae,_e]=g.useState(!1),qe=g.useRef(0),He=g.useCallback(()=>{p(!0),r()},[r]),re=g.useMemo(()=>{const Ze=i.filter(H=>H.level==="project"),bt=i.filter(H=>H.level==="user"),ft=i.filter(H=>H.level==="builtin"),ie=i.filter(H=>H.level==="extension");return{project:Ze,user:bt,builtin:ft,extension:ie}},[i]),ye=g.useMemo(()=>[...re.project,...re.user,...re.builtin,...re.extension],[re]),Te=g.useMemo(()=>{const Ze=f.filter(H=>H.enabled).map(T_e).sort((H,oe)=>H.localeCompare(oe)),bt=Ze.filter(NB),ft=Ze.filter(RB),ie=Ze.filter(LB);return[{id:"all",label:s("agent.create.tools.all"),tools:[]},{id:"read",label:s("agent.create.tools.readOnly"),tools:bt},{id:"edit",label:s("agent.create.tools.readEdit"),tools:[...new Set([...bt,...ft])]},{id:"execute",label:s("agent.create.tools.readEditExecute"),tools:[...new Set([...bt,...ft,...ie])]}]},[s,f]);g.useEffect(()=>{if(y!=="manage")return;const Ze=M!==null?ye[M]:void 0;Ze&&l(Ze.name).then(A).catch(bt=>I(bt instanceof Error?bt.message:String(bt)))},[y,ye,M,l]),g.useEffect(()=>{x>=ye.length&&ye.length>0&&k(ye.length-1),M!==null&&M>=ye.length&&D(null)},[M,ye.length,x]);const ke=g.useCallback((Ze=x)=>{const bt=ye[Ze];if(!bt||!IB(bt))return;const ft=MB(bt.level);ft&&(C(!0),d(bt.name,ft).then(()=>{n(s("agent.deleted",{name:bt.name})),A(null),D(null),k(0),a()}).catch(ie=>I(ie instanceof Error?ie.message:String(ie))).finally(()=>C(!1)))},[ye,x,d,n,a,s]),vt=g.useCallback(()=>{if(!ee.trim()||!q.trim()||!E.trim()){I(s("agent.create.required"));return}C(!0),c({name:ee.trim(),description:q.trim(),systemPrompt:E.trim(),scope:W,tools:pe}).then(Ze=>{n(s("agent.created",{name:Ze.agent.name})),He()}).catch(Ze=>I(Ze instanceof Error?Ze.message:String(Ze))).finally(()=>C(!1))},[ee,q,E,W,pe,c,n,He,s]),rt=g.useCallback(async()=>{const Ze=q.trim();if(!Ze||de)return;const bt=qe.current+1;qe.current=bt,se(!0),_e(!1),I(null);try{const ft=await u(Ze);if(qe.current!==bt)return;N(ft.name),P(ft.description),ne(ft.systemPrompt),F(K==="manual"?6:4),we(0)}catch(ft){if(qe.current!==bt)return;I(s("agent.create.generateFailed",{error:ft instanceof Error?ft.message:String(ft)})),_e(!0)}finally{qe.current===bt&&se(!1)}},[q,de,K,u,s]),Mt=g.useCallback(Ze=>{if(Ze==="name"&&ee.trim())F(4),_e(!0);else if(Ze==="prompt"&&E.trim())F(5),_e(!0);else if(Ze==="desc"&&q.trim()){if(K==="qwen"){rt();return}F(K==="manual"?6:4),we(0),_e(!1)}},[ee,q,E,K,rt]);if(m)return h.jsx("div",{className:`${Se.panel} ${t?Se.embedded:""} ${Se.closed}`,children:h.jsx("div",{className:Se.closedText,children:s("agents.closed")})});if(o&&i.length===0)return h.jsxs("div",{className:`${Se.panel} ${t?Se.embedded:""}`,children:[h.jsxs("div",{className:Se.titleLine,children:[h.jsx("span",{className:Se.icon,children:"?"}),h.jsx("span",{className:Se.title,children:s("agents.title")})]}),h.jsx("div",{className:Se.loading,children:s("common.loading")})]});const Pt=s("agents.title");return h.jsxs("div",{className:`${Se.panel} ${t?Se.embedded:""}`,children:[!t&&y!=="create"&&h.jsxs("div",{className:Se.titleLine,children:[h.jsx("span",{className:Se.icon,children:"?"}),h.jsx("span",{className:Se.title,children:Pt}),h.jsx("span",{className:Se.subtitle,children:s("agent.count",{count:i.length})})]}),L&&h.jsx("div",{className:Se.error,children:L}),y==="menu"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.text,children:s("agent.selectAction")}),h.jsxs("div",{className:Se.options,children:[h.jsx(au,{idx:0,active:b===0,label:s("agent.manage"),desc:s("agent.manage.desc"),onClick:()=>{w(0),v("manage")},onHover:()=>w(0)}),h.jsx(au,{idx:1,active:b===1,label:s("agent.create"),desc:s("agent.create.desc"),onClick:()=>{w(1),v("create")},onHover:()=>w(1)})]}),h.jsx("div",{className:Se.footer,children:s("agent.footer.nav")})]}),y==="manage"&&h.jsx(E_e,{agents:ye,expandedAgentIdx:M,selectedAgent:T,busy:O,onToggleAgent:Ze=>{k(Ze),D(bt=>bt===Ze?null:Ze),A(null)},onDelete:Ze=>{O||ke(Ze)},t:s}),y==="create"&&h.jsx(M_e,{step:B,method:K,scope:W,name:ee,desc:q,prompt:E,tools:pe,toolCategories:Te,selIdx:xe,busy:O,generating:de,inputFocused:ae,onSetName:N,onSetDesc:P,onSetPrompt:ne,onInputNext:Mt,onInputFocus:()=>_e(!0),onInputBlur:()=>_e(!1),onSetStep:F,onSetSelectedIndex:we,onSelectLocation:Ze=>{we(Ze),j(Ze===0?"workspace":"global")},onSelectMethod:Ze=>{we(Ze),J(Ze===0?"qwen":"manual")},onSelectTools:Ze=>{var bt;we(Ze),be(((bt=Te[Ze])==null?void 0:bt.tools)??[])},onSave:()=>{O||vt()},t:s})]})}function au({idx:e,active:t,label:n,desc:r,badge:s,numbered:i=!1,onClick:o,onHover:a}){return h.jsxs("div",{className:`${Se.option} ${t?Se.optionActive:""}`,onClick:o,onMouseEnter:a,children:[h.jsx("span",{className:Se.optionIcon,"aria-hidden":"true"}),h.jsxs("span",{className:Se.optionContent,children:[h.jsxs("span",{className:Se.optionLabel,children:[i?`${e+1}. `:"",n,s&&h.jsx("span",{className:Se.badge,children:s})]}),r&&h.jsx("span",{className:Se.optionDesc,children:r})]})]})}function E_e({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:Se.text,children:o("agent.empty")}),h.jsx("div",{className:Se.text,children:o("agent.createFirstHint")})]}):h.jsx("div",{className:Se.manageList,children:e.map((u,d)=>{const f=t===d,m=f&&(n==null?void 0:n.name)===u.name?n:null,p=IB(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:`${Se.manageItem} ${f?Se.manageItemExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${Se.manageRow} ${f?Se.manageRowActive:""}`,onClick:()=>{l(null),s(d)},children:[h.jsx("span",{className:Se.manageIcon,"aria-hidden":"true"}),h.jsx("span",{className:Se.manageName,children:u.name}),h.jsx("span",{className:Se.levelTag,children:S_e(u.level,o)}),u.level==="user"&&c.has(u.name)?h.jsx("span",{className:Se.levelTag,children:o("agent.overriddenBadge")}):null,h.jsx("span",{className:`${Se.manageChevron} ${f?Se.manageChevronExpanded:""}`})]}),f?h.jsx("div",{className:Se.manageDetail,children:m?h.jsxs("div",{className:Se.manageDetailInner,children:[h.jsx("div",{className:Se.manageDetailHeader,children:p?h.jsx("div",{className:Se.manageActions,children:a===d?h.jsxs(h.Fragment,{children:[h.jsx("span",{className:Se.deleteText,children:r?o("agent.delete.loading"):o("agent.delete.confirm",{name:u.name})}),h.jsx("button",{type:"button",className:Se.manageButton,onClick:()=>l(null),disabled:r,children:o("common.cancel")}),h.jsx("button",{type:"button",className:`${Se.manageButton} ${Se.dangerButton}`,onClick:()=>i(d),disabled:r,children:o("agent.action.delete")})]}):h.jsx("button",{type:"button",className:`${Se.manageButton} ${Se.dangerButton}`,onClick:()=>l(d),disabled:r,children:o("agent.action.delete")})}):null}),h.jsxs("div",{className:Se.viewerField,children:[h.jsx("div",{className:Se.viewerSectionTitle,children:la(o("agent.toolsLabel"))}),h.jsx("div",{className:Se.viewerBlock,children:v})]}),h.jsxs("div",{className:Se.viewerField,children:[h.jsx("div",{className:Se.viewerSectionTitle,children:la(o("agent.filePathLabel"))}),h.jsx("div",{className:Se.viewerBlock,children:m.filePath||"—"})]}),m.model?h.jsxs("div",{className:Se.viewerRow,children:[h.jsx("span",{className:Se.viewerLabel,children:la(o("agent.modelLabel"))}),h.jsx("span",{children:m.model})]}):null,h.jsxs("div",{className:Se.viewerField,children:[h.jsx("div",{className:Se.viewerSectionTitle,children:la(o("agent.descriptionLabel"))}),h.jsx("div",{className:Se.viewerBlock,children:m.description||"—"})]}),h.jsxs("div",{className:Se.viewerField,children:[h.jsx("div",{className:Se.viewerSectionTitle,children:la(o("agent.systemPromptLabel"))}),h.jsx("div",{className:Se.viewerBlock,children:m.systemPrompt||"—"})]})]}):h.jsx("div",{className:Se.loading,children:o("common.loading")})}):null]},`${u.level}:${u.name}`)})})}function M_e({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:w,onSetSelectedIndex:x,onSelectLocation:k,onSelectMethod:T,onSelectTools:A,onSave:M,t:D}){const O=g.useRef(null),C=g.useRef(null),L=g.useRef(null);g.useEffect(()=>{var q,P,E,ne;d&&(t==="manual"?e===3?(q=O.current)==null||q.focus():e===4?(P=L.current)==null||P.focus():e===5&&((E=C.current)==null||E.focus()):e===3&&((ne=C.current)==null||ne.focus()))},[e,t,d]);const I=t==="manual"?6:4,B=I+1,F=t==="manual"?[D("agent.create.location"),D("agent.create.method"),D("agent.create.name"),D("agent.create.prompt"),D("agent.create.description"),D("agent.create.toolsSelection")]:[D("agent.create.location"),D("agent.create.method"),D("agent.create.describeAgent"),D("agent.create.toolsSelection")],W=q=>q===1?n==="workspace"?0:1:q===2?t==="qwen"?0:1:q===I?C_e(a,o):0,j=q=>{w(q),x(W(q)),t==="manual"&&(q===3||q===4||q===5)||t==="qwen"&&q===3?v():b()},K=()=>{e<=1||u||j(e-1)},J=()=>{if(!u){if(e===1){j(2);return}if(e===2){j(3);return}if(t==="manual"&&e===3){y("name");return}if(t==="manual"&&e===4){y("prompt");return}if(t==="manual"&&e===5||t==="qwen"&&e===3){y("desc");return}e===I&&(A(l),j(B))}},ee=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 N=null;if(e===1&&(N=h.jsx(h.Fragment,{children:h.jsxs("div",{className:Se.options,children:[h.jsx(au,{idx:0,active:l===0,label:D("agent.create.project.cli"),numbered:!0,onClick:()=>k(0)}),h.jsx(au,{idx:1,active:l===1,label:D("agent.create.user.cli"),numbered:!0,onClick:()=>k(1)})]})})),e===2&&(N=h.jsx(h.Fragment,{children:h.jsxs("div",{className:Se.options,children:[h.jsx(au,{idx:0,active:l===0,label:D("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>T(0)}),h.jsx(au,{idx:1,active:l===1,label:D("agent.create.method.manual"),numbered:!0,onClick:()=>T(1)})]})})),t==="manual"&&e===3&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.text,children:D("agent.create.nameHelp")}),h.jsx("input",{ref:O,className:Se.textInput,value:r,onChange:q=>f(q.target.value),onFocus:v,onBlur:b,placeholder:D("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.text,children:D("agent.create.promptHelp")}),h.jsx("textarea",{ref:L,className:Se.textArea,value:i,onChange:q=>p(q.target.value),onFocus:v,onBlur:b,placeholder:D("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.text,children:D("agent.create.manualDescHelp")}),h.jsx("textarea",{ref:C,className:Se.textArea,value:s,onChange:q=>m(q.target.value),onFocus:v,onBlur:b,placeholder:D("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.text,children:D("agent.create.qwenHint")}),u?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.text,children:D("agent.create.generatingConfig")}),h.jsx("div",{className:Se.footer,children:D("agent.footer.generating")})]}):h.jsx(h.Fragment,{children:h.jsx("textarea",{ref:C,className:Se.textArea,value:s,onChange:q=>m(q.target.value),onFocus:v,onBlur:b,placeholder:D("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===I){const q=a[l]??a[0],P=(q==null?void 0:q.tools)??[],E=(q==null?void 0:q.id)==="all"?D("agent.create.tools.allInfo"):P.length>0?P.join(", "):D("agent.create.tools.none"),ne=P.filter(NB),pe=P.filter(RB),be=P.filter(LB);N=h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.options,children:a.map((xe,we)=>h.jsx(au,{idx:we,active:l===we,label:xe.label,numbered:!0,onClick:()=>A(we)},xe.id))}),h.jsx("div",{className:Se.toolDetail,children:(q==null?void 0:q.id)==="all"?h.jsx("div",{className:Se.toolDetailBody,children:E}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Se.toolDetailTitle,children:D("agent.create.tools.selected")}),h.jsx("div",{className:Se.toolList,children:P.length===0?E:h.jsxs(h.Fragment,{children:[ne.length>0&&h.jsxs("div",{children:[D("agent.create.tools.readOnlyLabel")," ",ne.join(", ")]}),pe.length>0&&h.jsxs("div",{children:[D("agent.create.tools.editLabel")," ",pe.join(", ")]}),be.length>0&&h.jsxs("div",{children:[D("agent.create.tools.executionLabel")," ",be.join(", ")]})]})})]})})]})}if(e===B){const q=o.length===0?"*":o.join(", ");N=h.jsx(h.Fragment,{children:h.jsxs("div",{className:Se.summary,children:[h.jsxs("div",{className:Se.summaryRow,children:[h.jsx("span",{className:Se.summaryLabel,children:la(D("agent.create.name"))}),h.jsx("span",{className:Se.summaryValue,children:r||"—"})]}),h.jsxs("div",{className:Se.summaryRow,children:[h.jsx("span",{className:Se.summaryLabel,children:la(D("agent.location"))}),h.jsx("span",{className:Se.summaryValue,children:D(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),h.jsxs("div",{className:Se.summaryRow,children:[h.jsx("span",{className:Se.summaryLabel,children:la(D("agent.toolsLabel"))}),h.jsx("span",{className:Se.summaryValue,children:q})]}),h.jsx("div",{className:Se.summaryBlockTitle,children:la(D("agent.descriptionLabel"))}),h.jsx("div",{className:Se.summaryBlock,children:s||"—"}),h.jsx("div",{className:Se.summaryBlockTitle,children:la(D("agent.systemPromptLabel"))}),h.jsx("div",{className:Se.summaryBlock,children:i||"—"})]})})}return h.jsxs("div",{className:Se.createWizard,children:[h.jsx("div",{className:Se.createSteps,children:F.map((q,P)=>{const E=P+1;return h.jsxs("div",{className:`${Se.createStepPill} ${E===Math.min(e,I)?Se.createStepPillActive:""} ${E<Math.min(e,I)?Se.createStepPillDone:""}`,children:[h.jsx("span",{className:Se.createStepNumber,children:E}),h.jsx("span",{className:Se.createStepLabel,children:q})]},`${E}:${q}`)})}),h.jsx("div",{className:Se.createBody,children:N}),h.jsxs("div",{className:Se.createActions,children:[h.jsx("button",{type:"button",className:Se.manageButton,onClick:K,disabled:e<=1||u||c,children:D("common.previous")}),e===B?h.jsx("button",{type:"button",className:Se.manageButton,onClick:M,disabled:c,children:D(c?"agent.create.loading":"agent.create.save")}):h.jsx("button",{type:"button",className:Se.manageButton,onClick:J,disabled:ee,children:D("common.next")})]})]})}const I_e="_page_1np31_1",N_e="_tabs_1np31_11",R_e="_memoryCard_1np31_19",L_e="_memoryCardActive_1np31_35",j_e="_memoryTitle_1np31_44",D_e="_detailPath_1np31_48",O_e="_status_1np31_49",B_e="_actionButton_1np31_54",P_e="_primaryButton_1np31_55",$_e="_secondaryButton_1np31_56",z_e="_detail_1np31_48",F_e="_detailHeader_1np31_79",q_e="_detailTitleWrap_1np31_87",U_e="_actions_1np31_91",H_e="_content_1np31_105",V_e="_editor_1np31_106",W_e="_editorFooter_1np31_127",ps={page:I_e,tabs:N_e,memoryCard:R_e,memoryCardActive:L_e,memoryTitle:j_e,detailPath:D_e,status:O_e,actionButton:B_e,primaryButton:P_e,secondaryButton:$_e,detail:z_e,detailHeader:F_e,detailTitleWrap:q_e,actions:U_e,content:H_e,editor:V_e,editorFooter:W_e};function lA(e,t){return e.find(n=>n.scope===t)}function cA(e,t){return t(e==="global"?"memory.global":"memory.project")}function G_e({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:r}){var N,q;const{t:s}=lt(),{files:i,loading:o,error:a,readFile:l,reload:c,writeMemory:u}=WH({autoLoad:!0}),d=g.useRef(null),f=g.useRef(0),[m,p]=g.useState("workspace"),[y,v]=g.useState("view"),[b,w]=g.useState(""),[x,k]=g.useState(""),[T,A]=g.useState(!1),[M,D]=g.useState(!1),[O,C]=g.useState(null),L=g.useRef(0),I=g.useMemo(()=>{const P=lA(i,"global"),E=lA(i,"workspace");return[{scope:"workspace",title:s("memory.project"),description:s("memory.project.desc"),fallbackPath:"QWEN.md",file:E},{scope:"global",title:s("memory.global"),description:s("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:P}]},[i,s]),B=I.find(P=>P.scope===m)??I[0],F=g.useCallback((P,E)=>{const ne=++f.current;if(v(E),C(null),w(""),k(""),!(P!=null&&P.file)){E==="edit"&&requestAnimationFrame(()=>{var pe;return(pe=d.current)==null?void 0:pe.focus()});return}A(!0),l(P.file.path).then(pe=>{ne===f.current&&(w(pe.content),k(pe.content),pe.truncated&&C(s("memory.fileTruncated")),requestAnimationFrame(()=>{var be;return(be=d.current)==null?void 0:be.focus()}))}).catch(pe=>{if(ne!==f.current)return;const be=pe instanceof Error?pe.message:String(pe);C(be),P.scope!=="global"&&(r==null||r(be,"error"))}).finally(()=>{ne===f.current&&A(!1)})},[r,l,s]);g.useEffect(()=>{B&&F(B,y)},[(N=B==null?void 0:B.file)==null?void 0:N.path,B==null?void 0:B.scope]),g.useEffect(()=>{a&&C(a.message)},[a]),g.useEffect(()=>{e<=0||c().then(()=>C(s("memory.refreshed"))).catch(P=>{const E=P instanceof Error?P.message:String(P);C(E),r==null||r(E,"error")})},[r,e,c,s]),g.useEffect(()=>{if(t<=0||L.current===t)return;L.current=t;const P=n==="global"?"global":"workspace";p(P);const E=I.find(ne=>ne.scope===P);F(E,"edit")},[n,t,I,F]);const W=P=>{p(P.scope),F(P,"view")},j=()=>{B&&F(B,"edit")},K=()=>{if(B){if(!x.trim()){C(s("memory.contentEmpty"));return}D(!0),C(null),u({scope:B.scope,mode:"replace",content:x}).then(P=>{const E=s("memory.saved",{scope:cA(B.scope,s),bytes:P.bytesWritten,path:P.filePath});w(x),v("view"),C(E),r==null||r(E,"status"),c().catch(()=>{})}).catch(P=>{const E=P instanceof Error?P.message:String(P);C(E),r==null||r(E,"error")}).finally(()=>D(!1))}},J=((q=B==null?void 0:B.file)==null?void 0:q.path)??(B==null?void 0:B.fallbackPath)??"",ee=O??(o?s("memory.loading"):null);return h.jsxs("div",{className:ps.page,children:[h.jsx("nav",{className:ps.tabs,"aria-label":s("memory.menu"),children:I.map(P=>{const E=P.scope===m;return h.jsx("button",{type:"button",className:`${ps.memoryCard} ${E?ps.memoryCardActive:""}`,onClick:()=>W(P),children:h.jsx("span",{className:ps.memoryTitle,children:P.title})},P.scope)})}),h.jsxs("section",{className:ps.detail,children:[h.jsxs("header",{className:ps.detailHeader,children:[h.jsx("div",{className:ps.detailTitleWrap,children:h.jsx("div",{className:ps.detailPath,children:J})}),h.jsx("div",{className:ps.actions,children:h.jsx("button",{type:"button",className:ps.actionButton,onClick:j,children:s("settings.action.edit")})})]}),ee&&h.jsx("div",{className:ps.status,children:ee}),y==="edit"?h.jsxs(h.Fragment,{children:[h.jsx("textarea",{ref:d,className:ps.editor,value:x,disabled:M||T,onChange:P=>k(P.target.value),placeholder:s("memory.placeholder",{scope:B?cA(B.scope,s):""})}),h.jsxs("div",{className:ps.editorFooter,children:[h.jsx("button",{type:"button",className:ps.secondaryButton,disabled:M,onClick:()=>{k(b),v("view")},children:s("common.cancel")}),h.jsx("button",{type:"button",className:ps.primaryButton,disabled:M||T,onClick:K,children:s(M?"memory.saving":"memory.save")})]})]}):h.jsx("pre",{className:ps.content,children:T?s("memory.loadingFile"):b||s("memory.noFiles")})]})]})}const K_e="_panel_cxp6w_1",Y_e="_steps_cxp6w_10",X_e="_stepPill_cxp6w_18",Q_e="_stepPillActive_cxp6w_29",J_e="_stepPillDone_cxp6w_34",Z_e="_stepNumber_cxp6w_38",e5e="_stepLabel_cxp6w_49",t5e="_body_cxp6w_55",n5e="_text_cxp6w_59",r5e="_muted_cxp6w_64",s5e="_options_cxp6w_68",i5e="_option_cxp6w_68",o5e="_optionActive_cxp6w_90",a5e="_label_cxp6w_94",l5e="_optionText_cxp6w_98",c5e="_description_cxp6w_112",u5e="_input_cxp6w_119",d5e="_preview_cxp6w_135",h5e="_error_cxp6w_146",f5e="_link_cxp6w_150",m5e="_terms_cxp6w_161",p5e="_actions_cxp6w_169",g5e="_actionButton_cxp6w_177",kn={panel:K_e,steps:Y_e,stepPill:X_e,stepPillActive:Q_e,stepPillDone:J_e,stepNumber:Z_e,stepLabel:e5e,body:t5e,text:n5e,muted:r5e,options:s5e,option:i5e,optionActive:o5e,label:a5e,optionText:l5e,description:c5e,input:u5e,preview:d5e,error:h5e,link:f5e,terms:m5e,actions:p5e,actionButton:g5e},y5e=[{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 Ef(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function uA(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function b5e(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 w5e(e){const t=e.trim();return t?t.length<=6?"***":`${t.slice(0,3)}...${t.slice(-4)}`:"(not set)"}function f4(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function v5e({onMessage:e,onClose:t}){const{t:n}=lt(),r=Rc(),[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"),[w,x]=g.useState(null),[k,T]=g.useState("openai"),[A,M]=g.useState(""),[D,O]=g.useState(""),[C,L]=g.useState(""),[I,B]=g.useState(!1),[F,W]=g.useState(!1),[j,K]=g.useState(!0),[J,ee]=g.useState(!0),[N,q]=g.useState(!1),[P,E]=g.useState(!1),[ne,pe]=g.useState(""),[be,xe]=g.useState(!0),[we,de]=g.useState(!1),[se,ae]=g.useState(null);g.useEffect(()=>{r.getAuthProviders().then(X=>{y(X),xe(!1)}).catch(X=>{ae(X instanceof Error?X.message:String(X)),xe(!1)})},[r]);const _e=g.useMemo(()=>(p==null?void 0:p.groups)??[],[p]),qe=g.useMemo(()=>{var ue;return(((ue=_e.find(me=>me.id===v))==null?void 0:ue.providerIds)??[]).map(me=>p==null?void 0:p.providers.find(We=>We.id===me)).filter(me=>!!me)},[p,v,_e]),He=g.useMemo(()=>(w==null?void 0:w.steps)??[],[w==null?void 0:w.steps]),re=He[f],ye=(w==null?void 0:w.showAdvancedConfig)===!0,Te=g.useMemo(()=>F?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[F]),ke=Te.indexOf("context"),vt=re==="apiKey"||re==="models"||re==="baseUrl"&&!Array.isArray(w==null?void 0:w.baseUrl),[rt,Mt]=g.useState(0),Pt=g.useCallback((X,ue="providers")=>{var We,At;x(X),d(ue);const me=((We=X.protocolOptions)==null?void 0:We[0])??X.protocol;T(me),typeof X.baseUrl=="string"?M(X.baseUrl):Array.isArray(X.baseUrl)?M(((At=X.baseUrl[0])==null?void 0:At.url)??""):M(Ef(me)),O(""),L(uA(X)),B(!1),W(!1),K(!0),ee(!0),q(!1),E(!1),pe(""),m(0),Mt(0),ae(null),i(X.steps.length>0?"step":"review")},[]),Ze=g.useCallback(()=>{if(ae(null),s==="groups"){t();return}if(s==="providers"){i("groups");return}if(s==="review"){if(He.length===0){i(u);return}i("step"),m(Math.max(0,He.length-1));return}if(f>0){m(X=>X-1),Mt(0);return}i(u)},[t,u,f,He.length,s]),bt=g.useCallback(()=>{if(!w||we)return;de(!0),ae(null);const X=Number(ne);r.installAuthProvider({providerId:w.id,protocol:k,baseUrl:A,apiKey:D,modelIds:f4(C),advancedConfig:I||F||Number.isFinite(X)&&X>0?{...I?{enableThinking:!0}:{},...F?{multimodal:{...j?{image:!0}:{},...J?{video:!0}:{},...N?{audio:!0}:{},...P?{pdf:!0}:{}}}:{},...Number.isFinite(X)&&X>0?{contextWindowSize:X}:{}}:void 0}).then(ue=>{e(ue.message),t()}).catch(ue=>{const me=ue instanceof Error?ue.message:String(ue);ae(me),e(me,"error")}).finally(()=>de(!1))},[D,A,ne,F,N,j,P,J,C,t,e,k,w,we,I,r]),ft=g.useCallback(()=>{if(w){if(re==="baseUrl"){const X=A.trim()||Ef(k);if(!X){ae(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(X)){ae(n("auth.baseUrlInvalid"));return}A.trim()||M(X)}if(re==="apiKey"&&D.trim().length===0){ae(n("auth.apiKeyRequired"));return}if(re==="models"&&f4(C).length===0){ae(n("auth.modelsRequired"));return}ae(null),f>=He.length-1?ye?i("review"):bt():(m(X=>X+1),Mt(0))}},[D,A,re,C,k,w,bt,ye,f,He.length,n]),ie=g.useCallback(X=>{switch(X){case"thinking":B(ue=>!ue);return;case"modality":W(ue=>!ue);return;case"image":K(ue=>!ue);return;case"video":ee(ue=>!ue);return;case"audio":q(ue=>!ue);return;case"pdf":E(ue=>!ue);return;case"context":ft();return;default:return}},[ft]),H=g.useCallback(()=>{if(s==="groups"){const X=_e[o];if(!X)return;if(X.id==="custom"){const ue=X.providerIds.map(me=>p==null?void 0:p.providers.find(We=>We.id===me)).find(me=>!!me);ue&&Pt(ue,"groups");return}b(X.id),c(0),i("providers");return}if(s==="providers"){const X=qe[l];X&&Pt(X,"providers");return}if(s==="review"){bt();return}if(!(!w||!re)){if(re==="protocol"){const X=(w.protocolOptions??[w.protocol])[rt];X&&(T(X),w.baseUrl||M(Ef(X))),ft();return}if(re==="baseUrl"&&Array.isArray(w.baseUrl)){const X=w.baseUrl[rt];X&&M(X.url),ft();return}if(re==="advancedConfig"){ie(Te[rt]);return}ft()}},[re,p,ft,o,_e,rt,w,l,qe,bt,Pt,s,ie,Te]),oe=g.useCallback(X=>{if(s==="groups"){const ue=_e[X];if(!ue)return;if(ue.id==="custom"){const me=ue.providerIds.map(We=>p==null?void 0:p.providers.find(At=>At.id===We)).find(We=>!!We);me&&Pt(me,"groups");return}b(ue.id),c(0),i("providers");return}if(s==="providers"){const ue=qe[X];ue&&Pt(ue,"providers");return}if(!w||!re){s==="review"&&bt();return}if(re==="protocol"){const ue=(w.protocolOptions??[w.protocol])[X];ue&&(T(ue),w.baseUrl||M(Ef(ue))),ft();return}if(re==="baseUrl"&&Array.isArray(w.baseUrl)){const ue=w.baseUrl[X];ue&&M(ue.url),ft();return}re==="advancedConfig"&&ie(Te[X])},[re,p,ft,_e,ie,Te,w,qe,bt,Pt,s]),De=(X,ue,me)=>h.jsx("div",{className:kn.options,children:X.map((We,At)=>h.jsx("button",{type:"button",className:`${kn.option} ${ue===At?kn.optionActive:""}`,onClick:()=>{me(At),oe(At)},children:h.jsxs("div",{className:kn.optionText,children:[h.jsx("div",{className:kn.label,children:We.label}),We.description&&h.jsx("div",{className:kn.description,children:We.description})]})},We.value))}),tt=()=>{if(!w||!re)return null;if(re==="protocol"){const me=w.protocolOptions??[w.protocol];return De(y5e.filter(We=>me.includes(We.value)),rt,Mt)}if(re==="baseUrl")return Array.isArray(w.baseUrl)?De(w.baseUrl.map(me=>({value:me.url,label:me.label,description:me.url})),rt,Mt):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:kn.text,children:n("auth.baseUrlPrompt")}),h.jsx("input",{className:kn.input,value:A,placeholder:Ef(k),onChange:me=>{M(me.target.value),ae(null)},onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),me.stopPropagation(),ft())},autoFocus:!0}),w.documentationUrl&&h.jsx("a",{className:kn.link,href:w.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(re==="apiKey")return h.jsxs(h.Fragment,{children:[w.documentationUrl&&h.jsxs("a",{className:kn.link,href:w.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",w.documentationUrl]}),h.jsx("input",{className:kn.input,type:"password",value:D,placeholder:w.apiKeyPlaceholder??"sk-...",onChange:me=>{O(me.target.value),ae(null)},onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),me.stopPropagation(),ft())},autoFocus:!0})]});if(re==="models"){const me=uA(w);return h.jsxs(h.Fragment,{children:[me&&h.jsx("div",{className:kn.muted,children:n("auth.modelsPrompt",{modelIds:me})}),h.jsx("input",{className:kn.input,value:C,placeholder:me||"model-id-1, model-id-2",onChange:We=>{L(We.target.value),ae(null)},onKeyDown:We=>{We.key==="Enter"&&(We.preventDefault(),We.stopPropagation(),ft())},autoFocus:!0})]})}const X=me=>me?"◉":"○",ue=[{value:"thinking",label:`${X(I)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${X(F)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return F&&ue.push({value:"image",label:`${X(j)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${X(J)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${X(N)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${X(P)} ${n("auth.advanced.modalityPdf")}`}),ue.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${ne||"auto"}`,description:n("auth.advanced.contextDesc")}),h.jsxs(h.Fragment,{children:[h.jsx("div",{className:kn.text,children:n("auth.advanced.prompt")}),De(ue,rt,Mt),h.jsx("input",{className:kn.input,value:ne,placeholder:"auto",onChange:me=>pe(me.target.value.replace(/[^0-9]/g,"")),onFocus:()=>Mt(ke),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),me.stopPropagation(),ft())}})]})},Ct=g.useMemo(()=>{if(!w)return"";const X=w.envKey??`${k.toUpperCase()}_API_KEY`,ue=f4(C),me={};if(I&&(me.extra_body={enable_thinking:!0}),F){const jt={};j&&(jt.image=!0),J&&(jt.video=!0),N&&(jt.audio=!0),P&&(jt.pdf=!0),Object.keys(jt).length>0&&(me.modalities=jt)}const We=Number(ne);Number.isFinite(We)&&We>0&&(me.contextWindowSize=We);const At=Object.keys(me).length>0;return JSON.stringify({env:{[X]:w5e(D)},modelProviders:{[k]:ue.map(jt=>({id:jt,name:jt,baseUrl:A.trim(),envKey:X,...At?{generationConfig:me}:{}}))},security:{auth:{selectedType:k}},model:{name:ue[0]}},null,2)},[D,A,ne,F,N,j,P,J,C,k,w,I]),Et=g.useMemo(()=>{const X=[n("auth.step.group"),n("auth.step.provider")];return w&&(X.push(...He.map(ue=>b5e(ue,w,n))),ye&&X.push(n("auth.review"))),X},[w,ye,He,n]),Qt=g.useMemo(()=>s==="groups"?1:s==="providers"?2:s==="step"?Math.min(3+f,Et.length):Et.length,[f,Et.length,s]),on=be?h.jsx("div",{className:kn.muted,children:n("common.loading")}):s==="groups"?h.jsxs(h.Fragment,{children:[De(_e.map(X=>({value:X.id,label:n(X.label),description:n(X.description)})),o,a),h.jsxs("div",{className:kn.terms,children:[h.jsxs("div",{children:[n("auth.termsTitle"),":"]}),h.jsx("a",{className:kn.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"?De(qe.map(X=>({value:X.id,label:n(X.label),description:n(X.description)})),l,c):s==="step"?tt():h.jsxs(h.Fragment,{children:[h.jsx("div",{className:kn.text,children:n("auth.reviewText")}),h.jsx("div",{className:kn.preview,children:Ct})]}),he=()=>{if(s==="review"){bt();return}if(vt||re==="advancedConfig"){ft();return}H()};return h.jsxs("div",{className:kn.panel,children:[h.jsx("div",{className:kn.steps,children:Et.map((X,ue)=>{const me=ue+1;return h.jsxs("div",{className:`${kn.stepPill} ${me===Qt?kn.stepPillActive:""} ${me<Qt?kn.stepPillDone:""}`,children:[h.jsx("span",{className:kn.stepNumber,children:me}),h.jsx("span",{className:kn.stepLabel,children:X})]},`${me}:${X}`)})}),h.jsx("div",{className:kn.body,children:on}),se&&h.jsx("div",{className:kn.error,children:se}),h.jsxs("div",{className:kn.actions,children:[h.jsx("button",{type:"button",className:kn.actionButton,onClick:Ze,disabled:s==="groups"||be||we,children:n("common.previous")}),h.jsx("button",{type:"button",className:kn.actionButton,onClick:he,disabled:be||we,children:n(s==="review"?we?"auth.saving":"auth.save":"common.next")})]})]})}function x5e(e){return e.displayName||e.name}const jB="tools-list",dA=e=>`${jB}-opt-${e}`;function _5e(){const{t:e}=lt(),{status:t,tools:n,loading:r,error:s}=wN({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 y,v;s?l(s.message):(v=(y=t==null?void 0:t.errors)==null?void 0:y[0])!=null&&v.error?l(t.errors[0].error):t&&l(null)},[t,s]);const f=g.useCallback(y=>{u(v=>v.has(y.name)?new Set:new Set([y.name]))},[]);g.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),g.useEffect(()=>{var v;const y=(v=d.current)==null?void 0:v.children[i];y==null||y.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:m}=Bc({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:y=>{const v=n[y];v!=null&&v.description&&f(v)}}),p=g.useMemo(()=>{if(!t)return"";const y=n.filter(v=>v.enabled).length;return e("tools.summary",{enabled:y,total:n.length})},[t,n,e]);return h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[p&&h.jsx("div",{className:Me("picker-search"),children:h.jsx("span",{className:Me("picker-search-hint"),children:p})}),(a||r)&&h.jsx("div",{className:Me("picker-search"),children:h.jsx("span",{className:Me("picker-search-hint"),children:a||e("tools.loading")})}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:jB,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?dA(i):void 0,className:Me("picker-list",m?"picker-keyboard-only":void 0),ref:d,children:[!r&&n.length===0&&h.jsx("div",{className:Me("picker-empty"),children:e("tools.empty")}),n.map((y,v)=>{const b=c.has(y.name),w=y.description??"";return h.jsxs("div",{id:dA(v),role:"option","aria-selected":!1,"aria-expanded":w?b:void 0,className:Me("picker-item","picker-session-item","tools-picker-item",v===i?"selected":void 0,b?"tools-picker-item-expanded":void 0),onClick:()=>{o(v),y.description&&f(y)},onMouseMove:()=>o(v),children:[h.jsxs("div",{className:Me("picker-item-row"),children:[h.jsx("span",{className:Me("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:Me("picker-item-title"),children:x5e(y)}),h.jsx("span",{className:Me("tools-status-badge",y.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:y.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),w?h.jsx("svg",{className:Me("tools-item-chevron",b?"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]}),b&&w&&h.jsx("div",{className:Me("tools-desc-expanded"),children:h.jsx("div",{className:Me("tools-desc-body"),children:w})})]},y.name)})]})]})}const DB="update available";function k5e(e){return e.displayName||e.name}function OB(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function S5e(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 dd(e){return e&&e.length>0?e.join(", "):"-"}const T5e=Bk;function C5e(){const{t:e}=lt(),t=gl(),n=Rc(),r=Hu(),[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),[w,x]=g.useState(null),k=g.useCallback(()=>(m(!0),n.loadExtensionsStatus().then(O=>{var L,I;const C=O.extensions??[];i(C),x(((I=(L=O.errors)==null?void 0:L[0])==null?void 0:I.error)??null),a(B=>B&&C.some(F=>F.name===B)?B:null)}).catch(O=>{x(O instanceof Error?O.message:String(O))}).finally(()=>m(!1))),[n]),T=g.useCallback(()=>{const O=t.clientId;return O?(y(!0),n.checkExtensionUpdates(O).then(C=>d(C.states)).catch(C=>{x(C instanceof Error?C.message:String(C))}).finally(()=>y(!1))):(x(e("extensions.install.waitForSession")),Promise.resolve())},[n,t.clientId,e]),A=g.useCallback(()=>{const O=t.clientId;if(!O){x(e("extensions.install.waitForSession"));return}y(!0),n.refreshExtensions(O).then(async C=>{x(e("extensions.manage.refreshed",{refreshed:C.refreshed,failed:C.failed})),await k(),await T()}).catch(C=>{x(C instanceof Error?C.message:String(C))}).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 M=g.useCallback((O,C)=>{const L=t.clientId;if(!L){x(e("extensions.install.waitForSession"));return}b(O),x(null),C(L).then(()=>x(e("extensions.manage.queued",{name:O}))).catch(I=>{x(I instanceof Error?I.message:String(I))}).finally(()=>b(null))},[t.clientId,e]),D=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:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search","extensions-toolbar"),children:[h.jsx("span",{className:Me("picker-search-hint"),children:w||D}),h.jsx("button",{type:"button",className:Me("dialog-inline-button"),disabled:f||p,onClick:A,children:e("common.refresh")})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{className:Me("picker-list"),children:[!f&&s.length===0&&h.jsx("div",{className:Me("picker-empty"),children:e("extensions.manage.empty")}),s.map(O=>{const C=u[O.name]??O.updateState,L=o===O.name,I=v===O.name;return h.jsxs("div",{className:Me("picker-item","picker-session-item","tools-picker-item",L?"selected":void 0,L?"tools-picker-item-expanded":void 0),children:[h.jsxs("button",{type:"button",className:Me("extensions-row-button"),onClick:()=>{a(L?null:O.name),c(null)},children:[h.jsx("span",{className:Me("tools-item-icon"),"aria-hidden":"true"}),h.jsx("span",{className:Me("picker-item-title"),children:k5e(O)}),h.jsxs("span",{className:Me("picker-item-badge"),children:["v",O.version]}),h.jsx("span",{className:Me("tools-status-badge",O.isActive?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:OB(O,e)}),h.jsx("span",{className:Me("tools-status-badge",C===DB?"tools-status-badge-busy":void 0),children:S5e(C,e)}),h.jsx("svg",{className:Me("tools-item-chevron",L?"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"})})]}),L&&h.jsx(A5e,{extension:O,updateState:C,busy:I,confirmingUninstall:l===O.name,onUpdate:()=>M(O.name,B=>n.updateExtension(O.name,B)),onToggleScope:(B,F)=>M(O.name,W=>B==="enable"?n.enableExtension(O.name,{scope:F},W):n.disableExtension(O.name,{scope:F},W)),onRequestUninstall:()=>c(O.name),onCancelUninstall:()=>c(null),onConfirmUninstall:()=>{M(O.name,B=>n.uninstallExtension(O.name,B)),c(null),a(null)}})]},O.id||O.name)})]})]})}function A5e({extension:e,updateState:t,busy:n,confirmingUninstall:r,onUpdate:s,onToggleScope:i,onRequestUninstall:o,onCancelUninstall:a,onConfirmUninstall:l}){const{t:c}=lt(),u=e.details,d=e.isActive?"disable":"enable";return h.jsxs("div",{className:Me("extensions-detail"),children:[h.jsxs("div",{className:Me("extensions-detail-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-inline-button"),disabled:n||t!==DB,onClick:s,children:c("extensions.manage.update")}),h.jsxs("button",{type:"button",className:Me("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:Me("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:Me("dialog-danger-button"),disabled:n,onClick:o,children:c("extensions.manage.uninstallAction")})]}),r&&h.jsxs("div",{className:Me("extensions-confirm"),children:[h.jsx("span",{children:c("extensions.manage.uninstallConfirm",{name:e.name})}),h.jsxs("div",{className:Me("dialog-inline-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-danger-button"),disabled:n,onClick:l,children:c("extensions.manage.uninstallAction")}),h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:a,children:c("common.cancel")})]})]}),h.jsxs("div",{className:Me("extensions-detail-grid"),children:[h.jsx(Mo,{label:c("extensions.manage.name"),value:e.name}),h.jsx(Mo,{label:c("extensions.manage.version"),value:e.version}),h.jsx(Mo,{label:c("extensions.manage.status"),value:OB(e,c)}),h.jsx(Mo,{label:c("extensions.manage.path"),value:e.path}),h.jsx(Mo,{label:c("extensions.manage.source"),value:e.source??"-"}),h.jsx(Mo,{label:c("extensions.manage.commands"),value:dd(u==null?void 0:u.commands)}),h.jsx(Mo,{label:c("extensions.manage.skills"),value:dd(u==null?void 0:u.skills)}),h.jsx(Mo,{label:c("extensions.manage.agents"),value:dd(u==null?void 0:u.agents)}),h.jsx(Mo,{label:c("extensions.manage.mcpServers"),value:dd(u==null?void 0:u.mcpServers)}),h.jsx(Mo,{label:c("extensions.manage.contextFiles"),value:dd(u==null?void 0:u.contextFiles)}),h.jsx(Mo,{label:c("extensions.manage.settings"),value:dd(u==null?void 0:u.settings)})]})]})}function Mo({label:e,value:t}){return h.jsxs("div",{className:Me("extensions-detail-field"),children:[h.jsx("span",{className:Me("extensions-detail-label"),children:T5e(e)}),h.jsx("span",{className:Me("extensions-detail-value"),children:t})]})}const E5e="_panel_1nmt9_1",M5e="_embeddedPanel_1nmt9_16",I5e="_header_1nmt9_26",N5e="_title_1nmt9_32",R5e="_secondary_1nmt9_36",L5e="_hint_1nmt9_37",j5e="_empty_1nmt9_38",D5e="_busy_1nmt9_39",O5e="_scopeTabs_1nmt9_49",B5e="_scopeTab_1nmt9_49",P5e="_scopeTabActive_1nmt9_71",$5e="_settingsPage_1nmt9_76",z5e="_sidebar_1nmt9_83",F5e="_categoryButton_1nmt9_92",q5e="_categoryButtonActive_1nmt9_110",U5e="_categoryCount_1nmt9_115",H5e="_content_1nmt9_121",V5e="_card_1nmt9_128",W5e="_cardBody_1nmt9_142",G5e="_cardTitle_1nmt9_146",K5e="_cardDescription_1nmt9_155",Y5e="_scopeHint_1nmt9_156",X5e="_scopeBadge_1nmt9_164",Q5e="_cardControl_1nmt9_174",J5e="_select_1nmt9_180",Z5e="_actionButton_1nmt9_181",eke="_editInput_1nmt9_182",tke="_editor_1nmt9_219",nke="_switchOn_1nmt9_241",rke="_switchKnob_1nmt9_246",ske="_footer_1nmt9_261",Jt={panel:E5e,embeddedPanel:M5e,header:I5e,title:N5e,secondary:R5e,hint:L5e,empty:j5e,busy:D5e,scopeTabs:O5e,scopeTab:B5e,scopeTabActive:P5e,settingsPage:$5e,sidebar:z5e,categoryButton:F5e,categoryButtonActive:q5e,categoryCount:U5e,content:H5e,card:V5e,cardBody:W5e,cardTitle:G5e,cardDescription:K5e,scopeHint:Y5e,scopeBadge:X5e,cardControl:Q5e,select:J5e,actionButton:Z5e,editInput:eke,editor:tke,switch:"_switch_1nmt9_231",switchOn:nke,switchKnob:rke,footer:ske},ike=new Set(["fastModel"]),oke=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline"]);function Sb(e,t,n){const r=e(t);return r===t?n:r}function ake(e,t){return Sb(t,`settings.category.${e}`,e)}function lke(e,t){return Sb(t,`settings.label.${e.key}`,e.label)}function cke(e,t){if(e.description)return Sb(t,`settings.description.${e.key}`,e.description)}function BB(e,t,n,r){return Sb(r,`settings.option.${e.key}.${String(t)}`,n)}function m4(e,t,n){const r=$B(e,t);if(r==null)return"";if(e.key===nu){const i=J_(r,Ns.Dark);return n(`theme.${i}`)}if(e.key===cm){const i=Y_(r);return i?X_(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?BB(e,i.value,i.label,n):String(r)}const s=String(r);return s.length>24?s.slice(0,21)+"...":s}function PB(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function uke(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return PB(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function $B(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function dke(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:ake(r,t),items:s}))}function hke({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:r,chatWidthMode:s,onChatWidthModeChange:i,embedded:o=!1}){const{t:a}=lt(),{status:l,settings:c,loading:u,error:d,reload:f,setValue:m}=e,[p,y]=g.useState("workspace"),[v,b]=g.useState(""),[w,x]=g.useState(null),[k,T]=g.useState(null),[A,M]=g.useState(null),D=g.useRef(null),[O,C]=g.useState(!1),L=u&&!l,I=c.find(P=>P.key===nu),B=J_(I==null?void 0:I.values.effective),F=c.find(P=>P.key===cm),W=Y_(F==null?void 0:F.values.effective),j=g.useMemo(()=>{const P=c.filter(be=>!oke.has(be.key)),E=dke(P,a).map(be=>({id:be.category,label:be.category,items:be.items.map(xe=>({type:"setting",setting:xe}))})),ne={type:"local",localKey:"chatWidth"},pe=E.find(be=>be.items.some(xe=>xe.type==="setting"&&xe.setting.key===nu));if(pe){const be=pe.items.findIndex(xe=>xe.type==="setting"&&xe.setting.key===nu);pe.items.splice(be+1,0,ne)}else E.push({id:a("settings.category.UI"),label:a("settings.category.UI"),items:[ne]});return E},[c,a]);g.useEffect(()=>{j.length!==0&&(j.some(P=>P.id===v)||b(j[0].id))},[v,j]),g.useEffect(()=>{var P;d?T(d.message):(P=l==null?void 0:l.warnings)!=null&&P.length?T(l.warnings.map(E=>a("settings.corrupted",{recovered:E.recovered?"true":"false"})).join("; ")):c.length>0&&!O&&T(null)},[d,c,l,a,O]),g.useEffect(()=>{A&&setTimeout(()=>{var P;return(P=D.current)==null?void 0:P.focus()},0)},[A]);const K=g.useCallback((P,E)=>{O||T(null),x(P),m("workspace",P,E).then(async ne=>{try{await f()}catch{}ne!=null&&ne.requiresRestart&&P!==cm&&(C(!0),T(a("settings.requiresRestart")))}).catch(ne=>{T(ne instanceof Error?ne.message:String(ne))}).finally(()=>x(null))},[f,O,m,a]),J=g.useCallback(()=>{if(!A)return;const P=c.find(ne=>ne.key===A.key);if(!P){M(null);return}let E=A.draft;if(P.type==="number"){const ne=A.draft.trim();if(ne===""||!Number.isFinite(Number(ne))){T(a("settings.invalidNumber"));return}E=Number(ne)}M(null),K(P.key,E)},[A,c,K,a]),ee=j.find(P=>P.id===v)??j[0],N=(P,E,ne,pe=!1)=>h.jsx("select",{className:Jt.select,value:P,disabled:pe,onChange:be=>E(be.target.value),children:ne.map(be=>h.jsx("option",{value:be.value,children:be.label},be.value))}),q=P=>{var xe;const E=$B(P,p),ne=w===P.key,pe=(A==null?void 0:A.key)===P.key;if(p!=="workspace")return h.jsx("button",{type:"button",className:Jt.actionButton,disabled:!0,title:a("settings.readOnly"),children:m4(P,p,a)||a("settings.readOnly")});if(P.key===nu)return N(B??Ns.Dark,we=>{const de=we;r(de),K(nu,PV(de))},AN.map(we=>({value:we,label:a(`theme.${we}`)})),ne);if(P.key===cm)return N(W??"zh-CN",we=>t(we),xV.map(we=>({value:we,label:X_(we)})),ne);if(ike.has(P.key))return h.jsx("button",{type:"button",className:Jt.actionButton,onClick:()=>n(P.key),children:m4(P,p,a)||a("settings.action.edit")});if(P.type==="boolean"){const we=E===!0;return h.jsx("button",{type:"button",className:`${Jt.switch} ${we?Jt.switchOn:""}`,disabled:ne,onClick:()=>K(P.key,!we),"aria-pressed":we,children:h.jsx("span",{className:Jt.switchKnob})})}if(P.type==="enum"&&((xe=P.options)!=null&&xe.length)){const we=P.options.findIndex(de=>de.value===E);return N(we>=0?String(we):"",de=>{var ae;const se=(ae=P.options)==null?void 0:ae[Number(de)];se&&K(P.key,se.value)},P.options.map((de,se)=>({value:String(se),label:BB(P,de.value,de.label,a)})),ne)}return pe?h.jsxs("div",{className:Jt.editor,children:[h.jsx("input",{ref:D,className:Jt.editInput,type:P.type==="number"?"number":"text",value:A.draft,onChange:we=>M({key:A.key,draft:we.target.value}),onKeyDown:we=>{we.key==="Enter"&&(we.preventDefault(),J()),we.key==="Escape"&&(we.preventDefault(),M(null))}}),h.jsx("button",{type:"button",className:Jt.actionButton,onClick:J,children:a("settings.action.save")})]}):h.jsx("button",{type:"button",className:Jt.actionButton,disabled:ne,onClick:()=>M({key:P.key,draft:String(E??"")}),children:m4(P,p,a)||a("settings.action.edit")})};return h.jsxs("div",{className:`${Jt.panel} ${o?Jt.embeddedPanel:""}`,"data-keyboard-scope":!0,children:[!o&&h.jsxs("div",{className:Jt.header,children:[h.jsx("span",{className:Jt.title,children:a("settings.title")}),h.jsx("span",{className:Jt.secondary,children:a("settings.scope.workspace")})]}),(k||L)&&h.jsx("div",{className:Jt.hint,children:k||a("settings.loading")}),h.jsxs("div",{className:Jt.scopeTabs,role:"tablist",children:[h.jsx("button",{type:"button",role:"tab","aria-selected":p==="workspace",className:`${Jt.scopeTab} ${p==="workspace"?Jt.scopeTabActive:""}`,onClick:()=>y("workspace"),children:a("settings.scope.workspace")}),h.jsx("button",{type:"button",role:"tab","aria-selected":p==="user",className:`${Jt.scopeTab} ${p==="user"?Jt.scopeTabActive:""}`,onClick:()=>{M(null),y("user")},children:a("settings.scope.user")})]}),h.jsxs("div",{className:Jt.settingsPage,children:[h.jsx("nav",{className:Jt.sidebar,"aria-label":a("settings.title"),children:j.map(P=>h.jsxs("button",{type:"button",className:`${Jt.categoryButton} ${P.id===v?Jt.categoryButtonActive:""}`,onClick:()=>b(P.id),children:[h.jsx("span",{children:P.label}),h.jsx("span",{className:Jt.categoryCount,children:P.items.length})]},P.id))}),h.jsxs("section",{className:Jt.content,children:[!u&&!ee&&h.jsx("div",{className:Jt.empty,children:a("settings.empty")}),ee==null?void 0:ee.items.map(P=>{if(P.type==="local")return h.jsxs("div",{className:Jt.card,children:[h.jsxs("div",{className:Jt.cardBody,children:[h.jsx("div",{className:Jt.cardTitle,children:a("settings.label.ui.chatWidth")}),h.jsx("div",{className:Jt.cardDescription,children:a("settings.description.ui.chatWidth")})]}),h.jsx("div",{className:Jt.cardControl,children:N(s,xe=>i(xe),[{value:"1000",label:a("settings.option.ui.chatWidth.1000")},{value:"wide",label:a("settings.option.ui.chatWidth.wide")}])})]},P.localKey);const E=P.setting,ne=cke(E,a),pe=uke(E,p),be=PB(E,p);return h.jsxs("div",{className:Jt.card,children:[h.jsxs("div",{className:Jt.cardBody,children:[h.jsxs("div",{className:Jt.cardTitle,children:[lke(E,a),be&&h.jsx("span",{className:Jt.scopeBadge,children:a(p==="workspace"?"settings.scope.workspace":"settings.scope.user")})]}),ne&&h.jsx("div",{className:Jt.cardDescription,children:ne}),pe&&h.jsx("div",{className:Jt.scopeHint,children:a(pe,{scope:a(p==="workspace"?"settings.scope.user":"settings.scope.workspace")})})]}),h.jsx("div",{className:Jt.cardControl,children:w===E.key?h.jsx("span",{className:Jt.busy,children:"..."}):q(E)})]},E.key)})]})]}),!o&&h.jsx("div",{className:Jt.footer,children:a(A?"settings.footer.edit":"settings.footer")})]})}const fke="_approval_j86la_1",mke="_floating_j86la_18",pke="_header_j86la_31",gke="_icon_j86la_41",yke="_name_j86la_56",bke="_desc_j86la_67",wke="_content_j86la_87",vke="_code_j86la_105",xke="_codeBlock_j86la_113",_ke="_question_j86la_133",kke="_options_j86la_139",Ske="_option_j86la_139",Tke="_optionPlain_j86la_167",Cke="_optionSecondary_j86la_177",Ake="_optionPrimary_j86la_184",Eke="_optionActive_j86la_195",Mke="_pointer_j86la_199",Ike="_num_j86la_203",Nke="_label_j86la_207",Tr={approval:fke,floating:mke,header:pke,icon:gke,name:yke,desc:bke,content:wke,code:vke,codeBlock:xke,question:_ke,options:kke,option:Ske,optionPlain:Tke,optionSecondary:Cke,optionPrimary:Ake,optionActive:Eke,pointer:Mke,num:Ike,label:Nke};function Rke(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 Lke(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function jke(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 Dke(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 Oke(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function hA(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 fA(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 eg(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const r=fA(t.option)-fA(n.option);return r===0?t.index-n.index:r}).map(({option:t})=>t)}function Bke(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 Pke(e){return e.kind==="allow_once"?Tr.optionPrimary:e.kind==="allow_always"?Tr.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?Tr.optionPlain:Tr.optionSecondary}function $ke({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=lt(),s=g.useMemo(()=>eg(e.options),[e.options]),[i,o]=g.useState(()=>hA(eg(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=hA(eg(a.current.options));c.current=!1,u.current=!1,l.current=T,o(T)},[e.id]);const d=Rke(e.title),f=e.toolName||d.toolName||e.kind||"Tool",m=xl(f,r),p=Oke(e),y=Lke(e),v=g.useCallback(T=>{c.current||(c.current=!0,t(a.current.id,T))},[t]),b=g.useCallback(T=>{if(T.defaultPrevented||Km(T.target))return;const A=a.current,M=eg(A.options),D=M.length;if(T.key==="ArrowUp"||T.key==="k")T.preventDefault(),u.current=!0,o(O=>{const C=(O-1+D)%D;return l.current=C,C});else if(T.key==="ArrowDown"||T.key==="j")T.preventDefault(),u.current=!0,o(O=>{const C=(O+1)%D;return l.current=C,C});else if(T.key==="Enter"){if(T.preventDefault(),!u.current){u.current=!0;return}const O=M[l.current];O&&v(O.id)}else if(T.key==="Escape"){T.preventDefault();const O=A.options.find(C=>C.kind==="reject_once"||C.kind==="reject_always");O&&v(O.id)}else if(T.key>="1"&&T.key<="9"){const O=parseInt(T.key)-1;O<D&&(T.preventDefault(),u.current=!0,v(M[O].id))}},[v]);g.useEffect(()=>{const T=setTimeout(()=>{window.addEventListener("keydown",b)},250);return()=>{clearTimeout(T),window.removeEventListener("keydown",b)}},[b]);const w=jke(e),x=qF(e.toolName),k=Dke(e);return h.jsxs("div",{className:n==="floating"?`${Tr.approval} ${Tr.floating}`:Tr.approval,children:[h.jsxs("div",{className:Tr.header,children:[h.jsx("span",{className:Tr.icon,children:"?"}),h.jsx("span",{className:Tr.name,children:m})]}),p&&h.jsx("div",{className:Tr.desc,title:p,children:p}),w&&k?h.jsx("div",{className:Tr.code,children:h.jsx("pre",{className:Tr.codeBlock,title:k,children:k})}):y&&y!==e.title?h.jsx("pre",{className:Tr.content,title:y,children:y}):null,h.jsx("div",{className:Tr.question,children:x?r("approval.launchAgentQuestion"):w?r("approval.execQuestion",{tool:m}):r("approval.changeQuestion")}),h.jsx("div",{className:Tr.options,children:s.map((T,A)=>{const M=A===i,D=Bke(T),O=D?r(D):T.label;return h.jsxs("div",{className:`${Tr.option} ${Pke(T)} ${M?Tr.optionActive:""}`,onClick:()=>v(T.id),children:[h.jsx("span",{className:Tr.pointer,children:M?"›":" "}),h.jsxs("span",{className:Tr.num,children:[A+1,"."]}),h.jsx("span",{className:Tr.label,children:O})]},T.id)})})]})}const zke="_question_1e2wi_1",Fke="_floating_1e2wi_18",qke="_titleLine_1e2wi_30",Uke="_icon_1e2wi_39",Hke="_toolName_1e2wi_43",Vke="_toolDesc_1e2wi_47",Wke="_tabs_1e2wi_54",Gke="_tab_1e2wi_54",Kke="_tabActive_1e2wi_78",Yke="_text_1e2wi_95",Xke="_description_1e2wi_104",Qke="_multiHint_1e2wi_112",Jke="_options_1e2wi_118",Zke="_option_1e2wi_118",e6e="_optionActive_1e2wi_140",t6e="_optionSelected_1e2wi_141",n6e="_optionLabel_1e2wi_146",r6e="_pointer_1e2wi_151",s6e="_optionNum_1e2wi_155",i6e="_editIcon_1e2wi_172",o6e="_optionContent_1e2wi_204",a6e="_optionPlaceholder_1e2wi_220",l6e="_optionDesc_1e2wi_225",c6e="_customInput_1e2wi_232",u6e="_actions_1e2wi_249",d6e="_button_1e2wi_257",h6e="_submitButton_1e2wi_283",f6e="_ignoreButton_1e2wi_289",gn={question:zke,floating:Fke,titleLine:qke,icon:Uke,toolName:Hke,toolDesc:Vke,tabs:Wke,tab:Gke,tabActive:Kke,text:Yke,description:Xke,multiHint:Qke,options:Jke,option:Zke,optionActive:e6e,optionSelected:t6e,optionLabel:n6e,pointer:r6e,optionNum:s6e,editIcon:i6e,optionContent:o6e,optionPlaceholder:a6e,optionDesc:l6e,customInput:c6e,actions:u6e,button:d6e,submitButton:h6e,ignoreButton:f6e};function m6e({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=lt(),s=g.useMemo(()=>{var j;return Array.isArray((j=e.rawInput)==null?void 0:j.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=g.useState(0),[a,l]=g.useState(null),[c,u]=g.useState({}),[d,f]=g.useState({}),[m,p]=g.useState({}),[y,v]=g.useState(!1),b=g.useRef(!1);g.useEffect(()=>{const j=s[0];b.current=!1,o(0),l(j!=null&&j.options.length?0:null),u(j&&!j.multiSelect&&j.options[0]?{0:j.options[0].label}:{}),f({}),p(j!=null&&j.multiSelect&&j.options[0]?{0:[j.options[0].label]}:{}),v(!1)},[s,e.id]);const w=s[i],x=(w==null?void 0:w.multiSelect)??!1,k=g.useCallback(()=>{const j={};for(let K=0;K<s.length;K++){const J=s[K];if(J)if(J.multiSelect){const ee=m[K]||[],N=d[K],q=N?[...ee,N]:ee;j[String(K)]=q.join(", ")}else j[String(K)]=c[K]||d[K]||""}return j},[s,m,d,c]),T=g.useCallback(()=>{if(b.current)return;const j=e.options.find(K=>K.kind==="allow_once");j&&(b.current=!0,t(e.id,j.id,k()))},[k,e,t]),A=g.useCallback(()=>{if(b.current)return;const j=e.options.find(K=>K.kind==="reject_once"||K.kind==="reject_always");j&&(b.current=!0,t(e.id,j.id,void 0))},[e,t]),M=g.useCallback(j=>{j!==void 0&&f(K=>({...K,[i]:j})),x||u(K=>{if(!(i in K))return K;const J={...K};return delete J[i],J}),v(!0)},[i,x]),D=g.useCallback(j=>{if(!w)return;if(j===w.options.length){M();return}const J=w.options[j].label;if(x){const ee=m[i]||[],N=ee.includes(J)?ee.filter(q=>q!==J):[...ee,J];p({...m,[i]:N})}else{const ee={...c,[i]:J};u(ee),f(N=>{if(!(i in N))return N;const q={...N};return delete q[i],q})}},[w,i,x,m,c,M]),O=g.useCallback(j=>{if(!w||!x)return;if(j===w.options.length){M();return}const K=w.options[j].label,J=m[i]||[],ee=J.includes(K)?J.filter(N=>N!==K):[...J,K];p({...m,[i]:ee})},[w,x,m,i,M]);if(s.length===0)return null;const C=j=>{const K=s[j];return K?K.multiSelect?(m[j]||[]).length>0||!!d[j]:!!c[j]||!!d[j]:!1},L=s.every((j,K)=>C(K)),I=Math.min(i,s.length-1),B=j=>{const K=s[j];if(o(j),v(!1),!(K!=null&&K.options.length)){l(null);return}if(l(0),K.multiSelect){p(J=>(J[j]||[]).length>0||d[j]?J:{...J,[j]:[K.options[0].label]});return}u(J=>J[j]||d[j]?J:{...J,[j]:K.options[0].label})},F=()=>{i<=0||B(i-1)},W=()=>{i>=s.length-1||B(i+1)};return h.jsxs("div",{className:`${gn.question} ${n==="floating"?gn.floating:""}`,children:[h.jsxs("div",{className:gn.titleLine,children:[h.jsx("span",{className:gn.icon,children:"?"}),h.jsx("span",{className:gn.toolName,children:xl("ask_user_question",r)}),h.jsx("span",{className:gn.toolDesc,children:r("askUser.progress",{current:I+1,total:s.length})})]}),h.jsx("div",{className:gn.tabs,children:s.map((j,K)=>h.jsx("span",{className:`${gn.tab} ${K===i?gn.tabActive:""}`,"aria-hidden":"true"},K))}),w?h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:gn.text,children:[w.question,x&&h.jsxs("span",{className:gn.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),h.jsx("p",{className:gn.description,children:r("askUser.selectAnswer")}),h.jsxs("div",{className:gn.options,onMouseLeave:()=>l(null),children:[w.options.map((j,K)=>{const J=K===a,ee=x?(m[i]||[]).includes(j.label):c[i]===j.label;return h.jsxs("div",{className:`${gn.option} ${J?gn.optionActive:""} ${ee?gn.optionSelected:""}`,onClick:()=>{l(K),x?O(K):D(K)},onMouseEnter:()=>l(K),children:[h.jsx("span",{className:gn.pointer,children:J?"›":" "}),h.jsx("span",{className:gn.optionNum,children:K+1}),h.jsxs("span",{className:gn.optionContent,children:[h.jsx("span",{className:gn.optionLabel,children:j.label}),j.description&&h.jsx("span",{className:gn.optionDesc,children:j.description})]})]},j.label)}),(()=>{const j=a===w.options.length,K=!!d[i];return h.jsxs("div",{className:`${gn.option} ${j?gn.optionActive:""} ${K?gn.optionSelected:""}`,onClick:()=>{l(w.options.length),M()},onMouseEnter:()=>l(w.options.length),children:[h.jsx("span",{className:gn.pointer,children:j?"›":" "}),h.jsx("span",{className:gn.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:gn.customInput,placeholder:r("askUser.typePlaceholder"),value:d[i]||"",onChange:J=>f({...d,[i]:J.target.value}),onBlur:()=>v(!1),autoFocus:!0}):h.jsx("span",{className:`${gn.optionLabel} ${d[i]?"":gn.optionPlaceholder}`,children:d[i]||r("askUser.typePlaceholder")})]})})()]})]}):null,h.jsxs("div",{className:gn.actions,children:[h.jsx("button",{type:"button",className:gn.ignoreButton,onClick:A,children:r("askUser.ignore")}),s.length>1&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:gn.button,disabled:i<=0,onClick:F,children:r("common.previous")}),h.jsx("button",{type:"button",className:gn.button,disabled:i>=s.length-1,onClick:W,children:r("common.next")})]}),h.jsx("button",{type:"button",className:`${gn.button} ${gn.submitButton}`,disabled:!L,onClick:T,children:r("askUser.submit")})]})]})}const p6e="_dialog_1ymqd_1",g6e="_toolbar_1ymqd_12",y6e="_tabs_1ymqd_21",b6e="_tab_1ymqd_21",w6e="_tabActive_1ymqd_39",v6e="_search_1ymqd_48",x6e="_general_1ymqd_60",_6e="_shortcuts_1ymqd_67",k6e="_shortcut_1ymqd_67",S6e="_shortcutKey_1ymqd_87",T6e="_shortcutDesc_1ymqd_95",C6e="_commandList_1ymqd_101",A6e="_commandCard_1ymqd_108",E6e="_commandCardExpanded_1ymqd_115",M6e="_commandRow_1ymqd_119",I6e="_commandName_1ymqd_135",N6e="_commandTag_1ymqd_142",R6e="_chevron_1ymqd_152",L6e="_chevronExpanded_1ymqd_160",j6e="_commandDetail_1ymqd_164",D6e="_commandDescription_1ymqd_174",O6e="_commandSubcommands_1ymqd_175",B6e="_empty_1ymqd_182",mr={dialog:p6e,toolbar:g6e,tabs:y6e,tab:b6e,tabActive:w6e,search:v6e,general:x6e,shortcuts:_6e,shortcut:k6e,shortcutKey:S6e,shortcutDesc:T6e,commandList:C6e,commandCard:A6e,commandCardExpanded:E6e,commandRow:M6e,commandName:I6e,commandTag:N6e,chevron:R6e,chevronExpanded:L6e,commandDetail:j6e,commandDescription:D6e,commandSubcommands:O6e,empty:B6e},P6e=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],$6e=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"]),z6e=[["@","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 F6e(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function T3(e){return!$6e.has(e.name)}function q6e(e,t){return T3(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function U6e(e,t,n){const r=n.trim().toLowerCase();return e.filter(s=>s.name&&s.description!==void 0).filter(s=>t==="commands"?!T3(s):t==="custom-commands"?T3(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 H6e(){const{t:e}=lt();return h.jsx("div",{className:mr.general,children:h.jsx("div",{className:mr.shortcuts,children:z6e.map(([t,n])=>h.jsxs("div",{className:mr.shortcut,children:[h.jsx("span",{className:mr.shortcutDesc,children:e(n)}),h.jsx("span",{className:mr.shortcutKey,children:t})]},t))})})}function V6e({commands:e,tab:t,query:n}){const{t:r}=lt(),[s,i]=g.useState(null),o=g.useMemo(()=>U6e(e,t,n),[e,n,t]);return o.length===0?h.jsx("div",{className:mr.empty,children:r(t==="custom-commands"?"help.emptyCustom":"help.empty")}):h.jsx("div",{className:mr.commandList,children:o.map(a=>{var c;const l=s===a.name;return h.jsxs("article",{className:`${mr.commandCard} ${l?mr.commandCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:mr.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[h.jsx("span",{className:mr.commandName,children:F6e(a)}),h.jsx("span",{className:mr.commandTag,children:q6e(a,r)}),h.jsx("svg",{className:`${mr.chevron} ${l?mr.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:mr.commandDetail,children:[a.description&&h.jsx("div",{className:mr.commandDescription,children:a.description}),!!((c=a.subcommands)!=null&&c.length)&&h.jsxs("div",{className:mr.commandSubcommands,children:[r("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function W6e({commands:e}){const{t}=lt(),[n,r]=g.useState("general"),{filterValue:s,inputProps:i}=kb(),o=n!=="general";return h.jsxs("div",{className:mr.dialog,children:[h.jsxs("div",{className:mr.toolbar,children:[h.jsx("div",{className:mr.tabs,children:P6e.map(a=>h.jsx("button",{type:"button",className:`${mr.tab} ${a.id===n?mr.tabActive:""}`,onClick:()=>r(a.id),children:t(a.labelKey)},a.id))}),o&&h.jsx("input",{className:mr.search,...i,placeholder:t("help.search")})]}),n==="general"?h.jsx(H6e,{}):h.jsx(V6e,{commands:e,tab:n,query:s})]})}function G6e({currentTheme:e,onSelect:t,onClose:n}){const{t:r}=lt(),s=AN.map(u=>({id:u,label:r(`theme.${u}`),description:r(`theme.${u}.desc`)})),[i,o]=g.useState(()=>{const u=s.findIndex(d=>d.id===e);return u>=0?u:0}),a=g.useRef(null),l=u=>{const d=s[u];d&&(t(d.id),n())},{keyboardMode:c}=Bc({itemCount:s.length,activeIndex:i,onActiveIndexChange:o,onConfirm:l});return g.useEffect(()=>{var d;const u=(d=a.current)==null?void 0:d.children[i];u==null||u.scrollIntoView({block:"nearest"})},[i]),h.jsx("div",{className:Me("picker-list","picker-list-compact",c?"picker-keyboard-only":void 0),ref:a,role:"listbox","aria-label":r("theme.title"),tabIndex:0,"aria-activedescendant":s.length>0?`theme-opt-${i}`:void 0,children:s.map((u,d)=>{const f=u.id===e;return h.jsxs("div",{id:`theme-opt-${d}`,role:"option","aria-selected":f,className:Me("picker-item","picker-session-item",d===i?"selected":void 0,f?"dialog-current":void 0),onClick:()=>l(d),onMouseMove:()=>o(d),children:[h.jsx("div",{className:Me("picker-item-row"),children:h.jsx("span",{className:Me("picker-item-title"),children:u.label})}),h.jsx("div",{className:Me("picker-item-meta"),children:u.description})]},u.id)})})}const C3="delete-session-list",mA=e=>`${C3}-opt-${e}`;function K6e({onDeleted:e,onError:t,onClose:n}){const{t:r}=lt(),s=gl(),{sessions:i,loading:o,error:a,deleteSession:l,deleteSessions:c}=Dy({autoLoad:!0}),u=s.sessionId,[d,f]=g.useState(!1),[m,p]=g.useState(-1),[y,v]=g.useState(new Set),{filterValue:b,inputProps:w}=kb(()=>{p(-1),v(new Set)}),[x,k]=g.useState(null),T=g.useRef(null),A=g.useRef(null);g.useEffect(()=>{a&&k(a.message)},[a]);const M=g.useMemo(()=>b?i.filter(B=>{const F=b.toLowerCase();return(B.displayName||"").toLowerCase().includes(F)||B.sessionId.toLowerCase().includes(F)}):i,[i,b]),D=g.useCallback(B=>{B!==u&&v(F=>{const W=new Set(F);return W.has(B)?W.delete(B):W.add(B),W})},[u]);g.useEffect(()=>{if(y.size===0)return;const B=new Set(M.map(F=>F.sessionId));v(F=>{const W=new Set([...F].filter(j=>B.has(j)));return W.size===F.size?F:W})},[M,y.size]),g.useEffect(()=>{m>=M.length&&M.length>0&&p(M.length-1)},[M.length,m]),g.useEffect(()=>{var F;const B=(F=T.current)==null?void 0:F.children[m];B==null||B.scrollIntoView({block:"nearest"})},[m]),g.useEffect(()=>{var B;(B=A.current)==null||B.focus()},[]);const{keyboardMode:O}=Bc({itemCount:M.length,activeIndex:m,onActiveIndexChange:p,onConfirm:B=>{const F=M[B];F&&D(F.sessionId)}}),C=g.useCallback(()=>{if(d)return;if(y.size>0){const F=new Set(M.map(j=>j.sessionId)),W=Array.from(y).filter(j=>F.has(j));if(W.length===0)return;f(!0),c(W).then(j=>{const K=j.removed.length+j.notFound.length,J=j.errors.length;if(J>0&&K>0){t(new Error(r("delete.partialFail",{removed:K,failed:J,detail:j.errors[0].error}))),n();return}if(J>0){k(r("delete.allFailed",{count:J,reason:j.errors[0].error})),f(!1),v(new Set);return}if(K===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 B=M[m];if(B){if(B.sessionId===u){k(r("delete.cannotCurrent"));return}f(!0),l(B.sessionId).then(F=>{if(!F){k(r("delete.notFound")),f(!1);return}e([B.sessionId]),n()}).catch(F=>{t(F),f(!1)})}},[u,l,c,d,M,n,e,t,m,y,r]),L=y.size>0,I=!d&&!o&&L;return h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search"),children:[h.jsxs("span",{className:Me("picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:A,className:Me("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":C3,"aria-activedescendant":m>=0&&m<M.length?mA(m):void 0,...w,placeholder:""}),h.jsx("span",{className:Me("picker-search-hint"),children:x||(d?r("delete.deleting"):o?r("common.loading"):L?r("delete.selected",{count:y.size}):b?r("delete.matches",{count:M.length}):"")})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:C3,role:"listbox","aria-multiselectable":"true",className:Me("picker-list",O?"picker-keyboard-only":void 0),ref:T,children:[o&&h.jsx("div",{className:Me("picker-empty"),children:r("common.loading")}),!o&&a&&h.jsx("div",{className:Me("picker-empty"),children:a.message}),!o&&!a&&M.length===0&&h.jsx("div",{className:Me("picker-empty"),children:b?r("delete.noMatch",{query:b}):r("delete.none")}),!o&&M.map((B,F)=>{const W=B.sessionId===u,j=y.has(B.sessionId);return h.jsx(Ok,{session:B,optionId:mA(F),active:F===m,ariaSelected:j,current:!1,disabled:W,leading:h.jsx("span",{className:Me("picker-item-checkbox",j?"picker-item-checkbox-checked":void 0),children:j?"[x] ":"[ ] "}),trailing:W?h.jsx("span",{className:Me("picker-item-badge"),children:r("resume.current")}):void 0,onClick:()=>{p(F),W||D(B.sessionId)},onActivate:()=>p(F)},B.sessionId)})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{className:Me("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:n,disabled:d,children:r("common.cancel")}),h.jsx("button",{type:"button",className:Me("dialog-danger-button"),onClick:C,disabled:!I,children:r(d?"delete.deleting":"delete.action")})]})]})}const A3="release-session-list",pA=e=>`${A3}-opt-${e}`;function Y6e({onReleased:e,onError:t,onClose:n}){const{t:r}=lt(),s=gl(),{sessions:i,loading:o,error:a,releaseSession:l}=Dy({autoLoad:!0}),c=s.sessionId,[u,d]=g.useState(!1),[f,m]=g.useState(-1),[p,y]=g.useState(null),{filterValue:v,inputProps:b}=kb(()=>{m(-1),y(null)}),[w,x]=g.useState(null),k=g.useRef(null),T=g.useRef(null);g.useEffect(()=>{a&&x(a.message)},[a]);const A=v?i.filter(B=>{const F=v.toLowerCase();return(B.displayName||"").toLowerCase().includes(F)||B.sessionId.toLowerCase().includes(F)}):i,M=B=>{const F=A[B];if(!F)return;const W=F.sessionId===c,j=(F.clientCount??0)>0||F.hasActivePrompt===!0;W||!j||(m(B),y(F.sessionId))};g.useEffect(()=>{f>=A.length&&A.length>0&&m(A.length-1)},[A.length,f]),g.useEffect(()=>{var F;const B=(F=k.current)==null?void 0:F.children[f];B==null||B.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var B;(B=T.current)==null||B.focus()},[]);const{keyboardMode:D}=Bc({itemCount:A.length,activeIndex:f,onActiveIndexChange:m,onConfirm:M}),O=g.useCallback(B=>{const F=B??A.find(j=>j.sessionId===p)??void 0;if(!F||u)return;if(!((F.clientCount??0)>0||F.hasActivePrompt===!0)){x(r("release.inactive"));return}if(F.sessionId===c){x(r("release.cannotCurrent"));return}l&&(d(!0),l(F.sessionId).then(()=>{e(F.sessionId),n()}).catch(j=>{t(j),d(!1)}))},[c,u,A,n,t,e,l,p,r]),C=A.find(B=>B.sessionId===p)??void 0,L=C&&((C.clientCount??0)>0||C.hasActivePrompt===!0),I=!u&&!o&&!!C&&C.sessionId!==c&&!!L;return h.jsxs("div",{className:Me("picker","picker-in-shell"),children:[h.jsxs("div",{className:Me("picker-search"),children:[h.jsxs("span",{className:Me("picker-search-label"),children:[r("resume.search"),":"," "]}),h.jsx("input",{ref:T,className:Me("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":A3,"aria-activedescendant":f>=0&&f<A.length?pA(f):void 0,...b,placeholder:""}),h.jsx("span",{className:Me("picker-search-hint"),children:w||(u?r("release.releasing"):o?r("common.loading"):v?r("release.matches",{count:A.length}):"")})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{id:A3,role:"listbox",className:Me("picker-list",D?"picker-keyboard-only":void 0),ref:k,children:[o&&h.jsx("div",{className:Me("picker-empty"),children:r("common.loading")}),!o&&A.length===0&&h.jsx("div",{className:Me("picker-empty"),children:v?r("release.noMatch",{query:v}):r("release.none")}),!o&&A.map((B,F)=>{const W=B.sessionId===c,j=(B.clientCount??0)>0||B.hasActivePrompt===!0,K=W||!j;return h.jsx(Ok,{session:B,optionId:pA(F),active:F===f,confirmed:B.sessionId===p,ariaSelected:B.sessionId===p,current:!1,disabled:K,trailing:W?h.jsx("span",{className:Me("picker-item-badge"),children:r("resume.current")}):j?void 0:h.jsx("span",{className:Me("picker-item-badge"),children:r("release.inactiveBadge")}),onClick:()=>M(F),onActivate:()=>m(F)},B.sessionId)})]}),h.jsx("div",{className:Me("picker-sep")}),h.jsxs("div",{className:Me("dialog-footer-actions"),children:[h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:n,disabled:u,children:r("common.cancel")}),h.jsx("button",{type:"button",className:Me("dialog-danger-button"),onClick:()=>O(),disabled:!I,children:r(u?"release.releasing":"release.action")})]})]})}const X6e="_root_ieg2d_1",Q6e="_list_ieg2d_8",J6e="_item_ieg2d_21",Z6e="_itemCursor_ieg2d_42",e8e="_itemSelected_ieg2d_49",t8e="_prompt_ieg2d_61",n8e="_keyboardOnly_ieg2d_68",r8e="_itemDisabled_ieg2d_77",s8e="_turn_ieg2d_91",i8e="_time_ieg2d_96",o8e="_footer_ieg2d_102",a8e="_footerMessage_ieg2d_112",l8e="_dangerButton_ieg2d_118",Ai={root:X6e,list:Q6e,item:J6e,itemCursor:Z6e,itemSelected:e8e,prompt:t8e,keyboardOnly:n8e,itemDisabled:r8e,turn:s8e,time:i8e,footer:o8e,footerMessage:a8e,dangerButton:l8e},c8e="rewind-snapshot-list",gA=e=>`${c8e}-opt-${e}`;function u8e(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 d8e(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function h8e({blocks:e,loadSnapshots:t,rewind:n,onError:r,onClose:s}){const{t:i}=lt(),[o,a]=g.useState([]),[l,c]=g.useState(!0),[u,d]=g.useState(null),[f,m]=g.useState(0),[p,y]=g.useState(null),[v,b]=g.useState(null);g.useEffect(()=>{let D=!0;return c(!0),t().then(O=>{D&&a(O.snapshots)}).catch(O=>{D&&r(O)}).finally(()=>{D&&c(!1)}),()=>{D=!1}},[t,r]);const w=g.useMemo(()=>o.map(D=>({snapshot:D,promptText:u8e(e,D.turnIndex)})).sort((D,O)=>D.snapshot.turnIndex-O.snapshot.turnIndex),[e,o]);g.useEffect(()=>{f>=w.length&&w.length>0&&m(w.length-1)},[w.length,f]);const x=g.useRef(null),k=u!==null,T=D=>{!D||u||(d(D),b(null),n(D).then(()=>{s()}).catch(O=>{r(O),b(i("rewind.failed",{reason:O instanceof Error?O.message:String(O)})),d(null)}))},A=D=>{const O=w[D];O&&(m(D),y(O.snapshot.promptId))},{keyboardMode:M}=Bc({itemCount:w.length,activeIndex:f,onActiveIndexChange:m,onConfirm:A,enabled:!k});return g.useEffect(()=>{var O;const D=(O=x.current)==null?void 0:O.children[f];D==null||D.scrollIntoView({block:"nearest"})},[f]),g.useEffect(()=>{var O;if(l||w.length===0)return;const D=document.activeElement;(D==null?void 0:D.getAttribute("role"))==="dialog"&&((O=x.current)==null||O.focus())},[l,w.length]),l?h.jsx("div",{className:Me("picker-empty"),children:i("rewind.loading")}):w.length===0?h.jsx("div",{className:Me("picker-empty"),children:i("rewind.empty")}):h.jsxs("div",{className:Ai.root,children:[h.jsx("div",{className:`${Ai.list} ${M?Ai.keyboardOnly:""}`,ref:x,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":w.length>0?gA(f):void 0,children:w.map(({snapshot:D,promptText:O},C)=>{const L=C===f,I=p===D.promptId,B=O||i("rewind.promptFallback",{id:D.promptId.slice(-8)});return h.jsxs("div",{id:gA(C),role:"option","aria-selected":I,"aria-disabled":k||void 0,className:`${Ai.item} ${L?Ai.itemCursor:""} ${I?Ai.itemSelected:""} ${k?Ai.itemDisabled:""}`,onClick:()=>{k||A(C)},onMouseMove:()=>m(C),children:[h.jsxs("div",{className:Ai.prompt,title:B,children:[h.jsxs("span",{className:Ai.turn,children:["#",D.turnIndex+1]})," ",B]}),h.jsx("div",{className:Ai.time,children:d8e(D.timestamp)})]},D.promptId)})}),h.jsxs("div",{className:Ai.footer,children:[v&&h.jsx("span",{className:Ai.footerMessage,role:"alert",children:v}),h.jsx("button",{type:"button",className:Me("dialog-inline-button"),onClick:s,disabled:u!==null,children:i("common.cancel")}),h.jsx("button",{type:"button",className:`${Me("dialog-danger-button")} ${Ai.dangerButton}`,onClick:()=>T(p),disabled:!p||u!==null,children:i(u?"rewind.rewinding":"rewind.confirm")})]})]})}const f8e="_sidebar_khplw_1",m8e="_resizing_khplw_21",p8e="_collapsed_khplw_25",g8e="_newChatButton_khplw_31",y8e="_footerButton_khplw_32",b8e="_collapseButton_khplw_33",w8e="_projectRow_khplw_34",v8e="_sessionRow_khplw_35",x8e="_retry_khplw_36",_8e="_projectIconButton_khplw_38",k8e="_sessionActionButton_khplw_39",S8e="_secondaryButton_khplw_40",T8e="_dangerButton_khplw_41",C8e="_navIcon_khplw_96",A8e="_settingsIcon_khplw_119",E8e="_projectFolderIcon_khplw_125",M8e="_body_khplw_129",I8e="_sectionTitle_khplw_138",N8e="_projectName_khplw_176",R8e="_sessionText_khplw_177",L8e="_sessionList_khplw_192",j8e="_currentSession_khplw_214",D8e="_busySession_khplw_219",O8e="_floatingTooltip_khplw_224",B8e="_tooltipContent_khplw_254",P8e="_tooltipTitle_khplw_260",$8e="_tooltipTags_khplw_267",z8e="_tooltipTag_khplw_267",F8e="_tooltipTagRunning_khplw_287",q8e="_tooltipTagNew_khplw_292",U8e="_tooltipMeta_khplw_297",H8e="_sessionStatusSlot_khplw_312",V8e="_sessionStatusDot_khplw_322",W8e="_sessionMetaSlot_khplw_332",G8e="_sessionTime_khplw_343",K8e="_sessionLoading_khplw_350",Y8e="_runningSession_khplw_360",X8e="_sessionActions_khplw_369",Q8e="_searchInput_khplw_461",J8e="_renameInput_khplw_475",Z8e="_renameForm_khplw_486",eSe="_notice_khplw_502",tSe="_confirmContent_khplw_517",nSe="_confirmDescription_khplw_523",rSe="_confirmActions_khplw_530",sSe="_footer_khplw_32",iSe="_resizeHandle_khplw_603",oSe="_mobileOpen_khplw_636",gt={sidebar:f8e,resizing:m8e,collapsed:p8e,newChatButton:g8e,footerButton:y8e,collapseButton:b8e,projectRow:w8e,sessionRow:v8e,retry:x8e,projectIconButton:_8e,sessionActionButton:k8e,secondaryButton:S8e,dangerButton:T8e,navIcon:C8e,settingsIcon:A8e,projectFolderIcon:E8e,body:M8e,sectionTitle:I8e,projectName:N8e,sessionText:R8e,sessionList:L8e,currentSession:j8e,busySession:D8e,floatingTooltip:O8e,tooltipContent:B8e,tooltipTitle:P8e,tooltipTags:$8e,tooltipTag:z8e,tooltipTagRunning:F8e,tooltipTagNew:q8e,tooltipMeta:U8e,sessionStatusSlot:H8e,sessionStatusDot:V8e,sessionMetaSlot:W8e,sessionTime:G8e,sessionLoading:K8e,runningSession:Y8e,sessionActions:X8e,searchInput:Q8e,renameInput:J8e,renameForm:Z8e,notice:eSe,confirmContent:tSe,confirmDescription:nSe,confirmActions:rSe,footer:sSe,resizeHandle:iSe,mobileOpen:oSe},zB="qwen-code-web-shell-sidebar-width",tg=260,aSe=220,lSe=420,cSe=1e3,uSe=2e3,dSe=3e4;function ng(...e){return e.filter(Boolean).join(" ")}function yA(e){return e instanceof DOMException&&e.name==="AbortError"}function hSe(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function Mf(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function fSe(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function ly(e){return Math.min(lSe,Math.max(aSe,e))}function mSe(){if(typeof window>"u")return tg;try{const e=window.localStorage.getItem(zB),t=e?Number(e):tg;return Number.isFinite(t)?ly(t):tg}catch{return tg}}function pSe(e){try{window.localStorage.setItem(zB,String(ly(e)))}catch{}}function gSe(){return h.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:h.jsx("path",{d:"M12 5v14M5 12h14"})})}function ySe({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 bSe(){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 wSe(){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 vSe(){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 xSe(){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 _Se({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 kSe({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 SSe({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onNewSession:r,onLoadSession:s,onError:i,mobileOpen:o}){const{t:a}=lt(),l=gl(),c=jy(),{sessions:u,loading:d,error:f,reload:m,deleteSession:p}=Dy({autoLoad:!0,pageSize:cSe}),[y,v]=g.useState(null),[b,w]=g.useState(""),[x,k]=g.useState(null),T=g.useRef(null),A=g.useRef(!1),[M,D]=g.useState(null),[O,C]=g.useState(mSe),[L,I]=g.useState(!0),[B,F]=g.useState(!1),[W,j]=g.useState(""),[K,J]=g.useState(!1),[ee,N]=g.useState(null),[q,P]=g.useState(()=>new Set),E=g.useRef(null),ne=g.useRef(null),pe=g.useRef(!1),be=g.useRef(null),xe=l.sessionId,we=hSe(l.workspaceCwd)||a("sidebar.projectFallback"),de={"--web-shell-sidebar-width":`${O}px`},se=g.useCallback(()=>{E.current!==null&&(window.clearTimeout(E.current),E.current=null)},[]),ae=g.useCallback(()=>{se(),E.current=window.setTimeout(()=>{N(null),E.current=null},240)},[se]);g.useEffect(()=>()=>{var H;se(),(H=be.current)==null||H.call(be,!1)},[se]),g.useEffect(()=>{I(!e),e&&(F(!1),j(""),N(null))},[e]);const _e=g.useMemo(()=>u.some(H=>H.hasActivePrompt),[u]);g.useEffect(()=>{if(!L&&!_e)return;const H=_e&&!f?uSe:dSe,oe=window.setInterval(()=>{document.hidden||pe.current||(pe.current=!0,m().finally(()=>{pe.current=!1}))},H);return()=>window.clearInterval(oe)},[f,_e,L,m]),g.useEffect(()=>{const H=new Map(u.map(De=>[De.sessionId,!!De.hasActivePrompt])),oe=ne.current;ne.current=H,oe!==null&&P(De=>{const tt=new Set(De);let Ct=!1;for(const[Et,Qt]of oe){const on=H.get(Et);Qt&&on===!1&&Et!==xe&&!tt.has(Et)&&(tt.add(Et),Ct=!0)}for(const Et of tt)(Et===xe||!H.has(Et)||H.get(Et))&&(tt.delete(Et),Ct=!0);return Ct?tt:De})},[xe,u]);const qe=g.useCallback((H,oe)=>{se();const De=H.currentTarget.getBoundingClientRect();N({content:oe,top:De.top+De.height/2,left:De.right+8})},[se]),He=g.useCallback(H=>{const oe=Mf(H),De=H.sessionId!==xe&&q.has(H.sessionId);return h.jsxs("div",{className:gt.tooltipContent,children:[h.jsx("div",{className:gt.tooltipTitle,children:oe}),h.jsxs("div",{className:gt.tooltipTags,children:[H.hasActivePrompt&&h.jsx("span",{className:ng(gt.tooltipTag,gt.tooltipTagRunning),children:a("sidebar.running")}),De&&h.jsx("span",{className:ng(gt.tooltipTag,gt.tooltipTagNew),children:a("sidebar.completedUnread")}),h.jsx("span",{className:gt.tooltipTag,children:a("sidebar.clients",{count:H.clientCount??0})})]}),h.jsx("div",{className:gt.tooltipMeta,children:H.sessionId})]})},[q,xe,a]),re=g.useCallback(()=>{T.current!==null||A.current||(A.current=!0,(async()=>{try{await r()&&m()}catch(H){yA(H)||i(H,a("sidebar.newSessionFailed"))}finally{A.current=!1}})())},[i,r,m,a]),ye=g.useCallback(H=>{H===xe||H===T.current||(P(oe=>{if(!oe.has(H))return oe;const De=new Set(oe);return De.delete(H),De}),T.current=H,k(H),(async()=>{try{await s(H)}catch(oe){yA(oe)||i(oe,a("sidebar.switchFailed"))}finally{T.current===H&&(T.current=null),k(oe=>oe===H?null:oe)}})())},[xe,i,s,a]),Te=g.useCallback(H=>{v(H.sessionId),w(Mf(H))},[]),ke=g.useCallback(()=>{v(null),w("")},[]),vt=g.useCallback(()=>{const H=b.trim();if(!H||y!==xe){ke();return}const oe=y;T.current=oe,k(oe),c.renameSession(H).then(()=>{ke(),m()}).catch(De=>{i(De,a("sidebar.renameFailed")),ke()}).finally(()=>{T.current===oe&&(T.current=null),k(De=>De===oe?null:De)})},[c,ke,xe,b,y,i,m,a]),rt=g.useCallback(H=>{H.sessionId!==xe&&D(H)},[xe]),Mt=g.useCallback(()=>{if(!M)return;const H=M.sessionId;if(H===xe){D(null);return}D(null),T.current=H,k(H),p(H).then(oe=>{oe||m()}).catch(oe=>i(oe,a("sidebar.deleteFailed"))).finally(()=>{T.current===H&&(T.current=null),k(oe=>oe===H?null:oe)})},[xe,M,p,i,m,a]),Pt=g.useCallback(H=>{H.sessionId===xe&&Te(H)},[xe,Te]),Ze=g.useMemo(()=>{const H=W.trim().toLowerCase(),oe=H?u.filter(tt=>Mf(tt).toLowerCase().includes(H)||tt.sessionId.toLowerCase().includes(H)):u.slice(),De=new Map(oe.map(tt=>[tt.sessionId,fSe(tt)]));return oe.sort((tt,Ct)=>(De.get(Ct.sessionId)??0)-(De.get(tt.sessionId)??0))},[W,u]),bt=g.useCallback(H=>{var X;if(e)return;H.preventDefault(),(X=be.current)==null||X.call(be,!0),J(!0);const oe=H.clientX,De=O,tt=document.body.style.cursor,Ct=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{H.currentTarget.setPointerCapture(H.pointerId)}catch{}const Et=ue=>{const me=ly(De+ue.clientX-oe);C(me)},Qt=ue=>{document.body.style.cursor=tt,document.body.style.userSelect=Ct,window.removeEventListener("pointermove",Et),window.removeEventListener("pointerup",on),window.removeEventListener("pointercancel",he),be.current=null,ue&&J(!1)},on=ue=>{const me=ly(De+ue.clientX-oe);C(me),pSe(me),Qt(!0)},he=()=>{Qt(!0)};be.current=Qt,window.addEventListener("pointermove",Et),window.addEventListener("pointerup",on,{once:!0}),window.addEventListener("pointercancel",he,{once:!0})},[e,O]),ft=M?Mf(M):"",ie=g.useMemo(()=>L?d&&u.length===0?h.jsx("div",{className:gt.notice,children:a("sidebar.loadingSessions")}):f&&u.length===0?h.jsx("button",{className:gt.retry,type:"button",onClick:m,children:a("sidebar.loadFailed")}):Ze.length===0?h.jsx("div",{className:gt.notice,children:a("sidebar.searchEmpty")}):Ze.map(H=>{const oe=H.sessionId===xe,De=y===H.sessionId,tt=Mf(H),Ct=H.updatedAt||H.createdAt,Et=Ct?EB(Ct,a):"",Qt=x===H.sessionId,on=!oe&&q.has(H.sessionId);return h.jsx("div",{className:ng(gt.sessionRow,oe&&gt.currentSession,H.hasActivePrompt&&gt.runningSession,Qt&&gt.busySession),role:"button",tabIndex:0,"aria-current":oe?"page":void 0,onMouseEnter:he=>qe(he,He(H)),onMouseLeave:ae,onFocus:he=>qe(he,He(H)),onBlur:ae,onClick:()=>ye(H.sessionId),onDoubleClick:()=>{oe&&!e&&Te(H)},onKeyDown:he=>{he.key==="Enter"&&ye(H.sessionId)},children:!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:gt.sessionStatusSlot,"aria-hidden":"true",children:on&&h.jsx("span",{className:gt.sessionStatusDot})}),De?h.jsx("form",{className:gt.renameForm,onClick:he=>he.stopPropagation(),onSubmit:he=>{he.preventDefault(),vt()},children:h.jsx("input",{autoFocus:!0,className:gt.renameInput,value:b,onChange:he=>w(he.target.value),onBlur:ke,onKeyDown:he=>{he.key==="Escape"&&(he.preventDefault(),ke())}})}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:gt.sessionText,children:tt}),h.jsxs("div",{className:gt.sessionMetaSlot,children:[H.hasActivePrompt?h.jsx("span",{className:gt.sessionLoading,"aria-label":a("sidebar.running")}):h.jsx("span",{className:gt.sessionTime,children:Et}),h.jsxs("div",{className:gt.sessionActions,onClick:he=>he.stopPropagation(),onKeyDown:he=>he.stopPropagation(),onMouseEnter:he=>{he.stopPropagation(),N(null)},children:[h.jsx("button",{className:gt.sessionActionButton,type:"button",disabled:!oe,title:a(oe?"sidebar.rename":"sidebar.renameCurrentOnly"),"aria-label":a("sidebar.rename"),onClick:()=>Pt(H),children:h.jsx(vSe,{})}),h.jsx("button",{className:gt.sessionActionButton,type:"button",disabled:oe,title:a(oe?"sidebar.currentDeleteDisabled":"sidebar.delete"),"aria-label":a("sidebar.delete"),onClick:()=>rt(H),children:h.jsx(xSe,{})})]})]})]})]})},H.sessionId)}):null,[x,ke,e,q,xe,b,y,f,Ze,rt,ye,Pt,ae,d,L,m,vt,He,u.length,qe,Te,a]);return h.jsxs("aside",{className:ng(gt.sidebar,e&&gt.collapsed,K&&gt.resizing,o&&gt.mobileOpen),"aria-label":a("sidebar.label"),style:de,children:[ee&&h.jsx("div",{className:gt.floatingTooltip,role:"tooltip",style:{top:ee.top,left:ee.left},onMouseEnter:se,onMouseLeave:ae,children:ee.content}),M&&h.jsx(gs,{title:a("delete.title"),size:"sm",onClose:()=>D(null),children:h.jsxs("div",{className:gt.confirmContent,children:[h.jsx("p",{className:gt.confirmDescription,children:a("sidebar.deleteConfirmDescription",{name:ft})}),h.jsxs("div",{className:gt.confirmActions,children:[h.jsx("button",{className:gt.secondaryButton,type:"button",onClick:()=>D(null),children:a("common.cancel")}),h.jsx("button",{className:gt.dangerButton,type:"button",onClick:Mt,children:a("sidebar.delete")})]})]})}),h.jsxs("button",{className:gt.newChatButton,type:"button",title:a("sidebar.newChat"),"aria-label":a("sidebar.newChat"),onClick:re,children:[h.jsx("span",{className:gt.navIcon,children:h.jsx(gSe,{})}),!e&&h.jsx("span",{children:a("sidebar.newChat")})]}),h.jsxs("div",{className:gt.body,children:[!e&&h.jsx("div",{className:gt.sectionTitle,children:a("sidebar.project")}),h.jsxs("div",{className:gt.projectRow,role:"button",tabIndex:0,"aria-expanded":L,onClick:()=>{e||I(H=>!H)},onKeyDown:H=>{e||(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),I(oe=>!oe))},onMouseEnter:H=>qe(H,h.jsxs("div",{className:gt.tooltipContent,children:[h.jsx("div",{className:gt.tooltipTitle,children:we}),h.jsx("div",{className:gt.tooltipMeta,children:l.workspaceCwd||we})]})),onMouseLeave:ae,onFocus:H=>qe(H,h.jsxs("div",{className:gt.tooltipContent,children:[h.jsx("div",{className:gt.tooltipTitle,children:we}),h.jsx("div",{className:gt.tooltipMeta,children:l.workspaceCwd||we})]})),onBlur:ae,children:[h.jsx("span",{className:`${gt.navIcon} ${gt.projectFolderIcon}`,children:h.jsx(ySe,{expanded:L})}),!e&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:gt.projectName,children:we}),h.jsx("button",{className:gt.projectIconButton,type:"button","aria-label":a("sidebar.search"),onKeyDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation(),F(oe=>(oe&&j(""),!oe)),I(!0)},children:h.jsx(bSe,{})}),h.jsx("button",{className:gt.projectIconButton,type:"button","aria-label":a(L?"sidebar.collapseProject":"sidebar.expandProject"),onKeyDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation(),I(oe=>!oe)},children:h.jsx(kSe,{expanded:L})})]})]}),B&&!e&&L&&h.jsx("input",{className:gt.searchInput,value:W,placeholder:a("sidebar.searchPlaceholder"),"aria-label":a("sidebar.search"),autoFocus:!0,onChange:H=>j(H.target.value),onKeyDown:H=>{H.key==="Escape"&&(j(""),F(!1))}}),h.jsx("div",{className:gt.sessionList,children:ie})]}),h.jsxs("div",{className:gt.footer,children:[h.jsxs("button",{className:gt.footerButton,type:"button",title:a("sidebar.settings"),"aria-label":a("sidebar.settings"),onClick:n,children:[h.jsx("span",{className:`${gt.navIcon} ${gt.settingsIcon}`,children:h.jsx(wSe,{})}),!e&&h.jsx("span",{children:a("sidebar.settings")})]}),!o&&h.jsx("button",{className:gt.collapseButton,type:"button",title:a(e?"sidebar.expand":"sidebar.collapse"),"aria-label":a(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:h.jsx(_Se,{collapsed:e})})]}),h.jsx("div",{className:gt.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:bt})]})}function TSe(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 CSe(...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 ASe(e){const[t,n]=g.useState(e);return g.useEffect(()=>{const r=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(r)},[e]),t}const ESe=3e3,MSe=2;function bA(e){return e.some(t=>t.status==="running"||t.status==="paused")}function ISe(e,t,n=0){const r=jy(),[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>=MSe&&a(!1);return}u.current=0,bA(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,ESe);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&&bA(f.current)&&a(!0)};return window.addEventListener(Ym,m),()=>window.removeEventListener(Ym,m)},[]),s}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function NSe(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function RSe(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 LSe(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 jSe(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function DSe(e){return jSe(e)||!e.text&&!e.usage?null:e}function wA(e){return e.text.length===0}function OSe(e){const t=e.flatMap((n,r)=>{const s=bi(n),i=mi(s,"content");return i?[{id:mi(s,"id")??`plan-${r}`,content:i,status:qSe(mi(s,"status")),...(()=>{const a=USe(mi(s,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function vA(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 BSe(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=DSe(m);if(!y)break;const v=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(v){xA(v,y.text);break}const b=n7e(y.text);if(b){let x=null,k=!1,T=0,A=0;for(const M of b)M.kind==="insight"?M.data.type==="insight_progress"?x=M.data:M.data.type==="insight_ready"?(k=!0,n.push({id:`${m.id}-ir-${T++}`,role:"insight_ready",path:M.data.path,timestamp:p})):M.data.type==="insight_error"&&(k=!0,n.push({id:`${m.id}-ie-${A++}`,role:"insight_error",error:M.data.error,timestamp:p})):(n.push({id:`${m.id}-t-${n.length}`,role:"assistant",content:M.text,timestamp:p}),o=n.length-1,a=null);x&&!k&&n.push({id:`${m.id}-ip`,role:"insight_progress",stage:x.stage,progress:x.progress,detail:x.detail,timestamp:p}),l=!0;break}const w=o!==null?n[o]:void 0;if(w&&w.role==="assistant"&&!l&&!wA(y)){const x=vA(w.usage,y.usage);n[o]={...w,content:w.content+y.text,isStreaming:y.streaming,...x?{usage:x}:{}},l=!1,a=null}else if(!wA(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&&w&&w.role==="assistant"){const x=vA(w.usage,y.usage);n[o]={...w,...x?{usage:x}:{}}}break}case"thought":{const y=m,v=y.parentToolCallId?s.get(y.parentToolCallId):void 0;if(v){xA(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=HSe(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 w=v.parentToolCallId?s.get(v.parentToolCallId):void 0,x=s.get(v.callId);if(x){_A(x,v);break}if(w){PSe(w,v),s.set(v.callId,v);break}p4(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=$Se(v.tools),w=v.tools[b];if(w){const x=typeof w.rawOutput=="string"?w.rawOutput:"",k={...w,rawOutput:x+y.text};n[n.length-1]={...v,tools:[...v.tools.slice(0,b),k,...v.tools.slice(b+1)]},s.get(w.callId)===w&&s.set(w.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;WSe(y,i);const v=VSe(y);if(!v)break;const b=FB(v);if(!y.resolved)break;const w=s.get(v.callId);if(w){const x=w.status;v.toolName=w.toolName,y.resolved&&(g4(y.resolved)?v.status=b?v.status:"in_progress":(v.status="failed",v.endTime=y.updatedAt)),_A(w,v),y.resolved&&b&&g4(y.resolved)&&(w.status=x);break}if(y.resolved){g4(y.resolved)?(b||(v.status="in_progress"),p4(n,m.id,v,p),s.set(v.callId,v),l=!0):(v.status="failed",v.endTime=y.updatedAt,p4(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"?RSe(y.data):null,b=y.source==="mid_turn_message_injected"?LSe(y.data):null,w=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(NSe(w))break;const x=FSe(w);if(x){n.push({id:m.id,role:"plan",todos:x,timestamp:p}),l=!0;break}n.push({id:m.id,role:"system",content:w,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 PSe(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function xA(e,t){e.subContent=(e.subContent||"")+t}function p4(e,t,n,r){const s=o=>FB(o)||Hh(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 $Se(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 _A(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 FB(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||zSe(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function zSe(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function FSe(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),r=bi(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:OSe(r.entries)}catch{return}}function bi(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function mi(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function qSe(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function USe(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function HSe(e){const t=KSe(e),n=GSe(e,t),r=YSe(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:UB(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 VSe(e){const t=bi(e.toolCall);if(!t)return;const n=qB(t);if(Array.isArray(n==null?void 0:n.questions))return;const r=bi(t._meta),s=mi(t,"kind"),i=mi(r,"toolName")??mi(t,"toolName")??mi(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(s==="fetch"?"web_fetch":s),o=mi(t,"toolCallId")??mi(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:mi(t,"title")??e.title,status:"pending",kind:UB(i,s),args:n,startTime:e.createdAt}}function WSe(e,t){const n=bi(e.toolCall),r=mi(n,"toolCallId")??mi(n,"id");if(!r)return;const s=mi(n,"title")??e.title,i=n?qB(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(r,{...s?{title:s}:{},...i?{args:i}:{}})}function g4(e){const[t="",n=""]=e.toLowerCase().split(":",2);return kA(t)?!0:t!=="selected"?!1:kA(n.trim())}function kA(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 qB(e){return bi(e.rawInput)??bi(e.input)??bi(e.args)}function GSe(e,t){var s;const n=(s=e.toolName)==null?void 0:s.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=bi(t);return(r==null?void 0:r.status)==="background"}function KSe(e){return XSe(e)&&e.status==="failed"?QSe(e)??e.details??e.rawOutput:!JSe(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 YSe(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const r=bi(n);if(!r)return[];const s=r.type;if(s==="content"){const i=bi(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 XSe(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function QSe(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 JSe(e){return e==="cancelled"||e==="canceled"}const ZSe=['"insight_progress":','"insight_ready":','"insight_error":'];function e7e(e){try{const t=JSON.parse(e),n=bi(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=bi(t.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const s=bi(t.insight_error);if(s&&typeof s.error=="string")return{type:"insight_error",error:s.error}}catch{}return null}function t7e(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 n7e(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(!ZSe.some(f=>a.startsWith(f))){r=o+1;continue}const c=t7e(e,o);if(!c){r=o+1;continue}const u=e7e(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 UB(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 r7e(e){const t=Ly();return g.useMemo(()=>BSe(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n})}}),[t,e])}function s7e(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 i7e(e){const t=g.useRef(e);return s7e(t.current,e)||(t.current=e),t.current}function o7e(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 Kr={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"},SA=1024,a7e=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${SA}}\S\$)([^$\n]{1,${SA}})\$(?![\w$])`,"g");function l7e(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 c7e(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 u7e(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(a7e)){const d=u[1];d&&t.push({content:d,index:t.length+1})}}return t}function TA(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function d7e(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=l7e(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:TA(d,i)}:null}const c=l[l.length-1];return c?{content:c.content,label:TA(c,i)}:null}function CA(e,t){const n=u7e(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 h7e(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 CA(e,n.slice(1));const s=n.slice(1),i=s.findIndex(u=>u.toLowerCase()==="inline");if(i!==-1)return CA(e,s.filter((u,d)=>d!==i));const o=c7e(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 f7e(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 m7e(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 p7e(e,t,n=m7e){const r=f7e(e);if(r===null)return{status:"info",message:Kr.NO_OUTPUT};if(!r)return{status:"info",message:Kr.NO_TEXT};try{const s=h7e(r,t);if(s===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Kr.INLINE_LATEX_MISSING:Kr.LATEX_MISSING};if(s!==void 0)return await n(s.content),{status:"info",message:`${s.label}${Kr.COPIED_SUFFIX}`};const i=d7e(r,t);if(i===null)return{status:"info",message:Kr.CODE_MISSING};const o=(i==null?void 0:i.content)??r;return await n(o),{status:"info",message:i?`${i.label}${Kr.COPIED_SUFFIX}`:Kr.OUTPUT_COPIED}}catch(s){const i=s instanceof Error?s.message:String(s);return{status:"error",message:`${Kr.CLIPBOARD_PREFIX}${i}`}}}function g7e(e){return typeof e=="object"&&e!==null}function HB(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function Pk(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function y7e(e){if(!Pk(e)||!g7e(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function b7e(e){const t=new Set;for(const n of e){if(!Pk(n))continue;const r=y7e(n);r&&t.add(r)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=HB(n.content);return!r||!t.has(r)})}function w7e(e){return e.role!=="system"||e.variant!=="info"?!1:HB(e.content)!==null||Pk(e)}function v7e(e){const t=e.findIndex(n=>!w7e(n));return t<0?[]:e.slice(t)}function AA(e){return v7e(b7e(e))}function x7e(e){return e.blocked?{kind:"ignore"}:e.streaming?e.armed==="cancel"?{kind:"cancel"}:{kind:"arm",action:"cancel"}:e.hasInput?e.armed==="clear"?{kind:"clear"}:{kind:"arm",action:"clear"}:{kind:"ignore"}}function EA(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 _7e(e,t,n,r){return e?!0:(r.append(t),!1)}function VB(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}const k7e="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",S7e="/assets/insert-DmRbh9Rv.svg",T7e="/assets/queue-DWpnpFgW.svg",C7e="_app_rurlx_1",A7e="_appChat_rurlx_36",E7e="_appChatEmpty_rurlx_42",M7e="_appShell_rurlx_47",I7e="_chatPane_rurlx_55",N7e="_mobileDrawer_rurlx_64",R7e="_mobileBackdrop_rurlx_68",L7e="_hamburgerButton_rurlx_72",j7e="_mobileDrawerOpen_rurlx_111",D7e="_appWithSidebar_rurlx_147",O7e="_themeDark_rurlx_195",B7e="_themeLight_rurlx_263",P7e="_content_rurlx_331",$7e="_contentHasMessages_rurlx_339",z7e="_footer_rurlx_348",F7e="_bottomPanels_rurlx_358",q7e="_approvalOverlay_rurlx_373",U7e="_scrollToBottomLayer_rurlx_382",H7e="_scrollToBottomLayerWithTodos_rurlx_393",V7e="_scrollToBottomButton_rurlx_397",W7e="_scrollToBottomIcon_rurlx_426",G7e="_btwPanel_rurlx_432",K7e="_composer_rurlx_439",Y7e="_escClearStatus_rurlx_446",X7e="_emptyWelcomeFooter_rurlx_453",Q7e="_queuedPrompts_rurlx_457",J7e="_queuedPrompt_rurlx_457",Z7e="_queuedPromptIcon_rurlx_487",e9e="_queuedPromptMaskIcon_rurlx_497",t9e="_queuedPromptActionIcon_rurlx_498",n9e="_queuedPromptText_rurlx_511",r9e="_queuedPromptState_rurlx_519",s9e="_queuedPromptSpinner_rurlx_527",i9e="_queuedPromptActions_rurlx_542",o9e="_queuedPromptAction_rurlx_498",a9e="_queuedHint_rurlx_587",Yt={app:C7e,appChat:A7e,appChatEmpty:E7e,appShell:M7e,chatPane:I7e,mobileDrawer:N7e,mobileBackdrop:R7e,hamburgerButton:L7e,mobileDrawerOpen:j7e,appWithSidebar:D7e,themeDark:O7e,themeLight:B7e,content:P7e,contentHasMessages:$7e,footer:z7e,bottomPanels:F7e,approvalOverlay:q7e,scrollToBottomLayer:U7e,scrollToBottomLayerWithTodos:H7e,scrollToBottomButton:V7e,scrollToBottomIcon:W7e,btwPanel:G7e,composer:K7e,escClearStatus:Y7e,emptyWelcomeFooter:X7e,queuedPrompts:Q7e,queuedPrompt:J7e,queuedPromptIcon:Z7e,queuedPromptMaskIcon:e9e,queuedPromptActionIcon:t9e,queuedPromptText:n9e,queuedPromptState:r9e,queuedPromptSpinner:s9e,queuedPromptActions:i9e,queuedPromptAction:o9e,queuedHint:a9e},MA=240;function l9e({prompts:e,t,onDelete:n,onInsert:r,onEdit:s}){return e.length===0?null:h.jsxs("div",{className:Yt.queuedPrompts,children:[e.map(i=>{var b;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>MA?`${o.slice(0,MA)}...`:o,l=((b=i.images)==null?void 0:b.length)??0,c=VB(i.text),u=i.serverState==="submitting",d=i.serverState==="running",f=i.isRemoving===!0,m=u||d||i.isEditing===!0||f;let p=t("queue.insertTip");m?p=t("queue.submittingDisabled"):c&&(p=t("queue.insertCommandDisabled"));let y=t("queue.editTip");m&&(y=t("queue.submittingDisabled"));const v=t(m?"queue.submittingDisabled":"queue.deleteTip");return h.jsxs("div",{className:Yt.queuedPrompt,children:[h.jsx("span",{className:Yt.queuedPromptIcon,"aria-hidden":"true",children:h.jsx("span",{className:Yt.queuedPromptMaskIcon,style:Uf("--queued-icon-url",T7e)})}),h.jsxs("span",{className:Yt.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:"",u||i.isEditing||f?h.jsxs("span",{className:Yt.queuedPromptState,children:[h.jsx("span",{className:Yt.queuedPromptSpinner}),f?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),h.jsxs("span",{className:Yt.queuedPromptActions,children:[l===0&&h.jsxs("button",{type:"button",className:Yt.queuedPromptAction,onClick:()=>r(i.id),disabled:c||m,title:p,children:[h.jsx("span",{className:Yt.queuedPromptActionIcon,style:Uf("--queued-icon-url",S7e),"aria-hidden":"true"}),t("queue.insert")]}),h.jsx("button",{type:"button",className:Yt.queuedPromptAction,onClick:()=>n(i.id),disabled:m,"aria-label":t("queue.delete"),title:v,children:h.jsx("span",{className:Yt.queuedPromptActionIcon,style:Uf("--queued-icon-url",k7e),"aria-hidden":"true"})}),h.jsx("button",{type:"button",className:Yt.queuedPromptAction,onClick:()=>s(i.id),disabled:m,"aria-label":t("queue.edit"),title:y,children:h.jsx("span",{className:Yt.queuedPromptActionIcon,style:Uf("--queued-icon-url",TB),"aria-hidden":"true"})})]})]},i.id)}),h.jsx("div",{className:Yt.queuedHint,children:t("queue.footer")})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function c9e(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}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const u9e=100;function IA(e,t){return e.length!==t.length?!1:e.every((n,r)=>{var i,o;const s=t[r];return s!==void 0&&n.id===s.id&&n.sessionId===s.sessionId&&n.text===s.text&&n.serverPromptId===s.serverPromptId&&n.serverState===s.serverState&&n.isEditing===s.isEditing&&n.isRemoving===s.isRemoving&&(((i=n.images)==null?void 0:i.length)??0)===(((o=s.images)==null?void 0:o.length)??0)})}function NA(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function d9e({connected:e,sessionId:t,clientId:n,streamingState:r,sessionActions:s,store:i,editorRef:o,reportError:a,notifySuccess:l,t:c}){const[u,d]=g.useState([]),f=g.useRef([]),m=g.useRef(1),p=g.useRef(t),y=g.useRef(null),v=g.useRef(new Set),b=g.useRef(new Set),w=g.useRef(new Set),x=g.useRef(new Map),k=g.useRef(new Set),T=g.useRef([]),A=g.useRef(r),M=g.useRef(0);p.current=t,A.current=r;const D=g.useMemo(()=>u.map(de=>de.text),[u]);g.useEffect(()=>{f.current=u},[u]),g.useEffect(()=>{var de;f.current=[],d([]),x.current.clear(),k.current.clear(),T.current=[];for(const se of v.current)se.abort();v.current.clear(),b.current.clear(),w.current.clear(),W.current=void 0,(de=y.current)==null||de.abort(),y.current=null},[t]);const O=g.useCallback((de,se)=>{const ae=f.current.filter(_e=>_e.serverPromptId?de.some(qe=>qe.promptId===_e.serverPromptId):!0);for(const _e of de){if(b.current.has(_e.promptId))continue;const qe=ae.findIndex(ye=>ye.serverPromptId===_e.promptId),He=w.current.has(_e.promptId);if(qe!==-1){if(He){ae.splice(qe,1);continue}ae[qe]={...ae[qe],text:_e.text,serverState:_e.state};continue}const re=ae.filter(ye=>!ye.serverPromptId&&ye.serverState==="submitting"&&ye.text===_e.text);if(re.length===1){const ye=ae.indexOf(re[0]);if(He){ae.splice(ye,1);continue}ae[ye]={...re[0],serverPromptId:_e.promptId,serverState:_e.state};continue}_e.state==="running"||He||ae.push({id:m.current++,sessionId:se,text:_e.text,serverPromptId:_e.promptId,serverState:_e.state})}IA(f.current,ae)||(f.current=ae,d(ae))},[]),C=g.useCallback(async(de=t)=>{if(!e||!de||p.current!==de)return!1;const se=++M.current;try{const ae=await s.getPendingPrompts({sessionId:de});return se!==M.current||p.current!==de?!1:(O(ae.pendingPrompts.filter(_e=>_e.state==="queued"||_e.state==="running"),de),!0)}catch(ae){return console.warn("Failed to refresh pending prompts",ae),!1}},[e,s,t,O]),L=g.useCallback(de=>{const se=p.current,ae=de.filter(re=>re.sessionId===void 0||re.sessionId===se);if(ae.length===0)return;const _e=new Set(f.current.map(re=>re.id)),qe=ae.filter(re=>!_e.has(re.id));if(qe.length===0)return;const He=[...f.current,...qe].sort((re,ye)=>re.id-ye.id);f.current=He,d(He)},[]),I=g.useCallback((de,se,ae)=>{var He,re,ye,Te;if(ae!==void 0&&p.current!==ae)return;const _e=((He=o.current)==null?void 0:He.getText())??"",qe=_e.trim()?`${de}
${_e}`:de;(re=o.current)==null||re.setText(qe),se&&se.length>0&&((ye=o.current)==null||ye.restoreImages(se)),(Te=o.current)==null||Te.focus()},[o]),B=g.useSyncExternalStore(kH,_H),F=g.useRef(B),W=g.useRef(void 0);g.useEffect(()=>{if(!e||!t)return;const de=F.current!==B;if(F.current=B,!de){if(f.current.length>0||r==="idle"||W.current===t)return;W.current=t}C()},[B,e,t,r,C]);const j=g.useSyncExternalStore(SH,wS,wS);g.useEffect(()=>{if(!t||j.length===0)return;const de=[];for(const se of j){if(se.data.sessionId!==t)continue;de.push(se);const ae=se.data.promptId;if(ae){if(se.type==="pending_prompt_started"){if(b.current.has(ae))continue;if((se.originatorClientId===void 0||se.originatorClientId===n)&&!w.current.has(ae)){const qe=typeof se.data.text=="string"?se.data.text:"",He=f.current.find(ye=>ye.serverPromptId===ae)??f.current.find(ye=>!ye.serverPromptId&&ye.serverState==="submitting"&&ye.text===qe),re=(He==null?void 0:He.text)??"";re&&(w.current.add(ae),i.appendLocalUserMessage(re,NA(He==null?void 0:He.images)))}C()}else if(se.type==="turn_complete"){w.current.delete(ae);const _e=x.current.get(ae);if(x.current.delete(ae),_e)_e();else if(!k.current.has(ae))for(k.current.add(ae),T.current.push(ae);T.current.length>u9e;){const qe=T.current.shift();qe&&k.current.delete(qe)}}else if(se.type==="turn_error"||se.type==="pending_prompt_completed"&&se.data.state==="removed"){w.current.delete(ae);const _e=x.current.get(ae);x.current.delete(ae),_e==null||_e(),k.current.delete(ae),T.current=T.current.filter(qe=>qe!==ae)}}}CH(de)},[j,t,n,i,C]);const K=g.useCallback((de,se)=>{if(k.current.delete(de)){T.current=T.current.filter(ae=>ae!==de),se();return}x.current.set(de,se)},[]),J=g.useCallback((de,se,ae)=>{const _e=de.trim();if(!_e)return!0;const qe=m.current++,He=p.current,re=new AbortController;v.current.add(re);const ye=se?[...se]:void 0,Te={id:qe,sessionId:He,text:_e,images:ye,onComplete:ae,serverState:"submitting"};return f.current=[...f.current,Te],d(f.current),s.submitPrompt(_e,{images:se,optimisticUserMessage:!1,sessionId:He,signal:re.signal}).then(ke=>{if(v.current.delete(re),p.current!==He){s.removePendingPrompt(ke.promptId,{sessionId:He}).catch(Pt=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:He,promptId:ke.promptId,error:Pt})});return}if(A.current==="idle"){w.current.has(ke.promptId)||(w.current.add(ke.promptId),i.appendLocalUserMessage(_e,NA(ye)));const Pt=f.current.filter(Ze=>Ze.id!==qe);f.current=Pt,d(Pt),ae&&K(ke.promptId,ae);return}const vt=f.current,rt=vt.findIndex(Pt=>Pt.id===qe);if(rt===-1){s.removePendingPrompt(ke.promptId,{sessionId:He}).then(Pt=>{Pt.removed||C(He)},()=>{C(He)});return}const Mt=[...vt];Mt[rt]={...Mt[rt],serverPromptId:ke.promptId,serverState:"queued"},f.current=Mt,d(Mt),ae&&K(ke.promptId,ae)}).catch(ke=>{if(v.current.delete(re),p.current!==He||!f.current.some(rt=>rt.id===qe))return;const vt=f.current.filter(rt=>rt.id!==qe);f.current=vt,d(vt),I(_e,ye,He),a(ke,c("queue.queueFailed"))}),!0},[C,a,I,s,K,i,c]);g.useEffect(()=>{if(r!=="idle")return;const de=y.current;de&&(console.debug("[mid-turn] turn settled; cancelling any in-flight push"),de.abort(),y.current=null)},[r]);const ee=g.useCallback(de=>{const se=f.current;if(se.length===0)return null;const ae=de===void 0?se.length-1:se.findIndex(He=>He.id===de);if(ae<0)return null;const _e=se[ae],qe=se.filter((He,re)=>re!==ae);return f.current=qe,d(qe),(_e==null?void 0:_e.text)??null},[]),N=g.useCallback((de,se)=>{const ae=f.current.map(_e=>_e.id===de?{..._e,...se}:_e);IA(ae,f.current)||(f.current=ae,d(ae))},[]),q=g.useCallback(async(de,se,ae)=>{if(!de.serverPromptId)return!0;if(de.serverState!=="queued"||b.current.has(de.serverPromptId))return!1;const _e=de.sessionId;b.current.add(de.serverPromptId),N(de.id,se);try{const qe=await s.removePendingPrompt(de.serverPromptId,{sessionId:_e});return b.current.delete(de.serverPromptId),qe.removed?(x.current.delete(de.serverPromptId),await C(_e)||(N(de.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),ae)),!0):(N(de.id,{isEditing:!1,isRemoving:!1}),await C(_e),a(new Error("Prompt could not be removed from queue"),ae),!1)}catch(qe){return b.current.delete(de.serverPromptId),N(de.id,{isEditing:!1,isRemoving:!1}),await C(_e)||L([de]),a(qe,ae),!1}},[C,a,L,s,N]),P=g.useCallback(de=>{const se=f.current.find(ae=>ae.id===de);if((se==null?void 0:se.serverState)!=="submitting"&&se){if(!se.serverPromptId){const ae=f.current.filter(_e=>_e.id!==de);f.current=ae,d(ae);return}q(se,{isRemoving:!0},c("queue.deleteFailed"))}},[q,c]),E=g.useCallback(async de=>{var re;const se=f.current.find(ye=>ye.id===de);if(!se||(((re=se.images)==null?void 0:re.length)??0)>0||se.serverState==="submitting"||se.isEditing||se.isRemoving||VB(se.text))return;const ae=se.serverPromptId?se.onComplete??x.current.get(se.serverPromptId):void 0,_e=()=>{se.serverPromptId&&x.current.delete(se.serverPromptId),ae==null||ae()};if(se.serverPromptId&&!await q(se,{isRemoving:!0},c("queue.insertFailed")))return;let qe=y.current;qe||(qe=new AbortController,y.current=qe);let He;try{He=await s.enqueueMidTurnMessage(se.text,{signal:qe.signal})}catch(ye){se.serverPromptId&&(I(se.text,se.images,se.sessionId),_e()),a(ye,c("queue.insertFailed"));return}if(!He.accepted){se.serverPromptId&&(I(se.text,se.images,se.sessionId),_e()),a(new Error("Queued message was not accepted for insertion"),c("queue.insertFailed"));return}if(_e(),!se.serverPromptId){const ye=f.current.filter(Te=>Te.id!==de);f.current=ye,d(ye)}l(c("queue.inserted"))},[q,l,a,I,s,c]),ne=g.useCallback(async de=>{const se=f.current.find(_e=>_e.id===de);if(!se||se.serverState==="submitting"||se.isEditing||se.isRemoving)return;if(se.serverPromptId){if(!await q(se,{isEditing:!0},c("queue.editFailed")))return;I(se.text,se.images,se.sessionId);return}const ae=ee(de);ae&&I(ae,se.images,se.sessionId)},[ee,q,I,c]),pe=g.useCallback(()=>{const de=f.current;if(de.length===0)return!1;const se=de[de.length-1];if(!se)return!1;if(se.serverState==="submitting"||se.isEditing||se.isRemoving)return!0;if(!se.serverPromptId){const ae=ee(se.id);return ae?(I(ae,se.images,se.sessionId),!0):!1}return se.serverState!=="queued"?!1:((async()=>{await q(se,{isEditing:!0},c("queue.editFailed"))&&I(se.text,se.images,se.sessionId)})().catch(ae=>{a(ae,c("queue.editFailed"))}),!0)},[ee,q,a,I,c]),be=g.useCallback(()=>{if(f.current.length===0)return!1;const de=p.current,se=f.current.filter(ye=>ye.serverState==="submitting"),ae=f.current.filter(ye=>ye.serverState!=="submitting");for(const ye of[...se].reverse())I(ye.text,ye.images,ye.sessionId);for(const ye of v.current)ye.abort();const _e=ae.filter(ye=>ye.serverPromptId);if(_e.length===0)return f.current=[],d([]),i.dispatch([{type:"status",text:c("queue.cleared")}]),!0;const qe=new Set(f.current.map(ye=>ye.id)),He=new Set(_e.map(ye=>ye.serverPromptId).filter(ye=>!!ye));for(const ye of He)b.current.add(ye);const re=f.current.filter(ye=>!qe.has(ye.id)).concat(_e.map(ye=>({...ye,isRemoving:!0})));return f.current=re,d(re),(async()=>{var vt;const ye=[];if(await Promise.all(_e.map(async rt=>{const Mt=rt.serverPromptId;try{if((await s.removePendingPrompt(Mt,{sessionId:rt.sessionId})).removed){x.current.delete(Mt);return}ye.push(rt)}catch{ye.push(rt)}finally{b.current.delete(Mt)}})),p.current!==de)return;const Te=ye.map(rt=>({...rt,isRemoving:!1})),ke=f.current.filter(rt=>rt.serverPromptId?!He.has(rt.serverPromptId):!qe.has(rt.id)).concat(Te);if(f.current=ke,d(ke),ye.length>0){a(new Error("Some prompts could not be removed from queue"),c("queue.deleteFailed")),C((vt=ye[0])==null?void 0:vt.sessionId);return}i.dispatch([{type:"status",text:c("queue.cleared")}])})(),!0},[C,a,I,i,c,s]),{batches:xe,consume:we}=JH();return g.useEffect(()=>{if(!t||xe.length===0)return;n===void 0&&xe.some(se=>se.sessionId===t&&se.originatorClientId!==void 0)&&console.debug("[mid-turn] originator-stamped batches but no client id; dedupe skipped (may resend next turn)");const de=c9e(f.current,xe,t,n);de&&(f.current=de,d(de)),we(xe.filter(se=>se.sessionId===t))},[xe,t,n,we]),{queuedPrompts:u,queuedTexts:D,enqueuePrompt:J,removeQueuedPrompt:P,insertQueuedPrompt:E,editQueuedPrompt:ne,editLastQueuedPrompt:pe,clearQueuedPrompts:be}}const h9e="_layout_ghraz_1",f9e="_muted_ghraz_8",m9e="_notice_ghraz_13",p9e="_list_ghraz_20",g9e="_group_ghraz_26",y9e="_groupTitle_ghraz_33",b9e="_server_ghraz_39",w9e="_serverCard_ghraz_44",v9e="_serverCardExpanded_ghraz_50",x9e="_row_ghraz_55",_9e="_expandedRow_ghraz_72",k9e="_serverRow_ghraz_76",S9e="_rowMain_ghraz_81",T9e="_rowIcon_ghraz_96",C9e="_chevronCell_ghraz_125",A9e="_toolRow_ghraz_135",E9e="_chevron_ghraz_125",M9e="_chevronExpanded_ghraz_150",I9e="_disabled_ghraz_154",N9e="_name_ghraz_158",R9e="_serverName_ghraz_166",L9e="_status_ghraz_170",j9e="_badge_ghraz_171",D9e="_toolCount_ghraz_185",O9e="_resourceCount_ghraz_190",B9e="_promptCount_ghraz_191",P9e="_success_ghraz_196",$9e="_warning_ghraz_200",z9e="_error_ghraz_204",F9e="_serverDetail_ghraz_208",q9e="_serverDetailHeader_ghraz_218",U9e="_serverActions_ghraz_223",H9e="_field_ghraz_230",V9e="_label_ghraz_238",W9e="_value_ghraz_244",G9e="_button_ghraz_249",K9e="_message_ghraz_269",Y9e="_schema_ghraz_270",X9e="_tools_ghraz_281",Q9e="_tool_ghraz_135",J9e="_resources_ghraz_292",Z9e="_sectionTitle_ghraz_301",eTe="_resourceUri_ghraz_306",tTe="_resourceLabel_ghraz_314",nTe="_toolDetail_ghraz_324",rTe="_section_ghraz_301",sTe="_description_ghraz_347",iTe="_parameter_ghraz_353",oTe="_empty_ghraz_359",aTe="_emptyTools_ghraz_360",Ye={layout:h9e,muted:f9e,notice:m9e,list:p9e,group:g9e,groupTitle:y9e,server:b9e,serverCard:w9e,serverCardExpanded:v9e,row:x9e,expandedRow:_9e,serverRow:k9e,rowMain:S9e,rowIcon:T9e,chevronCell:C9e,toolRow:A9e,chevron:E9e,chevronExpanded:M9e,disabled:I9e,name:N9e,serverName:R9e,status:L9e,badge:j9e,toolCount:D9e,resourceCount:O9e,promptCount:B9e,success:P9e,warning:$9e,error:z9e,serverDetail:F9e,serverDetailHeader:q9e,serverActions:U9e,field:H9e,label:V9e,value:W9e,button:G9e,message:K9e,schema:Y9e,tools:X9e,tool:Q9e,resources:J9e,sectionTitle:Z9e,resourceUri:eTe,resourceLabel:tTe,toolDetail:nTe,section:rTe,description:sTe,parameter:iTe,empty:oTe,emptyTools:aTe};function RA(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 lTe(e,t){if(e.disabled)return{text:t("mcp.status.disabled"),className:Ye.error};switch(e.mcpStatus){case"connected":return{text:t("mcp.status.connected"),className:Ye.success};case"connecting":return{text:t("mcp.status.starting"),className:Ye.warning};case"disconnected":default:return{text:t("mcp.status.disconnectedTitle"),className:Ye.error}}}function cTe(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function y4(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function uTe(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 dTe(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 LA(e,t){return`${e}:${t}`}function jA(e,t){return`${e}\0${t}`}const Vl=Bk;function b4({expanded:e}){return h.jsx("svg",{className:`${Ye.chevron} ${e?Ye.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 hTe(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 fTe({tool:e,t}){const n=uTe(e);if(!n)return h.jsx("div",{className:Ye.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:Ye.schema,children:JSON.stringify(n,null,2)});const i=Object.entries(r);return i.length===0?null:h.jsxs("div",{className:Ye.section,children:[h.jsx("div",{className:Ye.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:Ye.parameter,children:`- ${o}${s.has(o)?t("mcp.required"):""}: ${c}${u?` - ${u}`:""}`},o)})]})}function Vf({label:e,value:t}){return h.jsxs("div",{className:Ye.field,children:[h.jsx("span",{className:Ye.label,children:e}),h.jsx("span",{className:Ye.value,children:t})]})}function mTe({tool:e,t}){const n=dTe(e,t);return h.jsxs("div",{className:Ye.toolDetail,children:[e.isValid?null:h.jsxs("div",{className:Ye.section,children:[h.jsx("div",{className:`${Ye.sectionTitle} ${Ye.error}`,children:t("mcp.invalidToolWarning")}),h.jsxs("div",{className:Ye.muted,children:[Vl(t("mcp.invalidReasonLabel"))," ",e.invalidReason||t("mcp.status.unknown")]}),h.jsx("div",{className:Ye.muted,children:t("mcp.invalidToolHelp")})]}),e.description?h.jsxs("div",{className:Ye.section,children:[h.jsx("div",{className:Ye.sectionTitle,children:Vl(t("mcp.description"))}),h.jsx("div",{className:Ye.description,children:e.description.trim()})]}):h.jsx("div",{className:Ye.muted,children:t("mcp.noDescription")}),n?h.jsx(Vf,{label:Vl(t("mcp.annotations")),value:n}):null,h.jsx(fTe,{tool:e,t})]})}function pTe({resource:e,t}){const n=e.title||e.name||"",r=n!==""&&n!==e.uri;return h.jsxs("div",{className:Ye.toolDetail,children:[h.jsx(Vf,{label:Vl(t("mcp.resource.uriLabel")),value:e.uri}),r?h.jsx(Vf,{label:Vl(t("mcp.resource.nameLabel")),value:n}):null,e.mimeType?h.jsx(Vf,{label:Vl(t("mcp.resource.mimeTypeLabel")),value:e.mimeType}):null,typeof e.size=="number"?h.jsx(Vf,{label:Vl(t("mcp.resource.sizeLabel")),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?h.jsxs("div",{className:Ye.section,children:[h.jsx("div",{className:Ye.sectionTitle,children:Vl(t("mcp.description"))}),h.jsx("div",{className:Ye.description,children:e.description.trim()})]}):null]})}function gTe({message:e}){const{t}=lt(),n=bN({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),[w,x]=g.useState(null);g.useEffect(()=>{d(L=>{const I=new Set(c.map(B=>B.name));return new Set([...L].filter(B=>I.has(B)))})},[c]);const k=c.filter(L=>!L.disabled&&L.mcpStatus==="connecting").length,T=g.useMemo(()=>{var I,B;const L=[];for(const F of c){const W=cTe(F,t),j={server:F,tools:((I=i[F.name])==null?void 0:I.tools)??[],resources:((B=a[F.name])==null?void 0:B.resources)??[]},K=L.find(J=>J.label===W);K?K.items.push(j):L.push({label:W,items:[j]})}return L},[c,t,i,a]),A=g.useCallback(async L=>{var W;const I=await n.reload();if(!I)return;s(I);const B=(W=I.servers)==null?void 0:W.find(j=>j.name===L);if(!B)return;const F=await n.loadTools(B.name);if(o(j=>({...j,[B.name]:F})),B.resourceCount)try{const j=await n.loadResources(B.name);l(K=>({...K,[B.name]:j}))}catch{}else l(j=>{if(!(B.name in j))return j;const K={...j};return delete K[B.name],K})},[n]),M=g.useCallback(async(L,I)=>{if(!w){d(new Set([L.name])),x(L.name),b({serverName:L.name,text:I.id==="authenticate"?y4(L.name,t):t("mcp.action.running",{action:I.label})});try{let B=null;if(I.id==="reconnect")await n.restartServer(L.name);else{const F=await n.manageServer(L.name,I.id),W=[...F.messages??[],...F.authUrl?[F.authUrl]:[]].join(`
`);W&&(B=I.id==="authenticate"?y4(L.name,t,W):W)}await A(L.name),b({serverName:L.name,text:B??t("mcp.action.done",{action:I.label})})}catch(B){b({serverName:L.name,text:I.id==="authenticate"?y4(L.name,t,RA(B)):t("mcp.action.failed",{error:RA(B)})})}finally{x(null)}}},[w,n,A,t]),D=g.useCallback(L=>{d(I=>I.has(L)?new Set:new Set([L])),m(new Set),y(new Set)},[]),O=g.useCallback((L,I)=>{const B=LA(L,I);m(F=>F.has(B)?new Set:new Set([B]))},[]),C=g.useCallback((L,I)=>{const B=jA(L,I);y(F=>F.has(B)?new Set:new Set([B]))},[]);return h.jsxs("div",{className:Ye.layout,"data-keyboard-scope":!0,children:[k>0?h.jsxs("div",{className:Ye.notice,children:[t("mcp.starting",{count:k}),h.jsx("div",{className:Ye.muted,children:t("mcp.startingNote")})]}):null,c.length===0?h.jsx("div",{className:Ye.empty,children:t("mcp.empty")}):h.jsx("div",{className:Ye.list,children:T.map(L=>h.jsxs("div",{className:Ye.group,children:[L.label!==t("mcp.extensionMcp")?h.jsx("div",{className:Ye.groupTitle,children:L.label}):null,L.items.map(({server:I,tools:B,resources:F})=>{var q;const W=lTe(I,t),j=u.has(I.name),K=hTe(I,t),J=((q=i[I.name])==null?void 0:q.tools.length)??0,ee=I.resourceCount??0,N=I.promptCount??0;return h.jsx("div",{className:Ye.server,children:h.jsxs("div",{className:`${Ye.serverCard} ${j?Ye.serverCardExpanded:""}`,children:[h.jsxs("button",{type:"button",className:`${Ye.row} ${Ye.serverRow} ${j?Ye.expandedRow:""}`,onClick:()=>D(I.name),"aria-label":t(j?"mcp.collapse":"mcp.expand"),children:[h.jsxs("span",{className:Ye.rowMain,children:[h.jsx("span",{className:Ye.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Ye.name} ${Ye.serverName}`,children:I.name})]}),h.jsx("span",{className:`${Ye.status} ${W.className}`,children:W.text}),h.jsx("span",{className:`${Ye.badge} ${Ye.toolCount}`,children:t(J===1?"mcp.toolCount":"mcp.toolsCount",{count:J})}),ee>0?h.jsx("span",{className:`${Ye.badge} ${Ye.resourceCount}`,children:t("mcp.resourceCount",{count:ee})}):null,N>0?h.jsx("span",{className:`${Ye.badge} ${Ye.promptCount}`,children:t("mcp.promptCount",{count:N})}):null,h.jsx("span",{className:Ye.chevronCell,"aria-hidden":"true",children:h.jsx(b4,{expanded:j})})]}),j?h.jsxs("div",{className:Ye.serverDetail,children:[K.length>0?h.jsx("div",{className:Ye.serverDetailHeader,children:h.jsx("div",{className:Ye.serverActions,children:K.map(P=>h.jsx("button",{type:"button",className:Ye.button,onClick:()=>void M(I,P),disabled:w!==null,children:P.label},P.id))})}):null,(v==null?void 0:v.serverName)===I.name?h.jsx("pre",{className:Ye.message,children:v.text}):null,B.length===0?h.jsx("div",{className:Ye.emptyTools,children:t("mcp.emptyTools")}):h.jsx("div",{className:Ye.tools,children:B.map(P=>{const E=LA(I.name,P.name),ne=f.has(E);return h.jsxs("div",{className:Ye.tool,children:[h.jsxs("button",{type:"button",className:`${Ye.row} ${Ye.toolRow} ${ne?Ye.expandedRow:""} ${P.isValid?"":Ye.disabled}`,onClick:()=>O(I.name,P.name),children:[h.jsx("span",{className:Ye.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:Ye.name,children:P.name}),h.jsx(b4,{expanded:ne})]}),ne?h.jsx(mTe,{tool:P,t}):null]},P.name)})}),ee>0?h.jsxs("div",{className:Ye.resources,children:[h.jsx("div",{className:Ye.sectionTitle,children:t("mcp.resources")}),F.length===0?h.jsx("div",{className:Ye.emptyTools,children:t("mcp.resourcesUnavailable")}):null,F.map(P=>{const E=jA(I.name,P.uri),ne=p.has(E),pe=P.title||P.name||"";return h.jsxs("div",{className:Ye.tool,children:[h.jsxs("button",{type:"button",className:`${Ye.row} ${Ye.toolRow} ${ne?Ye.expandedRow:""}`,onClick:()=>C(I.name,P.uri),children:[h.jsx("span",{className:Ye.rowIcon,"aria-hidden":"true"}),h.jsx("span",{className:`${Ye.name} ${Ye.resourceUri}`,children:P.uri}),pe&&pe!==P.uri?h.jsx("span",{className:Ye.resourceLabel,children:pe}):null,h.jsx(b4,{expanded:ne})]}),ne?h.jsx(pTe,{resource:P,t}):null]},P.uri)})]}):null]}):null]})},I.name)})]},L.label))})]})}function E3(e){return Iy.includes(e)}async function yTe({sessionActions:e,modelId:t,modeId:n,warn:r=console.warn}){await e.createSession();try{await e.attachSession()}catch(s){throw r("[WebShell] failed to attach new session:",s),await e.closeSession().catch(i=>{r("[WebShell] failed to close unattached session:",i)}),await e.clearSession().catch(i=>{r("[WebShell] failed to clear unattached session:",i)}),s}await Promise.all([t?e.setModel(t).catch(s=>{r("[WebShell] failed to set model for new session:",s)}):Promise.resolve(),n&&E3(n)?e.setApprovalMode(n).catch(s=>{r("[WebShell] failed to set approval mode for new session:",s)}):Promise.resolve()])}function bTe({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function wTe({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"common.loading":t||n?"editor.processing":"editor.placeholder"}function vTe({connectionStatus:e}){return e==="disconnected"||e==="error"}const Gh=g.createContext(!1),$k=g.createContext(new Map),WB=g.createContext(new Map);function xTe({timeline:e,details:t,children:n}){return h.jsx($k.Provider,{value:e,children:h.jsx(WB.Provider,{value:t,children:n})})}const rg=Iy,_Te="ui.compactMode",kTe="ui.hideTips",STe=new Set(["coder-model(qwen-oauth)"]);function DA(e){return!STe.has(e.id)}function w4(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const GB=new Set(["clear","stop","off","reset","none","cancel"]);function TTe(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return GB.has(t)}function CTe(e){const t=e;return t.source!=="goal"?null:F1(t.data)??F1(t.text)}function ATe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const r=CTe(n);if(r)return r.kind==="set"||r.kind==="checking"?{condition:r.condition,setAt:r.setAt??n.serverTimestamp??n.createdAt}:null}return null}const OA={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},KB=1e3,YB="qwen-code-web-shell-chat-width",ETe=40,XB="qwen-code-web-shell-sidebar-collapsed";function MTe(e){return e===!0?{enabled:!0,defaultCollapsed:!1}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1}:{enabled:!1,defaultCollapsed:!1}}function ITe(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(XB);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function NTe(e){try{window.localStorage.setItem(XB,String(e))}catch{}}function Pg(){return`${KB}`}function RTe(){if(typeof window>"u")return Pg();try{return window.localStorage.getItem(YB)==="wide"?"wide":Pg()}catch{return Pg()}}function LTe(e){try{window.localStorage.setItem(YB,e)}catch{}}function QB(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:KB}function jTe(e,t){const n=`${QB(t)}px`,r=`calc(${n} + ${ETe}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 BA(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function DTe(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return dc(e.get("language")??e.get("lang")??navigator.language)}function OTe(e,t){return e instanceof Error?e.message:t}function v4(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function hd(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function BTe(e){e.length>0&&console.info("[web-shell] useSessionNotices()",{notices:e})}function PTe(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function $Te(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function x4(e){return typeof e=="object"&&e!==null}function zTe(e){if(!x4(e))return null;const t=e._meta;if(!x4(t))return null;const n=t.qwenModelSwitch;if(!x4(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 FTe(e){return`Using ${e.isRuntime?"runtime ":""}model: ${e.modelId}`}function qTe(e){return e.toolKind==="edit"}function PA(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?Uh(e.toolName):!0}function UTe(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 HTe(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 VTe(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools)(_N(r)||HTe(r))&&t.push(`${r.callId}:${r.status}`);return t.join("|")}function WTe(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 GTe(e,t){return e===Kr.NO_OUTPUT?t("copy.noOutput"):e===Kr.NO_TEXT?t("copy.noText"):e===Kr.CODE_MISSING?t("copy.codeMissing"):e===Kr.LATEX_MISSING?t("copy.latexMissing"):e===Kr.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Kr.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Kr.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Kr.CLIPBOARD_PREFIX.length)}`:e.endsWith(Kr.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Kr.COPIED_SUFFIX.length)}):e}function KTe({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,renderComposerToolbarRight:w,renderFooter:x,chatMaxWidth:k,sidebar:T,composerToolbarActions:A,compactThinking:M=!1,collapseCompletedTurns:D=!0,markdownTableMode:O="basic",virtualScrollThreshold:C,markdown:L,loadingPhrases:I,onTranscriptChange:B,onToast:F,composerRef:W,onComposerReady:j,composerInput:K,composerInputVersion:J}={}){var f6;const[ee,N]=g.useState(RTe),[q,P]=g.useState(()=>r===void 0?DTe():dc(r)),E=g.useMemo(()=>TN(q),[q]),ne=g.useMemo(()=>MTe(T),[T]),[pe,be]=g.useState(()=>ITe(ne.defaultCollapsed)),[xe,we]=g.useState(null),[de,se]=g.useState(!1),ae=g.useCallback(()=>se(!1),[]);g.useEffect(()=>{const z=window.matchMedia("(max-width: 760px)"),Y=ge=>{ge.matches||se(!1)};return z.addEventListener("change",Y),()=>z.removeEventListener("change",Y)},[]),g.useEffect(()=>{if(!de)return;const z=st=>{if(st.key!=="Escape"||xn.current)return;const Rt=st.target;Km(Rt)&&!(Rt!=null&&Rt.closest("[data-mobile-drawer]"))||(st.stopPropagation(),st.preventDefault(),ae())},Y=document.body.style.overflow;document.body.style.overflow="hidden";const ge=st=>{const Rt=st.target;Rt!=null&&Rt.closest("[data-mobile-drawer]")&&!Rt.closest(`.${Yt.mobileBackdrop}`)||st.preventDefault()};return document.addEventListener("touchmove",ge,{passive:!1}),window.addEventListener("keydown",z,!0),()=>{document.body.style.overflow=Y,document.removeEventListener("touchmove",ge),window.removeEventListener("keydown",z,!0)}},[de,ae]);const _e=g.useCallback(z=>{be(z),NTe(z)},[]),qe=g.useMemo(()=>({renderToolHeaderExtra:m,renderWelcomeHeader:p,renderWelcomeFooter:y,renderComposerToolbarStart:v,renderComposerToolbarEnd:b,renderComposerToolbarRight:w,renderFooter:x,compactThinking:M,collapseCompletedTurns:D,markdownTableMode:O,markdown:L,loadingPhrases:I}),[m,p,y,v,b,w,x,M,D,O,L,I]),He=x,re=W_(),ye=Ly(),Te=gl(),ke=jy(),{notices:vt,dismissNotice:rt}=$H(),Mt=Rc(),Pt=g.useRef(F);Pt.current=F;const Ze=g.useRef(0),[bt,ft]=g.useState([]),ie=g.useCallback(z=>{ft(Y=>Y.filter(ge=>ge.id!==z))},[]),H=g.useCallback((z,Y)=>{if(Pt.current){Pt.current(z,Y);return}const ge={id:`web-shell-toast-${Date.now()}-${++Ze.current}`,tone:z,message:Y};ft(st=>[...st.filter(ut=>ut.tone!==z||ut.message!==Y),ge].slice(-4))},[]),oe=r7e(E),De=g.useRef(oe);De.current=oe;const[tt,Ct]=g.useState(null),[Et,Qt]=g.useState(null),on=g.useRef(1),he=g.useRef(1),X=g.useRef(null),ue=g.useRef(Te.sessionId),me=g.useRef(void 0),We=g.useMemo(()=>{const z=[tt].filter(ge=>ge!==null);if(z.length===0)return AA(oe);const Y=[...oe];for(const ge of z.sort((st,Rt)=>st.anchorIndex-Rt.anchorIndex)){const st=ge.anchorAfterId?Y.findIndex(ut=>ut.id===ge.anchorAfterId):-1,Rt=st>=0?st+1:Math.min(ge.anchorIndex,Y.length);Y.splice(Rt,0,ge.message)}return AA(Y)},[oe,tt]),At=ASe(ye),jt=g.useMemo(()=>ZH(At),[At]),dt=i7e(jt),Wt=!(Te.catchingUp&&xe!==null),Rn=PA(dt)&&Wt?dt:null,ln=dt&&!PA(dt)&&Wt?dt:null,xn=g.useRef(dt);xn.current=Wt?dt:null;const Ee=g.useMemo(()=>Jde(oe),[oe]),ht=g.useRef(null),en=g.useMemo(()=>{const z=ehe(oe),Y=ht.current;if(Y&&Y.signature===z)return Y.timeline;const ge=Zde(oe);return ht.current={signature:z,timeline:ge},ge},[oe]),ns=g.useRef(null),ri=g.useMemo(()=>{const z=the(oe),Y=ns.current;if(Y&&Y.signature===z)return Y.details;const ge=ahe(oe);return ns.current={signature:z,details:ge},ge},[oe]),Si=o7e(Ee.todos,z=>`${z.id}:${z.status}:${z.content}`),$o=Ee.allCompleted,[gr,Sr]=g.useState("hidden"),rs=Te.catchingUp||Si.length===0||$o?"hidden":"active";rs!==gr&&Sr(rs);const fe=rs!=="hidden",ze=g.useMemo(()=>VTe(oe),[oe]),[St,sn]=g.useState(0),nn=ISe(ze,Te.status==="connected",St),yr=g.useMemo(()=>x?nn.map(WTe):[],[nn,x]),qr=g.useRef(null),Ps=g.useRef(null),hr=g.useRef(null),Gt=g.useRef(null),rn=g.useRef(null),[Ur,$s]=g.useState(!1),Hr=g.useRef(null),br=g.useRef(!1),xt=g.useCallback((z="smooth")=>{requestAnimationFrame(()=>{var Y;(Y=Ps.current)==null||Y.scrollToBottom(z),requestAnimationFrame(()=>{var ge;(ge=Ps.current)==null||ge.scrollToBottom(z)})})},[]),Ea=g.useCallback(z=>{hr.current=z,BA(W,z??OA),z&&Gt.current!==z&&(Gt.current=z,j==null||j(z))},[W,j]);g.useEffect(()=>{BA(W,hr.current??OA)},[W]);const[ss,Vr]=g.useState(null),Cs=g.useRef(null);Cs.current=ss;const{followupState:Kh,onAcceptFollowup:zo,onDismissFollowup:Ma,clear:Fo}=QH({onAccept:z=>{var Y;(Y=hr.current)==null||Y.insertText(z)}}),Xn=G_(),Ki=g.useRef(Xn),Ia=g.useRef(Date.now()),Q=g.useRef(Xn);Q.current==="idle"&&Xn!=="idle"&&(Ia.current=Date.now()),Q.current=Xn;const ce=g.useMemo(()=>{if(Xn!=="idle"){for(let z=We.length-1;z>=0;z--){const Y=We[z];if((Y==null?void 0:Y.role)==="user")return Y.timestamp??Ia.current}return Ia.current}},[We,Xn]),Ie=g.useRef(""),Qe=g.useRef(void 0),Kt=g.useRef(null),Dt=g.useRef(null),[pn,Pn]=g.useState(!1),or=g.useRef(pn);or.current=pn;const Tn=Te.status==="connected",[zs,Yi]=g.useState([]);g.useEffect(()=>{Tn&&Mt.loadSkillsStatus().then(z=>{Yi(((z==null?void 0:z.skills)??[]).map(Y=>({name:Y.name,description:Y.description??""})).sort((Y,ge)=>Y.name.localeCompare(ge.name)))}).catch(()=>{})},[Tn,Mt]);const[ms,ko]=g.useState(null),[si,Xu]=g.useState([]),[So,qo]=g.useState(!1),[te,Ve]=g.useState(!1),[Xe,Tt]=g.useState(!1),[_t,qt]=g.useState(!1),[Ot,$n]=g.useState(!1),[Wr,Qn]=g.useState(!1),[Cn,_n]=g.useState(!1),[To,Uo]=g.useState(!1),[Xi,Qu]=g.useState(!1),[Yh,Tb]=g.useState(null),[zk,Xh]=g.useState(!1),[Fk,qk]=g.useState(!1),[Uk,Cb]=g.useState(!1),[tP,nP]=g.useState(0),[rP,sP]=g.useState(0),Fs=Hu(),Hk=g.useRef((Fs==null?void 0:Fs.extensionsVersion)??0);g.useEffect(()=>{const z=(Fs==null?void 0:Fs.extensionsVersion)??0;if(z!==Hk.current){Hk.current=z;const Y=Fs==null?void 0:Fs.lastExtensionChange;if((Y==null?void 0:Y.status)==="failed"){re.dispatch([{type:"error",text:E("extensions.action.failed",{name:Y.name??"",source:Y.source??"",error:Y.error??E("error.unknown")})}]);return}if((Y==null?void 0:Y.status)==="installed"){const ge=Y.name??Y.source??E("extensions.label");re.dispatch([{type:"status",text:Y.version?E("extensions.install.installedWithVersion",{name:ge,version:Y.version}):E("extensions.install.installed",{name:ge})}])}else if(Y!=null&&Y.status){const ge=Y.name??Y.source??E("extensions.label"),st=Y.status==="updated"&&Y.version?"extensions.manage.updatedWithVersion":`extensions.manage.${Y.status}`;re.dispatch([{type:"status",text:E(st,{name:ge,version:Y.version??""})}])}ke.refreshCommands().catch(()=>{re.dispatch([{type:"error",text:E("extensions.commands.refreshFailed")}])})}},[Fs==null?void 0:Fs.extensionsVersion,Fs==null?void 0:Fs.lastExtensionChange,ke,re,E]);const[iP,oP]=g.useState("workspace"),[Qh,Ab]=g.useState(null),[aP,Vk]=g.useState(!1),[lP,Wk]=g.useState(!1),P0=g.useRef(null),Ju=g.useRef(null),[Eb,$0]=g.useState(null),[Mb,Ib]=g.useState(t??Ns.Dark),[Zu,Gk]=g.useState(""),z0=g.useRef(Zu);z0.current=Zu;const ed=g.useCallback(z=>{z0.current=z,Gk(z)},[]),is=g.useRef(Te);is.current=Te;const os=g.useCallback(()=>is.current.sessionId?!0:(H("info",E("localCommand.noSession")),!1),[H,E]),cP=Te.displayName,[Ho,Nb]=g.useState("default"),Rb=g.useRef(Ho);Rb.current=Ho;const Jh=g.useCallback(z=>{Rb.current=z,Nb(z)},[]),[Lb,F0]=g.useState(!1),Zh=g.useRef(null);g.useEffect(()=>{Te.sessionId&&(Zh.current=null)},[Te.sessionId]);const Kk=g.useCallback(()=>is.current.sessionId?Promise.resolve():(Zh.current||(Zh.current=(async()=>{const z=z0.current||is.current.currentModel,Y=Rb.current||is.current.currentMode;await yTe({sessionActions:ke,modelId:z,modeId:Y})})().catch(z=>{throw Zh.current=null,z})),Zh.current),[ke]),Qi=g.useCallback(async(z,Y,ge)=>{var je;Fo();const st=!z.trimStart().startsWith("/");!(ge!=null&&ge.retry)&&st&&(Ie.current=z,Qe.current=Y,Dt.current=null),Pn(!1);const Rt=!is.current.sessionId;Rt&&F0(!0);try{await Kk()}finally{Rt&&F0(!1)}const ut={images:Y,optimisticUserMessage:ge==null?void 0:ge.optimisticUserMessage,retry:ge==null?void 0:ge.retry};return ge!=null&&ge.clearComposerOnPromptStart&&((je=hr.current)==null||je.clear()),await ke.sendPrompt(z,ut)},[Fo,Kk,ke]),uP=g.useMemo(()=>(Te.models??[]).filter(DA).map(z=>({id:z.id,label:ay(z.label||z.id)})),[Te.models]),Na=te||Xe||_t||Ot||Wr||Cn||To||Xi||ms!==null||So||Eb!==null||Yh!==null||Qh!==null||zk||Fk||Uk,Nt=g.useCallback((z,Y)=>{if(v4(z))return;if(UI(z)){console.debug("[web-shell] turn error rendered in transcript",z);return}if(hd(z)){console.debug("[web-shell] error already handled by notice",z);return}const ge=OTe(z,Y);console.error("[web-shell]",ge,z),H("error",ge)},[H]),dP=g.useCallback(z=>H("success",z),[H]),{queuedPrompts:hP,queuedTexts:fP,enqueuePrompt:Pc,removeQueuedPrompt:mP,insertQueuedPrompt:pP,editQueuedPrompt:gP,editLastQueuedPrompt:yP,clearQueuedPrompts:bP}=d9e({connected:Tn,sessionId:Te.sessionId,clientId:Te.clientId,streamingState:Xn,sessionActions:ke,store:re,editorRef:hr,reportError:Nt,notifySuccess:dP,t:E});g.useEffect(()=>{BTe(vt);for(const z of vt)PTe(z)?H($Te(z),z.message):z.category==="lifecycle"?console.debug("[web-shell] daemon notice",z):console.warn("[web-shell] daemon notice",z),rt(z.id)},[rt,vt,H]);const jb=g.useRef(u);jb.current=u,g.useEffect(()=>{var z;ue.current=Te.sessionId,(z=X.current)==null||z.abort(),X.current=null,Ct(null),Qt(null),$0(null),H0.current=0},[Te.sessionId]);const Yk=g.useCallback(()=>{var Rt;if(!os())return;const z=`local-recap-${on.current++}`,Y=oe.length,ge=(Rt=oe.at(-1))==null?void 0:Rt.id,st=Te.sessionId;Ct({anchorAfterId:ge,anchorIndex:Y,message:{id:z,role:"system",content:`※ ${E("recap.label")}: ${E("recap.loading")}`,variant:"info",source:"recap"}}),ke.recapSession().then(ut=>{ue.current===st&&Ct({anchorAfterId:ge,anchorIndex:Y,message:{id:z,role:"system",content:ut.recap?`※ ${E("recap.label")}: ${ut.recap}`:E("recap.empty"),variant:"info",source:"recap"}})},ut=>{ue.current===st&&(Ct(null),!v4(ut)&&!hd(ut)&&console.warn("[web-shell] unhandled recap failure",ut))})},[Te.sessionId,oe,os,ke,E]),Xk=g.useCallback(z=>{var ut;const Y=z.trim();if(!Y){H("error",E("btw.empty"));return}if(!os())return;const ge=`local-btw-${he.current++}`,st=Te.sessionId;(ut=X.current)==null||ut.abort();const Rt=new AbortController;X.current=Rt,Qt({id:ge,role:"btw",question:Y,answer:"",isPending:!0}),ke.btwSession(Y,{signal:Rt.signal}).then(pt=>{ue.current===st&&X.current===Rt&&(X.current=null,Qt({id:ge,role:"btw",question:Y,answer:pt.answer||E("btw.emptyAnswer"),isPending:!1}))},pt=>{ue.current===st&&X.current===Rt&&(X.current=null,Qt(null),!v4(pt)&&!hd(pt)&&console.warn("[web-shell] unhandled btw failure",pt))})},[Te.sessionId,H,os,ke,E]),Qk=g.useCallback(()=>{var z;(z=X.current)==null||z.abort(),X.current=null,Qt(null)},[]);g.useEffect(()=>{const z=Y=>{var pt;if(Na||dt)return;const ge=Et;if(!ge||ge.role!=="btw")return;const st=Y.key.toLowerCase(),Rt=Y.key==="Escape"&&!Y.ctrlKey&&!Y.metaKey&&!Y.altKey&&!Y.shiftKey,ut=Y.ctrlKey&&!Y.metaKey&&!Y.altKey&&!Y.shiftKey&&(st==="c"||st==="d");if(ge.isPending){if(!Rt&&!ut)return}else{const je=((pt=hr.current)==null?void 0:pt.hasInput())??!1;if(!(!Y.ctrlKey&&!Y.metaKey&&!Y.altKey&&!Y.shiftKey&&(Y.key==="Escape"||!je&&(Y.key==="Enter"||Y.key===" "))))return}Y.preventDefault(),Y.stopPropagation(),Qk()};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[Na,Et,Qk,dt]);const Vo=g.useCallback((z,Y)=>_7e(Ki.current!=="idle",z,Y,{append:ge=>re.appendLocalUserMessage(ge)}),[re]),Wo=g.useCallback(()=>(H("error",E("queue.commandBlocked")),!1),[H,E]),q0=g.useCallback(z=>{Ib(z),n==null||n(z)},[n]),td=g.useCallback(z=>{P(z),s==null||s(z)},[s]),Jk=g.useCallback(()=>{Qn(!0)},[]),Zk=GH({autoLoad:!0}),{settings:ef,setValue:nd,reload:e6}=Zk,rd=ef.find(z=>z.key===nu),sd=ef.find(z=>z.key===kTe),id=ef.find(z=>z.key===cm),wP=(()=>{var Y;const z=(Y=ef.find(ge=>ge.key==="voiceModel"))==null?void 0:Y.values.effective;return typeof z=="string"&&z.trim()?z.trim():void 0})(),vP=Fhe(ef),[Db,t6]=g.useState(!1),Ob=g.useRef(Db);Ob.current=Db,g.useEffect(()=>{if(t){Ib(t);return}const z=J_(rd==null?void 0:rd.values.effective);z&&Ib(z)},[t,rd==null?void 0:rd.values.effective]),g.useEffect(()=>{if(r!==void 0){P(dc(r));return}const z=Y_(id==null?void 0:id.values.effective);z&&P(z)},[r,id==null?void 0:id.values.effective]);const xP=g.useCallback(z=>{const Y=q,ge=`/language ui ${z}`;td(z);const st=()=>Promise.all([ke.refreshCommands(),e6()]);if(Ki.current!=="idle"){td(Y),Wo();return}Qi(ge).then(st).catch(Rt=>{td(Y),Nt(Rt,"Failed to sync /language command")})},[Wo,td,e6,Nt,Qi,q,ke]),n6=g.useCallback(()=>{if(Ki.current!=="idle"){re.dispatch([{type:"status",text:E("clear.blocked")}]);return}re.reset()},[re,E]),r6=g.useCallback(()=>{const z=Ob.current,Y=!Ob.current;t6(Y),nd("workspace",_Te,Y).catch(ge=>{t6(z),Nt(ge,E("compact.saveFailed"))})},[Nt,nd,E]),$c=g.useCallback(z=>{if(!E3(z)){Nt(new Error(`Unsupported approval mode: ${z}`),E("local.approvalMode"));return}if(!is.current.sessionId){Jh(z);return}ke.setApprovalMode(z).then(Y=>{const ge=Y.mode||z;Nb(ge);const st=xn.current;if(!st)return;if(z==="yolo"||z==="auto-edit"&&qTe(st)){const ut=st.options.find(pt=>pt.kind==="allow_once");if(ut){const pt=st.title||"";re.dispatch([{type:"status",text:E("mode.autoApproved",{tool:pt})}]),ke.submitPermission(st.id,ut.id).catch(je=>{Nt(je,"Failed to auto-approve tool call")})}}}).catch(Y=>{Nt(Y,E("local.approvalMode"))})},[ke,Nt,re,E,Jh]);g.useEffect(()=>{Ki.current=Xn},[Xn]),g.useEffect(()=>{let z=null;for(let ge=ye.length-1;ge>=0;ge--){const st=ye[ge];if((st==null?void 0:st.kind)==="user")break;if((st==null?void 0:st.kind)==="error"&&st.source==="turn_error"){z=st.id;break}if((st==null?void 0:st.kind)!=="debug")break}const Y=Tn&&z!==null&&z!==Dt.current&&Ie.current.length>0;Kt.current=Y?z:null,Pn(Y)},[ye,Tn]),g.useEffect(()=>{l==null||l(Xn)},[Xn,l]),g.useEffect(()=>{a==null||a(Te.status)},[Te.status,a]),g.useEffect(()=>{B==null||B(ye)},[ye,B]),g.useEffect(()=>{if(Te.error){const z=new Error(Te.error);c==null||c(z)}},[Te.error,c]),g.useEffect(()=>{Gk(Te.currentModel??"")},[Te.currentModel,Te.sessionId]),g.useEffect(()=>{Nb(Te.currentMode??"default")},[Te.currentMode,Te.sessionId]),g.useEffect(()=>{Te.sessionId&&Vr(null),me.current!==Te.sessionId&&(me.current=Te.sessionId,e==null||e(Te.sessionId))},[Te.sessionId,e]),g.useEffect(()=>{const z=ATe(ye);Vr(Y=>z?(Y==null?void 0:Y.condition)===z.condition&&Y.setAt===z.setAt?Y:z:Y&&null)},[ye]),g.useEffect(()=>{const z=Y=>{const ge=Y.detail;if(!(ge!=null&&ge.active)){Vr(null);return}ge.condition&&Vr({condition:ge.condition,setAt:ge.setAt??Date.now()})};return window.addEventListener(Ex,z),()=>window.removeEventListener(Ex,z)},[]);const U0=g.useRef(null),H0=g.useRef(0);g.useEffect(()=>{H0.current=0},[Te.sessionId]),g.useEffect(()=>{function ge(){if(document.hidden){U0.current===null&&(U0.current=Date.now());return}const st=U0.current;if(U0.current=null,st===null||Date.now()-st<18e4||Ki.current!=="idle"||!Te.sessionId)return;const Rt=re.getSnapshot().blocks.length;Rt-H0.current<4||(H0.current=Rt,ke.recapSession().then(ut=>{ut.recap&&re.dispatch([{type:"status",text:`※ ${E("recap.label")}: ${ut.recap}`,source:"recap"}])},ut=>{console.error("[auto-recap] failed:",ut)}))}return document.addEventListener("visibilitychange",ge),()=>document.removeEventListener("visibilitychange",ge)},[Te.sessionId,ke,re,E]);const Bb=g.useCallback(()=>{const z=E3(Ho)?rg.indexOf(Ho):-1,Y=rg[(z+1)%rg.length];$c(Y)},[Ho,$c]),tf=g.useCallback((z,Y)=>{os()&&(Vo(z)||ke.getContextUsage({detail:Y}).then(ge=>{re.dispatch([{type:"status",text:cae(ge)}]),xt("smooth")}).catch(ge=>{Nt(ge,"Failed to load context usage")}))},[Vo,re,os,ke,Nt,xt]),_P=g.useCallback(()=>{tf("/context detail",!0)},[tf]),V0=g.useCallback(z=>{os()&&ke.branchSession(z||void 0).then(Y=>{re.dispatch([{type:"status",text:E("branch.success",{name:Y.displayName})}])}).catch(Y=>{Nt(Y,E("branch.failed"))})},[Nt,os,ke,re,E]),kP=g.useCallback(()=>{V0()},[V0]),W0=g.useCallback(async()=>{ae();try{return await ke.clearSession(),!0}catch(z){return Nt(z,"Failed to start a new chat"),!1}},[ae,Nt,ke]),SP=g.useCallback(async z=>{we(z),ae();try{await ke.loadSession(z,{deferTranscriptReset:!0})}catch(Y){throw we(ge=>ge===z?null:ge),Y}},[ae,ke]);g.useEffect(()=>{xe!==null&&Te.sessionId===xe&&!Te.catchingUp&&we(null)},[Te.catchingUp,Te.sessionId,xe]);const Pb=g.useCallback(()=>{os()&&ke.getTasks().then(z=>{$0({snapshot:z})}).catch(z=>{Nt(z,"Failed to load tasks")})},[Nt,os,ke]),s6=g.useCallback((z,Y)=>{Vr({condition:z,setAt:Y}),re.dispatch([{type:"status",text:nT({kind:"set",condition:z,setAt:Y})}])},[re]),i6=g.useCallback(z=>{z&&(re.dispatch([{type:"status",text:nT({kind:"cleared",condition:z.condition,durationMs:Date.now()-z.setAt})}]),Vr(null))},[re]),G0=g.useCallback(z=>os()?(re.appendLocalUserMessage(z),ke.clearGoal().catch(Y=>{Nt(Y,"Failed to clear /goal")}),!0):!1,[Nt,os,ke,re]),TP=g.useCallback(()=>ke.getRewindSnapshots(),[ke]),CP=g.useCallback(z=>ke.rewindSession(z,{rewindFiles:!1}).then(()=>{}),[ke]),AP=g.useCallback(z=>{if(hd(z))return;const Y=z instanceof Error?z.message:String(z);H("error",E("rewind.failed",{reason:Y}))},[H,E]),o6=g.useCallback((z,Y,ge)=>{const st=z.replace(/^\/goal\b/i,"").trim(),Rt=st.toLowerCase(),ut=(ge==null?void 0:ge.sendToDaemon)??!0,pt=()=>{const je=!is.current.sessionId;return Qi(z,Y,{clearComposerOnPromptStart:je}).catch(Ne=>{Nt(Ne,"Failed to send /goal command")}),!je};return st&&GB.has(Rt)?ut?G0(z):(re.appendLocalUserMessage(z),i6(Cs.current),!0):st?ut?pt():(re.appendLocalUserMessage(z),s6(st,Date.now()),!0):ut?pt():(re.appendLocalUserMessage(z),!0)},[i6,s6,G0,Nt,Qi,re,is]),nf=g.useMemo(()=>new Set((d??[]).map(w4).filter(Boolean)),[d]),EP=nf.has("settings"),a6=g.useCallback((z,Y)=>{var Rt;if(vTe({connectionStatus:is.current.status}))return H("warning",E("editor.connectionDisconnected")),!1;const ge=Ki.current!=="idle",st=(ut,pt,je,Ne)=>{const hn=!is.current.sessionId;return Qi(ut,pt,{...Ne,clearComposerOnPromptStart:hn}).catch(Ut=>Nt(Ut,je)),!hn};if(z.startsWith("/")){const ut=z.match(/^\/([\w-]+)/);if(ut){const pt=ut[1];if(nf.has(w4(pt)))return ge?Pc(z,Y):st(z,Y,"Failed to send hidden slash command");if(pt==="help")return Qn(!0),!0;if(pt==="tasks")return Pb(),!0;if(pt==="goal")return ge?TTe(z)?G0(z):Wo():o6(z,Y);if(pt==="theme"){const je=z.slice(ut[0].length).trim().toLowerCase();return je==="dark"||je==="light"?q0(je):je?H("error",E("error.unsupportedTheme")):_n(!0),!0}if(pt==="language"){const je=z.slice(ut[0].length).trim(),[Ne,hn]=je.split(/\s+/);if(!je)return re.dispatch([{type:"status",text:[E("language.current",{language:X_(q)}),E("language.usage"),E("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((Ne==null?void 0:Ne.toLowerCase())==="ui"){if(!hn)return re.dispatch([{type:"status",text:[E("language.set"),"",E("language.usage"),"",E("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const Ut=hn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(Ut))return H("error",E("language.invalid")),!0;const Ir=dc(hn);if(td(Ir),!ge){const Ti=!is.current.sessionId;return Qi(`/language ui ${Ir}`,void 0,{clearComposerOnPromptStart:Ti}).then(()=>ke.refreshCommands()).catch(Ra=>{Nt(Ra,"Failed to sync /language command")}),!Ti}return!0}}if(pt==="copy"){const je=z.slice(ut[0].length).trim();return p7e(De.current,je).then(Ne=>{re.dispatch([{type:Ne.status==="error"?"error":"status",text:GTe(Ne.message,E)}])}).catch(Ne=>{Nt(Ne,E("copy.failedFallback"))}),!0}if(pt==="delete")return Tt(!0),!0;if(pt==="release")return qt(!0),!0;if(pt==="rewind")return os()?($n(!0),!0):!1;if(pt==="branch"){if(ge)return Wo();const je=z.slice(ut[0].length).trim();return V0(je||void 0),!0}if(pt==="fork"){if(ge)return Wo();if(!os())return!1;const je=z.slice(ut[0].length).trim();return je?(ke.forkSession(je).then(Ne=>{if(!Ne.launched){H("warning",E("fork.notStarted"));return}sn(hn=>hn+1),H("success",E("fork.started",{name:Ne.description}))}).catch(Ne=>{const hn=Ne instanceof Error?Ne.message:String(Ne);Nt(Ne,E("fork.failed",{reason:hn}))}),!0):(H("error",E("fork.empty")),!0)}if(pt==="auth")return Cb(!0),!0;if(pt==="model"){const je=z.slice(ut[0].length).trim();if(je==="--fast")return ko("fast"),!0;if(je.startsWith("--fast "))return ge?Pc(z,Y):st(z,Y,"Failed to send /model --fast");if(je==="--voice")return Vo(z,Y)||Mt.loadProviders().then(Ne=>{Xu(S0e(Ne)),ko("voice")}).catch(Ne=>Nt(Ne,E("model.setVoice"))),!0;if(je.startsWith("--voice ")){const Ne=je.replace(/^--voice\s+/,"");return nd("workspace","voiceModel",Ne).catch(hn=>Nt(hn,E("model.setVoice"))),!0}if(je){if(!is.current.sessionId)return ed(je),!0;ke.setModel(je).then(()=>{ed(je)}).catch(Ne=>{Nt(Ne,E("model.switch"))})}else ko("main");return!0}if(pt==="plan"){if(ge)return Wo();const je=z.slice(ut[0].length).trim();return is.current.sessionId?(je&&F0(!0),ke.setApprovalMode("plan").then(()=>{if(Jh("plan"),je)return Qi(je,Y,{clearComposerOnPromptStart:!0}).catch(Ne=>Nt(Ne,"Failed to send plan prompt"))}).catch(Ne=>{Nt(Ne,E("mode.plan"))}).finally(()=>{je&&F0(!1)}),!je):(Jh("plan"),je?st(je,Y,"Failed to send plan prompt"):!0)}if(pt==="approval-mode"){const je=z.slice(ut[0].length).trim();return je?$c(je):qo(!0),!0}if(pt==="mcp"){const je=z.slice(ut[0].length).trim().toLowerCase();return Mt.loadMcpStatus().then(async Ne=>{const hn={},Ut={};await Promise.all(((Ne==null?void 0:Ne.servers)??[]).map(async Hn=>{await Promise.all([(async()=>{try{hn[Hn.name]=await Mt.loadMcpTools(Hn.name)}catch{}})(),(async()=>{if(Hn.resourceCount)try{Ut[Hn.name]=await Mt.loadMcpResources(Hn.name)}catch{}})()])})),Tb({status:Ne,toolsByServer:hn,resourcesByServer:Ut,showDescriptions:je==="desc",showSchema:je==="schema",showTips:!je})}).catch(Ne=>{Nt(Ne,"Failed to load MCP status")}),!0}if(pt==="skills")return z.slice(ut[0].length).trim()?ge?Pc(z,Y):st(z,Y,"Failed to send /skills command"):(Vo(z,Y)||Mt.loadSkillsStatus().then(Ne=>{const hn=((Ne==null?void 0:Ne.skills)??[]).map(Ut=>({name:Ut.name,description:Ut.description??""})).sort((Ut,Hn)=>Ut.name.localeCompare(Hn.name));if(Yi(hn),hn.length===0)re.dispatch([{type:"status",text:E("skills.none")}]);else{const Ut=hn.map(Hn=>`- ${Hn.name}`).join(`
`);re.dispatch([{type:"status",text:`${E("skills.available")}

${Ut}`}])}xt("smooth")}).catch(Ne=>{Nt(Ne,"Failed to load skills")}),!0);if(pt==="tools"){const je=z.slice(ut[0].length).trim().toLowerCase();if(je==="desc"||je==="descriptions")Uo(!0);else{if(Vo(z,Y))return!0;Mt.loadToolsStatus().then(Ne=>{const hn=(Ne==null?void 0:Ne.tools)??[];if(hn.length===0)re.dispatch([{type:"status",text:E("tools.none")}]);else{const Ut=hn.map(Hn=>`- ${Hn.displayName||Hn.name}`).join(`
`);re.dispatch([{type:"status",text:`${E("tools.available")}

${Ut}`}])}xt("smooth")}).catch(Ne=>{Nt(Ne,"Failed to load tools")})}return!0}if(pt==="settings")return Xh(!0),!0;if(pt==="context"){const je=z.slice(ut[0].length).trim().toLowerCase();if(je===""||je==="detail"||je==="-d")return tf(z,je==="detail"||je==="-d"),!0}if(pt==="memory"){const je=z.slice(ut[0].length).trim().toLowerCase();if(je==="refresh")nP(Ne=>Ne+1);else if(je==="add"||je.startsWith("add ")){const Ne=je.slice(3).trim();oP(Ne==="user"||Ne==="global"?"global":"workspace"),sP(hn=>hn+1)}return qk(!0),!0}if(pt==="agents"){const je=z.slice(ut[0].length).trim().toLowerCase();let Ne="menu";return je==="create"?Ne="create":je==="create user"||je==="create global"?Ne="create-user":je==="create project"||je==="create workspace"?Ne="create-project":je==="manage"&&(Ne="manage"),Ab(Ne),!0}if(pt==="extensions"){const je=z.slice(ut[0].length).trim(),Ne=(Rt=je.split(/\s+/)[0])==null?void 0:Rt.toLowerCase();if(!Ne||Ne==="manage")return Qu(!0),!0;if(Ne==="install"){if(ge)return Wo();const hn=je.slice(7).trim().split(/\s+/);let Ut="",Hn,Ir,Ti,Ra,Go=null;for(let Ji=0;Ji<hn.length;Ji++){const qs=hn[Ji];if(qs)if(qs==="--auto-update")Ti=!0;else if(qs==="--pre-release"||qs==="--allow-pre-release")Ra=!0;else if(qs==="--ref"||qs==="--registry"){const zc=hn[Ji+1];if(!zc||zc.startsWith("--")){Go=E("extensions.install.missingOptionValue",{option:qs});break}qs==="--ref"?Hn=zc:Ir=zc,Ji+=1}else if(qs.startsWith("--")){Go=E("extensions.install.unknownOption",{option:qs});break}else if(!Ut)Ut=qs;else{Go=E("extensions.install.usage");break}}if(Go)return re.appendLocalUserMessage(z),re.dispatch([{type:"error",text:Go}]),!0;if(!Ut)return re.appendLocalUserMessage(z),re.dispatch([{type:"error",text:E("extensions.install.usage")}]),!0;const Ko=is.current.clientId;return Ko?(re.appendLocalUserMessage(z),re.dispatch([{type:"status",text:E("extensions.install.started",{source:Ut})}]),Mt.installExtension({source:Ut,...Hn?{ref:Hn}:{},...Ir?{registry:Ir}:{},...Ti!==void 0?{autoUpdate:Ti}:{},...Ra!==void 0?{allowPreRelease:Ra}:{},consent:!0},Ko).then(()=>{}).catch(Ji=>{Nt(Ji,E("extensions.install.requestFailed"))}),!0):(H("warning",E("extensions.install.waitForSession")),!0)}return Vo(z,Y)||re.dispatch([{type:"error",text:E("extensions.install.usage")}]),!0}if(pt==="clear"||pt==="new"||pt==="reset")return W0(),!0;if(pt==="rename"){const je=UTe(z.slice(ut[0].length));if(je.type==="auto"||je.type==="delegate")return ge?Pc(z,Y):st(z,Y,"Failed to send /rename command");const Ne=je.displayName;return Ne?os()?(ke.renameSession(Ne).then(()=>{re.dispatch([{type:"status",text:E("rename.success",{name:Ne})}])}).catch(hn=>{Nt(hn,"Failed to rename session")}),!0):!1:(H("error",E("rename.empty")),!0)}if(pt==="resume"){const je=z.slice(ut[0].length).trim();return je?(ae(),ke.loadSession(je).catch(Ne=>{Nt(Ne,"Failed to load session")})):(ae(),Ve(!0)),!0}if(pt==="recap")return Yk(),!0;if(pt==="btw")return Xk(z.slice(ut[0].length)),!0;if(pt==="stats"){const je=z.slice(ut[0].length).trim().toLowerCase();let Ne="overview";return je==="model"?Ne="model":je==="tools"&&(Ne="tools"),os()?(Vo(z,Y)||ke.getStats().then(hn=>{re.dispatch([{type:"status",text:Kae(hn,Ne)}]),xt("smooth")}).catch(()=>{}),!0):!1}if(pt==="status"||pt==="about")return Vo(z,Y)||Promise.all([Mt.loadPreflight().catch(()=>null),Mt.loadProviders().catch(()=>null),Mt.loadEnv().catch(()=>null)]).then(([je,Ne,hn])=>{var zc,m6,p6,g6,y6,b6;const Ut=EA(je,hn);let Hn=Ut.authSource;!Hn&&((zc=Ne==null?void 0:Ne.current)!=null&&zc.authType)&&(Hn=Ne.current.authType);const Ir=[];Ut.nodeVersion&&Ir.push(`Node.js v${Ut.nodeVersion}`),Ut.npmVersion&&Ir.push(`npm ${Ut.npmVersion}`);let Ti="";Hn&&(Hn.startsWith("oauth")||Hn==="qwen-oauth"?Ti="Qwen OAuth":Ti=`API Key - ${Hn}`);const Ra=`${Ut.platform} ${Ut.arch}`.trim(),Go=z0.current,Ko=is.current,qs={cliVersion:((m6=Ko.capabilities)==null?void 0:m6.qwenCodeVersion)||"",runtime:Ir.join(" / "),platform:Ra,auth:Ti,baseUrl:((p6=Ne==null?void 0:Ne.current)==null?void 0:p6.baseUrl)||"",model:Go||Ko.currentModel||((g6=Ne==null?void 0:Ne.current)==null?void 0:g6.modelId)||"",fastModel:((y6=Ne==null?void 0:Ne.current)==null?void 0:y6.fastModelId)||Go||Ko.currentModel||((b6=Ne==null?void 0:Ne.current)==null?void 0:b6.modelId)||"",sessionId:Ko.sessionId||"",sandbox:Ut.sandbox,proxy:Ut.proxy,memoryUsage:Ut.memoryUsage};re.dispatch([{type:"status",text:dle(qs)}]),xt("smooth")}),!0;if(pt==="bug"){const je=z.slice(ut[0].length).trim();return Vo(z,Y)||Promise.all([Mt.loadPreflight().catch(()=>null),Mt.loadEnv().catch(()=>null)]).then(([Ne,hn])=>{var Ti;const Ut=EA(Ne,hn),Hn=((Ti=is.current.capabilities)==null?void 0:Ti.qwenCodeVersion)||"",Ir={};if(Hn&&(Ir.cliVersion=Hn),Ut.nodeVersion&&(Ir.nodeVersion=Ut.nodeVersion),Ut.npmVersion&&(Ir.npmVersion=Ut.npmVersion),Ut.platform&&(Ir.platform=Ut.platform),Ut.arch&&(Ir.arch=Ut.arch),Ut.sandbox&&(Ir.sandbox=Ut.sandbox),Ut.memoryUsage&&(Ir.memoryUsage=Ut.memoryUsage),jb.current)jb.current({title:je,systemInfo:Ir}),re.dispatch([{type:"status",text:E("bug.submitted")}]);else{const Ra=Object.entries(Ir).filter(([,Ji])=>Ji).map(([Ji,qs])=>`${Ji}: ${qs}`).join(`
`),Go=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(je)}&info=${encodeURIComponent(`
`+Ra+`
`)}`,Ko=window.open(Go,"_blank");Ko?(Ko.opener=null,re.dispatch([{type:"status",text:E("bug.submitted")}])):H("error",E("bug.popupBlocked"))}}).catch(Ne=>{Nt(Ne,E("bug.failed"))}),!0}}return ge?Pc(z,Y):st(z,Y,"Failed to send command")}else if(z.startsWith("!")){if(ge)return H("error",E("queue.shellBlocked")),!1;const ut=z.slice(1).trim();return!ut||!os()?!1:(ke.sendShellCommand(ut).catch(pt=>{Nt(pt,"Failed to execute shell command")}),!0)}else return ge?Pc(z,Y):st(z,Y,"Failed to send message")},[Qi,ke,re,Pc,Vo,V0,ae,W0,G0,o6,q0,$c,td,Wo,Pb,nf,H,Nt,Yk,Xk,os,xt,q,ed,Jh,nd,tf,E,Mt]),MP=g.useCallback((z,Y)=>{const ge=a6(z,Y);return ge!==!1&&xt("smooth"),ge},[a6,xt]),l6=g.useCallback((z,Y,ge)=>{ke.submitPermission(z,Y,ge).catch(st=>{Nt(st,"Failed to submit permission choice")})},[ke,Nt]),$b=g.useCallback(()=>{ke.cancel().catch(z=>{Nt(z,"Failed to cancel request")})},[ke,Nt]),IP=g.useCallback(()=>{var z;return Na?!1:((z=qr.current)==null?void 0:z.focusTaskPill())??!1},[Na]),NP=g.useCallback(z=>{var Y,ge;if(z){(Y=hr.current)==null||Y.insertText(z);return}(ge=hr.current)==null||ge.focus()},[]),RP=g.useCallback(z=>{$s(z)},[]),zb=g.useCallback(()=>{or.current&&Tn&&Ki.current==="idle"&&Kt.current&&Ie.current?(Dt.current=Kt.current,Pn(!1),Qi(Ie.current,Qe.current,{optimisticUserMessage:!1,retry:!0}).catch(z=>Nt(z,"Failed to retry prompt"))):re.dispatch([{type:"status",text:E("retry.none")}])},[Tn,Qi,Nt,re,E]);g.useEffect(()=>{const z=Y=>{if(!Na&&Y.ctrlKey&&!Y.metaKey&&!Y.altKey&&!Y.shiftKey){if(Y.key==="l"){Y.preventDefault(),n6();return}if(Y.key==="o"){Y.preventDefault(),r6();return}if(Y.key==="y"){Y.preventDefault(),zb();return}}};return window.addEventListener("keydown",z,!0),()=>window.removeEventListener("keydown",z,!0)},[Na,n6,r6,zb,re,E]);const kl=g.useCallback(()=>{P0.current=null,Vk(!1),Wk(!1),Ju.current&&(clearTimeout(Ju.current),Ju.current=null)},[]),c6=g.useRef({streamingState:Xn,pendingApproval:dt,interactionBlocked:Na,handleCancel:$b,handleCycleMode:Bb});c6.current={streamingState:Xn,pendingApproval:dt,interactionBlocked:Na,handleCancel:$b,handleCycleMode:Bb};const LP=Xn!=="idle";g.useEffect(()=>{kl()},[LP,kl]),g.useEffect(()=>{const ge=(Rt,ut)=>{P0.current=Rt,Rt==="cancel"?Wk(!0):Vk(!0),Ju.current&&clearTimeout(Ju.current),Ju.current=setTimeout(kl,ut)},st=Rt=>{var je,Ne;if(Rt.defaultPrevented||Rt.isComposing)return;const ut=c6.current;if(Rt.key!=="Escape"){P0.current!==null&&kl(),Rt.key==="Tab"&&Rt.shiftKey&&!ut.interactionBlocked&&(Rt.preventDefault(),ut.handleCycleMode());return}const pt=x7e({blocked:!!ut.pendingApproval||ut.interactionBlocked,streaming:ut.streamingState!=="idle",hasInput:!!((je=hr.current)!=null&&je.hasInput()),armed:P0.current});if(pt.kind!=="ignore")switch(Rt.preventDefault(),pt.kind){case"cancel":ut.handleCancel(),kl();break;case"clear":(Ne=hr.current)==null||Ne.clear(),kl();break;case"arm":ge(pt.action,pt.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",st),()=>{window.removeEventListener("keydown",st),kl()}},[kl]);const jP=bTe({catchingUp:!!Te.catchingUp,pendingApproval:dt!==null,isPreparingPrompt:Lb}),Fb=g.useCallback(z=>{if(!is.current.sessionId){ed(z);return}ke.setModel(z).then(Y=>{const ge=zTe(Y);ed((ge==null?void 0:ge.modelId)??z),ge&&re.dispatch({type:"debug",text:FTe(ge),source:"model_switch_summary",data:ge})}).catch(Y=>{Nt(Y,E("model.switch"))})},[ke,re,Nt,E,ed]),DP=g.useCallback(z=>{if(Xn!=="idle"){Wo();return}Qi(`/model --fast ${z}`).catch(Y=>{Nt(Y,"Failed to switch fast model")})},[Wo,Qi,Xn,Nt]),OP=g.useCallback(z=>{nd("workspace","voiceModel",z).catch(Y=>Nt(Y,E("model.setVoice")))},[Nt,nd,E]),u6=g.useMemo(()=>{const z=new Set(Te.skills??[]);return CSe(Te.commands??[],TSe(E)).filter(Y=>!nf.has(w4(Y.name))).map(Y=>z.has(Y.name)?{...Y,displayCategory:"skill",description:Y.description||E("skills.run")}:Y)},[Te.commands,Te.skills,nf,E]),rf=g.useMemo(()=>{var z;return{version:((z=Te.capabilities)==null?void 0:z.qwenCodeVersion)||"",cwd:Te.workspaceCwd||"",currentModel:Zu,currentMode:Ho,hideTips:(sd==null?void 0:sd.values.effective)===!0}},[(f6=Te.capabilities)==null?void 0:f6.qwenCodeVersion,Te.workspaceCwd,Zu,Ho,sd==null?void 0:sd.values.effective]),BP=g.useMemo(()=>p?p(rf):h.jsx(mxe,{...rf}),[p,rf]),d6=g.useMemo(()=>y==null?void 0:y(rf),[y,rf]),Sl=!Te.sessionId&&We.length===0&&!fe&&!dt&&!Et,qb=Sl?Pg():ee,PP=QB(k),$P=[Yt.app,Yt.appChat,Sl?Yt.appChatEmpty:void 0,ne.enabled?Yt.appWithSidebar:void 0,Mb===Ns.Light?Yt.themeLight:Yt.themeDark,i].filter(Boolean).join(" "),zP=g.useMemo(()=>({...o,...jTe(qb,k)}),[k,qb,o]),h6=g.useCallback(z=>{N(z),LTe(z)},[]);return g.useLayoutEffect(()=>{const z=rn.current;if(!z)return;const Y=Hr.current,ge=br.current,st=z.getBoundingClientRect();if(ge&&!Sl&&Y){const Rt=Y.top-st.top;Math.abs(Rt)>1&&(z.style.transition="width 320ms ease",z.style.transform=`translateY(${Rt}px)`,requestAnimationFrame(()=>{z.style.transition="width 320ms ease, transform 280ms ease",z.style.transform=""}),window.setTimeout(()=>{z.style.transition=""},320))}Hr.current=st,br.current=Sl},[Sl]),h.jsx(BV,{value:Mb,children:h.jsx(TV,{language:q,children:h.jsxs("div",{className:$P,style:zP,"data-web-shell-root":!0,children:[!F&&h.jsx(Gve,{toasts:bt,onDismiss:ie}),te&&h.jsx(gs,{title:E("resume.title"),size:"lg",onClose:()=>Ve(!1),children:h.jsx(Gxe,{onSelect:z=>{ae(),ke.loadSession(z).catch(Y=>{Nt(Y,"Failed to load session")})},onClose:()=>Ve(!1)})}),ms&&h.jsx(gs,{title:E(ms==="fast"?"model.setFast":ms==="voice"?"model.setVoice":"model.select"),size:"lg",onClose:()=>ko(null),children:h.jsx(m3e,{mode:ms,models:ms==="voice"?si:void 0,currentModelId:ms==="voice"?wP:void 0,onSelect:z=>{ms==="fast"?DP(z):ms==="voice"?OP(z):Fb(z),ko(null)}})}),So&&h.jsx(gs,{title:E("mode.select"),size:"sm",onClose:()=>qo(!1),children:h.jsx(Wxe,{currentMode:Ho,onSelect:z=>{$c(z),qo(!1)}})}),To&&h.jsx(gs,{title:E("tools.title"),size:"lg",onClose:()=>Uo(!1),children:h.jsx(_5e,{})}),Xi&&h.jsx(gs,{title:E("extensions.manage.title"),size:"lg",onClose:()=>Qu(!1),children:h.jsx(C5e,{})}),Yh&&h.jsx(gs,{title:E("mcp.manageServers"),size:"lg",onClose:()=>Tb(null),children:h.jsx(gTe,{message:Yh,onClose:()=>Tb(null)})}),Eb&&h.jsx(gs,{title:E("tasks.title"),size:"lg",onClose:()=>$0(null),children:h.jsx(Uj,{message:Eb,embedded:!0,manageActiveEvent:!1,onClose:()=>$0(null)})}),Qh&&h.jsx(gs,{title:E(Qh==="manage"?"agent.manage":Qh==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>Ab(null),children:h.jsx(A_e,{mode:Qh,embedded:!0,onMessage:z=>re.dispatch([{type:"status",text:z}]),onClose:()=>Ab(null)})}),zk&&h.jsx(gs,{title:E("settings.title"),size:"lg",onClose:()=>Xh(!1),children:h.jsx(hke,{settingsState:Zk,embedded:!0,onLanguageChange:xP,onThemeChange:q0,chatWidthMode:ee,onChatWidthModeChange:h6,onSubDialog:z=>{Xh(!1),z==="fastModel"?ko("fast"):z==="tools.approvalMode"&&qo(!0)}})}),Fk&&h.jsx(gs,{title:E("memory.menu"),size:"lg",onClose:()=>qk(!1),children:h.jsx(G_e,{refreshSignal:tP,addSignal:rP,addScope:iP,onMessage:(z,Y="status")=>{re.dispatch([{type:Y,text:z}])}})}),Wr&&h.jsx(gs,{title:E("help.title"),size:"md",onClose:()=>Qn(!1),children:h.jsx(W6e,{commands:u6})}),Cn&&h.jsx(gs,{title:E("theme.title"),size:"sm",onClose:()=>_n(!1),children:h.jsx(G6e,{currentTheme:Mb,onSelect:q0,onClose:()=>_n(!1)})}),Uk&&h.jsx(gs,{title:E("auth.title"),size:"lg",onClose:()=>Cb(!1),children:h.jsx(v5e,{onMessage:(z,Y="status")=>{re.dispatch([Y==="error"?{type:"error",text:z}:{type:"status",text:z}])},onClose:()=>Cb(!1)})}),Xe&&h.jsx(gs,{title:E("delete.title"),size:"lg",onClose:()=>Tt(!1),children:h.jsx(K6e,{onDeleted:z=>{re.dispatch([{type:"status",text:z.length===1?`${E("delete.deleted")} (${z[0].slice(0,8)})`:E("delete.deletedCount",{count:z.length})}])},onError:z=>{if(hd(z))return;const Y=z instanceof Error?z.message:String(z);H("error",E("delete.failed",{reason:Y}))},onClose:()=>Tt(!1)})}),_t&&h.jsx(gs,{title:E("release.title"),size:"lg",onClose:()=>qt(!1),children:h.jsx(Y6e,{onReleased:z=>{re.dispatch([{type:"status",text:`${E("release.released")} (${z.slice(0,8)})`}])},onError:z=>{if(hd(z))return;const Y=z instanceof Error?z.message:String(z);H("error",E("release.failed",{reason:Y}))},onClose:()=>qt(!1)})}),Ot&&h.jsx(gs,{title:E("rewind.title"),subtitle:E("rewind.subtitle"),size:"lg",onClose:()=>$n(!1),children:h.jsx(h8e,{blocks:ye,loadSnapshots:TP,rewind:CP,onError:AP,onClose:()=>$n(!1)})}),h.jsxs("div",{className:Yt.appShell,children:[ne.enabled&&h.jsxs("div",{"data-mobile-drawer":"",...de?{role:"dialog","aria-modal":"true"}:{},"aria-label":E("sidebar.label"),className:[Yt.mobileDrawer,de?Yt.mobileDrawerOpen:void 0].filter(Boolean).join(" "),children:[h.jsx("div",{className:Yt.mobileBackdrop,onClick:ae,"aria-hidden":"true"}),h.jsx(SSe,{collapsed:pe&&!de,onCollapsedChange:_e,onOpenSettings:()=>{ae(),Xh(!0)},onNewSession:W0,onLoadSession:SP,onError:Nt,mobileOpen:de})]}),h.jsxs("div",{className:Yt.chatPane,children:[ne.enabled&&h.jsx("button",{type:"button",className:Yt.hamburgerButton,onClick:()=>se(z=>!z),"aria-label":E("sidebar.toggleMenu"),"aria-expanded":de,children:h.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[h.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),h.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),h.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),h.jsxs(vV,{value:qe,children:[h.jsx(Gh.Provider,{value:Db,children:h.jsx(xTe,{timeline:en,details:ri,children:h.jsxs("div",{className:[Yt.content,fe||We.length>0||dt?Yt.contentHasMessages:void 0].filter(Boolean).join(" "),children:[h.jsx(_0e,{ref:Ps,messages:We,pendingApproval:ln,onShowContextDetail:_P,catchingUp:Te.catchingUp,isResponding:Xn!=="idle",activeTurnStartedAt:ce,workspaceCwd:Te.workspaceCwd||"",shellOutputMaxLines:vP,hideSessionTimeline:qb==="wide",showRetryHint:pn,onRetryClick:zb,onBranchSession:kP,welcomeHeader:Sl?BP:void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:RP,virtualScrollThreshold:C}),(Et==null?void 0:Et.role)==="btw"&&h.jsx("div",{className:Yt.btwPanel,children:h.jsx(tD,{question:Et.question,answer:Et.answer,isPending:Et.isPending})})]})})}),h.jsxs("div",{ref:rn,className:Yt.footer,children:[Ur&&h.jsx("div",{className:fe?`${Yt.scrollToBottomLayer} ${Yt.scrollToBottomLayerWithTodos}`:Yt.scrollToBottomLayer,children:h.jsx("button",{type:"button",className:Yt.scrollToBottomButton,"aria-label":E("chat.scrollToBottom"),onClick:()=>xt("smooth"),children:h.jsx("svg",{className:Yt.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"})})})}),fe&&h.jsx("div",{className:Yt.bottomPanels,children:h.jsx(cxe,{todos:Si})}),ln&&h.jsx("div",{className:Yt.approvalOverlay,children:h.jsx($ke,{request:ln,onConfirm:l6,variant:"floating"})}),Rn&&h.jsx("div",{className:Yt.approvalOverlay,children:h.jsx(m6e,{request:Rn,onConfirm:l6,variant:"floating"})}),h.jsxs("div",{className:Yt.composer,children:[h.jsx(Bve,{startedAt:ce}),aP&&Xn==="idle"&&h.jsx("div",{className:Yt.escClearStatus,role:"status",children:E("editor.escClearHint")}),h.jsx(l9e,{prompts:hP,t:E,onDelete:mP,onInsert:pP,onEdit:gP}),h.jsx(eve,{ref:Ea,onSubmit:MP,onCycleMode:Bb,onToggleShortcuts:Jk,onCancel:$b,isRunning:Xn!=="idle",isPreparing:Lb,cancelArmed:lP,disabled:jP,commands:u6,skills:zs,slashCommandCategoryOrder:f,queuedMessages:fP,onFocusFooter:IP,onPopQueuedMessages:yP,onClearQueuedMessages:bP,currentMode:Ho,currentModel:Zu,chatWidthMode:ee,showChatWidthToggle:!Sl,chatWidthToggleMin:PP,visibleToolbarActions:A,availableModels:uP,onSelectMode:$c,onSelectModel:Fb,onChatWidthModeChange:h6,sessionName:cP,dialogOpen:Na,followupState:Kh,onAcceptFollowup:zo,onDismissFollowup:Ma,composerInput:K,composerInputVersion:J,placeholderText:E(wTe({catchingUp:!!Te.catchingUp,isPreparingPrompt:Lb,isStreaming:Xn!=="idle"}))})]}),He?h.jsx(He,{connected:Tn,mode:Ho,model:Zu,streamingState:Xn,contextUsageRatio:(Te.contextWindow??0)>0?(Te.tokenCount??0)/(Te.contextWindow??0):0,activeGoal:ss,tasks:yr,availableModes:rg,availableModels:(Te.models??[]).filter(DA).map(z=>({id:z.id,label:ay(z.label||z.id),contextWindow:z.contextWindow})),skills:zs,onSelectMode:$c,onSelectModel:Fb}):h.jsx(Cve,{onSelectMode:()=>qo(z=>!z),onSelectModel:()=>ko(z=>z?null:"main"),onShowContext:()=>tf("/context",!1),onOpenSettings:()=>Xh(!0),ref:qr,onOpenTasks:()=>Pb(),onReturnToInput:NP,tasks:nn,activeGoal:ss,hideSettings:EP,onToggleShortcuts:Jk,compact:!0}),Sl&&d6&&h.jsx("div",{className:Yt.emptyWelcomeFooter,children:d6})]})]})]})]})]})})})}const $A={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:"重试"}},YTe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},XTe={margin:0,fontSize:"1rem",fontWeight:600},QTe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},JTe={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 ZTe({error:e,onRetry:t,language:n="en"}){const r=$A[n]??$A.en;return h.jsxs("div",{role:"alert",style:YTe,"data-web-shell-error":!0,children:[h.jsx("p",{style:XTe,children:r.title}),h.jsx("p",{style:QTe,children:r.body}),!1,h.jsx("button",{type:"button",style:JTe,onClick:t,children:r.retry})]})}function eCe(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?oCe(e):""}let Wf;const tCe="qwen-daemon-auth",nCe=2500;function rCe(){return Wf||(typeof window>"u"?void 0:(Wf=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,Wf))}function sCe(e=nCe){return typeof window>"u"||window.parent===window?Promise.resolve(void 0):new Promise(t=>{let n=!1;const r=o=>{n||(n=!0,window.removeEventListener("message",s),clearTimeout(i),Wf=o,t(o))},s=o=>{if(o.source!==window.parent||!o.origin.startsWith("chrome-extension://")&&!o.origin.startsWith("moz-extension://"))return;const a=o.data;if((a==null?void 0:a.type)!==tCe)return;const l=typeof a.token=="string"?a.token:"";r(l.trim()||void 0)},i=setTimeout(()=>r(void 0),e);window.addEventListener("message",s)})}function iCe(){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 oCe(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 aCe=eCe(),JB="qwen-code-web-shell-language",ZB="qwen-code-web-shell-theme";function eP(e){if(e===Ns.Dark||e===Ns.Light)return e}function lCe(){const e=new URLSearchParams(window.location.search).get("theme");return eP(e)}function cCe(){try{return eP(window.localStorage.getItem(ZB))}catch{return}}function uCe(e){try{window.localStorage.setItem(ZB,e)}catch{}}function dCe(){return lCe()??cCe()??Ns.Dark}function hCe(){try{const e=window.localStorage.getItem(JB);return e?dc(e):void 0}catch{return}}function fCe(e){try{window.localStorage.setItem(JB,e)}catch{}}function mCe(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return dc(t||(hCe()??navigator.language))}function pCe(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function gCe(e){const t=new URL(window.location.href);t.pathname=e?`/session/${encodeURIComponent(e)}`:"/",t.searchParams.delete("theme"),t.searchParams.delete("language"),t.searchParams.delete("lang"),t.searchParams.delete("token"),t.searchParams.delete("daemon"),window.history.replaceState(null,"",t)}function yCe({daemonToken:e}){const[t,n]=g.useState(()=>dCe()),[r,s]=g.useState(()=>mCe()),[i]=g.useState(()=>pCe()),o=aCe||window.location.origin;g.useEffect(()=>{const u=document.documentElement;u.classList.remove("theme-dark","theme-light"),u.classList.add(`theme-${t}`);const d=document.querySelector('meta[name="theme-color"]');d&&d.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const a=g.useCallback(u=>{n(u),uCe(u)},[]),l=g.useCallback(u=>{s(u),fCe(u)},[]),c=g.useCallback(u=>{gCe(u)},[]);return h.jsx(CN,{label:"web-shell-root",fallback:(u,d)=>h.jsx(ZTe,{error:u,onRetry:d,language:r}),children:h.jsx(hH,{baseUrl:o,token:e,children:h.jsx(jH,{sessionId:i,suppressOwnUserEcho:!0,children:h.jsx(KTe,{theme:t,onThemeChange:a,language:r,onLanguageChange:l,onSessionIdChange:c,sidebar:!0,compactThinking:!0})},i??"new")})})}async function bCe(){const e=rCe()??await sCe();iCe(),zF.createRoot(document.getElementById("root")).render(h.jsx(a$.StrictMode,{children:h.jsx(yCe,{daemonToken:e})}))}bCe();export{U as _,$g as c,cy as g,kCe as k};
