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 xoe=Object.defineProperty;var woe=(e,t,n)=>t in e?xoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Me=(e,t,n)=>woe(e,typeof t!="symbol"?t+"":t,n);function koe(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(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 l2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dq={exports:{}},S4={};/**
 * @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 _oe=Symbol.for("react.transitional.element"),Soe=Symbol.for("react.fragment");function Lq(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:_oe,type:e,key:r,ref:t!==void 0?t:null,props:n}}S4.Fragment=Soe;S4.jsx=Lq;S4.jsxs=Lq;Dq.exports=S4;var c=Dq.exports,Pq={exports:{}},rr={};/**
 * @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 kE=Symbol.for("react.transitional.element"),Coe=Symbol.for("react.portal"),Toe=Symbol.for("react.fragment"),Aoe=Symbol.for("react.strict_mode"),Eoe=Symbol.for("react.profiler"),Moe=Symbol.for("react.consumer"),Noe=Symbol.for("react.context"),joe=Symbol.for("react.forward_ref"),Ioe=Symbol.for("react.suspense"),Roe=Symbol.for("react.memo"),Oq=Symbol.for("react.lazy"),Doe=Symbol.for("react.activity"),KI=Symbol.iterator;function Loe(e){return e===null||typeof e!="object"?null:(e=KI&&e[KI]||e["@@iterator"],typeof e=="function"?e:null)}var Bq={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$q=Object.assign,zq={};function Rg(e,t,n){this.props=e,this.context=t,this.refs=zq,this.updater=n||Bq}Rg.prototype.isReactComponent={};Rg.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")};Rg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Fq(){}Fq.prototype=Rg.prototype;function _E(e,t,n){this.props=e,this.context=t,this.refs=zq,this.updater=n||Bq}var SE=_E.prototype=new Fq;SE.constructor=_E;$q(SE,Rg.prototype);SE.isPureReactComponent=!0;var YI=Array.isArray;function RT(){}var Rs={H:null,A:null,T:null,S:null},qq=Object.prototype.hasOwnProperty;function CE(e,t,n){var r=n.ref;return{$$typeof:kE,type:e,key:t,ref:r!==void 0?r:null,props:n}}function Poe(e,t){return CE(e.type,t,e.props)}function TE(e){return typeof e=="object"&&e!==null&&e.$$typeof===kE}function Ooe(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var XI=/\/+/g;function gC(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ooe(""+e.key):t.toString(36)}function Boe(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(RT,RT):(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 e0(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 kE:case Coe:o=!0;break;case Oq:return o=e._init,e0(o(e._payload),t,n,r,s)}}if(o)return s=s(e),o=r===""?"."+gC(e,0):r,YI(s)?(n="",o!=null&&(n=o.replace(XI,"$&/")+"/"),e0(s,t,n,"",function(u){return u})):s!=null&&(TE(s)&&(s=Poe(s,n+(s.key==null||e&&e.key===s.key?"":(""+s.key).replace(XI,"$&/")+"/")+o)),t.push(s)),1;o=0;var a=r===""?".":r+":";if(YI(e))for(var l=0;l<e.length;l++)r=e[l],i=a+gC(r,l),o+=e0(r,t,n,i,s);else if(l=Loe(e),typeof l=="function")for(e=l.call(e),l=0;!(r=e.next()).done;)r=r.value,i=a+gC(r,l++),o+=e0(r,t,n,i,s);else if(i==="object"){if(typeof e.then=="function")return e0(Boe(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 jx(e,t,n){if(e==null)return e;var r=[],s=0;return e0(e,r,"","",function(i){return t.call(n,i,s++)}),r}function $oe(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 QI=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)},zoe={map:jx,forEach:function(e,t,n){jx(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return jx(e,function(){t++}),t},toArray:function(e){return jx(e,function(t){return t})||[]},only:function(e){if(!TE(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};rr.Activity=Doe;rr.Children=zoe;rr.Component=Rg;rr.Fragment=Toe;rr.Profiler=Eoe;rr.PureComponent=_E;rr.StrictMode=Aoe;rr.Suspense=Ioe;rr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Rs;rr.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Rs.H.useMemoCache(e)}};rr.cache=function(e){return function(){return e.apply(null,arguments)}};rr.cacheSignal=function(){return null};rr.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var r=$q({},e.props),s=e.key;if(t!=null)for(i in t.key!==void 0&&(s=""+t.key),t)!qq.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 CE(e.type,s,r)};rr.createContext=function(e){return e={$$typeof:Noe,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Moe,_context:e},e};rr.createElement=function(e,t,n){var r,s={},i=null;if(t!=null)for(r in t.key!==void 0&&(i=""+t.key),t)qq.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 CE(e,i,s)};rr.createRef=function(){return{current:null}};rr.forwardRef=function(e){return{$$typeof:joe,render:e}};rr.isValidElement=TE;rr.lazy=function(e){return{$$typeof:Oq,_payload:{_status:-1,_result:e},_init:$oe}};rr.memo=function(e,t){return{$$typeof:Roe,type:e,compare:t===void 0?null:t}};rr.startTransition=function(e){var t=Rs.T,n={};Rs.T=n;try{var r=e(),s=Rs.S;s!==null&&s(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(RT,QI)}catch(i){QI(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),Rs.T=t}};rr.unstable_useCacheRefresh=function(){return Rs.H.useCacheRefresh()};rr.use=function(e){return Rs.H.use(e)};rr.useActionState=function(e,t,n){return Rs.H.useActionState(e,t,n)};rr.useCallback=function(e,t){return Rs.H.useCallback(e,t)};rr.useContext=function(e){return Rs.H.useContext(e)};rr.useDebugValue=function(){};rr.useDeferredValue=function(e,t){return Rs.H.useDeferredValue(e,t)};rr.useEffect=function(e,t){return Rs.H.useEffect(e,t)};rr.useEffectEvent=function(e){return Rs.H.useEffectEvent(e)};rr.useId=function(){return Rs.H.useId()};rr.useImperativeHandle=function(e,t,n){return Rs.H.useImperativeHandle(e,t,n)};rr.useInsertionEffect=function(e,t){return Rs.H.useInsertionEffect(e,t)};rr.useLayoutEffect=function(e,t){return Rs.H.useLayoutEffect(e,t)};rr.useMemo=function(e,t){return Rs.H.useMemo(e,t)};rr.useOptimistic=function(e,t){return Rs.H.useOptimistic(e,t)};rr.useReducer=function(e,t,n){return Rs.H.useReducer(e,t,n)};rr.useRef=function(e){return Rs.H.useRef(e)};rr.useState=function(e){return Rs.H.useState(e)};rr.useSyncExternalStore=function(e,t,n){return Rs.H.useSyncExternalStore(e,t,n)};rr.useTransition=function(){return Rs.H.useTransition()};rr.version="19.2.4";Pq.exports=rr;var f=Pq.exports;const Hq=_4(f),C4=koe({__proto__:null,default:Hq},[f]);var Uq={exports:{}},T4={},Vq={exports:{}},Wq={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(e){function t(P,K){var F=P.length;P.push(K);e:for(;0<F;){var H=F-1>>>1,D=P[H];if(0<s(D,K))P[H]=K,P[F]=D,F=H;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var K=P[0],F=P.pop();if(F!==K){P[0]=F;e:for(var H=0,D=P.length,Q=D>>>1;H<Q;){var U=2*(H+1)-1,j=P[U],ie=U+1,oe=P[ie];if(0>s(j,F))ie<D&&0>s(oe,j)?(P[H]=oe,P[ie]=F,H=ie):(P[H]=j,P[U]=F,H=U);else if(ie<D&&0>s(oe,F))P[H]=oe,P[ie]=F,H=ie;else break e}}return K}function s(P,K){var F=P.sortIndex-K.sortIndex;return F!==0?F:P.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=[],u=[],d=1,h=null,m=3,p=!1,g=!1,b=!1,x=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function k(P){for(var K=n(u);K!==null;){if(K.callback===null)r(u);else if(K.startTime<=P)r(u),K.sortIndex=K.expirationTime,t(l,K);else break;K=n(u)}}function T(P){if(b=!1,k(P),!g)if(n(l)!==null)g=!0,S||(S=!0,N());else{var K=n(u);K!==null&&$(T,K.startTime-P)}}var S=!1,C=-1,_=5,A=-1;function M(){return x?!0:!(e.unstable_now()-A<_)}function L(){if(x=!1,S){var P=e.unstable_now();A=P;var K=!0;try{e:{g=!1,b&&(b=!1,y(C),C=-1),p=!0;var F=m;try{t:{for(k(P),h=n(l);h!==null&&!(h.expirationTime>P&&M());){var H=h.callback;if(typeof H=="function"){h.callback=null,m=h.priorityLevel;var D=H(h.expirationTime<=P);if(P=e.unstable_now(),typeof D=="function"){h.callback=D,k(P),K=!0;break t}h===n(l)&&r(l),k(P)}else r(l);h=n(l)}if(h!==null)K=!0;else{var Q=n(u);Q!==null&&$(T,Q.startTime-P),K=!1}}break e}finally{h=null,m=F,p=!1}K=void 0}}finally{K?N():S=!1}}}var N;if(typeof w=="function")N=function(){w(L)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,B=O.port2;O.port1.onmessage=L,N=function(){B.postMessage(null)}}else N=function(){v(L,0)};function $(P,K){C=v(function(){P(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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(P){switch(m){case 1:case 2:case 3:var K=3;break;default:K=m}var F=m;m=K;try{return P()}finally{m=F}},e.unstable_requestPaint=function(){x=!0},e.unstable_runWithPriority=function(P,K){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var F=m;m=P;try{return K()}finally{m=F}},e.unstable_scheduleCallback=function(P,K,F){var H=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?H+F:H):F=H,P){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=F+D,P={id:d++,callback:K,priorityLevel:P,startTime:F,expirationTime:D,sortIndex:-1},F>H?(P.sortIndex=F,t(u,P),n(l)===null&&P===n(u)&&(b?(y(C),C=-1):b=!0,$(T,F-H))):(P.sortIndex=D,t(l,P),g||p||(g=!0,S||(S=!0,N()))),P},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(P){var K=m;return function(){var F=m;m=K;try{return P.apply(this,arguments)}finally{m=F}}}})(Wq);Vq.exports=Wq;var Foe=Vq.exports,Gq={exports:{}},Vo={};/**
 * @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 qoe=f;function Kq(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 Hd(){}var qo={d:{f:Hd,r:function(){throw Error(Kq(522))},D:Hd,C:Hd,L:Hd,m:Hd,X:Hd,S:Hd,M:Hd},p:0,findDOMNode:null},Hoe=Symbol.for("react.portal");function Uoe(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Hoe,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}var Ib=qoe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function A4(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Vo.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=qo;Vo.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(Kq(299));return Uoe(e,t,null,n)};Vo.flushSync=function(e){var t=Ib.T,n=qo.p;try{if(Ib.T=null,qo.p=2,e)return e()}finally{Ib.T=t,qo.p=n,qo.d.f()}};Vo.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,qo.d.C(e,t))};Vo.prefetchDNS=function(e){typeof e=="string"&&qo.d.D(e)};Vo.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,r=A4(n,t.crossOrigin),s=typeof t.integrity=="string"?t.integrity:void 0,i=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?qo.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:r,integrity:s,fetchPriority:i}):n==="script"&&qo.d.X(e,{crossOrigin:r,integrity:s,fetchPriority:i,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Vo.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=A4(t.as,t.crossOrigin);qo.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&&qo.d.M(e)};Vo.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,r=A4(n,t.crossOrigin);qo.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})}};Vo.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=A4(t.as,t.crossOrigin);qo.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 qo.d.m(e)};Vo.requestFormReset=function(e){qo.d.r(e)};Vo.unstable_batchedUpdates=function(e,t){return e(t)};Vo.useFormState=function(e,t,n){return Ib.H.useFormState(e,t,n)};Vo.useFormStatus=function(){return Ib.H.useHostTransitionStatus()};Vo.version="19.2.4";function Yq(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Yq)}catch(e){console.error(e)}}Yq(),Gq.exports=Vo;var rc=Gq.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 Ni=Foe,Xq=f,Voe=rc;function nt(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 Qq(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function yv(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 Jq(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 Zq(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 JI(e){if(yv(e)!==e)throw Error(nt(188))}function Woe(e){var t=e.alternate;if(!t){if(t=yv(e),t===null)throw Error(nt(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 JI(s),e;if(i===r)return JI(s),t;i=i.sibling}throw Error(nt(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(nt(189))}}if(n.alternate!==r)throw Error(nt(190))}if(n.tag!==3)throw Error(nt(188));return n.stateNode.current===n?e:t}function eH(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=eH(e),t!==null)return t;e=e.sibling}return null}var Ds=Object.assign,Goe=Symbol.for("react.element"),Ix=Symbol.for("react.transitional.element"),ub=Symbol.for("react.portal"),c0=Symbol.for("react.fragment"),tH=Symbol.for("react.strict_mode"),DT=Symbol.for("react.profiler"),nH=Symbol.for("react.consumer"),$u=Symbol.for("react.context"),AE=Symbol.for("react.forward_ref"),LT=Symbol.for("react.suspense"),PT=Symbol.for("react.suspense_list"),EE=Symbol.for("react.memo"),sh=Symbol.for("react.lazy"),OT=Symbol.for("react.activity"),Koe=Symbol.for("react.memo_cache_sentinel"),ZI=Symbol.iterator;function R1(e){return e===null||typeof e!="object"?null:(e=ZI&&e[ZI]||e["@@iterator"],typeof e=="function"?e:null)}var Yoe=Symbol.for("react.client.reference");function BT(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Yoe?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c0:return"Fragment";case DT:return"Profiler";case tH:return"StrictMode";case LT:return"Suspense";case PT:return"SuspenseList";case OT:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case ub:return"Portal";case $u:return e.displayName||"Context";case nH:return(e._context.displayName||"Context")+".Consumer";case AE:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case EE:return t=e.displayName||null,t!==null?t:BT(e.type)||"Memo";case sh:t=e._payload,e=e._init;try{return BT(e(t))}catch{}}return null}var db=Array.isArray,qn=Xq.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ts=Voe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Mm={pending:!1,data:null,method:null,action:null},$T=[],u0=-1;function ru(e){return{current:e}}function Vi(e){0>u0||(e.current=$T[u0],$T[u0]=null,u0--)}function Es(e,t){u0++,$T[u0]=e.current,e.current=t}var Yc=ru(null),yy=ru(null),Eh=ru(null),c2=ru(null);function u2(e,t){switch(Es(Eh,t),Es(yy,e),Es(Yc,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?iD(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=iD(t),e=kV(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Vi(Yc),Es(Yc,e)}function tg(){Vi(Yc),Vi(yy),Vi(Eh)}function zT(e){e.memoizedState!==null&&Es(c2,e);var t=Yc.current,n=kV(t,e.type);t!==n&&(Es(yy,e),Es(Yc,n))}function d2(e){yy.current===e&&(Vi(Yc),Vi(yy)),c2.current===e&&(Vi(c2),My._currentValue=Mm)}var bC,eR;function rm(e){if(bC===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);bC=t&&t[1]||"",eR=-1<n.stack.indexOf(`
    at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
`+bC+e+eR}var yC=!1;function vC(e,t){if(!e||yC)return"";yC=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(p){var m=p}Reflect.construct(e,[],h)}else{try{h.call()}catch(p){m=p}e.call(h.prototype)}}else{try{throw Error()}catch(p){m=p}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(p){if(p&&m&&typeof p.stack=="string")return[p.stack,m.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(`
`),u=a.split(`
`);for(s=r=0;r<l.length&&!l[r].includes("DetermineComponentFrameRoot");)r++;for(;s<u.length&&!u[s].includes("DetermineComponentFrameRoot");)s++;if(r===l.length||s===u.length)for(r=l.length-1,s=u.length-1;1<=r&&0<=s&&l[r]!==u[s];)s--;for(;1<=r&&0<=s;r--,s--)if(l[r]!==u[s]){if(r!==1||s!==1)do if(r--,s--,0>s||l[r]!==u[s]){var d=`
`+l[r].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),d}while(1<=r&&0<=s);break}}}finally{yC=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?rm(n):""}function Xoe(e,t){switch(e.tag){case 26:case 27:case 5:return rm(e.type);case 16:return rm("Lazy");case 13:return e.child!==t&&t!==null?rm("Suspense Fallback"):rm("Suspense");case 19:return rm("SuspenseList");case 0:case 15:return vC(e.type,!1);case 11:return vC(e.type.render,!1);case 1:return vC(e.type,!0);case 31:return rm("Activity");default:return""}}function tR(e){try{var t="",n=null;do t+=Xoe(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
Error generating stack: `+r.message+`
`+r.stack}}var FT=Object.prototype.hasOwnProperty,ME=Ni.unstable_scheduleCallback,xC=Ni.unstable_cancelCallback,Qoe=Ni.unstable_shouldYield,Joe=Ni.unstable_requestPaint,Ya=Ni.unstable_now,Zoe=Ni.unstable_getCurrentPriorityLevel,rH=Ni.unstable_ImmediatePriority,sH=Ni.unstable_UserBlockingPriority,h2=Ni.unstable_NormalPriority,eae=Ni.unstable_LowPriority,iH=Ni.unstable_IdlePriority,tae=Ni.log,nae=Ni.unstable_setDisableYieldValue,vv=null,Xa=null;function gh(e){if(typeof tae=="function"&&nae(e),Xa&&typeof Xa.setStrictMode=="function")try{Xa.setStrictMode(vv,e)}catch{}}var Qa=Math.clz32?Math.clz32:iae,rae=Math.log,sae=Math.LN2;function iae(e){return e>>>=0,e===0?32:31-(rae(e)/sae|0)|0}var Rx=256,Dx=262144,Lx=4194304;function sm(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 E4(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=sm(r):(o&=a,o!==0?s=sm(o):n||(n=a&~e,n!==0&&(s=sm(n))))):(a=r&~i,a!==0?s=sm(a):o!==0?s=sm(o):n||(n=r&~e,n!==0&&(s=sm(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 xv(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function oae(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 oH(){var e=Lx;return Lx<<=1,!(Lx&62914560)&&(Lx=4194304),e}function wC(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function wv(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function aae(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,u=e.hiddenUpdates;for(n=o&~n;0<n;){var d=31-Qa(n),h=1<<d;a[d]=0,l[d]=-1;var m=u[d];if(m!==null)for(u[d]=null,d=0;d<m.length;d++){var p=m[d];p!==null&&(p.lane&=-536870913)}n&=~h}r!==0&&aH(e,r,0),i!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=i&~(o&~t))}function aH(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Qa(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function lH(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Qa(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}function cH(e,t){var n=t&-t;return n=n&42?1:NE(n),n&(e.suspendedLanes|t)?0:n}function NE(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 jE(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function uH(){var e=ts.p;return e!==0?e:(e=window.event,e===void 0?32:RV(e.type))}function nR(e,t){var n=ts.p;try{return ts.p=e,t()}finally{ts.p=n}}var mf=Math.random().toString(36).slice(2),no="__reactFiber$"+mf,xa="__reactProps$"+mf,Dg="__reactContainer$"+mf,qT="__reactEvents$"+mf,lae="__reactListeners$"+mf,cae="__reactHandles$"+mf,rR="__reactResources$"+mf,kv="__reactMarker$"+mf;function IE(e){delete e[no],delete e[xa],delete e[qT],delete e[lae],delete e[cae]}function d0(e){var t=e[no];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Dg]||n[no]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=uD(e);e!==null;){if(n=e[no])return n;e=uD(e)}return t}e=n,n=e.parentNode}return null}function Lg(e){if(e=e[no]||e[Dg]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function hb(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(nt(33))}function I0(e){var t=e[rR];return t||(t=e[rR]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function qi(e){e[kv]=!0}var dH=new Set,hH={};function op(e,t){ng(e,t),ng(e+"Capture",t)}function ng(e,t){for(hH[e]=t,e=0;e<t.length;e++)dH.add(t[e])}var uae=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]*$"),sR={},iR={};function dae(e){return FT.call(iR,e)?!0:FT.call(sR,e)?!1:uae.test(e)?iR[e]=!0:(sR[e]=!0,!1)}function fk(e,t,n){if(dae(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 Px(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 wu(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 wl(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fH(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hae(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 HT(e){if(!e._valueTracker){var t=fH(e)?"checked":"value";e._valueTracker=hae(e,t,""+e[t])}}function mH(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fH(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function f2(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 fae=/[\n"\\]/g;function Al(e){return e.replace(fae,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function UT(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=""+wl(t)):e.value!==""+wl(t)&&(e.value=""+wl(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?VT(e,o,wl(t)):n!=null?VT(e,o,wl(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=""+wl(a):e.removeAttribute("name")}function pH(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)){HT(e);return}n=n!=null?""+wl(n):"",t=t!=null?""+wl(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),HT(e)}function VT(e,t,n){t==="number"&&f2(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function R0(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=""+wl(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 gH(e,t,n){if(t!=null&&(t=""+wl(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+wl(n):""}function bH(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(nt(92));if(db(r)){if(1<r.length)throw Error(nt(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=wl(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),HT(e)}function rg(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mae=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 oR(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||mae.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function yH(e,t,n){if(t!=null&&typeof t!="object")throw Error(nt(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&&oR(e,s,r)}else for(var i in t)t.hasOwnProperty(i)&&oR(e,i,t[i])}function RE(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 pae=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"]]),gae=/^[\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 mk(e){return gae.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function zu(){}var WT=null;function DE(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var h0=null,D0=null;function aR(e){var t=Lg(e);if(t&&(e=t.stateNode)){var n=e[xa]||null;e:switch(e=t.stateNode,t.type){case"input":if(UT(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="'+Al(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=r[xa]||null;if(!s)throw Error(nt(90));UT(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&&mH(r)}break e;case"textarea":gH(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&R0(e,!!n.multiple,t,!1)}}}var kC=!1;function vH(e,t,n){if(kC)return e(t,n);kC=!0;try{var r=e(t);return r}finally{if(kC=!1,(h0!==null||D0!==null)&&(z4(),h0&&(t=h0,e=D0,D0=h0=null,aR(t),e)))for(t=0;t<e.length;t++)aR(e[t])}}function vy(e,t){var n=e.stateNode;if(n===null)return null;var r=n[xa]||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(nt(231,t,typeof n));return n}var nd=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),GT=!1;if(nd)try{var D1={};Object.defineProperty(D1,"passive",{get:function(){GT=!0}}),window.addEventListener("test",D1,D1),window.removeEventListener("test",D1,D1)}catch{GT=!1}var bh=null,LE=null,pk=null;function xH(){if(pk)return pk;var e,t=LE,n=t.length,r,s="value"in bh?bh.value:bh.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 pk=s.slice(e,1<r?1-r:void 0)}function gk(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 Ox(){return!0}function lR(){return!1}function _a(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)?Ox:lR,this.isPropagationStopped=lR,this}return Ds(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=Ox)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ox)},persist:function(){},isPersistent:Ox}),t}var ap={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},M4=_a(ap),_v=Ds({},ap,{view:0,detail:0}),bae=_a(_v),_C,SC,L1,N4=Ds({},_v,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:PE,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!==L1&&(L1&&e.type==="mousemove"?(_C=e.screenX-L1.screenX,SC=e.screenY-L1.screenY):SC=_C=0,L1=e),_C)},movementY:function(e){return"movementY"in e?e.movementY:SC}}),cR=_a(N4),yae=Ds({},N4,{dataTransfer:0}),vae=_a(yae),xae=Ds({},_v,{relatedTarget:0}),CC=_a(xae),wae=Ds({},ap,{animationName:0,elapsedTime:0,pseudoElement:0}),kae=_a(wae),_ae=Ds({},ap,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Sae=_a(_ae),Cae=Ds({},ap,{data:0}),uR=_a(Cae),Tae={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Aae={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"},Eae={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Mae(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Eae[e])?!!t[e]:!1}function PE(){return Mae}var Nae=Ds({},_v,{key:function(e){if(e.key){var t=Tae[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gk(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Aae[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:PE,charCode:function(e){return e.type==="keypress"?gk(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gk(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),jae=_a(Nae),Iae=Ds({},N4,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dR=_a(Iae),Rae=Ds({},_v,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:PE}),Dae=_a(Rae),Lae=Ds({},ap,{propertyName:0,elapsedTime:0,pseudoElement:0}),Pae=_a(Lae),Oae=Ds({},N4,{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}),Bae=_a(Oae),$ae=Ds({},ap,{newState:0,oldState:0}),zae=_a($ae),Fae=[9,13,27,32],OE=nd&&"CompositionEvent"in window,Rb=null;nd&&"documentMode"in document&&(Rb=document.documentMode);var qae=nd&&"TextEvent"in window&&!Rb,wH=nd&&(!OE||Rb&&8<Rb&&11>=Rb),hR=" ",fR=!1;function kH(e,t){switch(e){case"keyup":return Fae.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _H(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var f0=!1;function Hae(e,t){switch(e){case"compositionend":return _H(t);case"keypress":return t.which!==32?null:(fR=!0,hR);case"textInput":return e=t.data,e===hR&&fR?null:e;default:return null}}function Uae(e,t){if(f0)return e==="compositionend"||!OE&&kH(e,t)?(e=xH(),pk=LE=bh=null,f0=!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 wH&&t.locale!=="ko"?null:t.data;default:return null}}var Vae={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 mR(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Vae[e.type]:t==="textarea"}function SH(e,t,n,r){h0?D0?D0.push(r):D0=[r]:h0=r,t=j2(t,"onChange"),0<t.length&&(n=new M4("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Db=null,xy=null;function Wae(e){vV(e,0)}function j4(e){var t=hb(e);if(mH(t))return e}function pR(e,t){if(e==="change")return t}var CH=!1;if(nd){var TC;if(nd){var AC="oninput"in document;if(!AC){var gR=document.createElement("div");gR.setAttribute("oninput","return;"),AC=typeof gR.oninput=="function"}TC=AC}else TC=!1;CH=TC&&(!document.documentMode||9<document.documentMode)}function bR(){Db&&(Db.detachEvent("onpropertychange",TH),xy=Db=null)}function TH(e){if(e.propertyName==="value"&&j4(xy)){var t=[];SH(t,xy,e,DE(e)),vH(Wae,t)}}function Gae(e,t,n){e==="focusin"?(bR(),Db=t,xy=n,Db.attachEvent("onpropertychange",TH)):e==="focusout"&&bR()}function Kae(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return j4(xy)}function Yae(e,t){if(e==="click")return j4(t)}function Xae(e,t){if(e==="input"||e==="change")return j4(t)}function Qae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tl=typeof Object.is=="function"?Object.is:Qae;function wy(e,t){if(tl(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(!FT.call(t,s)||!tl(e[s],t[s]))return!1}return!0}function yR(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vR(e,t){var n=yR(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=yR(n)}}function AH(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?AH(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function EH(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=f2(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=f2(e.document)}return t}function BE(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 Jae=nd&&"documentMode"in document&&11>=document.documentMode,m0=null,KT=null,Lb=null,YT=!1;function xR(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;YT||m0==null||m0!==f2(r)||(r=m0,"selectionStart"in r&&BE(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}),Lb&&wy(Lb,r)||(Lb=r,r=j2(KT,"onSelect"),0<r.length&&(t=new M4("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=m0)))}function Wf(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var p0={animationend:Wf("Animation","AnimationEnd"),animationiteration:Wf("Animation","AnimationIteration"),animationstart:Wf("Animation","AnimationStart"),transitionrun:Wf("Transition","TransitionRun"),transitionstart:Wf("Transition","TransitionStart"),transitioncancel:Wf("Transition","TransitionCancel"),transitionend:Wf("Transition","TransitionEnd")},EC={},MH={};nd&&(MH=document.createElement("div").style,"AnimationEvent"in window||(delete p0.animationend.animation,delete p0.animationiteration.animation,delete p0.animationstart.animation),"TransitionEvent"in window||delete p0.transitionend.transition);function lp(e){if(EC[e])return EC[e];if(!p0[e])return e;var t=p0[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in MH)return EC[e]=t[n];return e}var NH=lp("animationend"),jH=lp("animationiteration"),IH=lp("animationstart"),Zae=lp("transitionrun"),ele=lp("transitionstart"),tle=lp("transitioncancel"),RH=lp("transitionend"),DH=new Map,XT="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(" ");XT.push("scrollEnd");function sc(e,t){DH.set(e,t),op(t,[e])}var m2=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)},yl=[],g0=0,$E=0;function I4(){for(var e=g0,t=$E=g0=0;t<e;){var n=yl[t];yl[t++]=null;var r=yl[t];yl[t++]=null;var s=yl[t];yl[t++]=null;var i=yl[t];if(yl[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&&LH(n,s,i)}}function R4(e,t,n,r){yl[g0++]=e,yl[g0++]=t,yl[g0++]=n,yl[g0++]=r,$E|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function zE(e,t,n,r){return R4(e,t,n,r),p2(e)}function cp(e,t){return R4(e,null,null,t),p2(e)}function LH(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-Qa(n),e=i.hiddenUpdates,r=e[s],r===null?e[s]=[t]:r.push(t),t.lane=n|536870912),i):null}function p2(e){if(50<Ub)throw Ub=0,b8=null,Error(nt(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var b0={};function nle(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 Ua(e,t,n,r){return new nle(e,t,n,r)}function FE(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vu(e,t){var n=e.alternate;return n===null?(n=Ua(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 PH(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 bk(e,t,n,r,s,i){var o=0;if(r=e,typeof e=="function")FE(e)&&(o=1);else if(typeof e=="string")o=ace(e,n,Yc.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case OT:return e=Ua(31,n,t,s),e.elementType=OT,e.lanes=i,e;case c0:return Nm(n.children,s,i,t);case tH:o=8,s|=24;break;case DT:return e=Ua(12,n,t,s|2),e.elementType=DT,e.lanes=i,e;case LT:return e=Ua(13,n,t,s),e.elementType=LT,e.lanes=i,e;case PT:return e=Ua(19,n,t,s),e.elementType=PT,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $u:o=10;break e;case nH:o=9;break e;case AE:o=11;break e;case EE:o=14;break e;case sh:o=16,r=null;break e}o=29,n=Error(nt(130,e===null?"null":typeof e,"")),r=null}return t=Ua(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Nm(e,t,n,r){return e=Ua(7,e,r,t),e.lanes=n,e}function MC(e,t,n){return e=Ua(6,e,null,t),e.lanes=n,e}function OH(e){var t=Ua(18,null,null,0);return t.stateNode=e,t}function NC(e,t,n){return t=Ua(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var wR=new WeakMap;function El(e,t){if(typeof e=="object"&&e!==null){var n=wR.get(e);return n!==void 0?n:(t={value:e,source:t,stack:tR(t)},wR.set(e,t),t)}return{value:e,source:t,stack:tR(t)}}var y0=[],v0=0,g2=null,ky=0,kl=[],_l=0,Uh=null,$c=1,zc="";function Iu(e,t){y0[v0++]=ky,y0[v0++]=g2,g2=e,ky=t}function BH(e,t,n){kl[_l++]=$c,kl[_l++]=zc,kl[_l++]=Uh,Uh=e;var r=$c;e=zc;var s=32-Qa(r)-1;r&=~(1<<s),n+=1;var i=32-Qa(t)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,$c=1<<32-Qa(t)+s|n<<s|r,zc=i+e}else $c=1<<i|n<<s|r,zc=e}function qE(e){e.return!==null&&(Iu(e,1),BH(e,1,0))}function HE(e){for(;e===g2;)g2=y0[--v0],y0[v0]=null,ky=y0[--v0],y0[v0]=null;for(;e===Uh;)Uh=kl[--_l],kl[_l]=null,zc=kl[--_l],kl[_l]=null,$c=kl[--_l],kl[_l]=null}function $H(e,t){kl[_l++]=$c,kl[_l++]=zc,kl[_l++]=Uh,$c=t.id,zc=t.overflow,Uh=e}var ro=null,Is=null,Rr=!1,Mh=null,Ml=!1,QT=Error(nt(519));function Vh(e){var t=Error(nt(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _y(El(t,e)),QT}function kR(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[no]=e,t[xa]=r,n){case"dialog":wr("cancel",t),wr("close",t);break;case"iframe":case"object":case"embed":wr("load",t);break;case"video":case"audio":for(n=0;n<Ay.length;n++)wr(Ay[n],t);break;case"source":wr("error",t);break;case"img":case"image":case"link":wr("error",t),wr("load",t);break;case"details":wr("toggle",t);break;case"input":wr("invalid",t),pH(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":wr("invalid",t);break;case"textarea":wr("invalid",t),bH(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||wV(t.textContent,n)?(r.popover!=null&&(wr("beforetoggle",t),wr("toggle",t)),r.onScroll!=null&&wr("scroll",t),r.onScrollEnd!=null&&wr("scrollend",t),r.onClick!=null&&(t.onclick=zu),t=!0):t=!1,t||Vh(e,!0)}function _R(e){for(ro=e.return;ro;)switch(ro.tag){case 5:case 31:case 13:Ml=!1;return;case 27:case 3:Ml=!0;return;default:ro=ro.return}}function Op(e){if(e!==ro)return!1;if(!Rr)return _R(e),Rr=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||k8(e.type,e.memoizedProps)),n=!n),n&&Is&&Vh(e),_R(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(nt(317));Is=cD(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(nt(317));Is=cD(e)}else t===27?(t=Is,pf(e.type)?(e=T8,T8=null,Is=e):Is=t):Is=ro?Ll(e.stateNode.nextSibling):null;return!0}function $m(){Is=ro=null,Rr=!1}function jC(){var e=Mh;return e!==null&&(aa===null?aa=e:aa.push.apply(aa,e),Mh=null),e}function _y(e){Mh===null?Mh=[e]:Mh.push(e)}var JT=ru(null),up=null,Fu=null;function uh(e,t,n){Es(JT,t._currentValue),t._currentValue=n}function Wu(e){e._currentValue=JT.current,Vi(JT)}function ZT(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 e8(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),ZT(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(nt(341));o.lanes|=n,i=o.alternate,i!==null&&(i.lanes|=n),ZT(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 Pg(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(nt(387));if(o=o.memoizedProps,o!==null){var a=s.type;tl(s.pendingProps.value,o.value)||(e!==null?e.push(a):e=[a])}}else if(s===c2.current){if(o=s.alternate,o===null)throw Error(nt(387));o.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(My):e=[My])}s=s.return}e!==null&&e8(t,e,n,r),t.flags|=262144}function b2(e){for(e=e.firstContext;e!==null;){if(!tl(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function zm(e){up=e,Fu=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function so(e){return zH(up,e)}function Bx(e,t){return up===null&&zm(e),zH(e,t)}function zH(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Fu===null){if(e===null)throw Error(nt(308));Fu=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Fu=Fu.next=t;return n}var rle=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()})}},sle=Ni.unstable_scheduleCallback,ile=Ni.unstable_NormalPriority,pi={$$typeof:$u,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function UE(){return{controller:new rle,data:new Map,refCount:0}}function Sv(e){e.refCount--,e.refCount===0&&sle(ile,function(){e.controller.abort()})}var Pb=null,t8=0,sg=0,L0=null;function ole(e,t){if(Pb===null){var n=Pb=[];t8=0,sg=p9(),L0={status:"pending",value:void 0,then:function(r){n.push(r)}}}return t8++,t.then(SR,SR),t}function SR(){if(--t8===0&&Pb!==null){L0!==null&&(L0.status="fulfilled");var e=Pb;Pb=null,sg=0,L0=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ale(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 CR=qn.S;qn.S=function(e,t){eV=Ya(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&ole(e,t),CR!==null&&CR(e,t)};var jm=ru(null);function VE(){var e=jm.current;return e!==null?e:ws.pooledCache}function yk(e,t){t===null?Es(jm,jm.current):Es(jm,t.pool)}function FH(){var e=VE();return e===null?null:{parent:pi._currentValue,pool:e}}var Og=Error(nt(460)),WE=Error(nt(474)),D4=Error(nt(542)),y2={then:function(){}};function TR(e){return e=e.status,e==="fulfilled"||e==="rejected"}function qH(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(zu,zu),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ER(e),e;default:if(typeof t.status=="string")t.then(zu,zu);else{if(e=ws,e!==null&&100<e.shellSuspendCounter)throw Error(nt(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,ER(e),e}throw Im=t,Og}}function im(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Im=n,Og):n}}var Im=null;function AR(){if(Im===null)throw Error(nt(459));var e=Im;return Im=null,e}function ER(e){if(e===Og||e===D4)throw Error(nt(483))}var P0=null,Sy=0;function $x(e){var t=Sy;return Sy+=1,P0===null&&(P0=[]),qH(P0,e,t)}function P1(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function zx(e,t){throw t.$$typeof===Goe?Error(nt(525)):(e=Object.prototype.toString.call(t),Error(nt(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function HH(e){function t(v,y){if(e){var w=v.deletions;w===null?(v.deletions=[y],v.flags|=16):w.push(y)}}function n(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function r(v){for(var y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(v,y){return v=Vu(v,y),v.index=0,v.sibling=null,v}function i(v,y,w){return v.index=w,e?(w=v.alternate,w!==null?(w=w.index,w<y?(v.flags|=67108866,y):w):(v.flags|=67108866,y)):(v.flags|=1048576,y)}function o(v){return e&&v.alternate===null&&(v.flags|=67108866),v}function a(v,y,w,k){return y===null||y.tag!==6?(y=MC(w,v.mode,k),y.return=v,y):(y=s(y,w),y.return=v,y)}function l(v,y,w,k){var T=w.type;return T===c0?d(v,y,w.props.children,k,w.key):y!==null&&(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===sh&&im(T)===y.type)?(y=s(y,w.props),P1(y,w),y.return=v,y):(y=bk(w.type,w.key,w.props,null,v.mode,k),P1(y,w),y.return=v,y)}function u(v,y,w,k){return y===null||y.tag!==4||y.stateNode.containerInfo!==w.containerInfo||y.stateNode.implementation!==w.implementation?(y=NC(w,v.mode,k),y.return=v,y):(y=s(y,w.children||[]),y.return=v,y)}function d(v,y,w,k,T){return y===null||y.tag!==7?(y=Nm(w,v.mode,k,T),y.return=v,y):(y=s(y,w),y.return=v,y)}function h(v,y,w){if(typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint")return y=MC(""+y,v.mode,w),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case Ix:return w=bk(y.type,y.key,y.props,null,v.mode,w),P1(w,y),w.return=v,w;case ub:return y=NC(y,v.mode,w),y.return=v,y;case sh:return y=im(y),h(v,y,w)}if(db(y)||R1(y))return y=Nm(y,v.mode,w,null),y.return=v,y;if(typeof y.then=="function")return h(v,$x(y),w);if(y.$$typeof===$u)return h(v,Bx(v,y),w);zx(v,y)}return null}function m(v,y,w,k){var T=y!==null?y.key:null;if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return T!==null?null:a(v,y,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Ix:return w.key===T?l(v,y,w,k):null;case ub:return w.key===T?u(v,y,w,k):null;case sh:return w=im(w),m(v,y,w,k)}if(db(w)||R1(w))return T!==null?null:d(v,y,w,k,null);if(typeof w.then=="function")return m(v,y,$x(w),k);if(w.$$typeof===$u)return m(v,y,Bx(v,w),k);zx(v,w)}return null}function p(v,y,w,k,T){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return v=v.get(w)||null,a(y,v,""+k,T);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Ix:return v=v.get(k.key===null?w:k.key)||null,l(y,v,k,T);case ub:return v=v.get(k.key===null?w:k.key)||null,u(y,v,k,T);case sh:return k=im(k),p(v,y,w,k,T)}if(db(k)||R1(k))return v=v.get(w)||null,d(y,v,k,T,null);if(typeof k.then=="function")return p(v,y,w,$x(k),T);if(k.$$typeof===$u)return p(v,y,w,Bx(y,k),T);zx(y,k)}return null}function g(v,y,w,k){for(var T=null,S=null,C=y,_=y=0,A=null;C!==null&&_<w.length;_++){C.index>_?(A=C,C=null):A=C.sibling;var M=m(v,C,w[_],k);if(M===null){C===null&&(C=A);break}e&&C&&M.alternate===null&&t(v,C),y=i(M,y,_),S===null?T=M:S.sibling=M,S=M,C=A}if(_===w.length)return n(v,C),Rr&&Iu(v,_),T;if(C===null){for(;_<w.length;_++)C=h(v,w[_],k),C!==null&&(y=i(C,y,_),S===null?T=C:S.sibling=C,S=C);return Rr&&Iu(v,_),T}for(C=r(C);_<w.length;_++)A=p(C,v,_,w[_],k),A!==null&&(e&&A.alternate!==null&&C.delete(A.key===null?_:A.key),y=i(A,y,_),S===null?T=A:S.sibling=A,S=A);return e&&C.forEach(function(L){return t(v,L)}),Rr&&Iu(v,_),T}function b(v,y,w,k){if(w==null)throw Error(nt(151));for(var T=null,S=null,C=y,_=y=0,A=null,M=w.next();C!==null&&!M.done;_++,M=w.next()){C.index>_?(A=C,C=null):A=C.sibling;var L=m(v,C,M.value,k);if(L===null){C===null&&(C=A);break}e&&C&&L.alternate===null&&t(v,C),y=i(L,y,_),S===null?T=L:S.sibling=L,S=L,C=A}if(M.done)return n(v,C),Rr&&Iu(v,_),T;if(C===null){for(;!M.done;_++,M=w.next())M=h(v,M.value,k),M!==null&&(y=i(M,y,_),S===null?T=M:S.sibling=M,S=M);return Rr&&Iu(v,_),T}for(C=r(C);!M.done;_++,M=w.next())M=p(C,v,_,M.value,k),M!==null&&(e&&M.alternate!==null&&C.delete(M.key===null?_:M.key),y=i(M,y,_),S===null?T=M:S.sibling=M,S=M);return e&&C.forEach(function(N){return t(v,N)}),Rr&&Iu(v,_),T}function x(v,y,w,k){if(typeof w=="object"&&w!==null&&w.type===c0&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Ix:e:{for(var T=w.key;y!==null;){if(y.key===T){if(T=w.type,T===c0){if(y.tag===7){n(v,y.sibling),k=s(y,w.props.children),k.return=v,v=k;break e}}else if(y.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===sh&&im(T)===y.type){n(v,y.sibling),k=s(y,w.props),P1(k,w),k.return=v,v=k;break e}n(v,y);break}else t(v,y);y=y.sibling}w.type===c0?(k=Nm(w.props.children,v.mode,k,w.key),k.return=v,v=k):(k=bk(w.type,w.key,w.props,null,v.mode,k),P1(k,w),k.return=v,v=k)}return o(v);case ub:e:{for(T=w.key;y!==null;){if(y.key===T)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(v,y.sibling),k=s(y,w.children||[]),k.return=v,v=k;break e}else{n(v,y);break}else t(v,y);y=y.sibling}k=NC(w,v.mode,k),k.return=v,v=k}return o(v);case sh:return w=im(w),x(v,y,w,k)}if(db(w))return g(v,y,w,k);if(R1(w)){if(T=R1(w),typeof T!="function")throw Error(nt(150));return w=T.call(w),b(v,y,w,k)}if(typeof w.then=="function")return x(v,y,$x(w),k);if(w.$$typeof===$u)return x(v,y,Bx(v,w),k);zx(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint"?(w=""+w,y!==null&&y.tag===6?(n(v,y.sibling),k=s(y,w),k.return=v,v=k):(n(v,y),k=MC(w,v.mode,k),k.return=v,v=k),o(v)):n(v,y)}return function(v,y,w,k){try{Sy=0;var T=x(v,y,w,k);return P0=null,T}catch(C){if(C===Og||C===D4)throw C;var S=Ua(29,C,null,v.mode);return S.lanes=k,S.return=v,S}finally{}}}var Fm=HH(!0),UH=HH(!1),ih=!1;function GE(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function n8(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 Nh(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function jh(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Zr&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,t=p2(e),LH(e,null,n),t}return R4(e,r,t,n),p2(e)}function Ob(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,lH(e,n)}}function IC(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 r8=!1;function Bb(){if(r8){var e=L0;if(e!==null)throw e}}function $b(e,t,n,r){r8=!1;var s=e.updateQueue;ih=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?i=u:o.next=u,o=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(i!==null){var h=s.baseState;o=0,d=u=l=null,a=i;do{var m=a.lane&-536870913,p=m!==a.lane;if(p?(Cr&m)===m:(r&m)===m){m!==0&&m===sg&&(r8=!0),d!==null&&(d=d.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var g=e,b=a;m=t;var x=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){h=g.call(x,h,m);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,m=typeof g=="function"?g.call(x,h,m):g,m==null)break e;h=Ds({},h,m);break e;case 2:ih=!0}}m=a.callback,m!==null&&(e.flags|=64,p&&(e.flags|=8192),p=s.callbacks,p===null?s.callbacks=[m]:p.push(m))}else p={lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=p,l=h):d=d.next=p,o|=m;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;p=a,a=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);d===null&&(l=h),s.baseState=l,s.firstBaseUpdate=u,s.lastBaseUpdate=d,i===null&&(s.shared.lanes=0),Gh|=o,e.lanes=o,e.memoizedState=h}}function VH(e,t){if(typeof e!="function")throw Error(nt(191,e));e.call(t)}function WH(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)VH(n[e],t)}var ig=ru(null),v2=ru(0);function MR(e,t){e=od,Es(v2,e),Es(ig,t),od=e|t.baseLanes}function s8(){Es(v2,od),Es(ig,ig.current)}function KE(){od=v2.current,Vi(ig),Vi(v2)}var nl=ru(null),Dl=null;function dh(e){var t=e.alternate;Es(li,li.current&1),Es(nl,e),Dl===null&&(t===null||ig.current!==null||t.memoizedState!==null)&&(Dl=e)}function i8(e){Es(li,li.current),Es(nl,e),Dl===null&&(Dl=e)}function GH(e){e.tag===22?(Es(li,li.current),Es(nl,e),Dl===null&&(Dl=e)):hh()}function hh(){Es(li,li.current),Es(nl,nl.current)}function za(e){Vi(nl),Dl===e&&(Dl=null),Vi(li)}var li=ru(0);function x2(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||S8(n)||C8(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 rd=0,ir=null,ms=null,fi=null,w2=!1,O0=!1,qm=!1,k2=0,Cy=0,B0=null,lle=0;function Xs(){throw Error(nt(321))}function YE(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!tl(e[n],t[n]))return!1;return!0}function XE(e,t,n,r,s,i){return rd=i,ir=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,qn.H=e===null||e.memoizedState===null?SU:a9,qm=!1,i=n(r,s),qm=!1,O0&&(i=YH(t,n,r,s)),KH(e),i}function KH(e){qn.H=Ty;var t=ms!==null&&ms.next!==null;if(rd=0,fi=ms=ir=null,w2=!1,Cy=0,B0=null,t)throw Error(nt(300));e===null||gi||(e=e.dependencies,e!==null&&b2(e)&&(gi=!0))}function YH(e,t,n,r){ir=e;var s=0;do{if(O0&&(B0=null),Cy=0,O0=!1,25<=s)throw Error(nt(301));if(s+=1,fi=ms=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}qn.H=CU,i=t(n,r)}while(O0);return i}function cle(){var e=qn.H,t=e.useState()[0];return t=typeof t.then=="function"?Cv(t):t,e=e.useState()[0],(ms!==null?ms.memoizedState:null)!==e&&(ir.flags|=1024),t}function QE(){var e=k2!==0;return k2=0,e}function JE(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ZE(e){if(w2){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}w2=!1}rd=0,fi=ms=ir=null,O0=!1,Cy=k2=0,B0=null}function Do(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fi===null?ir.memoizedState=fi=e:fi=fi.next=e,fi}function ci(){if(ms===null){var e=ir.alternate;e=e!==null?e.memoizedState:null}else e=ms.next;var t=fi===null?ir.memoizedState:fi.next;if(t!==null)fi=t,ms=e;else{if(e===null)throw ir.alternate===null?Error(nt(467)):Error(nt(310));ms=e,e={memoizedState:ms.memoizedState,baseState:ms.baseState,baseQueue:ms.baseQueue,queue:ms.queue,next:null},fi===null?ir.memoizedState=fi=e:fi=fi.next=e}return fi}function L4(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Cv(e){var t=Cy;return Cy+=1,B0===null&&(B0=[]),e=qH(B0,e,t),t=ir,(fi===null?t.memoizedState:fi.next)===null&&(t=t.alternate,qn.H=t===null||t.memoizedState===null?SU:a9),e}function P4(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Cv(e);if(e.$$typeof===$u)return so(e)}throw Error(nt(438,String(e)))}function e9(e){var t=null,n=ir.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ir.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=L4(),ir.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]=Koe;return t.index++,n}function sd(e,t){return typeof t=="function"?t(e):t}function vk(e){var t=ci();return t9(t,ms,e)}function t9(e,t,n){var r=e.queue;if(r===null)throw Error(nt(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,u=t,d=!1;do{var h=u.lane&-536870913;if(h!==u.lane?(Cr&h)===h:(rd&h)===h){var m=u.revertLane;if(m===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),h===sg&&(d=!0);else if((rd&m)===m){u=u.next,m===sg&&(d=!0);continue}else h={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(a=l=h,o=i):l=l.next=h,ir.lanes|=m,Gh|=m;h=u.action,qm&&n(i,h),i=u.hasEagerState?u.eagerState:n(i,h)}else m={lane:h,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(a=l=m,o=i):l=l.next=m,ir.lanes|=h,Gh|=h;u=u.next}while(u!==null&&u!==t);if(l===null?o=i:l.next=a,!tl(i,e.memoizedState)&&(gi=!0,d&&(n=L0,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 RC(e){var t=ci(),n=t.queue;if(n===null)throw Error(nt(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);tl(i,t.memoizedState)||(gi=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function XH(e,t,n){var r=ir,s=ci(),i=Rr;if(i){if(n===void 0)throw Error(nt(407));n=n()}else n=t();var o=!tl((ms||s).memoizedState,n);if(o&&(s.memoizedState=n,gi=!0),s=s.queue,n9(ZH.bind(null,r,s,e),[e]),s.getSnapshot!==t||o||fi!==null&&fi.memoizedState.tag&1){if(r.flags|=2048,og(9,{destroy:void 0},JH.bind(null,r,s,n,t),null),ws===null)throw Error(nt(349));i||rd&127||QH(r,t,n)}return n}function QH(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ir.updateQueue,t===null?(t=L4(),ir.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function JH(e,t,n,r){t.value=n,t.getSnapshot=r,eU(t)&&tU(e)}function ZH(e,t,n){return n(function(){eU(t)&&tU(e)})}function eU(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!tl(e,n)}catch{return!0}}function tU(e){var t=cp(e,2);t!==null&&ba(t,e,2)}function o8(e){var t=Do();if(typeof e=="function"){var n=e;if(e=n(),qm){gh(!0);try{n()}finally{gh(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sd,lastRenderedState:e},t}function nU(e,t,n,r){return e.baseState=n,t9(e,ms,typeof r=="function"?r:sd)}function ule(e,t,n,r,s){if(B4(e))throw Error(nt(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)}};qn.T!==null?n(!0):i.isTransition=!1,r(i),n=t.pending,n===null?(i.next=t.pending=i,rU(t,i)):(i.next=n.next,t.pending=n.next=i)}}function rU(e,t){var n=t.action,r=t.payload,s=e.state;if(t.isTransition){var i=qn.T,o={};qn.T=o;try{var a=n(s,r),l=qn.S;l!==null&&l(o,a),NR(e,t,a)}catch(u){a8(e,t,u)}finally{i!==null&&o.types!==null&&(i.types=o.types),qn.T=i}}else try{i=n(s,r),NR(e,t,i)}catch(u){a8(e,t,u)}}function NR(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){jR(e,t,r)},function(r){return a8(e,t,r)}):jR(e,t,n)}function jR(e,t,n){t.status="fulfilled",t.value=n,sU(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,rU(e,n)))}function a8(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,sU(t),t=t.next;while(t!==r)}e.action=null}function sU(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function iU(e,t){return t}function IR(e,t){if(Rr){var n=ws.formState;if(n!==null){e:{var r=ir;if(Rr){if(Is){t:{for(var s=Is,i=Ml;s.nodeType!==8;){if(!i){s=null;break t}if(s=Ll(s.nextSibling),s===null){s=null;break t}}i=s.data,s=i==="F!"||i==="F"?s:null}if(s){Is=Ll(s.nextSibling),r=s.data==="F!";break e}}Vh(r)}r=!1}r&&(t=n[0])}}return n=Do(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:iU,lastRenderedState:t},n.queue=r,n=wU.bind(null,ir,r),r.dispatch=n,r=o8(!1),i=o9.bind(null,ir,!1,r.queue),r=Do(),s={state:t,dispatch:null,action:e,pending:null},r.queue=s,n=ule.bind(null,ir,s,i,n),s.dispatch=n,r.memoizedState=e,[t,n,!1]}function RR(e){var t=ci();return oU(t,ms,e)}function oU(e,t,n){if(t=t9(e,t,iU)[0],e=vk(sd)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Cv(t)}catch(o){throw o===Og?D4:o}else r=t;t=ci();var s=t.queue,i=s.dispatch;return n!==t.memoizedState&&(ir.flags|=2048,og(9,{destroy:void 0},dle.bind(null,s,n),null)),[r,i,e]}function dle(e,t){e.action=t}function DR(e){var t=ci(),n=ms;if(n!==null)return oU(t,n,e);ci(),t=t.memoizedState,n=ci();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function og(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=ir.updateQueue,t===null&&(t=L4(),ir.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 aU(){return ci().memoizedState}function xk(e,t,n,r){var s=Do();ir.flags|=e,s.memoizedState=og(1|t,{destroy:void 0},n,r===void 0?null:r)}function O4(e,t,n,r){var s=ci();r=r===void 0?null:r;var i=s.memoizedState.inst;ms!==null&&r!==null&&YE(r,ms.memoizedState.deps)?s.memoizedState=og(t,i,n,r):(ir.flags|=e,s.memoizedState=og(1|t,i,n,r))}function LR(e,t){xk(8390656,8,e,t)}function n9(e,t){O4(2048,8,e,t)}function hle(e){ir.flags|=4;var t=ir.updateQueue;if(t===null)t=L4(),ir.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function lU(e){var t=ci().memoizedState;return hle({ref:t,nextImpl:e}),function(){if(Zr&2)throw Error(nt(440));return t.impl.apply(void 0,arguments)}}function cU(e,t){return O4(4,2,e,t)}function uU(e,t){return O4(4,4,e,t)}function dU(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 hU(e,t,n){n=n!=null?n.concat([e]):null,O4(4,4,dU.bind(null,t,e),n)}function r9(){}function fU(e,t){var n=ci();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&YE(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function mU(e,t){var n=ci();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&YE(t,r[1]))return r[0];if(r=e(),qm){gh(!0);try{e()}finally{gh(!1)}}return n.memoizedState=[r,t],r}function s9(e,t,n){return n===void 0||rd&1073741824&&!(Cr&261930)?e.memoizedState=t:(e.memoizedState=n,e=nV(),ir.lanes|=e,Gh|=e,n)}function pU(e,t,n,r){return tl(n,t)?n:ig.current!==null?(e=s9(e,n,r),tl(e,t)||(gi=!0),e):!(rd&42)||rd&1073741824&&!(Cr&261930)?(gi=!0,e.memoizedState=n):(e=nV(),ir.lanes|=e,Gh|=e,t)}function gU(e,t,n,r,s){var i=ts.p;ts.p=i!==0&&8>i?i:8;var o=qn.T,a={};qn.T=a,o9(e,!1,t,n);try{var l=s(),u=qn.S;if(u!==null&&u(a,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var d=ale(l,r);zb(e,t,d,Ja(e))}else zb(e,t,r,Ja(e))}catch(h){zb(e,t,{then:function(){},status:"rejected",reason:h},Ja())}finally{ts.p=i,o!==null&&a.types!==null&&(o.types=a.types),qn.T=o}}function fle(){}function l8(e,t,n,r){if(e.tag!==5)throw Error(nt(476));var s=bU(e).queue;gU(e,s,t,Mm,n===null?fle:function(){return yU(e),n(r)})}function bU(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Mm,baseState:Mm,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sd,lastRenderedState:Mm},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sd,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function yU(e){var t=bU(e);t.next===null&&(t=e.alternate.memoizedState),zb(e,t.next.queue,{},Ja())}function i9(){return so(My)}function vU(){return ci().memoizedState}function xU(){return ci().memoizedState}function mle(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Ja();e=Nh(n);var r=jh(t,e,n);r!==null&&(ba(r,t,n),Ob(r,t,n)),t={cache:UE()},e.payload=t;return}t=t.return}}function ple(e,t,n){var r=Ja();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},B4(e)?kU(t,n):(n=zE(e,t,n,r),n!==null&&(ba(n,e,r),_U(n,t,r)))}function wU(e,t,n){var r=Ja();zb(e,t,n,r)}function zb(e,t,n,r){var s={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(B4(e))kU(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,tl(a,o))return R4(e,t,s,0),ws===null&&I4(),!1}catch{}finally{}if(n=zE(e,t,s,r),n!==null)return ba(n,e,r),_U(n,t,r),!0}return!1}function o9(e,t,n,r){if(r={lane:2,revertLane:p9(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},B4(e)){if(t)throw Error(nt(479))}else t=zE(e,n,r,2),t!==null&&ba(t,e,2)}function B4(e){var t=e.alternate;return e===ir||t!==null&&t===ir}function kU(e,t){O0=w2=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _U(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,lH(e,n)}}var Ty={readContext:so,use:P4,useCallback:Xs,useContext:Xs,useEffect:Xs,useImperativeHandle:Xs,useLayoutEffect:Xs,useInsertionEffect:Xs,useMemo:Xs,useReducer:Xs,useRef:Xs,useState:Xs,useDebugValue:Xs,useDeferredValue:Xs,useTransition:Xs,useSyncExternalStore:Xs,useId:Xs,useHostTransitionStatus:Xs,useFormState:Xs,useActionState:Xs,useOptimistic:Xs,useMemoCache:Xs,useCacheRefresh:Xs};Ty.useEffectEvent=Xs;var SU={readContext:so,use:P4,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:so,useEffect:LR,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,xk(4194308,4,dU.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xk(4194308,4,e,t)},useInsertionEffect:function(e,t){xk(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(qm){gh(!0);try{e()}finally{gh(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var s=n(t);if(qm){gh(!0);try{n(t)}finally{gh(!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=ple.bind(null,ir,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=o8(e);var t=e.queue,n=wU.bind(null,ir,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:r9,useDeferredValue:function(e,t){var n=Do();return s9(n,e,t)},useTransition:function(){var e=o8(!1);return e=gU.bind(null,ir,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=ir,s=Do();if(Rr){if(n===void 0)throw Error(nt(407));n=n()}else{if(n=t(),ws===null)throw Error(nt(349));Cr&127||QH(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,LR(ZH.bind(null,r,i,e),[e]),r.flags|=2048,og(9,{destroy:void 0},JH.bind(null,r,i,n,t),null),n},useId:function(){var e=Do(),t=ws.identifierPrefix;if(Rr){var n=zc,r=$c;n=(r&~(1<<32-Qa(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=k2++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=lle++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:i9,useFormState:IR,useActionState:IR,useOptimistic:function(e){var t=Do();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=o9.bind(null,ir,!0,n),n.dispatch=t,[e,t]},useMemoCache:e9,useCacheRefresh:function(){return Do().memoizedState=mle.bind(null,ir)},useEffectEvent:function(e){var t=Do(),n={impl:e};return t.memoizedState=n,function(){if(Zr&2)throw Error(nt(440));return n.impl.apply(void 0,arguments)}}},a9={readContext:so,use:P4,useCallback:fU,useContext:so,useEffect:n9,useImperativeHandle:hU,useInsertionEffect:cU,useLayoutEffect:uU,useMemo:mU,useReducer:vk,useRef:aU,useState:function(){return vk(sd)},useDebugValue:r9,useDeferredValue:function(e,t){var n=ci();return pU(n,ms.memoizedState,e,t)},useTransition:function(){var e=vk(sd)[0],t=ci().memoizedState;return[typeof e=="boolean"?e:Cv(e),t]},useSyncExternalStore:XH,useId:vU,useHostTransitionStatus:i9,useFormState:RR,useActionState:RR,useOptimistic:function(e,t){var n=ci();return nU(n,ms,e,t)},useMemoCache:e9,useCacheRefresh:xU};a9.useEffectEvent=lU;var CU={readContext:so,use:P4,useCallback:fU,useContext:so,useEffect:n9,useImperativeHandle:hU,useInsertionEffect:cU,useLayoutEffect:uU,useMemo:mU,useReducer:RC,useRef:aU,useState:function(){return RC(sd)},useDebugValue:r9,useDeferredValue:function(e,t){var n=ci();return ms===null?s9(n,e,t):pU(n,ms.memoizedState,e,t)},useTransition:function(){var e=RC(sd)[0],t=ci().memoizedState;return[typeof e=="boolean"?e:Cv(e),t]},useSyncExternalStore:XH,useId:vU,useHostTransitionStatus:i9,useFormState:DR,useActionState:DR,useOptimistic:function(e,t){var n=ci();return ms!==null?nU(n,ms,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:e9,useCacheRefresh:xU};CU.useEffectEvent=lU;function DC(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ds({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var c8={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ja(),s=Nh(r);s.payload=t,n!=null&&(s.callback=n),t=jh(e,s,r),t!==null&&(ba(t,e,r),Ob(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ja(),s=Nh(r);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=jh(e,s,r),t!==null&&(ba(t,e,r),Ob(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ja(),r=Nh(n);r.tag=2,t!=null&&(r.callback=t),t=jh(e,r,n),t!==null&&(ba(t,e,n),Ob(t,e,n))}};function PR(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?!wy(n,r)||!wy(s,i):!0}function OR(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&&c8.enqueueReplaceState(t,t.state,null)}function Hm(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=Ds({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function TU(e){m2(e)}function AU(e){console.error(e)}function EU(e){m2(e)}function _2(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function BR(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 u8(e,t,n){return n=Nh(n),n.tag=3,n.payload={element:null},n.callback=function(){_2(e,t)},n}function MU(e){return e=Nh(e),e.tag=3,e}function NU(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(){BR(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(e.callback=function(){BR(t,n,r),typeof s!="function"&&(Ih===null?Ih=new Set([this]):Ih.add(this));var a=r.stack;this.componentDidCatch(r.value,{componentStack:a!==null?a:""})})}function gle(e,t,n,r,s){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&Pg(t,n,s,!0),n=nl.current,n!==null){switch(n.tag){case 31:case 13:return Dl===null?E2():n.alternate===null&&Zs===0&&(Zs=3),n.flags&=-257,n.flags|=65536,n.lanes=s,r===y2?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),VC(e,r,s)),!1;case 22:return n.flags|=65536,r===y2?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)),VC(e,r,s)),!1}throw Error(nt(435,n.tag))}return VC(e,r,s),E2(),!1}if(Rr)return t=nl.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=s,r!==QT&&(e=Error(nt(422),{cause:r}),_y(El(e,n)))):(r!==QT&&(t=Error(nt(423),{cause:r}),_y(El(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,r=El(r,n),s=u8(e.stateNode,r,s),IC(e,s),Zs!==4&&(Zs=2)),!1;var i=Error(nt(520),{cause:r});if(i=El(i,n),Hb===null?Hb=[i]:Hb.push(i),Zs!==4&&(Zs=2),t===null)return!0;r=El(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=u8(n.stateNode,r,e),IC(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"&&(Ih===null||!Ih.has(i))))return n.flags|=65536,s&=-s,n.lanes|=s,s=MU(s),NU(s,e,n,r),IC(n,s),!1}n=n.return}while(n!==null);return!1}var l9=Error(nt(461)),gi=!1;function Qi(e,t,n,r){t.child=e===null?UH(t,null,n,r):Fm(t,e.child,n,r)}function $R(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 zm(t),r=XE(e,t,n,o,i,s),a=QE(),e!==null&&!gi?(JE(e,t,s),id(e,t,s)):(Rr&&a&&qE(t),t.flags|=1,Qi(e,t,r,s),t.child)}function zR(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!FE(i)&&i.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=i,jU(e,t,i,r,s)):(e=bk(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!c9(e,s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:wy,n(o,r)&&e.ref===t.ref)return id(e,t,s)}return t.flags|=1,e=Vu(i,r),e.ref=t.ref,e.return=t,t.child=e}function jU(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(wy(i,r)&&e.ref===t.ref)if(gi=!1,t.pendingProps=r=i,c9(e,s))e.flags&131072&&(gi=!0);else return t.lanes=e.lanes,id(e,t,s)}return d8(e,t,n,r,s)}function IU(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 FR(e,t,i,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&yk(t,i!==null?i.cachePool:null),i!==null?MR(t,i):s8(),GH(t);else return r=t.lanes=536870912,FR(e,t,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(yk(t,i.cachePool),MR(t,i),hh(),t.memoizedState=null):(e!==null&&yk(t,null),s8(),hh());return Qi(e,t,s,n),t.child}function fb(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function FR(e,t,n,r,s){var i=VE();return i=i===null?null:{parent:pi._currentValue,pool:i},t.memoizedState={baseLanes:n,cachePool:i},e!==null&&yk(t,null),s8(),GH(t),e!==null&&Pg(e,t,r,!0),t.childLanes=s,null}function wk(e,t){return t=S2({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function qR(e,t,n){return Fm(t,e.child,null,n),e=wk(t,t.pendingProps),e.flags|=2,za(t),t.memoizedState=null,e}function ble(e,t,n){var r=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Rr){if(r.mode==="hidden")return e=wk(t,r),t.lanes=536870912,fb(null,e);if(i8(t),(e=Is)?(e=SV(e,Ml),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Uh!==null?{id:$c,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},n=OH(e),n.return=t,t.child=n,ro=t,Is=null)):e=null,e===null)throw Vh(t);return t.lanes=536870912,null}return wk(t,r)}var i=e.memoizedState;if(i!==null){var o=i.dehydrated;if(i8(t),s)if(t.flags&256)t.flags&=-257,t=qR(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(nt(558));else if(gi||Pg(e,t,n,!1),s=(n&e.childLanes)!==0,gi||s){if(r=ws,r!==null&&(o=cH(r,n),o!==0&&o!==i.retryLane))throw i.retryLane=o,cp(e,o),ba(r,e,o),l9;E2(),t=qR(e,t,n)}else e=i.treeContext,Is=Ll(o.nextSibling),ro=t,Rr=!0,Mh=null,Ml=!1,e!==null&&$H(t,e),t=wk(t,r),t.flags|=4096;return t}return e=Vu(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function kk(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(nt(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function d8(e,t,n,r,s){return zm(t),n=XE(e,t,n,r,void 0,s),r=QE(),e!==null&&!gi?(JE(e,t,s),id(e,t,s)):(Rr&&r&&qE(t),t.flags|=1,Qi(e,t,n,s),t.child)}function HR(e,t,n,r,s,i){return zm(t),t.updateQueue=null,n=YH(t,r,n,s),KH(e),r=QE(),e!==null&&!gi?(JE(e,t,i),id(e,t,i)):(Rr&&r&&qE(t),t.flags|=1,Qi(e,t,n,i),t.child)}function UR(e,t,n,r,s){if(zm(t),t.stateNode===null){var i=b0,o=n.contextType;typeof o=="object"&&o!==null&&(i=so(o)),i=new n(r,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=c8,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=r,i.state=t.memoizedState,i.refs={},GE(t),o=n.contextType,i.context=typeof o=="object"&&o!==null?so(o):b0,i.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o=="function"&&(DC(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&&c8.enqueueReplaceState(i,i.state,null),$b(t,r,i,s),Bb(),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=Hm(n,a);i.props=l;var u=i.context,d=n.contextType;o=b0,typeof d=="object"&&d!==null&&(o=so(d));var h=n.getDerivedStateFromProps;d=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,d||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a||u!==o)&&OR(t,i,r,o),ih=!1;var m=t.memoizedState;i.state=m,$b(t,r,i,s),Bb(),u=t.memoizedState,a||m!==u||ih?(typeof h=="function"&&(DC(t,n,h,r),u=t.memoizedState),(l=ih||PR(t,n,l,r,m,u,o))?(d||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=o,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,n8(e,t),o=t.memoizedProps,d=Hm(n,o),i.props=d,h=t.pendingProps,m=i.context,u=n.contextType,l=b0,typeof u=="object"&&u!==null&&(l=so(u)),a=n.getDerivedStateFromProps,(u=typeof a=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(o!==h||m!==l)&&OR(t,i,r,l),ih=!1,m=t.memoizedState,i.state=m,$b(t,r,i,s),Bb();var p=t.memoizedState;o!==h||m!==p||ih||e!==null&&e.dependencies!==null&&b2(e.dependencies)?(typeof a=="function"&&(DC(t,n,a,r),p=t.memoizedState),(d=ih||PR(t,n,d,r,m,p,l)||e!==null&&e.dependencies!==null&&b2(e.dependencies))?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,p,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,p,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=l,r=d):(typeof i.componentDidUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,kk(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=Fm(t,e.child,null,s),t.child=Fm(t,null,n,s)):Qi(e,t,n,s),t.memoizedState=i.state,e=t.child):e=id(e,t,s),e}function VR(e,t,n,r){return $m(),t.flags|=256,Qi(e,t,n,r),t.child}var LC={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function PC(e){return{baseLanes:e,cachePool:FH()}}function OC(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Va),e}function RU(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:(li.current&2)!==0),o&&(s=!0,t.flags&=-129),o=(t.flags&32)!==0,t.flags&=-33,e===null){if(Rr){if(s?dh(t):hh(),(e=Is)?(e=SV(e,Ml),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Uh!==null?{id:$c,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},n=OH(e),n.return=t,t.child=n,ro=t,Is=null)):e=null,e===null)throw Vh(t);return C8(e)?t.lanes=32:t.lanes=536870912,null}var a=r.children;return r=r.fallback,s?(hh(),s=t.mode,a=S2({mode:"hidden",children:a},s),r=Nm(r,s,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=PC(n),r.childLanes=OC(e,o,n),t.memoizedState=LC,fb(null,r)):(dh(t),h8(t,a))}var l=e.memoizedState;if(l!==null&&(a=l.dehydrated,a!==null)){if(i)t.flags&256?(dh(t),t.flags&=-257,t=BC(e,t,n)):t.memoizedState!==null?(hh(),t.child=e.child,t.flags|=128,t=null):(hh(),a=r.fallback,s=t.mode,r=S2({mode:"visible",children:r.children},s),a=Nm(a,s,n,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,Fm(t,e.child,null,n),r=t.child,r.memoizedState=PC(n),r.childLanes=OC(e,o,n),t.memoizedState=LC,t=fb(null,r));else if(dh(t),C8(a)){if(o=a.nextSibling&&a.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(nt(419)),r.stack="",r.digest=o,_y({value:r,source:null,stack:null}),t=BC(e,t,n)}else if(gi||Pg(e,t,n,!1),o=(n&e.childLanes)!==0,gi||o){if(o=ws,o!==null&&(r=cH(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,cp(e,r),ba(o,e,r),l9;S8(a)||E2(),t=BC(e,t,n)}else S8(a)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Is=Ll(a.nextSibling),ro=t,Rr=!0,Mh=null,Ml=!1,e!==null&&$H(t,e),t=h8(t,r.children),t.flags|=4096);return t}return s?(hh(),a=r.fallback,s=t.mode,l=e.child,u=l.sibling,r=Vu(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u!==null?a=Vu(u,a):(a=Nm(a,s,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,fb(null,r),r=t.child,a=e.child.memoizedState,a===null?a=PC(n):(s=a.cachePool,s!==null?(l=pi._currentValue,s=s.parent!==l?{parent:l,pool:l}:s):s=FH(),a={baseLanes:a.baseLanes|n,cachePool:s}),r.memoizedState=a,r.childLanes=OC(e,o,n),t.memoizedState=LC,fb(e.child,r)):(dh(t),n=e.child,e=n.sibling,n=Vu(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 h8(e,t){return t=S2({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function S2(e,t){return e=Ua(22,e,null,t),e.lanes=0,e}function BC(e,t,n){return Fm(t,e.child,null,n),e=h8(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function WR(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ZT(e.return,t,n)}function $C(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 DU(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;r=r.children;var o=li.current,a=(o&2)!==0;if(a?(o=o&1|2,t.flags|=128):o&=1,Es(li,o),Qi(e,t,r,n),r=Rr?ky:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&WR(e,n,t);else if(e.tag===19)WR(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&&x2(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),$C(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&&x2(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}$C(t,!0,n,null,i,r);break;case"together":$C(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function id(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Gh|=t.lanes,!(n&t.childLanes))if(e!==null){if(Pg(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(nt(153));if(t.child!==null){for(e=t.child,n=Vu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Vu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function c9(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&b2(e)))}function yle(e,t,n){switch(t.tag){case 3:u2(t,t.stateNode.containerInfo),uh(t,pi,e.memoizedState.cache),$m();break;case 27:case 5:zT(t);break;case 4:u2(t,t.stateNode.containerInfo);break;case 10:uh(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,i8(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(dh(t),t.flags|=128,null):n&t.child.childLanes?RU(e,t,n):(dh(t),e=id(e,t,n),e!==null?e.sibling:null);dh(t);break;case 19:var s=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(Pg(e,t,n,!1),r=(n&t.childLanes)!==0),s){if(r)return DU(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Es(li,li.current),r)break;return null;case 22:return t.lanes=0,IU(e,t,n,t.pendingProps);case 24:uh(t,pi,e.memoizedState.cache)}return id(e,t,n)}function LU(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)gi=!0;else{if(!c9(e,n)&&!(t.flags&128))return gi=!1,yle(e,t,n);gi=!!(e.flags&131072)}else gi=!1,Rr&&t.flags&1048576&&BH(t,ky,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=im(t.elementType),t.type=e,typeof e=="function")FE(e)?(r=Hm(e,r),t.tag=1,t=UR(null,t,e,r,n)):(t.tag=0,t=d8(null,t,e,r,n));else{if(e!=null){var s=e.$$typeof;if(s===AE){t.tag=11,t=$R(null,t,e,r,n);break e}else if(s===EE){t.tag=14,t=zR(null,t,e,r,n);break e}}throw t=BT(e)||e,Error(nt(306,t,""))}}return t;case 0:return d8(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,s=Hm(r,t.pendingProps),UR(e,t,r,s,n);case 3:e:{if(u2(t,t.stateNode.containerInfo),e===null)throw Error(nt(387));r=t.pendingProps;var i=t.memoizedState;s=i.element,n8(e,t),$b(t,r,null,n);var o=t.memoizedState;if(r=o.cache,uh(t,pi,r),r!==i.cache&&e8(t,[pi],n,!0),Bb(),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=VR(e,t,r,n);break e}else if(r!==s){s=El(Error(nt(424)),t),_y(s),t=VR(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(Is=Ll(e.firstChild),ro=t,Rr=!0,Mh=null,Ml=!0,n=UH(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if($m(),r===s){t=id(e,t,n);break e}Qi(e,t,r,n)}t=t.child}return t;case 26:return kk(e,t),e===null?(n=hD(t.type,null,t.pendingProps,null))?t.memoizedState=n:Rr||(n=t.type,e=t.pendingProps,r=I2(Eh.current).createElement(n),r[no]=t,r[xa]=e,oo(r,n,e),qi(r),t.stateNode=r):t.memoizedState=hD(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return zT(t),e===null&&Rr&&(r=t.stateNode=CV(t.type,t.pendingProps,Eh.current),ro=t,Ml=!0,s=Is,pf(t.type)?(T8=s,Is=Ll(r.firstChild)):Is=s),Qi(e,t,t.pendingProps.children,n),kk(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Rr&&((s=r=Is)&&(r=Kle(r,t.type,t.pendingProps,Ml),r!==null?(t.stateNode=r,ro=t,Is=Ll(r.firstChild),Ml=!1,s=!0):s=!1),s||Vh(t)),zT(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,r=i.children,k8(s,i)?r=null:o!==null&&k8(s,o)&&(t.flags|=32),t.memoizedState!==null&&(s=XE(e,t,cle,null,null,n),My._currentValue=s),kk(e,t),Qi(e,t,r,n),t.child;case 6:return e===null&&Rr&&((e=n=Is)&&(n=Yle(n,t.pendingProps,Ml),n!==null?(t.stateNode=n,ro=t,Is=null,e=!0):e=!1),e||Vh(t)),null;case 13:return RU(e,t,n);case 4:return u2(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fm(t,null,r,n):Qi(e,t,r,n),t.child;case 11:return $R(e,t,t.type,t.pendingProps,n);case 7:return Qi(e,t,t.pendingProps,n),t.child;case 8:return Qi(e,t,t.pendingProps.children,n),t.child;case 12:return Qi(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,uh(t,t.type,r.value),Qi(e,t,r.children,n),t.child;case 9:return s=t.type._context,r=t.pendingProps.children,zm(t),s=so(s),r=r(s),t.flags|=1,Qi(e,t,r,n),t.child;case 14:return zR(e,t,t.type,t.pendingProps,n);case 15:return jU(e,t,t.type,t.pendingProps,n);case 19:return DU(e,t,n);case 31:return ble(e,t,n);case 22:return IU(e,t,n,t.pendingProps);case 24:return zm(t),r=so(pi),e===null?(s=VE(),s===null&&(s=ws,i=UE(),s.pooledCache=i,i.refCount++,i!==null&&(s.pooledCacheLanes|=n),s=i),t.memoizedState={parent:r,cache:s},GE(t),uh(t,pi,s)):(e.lanes&n&&(n8(e,t),$b(t,null,null,n),Bb()),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),uh(t,pi,r)):(r=i.cache,uh(t,pi,r),r!==s.cache&&e8(t,[pi],n,!0))),Qi(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(nt(156,t.tag))}function ku(e){e.flags|=4}function zC(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(iV())e.flags|=8192;else throw Im=y2,WE}else e.flags&=-16777217}function GR(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!EV(t))if(iV())e.flags|=8192;else throw Im=y2,WE}function Fx(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?oH():536870912,e.lanes|=t,ag|=t)}function O1(e,t){if(!Rr)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 js(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 vle(e,t,n){var r=t.pendingProps;switch(HE(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return js(t),null;case 1:return js(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Wu(pi),tg(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Op(t)?ku(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,jC())),js(t),null;case 26:var s=t.type,i=t.memoizedState;return e===null?(ku(t),i!==null?(js(t),GR(t,i)):(js(t),zC(t,s,null,r,n))):i?i!==e.memoizedState?(ku(t),js(t),GR(t,i)):(js(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ku(t),js(t),zC(t,s,e,r,n)),null;case 27:if(d2(t),n=Eh.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ku(t);else{if(!r){if(t.stateNode===null)throw Error(nt(166));return js(t),null}e=Yc.current,Op(t)?kR(t):(e=CV(s,r,n),t.stateNode=e,ku(t))}return js(t),null;case 5:if(d2(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ku(t);else{if(!r){if(t.stateNode===null)throw Error(nt(166));return js(t),null}if(i=Yc.current,Op(t))kR(t);else{var o=I2(Eh.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[no]=t,i[xa]=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(oo(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&&ku(t)}}return js(t),zC(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ku(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(nt(166));if(e=Eh.current,Op(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,s=ro,s!==null)switch(s.tag){case 27:case 5:r=s.memoizedProps}e[no]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||wV(e.nodeValue,n)),e||Vh(t,!0)}else e=I2(e).createTextNode(r),e[no]=t,t.stateNode=e}return js(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Op(t),n!==null){if(e===null){if(!r)throw Error(nt(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(nt(557));e[no]=t}else $m(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;js(t),e=!1}else n=jC(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(za(t),t):(za(t),null);if(t.flags&128)throw Error(nt(558))}return js(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Op(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(nt(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(nt(317));s[no]=t}else $m(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;js(t),s=!1}else s=jC(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(za(t),t):(za(t),null)}return za(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),Fx(t,t.updateQueue),js(t),null);case 4:return tg(),e===null&&g9(t.stateNode.containerInfo),js(t),null;case 10:return Wu(t.type),js(t),null;case 19:if(Vi(li),r=t.memoizedState,r===null)return js(t),null;if(s=(t.flags&128)!==0,i=r.rendering,i===null)if(s)O1(r,!1);else{if(Zs!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=x2(e),i!==null){for(t.flags|=128,O1(r,!1),e=i.updateQueue,t.updateQueue=e,Fx(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)PH(n,e),n=n.sibling;return Es(li,li.current&1|2),Rr&&Iu(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ya()>T2&&(t.flags|=128,s=!0,O1(r,!1),t.lanes=4194304)}else{if(!s)if(e=x2(i),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Fx(t,e),O1(r,!0),r.tail===null&&r.tailMode==="hidden"&&!i.alternate&&!Rr)return js(t),null}else 2*Ya()-r.renderingStartTime>T2&&n!==536870912&&(t.flags|=128,s=!0,O1(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=Ya(),e.sibling=null,n=li.current,Es(li,s?n&1|2:n&1),Rr&&Iu(t,r.treeForkCount),e):(js(t),null);case 22:case 23:return za(t),KE(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(js(t),t.subtreeFlags&6&&(t.flags|=8192)):js(t),n=t.updateQueue,n!==null&&Fx(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&&Vi(jm),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wu(pi),js(t),null;case 25:return null;case 30:return null}throw Error(nt(156,t.tag))}function xle(e,t){switch(HE(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wu(pi),tg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return d2(t),null;case 31:if(t.memoizedState!==null){if(za(t),t.alternate===null)throw Error(nt(340));$m()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(za(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(nt(340));$m()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vi(li),null;case 4:return tg(),null;case 10:return Wu(t.type),null;case 22:case 23:return za(t),KE(),e!==null&&Vi(jm),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wu(pi),null;case 25:return null;default:return null}}function PU(e,t){switch(HE(t),t.tag){case 3:Wu(pi),tg();break;case 26:case 27:case 5:d2(t);break;case 4:tg();break;case 31:t.memoizedState!==null&&za(t);break;case 13:za(t);break;case 19:Vi(li);break;case 10:Wu(t.type);break;case 22:case 23:za(t),KE(),e!==null&&Vi(jm);break;case 24:Wu(pi)}}function Tv(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){ls(t,t.return,a)}}function Wh(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,u=a;try{u()}catch(d){ls(s,l,d)}}}r=r.next}while(r!==i)}}catch(d){ls(t,t.return,d)}}function OU(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{WH(t,n)}catch(r){ls(e,e.return,r)}}}function BU(e,t,n){n.props=Hm(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){ls(e,t,r)}}function Fb(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){ls(e,t,s)}}function Fc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(s){ls(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){ls(e,t,s)}else n.current=null}function $U(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){ls(e,e.return,s)}}function FC(e,t,n){try{var r=e.stateNode;qle(r,e.type,n,t),r[xa]=t}catch(s){ls(e,e.return,s)}}function zU(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pf(e.type)||e.tag===4}function qC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zU(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&&pf(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 f8(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=zu));else if(r!==4&&(r===27&&pf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(f8(e,t,n),e=e.sibling;e!==null;)f8(e,t,n),e=e.sibling}function C2(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&&pf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(C2(e,t,n),e=e.sibling;e!==null;)C2(e,t,n),e=e.sibling}function FU(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);oo(t,r,n),t[no]=e,t[xa]=n}catch(i){ls(e,e.return,i)}}var Lu=!1,mi=!1,HC=!1,KR=typeof WeakSet=="function"?WeakSet:Set,Fi=null;function wle(e,t){if(e=e.containerInfo,x8=P2,e=EH(e),BE(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,u=0,d=0,h=e,m=null;t:for(;;){for(var p;h!==n||s!==0&&h.nodeType!==3||(a=o+s),h!==i||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)m=h,h=p;for(;;){if(h===e)break t;if(m===n&&++u===s&&(a=o),m===i&&++d===r&&(l=o),(p=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(w8={focusedElem:e,selectionRange:n},P2=!1,Fi=t;Fi!==null;)if(t=Fi,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Fi=e;else for(;Fi!==null;){switch(t=Fi,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 g=Hm(n.type,s);e=r.getSnapshotBeforeUpdate(g,i),r.__reactInternalSnapshotBeforeUpdate=e}catch(b){ls(n,n.return,b)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)_8(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":_8(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(nt(163))}if(e=t.sibling,e!==null){e.return=t.return,Fi=e;break}Fi=t.return}}function qU(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Su(e,n),r&4&&Tv(5,n);break;case 1:if(Su(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(o){ls(n,n.return,o)}else{var s=Hm(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(o){ls(n,n.return,o)}}r&64&&OU(n),r&512&&Fb(n,n.return);break;case 3:if(Su(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{WH(e,t)}catch(o){ls(n,n.return,o)}}break;case 27:t===null&&r&4&&FU(n);case 26:case 5:Su(e,n),t===null&&r&4&&$U(n),r&512&&Fb(n,n.return);break;case 12:Su(e,n);break;case 31:Su(e,n),r&4&&VU(e,n);break;case 13:Su(e,n),r&4&&WU(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Nle.bind(null,n),Xle(e,n))));break;case 22:if(r=n.memoizedState!==null||Lu,!r){t=t!==null&&t.memoizedState!==null||mi,s=Lu;var i=mi;Lu=r,(mi=t)&&!i?Nu(e,n,(n.subtreeFlags&8772)!==0):Su(e,n),Lu=s,mi=i}break;case 30:break;default:Su(e,n)}}function HU(e){var t=e.alternate;t!==null&&(e.alternate=null,HU(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&IE(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 Bs=null,oa=!1;function _u(e,t,n){for(n=n.child;n!==null;)UU(e,t,n),n=n.sibling}function UU(e,t,n){if(Xa&&typeof Xa.onCommitFiberUnmount=="function")try{Xa.onCommitFiberUnmount(vv,n)}catch{}switch(n.tag){case 26:mi||Fc(n,t),_u(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:mi||Fc(n,t);var r=Bs,s=oa;pf(n.type)&&(Bs=n.stateNode,oa=!1),_u(e,t,n),Vb(n.stateNode),Bs=r,oa=s;break;case 5:mi||Fc(n,t);case 6:if(r=Bs,s=oa,Bs=null,_u(e,t,n),Bs=r,oa=s,Bs!==null)if(oa)try{(Bs.nodeType===9?Bs.body:Bs.nodeName==="HTML"?Bs.ownerDocument.body:Bs).removeChild(n.stateNode)}catch(i){ls(n,t,i)}else try{Bs.removeChild(n.stateNode)}catch(i){ls(n,t,i)}break;case 18:Bs!==null&&(oa?(e=Bs,aD(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),dg(e)):aD(Bs,n.stateNode));break;case 4:r=Bs,s=oa,Bs=n.stateNode.containerInfo,oa=!0,_u(e,t,n),Bs=r,oa=s;break;case 0:case 11:case 14:case 15:Wh(2,n,t),mi||Wh(4,n,t),_u(e,t,n);break;case 1:mi||(Fc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&BU(n,t,r)),_u(e,t,n);break;case 21:_u(e,t,n);break;case 22:mi=(r=mi)||n.memoizedState!==null,_u(e,t,n),mi=r;break;default:_u(e,t,n)}}function VU(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{dg(e)}catch(n){ls(t,t.return,n)}}}function WU(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{dg(e)}catch(n){ls(t,t.return,n)}}function kle(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new KR),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new KR),t;default:throw Error(nt(435,e.tag))}}function qx(e,t){var n=kle(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var s=jle.bind(null,e,r);r.then(s,s)}})}function Zo(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(pf(a.type)){Bs=a.stateNode,oa=!1;break e}break;case 5:Bs=a.stateNode,oa=!1;break e;case 3:case 4:Bs=a.stateNode.containerInfo,oa=!0;break e}a=a.return}if(Bs===null)throw Error(nt(160));UU(i,o,s),Bs=null,oa=!1,i=s.alternate,i!==null&&(i.return=null),s.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)GU(t,e),t=t.sibling}var Yl=null;function GU(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Zo(t,e),ea(e),r&4&&(Wh(3,e,e.return),Tv(3,e),Wh(5,e,e.return));break;case 1:Zo(t,e),ea(e),r&512&&(mi||n===null||Fc(n,n.return)),r&64&&Lu&&(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=Yl;if(Zo(t,e),ea(e),r&512&&(mi||n===null||Fc(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[kv]||i[no]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=s.createElement(r),s.head.insertBefore(i,s.querySelector("head > title"))),oo(i,r,n),i[no]=e,qi(i),r=i;break e;case"link":var o=mD("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),oo(i,r,n),s.head.appendChild(i);break;case"meta":if(o=mD("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),oo(i,r,n),s.head.appendChild(i);break;default:throw Error(nt(468,r))}i[no]=e,qi(i),r=i}e.stateNode=r}else pD(s,e.type,e.stateNode);else e.stateNode=fD(s,r,e.memoizedProps);else i!==r?(i===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):i.count--,r===null?pD(s,e.type,e.stateNode):fD(s,r,e.memoizedProps)):r===null&&e.stateNode!==null&&FC(e,e.memoizedProps,n.memoizedProps)}break;case 27:Zo(t,e),ea(e),r&512&&(mi||n===null||Fc(n,n.return)),n!==null&&r&4&&FC(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Zo(t,e),ea(e),r&512&&(mi||n===null||Fc(n,n.return)),e.flags&32){s=e.stateNode;try{rg(s,"")}catch(g){ls(e,e.return,g)}}r&4&&e.stateNode!=null&&(s=e.memoizedProps,FC(e,s,n!==null?n.memoizedProps:s)),r&1024&&(HC=!0);break;case 6:if(Zo(t,e),ea(e),r&4){if(e.stateNode===null)throw Error(nt(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(g){ls(e,e.return,g)}}break;case 3:if(Ck=null,s=Yl,Yl=R2(t.containerInfo),Zo(t,e),Yl=s,ea(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{dg(t.containerInfo)}catch(g){ls(e,e.return,g)}HC&&(HC=!1,KU(e));break;case 4:r=Yl,Yl=R2(e.stateNode.containerInfo),Zo(t,e),ea(e),Yl=r;break;case 12:Zo(t,e),ea(e);break;case 31:Zo(t,e),ea(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,qx(e,r)));break;case 13:Zo(t,e),ea(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&($4=Ya()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,qx(e,r)));break;case 22:s=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Lu,d=mi;if(Lu=u||s,mi=d||l,Zo(t,e),mi=d,Lu=u,ea(e),r&8192)e:for(t=e.stateNode,t._visibility=s?t._visibility&-2:t._visibility|1,s&&(n===null||l||Lu||mi||om(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 h=l.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;a.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(g){ls(l,l.return,g)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=s?"":l.memoizedProps}catch(g){ls(l,l.return,g)}}}else if(t.tag===18){if(n===null){l=t;try{var p=l.stateNode;s?lD(p,!0):lD(l.stateNode,!1)}catch(g){ls(l,l.return,g)}}}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,qx(e,n))));break;case 19:Zo(t,e),ea(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,qx(e,r)));break;case 30:break;case 21:break;default:Zo(t,e),ea(e)}}function ea(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(zU(r)){n=r;break}r=r.return}if(n==null)throw Error(nt(160));switch(n.tag){case 27:var s=n.stateNode,i=qC(e);C2(e,i,s);break;case 5:var o=n.stateNode;n.flags&32&&(rg(o,""),n.flags&=-33);var a=qC(e);C2(e,a,o);break;case 3:case 4:var l=n.stateNode.containerInfo,u=qC(e);f8(e,u,l);break;default:throw Error(nt(161))}}catch(d){ls(e,e.return,d)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function KU(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;KU(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Su(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)qU(e,t.alternate,t),t=t.sibling}function om(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wh(4,t,t.return),om(t);break;case 1:Fc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&BU(t,t.return,n),om(t);break;case 27:Vb(t.stateNode);case 26:case 5:Fc(t,t.return),om(t);break;case 22:t.memoizedState===null&&om(t);break;case 30:om(t);break;default:om(t)}e=e.sibling}}function Nu(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:Nu(s,i,n),Tv(4,i);break;case 1:if(Nu(s,i,n),r=i,s=r.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch(u){ls(r,r.return,u)}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++)VH(l[s],a)}catch(u){ls(r,r.return,u)}}n&&o&64&&OU(i),Fb(i,i.return);break;case 27:FU(i);case 26:case 5:Nu(s,i,n),n&&r===null&&o&4&&$U(i),Fb(i,i.return);break;case 12:Nu(s,i,n);break;case 31:Nu(s,i,n),n&&o&4&&VU(s,i);break;case 13:Nu(s,i,n),n&&o&4&&WU(s,i);break;case 22:i.memoizedState===null&&Nu(s,i,n),Fb(i,i.return);break;case 30:break;default:Nu(s,i,n)}t=t.sibling}}function u9(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&&Sv(n))}function d9(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Sv(e))}function Vl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)YU(e,t,n,r),t=t.sibling}function YU(e,t,n,r){var s=t.flags;switch(t.tag){case 0:case 11:case 15:Vl(e,t,n,r),s&2048&&Tv(9,t);break;case 1:Vl(e,t,n,r);break;case 3:Vl(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&&Sv(e)));break;case 12:if(s&2048){Vl(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){ls(t,t.return,l)}}else Vl(e,t,n,r);break;case 31:Vl(e,t,n,r);break;case 13:Vl(e,t,n,r);break;case 23:break;case 22:i=t.stateNode,o=t.alternate,t.memoizedState!==null?i._visibility&2?Vl(e,t,n,r):qb(e,t):i._visibility&2?Vl(e,t,n,r):(i._visibility|=2,t0(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),s&2048&&u9(o,t);break;case 24:Vl(e,t,n,r),s&2048&&d9(t.alternate,t);break;default:Vl(e,t,n,r)}}function t0(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,u=o.flags;switch(o.tag){case 0:case 11:case 15:t0(i,o,a,l,s),Tv(8,o);break;case 23:break;case 22:var d=o.stateNode;o.memoizedState!==null?d._visibility&2?t0(i,o,a,l,s):qb(i,o):(d._visibility|=2,t0(i,o,a,l,s)),s&&u&2048&&u9(o.alternate,o);break;case 24:t0(i,o,a,l,s),s&&u&2048&&d9(o.alternate,o);break;default:t0(i,o,a,l,s)}t=t.sibling}}function qb(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:qb(n,r),s&2048&&u9(r.alternate,r);break;case 24:qb(n,r),s&2048&&d9(r.alternate,r);break;default:qb(n,r)}t=t.sibling}}var mb=8192;function Bp(e,t,n){if(e.subtreeFlags&mb)for(e=e.child;e!==null;)XU(e,t,n),e=e.sibling}function XU(e,t,n){switch(e.tag){case 26:Bp(e,t,n),e.flags&mb&&e.memoizedState!==null&&lce(n,Yl,e.memoizedState,e.memoizedProps);break;case 5:Bp(e,t,n);break;case 3:case 4:var r=Yl;Yl=R2(e.stateNode.containerInfo),Bp(e,t,n),Yl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=mb,mb=16777216,Bp(e,t,n),mb=r):Bp(e,t,n));break;default:Bp(e,t,n)}}function QU(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 B1(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Fi=r,ZU(r,e)}QU(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)JU(e),e=e.sibling}function JU(e){switch(e.tag){case 0:case 11:case 15:B1(e),e.flags&2048&&Wh(9,e,e.return);break;case 3:B1(e);break;case 12:B1(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,_k(e)):B1(e);break;default:B1(e)}}function _k(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Fi=r,ZU(r,e)}QU(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wh(8,t,t.return),_k(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,_k(t));break;default:_k(t)}e=e.sibling}}function ZU(e,t){for(;Fi!==null;){var n=Fi;switch(n.tag){case 0:case 11:case 15:Wh(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:Sv(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Fi=r;else e:for(n=e;Fi!==null;){r=Fi;var s=r.sibling,i=r.return;if(HU(r),r===n){Fi=null;break e}if(s!==null){s.return=i,Fi=s;break e}Fi=i}}}var _le={getCacheForType:function(e){var t=so(pi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return so(pi).controller.signal}},Sle=typeof WeakMap=="function"?WeakMap:Map,Zr=0,ws=null,kr=null,Cr=0,as=0,Pa=null,yh=!1,Bg=!1,h9=!1,od=0,Zs=0,Gh=0,Rm=0,f9=0,Va=0,ag=0,Hb=null,aa=null,m8=!1,$4=0,eV=0,T2=1/0,A2=null,Ih=null,Ai=0,Rh=null,lg=null,Gu=0,p8=0,g8=null,tV=null,Ub=0,b8=null;function Ja(){return Zr&2&&Cr!==0?Cr&-Cr:qn.T!==null?p9():uH()}function nV(){if(Va===0)if(!(Cr&536870912)||Rr){var e=Dx;Dx<<=1,!(Dx&3932160)&&(Dx=262144),Va=e}else Va=536870912;return e=nl.current,e!==null&&(e.flags|=32),Va}function ba(e,t,n){(e===ws&&(as===2||as===9)||e.cancelPendingCommit!==null)&&(cg(e,0),vh(e,Cr,Va,!1)),wv(e,n),(!(Zr&2)||e!==ws)&&(e===ws&&(!(Zr&2)&&(Rm|=n),Zs===4&&vh(e,Cr,Va,!1)),su(e))}function rV(e,t,n){if(Zr&6)throw Error(nt(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||xv(e,t),s=r?Ale(e,t):UC(e,t,!0),i=r;do{if(s===0){Bg&&!r&&vh(e,t,0,!1);break}else{if(n=e.current.alternate,i&&!Cle(n)){s=UC(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=Hb;var l=a.current.memoizedState.isDehydrated;if(l&&(cg(a,o).flags|=256),o=UC(a,o,!1),o!==2){if(h9&&!l){a.errorRecoveryDisabledLanes|=i,Rm|=i,s=4;break e}i=aa,aa=s,i!==null&&(aa===null?aa=i:aa.push.apply(aa,i))}s=o}if(i=!1,s!==2)continue}}if(s===1){cg(e,0),vh(e,t,0,!0);break}e:{switch(r=e,i=s,i){case 0:case 1:throw Error(nt(345));case 4:if((t&4194048)!==t)break;case 6:vh(r,t,Va,!yh);break e;case 2:aa=null;break;case 3:case 5:break;default:throw Error(nt(329))}if((t&62914560)===t&&(s=$4+300-Ya(),10<s)){if(vh(r,t,Va,!yh),E4(r,0,!0)!==0)break e;Gu=t,r.timeoutHandle=_V(YR.bind(null,r,n,aa,A2,m8,t,Va,Rm,ag,yh,i,"Throttled",-0,0),s);break e}YR(r,n,aa,A2,m8,t,Va,Rm,ag,yh,i,null,-0,0)}}break}while(!0);su(e)}function YR(e,t,n,r,s,i,o,a,l,u,d,h,m,p){if(e.timeoutHandle=-1,h=t.subtreeFlags,h&8192||(h&16785408)===16785408){h={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zu},XU(t,i,h);var g=(i&62914560)===i?$4-Ya():(i&4194048)===i?eV-Ya():0;if(g=cce(h,g),g!==null){Gu=i,e.cancelPendingCommit=g(QR.bind(null,e,t,i,n,r,s,o,a,l,d,h,null,m,p)),vh(e,i,o,!u);return}}QR(e,t,i,n,r,s,o,a,l)}function Cle(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(!tl(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 vh(e,t,n,r){t&=~f9,t&=~Rm,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var s=t;0<s;){var i=31-Qa(s),o=1<<i;r[i]=-1,s&=~o}n!==0&&aH(e,n,t)}function z4(){return Zr&6?!0:(Av(0),!1)}function m9(){if(kr!==null){if(as===0)var e=kr.return;else e=kr,Fu=up=null,ZE(e),P0=null,Sy=0,e=kr;for(;e!==null;)PU(e.alternate,e),e=e.return;kr=null}}function cg(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Vle(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Gu=0,m9(),ws=e,kr=n=Vu(e.current,null),Cr=t,as=0,Pa=null,yh=!1,Bg=xv(e,t),h9=!1,ag=Va=f9=Rm=Gh=Zs=0,aa=Hb=null,m8=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var s=31-Qa(r),i=1<<s;t|=e[s],r&=~i}return od=t,I4(),n}function sV(e,t){ir=null,qn.H=Ty,t===Og||t===D4?(t=AR(),as=3):t===WE?(t=AR(),as=4):as=t===l9?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pa=t,kr===null&&(Zs=1,_2(e,El(t,e.current)))}function iV(){var e=nl.current;return e===null?!0:(Cr&4194048)===Cr?Dl===null:(Cr&62914560)===Cr||Cr&536870912?e===Dl:!1}function oV(){var e=qn.H;return qn.H=Ty,e===null?Ty:e}function aV(){var e=qn.A;return qn.A=_le,e}function E2(){Zs=4,yh||(Cr&4194048)!==Cr&&nl.current!==null||(Bg=!0),!(Gh&134217727)&&!(Rm&134217727)||ws===null||vh(ws,Cr,Va,!1)}function UC(e,t,n){var r=Zr;Zr|=2;var s=oV(),i=aV();(ws!==e||Cr!==t)&&(A2=null,cg(e,t)),t=!1;var o=Zs;e:do try{if(as!==0&&kr!==null){var a=kr,l=Pa;switch(as){case 8:m9(),o=6;break e;case 3:case 2:case 9:case 6:nl.current===null&&(t=!0);var u=as;if(as=0,Pa=null,x0(e,a,l,u),n&&Bg){o=0;break e}break;default:u=as,as=0,Pa=null,x0(e,a,l,u)}}Tle(),o=Zs;break}catch(d){sV(e,d)}while(!0);return t&&e.shellSuspendCounter++,Fu=up=null,Zr=r,qn.H=s,qn.A=i,kr===null&&(ws=null,Cr=0,I4()),o}function Tle(){for(;kr!==null;)lV(kr)}function Ale(e,t){var n=Zr;Zr|=2;var r=oV(),s=aV();ws!==e||Cr!==t?(A2=null,T2=Ya()+500,cg(e,t)):Bg=xv(e,t);e:do try{if(as!==0&&kr!==null){t=kr;var i=Pa;t:switch(as){case 1:as=0,Pa=null,x0(e,t,i,1);break;case 2:case 9:if(TR(i)){as=0,Pa=null,XR(t);break}t=function(){as!==2&&as!==9||ws!==e||(as=7),su(e)},i.then(t,t);break e;case 3:as=7;break e;case 4:as=5;break e;case 7:TR(i)?(as=0,Pa=null,XR(t)):(as=0,Pa=null,x0(e,t,i,7));break;case 5:var o=null;switch(kr.tag){case 26:o=kr.memoizedState;case 5:case 27:var a=kr;if(o?EV(o):a.stateNode.complete){as=0,Pa=null;var l=a.sibling;if(l!==null)kr=l;else{var u=a.return;u!==null?(kr=u,F4(u)):kr=null}break t}}as=0,Pa=null,x0(e,t,i,5);break;case 6:as=0,Pa=null,x0(e,t,i,6);break;case 8:m9(),Zs=6;break e;default:throw Error(nt(462))}}Ele();break}catch(d){sV(e,d)}while(!0);return Fu=up=null,qn.H=r,qn.A=s,Zr=n,kr!==null?0:(ws=null,Cr=0,I4(),Zs)}function Ele(){for(;kr!==null&&!Qoe();)lV(kr)}function lV(e){var t=LU(e.alternate,e,od);e.memoizedProps=e.pendingProps,t===null?F4(e):kr=t}function XR(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=HR(n,t,t.pendingProps,t.type,void 0,Cr);break;case 11:t=HR(n,t,t.pendingProps,t.type.render,t.ref,Cr);break;case 5:ZE(t);default:PU(n,t),t=kr=PH(t,od),t=LU(n,t,od)}e.memoizedProps=e.pendingProps,t===null?F4(e):kr=t}function x0(e,t,n,r){Fu=up=null,ZE(t),P0=null,Sy=0;var s=t.return;try{if(gle(e,s,t,n,Cr)){Zs=1,_2(e,El(n,e.current)),kr=null;return}}catch(i){if(s!==null)throw kr=s,i;Zs=1,_2(e,El(n,e.current)),kr=null;return}t.flags&32768?(Rr||r===1?e=!0:Bg||Cr&536870912?e=!1:(yh=e=!0,(r===2||r===9||r===3||r===6)&&(r=nl.current,r!==null&&r.tag===13&&(r.flags|=16384))),cV(t,e)):F4(t)}function F4(e){var t=e;do{if(t.flags&32768){cV(t,yh);return}e=t.return;var n=vle(t.alternate,t,od);if(n!==null){kr=n;return}if(t=t.sibling,t!==null){kr=t;return}kr=t=e}while(t!==null);Zs===0&&(Zs=5)}function cV(e,t){do{var n=xle(e.alternate,e);if(n!==null){n.flags&=32767,kr=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){kr=e;return}kr=e=n}while(e!==null);Zs=6,kr=null}function QR(e,t,n,r,s,i,o,a,l){e.cancelPendingCommit=null;do q4();while(Ai!==0);if(Zr&6)throw Error(nt(327));if(t!==null){if(t===e.current)throw Error(nt(177));if(i=t.lanes|t.childLanes,i|=$E,aae(e,n,i,o,a,l),e===ws&&(kr=ws=null,Cr=0),lg=t,Rh=e,Gu=n,p8=i,g8=s,tV=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ile(h2,function(){return mV(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,t.subtreeFlags&13878||r){r=qn.T,qn.T=null,s=ts.p,ts.p=2,o=Zr,Zr|=4;try{wle(e,t,n)}finally{Zr=o,ts.p=s,qn.T=r}}Ai=1,uV(),dV(),hV()}}function uV(){if(Ai===1){Ai=0;var e=Rh,t=lg,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=qn.T,qn.T=null;var r=ts.p;ts.p=2;var s=Zr;Zr|=4;try{GU(t,e);var i=w8,o=EH(e.containerInfo),a=i.focusedElem,l=i.selectionRange;if(o!==a&&a&&a.ownerDocument&&AH(a.ownerDocument.documentElement,a)){if(l!==null&&BE(a)){var u=l.start,d=l.end;if(d===void 0&&(d=u),"selectionStart"in a)a.selectionStart=u,a.selectionEnd=Math.min(d,a.value.length);else{var h=a.ownerDocument||document,m=h&&h.defaultView||window;if(m.getSelection){var p=m.getSelection(),g=a.textContent.length,b=Math.min(l.start,g),x=l.end===void 0?b:Math.min(l.end,g);!p.extend&&b>x&&(o=x,x=b,b=o);var v=vR(a,b),y=vR(a,x);if(v&&y&&(p.rangeCount!==1||p.anchorNode!==v.node||p.anchorOffset!==v.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var w=h.createRange();w.setStart(v.node,v.offset),p.removeAllRanges(),b>x?(p.addRange(w),p.extend(y.node,y.offset)):(w.setEnd(y.node,y.offset),p.addRange(w))}}}}for(h=[],p=a;p=p.parentNode;)p.nodeType===1&&h.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<h.length;a++){var k=h[a];k.element.scrollLeft=k.left,k.element.scrollTop=k.top}}P2=!!x8,w8=x8=null}finally{Zr=s,ts.p=r,qn.T=n}}e.current=t,Ai=2}}function dV(){if(Ai===2){Ai=0;var e=Rh,t=lg,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=qn.T,qn.T=null;var r=ts.p;ts.p=2;var s=Zr;Zr|=4;try{qU(e,t.alternate,t)}finally{Zr=s,ts.p=r,qn.T=n}}Ai=3}}function hV(){if(Ai===4||Ai===3){Ai=0,Joe();var e=Rh,t=lg,n=Gu,r=tV;t.subtreeFlags&10256||t.flags&10256?Ai=5:(Ai=0,lg=Rh=null,fV(e,e.pendingLanes));var s=e.pendingLanes;if(s===0&&(Ih=null),jE(n),t=t.stateNode,Xa&&typeof Xa.onCommitFiberRoot=="function")try{Xa.onCommitFiberRoot(vv,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=qn.T,s=ts.p,ts.p=2,qn.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{qn.T=t,ts.p=s}}Gu&3&&q4(),su(e),s=e.pendingLanes,n&261930&&s&42?e===b8?Ub++:(Ub=0,b8=e):Ub=0,Av(0)}}function fV(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Sv(t)))}function q4(){return uV(),dV(),hV(),mV()}function mV(){if(Ai!==5)return!1;var e=Rh,t=p8;p8=0;var n=jE(Gu),r=qn.T,s=ts.p;try{ts.p=32>n?32:n,qn.T=null,n=g8,g8=null;var i=Rh,o=Gu;if(Ai=0,lg=Rh=null,Gu=0,Zr&6)throw Error(nt(331));var a=Zr;if(Zr|=4,JU(i.current),YU(i,i.current,o,n),Zr=a,Av(0,!1),Xa&&typeof Xa.onPostCommitFiberRoot=="function")try{Xa.onPostCommitFiberRoot(vv,i)}catch{}return!0}finally{ts.p=s,qn.T=r,fV(e,t)}}function JR(e,t,n){t=El(n,t),t=u8(e.stateNode,t,2),e=jh(e,t,2),e!==null&&(wv(e,2),su(e))}function ls(e,t,n){if(e.tag===3)JR(e,e,n);else for(;t!==null;){if(t.tag===3){JR(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ih===null||!Ih.has(r))){e=El(n,e),n=MU(2),r=jh(t,n,2),r!==null&&(NU(n,r,t,e),wv(r,2),su(r));break}}t=t.return}}function VC(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Sle;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)||(h9=!0,s.add(n),e=Mle.bind(null,e,t,n),t.then(e,e))}function Mle(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ws===e&&(Cr&n)===n&&(Zs===4||Zs===3&&(Cr&62914560)===Cr&&300>Ya()-$4?!(Zr&2)&&cg(e,0):f9|=n,ag===Cr&&(ag=0)),su(e)}function pV(e,t){t===0&&(t=oH()),e=cp(e,t),e!==null&&(wv(e,t),su(e))}function Nle(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pV(e,n)}function jle(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(nt(314))}r!==null&&r.delete(t),pV(e,n)}function Ile(e,t){return ME(e,t)}var M2=null,n0=null,y8=!1,N2=!1,WC=!1,xh=0;function su(e){e!==n0&&e.next===null&&(n0===null?M2=n0=e:n0=n0.next=e),N2=!0,y8||(y8=!0,Dle())}function Av(e,t){if(!WC&&N2){WC=!0;do for(var n=!1,r=M2;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-Qa(42|e)+1)-1,i&=s&~(o&~a),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,ZR(r,i))}else i=Cr,i=E4(r,r===ws?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(i&3)||xv(r,i)||(n=!0,ZR(r,i));r=r.next}while(n);WC=!1}}function Rle(){gV()}function gV(){N2=y8=!1;var e=0;xh!==0&&Ule()&&(e=xh);for(var t=Ya(),n=null,r=M2;r!==null;){var s=r.next,i=bV(r,t);i===0?(r.next=null,n===null?M2=s:n.next=s,s===null&&(n0=n)):(n=r,(e!==0||i&3)&&(N2=!0)),r=s}Ai!==0&&Ai!==5||Av(e),xh!==0&&(xh=0)}function bV(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var o=31-Qa(i),a=1<<o,l=s[o];l===-1?(!(a&n)||a&r)&&(s[o]=oae(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}if(t=ws,n=Cr,n=E4(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(as===2||as===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xC(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||xv(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xC(r),jE(n)){case 2:case 8:n=sH;break;case 32:n=h2;break;case 268435456:n=iH;break;default:n=h2}return r=yV.bind(null,e),n=ME(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xC(r),e.callbackPriority=2,e.callbackNode=null,2}function yV(e,t){if(Ai!==0&&Ai!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(q4()&&e.callbackNode!==n)return null;var r=Cr;return r=E4(e,e===ws?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(rV(e,r,t),bV(e,Ya()),e.callbackNode!=null&&e.callbackNode===n?yV.bind(null,e):null)}function ZR(e,t){if(q4())return null;rV(e,t,!0)}function Dle(){Wle(function(){Zr&6?ME(rH,Rle):gV()})}function p9(){if(xh===0){var e=sg;e===0&&(e=Rx,Rx<<=1,!(Rx&261888)&&(Rx=256)),xh=e}return xh}function eD(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:mk(""+e)}function tD(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 Lle(e,t,n,r,s){if(t==="submit"&&n&&n.stateNode===s){var i=eD((s[xa]||null).action),o=r.submitter;o&&(t=(t=o[xa]||null)?eD(t.formAction):o.getAttribute("formAction"),t!==null&&(i=t,o=null));var a=new M4("action","action",null,r,s);e.push({event:a,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(xh!==0){var l=o?tD(s,o):new FormData(s);l8(n,{pending:!0,data:l,method:s.method,action:i},null,l)}}else typeof i=="function"&&(a.preventDefault(),l=o?tD(s,o):new FormData(s),l8(n,{pending:!0,data:l,method:s.method,action:i},i,l))},currentTarget:s}]})}}for(var GC=0;GC<XT.length;GC++){var KC=XT[GC],Ple=KC.toLowerCase(),Ole=KC[0].toUpperCase()+KC.slice(1);sc(Ple,"on"+Ole)}sc(NH,"onAnimationEnd");sc(jH,"onAnimationIteration");sc(IH,"onAnimationStart");sc("dblclick","onDoubleClick");sc("focusin","onFocus");sc("focusout","onBlur");sc(Zae,"onTransitionRun");sc(ele,"onTransitionStart");sc(tle,"onTransitionCancel");sc(RH,"onTransitionEnd");ng("onMouseEnter",["mouseout","mouseover"]);ng("onMouseLeave",["mouseout","mouseover"]);ng("onPointerEnter",["pointerout","pointerover"]);ng("onPointerLeave",["pointerout","pointerover"]);op("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));op("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));op("onBeforeInput",["compositionend","keypress","textInput","paste"]);op("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));op("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));op("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ay="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(" "),Ble=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ay));function vV(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,u=a.currentTarget;if(a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=u;try{i(s)}catch(d){m2(d)}s.currentTarget=null,i=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&s.isPropagationStopped())break e;i=a,s.currentTarget=u;try{i(s)}catch(d){m2(d)}s.currentTarget=null,i=l}}}}function wr(e,t){var n=t[qT];n===void 0&&(n=t[qT]=new Set);var r=e+"__bubble";n.has(r)||(xV(t,e,2,!1),n.add(r))}function YC(e,t,n){var r=0;t&&(r|=4),xV(n,e,r,t)}var Hx="_reactListening"+Math.random().toString(36).slice(2);function g9(e){if(!e[Hx]){e[Hx]=!0,dH.forEach(function(n){n!=="selectionchange"&&(Ble.has(n)||YC(n,!1,e),YC(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hx]||(t[Hx]=!0,YC("selectionchange",!1,t))}}function xV(e,t,n,r){switch(RV(t)){case 2:var s=hce;break;case 8:s=fce;break;default:s=x9}n=s.bind(null,t,n,e),s=void 0,!GT||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 XC(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=d0(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}vH(function(){var u=i,d=DE(n),h=[];e:{var m=DH.get(e);if(m!==void 0){var p=M4,g=e;switch(e){case"keypress":if(gk(n)===0)break e;case"keydown":case"keyup":p=jae;break;case"focusin":g="focus",p=CC;break;case"focusout":g="blur",p=CC;break;case"beforeblur":case"afterblur":p=CC;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":p=cR;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=vae;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Dae;break;case NH:case jH:case IH:p=kae;break;case RH:p=Pae;break;case"scroll":case"scrollend":p=bae;break;case"wheel":p=Bae;break;case"copy":case"cut":case"paste":p=Sae;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=dR;break;case"toggle":case"beforetoggle":p=zae}var b=(t&4)!==0,x=!b&&(e==="scroll"||e==="scrollend"),v=b?m!==null?m+"Capture":null:m;b=[];for(var y=u,w;y!==null;){var k=y;if(w=k.stateNode,k=k.tag,k!==5&&k!==26&&k!==27||w===null||v===null||(k=vy(y,v),k!=null&&b.push(Ey(y,k,w))),x)break;y=y.return}0<b.length&&(m=new p(m,g,null,n,d),h.push({event:m,listeners:b}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",m&&n!==WT&&(g=n.relatedTarget||n.fromElement)&&(d0(g)||g[Dg]))break e;if((p||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=u,g=g?d0(g):null,g!==null&&(x=yv(g),b=g.tag,g!==x||b!==5&&b!==27&&b!==6)&&(g=null)):(p=null,g=u),p!==g)){if(b=cR,k="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(b=dR,k="onPointerLeave",v="onPointerEnter",y="pointer"),x=p==null?m:hb(p),w=g==null?m:hb(g),m=new b(k,y+"leave",p,n,d),m.target=x,m.relatedTarget=w,k=null,d0(d)===u&&(b=new b(v,y+"enter",g,n,d),b.target=w,b.relatedTarget=x,k=b),x=k,p&&g)t:{for(b=$le,v=p,y=g,w=0,k=v;k;k=b(k))w++;k=0;for(var T=y;T;T=b(T))k++;for(;0<w-k;)v=b(v),w--;for(;0<k-w;)y=b(y),k--;for(;w--;){if(v===y||y!==null&&v===y.alternate){b=v;break t}v=b(v),y=b(y)}b=null}else b=null;p!==null&&nD(h,m,p,b,!1),g!==null&&x!==null&&nD(h,x,g,b,!0)}}e:{if(m=u?hb(u):window,p=m.nodeName&&m.nodeName.toLowerCase(),p==="select"||p==="input"&&m.type==="file")var S=pR;else if(mR(m))if(CH)S=Xae;else{S=Kae;var C=Gae}else p=m.nodeName,!p||p.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?u&&RE(u.elementType)&&(S=pR):S=Yae;if(S&&(S=S(e,u))){SH(h,S,n,d);break e}C&&C(e,m,u),e==="focusout"&&u&&m.type==="number"&&u.memoizedProps.value!=null&&VT(m,"number",m.value)}switch(C=u?hb(u):window,e){case"focusin":(mR(C)||C.contentEditable==="true")&&(m0=C,KT=u,Lb=null);break;case"focusout":Lb=KT=m0=null;break;case"mousedown":YT=!0;break;case"contextmenu":case"mouseup":case"dragend":YT=!1,xR(h,n,d);break;case"selectionchange":if(Jae)break;case"keydown":case"keyup":xR(h,n,d)}var _;if(OE)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else f0?kH(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(wH&&n.locale!=="ko"&&(f0||A!=="onCompositionStart"?A==="onCompositionEnd"&&f0&&(_=xH()):(bh=d,LE="value"in bh?bh.value:bh.textContent,f0=!0)),C=j2(u,A),0<C.length&&(A=new uR(A,e,null,n,d),h.push({event:A,listeners:C}),_?A.data=_:(_=_H(n),_!==null&&(A.data=_)))),(_=qae?Hae(e,n):Uae(e,n))&&(A=j2(u,"onBeforeInput"),0<A.length&&(C=new uR("onBeforeInput","beforeinput",null,n,d),h.push({event:C,listeners:A}),C.data=_)),Lle(h,e,u,n,d)}vV(h,t)})}function Ey(e,t,n){return{instance:e,listener:t,currentTarget:n}}function j2(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=vy(e,n),s!=null&&r.unshift(Ey(e,s,i)),s=vy(e,t),s!=null&&r.push(Ey(e,s,i))),e.tag===3)return r;e=e.return}return[]}function $le(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function nD(e,t,n,r,s){for(var i=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(a=a.tag,l!==null&&l===r)break;a!==5&&a!==26&&a!==27||u===null||(l=u,s?(u=vy(n,i),u!=null&&o.unshift(Ey(n,u,l))):s||(u=vy(n,i),u!=null&&o.push(Ey(n,u,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var zle=/\r\n?/g,Fle=/\u0000|\uFFFD/g;function rD(e){return(typeof e=="string"?e:""+e).replace(zle,`
`).replace(Fle,"")}function wV(e,t){return t=rD(t),rD(e)===t}function hs(e,t,n,r,s,i){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||rg(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&rg(e,""+r);break;case"className":Px(e,"class",r);break;case"tabIndex":Px(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Px(e,n,r);break;case"style":yH(e,r,i);break;case"data":if(t!=="object"){Px(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=mk(""+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"&&hs(e,t,"name",s.name,s,null),hs(e,t,"formEncType",s.formEncType,s,null),hs(e,t,"formMethod",s.formMethod,s,null),hs(e,t,"formTarget",s.formTarget,s,null)):(hs(e,t,"encType",s.encType,s,null),hs(e,t,"method",s.method,s,null),hs(e,t,"target",s.target,s,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=mk(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=zu);break;case"onScroll":r!=null&&wr("scroll",e);break;case"onScrollEnd":r!=null&&wr("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(nt(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(nt(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=mk(""+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":wr("beforetoggle",e),wr("toggle",e),fk(e,"popover",r);break;case"xlinkActuate":wu(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":wu(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":wu(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":wu(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":wu(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":wu(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":wu(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":wu(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":wu(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":fk(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=pae.get(n)||n,fk(e,n,r))}}function v8(e,t,n,r,s,i){switch(n){case"style":yH(e,r,i);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(nt(61));if(n=r.__html,n!=null){if(s.children!=null)throw Error(nt(60));e.innerHTML=n}}break;case"children":typeof r=="string"?rg(e,r):(typeof r=="number"||typeof r=="bigint")&&rg(e,""+r);break;case"onScroll":r!=null&&wr("scroll",e);break;case"onScrollEnd":r!=null&&wr("scrollend",e);break;case"onClick":r!=null&&(e.onclick=zu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hH.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[xa]||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,""):fk(e,n,r)}}}function oo(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":wr("error",e),wr("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(nt(137,t));default:hs(e,t,i,o,n,null)}}s&&hs(e,t,"srcSet",n.srcSet,n,null),r&&hs(e,t,"src",n.src,n,null);return;case"input":wr("invalid",e);var a=i=o=s=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case"name":s=d;break;case"type":o=d;break;case"checked":l=d;break;case"defaultChecked":u=d;break;case"value":i=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(nt(137,t));break;default:hs(e,t,r,d,n,null)}}pH(e,i,a,l,u,o,s,!1);return;case"select":wr("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:hs(e,t,s,a,n,null)}t=i,n=o,e.multiple=!!r,t!=null?R0(e,!!r,t,!1):n!=null&&R0(e,!!r,n,!0);return;case"textarea":wr("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(nt(91));break;default:hs(e,t,o,a,n,null)}bH(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:hs(e,t,l,r,n,null)}return;case"dialog":wr("beforetoggle",e),wr("toggle",e),wr("cancel",e),wr("close",e);break;case"iframe":case"object":wr("load",e);break;case"video":case"audio":for(r=0;r<Ay.length;r++)wr(Ay[r],e);break;case"image":wr("error",e),wr("load",e);break;case"details":wr("toggle",e);break;case"embed":case"source":case"link":wr("error",e),wr("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(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(nt(137,t));default:hs(e,t,u,r,n,null)}return;default:if(RE(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&v8(e,t,d,r,n,void 0));return}}for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null&&hs(e,t,a,r,n,null))}function qle(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,u=null,d=null;for(p in n){var h=n[p];if(n.hasOwnProperty(p)&&h!=null)switch(p){case"checked":break;case"value":break;case"defaultValue":l=h;default:r.hasOwnProperty(p)||hs(e,t,p,null,r,h)}}for(var m in r){var p=r[m];if(h=n[m],r.hasOwnProperty(m)&&(p!=null||h!=null))switch(m){case"type":i=p;break;case"name":s=p;break;case"checked":u=p;break;case"defaultChecked":d=p;break;case"value":o=p;break;case"defaultValue":a=p;break;case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(nt(137,t));break;default:p!==h&&hs(e,t,m,p,r,h)}}UT(e,o,a,l,u,d,i,s);return;case"select":p=o=a=m=null;for(i in n)if(l=n[i],n.hasOwnProperty(i)&&l!=null)switch(i){case"value":break;case"multiple":p=l;default:r.hasOwnProperty(i)||hs(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":m=i;break;case"defaultValue":a=i;break;case"multiple":o=i;default:i!==l&&hs(e,t,s,i,r,l)}t=a,n=o,r=p,m!=null?R0(e,!!n,m,!1):!!r!=!!n&&(t!=null?R0(e,!!n,t,!0):R0(e,!!n,n?[]:"",!1));return;case"textarea":p=m=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:hs(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":m=s;break;case"defaultValue":p=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(nt(91));break;default:s!==i&&hs(e,t,o,s,r,i)}gH(e,m,p);return;case"option":for(var g in n)if(m=n[g],n.hasOwnProperty(g)&&m!=null&&!r.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:hs(e,t,g,null,r,m)}for(l in r)if(m=r[l],p=n[l],r.hasOwnProperty(l)&&m!==p&&(m!=null||p!=null))switch(l){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:hs(e,t,l,m,r,p)}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 b in n)m=n[b],n.hasOwnProperty(b)&&m!=null&&!r.hasOwnProperty(b)&&hs(e,t,b,null,r,m);for(u in r)if(m=r[u],p=n[u],r.hasOwnProperty(u)&&m!==p&&(m!=null||p!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(nt(137,t));break;default:hs(e,t,u,m,r,p)}return;default:if(RE(t)){for(var x in n)m=n[x],n.hasOwnProperty(x)&&m!==void 0&&!r.hasOwnProperty(x)&&v8(e,t,x,void 0,r,m);for(d in r)m=r[d],p=n[d],!r.hasOwnProperty(d)||m===p||m===void 0&&p===void 0||v8(e,t,d,m,r,p);return}}for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!=null&&!r.hasOwnProperty(v)&&hs(e,t,v,null,r,m);for(h in r)m=r[h],p=n[h],!r.hasOwnProperty(h)||m===p||m==null&&p==null||hs(e,t,h,m,r,p)}function sD(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Hle(){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&&sD(o)){for(o=0,a=s.responseEnd,r+=1;r<n.length;r++){var l=n[r],u=l.startTime;if(u>a)break;var d=l.transferSize,h=l.initiatorType;d&&sD(h)&&(l=l.responseEnd,o+=d*(l<a?1:(a-u)/(l-u)))}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 x8=null,w8=null;function I2(e){return e.nodeType===9?e:e.ownerDocument}function iD(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 kV(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 k8(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 QC=null;function Ule(){var e=window.event;return e&&e.type==="popstate"?e===QC?!1:(QC=e,!0):(QC=null,!1)}var _V=typeof setTimeout=="function"?setTimeout:void 0,Vle=typeof clearTimeout=="function"?clearTimeout:void 0,oD=typeof Promise=="function"?Promise:void 0,Wle=typeof queueMicrotask=="function"?queueMicrotask:typeof oD<"u"?function(e){return oD.resolve(null).then(e).catch(Gle)}:_V;function Gle(e){setTimeout(function(){throw e})}function pf(e){return e==="head"}function aD(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),dg(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Vb(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Vb(n);for(var i=n.firstChild;i;){var o=i.nextSibling,a=i.nodeName;i[kv]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}else n==="body"&&Vb(e.ownerDocument.body);n=s}while(n);dg(t)}function lD(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 _8(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":_8(n),IE(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Kle(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[kv])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=Ll(e.nextSibling),e===null)break}return null}function Yle(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ll(e.nextSibling),e===null))return null;return e}function SV(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ll(e.nextSibling),e===null))return null;return e}function S8(e){return e.data==="$?"||e.data==="$~"}function C8(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Xle(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 Ll(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 T8=null;function cD(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ll(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function uD(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 CV(e,t,n){switch(t=I2(n),e){case"html":if(e=t.documentElement,!e)throw Error(nt(452));return e;case"head":if(e=t.head,!e)throw Error(nt(453));return e;case"body":if(e=t.body,!e)throw Error(nt(454));return e;default:throw Error(nt(451))}}function Vb(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);IE(e)}var Ol=new Map,dD=new Set;function R2(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var md=ts.d;ts.d={f:Qle,r:Jle,D:Zle,C:ece,L:tce,m:nce,X:sce,S:rce,M:ice};function Qle(){var e=md.f(),t=z4();return e||t}function Jle(e){var t=Lg(e);t!==null&&t.tag===5&&t.type==="form"?yU(t):md.r(e)}var $g=typeof document>"u"?null:document;function TV(e,t,n){var r=$g;if(r&&typeof t=="string"&&t){var s=Al(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),dD.has(s)||(dD.add(s),e={rel:e,crossOrigin:n,href:t},r.querySelector(s)===null&&(t=r.createElement("link"),oo(t,"link",e),qi(t),r.head.appendChild(t)))}}function Zle(e){md.D(e),TV("dns-prefetch",e,null)}function ece(e,t){md.C(e,t),TV("preconnect",e,t)}function tce(e,t,n){md.L(e,t,n);var r=$g;if(r&&e&&t){var s='link[rel="preload"][as="'+Al(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Al(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Al(n.imageSizes)+'"]')):s+='[href="'+Al(e)+'"]';var i=s;switch(t){case"style":i=ug(e);break;case"script":i=zg(e)}Ol.has(i)||(e=Ds({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Ol.set(i,e),r.querySelector(s)!==null||t==="style"&&r.querySelector(Ev(i))||t==="script"&&r.querySelector(Mv(i))||(t=r.createElement("link"),oo(t,"link",e),qi(t),r.head.appendChild(t)))}}function nce(e,t){md.m(e,t);var n=$g;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Al(r)+'"][href="'+Al(e)+'"]',i=s;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=zg(e)}if(!Ol.has(i)&&(e=Ds({rel:"modulepreload",href:e},t),Ol.set(i,e),n.querySelector(s)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Mv(i)))return}r=n.createElement("link"),oo(r,"link",e),qi(r),n.head.appendChild(r)}}}function rce(e,t,n){md.S(e,t,n);var r=$g;if(r&&e){var s=I0(r).hoistableStyles,i=ug(e);t=t||"default";var o=s.get(i);if(!o){var a={loading:0,preload:null};if(o=r.querySelector(Ev(i)))a.loading=5;else{e=Ds({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ol.get(i))&&b9(e,n);var l=o=r.createElement("link");qi(l),oo(l,"link",e),l._p=new Promise(function(u,d){l.onload=u,l.onerror=d}),l.addEventListener("load",function(){a.loading|=1}),l.addEventListener("error",function(){a.loading|=2}),a.loading|=4,Sk(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:a},s.set(i,o)}}}function sce(e,t){md.X(e,t);var n=$g;if(n&&e){var r=I0(n).hoistableScripts,s=zg(e),i=r.get(s);i||(i=n.querySelector(Mv(s)),i||(e=Ds({src:e,async:!0},t),(t=Ol.get(s))&&y9(e,t),i=n.createElement("script"),qi(i),oo(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function ice(e,t){md.M(e,t);var n=$g;if(n&&e){var r=I0(n).hoistableScripts,s=zg(e),i=r.get(s);i||(i=n.querySelector(Mv(s)),i||(e=Ds({src:e,async:!0,type:"module"},t),(t=Ol.get(s))&&y9(e,t),i=n.createElement("script"),qi(i),oo(i,"link",e),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(s,i))}}function hD(e,t,n,r){var s=(s=Eh.current)?R2(s):null;if(!s)throw Error(nt(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=ug(n.href),n=I0(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=ug(n.href);var i=I0(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(Ev(e)))&&!i._p&&(o.instance=i,o.state.loading=5),Ol.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},Ol.set(e,n),i||oce(s,e,n,o.state))),t&&r===null)throw Error(nt(528,""));return o}if(t&&r!==null)throw Error(nt(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=zg(n),n=I0(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(nt(444,e))}}function ug(e){return'href="'+Al(e)+'"'}function Ev(e){return'link[rel="stylesheet"]['+e+"]"}function AV(e){return Ds({},e,{"data-precedence":e.precedence,precedence:null})}function oce(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}),oo(t,"link",n),qi(t),e.head.appendChild(t))}function zg(e){return'[src="'+Al(e)+'"]'}function Mv(e){return"script[async]"+e}function fD(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Al(n.href)+'"]');if(r)return t.instance=r,qi(r),r;var s=Ds({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),qi(r),oo(r,"style",s),Sk(r,n.precedence,e),t.instance=r;case"stylesheet":s=ug(n.href);var i=e.querySelector(Ev(s));if(i)return t.state.loading|=4,t.instance=i,qi(i),i;r=AV(n),(s=Ol.get(s))&&b9(r,s),i=(e.ownerDocument||e).createElement("link"),qi(i);var o=i;return o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),oo(i,"link",r),t.state.loading|=4,Sk(i,n.precedence,e),t.instance=i;case"script":return i=zg(n.src),(s=e.querySelector(Mv(i)))?(t.instance=s,qi(s),s):(r=n,(s=Ol.get(i))&&(r=Ds({},n),y9(r,s)),e=e.ownerDocument||e,s=e.createElement("script"),qi(s),oo(s,"link",r),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(nt(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Sk(r,n.precedence,e));return t.instance}function Sk(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 b9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function y9(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ck=null;function mD(e,t,n){if(Ck===null){var r=new Map,s=Ck=new Map;s.set(n,r)}else s=Ck,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[kv]||i[no]||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 pD(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function ace(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 EV(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function lce(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=ug(r.href),i=t.querySelector(Ev(s));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=D2.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=i,qi(i);return}i=t.ownerDocument||t,r=AV(r),(s=Ol.get(s))&&b9(r,s),i=i.createElement("link"),qi(i);var o=i;o._p=new Promise(function(a,l){o.onload=a,o.onerror=l}),oo(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=D2.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var JC=0;function cce(e,t){return e.stylesheets&&e.count===0&&Tk(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Tk(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&JC===0&&(JC=62500*Hle());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Tk(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>JC?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(s)}}:null}function D2(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Tk(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var L2=null;function Tk(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,L2=new Map,t.forEach(uce,e),L2=null,D2.call(e))}function uce(e,t){if(!(t.state.loading&4)){var n=L2.get(e);if(n)var r=n.get(null);else{n=new Map,L2.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=D2.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 My={$$typeof:$u,Provider:null,Consumer:null,_currentValue:Mm,_currentValue2:Mm,_threadCount:0};function dce(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=wC(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wC(0),this.hiddenUpdates=wC(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 MV(e,t,n,r,s,i,o,a,l,u,d,h){return e=new dce(e,t,n,o,l,u,d,h,a),t=1,i===!0&&(t|=24),i=Ua(3,null,null,t),e.current=i,i.stateNode=e,t=UE(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:t},GE(i),e}function NV(e){return e?(e=b0,e):b0}function jV(e,t,n,r,s,i){s=NV(s),r.context===null?r.context=s:r.pendingContext=s,r=Nh(t),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=jh(e,r,t),n!==null&&(ba(n,e,t),Ob(n,e,t))}function gD(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function v9(e,t){gD(e,t),(e=e.alternate)&&gD(e,t)}function IV(e){if(e.tag===13||e.tag===31){var t=cp(e,67108864);t!==null&&ba(t,e,67108864),v9(e,67108864)}}function bD(e){if(e.tag===13||e.tag===31){var t=Ja();t=NE(t);var n=cp(e,t);n!==null&&ba(n,e,t),v9(e,t)}}var P2=!0;function hce(e,t,n,r){var s=qn.T;qn.T=null;var i=ts.p;try{ts.p=2,x9(e,t,n,r)}finally{ts.p=i,qn.T=s}}function fce(e,t,n,r){var s=qn.T;qn.T=null;var i=ts.p;try{ts.p=8,x9(e,t,n,r)}finally{ts.p=i,qn.T=s}}function x9(e,t,n,r){if(P2){var s=A8(r);if(s===null)XC(e,t,r,O2,n),yD(e,r);else if(pce(s,e,t,n,r))r.stopPropagation();else if(yD(e,r),t&4&&-1<mce.indexOf(e)){for(;s!==null;){var i=Lg(s);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var o=sm(i.pendingLanes);if(o!==0){var a=i;for(a.pendingLanes|=2,a.entangledLanes|=2;o;){var l=1<<31-Qa(o);a.entanglements[1]|=l,o&=~l}su(i),!(Zr&6)&&(T2=Ya()+500,Av(0))}}break;case 31:case 13:a=cp(i,2),a!==null&&ba(a,i,2),z4(),v9(i,2)}if(i=A8(r),i===null&&XC(e,t,r,O2,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else XC(e,t,r,null,n)}}function A8(e){return e=DE(e),w9(e)}var O2=null;function w9(e){if(O2=null,e=d0(e),e!==null){var t=yv(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Jq(t),e!==null)return e;e=null}else if(n===31){if(e=Zq(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 O2=e,null}function RV(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(Zoe()){case rH:return 2;case sH:return 8;case h2:case eae:return 32;case iH:return 268435456;default:return 32}default:return 32}}var E8=!1,Dh=null,Lh=null,Ph=null,Ny=new Map,jy=new Map,fh=[],mce="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 yD(e,t){switch(e){case"focusin":case"focusout":Dh=null;break;case"dragenter":case"dragleave":Lh=null;break;case"mouseover":case"mouseout":Ph=null;break;case"pointerover":case"pointerout":Ny.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":jy.delete(t.pointerId)}}function $1(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=Lg(t),t!==null&&IV(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function pce(e,t,n,r,s){switch(t){case"focusin":return Dh=$1(Dh,e,t,n,r,s),!0;case"dragenter":return Lh=$1(Lh,e,t,n,r,s),!0;case"mouseover":return Ph=$1(Ph,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Ny.set(i,$1(Ny.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,jy.set(i,$1(jy.get(i)||null,e,t,n,r,s)),!0}return!1}function DV(e){var t=d0(e.target);if(t!==null){var n=yv(t);if(n!==null){if(t=n.tag,t===13){if(t=Jq(n),t!==null){e.blockedOn=t,nR(e.priority,function(){bD(n)});return}}else if(t===31){if(t=Zq(n),t!==null){e.blockedOn=t,nR(e.priority,function(){bD(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 Ak(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=A8(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);WT=r,n.target.dispatchEvent(r),WT=null}else return t=Lg(n),t!==null&&IV(t),e.blockedOn=n,!1;t.shift()}return!0}function vD(e,t,n){Ak(e)&&n.delete(t)}function gce(){E8=!1,Dh!==null&&Ak(Dh)&&(Dh=null),Lh!==null&&Ak(Lh)&&(Lh=null),Ph!==null&&Ak(Ph)&&(Ph=null),Ny.forEach(vD),jy.forEach(vD)}function Ux(e,t){e.blockedOn===t&&(e.blockedOn=null,E8||(E8=!0,Ni.unstable_scheduleCallback(Ni.unstable_NormalPriority,gce)))}var Vx=null;function xD(e){Vx!==e&&(Vx=e,Ni.unstable_scheduleCallback(Ni.unstable_NormalPriority,function(){Vx===e&&(Vx=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(w9(r||n)===null)continue;break}var i=Lg(n);i!==null&&(e.splice(t,3),t-=3,l8(i,{pending:!0,data:s,method:n.method,action:r},r,s))}}))}function dg(e){function t(l){return Ux(l,e)}Dh!==null&&Ux(Dh,e),Lh!==null&&Ux(Lh,e),Ph!==null&&Ux(Ph,e),Ny.forEach(t),jy.forEach(t);for(var n=0;n<fh.length;n++){var r=fh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<fh.length&&(n=fh[0],n.blockedOn===null);)DV(n),n.blockedOn===null&&fh.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[xa]||null;if(typeof i=="function")o||xD(n);else if(o){var a=null;if(i&&i.hasAttribute("formAction")){if(s=i,o=i[xa]||null)a=o.formAction;else if(w9(s)!==null)continue}else a=o.action;typeof a=="function"?n[r+1]=a:(n.splice(r,3),r-=3),xD(n)}}}function LV(){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 k9(e){this._internalRoot=e}H4.prototype.render=k9.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(nt(409));var n=t.current,r=Ja();jV(n,r,e,t,null,null)};H4.prototype.unmount=k9.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;jV(e.current,2,null,e,null,null),z4(),t[Dg]=null}};function H4(e){this._internalRoot=e}H4.prototype.unstable_scheduleHydration=function(e){if(e){var t=uH();e={blockedOn:null,target:e,priority:t};for(var n=0;n<fh.length&&t!==0&&t<fh[n].priority;n++);fh.splice(n,0,e),n===0&&DV(e)}};var wD=Xq.version;if(wD!=="19.2.4")throw Error(nt(527,wD,"19.2.4"));ts.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(nt(188)):(e=Object.keys(e).join(","),Error(nt(268,e)));return e=Woe(t),e=e!==null?eH(e):null,e=e===null?null:e.stateNode,e};var bce={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:qn,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wx=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wx.isDisabled&&Wx.supportsFiber)try{vv=Wx.inject(bce),Xa=Wx}catch{}}T4.createRoot=function(e,t){if(!Qq(e))throw Error(nt(299));var n=!1,r="",s=TU,i=AU,o=EU;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=MV(e,1,!1,null,null,n,r,null,s,i,o,LV),e[Dg]=t.current,g9(e),new k9(t)};T4.hydrateRoot=function(e,t,n){if(!Qq(e))throw Error(nt(299));var r=!1,s="",i=TU,o=AU,a=EU,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=MV(e,1,!0,t,n??null,r,s,l,i,o,a,LV),t.context=NV(null),n=t.current,r=Ja(),r=NE(r),s=Nh(r),s.callback=null,jh(n,s,r),n=r,t.current.lanes=n,wv(t,n),su(t),e[Dg]=t.current,g9(e),new H4(t)};T4.version="19.2.4";function PV(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PV)}catch(e){console.error(e)}}PV(),Uq.exports=T4;var M8=Uq.exports;const yce=_4(M8);/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const vce="agent";function xce(e){return e===vce}var wce=3e4,kce=new Set(["authorized","expired","error","cancelled"]),_ce=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 Sce(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 Sce(e,t,n,r){return await Cce(e,t,n,r)}async function kD(e,t,n,r){try{return await e.getDeviceFlow(t.deviceFlowId,{clientId:n,signal:r})}catch(s){if(s instanceof ec&&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 _D(e,t={}){if(e!==void 0&&Number.isFinite(e)&&!(t.allowZero?e<0:e<=0))return e}async function Cce(e,t,n,r){var d;let s=r.signal,i=_D(r.timeoutMs,{allowZero:!0}),o=_D(r.pollOverrideMs),a=i!==void 0?Date.now()+i:t.expiresAt+wce,l=Math.max(1e3,o??t.intervalMs??5e3),u=l;for(;;){if(s!=null&&s.aborted)throw N8(s);if(Date.now()>=a)return await kD(e,t,n,s);let h=await kD(e,t,n,s);if(h.intervalMs&&h.intervalMs!==u&&(u=h.intervalMs,l=h.intervalMs,(d=r.onThrottled)==null||d.call(r,h.intervalMs)),kce.has(h.status))return h;await Tce(l,s)}}async function Tce(e,t){if(t!=null&&t.aborted)throw N8(t);await new Promise((n,r)=>{let s=setTimeout(()=>{o(),n()},e),i=()=>{o(),r(N8(t))};function o(){clearTimeout(s),t==null||t.removeEventListener("abort",i)}t&&t.addEventListener("abort",i,{once:!0})})}function N8(e){let t=e==null?void 0:e.reason;return t instanceof Error?t:typeof t=="string"?new Error(t):new Error("aborted")}var ec=class extends Error{constructor(t,n,r){super(r);Me(this,"status");Me(this,"body");this.name="DaemonHttpError",this.status=t,this.body=n}},SD=class extends Error{constructor(e){super(e??"Transport connection closed"),this.name="DaemonTransportClosedError"}},Ace=class extends Error{constructor(e){super(e),this.name="SseFramingError"}},CD=16*1024*1024;async function*OV(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(u){if(t!=null&&t.aborted)return;throw u}if(a){if(s+=r.decode(),s.length>0){let u=TD(s);for(let d of u.frames){let h=ZC(d);h&&(yield h)}if(u.tail.length>0){let d=ZC(u.tail);d&&(yield d)}}return}if(s+=r.decode(o,{stream:!0}),s.length>CD)throw new Ace(`parseSseStream: unread buffer exceeded ${CD} UTF-16 code units without a frame separator — upstream likely not SSE`);let l=TD(s);if(l.frames.length>0)for(let u of l.frames){let d=ZC(u);d&&(yield d)}s=l.tail}}finally{t&&i&&t.removeEventListener("abort",i);try{await n.cancel()}catch{}}}function TD(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 ZC(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 Ece=class{constructor(e,t,n){Me(this,"baseUrl");Me(this,"token");Me(this,"_fetch");Me(this,"_disposed",!1);Me(this,"type","rest");Me(this,"supportsReplay",!0);Me(this,"restFetch");this.baseUrl=e,this.token=t,this._fetch=n,this.restFetch=n}get connected(){return!this._disposed}async fetch(e,t,n){if(this._disposed)throw new SD;return this._fetch(e,t)}async*subscribeEvents(e,t={}){var d;if(this._disposed)throw new SD;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?Mce([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 h;try{let p=await l.text();try{h=JSON.parse(p)}catch{h=p}}catch{}let m=h&&typeof h=="object"&&"error"in h?String(h.error):`HTTP ${l.status}`;throw new ec(l.status,h,`GET /session/:id/events: ${m}`)}let u=l.headers.get("content-type")??"";if(!u.toLowerCase().includes("text/event-stream")){try{await((d=l.body)==null?void 0:d.cancel())}catch{}throw new ec(l.status,u,`GET /session/:id/events: expected content-type text/event-stream, got "${u}"`)}if(!l.body)throw new Error("No SSE body");yield*OV(l.body,t.signal)}dispose(){this._disposed=!0}};function Mce(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 Nce=class extends Error{constructor(t,n){super(`DaemonCapabilities.${t} is missing — ${n}. The daemon you are connected to likely predates the feature that added this field; upgrade the daemon or fall back to a different code path that doesn't require it.`);Me(this,"capability");this.name="DaemonCapabilityMissingError",this.capability=t}},jce=["missing_binary","blocked_egress","auth_env_error","init_timeout","protocol_error","missing_file","parse_error","budget_exhausted","mcp_budget_would_exceed","mcp_server_spawn_failed","invalid_config","prompt_deadline_exceeded","writer_idle_timeout","model_stream_interrupted"],U4=["plan","default","auto-edit","auto","yolo"],Gx="/workspace/memory/remember",Kx="/workspace/memory/forget",Yx="/workspace/memory/dream";function Ice(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(t.v!==1||typeof t.type!="string")return;let n=t.requestId,r=t.modelSource,s=typeof n=="string"&&n.length>0,i=r==="fast"||r==="main",o=a=>a===void 0||typeof a=="number"&&Number.isSafeInteger(a)&&a>=0;if(t.type==="started"){if(!s||typeof t.model!="string"||!i)return}else if(t.type==="thinking"){if(!s)return}else if(t.type==="delta"){if(!s||!Number.isSafeInteger(t.seq)||t.seq<0||typeof t.text!="string"||t.text.length===0)return}else if(t.type==="done"){if(!s||typeof t.model!="string"||!i||!o(t.inputTokens)||!o(t.outputTokens))return}else if(t.type==="error"){if(typeof t.code!="string"||typeof t.message!="string")return}else return;return t}var B2=20,Rce=3e4,Dce=65e3,Lce=9e4,AD=2147483647,Pce=5,r0=33e4,Oce="X-Qwen-Client-Id",ut=encodeURIComponent;function ED(e){let t=e.trim();if(!t)throw new Error("rule must be a non-empty string");return t}function BV(e){if(e===void 0)return Pce;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 Bce(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function $ce(){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 MD=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 $V(e){return typeof e=="object"&&e!==null&&e._daemonTurnError===!0}var j8=class{constructor(e){Me(this,"baseUrl");Me(this,"token");Me(this,"_fetch");Me(this,"fetchTimeoutMs");Me(this,"promptLimit");Me(this,"promptCounts",Object.create(null));Me(this,"transport");Me(this,"_authFlow");var n;this.baseUrl=Bce(e.baseUrl),this.token=e.token??$ce(),this._fetch=e.fetch??((n=e.transport)==null?void 0:n.restFetch)??globalThis.fetch.bind(globalThis);let t=e.fetchTimeoutMs??Rce;this.fetchTimeoutMs=Number.isFinite(t)&&t>0?t:0,this.promptLimit=BV(e.maxPendingPromptsPerSession),this.transport=e.transport??new Ece(this.baseUrl,this.token,this._fetch)}get auth(){return this._authFlow||(this._authFlow=new _ce(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 MD(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 d=s==="rest"?await this._fetch(e,t):await this.transport.fetch(e,t);return n?n(d):d}let o=new AbortController,a=setTimeout(()=>{o.abort(new DOMException("timeout","TimeoutError"))},i);typeof a=="object"&&a&&"unref"in a&&a.unref();let l=t.signal??void 0,u=l?e5([l,o.signal]):o.signal;try{let d=s==="rest"?await this._fetch(e,{...t,signal:u}):await this.transport.fetch(e,{...t,signal:u});return n?await n(d):d}finally{clearTimeout(a)}}headers(e={},t){let n={...e};return this.token&&(n.Authorization=`Bearer ${this.token}`),t&&(n[Oce]=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 MD(typeof i.sessionId=="string"?i.sessionId:n,typeof i.limit=="number"?i.limit:0,typeof i.pendingCount=="number"?i.pendingCount:0)}return new ec(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)}:{},...n.signal?{signal:n.signal}:{}},async s=>{if(!s.ok)throw await this.failOnError(s,t);return await s.json()},n.timeoutMs,n.mode)}async workspaceJsonRequest(e,t,n,r={}){return await this.jsonRequest(`/workspaces/${e}${t}`,n,r)}async sessionExportRequest(e,t,n={}){let r=n.format??"html",s=n.format?`?format=${ut(n.format)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${s}`,{headers:this.headers({},n.clientId)},async i=>{var u;if(!i.ok)throw await this.failOnError(i,t);let o=await i.text(),a=i.headers.get("content-type")??"",l=((u=/filename="([^"]+)"/i.exec(i.headers.get("content-disposition")??""))==null?void 0:u[1])??`export.${r}`;return{content:o,filename:l,mimeType:a,format:r}},void 0,"rest")}async workspaceNoContentRequest(e,t,n,r={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces/${e}${t}`,{...r.method?{method:r.method}:{},headers:this.headers({},r.clientId)},async s=>{var i,o;if(s.status===204){try{await((i=s.body)==null?void 0:i.cancel())}catch{}return}if(s.status===404&&r.okNotFoundCode){let a=await this.failOnError(s,n);if(((o=a.body)==null?void 0:o.code)===r.okNotFoundCode)return;throw a}throw await this.failOnError(s,n)},r.timeoutMs)}workspaceById(e){return new ND(this,ut(e))}workspaceByCwd(e){return new ND(this,ut(e))}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 requireCapability(e){if(!(await this.capabilities()).features.includes(e))throw new Nce(e,`daemon does not advertise the ${e} feature`)}async daemonStatus(e="summary"){let t=e==="summary"?"":`?detail=${e}`;return await this.jsonRequest(`/daemon/status${t}`,"GET /daemon/status")}async usageDashboard(e={}){let t=new URLSearchParams;e.range!==void 0&&t.set("range",e.range),e.heatmapDays!==void 0&&t.set("heatmapDays",String(e.heatmapDays));let n=t.toString();return await this.jsonRequest(`/usage/dashboard${n?`?${n}`:""}`,"GET /usage/dashboard")}async workspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/mcp");return await e.json()})}async initializeWorkspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/initialize`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:"{}"},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/mcp/initialize");return await e.json()})}async reloadWorkspaceMcp(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/reload`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:"{}"},async e=>{if(!e.ok)throw await this.failOnError(e,"POST /workspace/mcp/reload");return await e.json()})}async workspaceGit(){return await this.jsonRequest("/workspace/git","GET /workspace/git",{mode:"rest"})}async workspaceMcpTools(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${ut(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/${ut(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 workspaceAcpPreheat(e){let t=e??5e3,n=e!==void 0?`?timeoutMs=${encodeURIComponent(e)}`:"";return await this.fetchWithTimeout(`${this.baseUrl}/workspace/acp/preheat${n}`,{method:"POST",headers:this.headers()},async r=>{if(!r.ok)throw await this.failOnError(r,"POST /workspace/acp/preheat");return await r.json()},t+2e3)}async workspaceAcpStatus(){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/acp/status`,{headers:this.headers()},async e=>{if(!e.ok)throw await this.failOnError(e,"GET /workspace/acp/status");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/${ut(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",{mode:"rest"})}async installExtension(e,t){return await this.jsonRequest("/workspace/extensions/install","POST /workspace/extensions/install",{method:"POST",body:e,clientId:t,mode:"rest"})}async extensionOperationStatus(e){return await this.jsonRequest(`/workspace/extensions/operations/${ut(e)}`,"GET /workspace/extensions/operations/:operationId",{mode:"rest"})}async activeExtensionOperations(){return await this.jsonRequest("/workspace/extensions/operations","GET /workspace/extensions/operations",{mode:"rest"})}async respondToExtensionInteraction(e,t,n,r){return await this.jsonRequest(`/workspace/extensions/operations/${ut(e)}/interactions/${ut(t)}`,"POST /workspace/extensions/operations/:operationId/interactions/:interactionId",{method:"POST",body:n,clientId:r,mode:"rest"})}async checkExtensionUpdates(e){return await this.jsonRequest("/workspace/extensions/check-updates","POST /workspace/extensions/check-updates",{method:"POST",body:{},clientId:e,mode:"rest"})}async refreshExtensions(e){return await this.jsonRequest("/workspace/extensions/refresh","POST /workspace/extensions/refresh",{method:"POST",body:{},clientId:e,mode:"rest"})}async enableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${ut(e)}/enable`,"POST /workspace/extensions/:name/enable",{method:"POST",body:t,clientId:n,mode:"rest"})}async disableExtension(e,t,n){return await this.jsonRequest(`/workspace/extensions/${ut(e)}/disable`,"POST /workspace/extensions/:name/disable",{method:"POST",body:t,clientId:n,mode:"rest"})}async updateExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${ut(e)}/update`,"POST /workspace/extensions/:name/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallExtension(e,t){return await this.jsonRequest(`/workspace/extensions/${ut(e)}`,"DELETE /workspace/extensions/:name",{method:"DELETE",clientId:t,mode:"rest"})}async extensionCatalog(){return await this.jsonRequest("/extensions","GET /extensions",{mode:"rest"})}async installUserExtension(e,t){return await this.jsonRequest("/extensions/install","POST /extensions/install",{method:"POST",body:e,clientId:t,mode:"rest"})}async checkUserExtensionUpdates(e){return await this.jsonRequest("/extensions/check-updates","POST /extensions/check-updates",{method:"POST",body:{},clientId:e,mode:"rest"})}async updateUserExtension(e,t){return await this.jsonRequest(`/extensions/${ut(e)}/update`,"POST /extensions/:extensionId/update",{method:"POST",body:{},clientId:t,mode:"rest"})}async uninstallUserExtension(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/extensions/${ut(e)}`,{method:"DELETE",headers:this.headers({},t)},async n=>{var r;if(n.status===204){await((r=n.body)==null?void 0:r.cancel().catch(()=>{}));return}if(!n.ok)throw await this.failOnError(n,"DELETE /extensions/:extensionId");return await n.json()},void 0,"rest")}async setExtensionDefaultActivation(e,t,n){return await this.jsonRequest(`/extensions/${ut(e)}/activation`,"PUT /extensions/:extensionId/activation",{method:"PUT",body:{state:t},clientId:n,mode:"rest"})}async extensionOperation(e,t){return await this.jsonRequest(`/extensions/operations/${ut(e)}`,"GET /extensions/operations/:operationId",t?{signal:t,mode:"rest"}:{mode:"rest"})}async waitForExtensionOperation(e,t={}){var a;let n=t.pollIntervalMs??1e3,r=t.timeoutMs??10*6e4,s=r!==Number.POSITIVE_INFINITY,i=Date.now()+r,o=()=>new Error(`Timed out waiting for extension operation ${e.operationId}. The server operation was not cancelled.`);for(;;){(a=t.signal)==null||a.throwIfAborted();let l=i-Date.now();if(l<=0||Number.isNaN(l))throw o();let u;if(!s)u=await this.extensionOperation(e.operationId,t.signal);else{let h=new AbortController,m=t.signal?e5([t.signal,h.signal]):h.signal,p,g=new Promise((b,x)=>{let v=()=>{let w=o();x(w),h.abort(w)},y=()=>{let w=i-Date.now();if(w<=0){v();return}p=setTimeout(()=>{Date.now()>=i?v():y()},Math.min(w,AD))};y()});try{u=await Promise.race([this.extensionOperation(e.operationId,m),g])}finally{p!==void 0&&clearTimeout(p),h.abort()}}if(u.status!=="queued"&&u.status!=="running")return u;let d=i-Date.now();if(d<=0)throw o();await new Promise((h,m)=>{var b,x;let p=setTimeout(()=>{var v;(v=t.signal)==null||v.removeEventListener("abort",g),h()},Math.min(n,d,AD)),g=()=>{var v,y;clearTimeout(p),(v=t.signal)==null||v.removeEventListener("abort",g),m(((y=t.signal)==null?void 0:y.reason)??new DOMException("Aborted","AbortError"))};(b=t.signal)==null||b.addEventListener("abort",g,{once:!0}),(x=t.signal)!=null&&x.aborted&&g()})}}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(Gx,`POST ${Gx}`,{method:"POST",body:{content:e,contextMode:t.contextMode??"workspace"},clientId:t.clientId})}async getWorkspaceMemoryRememberTask(e,t){return await this.jsonRequest(`${Gx}/${ut(e)}`,`GET ${Gx}/:taskId`,{clientId:t==null?void 0:t.clientId})}async forgetWorkspaceMemory(e,t={}){return await this.jsonRequest(Kx,`POST ${Kx}`,{method:"POST",body:{query:e},clientId:t.clientId})}async getWorkspaceMemoryForgetTask(e,t){return await this.jsonRequest(`${Kx}/${ut(e)}`,`GET ${Kx}/:taskId`,{clientId:t==null?void 0:t.clientId})}async dreamWorkspaceMemory(e={}){return await this.jsonRequest(Yx,`POST ${Yx}`,{method:"POST",body:{},clientId:e.clientId})}async getWorkspaceMemoryDreamTask(e,t){return await this.jsonRequest(`${Yx}/${ut(e)}`,`GET ${Yx}/: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()},r0)}async getWorkspaceAgent(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/agents/${ut(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/${ut(e)}?scope=${ut(n.scope)}`:`${this.baseUrl}/workspace/agents/${ut(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/${ut(e)}?scope=${ut(t.scope)}`:`${this.baseUrl}/workspace/agents/${ut(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(e.sourceType!==void 0||e.sourceId!==void 0)&&await this.requireCapability("session_source_metadata"),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}:{},...e.approvalMode!==void 0?{approvalMode:e.approvalMode}:{},...e.sourceType!==void 0?{sourceType:e.sourceType}:{},...e.sourceId!==void 0?{sourceId:e.sourceId}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /session");return await n.json()})}async listWorkspaceSessions(e,t){return(await this.listWorkspaceSessionsPage(e,t)).sessions}async listWorkspaceSessionsPage(e,t){((t==null?void 0:t.sourceType)!==void 0||(t==null?void 0:t.sourceId)!==void 0)&&await this.requireCapability("session_source_metadata");let n=(t==null?void 0:t.pageSize)??B2,r=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:B2))),s=new URLSearchParams({size:String(r)});return(t==null?void 0:t.cursor)!==void 0&&s.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&s.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&s.set("view",t.view),(t==null?void 0:t.group)!==void 0&&s.set("group",t.group),(t==null?void 0:t.parentSessionId)!==void 0&&s.set("parentSessionId",t.parentSessionId),(t==null?void 0:t.sourceType)!==void 0&&s.set("sourceType",t.sourceType),(t==null?void 0:t.sourceId)!==void 0&&s.set("sourceId",t.sourceId),await this.jsonRequest(`/workspace/${ut(e)}/sessions?${s.toString()}`,"GET /workspace/sessions")}async listSessionGroups(e){return await this.jsonRequest(`/workspace/${ut(e)}/session-groups`,"GET /workspace/session-groups")}async createSessionGroup(e,t){return(await this.jsonRequest(`/workspace/${ut(e)}/session-groups`,"POST /workspace/session-groups",{method:"POST",body:t})).group}async updateSessionGroup(e,t,n){return(await this.jsonRequest(`/workspace/${ut(e)}/session-groups/${ut(t)}`,"PATCH /workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}async deleteSessionGroup(e,t){return await this.jsonRequest(`/workspace/${ut(e)}/session-groups/${ut(t)}`,"DELETE /workspace/session-groups/:groupId",{method:"DELETE"})}async updateSessionOrganization(e,t,n){return await this.jsonRequest(`/session/${ut(e)}/organization`,"PATCH /session/:id/organization",{method:"PATCH",body:t,clientId:n})}async loadSession(e,t={},n){return this.restoreSession("load",e,t,n)}async exportSession(e,t={}){return await this.sessionExportRequest(`/session/${ut(e)}/export`,"GET /session/:id/export",t)}async getSessionTranscriptPage(e,t={}){let n=new URLSearchParams;t.cursor!==void 0&&n.set("cursor",t.cursor),t.limit!==void 0&&n.set("limit",String(t.limit));let r=n.toString();return await this.jsonRequest(`/session/${ut(e)}/transcript${r?`?${r}`:""}`,"GET /session/:id/transcript",{clientId:t.clientId,mode:"rest"})}async resumeSession(e,t={},n){return this.restoreSession("resume",e,t,n)}async branchSession(e,t={},n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ut(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/${ut(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/${ut(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 sessionStatus(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ut(e)}/status`,{headers:this.headers({},t)},async n=>{if(!n.ok)throw await this.failOnError(n,"GET /session/:id/status");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/${ut(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/${ut(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/${ut(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/${ut(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/${ut(e)}/tasks/${ut(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/${ut(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/${ut(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/${ut(t)}/${e}`,{method:"POST",headers:this.headers({"Content-Type":"application/json"},r),body:JSON.stringify({cwd:n.workspaceCwd,...n.approvalMode!==void 0?{approvalMode:n.approvalMode}:{}})},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/${ut(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/${ut(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()},void 0,"rest")}async rewindSession(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ut(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()},void 0,"rest")}async recapSession(e,t){let n=await this.transport.fetch(`${this.baseUrl}/session/${ut(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*generateSessionContent(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${ut(e)}/generate`,{method:"POST",headers:this.headers({"Content-Type":"application/json",Accept:"text/event-stream"},n==null?void 0:n.clientId),body:JSON.stringify({prompt:t}),signal:n==null?void 0:n.signal});if(!r.ok)throw await this.failOnError(r,"POST /session/:id/generate");if(!r.body)throw new Error("Generation response body is missing");for await(let s of OV(r.body,n==null?void 0:n.signal)){let i=Ice(s);i&&(yield i)}}async btwSession(e,t,n){let r=await this.transport.fetch(`${this.baseUrl}/session/${ut(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/${ut(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/${ut(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/${ut(e)}/pending-prompts/${ut(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/${ut(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/${ut(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 setWorkspaceSkillEnabled(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/skills/${ut(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/skills/: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,...r!=null&&r.mcpServerMutation?{mcpServerMutation:r.mcpServerMutation}:{}})},async s=>{if(!s.ok)throw await this.failOnError(s,"POST /workspace/settings");return await s.json()})}async deleteModel(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/models`,{method:"DELETE",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,"DELETE /workspace/models");return await n.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){return await this.voiceTranscriptionRequest("/workspace/voice/transcribe","POST /workspace/voice/transcribe",e,t)}async workspaceVoiceTranscriptionRequest(e,t,n){return await this.voiceTranscriptionRequest(`/workspaces/${e}/voice/transcribe`,"POST /workspaces/:workspace/voice/transcribe",t,n)}async voiceTranscriptionRequest(e,t,n,r){let s=r.voiceModel?`?${new URLSearchParams({voiceModel:r.voiceModel}).toString()}`:"";return await this.fetchWithTimeout(`${this.baseUrl}${e}${s}`,{method:"POST",headers:this.headers({"Content-Type":r.mimeType},r.clientId),body:n},async i=>{if(!i.ok)throw await this.failOnError(i,t);return await i.json()},r.timeoutMs??Dce,"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=ED(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=ED(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=${ut(String(t.entryIndex))}`;return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${ut(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)??r0)}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 reloadChannelWorker(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel/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/channel/reload");return await t.json()},(e==null?void 0:e.timeoutMs)??213e4)}async getChannelWorkerControl(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"GET",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"GET /workspace/channel");return await t.json()},e==null?void 0:e.timeoutMs)}async setChannelWorkerSelection(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"PUT",headers:this.headers({"Content-Type":"application/json"},t==null?void 0:t.clientId),body:JSON.stringify({selection:e})},async n=>{if(!n.ok)throw await this.failOnError(n,"PUT /workspace/channel");return await n.json()},(t==null?void 0:t.timeoutMs)??213e4)}async stopChannelWorker(e){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/channel`,{method:"DELETE",headers:this.headers({},e==null?void 0:e.clientId)},async t=>{if(!t.ok)throw await this.failOnError(t,"DELETE /workspace/channel");return await t.json()},(e==null?void 0:e.timeoutMs)??213e4)}async manageMcpServer(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/${ut(e)}/${ut(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)??r0)}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)??r0)}async removeRuntimeMcpServer(e,t){return await this.fetchWithTimeout(`${this.baseUrl}/workspace/mcp/servers/${ut(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)??r0)}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:Lce})}async setSessionModel(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ut(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/${ut(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/${ut(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/${ut(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?e5([r,i.signal]):i.signal;try{let a=this.subscribeEvents(e,{lastEventId:n,signal:o});for await(let l of a){let u=_9(l,t);if(u!==void 0)return u}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/${ut(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/${ut(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/${ut(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/${ut(e)}/permission/${ut(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/${ut(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/${ut(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/${ut(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/${ut(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()})}async addWorkspace(e,t={}){return await this.fetchWithTimeout(`${this.baseUrl}/workspaces`,{method:"POST",headers:this.headers({"Content-Type":"application/json"}),body:JSON.stringify({cwd:e,...t.persist?{persist:!0}:{}})},async n=>{if(!n.ok)throw await this.failOnError(n,"POST /workspaces");return await n.json()})}dispose(){this.transport.dispose()}async listSessionArtifacts(e,t){return await this.jsonRequest(`/session/${ut(e)}/artifacts`,"GET /session/:id/artifacts",{clientId:t})}async addSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${ut(e)}/artifacts`,"POST /session/:id/artifacts",{method:"POST",body:t,clientId:n})}async removeSessionArtifact(e,t,n){return await this.jsonRequest(`/session/${ut(e)}/artifacts/${ut(t)}`,"DELETE /session/:id/artifacts/:artifactId",{method:"DELETE",clientId:n})}async updateSessionMetadata(e,t,n){return await this.fetchWithTimeout(`${this.baseUrl}/session/${ut(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")})}},ND=class{constructor(t,n){this.client=t,this.workspaceSelector=n}workspaceMcp(){return this.get("/mcp","GET /workspaces/:workspace/mcp")}initializeWorkspaceMcp(){return this.post("/mcp/initialize","POST /workspaces/:workspace/mcp/initialize",{})}reloadWorkspaceMcp(){return this.post("/mcp/reload","POST /workspaces/:workspace/mcp/reload",{})}workspaceVoice(t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","GET /workspaces/:workspace/voice",{clientId:t,mode:"rest"})}setWorkspaceVoice(t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,"/voice","POST /workspaces/:workspace/voice",{method:"POST",body:t,clientId:n,mode:"rest"})}transcribeWorkspaceVoice(t,n){return this.client.workspaceVoiceTranscriptionRequest(this.workspaceSelector,t,n)}workspaceGit(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/git","GET /workspaces/:workspace/git",{mode:"rest"})}workspaceSkills(){return this.get("/skills","GET /workspaces/:workspace/skills")}workspaceProviders(){return this.get("/providers","GET /workspaces/:workspace/providers")}workspaceHooks(){return this.get("/hooks","GET /workspaces/:workspace/hooks")}workspaceEnv(){return this.get("/env","GET /workspaces/:workspace/env")}workspacePreflight(){return this.get("/preflight","GET /workspaces/:workspace/preflight")}workspaceTools(){return this.get("/tools","GET /workspaces/:workspace/tools")}workspaceMemory(){return this.get("/memory","GET /workspaces/:workspace/memory")}remove(t){let n=(t==null?void 0:t.force)===void 0?void 0:{force:t.force};return this.client.workspaceJsonRequest(this.workspaceSelector,"","DELETE /workspaces/:workspace",{method:"DELETE",...n?{body:n}:{},...(t==null?void 0:t.timeoutMs)!==void 0?{timeoutMs:t.timeoutMs}:{},mode:"rest"})}writeWorkspaceMemory(t,n){return this.post("/memory","POST /workspaces/:workspace/memory",{...t,scope:"workspace"},n)}listWorkspaceAgents(){return this.get("/agents","GET /workspaces/:workspace/agents")}createWorkspaceAgent(t,n){return this.post("/agents","POST /workspaces/:workspace/agents",{...t,scope:t.scope??"workspace"},n)}getWorkspaceAgent(t){return this.get(`/agents/${ut(t)}`,"GET /workspaces/:workspace/agents/:agentType")}updateWorkspaceAgent(t,n,r={}){let s=r.scope?`?scope=${ut(r.scope)}`:"";return this.post(`/agents/${ut(t)}${s}`,"POST /workspaces/:workspace/agents/:agentType",n,r.clientId)}async deleteWorkspaceAgent(t,n={}){let r=n.scope?`?scope=${ut(n.scope)}`:"";return await this.client.workspaceNoContentRequest(this.workspaceSelector,`/agents/${ut(t)}${r}`,"DELETE /workspaces/:workspace/agents/:agentType",{method:"DELETE",clientId:n.clientId,okNotFoundCode:"agent_not_found"})}async listWorkspaceSessionsPage(t){((t==null?void 0:t.sourceType)!==void 0||(t==null?void 0:t.sourceId)!==void 0)&&await this.client.requireCapability("session_source_metadata");let n=(t==null?void 0:t.pageSize)??B2,r=Math.max(1,Math.min(1e3,Math.round(Number.isFinite(n)?n:B2))),s=new URLSearchParams({size:String(r)});return(t==null?void 0:t.cursor)!==void 0&&s.set("cursor",t.cursor),(t==null?void 0:t.archiveState)!==void 0&&s.set("archiveState",t.archiveState),(t==null?void 0:t.view)!==void 0&&s.set("view",t.view),(t==null?void 0:t.group)!==void 0&&s.set("group",t.group),(t==null?void 0:t.parentSessionId)!==void 0&&s.set("parentSessionId",t.parentSessionId),(t==null?void 0:t.sourceType)!==void 0&&s.set("sourceType",t.sourceType),(t==null?void 0:t.sourceId)!==void 0&&s.set("sourceId",t.sourceId),await this.get(`/sessions?${s.toString()}`,"GET /workspaces/:workspace/sessions")}async listWorkspaceSessions(t){return(await this.listWorkspaceSessionsPage(t)).sessions}getSessionTranscriptPage(t,n={}){let r=new URLSearchParams;n.cursor!==void 0&&r.set("cursor",n.cursor),n.limit!==void 0&&r.set("limit",String(n.limit));let s=r.size>0?`?${r.toString()}`:"";return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${ut(t)}/transcript${s}`,"GET /workspaces/:workspace/session/:id/transcript",{clientId:n.clientId,mode:"rest"})}exportSession(t,n={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${ut(t)}/export`,"GET /workspaces/:workspace/session/:id/export",n)}exportArchivedSession(t,n={}){return this.client.sessionExportRequest(`/workspaces/${this.workspaceSelector}/session/${ut(t)}/archive/export`,"GET /workspaces/:workspace/session/:id/archive/export",n)}listSessionGroups(){return this.get("/session-groups","GET /workspaces/:workspace/session-groups")}async createSessionGroup(t){return(await this.post("/session-groups","POST /workspaces/:workspace/session-groups",t)).group}async updateSessionGroup(t,n){return(await this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${ut(t)}`,"PATCH /workspaces/:workspace/session-groups/:groupId",{method:"PATCH",body:n})).group}deleteSessionGroup(t){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session-groups/${ut(t)}`,"DELETE /workspaces/:workspace/session-groups/:groupId",{method:"DELETE"})}updateSessionOrganization(t,n,r){return this.client.workspaceJsonRequest(this.workspaceSelector,`/session/${ut(t)}/organization`,"PATCH /workspaces/:workspace/session/:id/organization",{method:"PATCH",body:n,clientId:r})}deleteSessionsData(t,n){return this.post("/sessions/delete","POST /workspaces/:workspace/sessions/delete",{sessionIds:t},n)}archiveSessionsData(t,n){return this.post("/sessions/archive","POST /workspaces/:workspace/sessions/archive",{sessionIds:t},n)}unarchiveSessionsData(t,n){return this.post("/sessions/unarchive","POST /workspaces/:workspace/sessions/unarchive",{sessionIds:t},n)}readWorkspaceFile(t,n={},r){let s=new URLSearchParams({path:t});return n.maxBytes!==void 0&&s.set("maxBytes",String(n.maxBytes)),n.line!==void 0&&s.set("line",String(n.line)),n.limit!==void 0&&s.set("limit",String(n.limit)),this.get(`/file?${s.toString()}`,"GET /workspaces/:workspace/file",r)}readWorkspaceFileBytes(t,n={},r){let s=new URLSearchParams({path:t});return n.offset!==void 0&&s.set("offset",String(n.offset)),n.maxBytes!==void 0&&s.set("maxBytes",String(n.maxBytes)),this.get(`/file/bytes?${s.toString()}`,"GET /workspaces/:workspace/file/bytes",r)}fileStat(t){let n=new URLSearchParams({path:t});return this.get(`/stat?${n.toString()}`,"GET /workspaces/:workspace/stat")}dirList(t){let n=new URLSearchParams({path:t});return this.get(`/list?${n.toString()}`,"GET /workspaces/:workspace/list")}glob(t,n={}){let r=new URLSearchParams({pattern:t});return n.maxResults!==void 0&&r.set("maxResults",String(n.maxResults)),this.client.workspaceJsonRequest(this.workspaceSelector,`/glob?${r.toString()}`,"GET /workspaces/:workspace/glob",{signal:n.signal})}writeWorkspaceFile(t,n){return this.post("/file/write","POST /workspaces/:workspace/file/write",t,n)}editWorkspaceFile(t,n){return this.post("/file/edit","POST /workspaces/:workspace/file/edit",t,n)}workspaceSettings(t){return this.get("/settings","GET /workspaces/:workspace/settings",t==null?void 0:t.clientId)}setWorkspaceSetting(t,n,r,s){return this.post("/settings","POST /workspaces/:workspace/settings",{scope:t,key:n,value:r,...s!=null&&s.mcpServerMutation?{mcpServerMutation:s.mcpServerMutation}:{}},s==null?void 0:s.clientId)}workspaceTrust(t){return this.get("/trust","GET /workspaces/:workspace/trust",t==null?void 0:t.clientId)}requestWorkspaceTrustChange(t,n){return this.post("/trust/request","POST /workspaces/:workspace/trust/request",t,n)}workspacePermissions(t){return this.get("/permissions","GET /workspaces/:workspace/permissions",t==null?void 0:t.clientId)}setWorkspacePermissionRules(t,n,r){return this.post("/permissions","POST /workspaces/:workspace/permissions",{scope:"workspace",ruleType:t,rules:[...n]},r==null?void 0:r.clientId)}setWorkspaceToolEnabled(t,n,r){return this.post(`/tools/${ut(t)}/enable`,"POST /workspaces/:workspace/tools/:name/enable",{enabled:n},r==null?void 0:r.clientId)}setWorkspaceSkillEnabled(t,n,r){return this.post(`/skills/${ut(t)}/enable`,"POST /workspaces/:workspace/skills/:name/enable",{enabled:n},r==null?void 0:r.clientId)}restartMcpServer(t,n){let r=(n==null?void 0:n.entryIndex)===void 0?"":`?entryIndex=${ut(String(n.entryIndex))}`;return this.post(`/mcp/${ut(t)}/restart${r}`,"POST /workspaces/:workspace/mcp/:server/restart",{},n==null?void 0:n.clientId,(n==null?void 0:n.timeoutMs)??r0)}reload(t){return this.post("/reload","POST /workspaces/:workspace/reload",{},t==null?void 0:t.clientId,t==null?void 0:t.timeoutMs)}initWorkspace(t){return this.post("/init","POST /workspaces/:workspace/init",(t==null?void 0:t.force)===!0?{force:!0}:{},t==null?void 0:t.clientId)}workspaceExtensions(){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions","GET /workspaces/:workspace/extensions",{mode:"rest"})}setExtensionActivation(t,n,r){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${ut(t)}/activation`,"PUT /workspaces/:workspace/extensions/:extensionId/activation",{method:"PUT",body:{state:n},clientId:r,mode:"rest"})}clearExtensionActivation(t,n){return this.client.workspaceJsonRequest(this.workspaceSelector,`/extensions/${ut(t)}/activation`,"DELETE /workspaces/:workspace/extensions/:extensionId/activation",{method:"DELETE",clientId:n,mode:"rest"})}refreshExtensionRuntime(t){return this.client.workspaceJsonRequest(this.workspaceSelector,"/extensions/refresh","POST /workspaces/:workspace/extensions/refresh",{method:"POST",body:{},clientId:t,mode:"rest"})}get(t,n,r){return this.client.workspaceJsonRequest(this.workspaceSelector,t,n,{clientId:r})}post(t,n,r,s,i){return this.client.workspaceJsonRequest(this.workspaceSelector,t,n,{method:"POST",body:r,clientId:s,timeoutMs:i})}};function e5(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 _9(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 ec(500,n.code??"turn_error",n.message??"Prompt failed"),{_daemonTurnError:!0})}}function jD(e){return"promptId"in e&&"lastEventId"in e}var z1=class Ek{constructor(t){Me(this,"client");Me(this,"session");Me(this,"state");Me(this,"replaySnapshot");Me(this,"hasActivePrompt");Me(this,"lastSeenEventId");Me(this,"subscriptionActive",!1);Me(this,"reattaching");Me(this,"promptLimit");Me(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=Xx(t.lastEventId),this.promptLimit=t.maxPendingPromptsPerSession===void 0?t.client.maxPendingPromptsPerSession:BV(t.maxPendingPromptsPerSession)}static async createOrAttach(t,n={},r){let s=await t.createOrAttachSession(n,r),i=!s.attached||n.modelServiceId||n.approvalMode?0:void 0;return new Ek({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:u,...d}=await t.loadSession(n,r,s);return new Ek({client:t,session:d,hasActivePrompt:o,state:i,lastEventId:u??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 Ek({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=Xx(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)),!jD(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 u=this._pendingPrompts.get(s.promptId);u&&this._pendingPrompts.delete(s.promptId)&&(this.client.cancel(this.sessionId,this.clientId).catch(()=>{}),u.reject(n.reason??new DOMException("Aborted","AbortError")))},l=()=>n==null?void 0:n.removeEventListener("abort",a);this._pendingPrompts.set(s.promptId,{resolve:u=>{l(),r(),i(u)},reject:u=>{l(),r(),o(u)}}),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(!jD(r))throw new Error("Expected non-blocking prompt acceptance");return r}async withClientIdSelfHeal(t){try{return await t()}catch(n){if(!zce(n))throw n;return await this.reattach(),await t()}}async reattach(){if(this.reattaching)return this.reattaching;this.reattaching=this.client.resumeSession(this.sessionId,{workspaceCwd:this.workspaceCwd}).then(t=>{this.session.clientId=t.clientId});try{await this.reattaching}finally{this.reattaching=void 0}}async cancel(){await this.client.cancel(this.sessionId,this.clientId)}async heartbeat(){return await this.client.heartbeat(this.sessionId,this.clientId)}async artifacts(){return await this.client.listSessionArtifacts(this.sessionId,this.clientId)}async addArtifact(t){return await this.client.addSessionArtifact(this.sessionId,t,this.clientId)}async removeArtifact(t){return await this.client.removeSessionArtifact(this.sessionId,t,this.clientId)}async setModel(t){return await this.client.setSessionModel(this.sessionId,t,this.clientId)}async getRewindSnapshots(){return await this.client.getRewindSnapshots(this.sessionId)}async rewind(t,n){return await this.client.rewindSession(this.sessionId,t,{clientId:this.clientId,...(n==null?void 0:n.rewindFiles)!==void 0?{rewindFiles:n.rewindFiles}:{}})}async fork(t){return await this.client.forkSession(this.sessionId,{directive:t},this.clientId)}async recap(t){return await this.client.recapSession(this.sessionId,{...t!=null&&t.signal?{signal:t.signal}:{},...this.clientId?{clientId:this.clientId}:{}})}generateContent(t,n){return this.client.generateSessionContent(this.sessionId,t,{...n!=null&&n.signal?{signal:n.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 status(){return await this.client.sessionStatus(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=Xx(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,Xx(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=_9(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 Xx(e){if(e!==void 0){if(!Number.isInteger(e)||e<0)throw new TypeError("invalid lastEventId");return e}}function zce(e){return e instanceof ec&&e.status===400&&typeof e.body=="object"&&e.body!==null&&e.body.code==="invalid_client_id"}var zV="mid_turn_message_injected",S9="pending_prompt_added",C9="pending_prompt_started",T9="pending_prompt_completed",Fce=["session_update","permission_request","permission_resolved","permission_already_resolved","model_switched","model_switch_failed","session_died","session_closed","session_metadata_updated","session_recording_degraded","artifact_changed",zV,S9,C9,T9,"client_evicted","slow_client_warning","stream_error","state_resync_required","history_truncated","mcp_budget_warning","mcp_child_refused_batch","memory_changed","agent_changed","auth_device_flow_started","auth_device_flow_throttled","auth_device_flow_authorized","auth_device_flow_failed","auth_device_flow_cancelled","approval_mode_changed","tool_toggled","settings_changed","trust_change_requested","workspace_initialized","github_setup_completed","mcp_server_restarted","mcp_server_restart_refused","mcp_server_changed","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","git_branch_changed"];new Set(Fce);var I8="daemon-plan";function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tt(e,t){if(!cn(e))return;let n=e[t];return typeof n=="string"?n:void 0}function Xr(e,t){if(cn(e))for(let n of t){let r=e[n];if(typeof r=="string"&&r.trim().length>0)return r}}function Kh(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 ad(e){return Kh(qu(e))}function qu(e,t=0){return t>16?"[truncated]":Array.isArray(e)?e.map(n=>qu(n,t+1)):cn(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,FV(n)?"[redacted]":qu(r,t+1)])):e}function FV(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 t5(e){if(typeof e=="string")return e;if(!cn(e))return"";let t=e.text;return typeof t=="string"?t:""}function qce(e){if(typeof e=="string")return{kind:"text",text:e};if(!cn(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=cn(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=cn(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 Hce=64;function $2(e,t=0){if(t>Hce)return"[output truncated]";if(typeof e=="string")return e;if(Array.isArray(e))return e.map(r=>$2(r,t+1)).filter(Boolean).join(`
`);if(!cn(e))return e===void 0?"":Kh(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=$2(n,t+1);if(r)return r}return Kh(e)}var Uce=new Set(jce),qV=new Set(["qwen","qwen-oauth"]),Vce=new Set(["in_flight","disabled","budget_would_exceed","authentication_required"]),ID="malformed memory_changed payload",RD=4096,DD="Session recording stopped after a write failure. New messages for the affected session will not be saved. Check disk space and permissions, then start a new session to resume recording.";function Wce(e,t={}){let n=eue(e,t);switch(e.type){case"session_update":return tue(e,n,t);case"shell_output":{let r=$2(e.data),s=D8(e.data),i=L8(e.data);return r?[{...n,type:i==="user-shell"?"user.shell.output":"shell.output",text:r,...s?{stream:s}:{}}]:[]}case"permission_request":return lue(e,n);case"permission_resolved":case"permission_already_resolved":return cue(e,n);case"model_switched":return[{...n,type:"model.changed",modelId:tt(e.data,"modelId")??"unknown"}];case"model_switch_failed":return[{...n,type:"error",recoverable:!0,text:tt(e.data,"error")??"Model switch failed (no details available)"}];case"session_died":{let r=n5(tt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!1,...r?{errorKind:r}:{},text:tt(e.data,"reason")??"Session died (no details available)"}]}case"session_closed":return[{...n,type:"status",text:`Session closed: ${tt(e.data,"reason")??"closed"}`}];case"session_recording_degraded":return!tt(e.data,"sessionId")||tt(e.data,"reason")!=="write_failed"?Tr(e,n,"malformed recording state"):[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:DD}];case"session_snapshot":{if(!cn(e.data)||!tt(e.data,"sessionId"))return Tr(e,n,"malformed recording snapshot");let r=e.data.recordingDegraded;return r!==void 0&&typeof r!="boolean"?Tr(e,n,"malformed recording snapshot"):r===!0?[{...n,type:"error",recoverable:!0,code:"session_recording_degraded",text:DD}]:[]}case"client_evicted":return[{...n,type:"error",recoverable:!0,text:tt(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=n5(tt(e.data,"errorKind"));return[{...n,type:"error",recoverable:!0,...r?{errorKind:r}:{},text:tt(e.data,"error")??"SSE stream error (no details available)"}]}case"turn_error":{let r=tt(e.data,"code"),s=n5(tt(e.data,"errorKind")),i=tt(e.data,"promptId");return[{...n,type:"error",source:"turn_error",recoverable:!0,...r?{code:r}:{},...s?{errorKind:s}:{},...i?{promptId:i}:{},text:tt(e.data,"message")??"Prompt failed (no details available)"}]}case"state_resync_required":return Kce(e,n);case"history_truncated":return Yce(e,n);case"session_rewound":return Xce(e,n);case"session_branched":return Qce(e,n);case"prompt_cancelled":{let r=Pue(e.data,"reason");return[{...n,type:"prompt.cancelled",...r?{reason:r}:{}}]}case"followup_suggestion":return Jce(e,n);case"mid_turn_message_injected":return Zce(e,n);case"pending_prompt_added":case"pending_prompt_started":case"pending_prompt_completed":return[];case"user_shell_command":{let r=tt(e.data,"command"),s=tt(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=vs(e.data,"exitCode"),s=cn(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=vs(e.data,"replayedCount")??0,s=vs(e.data,"lastReplayedEventId")??vs(e.data,"lastEventId");return[{...n,type:"session.replay_complete",replayedCount:r,...s!==void 0?{lastReplayedEventId:s}:{}}]}case"session_metadata_updated":return mue(e,n);case"approval_mode_changed":return gue(e,n);case"git_branch_changed":return[];case"memory_changed":return bue(e,n);case"agent_changed":return yue(e,n);case"tool_toggled":return vue(e,n);case"settings_changed":return xue(e,n);case"settings_reloaded":return wue(e,n);case"trust_change_requested":return _ue(e,n);case"workspace_initialized":return kue(e,n);case"github_setup_completed":return Sue(e,n);case"mcp_budget_warning":return Cue(e,n);case"mcp_child_refused_batch":return Tue(e,n);case"mcp_server_restarted":return Aue(e,n);case"mcp_server_restart_refused":return Eue(e,n);case"mcp_server_added":return r5(e,n,"added");case"mcp_server_removed":return r5(e,n,"removed");case"mcp_server_changed":return r5(e,n);case"extensions_changed":return Mue(e,n);case"artifact_changed":return pue(e,n);case"auth_device_flow_started":return Nue(e,n);case"auth_device_flow_throttled":return jue(e,n);case"auth_device_flow_authorized":return Iue(e,n);case"auth_device_flow_failed":return Rue(e,n);case"auth_device_flow_cancelled":return Lue(e,n);default:return Gce(e,n)}}function Gce(e,t){return[{...t,type:"debug",text:`${e.type} (unrecognized daemon event): ${ad(e.data)}`}]}function Kce(e,t){let n=tt(e.data,"reason"),r=vs(e.data,"lastDeliveredId"),s=vs(e.data,"earliestAvailableId");return!n||r===void 0||s===void 0?Tr(e,t,"malformed state_resync_required payload"):[{...t,type:"session.state_resync_required",reason:n,lastDeliveredId:r,earliestAvailableId:s}]}function Yce(e,t){let n=tt(e.data,"reason"),r=vs(e.data,"truncatedEvents"),s=vs(e.data,"retainedEvents"),i=vs(e.data,"maxBytes");return n!=="replay_window_exceeded"||r===void 0||s===void 0||i===void 0||!cn(e.data)||typeof e.data.fullTranscriptAvailable!="boolean"?Tr(e,t,"malformed history_truncated payload"):[{...t,type:"status",text:`History truncated: retained ${s}, dropped ${r} (window ${i} bytes).`,source:"history_truncated"}]}function Xce(e,t){let n=tt(e.data,"promptId"),r=vs(e.data,"targetTurnIndex");if(!n||r===void 0)return Tr(e,t,"malformed session_rewound payload");let s=tt(e.data,"sessionId");return[{...t,type:"session.rewound",promptId:n,targetTurnIndex:r,...s?{sessionId:s}:{}}]}function Qce(e,t){let n=tt(e.data,"sourceSessionId"),r=tt(e.data,"newSessionId"),s=tt(e.data,"displayName");return!n||!r||!s?Tr(e,t,"malformed session_branched payload"):[{...t,type:"session.branched",sourceSessionId:n,newSessionId:r,displayName:s}]}function Jce(e,t){let n=tt(e.data,"sessionId"),r=tt(e.data,"suggestion"),s=tt(e.data,"promptId");return!n||!r||!s?Tr(e,t,"malformed followup_suggestion payload"):[{...t,type:"followup.suggestion",sessionId:n,suggestion:r,promptId:s}]}function Zce(e,t){if(!cn(e.data))return Tr(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?Tr(e,t,"malformed mid_turn_message_injected"):[{...t,type:"status",text:`Inserted message: ${n.join(`
`)}`,source:"mid_turn_message_injected",data:e.data}]}function eue(e,t){let n=HV(e);return{...e.id!==void 0?{eventId:e.id}:{},...n!==void 0?{serverTimestamp:n}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},...t.includeRawEvent?{rawEvent:{...e,data:qu(e.data)}}:{}}}function HV(e){let t=e.serverTimestamp;if(typeof t=="number"&&Number.isFinite(t))return t;let n=e._meta;if(cn(n)){let r=n.serverTimestamp;if(typeof r=="number"&&Number.isFinite(r))return r}if(cn(e.data)){let r=e.data._meta;if(cn(r)){let i=r.serverTimestamp;if(typeof i=="number"&&Number.isFinite(i))return i}let s=e.data.update;if(cn(s)){let i=s._meta;if(cn(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 tue(e,t,n){let r=uue(e.data);if(!r)return[{...t,type:"debug",text:`session_update: ${ad(e.data)}`}];let s=tt(r,"sessionUpdate");switch(s){case"user_message_chunk":{if(n.suppressOwnUserEcho&&n.clientId&&e.originatorClientId===n.clientId)return[];let i=PD(r),o=r.content,a=qce(o);if(a){if(a.kind==="image"){let u=a.source.data,d=a.mediaType||"image/*";if(d==="image/*"&&u){let h=(u.startsWith("data:")?u.split(",")[1]??"":u).slice(0,10);h.startsWith("iVBORw0KGg")?d="image/png":h.startsWith("/9j/")?d="image/jpeg":h.startsWith("R0lGOD")?d="image/gif":h.startsWith("UklGR")&&(d="image/webp")}return u?[{...t,type:"user.image.delta",data:u,mimeType:d}]:[]}return a.kind==="text"?a.text?[{...t,type:"user.text.delta",text:a.text,...i?{meta:i}:{}}]:[]:[]}let l=t5(o);return l?[{...t,type:"user.text.delta",text:l,...i?{meta:i}:{}}]:[]}case"agent_message_chunk":{let i=t5(r.content),o=LD(r),a=PD(r),l=[];i&&l.push({...t,type:"assistant.text.delta",text:i,...o?{parentToolCallId:o}:{},...a?{meta:a}:{}});let u=nue(r);return u&&l.push({...t,type:"assistant.usage",usage:u,...o?{parentToolCallId:o}:{}}),l}case"agent_thought_chunk":{let i=t5(r.content);if(!i)return[];let o=LD(r);return[{...t,type:"thought.text.delta",text:i,...o?{parentToolCallId:o}:{}}]}case"tool_call":case"tool_call_update":{let i=cn(r._meta)?r._meta:void 0;return tt(r,"status")==="in_progress"&&tt(r,"kind")===void 0&&(i==null?void 0:i.shellProgress)!==void 0?[]:[rue(r,t)]}case"shell_output":case"tool_output":{let i=$2(r),o=D8(r)??D8(e.data),a=L8(r)??L8(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(cn);return[{...t,type:"session.available_commands",count:i.length,commands:i}]}case"plan":return[sue(r,t)];case"current_mode_update":return[];default:return[{...t,type:"debug",text:`${s??"session_update"}: ${ad(r)}`}]}}function LD(e){let t=cn(e._meta)?e._meta:void 0;return t?tt(t,"parentToolCallId"):void 0}function PD(e){let t=cn(e._meta)?e._meta:void 0;return t?{...t}:void 0}function nue(e){let t=cn(e._meta)?e._meta:void 0,n=t&&cn(t.usage)?t.usage:void 0;if(!n)return;let r=vs(n,"inputTokens"),s=vs(n,"outputTokens");if(r===void 0&&s===void 0)return;let i=vs(n,"cachedReadTokens");return{inputTokens:r??0,outputTokens:s??0,...i!==void 0?{cachedTokens:i}:{}}}function rue(e,t){let n=cn(e._meta)?e._meta:void 0,r=tt(e,"toolName")??tt(e,"name")??(n?tt(n,"toolName"):void 0)??(n?tt(n,"name"):void 0),s=tt(e,"kind"),i=tt(e,"title")??r??s,o=e.rawInput??e.input??e.args,a=e.rawOutput??e.output??e.result,l=o!==void 0?qu(o):void 0,u=a!==void 0?qu(a):void 0,d=e.content!==void 0?qu(e.content):void 0,h=e.locations!==void 0?qu(e.locations):void 0,m=tt(e,"toolCallId"),p=tt(e,"status");if(!m)return{...t,type:"error",code:"daemon.protocol.tool_update_missing_tool_call_id",recoverable:!0,text:`Tool update missing toolCallId${i?` (${i})`:""}`};let{provenance:g,serverId:b}=aue(e,r),x=tt(e,"parentToolCallId")??(n?tt(n,"parentToolCallId"):void 0),v=x&&x!==m?x:void 0,y=tt(e,"subagentType")??(n?tt(n,"subagentType"):void 0);return{...t,type:"tool.update",toolCallId:m,...p?{status:p}:{},...i?{title:i}:{},...r?{toolName:r}:{},...s?{toolKind:s}:{},...d!==void 0?{content:d}:{},...h!==void 0?{locations:h}:{},...g?{provenance:g}:{},...b?{serverId:b}:{},...v?{parentToolCallId:v}:{},...y?{subagentType:y}:{},...l!==void 0?{rawInput:l}:{},...u!==void 0?{rawOutput:u}:{},...l!==void 0?{details:R8(ad(l))}:u!==void 0?{details:R8(ad(u))}:{}}}function sue(e,t){let n=Array.isArray(e.entries)?e.entries:[],r=R8(iue(n)),s=t.eventId!==void 0?`${I8}-${t.eventId}`:I8,i=cn(e._meta)?e._meta:void 0,o=i&&cn(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 iue(e){return e.flatMap(t=>{if(!cn(t))return[];let n=tt(t,"content");return n?[`- [${oue(tt(t,"status"))}] ${n}`]:[]}).join(`
`)}function oue(e){switch(e){case"completed":return"x";case"in_progress":return"-";default:return" "}}function aue(e,t){let n=tt(e,"provenance"),r=tt(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 n5(e){if(e)return Uce.has(e)?e:void 0}function R8(e){return e.length<=RD?e:`${e.slice(0,RD)}... [truncated]`}function lue(e,t){if(!cn(e.data))return[{...t,type:"debug",text:`permission_request: ${ad(e.data)}`}];let n=tt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`permission_request: ${ad(e.data)}`}];let r=e.data.toolCall!==void 0?qu(e.data.toolCall):void 0;return[{...t,type:"permission.request",requestId:n,sessionId:tt(e.data,"sessionId"),title:fue(r),options:due(e.data.options),toolCall:r}]}function cue(e,t){let n=tt(e.data,"requestId");if(!n)return[{...t,type:"debug",text:`${e.type}: ${ad(e.data)}`}];let r=tt(e.data,"voterClientId")??t.originatorClientId;return[{...t,type:"permission.resolved",requestId:n,outcome:hue(e.data),...r?{voterClientId:r}:{}}]}function uue(e){if(!cn(e))return;let t=e.update;return cn(t)?t:e}function due(e){return Array.isArray(e)?e.flatMap(t=>{if(!cn(t))return[];let n=tt(t,"optionId");return n?[{optionId:n,label:tt(t,"label")??tt(t,"title")??tt(t,"name")??n,...tt(t,"description")?{description:tt(t,"description")}:{},raw:t}]:[]}):[]}function hue(e){if(!cn(e))return Kh(e);let t=e.outcome;if(typeof t=="string")return t;if(cn(t)){let n=tt(t,"outcome")??"selected",r=tt(t,"optionId");return r?`${n}:${r}`:n}return Xr(e,["status","reason"])??Kh(e)}function fue(e){return cn(e)?tt(e,"title")??tt(e,"name")??tt(e,"kind")??tt(e,"toolName")??"Tool permission":"Tool permission"}function D8(e){let t=tt(e,"stream");return t==="stdout"||t==="stderr"?t:void 0}function L8(e){if(!cn(e))return;let t=tt(e,"source");if(t)return t;let n=e._meta;return cn(n)?tt(n,"source"):void 0}function Tr(e,t,n){return[{...t,type:"debug",text:`${e.type}: ${n}`}]}function mue(e,t){let n=tt(e.data,"sessionId");if(!n)return Tr(e,t,"missing sessionId");let r=tt(e.data,"displayName");return[{...t,type:"session.metadata.changed",sessionId:n,...r!==void 0?{displayName:r}:{}}]}function pue(e,t){let n=tt(e.data,"sessionId"),r=cn(e.data)?e.data.change:void 0;if(!n||!cn(r))return Tr(e,t,"malformed artifact_changed payload");let s=tt(r,"action"),i=tt(r,"artifactId");return!s||!i?Tr(e,t,"missing action or artifactId"):[{...t,type:"session.artifact.changed",sessionId:n,change:r}]}function gue(e,t){let n=tt(e.data,"sessionId"),r=tt(e.data,"previous"),s=tt(e.data,"next");if(!n||!r||!s)return Tr(e,t,"missing sessionId / previous / next");let i=cn(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 bue(e,t){var o;let n=tt(e.data,"scope");if(n==="managed"){let a=tt(e.data,"source"),l=tt(e.data,"taskId"),u=(o=e.data)==null?void 0:o.touchedScopes;return!(a&&l&&Array.isArray(u))||u.some(d=>d!=="user"&&d!=="project")?Tr(e,t,ID):[{...t,type:"workspace.memory.changed",scope:n,source:a,taskId:l,touchedScopes:u}]}let r=tt(e.data,"filePath"),s=tt(e.data,"mode"),i=vs(cn(e.data)?e.data:void 0,"bytesWritten");return n!=="workspace"&&n!=="global"||!r||s!=="append"&&s!=="replace"||i===void 0?Tr(e,t,ID):[{...t,type:"workspace.memory.changed",scope:n,filePath:r,mode:s,bytesWritten:i}]}function yue(e,t){let n=tt(e.data,"change"),r=tt(e.data,"name"),s=tt(e.data,"level");return n!=="created"&&n!=="updated"&&n!=="deleted"||!r||s!=="project"&&s!=="user"?Tr(e,t,"malformed agent_changed payload"):[{...t,type:"workspace.agent.changed",change:n,name:r,level:s}]}function vue(e,t){let n=tt(e.data,"toolName"),r=cn(e.data)&&typeof e.data.enabled=="boolean"?e.data.enabled:void 0;return!n||r===void 0?Tr(e,t,"malformed tool_toggled payload"):[{...t,type:"workspace.tool.toggled",toolName:n,enabled:r}]}function xue(e,t){let n=tt(e.data,"key"),r=tt(e.data,"scope");return n?[{...t,type:"workspace.settings.changed",key:n,scope:r??"workspace",value:cn(e.data)?e.data.value:void 0}]:Tr(e,t,"malformed settings_changed payload")}function wue(e,t){return cn(e.data)?[{...t,type:"workspace.settings.changed",key:"settings_reloaded",scope:"workspace",value:e.data}]:Tr(e,t,"malformed settings_reloaded payload")}function kue(e,t){let n=tt(e.data,"path"),r=tt(e.data,"action");return!n||r!=="created"&&r!=="overwrote"&&r!=="noop"?Tr(e,t,"malformed workspace_initialized payload"):[{...t,type:"workspace.initialized",path:n,action:r}]}function _ue(e,t){let n=tt(e.data,"workspaceCwd"),r=tt(e.data,"desiredState"),s=tt(e.data,"reason");return!n||r!=="trusted"&&r!=="untrusted"?Tr(e,t,"bad trust_change_requested payload"):[{...t,type:"workspace.trust.change.requested",workspaceCwd:n,desiredState:r,...s!==void 0?{reason:s}:{}}]}function Sue(e,t){let n=tt(e.data,"releaseTag"),r=tt(e.data,"readmeUrl");if(!n||!r||!cn(e.data))return Tr(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 Cue(e,t){if(!cn(e.data))return Tr(e,t,"non-object payload");let n=vs(e.data,"liveCount"),r=vs(e.data,"reservedCount"),s=vs(e.data,"budget"),i=vs(e.data,"thresholdRatio"),o=tt(e.data,"mode");return n===void 0||r===void 0||s===void 0||i===void 0||o!=="warn"&&o!=="enforce"?Tr(e,t,"malformed mcp_budget_warning payload"):[{...t,type:"workspace.mcp.budget_warning",liveCount:n,reservedCount:r,budget:s,thresholdRatio:i,mode:o}]}function Tue(e,t){if(!cn(e.data))return Tr(e,t,"non-object payload");let n=Array.isArray(e.data.refusedServers)?e.data.refusedServers.filter(cn).map(o=>{let a=tt(o,"name"),l=tt(o,"transport"),u=tt(o,"reason");return!a||!l||u!=="budget_exhausted"?null:{name:a,transport:l,reason:"budget_exhausted"}}).filter(o=>o!==null):[],r=vs(e.data,"budget"),s=vs(e.data,"liveCount"),i=vs(e.data,"reservedCount");return n.length===0||r===void 0||s===void 0||i===void 0?Tr(e,t,"malformed mcp_child_refused_batch payload"):[{...t,type:"workspace.mcp.child_refused",refusedServers:n,budget:r,liveCount:s,reservedCount:i}]}function Aue(e,t){let n=tt(e.data,"serverName"),r=vs(e.data,"durationMs");return!n||r===void 0?Tr(e,t,"malformed mcp_server_restarted payload"):[{...t,type:"workspace.mcp.server_restarted",serverName:n,durationMs:r}]}function Eue(e,t){let n=tt(e.data,"serverName"),r=tt(e.data,"reason");return!n||!r||!Vce.has(r)?Tr(e,t,"malformed mcp_server_restart_refused payload"):[{...t,type:"workspace.mcp.server_restart_refused",serverName:n,reason:r}]}function r5(e,t,n){let r=tt(e.data,n?"name":"serverName"),s=n??tt(e.data,"action");return!r||!s||!["added","removed","approve","enable","disable","authenticate","clear-auth"].includes(s)?Tr(e,t,`malformed ${e.type} payload`):[{...t,type:"workspace.mcp.server_changed",serverName:r,action:s}]}function Mue(e,t){let n=vs(e.data,"refreshed"),r=vs(e.data,"failed"),s=tt(e.data,"status"),i=tt(e.data,"source"),o=tt(e.data,"name"),a=tt(e.data,"version"),l=tt(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"?Tr(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 Nue(e,t){let n=tt(e.data,"deviceFlowId"),r=tt(e.data,"providerId"),s=vs(e.data,"expiresAt");return!n||!r||!qV.has(r)||s===void 0?Tr(e,t,"malformed auth_device_flow_started payload"):[{...t,type:"auth.device_flow.started",deviceFlowId:n,providerId:r,expiresAt:s}]}function jue(e,t){let n=tt(e.data,"deviceFlowId"),r=vs(e.data,"intervalMs");return!n||r===void 0?Tr(e,t,"malformed auth_device_flow_throttled payload"):[{...t,type:"auth.device_flow.throttled",deviceFlowId:n,intervalMs:r}]}function Iue(e,t){let n=tt(e.data,"deviceFlowId"),r=tt(e.data,"providerId");if(!n||!r||!qV.has(r))return Tr(e,t,"malformed auth_device_flow_authorized payload");let s=vs(e.data,"expiresAt"),i=tt(e.data,"accountAlias");return[{...t,type:"auth.device_flow.authorized",deviceFlowId:n,providerId:r,...s!==void 0?{expiresAt:s}:{},...i?{accountAlias:i}:{}}]}function Rue(e,t){let n=tt(e.data,"deviceFlowId"),r=tt(e.data,"errorKind");if(!n||!Due(r))return Tr(e,t,"malformed auth_device_flow_failed payload");let s=tt(e.data,"hint");return[{...t,type:"auth.device_flow.failed",deviceFlowId:n,errorKind:r,...s?{hint:s}:{}}]}function Due(e){return typeof e=="string"&&e.trim().length>0}function Lue(e,t){let n=tt(e.data,"deviceFlowId");return n?[{...t,type:"auth.device_flow.cancelled",deviceFlowId:n}]:Tr(e,t,"malformed auth_device_flow_cancelled payload")}function vs(e,t){if(!cn(e))return;let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Pue(e,t){if(!cn(e))return;let n=e[t];return typeof n=="string"&&n.length>0?n:void 0}var Oue=8;function z2(e,t={},n=0){if(n>Oue){let g=t.title??t.toolName??t.toolKind;return{kind:"generic",...g?{summary:g}:{}}}if(cn(e)){let g=e.rawInput??e.input??e.args;if(g!==void 0&&g!==e){let b=z2(g,{title:t.title??Xr(e,["title"]),toolName:t.toolName??Xr(e,["toolName","name"]),toolKind:t.toolKind??Xr(e,["kind"])},n+1);if(b.kind!=="generic"||!b.summary)return b}}let r=que(e);if(r.length>0)return{kind:"ask_user_question",questions:r};let s=Fue(e,t);if(s)return s;let i=Wue(e,t);if(i)return i;let o=Gue(e,t);if(o)return o;let a=Kue(e,t);if(a)return a;let l=Bue(e,t);if(l)return l;let u=$ue(e,t);if(u)return u;let d=zue(e);if(d)return d;let h=Yue(e,t);if(h)return h;let m=Xue(e);if(m)return m;if(cn(e)){let g=Xr(e,["command","cmd"]);if(g){let x=Xr(e,["cwd","directory","workingDirectory"]);return{kind:"command",command:g,...x?{cwd:x}:{}}}let b=Uue(e);if(b.length>0)return{kind:"key_value",rows:b}}let p=t.title??t.toolName??t.toolKind;return{kind:"generic",...p?{summary:p}:{}}}function Bue(e,t={}){if(!cn(e))return;let n=Xr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=Xr(e,["oldText","old_text","old_str","oldString"]),s=Xr(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?Xr(e,["content"]):void 0,l=s??a,u=Xr(e,["patch","diff","unified_diff"]);if(!(!r&&!l&&!u))return{kind:"file_diff",path:n,...r?{oldText:r}:{},...l?{newText:l}:{},...u?{patch:u}:{}}}function $ue(e,t){if(!cn(e))return;let n=Xr(e,["path","filePath","file_path","absolutePath"]);if(!n)return;let r=t.toolName??Xr(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 zue(e){if(!cn(e))return;let t=Xr(e,["url","uri","href"]);if(!t||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t))return;let n=Xr(e,["method","httpMethod"]);return{kind:"web_fetch",url:t,...n?{method:n}:{}}}function Fue(e,t){let n=t.toolName??(cn(e)?Xr(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(cn(e)){let l=e.arguments??e.args??e;if(cn(l)){let u=Object.entries(l).filter(([d])=>d!=="name"&&d!=="toolName").slice(0,1).map(([d,h])=>{let m=typeof h=="string"?h:JSON.stringify(h),p=m.length>60?`${m.slice(0,60)}…`:m;return`${d}=${p}`})[0];u&&(a=u)}}return{kind:"mcp_invocation",serverId:i,toolName:o,...a?{argsSummary:a}:{}}}function que(e){return!cn(e)||!Array.isArray(e.questions)?[]:e.questions.filter(cn).map(t=>{let n=Xr(t,["header","title","label"]),r=Xr(t,["question","prompt","text"])??"Question",s=Array.isArray(t.options)?t.options.filter(cn).map(Hue):[];return{...n?{header:n}:{},question:r,options:s,raw:t}})}function Hue(e){let t=Xr(e,["label","title","value"])??"Option",n=Xr(e,["description","detail","text"]);return{label:t,...n?{description:n}:{},raw:e}}function Uue(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=Xr(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)||cn(s)||t.push({label:r,value:FV(r)?"[redacted]":ad(s)});return t}var OD=50,Vue=5;function Wue(e,t){let n=t.toolName??"";if(!(/^task$/i.test(n)||/(?:^|_)(?:delegate|subagent|spawn[_-]?task)$/i.test(n)||/agent/i.test(t.toolKind??""))||!cn(e))return;let r=Xr(e,["subagent_type","agent","agentName","agent_name","subagent"]),s=Xr(e,["prompt","task","description","instruction","query"]);if(!r&&!s)return;let i=Xr(e,["parentDelegationId","parent_delegation_id","parent_id"]);return{kind:"subagent_delegation",agentName:r??"subagent",task:s??"(no task description)",...i?{parentDelegationId:i}:{}}}function Gue(e,t){if(!cn(e))return;let n=Xr(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,Vue).map(a=>typeof a=="string"?a:cn(a)?Xr(a,["path","file","name","title","text"])??Kh(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 Kue(e,t){let n=t.toolName??"";if(!/(image[_-]?gen|generate[_-]?image|diffusion|dalle|imagen|flux|stable[_-]?diffusion|midjourney|sora)/i.test(n)||!cn(e))return;let r=Xr(e,["prompt","description","query"]);if(!r)return;let s=Xr(e,["thumbnailUrl","thumbnail","url","imageUrl","preview"]),i=Xr(e,["model","modelId","model_name"]);return{kind:"image_generation",prompt:r,...s?{thumbnailUrl:s}:{},...i?{model:i}:{}}}function Yue(e,t){if(!cn(e))return;let n=Xr(e,["code","snippet","source"]);if(!n)return;let r=Xr(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=Xr(e,["origin","source_location","path"]);return{kind:"code_block",code:n,...r?{language:r}:{},...o?{origin:o}:{}}}function Xue(e){if(!cn(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,OD).map(o=>Array.isArray(o)?o.map(a=>typeof a=="string"?a:Kh(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&&cn(r[0])){let s=Object.keys(r[0]).slice(0,30);if(s.length===0)return;let i=r.slice(0,OD).map(o=>{let a=o;return s.map(l=>{let u=a[l];return typeof u=="string"?u:Kh(u).slice(0,80)})});return{kind:"tabular",columns:s,rows:i,...r.length>i.length?{totalRows:r.length}:{}}}}var Que=1e3,Dm="__trimmed_tool_block__",V4="__trimmed_permission_block__",P8=1e5,BD=`
[truncated]
`,Jue=16;function Zue(e={}){return{blocks:[],blockIndexById:{},toolBlockByCallId:{},trimmedToolNotificationByCallId:{},permissionBlockByRequestId:{},activeAssistantBlockByParent:{},activeThoughtBlockByParent:{},toolProgress:{},awaitingResync:!1,resyncRequiredCount:0,nextOrdinal:1,now:e.now??Date.now(),maxBlocks:e.maxBlocks??Que}}var A9=new Set(["pending","confirming","running","in_progress"]),ede=new Set(["completed","success","failed","error","canceled","cancelled"]),tde=new Set(["session.state_resync_required","assistant.done","status","debug","error"]);function nde(e,t,n={}){let r=GV(e,n);j9(r);let s=I9(r,"user",t,void 0,void 0,n.meta);return n.images&&n.images.length>0&&(s.images=[...n.images]),iu(r,s),r.activeUserBlockId=s.id,KV(r)}function rde(e,t,n={}){if(t.length===0)return e;let r=GV(e,n);for(let i of t)sde(r,i);let s=KV(r);return Object.freeze(s.blocks),s}function E9(e){let t={};return e.forEach((n,r)=>{t[n.id]=r}),t}function sde(e,t){var n;if(t.eventId!==void 0&&(e.lastEventId=Math.max(e.lastEventId??0,t.eventId)),e.awaitingResync&&!tde.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),s5(e,"user","activeUserBlockId",t.text,t);break;case"user.image.delta":{if(e.activeUserBlockId){let r=Bl(e,e.activeUserBlockId);r&&r.kind==="user"&&(r.images=[...r.images??[],{data:t.data,mimeType:t.mimeType}])}else{let r=I9(e,"user","");r.images=[{data:t.data,mimeType:t.mimeType}],iu(e,r),e.activeUserBlockId=r.id}break}case"assistant.text.delta":s5(e,"assistant","activeAssistantBlockId",t.text,t);break;case"assistant.done":j9(e,t),(t.reason==="cancelled"||t.reason==="error")&&O8(e);break;case"assistant.usage":ade(e,t);break;case"thought.text.delta":s5(e,"thought","activeThoughtBlockId",t.text,t);break;case"tool.update":WV(e,t);break;case"shell.output":ude(e,t);break;case"user.shell.output":dde(e,t);break;case"permission.request":hde(e,t);break;case"permission.resolved":fde(e,t);break;case"model.changed":Wb(e,"status",`Model switched: ${t.modelId}`,t);break;case"status":case"debug":case"error":Wb(e,t.type,t.text,t);break;case"session.approval_mode.changed":e.approvalMode=t.next;break;case"session.metadata.changed":case"session.artifact.changed":case"session.available_commands":break;case"session.state_resync_required":ide(e,t);break;case"prompt.cancelled":O8(e),t.reason!=="forward_failed"&&mde(e,t);break;case"followup.suggestion":e.lastFollowupSuggestion={suggestion:t.suggestion,promptId:t.promptId};break;case"session.replay_complete":break;case"session.rewound":gde(e,t.targetTurnIndex);break;case"session.branched":Wb(e,"status",`Branched conversation "${t.displayName}". You are now in the branch.`,t);break}}function ide(e,t){e.awaitingResync=!0,e.resyncRequiredCount+=1,e.lastResyncRequired={reason:t.reason,lastDeliveredId:t.lastDeliveredId,earliestAvailableId:t.earliestAvailableId},O8(e),Wb(e,"error",`State resync required: ${ode(t.lastDeliveredId,t.earliestAvailableId)}.`,t)}function ode(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 W4(e,t,n){let r=Bl(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 UV(e,t){W4(e,e.activeAssistantBlockId,t),e.activeAssistantBlockId=void 0}function ade(e,t){let n=Bl(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 VV(e,t){W4(e,e.activeThoughtBlockId,t),e.activeThoughtBlockId=void 0}function M9(e,t,n){W4(e,e.activeAssistantBlockByParent[t],n),delete e.activeAssistantBlockByParent[t]}function N9(e,t,n){W4(e,e.activeThoughtBlockByParent[t],n),delete e.activeThoughtBlockByParent[t]}function s5(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=Bl(e,a);if(l&&l.kind===t&&lde(l,s)){l.text=D9(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 u=I9(e,t,r,s.eventId,s.serverTimestamp,"meta"in s?s.meta:void 0);(t==="assistant"||t==="thought")&&(u.streaming=!0),t==="thought"&&(u.collapsed=!0),i!=null&&(u.parentToolCallId=i),iu(e,u),o&&i!=null?o[i]=u.id:e[n]=u.id,i!=null?(t==="assistant"&&N9(e,i),t==="thought"&&M9(e,i)):(t!=="user"&&(e.activeUserBlockId=void 0),t!=="assistant"&&UV(e),t!=="thought"&&VV(e))}function lde(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 j9(e,t){UV(e,t);for(let n of Object.keys(e.activeAssistantBlockByParent))M9(e,n,t);for(let n of Object.keys(e.activeThoughtBlockByParent))N9(e,n,t);VV(e,t)}function WV(e,t){let n=e.toolBlockByCallId[t.toolCallId];if(n===Dm){if(pde(t))return delete e.toolBlockByCallId[t.toolCallId],delete e.trimmedToolNotificationByCallId[t.toolCallId],WV(e,t);e.trimmedToolNotificationByCallId[t.toolCallId]||(e.trimmedToolNotificationByCallId[t.toolCallId]=!0,Wb(e,"error",`Tool ${t.toolCallId} output trimmed (max blocks reached)`,t,{clearActiveText:!1}));return}let r=Bl(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=z2(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!==Dm&&(r.parentBlockId=o)}t.subagentType&&!r.subagentType&&(r.subagentType=t.subagentType),$D(e,t.toolCallId,t.status);return}let s=t.parentToolCallId&&e.toolBlockByCallId[t.parentToolCallId]!==Dm?e.toolBlockByCallId[t.parentToolCallId]:void 0,i={id:gf(e,"tool"),kind:"tool",toolCallId:t.toolCallId,title:t.title??t.toolName??t.toolKind??"Tool",status:t.status??"pending",preview:z2(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}:{}};iu(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=Bl(e,o.id);(a==null?void 0:a.kind)==="tool"&&(a.parentBlockId=i.id)}$D(e,t.toolCallId,t.status??"pending"),dp(e,t.parentToolCallId)}function $D(e,t,n){if(n!==void 0){if(A9.has(n)){e.currentToolCallId=t;return}if(ede.has(n)){e.currentToolCallId===t&&(e.currentToolCallId=cde(e));return}}}function cde(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"&&A9.has(n.status))return n.toolCallId}}function O8(e){for(let t of Object.values(e.toolBlockByCallId)){if(t===Dm)continue;let n=Bl(e,t);!n||n.kind!=="tool"||A9.has(n.status)&&(n.status="cancelled",n.updatedAt=e.now)}e.currentToolCallId=void 0}function ude(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=Bl(e,n.id);(s==null?void 0:s.kind)==="shell"&&(s.text=D9(s.text,t.text),s.updatedAt=e.now,t.eventId!==void 0&&(s.eventId=t.eventId));return}let r={id:gf(e,"shell"),kind:"shell",text:Nv(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}:{}};iu(e,r),dp(e)}function dde(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=Bl(e,n.id);(o==null?void 0:o.kind)==="user_shell"&&(o.text=D9(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:gf(e,"user-shell"),kind:"user_shell",text:Nv(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,iu(e,i),dp(e)}function hde(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===V4)return;let r=Bl(e,n),s=z2(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:gf(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}:{}};iu(e,i),e.permissionBlockByRequestId[t.requestId]=i.id,dp(e)}function fde(e,t){let n=e.permissionBlockByRequestId[t.requestId];if(n===void 0||n===V4)return;let r=Bl(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:gf(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}:{}};iu(e,s),e.permissionBlockByRequestId[t.requestId]=s.id,dp(e)}function Wb(e,t,n,r,s={}){let i={id:gf(e,t),kind:t,text:Nv(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.errorKind?{errorKind:r.errorKind}:{},...(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}}:{}};iu(e,i),s.clearActiveText!==!1&&dp(e)}function mde(e,t){let n={id:gf(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}:{}};iu(e,n),dp(e)}function I9(e,t,n,r,s,i){return{id:gf(e,t),kind:t,text:Nv(n),clientReceivedAt:e.now,createdAt:e.now,updatedAt:e.now,...r!==void 0?{eventId:r}:{},...s!==void 0?{serverTimestamp:s}:{},...i?{meta:{...i}}:{}}}function GV(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 KV(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=E9(t),F2.set(e,e.blocks);for(let[r,s]of Object.entries(e.toolBlockByCallId))n.has(s)||(e.toolBlockByCallId[r]=Dm);vde(e);for(let[r]of Object.entries(e.trimmedToolNotificationByCallId))e.toolBlockByCallId[r]!==Dm&&delete e.trimmedToolNotificationByCallId[r];for(let[r,s]of Object.entries(e.permissionBlockByRequestId))n.has(s)||(e.permissionBlockByRequestId[r]=V4);xde(e);for(let r of e.blocks)if(r.kind==="tool"&&r.parentBlockId&&!n.has(r.parentBlockId)){let s=Bl(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 pde(e){return e.toolCallId===I8||e.toolKind==="updated_plan"}var F2=new WeakMap;function R9(e){F2.get(e)!==e.blocks&&(e.blocks=[...e.blocks],e.blockIndexById={...e.blockIndexById},F2.set(e,e.blocks))}function gde(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){zD(e,i);return}n+=1}r>=0&&t>=n&&zD(e,r)}function zD(e,t){R9(e),e.blocks=e.blocks.slice(0,t),F2.set(e,e.blocks),bde(e)}function bde(e){e.blockIndexById=E9(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 iu(e,t){R9(e),e.blockIndexById[t.id]=e.blocks.length,e.blocks.push(t)}function Bl(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=yde(r);return R9(e),e.blocks[n]=s,s}function yde(e){return e.kind==="permission"?{...e,options:e.options.map(t=>Ec(t)),toolCall:Ec(e.toolCall),preview:Ec(e.preview)}:e.kind==="tool"?{...e,preview:Ec(e.preview),content:Ec(e.content),locations:Ec(e.locations),rawInput:Ec(e.rawInput),rawOutput:Ec(e.rawOutput)}:{...e}}function gf(e,t){let n=`${t}-${e.nextOrdinal}`;return e.nextOrdinal+=1,n}function dp(e,t){t?(M9(e,t),N9(e,t)):(j9(e),e.activeUserBlockId=void 0)}function D9(e,t){return e.length>=P8?e:Nv(e+t)}function Nv(e){if(e.length<=P8)return e;let t=Math.max(0,P8-BD.length);return`${e.slice(0,t)}${BD}`}function vde(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.toolBlockByCallId).filter(([,s])=>s===Dm).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 xde(e){let t=Math.max(0,e.maxBlocks),n=Object.entries(e.permissionBlockByRequestId).filter(([,s])=>s===V4).map(([s])=>s),r=n.length-t;if(!(r<=0))for(let s of n.slice(0,r))delete e.permissionBlockByRequestId[s]}function Ec(e,t=0){return t>Jue?e:Array.isArray(e)?e.map(n=>Ec(n,t+1)):cn(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Ec(r,t+1)])):e}function wde(e={}){let t=FD(e),n=new Set,r=!1,s=()=>{for(let o of n)try{o()}catch(a){kde(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=rde(t,a),i())},appendLocalUserMessage(o,a,l){t=nde(t,o,{images:a,meta:l}),i()},reset(o={}){t=FD({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 kde(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 FD(e){let t=e.blocks?[...e.blocks]:[];return{...Zue({maxBlocks:e.maxBlocks,now:e.now}),...e,blocks:t,blockIndexById:E9(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 _de="web-shell:goal-status:v1:";/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function qD(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 u of l.models){!i&&u.isCurrent&&(i=u.modelId),a===void 0&&(i?u.modelId===i:u.isCurrent)&&(a=u.contextLimit);const d=[l.authType,u.modelId,u.baseUrl??"",u.envKey??""].join("\0");r.has(d)||(r.add(d),s.push({id:u.modelId,baseModelId:u.baseModelId,label:u.name||u.modelId,authType:l.authType,...u.contextLimit!==void 0?{contextWindow:u.contextLimit}:{},...u.modalities!==void 0?{modalities:u.modalities}:{},...u.baseUrl!==void 0?{baseUrl:u.baseUrl}:{},...u.envKey!==void 0?{envKey:u.envKey}:{},...u.isRuntime?{isRuntime:!0}:{}}))}return{models:s,currentModel:i,currentMode:o,contextWindow:a}}function Sde(e){var t;const n=eo((t=e==null?void 0:e.state)==null?void 0:t.models);if(!n)return;const r=Js(n,"currentModelId")??Js(n,"currentModel"),s=n.availableModels,i=[];let o;if(Array.isArray(s))for(const a of s){const l=eo(a),u=Js(l,"modelId")??Js(l,"id")??Js(l,"value");if(!u)continue;const d=eo(l==null?void 0:l._meta),h=pb(d,"contextLimit")??pb(d,"contextWindow")??pb(l,"contextLimit")??pb(l,"contextWindow");o===void 0&&r!==void 0&&u===r&&(o=h),i.push({id:u,baseModelId:Js(l,"baseModelId")??Mde(u),label:Js(l,"name")??Js(l,"label")??u,...h!==void 0?{contextWindow:h}:{}})}if(!(!r&&i.length===0))return{models:i,currentModel:r,contextWindow:o}}function YV(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}:{},...JV(r._meta),raw:r}}),n=e.availableSkills.map(r=>({name:r,description:"",raw:{name:r,description:"",input:null,_meta:{source:"skill"}}}));return{commands:XV(t,n),skills:e.availableSkills}}function HD(e){if(!e)return{commands:[],skills:[]};const t=e.skills.filter(r=>r.status==="ok");return{commands:t.map(r=>({name:r.name,description:r.description||"",...r.argumentHint?{argumentHint:r.argumentHint}:{},raw:{name:r.name,description:r.description||"",input:r.argumentHint?{hint:r.argumentHint}:null,_meta:{source:"skill"}}})),skills:t.map(r=>r.name)}}function XV(...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 Cde(e,t){var n;if(e.type==="session_update"){const r=eo((n=eo(e.data))==null?void 0:n.update),s=QV(r);if(s&&t(i=>({...i,tokenUsage:s,tokenCount:L9(s)})),Js(r,"sessionUpdate")==="available_commands_update"){const{commands:i,skills:o}=Ede(r);t(a=>({...a,commands:i,skills:o}))}return}switch(e.type){case"git_branch_changed":{const r=eo(e.data),s=Js(r,"workspaceCwd"),i=Js(r,"branch");t(o=>s&&s!==o.workspaceCwd?o:{...o,gitBranch:i});break}case"session_metadata_updated":{const r=eo(e.data);Object.prototype.hasOwnProperty.call(r??{},"displayName")&&t(s=>({...s,displayName:Js(r,"displayName")}));break}case"model_switched":{const r=Js(eo(e.data),"modelId");r&&t(s=>({...s,currentModel:r}));break}case"approval_mode_changed":{const r=eo(e.data),s=Js(r,"next")??Js(r,"mode");s&&t(i=>({...i,currentMode:s}));break}}}function UD(e){const t=Js(e,"displayName");return t!=null&&t.trim()?t:void 0}function Tde(e){var t;const n=eo((t=e==null?void 0:e.state)==null?void 0:t.modes);return Js(n,"currentModeId")??Js(n,"currentMode")}function L9(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 Ade(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=eo((t=eo(r.data))==null?void 0:t.update),i=QV(s);if(i)return i}catch{}}function QV(e){const t=eo(e==null?void 0:e._meta);if((t==null?void 0:t.parentToolCallId)!==void 0)return;const n=eo(t==null?void 0:t.usage),r={...F1(n,"inputTokens"),...F1(n,"outputTokens"),...F1(n,"totalTokens"),...F1(n,"thoughtTokens"),...F1(n,"cachedReadTokens")};return L9(r)!==void 0?r:void 0}function F1(e,t){const n=pb(e,t);return n!==void 0&&n>=0?{[t]:n}:{}}function Ede(e){if(!e)return{commands:[],skills:[]};const n=(Array.isArray(e.availableCommands)?e.availableCommands:[]).flatMap(i=>{var o;const a=eo(i),l=Js(a,"name");if(!l)return[];const u=eo(a==null?void 0:a.input),d={name:l,description:Js(a,"description")??"",input:u?{hint:Js(u,"hint")??""}:null,_meta:eo(a==null?void 0:a._meta)??null};return[{name:l,description:d.description??"",...(o=d.input)!=null&&o.hint?{argumentHint:d.input.hint}:{},...JV(d._meta),raw:d}]}),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:XV(n,s),skills:r}}function JV(e){const n=Js(e??void 0,"source");return{...n?{source:n}:{}}}function eo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Js(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function pb(e,t){const n=e==null?void 0:e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Mde(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 VD(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 Nde=3e4;function jde(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 ft(e,t,n=Nde){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 Ide(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 ii(e){e.current!==void 0&&(clearTimeout(e.current),e.current=void 0)}function Rde(e,t,n="replay",r=80,s){ii(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 Dde="qwen-code-webui-client-id:session:";function i5(e,t){if(e)return e;if(typeof window>"u")return o5();try{if(t){const n=window.sessionStorage.getItem(ZV(t));if(n)return n}return o5()}catch{return o5()}}function Mk(e,t){if(!(!e||!t||typeof window>"u"))try{window.sessionStorage.setItem(ZV(t),e)}catch{}}async function WD(e){if(!e.clientId)return;const t={"X-Qwen-Client-Id":e.clientId};e.token&&(t.Authorization=`Bearer ${e.token}`);const n=`${Lde(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 o5(){return`webui_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function ZV(e){return`${Dde}${encodeURIComponent(e)}`}function Lde(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 Pde(e,t){const n={...e};return(!t||e.sessionId===t)&&(delete n.sessionId,delete n.clientId,delete n.displayName,delete n.tokenUsage,delete n.tokenCount,delete n.supportedCommands,delete n.context),{...n,status:"connected",loadingTranscript:void 0,catchingUp:void 0,error:void 0,errorStatus:void 0,missingSession:!1}}function Ode({store:e,sessionRef:t,activePromptsRef:n,settledPromptsRef:r,pendingSessionLoadRef:s,pendingSessionLoadIdRef:i,heartbeatSupportedRef:o,manualSessionClearRef:a,skipNextCleanupDetachSessionIdRef:l,passiveAssistantDoneTimerRef:u,getCreateSessionRequest:d,createDetachedSession:h,getConnection:m,hasSessionActivePrompt:p,resetCurrentSessionActivePrompt:g,addNotice:b,setConnection:x,setPromptStatus:v,setRestoreSessionId:y,setRestoreWorkspaceCwd:w,setRestoreMode:k,setRestoreSessionNonce:T,setAttachSessionNonce:S,setNewSessionNonce:C}){function _(){for(const[,L]of n.current)L.controller.abort();n.current.clear(),r.current.clear(),v("idle"),ii(u),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(),y(void 0),w(void 0)}function A(L,N){const O=i.current+1;return i.current=O,s.current&&(clearTimeout(s.current.timeout),s.current.reject(new DOMException(`Session ${N} superseded by a newer request`,"AbortError"))),new Promise(($,P)=>{const K=setTimeout(()=>{var F;((F=s.current)==null?void 0:F.id)===O&&(s.current=void 0,P(Jr(b,`${qde(N)} session failed`,new Error(`Session ${N} timed out`),Hde(N))))},3e4);s.current={id:O,sessionId:L,mode:N,timeout:K,resolve:$,reject:P}})}function M(L,N,O){var B;a.current=!1;const $=A(L,N),P=t.current,K=P==null?void 0:P.sessionId,F=K?n.current.get(K):void 0;return(B=F==null?void 0:F.reject)==null||B.call(F,new DOMException("Session switch interrupted prompt wait","AbortError")),K&&n.current.delete(K),g(),P&&P.detach().catch(H=>{console.warn("[DaemonSessionActions] detach before session switch failed:",H)}),t.current=void 0,x(H=>({...H,status:"connecting",sessionId:L,clientId:void 0,displayName:void 0,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0,catchingUp:void 0})),v("idle"),r.current.clear(),ii(u),e.reset(),k(N),y(L),w(O??m().workspaceCwd),T(H=>H+1),$.catch(H=>{throw gb(H)||x(D=>({...D,loadingTranscript:void 0,catchingUp:void 0})),H})}return{async sendPrompt(L,N){var O,B,$,P;const K=ds(b,t.current,"Prompt failed","send_prompt"),F=K.sessionId;if(n.current.has(F))throw Jr(b,"Prompt failed","A prompt is already in progress","send_prompt");ii(u),v("waiting");const H=new AbortController;n.current.set(F,{controller:H});try{const D=((N==null?void 0:N.images)??[]).map(ie=>({data:ie.data,mimeType:ie.mimeType||ie.mediaType||ie.media_type||"image/*"})),Q=N!=null&&N.inputAnnotations&&N.inputAnnotations.length>0?N.inputAnnotations:void 0;(N==null?void 0:N.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(L,D,Q?{inputAnnotations:Q}:void 0);const U={prompt:VD(L,D)};Q&&(U._meta={inputAnnotations:Q}),N!=null&&N.retry&&(U.retry=!0);const j=await K.submitPrompt(U,H.signal);return(O=N==null?void 0:N.onAdmitted)==null||O.call(N),await Bde(n.current,r.current,F,H,j.promptId)}catch(D){if(gb(D))return((B=t.current)==null?void 0:B.sessionId)===F&&e.dispatch({type:"assistant.done",reason:"cancelled"}),{stopReason:"cancelled"};throw $V(D)?D:((($=t.current)==null?void 0:$.sessionId)===F&&e.dispatch({type:"assistant.done",reason:"error"}),Jr(b,"Prompt failed",D,"send_prompt"))}finally{const D=n.current.get(F);(D==null?void 0:D.controller)===H&&n.current.delete(F),((P=t.current)==null?void 0:P.sessionId)===F&&!p()&&v("idle")}},async submitPrompt(L,N){var O;const B=ds(b,t.current,"Prompt failed","send_prompt");if(N!=null&&N.sessionId&&B.sessionId!==N.sessionId)throw new Error("Session changed before prompt submission");const $=((N==null?void 0:N.images)??[]).map(H=>({data:H.data,mimeType:H.mimeType||H.mediaType||H.media_type||"image/*"})),P=N!=null&&N.inputAnnotations&&N.inputAnnotations.length>0?N.inputAnnotations:void 0;(N==null?void 0:N.optimisticUserMessage)!==!1&&e.appendLocalUserMessage(L,$,P?{inputAnnotations:P}:void 0);const K={prompt:VD(L,$)};P&&(K._meta={inputAnnotations:P}),N!=null&&N.retry&&(K.retry=!0);const F=await B.submitPrompt(K);if((O=N==null?void 0:N.signal)!=null&&O.aborted)throw await B.removePendingPrompt(F.promptId).catch(H=>{console.warn("[submitPrompt] removePendingPrompt failed after abort",H),b({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:H instanceof Error?H.message:String(H),recoverable:!0})}),N.signal.reason??new DOMException("Aborted","AbortError");return{promptId:F.promptId}},async cancel(){var L,N;const O=ds(b,t.current,"Cancel failed","cancel_prompt"),B=n.current.get(O.sessionId);B==null||B.controller.abort(),ii(u);const $=B?new AbortController:void 0;$&&n.current.set(O.sessionId,{controller:$});try{await ft(O.cancel(),"Cancel timed out")}catch(P){throw Jr(b,"Cancel failed",P,"cancel_prompt")}finally{$&&((L=n.current.get(O.sessionId))==null?void 0:L.controller)===$&&n.current.delete(O.sessionId),((N=t.current)==null?void 0:N.sessionId)===O.sessionId&&!p()&&v("idle")}},async setModel(L){const N=ds(b,t.current,"Set model failed","switch_model");try{const O=await ft(N.setModel(L),"Set model timed out");return x(B=>({...B,currentModel:L})),O}catch(O){throw Jr(b,"Set model failed",O,"switch_model")}},async setApprovalMode(L,N){const O=ds(b,t.current,"Set approval mode failed","set_approval_mode");try{const B=await ft(O.client.setSessionApprovalMode(O.sessionId,L,{persist:N==null?void 0:N.persist,clientId:O.clientId}),"Set approval mode timed out");return x($=>({...$,currentMode:B.mode||L})),B}catch(B){throw Jr(b,"Set approval mode failed",B,"set_approval_mode")}},async respondToPermission(L,N){const O=ds(b,t.current,"Permission response failed","submit_permission");try{return await ft(O.respondToSessionPermission(L,N),"Permission response timed out")}catch(B){throw Jr(b,"Permission response failed",B,"submit_permission")}},async submitPermission(L,N,O){const B=ds(b,t.current,"Permission response failed","submit_permission"),$=N!==void 0&&N.length>0?{outcome:{outcome:"selected",optionId:N},...O?{answers:O}:{}}:{outcome:{outcome:"cancelled"},...O?{answers:O}:{}};try{return await ft(B.respondToSessionPermission(L,$),"Permission response timed out")}catch(P){throw Jr(b,"Permission response failed",P,"submit_permission")}},async heartbeat(){const L=t.current;if(!(!L||!o.current))return ft(L.heartbeat(),"Heartbeat timed out")},async listSessions(L){const N=t.current;if(!N)return[];try{return await ft(N.client.listWorkspaceSessions(N.workspaceCwd,L),"List sessions timed out")}catch(O){throw Jr(b,"List sessions failed",O,"list_sessions")}},async loadSession(L,N){return M(L,"load",N==null?void 0:N.workspaceCwd)},async resumeSession(L,N){return M(L,"resume",N==null?void 0:N.workspaceCwd)},async createSession(L){try{a.current=!1;const N={...(L==null?void 0:L.approvalMode)!==void 0?{approvalMode:L.approvalMode}:{},...(L==null?void 0:L.sourceType)!==void 0?{sourceType:L.sourceType}:{}},O=t.current,B=O&&m().sessionId===O.sessionId?O:void 0;if(B){const P=await ft(B.client.createOrAttachSession({...d(),...(L==null?void 0:L.workspaceCwd)!==void 0?{workspaceCwd:L.workspaceCwd}:{},...N}),"Create session timed out");return Mk(P.clientId,P.sessionId),P}const $=await ft(h(L==null?void 0:L.workspaceCwd,N),"Create session timed out");if(a.current){try{await ft($.detach(),"Detach cleared session timed out")}catch(P){console.warn("[DaemonSessionActions] detach after interrupted create failed:",P)}throw new DOMException("Session creation interrupted","AbortError")}return Mk($.clientId,$.sessionId),t.current=$,l.current=$.sessionId,x(P=>({...P,status:"connected",sessionId:$.sessionId,...$.clientId?{clientId:$.clientId}:{},workspaceCwd:$.workspaceCwd,error:void 0,errorStatus:void 0,missingSession:!1})),$}catch(N){throw Jr(b,`Create session failed${L!=null&&L.workspaceCwd?` (workspace: ${L.workspaceCwd})`:""}`,N,"create_session")}},async attachSession(){const L=ds(b,t.current,"Attach session failed","attach_session"),N=A(L.sessionId,"attach");return S(O=>O+1),N},async clearSession(){const L=t.current;if(a.current=!0,_(),t.current=void 0,x(N=>Pde(N,L==null?void 0:L.sessionId)),L)try{await ft(L.detach(),"Clear session timed out")}catch(N){console.warn("[DaemonSessionActions] detach on clear failed:",N)}},async newSession(){a.current=!1,_(),x(L=>({...L,missingSession:!1,error:void 0,errorStatus:void 0})),C(L=>L+1)},async releaseSession(L){try{const N=ds(b,t.current,"Release session failed","release_session");await ft(N.client.closeSession(L),"Release session timed out")}catch(N){throw Jr(b,"Release session failed",N,"release_session")}},async closeSession(){const L=ds(b,t.current,"Close session failed","close_session");try{await ft(L.close(),"Close session timed out")}catch(N){throw Jr(b,"Close session failed",N,"close_session")}},async refreshCommands(){const L=ds(b,t.current,"Refresh commands failed","refresh_commands");try{const N=await ft(L.supportedCommands(),"Refresh commands timed out"),{commands:O,skills:B}=YV(N);x($=>({...$,commands:O,skills:B,supportedCommands:N}))}catch(N){throw Jr(b,"Refresh commands failed",N,"refresh_commands")}},async getContext(){const L=ds(b,t.current,"Load context failed","load_context");try{const N=await ft(L.context(),"Load context timed out");return x(O=>({...O,context:N,currentMode:$de(N)??O.currentMode,currentModel:zde(N)??O.currentModel})),N}catch(N){throw Jr(b,"Load context failed",N,"load_context")}},async getContextUsage(L){const N=ds(b,t.current,"Load context usage failed","load_context_usage");try{return await ft(N.contextUsage(L),"Load context usage timed out")}catch(O){throw Jr(b,"Load context usage failed",O,"load_context_usage")}},async renameSession(L){const N=ds(b,t.current,"Rename session failed","rename_session");try{return await ft(N.updateMetadata({displayName:L}),"Rename session timed out")}catch(O){throw Jr(b,"Rename session failed",O,"rename_session")}},async recapSession(){const L=ds(b,t.current,"Recap session failed","recap_session");try{return await ft(L.recap(),"Recap session timed out")}catch(N){throw Jr(b,"Recap session failed",N,"recap_session")}},async*generateSessionContent(L,N){yield*ds(b,t.current,"Generate content failed","generate_session_content").generateContent(L,N)},async getRewindSnapshots(){const L=ds(b,t.current,"Load rewind snapshots failed","rewind_snapshots");try{return await ft(L.getRewindSnapshots(),"Load rewind snapshots timed out")}catch(N){throw Jr(b,"Load rewind snapshots failed",N,"rewind_snapshots")}},async rewindSession(L,N){const O=ds(b,t.current,"Rewind session failed","rewind_session");try{return await ft(O.rewind(L,N),"Rewind session timed out")}catch(B){throw Jr(b,"Rewind session failed",B,"rewind_session")}},async btwSession(L,N){var O;const B=ds(b,t.current,"Side question failed","btw_session");try{return await ft(B.btw(L,N),"Side question timed out")}catch($){throw(O=N==null?void 0:N.signal)!=null&&O.aborted||gb($)?$:Jr(b,"Side question failed",$,"btw_session")}},async enqueueMidTurnMessage(L,N){const O=t.current;if(!O)return{accepted:!1};try{return await O.enqueueMidTurnMessage(L,N)}catch(B){return B instanceof DOMException&&B.name==="AbortError"||console.debug("[enqueueMidTurnMessage] push failed; kept for next turn",B),{accepted:!1}}},async getPendingPrompts(L){const N=t.current;if(!N)return{pendingPrompts:[]};if(L!=null&&L.sessionId&&N.sessionId!==L.sessionId)throw new Error("Session changed before pending prompts refresh");return await N.getPendingPrompts()},async removePendingPrompt(L,N){const O=t.current;return O?N!=null&&N.sessionId&&O.sessionId!==N.sessionId?await O.client.removePendingPrompt(N.sessionId,L):await O.removePendingPrompt(L):{removed:!1}},async sendShellCommand(L){var N,O;const B=ds(b,t.current,"Shell command failed","send_shell_command"),$=`${B.sessionId}:shell`;v("waiting");const P=new AbortController;n.current.set($,{controller:P});try{return await B.shellCommand(L,P.signal)}catch(K){throw Jr(b,"Shell command failed",K,"send_shell_command")}finally{((N=n.current.get($))==null?void 0:N.controller)===P&&n.current.delete($),((O=t.current)==null?void 0:O.sessionId)===B.sessionId&&!p()&&v("idle")}},async getTasks(){const L=ds(b,t.current,"Get tasks failed","load_tasks");try{return await ft(L.tasks(),"Get tasks timed out")}catch(N){throw Jr(b,"Get tasks failed",N,"load_tasks")}},async cancelTask(L,N){const O=ds(b,t.current,"Cancel task failed","cancel_task");try{return await ft(O.cancelTask(L,N),"Cancel task timed out")}catch(B){throw Jr(b,"Cancel task failed",B,"cancel_task")}},async clearGoal(){const L=ds(b,t.current,"Clear goal failed","clear_goal");try{return await ft(L.clearGoal(),"Clear goal timed out")}catch(N){throw Jr(b,"Clear goal failed",N,"clear_goal")}},async getStats(){const L=ds(b,t.current,"Load stats failed","load_stats");try{return await ft(L.stats(),"Load stats timed out")}catch(N){throw Jr(b,"Load stats failed",N,"load_stats")}},async loadArtifacts(){const L=ds(b,t.current,"Load artifacts failed","load_artifacts");try{return await ft(L.artifacts(),"Load artifacts timed out")}catch(N){throw Jr(b,"Load artifacts failed",N,"load_artifacts")}},async respondToGlobalPermission(L,N){const O=ds(b,t.current,"Global permission response failed","submit_permission");try{return await ft(O.client.respondToPermission(L,N),"Global permission response timed out")}catch(B){throw Jr(b,"Global permission response failed",B,"submit_permission")}},async branchSession(L){const N=ds(b,t.current,"Branch session failed","branch_session");try{const O=await ft(N.client.branchSession(N.sessionId,{name:L},N.clientId),"Branch session timed out");return Mk(O.clientId,O.sessionId),M(O.sessionId,"load").catch(B=>{gb(B)||Jr(b,"Branch session failed",B,"branch_session")}),{sessionId:O.sessionId,displayName:O.displayName}}catch(O){throw Jr(b,"Branch session failed",O,"branch_session")}},async forkSession(L){const N=ds(b,t.current,"Fork session failed","fork_session");try{return await ft(N.fork(L),"Fork session timed out")}catch(O){throw Jr(b,"Fork session failed",O,"fork_session")}}}}function Bde(e,t,n,r,s){return new Promise((i,o)=>{const a=B8(n,s),l=t.get(a);if(l){t.delete(a),l.status==="resolved"?i(l.result):o(l.error);return}const u=e.get(n);if((u==null?void 0:u.controller)!==r){o(new DOMException("Aborted","AbortError"));return}if(u.promptId!==void 0&&u.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 d=()=>{r.signal.removeEventListener("abort",h)},h=()=>{const m=e.get(n);(m==null?void 0:m.controller)===r&&e.delete(n),d(),o(r.signal.reason??new DOMException("Aborted","AbortError"))};e.set(n,{...u,promptId:s,resolve:m=>{d(),i(m)},reject:m=>{d(),o(m)}}),r.signal.addEventListener("abort",h,{once:!0})})}function B8(e,t){return JSON.stringify([e,t])}function $de(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 zde(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 ds(e,t,n,r){if(!t)throw Jr(e,n,"Daemon session is not connected",r);return t}function Jr(e,t,n,r){if(gb(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}),Fde(n instanceof Error?n:new Error(s))}function gb(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Fde(e){return Object.assign(e,{_alreadyDispatched:!0})}function qde(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Hde(e){return e==="resume"?"resume_session":e==="attach"?"attach_session":"load_session"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Ude=33e4;function Vde({getClient:e,getWorkspaceCwd:t,baseUrl:n,token:r}){return{async listSessions(s){const i=en(e,"List sessions failed"),o=t();return o?ft(i.listWorkspaceSessionsPage(o,s).then(a=>a.sessions),"List sessions timed out"):[]},async listSessionsPage(s){const i=en(e,"List sessions failed"),o=t();return o?ft(i.listWorkspaceSessionsPage(o,s),"List sessions timed out"):{sessions:[]}},async listSessionGroups(){const s=en(e,"List session groups failed"),i=t();return i?ft(s.listSessionGroups(i),"List session groups timed out"):{groups:[],colorOptions:[]}},async createSessionGroup(s){const i=en(e,"Create session group failed"),o=a5(t);return ft(i.createSessionGroup(o,s),"Create session group timed out")},async updateSessionGroup(s,i){const o=en(e,"Update session group failed"),a=a5(t);return ft(o.updateSessionGroup(a,s,i),"Update session group timed out")},async deleteSessionGroup(s){const i=en(e,"Delete session group failed"),o=a5(t);return ft(i.deleteSessionGroup(o,s),"Delete session group timed out")},async updateSessionOrganization(s,i){const o=en(e,"Update session organization failed");return ft(o.updateSessionOrganization(s,i),"Update session organization timed out")},async deleteSession(s){const i=en(e,"Delete session failed"),o=await ft(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=en(e,"Delete sessions failed");return ft(i.deleteSessionsData(s),"Delete sessions timed out")},async exportSession(s,i="html"){const o=en(e,"Export session failed");return ft(o.exportSession(s,{format:i}),"Export session timed out")},async archiveSession(s){const i=en(e,"Archive session failed"),o=await ft(i.archiveSessionsData([s]),"Archive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.archived.length>0||o.alreadyArchived.length>0},async unarchiveSession(s){const i=en(e,"Unarchive session failed"),o=await ft(i.unarchiveSessionsData([s]),"Unarchive session timed out");if(o.errors.length>0)throw new Error(o.errors[0].error);return o.unarchived.length>0||o.alreadyActive.length>0},async loadMcpStatus(){const s=en(e,"Load MCP status failed");return ft(s.workspaceMcp(),"Load MCP status timed out")},async initializeMcp(){const s=en(e,"Initialize MCP failed");return ft(s.initializeWorkspaceMcp(),"Initialize MCP timed out")},async reloadMcp(){const s=en(e,"Reload MCP failed");return ft(s.reloadWorkspaceMcp(),"Reload MCP timed out")},async loadMcpTools(s){const i=en(e,"Load MCP tools failed");try{return await ft(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=en(e,"Load MCP resources failed");try{return await ft(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=en(e,"Restart MCP server failed");return ft(i.restartMcpServer(s),"Restart MCP server timed out",5*6e4)},async manageMcpServer(s,i){const o=en(e,"Manage MCP server failed"),a=i==="authenticate"?10*6e4:5*6e4;return ft(o.manageMcpServer(s,i),"Manage MCP server timed out",a)},async addRuntimeMcpServer(s){const i=en(e,"Add MCP server failed");return ft(i.addRuntimeMcpServer(s),"Add MCP server timed out",5*6e4)},async removeRuntimeMcpServer(s){const i=en(e,"Remove MCP server failed");return ft(i.removeRuntimeMcpServer(s),"Remove MCP server timed out",5*6e4)},async loadDaemonStatus(s){const i=en(e,"Load daemon status failed");return ft(i.daemonStatus(s),"Load daemon status timed out")},async loadUsageDashboard(s){const i=en(e,"Load usage dashboard failed");return ft(i.usageDashboard(s),"Load usage dashboard timed out")},async loadSkillsStatus(){const s=en(e,"Load skills failed");return ft(s.workspaceSkills(),"Load skills timed out")},async loadExtensionsStatus(){const s=en(e,"Load extensions failed");return ft(s.workspaceExtensions(),"Load extensions timed out")},async loadToolsStatus(){const s=en(e,"Load tools failed");return ft(s.workspaceTools(),"Load tools timed out")},async setWorkspaceToolEnabled(s,i){const o=en(e,"Set tool enabled failed");return ft(o.setWorkspaceToolEnabled(s,i),"Set tool enabled timed out")},async loadSettingsStatus(){const s=en(e,"Load settings failed");return ft(s.workspaceSettings(),"Load settings timed out")},async setWorkspaceSetting(s,i,o,a){const l=en(e,"Set setting failed");return ft(l.setWorkspaceSetting(s,i,o,a),"Set setting timed out")},async loadMemoryStatus(){const s=en(e,"Load memory failed");return ft(s.workspaceMemory(),"Load memory timed out")},async readWorkspaceFile(s){const i=en(e,"Read workspace file failed");return ft(i.readWorkspaceFile(s),"Read workspace file timed out")},async writeMemory(s){const i=en(e,"Write memory failed");return ft(i.writeWorkspaceMemory(s),"Write memory timed out")},async listAgents(){const s=en(e,"List agents failed");return ft(s.listWorkspaceAgents(),"List agents timed out")},async getAgent(s){const i=en(e,"Get agent failed");return ft(i.getWorkspaceAgent(s),"Get agent timed out")},async createAgent(s){const i=en(e,"Create agent failed");return ft(i.createWorkspaceAgent(s),"Create agent timed out")},async generateAgent(s){const i=en(e,"Generate agent failed");return ft(i.generateWorkspaceAgent(s),"Generate agent timed out",Ude)},async deleteAgent(s,i){const o=en(e,"Delete agent failed");return ft(o.deleteWorkspaceAgent(s,i?{scope:i}:{}),"Delete agent timed out")},async globWorkspace(s,i){en(e,"Glob workspace failed");const o=Ud(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 ft(fetch(Vd(o,n),{headers:H1(r)}),"Glob workspace timed out");if(!a.ok)throw new Error(await Wd(a,"GET /glob"));const l=await a.json();return{matches:Array.isArray(l.matches)?l.matches.filter(u=>typeof u=="string"):[]}},async loadProviders(){const s=en(e,"Load providers failed");return ft(s.workspaceProviders(),"Load providers timed out")},async readFileBytes(s,i){const o=en(e,"Read file bytes failed");return ft(o.readWorkspaceFileBytes(s,i??{}),"Read file bytes timed out")},async writeFile(s){const i=en(e,"Write file failed");return ft(i.writeWorkspaceFile(s),"Write file timed out")},async editFile(s){const i=en(e,"Edit file failed");return ft(i.editWorkspaceFile(s),"Edit file timed out")},async stat(s){en(e,"Stat file failed");const i=Ud(n,"/stat");i.searchParams.set("path",s);const o=await ft(fetch(Vd(i,n),{headers:H1(r)}),"Stat file timed out");if(!o.ok)throw new Error(await Wd(o,"GET /stat"));return await o.json()},async listDirectory(s){en(e,"List directory failed");const i=Ud(n,"/list");i.searchParams.set("path",s);const o=await ft(fetch(Vd(i,n),{headers:H1(r)}),"List directory timed out");if(!o.ok)throw new Error(await Wd(o,"GET /list"));return await o.json()},async listScheduledTasks(s){en(e,"List scheduled tasks failed");const i=q1(s),o=Ud(n,i),a=await ft(fetch(Vd(o,n),{headers:H1(r)}),"List scheduled tasks timed out");if(!a.ok)throw new Error(await Wd(a,`GET ${i}`));const l=await a.json();return Array.isArray(l.tasks)?l.tasks:[]},async createScheduledTask(s,i){en(e,"Create scheduled task failed");const o=q1(i),a=Ud(n,o),l=await ft(fetch(Vd(a,n),{method:"POST",headers:l5(r),body:JSON.stringify(s)}),"Create scheduled task timed out");if(!l.ok)throw new Error(await Wd(l,`POST ${o}`));return await l.json()},async updateScheduledTask(s,i,o){en(e,"Update scheduled task failed");const a=q1(o,`/${encodeURIComponent(s)}`),l=Ud(n,a),u=await ft(fetch(Vd(l,n),{method:"PATCH",headers:l5(r),body:JSON.stringify(i)}),"Update scheduled task timed out");if(!u.ok)throw new Error(await Wd(u,`PATCH ${a}`));return await u.json()},async runScheduledTask(s,i){en(e,"Run scheduled task failed");const o=q1(i,`/${encodeURIComponent(s)}/run`),a=Ud(n,o),l=await ft(fetch(Vd(a,n),{method:"POST",headers:l5(r)}),"Run scheduled task timed out");if(!l.ok)throw new Error(await Wd(l,`POST ${o}`));return await l.json()},async deleteScheduledTask(s,i){en(e,"Delete scheduled task failed");const o=q1(i,`/${encodeURIComponent(s)}`),a=Ud(n,o),l=await ft(fetch(Vd(a,n),{method:"DELETE",headers:H1(r)}),"Delete scheduled task timed out");if(!l.ok)throw new Error(await Wd(l,`DELETE ${o}`))},async loadEnv(){const s=en(e,"Load env failed");return ft(s.workspaceEnv(),"Load env timed out")},async loadPreflight(){const s=en(e,"Load preflight failed");return ft(s.workspacePreflight(),"Load preflight timed out")},async initWorkspace(s){const i=en(e,"Init workspace failed");return ft(i.initWorkspace(s),"Init workspace timed out")},async updateAgent(s,i,o){const a=en(e,"Update agent failed");return ft(a.updateWorkspaceAgent(s,i,o?{scope:o}:{}),"Update agent timed out")},async installExtension(s,i){const o=en(e,"Install extension failed");return ft(o.installExtension(s,i),"Install extension timed out")},async extensionOperationStatus(s){const i=en(e,"Load extension operation failed");return ft(i.extensionOperationStatus(s),"Load extension operation timed out")},async activeExtensionOperations(){const s=en(e,"Load active extension operations failed");return ft(s.activeExtensionOperations(),"Load active extension operations timed out")},async respondToExtensionInteraction(s,i,o,a){const l=en(e,"Respond to extension interaction failed");return ft(l.respondToExtensionInteraction(s,i,o,a),"Respond to extension interaction timed out")},async checkExtensionUpdates(s){const i=en(e,"Check extension updates failed");return ft(i.checkExtensionUpdates(s),"Check extension updates timed out")},async refreshExtensions(s){const i=en(e,"Refresh extensions failed");return ft(i.refreshExtensions(s),"Refresh extensions timed out")},async enableExtension(s,i,o){const a=en(e,"Enable extension failed");return ft(a.enableExtension(s,i,o),"Enable extension timed out")},async disableExtension(s,i,o){const a=en(e,"Disable extension failed");return ft(a.disableExtension(s,i,o),"Disable extension timed out")},async updateExtension(s,i){const o=en(e,"Update extension failed");return ft(o.updateExtension(s,i),"Update extension timed out")},async uninstallExtension(s,i){const o=en(e,"Uninstall extension failed");return ft(o.uninstallExtension(s,i),"Uninstall extension timed out")},async startDeviceFlow(s){const i=en(e,"Start device flow failed");return ft(i.startDeviceFlow({providerId:s}),"Start device flow timed out")},async getDeviceFlow(s,i){const o=en(e,"Get device flow failed");return ft(o.getDeviceFlow(s,i),"Get device flow timed out")},async cancelDeviceFlow(s){const i=en(e,"Cancel device flow failed");return ft(i.cancelDeviceFlow(s),"Cancel device flow timed out")},async getAuthStatus(){const s=en(e,"Get auth status failed");return ft(s.getAuthStatus(),"Get auth status timed out")},async getAuthProviders(){const s=en(e,"Get auth providers failed");return ft(s.getAuthProviders(),"Get auth providers timed out")},async installAuthProvider(s){const i=en(e,"Install auth provider failed");return ft(i.installAuthProvider(s),"Install auth provider timed out")},async deleteModel(s){const i=en(e,"Delete model failed");return ft(i.deleteModel(s),"Delete model timed out")},async addWorkspace(s,i){const o=en(e,"Add workspace failed");return ft(o.addWorkspace(s,i),"Add workspace timed out")},async removeWorkspace(s,i){const a=en(e,"Remove workspace failed").workspaceById(s).remove(i);return(i==null?void 0:i.timeoutMs)===0?a:ft(a,"Remove workspace timed out",i==null?void 0:i.timeoutMs)}}}function en(e,t){const n=e();if(!n)throw new Error(`${t}: DaemonClient is not connected`);return n}function a5(e){const t=e();if(!t)throw new Error("Daemon workspace is not connected");return t}function q1(e,t=""){return e?`/workspaces/${encodeURIComponent(e)}/scheduled-tasks${t}`:`/scheduled-tasks${t}`}function H1(e){const t={};return e&&(t.Authorization=`Bearer ${e}`),t}function l5(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Ud(e,t){const n=eW(e),r=typeof window>"u"?"http://localhost":window.location.origin;return new URL(`${n}${t}`,r)}function Vd(e,t){return eW(t)?e.toString():`${e.pathname}${e.search}`}function eW(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 Wd(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 P9=f.createContext(void 0);let U1;function Wde({baseUrl:e,token:t,workspaceCwd:n,autoConnect:r=!0,transport:s,children:i}){const o=f.useMemo(()=>r?new j8({baseUrl:e,token:t,transport:s}):void 0,[r,e,t,s]),a=f.useRef(o);a.current=o;const l=f.useRef(void 0),u=f.useRef(void 0),d=f.useRef(n),[h,m]=f.useState(void 0),[p,g]=f.useState(r?"connecting":"idle"),[b,x]=f.useState(void 0),v=f.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));if(l.current!==o&&(l.current=o,u.current=void 0),!u.current){const T=o.capabilities().catch(S=>{throw u.current===T&&(u.current=void 0),S});u.current=T}return u.current},[o]),y=f.useCallback(()=>{if(!o)return Promise.reject(new Error("Daemon workspace client unavailable"));l.current=o;const T=o.capabilities().catch(S=>{throw u.current===T&&(u.current=void 0,x(S instanceof Error?S:new Error(String(S))),g("error")),S});return u.current=T,T.then(S=>(l.current===o&&u.current===T&&(m(S),g("connected"),x(void 0)),S))},[o]);f.useEffect(()=>{if(!o)return;g("connecting"),x(void 0),m(void 0),U1===o&&(U1=void 0);let T=!1;return v().then(S=>{T||(m(S),g("connected"))}).catch(S=>{T||(x(S instanceof Error?S:new Error(String(S))),g("error"))}),()=>{T=!0,U1=o,queueMicrotask(()=>{U1===o&&(U1=void 0,o.dispose())})}},[o,v]),d.current=(h==null?void 0:h.workspaceCwd)??n;const w=f.useMemo(()=>Vde({getClient:()=>a.current,getWorkspaceCwd:()=>d.current,baseUrl:e,token:t}),[e,t]),k=f.useMemo(()=>{if(o)return{client:o,token:t,baseUrl:e,workspaceCwd:(h==null?void 0:h.workspaceCwd)??n,status:p,error:b,capabilities:h,getCapabilities:v,refreshCapabilities:y,actions:w}},[o,t,e,n,p,b,h,v,y,w]);return c.jsx(P9.Provider,{value:k,children:i})}function pd(){const e=f.useContext(P9);if(!e)throw new Error("useDaemonWorkspace must be used within DaemonWorkspaceProvider");return e}function ko(){return pd().actions}function tW(){return f.useContext(P9)}function Gde(e){if(e.length===0)return"idle";const t=e[e.length-1];if((t==null?void 0:t.kind)==="thought"&&GD(t))return"thinking";if((t==null?void 0:t.kind)==="assistant"&&GD(t)||(t==null?void 0:t.kind)==="tool"&&KD(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"&&KD(r))return"responding"}return"idle"}function Kde(e,t){const n=Gde(e);return t==="idle"?"idle":n!=="idle"||t===void 0?n:t==="waiting"?"waiting":"responding"}function GD(e){return e.streaming===!0}function KD(e){return e.status==="running"||e.status==="in_progress"}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const $8=new Set;let q2;function YD(){return q2}function Yde(e){return $8.add(e),()=>{$8.delete(e)}}function Xde(e){q2={...e},nW()}function Qx(){q2!==void 0&&(q2=void 0,nW())}function nW(){for(const e of $8)e()}function Qde(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 z8=new Set,rW=Object.freeze([]),c5=64;let wh=rW;function XD(){return wh}function Jde(e){return z8.add(e),()=>{z8.delete(e)}}function Zde(e){const t=[...wh,{sessionId:e.sessionId,messages:[...e.messages],...e.originatorClientId?{originatorClientId:e.originatorClientId}:{}}];if(t.length>c5){const n=t.length-c5;console.debug(`[mid-turn] sidechannel buffer over ${c5}; evicting ${n} oldest batch(es)`),wh=t.slice(n)}else wh=t;sW()}function ehe(e){if(e.length===0||wh.length===0)return;const t=new Set(e),n=wh.filter(r=>!t.has(r));n.length!==wh.length&&(wh=n.length===0?rW:n,sW())}function sW(){for(const e of z8)e()}function the(e){if(!e||typeof e!="object")return;const t=e;if(t.type!==zV)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 F8=new Set,q8=new Set;let iW=0,$0=[];function nhe(){return iW}function QD(){return $0}function rhe(e){return F8.add(e),()=>{F8.delete(e)}}function she(e){return q8.add(e),()=>{q8.delete(e)}}function ihe(){iW++;for(const e of F8)try{e()}catch(t){console.error("[pendingPromptVersion] listener error",t)}}function oW(){for(const e of q8)try{e()}catch(t){console.error("[pendingPromptEvents] listener error",t)}}function ohe(e){if(e.length===0)return;const t=new Set(e),n=$0.filter(r=>!t.has(r));n.length!==$0.length&&($0=n,oW())}function ahe(e){const t=aW(e);return t?($0=[...$0,t].slice(-200),oW(),(t.type===S9||t.type===C9||t.type===T9)&&ihe(),!0):!1}function lhe(e){return aW(e)!==void 0}function aW(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===S9||n===C9||n===T9)&&typeof s.promptId=="string"||(n==="turn_complete"||n==="turn_error")&&typeof s.promptId=="string"))return e}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const lW=[404,410],che=new Set(lW);function Gb(e){return e!==void 0&&che.has(e)}function gc(e,t){return Gb(t)&&!Gb(e)?t:e}function oh(e,t){const n=HV(e);return{type:"assistant.done",reason:t,eventId:e.id,...n!==void 0?{serverTimestamp:n}:{}}}const cW=f.createContext(void 0),uW=f.createContext(void 0),O9=f.createContext(void 0),dW=f.createContext(void 0),hW=f.createContext(void 0),fW=f.createContext(void 0),B9=new Set([401,403]),uhe=new Set([...B9,...lW]),dhe=2e5,hhe={memoryVersion:0,agentsVersion:0,toolsVersion:0,settingsVersion:0,mcpVersion:0,extensionsVersion:0,artifactsVersion:0,initVersion:0,authVersion:0},fhe=Symbol("unhandled session");function mW(e){const{baseUrl:t,token:n,workspaceCwd:r,sessionId:s,clientId:i,createSessionRequest:o,maxQueued:a=1024,maxBlocks:l=dhe,suppressOwnUserEcho:u=!0,includeRawEvent:d=!1,autoConnect:h=!0,autoReconnect:m=!0,reconnectDelayMs:p=1e3,maxReconnectDelayMs:g=1e4,heartbeatIntervalMs:b=3e4,heartbeatFailureThreshold:x=3,loadWarnings:v,children:y}=e,w=tW(),k=t??(w==null?void 0:w.baseUrl),T=n??(w==null?void 0:w.token),S=r??(w==null?void 0:w.workspaceCwd),C=f.useRef(w==null?void 0:w.client);C.current=w==null?void 0:w.client;const _=f.useRef(w==null?void 0:w.capabilities);_.current=w==null?void 0:w.capabilities;const A=f.useRef(w==null?void 0:w.getCapabilities);A.current=w==null?void 0:w.getCapabilities;const M=f.useRef(!1),N=f.useRef(s).current,O=N===void 0,B=f.useRef(S);B.current=S;const $=f.useRef(S);S&&($.current=S);const P=f.useMemo(()=>wde({maxBlocks:l}),[l]),K=f.useRef(void 0),F=f.useRef(void 0),H=f.useRef(new Map),D=f.useRef(new Map),Q=f.useRef(void 0),U=f.useRef(0),j=f.useRef(void 0),ie=f.useRef(!1),oe=f.useRef({consecutiveFailures:0}),J=f.useRef(!1),V=f.useRef(void 0),se=f.useRef(new WeakSet),Z=f.useRef({suppressOwnUserEcho:u,includeRawEvent:d}),X=f.useRef({reconnectDelayMs:p,maxReconnectDelayMs:g}),te=f.useRef(v),ae=f.useRef(void 0);(!ae.current||i)&&(ae.current=i5(i)),Z.current={suppressOwnUserEcho:u,includeRawEvent:d},X.current={reconnectDelayMs:p,maxReconnectDelayMs:g},te.current=v;const xe=o==null?void 0:o.modelServiceId,Ae=o==null?void 0:o.sessionScope,Ne=f.useRef(o);Ne.current=o;const[Le,ge]=f.useState("idle"),[Oe,Nt]=f.useState(N),[Pe,Ce]=f.useState(void 0),[Zt,dt]=f.useState("load"),[Ge,St]=f.useState(0),[Y,je]=f.useState(0),[We,Te]=f.useState(0),[jt,zt]=f.useState({status:h?"connecting":"idle",...N?{sessionId:N}:{}}),bn=f.useRef(jt);bn.current=jt,f.useEffect(()=>{w!=null&&w.capabilities&&zt(Ot=>Ot.capabilities===w.capabilities?Ot:{...Ot,capabilities:w.capabilities})},[w==null?void 0:w.capabilities]);const Pn=f.useRef(0),[qe,At]=f.useState([]),he=f.useCallback(Ot=>{const fe={...Ot,id:Ot.id??`daemon-notice-${Date.now()}-${++Pn.current}`,createdAt:Ot.createdAt??Date.now()};return At(pt=>pt.some(He=>He.id===fe.id)?pt:[...pt.slice(-49),fe]),fe},[]),Be=f.useCallback(Ot=>{At(fe=>fe.filter(pt=>pt.id!==Ot))},[]),Ie=f.useCallback(()=>{At([])},[]),Ke=f.useMemo(()=>({notices:qe,dismissNotice:Be,clearNotices:Ie}),[Ie,Be,qe]),[ne,De]=f.useState(hhe),Dt=f.useRef(()=>!1),ze=f.useRef(!1);f.useEffect(()=>(ze.current=!0,()=>{ze.current=!1}),[]),f.useEffect(()=>{if(!h)return;if(!C.current&&!k){zt({status:"error",error:"DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."});return}const Ot=new AbortController;let fe=!1;return(async()=>{var He,on,Ze,Et,wn,qr,cr,Jn,Ft,dn,sr;const Rn=C.current??new j8({baseUrl:k,token:T});let Vn,Zn,kn=Oe,er=!Oe&&We>0,Ms=0,Ss=()=>!1,Hr=!1;for(;!fe&&!Ot.signal.aborted;){let rs=!1;try{let Ur=!1,Ar=!1,Un=!1,or=!1,Cs,Ls;if(!Vn){const Ye=K.current;Ye&&!Oe&&!kn&&!er&&(Vn=Ye,kn=Ye.sessionId,F.current=Ye.sessionId,or=!0)}if(!Vn){zt(Ns=>({...Ns,status:"connecting",error:void 0,errorStatus:gc(void 0,Ns.errorStatus)}));const Ye=A.current,Tn=_.current??(Ye?await Ye():await Rn.capabilities());if(fe||Ot.signal.aborted)return;Zn=Tn,ie.current=Array.isArray(Tn.features)&&Tn.features.includes("client_heartbeat");const nn=Pe??B.current??Tn.workspaceCwd;if($.current=nn,(O||J.current)&&!Oe&&!kn&&!er){const[Ns,$e,ht,Tt]=await Promise.allSettled([Rn.workspaceProviders(),Rn.workspaceSkills(),Rn.workspaceAcpStatus(),nn?Rn.workspaceByCwd(nn).workspaceGit():Rn.workspaceGit()]);Ns.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceProviders failed in deferred connect:",Ns.reason),$e.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceSkills failed in deferred connect:",$e.reason),ht.status==="rejected"&&console.warn("[DaemonSessionProvider] workspaceAcpStatus failed in deferred connect:",ht.reason);const xn=Ns.status==="fulfilled"?Ns.value:void 0,Sn=qD(xn),{commands:En,skills:pr}=HD($e.status==="fulfilled"?$e.value:void 0),yr=$e.status==="rejected"||J.current&&En.length===0;zt(ps=>({...ps,status:"connected",workspaceCwd:nn,gitBranch:Tt.status==="fulfilled"?Tt.value.branch??void 0:void 0,models:Sn.models,currentModel:Sn.currentModel,currentMode:Sn.currentMode,contextWindow:Sn.contextWindow,providers:xn,capabilities:Tn,commands:yr?ps.commands:En,skills:yr?ps.skills:pr})),ht.status==="fulfilled"&&!ht.value.channelLive&&!M.current&&(M.current=!0,(async()=>{try{const ps=await Rn.workspaceAcpPreheat(5e3);if(fe||Ot.signal.aborted||!ps.ready||bn.current.sessionId)return;const Gi=await Rn.workspaceSkills();if(fe||Ot.signal.aborted||bn.current.sessionId)return;const{commands:Ca,skills:To}=HD(Gi);zt(Ta=>Ta.sessionId?Ta:{...Ta,commands:Ca,skills:To})}catch(ps){console.warn("[DaemonSessionProvider] ACP preheat for workspace skills failed:",ps)}finally{M.current=!1}})());return}const ur=Oe&&Zt==="resume"?z1.resume:z1.load,Nr=Oe??kn,ti=i?ae.current:i5(void 0,Nr);rs=!!Oe,Nr&&zt(Ns=>({...Ns,sessionId:Nr,error:void 0,errorStatus:void 0,missingSession:!1,loadingTranscript:!0}));const dr=Oe?await ur(Rn,Oe,{workspaceCwd:nn},ti):kn?await z1.load(Rn,kn,{workspaceCwd:nn},ti):await z1.createOrAttach(Rn,{...xe!==void 0?{modelServiceId:xe}:{},...er?{sessionScope:"thread"}:Ae!==void 0?{sessionScope:Ae}:{},workspaceCwd:nn},ti);if(rs=!1,!i&&dr.clientId&&(ae.current=dr.clientId,Mk(dr.clientId,dr.sessionId)),fe||Ot.signal.aborted){WD({baseUrl:k,token:T,sessionId:dr.sessionId,clientId:dr.clientId}).catch(Ns=>console.warn("[DaemonSessionProvider] detach failed:",Ns));return}const Yo=F.current;Yo!==dr.sessionId&&Ie(),Yo!==void 0&&dr.sessionId!==Yo?(ge("idle"),ii(j),Un=!0):Yo!==void 0&&(dr.replaySnapshot.compactedReplay.length+dr.replaySnapshot.liveJournal.length>0?(ge("idle"),ii(j),Un=!0):(P.dispatch({type:"assistant.done",reason:"reconnected"}),P.getSnapshot().awaitingResync&&P.clearAwaitingResync())),Ur=Yo!==void 0&&Yo===dr.sessionId,Ar=dr.replaySnapshot.compactedReplay.length>0||dr.replaySnapshot.liveJournal.length>0;const cs=[...dr.replaySnapshot.compactedReplay,...dr.replaySnapshot.liveJournal];Cs=Ade(cs),Ls=L9(Cs),Vn=dr,kn=Vn.sessionId,er=!1,F.current=Vn.sessionId,K.current=Vn}const be=Vn,st=se.current.has(be);let Ct=be.hasActivePrompt===!0&&!st;const Bt=()=>{se.current.add(be),Ct=!1},qt=()=>Ct||H.current.has(be.sessionId);Ss=qt,Dt.current=qt,ge(qt()?"streaming":"idle");const tr=Q.current,Lr=(tr==null?void 0:tr.sessionId)===be.sessionId?tr:void 0,{compactedReplay:ss,liveJournal:Vr}=be.replaySnapshot,$n=[...ss,...Vr],An=Ar&&$n.length>0;if(Un&&!An&&P.reset(),An){const Ye={...Z.current,suppressOwnUserEcho:!1},Tn=[];for(const nn of $n)try{const ur=ZD(nn,be.clientId,Ye,zt,{updateConnection:!1});if(Tn.push(...eL(nn,ur,he,Be)),nn.type==="turn_complete"){const Nr=((He=nn.data)==null?void 0:He.stopReason)??"end_turn";Tn.push(oh(nn,Nr))}else nn.type==="turn_error"&&Tn.push(oh(nn,"error"))}catch(ur){const Nr=ur instanceof Error?ur.message:String(ur);he({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.replay_event_malformed",message:"Skipped malformed replay event",debugMessage:Nr,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed replay event:",ur)}Un&&P.reset(),Tn.length>0&&(P.dispatch(Tn),nL(Tn,De));for(const nn of $n)JD(H.current,D.current,be.sessionId,nn,P,ge,j,{requireBoundPromptId:!0});zt(nn=>({...nn,catchingUp:void 0}))}zt(Ye=>({...Ye,status:"connected",sessionId:be.sessionId,...be.clientId?{clientId:be.clientId}:{},workspaceCwd:be.workspaceCwd,displayName:UD(be.state)??(Ye.sessionId===be.sessionId?Ye.displayName:void 0),tokenUsage:Cs!==void 0?Cs:Ye.sessionId===be.sessionId?Ye.tokenUsage:void 0,tokenCount:Ls!==void 0?Ls:Ye.sessionId===be.sessionId?Ye.tokenCount??0:0,loadingTranscript:void 0,catchingUp:An?Ye.catchingUp:Ur||be.lastEventId!=null||void 0})),Lr&&(Q.current=void 0,clearTimeout(Lr.timeout),V.current===be.sessionId&&(V.current=void 0),Lr.resolve());const Er=or&&bn.current.commands!==void 0&&bn.current.skills!==void 0&&bn.current.supportedCommands!==void 0&&bn.current.context!==void 0,Pr=be.workspaceCwd?Rn.workspaceByCwd(be.workspaceCwd).workspaceGit():Rn.workspaceGit(),[de,Ee,rt,yt]=await Promise.allSettled([Er?Promise.resolve(void 0):Rn.workspaceProviders(),Er?Promise.resolve(void 0):be.supportedCommands(),Er?Promise.resolve(void 0):be.context(),Pr]),wt=(de==null?void 0:de.status)==="fulfilled"?de.value:void 0,mn=(Ee==null?void 0:Ee.status)==="fulfilled"?Ee.value:void 0,we=(rt==null?void 0:rt.status)==="fulfilled"?rt.value:void 0,Pt=(yt==null?void 0:yt.status)==="fulfilled"?yt.value.branch??void 0:void 0,yn=[(de==null?void 0:de.status)==="rejected"?(on=te.current)==null?void 0:on.models:void 0,(Ee==null?void 0:Ee.status)==="rejected"?(Ze=te.current)==null?void 0:Ze.commands:void 0,(rt==null?void 0:rt.status)==="rejected"?(Et=te.current)==null?void 0:Et.context:void 0].filter(Ye=>!!Ye),zn=qD(wt),Xn=Sde(we),Hn=Xn&&Xn.models.length>0?Xn.models:zn.models,Mr=(Xn==null?void 0:Xn.currentModel)??zn.currentModel,is=Mr===zn.currentModel?zn.contextWindow:(wn=zn.models.find(Ye=>Ye.id===Mr))==null?void 0:wn.contextWindow,ce=(Xn==null?void 0:Xn.contextWindow)??((qr=Hn.find(Ye=>Ye.id===Mr))==null?void 0:qr.contextWindow)??is,{commands:ve,skills:Fe}=YV(mn),ot=Tde(we)??zn.currentMode;zt(Ye=>Ye.sessionId!==be.sessionId?Ye:{...Ye,status:"connected",sessionId:be.sessionId,...be.clientId?{clientId:be.clientId}:{},workspaceCwd:be.workspaceCwd,commands:mn!==void 0?ve:Ye.commands,skills:mn!==void 0?Fe:Ye.skills,models:Hn.length>0?Hn:Ye.models,currentModel:Mr??Ye.currentModel,currentMode:ot??Ye.currentMode,displayName:UD(be.state)??Ye.displayName,contextWindow:ce??Ye.contextWindow,providers:wt??Ye.providers,supportedCommands:mn??Ye.supportedCommands,context:we??Ye.context,gitBranch:yt.status==="fulfilled"?Pt:Ye.gitBranch,capabilities:Zn??Ye.capabilities,loadingTranscript:void 0,catchingUp:An?Ye.catchingUp:Ur||be.lastEventId!=null||void 0}),yn.length>0&&P.dispatch(yn.map(Ye=>({type:"status",text:Ye})));let _n=!1,Yt=!1;const On=()=>{const Ye=H.current.get(be.sessionId);Ye==null||Ye.controller.abort(),H.current.delete(be.sessionId),Ct&&Bt(),ii(j),ge("idle"),P.reset(),be.setLastEventId(0),kn=be.sessionId,Yt=!0,Vn=void 0,K.current=void 0,Dt.current=()=>!1,zt(Tn=>({...Tn,status:"connecting",error:void 0,errorStatus:gc(void 0,Tn.errorStatus)}))};for await(const Ye of be.events({signal:Ot.signal,maxQueued:a})){if(((cr=K.current)==null?void 0:cr.sessionId)!==be.sessionId)break;_n||(_n=!0,Ms=0);try{const Tn=Qde(Ye);if(Tn){Xde(Tn);continue}const nn=the(Ye);nn&&Zde(nn),lhe(Ye)&&(ahe(Ye),Ye.type==="pending_prompt_started"&&(ii(j),ge("waiting")));const ur=ZD(Ye,be.clientId,Z.current,zt),Nr=eL(Ye,ur,he,Be);if(Ye.type==="state_resync_required"&&(typeof Ye.data=="object"&&Ye.data!==null?Ye.data.reason:void 0)==="epoch_reset"){On();break}if(nL(Nr,De),Nr.length>0){const $e=u5(Nr);ge(ht=>ht==="waiting"||ht==="idle"&&$e?"streaming":ht)}const ti=JD(H.current,D.current,be.sessionId,Ye,P,ge,j);let dr=!1;if(!ti&&Ct&&(Ye.type==="turn_complete"||Ye.type==="turn_error")){Bt(),dr=!0,ii(j);const $e=Ye.type==="turn_complete"?((Jn=Ye.data)==null?void 0:Jn.stopReason)??"end_turn":"error";P.dispatch(oh(Ye,$e)),qt()||ge("idle")}const cs=!qt()&&P.getSnapshot().activeAssistantBlockId!=null?Nr.filter($e=>$e.type!=="debug"):Nr;P.dispatch(cs);for(const $e of Nr)if($e.type==="prompt.cancelled"&&(Ct||$e.originatorClientId!==be.clientId)){P.dispatch(oh(Ye,"cancelled"));const ht=Ct;Bt(),dr=!0,ii(j),ht||H.current.delete(be.sessionId),qt()||ge("idle")}else $e.type==="session.replay_complete"&&(zt(ht=>({...ht,catchingUp:void 0})),P.getSnapshot().awaitingResync&&P.clearAwaitingResync(),qt()||(ii(j),P.dispatch({type:"assistant.done",reason:"replay_complete"}),ge("idle")));const Ns=!ti&&!dr&&!qt();if(Ns&&(Nr.some(ht=>ht.type==="user.text.delta")?ge("waiting"):u5(Nr)&&ge(ht=>ht==="idle"?"streaming":ht)),Ns&&Ye.type==="turn_complete"){ii(j);const $e=((Ft=Ye.data)==null?void 0:Ft.stopReason)??"end_turn";P.dispatch(oh(Ye,$e)),ge("idle")}else Ns&&Ye.type==="turn_error"?(ii(j),P.dispatch(oh(Ye,"error")),ge("idle")):Ns&&u5(Nr)&&Rde(P,j,"passive_observer",3e3,()=>ge("idle"));if(Ye.type==="state_resync_required"&&(typeof Ye.data=="object"&&Ye.data!==null?Ye.data.reason:void 0)!=="epoch_reset"){qt()||(ge("idle"),ii(j)),P.reset(),console.warn("[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",be.sessionId),Yt=!0,Vn=void 0,K.current=void 0,Dt.current=()=>!1,zt(ht=>({...ht,status:"connecting",error:void 0,errorStatus:gc(void 0,ht.errorStatus)}));break}if(Ye.type==="session_closed"&&((dn=Ye.data)==null?void 0:dn.reason)==="client_close"){Hr=!0;const $e=be.sessionId,ht=H.current.get($e);ht==null||ht.controller.abort(),H.current.delete($e),Vn=void 0,K.current=void 0;break}}catch(Tn){const nn=Tn instanceof Error?Tn.message:String(Tn);he({severity:"warning",category:"protocol",operation:"normalize_event",code:"daemon.event_malformed",message:"Skipped malformed daemon event",debugMessage:nn,recoverable:!0}),console.warn("[DaemonSessionProvider] skipped malformed daemon event:",Tn)}}if(Hr){P.dispatch({type:"assistant.done",reason:"cancelled"}),ge("idle"),ii(j),zt(Ye=>({...Ye,status:"disconnected",sessionId:void 0,error:void 0,errorStatus:void 0,missingSession:!1}));return}if(J.current){Vn=void 0,K.current=void 0,Dt.current=()=>!1;return}!fe&&!Ot.signal.aborted&&!Yt&&(((sr=K.current)==null?void 0:sr.sessionId)===be.sessionId&&(console.debug("[DaemonSessionProvider] SSE stream ended"),qt()||(ii(j),ge("idle"),P.dispatch({type:"assistant.done",reason:"stream_ended"}))),zt(Ye=>({...Ye,status:Ye.status==="error"?"error":"disconnected",error:Ye.status==="error"?Ye.error:void 0,errorStatus:gc(void 0,Ye.errorStatus)})))}catch(Ur){if(fe||Ot.signal.aborted)return;const Ar=Ur instanceof Error?Ur.message:String(Ur),Un=H2(Ur),or=Vn==null?void 0:Vn.sessionId,Cs=Che(Ur),Ls=She(Ur);if(or&&(Cs||Ls)){const st=H.current.get(or);st==null||st.controller.abort(),H.current.delete(or)}(Cs||Ls||!Ss())&&(ii(j),ge("idle"));const be=Q.current;if(be&&(be.sessionId===Oe||be.sessionId===kn)&&(V.current===be.sessionId&&(V.current=void 0),Q.current=void 0,clearTimeout(be.timeout),be.reject(Ur)),Cs||Ls){if(Vn=void 0,K.current=void 0,Cs){zt(Ct=>({...Ct,status:"error",sessionId:void 0,error:Ar,errorStatus:gc(Un,Ct.errorStatus),missingSession:!1,capabilities:Zn??Ct.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}const st=rs&&Gb(Un);console.warn("[DaemonSessionProvider] terminal session error (sessionId=%s, status=%d, message=%s)",or,Un,Ar),zt(Ct=>({...Ct,status:"disconnected",sessionId:void 0,error:Ar,errorStatus:gc(Un,Ct.errorStatus),missingSession:st||Ct.missingSession===!0,capabilities:Zn??Ct.capabilities,loadingTranscript:void 0,catchingUp:void 0}));return}else console.debug("[DaemonSessionProvider] retriable SSE error, preserving session for delta resume (sessionId=%s)",Vn==null?void 0:Vn.sessionId);if(!m){Vn=void 0,K.current=void 0,zt(st=>({...st,status:"error",error:Ar,errorStatus:gc(Un,st.errorStatus),missingSession:!1}));return}zt(st=>({...st,status:"disconnected",error:Ar,errorStatus:gc(Un,st.errorStatus),missingSession:!1,loadingTranscript:void 0}))}if(!m){K.current=void 0,zt(Ur=>({...Ur,status:"disconnected",loadingTranscript:void 0,catchingUp:void 0}));return}Ms+=1;const Hs=X.current,Us=jde(Ms,Hs.reconnectDelayMs,Hs.maxReconnectDelayMs);zt(Ur=>({...Ur,status:"disconnected",error:`Reconnecting in ${Us}ms`})),await Ide(Us,Ot.signal)}})(),()=>{const He=K.current;fe=!0,Ot.abort(),Dt.current=()=>!1,ge("idle"),ii(j);const on=(He==null?void 0:He.sessionId)===V.current,Ze=!ze.current;Q.current&&(!on||Ze)&&(clearTimeout(Q.current.timeout),Q.current.reject(new DOMException("Session load interrupted by cleanup","AbortError")),Q.current=void 0),(!on||Ze)&&(He!=null&&He.clientId)&&WD({baseUrl:k,token:T,sessionId:He.sessionId,clientId:He.clientId}).catch(Et=>console.warn("[DaemonSessionProvider] detach failed:",Et)),(!on||Ze)&&(K.current=void 0)}},[h,m,k,T,r,xe,Ae,a,P,Oe,Pe,Zt,Ge,Y,We,i,O,Ie,he,Be]),f.useEffect(()=>{if(!ie.current||jt.status!=="connected"||b<=0||x<=0||!jt.sessionId)return;oe.current.sessionId!==jt.sessionId&&(oe.current={sessionId:jt.sessionId,consecutiveFailures:0});const Ot=oe.current;let fe=!1;const pt=setInterval(()=>{const He=K.current;He&&He.heartbeat().then(()=>{fe||(Ot.consecutiveFailures>=x&&zt(on=>on.sessionId===He.sessionId?{...on,status:"connected",error:void 0,errorStatus:void 0}:on),Ot.consecutiveFailures=0,Ot.lastHttpError=void 0)}).catch(on=>{var Ze,Et,wn,qr,cr;if(fe)return;Ot.consecutiveFailures+=1;const Jn=on instanceof Error?on.message:"Session heartbeat failed",Ft=H2(on);if(Ft!==void 0){const Zn=(Ze=Ot.lastHttpError)==null?void 0:Ze.status;Ot.lastHttpError={status:gc(Ft,Zn)??Ft,message:Gb(Zn)?((Et=Ot.lastHttpError)==null?void 0:Et.message)??Jn:Jn}}if(Ot.consecutiveFailures<x)return;const dn=(wn=Ot.lastHttpError)==null?void 0:wn.status,sr=((qr=Ot.lastHttpError)==null?void 0:qr.message)??Jn,Rn=dn!==void 0&&B9.has(dn),Vn=Gb(dn);if(Rn||Vn){const Zn=He.sessionId;console.warn(Vn?"[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)":"[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",Zn,dn);const kn=H.current.get(Zn);kn==null||kn.controller.abort(),H.current.delete(Zn),ii(j),ge("idle"),((cr=K.current)==null?void 0:cr.sessionId)===Zn&&(Vn&&(J.current=!0),K.current=void 0)}zt(Zn=>Zn.sessionId===He.sessionId?{...Zn,status:Rn?"error":"disconnected",error:sr,errorStatus:gc(dn,Zn.errorStatus),missingSession:Vn,...Rn||Vn?{sessionId:void 0,loadingTranscript:void 0,catchingUp:void 0}:{}}:Zn)})},b);return()=>{fe=!0,clearInterval(pt)}},[jt.sessionId,jt.status,x,b]);const Lt=f.useMemo(()=>Ode({store:P,sessionRef:K,activePromptsRef:H,settledPromptsRef:D,pendingSessionLoadRef:Q,pendingSessionLoadIdRef:U,heartbeatSupportedRef:ie,manualSessionClearRef:J,skipNextCleanupDetachSessionIdRef:V,passiveAssistantDoneTimerRef:j,hasSessionActivePrompt:()=>Dt.current(),resetCurrentSessionActivePrompt:()=>{Dt.current=()=>!1},getCreateSessionRequest:()=>{var Ot;return{...Ne.current,sessionScope:"thread",workspaceCwd:$.current??((Ot=K.current)==null?void 0:Ot.workspaceCwd)}},createDetachedSession:(Ot,fe)=>{var pt;const He=C.current??new j8({baseUrl:k,token:T}),on={...Ne.current,sessionScope:"thread",workspaceCwd:Ot??$.current??((pt=K.current)==null?void 0:pt.workspaceCwd),...(fe==null?void 0:fe.approvalMode)!==void 0?{approvalMode:fe.approvalMode}:{},...(fe==null?void 0:fe.sourceType)!==void 0?{sourceType:fe.sourceType}:{}},Ze=i?ae.current:i5(void 0);return z1.createOrAttach(He,on,Ze)},getConnection:()=>bn.current,addNotice:he,setConnection:zt,setPromptStatus:ge,setRestoreSessionId:Nt,setRestoreWorkspaceCwd:Ce,setRestoreMode:dt,setRestoreSessionNonce:St,setAttachSessionNonce:je,setNewSessionNonce:Te}),[he,i,k,T,P]),ke=f.useRef(fhe);return f.useEffect(()=>{if(ke.current===s)return;ke.current=s;const Ot=bn.current.sessionId;if(s===Ot)return;const fe=s?Lt.loadSession(s):Ot?Lt.clearSession():void 0;fe&&fe.catch(pt=>{console.warn("[DaemonSessionProvider] controlled session transition failed:",pt)})},[Lt,s]),c.jsx(cW.Provider,{value:P,children:c.jsx(uW.Provider,{value:jt,children:c.jsx(dW.Provider,{value:Le,children:c.jsx(hW.Provider,{value:Ke,children:c.jsx(fW.Provider,{value:ne,children:c.jsx(O9.Provider,{value:Lt,children:y})})})})})})}function JD(e,t,n,r,s,i,o,a={}){var l;if(r.type!=="turn_complete"&&r.type!=="turn_error")return!1;const u=(l=r.data)==null?void 0:l.promptId;if(!u)return!1;const d=e.get(n);if(!d||a.requireBoundPromptId&&d.promptId===void 0||d.promptId!==void 0&&d.promptId!==u)return!1;ii(o);try{const h=_9(r,u);if(!h)return!1;s.dispatch(oh(r,h.stopReason)),i("idle"),d.resolve?(e.delete(n),d.resolve(h)):(e.delete(n),t.set(B8(n,u),{status:"resolved",result:h}))}catch(h){s.dispatch(oh(r,"error")),i("idle"),d.reject?(e.delete(n),d.reject(h)):(e.delete(n),t.set(B8(n,u),{status:"rejected",error:h}))}return!0}function mhe(e){return e.type==="turn_complete"}function ZD(e,t,n,r,s={}){phe(e),s.updateConnection!==!1&&Cde(e,r);const i=Wce(e,{clientId:t,suppressOwnUserEcho:n.suppressOwnUserEcho,includeRawEvent:n.includeRawEvent}),o=whe(e);return mhe(e)?o?[o]:[]:o?[...i,o]:i}function phe(e){e.type==="settings_reloaded"&&console.debug("[DaemonSessionProvider] settings reloaded:",ghe(e))}function ghe(e){const t={};if(e.id!==void 0&&(t.eventId=e.id),!Fa(e.data))return t.payload="non-object",t;const n=bhe(e.data.env),r=Kb(e.data.changedKeys),s=Kb(e.data.sessionsRefreshed),i=Kb(e.data.sessionsSkipped),o=e.data.childReloaded,a=Xc(e.data,"childError");return n&&(t.env=n),r&&(t.changedKeys=r),typeof o=="boolean"&&(t.childReloaded=o),s&&(t.sessionsRefreshed=s),i&&(t.sessionsSkipped=i),a&&(t.childError=a),t}function bhe(e){if(Fa(e))return{updatedKeys:Kb(e.updatedKeys)??[],removedKeys:Kb(e.removedKeys)??[]}}function Kb(e){if(Array.isArray(e))return e.filter(t=>typeof t=="string")}function eL(e,t,n,r){if(e.type==="session_snapshot"&&Fa(e.data)&&e.data.recordingDegraded===!1){const i=Xc(e.data,"sessionId");i&&r(`daemon.session_recording_degraded:${i}`)}const s=[];for(const i of t){if(i.type!=="error"){s.push(i);continue}if(e.type==="turn_error"){s.push(i);continue}const o=n(yhe(e,i));(o.category==="protocol"||o.category==="connection")&&console.warn("[DaemonSessionProvider] daemon notice:",o)}return s}function yhe(e,t){const n={message:t.text,debugMessage:t.text,recoverable:t.recoverable};switch(e.type){case"session_recording_degraded":case"session_snapshot":{const r=Fa(e.data)?Xc(e.data,"sessionId"):void 0;return{...n,...r?{id:`daemon.session_recording_degraded:${r}`}:{},severity:"warning",category:"system",operation:"record_session",code:"daemon.session_recording_degraded"}}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 G4(){const e=f.useContext(cW);if(!e)throw new Error("useDaemonTranscriptStore must be used within DaemonSessionProvider");return e}function jv(){const e=G4(),t=f.useCallback(()=>e.getSnapshot().blocks,[e]);return f.useSyncExternalStore(e.subscribe,t,t)}function K4(){const e=jv(),t=pW();return f.useMemo(()=>Kde(e,t),[e,t])}function Fg(){const e=f.useContext(O9);if(!e)throw new Error("useDaemonActions must be used within DaemonSessionProvider");return e}function vhe(){return f.useContext(O9)}function gd(){return f.useContext(fW)}function pW(){const e=f.useContext(dW);if(!e)throw new Error("useDaemonPromptStatus must be used within DaemonSessionProvider");return e}function il(){const e=f.useContext(uW);if(!e)throw new Error("useDaemonConnection must be used within DaemonSessionProvider");return e}function xhe(){const e=f.useContext(hW);if(!e)throw new Error("useDaemonSessionNotices must be used within DaemonSessionProvider");return e}function u5(e){return e.some(t=>t.type==="assistant.text.delta"||t.type==="thought.text.delta"||t.type==="tool.update")}function whe(e){if(e.type!=="session_update")return null;const t=Fa(e.data)?e.data:void 0,n=Fa(t==null?void 0:t.update)?t.update:Fa(e.data)?e.data:void 0;if(!n||n.sessionUpdate!=="agent_message_chunk")return null;const r=n._meta;if(!Fa(r))return null;const s=khe(r.goalStatus);if(s)return tL(e,s);const i=_he(r.goalTerminal);if(i)return tL(e,i);const o=r.stopHookLoop;if(!Fa(o))return null;const a=o.goal;return!Fa(a)||!Xc(a,"condition"),null}function tL(e,t){return{type:"status",...e.id!==void 0?{eventId:e.id}:{},...e.originatorClientId?{originatorClientId:e.originatorClientId}:{},text:"",source:"goal",data:t}}function khe(e){if(!Fa(e))return null;const t=Xc(e,"kind");if(t!=="set"&&t!=="cleared"&&t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Xc(e,"condition");if(!n)return null;const r=Yb(e,"iterations"),s=Yb(e,"durationMs"),i=Yb(e,"setAt"),o=Xc(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 _he(e){if(!Fa(e))return null;const t=Xc(e,"kind");if(t!=="achieved"&&t!=="failed"&&t!=="aborted")return null;const n=Xc(e,"condition");if(!n)return null;const r=Yb(e,"iterations"),s=Yb(e,"durationMs"),i=Xc(e,"lastReason");return{kind:t,condition:n,...r!==void 0?{iterations:r}:{},...s!==void 0?{durationMs:s}:{},...i?{lastReason:i}:{}}}function Xc(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Yb(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function nL(e,t){let n=0,r=0,s=0,i=0,o=0,a=0,l=0,u,d=0,h=0;for(const m of e)switch(m.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":case"workspace.mcp.server_changed":o+=1;break;case"workspace.extensions.changed":a+=1,u={...m.status?{status:m.status}:{},...m.source?{source:m.source}:{},...m.name?{name:m.name}:{},...m.version?{version:m.version}:{},...m.error?{error:m.error}:{},refreshed:m.refreshed,failed:m.failed};break;case"session.artifact.changed":l+=1;break;case"workspace.initialized":d+=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":h+=1;break}n+r+s+i+o+a+l+d+h!==0&&t(m=>({memoryVersion:m.memoryVersion+n,agentsVersion:m.agentsVersion+r,toolsVersion:m.toolsVersion+s,settingsVersion:m.settingsVersion+i,mcpVersion:m.mcpVersion+o,extensionsVersion:m.extensionsVersion+a,artifactsVersion:m.artifactsVersion+l,...u?{lastExtensionChange:u}:{},initVersion:m.initVersion+d,authVersion:m.authVersion+h}))}function She(e){const t=H2(e);return t!==void 0&&uhe.has(t)}function Che(e){const t=H2(e);return t!==void 0&&B9.has(t)}function H2(e){if(e instanceof ec||Fa(e)&&typeof e.status=="number")return e.status}function Fa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function bd(e,t){const{autoLoad:n=!1,enabled:r=!0}=t,[s,i]=f.useState({data:void 0,loading:!1,error:void 0}),o=f.useRef(0),a=f.useCallback(async()=>{if(!r)return;const l=++o.current;i(u=>({...u,loading:!0,error:void 0}));try{const u=await e();return l!==o.current?void 0:(i({data:u,loading:!1,error:void 0}),u)}catch(u){if(l!==o.current)return;const d=u instanceof Error?u:new Error(String(u));i(h=>({...h,loading:!1,error:d}));return}},[r,e]);return f.useEffect(()=>{!n||!r||a()},[n,r,a]),{...s,reload:a}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function qg(e,t,n){const r=f.useRef(!1);f.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 The(e={}){var t;const n=ko(),r=f.useCallback(()=>n.listAgents(),[n]),s=bd(r,e),i=gd();return qg(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 gW(e={}){const t=ko(),n=f.useCallback(()=>t.loadMcpStatus(),[t]),r=bd(n,e),s=gd();return qg(s==null?void 0:s.mcpVersion,r.reload,e.autoLoad===!0||r.data!==void 0),{...r,status:r.data,initialize:t.initializeMcp,reloadConfig:t.reloadMcp,loadTools:t.loadMcpTools,loadResources:t.loadMcpResources,restartServer:t.restartMcpServer,manageServer:t.manageMcpServer,addServer:t.addRuntimeMcpServer,removeServer:t.removeRuntimeMcpServer}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Ahe(e={}){var t;const n=ko(),r=f.useCallback(()=>n.loadMemoryStatus(),[n]),s=bd(r,e),i=gd();return qg(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 Nk(e={}){const{pageSize:t,cursor:n,archiveState:r,view:s,group:i,sourceType:o,...a}=e,l=pd(),u=vhe(),d=f.useCallback(()=>{const S={...t!==void 0?{pageSize:t}:{},...n!==void 0?{cursor:n}:{},...r!==void 0?{archiveState:r}:{},...s!==void 0?{view:s}:{},...i!==void 0?{group:i}:{},...o!==void 0?{sourceType:o}:{}};return l.actions.listSessionsPage(S)},[r,n,i,t,o,s,l.actions]),h=!!l.workspaceCwd,m=bd(d,{...a,enabled:(a.enabled??!0)&&h}),p=m.reload,g=f.useCallback(async()=>{const S=await p();return S==null?void 0:S.sessions},[p]),b=m.data,x=(b==null?void 0:b.sessions)??[],v=f.useCallback(async S=>{const C=await l.actions.deleteSession(S);return C&&g(),C},[l.actions,g]),y=f.useCallback(async S=>{const C=await l.actions.deleteSessions(S);return(C.removed.length>0||C.notFound.length>0)&&g(),C},[l.actions,g]),w=f.useCallback((S,C="html")=>l.actions.exportSession(S,C),[l.actions]),k=f.useCallback(async S=>{const C=await l.actions.archiveSession(S);return C&&g(),C},[l.actions,g]),T=f.useCallback(async S=>{const C=await l.actions.unarchiveSession(S);return C&&g(),C},[l.actions,g]);return{...m,data:b!==void 0?x:void 0,reload:g,sessions:x,nextCursor:b==null?void 0:b.nextCursor,liveMergeFailed:(b==null?void 0:b.liveMergeFailed)===!0,truncated:(b==null?void 0:b.truncated)===!0,loadSession:u==null?void 0:u.loadSession,resumeSession:u==null?void 0:u.resumeSession,newSession:u==null?void 0:u.newSession,releaseSession:u==null?void 0:u.releaseSession,deleteSession:v,deleteSessions:y,exportSession:w,archiveSession:k,unarchiveSession:T}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function H8(e={}){const{detail:t="summary",...n}=e,r=ko(),s=f.useCallback(()=>r.loadDaemonStatus(t),[r,t]),i=bd(s,n);return{...i,report:i.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Ehe(e={}){const{range:t,heatmapDays:n,...r}=e,s=ko(),i=f.useCallback(()=>s.loadUsageDashboard({range:t,heatmapDays:n}),[s,t,n]),o=bd(i,r);return{...o,dashboard:o.data}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function bW(e={}){var t;const n=ko(),r=f.useCallback(()=>n.loadToolsStatus(),[n]),s=bd(r,e),i=gd();return qg(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 yW(e={}){var t;const n=ko(),r=f.useCallback(()=>n.loadSettingsStatus(),[n]),s=bd(r,e),i=gd();return qg(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
 */function Mhe(e={}){var t,n;const r=ko(),s=f.useCallback(()=>r.loadProviders(),[r]),i=bd(s,e),o=gd();return qg(o==null?void 0:o.settingsVersion,i.reload,e.autoLoad===!0||i.data!==void 0),{...i,status:i.data,providers:((t=i.data)==null?void 0:t.providers)??[],current:(n=i.data)==null?void 0:n.current}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Nhe=300,jhe=100,s0=Object.freeze({suggestion:null,isVisible:!1,shownAt:0});function d5(e){var t;const n=e;(t=n.clearFollowupSuggestion)==null||t.call(n)}function Ihe(e){const{enabled:t=!0,onStateChange:n,getOnAccept:r,getOnOutcome:s}=e;let i=s0,o=null,a=!1,l=null;function u(x){i=x,n(x)}function d(){o&&(clearTimeout(o),o=null),l&&(clearTimeout(l),l=null)}return{setSuggestion:x=>{if(o&&(clearTimeout(o),o=null),!x){u(s0);return}t&&(o=setTimeout(()=>{u({suggestion:x,isVisible:!0,shownAt:Date.now()})},Nhe))},accept:(x,v)=>{var y;if(a)return;o&&(clearTimeout(o),o=null),a=!0;const w=i.suggestion,{shownAt:k}=i;if(!w){a=!1;return}try{(y=s())==null||y({outcome:"accepted",accept_method:x,time_ms:k>0?Date.now()-k:0,suggestion_length:w.length})}catch(T){console.error("[followup] onOutcome callback threw:",T)}u(s0),queueMicrotask(()=>{var T;try{v!=null&&v.skipOnAccept||(T=r())==null||T(w)}catch(S){console.error("[followup] onAccept callback threw:",S)}finally{l&&clearTimeout(l),l=setTimeout(()=>{a=!1},jhe)}})},dismiss:()=>{var x;if(o&&(clearTimeout(o),o=null),!(!i.isVisible&&!i.suggestion)){if(i.isVisible&&i.suggestion)try{(x=s())==null||x({outcome:"ignored",time_ms:i.shownAt>0?Date.now()-i.shownAt:0,suggestion_length:i.suggestion.length})}catch(v){console.error("[followup] onOutcome callback threw:",v)}u(s0)}},clear:()=>{d(),a=!1,u(s0)},cleanup:()=>{d(),a=!1}}}function vW(e={}){const{enabled:t=!0,onAccept:n,onOutcome:r}=e,s=G4(),i=il().sessionId,[o,a]=f.useState(s0),l=f.useRef(n);l.current=n;const u=f.useRef(r);u.current=r;const d=f.useSyncExternalStore(s.subscribe,()=>s.getSnapshot().lastFollowupSuggestion,()=>s.getSnapshot().lastFollowupSuggestion),h=f.useSyncExternalStore(Yde,YD,YD),m=(h==null?void 0:h.sessionId)===i?h:d,p=f.useMemo(()=>Ihe({enabled:t,onStateChange:a,getOnAccept:()=>l.current,getOnOutcome:()=>u.current}),[t]),{setSuggestion:g}=p;f.useEffect(()=>(t||p.clear(),()=>p.cleanup()),[p,t]);const b=f.useRef(void 0),x=f.useRef(i);f.useEffect(()=>{const k=x.current;x.current=i,k!==void 0&&i!==void 0&&k!==i&&(p.clear(),Qx(),b.current=void 0)},[p,i]),f.useEffect(()=>{const k=m==null?void 0:m.promptId;k!==b.current&&(b.current=k,g((m==null?void 0:m.suggestion)??null))},[m,g]);const v=f.useCallback(()=>{p.clear(),d5(s),Qx(),b.current=void 0},[p,s]),y=f.useCallback((k,T)=>{p.accept(k,T),d5(s),Qx(),b.current=void 0},[p,s]),w=f.useCallback(()=>{p.dismiss(),d5(s),Qx(),b.current=void 0},[p,s]);return f.useMemo(()=>({followupState:o,onAcceptFollowup:y,onDismissFollowup:w,clear:v}),[o,y,w,v])}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Rhe(){const e=f.useSyncExternalStore(Jde,XD,XD),t=f.useCallback(n=>ehe(n),[]);return{batches:e,consume:t}}const rL=[];function Dhe(e,t){return e===t?!1:e.length!==t.length?!0:e.some((n,r)=>!Object.is(n,t[r]))}class ld extends f.Component{constructor(){super(...arguments);Me(this,"state",{error:null,resetKeys:this.props.resetKeys??rL});Me(this,"reset",()=>{this.setState({error:null})})}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,r){const s=n.resetKeys??rL;return Dhe(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 sL={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:"重试"}},Lhe={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0.75rem",padding:"2rem",minHeight:"8rem",height:"100%",textAlign:"center",color:"inherit"},Phe={margin:0,fontSize:"1rem",fontWeight:600},Ohe={margin:0,fontSize:"0.85rem",opacity:.7,maxWidth:"32rem"},Bhe={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 $he({error:e,onRetry:t,language:n="en"}){const r=sL[n]??sL.en;return c.jsxs("div",{role:"alert",style:Lhe,"data-web-shell-error":!0,children:[c.jsx("p",{style:Phe,children:r.title}),c.jsx("p",{style:Ohe,children:r.body}),!1,c.jsx("button",{type:"button",style:Bhe,onClick:t,children:r.retry})]})}/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xW=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zhe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fhe=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iL=e=>{const t=Fhe(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var h5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qhe=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},Hhe=f.createContext({}),Uhe=()=>f.useContext(Hhe),Vhe=f.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...a},l)=>{const{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:h=!1,color:m="currentColor",className:p=""}=Uhe()??{},g=r??h?Number(n??d)*24/Number(t??u):n??d;return f.createElement("svg",{ref:l,...h5,width:t??u??h5.width,height:t??u??h5.height,stroke:e??m,strokeWidth:g,className:xW("lucide",p,s),...!i&&!qhe(a)&&{"aria-hidden":"true"},...a},[...o.map(([b,x])=>f.createElement(b,x)),...Array.isArray(i)?i:[i]])});/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ln=(e,t)=>{const n=f.forwardRef(({className:r,...s},i)=>f.createElement(Vhe,{ref:i,iconNode:t,className:xW(`lucide-${zhe(iL(e))}`,`lucide-${e}`,r),...s}));return n.displayName=iL(e),n};/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Whe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ghe=Ln("activity",Whe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Khe=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],Yhe=Ln("archive-restore",Khe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xhe=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],oL=Ln("archive",Xhe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qhe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],wW=Ln("arrow-left",Qhe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jhe=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],Zhe=Ln("blocks",Jhe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const efe=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],kW=Ln("bot",efe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tfe=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],nfe=Ln("box",tfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rfe=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],sfe=Ln("calendar-clock",rfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ife=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ofe=Ln("check",ife);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const afe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vl=Ln("chevron-down",afe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lfe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Y4=Ln("chevron-right",lfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cfe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ufe=Ln("chevron-up",cfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Nc=Ln("circle-alert",dfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hfe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ffe=Ln("columns-2",hfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mfe=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],pfe=Ln("command",mfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gfe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],U8=Ln("database",gfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bfe=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],yfe=Ln("download",bfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vfe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Xb=Ln("ellipsis-vertical",vfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xfe=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],wfe=Ln("file-text",xfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kfe=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],_fe=Ln("flask-conical",kfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sfe=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]],jk=Ln("folder-closed",Sfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cfe=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],Tfe=Ln("folder-input",Cfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Afe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Efe=Ln("folder-open",Afe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mfe=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]],Nfe=Ln("folder-x",Mfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],V8=Ln("info",jfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ife=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Rfe=Ln("layout-grid",Ife);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dfe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Lfe=Ln("loader-circle",Dfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pfe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],_W=Ln("maximize-2",Pfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ofe=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],SW=Ln("minimize-2",Ofe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bfe=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],$fe=Ln("moon",Bfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zfe=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],aL=Ln("package",zfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ffe=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],qfe=Ln("palette",Ffe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hfe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Ufe=Ln("panel-left-close",Hfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vfe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],Wfe=Ln("panel-left-open",Vfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gfe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],CW=Ln("pencil",Gfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kfe=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Yfe=Ln("pin",Kfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xfe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],U2=Ln("plus",Xfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qfe=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ik=Ln("refresh-cw",Qfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jfe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Um=Ln("search",Jfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zfe=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],z0=Ln("server",Zfe);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eme=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],TW=Ln("settings-2",eme);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tme=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],nme=Ln("settings",tme);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rme=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],sme=Ln("shield",rme);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ime=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],ome=Ln("sliders-horizontal",ime);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ame=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],lme=Ln("sparkles",ame);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cme=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],lL=Ln("square-pen",cme);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ume=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],dme=Ln("sun",ume);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hme=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Qb=Ln("trash-2",hme);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fme=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],cL=Ln("wifi-off",fme);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mme=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],W8=Ln("wrench",mme);/**
 * @license lucide-react v1.24.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pme=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],AW=Ln("x",pme);function G8(e){for(const t of e){if(!gme(t))continue;const n=t;if(n.resolved)continue;const r=w0(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=w0(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:yme(l.raw)})),rawInput:bme(n.toolCall)}}return null}function gme(e){return e.kind==="permission"}function bme(e){const t=w0(e);return t?w0(t.rawInput)??w0(t.input)??w0(t.args)??t:void 0}function w0(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function yme(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 vme(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 u=s[l];if(!u){const d=t[l*2];u=s[l]={index:l,key:n(l),start:d,size:t[l*2+1],end:d+t[l*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(s,i,o)}})}function $p(e,t,n){let r=n.initialDeps??[],s,i=!0;function o(){const a=e();return(a.length!==r.length||a.some((u,d)=>r[d]!==u))&&(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 uL(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const xme=(e,t)=>Math.abs(e-t)<1.01,wme=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};let V1;const f5=()=>{if(V1!==void 0)return V1;if(typeof navigator>"u")return V1=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return V1=!0;const e=navigator.maxTouchPoints;return V1=navigator.platform==="MacIntel"&&e!==void 0&&e>0},dL=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},kme=e=>e,_me=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},Sme=(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(dL(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const u=l.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(dL(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},V2={passive:!0},Cme=typeof window>"u"?!0:"onscrollend"in window,Tme=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const s=e.targetWindow;if(!s)return;const i=e.options.useScrollendEvent&&Cme;let o=0;const a=i?null:wme(s,()=>t(o,!1),e.options.isScrollingResetDelay),l=h=>()=>{o=n(r),a==null||a(),t(o,h)},u=l(!0),d=l(!1);return r.addEventListener("scroll",u,V2),i&&r.addEventListener("scrollend",d,V2),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",d)}},Ame=(e,t)=>Tme(e,t,n=>{const{horizontal:r,isRtl:s}=e.options;return r?n.scrollLeft*(s&&-1||1):n.scrollTop}),Eme=(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"]},Mme=(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})},Nme=Mme;class jme{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[u,d]of this.elementsCache)if(d===a){this.elementsCache.delete(u);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:kme,rangeExtractor:_me,onChange:()=>{},measureElement:Eme,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 m in n){const p=n[m];p!==void 0&&(i[m]=p)}const o=this.options;let a=null,l=null,u=!1;if(o!==void 0&&o.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const m=o.count,p=i.count,g=this.getMeasurements(),b=m>0?((r=g[0])==null?void 0:r.key)??o.getItemKey(0):null,x=m>0?((s=g[m-1])==null?void 0:s.key)??o.getItemKey(m-1):null;if(p!==m||m>0&&p>0&&(i.getItemKey(0)!==b||i.getItemKey(p-1)!==x)){u=!0;const w=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??g[0]:null;w&&(a=[w.key,this.getScrollOffset()-w.start]);const k=i.followOnAppend===!0?"auto":i.followOnAppend||null;k&&p>m&&this.isAtEnd(o.scrollEndThreshold)&&(m===0||i.getItemKey(p-1)!==x)&&(l=k)}}this.options=i,u&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,h=0;if(a&&this.scrollOffset!==null){const[m,p]=a,g=this.getMeasurements(),{count:b,getItemKey:x}=this.options;let v=0;for(;v<b&&x(v)!==m;)v++;if(v<b){const y=g[v];if(y){const w=y.start+p;w!==this.scrollOffset&&(h=w-this.scrollOffset,this.scrollOffset=w,d=!0)}}}(d||l)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,l,h])},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=$p(()=>(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,!(!f5()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",o,V2),i.addEventListener("touchend",a,V2),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&&(f5()&&(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=$p(()=>[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=$p(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o,lanes:a,laneAssignmentMode:l},u)=>{const d=this.itemSizeCache;if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const g of this.laneAssignments.keys())g>=n&&this.laneAssignments.delete(g);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(g=>{this.itemSizeCache.set(g.key,g.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const g=this.options.gap,b=n*2;let x=this._flatMeasurements;if(!x||x.length<b){const w=new Float64Array(b);x&&h>0&&w.set(x.subarray(0,h*2)),x=w,this._flatMeasurements=x}let v;if(h===0)v=r+s;else{const w=h-1;v=x[w*2]+x[w*2+1]+g}for(let w=h;w<n;w++){const k=i(w),T=d.get(k),S=typeof T=="number"?T:this.options.estimateSize(w);x[w*2]=v,x[w*2+1]=S,v+=S+g}const y=vme(n,x,i);return this.measurementsCache=y,y}const m=this.measurementsCache.slice(0,h),p=new Array(a).fill(void 0);for(let g=0;g<h;g++){const b=m[g];b&&(p[b.lane]=g)}for(let g=h;g<n;g++){const b=i(g),x=this.laneAssignments.get(g);let v,y;const w=l==="estimate"||d.has(b);if(x!==void 0&&this.options.lanes>1){v=x;const C=p[v],_=C!==void 0?m[C]:void 0;y=_?_.end+this.options.gap:r+s}else{const C=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);y=C?C.end+this.options.gap:r+s,v=C?C.lane:g%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(g,v)}const k=d.get(b),T=typeof k=="number"?k:this.options.estimateSize(g),S=y+T;m[g]={index:g,start:y,size:T,end:S,key:b,lane:v},p[v]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=$p(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?Ime({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=$p(()=>{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 u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)l=this.options.getItemKey(n),a=u[n*2],o=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;l=m.key,a=m.start,o=m.size}const d=this.itemSizeCache.get(l)??o,h=r-d;if(h!==0){const m=this.options.anchorTo==="end"&&((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?this.getTotalSize():0,g=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:a,size:o,end:a+o,lane:0},h,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(l,r),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=$p(()=>[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=EW(0,r.length-1,i?a=>s[a*2]:a=>uL(r[a]).start,n);return uL(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&&(f5()&&(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&&xme(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()),u=this.scrollState.behavior==="smooth"&&l>a;this.scrollState.lastTargetOffset=s,u||(this.scrollState.behavior="auto"),this._scrollToOffset(s,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const EW=(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 Ime({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:s}){const i=e.length-1,o=s?d=>s[d*2]:d=>e[d].start,a=s?d=>s[d*2]+s[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:i};let l=EW(0,i,o,n),u=l;if(r===1)for(;u<i&&a(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<i&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const h=Array(r).fill(n+t);for(;l>=0&&h.some(m=>m>=n);){const m=e[l];h[m.lane]=m.start,l--}l=Math.max(0,l-l%r),u=Math.min(i,u+(r-1-u%r))}return{startIndex:l,endIndex:u}}const m5=typeof document<"u"?f.useLayoutEffect:f.useEffect;function Rme({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const s=f.useReducer(u=>u+1,0)[1],i=f.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});i.current.enabled=t,i.current.mode=n;const o=u=>{const d=i.current;if(!d.enabled)return;const h=u.getTotalSize();if(d.container&&h!==d.lastSize){d.lastSize=h;const v=u.options.horizontal?"width":"height";d.container.style[v]=`${h}px`}const m=!!u.options.horizontal,p=d.mode==="transform",g=m?"left":"top",b=u.options.scrollMargin,x=u.getVirtualItems();for(const v of x){const y=v.start-b,w=u.elementsCache.get(v.key);w&&d.lastPositions.get(w)!==y&&(d.lastPositions.set(w,y),p?w.style.transform=m?`translate3d(${y}px, 0, 0)`:`translate3d(0, ${y}px, 0)`:w.style[g]=`${y}px`)}},a={...r,onChange:(u,d)=>{var h;const m=i.current;let p=!0;if(m.enabled){o(u);const g=u.range,b=m.prevRange;p=!b||b.isScrolling!==u.isScrolling||b.startIndex!==(g==null?void 0:g.startIndex)||b.endIndex!==(g==null?void 0:g.endIndex),p&&(m.prevRange=g?{startIndex:g.startIndex,endIndex:g.endIndex,isScrolling:u.isScrolling}:null)}p&&(e&&d?rc.flushSync(s):s()),(h=r.onChange)==null||h.call(r,u,d)}},[l]=f.useState(()=>{const u=new jme(a);return Object.assign(u,{containerRef:d=>{const h=i.current;if(h.container=d,h.lastSize=null,d&&h.enabled){const m=u.getTotalSize();h.lastSize=m;const p=u.options.horizontal?"width":"height";d.style[p]=`${m}px`}}})});return l.setOptions(a),m5(()=>l._didMount(),[]),m5(()=>l._willUpdate()),m5(()=>{o(l)}),l}function Dme(e){return Rme({observeElementRect:Sme,observeElementOffset:Ame,scrollToFn:Nme,...e})}function MW(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Lme(e){var t;return((t=MW(e))==null?void 0:t.type)==="task_execution"}function X4(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||Lme(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function NW(e){var n;if(!X4(e))return!1;const t=MW(e.rawOutput);return(t==null?void 0:t.status)==="background"||((n=e.args)==null?void 0:n.run_in_background)===!0}const jW=f.createContext({}),hL=jW.Provider;function ou(){return f.useContext(jW)}const Pme=["en","zh-CN"],$9={"git.currentBranch":e=>`Current Git branch: ${(e==null?void 0:e.branch)??""}`,"workspace.paneLabel":e=>`Workspace: ${(e==null?void 0:e.name)??""}`,"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.noMatches":"No matching 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.detail.overview":"Basic Information","agent.detail.tools":"Tools","agent.detail.systemPrompt":"System Prompt","agent.toolsUpdated":e=>`Updated tools for ${(e==null?void 0:e.name)??""}`,"agent.usingCount":e=>`Using: ${(e==null?void 0:e.count)??0} agents`,"agent.view":"View","agents.closed":"Agents panel closed.","agents.title":"Agents","subagent.result":"Result","subagent.tools":e=>`Tools (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} tools`,"subagent.toggleStream":"Toggle agent stream details","subagent.pending":"pending","subagent.running":"running","timeline.parallelAgents":"Parallel agents","timeline.thinking":"Thinking","timeline.assistantUpdate":"Assistant update","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool call${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.planUpdate":"Plan update","timeline.statusUpdate":"Status update","timeline.userTurn":"User turn","timeline.planDetail":"plan update","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} parallel agent${(e==null?void 0:e.count)===1?"":"s"}`,"timeline.noActivity":"No activity","timeline.sessionTimeline":"Session timeline","timeline.turnPrefix":e=>`Turn ${(e==null?void 0:e.index)??0}`,"timeline.currentTurn":"Current turn","timeline.kind.thought":"thinking","timeline.kind.commentary":"assistant update","timeline.kind.tool":"tool calls","timeline.kind.agents":"parallel agents","timeline.kind.plan":"plan update","timeline.kind.status":"status update","timeline.kind.none":"turn","common.copy":"Copy","common.open":"Open","common.na":"N/A","common.server":"Server","common.agent":"Agent","common.auto":"auto","common.runtime":"Runtime","common.failedToLoad":"Failed to load","auth.notSet":"(not set)","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"model-id-1, model-id-2","model.usingModel":e=>`Using ${e!=null&&e.isRuntime?"runtime ":""}model: ${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid (error)","user.uploadedImage":e=>`User uploaded image ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"No speech detected.","voice.stopDictation":"Stop dictation","voice.transcribing":"Transcribing…","voice.starting":"Starting…","voice.errorRetry":e=>`Voice error — click to retry${e!=null&&e.message?`: ${e.message}`:""}`,"voice.noSpeechRetry":"No speech detected — click to retry","voice.startDictation":"Start voice dictation","voice.error":"Voice error","resume.failedToLoad":"Failed to load sessions","toast.dismiss":"Dismiss notification","toast.dismissShort":"Dismiss","insight.ready":"Insight report generated successfully!","request.cancelled":"Request cancelled.","approval.execQuestion":e=>`Allow execution of: '${(e==null?void 0:e.tool)??""}'?`,"approval.changeQuestion":"Apply this change?","approval.launchAgentQuestion":"Launch this agent?","approval.option.allowOnce":"Yes, allow once","approval.option.rejectOnce":"Reject","approval.option.allowAllEdits":"Allow All Edits","approval.option.allowAlwaysProject":"Always allow in this project","approval.option.allowAlwaysUser":"Always allow for this user","approval.option.allowAlwaysServer":"Always allow for this server","approval.option.allowAlwaysTool":"Always allow for this tool","assistant.branch":"Branch","assistant.copy":"Copy","at.category.extensions":"Extensions","at.category.extensions.description":"Reference active extensions","at.category.files":"Files","at.category.files.description":"Reference workspace files","at.category.mcpResources":"MCP resources","at.category.mcpResources.description":"Reference MCP server resources","at.menu":"Reference menu","common.back":"back","common.all":"All","common.cancel":"cancel","common.close":"close","common.fullscreen":"Fullscreen","common.exitFullscreen":"Exit fullscreen","common.continue":"continue","common.current":"current","common.disabled":"disabled","common.enabled":"enabled","common.enterSelect":"Enter to select","common.invalid":"invalid","common.loading":"Loading...","common.retry":"Try again","common.save":"save","common.navigate":"↑↓ to navigate","common.next":"next","common.noResults":"No results","common.previous":"previous","common.expand":"Expand","common.collapse":"Collapse","common.refresh":"refresh","common.search":"Search","common.valid":"valid","common.clients":e=>`${(e==null?void 0:e.count)??0} clients`,"agent.count":e=>`${(e==null?void 0:e.count)??0} agents`,"askUser.submit":"Submit","askUser.ignore":"Ignore","askUser.multiHint":"multiple choice","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} questions`,"askUser.selectAnswer":"Select an answer","askUser.typePlaceholder":"Type something...","copy.failedFallback":"Failed to copy to the clipboard","copy.inlineLatexMissing":"No matching inline LaTeX expression found in the last AI output.","copy.latexMissing":"No matching LaTeX block found in the last AI output.","copy.noOutput":"No output in history","copy.noText":"Last AI output contains no text to copy.","copy.codeMissing":"No matching code block found in the last AI output.","copy.outputCopied":"Last output copied to the clipboard","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"Selection"} copied to the clipboard`,"code.copy":"Copy","code.copied":"Copied!","echartsChart.defaultTitle":"Chart Loading","echartsChart.noData":"No data","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows and ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:n>0?`Showing ${(e==null?void 0:e.visibleColumns)??0} of ${(e==null?void 0:e.totalColumns)??0} columns`:`Showing ${(e==null?void 0:e.visibleRows)??0} of ${(e==null?void 0:e.totalRows)??0} rows`},"echartsChart.rendering":"Rendering chart","echartsChart.runtimeUnavailable":"Chart runtime is unavailable.","echartsChart.renderFailed":"Chart render failed.","echartsChart.viewMode":"View mode","echartsChart.showChart":"Show chart","echartsChart.showData":"Show data","echartsChart.chart":"Chart","echartsChart.data":"Data","markdownTable.blank":"(blank)","markdownTable.column":e=>`Column ${(e==null?void 0:e.index)??""}`,"markdownTable.rows":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} row${t===1?"":"s"}`},"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} rows`,"markdownTable.hint":"Click headers to sort, open filters from ▾.","markdownTable.filtersActive":e=>{const t=Number((e==null?void 0:e.count)??0);return`${t} filter${t===1?"":"s"}`},"markdownTable.selection.selected":"Selected","markdownTable.selection.nonEmpty":"Non-empty","markdownTable.selection.numeric":"Numeric","markdownTable.selection.sum":"Sum","markdownTable.selection.average":"Average","markdownTable.selection.min":"Min","markdownTable.selection.max":"Max","markdownTable.copyTsv":"Copy TSV","markdownTable.copyVisible":"Quick copy","markdownTable.freezeFirstColumn":"Freeze first column","markdownTable.unfreezeFirstColumn":"Unfreeze first column","markdownTable.density":e=>`Density: ${(e==null?void 0:e.density)??""}`,"markdownTable.density.standard":"Standard","markdownTable.density.compact":"Compact","markdownTable.density.comfortable":"Comfortable","markdownTable.expandLongText":"Expand text","markdownTable.collapseLongText":"Collapse text","markdownTable.emptyValue":"(blank)","markdownTable.hideColumn":"Hide column","markdownTable.showHiddenColumns":e=>{const t=Number((e==null?void 0:e.count)??0);return`Show ${t} hidden column${t===1?"":"s"}`},"markdownTable.moveColumn":e=>`Move ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`Resize ${(e==null?void 0:e.column)??""}`,"markdownTable.rowDetails":"Details","markdownTable.rowDetailsAria":e=>`View details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.closeRowDetailsAria":e=>`Hide details for row ${(e==null?void 0:e.index)??""}`,"markdownTable.detailsHeader":"Row details","markdownTable.cellDialogTitle":"Current field value","markdownTable.copyCell":"Copy","markdownTable.close":"Close","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":"⊞","mermaid.zoomIn":"+","mermaid.zoomOut":"−","mermaid.zoomReset":"↺","contextUsage.active":"active","contextUsage.autocompactBuffer":"Autocompact buffer","contextUsage.bodyLoaded":"body loaded","contextUsage.builtinTools":"Built-in tools","contextUsage.contextWindow":"Context window","contextUsage.detailHint":"Run /context detail for per-item breakdown.","contextUsage.estimatedOverhead":"Estimated pre-conversation overhead","contextUsage.free":"Free","contextUsage.memoryFiles":"Memory files","contextUsage.messages":"Messages","contextUsage.mcpTools":"MCP tools","contextUsage.model":"Model","contextUsage.noSession":"No active session yet. Send your first message before viewing context usage.","contextUsage.noApiResponse":"No API response yet. Send a message to see actual usage.","contextUsage.overLimit":"Context exceeds limit! Use /compress or /clear to reduce.","contextUsage.skills":"Skills","contextUsage.systemPrompt":"System prompt","contextUsage.title":"Context Usage","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"Usage by category","contextUsage.used":"Used","daemon.title":"Daemon Status","daemon.details.loading":"Loading diagnostics...","daemon.details.failed":"Failed to load diagnostics.","daemon.refresh":"Refresh","daemon.loading":"Loading daemon status...","daemon.loadFailed":"Failed to load daemon status","daemon.updatedAt":e=>`Updated ${(e==null?void 0:e.time)??""}`,"daemon.none":"none","daemon.level.ok":"OK","daemon.level.warning":"Warning","daemon.level.error":"Error","daemon.level.unavailable":"Unavailable","daemon.issues.title":"Issues","daemon.overview.title":"Daemon","daemon.overview.version":"Version","daemon.overview.pid":"PID","daemon.overview.mode":"Mode","daemon.overview.uptime":"Uptime","daemon.overview.workspace":"Workspace","daemon.runtime.title":"Runtime","daemon.runtime.activeSessions":"Active sessions","daemon.runtime.activePrompts":"Active prompts","daemon.runtime.idle":"Idle for","daemon.runtime.noActivity":"no activity yet","daemon.runtime.pendingPermissions":"Pending permissions","daemon.runtime.permissionPolicy":"Permission policy","daemon.runtime.channel":"ACP channel","daemon.runtime.channelLive":"live","daemon.runtime.channelDown":"down","daemon.runtime.startingUp":"Runtime is starting...","daemon.runtime.startFailed":"Runtime failed to start","daemon.runtime.channelWorker":"Channel worker","daemon.runtime.channelWorkerRestarts":"Worker restarts","daemon.runtime.memory":"Memory (RSS / heap)","daemon.transport.title":"Transport","daemon.transport.restSse":"REST SSE streams","daemon.transport.acpDisabled":"ACP transport disabled","daemon.transport.acpConnections":"ACP connections","daemon.transport.acpStreams":"ACP streams (session/SSE/WS)","daemon.transport.pendingRequests":"Pending client requests","daemon.transport.rateLimitRejected":"Rate-limit rejects","daemon.security.title":"Security","daemon.security.token":"Bearer token","daemon.security.requireAuth":"Require auth","daemon.security.loopback":"Loopback bind","daemon.security.allowOrigin":"Allowed origins","daemon.security.shell":"Session shell commands","daemon.security.configured":"configured","daemon.security.notConfigured":"not configured","daemon.limits.title":"Limits","daemon.limits.unlimited":"unlimited","daemon.limits.maxSessions":"Max sessions","daemon.limits.maxPendingPrompts":"Max pending prompts / session","daemon.limits.maxConnections":"Max listener connections","daemon.limits.eventRing":"Event ring size","daemon.limits.promptDeadline":"Prompt deadline","daemon.limits.sessionIdle":"Session idle timeout","daemon.capabilities.title":"Capabilities","daemon.capabilities.titleCount":e=>`Capabilities (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"Sessions","daemon.full.sessions.empty":"No active sessions","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} pending prompts`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} pending permissions`,"daemon.full.session.prompting":"prompting","daemon.full.workspace.title":"Workspace Diagnostics","daemon.full.workspace.empty":"No workspace diagnostics reported","daemon.full.auth.title":"Auth","daemon.full.auth.providers":"Device-flow providers","daemon.full.auth.pending":"Pending device flows","daemon.full.acp.title":"ACP connections","daemon.tab.overview":"Overview","daemon.tab.usage":"Usage","daemon.tab.metrics":"Metrics","daemon.tab.diagnostics":"Diagnostics","daemon.charts.title":"Metrics","daemon.charts.empty":"Collecting metrics… charts appear after the first sample.","daemon.charts.concurrency":"Concurrency","daemon.charts.activePrompts":"Active tasks","daemon.charts.activeSessions":"Sessions","daemon.charts.requests":"Requests","daemon.charts.reqTotal":"Total","daemon.charts.reqErrors":"Errors","daemon.charts.apiLatency":"API latency","daemon.charts.promptLatency":"Prompt latency","daemon.charts.queueWait":"Queue wait","daemon.charts.promptDuration":"Duration","daemon.charts.eventLoop":"Event-loop lag","daemon.charts.eventLoopLag":"Lag p99","daemon.charts.queuedPrompts":"Queued","daemon.charts.reqRejected":"Rejected","daemon.charts.llmLatency":"LLM API latency","daemon.charts.apiHealth":"Model API health","daemon.charts.apiErrors":"API errors","daemon.charts.apiRetries":"Retries","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC pipe","daemon.charts.pipeIn":"In","daemon.charts.pipeOut":"Out","daemon.charts.connections":"Connections","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"Child","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"Child RSS","daemon.charts.memory":"Memory","daemon.charts.heap":"Heap","daemon.charts.tokens":"Token burn","daemon.charts.tokensIn":"Input","daemon.charts.tokensOut":"Output","daemon.charts.peak":"peak","daemon.charts.concurrency.help":"Live load at each sample: prompts running now, prompts queued (accepted but not yet dispatched), and active sessions. Queued rising above active is backpressure.","daemon.charts.requests.help":"Client↔daemon HTTP traffic per window — NOT model calls. Total requests, those returning 4xx/5xx, and those the rate limiter rejected.","daemon.charts.apiLatency.help":"Client↔daemon HTTP request duration (p50/p95) — how fast the daemon answers, not the model. Compare with LLM API latency to separate 'we are slow' from 'the model is slow'.","daemon.charts.llmLatency.help":"Per-round model API round-trip (daemon→model→daemon), p50/p95. Model-side latency, distinct from the HTTP API latency above.","daemon.charts.apiHealth.help":"Provider-side LLM failures. Each failed attempt = 1 error; each automatic backoff = 1 retry. Transient 429/5xx are usually absorbed by retries (errors ≈ retries); errors climbing above retries means calls are failing outright.","daemon.charts.promptLatency.help":"Per prompt (task): p95 time waiting in the per-session queue before dispatch, and p95 end-to-end run time. Rising queue wait signals backpressure.","daemon.charts.eventLoop.help":"Daemon event-loop lag p99 per window — the CPU-saturation / blocking signal. High lag means the daemon is starved and everything slows.","daemon.charts.cpu.help":"CPU utilization (% of all cores) at each sample: the daemon and the ACP child (where LLM/tool work runs). Child at 0% means no child is running.","daemon.charts.memory.help":"Resident memory at each sample: daemon RSS, daemon V8 heap, and ACP child RSS. Steady growth over time hints at a leak.","daemon.charts.pipe.help":"Bytes over the stdio pipe to/from the ACP child per window. Sustained high volume points to chatty framing between daemon and child.","daemon.charts.connections.help":"Live client transport connections at each sample: REST/SSE streams, ACP WebSocket streams, and ACP connections.","daemon.charts.tokens.help":"Input (prompt) and output (completion) tokens attributed to model turns per window — model spend over time.","daemon.usage.today":"Today","daemon.usage.period7d":"7D","daemon.usage.period30d":"30D","daemon.usage.rangeWeek":"Last 7 days","daemon.usage.rangeMonth":"Last 30 days","daemon.usage.rangeGroup":"Summary period","daemon.usage.tokensConsumed":"tokens consumed","daemon.usage.sessions":"Sessions","daemon.usage.requests":"Requests","daemon.usage.tools":"Tools","daemon.usage.changes":"Changes","daemon.usage.breakdownTitle":"Token Breakdown","daemon.usage.inputTokens":"Input tokens","daemon.usage.inputHint":"request + cache read","daemon.usage.outputTokens":"Output tokens","daemon.usage.outputHint":"response + reasoning","daemon.usage.cacheRead":"Cache read","daemon.usage.cacheHint":"cache read share","daemon.usage.heatmapTitle":"Token Heatmap","daemon.usage.heatmapSub":e=>`recent ${(e==null?void 0:e.months)??12} months · daily aggregated tokens`,"daemon.usage.low":"Low","daemon.usage.high":"High","daemon.usage.dowMon":"Mon","daemon.usage.dowWed":"Wed","daemon.usage.dowFri":"Fri","daemon.usage.empty":"No token usage recorded yet.","daemon.usage.loading":"Loading usage…","daemon.usage.failed":"Failed to load usage","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"Today","daemon.usage.rangeWordWeek":"7 days","daemon.usage.rangeWordMonth":"30 days","daemon.usage.modelShareTitle":"model share","daemon.usage.modelShareSub":"token share · light green shows cache read","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · cache ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"skill calls","daemon.usage.skillSub":"skill name / count","daemon.usage.skillName":"Skill name","daemon.usage.skillCount":"Count","daemon.usage.dailyTokensTitle":"tokens","daemon.usage.dailyTokensSub":"daily token totals","daemon.usage.dailySessionsTitle":"sessions","daemon.usage.dailySessionsSub":"active session counts per day","delete.cannotCurrent":"Cannot delete the current active session.","delete.action":"Delete","delete.deleted":"Session deleted.","delete.deletedCount":e=>`${(e==null?void 0:e.count)??0} session(s) deleted.`,"delete.deleting":"Deleting...","delete.failed":e=>`Failed to delete session.${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ navigate · Space select · Enter delete · Esc cancel","delete.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"delete.none":"No sessions to delete","delete.allFailed":e=>`Failed to delete ${(e==null?void 0:e.count)??0} session(s): ${(e==null?void 0:e.reason)??"unknown error"}`,"delete.nonRemoved":"No sessions were deleted.","delete.notFound":"Session not found — it may have been deleted already.","delete.partialFail":e=>`${(e==null?void 0:e.removed)??0} deleted, ${(e==null?void 0:e.failed)??0} failed: ${(e==null?void 0:e.detail)??"unknown error"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"delete.pressSearch":"Press / to search; Space to select; Enter to delete","delete.selected":e=>`${(e==null?void 0:e.count)??0} selected`,"delete.title":"Delete Session","time.justNow":"just now","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} min ago`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0}h ago`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0}d ago`,"dialog.footer.close":"Esc to close","dialog.footer.confirmCancel":"Enter to confirm · Esc to cancel","release.cannotCurrent":"Cannot release the current active session.","release.action":"Release","release.released":"Session released successfully.","release.failed":e=>`Failed to release session.${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ to navigate · Enter to release · Esc to cancel","release.inactive":"Only active live sessions can be released.","release.inactiveBadge":"inactive","release.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"release.matches":e=>`${(e==null?void 0:e.count)??0} matches`,"release.none":"No live sessions to release","release.pressSearch":"Press / to search; Enter releases the selected live session","release.releasing":"Releasing...","release.title":"Release Session","dialog.footer.menu":"Esc to menu","dialog.footer.mcpServers":"↑↓ to navigate · Enter details · r refresh · Esc close","dialog.footer.mcpSelect":"↑↓ to navigate · Enter select · Esc back","dialog.footer.modelFast":"↑↓ to navigate · / to search · c for custom · Enter to set fast model · Esc to cancel","dialog.footer.navSelectCancel":"↑↓ to navigate · Enter to select · Esc to cancel","dialog.footer.navSelectClose":"↑↓ to navigate · Enter to select · Esc to close","dialog.footer.navSelectMenu":"↑↓ to navigate · Enter to select · Esc to menu","dialog.footer.navOpenClose":"↑↓ to navigate · Enter to open · Esc to close","dialog.footer.navOpenMenu":"↑↓ to navigate · Enter to open · Esc to menu","dialog.footer.back":"Esc to go back","dialog.footer.backClose":"Esc to close","dialog.footer.saveClose":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to close","dialog.footer.saveMenu":"↑↓ switch fields · ⌘/Ctrl+Enter to save · Esc to menu","dialog.footer.search":"Type to search · Enter to commit · Esc to clear","dialog.footer.select":"Enter to select","editor.escClearHint":"Press Esc again to clear","editor.hintCommands":"commands","editor.hintFiles":"Files","editor.hintNext":"next","editor.hintPrev":"previous","editor.hintSearch":"search","editor.noHistory":"No matching history","editor.placeholder":"Type a message or @ file path","editor.shellPlaceholder":"Enter terminal command","editor.send":"Send message","editor.connectionDisconnected":"Connection interrupted. Please try again after it reconnects.","editor.sessionLoading":"Session is still loading. Try again in a moment.","editor.processing":"Processing. New messages will be queued.","editor.searchHint":"ctrl+r next · tab accept · enter send · esc cancel","editor.searchLabel":"reverse-i-search:","editor.searchPlaceholder":"type to search...","quickActions.open":"more actions","quickActions.title":"more actions","quickActions.mcp":"MCP","quickActions.context":"Context","quickActions.status":"Status","quickActions.stats":"Session","quickActions.memory":"Memory","quickActions.extensions":"Extensions","quickActions.skills":"Skills","quickActions.tools":"Tools","quickActions.agents":"Agents","quickActions.help":"Help","quickActions.theme":"Set theme","quickActions.auth":"Auth","quickActions.settings":"Settings","quickActions.new":"New session","quickActions.resume":"Switch session","quickActions.delete":"Delete session","quickActions.branch":"Copy session","quickActions.rewind":"Rewind session","quickActions.historyQuestion":"Question history","quickActions.recap":"Generate recap","quickActions.copy":"Copy output","quickActions.shellMode":"Shell mode","quickActions.exitShellMode":"Exit Shell","quickActions.setGoal":"Set goal","session.missing":"Current session does not exist","session.new":"New session","workspace.loadFailed":"Failed to load workspace","workspace.notFound":"Workspace not found","workspace.notFoundDescription":"This workspace may have been removed or the link is no longer valid.","workspace.loadFailedDescription":"The workspace service could not be reached. Check the daemon and try again.","scheduledTasks.title":"Scheduled Tasks","scheduledTasks.subtitle":"Run tasks automatically on a schedule, or trigger them manually anytime.","scheduledTasks.loading":"Loading…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} task${Number((e==null?void 0:e.count)??0)===1?"":"s"}`,"scheduledTasks.refresh":"Refresh","scheduledTasks.new":"New scheduled task","scheduledTasks.createViaChat":"Create via chat","scheduledTasks.chatStarter":"Help me set up a recurring scheduled task (keep it long-term). What I want: ","scheduledTasks.name":"Name","scheduledTasks.workspace":"Workspace","scheduledTasks.workspacePrimaryTag":"(primary)","scheduledTasks.taskId":"Task ID","scheduledTasks.schedule":"Schedule","scheduledTasks.type":"Type","scheduledTasks.status":"Status","scheduledTasks.namePlaceholder":"Optional — defaults to the prompt","scheduledTasks.prompt":"Prompt","scheduledTasks.promptPlaceholder":"What should this task do?","scheduledTasks.reference.extension":"Extensions","scheduledTasks.reference.skill":"Skills","scheduledTasks.reference.mcp":"MCP","scheduledTasks.referencePicker":"Reference picker","scheduledTasks.reference.loading":"Loading…","scheduledTasks.reference.empty":"No available items.","scheduledTasks.frequency":"Frequency","scheduledTasks.freq.daily":"Daily","scheduledTasks.freq.weekdays":"Weekdays","scheduledTasks.freq.weekly":"Weekly","scheduledTasks.freq.hourly":"Hourly","scheduledTasks.freq.minutes":"Every N minutes","scheduledTasks.freq.custom":"Custom (cron)","scheduledTasks.time":"Time","scheduledTasks.weekday":"Weekday","scheduledTasks.interval":"Minutes","scheduledTasks.cron":"Cron expression","scheduledTasks.weekdayNames":"Sun,Mon,Tue,Wed,Thu,Fri,Sat","scheduledTasks.human.daily":e=>`Daily at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`Weekdays at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`Every ${(e==null?void 0:e.day)??""} at ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`Hourly at :${(e==null?void 0:e.min)??"00"}`,"scheduledTasks.human.everyMinutes":e=>`Every ${(e==null?void 0:e.n)??""} minutes`,"scheduledTasks.never":"Never run","scheduledTasks.repeats":"Repeats","scheduledTasks.runsOnce":"Runs once","scheduledTasks.lastFired":e=>`Last run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"Run now","scheduledTasks.enable":"Enable","scheduledTasks.disable":"Disable","scheduledTasks.delete":"Delete","scheduledTasks.deleteConfirmTitle":"Delete scheduled task","scheduledTasks.deleteConfirm":e=>`Delete scheduled task "${(e==null?void 0:e.name)??""}"?`,"scheduledTasks.deletedSnapshot":"This scheduled task has been deleted. Showing the snapshot from when it was created.","scheduledTasks.sessionScopedSnapshot":"This is a session-scoped scheduled task. Showing the snapshot from when it was created.","scheduledTasks.empty":"No scheduled tasks yet. Create one to get started.","scheduledTasks.create":"Create","scheduledTasks.creating":"Creating…","scheduledTasks.cancel":"Cancel","scheduledTasks.error.invalidSchedule":"Invalid schedule","scheduledTasks.error.emptyPrompt":"Prompt is required","scheduledTasks.error.promptTooLong":e=>`Prompt exceeds ${(e==null?void 0:e.max)??1e5}-character limit`,"scheduledTasks.error.toggleFailed":"Failed to update task","scheduledTasks.error.deleteFailed":"Failed to delete task","scheduledTasks.edit":"Edit","scheduledTasks.editTitle":"Edit scheduled task","scheduledTasks.save":"Save","scheduledTasks.saving":"Saving…","scheduledTasks.runHistory":e=>`Run history (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistory":e=>`View conversation (${(e==null?void 0:e.count)??0})`,"scheduledTasks.viewHistoryEmpty":"View conversation","scheduledTasks.viewHistoryHint":"Open the task's session to see its runs","scheduledTasks.runKind.catchUp":"late","scheduledTasks.runKind.manual":"manual","scheduledTasks.runKind.withheld":"skipped","scheduledTasks.error.runFailed":"Failed to record the run","scheduledTasks.error.oneShotConsumedButFailed":"The task was deleted but the prompt could not be delivered — it never ran. Recreate it to try again.","scheduledTasks.dueNow":"Due now","scheduledTasks.nextRunTooltip":e=>`Next run: ${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"d","scheduledTasks.dur.h":"h","scheduledTasks.dur.m":"m","scheduledTasks.dur.s":"s","scheduledTasks.runMode":"Run mode","scheduledTasks.runMode.shared":"Shared session","scheduledTasks.runMode.isolated":"Isolated (fresh session per run)","scheduledTasks.runMode.shared.hint":"Runs accumulate in one session transcript.","scheduledTasks.runMode.isolated.hint":"Each run gets a clean session context.","scheduledTasks.condition":"Precondition (optional)","scheduledTasks.conditionPlaceholder":"e.g. Check whether anything landed on main since yesterday. If nothing did, the task should not run.","scheduledTasks.condition.hint":"Checked in this task's own session before each run. The prompt only runs in a fresh session when the check says yes — otherwise the run is skipped.","scheduledTasks.condition.cardPrefix":"If:","turnOutputs.filesEdited":e=>`Edited ${(e==null?void 0:e.count)??0} files`,"turnOutputs.viewChanges":"View changes","turnOutputs.review":"Review","turnOutputs.collapseFiles":"Collapse files","turnOutputs.showMoreFiles":e=>`Show ${(e==null?void 0:e.count)??0} more files`,"turnOutputs.previousTurn":"Previous turn","turnOutputs.fileCount":e=>`${(e==null?void 0:e.count)??0} files`,"turnOutputs.openFileTree":"Open file tree","turnOutputs.closeFileTree":"Close file tree","sidebar.label":"Workspace sidebar","sidebar.toggleMenu":"Toggle menu","sidebar.newChat":"New chat","sidebar.newTask":"New task","sidebar.plugins":"Plugins","sidebar.project":"Project","sidebar.pinnedSessions":"Pinned","sidebar.workspaceSelectLabel":"Workspace","sidebar.details":"Details","sidebar.workspacePrimary":"Primary","sidebar.workspaceUntrusted":"untrusted","sidebar.workspaceReadOnly":"read-only","sidebar.workspaceTrustToOpen":"Trust this workspace to open the session.","sidebar.addWorkspace":"Add workspace","sidebar.addWorkspaceTitle":"Add Workspace","sidebar.addWorkspacePath":"Directory path","sidebar.addWorkspaceRegister":"Register","sidebar.addWorkspaceCancel":"Cancel","sidebar.addWorkspaceError":"Failed to add workspace","sidebar.addWorkspacePersistenceError":"The daemon did not confirm persistent workspace registration","sidebar.addWorkspaceAbsError":"Path must be absolute","sidebar.addWorkspaceHint":"Enter the absolute path to a project directory.","sidebar.addWorkspacePersist":"Keep after daemon restart","sidebar.addWorkspacePersistHint":"Persist this workspace registration in the daemon configuration.","sidebar.addWorkspaceAdding":"Adding…","sidebar.removeWorkspace":"Remove workspace","sidebar.workspaceActions":"Workspace actions","sidebar.forceRemoveWorkspace":"Force remove","sidebar.removeWorkspaceTitle":"Remove Workspace","sidebar.removeWorkspaceConfirm":e=>`Remove the runtime and persistent registration for “${(e==null?void 0:e.name)??""}”? Files, settings, and session history will not be deleted.`,"sidebar.removeWorkspaceBusy":e=>`“${(e==null?void 0:e.name)??""}” still has active runtime resources. Force removal will terminate them.`,"sidebar.removeWorkspaceCurrentSession":"Switch to another workspace or close the current session before forcing removal.","sidebar.removeWorkspaceInProgress":"Another client is already removing this workspace. Refresh after that operation finishes.","sidebar.removeWorkspaceError":"Failed to remove workspace","sidebar.removeWorkspaceSessions":e=>`Sessions: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspacePrompts":e=>`Active prompts: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceStarts":e=>`Pending session starts: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceConnections":e=>`ACP connections: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceMemoryTasks":e=>`Memory tasks: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceWorkers":e=>`Channel workers: ${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceVoiceSessions":e=>`Voice sessions: ${(e==null?void 0:e.count)??0}`,"sidebar.noSessions":"No sessions.","sidebar.projectFallback":"Project","sidebar.sessionsOverview":"Session Overview","sidebar.splitView":"Split View","sidebar.settings":"Settings","sidebar.daemonStatus":"Daemon Status","sidebar.scheduledTasks":"Scheduled Tasks","sidebar.themeLight":"Switch to light theme","sidebar.themeDark":"Switch to dark theme","sidebar.collapse":"Collapse","sidebar.expand":"Expand","sidebar.collapseProject":"Collapse project","sidebar.expandProject":"Expand project","sidebar.search":"Search sessions","sidebar.searchPlaceholder":"Search sessions","sidebar.searchEmpty":"No matching sessions.","sidebar.rename":"Rename","sidebar.renameCurrentOnly":"Only the current session can be renamed","sidebar.export":"Export conversation record","sidebar.exportFailed":"Failed to export session","sidebar.delete":"Delete","sidebar.archive":"Archive","sidebar.unarchive":"Restore","sidebar.moreActions":"More actions","sidebar.archiveCurrentDisabled":"The current session cannot be archived","sidebar.archivedTitle":"Archived","sidebar.archivedEmpty":"No archived sessions.","sidebar.archiveFailed":"Failed to archive session","sidebar.unarchiveFailed":"Failed to restore session","sidebar.loadingSessions":"Loading sessions...","sidebar.loadFailed":"Failed to load sessions. Click to retry.","sidebar.renameFailed":"Failed to rename session","sidebar.deleteFailed":"Failed to delete session","sidebar.newSessionFailed":"Failed to create a new chat","sidebar.switchFailed":"Failed to switch session","sidebar.currentDeleteDisabled":"Current session cannot be deleted","sidebar.deleteConfirmDescription":e=>`Delete "${(e==null?void 0:e.name)??""}"? This cannot be undone.`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} client(s)`,"sidebar.running":"Running","sidebar.waitingForApproval":"Waiting for approval","sidebar.userInputNeeded":"User input needed","sidebar.completedUnread":"Finished","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.sessionGroup":"Group","sidebar.groupFilter":"Session group","sidebar.groupAll":"All","sidebar.groupPinned":"Pinned","sidebar.groupUngrouped":"Ungrouped","sidebar.groupRecent":"Recent","sidebar.groupCreate":"Create group","sidebar.groupRename":"Rename group","sidebar.groupDelete":"Delete group","sidebar.groupColor":"Group color","sidebar.groupNamePrompt":"Group name","sidebar.groupDeleteConfirm":e=>`Delete group "${(e==null?void 0:e.name)??""}"?`,"sidebar.groupsLoadFailed":"Failed to load session groups","sidebar.groupCreateFailed":"Failed to create group","sidebar.groupAssignFailedAfterCreate":"Group created, but failed to move session into it","sidebar.groupUpdateFailed":"Failed to update group","sidebar.groupDeleteFailed":"Failed to delete group","sidebar.organizationFailed":"Failed to update session organization","sidebar.groupColor.red":"Red","sidebar.groupColor.orange":"Orange","sidebar.groupColor.yellow":"Yellow","sidebar.groupColor.green":"Green","sidebar.groupColor.blue":"Blue","sidebar.groupColor.purple":"Purple","sidebar.groupColor.custom":"Custom…","sidebar.groupColor.picker":"Choose custom group color","sidebar.groupColor.hex":"Hex color","sidebar.groupColor.invalid":"Enter a six-digit Hex color such as #416ef5.","quickKeys.cursor":"Move cursor","quickKeys.escape":"Cancel run","quickKeys.history":"History","quickKeys.retry":"Retry failed","quickKeys.searchHistory":"Search history","quickKeys.tab":"Accept completion","error.unsupportedTheme":"Unsupported theme. Use /theme light or /theme dark.","queue.delete":"Delete","queue.edit":"Edit","queue.insert":"Insert","queue.cleared":"Queue cleared.","queue.deleteTip":"Remove from queue","queue.editTip":"Remove from queue and edit again","queue.insertTip":"Insert this message into the current session; it takes effect on the next model call.","queue.inserted":"Inserted. It takes effect on the next model call.","queue.insertCommandDisabled":"Commands can't be inserted into the running turn; they run after it finishes.","queue.submitting":"Submitting...","queue.editing":"Editing...","queue.removing":"Updating...","queue.submittingDisabled":"Submitting queued message...","queue.commandBlocked":"Slash commands can't be queued while a turn is running.","queue.shellBlocked":"Shell commands can't be queued while a turn is running.","queue.queueFailed":"Failed to queue message","queue.insertFailed":"Failed to insert queued message","queue.deleteFailed":"Failed to move message out of queue","queue.editFailed":"Failed to edit queued message","queue.footer":"Press ↑ to edit the latest queued message · Esc to clear queue","queue.imageCount":e=>`(+${(e==null?void 0:e.count)??0} images)`,"queue.more":e=>`... (+${(e==null?void 0:e.count)??0} more)`,"midTurn.inserted":e=>`Inserted message: ${(e==null?void 0:e.message)??""}`,"help.builtIn":"Built-in commands","help.commandCount":e=>`${(e==null?void 0:e.count)??0} commands`,"help.commandMeta.builtIn":"built-in","help.commandMeta.custom":"custom","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} subcommands`,"help.commandsIntro":"Browse built-in commands:","help.customGroup":"Custom, skills, plugins, MCP","help.customIntro":"Browse custom, skill, plugin, and MCP commands:","help.empty":"No commands are currently available.","help.emptyCustom":"No custom commands are currently available.","help.footer":"Tab/Shift+Tab to switch tabs · ↑/↓ or PgUp/PgDn to scroll · Esc to close","help.intro":"Qwen Code understands your codebase, makes edits with your permission, and executes commands right from your terminal.","help.section.shortcuts":"Shortcuts","help.search":"Search commands","help.shortcut.addContext":"Add files or folders as context","help.shortcut.altWords":"Jump through words","help.shortcut.clear":"Clear the screen","help.shortcut.commandMenu":"Open command menu","help.shortcut.completion":"Accept completion or switch help tabs","help.shortcut.history":"Cycle prompt history or scroll lists","help.shortcut.searchHistory":"Search prompt history","help.shortcut.newline":"Insert a newline","help.shortcut.pasteImages":"Paste images","help.shortcut.shell":"Run shell commands","help.shortcut.togglePanel":"Toggle this panel","help.shortcut.retry":"Retry last request","help.shortcut.compact":"Toggle compact mode","retry.hint":"Press Ctrl+Y to retry or click to retry","retry.none":"No failed request to retry.","branch.failed":"Failed to branch session.","branch.success":e=>`Copied session. New session name: "${(e==null?void 0:e.name)??""}". Switched to the new session.`,"fork.empty":"Please provide a directive. Usage: /fork <directive>","fork.failed":e=>`Failed to launch fork: ${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"Background agent was not launched.","fork.started":e=>`Started background agent: "${(e==null?void 0:e.name)??""}". Track it in background tasks.`,"command.hidden":"This command is not available.","help.shortcut.approvals":"Cycle approval modes","help.shortcut.cancel":"Close dialogs or cancel operation","bug.failed":"Failed to load system info for bug report.","bug.popupBlocked":"Popup blocked — please allow popups and try again.","bug.submitted":"Bug report opened in a new tab.","clear.blocked":"Cannot clear while streaming — cancel first (Esc).","error.unknown":"Unknown error","error.modelStreamInterrupted":"Model response stream was interrupted. Please retry.","shell.command":"Shell Command","compact.enabled":"Compact mode enabled","compact.disabled":"Compact mode disabled","compact.hint":"Press Ctrl+O to show full tool output","compact.saveFailed":"Failed to save compact mode","help.subcommands":"subcommands","help.tab.commands":"Built-in commands","help.tab.custom":"custom-commands","help.tab.general":"shortcuts","help.title":"Help","slash.category.custom":"Custom commands","slash.category.skill":"Skill commands","slash.category.system":"System commands","language.changed":e=>`UI language changed to ${(e==null?void 0:e.language)??""}`,"language.current":e=>`Current UI language: ${(e==null?void 0:e.language)??""}`,"language.invalid":"Invalid language. Available: en, zh-CN","language.options":"Available options:","language.set":"Set UI language","language.usage":"Usage: /language ui [en|zh-CN]","localCommand.noSession":"No active session yet. Send your first message before using this command.","local.agents":"Manage subagents","local.bug":"Submit a bug report","local.compress":"Compress the context into a summary","local.compressFast":"Fast context compression without AI","local.config":"Get or set any setting by dot-path key","local.diff":"Show working-tree change stats versus HEAD","local.directory":"Manage workspace directories","local.docs":"Open the full Qwen Code documentation","local.doctor":"Run installation and environment diagnostics","local.dream":"Consolidate managed auto-memory topic files","local.effort":"Set reasoning effort for capable models","local.export":"Export the current session history to a file","local.forget":"Remove matching entries from managed auto-memory","local.hooks":"Manage Qwen Code hooks","local.importConfig":"Import MCP servers from Claude configs","local.init":"Analyze the project and create a QWEN.md file","local.insight":"Generate programming insights from chat history","local.lsp":"Show LSP server status","local.remember":"Save a durable memory to the memory system","local.summary":"Generate a project summary file","local.workflows":"List active and completed workflow runs","skilldesc.batch":"Run batch operations across many files in parallel","skilldesc.dataviz":"Design guidance for charts and data visualizations","skilldesc.extensionCreator":"Create, test, and customize Qwen Code extensions","skilldesc.loop":"Run a prompt on a schedule or self-paced wakeups","skilldesc.newApp":"Workflow for building a new app from scratch","skilldesc.qcHelper":"Answer questions about using Qwen Code","skilldesc.review":"Review changed code for bugs, security, and quality","skilldesc.simplify":"Clean up recent changes for reuse and simplicity","skilldesc.stuck":"Diagnose frozen or slow Qwen Code sessions","skilldesc.agentReproduceAlign":"Align a ported Codex/Claude Code feature with the original","skilldesc.agentReproduceFeature":"Reproduce an existing Codex/Claude Code feature","skilldesc.autofix":"Implement approved issues or address PR review feedback","skilldesc.bugfix":"Fix a bug from a GitHub issue, reproduce-first","skilldesc.codegraph":"Analyze the codebase via graph and vector index","skilldesc.createIssue":"Draft and submit a GitHub issue from an idea","skilldesc.desktopPet":"Create a pixel-art desktop pet for Qwen Code","skilldesc.docsAuditAndRefresh":"Audit and refresh docs/ against the codebase","skilldesc.docsUpdateFromDiff":"Update official docs from local git diff","skilldesc.e2eTesting":"Run end-to-end tests of the Qwen Code CLI","skilldesc.featDev":"End-to-end workflow for a non-trivial feature","skilldesc.memoryLeakDebug":"Diagnose CLI memory leaks via heap snapshots","skilldesc.openworkDesktopSync":"Sync packages/desktop with openwork commit-by-commit","skilldesc.preparePr":"Prepare a GitHub PR title and body from the branch","skilldesc.qwenCodeClaw":"Use Qwen Code as a code-understanding agent","skilldesc.structuredDebugging":"Hypothesis-driven methodology for hard bugs","skilldesc.terminalCapture":"Automate terminal UI screenshot testing","skilldesc.tmuxRealUserTesting":"Real-user testing with tmux, saving logs","skilldesc.triage":"Triage and review Qwen Code issues and PRs","local.approvalMode":"Change approval mode","local.auth":"Connect an LLM provider","auth.title":"Connect a Provider","auth.step.group":"Type","auth.step.provider":"Provider","auth.step.protocol":"Protocol","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"Model IDs","auth.step.advanced":"Advanced Config","auth.protocol.openai":"OpenAI-compatible","auth.protocol.openaiDesc":"Standard OpenAI API format (most common)","auth.protocol.anthropic":"Anthropic-compatible","auth.protocol.anthropicDesc":"Anthropic Messages API format","auth.protocol.gemini":"Gemini-compatible","auth.protocol.geminiDesc":"Google Gemini API format","auth.apiKeyRequired":"API key cannot be empty.","auth.baseUrlInvalid":"Base URL must start with http:// or https://.","auth.baseUrlPrompt":"Enter the API endpoint for this protocol.","auth.baseUrlRequired":"Base URL cannot be empty.","auth.documentation":"Documentation","auth.modelsRequired":"Model IDs cannot be empty.","auth.review":"Review","auth.reviewText":"The following JSON will be saved to settings.json:","auth.save":"Save","auth.saving":"Saving...","auth.termsTitle":"Terms of Services and Privacy Notice","auth.continue":"Continue","auth.modelsPrompt":e=>`Enter model IDs separated by commas. Examples: ${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"Optional: configure advanced generation settings.","auth.advanced.thinking":"Enable thinking","auth.advanced.thinkingDesc":"Allows the model to perform extended reasoning before responding.","auth.advanced.modality":"Enable modality","auth.advanced.modalityDesc":"Enables multimodal input capabilities (image, video, etc.).","auth.advanced.modalityImage":"Image","auth.advanced.modalityVideo":"Video","auth.advanced.modalityAudio":"Audio","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"Context window","auth.advanced.contextDesc":"Max input tokens (leave empty to auto-detect from model name).","auth.advanced.contextPlaceholder":"Context window (optional)","local.btw":"Ask a quick side question without affecting the main conversation. Usage: /btw <your question>","btw.empty":"Please provide a question. Usage: /btw <your question>","btw.emptyAnswer":"No response received.","btw.failed":"Failed to answer btw question","btw.answering":"+ Answering...","btw.shortcuts.pending":"Press Escape, Ctrl+C, or Ctrl+D to cancel","btw.shortcuts.done":"Press Space, Enter, or Escape to dismiss","local.clear":"Start a new session with empty context; previous session stays on disk (resumable with /resume)","local.context":'Show context window usage breakdown. Use "/context detail" for per-item breakdown.',"local.copy":"Copy last output or snippet","local.delete":"Delete a session permanently","local.release":"Release a live session","local.rewind":"Rewind the current conversation","local.branch":"Fork the current conversation into a new session","local.fork":"Start a background agent from this conversation","local.help":"Show help and commands","local.language":"Change UI language","local.mcp":"Manage MCP servers","local.memory":"Manage memory","local.model":"Switch model or set fast model","local.new":"Start a new conversation","local.plan":"Enter Plan mode","local.goal":"Set a goal and keep working until it is met","local.recap":"Generate a session recap","recap.label":"Recap","recap.loading":"Generating recap...","recap.empty":"Not enough conversation context for a recap yet.","recap.failed":"Failed to generate recap","rewind.action":"Rewind","rewind.confirm":"Confirm rewind","rewind.empty":"No rewind snapshots are available for this session.","rewind.failed":e=>`Failed to rewind session: ${(e==null?void 0:e.reason)??""}`,"rewind.loading":"Loading rewind snapshots...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"Rewinding...","rewind.subtitle":"Only the conversation is rewound. Files are not changed.","rewind.title":"Rewind Conversation","rewind.turn":e=>`Prompt ${(e==null?void 0:e.turn)??0}`,"local.rename":"Rename current session","rename.empty":"Please enter a session name, for example /rename project debugging, or use /rename --auto.","rename.success":e=>`Session renamed to ${(e==null?void 0:e.name)??""}`,"local.reset":"Reset current conversation","local.resume":"Resume a previous session","local.skills":"View available skills","local.stats":"Show session statistics","local.tasks":"View background tasks","local.status":"Show version info","local.theme":"Change theme","local.settings":"View and edit settings","local.schedule":"Manage scheduled tasks","local.extensions":"Manage extensions. Usage: /extensions manage|install <source>","extensions.label":"extension","extensions.action.failed":e=>`Extension action failed${e!=null&&e.name?` for "${e.name}"`:e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.commands.refreshFailed":"Failed to refresh extension commands.","extensions.install.failed":e=>`Failed to install extension${e!=null&&e.source?` from "${e.source}"`:""}: ${(e==null?void 0:e.error)??"Unknown error"}`,"extensions.manage.agents":"Agents:","extensions.manage.actions":"Extension actions","extensions.manage.add":"Add Extension","extensions.manage.checkingUpdates":"Checking for updates...","extensions.manage.checkUpdates":"Check 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.disable":"Disable Extension","extensions.manage.disabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" disabled.`,"extensions.manage.disabling":e=>`Disabling extension "${(e==null?void 0:e.name)??"extension"}"…`,"extensions.manage.empty":"No extensions installed.","extensions.manage.emptyAgents":"This extension has no agents.","extensions.manage.emptyCommands":"This extension has no commands.","extensions.manage.emptyContextFiles":"This extension has no context files.","extensions.manage.emptyDescription":"Install an extension to add commands, skills, agents, or MCP servers.","extensions.manage.emptyMcpServers":"This extension has no MCP servers.","extensions.manage.emptySkills":"This extension has no skills.","extensions.manage.enable":"Enable Extension","extensions.manage.enabled":e=>`Extension "${(e==null?void 0:e.name)??"extension"}" enabled.`,"extensions.manage.enabling":e=>`Enabling extension "${(e==null?void 0:e.name)??"extension"}"…`,"extensions.manage.install":"Install","extensions.manage.installDescription":"Enter a GitHub, Git, or npm extension source.","extensions.manage.installSelectPluginDescription":e=>`Choose a plugin from "${(e==null?void 0:e.marketplace)??"this marketplace"}".`,"extensions.manage.installType":"Install type:","extensions.manage.mcpServers":"MCP servers:","extensions.manage.marketplaceRoot":"Marketplace root","extensions.manage.name":"Name:","extensions.manage.notUpdatable":"not updatable","extensions.manage.operationFailed":"Extension operation failed.","extensions.manage.noDescription":"No description","extensions.manage.noMatches":"No matching extensions.","extensions.manage.origin":"Origin:","extensions.manage.overview":"Overview","extensions.manage.path":"Path:","extensions.manage.queued":e=>`Extension action queued for "${(e==null?void 0:e.name)??"extension"}".`,"extensions.manage.refreshFailed":e=>`Extension action succeeded, but session refresh failed${e!=null&&e.error?`: ${e.error}`:"."}`,"extensions.manage.restartRequired":"updated; restart required","extensions.manage.search":"Search extensions…","extensions.manage.selectExtension":"Choose an extension","extensions.manage.settings":"Settings:","extensions.manage.skills":"Skills:","extensions.manage.source":"Source:","extensions.manage.sourcePlaceholder":"https://github.com/owner/repository","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.uninstalling":e=>`Uninstalling extension "${(e==null?void 0:e.name)??"extension"}"…`,"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.updateComplete":"updated","extensions.manage.updatedWithWarnings":"updated with warnings","extensions.manage.updateStatus":"Update status:","extensions.manage.updating":"updating…","extensions.manage.updatingExtension":e=>`Updating extension "${(e==null?void 0:e.name)??"extension"}"…`,"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.action.approve":"Approve","mcp.actions":"Server actions","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.oauth.timeout":"Authentication timed out. Refresh to check the status.","mcp.oauth.authenticationFailed":"Authentication failed.","mcp.oauth.statusFailed":"Failed to check the authentication status.","mcp.oauth.serverRemoved":"The MCP server was removed during 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.descriptionTitle":"Description","mcp.basicInfo":"Basic Information","mcp.action.reconnect":"Reconnect","mcp.action.edit":"Edit","mcp.reconnect.skipped":e=>`Reconnect was not completed: ${(e==null?void 0:e.reason)??"unknown reason"}.`,"mcp.reconnect.authenticationRequired":"Authentication is required before reconnecting.","mcp.action.restart":"Restart","mcp.action.tools":"View tools","mcp.action.toolsHint":"Enter to inspect","mcp.empty":"No MCP servers configured.","mcp.emptyDescription":"Add an MCP server to manage it here.","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.noMatches":"No matching MCP servers.","mcp.add.button":"Add MCP Server","mcp.add.adding":"Adding MCP Server…","mcp.add.title":"Add MCP Server","mcp.add.description":"Save an MCP server to this workspace with a name and configuration.","mcp.add.name":"Name","mcp.add.serverDescription":"Description","mcp.add.serverDescriptionPlaceholder":"Describe this MCP server","mcp.add.scope":"Location","mcp.add.scope.global":"Global","mcp.add.nameRequired":"Enter an MCP server name.","mcp.add.config":"Configuration (JSON)","mcp.add.configInvalid":"Configuration must be a JSON object.","mcp.add.done":e=>`Added ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.edit.title":"Edit MCP Server","mcp.edit.description":"Update the description or configuration. Name and location cannot be changed.","mcp.edit.save":"Save Changes","mcp.edit.saving":"Saving Changes…","mcp.edit.done":e=>`Updated ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.edit.notFound":"The MCP server is no longer present in settings.","mcp.runtime.notUpdated":"Configuration was saved, but the current session was not updated.","mcp.runtime.removeNotUpdated":"Configuration was deleted, but the current session was not updated.","mcp.discovery.empty":"No MCP servers are configured.","mcp.discovery.initializing":"Initializing MCP servers…","mcp.discovery.timeout":"MCP discovery is taking longer than expected. Refresh to check again.","mcp.add.settingsUnavailable":"Workspace settings are unavailable.","mcp.action.remove":"Delete","mcp.remove.title":"Delete MCP Server","mcp.remove.description":e=>`Remove MCP server “${(e==null?void 0:e.name)??""}” from this workspace?`,"mcp.remove.description.global":e=>`Remove MCP server “${(e==null?void 0:e.name)??""}” from global settings?`,"mcp.remove.done":e=>`Deleted ${(e==null?void 0:e.name)??"MCP server"}.`,"mcp.remove.notWorkspace":"This MCP server is not defined in workspace settings.","mcp.source.all":"All","mcp.noSchema":"No input schema.","mcp.oauth.open":"Open authentication page","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.viewDetails":"View details","mcp.parameters":"Parameters:","mcp.required":" required","mcp.resources":"Resources","mcp.resourcesUnavailable":"Resource details unavailable.","mcp.noResources":"No resources.","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":"Project MCP (.mcp.json)","mcp.source.workspace":"Workspace Settings","mcp.source.user":"Global Settings","mcp.status":"Status","mcp.status.blocked":"Blocked","mcp.status.authenticating":"Authenticating","mcp.status.needsApproval":"Needs approval","mcp.status.rejected":"Rejected","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 Protocol","mcp.use":"Use","mcp.userMcp":"Global MCP","mcp.workingDirectory":"Working Directory","goal.aborted":"Goal aborted","goal.achieved":"Goal achieved","goal.check":"Goal check","goal.cleared":"Goal cleared","goal.failed":"Goal could not be achieved","goal.judge":"Judge","goal.label":"Goal","goal.lastCheck":"Last check","goal.notYetMet":"not yet met","goal.set":"Goal set","goal.statusActive":"/goal active","goal.turn":e=>`${(e==null?void 0:e.count)??0} turn`,"goal.turnLabel":e=>`turn ${(e==null?void 0:e.count)??0}`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} turns`,"memory.add":"Add","memory.add.desc":"Write a durable memory","memory.autoDream":e=>`Auto-dream: ${(e==null?void 0:e.status)??"unknown"} · ${(e==null?void 0:e.lastDream)??"never"} · /dream to run`,"memory.autoDreamUnsupported":"Auto-dream settings are not available from web-shell yet.","memory.autoFolder":"Open auto-memory folder","memory.autoMemory":e=>`Auto-memory: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoMemoryUnsupported":"Auto-memory settings are not available from web-shell yet.","memory.autoSkill":e=>`Auto-skill: ${(e==null?void 0:e.status)??"unknown"}`,"memory.autoSkillUnsupported":"Auto-skill settings are not available from web-shell yet.","memory.chooseScope":"Choose where to save the memory","memory.closed":"Memory panel closed.","memory.contentEmpty":"Memory content is empty.","memory.file":"Memory file","memory.fileOpen":"Memory file opened.","memory.fileTruncated":"Memory file opened. Content is truncated.","memory.files":"Memory Files","memory.footer":"Enter to confirm · Esc to cancel","memory.footer.back":"Esc to go back","memory.global":"User","memory.global.desc":"Saved to the global user memory file","memory.globalReadUnsupported":"Global memory is outside the bound workspace, so the current daemon file-read API cannot open its content.","memory.loading":"Loading memory...","memory.loadingFile":"Loading memory file...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"never","memory.noFiles":"No memory files found.","memory.on":"on","memory.openFolderUnsupported":"Opening the auto-memory folder is not available from web-shell yet.","memory.placeholder":e=>`Write ${(e==null?void 0:e.scope)??"memory"} content...`,"memory.project":"Project","memory.project.desc":"Saved to this workspace memory file","memory.refresh":"Refresh","memory.refresh.desc":"Reload memory file information","memory.refreshed":"Memory refreshed.","memory.save":"Save Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} saved: ${(e==null?void 0:e.bytes)??0} bytes -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"Saving...","memory.show":"Show","memory.show.desc":"Show configured memory files","memory.status":"Workspace and user memory files","memory.unknown":"unknown","memory.write":"Write memory content","mode.auto":"Classifier Approval","mode.auto.desc":"Uses a classifier to approve safe tool calls and block or ask for risky ones","mode.auto.notice":"Auto mode enabled. An LLM classifier evaluates each tool call and auto-approves safe actions, blocks risky ones. To exit: Shift+Tab or /approval-mode default.","mode.footer":"(Use Enter to select, Esc to cancel)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"Plan","mode.label.default":"Ask Approval","mode.label.auto-edit":"Auto Edit","mode.label.auto":"Classifier Approval","mode.label.yolo":"Full Access","mode.listLabel.plan":"Plan (plan)","mode.listLabel.default":"Ask Approval (default)","mode.listLabel.auto-edit":"Auto Edit (auto-edit)","mode.listLabel.auto":"Classifier Approval (auto)","mode.listLabel.yolo":"Full Access (yolo)","mode.desc.plan":"Analyze only, do not modify files or execute commands","mode.desc.default":"Ask before running commands, editing files, or accessing external resources","mode.desc.auto-edit":"Automatically approve file edits and ask before command execution or other sensitive actions","mode.desc.auto":"Evaluate tool risk automatically, run safe actions, and confirm risky ones","mode.desc.yolo":"Automatically approve all tool calls in trusted contexts","mode.select":"Approval Mode","mode.autoApproved":e=>e!=null&&e.tool?`Auto-approved: ${e.tool}`:"Pending tool call auto-approved by mode switch.","mode.auto-edit":"Auto-accept edits","mode.auto-edit.desc":"Automatically approve file read/write operations","mode.default":"Default mode","mode.default.desc":"Ask before each tool call","mode.plan":"Plan mode","mode.plan.desc":"Analyze and plan without running tools","mode.unknown":"unknown mode","mode.yolo":"YOLO mode","mode.yolo.desc":"Automatically approve all operations","plan.title":"Plan","model.contextWindow":"Context Window","model.contextWindow.unknown":"(unknown)","model.current":e=>`current: ${(e==null?void 0:e.model)??"unknown"}`,"model.modality":"Modality","model.modality.text":"text","model.modality.textOnly":"text-only","model.modality.image":"image","model.modality.pdf":"pdf","model.modality.audio":"audio","model.modality.video":"video","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"(default)","model.notSet":"(not set)","model.footer":"Enter select, ↑↓ navigate, Esc close","model.searchHint":"Press / to search","model.fastHint":"for suggestions and side tasks","model.noMatch":e=>`No model matching "${(e==null?void 0:e.query)??""}"`,"model.none":"No models available","model.select":"Select Model","model.setFast":"Set Fast Model","model.setVoice":"Set Voice Model","model.setVision":"Set Vision Model","model.switch":"Switch Model","model.unknown":"unknown","resume.current":"current","resume.activePrompt":"active prompt","resume.filter":"Filter","resume.noMatch":e=>`No session matching "${(e==null?void 0:e.query)??""}"`,"resume.none":"No sessions to resume","resume.pressSearch":"Press / to search","resume.search":"Search","resume.title":"Resume Session","parallelAgents.title":"Parallel agents","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} done`,"skills.available":"Available skills:","skills.none":"No skills are currently available.","skills.empty":"No skills available.","skills.footer":e=>e!=null&&e.name?`Use /skills ${e.name} to invoke · r to refresh · Esc to close`:"r to refresh · Esc to close","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} invocable`,"skills.details":"Skill details","skills.extension":"Extension","skills.filter.all":"All","skills.filter.bundled":"Built-in","skills.filter.extension":"Extensions","skills.filter.label":"Filter skills by source","skills.filter.project":"Workspace settings","skills.filter.user":"User settings","skills.hint":"Hint","skills.invocation":"Invocation","skills.level":"Scope","skills.level.bundled":"Bundled","skills.level.extension":"Extension","skills.level.project":"Project","skills.level.user":"User","skills.loading":"Loading skills...","skills.model":"Model","skills.modelAccess":"Model access","skills.modelAccess.disabled":"Not model-invocable","skills.modelAccess.enabled":"Model-invocable","skills.modelInvocable":"Model","skills.noDescription":"No description","skills.noMatches":"No matching skills.","skills.run":"Run skill","skills.search":"Search skills…","skills.status":"Status","skills.status.disabled":"disabled","skills.title":"Skills","plugins.extensions":"Extensions","plugins.agents":"Agents","plugins.mcp":"MCP","plugins.mcpLoadFailed":"Failed to load MCP status","plugins.sections":"Plugin sections","plugins.skills":"Skills","plugins.title":"Plugins","plugins.tools":"Tools","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.outputTokens":"Output Tokens","stats.overview":"Session Overview","stats.performance":"Performance","stats.prompts":"Prompts","stats.rejected":"Rejected:","stats.reqs":"Reqs","stats.requests":"Requests","stats.savingsHighlight":"Savings Highlight:","stats.successRate":"Success Rate","stats.thoughts":"Thoughts","stats.title":"Session Stats","stats.tokens":"Tokens","stats.toolCalls":"Tool Calls","stats.toolName":"Tool Name","stats.toolStats":"Tool Stats","stats.toolTime":"Tool Time","stats.total":"Total","stats.totalReviewed":"Total Reviewed Suggestions:","status.contextUsed":e=>`${(e==null?void 0:e.pct)??"0.0"}% context used`,"status.disconnected":"Disconnected","status.modeHint":"(shift + tab or click to switch)","status.shortcuts":"? for shortcuts","stream.cancel":"esc to cancel","stream.cancelArmed":"Press Esc again to stop","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`current: ${(e==null?void 0:e.theme)??""}`,"theme.auto":"Auto","theme.dark":"Dark","theme.dark.desc":"Terminal-style dark skin.","theme.light":"Light","theme.light.desc":"Terminal-style light skin.","theme.title":"Theme","todo.allDone":"All tasks completed","todo.collapse":"Collapse task list","todo.completedAbove":e=>`✓ ${(e==null?void 0:e.count)??0} completed`,"todo.detail.api":"API","todo.detail.cached":"Cached","todo.detail.end":"End","todo.detail.hide":"Hide task detail","todo.detail.input":"Input","todo.detail.noResources":"Token & time usage wasn't captured for this task.","todo.detail.output":"Output","todo.detail.sectionSpent":"Time spent","todo.detail.sectionTime":"Time","todo.detail.sectionTokens":"Tokens","todo.detail.show":"Show task detail","todo.detail.start":"Start","todo.detail.tool":"Tool","todo.expand":"Expand task list","todo.more":e=>`... ${(e==null?void 0:e.count)??0} more`,"todo.moreAbove":e=>`... ${(e==null?void 0:e.count)??0} earlier`,"todo.showLess":"Show less","todo.stepProgress":e=>`Step ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"Current tasks","chat.scrollToBottom":"Scroll to bottom","userMessage.showMore":"Show more","userMessage.showLess":"Collapse","turn.processed":"Processed","turn.processing":"Processing","turn.collapse":"Collapse steps","turn.expand":"Expand steps","turn.cached":"cached","turn.executionSteps":e=>{const t=(e==null?void 0:e.count)??0;return`${t} step${t===1?"":"s"}`},"turn.toolCalls":e=>{const t=(e==null?void 0:e.count)??0;return`${t} tool call${t===1?"":"s"}`},"turn.thinkingCount":e=>{const t=(e==null?void 0:e.count)??0;return`${t} thought${t===1?"":"s"}`},"turn.stopped":"You cancelled this request","message.renderError":"This message could not be displayed.","tasks.title":"Background tasks","tasks.empty":"No tasks currently running","tasks.refreshStale":"Task status may be stale; reconnecting...","tasks.cancelFailed":"Failed to cancel task","tasks.alreadyStopped":"Task already stopped","tasks.moreAbove":e=>`^ ${(e==null?void 0:e.count)??0} more above`,"tasks.moreBelow":e=>`v ${(e==null?void 0:e.count)??0} more below`,"tasks.running":"Running","tasks.completed":"Completed","tasks.failed":"Failed","tasks.cancelled":"Stopped","tasks.paused":"Paused","tasks.kind.shell":"Shell","tasks.kind.monitor":"Monitor","tasks.action.stop":"Stop","tasks.action.abandon":"Abandon","tasks.action.confirmStop":"Confirm stop","tasks.action.confirmAbandon":"Confirm abandon","tasks.action.confirmHint":"This will end the blocking turn.","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} local agent`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} local agents`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} local agent paused`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} local agents paused`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} task done`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} tasks done`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} monitor`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} monitors`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} shells`,"tasks.confirmStop":"x again to confirm stop · ends the blocking turn","tasks.shortcut.select":"↑/↓ select","tasks.shortcut.view":"Enter view","tasks.shortcut.stop":"x stop","tasks.shortcut.abandon":"x abandon","tasks.shortcut.listClose":"←/Esc close","tasks.shortcut.detailBack":"← go back","tasks.shortcut.detailClose":"Esc/Enter/Space close","tasks.shortcut.close":"Esc close","tasks.shortcut.cancelConfirm":"Esc cancel","tasks.detail.workingDir":"Working dir","tasks.detail.outputFile":"Output file","tasks.detail.command":"Command","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} events`,"tasks.detail.exit":e=>`exit ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} dropped`,"tasks.detail.error":"Error","tasks.detail.stoppedBecause":"Stopped because","tasks.detail.resumeBlocked":"Resume blocked","tasks.detail.progress":"Progress","tasks.detail.prompt":"Prompt","tasks.detail.type":"Type","tasks.detail.runtime":"Time","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"Tool calls","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} tool calls`,"tasks.detail.nesting":"Nesting","tasks.detail.nestingValue":e=>`Level ${(e==null?void 0:e.level)??"?"} · from ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`Level ${(e==null?void 0:e.level)??"?"}`,"tasks.row.from":e=>`from ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"nested","tips.items":"Type / to see all available commands.|Use @ to reference file paths.|Press Esc to cancel an in-flight request.|Use Shift+Enter for a newline.|Press ↑↓ to browse message history.","tools.available":"Available tools:","tools.none":"No tools available.","tools.empty":"No built-in tools available. Open a session first.","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space for details · ":""}t to toggle ${e.name} · r to refresh · Esc to close`:"r to refresh · Esc to close","tools.details.hide":"Hide details","tools.details.show":"Show details","tools.description":"Description","tools.details":"Tool details","tools.loading":"Loading tools...","tools.name":"Tool name","tools.noDescription":"No description","tools.noMatches":"No matching tools.","tools.search":"Search tools…","tools.status":"Status","tools.status.disabled":"disabled","tools.status.enabled":"enabled","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} enabled`,"tools.title":"Tools","tools.update.disable":"Disable","tools.update.enable":"Enable","tools.updating":"Updating...","tool.collapse":"▲ Collapse","tool.expand":"Expand","tool.collapseHint":"Collapse","tool.status.failed":"Failed","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`Ran ${(e==null?void 0:e.count)??0} tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.editedFiles":e=>`Edited ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.ranCommands":e=>`Ran ${(e==null?void 0:e.count)??0} command${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.readFiles":e=>`Read ${(e==null?void 0:e.count)??0} file${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.searched":e=>`Searched ${(e==null?void 0:e.count)??0} time${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.updatedTodos":e=>`Updated task list${(e==null?void 0:e.count)===1?"":` ${(e==null?void 0:e.count)??0} times`}`,"toolGroup.summary.provideInformation":"Provide information","toolGroup.summary.askedQuestions":e=>`Asked ${(e==null?void 0:e.count)??0} question${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.summary.otherTools":e=>`Called ${(e==null?void 0:e.count)??0} other tool${(e==null?void 0:e.count)===1?"":"s"}`,"toolGroup.running":e=>`Running ${(e==null?void 0:e.name)??"tool"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · ${(e==null?void 0:e.count)??0} tools`:""}`,"toolGroup.runningPrefix":"Running","thinking.expand":"Expand thinking","thinking.collapse":"Collapse thinking","thinking.running":e=>`Thinking${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.doneBriefly":"Thought briefly","thinking.done":e=>e!=null&&e.duration?`Thought for ${e.duration}`:"Done thinking","thinking.translate":"Translate","thinking.translation":"Translated thinking","thinking.translating":"Translating...","thinking.translationThinking":"Thinking...","thinking.translationFailed":"Translation failed","thinking.retranslate":"Translate again","thinking.cancelTranslation":"Cancel","thinking.closeTranslation":"Close","thinking.inputTokens":e=>`Input tokens: ${(e==null?void 0:e.count)??"--"}`,"thinking.outputTokens":e=>`Output tokens: ${(e==null?void 0:e.count)??"--"}`,"sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} sessions`,"sessionsOverview.current":"Current","sessionsOverview.empty":"No sessions yet","sessionsOverview.loadFailed":"Failed to load sessions","sessionsOverview.loading":"Loading sessions…","sessionsOverview.openElsewhere":"Currently open in another window","sessionsOverview.openInSplit":"Open in split","sessionsOverview.openInSplitHint":"Show the selected sessions side by side in this window","sessionsOverview.openInTab":"Open in new tab","sessionsOverview.openInTabHint":"Open the selected sessions as a split view in a new browser tab","sessionsOverview.popupBlocked":"Pop-up blocked. Allow pop-ups for this site to open sessions in new tabs.","sessionsOverview.refresh":"Refresh","sessionsOverview.selectAll":"Select all","sessionsOverview.splitCap":e=>`Only the first ${(e==null?void 0:e.max)??6} selected sessions will open in the split.`,"sessionsOverview.selectSession":e=>`Select ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"Idle","sessionsOverview.status.needsApproval":"Needs approval","sessionsOverview.status.running":"Running","sessionsOverview.title":"Session Overview","splitView.title":"Split View","splitView.count":e=>`${(e==null?void 0:e.count)??0} panes`,"splitView.addPane":"Add session","splitView.closePane":"Close pane","splitView.maximizePane":"Maximize pane","splitView.restorePane":"Restore pane","splitView.paneError":"This session pane hit an error","splitView.paneConnectionError":"Connection lost","splitView.outerApprovalPending":"Your main session is waiting for approval.","splitView.goToApproval":"Go to it","splitView.empty":"No sessions in the split. Add one to get started.","splitView.composerPlaceholder":"Message this session…","settings.title":"Settings","settings.loading":"Loading settings...","settings.empty":"No settings available.","settings.footer":"↑↓ Navigate  Enter Toggle  Tab Scope  r Reload  ESC Close","settings.footer.edit":"Enter Save  ESC Cancel","settings.footer.theme":"↑↓ Navigate  Enter Select  ESC Back","settings.scope.user":"User","settings.scope.workspace":"Workspace","settings.value.on":"ON","settings.value.off":"OFF","settings.action.edit":"Edit","settings.action.select":"Select","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.requiresRestart":"This change requires a restart to take effect.","settings.models.title":"Models","settings.models.add":"+ Add Model","settings.models.setCurrent":"Set current","settings.models.current":"Current","settings.models.runtime":"Runtime","settings.models.delete":"Delete","settings.models.confirmDelete":"Confirm","settings.models.cancel":"Cancel","settings.models.empty":"No configured models yet.","settings.models.loading":"Loading models…","settings.models.deleteFailed":"Failed to delete model","settings.models.fallbacks.title":"Model Fallbacks","settings.models.fallbacks.hint":e=>`Select up to ${(e==null?void 0:e.max)??3}; tried in order when the main model is at capacity.`,"settings.models.fallbacks.confirm":"Confirm","settings.models.fallbacks.empty":"No selectable models.","settings.models.fallbacks.saveFailed":"Failed to save fallback models","settings.models.fallbacks.limitReached":e=>`Maximum of ${(e==null?void 0:e.max)??3} fallback models selected; deselect one to choose another.`,"settings.corrupted":e=>`Settings file was corrupted${(e==null?void 0:e.recovered)==="true"?" (recovered from backup)":""}`,"settings.label.ui.chatWidth":"Chat width","settings.description.ui.chatWidth":"Frontend-only chat content width. Stored in this browser.","settings.option.ui.chatWidth.1000":"Regular","settings.option.ui.chatWidth.wide":"Ultra wide","settings.label.visionModel":"Vision Model","settings.description.visionModel":"Image-capable model used as the vision bridge. Leave empty to auto-select.","welcome.changeModel":"(/model to change)","welcome.defaultModel":"unknown model","welcome.modeHint":"Shift+Tab or /approval-mode","welcome.prompt":"What would you like to do?","welcome.titlePrefix":"Welcome to","welcome.tipLabel":"Tips:"},Ome={...$9,"git.currentBranch":e=>`当前 Git 分支：${(e==null?void 0:e.branch)??""}`,"workspace.paneLabel":e=>`工作区：${(e==null?void 0:e.name)??""}`,"toolName.edit":"编辑","toolName.write_file":"写入文件","toolName.read_file":"读取文件","toolName.grep":"搜索内容","toolName.grep_search":"搜索内容","toolName.glob":"Glob","toolName.run_shell_command":"运行命令","toolName.todo_write":"任务清单","toolName.save_memory":"保存记忆","toolName.agent":"Agent","toolName.skill":"查看技能","toolName.enter_plan_mode":"进入计划模式","toolName.exit_plan_mode":"退出计划模式","toolName.web_fetch":"网络搜索","toolName.webfetch":"网络搜索","toolName.fetch":"网络搜索","toolName.web_search":"网络搜索","toolName.list_directory":"列出文件","toolName.lsp":"LSP","toolName.ask_user_question":"询问用户","toolName.cron_create":"创建定时任务","toolName.cron_list":"定时任务列表","toolName.cron_delete":"删除定时任务","toolName.task_create":"创建任务","toolName.task_update":"更新任务","toolName.task_list":"任务列表","toolName.task_stop":"停止任务","toolName.team_create":"创建团队","toolName.team_delete":"删除团队","toolName.send_message":"发送消息","toolName.structured_output":"结构化输出","toolName.monitor":"监控","toolName.notebook_edit":"编辑 Notebook","toolName.tool_search":"工具搜索","toolName.enter_worktree":"进入 Worktree","toolName.exit_worktree":"退出 Worktree","toolName.workflow":"工作流","toolName.team_plan_approval":"团队计划审批","toolName.loop_wakeup":"循环唤醒","toolName.create_sub_session":"创建子会话","toolName.read_mcp_resource":"读取 MCP 资源","toolName.artifact":"制品","toolName.record_artifact":"记录制品","toolName.bash":"运行命令","toolName.shell":"Shell 命令","toolName.read":"读取文件","toolName.readfile":"读取文件","toolName.write":"写入文件","toolName.writefile":"写入文件","toolName.search":"搜索内容","toolName.todowrite":"任务清单","toolName.savememory":"保存记忆","toolName.askuserquestion":"询问用户","toolName.toolsearch":"工具搜索","about.auth":"认证","about.baseUrl":"Base URL","about.fastModel":"快速模型","about.memoryUsage":"内存使用","about.model":"模型","about.noProxy":"no proxy","about.noSandbox":"no sandbox","about.platform":"操作系统","about.proxy":"代理","about.qwenCode":"Qwen Code","about.runtime":"运行环境","about.sandbox":"沙箱","about.sessionId":"会话 ID","about.title":"状态","agent.back":"返回","agent.builtInBadge":"（内置）","agent.action.delete":"删除智能体","agent.action.edit":"编辑智能体","agent.action.view":"查看智能体","agent.chooseAction":e=>`选择操作：${(e==null?void 0:e.name)??""}`,"agent.chooseActionTitle":"选择操作","agent.colorLabel":"颜色：","agent.colorUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的颜色`,"agent.create":"创建新的智能体","agent.create.button":"创建智能体","agent.create.confirm":"确认并保存","agent.create.desc":"创建新的智能体","agent.create.descPlaceholder":"这个智能体做什么？","agent.create.describeAgent":"描述您的子智能体","agent.create.description":"描述","agent.create.editAgain":"编辑","agent.create.enterDescription":"输入描述","agent.create.enterName":"输入子智能体名称","agent.create.enterPrompt":"输入系统提示词","agent.create.generateFailed":e=>`生成子智能体失败：${(e==null?void 0:e.error)??"未知错误"}`,"agent.create.generatingConfig":"正在生成子智能体配置...","agent.create.loading":"创建中...","agent.create.location":"选择位置","agent.create.method":"选择生成方式","agent.create.method.manual":"手动创建","agent.create.method.qwen":"使用 Qwen Code 生成","agent.create.method.qwen.recommended":"使用 Qwen Code 生成（推荐）","agent.create.method.qwen.desc":"LLM 生成名称、提示词和描述","agent.create.name":"名称","agent.create.namePlaceholder":"my-agent","agent.create.nameHelp":"输入此子智能体清晰且唯一的名称。","agent.create.project":"项目","agent.create.project.cli":"项目级 (.qwen/agents/)","agent.create.project.desc":"创建项目级智能体","agent.create.prompt":"系统提示词","agent.create.promptPlaceholder":"你是一个专门的智能体...","agent.create.promptPlaceholder.cli":"例如：你是一名专业的代码审查员...","agent.create.promptHelp":"编写定义此子智能体行为的系统提示词。为了获得最佳效果，请全面描述。","agent.create.preview":"预览","agent.create.qwenHint":"描述此子智能体应该做什么以及何时使用它。（为了获得最佳效果，请全面描述）","agent.create.qwenPlaceholder":"> 例如：专业的代码审查员，根据最佳实践审查代码...","agent.create.required":"名称、描述和系统提示词均为必填项。","agent.create.save":"保存智能体","agent.create.scope":"选择智能体的保存位置","agent.create.manualDescHelp":"描述此子智能体应该在何时以及如何使用。","agent.create.manualDescPlaceholder":"例如：根据最佳实践和潜在 bug 审查代码。","agent.create.toolsSelection":"选择工具","agent.create.tools.all":"所有工具","agent.create.tools.allDefault":"所有工具（默认）","agent.create.tools.allInfo":"已选择所有工具，包括 MCP 工具","agent.create.tools.allInfoFallback":"已选择所有工具，包括 MCP 工具","agent.create.tools.editLabel":"• 编辑工具:","agent.create.tools.executionLabel":"• 执行工具:","agent.create.tools.none":"（无）","agent.create.tools.readEdit":"读取和编辑工具","agent.create.tools.readEditExecute":"读取、编辑和执行工具","agent.create.tools.readOnlyLabel":"• 只读工具:","agent.create.tools.readOnly":"只读工具","agent.create.tools.selected":"已选择的工具:","agent.create.user":"用户","agent.create.user.cli":"用户级 (~/.qwen/agents/)","agent.create.user.desc":"创建用户级智能体","agent.createFirstHint":"使用 '/agents create' 创建第一个智能体。","agent.created":e=>`已创建 ${(e==null?void 0:e.name)??""}`,"agent.delete":"删除","agent.delete.confirm":e=>`确定要删除 "${(e==null?void 0:e.name)??""}" 吗？`,"agent.delete.loading":"删除中...","agent.delete.no":"否","agent.delete.title":e=>`删除 ${(e==null?void 0:e.name)??""}`,"agent.delete.yes":"是，删除","agent.deleted":e=>`已删除 ${(e==null?void 0:e.name)??""}`,"agent.edit":"编辑","agent.edit.color":"编辑颜色","agent.edit.tools":"编辑工具","agent.editColorTitle":e=>`编辑颜色：${(e==null?void 0:e.name)??""}`,"agent.editTitle":e=>`编辑 ${(e==null?void 0:e.name)??""}`,"agent.empty":"未找到智能体。","agent.noMatches":"未找到匹配的智能体。","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.detail.overview":"基本信息","agent.detail.tools":"工具","agent.detail.systemPrompt":"系统提示词","agent.toolsUpdated":e=>`已更新 ${(e==null?void 0:e.name)??""} 的工具`,"agent.usingCount":e=>`使用中：${(e==null?void 0:e.count)??0} 个智能体`,"agent.view":"查看","agents.closed":"智能体面板已关闭。","agents.title":"智能体","subagent.result":"结果","subagent.tools":e=>`工具 (${(e==null?void 0:e.count)??0})`,"subagent.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"subagent.toggleStream":"展开/收起子智能体详情","subagent.pending":"等待中","subagent.running":"运行中","timeline.parallelAgents":"并行智能体","timeline.thinking":"思考","timeline.assistantUpdate":"助手更新","timeline.toolCalls":e=>`${(e==null?void 0:e.count)??0} 个工具调用`,"timeline.planUpdate":"计划更新","timeline.statusUpdate":"状态更新","timeline.userTurn":"用户轮次","timeline.planDetail":"计划更新","timeline.parallelAgentsDetail":e=>`${(e==null?void 0:e.count)??0} 个并行智能体`,"timeline.noActivity":"无活动","timeline.sessionTimeline":"会话时间线","timeline.turnPrefix":e=>`第 ${(e==null?void 0:e.index)??0} 轮`,"timeline.currentTurn":"当前轮次","timeline.kind.thought":"思考","timeline.kind.commentary":"助手更新","timeline.kind.tool":"工具调用","timeline.kind.agents":"并行智能体","timeline.kind.plan":"计划更新","timeline.kind.status":"状态更新","timeline.kind.none":"轮次","common.copy":"复制","common.open":"打开","common.na":"不适用","common.server":"服务器","common.agent":"智能体","common.auto":"自动","common.runtime":"运行时","common.failedToLoad":"加载失败","auth.notSet":"（未设置）","auth.apiKeyPlaceholder":"sk-...","auth.modelsPlaceholder":"模型ID-1, 模型ID-2","model.usingModel":e=>`正在使用${e!=null&&e.isRuntime?"运行时":""}模型：${(e==null?void 0:e.modelId)??""}`,"mermaid.label":"mermaid","mermaid.errorLabel":"mermaid（错误）","user.uploadedImage":e=>`用户上传的图片 ${(e==null?void 0:e.index)??1}`,"voice.noSpeech":"未检测到语音。","voice.stopDictation":"停止语音输入","voice.transcribing":"正在转录…","voice.starting":"正在启动…","voice.errorRetry":e=>`语音错误 — 点击重试${e!=null&&e.message?`：${e.message}`:""}`,"voice.noSpeechRetry":"未检测到语音 — 点击重试","voice.startDictation":"开始语音输入","voice.error":"语音错误","resume.failedToLoad":"加载会话失败","toast.dismiss":"关闭通知","toast.dismissShort":"关闭","insight.ready":"Insight 报告已生成！","request.cancelled":"请求已取消。","approval.execQuestion":e=>`允许执行：'${(e==null?void 0:e.tool)??""}'？`,"approval.changeQuestion":"是否继续？","approval.launchAgentQuestion":"启动这个 agent？","approval.option.allowOnce":"是，允许一次","approval.option.rejectOnce":"拒绝","approval.option.allowAllEdits":"允许所有编辑","approval.option.allowAlwaysProject":"项目内始终允许","approval.option.allowAlwaysUser":"对此用户始终允许","approval.option.allowAlwaysServer":"对此服务始终允许","approval.option.allowAlwaysTool":"对此工具始终允许","assistant.branch":"分叉","assistant.copy":"复制","at.category.extensions":"扩展","at.category.extensions.description":"引用已启用扩展","at.category.files":"文件","at.category.files.description":"引用工作区文件","at.category.mcpResources":"MCP 资源","at.category.mcpResources.description":"引用 MCP server 资源","at.menu":"引用菜单","common.back":"返回","common.all":"全部","common.cancel":"取消","common.close":"关闭","common.fullscreen":"全屏","common.exitFullscreen":"退出全屏","common.continue":"继续","common.current":"当前","common.disabled":"已禁用","common.enabled":"已启用","common.enterSelect":"回车选择","common.invalid":"无效","common.loading":"加载中...","common.retry":"重试","common.save":"保存","common.navigate":"↑↓ 导航","common.next":"下一步","common.noResults":"无结果","common.previous":"上一步","common.expand":"展开","common.collapse":"收起","common.refresh":"刷新","common.search":"搜索","common.valid":"有效","common.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"agent.count":e=>`${(e==null?void 0:e.count)??0} 个智能体`,"askUser.submit":"提交","askUser.ignore":"忽略","askUser.multiHint":"可多选","askUser.progress":e=>`${(e==null?void 0:e.current)??0}/${(e==null?void 0:e.total)??0} 个问题`,"askUser.selectAnswer":"选择一个答案","askUser.typePlaceholder":"输入内容...","copy.failedFallback":"复制到剪贴板失败","copy.inlineLatexMissing":"最后一条 AI 输出中没有匹配的行内 LaTeX 表达式。","copy.latexMissing":"最后一条 AI 输出中没有匹配的 LaTeX 块。","copy.noOutput":"历史记录中没有可复制的输出","copy.noText":"最后一条 AI 输出没有可复制的文本。","copy.codeMissing":"最后一条 AI 输出中没有匹配的代码块。","copy.outputCopied":"已复制最后一条输出到剪贴板","copy.toClipboard":e=>`${(e==null?void 0:e.label)??"内容"} 已复制到剪贴板`,"code.copy":"复制","code.copied":"已复制！","echartsChart.defaultTitle":"图表加载中","echartsChart.noData":"暂无数据","echartsChart.tableNotice":e=>{const t=Number((e==null?void 0:e.omittedRows)??0),n=Number((e==null?void 0:e.omittedColumns)??0);return t>0&&n>0?`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行，${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:n>0?`显示 ${(e==null?void 0:e.visibleColumns)??0}/${(e==null?void 0:e.totalColumns)??0} 列`:`显示 ${(e==null?void 0:e.visibleRows)??0}/${(e==null?void 0:e.totalRows)??0} 行`},"echartsChart.rendering":"正在渲染图表","echartsChart.runtimeUnavailable":"图表运行时不可用。","echartsChart.renderFailed":"图表渲染失败。","echartsChart.viewMode":"视图模式","echartsChart.showChart":"显示图表","echartsChart.showData":"显示数据","echartsChart.chart":"图表","echartsChart.data":"数据","markdownTable.blank":"(空白)","markdownTable.column":e=>`第 ${(e==null?void 0:e.index)??""} 列`,"markdownTable.rows":e=>`${(e==null?void 0:e.count)??0} 行`,"markdownTable.rowsFiltered":e=>`${(e==null?void 0:e.visible)??0}/${(e==null?void 0:e.total)??0} 行`,"markdownTable.hint":"点击表头排序，点击 ▾ 打开筛选。","markdownTable.filtersActive":e=>`${(e==null?void 0:e.count)??0} 个筛选`,"markdownTable.selection.selected":"已选","markdownTable.selection.nonEmpty":"非空","markdownTable.selection.numeric":"数值","markdownTable.selection.sum":"求和","markdownTable.selection.average":"平均","markdownTable.selection.min":"最小","markdownTable.selection.max":"最大","markdownTable.copyTsv":"复制 TSV","markdownTable.copyVisible":"快捷复制","markdownTable.freezeFirstColumn":"冻结首列","markdownTable.unfreezeFirstColumn":"取消冻结首列","markdownTable.density":e=>`密度：${(e==null?void 0:e.density)??""}`,"markdownTable.density.standard":"标准","markdownTable.density.compact":"紧凑","markdownTable.density.comfortable":"舒适","markdownTable.expandLongText":"展开文本","markdownTable.collapseLongText":"收起文本","markdownTable.emptyValue":"(空白)","markdownTable.hideColumn":"隐藏列","markdownTable.showHiddenColumns":e=>`显示 ${(e==null?void 0:e.count)??0} 个隐藏列`,"markdownTable.moveColumn":e=>`移动 ${(e==null?void 0:e.column)??""}`,"markdownTable.resizeColumn":e=>`调整 ${(e==null?void 0:e.column)??""} 列宽`,"markdownTable.rowDetails":"详情","markdownTable.rowDetailsAria":e=>`查看第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.closeRowDetailsAria":e=>`收起第 ${(e==null?void 0:e.index)??""} 行详情`,"markdownTable.detailsHeader":"单行详情","markdownTable.cellDialogTitle":"当前字段值","markdownTable.copyCell":"复制","markdownTable.close":"关闭","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":"⊞","mermaid.zoomIn":"+","mermaid.zoomOut":"−","mermaid.zoomReset":"↺","contextUsage.active":"已激活","contextUsage.autocompactBuffer":"自动压缩缓冲区","contextUsage.bodyLoaded":"已加载正文","contextUsage.builtinTools":"内置工具","contextUsage.contextWindow":"上下文窗口","contextUsage.detailHint":"运行 /context detail 查看逐项明细。","contextUsage.estimatedOverhead":"预估的对话前开销","contextUsage.free":"空闲","contextUsage.memoryFiles":"Memory 文件","contextUsage.messages":"消息","contextUsage.mcpTools":"MCP 工具","contextUsage.model":"模型","contextUsage.noSession":"当前还没有会话。请先发送第一条消息，再查看上下文使用情况。","contextUsage.noApiResponse":"尚无 API 响应。发送一条消息后可查看实际使用量。","contextUsage.overLimit":"上下文已超过限制！请使用 /compress 或 /clear 减少占用。","contextUsage.skills":"Skills","contextUsage.systemPrompt":"系统提示词","contextUsage.title":"上下文使用情况","contextUsage.tokens":"tokens","contextUsage.usageByCategory":"按类别统计","contextUsage.used":"已用","daemon.title":"Daemon 状态","daemon.details.loading":"正在加载诊断信息...","daemon.details.failed":"诊断信息加载失败。","daemon.refresh":"刷新","daemon.loading":"正在加载 Daemon 状态...","daemon.loadFailed":"加载 Daemon 状态失败","daemon.updatedAt":e=>`更新于 ${(e==null?void 0:e.time)??""}`,"daemon.none":"无","daemon.level.ok":"正常","daemon.level.warning":"警告","daemon.level.error":"错误","daemon.level.unavailable":"不可用","daemon.issues.title":"问题","daemon.overview.title":"Daemon","daemon.overview.version":"版本","daemon.overview.pid":"PID","daemon.overview.mode":"模式","daemon.overview.uptime":"运行时长","daemon.overview.workspace":"工作区","daemon.runtime.title":"运行时","daemon.runtime.activeSessions":"活跃会话","daemon.runtime.activePrompts":"执行中的 prompt","daemon.runtime.idle":"空闲时长","daemon.runtime.noActivity":"暂无活动","daemon.runtime.pendingPermissions":"待审批权限","daemon.runtime.permissionPolicy":"权限策略","daemon.runtime.channel":"ACP 通道","daemon.runtime.channelLive":"在线","daemon.runtime.channelDown":"离线","daemon.runtime.startingUp":"运行时启动中...","daemon.runtime.startFailed":"运行时启动失败","daemon.runtime.channelWorker":"通道 Worker","daemon.runtime.channelWorkerRestarts":"Worker 重启次数","daemon.runtime.memory":"内存 (RSS / 堆)","daemon.transport.title":"传输","daemon.transport.restSse":"REST SSE 流","daemon.transport.acpDisabled":"ACP 传输未启用","daemon.transport.acpConnections":"ACP 连接","daemon.transport.acpStreams":"ACP 流 (会话/SSE/WS)","daemon.transport.pendingRequests":"待处理客户端请求","daemon.transport.rateLimitRejected":"限流拒绝数","daemon.security.title":"安全","daemon.security.token":"Bearer 令牌","daemon.security.requireAuth":"强制鉴权","daemon.security.loopback":"回环绑定","daemon.security.allowOrigin":"允许来源","daemon.security.shell":"会话 Shell 命令","daemon.security.configured":"已配置","daemon.security.notConfigured":"未配置","daemon.limits.title":"限制","daemon.limits.unlimited":"无限制","daemon.limits.maxSessions":"最大会话数","daemon.limits.maxPendingPrompts":"每会话最大待处理 prompt 数","daemon.limits.maxConnections":"最大监听连接数","daemon.limits.eventRing":"事件环大小","daemon.limits.promptDeadline":"Prompt 截止时间","daemon.limits.sessionIdle":"会话空闲超时","daemon.capabilities.title":"能力","daemon.capabilities.titleCount":e=>`能力 (${(e==null?void 0:e.count)??0})`,"daemon.full.sessions.title":"会话","daemon.full.sessions.empty":"无活跃会话","daemon.full.session.pendingPrompts":e=>`${(e==null?void 0:e.count)??0} 个待处理 prompt`,"daemon.full.session.pendingPermissions":e=>`${(e==null?void 0:e.count)??0} 个待审批权限`,"daemon.full.session.prompting":"执行中","daemon.full.workspace.title":"工作区诊断","daemon.full.workspace.empty":"未上报工作区诊断","daemon.full.auth.title":"认证","daemon.full.auth.providers":"设备码登录提供方","daemon.full.auth.pending":"进行中的设备码登录","daemon.full.acp.title":"ACP 连接","daemon.tab.overview":"概览","daemon.tab.usage":"用量","daemon.tab.metrics":"指标","daemon.tab.diagnostics":"诊断","daemon.charts.title":"指标图表","daemon.charts.empty":"正在采集指标…首次采样后显示图表。","daemon.charts.concurrency":"并发","daemon.charts.activePrompts":"执行中任务","daemon.charts.activeSessions":"会话","daemon.charts.requests":"请求数","daemon.charts.reqTotal":"总数","daemon.charts.reqErrors":"错误","daemon.charts.apiLatency":"API 耗时","daemon.charts.promptLatency":"Prompt 延迟","daemon.charts.queueWait":"排队等待","daemon.charts.promptDuration":"端到端","daemon.charts.eventLoop":"事件循环延迟","daemon.charts.eventLoopLag":"延迟 p99","daemon.charts.queuedPrompts":"排队中","daemon.charts.reqRejected":"限流拒绝","daemon.charts.llmLatency":"LLM 耗时","daemon.charts.apiHealth":"模型 API 健康","daemon.charts.apiErrors":"API 报错","daemon.charts.apiRetries":"重试","daemon.charts.cpu":"CPU","daemon.charts.pipe":"IPC 管道","daemon.charts.pipeIn":"接收","daemon.charts.pipeOut":"发送","daemon.charts.connections":"连接数","daemon.charts.cpuDaemon":"Daemon","daemon.charts.cpuChild":"子进程","daemon.charts.rssDaemon":"Daemon RSS","daemon.charts.rssChild":"子进程 RSS","daemon.charts.memory":"内存","daemon.charts.heap":"堆","daemon.charts.tokens":"Token 消耗","daemon.charts.tokensIn":"输入","daemon.charts.tokensOut":"输出","daemon.charts.peak":"峰值","daemon.charts.concurrency.help":"每次采样的实时负载:正在执行的 prompt、排队中(已接受未派发)、活跃会话数。排队数超过执行数即出现背压。","daemon.charts.requests.help":"每个窗口内客户端↔守护进程的 HTTP 流量,并非模型调用。总请求数、返回 4xx/5xx 的数量、被限流拒绝的数量。","daemon.charts.apiLatency.help":'客户端↔守护进程 HTTP 请求耗时(p50/p95)——反映守护进程本身快慢,而非模型。与「LLM 耗时」对比可区分是"我们慢"还是"模型慢"。',"daemon.charts.llmLatency.help":"每轮模型 API 往返耗时(守护进程→模型→守护进程),p50/p95。属模型侧延迟,区别于上面的 HTTP「API 耗时」。","daemon.charts.apiHealth.help":"服务商侧 LLM 失败。每次失败尝试 = 1 次报错,每次自动退避 = 1 次重试。瞬时 429/5xx 通常被重试吸收(报错 ≈ 重试);报错高于重试说明调用彻底失败。","daemon.charts.promptLatency.help":"每个 prompt(任务):派发前在会话队列中的等待 p95,以及端到端执行 p95。等待升高即背压信号。","daemon.charts.eventLoop.help":"守护进程事件循环延迟 p99——CPU 饱和 / 阻塞信号。延迟高说明守护进程被拖住,一切都会变慢。","daemon.charts.cpu.help":"每次采样的 CPU 占用(占全部核心百分比):守护进程,以及运行实际 LLM/工具的 ACP 子进程。子进程 0% 表示无子进程运行。","daemon.charts.memory.help":"每次采样的常驻内存:守护进程 RSS、守护进程 V8 堆、ACP 子进程 RSS。若持续增长可能是内存泄漏。","daemon.charts.pipe.help":"每个窗口内经 stdio 管道与 ACP 子进程收发的字节数。持续偏大说明守护进程与子进程间帧交互频繁。","daemon.charts.connections.help":"每次采样的客户端传输连接:REST/SSE 流、ACP WebSocket 流、ACP 连接数。","daemon.charts.tokens.help":"每个窗口内计入模型轮次的输入(prompt)与输出(completion)token——随时间的模型消耗。","daemon.usage.today":"今日","daemon.usage.period7d":"7天","daemon.usage.period30d":"30天","daemon.usage.rangeWeek":"近 7 天","daemon.usage.rangeMonth":"近 30 天","daemon.usage.rangeGroup":"统计周期","daemon.usage.tokensConsumed":"tokens 消耗","daemon.usage.sessions":"会话","daemon.usage.requests":"请求","daemon.usage.tools":"工具","daemon.usage.changes":"改动","daemon.usage.breakdownTitle":"Token 拆分","daemon.usage.inputTokens":"输入 tokens","daemon.usage.inputHint":"请求 + 缓存读取","daemon.usage.outputTokens":"输出 tokens","daemon.usage.outputHint":"响应 + 推理","daemon.usage.cacheRead":"缓存读取","daemon.usage.cacheHint":"缓存读取占比","daemon.usage.heatmapTitle":"Token 热力图","daemon.usage.heatmapSub":e=>`最近 ${(e==null?void 0:e.months)??12} 个月 · 每日 token 汇总`,"daemon.usage.low":"少","daemon.usage.high":"多","daemon.usage.dowMon":"一","daemon.usage.dowWed":"三","daemon.usage.dowFri":"五","daemon.usage.empty":"暂无 token 使用记录。","daemon.usage.loading":"加载用量中…","daemon.usage.failed":"加载用量失败","daemon.usage.cellTokens":e=>`${(e==null?void 0:e.date)??""} · Tokens: ${(e==null?void 0:e.tokens)??"0"} · Cache: ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.rangeWordToday":"今日","daemon.usage.rangeWordWeek":"7 天","daemon.usage.rangeWordMonth":"30 天","daemon.usage.modelShareTitle":"模型份额","daemon.usage.modelShareSub":"token 份额 · 浅绿表示缓存读取","daemon.usage.modelMeta":e=>`${(e==null?void 0:e.tokens)??"0"} tokens · 缓存 ${(e==null?void 0:e.cache)??0}%`,"daemon.usage.skillTitle":"技能调用","daemon.usage.skillSub":"技能名 / 次数","daemon.usage.skillName":"技能名","daemon.usage.skillCount":"次数","daemon.usage.dailyTokensTitle":"Tokens","daemon.usage.dailyTokensSub":"每日 token 总量","daemon.usage.dailySessionsTitle":"会话","daemon.usage.dailySessionsSub":"每日活跃会话数","delete.cannotCurrent":"无法删除当前活动会话。","delete.action":"删除","delete.deleted":"会话已删除。","delete.deletedCount":e=>`已删除 ${(e==null?void 0:e.count)??0} 个会话。`,"delete.deleting":"删除中...","delete.failed":e=>`删除会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"delete.footer":"↑↓ 导航 · Space 选择 · Enter 删除 · Esc 取消","delete.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"delete.none":"没有可删除的会话","delete.allFailed":e=>`删除 ${(e==null?void 0:e.count)??0} 个会话失败: ${(e==null?void 0:e.reason)??"未知错误"}`,"delete.nonRemoved":"没有会话被删除。","delete.notFound":"会话未找到，可能已被删除。","delete.partialFail":e=>`已删除 ${(e==null?void 0:e.removed)??0} 个，${(e==null?void 0:e.failed)??0} 个失败: ${(e==null?void 0:e.detail)??"未知错误"}`,"delete.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"delete.pressSearch":"按 / 搜索；Space 选择；Enter 删除","delete.selected":e=>`已选 ${(e==null?void 0:e.count)??0} 个`,"delete.title":"删除会话","time.justNow":"刚刚","time.minutesAgo":e=>`${(e==null?void 0:e.count)??0} 分钟前`,"time.hoursAgo":e=>`${(e==null?void 0:e.count)??0} 小时前`,"time.daysAgo":e=>`${(e==null?void 0:e.count)??0} 天前`,"dialog.footer.close":"Esc 关闭","dialog.footer.confirmCancel":"Enter 确认 · Esc 取消","release.cannotCurrent":"不能释放当前活动会话。","release.action":"释放","release.released":"会话已释放。","release.failed":e=>`释放会话失败。${e!=null&&e.reason?` ${e.reason}`:""}`,"release.footer":"↑↓ 导航 · Enter 释放 · Esc 取消","release.inactive":"只有活跃的 live session 才能释放。","release.inactiveBadge":"非活跃","release.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"release.matches":e=>`${(e==null?void 0:e.count)??0} 个匹配`,"release.none":"没有可释放的 live session","release.pressSearch":"按 / 搜索；Enter 释放选中的 live session","release.releasing":"释放中...","release.title":"释放会话","dialog.footer.menu":"Esc 返回菜单","dialog.footer.mcpServers":"↑↓ 导航 · Enter 查看详情 · r 刷新 · Esc 关闭","dialog.footer.mcpSelect":"↑↓ 导航 · Enter 选择 · Esc 返回","dialog.footer.modelFast":"↑↓ 导航 · / 搜索 · c 自定义 · Enter 设置 fast model · Esc 取消","dialog.footer.navSelectCancel":"↑↓ 导航 · Enter 选择 · Esc 取消","dialog.footer.navSelectClose":"↑↓ 导航 · Enter 选择 · Esc 关闭","dialog.footer.navSelectMenu":"↑↓ 导航 · Enter 选择 · Esc 返回菜单","dialog.footer.navOpenClose":"↑↓ 导航 · Enter 打开 · Esc 关闭","dialog.footer.navOpenMenu":"↑↓ 导航 · Enter 打开 · Esc 返回菜单","dialog.footer.back":"Esc 返回","dialog.footer.backClose":"Esc 关闭","dialog.footer.saveClose":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 关闭","dialog.footer.saveMenu":"↑↓ 切换输入框 · ⌘/Ctrl+Enter 保存 · Esc 返回菜单","dialog.footer.search":"输入搜索 · Enter 确认 · Esc 清空","dialog.footer.select":"Enter 选择","editor.escClearHint":"再按一次 Esc 清空","editor.hintCommands":"命令","editor.hintFiles":"文件","editor.hintNext":"下一条","editor.hintPrev":"上一条","editor.hintSearch":"搜索","editor.noHistory":"没有匹配的历史记录","editor.placeholder":"输入消息或 @ 文件路径","editor.shellPlaceholder":"请输入终端命令","editor.send":"发送消息","editor.connectionDisconnected":"连接已中断，请在恢复后重试。","editor.sessionLoading":"会话正在加载，请稍后再发送。","editor.processing":"处理中。新消息会进入队列。","editor.searchHint":"ctrl+r 下一条 · tab 采纳 · enter 发送 · esc 取消","editor.searchLabel":"历史搜索：","editor.searchPlaceholder":"输入以搜索…","quickActions.open":"更多操作","quickActions.title":"更多操作","quickActions.mcp":"MCP","quickActions.context":"上下文","quickActions.status":"运行状态","quickActions.stats":"会话统计","quickActions.memory":"记忆管理","quickActions.extensions":"扩展","quickActions.skills":"技能详情","quickActions.tools":"工具详情","quickActions.agents":"智能体","quickActions.help":"帮助","quickActions.theme":"设置主题","quickActions.auth":"认证","quickActions.settings":"设置","quickActions.new":"新建会话","quickActions.resume":"切换会话","quickActions.delete":"删除会话","quickActions.branch":"复制会话","quickActions.rewind":"回退会话","quickActions.historyQuestion":"历史提问","quickActions.recap":"生成摘要","quickActions.copy":"复制输出","quickActions.shellMode":"Shell模式","quickActions.exitShellMode":"退出Shell","quickActions.setGoal":"设置目标","session.missing":"当前会话不存在","session.new":"新建会话","workspace.loadFailed":"工作区加载失败","workspace.notFound":"工作区不存在","workspace.notFoundDescription":"此工作区可能已被移除，或链接已经失效。","workspace.loadFailedDescription":"无法连接工作区服务，请检查守护进程后重试。","scheduledTasks.title":"定时任务","scheduledTasks.subtitle":"按计划自动执行任务，也可随时手动触发。","scheduledTasks.loading":"加载中…","scheduledTasks.count":e=>`${(e==null?void 0:e.count)??0} 个任务`,"scheduledTasks.refresh":"刷新","scheduledTasks.new":"新建定时任务","scheduledTasks.createViaChat":"通过聊天创建","scheduledTasks.chatStarter":"帮我创建一个长期保留的定时任务，我想：","scheduledTasks.name":"名称","scheduledTasks.workspace":"工作区","scheduledTasks.workspacePrimaryTag":"（主）","scheduledTasks.taskId":"任务 ID","scheduledTasks.schedule":"计划","scheduledTasks.type":"类型","scheduledTasks.status":"状态","scheduledTasks.namePlaceholder":"可选 —— 默认取提示词","scheduledTasks.prompt":"提示词","scheduledTasks.promptPlaceholder":"这个任务要做什么？","scheduledTasks.reference.extension":"扩展","scheduledTasks.reference.skill":"技能","scheduledTasks.reference.mcp":"MCP","scheduledTasks.referencePicker":"引用选择器","scheduledTasks.reference.loading":"加载中…","scheduledTasks.reference.empty":"暂无可选项。","scheduledTasks.frequency":"频率","scheduledTasks.freq.daily":"每天","scheduledTasks.freq.weekdays":"工作日","scheduledTasks.freq.weekly":"每周","scheduledTasks.freq.hourly":"每小时","scheduledTasks.freq.minutes":"每 N 分钟","scheduledTasks.freq.custom":"自定义（cron）","scheduledTasks.time":"时间","scheduledTasks.weekday":"星期","scheduledTasks.interval":"分钟","scheduledTasks.cron":"Cron 表达式","scheduledTasks.weekdayNames":"周日,周一,周二,周三,周四,周五,周六","scheduledTasks.human.daily":e=>`每天 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekdays":e=>`工作日 ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.weekly":e=>`每${(e==null?void 0:e.day)??""} ${(e==null?void 0:e.time)??""}`,"scheduledTasks.human.hourly":e=>`每小时 第 ${(e==null?void 0:e.min)??"00"} 分`,"scheduledTasks.human.everyMinutes":e=>`每 ${(e==null?void 0:e.n)??""} 分钟`,"scheduledTasks.never":"尚未运行","scheduledTasks.repeats":"重复","scheduledTasks.runsOnce":"仅一次","scheduledTasks.lastFired":e=>`上次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.runNow":"立即运行","scheduledTasks.enable":"启用","scheduledTasks.disable":"停用","scheduledTasks.delete":"删除","scheduledTasks.deleteConfirmTitle":"删除定时任务","scheduledTasks.deleteConfirm":e=>`确定删除定时任务「${(e==null?void 0:e.name)??""}」？`,"scheduledTasks.deletedSnapshot":"这个定时任务已被删除，下面显示的是创建时的快照。","scheduledTasks.sessionScopedSnapshot":"这是一个会话内定时任务，下面显示的是创建时的快照。","scheduledTasks.empty":"还没有定时任务，创建一个开始吧。","scheduledTasks.create":"创建","scheduledTasks.creating":"创建中…","scheduledTasks.cancel":"取消","scheduledTasks.error.invalidSchedule":"计划无效","scheduledTasks.error.emptyPrompt":"提示词不能为空","scheduledTasks.error.promptTooLong":e=>`提示词超过 ${(e==null?void 0:e.max)??1e5} 字符限制`,"scheduledTasks.error.toggleFailed":"更新任务失败","scheduledTasks.error.deleteFailed":"删除任务失败","scheduledTasks.edit":"编辑","scheduledTasks.editTitle":"编辑定时任务","scheduledTasks.save":"保存","scheduledTasks.saving":"保存中…","scheduledTasks.runHistory":e=>`运行记录（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistory":e=>`查看对话（${(e==null?void 0:e.count)??0}）`,"scheduledTasks.viewHistoryEmpty":"查看对话","scheduledTasks.viewHistoryHint":"打开该任务的会话查看运行详情","scheduledTasks.runKind.catchUp":"补跑","scheduledTasks.runKind.manual":"手动","scheduledTasks.runKind.withheld":"已跳过","scheduledTasks.error.runFailed":"记录运行失败","scheduledTasks.error.oneShotConsumedButFailed":"任务已删除,但提示词未能送达——它没有运行。请重新创建后重试。","scheduledTasks.dueNow":"即将运行","scheduledTasks.nextRunTooltip":e=>`下次运行：${(e==null?void 0:e.when)??""}`,"scheduledTasks.dur.d":"天","scheduledTasks.dur.h":"小时","scheduledTasks.dur.m":"分","scheduledTasks.dur.s":"秒","scheduledTasks.runMode":"运行模式","scheduledTasks.runMode.shared":"共享会话","scheduledTasks.runMode.isolated":"隔离（每次运行新建会话）","scheduledTasks.runMode.shared.hint":"所有运行记录累积在同一个会话中。","scheduledTasks.runMode.isolated.hint":"每次运行获得独立的会话上下文。","scheduledTasks.condition":"前置条件（可选）","scheduledTasks.conditionPlaceholder":"例如：检查昨天以来 main 分支有没有新提交。如果没有，则本次不应执行。","scheduledTasks.condition.hint":'每次触发前，先在本任务自己的会话中检查该条件。只有判定为"是"，才会新建会话执行命令；否则跳过本次运行。',"scheduledTasks.condition.cardPrefix":"若：","turnOutputs.filesEdited":e=>`已编辑 ${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.viewChanges":"查看更改","turnOutputs.review":"审核","turnOutputs.collapseFiles":"收起文件","turnOutputs.showMoreFiles":e=>`再展示 ${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.previousTurn":"上轮对话","turnOutputs.fileCount":e=>`${(e==null?void 0:e.count)??0} 个文件`,"turnOutputs.openFileTree":"打开文件树","turnOutputs.closeFileTree":"关闭文件树","sidebar.label":"工作区侧边栏","sidebar.toggleMenu":"切换菜单","sidebar.newChat":"新对话","sidebar.newTask":"新建任务","sidebar.plugins":"插件","sidebar.project":"项目","sidebar.pinnedSessions":"置顶","sidebar.workspaceSelectLabel":"工作区","sidebar.details":"详情","sidebar.workspacePrimary":"主工作区","sidebar.workspaceUntrusted":"未信任","sidebar.workspaceReadOnly":"只读","sidebar.workspaceTrustToOpen":"信任此工作区后才能打开会话。","sidebar.addWorkspace":"添加工作区","sidebar.addWorkspaceTitle":"添加工作区","sidebar.addWorkspacePath":"目录路径","sidebar.addWorkspaceRegister":"注册","sidebar.addWorkspaceCancel":"取消","sidebar.addWorkspaceError":"添加工作区失败","sidebar.addWorkspacePersistenceError":"守护进程未确认工作区已持久化注册","sidebar.addWorkspaceAbsError":"路径必须是绝对路径","sidebar.addWorkspaceHint":"请输入项目目录的绝对路径。","sidebar.addWorkspacePersist":"服务重启后保留","sidebar.addWorkspacePersistHint":"将此工作区注册持久化到守护进程配置中。","sidebar.addWorkspaceAdding":"添加中…","sidebar.removeWorkspace":"移除工作区","sidebar.workspaceActions":"工作区操作","sidebar.forceRemoveWorkspace":"强制移除","sidebar.removeWorkspaceTitle":"移除工作区","sidebar.removeWorkspaceConfirm":e=>`确定移除“${(e==null?void 0:e.name)??""}”的运行时和持久化注册吗？文件、设置和会话历史不会被删除。`,"sidebar.removeWorkspaceBusy":e=>`“${(e==null?void 0:e.name)??""}”仍有活动运行时资源。强制移除会终止这些资源。`,"sidebar.removeWorkspaceCurrentSession":"请先切换到其他工作区或关闭当前会话，再执行强制移除。","sidebar.removeWorkspaceInProgress":"另一个客户端正在移除此工作区，请在操作完成后刷新。","sidebar.removeWorkspaceError":"移除工作区失败","sidebar.removeWorkspaceSessions":e=>`会话：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspacePrompts":e=>`活动提示：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceStarts":e=>`待启动会话：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceConnections":e=>`ACP 连接：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceMemoryTasks":e=>`Memory 任务：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceWorkers":e=>`Channel worker：${(e==null?void 0:e.count)??0}`,"sidebar.removeWorkspaceVoiceSessions":e=>`语音会话：${(e==null?void 0:e.count)??0}`,"sidebar.noSessions":"暂无会话","sidebar.projectFallback":"项目","sidebar.sessionsOverview":"会话总览","sidebar.splitView":"分屏","sidebar.settings":"设置","sidebar.daemonStatus":"Daemon 状态","sidebar.scheduledTasks":"定时任务","sidebar.themeLight":"切换到浅色主题","sidebar.themeDark":"切换到深色主题","sidebar.collapse":"收起","sidebar.expand":"展开","sidebar.collapseProject":"收起项目","sidebar.expandProject":"展开项目","sidebar.search":"搜索会话","sidebar.searchPlaceholder":"搜索会话","sidebar.searchEmpty":"没有匹配的会话。","sidebar.rename":"重命名","sidebar.renameCurrentOnly":"暂仅支持重命名当前会话","sidebar.export":"导出对话记录","sidebar.exportFailed":"导出会话失败","sidebar.delete":"删除","sidebar.archive":"归档","sidebar.unarchive":"恢复","sidebar.moreActions":"更多操作","sidebar.archiveCurrentDisabled":"不能归档当前会话","sidebar.archivedTitle":"已归档","sidebar.archivedEmpty":"没有已归档的会话。","sidebar.archiveFailed":"归档会话失败","sidebar.unarchiveFailed":"恢复会话失败","sidebar.loadingSessions":"正在加载会话...","sidebar.loadFailed":"会话加载失败，点击重试。","sidebar.renameFailed":"重命名会话失败","sidebar.deleteFailed":"删除会话失败","sidebar.newSessionFailed":"创建新对话失败","sidebar.switchFailed":"切换会话失败","sidebar.currentDeleteDisabled":"不能删除当前会话","sidebar.deleteConfirmDescription":e=>`确定删除“${(e==null?void 0:e.name)??""}”吗？删除后不可恢复。`,"sidebar.clients":e=>`${(e==null?void 0:e.count)??0} 个客户端`,"sidebar.running":"运行中","sidebar.waitingForApproval":"等待批准","sidebar.userInputNeeded":"需要用户输入","sidebar.completedUnread":"刚完成","sidebar.pin":"置顶","sidebar.unpin":"取消置顶","sidebar.sessionGroup":"分组","sidebar.groupFilter":"会话分组","sidebar.groupAll":"全部","sidebar.groupPinned":"已置顶","sidebar.groupUngrouped":"未分组","sidebar.groupRecent":"最近","sidebar.groupCreate":"新建分组","sidebar.groupRename":"重命名分组","sidebar.groupDelete":"删除分组","sidebar.groupColor":"分组颜色","sidebar.groupNamePrompt":"分组名称","sidebar.groupDeleteConfirm":e=>`确定删除分组“${(e==null?void 0:e.name)??""}”吗？`,"sidebar.groupsLoadFailed":"加载会话分组失败","sidebar.groupCreateFailed":"创建分组失败","sidebar.groupAssignFailedAfterCreate":"分组已创建，但移动会话失败","sidebar.groupUpdateFailed":"更新分组失败","sidebar.groupDeleteFailed":"删除分组失败","sidebar.organizationFailed":"更新会话组织失败","sidebar.groupColor.red":"红色","sidebar.groupColor.orange":"橙色","sidebar.groupColor.yellow":"黄色","sidebar.groupColor.green":"绿色","sidebar.groupColor.blue":"蓝色","sidebar.groupColor.purple":"紫色","sidebar.groupColor.custom":"自定义…","sidebar.groupColor.picker":"选择自定义分组颜色","sidebar.groupColor.hex":"Hex 颜色","sidebar.groupColor.invalid":"请输入六位 Hex 颜色，例如 #416ef5。","quickKeys.cursor":"移动光标","quickKeys.escape":"取消运行","quickKeys.history":"切换历史","quickKeys.retry":"重试失败请求","quickKeys.searchHistory":"搜索历史","quickKeys.tab":"接受补全","error.unsupportedTheme":"不支持该主题。请使用 /theme light 或 /theme dark。","queue.delete":"删除","queue.edit":"编辑","queue.insert":"插入","queue.cleared":"队列已清空。","queue.deleteTip":"移出队列","queue.editTip":"移出队列并将内容放回输入框","queue.insertTip":"将信息插入当前会话，下次模型调用生效。","queue.inserted":"已插入，下次模型调用生效。","queue.insertCommandDisabled":"命令无法插入当前回合。","queue.submitting":"提交中...","queue.editing":"编辑中...","queue.removing":"处理中...","queue.submittingDisabled":"排队消息正在提交中...","queue.commandBlocked":"当前回合运行时，Slash 命令不能进入排队。","queue.shellBlocked":"当前回合运行时，Shell 命令不能进入排队。","queue.queueFailed":"排队消息失败","queue.insertFailed":"插入排队消息失败","queue.deleteFailed":"移出队列失败","queue.editFailed":"编辑排队消息失败","queue.footer":"按 ↑ 编辑最后一条排队消息 · Esc 清空队列","queue.imageCount":e=>`（+${(e==null?void 0:e.count)??0} 张图片）`,"queue.more":e=>`...（还有 ${(e==null?void 0:e.count)??0} 条）`,"midTurn.inserted":e=>`已插入消息：${(e==null?void 0:e.message)??""}`,"help.builtIn":"内置命令","help.commandCount":e=>`${(e==null?void 0:e.count)??0} 个命令`,"help.commandMeta.builtIn":"内置","help.commandMeta.custom":"自定义","help.commandMeta.subcommands":e=>`${(e==null?void 0:e.count)??0} 个子命令`,"help.commandsIntro":"浏览内置命令：","help.customGroup":"自定义、skills、plugins、MCP","help.customIntro":"浏览自定义、skill、plugin 和 MCP 命令：","help.empty":"当前没有可用命令。","help.emptyCustom":"当前没有可用的自定义命令。","help.footer":"Tab/Shift+Tab 切换标签 · ↑/↓ 或 PgUp/PgDn 滚动 · Esc 关闭","help.intro":"Qwen Code 可以理解代码库，在你的许可下修改文件，并直接执行命令。","help.section.shortcuts":"快捷键","help.search":"搜索命令","help.shortcut.addContext":"添加文件或目录作为上下文","help.shortcut.altWords":"按词跳转","help.shortcut.clear":"清屏","help.shortcut.commandMenu":"打开命令菜单","help.shortcut.completion":"接受补全或切换帮助标签","help.shortcut.history":"切换历史 prompt 或滚动列表","help.shortcut.searchHistory":"搜索历史 prompt","help.shortcut.newline":"插入换行","help.shortcut.pasteImages":"粘贴图片","help.shortcut.shell":"运行 shell 命令","help.shortcut.togglePanel":"切换此面板","help.shortcut.retry":"重试上次请求","help.shortcut.compact":"切换紧凑模式","retry.hint":"按 Ctrl+Y 重试或点击重试","retry.none":"没有可重试的失败请求。","branch.failed":"分支会话失败。","branch.success":e=>`已复制会话，新会话名称为： "${(e==null?void 0:e.name)??""}"，当前已切换到新的会话。`,"fork.empty":"请提供任务指令。用法：/fork <指令>","fork.failed":e=>`启动后台智能体失败：${(e==null?void 0:e.reason)??""}`,"fork.notStarted":"后台智能体未启动。","fork.started":e=>`已启动后台智能体："${(e==null?void 0:e.name)??""}"，可在后台任务中查看。`,"command.hidden":"该命令不可用。","help.shortcut.approvals":"切换审批模式","help.shortcut.cancel":"关闭弹窗或取消操作","bug.failed":"加载系统信息失败，无法提交 Bug 报告。","bug.popupBlocked":"弹窗被拦截，请允许弹窗后重试。","bug.submitted":"Bug 报告已在新标签页中打开。","clear.blocked":"流式输出中无法清屏 — 先按 Esc 取消。","error.unknown":"未知错误","error.modelStreamInterrupted":"模型响应流已中断，请重试。","shell.command":"Shell 命令","compact.enabled":"紧凑模式已开启","compact.disabled":"紧凑模式已关闭","compact.hint":"按 Ctrl+O 显示完整工具输出","compact.saveFailed":"保存紧凑模式失败","help.subcommands":"子命令","help.tab.commands":"内置命令","help.tab.custom":"自定义命令","help.tab.general":"快捷键","help.title":"帮助","slash.category.custom":"自定义","slash.category.skill":"Skill","slash.category.system":"系统","language.changed":e=>`UI 语言已切换为 ${(e==null?void 0:e.language)??""}`,"language.current":e=>`当前 UI 语言：${(e==null?void 0:e.language)??""}`,"language.invalid":"语言无效。可用值：en, zh-CN","language.options":"可用选项：","language.set":"设置 UI 语言","language.usage":"用法：/language ui [en|zh-CN]","localCommand.noSession":"当前还没有会话。请先发送第一条消息，再使用这个命令。","local.agents":"管理智能体","local.bug":"提交错误报告","local.compress":"将上下文压缩为摘要","local.compressFast":"无需 AI 的快速上下文压缩","local.config":"通过点分路径键获取或设置配置项","local.diff":"显示工作区相对 HEAD 的改动统计","local.directory":"管理工作区目录","local.docs":"打开完整的 Qwen Code 文档","local.doctor":"运行安装和环境诊断","local.dream":"整合托管的自动记忆主题文件","local.effort":"设置推理模型的思考强度","local.export":"将当前会话历史导出到文件","local.forget":"从托管的自动记忆中移除匹配的条目","local.hooks":"管理 Qwen Code 钩子","local.importConfig":"从 Claude 配置导入 MCP 服务器","local.init":"分析项目并创建 QWEN.md 文件","local.insight":"根据聊天历史生成编程洞察","local.lsp":"显示 LSP 服务器状态","local.remember":"将持久记忆保存到记忆系统","local.summary":"生成项目摘要文件","local.workflows":"列出进行中和已完成的工作流运行","skilldesc.batch":"并行批量处理多个文件","skilldesc.dataviz":"图表与数据可视化设计指南","skilldesc.extensionCreator":"创建、测试和定制 Qwen Code 扩展","skilldesc.loop":"按计划或自定节奏循环运行提示词","skilldesc.newApp":"从零构建新应用的工作流","skilldesc.qcHelper":"解答 Qwen Code 使用相关问题","skilldesc.review":"审查代码变更的正确性、安全、质量与性能","skilldesc.simplify":"清理近期代码变更（复用与精简）","skilldesc.stuck":"诊断卡死或缓慢的 Qwen Code 会话","skilldesc.agentReproduceAlign":"将已移植的 Codex/Claude Code 功能与原版对齐","skilldesc.agentReproduceFeature":"复现 Codex/Claude Code 的现有功能","skilldesc.autofix":"实现已批准的 issue 或处理 PR 审查反馈","skilldesc.bugfix":"按先复现流程修复 GitHub issue 中的 bug","skilldesc.codegraph":"通过图数据库和向量索引分析代码库","skilldesc.createIssue":"根据想法或 bug 描述起草并提交 GitHub issue","skilldesc.desktopPet":"为 Qwen Code 创建像素风桌面宠物","skilldesc.docsAuditAndRefresh":"对照代码库审计并刷新 docs/ 文档","skilldesc.docsUpdateFromDiff":"按本地 git diff 更新官方文档","skilldesc.e2eTesting":"运行 Qwen Code CLI 的端到端测试","skilldesc.featDev":"实现非平凡功能的端到端工作流","skilldesc.memoryLeakDebug":"用堆快照诊断 CLI 内存泄漏","skilldesc.openworkDesktopSync":"将 packages/desktop 与 openwork 逐提交同步","skilldesc.preparePr":"从当前分支准备 GitHub PR 标题和正文","skilldesc.qwenCodeClaw":"将 Qwen Code 用作代码理解智能体","skilldesc.structuredDebugging":"假设驱动的疑难 bug 调试方法","skilldesc.terminalCapture":"自动化终端 UI 截图测试","skilldesc.tmuxRealUserTesting":"用 tmux 做真实用户测试并保存日志","skilldesc.triage":"把关和审查 Qwen Code 的 issue 与 PR","local.approvalMode":"切换审批模式","local.auth":"连接 LLM provider","auth.title":"连接 Provider","auth.step.group":"类型","auth.step.provider":"供应商","auth.step.protocol":"协议","auth.step.baseUrl":"Base URL","auth.step.apiKey":"API Key","auth.step.models":"模型 ID","auth.step.advanced":"高级配置","auth.protocol.openai":"OpenAI 兼容","auth.protocol.openaiDesc":"标准 OpenAI API 格式（最常用）","auth.protocol.anthropic":"Anthropic 兼容","auth.protocol.anthropicDesc":"Anthropic Messages API 格式","auth.protocol.gemini":"Gemini 兼容","auth.protocol.geminiDesc":"Google Gemini API 格式","auth.apiKeyRequired":"API key 不能为空。","auth.baseUrlInvalid":"Base URL 必须以 http:// 或 https:// 开头。","auth.baseUrlPrompt":"输入此协议的 API endpoint。","auth.baseUrlRequired":"Base URL 不能为空。","auth.documentation":"文档","auth.modelsRequired":"模型 ID 不能为空。","auth.review":"确认","auth.reviewText":"以下 JSON 将保存到 settings.json：","auth.save":"保存","auth.saving":"正在保存...","auth.termsTitle":"服务条款和隐私声明","auth.continue":"继续","auth.modelsPrompt":e=>`输入以逗号分隔的模型 ID。例如：${(e==null?void 0:e.modelIds)??""}`,"auth.advanced.prompt":"可选：配置高级生成设置。","auth.advanced.thinking":"启用 thinking","auth.advanced.thinkingDesc":"允许模型在回复前进行扩展推理。","auth.advanced.modality":"启用多模态","auth.advanced.modalityDesc":"启用图片、视频等多模态输入能力。","auth.advanced.modalityImage":"图片","auth.advanced.modalityVideo":"视频","auth.advanced.modalityAudio":"音频","auth.advanced.modalityPdf":"PDF","auth.advanced.contextWindow":"上下文窗口","auth.advanced.contextDesc":"最大输入 token 数（留空则根据模型名称自动检测）。","auth.advanced.contextPlaceholder":"上下文窗口（可选）","local.btw":"快速问一个不影响主对话的侧边问题。用法：/btw <your question>","btw.empty":"请提供一个问题。用法：/btw <你的问题>","btw.emptyAnswer":"未收到回答。","btw.failed":"回答 btw 问题失败","btw.answering":"+ 正在回答...","btw.shortcuts.pending":"按 Escape、Ctrl+C 或 Ctrl+D 取消","btw.shortcuts.done":"按 Space、Enter 或 Escape 关闭","local.clear":"以空上下文开始新会话；之前的会话会保留在磁盘上（可用 /resume 恢复）","local.context":'显示上下文窗口使用情况明细。使用 "/context detail" 查看逐项明细',"local.copy":"复制最后输出或代码片段","local.delete":"永久删除会话","local.release":"释放 live session","local.rewind":"回退当前会话","local.branch":"将当前对话分叉到新会话","local.fork":"基于当前对话启动后台智能体","local.help":"查看帮助和可用命令","local.language":"切换 UI 语言","local.mcp":"管理 MCP servers","local.memory":"管理 memory","local.model":"切换模型或设置 fast model","local.new":"开始新对话","local.plan":"进入 Plan 模式","local.goal":"设置目标并持续工作直到完成","local.recap":"生成会话摘要","recap.label":"回顾","recap.loading":"正在生成摘要...","recap.empty":"对话内容还不够，暂时无法生成摘要。","recap.failed":"生成摘要失败","rewind.action":"回退","rewind.confirm":"确认回退","rewind.empty":"当前会话没有可回退的快照。","rewind.failed":e=>`回退会话失败：${(e==null?void 0:e.reason)??""}`,"rewind.loading":"正在加载可回退的 prompt...","rewind.promptFallback":e=>`Prompt ${(e==null?void 0:e.id)??""}`,"rewind.rewinding":"回退中...","rewind.subtitle":"仅回退会话，不涉及文件。","rewind.title":"回退会话","rewind.turn":e=>`第 ${(e==null?void 0:e.turn)??0} 个 prompt`,"local.rename":"重命名当前会话","rename.empty":"请输入会话名称，例如 /rename 项目调试，或使用 /rename --auto。","rename.success":e=>`会话已重命名为 ${(e==null?void 0:e.name)??""}`,"local.reset":"重置当前对话","local.resume":"恢复历史会话","local.skills":"查看可用 skills","local.stats":"查看会话统计","local.tasks":"查看后台任务","local.status":"查看版本信息","local.theme":"切换主题","local.settings":"查看和编辑设置","local.schedule":"管理定时任务","local.extensions":"管理扩展。用法: /extensions manage|install <source>","extensions.label":"扩展","extensions.action.failed":e=>`扩展操作失败${e!=null&&e.name?`（${e.name}）`:e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.commands.refreshFailed":"刷新扩展命令失败。","extensions.install.failed":e=>`安装扩展失败${e!=null&&e.source?`（${e.source}）`:""}：${(e==null?void 0:e.error)??"未知错误"}`,"extensions.manage.agents":"智能体：","extensions.manage.actions":"扩展操作","extensions.manage.add":"添加扩展","extensions.manage.checkingUpdates":"正在检查更新...","extensions.manage.checkUpdates":"检查更新","extensions.manage.commands":"命令：","extensions.manage.contextFiles":"上下文文件：","extensions.manage.count":e=>`已安装 ${(e==null?void 0:e.count)??0} 个扩展`,"extensions.manage.disable":"禁用扩展","extensions.manage.disabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已禁用。`,"extensions.manage.disabling":e=>`正在禁用扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"extensions.manage.empty":"未安装扩展。","extensions.manage.emptyAgents":"此扩展没有智能体。","extensions.manage.emptyCommands":"此扩展没有命令。","extensions.manage.emptyContextFiles":"此扩展没有上下文文件。","extensions.manage.emptyDescription":"安装扩展以添加命令、Skills、智能体或 MCP servers。","extensions.manage.emptyMcpServers":"此扩展没有 MCP servers。","extensions.manage.emptySkills":"此扩展没有 Skills。","extensions.manage.enable":"启用扩展","extensions.manage.enabled":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 已启用。`,"extensions.manage.enabling":e=>`正在启用扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"extensions.manage.install":"安装","extensions.manage.installDescription":"输入 GitHub、Git 或 npm 扩展来源。","extensions.manage.installSelectPluginDescription":e=>`从「${(e==null?void 0:e.marketplace)??"此市场"}」中选择插件。`,"extensions.manage.installType":"安装类型：","extensions.manage.mcpServers":"MCP servers：","extensions.manage.marketplaceRoot":"此市场根目录","extensions.manage.name":"名称：","extensions.manage.notUpdatable":"不可更新","extensions.manage.operationFailed":"扩展操作失败。","extensions.manage.noDescription":"暂无描述","extensions.manage.noMatches":"没有匹配的扩展。","extensions.manage.origin":"来源平台：","extensions.manage.overview":"基本信息","extensions.manage.path":"路径：","extensions.manage.queued":e=>`扩展 "${(e==null?void 0:e.name)??"扩展"}" 的操作已提交。`,"extensions.manage.refreshFailed":e=>`扩展操作已成功，但 session 刷新失败${e!=null&&e.error?`：${e.error}`:"。"}`,"extensions.manage.restartRequired":"已更新，需要重启","extensions.manage.search":"搜索扩展…","extensions.manage.selectExtension":"请选择扩展","extensions.manage.settings":"设置：","extensions.manage.skills":"Skills：","extensions.manage.source":"来源：","extensions.manage.sourcePlaceholder":"https://github.com/owner/repository","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.uninstalling":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.updateComplete":"已更新","extensions.manage.updatedWithWarnings":"已更新，但有警告","extensions.manage.updateStatus":"更新状态：","extensions.manage.updating":"正在更新…","extensions.manage.updatingExtension":e=>`正在更新扩展 "${(e==null?void 0:e.name)??"扩展"}"…`,"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.action.approve":"审批","mcp.actions":"服务器操作","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.oauth.timeout":"认证等待超时，请刷新后查看状态。","mcp.oauth.authenticationFailed":"认证失败。","mcp.oauth.statusFailed":"检查认证状态失败。","mcp.oauth.serverRemoved":"MCP 服务器已在认证期间被移除。","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.descriptionTitle":"描述","mcp.basicInfo":"基本信息","mcp.action.reconnect":"重新连接","mcp.action.edit":"编辑","mcp.reconnect.skipped":e=>`重新连接未完成：${(e==null?void 0:e.reason)??"未知原因"}。`,"mcp.reconnect.authenticationRequired":"请先完成认证，再重新连接。","mcp.action.restart":"重启","mcp.action.tools":"查看工具","mcp.action.toolsHint":"Enter 查看","mcp.empty":"未配置 MCP 服务器。","mcp.emptyDescription":"添加 MCP 服务器后可在此管理。","mcp.emptyTools":"没有发现工具。","mcp.expand":"展开 MCP server","mcp.collapse":"收起 MCP server","mcp.inputSchema":"输入 schema","mcp.loadingStatus":"正在加载 MCP 状态...","mcp.loadingTools":"正在加载工具...","mcp.name":"名称","mcp.noDescription":"没有描述","mcp.noMatches":"没有匹配的 MCP 服务器。","mcp.add.button":"添加 MCP 服务器","mcp.add.adding":"正在添加 MCP 服务器…","mcp.add.title":"添加 MCP 服务器","mcp.add.description":"输入服务器名称和配置，并保存到当前工作区。","mcp.add.name":"名称","mcp.add.serverDescription":"描述","mcp.add.serverDescriptionPlaceholder":"描述这个 MCP 服务器","mcp.add.scope":"保存位置","mcp.add.scope.global":"全局","mcp.add.nameRequired":"请输入 MCP 服务器名称。","mcp.add.config":"配置（JSON）","mcp.add.configInvalid":"配置必须是 JSON 对象。","mcp.add.done":e=>`已添加 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.edit.title":"编辑 MCP 服务器","mcp.edit.description":"修改描述或配置。名称和保存位置不可修改。","mcp.edit.save":"保存修改","mcp.edit.saving":"正在保存修改…","mcp.edit.done":e=>`已更新 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.edit.notFound":"设置中已不存在该 MCP 服务器。","mcp.runtime.notUpdated":"配置已保存，但未同步当前会话。","mcp.runtime.removeNotUpdated":"配置已删除，但未同步当前会话。","mcp.discovery.empty":"尚未配置 MCP 服务器。","mcp.discovery.initializing":"正在初始化 MCP 服务器…","mcp.discovery.timeout":"MCP 发现耗时较长，请刷新后查看状态。","mcp.add.settingsUnavailable":"无法读取工作区设置。","mcp.action.remove":"删除","mcp.remove.title":"删除 MCP 服务器","mcp.remove.description":e=>`确定从当前工作区移除 MCP 服务器“${(e==null?void 0:e.name)??""}”吗？`,"mcp.remove.description.global":e=>`确定从全局设置中移除 MCP 服务器“${(e==null?void 0:e.name)??""}”吗？`,"mcp.remove.done":e=>`已删除 ${(e==null?void 0:e.name)??"MCP 服务器"}。`,"mcp.remove.notWorkspace":"此 MCP 服务器不在工作区设置中。","mcp.source.all":"全部","mcp.noSchema":"没有输入 schema。","mcp.oauth.open":"打开认证页面","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.viewDetails":"查看详情","mcp.parameters":"参数：","mcp.required":" 必填","mcp.resources":"资源","mcp.resourcesUnavailable":"无法加载资源详情。","mcp.noResources":"没有资源。","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（.mcp.json）","mcp.source.workspace":"工作区设置","mcp.source.user":"全局设置","mcp.status":"状态","mcp.status.blocked":"已阻止","mcp.status.authenticating":"认证中","mcp.status.needsApproval":"待审批","mcp.status.rejected":"已拒绝","mcp.status.connected":"已连接","mcp.status.connecting":"连接中","mcp.status.disconnected":"未连接","mcp.status.disconnectedTitle":"已断开","mcp.status.disabled":"已禁用","mcp.status.ready":"就绪","mcp.status.starting":"启动中...（首次启动可能需要更长时间）","mcp.status.unknown":"未知","mcp.tipDesc":"显示 server 和工具描述","mcp.tipNodesc":"隐藏描述","mcp.tipSchema":"显示工具参数 schema","mcp.tips":"💡 提示：","mcp.toolCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsCount":e=>`${(e==null?void 0:e.count)??0} 个工具`,"mcp.toolsLabel":"工具：","mcp.title":"MCP 服务器","mcp.toolDetail":"工具详情","mcp.tools":"工具","mcp.toolsForServer":e=>`${(e==null?void 0:e.name)??"Server"} 的工具`,"mcp.transport":"传输协议","mcp.use":"使用","mcp.userMcp":"全局 MCP","mcp.workingDirectory":"工作目录","goal.aborted":"目标已中止","goal.achieved":"目标已达成","goal.check":"目标检查","goal.cleared":"目标已清除","goal.failed":"目标未能达成","goal.judge":"判断","goal.label":"目标","goal.lastCheck":"上次检查","goal.notYetMet":"尚未满足","goal.set":"目标已设置","goal.statusActive":"/goal 运行中","goal.turn":e=>`${(e==null?void 0:e.count)??0} 轮`,"goal.turnLabel":e=>`第 ${(e==null?void 0:e.count)??0} 轮`,"goal.turns":e=>`${(e==null?void 0:e.count)??0} 轮`,"memory.add":"添加","memory.add.desc":"写入一条持久 memory","memory.autoDream":e=>`自动整理：${(e==null?void 0:e.status)??"未知"} · ${(e==null?void 0:e.lastDream)??"从未"} · /dream 立即运行`,"memory.autoDreamUnsupported":"web-shell 暂不支持修改自动整理设置。","memory.autoFolder":"打开自动记忆文件夹","memory.autoMemory":e=>`自动记忆：${(e==null?void 0:e.status)??"未知"}`,"memory.autoMemoryUnsupported":"web-shell 暂不支持修改自动记忆设置。","memory.autoSkill":e=>`自动技能：${(e==null?void 0:e.status)??"未知"}`,"memory.autoSkillUnsupported":"web-shell 暂不支持修改自动技能设置。","memory.chooseScope":"选择 memory 的保存位置","memory.closed":"Memory 面板已关闭。","memory.contentEmpty":"Memory 内容为空。","memory.file":"Memory 文件","memory.fileOpen":"Memory 文件已打开。","memory.fileTruncated":"Memory 文件已打开，内容已截断。","memory.files":"Memory 文件","memory.footer":"Enter 确认 · Esc 取消","memory.footer.back":"Esc 返回","memory.global":"用户级","memory.global.desc":"保存到全局用户 memory 文件","memory.globalReadUnsupported":"全局 memory 位于当前 workspace 之外，当前 daemon 文件读取接口不能打开它的内容。","memory.loading":"正在加载 memory...","memory.loadingFile":"正在加载 memory 文件...","memory.lastDream":"5 hours ago","memory.menu":"Memory","memory.never":"从未","memory.noFiles":"未找到 memory 文件。","memory.on":"开","memory.openFolderUnsupported":"web-shell 暂不支持打开自动记忆文件夹。","memory.placeholder":e=>`写入${(e==null?void 0:e.scope)??"memory"}内容...`,"memory.project":"项目级","memory.project.desc":"保存到当前 workspace memory 文件","memory.refresh":"刷新","memory.refresh.desc":"重新加载 memory 文件信息","memory.refreshed":"Memory 已刷新。","memory.save":"保存 Memory","memory.savedIn":e=>`Saved in ${(e==null?void 0:e.path)??""}`,"memory.saved":e=>`${(e==null?void 0:e.scope)??"Memory"} 已保存：${(e==null?void 0:e.bytes)??0} 字节 -> ${(e==null?void 0:e.path)??""}`,"memory.saving":"保存中...","memory.show":"查看","memory.show.desc":"查看已配置的 memory 文件","memory.status":"Workspace 和用户 memory 文件","memory.unknown":"未知","memory.write":"写入 memory 内容","mode.auto":"智能审批","mode.auto.desc":"使用分类器评估工具调用，安全操作自动批准，风险操作阻止或请求确认","mode.auto.notice":"Auto 模式已启用。LLM 分类器会评估每个工具调用，自动批准安全操作，拦截危险操作。退出方式：Shift+Tab 或 /approval-mode default。","mode.footer":"(Enter 选择，Esc 取消)","mode.name.plan":"plan","mode.name.default":"default","mode.name.auto-edit":"auto-edit","mode.name.auto":"auto","mode.name.yolo":"yolo","mode.label.plan":"计划","mode.label.default":"请求批准","mode.label.auto-edit":"自动编辑","mode.label.auto":"智能审批","mode.label.yolo":"完全访问权限","mode.listLabel.plan":"计划（plan）","mode.listLabel.default":"请求批准（default）","mode.listLabel.auto-edit":"自动编辑（auto-edit）","mode.listLabel.auto":"智能审批（auto）","mode.listLabel.yolo":"完全访问权限（yolo）","mode.desc.plan":"仅分析，不修改文件或执行命令","mode.desc.default":"执行命令、编辑文件或访问外部资源前请求确认","mode.desc.auto-edit":"自动批准文件编辑，命令执行等敏感操作仍会询问","mode.desc.auto":"自动评估工具风险，安全操作直接执行，风险操作再确认","mode.desc.yolo":"自动批准所有工具调用，适合可信任务环境","mode.select":"审批模式","mode.autoApproved":e=>e!=null&&e.tool?`已自动批准：${e.tool}`:"切换模式后自动批准了待处理的工具调用。","mode.auto-edit":"自动编辑","mode.auto-edit.desc":"自动批准文件读写操作","mode.default":"默认模式","mode.default.desc":"每次工具调用都需要确认","mode.plan":"Plan 模式","mode.plan.desc":"仅分析和规划，不执行工具","mode.unknown":"未知模式","mode.yolo":"YOLO 模式","mode.yolo.desc":"自动批准所有操作","plan.title":"计划","model.contextWindow":"上下文窗口","model.contextWindow.unknown":"（未知）","model.current":e=>`当前：${(e==null?void 0:e.model)??"未知"}`,"model.modality":"模态","model.modality.text":"文本","model.modality.textOnly":"仅文本","model.modality.image":"图片","model.modality.pdf":"PDF","model.modality.audio":"音频","model.modality.video":"视频","model.baseUrl":"Base URL","model.apiKey":"API Key","model.default":"（默认）","model.notSet":"（未设置）","model.footer":"Enter 选择，↑↓ 导航，Esc 关闭","model.searchHint":"按 / 搜索","model.fastHint":"用于建议和旁路任务","model.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的模型`,"model.none":"没有可用模型","model.select":"选择模型","model.setFast":"设置 Fast Model","model.setVoice":"设置语音模型","model.setVision":"设置视觉模型","model.switch":"切换模型","model.unknown":"未知","resume.current":"当前","resume.activePrompt":"正在运行","resume.filter":"筛选","resume.noMatch":e=>`没有匹配 "${(e==null?void 0:e.query)??""}" 的会话`,"resume.none":"没有可恢复的会话","resume.pressSearch":"按 / 搜索","resume.search":"搜索","resume.title":"恢复会话","parallelAgents.title":"并行智能体","parallelAgents.done":e=>`${(e==null?void 0:e.done)??0}/${(e==null?void 0:e.total)??0} 完成`,"skills.available":"可用 skills:","skills.none":"当前没有可用 skill。","skills.empty":"没有可用 skill。","skills.footer":e=>e!=null&&e.name?`使用 /skills ${e.name} 调用 · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","skills.invocable":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 可调用`,"skills.details":"Skill 详情","skills.extension":"所属扩展","skills.filter.all":"全部","skills.filter.bundled":"内置","skills.filter.extension":"扩展","skills.filter.label":"按来源筛选 Skills","skills.filter.project":"工作区设置","skills.filter.user":"用户设置","skills.hint":"提示","skills.invocation":"调用方式","skills.level":"作用域","skills.level.bundled":"内置","skills.level.extension":"扩展","skills.level.project":"项目","skills.level.user":"用户","skills.loading":"正在加载 skills...","skills.model":"模型","skills.modelAccess":"模型调用","skills.modelAccess.disabled":"不可由模型调用","skills.modelAccess.enabled":"可由模型调用","skills.modelInvocable":"模型可用","skills.noDescription":"暂无描述","skills.noMatches":"没有匹配的 Skill。","skills.run":"运行 skill","skills.search":"搜索 Skills…","skills.status":"状态","skills.status.disabled":"已禁用","skills.title":"Skills","plugins.extensions":"扩展","plugins.agents":"智能体","plugins.mcp":"MCP","plugins.mcpLoadFailed":"MCP 状态加载失败","plugins.sections":"插件分类","plugins.skills":"Skills","plugins.title":"插件","plugins.tools":"工具","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.outputTokens":"输出 Token","stats.overview":"会话概览","stats.performance":"性能","stats.prompts":"对话轮次","stats.rejected":"已拒绝：","stats.reqs":"请求","stats.requests":"请求数","stats.savingsHighlight":"节省亮点：","stats.successRate":"成功率","stats.thoughts":"思考","stats.title":"会话统计","stats.tokens":"Token","stats.toolCalls":"工具调用","stats.toolName":"工具名称","stats.toolStats":"工具统计（技术细节）","stats.toolTime":"工具耗时","stats.total":"总计","stats.totalReviewed":"已审核建议总数：","status.contextUsed":e=>`上下文已用 ${(e==null?void 0:e.pct)??"0.0"}%`,"status.disconnected":"断开连接","status.modeHint":"(shift + tab 或点击切换)","status.shortcuts":"? 查看快捷键","stream.cancel":"esc 取消","stream.cancelArmed":"再按一次 Esc 停止","stream.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"theme.current":e=>`当前：${(e==null?void 0:e.theme)??""}`,"theme.auto":"自动","theme.dark":"暗色","theme.dark.desc":"仿终端暗色皮肤。","theme.light":"亮色","theme.light.desc":"仿终端亮色皮肤。","theme.title":"主题","todo.allDone":"任务已全部完成","todo.collapse":"折叠任务列表","todo.completedAbove":e=>`✓ 已完成 ${(e==null?void 0:e.count)??0} 项`,"todo.detail.api":"API","todo.detail.cached":"缓存","todo.detail.end":"结束","todo.detail.hide":"收起任务明细","todo.detail.input":"输入","todo.detail.noResources":"未采集到该任务的 Token 与耗时明细。","todo.detail.output":"输出","todo.detail.sectionSpent":"耗时","todo.detail.sectionTime":"时间","todo.detail.sectionTokens":"Token","todo.detail.show":"查看任务明细","todo.detail.start":"开始","todo.detail.tool":"工具","todo.expand":"展开任务列表","todo.more":e=>`... 还有 ${(e==null?void 0:e.count)??0} 项`,"todo.moreAbove":e=>`... 前面还有 ${(e==null?void 0:e.count)??0} 项`,"todo.showLess":"收起","todo.stepProgress":e=>`第 ${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0} 步`,"todo.stepFraction":e=>`${(e==null?void 0:e.current)??0} / ${(e==null?void 0:e.total)??0}`,"todo.title":"当前任务","chat.scrollToBottom":"回到底部","userMessage.showMore":"显示更多","userMessage.showLess":"收起","turn.processed":"已处理","turn.processing":"处理中","turn.collapse":"折叠步骤","turn.expand":"展开步骤","turn.cached":"缓存","turn.executionSteps":e=>`${(e==null?void 0:e.count)??0} 步`,"turn.toolCalls":e=>`工具 ${(e==null?void 0:e.count)??0} 次`,"turn.thinkingCount":e=>`思考 ${(e==null?void 0:e.count)??0} 次`,"turn.stopped":"你已取消请求","message.renderError":"此消息无法显示。","tasks.title":"后台任务","tasks.empty":"当前没有运行中的任务","tasks.refreshStale":"任务状态可能已过期，正在重连...","tasks.cancelFailed":"取消任务失败","tasks.alreadyStopped":"任务已停止","tasks.moreAbove":e=>`^ 上方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.moreBelow":e=>`v 下方还有 ${(e==null?void 0:e.count)??0} 个`,"tasks.running":"运行中","tasks.completed":"已完成","tasks.failed":"失败","tasks.cancelled":"已停止","tasks.paused":"已暂停","tasks.kind.shell":"Shell","tasks.kind.monitor":"监控","tasks.action.stop":"停止","tasks.action.abandon":"放弃","tasks.action.confirmStop":"确认停止","tasks.action.confirmAbandon":"确认放弃","tasks.action.confirmHint":"这会终结当前阻塞轮次。","tasks.pill.agent":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agents":e=>`${(e==null?void 0:e.count)??0} 个本地智能体`,"tasks.pill.agentPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.agentsPaused":e=>`${(e==null?void 0:e.count)??0} 个本地智能体已暂停`,"tasks.pill.done":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.doneMany":e=>`${(e==null?void 0:e.count)??0} 个任务完成`,"tasks.pill.monitor":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.monitors":e=>`${(e==null?void 0:e.count)??0} 个监控`,"tasks.pill.shell":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.pill.shells":e=>`${(e==null?void 0:e.count)??0} 个 shell`,"tasks.confirmStop":"再按 x 确认停止 · 会终结当前阻塞轮次","tasks.shortcut.select":"↑/↓ 选择","tasks.shortcut.view":"Enter 查看","tasks.shortcut.stop":"x 停止","tasks.shortcut.abandon":"x 放弃","tasks.shortcut.listClose":"←/Esc 关闭","tasks.shortcut.detailBack":"← 返回","tasks.shortcut.detailClose":"Esc/Enter/Space 关闭","tasks.shortcut.close":"Esc 关闭","tasks.shortcut.cancelConfirm":"Esc 取消","tasks.detail.workingDir":"工作目录","tasks.detail.outputFile":"输出文件","tasks.detail.command":"命令","tasks.detail.events":e=>`${(e==null?void 0:e.count)??0} 个事件`,"tasks.detail.exit":e=>`退出码 ${(e==null?void 0:e.exitCode)??""}`,"tasks.detail.dropped":e=>`${(e==null?void 0:e.count)??0} 个已丢弃`,"tasks.detail.error":"错误","tasks.detail.stoppedBecause":"停止原因","tasks.detail.resumeBlocked":"恢复被阻止","tasks.detail.progress":"执行进度","tasks.detail.prompt":"提示词","tasks.detail.type":"类型","tasks.detail.runtime":"时间","tasks.detail.tokenCount":"Tokens","tasks.detail.toolCallCount":"工具数量","tasks.detail.tokens":e=>`${(e==null?void 0:e.count)??0} tokens`,"tasks.detail.toolCalls":e=>`${(e==null?void 0:e.count)??0} 次工具调用`,"tasks.detail.nesting":"嵌套","tasks.detail.nestingValue":e=>`第 ${(e==null?void 0:e.level)??"?"} 层 · 来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.detail.nestingLevel":e=>`第 ${(e==null?void 0:e.level)??"?"} 层`,"tasks.row.from":e=>`来自 ${(e==null?void 0:e.parent)??"?"}`,"tasks.row.nested":"嵌套","tips.items":"输入 / 查看所有可用命令。|使用 @ 引用文件路径。|按 Esc 取消正在进行的请求。|使用 Shift+Enter 换行。|按 ↑↓ 浏览历史消息。","tools.available":"可用工具:","tools.none":"没有可用工具。","tools.empty":"没有可用的内置工具。请先打开一个会话。","tools.footer":e=>e!=null&&e.name?`${e!=null&&e.details?"Enter/Space 查看详情 · ":""}t 切换 ${e.name} · r 刷新 · Esc 关闭`:"r 刷新 · Esc 关闭","tools.details.hide":"收起详情","tools.details.show":"展开详情","tools.description":"描述","tools.details":"工具详情","tools.loading":"正在加载工具...","tools.name":"工具名称","tools.noDescription":"暂无描述","tools.noMatches":"没有匹配的工具。","tools.search":"搜索工具…","tools.status":"状态","tools.status.disabled":"已禁用","tools.status.enabled":"已启用","tools.summary":e=>`${(e==null?void 0:e.enabled)??0}/${(e==null?void 0:e.total)??0} 已启用`,"tools.title":"工具","tools.update.disable":"禁用","tools.update.enable":"启用","tools.updating":"更新中...","tool.collapse":"▲ 收起","tool.expand":"展开","tool.collapseHint":"收起","tool.status.failed":"执行失败","toolGroup.moreKinds":e=>` +${(e==null?void 0:e.count)??0}`,"toolGroup.summary":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.summary.editedFiles":e=>`已编辑 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.ranCommands":e=>`已运行 ${(e==null?void 0:e.count)??0} 条命令`,"toolGroup.summary.readFiles":e=>`已读取 ${(e==null?void 0:e.count)??0} 个文件`,"toolGroup.summary.searched":e=>`已搜索 ${(e==null?void 0:e.count)??0} 次`,"toolGroup.summary.updatedTodos":e=>Number((e==null?void 0:e.count)??0)>1?`已更新任务清单 ${(e==null?void 0:e.count)??0} 次`:"已更新任务清单","toolGroup.summary.provideInformation":"补充信息","toolGroup.summary.askedQuestions":e=>`已询问 ${(e==null?void 0:e.count)??0} 个问题`,"toolGroup.summary.otherTools":e=>`调用了 ${(e==null?void 0:e.count)??0} 个工具`,"toolGroup.running":e=>`正在执行 ${(e==null?void 0:e.name)??"工具"}${e!=null&&e.duration?` ${e.duration}`:""}${Number((e==null?void 0:e.count)??0)>1?` · 共 ${(e==null?void 0:e.count)??0} 个工具`:""}`,"toolGroup.runningPrefix":"正在执行","thinking.expand":"展开思考","thinking.collapse":"收起思考","thinking.running":e=>`正在思考${e!=null&&e.duration?` ${e.duration}`:""}`,"thinking.doneBriefly":"思考片刻","thinking.done":e=>e!=null&&e.duration?`已思考 ${e.duration}`:"思考完成","thinking.translate":"翻译","thinking.translation":"思考翻译","thinking.translating":"正在翻译…","thinking.translationThinking":"思考中…","thinking.translationFailed":"翻译失败","thinking.retranslate":"重新翻译","thinking.cancelTranslation":"取消","thinking.closeTranslation":"关闭","thinking.inputTokens":e=>`发送 Token：${(e==null?void 0:e.count)??"--"}`,"thinking.outputTokens":e=>`生成 Token：${(e==null?void 0:e.count)??"--"}`,"welcome.changeModel":"(/model 切换)","welcome.defaultModel":"未知模型","sessionsOverview.count":e=>`${(e==null?void 0:e.count)??0} 个会话`,"sessionsOverview.current":"当前","sessionsOverview.empty":"暂无会话","sessionsOverview.loadFailed":"加载会话失败","sessionsOverview.loading":"正在加载会话…","sessionsOverview.openElsewhere":"已在其他窗口打开","sessionsOverview.openInSplit":"打开到分屏","sessionsOverview.openInSplitHint":"在本窗口内并排显示选中的会话","sessionsOverview.openInTab":"在新标签页打开","sessionsOverview.openInTabHint":"在新标签页中以分屏并排打开选中的会话","sessionsOverview.popupBlocked":"弹出窗口被拦截。请允许本站弹窗，以便在新标签页中打开会话。","sessionsOverview.refresh":"刷新","sessionsOverview.selectAll":"全选","sessionsOverview.splitCap":e=>`只有前 ${(e==null?void 0:e.max)??6} 个选中的会话会进入分屏。`,"sessionsOverview.selectSession":e=>`选择 ${(e==null?void 0:e.name)??""}`,"sessionsOverview.status.idle":"空闲","sessionsOverview.status.needsApproval":"待审批","sessionsOverview.status.running":"运行中","sessionsOverview.title":"会话总览","splitView.title":"分屏","splitView.count":e=>`${(e==null?void 0:e.count)??0} 个窗格`,"splitView.addPane":"添加会话","splitView.closePane":"关闭窗格","splitView.maximizePane":"最大化窗格","splitView.restorePane":"还原窗格","splitView.paneError":"此会话窗格出错","splitView.paneConnectionError":"连接已断开","splitView.outerApprovalPending":"主会话正在等待审批。","splitView.goToApproval":"前往处理","splitView.empty":"分屏中还没有会话，添加一个开始。","splitView.composerPlaceholder":"给这个会话发消息…","settings.title":"设置","settings.loading":"正在加载设置...","settings.empty":"暂无可用设置。","settings.footer":"↑↓ 导航  Enter 切换  Tab 切换作用域  r 刷新  ESC 关闭","settings.footer.edit":"Enter 保存  ESC 取消","settings.footer.theme":"↑↓ 导航  Enter 选择  ESC 返回","settings.scope.user":"用户","settings.scope.workspace":"工作区","settings.value.on":"开","settings.value.off":"关","settings.action.edit":"编辑","settings.action.select":"选择","settings.action.save":"保存","settings.modifiedIn":e=>`（已在${(e==null?void 0:e.scope)??""}中修改）`,"settings.alsoModifiedIn":e=>`（同时在${(e==null?void 0:e.scope)??""}中修改）`,"settings.invalidNumber":"无效数字","settings.requiresRestart":"此更改需要重启后才能生效。","settings.models.title":"模型","settings.models.add":"+ 增加模型","settings.models.setCurrent":"设为当前","settings.models.current":"当前","settings.models.runtime":"运行时","settings.models.delete":"删除","settings.models.confirmDelete":"确认删除","settings.models.cancel":"取消","settings.models.empty":"暂无配置的模型。","settings.models.loading":"正在加载模型…","settings.models.deleteFailed":"删除模型失败","settings.models.fallbacks.title":"模型回退","settings.models.fallbacks.hint":e=>`最多选择 ${(e==null?void 0:e.max)??3} 个；主模型容量不足时按顺序回退。`,"settings.models.fallbacks.confirm":"确认","settings.models.fallbacks.empty":"暂无可选模型。","settings.models.fallbacks.saveFailed":"保存回退模型失败","settings.models.fallbacks.limitReached":e=>`最多可选 ${(e==null?void 0:e.max)??3} 个回退模型；请先取消一个再选择其他。`,"settings.corrupted":e=>`设置文件已损坏${(e==null?void 0:e.recovered)==="true"?"（已从备份恢复）":""}`,"settings.label.ui.chatWidth":"屏宽","settings.description.ui.chatWidth":"纯前端的聊天内容宽度设置，保存在当前浏览器中。","settings.option.ui.chatWidth.1000":"常规","settings.option.ui.chatWidth.wide":"超宽","settings.category.General":"通用","settings.category.UI":"界面","settings.category.Privacy":"隐私","settings.category.Model":"模型","settings.category.Context":"上下文","settings.category.Tools":"工具","settings.category.Daemon":"守护进程","settings.category.Experimental":"实验性","settings.category.Advanced":"高级","settings.label.general.enableAutoUpdate":"启用自动更新","settings.description.general.enableAutoUpdate":"启动时自动检查并安装更新。","settings.label.general.showSessionRecap":"显示会话回顾","settings.description.general.showSessionRecap":"离开终端一段时间后返回时，自动显示一行“上次停在这里”的回顾。默认关闭。也可以随时使用 /recap 手动触发。","settings.label.general.sessionRecapAwayThresholdMinutes":"会话回顾离开阈值（分钟）","settings.description.general.sessionRecapAwayThresholdMinutes":"终端失焦多少分钟后，下一次重新聚焦时触发自动回顾。默认与 Claude Code 一致为 5 分钟；如果只是短暂切换窗口，可以调高。","settings.label.general.cleanupPeriodDays":"清理周期（天）","settings.description.general.cleanupPeriodDays":"~/.qwen/file-history/ 中用于 /rewind 的会话备份保留天数。后台清理最多每天运行一次。设为 0 表示最小保留（约 1 小时），仍会保护最近一小时触碰过的会话和当前活动会话。","settings.label.general.gitCoAuthor.commit":"归因：commit","settings.description.general.gitCoAuthor.commit":"通过 Qwen Code 创建 commit 时，添加 Co-authored-by trailer，并写入逐文件 AI 归因 git note。关闭后两者都会跳过。","settings.label.general.gitCoAuthor.pr":"归因：PR","settings.description.general.gitCoAuthor.pr":"运行 gh pr create 时，在 PR 描述中追加 Qwen Code 归因行。","settings.label.general.language":"语言：界面","settings.description.general.language":"用户界面的语言。使用 auto 可根据系统设置自动检测；也可以在 ~/.qwen/locales/ 中放置 JS 语言文件来使用自定义语言代码。","settings.label.general.dynamicCommandTranslation":"语言：动态命令翻译","settings.description.general.dynamicCommandTranslation":"为动态 slash command 描述启用 AI 翻译。关闭后动态命令使用原始描述，也不会触发翻译模型调用。","settings.label.general.preventSystemSleep":"运行时防止系统睡眠","settings.description.general.preventSystemSleep":"当 Qwen Code 正在流式生成模型回复或执行工具时防止系统睡眠。空闲输入状态和权限确认状态不会阻止睡眠。","settings.label.ui.theme":"主题","settings.description.ui.theme":"界面的颜色主题。","settings.label.ui.hideTips":"隐藏提示","settings.description.ui.hideTips":"隐藏界面中的帮助提示。","settings.label.ui.enableWelcomeBack":"显示欢迎回来对话框","settings.description.ui.enableWelcomeBack":"回到有历史会话的项目时显示欢迎回来对话框。选择“开始新的聊天会话”后，在项目摘要变化前不会再次显示。","settings.label.ui.enableUserFeedback":"启用用户反馈","settings.description.ui.enableUserFeedback":"对话结束后显示可选反馈对话框，帮助改进 Qwen 表现。","settings.label.ui.enableFollowupSuggestions":"启用后续建议","settings.description.ui.enableFollowupSuggestions":"任务完成后显示上下文相关的后续建议。按 Tab 或右方向键接受，按 Enter 接受并提交。","settings.label.ui.compactMode":"紧凑模式","settings.description.ui.compactMode":"隐藏工具输出和思考内容，显示更简洁的视图（可用 Ctrl+O 切换）。","settings.label.ui.compactInline":"紧凑内联","settings.description.ui.compactInline":"在每个分组内紧凑显示工具内容，而不是跨分组合并。需要先启用紧凑模式。","settings.label.ui.shellOutputMaxLines":"Shell 输出最大行数","settings.description.ui.shellOutputMaxLines":"内联显示的 shell 输出最大行数。设为 0 可取消限制并显示完整输出；隐藏行数仍会通过 +N lines 指示器展示。","settings.label.privacy.usageStatisticsEnabled":"启用使用统计","settings.description.privacy.usageStatisticsEnabled":"启用使用统计收集。","settings.label.fastModel":"快速模型","settings.description.fastModel":"用于生成提示建议和推测执行的模型。留空则使用主模型。较小/更快的模型（例如 qwen3-coder-flash）可以降低延迟和成本。","settings.label.visionModel":"视觉模型","settings.description.visionModel":"用于视觉桥接的图像能力模型。留空则自动选择。","settings.label.context.fileFiltering.respectGitIgnore":"遵守 .gitignore","settings.description.context.fileFiltering.respectGitIgnore":"搜索时遵守 .gitignore 文件。","settings.label.context.fileFiltering.respectQwenIgnore":"遵守 .qwenignore","settings.description.context.fileFiltering.respectQwenIgnore":"搜索时遵守 .qwenignore 文件。","settings.label.context.fileFiltering.enableFuzzySearch":"启用模糊搜索","settings.description.context.fileFiltering.enableFuzzySearch":"搜索文件时启用模糊搜索。","settings.label.tools.toolSearch.enabled":"启用 ToolSearch","settings.description.tools.toolSearch.enabled":"启用后，MCP 工具会通过 ToolSearch 按需加载，以减少提示词大小。对于依赖前缀 KV 缓存的模型（如 DeepSeek），可关闭此项来保持提示词前缀稳定并提高缓存命中率。","settings.label.tools.shell.enableInteractiveShell":"交互式 Shell（PTY）","settings.description.tools.shell.enableInteractiveShell":"使用 node-pty 提供交互式 shell 体验。PTY 不可用时回退到 child_process。","settings.label.tools.computerUse.enabled":"启用 Computer Use","settings.description.tools.computerUse.enabled":"启用后（默认），会注册 9 个 computer_use__* 延迟内置工具。","settings.label.policy.permissionStrategy":"权限协调策略","settings.description.policy.permissionStrategy":"多个客户端连接时权限请求的决策方式。first-responder 表示任意客户端先响应者生效；designated 表示仅提示发起方决策；consensus 表示需要 N-of-M 投票同意；local-only 表示只有 loopback 客户端可决策。需要重启 daemon 后生效。","settings.option.policy.permissionStrategy.first-responder":"先响应者","settings.option.policy.permissionStrategy.designated":"指定发起方","settings.option.policy.permissionStrategy.consensus":"共识法定人数","settings.option.policy.permissionStrategy.local-only":"仅本机","settings.label.experimental.enableCronTools":"启用 Cron/Loop 工具","settings.description.experimental.enableCronTools":"启用会话内 cron/loop 工具（实验性）。启用后，模型可以用 cron_create、cron_list 和 cron_delete 创建周期性提示。也可通过 QWEN_CODE_ENABLE_CRON=1 环境变量启用。","settings.label.experimental.emitToolUseSummaries":"工具使用摘要","settings.description.experimental.emitToolUseSummaries":"每个工具批次完成后生成一个简短的 LLM 标签。紧凑模式下会替代通用的 Tool × N 标题；完整模式下显示为工具组下方的弱化 ● <label> 行。需要配置快速模型。","settings.label.agents.arena.preserveArtifacts":"保留 Arena 产物","settings.description.agents.arena.preserveArtifacts":"启用后，Arena worktree 和会话状态文件会在会话结束或主智能体退出后保留。","welcome.modeHint":"Shift+Tab 或 /approval-mode","welcome.prompt":"你想构建什么？","welcome.titlePrefix":"欢迎使用","welcome.tipLabel":"提示："},Bme={en:$9,"zh-CN":Ome},$me={en:"English [en]","zh-CN":"中文 [zh-CN]"},IW=f.createContext({language:"en",t:e=>e});function Ku(e){const t=e==null?void 0:e.trim().toLowerCase();return t&&(t==="zh"||t==="zh-cn"||t==="zh_cn")?"zh-CN":"en"}function z9(e){if(typeof e!="string")return;const t=e.trim().toLowerCase().replace(/_/g,"-");if(t){if(t==="auto")return Ku(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 F9(e){return $me[e]}function q9(e){const t=Bme[e];return(n,r)=>{const s=t[n]??$9[n]??n;return typeof s=="function"?s(r):s}}function zme({language:e,children:t}){const n=f.useMemo(()=>({language:e,t:q9(e)}),[e]);return c.jsx(IW.Provider,{value:n,children:t})}function gt(){return f.useContext(IW)}const RW=f.createContext(null);function yd(){return f.useContext(RW)}const Fme="_row_19m4s_1",qme="_tip_19m4s_13",Hme="_chatRow_19m4s_35",Ume="_chatTip_19m4s_43",Vme="_chatActions_19m4s_56",Wme="_copyButton_19m4s_71",Gd={row:Fme,tip:qme,chatRow:Hme,chatTip:Ume,chatActions:Vme,copyButton:Wme};function K8({timestamp:e,children:t,chatMode:n=!1,copyText:r,copyTitle:s="Copy"}){const[i,o]=f.useState(!1),a=f.useCallback(()=>{var u;r&&((u=navigator.clipboard)==null||u.writeText(r).then(()=>{o(!0),window.setTimeout(()=>o(!1),2e3)}).catch(()=>{}))},[r]);if(e===void 0&&!r)return c.jsx(c.Fragment,{children:t});const l=r?c.jsx("button",{type:"button",className:Gd.copyButton,title:s,"aria-label":s,onClick:a,children:i?c.jsx(Kme,{}):c.jsx(Gme,{})}):null;return e===void 0?c.jsxs("div",{className:n?Gd.chatRow:Gd.row,children:[t,l]}):c.jsxs("div",{className:n?Gd.chatRow:Gd.row,children:[t,n?c.jsxs("span",{className:Gd.chatActions,children:[c.jsx("span",{className:Gd.chatTip,"aria-hidden":"true",children:hg(e)}),l]}):c.jsx("span",{className:Gd.tip,"aria-hidden":"true",children:hg(e)})]})}function Gme(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.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"}),c.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function Kme(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function hg(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 Yme="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3crect%20x='1.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3crect%20x='1.2'%20y='2.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3cg%20transform='matrix(0.86602545%200.50000006%20-0.50000006%200.86602545%202.21032266%20-5.24903863)'%3e%3crect%20x='10.9'%20y='1.5'%20width='4.3'%20height='4.3'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/g%3e%3crect%20x='7.2'%20y='8.8'%20width='6'%20height='6'%20stroke='currentColor'%20stroke-width='1.2'%20/%3e%3c/svg%3e",Xme="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2020%2020'%3e%3cpath%20d='M18%2018V5H9.5L7.5%202H2L2%2018H5M18%2018H5M18%2018V8.5H5V18'%20stroke='currentColor'%20stroke-linecap='square'/%3e%3c/svg%3e",Qme="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M5.4%201.2v3.2M10.6%201.2v3.2M3.8%204.4h8.4v2.2a4.2%204.2%200%200%201-4.2%204.2%204.2%204.2%200%200%201-4.2-4.2V4.4ZM8%2011v3.8'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Jme="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2016%2016'%3e%3cpath%20d='M9.333333480718995,0.4848014130697632L8.909069580718995,0.9090693330697632L8.666668880718994,1.1514702030697632L7.818136680718994,2.000002323069763L6.000002380718994,3.8181367730697633L4.909069780718994,4.909069373069763L4.484801580718994,5.333333373069763L5.333333480718994,6.181865073069763L5.757597480718994,5.757597373069763L6.002225380718994,5.5129693730697635Q6.399448880718994,5.902126173069763,6.835733380718994,6.315723273069763L0.6516202707189941,12.497309373069763L3.5001483807189944,15.345837373069763L9.749393980718994,9.099145273069762L10.000080580718993,9.349833873069763L10.848612280718994,8.501302173069764L10.424344580718994,8.077038173069763Q9.527247880718994,7.179941973069763,8.407596580718995,6.143646073069763Q7.564285280718994,5.3631170730697635,6.850798580718994,4.664396173069763L8.666666480718995,2.848528273069763L13.151472080718994,7.333333873069763L10.242402580718995,10.242403373069763L9.818134780718994,10.666667373069764L10.666666480718995,11.515199373069763L11.090930480718994,11.090931273069764L13.999998080718994,8.181864173069762L14.848531080718994,7.333333373069763L15.090931080718994,7.090931273069764L15.515198080718994,6.666666873069763L14.666666080718993,5.818134673069763L14.242402080718994,6.242402873069763L14.000000080718994,6.484805973069763L9.515194380718993,2.0000002430697634L9.757597480718994,1.7575974430697632L10.181865180718994,1.3333333730697632L9.333333480718995,0.4848014130697632ZM8.895271280718994,8.256209773069763Q8.340813180718994,7.719207673069763,7.712720380718994,7.1358045730697635L2.348849830718994,12.497482373069763L3.5003215807189942,13.648954373069763L8.895271280718994,8.256209773069763Z'%20fill-rule='evenodd'%20fill='currentColor'/%3e%3c/svg%3e",DW={extension:Yme,file:Xme,mcp:Qme,skill:Jme};function Y8(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return typeof n=="string"?n:void 0}function LW(e){var t,n,r;return((t=e.serialized)==null?void 0:t.trim())||((n=e.value)==null?void 0:n.trim())||((r=e.label)==null?void 0:r.trim())||e.id}function hp(e,t){if(e)return Y8(t,e)??Y8(DW,e)}function Zme(e,t){const n=[];let r=0;for(const s of t){const i=LW(s);if(!i)continue;const o=e.indexOf(i,r);if(o<0)continue;const a=o+i.length;n.push({type:"reference",start:o,end:a,text:i,reference:{id:s.id,...s.kind?{kind:s.kind}:{},...s.label?{label:s.label}:{},...s.value?{value:s.value}:{},...s.serialized?{serialized:s.serialized}:{},...s.removable!==void 0?{removable:s.removable}:{}}}),r=a}return n}function epe(e,t){if(!t||t.length===0)return[{type:"text",text:e}];const n=[];let r=0;for(const s of t){if(s.type!=="reference")continue;const{start:i,end:o,text:a}=s,l=s.reference;!l||typeof l.id!="string"||i<r||o<=i||o>e.length||e.slice(i,o)!==a||(r<i&&n.push({type:"text",text:e.slice(r,i)}),n.push({type:"reference",tag:{id:l.id,...l.kind?{kind:l.kind}:{},...l.label?{label:l.label}:{},...l.value?{value:l.value}:{},serialized:l.serialized??a,...l.removable!==void 0?{removable:l.removable}:{}}}),r=o)}return r<e.length&&n.push({type:"text",text:e.slice(r)}),n.length>0?n:[{type:"text",text:e}]}function tpe(e,t){var i,o;const n=((i=e.label)==null?void 0:i.trim())??"",r=((o=e.value)==null?void 0:o.trim())??"";return{tagLabel:(e.kind?Y8(DW,e.kind):void 0)?"":n,tagValue:r,fallback:e.id,iconUrl:hp(e.kind,t)}}const npe="modulepreload",rpe=function(e){return"/"+e},fL={},re=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=rpe(l),l in fL)return;fL[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":npe,u||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),u)return new Promise((m,p)=>{h.addEventListener("load",m),h.addEventListener("error",()=>p(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)})},As={Dark:"dark",Light:"light"},PW=[As.Dark,As.Light],OW=f.createContext(As.Dark),spe=OW.Provider;function Hg(){return f.useContext(OW)}const ym="ui.theme",W2="general.language";function H9(e,t){return e===As.Light||e==="Qwen Light"?As.Light:e===As.Dark||e==="Qwen Dark"?As.Dark:t}function BW(e){return e===As.Light?"Qwen Light":"Qwen Dark"}function mL(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 $W(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ipe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ope=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ape={};function pL(e,t){return(ape.jsx?ope:ipe).test(e)}const lpe=/[ \t\n\f\r]/g;function Q4(e){return typeof e=="object"?e.type==="text"?gL(e.value):!1:gL(e)}function gL(e){return e.replace(lpe,"")===""}class Iv{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Iv.prototype.normal={};Iv.prototype.property={};Iv.prototype.space=void 0;function zW(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Iv(n,r,t)}function Iy(e){return e.toLowerCase()}class Sa{constructor(t,n){this.attribute=n,this.property=t}}Sa.prototype.attribute="";Sa.prototype.booleanish=!1;Sa.prototype.boolean=!1;Sa.prototype.commaOrSpaceSeparated=!1;Sa.prototype.commaSeparated=!1;Sa.prototype.defined=!1;Sa.prototype.mustUseProperty=!1;Sa.prototype.number=!1;Sa.prototype.overloadedBoolean=!1;Sa.prototype.property="";Sa.prototype.spaceSeparated=!1;Sa.prototype.space=void 0;let cpe=0;const Gn=fp(),hi=fp(),X8=fp(),kt=fp(),gs=fp(),Lm=fp(),La=fp();function fp(){return 2**++cpe}const Q8=Object.freeze(Object.defineProperty({__proto__:null,boolean:Gn,booleanish:hi,commaOrSpaceSeparated:La,commaSeparated:Lm,number:kt,overloadedBoolean:X8,spaceSeparated:gs},Symbol.toStringTag,{value:"Module"})),p5=Object.keys(Q8);class U9 extends Sa{constructor(t,n,r,s){let i=-1;if(super(t,n),bL(this,"space",s),typeof r=="number")for(;++i<p5.length;){const o=p5[i];bL(this,p5[i],(r&Q8[o])===Q8[o])}}}U9.prototype.defined=!0;function bL(e,t,n){n&&(e[t]=n)}function Ug(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new U9(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Iy(r)]=r,n[Iy(i.attribute)]=r}return new Iv(t,n,e.space)}const FW=Ug({properties:{ariaActiveDescendant:null,ariaAtomic:hi,ariaAutoComplete:null,ariaBusy:hi,ariaChecked:hi,ariaColCount:kt,ariaColIndex:kt,ariaColSpan:kt,ariaControls:gs,ariaCurrent:null,ariaDescribedBy:gs,ariaDetails:null,ariaDisabled:hi,ariaDropEffect:gs,ariaErrorMessage:null,ariaExpanded:hi,ariaFlowTo:gs,ariaGrabbed:hi,ariaHasPopup:null,ariaHidden:hi,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gs,ariaLevel:kt,ariaLive:null,ariaModal:hi,ariaMultiLine:hi,ariaMultiSelectable:hi,ariaOrientation:null,ariaOwns:gs,ariaPlaceholder:null,ariaPosInSet:kt,ariaPressed:hi,ariaReadOnly:hi,ariaRelevant:null,ariaRequired:hi,ariaRoleDescription:gs,ariaRowCount:kt,ariaRowIndex:kt,ariaRowSpan:kt,ariaSelected:hi,ariaSetSize:kt,ariaSort:null,ariaValueMax:kt,ariaValueMin:kt,ariaValueNow:kt,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function qW(e,t){return t in e?e[t]:t}function HW(e,t){return qW(e,t.toLowerCase())}const upe=Ug({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Lm,acceptCharset:gs,accessKey:gs,action:null,allow:null,allowFullScreen:Gn,allowPaymentRequest:Gn,allowUserMedia:Gn,alpha:Gn,alt:null,as:null,async:Gn,autoCapitalize:null,autoComplete:gs,autoFocus:Gn,autoPlay:Gn,blocking:gs,capture:null,charSet:null,checked:Gn,cite:null,className:gs,closedBy:null,colorSpace:null,cols:kt,colSpan:kt,command:null,commandFor:null,content:null,contentEditable:hi,controls:Gn,controlsList:gs,coords:kt|Lm,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Gn,defer:Gn,dir:null,dirName:null,disabled:Gn,download:X8,draggable:hi,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Gn,formTarget:null,headers:gs,height:kt,hidden:X8,high:kt,href:null,hrefLang:null,htmlFor:gs,httpEquiv:gs,id:null,imageSizes:null,imageSrcSet:null,inert:Gn,inputMode:null,integrity:null,is:null,isMap:Gn,itemId:null,itemProp:gs,itemRef:gs,itemScope:Gn,itemType:gs,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Gn,low:kt,manifest:null,max:null,maxLength:kt,media:null,method:null,min:null,minLength:kt,multiple:Gn,muted:Gn,name:null,nonce:null,noModule:Gn,noValidate:Gn,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:Gn,optimum:kt,pattern:null,ping:gs,placeholder:null,playsInline:Gn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Gn,referrerPolicy:null,rel:gs,required:Gn,reversed:Gn,rows:kt,rowSpan:kt,sandbox:gs,scope:null,scoped:Gn,seamless:Gn,selected:Gn,shadowRootClonable:Gn,shadowRootCustomElementRegistry:Gn,shadowRootDelegatesFocus:Gn,shadowRootMode:null,shadowRootSerializable:Gn,shape:null,size:kt,sizes:null,slot:null,span:kt,spellCheck:hi,src:null,srcDoc:null,srcLang:null,srcSet:null,start:kt,step:null,style:null,tabIndex:kt,target:null,title:null,translate:null,type:null,typeMustMatch:Gn,useMap:null,value:hi,width:kt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gs,axis:null,background:null,bgColor:null,border:kt,borderColor:null,bottomMargin:kt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Gn,declare:Gn,event:null,face:null,frame:null,frameBorder:null,hSpace:kt,leftMargin:kt,link:null,longDesc:null,lowSrc:null,marginHeight:kt,marginWidth:kt,noResize:Gn,noHref:Gn,noShade:Gn,noWrap:Gn,object:null,profile:null,prompt:null,rev:null,rightMargin:kt,rules:null,scheme:null,scrolling:hi,standby:null,summary:null,text:null,topMargin:kt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:kt,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Gn,disablePictureInPicture:Gn,disableRemotePlayback:Gn,exportParts:Lm,part:gs,prefix:null,property:null,results:kt,security:null,unselectable:null},space:"html",transform:HW}),dpe=Ug({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:La,accentHeight:kt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:kt,amplitude:kt,arabicForm:null,ascent:kt,attributeName:null,attributeType:null,azimuth:kt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:kt,by:null,calcMode:null,capHeight:kt,className:gs,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:kt,diffuseConstant:kt,direction:null,display:null,dur:null,divisor:kt,dominantBaseline:null,download:Gn,dx:null,dy:null,edgeMode:null,editable:null,elevation:kt,enableBackground:null,end:null,event:null,exponent:kt,externalResourcesRequired:null,fill:null,fillOpacity:kt,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:Lm,g2:Lm,glyphName:Lm,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:kt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:kt,horizOriginX:kt,horizOriginY:kt,id:null,ideographic:kt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:kt,k:kt,k1:kt,k2:kt,k3:kt,k4:kt,kernelMatrix:La,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:kt,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:kt,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:kt,overlineThickness:kt,paintOrder:null,panose1:null,path:null,pathLength:kt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gs,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:kt,pointsAtY:kt,pointsAtZ:kt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:La,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:La,rev:La,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:La,requiredFeatures:La,requiredFonts:La,requiredFormats:La,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:kt,specularExponent:kt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:kt,strikethroughThickness:kt,string:null,stroke:null,strokeDashArray:La,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:kt,strokeOpacity:kt,strokeWidth:null,style:null,surfaceScale:kt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:La,tabIndex:kt,tableValues:null,target:null,targetX:kt,targetY:kt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:La,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:kt,underlineThickness:kt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:kt,values:null,vAlphabetic:kt,vMathematical:kt,vectorEffect:null,vHanging:kt,vIdeographic:kt,version:null,vertAdvY:kt,vertOriginX:kt,vertOriginY:kt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:kt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:qW}),UW=Ug({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()}}),VW=Ug({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:HW}),WW=Ug({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),hpe={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"},fpe=/[A-Z]/g,yL=/-[a-z]/g,mpe=/^data[-\w.:]+$/i;function V9(e,t){const n=Iy(t);let r=t,s=Sa;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mpe.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(yL,gpe);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!yL.test(i)){let o=i.replace(fpe,ppe);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=U9}return new s(r,t)}function ppe(e){return"-"+e.toLowerCase()}function gpe(e){return e.charAt(1).toUpperCase()}const W9=zW([FW,upe,UW,VW,WW],"html"),Vg=zW([FW,dpe,UW,VW,WW],"svg");function vL(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function GW(e){return e.join(" ").trim()}var G9={},xL=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,bpe=/\n/g,ype=/^\s*/,vpe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,xpe=/^:\s*/,wpe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,kpe=/^[;\s]*/,_pe=/^\s+|\s+$/g,Spe=`
`,wL="/",kL="*",cm="",Cpe="comment",Tpe="declaration";function Ape(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(g){var b=g.match(bpe);b&&(n+=b.length);var x=g.lastIndexOf(Spe);r=~x?g.length-x:r+g.length}function i(){var g={line:n,column:r};return function(b){return b.position=new o(g),u(),b}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(g){var b=g.exec(e);if(b){var x=b[0];return s(x),e=e.slice(x.length),b}}function u(){l(ype)}function d(g){var b;for(g=g||[];b=h();)b!==!1&&g.push(b);return g}function h(){var g=i();if(!(wL!=e.charAt(0)||kL!=e.charAt(1))){for(var b=2;cm!=e.charAt(b)&&(kL!=e.charAt(b)||wL!=e.charAt(b+1));)++b;if(b+=2,cm===e.charAt(b-1))return a("End of comment missing");var x=e.slice(2,b-2);return r+=2,s(x),e=e.slice(b),r+=2,g({type:Cpe,comment:x})}}function m(){var g=i(),b=l(vpe);if(b){if(h(),!l(xpe))return a("property missing ':'");var x=l(wpe),v=g({type:Tpe,property:_L(b[0].replace(xL,cm)),value:x?_L(x[0].replace(xL,cm)):cm});return l(kpe),v}}function p(){var g=[];d(g);for(var b;b=m();)b!==!1&&(g.push(b),d(g));return g}return u(),p()}function _L(e){return e?e.replace(_pe,cm):cm}var Epe=Ape,Mpe=l2&&l2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(G9,"__esModule",{value:!0});G9.default=jpe;const Npe=Mpe(Epe);function jpe(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,Npe.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 J4={};Object.defineProperty(J4,"__esModule",{value:!0});J4.camelCase=void 0;var Ipe=/^--[a-zA-Z0-9_-]+$/,Rpe=/-([a-z])/g,Dpe=/^[^-]+$/,Lpe=/^-(webkit|moz|ms|o|khtml)-/,Ppe=/^-(ms)-/,Ope=function(e){return!e||Dpe.test(e)||Ipe.test(e)},Bpe=function(e,t){return t.toUpperCase()},SL=function(e,t){return"".concat(t,"-")},$pe=function(e,t){return t===void 0&&(t={}),Ope(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Ppe,SL):e=e.replace(Lpe,SL),e.replace(Rpe,Bpe))};J4.camelCase=$pe;var zpe=l2&&l2.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Fpe=zpe(G9),qpe=J4;function J8(e,t){var n={};return!e||typeof e!="string"||(0,Fpe.default)(e,function(r,s){r&&s&&(n[(0,qpe.camelCase)(r,t)]=s)}),n}J8.default=J8;var Hpe=J8;const Upe=_4(Hpe),KW=YW("end"),K9=YW("start");function YW(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 Vpe(e){const t=K9(e),n=KW(e);if(t&&n)return{start:t,end:n}}function Jb(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?CL(e.position):"start"in e||"end"in e?CL(e):"line"in e||"column"in e?Z8(e):""}function Z8(e){return TL(e&&e.line)+":"+TL(e&&e.column)}function CL(e){return Z8(e&&e.start)+"-"+Z8(e&&e.end)}function TL(e){return e&&typeof e=="number"?e:1}class _o 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=Jb(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}}_o.prototype.file="";_o.prototype.name="";_o.prototype.reason="";_o.prototype.message="";_o.prototype.stack="";_o.prototype.column=void 0;_o.prototype.line=void 0;_o.prototype.ancestors=void 0;_o.prototype.cause=void 0;_o.prototype.fatal=void 0;_o.prototype.place=void 0;_o.prototype.ruleId=void 0;_o.prototype.source=void 0;const Y9={}.hasOwnProperty,Wpe=new Map,Gpe=/[A-Z]/g,Kpe=new Set(["table","tbody","thead","tfoot","tr"]),Ype=new Set(["td","th"]),XW="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Xpe(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=s0e(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=r0e(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"?Vg:W9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=QW(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function QW(e,t,n){if(t.type==="element")return Qpe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Jpe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return e0e(e,t,n);if(t.type==="mdxjsEsm")return Zpe(e,t);if(t.type==="root")return t0e(e,t,n);if(t.type==="text")return n0e(e,t)}function Qpe(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Vg,e.schema=s),e.ancestors.push(t);const i=ZW(e,t.tagName,!1),o=i0e(e,t);let a=Q9(e,t);return Kpe.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Q4(l):!0})),JW(e,o,i,t),X9(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function Jpe(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)}Ry(e,t.position)}function Zpe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ry(e,t.position)}function e0e(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Vg,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:ZW(e,t.name,!0),o=o0e(e,t),a=Q9(e,t);return JW(e,o,i,t),X9(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function t0e(e,t,n){const r={};return X9(r,Q9(e,t)),e.create(t,e.Fragment,r,n)}function n0e(e,t){return t.value}function JW(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function X9(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function r0e(e,t,n){return r;function r(s,i,o,a){const u=Array.isArray(o.children)?n:t;return a?u(i,o,a):u(i,o)}}function s0e(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=K9(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 i0e(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Y9.call(t.properties,s)){const i=a0e(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Ype.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 o0e(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 Ry(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 Ry(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Q9(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:Wpe;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 u=s.get(l)||0;o=l+"-"+u,s.set(l,u+1)}}const a=QW(e,i,o);a!==void 0&&n.push(a)}return n}function a0e(e,t,n){const r=V9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?$W(n):GW(n)),r.property==="style"){let s=typeof n=="object"?n:l0e(e,String(n));return e.stylePropertyNameCase==="css"&&(s=c0e(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?hpe[r.property]||r.property:r.attribute,n]}}function l0e(e,t){try{return Upe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new _o("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=XW+"#cannot-parse-style-attribute",s}}function ZW(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=pL(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=pL(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Y9.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ry(e)}function Ry(e,t){const n=new _o("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=XW+"#cannot-handle-mdx-estrees-without-createevaluater",n}function c0e(e){const t={};let n;for(n in e)Y9.call(e,n)&&(t[u0e(n)]=e[n]);return t}function u0e(e){let t=e.replace(Gpe,d0e);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function d0e(e){return"-"+e.toLowerCase()}const g5={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"]},h0e={};function J9(e,t){const n=h0e,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return eG(e,r,s)}function eG(e,t,n){if(f0e(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 AL(e.children,t,n)}return Array.isArray(e)?AL(e,t,n):""}function AL(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=eG(e[s],t,n);return r.join("")}function f0e(e){return!!(e&&typeof e=="object")}const EL=document.createElement("i");function Z9(e){const t="&"+e+";";EL.innerHTML=t;const n=EL.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Za(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 Sl(e,t){return e.length>0?(Za(e,e.length,0,t),e):t}const ML={}.hasOwnProperty;function tG(e){const t={};let n=-1;for(;++n<e.length;)m0e(t,e[n]);return t}function m0e(e,t){let n;for(n in t){const s=(ML.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){ML.call(s,o)||(s[o]=[]);const a=i[o];p0e(s[o],Array.isArray(a)?a:a?[a]:[])}}}function p0e(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Za(e,0,0,r)}function nG(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 Zl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zo=bf(/[A-Za-z]/),yo=bf(/[\dA-Za-z]/),g0e=bf(/[#-'*+\--9=?A-Z^-~]/);function G2(e){return e!==null&&(e<32||e===127)}const e7=bf(/\d/),b0e=bf(/[\dA-Fa-f]/),y0e=bf(/[!-/:-@[-`{-~]/);function Cn(e){return e!==null&&e<-2}function ks(e){return e!==null&&(e<0||e===32)}function Sr(e){return e===-2||e===-1||e===32}const Z4=bf(new RegExp("\\p{P}|\\p{S}","u")),Vm=bf(/\s/);function bf(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Wg(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&yo(e.charCodeAt(n+1))&&yo(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 br(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Sr(l)?(e.enter(n),a(l)):t(l)}function a(l){return Sr(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const v0e={tokenize:x0e};function x0e(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"),br(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 Cn(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const w0e={tokenize:k0e},NL={tokenize:_0e};function k0e(e){const t=this,n=[];let r=0,s,i,o;return a;function a(w){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&y();const k=t.events.length;let T=k,S;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){S=t.events[T][1].end;break}v(r);let C=k;for(;C<t.events.length;)t.events[C][1].end={...S},C++;return Za(t.events,T+1,0,t.events.slice(k)),t.events.length=C,u(w)}return a(w)}function u(w){if(r===n.length){if(!s)return m(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(NL,d,h)(w)}function d(w){return s&&y(),v(r),m(w)}function h(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(w)}function m(w){return t.containerState={},e.attempt(NL,p,g)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),m(w)}function g(w){if(w===null){s&&y(),v(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),b(w)}function b(w){if(w===null){x(e.exit("chunkFlow"),!0),v(0),e.consume(w);return}return Cn(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),b)}function x(w,k){const T=t.sliceStream(w);if(k&&T.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(T),t.parser.lazy[w.start.line]){let S=s.events.length;for(;S--;)if(s.events[S][1].start.offset<o&&(!s.events[S][1].end||s.events[S][1].end.offset>o))return;const C=t.events.length;let _=C,A,M;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(A){M=t.events[_][1].end;break}A=!0}for(v(r),S=C;S<t.events.length;)t.events[S][1].end={...M},S++;Za(t.events,_+1,0,t.events.slice(C)),t.events.length=S}}function v(w){let k=n.length;for(;k-- >w;){const T=n[k];t.containerState=T[1],T[0].exit.call(t,e)}n.length=w}function y(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function _0e(e,t,n){return br(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fg(e){if(e===null||ks(e)||Vm(e))return 1;if(Z4(e))return 2}function eS(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 t7={name:"attention",resolveAll:S0e,tokenize:C0e};function S0e(e,t){let n=-1,r,s,i,o,a,l,u,d;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 h={...e[r][1].end},m={...e[n][1].start};jL(h,-l),jL(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:m},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},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Sl(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Sl(u,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),u=Sl(u,eS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Sl(u,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Sl(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Za(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function C0e(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=fg(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 u=e.exit("attentionSequence"),d=fg(l),h=!d||d===2&&s||n.includes(l),m=!s||s===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(s||!m)),u._close=!!(i===42?m:m&&(d||!h)),t(l)}}function jL(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const T0e={name:"autolink",tokenize:A0e};function A0e(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return zo(p)?(e.consume(p),o):p===64?n(p):u(p)}function o(p){return p===43||p===45||p===46||yo(p)?(r=1,a(p)):u(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||yo(p))&&r++<32?(e.consume(p),a):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||G2(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):g0e(p)?(e.consume(p),u):n(p)}function d(p){return yo(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||yo(p))&&r++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const Rv={partial:!0,tokenize:E0e};function E0e(e,t,n){return r;function r(i){return Sr(i)?br(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||Cn(i)?t(i):n(i)}}const rG={continuation:{tokenize:N0e},exit:j0e,name:"blockQuote",tokenize:M0e};function M0e(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 Sr(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function N0e(e,t,n){const r=this;return s;function s(o){return Sr(o)?br(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(rG,t,n)(o)}}function j0e(e){e.exit("blockQuote")}const sG={name:"characterEscape",tokenize:I0e};function I0e(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 y0e(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const iG={name:"characterReference",tokenize:R0e};function R0e(e,t,n){const r=this;let s=0,i,o;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=yo,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=b0e,d):(e.enter("characterReferenceValue"),i=7,o=e7,d(h))}function d(h){if(h===59&&s){const m=e.exit("characterReferenceValue");return o===yo&&!Z9(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(h)&&s++<i?(e.consume(h),d):n(h)}}const IL={partial:!0,tokenize:L0e},RL={concrete:!0,name:"codeFenced",tokenize:D0e};function D0e(e,t,n){const r=this,s={partial:!0,tokenize:T};let i=0,o=0,a;return l;function l(S){return u(S)}function u(S){const C=r.events[r.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,a=S,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(S)}function d(S){return S===a?(o++,e.consume(S),d):o<3?n(S):(e.exit("codeFencedFenceSequence"),Sr(S)?br(e,h,"whitespace")(S):h(S))}function h(S){return S===null||Cn(S)?(e.exit("codeFencedFence"),r.interrupt?t(S):e.check(IL,b,k)(S)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||Cn(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(S)):Sr(S)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),br(e,p,"whitespace")(S)):S===96&&S===a?n(S):(e.consume(S),m)}function p(S){return S===null||Cn(S)?h(S):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(S))}function g(S){return S===null||Cn(S)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(S)):S===96&&S===a?n(S):(e.consume(S),g)}function b(S){return e.attempt(s,k,x)(S)}function x(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),v}function v(S){return i>0&&Sr(S)?br(e,y,"linePrefix",i+1)(S):y(S)}function y(S){return S===null||Cn(S)?e.check(IL,b,k)(S):(e.enter("codeFlowValue"),w(S))}function w(S){return S===null||Cn(S)?(e.exit("codeFlowValue"),y(S)):(e.consume(S),w)}function k(S){return e.exit("codeFenced"),t(S)}function T(S,C,_){let A=0;return M;function M($){return S.enter("lineEnding"),S.consume($),S.exit("lineEnding"),L}function L($){return S.enter("codeFencedFence"),Sr($)?br(S,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):N($)}function N($){return $===a?(S.enter("codeFencedFenceSequence"),O($)):_($)}function O($){return $===a?(A++,S.consume($),O):A>=o?(S.exit("codeFencedFenceSequence"),Sr($)?br(S,B,"whitespace")($):B($)):_($)}function B($){return $===null||Cn($)?(S.exit("codeFencedFence"),C($)):_($)}}}function L0e(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 b5={name:"codeIndented",tokenize:O0e},P0e={partial:!0,tokenize:B0e};function O0e(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),br(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):Cn(u)?e.attempt(P0e,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||Cn(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function B0e(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Cn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):br(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):Cn(o)?s(o):n(o)}}const $0e={name:"codeText",previous:F0e,resolve:z0e,tokenize:q0e};function z0e(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 F0e(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function q0e(e,t,n){let r=0,s,i;return o;function o(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),r++,a):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),s=0,d(h)):Cn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||Cn(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),s++,d):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}class H0e{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&&W1(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),W1(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),W1(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);W1(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);W1(this.left,n.reverse())}}}function W1(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 oG(e){const t={};let n=-1,r,s,i,o,a,l,u;const d=new H0e(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.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,U0e(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=d.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(d.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={...d.get(s)[1].start},a=d.slice(s,n),a.unshift(r),d.splice(s,n-s+1,a))}}return Za(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function U0e(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=[],u={};let d,h,m=-1,p=n,g=0,b=0;const x=[b];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),h&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(b=m+1,x.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),m=x.length;m--;){const v=a.slice(x[m],x[m+1]),y=i.pop();l.push([y,y+v.length-1]),e.splice(y,2,v)}for(l.reverse(),m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const V0e={resolve:G0e,tokenize:K0e},W0e={partial:!0,tokenize:Y0e};function G0e(e){return oG(e),e}function K0e(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):Cn(a)?e.check(W0e,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 Y0e(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),br(e,i,"linePrefix")}function i(o){if(o===null||Cn(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 aG(e,t,n,r,s,i,o,a,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(v){return v===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(v),e.exit(i),m):v===null||v===32||v===41||G2(v)?n(v):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(v))}function m(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(a),m(v)):v===null||v===60||Cn(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function b(v){return!d&&(v===null||v===41||ks(v))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,b):v===41?(e.consume(v),d--,b):v===null||v===32||v===40||G2(v)?n(v):(e.consume(v),v===92?x:b)}function x(v){return v===40||v===41||v===92?(e.consume(v),b):b(v)}}function lG(e,t,n,r,s,i){const o=this;let a=0,l;return u;function u(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),d}function d(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Cn(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Cn(p)||a++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Sr(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),a++,h):h(p)}}function cG(e,t,n,r,s,i){let o;return a;function a(m){return m===34||m===39||m===40?(e.enter(r),e.enter(s),e.consume(m),e.exit(s),o=m===40?41:m,l):n(m)}function l(m){return m===o?(e.enter(s),e.consume(m),e.exit(s),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===o?(e.exit(i),l(o)):m===null?n(m):Cn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),br(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||Cn(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:d)}function h(m){return m===o||m===92?(e.consume(m),d):d(m)}}function Zb(e,t){let n;return r;function r(s){return Cn(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Sr(s)?br(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const X0e={name:"definition",tokenize:J0e},Q0e={partial:!0,tokenize:Z0e};function J0e(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return lG.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=Zl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ks(p)?Zb(e,u)(p):u(p)}function u(p){return aG(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Q0e,h,h)(p)}function h(p){return Sr(p)?br(e,m,"whitespace")(p):m(p)}function m(p){return p===null||Cn(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function Z0e(e,t,n){return r;function r(a){return ks(a)?Zb(e,s)(a):n(a)}function s(a){return cG(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Sr(a)?br(e,o,"whitespace")(a):o(a)}function o(a){return a===null||Cn(a)?t(a):n(a)}}const ege={name:"hardBreakEscape",tokenize:tge};function tge(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return Cn(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const nge={name:"headingAtx",resolve:rge,tokenize:sge};function rge(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"},Za(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function sge(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(e.consume(d),o):d===null||ks(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||Cn(d)?(e.exit("atxHeading"),t(d)):Sr(d)?br(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||ks(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const ige=["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"],DL=["pre","script","style","textarea"],oge={concrete:!0,name:"htmlFlow",resolveTo:cge,tokenize:uge},age={partial:!0,tokenize:hge},lge={partial:!0,tokenize:dge};function cge(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 uge(e,t,n){const r=this;let s,i,o,a,l;return u;function u(j){return d(j)}function d(j){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(j),h}function h(j){return j===33?(e.consume(j),m):j===47?(e.consume(j),i=!0,b):j===63?(e.consume(j),s=3,r.interrupt?t:D):zo(j)?(e.consume(j),o=String.fromCharCode(j),x):n(j)}function m(j){return j===45?(e.consume(j),s=2,p):j===91?(e.consume(j),s=5,a=0,g):zo(j)?(e.consume(j),s=4,r.interrupt?t:D):n(j)}function p(j){return j===45?(e.consume(j),r.interrupt?t:D):n(j)}function g(j){const ie="CDATA[";return j===ie.charCodeAt(a++)?(e.consume(j),a===ie.length?r.interrupt?t:N:g):n(j)}function b(j){return zo(j)?(e.consume(j),o=String.fromCharCode(j),x):n(j)}function x(j){if(j===null||j===47||j===62||ks(j)){const ie=j===47,oe=o.toLowerCase();return!ie&&!i&&DL.includes(oe)?(s=1,r.interrupt?t(j):N(j)):ige.includes(o.toLowerCase())?(s=6,ie?(e.consume(j),v):r.interrupt?t(j):N(j)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(j):i?y(j):w(j))}return j===45||yo(j)?(e.consume(j),o+=String.fromCharCode(j),x):n(j)}function v(j){return j===62?(e.consume(j),r.interrupt?t:N):n(j)}function y(j){return Sr(j)?(e.consume(j),y):M(j)}function w(j){return j===47?(e.consume(j),M):j===58||j===95||zo(j)?(e.consume(j),k):Sr(j)?(e.consume(j),w):M(j)}function k(j){return j===45||j===46||j===58||j===95||yo(j)?(e.consume(j),k):T(j)}function T(j){return j===61?(e.consume(j),S):Sr(j)?(e.consume(j),T):w(j)}function S(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),l=j,C):Sr(j)?(e.consume(j),S):_(j)}function C(j){return j===l?(e.consume(j),l=null,A):j===null||Cn(j)?n(j):(e.consume(j),C)}function _(j){return j===null||j===34||j===39||j===47||j===60||j===61||j===62||j===96||ks(j)?T(j):(e.consume(j),_)}function A(j){return j===47||j===62||Sr(j)?w(j):n(j)}function M(j){return j===62?(e.consume(j),L):n(j)}function L(j){return j===null||Cn(j)?N(j):Sr(j)?(e.consume(j),L):n(j)}function N(j){return j===45&&s===2?(e.consume(j),P):j===60&&s===1?(e.consume(j),K):j===62&&s===4?(e.consume(j),Q):j===63&&s===3?(e.consume(j),D):j===93&&s===5?(e.consume(j),H):Cn(j)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(age,U,O)(j)):j===null||Cn(j)?(e.exit("htmlFlowData"),O(j)):(e.consume(j),N)}function O(j){return e.check(lge,B,U)(j)}function B(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),$}function $(j){return j===null||Cn(j)?O(j):(e.enter("htmlFlowData"),N(j))}function P(j){return j===45?(e.consume(j),D):N(j)}function K(j){return j===47?(e.consume(j),o="",F):N(j)}function F(j){if(j===62){const ie=o.toLowerCase();return DL.includes(ie)?(e.consume(j),Q):N(j)}return zo(j)&&o.length<8?(e.consume(j),o+=String.fromCharCode(j),F):N(j)}function H(j){return j===93?(e.consume(j),D):N(j)}function D(j){return j===62?(e.consume(j),Q):j===45&&s===2?(e.consume(j),D):N(j)}function Q(j){return j===null||Cn(j)?(e.exit("htmlFlowData"),U(j)):(e.consume(j),Q)}function U(j){return e.exit("htmlFlow"),t(j)}}function dge(e,t,n){const r=this;return s;function s(o){return Cn(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 hge(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Rv,t,n)}}const fge={name:"htmlText",tokenize:mge};function mge(e,t,n){const r=this;let s,i,o;return a;function a(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),T):D===63?(e.consume(D),w):zo(D)?(e.consume(D),_):n(D)}function u(D){return D===45?(e.consume(D),d):D===91?(e.consume(D),i=0,g):zo(D)?(e.consume(D),y):n(D)}function d(D){return D===45?(e.consume(D),p):n(D)}function h(D){return D===null?n(D):D===45?(e.consume(D),m):Cn(D)?(o=h,K(D)):(e.consume(D),h)}function m(D){return D===45?(e.consume(D),p):h(D)}function p(D){return D===62?P(D):D===45?m(D):h(D)}function g(D){const Q="CDATA[";return D===Q.charCodeAt(i++)?(e.consume(D),i===Q.length?b:g):n(D)}function b(D){return D===null?n(D):D===93?(e.consume(D),x):Cn(D)?(o=b,K(D)):(e.consume(D),b)}function x(D){return D===93?(e.consume(D),v):b(D)}function v(D){return D===62?P(D):D===93?(e.consume(D),v):b(D)}function y(D){return D===null||D===62?P(D):Cn(D)?(o=y,K(D)):(e.consume(D),y)}function w(D){return D===null?n(D):D===63?(e.consume(D),k):Cn(D)?(o=w,K(D)):(e.consume(D),w)}function k(D){return D===62?P(D):w(D)}function T(D){return zo(D)?(e.consume(D),S):n(D)}function S(D){return D===45||yo(D)?(e.consume(D),S):C(D)}function C(D){return Cn(D)?(o=C,K(D)):Sr(D)?(e.consume(D),C):P(D)}function _(D){return D===45||yo(D)?(e.consume(D),_):D===47||D===62||ks(D)?A(D):n(D)}function A(D){return D===47?(e.consume(D),P):D===58||D===95||zo(D)?(e.consume(D),M):Cn(D)?(o=A,K(D)):Sr(D)?(e.consume(D),A):P(D)}function M(D){return D===45||D===46||D===58||D===95||yo(D)?(e.consume(D),M):L(D)}function L(D){return D===61?(e.consume(D),N):Cn(D)?(o=L,K(D)):Sr(D)?(e.consume(D),L):A(D)}function N(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),s=D,O):Cn(D)?(o=N,K(D)):Sr(D)?(e.consume(D),N):(e.consume(D),B)}function O(D){return D===s?(e.consume(D),s=void 0,$):D===null?n(D):Cn(D)?(o=O,K(D)):(e.consume(D),O)}function B(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ks(D)?A(D):(e.consume(D),B)}function $(D){return D===47||D===62||ks(D)?A(D):n(D)}function P(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function K(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),F}function F(D){return Sr(D)?br(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):H(D)}function H(D){return e.enter("htmlTextData"),o(D)}}const eM={name:"labelEnd",resolveAll:yge,resolveTo:vge,tokenize:xge},pge={tokenize:wge},gge={tokenize:kge},bge={tokenize:_ge};function yge(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&&Za(e,0,e.length,n),e}function vge(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}},u={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=Sl(a,e.slice(i+1,i+r+3)),a=Sl(a,[["enter",d,t]]),a=Sl(a,eS(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=Sl(a,[["exit",d,t],e[o-2],e[o-1],["exit",u,t]]),a=Sl(a,e.slice(o+1)),a=Sl(a,[["exit",l,t]]),Za(e,i,e.length,a),e}function xge(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(m){return i?i._inactive?h(m):(o=r.parser.defined.includes(Zl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(pge,d,o?d:h)(m):m===91?e.attempt(gge,d,o?u:h)(m):o?d(m):h(m)}function u(m){return e.attempt(bge,d,h)(m)}function d(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function wge(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),s}function s(h){return ks(h)?Zb(e,i)(h):i(h)}function i(h){return h===41?d(h):aG(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return ks(h)?Zb(e,l)(h):d(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?cG(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return ks(h)?Zb(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function kge(e,t,n){const r=this;return s;function s(a){return lG.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Zl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function _ge(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 Sge={name:"labelStartImage",resolveAll:eM.resolveAll,tokenize:Cge};function Cge(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 Tge={name:"labelStartLink",resolveAll:eM.resolveAll,tokenize:Age};function Age(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 y5={name:"lineEnding",tokenize:Ege};function Ege(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),br(e,t,"linePrefix")}}const Rk={name:"thematicBreak",tokenize:Mge};function Mge(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),o(u)}function o(u){return s=u,a(u)}function a(u){return u===s?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||Cn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===s?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Sr(u)?br(e,a,"whitespace")(u):a(u))}}const ra={continuation:{tokenize:Rge},exit:Lge,name:"list",tokenize:Ige},Nge={partial:!0,tokenize:Pge},jge={partial:!0,tokenize:Dge};function Ige(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(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:e7(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Rk,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return e7(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Rv,r.interrupt?n:d,e.attempt(Nge,m,h))}function d(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Sr(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function Rge(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Rv,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,br(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Sr(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(jge,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,br(e,e.attempt(ra,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Dge(e,t,n){const r=this;return br(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 Lge(e){e.exit(this.containerState.type)}function Pge(e,t,n){const r=this;return br(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!Sr(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const LL={name:"setextUnderline",resolveTo:Oge,tokenize:Bge};function Oge(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 Bge(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===s?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Sr(u)?br(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Cn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const $ge={tokenize:zge};function zge(e){const t=this,n=e.attempt(Rv,r,e.attempt(this.parser.constructs.flowInitial,s,br(e,e.attempt(this.parser.constructs.flow,s,e.attempt(V0e,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 Fge={resolveAll:dG()},qge=uG("string"),Hge=uG("text");function uG(e){return{resolveAll:dG(e==="text"?Uge: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(d){return u(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=s[d];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function dG(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 Uge(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 u=s[i];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={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={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Vge={42:ra,43:ra,45:ra,48:ra,49:ra,50:ra,51:ra,52:ra,53:ra,54:ra,55:ra,56:ra,57:ra,62:rG},Wge={91:X0e},Gge={[-2]:b5,[-1]:b5,32:b5},Kge={35:nge,42:Rk,45:[LL,Rk],60:oge,61:LL,95:Rk,96:RL,126:RL},Yge={38:iG,92:sG},Xge={[-5]:y5,[-4]:y5,[-3]:y5,33:Sge,38:iG,42:t7,60:[T0e,fge],91:Tge,92:[ege,sG],93:eM,95:t7,96:$0e},Qge={null:[t7,Fge]},Jge={null:[42,95]},Zge={null:[]},e1e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Jge,contentInitial:Wge,disable:Zge,document:Vge,flow:Kge,flowInitial:Gge,insideSpan:Qge,string:Yge,text:Xge},Symbol.toStringTag,{value:"Module"}));function t1e(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:C(T),check:C(S),consume:y,enter:w,exit:k,interrupt:C(S,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:m,sliceStream:p,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(L){return o=Sl(o,L),x(),o[o.length-1]!==null?[]:(_(t,0),u.events=eS(i,u.events,u),u.events)}function m(L,N){return r1e(p(L),N)}function p(L){return n1e(o,L)}function g(){const{_bufferIndex:L,_index:N,line:O,column:B,offset:$}=r;return{_bufferIndex:L,_index:N,line:O,column:B,offset:$}}function b(L){s[L.line]=L.column,M()}function x(){let L;for(;r._index<o.length;){const N=o[r._index];if(typeof N=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<N.length;)v(N.charCodeAt(r._bufferIndex));else v(N)}}function v(L){d=d(L)}function y(L){Cn(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,M()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function w(L,N){const O=N||{};return O.type=L,O.start=g(),u.events.push(["enter",O,u]),a.push(O),O}function k(L){const N=a.pop();return N.end=g(),u.events.push(["exit",N,u]),N}function T(L,N){_(L,N.from)}function S(L,N){N.restore()}function C(L,N){return O;function O(B,$,P){let K,F,H,D;return Array.isArray(B)?U(B):"tokenize"in B?U([B]):Q(B);function Q(J){return V;function V(se){const Z=se!==null&&J[se],X=se!==null&&J.null,te=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(X)?X:X?[X]:[]];return U(te)(se)}}function U(J){return K=J,F=0,J.length===0?P:j(J[F])}function j(J){return V;function V(se){return D=A(),H=J,J.partial||(u.currentConstruct=J),J.name&&u.parser.constructs.disable.null.includes(J.name)?oe():J.tokenize.call(N?Object.assign(Object.create(u),N):u,l,ie,oe)(se)}}function ie(J){return L(H,D),$}function oe(J){return D.restore(),++F<K.length?j(K[F]):P}}}function _(L,N){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&Za(u.events,N,u.events.length-N,L.resolve(u.events.slice(N),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function A(){const L=g(),N=u.previous,O=u.currentConstruct,B=u.events.length,$=Array.from(a);return{from:B,restore:P};function P(){r=L,u.previous=N,u.currentConstruct=O,u.events.length=B,a=$,M()}}function M(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function n1e(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 r1e(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 s1e(e){const r={constructs:tG([e1e,...(e||{}).extensions||[]]),content:s(v0e),defined:[],document:s(w0e),flow:s($ge),lazy:{},string:s(qge),text:s(Hge)};return r;function s(i){return o;function o(a){return t1e(r,i,a)}}}function i1e(e){for(;!oG(e););return e}const PL=/[\0\t\n\r]/g;function o1e(){let e=1,t="",n=!0,r;return s;function s(i,o,a){const l=[];let u,d,h,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(PL.lastIndex=h,u=PL.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<m&&(l.push(i.slice(h,m)),e+=m-h),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=m+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const a1e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function l1e(e){return e.replace(a1e,c1e)}function c1e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return nG(n.slice(i?2:1),i?16:10)}return Z9(n)||e}const hG={}.hasOwnProperty;function u1e(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),d1e(n)(i1e(s1e(n).document().write(o1e()(e,t,!0))))}function d1e(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Nt),autolinkProtocol:A,autolinkEmail:A,atxHeading:i(Ne),blockQuote:i(X),characterEscape:A,characterReference:A,codeFenced:i(te),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(te,o),codeText:i(ae,o),codeTextData:A,data:A,codeFlowValue:A,definition:i(xe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ae),hardBreakEscape:i(Le),hardBreakTrailing:i(Le),htmlFlow:i(ge,o),htmlFlowData:A,htmlText:i(ge,o),htmlTextData:A,image:i(Oe),label:o,link:i(Nt),listItem:i(Ce),listItemValue:m,listOrdered:i(Pe,h),listUnordered:i(Pe),paragraph:i(Zt),reference:j,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(Ne),strong:i(dt),thematicBreak:i(St)},exit:{atxHeading:l(),atxHeadingSequence:T,autolink:l(),autolinkEmail:Z,autolinkProtocol:se,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:J,characterReference:V,codeFenced:l(x),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:M,codeIndented:l(v),codeText:l($),codeTextData:M,data:M,definition:l(),definitionDestinationString:k,definitionLabelString:y,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(N),hardBreakTrailing:l(N),htmlFlow:l(O),htmlFlowData:M,htmlText:l(B),htmlTextData:M,image:l(K),label:H,labelText:F,lineEnding:L,link:l(P),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ie,resourceDestinationString:D,resourceTitleString:Q,resource:U,setextHeading:l(_),setextHeadingLineSequence:C,setextHeadingText:S,strong:l(),thematicBreak:l()}};fG(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let je={type:"root",children:[]};const We={stack:[je],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:d,data:n},Te=[];let jt=-1;for(;++jt<Y.length;)if(Y[jt][1].type==="listOrdered"||Y[jt][1].type==="listUnordered")if(Y[jt][0]==="enter")Te.push(jt);else{const zt=Te.pop();jt=s(Y,zt,jt)}for(jt=-1;++jt<Y.length;){const zt=t[Y[jt][0]];hG.call(zt,Y[jt][1].type)&&zt[Y[jt][1].type].call(Object.assign({sliceSerialize:Y[jt][2].sliceSerialize},We),Y[jt][1])}if(We.tokenStack.length>0){const zt=We.tokenStack[We.tokenStack.length-1];(zt[1]||OL).call(We,void 0,zt[0])}for(je.position={start:Kd(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:Kd(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},jt=-1;++jt<t.transforms.length;)je=t.transforms[jt](je)||je;return je}function s(Y,je,We){let Te=je-1,jt=-1,zt=!1,bn,Pn,qe,At;for(;++Te<=We;){const he=Y[Te];switch(he[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{he[0]==="enter"?jt++:jt--,At=void 0;break}case"lineEndingBlank":{he[0]==="enter"&&(bn&&!At&&!jt&&!qe&&(qe=Te),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!jt&&he[0]==="enter"&&he[1].type==="listItemPrefix"||jt===-1&&he[0]==="exit"&&(he[1].type==="listUnordered"||he[1].type==="listOrdered")){if(bn){let Be=Te;for(Pn=void 0;Be--;){const Ie=Y[Be];if(Ie[1].type==="lineEnding"||Ie[1].type==="lineEndingBlank"){if(Ie[0]==="exit")continue;Pn&&(Y[Pn][1].type="lineEndingBlank",zt=!0),Ie[1].type="lineEnding",Pn=Be}else if(!(Ie[1].type==="linePrefix"||Ie[1].type==="blockQuotePrefix"||Ie[1].type==="blockQuotePrefixWhitespace"||Ie[1].type==="blockQuoteMarker"||Ie[1].type==="listItemIndent"))break}qe&&(!Pn||qe<Pn)&&(bn._spread=!0),bn.end=Object.assign({},Pn?Y[Pn][1].start:he[1].end),Y.splice(Pn||Te,0,["exit",bn,he[2]]),Te++,We++}if(he[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},he[1].start),end:void 0};bn=Be,Y.splice(Te,0,["enter",Be,he[2]]),Te++,We++,qe=void 0,At=!0}}}return Y[je][1]._spread=zt,We}function i(Y,je){return We;function We(Te){a.call(this,Y(Te),Te),je&&je.call(this,Te)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(Y,je,We){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([je,We||void 0]),Y.position={start:Kd(je.start),end:void 0}}function l(Y){return je;function je(We){Y&&Y.call(this,We),u.call(this,We)}}function u(Y,je){const We=this.stack.pop(),Te=this.tokenStack.pop();if(Te)Te[0].type!==Y.type&&(je?je.call(this,Y,Te[0]):(Te[1]||OL).call(this,Y,Te[0]));else throw new Error("Cannot close `"+Y.type+"` ("+Jb({start:Y.start,end:Y.end})+"): it’s not open");We.position.end=Kd(Y.end)}function d(){return J9(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(Y){if(this.data.expectingFirstListItemValue){const je=this.stack[this.stack.length-2];je.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.lang=Y}function g(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.meta=Y}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.value=Y.replace(/(\r?\n|\r)$/g,"")}function y(Y){const je=this.resume(),We=this.stack[this.stack.length-1];We.label=je,We.identifier=Zl(this.sliceSerialize(Y)).toLowerCase()}function w(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.title=Y}function k(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.url=Y}function T(Y){const je=this.stack[this.stack.length-1];if(!je.depth){const We=this.sliceSerialize(Y).length;je.depth=We}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(Y){const je=this.stack[this.stack.length-1];je.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function A(Y){const We=this.stack[this.stack.length-1].children;let Te=We[We.length-1];(!Te||Te.type!=="text")&&(Te=Ge(),Te.position={start:Kd(Y.start),end:void 0},We.push(Te)),this.stack.push(Te)}function M(Y){const je=this.stack.pop();je.value+=this.sliceSerialize(Y),je.position.end=Kd(Y.end)}function L(Y){const je=this.stack[this.stack.length-1];if(this.data.atHardBreak){const We=je.children[je.children.length-1];We.position.end=Kd(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(je.type)&&(A.call(this,Y),M.call(this,Y))}function N(){this.data.atHardBreak=!0}function O(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.value=Y}function B(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.value=Y}function $(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.value=Y}function P(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const je=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=je,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function K(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const je=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=je,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function F(Y){const je=this.sliceSerialize(Y),We=this.stack[this.stack.length-2];We.label=l1e(je),We.identifier=Zl(je).toLowerCase()}function H(){const Y=this.stack[this.stack.length-1],je=this.resume(),We=this.stack[this.stack.length-1];if(this.data.inReference=!0,We.type==="link"){const Te=Y.children;We.children=Te}else We.alt=je}function D(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.url=Y}function Q(){const Y=this.resume(),je=this.stack[this.stack.length-1];je.title=Y}function U(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function ie(Y){const je=this.resume(),We=this.stack[this.stack.length-1];We.label=je,We.identifier=Zl(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function oe(Y){this.data.characterReferenceType=Y.type}function J(Y){const je=this.sliceSerialize(Y),We=this.data.characterReferenceType;let Te;We?(Te=nG(je,We==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Te=Z9(je);const jt=this.stack[this.stack.length-1];jt.value+=Te}function V(Y){const je=this.stack.pop();je.position.end=Kd(Y.end)}function se(Y){M.call(this,Y);const je=this.stack[this.stack.length-1];je.url=this.sliceSerialize(Y)}function Z(Y){M.call(this,Y);const je=this.stack[this.stack.length-1];je.url="mailto:"+this.sliceSerialize(Y)}function X(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function ae(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ae(){return{type:"emphasis",children:[]}}function Ne(){return{type:"heading",depth:0,children:[]}}function Le(){return{type:"break"}}function ge(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function Nt(){return{type:"link",title:null,url:"",children:[]}}function Pe(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Ce(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function Zt(){return{type:"paragraph",children:[]}}function dt(){return{type:"strong",children:[]}}function Ge(){return{type:"text",value:""}}function St(){return{type:"thematicBreak"}}}function Kd(e){return{line:e.line,column:e.column,offset:e.offset}}function fG(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?fG(e,r):h1e(e,r)}}function h1e(e,t){let n;for(n in t)if(hG.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 OL(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Jb({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Jb({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Jb({start:t.start,end:t.end})+") is still open")}function f1e(e){const t=this;t.parser=n;function n(r){return u1e(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function m1e(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 p1e(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
`}]}function g1e(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 b1e(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function y1e(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v1e(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Wg(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 u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function x1e(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 w1e(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function mG(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 k1e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mG(e,t);const s={src:Wg(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 _1e(e,t){const n={src:Wg(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 S1e(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 C1e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return mG(e,t);const s={href:Wg(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 T1e(e,t){const n={href:Wg(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 A1e(e,t,n){const r=e.all(t),s=n?E1e(n):pG(t),i={},o=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(s||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!s?o.push(...d.children):o.push(d)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
`});const u={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,u),e.applyData(t,u)}function E1e(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=pG(n[r])}return t}function pG(e){const t=e.spread;return t??e.children.length>1}function M1e(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 N1e(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j1e(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function I1e(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function R1e(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=K9(t.children[1]),l=KW(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 D1e(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 u=[];for(;++l<a;){const h=t.children[l],m={},p=o?o[l]:void 0;p&&(m.align=p);let g={type:"element",tagName:i,properties:m,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function L1e(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const BL=9,$L=32;function P1e(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(zL(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(zL(t.slice(s),s>0,!1)),i.join("")}function zL(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===BL||i===$L;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===BL||i===$L;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function O1e(e,t){const n={type:"text",value:P1e(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function B1e(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const $1e={blockquote:m1e,break:p1e,code:g1e,delete:b1e,emphasis:y1e,footnoteReference:v1e,heading:x1e,html:w1e,imageReference:k1e,image:_1e,inlineCode:S1e,linkReference:C1e,link:T1e,listItem:A1e,list:M1e,paragraph:N1e,root:j1e,strong:I1e,table:R1e,tableCell:L1e,tableRow:D1e,text:O1e,thematicBreak:B1e,toml:Jx,yaml:Jx,definition:Jx,footnoteDefinition:Jx};function Jx(){}const gG=-1,tS=0,ey=1,K2=2,tM=3,nM=4,rM=5,sM=6,bG=7,yG=8,FL=typeof self=="object"?self:globalThis,z1e=(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 tS:case gG:return n(o,s);case ey:{const a=n([],s);for(const l of o)a.push(r(l));return a}case K2:{const a=n({},s);for(const[l,u]of o)a[r(l)]=r(u);return a}case tM:return n(new Date(o),s);case nM:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case rM:{const a=n(new Map,s);for(const[l,u]of o)a.set(r(l),r(u));return a}case sM:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case bG:{const{name:a,message:l}=o;return n(new FL[a](l),s)}case yG: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 FL[i](o),s)};return r},qL=e=>z1e(new Map,e)(0),zp="",{toString:F1e}={},{keys:q1e}=Object,G1=e=>{const t=typeof e;if(t!=="object"||!e)return[tS,t];const n=F1e.call(e).slice(8,-1);switch(n){case"Array":return[ey,zp];case"Object":return[K2,zp];case"Date":return[tM,zp];case"RegExp":return[nM,zp];case"Map":return[rM,zp];case"Set":return[sM,zp];case"DataView":return[ey,n]}return n.includes("Array")?[ey,n]:n.includes("Error")?[bG,n]:[K2,n]},Zx=([e,t])=>e===tS&&(t==="function"||t==="symbol"),H1e=(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]=G1(o);switch(a){case tS:{let d=o;switch(l){case"bigint":a=yG,d=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return s([gG],o)}return s([a,d],o)}case ey:{if(l){let m=o;return l==="DataView"?m=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(o)),s([l,[...m]],o)}const d=[],h=s([a,d],o);for(const m of o)d.push(i(m));return h}case K2:{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 d=[],h=s([a,d],o);for(const m of q1e(o))(e||!Zx(G1(o[m])))&&d.push([i(m),i(o[m])]);return h}case tM:return s([a,o.toISOString()],o);case nM:{const{source:d,flags:h}=o;return s([a,{source:d,flags:h}],o)}case rM:{const d=[],h=s([a,d],o);for(const[m,p]of o)(e||!(Zx(G1(m))||Zx(G1(p))))&&d.push([i(m),i(p)]);return h}case sM:{const d=[],h=s([a,d],o);for(const m of o)(e||!Zx(G1(m)))&&d.push(i(m));return h}}const{message:u}=o;return s([a,{name:l,message:u}],o)};return i},HL=(e,{json:t,lossy:n}={})=>{const r=[];return H1e(!(t||n),!!t,new Map,r)(e),r},Y2=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?qL(HL(e,t)):structuredClone(e):(e,t)=>qL(HL(e,t));function U1e(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 V1e(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function W1e(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||U1e,r=e.options.footnoteBackLabel||V1e,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 u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),m=Wg(h.toLowerCase());let p=0;const g=[],b=e.footnoteCounts.get(h);for(;b!==void 0&&++p<=b;){g.length>0&&g.push({type:"text",value:" "});let y=typeof n=="string"?n:n(l,p);typeof y=="string"&&(y={type:"text",value:y}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const y=x.children[x.children.length-1];y&&y.type==="text"?y.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const v={type:"element",tagName:"li",properties:{id:t+"fn-"+m},children:e.wrap(d,!0)};e.patch(u,v),a.push(v)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Y2(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 Dv=function(e){if(e==null)return X1e;if(typeof e=="function")return nS(e);if(typeof e=="object")return Array.isArray(e)?G1e(e):K1e(e);if(typeof e=="string")return Y1e(e);throw new Error("Expected function, string, or object as test")};function G1e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Dv(e[n]);return nS(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function K1e(e){const t=e;return nS(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function Y1e(e){return nS(t);function t(n){return n&&n.type===e}}function nS(e){return t;function t(n,r,s){return!!(Q1e(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function X1e(){return!0}function Q1e(e){return e!==null&&typeof e=="object"&&"type"in e}const vG=[],J1e=!0,n7=!1,xG="skip";function iM(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Dv(s),o=r?-1:1;a(e,void 0,[])();function a(l,u,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const p=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=vG,g,b,x;if((!t||i(l,u,d[d.length-1]||void 0))&&(p=Z1e(n(l,d)),p[0]===n7))return p;if("children"in l&&l.children){const v=l;if(v.children&&p[0]!==xG)for(b=(r?v.children.length:-1)+o,x=d.concat(v);b>-1&&b<v.children.length;){const y=v.children[b];if(g=a(y,b,x)(),g[0]===n7)return g;b=typeof g[1]=="number"?g[1]:b+o}}return p}}}function Z1e(e){return Array.isArray(e)?e:typeof e=="number"?[J1e,e]:e==null?vG:[e]}function oM(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),iM(e,i,a,s);function a(l,u){const d=u[u.length-1],h=d?d.children.indexOf(l):void 0;return o(l,h,d)}}const r7={}.hasOwnProperty,ebe={};function tbe(e,t){const n=t||ebe,r=new Map,s=new Map,i=new Map,o={...$1e,...n.handlers},a={all:u,applyData:rbe,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:nbe,wrap:ibe};return oM(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:s,m=String(d.identifier).toUpperCase();h.has(m)||h.set(m,d)}}),a;function l(d,h){const m=d.type,p=a.handlers[m];if(r7.call(a.handlers,m)&&p)return p(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in d){const{children:b,...x}=d,v=Y2(x);return v.children=a.all(d),v}return Y2(d)}return(a.options.unknownHandler||sbe)(a,d,h)}function u(d){const h=[];if("children"in d){const m=d.children;let p=-1;for(;++p<m.length;){const g=a.one(m[p],d);if(g){if(p&&m[p-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=UL(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=UL(b.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function nbe(e,t){e.position&&(t.position=Vpe(e))}function rbe(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,Y2(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function sbe(e,t){const n=t.data||{},r="value"in t&&!(r7.call(n,"hProperties")||r7.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 ibe(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 UL(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function VL(e,t){const n=tbe(e,t),r=n.one(e,void 0),s=W1e(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
`},s),i}function obe(e,t){return e&&"run"in e?async function(n,r){const s=VL(n,{file:r,...t});await e.run(s,r)}:function(n,r){return VL(n,{file:r,...e||t})}}function WL(e){if(e)throw e}var Dk=Object.prototype.hasOwnProperty,wG=Object.prototype.toString,GL=Object.defineProperty,KL=Object.getOwnPropertyDescriptor,YL=function(t){return typeof Array.isArray=="function"?Array.isArray(t):wG.call(t)==="[object Array]"},XL=function(t){if(!t||wG.call(t)!=="[object Object]")return!1;var n=Dk.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Dk.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Dk.call(t,s)},QL=function(t,n){GL&&n.name==="__proto__"?GL(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},JL=function(t,n){if(n==="__proto__")if(Dk.call(t,n)){if(KL)return KL(t,n).value}else return;return t[n]},abe=function e(){var t,n,r,s,i,o,a=arguments[0],l=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=JL(a,n),s=JL(t,n),a!==s&&(d&&s&&(XL(s)||(i=YL(s)))?(i?(i=!1,o=r&&YL(r)?r:[]):o=r&&XL(r)?r:{},QL(a,{name:n,newValue:e(d,o,s)})):typeof s<"u"&&QL(a,{name:n,newValue:s}));return a};const v5=_4(abe);function s7(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 lbe(){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,...u){const d=e[++i];let h=-1;if(l){o(l);return}for(;++h<s.length;)(u[h]===null||u[h]===void 0)&&(u[h]=s[h]);s=u,d?cbe(d,a)(...u):o(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function cbe(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(u){const d=u;if(a&&n)throw d;return s(d)}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 Mc={basename:ube,dirname:dbe,extname:hbe,join:fbe,sep:"/"};function ube(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Lv(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 dbe(e){if(Lv(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 hbe(e){Lv(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 fbe(...e){let t=-1,n;for(;++t<e.length;)Lv(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":mbe(n)}function mbe(e){Lv(e);const t=e.codePointAt(0)===47;let n=pbe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function pbe(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 Lv(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const gbe={cwd:bbe};function bbe(){return"/"}function i7(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ybe(e){if(typeof e=="string")e=new URL(e);else if(!i7(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 vbe(e)}function vbe(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 x5=["history","path","basename","stem","extname","dirname"];class kG{constructor(t){let n;t?i7(t)?n={path:t}:typeof t=="string"||xbe(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":gbe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<x5.length;){const i=x5[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)x5.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Mc.basename(this.path):void 0}set basename(t){k5(t,"basename"),w5(t,"basename"),this.path=Mc.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Mc.dirname(this.path):void 0}set dirname(t){ZL(this.basename,"dirname"),this.path=Mc.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Mc.extname(this.path):void 0}set extname(t){if(w5(t,"extname"),ZL(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=Mc.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){i7(t)&&(t=ybe(t)),k5(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Mc.basename(this.path,this.extname):void 0}set stem(t){k5(t,"stem"),w5(t,"stem"),this.path=Mc.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 _o(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 w5(e,t){if(e&&e.includes(Mc.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Mc.sep+"`")}function k5(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ZL(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function xbe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wbe=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},kbe={}.hasOwnProperty;class aM extends wbe{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=lbe()}copy(){const t=new aM;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(v5(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(C5("data",this.frozen),this.namespace[t]=n,this):kbe.call(this.namespace,t)&&this.namespace[t]||void 0:t?(C5("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=ew(t),r=this.parser||this.Parser;return _5("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),_5("process",this.parser||this.Parser),S5("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=ew(t),l=r.parse(a);r.run(l,a,function(d,h,m){if(d||!h||!m)return u(d);const p=h,g=r.stringify(p,m);Cbe(g)?m.value=g:m.result=g,u(d,m)});function u(d,h){d||!h?o(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),_5("processSync",this.parser||this.Parser),S5("processSync",this.compiler||this.Compiler),this.process(t,s),tP("processSync","process",n),r;function s(i,o){n=!0,WL(i),r=o}}run(t,n,r){eP(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=ew(n);s.run(t,l,u);function u(d,h,m){const p=h||t;d?a(d):o?o(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),tP("runSync","run",r),s;function i(o,a){WL(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=ew(n),s=this.compiler||this.Compiler;return S5("stringify",s),eP(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(C5("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(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;l(d,h)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))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(u.plugins),u.settings&&(s.settings=v5(!0,s.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===u){m=h;break}if(m===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const b=r[m][1];s7(b)&&s7(p)&&(p=v5(!0,b,p)),r[m]=[u,p,...g]}}}}const _be=new aM().freeze();function _5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function S5(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function C5(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 eP(e){if(!s7(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function tP(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ew(e){return Sbe(e)?e:new kG(e)}function Sbe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Cbe(e){return typeof e=="string"||Tbe(e)}function Tbe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Abe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",nP=[],rP={allowDangerousHtml:!0},Ebe=/^(https?|ircs?|mailto|xmpp)$/i,Mbe=[{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 Nbe(e){const t=jbe(e),n=Ibe(e);return Rbe(t.runSync(t.parse(n),n),e)}function jbe(e){const t=e.rehypePlugins||nP,n=e.remarkPlugins||nP,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...rP}:rP;return _be().use(f1e).use(n).use(obe,r).use(t)}function Ibe(e){const t=e.children||"",n=new kG;return typeof t=="string"&&(n.value=t),n}function Rbe(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||_G;for(const d of Mbe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Abe+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),oM(e,u),Xpe(e,{Fragment:c.Fragment,components:s,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function u(d,h,m){if(d.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in g5)if(Object.hasOwn(g5,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=g5[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=l(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,m)),p&&m&&typeof h=="number")return a&&d.children?m.children.splice(h,1,...d.children):m.children.splice(h,1),h}}}function _G(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||Ebe.test(e.slice(0,t))?e:""}function X2(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 Dbe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Lbe(e,t,n){const s=Dv((n||{}).ignore||[]),i=Pbe(t);let o=-1;for(;++o<i.length;)iM(e,"text",a);function a(u,d){let h=-1,m;for(;++h<d.length;){const p=d[h],g=m?m.children:void 0;if(s(p,g?g.indexOf(p):void 0,m))return;m=p}if(m)return l(u,d)}function l(u,d){const h=d[d.length-1],m=i[o][0],p=i[o][1];let g=0;const x=h.children.indexOf(u);let v=!1,y=[];m.lastIndex=0;let w=m.exec(u.value);for(;w;){const k=w.index,T={index:w.index,input:w.input,stack:[...d,u]};let S=p(...w,T);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?m.lastIndex=k+1:(g!==k&&y.push({type:"text",value:u.value.slice(g,k)}),Array.isArray(S)?y.push(...S):S&&y.push(S),g=k+w[0].length,v=!0),!m.global)break;w=m.exec(u.value)}return v?(g<u.value.length&&y.push({type:"text",value:u.value.slice(g)}),h.children.splice(x,1,...y)):y=[u],x+y.length}}function Pbe(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([Obe(s[0]),Bbe(s[1])])}return t}function Obe(e){return typeof e=="string"?new RegExp(Dbe(e),"g"):e}function Bbe(e){return typeof e=="function"?e:function(){return e}}const T5="phrasing",A5=["autolink","link","image","label"];function $be(){return{transforms:[Wbe],enter:{literalAutolink:Fbe,literalAutolinkEmail:E5,literalAutolinkHttp:E5,literalAutolinkWww:E5},exit:{literalAutolink:Vbe,literalAutolinkEmail:Ube,literalAutolinkHttp:qbe,literalAutolinkWww:Hbe}}}function zbe(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:T5,notInConstruct:A5},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:T5,notInConstruct:A5},{character:":",before:"[ps]",after:"\\/",inConstruct:T5,notInConstruct:A5}]}}function Fbe(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function E5(e){this.config.enter.autolinkProtocol.call(this,e)}function qbe(e){this.config.exit.autolinkProtocol.call(this,e)}function Hbe(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 Ube(e){this.config.exit.autolinkEmail.call(this,e)}function Vbe(e){this.exit(e)}function Wbe(e){Lbe(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Gbe],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Kbe]],{ignore:["link","linkReference"]})}function Gbe(e,t,n,r,s){let i="";if(!SG(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!Ybe(n)))return!1;const o=Xbe(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 Kbe(e,t,n,r){return!SG(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Ybe(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 Xbe(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=X2(e,"(");let i=X2(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 SG(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Vm(n)||Z4(n))&&(!t||n!==47)}CG.peek=iye;function Qbe(){this.buffer()}function Jbe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Zbe(){this.buffer()}function eye(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function tye(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zl(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nye(e){this.exit(e)}function rye(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Zl(this.sliceSerialize(e)).toLowerCase(),n.label=t}function sye(e){this.exit(e)}function iye(){return"["}function CG(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 oye(){return{enter:{gfmFootnoteCallString:Qbe,gfmFootnoteCall:Jbe,gfmFootnoteDefinitionLabelString:Zbe,gfmFootnoteDefinition:eye},exit:{gfmFootnoteCallString:tye,gfmFootnoteCall:nye,gfmFootnoteDefinitionLabelString:rye,gfmFootnoteDefinition:sye}}}function aye(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:CG},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),d(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
`:" ")+i.indentLines(i.containerFlow(r,a.current()),t?TG:lye))),u(),l}}function lye(e,t,n){return t===0?e:TG(e,t,n)}function TG(e,t,n){return(n?"":"    ")+e}const cye=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];AG.peek=mye;function uye(){return{canContainEols:["delete"],enter:{strikethrough:hye},exit:{strikethrough:fye}}}function dye(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cye}],handlers:{delete:AG}}}function hye(e){this.enter({type:"delete",children:[]},e)}function fye(e){this.exit(e)}function AG(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 mye(){return"~"}function pye(e){return e.length}function gye(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||pye,i=[],o=[],a=[],l=[];let u=0,d=-1;for(;++d<e.length;){const b=[],x=[];let v=-1;for(e[d].length>u&&(u=e[d].length);++v<e[d].length;){const y=bye(e[d][v]);if(n.alignDelimiters!==!1){const w=s(y);x[v]=w,(l[v]===void 0||w>l[v])&&(l[v]=w)}b.push(y)}o[d]=b,a[d]=x}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<u;)i[h]=sP(r[h]);else{const b=sP(r);for(;++h<u;)i[h]=b}h=-1;const m=[],p=[];for(;++h<u;){const b=i[h];let x="",v="";b===99?(x=":",v=":"):b===108?x=":":b===114&&(v=":");let y=n.alignDelimiters===!1?1:Math.max(1,l[h]-x.length-v.length);const w=x+"-".repeat(y)+v;n.alignDelimiters!==!1&&(y=x.length+y+v.length,y>l[h]&&(l[h]=y),p[h]=y),m[h]=w}o.splice(1,0,m),a.splice(1,0,p),d=-1;const g=[];for(;++d<o.length;){const b=o[d],x=a[d];h=-1;const v=[];for(;++h<u;){const y=b[h]||"";let w="",k="";if(n.alignDelimiters!==!1){const T=l[h]-(x[h]||0),S=i[h];S===114?w=" ".repeat(T):S===99?T%2?(w=" ".repeat(T/2+.5),k=" ".repeat(T/2-.5)):(w=" ".repeat(T/2),k=w):k=" ".repeat(T)}n.delimiterStart!==!1&&!h&&v.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&y==="")&&(n.delimiterStart!==!1||h)&&v.push(" "),n.alignDelimiters!==!1&&v.push(w),v.push(y),n.alignDelimiters!==!1&&v.push(k),n.padding!==!1&&v.push(" "),(n.delimiterEnd!==!1||h!==u-1)&&v.push("|")}g.push(n.delimiterEnd===!1?v.join("").replace(/ +$/,""):v.join(""))}return g.join(`
`)}function bye(e){return e==null?"":String(e)}function sP(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 iP={}.hasOwnProperty;function yye(e,t){const n=t||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&iP.call(s,e)){const l=String(s[e]);o=iP.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 vye(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()),xye);return s(),o}function xye(e,t,n){return">"+(n?"":" ")+e}function wye(e,t){return oP(e,t.inConstruct,!0)&&!oP(e,t.notInConstruct,!1)}function oP(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 aP(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
`&&wye(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function EG(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 kye(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 _ye(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 Sye(e,t,n,r){const s=_ye(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(kye(e,n)){const h=n.enter("codeIndented"),m=n.indentLines(i,Cye);return h(),m}const a=n.createTracker(r),l=s.repeat(Math.max(EG(i,s)+1,3)),u=n.enter("codeFenced");let d=a.move(l);if(e.lang){const h=n.enter(`codeFencedLang${o}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),h()}if(e.lang&&e.meta){const h=n.enter(`codeFencedMeta${o}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
`,encode:["`"],...a.current()})),h()}return d+=a.move(`
`),i&&(d+=a.move(i+`
`)),d+=a.move(l),u(),d}function Cye(e,t,n){return(n?"":"    ")+e}function lM(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 Tye(e,t,n,r){const s=lM(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),a()),o(),u}function Aye(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 Dy(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Q2(e,t,n){const r=fg(e),s=fg(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}}MG.peek=Eye;function MG(e,t,n,r){const s=Aye(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 u=l.charCodeAt(0),d=Q2(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(l=Dy(u)+l.slice(1));const h=l.charCodeAt(l.length-1),m=Q2(r.after.charCodeAt(0),h,s);m.inside&&(l=l.slice(0,-1)+Dy(h));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+l+p}function Eye(e,t,n){return n.options.emphasis||"*"}function Mye(e,t){let n=!1;return oM(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,n7}),!!((!e.depth||e.depth<3)&&J9(e)&&(t.options.setext||n))}function Nye(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(Mye(e,n)){const d=n.enter("headingSetext"),h=n.enter("phrasing"),m=n.containerPhrasing(e,{...i.current(),before:`
`,after:`
`});return h(),d(),m+`
`+(s===1?"=":"-").repeat(m.length-(Math.max(m.lastIndexOf("\r"),m.lastIndexOf(`
`))+1))}const o="#".repeat(s),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
`,...i.current()});return/^[\t ]/.test(u)&&(u=Dy(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}NG.peek=jye;function NG(e){return e.value||""}function jye(){return"<"}jG.peek=Iye;function jG(e,t,n,r){const s=lM(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),u+=l.move(" "+s),u+=l.move(n.safe(e.title,{before:u,after:s,...l.current()})),u+=l.move(s),a()),u+=l.move(")"),o(),u}function Iye(){return"!"}IG.peek=Rye;function IG(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 u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==h?l+=a.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Rye(){return"!"}RG.peek=Dye;function RG(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 u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return s+r+s}function Dye(){return"`"}function DG(e,t){const n=J9(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))}LG.peek=Lye;function LG(e,t,n,r){const s=lM(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(DG(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let h=o.move("<");return h+=o.move(n.containerPhrasing(e,{before:h,after:">",...o.current()})),h+=o.move(">"),a(),n.stack=d,h}a=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),u+=o.move(" "+s),u+=o.move(n.safe(e.title,{before:u,after:s,...o.current()})),u+=o.move(s),l()),u+=o.move(")"),a(),u}function Lye(e,t,n){return DG(e,n)?"<":"["}PG.peek=Pye;function PG(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 u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const d=n.stack;n.stack=[],o=n.enter("reference");const h=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=d,i(),s==="full"||!u||u!==h?l+=a.move(h+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Pye(){return"["}function cM(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 Oye(e){const t=cM(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 Bye(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 OG(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 $ye(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?Bye(n):cM(n);const a=e.ordered?o==="."?")":".":Oye(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),OG(n)===o&&d){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),u}function zye(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 Fye(e,t,n,r){const s=zye(n);let i=n.bulletCurrent||cM(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"),u=n.indentLines(n.containerFlow(e,a.current()),d);return l(),u;function d(h,m,p){return m?(p?"":" ".repeat(o))+h:(p?i:i+" ".repeat(o-i.length))+h}}function qye(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const Hye=Dv(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Uye(e,t,n,r){return(e.children.some(function(o){return Hye(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Vye(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}BG.peek=Wye;function BG(e,t,n,r){const s=Vye(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 u=l.charCodeAt(0),d=Q2(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(l=Dy(u)+l.slice(1));const h=l.charCodeAt(l.length-1),m=Q2(r.after.charCodeAt(0),h,s);m.inside&&(l=l.slice(0,-1)+Dy(h));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:m.outside,before:d.outside},a+l+p}function Wye(e,t,n){return n.options.strong||"*"}function Gye(e,t,n,r){return n.safe(e.value,r)}function Kye(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 Yye(e,t,n){const r=(OG(n)+(n.options.ruleSpaces?" ":"")).repeat(Kye(n));return n.options.ruleSpaces?r.slice(0,-1):r}const $G={blockquote:vye,break:aP,code:Sye,definition:Tye,emphasis:MG,hardBreak:aP,heading:Nye,html:NG,image:jG,imageReference:IG,inlineCode:RG,link:LG,linkReference:PG,list:$ye,listItem:Fye,paragraph:qye,root:Uye,strong:BG,text:Gye,thematicBreak:Yye};function Xye(){return{enter:{table:Qye,tableData:lP,tableHeader:lP,tableRow:Zye},exit:{codeText:eve,table:Jye,tableData:M5,tableHeader:M5,tableRow:M5}}}function Qye(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 Jye(e){this.exit(e),this.data.inTable=void 0}function Zye(e){this.enter({type:"tableRow",children:[]},e)}function M5(e){this.exit(e)}function lP(e){this.enter({type:"tableCell",children:[]},e)}function eve(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,tve));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function tve(e,t){return t==="|"?t:e}function nve(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:m,table:o,tableCell:l,tableRow:a}};function o(p,g,b,x){return u(d(p,b,x),p.align)}function a(p,g,b,x){const v=h(p,b,x),y=u([v]);return y.slice(0,y.indexOf(`
`))}function l(p,g,b,x){const v=b.enter("tableCell"),y=b.enter("phrasing"),w=b.containerPhrasing(p,{...x,before:i,after:i});return y(),v(),w}function u(p,g){return gye(p,{align:g,alignDelimiters:r,padding:n,stringLength:s})}function d(p,g,b){const x=p.children;let v=-1;const y=[],w=g.enter("table");for(;++v<x.length;)y[v]=h(x[v],g,b);return w(),y}function h(p,g,b){const x=p.children;let v=-1;const y=[],w=g.enter("tableRow");for(;++v<x.length;)y[v]=l(x[v],p,g,b);return w(),y}function m(p,g,b){let x=$G.inlineCode(p,g,b);return b.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function rve(){return{exit:{taskListCheckValueChecked:cP,taskListCheckValueUnchecked:cP,paragraph:ive}}}function sve(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:ove}}}function cP(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ive(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 ove(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=$G.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(d){return d+o}}function ave(){return[$be(),oye(),uye(),Xye(),rve()]}function lve(e){return{extensions:[zbe(),aye(e),dye(),nve(e),sve()]}}const cve={tokenize:pve,partial:!0},zG={tokenize:gve,partial:!0},FG={tokenize:bve,partial:!0},qG={tokenize:yve,partial:!0},uve={tokenize:vve,partial:!0},HG={name:"wwwAutolink",tokenize:fve,previous:VG},UG={name:"protocolAutolink",tokenize:mve,previous:WG},vd={name:"emailAutolink",tokenize:hve,previous:GG},au={};function dve(){return{text:au}}let Gf=48;for(;Gf<123;)au[Gf]=vd,Gf++,Gf===58?Gf=65:Gf===91&&(Gf=97);au[43]=vd;au[45]=vd;au[46]=vd;au[95]=vd;au[72]=[vd,UG];au[104]=[vd,UG];au[87]=[vd,HG];au[119]=[vd,HG];function hve(e,t,n){const r=this;let s,i;return o;function o(h){return!o7(h)||!GG.call(r,r.previous)||uM(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return o7(h)?(e.consume(h),a):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check(uve,d,u)(h):h===45||h===95||yo(h)?(i=!0,e.consume(h),l):d(h)}function u(h){return e.consume(h),s=!0,l}function d(h){return i&&s&&zo(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function fve(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!VG.call(r,r.previous)||uM(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(cve,e.attempt(zG,e.attempt(FG,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function mve(e,t,n){const r=this;let s="",i=!1;return o;function o(h){return(h===72||h===104)&&WG.call(r,r.previous)&&!uM(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(zo(h)&&s.length<5)return s+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const m=s.toLowerCase();if(m==="http"||m==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),i?u:(i=!0,l)):n(h)}function u(h){return h===null||G2(h)||ks(h)||Vm(h)||Z4(h)?n(h):e.attempt(zG,e.attempt(FG,d),n)(h)}function d(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function pve(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 gve(e,t,n){let r,s,i;return o;function o(u){return u===46||u===95?e.check(qG,l,a)(u):u===null||ks(u)||Vm(u)||u!==45&&Z4(u)?l(u):(i=!0,e.consume(u),o)}function a(u){return u===95?r=!0:(s=r,r=void 0),e.consume(u),o}function l(u){return s||r||!i?n(u):t(u)}}function bve(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(qG,t,i)(o):o===null||ks(o)||Vm(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function yve(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||ks(a)||Vm(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||ks(a)||Vm(a)?t(a):r(a)}function i(a){return zo(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):zo(a)?(e.consume(a),o):n(a)}}function vve(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return yo(i)?n(i):t(i)}}function VG(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ks(e)}function WG(e){return!zo(e)}function GG(e){return!(e===47||o7(e))}function o7(e){return e===43||e===45||e===46||e===95||yo(e)}function uM(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 xve={tokenize:Eve,partial:!0};function wve(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Cve,continuation:{tokenize:Tve},exit:Ave}},text:{91:{name:"gfmFootnoteCall",tokenize:Sve},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:kve,resolveTo:_ve}}}}function kve(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 u=Zl(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function _ve(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 Sve(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(h){if(i>999||h===93&&!o||h===null||h===91||ks(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return s.includes(Zl(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return ks(h)||(o=!0),i++,e.consume(h),h===92?d:u}function d(h){return h===91||h===92||h===93?(e.consume(h),i++,u):u(h)}}function Cve(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(o>999||g===93&&!a||g===null||g===91||ks(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return i=Zl(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return ks(g)||(a=!0),o++,e.consume(g),g===92?h:d}function h(g){return g===91||g===92||g===93?(e.consume(g),o++,d):d(g)}function m(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),s.includes(i)||s.push(i),br(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function Tve(e,t,n){return e.check(Rv,t,e.attempt(xve,t,n))}function Ave(e){e.exit("gfmFootnoteDefinition")}function Eve(e,t,n){const r=this;return br(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 Mve(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 u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},m=[["enter",d,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",h,a]],p=a.parser.constructs.insideSpan.null;p&&Za(m,m.length,0,eS(p,o.slice(u+1,l),a)),Za(m,m.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",d,a]]),Za(o,u-1,l-u+3,m),l=u+m.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 u=this.previous,d=this.events;let h=0;return m;function m(g){return u===126&&d[d.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const b=fg(u);if(g===126)return h>1?l(g):(o.consume(g),h++,p);if(h<2&&!n)return l(g);const x=o.exit("strikethroughSequenceTemporary"),v=fg(g);return x._open=!v||v===2&&!!b,x._close=!b||b===2&&!!v,a(g)}}}class Nve{constructor(){this.map=[]}add(t,n,r){jve(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 jve(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 Ive(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 Rve(){return{flow:{null:{name:"table",tokenize:Dve,resolveAll:Lve}}}}function Dve(e,t,n){const r=this;let s=0,i=0,o;return a;function a(M){let L=r.events.length-1;for(;L>-1;){const B=r.events[L][1].type;if(B==="lineEnding"||B==="linePrefix")L--;else break}const N=L>-1?r.events[L][1].type:null,O=N==="tableHead"||N==="tableRow"?S:l;return O===S&&r.parser.lazy[r.now().line]?n(M):O(M)}function l(M){return e.enter("tableHead"),e.enter("tableRow"),u(M)}function u(M){return M===124||(o=!0,i+=1),d(M)}function d(M){return M===null?n(M):Cn(M)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),p):n(M):Sr(M)?br(e,d,"whitespace")(M):(i+=1,o&&(o=!1,s+=1),M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),o=!0,d):(e.enter("data"),h(M)))}function h(M){return M===null||M===124||ks(M)?(e.exit("data"),d(M)):(e.consume(M),M===92?m:h)}function m(M){return M===92||M===124?(e.consume(M),h):h(M)}function p(M){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(M):(e.enter("tableDelimiterRow"),o=!1,Sr(M)?br(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):g(M))}function g(M){return M===45||M===58?x(M):M===124?(o=!0,e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),b):T(M)}function b(M){return Sr(M)?br(e,x,"whitespace")(M):x(M)}function x(M){return M===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),v):M===45?(i+=1,v(M)):M===null||Cn(M)?k(M):T(M)}function v(M){return M===45?(e.enter("tableDelimiterFiller"),y(M)):T(M)}function y(M){return M===45?(e.consume(M),y):M===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(M),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(M))}function w(M){return Sr(M)?br(e,k,"whitespace")(M):k(M)}function k(M){return M===124?g(M):M===null||Cn(M)?!o||s!==i?T(M):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(M)):T(M)}function T(M){return n(M)}function S(M){return e.enter("tableRow"),C(M)}function C(M){return M===124?(e.enter("tableCellDivider"),e.consume(M),e.exit("tableCellDivider"),C):M===null||Cn(M)?(e.exit("tableRow"),t(M)):Sr(M)?br(e,C,"whitespace")(M):(e.enter("data"),_(M))}function _(M){return M===null||M===124||ks(M)?(e.exit("data"),C(M)):(e.consume(M),M===92?A:_)}function A(M){return M===92||M===124?(e.consume(M),_):_(M)}}function Lve(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,d,h;const m=new Nve;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(uP(m,t,l,u,d),d=void 0,l=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",u,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,h=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},m.add(n,0,[["enter",d,t]])),s=g.type==="tableDelimiterRow"?2:d?3:1):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],h=tw(m,t,i,s,void 0,h),i=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],h=tw(m,t,i,s,void 0,h)),i=o,o=[i[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],h=tw(m,t,i,s,n,h)):o[1]!==0&&(h=tw(m,t,o,s,n,h)),s=0):s&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&uP(m,t,l,u,d),m.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Ive(t.events,n))}return e}function tw(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},i0(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=i0(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 u=i0(t.events,n[2]),d=i0(t.events,n[3]),h={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const m=t.events[n[2]],p=t.events[n[3]];if(m[1].end=Object.assign({},p[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return s!==void 0&&(i.end=Object.assign({},i0(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function uP(e,t,n,r,s){const i=[],o=i0(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 i0(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Pve={name:"tasklistCheck",tokenize:Bve};function Ove(){return{text:{91:Pve}}}function Bve(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 ks(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 Cn(l)?t(l):Sr(l)?e.check({tokenize:$ve},t,n)(l):n(l)}}function $ve(e,t,n){return br(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function zve(e){return tG([dve(),wve(),Mve(e),Rve(),Ove()])}const Fve={};function dP(e){const t=this,n=e||Fve,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(zve(n)),i.push(ave()),o.push(lve(n))}function qve(){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 u={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[u]}},l)}function t(){this.buffer()}function n(){const l=this.resume(),u=this.stack[this.stack.length-1];u.type,u.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(l){const u=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=u;const h=d.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:u}),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 u=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=u,d.data.hChildren.push({type:"text",value:u})}function a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function Hve(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 u=i.value||"",d=a.createTracker(l),h="$".repeat(Math.max(EG(u,"$")+1,2)),m=a.enter("mathFlow");let p=d.move(h);if(i.meta){const g=a.enter("mathFlowMeta");p+=d.move(a.safe(i.meta,{after:`
`,before:p,encode:["$"],...d.current()})),g()}return p+=d.move(`
`),u&&(p+=d.move(u+`
`)),p+=d.move(h),m(),p}function r(i,o,a){let l=i.value||"",u=1;for(t||u++;new RegExp("(^|[^$])"+"\\$".repeat(u)+"([^$]|$)").test(l);)u++;const d="$".repeat(u);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let h=-1;for(;++h<a.unsafe.length;){const m=a.unsafe[h];if(!m.atBreak)continue;const p=a.compilePattern(m);let g;for(;g=p.exec(l);){let b=g.index;l.codePointAt(b)===10&&l.codePointAt(b-1)===13&&b--,l=l.slice(0,b)+" "+l.slice(g.index+1)}}return d+l+d}function s(){return"$"}}const Uve={tokenize:Vve,concrete:!0,name:"mathFlow"},hP={tokenize:Wve,partial:!0};function Vve(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(y){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(y)}function l(y){return y===36?(e.consume(y),o++,l):o<2?n(y):(e.exit("mathFlowFenceSequence"),br(e,u,"whitespace")(y))}function u(y){return y===null||Cn(y)?h(y):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(y))}function d(y){return y===null||Cn(y)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),h(y)):y===36?n(y):(e.consume(y),d)}function h(y){return e.exit("mathFlowFence"),r.interrupt?t(y):e.attempt(hP,m,x)(y)}function m(y){return e.attempt({tokenize:v,partial:!0},x,p)(y)}function p(y){return(i?br(e,g,"linePrefix",i+1):g)(y)}function g(y){return y===null?x(y):Cn(y)?e.attempt(hP,m,x)(y):(e.enter("mathFlowValue"),b(y))}function b(y){return y===null||Cn(y)?(e.exit("mathFlowValue"),g(y)):(e.consume(y),b)}function x(y){return e.exit("mathFlow"),t(y)}function v(y,w,k){let T=0;return br(y,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function S(A){return y.enter("mathFlowFence"),y.enter("mathFlowFenceSequence"),C(A)}function C(A){return A===36?(T++,y.consume(A),C):T<o?k(A):(y.exit("mathFlowFenceSequence"),br(y,_,"whitespace")(A))}function _(A){return A===null||Cn(A)?(y.exit("mathFlowFence"),w(A)):k(A)}}}function Wve(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 Gve(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:Kve,previous:Yve,name:"mathText"};function r(s,i,o){let a=0,l,u;return d;function d(b){return s.enter("mathText"),s.enter("mathTextSequence"),h(b)}function h(b){return b===36?(s.consume(b),a++,h):a<2&&!n?o(b):(s.exit("mathTextSequence"),m(b))}function m(b){return b===null?o(b):b===36?(u=s.enter("mathTextSequence"),l=0,g(b)):b===32?(s.enter("space"),s.consume(b),s.exit("space"),m):Cn(b)?(s.enter("lineEnding"),s.consume(b),s.exit("lineEnding"),m):(s.enter("mathTextData"),p(b))}function p(b){return b===null||b===32||b===36||Cn(b)?(s.exit("mathTextData"),m(b)):(s.consume(b),p)}function g(b){return b===36?(s.consume(b),l++,g):l===a?(s.exit("mathTextSequence"),s.exit("mathText"),i(b)):(u.type="mathTextData",p(b))}}}function Kve(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 Yve(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Xve(e){return{flow:{36:Uve},text:{36:Gve(e)}}}class xt 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,"$&̲"),u;s>15?u="…"+a.slice(s-15,s):u=a.slice(0,s);var d;i+15<a.length?d=a.slice(i,i+15)+"…":d=a.slice(i),r+=u+l+d}super(r),this.name="ParseError",this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,xt.prototype),this.position=s,s!=null&&i!=null&&(this.length=i-s),this.rawMessage=t}}var Qve=/([A-Z])/g,Jve=e=>e.replace(Qve,"-$1").toLowerCase(),Zve={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},exe=/[&><"']/g,vo=e=>String(e).replace(exe,t=>Zve[t]),Lk=e=>e.type==="ordgroup"||e.type==="color"?e.body.length===1?Lk(e.body[0]):e:e.type==="font"?Lk(e.body):e,txe=new Set(["mathord","textord","atom"]),xd=e=>txe.has(Lk(e).type),nxe=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"},J2={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 rxe(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 sxe(e){if(e.default!==void 0)return e.default;var t=Array.isArray(e.type)?e.type[0]:e.type;return rxe(t)}function ixe(e,t,n,r){var s=n[t];e[t]=s!==void 0?r.processor?r.processor(s):s:sxe(r)}class dM{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(J2)){var r=J2[n];r&&ixe(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 xt("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=nxe(t.url);if(n==null)return!1;t.protocol=n}var r=typeof this.trust=="function"?this.trust(t):this.trust;return!!r}}let Yd=class{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 Ic[oxe[this.id]]}sub(){return Ic[axe[this.id]]}fracNum(){return Ic[lxe[this.id]]}fracDen(){return Ic[cxe[this.id]]}cramp(){return Ic[uxe[this.id]]}text(){return Ic[dxe[this.id]]}isTight(){return this.size>=2}};var hM=0,Z2=1,F0=2,Yu=3,Ly=4,Nl=5,mg=6,Ho=7,Ic=[new Yd(hM,0,!1),new Yd(Z2,0,!0),new Yd(F0,1,!1),new Yd(Yu,1,!0),new Yd(Ly,2,!1),new Yd(Nl,2,!0),new Yd(mg,3,!1),new Yd(Ho,3,!0)],oxe=[Ly,Nl,Ly,Nl,mg,Ho,mg,Ho],axe=[Nl,Nl,Nl,Nl,Ho,Ho,Ho,Ho],lxe=[F0,Yu,Ly,Nl,mg,Ho,mg,Ho],cxe=[Yu,Yu,Nl,Nl,Ho,Ho,Ho,Ho],uxe=[Z2,Z2,Yu,Yu,Nl,Nl,Ho,Ho],dxe=[hM,Z2,F0,Yu,F0,Yu,F0,Yu],Kn={DISPLAY:Ic[hM],TEXT:Ic[F0],SCRIPT:Ic[Ly],SCRIPTSCRIPT:Ic[mg]},a7=[{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 hxe(e){for(var t=0;t<a7.length;t++)for(var n=a7[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 Pk=[];a7.forEach(e=>e.blocks.forEach(t=>Pk.push(...t)));function KG(e){for(var t=0;t<Pk.length;t+=2)if(e>=Pk[t]&&e<=Pk[t+1])return!0;return!1}var _i=e=>e+" "+e,Fp=80,fxe=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"},mxe=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"},pxe=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"},gxe=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"},bxe=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"},yxe=function(t){var n=t/2;return"M400000 "+t+" H0 L"+n+" 0 l65 45 L145 "+(t-80)+" H400000z"},vxe=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"},xxe=function(t,n,r){n=1e3*n;var s="";switch(t){case"sqrtMain":s=fxe(n,Fp);break;case"sqrtSize1":s=mxe(n,Fp);break;case"sqrtSize2":s=pxe(n,Fp);break;case"sqrtSize3":s=gxe(n,Fp);break;case"sqrtSize4":s=bxe(n,Fp);break;case"sqrtTall":s=vxe(n,Fp,r)}return s},wxe=function(t,n){switch(t){case"⎜":return _i("M291 0 H417 V"+n+" H291z");case"∣":return _i("M145 0 H188 V"+n+" H145z");case"∥":return _i("M145 0 H188 V"+n+" H145z")+_i("M367 0 H410 V"+n+" H367z");case"⎟":return _i("M457 0 H583 V"+n+" H457z");case"⎢":return _i("M319 0 H403 V"+n+" H319z");case"⎥":return _i("M263 0 H347 V"+n+" H263z");case"⎪":return _i("M384 0 H504 V"+n+" H384z");case"⏐":return _i("M312 0 H355 V"+n+" H312z");case"‖":return _i("M257 0 H300 V"+n+" H257z")+_i("M478 0 H521 V"+n+" H478z");default:return""}},fP={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:_i("M40 281 V428 H0 V94 H40 V241 H400000 v40z"),leftbracketunder:_i("M0 0 h120 V290 H399995 v120 H0z"),leftbracketover:_i("M0 440 h120 V150 H399995 v-120 H0z"),leftmapsto:_i("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:_i("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:_i("M399960 241 V94 h40 V428 h-40 V281 H0 v-40z"),rightbracketunder:_i("M399995 0 h-120 V290 H0 v120 H400000z"),rightbracketover:_i("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`},kxe=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 _xe(e){return"toText"in e}let Gg=class{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(_xe(t))return t.toText();throw new Error("Expected MathDomNode with toText, got "+t.constructor.name)}).join("")}};var l7={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},Sxe={ex:!0,em:!0,mu:!0},YG=function(t){return typeof t!="string"&&(t=t.unit),t in l7||t in Sxe||t==="ex"},Ks=function(t,n){var r;if(t.unit in l7)r=l7[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 xt("Invalid unit: '"+t.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(t.number*r,n.maxSize)},Rt=function(t){return+t.toFixed(4)+"em"},Yh=function(t){return t.filter(n=>n).join(" ")},fM=function(t){var n="";for(var r of Object.keys(t)){var s=t[r];s!==void 0&&(n+=Jve(r)+":"+s+";")}return n},XG=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)}},QG=function(t){var n=document.createElement(t);n.className=Yh(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},Cxe=/[\s"'>/=\x00-\x1f]/,JG=function(t){var n="<"+t;this.classes.length&&(n+=' class="'+vo(Yh(this.classes))+'"');var r=fM(this.style);r&&(n+=' style="'+vo(r)+'"');for(var s of Object.keys(this.attributes)){if(Cxe.test(s))throw new xt("Invalid attribute name '"+s+"'");n+=" "+s+'="'+vo(this.attributes[s])+'"'}n+=">";for(var i=0;i<this.children.length;i++)n+=this.children[i].toMarkup();return n+="</"+t+">",n};class Kg{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,XG.call(this,t,r,s),this.children=n||[]}setAttribute(t,n){this.attributes[t]=n}hasClass(t){return this.classes.includes(t)}toNode(){return QG.call(this,"span")}toMarkup(){return JG.call(this,"span")}}let rS=class{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,XG.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 QG.call(this,"a")}toMarkup(){return JG.call(this,"a")}};class Txe{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="'+vo(this.src)+'"'+(' alt="'+vo(this.alt)+'"'),n=fM(this.style);return n&&(t+=' style="'+vo(n)+'"'),t+="'/>",t}}var Axe={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class rl{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 u=hxe(this.text.charCodeAt(0));u&&this.classes.push(u+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Axe[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=Rt(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Yh(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+=vo(Yh(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+Rt(this.italic)+";"),r+=fM(this.style),r&&(t=!0,n+=' style="'+vo(r)+'"');var s=vo(this.text);return t?(n+=">",n+=s,n+="</span>",n):s}}class cd{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+'="'+vo(this.attributes[n])+'"';t+=">";for(var r=0;r<this.children.length;r++)t+=this.children[r].toMarkup();return t+="</svg>",t}}class Xh{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",fP[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+vo(this.alternate)+'"/>':'<path d="'+vo(fP[this.pathName])+'"/>'}}class c7{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+'="'+vo(this.attributes[n])+'"';return t+="/>",t}}function Exe(e){if(e instanceof rl)return e;throw new Error("Expected symbolNode but got "+String(e)+".")}function Mxe(e){if(e instanceof Kg)return e;throw new Error("Expected span<HtmlDomNode> but got "+String(e)+".")}var Nxe=e=>e instanceof Kg||e instanceof rS||e instanceof Gg,qc={"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]}},nw={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]},mP={Å:"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 ZG(e,t){qc[e]=t}function mM(e,t,n){if(!qc[t])throw new Error("Font metrics not found for font: "+t+".");var r=e.charCodeAt(0),s=qc[t][r];if(!s&&e[0]in mP&&(r=mP[e[0]].charCodeAt(0),s=qc[t][r]),!s&&n==="text"&&KG(r)&&(s=qc[t][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var N5={};function jxe(e){var t;if(e>=5?t=0:e>=3?t=1:t=2,!N5[t]){var n=N5[t]={cssEmPerMu:nw.quad[t]/18};for(var r in nw)nw.hasOwnProperty(r)&&(n[r]=nw[r][t])}return N5[t]}var zs={math:{},text:{}};function E(e,t,n,r,s,i){zs[e][s]={font:t,group:n,replace:r},i&&r&&(zs[e][r]=zs[e][s])}var R="math",ct="text",z="main",le="ams",qs="accent-token",un="bin",Wo="close",Yg="inner",In="mathord",vi="op-token",ol="open",Pv="punct",ue="rel",wd="spacing",pe="textord";E(R,z,ue,"≡","\\equiv",!0);E(R,z,ue,"≺","\\prec",!0);E(R,z,ue,"≻","\\succ",!0);E(R,z,ue,"∼","\\sim",!0);E(R,z,ue,"⊥","\\perp");E(R,z,ue,"⪯","\\preceq",!0);E(R,z,ue,"⪰","\\succeq",!0);E(R,z,ue,"≃","\\simeq",!0);E(R,z,ue,"∣","\\mid",!0);E(R,z,ue,"≪","\\ll",!0);E(R,z,ue,"≫","\\gg",!0);E(R,z,ue,"≍","\\asymp",!0);E(R,z,ue,"∥","\\parallel");E(R,z,ue,"⋈","\\bowtie",!0);E(R,z,ue,"⌣","\\smile",!0);E(R,z,ue,"⊑","\\sqsubseteq",!0);E(R,z,ue,"⊒","\\sqsupseteq",!0);E(R,z,ue,"≐","\\doteq",!0);E(R,z,ue,"⌢","\\frown",!0);E(R,z,ue,"∋","\\ni",!0);E(R,z,ue,"∝","\\propto",!0);E(R,z,ue,"⊢","\\vdash",!0);E(R,z,ue,"⊣","\\dashv",!0);E(R,z,ue,"∋","\\owns");E(R,z,Pv,".","\\ldotp");E(R,z,Pv,"⋅","\\cdotp");E(R,z,Pv,"⋅","·");E(ct,z,pe,"⋅","·");E(R,z,pe,"#","\\#");E(ct,z,pe,"#","\\#");E(R,z,pe,"&","\\&");E(ct,z,pe,"&","\\&");E(R,z,pe,"ℵ","\\aleph",!0);E(R,z,pe,"∀","\\forall",!0);E(R,z,pe,"ℏ","\\hbar",!0);E(R,z,pe,"∃","\\exists",!0);E(R,z,pe,"∇","\\nabla",!0);E(R,z,pe,"♭","\\flat",!0);E(R,z,pe,"ℓ","\\ell",!0);E(R,z,pe,"♮","\\natural",!0);E(R,z,pe,"♣","\\clubsuit",!0);E(R,z,pe,"℘","\\wp",!0);E(R,z,pe,"♯","\\sharp",!0);E(R,z,pe,"♢","\\diamondsuit",!0);E(R,z,pe,"ℜ","\\Re",!0);E(R,z,pe,"♡","\\heartsuit",!0);E(R,z,pe,"ℑ","\\Im",!0);E(R,z,pe,"♠","\\spadesuit",!0);E(R,z,pe,"§","\\S",!0);E(ct,z,pe,"§","\\S");E(R,z,pe,"¶","\\P",!0);E(ct,z,pe,"¶","\\P");E(R,z,pe,"†","\\dag");E(ct,z,pe,"†","\\dag");E(ct,z,pe,"†","\\textdagger");E(R,z,pe,"‡","\\ddag");E(ct,z,pe,"‡","\\ddag");E(ct,z,pe,"‡","\\textdaggerdbl");E(R,z,Wo,"⎱","\\rmoustache",!0);E(R,z,ol,"⎰","\\lmoustache",!0);E(R,z,Wo,"⟯","\\rgroup",!0);E(R,z,ol,"⟮","\\lgroup",!0);E(R,z,un,"∓","\\mp",!0);E(R,z,un,"⊖","\\ominus",!0);E(R,z,un,"⊎","\\uplus",!0);E(R,z,un,"⊓","\\sqcap",!0);E(R,z,un,"∗","\\ast");E(R,z,un,"⊔","\\sqcup",!0);E(R,z,un,"◯","\\bigcirc",!0);E(R,z,un,"∙","\\bullet",!0);E(R,z,un,"‡","\\ddagger");E(R,z,un,"≀","\\wr",!0);E(R,z,un,"⨿","\\amalg");E(R,z,un,"&","\\And");E(R,z,ue,"⟵","\\longleftarrow",!0);E(R,z,ue,"⇐","\\Leftarrow",!0);E(R,z,ue,"⟸","\\Longleftarrow",!0);E(R,z,ue,"⟶","\\longrightarrow",!0);E(R,z,ue,"⇒","\\Rightarrow",!0);E(R,z,ue,"⟹","\\Longrightarrow",!0);E(R,z,ue,"↔","\\leftrightarrow",!0);E(R,z,ue,"⟷","\\longleftrightarrow",!0);E(R,z,ue,"⇔","\\Leftrightarrow",!0);E(R,z,ue,"⟺","\\Longleftrightarrow",!0);E(R,z,ue,"↦","\\mapsto",!0);E(R,z,ue,"⟼","\\longmapsto",!0);E(R,z,ue,"↗","\\nearrow",!0);E(R,z,ue,"↩","\\hookleftarrow",!0);E(R,z,ue,"↪","\\hookrightarrow",!0);E(R,z,ue,"↘","\\searrow",!0);E(R,z,ue,"↼","\\leftharpoonup",!0);E(R,z,ue,"⇀","\\rightharpoonup",!0);E(R,z,ue,"↙","\\swarrow",!0);E(R,z,ue,"↽","\\leftharpoondown",!0);E(R,z,ue,"⇁","\\rightharpoondown",!0);E(R,z,ue,"↖","\\nwarrow",!0);E(R,z,ue,"⇌","\\rightleftharpoons",!0);E(R,le,ue,"≮","\\nless",!0);E(R,le,ue,"","\\@nleqslant");E(R,le,ue,"","\\@nleqq");E(R,le,ue,"⪇","\\lneq",!0);E(R,le,ue,"≨","\\lneqq",!0);E(R,le,ue,"","\\@lvertneqq");E(R,le,ue,"⋦","\\lnsim",!0);E(R,le,ue,"⪉","\\lnapprox",!0);E(R,le,ue,"⊀","\\nprec",!0);E(R,le,ue,"⋠","\\npreceq",!0);E(R,le,ue,"⋨","\\precnsim",!0);E(R,le,ue,"⪹","\\precnapprox",!0);E(R,le,ue,"≁","\\nsim",!0);E(R,le,ue,"","\\@nshortmid");E(R,le,ue,"∤","\\nmid",!0);E(R,le,ue,"⊬","\\nvdash",!0);E(R,le,ue,"⊭","\\nvDash",!0);E(R,le,ue,"⋪","\\ntriangleleft");E(R,le,ue,"⋬","\\ntrianglelefteq",!0);E(R,le,ue,"⊊","\\subsetneq",!0);E(R,le,ue,"","\\@varsubsetneq");E(R,le,ue,"⫋","\\subsetneqq",!0);E(R,le,ue,"","\\@varsubsetneqq");E(R,le,ue,"≯","\\ngtr",!0);E(R,le,ue,"","\\@ngeqslant");E(R,le,ue,"","\\@ngeqq");E(R,le,ue,"⪈","\\gneq",!0);E(R,le,ue,"≩","\\gneqq",!0);E(R,le,ue,"","\\@gvertneqq");E(R,le,ue,"⋧","\\gnsim",!0);E(R,le,ue,"⪊","\\gnapprox",!0);E(R,le,ue,"⊁","\\nsucc",!0);E(R,le,ue,"⋡","\\nsucceq",!0);E(R,le,ue,"⋩","\\succnsim",!0);E(R,le,ue,"⪺","\\succnapprox",!0);E(R,le,ue,"≆","\\ncong",!0);E(R,le,ue,"","\\@nshortparallel");E(R,le,ue,"∦","\\nparallel",!0);E(R,le,ue,"⊯","\\nVDash",!0);E(R,le,ue,"⋫","\\ntriangleright");E(R,le,ue,"⋭","\\ntrianglerighteq",!0);E(R,le,ue,"","\\@nsupseteqq");E(R,le,ue,"⊋","\\supsetneq",!0);E(R,le,ue,"","\\@varsupsetneq");E(R,le,ue,"⫌","\\supsetneqq",!0);E(R,le,ue,"","\\@varsupsetneqq");E(R,le,ue,"⊮","\\nVdash",!0);E(R,le,ue,"⪵","\\precneqq",!0);E(R,le,ue,"⪶","\\succneqq",!0);E(R,le,ue,"","\\@nsubseteqq");E(R,le,un,"⊴","\\unlhd");E(R,le,un,"⊵","\\unrhd");E(R,le,ue,"↚","\\nleftarrow",!0);E(R,le,ue,"↛","\\nrightarrow",!0);E(R,le,ue,"⇍","\\nLeftarrow",!0);E(R,le,ue,"⇏","\\nRightarrow",!0);E(R,le,ue,"↮","\\nleftrightarrow",!0);E(R,le,ue,"⇎","\\nLeftrightarrow",!0);E(R,le,ue,"△","\\vartriangle");E(R,le,pe,"ℏ","\\hslash");E(R,le,pe,"▽","\\triangledown");E(R,le,pe,"◊","\\lozenge");E(R,le,pe,"Ⓢ","\\circledS");E(R,le,pe,"®","\\circledR");E(ct,le,pe,"®","\\circledR");E(R,le,pe,"∡","\\measuredangle",!0);E(R,le,pe,"∄","\\nexists");E(R,le,pe,"℧","\\mho");E(R,le,pe,"Ⅎ","\\Finv",!0);E(R,le,pe,"⅁","\\Game",!0);E(R,le,pe,"‵","\\backprime");E(R,le,pe,"▲","\\blacktriangle");E(R,le,pe,"▼","\\blacktriangledown");E(R,le,pe,"■","\\blacksquare");E(R,le,pe,"⧫","\\blacklozenge");E(R,le,pe,"★","\\bigstar");E(R,le,pe,"∢","\\sphericalangle",!0);E(R,le,pe,"∁","\\complement",!0);E(R,le,pe,"ð","\\eth",!0);E(ct,z,pe,"ð","ð");E(R,le,pe,"╱","\\diagup");E(R,le,pe,"╲","\\diagdown");E(R,le,pe,"□","\\square");E(R,le,pe,"□","\\Box");E(R,le,pe,"◊","\\Diamond");E(R,le,pe,"¥","\\yen",!0);E(ct,le,pe,"¥","\\yen",!0);E(R,le,pe,"✓","\\checkmark",!0);E(ct,le,pe,"✓","\\checkmark");E(R,le,pe,"ℶ","\\beth",!0);E(R,le,pe,"ℸ","\\daleth",!0);E(R,le,pe,"ℷ","\\gimel",!0);E(R,le,pe,"ϝ","\\digamma",!0);E(R,le,pe,"ϰ","\\varkappa");E(R,le,ol,"┌","\\@ulcorner",!0);E(R,le,Wo,"┐","\\@urcorner",!0);E(R,le,ol,"└","\\@llcorner",!0);E(R,le,Wo,"┘","\\@lrcorner",!0);E(R,le,ue,"≦","\\leqq",!0);E(R,le,ue,"⩽","\\leqslant",!0);E(R,le,ue,"⪕","\\eqslantless",!0);E(R,le,ue,"≲","\\lesssim",!0);E(R,le,ue,"⪅","\\lessapprox",!0);E(R,le,ue,"≊","\\approxeq",!0);E(R,le,un,"⋖","\\lessdot");E(R,le,ue,"⋘","\\lll",!0);E(R,le,ue,"≶","\\lessgtr",!0);E(R,le,ue,"⋚","\\lesseqgtr",!0);E(R,le,ue,"⪋","\\lesseqqgtr",!0);E(R,le,ue,"≑","\\doteqdot");E(R,le,ue,"≓","\\risingdotseq",!0);E(R,le,ue,"≒","\\fallingdotseq",!0);E(R,le,ue,"∽","\\backsim",!0);E(R,le,ue,"⋍","\\backsimeq",!0);E(R,le,ue,"⫅","\\subseteqq",!0);E(R,le,ue,"⋐","\\Subset",!0);E(R,le,ue,"⊏","\\sqsubset",!0);E(R,le,ue,"≼","\\preccurlyeq",!0);E(R,le,ue,"⋞","\\curlyeqprec",!0);E(R,le,ue,"≾","\\precsim",!0);E(R,le,ue,"⪷","\\precapprox",!0);E(R,le,ue,"⊲","\\vartriangleleft");E(R,le,ue,"⊴","\\trianglelefteq");E(R,le,ue,"⊨","\\vDash",!0);E(R,le,ue,"⊪","\\Vvdash",!0);E(R,le,ue,"⌣","\\smallsmile");E(R,le,ue,"⌢","\\smallfrown");E(R,le,ue,"≏","\\bumpeq",!0);E(R,le,ue,"≎","\\Bumpeq",!0);E(R,le,ue,"≧","\\geqq",!0);E(R,le,ue,"⩾","\\geqslant",!0);E(R,le,ue,"⪖","\\eqslantgtr",!0);E(R,le,ue,"≳","\\gtrsim",!0);E(R,le,ue,"⪆","\\gtrapprox",!0);E(R,le,un,"⋗","\\gtrdot");E(R,le,ue,"⋙","\\ggg",!0);E(R,le,ue,"≷","\\gtrless",!0);E(R,le,ue,"⋛","\\gtreqless",!0);E(R,le,ue,"⪌","\\gtreqqless",!0);E(R,le,ue,"≖","\\eqcirc",!0);E(R,le,ue,"≗","\\circeq",!0);E(R,le,ue,"≜","\\triangleq",!0);E(R,le,ue,"∼","\\thicksim");E(R,le,ue,"≈","\\thickapprox");E(R,le,ue,"⫆","\\supseteqq",!0);E(R,le,ue,"⋑","\\Supset",!0);E(R,le,ue,"⊐","\\sqsupset",!0);E(R,le,ue,"≽","\\succcurlyeq",!0);E(R,le,ue,"⋟","\\curlyeqsucc",!0);E(R,le,ue,"≿","\\succsim",!0);E(R,le,ue,"⪸","\\succapprox",!0);E(R,le,ue,"⊳","\\vartriangleright");E(R,le,ue,"⊵","\\trianglerighteq");E(R,le,ue,"⊩","\\Vdash",!0);E(R,le,ue,"∣","\\shortmid");E(R,le,ue,"∥","\\shortparallel");E(R,le,ue,"≬","\\between",!0);E(R,le,ue,"⋔","\\pitchfork",!0);E(R,le,ue,"∝","\\varpropto");E(R,le,ue,"◀","\\blacktriangleleft");E(R,le,ue,"∴","\\therefore",!0);E(R,le,ue,"∍","\\backepsilon");E(R,le,ue,"▶","\\blacktriangleright");E(R,le,ue,"∵","\\because",!0);E(R,le,ue,"⋘","\\llless");E(R,le,ue,"⋙","\\gggtr");E(R,le,un,"⊲","\\lhd");E(R,le,un,"⊳","\\rhd");E(R,le,ue,"≂","\\eqsim",!0);E(R,z,ue,"⋈","\\Join");E(R,le,ue,"≑","\\Doteq",!0);E(R,le,un,"∔","\\dotplus",!0);E(R,le,un,"∖","\\smallsetminus");E(R,le,un,"⋒","\\Cap",!0);E(R,le,un,"⋓","\\Cup",!0);E(R,le,un,"⩞","\\doublebarwedge",!0);E(R,le,un,"⊟","\\boxminus",!0);E(R,le,un,"⊞","\\boxplus",!0);E(R,le,un,"⋇","\\divideontimes",!0);E(R,le,un,"⋉","\\ltimes",!0);E(R,le,un,"⋊","\\rtimes",!0);E(R,le,un,"⋋","\\leftthreetimes",!0);E(R,le,un,"⋌","\\rightthreetimes",!0);E(R,le,un,"⋏","\\curlywedge",!0);E(R,le,un,"⋎","\\curlyvee",!0);E(R,le,un,"⊝","\\circleddash",!0);E(R,le,un,"⊛","\\circledast",!0);E(R,le,un,"⋅","\\centerdot");E(R,le,un,"⊺","\\intercal",!0);E(R,le,un,"⋒","\\doublecap");E(R,le,un,"⋓","\\doublecup");E(R,le,un,"⊠","\\boxtimes",!0);E(R,le,ue,"⇢","\\dashrightarrow",!0);E(R,le,ue,"⇠","\\dashleftarrow",!0);E(R,le,ue,"⇇","\\leftleftarrows",!0);E(R,le,ue,"⇆","\\leftrightarrows",!0);E(R,le,ue,"⇚","\\Lleftarrow",!0);E(R,le,ue,"↞","\\twoheadleftarrow",!0);E(R,le,ue,"↢","\\leftarrowtail",!0);E(R,le,ue,"↫","\\looparrowleft",!0);E(R,le,ue,"⇋","\\leftrightharpoons",!0);E(R,le,ue,"↶","\\curvearrowleft",!0);E(R,le,ue,"↺","\\circlearrowleft",!0);E(R,le,ue,"↰","\\Lsh",!0);E(R,le,ue,"⇈","\\upuparrows",!0);E(R,le,ue,"↿","\\upharpoonleft",!0);E(R,le,ue,"⇃","\\downharpoonleft",!0);E(R,z,ue,"⊶","\\origof",!0);E(R,z,ue,"⊷","\\imageof",!0);E(R,le,ue,"⊸","\\multimap",!0);E(R,le,ue,"↭","\\leftrightsquigarrow",!0);E(R,le,ue,"⇉","\\rightrightarrows",!0);E(R,le,ue,"⇄","\\rightleftarrows",!0);E(R,le,ue,"↠","\\twoheadrightarrow",!0);E(R,le,ue,"↣","\\rightarrowtail",!0);E(R,le,ue,"↬","\\looparrowright",!0);E(R,le,ue,"↷","\\curvearrowright",!0);E(R,le,ue,"↻","\\circlearrowright",!0);E(R,le,ue,"↱","\\Rsh",!0);E(R,le,ue,"⇊","\\downdownarrows",!0);E(R,le,ue,"↾","\\upharpoonright",!0);E(R,le,ue,"⇂","\\downharpoonright",!0);E(R,le,ue,"⇝","\\rightsquigarrow",!0);E(R,le,ue,"⇝","\\leadsto");E(R,le,ue,"⇛","\\Rrightarrow",!0);E(R,le,ue,"↾","\\restriction");E(R,z,pe,"‘","`");E(R,z,pe,"$","\\$");E(ct,z,pe,"$","\\$");E(ct,z,pe,"$","\\textdollar");E(R,z,pe,"%","\\%");E(ct,z,pe,"%","\\%");E(R,z,pe,"_","\\_");E(ct,z,pe,"_","\\_");E(ct,z,pe,"_","\\textunderscore");E(R,z,pe,"∠","\\angle",!0);E(R,z,pe,"∞","\\infty",!0);E(R,z,pe,"′","\\prime");E(R,z,pe,"△","\\triangle");E(R,z,pe,"Γ","\\Gamma",!0);E(R,z,pe,"Δ","\\Delta",!0);E(R,z,pe,"Θ","\\Theta",!0);E(R,z,pe,"Λ","\\Lambda",!0);E(R,z,pe,"Ξ","\\Xi",!0);E(R,z,pe,"Π","\\Pi",!0);E(R,z,pe,"Σ","\\Sigma",!0);E(R,z,pe,"Υ","\\Upsilon",!0);E(R,z,pe,"Φ","\\Phi",!0);E(R,z,pe,"Ψ","\\Psi",!0);E(R,z,pe,"Ω","\\Omega",!0);E(R,z,pe,"A","Α");E(R,z,pe,"B","Β");E(R,z,pe,"E","Ε");E(R,z,pe,"Z","Ζ");E(R,z,pe,"H","Η");E(R,z,pe,"I","Ι");E(R,z,pe,"K","Κ");E(R,z,pe,"M","Μ");E(R,z,pe,"N","Ν");E(R,z,pe,"O","Ο");E(R,z,pe,"P","Ρ");E(R,z,pe,"T","Τ");E(R,z,pe,"X","Χ");E(R,z,pe,"¬","\\neg",!0);E(R,z,pe,"¬","\\lnot");E(R,z,pe,"⊤","\\top");E(R,z,pe,"⊥","\\bot");E(R,z,pe,"∅","\\emptyset");E(R,le,pe,"∅","\\varnothing");E(R,z,In,"α","\\alpha",!0);E(R,z,In,"β","\\beta",!0);E(R,z,In,"γ","\\gamma",!0);E(R,z,In,"δ","\\delta",!0);E(R,z,In,"ϵ","\\epsilon",!0);E(R,z,In,"ζ","\\zeta",!0);E(R,z,In,"η","\\eta",!0);E(R,z,In,"θ","\\theta",!0);E(R,z,In,"ι","\\iota",!0);E(R,z,In,"κ","\\kappa",!0);E(R,z,In,"λ","\\lambda",!0);E(R,z,In,"μ","\\mu",!0);E(R,z,In,"ν","\\nu",!0);E(R,z,In,"ξ","\\xi",!0);E(R,z,In,"ο","\\omicron",!0);E(R,z,In,"π","\\pi",!0);E(R,z,In,"ρ","\\rho",!0);E(R,z,In,"σ","\\sigma",!0);E(R,z,In,"τ","\\tau",!0);E(R,z,In,"υ","\\upsilon",!0);E(R,z,In,"ϕ","\\phi",!0);E(R,z,In,"χ","\\chi",!0);E(R,z,In,"ψ","\\psi",!0);E(R,z,In,"ω","\\omega",!0);E(R,z,In,"ε","\\varepsilon",!0);E(R,z,In,"ϑ","\\vartheta",!0);E(R,z,In,"ϖ","\\varpi",!0);E(R,z,In,"ϱ","\\varrho",!0);E(R,z,In,"ς","\\varsigma",!0);E(R,z,In,"φ","\\varphi",!0);E(R,z,un,"∗","*",!0);E(R,z,un,"+","+");E(R,z,un,"−","-",!0);E(R,z,un,"⋅","\\cdot",!0);E(R,z,un,"∘","\\circ",!0);E(R,z,un,"÷","\\div",!0);E(R,z,un,"±","\\pm",!0);E(R,z,un,"×","\\times",!0);E(R,z,un,"∩","\\cap",!0);E(R,z,un,"∪","\\cup",!0);E(R,z,un,"∖","\\setminus",!0);E(R,z,un,"∧","\\land");E(R,z,un,"∨","\\lor");E(R,z,un,"∧","\\wedge",!0);E(R,z,un,"∨","\\vee",!0);E(R,z,pe,"√","\\surd");E(R,z,ol,"⟨","\\langle",!0);E(R,z,ol,"∣","\\lvert");E(R,z,ol,"∥","\\lVert");E(R,z,Wo,"?","?");E(R,z,Wo,"!","!");E(R,z,Wo,"⟩","\\rangle",!0);E(R,z,Wo,"∣","\\rvert");E(R,z,Wo,"∥","\\rVert");E(R,z,ue,"=","=");E(R,z,ue,":",":");E(R,z,ue,"≈","\\approx",!0);E(R,z,ue,"≅","\\cong",!0);E(R,z,ue,"≥","\\ge");E(R,z,ue,"≥","\\geq",!0);E(R,z,ue,"←","\\gets");E(R,z,ue,">","\\gt",!0);E(R,z,ue,"∈","\\in",!0);E(R,z,ue,"","\\@not");E(R,z,ue,"⊂","\\subset",!0);E(R,z,ue,"⊃","\\supset",!0);E(R,z,ue,"⊆","\\subseteq",!0);E(R,z,ue,"⊇","\\supseteq",!0);E(R,le,ue,"⊈","\\nsubseteq",!0);E(R,le,ue,"⊉","\\nsupseteq",!0);E(R,z,ue,"⊨","\\models");E(R,z,ue,"←","\\leftarrow",!0);E(R,z,ue,"≤","\\le");E(R,z,ue,"≤","\\leq",!0);E(R,z,ue,"<","\\lt",!0);E(R,z,ue,"→","\\rightarrow",!0);E(R,z,ue,"→","\\to");E(R,le,ue,"≱","\\ngeq",!0);E(R,le,ue,"≰","\\nleq",!0);E(R,z,wd," ","\\ ");E(R,z,wd," ","\\space");E(R,z,wd," ","\\nobreakspace");E(ct,z,wd," ","\\ ");E(ct,z,wd," "," ");E(ct,z,wd," ","\\space");E(ct,z,wd," ","\\nobreakspace");E(R,z,wd,"","\\nobreak");E(R,z,wd,"","\\allowbreak");E(R,z,Pv,",",",");E(R,z,Pv,";",";");E(R,le,un,"⊼","\\barwedge",!0);E(R,le,un,"⊻","\\veebar",!0);E(R,z,un,"⊙","\\odot",!0);E(R,z,un,"⊕","\\oplus",!0);E(R,z,un,"⊗","\\otimes",!0);E(R,z,pe,"∂","\\partial",!0);E(R,z,un,"⊘","\\oslash",!0);E(R,le,un,"⊚","\\circledcirc",!0);E(R,le,un,"⊡","\\boxdot",!0);E(R,z,un,"△","\\bigtriangleup");E(R,z,un,"▽","\\bigtriangledown");E(R,z,un,"†","\\dagger");E(R,z,un,"⋄","\\diamond");E(R,z,un,"⋆","\\star");E(R,z,un,"◃","\\triangleleft");E(R,z,un,"▹","\\triangleright");E(R,z,ol,"{","\\{");E(ct,z,pe,"{","\\{");E(ct,z,pe,"{","\\textbraceleft");E(R,z,Wo,"}","\\}");E(ct,z,pe,"}","\\}");E(ct,z,pe,"}","\\textbraceright");E(R,z,ol,"{","\\lbrace");E(R,z,Wo,"}","\\rbrace");E(R,z,ol,"[","\\lbrack",!0);E(ct,z,pe,"[","\\lbrack",!0);E(R,z,Wo,"]","\\rbrack",!0);E(ct,z,pe,"]","\\rbrack",!0);E(R,z,ol,"(","\\lparen",!0);E(R,z,Wo,")","\\rparen",!0);E(ct,z,pe,"<","\\textless",!0);E(ct,z,pe,">","\\textgreater",!0);E(R,z,ol,"⌊","\\lfloor",!0);E(R,z,Wo,"⌋","\\rfloor",!0);E(R,z,ol,"⌈","\\lceil",!0);E(R,z,Wo,"⌉","\\rceil",!0);E(R,z,pe,"\\","\\backslash");E(R,z,pe,"∣","|");E(R,z,pe,"∣","\\vert");E(ct,z,pe,"|","\\textbar",!0);E(R,z,pe,"∥","\\|");E(R,z,pe,"∥","\\Vert");E(ct,z,pe,"∥","\\textbardbl");E(ct,z,pe,"~","\\textasciitilde");E(ct,z,pe,"\\","\\textbackslash");E(ct,z,pe,"^","\\textasciicircum");E(R,z,ue,"↑","\\uparrow",!0);E(R,z,ue,"⇑","\\Uparrow",!0);E(R,z,ue,"↓","\\downarrow",!0);E(R,z,ue,"⇓","\\Downarrow",!0);E(R,z,ue,"↕","\\updownarrow",!0);E(R,z,ue,"⇕","\\Updownarrow",!0);E(R,z,vi,"∐","\\coprod");E(R,z,vi,"⋁","\\bigvee");E(R,z,vi,"⋀","\\bigwedge");E(R,z,vi,"⨄","\\biguplus");E(R,z,vi,"⋂","\\bigcap");E(R,z,vi,"⋃","\\bigcup");E(R,z,vi,"∫","\\int");E(R,z,vi,"∫","\\intop");E(R,z,vi,"∬","\\iint");E(R,z,vi,"∭","\\iiint");E(R,z,vi,"∏","\\prod");E(R,z,vi,"∑","\\sum");E(R,z,vi,"⨂","\\bigotimes");E(R,z,vi,"⨁","\\bigoplus");E(R,z,vi,"⨀","\\bigodot");E(R,z,vi,"∮","\\oint");E(R,z,vi,"∯","\\oiint");E(R,z,vi,"∰","\\oiiint");E(R,z,vi,"⨆","\\bigsqcup");E(R,z,vi,"∫","\\smallint");E(ct,z,Yg,"…","\\textellipsis");E(R,z,Yg,"…","\\mathellipsis");E(ct,z,Yg,"…","\\ldots",!0);E(R,z,Yg,"…","\\ldots",!0);E(R,z,Yg,"⋯","\\@cdots",!0);E(R,z,Yg,"⋱","\\ddots",!0);E(R,z,pe,"⋮","\\varvdots");E(ct,z,pe,"⋮","\\varvdots");E(R,z,qs,"ˊ","\\acute");E(R,z,qs,"ˋ","\\grave");E(R,z,qs,"¨","\\ddot");E(R,z,qs,"~","\\tilde");E(R,z,qs,"ˉ","\\bar");E(R,z,qs,"˘","\\breve");E(R,z,qs,"ˇ","\\check");E(R,z,qs,"^","\\hat");E(R,z,qs,"⃗","\\vec");E(R,z,qs,"˙","\\dot");E(R,z,qs,"˚","\\mathring");E(R,z,In,"","\\@imath");E(R,z,In,"","\\@jmath");E(R,z,pe,"ı","ı");E(R,z,pe,"ȷ","ȷ");E(ct,z,pe,"ı","\\i",!0);E(ct,z,pe,"ȷ","\\j",!0);E(ct,z,pe,"ß","\\ss",!0);E(ct,z,pe,"æ","\\ae",!0);E(ct,z,pe,"œ","\\oe",!0);E(ct,z,pe,"ø","\\o",!0);E(ct,z,pe,"Æ","\\AE",!0);E(ct,z,pe,"Œ","\\OE",!0);E(ct,z,pe,"Ø","\\O",!0);E(ct,z,qs,"ˊ","\\'");E(ct,z,qs,"ˋ","\\`");E(ct,z,qs,"ˆ","\\^");E(ct,z,qs,"˜","\\~");E(ct,z,qs,"ˉ","\\=");E(ct,z,qs,"˘","\\u");E(ct,z,qs,"˙","\\.");E(ct,z,qs,"¸","\\c");E(ct,z,qs,"˚","\\r");E(ct,z,qs,"ˇ","\\v");E(ct,z,qs,"¨",'\\"');E(ct,z,qs,"˝","\\H");E(ct,z,qs,"◯","\\textcircled");var eK={"--":!0,"---":!0,"``":!0,"''":!0};E(ct,z,pe,"–","--",!0);E(ct,z,pe,"–","\\textendash");E(ct,z,pe,"—","---",!0);E(ct,z,pe,"—","\\textemdash");E(ct,z,pe,"‘","`",!0);E(ct,z,pe,"‘","\\textquoteleft");E(ct,z,pe,"’","'",!0);E(ct,z,pe,"’","\\textquoteright");E(ct,z,pe,"“","``",!0);E(ct,z,pe,"“","\\textquotedblleft");E(ct,z,pe,"”","''",!0);E(ct,z,pe,"”","\\textquotedblright");E(R,z,pe,"°","\\degree",!0);E(ct,z,pe,"°","\\degree");E(ct,z,pe,"°","\\textdegree",!0);E(R,z,pe,"£","\\pounds");E(R,z,pe,"£","\\mathsterling",!0);E(ct,z,pe,"£","\\pounds");E(ct,z,pe,"£","\\textsterling",!0);E(R,le,pe,"✠","\\maltese");E(ct,le,pe,"✠","\\maltese");var pP='0123456789/@."';for(var j5=0;j5<pP.length;j5++){var gP=pP.charAt(j5);E(R,z,pe,gP,gP)}var bP='0123456789!@*()-=+";:?/.,';for(var I5=0;I5<bP.length;I5++){var yP=bP.charAt(I5);E(ct,z,pe,yP,yP)}var e_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var R5=0;R5<e_.length;R5++){var rw=e_.charAt(R5);E(R,z,In,rw,rw),E(ct,z,pe,rw,rw)}E(R,le,pe,"C","ℂ");E(ct,le,pe,"C","ℂ");E(R,le,pe,"H","ℍ");E(ct,le,pe,"H","ℍ");E(R,le,pe,"N","ℕ");E(ct,le,pe,"N","ℕ");E(R,le,pe,"P","ℙ");E(ct,le,pe,"P","ℙ");E(R,le,pe,"Q","ℚ");E(ct,le,pe,"Q","ℚ");E(R,le,pe,"R","ℝ");E(ct,le,pe,"R","ℝ");E(R,le,pe,"Z","ℤ");E(ct,le,pe,"Z","ℤ");E(R,z,In,"h","ℎ");E(ct,z,In,"h","ℎ");var Fn;for(var jo=0;jo<e_.length;jo++){var Ys=e_.charAt(jo);Fn=String.fromCharCode(55349,56320+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56372+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56424+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56580+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56684+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56736+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56788+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56840+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56944+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),jo<26&&(Fn=String.fromCharCode(55349,56632+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn),Fn=String.fromCharCode(55349,56476+jo),E(R,z,In,Ys,Fn),E(ct,z,pe,Ys,Fn))}Fn="𝕜";E(R,z,In,"k",Fn);E(ct,z,pe,"k",Fn);for(var Kf=0;Kf<10;Kf++){var Xd=Kf.toString();Fn=String.fromCharCode(55349,57294+Kf),E(R,z,In,Xd,Fn),E(ct,z,pe,Xd,Fn),Fn=String.fromCharCode(55349,57314+Kf),E(R,z,In,Xd,Fn),E(ct,z,pe,Xd,Fn),Fn=String.fromCharCode(55349,57324+Kf),E(R,z,In,Xd,Fn),E(ct,z,pe,Xd,Fn),Fn=String.fromCharCode(55349,57334+Kf),E(R,z,In,Xd,Fn),E(ct,z,pe,Xd,Fn)}var u7="ÐÞþ";for(var D5=0;D5<u7.length;D5++){var sw=u7.charAt(D5);E(R,z,In,sw,sw),E(ct,z,pe,sw,sw)}var d7={mathClass:"mathbf",textClass:"textbf",font:"Main-Bold"},vP={mathClass:"mathnormal",textClass:"textit",font:"Math-Italic"},xP={mathClass:"boldsymbol",textClass:"boldsymbol",font:"Main-BoldItalic"},Ixe={mathClass:"mathscr",textClass:"textscr",font:"Script-Regular"},um={mathClass:"",textClass:"",font:""},wP={mathClass:"mathfrak",textClass:"textfrak",font:"Fraktur-Regular"},kP={mathClass:"mathbb",textClass:"textbb",font:"AMS-Regular"},_P={mathClass:"mathboldfrak",textClass:"textboldfrak",font:"Fraktur-Regular"},h7={mathClass:"mathsf",textClass:"textsf",font:"SansSerif-Regular"},f7={mathClass:"mathboldsf",textClass:"textboldsf",font:"SansSerif-Bold"},SP={mathClass:"mathitsf",textClass:"textitsf",font:"SansSerif-Italic"},m7={mathClass:"mathtt",textClass:"texttt",font:"Typewriter-Regular"},CP=[d7,d7,vP,vP,xP,xP,Ixe,um,um,um,wP,wP,kP,kP,_P,_P,h7,h7,f7,f7,SP,SP,um,um,m7,m7],Rxe=[d7,um,h7,f7,m7],Dxe=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 CP[s]}else if(120782<=r&&r<=120831){var i=Math.floor((r-120782)/10);return Rxe[i]}else{if(r===120485||r===120486)return CP[0];if(120486<r&&r<120782)return um;throw new xt("Unsupported character: "+e)}},sS=function(t,n,r){if(zs[r][t]){var s=zs[r][t].replace;s&&(t=s)}return{value:t,metrics:mM(t,n,r)}},Lo=function(t,n,r,s,i){var o=sS(t,n,r),a=o.metrics;t=o.value;var l;if(a){var u=a.italic;(r==="text"||s&&s.font==="mathit")&&(u=0),l=new rl(t,a.height,a.depth,u,a.skew,a.width,i)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+t+"' in style '"+n+"' and mode '"+r+"'")),l=new rl(t,0,0,0,0,0,i);if(s){l.maxFontSize=s.sizeMultiplier,s.style.isTight()&&l.classes.push("mtight");var d=s.getColor();d&&(l.style.color=d)}return l},pM=function(t,n,r,s){return s===void 0&&(s=[]),r.font==="boldsymbol"&&sS(t,"Main-Bold",n).metrics?Lo(t,"Main-Bold",n,r,s.concat(["mathbf"])):t==="\\"||zs[n][t].font==="main"?Lo(t,"Main-Regular",n,r,s):Lo(t,"AMS-Regular",n,r,s.concat(["amsrm"]))},Lxe=function(t,n,r){return r!=="textord"&&sS(t,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},iS=function(t,n,r){var s=t.mode,i=t.text,o=["mord"],{font:a,fontFamily:l,fontWeight:u,fontShape:d}=n,h=s==="math"||s==="text"&&!!a,m=h?a:l,p="",g="";if(i.charCodeAt(0)===55349){var b=Dxe(i);p=b.font,g=b[s+"Class"]}if(p)return Lo(i,p,s,n,o.concat(g));if(m){var x,v;if(m==="boldsymbol"){var y=Lxe(i,s,r);x=y.fontName,v=[y.fontClass]}else h?(x=p7[a].fontName,v=[a]):(x=iw(l,u,d),v=[l,u,d]);if(sS(i,x,s).metrics)return Lo(i,x,s,n,o.concat(v));if(eK.hasOwnProperty(i)&&x.slice(0,10)==="Typewriter"){for(var w=[],k=0;k<i.length;k++)w.push(Lo(i[k],x,s,n,o.concat(v)));return kd(w)}}if(r==="mathord")return Lo(i,"Math-Italic",s,n,o.concat(["mathnormal"]));if(r==="textord"){var T=zs[s][i]&&zs[s][i].font;if(T==="ams"){var S=iw("amsrm",u,d);return Lo(i,S,s,n,o.concat("amsrm",u,d))}else if(T==="main"||!T){var C=iw("textrm",u,d);return Lo(i,C,s,n,o.concat(u,d))}else{var _=iw(T,u,d);return Lo(i,_,s,n,o.concat(_,u,d))}}else throw new Error("unexpected type: "+r+" in makeOrd")},Pxe=(e,t)=>{if(Yh(e.classes)!==Yh(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},tK=e=>{for(var t=0;t<e.length-1;t++){var n=e[t],r=e[t+1];n instanceof rl&&r instanceof rl&&Pxe(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},gM=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},mt=function(t,n,r,s){var i=new Kg(t,n,r,s);return gM(i),i},Qh=(e,t,n,r)=>new Kg(e,t,n,r),pg=function(t,n,r){var s=mt([t],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Rt(s.height),s.maxFontSize=1,s},Oxe=function(t,n,r,s){var i=new rS(t,n,r,s);return gM(i),i},kd=function(t){var n=new Gg(t);return gM(n),n},gg=function(t,n){return t instanceof Gg?mt([],[t],n):t},Bxe=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 u;if(t.positionType==="top"){for(var d=t.positionData,h=0;h<t.children.length;h++){var m=t.children[h];d-=m.type==="kern"?m.size:m.elem.height+m.elem.depth}u=d}else if(t.positionType==="bottom")u=-t.positionData;else{var p=t.children[0];if(p.type!=="elem")throw new Error('First child must have type "elem".');if(t.positionType==="shift")u=-p.elem.depth-t.positionData;else if(t.positionType==="firstBaseline")u=-p.elem.depth;else throw new Error("Invalid positionType "+t.positionType+".")}return{children:t.children,depth:u}},es=function(t,n){for(var{children:r,depth:s}=Bxe(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 u=mt(["pstrut"],[]);u.style.height=Rt(i);for(var d=[],h=s,m=s,p=s,g=0;g<r.length;g++){var b=r[g];if(b.type==="kern")p+=b.size;else{var x=b.elem,v=b.wrapperClasses||[],y=b.wrapperStyle||{},w=mt(v,[u,x],void 0,y);w.style.top=Rt(-i-p-x.depth),b.marginLeft&&(w.style.marginLeft=b.marginLeft),b.marginRight&&(w.style.marginRight=b.marginRight),d.push(w),p+=x.height+x.depth}h=Math.min(h,p),m=Math.max(m,p)}var k=mt(["vlist"],d);k.style.height=Rt(m);var T;if(h<0){var S=mt([],[]),C=mt(["vlist"],[S]);C.style.height=Rt(-h);var _=mt(["vlist-s"],[new rl("​")]);T=[mt(["vlist-r"],[k,_]),mt(["vlist-r"],[C])]}else T=[mt(["vlist-r"],[k])];var A=mt(["vlist-t"],T);return T.length===2&&A.classes.push("vlist-t2"),A.height=m,A.depth=-h,A},nK=(e,t)=>{var n=mt(["mspace"],[],t),r=Ks(e,t);return n.style.marginRight=Rt(r),n},iw=(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},p7={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"}},rK={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},sK=function(t,n){var[r,s,i]=rK[t],o=new Xh(r),a=new cd([o],{width:Rt(s),height:Rt(i),style:"width:"+Rt(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),l=Qh(["overlay"],[a],n);return l.height=i,l.style.height=Rt(i),l.style.width=Rt(s),l},Vs={number:3,unit:"mu"},Yf={number:4,unit:"mu"},Cu={number:5,unit:"mu"},$xe={mord:{mop:Vs,mbin:Yf,mrel:Cu,minner:Vs},mop:{mord:Vs,mop:Vs,mrel:Cu,minner:Vs},mbin:{mord:Yf,mop:Yf,mopen:Yf,minner:Yf},mrel:{mord:Cu,mop:Cu,mopen:Cu,minner:Cu},mopen:{},mclose:{mop:Vs,mbin:Yf,mrel:Cu,minner:Vs},mpunct:{mord:Vs,mop:Vs,mrel:Cu,mopen:Vs,mclose:Vs,mpunct:Vs,minner:Vs},minner:{mord:Vs,mop:Vs,mbin:Yf,mrel:Cu,mopen:Vs,mpunct:Vs,minner:Vs}},zxe={mord:{mop:Vs},mop:{mord:Vs,mop:Vs},mbin:{},mrel:{},mopen:{},mclose:{mop:Vs},mpunct:{},minner:{mop:Vs}},iK={},t_={},n_={};function Jt(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)iK[n[l]]=a;t&&(i&&(t_[t]=i),o&&(n_[t]=o))}function mp(e){var{type:t,htmlBuilder:n,mathmlBuilder:r}=e;Jt({type:t,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var r_=function(t){return t.type==="ordgroup"&&t.body.length===1?t.body[0]:t},bi=function(t){return t.type==="ordgroup"?t.body:[t]},Fxe=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),qxe=new Set(["rightmost","mrel","mclose","mpunct"]),Hxe={display:Kn.DISPLAY,text:Kn.TEXT,script:Kn.SCRIPT,scriptscript:Kn.SCRIPTSCRIPT},Uxe={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ji=function(t,n,r,s){s===void 0&&(s=[null,null]);for(var i=[],o=0;o<t.length;o++){var a=ns(t[o],n);if(a instanceof Gg){var l=a.children;i.push(...l)}else i.push(a)}if(tK(i),!r)return i;var u=n;if(t.length===1){var d=t[0];d.type==="sizing"?u=n.havingSize(d.size):d.type==="styling"&&(u=n.havingStyle(Hxe[d.style]))}var h=mt([s[0]||"leftmost"],[],n),m=mt([s[1]||"rightmost"],[],n),p=r==="root";return g7(i,(g,b)=>{var x=b.classes[0],v=g.classes[0];x==="mbin"&&qxe.has(v)?b.classes[0]="mord":v==="mbin"&&Fxe.has(x)&&(g.classes[0]="mord")},{node:h},m,p),g7(i,(g,b)=>{var x,v,y=y7(b),w=y7(g),k=y&&w?g.hasClass("mtight")?(x=zxe[y])==null?void 0:x[w]:(v=$xe[y])==null?void 0:v[w]:null;if(k)return nK(k,u)},{node:h},m,p),i},g7=function(t,n,r,s,i){s&&t.push(s);for(var o=0;o<t.length;o++){var a=t[o],l=oK(a);if(l){g7(l.children,n,r,null,i);continue}var u=!a.hasClass("mspace");if(u){var d=n(a,r.node);d&&(r.insertAfter?r.insertAfter(d):(t.unshift(d),o++))}u?r.node=a:i&&a.hasClass("newline")&&(r.node=mt(["leftmost"])),r.insertAfter=(h=>m=>{t.splice(h+1,0,m),o++})(o)}s&&t.pop()},oK=function(t){return t instanceof Gg||t instanceof rS||t instanceof Kg&&t.hasClass("enclosing")?t:null},b7=function(t,n){var r=oK(t);if(r){var s=r.children;if(s.length){if(n==="right")return b7(s[s.length-1],"right");if(n==="left")return b7(s[0],"left")}}return t},y7=function(t,n){if(!t)return null;n&&(t=b7(t,n));var r=t.classes[0];return Uxe[r]||null},Py=function(t,n){var r=["nulldelimiter"].concat(t.baseSizingClasses());return mt(n.concat(r))},ns=function(t,n,r){if(!t)return mt();if(t_[t.type]){var s=t_[t.type](t,n);if(r&&n.size!==r.size){s=mt(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new xt("Got group of unknown type: '"+t.type+"'")};function ow(e,t){var n=mt(["base"],e,t),r=mt(["strut"]);return r.style.height=Rt(n.height+n.depth),n.depth&&(r.style.verticalAlign=Rt(-n.depth)),n.children.unshift(r),n}function v7(e,t){var n=null;e.length===1&&e[0].type==="tag"&&(n=e[0].tag,e=e[0].body);var r=ji(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(ow(o,t)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(i.push(ow(o,t)),o=[]),i.push(r[a]));o.length>0&&i.push(ow(o,t));var u;n?(u=ow(ji(n,t,!0),t),u.classes=["tag"],i.push(u)):s&&i.push(s);var d=mt(["katex-html"],i);if(d.setAttribute("aria-hidden","true"),u){var h=u.children[0];h.style.height=Rt(d.height+d.depth),d.depth&&(h.style.verticalAlign=Rt(-d.depth))}return d}function aK(e){return new Gg(e)}class _t{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=Yh(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof yi&&this.children[r+1]instanceof yi){for(var s=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof yi;)s+=this.children[++r].toText();t.appendChild(new yi(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+=vo(this.attributes[n]),t+='"');this.classes.length>0&&(t+=' class ="'+vo(Yh(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 yi=class{constructor(t){this.text=void 0,this.text=t}toNode(){return document.createTextNode(this.text)}toMarkup(){return vo(this.toText())}toText(){return this.text}};class lK{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",Rt(this.width)),t}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Rt(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var Vxe=new Set(["\\imath","\\jmath"]),Wxe=new Set(["mrow","mtable"]),$l=function(t,n,r){return zs[n][t]&&zs[n][t].replace&&t.charCodeAt(0)!==55349&&!(eK.hasOwnProperty(t)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(t=zs[n][t].replace),new yi(t)},bM=function(t){return t.length===1?t[0]:new _t("mrow",t)},Gxe={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"},yM=(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=Gxe[n];if(s)return typeof s=="function"?s(e):s;var i=e.text;if(Vxe.has(i))return null;if(zs[r][i]){var o=zs[r][i].replace;o&&(i=o)}var a=p7[n].fontName;return mM(i,a,r)?p7[n].variant:null};function L5(e){if(!e)return!1;if(e.type==="mi"&&e.children.length===1){var t=e.children[0];return t instanceof yi&&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 yi&&n.text===","}else return!1}var al=function(t,n,r){if(t.length===1){var s=_s(t[0],n);return r&&s instanceof _t&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],o,a=0;a<t.length;a++){var l=_s(t[a],n);if(l instanceof _t&&o instanceof _t){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(L5(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&L5(o))l.children=[...o.children,...l.children],i.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||L5(o))){var u=l.children[0];u instanceof _t&&u.type==="mn"&&(u.children=[...o.children,...u.children],i.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof yi&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof yi&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),i.pop())}}}i.push(l),o=l}return i},Jh=function(t,n,r){return bM(al(t,n,r))},_s=function(t,n){if(!t)return new _t("mrow");if(n_[t.type])return n_[t.type](t,n);throw new xt("Got group of unknown type: '"+t.type+"'")};function TP(e,t,n,r,s){var i=al(e,n),o;i.length===1&&i[0]instanceof _t&&Wxe.has(i[0].type)?o=i[0]:o=new _t("mrow",i);var a=new _t("annotation",[new yi(t)]);a.setAttribute("encoding","application/x-tex");var l=new _t("semantics",[o,a]),u=new _t("math",[l]);u.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&u.setAttribute("display","block");var d=s?"katex":"katex-mathml";return mt([d],[u])}var Kxe=[[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]],AP=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],EP=function(t,n){return n.size<2?t:Kxe[t-1][n.size-1]};class Ru{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||Ru.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=AP[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 Ru(n)}havingStyle(t){return this.style===t?this:this.extend({style:t,size:EP(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:AP[t-1]})}havingBaseStyle(t){t=t||this.style.text();var n=EP(Ru.BASESIZE,t);return this.size===n&&this.textSize===Ru.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!==Ru.BASESIZE?["sizing","reset-size"+this.size,"size"+Ru.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=jxe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Ru.BASESIZE=6;var cK=function(t){return new Ru({style:t.displayMode?Kn.DISPLAY:Kn.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},uK=function(t,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),t=mt(r,[t])}return t},Yxe=function(t,n,r){var s=cK(r),i;if(r.output==="mathml")return TP(t,n,s,r.displayMode,!0);if(r.output==="html"){var o=v7(t,s);i=mt(["katex"],[o])}else{var a=TP(t,n,s,r.displayMode,!1),l=v7(t,s);i=mt(["katex"],[a,l])}return uK(i,r)},Xxe=function(t,n,r){var s=cK(r),i=v7(t,s),o=mt(["katex"],[i]);return uK(o,r)},Qxe={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":"="},oS=function(t){var n=new _t("mo",[new yi(Qxe[t.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Jxe={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]},Zxe=new Set(["widehat","widecheck","widetilde","utilde"]),aS=function(t,n){function r(){var a=4e5,l=t.label.slice(1);if(Zxe.has(l)&&"base"in t){var u=t.base.type==="ordgroup"?t.base.body.length:1,d,h,m;if(u>5)l==="widehat"||l==="widecheck"?(d=420,a=2364,m=.42,h=l+"4"):(d=312,a=2340,m=.34,h="tilde4");else{var p=[1,1,2,2,3,3][u];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][p],d=[0,239,300,360,420][p],m=[0,.24,.3,.3,.36,.42][p],h=l+p):(a=[0,600,1033,2339,2340][p],d=[0,260,286,306,312][p],m=[0,.26,.286,.3,.306,.34][p],h="tilde"+p)}var g=new Xh(h),b=new cd([g],{width:"100%",height:Rt(m),viewBox:"0 0 "+a+" "+d,preserveAspectRatio:"none"});return{span:Qh([],[b],n),minWidth:0,height:m}}else{var x=[],v=Jxe[l];if(!v)throw new Error('No SVG data for "'+l+'".');var[y,w,k]=v,T=k/1e3,S=y.length,C,_;if(S===1){if(v.length!==4)throw new Error('Expected 4-tuple for single-path SVG data "'+l+'".');C=["hide-tail"],_=[v[3]]}else if(S===2)C=["halfarrow-left","halfarrow-right"],_=["xMinYMin","xMaxYMin"];else if(S===3)C=["brace-left","brace-center","brace-right"],_=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+S+" children.");for(var A=0;A<S;A++){var M=new Xh(y[A]),L=new cd([M],{width:"400em",height:Rt(T),viewBox:"0 0 "+a+" "+k,preserveAspectRatio:_[A]+" slice"}),N=Qh([C[A]],[L],n);if(S===1)return{span:N,minWidth:w,height:T};N.style.height=Rt(T),x.push(N)}return{span:mt(["stretchy"],x,n),minWidth:w,height:T}}}var{span:s,minWidth:i,height:o}=r();return s.height=o,s.style.height=Rt(o),i>0&&(s.style.minWidth=Rt(i)),s},ewe=function(t,n,r,s,i){var o,a=t.height+t.depth+r+s;if(/fbox|color|angl/.test(n)){if(o=mt(["stretchy",n],[],i),n==="fbox"){var l=i.color&&i.getColor();l&&(o.style.borderColor=l)}}else{var u=[];/^[bx]cancel$/.test(n)&&u.push(new c7({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&u.push(new c7({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new cd(u,{width:"100%",height:Rt(a)});o=Qh([],[d],i)}return o.height=a,o.style.height=Rt(a),o},twe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},nwe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1};function rwe(e){return e in twe}function ar(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 lS(e){var t=cS(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 cS(e){return e&&(e.type==="atom"||nwe.hasOwnProperty(e.type))?e:null}var dK=e=>{if(e instanceof rl)return e;if(Nxe(e)&&e.children.length===1)return dK(e.children[0])},vM=(e,t)=>{var n,r,s;e&&e.type==="supsub"?(r=ar(e.base,"accent"),n=r.base,e.base=n,s=Mxe(ns(e,t)),e.base=r):(r=ar(e,"accent"),n=r.base);var i=ns(n,t.havingCrampedStyle()),o=r.isShifty&&xd(n),a=0;if(o){var l,u;a=(l=(u=dK(i))==null?void 0:u.skew)!=null?l:0}var d=r.label==="\\c",h=d?i.height+i.depth:Math.min(i.height,t.fontMetrics().xHeight),m;if(r.isStretchy)m=aS(r,t),m=es({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Rt(2*a)+")",marginLeft:Rt(2*a)}:void 0}]});else{var p,g;r.label==="\\vec"?(p=sK("vec",t),g=rK.vec[1]):(p=iS({mode:r.mode,text:r.label},t,"textord"),p=Exe(p),p.italic=0,g=p.width,d&&(h+=p.depth)),m=mt(["accent-body"],[p]);var b=r.label==="\\textcircled";b&&(m.classes.push("accent-full"),h=i.height);var x=a;b||(x-=g/2),m.style.left=Rt(x),r.label==="\\textcircled"&&(m.style.top=".2em"),m=es({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-h},{type:"elem",elem:m}]})}var v=mt(["mord","accent"],[m],t);return s?(s.children[0]=v,s.height=Math.max(v.height,s.height),s.classes[0]="mord",s):v},hK=(e,t)=>{var n=e.isStretchy?oS(e.label):new _t("mo",[$l(e.label,e.mode)]),r=new _t("mover",[_s(e.base,t),n]);return r.setAttribute("accent","true"),r},swe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(e=>"\\"+e).join("|"));Jt({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=r_(t[0]),r=!swe.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:vM,mathmlBuilder:hK});Jt({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:vM,mathmlBuilder:hK});Jt({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=ns(e.base,t),r=aS(e,t),s=e.label==="\\utilde"?.12:0,i=es({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]});return mt(["mord","accentunder"],[i],t)},mathmlBuilder:(e,t)=>{var n=oS(e.label),r=new _t("munder",[_s(e.base,t),n]);return r.setAttribute("accentunder","true"),r}});var aw=e=>{var t=new _t("mpadded",e?[e]:[]);return t.setAttribute("width","+0.6em"),t.setAttribute("lspace","0.3em"),t};Jt({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=gg(ns(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=gg(ns(e.below,r,t),t),o.classes.push(i+"-arrow-pad"));var a=aS(e,t),l=-t.fontMetrics().axisHeight+.5*a.height,u=-t.fontMetrics().axisHeight-.5*a.height-.111;(s.depth>.25||e.label==="\\xleftequilibrium")&&(u-=s.depth);var d;if(o){var h=-t.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=es({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]},{type:"elem",elem:o,shift:h}]})}else d=es({positionType:"individualShift",children:[{type:"elem",elem:s,shift:u},{type:"elem",elem:a,shift:l,wrapperClasses:["svg-align"]}]});return mt(["mrel","x-arrow"],[d],t)},mathmlBuilder(e,t){var n=oS(e.label);n.setAttribute("minsize",e.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(e.body){var s=aw(_s(e.body,t));if(e.below){var i=aw(_s(e.below,t));r=new _t("munderover",[n,i,s])}else r=new _t("mover",[n,s])}else if(e.below){var o=aw(_s(e.below,t));r=new _t("munder",[n,o])}else r=aw(),r=new _t("mover",[n,r]);return r}});function fK(e,t){var n=ji(e.body,t,!0);return mt([e.mclass],n,t)}function mK(e,t){var n,r=al(e.body,t);return e.mclass==="minner"?n=new _t("mpadded",r):e.mclass==="mord"?e.isCharacterBox?(n=r[0],n.type="mi"):n=new _t("mi",r):(e.isCharacterBox?(n=r[0],n.type="mo"):n=new _t("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}Jt({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:bi(s),isCharacterBox:xd(s)}},htmlBuilder:fK,mathmlBuilder:mK});var uS=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"};Jt({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(e,t){var{parser:n}=e;return{type:"mclass",mode:n.mode,mclass:uS(t[0]),body:bi(t[1]),isCharacterBox:xd(t[1])}}});Jt({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=uS(s):o="mrel";var a={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:bi(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:xd(l)}},htmlBuilder:fK,mathmlBuilder:mK});Jt({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(e,t){var{parser:n}=e;return{type:"pmb",mode:n.mode,mclass:uS(t[0]),body:bi(t[0])}},htmlBuilder(e,t){var n=ji(e.body,t,!0),r=mt([e.mclass],n,t);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(e,t){var n=al(e.body,t),r=new _t("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var iwe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},MP=()=>({type:"styling",body:[],mode:"math",style:"display",resetFont:!0}),NP=e=>e.type==="textord"&&e.text==="@",owe=(e,t)=>(e.type==="mathord"||e.type==="atom")&&e.text===t;function awe(e,t,n){var r=iwe[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 u={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[u],[])}default:return{type:"textord",text:" ",mode:"math"}}}function lwe(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 xt("Expected \\\\ or \\cr or \\end",e.nextToken)}for(var r=[],s=[r],i=0;i<t.length;i++){for(var o=t[i],a=MP(),l=0;l<o.length;l++)if(!NP(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var u=lS(o[l]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(u))if("<>AV".includes(u))for(var h=0;h<2;h++){for(var m=!0,p=l+1;p<o.length;p++){if(owe(o[p],u)){m=!1,l=p;break}if(NP(o[p]))throw new xt("Missing a "+u+" character to complete a CD arrow.",o[p]);d[h].body.push(o[p])}if(m)throw new xt("Missing a "+u+" character to complete a CD arrow.",o[l])}else throw new xt('Expected one of "<>AV=|." after @',o[l]);var g=awe(u,d,e),b={type:"styling",body:[g],mode:"math",style:"display",resetFont:!0};r.push(b),a=MP()}i%2===0?r.push(a):r.shift(),r=[],s.push(r)}e.gullet.endGroup(),e.gullet.endGroup();var x=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:x,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Jt({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=gg(ns(e.label,n,t),t);return r.classes.push("cd-label-"+e.side),r.style.bottom=Rt(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(e,t){var n=new _t("mrow",[_s(e.label,t)]);return n=new _t("mpadded",[n]),n.setAttribute("width","0"),e.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new _t("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Jt({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=gg(ns(e.fragment,t),t);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(e,t){return new _t("mrow",[_s(e.fragment,t)])}});Jt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(e,t){for(var{parser:n}=e,r=ar(t[0],"ordgroup"),s=r.body,i="",o=0;o<s.length;o++){var a=ar(s[o],"textord");i+=a.text}var l=parseInt(i),u;if(isNaN(l))throw new xt("\\@char has non-numeric argument "+i);if(l<0||l>=1114111)throw new xt("\\@char with invalid code point "+i);return l<=65535?u=String.fromCharCode(l):(l-=65536,u=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:u}}});var pK=(e,t)=>{var n=ji(e.body,t.withColor(e.color),!1);return kd(n)},gK=(e,t)=>{var n=al(e.body,t.withColor(e.color)),r=new _t("mstyle",n);return r.setAttribute("mathcolor",e.color),r};Jt({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(e,t){var{parser:n}=e,r=ar(t[0],"color-token").color,s=t[1];return{type:"color",mode:n.mode,color:r,body:bi(s)}},htmlBuilder:pK,mathmlBuilder:gK});Jt({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(e,t){var{parser:n,breakOnTokenText:r}=e,s=ar(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:pK,mathmlBuilder:gK});Jt({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&&ar(s,"size").value}},htmlBuilder(e,t){var n=mt(["mspace"],[],t);return e.newLine&&(n.classes.push("newline"),e.size&&(n.style.marginTop=Rt(Ks(e.size,t)))),n},mathmlBuilder(e,t){var n=new _t("mspace");return e.newLine&&(n.setAttribute("linebreak","newline"),e.size&&n.setAttribute("height",Rt(Ks(e.size,t)))),n}});var x7={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},bK=e=>{var t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new xt("Expected a control sequence",e);return t},cwe=e=>{var t=e.gullet.popToken();return t.text==="="&&(t=e.gullet.popToken(),t.text===" "&&(t=e.gullet.popToken())),t},yK=(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)};Jt({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(x7[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=x7[r.text]),ar(t.parseFunction(),"internal");throw new xt("Invalid token after macro prefix",r)}});Jt({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 xt("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 xt('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new xt('Argument number "'+r.text+'" out of order');i++,a.push([])}else{if(r.text==="EOF")throw new xt("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===x7[n]),{type:"internal",mode:t.mode}}});Jt({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=bK(t.gullet.popToken());t.gullet.consumeSpaces();var s=cwe(t);return yK(t,r,s,n==="\\\\globallet"),{type:"internal",mode:t.mode}}});Jt({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(e){var{parser:t,funcName:n}=e,r=bK(t.gullet.popToken()),s=t.gullet.popToken(),i=t.gullet.popToken();return yK(t,r,i,n==="\\\\globalfuture"),t.gullet.pushToken(i),t.gullet.pushToken(s),{type:"internal",mode:t.mode}}});var bb=function(t,n,r){var s=zs.math[t]&&zs.math[t].replace,i=mM(s||t,n,r);if(!i)throw new Error("Unsupported symbol "+t+" and font size "+n+".");return i},xM=function(t,n,r,s){var i=r.havingBaseStyle(n),o=mt(s.concat(i.sizingClasses(r)),[t],r),a=i.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=i.sizeMultiplier,o},vK=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=Rt(i),t.height-=i,t.depth+=i},uwe=function(t,n,r,s,i,o){var a=Lo(t,"Main-Regular",i,s),l=xM(a,n,s,o);return vK(l,s,n),l},dwe=function(t,n,r,s){return Lo(t,"Size"+n+"-Regular",r,s)},xK=function(t,n,r,s,i,o){var a=dwe(t,n,i,s),l=xM(mt(["delimsizing","size"+n],[a],s),Kn.TEXT,s,o);return r&&vK(l,s,Kn.TEXT),l},P5=function(t,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=mt(["delimsizinginner",s],[mt([],[Lo(t,n,r)])]);return{type:"elem",elem:i}},O5=function(t,n,r){var s=qc["Size4-Regular"][t.charCodeAt(0)]?qc["Size4-Regular"][t.charCodeAt(0)][4]:qc["Size1-Regular"][t.charCodeAt(0)][4],i=new Xh("inner",wxe(t,Math.round(1e3*n))),o=new cd([i],{width:Rt(s),height:Rt(n),style:"width:"+Rt(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=Qh([],[o],r);return a.height=n,a.style.height=Rt(n),a.style.width=Rt(s),{type:"elem",elem:a}},w7=.008,lw={type:"kern",size:-1*w7},hwe=new Set(["|","\\lvert","\\rvert","\\vert"]),fwe=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),wK=function(t,n,r,s,i,o){var a,l,u,d,h="",m=0;a=u=d=t,l=null;var p="Size1-Regular";t==="\\uparrow"?u=d="⏐":t==="\\Uparrow"?u=d="‖":t==="\\downarrow"?a=u="⏐":t==="\\Downarrow"?a=u="‖":t==="\\updownarrow"?(a="\\uparrow",u="⏐",d="\\downarrow"):t==="\\Updownarrow"?(a="\\Uparrow",u="‖",d="\\Downarrow"):hwe.has(t)?(u="∣",h="vert",m=333):fwe.has(t)?(u="∥",h="doublevert",m=556):t==="["||t==="\\lbrack"?(a="⎡",u="⎢",d="⎣",p="Size4-Regular",h="lbrack",m=667):t==="]"||t==="\\rbrack"?(a="⎤",u="⎥",d="⎦",p="Size4-Regular",h="rbrack",m=667):t==="\\lfloor"||t==="⌊"?(u=a="⎢",d="⎣",p="Size4-Regular",h="lfloor",m=667):t==="\\lceil"||t==="⌈"?(a="⎡",u=d="⎢",p="Size4-Regular",h="lceil",m=667):t==="\\rfloor"||t==="⌋"?(u=a="⎥",d="⎦",p="Size4-Regular",h="rfloor",m=667):t==="\\rceil"||t==="⌉"?(a="⎤",u=d="⎥",p="Size4-Regular",h="rceil",m=667):t==="("||t==="\\lparen"?(a="⎛",u="⎜",d="⎝",p="Size4-Regular",h="lparen",m=875):t===")"||t==="\\rparen"?(a="⎞",u="⎟",d="⎠",p="Size4-Regular",h="rparen",m=875):t==="\\{"||t==="\\lbrace"?(a="⎧",l="⎨",d="⎩",u="⎪",p="Size4-Regular"):t==="\\}"||t==="\\rbrace"?(a="⎫",l="⎬",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lgroup"||t==="⟮"?(a="⎧",d="⎩",u="⎪",p="Size4-Regular"):t==="\\rgroup"||t==="⟯"?(a="⎫",d="⎭",u="⎪",p="Size4-Regular"):t==="\\lmoustache"||t==="⎰"?(a="⎧",d="⎭",u="⎪",p="Size4-Regular"):(t==="\\rmoustache"||t==="⎱")&&(a="⎫",d="⎩",u="⎪",p="Size4-Regular");var g=bb(a,p,i),b=g.height+g.depth,x=bb(u,p,i),v=x.height+x.depth,y=bb(d,p,i),w=y.height+y.depth,k=0,T=1;if(l!==null){var S=bb(l,p,i);k=S.height+S.depth,T=2}var C=b+w+k,_=Math.max(0,Math.ceil((n-C)/(T*v))),A=C+_*T*v,M=s.fontMetrics().axisHeight;r&&(M*=s.sizeMultiplier);var L=A/2-M,N=[];if(h.length>0){var O=A-b-w,B=Math.round(A*1e3),$=kxe(h,Math.round(O*1e3)),P=new Xh(h,$),K=Rt(m/1e3),F=Rt(B/1e3),H=new cd([P],{width:K,height:F,viewBox:"0 0 "+m+" "+B}),D=Qh([],[H],s);D.height=B/1e3,D.style.width=K,D.style.height=F,N.push({type:"elem",elem:D})}else{if(N.push(P5(d,p,i)),N.push(lw),l===null){var Q=A-b-w+2*w7;N.push(O5(u,Q,s))}else{var U=(A-b-w-k)/2+2*w7;N.push(O5(u,U,s)),N.push(lw),N.push(P5(l,p,i)),N.push(lw),N.push(O5(u,U,s))}N.push(lw),N.push(P5(a,p,i))}var j=s.havingBaseStyle(Kn.TEXT),ie=es({positionType:"bottom",positionData:L,children:N});return xM(mt(["delimsizing","mult"],[ie],j),Kn.TEXT,s,o)},B5=80,$5=.08,z5=function(t,n,r,s,i){var o=xxe(t,s,r),a=new Xh(t,o),l=new cd([a],{width:"400em",height:Rt(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Qh(["hide-tail"],[l],i)},mwe=function(t,n){var r=n.havingBaseSizing(),s=TK("\\surd",t*r.sizeMultiplier,CK,r),i=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l,u,d,h;return s.type==="small"?(d=1e3+1e3*o+B5,t<1?i=1:t<1.4&&(i=.7),l=(1+o+$5)/i,u=(1+o)/i,a=z5("sqrtMain",l,d,o,n),a.style.minWidth="0.853em",h=.833/i):s.type==="large"?(d=(1e3+B5)*ty[s.size],u=(ty[s.size]+o)/i,l=(ty[s.size]+o+$5)/i,a=z5("sqrtSize"+s.size,l,d,o,n),a.style.minWidth="1.02em",h=1/i):(l=t+o+$5,u=t+o,d=Math.floor(1e3*t+o)+B5,a=z5("sqrtTall",l,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=u,a.style.height=Rt(l),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*i}},kK=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),pwe=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),_K=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),ty=[0,1.2,1.8,2.4,3],SK=function(t,n,r,s,i){if(t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle"),kK.has(t)||_K.has(t))return xK(t,n,!1,r,s,i);if(pwe.has(t))return wK(t,ty[n],!1,r,s,i);throw new xt("Illegal delimiter: '"+t+"'")},gwe=[{type:"small",style:Kn.SCRIPTSCRIPT},{type:"small",style:Kn.SCRIPT},{type:"small",style:Kn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],bwe=[{type:"small",style:Kn.SCRIPTSCRIPT},{type:"small",style:Kn.SCRIPT},{type:"small",style:Kn.TEXT},{type:"stack"}],CK=[{type:"small",style:Kn.SCRIPTSCRIPT},{type:"small",style:Kn.SCRIPT},{type:"small",style:Kn.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],ywe=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.")},TK=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=bb(t,ywe(a),"math"),u=l.height+l.depth;if(a.type==="small"){var d=s.havingBaseStyle(a.style);u*=d.sizeMultiplier}if(u>n)return a}return r[r.length-1]},k7=function(t,n,r,s,i,o){t==="<"||t==="\\lt"||t==="⟨"?t="\\langle":(t===">"||t==="\\gt"||t==="⟩")&&(t="\\rangle");var a;_K.has(t)?a=gwe:kK.has(t)?a=CK:a=bwe;var l=TK(t,n,a,s);return l.type==="small"?uwe(t,l.style,r,s,i,o):l.type==="large"?xK(t,l.size,r,s,i,o):wK(t,n,r,s,i,o)},F5=function(t,n,r,s,i,o){var a=s.fontMetrics().axisHeight*s.sizeMultiplier,l=901,u=5/s.fontMetrics().ptPerEm,d=Math.max(n-a,r+a),h=Math.max(d/500*l,2*d-u);return k7(t,h,!0,s,i,o)},jP={"\\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}},vwe=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 IP(e){return"isMiddle"in e}function dS(e,t){var n=cS(e);if(n&&vwe.has(n.text))return n;throw n?new xt("Invalid delimiter '"+n.text+"' after '"+t.funcName+"'",e):new xt("Invalid delimiter type '"+e.type+"'",e)}Jt({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=dS(t[0],e);return{type:"delimsizing",mode:e.parser.mode,size:jP[e.funcName].size,mclass:jP[e.funcName].mclass,delim:n.text}},htmlBuilder:(e,t)=>e.delim==="."?mt([e.mclass]):SK(e.delim,e.size,t,e.mode,[e.mclass]),mathmlBuilder:e=>{var t=[];e.delim!=="."&&t.push($l(e.delim,e.mode));var n=new _t("mo",t);e.mclass==="mopen"||e.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Rt(ty[e.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function RP(e){if(!e.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Jt({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 xt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:e.parser.mode,delim:dS(t[0],e).text,color:n}}});Jt({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=dS(t[0],e),r=e.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=ar(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(e,t)=>{RP(e);for(var n=ji(e.body,t,!0,["mopen","mclose"]),r=0,s=0,i=!1,o=0;o<n.length;o++){var a=n[o];IP(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=Py(t,["mopen"]):l=F5(e.left,r,s,t,e.mode,["mopen"]),n.unshift(l),i)for(var u=1;u<n.length;u++){var d=n[u];if(IP(d)){var h=d.isMiddle;n[u]=F5(h.delim,r,s,h.options,e.mode,[])}}var m;if(e.right===".")m=Py(t,["mclose"]);else{var p=e.rightColor?t.withColor(e.rightColor):t;m=F5(e.right,r,s,p,e.mode,["mclose"])}return n.push(m),mt(["minner"],n,t)},mathmlBuilder:(e,t)=>{RP(e);var n=al(e.body,t);if(e.left!=="."){var r=new _t("mo",[$l(e.left,e.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(e.right!=="."){var s=new _t("mo",[$l(e.right,e.mode)]);s.setAttribute("fence","true"),e.rightColor&&s.setAttribute("mathcolor",e.rightColor),n.push(s)}return bM(n)}});Jt({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(e,t)=>{var n=dS(t[0],e);if(!e.parser.leftrightDepth)throw new xt("\\middle without preceding \\left",n);return{type:"middle",mode:e.parser.mode,delim:n.text}},htmlBuilder:(e,t)=>{var n;return e.delim==="."?n=Py(t,[]):(n=SK(e.delim,1,t,e.mode,[]),n.isMiddle={delim:e.delim,options:t}),n},mathmlBuilder:(e,t)=>{var n=e.delim==="\\vert"||e.delim==="|"?$l("|","text"):$l(e.delim,e.mode),r=new _t("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var hS=(e,t)=>{var n=gg(ns(e.body,t),t),r=e.label.slice(1),s=t.sizeMultiplier,i,o,a=xd(e.body);if(r==="sout")i=mt(["stretchy","sout"]),i.height=t.fontMetrics().defaultRuleThickness/s,o=-.5*t.fontMetrics().xHeight;else if(r==="phase"){var l=Ks({number:.6,unit:"pt"},t),u=Ks({number:.35,unit:"ex"},t),d=t.havingBaseSizing();s=s/d.sizeMultiplier;var h=n.height+n.depth+l+u;n.style.paddingLeft=Rt(h/2+l);var m=Math.floor(1e3*h*s),p=yxe(m),g=new cd([new Xh("phase",p)],{width:"400em",height:Rt(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});i=Qh(["hide-tail"],[g],t),i.style.height=Rt(h),o=n.depth+l+u}else{/cancel/.test(r)?a||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var b,x,v=0;/box/.test(r)?(v=Math.max(t.fontMetrics().fboxrule,t.minRuleThickness),b=t.fontMetrics().fboxsep+(r==="colorbox"?0:v),x=b):r==="angl"?(v=Math.max(t.fontMetrics().defaultRuleThickness,t.minRuleThickness),b=4*v,x=Math.max(0,.25-n.depth)):(b=a?.2:0,x=b),i=ewe(n,r,b,x,t),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Rt(v)):r==="angl"&&v!==.049&&(i.style.borderTopWidth=Rt(v),i.style.borderRightWidth=Rt(v)),o=n.depth+x,e.backgroundColor&&(i.style.backgroundColor=e.backgroundColor,e.borderColor&&(i.style.borderColor=e.borderColor))}var y;if(e.backgroundColor)y=es({positionType:"individualShift",children:[{type:"elem",elem:i,shift:o},{type:"elem",elem:n,shift:0}]});else{var w=/cancel|phase/.test(r)?["svg-align"]:[];y=es({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:o,wrapperClasses:w}]})}return/cancel/.test(r)&&(y.height=n.height,y.depth=n.depth),/cancel/.test(r)&&!a?mt(["mord","cancel-lap"],[y],t):mt(["mord"],[y],t)},fS=(e,t)=>{var n,r=new _t(e.label.includes("colorbox")?"mpadded":"menclose",[_s(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: "+Rt(s)+" solid "+e.borderColor)}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return e.backgroundColor&&r.setAttribute("mathbackground",e.backgroundColor),r};Jt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=ar(t[0],"color-token").color,o=t[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:o}},htmlBuilder:hS,mathmlBuilder:fS});Jt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","hbox"]},handler(e,t,n){var{parser:r,funcName:s}=e,i=ar(t[0],"color-token").color,o=ar(t[1],"color-token").color,a=t[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:o,borderColor:i,body:a}},htmlBuilder:hS,mathmlBuilder:fS});Jt({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]}}});Jt({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:hS,mathmlBuilder:fS});Jt({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:hS,mathmlBuilder:fS});Jt({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 AK={};function lu(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)AK[n[l]]=a;i&&(t_[t]=i),o&&(n_[t]=o)}var EK={};function W(e,t){EK[e]=t}class da{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 da(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}}class el{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 el(n,da.range(this,t))}}function DP(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 mS=e=>{var t=e.parser.settings;if(!t.displayMode)throw new xt("{"+e.envName+"} can be used only in display mode.")},xwe=new Set(["gather","gather*"]);function wM(e){if(!e.includes("ed"))return!e.includes("*")}function yf(e,t,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:u,emptySingleRow:d,maxNumCols:h,leqno:m}=t;if(e.gullet.beginGroup(),u||e.gullet.macros.set("\\cr","\\\\\\relax"),!o){var p=e.gullet.expandMacroAsText("\\arraystretch");if(p==null)o=1;else if(o=parseFloat(p),!o||o<0)throw new xt("Invalid \\arraystretch: "+p)}e.gullet.beginGroup();var g=[],b=[g],x=[],v=[],y=l!=null?[]:void 0;function w(){l&&e.gullet.macros.set("\\@eqnsw","1",!0)}function k(){y&&(e.gullet.macros.get("\\df@tag")?(y.push(e.subparse([new el("\\df@tag")])),e.gullet.macros.set("\\df@tag",void 0,!0)):y.push(!!l&&e.gullet.macros.get("\\@eqnsw")==="1"))}for(w(),v.push(DP(e));;){var T=e.parseExpression(!1,u?"\\end":"\\\\");e.gullet.endGroup(),e.gullet.beginGroup();var S={type:"ordgroup",mode:e.mode,body:T};n&&(S={type:"styling",mode:e.mode,style:n,resetFont:!0,body:[S]}),g.push(S);var C=e.fetch().text;if(C==="&"){if(h&&g.length===h){if(u||a)throw new xt("Too many tab characters: &",e.nextToken);e.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}e.consume()}else if(C==="\\end"){k(),g.length===1&&S.type==="styling"&&S.body.length===1&&S.body[0].type==="ordgroup"&&S.body[0].body.length===0&&(b.length>1||!d)&&b.pop(),v.length<b.length+1&&v.push([]);break}else if(C==="\\\\"){e.consume();var _=void 0;e.gullet.future().text!==" "&&(_=e.parseSizeGroup(!0)),x.push(_?_.value:null),k(),v.push(DP(e)),g=[],b.push(g),w()}else throw new xt("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:b,cols:i,rowGaps:x,hskipBeforeAndAfter:r,hLinesBeforeRow:v,colSeparationType:a,tags:y,leqno:m}}function kM(e){return e.slice(0,1)==="d"?"display":"text"}var cu=function(t,n){var r,s,i=t.body.length,o=t.hLinesBeforeRow,a=0,l=new Array(i),u=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,m=5*h;if(t.colSeparationType&&t.colSeparationType==="small"){var p=n.havingStyle(Kn.SCRIPT).sizeMultiplier;m=.2778*(p/n.sizeMultiplier)}var g=t.colSeparationType==="CD"?Ks({number:3,unit:"ex"},n):12*h,b=3*h,x=t.arraystretch*g,v=.7*x,y=.3*x,w=0;function k(We){for(var Te=0;Te<We.length;++Te)Te>0&&(w+=.25),u.push({pos:w,isDashed:We[Te]})}for(k(o[0]),r=0;r<t.body.length;++r){var T=t.body[r],S=v,C=y;a<T.length&&(a=T.length);var _={cells:new Array(T.length),height:0,depth:0,pos:0};for(s=0;s<T.length;++s){var A=ns(T[s],n);C<A.depth&&(C=A.depth),S<A.height&&(S=A.height),_.cells[s]=A}var M=t.rowGaps[r],L=0;M&&(L=Ks(M,n),L>0&&(L+=y,C<L&&(C=L),L=0)),t.addJot&&r<t.body.length-1&&(C+=b),_.height=S,_.depth=C,w+=S,_.pos=w,w+=C+L,l[r]=_,k(o[r+1])}var N=w/2+n.fontMetrics().axisHeight,O=t.cols||[],B=[],$,P,K=[];if(t.tags&&t.tags.some(We=>We))for(r=0;r<i;++r){var F=l[r],H=F.pos-N,D=t.tags[r],Q=void 0;D===!0?Q=mt(["eqn-num"],[],n):D===!1?Q=mt([],[],n):Q=mt([],ji(D,n,!0),n),Q.depth=F.depth,Q.height=F.height,K.push({type:"elem",elem:Q,shift:H})}for(s=0,P=0;s<a||P<O.length;++s,++P){for(var U,j=O[P],ie=!0;((oe=j)==null?void 0:oe.type)==="separator";){var oe;if(ie||($=mt(["arraycolsep"],[]),$.style.width=Rt(n.fontMetrics().doubleRuleSep),B.push($)),j.separator==="|"||j.separator===":"){var J=j.separator==="|"?"solid":"dashed",V=mt(["vertical-separator"],[],n);V.style.height=Rt(w),V.style.borderRightWidth=Rt(d),V.style.borderRightStyle=J,V.style.margin="0 "+Rt(-d/2);var se=w-N;se&&(V.style.verticalAlign=Rt(-se)),B.push(V)}else throw new xt("Invalid separator type: "+j.separator);P++,j=O[P],ie=!1}if(!(s>=a)){var Z=void 0;if(s>0||t.hskipBeforeAndAfter){var X,te;Z=(X=(te=j)==null?void 0:te.pregap)!=null?X:m,Z!==0&&($=mt(["arraycolsep"],[]),$.style.width=Rt(Z),B.push($))}var ae=[];for(r=0;r<i;++r){var xe=l[r],Ae=xe.cells[s];if(Ae){var Ne=xe.pos-N;Ae.depth=xe.depth,Ae.height=xe.height,ae.push({type:"elem",elem:Ae,shift:Ne})}}var Le=es({positionType:"individualShift",children:ae}),ge=mt(["col-align-"+(((U=j)==null?void 0:U.align)||"c")],[Le]);if(B.push(ge),s<a-1||t.hskipBeforeAndAfter){var Oe,Nt;Z=(Oe=(Nt=j)==null?void 0:Nt.postgap)!=null?Oe:m,Z!==0&&($=mt(["arraycolsep"],[]),$.style.width=Rt(Z),B.push($))}}}var Pe=mt(["mtable"],B);if(u.length>0){for(var Ce=pg("hline",n,d),Zt=pg("hdashline",n,d),dt=[{type:"elem",elem:Pe,shift:0}];u.length>0;){var Ge=u.pop(),St=Ge.pos-N;Ge.isDashed?dt.push({type:"elem",elem:Zt,shift:St}):dt.push({type:"elem",elem:Ce,shift:St})}Pe=es({positionType:"individualShift",children:dt})}if(K.length===0)return mt(["mord"],[Pe],n);var Y=es({positionType:"individualShift",children:K}),je=mt(["tag"],[Y],n);return kd([Pe,je])},wwe={c:"center ",l:"left ",r:"right "},uu=function(t,n){for(var r=[],s=new _t("mtd",[],["mtr-glue"]),i=new _t("mtd",[],["mml-eqn-num"]),o=0;o<t.body.length;o++){for(var a=t.body[o],l=[],u=0;u<a.length;u++)l.push(new _t("mtd",[_s(a[u],n)]));t.tags&&t.tags[o]&&(l.unshift(s),l.push(s),t.leqno?l.unshift(i):l.push(i)),r.push(new _t("mtr",l))}var d=new _t("mtable",r),h=t.arraystretch===.5?.1:.16+t.arraystretch-1+(t.addJot?.09:0);d.setAttribute("rowspacing",Rt(h));var m="",p="";if(t.cols&&t.cols.length>0){var g=t.cols,b="",x=!1,v=0,y=g.length;g[0].type==="separator"&&(m+="top ",v=1),g[g.length-1].type==="separator"&&(m+="bottom ",y-=1);for(var w=v;w<y;w++){var k=g[w];k.type==="align"?(p+=wwe[k.align],x&&(b+="none "),x=!0):k.type==="separator"&&x&&(b+=k.separator==="|"?"solid ":"dashed ",x=!1)}d.setAttribute("columnalign",p.trim()),/[sd]/.test(b)&&d.setAttribute("columnlines",b.trim())}if(t.colSeparationType==="align"){for(var T=t.cols||[],S="",C=1;C<T.length;C++)S+=C%2?"0em ":"1em ";d.setAttribute("columnspacing",S.trim())}else t.colSeparationType==="alignat"||t.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):t.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):t.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var _="",A=t.hLinesBeforeRow;m+=A[0].length>0?"left ":"",m+=A[A.length-1].length>0?"right ":"";for(var M=1;M<A.length-1;M++)_+=A[M].length===0?"none ":A[M][0]?"dashed ":"solid ";return/[sd]/.test(_)&&d.setAttribute("rowlines",_.trim()),m!==""&&(d=new _t("menclose",[d]),d.setAttribute("notation",m.trim())),t.arraystretch&&t.arraystretch<1&&(d=new _t("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},MK=function(t,n){t.envName.includes("ed")||mS(t);var r=[],s=t.envName.includes("at")?"alignat":"align",i=t.envName==="split",o=yf(t.parser,{cols:r,addJot:!0,autoTag:i?void 0:wM(t.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:t.parser.settings.leqno},"display"),a=0,l=0,u={type:"ordgroup",mode:t.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",h=0;h<n[0].body.length;h++){var m=ar(n[0].body[h],"textord");d+=m.text}a=Number(d),l=a*2}var p=!l;o.body.forEach(function(v){for(var y=1;y<v.length;y+=2){var w=ar(v[y],"styling"),k=ar(w.body[0],"ordgroup");k.body.unshift(u)}if(p)l<v.length&&(l=v.length);else{var T=v.length/2;if(a<T)throw new xt("Too many math in a row: "+("expected "+a+", but got "+T),v[0])}});for(var g=0;g<l;++g){var b="r",x=0;g%2===1?b="l":g>0&&p&&(x=1),r[g]={type:"align",align:b,pregap:x,postgap:0}}return o.colSeparationType=p?"align":"alignat",o};lu({type:"array",names:["array","darray"],props:{numArgs:1},handler(e,t){var n=cS(t[0]),r=n?[t[0]]:ar(t[0],"ordgroup").body,s=r.map(function(o){var a=lS(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 xt("Unknown column alignment: "+l,o)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return yf(e.parser,i,kM(e.envName))},htmlBuilder:cu,mathmlBuilder:uu});lu({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 xt("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=yf(e.parser,r,kM(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:cu,mathmlBuilder:uu});lu({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(e){var t={arraystretch:.5},n=yf(e.parser,t,"script");return n.colSeparationType="small",n},htmlBuilder:cu,mathmlBuilder:uu});lu({type:"array",names:["subarray"],props:{numArgs:1},handler(e,t){var n=cS(t[0]),r=n?[t[0]]:ar(t[0],"ordgroup").body,s=r.map(function(a){var l=lS(a),u=l.text;if("lc".includes(u))return{type:"align",align:u};throw new xt("Unknown column alignment: "+u,a)});if(s.length>1)throw new xt("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5},o=yf(e.parser,i,"script");if(o.body.length>0&&o.body[0].length>1)throw new xt("{subarray} can contain only one column");return o},htmlBuilder:cu,mathmlBuilder:uu});lu({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=yf(e.parser,t,kM(e.envName));return{type:"leftright",mode:e.mode,body:[n],left:e.envName.includes("r")?".":"\\{",right:e.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:cu,mathmlBuilder:uu});lu({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:MK,htmlBuilder:cu,mathmlBuilder:uu});lu({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(e){xwe.has(e.envName)&&mS(e);var t={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:wM(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return yf(e.parser,t,"display")},htmlBuilder:cu,mathmlBuilder:uu});lu({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:MK,htmlBuilder:cu,mathmlBuilder:uu});lu({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(e){mS(e);var t={autoTag:wM(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:e.parser.settings.leqno};return yf(e.parser,t,"display")},htmlBuilder:cu,mathmlBuilder:uu});lu({type:"array",names:["CD"],props:{numArgs:0},handler(e){return mS(e),lwe(e.parser)},htmlBuilder:cu,mathmlBuilder:uu});W("\\nonumber","\\gdef\\@eqnsw{0}");W("\\notag","\\nonumber");Jt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new xt(e.funcName+" valid only within array environment")}});var LP=AK;Jt({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 xt("Invalid environment name",s);for(var i="",o=0;o<s.body.length;++o)i+=ar(s.body[o],"textord").text;if(r==="\\begin"){if(!LP.hasOwnProperty(i))throw new xt("No such environment: "+i,s);var a=LP[i],{args:l,optArgs:u}=n.parseArguments("\\begin{"+i+"}",a),d={mode:n.mode,envName:i,parser:n},h=a.handler(d,l,u);n.expect("\\end",!1);var m=n.nextToken,p=ar(n.parseFunction(),"environment");if(p.name!==i)throw new xt("Mismatch: \\begin{"+i+"} matched by \\end{"+p.name+"}",m);return h}return{type:"environment",mode:n.mode,name:i,nameGroup:s}}});var NK=(e,t)=>{var n=e.font,r=t.withFont(n);return ns(e.body,r)},jK=(e,t)=>{var n=e.font,r=t.withFont(n);return _s(e.body,r)},PP={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak"};Jt({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=r_(t[0]),i=r;return i in PP&&(i=PP[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:NK,mathmlBuilder:jK});Jt({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:uS(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:xd(r)}}});Jt({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:NK,mathmlBuilder:jK});var kwe=(e,t)=>{var n=t.style,r=n.fracNum(),s=n.fracDen(),i;i=t.havingStyle(r);var o=ns(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 u=ns(e.denom,i,t),d,h,m;e.hasBarLine?(e.barSize?(h=Ks(e.barSize,t),d=pg("frac-line",t,h)):d=pg("frac-line",t),h=d.height,m=d.height):(d=null,h=0,m=t.fontMetrics().defaultRuleThickness);var p,g,b;n.size===Kn.DISPLAY.size?(p=t.fontMetrics().num1,h>0?g=3*m:g=7*m,b=t.fontMetrics().denom1):(h>0?(p=t.fontMetrics().num2,g=m):(p=t.fontMetrics().num3,g=3*m),b=t.fontMetrics().denom2);var x;if(d){var y=t.fontMetrics().axisHeight;p-o.depth-(y+.5*h)<g&&(p+=g-(p-o.depth-(y+.5*h))),y-.5*h-(u.height-b)<g&&(b+=g-(y-.5*h-(u.height-b)));var w=-(y-.5*h);x=es({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:d,shift:w},{type:"elem",elem:o,shift:-p}]})}else{var v=p-o.depth-(u.height-b);v<g&&(p+=.5*(g-v),b+=.5*(g-v)),x=es({positionType:"individualShift",children:[{type:"elem",elem:u,shift:b},{type:"elem",elem:o,shift:-p}]})}i=t.havingStyle(n),x.height*=i.sizeMultiplier/t.sizeMultiplier,x.depth*=i.sizeMultiplier/t.sizeMultiplier;var k;n.size===Kn.DISPLAY.size?k=t.fontMetrics().delim1:n.size===Kn.SCRIPTSCRIPT.size?k=t.havingStyle(Kn.SCRIPT).fontMetrics().delim2:k=t.fontMetrics().delim2;var T,S;return e.leftDelim==null?T=Py(t,["mopen"]):T=k7(e.leftDelim,k,!0,t.havingStyle(n),e.mode,["mopen"]),e.continued?S=mt([]):e.rightDelim==null?S=Py(t,["mclose"]):S=k7(e.rightDelim,k,!0,t.havingStyle(n),e.mode,["mclose"]),mt(["mord"].concat(i.sizingClasses(t)),[T,mt(["mfrac"],[x]),S],t)},_we=(e,t)=>{var n=new _t("mfrac",[_s(e.numer,t),_s(e.denom,t)]);if(!e.hasBarLine)n.setAttribute("linethickness","0px");else if(e.barSize){var r=Ks(e.barSize,t);n.setAttribute("linethickness",Rt(r))}if(e.leftDelim!=null||e.rightDelim!=null){var s=[];if(e.leftDelim!=null){var i=new _t("mo",[new yi(e.leftDelim.replace("\\",""))]);i.setAttribute("fence","true"),s.push(i)}if(s.push(n),e.rightDelim!=null){var o=new _t("mo",[new yi(e.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),s.push(o)}return bM(s)}return n},IK=(e,t)=>{if(!t)return e;var n={type:"styling",mode:e.mode,style:t,body:[e]};return n};Jt({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 u=r==="\\cfrac",d=null;return u||r.startsWith("\\d")?d="display":r.startsWith("\\t")&&(d="text"),IK({type:"genfrac",mode:n.mode,numer:s,denom:i,continued:u,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:kwe,mathmlBuilder:_we});Jt({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 OP=["display","text","script","scriptscript"],BP=function(t){var n=null;return t.length>0&&(n=t,n=n==="."?null:n),n};Jt({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=r_(t[0]),o=i.type==="atom"&&i.family==="open"?BP(i.text):null,a=r_(t[1]),l=a.type==="atom"&&a.family==="close"?BP(a.text):null,u=ar(t[2],"size"),d,h=null;u.isBlank?d=!0:(h=u.value,d=h.number>0);var m=null,p=t[3];if(p.type==="ordgroup"){if(p.body.length>0){var g=ar(p.body[0],"textord");m=OP[Number(g.text)]}}else p=ar(p,"textord"),m=OP[Number(p.text)];return IK({type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,rightDelim:l},m)}});Jt({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:ar(t[0],"size").value,token:s}}});Jt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(e,t)=>{var{parser:n,funcName:r}=e,s=t[0],i=ar(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 RK=(e,t)=>{var n=t.style,r,s;e.type==="supsub"?(r=e.sup?ns(e.sup,t.havingStyle(n.sup()),t):ns(e.sub,t.havingStyle(n.sub()),t),s=ar(e.base,"horizBrace")):s=ar(e,"horizBrace");var i=ns(s.base,t.havingBaseStyle(Kn.DISPLAY)),o=aS(s,t),a;if(s.isOver?a=es({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:o,wrapperClasses:["svg-align"]}]}):a=es({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=mt(["minner",s.isOver?"mover":"munder"],[a],t);s.isOver?a=es({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=es({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return mt(["minner",s.isOver?"mover":"munder"],[a],t)},Swe=(e,t)=>{var n=oS(e.label);return new _t(e.isOver?"mover":"munder",[_s(e.base,t),n])};Jt({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:RK,mathmlBuilder:Swe});Jt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=t[1],s=ar(t[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:bi(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(e,t)=>{var n=ji(e.body,t,!1);return Oxe(e.href,[],n,t)},mathmlBuilder:(e,t)=>{var n=Jh(e.body,t);return n instanceof _t||(n=new _t("mrow",[n])),n.setAttribute("href",e.href),n}});Jt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(e,t)=>{var{parser:n}=e,r=ar(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:bi(a)}}});Jt({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:bi(t[0])}},htmlBuilder(e,t){var n=ji(e.body,t.withFont(""),!1);return kd(n)},mathmlBuilder(e,t){return new _t("mrow",al(e.body,t.withFont("")))}});Jt({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=ar(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 u=i.split(","),d=0;d<u.length;d++){var h=u[d],m=h.indexOf("=");if(m<0)throw new xt("\\htmlData key/value '"+h+"' missing equals sign");var p=h.slice(0,m),g=h.slice(m+1);l["data-"+p.trim()]=g}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:bi(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(e,t)=>{var n=ji(e.body,t,!1),r=["enclosing"];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/));var s=mt(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)=>Jh(e.body,t)});Jt({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:bi(t[0]),mathml:bi(t[1])}},htmlBuilder:(e,t)=>{var n=ji(e.html,t,!1);return kd(n)},mathmlBuilder:(e,t)=>Jh(e.mathml,t)});var q5=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 xt("Invalid size: '"+t+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!YG(r))throw new xt("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Jt({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=ar(n[0],"raw").string,u=l.split(","),d=0;d<u.length;d++){var h=u[d].split("=");if(h.length===2){var m=h[1].trim();switch(h[0].trim()){case"alt":a=m;break;case"width":s=q5(m);break;case"height":i=q5(m);break;case"totalheight":o=q5(m);break;default:throw new xt("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var p=ar(t[0],"url").url;return a===""&&(a=p,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:p})?{type:"includegraphics",mode:r.mode,alt:a,width:s,height:i,totalheight:o,src:p}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(e,t)=>{var n=Ks(e.height,t),r=0;e.totalheight.number>0&&(r=Ks(e.totalheight,t)-n);var s=0;e.width.number>0&&(s=Ks(e.width,t));var i={height:Rt(n+r)};s>0&&(i.width=Rt(s)),r>0&&(i.verticalAlign=Rt(-r));var o=new Txe(e.src,e.alt,i);return o.height=n,o.depth=r,o},mathmlBuilder:(e,t)=>{var n=new _t("mglyph",[]);n.setAttribute("alt",e.alt);var r=Ks(e.height,t),s=0;if(e.totalheight.number>0&&(s=Ks(e.totalheight,t)-r,n.setAttribute("valign",Rt(-s))),n.setAttribute("height",Rt(r+s)),e.width.number>0){var i=Ks(e.width,t);n.setAttribute("width",Rt(i))}return n.setAttribute("src",e.src),n}});Jt({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=ar(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 nK(e.dimension,t)},mathmlBuilder(e,t){var n=Ks(e.dimension,t);return new lK(n)}});Jt({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=mt([],[ns(e.body,t)]),n=mt(["inner"],[n],t)):n=mt(["inner"],[ns(e.body,t)]);var r=mt(["fix"],[]),s=mt([e.alignment],[n,r],t),i=mt(["strut"]);return i.style.height=Rt(s.height+s.depth),s.depth&&(i.style.verticalAlign=Rt(-s.depth)),s.children.unshift(i),s=mt(["thinbox"],[s],t),mt(["mord","vbox"],[s],t)},mathmlBuilder:(e,t)=>{var n=new _t("mpadded",[_s(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}});Jt({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}}});Jt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new xt("Mismatched "+e.funcName)}});var $P=(e,t)=>{switch(t.style.size){case Kn.DISPLAY.size:return e.display;case Kn.TEXT.size:return e.text;case Kn.SCRIPT.size:return e.script;case Kn.SCRIPTSCRIPT.size:return e.scriptscript;default:return e.text}};Jt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(e,t)=>{var{parser:n}=e;return{type:"mathchoice",mode:n.mode,display:bi(t[0]),text:bi(t[1]),script:bi(t[2]),scriptscript:bi(t[3])}},htmlBuilder:(e,t)=>{var n=$P(e,t),r=ji(n,t,!1);return kd(r)},mathmlBuilder:(e,t)=>{var n=$P(e,t);return Jh(n,t)}});var DK=(e,t,n,r,s,i,o)=>{e=mt([],[e]);var a=n&&xd(n),l,u;if(t){var d=ns(t,r.havingStyle(s.sup()),r);u={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=ns(n,r.havingStyle(s.sub()),r);l={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}var m;if(u&&l){var p=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+e.depth+o;m=es({positionType:"bottom",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Rt(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Rt(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var g=e.height-o;m=es({positionType:"top",positionData:g,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Rt(-i)},{type:"kern",size:l.kern},{type:"elem",elem:e}]})}else if(u){var b=e.depth+o;m=es({positionType:"bottom",positionData:b,children:[{type:"elem",elem:e},{type:"kern",size:u.kern},{type:"elem",elem:u.elem,marginLeft:Rt(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return e;var x=[m];if(l&&i!==0&&!a){var v=mt(["mspace"],[],r);v.style.marginRight=Rt(i),x.unshift(v)}return mt(["mop","op-limits"],x,r)},LK=new Set(["\\smallint"]),Xg=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=ar(e.base,"op"),s=!0):i=ar(e,"op");var o=t.style,a=!1;o.size===Kn.DISPLAY.size&&i.symbol&&!LK.has(i.name)&&(a=!0);var l,u;if(i.symbol){var d=a?"Size2-Regular":"Size1-Regular",h="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(h=i.name.slice(1),i.name=h==="oiint"?"\\iint":"\\iiint"),l=Lo(i.name,d,"math",t,["mop","op-symbol",a?"large-op":"small-op"]),u=l.italic,h.length>0){var m=sK(h+"Size"+(a?"2":"1"),t);l=es({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),i.name="\\"+h,l.classes.unshift("mop"),l.italic=u}}else if(i.body){var p=ji(i.body,t,!0);p.length===1&&p[0]instanceof rl?(l=p[0],l.classes[0]="mop"):l=mt(["mop"],p,t)}else{for(var g=[],b=1;b<i.name.length;b++)g.push(pM(i.name[b],i.mode,t));l=mt(["mop"],g,t)}var x=0,v=0;if((l instanceof rl||i.name==="\\oiint"||i.name==="\\oiiint")&&!i.suppressBaseShift){var y;x=(l.height-l.depth)/2-t.fontMetrics().axisHeight,v=(y=l.italic)!=null?y:0}return s?DK(l,n,r,t,o,v,x):(x&&(l.style.position="relative",l.style.top=Rt(x)),l)},Ov=(e,t)=>{var n;if(e.symbol)n=new _t("mo",[$l(e.name,e.mode)]),LK.has(e.name)&&n.setAttribute("largeop","false");else if(e.body)n=new _t("mo",al(e.body,t));else{n=new _t("mi",[new yi(e.name.slice(1))]);var r=new _t("mo",[$l("⁡","text")]);e.parentIsSupSub?n=new _t("mrow",[n,r]):n=aK([n,r])}return n},Cwe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Jt({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=Cwe[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Xg,mathmlBuilder:Ov});Jt({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:bi(r)}},htmlBuilder:Xg,mathmlBuilder:Ov});var Twe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Jt({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:Xg,mathmlBuilder:Ov});Jt({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:Xg,mathmlBuilder:Ov});Jt({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=Twe[r]),{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Xg,mathmlBuilder:Ov});var PK=(e,t)=>{var n,r,s=!1,i;e.type==="supsub"?(n=e.sup,r=e.sub,i=ar(e.base,"operatorname"),s=!0):i=ar(e,"operatorname");var o;if(i.body.length>0){for(var a=i.body.map(h=>{var m="text"in h?h.text:void 0;return typeof m=="string"?{type:"textord",mode:h.mode,text:m}:h}),l=ji(a,t.withFont("mathrm"),!0),u=0;u<l.length;u++){var d=l[u];d instanceof rl&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=mt(["mop"],l,t)}else o=mt(["mop"],[],t);return s?DK(o,n,r,t,t.style,0,0):o},Awe=(e,t)=>{for(var n=al(e.body,t.withFont("mathrm")),r=!0,s=0;s<n.length;s++){var i=n[s];if(!(i instanceof lK))if(i instanceof _t)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 yi?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(d=>d.toText()).join("");n=[new yi(a)]}var l=new _t("mi",n);l.setAttribute("mathvariant","normal");var u=new _t("mo",[$l("⁡","text")]);return e.parentIsSupSub?new _t("mrow",[l,u]):aK([l,u])};Jt({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:bi(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:PK,mathmlBuilder:Awe});W("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");mp({type:"ordgroup",htmlBuilder(e,t){return e.semisimple?kd(ji(e.body,t,!1)):mt(["mord"],ji(e.body,t,!0),t)},mathmlBuilder(e,t){return Jh(e.body,t,!0)}});Jt({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=ns(e.body,t.havingCrampedStyle()),r=pg("overline-line",t),s=t.fontMetrics().defaultRuleThickness,i=es({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]});return mt(["mord","overline"],[i],t)},mathmlBuilder(e,t){var n=new _t("mo",[new yi("‾")]);n.setAttribute("stretchy","true");var r=new _t("mover",[_s(e.body,t),n]);return r.setAttribute("accent","true"),r}});Jt({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:bi(r)}},htmlBuilder:(e,t)=>{var n=ji(e.body,t.withPhantom(),!1);return kd(n)},mathmlBuilder:(e,t)=>{var n=al(e.body,t);return new _t("mphantom",n)}});W("\\hphantom","\\smash{\\phantom{#1}}");Jt({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=mt(["inner"],[ns(e.body,t.withPhantom())]),r=mt(["fix"],[]);return mt(["mord","rlap"],[n,r],t)},mathmlBuilder:(e,t)=>{var n=al(bi(e.body),t),r=new _t("mphantom",n),s=new _t("mpadded",[r]);return s.setAttribute("width","0px"),s}});Jt({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(e,t){var{parser:n}=e,r=ar(t[0],"size").value,s=t[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(e,t){var n=ns(e.body,t),r=Ks(e.dy,t);return es({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new _t("mpadded",[_s(e.body,t)]),r=e.dy.number+e.dy.unit;return n.setAttribute("voffset",r),n}});Jt({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(e){var{parser:t}=e;return{type:"internal",mode:t.mode}}});Jt({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=ar(t[0],"size"),o=ar(t[1],"size");return{type:"rule",mode:r.mode,shift:s&&ar(s,"size").value,width:i.value,height:o.value}},htmlBuilder(e,t){var n=mt(["mord","rule"],[],t),r=Ks(e.width,t),s=Ks(e.height,t),i=e.shift?Ks(e.shift,t):0;return n.style.borderRightWidth=Rt(r),n.style.borderTopWidth=Rt(s),n.style.bottom=Rt(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*t.sizeMultiplier,n},mathmlBuilder(e,t){var n=Ks(e.width,t),r=Ks(e.height,t),s=e.shift?Ks(e.shift,t):0,i=t.color&&t.getColor()||"black",o=new _t("mspace");o.setAttribute("mathbackground",i),o.setAttribute("width",Rt(n)),o.setAttribute("height",Rt(r));var a=new _t("mpadded",[o]);return s>=0?a.setAttribute("height",Rt(s)):(a.setAttribute("height",Rt(s)),a.setAttribute("depth",Rt(-s))),a.setAttribute("voffset",Rt(s)),a}});function OK(e,t,n){for(var r=ji(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 kd(r)}var zP=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Ewe=(e,t)=>{var n=t.havingSize(e.size);return OK(e.body,n,t)};Jt({type:"sizing",names:zP,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:zP.indexOf(r)+1,body:i}},htmlBuilder:Ewe,mathmlBuilder:(e,t)=>{var n=t.havingSize(e.size),r=al(e.body,n),s=new _t("mstyle",r);return s.setAttribute("mathsize",Rt(n.sizeMultiplier)),s}});Jt({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]&&ar(n[0],"ordgroup");if(o)for(var a,l=0;l<o.body.length;++l){var u=o.body[l];if(a=lS(u).text,a==="t")s=!0;else if(a==="b")i=!0;else{s=!1,i=!1;break}}else s=!0,i=!0;var d=t[0];return{type:"smash",mode:r.mode,body:d,smashHeight:s,smashDepth:i}},htmlBuilder:(e,t)=>{var n=mt([],[ns(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 mt(["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=es({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return mt(["mord"],[s],t)},mathmlBuilder:(e,t)=>{var n=new _t("mpadded",[_s(e.body,t)]);return e.smashHeight&&n.setAttribute("height","0px"),e.smashDepth&&n.setAttribute("depth","0px"),n}});Jt({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=ns(e.body,t.havingCrampedStyle());n.height===0&&(n.height=t.fontMetrics().xHeight),n=gg(n,t);var r=t.fontMetrics(),s=r.defaultRuleThickness,i=s;t.style.id<Kn.TEXT.id&&(i=t.fontMetrics().xHeight);var o=s+i/4,a=n.height+n.depth+o+s,{span:l,ruleWidth:u,advanceWidth:d}=mwe(a,t),h=l.height-u;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var m=l.height-n.height-o-u;n.style.paddingLeft=Rt(d);var p=es({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+m)},{type:"elem",elem:l},{type:"kern",size:u}]});if(e.index){var g=t.havingStyle(Kn.SCRIPTSCRIPT),b=ns(e.index,g,t),x=.6*(p.height-p.depth),v=es({positionType:"shift",positionData:-x,children:[{type:"elem",elem:b}]}),y=mt(["root"],[v]);return mt(["mord","sqrt"],[y,p],t)}else return mt(["mord","sqrt"],[p],t)},mathmlBuilder(e,t){var{body:n,index:r}=e;return r?new _t("mroot",[_s(n,t),_s(r,t)]):new _t("msqrt",[_s(n,t)])}});var _7={display:Kn.DISPLAY,text:Kn.TEXT,script:Kn.SCRIPT,scriptscript:Kn.SCRIPTSCRIPT};function Mwe(e){return e in _7}Jt({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(!Mwe(o))throw new Error("Unknown style: "+o);return{type:"styling",mode:s.mode,style:o,body:i}},htmlBuilder(e,t){var n=_7[e.style],r=t.havingStyle(n);return e.resetFont&&(r=r.withFont("")),OK(e.body,r,t)},mathmlBuilder(e,t){var n=_7[e.style],r=t.havingStyle(n);e.resetFont&&(r=r.withFont(""));var s=al(e.body,r),i=new _t("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 Nwe=function(t,n){var r=t.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===Kn.DISPLAY.size||r.alwaysHandleSupSub);return s?Xg:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===Kn.DISPLAY.size||r.limits);return i?PK:null}else{if(r.type==="accent")return xd(r.base)?vM:null;if(r.type==="horizBrace"){var o=!t.sub;return o===r.isOver?RK:null}else return null}else return null};mp({type:"supsub",htmlBuilder(e,t){var n=Nwe(e,t);if(n)return n(e,t);var{base:r,sup:s,sub:i}=e,o=ns(r,t),a,l,u=t.fontMetrics(),d=0,h=0,m=r&&xd(r);if(s){var p=t.havingStyle(t.style.sup());a=ns(s,p,t),m||(d=o.height-p.fontMetrics().supDrop*p.sizeMultiplier/t.sizeMultiplier)}if(i){var g=t.havingStyle(t.style.sub());l=ns(i,g,t),m||(h=o.depth+g.fontMetrics().subDrop*g.sizeMultiplier/t.sizeMultiplier)}var b;t.style===Kn.DISPLAY?b=u.sup1:t.style.cramped?b=u.sup3:b=u.sup2;var x=t.sizeMultiplier,v=Rt(.5/u.ptPerEm/x),y=null;if(l){var w=e.base&&e.base.type==="op"&&e.base.name&&(e.base.name==="\\oiint"||e.base.name==="\\oiiint");if(o instanceof rl||w){var k;y=Rt(-((k=o.italic)!=null?k:0))}}var T;if(a&&l){d=Math.max(d,b,a.depth+.25*u.xHeight),h=Math.max(h,u.sub2);var S=u.defaultRuleThickness,C=4*S;if(d-a.depth-(l.height-h)<C){h=C-(d-a.depth)+l.height;var _=.8*u.xHeight-(d-a.depth);_>0&&(d+=_,h-=_)}var A=[{type:"elem",elem:l,shift:h,marginRight:v,marginLeft:y},{type:"elem",elem:a,shift:-d,marginRight:v}];T=es({positionType:"individualShift",children:A})}else if(l){h=Math.max(h,u.sub1,l.height-.8*u.xHeight);var M=[{type:"elem",elem:l,marginLeft:y,marginRight:v}];T=es({positionType:"shift",positionData:h,children:M})}else if(a)d=Math.max(d,b,a.depth+.25*u.xHeight),T=es({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:v}]});else throw new Error("supsub must have either sup or sub.");var L=y7(o,"right")||"mord";return mt([L],[o,mt(["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=[_s(e.base,t)];e.sub&&i.push(_s(e.sub,t)),e.sup&&i.push(_s(e.sup,t));var o;if(n)o=r?"mover":"munder";else if(e.sub)if(e.sup){var u=e.base;u&&u.type==="op"&&u.limits&&t.style===Kn.DISPLAY||u&&u.type==="operatorname"&&u.alwaysHandleSupSub&&(t.style===Kn.DISPLAY||u.limits)?o="munderover":o="msubsup"}else{var l=e.base;l&&l.type==="op"&&l.limits&&(t.style===Kn.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||t.style===Kn.DISPLAY)?o="munder":o="msub"}else{var a=e.base;a&&a.type==="op"&&a.limits&&(t.style===Kn.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||t.style===Kn.DISPLAY)?o="mover":o="msup"}return new _t(o,i)}});mp({type:"atom",htmlBuilder(e,t){return pM(e.text,e.mode,t,["m"+e.family])},mathmlBuilder(e,t){var n=new _t("mo",[$l(e.text,e.mode)]);if(e.family==="bin"){var r=yM(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 BK={mi:"italic",mn:"normal",mtext:"normal"};mp({type:"mathord",htmlBuilder(e,t){return iS(e,t,"mathord")},mathmlBuilder(e,t){var n=new _t("mi",[$l(e.text,e.mode,t)]),r=yM(e,t)||"italic";return r!==BK[n.type]&&n.setAttribute("mathvariant",r),n}});mp({type:"textord",htmlBuilder(e,t){return iS(e,t,"textord")},mathmlBuilder(e,t){var n=$l(e.text,e.mode,t),r=yM(e,t)||"normal",s;return e.mode==="text"?s=new _t("mtext",[n]):/[0-9]/.test(e.text)?s=new _t("mn",[n]):e.text==="\\prime"?s=new _t("mo",[n]):s=new _t("mi",[n]),r!==BK[s.type]&&s.setAttribute("mathvariant",r),s}});var H5={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},U5={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};mp({type:"spacing",htmlBuilder(e,t){if(U5.hasOwnProperty(e.text)){var n=U5[e.text].className||"";if(e.mode==="text"){var r=iS(e,t,"textord");return r.classes.push(n),r}else return mt(["mspace",n],[pM(e.text,e.mode,t)],t)}else{if(H5.hasOwnProperty(e.text))return mt(["mspace",H5[e.text]],[],t);throw new xt('Unknown type of space "'+e.text+'"')}},mathmlBuilder(e,t){var n;if(U5.hasOwnProperty(e.text))n=new _t("mtext",[new yi(" ")]);else{if(H5.hasOwnProperty(e.text))return new _t("mspace");throw new xt('Unknown type of space "'+e.text+'"')}return n}});var FP=()=>{var e=new _t("mtd",[]);return e.setAttribute("width","50%"),e};mp({type:"tag",mathmlBuilder(e,t){var n=new _t("mtable",[new _t("mtr",[FP(),new _t("mtd",[Jh(e.body,t)]),FP(),new _t("mtd",[Jh(e.tag,t)])])]);return n.setAttribute("width","100%"),n}});var qP={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},HP={"\\textbf":"textbf","\\textmd":"textmd"},jwe={"\\textit":"textit","\\textup":"textup"},UP=(e,t)=>{var n=e.font;if(n){if(qP[n])return t.withTextFontFamily(qP[n]);if(HP[n])return t.withTextFontWeight(HP[n]);if(n==="\\emph")return t.fontShape==="textit"?t.withTextFontShape("textup"):t.withTextFontShape("textit")}else return t;return t.withTextFontShape(jwe[n])};Jt({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:bi(s),font:r}},htmlBuilder(e,t){var n=UP(e,t),r=ji(e.body,n,!0);return mt(["mord","text"],r,n)},mathmlBuilder(e,t){var n=UP(e,t);return Jh(e.body,n)}});Jt({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=ns(e.body,t),r=pg("underline-line",t),s=t.fontMetrics().defaultRuleThickness,i=es({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]});return mt(["mord","underline"],[i],t)},mathmlBuilder(e,t){var n=new _t("mo",[new yi("‾")]);n.setAttribute("stretchy","true");var r=new _t("munder",[_s(e.body,t),n]);return r.setAttribute("accentunder","true"),r}});Jt({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=ns(e.body,t),r=t.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return es({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]})},mathmlBuilder(e,t){var n=new _t("mpadded",[_s(e.body,t)],["vcenter"]);return new _t("mrow",[n])}});Jt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new xt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(e,t){for(var n=VP(e),r=[],s=t.havingStyle(t.style.text()),i=0;i<n.length;i++){var o=n[i];o==="~"&&(o="\\textasciitilde"),r.push(Lo(o,"Typewriter-Regular",e.mode,s,["mord","texttt"]))}return mt(["mord","text"].concat(s.sizingClasses(t)),tK(r),s)},mathmlBuilder(e,t){var n=new yi(VP(e)),r=new _t("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var VP=e=>e.body.replace(/ /g,e.star?"␣":" "),kh=iK,$K=`[ \r
	]`,Iwe="\\\\[a-zA-Z@]+",Rwe="\\\\[^\uD800-\uDFFF]",Dwe="("+Iwe+")"+$K+"*",Lwe=`\\\\(
|[ \r	]+
?)[ \r	]*`,S7="[̀-ͯ]",Pwe=new RegExp(S7+"+$"),Owe="("+$K+"+)|"+(Lwe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(S7+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(S7+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Dwe)+("|"+Rwe+")");class WP{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(Owe,"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 el("EOF",new da(this,n,n));var r=this.tokenRegex.exec(t);if(r===null||r.index!==n)throw new xt("Unexpected character: '"+t[n]+"'",new el(t[n],new da(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 el(s,new da(this,n,this.tokenRegex.lastIndex))}}class Bwe{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 xt("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 $we=EK;W("\\noexpand",function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}});W("\\expandafter",function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}});W("\\@firstoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[0],numArgs:0}});W("\\@secondoftwo",function(e){var t=e.consumeArgs(2);return{tokens:t[1],numArgs:0}});W("\\@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}});W("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");W("\\TextOrMath",function(e){var t=e.consumeArgs(2);return e.mode==="text"?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var GP={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};W("\\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 xt("\\char` missing argument");r=t.text.charCodeAt(0)}else n=10;if(n){if(r=GP[t.text],r==null||r>=n)throw new xt("Invalid base-"+n+" digit "+t.text);for(var s;(s=GP[e.future().text])!=null&&s<n;)r*=n,r+=s,e.popToken()}return"\\@char{"+r+"}"});var _M=(e,t,n,r)=>{var s=e.consumeArg().tokens;if(s.length!==1)throw new xt("\\newcommand's first argument must be a macro name");var i=s[0].text,o=e.isDefined(i);if(o&&!t)throw new xt("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!o&&!n)throw new xt("\\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="",u=e.expandNextToken();u.text!=="]"&&u.text!=="EOF";)l+=u.text,u=e.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new xt("Invalid number of arguments: "+l);a=parseInt(l),s=e.consumeArg().tokens}return o&&r||e.macros.set(i,{tokens:s,numArgs:a}),""};W("\\newcommand",e=>_M(e,!1,!0,!1));W("\\renewcommand",e=>_M(e,!0,!1,!1));W("\\providecommand",e=>_M(e,!0,!0,!0));W("\\message",e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(n=>n.text).join("")),""});W("\\errmessage",e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(n=>n.text).join("")),""});W("\\show",e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),kh[n],zs.math[n],zs.text[n]),""});W("\\bgroup","{");W("\\egroup","}");W("~","\\nobreakspace");W("\\lq","`");W("\\rq","'");W("\\aa","\\r a");W("\\AA","\\r A");W("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");W("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");W("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");W("ℬ","\\mathscr{B}");W("ℰ","\\mathscr{E}");W("ℱ","\\mathscr{F}");W("ℋ","\\mathscr{H}");W("ℐ","\\mathscr{I}");W("ℒ","\\mathscr{L}");W("ℳ","\\mathscr{M}");W("ℛ","\\mathscr{R}");W("ℭ","\\mathfrak{C}");W("ℌ","\\mathfrak{H}");W("ℨ","\\mathfrak{Z}");W("\\Bbbk","\\Bbb{k}");W("\\llap","\\mathllap{\\textrm{#1}}");W("\\rlap","\\mathrlap{\\textrm{#1}}");W("\\clap","\\mathclap{\\textrm{#1}}");W("\\mathstrut","\\vphantom{(}");W("\\underbar","\\underline{\\text{#1}}");W("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');W("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");W("\\ne","\\neq");W("≠","\\neq");W("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");W("∉","\\notin");W("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");W("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");W("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");W("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");W("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");W("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");W("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");W("⟂","\\perp");W("‼","\\mathclose{!\\mkern-0.8mu!}");W("∌","\\notni");W("⌜","\\ulcorner");W("⌝","\\urcorner");W("⌞","\\llcorner");W("⌟","\\lrcorner");W("©","\\copyright");W("®","\\textregistered");W("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');W("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');W("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');W("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');W("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");W("⋮","\\vdots");W("\\varGamma","\\mathit{\\Gamma}");W("\\varDelta","\\mathit{\\Delta}");W("\\varTheta","\\mathit{\\Theta}");W("\\varLambda","\\mathit{\\Lambda}");W("\\varXi","\\mathit{\\Xi}");W("\\varPi","\\mathit{\\Pi}");W("\\varSigma","\\mathit{\\Sigma}");W("\\varUpsilon","\\mathit{\\Upsilon}");W("\\varPhi","\\mathit{\\Phi}");W("\\varPsi","\\mathit{\\Psi}");W("\\varOmega","\\mathit{\\Omega}");W("\\substack","\\begin{subarray}{c}#1\\end{subarray}");W("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");W("\\boxed","\\fbox{$\\displaystyle{#1}$}");W("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");W("\\implies","\\DOTSB\\;\\Longrightarrow\\;");W("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");W("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");W("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var KP={",":"\\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"},zwe=new Set(["bin","rel"]);W("\\dots",function(e){var t="\\dotso",n=e.expandAfterFuture().text;return n in KP?t=KP[n]:(n.slice(0,4)==="\\not"||n in zs.math&&zwe.has(zs.math[n].group))&&(t="\\dotsb"),t});var SM={")":!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};W("\\dotso",function(e){var t=e.future().text;return t in SM?"\\ldots\\,":"\\ldots"});W("\\dotsc",function(e){var t=e.future().text;return t in SM&&t!==","?"\\ldots\\,":"\\ldots"});W("\\cdots",function(e){var t=e.future().text;return t in SM?"\\@cdots\\,":"\\@cdots"});W("\\dotsb","\\cdots");W("\\dotsm","\\cdots");W("\\dotsi","\\!\\cdots");W("\\dotsx","\\ldots\\,");W("\\DOTSI","\\relax");W("\\DOTSB","\\relax");W("\\DOTSX","\\relax");W("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");W("\\,","\\tmspace+{3mu}{.1667em}");W("\\thinspace","\\,");W("\\>","\\mskip{4mu}");W("\\:","\\tmspace+{4mu}{.2222em}");W("\\medspace","\\:");W("\\;","\\tmspace+{5mu}{.2777em}");W("\\thickspace","\\;");W("\\!","\\tmspace-{3mu}{.1667em}");W("\\negthinspace","\\!");W("\\negmedspace","\\tmspace-{4mu}{.2222em}");W("\\negthickspace","\\tmspace-{5mu}{.277em}");W("\\enspace","\\kern.5em ");W("\\enskip","\\hskip.5em\\relax");W("\\quad","\\hskip1em\\relax");W("\\qquad","\\hskip2em\\relax");W("\\tag","\\@ifstar\\tag@literal\\tag@paren");W("\\tag@paren","\\tag@literal{({#1})}");W("\\tag@literal",e=>{if(e.macros.get("\\df@tag"))throw new xt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});W("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");W("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");W("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");W("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");W("\\newline","\\\\\\relax");W("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var zK=Rt(qc["Main-Regular"][84][1]-.7*qc["Main-Regular"][65][1]);W("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+zK+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");W("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+zK+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");W("\\hspace","\\@ifstar\\@hspacer\\@hspace");W("\\@hspace","\\hskip #1\\relax");W("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");W("\\ordinarycolon",":");W("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");W("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');W("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');W("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');W("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');W("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');W("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');W("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');W("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');W("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');W("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');W("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');W("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');W("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');W("∷","\\dblcolon");W("∹","\\eqcolon");W("≔","\\coloneqq");W("≕","\\eqqcolon");W("⩴","\\Coloneqq");W("\\ratio","\\vcentcolon");W("\\coloncolon","\\dblcolon");W("\\colonequals","\\coloneqq");W("\\coloncolonequals","\\Coloneqq");W("\\equalscolon","\\eqqcolon");W("\\equalscoloncolon","\\Eqqcolon");W("\\colonminus","\\coloneq");W("\\coloncolonminus","\\Coloneq");W("\\minuscolon","\\eqcolon");W("\\minuscoloncolon","\\Eqcolon");W("\\coloncolonapprox","\\Colonapprox");W("\\coloncolonsim","\\Colonsim");W("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");W("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");W("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");W("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");W("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");W("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");W("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");W("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");W("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");W("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");W("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");W("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");W("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");W("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");W("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");W("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");W("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");W("\\nleqq","\\html@mathml{\\@nleqq}{≰}");W("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");W("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");W("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");W("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");W("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");W("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");W("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");W("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");W("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");W("\\imath","\\html@mathml{\\@imath}{ı}");W("\\jmath","\\html@mathml{\\@jmath}{ȷ}");W("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");W("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");W("⟦","\\llbracket");W("⟧","\\rrbracket");W("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");W("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");W("⦃","\\lBrace");W("⦄","\\rBrace");W("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");W("⦵","\\minuso");W("\\darr","\\downarrow");W("\\dArr","\\Downarrow");W("\\Darr","\\Downarrow");W("\\lang","\\langle");W("\\rang","\\rangle");W("\\uarr","\\uparrow");W("\\uArr","\\Uparrow");W("\\Uarr","\\Uparrow");W("\\N","\\mathbb{N}");W("\\R","\\mathbb{R}");W("\\Z","\\mathbb{Z}");W("\\alef","\\aleph");W("\\alefsym","\\aleph");W("\\Alpha","\\mathrm{A}");W("\\Beta","\\mathrm{B}");W("\\bull","\\bullet");W("\\Chi","\\mathrm{X}");W("\\clubs","\\clubsuit");W("\\cnums","\\mathbb{C}");W("\\Complex","\\mathbb{C}");W("\\Dagger","\\ddagger");W("\\diamonds","\\diamondsuit");W("\\empty","\\emptyset");W("\\Epsilon","\\mathrm{E}");W("\\Eta","\\mathrm{H}");W("\\exist","\\exists");W("\\harr","\\leftrightarrow");W("\\hArr","\\Leftrightarrow");W("\\Harr","\\Leftrightarrow");W("\\hearts","\\heartsuit");W("\\image","\\Im");W("\\infin","\\infty");W("\\Iota","\\mathrm{I}");W("\\isin","\\in");W("\\Kappa","\\mathrm{K}");W("\\larr","\\leftarrow");W("\\lArr","\\Leftarrow");W("\\Larr","\\Leftarrow");W("\\lrarr","\\leftrightarrow");W("\\lrArr","\\Leftrightarrow");W("\\Lrarr","\\Leftrightarrow");W("\\Mu","\\mathrm{M}");W("\\natnums","\\mathbb{N}");W("\\Nu","\\mathrm{N}");W("\\Omicron","\\mathrm{O}");W("\\plusmn","\\pm");W("\\rarr","\\rightarrow");W("\\rArr","\\Rightarrow");W("\\Rarr","\\Rightarrow");W("\\real","\\Re");W("\\reals","\\mathbb{R}");W("\\Reals","\\mathbb{R}");W("\\Rho","\\mathrm{P}");W("\\sdot","\\cdot");W("\\sect","\\S");W("\\spades","\\spadesuit");W("\\sub","\\subset");W("\\sube","\\subseteq");W("\\supe","\\supseteq");W("\\Tau","\\mathrm{T}");W("\\thetasym","\\vartheta");W("\\weierp","\\wp");W("\\Zeta","\\mathrm{Z}");W("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");W("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");W("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");W("\\bra","\\mathinner{\\langle{#1}|}");W("\\ket","\\mathinner{|{#1}\\rangle}");W("\\braket","\\mathinner{\\langle{#1}\\rangle}");W("\\Bra","\\left\\langle#1\\right|");W("\\Ket","\\left|#1\\right\\rangle");var FK=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=h=>m=>{e&&(m.macros.set("|",o),s.length&&m.macros.set("\\|",a));var p=h;if(!h&&s.length){var g=m.future();g.text==="|"&&(m.popToken(),p=!0)}return{tokens:p?s:r,numArgs:0}};t.macros.set("|",l(!1)),s.length&&t.macros.set("\\|",l(!0));var u=t.consumeArg().tokens,d=t.expandTokens([...i,...u,...n]);return t.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};W("\\bra@ket",FK(!1));W("\\bra@set",FK(!0));W("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");W("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");W("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");W("\\angln","{\\angl n}");W("\\blue","\\textcolor{##6495ed}{#1}");W("\\orange","\\textcolor{##ffa500}{#1}");W("\\pink","\\textcolor{##ff00af}{#1}");W("\\red","\\textcolor{##df0030}{#1}");W("\\green","\\textcolor{##28ae7b}{#1}");W("\\gray","\\textcolor{gray}{#1}");W("\\purple","\\textcolor{##9d38bd}{#1}");W("\\blueA","\\textcolor{##ccfaff}{#1}");W("\\blueB","\\textcolor{##80f6ff}{#1}");W("\\blueC","\\textcolor{##63d9ea}{#1}");W("\\blueD","\\textcolor{##11accd}{#1}");W("\\blueE","\\textcolor{##0c7f99}{#1}");W("\\tealA","\\textcolor{##94fff5}{#1}");W("\\tealB","\\textcolor{##26edd5}{#1}");W("\\tealC","\\textcolor{##01d1c1}{#1}");W("\\tealD","\\textcolor{##01a995}{#1}");W("\\tealE","\\textcolor{##208170}{#1}");W("\\greenA","\\textcolor{##b6ffb0}{#1}");W("\\greenB","\\textcolor{##8af281}{#1}");W("\\greenC","\\textcolor{##74cf70}{#1}");W("\\greenD","\\textcolor{##1fab54}{#1}");W("\\greenE","\\textcolor{##0d923f}{#1}");W("\\goldA","\\textcolor{##ffd0a9}{#1}");W("\\goldB","\\textcolor{##ffbb71}{#1}");W("\\goldC","\\textcolor{##ff9c39}{#1}");W("\\goldD","\\textcolor{##e07d10}{#1}");W("\\goldE","\\textcolor{##a75a05}{#1}");W("\\redA","\\textcolor{##fca9a9}{#1}");W("\\redB","\\textcolor{##ff8482}{#1}");W("\\redC","\\textcolor{##f9685d}{#1}");W("\\redD","\\textcolor{##e84d39}{#1}");W("\\redE","\\textcolor{##bc2612}{#1}");W("\\maroonA","\\textcolor{##ffbde0}{#1}");W("\\maroonB","\\textcolor{##ff92c6}{#1}");W("\\maroonC","\\textcolor{##ed5fa6}{#1}");W("\\maroonD","\\textcolor{##ca337c}{#1}");W("\\maroonE","\\textcolor{##9e034e}{#1}");W("\\purpleA","\\textcolor{##ddd7ff}{#1}");W("\\purpleB","\\textcolor{##c6b9fc}{#1}");W("\\purpleC","\\textcolor{##aa87ff}{#1}");W("\\purpleD","\\textcolor{##7854ab}{#1}");W("\\purpleE","\\textcolor{##543b78}{#1}");W("\\mintA","\\textcolor{##f5f9e8}{#1}");W("\\mintB","\\textcolor{##edf2df}{#1}");W("\\mintC","\\textcolor{##e0e5cc}{#1}");W("\\grayA","\\textcolor{##f6f7f7}{#1}");W("\\grayB","\\textcolor{##f0f1f2}{#1}");W("\\grayC","\\textcolor{##e3e5e6}{#1}");W("\\grayD","\\textcolor{##d6d8da}{#1}");W("\\grayE","\\textcolor{##babec2}{#1}");W("\\grayF","\\textcolor{##888d93}{#1}");W("\\grayG","\\textcolor{##626569}{#1}");W("\\grayH","\\textcolor{##3b3e40}{#1}");W("\\grayI","\\textcolor{##21242c}{#1}");W("\\kaBlue","\\textcolor{##314453}{#1}");W("\\kaGreen","\\textcolor{##71B307}{#1}");var qK={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Fwe{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 Bwe($we,n.macros),this.mode=r,this.stack=[]}feed(t){this.lexer=new WP(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 el("EOF",r.loc)),this.pushTokens(s),new el("",da.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 xt("Extra }",i)}else if(i.text==="EOF")throw new xt("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 xt("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 xt("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 xt("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 xt("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 xt("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 xt("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 el(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 WP(s,this.settings),l=[],u=a.lex();u.text!=="EOF";)l.push(u),u=a.lex();l.reverse();var d={tokens:l,numArgs:i};return d}return s}isDefined(t){return this.macros.has(t)||kh.hasOwnProperty(t)||zs.math.hasOwnProperty(t)||zs.text.hasOwnProperty(t)||qK.hasOwnProperty(t)}isExpandable(t){var n=this.macros.get(t);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:kh.hasOwnProperty(t)&&!kh[t].primitive}}var YP=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,cw=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),V5={"́":{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"}},XP={á:"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 HK=class UK{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 Fwe(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 xt("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 el("}")),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(UK.endOfExpression.has(s.text)||n&&s.text===n||t&&kh[s.text]&&kh[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 xt("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),u=t.slice(n+1);l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l},u.length===1&&u[0].type==="ordgroup"?a=u[0]:a={type:"ordgroup",mode:this.mode,body:u};var d;return r==="\\\\abovefrac"?d=this.callFunction(r,[o,t[n],a],[]):d=this.callFunction(r,[o,a],[]),[d]}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 xt("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 xt("Limit controls must follow a math operator",i);this.consume()}else if(i.text==="^"){if(r)throw new xt("Double superscript",i);r=this.handleSupSubscript("superscript")}else if(i.text==="_"){if(s)throw new xt("Double subscript",i);s=this.handleSupSubscript("subscript")}else if(i.text==="'"){if(r)throw new xt("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(cw[i.text]){var u=YP.test(i.text),d=[];for(d.push(new el(cw[i.text])),this.consume();;){var h=this.fetch().text;if(!cw[h]||YP.test(h)!==u)break;d.unshift(new el(cw[h])),this.consume()}var m=this.subparse(d);u?s={type:"ordgroup",mode:"math",body:m}:r={type:"ordgroup",mode:"math",body:m}}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=kh[s];if(!i)return null;if(this.consume(),n&&n!=="atom"&&!i.allowedInArgument)throw new xt("Got function '"+s+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!i.allowedInText)throw new xt("Can't use function '"+s+"' in text mode",r);if(this.mode==="math"&&i.allowedInMath===!1)throw new xt("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=kh[t];if(a&&a.handler)return a.handler(o,n,r);throw new xt("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 u=this.parseGroupOfType("argument to '"+t+"'",a,l);if(l)i.push(u);else if(u!=null)s.push(u);else throw new xt("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 xt("A primitive argument cannot be optional");var o=this.parseGroup(t);if(o==null)throw new xt("Expected group as "+t,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new xt("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 xt("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 xt("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 xt("Invalid size: '"+n.text+"'",n);var i={number:+(s[1]+s[2]),unit:s[3]};if(!YG(i))throw new xt("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:da.range(r,l),body:a,semisimple:s==="\\begingroup"||void 0}}else if(i=this.parseFunction(n,t)||this.parseSymbol(),i==null&&s[0]==="\\"&&!qK.hasOwnProperty(s)){if(this.settings.throwOnError)throw new xt("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:da.range(s,a),text:"---"}),n-=2):(t.splice(r,2,{type:"textord",mode:"text",loc:da.range(s,o),text:"--"}),n-=1)}(i==="'"||i==="`")&&o.text===i&&(t.splice(r,2,{type:"textord",mode:"text",loc:da.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 xt(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:s}}XP.hasOwnProperty(n[0])&&!zs[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=XP[n[0]]+n.slice(1));var i=Pwe.exec(n);i&&(n=n.substring(0,i.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(zs[this.mode][n]){this.settings.strict&&this.mode==="math"&&u7.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',t);var a=zs[this.mode][n].group,l=da.range(t),u;rwe(a)?u={type:"atom",mode:this.mode,family:a,loc:l,text:n}:u={type:a,mode:this.mode,loc:l,text:n},o=u}else if(n.charCodeAt(0)>=128)this.settings.strict&&(KG(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:da.range(t),text:n};else return null;if(this.consume(),i)for(var d=0;d<i[0].length;d++){var h=i[0][d];if(!V5[h])throw new xt("Unknown accent ' "+h+"'",t);var m=V5[h][this.mode]||V5[h].text;if(!m)throw new xt("Accent "+h+" unsupported in "+this.mode+" mode",t);o={type:"accent",mode:this.mode,loc:da.range(t),label:m,isStretchy:!1,isShifty:!0,base:o}}return o}};HK.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var CM=function(t,n){if(!(typeof t=="string"||t instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new HK(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 xt("\\tag works only in display equations");s=[{type:"tag",mode:"text",body:s,tag:r.subparse([new el("\\df@tag")])}]}return s},TM=function(t,n,r){n.textContent="";var s=pS(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."),TM=function(){throw new xt("KaTeX doesn't work in quirks mode.")});var VK=function(t,n){var r=pS(t,n).toMarkup();return r},WK=function(t,n){var r=new dM(n);return CM(t,r)},GK=function(t,n,r){if(r.throwOnError||!(t instanceof xt))throw t;var s=mt(["katex-error"],[new rl(n)]);return s.setAttribute("title",t.toString()),s.setAttribute("style","color:"+r.errorColor),s},pS=function(t,n){var r=new dM(n);try{var s=CM(t,r);return Yxe(s,t,r)}catch(i){return GK(i,t,r)}},KK=function(t,n){var r=new dM(n);try{var s=CM(t,r);return Xxe(s,t,r)}catch(i){return GK(i,t,r)}},YK="0.16.47",XK={Span:Kg,Anchor:rS,SymbolNode:rl,SvgNode:cd,PathNode:Xh,LineNode:c7},C7={version:YK,render:TM,renderToString:VK,ParseError:xt,SETTINGS_SCHEMA:J2,__parse:WK,__renderToDomTree:pS,__renderToHTMLTree:KK,__setFontMetrics:ZG,__defineSymbol:E,__defineFunction:Jt,__defineMacro:W,__domTree:XK};const cyt=Object.freeze(Object.defineProperty({__proto__:null,ParseError:xt,SETTINGS_SCHEMA:J2,__defineFunction:Jt,__defineMacro:W,__defineSymbol:E,__domTree:XK,__parse:WK,__renderToDomTree:pS,__renderToHTMLTree:KK,__setFontMetrics:ZG,default:C7,get render(){return TM},renderToString:VK,version:YK},Symbol.toStringTag,{value:"Module"})),qwe={};function QP(e){const t=this,n=e||qwe,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(Xve(n)),i.push(qve()),o.push(Hve(n))}const JP=/[#.]/g;function Hwe(e,t){const n=e||"",r={};let s=0,i,o;for(;s<n.length;){JP.lastIndex=s;const a=JP.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 QK(e,t,n){const r=n?Gwe(n):void 0;function s(i,o,...a){let l;if(i==null){l={type:"root",children:[]};const u=o;a.unshift(u)}else{l=Hwe(i,t);const u=l.tagName.toLowerCase(),d=r?r.get(u):void 0;if(l.tagName=d||u,Uwe(o))a.unshift(o);else for(const[h,m]of Object.entries(o))Vwe(e,l.properties,h,m)}for(const u of a)T7(l.children,u);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return s}function Uwe(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 Vwe(e,t,n,r){const s=V9(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=vL(r):s.commaSeparated?i=mL(r):s.commaOrSpaceSeparated?i=vL(mL(r).join(" ")):i=ZP(s,s.property,r):Array.isArray(r)?i=[...r]:i=s.property==="style"?Wwe(r):String(r);if(Array.isArray(i)){const o=[];for(const a of i)o.push(ZP(s,s.property,a));i=o}s.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[s.property]=i}}function T7(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)T7(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?T7(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function ZP(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||Iy(n)===Iy(t)))return!0}return n}function Wwe(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function Gwe(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const Kwe=["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"],Ywe=QK(W9,"div"),Xwe=QK(Vg,"g",Kwe),W5={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Qwe(e,t){return JK(e,{})||{type:"root",children:[]}}function JK(e,t){const n=Jwe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function Jwe(e,t){switch(e.nodeType){case 1:return nke(e,t);case 3:return eke(e);case 8:return tke(e);case 9:return eO(e,t);case 10:return Zwe();case 11:return eO(e,t);default:return}}function eO(e,t){return{type:"root",children:ZK(e,t)}}function Zwe(){return{type:"doctype"}}function eke(e){return{type:"text",value:e.nodeValue||""}}function tke(e){return{type:"comment",value:e.nodeValue||""}}function nke(e,t){const n=e.namespaceURI,r=n===W5.svg?Xwe:Ywe,s=n===W5.html?e.tagName.toLowerCase():e.tagName,i=n===W5.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,ZK(i,t))}function ZK(e,t){const n=e.childNodes,r=[];let s=-1;for(;++s<n.length;){const i=JK(n[s],t);i!==void 0&&r.push(i)}return r}new DOMParser;function rke(e,t){const n=ske(e);return Qwe(n)}function ske(e){const t=document.createElement("template");return t.innerHTML=e,t.content}const tO=function(e,t,n){const r=Dv(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]},pp=function(e){if(e==null)return ake;if(typeof e=="string")return oke(e);if(typeof e=="object")return ike(e);if(typeof e=="function")return AM(e);throw new Error("Expected function, string, or array as `test`")};function ike(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=pp(e[n]);return AM(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function oke(e){return AM(t);function t(n){return n.tagName===e}}function AM(e){return t;function t(n,r,s){return!!(lke(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function ake(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function lke(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const nO=/\n/g,rO=/[\t ]+/g,A7=pp("br"),sO=pp(gke),cke=pp("p"),iO=pp("tr"),uke=pp(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",pke,bke]),eY=pp(["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 dke(e,t){const n=t||{},r="children"in e?e.children:[],s=eY(e),i=rY(e,{whitespace:n.whitespace||"normal"}),o=[];(e.type==="text"||e.type==="comment")&&o.push(...nY(e,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...tY(r[a],e,{whitespace:i,breakBefore:a?void 0:s,breakAfter:a<r.length-1?A7(r[a+1]):s}));const l=[];let u;for(a=-1;++a<o.length;){const d=o[a];typeof d=="number"?u!==void 0&&d>u&&(u=d):d&&(u!==void 0&&u>-1&&l.push(`
`.repeat(u)||" "),u=-1,l.push(d))}return l.join("")}function tY(e,t,n){return e.type==="element"?hke(e,t,n):e.type==="text"?n.whitespace==="normal"?nY(e,n):fke(e):[]}function hke(e,t,n){const r=rY(e,n),s=e.children||[];let i=-1,o=[];if(uke(e))return o;let a,l;for(A7(e)||iO(e)&&tO(t,e,iO)?l=`
`:cke(e)?(a=2,l=2):eY(e)&&(a=1,l=1);++i<s.length;)o=o.concat(tY(s[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<s.length-1?A7(s[i+1]):l}));return sO(e)&&tO(t,e,sO)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function nY(e,t){const n=String(e.value),r=[],s=[];let i=0;for(;i<=n.length;){nO.lastIndex=i;const l=nO.exec(n),u=l&&"index"in l?l.index:n.length;r.push(mke(n.slice(i,u).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,u===n.length?t.breakAfter:!0)),i=u+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 fke(e){return[String(e.value)]}function mke(e,t,n){const r=[];let s=0,i;for(;s<e.length;){rO.lastIndex=s;const o=rO.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 rY(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 pke(e){return!!(e.properties||{}).hidden}function gke(e){return e.tagName==="td"||e.tagName==="th"}function bke(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const yke={},vke=[];function oO(e){const t=e||yke;return function(n,r){iM(n,"element",function(s,i){const o=Array.isArray(s.properties.className)?s.properties.className:vke,a=o.includes("language-math"),l=o.includes("math-display"),u=o.includes("math-inline");let d=l;if(!a&&!l&&!u)return;let h=i[i.length-1],m=s;if(s.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(m=h,h=i[i.length-2],d=!0),!h)return;const p=dke(m,{whitespace:"pre"});let g;try{g=C7.renderToString(p,{...t,displayMode:d,throwOnError:!0})}catch(x){const v=x,y=v.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,s],cause:v,place:s.position,ruleId:y,source:"rehype-katex"});try{g=C7.renderToString(p,{...t,displayMode:d,strict:"ignore",throwOnError:!1})}catch{g=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(x)},children:[{type:"text",value:p}]}]}}typeof g=="string"&&(g=rke(g).children);const b=h.children.indexOf(m);return h.children.splice(b,1,...g),xG})}}const sY=[{id:"abap",name:"ABAP",import:()=>re(()=>import("./abap-DsBKuouk.js"),[])},{id:"actionscript-3",name:"ActionScript",import:()=>re(()=>import("./actionscript-3-D_z4Izcz.js"),[])},{id:"ada",name:"Ada",import:()=>re(()=>import("./ada-727ZlQH0.js"),[])},{id:"angular-html",name:"Angular HTML",import:()=>re(()=>import("./angular-html-LfdN0zeE.js").then(e=>e.f),__vite__mapDeps([0,1,2,3]))},{id:"angular-ts",name:"Angular TypeScript",import:()=>re(()=>import("./angular-ts-CKsD7JZE.js"),__vite__mapDeps([4,0,1,2,3,5]))},{id:"apache",name:"Apache Conf",import:()=>re(()=>import("./apache-Dn00JSTd.js"),[])},{id:"apex",name:"Apex",import:()=>re(()=>import("./apex-COJ4H7py.js"),[])},{id:"apl",name:"APL",import:()=>re(()=>import("./apl-BBq3IX1j.js"),__vite__mapDeps([6,1,2,3,7,8,9]))},{id:"applescript",name:"AppleScript",import:()=>re(()=>import("./applescript-Bu5BbsvL.js"),[])},{id:"ara",name:"Ara",import:()=>re(()=>import("./ara-7O62HKoU.js"),[])},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>re(()=>import("./asciidoc-BPT9niGB.js"),[])},{id:"asm",name:"Assembly",import:()=>re(()=>import("./asm-Dhn9LcZ4.js"),[])},{id:"astro",name:"Astro",import:()=>re(()=>import("./astro-CqkE3fuf.js"),__vite__mapDeps([10,9,2,11,3,12]))},{id:"awk",name:"AWK",import:()=>re(()=>import("./awk-eg146-Ew.js"),[])},{id:"ballerina",name:"Ballerina",import:()=>re(()=>import("./ballerina-Du268qiB.js"),[])},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>re(()=>import("./bat-fje9CFhw.js"),[])},{id:"beancount",name:"Beancount",import:()=>re(()=>import("./beancount-BwXTMy5W.js"),[])},{id:"berry",name:"Berry",aliases:["be"],import:()=>re(()=>import("./berry-3xVqZejG.js"),[])},{id:"bibtex",name:"BibTeX",import:()=>re(()=>import("./bibtex-xW4inM5L.js"),[])},{id:"bicep",name:"Bicep",import:()=>re(()=>import("./bicep-DHo0CJ0O.js"),[])},{id:"blade",name:"Blade",import:()=>re(()=>import("./blade-a8OxSdnT.js"),__vite__mapDeps([13,1,2,3,7,8,14,9]))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>re(()=>import("./bsl-Dgyn0ogV.js"),__vite__mapDeps([15,16]))},{id:"c",name:"C",import:()=>re(()=>import("./c-C3t2pwGQ.js"),[])},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>re(()=>import("./cadence-DNquZEk8.js"),[])},{id:"cairo",name:"Cairo",import:()=>re(()=>import("./cairo--RitsXJZ.js"),__vite__mapDeps([17,18]))},{id:"clarity",name:"Clarity",import:()=>re(()=>import("./clarity-BHOwM8T6.js"),[])},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>re(()=>import("./clojure-DxSadP1t.js"),[])},{id:"cmake",name:"CMake",import:()=>re(()=>import("./cmake-DbXoA79R.js"),[])},{id:"cobol",name:"COBOL",import:()=>re(()=>import("./cobol-PTqiYgYu.js"),__vite__mapDeps([19,1,2,3,8]))},{id:"codeowners",name:"CODEOWNERS",import:()=>re(()=>import("./codeowners-Bp6g37R7.js"),[])},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>re(()=>import("./codeql-sacFqUAJ.js"),[])},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>re(()=>import("./coffee-dyiR41kL.js"),__vite__mapDeps([20,2]))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>re(()=>import("./common-lisp-C7gG9l05.js"),[])},{id:"coq",name:"Coq",import:()=>re(()=>import("./coq-Dsg_Bt_b.js"),[])},{id:"cpp",name:"C++",aliases:["c++"],import:()=>re(()=>import("./cpp-BksuvNSY.js"),__vite__mapDeps([21,22,23,24,14]))},{id:"crystal",name:"Crystal",import:()=>re(()=>import("./crystal-DtDmRg-F.js"),__vite__mapDeps([25,1,2,3,14,24,26]))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>re(()=>import("./csharp-D9R-vmeu.js"),[])},{id:"css",name:"CSS",import:()=>re(()=>import("./css-BPhBrDlE.js"),[])},{id:"csv",name:"CSV",import:()=>re(()=>import("./csv-B0qRVHPH.js"),[])},{id:"cue",name:"CUE",import:()=>re(()=>import("./cue-DtFQj3wx.js"),[])},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>re(()=>import("./cypher-m2LEI-9-.js"),[])},{id:"d",name:"D",import:()=>re(()=>import("./d-BoXegm-a.js"),[])},{id:"dart",name:"Dart",import:()=>re(()=>import("./dart-B9wLZaAG.js"),[])},{id:"dax",name:"DAX",import:()=>re(()=>import("./dax-ClGRhx96.js"),[])},{id:"desktop",name:"Desktop",import:()=>re(()=>import("./desktop-DEIpsLCJ.js"),[])},{id:"diff",name:"Diff",import:()=>re(()=>import("./diff-BgYniUM_.js"),[])},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>re(()=>import("./docker-COcR7UxN.js"),[])},{id:"dotenv",name:"dotEnv",import:()=>re(()=>import("./dotenv-BjQB5zDj.js"),[])},{id:"dream-maker",name:"Dream Maker",import:()=>re(()=>import("./dream-maker-C-nORZOA.js"),[])},{id:"edge",name:"Edge",import:()=>re(()=>import("./edge-D5gP-w-T.js"),__vite__mapDeps([27,11,1,2,3,28]))},{id:"elixir",name:"Elixir",import:()=>re(()=>import("./elixir-CLiX3zqd.js"),__vite__mapDeps([29,1,2,3]))},{id:"elm",name:"Elm",import:()=>re(()=>import("./elm-CmHSxxaM.js"),__vite__mapDeps([30,23,24]))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>re(()=>import("./emacs-lisp-BX77sIaO.js"),[])},{id:"erb",name:"ERB",import:()=>re(()=>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:()=>re(()=>import("./erlang-B-DoSBHF.js"),[])},{id:"fennel",name:"Fennel",import:()=>re(()=>import("./fennel-bCA53EVm.js"),[])},{id:"fish",name:"Fish",import:()=>re(()=>import("./fish-w-ucz2PV.js"),[])},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>re(()=>import("./fluent-Dayu4EKP.js"),[])},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>re(()=>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:()=>re(()=>import("./fortran-free-form-DKXYxT9g.js"),[])},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>re(()=>import("./fsharp-XplgxFYe.js"),__vite__mapDeps([41,42]))},{id:"gdresource",name:"GDResource",import:()=>re(()=>import("./gdresource-BHYsBjWJ.js"),__vite__mapDeps([43,44,45]))},{id:"gdscript",name:"GDScript",import:()=>re(()=>import("./gdscript-DfxzS6Rs.js"),[])},{id:"gdshader",name:"GDShader",import:()=>re(()=>import("./gdshader-SKMF96pI.js"),[])},{id:"genie",name:"Genie",import:()=>re(()=>import("./genie-ajMbGru0.js"),[])},{id:"gherkin",name:"Gherkin",import:()=>re(()=>import("./gherkin--30QC5Em.js"),[])},{id:"git-commit",name:"Git Commit Message",import:()=>re(()=>import("./git-commit-i4q6IMui.js"),__vite__mapDeps([46,47]))},{id:"git-rebase",name:"Git Rebase Message",import:()=>re(()=>import("./git-rebase-B-v9cOL2.js"),__vite__mapDeps([48,26]))},{id:"gleam",name:"Gleam",import:()=>re(()=>import("./gleam-B430Bg39.js"),[])},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>re(()=>import("./glimmer-js-D-cwc0-E.js"),__vite__mapDeps([49,2,11,3,1]))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>re(()=>import("./glimmer-ts-pgjy16dm.js"),__vite__mapDeps([50,11,3,2,1]))},{id:"glsl",name:"GLSL",import:()=>re(()=>import("./glsl-DBO2IWDn.js"),__vite__mapDeps([23,24]))},{id:"gnuplot",name:"Gnuplot",import:()=>re(()=>import("./gnuplot-CM8KxXT1.js"),[])},{id:"go",name:"Go",import:()=>re(()=>import("./go-B1SYOhNW.js"),[])},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>re(()=>import("./graphql-cDcHW_If.js"),__vite__mapDeps([34,2,11,35,36]))},{id:"groovy",name:"Groovy",import:()=>re(()=>import("./groovy-DkBy-JyN.js"),[])},{id:"hack",name:"Hack",import:()=>re(()=>import("./hack-D1yCygmZ.js"),__vite__mapDeps([51,1,2,3,14]))},{id:"haml",name:"Ruby Haml",import:()=>re(()=>import("./haml-B2EZWmdv.js"),__vite__mapDeps([33,2,3]))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>re(()=>import("./handlebars-BQGss363.js"),__vite__mapDeps([52,1,2,3,38]))},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>re(()=>import("./haskell-BILxekzW.js"),[])},{id:"haxe",name:"Haxe",import:()=>re(()=>import("./haxe-C5wWYbrZ.js"),[])},{id:"hcl",name:"HashiCorp HCL",import:()=>re(()=>import("./hcl-HzYwdGDm.js"),[])},{id:"hjson",name:"Hjson",import:()=>re(()=>import("./hjson-T-Tgc4AT.js"),[])},{id:"hlsl",name:"HLSL",import:()=>re(()=>import("./hlsl-ifBTmRxC.js"),[])},{id:"html",name:"HTML",import:()=>re(()=>import("./html-C2L_23MC.js"),__vite__mapDeps([1,2,3]))},{id:"html-derivative",name:"HTML (Derivative)",import:()=>re(()=>import("./html-derivative-CSfWNPLT.js"),__vite__mapDeps([28,1,2,3]))},{id:"http",name:"HTTP",import:()=>re(()=>import("./http-FRrOvY1W.js"),__vite__mapDeps([53,26,9,7,8,34,2,11,35,36]))},{id:"hxml",name:"HXML",import:()=>re(()=>import("./hxml-TIA70rKU.js"),__vite__mapDeps([54,55]))},{id:"hy",name:"Hy",import:()=>re(()=>import("./hy-BMj5Y0dO.js"),[])},{id:"imba",name:"Imba",import:()=>re(()=>import("./imba-bv_oIlVt.js"),__vite__mapDeps([56,11]))},{id:"ini",name:"INI",aliases:["properties"],import:()=>re(()=>import("./ini-BjABl1g7.js"),[])},{id:"java",name:"Java",import:()=>re(()=>import("./java-xI-RfyKK.js"),[])},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>re(()=>import("./javascript-ySlJ1b_l.js"),[])},{id:"jinja",name:"Jinja",import:()=>re(()=>import("./jinja-DGy0s7-h.js"),__vite__mapDeps([57,1,2,3]))},{id:"jison",name:"Jison",import:()=>re(()=>import("./jison-BqZprYcd.js"),__vite__mapDeps([58,2]))},{id:"json",name:"JSON",import:()=>re(()=>import("./json-BQoSv7ci.js"),[])},{id:"json5",name:"JSON5",import:()=>re(()=>import("./json5-w8dY5SsB.js"),[])},{id:"jsonc",name:"JSON with Comments",import:()=>re(()=>import("./jsonc-TU54ms6u.js"),[])},{id:"jsonl",name:"JSON Lines",import:()=>re(()=>import("./jsonl-DREVFZK8.js"),[])},{id:"jsonnet",name:"Jsonnet",import:()=>re(()=>import("./jsonnet-BfivnA6A.js"),[])},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>re(()=>import("./jssm-P4WzXJd0.js"),[])},{id:"jsx",name:"JSX",import:()=>re(()=>import("./jsx-BAng5TT0.js"),[])},{id:"julia",name:"Julia",aliases:["jl"],import:()=>re(()=>import("./julia-BBuGR-5E.js"),__vite__mapDeps([59,21,22,23,24,14,18,2,60]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>re(()=>import("./kotlin-B5lbUyaz.js"),[])},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>re(()=>import("./kusto-mebxcVVE.js"),[])},{id:"latex",name:"LaTeX",import:()=>re(()=>import("./latex-C-cWTeAZ.js"),__vite__mapDeps([61,62,60]))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>re(()=>import("./lean-XBlWyCtg.js"),[])},{id:"less",name:"Less",import:()=>re(()=>import("./less-BfCpw3nA.js"),[])},{id:"liquid",name:"Liquid",import:()=>re(()=>import("./liquid-D3W5UaiH.js"),__vite__mapDeps([63,1,2,3,9]))},{id:"log",name:"Log file",import:()=>re(()=>import("./log-Cc5clBb7.js"),[])},{id:"logo",name:"Logo",import:()=>re(()=>import("./logo-IuBKFhSY.js"),[])},{id:"lua",name:"Lua",import:()=>re(()=>import("./lua-CvWAzNxB.js"),__vite__mapDeps([37,24]))},{id:"luau",name:"Luau",import:()=>re(()=>import("./luau-Du5NY7AG.js"),[])},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>re(()=>import("./make-Bvotw-X0.js"),[])},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>re(()=>import("./markdown-UIAJJxZW.js"),[])},{id:"marko",name:"Marko",import:()=>re(()=>import("./marko-z0MBrx5-.js"),__vite__mapDeps([64,3,65,5,2]))},{id:"matlab",name:"MATLAB",import:()=>re(()=>import("./matlab-D9-PGadD.js"),[])},{id:"mdc",name:"MDC",import:()=>re(()=>import("./mdc-DB_EDNY_.js"),__vite__mapDeps([66,42,38,28,1,2,3]))},{id:"mdx",name:"MDX",import:()=>re(()=>import("./mdx-sdHcTMYB.js"),[])},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>re(()=>import("./mermaid-Ci6OQyBP.js"),[])},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>re(()=>import("./mipsasm-BC5c_5Pe.js"),[])},{id:"mojo",name:"Mojo",import:()=>re(()=>import("./mojo-Tz6hzZYG.js"),[])},{id:"move",name:"Move",import:()=>re(()=>import("./move-DB_GagMm.js"),[])},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>re(()=>import("./narrat-DLbgOhZU.js"),[])},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>re(()=>import("./nextflow-B0XVJmRM.js"),[])},{id:"nginx",name:"Nginx",import:()=>re(()=>import("./nginx-D_VnBJ67.js"),__vite__mapDeps([67,37,24]))},{id:"nim",name:"Nim",import:()=>re(()=>import("./nim-ZlGxZxc3.js"),__vite__mapDeps([68,24,1,2,3,7,8,23,42]))},{id:"nix",name:"Nix",import:()=>re(()=>import("./nix-shcSOmrb.js"),[])},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>re(()=>import("./nushell-D4Tzg5kh.js"),[])},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>re(()=>import("./objective-c-Deuh7S70.js"),[])},{id:"objective-cpp",name:"Objective-C++",import:()=>re(()=>import("./objective-cpp-BUEGK8hf.js"),[])},{id:"ocaml",name:"OCaml",import:()=>re(()=>import("./ocaml-BNioltXt.js"),[])},{id:"pascal",name:"Pascal",import:()=>re(()=>import("./pascal-JqZropPD.js"),[])},{id:"perl",name:"Perl",import:()=>re(()=>import("./perl-CHQXSrWU.js"),__vite__mapDeps([69,1,2,3,7,8,14]))},{id:"php",name:"PHP",import:()=>re(()=>import("./php-B5ebYQev.js"),__vite__mapDeps([70,1,2,3,7,8,14,9]))},{id:"plsql",name:"PL/SQL",import:()=>re(()=>import("./plsql-LKU2TuZ1.js"),[])},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>re(()=>import("./po-BFLt1xDp.js"),[])},{id:"polar",name:"Polar",import:()=>re(()=>import("./polar-DKykz6zU.js"),[])},{id:"postcss",name:"PostCSS",import:()=>re(()=>import("./postcss-B3ZDOciz.js"),[])},{id:"powerquery",name:"PowerQuery",import:()=>re(()=>import("./powerquery-CSHBycmS.js"),[])},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>re(()=>import("./powershell-BIEUsx6d.js"),[])},{id:"prisma",name:"Prisma",import:()=>re(()=>import("./prisma-B48N-Iqd.js"),[])},{id:"prolog",name:"Prolog",import:()=>re(()=>import("./prolog-BY-TUvya.js"),[])},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>re(()=>import("./proto-zocC4JxJ.js"),[])},{id:"pug",name:"Pug",aliases:["jade"],import:()=>re(()=>import("./pug-CM9l7STV.js"),__vite__mapDeps([71,2,3,1]))},{id:"puppet",name:"Puppet",import:()=>re(()=>import("./puppet-Cza_XSSt.js"),[])},{id:"purescript",name:"PureScript",import:()=>re(()=>import("./purescript-Bg-kzb6g.js"),[])},{id:"python",name:"Python",aliases:["py"],import:()=>re(()=>import("./python-DhUJRlN_.js"),[])},{id:"qml",name:"QML",import:()=>re(()=>import("./qml-D8XfuvdV.js"),__vite__mapDeps([72,2]))},{id:"qmldir",name:"QML Directory",import:()=>re(()=>import("./qmldir-C8lEn-DE.js"),[])},{id:"qss",name:"Qt Style Sheets",import:()=>re(()=>import("./qss-DhMKtDLN.js"),[])},{id:"r",name:"R",import:()=>re(()=>import("./r-CwjWoCRV.js"),[])},{id:"racket",name:"Racket",import:()=>re(()=>import("./racket-CzouJOBO.js"),[])},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>re(()=>import("./raku-B1bQXN8T.js"),[])},{id:"razor",name:"ASP.NET Razor",import:()=>re(()=>import("./razor-CNLDkMZG.js"),__vite__mapDeps([73,1,2,3,74]))},{id:"reg",name:"Windows Registry Script",import:()=>re(()=>import("./reg-5LuOXUq_.js"),[])},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>re(()=>import("./regexp-DWJ3fJO_.js"),[])},{id:"rel",name:"Rel",import:()=>re(()=>import("./rel-DJlmqQ1C.js"),[])},{id:"riscv",name:"RISC-V",import:()=>re(()=>import("./riscv-QhoSD0DR.js"),[])},{id:"rst",name:"reStructuredText",import:()=>re(()=>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:()=>re(()=>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:()=>re(()=>import("./rust-Be6lgOlo.js"),[])},{id:"sas",name:"SAS",import:()=>re(()=>import("./sas-BmTFh92c.js"),__vite__mapDeps([77,14]))},{id:"sass",name:"Sass",import:()=>re(()=>import("./sass-BJ4Li9vH.js"),[])},{id:"scala",name:"Scala",import:()=>re(()=>import("./scala-DQVVAn-B.js"),[])},{id:"scheme",name:"Scheme",import:()=>re(()=>import("./scheme-BJGe-b2p.js"),[])},{id:"scss",name:"SCSS",import:()=>re(()=>import("./scss-C31hgJw-.js"),__vite__mapDeps([5,3]))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>re(()=>import("./sdbl-BLhTXw86.js"),[])},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>re(()=>import("./shaderlab-B7qAK45m.js"),__vite__mapDeps([78,79]))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>re(()=>import("./shellscript-atvbtKCR.js"),[])},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>re(()=>import("./shellsession-C_rIy8kc.js"),__vite__mapDeps([80,26]))},{id:"smalltalk",name:"Smalltalk",import:()=>re(()=>import("./smalltalk-DkLiglaE.js"),[])},{id:"solidity",name:"Solidity",import:()=>re(()=>import("./solidity-C1w2a3ep.js"),[])},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>re(()=>import("./soy-C-lX7w71.js"),__vite__mapDeps([81,1,2,3]))},{id:"sparql",name:"SPARQL",import:()=>re(()=>import("./sparql-bYkjHRlG.js"),__vite__mapDeps([82,83]))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>re(()=>import("./splunk-Cf8iN4DR.js"),[])},{id:"sql",name:"SQL",import:()=>re(()=>import("./sql-COK4E0Yg.js"),[])},{id:"ssh-config",name:"SSH Config",import:()=>re(()=>import("./ssh-config-BknIz3MU.js"),[])},{id:"stata",name:"Stata",import:()=>re(()=>import("./stata-DorPZHa4.js"),__vite__mapDeps([84,14]))},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>re(()=>import("./stylus-BeQkCIfX.js"),[])},{id:"svelte",name:"Svelte",import:()=>re(()=>import("./svelte-MSaWC3Je.js"),__vite__mapDeps([85,2,11,3,12]))},{id:"swift",name:"Swift",import:()=>re(()=>import("./swift-BSxZ-RaX.js"),[])},{id:"system-verilog",name:"SystemVerilog",import:()=>re(()=>import("./system-verilog-C7L56vO4.js"),[])},{id:"systemd",name:"Systemd Units",import:()=>re(()=>import("./systemd-CUnW07Te.js"),[])},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>re(()=>import("./talonscript-C1XDQQGZ.js"),[])},{id:"tasl",name:"Tasl",import:()=>re(()=>import("./tasl-CQjiPCtT.js"),[])},{id:"tcl",name:"Tcl",import:()=>re(()=>import("./tcl-DQ1-QYvQ.js"),[])},{id:"templ",name:"Templ",import:()=>re(()=>import("./templ-dwX3ZSMB.js"),__vite__mapDeps([86,87,2,3]))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>re(()=>import("./terraform-BbSNqyBO.js"),[])},{id:"tex",name:"TeX",import:()=>re(()=>import("./tex-rYs2v40G.js"),__vite__mapDeps([62,60]))},{id:"toml",name:"TOML",import:()=>re(()=>import("./toml-CB2ApiWb.js"),[])},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>re(()=>import("./ts-tags-CipyTH0X.js"),__vite__mapDeps([88,11,3,2,23,24,1,14,7,8]))},{id:"tsv",name:"TSV",import:()=>re(()=>import("./tsv-B_m7g4N7.js"),[])},{id:"tsx",name:"TSX",import:()=>re(()=>import("./tsx-B6W0miNI.js"),[])},{id:"turtle",name:"Turtle",import:()=>re(()=>import("./turtle-BMR_PYu6.js"),[])},{id:"twig",name:"Twig",import:()=>re(()=>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:()=>re(()=>import("./typescript-Dj6nwHGl.js"),[])},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>re(()=>import("./typespec-BpWG_bgh.js"),[])},{id:"typst",name:"Typst",aliases:["typ"],import:()=>re(()=>import("./typst-BVUVsWT6.js"),[])},{id:"v",name:"V",import:()=>re(()=>import("./v-CAQ2eGtk.js"),[])},{id:"vala",name:"Vala",import:()=>re(()=>import("./vala-BFOHcciG.js"),[])},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>re(()=>import("./vb-CdO5JTpU.js"),[])},{id:"verilog",name:"Verilog",import:()=>re(()=>import("./verilog-CJaU5se_.js"),[])},{id:"vhdl",name:"VHDL",import:()=>re(()=>import("./vhdl-DYoNaHQp.js"),[])},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>re(()=>import("./viml-m4uW47V2.js"),[])},{id:"vue",name:"Vue",import:()=>re(()=>import("./vue-BuYVFjOK.js"),__vite__mapDeps([90,1,2,3,11,9,28]))},{id:"vue-html",name:"Vue HTML",import:()=>re(()=>import("./vue-html-xdeiXROB.js"),__vite__mapDeps([91,90,1,2,3,11,9,28]))},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>re(()=>import("./vyper-nyqBNV6O.js"),[])},{id:"wasm",name:"WebAssembly",import:()=>re(()=>import("./wasm-C6j12Q_x.js"),[])},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>re(()=>import("./wenyan-7A4Fjokl.js"),[])},{id:"wgsl",name:"WGSL",import:()=>re(()=>import("./wgsl-CB0Krxn9.js"),[])},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>re(()=>import("./wikitext-DCE3LsBG.js"),[])},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>re(()=>import("./wolfram-C3FkfJm5.js"),[])},{id:"xml",name:"XML",import:()=>re(()=>import("./xml-e3z08dGr.js"),__vite__mapDeps([7,8]))},{id:"xsl",name:"XSL",import:()=>re(()=>import("./xsl-Dd0NUgwM.js"),__vite__mapDeps([92,7,8]))},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>re(()=>import("./yaml-CVw76BM1.js"),[])},{id:"zenscript",name:"ZenScript",import:()=>re(()=>import("./zenscript-HnGAYVZD.js"),[])},{id:"zig",name:"Zig",import:()=>re(()=>import("./zig-BVz_zdnA.js"),[])}],xke=Object.fromEntries(sY.map(e=>[e.id,e.import])),wke=Object.fromEntries(sY.flatMap(e=>{var t;return((t=e.aliases)==null?void 0:t.map(n=>[n,e.import]))||[]})),kke={...xke,...wke},_ke=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>re(()=>import("./andromeeda-C3khCPGq.js"),[])},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>re(()=>import("./aurora-x-D-2ljcwZ.js"),[])},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>re(()=>import("./ayu-dark-Cv9koXgw.js"),[])},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>re(()=>import("./catppuccin-frappe-CD_QflpE.js"),[])},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>re(()=>import("./catppuccin-latte-DRW-0cLl.js"),[])},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>re(()=>import("./catppuccin-macchiato-C-_shW-Y.js"),[])},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>re(()=>import("./catppuccin-mocha-LGGdnPYs.js"),[])},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>re(()=>import("./dark-plus-C3mMm8J8.js"),[])},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>re(()=>import("./dracula-BzJJZx-M.js"),[])},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>re(()=>import("./dracula-soft-BXkSAIEj.js"),[])},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>re(()=>import("./everforest-dark-BgDCqdQA.js"),[])},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>re(()=>import("./everforest-light-C8M2exoo.js"),[])},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>re(()=>import("./github-dark-DHJKELXO.js"),[])},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>re(()=>import("./github-dark-default-Cuk6v7N8.js"),[])},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>re(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[])},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>re(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[])},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>re(()=>import("./github-light-DAi9KRSo.js"),[])},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>re(()=>import("./github-light-default-D7oLnXFd.js"),[])},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>re(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[])},{id:"houston",displayName:"Houston",type:"dark",import:()=>re(()=>import("./houston-DnULxvSX.js"),[])},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>re(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[])},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>re(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[])},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>re(()=>import("./kanagawa-wave-DWedfzmr.js"),[])},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>re(()=>import("./laserwave-DUszq2jm.js"),[])},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>re(()=>import("./light-plus-B7mTdjB0.js"),[])},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>re(()=>import("./material-theme-D5KoaKCx.js"),[])},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>re(()=>import("./material-theme-darker-BfHTSMKl.js"),[])},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>re(()=>import("./material-theme-lighter-B0m2ddpp.js"),[])},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>re(()=>import("./material-theme-ocean-CyktbL80.js"),[])},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>re(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[])},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>re(()=>import("./min-dark-CafNBF8u.js"),[])},{id:"min-light",displayName:"Min Light",type:"light",import:()=>re(()=>import("./min-light-CTRr51gU.js"),[])},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>re(()=>import("./monokai-D4h5O-jR.js"),[])},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>re(()=>import("./night-owl-C39BiMTA.js"),[])},{id:"nord",displayName:"Nord",type:"dark",import:()=>re(()=>import("./nord-Ddv68eIx.js"),[])},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>re(()=>import("./one-dark-pro-GBQ2dnAY.js"),[])},{id:"one-light",displayName:"One Light",type:"light",import:()=>re(()=>import("./one-light-PoHY5YXO.js"),[])},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>re(()=>import("./plastic-3e1v2bzS.js"),[])},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>re(()=>import("./poimandres-CS3Unz2-.js"),[])},{id:"red",displayName:"Red",type:"dark",import:()=>re(()=>import("./red-bN70gL4F.js"),[])},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>re(()=>import("./rose-pine-CmCqftbK.js"),[])},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>re(()=>import("./rose-pine-dawn-Ds-gbosJ.js"),[])},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>re(()=>import("./rose-pine-moon-CjDtw9vr.js"),[])},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>re(()=>import("./slack-dark-BthQWCQV.js"),[])},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>re(()=>import("./slack-ochin-DqwNpetd.js"),[])},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>re(()=>import("./snazzy-light-Bw305WKR.js"),[])},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>re(()=>import("./solarized-dark-DXbdFlpD.js"),[])},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>re(()=>import("./solarized-light-L9t79GZl.js"),[])},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>re(()=>import("./synthwave-84-CbfX1IO0.js"),[])},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>re(()=>import("./tokyo-night-DBQeEorK.js"),[])},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>re(()=>import("./vesper-BEBZ7ncR.js"),[])},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>re(()=>import("./vitesse-black-Bkuqu6BP.js"),[])},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>re(()=>import("./vitesse-dark-D0r3Knsf.js"),[])},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>re(()=>import("./vitesse-light-CVO1_9PV.js"),[])}],Ske=Object.fromEntries(_ke.map(e=>[e.id,e.import]));let Xu=class extends Error{constructor(t){super(t),this.name="ShikiError"}},EM=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Cke(){return 2147483648}function Tke(){return typeof performance<"u"?performance.now():Date.now()}const Ake=(e,t)=>e+(t-e%t)%t;async function Eke(e){let t,n;const r={};function s(p){n=p,r.HEAPU8=new Uint8Array(p),r.HEAPU32=new Uint32Array(p)}function i(p,g,b){r.HEAPU8.copyWithin(p,g,g+b)}function o(p){try{return t.grow(p-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function a(p){const g=r.HEAPU8.length;p=p>>>0;const b=Cke();if(p>b)return!1;for(let x=1;x<=4;x*=2){let v=g*(1+.2/x);v=Math.min(v,p+100663296);const y=Math.min(b,Ake(Math.max(p,v),65536));if(o(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(p,g,b=1024){const x=g+b;let v=g;for(;p[v]&&!(v>=x);)++v;if(v-g>16&&p.buffer&&l)return l.decode(p.subarray(g,v));let y="";for(;g<v;){let w=p[g++];if(!(w&128)){y+=String.fromCharCode(w);continue}const k=p[g++]&63;if((w&224)===192){y+=String.fromCharCode((w&31)<<6|k);continue}const T=p[g++]&63;if((w&240)===224?w=(w&15)<<12|k<<6|T:w=(w&7)<<18|k<<12|T<<6|p[g++]&63,w<65536)y+=String.fromCharCode(w);else{const S=w-65536;y+=String.fromCharCode(55296|S>>10,56320|S&1023)}}return y}function d(p,g){return p?u(r.HEAPU8,p,g):""}const h={emscripten_get_now:Tke,emscripten_memcpy_big:i,emscripten_resize_heap:a,fd_write:()=>0};async function m(){const g=await e({env:h,wasi_snapshot_preview1:h});t=g.memory,s(t.buffer),Object.assign(r,g),r.UTF8ToString=d}return await m(),r}var Mke=Object.defineProperty,Nke=(e,t,n)=>t in e?Mke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ci=(e,t,n)=>(Nke(e,typeof t!="symbol"?t+"":t,n),n);let zi=null;function jke(e){throw new EM(e.UTF8ToString(e.getLastOnigError()))}class gS{constructor(t){Ci(this,"utf16Length"),Ci(this,"utf8Length"),Ci(this,"utf16Value"),Ci(this,"utf8Value"),Ci(this,"utf16OffsetToUtf8"),Ci(this,"utf8OffsetToUtf16");const n=t.length,r=gS._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 u=0;u<n;u++){const d=t.charCodeAt(u);let h=d,m=!1;if(d>=55296&&d<=56319&&u+1<n){const p=t.charCodeAt(u+1);p>=56320&&p<=57343&&(h=(d-55296<<10)+65536|p-56320,m=!0)}s&&(i[u]=l,m&&(i[u+1]=l),h<=127?o[l+0]=u:h<=2047?(o[l+0]=u,o[l+1]=u):h<=65535?(o[l+0]=u,o[l+1]=u,o[l+2]=u):(o[l+0]=u,o[l+1]=u,o[l+2]=u,o[l+3]=u)),h<=127?a[l++]=h:h<=2047?(a[l++]=192|(h&1984)>>>6,a[l++]=128|(h&63)>>>0):h<=65535?(a[l++]=224|(h&61440)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0):(a[l++]=240|(h&1835008)>>>18,a[l++]=128|(h&258048)>>>12,a[l++]=128|(h&4032)>>>6,a[l++]=128|(h&63)>>>0),m&&u++}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 Sc=class{constructor(e){if(Ci(this,"id",++Sc.LAST_ID),Ci(this,"_onigBinding"),Ci(this,"content"),Ci(this,"utf16Length"),Ci(this,"utf8Length"),Ci(this,"utf16OffsetToUtf8"),Ci(this,"utf8OffsetToUtf16"),Ci(this,"ptr"),!zi)throw new EM("Must invoke loadWasm first.");this._onigBinding=zi,this.content=e;const t=new gS(e);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!Sc._sharedPtrInUse?(Sc._sharedPtr||(Sc._sharedPtr=zi.omalloc(1e4)),Sc._sharedPtrInUse=!0,zi.HEAPU8.set(t.utf8Value,Sc._sharedPtr),this.ptr=Sc._sharedPtr):this.ptr=t.createString(zi)}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===Sc._sharedPtr?Sc._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let Bv=Sc;Ci(Bv,"LAST_ID",0);Ci(Bv,"_sharedPtr",0);Ci(Bv,"_sharedPtrInUse",!1);class Ike{constructor(t){if(Ci(this,"_onigBinding"),Ci(this,"_ptr"),!zi)throw new EM("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a<l;a++){const u=new gS(t[a]);n[a]=u.createString(zi),r[a]=u.utf8Length}const s=zi.omalloc(4*t.length);zi.HEAPU32.set(n,s/4);const i=zi.omalloc(4*t.length);zi.HEAPU32.set(r,i/4);const o=zi.createOnigScanner(s,i,t.length);for(let a=0,l=t.length;a<l;a++)zi.ofree(n[a]);zi.ofree(i),zi.ofree(s),o===0&&jke(zi),this._onigBinding=zi,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 Bv(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 u=a[l++],d=a[l++],h=[];for(let m=0;m<d;m++){const p=t.convertUtf8OffsetToUtf16(a[l++]),g=t.convertUtf8OffsetToUtf16(a[l++]);h[m]={start:p,end:g,length:g-p}}return{index:u,captureIndices:h}}}function Rke(e){return typeof e.instantiator=="function"}function Dke(e){return typeof e.default=="function"}function Lke(e){return typeof e.data<"u"}function Pke(e){return typeof Response<"u"&&e instanceof Response}function Oke(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 uw;function Bke(e){if(uw)return uw;async function t(){zi=await Eke(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Rke(r)?r=await r.instantiator(n):Dke(r)?r=await r.default(n):(Lke(r)&&(r=r.data),Pke(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await $ke(r)(n):r=await zke(r)(n):Oke(r)?r=await G5(r)(n):r instanceof WebAssembly.Module?r=await G5(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await G5(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return uw=t(),uw}function G5(e){return t=>WebAssembly.instantiate(e,t)}function $ke(e){return t=>WebAssembly.instantiateStreaming(e,t)}function zke(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Fke;function qke(){return Fke}async function iY(e){return e&&await Bke(e),{createScanner(t){return new Ike(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Bv(t)}}}function Hke(e){return MM(e)}function MM(e){return Array.isArray(e)?Uke(e):e instanceof RegExp?e:typeof e=="object"?Vke(e):e}function Uke(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=MM(e[n]);return t}function Vke(e){let t={};for(let n in e)t[n]=MM(e[n]);return t}function oY(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function aY(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?aY(e.substring(0,e.length-1)):e.substr(~t+1)}var K5=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,dw=class{static hasCaptures(e){return e===null?!1:(K5.lastIndex=0,K5.test(e))}static replaceCaptures(e,t,n){return e.replace(K5,(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 lY(e,t){return e<t?-1:e>t?1:0}function cY(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=lY(e[s],t[s]);if(i!==0)return i}return 0}return n-r}function aO(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 uY(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var dY=class{constructor(e){Me(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}},s_=class{constructor(e,t,n){Me(this,"_cachedMatchRoot",new dY(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Kke(e),t)}static createFromParsedTheme(e,t){return Xke(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=>Wke(e.parent,s.parentScopes));return r?new hY(r.fontStyle,r.foreground,r.background):null}},Y5=class Ok{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ok(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Ok(n,t[r]);return n}push(t){return new Ok(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 Wke(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&&!Gke(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Gke(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var hY=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Kke(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 h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let h=o.settings.fontStyle.split(" ");for(let m=0,p=h.length;m<p;m++)switch(h[m]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let u=null;typeof o.settings.foreground=="string"&&aO(o.settings.foreground)&&(u=o.settings.foreground);let d=null;typeof o.settings.background=="string"&&aO(o.settings.background)&&(d=o.settings.background);for(let h=0,m=a.length;h<m;h++){let g=a[h].trim().split(" "),b=g[g.length-1],x=null;g.length>1&&(x=g.slice(0,g.length-1),x.reverse()),n[r++]=new Yke(b,x,s,l,u,d)}}return n}var Yke=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}},Hu=(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))(Hu||{});function Xke(e,t){e.sort((l,u)=>{let d=lY(l.scope,u.scope);return d!==0||(d=cY(l.parentScopes,u.parentScopes),d!==0)?d:l.index-u.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 Qke(t),o=new hY(n,i.getId(r),i.getId(s)),a=new Zke(new E7(0,null,-1,0,0),[]);for(let l=0,u=e.length;l<u;l++){let d=e[l];a.insert(0,d.scope,d.parentScopes,d.fontStyle,i.getId(d.foreground),i.getId(d.background))}return new s_(i,o,a)}var Qke=class{constructor(e){Me(this,"_isFrozen");Me(this,"_lastColorId");Me(this,"_id2color");Me(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)}},Jke=Object.freeze([]),E7=class fY{constructor(t,n,r,s,i){Me(this,"scopeDepth");Me(this,"parentScopes");Me(this,"fontStyle");Me(this,"foreground");Me(this,"background");this.scopeDepth=t,this.parentScopes=n||Jke,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new fY(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)}},Zke=class M7{constructor(t,n=[],r={}){Me(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(M7._cmpBySpecificity),n}insert(t,n,r,s,i,o){if(n===""){this._doInsertHere(t,r,s,i,o);return}let a=n.indexOf("."),l,u;a===-1?(l=n,u=""):(l=n.substring(0,a),u=n.substring(a+1));let d;this._children.hasOwnProperty(l)?d=this._children[l]:(d=new M7(this._mainRule.clone(),E7.cloneArr(this._rulesWithParentScopes)),this._children[l]=d),d.insert(t+1,u,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(cY(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 E7(t,n,r,s,i))}},bg=class bl{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=bl.getLanguageId(t),r=bl.getTokenType(t),s=bl.getFontStyle(t),i=bl.getForeground(t),o=bl.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=bl.getLanguageId(t),u=bl.getTokenType(t),d=bl.containsBalancedBrackets(t)?1:0,h=bl.getFontStyle(t),m=bl.getForeground(t),p=bl.getBackground(t);return n!==0&&(l=n),r!==8&&(u=r),s!==null&&(d=s?1:0),i!==-1&&(h=i),o!==0&&(m=o),a!==0&&(p=a),(l<<0|u<<8|d<<10|h<<11|m<<15|p<<24)>>>0}};function i_(e,t){const n=[],r=e2e(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 u=o();if(n.push({matcher:u,priority:l}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();const l=i();return u=>!!l&&!l(u)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(lO(s)){const l=[];do l.push(s),s=r.next();while(lO(s));return u=>t(l,u)}return null}function o(){const l=[];let u=i();for(;u;)l.push(u),u=i();return d=>l.every(h=>h(d))}function a(){const l=[];let u=o();for(;u&&(l.push(u),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");u=o()}return d=>l.some(h=>h(d))}}function lO(e){return!!e&&!!e.match(/[\w\.:]+/)}function e2e(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 mY(e){typeof e.dispose=="function"&&e.dispose()}var Oy=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},t2e=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},n2e=class{constructor(){Me(this,"_references",[]);Me(this,"_seenReferenceKeys",new Set);Me(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))}},r2e=class{constructor(e,t){Me(this,"seenFullScopeRequests",new Set);Me(this,"seenPartialScopeRequests",new Set);Me(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Oy(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new n2e;for(const n of e)s2e(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Oy){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 s2e(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 Oy?Bk({baseGrammar:i,selfGrammar:s},r):N7(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 Oy(a))}function N7(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];o_([r],t,n)}}function Bk(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&o_(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&o_(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function o_(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?oY({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&o_(r.patterns,{...t,repository:s},n);const i=r.include;if(!i)continue;const o=pY(i);switch(o.kind){case 0:Bk({...t,selfGrammar:t.baseGrammar},n);break;case 1:Bk(t,n);break;case 2:N7(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?N7(o.ruleName,l,n):Bk(l,n)}else o.kind===4?n.add(new t2e(o.scopeName,o.ruleName)):n.add(new Oy(o.scopeName));break}}}var i2e=class{constructor(){Me(this,"kind",0)}},o2e=class{constructor(){Me(this,"kind",1)}},a2e=class{constructor(e){Me(this,"kind",2);this.ruleName=e}},l2e=class{constructor(e){Me(this,"kind",3);this.scopeName=e}},c2e=class{constructor(e,t){Me(this,"kind",4);this.scopeName=e,this.ruleName=t}};function pY(e){if(e==="$base")return new i2e;if(e==="$self")return new o2e;const t=e.indexOf("#");if(t===-1)return new l2e(e);if(t===0)return new a2e(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new c2e(n,r)}}var u2e=/\\(\d+)/,cO=/\\(\d+)/g,d2e=-1,gY=-2;var $v=class{constructor(t,n,r,s){Me(this,"$location");Me(this,"id");Me(this,"_nameIsCapturing");Me(this,"_name");Me(this,"_contentNameIsCapturing");Me(this,"_contentName");this.$location=t,this.id=n,this._name=r||null,this._nameIsCapturing=dw.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=dw.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${aY(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:dw.replaceCaptures(this._name,t,n)}getContentName(t,n){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:dw.replaceCaptures(this._contentName,t,n)}},h2e=class extends $v{constructor(t,n,r,s,i){super(t,n,r,s);Me(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!")}},f2e=class extends $v{constructor(t,n,r,s,i){super(t,n,r,null);Me(this,"_match");Me(this,"captures");Me(this,"_cachedCompiledPatterns");this._match=new By(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 $y,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},uO=class extends $v{constructor(t,n,r,s,i){super(t,n,r,s);Me(this,"hasMissingPatterns");Me(this,"patterns");Me(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 $y,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},j7=class extends $v{constructor(t,n,r,s,i,o,a,l,u,d){super(t,n,r,s);Me(this,"_begin");Me(this,"beginCaptures");Me(this,"_end");Me(this,"endHasBackReferences");Me(this,"endCaptures");Me(this,"applyEndPatternLast");Me(this,"hasMissingPatterns");Me(this,"patterns");Me(this,"_cachedCompiledPatterns");this._begin=new By(i,this.id),this.beginCaptures=o,this._end=new By(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=u||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,s)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $y;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}},a_=class extends $v{constructor(t,n,r,s,i,o,a,l,u){super(t,n,r,s);Me(this,"_begin");Me(this,"beginCaptures");Me(this,"whileCaptures");Me(this,"_while");Me(this,"whileHasBackReferences");Me(this,"hasMissingPatterns");Me(this,"patterns");Me(this,"_cachedCompiledPatterns");Me(this,"_cachedCompiledWhilePatterns");this._begin=new By(i,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new By(a,gY),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,s){return this._getCachedCompiledPatterns(t).compileAG(t,r,s)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $y;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 $y,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},bY=class po{static createCaptureRule(t,n,r,s,i){return t.registerRule(o=>new h2e(n,o,r,s,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new f2e(t.$vscodeTextmateLocation,t.id,t.name,t.match,po._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=oY({},r,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new uO(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,po._compilePatterns(i,n,r))}return t.while?new a_(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,po._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,po._compileCaptures(t.whileCaptures||t.captures,n,r),po._compilePatterns(t.patterns,n,r)):new j7(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,po._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,po._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,po._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=po.getCompiledRuleId(t[o],n,r)),s[a]=po.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 u=pY(a.include);switch(u.kind){case 0:case 1:l=po.getCompiledRuleId(r[a.include],n,r);break;case 2:let d=r[u.ruleName];d&&(l=po.getCompiledRuleId(d,n,r));break;case 3:case 4:const h=u.scopeName,m=u.kind===4?u.ruleName:null,p=n.getExternalGrammar(h,r);if(p)if(m){let g=p.repository[m];g&&(l=po.getCompiledRuleId(g,n,p.repository))}else l=po.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else l=po.getCompiledRuleId(a,n,r);if(l!==-1){const u=n.getRule(l);let d=!1;if((u instanceof uO||u instanceof j7||u instanceof a_)&&u.hasMissingPatterns&&u.patterns.length===0&&(d=!0),d)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},By=class yY{constructor(t,n){Me(this,"source");Me(this,"ruleId");Me(this,"hasAnchor");Me(this,"hasBackReferences");Me(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 u=t.charAt(a+1);u==="z"?(i.push(t.substring(s,a)),i.push("$(?!\\n)(?<!\\n)"),s=a+2):(u==="A"||u==="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=u2e.test(this.source):this.hasBackReferences=!1}clone(){return new yY(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 cO.lastIndex=0,this.source.replace(cO,(s,i)=>uY(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}},$y=class{constructor(){Me(this,"_items");Me(this,"_hasAnchors");Me(this,"_cached");Me(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 dO(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 dO(e,r,this._items.map(s=>s.ruleId))}},dO=class{constructor(e,t,n){Me(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}},X5=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Bu,m2e=(Bu=class{constructor(t,n){Me(this,"_defaultAttributes");Me(this,"_embeddedLanguagesMatcher");Me(this,"_getBasicScopeAttributes",new dY(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new X5(n,r)}));this._defaultAttributes=new X5(t,8),this._embeddedLanguagesMatcher=new p2e(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Bu._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Bu.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!")}},Me(Bu,"_NULL_SCOPE_METADATA",new X5(0,0)),Me(Bu,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Bu),p2e=class{constructor(e){Me(this,"values");Me(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>uY(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])}},hO=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function vY(e,t,n,r,s,i,o,a){const l=t.content.length;let u=!1,d=-1;if(o){const p=g2e(e,t,n,r,s,i);s=p.stack,r=p.linePos,n=p.isFirstLine,d=p.anchorPosition}const h=Date.now();for(;!u;){if(a!==0&&Date.now()-h>a)return new hO(s,!0);m()}return new hO(s,!1);function m(){const p=b2e(e,t,n,r,s,d);if(!p){i.produce(s,l),u=!0;return}const g=p.captureIndices,b=p.matchedRuleId,x=g&&g.length>0?g[0].end>r:!1;if(b===d2e){const v=s.getRule(e);i.produce(s,g[0].start),s=s.withContentNameScopesList(s.nameScopesList),yb(e,t,n,s,i,v.endCaptures,g),i.produce(s,g[0].end);const y=s;if(s=s.parent,d=y.getAnchorPos(),!x&&y.getEnterPos()===r){s=y,i.produce(s,l),u=!0;return}}else{const v=e.getRule(b);i.produce(s,g[0].start);const y=s,w=v.getName(t.content,g),k=s.contentNameScopesList.pushAttributed(w,e);if(s=s.push(b,r,d,g[0].end===l,null,k,k),v instanceof j7){const T=v;yb(e,t,n,s,i,T.beginCaptures,g),i.produce(s,g[0].end),d=g[0].end;const S=T.getContentName(t.content,g),C=k.pushAttributed(S,e);if(s=s.withContentNameScopesList(C),T.endHasBackReferences&&(s=s.withEndRule(T.getEndWithResolvedBackReferences(t.content,g))),!x&&y.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),u=!0;return}}else if(v instanceof a_){const T=v;yb(e,t,n,s,i,T.beginCaptures,g),i.produce(s,g[0].end),d=g[0].end;const S=T.getContentName(t.content,g),C=k.pushAttributed(S,e);if(s=s.withContentNameScopesList(C),T.whileHasBackReferences&&(s=s.withEndRule(T.getWhileWithResolvedBackReferences(t.content,g))),!x&&y.hasSameRuleAs(s)){s=s.pop(),i.produce(s,l),u=!0;return}}else if(yb(e,t,n,s,i,v.captures,g),i.produce(s,g[0].end),s=s.pop(),!x){s=s.safePop(),i.produce(s,l),u=!0;return}}g[0].end>r&&(r=g[0].end,n=!1)}}function g2e(e,t,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const u=l.getRule(e);u instanceof a_&&a.push({rule:u,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:u,findOptions:d}=x2e(l.rule,e,l.stack.endRule,n,r===o),h=u.findNextMatchSync(t,r,d);if(h){if(h.ruleId!==gY){s=l.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(l.stack,h.captureIndices[0].start),yb(e,t,n,l.stack,i,l.rule.whileCaptures,h.captureIndices),i.produce(l.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function b2e(e,t,n,r,s,i){const o=y2e(e,t,n,r,s,i),a=e.getInjections();if(a.length===0)return o;const l=v2e(a,e,t,n,r,s,i);if(!l)return o;if(!o)return l;const u=o.captureIndices[0].start,d=l.captureIndices[0].start;return d<u||l.priorityMatch&&d===u?l:o}function y2e(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:a,findOptions:l}=xY(o,e,s.endRule,n,r===i),u=a.findNextMatchSync(t,r,l);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function v2e(e,t,n,r,s,i,o){let a=Number.MAX_VALUE,l=null,u,d=0;const h=i.contentNameScopesList.getScopeNames();for(let m=0,p=e.length;m<p;m++){const g=e[m];if(!g.matcher(h))continue;const b=t.getRule(g.ruleId),{ruleScanner:x,findOptions:v}=xY(b,t,null,r,s===o),y=x.findNextMatchSync(n,s,v);if(!y)continue;const w=y.captureIndices[0].start;if(!(w>=a)&&(a=w,l=y.captureIndices,u=y.ruleId,d=g.priority,a===s))break}return l?{priorityMatch:d===-1,captureIndices:l,matchedRuleId:u}:null}function xY(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function x2e(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function yb(e,t,n,r,s,i,o){if(i.length===0)return;const a=t.content,l=Math.min(i.length,o.length),u=[],d=o[0].end;for(let h=0;h<l;h++){const m=i[h];if(m===null)continue;const p=o[h];if(p.length===0)continue;if(p.start>d)break;for(;u.length>0&&u[u.length-1].endPos<=p.start;)s.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?s.produceFromScopes(u[u.length-1].scopes,p.start):s.produce(r,p.start),m.retokenizeCapturedWithRuleId){const b=m.getName(a,o),x=r.contentNameScopesList.pushAttributed(b,e),v=m.getContentName(a,o),y=x.pushAttributed(v,e),w=r.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,x,y),k=e.createOnigString(a.substring(0,p.end));vY(e,k,n&&p.start===0,p.start,w,s,!1,0),mY(k);continue}const g=m.getName(a,o);if(g!==null){const x=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).pushAttributed(g,e);u.push(new w2e(x,p.end))}}for(;u.length>0;)s.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var w2e=class{constructor(e,t){Me(this,"scopes");Me(this,"endPos");this.scopes=e,this.endPos=t}};function k2e(e,t,n,r,s,i,o,a){return new S2e(e,t,n,r,s,i,o,a)}function fO(e,t,n,r,s){const i=i_(t,l_),o=bY.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 l_(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(_2e(t[s],r))return n=s+1,!0;return!1})}function _2e(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 S2e=class{constructor(e,t,n,r,s,i,o,a){Me(this,"_rootId");Me(this,"_lastRuleId");Me(this,"_ruleId2desc");Me(this,"_includedGrammars");Me(this,"_grammarRepository");Me(this,"_grammar");Me(this,"_injections");Me(this,"_basicScopeAttributesProvider");Me(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new m2e(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=mO(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const u=i_(l,l_);for(const d of u)this._tokenTypeMatchers.push({matcher:d.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)fO(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&&fO(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]=mO(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=bY.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===I7.NULL){s=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),h=bg.set(0,u.languageId,u.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),m=this.getRule(this._rootId).getName(null,null);let p;m?p=ny.createRootAndLookUpScopeName(m,h,this):p=ny.createRoot("unknown",h),t=new I7(null,this._rootId,-1,-1,!1,null,p,p)}else s=!1,t.reset();e=e+`
`;const i=this.createOnigString(e),o=i.content.length,a=new T2e(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=vY(this,i,s,0,t,a,!0,r);return mY(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function mO(e,t){return e=Hke(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 ny=class Cc{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=Y5.push(s,i.scopeNames),r=new Cc(r,s,i.encodedTokenAttributes);return r}static createRoot(t,n){return new Cc(null,new Y5(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new Y5(null,t),o=r.themeProvider.themeMatch(i),a=Cc.mergeAttributes(n,s,o);return new Cc(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return Cc.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),bg.set(t,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return Cc._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const i of r)s=Cc._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=Cc.mergeAttributes(t.tokenAttributes,s,o);return new Cc(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}},Tl,I7=(Tl=class{constructor(t,n,r,s,i,o,a,l){Me(this,"_stackElementBrand");Me(this,"_enterPos");Me(this,"_anchorPos");Me(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:Tl._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?ny.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(){Tl._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,a){return new Tl(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 Tl(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=ny.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new Tl(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ny.fromExtension(r,n.contentNameScopesList))}},Me(Tl,"NULL",new Tl(null,0,0,0,!1,null,null,null)),Tl),C2e=class{constructor(e,t){Me(this,"balancedBracketScopes");Me(this,"unbalancedBracketScopes");Me(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):i_(n,l_).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>i_(n,l_).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}},T2e=class{constructor(e,t,n,r){Me(this,"_emitBinaryTokens");Me(this,"_lineText");Me(this,"_tokens");Me(this,"_binaryTokens");Me(this,"_lastTokenEndIndex");Me(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=bg.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(s=bg.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}},A2e=class{constructor(e,t){Me(this,"_grammars",new Map);Me(this,"_rawGrammars",new Map);Me(this,"_injectionGrammars",new Map);Me(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,k2e(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},E2e=class{constructor(t){Me(this,"_options");Me(this,"_syncRegistry");Me(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new A2e(s_.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(s_.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 C2e(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,i){const o=new r2e(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)}},R7=I7.NULL;const M2e=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],N2e=/["&'<>`]/g,j2e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,I2e=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,R2e=/[|\\{}()[\]^$+*?.]/g,pO=new WeakMap;function D2e(e,t){if(e=e.replace(t.subset?L2e(t.subset):N2e,r),t.subset||t.escapeOnly)return e;return e.replace(j2e,n).replace(I2e,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 L2e(e){let t=pO.get(e);return t||(t=P2e(e),pO.set(e,t)),t}function P2e(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(R2e,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const O2e=/[\dA-Fa-f]/;function B2e(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!O2e.test(String.fromCharCode(t))?r:r+";"}const $2e=/\d/;function z2e(e,t,n){const r="&#"+String(e);return n&&t&&!$2e.test(String.fromCharCode(t))?r:r+";"}const F2e=["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"],Q5={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:"€"},q2e=["cent","copy","divide","gt","lt","not","para","times"],wY={}.hasOwnProperty,D7={};let hw;for(hw in Q5)wY.call(Q5,hw)&&(D7[Q5[hw]]=hw);const H2e=/[^\dA-Za-z]/;function U2e(e,t,n,r){const s=String.fromCharCode(e);if(wY.call(D7,s)){const i=D7[s],o="&"+i;return n&&F2e.includes(i)&&!q2e.includes(i)&&(!r||t&&t!==61&&H2e.test(String.fromCharCode(t)))?o:o+";"}return""}function V2e(e,t,n){let r=B2e(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=U2e(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=z2e(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function q0(e,t){return D2e(e,Object.assign({format:V2e},t))}const W2e=/^>|^->|<!--|-->|--!>|<!-$/g,G2e=[">"],K2e=["<",">"];function Y2e(e,t,n,r){return r.settings.bogusComments?"<?"+q0(e.value,Object.assign({},r.settings.characterReferences,{subset:G2e}))+">":"<!--"+e.value.replace(W2e,s)+"-->";function s(i){return q0(i,Object.assign({},r.settings.characterReferences,{subset:K2e}))}}function X2e(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const Ii=_Y(1),kY=_Y(-1),Q2e=[];function _Y(e){return t;function t(n,r,s){const i=n?n.children:Q2e;let o=(r||0)+e,a=i[o];if(!s)for(;a&&Q4(a);)o+=e,a=i[o];return a}}const J2e={}.hasOwnProperty;function SY(e){return t;function t(n,r,s){return J2e.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const NM=SY({body:e_e,caption:J5,colgroup:J5,dd:s_e,dt:r_e,head:J5,html:Z2e,li:n_e,optgroup:i_e,option:o_e,p:t_e,rp:gO,rt:gO,tbody:l_e,td:bO,tfoot:c_e,th:bO,thead:a_e,tr:u_e});function J5(e,t,n){const r=Ii(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Q4(r.value.charAt(0)))}function Z2e(e,t,n){const r=Ii(n,t);return!r||r.type!=="comment"}function e_e(e,t,n){const r=Ii(n,t);return!r||r.type!=="comment"}function t_e(e,t,n){const r=Ii(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 n_e(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&r.tagName==="li"}function r_e(e,t,n){const r=Ii(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function s_e(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function gO(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function i_e(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function o_e(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function a_e(e,t,n){const r=Ii(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function l_e(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function c_e(e,t,n){return!Ii(n,t)}function u_e(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function bO(e,t,n){const r=Ii(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const d_e=SY({body:m_e,colgroup:p_e,head:f_e,html:h_e,tbody:g_e});function h_e(e){const t=Ii(e,-1);return!t||t.type!=="comment"}function f_e(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 m_e(e){const t=Ii(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Q4(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function p_e(e,t,n){const r=kY(n,t),s=Ii(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&NM(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function g_e(e,t,n){const r=kY(n,t),s=Ii(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&NM(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const fw={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 b_e(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=Vg);const u=y_e(r,e.properties),d=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,d&&(o=!1),(u||!i||!d_e(e,t,n))&&(a.push("<",e.tagName,u?" "+u:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(d),!o&&(!i||!NM(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function y_e(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=v_e(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 v_e(e,t,n){const r=V9(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=q0(r.attribute,Object.assign({},e.settings.characterReferences,{subset:fw.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?$W:GW)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=q0(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:fw.unquoted[s][i]}))),a!==n&&(e.settings.quoteSmart&&X2(n,o)>X2(n,e.alternative)&&(o=e.alternative),a=o+q0(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?fw.single:fw.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const x_e=["<","&"];function CY(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:q0(e.value,Object.assign({},r.settings.characterReferences,{subset:x_e}))}function w_e(e,t,n,r){return r.settings.allowDangerousHtml?e.value:CY(e,t,n,r)}function k_e(e,t,n,r){return r.all(e)}const __e=yye("type",{invalid:S_e,unknown:C_e,handlers:{comment:Y2e,doctype:X2e,element:b_e,raw:w_e,root:k_e,text:CY}});function S_e(e){throw new Error("Expected node, not `"+e+"`")}function C_e(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const T_e={},A_e={},E_e=[];function M_e(e,t){const n=T_e,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:N_e,all:j_e,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||M2e,characterReferences:n.characterReferences||A_e,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Vg:W9,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function N_e(e,t,n){return __e(e,t,n,this)}function j_e(e){const t=[],n=e&&e.children||E_e;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function I_e(e){return Array.isArray(e)?e:[e]}function bS(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 jM(e){return!e||["plaintext","txt","text","plain"].includes(e)}function TY(e){return e==="ansi"||jM(e)}function IM(e){return e==="none"}function AY(e){return IM(e)}function EY(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 R_e(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 D_e(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?R_e(s,i):s})):e}async function MY(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function c_(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 vm(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function NY(e){const t={};return e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle&&(e.fontStyle&Hu.Italic&&(t["font-style"]="italic"),e.fontStyle&Hu.Bold&&(t["font-weight"]="bold"),e.fontStyle&Hu.Underline&&(t["text-decoration"]="underline")),t}function L_e(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function P_e(e){const t=bS(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 Bo extends Error{constructor(t){super(t),this.name="ShikiError"}}const jY=new WeakMap;function yS(e,t){jY.set(e,t)}function zy(e){return jY.get(e)}class Qg{constructor(...t){Me(this,"_stacks",{});Me(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 Qg(Object.fromEntries(I_e(n).map(r=>[r,R7])),t)}getInternalStack(t=this.theme){return this._stacks[t]}get scopes(){return yO(this._stacks[this.theme])}getScopes(t=this.theme){return yO(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function yO(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 O_e(e,t){if(!(e instanceof Qg))throw new Bo("Invalid grammar state");return e.getInternalStack(t)}function B_e(){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 Bo(`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 Bo(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${s.lines.length}`);if(o.character<0||o.character>a.length)throw new Bo(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:s.posToIndex(o.line,o.character)}}};const s=P_e(n.source),i=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));$_e(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 D_e(n,s)},code(n){var d;if(!((d=this.options.decorations)!=null&&d.length))return;const r=t(this),s=Array.from(n.children).filter(h=>h.type==="element"&&h.tagName==="span");if(s.length!==r.converter.lines.length)throw new Bo(`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(h,m,p,g){const b=s[h];let x="",v=-1,y=-1;if(m===0&&(v=0),p===0&&(y=0),p===Number.POSITIVE_INFINITY&&(y=b.children.length),v===-1||y===-1)for(let k=0;k<b.children.length;k++)x+=IY(b.children[k]),v===-1&&x.length===m&&(v=k+1),y===-1&&x.length===p&&(y=k+1);if(v===-1)throw new Bo(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(y===-1)throw new Bo(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const w=b.children.slice(v,y);if(!g.alwaysWrap&&w.length===b.children.length)a(b,g,"line");else if(!g.alwaysWrap&&w.length===1&&w[0].type==="element")a(w[0],g,"token");else{const k={type:"element",tagName:"span",properties:{},children:w};a(k,g,"wrapper"),b.children.splice(v,w.length,k)}}function o(h,m){s[h]=a(s[h],m,"line")}function a(h,m,p){var x;const g=m.properties||{},b=m.transform||(v=>v);return h.tagName=m.tagName||"span",h.properties={...h.properties,...g,class:h.properties.class},(x=m.properties)!=null&&x.class&&EY(h,m.properties.class),h=b(h,p)||h,h}const l=[],u=r.decorations.sort((h,m)=>m.start.offset-h.start.offset);for(const h of u){const{start:m,end:p}=h;if(m.line===p.line)i(m.line,m.character,p.character,h);else if(m.line<p.line){i(m.line,m.character,Number.POSITIVE_INFINITY,h);for(let g=m.line+1;g<p.line;g++)l.unshift(()=>o(g,h));i(p.line,0,p.character,h)}}l.forEach(h=>h())}}}function $_e(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new Bo(`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 Bo(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function IY(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(IY).join(""):""}const z_e=[B_e()];function u_(e){return[...e.transformers||[],...z_e]}var xm=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Z5={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function F_e(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 vO(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 q_e(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)Z5[s]&&t.push({type:"setDecoration",value:Z5[s]});else if(s<=29){const i=Z5[s-20];i&&t.push({type:"resetDecoration",value:i})}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:xm[s-30]}});else if(s===38){const[i,o]=vO(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:xm[s-40]}});else if(s===48){const[i,o]=vO(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:xm[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:xm[s-100+8]}})}return t}function H_e(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=F_e(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=q_e(o.sequence);for(const u of l)u.type==="resetAll"?(e=null,t=null,n.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&n.delete(u.value);for(const u of l)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&n.add(u.value)}i=o.position}while(i<r.length);return s}}}var U_e={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function V_e(e=U_e){function t(a){return e[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let u=0;u<xm.length;u++)r.push(t(xm[u]));let a=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let d=0;d<6;d++)for(let h=0;h<6;h++)r.push(n([a[u],a[d],a[h]]));let l=8;for(let u=0;u<24;u++,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 W_e(e,t,n){const r=c_(e,n),s=bS(t),i=V_e(Object.fromEntries(xm.map(a=>{var l;return[a,(l=e.colors)==null?void 0:l[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]}))),o=H_e();return s.map(a=>o.parse(a[0]).map(l=>{let u,d;l.decorations.has("reverse")?(u=l.background?i.value(l.background):e.bg,d=l.foreground?i.value(l.foreground):e.fg):(u=l.foreground?i.value(l.foreground):e.fg,d=l.background?i.value(l.background):void 0),u=vm(u,r),d=vm(d,r),l.decorations.has("dim")&&(u=G_e(u));let h=Hu.None;return l.decorations.has("bold")&&(h|=Hu.Bold),l.decorations.has("italic")&&(h|=Hu.Italic),l.decorations.has("underline")&&(h|=Hu.Underline),{content:l.value,offset:a[1],color:u,bgColor:d,fontStyle:h}}))}function G_e(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 RM(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(jM(r)||IM(s))return bS(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:i,colorMap:o}=e.setTheme(s);if(r==="ansi")return W_e(i,t,n);const a=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new Xu(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Xu(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Y_e(t,a,i,o,n)}function K_e(...e){if(e.length===2)return zy(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(jM(s)||IM(i))throw new Xu("Plain language does not have grammar state");if(s==="ansi")throw new Xu("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(s);return new Qg(d_(n,l,o,a,r).stateStack,l.name,o.name)}function Y_e(e,t,n,r,s){const i=d_(e,t,n,r,s),o=new Qg(d_(e,t,n,r,s).stateStack,t.name,n.name);return yS(i.tokens,o),i.tokens}function d_(e,t,n,r,s){const i=c_(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,l=bS(e);let u=s.grammarState?O_e(s.grammarState,n.name)??R7:s.grammarContextCode!=null?d_(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:R7,d=[];const h=[];for(let m=0,p=l.length;m<p;m++){const[g,b]=l[m];if(g===""){d=[],h.push([]);continue}if(o>0&&g.length>=o){d=[],h.push([{content:g,offset:b,color:"",fontStyle:0}]);continue}let x,v,y;s.includeExplanation&&(x=t.tokenizeLine(g,u),v=x.tokens,y=0);const w=t.tokenizeLine2(g,u,a),k=w.tokens.length/2;for(let T=0;T<k;T++){const S=w.tokens[2*T],C=T+1<k?w.tokens[2*T+2]:g.length;if(S===C)continue;const _=w.tokens[2*T+1],A=vm(r[bg.getForeground(_)],i),M=bg.getFontStyle(_),L={content:g.substring(S,C),offset:b+S,color:A,fontStyle:M};if(s.includeExplanation){const N=[];if(s.includeExplanation!=="scopeName")for(const B of n.settings){let $;switch(typeof B.scope){case"string":$=B.scope.split(/,/).map(P=>P.trim());break;case"object":$=B.scope;break;default:continue}N.push({settings:B,selectors:$.map(P=>P.split(/ /))})}L.explanation=[];let O=0;for(;S+O<C;){const B=v[y],$=g.substring(B.startIndex,B.endIndex);O+=$.length,L.explanation.push({content:$,scopes:s.includeExplanation==="scopeName"?X_e(B.scopes):Q_e(N,B.scopes)}),y+=1}}d.push(L)}h.push(d),d=[],u=w.ruleStack}return{tokens:h,stateStack:u}}function X_e(e){return e.map(t=>({scopeName:t}))}function Q_e(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];n[r]={scopeName:i,themeMatches:Z_e(e,i,t.slice(0,r))}}return n}function xO(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function J_e(e,t,n){if(!xO(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)xO(e[r],n[s])&&(r-=1),s-=1;return r===-1}function Z_e(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const o of s)if(J_e(o,t,n)){r.push(i);break}return r}function RY(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 u=RM(e,t,{...n,theme:l.theme}),d=zy(u),h=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:u,state:d,theme:h}}),i=e4e(...s.map(l=>l.tokens)),o=i[0].map((l,u)=>l.map((d,h)=>{const m={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(m.explanation=d.explanation),i.forEach((p,g)=>{const{content:b,explanation:x,offset:v,...y}=p[u][h];m.variants[r[g].color]=y}),m})),a=s[0].state?new Qg(Object.fromEntries(s.map(l=>{var u;return[l.theme,(u=l.state)==null?void 0:u.getInternalStack(l.theme)]})),s[0].state.lang):void 0;return a&&yS(o,a),o}function e4e(...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,u)=>l.push(i[u]));const o=s.map(()=>0),a=s.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(u=>u.content.length));for(let u=0;u<n;u++){const d=a[u];d.content.length===l?(i[u].push(d),o[u]+=1,a[u]=s[u][o[u]]):(i[u].push({...d,content:d.content.slice(0,l)}),a[u]={...d,content:d.content.slice(l),offset:d.offset+l})}}}return t}function h_(e,t,n){let r,s,i,o,a,l;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:d="--shiki-"}=n,h=Object.entries(n.themes).filter(x=>x[1]).map(x=>({color:x[0],theme:x[1]})).sort((x,v)=>x.color===u?-1:v.color===u?1:0);if(h.length===0)throw new Xu("`themes` option must not be empty");const m=RY(e,t,n);if(l=zy(m),u&&!h.find(x=>x.color===u))throw new Xu(`\`themes\` option must contain the defaultColor key \`${u}\``);const p=h.map(x=>e.getTheme(x.theme)),g=h.map(x=>x.color);i=m.map(x=>x.map(v=>t4e(v,g,d,u))),l&&yS(i,l);const b=h.map(x=>c_(x.theme,n));s=h.map((x,v)=>(v===0&&u?"":`${d+x.color}:`)+(vm(p[v].fg,b[v])||"inherit")).join(";"),r=h.map((x,v)=>(v===0&&u?"":`${d+x.color}-bg:`)+(vm(p[v].bg,b[v])||"inherit")).join(";"),o=`shiki-themes ${p.map(x=>x.name).join(" ")}`,a=u?void 0:[s,r].join(";")}else if("theme"in n){const u=c_(n.theme,n);i=RM(e,t,n);const d=e.getTheme(n.theme);r=vm(d.bg,u),s=vm(d.fg,u),o=d.name,l=zy(i)}else throw new Xu("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:l}}function t4e(e,t,n,r){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(l=>NY(e.variants[l])),o=new Set(i.flatMap(l=>Object.keys(l))),a={};return i.forEach((l,u)=>{for(const d of o){const h=l[d]||"inherit";if(u===0&&r)a[d]=h;else{const m=d==="color"?"":d==="background-color"?"-bg":`-${d}`,p=n+t[u]+(d==="color"?"":m);a[p]=h}}}),s.htmlStyle=a,s}function f_(e,t,n,r={meta:{},options:n,codeToHast:(s,i)=>f_(e,s,i),codeToTokens:(s,i)=>h_(e,s,i)}){var p,g;let s=t;for(const b of u_(n))s=((p=b.preprocess)==null?void 0:p.call(r,s,n))||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:u,grammarState:d}=h_(e,s,n);const{mergeWhitespaces:h=!0}=n;h===!0?i=r4e(i):h==="never"&&(i=s4e(i));const m={...r,get source(){return s}};for(const b of u_(n))i=((g=b.tokens)==null?void 0:g.call(m,i))||i;return n4e(i,{...n,fg:o,bg:a,themeName:l,rootStyle:u},m,d)}function n4e(e,t,n,r=zy(e)){var g,b,x;const s=u_(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t;let u={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(([v])=>!v.startsWith("_")))},children:[]},d={type:"element",tagName:"code",properties:{},children:i};const h=[],m={...n,structure:a,addClassToHast:EY,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return h}};if(e.forEach((v,y)=>{var T,S;y&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
`}));let w={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(const C of v){let _={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]};C.htmlStyle;const A=L_e(C.htmlStyle||NY(C));A&&(_.properties.style=A);for(const M of s)_=((T=M==null?void 0:M.span)==null?void 0:T.call(m,_,y+1,k,w,C))||_;a==="inline"?o.children.push(_):a==="classic"&&w.children.push(_),k+=C.content.length}if(a==="classic"){for(const C of s)w=((S=C==null?void 0:C.line)==null?void 0:S.call(m,w,y+1))||w;h.push(w),i.push(w)}}),a==="classic"){for(const v of s)d=((g=v==null?void 0:v.code)==null?void 0:g.call(m,d))||d;u.children.push(d);for(const v of s)u=((b=v==null?void 0:v.pre)==null?void 0:b.call(m,u))||u;o.children.push(u)}let p=o;for(const v of s)p=((x=v==null?void 0:v.root)==null?void 0:x.call(m,p))||p;return r&&yS(p,r),p}function r4e(e){return e.map(t=>{const n=[];let r="",s=0;return t.forEach((i,o)=>{const l=!(i.fontStyle&&i.fontStyle&Hu.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 s4e(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 i4e(e,t,n){var i;const r={meta:{},options:n,codeToHast:(o,a)=>f_(e,o,a),codeToTokens:(o,a)=>h_(e,o,a)};let s=M_e(f_(e,t,n,r));for(const o of u_(n))s=((i=o.postprocess)==null?void 0:i.call(r,s,n))||s;return s}const wO={light:"#333333",dark:"#bbbbbb"},kO={light:"#fffffe",dark:"#1e1e1e"},_O="__shiki_resolved";function DM(e){var a,l,u,d,h;if(e!=null&&e[_O])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 m=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(a=m==null?void 0:m.settings)!=null&&a.foreground&&(r=m.settings.foreground),(l=m==null?void 0:m.settings)!=null&&l.background&&(n=m.settings.background),!r&&((u=t==null?void 0:t.colors)!=null&&u["editor.foreground"])&&(r=t.colors["editor.foreground"]),!n&&((d=t==null?void 0:t.colors)!=null&&d["editor.background"])&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?wO.light:wO.dark),n||(n=t.type==="light"?kO.light:kO.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(m){var g;if(i.has(m))return i.get(m);s+=1;const p=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(g=t.colorReplacements)!=null&&g[`#${p}`]?o(m):(i.set(m,p),p)}t.settings=t.settings.map(m=>{var x,v;const p=((x=m.settings)==null?void 0:x.foreground)&&!m.settings.foreground.startsWith("#"),g=((v=m.settings)==null?void 0:v.background)&&!m.settings.background.startsWith("#");if(!p&&!g)return m;const b={...m,settings:{...m.settings}};if(p){const y=o(m.settings.foreground);t.colorReplacements[y]=m.settings.foreground,b.settings.foreground=y}if(g){const y=o(m.settings.background);t.colorReplacements[y]=m.settings.background,b.settings.background=y}return b});for(const m of Object.keys(t.colors||{}))if((m==="editor.foreground"||m==="editor.background"||m.startsWith("terminal.ansi"))&&!((h=t.colors[m])!=null&&h.startsWith("#"))){const p=o(t.colors[m]);t.colorReplacements[p]=t.colors[m],t.colors[m]=p}return Object.defineProperty(t,_O,{enumerable:!1,writable:!1,value:!0}),t}async function DY(e){return Array.from(new Set((await Promise.all(e.filter(t=>!TY(t)).map(async t=>await MY(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function LY(e){return(await Promise.all(e.map(async n=>AY(n)?null:DM(await MY(n))))).filter(n=>!!n)}class o4e extends E2e{constructor(n,r,s,i={}){super(n);Me(this,"_resolvedThemes",new Map);Me(this,"_resolvedGrammars",new Map);Me(this,"_langMap",new Map);Me(this,"_langGraph",new Map);Me(this,"_textmateThemeCache",new WeakMap);Me(this,"_loadedThemesCache",null);Me(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=DM(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=s_.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 Bo(`Circular alias \`${Array.from(r).join(" -> ")} -> ${n}\``);r.add(n)}}return this._resolvedGrammars.get(n)}loadLanguage(n){var o,a,l,u;if(this.getGrammar(n.name))return;const r=new Set([...this._langMap.values()].filter(d=>{var h;return(h=d.embeddedLangsLazy)==null?void 0:h.includes(n.name)}));this._resolver.addLanguage(n);const 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(d=>{this._alias[d]=n.name}),this._loadedLanguagesCache=null,r.size)for(const d of r)this._resolvedGrammars.delete(d.name),this._loadedLanguagesCache=null,(a=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||a.delete(d.scopeName),(u=(l=this._syncRegistry)==null?void 0:l._grammars)==null||u.delete(d.scopeName),this.loadLanguage(this._langMap.get(d.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const 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(u=>s.map(([d])=>d).includes(u)))}).filter(o=>!s.includes(o));throw new Bo(`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 a4e{constructor(t,n){Me(this,"_langs",new Map);Me(this,"_scopeToLang",new Map);Me(this,"_injections",new Map);Me(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 K1=0;function l4e(e){K1+=1,e.warnings!==!1&&K1>=10&&K1%10===0&&console.warn(`[Shiki] ${K1} 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 Bo("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(DM),s=new a4e(e.engine,n),i=new o4e(s,r,n,e.langAlias);let o;function a(y){x();const w=i.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new Bo(`Language \`${y}\` not found, you may need to load it first`);return w}function l(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};x();const w=i.getTheme(y);if(!w)throw new Bo(`Theme \`${y}\` not found, you may need to load it first`);return w}function u(y){x();const w=l(y);o!==y&&(i.setTheme(w),o=y);const k=i.getColorMap();return{theme:w,colorMap:k}}function d(){return x(),i.getLoadedThemes()}function h(){return x(),i.getLoadedLanguages()}function m(...y){x(),i.loadLanguages(y.flat(1))}async function p(...y){return m(await DY(y))}function g(...y){x();for(const w of y.flat(1))i.loadTheme(w)}async function b(...y){return x(),g(await LY(y))}function x(){if(t)throw new Bo("Shiki instance has been disposed")}function v(){t||(t=!0,i.dispose(),K1-=1)}return{setTheme:u,getTheme:l,getLanguage:a,getLoadedThemes:d,getLoadedLanguages:h,loadLanguage:p,loadLanguageSync:m,loadTheme:b,loadThemeSync:g,dispose:v,[Symbol.dispose]:v}}async function c4e(e={}){e.loadWasm;const[t,n,r]=await Promise.all([LY(e.themes||[]),DY(e.langs||[]),e.engine||iY(e.loadWasm||qke())]);return l4e({...e,themes:t,langs:n,engine:r})}async function u4e(e={}){const t=await c4e(e);return{getLastGrammarState:(...n)=>K_e(t,...n),codeToTokensBase:(n,r)=>RM(t,n,r),codeToTokensWithThemes:(n,r)=>RY(t,n,r),codeToTokens:(n,r)=>h_(t,n,r),codeToHast:(n,r)=>f_(t,n,r),codeToHtml:(n,r)=>i4e(t,n,r),...t,getInternalContext:()=>t}}function d4e(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(p){if(typeof p=="string"){if(TY(p))return[];const g=r[p];if(!g)throw new Xu(`Language \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}function u(p){if(AY(p))return"none";if(typeof p=="string"){const g=s[p];if(!g)throw new Xu(`Theme \`${p}\` is not included in this bundle. You may want to load it from external source.`);return g}return p}const d=(a.themes??[]).map(p=>u(p)),h=(a.langs??[]).map(p=>l(p)),m=await u4e({engine:a.engine??i(),...a,themes:d,langs:h});return{...m,loadLanguage(...p){return m.loadLanguage(...p.map(l))},loadTheme(...p){return m.loadTheme(...p.map(u))}}}return o}const h4e=d4e({langs:kke,themes:Ske,engine:()=>iY(re(()=>import("./wasm-CG6Dc4jp.js"),[]))});/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const f4e=["github-light-default","github-dark-default"];let mw=null,L7=null;const P7=new Set,e6=new Map,SO=new Set,m4e=128,vb=new Map;function PY(e,t,n){return`${t}\0${n}\0${e}`}function p4e(e,t){if(vb.size>=m4e){const n=vb.keys().next().value;n!==void 0&&vb.delete(n)}vb.set(e,t)}function g4e(e,t,n){return vb.get(PY(e,t,n))??null}function b4e(){return mw||(mw=h4e({langs:[],themes:f4e}).then(e=>(L7=e,e)).catch(e=>{throw mw=null,e})),mw}async function y4e(e){const t=await b4e();if(P7.has(e))return t;if(SO.has(e))throw new Error(`shiki: language "${e}" previously failed to load`);let n=e6.get(e);return n||(n=t.loadLanguage(e).then(()=>{P7.add(e)}).catch(r=>{throw SO.add(e),r}).finally(()=>{e6.delete(e)}),e6.set(e,n)),await n,t}const v4e=1e5,x4e=2e4;function w4e(e){if(e.length>v4e)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>x4e)return!0;t=r+1}return!1}function CO(e,t,n,r=!0){if(L7&&P7.has(t))try{const s=L7.codeToHtml(e,{lang:t,theme:n});return r&&p4e(PY(e,t,n),s),s}catch(s){return console.warn("[web-shell] sync highlight failed for lang=%s",t,s),null}return null}const k4e=()=>{},_4e=()=>k4e,OY=f.createContext(_4e);function S4e(){return f.useContext(OY)}const C4e="_tableShell_14nne_1",T4e="_densityCompact_14nne_11",A4e="_densityStandard_14nne_21",E4e="_densityComfortable_14nne_29",M4e="_toolbar_14nne_37",N4e="_summary_14nne_48",j4e="_hint_14nne_53",I4e="_selection_14nne_57",R4e="_selectionStats_14nne_62",D4e="_selectionMetric_14nne_70",L4e="_selectionMetricValue_14nne_74",P4e="_copyButton_14nne_80",O4e="_secondaryButton_14nne_81",B4e="_primaryButton_14nne_82",$4e="_copyCheck_14nne_91",z4e="_scroller_14nne_115",F4e="_table_14nne_1",q4e="_headerCell_14nne_137",H4e="_cell_14nne_138",U4e="_frozenHeaderCell_14nne_161",V4e="_headerControls_14nne_166",W4e="_headerButton_14nne_172",G4e="_filterTrigger_14nne_189",K4e="_headerText_14nne_193",Y4e="_sortIcon_14nne_200",X4e="_activeHeaderCell_14nne_216",Q4e="_reorderHandle_14nne_220",J4e="_reorderHandleVisible_14nne_243",Z4e="_resizeHandle_14nne_263",eSe="_filterTriggerActive_14nne_282",tSe="_filterMenu_14nne_287",nSe="_columnContextMenu_14nne_303",rSe="_columnContextMenuAction_14nne_316",sSe="_filterMenuTitle_14nne_334",iSe="_filterMenuSection_14nne_344",oSe="_filterMenuAction_14nne_352",aSe="_activeAction_14nne_365",lSe="_filterSearch_14nne_374",cSe="_conditionInput_14nne_375",uSe="_conditionSelect_14nne_376",dSe="_filterOptionList_14nne_392",hSe="_filterOption_14nne_392",fSe="_optionLabel_14nne_418",mSe="_optionCount_14nne_426",pSe="_optionLimitHint_14nne_432",gSe="_conditionTitle_14nne_438",bSe="_conditionInputs_14nne_443",ySe="_filterFooter_14nne_448",vSe="_footerSpacer_14nne_455",xSe="_cellContent_14nne_473",wSe="_detailValueContent_14nne_474",kSe="_cellText_14nne_480",_Se="_detailValueText_14nne_481",SSe="_cellContentCollapsed_14nne_487",CSe="_detailValueCollapsed_14nne_488",TSe="_dragging_14nne_495",ASe="_evenRow_14nne_499",ESe="_selectedCell_14nne_507",MSe="_actionHeaderCell_14nne_514",NSe="_actionCell_14nne_515",jSe="_stickyActionHeaderCell_14nne_523",ISe="_stickyActionCell_14nne_524",RSe="_frozenCell_14nne_540",DSe="_hasFrozenColumn_14nne_546",LSe="_rowDetailButton_14nne_593",PSe="_detailRow_14nne_608",OSe="_detailCell_14nne_612",BSe="_detailPanel_14nne_619",$Se="_detailTitle_14nne_625",zSe="_detailItem_14nne_630",FSe="_detailLabel_14nne_637",qSe="_detailValue_14nne_474",HSe="_themeDark_14nne_652",USe="_themeLight_14nne_661",VSe="_cellDialogBackdrop_14nne_670",WSe="_cellDialog_14nne_670",GSe="_cellDialogCloseIcon_14nne_701",KSe="_cellDialogTitle_14nne_722",YSe="_cellDialogValue_14nne_729",XSe="_cellDialogFooter_14nne_747",QSe="_cellDialogActions_14nne_756",JSe="_cellDialogButton_14nne_762",ZSe="_cellDialogPrimaryButton_14nne_778",e3e="_emptyValue_14nne_787",t3e="_emptyState_14nne_792",Je={tableShell:C4e,densityCompact:T4e,densityStandard:A4e,densityComfortable:E4e,toolbar:M4e,summary:N4e,hint:j4e,selection:I4e,selectionStats:R4e,selectionMetric:D4e,selectionMetricValue:L4e,copyButton:P4e,secondaryButton:O4e,primaryButton:B4e,copyCheck:$4e,scroller:z4e,table:F4e,headerCell:q4e,cell:H4e,frozenHeaderCell:U4e,headerControls:V4e,headerButton:W4e,filterTrigger:G4e,headerText:K4e,sortIcon:Y4e,activeHeaderCell:X4e,reorderHandle:Q4e,reorderHandleVisible:J4e,resizeHandle:Z4e,filterTriggerActive:eSe,filterMenu:tSe,columnContextMenu:nSe,columnContextMenuAction:rSe,filterMenuTitle:sSe,filterMenuSection:iSe,filterMenuAction:oSe,activeAction:aSe,filterSearch:lSe,conditionInput:cSe,conditionSelect:uSe,filterOptionList:dSe,filterOption:hSe,optionLabel:fSe,optionCount:mSe,optionLimitHint:pSe,conditionTitle:gSe,conditionInputs:bSe,filterFooter:ySe,footerSpacer:vSe,cellContent:xSe,detailValueContent:wSe,cellText:kSe,detailValueText:_Se,cellContentCollapsed:SSe,detailValueCollapsed:CSe,dragging:TSe,evenRow:ASe,selectedCell:ESe,actionHeaderCell:MSe,actionCell:NSe,stickyActionHeaderCell:jSe,stickyActionCell:ISe,frozenCell:RSe,hasFrozenColumn:DSe,rowDetailButton:LSe,detailRow:PSe,detailCell:OSe,detailPanel:BSe,detailTitle:$Se,detailItem:zSe,detailLabel:FSe,detailValue:qSe,themeDark:HSe,themeLight:USe,cellDialogBackdrop:VSe,cellDialog:WSe,cellDialogCloseIcon:GSe,cellDialogTitle:KSe,cellDialogValue:YSe,cellDialogFooter:XSe,cellDialogActions:QSe,cellDialogButton:JSe,cellDialogPrimaryButton:ZSe,emptyValue:e3e,emptyState:t3e},n3e={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"},r3e={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"},s3e=500,i3e=50,Oh=160,BY=80,$Y=640,TO=16,zY="application/x-qwen-web-shell-table-column",o3e=60,a3e=3,t6=["standard","compact","comfortable"],l3e={width:Oh,minWidth:Oh,maxWidth:Oh},c3e={width:"auto"};function AO(e){return Math.min($Y,Math.max(BY,e))}const u3e='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',d3e='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])';function h3e(e){return Array.from(e.querySelectorAll(u3e)).filter(t=>!t.hasAttribute("hidden"))}function EO(e){return e?Array.from(e.querySelectorAll(d3e)):[]}function n6(e){return e instanceof Element&&!!e.closest('a, button, input, textarea, select, [contenteditable="true"]')}function f3e(){const e=document.getSelection();return!!(e&&!e.isCollapsed)}function wm(e,t){return f.isValidElement(e)&&e.type===t}function m3e(e){return e.replace(/\s+/g," ").trim()}function r6(e){return e.length>o3e||e.split(/\r\n|\r|\n/).length>a3e}function p3e(e){const t=t6.indexOf(e);return t6[(t+1)%t6.length]??"standard"}function g3e(e){switch(e){case"compact":return Je.densityCompact;case"comfortable":return Je.densityComfortable;case"standard":default:return Je.densityStandard}}function O7(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(O7).join(""):f.isValidElement(e)?e.type==="img"?e.props.alt??"":O7(e.props.children):""}function b3e(e,t){return{key:`${e}-empty-${t}`,content:"",text:"",rawText:"",isHeader:!1}}function FY(e,t){const n=f.Children.toArray(e.props.children).filter(r=>wm(r,"td")||wm(r,"th"));return{key:t,cells:n.map((r,s)=>{var o;const i=O7(r.props.children);return{key:`${t}-${s}`,content:r.props.children,text:m3e(i),rawText:i,isHeader:r.type==="th",textAlign:(o=r.props.style)==null?void 0:o.textAlign}})}}function s6(e,t){return f.Children.toArray(e.props.children).filter(n=>wm(n,"tr")).map((n,r)=>FY(n,`${t}-${r}`))}function y3e(e,t){return{...e,cells:Array.from({length:t},(n,r)=>e.cells[r]??b3e(e.key,r))}}function v3e(e,t){const n=f.Children.toArray(e),r=[],s=[],i=[];if(n.forEach((d,h)=>{wm(d,"thead")?r.push(...s6(d,`head-${h}`)):wm(d,"tbody")?s.push(...s6(d,`body-${h}`)):wm(d,"tfoot")?s.push(...s6(d,`foot-${h}`)):wm(d,"tr")&&i.push(FY(d,`row-${h}`))}),i.length>0){const[d,...h]=i;d!=null&&d.cells.some(m=>m.isHeader)?(r.push(d),s.push(...h)):s.push(...i)}const o=[...r,...s],a=Math.max(0,...o.map(d=>d.cells.length)),l=r[0];return{headers:Array.from({length:a},(d,h)=>{const m=l==null?void 0:l.cells[h];if(m)return m;const p=t(h);return{key:`header-${h}`,content:p,text:p,rawText:p,isHeader:!0}}),rows:s.map(d=>y3e(d,a)),columnCount:a}}function Qu(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 Number.isFinite(i)?n?i/100:i:null}function qY(e,t){const n=Qu(e),r=Qu(t);return n!==null&&r!==null&&n!==r?n-r:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function m_(e){return{minRow:Math.min(e.anchorRow,e.focusRow),maxRow:Math.max(e.anchorRow,e.focusRow)}}function LM(e,t){if(!e)return[];const n=t.indexOf(e.anchorCol),r=t.indexOf(e.focusCol);if(n===-1||r===-1)return[];const s=Math.min(n,r),i=Math.max(n,r);return t.slice(s,i+1)}function p_(e){const t=e.replace(/[\u200B-\u200D\u2060\u00AD\uFEFF]/g,"").trimStart();return/^[=+\-@]/.test(t)?`'${e}`:e}function B7(e){return((e==null?void 0:e.rawText)??(e==null?void 0:e.text)??"").replace(/[\r\n\t]+/g," ")}function i6(e){return e.rawText||e.text}function MO(e,t,n){if((e[t]??Oh)===n)return e;if(n===Oh){const s={...e};return delete s[t],s}return{...e,[t]:n}}function NO(e,t,n){if(!e)return"";const{minRow:r,maxRow:s}=m_(e),i=LM(e,n);if(i.length===0)return"";const o=[];for(let a=r;a<=s;a++){const l=t[a];l&&o.push(i.map(u=>p_(B7(l.cells[u]))).join("	"))}return o.join(`
`)}function x3e(e,t,n){return n.length===0?"":[n.map(s=>p_(B7(e[s]))).join("	"),...t.map(s=>n.map(i=>p_(B7(s.cells[i]))).join("	"))].join(`
`)}function w3e(e,t,n){if(!e)return null;const{minRow:r,maxRow:s}=m_(e),i=LM(e,n);if(i.length===0)return null;let o=0,a=0,l=0,u=0,d=1/0,h=-1/0,m=!0,p=!0,g;for(let x=r;x<=s;x++){const v=t[x];v&&i.forEach(y=>{const w=v.cells[y];if(!w)return;o+=1;const k=w.text.trim();if(!k)return;a+=1;const T=Qu(k);if(T===null)return;l+=1,u+=T,d=Math.min(d,T),h=Math.max(h,T),m=m&&k.endsWith("%");const S=k.match(/[$€£¥₹]/g),C=(S==null?void 0:S.length)===1?S[0]:void 0;C?g===void 0?g=C:g!==C&&(p=!1):p=!1})}if(o===0)return null;const b=l>0&&m?"percent":l>0&&p&&g?"currency":"number";return{selectedCount:o,nonEmptyCount:a,numericCount:l,sum:u,average:l>0?u/l:0,min:l>0?d:0,max:l>0?h:0,format:b,currencySymbol:g}}function pw(e,t,n){const r=Object.is(e,-0)?0:e,s=n==="en"?"en-US":n;if(t.format==="percent")return new Intl.NumberFormat(s,{style:"percent",maximumFractionDigits:6}).format(r);const i=new Intl.NumberFormat(s,{maximumFractionDigits:6}).format(Math.abs(r));return t.format==="currency"&&t.currencySymbol?`${r<0?"-":""}${t.currencySymbol}${i}`:r<0?`-${i}`:i}function jO(e,t,n){if(t===n)return e;const r=e.indexOf(t),s=e.indexOf(n);if(r===-1||s===-1)return e;const i=[...e],[o]=i.splice(r,1);return o===void 0?e:(i.splice(s,0,o),i)}function k3e(e,t,n,r){if(r.size===0)return jO(e,t,n);const s=e.filter(a=>!r.has(a)),i=jO(s,t,n);if(i===s)return e;let o=0;return e.map(a=>{if(r.has(a))return a;const l=i[o];return o+=1,l??a})}function IO(e){return Array.from({length:e},(t,n)=>n)}function RO(e){return Array.from(e.types).includes(zY)}function ry(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 _3e(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 S3e(e,t){if(!(t!=null&&t.value.trim()))return!0;const n=Qu(e),r=Qu(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=Qu(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 C3e(e,t){return t.selectedValues!==void 0&&!t.selectedValues.includes(e)?!1:_3e(e,t.textFilter)&&S3e(e,t.numberFilter)}function DO(e,t,n){const r=Object.entries(t).map(([s,i])=>[Number(s),i]).filter(([s,i])=>s!==n&&ry(i));return r.length===0?e:e.filter(s=>r.every(([i,o])=>{var a;return C3e(((a=s.cells[i])==null?void 0:a.text)??"",o)}))}function T3e(e,t){return t?e.map((n,r)=>({row:n,index:r})).sort((n,r)=>{var o,a;const s=qY(((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 A3e(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)=>qY(s.value,i.value))}function E3e(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,Qu(i)!==null&&(r+=1))}),n>0&&r/n>=.7}function M3e(e,t){if(e.length!==t.length)return!1;const n=new Set(e);return t.every(r=>n.has(r))}function N3e(e,t){var r,s,i;const n={};if(e.selectedValues!==void 0&&!M3e(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();Qu(o)!==null&&(e.numberFilter.operator!=="between"||Qu(a??"")!==null)&&(n.numberFilter={operator:e.numberFilter.operator,value:o,valueTo:a})}return ry(n)?n:void 0}function j3e({columnIndex:e,sortedThisColumn:t,onSort:n}){const{t:r}=gt();return c.jsxs("div",{className:Je.filterMenuSection,children:[c.jsx("button",{className:`${Je.filterMenuAction} ${(t==null?void 0:t.direction)==="asc"?Je.activeAction:""}`,type:"button",onClick:()=>n(e,"asc"),children:r("markdownTable.sort.asc")}),c.jsx("button",{className:`${Je.filterMenuAction} ${(t==null?void 0:t.direction)==="desc"?Je.activeAction:""}`,type:"button",onClick:()=>n(e,"desc"),children:r("markdownTable.sort.desc")}),c.jsx("button",{className:Je.filterMenuAction,type:"button",onClick:()=>n(e,null),children:r("markdownTable.sort.clear")})]})}function I3e({onHideColumn:e}){const{t}=gt();return c.jsx("div",{className:Je.filterMenuSection,children:c.jsx("button",{className:Je.filterMenuAction,type:"button",onClick:e,children:t("markdownTable.hideColumn")})})}function R3e({columnIndex:e,columnName:t,search:n,searchInputRef:r,filteredOptions:s,visibleOptions:i,selectedValues:o,allFilteredSelected:a,onSearchChange:l,onFilteredSelectionChange:u,onToggleValue:d}){const{t:h}=gt();return c.jsxs("div",{className:Je.filterMenuSection,children:[c.jsx("input",{ref:r,className:Je.filterSearch,value:n,onChange:m=>l(m.currentTarget.value),placeholder:h("markdownTable.filter.searchPlaceholder"),name:`markdown-table-option-search-${e}`,"aria-label":h("markdownTable.filter.searchAria",{column:t})}),c.jsxs("label",{className:Je.filterOption,children:[c.jsx("input",{type:"checkbox",name:`markdown-table-filter-all-${e}`,checked:a,onChange:m=>u(m.currentTarget.checked)}),c.jsx("span",{children:h("markdownTable.filter.selectVisible")}),c.jsx("span",{className:Je.optionCount,children:s.length})]}),c.jsxs("div",{className:Je.filterOptionList,children:[i.map((m,p)=>c.jsxs("label",{className:Je.filterOption,children:[c.jsx("input",{type:"checkbox",name:`markdown-table-filter-option-${e}-${p}`,checked:o.has(m.value),onChange:()=>d(m.value)}),c.jsx("span",{className:Je.optionLabel,children:m.label}),c.jsx("span",{className:Je.optionCount,children:m.count})]},m.value)),s.length>i.length&&c.jsx("div",{className:Je.optionLimitHint,children:h("markdownTable.filter.optionLimit",{count:i.length})}),s.length===0&&c.jsx("div",{className:Je.optionLimitHint,children:h("markdownTable.filter.noOptions")})]})]})}function D3e({columnIndex:e,columnName:t,isNumeric:n,textOperator:r,textValue:s,numberOperator:i,numberValue:o,numberValueTo:a,onTextOperatorChange:l,onTextValueChange:u,onNumberOperatorChange:d,onNumberValueChange:h,onNumberValueToChange:m}){const{t:p}=gt();return c.jsxs("div",{className:Je.filterMenuSection,children:[c.jsx("div",{className:Je.conditionTitle,children:p("markdownTable.filter.custom")}),n?c.jsxs(c.Fragment,{children:[c.jsx("select",{className:Je.conditionSelect,value:i,name:`markdown-table-number-operator-${e}`,onChange:g=>d(g.currentTarget.value),"aria-label":p("markdownTable.filter.numberAria",{column:t}),children:Object.entries(r3e).map(([g,b])=>c.jsx("option",{value:g,children:p(b)},g))}),c.jsxs("div",{className:Je.conditionInputs,children:[c.jsx("input",{className:Je.conditionInput,value:o,onChange:g=>h(g.currentTarget.value),placeholder:p("markdownTable.filter.numberPlaceholder"),name:`markdown-table-number-filter-${e}`}),i==="between"&&c.jsx("input",{className:Je.conditionInput,value:a,onChange:g=>m(g.currentTarget.value),placeholder:p("markdownTable.filter.toPlaceholder"),name:`markdown-table-number-filter-to-${e}`})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("select",{className:Je.conditionSelect,value:r,name:`markdown-table-text-operator-${e}`,onChange:g=>l(g.currentTarget.value),"aria-label":p("markdownTable.filter.textAria",{column:t}),children:Object.entries(n3e).map(([g,b])=>c.jsx("option",{value:g,children:p(b)},g))}),c.jsx("input",{className:Je.conditionInput,value:s,onChange:g=>u(g.currentTarget.value),placeholder:p("markdownTable.filter.textPlaceholder"),name:`markdown-table-text-filter-${e}`})]})]})}function L3e({onClear:e,onClose:t,onApply:n}){const{t:r}=gt();return c.jsxs("div",{className:Je.filterFooter,children:[c.jsx("button",{className:Je.secondaryButton,type:"button",onClick:e,children:r("markdownTable.filter.reset")}),c.jsx("span",{className:Je.footerSpacer}),c.jsx("button",{className:Je.secondaryButton,type:"button",onClick:t,children:r("markdownTable.filter.cancel")}),c.jsx("button",{className:Je.primaryButton,type:"button",onClick:n,children:r("markdownTable.filter.confirm")})]})}function P3e({id:e,columnName:t,columnIndex:n,filter:r,isNumeric:s,options:i,sort:o,style:a,menuRef:l,canHideColumn:u,onApply:d,onClose:h,onHideColumn:m,onSort:p}){var U,j,ie,oe,J;const g=f.useMemo(()=>i.map(V=>V.value),[i]),[b,x]=f.useState(""),[v,y]=f.useState(()=>new Set((r==null?void 0:r.selectedValues)??g)),[w,k]=f.useState(((U=r==null?void 0:r.textFilter)==null?void 0:U.operator)??"contains"),[T,S]=f.useState(((j=r==null?void 0:r.textFilter)==null?void 0:j.value)??""),[C,_]=f.useState(((ie=r==null?void 0:r.numberFilter)==null?void 0:ie.operator)??"gt"),[A,M]=f.useState(((oe=r==null?void 0:r.numberFilter)==null?void 0:oe.value)??""),[L,N]=f.useState(((J=r==null?void 0:r.numberFilter)==null?void 0:J.valueTo)??""),O=f.useRef(null);f.useEffect(()=>{var V;(V=O.current)==null||V.focus()},[]);const B=f.useMemo(()=>{const V=b.trim().toLowerCase();return V?i.filter(se=>se.label.toLowerCase().includes(V)):i},[i,b]),$=B.slice(0,500),P=B.length>0&&B.every(V=>v.has(V.value)),K=V=>{y(se=>{const Z=new Set(se);return B.forEach(X=>{V?Z.add(X.value):Z.delete(X.value)}),Z})},F=V=>{y(se=>{const Z=new Set(se);return Z.has(V)?Z.delete(V):Z.add(V),Z})},H=()=>{d(n,N3e({selectedValues:Array.from(v),textFilter:{operator:w,value:T},numberFilter:{operator:C,value:A,valueTo:L}},g))},D=()=>{d(n,void 0)},Q=(o==null?void 0:o.columnIndex)===n?o:null;return c.jsxs("div",{ref:l,id:e,className:Je.filterMenu,style:a,role:"dialog","aria-labelledby":`${e}-title`,children:[c.jsx("div",{id:`${e}-title`,className:Je.filterMenuTitle,children:t}),c.jsx(j3e,{columnIndex:n,sortedThisColumn:Q,onSort:p}),u&&c.jsx(I3e,{onHideColumn:()=>m(n)}),c.jsx(R3e,{columnIndex:n,columnName:t,search:b,searchInputRef:O,filteredOptions:B,visibleOptions:$,selectedValues:v,allFilteredSelected:P,onSearchChange:x,onFilteredSelectionChange:K,onToggleValue:F}),c.jsx(D3e,{columnIndex:n,columnName:t,isNumeric:s,textOperator:w,textValue:T,numberOperator:C,numberValue:A,numberValueTo:L,onTextOperatorChange:k,onTextValueChange:S,onNumberOperatorChange:_,onNumberValueChange:M,onNumberValueToChange:N}),c.jsx(L3e,{onClear:D,onClose:h,onApply:H})]})}function O3e({children:e,fallback:t,toolbarExtra:n}){const{t:r}=gt(),s=f.useMemo(()=>v3e(e,i=>r("markdownTable.column",{index:i+1})),[e,r]);return s.columnCount===0?c.jsx(c.Fragment,{children:t??c.jsx("table",{children:e})}):s.rows.length>s3e||s.columnCount>i3e?c.jsx(c.Fragment,{children:t??c.jsx("table",{children:e})}):c.jsx(B3e,{table:s,toolbarExtra:n})}function B3e({table:e,toolbarExtra:t}){const{language:n,t:r}=gt(),s=Hg(),i=S4e(),o=f.useId(),[a,l]=f.useState(null),[u,d]=f.useState({}),[h,m]=f.useState(null),[p,g]=f.useState(null),[b,x]=f.useState(null),[v,y]=f.useState(()=>new Set),[w,k]=f.useState({}),[T,S]=f.useState(()=>IO(e.columnCount)),[C,_]=f.useState(null),[A,M]=f.useState(!1),[L,N]=f.useState(null),[O,B]=f.useState(null),[$,P]=f.useState(null),[K,F]=f.useState(!1),[H,D]=f.useState("standard"),[Q,U]=f.useState(!1),[j,ie]=f.useState(!1),[oe,J]=f.useState(!1),[V,se]=f.useState(!1),Z=f.useRef(!1),X=f.useRef(null),te=f.useRef(null),ae=f.useRef(null),xe=f.useRef(0),Ae=f.useRef(0),Ne=f.useRef(0),Le=f.useRef(!0),ge=f.useRef(null),Oe=f.useRef(null),Nt=f.useRef(null),Pe=f.useRef(null),Ce=f.useRef(null),Zt=f.useRef(null),dt=f.useRef(null),Ge=f.useRef(0),St=f.useRef(null),Y=f.useRef(0),je=f.useRef(0),We=f.useRef(null),Te=f.useRef(null),jt=f.useMemo(()=>`${e.columnCount}\0${e.headers.map(de=>de.text).join("\0")}`,[e.columnCount,e.headers]),zt=f.useRef(jt),bn=f.useCallback(()=>{Ge.current&&cancelAnimationFrame(Ge.current),Ge.current=requestAnimationFrame(()=>{Ge.current=0;const de=Ce.current;de!=null&&de.isConnected&&de.focus()})},[]),Pn=f.useCallback(()=>{g(null),bn()},[bn]),qe=f.useCallback(()=>{xe.current+=1,X.current&&(clearTimeout(X.current),X.current=null),ie(!1)},[]),At=f.useCallback(()=>{Ae.current+=1,te.current&&(clearTimeout(te.current),te.current=null),J(!1)},[]),he=f.useCallback(()=>{Ne.current+=1,ae.current&&(clearTimeout(ae.current),ae.current=null),se(!1)},[]),Be=f.useCallback(()=>{Y.current&&(cancelAnimationFrame(Y.current),Y.current=0);const de=St.current;St.current=null,de&&m(Ee=>Ee&&{...Ee,focusRow:de.rowIndex,focusCol:de.columnIndex})},[]),Ie=f.useCallback(()=>{Be(),Z.current=!1,U(!1)},[Be]);f.useEffect(()=>{const de=()=>{document.hidden&&Ie()};return window.addEventListener("mouseup",Ie),window.addEventListener("blur",Ie),document.addEventListener("visibilitychange",de),()=>{window.removeEventListener("mouseup",Ie),window.removeEventListener("blur",Ie),document.removeEventListener("visibilitychange",de),Y.current&&cancelAnimationFrame(Y.current),Ge.current&&cancelAnimationFrame(Ge.current)}},[Ie]),f.useEffect(()=>{zt.current!==jt&&(zt.current=jt,l(null),d({}),m(null),g(null),x(null),y(new Set),k({}),S(IO(e.columnCount)),_(null),M(!1),N(null),B(null),P(null),F(!1),D("standard"),qe(),At(),he(),Z.current=!1,Te.current=null,U(!1))},[At,he,qe,e.columnCount,jt]),f.useEffect(()=>{At()},[At,h]),f.useEffect(()=>(Le.current=!0,()=>{Le.current=!1,X.current&&(clearTimeout(X.current),X.current=null),te.current&&(clearTimeout(te.current),te.current=null),ae.current&&(clearTimeout(ae.current),ae.current=null)}),[]),f.useEffect(()=>{if(!p)return;const de=wt=>{var we,Pt;const mn=wt.target;!((we=Nt.current)!=null&&we.contains(mn))&&!((Pt=Ce.current)!=null&&Pt.contains(mn))&&g(null)},Ee=wt=>{var Xn;if(wt.key==="Escape"){wt.preventDefault(),Pn();return}if(wt.key!=="Tab")return;const mn=Nt.current,we=document.activeElement;if(!mn||!(we instanceof Node)||!mn.contains(we))return;const Pt=h3e(mn);if(Pt.length===0)return;const yn=we instanceof HTMLElement?Pt.indexOf(we):-1,zn=wt.shiftKey?yn<=0?Pt.length-1:yn-1:yn===-1||yn===Pt.length-1?0:yn+1;wt.preventDefault(),(Xn=Pt[zn])==null||Xn.focus()},rt=wt=>{var we;const mn=wt.target;mn instanceof Node&&((we=Nt.current)!=null&&we.contains(mn))||g(null)},yt=()=>g(null);return document.addEventListener("mousedown",de),document.addEventListener("keydown",Ee),document.addEventListener("scroll",rt,!0),window.addEventListener("resize",yt),()=>{document.removeEventListener("mousedown",de),document.removeEventListener("keydown",Ee),document.removeEventListener("scroll",rt,!0),window.removeEventListener("resize",yt)}},[Pn,p]),f.useEffect(()=>{if(!b)return;const de=yt=>{var mn;const wt=yt.target;(mn=Pe.current)!=null&&mn.contains(wt)||x(null)},Ee=yt=>{yt.key==="Escape"&&(yt.preventDefault(),x(null))},rt=()=>x(null);return document.addEventListener("mousedown",de),document.addEventListener("keydown",Ee),document.addEventListener("scroll",rt,!0),window.addEventListener("resize",rt),()=>{document.removeEventListener("mousedown",de),document.removeEventListener("keydown",Ee),document.removeEventListener("scroll",rt,!0),window.removeEventListener("resize",rt)}},[b]),f.useEffect(()=>{const de=rt=>{var wt,mn;const yt=rt.target;yt instanceof Node&&!((wt=ge.current)!=null&&wt.contains(yt))&&!((mn=Pe.current)!=null&&mn.contains(yt))&&_(null)},Ee=rt=>{rt.defaultPrevented||p||$||b||rt.key==="Escape"&&_(null)};return document.addEventListener("mousedown",de),document.addEventListener("keydown",Ee),()=>{document.removeEventListener("mousedown",de),document.removeEventListener("keydown",Ee)}},[$,b,p]);const Ke=f.useMemo(()=>DO(e.rows,u),[u,e.rows]),ne=f.useMemo(()=>T3e(Ke,a),[Ke,a]);f.useEffect(()=>{m(de=>de&&(m_(de).maxRow<ne.length?de:null))},[ne.length]);const De=f.useMemo(()=>{if(!p)return[];const de=p.columnIndex;return A3e(DO(e.rows,u,de),de,r("markdownTable.blank"))},[u,p,r,e.rows]),Dt=f.useMemo(()=>e.headers.map((de,Ee)=>E3e(e.rows,Ee)),[e.headers,e.rows]),ze=f.useMemo(()=>T.filter(de=>de>=0&&de<e.columnCount).filter(de=>!v.has(de)),[T,v,e.columnCount]),Lt=A?ze[0]:void 0,ke=f.useMemo(()=>{if(!$)return null;const de=ne.find(Ee=>Ee.key===$.rowKey);return(de==null?void 0:de.cells[$.columnIndex])??null},[$,ne]),Ot=ke==null?void 0:ke.text,fe=s===As.Light?Je.themeLight:Je.themeDark;f.useEffect(()=>{qe()},[qe,ze,ne]),f.useEffect(()=>{if(!L)return;const de=()=>{const wt=We.current;We.current=null,je.current&&(cancelAnimationFrame(je.current),je.current=0),wt!==null&&k(mn=>MO(mn,L.columnIndex,wt))},Ee=wt=>{We.current=AO(L.startWidth+wt.clientX-L.startX),!je.current&&(je.current=requestAnimationFrame(de))},rt=()=>{de(),N(null)},yt=()=>{document.hidden&&rt()};return window.addEventListener("mousemove",Ee),window.addEventListener("mouseup",rt),window.addEventListener("blur",rt),document.addEventListener("visibilitychange",yt),()=>{window.removeEventListener("mousemove",Ee),window.removeEventListener("mouseup",rt),window.removeEventListener("blur",rt),document.removeEventListener("visibilitychange",yt),je.current&&(cancelAnimationFrame(je.current),je.current=0),We.current=null}},[L]),f.useEffect(()=>{O&&!ne.some(de=>de.key===O)&&B(null),$&&!ne.some(de=>de.key===$.rowKey&&de.cells[$.columnIndex])&&P(null)},[$,O,ne]),f.useEffect(()=>{if($)return i()},[$,i]),f.useEffect(()=>{$&&he()},[$,Ot,he]),f.useEffect(()=>{var yt;if(!$)return;const de=Zt.current;(yt=EO(de)[0]??de)==null||yt.focus();const rt=wt=>{var Xn;if(wt.defaultPrevented||wt.isComposing||wt.keyCode===229)return;if(wt.key==="Escape"){wt.preventDefault(),wt.stopPropagation(),P(null),he();return}if(wt.key!=="Tab")return;const mn=EO(Zt.current);if(mn.length===0){wt.preventDefault(),(Xn=Zt.current)==null||Xn.focus();return}const we=mn[0],Pt=mn[mn.length-1],yn=document.activeElement,zn=yn instanceof HTMLElement?mn.indexOf(yn):-1;wt.shiftKey&&(yn===we||zn===-1)?(wt.preventDefault(),Pt==null||Pt.focus()):!wt.shiftKey&&(yn===Pt||zn===-1)&&(wt.preventDefault(),we==null||we.focus())};return document.addEventListener("keydown",rt),()=>{document.removeEventListener("keydown",rt);const wt=dt.current;dt.current=null,wt!=null&&wt.isConnected&&wt.focus()}},[$,he]);const pt=(de,Ee)=>{m(null),d(rt=>{const yt={...rt};return Ee&&ry(Ee)?yt[de]=Ee:delete yt[de],yt}),Pn()},He=(de,Ee)=>{m(null),_(de),l(Ee?{columnIndex:de,direction:Ee}:null)},on=de=>{m(null),_(de),l(Ee=>(Ee==null?void 0:Ee.columnIndex)!==de?{columnIndex:de,direction:"asc"}:Ee.direction==="asc"?{columnIndex:de,direction:"desc"}:null)},Ze=(de,Ee)=>{m(null),_(Ee),x(null),Ce.current=de.currentTarget;const rt=de.currentTarget.getBoundingClientRect(),yt=300,wt=430,mn={columnIndex:Ee,left:Math.max(6,Math.min(rt.right-yt,window.innerWidth-yt-6)),top:window.innerHeight-rt.bottom<wt?Math.max(8,rt.top-wt-2):rt.bottom+2};g(we=>(we==null?void 0:we.columnIndex)===Ee?null:mn)},Et=de=>{ze.length<=1||(m(null),_(Ee=>Ee===de?null:Ee),Pn(),d(Ee=>{const rt={...Ee};return delete rt[de],rt}),l(Ee=>(Ee==null?void 0:Ee.columnIndex)===de?null:Ee),y(Ee=>{const rt=new Set(Ee);return rt.add(de),rt}))},wn=()=>{m(null),y(new Set)},qr=()=>{M(de=>!de),x(null)},cr=(de,Ee)=>{if(Ee!==ze[0])return;de.preventDefault(),m(null),_(Ee),g(null),x({left:Math.max(6,Math.min(de.clientX,window.innerWidth-220-6)),top:Math.max(6,Math.min(de.clientY,window.innerHeight-72-6))})},Jn=()=>{D(de=>p3e(de))},Ft=de=>{m(null),P(null),he(),B(Ee=>Ee===de?null:de)},dn=(de,Ee)=>{dt.current=document.activeElement instanceof HTMLElement?document.activeElement:null,m(null),g(null),B(null),he(),P({rowKey:de,columnIndex:Ee})},sr=()=>{P(null),he()},Rn=()=>{if(Ot==null||!navigator.clipboard)return;const de=Ne.current;navigator.clipboard.writeText(p_(Ot)).then(()=>{Le.current&&Ne.current===de&&(ae.current&&clearTimeout(ae.current),se(!0),ae.current=setTimeout(()=>se(!1),2e3))}).catch(Ee=>console.warn("[web-shell] clipboard write failed:",Ee))},Vn=f.useMemo(()=>h?m_(h):null,[h]),Zn=f.useMemo(()=>new Set(LM(h,ze)),[h,ze]),kn=(de,Ee)=>{if(!Vn)return!1;const{minRow:rt,maxRow:yt}=Vn;return de>=rt&&de<=yt&&Zn.has(Ee)},er=(de,Ee)=>{const rt=w[de];if(rt===void 0){const yt=H==="compact"?c3e:l3e;return Ee?{...yt,...Ee}:yt}return{width:rt,minWidth:rt,maxWidth:rt,...Ee}},Ms=(de,Ee)=>{de.preventDefault(),de.stopPropagation();const rt=de.currentTarget.closest("th"),yt=rt==null?void 0:rt.getBoundingClientRect().width;N({columnIndex:Ee,startX:de.clientX,startWidth:w[Ee]??(yt?Math.round(yt):Oh)})},Ss=(de,Ee)=>{if(de.ctrlKey||de.metaKey||de.altKey||de.shiftKey)return;let rt=0;if(de.key==="ArrowRight"?rt=TO:de.key==="ArrowLeft"&&(rt=-TO),rt===0)return;de.preventDefault(),de.stopPropagation();const yt=de.currentTarget.closest("th"),wt=yt==null?void 0:yt.getBoundingClientRect().width;k(mn=>{const we=mn[Ee]??(wt?Math.round(wt):Oh),Pt=AO(we+rt);return MO(mn,Ee,Pt)})},Hr=(de,Ee)=>{de.stopPropagation(),_(Ee),Te.current=Ee,de.dataTransfer.effectAllowed="move",de.dataTransfer.setData(zY,String(Ee))},rs=()=>{Te.current=null},Hs=de=>{Te.current===null||!RO(de.dataTransfer)||(de.preventDefault(),de.dataTransfer.dropEffect="move")},Us=(de,Ee)=>{const rt=Te.current;rs(),!(rt===null||!RO(de.dataTransfer))&&(de.preventDefault(),de.stopPropagation(),m(null),_(rt),S(yt=>k3e(yt,rt,Ee,v)))},Ur=(de,Ee)=>{p!==null&&g(null),_(null),Z.current=!0,m({anchorRow:de,anchorCol:Ee,focusRow:de,focusCol:Ee})},Ar=(de,Ee,rt)=>{var yt;de.button!==0||n6(de.target)||(de.preventDefault(),(yt=Oe.current)==null||yt.focus({preventScroll:!0}),Ur(Ee,rt))},Un=(de,Ee)=>{Z.current&&(U(!0),St.current={rowIndex:de,columnIndex:Ee},!Y.current&&(Y.current=requestAnimationFrame(()=>{Y.current=0;const rt=St.current;St.current=null,rt&&m(yt=>yt&&{...yt,focusRow:rt.rowIndex,focusCol:rt.columnIndex})})))},or=de=>{var mn;const Ee=document.elementFromPoint(de.clientX,de.clientY),rt=Ee==null?void 0:Ee.closest("[data-row-index][data-column-index]");if(!rt||!((mn=ge.current)!=null&&mn.contains(rt)))return null;const yt=Number(rt.dataset.rowIndex),wt=Number(rt.dataset.columnIndex);return!Number.isInteger(yt)||!Number.isInteger(wt)?null:{rowIndex:yt,columnIndex:wt}},Cs=(de,Ee,rt)=>{de.touches.length!==1||n6(de.target)||Ur(Ee,rt)},Ls=de=>{if(!Z.current||de.touches.length!==1)return;const Ee=de.touches[0];if(!Ee)return;const rt=or(Ee);rt&&(de.preventDefault(),Un(rt.rowIndex,rt.columnIndex))},be=()=>{const de=NO(h,ne,ze);if(!de||!navigator.clipboard)return;const Ee=Ae.current;navigator.clipboard.writeText(de).then(()=>{Le.current&&Ae.current===Ee&&(te.current&&clearTimeout(te.current),J(!0),te.current=setTimeout(()=>J(!1),2e3))}).catch(rt=>console.warn("[web-shell] clipboard write failed:",rt))},st=()=>{const de=x3e(e.headers,ne,ze);if(!de||!navigator.clipboard)return;const Ee=xe.current;navigator.clipboard.writeText(de).then(()=>{Le.current&&xe.current===Ee&&(X.current&&clearTimeout(X.current),ie(!0),X.current=setTimeout(()=>ie(!1),2e3))}).catch(rt=>console.warn("[web-shell] clipboard write failed:",rt))},Ct=de=>{if(f3e())return;const Ee=NO(h,ne,ze);Ee&&(de.preventDefault(),de.clipboardData.setData("text/plain",Ee))},Bt=f.useMemo(()=>w3e(h,ne,ze),[ze,h,ne]),qt=(Bt==null?void 0:Bt.selectedCount)??0,tr=Object.values(u).filter(ry).length,Lr=r(`markdownTable.density.${H}`),ss=f.useMemo(()=>ne.some(de=>ze.some(Ee=>{const rt=de.cells[Ee];return rt?r6(i6(rt)):!1})),[ze,ne]),Vr=ne.length===e.rows.length?r("markdownTable.rows",{count:e.rows.length}):r("markdownTable.rowsFiltered",{visible:ne.length,total:e.rows.length}),$n=p===null?void 0:e.headers[p.columnIndex],An=$n&&p?$n.text||r("markdownTable.column",{index:p.columnIndex+1}):"",Er=(de,Ee)=>{const rt=i6(de),yt=r6(rt);return c.jsx("div",{className:`${Je.cellContent} ${yt&&!Ee?Je.cellContentCollapsed:""}`,title:yt&&!Ee?rt:void 0,children:c.jsx("div",{className:Je.cellText,children:de.content})})},Pr=(de,Ee)=>{const rt=de.text.length===0,yt=i6(de),wt=r6(yt);return c.jsx("div",{className:`${Je.detailValueContent} ${wt&&!Ee?Je.detailValueCollapsed:""} ${rt?Je.emptyValue:""}`,title:wt&&!Ee?yt:void 0,children:c.jsx("div",{className:Je.detailValueText,children:rt?r("markdownTable.emptyValue"):de.content})})};return c.jsxs("div",{ref:ge,className:`${Je.tableShell} ${g3e(H)} ${A?Je.hasFrozenColumn:""} ${Q?Je.dragging:""}`,children:[c.jsxs("div",{className:Je.toolbar,children:[c.jsx("span",{className:Je.summary,children:Vr}),c.jsx("span",{className:Je.hint,children:r("markdownTable.hint")}),c.jsx("button",{className:Je.copyButton,type:"button",onClick:st,children:j?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Je.copyCheck,children:"✓"}),r("code.copied")]}):r("markdownTable.copyVisible")}),v.size>0&&c.jsx("button",{className:Je.copyButton,type:"button",onClick:wn,children:r("markdownTable.showHiddenColumns",{count:v.size})}),c.jsx("button",{className:Je.copyButton,type:"button",onClick:Jn,children:r("markdownTable.density",{density:Lr})}),ss&&c.jsx("button",{className:Je.copyButton,type:"button",onClick:()=>F(de=>!de),children:r(K?"markdownTable.collapseLongText":"markdownTable.expandLongText")}),tr>0&&c.jsx("span",{className:Je.selection,children:r("markdownTable.filtersActive",{count:tr})}),qt>0&&c.jsxs(c.Fragment,{children:[Bt&&c.jsxs("div",{className:Je.selectionStats,children:[c.jsxs("span",{className:Je.selectionMetric,children:[r("markdownTable.selection.selected")," ",c.jsx("strong",{className:Je.selectionMetricValue,children:Bt.selectedCount})]}),c.jsxs("span",{className:Je.selectionMetric,children:[r("markdownTable.selection.nonEmpty")," ",c.jsx("strong",{className:Je.selectionMetricValue,children:Bt.nonEmptyCount})]}),c.jsxs("span",{className:Je.selectionMetric,children:[r("markdownTable.selection.numeric")," ",c.jsx("strong",{className:Je.selectionMetricValue,children:Bt.numericCount})]}),Bt.numericCount>0&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:Je.selectionMetric,children:[r("markdownTable.selection.sum")," ",c.jsx("strong",{className:Je.selectionMetricValue,children:pw(Bt.sum,Bt,n)})]}),c.jsxs("span",{className:Je.selectionMetric,children:[r("markdownTable.selection.average")," ",c.jsx("strong",{className:Je.selectionMetricValue,children:pw(Bt.average,Bt,n)})]}),c.jsxs("span",{className:Je.selectionMetric,children:[r("markdownTable.selection.min")," ",c.jsx("strong",{className:Je.selectionMetricValue,children:pw(Bt.min,Bt,n)})]}),c.jsxs("span",{className:Je.selectionMetric,children:[r("markdownTable.selection.max")," ",c.jsx("strong",{className:Je.selectionMetricValue,children:pw(Bt.max,Bt,n)})]})]})]}),c.jsx("button",{className:Je.copyButton,type:"button",onClick:be,children:oe?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Je.copyCheck,children:"✓"}),r("code.copied")]}):r("markdownTable.copyTsv")})]}),t]}),c.jsxs("div",{ref:Oe,className:Je.scroller,tabIndex:0,onCopy:Ct,children:[c.jsxs("table",{className:Je.table,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:`${Je.headerCell} ${Je.actionHeaderCell} ${A?Je.stickyActionHeaderCell:""}`,children:r("markdownTable.actions")}),ze.map(de=>{const Ee=e.headers[de];if(!Ee)return null;const rt=(a==null?void 0:a.columnIndex)===de,yt=ry(u[de]),wt=(p==null?void 0:p.columnIndex)===de,mn=rt?a.direction==="asc"?"↑":"↓":"↕",we=Ee.text||r("markdownTable.column",{index:de+1}),Pt=rt?r(a.direction==="asc"?"markdownTable.sortByColumnAsc":"markdownTable.sortByColumnDesc",{column:we}):r("markdownTable.sortByColumn",{column:we}),yn=rt?a.direction==="asc"?"ascending":"descending":"none",zn=`${o}-filter-${de}`,Xn=Ee.textAlign?{textAlign:Ee.textAlign}:void 0,Hn=Lt===de,Mr=C===de;return c.jsxs("th",{className:`${Je.headerCell} ${Hn?Je.frozenHeaderCell:""} ${Mr?Je.activeHeaderCell:""}`,"aria-sort":yn,onContextMenu:is=>cr(is,de),onDragOver:Hs,onDrop:is=>Us(is,de),style:er(de,Xn),title:we,children:[c.jsxs("div",{className:Je.headerControls,children:[c.jsxs("button",{className:Je.headerButton,type:"button",onClick:()=>on(de),"aria-label":Pt,style:Xn,children:[c.jsx("span",{className:Je.headerText,style:Xn,children:Ee.content}),c.jsx("span",{className:Je.sortIcon,"aria-hidden":"true",children:mn})]}),c.jsx("button",{className:`${Je.reorderHandle} ${Mr?Je.reorderHandleVisible:""}`,type:"button",draggable:!0,tabIndex:Mr?0:-1,onDragStart:is=>Hr(is,de),onDragEnd:rs,"aria-label":r("markdownTable.moveColumn",{column:we}),children:"⋮⋮"}),c.jsx("button",{className:`${Je.filterTrigger} ${yt?Je.filterTriggerActive:""}`,type:"button",onClick:is=>Ze(is,de),"aria-label":r("markdownTable.filterColumn",{column:we}),"aria-expanded":wt,"aria-controls":wt?zn:void 0,children:"▾"})]}),c.jsx("button",{className:Je.resizeHandle,type:"button",onMouseDown:is=>Ms(is,de),onKeyDown:is=>Ss(is,de),role:"separator","aria-label":r("markdownTable.resizeColumn",{column:we}),"aria-orientation":"vertical","aria-valuemin":BY,"aria-valuemax":$Y,"aria-valuenow":w[de]??Oh})]},Ee.key)})]})}),c.jsx("tbody",{children:ne.map((de,Ee)=>{const rt=O===de.key,yt=`${o}-detail-${de.key}`;return c.jsxs(f.Fragment,{children:[c.jsxs("tr",{className:Ee%2===1?Je.evenRow:void 0,children:[c.jsx("td",{className:`${Je.cell} ${Je.actionCell} ${A?Je.stickyActionCell:""}`,children:c.jsx("button",{className:Je.rowDetailButton,type:"button",onClick:()=>Ft(de.key),"aria-expanded":rt,"aria-controls":yt,"aria-label":r(rt?"markdownTable.closeRowDetailsAria":"markdownTable.rowDetailsAria",{index:Ee+1}),children:r("markdownTable.rowDetails")})}),ze.map(wt=>{const mn=de.cells[wt];if(!mn)return null;const we=mn.textAlign?{textAlign:mn.textAlign}:void 0,Pt=Lt===wt;return c.jsx("td",{className:`${Je.cell} ${kn(Ee,wt)?Je.selectedCell:""} ${Pt?Je.frozenCell:""}`,style:er(wt,we),"data-row-index":Ee,"data-column-index":wt,onMouseDown:yn=>Ar(yn,Ee,wt),onMouseEnter:()=>Un(Ee,wt),onTouchStart:yn=>Cs(yn,Ee,wt),onTouchMove:Ls,onTouchEnd:Ie,onTouchCancel:Ie,onDoubleClick:yn=>{n6(yn.target)||dn(de.key,wt)},children:Er(mn,K)},mn.key)})]}),rt&&c.jsx("tr",{id:yt,className:Je.detailRow,children:c.jsx("td",{className:Je.detailCell,colSpan:ze.length+1,children:c.jsxs("div",{className:Je.detailPanel,children:[c.jsx("div",{className:Je.detailTitle,children:r("markdownTable.detailsHeader")}),ze.map(wt=>{const mn=e.headers[wt],we=de.cells[wt];return!mn||!we?null:c.jsxs("div",{className:Je.detailItem,children:[c.jsx("div",{className:Je.detailLabel,title:mn.text,children:mn.content}),c.jsx("div",{className:Je.detailValue,children:Pr(we,K)})]},`${de.key}-detail-${wt}`)})]})})})]},de.key)})})]}),ne.length===0&&c.jsx("div",{className:Je.emptyState,children:e.rows.length===0?r("markdownTable.empty"):r("markdownTable.emptyFiltered")})]}),b&&ze.length>0&&c.jsx("div",{ref:Pe,className:Je.columnContextMenu,style:{left:b.left,top:b.top},role:"menu",children:c.jsx("button",{className:Je.columnContextMenuAction,type:"button",role:"menuitem",onClick:qr,children:r(A?"markdownTable.unfreezeFirstColumn":"markdownTable.freezeFirstColumn")})}),p&&$n&&c.jsx(P3e,{id:`${o}-filter-${p.columnIndex}`,columnName:An,columnIndex:p.columnIndex,filter:u[p.columnIndex],isNumeric:Dt[p.columnIndex]??!1,options:De,sort:a,style:{left:p.left,top:p.top},menuRef:Nt,canHideColumn:ze.length>1,onApply:pt,onClose:Pn,onHideColumn:Et,onSort:He},p.columnIndex),$&&ke&&rc.createPortal(c.jsx("div",{className:`${Je.cellDialogBackdrop} ${fe}`,onMouseDown:sr,children:c.jsxs("div",{ref:Zt,className:Je.cellDialog,role:"dialog","aria-modal":"true","aria-labelledby":`${o}-cell-dialog-title`,tabIndex:-1,onMouseDown:de=>de.stopPropagation(),children:[c.jsx("button",{className:Je.cellDialogCloseIcon,type:"button",onClick:sr,"aria-label":r("markdownTable.close"),children:"×"}),c.jsx("div",{id:`${o}-cell-dialog-title`,className:Je.cellDialogTitle,children:r("markdownTable.cellDialogTitle")}),c.jsx("div",{className:Je.cellDialogValue,children:ke.content}),c.jsx("div",{className:Je.cellDialogFooter,children:c.jsxs("div",{className:Je.cellDialogActions,children:[c.jsx("button",{className:Je.cellDialogButton,type:"button",onClick:Rn,children:r(V?"code.copied":"markdownTable.copyCell")}),c.jsx("button",{className:`${Je.cellDialogButton} ${Je.cellDialogPrimaryButton}`,type:"button",onClick:sr,children:r("markdownTable.close")})]})})]})}),document.body)]})}const $3e="_content_1n6wo_1",z3e="_inlineCode_1n6wo_127",F3e="_link_1n6wo_139",q3e="_tableWrapper_1n6wo_149",H3e="_table_1n6wo_149",U3e="_image_1n6wo_179",V3e="_codeBlock_1n6wo_187",W3e="_codeBlockHeader_1n6wo_196",G3e="_codeBlockLang_1n6wo_205",K3e="_codeBlockCopy_1n6wo_213",Y3e="_codeBlockContent_1n6wo_236",X3e="_codeBlockPlain_1n6wo_256",Q3e="_mermaidBlock_1n6wo_274",J3e="_mermaidInline_1n6wo_286",Z3e="_mermaidLoading_1n6wo_305",eCe="_mermaidActions_1n6wo_312",tCe="_mermaidZoomWrapper_1n6wo_317",nCe="_mermaidDragging_1n6wo_325",xr={content:$3e,inlineCode:z3e,link:F3e,tableWrapper:q3e,table:H3e,image:U3e,codeBlock:V3e,codeBlockHeader:W3e,codeBlockLang:G3e,codeBlockCopy:K3e,codeBlockContent:Y3e,codeBlockPlain:X3e,mermaidBlock:Q3e,mermaidInline:J3e,mermaidLoading:Z3e,mermaidActions:eCe,mermaidZoomWrapper:tCe,mermaidDragging:nCe},rCe=new Set(["javascript","typescript","python","rust","go","java","c","cpp","csharp","fsharp","ruby","php","swift","kotlin","scala","bash","fish","powershell","sql","html","css","scss","json","yaml","toml","xml","markdown","dockerfile","graphql","lua","r","matlab","perl","haskell","elixir","erlang","clojure","dart","vue","svelte","astro","tsx","jsx","diff"]),LO={"c++":"cpp","c#":"csharp","f#":"fsharp",ts:"typescript",js:"javascript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",sh:"bash",zsh:"bash",shell:"bash",yml:"yaml",md:"markdown",golang:"go",ps1:"powershell",docker:"dockerfile"};function HY(e){const t=(e||"").toLowerCase(),n=Object.hasOwn(LO,t)?LO[t]:t,r=rCe.has(n)?n:"text";return{label:(e||"").trim()||"text",lang:n,resolvedLang:r}}const UY=/^(https?:|mailto:)/i,sCe=/^data:image\/(png|jpeg|gif|webp);base64,/i;function VY(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")?!0:UY.test(t):!1}function Jg(e){if(!e)return!1;const t=e.trim();return t?t.startsWith("#")||t.startsWith("/")&&!t.startsWith("//")||sCe.test(t)?!0:UY.test(t):!1}let PO,iCe=0;function oCe({code:e}){const{t}=gt(),n=Hg(),[r,s]=f.useState(null),[i,o]=f.useState(null),[a,l]=f.useState("diagram"),[u,d]=f.useState(!1),[h,m]=f.useState(1),[p,g]=f.useState({x:0,y:0}),[b,x]=f.useState(!1),v=f.useRef(null),y=n==="light"?"default":"dark",w=.5,k=3,T=.25,S=()=>{m(L=>Math.min(k,Math.round((L+T)*100)/100))},C=()=>{m(L=>Math.max(w,Math.round((L-T)*100)/100))},_=f.useCallback(()=>{v.current=null,x(!1),m(1),g({x:0,y:0})},[]),A=f.useCallback(L=>{L.preventDefault(),x(!0),v.current={startX:L.clientX,startY:L.clientY,origX:p.x,origY:p.y}},[p]);f.useEffect(()=>{if(!b)return;const L=O=>{if(!v.current)return;const B=O.clientX-v.current.startX,$=O.clientY-v.current.startY,P=1500;g({x:v.current.origX+B,y:Math.max(-P,Math.min(P,v.current.origY+$))})},N=()=>{v.current=null,x(!1)};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",N),window.addEventListener("blur",N),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",N),window.removeEventListener("blur",N)}},[b]),f.useEffect(()=>{m(1),g({x:0,y:0})},[e]),f.useEffect(()=>{let L=!1;s(null),o(null);const N=setTimeout(()=>{re(()=>import("./mermaid.core-xf9SXDdb.js").then(O=>O.bm),[]).then(async O=>{if(L)return;const B=O.default;PO!==y&&(B.initialize({startOnLoad:!1,theme:y,securityLevel:"strict",suppressErrorRendering:!0,flowchart:{wrappingWidth:300,useMaxWidth:!1}}),PO=y);try{const $=`mermaid-${++iCe}`,{svg:P}=await B.render($,e.trim());L||s(P)}catch($){L||o($ instanceof Error?$.message:"Mermaid render failed")}})},150);return()=>{L=!0,clearTimeout(N)}},[e,y]);const M=()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)},()=>{})};return i?c.jsxs("div",{className:xr.codeBlock,children:[c.jsx("div",{className:xr.codeBlockHeader,children:c.jsx("span",{className:xr.codeBlockLang,children:t("mermaid.errorLabel")})}),c.jsx("pre",{className:`${xr.codeBlockContent} ${xr.codeBlockPlain}`,children:c.jsx("code",{children:e})})]}):c.jsxs("div",{className:xr.codeBlock,children:[c.jsxs("div",{className:xr.codeBlockHeader,children:[c.jsx("span",{className:xr.codeBlockLang,children:t("mermaid.label")}),c.jsxs("span",{className:xr.mermaidActions,children:[a==="diagram"&&c.jsxs(c.Fragment,{children:[c.jsx("button",{className:xr.codeBlockCopy,onClick:C,title:t("mermaid.zoomOut"),disabled:h<=w,children:t("mermaid.zoomOut")}),c.jsx("button",{className:xr.codeBlockCopy,onClick:_,title:t("mermaid.zoomReset"),disabled:h===1&&p.x===0&&p.y===0,children:t("mermaid.zoomReset")}),c.jsx("button",{className:xr.codeBlockCopy,onClick:S,title:t("mermaid.zoomIn"),disabled:h>=k,children:t("mermaid.zoomIn")})]}),c.jsx("button",{className:xr.codeBlockCopy,onClick:()=>l(a==="diagram"?"code":"diagram"),children:t(a==="diagram"?"mermaid.viewCode":"mermaid.viewDiagram")}),c.jsx("button",{className:xr.codeBlockCopy,onClick:M,children:t(u?"code.copied":"code.copy")})]})]}),a==="code"?c.jsx("pre",{className:`${xr.codeBlockContent} ${xr.codeBlockPlain}`,children:c.jsx("code",{children:e})}):r?c.jsx("div",{className:`${xr.mermaidZoomWrapper} ${b?xr.mermaidDragging:""}`,onMouseDown:A,onDoubleClick:_,children:c.jsx("div",{className:`${xr.mermaidBlock} ${xr.mermaidInline}`,style:{transform:`translate(${p.x}px, ${p.y}px) scale(${h})`,transformOrigin:"top center"},dangerouslySetInnerHTML:{__html:r}})}):c.jsx("div",{className:`${xr.mermaidBlock} ${xr.mermaidLoading} ${xr.mermaidInline}`,children:c.jsx("span",{children:t("mermaid.rendering")})})]})}function aCe({className:e,children:t,isStreaming:n}){const{t:r}=gt(),s=Hg(),[i,o]=f.useState(null),[a,l]=f.useState(!1),{label:u,lang:d,resolvedLang:h}=HY(WY(e)),m=String(t).replace(/\n$/,""),p=s==="light"?"github-light-default":"github-dark-default";f.useEffect(()=>{if(d==="mermaid"||h==="text"||w4e(m)){o(null);return}const b=g4e(m,h,p);if(b!==null){o(b);return}const x=!n,v=CO(m,h,p,x);if(v!==null){o(v);return}o(null);let y=!1;return y4e(h).then(()=>{if(y)return;const w=CO(m,h,p,x);w!==null&&o(w)}).catch(w=>{y||(console.warn("[web-shell] highlight failed for lang=%s",h,w),o(null))}),()=>{y=!0}},[m,d,h,p,n]);const g=()=>{navigator.clipboard.writeText(m).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)},()=>{})};return d==="mermaid"&&!n?c.jsx(oCe,{code:m}):c.jsxs("div",{className:xr.codeBlock,children:[c.jsxs("div",{className:xr.codeBlockHeader,children:[c.jsx("span",{className:xr.codeBlockLang,children:u}),c.jsx("button",{className:xr.codeBlockCopy,onClick:g,children:r(a?"code.copied":"code.copy")})]}),i!==null?c.jsx("div",{className:xr.codeBlockContent,dangerouslySetInnerHTML:{__html:i}}):c.jsx("pre",{className:`${xr.codeBlockContent} ${xr.codeBlockPlain}`,children:c.jsx("code",{children:m})})]})}function WY(e){var i;const t=((i=e==null?void 0:e.match(/(?:^|\s)language-([^\s]+)/))==null?void 0:i[1])??"",n=t.match(/^([\w+.#-]+)/);if(!n)return"";const r=n[1]??"",s=t[r.length];return!s||s==="{"||s===":"?r:""}function lCe({children:e}){return c.jsx("code",{className:xr.inlineCode,children:e})}function OO({children:e}){return c.jsx("div",{className:xr.tableWrapper,children:c.jsx("table",{className:xr.table,children:e})})}const GY=f.createContext(!1),KY=f.createContext(void 0);function cCe({className:e,children:t}){const n=f.useContext(GY);return(e==null?void 0:e.startsWith("language-"))||typeof t=="string"&&t.includes(`
`)?c.jsx(uCe,{className:e,isStreaming:n,children:t}):c.jsx(lCe,{children:t})}function uCe({className:e,children:t,isStreaming:n}){var m;const r=f.useContext(KY),s=Hg(),{markdown:i}=ou(),o=String(t),a=o.replace(/\n$/,""),l=c.jsx(aCe,{className:e,isStreaming:n,children:o}),u=WY(e),{resolvedLang:d}=HY(u);if(!!r&&!!e&&!!u)try{const p=(m=i==null?void 0:i.renderCodeBlock)==null?void 0:m.call(i,{language:u,resolvedLanguage:d,className:e,code:a,isStreaming:!!n,source:r,theme:s});if(p!=null&&typeof p!="boolean")return c.jsx(ld,{fallback:l,label:`custom code block component render (lang=${u})`,resetKeys:[u,r,s,n?"streaming":"settled",a],children:p})}catch(p){console.error("[web-shell] custom code block renderer call failed (lang=%s):",u,p)}return l}function dCe({children:e}){return c.jsx(c.Fragment,{children:e})}const $7=/^qwen-session:\/\//i;function hCe(e){return $7.test(e.trim())?e:_G(e)}function fCe({href:e,children:t}){if(e&&$7.test(e.trim())){const r=e.trim().replace($7,"");return c.jsx("a",{href:"#",role:"button",className:xr.link,onClick:s=>{s.preventDefault(),s.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:r}))},children:t})}const n=VY(e)?e:void 0;return c.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:xr.link,children:t})}function mCe({src:e,alt:t}){const n=Jg(e)?e:void 0;return c.jsx("img",{src:n,alt:t||"",className:xr.image})}function YY(e="basic",t=""){return{code:cCe,pre:dCe,a:fCe,img:mCe,table({children:n}){if(e==="advanced"){const r=c.jsx(OO,{children:n});return c.jsx(ld,{fallback:r,label:"enhanced markdown table",resetKeys:[t],children:c.jsx(O3e,{fallback:r,children:n})})}return c.jsx(OO,{children:n})}}}const pCe=YY(),Wm=f.memo(function({content:t,source:n,isStreaming:r,tableMode:s}){const{markdown:i,markdownTableMode:o}=ou(),a=n?i:void 0,l=t&&n&&(a!=null&&a.transformMarkdown)?a.transformMarkdown(t,{source:n}):t,u=r?"basic":s??o??"basic",d=f.useMemo(()=>u==="advanced"?YY("advanced",l):pCe,[u,l]),h=a==null?void 0:a.components,m=f.useMemo(()=>h?{...d,...h,...u==="advanced"?{table:d.table}:{}}:d,[d,u,h]);if(!t)return null;const p=a!=null&&a.remarkPlugins?[dP,QP,...a.remarkPlugins]:[dP,QP],g=a!=null&&a.rehypePlugins?[oO,...a.rehypePlugins]:[oO];return c.jsx("div",{className:n!=="thinking"?xr.content:void 0,"data-markdown-source":n,children:c.jsx(GY.Provider,{value:!!r,children:c.jsx(KY.Provider,{value:n,children:c.jsx(Nbe,{remarkPlugins:p,rehypePlugins:g,components:m,urlTransform:hCe,children:l})})})})});let z7=[],XY=[];(()=>{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?XY:z7).push(n=n+e[t])})();function gCe(e){if(e<768)return!1;for(let t=0,n=z7.length;;){let r=t+n>>1;if(e<z7[r])n=r;else if(e>=XY[r])t=r+1;else return!0;if(t==n)return!1}}function BO(e){return e>=127462&&e<=127487}const $O=8205;function bCe(e,t,n=!0,r=!0){return(n?QY:yCe)(e,t,r)}function QY(e,t,n){if(t==e.length)return t;t&&JY(e.charCodeAt(t))&&ZY(e.charCodeAt(t-1))&&t--;let r=o6(e,t);for(t+=zO(r);t<e.length;){let s=o6(e,t);if(r==$O||s==$O||n&&gCe(s))t+=zO(s),r=s;else if(BO(s)){let i=0,o=t-2;for(;o>=0&&BO(o6(e,o));)i++,o-=2;if(i%2==0)break;t+=2}else break}return t}function yCe(e,t,n){for(;t>0;){let r=QY(e,t-2,n);if(r<t)return r;t--}return 0}function o6(e,t){let n=e.charCodeAt(t);if(!ZY(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return JY(r)?(n-55296<<10)+(r-56320)+65536:n}function JY(e){return e>=56320&&e<57344}function ZY(e){return e>=55296&&e<56320}function zO(e){return e<65536?1:2}class Wr{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]=yg(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),Dc.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]=yg(this,t,n);let r=[];return this.decompose(t,n,r,0),Dc.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 sy(this),i=new sy(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 sy(this,t)}iterRange(t,n=this.length){return new eX(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 tX(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]?Wr.empty:t.length<=32?new oi(t):Dc.from(oi.split(t,[]))}}class oi extends Wr{constructor(t,n=vCe(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 xCe(s,a,r,o);s=a+1,r++}}decompose(t,n,r,s){let i=t<=0&&n>=this.length?this:new oi(FO(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(s&1){let o=r.pop(),a=$k(i.text,o.text.slice(),0,i.length);if(a.length<=32)r.push(new oi(a,o.length+i.length));else{let l=a.length>>1;r.push(new oi(a.slice(0,l)),new oi(a.slice(l)))}}else r.push(i)}replace(t,n,r){if(!(r instanceof oi))return super.replace(t,n,r);[t,n]=yg(this,t,n);let s=$k(this.text,$k(r.text,FO(this.text,0,t)),n),i=this.length+r.length-(n-t);return s.length<=32?new oi(s,i):Dc.from(oi.split(s,[]),i)}sliceString(t,n=this.length,r=`
`){[t,n]=yg(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 oi(r,s)),r=[],s=-1);return s>-1&&n.push(new oi(r,s)),n}}class Dc extends Wr{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 u=s&((o<=t?1:0)|(l>=n?2:0));o>=t&&l<=n&&!u?r.push(a):a.decompose(t-o,n-o,r,u)}o=l+1}}replace(t,n,r){if([t,n]=yg(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),u=this.lines-o.lines+l.lines;if(l.lines<u>>4&&l.lines>u>>6){let d=this.children.slice();return d[s]=l,new Dc(d,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]=yg(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 Dc))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],u=t.children[i];if(l!=u)return r+l.scanIdentical(u,n);r+=l.length+1}}static from(t,n=t.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let p of t)r+=p.lines;if(r<32){let p=[];for(let g of t)g.flatten(p);return new oi(p,n)}let s=Math.max(32,r>>5),i=s<<1,o=s>>1,a=[],l=0,u=-1,d=[];function h(p){let g;if(p.lines>i&&p instanceof Dc)for(let b of p.children)h(b);else p.lines>o&&(l>o||!l)?(m(),a.push(p)):p instanceof oi&&l&&(g=d[d.length-1])instanceof oi&&p.lines+g.lines<=32?(l+=p.lines,u+=p.length+1,d[d.length-1]=new oi(g.text.concat(p.text),g.length+1+p.length)):(l+p.lines>s&&m(),l+=p.lines,u+=p.length+1,d.push(p))}function m(){l!=0&&(a.push(d.length==1?d[0]:Dc.from(d,u)),u=-1,l=d.length=0)}for(let p of t)h(p);return m(),a.length==1?a[0]:new Dc(a,n)}}Wr.empty=new oi([""],0);function vCe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function $k(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 FO(e,t,n){return $k(e,[""],t,n)}class sy{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 oi?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 oi?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 oi){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 oi?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 eX{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new sy(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 tX{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"&&(Wr.prototype[Symbol.iterator]=function(){return this.iter()},sy.prototype[Symbol.iterator]=eX.prototype[Symbol.iterator]=tX.prototype[Symbol.iterator]=function(){return this});class xCe{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 yg(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Ui(e,t,n=!0,r=!0){return bCe(e,t,n,r)}function wCe(e){return e>=56320&&e<57344}function kCe(e){return e>=55296&&e<56320}function ha(e,t){let n=e.charCodeAt(t);if(!kCe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return wCe(r)?(n-55296<<10)+(r-56320)+65536:n}function PM(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Lc(e){return e<65536?1:2}const F7=/\r\n?|\n/;var Fo=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Fo||(Fo={}));class Qc{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){q7(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 Qc(t)}composeDesc(t){return this.empty?t:t.empty?this:nX(this,t)}mapDesc(t,n=!1){return t.empty?this:H7(this,t,n)}mapPos(t,n=-1,r=Fo.Simple){let s=0,i=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],u=s+a;if(l<0){if(u>t)return i+(t-s);i+=a}else{if(r!=Fo.Simple&&u>=t&&(r==Fo.TrackDel&&s<t&&u>t||r==Fo.TrackBefore&&s<t||r==Fo.TrackAfter&&u>t))return null;if(u>t||u==t&&n<0&&!a)return t==s||n<0?i:i+l;i+=l}s=u}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 Qc(t)}static create(t){return new Qc(t)}}class Ti extends Qc{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 q7(this,(n,r,s,i,o)=>t=t.replace(s,s+(r-n),o),!1),t}mapDesc(t,n=!1){return H7(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(Wr.empty);r.push(o?t.slice(i,i+o):Wr.empty)}i+=o}return new Ti(n,r)}compose(t){return this.empty?t:t.empty?this:nX(this,t,!0)}map(t,n=!1){return t.empty?this:H7(this,t,n,!0)}iterChanges(t,n=!1){q7(this,t,n)}get desc(){return Qc.create(this.sections)}filter(t){let n=[],r=[],s=[],i=new Fy(this);e:for(let o=0,a=0;;){let l=o==t.length?1e9:t[o++];for(;a<l||a==l&&i.len==0;){if(i.done)break e;let d=Math.min(i.len,l-a);bo(s,d,-1);let h=i.ins==-1?-1:i.off==0?i.ins:0;bo(n,d,h),h>0&&_h(r,n,i.text),i.forward(d),a+=d}let u=t[o++];for(;a<u;){if(i.done)break e;let d=Math.min(i.len,u-a);bo(n,d,-1),bo(s,d,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(d),a+=d}}return{changes:new Ti(n,r),filtered:Qc.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(d=!1){if(!d&&!s.length)return;o<n&&bo(s,n-o,-1);let h=new Ti(s,i);a=a?a.compose(h.map(a)):h,s=[],i=[],o=0}function u(d){if(Array.isArray(d))for(let h of d)u(h);else if(d instanceof Ti){if(d.length!=n)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${n})`);l(),a=a?a.compose(d.map(a)):d}else{let{from:h,to:m=h,insert:p}=d;if(h>m||h<0||m>n)throw new RangeError(`Invalid change range ${h} to ${m} (in doc of length ${n})`);let g=p?typeof p=="string"?Wr.of(p.split(r||F7)):p:Wr.empty,b=g.length;if(h==m&&b==0)return;h<o&&l(),h>o&&bo(s,h-o,-1),bo(s,m-h,b),_h(i,s,g),o=m}}return u(t),l(!a),a}static empty(t){return new Ti(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(Wr.empty);r[s]=Wr.of(i.slice(1)),n.push(i[0],r[s].length)}}}return new Ti(n,r)}static createSet(t,n){return new Ti(t,n)}}function bo(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 _h(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(Wr.empty);e.push(n)}}function q7(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 u=s,d=i,h=Wr.empty;for(;u+=a,d+=l,l&&r&&(h=h.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,u,i,d,h),s=u,i=d}}}function H7(e,t,n,r=!1){let s=[],i=r?[]:null,o=new Fy(e),a=new Fy(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 u=Math.min(o.len,a.len);bo(s,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!n))){let u=a.len;for(bo(s,a.ins,-1);u;){let d=Math.min(o.len,u);o.ins>=0&&l<o.i&&o.len<=d&&(bo(s,0,o.ins),i&&_h(i,s,o.text),l=o.i),o.forward(d),u-=d}a.next()}else if(o.ins>=0){let u=0,d=o.len;for(;d;)if(a.ins==-1){let h=Math.min(d,a.len);u+=h,d-=h,a.forward(h)}else if(a.ins==0&&a.len<d)d-=a.len,a.next();else break;bo(s,u,l<o.i?o.ins:0),i&&l<o.i&&_h(i,s,o.text),l=o.i,o.forward(o.len-d)}else{if(o.done&&a.done)return i?Ti.createSet(s,i):Qc.create(s);throw new Error("Mismatched change set lengths")}}}function nX(e,t,n=!1){let r=[],s=n?[]:null,i=new Fy(e),o=new Fy(t);for(let a=!1;;){if(i.done&&o.done)return s?Ti.createSet(r,s):Qc.create(r);if(i.ins==0)bo(r,i.len,0,a),i.next();else if(o.len==0&&!o.done)bo(r,0,o.ins,a),s&&_h(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),u=r.length;if(i.ins==-1){let d=o.ins==-1?-1:o.off?0:o.ins;bo(r,l,d,a),s&&d&&_h(s,r,o.text)}else o.ins==-1?(bo(r,i.off?0:i.len,l,a),s&&_h(s,r,i.textBit(l))):(bo(r,i.off?0:i.len,o.off?0:o.ins,a),s&&!o.off&&_h(s,r,o.text));a=(i.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>u),i.forward2(l),o.forward(l)}}}}class Fy{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?Wr.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Wr.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 km{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 km(r,s,this.flags)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Xe.range(t,n,void 0,void 0,r);let s=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Xe.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 Xe.range(t.anchor,t.head)}static create(t,n,r){return new km(t,n,r)}}class Xe{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Xe.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 Xe([this.main],0)}addRange(t,n=!0){return Xe.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,Xe.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 Xe(t.ranges.map(n=>km.fromJSON(n)),t.main)}static single(t,n=t){return new Xe([Xe.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 Xe.normalized(t.slice(),n);r=i.to}return new Xe(t,n)}static cursor(t,n=0,r,s){return km.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?km.create(n,t,48|o):km.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?Xe.range(l,a):Xe.range(a,l))}}return new Xe(t,n)}}function rX(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let OM=0;class sn{constructor(t,n,r,s,i){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=OM++,this.default=t([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(t={}){return new sn(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:BM),!!t.static,t.enables)}of(t){return new zk([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new zk(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new zk(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function BM(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class zk{constructor(t,n,r,s){this.dependencies=t,this.facet=n,this.type=r,this.value=s,this.id=OM++}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,u=!1,d=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?u=!0:((n=t[h.id])!==null&&n!==void 0?n:1)&1||d.push(t[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,m){if(l&&m.docChanged||u&&(m.docChanged||m.selection)||U7(h,d)){let p=r(h);if(a?!qO(p,h.values[o],s):!s(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,m)=>{let p,g=m.config.address[i];if(g!=null){let b=b_(m,g);if(this.dependencies.every(x=>x instanceof sn?m.facet(x)===h.facet(x):x instanceof lo?m.field(x,!1)==h.field(x,!1):!0)||(a?qO(p=r(h),b,s):s(p=r(h),b)))return h.values[o]=b,0}else p=r(h);return h.values[o]=p,1}}}}function qO(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 U7(e,t){let n=!1;for(let r of t)iy(e,r)&1&&(n=!0);return n}function _Ce(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 u=[];for(let d=0;d<r.length;d++){let h=b_(l,r[d]);if(s[d]==2)for(let m of h)u.push(m);else u.push(h)}return t.combine(u)}return{create(l){for(let u of r)iy(l,u);return l.values[o]=a(l),1},update(l,u){if(!U7(l,i))return 0;let d=a(l);return t.compare(d,l.values[o])?0:(l.values[o]=d,1)},reconfigure(l,u){let d=U7(l,r),h=u.config.facets[t.id],m=u.facet(t);if(h&&!d&&BM(n,h))return l.values[o]=m,0;let p=a(l);return t.compare(p,m)?(l.values[o]=m,0):(l.values[o]=p,1)}}}const gw=sn.define({static:!0});class lo{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 lo(OM++,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(gw).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(gw),o=s.facet(gw),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,gw.of({field:this,create:t})]}get extension(){return this}}const dm={lowest:4,low:3,default:2,high:1,highest:0};function Y1(e){return t=>new sX(t,e)}const vf={highest:Y1(dm.highest),high:Y1(dm.high),default:Y1(dm.default),low:Y1(dm.low),lowest:Y1(dm.lowest)};class sX{constructor(t,n){this.inner=t,this.prec=n}}class gp{of(t){return new V7(this,t)}reconfigure(t){return gp.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class V7{constructor(t,n){this.compartment=t,this.inner=n}}class g_{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 m of SCe(t,n,o))m instanceof lo?s.push(m):(i[m.facet.id]||(i[m.facet.id]=[])).push(m);let a=Object.create(null),l=[],u=[];for(let m of s)a[m.id]=u.length<<1,u.push(p=>m.slot(p));let d=r==null?void 0:r.config.facets;for(let m in i){let p=i[m],g=p[0].facet,b=d&&d[m]||[];if(p.every(x=>x.type==0))if(a[g.id]=l.length<<1|1,BM(b,p))l.push(r.facet(g));else{let x=g.combine(p.map(v=>v.value));l.push(r&&g.compare(x,r.facet(g))?r.facet(g):x)}else{for(let x of p)x.type==0?(a[x.id]=l.length<<1|1,l.push(x.value)):(a[x.id]=u.length<<1,u.push(v=>x.dynamicSlot(v)));a[g.id]=u.length<<1,u.push(x=>_Ce(x,g,p))}}let h=u.map(m=>m(a));return new g_(t,o,h,a,l,i)}}function SCe(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 u=r[l].indexOf(o);u>-1&&r[l].splice(u,1),o instanceof V7&&n.delete(o.compartment)}if(s.set(o,a),Array.isArray(o))for(let u of o)i(u,a);else if(o instanceof V7){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(o.compartment)||o.inner;n.set(o.compartment,u),i(u,a)}else if(o instanceof sX)i(o.inner,o.prec);else if(o instanceof lo)r[a].push(o),o.provides&&i(o.provides,a);else if(o instanceof zk)r[a].push(o),o.facet.extensions&&i(o.facet.extensions,dm.default);else{let u=o.extension;if(!u)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(u,a)}}return i(e,dm.default),r.reduce((o,a)=>o.concat(a))}function iy(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 b_(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const iX=sn.define(),W7=sn.define({combine:e=>e.some(t=>t),static:!0}),oX=sn.define({combine:e=>e.length?e[0]:void 0,static:!0}),aX=sn.define(),lX=sn.define(),cX=sn.define(),uX=sn.define({combine:e=>e.length?e[0]:!1});class _d{constructor(t,n){this.type=t,this.value=n}static define(){return new CCe}}class CCe{of(t){return new _d(this,t)}}class TCe{constructor(t){this.map=t}of(t){return new Yn(this,t)}}class Yn{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 Yn(this.type,n)}is(t){return this.type==t}static define(t={}){return new TCe(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}}Yn.reconfigure=Yn.define();Yn.appendConfig=Yn.define();class Ei{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&&rX(r,n.newLength),i.some(a=>a.type==Ei.time)||(this.annotations=i.concat(Ei.time.of(Date.now())))}static create(t,n,r,s,i,o){return new Ei(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(Ei.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Ei.time=_d.define();Ei.userEvent=_d.define();Ei.addToHistory=_d.define();Ei.remote=_d.define();function ACe(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 dX(e,t,n){var r;let s,i,o;return n?(s=t.changes,i=Ti.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:Yn.mapEffects(e.effects,s).concat(Yn.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function G7(e,t,n){let r=t.selection,s=H0(t.annotations);return t.userEvent&&(s=s.concat(Ei.userEvent.of(t.userEvent))),{changes:t.changes instanceof Ti?t.changes:Ti.of(t.changes||[],n,e.facet(oX)),selection:r&&(r instanceof Xe?r:Xe.single(r.anchor,r.head)),effects:H0(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function hX(e,t,n){let r=G7(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=dX(r,G7(e,t[i],o?r.changes.newLength:e.doc.length),o)}let s=Ei.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return MCe(n?ECe(s):s)}function ECe(e){let t=e.startState,n=!0;for(let s of t.facet(aX)){let i=s(e);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:ACe(n,i))}if(n!==!0){let s,i;if(n===!1)i=e.changes.invertedDesc,s=Ti.empty(t.doc.length);else{let o=e.changes.filter(n);s=o.changes,i=o.filtered.mapDesc(o.changes).invertedDesc}e=Ei.create(t,s,e.selection&&e.selection.map(i),Yn.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(lX);for(let s=r.length-1;s>=0;s--){let i=r[s](e);i instanceof Ei?e=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Ei?e=i[0]:e=hX(t,H0(i),!1)}return e}function MCe(e){let t=e.startState,n=t.facet(cX),r=e;for(let s=n.length-1;s>=0;s--){let i=n[s](e);i&&Object.keys(i).length&&(r=dX(r,G7(t,i,e.changes.newLength),!0))}return r==e?e:Ei.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const NCe=[];function H0(e){return e==null?NCe:Array.isArray(e)?e:[e]}var $s=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}($s||($s={}));const jCe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let K7;try{K7=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ICe(e){if(K7)return K7.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||jCe.test(n)))return!0}return!1}function RCe(e){return t=>{if(!/\S/.test(t))return $s.Space;if(ICe(t))return $s.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return $s.Word;return $s.Other}}class Ir{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++)iy(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 iy(this,r),b_(this,r)}update(...t){return hX(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:s}=n;for(let a of t.effects)a.is(gp.reconfigure)?(n&&(s=new Map,n.compartments.forEach((l,u)=>s.set(u,l)),n=null),s.set(a.value.compartment,a.value.extension)):a.is(Yn.reconfigure)?(n=null,r=a.value):a.is(Yn.appendConfig)&&(n=null,r=H0(r).concat(a.value));let i;n?i=t.startState.values.slice():(n=g_.resolve(r,s,this),i=new Ir(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,u)=>u.reconfigure(l,this),null).values);let o=t.startState.facet(W7)?t.newSelection:t.newSelection.asSingle();new Ir(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:Xe.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=H0(r.effects);for(let a=1;a<n.ranges.length;a++){let l=t(n.ranges[a]),u=this.changes(l.changes),d=u.map(s);for(let m=0;m<a;m++)i[m]=i[m].map(d);let h=s.mapDesc(u,!0);i.push(l.range.map(h)),s=s.compose(d),o=Yn.mapEffects(o,d).concat(Yn.mapEffects(H0(l.effects),h))}return{changes:s,selection:Xe.create(i,n.mainIndex),effects:o}}changes(t=[]){return t instanceof Ti?t:Ti.of(t,this.doc.length,this.facet(Ir.lineSeparator))}toText(t){return Wr.of(t.split(this.facet(Ir.lineSeparator)||F7))}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:(iy(this,n),b_(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 lo&&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 Ir.create({doc:t.doc,selection:Xe.fromJSON(t.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(t={}){let n=g_.resolve(t.extensions||[],new Map),r=t.doc instanceof Wr?t.doc:Wr.of((t.doc||"").split(n.staticFacet(Ir.lineSeparator)||F7)),s=t.selection?t.selection instanceof Xe?t.selection:Xe.single(t.selection.anchor,t.selection.head):Xe.single(0);return rX(s,r.length),n.staticFacet(W7)||(s=s.asSingle()),new Ir(n,r,s,n.dynamicSlots.map(()=>null),(i,o)=>o.create(i),null)}get tabSize(){return this.facet(Ir.tabSize)}get lineBreak(){return this.facet(Ir.lineSeparator)||`
`}get readOnly(){return this.facet(uX)}phrase(t,...n){for(let r of this.facet(Ir.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(iX))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 RCe(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=Ui(n,o,!1);if(i(n.slice(l,o))!=$s.Word)break;o=l}for(;a<s;){let l=Ui(n,a);if(i(n.slice(a,l))!=$s.Word)break;a=l}return o==a?null:Xe.range(o+r,a+r)}}Ir.allowMultipleSelections=W7;Ir.tabSize=sn.define({combine:e=>e.length?e[0]:4});Ir.lineSeparator=oX;Ir.readOnly=uX;Ir.phrases=sn.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])}});Ir.languageData=iX;Ir.changeFilter=aX;Ir.transactionFilter=lX;Ir.transactionExtender=cX;gp.reconfigure=Yn.define();function du(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 Zh{eq(t){return this==t}range(t,n=t){return Y7.create(t,n,this)}}Zh.prototype.startSide=Zh.prototype.endSide=0;Zh.prototype.point=!1;Zh.prototype.mapMode=Fo.TrackDel;function $M(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}let Y7=class fX{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new fX(t,n,r)}};function X7(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class zM{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,u=i[l]-t||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return u>=0?o:a;u>=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 u=this.value[l],d=this.from[l]+t,h=this.to[l]+t,m,p;if(d==h){let g=n.mapPos(d,u.startSide,u.mapMode);if(g==null||(m=p=g,u.startSide!=u.endSide&&(p=n.mapPos(d,u.endSide),p<m)))continue}else if(m=n.mapPos(d,u.startSide),p=n.mapPos(h,u.endSide),m>p||m==p&&u.startSide>0&&u.endSide<=0)continue;(p-m||u.endSide-u.startSide)<0||(o<0&&(o=m),u.point&&(a=Math.max(a,p-m)),r.push(u),s.push(m-o),i.push(p-o))}return{mapped:r.length?new zM(s,i,r,a):null,pos:o}}}class _r{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 _r(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(X7)),this.isEmpty)return n.length?_r.of(n):this;let a=new mX(this,null,-1).goto(0),l=0,u=[],d=new Zc;for(;a.value||l<n.length;)if(l<n.length&&(a.from-n[l].from||a.startSide-n[l].value.startSide)>=0){let h=n[l++];d.addInner(h.from,h.to,h.value)||u.push(h)}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])&&d.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))&&(d.addInner(a.from,a.to,a.value)||u.push(Y7.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!u.length?_r.empty:this.nextLayer.update({add:u,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],u=t.touchesRange(a,a+l.length);if(u===!1)s=Math.max(s,l.maxPoint),n.push(l),r.push(t.mapPos(a));else if(u===!0){let{mapped:d,pos:h}=l.map(a,t);d&&(s=Math.max(s,d.maxPoint),n.push(d),r.push(h))}}let i=this.nextLayer.map(t);return n.length==0?i:new _r(r,n,i||_r.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 qy.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return qy.from(t).goto(n)}static compare(t,n,r,s,i=-1){let o=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),a=n.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=i),l=HO(o,a,r),u=new X1(o,l,i),d=new X1(a,l,i);r.iterGaps((h,m,p)=>UO(u,h,d,m,p,s)),r.empty&&r.length==0&&UO(u,0,d,0,0,s)}static eq(t,n,r=0,s){s==null&&(s=999999999);let i=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),o=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(i.length!=o.length)return!1;if(!i.length)return!0;let a=HO(i,o),l=new X1(i,a,0).goto(r),u=new X1(o,a,0).goto(r);for(;;){if(l.to!=u.to||!Q7(l.active,u.active)||l.point&&(!u.point||!$M(l.point,u.point)))return!1;if(l.to>s)return!0;l.next(),u.next()}}static spans(t,n,r,s,i=-1){let o=new X1(t,null,i).goto(n),a=n,l=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let d=o.activeForPoint(o.to),h=o.pointFrom<n?d.length+1:o.point.startSide<0?d.length:Math.min(d.length,l);s.point(a,u,o.point,d,h,o.pointRank),l=Math.min(o.openEnd(u),d.length)}else u>a&&(s.span(a,u,o.active,l),l=o.openEnd(u));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 Zc;for(let s of t instanceof Y7?[t]:n?DCe(t):t)r.add(s.from,s.to,s.value);return r.finish()}static join(t){if(!t.length)return _r.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let s=t[r];s!=_r.empty;s=s.nextLayer)n=new _r(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}_r.empty=new _r([],[],null,-1);function DCe(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(X7(t,r)>0)return e.slice().sort(X7);t=r}return e}_r.empty.nextLayer=_r.empty;class Zc{finishChunk(t){this.chunks.push(new zM(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 Zc)).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(_r.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=_r.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function HO(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 mX{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 qy{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 mX(o,n,r,i));return s.length==1?s[0]:new qy(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--)a6(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--)a6(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(),a6(this.heap,0)}}}function a6(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 X1{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=qy.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){bw(this.active,t),bw(this.activeTo,t),bw(this.activeRank,t),this.minActive=VO(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++;yw(this.active,n,r),yw(this.activeTo,n,s),yw(this.activeRank,n,i),t&&yw(t,n,this.cursor.from),this.minActive=VO(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&&bw(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 UO(e,t,n,r,s,i){e.goto(t),n.goto(r);let o=r+s,a=r,l=r-t,u=!!i.boundChange;for(let d=!1;;){let h=e.to+l-n.to,m=h||e.endSide-n.endSide,p=m<0?e.to+l:n.to,g=Math.min(p,o);if(e.point||n.point?(e.point&&n.point&&$M(e.point,n.point)&&Q7(e.activeForPoint(e.to),n.activeForPoint(n.to))||i.comparePoint(a,g,e.point,n.point),d=!1):(d&&i.boundChange(a),g>a&&!Q7(e.active,n.active)&&i.compareRange(a,g,e.active,n.active),u&&g<o&&(h||e.openEnd(p)!=n.openEnd(p))&&(d=!0)),p>o)break;a=p,m<=0&&e.next(),m>=0&&n.next()}}function Q7(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!$M(e[n],t[n]))return!1;return!0}function bw(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function yw(e,t,n){for(let r=e.length-1;r>=t;r--)e[r+1]=e[r];e[t]=n}function VO(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 Zg(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=Ui(e,s));return r}function J7(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=Ui(e,s)}return r===!0?-1:e.length}const Z7="ͼ",WO=typeof Symbol>"u"?"__"+Z7:Symbol.for(Z7),eA=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),GO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ef{constructor(t,n){this.rules=[];let{finish:r}=n||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function i(o,a,l,u){let d=[],h=/^@(\w+)\b/.exec(o[0]),m=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let g=a[p];if(/&/.test(p))i(p.split(/,\s*/).map(b=>o.map(x=>b.replace(/&/,x))).reduce((b,x)=>b.concat(x)),g,l);else if(g&&typeof g=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");i(s(p),g,d,m)}else g!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||m)&&l.push((r&&!h&&!u?o.map(r):o).join(", ")+" {"+d.join(" ")+"}")}for(let o in t)i(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=GO[WO]||1;return GO[WO]=t+1,Z7+t.toString(36)}static mount(t,n,r){let s=t[eA],i=r&&r.nonce;s?i&&s.setNonce(i):s=new LCe(t,i),s.mount(Array.isArray(n)?n:[n],t)}}let KO=new Map;class LCe{constructor(t,n){let r=t.ownerDocument||t,s=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let i=KO.get(r);if(i)return t[eA]=i;this.sheet=new s.CSSStyleSheet,KO.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[eA]=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 u=0;u<a.rules.length;u++)r.insertRule(a.rules[u],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 tf={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:"'"},Hy={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},PCe=typeof navigator<"u"&&/Mac/.test(navigator.platform),OCe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var to=0;to<10;to++)tf[48+to]=tf[96+to]=String(to);for(var to=1;to<=24;to++)tf[to+111]="F"+to;for(var to=65;to<=90;to++)tf[to]=String.fromCharCode(to+32),Hy[to]=String.fromCharCode(to);for(var l6 in tf)Hy.hasOwnProperty(l6)||(Hy[l6]=tf[l6]);function BCe(e){var t=PCe&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||OCe&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Hy:tf)[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}function fs(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?e.setAttribute(r,s):s!=null&&(e[r]=s)}t++}for(;t<arguments.length;t++)pX(e,arguments[t]);return e}function pX(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)pX(e,t[n]);else throw new RangeError("Unsupported child node: "+t)}let Po=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},tA=typeof document<"u"?document:{documentElement:{style:{}}};const nA=/Edge\/(\d+)/.exec(Po.userAgent),gX=/MSIE \d/.test(Po.userAgent),rA=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Po.userAgent),vS=!!(gX||rA||nA),YO=!vS&&/gecko\/(\d+)/i.test(Po.userAgent),c6=!vS&&/Chrome\/(\d+)/.exec(Po.userAgent),XO="webkitFontSmoothing"in tA.documentElement.style,sA=!vS&&/Apple Computer/.test(Po.vendor),QO=sA&&(/Mobile\/\w+/.test(Po.userAgent)||Po.maxTouchPoints>2);var rn={mac:QO||/Mac/.test(Po.platform),windows:/Win/.test(Po.platform),linux:/Linux|X11/.test(Po.platform),ie:vS,ie_version:gX?tA.documentMode||6:rA?+rA[1]:nA?+nA[1]:0,gecko:YO,gecko_version:YO?+(/Firefox\/(\d+)/.exec(Po.userAgent)||[0,0])[1]:0,chrome:!!c6,chrome_version:c6?+c6[1]:0,ios:QO,android:/Android\b/.test(Po.userAgent),webkit:XO,webkit_version:XO?+(/\bAppleWebKit\/(\d+)/.exec(Po.userAgent)||[0,0])[1]:0,safari:sA,safari_version:sA?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Po.userAgent)||[0,0])[1]:0,tabSize:tA.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function FM(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 y_=Object.create(null);function qM(e,t,n){if(e==t)return!0;e||(e=y_),t||(t=y_);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 $Ce(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 JO(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 zCe(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 ll{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 ao=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(ao||(ao={}));class vn extends Zh{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 zv(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 Gm(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}=bX(t,n);r=(i?n?-3e8:-1:5e8)-1,s=(o?n?2e8:1:-6e8)+1}return new Gm(t,r,s,n,t.widget||null,!0)}static line(t){return new Fv(t)}static set(t,n=!1){return _r.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}vn.none=_r.empty;class zv extends vn{constructor(t){let{start:n,end:r}=bX(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?FM(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||y_}eq(t){return this==t||t instanceof zv&&this.tagName==t.tagName&&qM(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)}}zv.prototype.point=!1;class Fv extends vn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Fv&&this.spec.class==t.spec.class&&qM(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)}}Fv.prototype.mapMode=Fo.TrackBefore;Fv.prototype.point=!0;class Gm extends vn{constructor(t,n,r,s,i,o){super(n,r,i,t),this.block=s,this.isReplace=o,this.mapMode=s?n<=0?Fo.TrackBefore:Fo.TrackAfter:Fo.TrackDel}get type(){return this.startSide!=this.endSide?ao.WidgetRange:this.startSide<=0?ao.WidgetBefore:ao.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Gm&&FCe(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)}}Gm.prototype.point=!0;function bX(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 FCe(e,t){return e==t||!!(e&&t&&e.compare(t))}function U0(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 Uy extends Zh{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof Uy&&this.tagName==t.tagName&&qM(this.attributes,t.attributes)}static create(t){return new Uy(t.tagName,t.attributes||y_,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return _r.of(t,n)}}Uy.prototype.startSide=Uy.prototype.endSide=-1;function Vy(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function iA(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function oy(e,t){if(!t.anchorNode)return!1;try{return iA(e,t.anchorNode)}catch{return!1}}function ay(e){return e.nodeType==3?Gy(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function ly(e,t,n,r){return n?ZO(e,t,n,r,-1)||ZO(e,t,n,r,1):!1}function nf(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function v_(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function ZO(e,t,n,r,s){for(;;){if(e==n&&t==r)return!0;if(t==(s<0?0:ud(e))){if(e.nodeName=="DIV")return!1;let i=e.parentNode;if(!i||i.nodeType!=1)return!1;t=nf(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?ud(e):0}else return!1}}function ud(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Wy(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function qCe(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 yX(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 HCe(e,t,n,r,s,i,o,a){let l=e.ownerDocument,u=l.defaultView||window;for(let d=e,h=!1;d&&!h;)if(d.nodeType==1){let m,p=d==l.body,g=1,b=1;if(p)m=qCe(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(h=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let y=d.getBoundingClientRect();({scaleX:g,scaleY:b}=yX(d,y)),m={left:y.left,right:y.left+d.clientWidth*g,top:y.top,bottom:y.top+d.clientHeight*b}}let x=0,v=0;if(s=="nearest")t.top<m.top+o?(v=t.top-(m.top+o),n>0&&t.bottom>m.bottom+v&&(v=t.bottom-m.bottom+o)):t.bottom>m.bottom-o&&(v=t.bottom-m.bottom+o,n<0&&t.top-v<m.top&&(v=t.top-(m.top+o)));else{let y=t.bottom-t.top,w=m.bottom-m.top;v=(s=="center"&&y<=w?t.top+y/2-w/2:s=="start"||s=="center"&&n<0?t.top-o:t.bottom-w+o)-m.top}if(r=="nearest"?t.left<m.left+i?(x=t.left-(m.left+i),n>0&&t.right>m.right+x&&(x=t.right-m.right+i)):t.right>m.right-i&&(x=t.right-m.right+i,n<0&&t.left<m.left+x&&(x=t.left-(m.left+i))):x=(r=="center"?t.left+(t.right-t.left)/2-(m.right-m.left)/2:r=="start"==a?t.left-i:t.right-(m.right-m.left)+i)-m.left,x||v)if(p)u.scrollBy(x,v);else{let y=0,w=0;if(v){let k=d.scrollTop;d.scrollTop+=v/b,w=(d.scrollTop-k)*b}if(x){let k=d.scrollLeft;d.scrollLeft+=x/g,y=(d.scrollLeft-k)*g}t={left:t.left-y,top:t.top-w,right:t.right-y,bottom:t.bottom-w},y&&Math.abs(y-x)<1&&(r="nearest"),w&&Math.abs(w-v)<1&&(s="nearest")}if(p)break;(t.top<m.top||t.bottom>m.bottom||t.left<m.left||t.right>m.right)&&(t={left:Math.max(t.left,m.left),right:Math.min(t.right,m.right),top:Math.max(t.top,m.top),bottom:Math.min(t.bottom,m.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function vX(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 UCe{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?ud(n):0),r,Math.min(t.focusOffset,r?ud(r):0))}set(t,n,r,s){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let am=null;rn.safari&&rn.safari_version>=26&&(am=!1);function xX(e){if(e.setActive)return e.setActive();if(am)return e.focus(am);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(am==null?{get preventScroll(){return am={preventScroll:!0},!0}}:void 0),!am){am=!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 eB;function Gy(e,t,n=t){let r=eB||(eB=document.createRange());return r.setEnd(e,n),r.setStart(e,t),r}function V0(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 VCe(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function WCe(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,ud(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=ud(n))}else{if(n==e)return!0;r=nf(n),n=n.parentNode}}function wX(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 kX(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=ud(n)}else if(n.parentNode&&!v_(n))r=nf(n),n=n.parentNode;else return null}}function _X(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&&!v_(n))r=nf(n)+1,n=n.parentNode;else return null}}class Jl{constructor(t,n,r=!0){this.node=t,this.offset=n,this.precise=r}static before(t,n){return new Jl(t.parentNode,nf(t),n)}static after(t,n){return new Jl(t.parentNode,nf(t)+1,n)}}var xs=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(xs||(xs={}));const Km=xs.LTR,HM=xs.RTL;function SX(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const GCe=SX("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),KCe=SX("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),oA=Object.create(null),bc=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);oA[t]=n,oA[n]=-t}function CX(e){return e<=247?GCe[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?KCe[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const YCe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Hc{get dir(){return this.level%2?HM:Km}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 TX(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||!TX(r.inner,s.inner))return!1}return!0}const bs=[];function XCe(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 u=o,d=l,h=l;u<a;u++){let m=CX(e.charCodeAt(u));m==512?m=d:m==8&&h==4&&(m=16),bs[u]=m==4?2:m,m&7&&(h=m),d=m}for(let u=o,d=l,h=l;u<a;u++){let m=bs[u];if(m==128)u<a-1&&d==bs[u+1]&&d&24?m=bs[u]=d:bs[u]=256;else if(m==64){let p=u+1;for(;p<a&&bs[p]==64;)p++;let g=u&&d==8||p<n&&bs[p]==8?h==1?1:8:256;for(let b=u;b<p;b++)bs[b]=g;u=p-1}else m==8&&h==1&&(bs[u]=1);d=m,m&7&&(h=m)}}}function QCe(e,t,n,r,s){let i=s==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let u=o?r[o-1].to:t,d=o<r.length?r[o].from:n;for(let h=u,m,p,g;h<d;h++)if(p=oA[m=e.charCodeAt(h)])if(p<0){for(let b=a-3;b>=0;b-=3)if(bc[b+1]==-p){let x=bc[b+2],v=x&2?s:x&4?x&1?i:s:0;v&&(bs[h]=bs[bc[b]]=v),a=b;break}}else{if(bc.length==189)break;bc[a++]=h,bc[a++]=m,bc[a++]=l}else if((g=bs[h])==2||g==1){let b=g==s;l=b?0:1;for(let x=a-3;x>=0;x-=3){let v=bc[x+2];if(v&2)break;if(b)bc[x+2]|=2;else{if(v&4)break;bc[x+2]|=4}}}}}function JCe(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 u=bs[l];if(u==256){let d=l+1;for(;;)if(d==a){if(s==n.length)break;d=n[s++].to,a=s<n.length?n[s].from:t}else if(bs[d]==256)d++;else break;let h=i==1,m=(d<t?bs[d]:r)==1,p=h==m?h?1:2:r;for(let g=d,b=s,x=b?n[b-1].to:e;g>l;)g==x&&(g=n[--b].from,x=b?n[b-1].to:e),bs[--g]=p;l=d}else i=u,l++}}}function aA(e,t,n,r,s,i,o){let a=r%2?2:1;if(r%2==s%2)for(let l=t,u=0;l<n;){let d=!0,h=!1;if(u==i.length||l<i[u].from){let b=bs[l];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?r:r+1,g=l;e:for(;;)if(u<i.length&&g==i[u].from){if(h)break e;let b=i[u];if(!d)for(let x=b.to,v=u+1;;){if(x==n)break e;if(v<i.length&&i[v].from==x)x=i[v++].to;else{if(bs[x]==a)break e;break}}if(u++,m)m.push(b);else{b.from>l&&o.push(new Hc(l,b.from,p));let x=b.direction==Km!=!(p%2);lA(e,x?r+1:r,s,b.inner,b.from,b.to,o),l=b.to}g=b.to}else{if(g==n||(d?bs[g]!=a:bs[g]==a))break;g++}m?aA(e,l,g,r+1,s,m,o):l<g&&o.push(new Hc(l,g,p)),l=g}else for(let l=n,u=i.length;l>t;){let d=!0,h=!1;if(!u||l>i[u-1].to){let b=bs[l-1];b!=a&&(d=!1,h=b==16)}let m=!d&&a==1?[]:null,p=d?r:r+1,g=l;e:for(;;)if(u&&g==i[u-1].to){if(h)break e;let b=i[--u];if(!d)for(let x=b.from,v=u;;){if(x==t)break e;if(v&&i[v-1].to==x)x=i[--v].from;else{if(bs[x-1]==a)break e;break}}if(m)m.push(b);else{b.to<l&&o.push(new Hc(b.to,l,p));let x=b.direction==Km!=!(p%2);lA(e,x?r+1:r,s,b.inner,b.from,b.to,o),l=b.from}g=b.from}else{if(g==t||(d?bs[g-1]!=a:bs[g-1]==a))break;g--}m?aA(e,g,l,r+1,s,m,o):g<l&&o.push(new Hc(g,l,p)),l=g}}function lA(e,t,n,r,s,i,o){let a=t%2?2:1;XCe(e,s,i,r,a),QCe(e,s,i,r,a),JCe(s,i,r,a),aA(e,s,i,t,n,r,o)}function ZCe(e,t,n){if(!e)return[new Hc(0,0,t==HM?1:0)];if(t==Km&&!n.length&&!YCe.test(e))return AX(e.length);if(n.length)for(;e.length>bs.length;)bs[bs.length]=256;let r=[],s=t==Km?0:1;return lA(e,s,s,n,0,e.length,r),r}function AX(e){return[new Hc(0,e,0)]}let EX="";function e5e(e,t,n,r,s){var i;let o=r.head-e.from,a=Hc.find(t,o,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),l=t[a],u=l.side(s,n);if(o==u){let m=a+=s?1:-1;if(m<0||m>=t.length)return null;l=t[a=m],o=l.side(!s,n),u=l.side(s,n)}let d=Ui(e.text,o,l.forward(s,n));(d<l.from||d>l.to)&&(d=u),EX=e.text.slice(Math.min(o,d),Math.max(o,d));let h=a==(s?t.length-1:0)?null:t[a+(s?1:-1)];return h&&d==u&&h.level+(s?0:1)<l.level?Xe.cursor(h.side(!s,n)+e.from,h.forward(s,n)?1:-1,h.level):Xe.cursor(d+e.from,l.forward(s,n)?-1:1,l.level)}function t5e(e,t,n){for(let r=t;r<n;r++){let s=CX(e.charCodeAt(r));if(s==1)return Km;if(s==2||s==4)return HM}return Km}const MX=sn.define(),NX=sn.define(),jX=sn.define(),IX=sn.define(),cA=sn.define(),RX=sn.define(),DX=sn.define(),UM=sn.define(),VM=sn.define(),LX=sn.define({combine:e=>e.some(t=>t)}),PX=sn.define({combine:e=>e.some(t=>t)}),OX=sn.define();class W0{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 W0(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 W0(Xe.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const vw=Yn.define({map:(e,t)=>e.map(t)}),BX=Yn.define();function ma(e,t,n){let r=e.facet(IX);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 Pu=sn.define({combine:e=>e.length?e[0]:!0});let n5e=0;const k0=sn.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 Fs{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(k0.of({plugin:this,arg:void 0}))}of(t){return this.baseExtensions.concat(k0.of({plugin:this,arg:t}))}static define(t,n){const{eventHandlers:r,eventObservers:s,provide:i,decorations:o}=n||{};return new Fs(n5e++,t,r,s,a=>{let l=[];return o&&l.push(xS.of(u=>{let d=u.plugin(a);return d?o(d):vn.none})),i&&l.push(i(a)),l})}static fromClass(t,n){return Fs.define((r,s)=>new t(r,s),n)}}class u6{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(ma(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){ma(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){ma(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const $X=sn.define(),WM=sn.define(),xS=sn.define(),zX=sn.define(),GM=sn.define(),qv=sn.define(),FX=sn.define();function tB(e,t){let n=e.state.facet(FX);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(e):i),s=[];return _r.spans(r,t.from,t.to,{point(){},span(i,o,a,l){let u=i-t.from,d=o-t.from,h=s;for(let m=a.length-1;m>=0;m--,l--){let p=a[m].spec.bidiIsolate,g;if(p==null&&(p=t5e(t.text,u,d)),l>0&&h.length&&(g=h[h.length-1]).to==u&&g.direction==p)g.to=d,h=g.inner;else{let b={from:u,to:d,direction:p,inner:[]};h.push(b),h=b.inner}}}}),s}const qX=sn.define();function KM(e){let t=0,n=0,r=0,s=0;for(let i of e.state.facet(qX)){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 xb=sn.define();class jl{constructor(t,n,r,s){this.fromA=t,this.toA=n,this.fromB=r,this.toB=s}join(t){return new jl(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,u=Math.min(a,l);if(u==1e9)break;let d=u+o,h=u,m=d;for(;;)if(i<n.length&&n[i]<=h){let p=n[i+1];i+=2,h=Math.max(h,p);for(let g=s;g<t.length&&t[g].fromB<=h;g++)o=t[g].toA-t[g].toB;m=Math.max(m,p+o)}else if(s<t.length&&t[s].fromB<=h){let p=t[s++];h=Math.max(h,p.toB),m=Math.max(m,p.toA),o=p.toA-p.toB}else break;r.push(new jl(d,m,u,h))}return r}}class x_{constructor(t,n,r){this.view=t,this.state=n,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=Ti.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 jl(i,o,a,l))),this.changedRanges=s}static create(t,n,r){return new x_(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 r5e=[];class ei{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 r5e}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&&$Ce(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=nf(this.dom),s=this.length?t>0:n>0;return new Jl(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 kS)return t;return null}static get(t){return t.cmTile}}class wS extends ei{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=nB(s);else n.insertBefore(a.dom,s);r=a.dom}for(s=r?r.nextSibling:n.firstChild,i&&s&&(i.written=!0);s;)s=nB(s);this.length=o}}function nB(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class kS extends wS{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=ei.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 Ju)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 u=l+a.length;if(t>=l&&t<=u){if(a.isWidget()&&n>=-1&&n<=1){if(a.flags&32)return!0;a.flags&16&&(r=void 0)}(l<t||t==u&&(n<-1?a.length:a.covers(1)))&&(!r||!a.isWidget()&&r.isWidget())&&(r=a,s=t-l),(u>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 Ju extends wS{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 Ju(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class vg extends wS{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let s=new vg(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(d,h){for(let m=0,p=0;m<d.children.length&&p<=h;m++){let g=d.children[m],b=p+g.length;b>=h&&(g.isComposite()?l(g,h-p):(!o||o.isHidden&&(n>0||r&&i5e(o,g)))&&(b>h||g.flags&32)?(o=g,a=h-p):(p<h||g.flags&16&&!g.isHidden)&&(s=g,i=h-p)),p=b}}l(this,t);let u=(n<0?s:o)||s||o;return u?{tile:u,offset:u==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):s5e(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 Jl(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 Jl(l.dom,0);l==r.tile&&(a=!0)}}return new Jl(this.dom,0)}}function s5e(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=ay(t);return n[n.length-1]||null}function i5e(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}class fa extends wS{constructor(t,n){super(t),this.mark=n}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new fa(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class _m extends ei{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?rn.chrome||rn.gecko||(t?(s--,o=1):i<r&&(i++,o=-1)):n<0?s--:i<r&&i++;let a=Gy(this.dom,s,i).getClientRects();if(!a.length)return null;let l=a[(o?o<0:n>=0)?0:a.length-1];return rn.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,u=>u.width)||l),o?Wy(l,o<0):l||null}static of(t,n){let r=new _m(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Ym extends ei{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 Wy(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 Wy(o,!a)}}get overrideDOMText(){if(!this.length)return Wr.empty;let{root:t}=this;if(!t)return Wr.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 Ym(i,r,t,s)}}class w_ extends ei{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 Wr.empty}coordsIn(t){return this.dom.getBoundingClientRect()}}class o5e{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],u=l.breakAfter;(n>0?l.length<=t:l.length<t)&&(!r||r.skip(l,0,l.length)!==!1||!l.isComposite)?(o=!!u,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 a5e{constructor(t,n,r,s){this.from=t,this.to=n,this.wrapper=r,this.rank=s}}class l5e{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 _m(a.dom,a.text+t);l.parent=o}else o.append(s||_m.of(t,(i=this.cache.find(_m))===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)?d6(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],u=s.lastChild;if(u instanceof fa&&u.mark.eq(l.mark))u.dom!=l.dom&&u.setDOM(d6(l.dom)),s=u;else{if(this.cache.reused.get(l)){let h=ei.get(l.dom);h&&h.setDOM(d6(l.dom))}let d=fa.of(l.mark,l.dom);s.append(d),s=d}this.cache.reused.set(l,2)}let i=ei.get(t.text);i&&this.cache.reused.set(i,2);let o=new _m(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=HX);let s=vg.start(t,n||((r=this.cache.find(vg))===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 fa&&a.mark.eq(o))s=a,n--;else{let l=fa.of(o,(r=this.cache.find(fa,u=>u.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||!rB(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(rn.ios&&rB(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(h6,0,32)||new Ym(h6.toDOM(),0,h6,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 a5e(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 Ju&&s.wrapper.eq(r.wrapper))n=s;else{let i=Ju.of(r.wrapper,(t=this.cache.find(Ju,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(w_,void 0,1);return r&&(r.flags=n),r||new w_(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class c5e{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 k_=[Ym,vg,_m,fa,w_,Ju,kS];for(let e=0;e<k_.length;e++)k_[e].bucket=e;class u5e{constructor(t){this.view=t,this.buckets=k_.map(()=>[]),this.index=k_.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,u=i[l];if((!n||n(u))&&!this.reused.has(u))return i.splice(l,1),l<o&&this.index[s]--,this.reused.set(u,r),u}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 Ym(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 d5e{constructor(t,n,r,s,i){this.view=t,this.decorations=s,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new u5e(t),this.text=new c5e(t.state.doc),this.builder=new l5e(this.cache,new kS(t,t.contentDOM),_r.iter(r)),this.cache.reused.set(n,2),this.old=new o5e(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 u=l-s;this.preserve(u,!o,!a),s=l,i+=u}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=m5e(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 u=l>0||a<o.length?Ym.of(o.widget,this.view,l-a,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);u.flags&256?(u.flags&=-2,this.builder.addBlockWidget(u)):(this.builder.ensureLine(null),this.builder.addInlineWidget(u,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 w_)this.cache.add(o);else if(o instanceof fa)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 fa&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=i=0):o instanceof fa&&(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=_r.spans(this.decorations,t,n,{point:(a,l,u,d,h,m)=>{if(u instanceof Gm){if(this.disallowBlockEffectsFor[m]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(l>this.view.state.doc.lineAt(a).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(i=d.length,h>d.length)s.continueWidget(l-a);else{let p=u.widget||(u.block?xg.block:xg.inline),g=h5e(u),b=this.cache.findWidget(p,l-a,g)||Ym.of(p,this.view,l-a,g);u.block?(u.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(b)):(s.ensureLine(r),s.addInlineWidget(b,d,h))}r=null}else r=f5e(r,u);l>a&&this.text.skip(l-a)},span:(a,l,u,d)=>{for(let h=a;h<l;){let m=this.text.next(Math.min(512,l-h));m==null?(s.addLineStartIfNotCovered(r),s.addBreak(),h++):(s.ensureLine(r),s.addText(m,u,h==a?d:u.length),h+=m.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=ei.get(s);if(s==this.view.contentDOM)break;i instanceof fa?n.push(i):i!=null&&i.isLine()?r=i:i instanceof Ju||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new vg(s,HX):r||n.push(fa.of(new zv({tagName:s.nodeName.toLowerCase(),attributes:zCe(s)}),s)))}return{line:r,marks:n}}}function rB(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 h5e(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 HX={class:"cm-line"};function f5e(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&FM(n,e),r&&(e.class+=" "+r)),e}function m5e(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 fa&&t.push(r.mark)}return t}function d6(e){let t=ei.get(e);return t&&t.setDOM(e.cloneNode()),e}class xg extends ll{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}}xg.inline=new xg("span");xg.block=new xg("div");const h6=new class extends ll{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class sB{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=vn.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 kS(t,t.contentDOM),this.updateInner([new jl(0,0,0,t.state.doc.length)],null)}update(t){var n;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:h})=>h<this.minWidthFrom||d>this.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let 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:!_5e(t.changes,this.hasComposition)&&!t.selectionSet&&(s=t.state.selection.main.head));let i=s>-1?g5e(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:h}=this.hasComposition;r=new jl(d,h,t.changes.mapPos(d,-1),t.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(rn.ie||rn.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=v5e(o,this.decorations,t.changes);l.length&&(r=jl.extendWithRanges(r,l));let u=w5e(a,this.blockWrappers,t.changes);return u.length&&(r=jl.extendWithRanges(r,u)),i&&!r.some(d=>d.fromA<=i.range.fromA&&d.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 d5e(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&ei.get(n.text)&&a.cache.reused.set(ei.get(n.text),2),this.tile=a.run(t,n),uA(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=rn.chrome||rn.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 f6&&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(BX)&&(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(Pu)||r.tabIndex>-1)&&oy(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,u,d;if(l.empty?d=u=this.inlineDOMNearPos(l.anchor,l.assoc||1):(d=this.inlineDOMNearPos(l.head,l.head==l.from?1:-1),u=this.inlineDOMNearPos(l.anchor,l.anchor==l.from?1:-1)),rn.gecko&&l.empty&&!this.hasComposition&&p5e(u)){let m=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(m,u.node.childNodes[u.offset]||null)),u=d=new Jl(m,0),a=!0}let h=this.view.observer.selectionRange;(a||!h.focusNode||(!ly(u.node,u.offset,h.anchorNode,h.anchorOffset)||!ly(d.node,d.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,l))&&(this.view.observer.ignore(()=>{rn.android&&rn.chrome&&r.contains(h.focusNode)&&k5e(h.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let m=Vy(this.view.root);if(m)if(l.empty){if(rn.gecko){let p=b5e(u.node,u.offset);if(p&&p!=3){let g=(p==1?kX:_X)(u.node,u.offset);g&&(u=new Jl(g.node,g.offset))}}m.collapse(u.node,u.offset),l.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=l.bidiLevel)}else if(m.extend){m.collapse(u.node,u.offset);try{m.extend(d.node,d.offset)}catch{}}else{let p=document.createRange();l.anchor>l.head&&([u,d]=[d,u]),p.setEnd(d.node,d.offset),p.setStart(u.node,u.offset),m.removeAllRanges(),m.addRange(p)}o&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new Jl(h.anchorNode,h.anchorOffset),this.impreciseHead=d.precise?null:new Jl(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&ly(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=Vy(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),u=this.coordsAt(n.head,1);if(!l||!u||l.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(d.node,d.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let h=t.observer.selectionRange;t.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=n.from&&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=ud(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&&!ei.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((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(i=!0)}else{let h=d+u.length;if(d<=t&&(r=u,s=t-d,i=h<t),h>=t&&!o&&(o=u,a=t-d,l=d>t),d>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 f6?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=Ui(i.text,o);if(a==o)return null;let l=Gy(i.dom,o,a).getClientRects();for(let u=0;u<l.length;u++){let d=l[u];if(u==l.length-1||d.top<d.bottom&&d.left<d.right)return d}}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==xs.LTR,u=0,d=(h,m,p)=>{for(let g=0;g<h.children.length&&!(m>s);g++){let b=h.children[g],x=m+b.length,v=b.dom.getBoundingClientRect(),{height:y}=v;if(p&&!g&&(u+=v.top-p.top),b instanceof Ju)x>r&&d(b,m,v);else if(m>=r&&(u>0&&n.push(-u),n.push(y+u),u=0,o)){let w=b.dom.lastChild,k=w?ay(w):[];if(k.length){let T=k[k.length-1],S=l?T.right-v.left:v.right-T.left;S>a&&(a=S,this.minWidth=i,this.minWidthFrom=m,this.minWidthTo=x)}}p&&g==h.children.length-1&&(u+=p.bottom-v.bottom),m=x+b.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?xs.RTL:xs.LTR}measureTextSize(){let t=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let a=0,l;for(let u of o.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=ay(u.dom);if(d.length!=1)return;a+=d[0].width,l=d[0].height}if(a)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:a/o.length,textHeight:l}}});if(t)return t;let n=document.createElement("div"),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=ay(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(vn.replace({widget:new f6(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!i)break;r=i.to+1}return vn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(xS).map(i=>(this.dynamicDecorationMap[t++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(GM).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(_r.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(zX).map(i=>typeof i=="function"?i(this.view):i)}scrollIntoView(t){var n;if(t.isSnapshot){let d=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=d.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let d of this.view.state.facet(OX))try{if(d(this.view,t.range,t))return!0}catch(h){ma(this.view.state,h,"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=KM(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:u}=this.view.scrollDOM;if(HCe(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,u),-u),this.view.textDirection==xs.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 d=this.view.docView.lineAt(r.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(t){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){uA(this.tile)}}function uA(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)uA(r,t)}}function p5e(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 UX(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=kX(n.focusNode,n.focusOffset),s=_X(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let a=ei.get(s.node);if(!a||a.isText()&&a.text!=s.node.nodeValue)i=s;else if(e.docView.lastCompositionAfterCursor){let l=ei.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 g5e(e,t,n){let r=UX(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 jl(l.mapPos(i),l.mapPos(o),i,o),text:s}}function b5e(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 y5e=class{constructor(){this.changes=[]}compareRange(t,n){U0(t,n,this.changes)}comparePoint(t,n){U0(t,n,this.changes)}boundChange(t){U0(t,t,this.changes)}};function v5e(e,t,n){let r=new y5e;return _r.compare(e,t,n,r),r.changes}class x5e{constructor(){this.changes=[]}compareRange(t,n){U0(t,n,this.changes)}comparePoint(){}boundChange(t){U0(t,t,this.changes)}}function w5e(e,t,n){let r=new x5e;return _r.compare(e,t,n,r),r.changes}function k5e(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 _5e(e,t){let n=!1;return t&&e.iterChangedRanges((r,s)=>{r<t.to&&s>t.from&&(n=!0)}),n}class f6 extends ll{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 S5e(e,t,n=1){let r=e.charCategorizer(t),s=e.doc.lineAt(t),i=t-s.from;if(s.length==0)return Xe.cursor(t);i==0?n=1:i==s.length&&(n=-1);let o=i,a=i;n<0?o=Ui(s.text,i,!1):a=Ui(s.text,i);let l=r(s.text.slice(o,a));for(;o>0;){let u=Ui(s.text,o,!1);if(r(s.text.slice(u,o))!=l)break;o=u}for(;a<s.length;){let u=Ui(s.text,a);if(r(s.text.slice(a,u))!=l)break;a=u}return Xe.range(o+s.from,a+s.from)}function C5e(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+J7(o,i,e.state.tabSize)}function dA(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==ao.Text&&(s.type!=i.type||(n<0?i.from<t:i.to>t)))&&(s=i)}}return s||r}return r}function T5e(e,t,n,r){let s=dA(e,t.head,t.assoc||-1),i=!r||s.type!=ao.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==xs.LTR)?o.right-1:o.left+1,y:(i.top+i.bottom)/2});if(l!=null)return Xe.cursor(l,n?-1:1)}return Xe.cursor(n?s.to:s.from,n?-1:1)}function iB(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 u=e5e(s,i,o,a,n),d=EX;if(!u){if(s.number==(n?e.state.doc.lines:1))return a;d=`
`,s=e.state.doc.line(s.number+(n?1:-1)),i=e.bidiSpans(s),u=e.visualLineSide(s,!n)}if(l){if(!l(d))return a}else{if(!r)return u;l=r(d)}a=u}}function A5e(e,t,n){let r=e.state.charCategorizer(t),s=r(n);return i=>{let o=r(i);return s==$s.Space&&(s=o),s==o}}function E5e(e,t,n,r){let s=t.head,i=n?1:-1;if(s==(n?e.state.doc.length:0))return Xe.cursor(s,t.assoc);let o=t.goalColumn,a,l=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(s,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)o==null&&(o=u.left-l.left),a=i<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(l.right-l.left,e.defaultCharacterWidth*(s-g.from))),a=(i<0?g.top:g.bottom)+d}let h=l.left+o,m=e.viewState.heightOracle.textHeight>>1,p=r??m;for(let g=0;;g+=m){let b=a+(p+g)*i,x=hA(e,{x:h,y:b},!1,i);if(n?b>l.bottom:b<l.top)return Xe.cursor(x.pos,x.assoc);let v=e.coordsAtPos(x.pos,x.assoc),y=v?(v.top+v.bottom)/2:0;if(!v||(n?y>a:y<a))return Xe.cursor(x.pos,x.assoc,void 0,o)}}function cy(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 VX(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=cy(e,s.from,0);o!=s.from&&(i=Xe.cursor(o,-1))}else{let o=cy(e,s.from,-1),a=cy(e,s.to,1);(o!=s.from||a!=s.to)&&(i=Xe.range(s.from==s.anchor?o:a,s.from==s.head?o:a))}i&&(n||(n=t.ranges.slice()),n[r]=i)}return n?Xe.create(n,t.mainIndex):t}function m6(e,t,n){let r=cy(e.state.facet(qv).map(s=>s(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Xe.cursor(r,r<n.from?1:-1)}class Pc{constructor(t,n){this.pos=t,this.assoc=n}}function hA(e,t,n,r){let s=e.contentDOM.getBoundingClientRect(),i=s.top+e.viewState.paddingTop,{x:o,y:a}=t,l=a-i,u;for(;;){if(l<0)return new Pc(0,1);if(l>e.viewState.docHeight)return new Pc(e.state.doc.length,-1);if(u=e.elementAtHeight(l),r==null)break;if(u.type==ao.Text){if(r<0?u.to<e.viewport.from:u.from>e.viewport.to)break;let m=e.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(m&&(r<0?m.top<=l+i:m.bottom>=l+i))break}let h=e.viewState.heightOracle.textHeight/2;l=r>0?u.bottom+h:u.top-h}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==ao.Text){let h=C5e(e,s,u,o,a);return new Pc(h,h==u.from?1:-1)}}if(u.type!=ao.Text)return l<(u.top+u.bottom)/2?new Pc(u.from,1):new Pc(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new M5e(e,o,a,e.textDirectionAt(u.from)).scanTile(d,u.from)}class M5e{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[Hc.find(s,t-r.from,-1,n)].level==this.baseDir}dirAt(t,n){let{line:r,spans:s}=this.bidiSpansAt(t);return s[Hc.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,u,d=-1,h=1e9,m;e:for(;s<i;){let g=i-s,b=s+i>>1;t:if(o.has(b)){let v=s+Math.floor(Math.random()*g);for(let y=0;y<g;y++){if(!o.has(v)){b=v;break t}v++,v==i&&(v=s)}break e}o.add(b);let x=n(b);if(x)for(let v=0;v<x.length;v++){let y=x[v],w=0;if(!(y.width==0&&x.length>1)){if(y.bottom<this.y)(!l||l.bottom<y.bottom)&&(l=y),w=1;else if(y.top>this.y)(!u||u.top>y.top)&&(u=y),w=-1;else{let k=y.left>this.x?this.x-y.left:y.right<this.x?this.x-y.right:0,T=Math.abs(k);T<h&&(d=b,h=T,m=y),k&&(w=k<0==(this.baseDir==xs.LTR)?-1:1)}w==-1&&(!a||this.baseDirAt(t[b],1))?i=b:w==1&&(!a||this.baseDirAt(t[b+1],-1))&&(s=b+1)}}}if(!m){if(!u&&!l)return{i:t[0],after:!1};let g=l&&(!u||this.y-l.bottom<u.top-this.y)?l:u;return this.y=(g.top+g.bottom)/2,this.scan(t,n,!0)}if(h&&!r){let{top:g,bottom:b}=m;if(l&&l.bottom>(g+g+b)/3)return this.y=l.bottom-1,this.scan(t,n,!0);if(u&&u.top<(g+b+b)/3)return this.y=u.top+1,this.scan(t,n,!0)}let p=(a?this.dirAt(t[d],1):this.baseDir)==xs.LTR;return{i:d,after:this.x>(m.left+m.right)/2==p}}scanText(t,n){let r=[];for(let i=0;i<t.length;i=Ui(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 Gy(t.dom,o,a).getClientRects()});return s.after?new Pc(r[s.i+1],-1):new Pc(r[s.i],1)}scanTile(t,n){if(!t.length)return new Pc(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:Gy(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 Pc(r[s.i+1],-1):new Pc(o,1)}}const o0="";class N5e{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(Ir.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=o0}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=ei.get(s),a=s.nextSibling;if(a==n){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=ei.get(a);(o&&l?o.breakAfter:(o?o.breakAfter:v_(s))||v_(a)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>i)&&!I5e(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=ei.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+(j5e(t,r.node,r.offset)?n:0))}}function j5e(e,t,n){for(;;){if(!t||n<ud(t))return!1;if(t==e)return!0;n=nf(t)+1,t=t.parentNode}}function I5e(e,t){let n;for(;!(e==t||!e);e=e.nextSibling){let r=ei.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 oB{constructor(t,n){this.node=t,this.offset=n,this.pos=-1}}class R5e{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=WX(t.docView.tile,n,r,0))){let l=i||o?[]:L5e(t),u=new N5e(l,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=P5e(l,this.bounds.from)}else{let l=t.observer.selectionRange,u=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!iA(t.contentDOM,l.focusNode)?a.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),d=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!iA(t.contentDOM,l.anchorNode)?a.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),h=t.viewport;if((rn.ios||rn.chrome)&&a.main.empty&&u!=d&&(h.from>0||h.to<t.state.doc.length)){let m=Math.min(u,d),p=Math.max(u,d),g=h.from-m,b=h.to-p;(g==0||g==1||m==0)&&(b==0||b==-1||p==t.state.doc.length)&&(u=0,d=t.state.doc.length)}if(t.inputState.composing>-1&&a.ranges.length>1)this.newSel=a.replaceRange(Xe.range(d,u));else if(t.lineWrapping&&d==u&&!(a.main.empty&&a.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let m=t.coordsAtPos(u,-1),p=0;m&&(p=t.inputState.lastTouchY<=m.bottom?-1:1),this.newSel=Xe.create([Xe.cursor(u,p)])}else this.newSel=Xe.single(d,u)}}}function WX(e,t,n,r){if(e.isComposite()){let s=-1,i=-1,o=-1,a=-1;for(let l=0,u=r,d=r;l<e.children.length;l++){let h=e.children[l],m=u+h.length;if(u<t&&m>n)return WX(h,t,n,u);if(m>=t&&s==-1&&(s=l,i=u),u>n&&h.dom.parentNode==e.dom){o=l,a=d;break}d=m,u=m+h.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 GX(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,u=i.from,d=null;(o===8||rn.android&&t.text.length<l-a)&&(u=i.to,d="end");let h=s.doc.sliceString(a,l,o0),m,p;!i.empty&&i.from>=a&&i.to<=l&&(t.typeOver||h!=t.text)&&h.slice(0,i.from-a)==t.text.slice(0,i.from-a)&&h.slice(i.to-a)==t.text.slice(m=t.text.length-(h.length-(i.to-a)))?n={from:i.from,to:i.to,insert:Wr.of(t.text.slice(i.from-a,m).split(o0))}:(p=KX(h,t.text,u-a,d))&&(rn.chrome&&o==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==o0+o0&&p.toB--,n={from:a+p.from,to:a+p.toA,insert:Wr.of(t.text.slice(p.from,p.toB).split(o0))})}else r&&(!e.hasFocus&&s.facet(Pu)||__(r,i))&&(r=null);if(!n&&!r)return!1;if((rn.mac||rn.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=Xe.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Wr.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)}:rn.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==`
 `&&e.lineWrapping&&(r&&(r=Xe.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:Wr.of([" "])}),n)return YM(e,n,r,o);if(r&&!__(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=VX(s.facet(qv).map(u=>u(e)),r))),e.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function YM(e,t,n,r=-1){if(rn.ios&&e.inputState.flushIOSKey(t))return!0;let s=e.state.selection.main;if(rn.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&&V0(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)&&V0(e.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&V0(e.contentDOM,"Delete",46)))return!0;let i=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,a=()=>o||(o=D5e(e,t,n));return e.state.facet(RX).some(l=>l(e,t.from,t.to,i,a))||e.dispatch(a()),!0}function D5e(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,u=l<0?i.from:i.to,d=cy(s.facet(qv).map(h=>h(e)),u,l);t.from==d&&(o=d)}if(o>-1)r={changes:t,selection:Xe.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):"",u=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)+u))}else{let l=s.changes(t),u=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 d=e.state.sliceDoc(t.from,t.to),h,m=n&&UX(e,n.main.head);if(m){let g=t.insert.length-(t.to-t.from);h={from:m.from,to:m.to-g}}else h=e.state.doc.lineAt(i.head);let p=i.to-t.to;r=s.changeByRange(g=>{if(g.from==i.from&&g.to==i.to)return{changes:l,range:u||g.map(l)};let b=g.to-p,x=b-d.length;if(e.state.sliceDoc(x,b)!=d||b>=h.from&&x<=h.to)return{range:g};let v=s.changes({from:x,to:b,insert:t.insert}),y=g.to-i.to;return{changes:v,range:u?Xe.range(Math.max(0,u.anchor+y),Math.max(0,u.head+y)):g.map(v)}})}else r={changes:l,selection:u&&s.selection.replaceRange(u)}}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 KX(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 L5e(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 oB(n,r)),(s!=n||i!=r)&&t.push(new oB(s,i))),t}function P5e(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?Xe.single(n+t,r+t):null}function __(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class O5e{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,rn.safari&&t.contentDOM.addEventListener("input",()=>null),rn.gecko&&J5e(t.contentDOM.ownerDocument)}handleEvent(t){!V5e(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=B5e(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&&XX.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),rn.android&&rn.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let n;return rn.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&!t.shiftKey&&((n=YX.find(r=>r.keyCode==t.keyCode))&&!t.ctrlKey||$5e.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,V0(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:rn.safari&&!rn.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 aB(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(s){ma(n.state,s)}}}function B5e(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(aB(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(aB(r.value,l))}}for(let r in tc)n(r).handlers.push(tc[r]);for(let r in wa)n(r).observers.push(wa[r]);return t}const YX=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],$5e="dthko",XX=[16,17,18,20,91,92,224,225],xw=6;function ww(e){return Math.max(0,e)*.7+8}function z5e(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class F5e{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=vX(t.contentDOM),this.atoms=t.state.facet(qv).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(Ir.allowMultipleSelections)&&q5e(t,n),this.dragging=U5e(t,n)&&ZX(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&&z5e(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=KM(this.view);t.clientX-l.left<=s+xw?n=-ww(s-t.clientX):t.clientX+l.right>=o-xw&&(n=ww(t.clientX-o)),t.clientY-l.top<=i+xw?r=-ww(i-t.clientY):t.clientY+l.bottom>=a-xw&&(r=ww(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=VX(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 q5e(e,t){let n=e.state.facet(MX);return n.length?n[0](t):rn.mac?t.metaKey:t.ctrlKey}function H5e(e,t){let n=e.state.facet(NX);return n.length?n[0](t):rn.mac?!t.altKey:!t.ctrlKey}function U5e(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Vy(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 V5e(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=ei.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const tc=Object.create(null),wa=Object.create(null),QX=rn.ie&&rn.ie_version<15||rn.ios&&rn.webkit_version<604;function W5e(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(),JX(e,n.value)},50)}function _S(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function JX(e,t){t=_S(e.state,UM,t);let{state:n}=e,r,s=1,i=n.toText(t),o=i.lines==n.selection.ranges.length;if(fA!=null&&n.selection.ranges.every(l=>l.empty)&&fA==i.toString()){let l=-1;r=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==l)return{range:u};l=d.from;let h=n.toText((o?i.line(s++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:h},range:Xe.cursor(u.from+h.length)}})}else o?r=n.changeByRange(l=>{let u=i.line(s++);return{changes:{from:l.from,to:l.to,insert:u.text},range:Xe.cursor(l.from+u.length)}}):r=n.replaceSelection(i);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}wa.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};wa.wheel=wa.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};tc.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);wa.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")};wa.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};tc.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(jX))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=K5e(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new F5e(e,t,n,r)),r&&e.observer.ignore(()=>{xX(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 lB(e,t,n,r){if(r==1)return Xe.cursor(t,n);if(r==2)return S5e(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++,Xe.range(o,a)}}const G5e=rn.ie&&rn.ie_version<=11;let cB=null,uB=0,dB=0;function ZX(e){if(!G5e)return e.detail;let t=cB,n=dB;return cB=e,dB=Date.now(),uB=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(uB+1)%3:1}function K5e(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=ZX(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),u,d=lB(e,l.pos,l.assoc,r);if(n.pos!=l.pos&&!o){let h=lB(e,n.pos,n.assoc,r),m=Math.min(h.from,d.from),p=Math.max(h.to,d.to);d=m<d.from?Xe.range(m,p,d.assoc):Xe.range(p,m,d.assoc)}return o?s.replaceRange(s.main.extend(d.from,d.to,d.assoc)):a&&r==1&&s.ranges.length>1&&(u=Y5e(s,l.pos))?u:a?s.addRange(d):Xe.create([d])}}}function Y5e(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 Xe.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}tc.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=Xe.range(i,o))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",_S(e.state,VM,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};tc.dragend=e=>(e.inputState.draggedContent=null,!1);function hB(e,t,n,r){if(n=_S(e.state,UM,n),!n)return;let s=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:i}=e.inputState,o=r&&i&&H5e(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}tc.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&&hB(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 hB(e,t,r,!0),!0}return!1};tc.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=QX?null:t.clipboardData;return n?(JX(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(W5e(e),!1)};function X5e(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 Q5e(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:_S(e,VM,t.join(e.lineBreak)),ranges:n,linewise:r}}let fA=null;tc.copy=tc.cut=(e,t)=>{if(!oy(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=Q5e(e.state);if(!n&&!s)return!1;fA=s?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=QX?null:t.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(X5e(e,n),!1)};const eQ=_d.define();function tQ(e,t){let n=[];for(let r of e.facet(DX)){let s=r(e,t);s&&n.push(s)}return n.length?e.update({effects:n,annotations:eQ.of(!0)}):null}function nQ(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=tQ(e.state,t);n?e.dispatch(n):e.update([])}},10)}wa.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),nQ(e)};wa.blur=e=>{e.observer.clearSelectionRange(),nQ(e)};wa.compositionstart=wa.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};wa.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,rn.chrome&&rn.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};wa.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};tc.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),u=e.posAtDOM(a.endContainer,a.endOffset);return YM(e,{from:l,to:u,insert:e.state.toText(i)},null),!0}}let s;if(rn.chrome&&rn.android&&(s=YX.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 rn.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),rn.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>wa.compositionend(e,t),20),!1};const fB=new Set;function J5e(e){fB.has(e)||(fB.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const mB=["pre-wrap","normal","pre-line","break-spaces"];let wg=!1;function pB(){wg=!1}class Z5e{constructor(t){this.lineWrapping=t,this.doc=Wr.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 mB.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=mB.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 u=0;u<o.length;u++){let d=o[u];d<0?u++:this.heightSamples[Math.floor(d*10)]=!0}}return l}}class e6e{constructor(t,n){this.from=t,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Ql{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"?ao.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 Gm?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 Ql(this.from,this.length+t.length,this.top,this.height+t.height,n)}}var Ts=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(Ts||(Ts={}));const Fk=.001;class Uo{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)>Fk&&(wg=!0),this.height=t)}replace(t,n,r){return Uo.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:u,fromB:d,toB:h}=s[a],m=i.lineAt(l,Ts.ByPosNoHeight,r.setDoc(n),0,0),p=m.to>=u?m:i.lineAt(u,Ts.ByPosNoHeight,r,0,0);for(h+=p.to-u,u=p.to;a>0&&m.from<=s[a-1].toA;)l=s[a-1].fromA,d=s[a-1].fromB,a--,l<m.from&&(m=i.lineAt(l,Ts.ByPosNoHeight,r,0,0));d+=m.from-l,l=m.from;let g=XM.build(r.setDoc(o),t,d,h);i=S_(i,i.replace(l,u,g))}return i.updateHeight(r,0)}static empty(){return new Oa(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 n6e(Uo.of(t.slice(0,n)),o,Uo.of(t.slice(r)))}}function S_(e,t){return e==t?e:(e.constructor!=t.constructor&&(wg=!0),t)}Uo.prototype.size=1;const t6e=vn.replace({});class rQ extends Uo{constructor(t,n,r){super(t,n),this.deco=r,this.spaceAbove=0}mainBlock(t,n){return new Ql(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 Ql(s,0,r,this.spaceAbove,t6e):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,Ts.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 Oa extends rQ{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 Ql(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 Oa||s instanceof Ji&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Ji?s=new Oa(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Uo.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 Ji extends Uo{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 u=s+(t<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length)),d=n.doc.lineAt(u),h=a+d.length*l,m=Math.max(r,t-h/2);return new Ql(d.from,d.length,m,h,0)}else{let u=Math.max(0,Math.min(o-i,Math.floor((t-r)/a))),{from:d,length:h}=n.doc.line(i+u);return new Ql(d,h,r+a*u,a,0)}}lineAt(t,n,r,s,i){if(n==Ts.ByHeight)return this.blockAt(t,r,s,i);if(n==Ts.ByPosNoHeight){let{from:p,to:g}=r.doc.lineAt(t);return new Ql(p,g-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,i),u=r.doc.lineAt(t),d=a+u.length*l,h=u.number-o,m=s+a*h+l*(u.from-i-h);return new Ql(u.from,u.length,Math.max(s,Math.min(m,s+this.height-d)),d,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:u}=this.heightMetrics(r,i);for(let d=t,h=s;d<=n;){let m=r.doc.lineAt(d);if(d==t){let g=m.number-a;h+=l*g+u*(t-i-g)}let p=l+u*m.length;o(new Ql(m.from,m.length,h,p,0)),h+=p,d=m.to+1}}replace(t,n,r){let s=this.length-n;if(s>0){let i=r[r.length-1];i instanceof Ji?r[r.length-1]=new Ji(i.length+s):r.push(null,new Ji(s-1))}if(t>0){let i=r[0];i instanceof Ji?r[0]=new Ji(t+i.length):r.unshift(new Ji(t-1),null)}return Uo.of(r)}decomposeLeft(t,n){n.push(new Ji(t-1),null)}decomposeRight(t,n){n.push(null,new Ji(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 Ji(s.from-n-1).updateHeight(t,n));a<=i&&s.more;){let d=t.doc.lineAt(a).length;o.length&&o.push(null);let h=s.heights[s.index++],m=0;h<0&&(m=-h,h=s.heights[s.index++]),l==-1?l=h:Math.abs(h-l)>=Fk&&(l=-2);let p=new Oa(d,h,m);p.outdated=!1,o.push(p),a+=d+1}a<=i&&o.push(null,new Ji(i-a).updateHeight(t,a));let u=Uo.of(o);return(l<0||Math.abs(u.height-this.height)>=Fk||Math.abs(l-this.heightMetrics(t,n).perLine)>=Fk)&&(wg=!0),S_(this,u)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class n6e extends Uo{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==Ts.ByHeight?t<o:t<a,u=l?this.left.lineAt(t,n,r,s,i):this.right.lineAt(t,n,r,o,a);if(this.break||(l?u.to<a:u.from>a))return u;let d=n==Ts.ByPosNoHeight?Ts.ByPosNoHeight:Ts.ByPos;return l?u.join(this.right.lineAt(a,d,r,o,a)):this.left.lineAt(a,d,r,s,i).join(u)}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 u=this.lineAt(l,Ts.ByPos,r,s,i);t<u.from&&this.left.forEachLine(t,u.from-1,r,s,i,o),u.to>=t&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.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&&gB(i,o-1),n<this.length){let a=i.length;this.decomposeRight(n,i),gB(i,a)}return Uo.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?Uo.of(this.break?[t,null,n]:[t,n]):(this.left=S_(this.left,t),this.right=S_(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 gB(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Ji&&(r=e[t+1])instanceof Ji&&e.splice(t-1,3,new Ji(n.length+1+r.length))}const r6e=5;class XM{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 Oa?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Oa(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 rQ(o,s,r)):(o||i||s>=r6e)&&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 Oa(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new Ji(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 Oa)return t;let n=new Oa(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 Oa)&&!this.isCovered?this.nodes.push(new Oa(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 Oa&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(t,n,r,s){let i=new XM(r,t);return _r.spans(n,r,s,i,0),i.finish(r)}}function s6e(e,t,n){let r=new i6e;return _r.compare(e,t,n,r,0),r.changes}class i6e{constructor(){this.changes=[]}compareRange(){}comparePoint(t,n,r,s){(t<n||r&&r.heightRelevant||s&&s.heightRelevant)&&U0(t,n,this.changes,5)}}function o6e(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 u=e.parentNode;u&&u!=r.body;)if(u.nodeType==1){let d=u,h=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&h.overflow!="visible"){let m=d.getBoundingClientRect();i=Math.max(i,m.left),o=Math.min(o,m.right),a=Math.max(a,m.top),l=Math.min(u==e.parentNode?s.innerHeight:l,m.bottom)}u=h.position=="absolute"||h.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.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 a6e(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 l6e(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class p6{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 vn.replace({widget:new c6e(this.displaySize*(n?t.scaleY:t.scaleX),n)}).range(this.from,this.to)}}class c6e extends ll{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 bB{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=yB,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=xs.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(WM).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new Z5e(r),this.stateDeco=vB(n),this.heightMap=Uo.empty().applyChanges(this.stateDeco,Wr.empty,this.heightOracle.setDoc(n.doc),[new jl(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=vn.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 kw(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?yB:new QM(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(wb(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=vB(this.state);let s=t.changedRanges,i=jl.extendWithRanges(s,s6e(r,this.stateDeco,t?t.changes:Ti.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);pB(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=o||wg)&&(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 u=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,t.flags|=this.updateForViewport(),(u||!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(PX)&&(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"?xs.RTL:xs.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 u=0,d=0;if(a.width&&a.height){let{scaleX:T,scaleY:S}=yX(n,a);(T>.005&&Math.abs(this.scaleX-T)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=T,this.scaleY=S,u|=16,o=l=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,m=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=m)&&(this.paddingTop=h,this.paddingBottom=m,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let p=vX(this.view.contentDOM,!1).y;p!=this.scrollParent&&(this.scrollParent=p,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=wX(this.scrollParent||t.win);let b=(this.printing?l6e:o6e)(n,this.paddingTop),x=b.top-this.pixelViewport.top,v=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(l=!0)),!this.inView&&!this.scrollTarget&&!a6e(t.dom))return 0;let w=a.width;if((this.contentDOMWidth!=w||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),l){let T=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(o=!0),o||s.lineWrapping&&Math.abs(w-this.contentDOMWidth)>s.charWidth){let{lineHeight:S,charWidth:C,textHeight:_}=t.docView.measureTextSize();o=S>0&&s.refresh(i,S,C,_,Math.max(5,w/C),T),o&&(t.docView.minWidth=0,u|=16)}x>0&&v>0?d=Math.max(x,v):x<0&&v<0&&(d=Math.min(x,v)),pB();for(let S of this.viewports){let C=S.from==this.viewport.from?T:t.docView.measureVisibleLineHeights(S);this.heightMap=(o?Uo.empty().applyChanges(this.stateDeco,Wr.empty,this.heightOracle,[new jl(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new e6e(S.from,C))}wg&&(u|=2)}let k=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}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 kw(s.lineAt(o-r*1e3,Ts.ByHeight,i,0,0).from,s.lineAt(a+(1-r)*1e3,Ts.ByHeight,i,0,0).to);if(n){let{head:u}=n.range;if(u<l.from||u>l.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=s.lineAt(u,Ts.ByPos,i,0,0),m;n.y=="center"?m=(h.top+h.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u<l.from?m=h.top:m=h.bottom-d,l=new kw(s.lineAt(m-1e3/2,Ts.ByHeight,i,0,0).from,s.lineAt(m+d+1e3/2,Ts.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 kw(this.heightMap.lineAt(r,Ts.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Ts.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,Ts.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,Ts.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 p6(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!=xs.LTR&&!r)return[];let a=[],l=(d,h,m,p)=>{if(h-d<i)return;let g=this.state.selection.main,b=[g.from];g.empty||b.push(g.to);for(let v of b)if(v>d&&v<h){l(d,v-10,m,p),l(v+10,h,m,p);return}let x=d6e(t,v=>v.from>=m.from&&v.to<=m.to&&Math.abs(v.from-d)<i&&Math.abs(v.to-h)<i&&!b.some(y=>v.from<y&&v.to>y));if(!x){if(h<m.to&&n&&r&&n.visibleRanges.some(w=>w.from<=h&&w.to>=h)){let w=n.moveToLineBoundary(Xe.cursor(h),!1,!0).head;w>d&&(h=w)}let v=this.gapSize(m,d,h,p),y=r||v<2e6?v:2e6;x=new p6(d,h,v,y)}a.push(x)},u=d=>{if(d.length<o||d.type!=ao.Text)return;let h=u6e(d.from,d.to,this.stateDeco);if(h.total<o)return;let m=this.scrollTarget?this.scrollTarget.range.head:null,p,g;if(r){let b=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,x,v;if(m!=null){let y=Sw(h,m),w=((this.visibleBottom-this.visibleTop)/2+b)/d.height;x=y-w,v=y+w}else x=(this.visibleTop-d.top-b)/d.height,v=(this.visibleBottom-d.top+b)/d.height;p=_w(h,x),g=_w(h,v)}else{let b=h.total*this.heightOracle.charWidth,x=s*this.heightOracle.charWidth,v=0;if(b>2e6)for(let S of t)S.from>=d.from&&S.from<d.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=S.size-S.displaySize);let y=this.pixelViewport.left+v,w=this.pixelViewport.right+v,k,T;if(m!=null){let S=Sw(h,m),C=((w-y)/2+x)/b;k=S-C,T=S+C}else k=(y-x)/b,T=(w+x)/b;p=_w(h,k),g=_w(h,T)}p>d.from&&l(d.from,p,d,h),g<d.to&&l(g,d.to,d,h)};for(let d of this.viewportLines)Array.isArray(d.type)?d.type.forEach(u):u(d);return a}gapSize(t,n,r,s){let i=Sw(s,r)-Sw(s,n);return this.heightOracle.lineWrapping?t.height*i:s.total*this.heightOracle.charWidth*i}updateLineGaps(t){p6.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=vn.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=[];_r.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)||wb(this.heightMap.lineAt(t,Ts.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)||wb(this.heightMap.lineAt(this.scaler.fromDOM(t),Ts.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 wb(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 kw{constructor(t,n){this.from=t,this.to=n}}function u6e(e,t,n){let r=[],s=e,i=0;return _r.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 _w({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 Sw(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 d6e(e,t){for(let n of e)if(t(n))return n}const yB={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function vB(e){let t=e.facet(xS).filter(r=>typeof r!="function"),n=e.facet(GM).filter(r=>typeof r!="function");return n.length&&t.push(_r.join(n)),t}class QM{constructor(t,n,r){let s=0,i=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let u=n.lineAt(a,Ts.ByPos,t,0,0).top,d=n.lineAt(l,Ts.ByPos,t,0,0).bottom;return s+=d-u,{from:a,to:l,top:u,bottom:d,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 QM?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 wb(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Ql(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(s=>wb(s,t)):e._content)}const Cw=sn.define({combine:e=>e.join(" ")}),mA=sn.define({combine:e=>e.indexOf(!0)>-1}),pA=ef.newName(),sQ=ef.newName(),iQ=ef.newName(),oQ={"&light":"."+sQ,"&dark":"."+iQ};function gA(e,t,n){return new ef(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 h6e=gA("."+pA,{"&":{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"}},oQ),f6e={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},g6=rn.ie&&rn.ie_version<=11;class m6e{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new UCe,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);(rn.ie&&rn.ie_version<=11||rn.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&&rn.android&&t.constructor.EDIT_CONTEXT!==!1&&!(rn.chrome&&rn.chrome_version<126)&&(this.editContext=new g6e(t),t.state.facet(Pu)&&(t.contentDOM.editContext=this.editContext.editContext)),g6&&(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(Pu)?r.root.activeElement!=this.dom:!oy(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}(rn.ie&&rn.ie_version<=11||rn.android&&rn.chrome)&&!r.state.selection.main.empty&&s.focusNode&&ly(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=Vy(t.root);if(!n)return!1;let r=rn.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&p6e(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=oy(this.dom,r);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&WCe(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,f6e),g6&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),g6&&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&&V0(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&&oy(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 R5e(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=GX(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!__(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=xB(n,t.previousSibling||t.target.previousSibling,-1),s=xB(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(Pu)!=t.state.facet(Pu)&&(t.view.contentDOM.editContext=t.state.facet(Pu)?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 xB(e,t,n){for(;t;){let r=ei.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 wB(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 ly(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function p6e(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return wB(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?wB(e,n):null}class g6e{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 u=l-a>r.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let d=KX(t.state.sliceDoc(a,l),r.text,(u?s.from:s.to)-a,u?"end":null);if(!d){let m=Xe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));__(m,s)||t.dispatch({selection:m,userEvent:"select"});return}let h={from:d.from+a,to:d.toA+a,insert:Wr.of(r.text.slice(d.from,d.toB).split(`
`))};if((rn.mac||rn.android)&&h.from==o-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Wr.of([r.text.replace("."," ")])}),this.pendingContextChange=h,!t.state.readOnly){let m=this.to-this.from+(h.to-h.from+h.insert.length);YM(t,h,Xe.single(this.toEditorPos(r.selectionStart,m),this.toEditorPos(r.selectionEnd,m)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),h.from<h.to&&!h.insert.length&&t.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,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),u=this.toEditorPos(i.rangeEnd);if(l<u){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;s.push(vn.mark({attributes:{style:d}}).range(l,u))}}}t.dispatch({effects:BX.of(vn.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=Vy(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,u)=>{if(r)return;let d=u.length-(o-i);if(s&&o>=s.to)if(s.from==i&&s.to==o&&s.insert.eq(u)){s=this.pendingContextChange=null,n+=d,this.to+=d;return}else s=null,this.revertPending(t.state);if(i+=n,o+=n,o<=this.from)this.from+=d,this.to+=d;else if(i<this.to){if(i<this.from||o>this.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(o),u.toString()),this.to+=d}n+=d}),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 It{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||VCe(t.parent)||document,this.viewState=new bB(this,t.state||Ir.create(t)),t.scrollTo&&t.scrollTo.is(vw)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(k0).map(s=>new u6(s));for(let s of this.plugins)s.update(this);this.observer=new m6e(this),this.inputState=new O5e(this),this.inputState.ensureHandlers(this.plugins),this.docView=new sB(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 Ei?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 m of t){if(m.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=m.state}if(this.destroyed){this.viewState.state=i;return}let o=this.hasFocus,a=0,l=null;t.some(m=>m.annotation(eQ))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=tQ(i,o),l||(a=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(d=null)):this.observer.clear(),i.facet(Ir.phrases)!=this.state.facet(Ir.phrases))return this.setState(i);s=x_.create(this,i,t),s.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let m of t){if(h&&(h=h.map(m.changes)),m.scrollIntoView){let{main:p}=m.state.selection,{x:g,y:b}=this.state.facet(It.cursorScrollMargin);h=new W0(p.empty?p:Xe.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",b,g)}for(let p of m.effects)p.is(vw)&&(h=p.value.clip(this.state))}this.viewState.update(s,h),this.bidiCache=C_.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(xb)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(m=>m.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Cw)!=s.state.facet(Cw)&&(this.viewState.mustMeasureContent=!0),(n||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let m of this.state.facet(cA))try{m(s)}catch(p){ma(this.state,p,"update listener")}(l||d)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),d&&!GX(this,d)&&u.force&&V0(this.contentDOM,u.key,u.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 bB(this,t),this.plugins=t.facet(k0).map(r=>new u6(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new sB(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(k0),r=t.state.facet(k0);if(n!=r){let s=[];for(let i of r){let o=n.indexOf(i);if(o<0)s.push(new u6(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){ma(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(wX(r||this.win))i=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(s);i=p.from,o=p.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 u=[];l&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(p=>{try{return p.read(this)}catch(g){return ma(this.state,g),kB}}),h=x_.create(this,this.state,[]),m=!1;h.flags|=l,n?n.flags|=l:n=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),m=this.docView.update(h),m&&this.docViewUpdate());for(let p=0;p<u.length;p++)if(d[p]!=kB)try{let g=u[p];g.write&&g.write(d[p],this)}catch(g){ma(this.state,g)}if(m&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let g=((i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-o)/this.scaleY;if((g>1||g<-1)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+g,r?r.scrollTop+=g:this.win.scrollBy(0,g),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(cA))a(n)}get themeClasses(){return pA+" "+(this.state.facet(mA)?iQ:sQ)+" "+this.state.facet(Cw)}updateAttrs(){let t=_B(this,$X,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Pu)?"true":"false",class:"cm-content",style:`${rn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),_B(this,WM,n);let r=this.observer.ignore(()=>{let s=JO(this.contentDOM,this.contentAttrs,n),i=JO(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(It.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(xb);let t=this.state.facet(It.cspNonce);ef.mount(this.root,this.styleModules.concat(h6e).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 m6(this,t,iB(this,t,n,r))}moveByGroup(t,n){return m6(this,t,iB(this,t,n,r=>A5e(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 Xe.cursor(i.side(n,s)+t.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(t,n,r=!0){return T5e(this,t,n,r)}moveVertically(t,n,r){return m6(this,t,E5e(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=hA(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),hA(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[Hc.find(i,t-s.from,-1,n)];return Wy(r,o.dir==xs.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(LX)||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>b6e)return AX(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||TX(i.isolates,r=tB(this,t))))return i.order;r||(r=tB(this,t));let s=ZCe(t.text,n,r);return this.bidiCache.push(new C_(t.from,t.to,n,r,!0,s)),s}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||rn.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{xX(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 vw.of(new W0(typeof t=="number"?Xe.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 vw.of(new W0(Xe.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 Fs.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Fs.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=ef.newName(),s=[Cw.of(r),xb.of(gA(`.${r}`,t))];return n&&n.dark&&s.push(mA.of(!0)),s}static baseTheme(t){return vf.lowest(xb.of(gA("."+pA,t,oQ)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),s=r&&ei.get(r)||ei.get(t);return((n=s==null?void 0:s.root)===null||n===void 0?void 0:n.view)||null}}It.styleModule=xb;It.inputHandler=RX;It.clipboardInputFilter=UM;It.clipboardOutputFilter=VM;It.scrollHandler=OX;It.focusChangeEffect=DX;It.perLineTextDirection=LX;It.exceptionSink=IX;It.updateListener=cA;It.editable=Pu;It.mouseSelectionStyle=jX;It.dragMovesSelection=NX;It.clickAddsSelectionRange=MX;It.decorations=xS;It.blockWrappers=zX;It.outerDecorations=GM;It.atomicRanges=qv;It.bidiIsolatedRanges=FX;It.cursorScrollMargin=sn.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}}});It.scrollMargins=qX;It.darkTheme=mA;It.cspNonce=sn.define({combine:e=>e.length?e[0]:""});It.contentAttributes=WM;It.editorAttributes=$X;It.lineWrapping=It.contentAttributes.of({class:"cm-lineWrapping"});It.announce=Yn.define();const b6e=4096,kB={};class C_{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:xs.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 C_(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function _B(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&&FM(o,n)}return n}const y6e=rn.mac?"mac":rn.windows?"win":rn.linux?"linux":"key";function v6e(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 u=n[l];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))s=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))o=!0;else if(/^mod$/i.test(u))t=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return s&&(r="Alt-"+r),i&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Tw(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 x6e=vf.default(It.domEventHandlers({keydown(e,t){return lQ(aQ(t.state),e,t,"editor")}})),kg=sn.define({enables:x6e}),SB=new WeakMap;function aQ(e){let t=e.facet(kg),n=SB.get(t);return n||SB.set(t,n=_6e(t.reduce((r,s)=>r.concat(s),[]))),n}function w6e(e,t,n){return lQ(aQ(e.state),t,e,n)}let mh=null;const k6e=4e3;function _6e(e,t=y6e){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,u,d)=>{var h,m;let p=n[o]||(n[o]=Object.create(null)),g=a.split(/ (?!$)/).map(v=>v6e(v,t));for(let v=1;v<g.length;v++){let y=g.slice(0,v).join(" ");s(y,!0),p[y]||(p[y]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=mh={view:w,prefix:y,scope:o};return setTimeout(()=>{mh==k&&(mh=null)},k6e),!0}]})}let b=g.join(" ");s(b,!1);let x=p[b]||(p[b]={preventDefault:!1,stopPropagation:!1,run:((m=(h=p._any)===null||h===void 0?void 0:h.run)===null||m===void 0?void 0:m.slice())||[]});l&&x.run.push(l),u&&(x.preventDefault=!0),d&&(x.stopPropagation=!0)};for(let o of e){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of a){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let m in d)d[m].run.push(p=>h(p,bA))}let l=o[t]||o.key;if(l)for(let u of a)i(u,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&i(u,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let bA=null;function lQ(e,t,n,r){bA=t;let s=BCe(t),i=ha(s,0),o=Lc(i)==s.length&&s!=" ",a="",l=!1,u=!1,d=!1;mh&&mh.view==n&&mh.scope==r&&(a=mh.prefix+" ",XX.indexOf(t.keyCode)<0&&(u=!0,mh=null));let h=new Set,m=x=>{if(x){for(let v of x.run)if(!h.has(v)&&(h.add(v),v(n)))return x.stopPropagation&&(d=!0),!0;x.preventDefault&&(x.stopPropagation&&(d=!0),u=!0)}return!1},p=e[r],g,b;return p&&(m(p[a+Tw(s,t,!o)])?l=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(rn.windows&&t.ctrlKey&&t.altKey)&&!(rn.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=tf[t.keyCode])&&g!=s?(m(p[a+Tw(g,t,!0)])||t.shiftKey&&(b=Hy[t.keyCode])!=s&&b!=g&&m(p[a+Tw(b,t,!1)]))&&(l=!0):o&&t.shiftKey&&m(p[a+Tw(s,t,!0)])&&(l=!0),!l&&m(p._any)&&(l=!0)),u&&(l=!0),l&&d&&t.stopPropagation(),bA=null,l}class Pm{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=cQ(t);return[new Pm(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return S6e(t,n,r)}}function cQ(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==xs.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function CB(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 S6e(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==xs.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=cQ(e),u=o.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),h=a.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),m=a.right-(d?parseInt(d.paddingRight):0),p=dA(e,r,1),g=dA(e,s,-1),b=p.type==ao.Text?p:null,x=g.type==ao.Text?g:null;if(b&&(e.lineWrapping||p.widgetLineBreaks)&&(b=CB(e,r,1,b)),x&&(e.lineWrapping||g.widgetLineBreaks)&&(x=CB(e,s,-1,x)),b&&x&&b.from==x.from&&b.to==x.to)return y(w(n.from,n.to,b));{let T=b?w(n.from,null,b):k(p,!1),S=x?w(null,n.to,x):k(g,!0),C=[];return(b||p).to<(x||g).from-(b&&x?1:0)||p.widgetLineBreaks>1&&T.bottom+e.defaultLineHeight/2<S.top?C.push(v(h,T.bottom,m,S.top)):T.bottom<S.top&&e.elementAtHeight((T.bottom+S.top)/2).type==ao.Text&&(T.bottom=S.top=(T.bottom+S.top)/2),y(T).concat(C).concat(y(S))}function v(T,S,C,_){return new Pm(t,T-l.left,S-l.top,Math.max(0,C-T),_-S)}function y({top:T,bottom:S,horizontal:C}){let _=[];for(let A=0;A<C.length;A+=2)_.push(v(C[A],T,C[A+1],S));return _}function w(T,S,C){let _=1e9,A=-1e9,M=[];function L(B,$,P,K,F){let H=e.coordsAtPos(B,B==C.to?-2:2),D=e.coordsAtPos(P,P==C.from?2:-2);!H||!D||(_=Math.min(H.top,D.top,_),A=Math.max(H.bottom,D.bottom,A),F==xs.LTR?M.push(i&&$?h:H.left,i&&K?m:D.right):M.push(!i&&K?h:D.left,!i&&$?m:H.right))}let N=T??C.from,O=S??C.to;for(let B of e.visibleRanges)if(B.to>N&&B.from<O)for(let $=Math.max(B.from,N),P=Math.min(B.to,O);;){let K=e.state.doc.lineAt($);for(let F of e.bidiSpans(K)){let H=F.from+K.from,D=F.to+K.from;if(H>=P)break;D>$&&L(Math.max(H,$),T==null&&H<=N,Math.min(D,P),S==null&&D>=O,F.dir)}if($=K.to+1,$>=P)break}return M.length==0&&L(N,T==null,O,S==null,e.textDirection),{top:_,bottom:A,horizontal:M}}function k(T,S){let C=a.top+(S?T.top:T.bottom);return{top:C,bottom:C,horizontal:[]}}}function C6e(e,t){return e.constructor==t.constructor&&e.eq(t)}class T6e{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(qk)!=t.state.facet(qk)&&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(qk);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)=>!C6e(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,rn.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const qk=sn.define();function uQ(e){return[Fs.define(t=>new T6e(t,e)),qk.of(e)]}const _g=sn.define({combine(e){return du(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function dQ(e={}){return[_g.of(e),A6e,E6e,M6e,PX.of(!0)]}function hQ(e){return e.startState.facet(_g)!=e.state.facet(_g)}const A6e=uQ({above:!0,markers(e){let{state:t}=e,n=t.facet(_g),r=[];for(let s of t.selection.ranges){let i=s==t.selection.main;if(s.empty||n.drawRangeCursor&&!(i&&rn.ios&&n.iosSelectionHandles)){let o=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=s.empty?s:Xe.cursor(s.head,s.assoc);for(let l of Pm.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=hQ(e);return n&&TB(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){TB(t.state,e)},class:"cm-cursorLayer"});function TB(e,t){t.style.animationDuration=e.facet(_g).cursorBlinkRate+"ms"}const E6e=uQ({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 Pm.forRange(e,"cm-selectionBackground",s))t.push(i);if(rn.ios&&!n.empty&&e.state.facet(_g).iosSelectionHandles){for(let s of Pm.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Xe.cursor(n.from,1)))t.push(s);for(let s of Pm.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Xe.cursor(n.to,1)))t.push(s)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||hQ(e)},class:"cm-selectionLayer"}),M6e=vf.highest(It.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"}}}})),fQ=Yn.define({map(e,t){return e==null?null:t.mapPos(e)}}),kb=lo.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(fQ)?r.value:n,e)}}),N6e=Fs.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(kb);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(kb)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(kb),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(kb)!=e&&this.view.dispatch({effects:fQ.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function j6e(){return[kb,N6e]}function AB(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 I6e(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 R6e{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,u,d)=>s(d,u,u+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,u,d)=>{let h=r(a,l,u);h&&d(u,u+a[0].length,h)};else if(r)this.addMatch=(a,l,u,d)=>d(u,u+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 Zc,r=n.add.bind(n);for(let{from:s,to:i}of I6e(t,this.maxLength))AB(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),u=l.to<a?t.state.doc.lineAt(a):l,d=Math.max(i.from,l.from),h=Math.min(i.to,u.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){d=o;break}for(;a<u.to;a++)if(this.boundary.test(u.text[a-u.from])){h=a;break}}let m=[],p,g=(b,x,v)=>m.push(v.range(b,x));if(l==u)for(this.regexp.lastIndex=d-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,t,p.index+l.from,g);else AB(t.state.doc,this.regexp,d,h,(b,x)=>this.addMatch(x,t,b,g));n=n.update({filterFrom:d,filterTo:h,filter:(b,x)=>b<d||x>h,add:m})}}return n}}const yA=/x/.unicode!=null?"gu":"g",D6e=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,yA),L6e={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 b6=null;function P6e(){var e;if(b6==null&&typeof document<"u"&&document.body){let t=document.body.style;b6=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return b6||!1}const Hk=sn.define({combine(e){let t=du(e,{render:null,specialChars:D6e,addSpecialChars:null});return(t.replaceTabs=!P6e())&&(t.specialChars=new RegExp("	|"+t.specialChars.source,yA)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,yA)),t}});function mQ(e={}){return[Hk.of(e),O6e()]}let EB=null;function O6e(){return EB||(EB=Fs.fromClass(class{constructor(e){this.view=e,this.decorations=vn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Hk)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new R6e({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:s}=n.state,i=ha(t[0],0);if(i==9){let o=s.lineAt(r),a=n.state.tabSize,l=Zg(o.text,a,r-o.from);return vn.replace({widget:new F6e((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=vn.replace({widget:new z6e(e,i)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Hk);e.startState.facet(Hk)!=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 B6e="•";function $6e(e){return e>=32?B6e:e==10?"␤":String.fromCharCode(9216+e)}class z6e extends ll{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=$6e(this.code),r=t.state.phrase("Control character")+" "+(L6e[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 F6e extends ll{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}}function q6e(){return U6e}const H6e=vn.line({class:"cm-activeLine"}),U6e=Fs.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let s=e.lineBlockAt(r.head);s.from>t&&(n.push(H6e.range(s.from)),t=s.from)}return vn.set(n)}},{decorations:e=>e.decorations});class V6e extends ll{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?ay(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),s=Wy(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 MB(e){let t=Fs.fromClass(class{constructor(n){this.view=n,this.placeholder=e?vn.set([vn.widget({widget:new V6e(e),side:1}).range(0)]):vn.none}get decorations(){return this.view.state.doc.length?vn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,It.contentAttributes.of({"aria-placeholder":e})]:t}const vA=2e3;function W6e(e,t,n){let r=Math.min(t.line,n.line),s=Math.max(t.line,n.line),i=[];if(t.off>vA||n.off>vA||t.col<0||n.col<0){let o=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let l=r;l<=s;l++){let u=e.doc.line(l);u.length<=a&&i.push(Xe.range(u.from+o,u.to+a))}}else{let o=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let l=r;l<=s;l++){let u=e.doc.line(l),d=J7(u.text,o,e.tabSize,!0);if(d<0)i.push(Xe.cursor(u.to));else{let h=J7(u.text,a,e.tabSize);i.push(Xe.range(u.from+d,u.from+h))}}}return i}function G6e(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function NB(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),s=n-r.from,i=s>vA?-1:s==r.length?G6e(e,t.clientX):Zg(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function K6e(e,t){let n=NB(e,t),r=e.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),o=s.state.doc.lineAt(i);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(s.changes)}},get(s,i,o){let a=NB(e,s);if(!a)return r;let l=W6e(e.state,n,a);return l.length?o?Xe.create(l.concat(r.ranges)):Xe.create(l):r}}:null}function Y6e(e){let t=n=>n.altKey&&n.button==0;return It.mouseSelectionStyle.of((n,r)=>t(r)?K6e(n,r):null)}const X6e={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Q6e={style:"cursor: crosshair"};function J6e(e={}){let[t,n]=X6e[e.key||"Alt"],r=Fs.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==t||n(s))},keyup(s){(s.keyCode==t||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,It.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?Q6e:null})]}const Aw="-10000px";class pQ{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 u=i[l],d=-1;if(u){for(let h=0;h<this.tooltips.length;h++){let m=this.tooltips[h];m&&m.create==u.create&&(d=h)}if(d<0)o[l]=this.createTooltipView(u,l?o[l-1]:null),a&&(a[l]=!!u.above);else{let h=o[l]=this.tooltipViews[d];a&&(a[l]=n[d]),h.update&&h.update(t)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(a.forEach((l,u)=>n[u]=l),n.length=a.length),this.input=s,this.tooltips=i,this.tooltipViews=o,!0}}function Z6e(e={}){return Uk.of(e)}function eTe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const Uk=sn.define({combine:e=>{var t,n,r;return{position:rn.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)||eTe}}}),jB=new WeakMap,JM=Fs.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(Uk);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 pQ(e,ZM,(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(Uk);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=Aw,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(rn.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=KM(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(Uk).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],u=this.manager.tooltipViews[a],{dom:d}=u,h=e.pos[a],m=e.size[a];if(!h||l.clip!==!1&&(h.bottom<=Math.max(n.top,r.top)||h.top>=Math.min(n.bottom,r.bottom)||h.right<Math.max(n.left,r.left)-.1||h.left>Math.min(n.right,r.right)+.1)){d.style.top=Aw;continue}let p=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=p?7:0,b=m.right-m.left,x=(t=jB.get(u))!==null&&t!==void 0?t:m.bottom-m.top,v=u.offset||nTe,y=this.view.textDirection==xs.LTR,w=m.width>r.right-r.left?y?r.left:r.right-m.width:y?Math.max(r.left,Math.min(h.left-(p?14:0)+v.x,r.right-b)):Math.min(Math.max(r.left,h.left-b+(p?14:0)-v.x),r.right-b),k=this.above[a];!l.strictSide&&(k?h.top-x-g-v.y<r.top:h.bottom+x+g+v.y>r.bottom)&&k==r.bottom-h.bottom>h.top-r.top&&(k=this.above[a]=!k);let T=(k?h.top-r.top:r.bottom-h.bottom)-g;if(T<x&&u.resize!==!1){if(T<this.view.defaultLineHeight){d.style.top=Aw;continue}jB.set(u,x),d.style.height=(x=T)/i+"px"}else d.style.height&&(d.style.height="");let S=k?h.top-x-g-v.y:h.bottom+g+v.y,C=w+b;if(u.overlap!==!0)for(let _ of o)_.left<C&&_.right>w&&_.top<S+x&&_.bottom>S&&(S=k?_.top-x-2-g:_.bottom+g+2);if(this.position=="absolute"?(d.style.top=(S-e.parent.top)/i+"px",IB(d,(w-e.parent.left)/s)):(d.style.top=S/i+"px",IB(d,w/s)),p){let _=h.left+(y?v.x:-v.x)-(w+14-7);p.style.left=_/s+"px"}u.overlap!==!0&&o.push({left:w,top:S,right:C,bottom:S+x}),d.classList.toggle("cm-tooltip-above",k),d.classList.toggle("cm-tooltip-below",!k),u.positioned&&u.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=Aw}},{eventObservers:{scroll(){this.maybeMeasure()}}});function IB(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const tTe=It.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"}}}),nTe={x:0,y:0},ZM=sn.define({enables:[JM,tTe]}),T_=sn.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class SS{static create(t){return new SS(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new pQ(t,T_,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(t,n){let r=t.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let r of this.manager.tooltipViews){let s=r[t];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const rTe=ZM.compute([T_],e=>{let t=e.facet(T_);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:SS.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),gQ=sn.define();class sTe{constructor(t,n,r,s,i,o){this.view=t,this.source=n,this.field=r,this.locked=s,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(t){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:n}=this,r=t.docView.tile.nearest(n.target);if(!r)return;let s,i=1;if(r.isWidget())s=r.posAtStart;else{if(s=t.posAtCoords(n),s==null)return;let o=t.coordsAtPos(s);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-t.defaultCharacterWidth||n.x>o.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(s)).find(u=>u.from<=s&&u.to>=s),l=a&&a.dir==xs.RTL?-1:1;i=n.x<o.left?-l:l}this.activateHover(t,s,i)}activateHover(t,n,r,s){let i=this.source(t,n,r),o=a=>{if(a&&!(Array.isArray(a)&&!a.length)){let l=Array.isArray(a)?a:[a];s&&this.locked.set(l,s),t.dispatch({effects:this.setHover.of(l)})}};if(i&&"then"in i){let a=this.pending={pos:n};i.then(l=>{this.pending==a&&(this.pending=null,o(l))},l=>ma(t.state,l,"hover tooltip"))}else o(i)}get tooltip(){let t=this.view.plugin(JM),n=t?t.manager.tooltips.findIndex(r=>r.create==SS.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&!this.locked.has(s)&&i&&!iTe(i.dom,t)||this.pending){let{pos:o}=s[0]||this.pending,a=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!oTe(this.view,o,a,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=r=>{t.removeEventListener("mouseleave",n);let{active:s}=this;s.length&&!this.locked.has(s)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ew=4;function iTe(e,t){let{left:n,right:r,top:s,bottom:i}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();s=Math.min(a.top,s),i=Math.max(a.bottom,i)}return t.clientX>=n-Ew&&t.clientX<=r+Ew&&t.clientY>=s-Ew&&t.clientY<=i+Ew}function oTe(e,t,n,r,s,i){let o=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>r||o.right<r||o.top>s||Math.min(o.bottom,a)<s)return!1;let l=e.posAtCoords({x:r,y:s},!1);return l>=t&&l<=n}function aTe(e,t={}){let n=Yn.define(),r=new WeakMap,s=lo.define({create(){return[]},update(o,a){let l=r.get(o);if(o.length&&(t.hideOnChange&&(a.docChanged||a.selection)?o=[]:l&&l(a)?o=[]:t.hideOn&&(o=o.filter(u=>!t.hideOn(a,u)))),a.docChanged&&o.length){let u=[];for(let d of o){let h=a.changes.mapPos(d.pos,-1,Fo.TrackDel);if(h!=null){let m=Object.assign(Object.create(null),d);m.pos=h,m.end!=null&&(m.end=a.changes.mapPos(m.end)),u.push(m)}}o=u}for(let u of a.effects)u.is(n)&&(o=u.value,l=void 0),(u.is(cTe)&&!u.value||u.value==s)&&(o=[]);return o.length&&l&&r.set(o,l),o},provide:o=>T_.from(o)});const i=Fs.define(o=>new sTe(o,e,s,r,n,t.hoverTime||300));return{active:s,extension:[s,i,gQ.of(i),rTe]}}function lTe(e,t,n,r={}){var s;let i=e.state.facet(gQ).map(o=>e.plugin(o)).filter(o=>!!o);if(r.tooltip&&r.tooltip.active){let o=i.find(a=>a.field==r.tooltip.active);o&&(i=[o])}for(let o of i)o.activateHover(e,t,n,(s=r.until)!==null&&s!==void 0?s:()=>!1)}function bQ(e,t){let n=e.plugin(JM);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const cTe=Yn.define(),RB=sn.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function eN(e,t){let n=e.plugin(yQ),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const yQ=Fs.fromClass(class{constructor(e){this.input=e.state.facet(Ky),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(RB);this.top=new Mw(e,!0,t.topContainer),this.bottom=new Mw(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(RB);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Mw(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Mw(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Ky);if(n!=this.input){let r=n.filter(l=>l),s=[],i=[],o=[],a=[];for(let l of r){let u=this.specs.indexOf(l),d;u<0?(d=l(e.view),a.push(d)):(d=this.panels[u],d.update&&d.update(e)),s.push(d),(d.top?i:o).push(d)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>It.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Mw{constructor(t,n,r){this.view=t,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=DB(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=DB(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function DB(e){let t=e.nextSibling;return e.remove(),t}const Ky=sn.define({enables:yQ});function uTe(e,t){let n,r=new Promise(o=>n=o),s=o=>dTe(o,t,n);e.state.field(y6,!1)?e.dispatch({effects:vQ.of(s)}):e.dispatch({effects:Yn.appendConfig.of(y6.init(()=>[s]))});let i=xQ.of(s);return{close:i,result:r.then(o=>((e.win.queueMicrotask||(l=>e.win.setTimeout(l,10)))(()=>{e.state.field(y6).indexOf(s)>-1&&e.dispatch({effects:i})}),o))}}const y6=lo.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(vQ)?e=[n.value].concat(e):n.is(xQ)&&(e=e.filter(r=>r!=n.value));return e},provide:e=>Ky.computeN([e],t=>t.field(e))}),vQ=Yn.define(),xQ=Yn.define();function dTe(e,t,n){let r=t.content?t.content(e,()=>o(null)):null;if(!r){if(r=fs("form"),t.input){let a=fs("input",t.input);/^(text|password|number|email|tel|url)$/.test(a.type)&&a.classList.add("cm-textfield"),a.name||(a.name="input"),r.appendChild(fs("label",(t.label||"")+": ",a))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(fs("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let s=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let a=0;a<s.length;a++){let l=s[a];l.addEventListener("keydown",u=>{u.keyCode==27?(u.preventDefault(),o(null)):u.keyCode==13&&(u.preventDefault(),o(l))}),l.addEventListener("submit",u=>{u.preventDefault(),o(l)})}let i=fs("div",r,fs("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(i.className=t.class),i.classList.add("cm-dialog");function o(a){i.contains(i.ownerDocument.activeElement)&&e.focus(),n(a)}return{dom:i,top:t.top,mount:()=>{if(t.focus){let a;typeof t.focus=="string"?a=r.querySelector(t.focus):a=r.querySelector("input")||r.querySelector("button"),a&&"select"in a?a.select():a&&"focus"in a&&a.focus()}}}}class dd extends Zh{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}dd.prototype.elementClass="";dd.prototype.toDOM=void 0;dd.prototype.mapMode=Fo.TrackBefore;dd.prototype.startSide=dd.prototype.endSide=-1;dd.prototype.point=!0;const Vk=sn.define(),hTe=sn.define(),fTe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_r.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},uy=sn.define();function mTe(e){return[wQ(),uy.of({...fTe,...e})]}const LB=sn.define({combine:e=>e.some(t=>t)});function wQ(e){return[pTe]}const pTe=Fs.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(uy).map(t=>new OB(e,t)),this.fixed=!e.state.facet(LB);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(LB)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=_r.iter(this.view.state.facet(Vk),this.view.viewport.from),r=[],s=this.gutters.map(i=>new gTe(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let o=!0;for(let a of i.type)if(a.type==ao.Text&&o){xA(n,r,a.from);for(let l of s)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of s)l.widget(this.view,a)}else if(i.type==ao.Text){xA(n,r,i.from);for(let o of s)o.line(this.view,i,r)}else if(i.widget)for(let o of s)o.widget(this.view,i);for(let i of s)i.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(uy),n=e.state.facet(uy),r=e.docChanged||e.heightChanged||e.viewportChanged||!_r.eq(e.startState.facet(Vk),e.state.facet(Vk),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let s of this.gutters)s.update(e)&&(r=!0);else{r=!0;let s=[];for(let i of n){let o=t.indexOf(i);o<0?s.push(new OB(this.view,i)):(this.gutters[o].update(e),s.push(this.gutters[o]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>It.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,s=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==xs.LTR?{left:r,right:s}:{right:r,left:s}})});function PB(e){return Array.isArray(e)?e:[e]}function xA(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class gTe{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=_r.iter(t.markers,n.from)}addElement(t,n,r){let{gutter:s}=this,i=(n.top-this.height)/t.scaleY,o=n.height/t.scaleY;if(this.i==s.elements.length){let a=new kQ(t,o,i,r);s.elements.push(a),s.dom.appendChild(a.dom)}else s.elements[this.i].update(t,o,i,r);this.height=n.bottom,this.i++}line(t,n,r){let s=[];xA(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(t,n,s);i&&s.unshift(i);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(t,n,s)}widget(t,n){let r=this.gutter.config.widgetMarker(t,n.widget,n),s=r?[r]:null;for(let i of t.state.facet(hTe)){let o=i(t,n.widget,n);o&&(s||(s=[])).push(o)}s&&this.addElement(t,n,s)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class OB{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,o;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let l=i.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=s.clientY;let a=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[r](t,a,s)&&s.preventDefault()});this.markers=PB(n.markers(t)),n.initialSpacer&&(this.spacer=new kQ(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=PB(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],t);s!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[s])}let r=t.view.viewport;return!_r.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class kQ{constructor(t,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,s)}update(t,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),bTe(this.markers,s)||this.setMarkers(t,s)}setMarkers(t,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,o=0;;){let a=o,l=i<n.length?n[i++]:null,u=!1;if(l){let d=l.elementClass;d&&(r+=" "+d);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,u=!0;break}}else a=this.markers.length;for(;o<a;){let d=this.markers[o++];if(d.toDOM){d.destroy(s);let h=s.nextSibling;s.remove(),s=h}}if(!l)break;l.toDOM&&(u?s=s.nextSibling:this.dom.insertBefore(l.toDOM(t),s)),u&&o++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function bTe(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}const yTe=sn.define(),vTe=sn.define(),_0=sn.define({combine(e){return du(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,n){let r=Object.assign({},t);for(let s in n){let i=r[s],o=n[s];r[s]=i?(a,l,u)=>i(a,l,u)||o(a,l,u):o}return r}})}});class v6 extends dd{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function x6(e,t){return e.state.facet(_0).formatNumber(t,e.state)}const xTe=uy.compute([_0],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(yTe)},lineMarker(t,n,r){return r.some(s=>s.toDOM)?null:new v6(x6(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let s of t.state.facet(vTe)){let i=s(t,n,r);if(i)return i}return null},lineMarkerChange:t=>t.startState.facet(_0)!=t.state.facet(_0),initialSpacer(t){return new v6(x6(t,BB(t.state.doc.lines)))},updateSpacer(t,n){let r=x6(n.view,BB(n.view.state.doc.lines));return r==t.number?t:new v6(r)},domEventHandlers:e.facet(_0).domEventHandlers,side:"before"}));function wTe(e={}){return[_0.of(e),wQ(),xTe]}function BB(e){let t=9;for(;t<e;)t=t*10+9;return t}const kTe=new class extends dd{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},_Te=Vk.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let s=e.doc.lineAt(r.head).from;s>n&&(n=s,t.push(kTe.range(s)))}return _r.of(t)});function STe(){return _Te}const CTe=1024;let TTe=0;class w6{constructor(t,n){this.from=t,this.to=n}}class Dr{constructor(t={}){this.id=TTe++,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=zl.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}Dr.closedBy=new Dr({deserialize:e=>e.split(" ")});Dr.openedBy=new Dr({deserialize:e=>e.split(" ")});Dr.group=new Dr({deserialize:e=>e.split(" ")});Dr.isolate=new Dr({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Dr.contextHash=new Dr({perNode:!0});Dr.lookAhead=new Dr({perNode:!0});Dr.mounted=new Dr({perNode:!0});class dy{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[Dr.mounted.id]}}const ATe=Object.create(null);class zl{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):ATe,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),s=new zl(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(Dr.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(Dr.group),i=-1;i<(s?s.length:0);i++){let o=n[i<0?r.name:s[i]];if(o)return o}}}}zl.none=new zl("",Object.create(null),0,8);const Nw=new WeakMap,$B=new WeakMap;var ai;(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"})(ai||(ai={}));class io{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=dy.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 kA(this.topNode,t)}cursorAt(t,n=0,r=0){let s=Nw.get(this)||this.topNode,i=new kA(s);return i.moveTo(t,n),Nw.set(this,i._tree),i}get topNode(){return new sf(this,0,0,null)}resolve(t,n=0){let r=Yy(Nw.get(this)||this.topNode,t,n,!1);return Nw.set(this,r),r}resolveInner(t,n=0){let r=Yy($B.get(this)||this.topNode,t,n,!0);return $B.set(this,r),r}resolveStack(t,n=0){return NTe(this,t,n)}iterate(t){let{enter:n,leave:r,from:s=0,to:i=this.length}=t,o=t.mode||0,a=(o&ai.IncludeAnonymous)>0;for(let l=this.cursor(o|ai.IncludeAnonymous);;){let u=!1;if(l.from<=i&&l.to>=s&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;u=!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:rN(zl.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new io(this.type,n,r,s,this.propValues),t.makeTree||((n,r,s)=>new io(zl.none,n,r,s)))}static build(t){return jTe(t)}}io.empty=new io(zl.none,[],[],0);class tN{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 tN(this.buffer,this.index)}}class rf{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return zl.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&&!(_Q(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 u=i[l++]=s[a++]-r;i[l++]=s[a++]-t,o=Math.max(o,u)}return new rf(i,o,this.set)}}function _Q(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 Yy(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 sf&&e.index<0?null:e.parent;if(!o)return e;e=o}let i=r?0:ai.IgnoreOverlays;if(r)for(let o=e,a=o.parent;a;o=a,a=o.parent)o instanceof sf&&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 SQ{cursor(t=0){return new kA(this,t)}getChild(t,n=null,r=null){let s=zB(this,t,n,r);return s.length?s[0]:null}getChildren(t,n=null,r=null){return zB(this,t,n,r)}resolve(t,n=0){return Yy(this,t,n,!1)}resolveInner(t,n=0){return Yy(this,t,n,!0)}matchContext(t){return wA(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}}let sf=class Wk extends SQ{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,u=n>0?a.length:-1;t!=u;t+=n){let d=a[t],h=l[t]+o.from,m;if(!(!(i&ai.EnterBracketed&&d instanceof io&&(m=dy.get(d))&&!m.overlay&&m.bracketed&&r>=h&&r<=h+d.length)&&!_Q(s,r,h,h+d.length))){if(d instanceof rf){if(i&ai.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-h,s);if(p>-1)return new Sh(new ETe(o,d,t,h),null,p)}else if(i&ai.IncludeAnonymous||!d.type.isAnonymous||nN(d)){let p;if(!(i&ai.IgnoreMounts)&&(p=dy.get(d))&&!p.overlay)return new Wk(p.tree,h,t,o);let g=new Wk(d,h,t,o);return i&ai.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,r,s,i)}}}if(i&ai.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&ai.IgnoreOverlays)&&(s=dy.get(this._tree))&&s.overlay){let i=t-this.from,o=r&ai.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 Wk(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 zB(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 wA(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 ETe{constructor(t,n,r,s){this.parent=t,this.buffer=n,this.index=r,this.start=s}}class Sh extends SQ{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 Sh(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&ai.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 Sh(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 Sh(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 Sh(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 io(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function CQ(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 sf&&n.index<0?null:n.parent,s=e.slice();return r?s[t]=r:s.splice(t,1),new MTe(s,n)}class MTe{constructor(t,n){this.heads=t,this.node=n}get next(){return CQ(this.heads)}}function NTe(e,t,n){let r=e.resolveInner(t,n),s=null;for(let i=r instanceof sf?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=dy.get(i.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let a=new sf(o.tree,o.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Yy(a,t,n,!1))}}return s?CQ(s):r}class kA{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&~ai.EnterBracketed,t instanceof sf)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 sf?(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&ai.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ai.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&ai.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&ai.IncludeAnonymous||a instanceof rf||!a.type.isAnonymous||nN(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 Sh(this.buffer,n,this.stack[s]);return this.bufferNode=new Sh(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 wA(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 wA(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 nN(e){return e.children.some(t=>t instanceof rf||!t.type.isAnonymous||nN(t))}function jTe(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:s=CTe,reused:i=[],minRepeatType:o=r.types.length}=e,a=Array.isArray(n)?new tN(n,n.length):n,l=r.types,u=0,d=0;function h(T,S,C,_,A,M){let{id:L,start:N,end:O,size:B}=a,$=d,P=u;if(B<0)if(a.next(),B==-1){let Q=i[L];C.push(Q),_.push(N-T);return}else if(B==-3){u=L;return}else if(B==-4){d=L;return}else throw new RangeError(`Unrecognized record size: ${B}`);let K=l[L],F,H,D=N-T;if(O-N<=s&&(H=x(a.pos-S,A))){let Q=new Uint16Array(H.size-H.skip),U=a.pos-H.size,j=Q.length;for(;a.pos>U;)j=v(H.start,Q,j);F=new rf(Q,O-H.start,r),D=H.start-T}else{let Q=a.pos-B;a.next();let U=[],j=[],ie=L>=o?L:-1,oe=0,J=O;for(;a.pos>Q;)ie>=0&&a.id==ie&&a.size>=0?(a.end<=J-s&&(g(U,j,N,oe,a.end,J,ie,$,P),oe=U.length,J=a.end),a.next()):M>2500?m(N,Q,U,j):h(N,Q,U,j,ie,M+1);if(ie>=0&&oe>0&&oe<U.length&&g(U,j,N,oe,N,J,ie,$,P),U.reverse(),j.reverse(),ie>-1&&oe>0){let V=p(K,P);F=rN(K,U,j,0,U.length,0,O-N,V,V)}else F=b(K,U,j,O-N,$-O,P)}C.push(F),_.push(D)}function m(T,S,C,_){let A=[],M=0,L=-1;for(;a.pos>S;){let{id:N,start:O,end:B,size:$}=a;if($>4)a.next();else{if(L>-1&&O<L)break;L<0&&(L=B-s),A.push(N,O,B),M++,a.next()}}if(M){let N=new Uint16Array(M*4),O=A[A.length-2];for(let B=A.length-3,$=0;B>=0;B-=3)N[$++]=A[B],N[$++]=A[B+1]-O,N[$++]=A[B+2]-O,N[$++]=$;C.push(new rf(N,A[2]-O,r)),_.push(O-T)}}function p(T,S){return(C,_,A)=>{let M=0,L=C.length-1,N,O;if(L>=0&&(N=C[L])instanceof io){if(!L&&N.type==T&&N.length==A)return N;(O=N.prop(Dr.lookAhead))&&(M=_[L]+N.length+O)}return b(T,C,_,A,M,S)}}function g(T,S,C,_,A,M,L,N,O){let B=[],$=[];for(;T.length>_;)B.push(T.pop()),$.push(S.pop()+C-A);T.push(b(r.types[L],B,$,M-A,N-M,O)),S.push(A-C)}function b(T,S,C,_,A,M,L){if(M){let N=[Dr.contextHash,M];L=L?[N].concat(L):[N]}if(A>25){let N=[Dr.lookAhead,A];L=L?[N].concat(L):[N]}return new io(T,S,C,_,L)}function x(T,S){let C=a.fork(),_=0,A=0,M=0,L=C.end-s,N={size:0,start:0,skip:0};e:for(let O=C.pos-T;C.pos>O;){let B=C.size;if(C.id==S&&B>=0){N.size=_,N.start=A,N.skip=M,M+=4,_+=4,C.next();continue}let $=C.pos-B;if(B<0||$<O||C.start<L)break;let P=C.id>=o?4:0,K=C.start;for(C.next();C.pos>$;){if(C.size<0)if(C.size==-3||C.size==-4)P+=4;else break e;else C.id>=o&&(P+=4);C.next()}A=K,_+=B,M+=P}return(S<0||_==T)&&(N.size=_,N.start=A,N.skip=M),N.size>4?N:void 0}function v(T,S,C){let{id:_,start:A,end:M,size:L}=a;if(a.next(),L>=0&&_<o){let N=C;if(L>4){let O=a.pos-(L-4);for(;a.pos>O;)C=v(T,S,C)}S[--C]=N,S[--C]=M-T,S[--C]=A-T,S[--C]=_}else L==-3?u=_:L==-4&&(d=_);return C}let y=[],w=[];for(;a.pos>0;)h(e.start||0,e.bufferStart||0,y,w,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:y.length?w[0]+y[0].length:0;return new io(l[e.topID],y.reverse(),w.reverse(),k)}const FB=new WeakMap;function Gk(e,t){if(!e.isAnonymous||t instanceof rf||t.type!=e)return 1;let n=FB.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof io)){n=1;break}n+=Gk(e,r)}FB.set(t,n)}return n}function rN(e,t,n,r,s,i,o,a,l){let u=0;for(let g=r;g<s;g++)u+=Gk(e,t[g]);let d=Math.ceil(u*1.5/8),h=[],m=[];function p(g,b,x,v,y){for(let w=x;w<v;){let k=w,T=b[w],S=Gk(e,g[w]);for(w++;w<v;w++){let C=Gk(e,g[w]);if(S+C>=d)break;S+=C}if(w==k+1){if(S>d){let C=g[k];p(C.children,C.positions,0,C.children.length,b[k]+y);continue}h.push(g[k])}else{let C=b[w-1]+g[w-1].length-T;h.push(rN(e,g,b,k,w,T,C,null,l))}m.push(T+y-i)}}return p(t,n,r,s,0),(a||l)(h,m,o)}class Om{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 Om(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,u=0;;a++){let d=a<n.length?n[a]:null,h=d?d.fromA:1e9;if(h-l>=r)for(;o&&o.from<h;){let m=o;if(l>=m.from||h<=m.to||u){let p=Math.max(m.from,l)-u,g=Math.min(m.to,h)-u;m=p>=g?null:new Om(p,g,m.tree,m.offset+u,a>0,!!d)}if(m&&s.push(m),o.to>h)break;o=i<t.length?t[i++]:null}if(!d)break;l=d.toA,u=d.toA-d.toB}return s}}class ITe{startParse(t,n,r){return typeof t=="string"&&(t=new RTe(t)),r=r?r.length?r.map(s=>new w6(s.from,s.to)):[new w6(0,0)]:[new w6(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 RTe{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 Dr({perNode:!0});let DTe=0;class Cl{constructor(t,n,r,s){this.name=t,this.set=n,this.base=r,this.modified=s,this.id=DTe++}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 Cl&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let s=new Cl(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 A_(t);return r=>r.modified.indexOf(n)>-1?r:A_.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let LTe=0;class A_{constructor(t){this.name=t,this.instances=[],this.id=LTe++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(a=>a.base==t&&PTe(n,a.modified));if(r)return r;let s=[],i=new Cl(t.name,s,t,n);for(let a of n)a.instances.push(i);let o=OTe(n);for(let a of t.set)if(!a.modified.length)for(let l of o)s.push(A_.get(a,l));return i}}function PTe(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function OTe(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 BTe(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 h=0;;){if(a=="..."&&h>0&&h+3==s.length){o=1;break}let m=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!m)throw new RangeError("Invalid path: "+s);if(i.push(m[0]=="*"?"":m[0][0]=='"'?JSON.parse(m[0]):m[0]),h+=m[0].length,h==s.length)break;let p=s[h++];if(h==s.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+s);a=s.slice(h)}let l=i.length-1,u=i[l];if(!u)throw new RangeError("Invalid path: "+s);let d=new Xy(r,o,l>0?i.slice(0,l):null);t[u]=d.sort(t[u])}}return TQ.add(t)}const TQ=new Dr({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 Xy(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Xy{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}}Xy.empty=new Xy([],2,null);function AQ(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 u=n[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function $Te(e,t){let n=null;for(let r of e){let s=r.style(t);s&&(n=n?n+" "+s:s)}return n}function zTe(e,t,n,r=0,s=e.length){let i=new FTe(r,Array.isArray(t)?t:[t],n);i.highlightRange(e.cursor(),r,s,"",i.highlighters),i.flush(s)}class FTe{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(p=>!p.scope||p.scope(o)));let u=s,d=qTe(t)||Xy.empty,h=$Te(i,d.tags);if(h&&(u&&(u+=" "),u+=h,d.mode==1&&(s+=(s?" ":"")+h)),this.startSpan(Math.max(n,a),u),d.opaque)return;let m=t.tree&&t.tree.prop(Dr.mounted);if(m&&m.overlay){let p=t.node.enter(m.overlay[0].from+a,1),g=this.highlighters.filter(x=>!x.scope||x.scope(m.tree.type)),b=t.firstChild();for(let x=0,v=a;;x++){let y=x<m.overlay.length?m.overlay[x]:null,w=y?y.from+a:l,k=Math.max(n,v),T=Math.min(r,w);if(k<T&&b)for(;t.from<T&&(this.highlightRange(t,k,T,s,i),this.startSpan(Math.min(T,t.to),u),!(t.to>=w||!t.nextSibling())););if(!y||w>r)break;v=y.to+a,v>n&&(this.highlightRange(p.cursor(),Math.max(n,y.from+a),Math.min(r,v),"",g),this.startSpan(Math.min(r,v),u))}b&&t.parent()}else if(t.firstChild()){m&&(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),u)}while(t.nextSibling());t.parent()}}}function qTe(e){let t=e.type.prop(TQ);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Ht=Cl.define,jw=Ht(),ah=Ht(),qB=Ht(ah),HB=Ht(ah),lh=Ht(),Iw=Ht(lh),k6=Ht(lh),Tc=Ht(),Xf=Ht(Tc),yc=Ht(),vc=Ht(),_A=Ht(),Q1=Ht(_A),Rw=Ht(),Kt={comment:jw,lineComment:Ht(jw),blockComment:Ht(jw),docComment:Ht(jw),name:ah,variableName:Ht(ah),typeName:qB,tagName:Ht(qB),propertyName:HB,attributeName:Ht(HB),className:Ht(ah),labelName:Ht(ah),namespace:Ht(ah),macroName:Ht(ah),literal:lh,string:Iw,docString:Ht(Iw),character:Ht(Iw),attributeValue:Ht(Iw),number:k6,integer:Ht(k6),float:Ht(k6),bool:Ht(lh),regexp:Ht(lh),escape:Ht(lh),color:Ht(lh),url:Ht(lh),keyword:yc,self:Ht(yc),null:Ht(yc),atom:Ht(yc),unit:Ht(yc),modifier:Ht(yc),operatorKeyword:Ht(yc),controlKeyword:Ht(yc),definitionKeyword:Ht(yc),moduleKeyword:Ht(yc),operator:vc,derefOperator:Ht(vc),arithmeticOperator:Ht(vc),logicOperator:Ht(vc),bitwiseOperator:Ht(vc),compareOperator:Ht(vc),updateOperator:Ht(vc),definitionOperator:Ht(vc),typeOperator:Ht(vc),controlOperator:Ht(vc),punctuation:_A,separator:Ht(_A),bracket:Q1,angleBracket:Ht(Q1),squareBracket:Ht(Q1),paren:Ht(Q1),brace:Ht(Q1),content:Tc,heading:Xf,heading1:Ht(Xf),heading2:Ht(Xf),heading3:Ht(Xf),heading4:Ht(Xf),heading5:Ht(Xf),heading6:Ht(Xf),contentSeparator:Ht(Tc),list:Ht(Tc),quote:Ht(Tc),emphasis:Ht(Tc),strong:Ht(Tc),link:Ht(Tc),monospace:Ht(Tc),strikethrough:Ht(Tc),inserted:Ht(),deleted:Ht(),changed:Ht(),invalid:Ht(),meta:Rw,documentMeta:Ht(Rw),annotation:Ht(Rw),processingInstruction:Ht(Rw),definition:Cl.defineModifier("definition"),constant:Cl.defineModifier("constant"),function:Cl.defineModifier("function"),standard:Cl.defineModifier("standard"),local:Cl.defineModifier("local"),special:Cl.defineModifier("special")};for(let e in Kt){let t=Kt[e];t instanceof Cl&&(t.name=e)}AQ([{tag:Kt.link,class:"tok-link"},{tag:Kt.heading,class:"tok-heading"},{tag:Kt.emphasis,class:"tok-emphasis"},{tag:Kt.strong,class:"tok-strong"},{tag:Kt.keyword,class:"tok-keyword"},{tag:Kt.atom,class:"tok-atom"},{tag:Kt.bool,class:"tok-bool"},{tag:Kt.url,class:"tok-url"},{tag:Kt.labelName,class:"tok-labelName"},{tag:Kt.inserted,class:"tok-inserted"},{tag:Kt.deleted,class:"tok-deleted"},{tag:Kt.literal,class:"tok-literal"},{tag:Kt.string,class:"tok-string"},{tag:Kt.number,class:"tok-number"},{tag:[Kt.regexp,Kt.escape,Kt.special(Kt.string)],class:"tok-string2"},{tag:Kt.variableName,class:"tok-variableName"},{tag:Kt.local(Kt.variableName),class:"tok-variableName tok-local"},{tag:Kt.definition(Kt.variableName),class:"tok-variableName tok-definition"},{tag:Kt.special(Kt.variableName),class:"tok-variableName2"},{tag:Kt.definition(Kt.propertyName),class:"tok-propertyName tok-definition"},{tag:Kt.typeName,class:"tok-typeName"},{tag:Kt.namespace,class:"tok-namespace"},{tag:Kt.className,class:"tok-className"},{tag:Kt.macroName,class:"tok-macroName"},{tag:Kt.propertyName,class:"tok-propertyName"},{tag:Kt.operator,class:"tok-operator"},{tag:Kt.comment,class:"tok-comment"},{tag:Kt.meta,class:"tok-meta"},{tag:Kt.invalid,class:"tok-invalid"},{tag:Kt.punctuation,class:"tok-punctuation"}]);var _6;const _b=new Dr,HTe=new Dr;class Uc{constructor(t,n,r=[],s=""){this.data=t,this.name=s,Ir.prototype.hasOwnProperty("tree")||Object.defineProperty(Ir.prototype,"tree",{get(){return wo(this)}}),this.parser=n,this.extension=[of.of(this),Ir.languageData.of((i,o,a)=>{let l=UB(i,o,a),u=l.type.prop(_b);if(!u)return[];let d=i.facet(u),h=l.type.prop(HTe);if(h){let m=l.resolve(o-l.from,a);for(let p of h)if(p.test(m,i)){let g=i.facet(p.facet);return p.type=="replace"?g:g.concat(d)}}return d})].concat(r)}isActiveAt(t,n,r=-1){return UB(t,n,r).type.prop(_b)==this.data}findRegions(t){let n=t.facet(of);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(_b)==this.data){r.push({from:o,to:o+i.length});return}let a=i.prop(Dr.mounted);if(a){if(a.tree.prop(_b)==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 u=i.children[l];u instanceof io&&s(u,i.positions[l]+o)}};return s(wo(t),0),r}get allowsNesting(){return!0}}Uc.setState=Yn.define();function UB(e,t,n){let r=e.facet(of),s=wo(e).topNode;if(!r||r.allowsNesting)for(let i=s;i;i=i.enter(t,n,ai.ExcludeBuffers|ai.EnterBracketed))i.type.isTop&&(s=i);return s}function wo(e){let t=e.field(Uc.state,!1);return t?t.tree:io.empty}class UTe{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 J1=null;class E_{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 E_(t,n,[],io.empty,0,r,[],null)}startParse(){return this.parser.startParse(new UTe(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=io.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(Om.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(Om.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=J1;J1=this;try{return t()}finally{J1=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=VB(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((u,d,h,m)=>l.push({fromA:u,toA:d,fromB:h,toB:m})),r=Om.applyChanges(r,l),s=io.empty,i=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),h=t.mapPos(u.to,-1);d<h&&a.push({from:d,to:h})}}}return new E_(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=VB(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 ITe{createParse(n,r,s){let i=s[0].from,o=s[s.length-1].to;return{parsedPos:i,advance(){let l=J1;if(l){for(let u of s)l.tempSkipped.push(u);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=o,new io(zl.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 J1}}function VB(e,t,n){return Om.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Sg{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 Sg(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=E_.create(t.facet(of).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Sg(r)}}Uc.state=lo.define({create:Sg.init,update(e,t){for(let n of t.effects)if(n.is(Uc.setState))return n.value;return t.startState.facet(of)!=t.state.facet(of)?Sg.init(t.state):e.apply(t)}});let EQ=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(EQ=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const S6=typeof navigator<"u"&&(!((_6=navigator.scheduling)===null||_6===void 0)&&_6.isInputPending)?()=>navigator.scheduling.isInputPending():null,VTe=Fs.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(Uc.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(Uc.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=EQ(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(Uc.state);if(i.tree==i.context.tree&&i.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,t&&!S6?Math.max(25,t.timeRemaining()-5):1e9),a=i.context.treeLen<s&&r.doc.length>s+1e3,l=i.context.work(()=>S6&&S6()||Date.now()>o,s+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Uc.setState.of(new Sg(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=>ma(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()}}}),of=sn.define({combine(e){return e.length?e[0]:null},enables:e=>[Uc.state,VTe,It.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),WTe=sn.define(),sN=sn.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 M_(e){let t=e.facet(sN);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Qy(e,t){let n="",r=e.tabSize,s=e.facet(sN)[0];if(s=="	"){for(;t>=r;)n+="	",t-=r;s=" "}for(let i=0;i<t;i++)n+=s;return n}function iN(e,t){e instanceof Ir&&(e=new CS(e));for(let r of e.state.facet(WTe)){let s=r(e,t);if(s!==void 0)return s}let n=wo(e.state);return n.length>=t?KTe(e,n,t):null}class CS{constructor(t,n={}){this.state=t,this.options=n,this.unit=M_(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 Zg(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 GTe=new Dr;function KTe(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 MQ(r,e,n)}function MQ(e,t,n){for(let r=e;r;r=r.next){let s=XTe(r.node);if(s)return s(oN.create(t,n,r))}return 0}function YTe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function XTe(e){let t=e.type.prop(GTe);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Dr.closedBy))){let s=e.lastChild,i=s&&r.indexOf(s.name)>-1;return o=>e8e(o,!0,1,void 0,i&&!YTe(o)?s.from:void 0)}return e.parent==null?QTe:null}function QTe(){return 0}class oN extends CS{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 oN(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(JTe(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return MQ(this.context.next,this.base,this.pos)}}function JTe(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function ZTe(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 u=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+u}}a=l.to}}function e8e(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=ZTe(e);return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}const t8e=200;function n8e(){return Ir.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,s=n.lineAt(r);if(r>s.from+t8e)return e;let i=n.sliceString(s.from,r);if(!t.some(u=>u.test(i)))return e;let{state:o}=e,a=-1,l=[];for(let{head:u}of o.selection.ranges){let d=o.doc.lineAt(u);if(d.from==a)continue;a=d.from;let h=iN(o,d.from);if(h==null)continue;let m=/^\s*/.exec(d.text)[0],p=Qy(o,h);m!=p&&l.push({from:d.from,to:d.from+m.length,insert:p})}return l.length?[e,{changes:l,sequential:!0}]:e})}const r8e=sn.define(),s8e=new Dr;function i8e(e,t,n){let r=wo(e);if(r.length<n)return null;let s=r.resolveStack(n,1),i=null;for(let o=s;o;o=o.next){let a=o.node;if(a.to<=n||a.from>n)continue;if(i&&a.from<t)break;let l=a.type.prop(s8e);if(l&&(a.to<r.length-50||r.length==e.doc.length||!o8e(a))){let u=l(a,e);u&&u.from<=n&&u.from>=t&&u.to>n&&(i=u)}}return i}function o8e(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function N_(e,t,n){for(let r of e.facet(r8e)){let s=r(e,t,n);if(s)return s}return i8e(e,t,n)}function NQ(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const TS=Yn.define({map:NQ}),Hv=Yn.define({map:NQ});function jQ(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(r=>r.from<=n&&r.to>=n)||t.push(e.lineBlockAt(n));return t}const Xm=lo.define({create(){return vn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((n,r)=>e=WB(e,n,r)),e=e.map(t.changes);for(let n of t.effects)if(n.is(TS)&&!a8e(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(DQ),s=r?vn.replace({widget:new m8e(r(t.state,n.value))}):GB;e=e.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(Hv)&&(e=e.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=WB(e,t.selection.main.head)),e},provide:e=>It.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],s=e[n++];if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");t.push(GB.range(r,s))}return vn.set(t,!0)}});function WB(e,t,n=t){let r=!1;return e.between(t,n,(s,i)=>{s<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(s,i)=>s>=n||i<=t}):e}function j_(e,t,n){var r;let s=null;return(r=e.field(Xm,!1))===null||r===void 0||r.between(t,n,(i,o)=>{(!s||s.from>i)&&(s={from:i,to:o})}),s}function a8e(e,t,n){let r=!1;return e.between(t,t,(s,i)=>{s==t&&i==n&&(r=!0)}),r}function IQ(e,t){return e.field(Xm,!1)?t:t.concat(Yn.appendConfig.of(LQ()))}const l8e=e=>{for(let t of jQ(e)){let n=N_(e.state,t.from,t.to);if(n)return e.dispatch({effects:IQ(e.state,[TS.of(n),RQ(e,n)])}),!0}return!1},c8e=e=>{if(!e.state.field(Xm,!1))return!1;let t=[];for(let n of jQ(e)){let r=j_(e.state,n.from,n.to);r&&t.push(Hv.of(r),RQ(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function RQ(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,s=e.state.doc.lineAt(t.to).number;return It.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${s}.`)}const u8e=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let s=e.lineBlockAt(r),i=N_(t,s.from,s.to);i&&n.push(TS.of(i)),r=(i?e.lineBlockAt(i.to):s).to+1}return n.length&&e.dispatch({effects:IQ(e.state,n)}),!!n.length},d8e=e=>{let t=e.state.field(Xm,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,s)=>{n.push(Hv.of({from:r,to:s}))}),e.dispatch({effects:n}),!0},h8e=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:l8e},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:c8e},{key:"Ctrl-Alt-[",run:u8e},{key:"Ctrl-Alt-]",run:d8e}],f8e={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},DQ=sn.define({combine(e){return du(e,f8e)}});function LQ(e){return[Xm,b8e]}function PQ(e,t){let{state:n}=e,r=n.facet(DQ),s=o=>{let a=e.lineBlockAt(e.posAtDOM(o.target)),l=j_(e.state,a.from,a.to);l&&e.dispatch({effects:Hv.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,s,t);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const GB=vn.replace({widget:new class extends ll{toDOM(e){return PQ(e,null)}}});class m8e extends ll{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return PQ(t,this.value)}}const p8e={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class C6 extends dd{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function g8e(e={}){let t={...p8e,...e},n=new C6(t,!0),r=new C6(t,!1),s=Fs.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(of)!=o.state.facet(of)||o.startState.field(Xm,!1)!=o.state.field(Xm,!1)||wo(o.startState)!=wo(o.state)||t.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Zc;for(let l of o.viewportLineBlocks){let u=j_(o.state,l.from,l.to)?r:N_(o.state,l.from,l.to)?n:null;u&&a.add(l.from,l.from,u)}return a.finish()}}),{domEventHandlers:i}=t;return[s,mTe({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(s))===null||a===void 0?void 0:a.markers)||_r.empty},initialSpacer(){return new C6(t,!1)},domEventHandlers:{...i,click:(o,a,l)=>{if(i.click&&i.click(o,a,l))return!0;let u=j_(o.state,a.from,a.to);if(u)return o.dispatch({effects:Hv.of(u)}),!0;let d=N_(o.state,a.from,a.to);return d?(o.dispatch({effects:TS.of(d)}),!0):!1}}}),LQ()]}const b8e=It.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class AS{constructor(t,n){this.specs=t;let r;function s(a){let l=ef.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 Uc?a=>a.prop(_b)==o.data:o?a=>a==o:void 0,this.style=AQ(t.map(a=>({tag:a.tag,class:a.class||s(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=r?new ef(r):null,this.themeType=n.themeType}static define(t,n){return new AS(t,n||{})}}const SA=sn.define(),OQ=sn.define({combine(e){return e.length?[e[0]]:null}});function Kk(e){let t=e.facet(SA);return t.length?t:e.facet(OQ)}function BQ(e,t){let n=[v8e],r;return e instanceof AS&&(e.module&&n.push(It.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(OQ.of(e)):r?n.push(SA.computeN([It.darkTheme],s=>s.facet(It.darkTheme)==(r=="dark")?[e]:[])):n.push(SA.of(e)),n}function gyt(e,t,n){let r=Kk(e),s=null;if(r){for(let i of r)if(!i.scope||n){let o=i.style(t);o&&(s=s?s+" "+o:o)}}return s}class y8e{constructor(t){this.markCache=Object.create(null),this.tree=wo(t.state),this.decorations=this.buildDeco(t,Kk(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=wo(t.state),r=Kk(t.state),s=r!=Kk(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 vn.none;let r=new Zc;for(let{from:s,to:i}of t.visibleRanges)zTe(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=vn.mark({class:l})))},s,i);return r.finish()}}const v8e=vf.high(Fs.fromClass(y8e,{decorations:e=>e.decorations})),$Q=AS.define([{tag:Kt.meta,color:"#404740"},{tag:Kt.link,textDecoration:"underline"},{tag:Kt.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Kt.emphasis,fontStyle:"italic"},{tag:Kt.strong,fontWeight:"bold"},{tag:Kt.strikethrough,textDecoration:"line-through"},{tag:Kt.keyword,color:"#708"},{tag:[Kt.atom,Kt.bool,Kt.url,Kt.contentSeparator,Kt.labelName],color:"#219"},{tag:[Kt.literal,Kt.inserted],color:"#164"},{tag:[Kt.string,Kt.deleted],color:"#a11"},{tag:[Kt.regexp,Kt.escape,Kt.special(Kt.string)],color:"#e40"},{tag:Kt.definition(Kt.variableName),color:"#00f"},{tag:Kt.local(Kt.variableName),color:"#30a"},{tag:[Kt.typeName,Kt.namespace],color:"#085"},{tag:Kt.className,color:"#167"},{tag:[Kt.special(Kt.variableName),Kt.macroName],color:"#256"},{tag:Kt.definition(Kt.propertyName),color:"#00c"},{tag:Kt.comment,color:"#940"},{tag:Kt.invalid,color:"#f00"}]),x8e=It.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),zQ=1e4,FQ="()[]{}",qQ=sn.define({combine(e){return du(e,{afterCursor:!0,brackets:FQ,maxScanDistance:zQ,renderMatch:_8e})}}),w8e=vn.mark({class:"cm-matchingBracket"}),k8e=vn.mark({class:"cm-nonmatchingBracket"});function _8e(e){let t=[],n=e.matched?w8e:k8e;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function KB(e){let t=[],n=e.facet(qQ);for(let r of e.selection.ranges){if(!r.empty)continue;let s=Vc(e,r.head,-1,n)||r.head>0&&Vc(e,r.head-1,1,n)||n.afterCursor&&(Vc(e,r.head,1,n)||r.head<e.doc.length&&Vc(e,r.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e)))}return vn.set(t,!0)}const S8e=Fs.fromClass(class{constructor(e){this.paused=!1,this.decorations=KB(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=KB(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),C8e=[S8e,x8e];function T8e(e={}){return[qQ.of(e),C8e]}const A8e=new Dr;function CA(e,t,n){let r=e.prop(t<0?Dr.openedBy:Dr.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 TA(e){let t=e.type.prop(A8e);return t?t(e.node):e}function Vc(e,t,n,r={}){let s=r.maxScanDistance||zQ,i=r.brackets||FQ,o=wo(e),a=o.resolveInner(t,n);for(let l=a;l;l=l.parent){let u=CA(l.type,n,i);if(u&&l.from<l.to){let d=TA(l);if(d&&(n>0?t>=d.from&&t<d.to:t>d.from&&t<=d.to))return E8e(e,t,n,l,d,u,i)}}return M8e(e,t,n,o,a.type,s,i)}function E8e(e,t,n,r,s,i,o){let a=r.parent,l={from:s.from,to:s.to},u=0,d=a==null?void 0:a.cursor();if(d&&(n<0?d.childBefore(r.from):d.childAfter(r.to)))do if(n<0?d.to<=r.from:d.from>=r.to){if(u==0&&i.indexOf(d.type.name)>-1&&d.from<d.to){let h=TA(d);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(CA(d.type,n,o))u++;else if(CA(d.type,-n,o)){if(u==0){let h=TA(d);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}u--}}while(n<0?d.prevSibling():d.nextSibling());return{start:l,matched:!1}}function M8e(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 u={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let m=0;!d.next().done&&m<=i;){let p=d.value;n<0&&(m+=p.length);let g=t+m*n;for(let b=n>0?0:p.length-1,x=n>0?p.length:-1;b!=x;b+=n){let v=o.indexOf(p[b]);if(!(v<0||r.resolveInner(g+b,1).type!=s))if(v%2==0==n>0)h++;else{if(h==1)return{start:u,end:{from:g+b,to:g+b+1},matched:v>>1==l>>1};h--}}n>0&&(m+=p.length)}return d.done?{start:u,matched:!1}:null}const N8e=Object.create(null),YB=[zl.none],XB=[],QB=Object.create(null),j8e=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"]])j8e[e]=I8e(N8e,t);function T6(e,t){XB.indexOf(e)>-1||(XB.push(e),console.warn(t))}function I8e(e,t){let n=[];for(let a of t.split(" ")){let l=[];for(let u of a.split(".")){let d=e[u]||Kt[u];d?typeof d=="function"?l.length?l=l.map(d):T6(u,`Modifier ${u} used at start of tag`):l.length?T6(u,`Tag ${u} used as modifier`):l=Array.isArray(d)?d:[d]:T6(u,`Unknown highlighting tag ${u}`)}for(let u of l)n.push(u)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),s=r+" "+n.map(a=>a.id),i=QB[s];if(i)return i.id;let o=QB[s]=zl.define({id:YB.length,name:r,props:[BTe({[r]:n})]});return YB.push(o),o.id}xs.RTL,xs.LTR;const R8e=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=lN(e.state,n.from);return r.line?D8e(e):r.block?P8e(e):!1};function aN(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 D8e=aN($8e,0),L8e=aN(HQ,0),P8e=aN((e,t)=>HQ(e,t,B8e(t)),0);function lN(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Z1=50;function O8e(e,{open:t,close:n},r,s){let i=e.sliceDoc(r-Z1,r),o=e.sliceDoc(s,s+Z1),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(o)[0].length,u=i.length-a;if(i.slice(u-t.length,u)==t&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:s+l,margin:l&&1}};let d,h;s-r<=2*Z1?d=h=e.sliceDoc(r,s):(d=e.sliceDoc(r,r+Z1),h=e.sliceDoc(s-Z1,s));let m=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(h)[0].length,g=h.length-p-n.length;return d.slice(m,m+t.length)==t&&h.slice(g,g+n.length)==n?{open:{pos:r+m+t.length,margin:/\s/.test(d.charAt(m+t.length))?1:0},close:{pos:s-p-n.length,margin:/\s/.test(h.charAt(g-1))?1:0}}:null}function B8e(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 HQ(e,t,n=t.selection.ranges){let r=n.map(i=>lN(t,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,o)=>O8e(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:u,close:d}=a;i.push({from:u.pos-l.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:i}}return null}function $8e(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,u;for(let d=i;d<=o;){let h=t.doc.lineAt(d);if(u==null&&(u=lN(t,h.from).line,!u))continue e;if(h.from>s&&(i==o||o>h.from)){s=h.from;let m=/^\s*/.exec(h.text)[0].length,p=m==h.length,g=h.text.slice(m,m+u.length)==u?m:-1;m<h.text.length&&m<l&&(l=m),r.push({line:h,comment:g,token:u,indent:m,empty:p,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].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:u,empty:d,single:h}of r)(h||!d)&&i.push({from:a.from+u,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 u=o.from+a,d=u+l.length;o.text[d-o.from]==" "&&d++,i.push({from:u,to:d})}return{changes:i}}return null}const AA=_d.define(),z8e=_d.define(),F8e=sn.define(),UQ=sn.define({combine(e){return du(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)})}}),VQ=lo.define({create(){return Wc.empty},update(e,t){let n=t.state.facet(UQ),r=t.annotation(AA);if(r){let l=pa.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return l?d=I_(d,d.length,n.minDepth,l):d=KQ(d,t.startState.selection),new Wc(u==0?r.rest:d,u==0?d:r.rest)}let s=t.annotation(z8e);if((s=="full"||s=="before")&&(e=e.isolate()),t.annotation(Ei.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let i=pa.fromTransaction(t),o=t.annotation(Ei.time),a=t.annotation(Ei.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 Wc(e.done.map(pa.fromJSON),e.undone.map(pa.fromJSON))}});function cN(e={}){return[VQ,UQ.of(e),It.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?WQ:t.inputType=="historyRedo"?EA:null;return r?(t.preventDefault(),r(n)):!1}})]}function ES(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let s=n.field(VQ,!1);if(!s)return!1;let i=s.pop(e,n,t);return i?(r(i),!0):!1}}const WQ=ES(0,!1),EA=ES(1,!1),q8e=ES(0,!0),H8e=ES(1,!0);class pa{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 pa(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 pa(t.changes&&Ti.fromJSON(t.changes),[],t.mapped&&Qc.fromJSON(t.mapped),t.startSelection&&Xe.fromJSON(t.startSelection),t.selectionsAfter.map(Xe.fromJSON))}static fromTransaction(t,n){let r=Il;for(let s of t.startState.facet(F8e)){let i=s(t);i.length&&(r=r.concat(i))}return!r.length&&t.changes.empty?null:new pa(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Il)}static selection(t){return new pa(void 0,Il,void 0,void 0,t)}}function I_(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 U8e(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 u=n[l++],d=n[l++];a>=u&&o<=d&&(r=!0)}}),r}function V8e(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function GQ(e,t){return e.length?t.length?e.concat(t):e:t}const Il=[],W8e=200;function KQ(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-W8e));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),I_(e,e.length-1,1e9,n.setSelAfter(r)))}else return[pa.selection([t])]}function G8e(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 A6(e,t){if(!e.length)return e;let n=e.length,r=Il;for(;n;){let s=K8e(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?[pa.selection(r)]:Il}function K8e(e,t,n){let r=GQ(e.selectionsAfter.length?e.selectionsAfter.map(a=>a.map(t)):Il,n);if(!e.changes)return pa.selection(r);let s=e.changes.map(t),i=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(i):i;return new pa(s,Yn.mapEffects(e.effects,t),o,e.startSelection.map(i),r)}const Y8e=/^(input\.type|delete)($|\.)/;class Wc{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 Wc(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||Y8e.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(i,U8e(a.changes,t.changes))||r=="input.type.compose")?o=I_(o,o.length-1,s.minDepth,new pa(t.changes.compose(a.changes),GQ(Yn.mapEffects(t.effects,a.changes),a.effects),a.mapped,a.startSelection,Il)):o=I_(o,o.length,s.minDepth,t),new Wc(o,Il,n,r)}addSelection(t,n,r,s){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Il;return i.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&V8e(i[i.length-1],t)?this:new Wc(KQ(this.done,t),this.undone,n,r)}addMapping(t){return new Wc(A6(this.done,t),A6(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:AA.of({side:t,rest:G8e(s),selection:o}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=s.length==1?Il:s.slice(0,s.length-1);return i.mapped&&(a=A6(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:AA.of({side:t,rest:a,selection:o}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Wc.empty=new Wc(Il,Il);const uN=[{key:"Mod-z",run:WQ,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:EA,preventDefault:!0},{linux:"Ctrl-Shift-z",run:EA,preventDefault:!0},{key:"Mod-u",run:q8e,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:H8e,preventDefault:!0}];function e1(e,t){return Xe.create(e.ranges.map(t),e.mainIndex)}function ic(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function oc({state:e,dispatch:t},n){let r=e1(e.selection,n);return r.eq(e.selection,!0)?!1:(t(ic(e,r)),!0)}function MS(e,t){return Xe.cursor(t?e.to:e.from)}function YQ(e,t){return oc(e,n=>n.empty?e.moveByChar(n,t):MS(n,t))}function So(e){return e.textDirectionAt(e.state.selection.main.head)==xs.LTR}const XQ=e=>YQ(e,!So(e)),QQ=e=>YQ(e,So(e));function JQ(e,t){return oc(e,n=>n.empty?e.moveByGroup(n,t):MS(n,t))}const X8e=e=>JQ(e,!So(e)),Q8e=e=>JQ(e,So(e));function J8e(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 NS(e,t,n){let r=wo(e).resolveInner(t.head),s=n?Dr.closedBy:Dr.openedBy;for(let l=t.head;;){let u=n?r.childAfter(l):r.childBefore(l);if(!u)break;J8e(e,u,s)?r=u:l=n?u.to:u.from}let i=r.type.prop(s),o,a;return i&&(o=n?Vc(e,r.from,1):Vc(e,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,Xe.cursor(a,n?-1:1)}const Z8e=e=>oc(e,t=>NS(e.state,t,!So(e))),e7e=e=>oc(e,t=>NS(e.state,t,So(e)));function ZQ(e,t){return oc(e,n=>{if(!n.empty)return MS(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const eJ=e=>ZQ(e,!1),tJ=e=>ZQ(e,!0);function nJ(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,s;if(t){for(let i of e.state.facet(It.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 rJ(e,t){let n=nJ(e),{state:r}=e,s=e1(r.selection,o=>o.empty?e.moveVertically(o,t,n.height):MS(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,u=a.bottom-n.marginBottom;o&&o.top>l&&o.bottom<u&&(i=It.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-l}))}return e.dispatch(ic(r,s),{effects:i}),!0}const JB=e=>rJ(e,!1),MA=e=>rJ(e,!0);function xf(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=Xe.cursor(r.from+i))}return s}const t7e=e=>oc(e,t=>xf(e,t,!0)),n7e=e=>oc(e,t=>xf(e,t,!1)),r7e=e=>oc(e,t=>xf(e,t,!So(e))),s7e=e=>oc(e,t=>xf(e,t,So(e))),i7e=e=>oc(e,t=>Xe.cursor(e.lineBlockAt(t.head).from,1)),o7e=e=>oc(e,t=>Xe.cursor(e.lineBlockAt(t.head).to,-1));function a7e(e,t,n){let r=!1,s=e1(e.selection,i=>{let o=Vc(e,i.head,-1)||Vc(e,i.head,1)||i.head>0&&Vc(e,i.head-1,1)||i.head<e.doc.length&&Vc(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 Xe.cursor(a)});return r?(t(ic(e,s)),!0):!1}const l7e=({state:e,dispatch:t})=>a7e(e,t);function Fl(e,t){let n=e1(e.state.selection,r=>{let s=t(r);return Xe.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return n.eq(e.state.selection)?!1:(e.dispatch(ic(e.state,n)),!0)}function sJ(e,t){return Fl(e,n=>e.moveByChar(n,t))}const iJ=e=>sJ(e,!So(e)),oJ=e=>sJ(e,So(e));function aJ(e,t){return Fl(e,n=>e.moveByGroup(n,t))}const c7e=e=>aJ(e,!So(e)),u7e=e=>aJ(e,So(e)),d7e=e=>Fl(e,t=>NS(e.state,t,!So(e))),h7e=e=>Fl(e,t=>NS(e.state,t,So(e)));function lJ(e,t){return Fl(e,n=>e.moveVertically(n,t))}const cJ=e=>lJ(e,!1),uJ=e=>lJ(e,!0);function dJ(e,t){return Fl(e,n=>e.moveVertically(n,t,nJ(e).height))}const ZB=e=>dJ(e,!1),e$=e=>dJ(e,!0),f7e=e=>Fl(e,t=>xf(e,t,!0)),m7e=e=>Fl(e,t=>xf(e,t,!1)),p7e=e=>Fl(e,t=>xf(e,t,!So(e))),g7e=e=>Fl(e,t=>xf(e,t,So(e))),b7e=e=>Fl(e,t=>Xe.cursor(e.lineBlockAt(t.head).from)),y7e=e=>Fl(e,t=>Xe.cursor(e.lineBlockAt(t.head).to)),t$=({state:e,dispatch:t})=>(t(ic(e,{anchor:0})),!0),n$=({state:e,dispatch:t})=>(t(ic(e,{anchor:e.doc.length})),!0),r$=({state:e,dispatch:t})=>(t(ic(e,{anchor:e.selection.main.anchor,head:0})),!0),s$=({state:e,dispatch:t})=>(t(ic(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),v7e=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),x7e=({state:e,dispatch:t})=>{let n=jS(e).map(({from:r,to:s})=>Xe.range(r,Math.min(s+1,e.doc.length)));return t(e.update({selection:Xe.create(n),userEvent:"select"})),!0},w7e=({state:e,dispatch:t})=>{let n=e1(e.selection,r=>{let s=wo(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 Xe.range(a.to,a.from)}return r});return n.eq(e.selection)?!1:(t(ic(e,n)),!0)};function hJ(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(u=>u.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(ic(n,Xe.create(s,s.length-1))),!0)}const k7e=e=>hJ(e,!1),_7e=e=>hJ(e,!0),S7e=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Xe.create([n.main]):n.main.empty||(r=Xe.create([Xe.cursor(n.main.head)])),r?(t(ic(e,r)),!0):!1};function Uv(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=Dw(e,l,!1)):l>o&&(n="delete.forward",l=Dw(e,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=Dw(e,o,!1),a=Dw(e,a,!0);return o==a?{range:i}:{changes:{from:o,to:a},range:Xe.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"?It.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Dw(e,t,n){if(e instanceof It)for(let r of e.state.facet(It.atomicRanges).map(s=>s(e)))r.between(t,t,(s,i)=>{s<t&&i>t&&(t=n?i:s)});return t}const fJ=(e,t,n)=>Uv(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 u=Zg(a,i.tabSize),d=u%M_(i)||M_(i);for(let h=0;h<d&&a[a.length-1-h]==" ";h++)s--;l=s}else l=Ui(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=Ui(o.text,l-o.from,!1,!1)+o.from);return l}),NA=e=>fJ(e,!1,!0),mJ=e=>fJ(e,!0,!1),pJ=(e,t)=>Uv(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=Ui(i.text,r-i.from,t)+i.from,u=i.text.slice(Math.min(r,l)-i.from,Math.max(r,l)-i.from),d=o(u);if(a!=null&&d!=a)break;(u!=" "||r!=n.head)&&(a=d),r=l}return r}),gJ=e=>pJ(e,!1),C7e=e=>pJ(e,!0),T7e=e=>Uv(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),A7e=e=>Uv(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),E7e=e=>Uv(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),M7e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Wr.of(["",""])},range:Xe.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},N7e=({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:Ui(i.text,s-i.from,!1)+i.from,a=s==i.to?s+1:Ui(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:Xe.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function jS(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 bJ(e,t,n){if(e.readOnly)return!1;let r=[],s=[];for(let i of jS(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(Xe.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(Xe.range(l.anchor-a,l.head-a))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Xe.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const j7e=({state:e,dispatch:t})=>bJ(e,t,!1),I7e=({state:e,dispatch:t})=>bJ(e,t,!0);function yJ(e,t,n){if(e.readOnly)return!1;let r=[];for(let i of jS(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 R7e=({state:e,dispatch:t})=>yJ(e,t,!1),D7e=({state:e,dispatch:t})=>yJ(e,t,!0),L7e=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(jS(t).map(({from:s,to:i})=>(s>0?s--:i<t.doc.length&&i++,{from:s,to:i}))),r=e1(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 P7e(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=wo(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(Dr.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 i$=vJ(!1),O7e=vJ(!0);function vJ(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&&P7e(t,i);e&&(i=o=(o<=a.to?a:t.doc.lineAt(o)).to);let u=new CS(t,{simulateBreak:i,simulateDoubleBreak:!!l}),d=iN(u,i);for(d==null&&(d=Zg(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:i,to:o}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let h=["",Qy(t,d)];return l&&h.push(Qy(t,u.lineIndent(a.from,-1))),{changes:{from:i,to:o,insert:Wr.of(h)},range:Xe.cursor(i+1+h[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function dN(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:Xe.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const B7e=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new CS(e,{overrideIndentation:i=>{let o=n[i];return o??-1}}),s=dN(e,(i,o,a)=>{let l=iN(r,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let u=/^\s*/.exec(i.text)[0],d=Qy(e,l);(u!=d||a.from<i.from+u.length)&&(n[i.from]=l,o.push({from:i.from,to:i.from+u.length,insert:d}))});return s.changes.empty||t(e.update(s,{userEvent:"indent"})),!0},$7e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(dN(e,(n,r)=>{r.push({from:n.from,insert:e.facet(sN)})}),{userEvent:"input.indent"})),!0),z7e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(dN(e,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Zg(s,e.tabSize),o=0,a=Qy(e,Math.max(0,i-M_(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),F7e=e=>(e.setTabFocusMode(),!0),q7e=[{key:"Ctrl-b",run:XQ,shift:iJ,preventDefault:!0},{key:"Ctrl-f",run:QQ,shift:oJ},{key:"Ctrl-p",run:eJ,shift:cJ},{key:"Ctrl-n",run:tJ,shift:uJ},{key:"Ctrl-a",run:i7e,shift:b7e},{key:"Ctrl-e",run:o7e,shift:y7e},{key:"Ctrl-d",run:mJ},{key:"Ctrl-h",run:NA},{key:"Ctrl-k",run:T7e},{key:"Ctrl-Alt-h",run:gJ},{key:"Ctrl-o",run:M7e},{key:"Ctrl-t",run:N7e},{key:"Ctrl-v",run:MA}],H7e=[{key:"ArrowLeft",run:XQ,shift:iJ,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:X8e,shift:c7e,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:r7e,shift:p7e,preventDefault:!0},{key:"ArrowRight",run:QQ,shift:oJ,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Q8e,shift:u7e,preventDefault:!0},{mac:"Cmd-ArrowRight",run:s7e,shift:g7e,preventDefault:!0},{key:"ArrowUp",run:eJ,shift:cJ,preventDefault:!0},{mac:"Cmd-ArrowUp",run:t$,shift:r$},{mac:"Ctrl-ArrowUp",run:JB,shift:ZB},{key:"ArrowDown",run:tJ,shift:uJ,preventDefault:!0},{mac:"Cmd-ArrowDown",run:n$,shift:s$},{mac:"Ctrl-ArrowDown",run:MA,shift:e$},{key:"PageUp",run:JB,shift:ZB},{key:"PageDown",run:MA,shift:e$},{key:"Home",run:n7e,shift:m7e,preventDefault:!0},{key:"Mod-Home",run:t$,shift:r$},{key:"End",run:t7e,shift:f7e,preventDefault:!0},{key:"Mod-End",run:n$,shift:s$},{key:"Enter",run:i$,shift:i$},{key:"Mod-a",run:v7e},{key:"Backspace",run:NA,shift:NA,preventDefault:!0},{key:"Delete",run:mJ,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:gJ,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:C7e,preventDefault:!0},{mac:"Mod-Backspace",run:A7e,preventDefault:!0},{mac:"Mod-Delete",run:E7e,preventDefault:!0}].concat(q7e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),hN=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Z8e,shift:d7e},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e7e,shift:h7e},{key:"Alt-ArrowUp",run:j7e},{key:"Shift-Alt-ArrowUp",run:R7e},{key:"Alt-ArrowDown",run:I7e},{key:"Shift-Alt-ArrowDown",run:D7e},{key:"Mod-Alt-ArrowUp",run:k7e},{key:"Mod-Alt-ArrowDown",run:_7e},{key:"Escape",run:S7e},{key:"Mod-Enter",run:O7e},{key:"Alt-l",mac:"Ctrl-l",run:x7e},{key:"Mod-i",run:w7e,preventDefault:!0},{key:"Mod-[",run:z7e},{key:"Mod-]",run:$7e},{key:"Mod-Alt-\\",run:B7e},{key:"Shift-Mod-k",run:L7e},{key:"Shift-Mod-\\",run:l7e},{key:"Mod-/",run:R8e},{key:"Alt-A",run:L8e},{key:"Ctrl-m",mac:"Shift-Alt-m",run:F7e}].concat(H7e);class xJ{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=wo(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(wJ(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 o$(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 U7e(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=o$(t)+o$(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function V7e(e){let t=e.map(s=>typeof s=="string"?{label:s}:s),[n,r]=t.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:U7e(t);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:t,validFor:n}:null}}class a${constructor(t,n,r,s){this.completion=t,this.source=n,this.match=r,this.score=s}}function Bm(e){return e.selection.main.from}function wJ(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 kJ=_d.define();function W7e(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:Xe.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const l$=new WeakMap;function G7e(e){if(!Array.isArray(e))return e;let t=l$.get(e);return t||l$.set(e,t=V7e(e)),t}const R_=Yn.define(),Jy=Yn.define();class K7e{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=ha(t,n),s=Lc(r);this.chars.push(r);let i=t.slice(n,n+s),o=i.toUpperCase();this.folded.push(ha(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 y=ha(t,0),w=Lc(y),k=w==t.length?0:-100;if(y!=n[0])if(y==r[0])k+=-200;else return null;return this.ret(k,[0,w])}let a=t.indexOf(this.pattern);if(a==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,u=0;if(a<0){for(let y=0,w=Math.min(t.length,200);y<w&&u<l;){let k=ha(t,y);(k==n[u]||k==r[u])&&(s[u++]=y),y+=Lc(k)}if(u<l)return null}let d=0,h=0,m=!1,p=0,g=-1,b=-1,x=/[a-z]/.test(t),v=!0;for(let y=0,w=Math.min(t.length,200),k=0;y<w&&h<l;){let T=ha(t,y);a<0&&(d<l&&T==n[d]&&(i[d++]=y),p<l&&(T==n[p]||T==r[p]?(p==0&&(g=y),b=y+1,p++):p=0));let S,C=T<255?T>=48&&T<=57||T>=97&&T<=122?2:T>=65&&T<=90?1:0:(S=PM(T))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!y||C==1&&x||k==0&&C!=0)&&(n[h]==T||r[h]==T&&(m=!0)?o[h++]=y:o.length&&(v=!1)),k=C,y+=Lc(T)}return h==l&&o[0]==0&&v?this.result(-100+(m?-200:0),o,t):p==l&&g==0?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):a>-1?this.ret(-700-t.length,[a,a+this.pattern.length]):p==l?this.ret(-900-t.length,[g,b]):h==l?this.result(-100+(m?-200:0)+-700+(v?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?Lc(ha(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 Y7e{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 Hi=sn.define({combine(e){return du(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:X7e,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 X7e(e,t,n,r,s,i){let o=e.textDirection==xs.RTL,a=o,l=!1,u="top",d,h,m=t.left-s.left,p=s.right-t.right,g=r.right-r.left,b=r.bottom-r.top;if(a&&m<Math.min(g,p)?a=!1:!a&&p<Math.min(g,m)&&(a=!0),g<=(a?m:p))d=Math.max(s.top,Math.min(n.top,s.bottom-b))-t.top,h=Math.min(400,a?m:p);else{l=!0,h=Math.min(400,(o?t.right:s.right-t.left)-30);let y=s.bottom-t.bottom;y>=b||y>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let x=(t.bottom-t.top)/i.offsetHeight,v=(t.right-t.left)/i.offsetWidth;return{style:`${u}: ${d/x}px; max-width: ${h/v}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}const fN=Yn.define();function Q7e(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 u=0;u<i.length;){let d=i[u++],h=i[u++];d>l&&o.appendChild(document.createTextNode(a.slice(l,d)));let m=o.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(a.slice(d,h))),m.className="cm-completionMatchedText",l=h}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(n){if(!n.detail)return null;let 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 E6(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 J7e{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(Hi);this.optionContent=Q7e(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=E6(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:u}=t.state.field(n).open;for(let d=l.target,h;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(h=/-(\d+)$/.exec(d.id))&&+h[1]<u.length){this.applyCompletion(t,u[+h[1]]),l.preventDefault();return}if(l.target==this.list){let d=this.list.classList.contains("cm-completionListIncompleteTop")&&l.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&l.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:fN.of(d)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Hi).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:Jy.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=E6(i.length,o,t.state.facet(Hi).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=E6(n.options.length,n.selected,this.view.state.facet(Hi).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=>ma(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&&eAe(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(Hi).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:u}=a;if(u){let m=typeof u=="string"?u:u.name;if(m!=i&&(o>r.from||r.from==0))if(i=m,typeof u!="string"&&u.header)s.appendChild(u.header(u));else{let p=s.appendChild(document.createElement("completion-section"));p.textContent=m}}const d=s.appendChild(document.createElement("li"));d.id=n+"-"+o,d.setAttribute("role","option");let h=this.optionClass(a);h&&(d.className=h);for(let m of this.optionContent){let p=m(a,this.view.state,this.view,l);p&&d.appendChild(p)}}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 Z7e(e,t){return n=>new J7e(n,e,t)}function eAe(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 u$(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function tAe(e,t){let n=[],r=null,s=null,i=d=>{n.push(d);let{section:h}=d.completion;if(h){r||(r=[]);let m=typeof h=="string"?h:h.name;r.some(p=>p.name==m)||r.push(typeof h=="string"?{name:m}:h)}},o=t.facet(Hi);for(let d of e)if(d.hasResult()){let h=d.result.getMatch;if(d.result.filter===!1)for(let m of d.result.options)i(new a$(m,d.source,h?h(m):[],1e9-n.length));else{let m=t.sliceDoc(d.from,d.to),p,g=o.filterStrict?new Y7e(m):new K7e(m);for(let b of d.result.options)if(p=g.match(b.label)){let x=b.displayLabel?h?h(b,p.matched):[]:p.matched,v=p.score+(b.boost||0);if(i(new a$(b,d.source,x,v)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:y}=b.section;s||(s=Object.create(null)),s[y]=Math.max(v,s[y]||-1e9)}}}}if(r){let d=Object.create(null),h=0,m=(p,g)=>(p.rank==="dynamic"&&g.rank==="dynamic"?s[g.name]-s[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(p.name<g.name?-1:1);for(let p of r.sort(m))h-=1e5,d[p.name]=h;for(let p of n){let{section:g}=p.completion;g&&(p.score+=d[typeof g=="string"?g:g.name])}}let a=[],l=null,u=o.compareCompletions;for(let d of n.sort((h,m)=>m.score-h.score||u(h.completion,m.completion))){let h=d.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?a.push(d):u$(d.completion)>u$(l)&&(a[a.length-1]=d),l=d.completion}return a}class S0{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 S0(this.options,d$(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,s,i,o){if(s&&!o&&t.some(u=>u.isPending))return s.setDisabled();let a=tAe(t,n);if(!a.length)return s&&t.some(u=>u.isPending)?s.setDisabled():null;let l=n.facet(Hi).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let u=s.options[s.selected].completion;for(let d=0;d<a.length;d++)if(a[d].completion==u){l=d;break}}return new S0(a,d$(r,l),{pos:t.reduce((u,d)=>d.hasResult()?Math.min(u,d.from):u,1e8),create:aAe,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(t){return new S0(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new S0(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class D_{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new D_(iAe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Hi),i=(r.override||n.languageDataAt("autocomplete",Bm(n)).map(G7e)).map(l=>(this.active.find(d=>d.source==l)||new Rl(l,this.active.some(d=>d.state!=0)?1:0)).update(t,r));i.length==this.active.length&&i.every((l,u)=>l==this.active[u])&&(i=this.active);let o=this.open,a=t.effects.some(l=>l.is(mN));o&&t.docChanged&&(o=o.map(t.changes)),t.selection||i.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!nAe(i,this.active)||a?o=S0.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 Rl(l.source,0):l));for(let l of t.effects)l.is(fN)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new D_(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?rAe:sAe}}function nAe(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 rAe={"aria-autocomplete":"list"},sAe={};function d$(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const iAe=[];function _J(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(kJ);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 Rl{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=_J(t,n),s=this;(r&8||r&16&&this.touches(t))&&(s=new Rl(s.source,0)),r&4&&s.state==0&&(s=new Rl(this.source,1)),s=s.updateFor(t,r);for(let i of t.effects)if(i.is(R_))s=new Rl(s.source,1,i.value);else if(i.is(Jy))s=new Rl(s.source,0);else if(i.is(mN))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(Bm(t.state))}}class G0 extends Rl{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=Bm(t.state);if(a>o||!s||n&2&&(Bm(t.startState)==this.from||a<this.limit))return new Rl(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return oAe(s.validFor,t.state,i,o)?new G0(this.source,this.explicit,l,s,i,o):s.update&&(s=s.update(s,i,o,new xJ(t.state,a,!1)))?new G0(this.source,this.explicit,l,s,s.from,(r=s.to)!==null&&r!==void 0?r:Bm(t.state)):new Rl(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 G0(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Rl(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function oAe(e,t,n,r){if(!e)return!1;let s=t.sliceDoc(n,r);return typeof e=="function"?e(s,n,r,t):wJ(e,!0).test(s)}const mN=Yn.define({map(e,t){return e.map(n=>n.map(t))}}),$o=lo.define({create(){return D_.start()},update(e,t){return e.update(t)},provide:e=>[ZM.from(e,t=>t.tooltip),It.contentAttributes.from(e,t=>t.attrs)]});function pN(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field($o).active.find(s=>s.source==t.source);return r instanceof G0?(typeof n=="string"?e.dispatch({...W7e(e.state,n,r.from,r.to),annotations:kJ.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const aAe=Z7e($o,pN);function Ch(e,t="option"){return n=>{let r=n.state.field($o,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Hi).interactionDelay)return!1;let s=1,i;t=="page"&&(i=bQ(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:fN.of(a)}),!0}}const SJ=e=>{let t=e.state.field($o,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Hi).interactionDelay?!1:pN(e,t.open.options[t.open.selected])},Yk=e=>e.state.field($o,!1)?(e.dispatch({effects:R_.of(!0)}),!0):!1,Xk=e=>{let t=e.state.field($o,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Jy.of(null)}),!0)};class lAe{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const cAe=50,uAe=1e3,dAe=Fs.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($o).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field($o),n=e.state.facet(Hi);if(!e.selectionSet&&!e.docChanged&&e.startState.field($o)==t)return;let r=e.transactions.some(i=>{let o=_J(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>cAe&&Date.now()-o.time>uAe){for(let a of o.context.abortListeners)try{a()}catch(l){ma(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(R_)))&&(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($o);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(Hi).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Bm(t),r=new xJ(t,n,e.explicit,this.view),s=new lAe(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:Jy.of(null)}),ma(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(Hi).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Hi),r=this.view.state.field($o);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=Bm(i.updates.length?i.updates[0].startState:this.view.state),l=Math.min(a,i.done.from+(i.active.explicit?0:1)),u=new G0(i.active.source,i.active.explicit,l,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:a);for(let d of i.updates)u=u.update(d,n);if(u.hasResult()){t.push(u);continue}}let o=r.active.find(a=>a.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new Rl(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:mN.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field($o,!1);if(t&&t.tooltip&&this.view.state.facet(Hi).closeOnBlur){let n=t.open&&bQ(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Jy.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:R_.of(!1)}),20),this.composing=0}}}),hAe=typeof navigator=="object"&&/Win/.test(navigator.platform),fAe=vf.highest(It.domEventHandlers({keydown(e,t){let n=t.state.field($o,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(hAe&&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&&pN(t,r),!1}})),mAe=It.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"}}}),Zy={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Sm=Yn.define({map(e,t){let n=t.mapPos(e,-1,Fo.TrackAfter);return n??void 0}}),gN=new class extends Zh{};gN.startSide=1;gN.endSide=-1;const CJ=lo.define({create(){return _r.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of t.effects)n.is(Sm)&&(e=e.update({add:[gN.range(n.value,n.value+1)]}));return e}});function pAe(){return[bAe,CJ]}const M6="()[]{}<>«»»«［］｛｝";function TJ(e){for(let t=0;t<M6.length;t+=2)if(M6.charCodeAt(t)==e)return M6.charAt(t+1);return PM(e<128?e:e+1)}function AJ(e,t){return e.languageDataAt("closeBrackets",t)[0]||Zy}const gAe=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),bAe=It.inputHandler.of((e,t,n,r)=>{if((gAe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let s=e.state.selection.main;if(r.length>2||r.length==2&&Lc(ha(r,0))==1||t!=s.from||n!=s.to)return!1;let i=xAe(e.state,r);return i?(e.dispatch(i),!0):!1}),yAe=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=AJ(e,e.selection.main.head).brackets||Zy.brackets,s=null,i=e.changeByRange(o=>{if(o.empty){let a=wAe(e.doc,o.head);for(let l of r)if(l==a&&IS(e.doc,o.head)==TJ(ha(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:Xe.cursor(o.head-l.length)}}return{range:s=o}});return s||t(e.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},vAe=[{key:"Backspace",run:yAe}];function xAe(e,t){let n=AJ(e,e.selection.main.head),r=n.brackets||Zy.brackets;for(let s of r){let i=TJ(ha(s,0));if(t==s)return i==s?SAe(e,s,r.indexOf(s+s+s)>-1,n):kAe(e,s,i,n.before||Zy.before);if(t==i&&EJ(e,e.selection.main.from))return _Ae(e,s,i)}return null}function EJ(e,t){let n=!1;return e.field(CJ).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function IS(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Lc(ha(n,0)))}function wAe(e,t){let n=e.sliceString(t-2,t);return Lc(ha(n,0))==n.length?n:n.slice(1)}function kAe(e,t,n,r){let s=null,i=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:Sm.of(o.to+t.length),range:Xe.range(o.anchor+t.length,o.head+t.length)};let a=IS(e.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:t+n,from:o.head},effects:Sm.of(o.head+t.length),range:Xe.cursor(o.head+t.length)}:{range:s=o}});return s?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function _Ae(e,t,n){let r=null,s=e.changeByRange(i=>i.empty&&IS(e.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Xe.cursor(i.head+n.length)}:r={range:i});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function SAe(e,t,n,r){let s=r.stringPrefixes||Zy.stringPrefixes,i=null,o=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:t,from:a.to}],effects:Sm.of(a.to+t.length),range:Xe.range(a.anchor+t.length,a.head+t.length)};let l=a.head,u=IS(e.doc,l),d;if(u==t){if(h$(e,l))return{changes:{insert:t+t,from:l},effects:Sm.of(l+t.length),range:Xe.cursor(l+t.length)};if(EJ(e,l)){let m=n&&e.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+m.length,insert:m},range:Xe.cursor(l+m.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(d=f$(e,l-2*t.length,s))>-1&&h$(e,d))return{changes:{insert:t+t+t+t,from:l},effects:Sm.of(l+t.length),range:Xe.cursor(l+t.length)};if(e.charCategorizer(l)(u)!=$s.Word&&f$(e,l,s)>-1&&!CAe(e,l,t,s))return{changes:{insert:t+t,from:l},effects:Sm.of(l+t.length),range:Xe.cursor(l+t.length)}}return{range:i=a}});return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function h$(e,t){let n=wo(e).resolveInner(t+1);return n.parent&&n.from==t}function CAe(e,t,n,r){let s=wo(e).resolveInner(t,-1),i=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=e.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let d=s.firstChild;for(;d&&d.from==s.from&&d.to-d.from>n.length+l;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=s.to==t&&s.parent;if(!u)break;s=u}return!1}function f$(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=$s.Word)return t;for(let s of n){let i=t-s.length;if(e.sliceDoc(i,t)==s&&r(e.sliceDoc(i-1,i))!=$s.Word)return i}return-1}function MJ(e={}){return[fAe,$o,Hi.of(e),dAe,TAe,mAe]}const NJ=[{key:"Ctrl-Space",run:Yk},{mac:"Alt-`",run:Yk},{mac:"Alt-i",run:Yk},{key:"Escape",run:Xk},{key:"ArrowDown",run:Ch(!0)},{key:"ArrowUp",run:Ch(!1)},{key:"PageDown",run:Ch(!0,"page")},{key:"PageUp",run:Ch(!1,"page")},{key:"Enter",run:SJ}],TAe=vf.highest(kg.computeN([Hi],e=>e.facet(Hi).defaultKeymap?[NJ]:[]));function Na(e){let t=e.field($o,!1);return t&&t.active.some(n=>n.isPending)?"pending":t&&t.active.some(n=>n.state!=0)?"active":null}const m$=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Cg{constructor(t,n,r=0,s=t.length,i,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,s),this.bufferStart=r,this.normalize=i?a=>i(m$(a)):m$,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ha(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=PM(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Lc(t);let s=this.normalize(n);if(s.length)for(let i=0,o=r,a=!0;;i++){let l=s.charCodeAt(i),u=this.match(l,o,a,this.bufferPos+this.bufferStart,i==s.length-1);if(u)return this.value=u,this;if(i==s.length-1)break;a&&i<n.length&&n.charCodeAt(i)==l?o++:a=!1}}}match(t,n,r,s,i){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],u=!1;this.query.charCodeAt(l.index)==t&&(l.index==this.query.length-1?o={from:l.from,to:s,precise:i&&l.precise}:(l.index++,u=!0)),u?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:n,to:s,precise:r&&i}:this.matches.push({from:n,index:1,precise:r})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Cg.prototype[Symbol.iterator]=function(){return this});const jJ={from:-1,to:-1,match:/.*/.exec(""),precise:!0},bN="gm"+(/x/.unicode==null?"":"u");class IJ{constructor(t,n,r,s=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=jJ,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new RJ(t,n,r,s,i);this.re=new RegExp(n,bN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=t.iter();let o=t.lineAt(s);this.curLineStart=o.from,this.matchPos=L_(t,s),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=L_(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<s||r>this.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,precise:!0,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const N6=new WeakMap;class K0{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let s=N6.get(t);if(!s||s.from>=r||s.to<=n){let a=new K0(n,t.sliceString(n,r));return N6.set(t,a),a}if(s.from==n&&s.to==r)return s;let{text:i,from:o}=s;return o>n&&(i=t.sliceString(n,o)+i,o=n),s.to<r&&(i+=t.sliceString(s.to,r)),N6.set(t,new K0(o,i)),new K0(n,i.slice(n-o,r-o))}}class RJ{constructor(t,n,r,s,i){this.text=t,this.to=i,this.done=!1,this.value=jJ,this.matchPos=L_(t,s),this.re=new RegExp(n,bN+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=K0.get(t,s,this.chunkEnd(s+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,precise:!0,match:n},this.matchPos=L_(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=K0.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(IJ.prototype[Symbol.iterator]=RJ.prototype[Symbol.iterator]=function(){return this});function AAe(e){try{return new RegExp(e,bN),!0}catch{return!1}}function L_(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}const EAe=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:s}=uTe(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return s.then(i=>{let o=i&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(i.elements.line.value);if(!o){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,l,u,d,h]=o,m=d?+d.slice(1):0,p=u?+u:a.number;if(u&&h){let x=p/100;l&&(x=x*(l=="-"?-1:1)+a.number/t.doc.lines),p=Math.round(t.doc.lines*x)}else u&&l&&(p=p*(l=="-"?-1:1)+a.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),b=Xe.cursor(g.from+Math.max(0,Math.min(m,g.length)));e.dispatch({effects:[r,It.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},MAe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},NAe=sn.define({combine(e){return du(e,MAe,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function jAe(e){return[PAe,LAe]}const IAe=vn.mark({class:"cm-selectionMatch"}),RAe=vn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function p$(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=$s.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=$s.Word)}function DAe(e,t,n,r){return e(t.sliceDoc(n,n+1))==$s.Word&&e(t.sliceDoc(r-1,r))==$s.Word}const LAe=Fs.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(NAe),{state:n}=e,r=n.selection;if(r.ranges.length>1)return vn.none;let s=r.main,i,o=null;if(s.empty){if(!t.highlightWordAroundCursor)return vn.none;let l=n.wordAt(s.head);if(!l)return vn.none;o=n.charCategorizer(s.head),i=n.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l<t.minSelectionLength||l>200)return vn.none;if(t.wholeWords){if(i=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!(p$(o,n,s.from,s.to)&&DAe(o,n,s.from,s.to)))return vn.none}else if(i=n.sliceDoc(s.from,s.to),!i)return vn.none}let a=[];for(let l of e.visibleRanges){let u=new Cg(n.doc,i,l.from,l.to);for(;!u.next().done;){let{from:d,to:h}=u.value;if((!o||p$(o,n,d,h))&&(s.empty&&d<=s.from&&h>=s.to?a.push(RAe.range(d,h)):(d>=s.to||h<=s.from)&&a.push(IAe.range(d,h)),a.length>t.maxMatches))return vn.none}}return vn.set(a)}},{decorations:e=>e.decorations}),PAe=It.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),OAe=({state:e,dispatch:t})=>{let{selection:n}=e,r=Xe.create(n.ranges.map(s=>e.wordAt(s.head)||Xe.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function BAe(e,t){let{main:n,ranges:r}=e.selection,s=e.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let o=!1,a=new Cg(e.doc,t,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Cg(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(i){let l=e.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const $Ae=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(i=>i.from===i.to))return OAe({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=r))return!1;let s=BAe(e,r);return s?(t(e.update({selection:e.selection.addRange(Xe.range(s.from,s.to),!1),effects:It.scrollIntoView(s.to)})),!0):!1},t1=sn.define({combine(e){return du(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new ZAe(t),scrollToMatch:t=>It.scrollIntoView(t)})}});class DJ{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||AAe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
`:r=="r"?"\r":r=="t"?"	":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new VAe(this):new qAe(this)}getCursor(t,n=0,r){let s=t.doc?t:Ir.create({doc:t});return r==null&&(r=s.doc.length),this.regexp?l0(this,s,n,r):a0(this,s,n,r)}}class LJ{constructor(t){this.spec=t}}function zAe(e,t,n){return(r,s,i,o)=>{if(n&&!n(r,s,i,o))return!1;let a=r>=o&&s<=o+i.length?i.slice(r-o,s-o):t.doc.sliceString(r,s);return e(a,t,r,s)}}function a0(e,t,n,r){let s;return e.wholeWord&&(s=FAe(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(s=zAe(e.test,t,s)),new Cg(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:i=>i.toLowerCase(),s)}function FAe(e,t){return(n,r,s,i)=>((i>n||i+s.length<r)&&(i=Math.max(0,n-2),s=e.sliceString(i,Math.min(e.length,r+2))),(t(P_(s,n-i))!=$s.Word||t(O_(s,n-i))!=$s.Word)&&(t(O_(s,r-i))!=$s.Word||t(P_(s,r-i))!=$s.Word))}class qAe extends LJ{constructor(t){super(t)}nextMatch(t,n,r){let s=a0(this.spec,t,r,t.doc.length).nextOverlapping();if(s.done){let i=Math.min(t.doc.length,n+this.spec.unquoted.length);s=a0(this.spec,t,0,i).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==r?null:s.value}prevMatchInRange(t,n,r){for(let s=r;;){let i=Math.max(n,s-1e4-this.spec.unquoted.length),o=a0(this.spec,t,i,s),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(i==n)return null;s-=1e4}}prevMatch(t,n,r){let s=this.prevMatchInRange(t,0,n);return s||(s=this.prevMatchInRange(t,Math.max(0,r-this.spec.unquoted.length),t.doc.length)),s&&(s.from!=n||s.to!=r)?s:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let r=a0(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let i=a0(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function HAe(e,t,n){return(r,s,i)=>(!n||n(r,s,i))&&e(i[0],t,r,s)}function l0(e,t,n,r){let s;return e.wholeWord&&(s=UAe(t.charCategorizer(t.selection.main.head))),e.test&&(s=HAe(e.test,t,s)),new IJ(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},n,r)}function P_(e,t){return e.slice(Ui(e,t,!1),t)}function O_(e,t){return e.slice(t,Ui(e,t))}function UAe(e){return(t,n,r)=>!r[0].length||(e(P_(r.input,r.index))!=$s.Word||e(O_(r.input,r.index))!=$s.Word)&&(e(O_(r.input,r.index+r[0].length))!=$s.Word||e(P_(r.input,r.index+r[0].length))!=$s.Word)}class VAe extends LJ{nextMatch(t,n,r){let s=l0(this.spec,t,r,t.doc.length).next();return s.done&&(s=l0(this.spec,t,0,n).next()),s.done?null:s.value}prevMatchInRange(t,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),o=l0(this.spec,t,i,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==n||a.from>i+10))return a;if(i==n)return null}}prevMatch(t,n,r){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return t.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i<t.match.length)return t.match[i]+r.slice(s)}return n})}matchAll(t,n){let r=l0(this.spec,t,0,t.doc.length),s=[];for(;!r.next().done;){if(s.length>=n)return null;s.push(r.value)}return s}highlight(t,n,r,s){let i=l0(this.spec,t,Math.max(0,n-250),Math.min(r+250,t.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const ev=Yn.define(),yN=Yn.define(),Bh=lo.define({create(e){return new j6(jA(e).create(),null)},update(e,t){for(let n of t.effects)n.is(ev)?e=new j6(n.value.create(),e.panel):n.is(yN)&&(e=new j6(e.query,n.value?vN:null));return e},provide:e=>Ky.from(e,t=>t.panel)});class j6{constructor(t,n){this.query=t,this.panel=n}}const WAe=vn.mark({class:"cm-searchMatch"}),GAe=vn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),KAe=Fs.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Bh))}update(e){let t=e.state.field(Bh);(t!=e.startState.field(Bh)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return vn.none;let{view:n}=this,r=new Zc;for(let s=0,i=n.visibleRanges,o=i.length;s<o;s++){let{from:a,to:l}=i[s];for(;s<o-1&&l>i[s+1].from-2*250;)l=i[++s].to;e.highlight(n.state,a,l,(u,d)=>{let h=n.state.selection.ranges.some(m=>m.from==u&&m.to==d);r.add(u,d,h?GAe:WAe)})}return r.finish()}},{decorations:e=>e.decorations});function Vv(e){return t=>{let n=t.state.field(Bh,!1);return n&&n.query.spec.valid?e(t,n):BJ(t)}}const B_=Vv((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let s=Xe.single(r.from,r.to),i=e.state.facet(t1);return e.dispatch({selection:s,effects:[xN(e,r),i.scrollToMatch(s.main,e)],userEvent:"select.search"}),OJ(e),!0}),$_=Vv((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,s=t.prevMatch(n,r,r);if(!s)return!1;let i=Xe.single(s.from,s.to),o=e.state.facet(t1);return e.dispatch({selection:i,effects:[xN(e,s),o.scrollToMatch(i.main,e)],userEvent:"select.search"}),OJ(e),!0}),YAe=Vv((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Xe.create(n.map(r=>Xe.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),XAe=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],o=0;for(let a=new Cg(e.doc,e.sliceDoc(r,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==r&&(o=i.length),i.push(Xe.range(a.value.from,a.value.to))}return t(e.update({selection:Xe.create(i,o),userEvent:"select.search.matches"})),!0},g$=Vv((e,{query:t})=>{let{state:n}=e,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=t.nextMatch(n,r,r);if(!i)return!1;let o=i,a=[],l,u,d=[];o.precise?o.from==r&&o.to==s&&(u=n.toText(t.getReplacement(o)),a.push({from:o.from,to:o.to,insert:u}),d.push(It.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=t.nextMatch(n,o.from,o.to);let h=e.state.changes(a);return o&&(l=Xe.single(o.from,o.to).map(h),d.push(xN(e,o)),d.push(n.facet(t1).scrollToMatch(l.main,e))),e.dispatch({changes:h,selection:l,effects:d,userEvent:"input.replace"}),!0}),QAe=Vv((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let s of t.matchAll(e.state,1e9)){let{from:i,to:o,precise:a}=s;a&&n.push({from:i,to:o,insert:t.getReplacement(s)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:It.announce.of(r),userEvent:"input.replace.all"}),!0});function vN(e){return e.state.facet(t1).createPanel(e)}function jA(e,t){var n,r,s,i,o;let a=e.selection.main,l=a.empty||a.to>a.from+100?"":e.sliceDoc(a.from,a.to);if(t&&!l)return t;let u=e.facet(t1);return new DJ({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=t==null?void 0:t.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(s=t==null?void 0:t.literal)!==null&&s!==void 0?s:u.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:u.regexp,wholeWord:(o=t==null?void 0:t.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function PJ(e){let t=eN(e,vN);return t&&t.dom.querySelector("[main-field]")}function OJ(e){let t=PJ(e);t&&t==e.root.activeElement&&t.select()}const BJ=e=>{let t=e.state.field(Bh,!1);if(t&&t.panel){let n=PJ(e);if(n&&n!=e.root.activeElement){let r=jA(e.state,t.query.spec);r.valid&&e.dispatch({effects:ev.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[yN.of(!0),t?ev.of(jA(e.state,t.query.spec)):Yn.appendConfig.of(tEe)]});return!0},$J=e=>{let t=e.state.field(Bh,!1);if(!t||!t.panel)return!1;let n=eN(e,vN);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:yN.of(!1)}),!0},JAe=[{key:"Mod-f",run:BJ,scope:"editor search-panel"},{key:"F3",run:B_,shift:$_,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:B_,shift:$_,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:$J,scope:"editor search-panel"},{key:"Mod-Shift-l",run:XAe},{key:"Mod-Alt-g",run:EAe},{key:"Mod-d",run:$Ae,preventDefault:!0}];class ZAe{constructor(t){this.view=t;let n=this.query=t.state.field(Bh).query.spec;this.commit=this.commit.bind(this),this.searchField=fs("input",{value:n.search,placeholder:ja(t,"Find"),"aria-label":ja(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=fs("input",{value:n.replace,placeholder:ja(t,"Replace"),"aria-label":ja(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=fs("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=fs("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=fs("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,o){return fs("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=fs("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>B_(t),[ja(t,"next")]),r("prev",()=>$_(t),[ja(t,"previous")]),r("select",()=>YAe(t),[ja(t,"all")]),fs("label",null,[this.caseField,ja(t,"match case")]),fs("label",null,[this.reField,ja(t,"regexp")]),fs("label",null,[this.wordField,ja(t,"by word")]),...t.state.readOnly?[]:[fs("br"),this.replaceField,r("replace",()=>g$(t),[ja(t,"replace")]),r("replaceAll",()=>QAe(t),[ja(t,"replace all")])],fs("button",{name:"close",onclick:()=>$J(t),"aria-label":ja(t,"close"),type:"button"},["×"])])}commit(){let t=new DJ({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:ev.of(t)}))}keydown(t){w6e(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?$_:B_)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),g$(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(ev)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(t1).top}}function ja(e,t){return e.state.phrase(t)}const Lw=30,Pw=/[\s\.,:;?!]/;function xN(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),s=e.state.doc.lineAt(n).to,i=Math.max(r.from,t-Lw),o=Math.min(s,n+Lw),a=e.state.sliceDoc(i,o);if(i!=r.from){for(let l=0;l<Lw;l++)if(!Pw.test(a[l+1])&&Pw.test(a[l])){a=a.slice(l);break}}if(o!=s){for(let l=a.length-1;l>a.length-Lw;l--)if(!Pw.test(a[l-1])&&Pw.test(a[l])){a=a.slice(0,l);break}}return It.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${r.number}.`)}const eEe=It.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),tEe=[Bh,vf.low(KAe),eEe];class b${constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class hm{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let s=r.facet(tv).markerFilter;s&&(t=s(t,r));let i=t.slice().sort((p,g)=>p.from-g.from||p.to-g.to),o=new Zc,a=[],l=0,u=r.doc.iter(),d=0,h=r.doc.length;for(let p=0;;){let g=p==i.length?null:i[p];if(!g&&!a.length)break;let b,x;if(a.length)b=l,x=a.reduce((w,k)=>Math.min(w,k.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>h)break;x=g.to,a.push(g),p++}for(;p<i.length;){let w=i[p];if(w.from==b&&(w.to>w.from||w.to==b))a.push(w),p++,x=Math.min(w.to,x);else{x=Math.min(w.from,x);break}}x=Math.min(x,h);let v=!1;if(a.some(w=>w.from==b&&(w.to==x||x==h))&&(v=b==x,!v&&x-b<10)){let w=b-(d+u.value.length);w>0&&(u.next(w),d=b);for(let k=b;;){if(k>=x){v=!0;break}if(!u.lineBreak&&d+u.value.length>k)break;k=d+u.value.length,d+=u.value.length,u.next()}}let y=mEe(a);if(v)o.add(b,b,vn.widget({widget:new uEe(y),diagnostics:a.slice()}));else{let w=a.reduce((k,T)=>T.markClass?k+" "+T.markClass:k,"");o.add(b,x,vn.mark({class:"cm-lintRange cm-lintRange-"+y+w,diagnostics:a.slice(),inclusiveEnd:a.some(k=>k.to>x)}))}if(l=x,l==h)break;for(let w=0;w<a.length;w++)a[w].to<=l&&a.splice(w--,1)}let m=o.finish();return new hm(m,n,af(m))}}function af(e,t=null,n=0){let r=null;return e.between(n,1e9,(s,i,{spec:o})=>{if(!(t&&o.diagnostics.indexOf(t)<0))if(!r)r=new b$(s,i,t||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new b$(r.from,i,r.diagnostic)}}),r}function nEe(e,t){let n=t.pos,r=t.end||n,s=e.state.facet(tv).hideOn(e,n,r);if(s!=null)return s;let i=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(o=>o.is(zJ))||e.changes.touchesRange(i.from,Math.max(i.to,r)))}function rEe(e,t){return e.field(Wa,!1)?t:t.concat(Yn.appendConfig.of(pEe))}const zJ=Yn.define(),wN=Yn.define(),FJ=Yn.define(),Wa=lo.define({create(){return new hm(vn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,s=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=af(n,e.selected.diagnostic,i)||af(n,null,i)}!n.size&&s&&t.state.facet(tv).autoPanel&&(s=null),e=new hm(n,s,r)}for(let n of t.effects)if(n.is(zJ)){let r=t.state.facet(tv).autoPanel?n.value.length?nv.open:null:e.panel;e=hm.init(n.value,r,t.state)}else n.is(wN)?e=new hm(e.diagnostics,n.value?nv.open:null,e.selected):n.is(FJ)&&(e=new hm(e.diagnostics,e.panel,n.value));return e},provide:e=>[Ky.from(e,t=>t.panel),It.decorations.from(e,t=>t.diagnostics)]}),sEe=vn.mark({class:"cm-lintRange cm-lintRange-active"});function iEe(e,t,n){let{diagnostics:r}=e.state.field(Wa),s,i=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(l,u,{spec:d})=>{if(t>=l&&t<=u&&(l==u||(t>l||n>0)&&(t<u||n<0)))return s=d.diagnostics,i=l,o=u,!1});let a=e.state.facet(tv).tooltipFilter;return s&&a&&(s=a(s,e.state)),s?{pos:i,end:o,above:!0,create(){return{dom:oEe(e,s)}}}:null}function oEe(e,t){return fs("ul",{class:"cm-tooltip-lint"},t.map(n=>HJ(e,n,!1)))}const aEe=e=>{let t=e.state.field(Wa,!1);(!t||!t.panel)&&e.dispatch({effects:rEe(e.state,[wN.of(!0)])});let n=eN(e,nv.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},y$=e=>{let t=e.state.field(Wa,!1);return!t||!t.panel?!1:(e.dispatch({effects:wN.of(!1)}),!0)},lEe=e=>{let t=e.state.field(Wa,!1);if(!t)return!1;let n=e.state.selection.main,r=af(t.diagnostics,null,n.to+1);return!r&&(r=af(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),lTe(e,r.from,1,{tooltip:UJ,until:s=>s.docChanged||s.newSelection.main.head<r.from||s.newSelection.main.head>r.to}),!0)},cEe=[{key:"Mod-Shift-m",run:aEe,preventDefault:!0},{key:"F8",run:lEe}],tv=sn.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...du(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:v$,tooltipFilter:v$,needsRefresh:(t,n)=>t?n?r=>t(r)||n(r):t:n,hideOn:(t,n)=>t?n?(r,s,i)=>t(r,s,i)||n(r,s,i):t:n,autoPanel:(t,n)=>t||n})}}});function v$(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function qJ(e){let t=[];if(e)e:for(let{name:n}of e){for(let r=0;r<n.length;r++){let s=n[r];if(/[a-zA-Z]/.test(s)&&!t.some(i=>i.toLowerCase()==s.toLowerCase())){t.push(s);continue e}}t.push("")}return t}function HJ(e,t,n){var r;let s=n?qJ(t.actions):[];return fs("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},fs("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((i,o)=>{let a=!1,l=p=>{if(p.preventDefault(),a)return;a=!0;let g=af(e.state.field(Wa).diagnostics,t);g&&i.apply(e,g.from,g.to)},{name:u}=i,d=s[o]?u.indexOf(s[o]):-1,h=d<0?u:[u.slice(0,d),fs("u",u.slice(d,d+1)),u.slice(d+1)],m=i.markClass?" "+i.markClass:"";return fs("button",{type:"button",class:"cm-diagnosticAction"+m,onclick:l,onmousedown:l,"aria-label":` Action: ${u}${d<0?"":` (access key "${s[o]})"`}.`},h)}),t.source&&fs("div",{class:"cm-diagnosticSource"},t.source))}class uEe extends ll{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return fs("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class x${constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=HJ(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class nv{constructor(t){this.view=t,this.items=[];let n=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)y$(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],o=qJ(i.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==s.keyCode){let l=af(this.view.state.field(Wa).diagnostics,i);l&&i.actions[a].apply(t,l.from,l.to)}}else return;s.preventDefault()}},r=s=>{for(let i=0;i<this.items.length;i++)this.items[i].dom.contains(s.target)&&this.moveSelection(i)};this.list=fs("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=fs("div",{class:"cm-panel-lint"},this.list,fs("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>y$(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Wa).selected;if(!t)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return-1}update(){let{diagnostics:t,selected:n}=this.view.state.field(Wa),r=0,s=!1,i=null,o=new Set;for(t.between(0,this.view.state.doc.length,(a,l,{spec:u})=>{for(let d of u.diagnostics){if(o.has(d))continue;o.add(d);let h=-1,m;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==d){h=p;break}h<0?(m=new x$(this.view,d),this.items.splice(r,0,m),s=!0):(m=this.items[h],h>r&&(this.items.splice(r,h-r),s=!0)),n&&m.diagnostic==n.diagnostic?m.dom.hasAttribute("aria-selected")||(m.dom.setAttribute("aria-selected","true"),i=m):m.dom.hasAttribute("aria-selected")&&m.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new x$(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let u=l.height/this.list.offsetHeight;a.top<l.top?this.list.scrollTop-=(l.top-a.top)/u:a.bottom>l.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function n(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)n();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Wa),r=af(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:FJ.of(r)})}static open(t){return new nv(t)}}function dEe(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function Ow(e){return dEe(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const hEe=It.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Ow("#f11")},".cm-lintRange-warning":{backgroundImage:Ow("orange")},".cm-lintRange-info":{backgroundImage:Ow("#999")},".cm-lintRange-hint":{backgroundImage:Ow("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function fEe(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function mEe(e){let t="hint",n=1;for(let r of e){let s=fEe(r.severity);s>n&&(n=s,t=r.severity)}return t}const UJ=aTe(iEe,{hideOn:nEe}),pEe=[Wa,It.decorations.compute([Wa],e=>{let{selected:t,panel:n}=e.field(Wa);return!t||!n||t.from==t.to?vn.none:vn.set([sEe.range(t.from,t.to)])}),UJ,hEe],VJ=[wTe(),STe(),mQ(),cN(),g8e(),dQ(),j6e(),Ir.allowMultipleSelections.of(!0),n8e(),BQ($Q,{fallback:!0}),T8e(),pAe(),MJ(),Y6e(),J6e(),q6e(),jAe(),kg.of([...vAe,...hN,...JAe,...uN,...h8e,...NJ,...cEe])],gEe=[mQ(),cN(),dQ(),BQ($Q,{fallback:!0}),kg.of([...hN,...uN])];/** @license
 * fzf v0.5.2
 * Copyright (c) 2021 Ajit
 * Licensed under BSD 3-Clause
 */const kN={216:"O",223:"s",248:"o",273:"d",295:"h",305:"i",320:"l",322:"l",359:"t",383:"s",384:"b",385:"B",387:"b",390:"O",392:"c",393:"D",394:"D",396:"d",398:"E",400:"E",402:"f",403:"G",407:"I",409:"k",410:"l",412:"M",413:"N",414:"n",415:"O",421:"p",427:"t",429:"t",430:"T",434:"V",436:"y",438:"z",477:"e",485:"g",544:"N",545:"d",549:"z",564:"l",565:"n",566:"t",567:"j",570:"A",571:"C",572:"c",573:"L",574:"T",575:"s",576:"z",579:"B",580:"U",581:"V",582:"E",583:"e",584:"J",585:"j",586:"Q",587:"q",588:"R",589:"r",590:"Y",591:"y",592:"a",593:"a",595:"b",596:"o",597:"c",598:"d",599:"d",600:"e",603:"e",604:"e",605:"e",606:"e",607:"j",608:"g",609:"g",610:"G",613:"h",614:"h",616:"i",618:"I",619:"l",620:"l",621:"l",623:"m",624:"m",625:"m",626:"n",627:"n",628:"N",629:"o",633:"r",634:"r",635:"r",636:"r",637:"r",638:"r",639:"r",640:"R",641:"R",642:"s",647:"t",648:"t",649:"u",651:"v",652:"v",653:"w",654:"y",655:"Y",656:"z",657:"z",663:"c",665:"B",666:"e",667:"G",668:"H",669:"j",670:"k",671:"L",672:"q",686:"h",867:"a",868:"e",869:"i",870:"o",871:"u",872:"c",873:"d",874:"h",875:"m",876:"r",877:"t",878:"v",879:"x",7424:"A",7427:"B",7428:"C",7429:"D",7431:"E",7432:"e",7433:"i",7434:"J",7435:"K",7436:"L",7437:"M",7438:"N",7439:"O",7440:"O",7441:"o",7442:"o",7443:"o",7446:"o",7447:"o",7448:"P",7449:"R",7450:"R",7451:"T",7452:"U",7453:"u",7454:"u",7455:"m",7456:"V",7457:"W",7458:"Z",7522:"i",7523:"r",7524:"u",7525:"v",7834:"a",7835:"s",8305:"i",8341:"h",8342:"k",8343:"l",8344:"m",8345:"n",8346:"p",8347:"s",8348:"t",8580:"c"};for(let e="̀".codePointAt(0);e<="ͯ".codePointAt(0);++e){const t=String.fromCodePoint(e);for(const n of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"){const s=(n+t).normalize().codePointAt(0);s>126&&(kN[s]=n)}}const I6={a:[7844,7863],e:[7870,7879],o:[7888,7907],u:[7912,7921]};for(const e of Object.keys(I6)){const t=e.toUpperCase();for(let n=I6[e][0];n<=I6[e][1];++n)kN[n]=n%2===0?t:e}function Wv(e){if(e<192||e>8580)return e;const t=kN[e];return t!==void 0?t.codePointAt(0):e}function ch(e,t){return e>t?e:t}const WJ=e=>e.split("").map(t=>t.codePointAt(0)),bEe=new Set(` \f
\r	\v  \u2028\u2029  　\uFEFF`.split("").map(e=>e.codePointAt(0)));for(let e=" ".codePointAt(0);e<=" ".codePointAt(0);e++)bEe.add(e);const Tg="".codePointAt(0),rv="A".codePointAt(0),sv="Z".codePointAt(0),GJ="a".codePointAt(0),KJ="z".codePointAt(0),yEe="0".codePointAt(0),vEe="9".codePointAt(0);function C0(e,t,n){return n?e:t-e-1}const iv=16,IA=-3,z_=-1,Qm=iv/2,xEe=iv/2,wEe=Qm+z_,YJ=4,XJ=2;function RA(e){return e?new Set:null}function eb(e,t,n){if(t!==null&&t.i16.length>e+n){const r=t.i16.subarray(e,e+n);return[e+n,r]}return[e,new Int16Array(n)]}function w$(e,t,n){if(t!==null&&t.i32.length>e+n){const r=t.i32.subarray(e,e+n);return[e+n,r]}return[e,new Int32Array(n)]}function QJ(e){return e>=GJ&&e<=KJ?1:e>=rv&&e<=sv?2:e>=yEe&&e<=vEe?4:0}function JJ(e){const t=String.fromCodePoint(e);return t!==t.toUpperCase()?1:t!==t.toLowerCase()?2:t.match(new RegExp("\\p{Number}","gu"))!==null?4:t.match(new RegExp("\\p{Letter}","gu"))!==null?3:0}function F_(e){return e<=Tg?QJ(e):JJ(e)}function _N(e,t){return e===0&&t!==0?Qm:e===1&&t===2||e!==4&&t===4?wEe:t===0?xEe:0}function kEe(e,t){return t===0?Qm:_N(F_(e[t-1]),F_(e[t]))}function _Ee(e,t,n,r){let s=e.slice(r),i=s.indexOf(n);if(i===0)return r;if(!t&&n>=GJ&&n<=KJ){i>0&&(s=s.slice(0,i));const o=s.indexOf(n-32);o>=0&&(i=o)}return i<0?-1:r+i}function k$(e){for(const t of e)if(t>=128)return!1;return!0}function SN(e,t,n){if(!k$(e))return 0;if(!k$(t))return-1;let r=0,s=0;for(let i=0;i<t.length;i++){if(s=_Ee(e,n,t[i],s),s<0)return-1;i===0&&s>0&&(r=s-1),s++}return r}const SEe=(e,t,n,r,s,i,o)=>{const a=s.length;if(a===0)return[{start:0,end:0,score:0},RA(i)];const l=r.length;if(o!==null&&l*a>o.i16.length)return eZ(e,t,n,r,s,i);const u=SN(r,s,e);if(u<0)return[{start:-1,end:-1,score:0},null];let d=0,h=0,m=null,p=null,g=null,b=null;[d,m]=eb(d,o,l),[d,p]=eb(d,o,l),[d,g]=eb(d,o,l),[h,b]=w$(h,o,a);const[,x]=w$(h,o,l);for(let U=0;U<x.length;U++)x[U]=r[U];let v=0,y=0,w=0,k=0;const T=s[0];let S=s[0],C=0,_=0,A=!1,M=x.subarray(u),L=m.subarray(u).subarray(0,M.length),N=p.subarray(u).subarray(0,M.length),O=g.subarray(u).subarray(0,M.length);for(let[U,j]of M.entries()){let ie=null;j<=Tg?(ie=QJ(j),!e&&ie===2&&(j+=32)):(ie=JJ(j),!e&&ie===2&&(j=String.fromCodePoint(j).toLowerCase().codePointAt(0)),t&&(j=Wv(j))),M[U]=j;const oe=_N(_,ie);if(O[U]=oe,_=ie,j===S&&(w<a&&(b[w]=u+U,w++,S=s[Math.min(w,a-1)]),k=u+U),j===T){const J=iv+oe*XJ;if(L[U]=J,N[U]=1,a===1&&(n&&J>v||!n&&J>=v)&&(v=J,y=u+U,n&&oe===Qm))break;A=!1}else A?L[U]=ch(C+z_,0):L[U]=ch(C+IA,0),N[U]=0,A=!0;C=L[U]}if(w!==a)return[{start:-1,end:-1,score:0},null];if(a===1){const U={start:y,end:y+1,score:v};if(!i)return[U,null];const j=new Set;return j.add(y),[U,j]}const B=b[0],$=k-B+1;let P=null;[d,P]=eb(d,o,$*a);{const U=m.subarray(B,k+1);for(const[j,ie]of U.entries())P[j]=ie}let[,K]=eb(d,o,$*a);{const U=p.subarray(B,k+1);for(const[j,ie]of U.entries())K[j]=ie}const F=b.subarray(1),H=s.slice(1).slice(0,F.length);for(const[U,j]of F.entries()){let ie=!1;const oe=H[U],J=U+1,V=J*$,se=x.subarray(j,k+1),Z=g.subarray(j).subarray(0,se.length),X=K.subarray(V+j-B).subarray(0,se.length),te=K.subarray(V+j-B-1-$).subarray(0,se.length),ae=P.subarray(V+j-B).subarray(0,se.length),xe=P.subarray(V+j-B-1-$).subarray(0,se.length),Ae=P.subarray(V+j-B-1).subarray(0,se.length);Ae[0]=0;for(const[Ne,Le]of se.entries()){const ge=Ne+j;let Oe=0,Nt=0,Pe=0;if(ie?Nt=Ae[Ne]+z_:Nt=Ae[Ne]+IA,oe===Le){Oe=xe[Ne]+iv;let Zt=Z[Ne];Pe=te[Ne]+1,Zt===Qm?Pe=1:Pe>1&&(Zt=ch(Zt,ch(YJ,g[ge-Pe+1]))),Oe+Zt<Nt?(Oe+=Z[Ne],Pe=0):Oe+=Zt}X[Ne]=Pe,ie=Oe<Nt;const Ce=ch(ch(Oe,Nt),0);J===a-1&&(n&&Ce>v||!n&&Ce>=v)&&(v=Ce,y=ge),ae[Ne]=Ce}}const D=RA(i);let Q=B;if(i&&D!==null){let U=a-1;Q=y;let j=!0;for(;;){const ie=U*$,oe=Q-B,J=P[ie+oe];let V=0,se=0;if(U>0&&Q>=b[U]&&(V=P[ie-$+oe-1]),Q>b[U]&&(se=P[ie+oe-1]),J>V&&(J>se||J===se&&j)){if(D.add(Q),U===0)break;U--}j=K[ie+oe]>1||ie+$+oe+1<K.length&&K[ie+$+oe+1]>0,Q--}}return[{start:Q,end:y+1,score:v},D]};function ZJ(e,t,n,r,s,i,o){let a=0,l=0,u=!1,d=0,h=0;const m=RA(o);let p=0;s>0&&(p=F_(n[s-1]));for(let g=s;g<i;g++){let b=n[g];const x=F_(b);if(e||(b>=rv&&b<=sv?b+=32:b>Tg&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Wv(b)),b===r[a]){o&&m!==null&&m.add(g),l+=iv;let v=_N(p,x);d===0?h=v:(v===Qm&&(h=v),v=ch(ch(v,h),YJ)),a===0?l+=v*XJ:l+=v,u=!1,d++,a++}else u?l+=z_:l+=IA,u=!0,d=0,h=0;p=x}return[l,m]}const eZ=(e,t,n,r,s,i,o)=>{if(s.length===0)return[{start:0,end:0,score:0},null];if(SN(r,s,e)<0)return[{start:-1,end:-1,score:0},null];let a=0,l=-1,u=-1;const d=r.length,h=s.length;for(let m=0;m<d;m++){let p=r[C0(m,d,n)];e||(p>=rv&&p<=sv?p+=32:p>Tg&&(p=String.fromCodePoint(p).toLowerCase().codePointAt(0))),t&&(p=Wv(p));const g=s[C0(a,h,n)];if(p===g&&(l<0&&(l=m),a++,a===h)){u=m+1;break}}if(l>=0&&u>=0){a--;for(let g=u-1;g>=l;g--){const b=C0(g,d,n);let x=r[b];e||(x>=rv&&x<=sv?x+=32:x>Tg&&(x=String.fromCodePoint(x).toLowerCase().codePointAt(0)));const v=C0(a,h,n),y=s[v];if(x===y&&(a--,a<0)){l=g;break}}if(!n){const g=l;l=d-u,u=d-g}const[m,p]=ZJ(e,t,r,s,l,u,i);return[{start:l,end:u,score:m},p]}return[{start:-1,end:-1,score:0},null]},CEe=(e,t,n,r,s,i,o)=>{if(s.length===0)return[{start:0,end:0,score:0},null];const a=r.length,l=s.length;if(a<l)return[{start:-1,end:-1,score:0},null];if(SN(r,s,e)<0)return[{start:-1,end:-1,score:0},null];let u=0,d=-1,h=0,m=-1;for(let p=0;p<a;p++){const g=C0(p,a,n);let b=r[g];e||(b>=rv&&b<=sv?b+=32:b>Tg&&(b=String.fromCodePoint(b).toLowerCase().codePointAt(0))),t&&(b=Wv(b));const x=C0(u,l,n);if(s[x]===b){if(x===0&&(h=kEe(r,g)),u++,u===l){if(h>m&&(d=p,m=h),h===Qm)break;p-=u-1,u=0,h=0}}else p-=u,u=0,h=0}if(d>=0){let p=0,g=0;n?(p=d-l+1,g=d+1):(p=a-(d+1),g=a-(d-l+1));const[b]=ZJ(e,t,r,s,p,g,!1);return[{start:p,end:g,score:b},null]}return[{start:-1,end:-1,score:0},null]},TEe=100*1024,AEe=2048;function EEe(e,t){return{i16:new Int16Array(e),i32:new Int32Array(t)}}const MEe=EEe(TEe,AEe),NEe=(e,t,n)=>{let r=!1;switch(t){case"smart-case":e.toLowerCase()!==e&&(r=!0);break;case"case-sensitive":r=!0;break;case"case-insensitive":e=e.toLowerCase(),r=!1;break}let s=WJ(e);return n&&(s=s.map(Wv)),{queryRunes:s,caseSensitive:r}};function jEe(e,t){const n=Object.keys(e).map(s=>parseInt(s,10)).sort((s,i)=>i-s);let r=[];for(const s of n)if(r=r.concat(e[s]),r.length>=t)break;return r}function IEe(e,t,n){return r=>{const s=this.runesList[r];if(t.length>s.length)return;let[i,o]=this.algoFn(n,this.opts.normalize,this.opts.forward,s,t,!0,MEe);if(i.start===-1)return;if(this.opts.fuzzy===!1){o=new Set;for(let l=i.start;l<i.end;++l)o.add(l)}const a=this.opts.sort?i.score:0;e[a]===void 0&&(e[a]=[]),e[a].push({item:this.items[r],...i,positions:o??new Set})}}function REe(e){const{queryRunes:t,caseSensitive:n}=NEe(e,this.opts.casing,this.opts.normalize),r={},s=IEe.bind(this)(r,t,n);for(let i=0,o=this.runesList.length;i<o;++i)s(i);return jEe(r,this.opts.limit)}const tZ={limit:1/0,selector:e=>e,casing:"smart-case",normalize:!0,fuzzy:"v2",tiebreakers:[],sort:!0,forward:!0};class DEe{constructor(t,...n){switch(this.opts={...tZ,...n[0]},this.items=t,this.runesList=t.map(r=>WJ(this.opts.selector(r).normalize())),this.algoFn=CEe,this.opts.fuzzy){case"v2":this.algoFn=SEe;break;case"v1":this.algoFn=eZ;break}}}const LEe={...tZ,match:REe};class PEe extends DEe{constructor(t,...n){super(t,...n),this.opts={...LEe,...n[0]}}find(t){if(t.length===0||this.items.length===0)return this.items.slice(0,this.opts.limit).map(OEe);t=t.normalize();let n=this.opts.match.bind(this)(t);return BEe(n,this.opts)}}const OEe=e=>({item:e,start:-1,end:-1,score:0,positions:new Set});function BEe(e,t){if(t.sort){const{selector:n}=t;e.sort((r,s)=>{if(r.score===s.score)for(const i of t.tiebreakers){const o=i(r,s,n);if(o!==0)return o}return 0})}return Number.isFinite(t.limit)&&e.splice(t.limit),e}class $Ee{constructor(t,...n){this.finder=new PEe(t,...n),this.find=this.finder.find.bind(this.finder)}}const ov=["custom","skill","system"];function DA(e){return e.displayCategory?e.displayCategory:e.source==="builtin-command"?"system":e.source==="bundled-skill"||e.source==="skill"?"skill":"custom"}function zEe(e,t,n=ov){return _$(DA(e),n)-_$(DA(t),n)}function _$(e,t=ov){const n=t.indexOf(e);return n>=0?n:t.length+ov.indexOf(e)}const CN=String.raw`([^\s/]+)`,RS={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:"安装扩展"}]},DS={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"}]},LS={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 文件列表"}]},PS={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 FEe(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"?RS:DS)[e];if(o||(o=(r==="zh-CN"?LS:PS)[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(u=>u.name===a);if(!(l!=null&&l.children))return null;o=l.children}return o}function qEe(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 HEe(e,t,n,r){const s=zEe(e,t,r);return s!==0?s:0}const UEe={custom:"slash.category.custom",skill:"slash.category.skill",system:"slash.category.system"};function VEe(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 WEe(e,t,n){var u;const r=e.match(new RegExp(`^/${CN}\\s+$`));if(!r)return null;const s=r[1],i=t.find(d=>d.name===s),o=n==="zh-CN"?RS:DS;if((u=i==null?void 0:i.subcommands)!=null&&u.length||o[s]||s==="skills")return null;const l=(n==="zh-CN"?LS:PS)[s];return!l||l.length===0?null:`/${s} ${l[0].name} `}function GEe(e,t,n){var d,h;const r=e.match(new RegExp(`^/${CN}(\\s*)$`));if(!r)return null;const s=r[1],i=t.find(m=>m.name===s);if(!i)return null;const o=(d=i.argumentHint)==null?void 0:d.trim();if(o)return o;const a=n==="zh-CN"?RS:DS;if((h=i.subcommands)!=null&&h.length||a[s]||s==="skills")return null;const u=(n==="zh-CN"?LS:PS)[s];return!u||u.length===0?null:`[${u.map(m=>m.name).join("|")}]`}function KEe(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}}const S$=new WeakMap;function YEe(e){let t=S$.get(e);if(!t){const n=[],r=new Map;for(const s of e)r.has(s.name)||(n.push(s.name),r.set(s.name,s));t={fzf:new $Ee(n,{fuzzy:"v2",casing:"case-insensitive"}),byName:r},S$.set(e,t)}return t}function XEe(e,t){try{const{fzf:n,byName:r}=YEe(e),s=[];for(const i of n.find(t)){const o=r.get(i.item);o&&s.push(o)}return s}catch(n){console.warn("[web-shell] slash fuzzy search failed, falling back to substring match:",n);const r=t.toLowerCase();return e.filter(s=>s.name.toLowerCase().includes(r))}}function QEe(e,t,n,r=[],s="en",i=a=>a,o=ov){var y,w;const{lineStart:a,lineEnd:l,lineText:u,textBefore:d,cursor:h}=KEe(e,t),m=d.match(new RegExp(`^/${CN}\\s+(.*)$`));if(m){const[,k,T]=m,S=n.find(D=>D.name===k),C=s==="zh-CN"?RS:DS,_=s==="zh-CN"?LS:PS,A=!!C[k]||k==="skills",M=!!_[k];if(!((y=S==null?void 0:S.subcommands)!=null&&y.length)&&!A&&!M)return null;const L=T.split(/\s+/),N=L.pop()||"",O=L;if(!((w=S==null?void 0:S.subcommands)!=null&&w.length)&&!A&&M&&!N)return null;const B=FEe(k,O,r,s,S==null?void 0:S.subcommands);if(!B)return null;const $=N.toLowerCase(),P=`/${k} ${O.length>0?O.join(" ")+" ":""}`,K=B.filter(D=>!N||D.name.toLowerCase().includes($)).sort((D,Q)=>N?qEe(D.name,Q.name,$):0),F=k==="skills"&&O.length===0,H=K.map(D=>{const Q=`${P}${D.name}`;return{id:Q,label:D.name,detail:D.description||void 0,apply:`${Q} `,...F?{type:"skill"}:{}}});return H.length===0?null:{kind:"subcommand",from:a,to:h,query:N,items:H}}const p=u.match(/^\/([^\s/]*)$/);if(!p)return null;const g=p[1],b=g.length===0,v=(b?[...n].sort((k,T)=>HEe(k,T,"",o)):XEe(n,g)).map(k=>{const T=`/${k.name} `,S=DA(k),C=S==="custom"||S==="skill";return{id:k.name,label:`/${k.name}`,detail:k.description||void 0,apply:T,category:S,...b?{section:i(UEe[S])}:{},...C&&k.description?{type:"command-info"}:{}}});return v.length===0?null:{kind:"command",from:a,to:l,query:g,items:v}}const JEe="qwen-web-shell-history",nZ=100;function ZEe(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 e9e(e,t){try{localStorage.setItem(e,JSON.stringify(t.slice(-nZ)))}catch{}}function C$(e=JEe){const t=f.useRef(e);t.current=e;const n=f.useRef(ZEe(e)),r=f.useRef(-1),s=f.useRef(""),i=f.useRef(-1),[o,a]=f.useState(()=>({canUp:n.current.length>0,canDown:!1})),l=f.useCallback(()=>{const y=n.current,w=r.current;a({canUp:y.length>0&&(w===-1||w>0),canDown:w!==-1})},[]),u=f.useCallback(y=>{const w=n.current;w[w.length-1]!==y&&(w.push(y),w.length>nZ&&w.shift(),e9e(t.current,w),r.current=-1,l())},[l]),d=f.useCallback(y=>{const w=n.current;if(w.length===0)return null;if(r.current===-1)s.current=y,r.current=w.length-1;else if(r.current>0)r.current--;else return null;return l(),w[r.current]},[l]),h=f.useCallback(()=>{const y=n.current;return r.current===-1?null:r.current<y.length-1?(r.current++,l(),y[r.current]):(r.current=-1,l(),s.current)},[l]),m=f.useCallback(()=>r.current!==-1,[]),p=f.useCallback(()=>{r.current=-1,i.current=-1,l()},[l]),g=f.useCallback(y=>{const w=n.current;if(w.length===0||!y)return null;const k=i.current===-1?w.length-1:i.current-1;if(k<0)return i.current=-1,null;const T=y.toLowerCase();for(let S=k;S>=0;S--)if(w[S].toLowerCase().includes(T))return i.current=S,w[S];return i.current=-1,null},[]),b=f.useCallback(y=>{const w=y.trim().toLowerCase();return n.current.slice().reverse().filter(k=>!w||k.toLowerCase().includes(w))},[]),x=f.useCallback(y=>{const w=n.current;if(!y)return w.length>0?w[w.length-1]:null;for(let k=w.length-1;k>=0;k--)if(y(w[k]))return w[k];return null},[]),v=f.useCallback(()=>{i.current=-1},[]);return{push:u,navigateUp:d,navigateDown:h,isNavigating:m,reset:p,searchReverse:g,getReverseMatches:b,getLastEntry:x,resetSearch:v,nav:o}}function Bw(){return{directories:new Map,globResults:new Map,mcpResources:new Map}}function LA(e,t,n){let r=e.get(t);return r||(r=n().catch(s=>{throw e.delete(t),s}),e.set(t,r)),r}const t9e=/@((?:[\p{L}\p{N}_./:-]|\\.)*)$/u,n9e=[],T$=150,Jm=50,rZ=Jm+1,Xi="files",n1="extensions",Zi="mcp-resources",sZ=[Xi,n1,Zi],r9e="\x1B",iZ=new RegExp(`${r9e}(?:[@-Z\\\\-_]|\\[[0-?]*[ -/]*[@-~])`,"g"),oZ=/[\u200B\u200E\u200F\u061C\u2066-\u2069\u202A-\u202E]/g,av="[invalid]",s9e=/[^\p{L}\p{N}_./-]/gu;function Qk(e){return sZ.includes(e)}function i9e(e,t){var r;if(t===void 0||t===!0)return!0;if(t===!1)return!1;if(Array.isArray(t))return t.includes(e);const n=t;return!(n.enabled===!1||n.include&&!n.include.includes(e)||(r=n.exclude)!=null&&r.includes(e))}function o9e(e){const t=new Set(sZ),n=[];for(const r of e){if(t.has(r.id)){console.error(`[@mention] duplicate provider id="${r.id}" ignored`);continue}t.add(r.id),n.push(r)}return n}function A$(e){return(e.textValue===void 0?void 0:ys(e.textValue))??(typeof e.label=="string"?ys(e.label)??void 0:void 0)??hd(e.id)??av}function aZ(e,t){return e==="."||e===""?t:`${e.replace(/\/+$/,"")}/${t}`}function Zu(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){t.pop();continue}t.push(n)}return t.length>0?t.join("/"):"."}function a9e(e){return Array.from(e,t=>/[a-z]/i.test(t)?`[${t.toLowerCase()}${t.toUpperCase()}]`:/[\\*?[{\]}()!@+|]/.test(t)?`\\${t}`:t).join("")}function PA(e){const t=OS(e).replace(/^\.\//,"");return t?`**/*${a9e(t)}*`:"**/*"}function q_(e,...t){const n=e.toLowerCase();return t.some(r=>r==null?void 0:r.toLowerCase().includes(n))}function E$(e){const t=Zu(e),n=eu(t);return t==="."?"@./ ":`@${Zm(n)}/ `}function l9e(e,t){return`${e}:${t}`}function Zm(e){return e.replace(s9e,"\\$&")}function OS(e){return e.replace(/\\(.)/g,"$1")}function lZ(e){const t=e.charCodeAt(0);return t>31&&t!==127&&(t<128||t>159)}function c9e(e,t){return`@${Zm(l9e(eu(e),eu(t)))} `}function u9e(e,t,n){const r=OS(e);return t===Zi&&n&&r.startsWith(`${n}:`)?{providerId:Zi,serverName:n,itemQuery:r.slice(n.length+1),validateServer:!0}:e.startsWith("ext:")?{providerId:n1,itemQuery:e.slice(4)}:e.startsWith("mcp:")?{providerId:Zi,itemQuery:e.slice(4)}:null}function d9e(e,t,n){if(e===n1&&t.startsWith("ext:")||e===Zi&&t.startsWith("mcp:"))return t.slice(4);const r=OS(t);return e===Zi&&n&&r.startsWith(`${n}:`)?r.slice(n.length+1):!Qk(e)&&t.startsWith(`${e}:`)?t.slice(e.length+1):t}async function h9e(e,t,n,r){if(n!=null&&n.aborted)return!1;const s=r??(e==null?void 0:e.loadMcpStatus);if(!s)return!1;try{const i=await s();return n!=null&&n.aborted?!1:i.servers.some(o=>o.name===t&&!o.disabled)}catch(i){return console.warn(`Failed to verify @ MCP server "${t}" status`,i),!1}}function f9e(e){const t=Zu(e);if(t===".")return".";const n=t.lastIndexOf("/");return n<0?".":t.slice(0,n)}function cZ(e,t){const n=OS(e).replace(/^\.\/+/,"").replace(/\/+/g,"/"),r=n.lastIndexOf("/");if(r<0)return{dirPath:Zu(t),entryQuery:n};const s=n.slice(0,r),i=Zu(t),o=i==="."?s:aZ(i,s);return{dirPath:Zu(o),entryQuery:n.slice(r+1)}}function m9e(e){if(!e)return null;const t=e.state.selection.main;if(!t.empty)return null;const n=e.state.doc.lineAt(t.head),s=n.text.slice(0,t.head-n.from).match(t9e);if(!s)return null;const i=t.head-s[0].length;if(i>n.from){const o=e.state.doc.sliceString(i-1,i);if(!/[\s([{'"]/.test(o))return null}return{from:i,to:t.head,query:s[1]??""}}function ys(e){const t=e.replace(iZ,"").replace(oZ,"").split("").filter(lZ).join("").replace(/\s+/g," ").trim();return t.length>0?t:void 0}function eu(e){const t=e.replace(iZ,"").replace(oZ,"").split("").filter(lZ).join("");return t.length>0?t:av}function hd(e){return e===void 0?av:ys(e)??av}function p9e(e){if(e!==void 0)return eu(e).trim()}function g9e(e){if(!e)return;const t=e.kind===void 0?void 0:ys(e.kind);return{id:ys(e.id)??av,label:e.label===void 0?void 0:ys(e.label),value:e.value===void 0?void 0:ys(e.value),removable:e.removable,kind:t,icon:e.icon,metadata:e.metadata,serialized:p9e(e.serialized)}}function b9e(e,t){const n={...e,label:ys(e.label)??hd(e.id),description:e.description===void 0?void 0:ys(e.description),subtitle:e.subtitle===void 0?void 0:ys(e.subtitle),detail:e.detail===void 0?void 0:ys(e.detail),icon:e.icon,iconTooltip:e.iconTooltip===void 0?void 0:ys(e.iconTooltip),insertText:e.insertText===void 0?void 0:eu(e.insertText),composerTag:g9e(e.composerTag)};if(!(t!=null&&t.customProvider))return n;const r={...n};return delete r.targetPath,delete r.serverName,{...r,kind:"insert"}}function y9e(e,t,n){var s;const r=n.trim();return r?t.composerTag?{...t.composerTag,serialized:((s=t.composerTag.serialized)==null?void 0:s.trim())||r}:e===n1?{id:`extension:${r}`,kind:"extension",value:t.label,serialized:r}:e===Zi?{id:`mcp:${r}`,kind:"mcp",value:t.label,serialized:r}:e===Xi?{id:`file:${r}`,kind:"file",value:t.description??t.label,serialized:r}:null:null}function v9e(e,t,n,r,s){return{id:Xi,label:r,description:s,order:1,async search({query:i,signal:o}){const a=e(),l=Zu(t()),u=a==null?void 0:a.listDirectory;if(u&&(!i||!(a!=null&&a.globWorkspace)))try{const{dirPath:h,entryQuery:m}=cZ(i,l),p=m.toLowerCase(),g=await LA(n().directories,h,()=>u(h,{signal:o}));if(o.aborted)return[];const b=g.entries.filter(v=>!v.ignored).filter(v=>v.name.toLowerCase().includes(p)).sort((v,y)=>v.kind==="directory"&&y.kind!=="directory"?-1:v.kind!=="directory"&&y.kind==="directory"?1:v.name.localeCompare(y.name)),x={id:`current:${h}`,label:E$(h).trim(),description:ys(h),insertText:E$(h),kind:"insert"};return[...m?[]:[x],...b.map(v=>{const y=aZ(h,v.name),w=hd(v.name),k=ys(y),T=eu(y);return v.kind==="directory"?{id:`dir:${y}`,label:`${w}/`,description:k,kind:"directory",targetPath:y}:{id:`file:${y}`,label:w,description:k,insertText:`@${Zm(T)} `,kind:"insert"}})].slice(0,m?Jm:rZ)}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}const d=a==null?void 0:a.globWorkspace;if(!d)return console.warn("[@mention] file provider unavailable: workspace actions are not configured"),[];try{const h=PA(i),m=await LA(n().globResults,h,()=>d(h,{maxResults:Jm,signal:o}));return o.aborted?[]:m.matches.filter(p=>p!==".").map(p=>({id:p,label:hd(p),insertText:`@${Zm(eu(p))} `,kind:"insert"}))}catch(h){return o.aborted||console.warn("Failed to load @ file suggestions",h),[]}}}}function x9e(e,t,n,r){return{id:n1,label:n,description:r,order:2,async search({query:s,signal:i}){var a;const o=(a=e())==null?void 0:a.loadExtensionsStatus;if(!o)return[];try{const l=t();l.extensionsStatus??(l.extensionsStatus=o().catch(h=>{throw l.extensionsStatus=void 0,h}));const u=await l.extensionsStatus;if(i.aborted)return[];const d=s.toLowerCase();return u.extensions.filter(h=>h.isActive).map(h=>{const m=hd(h.name),p=Zm(eu(h.name)),g=ys(h.displayName??""),b=ys(h.description??"");return{id:h.name,label:m,description:g&&g!==m?g:b,detail:g&&b?`${g} - ${b}`:g??b,insertText:`@ext:${p} `}}).filter(h=>q_(d,h.label,h.description)).sort((h,m)=>{const p=h.label.toLowerCase(),g=m.label.toLowerCase(),b=p.startsWith(d)?0:1,x=g.startsWith(d)?0:1;return b!==x?b-x:p.localeCompare(g)}).slice(0,Jm)}catch(l){return i.aborted||console.warn("Failed to load @ extension suggestions",l),[]}}}}function w9e(e,t,n,r,s){return{id:Zi,label:n,description:r,order:3,async search({query:i,signal:o}){var l;const a=(l=e())==null?void 0:l.loadMcpStatus;if(!a)return[];try{const u=t();u.mcpStatus??(u.mcpStatus=a().catch(m=>{throw u.mcpStatus=void 0,m}));const d=await u.mcpStatus;if(o.aborted)return[];const h=i.toLowerCase();return d.servers.filter(m=>!m.disabled).map(m=>{const p=eu(m.name),g=m.resourceCount===void 0?void 0:s(m.resourceCount);return m.resourceCount===0?{id:`mcp-server-ref:${m.name}`,label:hd(m.name),description:ys(m.description??""),detail:ys(m.description??""),insertText:`@mcp:${Zm(p)} `,kind:"insert"}:{id:`mcp-server:${m.name}`,label:hd(m.name),description:g===void 0?ys(m.description??""):g,detail:ys(m.description??""),kind:"mcp-server",serverName:m.name}}).filter(m=>q_(h,m.label,m.description)).sort((m,p)=>m.label.localeCompare(p.label)).slice(0,Jm)}catch(u){return o.aborted||console.warn("Failed to load @ MCP resource suggestions",u),[]}}}}function k9e(e,t,n){return t<=0?null:n==="up"?e<=0?null:e-1:e>=t-1?null:e+1}function _9e({viewRef:e,disabledRef:t,shellModeRef:n,workspaceActionsRef:r,workspaceKey:s,builtinProviders:i,providers:o=n9e,createInlineTagEffect:a}){const{t:l}=gt(),[u,d]=f.useState(null),h=f.useRef(null),m=f.useRef(0),p=f.useRef(null),g=f.useRef(null),b=f.useRef("."),x=f.useRef(Bw()),v=f.useRef(null),y=f.useRef(null),w=f.useRef(!1),k=f.useMemo(()=>[...[v9e(()=>r.current,()=>b.current,()=>x.current,l("at.category.files"),l("at.category.files.description")),x9e(()=>r.current,()=>x.current,l("at.category.extensions"),l("at.category.extensions.description")),w9e(()=>r.current,()=>x.current,l("at.category.mcpResources"),l("at.category.mcpResources.description"),V=>l("mcp.resourceCount",{count:V}))].filter(V=>i9e(V.id,i)),...o9e(o)].sort((V,se)=>(V.order??0)-(se.order??0)),[i,o,l,r]),T=f.useRef(k);T.current=k;const S=f.useMemo(()=>k.map(J=>({id:J.id,provider:J,textValue:A$(J),label:typeof J.label=="string"?A$(J):J.label,description:J.description===void 0?void 0:ys(J.description),tabs:J.tabs,renderItem:J.renderItem})),[k]),C=f.useRef(S);C.current=S;const _=f.useCallback(J=>{const V=typeof J=="function"?J(h.current):J;h.current=V,d(V)},[]);f.useEffect(()=>{var J;(J=p.current)==null||J.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null),b.current=".",x.current=Bw(),h.current=null,d(null)},[s]);const A=f.useCallback(()=>{var J;(J=p.current)==null||J.abort(),p.current=null,g.current&&(clearTimeout(g.current),g.current=null)},[]),M=f.useCallback((J={})=>{A(),x.current=Bw();const V=J.preserveProviderSelection||w.current;w.current=!1,V||(v.current=null,y.current=null),_(null)},[A,_]),L=f.useCallback(()=>{const J=h.current;return J?J.level==="items"?(A(),_({...J,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0,tabs:void 0,selectedTabId:void 0}),"categories"):(M(),"closed"):!1},[A,M,_]);f.useEffect(()=>()=>{var J;g.current&&clearTimeout(g.current),(J=p.current)==null||J.abort(),p.current=null,b.current=".",x.current=Bw()},[]);const N=f.useCallback((J,V,se)=>{const Z=h.current;return(Z==null?void 0:Z.level)!=="items"||Z.selectedProviderId!==J||Z.selectedTabId!==se.selectedTabId||Z.itemMode!==se.itemMode||Z.mcpServerName!==se.mcpServerName||Z.fileDirectory!==se.fileDirectory?[]:Z.query!==V&&!Qk(J)?[]:J===Xi&&V===""&&b.current==="."?[]:Z.items},[]),O=f.useCallback((J,V)=>{const se=r.current,Z=x.current;if(J===Xi){if(V&&(se!=null&&se.globWorkspace))return Z.globResults.has(PA(V));if(se!=null&&se.listDirectory){const{dirPath:te}=cZ(V,Zu(b.current));return Z.directories.has(te)}const X=PA(V);return!!(se!=null&&se.globWorkspace)&&Z.globResults.has(X)}return J===n1?Z.extensionsStatus!==void 0:J===Zi?Z.mcpStatus!==void 0:!1},[r]),B=f.useCallback((J,V,se,Z={})=>{var Ae;const X=T.current.find(Ne=>Ne.id===J);if(!X){console.warn(`[@mention] provider="${J}" not found (may have been removed)`),_(null);return}(Ae=p.current)==null||Ae.abort();const te=new AbortController;p.current=te;const ae=m.current+1;m.current=ae;const xe=N(J,V,se);Z.loadingAlreadySet||_({...se,items:xe,loading:!0}),Promise.resolve().then(()=>X.search({query:V,signal:te.signal,tabId:se.selectedTabId})).then(Ne=>{te.signal.aborted||m.current!==ae||_(Le=>{if(!Le||Le.level!=="items")return Le;const ge=J===Xi&&V.length===0?rZ:Jm;return{...Le,items:Ne.slice(0,ge).map(Oe=>b9e(Oe,{customProvider:!Qk(J)})),selectedIndex:0,loading:!1}})}).catch(Ne=>{te.signal.aborted||m.current!==ae||(console.warn(`[@mention] provider="${J}" query=<redacted> failed`,Ne),_(Le=>!Le||Le.level!=="items"?Le:{...Le,items:[],selectedIndex:0,loading:!1}))})},[N,_]),$=f.useCallback((J,V,se)=>{var X;g.current&&clearTimeout(g.current),(X=p.current)==null||X.abort(),p.current=null;const Z=N(J,V,se);if(_({...se,items:Z,loading:!0}),O(J,V)){B(J,V,se,{loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,B(J,V,se,{loadingAlreadySet:!0})},T$)},[N,O,B,_]),P=f.useCallback((J,V,se,Z={})=>{var ge,Oe;const X=r.current,te=X==null?void 0:X.loadMcpResources;if(!te){console.warn(`[@mention] loadMcpResources not available for server="${J}"`),_({...se,items:[],loading:!1});return}(ge=p.current)==null||ge.abort();const ae=new AbortController;p.current=ae;const xe=m.current+1;m.current=xe;const Ae=((Oe=h.current)==null?void 0:Oe.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===J?h.current.items:[];Z.loadingAlreadySet||_({...se,items:Ae,loading:!0});const Ne=X==null?void 0:X.loadMcpStatus;(Z.validateServer?h9e(X,J,ae.signal,Ne?()=>{const Nt=x.current;return Nt.mcpStatus??(Nt.mcpStatus=Ne().catch(Pe=>{throw Nt.mcpStatus=void 0,Pe})),Nt.mcpStatus}:void 0):Promise.resolve(!0)).then(Nt=>ae.signal.aborted?{resources:[]}:Nt?LA(x.current.mcpResources,J,()=>te(J,{signal:ae.signal})):(console.warn("[@mention] MCP server disabled or not found",{serverName:J}),{resources:[]})).then(Nt=>{if(ae.signal.aborted||m.current!==xe)return;const Pe=Nt.resources.map(Ce=>{const Zt=ys(Ce.title??"")??ys(Ce.name??"")??hd(Ce.uri);return{id:`mcp-resource:${J}:${Ce.uri}`,label:Zt,description:ys(Ce.description??"")??ys(Ce.mimeType??""),detail:hd(Ce.uri),insertText:c9e(J,Ce.uri),kind:"insert"}}).filter(Ce=>q_(V,Ce.label,Ce.description,Ce.detail)).sort((Ce,Zt)=>Ce.label.localeCompare(Zt.label)).slice(0,Jm);_(Ce=>!Ce||Ce.level!=="items"?Ce:{...Ce,items:Pe,selectedIndex:0,loading:!1})}).catch(Nt=>{ae.signal.aborted||m.current!==xe||(console.warn("Failed to load @ MCP resources",Nt),_(Pe=>!Pe||Pe.level!=="items"?Pe:{...Pe,items:[],selectedIndex:0,loading:!1}))})},[_,r]),K=f.useCallback((J,V,se,Z={})=>{var te,ae;g.current&&clearTimeout(g.current),(te=p.current)==null||te.abort(),p.current=null;const X=((ae=h.current)==null?void 0:ae.level)==="items"&&h.current.itemMode==="mcpResources"&&h.current.mcpServerName===J&&se.itemMode==="mcpResources"?h.current.items:[];if(_({...se,items:X,loading:!0}),x.current.mcpResources.has(J)){P(J,V,se,{...Z,loadingAlreadySet:!0});return}g.current=setTimeout(()=>{g.current=null,P(J,V,se,{...Z,loadingAlreadySet:!0})},T$)},[P,_]),F=f.useCallback(J=>{if(t.current||n.current)return M(),!1;const V=m9e(J);if(!V)return M(),!1;const se=h.current;if((se==null?void 0:se.level)==="items"&&se.from===V.from&&(se.to===V.to||se.inputMode==="search"&&V.to>=se.to||se.inputMode==="context"&&V.to>=se.to)&&se.selectedProviderId!==void 0&&C.current.some(te=>te.id===se.selectedProviderId)){if(!se.selectedProviderId)return!0;const te=se.selectedProviderId,ae=se.inputMode==="context"?d9e(te,V.query,se.mcpServerName):se.query;if(ae!==se.query){const xe={...se,from:V.from,to:V.to,query:ae,selectedIndex:0,providers:C.current};return te===Zi&&se.itemMode==="mcpResources"&&se.mcpServerName?(K(se.mcpServerName,ae,xe,{validateServer:se.validateMcpServer}),!0):($(te,ae,xe),!0)}return _({...se,from:V.from,to:V.to,query:ae,providers:C.current}),!0}const X=C.current.filter(te=>q_(V.query,te.textValue,te.description));if(X.length===0&&V.query){const te=u9e(V.query,v.current,y.current);if(te&&C.current.some(xe=>xe.id===te.providerId))return te.providerId===Zi&&te.serverName?(y.current=te.serverName,K(te.serverName,te.itemQuery,{from:V.from,to:V.to,query:te.itemQuery,level:"items",selectedProviderId:Zi,selectedIndex:0,providers:C.current,itemMode:"mcpResources",mcpServerName:te.serverName,fileDirectory:void 0,inputMode:"context",validateMcpServer:te.validateServer},{validateServer:te.validateServer}),!0):($(te.providerId,te.itemQuery,{from:V.from,to:V.to,query:te.itemQuery,level:"items",selectedProviderId:te.providerId,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:te.providerId===Xi?b.current:void 0,inputMode:"context"}),!0);const ae=C.current.find(xe=>!Qk(xe.id)&&V.query.startsWith(`${xe.id}:`));if(ae){const xe=V.query.slice(ae.id.length+1);return $(ae.id,xe,{from:V.from,to:V.to,query:xe,level:"items",selectedProviderId:ae.id,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:void 0,inputMode:"context"}),!0}if(C.current.some(xe=>xe.id===Xi))return b.current=".",$(Xi,V.query,{from:V.from,to:V.to,query:V.query,level:"items",selectedProviderId:Xi,selectedIndex:0,providers:C.current,itemMode:"default",mcpServerName:void 0,fileDirectory:b.current,inputMode:"context"}),!0}return _({from:V.from,to:V.to,query:V.query,level:"categories",selectedIndex:0,providers:X,items:[],loading:!1,inputMode:void 0}),!0},[M,t,$,K,_,n]),H=f.useCallback(J=>{const V=h.current;if(!V)return!1;const se=V.level==="categories"?V.providers.length:V.items.length;if(se<=0)return!0;const Z=k9e(V.selectedIndex,se,J);return Z===null||_({...V,selectedIndex:Z}),!0},[_]),D=f.useCallback(J=>{const V=h.current;if(!V)return!1;const se=V.level==="categories"?V.providers.length:V.items.length;return J<0||J>=se?!1:(_({...V,selectedIndex:J}),!0)},[_]),Q=f.useCallback(J=>{var X,te;const V=h.current;if(!V||V.level!=="categories")return!1;const se=V.providers[J??V.selectedIndex];if(!se)return!1;v.current=se.id,se.id===Xi&&(b.current=".");const Z=(te=(X=se.tabs)==null?void 0:X.find(ae=>!ae.disabled))==null?void 0:te.id;return $(se.id,V.query,{...V,level:"items",selectedProviderId:se.id,selectedIndex:0,tabs:se.tabs,selectedTabId:Z,itemMode:se.id===Zi?"mcpServers":"default",mcpServerName:void 0,fileDirectory:se.id===Xi?b.current:void 0,inputMode:"search"}),!0},[$]),U=f.useCallback(J=>{const V=h.current;if(!V||V.level!=="items"||!V.selectedProviderId)return!1;const se={...V,query:J,selectedIndex:0,inputMode:"search"};return V.selectedProviderId===Zi&&V.itemMode==="mcpResources"&&V.mcpServerName?(K(V.mcpServerName,J,se,{validateServer:V.validateMcpServer}),!0):($(V.selectedProviderId,J,se),!0)},[$,K]),j=f.useCallback(J=>{var Z;const V=h.current;if(!V||V.level!=="items"||!V.selectedProviderId||!((Z=V.tabs)!=null&&Z.some(X=>X.id===J&&!X.disabled)))return!1;if(V.selectedTabId===J)return!0;const se={...V,selectedTabId:J,selectedIndex:0,inputMode:"search"};return $(V.selectedProviderId,V.query,se),!0},[$]),ie=f.useCallback(()=>{const J=h.current;if(!J||J.level!=="items")return!1;if(J.selectedProviderId===Zi&&J.itemMode==="mcpResources")return $(Zi,"",{...J,query:"",selectedIndex:0,itemMode:"mcpServers",mcpServerName:void 0,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),"items";if(J.selectedProviderId===Xi){const V=Zu(J.fileDirectory??b.current);if(V!==".")return b.current=f9e(V),$(Xi,"",{...J,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),"items"}return _({...J,level:"categories",selectedProviderId:void 0,selectedIndex:0,query:"",items:[],loading:!1,itemMode:void 0,mcpServerName:void 0,fileDirectory:void 0,inputMode:void 0,tabs:void 0,selectedTabId:void 0}),A(),"categories"},[A,$,_]),oe=f.useCallback(J=>{const V=h.current;if(!V)return!1;if(V.level==="categories")return Q(J);const se=e.current;if(!se)return!1;if(V.loading)return!0;const Z=V.items[J??V.selectedIndex];if(!Z)return!1;if(V.selectedProviderId&&(v.current=V.selectedProviderId),V.selectedProviderId===Xi&&Z.kind==="directory"&&Z.targetPath)return b.current=Zu(Z.targetPath),$(Xi,"",{...V,query:"",selectedIndex:0,fileDirectory:b.current,inputMode:"search"}),!0;if(V.selectedProviderId===Zi&&Z.kind==="mcp-server"&&Z.serverName)return y.current=Z.serverName,K(Z.serverName,"",{...V,query:"",selectedIndex:0,itemMode:"mcpResources",mcpServerName:Z.serverName,fileDirectory:void 0,inputMode:"search",validateMcpServer:void 0}),!0;const X=Z.insertText??`@${Zm(eu(Z.label))} `,te=Z.composerTag&&!/\s$/.test(X)?`${X} `:X,ae=se.state.doc.length;if(V.from<0||V.to<V.from||V.to>ae)return console.warn("[@mention] stale insertion range",{from:V.from,to:V.to,docLength:ae}),M(),!0;if(!se.state.doc.sliceString(V.from,V.to).startsWith("@"))return console.warn("[@mention] stale insertion text",{from:V.from,to:V.to}),M(),!0;w.current=!0;const Ae=y9e(V.selectedProviderId,Z,te),Ne=te.trimEnd(),Le=Ae&&a?[a({from:V.from,to:V.from+Ne.length,tag:Ae})]:void 0;return se.dispatch({changes:{from:V.from,to:V.to,insert:te},...Le?{effects:Le}:{},selection:{anchor:V.from+te.length},scrollIntoView:!0}),se.focus(),M({preserveProviderSelection:!0}),!0},[M,Q,a,$,K,e]);return{state:u,close:M,closeIfOpen:L,refreshForView:F,moveSelection:H,select:D,accept:oe,enterCategory:Q,selectTab:j,backToCategories:ie,updateSearch:U}}const S9e=vn.mark({class:"cm-input-slash"}),C9e=vn.mark({class:"cm-input-at"}),T9e=vn.mark({class:"cm-input-code"});class A9e extends ll{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 M$(e,t,n){const r=new Zc,s=e.state.doc,i=[];for(let o=1;o<=s.lines;o++){const a=s.line(o),l=a.text,u=a.from;if(l.startsWith("/")){const g=l.indexOf(" "),b=g===-1?l.length:g;i.push({from:u,to:u+b,deco:S9e})}const d=GEe(l,t(),n());if(d){const g=l.endsWith(" ")?"":" ";i.push({from:u+l.length,to:u+l.length,deco:vn.widget({widget:new A9e(`${g}${d}`),side:1})})}const h=/@[^\s]+/g;let m;for(;(m=h.exec(l))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:C9e});const p=/`[^`]+`/g;for(;(m=p.exec(l))!==null;)i.push({from:u+m.index,to:u+m.index+m[0].length,deco:T9e})}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 E9e(e=()=>[],t=()=>"en"){return Fs.fromClass(class{constructor(n){Me(this,"decorations");this.decorations=M$(n,e,t)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=M$(n.view,e,t))}},{decorations:n=>n.decorations})}const M9e=It.baseTheme({".cm-input-slash":{color:"var(--agent-blue-500, #4a9eff)",fontWeight:"bold"},".cm-input-at":{color:"var(--success-color, #48bb78)"},".cm-input-code":{background:"rgba(255, 255, 255, 0.06)",borderRadius:"3px",color:"var(--muted-foreground, #a0aec0)"},".cm-input-slash-argument-hint":{color:"color-mix(in srgb, var(--muted-foreground) 70%, transparent)",pointerEvents:"none"}});function Ag(e){return e instanceof HTMLElement?e.isContentEditable?!0:!!e.closest('input, textarea, select, [contenteditable="true"], .cm-editor, [data-keyboard-scope]'):!1}function BS(e){return`url("${e.replace(/["\\\n\r\f]/g,n=>{switch(n){case'"':case"\\":return`\\${n}`;case`
`:return"\\A ";case"\r":return"\\D ";case"\f":return"\\C ";default:return""}})}")`}function Th(e,t){return{[e]:BS(t)}}const N9e=1e3,j9e=10,N$="web-shell-tooltip-styles",I9e=`
[data-web-shell-tooltip-portal] {
  pointer-events: none;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[data-web-shell-tooltip-portal] .cm-completionInfo.cm-completionInfo-left-narrow {
  right: var(--web-shell-completion-detail-start);
}
`;function R9e(){if(document.getElementById(N$))return;const e=document.createElement("style");e.id=N$,e.textContent=I9e,document.head.appendChild(e)}function D9e(e,t,n){return t<=0?null:((e+(n==="up"?-1:1))%t+t)%t}function L9e(e){return typeof e.apply=="string"&&e.apply.trim().startsWith("/")}function TN(e){return L9e(e)}function P9e(e){var t;return typeof e.apply=="string"?e.apply.trim():((t=e.displayLabel)==null?void 0:t.trim())||e.label}function O9e(e){e.querySelectorAll(".cm-completionInfo-hover").forEach(t=>{t.remove()})}function B9e(e,t,n){if(!t.detail||!TN(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=`${P9e(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,u=12,d=window.innerWidth,h=window.innerHeight,m=n.clientX+a,p=m+o.width+u>d?Math.max(u,n.clientX-o.width-a):m,g=Math.min(Math.max(u,n.clientY+l),Math.max(u,h-o.height-u));s.style.position="fixed",s.style.left=`${p}px`,s.style.top=`${g}px`,s.style.right="auto",s.style.bottom="auto"}function $9e(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 z9e(e){if(!e.detail||!TN(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=>{B9e(t,e,r)}),n.addEventListener("mouseleave",()=>{const r=t.closest("[data-web-shell-tooltip-portal]");r&&$9e(r)}))}),t}function F9e(e){return e.replace(/\r\n/g,`
`).replace(/\r/g,`
`)}function q9e(e){return[...e].length>N9e||e.split(`
`).length>j9e}function H9e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U9e(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 V9e(e,t){for(const n of e.keys())t.includes(n)||e.delete(n);return e.size===0?1:null}function W9e(e,t){if(e.size===0)return t;const n=[...e.keys()].sort((s,i)=>i.length-s.length),r=new RegExp(n.map(H9e).join("|"),"g");return t.replace(r,s=>e.get(s)??s)}function hy(e){return LW(e)}function G9e(e){return e.map(hy).join(`
`)}function $S(e){var t;return((t=e.label)==null?void 0:t.trim())??""}function zS(e){var t;return((t=e.value)==null?void 0:t.trim())??""}function AN(e){return zS(e)||$S(e)||e.id}function K9e(e,t){const n=G9e(t);return n?e?`${n}

${e}`:n:e}function Y9e(e,t){const n=t.filter(i=>i.start>=0&&i.end>i.start&&i.end<=e.length).slice().sort((i,o)=>i.start-o.start);if(n.length===0)return e;let r=0;const s=[];for(const i of n)i.start<r||(s.push(e.slice(r,i.start)),s.push(hy(i.tag)),r=i.end);return s.push(e.slice(r)),s.join("")}function FS(e){const t={...e};return delete t.iconUrl,delete t.renderContent,delete t.tooltip,delete t.tooltipText,delete t.onClick,t}const Sb=Yn.define({map:e=>e}),EN=Yn.define(),ju=Yn.define();let X9e=0;class Q9e extends ll{constructor(n){super();Me(this,"contentRoot",null);Me(this,"tooltipRoot",null);this.tag=n}eq(n){return this.tag.id===n.tag.id&&this.tag.label===n.tag.label&&this.tag.value===n.tag.value&&this.tag.kind===n.tag.kind&&this.tag.icon===n.tag.icon&&this.tag.serialized===n.tag.serialized&&this.tag.removable===n.tag.removable&&this.tag.iconUrl===n.tag.iconUrl&&this.tag.renderContent===n.tag.renderContent&&this.tag.tooltip===n.tag.tooltip&&this.tag.tooltipText===n.tag.tooltipText&&this.tag.onClick===n.tag.onClick}toDOM(n){var m,p,g;const r=document.createElement("span"),s=FS(this.tag);r.style.cssText="position:relative;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;",this.tag.onClick&&(r.setAttribute("role","button"),r.tabIndex=0,r.style.cursor="pointer",r.addEventListener("pointerdown",b=>{b.preventDefault(),b.stopPropagation()}),r.addEventListener("mousedown",b=>{b.preventDefault(),b.stopPropagation()}),r.addEventListener("click",b=>{var x,v;b.stopPropagation(),(v=(x=this.tag).onClick)==null||v.call(x,{tag:s,placement:"composer",readonly:!1,anchorRect:r.getBoundingClientRect()})}),r.addEventListener("keydown",b=>{var x,v;b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),(v=(x=this.tag).onClick)==null||v.call(x,{tag:s,placement:"composer",readonly:!1,anchorRect:r.getBoundingClientRect()}))}));const i=$S(this.tag),o=zS(this.tag),a=this.tag.kind?"":i,l=this.tag.iconUrl??hp(this.tag.kind),u=l&&Jg(l)?l:void 0;let d;try{d=(p=(m=this.tag).renderContent)==null?void 0:p.call(m,{tag:s,placement:"composer",readonly:!1})}catch(b){console.warn("[WebShell] inline tag renderContent failed",b)}let h=!1;if(d!=null){const b=document.createElement("span");b.style.cssText="display:inline-flex;align-items:center;min-width:0;max-width:100%;";try{this.contentRoot=M8.createRoot(b),this.contentRoot.render(d),r.appendChild(b),h=!0}catch(x){(g=this.contentRoot)==null||g.unmount(),this.contentRoot=null,console.warn("[WebShell] inline tag renderContent failed",x)}}if(!h&&u){const b=document.createElement("span");b.style.cssText="display:block;width:12px;height:12px;flex:0 0 auto;margin-left:7px;background:currentColor;mask:var(--composer-tag-icon-url) center / contain no-repeat;-webkit-mask:var(--composer-tag-icon-url) center / contain no-repeat;",b.style.setProperty("--composer-tag-icon-url",BS(u)),r.appendChild(b)}return h||this.appendDefaultContent(r,a,o),this.tag.tooltip!==void 0&&this.tag.tooltip!==null&&this.appendTooltip(r,this.tag.tooltip),this.tag.removable!==!1&&this.appendRemoveButton(r,n),r}appendDefaultContent(n,r,s){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(--foreground, #e4e4e4);",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)}}appendTooltip(n,r){var a;const s=document.createElement("span");s.setAttribute("role","tooltip"),s.style.cssText="position:absolute;z-index:calc(var(--web-shell-tooltip-z-index,1000) + 1);top:calc(100% + 6px);left:0;display:none;min-width:160px;max-width:min(320px,80vw);padding:8px 10px;border:1px solid var(--border);border-radius:6px;background:var(--background);box-shadow:0 8px 24px rgba(0,0,0,0.18);color:var(--foreground);font-family:var(--font-sans,system-ui,sans-serif);font-size:12px;line-height:1.5;white-space:normal;";try{this.tooltipRoot=M8.createRoot(s),this.tooltipRoot.render(r),n.appendChild(s),s.id=`composer-tag-tooltip-${++X9e}`,n.setAttribute("aria-describedby",s.id)}catch(l){(a=this.tooltipRoot)==null||a.unmount(),this.tooltipRoot=null,this.tag.tooltipText&&(n.title=this.tag.tooltipText),console.warn("[WebShell] inline tag tooltip render failed",l);return}const i=()=>{s.style.display="block"},o=()=>{s.style.display="none"};n.addEventListener("mouseenter",i),n.addEventListener("mouseleave",o),n.addEventListener("focusin",i),n.addEventListener("focusout",o)}appendRemoveButton(n,r){const s=document.createElement("button");s.type="button",s.setAttribute("aria-label",`Remove ${AN(this.tag)}`),s.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;",s.textContent="×",s.addEventListener("mousedown",i=>i.preventDefault()),s.addEventListener("keydown",i=>{if(i.key==="Enter"||i.key===" "){i.stopPropagation();return}i.key!=="Backspace"&&i.key!=="Delete"||(i.preventDefault(),i.stopPropagation(),s.click())}),s.addEventListener("click",i=>{i.stopPropagation();const o=[];r.state.field(ph).between(0,r.state.doc.length,(a,l,u)=>{const d=u.spec.tag;(d==null?void 0:d.id)===this.tag.id&&d.removable!==!1&&o.push({from:a,to:l,insert:""})}),o.length!==0&&(r.dispatch({changes:o,effects:EN.of({predicate:a=>a.id===this.tag.id}),scrollIntoView:!0}),r.focus())}),s.addEventListener("mouseenter",()=>{s.style.color="var(--error-color)"}),s.addEventListener("mouseleave",()=>{s.style.color="var(--muted-foreground)"}),n.appendChild(s)}destroy(){var n,r;(n=this.contentRoot)==null||n.unmount(),(r=this.tooltipRoot)==null||r.unmount(),this.contentRoot=null,this.tooltipRoot=null}ignoreEvent(){return!1}}function J9e(e){const t={widget:new Q9e(e.tag),inclusive:!1,tag:e.tag};return vn.replace(t).range(e.from,e.to)}const ph=lo.define({create(){return vn.none},update(e,t){let n=e.map(t.changes);for(const r of t.effects)r.is(Sb)?n=n.update({add:[J9e(r.value)]}):r.is(EN)?n=n.update({filter:(s,i,o)=>{const a=o.spec.tag;return a&&r.value.predicate?!r.value.predicate(a):!0}}):r.is(ju)&&(n=vn.none);return n},provide:e=>[It.decorations.from(e),It.atomicRanges.of(t=>t.state.field(e))]});function j$(e){const t=[],n=e.state.field(ph,!1);return n==null||n.between(0,e.state.doc.length,(r,s,i)=>{const o=i.spec.tag;o&&t.push(FS(o))}),t}function Z9e(e){const t=[];return e.state.field(ph).between(0,e.state.doc.length,(n,r,s)=>{const i=s.spec.tag;i&&t.push({start:n,end:r,tag:FS(i)})}),t}const I$=new gp,R$=new gp,D$=new gp;function lm(e,t){return t&&(e.length===0||t.startsWith(e))?t:null}function eMe(e,t){const n=lm(e,t);if(!n||e.length===0)return null;const r=n.slice(e.length);return r.length>0?r:null}class tMe extends ll{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 L$(e){return Fs.fromClass(class{constructor(t){Me(this,"decorations");this.decorations=this.buildDecorations(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.buildDecorations(t.view))}buildDecorations(t){if(!e)return vn.none;const n=t.state.selection.main,r=t.state.doc.toString(),s=eMe(r,e);return!s||!n.empty||n.head!==r.length?vn.none:vn.set([vn.widget({widget:new tMe(s),side:1}).range(r.length)])}},{decorations:t=>t.decorations})}function P$(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 nMe(e){const{onSubmit:t,onCycleMode:n,onToggleShortcuts:r,disabled:s=!1,placeholderText:i="Type a message...",commands:o,skills:a=[],slashCommandCategoryOrder:l,queuedMessages:u=[],onPopQueuedMessages:d,currentMode:h="default",onFocusFooter:m,dialogOpen:p=!1,followupState:g,onAcceptFollowup:b,onDismissFollowup:x,sessionName:v,composerInput:y,composerInputVersion:w,builtinAtProviders:k,atProviders:T,atWorkspaceCwd:S,composerTagIcons:C,renderComposerTag:_,renderComposerTagTooltip:A,onComposerTagClick:M,editorTheme:L}=e,N=tW(),{language:O,t:B}=gt(),$=f.useRef(null),P=f.useRef(null),K=f.useRef(t);K.current=t;const F=f.useRef(n);F.current=n;const H=f.useRef(r);H.current=r;const D=f.useRef(s);D.current=s;const Q=f.useRef(o);Q.current=o;const U=f.useRef(a);U.current=a;const j=f.useRef(l);j.current=l;const ie=f.useRef(B);ie.current=B;const oe=f.useRef(u);oe.current=u;const J=f.useRef(d);J.current=d;const V=f.useRef(g);V.current=g;const se=f.useRef(b);se.current=b;const Z=f.useRef(x);Z.current=x;const X=f.useRef(m);X.current=m;const te=f.useRef(O);te.current=O;const ae=f.useRef(void 0);if(N&&S){const ce=N.client.workspaceByCwd(S);ae.current={...N.actions,async globWorkspace(ve,Fe){var Yt,On;(Yt=Fe==null?void 0:Fe.signal)==null||Yt.throwIfAborted();const ot=await ce.glob(ve,{maxResults:Fe==null?void 0:Fe.maxResults,signal:Fe==null?void 0:Fe.signal});return(On=Fe==null?void 0:Fe.signal)==null||On.throwIfAborted(),{matches:Array.isArray(ot.matches)?ot.matches.filter(Ye=>typeof Ye=="string"):[]}},async listDirectory(ve,Fe){var _n,Yt;if((_n=Fe==null?void 0:Fe.signal)!=null&&_n.aborted)return{kind:"list",path:ve,entries:[],truncated:!1};const ot=await ce.dirList(ve);return(Yt=Fe==null?void 0:Fe.signal)!=null&&Yt.aborted?{kind:"list",path:ve,entries:[],truncated:!1}:ot}}}else ae.current=N==null?void 0:N.actions;const xe=f.useRef(C);xe.current=C;const Ae=f.useRef(_);Ae.current=_;const Ne=f.useRef(A);Ne.current=A;const Le=f.useRef(M);Le.current=M;const ge=f.useCallback(ce=>{var Yt;const ve=ce.icon??hp(ce.kind,xe.current),Fe={tag:ce,placement:"composer",readonly:!1};let ot;try{ot=(Yt=Ne.current)==null?void 0:Yt.call(Ne,Fe)}catch(On){console.warn("[WebShell] inline tag tooltip render failed",On)}const _n=typeof ot=="string"||typeof ot=="number"?String(ot):void 0;return{...ce,...ve?{iconUrl:ve}:{},...Ae.current?{renderContent:Ae.current}:{},...ot!=null?{tooltip:ot}:{},..._n?{tooltipText:_n}:{},...Le.current?{onClick:Le.current}:{}}},[]),[Oe,Nt]=f.useState(!1),Pe=f.useRef(Oe);Pe.current=Oe;const Ce=_9e({viewRef:P,disabledRef:D,shellModeRef:Pe,workspaceActionsRef:ae,workspaceKey:S,builtinProviders:k,providers:T,createInlineTagEffect:ce=>Sb.of({...ce,tag:ge(ce.tag)})}),Zt=Ce.close,dt=Ce.refreshForView;f.useEffect(()=>{const ce=P.current;if(!ce)return;const ve=[ju.of()];ce.state.field(ph).between(0,ce.state.doc.length,(Fe,ot,_n)=>{const Yt=_n.spec.tag;Yt&&ve.push(Sb.of({from:Fe,to:ot,tag:ge(FS(Yt))}))}),ve.length!==1&&ce.dispatch({effects:ve})},[C,M,_,A,ge]);const Ge=f.useCallback(()=>{var ce,ve,Fe;(ce=V.current)!=null&&ce.isVisible&&((ve=Z.current)==null||ve.call(Z)),Nt(ot=>!ot),(Fe=P.current)==null||Fe.focus()},[]),[St,Y]=f.useState(!1),[je,We]=f.useState(""),[Te,jt]=f.useState([]),[zt,bn]=f.useState(0),Pn=f.useRef(null),qe=f.useRef(null),At=f.useRef(""),[he,Be]=f.useState([]),Ie=f.useRef([]),Ke=f.useRef(new Map),ne=f.useRef(1),[De,Dt]=f.useState([]),ze=f.useRef([]);ze.current=De;const Lt=f.useRef(y);Lt.current=y;const ke=f.useRef(()=>!0),Ot=f.useRef(null),[fe,pt]=f.useState(null),He=f.useRef(null),on=f.useRef(!1),Ze=f.useCallback(ce=>{He.current=ce,pt(ce)},[]),Et=f.useCallback(()=>{const ce=Ot.current,ve=P.current;if(!ce||!ve)return;const Fe=ve.state.doc,ot=ce.from+ce.text.length;Fe.length===ot&&Fe.sliceString(ce.from,ot)===ce.text&&ve.dispatch({changes:{from:ce.from,to:ot,insert:""}}),Ot.current=null},[]),wn=f.useCallback(()=>{Et(),Zt()},[Et,Zt]),qr=Ce.closeIfOpen,cr=f.useCallback(()=>{const ce=qr();return ce?(ce==="closed"&&Et(),!0):!1},[Et,qr]),Jn=f.useCallback((ce,ve)=>{var On;if(!ce||D.current||Pe.current){Ze(null);return}if(on.current){Ze(null);return}const Fe=ce.state.selection.main;if(!Fe.empty){Ze(null);return}const ot=QEe(ce.state.doc.toString(),Fe.head,Q.current,U.current,te.current,Ye=>ie.current(Ye),j.current??ov);if(!ot){Ze(null);return}wn();const _n=ve??((On=He.current)==null?void 0:On.selectedIndex)??0,Yt=Math.max(0,Math.min(_n,ot.items.length-1));Ze({...ot,selectedIndex:Yt})},[wn,Ze]),Ft=f.useCallback(()=>{Ze(null)},[Ze]),dn=f.useCallback(ce=>{const ve=He.current;return!ve||ce<0||ce>=ve.items.length?!1:(ve.selectedIndex===ce||Ze({...ve,selectedIndex:ce}),!0)},[Ze]),sr=f.useCallback(ce=>{const ve=He.current;if(!ve)return!1;const Fe=D9e(ve.selectedIndex,ve.items.length,ce);return Fe===null?!1:(Ze({...ve,selectedIndex:Fe}),!0)},[Ze]),Rn=f.useCallback(ce=>{const ve=P.current,Fe=He.current;if(!ve||!Fe)return!1;const ot=Fe.items[ce??Fe.selectedIndex];return ot?(ve.dispatch({changes:{from:Fe.from,to:Fe.to,insert:ot.apply},selection:{anchor:Fe.from+ot.apply.length},scrollIntoView:!0}),ve.focus(),!0):!1},[]),[Vn,Zn]=f.useState(!1);f.useEffect(()=>{const ce=P.current,ve=(ce==null?void 0:ce.state.doc.toString())??"",Fe=lm(ve,g!=null&&g.isVisible?g.suggestion:null);Zn(ve.trim().length>0||!!Fe||De.length>0||he.length>0)},[De,he,g==null?void 0:g.isVisible,g==null?void 0:g.suggestion]);const kn=C$(),er=C$("qwen-web-shell-command-history"),{push:Ms,navigateUp:Ss,navigateDown:Hr,isNavigating:rs,reset:Hs,getReverseMatches:Us,getLastEntry:Ur,resetSearch:Ar}=kn,Un=f.useRef({push:Ms,navigateUp:Ss,navigateDown:Hr,isNavigating:rs,reset:Hs,getReverseMatches:Us,getLastEntry:Ur,resetSearch:Ar});Un.current={push:Ms,navigateUp:Ss,navigateDown:Hr,isNavigating:rs,reset:Hs,getReverseMatches:Us,getLastEntry:Ur,resetSearch:Ar};const or=f.useRef(er);or.current=er,Ie.current=he;const Cs=f.useCallback(ce=>{const ve=Pe.current,ot=(ve?or.current:Un.current).getReverseMatches(ce);return ve?ot:ot.filter(_n=>!_n.trimStart().startsWith("/"))},[]),Ls=f.useCallback(()=>{if(D.current)return;const ce=P.current;if(!ce)return;Ft(),wn();const ve=ce.state.doc.toString();At.current=ve,Y(!0),We("");const Fe=Pe.current?or.current:Un.current;jt(Cs("")),bn(0),Fe.resetSearch(),setTimeout(()=>{var ot;return(ot=Pn.current)==null?void 0:ot.focus()},0)},[wn,Ft,Cs]),be=f.useRef(Ls);be.current=Ls;const st=f.useCallback(()=>{if(D.current)return;const ce=P.current;if(!ce)return;if(Na(ce.state)==="active"){Ch(!1)(ce),ce.focus();return}if(ce.state.doc.lines>1){ce.focus();return}const ve=Pe.current?or.current:Un.current,Fe=ce.state.doc.toString(),ot=ve.navigateUp(Fe);ot!==null&&ce.dispatch({changes:{from:0,to:ce.state.doc.length,insert:ot},selection:{anchor:ot.length}}),ce.focus()},[]),Ct=f.useCallback(()=>{if(D.current)return;const ce=P.current;if(!ce)return;if(Na(ce.state)==="active"){Ch(!0)(ce),ce.focus();return}if(ce.state.doc.lines>1){ce.focus();return}const Fe=(Pe.current?or.current:Un.current).navigateDown();Fe!==null&&ce.dispatch({changes:{from:0,to:ce.state.doc.length,insert:Fe},selection:{anchor:Fe.length}}),ce.focus()},[]);f.useEffect(()=>{var cs,Ns;if(!$.current)return;R9e();const ce=document.createElement("div");ce.setAttribute("data-web-shell-tooltip-portal",""),ce.style.position="fixed",ce.style.inset="0",ce.style.zIndex="var(--web-shell-tooltip-z-index)",ce.style.pointerEvents="none";const ve=/\b\S*theme(?:Dark|Light)\S*/gi,Fe=()=>{var Tt,xn;let $e=$.current,ht=null;if($.current){const Sn=getComputedStyle($.current);for(let En=0;En<Sn.length;En+=1){const pr=Sn[En];pr.startsWith("--")&&ce.style.setProperty(pr,Sn.getPropertyValue(pr))}Sn.getPropertyValue("--web-shell-tooltip-z-index").trim()||ce.style.setProperty("--web-shell-tooltip-z-index","1000")}for(;$e;){const Sn=(xn=(Tt=$e.className)==null?void 0:Tt.match)==null?void 0:xn.call(Tt,ve);if(Sn){ht=Sn[0];break}$e=$e.parentElement}ht&&(ce.className=ht)};Fe(),document.body.appendChild(ce);const ot=new MutationObserver(Fe);let _n=$.current;for(;_n&&(ot.observe(_n,{attributes:!0,attributeFilter:["class","style"]}),!((Ns=(cs=_n.className)==null?void 0:cs.match)!=null&&Ns.call(cs,ve)));)_n=_n.parentElement;const Yt=($e,ht,Tt)=>{const xn=Tt===void 0?Z9e($e):[],Sn=$e.state.doc.toString(),En=V.current,pr=ht===void 0&&xn.length===0&&(En!=null&&En.isVisible)?lm(Sn,En.suggestion):null,yr=ht??pr??Sn,ps=yr.length-yr.trimStart().length,Gi=yr.trim(),Ca=ht===void 0&&pr===null?xn.map(ni=>({...ni,start:ni.start-ps,end:ni.end-ps})).filter(ni=>ni.end>0).map(ni=>({...ni,start:Math.max(0,ni.start)})):[],To=Tt??ze.current;if(!Gi&&To.length===0&&xn.length===0)return!0;const Ta=Tt===void 0?Y9e(Gi,Ca):Gi,fu=W9e(Ke.current,Ta),Or=K9e(fu,To),Xo=Ie.current,Ad=Pe.current,Ed=Ad?`!${Or}`:Or,mu=Zme(Ed,[...To,...Ca.map(ni=>ni.tag)]);let pu=!1;const ql=()=>{var ni,Md;pu||(pu=!0,Ze(null),pr&&((ni=se.current)==null||ni.call(se,"enter",{skipOnAccept:!0})),(Md=Z.current)==null||Md.call(Z),Ke.current.clear(),ne.current=1,Ad?(or.current.push(fu),or.current.reset()):(Un.current.push(fu),Un.current.reset()),on.current=!1,Dt([]),Be([]),$e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:""},effects:ju.of()}))};return K.current(Ed,Xo.length>0?[...Xo]:void 0,ql,mu.length>0?{inputAnnotations:mu}:void 0)===!1||ql(),!0};ke.current=Yt;const On=$e=>($e.dispatch($e.state.replaceSelection(`
`)),!0),Ye=($e,ht)=>{var En;const Tt=V.current,xn=Tt==null?void 0:Tt.suggestion,Sn=lm($e.state.doc.toString(),xn);return!(Tt!=null&&Tt.isVisible)||!Sn?!1:($e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:Sn},selection:{anchor:Sn.length},scrollIntoView:!0}),$e.focus(),(En=se.current)==null||En.call(se,ht,{skipOnAccept:!0}),!0)},Tn=kg.of([{key:"Backspace",run:$e=>{var Sn;const ht=$e.state.selection.main;if(!ht.empty||ht.from!==0)return!1;let Tt=!1;if($e.state.field(ph).between(0,1,En=>{En===0&&(Tt=!0)}),Tt)return!1;let xn=-1;for(let En=ze.current.length-1;En>=0;En-=1)if(((Sn=ze.current[En])==null?void 0:Sn.removable)!==!1){xn=En;break}return xn<0?!1:(Dt(En=>En.filter((pr,yr)=>yr!==xn)),!0)}},{key:"Delete",run:$e=>{const ht=$e.state.selection.main;if(!ht.empty||ht.from!==0)return!1;let Tt=!1;if($e.state.field(ph).between(0,1,Sn=>{Sn===0&&(Tt=!0)}),Tt)return!1;const xn=ze.current.findIndex(Sn=>Sn.removable!==!1);return xn<0?!1:(Dt(Sn=>Sn.filter((En,pr)=>pr!==xn)),!0)}},{key:"Enter",run:$e=>{var Sn;if(Ce.accept())return!0;if(He.current)return Rn();if(Na($e.state)==="active")return!1;const ht=V.current,xn=j$($e).length>0?null:lm($e.state.doc.toString(),ht==null?void 0:ht.suggestion);return ht!=null&&ht.isVisible&&xn?((Sn=se.current)==null||Sn.call(se,"enter",{skipOnAccept:!0}),Yt($e,xn)):Yt($e)}},{key:"Shift-Enter",run:On},{key:"Ctrl-j",run:On},{key:"Mod-Enter",run:On},{key:"Alt-Enter",run:On},{key:"Escape",run:()=>cr()?!0:He.current?(Ft(),!0):Pe.current?(Nt(!1),!0):!1},{key:"Ctrl-o",run:()=>!0},{key:"Ctrl-l",run:()=>!0},{key:"Ctrl-y",run:()=>!0},{key:"ArrowUp",run:$e=>{var pr;const ht=Pe.current?or.current:Un.current;if(on.current)Xk($e),Ft(),wn();else{if(Ce.moveSelection("up")||sr("up"))return!0;if(Na($e.state)==="active")return Ch(!1)($e)}const xn=P$($e,"up");if(xn==="handled")return!0;if(xn==="editor")return!1;if(Pe.current){const yr=$e.state.doc.toString(),ps=ht.navigateUp(yr);return ps===null||(on.current=!0,$e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:ps},selection:{anchor:ps.length}})),!0}if(oe.current.length>0&&(pr=J.current)!=null&&pr.call(J))return!0;const Sn=$e.state.doc.toString(),En=ht.navigateUp(Sn);return En===null?!1:(on.current=!0,$e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:En},selection:{anchor:En.length}}),!0)}},{key:"ArrowDown",run:$e=>{var En;const ht=Pe.current?or.current:Un.current;if(on.current)Xk($e),Ft(),wn();else{if(Ce.moveSelection("down")||sr("down"))return!0;if(Na($e.state)==="active")return Ch(!0)($e)}const xn=P$($e,"down");if(xn==="handled")return!0;if(xn==="editor")return!1;if(Pe.current){const pr=ht.navigateDown();return pr===null||(on.current=ht.isNavigating(),$e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:pr},selection:{anchor:pr.length}})),!0}const Sn=ht.navigateDown();return Sn===null?((En=X.current)==null?void 0:En.call(X))??!1:(on.current=ht.isNavigating(),$e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:Sn},selection:{anchor:Sn.length}}),!0)}},{key:"Ctrl-r",run:()=>(be.current(),!0)},{key:"Tab",run:$e=>{if(Ce.accept()||Ye($e,"tab"))return!0;if(He.current)return Rn();if(Na($e.state)==="active")return SJ($e);const ht=$e.state.doc.toString(),Tt=WEe(ht,Q.current,te.current);if(Tt)return $e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:Tt},selection:{anchor:Tt.length}}),!0;const xn=VEe(ht,Q.current);return xn&&$e.dispatch({changes:{from:0,to:$e.state.doc.length,insert:xn},selection:{anchor:xn.length}}),!0}},{key:"ArrowRight",run:$e=>!!(Na($e.state)!=="active"&&Ye($e,"right"))},{key:"Shift-Tab",run:()=>{var $e;return($e=F.current)==null||$e.call(F),!0}}]),nn=It.updateListener.of($e=>{if($e.docChanged&&Ke.current.size>0){const Tt=V9e(Ke.current,$e.state.doc.toString());Tt!==null&&(ne.current=Tt)}$e.transactions.some(Tt=>Tt.isUserEvent("input")||Tt.isUserEvent("delete"))&&(on.current=!1),($e.docChanged||$e.selectionSet)&&(Jn($e.view),on.current?wn():dt($e.view)&&Ft())});let ur=!1;const Nr=It.updateListener.of($e=>{const ht=Ot.current,Tt=Na($e.state)==="active";if(ht){const xn=$e.state.doc;if(!(xn.length===ht.from+ht.text.length&&xn.sliceString(ht.from)===ht.text))Ot.current=null;else if(ur&&!Tt){Ot.current=null;const{view:En}=$e,{from:pr}=ht;window.setTimeout(()=>{if(P.current!==En)return;const yr=En.state.doc;yr.length===pr+ht.text.length&&yr.sliceString(pr)===ht.text&&En.dispatch({changes:{from:pr,to:pr+ht.text.length,insert:""}})},0)}}ur=Tt,Tt||O9e(ce)}),ti=Ir.create({doc:"",extensions:[vf.highest(Tn),gEe,cN(),kg.of([...hN,...uN]),MJ({override:[],activateOnTyping:!0,icons:!1,optionClass:$e=>{const ht=[];return $e.type==="file"&&ht.push("cm-file-completion"),TN($e)&&ht.push("cm-command-info-completion"),ht.join(" ")},addToOptions:[{render:z9e,position:90}],maxRenderedOptions:300,aboveCursor:!0,positionInfo:($e,ht,Tt,xn,Sn)=>{const En=xn.bottom-xn.top,pr=Sn.bottom-ht.bottom,yr=pr>=En||pr>ht.top,ps=yr?"top":"bottom",Gi=yr?Tt.bottom-ht.top:ht.bottom-Tt.top;return{style:`${ps}: ${Gi}px`,class:"cm-completionInfo-right-narrow"}},activateOnCompletion:$e=>typeof $e.apply=="string"&&$e.apply.endsWith(" ")}),Z6e({parent:ce}),R$.of(MB("")),D$.of(L$(null)),It.lineWrapping,I$.of(It.editable.of(!0)),E9e(()=>Q.current,()=>te.current),M9e,ph,nn,Nr,It.updateListener.of($e=>{if($e.docChanged){const ht=$e.state.doc.toString(),Tt=V.current,xn=lm(ht,Tt!=null&&Tt.isVisible?Tt.suggestion:null);Zn(ht.trim().length>0||!!xn||ze.current.length>0||Ie.current.length>0)}}),It.inputHandler.of(($e,ht,Tt,xn)=>{var Sn;return xn==="!"&&$e.state.doc.toString()===""&&Na($e.state)!=="active"?(Ge(),!0):xn==="?"&&$e.state.doc.toString()===""&&Na($e.state)!=="active"?((Sn=H.current)==null||Sn.call(H),!0):!1}),It.domEventHandlers({blur($e){return Ft(),$e.relatedTarget instanceof Element&&$e.relatedTarget.closest('[data-at-mention-panel="true"]')||window.setTimeout(()=>{const ht=P.current;ht!=null&&ht.hasFocus||document.activeElement instanceof Element&&document.activeElement.closest('[data-at-mention-panel="true"]')||wn()},0),!1},paste($e){var yr,ps,Gi,Ca;const ht=(yr=$e.clipboardData)==null?void 0:yr.items;if(!ht)return!1;let Tt=!1;for(const To of ht)if(To.type.startsWith("image/")&&/^image\/(png|jpeg|gif|webp)$/i.test(To.type)){Tt=!0;const Ta=To.getAsFile();if(!Ta)continue;const fu=To.type,Or=new FileReader;Or.onload=()=>{const Xo=Or.result.split(",")[1];Be(Ad=>[...Ad,{data:Xo,media_type:fu}])},Or.readAsDataURL(Ta)}if(Tt)return $e.preventDefault(),!0;const xn=F9e(((ps=$e.clipboardData)==null?void 0:ps.getData("text/plain"))??"");if(!xn||!q9e(xn))return!1;$e.preventDefault(),dr.state.doc.toString()===""&&((Gi=V.current)!=null&&Gi.isVisible)&&((Ca=Z.current)==null||Ca.call(Z));const{placeholderText:Sn,nextPasteId:En}=U9e(Ke.current,ne.current,xn);ne.current=En;const pr=dr.state.selection.main;return dr.dispatch({changes:{from:pr.from,to:pr.to,insert:Sn},selection:{anchor:pr.from+Sn.length},scrollIntoView:!0}),!0}}),It.theme(L)]}),dr=new It({state:ti,parent:$.current});P.current=dr,dr.focus();const Yo=dr.state.doc.toString().trim();return Zn(Yo.length>0||ze.current.length>0||Ie.current.length>0),()=>{dr.dispatch({effects:ju.of()}),dr.destroy(),P.current=null,ot.disconnect(),ce.remove()}},[]),f.useEffect(()=>{const ce=P.current;ce&&(ce.dispatch({effects:I$.reconfigure(It.editable.of(!s))}),s||ce.focus())},[s]),f.useEffect(()=>{const ce=P.current;if(!ce)return;const ve=!s&&(g!=null&&g.isVisible)&&g.suggestion?g.suggestion:null,Fe=ve??(Oe?B("editor.shellPlaceholder"):i);ce.dispatch({effects:[R$.reconfigure(MB(Fe)),D$.reconfigure(L$(ve))]})},[s,i,Oe,B,g==null?void 0:g.isVisible,g==null?void 0:g.suggestion]),f.useEffect(()=>{const ce=P.current;!ce||Na(ce.state)!=="active"||(Xk(ce),window.setTimeout(()=>{P.current===ce&&Yk(ce)},0))},[O]);const Bt=[o.map(ce=>{var ve;return[ce.name,ce.description??"",ce.source??"",ce.displayCategory??"",ce.argumentHint??"",((ve=ce.subcommands)==null?void 0:ve.join(","))??""].join("\0")}).join(""),a.map(ce=>[ce.name,ce.description].join("\0")).join(""),(l==null?void 0:l.join("|"))??""].join("");f.useEffect(()=>{He.current&&Jn(P.current)},[Bt,O,Jn]),f.useEffect(()=>{const ce=P.current;ce&&(p?(Ft(),wn(),ce.contentDOM.blur()):ce.focus())},[wn,p,Ft]),f.useEffect(()=>{const ce=ve=>{var nn,ur,Nr;if(D.current||St||p||ve.defaultPrevented)return;const Fe=ve.target,ot=(nn=$.current)==null?void 0:nn.contains(Fe),_n=document.activeElement===document.body;if(!ot&&!_n)return;const Yt=P.current,On=V.current,Ye=lm((Yt==null?void 0:Yt.state.doc.toString())??"",On==null?void 0:On.suggestion);if(Yt&&!Yt.hasFocus&&(On!=null&&On.isVisible)&&Ye&&!Ag(ve.target)){if(ve.key==="Tab"&&!ve.shiftKey&&!ve.metaKey&&!ve.ctrlKey&&!ve.altKey&&Na(Yt.state)!=="active"){ve.preventDefault(),Yt.dispatch({changes:{from:0,to:Yt.state.doc.length,insert:Ye},selection:{anchor:Ye.length},scrollIntoView:!0}),Yt.focus(),(ur=se.current)==null||ur.call(se,"tab",{skipOnAccept:!0});return}if(ve.key==="ArrowRight"&&!ve.shiftKey&&!ve.metaKey&&!ve.ctrlKey&&!ve.altKey&&Na(Yt.state)!=="active"){ve.preventDefault(),Yt.dispatch({changes:{from:0,to:Yt.state.doc.length,insert:Ye},selection:{anchor:Ye.length},scrollIntoView:!0}),Yt.focus(),(Nr=se.current)==null||Nr.call(se,"right",{skipOnAccept:!0});return}}if(ve.metaKey||ve.ctrlKey||ve.altKey||ve.key.length!==1||Ag(ve.target)||!Yt||Yt.hasFocus)return;if(ve.preventDefault(),ve.key==="!"&&Yt.state.doc.toString()===""){Ge();return}const Tn=Yt.state.selection.main;Yt.dispatch({changes:{from:Tn.from,to:Tn.to,insert:ve.key},selection:{anchor:Tn.from+ve.key.length},scrollIntoView:!0}),Yt.focus(),ve.key==="/"?window.setTimeout(()=>{Jn(P.current)},0):ve.key==="@"&&window.setTimeout(()=>{const ti=P.current;ti&&ti.hasFocus&&(Ft(),dt(ti))},0)};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[dt,Ft,St,p,Jn,Ge]);const qt=f.useCallback(()=>{var ce;(ce=P.current)==null||ce.focus()},[]),tr=f.useCallback((ce,ve)=>{const Fe=P.current;if(!Fe||!ce){Fe==null||Fe.focus();return}if((ve==null?void 0:ve.mode)==="replace"){Fe.dispatch({changes:{from:0,to:Fe.state.doc.length,insert:ce},effects:ju.of(),selection:{anchor:ce.length},scrollIntoView:!0}),Fe.focus();return}const ot=Fe.state.selection.main;let _n=ce,Yt=!1,On=null;const Ye=ce==="@";let Tn=ce==="/";if(ce==="/")Fe.state.doc.lineAt(ot.head).text.startsWith("/")?Yt=!0:Fe.state.doc.length>0&&(Yt=!0,Tn=!1);else if(ce==="@"){const nn=ot.from>0?Fe.state.doc.sliceString(ot.from-1,ot.from):"";Fe.state.doc.sliceString(ot.from,ot.from+1)==="@"?(Yt=!0,On=ot.from+1):nn==="@"?Yt=!0:nn&&!/\s/.test(nn)&&(_n=" @")}Yt?On!==null&&Fe.dispatch({selection:{anchor:On},scrollIntoView:!0}):(Fe.dispatch({changes:{from:ot.from,to:ot.to,insert:_n},selection:{anchor:ot.from+_n.length},scrollIntoView:!0}),Ye&&(Ot.current={text:_n,from:ot.from})),Fe.focus(),Tn?window.setTimeout(()=>{Jn(P.current)},0):Ye&&window.setTimeout(()=>{const nn=P.current;nn&&nn.hasFocus&&(Ft(),dt(nn))},0)},[Ft,dt,Jn]),Lr=f.useCallback(()=>{var ce;return((ce=P.current)==null?void 0:ce.state.doc.toString())??""},[]),ss=f.useCallback(ce=>{const ve=P.current;ve&&(ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ce},effects:ju.of(),selection:{anchor:ce.length},scrollIntoView:!0}),ve.focus())},[]),Vr=f.useCallback(ce=>{const ve=P.current;if(!ve)return;const Fe=[];ve.state.field(ph).between(0,ve.state.doc.length,(ot,_n,Yt)=>{const On=Yt.spec.tag;On&&(!ce||ce(On))&&Fe.push({from:ot,to:_n,insert:""})}),Fe.length!==0&&ve.dispatch({changes:Fe,effects:EN.of({predicate:ce}),scrollIntoView:!0})},[]),$n=f.useCallback(ce=>{const ve=(ce==null?void 0:ce.text)??!0,Fe=(ce==null?void 0:ce.tags)??!0,ot=P.current;ve&&ot&&ot.state.doc.length>0&&ot.dispatch({changes:{from:0,to:ot.state.doc.length,insert:""},effects:ju.of()}),ve&&(Be([]),Ke.current.clear(),ne.current=1),Fe&&(Dt([]),ve||Vr())},[Vr]),An=f.useCallback(()=>{$n({text:!0,tags:!1})},[$n]),Er=f.useCallback((ce,ve)=>{if(ce.length!==0){if((ve==null?void 0:ve.placement)==="inline"){const Fe=P.current;if(!Fe)return;const ot=Fe.state.selection.main;let _n=ot.from;const Yt=[],On=ce.map(Tn=>{const nn=hy(Tn);return Yt.push({from:_n,to:_n+nn.length,tag:Tn}),_n+=nn.length+1,nn}).join(" "),Ye=On?`${On} `:"";Fe.dispatch({changes:{from:ot.from,to:ot.to,insert:Ye},effects:Yt.length>0?Yt.map(Tn=>Sb.of({...Tn,tag:ge(Tn.tag)})):void 0,selection:{anchor:ot.from+Ye.length},scrollIntoView:!0}),Fe.focus();return}Dt(Fe=>{const ot=[...Fe];for(const _n of ce){const Yt=ot.findIndex(On=>On.id===_n.id);Yt>=0?ot[Yt]=_n:ot.push(_n)}return ot})}},[ge]),Pr=f.useCallback(ce=>{Dt(ve=>{const Fe=ve.filter(ot=>ot.id!==ce||ot.removable===!1);return Fe.length===ve.length?ve:Fe}),Vr(ve=>ve.id===ce&&ve.removable!==!1)},[Vr]),de=f.useCallback(()=>{var ce;return(((ce=P.current)==null?void 0:ce.state.doc.toString().trim().length)??0)>0||ze.current.length>0||Ie.current.length>0},[]),Ee=f.useCallback(ce=>{const ve=P.current;if(!ve)return;const Fe=j$(ve);if((ce==null?void 0:ce.tagPlacement)==="inline"){ke.current(ve,ce.text??"",ce.tags??Fe);return}if((ce==null?void 0:ce.text)!==void 0&&ce.tags===void 0&&Fe.length>0){ke.current(ve,ce.text,Fe);return}ke.current(ve,ce==null?void 0:ce.text,ce?ce.tags??[]:void 0)},[]),rt=f.useCallback(()=>{const ce=Un.current.getLastEntry(Fe=>!Fe.startsWith("/")&&!Fe.startsWith("!"));!ce||K.current(ce)===!1||Be([])},[]),yt=f.useCallback(ce=>{const ve=P.current;ve&&ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:ce},selection:{anchor:ce.length},scrollIntoView:!0})},[]);f.useEffect(()=>{const ce=Lt.current;if(!ce)return;const ve=P.current;if(!ve)return;const Fe=ce.tagPlacement??"top";if(ce.tags!==void 0&&Fe==="top"&&Dt([...ce.tags]),ce.text!==void 0||Fe==="inline"){const _n=Fe==="inline"?[...ce.tags??[]]:[],Yt=_n.map(hy).join(" "),On=Fe==="inline"?Yt&&ce.text?`${Yt} ${ce.text}`:Yt||(ce.text??""):ce.text??"",Ye=[ju.of()];if(_n.length>0){let Tn=0;for(const nn of _n){const ur=hy(nn);Ye.push(Sb.of({from:Tn,to:Tn+ur.length,tag:ge(nn)})),Tn+=ur.length+1}}ve.dispatch({changes:{from:0,to:ve.state.doc.length,insert:On},effects:Ye,selection:{anchor:On.length},scrollIntoView:!0})}else ve.dispatch({effects:ju.of()});(ce.text!==void 0||ce.submit)&&ve.focus();let ot=null;return ce.submit&&(ot=window.setTimeout(()=>{P.current&&Ee(ce)},0)),()=>{ot!==null&&window.clearTimeout(ot)}},[w,ge,Ee]);const wt=f.useCallback((ce,ve=!0)=>{var ot;ce&&yt(At.current),Y(!1),We(""),jt([]),bn(0),(Pe.current?or.current:Un.current).resetSearch(),ve&&((ot=P.current)==null||ot.focus())},[yt]);f.useEffect(()=>{if(!St)return;const ce=ve=>{if(ve instanceof MouseEvent&&ve.button!==0||ve.defaultPrevented)return;const Fe=qe.current,ot=ve.target;Fe&&ot instanceof Node&&!Fe.contains(ot)&&wt(!0,!1)};return window.addEventListener("mousedown",ce),window.addEventListener("touchstart",ce),()=>{window.removeEventListener("mousedown",ce),window.removeEventListener("touchstart",ce)}},[St,wt]);const mn=f.useCallback(ce=>{var On;if(!P.current)return;wt(!1);const Fe=ce.trim();if(!Fe)return;const ot=Ie.current,_n=Pe.current;if(K.current(_n?`!${Fe}`:Fe,ot.length>0?[...ot]:void 0)===!1){yt(ce);return}(On=Z.current)==null||On.call(Z),_n?(or.current.push(Fe),or.current.reset()):(Un.current.push(Fe),Un.current.reset()),Be([]),yt("")},[wt,yt]),we=ce=>{if(!ce.nativeEvent.isComposing)if(ce.key==="Escape")ce.preventDefault(),wt(!0);else if(ce.key==="Tab"){ce.preventDefault();const ve=Te[zt];ve&&yt(ve),wt(!1)}else if(ce.key==="Enter"){ce.preventDefault();const ve=Te[zt];ve?mn(ve):wt(!1)}else ce.key==="r"&&ce.ctrlKey&&(ce.preventDefault(),Te.length>0&&bn(ve=>(ve+1)%Te.length))},Pt=ce=>{const ve=Pe.current?or.current:Un.current;jt(Cs(ce)),bn(0),ve.resetSearch()},yn=ce=>{const ve=ce.target.value;We(ve),!ce.nativeEvent.isComposing&&Pt(ve)},zn=ce=>{const ve=ce.currentTarget.value;We(ve),Pt(ve)},Xn=f.useCallback(ce=>{Be(ve=>ve.filter((Fe,ot)=>ot!==ce))},[]),Hn=!Oe&&!St&&!(g!=null&&g.isVisible)&&!s&&!p,Mr=f.useCallback(ce=>{Be(ve=>[...ve,...ce])},[]),is=f.useMemo(()=>({clearText:An,clear:$n,focus:qt,getText:Lr,hasInput:de,setText:ss,addTags:Er,removeTag:Pr,insertText:tr,retryLast:rt,restoreImages:Mr,submit:Ee}),[Er,$n,An,qt,Lr,de,tr,Pr,Mr,rt,ss,Ee]);return{containerRef:$,viewRef:P,focus:qt,submitText:f.useCallback(()=>{const ce=P.current;ce&&ke.current(ce)},[]),clearText:An,getText:Lr,hasInput:de,hasContent:Vn,handle:is,pastedImages:he,removeImage:Xn,composerTags:De,removeTopTag:Pr,addTags:Er,removeInlineTags:Vr,insertText:tr,setText:ss,submit:Ee,clear:$n,retryLast:rt,replaceEditorText:yt,shellMode:Oe,setShellMode:Nt,toggleShellMode:Ge,currentMode:h,sessionName:v,searchState:{searchMode:St,searchQuery:je,searchMatches:Te,searchActiveIndex:zt,searchInputRef:Pn,searchUiRef:qe,openHistorySearch:Ls,closeSearch:wt,submitSearchMatch:mn,handleSearchKeyDown:we,handleSearchInput:yn,handleSearchCompositionEnd:zn},navigatePrevHistory:st,navigateNextHistory:Ct,showShortcutHints:Hn,followupState:g,disabled:s,onAcceptFollowup:b,onDismissFollowup:x,slashMenu:fe,closeSlashMenu:Ft,selectSlashCompletion:dn,acceptSlashCompletion:Rn,atMenu:Ce.state,closeAtMenu:wn,selectAtCompletion:Ce.select,acceptAtCompletion:Ce.accept,enterAtCategory:Ce.enterCategory,backAtCategories:Ce.backToCategories,updateAtSearch:Ce.updateSearch,selectAtTab:Ce.selectTab}}const rMe="_flash_96ig5_1",lf={flash:rMe},sMe="_chatMessageRow_17pz3_41",iMe="_chatBubble_17pz3_48",oMe="_chatContent_17pz3_61",aMe="_messageTag_17pz3_66",lMe="_messageTagTooltip_17pz3_83",cMe="_messageTagClickable_17pz3_117",uMe="_messageTagIcon_17pz3_127",dMe="_messageTagLabel_17pz3_138",hMe="_messageTagValue_17pz3_139",fMe="_chatContentCollapsed_17pz3_162",mMe="_toggleButton_17pz3_167",pMe="_toggleIcon_17pz3_188",gMe="_toggleIconExpanded_17pz3_195",bMe="_chatImages_17pz3_199",yMe="_chatImageThumb_17pz3_206",go={chatMessageRow:sMe,chatBubble:iMe,chatContent:oMe,messageTag:aMe,messageTagTooltip:lMe,messageTagClickable:cMe,messageTagIcon:uMe,messageTagLabel:dMe,messageTagValue:hMe,chatContentCollapsed:fMe,toggleButton:mMe,toggleIcon:pMe,toggleIconExpanded:gMe,chatImages:bMe,chatImageThumb:yMe};function vMe({composerTagIcons:e,content:t,inputAnnotations:n,onComposerTagClick:r,renderComposerTag:s,renderComposerTagTooltip:i}){const o=f.useMemo(()=>epe(t,n),[t,n]);return c.jsx(c.Fragment,{children:o.map((a,l)=>a.type==="text"?c.jsx(f.Fragment,{children:a.text},l):c.jsx(uZ,{composerTagIcons:e,onComposerTagClick:r,renderComposerTag:s,renderComposerTagTooltip:i,tag:a.tag,title:a.tag.serialized,preserveCustomKindLabel:!0},`${a.tag.id}:${l}`))})}const xMe=f.memo(function({content:t,images:n,inputAnnotations:r,isLocateFlashing:s=!1}){const{t:i}=gt(),{parseUserMessageContent:o,renderUserMessageContent:a,composerTagIcons:l,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h}=ou(),m=f.useRef(null),[p,g]=f.useState(!1),[b,x]=f.useState(!1),v=f.useMemo(()=>{const w=a==null?void 0:a({content:t,images:n,inputAnnotations:r});if(w!=null)return w;if(r&&r.length>0)return c.jsx(vMe,{composerTagIcons:l,content:t,inputAnnotations:r,onComposerTagClick:h,renderComposerTag:u,renderComposerTagTooltip:d});let k;try{k=o==null?void 0:o(t)}catch(T){return console.warn("[WebShell] failed to parse user message content",T),t}return!k||k.length===0?t:k.map((T,S)=>T.type==="text"?T.text:c.jsx(uZ,{tag:T.tag,composerTagIcons:l,renderComposerTag:u,renderComposerTagTooltip:d,onComposerTagClick:h},`${T.tag.id}-${S}`))},[t,n,r,h,o,l,u,d,a]),y=f.useCallback(()=>{const w=m.current;w&&x(w.scrollHeight>400)},[]);return f.useLayoutEffect(()=>{g(!1),y()},[t,n==null?void 0:n.length,y]),f.useEffect(()=>{const w=m.current;if(!w||typeof ResizeObserver>"u")return;const k=new ResizeObserver(y);return k.observe(w),()=>k.disconnect()},[y]),c.jsx("div",{className:go.chatMessageRow,children:c.jsxs("div",{className:`${go.chatBubble}${s?` ${lf.flash}`:""}`,children:[c.jsxs("div",{ref:m,className:`${go.chatContent} ${b&&!p?go.chatContentCollapsed:""}`,children:[n&&n.length>0&&c.jsx("div",{className:go.chatImages,children:n.map((w,k)=>{const T=w.data.startsWith("data:")?w.data:`data:${w.mimeType};base64,${w.data}`;return Jg(T)?c.jsx("img",{src:T,alt:i("user.uploadedImage",{index:k+1}),className:go.chatImageThumb,onLoad:y},k):null})}),v]}),b&&c.jsxs("button",{type:"button",className:go.toggleButton,onClick:()=>g(w=>!w),children:[c.jsx("span",{children:i(p?"userMessage.showLess":"userMessage.showMore")}),c.jsx("svg",{className:`${go.toggleIcon} ${p?go.toggleIconExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})})});function wMe(e){return AN(e)}function uZ({tag:e,composerTagIcons:t,renderComposerTag:n,renderComposerTagTooltip:r,onComposerTagClick:s,title:i,preserveCustomKindLabel:o=!1}){const a={tag:e,placement:"user-message",readonly:!0};let l,u;try{l=n==null?void 0:n(a)}catch(y){console.warn("[WebShell] user message tag render failed",y)}try{u=r==null?void 0:r(a)}catch(y){console.warn("[WebShell] user message tag tooltip render failed",y)}const d=!!s,h=o?tpe(e,t):null,m=$S(e),p=(h==null?void 0:h.tagValue)??zS(e),g=(h==null?void 0:h.tagLabel)??(e.kind?"":m),b=(h==null?void 0:h.fallback)??e.id,x=e.icon??(h==null?void 0:h.iconUrl)??hp(e.kind,t),v=x&&Jg(x)?x:void 0;return c.jsxs("span",{className:`${go.messageTag}${d?` ${go.messageTagClickable}`:""}`,role:d?"button":void 0,tabIndex:d?0:void 0,title:i??wMe(e),onClick:y=>{d&&(y.stopPropagation(),s==null||s({...a,anchorRect:y.currentTarget.getBoundingClientRect()}))},onKeyDown:y=>{d&&(y.key!=="Enter"&&y.key!==" "||(y.preventDefault(),s==null||s({...a,anchorRect:y.currentTarget.getBoundingClientRect()})))},children:[l??c.jsxs(c.Fragment,{children:[v&&c.jsx("span",{className:go.messageTagIcon,style:Th("--user-message-tag-icon-url",v),"aria-hidden":"true"}),g&&c.jsx("span",{className:go.messageTagLabel,children:g}),p?c.jsx("span",{className:go.messageTagValue,children:p}):g?null:c.jsx("span",{className:go.messageTagLabel,children:b})]}),u!=null&&c.jsx("span",{className:go.messageTagTooltip,role:"tooltip",children:u})]})}function dZ(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=dZ(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function hZ(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=dZ(e))&&(r&&(r+=" "),r+=t);return r}const O$=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,B$=hZ,bp=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return B$(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],h=i==null?void 0:i[u];if(d===null)return null;const m=O$(d)||O$(h);return s[u][m]}),a=n&&Object.entries(n).reduce((u,d)=>{let[h,m]=d;return m===void 0||(u[h]=m),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:m,...p}=d;return Object.entries(p).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...a}[b]):{...i,...a}[b]===x})?[...u,h,m]:u},[]);return B$(e,o,l,n==null?void 0:n.class,n==null?void 0:n.className)};function $$(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function kMe(...e){return t=>{let n=!1;const r=e.map(s=>{const i=$$(s,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():$$(e[s],null)}}}}function lr(...e){return f.useCallback(kMe(...e),e)}function cf(e){const t=f.forwardRef((n,r)=>{let{children:s,...i}=n,o=null,a=!1;const l=[];z$(s)&&typeof $w=="function"&&(s=$w(s._payload)),f.Children.forEach(s,m=>{var p;if(AMe(m)){a=!0;const g=m;let b="child"in g.props?g.props.child:g.props.children;z$(b)&&typeof $w=="function"&&(b=$w(b._payload)),o=SMe(g,b),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(m)}),o?o=f.cloneElement(o,void 0,l):!a&&f.Children.count(s)===1&&f.isValidElement(s)&&(o=s);const u=o?TMe(o):void 0,d=lr(r,u);if(!o){if(s||s===0)throw new Error(a?jMe(e):NMe(e));return s}const h=CMe(i,o.props??{});return o.type!==f.Fragment&&(h.ref=r?d:u),f.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}var MN=cf("Slot"),fZ=Symbol.for("radix.slottable");function _Me(e){const t=n=>"child"in n?n.children(n.child):n.children;return t.displayName=`${e}.Slottable`,t.__radixId=fZ,t}var SMe=(e,t)=>{if("child"in e.props){const n=e.props.child;return f.isValidElement(n)?f.cloneElement(n,void 0,e.props.children(n.props.children)):null}return f.isValidElement(t)?t:null};function CMe(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function TMe(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function AMe(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fZ}var EMe=Symbol.for("react.lazy");function z$(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===EMe&&"_payload"in e&&MMe(e._payload)}function MMe(e){return typeof e=="object"&&e!==null&&"then"in e}var NMe=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,jMe=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,$w=C4[" use ".trim().toString()],IMe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jn=IMe.reduce((e,t)=>{const n=cf(`Primitive.${t}`),r=f.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function mZ(e,t){e&&rc.flushSync(()=>e.dispatchEvent(t))}var pZ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),RMe="VisuallyHidden",gZ=f.forwardRef((e,t)=>c.jsx(jn.span,{...e,ref:t,style:{...pZ,...e.style}}));gZ.displayName=RMe;var DMe=gZ;function Go(e,t=[]){let n=[];function r(i,o){const a=f.createContext(o);a.displayName=i+"Context";const l=n.length;n=[...n,o];const u=h=>{var v;const{scope:m,children:p,...g}=h,b=((v=m==null?void 0:m[e])==null?void 0:v[l])||a,x=f.useMemo(()=>g,Object.values(g));return c.jsx(b.Provider,{value:x,children:p})};u.displayName=i+"Provider";function d(h,m,p={}){var v;const{optional:g=!1}=p,b=((v=m==null?void 0:m[e])==null?void 0:v[l])||a,x=f.useContext(b);if(x)return x;if(o!==void 0)return o;if(!g)throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=n.map(o=>f.createContext(o));return function(a){const l=(a==null?void 0:a[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return s.scopeName=e,[r,LMe(s,...t)]}function LMe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const h=l(i)[`__scope${u}`];return{...a,...h}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function NN(e){const t=e+"CollectionProvider",[n,r]=Go(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=b=>{const{scope:x,children:v}=b,y=f.useRef(null),w=f.useRef(new Map).current;return c.jsx(s,{scope:x,itemMap:w,collectionRef:y,children:v})};o.displayName=t;const a=e+"CollectionSlot",l=cf(a),u=f.forwardRef((b,x)=>{const{scope:v,children:y}=b,w=i(a,v),k=lr(x,w.collectionRef);return c.jsx(l,{ref:k,children:y})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",m=cf(d),p=f.forwardRef((b,x)=>{const{scope:v,children:y,...w}=b,k=f.useRef(null),T=lr(x,k),S=i(d,v);return f.useEffect(()=>(S.itemMap.set(k,{ref:k,...w}),()=>void S.itemMap.delete(k))),c.jsx(m,{[h]:"",ref:T,children:y})});p.displayName=d;function g(b){const x=i(e+"CollectionConsumer",b);return f.useCallback(()=>{const y=x.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((S,C)=>w.indexOf(S.ref.current)-w.indexOf(C.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},g,r]}function Vt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s||!s.defaultPrevented)return t==null?void 0:t(s)}}var Wi=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},PMe=C4[" useInsertionEffect ".trim().toString()]||Wi;function ka({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,i,o]=OMe({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:s;{const d=f.useRef(e!==void 0);f.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const u=f.useCallback(d=>{var h;if(a){const m=BMe(d)?d(e):d;m!==e&&((h=o.current)==null||h.call(o,m))}else i(d)},[a,e,i,o]);return[l,u]}function OMe({defaultProp:e,onChange:t}){const[n,r]=f.useState(e),s=f.useRef(n),i=f.useRef(t);return PMe(()=>{i.current=t},[t]),f.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function BMe(e){return typeof e=="function"}function $Me(e,t){return f.useReducer((n,r)=>t[n][r]??n,e)}var Ko=e=>{const{present:t,children:n}=e,r=zMe(t),s=typeof n=="function"?n({present:r.isPresent}):f.Children.only(n),i=FMe(r.ref,qMe(s));return typeof n=="function"||r.isPresent?f.cloneElement(s,{ref:i}):null};Ko.displayName="Presence";function zMe(e){const[t,n]=f.useState(),r=f.useRef(null),s=f.useRef(e),i=f.useRef("none"),o=f.useRef(void 0),a=e?"mounted":"unmounted",[l,u]=$Me(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{l==="mounted"?(i.current=o.current??tb(r.current),o.current=void 0):i.current="none"},[l]),Wi(()=>{const d=r.current,h=s.current;if(h!==e){const p=i.current,g=tb(d);e?(o.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),Wi(()=>{if(t){let d;const h=t.ownerDocument.defaultView??window,m=g=>{const x=tb(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&x&&(u("ANIMATION_END"),!s.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},p=g=>{g.target===t&&(i.current=tb(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{h.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(d=>{if(d){const h=getComputedStyle(d);r.current=h,o.current=tb(h)}else r.current=null;n(d)},[])}}function F$(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function FMe(...e){const t=f.useRef(e);return t.current=e,f.useCallback(n=>{const r=t.current;let s=!1;const i=r.map(o=>{const a=F$(o,n);return!s&&typeof a=="function"&&(s=!0),a});if(s)return()=>{for(let o=0;o<i.length;o++){const a=i[o];typeof a=="function"?a():F$(r[o],null)}}},[])}function tb(e){return(e==null?void 0:e.animationName)||"none"}function qMe(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var HMe=C4[" useId ".trim().toString()]||(()=>{}),UMe=0;function ya(e){const[t,n]=f.useState(HMe());return Wi(()=>{n(r=>r??String(UMe++))},[e]),e||(t?`radix-${t}`:"")}var VMe=f.createContext(void 0);function r1(e){const t=f.useContext(VMe);return e||t||"ltr"}function sl(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}var WMe="DismissableLayer",OA="dismissableLayer.update",GMe="dismissableLayer.pointerDownOutside",KMe="dismissableLayer.focusOutside",q$,jN=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),s1=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...u}=e,d=f.useContext(jN),[h,m]=f.useState(null),p=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=f.useState({}),b=lr(t,m),x=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),y=v?x.indexOf(v):-1,w=h?x.indexOf(h):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,T=w>=y,S=f.useRef(!1),C=ZMe(L=>{i==null||i(L),a==null||a(L),L.defaultPrevented||l==null||l()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:f.useCallback(L=>{if(!(L instanceof Node))return!1;const N=[...d.branches].some(O=>O.contains(L));return T&&!N},[d.branches,T])}),_=eNe(L=>{if(r&&S.current)return;const N=L.target;[...d.branches].some(B=>B.contains(N))||(o==null||o(L),a==null||a(L),L.defaultPrevented||l==null||l())},p),A=h?w===x.length-1:!1,M=sl(L=>{L.key==="Escape"&&(s==null||s(L),!L.defaultPrevented&&l&&(L.preventDefault(),l()))});return f.useEffect(()=>{if(A)return p.addEventListener("keydown",M,{capture:!0}),()=>p.removeEventListener("keydown",M,{capture:!0})},[p,A,M]),f.useEffect(()=>{if(h)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(q$=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(h)),d.layers.add(h),H$(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(h),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=q$))}},[h,p,n,d]),f.useEffect(()=>()=>{h&&(d.layers.delete(h),d.layersWithOutsidePointerEventsDisabled.delete(h),H$())},[h,d]),f.useEffect(()=>{const L=()=>g({});return document.addEventListener(OA,L),()=>document.removeEventListener(OA,L)},[]),c.jsx(jn.div,{...u,ref:b,style:{pointerEvents:k?T?"auto":"none":void 0,...e.style},onFocusCapture:Vt(e.onFocusCapture,_.onFocusCapture),onBlurCapture:Vt(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Vt(e.onPointerDownCapture,C.onPointerDownCapture)})});s1.displayName=WMe;var YMe="DismissableLayerBranch",XMe=f.forwardRef((e,t)=>{const n=f.useContext(jN),r=f.useRef(null),s=lr(t,r);return f.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),c.jsx(jn.div,{...e,ref:s})});XMe.displayName=YMe;function QMe(){const e=f.useContext(jN),[t,n]=f.useState(null);return f.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var JMe=()=>!0;function ZMe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:i,shouldHandlePointerDownOutside:o=JMe}=t,a=sl(e),l=f.useRef(!1),u=f.useRef(!1),d=f.useRef(new Map),h=f.useRef(()=>{});return f.useEffect(()=>{function m(){u.current=!1,s.current=!1,d.current.clear()}function p(){return Array.from(d.current.values()).some(Boolean)}function g(w){if(!u.current)return;const k=w.target;k instanceof Node&&[...i].some(S=>S.contains(k))||d.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{u.current&&h.current()},0)}function b(w){u.current&&d.current.set(w.type,!1)}const x=w=>{if(w.target&&!l.current){let k=function(){n.removeEventListener("click",h.current);const S=p();m(),S||bZ(GMe,a,T,{discrete:!0})};if(!o(w.target)){n.removeEventListener("click",h.current),m(),l.current=!1;return}const T={originalEvent:w};u.current=!0,s.current=r&&w.button===0,d.current.clear(),!r||w.button!==0?k():(n.removeEventListener("click",h.current),h.current=k,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),m();l.current=!1},v=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of v)n.addEventListener(w,g,!0),n.addEventListener(w,b);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",x),n.removeEventListener("click",h.current);for(const w of v)n.removeEventListener(w,g,!0),n.removeEventListener(w,b)}},[n,a,r,s,i,o]),{onPointerDownCapture:()=>l.current=!0}}function eNe(e,t=globalThis==null?void 0:globalThis.document){const n=sl(e),r=f.useRef(!1);return f.useEffect(()=>{const s=i=>{i.target&&!r.current&&bZ(KMe,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function H$(){const e=new CustomEvent(OA);document.dispatchEvent(e)}function bZ(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?mZ(s,i):s.dispatchEvent(i)}var R6="focusScope.autoFocusOnMount",D6="focusScope.autoFocusOnUnmount",U$={bubbles:!1,cancelable:!0},tNe="FocusScope",Gv=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[a,l]=f.useState(null),u=sl(s),d=sl(i),h=f.useRef(null),m=lr(t,l),p=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let b=function(w){if(p.paused||!a)return;const k=w.target;a.contains(k)?h.current=k:th(h.current,{select:!0})},x=function(w){if(p.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||th(h.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const T of w)T.removedNodes.length>0&&th(a)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const y=new MutationObserver(v);return a&&y.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),y.disconnect()}}},[r,a,p.paused]),f.useEffect(()=>{if(a){W$.add(p);const b=document.activeElement;if(!a.contains(b)){const v=new CustomEvent(R6,U$);a.addEventListener(R6,u),a.dispatchEvent(v),v.defaultPrevented||(nNe(aNe(yZ(a)),{select:!0}),document.activeElement===b&&th(a))}return()=>{a.removeEventListener(R6,u),setTimeout(()=>{const v=new CustomEvent(D6,U$);a.addEventListener(D6,d),a.dispatchEvent(v),v.defaultPrevented||th(b??document.body,{select:!0}),a.removeEventListener(D6,d),W$.remove(p)},0)}}},[a,u,d,p]);const g=f.useCallback(b=>{if(!n&&!r||p.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,v=document.activeElement;if(x&&v){const y=b.currentTarget,[w,k]=rNe(y);w&&k?!b.shiftKey&&v===k?(b.preventDefault(),n&&th(w,{select:!0})):b.shiftKey&&v===w&&(b.preventDefault(),n&&th(k,{select:!0})):v===y&&b.preventDefault()}},[n,r,p.paused]);return c.jsx(jn.div,{tabIndex:-1,...o,ref:m,onKeyDown:g})});Gv.displayName=tNe;function nNe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(th(r,{select:t}),document.activeElement!==n)return}function rNe(e){const t=yZ(e),n=V$(t,e),r=V$(t.reverse(),e);return[n,r]}function yZ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function V$(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):sNe(r,{upTo:t})))return r}function sNe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function iNe(e){return e instanceof HTMLInputElement&&"select"in e}function th(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&iNe(e)&&t&&e.select()}}var W$=oNe();function oNe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=G$(e,t),e.unshift(t)},remove(t){var n;e=G$(e,t),(n=e[0])==null||n.resume()}}}function G$(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function aNe(e){return e.filter(t=>t.tagName!=="A")}var lNe="Portal",i1=f.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[s,i]=f.useState(!1);Wi(()=>i(!0),[]);const o=n||s&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?rc.createPortal(c.jsx(jn.div,{...r,ref:t}),o):null});i1.displayName=lNe;var zw=0,xc=null;function qS(){f.useEffect(()=>{xc||(xc={start:K$(),end:K$()});const{start:e,end:t}=xc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),zw++,()=>{zw===1&&(xc==null||xc.start.remove(),xc==null||xc.end.remove(),xc=null),zw=Math.max(0,zw-1)}},[])}function K$(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Oc=function(){return Oc=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Oc.apply(this,arguments)};function vZ(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function cNe(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Jk="right-scroll-bar-position",Zk="width-before-scroll-bar",uNe="with-scroll-bars-hidden",dNe="--removed-body-scroll-bar-size";function L6(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function hNe(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var fNe=typeof window<"u"?f.useLayoutEffect:f.useEffect,Y$=new WeakMap;function mNe(e,t){var n=hNe(null,function(r){return e.forEach(function(s){return L6(s,r)})});return fNe(function(){var r=Y$.get(n);if(r){var s=new Set(r),i=new Set(e),o=n.current;s.forEach(function(a){i.has(a)||L6(a,null)}),i.forEach(function(a){s.has(a)||L6(a,o)})}Y$.set(n,e)},[e]),n}function pNe(e){return e}function gNe(e,t){t===void 0&&(t=pNe);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var o=t(i,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(i),o=n}var l=function(){var d=o;o=[],d.forEach(i)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),n}}}};return s}function bNe(e){e===void 0&&(e={});var t=gNe(null);return t.options=Oc({async:!0,ssr:!1},e),t}var xZ=function(e){var t=e.sideCar,n=vZ(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return f.createElement(r,Oc({},n))};xZ.isSideCarExport=!0;function yNe(e,t){return e.useMedium(t),xZ}var wZ=bNe(),P6=function(){},HS=f.forwardRef(function(e,t){var n=f.useRef(null),r=f.useState({onScrollCapture:P6,onWheelCapture:P6,onTouchMoveCapture:P6}),s=r[0],i=r[1],o=e.forwardProps,a=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,b=e.inert,x=e.allowPinchZoom,v=e.as,y=v===void 0?"div":v,w=e.gapMode,k=vZ(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,S=mNe([n,t]),C=Oc(Oc({},k),s);return f.createElement(f.Fragment,null,d&&f.createElement(T,{sideCar:wZ,removeScrollBar:u,shards:h,noRelative:p,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:w}),o?f.cloneElement(f.Children.only(a),Oc(Oc({},C),{ref:S})):f.createElement(y,Oc({},C,{className:l,ref:S}),a))});HS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};HS.classNames={fullWidth:Zk,zeroRight:Jk};var vNe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function xNe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=vNe();return t&&e.setAttribute("nonce",t),e}function wNe(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function kNe(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var _Ne=function(){var e=0,t=null;return{add:function(n){e==0&&(t=xNe())&&(wNe(t,n),kNe(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},SNe=function(){var e=_Ne();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},kZ=function(){var e=SNe(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},CNe={left:0,top:0,right:0,gap:0},O6=function(e){return parseInt(e||"",10)||0},TNe=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[O6(n),O6(r),O6(s)]},ANe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return CNe;var t=TNe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ENe=kZ(),Y0="data-scroll-locked",MNe=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
  .`.concat(uNe,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(Y0,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(Jk,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(Zk,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(Jk," .").concat(Jk,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(Zk," .").concat(Zk,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(Y0,`] {
    `).concat(dNe,": ").concat(a,`px;
  }
`)},X$=function(){var e=parseInt(document.body.getAttribute(Y0)||"0",10);return isFinite(e)?e:0},NNe=function(){f.useEffect(function(){return document.body.setAttribute(Y0,(X$()+1).toString()),function(){var e=X$()-1;e<=0?document.body.removeAttribute(Y0):document.body.setAttribute(Y0,e.toString())}},[])},jNe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;NNe();var i=f.useMemo(function(){return ANe(s)},[s]);return f.createElement(ENe,{styles:MNe(i,!t,s,n?"":"!important")})},BA=!1;if(typeof window<"u")try{var Fw=Object.defineProperty({},"passive",{get:function(){return BA=!0,!0}});window.addEventListener("test",Fw,Fw),window.removeEventListener("test",Fw,Fw)}catch{BA=!1}var qp=BA?{passive:!1}:!1,INe=function(e){return e.tagName==="TEXTAREA"},_Z=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!INe(e)&&n[t]==="visible")},RNe=function(e){return _Z(e,"overflowY")},DNe=function(e){return _Z(e,"overflowX")},Q$=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=SZ(e,r);if(s){var i=CZ(e,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},LNe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},PNe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},SZ=function(e,t){return e==="v"?RNe(t):DNe(t)},CZ=function(e,t){return e==="v"?LNe(t):PNe(t)},ONe=function(e,t){return e==="h"&&t==="rtl"?-1:1},BNe=function(e,t,n,r,s){var i=ONe(e,window.getComputedStyle(t).direction),o=i*r,a=n.target,l=t.contains(a),u=!1,d=o>0,h=0,m=0;do{if(!a)break;var p=CZ(e,a),g=p[0],b=p[1],x=p[2],v=b-x-i*g;(g||v)&&SZ(e,a)&&(h+=v,m+=g);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(m)<1)&&(u=!0),u},qw=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},J$=function(e){return[e.deltaX,e.deltaY]},Z$=function(e){return e&&"current"in e?e.current:e},$Ne=function(e,t){return e[0]===t[0]&&e[1]===t[1]},zNe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},FNe=0,Hp=[];function qNe(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),s=f.useState(FNe++)[0],i=f.useState(kZ)[0],o=f.useRef(e);f.useEffect(function(){o.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var b=cNe([e.lockRef.current],(e.shards||[]).map(Z$),!0).filter(Boolean);return b.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),b.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var a=f.useCallback(function(b,x){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!o.current.allowPinchZoom;var v=qw(b),y=n.current,w="deltaX"in b?b.deltaX:y[0]-v[0],k="deltaY"in b?b.deltaY:y[1]-v[1],T,S=b.target,C=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in b&&C==="h"&&S.type==="range")return!1;var _=window.getSelection(),A=_&&_.anchorNode,M=A?A===S||A.contains(S):!1;if(M)return!1;var L=Q$(C,S);if(!L)return!0;if(L?T=C:(T=C==="v"?"h":"v",L=Q$(C,S)),!L)return!1;if(!r.current&&"changedTouches"in b&&(w||k)&&(r.current=T),!T)return!0;var N=r.current||T;return BNe(N,x,b,N==="h"?w:k)},[]),l=f.useCallback(function(b){var x=b;if(!(!Hp.length||Hp[Hp.length-1]!==i)){var v="deltaY"in x?J$(x):qw(x),y=t.current.filter(function(T){return T.name===x.type&&(T.target===x.target||x.target===T.shadowParent)&&$Ne(T.delta,v)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(Z$).filter(Boolean).filter(function(T){return T.contains(x.target)}),k=w.length>0?a(x,w[0]):!o.current.noIsolation;k&&x.cancelable&&x.preventDefault()}}},[]),u=f.useCallback(function(b,x,v,y){var w={name:b,delta:x,target:v,should:y,shadowParent:HNe(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(k){return k!==w})},1)},[]),d=f.useCallback(function(b){n.current=qw(b),r.current=void 0},[]),h=f.useCallback(function(b){u(b.type,J$(b),b.target,a(b,e.lockRef.current))},[]),m=f.useCallback(function(b){u(b.type,qw(b),b.target,a(b,e.lockRef.current))},[]);f.useEffect(function(){return Hp.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",l,qp),document.addEventListener("touchmove",l,qp),document.addEventListener("touchstart",d,qp),function(){Hp=Hp.filter(function(b){return b!==i}),document.removeEventListener("wheel",l,qp),document.removeEventListener("touchmove",l,qp),document.removeEventListener("touchstart",d,qp)}},[]);var p=e.removeScrollBar,g=e.inert;return f.createElement(f.Fragment,null,g?f.createElement(i,{styles:zNe(s)}):null,p?f.createElement(jNe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function HNe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const UNe=yNe(wZ,qNe);var Kv=f.forwardRef(function(e,t){return f.createElement(HS,Oc({},e,{ref:t,sideCar:UNe}))});Kv.classNames=HS.classNames;var VNe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Up=new WeakMap,Hw=new WeakMap,Uw={},B6=0,TZ=function(e){return e&&(e.host||TZ(e.parentNode))},WNe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=TZ(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},GNe=function(e,t,n,r){var s=WNe(t,Array.isArray(e)?e:[e]);Uw[n]||(Uw[n]=new WeakMap);var i=Uw[n],o=[],a=new Set,l=new Set(s),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(m){if(a.has(m))d(m);else try{var p=m.getAttribute(r),g=p!==null&&p!=="false",b=(Up.get(m)||0)+1,x=(i.get(m)||0)+1;Up.set(m,b),i.set(m,x),o.push(m),b===1&&g&&Hw.set(m,!0),x===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",m,v)}})};return d(t),a.clear(),B6++,function(){o.forEach(function(h){var m=Up.get(h)-1,p=i.get(h)-1;Up.set(h,m),i.set(h,p),m||(Hw.has(h)||h.removeAttribute(r),Hw.delete(h)),p||h.removeAttribute(n)}),B6--,B6||(Up=new WeakMap,Up=new WeakMap,Hw=new WeakMap,Uw={})}},US=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=VNe(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),GNe(r,s,n,"aria-hidden")):function(){return null}},VS="Dialog",[AZ,EZ]=Go(VS),[KNe,ac]=AZ(VS),IN=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,a=f.useRef(null),l=f.useRef(null),[u,d]=ka({prop:r,defaultProp:s??!1,onChange:i,caller:VS});return c.jsx(KNe,{scope:t,triggerRef:a,contentRef:l,contentId:ya(),titleId:ya(),descriptionId:ya(),open:u,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};IN.displayName=VS;var MZ="DialogTrigger",NZ=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ac(MZ,n),i=lr(t,s.triggerRef);return c.jsx(jn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":$N(s.open),...r,ref:i,onClick:Vt(e.onClick,s.onOpenToggle)})});NZ.displayName=MZ;var RN="DialogPortal",[YNe,jZ]=AZ(RN,{forceMount:void 0}),DN=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=ac(RN,t);return c.jsx(YNe,{scope:t,forceMount:n,children:f.Children.map(r,o=>c.jsx(Ko,{present:n||i.open,children:c.jsx(i1,{asChild:!0,container:s,children:o})}))})};DN.displayName=RN;var H_="DialogOverlay",LN=f.forwardRef((e,t)=>{const n=jZ(H_,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=ac(H_,e.__scopeDialog);return i.modal?c.jsx(Ko,{present:r||i.open,children:c.jsx(QNe,{...s,ref:t})}):null});LN.displayName=H_;var XNe=cf("DialogOverlay.RemoveScroll"),QNe=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ac(H_,n),i=QMe(),o=lr(t,i);return c.jsx(Kv,{as:XNe,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(jn.div,{"data-state":$N(s.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),Eg="DialogContent",PN=f.forwardRef((e,t)=>{const n=jZ(Eg,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=ac(Eg,e.__scopeDialog);return c.jsx(Ko,{present:r||i.open,children:i.modal?c.jsx(JNe,{...s,ref:t}):c.jsx(ZNe,{...s,ref:t})})});PN.displayName=Eg;var JNe=f.forwardRef((e,t)=>{const n=ac(Eg,e.__scopeDialog),r=f.useRef(null),s=lr(t,n.contentRef,r);return f.useEffect(()=>{const i=r.current;if(i)return US(i)},[]),c.jsx(IZ,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Vt(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Vt(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Vt(e.onFocusOutside,i=>i.preventDefault())})}),ZNe=f.forwardRef((e,t)=>{const n=ac(Eg,e.__scopeDialog),r=f.useRef(!1),s=f.useRef(!1);return c.jsx(IZ,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),IZ=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,a=ac(Eg,n);return qS(),c.jsx(c.Fragment,{children:c.jsx(Gv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(s1,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":$N(a.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),RZ="DialogTitle",ON=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ac(RZ,n);return c.jsx(jn.h2,{id:s.titleId,...r,ref:t})});ON.displayName=RZ;var DZ="DialogDescription",BN=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ac(DZ,n);return c.jsx(jn.p,{id:s.descriptionId,...r,ref:t})});BN.displayName=DZ;var LZ="DialogClose",o1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ac(LZ,n);return c.jsx(jn.button,{type:"button",...r,ref:t,onClick:Vt(e.onClick,()=>s.onOpenChange(!1))})});o1.displayName=LZ;function $N(e){return e?"open":"closed"}var PZ="AlertDialog",[eje,byt]=Go(PZ,[EZ]),Sd=EZ(),OZ=e=>{const{__scopeAlertDialog:t,...n}=e,r=Sd(t);return c.jsx(IN,{...r,...n,modal:!0})};OZ.displayName=PZ;var tje="AlertDialogTrigger",nje=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Sd(n);return c.jsx(NZ,{...s,...r,ref:t})});nje.displayName=tje;var rje="AlertDialogPortal",BZ=e=>{const{__scopeAlertDialog:t,...n}=e,r=Sd(t);return c.jsx(DN,{...r,...n})};BZ.displayName=rje;var sje="AlertDialogOverlay",$Z=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Sd(n);return c.jsx(LN,{...s,...r,ref:t})});$Z.displayName=sje;var zZ="AlertDialogContent",[ije,oje]=eje(zZ),FZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=Sd(n),o=f.useRef(null),a=lr(t,o),l=f.useRef(null);return c.jsx(ije,{scope:n,cancelRef:l,children:c.jsx(PN,{role:"alertdialog",...i,...s,ref:a,onOpenAutoFocus:Vt(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:r})})});FZ.displayName=zZ;var aje="AlertDialogTitle",qZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Sd(n);return c.jsx(ON,{...s,...r,ref:t})});qZ.displayName=aje;var lje="AlertDialogDescription",HZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Sd(n);return c.jsx(BN,{...s,...r,ref:t})});HZ.displayName=lje;var cje="AlertDialogAction",UZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Sd(n);return c.jsx(o1,{...s,...r,ref:t})});UZ.displayName=cje;var VZ="AlertDialogCancel",WZ=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=oje(VZ,n),i=Sd(n),o=lr(t,s);return c.jsx(o1,{...i,...r,ref:o})});WZ.displayName=VZ;var uje=OZ,dje=BZ,hje=$Z,fje=FZ,mje=UZ,pje=WZ,gje=qZ,bje=HZ;function zN(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function FN(e){const[t,n]=f.useState(void 0);return Wi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;o=u.inlineSize,a=u.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const yje=["top","right","bottom","left"],uf=Math.min,ed=Math.max,U_=Math.round,Vw=Math.floor,td=e=>({x:e,y:e}),vje={left:"right",right:"left",bottom:"top",top:"bottom"};function GZ(e,t,n){return ed(e,uf(t,n))}function fd(e,t){return typeof e=="function"?e(t):e}function df(e){return e.split("-")[0]}function a1(e){return e.split("-")[1]}function qN(e){return e==="x"?"y":"x"}function HN(e){return e==="y"?"height":"width"}function Gc(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function UN(e){return qN(Gc(e))}function xje(e,t,n){n===void 0&&(n=!1);const r=a1(e),s=UN(e),i=HN(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=V_(o)),[o,V_(o)]}function wje(e){const t=V_(e);return[$A(e),t,$A(t)]}function $A(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ez=["left","right"],tz=["right","left"],kje=["top","bottom"],_je=["bottom","top"];function Sje(e,t,n){switch(e){case"top":case"bottom":return n?t?tz:ez:t?ez:tz;case"left":case"right":return t?kje:_je;default:return[]}}function Cje(e,t,n,r){const s=a1(e);let i=Sje(df(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map($A)))),i}function V_(e){const t=df(e);return vje[t]+e.slice(t.length)}function Tje(e){var t,n,r,s;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(s=e.left)!=null?s:0}}function KZ(e){return typeof e!="number"?Tje(e):{top:e,right:e,bottom:e,left:e}}function W_(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function nz(e,t,n){let{reference:r,floating:s}=e;const i=Gc(t),o=UN(t),a=HN(o),l=df(t),u=i==="y",d=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,m=r[a]/2-s[a]/2;let p;switch(l){case"top":p={x:d,y:r.y-s.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-s.width,y:h};break;default:p={x:r.x,y:r.y}}const g=a1(t);return g&&(p[o]+=m*(g==="end"?1:-1)*(n&&u?-1:1)),p}async function Aje(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:p=0}=fd(t,e),g=KZ(p),x=a[m?h==="floating"?"reference":"floating":h],v=W_(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:l})),y=h==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),k=await(i.isElement==null?void 0:i.isElement(w))&&await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1},T=W_(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(v.top-T.top+g.top)/k.y,bottom:(T.bottom-v.bottom+g.bottom)/k.y,left:(v.left-T.left+g.left)/k.x,right:(T.right-v.right+g.right)/k.x}}const Eje=50,Mje=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:Aje},l=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:h}=nz(u,r,l),m=r,p=0;const g={};for(let b=0;b<i.length;b++){const x=i[b];if(!x)continue;const{name:v,fn:y}=x,{x:w,y:k,data:T,reset:S}=await y({x:d,y:h,initialPlacement:r,placement:m,strategy:s,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,h=k??h,g[v]={...g[v],...T},S&&p<Eje&&(p++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(u=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):S.rects),{x:d,y:h}=nz(u,m,l)),b=-1)}return{x:d,y:h,placement:m,strategy:s,middlewareData:g}},Nje=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=t,{element:u,padding:d=0}=fd(e,t)||{};if(u==null)return{};const h=KZ(d),m={x:n,y:r},p=UN(s),g=HN(p),b=await o.getDimensions(u),x=p==="y",v=x?"top":"left",y=x?"bottom":"right",w=x?"clientHeight":"clientWidth",k=i.reference[g]+i.reference[p]-m[p]-i.floating[g],T=m[p]-i.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=S?S[w]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=a.floating[w]||i.floating[g]);const _=k/2-T/2,A=C/2-b[g]/2-1,M=uf(h[v],A),L=uf(h[y],A),N=C-b[g]-L,O=C/2-b[g]/2+_,B=GZ(M,O,N),$=!l.arrow&&a1(s)!=null&&O!==B&&i.reference[g]/2-(O<M?M:L)-b[g]/2<0,P=$?O<M?O-M:O-N:0;return{[p]:m[p]+P,data:{[p]:B,centerOffset:O-B-P,...$&&{alignmentOffset:P}},reset:$}}}),jje=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...x}=fd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=df(s),y=Gc(a),w=df(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(u.floating)),T=m||(w||!b?[V_(a)]:wje(a)),S=g!=="none";!m&&S&&T.push(...Cje(a,b,g,k));const C=[a,...T],_=await l.detectOverflow(t,x),A=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&A.push(_[v]),h){const B=xje(s,o,k);A.push(_[B[0]],_[B[1]])}if(M=[...M,{placement:s,overflows:A}],!A.every(B=>B<=0)){var L,N;const B=(((L=i.flip)==null?void 0:L.index)||0)+1,$=C[B];if($&&(!(h==="alignment"?y!==Gc($):!1)||M.every(F=>Gc(F.placement)===y?F.overflows[0]>0:!0)))return{data:{index:B,overflows:M},reset:{placement:$}};let P=(N=M.filter(K=>K.overflows[0]<=0).sort((K,F)=>K.overflows[1]-F.overflows[1])[0])==null?void 0:N.placement;if(!P)switch(p){case"bestFit":{var O;const K=(O=M.filter(F=>{if(S){const H=Gc(F.placement);return H===y||H==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(H=>H>0).reduce((H,D)=>H+D,0)]).sort((F,H)=>F[1]-H[1])[0])==null?void 0:O[0];K&&(P=K);break}case"initialPlacement":P=a;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function rz(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function sz(e){return yje.some(t=>e[t]>=0)}const Ije=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...i}=fd(e,t);switch(s){case"referenceHidden":{const o=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=rz(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:sz(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...i,altBoundary:!0}),a=rz(o,n.floating);return{data:{escapedOffsets:a,escaped:sz(a)}}}default:return{}}}}},YZ=new Set(["left","top"]);async function Rje(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=df(n),a=a1(n),l=Gc(n)==="y",u=YZ.has(o)?-1:1,d=i&&l?-1:1,h=fd(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const Dje=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:a}=t,l=await Rje(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},Lje=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...u}=fd(e,t),d={x:n,y:r},h=await i.detectOverflow(t,u),m=Gc(s),p=qN(m);let g=d[p],b=d[m];const x=(y,w)=>GZ(w+h[y==="y"?"top":"left"],w,w-h[y==="y"?"bottom":"right"]);o&&(g=x(p,g)),a&&(b=x(m,b));const v=l.fn({...t,[p]:g,[m]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:o,[m]:a}}}}}},Pje=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:s,y:i,placement:o,rects:a,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=fd(e,t),m={x:s,y:i},p=Gc(o),g=qN(p);let b=m[g],x=m[p];const v=fd(u,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:(n=v.mainAxis)!=null?n:0,crossAxis:(r=v.crossAxis)!=null?r:0};if(d){const T=g==="y"?"height":"width",S=a.reference[g]-a.floating[T]+y.mainAxis,C=a.reference[g]+a.reference[T]-y.mainAxis;b<S?b=S:b>C&&(b=C)}if(h){var w,k;const T=g==="y"?"width":"height",S=YZ.has(df(o)),C=a.reference[p]-a.floating[T]+(S&&((w=l.offset)==null?void 0:w[p])||0)+(S?0:y.crossAxis),_=a.reference[p]+a.reference[T]+(S?0:((k=l.offset)==null?void 0:k[p])||0)-(S?y.crossAxis:0);x<C?x=C:x>_&&(x=_)}return{[g]:b,[p]:x}}}},Oje=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:s,elements:i}=t,{apply:o=()=>{},...a}=fd(e,t),l=await s.detectOverflow(t,a),u=df(n),d=a1(n),h=Gc(n)==="y",{width:m,height:p}=r.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const x=p-l.top-l.bottom,v=m-l.left-l.right,y=uf(p-l[g],x),w=uf(m-l[b],v),k=t.middlewareData.shift,T=!k;let S=y,C=w;k!=null&&k.enabled.x&&(C=v),k!=null&&k.enabled.y&&(S=x),T&&!d&&(h?C=m-2*ed(l.left,l.right):S=p-2*ed(l.top,l.bottom)),await o({...t,availableWidth:C,availableHeight:S});const _=await s.getDimensions(i.floating);return m!==_.width||p!==_.height?{reset:{rects:!0}}:{}}}};function WS(){return typeof window<"u"}function l1(e){return XZ(e)?(e.nodeName||"").toLowerCase():"#document"}function va(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Cd(e){var t;return(t=(XZ(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function XZ(e){return WS()?e instanceof Node||e instanceof va(e).Node:!1}function tu(e){return WS()?e instanceof Element||e instanceof va(e).Element:!1}function wf(e){return WS()?e instanceof HTMLElement||e instanceof va(e).HTMLElement:!1}function iz(e){return!WS()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof va(e).ShadowRoot}function GS(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=nu(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Bje(e){return/^(table|td|th)$/.test(l1(e))}function KS(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $je=/transform|translate|scale|rotate|perspective|filter/,zje=/paint|layout|strict|content/,Qf=e=>!!e&&e!=="none";let $6;function VN(e){const t=tu(e)?nu(e):e;return Qf(t.transform)||Qf(t.translate)||Qf(t.scale)||Qf(t.rotate)||Qf(t.perspective)||!WN()&&(Qf(t.backdropFilter)||Qf(t.filter))||$je.test(t.willChange||"")||zje.test(t.contain||"")}function Fje(e){let t=ep(e);for(;wf(t)&&!lv(t);){if(VN(t))return t;if(KS(t))return null;t=ep(t)}return null}function WN(){return $6==null&&($6=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),$6}function lv(e){return/^(html|body|#document)$/.test(l1(e))}function nu(e){return va(e).getComputedStyle(e)}function YS(e){return tu(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ep(e){if(l1(e)==="html")return e;const t=e.assignedSlot||e.parentNode||iz(e)&&e.host||Cd(e);return iz(t)?t.host:t}function QZ(e){const t=ep(e);return lv(t)?(e.ownerDocument||e).body:wf(t)&&GS(t)?t:QZ(t)}function cv(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=QZ(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=va(s);if(i){const a=zA(o);return t.concat(o,o.visualViewport||[],GS(s)?s:[],a&&n?cv(a):[])}else return t.concat(s,cv(s,[],n))}function zA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function JZ(e){const t=nu(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=wf(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,a=U_(n)!==i||U_(r)!==o;return a&&(n=i,r=o),{width:n,height:r,$:a}}function GN(e){return tu(e)?e:e.contextElement}function X0(e){const t=GN(e);if(!wf(t))return td(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=JZ(t);let o=(i?U_(n.width):n.width)/r,a=(i?U_(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const qje=td(0);function ZZ(e){const t=va(e);return!WN()||!t.visualViewport?qje:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Hje(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===va(e)}function tp(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=GN(e);let o=td(1);t&&(r?tu(r)&&(o=X0(r)):o=X0(e));const a=Hje(i,n,r)?ZZ(i):td(0);let l=(s.left+a.x)/o.x,u=(s.top+a.y)/o.y,d=s.width/o.x,h=s.height/o.y;if(i&&r){const m=va(i),p=tu(r)?va(r):r;let g=m,b=zA(g);for(;b&&p!==g;){const x=X0(b),v=b.getBoundingClientRect(),y=nu(b),w=v.left+(b.clientLeft+parseFloat(y.paddingLeft))*x.x,k=v.top+(b.clientTop+parseFloat(y.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,h*=x.y,l+=w,u+=k,g=va(b),b=zA(g)}}return W_({width:d,height:h,x:l,y:u})}function XS(e,t){const n=YS(e).scrollLeft;return t?t.left+n:tp(Cd(e)).left+n}function eee(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-XS(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Uje(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Cd(r),a=t?KS(t.floating):!1;if(r===o||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=td(1);const d=td(0),h=wf(r);if((h||!i)&&((l1(r)!=="body"||GS(o))&&(l=YS(r)),h)){const p=tp(r);u=X0(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const m=o&&!h&&!i?eee(o,l):td(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-l.scrollTop*u.y+d.y+m.y}}function Vje(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Wje(e){const t=YS(e),n=e.ownerDocument.body,r=ed(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=ed(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+XS(e);const o=-t.scrollTop;return nu(n).direction==="rtl"&&(i+=ed(e.clientWidth,n.clientWidth)-r),{width:r,height:s,x:i,y:o}}const Gje=25;function Kje(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",s=va(e),i=Cd(e),o=s.visualViewport;let a=i.clientWidth,l=i.clientHeight,u=0,d=0;if(o){const m=!WN()||t==="fixed";r?m||(u=-o.offsetLeft,d=-o.offsetTop):(a=o.width,l=o.height,m&&(u=o.offsetLeft,d=o.offsetTop))}if(XS(i)<=0){const m=i.ownerDocument,p=m.body,g=getComputedStyle(p),b=m.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(i.clientWidth-p.clientWidth-b),v=getComputedStyle(i).scrollbarGutter==="stable both-edges"?x/2:x;v<=Gje&&(a-=v)}return{width:a,height:l,x:u,y:d}}function Yje(e,t){const n=tp(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=X0(e),o=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,u=r*i.y;return{width:o,height:a,x:l,y:u}}function oz(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Kje(e,n,t);else if(t==="document")r=Wje(Cd(e));else if(tu(t))r=Yje(t,n);else{const s=ZZ(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return W_(r)}function Xje(e,t){const n=t.get(e);if(n)return n;let r=cv(e,[],!1).filter(a=>tu(a)&&l1(a)!=="body"),s=null;const i=nu(e).position==="fixed";let o=i?ep(e):e;for(;tu(o)&&!lv(o);){const a=nu(o),l=VN(o),u=s?s.position:i?"fixed":"";!l&&(u==="fixed"||u==="absolute"&&a.position==="static")?r=r.filter(h=>h!==o):s=a,o=ep(o)}return t.set(e,r),r}function Qje(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?KS(t)?[]:Xje(t,this._c):[].concat(n),r],a=oz(t,o[0],s);let l=a.top,u=a.right,d=a.bottom,h=a.left;for(let m=1;m<o.length;m++){const p=oz(t,o[m],s);l=ed(p.top,l),u=uf(p.right,u),d=uf(p.bottom,d),h=ed(p.left,h)}return{width:u-h,height:d-l,x:h,y:l}}function Jje(e){const{width:t,height:n}=JZ(e);return{width:t,height:n}}function Zje(e,t,n){const r=wf(t),s=Cd(t),i=n==="fixed",o=tp(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=td(0);if((r||!i)&&((l1(t)!=="body"||GS(s))&&(a=YS(t)),r)){const m=tp(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}!r&&s&&(l.x=XS(s));const u=s&&!r&&!i?eee(s,a):td(0),d=o.left+a.scrollLeft-l.x-u.x,h=o.top+a.scrollTop-l.y-u.y;return{x:d,y:h,width:o.width,height:o.height}}function z6(e){return nu(e).position==="static"}function az(e,t){if(!wf(e)||nu(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Cd(e)===n&&(n=n.ownerDocument.body),n}function tee(e,t){const n=va(e);if(KS(e))return n;if(!wf(e)){let s=ep(e);for(;s&&!lv(s);){if(tu(s)&&!z6(s))return s;s=ep(s)}return n}let r=az(e,t);for(;r&&Bje(r)&&z6(r);)r=az(r,t);return r&&lv(r)&&z6(r)&&!VN(r)?n:r||Fje(e)||n}const eIe=async function(e){const t=this.getOffsetParent||tee,n=this.getDimensions,r=await n(e.floating);return{reference:Zje(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tIe(e){return nu(e).direction==="rtl"}const nIe={convertOffsetParentRelativeRectToViewportRelativeRect:Uje,getDocumentElement:Cd,getClippingRect:Qje,getOffsetParent:tee,getElementRects:eIe,getClientRects:Vje,getDimensions:Jje,getScale:X0,isElement:tu,isRTL:tIe};function nee(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rIe(e,t,n){let r=null,s;const i=Cd(e);function o(){var d;clearTimeout(s),(d=r)==null||d.disconnect(),r=null}function a(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),o();const m=e.getBoundingClientRect(),{left:p,top:g,width:b,height:x}=m;if(d||t(),!b||!x)return;const v=Vw(g),y=Vw(i.clientWidth-(p+b)),w=Vw(i.clientHeight-(g+x)),k=Vw(p),S={rootMargin:-v+"px "+-y+"px "+-w+"px "+-k+"px",threshold:ed(0,uf(1,h))||1};let C=!0;function _(A){const M=A[0].intersectionRatio;if(!nee(m,e.getBoundingClientRect()))return a();if(M!==h){if(!C)return a();M?a(!1,M):s=setTimeout(()=>{a(!1,1e-7)},1e3)}C=!1}try{r=new IntersectionObserver(_,{...S,root:i.ownerDocument})}catch{r=new IntersectionObserver(_,S)}r.observe(e)}const l=va(e),u=()=>a(n);return l.addEventListener("resize",u),a(!0),()=>{l.removeEventListener("resize",u),o()}}function sIe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=GN(e),d=s||i?[...u?cv(u):[],...t?cv(t):[]]:[];d.forEach(v=>{s&&v.addEventListener("scroll",n),i&&v.addEventListener("resize",n)});const h=u&&a?rIe(u,n,i):null;let m=-1,p=null;o&&(p=new ResizeObserver(v=>{let[y]=v;y&&y.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!l&&p.observe(u),t&&p.observe(t));let g,b=l?tp(e):null;l&&x();function x(){const v=tp(e);b&&!nee(b,v)&&n(),b=v,g=requestAnimationFrame(x)}return n(),()=>{var v;d.forEach(y=>{s&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),h==null||h(),(v=p)==null||v.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const iIe=Dje,oIe=Lje,aIe=jje,lIe=Oje,cIe=Ije,lz=Nje,uIe=Pje,dIe=(e,t,n)=>{const r=new Map,s=n??{},i={...nIe,...s.platform,_c:r};return Mje(e,t,{...s,platform:i})};var hIe=typeof document<"u",fIe=function(){},e2=hIe?f.useLayoutEffect:fIe;function G_(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!G_(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!G_(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ree(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function cz(e,t){const n=ree(e);return Math.round(t*n)/n}function F6(e){const t=f.useRef(e);return e2(()=>{t.current=e}),t}function mIe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[d,h]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=f.useState(r);G_(m,r)||p(r);const[g,b]=f.useState(null),[x,v]=f.useState(null),y=f.useCallback(F=>{F!==S.current&&(S.current=F,b(F))},[]),w=f.useCallback(F=>{F!==C.current&&(C.current=F,v(F))},[]),k=i||g,T=o||x,S=f.useRef(null),C=f.useRef(null),_=f.useRef(d),A=l!=null,M=F6(l),L=F6(s),N=F6(u),O=f.useCallback(()=>{if(!S.current||!C.current)return;const F={placement:t,strategy:n,middleware:m};L.current&&(F.platform=L.current),dIe(S.current,C.current,F).then(H=>{const D={...H,isPositioned:N.current!==!1};B.current&&!G_(_.current,D)&&(_.current=D,rc.flushSync(()=>{h(D)}))})},[m,t,n,L,N]);e2(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[u]);const B=f.useRef(!1);e2(()=>(B.current=!0,()=>{B.current=!1}),[]),e2(()=>{if(k&&(S.current=k),T&&(C.current=T),k&&T){if(M.current)return M.current(k,T,O);O()}},[k,T,O,M,A]);const $=f.useMemo(()=>({reference:S,floating:C,setReference:y,setFloating:w}),[y,w]),P=f.useMemo(()=>({reference:k,floating:T}),[k,T]),K=f.useMemo(()=>{const F={position:n,left:0,top:0};if(!P.floating)return F;const H=cz(P.floating,d.x),D=cz(P.floating,d.y);return a?{...F,transform:"translate("+H+"px, "+D+"px)",...ree(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:D}},[n,a,P.floating,d.x,d.y]);return f.useMemo(()=>({...d,update:O,refs:$,elements:P,floatingStyles:K}),[d,O,$,P,K])}const pIe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?lz({element:r.current,padding:s}).fn(n):{}:r?lz({element:r,padding:s}).fn(n):{}}}},gIe=(e,t)=>{const n=iIe(e);return{name:n.name,fn:n.fn,options:[e,t]}},bIe=(e,t)=>{const n=oIe(e);return{name:n.name,fn:n.fn,options:[e,t]}},yIe=(e,t)=>({fn:uIe(e).fn,options:[e,t]}),vIe=(e,t)=>{const n=aIe(e);return{name:n.name,fn:n.fn,options:[e,t]}},xIe=(e,t)=>{const n=lIe(e);return{name:n.name,fn:n.fn,options:[e,t]}},wIe=(e,t)=>{const n=cIe(e);return{name:n.name,fn:n.fn,options:[e,t]}},kIe=(e,t)=>{const n=pIe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var _Ie="Arrow",see=f.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return c.jsx(jn.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});see.displayName=_Ie;var SIe=see,KN="Popper",[iee,kf]=Go(KN),[CIe,oee]=iee(KN),aee=e=>{const{__scopePopper:t,children:n}=e,[r,s]=f.useState(null),[i,o]=f.useState(void 0);return c.jsx(CIe,{scope:t,anchor:r,onAnchorChange:s,placementState:i,setPlacementState:o,children:n})};aee.displayName=KN;var lee="PopperAnchor",cee=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=oee(lee,n),o=f.useRef(null),a=i.onAnchorChange,l=f.useCallback(g=>{o.current=g,g&&a(g)},[a]),u=lr(t,l),d=f.useRef(null);f.useEffect(()=>{if(!r)return;const g=d.current;d.current=r.current,g!==d.current&&a(d.current)});const h=i.placementState&&XN(i.placementState),m=h==null?void 0:h[0],p=h==null?void 0:h[1];return r?null:c.jsx(jn.div,{"data-radix-popper-side":m,"data-radix-popper-align":p,...s,ref:u})});cee.displayName=lee;var YN="PopperContent",[TIe,AIe]=iee(YN),uee=f.forwardRef((e,t)=>{var se,Z,X,te,ae,xe;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...b}=e,x=oee(YN,n),[v,y]=f.useState(null),w=lr(t,y),[k,T]=f.useState(null),S=FN(k),C=(S==null?void 0:S.width)??0,_=(S==null?void 0:S.height)??0,A=r+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},L=Array.isArray(u)?u:[u],N=L.length>0,O={padding:M,boundary:L.filter(MIe),altBoundary:N},{refs:B,floatingStyles:$,placement:P,isPositioned:K,middlewareData:F}=mIe({strategy:"fixed",placement:A,whileElementsMounted:(...Ae)=>sIe(...Ae,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[gIe({mainAxis:s+_,alignmentAxis:o}),l&&bIe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?yIe():void 0,...O}),l&&vIe({...O}),xIe({...O,apply:({elements:Ae,rects:Ne,availableWidth:Le,availableHeight:ge})=>{const{width:Oe,height:Nt}=Ne.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Le}px`),Pe.setProperty("--radix-popper-available-height",`${ge}px`),Pe.setProperty("--radix-popper-anchor-width",`${Oe}px`),Pe.setProperty("--radix-popper-anchor-height",`${Nt}px`)}}),k&&kIe({element:k,padding:a}),NIe({arrowWidth:C,arrowHeight:_}),m&&wIe({strategy:"referenceHidden",...O,boundary:N?O.boundary:void 0})]}),H=x.setPlacementState;Wi(()=>(H(P),()=>{H(void 0)}),[P,H]);const[D,Q]=XN(P),U=sl(g);Wi(()=>{K&&(U==null||U())},[K,U]);const j=(se=F.arrow)==null?void 0:se.x,ie=(Z=F.arrow)==null?void 0:Z.y,oe=((X=F.arrow)==null?void 0:X.centerOffset)!==0,[J,V]=f.useState();return Wi(()=>{v&&V(window.getComputedStyle(v).zIndex)},[v]),c.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:K?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(te=F.transformOrigin)==null?void 0:te.x,(ae=F.transformOrigin)==null?void 0:ae.y].join(" "),...((xe=F.hide)==null?void 0:xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(TIe,{scope:n,placedSide:D,placedAlign:Q,onArrowChange:T,arrowX:j,arrowY:ie,shouldHideArrow:oe,children:c.jsx(jn.div,{"data-side":D,"data-align":Q,...b,ref:w,style:{...b.style,animation:K?void 0:"none"}})})})});uee.displayName=YN;var dee="PopperArrow",EIe={top:"bottom",right:"left",bottom:"top",left:"right"},hee=f.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=AIe(dee,r),o=EIe[i.placedSide];return c.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:c.jsx(SIe,{...s,ref:n,style:{...s.style,display:"block"}})})});hee.displayName=dee;function MIe(e){return e!==null}var NIe=e=>({name:"transformOrigin",options:e,fn(t){var x,v,y;const{placement:n,rects:r,middlewareData:s}=t,o=((x=s.arrow)==null?void 0:x.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[u,d]=XN(n),h={start:"0%",center:"50%",end:"100%"}[d],m=(((v=s.arrow)==null?void 0:v.x)??0)+a/2,p=(((y=s.arrow)==null?void 0:y.y)??0)+l/2;let g="",b="";return u==="bottom"?(g=o?h:`${m}px`,b=`${-l}px`):u==="top"?(g=o?h:`${m}px`,b=`${r.floating.height+l}px`):u==="right"?(g=`${-l}px`,b=o?h:`${p}px`):u==="left"&&(g=`${r.floating.width+l}px`,b=o?h:`${p}px`),{data:{x:g,y:b}}}});function XN(e){const[t,n="center"]=e.split("-");return[t,n]}var Yv=aee,Xv=cee,QS=uee,JS=hee,q6=!1;function jIe(){const[e,t]=f.useState(q6);return f.useEffect(()=>{q6||(q6=!0,t(!0))},[]),e}var fee=C4[" useSyncExternalStore ".trim().toString()];function IIe(){return()=>{}}function RIe(){return fee(IIe,()=>!0,()=>!1)}var DIe=typeof fee=="function"?RIe:jIe,H6="rovingFocusGroup.onEntryFocus",LIe={bubbles:!1,cancelable:!0},Qv="RovingFocusGroup",[FA,mee,PIe]=NN(Qv),[OIe,_f]=Go(Qv,[PIe]),[BIe,$Ie]=OIe(Qv),pee=f.forwardRef((e,t)=>c.jsx(FA.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(FA.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(zIe,{...e,ref:t})})}));pee.displayName=Qv;var zIe=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,m=f.useRef(null),p=lr(t,m),g=r1(i),[b,x]=ka({prop:o,defaultProp:a??null,onChange:l,caller:Qv}),[v,y]=f.useState(!1),w=sl(u),k=mee(n),T=f.useRef(!1),[S,C]=f.useState(0);return f.useEffect(()=>{const _=m.current;if(_)return _.addEventListener(H6,w),()=>_.removeEventListener(H6,w)},[w]),c.jsx(BIe,{scope:n,orientation:r,dir:g,loop:s,currentTabStopId:b,onItemFocus:f.useCallback(_=>x(_),[x]),onItemShiftTab:f.useCallback(()=>y(!0),[]),onFocusableItemAdd:f.useCallback(()=>C(_=>_+1),[]),onFocusableItemRemove:f.useCallback(()=>C(_=>_-1),[]),children:c.jsx(jn.div,{tabIndex:v||S===0?-1:0,"data-orientation":r,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:Vt(e.onMouseDown,()=>{T.current=!0}),onFocus:Vt(e.onFocus,_=>{const A=!T.current;if(_.target===_.currentTarget&&A&&!v){const M=new CustomEvent(H6,LIe);if(_.currentTarget.dispatchEvent(M),!M.defaultPrevented){const L=k().filter(P=>P.focusable),N=L.find(P=>P.active),O=L.find(P=>P.id===b),$=[N,O,...L].filter(Boolean).map(P=>P.ref.current);yee($,d)}}T.current=!1}),onBlur:Vt(e.onBlur,()=>y(!1))})})}),gee="RovingFocusGroupItem",bee=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...a}=e,l=ya(),u=i||l,d=$Ie(gee,n),h=d.currentTabStopId===u,m=mee(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:b}=d,x=DIe();return Wi(()=>{if(!(!x||!r))return p(),()=>g()},[x,r,p,g]),f.useEffect(()=>{if(!(x||!r))return p(),()=>g()},[x,r,p,g]),c.jsx(FA.ItemSlot,{scope:n,id:u,focusable:r,active:s,children:c.jsx(jn.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:Vt(e.onMouseDown,v=>{r?d.onItemFocus(u):v.preventDefault()}),onFocus:Vt(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Vt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=HIe(v,d.orientation,d.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let k=m().filter(T=>T.focusable).map(T=>T.ref.current);if(y==="last")k.reverse();else if(y==="prev"||y==="next"){y==="prev"&&k.reverse();const T=k.indexOf(v.currentTarget);k=d.loop?UIe(k,T+1):k.slice(T+1)}setTimeout(()=>yee(k))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:b!=null}):o})})});bee.displayName=gee;var FIe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qIe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HIe(e,t,n){const r=qIe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return FIe[r]}function yee(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function UIe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ZS=pee,e3=bee,qA=["Enter"," "],VIe=["ArrowDown","PageUp","Home"],vee=["ArrowUp","PageDown","End"],WIe=[...VIe,...vee],GIe={ltr:[...qA,"ArrowRight"],rtl:[...qA,"ArrowLeft"]},KIe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jv="Menu",[uv,YIe,XIe]=NN(Jv),[yp,xee]=Go(Jv,[XIe,kf,_f]),Zv=kf(),wee=_f(),[kee,Sf]=yp(Jv),[QIe,ex]=yp(Jv),_ee=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=e,a=Zv(t),[l,u]=f.useState(null),d=f.useRef(!1),h=sl(i),m=r1(s);return f.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),f.useEffect(()=>{if(!n)return;const p=()=>h(!1);return window.addEventListener("blur",p),()=>window.removeEventListener("blur",p)},[n,h]),c.jsx(Yv,{...a,children:c.jsx(kee,{scope:t,open:n,onOpenChange:h,content:l,onContentChange:u,children:c.jsx(QIe,{scope:t,onClose:f.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:m,modal:o,children:r})})})};_ee.displayName=Jv;var JIe="MenuAnchor",QN=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Zv(n);return c.jsx(Xv,{...s,...r,ref:t})});QN.displayName=JIe;var JN="MenuPortal",[ZIe,See]=yp(JN,{forceMount:void 0}),Cee=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,i=Sf(JN,t);return c.jsx(ZIe,{scope:t,forceMount:n,children:c.jsx(Ko,{present:n||i.open,children:c.jsx(i1,{asChild:!0,container:s,children:r})})})};Cee.displayName=JN;var Pl="MenuContent",[eRe,ZN]=yp(Pl),Tee=f.forwardRef((e,t)=>{const n=See(Pl,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=Sf(Pl,e.__scopeMenu),o=ex(Pl,e.__scopeMenu);return c.jsx(uv.Provider,{scope:e.__scopeMenu,children:c.jsx(Ko,{present:r||i.open,children:c.jsx(uv.Slot,{scope:e.__scopeMenu,children:o.modal?c.jsx(tRe,{...s,ref:t}):c.jsx(nRe,{...s,ref:t})})})})}),tRe=f.forwardRef((e,t)=>{const n=Sf(Pl,e.__scopeMenu),r=f.useRef(null),s=lr(t,r);return f.useEffect(()=>{const i=r.current;if(i)return US(i)},[]),c.jsx(ej,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Vt(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),nRe=f.forwardRef((e,t)=>{const n=Sf(Pl,e.__scopeMenu);return c.jsx(ej,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),rRe=cf("MenuContent.ScrollLock"),ej=f.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,disableOutsideScroll:g,...b}=e,x=Sf(Pl,n),v=ex(Pl,n),y=Zv(n),w=wee(n),k=YIe(n),[T,S]=f.useState(null),C=f.useRef(null),_=lr(t,C,x.onContentChange),A=f.useRef(0),M=f.useRef(""),L=f.useRef(0),N=f.useRef(null),O=f.useRef("right"),B=f.useRef(0),$=g?Kv:f.Fragment,P=g?{as:rRe,allowPinchZoom:!0}:void 0,K=H=>{var V,se;const D=M.current+H,Q=k().filter(Z=>!Z.disabled),U=document.activeElement,j=(V=Q.find(Z=>Z.ref.current===U))==null?void 0:V.textValue,ie=Q.map(Z=>Z.textValue),oe=pRe(ie,D,j),J=(se=Q.find(Z=>Z.textValue===oe))==null?void 0:se.ref.current;(function Z(X){M.current=X,window.clearTimeout(A.current),X!==""&&(A.current=window.setTimeout(()=>Z(""),1e3))})(D),J&&setTimeout(()=>J.focus())};f.useEffect(()=>()=>window.clearTimeout(A.current),[]),qS();const F=f.useCallback(H=>{var Q,U;return O.current===((Q=N.current)==null?void 0:Q.side)&&bRe(H,(U=N.current)==null?void 0:U.area)},[]);return c.jsx(eRe,{scope:n,searchRef:M,onItemEnter:f.useCallback(H=>{F(H)&&H.preventDefault()},[F]),onItemLeave:f.useCallback(H=>{var D;F(H)||((D=C.current)==null||D.focus(),S(null))},[F]),onTriggerLeave:f.useCallback(H=>{F(H)&&H.preventDefault()},[F]),pointerGraceTimerRef:L,onPointerGraceIntentChange:f.useCallback(H=>{N.current=H},[]),children:c.jsx($,{...P,children:c.jsx(Gv,{asChild:!0,trapped:s,onMountAutoFocus:Vt(i,H=>{var D;H.preventDefault(),(D=C.current)==null||D.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:c.jsx(s1,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:m,onDismiss:p,children:c.jsx(ZS,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:T,onCurrentTabStopIdChange:S,onEntryFocus:Vt(l,H=>{v.isUsingKeyboardRef.current||H.preventDefault()}),preventScrollOnEntryFocus:!0,children:c.jsx(QS,{role:"menu","aria-orientation":"vertical","data-state":Hee(x.open),"data-radix-menu-content":"",dir:v.dir,...y,...b,ref:_,style:{outline:"none",...b.style},onKeyDown:Vt(b.onKeyDown,H=>{const Q=H.target.closest("[data-radix-menu-content]")===H.currentTarget,U=H.ctrlKey||H.altKey||H.metaKey,j=H.key.length===1;Q&&(H.key==="Tab"&&H.preventDefault(),!U&&j&&K(H.key));const ie=C.current;if(H.target!==ie||!WIe.includes(H.key))return;H.preventDefault();const J=k().filter(V=>!V.disabled).map(V=>V.ref.current);vee.includes(H.key)&&J.reverse(),fRe(J)}),onBlur:Vt(e.onBlur,H=>{H.currentTarget.contains(H.target)||(window.clearTimeout(A.current),M.current="")}),onPointerMove:Vt(e.onPointerMove,dv(H=>{const D=H.target,Q=B.current!==H.clientX;if(H.currentTarget.contains(D)&&Q){const U=H.clientX>B.current?"right":"left";O.current=U,B.current=H.clientX}}))})})})})})})});Tee.displayName=Pl;var sRe="MenuGroup",tj=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(jn.div,{role:"group",...r,ref:t})});tj.displayName=sRe;var iRe="MenuLabel",Aee=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(jn.div,{...r,ref:t})});Aee.displayName=iRe;var K_="MenuItem",uz="menu.itemSelect",t3=f.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,i=f.useRef(null),o=ex(K_,e.__scopeMenu),a=ZN(K_,e.__scopeMenu),l=lr(t,i),u=f.useRef(!1),d=()=>{const h=i.current;if(!n&&h){const m=new CustomEvent(uz,{bubbles:!0,cancelable:!0});h.addEventListener(uz,p=>r==null?void 0:r(p),{once:!0}),mZ(h,m),m.defaultPrevented?u.current=!1:o.onClose()}};return c.jsx(Eee,{...s,ref:l,disabled:n,onClick:Vt(e.onClick,d),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),u.current=!0},onPointerUp:Vt(e.onPointerUp,h=>{var m;u.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:Vt(e.onKeyDown,h=>{n||h.target!==h.currentTarget||a.searchRef.current!==""&&h.key===" "||qA.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});t3.displayName=K_;var Eee=f.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=e,o=ZN(K_,n),a=wee(n),l=f.useRef(null),u=lr(t,l),[d,h]=f.useState(!1),[m,p]=f.useState("");return f.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[i.children]),c.jsx(uv.ItemSlot,{scope:n,disabled:r,textValue:s??m,children:c.jsx(e3,{asChild:!0,...a,focusable:!r,children:c.jsx(jn.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:Vt(e.onPointerMove,dv(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Vt(e.onPointerLeave,dv(g=>o.onItemLeave(g))),onFocus:Vt(e.onFocus,()=>h(!0)),onBlur:Vt(e.onBlur,()=>h(!1))})})})}),oRe="MenuCheckboxItem",Mee=f.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return c.jsx(Dee,{scope:e.__scopeMenu,checked:n,children:c.jsx(t3,{role:"menuitemcheckbox","aria-checked":Y_(n)?"mixed":n,...s,ref:t,"data-state":sj(n),onSelect:Vt(s.onSelect,()=>r==null?void 0:r(Y_(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mee.displayName=oRe;var Nee="MenuRadioGroup",[aRe,lRe]=yp(Nee,{value:void 0,onValueChange:()=>{}}),jee=f.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,i=sl(r);return c.jsx(aRe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:c.jsx(tj,{...s,ref:t})})});jee.displayName=Nee;var Iee="MenuRadioItem",Ree=f.forwardRef((e,t)=>{const{value:n,...r}=e,s=lRe(Iee,e.__scopeMenu),i=n===s.value;return c.jsx(Dee,{scope:e.__scopeMenu,checked:i,children:c.jsx(t3,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":sj(i),onSelect:Vt(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});Ree.displayName=Iee;var nj="MenuItemIndicator",[Dee,cRe]=yp(nj,{checked:!1}),Lee=f.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,i=cRe(nj,n);return c.jsx(Ko,{present:r||Y_(i.checked)||i.checked===!0,children:c.jsx(jn.span,{...s,ref:t,"data-state":sj(i.checked)})})});Lee.displayName=nj;var uRe="MenuSeparator",Pee=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(jn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});Pee.displayName=uRe;var dRe="MenuArrow",Oee=f.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Zv(n);return c.jsx(JS,{...s,...r,ref:t})});Oee.displayName=dRe;var rj="MenuSub",[hRe,Bee]=yp(rj),$ee=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:s}=e,i=Sf(rj,t),o=Zv(t),[a,l]=f.useState(null),[u,d]=f.useState(null),h=sl(s);return f.useEffect(()=>(i.open===!1&&h(!1),()=>h(!1)),[i.open,h]),c.jsx(Yv,{...o,children:c.jsx(kee,{scope:t,open:r,onOpenChange:h,content:u,onContentChange:d,children:c.jsx(hRe,{scope:t,contentId:ya(),triggerId:ya(),trigger:a,onTriggerChange:l,children:n})})})};$ee.displayName=rj;var Cb="MenuSubTrigger",zee=f.forwardRef((e,t)=>{const n=Sf(Cb,e.__scopeMenu),r=ex(Cb,e.__scopeMenu),s=Bee(Cb,e.__scopeMenu),i=ZN(Cb,e.__scopeMenu),o=f.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,u={__scopeMenu:e.__scopeMenu},d=f.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);f.useEffect(()=>d,[d]),f.useEffect(()=>{const m=a.current;return()=>{window.clearTimeout(m),l(null)}},[a,l]);const h=lr(t,s.onTriggerChange);return c.jsx(QN,{asChild:!0,...u,children:c.jsx(Eee,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":n.open?s.contentId:void 0,"data-state":Hee(n.open),...e,ref:h,onClick:m=>{var p;(p=e.onClick)==null||p.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Vt(e.onPointerMove,dv(m=>{i.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Vt(e.onPointerLeave,dv(m=>{var g,b;d();const p=(g=n.content)==null?void 0:g.getBoundingClientRect();if(p){const x=(b=n.content)==null?void 0:b.dataset.side,v=x==="right",y=v?-5:5,w=p[v?"left":"right"],k=p[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+y,y:m.clientY},{x:w,y:p.top},{x:k,y:p.top},{x:k,y:p.bottom},{x:w,y:p.bottom}],side:x}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Vt(e.onKeyDown,m=>{var g;e.disabled||m.target!==m.currentTarget||i.searchRef.current!==""&&m.key===" "||GIe[r.dir].includes(m.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),m.preventDefault())})})})});zee.displayName=Cb;var Fee="MenuSubContent",qee=f.forwardRef((e,t)=>{const n=See(Pl,e.__scopeMenu),{forceMount:r=n.forceMount,align:s="start",...i}=e,o=Sf(Pl,e.__scopeMenu),a=ex(Pl,e.__scopeMenu),l=Bee(Fee,e.__scopeMenu),u=f.useRef(null),d=lr(t,u);return c.jsx(uv.Provider,{scope:e.__scopeMenu,children:c.jsx(Ko,{present:r||o.open,children:c.jsx(uv.Slot,{scope:e.__scopeMenu,children:c.jsx(ej,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:s,side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;a.isUsingKeyboardRef.current&&((m=u.current)==null||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:Vt(e.onFocusOutside,h=>{h.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Vt(e.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:Vt(e.onKeyDown,h=>{var g;const m=h.currentTarget.contains(h.target),p=KIe[a.dir].includes(h.key);m&&p&&(o.onOpenChange(!1),(g=l.trigger)==null||g.focus(),h.preventDefault())})})})})})});qee.displayName=Fee;function Hee(e){return e?"open":"closed"}function Y_(e){return e==="indeterminate"}function sj(e){return Y_(e)?"indeterminate":e?"checked":"unchecked"}function fRe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function mRe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function pRe(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=mRe(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function gRe(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],l=t[o],u=a.x,d=a.y,h=l.x,m=l.y;d>r!=m>r&&n<(h-u)*(r-d)/(m-d)+u&&(s=!s)}return s}function bRe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return gRe(n,t)}function dv(e){return t=>t.pointerType==="mouse"?e(t):void 0}var yRe=_ee,vRe=QN,xRe=Cee,wRe=Tee,kRe=tj,_Re=Aee,SRe=t3,CRe=Mee,TRe=jee,ARe=Ree,ERe=Lee,MRe=Pee,NRe=Oee,jRe=$ee,IRe=zee,RRe=qee,n3="DropdownMenu",[DRe,yyt]=Go(n3,[xee]),Co=xee(),[LRe,Uee]=DRe(n3),Vee=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:a=!0}=e,l=Co(t),u=f.useRef(null),[d,h]=ka({prop:s,defaultProp:i??!1,onChange:o,caller:n3});return c.jsx(LRe,{scope:t,triggerId:ya(),triggerRef:u,contentId:ya(),open:d,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(m=>!m),[h]),modal:a,children:c.jsx(yRe,{...l,open:d,onOpenChange:h,dir:r,modal:a,children:n})})};Vee.displayName=n3;var Wee="DropdownMenuTrigger",Gee=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,i=Uee(Wee,n),o=Co(n),a=lr(t,i.triggerRef);return c.jsx(vRe,{asChild:!0,...o,children:c.jsx(jn.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:a,onPointerDown:Vt(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Vt(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Gee.displayName=Wee;var PRe="DropdownMenuPortal",Kee=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Co(t);return c.jsx(xRe,{...r,...n})};Kee.displayName=PRe;var Yee="DropdownMenuContent",Xee=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Uee(Yee,n),i=Co(n),o=f.useRef(!1);return c.jsx(wRe,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:t,onCloseAutoFocus:Vt(e.onCloseAutoFocus,a=>{var l;o.current||(l=s.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Vt(e.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Xee.displayName=Yee;var ORe="DropdownMenuGroup",Qee=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(kRe,{...s,...r,ref:t})});Qee.displayName=ORe;var BRe="DropdownMenuLabel",$Re=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(_Re,{...s,...r,ref:t})});$Re.displayName=BRe;var zRe="DropdownMenuItem",Jee=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(SRe,{...s,...r,ref:t})});Jee.displayName=zRe;var FRe="DropdownMenuCheckboxItem",qRe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(CRe,{...s,...r,ref:t})});qRe.displayName=FRe;var HRe="DropdownMenuRadioGroup",URe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(TRe,{...s,...r,ref:t})});URe.displayName=HRe;var VRe="DropdownMenuRadioItem",WRe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(ARe,{...s,...r,ref:t})});WRe.displayName=VRe;var GRe="DropdownMenuItemIndicator",KRe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(ERe,{...s,...r,ref:t})});KRe.displayName=GRe;var YRe="DropdownMenuSeparator",Zee=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(MRe,{...s,...r,ref:t})});Zee.displayName=YRe;var XRe="DropdownMenuArrow",QRe=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(NRe,{...s,...r,ref:t})});QRe.displayName=XRe;var JRe=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:s,defaultOpen:i}=e,o=Co(t),[a,l]=ka({prop:r,defaultProp:i??!1,onChange:s,caller:"DropdownMenuSub"});return c.jsx(jRe,{...o,open:a,onOpenChange:l,children:n})},ZRe="DropdownMenuSubTrigger",ete=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(IRe,{...s,...r,ref:t})});ete.displayName=ZRe;var eDe="DropdownMenuSubContent",tte=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Co(n);return c.jsx(RRe,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tte.displayName=eDe;var tDe=Vee,nDe=Gee,rDe=Kee,sDe=Xee,iDe=Qee,oDe=Jee,aDe=Zee,lDe=JRe,cDe=ete,uDe=tte,dDe="Label",nte=f.forwardRef((e,t)=>c.jsx(jn.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));nte.displayName=dDe;var hDe=nte;function dz(e,[t,n]){return Math.min(n,Math.max(t,e))}var r3="Popover",[rte,vyt]=Go(r3,[kf]),tx=kf(),[fDe,Cf]=rte(r3),ste=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,a=tx(t),l=f.useRef(null),[u,d]=f.useState(!1),[h,m]=ka({prop:r,defaultProp:s??!1,onChange:i,caller:r3});return c.jsx(Yv,{...a,children:c.jsx(fDe,{scope:t,contentId:ya(),triggerRef:l,open:h,onOpenChange:m,onOpenToggle:f.useCallback(()=>m(p=>!p),[m]),hasCustomAnchor:u,onCustomAnchorAdd:f.useCallback(()=>d(!0),[]),onCustomAnchorRemove:f.useCallback(()=>d(!1),[]),modal:o,children:n})})};ste.displayName=r3;var ite="PopoverAnchor",ote=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Cf(ite,n),i=tx(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return f.useEffect(()=>(o(),()=>a()),[o,a]),c.jsx(Xv,{...i,...r,ref:t})});ote.displayName=ite;var ate="PopoverTrigger",lte=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Cf(ate,n),i=tx(n),o=lr(t,s.triggerRef),a=c.jsx(jn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":fte(s.open),...r,ref:o,onClick:Vt(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:c.jsx(Xv,{asChild:!0,...i,children:a})});lte.displayName=ate;var ij="PopoverPortal",[mDe,pDe]=rte(ij,{forceMount:void 0}),cte=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,i=Cf(ij,t);return c.jsx(mDe,{scope:t,forceMount:n,children:c.jsx(Ko,{present:n||i.open,children:c.jsx(i1,{asChild:!0,container:s,children:r})})})};cte.displayName=ij;var Mg="PopoverContent",ute=f.forwardRef((e,t)=>{const n=pDe(Mg,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,i=Cf(Mg,e.__scopePopover);return c.jsx(Ko,{present:r||i.open,children:i.modal?c.jsx(bDe,{...s,ref:t}):c.jsx(yDe,{...s,ref:t})})});ute.displayName=Mg;var gDe=cf("PopoverContent.RemoveScroll"),bDe=f.forwardRef((e,t)=>{const n=Cf(Mg,e.__scopePopover),r=f.useRef(null),s=lr(t,r),i=f.useRef(!1);return f.useEffect(()=>{const o=r.current;if(o)return US(o)},[]),c.jsx(Kv,{as:gDe,allowPinchZoom:!0,children:c.jsx(dte,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Vt(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Vt(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;i.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:Vt(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),yDe=f.forwardRef((e,t)=>{const n=Cf(Mg,e.__scopePopover),r=f.useRef(!1),s=f.useRef(!1);return c.jsx(dte,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),dte=f.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...h}=e,m=Cf(Mg,n),p=tx(n);return qS(),c.jsx(Gv,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:c.jsx(s1,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:c.jsx(QS,{"data-state":fte(m.open),role:"dialog",id:m.contentId,...p,...h,ref:t,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),hte="PopoverClose",vDe=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Cf(hte,n);return c.jsx(jn.button,{type:"button",...r,ref:t,onClick:Vt(e.onClick,()=>s.onOpenChange(!1))})});vDe.displayName=hte;var xDe="PopoverArrow",wDe=f.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=tx(n);return c.jsx(JS,{...s,...r,ref:t})});wDe.displayName=xDe;function fte(e){return e?"open":"closed"}var kDe=ste,_De=ote,SDe=lte,CDe=cte,TDe=ute,oj="Radio",[ADe,mte]=Go(oj),[EDe,s3]=ADe(oj);function pte(e){const{__scopeRadio:t,checked:n=!1,children:r,disabled:s,form:i,name:o,onCheck:a,required:l,value:u="on",internal_do_not_use_render:d}=e,[h,m]=f.useState(null),[p,g]=f.useState(null),b=f.useRef(!1),x=h?!!i||!!h.closest("form"):!0,v={checked:n,disabled:s,required:l,name:o,form:i,value:u,control:h,setControl:m,hasConsumerStoppedPropagationRef:b,isFormControl:x,bubbleInput:p,setBubbleInput:g,onCheck:()=>a==null?void 0:a()};return c.jsx(EDe,{scope:t,...v,children:NDe(d)?d(v):r})}var gte="RadioTrigger",aj=f.forwardRef(({__scopeRadio:e,onClick:t,...n},r)=>{const{checked:s,disabled:i,value:o,setControl:a,onCheck:l,hasConsumerStoppedPropagationRef:u,isFormControl:d,bubbleInput:h}=s3(gte,e),m=lr(r,a);return c.jsx(jn.button,{type:"button",role:"radio","aria-checked":s,"data-state":xte(s),"data-disabled":i?"":void 0,disabled:i,value:o,...n,ref:m,onClick:Vt(t,p=>{s||l(),h&&d&&(u.current=p.isPropagationStopped(),u.current||p.stopPropagation())})})});aj.displayName=gte;var MDe=f.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s,required:i,disabled:o,value:a,onCheck:l,form:u,...d}=e;return c.jsx(pte,{__scopeRadio:n,checked:s,disabled:o,required:i,onCheck:l,name:r,form:u,value:a,internal_do_not_use_render:({isFormControl:h})=>c.jsxs(c.Fragment,{children:[c.jsx(aj,{...d,ref:t,__scopeRadio:n}),h&&c.jsx(lj,{__scopeRadio:n})]})})});MDe.displayName=oj;var bte="RadioIndicator",yte=f.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,i=s3(bte,n);return c.jsx(Ko,{present:r||i.checked,children:c.jsx(jn.span,{"data-state":xte(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})})});yte.displayName=bte;var vte="RadioBubbleInput",lj=f.forwardRef(({__scopeRadio:e,...t},n)=>{const{control:r,checked:s,required:i,disabled:o,name:a,value:l,form:u,bubbleInput:d,setBubbleInput:h,hasConsumerStoppedPropagationRef:m}=s3(vte,e),p=lr(n,h),g=zN(s),b=FN(r);f.useEffect(()=>{const v=d;if(!v)return;const y=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(y,"checked").set,T=!m.current;if(g!==s&&k){const S=new Event("click",{bubbles:T});k.call(v,s),v.dispatchEvent(S)}},[d,g,s,m]);const x=f.useRef(s);return c.jsx(jn.input,{type:"radio","aria-hidden":!0,defaultChecked:x.current,required:i,disabled:o,name:a,value:l,form:u,...t,tabIndex:-1,ref:p,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});lj.displayName=vte;function NDe(e){return typeof e=="function"}function xte(e){return e?"checked":"unchecked"}var jDe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],i3="RadioGroup",[IDe,xyt]=Go(i3,[_f,mte]),wte=_f(),o3=mte(),[RDe,DDe]=IDe(i3),kte=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,form:s,defaultValue:i,value:o,required:a=!1,disabled:l=!1,orientation:u,dir:d,loop:h=!0,onValueChange:m,...p}=e,g=wte(n),b=r1(d),[x,v]=ka({prop:o,defaultProp:i??null,onChange:m,caller:i3}),[y,w]=f.useState(null),k=lr(t,w),T=f.useRef(x);return f.useEffect(()=>{const S=s?y==null?void 0:y.ownerDocument.getElementById(s):y==null?void 0:y.closest("form");if(S instanceof HTMLFormElement){const C=()=>v(T.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[y,s,v]),c.jsx(RDe,{scope:n,name:r,form:s,required:a,disabled:l,value:x,onValueChange:v,children:c.jsx(ZS,{asChild:!0,...g,orientation:u,dir:b,loop:h,children:c.jsx(jn.div,{role:"radiogroup","aria-required":a,"aria-orientation":u,"data-disabled":l?"":void 0,dir:b,...p,ref:k})})})});kte.displayName=i3;var LDe="RadioGroupItem",PDe="RadioGroupItemProvider",_te="RadioGroupItemTrigger",ODe="RadioGroupItemBubbleInput";function BDe(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:s,internal_do_not_use_render:i}=e,o=DDe(PDe,t),a=o3(t),l=o.disabled||r;return c.jsx(pte,{...a,checked:o.value===n,disabled:l,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:i,children:s})}var Ste=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=wte(n),i=o3(n),{checked:o,disabled:a}=s3(_te,i.__scopeRadio),l=f.useRef(null),u=lr(t,l),d=f.useRef(!1);return f.useEffect(()=>{const h=p=>{jDe.includes(p.key)&&(d.current=!0)},m=()=>d.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),c.jsx(e3,{asChild:!0,...s,focusable:!a,active:o,children:c.jsx(aj,{...i,...r,ref:u,onKeyDown:Vt(r.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Vt(r.onFocus,()=>{var h;d.current&&((h=l.current)==null||h.click())})})})});Ste.displayName=_te;var Cte=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,value:r,disabled:s,...i}=e;return c.jsx(BDe,{__scopeRadioGroup:n,value:r,disabled:s,internal_do_not_use_render:({isFormControl:o})=>c.jsxs(c.Fragment,{children:[c.jsx(Ste,{...i,ref:t,__scopeRadioGroup:n}),o&&c.jsx(Tte,{__scopeRadioGroup:n})]})})});Cte.displayName=LDe;var Tte=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=o3(n);return c.jsx(lj,{...s,...r,ref:t})});Tte.displayName=ODe;var $De="RadioGroupIndicator",Ate=f.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=o3(n);return c.jsx(yte,{...s,...r,ref:t})});Ate.displayName=$De;var zDe=[" ","Enter","ArrowUp","ArrowDown"],FDe=[" ","Enter"],np="Select",[a3,l3,qDe]=NN(np),[vp,wyt]=Go(np,[qDe,kf]),c3=kf(),[HDe,Tf]=vp(np),[UDe,VDe]=vp(np),WDe="SelectProvider";function Ete(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:u,name:d,autoComplete:h,disabled:m,required:p,form:g,internal_do_not_use_render:b}=e,x=c3(t),[v,y]=f.useState(null),[w,k]=f.useState(null),[T,S]=f.useState(!1),C=r1(u),[_,A]=ka({prop:r,defaultProp:s??!1,onChange:i,caller:np}),[M,L]=ka({prop:o,defaultProp:a,onChange:l,caller:np}),N=f.useRef(null),O=f.useRef(M);f.useEffect(()=>{const U=g?v==null?void 0:v.ownerDocument.getElementById(g):v==null?void 0:v.form;if(U instanceof HTMLFormElement){const j=()=>L(O.current);return U.addEventListener("reset",j),()=>U.removeEventListener("reset",j)}},[g,v,L]);const B=v?!!g||!!v.closest("form"):!0,[$,P]=f.useState(new Set),K=ya(),F=Array.from($).map(U=>U.props.value).join(";"),H=f.useCallback(U=>{P(j=>new Set(j).add(U))},[]),D=f.useCallback(U=>{P(j=>{const ie=new Set(j);return ie.delete(U),ie})},[]),Q={required:p,trigger:v,onTriggerChange:y,valueNode:w,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:S,contentId:K,value:M,onValueChange:L,open:_,onOpenChange:A,dir:C,triggerPointerDownPosRef:N,disabled:m,name:d,autoComplete:h,form:g,nativeOptions:$,nativeSelectKey:F,isFormControl:B};return c.jsx(Yv,{...x,children:c.jsx(HDe,{scope:t,...Q,children:c.jsx(a3.Provider,{scope:t,children:c.jsx(UDe,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:D,children:lLe(b)?b(Q):n})})})})}Ete.displayName=WDe;var Mte=e=>{const{__scopeSelect:t,children:n,...r}=e;return c.jsx(Ete,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:s})=>c.jsxs(c.Fragment,{children:[n,s?c.jsx(nne,{__scopeSelect:t}):null]})})};Mte.displayName=np;var Nte="SelectTrigger",jte=f.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=c3(n),o=Tf(Nte,n),a=o.disabled||r,l=lr(t,o.onTriggerChange),u=l3(n),d=f.useRef("touch"),[h,m,p]=rne(b=>{const x=u().filter(w=>!w.disabled),v=x.find(w=>w.value===o.value),y=sne(x,b,v);y!==void 0&&o.onValueChange(y.value)}),g=b=>{a||(o.onOpenChange(!0),p()),b&&(o.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return c.jsx(Xv,{asChild:!0,...i,children:c.jsx(jn.button,{type:"button",role:"combobox","aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":u3(o.value)?"":void 0,...s,ref:l,onClick:Vt(s.onClick,b=>{b.currentTarget.focus(),d.current!=="mouse"&&g(b)}),onPointerDown:Vt(s.onPointerDown,b=>{d.current=b.pointerType;const x=b.target;x.hasPointerCapture(b.pointerId)&&x.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(g(b),b.preventDefault())}),onKeyDown:Vt(s.onKeyDown,b=>{const x=h.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(x&&b.key===" ")&&zDe.includes(b.key)&&(g(),b.preventDefault())})})})});jte.displayName=Nte;var Ite="SelectValue",Rte=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=Tf(Ite,n),{onValueNodeHasChildrenChange:u}=l,d=i!==void 0,h=lr(t,l.onValueNodeChange);Wi(()=>{u(d)},[u,d]);const m=u3(l.value);return c.jsx(jn.span,{...a,asChild:m?!1:a.asChild,ref:h,style:{pointerEvents:"none"},children:c.jsx(f.Fragment,{children:m?o:i},m?"placeholder":"value")})});Rte.displayName=Ite;var GDe="SelectIcon",Dte=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return c.jsx(jn.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});Dte.displayName=GDe;var Lte="SelectPortal",[KDe,YDe]=vp(Lte,{forceMount:void 0}),Pte=e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return c.jsx(KDe,{scope:e.__scopeSelect,forceMount:n,children:c.jsx(i1,{asChild:!0,...r})})};Pte.displayName=Lte;var hf="SelectContent",Ote=f.forwardRef((e,t)=>{const n=YDe(hf,e.__scopeSelect),{forceMount:r=n.forceMount,...s}=e,i=Tf(hf,e.__scopeSelect),[o,a]=f.useState();return Wi(()=>{a(new DocumentFragment)},[]),c.jsx(Ko,{present:r||i.open,children:({present:l})=>l?c.jsx(zte,{...s,ref:t}):c.jsx(Bte,{...s,fragment:o})})});Ote.displayName=hf;var Bte=f.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,fragment:s}=e;return s?rc.createPortal(c.jsx($te,{scope:n,children:c.jsx(a3.Slot,{scope:n,children:c.jsx("div",{ref:t,children:r})})}),s):null});Bte.displayName="SelectContentFragment";var Kl=10,[$te,Af]=vp(hf),XDe="SelectContentImpl",QDe=cf("SelectContent.RemoveScroll"),zte=f.forwardRef((e,t)=>{const{__scopeSelect:n}=e,{position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:x,...v}=e,y=Tf(hf,n),[w,k]=f.useState(null),[T,S]=f.useState(null),C=lr(t,k),[_,A]=f.useState(null),[M,L]=f.useState(null),N=l3(n),[O,B]=f.useState(!1),$=f.useRef(!1);f.useEffect(()=>{if(w)return US(w)},[w]),qS();const P=f.useCallback(V=>{const[se,...Z]=N().map(ae=>ae.ref.current),[X]=Z.slice(-1),te=document.activeElement;for(const ae of V)if(ae===te||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===se&&T&&(T.scrollTop=0),ae===X&&T&&(T.scrollTop=T.scrollHeight),ae==null||ae.focus(),document.activeElement!==te))return},[N,T]),K=f.useCallback(()=>P([_,w]),[P,_,w]);f.useEffect(()=>{O&&K()},[O,K]);const{onOpenChange:F,triggerPointerDownPosRef:H}=y;f.useEffect(()=>{if(w){let V={x:0,y:0};const se=X=>{var te,ae;V={x:Math.abs(Math.round(X.pageX)-(((te=H.current)==null?void 0:te.x)??0)),y:Math.abs(Math.round(X.pageY)-(((ae=H.current)==null?void 0:ae.y)??0))}},Z=X=>{V.x<=10&&V.y<=10?X.preventDefault():X.composedPath().includes(w)||F(!1),document.removeEventListener("pointermove",se),H.current=null};return H.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",Z,{capture:!0})}}},[w,F,H]),f.useEffect(()=>{const V=()=>F(!1);return window.addEventListener("blur",V),window.addEventListener("resize",V),()=>{window.removeEventListener("blur",V),window.removeEventListener("resize",V)}},[F]);const[D,Q]=rne(V=>{const se=N().filter(te=>!te.disabled),Z=se.find(te=>te.ref.current===document.activeElement),X=sne(se,V,Z);X&&setTimeout(()=>{var te;return(te=X.ref.current)==null?void 0:te.focus()})}),U=f.useCallback((V,se,Z)=>{const X=!$.current&&!Z;(y.value!==void 0&&y.value===se||X)&&(A(V),X&&($.current=!0))},[y.value]),j=f.useCallback(()=>w==null?void 0:w.focus(),[w]),ie=f.useCallback((V,se,Z)=>{const X=!$.current&&!Z;(y.value!==void 0&&y.value===se||X)&&L(V)},[y.value]),oe=r==="popper"?HA:Fte,J=oe===HA?{side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:b,avoidCollisions:x}:{};return c.jsx($te,{scope:n,content:w,viewport:T,onViewportChange:S,itemRefCallback:U,selectedItem:_,onItemLeave:j,itemTextRefCallback:ie,focusSelectedItem:K,selectedItemText:M,position:r,isPositioned:O,searchRef:D,children:c.jsx(Kv,{as:QDe,allowPinchZoom:!0,children:c.jsx(Gv,{asChild:!0,trapped:y.open,onMountAutoFocus:V=>{V.preventDefault()},onUnmountAutoFocus:Vt(s,V=>{var se;(se=y.trigger)==null||se.focus({preventScroll:!0}),V.preventDefault()}),children:c.jsx(s1,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:V=>V.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:c.jsx(oe,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:V=>V.preventDefault(),...v,...J,onPlaced:()=>B(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Vt(v.onKeyDown,V=>{const se=V.ctrlKey||V.altKey||V.metaKey;if(V.key==="Tab"&&V.preventDefault(),!se&&V.key.length===1&&Q(V.key),["ArrowUp","ArrowDown","Home","End"].includes(V.key)){let X=N().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(V.key)&&(X=X.slice().reverse()),["ArrowUp","ArrowDown"].includes(V.key)){const te=V.target,ae=X.indexOf(te);X=X.slice(ae+1)}setTimeout(()=>P(X)),V.preventDefault()}})})})})})})});zte.displayName=XDe;var JDe="SelectItemAlignedPosition",Fte=f.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=Tf(hf,n),o=Af(hf,n),[a,l]=f.useState(null),[u,d]=f.useState(null),h=lr(t,d),m=l3(n),p=f.useRef(!1),g=f.useRef(!0),{viewport:b,selectedItem:x,selectedItemText:v,focusSelectedItem:y}=o,w=f.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&b&&x&&v){const C=i.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),M=v.getBoundingClientRect();if(i.dir!=="rtl"){const te=M.left-_.left,ae=A.left-te,xe=C.left-ae,Ae=C.width+xe,Ne=Math.max(Ae,_.width),Le=window.innerWidth-Kl,ge=dz(ae,[Kl,Math.max(Kl,Le-Ne)]);a.style.minWidth=Ae+"px",a.style.left=ge+"px"}else{const te=_.right-M.right,ae=window.innerWidth-A.right-te,xe=window.innerWidth-C.right-ae,Ae=C.width+xe,Ne=Math.max(Ae,_.width),Le=window.innerWidth-Kl,ge=dz(ae,[Kl,Math.max(Kl,Le-Ne)]);a.style.minWidth=Ae+"px",a.style.right=ge+"px"}const L=m(),N=window.innerHeight-Kl*2,O=b.scrollHeight,B=window.getComputedStyle(u),$=parseInt(B.borderTopWidth,10),P=parseInt(B.paddingTop,10),K=parseInt(B.borderBottomWidth,10),F=parseInt(B.paddingBottom,10),H=$+P+O+F+K,D=Math.min(x.offsetHeight*5,H),Q=window.getComputedStyle(b),U=parseInt(Q.paddingTop,10),j=parseInt(Q.paddingBottom,10),ie=C.top+C.height/2-Kl,oe=N-ie,J=x.offsetHeight/2,V=x.offsetTop+J,se=$+P+V,Z=H-se;if(se<=ie){const te=L.length>0&&x===L[L.length-1].ref.current;a.style.bottom="0px";const ae=u.clientHeight-b.offsetTop-b.offsetHeight,xe=Math.max(oe,J+(te?j:0)+ae+K),Ae=se+xe;a.style.height=Ae+"px"}else{const te=L.length>0&&x===L[0].ref.current;a.style.top="0px";const xe=Math.max(ie,$+b.offsetTop+(te?U:0)+J)+Z;a.style.height=xe+"px",b.scrollTop=se-ie+b.offsetTop}a.style.margin=`${Kl}px 0`,a.style.minHeight=D+"px",a.style.maxHeight=N+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[m,i.trigger,i.valueNode,a,u,b,x,v,i.dir,r]);Wi(()=>w(),[w]);const[k,T]=f.useState();Wi(()=>{u&&T(window.getComputedStyle(u).zIndex)},[u]);const S=f.useCallback(C=>{C&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return c.jsx(eLe,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:c.jsx(jn.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Fte.displayName=JDe;var ZDe="SelectPopperPosition",HA=f.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Kl,...i}=e,o=c3(n);return c.jsx(QS,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});HA.displayName=ZDe;var[eLe,cj]=vp(hf,{}),UA="SelectViewport",qte=f.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Af(UA,n),o=cj(UA,n),a=lr(t,i.onViewportChange),l=f.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),c.jsx(a3.Slot,{scope:n,children:c.jsx(jn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Vt(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const p=Math.abs(l.current-d.scrollTop);if(p>0){const g=window.innerHeight-Kl*2,b=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),v=Math.max(b,x);if(v<g){const y=v+p,w=Math.min(g,y),k=y-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});qte.displayName=UA;var Hte="SelectGroup",[tLe,nLe]=vp(Hte),Ute=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ya();return c.jsx(tLe,{scope:n,id:s,children:c.jsx(jn.div,{role:"group","aria-labelledby":s,...r,ref:t})})});Ute.displayName=Hte;var Vte="SelectLabel",rLe=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=nLe(Vte,n);return c.jsx(jn.div,{id:s.id,...r,ref:t})});rLe.displayName=Vte;var X_="SelectItem",[sLe,Wte]=vp(X_),Gte=f.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=Tf(X_,n),l=Af(X_,n),u=a.value===r,[d,h]=f.useState(i??""),[m,p]=f.useState(!1),g=sl(w=>{var k;return(k=l.itemRefCallback)==null?void 0:k.call(l,w,r,s)}),b=lr(t,g),x=ya(),v=f.useRef("touch"),y=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};return c.jsx(sLe,{scope:n,value:r,disabled:s,textId:x,isSelected:u,onItemTextChange:f.useCallback(w=>{h(k=>k||((w==null?void 0:w.textContent)??"").trim())},[]),children:c.jsx(a3.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:c.jsx(jn.div,{role:"option","aria-labelledby":x,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:b,onFocus:Vt(o.onFocus,()=>p(!0)),onBlur:Vt(o.onBlur,()=>p(!1)),onClick:Vt(o.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:Vt(o.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:Vt(o.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:Vt(o.onPointerMove,w=>{var k;v.current=w.pointerType,s?(k=l.onItemLeave)==null||k.call(l):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Vt(o.onPointerLeave,w=>{var k;w.currentTarget===document.activeElement&&((k=l.onItemLeave)==null||k.call(l))}),onKeyDown:Vt(o.onKeyDown,w=>{var T;s||w.target!==w.currentTarget||((T=l.searchRef)==null?void 0:T.current)!==""&&w.key===" "||(FDe.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});Gte.displayName=X_;var Tb="SelectItemText",Kte=f.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=Tf(Tb,n),a=Af(Tb,n),l=Wte(Tb,n),u=VDe(Tb,n),[d,h]=f.useState(null),m=sl(y=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,y,l.value,l.disabled)}),p=lr(t,h,l.onItemTextChange,m),g=d==null?void 0:d.textContent,b=f.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:x,onNativeOptionRemove:v}=u;return Wi(()=>(x(b),()=>v(b)),[x,v,b]),c.jsxs(c.Fragment,{children:[c.jsx(jn.span,{id:l.textId,...i,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!u3(o.value)?rc.createPortal(i.children,o.valueNode):null]})});Kte.displayName=Tb;var Yte="SelectItemIndicator",Xte=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Wte(Yte,n).isSelected?c.jsx(jn.span,{"aria-hidden":!0,...r,ref:t}):null});Xte.displayName=Yte;var VA="SelectScrollUpButton",Qte=f.forwardRef((e,t)=>{const n=Af(VA,e.__scopeSelect),r=cj(VA,e.__scopeSelect),[s,i]=f.useState(!1),o=lr(t,r.onScrollButtonChange);return Wi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollTop>0;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Zte,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Qte.displayName=VA;var WA="SelectScrollDownButton",Jte=f.forwardRef((e,t)=>{const n=Af(WA,e.__scopeSelect),r=cj(WA,e.__scopeSelect),[s,i]=f.useState(!1),o=lr(t,r.onScrollButtonChange);return Wi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;i(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?c.jsx(Zte,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Jte.displayName=WA;var Zte=f.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Af("SelectScrollButton",n),o=f.useRef(null),a=l3(n),l=f.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return f.useEffect(()=>()=>l(),[l]),Wi(()=>{var d;const u=a().find(h=>h.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),c.jsx(jn.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Vt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Vt(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Vt(s.onPointerLeave,()=>{l()})})}),iLe="SelectSeparator",oLe=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(jn.div,{"aria-hidden":!0,...r,ref:t})});oLe.displayName=iLe;var ene="SelectArrow",aLe=f.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=c3(n);return Af(ene,n).position==="popper"?c.jsx(JS,{...s,...r,ref:t}):null});aLe.displayName=ene;var tne="SelectBubbleInput",nne=f.forwardRef(({__scopeSelect:e,...t},n)=>{const r=Tf(tne,e),{value:s,onValueChange:i,required:o,disabled:a,name:l,autoComplete:u,form:d}=r,{nativeOptions:h,nativeSelectKey:m}=r,p=f.useRef(null),g=lr(n,p),b=s??"",x=zN(b),v=Array.from(h).some(y=>(y.props.value??"")==="");return f.useEffect(()=>{const y=p.current;if(!y)return;const w=window.HTMLSelectElement.prototype,T=Object.getOwnPropertyDescriptor(w,"value").set;if(x!==b&&T){const S=new Event("change",{bubbles:!0});T.call(y,b),y.dispatchEvent(S)}},[x,b]),c.jsxs(jn.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:u,disabled:a,form:d,onChange:y=>i(y.target.value),...t,style:{...pZ,...t.style},ref:g,defaultValue:b,children:[u3(s)&&!v?c.jsx("option",{value:""}):null,Array.from(h)]},m)});nne.displayName=tne;function lLe(e){return typeof e=="function"}function u3(e){return e===""||e===void 0}function rne(e){const t=sl(e),n=f.useRef(""),r=f.useRef(0),s=f.useCallback(o=>{const a=n.current+o;t(a),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=f.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function sne(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=cLe(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function cLe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var uLe="Separator",hz="horizontal",dLe=["horizontal","vertical"],ine=f.forwardRef((e,t)=>{const{decorative:n,orientation:r=hz,...s}=e,i=hLe(r)?r:hz,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return c.jsx(jn.div,{"data-orientation":i,...a,...s,ref:t})});ine.displayName=uLe;function hLe(e){return dLe.includes(e)}var fLe=ine,d3="Switch",[mLe,kyt]=Go(d3),[pLe,uj]=mLe(d3);function gLe(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:a,onCheckedChange:l,required:u,value:d="on",internal_do_not_use_render:h}=e,[m,p]=ka({prop:n,defaultProp:s??!1,onChange:l,caller:d3}),[g,b]=f.useState(null),[x,v]=f.useState(null),y=f.useRef(!1),w=g?!!o||!!g.closest("form"):!0,k={checked:m,setChecked:p,disabled:i,control:g,setControl:b,name:a,form:o,value:d,hasConsumerStoppedPropagationRef:y,required:u,defaultChecked:s,isFormControl:w,bubbleInput:x,setBubbleInput:v};return c.jsx(pLe,{scope:t,...k,children:bLe(h)?h(k):r})}var one="SwitchTrigger",ane=f.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{const{control:s,form:i,value:o,disabled:a,checked:l,required:u,setControl:d,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:g}=uj(one,e),b=lr(r,d),x=f.useRef(l);return f.useEffect(()=>{const v=i?s==null?void 0:s.ownerDocument.getElementById(i):s==null?void 0:s.form;if(v instanceof HTMLFormElement){const y=()=>h(x.current);return v.addEventListener("reset",y),()=>v.removeEventListener("reset",y)}},[s,i,h]),c.jsx(jn.button,{type:"button",role:"switch","aria-checked":l,"aria-required":u,"data-state":fne(l),"data-disabled":a?"":void 0,disabled:a,value:o,...n,ref:b,onClick:Vt(t,v=>{h(y=>!y),g&&p&&(m.current=v.isPropagationStopped(),m.current||v.stopPropagation())})})});ane.displayName=one;var lne=f.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:a,value:l,onCheckedChange:u,form:d,...h}=e;return c.jsx(gLe,{__scopeSwitch:n,checked:s,defaultChecked:i,disabled:a,required:o,onCheckedChange:u,name:r,form:d,value:l,internal_do_not_use_render:({isFormControl:m})=>c.jsxs(c.Fragment,{children:[c.jsx(ane,{...h,ref:t,__scopeSwitch:n}),m&&c.jsx(hne,{__scopeSwitch:n})]})})});lne.displayName=d3;var cne="SwitchThumb",une=f.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=uj(cne,n);return c.jsx(jn.span,{"data-state":fne(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});une.displayName=cne;var dne="SwitchBubbleInput",hne=f.forwardRef(({__scopeSwitch:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:a,disabled:l,name:u,value:d,form:h,bubbleInput:m,setBubbleInput:p}=uj(dne,e),g=lr(n,p),b=zN(i),x=FN(r);f.useEffect(()=>{const y=m;if(!y)return;const w=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(w,"checked").set,S=!s.current;if(b!==i&&T){const C=new Event("click",{bubbles:S});T.call(y,i),y.dispatchEvent(C)}},[m,b,i,s]);const v=f.useRef(i);return c.jsx(jn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??v.current,required:a,disabled:l,name:u,value:d,form:h,...t,tabIndex:-1,ref:g,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});hne.displayName=dne;function bLe(e){return typeof e=="function"}function fne(e){return e?"checked":"unchecked"}var h3="Tabs",[yLe,_yt]=Go(h3,[_f]),mne=_f(),[vLe,dj]=yLe(h3),pne=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=r1(a),[h,m]=ka({prop:r,onChange:s,defaultProp:i??"",caller:h3});return c.jsx(vLe,{scope:n,baseId:ya(),value:h,onValueChange:m,orientation:o,dir:d,activationMode:l,children:c.jsx(jn.div,{dir:d,"data-orientation":o,...u,ref:t})})});pne.displayName=h3;var gne="TabsList",bne=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=dj(gne,n),o=mne(n);return c.jsx(ZS,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:c.jsx(jn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});bne.displayName=gne;var yne="TabsTrigger",vne=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,o=dj(yne,n),a=mne(n),l=kne(o.baseId,r),u=_ne(o.baseId,r),d=r===o.value;return c.jsx(e3,{asChild:!0,...a,focusable:!s,active:d,children:c.jsx(jn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:l,...i,ref:t,onMouseDown:Vt(e.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(r):h.preventDefault()}),onKeyDown:Vt(e.onKeyDown,h=>{s||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&o.onValueChange(r)}),onFocus:Vt(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(r)})})})});vne.displayName=yne;var xne="TabsContent",wne=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=e,a=dj(xne,n),l=kne(a.baseId,r),u=_ne(a.baseId,r),d=r===a.value,h=f.useRef(d);return f.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),c.jsx(Ko,{present:s||d,children:({present:m})=>c.jsx(jn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!m,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&i})})});wne.displayName=xne;function kne(e,t){return`${e}-trigger-${t}`}function _ne(e,t){return`${e}-content-${t}`}var xLe=pne,wLe=bne,kLe=vne,_Le=wne,Sne="Toggle",Cne=f.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:s,...i}=e,[o,a]=ka({prop:n,onChange:s,defaultProp:r??!1,caller:Sne});return c.jsx(jn.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":e.disabled?"":void 0,...i,ref:t,onClick:Vt(e.onClick,()=>{e.disabled||a(!o)})})});Cne.displayName=Sne;var Ef="ToggleGroup",[Tne,Syt]=Go(Ef,[_f]),Ane=_f(),hj=f.forwardRef((e,t)=>{const{type:n,...r}=e;if(n==="single"){const s=r;return c.jsx(SLe,{role:"radiogroup",...s,ref:t})}if(n==="multiple"){const s=r;return c.jsx(CLe,{role:"toolbar",...s,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${Ef}\``)});hj.displayName=Ef;var[Ene,Mne]=Tne(Ef),SLe=f.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=ka({prop:n,defaultProp:r??"",onChange:s,caller:Ef});return c.jsx(Ene,{scope:e.__scopeToggleGroup,type:"single",value:f.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:f.useCallback(()=>a(""),[a]),children:c.jsx(Nne,{...i,ref:t})})}),CLe=f.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o,a]=ka({prop:n,defaultProp:r??[],onChange:s,caller:Ef}),l=f.useCallback(d=>a((h=[])=>[...h,d]),[a]),u=f.useCallback(d=>a((h=[])=>h.filter(m=>m!==d)),[a]);return c.jsx(Ene,{scope:e.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:u,children:c.jsx(Nne,{...i,ref:t})})});hj.displayName=Ef;var[TLe,ALe]=Tne(Ef),Nne=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:s=!0,orientation:i,dir:o,loop:a=!0,...l}=e,u=Ane(n),d=r1(o),h={dir:d,...l};return c.jsx(TLe,{scope:n,rovingFocus:s,disabled:r,children:s?c.jsx(ZS,{asChild:!0,...u,orientation:i,dir:d,loop:a,children:c.jsx(jn.div,{...h,ref:t})}):c.jsx(jn.div,{...h,ref:t})})}),Q_="ToggleGroupItem",jne=f.forwardRef((e,t)=>{const n=Mne(Q_,e.__scopeToggleGroup),r=ALe(Q_,e.__scopeToggleGroup),s=Ane(e.__scopeToggleGroup),i=n.value.includes(e.value),o=r.disabled||e.disabled,a={...e,pressed:i,disabled:o},l=f.useRef(null);return r.rovingFocus?c.jsx(e3,{asChild:!0,...s,focusable:!o,active:i,ref:l,children:c.jsx(fz,{...a,ref:t})}):c.jsx(fz,{...a,ref:t})});jne.displayName=Q_;var fz=f.forwardRef((e,t)=>{const{__scopeToggleGroup:n,value:r,...s}=e,i=Mne(Q_,n),o={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},a=i.type==="single"?o:void 0;return c.jsx(Cne,{...a,...s,ref:t,onPressedChange:l=>{l?i.onItemActivate(r):i.onItemDeactivate(r)}})}),[f3,Cyt]=Go("Tooltip",[kf]),m3=kf(),Ine="TooltipProvider",ELe=700,GA="tooltip.open",[MLe,fj]=f3(Ine),Rne=e=>{const{__scopeTooltip:t,delayDuration:n=ELe,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=f.useRef(!0),a=f.useRef(!1),l=f.useRef(0);return f.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx(MLe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:f.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:f.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:f.useCallback(u=>{a.current=u},[]),disableHoverableContent:s,children:i})};Rne.displayName=Ine;var hv="Tooltip",[NLe,nx]=f3(hv),Dne=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,l=fj(hv,e.__scopeTooltip),u=m3(t),[d,h]=f.useState(null),m=ya(),p=f.useRef(0),g=o??l.disableHoverableContent,b=a??l.delayDuration,x=f.useRef(!1),[v,y]=ka({prop:r,defaultProp:s??!1,onChange:C=>{C?(l.onOpen(),document.dispatchEvent(new CustomEvent(GA))):l.onClose(),i==null||i(C)},caller:hv}),w=f.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),k=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,y(!0)},[y]),T=f.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),S=f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,y(!0),p.current=0},b)},[b,y]);return f.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),c.jsx(Yv,{...u,children:c.jsx(NLe,{scope:t,contentId:m,open:v,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:f.useCallback(()=>{l.isOpenDelayedRef.current?S():k()},[l.isOpenDelayedRef,S,k]),onTriggerLeave:f.useCallback(()=>{g?T():(window.clearTimeout(p.current),p.current=0)},[T,g]),onOpen:k,onClose:T,disableHoverableContent:g,children:n})})};Dne.displayName=hv;var KA="TooltipTrigger",Lne=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=nx(KA,n),i=fj(KA,n),o=m3(n),a=f.useRef(null),l=lr(t,a,s.onTriggerChange),u=f.useRef(!1),d=f.useRef(!1),h=f.useCallback(()=>u.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),c.jsx(Xv,{asChild:!0,...o,children:c.jsx(jn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:Vt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:Vt(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:Vt(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Vt(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:Vt(e.onBlur,s.onClose),onClick:Vt(e.onClick,s.onClose)})})});Lne.displayName=KA;var mj="TooltipPortal",[jLe,ILe]=f3(mj,{forceMount:void 0}),Pne=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,i=nx(mj,t);return c.jsx(jLe,{scope:t,forceMount:n,children:c.jsx(Ko,{present:n||i.open,children:c.jsx(i1,{asChild:!0,container:s,children:r})})})};Pne.displayName=mj;var Ng="TooltipContent",One=f.forwardRef((e,t)=>{const n=ILe(Ng,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=nx(Ng,e.__scopeTooltip);return c.jsx(Ko,{present:r||o.open,children:o.disableHoverableContent?c.jsx(Bne,{side:s,...i,ref:t}):c.jsx(RLe,{side:s,...i,ref:t})})}),RLe=f.forwardRef((e,t)=>{const n=nx(Ng,e.__scopeTooltip),r=fj(Ng,e.__scopeTooltip),s=f.useRef(null),i=lr(t,s),[o,a]=f.useState(null),{trigger:l,onClose:u}=n,d=s.current,{onPointerInTransitChange:h}=r,m=f.useCallback(()=>{a(null),h(!1)},[h]),p=f.useCallback((g,b)=>{const x=g.currentTarget,v={x:g.clientX,y:g.clientY},y=OLe(v,x.getBoundingClientRect()),w=BLe(v,y),k=$Le(b.getBoundingClientRect()),T=FLe([...w,...k]);a(T),h(!0)},[h]);return f.useEffect(()=>()=>m(),[m]),f.useEffect(()=>{if(l&&d){const g=x=>p(x,d),b=x=>p(x,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[l,d,p,m]),f.useEffect(()=>{if(o){const g=b=>{const x=b.target,v={x:b.clientX,y:b.clientY},y=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),w=!zLe(v,o);y?m():w&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,o,u,m]),c.jsx(Bne,{...e,ref:i})}),[DLe,LLe]=f3(hv,{isInside:!1}),PLe=_Me("TooltipContent"),Bne=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=e,l=nx(Ng,n),u=m3(n),{onClose:d}=l;return f.useEffect(()=>(document.addEventListener(GA,d),()=>document.removeEventListener(GA,d)),[d]),f.useEffect(()=>{if(l.trigger){const h=m=>{m.target instanceof Node&&m.target.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),c.jsx(s1,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:c.jsxs(QS,{"data-state":l.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(PLe,{children:r}),c.jsx(DLe,{scope:n,isInside:!0,children:c.jsx(DMe,{id:l.contentId,role:"tooltip",children:s||r})})]})})});One.displayName=Ng;var $ne="TooltipArrow",zne=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=m3(n);return LLe($ne,n).isInside?null:c.jsx(JS,{...s,...r,ref:t})});zne.displayName=$ne;function OLe(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function BLe(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function $Le(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function zLe(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],l=t[o],u=a.x,d=a.y,h=l.x,m=l.y;d>r!=m>r&&n<(h-u)*(r-d)/(m-d)+u&&(s=!s)}return s}function FLe(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),qLe(t)}function qLe(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Fne=Rne,qne=Dne,Hne=Lne,Une=Pne,Vne=One,HLe=zne;const ULe=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},VLe=(e,t)=>({classGroupId:e,validator:t}),Wne=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),J_="-",mz=[],WLe="arbitrary..",GLe=e=>{const t=YLe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return KLe(o);const a=o.split(J_),l=a[0]===""&&a.length>1?1:0;return Gne(a,l,t)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],u=n[o];return l?u?ULe(u,l):l:u||mz}return n[o]||mz}}},Gne=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],i=n.nextPart.get(s);if(i){const u=Gne(e,t+1,i);if(u)return u}const o=n.validators;if(o===null)return;const a=t===0?e.join(J_):e.slice(t).join(J_),l=o.length;for(let u=0;u<l;u++){const d=o[u];if(d.validator(a))return d.classGroupId}},KLe=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?WLe+r:void 0})(),YLe=e=>{const{theme:t,classGroups:n}=e;return XLe(n,t)},XLe=(e,t)=>{const n=Wne();for(const r in e){const s=e[r];pj(s,n,r,t)}return n},pj=(e,t,n,r)=>{const s=e.length;for(let i=0;i<s;i++){const o=e[i];QLe(o,t,n,r)}},QLe=(e,t,n,r)=>{if(typeof e=="string"){JLe(e,t,n);return}if(typeof e=="function"){ZLe(e,t,n,r);return}ePe(e,t,n,r)},JLe=(e,t,n)=>{const r=e===""?t:Kne(t,e);r.classGroupId=n},ZLe=(e,t,n,r)=>{if(tPe(e)){pj(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(VLe(n,e))},ePe=(e,t,n,r)=>{const s=Object.entries(e),i=s.length;for(let o=0;o<i;o++){const[a,l]=s[o];pj(l,Kne(t,a),n,r)}},Kne=(e,t)=>{let n=e;const r=t.split(J_),s=r.length;for(let i=0;i<s;i++){const o=r[i];let a=n.nextPart.get(o);a||(a=Wne(),n.nextPart.set(o,a)),n=a}return n},tPe=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,nPe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(i,o)=>{n[i]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return s(i,o),o},set(i,o){i in n?n[i]=o:s(i,o)}}},YA="!",pz=":",rPe=[],gz=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),sPe=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const i=[];let o=0,a=0,l=0,u;const d=s.length;for(let b=0;b<d;b++){const x=s[b];if(o===0&&a===0){if(x===pz){i.push(s.slice(l,b)),l=b+1;continue}if(x==="/"){u=b;continue}}x==="["?o++:x==="]"?o--:x==="("?a++:x===")"&&a--}const h=i.length===0?s:s.slice(l);let m=h,p=!1;h.endsWith(YA)?(m=h.slice(0,-1),p=!0):h.startsWith(YA)&&(m=h.slice(1),p=!0);const g=u&&u>l?u-l:void 0;return gz(i,p,m,g)};if(t){const s=t+pz,i=r;r=o=>o.startsWith(s)?i(o.slice(s.length)):gz(rPe,!1,o,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},iPe=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const o=n[i],a=o[0]==="[",l=t.has(o);a||l?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},oPe=e=>({cache:nPe(e.cacheSize),parseClassName:sPe(e),sortModifiers:iPe(e),postfixLookupClassGroupIds:aPe(e),...GLe(e)}),aPe=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},lPe=/\s+/,cPe=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i,postfixLookupClassGroupIds:o}=t,a=[],l=e.trim().split(lPe);let u="";for(let d=l.length-1;d>=0;d-=1){const h=l[d],{isExternal:m,modifiers:p,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:x}=n(h);if(m){u=h+(u.length>0?" "+u:u);continue}let v=!!x,y;if(v){const C=b.substring(0,x);y=r(C);const _=y&&o[y]?r(b):void 0;_&&_!==y&&(y=_,v=!1)}else y=r(b);if(!y){if(!v){u=h+(u.length>0?" "+u:u);continue}if(y=r(b),!y){u=h+(u.length>0?" "+u:u);continue}v=!1}const w=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=g?w+YA:w,T=k+y;if(a.indexOf(T)>-1)continue;a.push(T);const S=s(y,v);for(let C=0;C<S.length;++C){const _=S[C];a.push(k+_)}u=h+(u.length>0?" "+u:u)}return u},uPe=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Yne(n))&&(s&&(s+=" "),s+=r);return s},Yne=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Yne(e[r]))&&(n&&(n+=" "),n+=t);return n},dPe=(e,...t)=>{let n,r,s,i;const o=l=>{const u=t.reduce((d,h)=>h(d),e());return n=oPe(u),r=n.cache.get,s=n.cache.set,i=a,a(l)},a=l=>{const u=r(l);if(u)return u;const d=cPe(l,n);return s(l,d),d};return i=o,(...l)=>i(uPe(...l))},hPe=[],ki=e=>{const t=n=>n[e]||hPe;return t.isThemeGetter=!0,t},Xne=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Qne=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fPe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,mPe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pPe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gPe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bPe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yPe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qd=e=>fPe.test(e),fr=e=>!!e&&!Number.isNaN(Number(e)),wc=e=>!!e&&Number.isInteger(Number(e)),U6=e=>e.endsWith("%")&&fr(e.slice(0,-1)),Tu=e=>mPe.test(e),Jne=()=>!0,vPe=e=>pPe.test(e)&&!gPe.test(e),gj=()=>!1,xPe=e=>bPe.test(e),wPe=e=>yPe.test(e),kPe=e=>!fn(e)&&!pn(e),_Pe=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),SPe=e=>Mf(e,tre,gj),fn=e=>Xne.test(e),Jf=e=>Mf(e,nre,vPe),bz=e=>Mf(e,IPe,fr),CPe=e=>Mf(e,sre,Jne),TPe=e=>Mf(e,rre,gj),yz=e=>Mf(e,Zne,gj),APe=e=>Mf(e,ere,wPe),Ww=e=>Mf(e,ire,xPe),pn=e=>Qne.test(e),nb=e=>xp(e,nre),EPe=e=>xp(e,rre),vz=e=>xp(e,Zne),MPe=e=>xp(e,tre),NPe=e=>xp(e,ere),Gw=e=>xp(e,ire,!0),jPe=e=>xp(e,sre,!0),Mf=(e,t,n)=>{const r=Xne.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},xp=(e,t,n=!1)=>{const r=Qne.exec(e);return r?r[1]?t(r[1]):n:!1},Zne=e=>e==="position"||e==="percentage",ere=e=>e==="image"||e==="url",tre=e=>e==="length"||e==="size"||e==="bg-size",nre=e=>e==="length",IPe=e=>e==="number",rre=e=>e==="family-name",sre=e=>e==="number"||e==="weight",ire=e=>e==="shadow",RPe=()=>{const e=ki("color"),t=ki("font"),n=ki("text"),r=ki("font-weight"),s=ki("tracking"),i=ki("leading"),o=ki("breakpoint"),a=ki("container"),l=ki("spacing"),u=ki("radius"),d=ki("shadow"),h=ki("inset-shadow"),m=ki("text-shadow"),p=ki("drop-shadow"),g=ki("blur"),b=ki("perspective"),x=ki("aspect"),v=ki("ease"),y=ki("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...k(),pn,fn],S=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],_=()=>[pn,fn,l],A=()=>[Qd,"full","auto",..._()],M=()=>[wc,"none","subgrid",pn,fn],L=()=>["auto",{span:["full",wc,pn,fn]},wc,pn,fn],N=()=>[wc,"auto",pn,fn],O=()=>["auto","min","max","fr",pn,fn],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",..._()],K=()=>[Qd,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],F=()=>[Qd,"screen","full","dvw","lvw","svw","min","max","fit",..._()],H=()=>[Qd,"screen","full","lh","dvh","lvh","svh","min","max","fit",..._()],D=()=>[e,pn,fn],Q=()=>[...k(),vz,yz,{position:[pn,fn]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",MPe,SPe,{size:[pn,fn]}],ie=()=>[U6,nb,Jf],oe=()=>["","none","full",u,pn,fn],J=()=>["",fr,nb,Jf],V=()=>["solid","dashed","dotted","double"],se=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>[fr,U6,vz,yz],X=()=>["","none",g,pn,fn],te=()=>["none",fr,pn,fn],ae=()=>["none",fr,pn,fn],xe=()=>[fr,pn,fn],Ae=()=>[Qd,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tu],breakpoint:[Tu],color:[Jne],container:[Tu],"drop-shadow":[Tu],ease:["in","out","in-out"],font:[kPe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tu],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tu],shadow:[Tu],spacing:["px",fr],text:[Tu],"text-shadow":[Tu],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Qd,fn,pn,x]}],container:["container"],"container-type":[{"@container":["","normal","size",pn,fn]}],"container-named":[_Pe],columns:[{columns:[fr,fn,pn,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[wc,"auto",pn,fn]}],basis:[{basis:[Qd,"full","auto",a,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[fr,Qd,"auto","initial","none",fn]}],grow:[{grow:["",fr,pn,fn]}],shrink:[{shrink:["",fr,pn,fn]}],order:[{order:[wc,"first","last","none",pn,fn]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pbs:[{pbs:_()}],pbe:[{pbe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mbs:[{mbs:P()}],mbe:[{mbe:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...H()]}],"min-block-size":[{"min-block":["auto",...H()]}],"max-block-size":[{"max-block":["none",...H()]}],w:[{w:[a,"screen",...K()]}],"min-w":[{"min-w":[a,"screen","none",...K()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,nb,Jf]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,jPe,CPe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",U6,fn]}],"font-family":[{font:[EPe,TPe,t]}],"font-features":[{"font-features":[fn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,pn,fn]}],"line-clamp":[{"line-clamp":[fr,"none",pn,bz]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",pn,fn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",pn,fn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[fr,"from-font","auto",pn,Jf]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[fr,"auto",pn,fn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"tab-size":[{tab:[wc,pn,fn]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pn,fn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pn,fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Q()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},wc,pn,fn],radial:["",pn,fn],conic:[wc,pn,fn]},NPe,APe]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[fr,pn,fn]}],"outline-w":[{outline:["",fr,nb,Jf]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,Gw,Ww]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",h,Gw,Ww]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[fr,Jf]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",m,Gw,Ww]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[fr,pn,fn]}],"mix-blend":[{"mix-blend":[...se(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":se()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[fr]}],"mask-image-linear-from-pos":[{"mask-linear-from":Z()}],"mask-image-linear-to-pos":[{"mask-linear-to":Z()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":Z()}],"mask-image-t-to-pos":[{"mask-t-to":Z()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":Z()}],"mask-image-r-to-pos":[{"mask-r-to":Z()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":Z()}],"mask-image-b-to-pos":[{"mask-b-to":Z()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":Z()}],"mask-image-l-to-pos":[{"mask-l-to":Z()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":Z()}],"mask-image-x-to-pos":[{"mask-x-to":Z()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":Z()}],"mask-image-y-to-pos":[{"mask-y-to":Z()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[pn,fn]}],"mask-image-radial-from-pos":[{"mask-radial-from":Z()}],"mask-image-radial-to-pos":[{"mask-radial-to":Z()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[fr]}],"mask-image-conic-from-pos":[{"mask-conic-from":Z()}],"mask-image-conic-to-pos":[{"mask-conic-to":Z()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Q()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",pn,fn]}],filter:[{filter:["","none",pn,fn]}],blur:[{blur:X()}],brightness:[{brightness:[fr,pn,fn]}],contrast:[{contrast:[fr,pn,fn]}],"drop-shadow":[{"drop-shadow":["","none",p,Gw,Ww]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",fr,pn,fn]}],"hue-rotate":[{"hue-rotate":[fr,pn,fn]}],invert:[{invert:["",fr,pn,fn]}],saturate:[{saturate:[fr,pn,fn]}],sepia:[{sepia:["",fr,pn,fn]}],"backdrop-filter":[{"backdrop-filter":["","none",pn,fn]}],"backdrop-blur":[{"backdrop-blur":X()}],"backdrop-brightness":[{"backdrop-brightness":[fr,pn,fn]}],"backdrop-contrast":[{"backdrop-contrast":[fr,pn,fn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",fr,pn,fn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[fr,pn,fn]}],"backdrop-invert":[{"backdrop-invert":["",fr,pn,fn]}],"backdrop-opacity":[{"backdrop-opacity":[fr,pn,fn]}],"backdrop-saturate":[{"backdrop-saturate":[fr,pn,fn]}],"backdrop-sepia":[{"backdrop-sepia":["",fr,pn,fn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",pn,fn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[fr,"initial",pn,fn]}],ease:[{ease:["linear","initial",v,pn,fn]}],delay:[{delay:[fr,pn,fn]}],animate:[{animate:["none",y,pn,fn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,pn,fn]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[pn,fn,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ae()}],"translate-x":[{"translate-x":Ae()}],"translate-y":[{"translate-y":Ae()}],"translate-z":[{"translate-z":Ae()}],"translate-none":["translate-none"],zoom:[{zoom:[wc,pn,fn]}],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pn,fn]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":D()}],"scrollbar-track-color":[{"scrollbar-track":D()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mbs":[{"scroll-mbs":_()}],"scroll-mbe":[{"scroll-mbe":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pbs":[{"scroll-pbs":_()}],"scroll-pbe":[{"scroll-pbe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pn,fn]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[fr,nb,Jf,bz]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},DPe=dPe(RPe);function tn(...e){return DPe(hZ(e))}const LPe=bp("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}}),Fr=f.forwardRef(function({className:t,variant:n="default",size:r="default",asChild:s=!1,...i},o){const a=s?MN:"button";return c.jsx(a,{ref:o,"data-slot":"button","data-variant":n,"data-size":r,className:tn(LPe({variant:n,size:r,className:t})),...i})});function Z_({...e}){return c.jsx(kDe,{"data-slot":"popover",...e})}const XA=f.forwardRef(function(t,n){return c.jsx(SDe,{ref:n,"data-slot":"popover-trigger",...t})}),e4=f.forwardRef(function({className:t,align:n="center",sideOffset:r=4,...s},i){const o=yd();return c.jsx(CDe,{container:o??void 0,children:c.jsx(TDe,{ref:i,"data-slot":"popover-content",align:n,sideOffset:r,className:tn("z-[var(--web-shell-popover-z-index,1000)] flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...s})})}),xz=f.forwardRef(function(t,n){return c.jsx(_De,{ref:n,"data-slot":"popover-anchor",...t})}),PPe="_message_1nmy0_1",OPe="_customFooter_1nmy0_7",BPe="_messageFooter_1nmy0_11",$Pe="_copyButton_1nmy0_27",zPe="_footerTime_1nmy0_53",FPe="_thinking_1nmy0_65",qPe="_thinkingBody_1nmy0_77",HPe="_thinkingHeader_1nmy0_108",UPe="_thinkingSummary_1nmy0_120",VPe="_translateButton_1nmy0_136",WPe="_thinkingHeaderExpanded_1nmy0_147",GPe="_translationPopover_1nmy0_154",KPe="_translationTitle_1nmy0_159",YPe="_translationContent_1nmy0_164",XPe="_translationPending_1nmy0_171",QPe="_translationError_1nmy0_175",JPe="_translationFooter_1nmy0_179",ZPe="_translationUsage_1nmy0_189",eOe="_translationActions_1nmy0_196",tOe="_thinkingSummaryTextActive_1nmy0_211",nOe="_thinkingSummaryIcon_1nmy0_218",rOe="_thinkingSummaryText_1nmy0_211",sOe="_thinkingChevronRight_1nmy0_275",iOe="_thinkingChevronDown_1nmy0_276",oOe="_thinkingExpandedWrap_1nmy0_339",aOe="_thinkingExpandedClip_1nmy0_343",lOe="_thinkingExpandedCollapsed_1nmy0_351",cOe="_thinkingExpandedInner_1nmy0_355",uOe="_content_1nmy0_403",dOe="_contentBody_1nmy0_408",jr={message:PPe,customFooter:OPe,messageFooter:BPe,copyButton:$Pe,footerTime:zPe,thinking:FPe,thinkingBody:qPe,thinkingHeader:HPe,thinkingSummary:UPe,translateButton:VPe,thinkingHeaderExpanded:WPe,translationPopover:GPe,translationTitle:KPe,translationContent:YPe,translationPending:XPe,translationError:QPe,translationFooter:JPe,translationUsage:ZPe,translationActions:eOe,thinkingSummaryTextActive:tOe,thinkingSummaryIcon:nOe,thinkingSummaryText:rOe,thinkingChevronRight:sOe,thinkingChevronDown:iOe,thinkingExpandedWrap:oOe,thinkingExpandedClip:aOe,thinkingExpandedCollapsed:lOe,thinkingExpandedInner:cOe,content:uOe,contentBody:dOe},hOe=f.memo(function({content:t,isStreaming:n,timestamp:r,onBranchSession:s,showFooterActions:i=!1,showBranchAction:o=!1,isLocateFlashing:a=!1,customFooterInfo:l}){const{t:u}=gt(),{renderAssistantTurnFooter:d}=ou(),[h,m]=f.useState(!1),p=!!t&&!n&&i,g=f.useMemo(()=>l?d==null?void 0:d(l):void 0,[l,d]),b=f.useCallback(()=>{var v;const x=(v=navigator.clipboard)==null?void 0:v.writeText(t);x&&x.then(()=>{m(!0),window.setTimeout(()=>m(!1),2e3)}).catch(()=>{})},[t]);return c.jsxs("div",{className:jr.message,children:[t&&c.jsx("div",{className:`${jr.content}${a?` ${lf.flash}`:""}`,children:c.jsx("div",{className:jr.contentBody,children:c.jsx(Wm,{content:t,source:"assistant",isStreaming:n})})}),g&&c.jsx("div",{className:jr.customFooter,children:g}),p&&c.jsxs("div",{className:jr.messageFooter,children:[c.jsx("button",{type:"button",className:jr.copyButton,title:u("assistant.copy"),"aria-label":u("assistant.copy"),onClick:b,children:h?c.jsx(mOe,{}):c.jsx(fOe,{})}),o&&s&&c.jsx("button",{type:"button",className:jr.copyButton,title:u("assistant.branch"),"aria-label":u("assistant.branch"),onClick:s,children:c.jsx(pOe,{})}),r!==void 0&&c.jsx("span",{className:jr.footerTime,"aria-hidden":"true",children:hg(r)})]})]})});function fOe(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.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"}),c.jsx("rect",{x:"3",y:"5.2",width:"7.8",height:"7.8",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]})}function mOe(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"m3.5 8.3 3 3L12.8 5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function pOe(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.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"}),c.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"}),c.jsx("circle",{cx:"5",cy:"3.5",r:"1.5",fill:"currentColor"}),c.jsx("circle",{cx:"11",cy:"4",r:"1.5",fill:"currentColor"}),c.jsx("circle",{cx:"11",cy:"12.5",r:"1.5",fill:"currentColor"})]})}const fm=new Map,gOe=200;function wz(e,t){if(fm.delete(e),fm.set(e,t),fm.size<=gOe)return;const n=fm.keys().next().value;n!==void 0&&fm.delete(n)}const bOe=f.memo(function({messageId:t,content:n,isStreaming:r,timestamp:s,isLocateFlashing:i=!1,generateContent:o}){const{language:a,t:l}=gt(),u=f.useContext(ip),[d,h]=f.useState(!1),m=r===!0,p=f.useRef(s??Date.now()),g=f.useRef(m),[b,x]=f.useState(()=>Date.now()),[v,y]=f.useState(null),[w,k]=f.useState(!1),[T,S]=f.useState(),[C,_]=f.useState(!1),[A,M]=f.useState(!1),[L,N]=f.useState(!1),O=f.useRef(void 0);f.useEffect(()=>{if(!n||!m)return;x(Date.now());const Q=setInterval(()=>x(Date.now()),1e3);return()=>clearInterval(Q)},[n,m]),f.useEffect(()=>{if(n){if(m){g.current=!0,y(null);return}g.current&&v===null&&y(Date.now())}},[n,v,m]);const B=m||v!==null?(m?b:v)-p.current:void 0,$=yOe({isStreaming:r,durationMs:B}),P=B!==void 0?vOe(B):"",K=f.useCallback(()=>{h(Q=>!Q)},[]);f.useEffect(()=>()=>{var Q;(Q=O.current)==null||Q.abort()},[]);const F=f.useCallback(async(Q=!1)=>{var V;if(r||!o||C&&!Q)return;const U=`${a}:${t}:${n}`,j=fm.get(U);if(j&&!Q){wz(U,j),S(j);return}Q&&fm.delete(U),(V=O.current)==null||V.abort();const ie=new AbortController;O.current=ie,S({text:""}),M(!1),N(!1),_(!0);let oe="",J=!1;try{const Z=`Translate the following model reasoning into ${a==="zh-CN"?"Simplified Chinese":"English"}. Preserve its meaning and Markdown formatting. Output only the translation.

${n}`;for await(const X of o(Z,{signal:ie.signal})){if(O.current!==ie)return;if(X.type==="thinking")M(!0);else if(X.type==="delta")M(!1),oe+=X.text,S({text:oe});else if(X.type==="done"){if(!oe.trim())throw new Error("Translation was empty");J=!0;const te={text:oe,inputTokens:X.inputTokens,outputTokens:X.outputTokens};wz(U,te),S(te)}else if(X.type==="error")throw new Error(X.message)}if(!J)throw new Error("Translation stream ended early")}catch{ie.signal.aborted||N(!0)}finally{O.current===ie&&(O.current=void 0,M(!1),_(!1))}},[n,o,r,a,t,C]),H=f.useCallback(Q=>{k(Q),Q&&F()},[F]),D=f.useCallback(()=>{const Q=O.current;O.current=void 0,Q==null||Q.abort(),M(!1),_(!1),k(!1)},[]);return c.jsx("div",{className:`${jr.message}${i?` ${lf.flash}`:""}`,children:n&&!u&&c.jsx("div",{className:jr.thinking,children:c.jsxs("div",{className:jr.thinkingBody,children:[c.jsxs("div",{className:`${jr.thinkingHeader}${d?` ${jr.thinkingHeaderExpanded}`:""}`,onClick:Q=>{Q.currentTarget.contains(Q.target)&&K()},children:[c.jsxs("button",{type:"button",className:jr.thinkingSummary,"aria-expanded":d,title:l(d?"thinking.collapse":"thinking.expand"),children:[c.jsx("span",{className:jr.thinkingSummaryIcon,"aria-hidden":"true",children:c.jsx(xOe,{})}),c.jsx("span",{className:m?`${jr.thinkingSummaryText} ${jr.thinkingSummaryTextActive}`:jr.thinkingSummaryText,children:l($,P?{duration:P}:{})})]}),a==="zh-CN"&&!m&&o&&c.jsxs(Z_,{open:w,onOpenChange:H,children:[c.jsx(XA,{asChild:!0,children:c.jsx(Fr,{type:"button",variant:"secondary",size:"xs",className:jr.translateButton,title:l("thinking.translate"),onClick:Q=>Q.stopPropagation(),children:l("thinking.translate")})}),c.jsxs(e4,{align:"start",className:jr.translationPopover,children:[c.jsx("div",{className:jr.translationTitle,children:l("thinking.translation")}),L?c.jsx("div",{className:jr.translationError,children:l("thinking.translationFailed")}):T!=null&&T.text?c.jsx("div",{className:`${jr.thinkingExpandedWrap} ${jr.translationContent}`,children:c.jsx(Wm,{content:T.text,source:"thinking",isStreaming:C})}):c.jsx("div",{className:jr.translationPending,children:l(A?"thinking.translationThinking":"thinking.translating")}),c.jsxs("div",{className:jr.translationFooter,children:[c.jsx("div",{className:jr.translationUsage,children:!C&&(T==null?void 0:T.text)&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:l("thinking.inputTokens",{count:T.inputTokens??"--"})}),c.jsx("span",{children:l("thinking.outputTokens",{count:T.outputTokens??"--"})})]})}),c.jsxs("div",{className:jr.translationActions,children:[c.jsx(Fr,{type:"button",variant:"outline",size:"xs",onClick:()=>void F(!0),children:l("thinking.retranslate")}),c.jsx(Fr,{type:"button",variant:"outline",size:"xs",disabled:!C&&!(T!=null&&T.text)&&!L,onClick:D,children:l(C?"thinking.cancelTranslation":"thinking.closeTranslation")})]})]})]})]}),c.jsx("span",{className:d?jr.thinkingChevronDown:jr.thinkingChevronRight,"aria-hidden":"true"})]}),c.jsx("div",{className:d?jr.thinkingExpandedClip:`${jr.thinkingExpandedClip} ${jr.thinkingExpandedCollapsed}`,children:c.jsx("div",{className:jr.thinkingExpandedInner,children:c.jsx("div",{className:jr.thinkingExpandedWrap,children:c.jsx(Wm,{content:n,source:"thinking",isStreaming:r})})})})]})})})});function yOe({isStreaming:e,durationMs:t}){return e?"thinking.running":t!==void 0&&t<1e3?"thinking.doneBriefly":"thinking.done"}function vOe(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 xOe(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("path",{d:"M7.2 15.2h4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),c.jsx("path",{d:"M6.5 13.1h5.4",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"}),c.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"}),c.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 wOe="_panel_8ng9u_1",kOe="_title_8ng9u_16",_Oe="_metaLine_8ng9u_22",SOe="_progress_8ng9u_32",COe="_spacer_8ng9u_38",TOe="_row_8ng9u_42",AOe="_detailRow_8ng9u_43",EOe="_subDetailRow_8ng9u_44",MOe="_symbol_8ng9u_65",NOe="_label_8ng9u_69",jOe="_value_8ng9u_73",IOe="_detailName_8ng9u_80",ROe="_sectionTitle_8ng9u_88",DOe="_detailSection_8ng9u_94",LOe="_skillBlock_8ng9u_100",POe="_hint_8ng9u_105",OOe="_detailCommand_8ng9u_111",BOe="_bodyLoaded_8ng9u_132",$Oe="_accent_8ng9u_137",zOe="_secondary_8ng9u_141",FOe="_warning_8ng9u_145",qOe="_error_8ng9u_149",HOe="_success_8ng9u_153",Bn={panel:wOe,title:kOe,metaLine:_Oe,progress:SOe,spacer:COe,row:TOe,detailRow:AOe,subDetailRow:EOe,symbol:MOe,label:NOe,value:jOe,detailName:IOe,sectionTitle:ROe,detailSection:DOe,skillBlock:LOe,hint:POe,detailCommand:OOe,bodyLoaded:BOe,accent:$Oe,secondary:zOe,warning:FOe,error:qOe,success:HOe},QA="web-shell:context-usage:v1:",nh="█",ore="▒",are="░",lre=30;function UOe(e){return`${QA}${JSON.stringify(e)}`}function VOe(e){if(!e.startsWith(QA))return null;try{const t=JSON.parse(e.slice(QA.length));return!(t!=null&&t.usage)||typeof t.usage.totalTokens!="number"?null:t}catch{return null}}function cre(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function jg(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function WOe(e,t){if(t<=0)return"0.0";const n=e/t*100;return n>100?">100":n.toFixed(1)}function GOe(e){return[...e].sort((t,n)=>n.tokens-t.tokens)}function KOe({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?Bn.error:e>60?Bn.warning:Bn.accent;return c.jsxs("div",{className:Bn.progress,"aria-hidden":"true",children:[c.jsx("span",{className:o,children:nh.repeat(Math.max(0,r))}),c.jsx("span",{className:Bn.secondary,children:are.repeat(Math.max(0,i))}),c.jsx("span",{className:Bn.warning,children:ore.repeat(Math.max(0,s))})]})}function Au({symbol:e,label:t,tokens:n,tokenLabel:r,contextWindowSize:s,symbolClassName:i=Bn.secondary,isOverLimit:o}){return c.jsxs("div",{className:Bn.row,children:[c.jsx("span",{className:`${Bn.symbol} ${i}`,children:e}),c.jsx("span",{className:Bn.label,children:t}),c.jsxs("span",{className:o?Bn.error:Bn.value,children:[jg(n)," ",r," (",WOe(n,s),"%)"]})]})}const V6="/context detail";function YOe({hint:e,onShowDetail:t}){const n=t?e.indexOf(V6):-1;return n<0?c.jsx("div",{className:Bn.hint,children:e}):c.jsxs("div",{className:Bn.hint,children:[e.slice(0,n),c.jsx("button",{type:"button",className:Bn.detailCommand,onClick:t,children:V6}),e.slice(n+V6.length)]})}function XOe({name:e,tokens:t,tokenLabel:n}){return c.jsxs("div",{className:Bn.detailRow,children:[c.jsxs("span",{className:Bn.secondary,children:["└"," "]}),c.jsx("span",{className:Bn.detailName,title:e,children:cre(e,lre)}),c.jsxs("span",{className:Bn.value,children:[jg(t)," ",n]})]})}function W6({title:e,items:t,getName:n,tokenLabel:r}){const s=GOe(t);return s.length===0?null:c.jsxs("section",{className:Bn.detailSection,children:[c.jsx("div",{className:Bn.sectionTitle,children:e}),s.map(i=>c.jsx(XOe,{name:n(i),tokens:i.tokens,tokenLabel:r},n(i)))]})}function QOe({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:c.jsxs("section",{className:Bn.detailSection,children:[c.jsx("div",{className:Bn.sectionTitle,children:t.skills}),n.map(r=>c.jsxs("div",{className:Bn.skillBlock,children:[c.jsxs("div",{className:Bn.detailRow,children:[c.jsxs("span",{className:Bn.secondary,children:["└"," "]}),c.jsxs("span",{className:Bn.detailName,title:r.name,children:[cre(r.name,lre),r.loaded&&c.jsxs("span",{className:Bn.success,children:[" ",t.active]})]}),c.jsxs("span",{className:Bn.value,children:[jg(r.tokens)," ",t.tokens]})]}),r.loaded&&r.bodyTokens!=null&&r.bodyTokens>0&&c.jsxs("div",{className:Bn.subDetailRow,children:[c.jsxs("span",{className:Bn.secondary,children:["  └"," "]}),c.jsx("span",{className:Bn.bodyLoaded,children:t.bodyLoaded}),c.jsxs("span",{className:Bn.success,children:["+",jg(r.bodyTokens)," ",t.tokens]})]})]},r.name))]})}function JOe({status:e,onShowDetail:t}){const{t:n}=gt(),{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 c.jsxs("div",{className:Bn.panel,children:[c.jsx("div",{className:Bn.title,children:n("contextUsage.title")}),r.isEstimated?c.jsx(c.Fragment,{children:c.jsxs("div",{className:Bn.metaLine,children:[c.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),c.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",jg(i)," ",n("contextUsage.tokens")]})]})}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Bn.metaLine,children:[c.jsxs("span",{children:[n("contextUsage.model"),": ",r.modelName]}),c.jsxs("span",{children:[n("contextUsage.contextWindow"),":"," ",jg(i)," ",n("contextUsage.tokens")]})]}),a&&c.jsx("div",{className:Bn.error,children:n("contextUsage.overLimit")})]}),c.jsx(KOe,{usedPercentage:Math.min(o,100),bufferPercentage:l}),c.jsx("div",{className:Bn.spacer}),c.jsx(Au,{symbol:nh,label:n("contextUsage.used"),tokens:r.totalTokens,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:a?Bn.error:Bn.accent,isOverLimit:a}),c.jsx(Au,{symbol:are,label:n("contextUsage.free"),tokens:s.freeSpace,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i}),c.jsx(Au,{symbol:ore,label:n("contextUsage.autocompactBuffer"),tokens:s.autocompactBuffer,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bn.warning}),c.jsx("div",{className:Bn.spacer}),c.jsx("div",{className:Bn.sectionTitle,children:n("contextUsage.usageByCategory")}),c.jsx(Au,{symbol:nh,label:n("contextUsage.systemPrompt"),tokens:s.systemPrompt,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bn.accent}),c.jsx(Au,{symbol:nh,label:n("contextUsage.builtinTools"),tokens:s.builtinTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bn.accent}),s.mcpTools>0&&c.jsx(Au,{symbol:nh,label:n("contextUsage.mcpTools"),tokens:s.mcpTools,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bn.accent}),c.jsx(Au,{symbol:nh,label:n("contextUsage.memoryFiles"),tokens:s.memoryFiles,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bn.accent}),c.jsx(Au,{symbol:nh,label:n("contextUsage.skills"),tokens:s.skills,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bn.accent}),!r.isEstimated&&c.jsx(Au,{symbol:nh,label:n("contextUsage.messages"),tokens:s.messages,tokenLabel:n("contextUsage.tokens"),contextWindowSize:i,symbolClassName:Bn.accent}),r.showDetails?c.jsxs(c.Fragment,{children:[c.jsx(W6,{title:n("contextUsage.builtinTools"),items:r.builtinTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),c.jsx(W6,{title:n("contextUsage.mcpTools"),items:r.mcpTools,getName:u=>"name"in u?u.name:u.path,tokenLabel:n("contextUsage.tokens")}),c.jsx(W6,{title:n("contextUsage.memoryFiles"),items:r.memoryFiles,getName:u=>"path"in u?u.path:u.name,tokenLabel:n("contextUsage.tokens")}),c.jsx(QOe,{skills:r.skills,labels:{active:n("contextUsage.active"),bodyLoaded:n("contextUsage.bodyLoaded"),skills:n("contextUsage.skills"),tokens:n("contextUsage.tokens")}})]}):c.jsx(YOe,{hint:n("contextUsage.detailHint"),onShowDetail:t})]})}const ZOe={edit:"Edit",write_file:"WriteFile",read_file:"ReadFile",grep:"Grep",grep_search:"Grep",glob:"Glob",run_shell_command:"Shell",todo_write:"TodoList",save_memory:"SaveMemory",agent:"Agent",skill:"Skill",exit_plan_mode:"ExitPlanMode",web_fetch:"WebFetch",webfetch:"WebFetch",fetch:"WebFetch",list_directory:"ListFiles",lsp:"Lsp",ask_user_question:"AskUserQuestion",cron_create:"CronCreate",cron_list:"CronList",cron_delete:"CronDelete",loop_wakeup:"LoopWakeup",create_sub_session:"CreateSubSession",task_stop:"TaskStop",send_message:"SendMessage",structured_output:"StructuredOutput",monitor:"Monitor",notebook_edit:"NotebookEdit",tool_search:"ToolSearch",read_mcp_resource:"ReadMcpResource",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",team_plan_approval:"TeamPlanApproval",workflow:"Workflow",artifact:"Artifact",record_artifact:"RecordArtifact",web_search:"WebSearch",bash:"Shell",shell:"Shell Command",read:"ReadFile",write:"WriteFile",search:"Grep"},eBe=/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g;function tBe(e){return e.replace(eBe,t=>{switch(t){case"\b":return"\\b";case"\f":return"\\f";case"\r":return"\\r";default:return`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`}})}function ure(e){if(!e.trim())return"Tool";const t=ZOe[e];if(t)return t;const n=e.toLowerCase();return n==="web_fetch"||n==="webfetch"||n==="fetch"?"WebFetch":e}function hu(e,t){const n=ure(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 lc(e){const t=e.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function Mi(e,t){return e.length<=t?e:e.slice(0,t)+"..."}const Q0=2e3;function bj(e,t){if(g3(e.toolName)){const s=p3(e.args,"skill");if(s)return Mi(s,Q0)}const n=sBe(e,t);if(n)return Mi(n,Q0);const r=hre(e,t);return r?Mi(r,Q0):""}function dre(e,t){if(!Ga(e.toolName))return bj(e,t);const n=p3(e.args,"description");if(n)return Mi(n,Q0);const r=hre(e,t,{includeTimeout:!1});return r?Mi(r,Q0):""}function nBe(e){return Ga(e.toolName)?p3(e.args,"description"):""}function Jc(e){var t;if(!e.content)return ZA(e.rawOutput);for(const n of e.content)if(n.type==="content"&&((t=n.content)!=null&&t.text))return n.content.text;return ZA(e.rawOutput)}function rBe(e){if(e.status!=="completed"&&e.status!=="failed")return"";const t=e.toolName.toLowerCase();if(t==="grep_search"||t==="grep"||t==="search"){const o=kz((ZA(e.rawOutput)??"").trim());if(o)return o}const n=Jc(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(Ga(t)){if(s>3)return`${s} lines of output`;const o=r[0]||"";return Mi(o,80)}if(t==="grep_search"||t==="grep"||t==="search"){const o=kz(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 Mi(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(lc(t))return"";const i=r[0]||"";return Mi(i,80)}function sBe(e,t){if(!e.title)return null;const n=ure(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 _z(o.replace(/^:\s*|\s+/,""),t)}return _z(r,t)}function kz(e){return e==="No matches found"||/^Found \d+ match(?:es)?(?: \(truncated\))?$/.test(e)?e:null}function hre(e,t,n={}){const r=e.args||{},s=e.toolName.toLowerCase(),i=n.includeTimeout??!0;if(r.command){let o=String(r.command);r.directory&&s!=="shell"&&(o+=` [in ${T0(String(r.directory),t)}]`),r.is_background?o+=" [background]":i&&r.timeout&&(o+=` [timeout: ${String(r.timeout)}ms]`);const a=p3(r,"description");return a&&(o+=` (${a})`),Mi(o,Q0)}if(s==="grep_search"||s==="grep"||s==="search"){const o=r.pattern??r.query;if(o){let a=`'${String(o)}'`;return r.path?a+=` in path '${String(r.path)}'`:(s==="grep_search"||s==="grep")&&(a+=" in path './'"),r.glob&&(a+=` (filter: '${String(r.glob)}')`),a}}if(s==="glob"&&r.pattern){let o=`'${String(r.pattern)}'`;return r.path&&(o+=` in path '${String(r.path)}'`),o}if(r.file_path)return r.description?String(r.description):T0(String(r.file_path),t);if(r.url){const o=String(r.url),a=typeof r.prompt=="string"?r.prompt:void 0,l=a?`${o} — "${Mi(a,40)}"`:o;return Mi(l,80)}if(r.path)return T0(String(r.path),t);if(r.query)return Mi(String(r.query),60);if(s==="list_directory"||s==="listfiles"){const o=r.path||r.directory||"";return T0(String(o),t)}return r.description?String(r.description):""}function p3(e,t){const n=e==null?void 0:e[t];return typeof n=="string"?n.trim().replace(/\n/g," "):""}function Ga(e){const t=e.toLowerCase();return t==="run_shell_command"||t==="bash"||t==="shell"||t==="execute_command"}function g3(e){return e.toLowerCase()==="skill"}function nc(e,t){var n;return e.callId===t?!0:((n=e.subTools)==null?void 0:n.some(r=>nc(r,t)))??!1}function _z(e,t){const n=e.trim();return fre(JA(n))?T0(n,t):n.replace(/(?:[A-Za-z]:)?\/[^\s'")]+/g,r=>T0(r,t))}function T0(e,t){const n=JA(e),r=t?JA(t).replace(/\/+$/,""):"";return r&&(n===r||n.startsWith(`${r}/`))?n.slice(r.length+1)||".":fre(n)?iBe(n):n}function JA(e){return e.replace(/\\/g,"/")}function fre(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function iBe(e){return e.replace(/\/+$/,"").split("/").pop()||e}function rx(e){if(!e||typeof e!="object")return;const t=e;return t.type==="task_execution"?t:void 0}function yj(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 fv(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=yj(e);return n==="cancelled"||n==="canceled"||r.toLowerCase().includes("cancel")?"failed":e.status}function vj(e){return e>=1e6?`${(e/1e6).toFixed(1)}M tokens`:e>=1e3?(e/1e3).toFixed(1).replace(/\.0$/,"")+"k tokens":`${e} tokens`}const oBe="general-purpose";function xj(e){var r;const t=rx(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":oBe}function wj(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=rx(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 aBe(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=hu(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 Mi(s,50)}function ZA(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 lBe="_panel_qchwm_1",cBe="_title_qchwm_17",uBe="_sectionTitle_qchwm_23",dBe="_spacer_qchwm_29",hBe="_pivotRow_qchwm_35",fBe="_metricCell_qchwm_41",mBe="_metricCellSection_qchwm_48",pBe="_metricCellSub_qchwm_56",gBe="_modelCell_qchwm_64",bBe="_modelCellHeader_qchwm_71",yBe="_divider_qchwm_79",vBe="_kvRow_qchwm_87",xBe="_kvSubRow_qchwm_94",wBe="_kvLabel_qchwm_102",kBe="_kvValue_qchwm_106",_Be="_tableRow_qchwm_115",SBe="_modelUsageRow_qchwm_121",CBe="_tableNameCol_qchwm_129",TBe="_tableToolCol_qchwm_137",ABe="_tableNumCol_qchwm_145",EBe="_tableValueCol_qchwm_153",MBe="_success_qchwm_162",NBe="_error_qchwm_166",jBe="_secondary_qchwm_170",IBe="_warning_qchwm_174",Mt={panel:lBe,title:cBe,sectionTitle:uBe,spacer:dBe,pivotRow:hBe,metricCell:fBe,metricCellSection:mBe,metricCellSub:pBe,modelCell:gBe,modelCellHeader:bBe,divider:yBe,kvRow:vBe,kvSubRow:xBe,kvLabel:wBe,kvValue:kBe,tableRow:_Be,modelUsageRow:SBe,tableNameCol:CBe,tableToolCol:TBe,tableNumCol:ABe,tableValueCol:EBe,success:MBe,error:NBe,secondary:jBe,warning:IBe},eE="web-shell:session-stats:v1:";function RBe(e,t="overview"){return`${eE}${JSON.stringify({_view:t,...e})}`}function DBe(e){if(!e.startsWith(eE))return null;try{const t=JSON.parse(e.slice(eE.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 $h(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 mm({label:e,children:t}){return c.jsxs("div",{className:Mt.kvRow,children:[c.jsx("span",{className:Mt.kvLabel,children:e}),c.jsx("span",{className:Mt.kvValue,children:t})]})}function fy({label:e,children:t}){return c.jsxs("div",{className:Mt.kvSubRow,children:[c.jsxs("span",{className:Mt.secondary,children:["»"," ",e]}),c.jsx("span",{className:Mt.kvValue,children:t})]})}function mre(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 LBe(e){return e.api.totalRequests===0?0:e.api.totalErrors/e.api.totalRequests*100}function PBe(e){return e.api.totalRequests===0?0:e.api.totalLatencyMs/e.api.totalRequests}function OBe(e){return e.tokens.prompt===0?0:e.tokens.cached/e.tokens.prompt*100}function kc({metric:e,values:t,variant:n="normal"}){const r=n==="section"?Mt.metricCellSection:n==="sub"?Mt.metricCellSub:Mt.metricCell;return c.jsxs("div",{className:Mt.pivotRow,children:[c.jsx("span",{className:r,children:n==="sub"?`↳ ${e}`:e}),t.map((s,i)=>c.jsx("span",{className:Mt.modelCell,children:s},i))]})}function BBe({status:e}){const{t}=gt(),{models:n,tools:r,files:s}=e,i=Object.values(n).reduce((b,x)=>b+x.api.totalLatencyMs,0),o=r.totalDurationMs,a=i+o,l=a>0?i/a*100:0,u=a>0?o/a*100:0,d=r.totalCalls>0?r.totalSuccess/r.totalCalls*100:0,h=mre(n),m=h.reduce((b,x)=>b+x.metrics.tokens.cached,0),p=h.reduce((b,x)=>b+x.metrics.tokens.prompt,0),g=p>0?m/p*100:0;return c.jsxs("div",{className:Mt.panel,children:[c.jsx("div",{className:Mt.title,children:t("stats.title")}),c.jsx("div",{className:Mt.sectionTitle,children:t("stats.overview")}),c.jsx(mm,{label:t("stats.duration"),children:$h(e.durationMs)}),c.jsx(mm,{label:t("stats.prompts"),children:e.promptCount}),c.jsx(mm,{label:t("stats.toolCalls"),children:c.jsxs("span",{children:[r.totalCalls," ",c.jsx("span",{className:Mt.secondary,children:"("}),c.jsxs("span",{className:Mt.success,children:["✓",r.totalSuccess]})," ",c.jsxs("span",{className:Mt.error,children:["✗",r.totalFail]}),c.jsx("span",{className:Mt.secondary,children:")"})]})}),c.jsx(mm,{label:t("stats.successRate"),children:c.jsxs("span",{className:d>=90?Mt.success:d>=70?Mt.warning:Mt.error,children:[d.toFixed(1),"%"]})}),(s.totalLinesAdded>0||s.totalLinesRemoved>0)&&c.jsx(mm,{label:t("stats.codeChanges"),children:c.jsxs("span",{children:[c.jsxs("span",{className:Mt.success,children:["+",s.totalLinesAdded]})," ",c.jsxs("span",{className:Mt.error,children:["-",s.totalLinesRemoved]})]})}),c.jsx("div",{className:Mt.spacer}),c.jsx("div",{className:Mt.sectionTitle,children:t("stats.performance")}),c.jsxs(fy,{label:t("stats.apiTime"),children:[$h(i)," ",c.jsxs("span",{className:Mt.secondary,children:["(",l.toFixed(1),"%)"]})]}),c.jsxs(fy,{label:t("stats.toolTime"),children:[$h(o)," ",c.jsxs("span",{className:Mt.secondary,children:["(",u.toFixed(1),"%)"]})]}),h.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Mt.spacer}),c.jsx("div",{className:Mt.sectionTitle,children:t("stats.modelUsage")}),c.jsx("div",{className:Mt.spacer}),c.jsxs("div",{className:`${Mt.tableRow} ${Mt.modelUsageRow}`,children:[c.jsx("span",{className:Mt.tableNameCol,children:t("stats.modelUsage")}),c.jsx("span",{className:Mt.tableValueCol,children:t("stats.reqs")}),c.jsx("span",{className:Mt.tableValueCol,children:t("stats.inputTokens")}),c.jsx("span",{className:Mt.tableValueCol,children:t("stats.outputTokens")})]}),c.jsx("div",{className:Mt.divider}),h.map(b=>c.jsxs("div",{className:`${Mt.tableRow} ${Mt.modelUsageRow}`,children:[c.jsx("span",{className:Mt.tableNameCol,children:b.label}),c.jsx("span",{className:Mt.tableValueCol,children:b.metrics.api.totalRequests}),c.jsx("span",{className:`${Mt.tableValueCol} ${Mt.warning}`,children:b.metrics.tokens.prompt.toLocaleString()}),c.jsx("span",{className:`${Mt.tableValueCol} ${Mt.warning}`,children:b.metrics.tokens.candidates.toLocaleString()})]},b.key)),g>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Mt.spacer}),c.jsxs("div",{children:[c.jsx("span",{className:Mt.success,children:t("stats.savingsHighlight")})," ",m.toLocaleString()," (",g.toFixed(1),"%)"," ",t("stats.cacheDesc")]}),c.jsxs("div",{className:Mt.secondary,children:["»"," ",t("stats.modelTip")]})]})]})]})}function $Be({status:e}){const{t}=gt(),n=mre(e.models);if(n.length===0)return c.jsxs("div",{className:Mt.panel,children:[c.jsx("div",{className:Mt.title,children:t("stats.modelStats")}),c.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 c.jsxs("div",{className:Mt.panel,children:[c.jsx("div",{className:Mt.title,children:t("stats.modelStats")}),c.jsx("div",{className:Mt.spacer}),c.jsxs("div",{className:Mt.pivotRow,children:[c.jsx("span",{className:Mt.metricCellSection,children:t("stats.metric")}),n.map(o=>c.jsx("span",{className:Mt.modelCellHeader,children:o.label},o.key))]}),c.jsx("div",{className:Mt.divider}),c.jsx(kc,{metric:t("stats.api"),values:[],variant:"section"}),c.jsx(kc,{metric:t("stats.requests"),values:i(o=>o.api.totalRequests.toLocaleString())}),c.jsx(kc,{metric:t("stats.errors"),values:i(o=>{const a=LBe(o);return c.jsxs("span",{className:o.api.totalErrors>0?Mt.error:void 0,children:[o.api.totalErrors.toLocaleString()," (",a.toFixed(1),"%)"]})})}),c.jsx(kc,{metric:t("stats.avgLatency"),values:i(o=>$h(PBe(o)))}),c.jsx("div",{className:Mt.spacer}),c.jsx(kc,{metric:t("stats.tokens"),values:[],variant:"section"}),c.jsx(kc,{metric:t("stats.total"),values:i(o=>c.jsx("span",{className:Mt.warning,children:o.tokens.total.toLocaleString()}))}),c.jsx(kc,{metric:t("stats.inputTokens"),values:i(o=>o.tokens.prompt.toLocaleString()),variant:"sub"}),r&&c.jsx(kc,{metric:t("stats.cached"),values:i(o=>c.jsxs("span",{className:Mt.success,children:[o.tokens.cached.toLocaleString()," (",OBe(o).toFixed(1),"%)"]})),variant:"sub"}),c.jsx(kc,{metric:t("stats.outputTokens"),values:i(o=>o.tokens.candidates.toLocaleString()),variant:"sub"}),s&&c.jsx(kc,{metric:t("stats.thoughts"),values:i(o=>o.tokens.thoughts.toLocaleString()),variant:"sub"})]})}function zBe(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 FBe({status:e}){const{t}=gt(),n=zBe(e.tools.byName);if(n.length===0)return c.jsxs("div",{className:Mt.panel,children:[c.jsx("div",{className:Mt.title,children:t("stats.toolStats")}),c.jsx("div",{children:t("stats.noToolCalls")})]});const r=Object.values(e.tools.byName).reduce((o,a)=>{var l,u,d;return o.accept+=((l=a.decisions)==null?void 0:l.accept)??0,o.reject+=((u=a.decisions)==null?void 0:u.reject)??0,o.modify+=((d=a.decisions)==null?void 0:d.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 c.jsxs("div",{className:Mt.panel,children:[c.jsx("div",{className:Mt.title,children:t("stats.toolStats")}),c.jsx("div",{className:Mt.spacer}),c.jsxs("div",{className:Mt.tableRow,children:[c.jsx("span",{className:Mt.tableToolCol,children:t("stats.toolName")}),c.jsx("span",{className:Mt.tableNumCol,children:t("stats.calls")}),c.jsx("span",{className:Mt.tableNumCol,children:t("stats.successRate")}),c.jsx("span",{className:Mt.tableNumCol,children:t("stats.avgDuration")})]}),c.jsx("div",{className:Mt.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 c.jsxs("div",{className:Mt.tableRow,children:[c.jsx("span",{className:`${Mt.tableToolCol} ${Mt.metricCell}`,children:hu(o.name,t)}),c.jsx("span",{className:Mt.tableNumCol,children:o.stats.count}),c.jsxs("span",{className:`${Mt.tableNumCol} ${a>=90?Mt.success:a>=70?Mt.warning:Mt.error}`,children:[a.toFixed(1),"%"]}),c.jsx("span",{className:Mt.tableNumCol,children:$h(l)})]},o.name)}),c.jsx("div",{className:Mt.spacer}),c.jsx("div",{className:Mt.sectionTitle,children:t("stats.decisionSummary")}),c.jsx(mm,{label:t("stats.totalReviewed"),children:s}),c.jsx(fy,{label:t("stats.accepted"),children:c.jsx("span",{className:Mt.success,children:r.accept})}),c.jsx(fy,{label:t("stats.rejected"),children:c.jsx("span",{className:Mt.error,children:r.reject})}),c.jsx(fy,{label:t("stats.modified"),children:c.jsx("span",{className:Mt.warning,children:r.modify})}),c.jsx("div",{className:Mt.divider}),c.jsx(mm,{label:t("stats.agreementRate"),children:c.jsx("span",{className:s>0?i>=90?Mt.success:i>=70?Mt.warning:Mt.error:void 0,children:s>0?`${i.toFixed(1)}%`:"--"})})]})}function qBe({view:e,status:t}){switch(e){case"model":return c.jsx($Be,{status:t});case"tools":return c.jsx(FBe,{status:t});default:return c.jsx(BBe,{status:t})}}function b3(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 HBe="_panel_13hcg_1",UBe="_title_13hcg_17",VBe="_row_13hcg_23",WBe="_rowGap_13hcg_31",GBe="_label_13hcg_35",KBe="_value_13hcg_41",YBe="_accent_13hcg_46",Cm={panel:HBe,title:UBe,row:VBe,rowGap:WBe,label:GBe,value:KBe,accent:YBe},{serialize:XBe,parse:QBe}=b3("web-shell:status:v1:");function Wl({label:e,children:t,gap:n}){return c.jsxs("div",{className:`${Cm.row}${n?` ${Cm.rowGap}`:""}`,children:[c.jsx("span",{className:Cm.label,children:e}),c.jsx("span",{className:Cm.value,children:t})]})}function JBe({info:e}){const{t}=gt();return c.jsxs("div",{className:Cm.panel,children:[c.jsx("div",{className:Cm.title,children:t("about.title")}),e.cliVersion&&c.jsx(Wl,{label:t("about.qwenCode"),children:c.jsx("span",{className:Cm.accent,children:e.cliVersion})}),e.runtime&&c.jsx(Wl,{label:t("about.runtime"),children:e.runtime}),e.platform&&c.jsx(Wl,{label:t("about.platform"),children:e.platform}),e.auth&&c.jsx(Wl,{label:t("about.auth"),gap:!0,children:e.auth}),e.baseUrl&&c.jsx(Wl,{label:t("about.baseUrl"),children:e.baseUrl}),e.model&&c.jsx(Wl,{label:t("about.model"),children:e.model}),e.fastModel&&e.fastModel!==e.model&&c.jsx(Wl,{label:t("about.fastModel"),children:e.fastModel}),e.sessionId&&c.jsx(Wl,{label:t("about.sessionId"),children:e.sessionId}),c.jsx(Wl,{label:t("about.sandbox"),children:e.sandbox||t("about.noSandbox")}),c.jsx(Wl,{label:t("about.proxy"),children:e.proxy||t("about.noProxy")}),e.memoryUsage&&c.jsx(Wl,{label:t("about.memoryUsage"),children:e.memoryUsage})]})}function ZBe(e){return e instanceof HTMLElement?!!e.closest("[data-keyboard-scope]"):!1}function pre(e,t,n=50){const r=f.useRef(e);f.useEffect(()=>{r.current=e},[e]),f.useEffect(()=>{const s=o=>{o.defaultPrevented||Ag(o.target)&&!ZBe(o.target)||r.current(o)},i=setTimeout(()=>{window.addEventListener("keydown",s)},n);return()=>{clearTimeout(i),window.removeEventListener("keydown",s)}},t)}function sa(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)}const e$e="_panel_1jx2a_1",t$e="_title_1jx2a_13",n$e="_header_1jx2a_18",r$e="_startup_1jx2a_24",s$e="_note_1jx2a_28",i$e="_secondary_1jx2a_29",o$e="_row_1jx2a_39",a$e="_selected_1jx2a_48",l$e="_disabled_1jx2a_52",c$e="_pointer_1jx2a_56",u$e="_nameCell_1jx2a_62",d$e="_truncate_1jx2a_69",h$e="_separator_1jx2a_75",f$e="_sectionTitle_1jx2a_79",m$e="_groupTitle_1jx2a_80",p$e="_success_1jx2a_84",g$e="_warning_1jx2a_88",b$e="_error_1jx2a_92",y$e="_group_1jx2a_80",v$e="_list_1jx2a_102",x$e="_description_1jx2a_108",w$e="_schema_1jx2a_113",k$e="_shortcuts_1jx2a_131",_$e="_detail_1jx2a_137",S$e="_serverFields_1jx2a_143",C$e="_serverField_1jx2a_143",T$e="_serverFieldLabel_1jx2a_156",A$e="_detailBlock_1jx2a_160",E$e="_parameters_1jx2a_161",M$e="_invalidBlock_1jx2a_162",N$e="_parameterRow_1jx2a_172",j$e="_actionMessage_1jx2a_177",I$e="_oauthPage_1jx2a_183",R$e="_scrollHint_1jx2a_189",Xt={panel:e$e,title:t$e,header:n$e,startup:r$e,note:s$e,secondary:i$e,row:o$e,selected:a$e,disabled:l$e,pointer:c$e,nameCell:u$e,truncate:d$e,separator:h$e,sectionTitle:f$e,groupTitle:m$e,success:p$e,warning:g$e,error:b$e,group:y$e,list:v$e,description:x$e,schema:w$e,shortcuts:k$e,detail:_$e,serverFields:S$e,serverField:C$e,serverFieldLabel:T$e,detailBlock:A$e,parameters:E$e,invalidBlock:M$e,parameterRow:N$e,actionMessage:j$e,oauthPage:I$e,scrollHint:R$e},tE="web-shell:mcp-panel-active",Zf=10,{parse:D$e}=b3("web-shell:mcp-status:v1:");function L$e(e){const t=D$e(e);return!t||!t.status?null:t}function Kw(e,t){if(e.disabled)return{icon:"✗",text:t("mcp.status.disabled"),className:Xt.error};if(e.approvalState==="pending")return{icon:"!",text:t("mcp.status.needsApproval"),className:Xt.warning};if(e.approvalState==="rejected")return{icon:"✗",text:t("mcp.status.rejected"),className:Xt.warning};switch(e.mcpStatus){case"connected":return{icon:"✓",text:t("mcp.status.connected"),className:Xt.success};case"connecting":return{icon:"🔄",text:t("mcp.status.starting"),className:Xt.warning};case"disconnected":default:return{icon:"🔴",text:t("mcp.status.disconnectedTitle"),className:Xt.error}}}function gre(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 P$e(e){const t=gre(e);return t?JSON.stringify(t,null,2):""}function O$e(e,t){return e.extensionName?t("mcp.extensionMcp"):t("mcp.userMcp")}function B$e(e,t){const n=e.source;return e.configOrigin==="project_mcp_json"||n==="project"&&e.removable===!1?t("mcp.source.project"):e.configOrigin==="workspace_settings"||n==="workspace"||n==="project"?t("mcp.source.workspace"):e.configOrigin==="extension"||e.extensionName?t("mcp.source.extension"):t("mcp.source.user")}function $$e(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 G6(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 Sz(e,t){window.dispatchEvent(new CustomEvent(tE,{detail:{id:e,active:t}}))}function Yw(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,"",t("mcp.oauth.starting",{name:e}),...n?["",n]:[]].join(`
`)}function z$e(e,t){return e?t("mcp.required"):""}function F$e(e,t){const n=gre(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=P$e(e);return o?c.jsx("pre",{className:Xt.schema,children:o}):null}const i=Object.entries(r);return i.length===0?null:c.jsxs("div",{className:Xt.parameters,children:[c.jsx("div",{className:Xt.sectionTitle,children:t("mcp.parameters")}),i.map(([o,a])=>{const l=a&&typeof a=="object"?a:{},u=typeof l.type=="string"?l.type:"any",d=typeof l.description=="string"?l.description:"";return c.jsx("div",{className:Xt.parameterRow,children:`• ${o}${z$e(s.has(o),t)}: ${u}${d?` - ${d}`:""}`},o)})]})}function q$e({message:e}){var Q;const{t}=gt(),n=gW({autoLoad:!1}),[r,s]=f.useState(e.status),[i,o]=f.useState(e.toolsByServer),[a,l]=f.useState(null),[u,d]=f.useState(!1),h=f.useRef(`mcp-${Math.random().toString(36).slice(2)}`),[m,p]=f.useState(!0),[g,b]=f.useState("servers"),[x,v]=f.useState(0),[y,w]=f.useState(0),[k,T]=f.useState(0),S=f.useMemo(()=>r.servers??[],[r.servers]),C=S[x]??null,_=f.useMemo(()=>{var U;return C?((U=i[C.name])==null?void 0:U.tools)??[]:[]},[C,i]),A=_[k]??null,M=f.useMemo(()=>_.length<=Zf||k<Zf-1?0:Math.min(k-Zf+1,_.length-Zf),[k,_.length]),L=f.useMemo(()=>_.slice(M,M+Zf),[_,M]),N=S.filter(U=>!U.disabled&&U.mcpStatus==="connecting").length,O=f.useMemo(()=>{const U=[];for(const j of S){const ie=O$e(j,t),oe=U.find(J=>J.label===ie);oe?oe.servers.push(j):U.push({label:ie,servers:[j]})}return U},[S,t]),B=f.useMemo(()=>S.length===0?20:Math.min(Math.max(...S.map(U=>U.name.length))+2,35),[S]),$=f.useMemo(()=>_.length===0?30:Math.min(Math.max(..._.map(U=>U.name.length))+2,50),[_]),P=f.useMemo(()=>{if(!C)return[];const U=[],j=!!C.approvalState;return!C.disabled&&!j&&_.length>0&&U.push({id:"view-tools",label:t("mcp.action.tools")}),!C.disabled&&!j&&C.mcpStatus==="disconnected"&&U.push({id:"reconnect",label:t("mcp.action.reconnect")}),!C.disabled&&j&&U.push({id:"approve",label:t("mcp.action.approve")}),(!(C.configOrigin==="extension"||C.source==="extension"||!!C.extensionName)||C.disabled)&&U.push({id:C.disabled?"enable":"disable",label:C.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!C.disabled&&!j&&(U.push({id:"authenticate",label:C.hasOAuthTokens?t("mcp.action.reauth"):t("mcp.action.auth")}),C.hasOAuthTokens&&U.push({id:"clear-auth",label:t("mcp.action.clearAuth")})),U},[C,_.length,t]),K=f.useCallback(async()=>{var j;const U=await n.reload();if(U){s(U);const ie=((j=U.servers)==null?void 0:j.find(oe=>oe.name===(C==null?void 0:C.name)))??null;if(ie){if(ie.approvalState)return;const oe=await n.loadTools(ie.name);o(J=>({...J,[ie.name]:oe}))}}},[n,C==null?void 0:C.name]),F=f.useCallback(async U=>{if(!(!C||U.disabled||u)){if(U.id==="view-tools"){b("tools"),T(0),l(null);return}d(!0),U.id==="authenticate"&&b("oauth"),l(U.id==="authenticate"?Yw(C.name,t):t("mcp.action.running",{action:U.label}));try{let j=null;if(U.id==="reconnect"){const ie=await n.restartServer(C.name);if("restarted"in ie&&!ie.restarted)throw new Error(t("mcp.reconnect.skipped",{reason:ie.reason}));if("entries"in ie&&(ie.entries.length===0||ie.entries.every(oe=>!oe.restarted)))throw new Error(t("mcp.reconnect.skipped",{reason:ie.entries.map(oe=>oe.reason).filter(Boolean).join(", ")||"not connected"}))}else{const ie=await n.manageServer(C.name,U.id),oe=[...ie.messages??[],...ie.authUrl?[ie.authUrl]:[]].join(`
`);oe&&(j=U.id==="authenticate"?Yw(C.name,t,oe):oe)}await K(),l(j??t("mcp.action.done",{action:U.label}))}catch(j){l(U.id==="authenticate"?Yw(C.name,t,sa(j)):t("mcp.action.failed",{error:sa(j)}))}finally{d(!1)}}},[u,n,K,C,t]);if(f.useEffect(()=>{const U=h.current;return Sz(U,m),()=>Sz(U,!1)},[m]),f.useEffect(()=>{const U=j=>{const ie=j.detail;ie!=null&&ie.active&&ie.id&&ie.id!==h.current&&p(!1)};return window.addEventListener(tE,U),()=>window.removeEventListener(tE,U)},[]),pre(U=>{if(m){if(U.key==="Escape"){U.preventDefault(),U.stopPropagation(),g==="servers"?p(!1):g==="server"?(b("servers"),w(0),l(null)):g==="oauth"?(b("server"),l(null)):g==="tools"?(b("server"),T(0)):b("tools");return}if(U.key==="ArrowUp"||U.key==="ArrowDown"){U.preventDefault(),U.stopPropagation();const j=U.key==="ArrowUp"?-1:1;g==="servers"?(v(ie=>Math.min(Math.max(ie+j,0),S.length-1)),w(0)):g==="server"?w(ie=>Math.min(Math.max(ie+j,0),P.length-1)):g==="tools"&&T(ie=>Math.min(Math.max(ie+j,0),_.length-1));return}if(U.key==="Enter")if(U.preventDefault(),U.stopPropagation(),g==="servers"&&S.length>0)b("server"),w(0);else if(g==="server"&&P.length>0){const j=P[y];j&&F(j)}else g==="tools"&&_.length>0&&b("tool")}},[m,y,_.length,P,F,S.length,g]),!m)return null;if(S.length===0)return c.jsxs("div",{className:Xt.panel,"data-keyboard-scope":!0,children:[c.jsxs("div",{className:Xt.header,children:[c.jsx("div",{className:Xt.title,children:t("mcp.manageServers")}),c.jsx("div",{className:Xt.secondary,children:t("mcp.servers",{count:0})})]}),c.jsx("div",{className:Xt.secondary,children:t("mcp.empty")}),c.jsx("div",{className:Xt.shortcuts,children:t("mcp.shortcut.close")})]});const H=g==="servers"?t("mcp.manageServers"):g==="server"?(C==null?void 0:C.name)??t("mcp.manageServers"):g==="oauth"?t("mcp.oauth.title"):g==="tools"?t("mcp.toolsForServer",{name:(C==null?void 0:C.name)??t("common.server")}):(A==null?void 0:A.name)??t("mcp.toolDetail"),D=g==="servers"?t("mcp.servers",{count:S.length}):g==="server"||g==="oauth"?"":g==="tools"?t(_.length===1?"mcp.toolCount":"mcp.toolsCount",{count:_.length}):(A==null?void 0:A.serverToolName)??(C==null?void 0:C.name)??"";return c.jsxs("div",{className:Xt.panel,"data-keyboard-scope":!0,children:[N>0&&c.jsxs("div",{children:[c.jsx("div",{className:Xt.startup,children:t("mcp.starting",{count:N})}),c.jsx("div",{className:Xt.note,children:t("mcp.startingNote")})]}),c.jsxs("div",{className:Xt.header,children:[c.jsx("div",{className:Xt.title,children:H}),D&&c.jsx("div",{className:Xt.secondary,children:D})]}),g==="servers"&&c.jsx("div",{className:Xt.list,children:O.map(U=>{let j=0;for(const ie of O){if(ie===U)break;j+=ie.servers.length}return c.jsxs("div",{className:Xt.group,children:[c.jsx("div",{className:Xt.groupTitle,children:U.label}),U.servers.map((ie,oe)=>{const J=j+oe,V=J===x,se=Kw(ie,t);return c.jsxs("div",{className:V?`${Xt.row} ${Xt.selected}`:Xt.row,onClick:()=>{v(J),b("server"),w(0)},onMouseEnter:()=>v(J),children:[c.jsx("span",{className:Xt.pointer,children:V?"❯":""}),c.jsx("span",{className:Xt.nameCell,style:{width:`${B}ch`},children:ie.name}),c.jsx("span",{className:Xt.separator,children:"·"}),c.jsxs("span",{className:se.className,children:[se.icon," ",se.text]})]},ie.name)})]},U.label)})}),g==="server"&&C&&c.jsxs("div",{className:Xt.detail,children:[c.jsxs("div",{className:Xt.serverFields,children:[c.jsxs("div",{className:Xt.serverField,children:[c.jsxs("span",{className:Xt.serverFieldLabel,children:[t("mcp.status"),":"]}),c.jsxs("span",{className:Kw(C,t).className,children:[Kw(C,t).icon," ",Kw(C,t).text]})]}),c.jsxs("div",{className:Xt.serverField,children:[c.jsxs("span",{className:Xt.serverFieldLabel,children:[t("mcp.source"),":"]}),c.jsx("span",{children:B$e(C,t)})]}),c.jsxs("div",{className:Xt.serverField,children:[c.jsxs("span",{className:Xt.serverFieldLabel,children:[t("mcp.command"),":"]}),c.jsx("span",{className:Xt.truncate,children:$$e(C,t)})]}),((Q=C.config)==null?void 0:Q.cwd)&&c.jsxs("div",{className:Xt.serverField,children:[c.jsxs("span",{className:Xt.serverFieldLabel,children:[t("mcp.workingDirectory"),":"]}),c.jsx("span",{className:Xt.truncate,children:C.config.cwd})]}),!C.disabled&&c.jsxs("div",{className:Xt.serverField,children:[c.jsxs("span",{className:Xt.serverFieldLabel,children:[t("mcp.tools"),":"]}),c.jsx("span",{children:t(_.length===1?"mcp.toolCount":"mcp.toolsCount",{count:_.length})})]})]}),c.jsx("div",{className:Xt.list,children:P.map((U,j)=>{const ie=j===y,oe=[Xt.row,ie?Xt.selected:"",U.disabled?Xt.disabled:""].filter(Boolean).join(" ");return c.jsxs("div",{className:oe,onClick:()=>{w(j),F(U)},children:[c.jsx("span",{className:Xt.pointer,children:ie?"❯":""}),c.jsx("span",{children:U.label})]},U.id)})}),a&&c.jsx("pre",{className:Xt.actionMessage,children:a})]}),g==="oauth"&&c.jsx("div",{className:Xt.oauthPage,children:c.jsx("pre",{className:Xt.actionMessage,children:a??(C?Yw(C.name,t):t("mcp.status.unknown"))})}),g==="tools"&&c.jsx("div",{className:Xt.list,children:_.length===0?c.jsx("div",{className:Xt.secondary,children:t("mcp.emptyTools")}):L.map((U,j)=>{const ie=M+j,oe=ie===k,J=G6(U,t);return c.jsxs("div",{className:oe?`${Xt.row} ${Xt.selected}`:Xt.row,onClick:()=>{T(ie),b("tool")},onMouseEnter:()=>T(ie),children:[c.jsx("span",{className:Xt.pointer,children:oe?"❯":""}),c.jsx("span",{className:Xt.nameCell,style:{width:`${$}ch`},children:U.name}),U.isValid?J?c.jsx("span",{className:Xt.secondary,children:J}):null:c.jsx("span",{className:Xt.warning,children:t("mcp.invalidReason",{reason:U.invalidReason||t("mcp.status.unknown")})})]},U.name)})}),g==="tools"&&_.length>Zf&&c.jsxs("div",{className:Xt.scrollHint,children:[M>0?"↑ ":"  ",t("mcp.scrollPosition",{current:k+1,total:_.length}),M+Zf<_.length?" ↓":""]}),g==="tool"&&A&&c.jsxs("div",{className:Xt.detail,children:[!A.isValid&&c.jsxs("div",{className:Xt.invalidBlock,children:[c.jsx("div",{className:Xt.sectionTitle,children:t("mcp.invalidToolWarning")}),c.jsxs("div",{children:[t("mcp.invalidReasonLabel")," ",A.invalidReason||t("mcp.status.unknown")]}),c.jsx("div",{className:Xt.secondary,children:t("mcp.invalidToolHelp")})]}),A.description&&c.jsxs("div",{className:Xt.detailBlock,children:[c.jsx("div",{className:Xt.sectionTitle,children:t("mcp.description")}),c.jsx("div",{className:Xt.description,children:A.description.trim()})]}),G6(A,t)&&c.jsxs("div",{className:Xt.detailBlock,children:[c.jsx("span",{className:Xt.sectionTitle,children:t("mcp.annotations")})," ",c.jsx("span",{children:G6(A,t)})]}),F$e(A,t)]}),c.jsx("div",{className:Xt.shortcuts,children:t(g==="servers"?"mcp.shortcut.selectClose":g==="server"||g==="tools"?"mcp.shortcut.selectBack":"mcp.shortcut.back")})]})}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const H$e=3;function t4(e){return e.kind==="agent"&&typeof e.id=="string"}function U$e(e){const t=e.filter(t4),n=new Map;for(const u of t)n.set(u.id,u);const r=new Map,s=[];for(const u of t){const d=u.parentAgentId;if(d!=null&&d!==u.id&&n.has(d)){const h=r.get(d);h?h.push(u):r.set(d,[u])}else s.push(u)}if(r.size===0)return[...e];const i=[],o=new Set,a=u=>{if(!o.has(u.id)){o.add(u.id),i.push(u);for(const d of r.get(u.id)??[])a(d)}};for(const u of s)a(u);for(const u of t)o.has(u.id)||(o.add(u.id),i.push(u));let l=0;return e.map(u=>t4(u)?i[l++]:u)}function bre(e,t){const n=[],r=new Set(e.id!=null?[e.id]:[]);let s=e.parentAgentId;for(;;){if(s==null)return{chain:n,terminatedBy:"root"};if(r.has(s))return{chain:n,terminatedBy:"cycle"};const i=t(s);if(!i)return{chain:n,terminatedBy:"missing"};r.add(s),n.push(i),s=i.parentAgentId}}function V$e(e){const t=new Map;for(const r of e)t4(r)&&t.set(r.id,r);const n=new Map;for(const r of t.values()){const{chain:s,terminatedBy:i}=bre(r,o=>t.get(o));n.set(r.id,{visibleDepth:i==="cycle"?0:s.length,orphaned:s.length===0&&i==="missing"})}return n}function W$e(e){const t=new Map;for(const r of e)t4(r)&&t.set(r.id,r);const n=new Set;for(const r of t.values()){if(r.isBackgrounded!==!1)continue;const{chain:s,terminatedBy:i}=bre(r,o=>t.get(o));i==="root"&&s.every(o=>o.isBackgrounded===!1)&&n.add(r.id)}return n}function nE(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 G$e="_panel_1c0ra_1",K$e="_embeddedPanel_1c0ra_12",Y$e="_title_1c0ra_19",X$e="_sectionTitle_1c0ra_24",Q$e="_overflowHint_1c0ra_28",J$e="_header_1c0ra_33",Z$e="_secondary_1c0ra_39",eze="_row_1c0ra_43",tze="_selected_1c0ra_51",nze="_pointer_1c0ra_55",rze="_nameCell_1c0ra_61",sze="_treeMarker_1c0ra_70",ize="_orphanNote_1c0ra_74",oze="_status_1c0ra_78",aze="_chevronCell_1c0ra_84",lze="_chevron_1c0ra_84",cze="_chevronExpanded_1c0ra_101",uze="_separator_1c0ra_111",dze="_list_1c0ra_115",hze="_task_1c0ra_121",fze="_taskExpanded_1c0ra_127",mze="_success_1c0ra_132",pze="_warning_1c0ra_136",gze="_error_1c0ra_140",bze="_detail_1c0ra_144",yze="_detailTop_1c0ra_153",vze="_detailTopMain_1c0ra_160",xze="_inlineDetail_1c0ra_200",wze="_taskIcon_1c0ra_222",kze="_detailField_1c0ra_251",_ze="_detailFieldLabel_1c0ra_258",Sze="_detailContent_1c0ra_264",Cze="_compactSummary_1c0ra_271",Tze="_actionBar_1c0ra_280",Aze="_actionHint_1c0ra_289",Eze="_actionButton_1c0ra_294",Mze="_dangerButton_1c0ra_314",Nze="_shortcuts_1c0ra_318",jze="_confirmHint_1c0ra_324",Ize="_statusBadge_1c0ra_328",Rze="_activityCurrent_1c0ra_334",Dze="_activityPast_1c0ra_341",Lze="_promptContent_1c0ra_348",$t={panel:G$e,embeddedPanel:K$e,title:Y$e,sectionTitle:X$e,overflowHint:Q$e,header:J$e,secondary:Z$e,row:eze,selected:tze,pointer:nze,nameCell:rze,treeMarker:sze,orphanNote:ize,status:oze,chevronCell:aze,chevron:lze,chevronExpanded:cze,separator:uze,list:dze,task:hze,taskExpanded:fze,success:mze,warning:pze,error:gze,detail:bze,detailTop:yze,detailTopMain:vze,inlineDetail:xze,taskIcon:wze,detailField:kze,detailFieldLabel:_ze,detailContent:Sze,compactSummary:Cze,actionBar:Tze,actionHint:Aze,actionButton:Eze,dangerButton:Mze,shortcuts:Nze,confirmHint:jze,statusBadge:Ize,activityCurrent:Rze,activityPast:Dze,promptContent:Lze},mv="web-shell:tasks-panel-active",Pze=3e3,Cz=8,{parse:Oze}=b3("web-shell:tasks-status:v1:");function Bze(e){const t=Oze(e);return!t||!t.snapshot?null:t}function Tz(e,t){window.dispatchEvent(new CustomEvent(mv,{detail:{id:e,active:t}}))}function Az(e){return e.status==="running"||e.status==="paused"}function $ze(e){return[...e].sort((t,n)=>{const r=Az(t),s=Az(n);return r!==s?r?-1:1:r?n.startTime-t.startTime:(n.endTime??n.startTime)-(t.endTime??t.startTime)})}function K6(e){return U$e($ze(e))}function Ez(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function yre(e){switch(e){case"running":return $t.success;case"paused":return $t.warning;case"completed":return $t.success;case"failed":return $t.error;case"cancelled":return $t.warning;default:return""}}function zze(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 Fze(e){switch(e){case"paused":return"⏸";case"completed":return"✓";case"failed":case"cancelled":return"✗";case"running":return null;default:return null}}function qze({expanded:e}){return c.jsx("svg",{className:`${$t.chevron} ${e?$t.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function Hze(e,t){switch(e.kind){case"agent":return t?`[blocking] ${e.label}`:e.label;case"shell":return`[shell] ${e.command}`;case"monitor":return`[monitor] ${e.description}`}}function Uze(e,t){if(e.length<=Cz)return{visible:e,windowStart:0,hiddenAbove:0,hiddenBelow:0};const n=Math.max(1,Cz-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 Vze(e,t,n){const r=hu(e,n),s=t?t.replace(/\s*\n\s*/g," ").trim():"",i=s?`${r}(${s})`:r;return tBe(i)}function vre({message:e,embedded:t=!1,manageActiveEvent:n=!0,onClose:r}){const{t:s}=gt(),i=Fg(),[o,a]=f.useState(()=>K6(e.snapshot.tasks)),[l,u]=f.useState(!0),[d,h]=f.useState("list"),[m,p]=f.useState(0),[g,b]=f.useState(null),[x,v]=f.useState(!1),[y,w]=f.useState(!1),[k,T]=f.useState(null),S=f.useRef(`tasks-${Math.random().toString(36).slice(2)}`),C=f.useRef(!1),_=f.useRef(null),A=o.length===0?0:Math.min(m,o.length-1),M=o[A]??null,L=f.useMemo(()=>V$e(o),[o]),N=f.useMemo(()=>W$e(o),[o]);f.useEffect(()=>{if(!l)return;const ie=setInterval(()=>{C.current||(C.current=!0,i.getTasks().then(oe=>{a(K6(oe.tasks)),w(!1)}).catch(oe=>{console.warn("[web-shell] failed to refresh tasks:",oe),w(!0)}).finally(()=>{C.current=!1}))},Pze);return()=>clearInterval(ie)},[l,i]),f.useEffect(()=>{o.length===0&&m!==0&&p(0),m>=o.length&&o.length>0&&p(o.length-1)},[o.length,m]),f.useEffect(()=>{if(!l||d!=="detail"){_.current=null;return}if(!M){_.current=null,h("list");return}const j=_.current;if(!j||j.taskId!==M.id){_.current={taskId:M.id,status:M.status};return}j.status==="running"&&M.status!=="running"&&(b(null),h("list"))},[l,d,M]),f.useEffect(()=>{if(!n)return;const j=S.current;return Tz(j,l),()=>Tz(j,!1)},[l,n]),f.useEffect(()=>{if(!n)return;const j=ie=>{const oe=ie.detail;oe!=null&&oe.active&&oe.id&&oe.id!==S.current&&u(!1)};return window.addEventListener(mv,j),()=>window.removeEventListener(mv,j)},[n]),f.useEffect(()=>{l||r==null||r()},[l,r]);const O=f.useCallback(async j=>{if(x)return;const ie=j.status==="running",oe=j.kind==="agent"&&j.status==="paused";if(!ie&&!oe)return;if(j.kind==="agent"&&N.has(j.id)&&g!==j.id){b(j.id);return}b(null),v(!0);try{if(!(await i.cancelTask(j.id,j.kind)).cancelled){T(s("tasks.alreadyStopped"));return}const se=await i.getTasks();a(K6(se.tasks)),T(null)}catch(V){console.warn("[web-shell] failed to cancel task:",V),T(s("tasks.cancelFailed"))}finally{v(!1)}},[i,x,N,g,s]);if(pre(j=>{if(l){if(j.key==="Escape"){if(j.preventDefault(),j.stopPropagation(),g){b(null);return}d==="detail"?h("list"):u(!1);return}if(j.key==="ArrowLeft"){j.preventDefault(),j.stopPropagation(),d==="detail"?(b(null),h("list")):u(!1);return}if((j.key==="ArrowUp"||j.key==="ArrowDown")&&d==="list"){if(j.preventDefault(),j.stopPropagation(),o.length===0)return;const ie=j.key==="ArrowUp"?-1:1;p(oe=>Math.min(Math.max(oe+ie,0),o.length-1)),b(null);return}if(j.key==="Enter"){j.preventDefault(),j.stopPropagation(),d==="list"&&M?h("detail"):d==="detail"&&u(!1);return}if(j.key===" "&&d==="detail"){j.preventDefault(),j.stopPropagation(),u(!1);return}if(j.key==="x"&&!j.ctrlKey&&!j.metaKey){j.preventDefault(),j.stopPropagation(),M&&O(M);return}}},[l,d,o.length,M,O,g]),!l)return null;const B=g!==null&&M!==null&&g===M.id,$=[];B?($.push(s("tasks.confirmStop")),$.push(s("tasks.shortcut.cancelConfirm"))):($.push(s("tasks.shortcut.select")),$.push(s("tasks.shortcut.view")),(M==null?void 0:M.status)==="running"?$.push(s("tasks.shortcut.stop")):(M==null?void 0:M.kind)==="agent"&&(M==null?void 0:M.status)==="paused"&&$.push(s("tasks.shortcut.abandon")),$.push(s("tasks.shortcut.listClose")));const P=[];if(B?(P.push(s("tasks.confirmStop")),P.push(s("tasks.shortcut.cancelConfirm"))):(P.push(s("tasks.shortcut.detailBack")),P.push(s("tasks.shortcut.detailClose")),(M==null?void 0:M.status)==="running"?P.push(s("tasks.shortcut.stop")):(M==null?void 0:M.kind)==="agent"&&(M==null?void 0:M.status)==="paused"&&P.push(s("tasks.shortcut.abandon"))),o.length===0)return c.jsxs("div",{className:t?`${$t.panel} ${$t.embeddedPanel}`:$t.panel,"data-keyboard-scope":!0,children:[(y||k||!t)&&c.jsxs("div",{className:$t.header,children:[!t&&c.jsx("div",{className:$t.title,children:s("tasks.title")}),y&&c.jsx("div",{className:$t.warning,children:s("tasks.refreshStale")}),k&&c.jsx("div",{className:$t.error,children:k})]}),c.jsx("div",{children:c.jsx("div",{className:$t.secondary,children:s("tasks.empty")})}),!t&&c.jsx("div",{className:$t.shortcuts,children:s("tasks.shortcut.close")})]});const{visible:K,windowStart:F,hiddenAbove:H,hiddenBelow:D}=Uze(o,A),Q=t?o:K,U=t?0:F;return c.jsxs("div",{className:t?`${$t.panel} ${$t.embeddedPanel}`:$t.panel,"data-keyboard-scope":!0,children:[(t||d==="list")&&(y||k||!t)&&c.jsxs("div",{className:$t.header,children:[!t&&c.jsx("div",{className:$t.title,children:s("tasks.title")}),y&&c.jsx("div",{className:$t.warning,children:s("tasks.refreshStale")}),k&&c.jsx("div",{className:$t.error,children:k})]}),(t||d==="list")&&c.jsxs("div",{className:$t.list,children:[!t&&c.jsxs("div",{className:$t.sectionTitle,children:[s("tasks.title")," ",c.jsxs("span",{className:$t.secondary,children:["(",o.length,")"]})]}),!t&&H>0&&c.jsx("div",{className:$t.overflowHint,children:s("tasks.moreAbove",{count:H})}),Q.map((j,ie)=>{const oe=U+ie,J=oe===A,V=yre(j.status),se=zze(j.status,s),Z=t&&J&&d==="detail",X=t?Z:J,te=j.kind==="agent"?L.get(j.id):void 0,ae=Math.min((te==null?void 0:te.visibleDepth)??0,H$e),xe=j.kind==="agent"&&j.parentAgentId!=null,Ae=te!=null&&te.orphaned?j.kind==="agent"&&j.parentName?s("tasks.row.from",{parent:j.parentName}):s("tasks.row.nested"):null;return c.jsxs("div",{className:`${$t.task} ${Z?$t.taskExpanded:""}`,children:[c.jsxs("div",{className:X?`${$t.row} ${$t.selected}`:$t.row,onClick:()=>{p(oe),h(t&&Z?"list":"detail")},onMouseEnter:()=>{t||p(oe)},children:[c.jsx("span",{className:$t.pointer,children:X?"❯":""}),t&&c.jsx("span",{className:$t.taskIcon,"aria-hidden":"true"}),c.jsxs("span",{className:$t.nameCell,style:ae>0?{paddingLeft:`${ae*16}px`}:void 0,children:[xe&&c.jsx("span",{className:$t.treeMarker,"aria-hidden":"true",children:"↳ "}),Hze(j,N.has(j.id)),Ae&&c.jsxs("span",{className:$t.orphanNote,children:[" · ",Ae]})]}),c.jsx("span",{className:`${$t.status} ${V}`,children:se}),c.jsx("span",{className:$t.chevronCell,children:c.jsx(qze,{expanded:Z})})]}),Z&&c.jsx("div",{className:$t.inlineDetail,children:c.jsx(Mz,{task:j,t:s,hideHeader:!0,busy:x,showCancelConfirm:g===j.id,onCancel:()=>void O(j),onCancelConfirmDismiss:()=>b(null)})})]},j.id)}),!t&&D>0&&c.jsx("div",{className:$t.overflowHint,children:s("tasks.moreBelow",{count:D})})]}),!t&&d==="detail"&&M&&c.jsxs(c.Fragment,{children:[k&&c.jsx("div",{className:$t.error,children:k}),c.jsx(Mz,{task:M,t:s,busy:x,showCancelConfirm:g===M.id,onCancel:()=>void O(M),onCancelConfirmDismiss:()=>b(null)})]}),!t&&c.jsx("div",{className:B?`${$t.shortcuts} ${$t.confirmHint}`:$t.shortcuts,children:(d==="list"?$:P).join(" · ")})]})}function Wze(e,t){switch(e.kind){case"agent":return`${e.subagentType??t("common.agent")} › ${e.label}`;case"shell":return`${t("tasks.kind.shell")} › ${e.command}`;case"monitor":return`${t("tasks.kind.monitor")} › ${e.description}`}}function Mz({task:e,t,hideHeader:n=!1,busy:r=!1,showCancelConfirm:s=!1,onCancel:i,onCancelConfirmDismiss:o}){var w,k,T;const a=Fze(e.status),l=yre(e.status),u=e.kind==="agent"&&e.status==="paused",d=e.status==="running"||u,h=t(u?"tasks.action.abandon":"tasks.action.stop"),m=t(u?"tasks.action.confirmAbandon":"tasks.action.confirmStop"),p=[nE(e.runtimeMs)],g=[{label:t("tasks.detail.runtime"),value:nE(e.runtimeMs)}],b=e.kind==="agent"?((w=e.stats)==null?void 0:w.outputTokens)??((k=e.stats)==null?void 0:k.totalTokens):void 0;b&&(p.push(t("tasks.detail.tokens",{count:Ez(b)})),g.push({label:t("tasks.detail.tokenCount"),value:Ez(b)})),e.kind==="agent"&&((T=e.stats)==null?void 0:T.toolUses)!==void 0&&(p.push(t("tasks.detail.toolCalls",{count:e.stats.toolUses})),g.push({label:t("tasks.detail.toolCallCount"),value:String(e.stats.toolUses)})),e.kind!=="agent"&&e.pid!==void 0&&p.push(`pid ${e.pid}`),e.kind==="shell"&&e.exitCode!==void 0&&p.push(t("tasks.detail.exit",{exitCode:e.exitCode})),e.kind==="monitor"&&(p.push(t("tasks.detail.events",{count:e.eventCount})),e.droppedLines>0&&p.push(t("tasks.detail.dropped",{count:e.droppedLines})),e.exitCode!==void 0&&p.push(t("tasks.detail.exit",{exitCode:e.exitCode})));const x=e.kind==="agent"&&e.prompt?e.prompt.split(`
`):[],v=d&&i?c.jsx("div",{className:$t.actionBar,children:s?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:$t.actionHint,children:t("tasks.action.confirmHint")}),c.jsx("button",{type:"button",className:`${$t.actionButton} ${$t.dangerButton}`,disabled:r,onClick:i,children:m}),c.jsx("button",{type:"button",className:$t.actionButton,onClick:o,children:t("common.cancel")})]}):c.jsx("button",{type:"button",className:`${$t.actionButton} ${$t.dangerButton}`,disabled:r,onClick:i,children:h})}):null,y=n?g.length>0?c.jsx("div",{className:$t.compactSummary,children:g.map(S=>`${S.label} ${S.value}`).join(" · ")}):null:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:$t.title,children:Wze(e,t)}),c.jsxs("div",{className:$t.statusBadge,children:[a&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:l,children:[a," ",t(`tasks.${e.status}`)]}),c.jsx("span",{className:$t.separator,children:"·"})]}),c.jsx("span",{className:$t.secondary,children:p.join(" · ")})]})]});return c.jsxs("div",{className:$t.detail,children:[(y||v)&&c.jsxs("div",{className:$t.detailTop,children:[y&&c.jsx("div",{className:$t.detailTopMain,children:y}),v]}),e.kind==="shell"&&c.jsxs(c.Fragment,{children:[c.jsx(Vp,{label:t("tasks.detail.workingDir"),value:e.cwd}),e.outputFile&&c.jsx(Vp,{label:t("tasks.detail.outputFile"),value:e.outputFile})]}),e.kind==="monitor"&&c.jsx(Vp,{label:t("tasks.detail.command"),value:e.command}),e.kind==="agent"&&e.subagentType&&c.jsx(Vp,{label:t("tasks.detail.type"),value:e.subagentType}),e.kind==="agent"&&(e.depth??0)>0&&c.jsx(Vp,{label:t("tasks.detail.nesting"),value:e.parentName?t("tasks.detail.nestingValue",{level:(e.depth??0)+1,parent:e.parentName}):t("tasks.detail.nestingLevel",{level:(e.depth??0)+1})}),e.kind==="agent"&&e.recentActivities&&e.recentActivities.length>0&&c.jsxs("div",{className:$t.detailField,children:[c.jsx("div",{className:$t.detailFieldLabel,children:t("tasks.detail.progress")}),c.jsx("div",{className:$t.detailContent,children:e.recentActivities.slice(-5).map((S,C,_)=>{const A=C===_.length-1,M=Vze(S.name,S.description,t);return c.jsxs("div",{className:A?$t.activityCurrent:$t.activityPast,children:[A?"> ":"  ",M]},`${S.at}-${C}`)})})]}),e.kind==="agent"&&e.prompt&&c.jsxs("div",{className:$t.detailField,children:[c.jsx("div",{className:$t.detailFieldLabel,children:t("tasks.detail.prompt")}),c.jsx("div",{className:$t.promptContent,children:x.slice(0,5).map((S,C,_)=>c.jsx("div",{children:C===_.length-1&&x.length>5?`${S}…`:S||" "},C))})]}),e.kind==="agent"&&e.outputFile&&c.jsx(Vp,{label:t("tasks.detail.outputFile"),value:e.outputFile}),e.kind==="agent"&&e.status==="paused"&&e.resumeBlockedReason&&c.jsxs("div",{className:$t.detailField,children:[c.jsx("div",{className:`${$t.detailFieldLabel} ${$t.error}`,children:t("tasks.detail.resumeBlocked")}),c.jsx("div",{className:$t.error,children:e.resumeBlockedReason})]}),e.error&&c.jsxs("div",{className:$t.detailField,children:[c.jsx("div",{className:`${$t.detailFieldLabel} ${e.kind==="monitor"&&e.status!=="failed"?$t.warning:$t.error}`,children:e.kind==="monitor"&&e.status!=="failed"?t("tasks.detail.stoppedBecause"):t("tasks.detail.error")}),c.jsx("div",{className:e.kind==="monitor"&&e.status!=="failed"?$t.warning:$t.error,children:e.error})]})]})}function Vp({label:e,value:t}){return c.jsxs("div",{className:$t.detailField,children:[c.jsx("div",{className:$t.detailFieldLabel,children:e}),c.jsx("div",{className:$t.detailContent,children:t})]})}const Gze="_message_fm8gc_1",Kze="_body_fm8gc_15",Yze="_title_fm8gc_20",Xze="_muted_fm8gc_24",Qze="_accent_fm8gc_28",Jze="_success_fm8gc_32",Zze="_error_fm8gc_36",eFe="_warning_fm8gc_40",tFe="_row_fm8gc_44",nFe="_label_fm8gc_50",rFe="_value_fm8gc_55",ua={message:Gze,body:Kze,title:Yze,muted:Xze,accent:Qze,success:Jze,error:Zze,warning:eFe,row:tFe,label:nFe,value:rFe},rE="web-shell-goal-status-active",{serialize:Nz,parse:sFe}=b3(_de),iFe=new Set(["set","achieved","cleared","failed","aborted","checking"]);function n4(e){const t=typeof e=="string"?sFe(e):e;return oFe(t)}function oFe(e){if(!e||typeof e!="object")return null;const t=e,n=t.kind,r=t.condition;if(typeof n!="string"||!iFe.has(n)||typeof r!="string")return null;const s=Y6(t.iterations),i=Y6(t.durationMs),o=Y6(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 Y6(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function aFe(e,t){return t(e===1?"goal.turn":"goal.turns",{count:e})}function lFe(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:ua.muted};case"set":return{title:t("goal.set"),colorClass:ua.accent};case"achieved":return{title:t("goal.achieved"),colorClass:ua.success};case"cleared":return{title:t("goal.cleared"),colorClass:ua.muted};case"failed":return{title:t("goal.failed"),colorClass:ua.error};case"aborted":return{title:t("goal.aborted"),colorClass:ua.warning}}}function cFe({status:e,activateFooter:t=!1}){var l;const{t:n}=gt();f.useEffect(()=>{if(!t)return;const u=e.kind==="set"||e.kind==="checking";window.dispatchEvent(new CustomEvent(rE,{detail:{active:u,condition:e.condition,setAt:e.setAt}}))},[t,e.condition,e.kind,e.setAt]);const r=lFe(e,n),s=[];e.kind!=="checking"&&(e.iterations&&e.iterations>0&&s.push(aFe(e.iterations,n)),typeof e.durationMs=="number"&&s.push(nE(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 c.jsx("div",{className:ua.message,children:c.jsxs("div",{className:ua.body,children:[c.jsxs("div",{className:`${ua.title} ${r.colorClass}`,children:[r.title,i&&c.jsx("span",{className:ua.muted,children:i})]}),c.jsxs("div",{className:ua.row,children:[c.jsxs("span",{className:ua.label,children:[n("goal.label"),":"]}),c.jsx("span",{className:ua.value,children:e.condition})]}),o&&c.jsxs("div",{className:ua.muted,children:[a,": ",o]})]})})}const uFe="_message_u8kmd_1",dFe="_flushMessage_u8kmd_12",hFe="_noMarker_u8kmd_26",fFe="_content_u8kmd_30",mFe="_info_u8kmd_49",pFe="_recap_u8kmd_54",gFe="_modelSwitch_u8kmd_67",bFe="_error_u8kmd_71",yFe="_warning_u8kmd_77",vFe="_retryHint_u8kmd_83",xFe="_retryButton_u8kmd_90",wFe="_cancelled_u8kmd_108",ta={message:uFe,flushMessage:dFe,noMarker:hFe,content:fFe,info:mFe,recap:pFe,modelSwitch:gFe,error:bFe,warning:yFe,retryHint:vFe,retryButton:xFe,cancelled:wFe},kFe=f.memo(function({content:t,variant:n,source:r,data:s,onShowContextDetail:i,isLatest:o=!1,showRetryHint:a=!1,onRetryClick:l}){const{t:u}=gt();if(r==="prompt_cancelled")return c.jsx("div",{className:ta.cancelled,role:"status",children:c.jsx("span",{children:u("turn.stopped")})});const d=n==="info"?VOe(t):null;if(d)return c.jsx("div",{className:ta.flushMessage,children:c.jsx(JOe,{status:d,onShowDetail:i})});const h=n==="info"?DBe(t):null;if(h)return c.jsx("div",{className:ta.flushMessage,children:c.jsx(qBe,{view:h.view,status:h.status})});const m=n==="info"?QBe(t):null;if(m)return c.jsx("div",{className:ta.flushMessage,children:c.jsx(JBe,{info:m})});const p=n==="info"?L$e(t):null;if(p)return c.jsx("div",{className:ta.flushMessage,children:c.jsx(q$e,{message:p})});const g=n==="info"?Bze(t):null;if(g)return c.jsx("div",{className:ta.flushMessage,children:c.jsx(vre,{message:g})});const b=n==="info"?n4(r==="goal"?s:t):null;if(b)return c.jsx("div",{className:ta.flushMessage,children:c.jsx(cFe,{status:b,activateFooter:o})});const x=n==="info"&&r==="model_switch_summary",v=n==="info"&&r==="recap";return c.jsx("div",{className:`${ta.message} ${ta[n]} ${x?ta.modelSwitch:""} ${v?ta.recap:""}`,children:c.jsxs("div",{className:ta.content,children:[x?c.jsx("pre",{children:t}):n==="info"?c.jsx(Wm,{content:t}):c.jsx("pre",{children:t}),a&&l&&c.jsx("div",{className:ta.retryHint,children:c.jsx("button",{type:"button",className:ta.retryButton,onClick:l,children:u("retry.hint")})})]})})}),_Fe="_group_1lo6j_1",SFe="_chatSummaryGroup_1lo6j_14",CFe="_line_1lo6j_22",TFe="_chatSummary_1lo6j_14",AFe="_chatSummaryTextActive_1lo6j_49",EFe="_chatSummaryIcon_1lo6j_55",MFe="_chatSummaryToolIcon_1lo6j_69",NFe="_chatSummaryText_1lo6j_49",jFe="_chatSummaryInline_1lo6j_85",IFe="_chatChevronRight_1lo6j_122",RFe="_chatChevronDown_1lo6j_123",DFe="_chatSummaryContentClip_1lo6j_184",LFe="_chatSummaryContentCollapsed_1lo6j_192",PFe="_chatSummaryContentInner_1lo6j_196",OFe="_lineMain_1lo6j_201",BFe="_icon_1lo6j_211",$Fe="_iconError_1lo6j_216",zFe="_lineName_1lo6j_221",FFe="_lineArg_1lo6j_225",qFe="_lineElapsed_1lo6j_233",HFe="_lineExpandable_1lo6j_239",UFe="_lineChevronRight_1lo6j_259",VFe="_lineChevronDown_1lo6j_260",WFe="_lineOutput_1lo6j_297",GFe="_expandedCard_1lo6j_306",KFe="_expandedCardHeader_1lo6j_316",YFe="_expandedCardTitle_1lo6j_325",XFe="_expandedCardDetail_1lo6j_332",QFe="_expandedCardBody_1lo6j_342",JFe="_expandedAgentCard_1lo6j_347",ZFe="_expandedLineOutput_1lo6j_357",eqe="_lineDetail_1lo6j_361",tqe="_markdownLineDetail_1lo6j_367",nqe="_expandedBash_1lo6j_375",rqe="_expandedRead_1lo6j_376",sqe="_expandedOutput_1lo6j_380",iqe="_expandedEdit_1lo6j_394",oqe="_todoProgress_1lo6j_408",aqe="_todoBody_1lo6j_415",lqe="_compactGroup_1lo6j_423",cqe="_compactHeader_1lo6j_430",uqe="_compactCount_1lo6j_440",dqe="_compactHint_1lo6j_446",Gt={group:_Fe,chatSummaryGroup:SFe,line:CFe,chatSummary:TFe,chatSummaryTextActive:AFe,chatSummaryIcon:EFe,chatSummaryToolIcon:MFe,chatSummaryText:NFe,chatSummaryInline:jFe,chatChevronRight:IFe,chatChevronDown:RFe,chatSummaryContentClip:DFe,chatSummaryContentCollapsed:LFe,chatSummaryContentInner:PFe,lineMain:OFe,icon:BFe,iconError:$Fe,lineName:zFe,lineArg:FFe,lineElapsed:qFe,lineExpandable:HFe,lineChevronRight:UFe,lineChevronDown:VFe,lineOutput:WFe,expandedCard:GFe,expandedCardHeader:KFe,expandedCardTitle:YFe,expandedCardDetail:XFe,expandedCardBody:QFe,expandedAgentCard:JFe,expandedLineOutput:ZFe,lineDetail:eqe,markdownLineDetail:tqe,expandedBash:nqe,expandedRead:rqe,expandedOutput:sqe,expandedEdit:iqe,todoProgress:oqe,todoBody:aqe,compactGroup:lqe,compactHeader:cqe,compactCount:uqe,compactHint:dqe};function ff({status:e}){const{t}=gt();switch(e){case"completed":case"success":return null;case"failed":case"error":case"cancelled":case"canceled":return c.jsx("span",{className:`${Gt.icon} ${Gt.iconError}`,children:t("tool.status.failed")});case"in_progress":case"running":return null;default:return null}}function sx(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 xre(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 wre(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 hqe="_panel_rcjxd_1",fqe="_header_rcjxd_11",mqe="_desc_rcjxd_23",pqe="_toggle_rcjxd_32",gqe="_meta_rcjxd_38",bqe="_body_rcjxd_44",yqe="_content_rcjxd_55",vqe="_stream_rcjxd_70",xqe="_streamCollapsed_rcjxd_80",wqe="_scrollWindow_rcjxd_88",kqe="_expandToggle_rcjxd_93",_qe="_sectionCap_rcjxd_110",Sqe="_tools_rcjxd_128",Cqe="_step_rcjxd_142",Tqe="_toolTimeRow_rcjxd_188",Aqe="_toolTimeTip_rcjxd_192",Ws={panel:hqe,header:fqe,desc:mqe,toggle:pqe,meta:gqe,body:bqe,content:yqe,stream:vqe,streamCollapsed:xqe,scrollWindow:wqe,expandToggle:kqe,sectionCap:_qe,tools:Sqe,step:Cqe,toolTimeRow:Tqe,toolTimeTip:Aqe};function kre(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function Eqe({timestamp:e,children:t}){return e===void 0?c.jsx(c.Fragment,{children:t}):c.jsxs("div",{className:Ws.toolTimeRow,children:[t,c.jsx("span",{className:Ws.toolTimeTip,"aria-hidden":"true",children:hg(e)})]})}const Mqe=f.memo(function({tool:t}){const n=t.subTools||t.subContent?c.jsx(kj,{tool:t}):c.jsx(oE,{tool:t,forceExpandable:!0,hideCollapsedOutput:!0});return c.jsx(Eqe,{timestamp:t.startTime,children:n})});function Nqe({tc:e}){const{t}=gt();return c.jsx("div",{className:Gt.line,children:c.jsxs("div",{className:Gt.lineMain,children:[c.jsx(ff,{status:e.status}),c.jsx("span",{className:Gt.lineName,children:hu(e.name,t)})]})})}function jqe(e){var t;if(e.rawOutput&&kre(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 Iqe({text:e}){const{compactThinking:t}=ou(),{t:n}=gt(),[r,s]=f.useState(!1),[i,o]=f.useState(!1),a=f.useRef(null),l=t&&!r;return f.useEffect(()=>{const u=a.current;!u||!l||(o(u.scrollHeight>u.clientHeight),u.scrollTop=u.scrollHeight)},[l,e]),f.useEffect(()=>{const u=a.current;if(!u||!l)return;const d=()=>o(u.scrollHeight>u.clientHeight),h=new ResizeObserver(d);return h.observe(u),()=>h.disconnect()},[l]),c.jsxs("div",{children:[c.jsx("pre",{ref:a,className:l?`${Ws.stream} ${Ws.streamCollapsed}`:Ws.stream,children:e}),t&&(i||r)&&c.jsx("button",{className:Ws.expandToggle,onClick:()=>s(u=>!u),"aria-expanded":r,"aria-label":n("subagent.toggleStream"),children:r?"▲":"▼"})]})}function Rqe({content:e}){const{compactThinking:t}=ou();return c.jsx("div",{className:t?Ws.scrollWindow:void 0,children:c.jsx(Wm,{content:e,source:"assistant"})})}function jz({pinTail:e,itemCount:t,children:n}){const r=f.useRef(null);return f.useEffect(()=>{const s=r.current;s&&(s.scrollTop=e?s.scrollHeight:0)},[e,t]),c.jsx("div",{ref:r,className:`${Ws.tools} ${Ws.scrollWindow}`,children:n})}function kj({tool:e,defaultExpanded:t,hideHeader:n,inline:r}){var T,S,C,_;const{t:s}=gt(),i=e.status==="completed"||e.status==="failed",o=fv(e),[a,l]=f.useState(t??!1),u=kre(e.rawOutput)?e.rawOutput:null,d=((T=e.subTools)==null?void 0:T.length)||((S=u==null?void 0:u.toolCalls)==null?void 0:S.length)||0,h=wj(e),m=xj(e),p=sx(e.startTime,e.endTime)||xre((C=u==null?void 0:u.executionSummary)==null?void 0:C.totalDurationMs),g=u!=null&&u.tokenCount&&u.tokenCount>0?u.tokenCount:(_=u==null?void 0:u.executionSummary)==null?void 0:_.outputTokens,b=g?vj(g):"",x=i?jqe(e):"",v=f.useMemo(()=>e.subTools&&e.subTools.length>0?null:(u==null?void 0:u.toolCalls)||null,[e.subTools,u]),y=!!(e.subContent||x),w=!!(e.subTools&&e.subTools.length>0||v&&v.length>0),k=i&&y&&w;return c.jsxs("div",{className:r?void 0:Ws.panel,children:[!n&&c.jsxs("div",{className:Ws.header,onClick:()=>l(!a),children:[c.jsx(ff,{status:o}),c.jsxs("span",{className:Gt.lineName,children:[m,":"]}),h&&c.jsx("span",{className:Ws.desc,children:Mi(h,50)}),i&&d>0&&c.jsxs("span",{className:Ws.meta,children:["· ",s("subagent.toolsCount",{count:d})]}),p&&c.jsxs("span",{className:Ws.meta,children:["· ",p]}),b&&c.jsxs("span",{className:Ws.meta,children:["· ",b]}),!i&&c.jsx("span",{className:Ws.toggle,children:a?"▼":"▶"})]}),(a||n)&&c.jsxs("div",{className:Ws.body,children:[i&&y&&c.jsxs("div",{className:Ws.content,children:[k&&c.jsx("div",{className:Ws.sectionCap,children:s("subagent.result")}),c.jsx(Rqe,{content:e.subContent||x})]}),k&&c.jsx("div",{className:Ws.sectionCap,children:s("subagent.tools",{count:d})}),e.subTools&&e.subTools.length>0&&c.jsx(jz,{pinTail:!i,itemCount:e.subTools.length,children:e.subTools.map(A=>c.jsx("div",{className:Ws.step,"data-status":A.status,children:c.jsx(Mqe,{tool:A})},A.callId))}),v&&v.length>0&&c.jsx(jz,{pinTail:!i,itemCount:v.length,children:v.map(A=>c.jsx("div",{className:Ws.step,"data-status":A.status,children:c.jsx(Nqe,{tc:A})},A.callId))}),!i&&e.subContent&&c.jsx("div",{className:Ws.content,children:c.jsx(Iqe,{text:e.subContent})})]})]})}const Dqe="_view_1ycry_1",Lqe="_stats_1ycry_7",Pqe="_statAdd_1ycry_16",Oqe="_statDel_1ycry_20",Bqe="_lines_1ycry_24",$qe="_line_1ycry_24",zqe="_lineAdd_1ycry_36",Fqe="_lineDel_1ycry_40",qqe="_lineHeader_1ycry_44",Hqe="_lineContext_1ycry_50",Uqe="_lineNo_1ycry_54",Vqe="_marker_1ycry_64",Wqe="_content_1ycry_79",_c={view:Dqe,stats:Lqe,statAdd:Pqe,statDel:Oqe,lines:Bqe,line:$qe,lineAdd:zqe,lineDel:Fqe,lineHeader:qqe,lineContext:Hqe,lineNo:Uqe,marker:Vqe,content:Wqe};function Gqe(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 Kqe=f.memo(function({diff:t}){if(!t)return null;const{lines:n,additions:r,deletions:s}=Gqe(t);return c.jsxs("div",{className:_c.view,children:[c.jsxs("div",{className:_c.stats,children:[r>0&&c.jsxs("span",{className:_c.statAdd,children:["+",r]}),s>0&&c.jsxs("span",{className:_c.statDel,children:["-",s]})]}),c.jsx("div",{className:_c.lines,children:n.map((i,o)=>c.jsxs("div",{className:`${_c.line} ${_c[`line${i.type[0].toUpperCase()}${i.type.slice(1)}`]}`,children:[c.jsx("span",{className:_c.lineNo,children:i.type==="header"?"":i.oldLine??i.newLine}),c.jsx("span",{className:_c.marker,children:i.type==="add"?"+":i.type==="del"?"-":i.type==="header"?"":" "}),c.jsx("span",{className:_c.content,children:i.content})]},o))})]})}),Iz={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 Yqe(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 u of l)u===0?(n=void 0,r=!1,s=!1):u===1?r=!0:u===2?s=!0:u===22?(r=!1,s=!1):u>=30&&u<=37||u>=90&&u<=97?n=Iz[u]:u===39&&(n=void 0)}return i<e.length&&t.push({text:e.slice(i),color:n,bold:r,dim:s}),t}function Xqe(e){return new RegExp(String.raw`\x1b\[`).test(e)}function Td(e){const t=e.toLowerCase();return t==="todo_write"||t==="todowrite"}function X6(e){const t=e.flatMap((n,r)=>{const s=s4(n),i=Xw(s,"content");return i?[{id:Xw(s,"id")??`plan-${r}`,content:i,status:lHe(Xw(s,"status")),priority:cHe(Xw(s,"priority"))}]:[]});return t.length>0?t:void 0}function _j(e){if(!Td(e.toolName)&&e.kind!=="other")return;const t=Dz(e.args);if(t)return X6(t);const n=s4(e.rawOutput),r=Dz(n);if(r)return X6(r);const s=Array.isArray(n==null?void 0:n.entries)?n.entries:void 0;return s?X6(s):void 0}function Qqe(e){return e.some(t=>t.status==="pending"||t.status==="in_progress")}function r4(e){switch(e){case"completed":return"●";case"in_progress":return"◐";case"pending":return"○"}}const Rz={todos:[],allCompleted:!1,sourceMessageId:null,sourceCallId:null};function Jqe(e){let t=[],n=null,r=null,s=!1;for(const o of e){if(o.role==="user"||o.role==="user_shell"){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=_j(a);l&&(t=l,n=o.id,r=a.callId,s=!1)}}if(t.length===0)return Rz;const i=!Qqe(t);return s?Rz:{todos:t,allCompleted:i,sourceMessageId:n,sourceCallId:r}}function Sj(e){return JSON.stringify([e.id,e.content])}function y3(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=_j(n);r&&t.push({key:n.callId,todos:r,stats:nHe(n)})}return t}return[]}function Zqe(e){const t=new Map,n=new Map;for(const r of e)for(const{key:s,todos:i}of y3(r)){const o=[];for(const a of i){const l=Sj(a),u=n.get(l);a.status==="in_progress"&&u!=="in_progress"?o.push({kind:"started",id:a.id,content:a.content}):a.status==="completed"&&u!=="completed"&&u!==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 y3(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)!Td(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 y3(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=s4((o=s4(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(Td(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 u=t.get(l);return u||(u={},t.set(l,u)),u};for(const l of e){const u=l.timestamp;for(const{todos:d,stats:h}of y3(l))for(const m of d){const p=Sj(m),g=n.get(p);if(m.status==="in_progress"&&g!=="in_progress")s.has(p)&&(s.delete(p),r.delete(p),t.delete(p)),r.get(p)===void 0&&(r.set(p,h),u!==void 0&&(o(p).startTs=u));else if(m.status==="completed"&&g!=="completed"&&g!==void 0){const b=r.get(p),x=b&&h?iHe(b,h):void 0,v=(a=t.get(p))==null?void 0:a.startTs,y=v!==void 0&&u!==void 0?sHe(i,v,u):void 0,w=oHe(x,y);if(u!==void 0||w){const k=o(p);u!==void 0&&(k.endTs=u),w&&(k.resources=w)}}m.status==="completed"&&s.add(p),n.set(p,m.status)}}return t}function Dz(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 s4(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Xw(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}const t2=new Set;let rb=null,_re=Date.now();function uHe(){_re=Date.now();for(const e of t2)e()}function dHe(e){return t2.add(e),rb||(rb=setInterval(uHe,1e3)),()=>{t2.delete(e),t2.size===0&&rb&&(clearInterval(rb),rb=null)}}function Cj(e){const[t,n]=f.useState(()=>Date.now());return f.useEffect(()=>{if(e)return n(Date.now()),dHe(()=>n(_re))},[e]),t}const hHe="_list_1bo8s_1",fHe="_summary_1bo8s_2",mHe="_row_1bo8s_8",pHe="_num_1bo8s_16",gHe="_icon_1bo8s_23",bHe="_text_1bo8s_29",yHe="_inProgress_1bo8s_43",vHe="_completed_1bo8s_48",xHe="_item_1bo8s_62",wHe="_rowButton_1bo8s_69",kHe="_detailChevron_1bo8s_82",_He="_detail_1bo8s_82",SHe="_detailSection_1bo8s_100",CHe="_detailSectionTitle_1bo8s_106",THe="_detailRows_1bo8s_114",AHe="_detailLabel_1bo8s_122",EHe="_detailValue_1bo8s_126",MHe="_detailDuration_1bo8s_132",NHe="_detailHint_1bo8s_136",zr={list:hHe,summary:fHe,row:mHe,num:pHe,icon:gHe,text:bHe,inProgress:yHe,completed:vHe,item:xHe,rowButton:wHe,detailChevron:kHe,detail:_He,detailSection:SHe,detailSectionTitle:CHe,detailRows:THe,detailLabel:AHe,detailValue:EHe,detailDuration:MHe,detailHint:NHe};function sE(e){switch(e){case"completed":return zr.completed;case"in_progress":return zr.inProgress;case"pending":return""}}function Sre({todos:e,events:t}){const{t:n}=gt();if(t.length===0){if(e.length>0&&e.every(i=>i.status==="completed"))return c.jsx("div",{className:zr.summary,children:c.jsxs("div",{className:`${zr.row} ${zr.completed}`,children:[c.jsx("span",{className:zr.icon,"aria-hidden":"true",children:"✓"}),c.jsx("span",{className:zr.text,children:n("todo.allDone")})]})});const s=e.find(i=>i.status==="in_progress")??e.find(i=>i.status==="pending");return s?c.jsx("div",{className:zr.summary,children:c.jsxs("div",{className:`${zr.row} ${sE(s.status)}`,children:[c.jsx("span",{className:zr.icon,"aria-hidden":"true",children:r4(s.status)}),c.jsx("span",{className:zr.text,children:s.content})]})}):null}return c.jsx("div",{className:zr.summary,children:t.map(r=>c.jsxs("div",{className:`${zr.row} ${r.kind==="completed"?zr.completed:zr.inProgress}`,children:[c.jsx("span",{className:zr.icon,"aria-hidden":"true",children:r4(r.kind==="completed"?"completed":"in_progress")}),c.jsx("span",{className:zr.text,children:r.content})]},`${r.kind}-${r.id}`))})}function em({label:e,value:t,suffix:n}){return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:zr.detailLabel,children:e}),c.jsxs("span",{className:zr.detailValue,children:[t,n]})]})}function Q6({title:e,children:t}){return c.jsxs("div",{className:zr.detailSection,children:[c.jsx("div",{className:zr.detailSectionTitle,children:e}),c.jsx("div",{className:zr.detailRows,children:t})]})}function jHe({detail:e}){const{t}=gt(),{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 c.jsxs("div",{className:zr.detail,children:[i&&c.jsxs(Q6,{title:t("todo.detail.sectionTime"),children:[n!==void 0&&c.jsx(em,{label:t("todo.detail.start"),value:hg(n)}),r!==void 0&&c.jsx(em,{label:t("todo.detail.end"),value:hg(r),suffix:n!==void 0?c.jsxs("span",{className:zr.detailDuration,children:[" ","(",$h(r-n),")"]}):void 0})]}),o&&c.jsxs(Q6,{title:t("todo.detail.sectionTokens"),children:[c.jsx(em,{label:t("todo.detail.input"),value:((s==null?void 0:s.inputTokens)??0).toLocaleString()}),c.jsx(em,{label:t("todo.detail.output"),value:((s==null?void 0:s.outputTokens)??0).toLocaleString()}),c.jsx(em,{label:t("todo.detail.cached"),value:((s==null?void 0:s.cachedTokens)??0).toLocaleString()})]}),a&&c.jsxs(Q6,{title:t("todo.detail.sectionSpent"),children:[(s==null?void 0:s.apiTimeMs)!==void 0&&c.jsx(em,{label:t("todo.detail.api"),value:$h(s.apiTimeMs)}),(s==null?void 0:s.toolTimeMs)!==void 0&&c.jsx(em,{label:t("todo.detail.tool"),value:$h(s.toolTimeMs)})]}),!s&&c.jsx("div",{className:zr.detailHint,children:t("todo.detail.noResources")})]})}function IHe(e){return!!e&&(e.endTs!==void 0||e.resources!==void 0)}function Cre({todos:e,numbered:t=!1}){const{t:n}=gt(),r=f.useContext(hie),[s,i]=f.useState(()=>new Set),o=`${String(e.length).length+1}ch`,a=l=>i(u=>{const d=new Set(u);return d.has(l)?d.delete(l):d.add(l),d});return c.jsx("div",{className:zr.list,children:e.map((l,u)=>{const d=l.id||String(u),h=r.get(Sj(l)),m=IHe(h),p=m&&s.has(d),g=c.jsxs(c.Fragment,{children:[t&&c.jsxs("span",{className:zr.num,style:{minWidth:o},children:[u+1,"."]}),c.jsx("span",{className:zr.icon,"aria-hidden":"true",children:r4(l.status)}),c.jsx("span",{className:zr.text,children:l.content}),m&&c.jsx("span",{className:zr.detailChevron,"aria-hidden":"true",children:p?"▾":"▸"})]});return c.jsxs("div",{className:zr.item,children:[m?c.jsx("button",{type:"button",className:`${zr.row} ${zr.rowButton} ${sE(l.status)}`,onClick:b=>{b.stopPropagation(),a(d)},"aria-expanded":p,title:n(p?"todo.detail.hide":"todo.detail.show"),children:g}):c.jsx("div",{className:`${zr.row} ${sE(l.status)}`,children:g}),p&&h&&c.jsx(jHe,{detail:h})]},d)})})}function RHe(e){const t=e.toolName.toLowerCase();if(lc(e.toolName))return!!Jc(e);if(t==="write_file"||t==="writefile")return!!XHe(e)||Lz(e);if(e.status!=="completed"&&e.status!=="failed")return!1;if(Ga(t)){const n=Jc(e);return!!n&&n.trim().length>0&&n.split(`
`).length>1}if(g3(t))return!!Are(e);if(t==="edit"||t==="write"||t==="editfile")return Lz(e);if(t==="read"||t==="read_file"||t==="readfile"){const n=Jc(e);return!!n&&n.split(`
`).length>3}return!1}function DHe(e){const t=e.toolName.toLowerCase();return Ga(t)||t==="write_file"||t==="writefile"||t==="edit"||t==="write"||t==="editfile"||t==="read"||t==="read_file"||t==="readfile"||g3(t)||lc(e.toolName)}function LHe(e){var t;return(t=e.content)!=null&&t.some(n=>n.type==="diff")?!0:!!Tre(e)}function Lz(e){return LHe(e)||!!Jc(e)}function PHe(e){const t=Tre(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 Tre(e){if(e.rawOutput&&typeof e.rawOutput=="object"){const t=e.rawOutput;if(OHe(t))return"";if(typeof t.fileDiff=="string")return t.fileDiff}return""}function OHe(e){return e.truncatedForSession===!0&&"fileName"in e&&"newContent"in e}const BHe=25e4;function $He(e,t){const n=e.split(`
`),r=t.split(`
`),s=n.length,i=r.length;if(s*i>BHe){const d=n.map(m=>m?`-${m}`:"-"),h=r.map(m=>m?`+${m}`:"+");return[...d,...h].join(`
`)}const o=Array.from({length:s+1},()=>Array(i+1).fill(0));for(let d=1;d<=s;d++)for(let h=1;h<=i;h++)o[d][h]=n[d-1]===r[h-1]?o[d-1][h-1]+1:Math.max(o[d-1][h],o[d][h-1]);const a=[];let l=s,u=i;for(;l>0||u>0;)l>0&&u>0&&n[l-1]===r[u-1]?(a.push(` ${n[l-1]}`),l--,u--):u>0&&(l===0||o[l][u-1]>=o[l-1][u])?(a.push(`+${r[u-1]}`),u--):(a.push(`-${n[l-1]}`),l--);return a.reverse().join(`
`)}const zHe=60,FHe=2e5,qHe=1e3,HHe={cjs:"javascript",cts:"typescript",h:"c",hpp:"cpp",js:"javascript",jsx:"jsx",mjs:"javascript",mts:"typescript",py:"python",rb:"ruby",sh:"bash",ts:"typescript",tsx:"tsx",yml:"yaml"};function UHe({tool:e}){const t=f.useMemo(()=>Jc(e)||"",[e]),n=f.useMemo(()=>Xqe(t)?Yqe(t):null,[t]);return c.jsx("div",{className:Gt.expandedBash,children:c.jsx("pre",{className:Gt.expandedOutput,children:n?n.map((r,s)=>c.jsx("span",{style:{color:r.color,fontWeight:r.bold?"bold":void 0,opacity:r.dim?.6:void 0},children:r.text},s)):t})})}function VHe({tool:e}){const t=f.useMemo(()=>Jc(e)||"",[e]),n=KHe(WHe(e)),r=n==="text"||t.length>FHe||GHe(t,qHe);return c.jsx("div",{className:Gt.expandedRead,children:r?c.jsx("pre",{className:Gt.expandedOutput,children:t}):c.jsx(Wm,{content:YHe(n,t)})})}function WHe(e){var n,r;const t=((n=e.args)==null?void 0:n.file_path)??((r=e.args)==null?void 0:r.path);return typeof t=="string"?t:""}function GHe(e,t){let n=1;for(let r=0;r<e.length;r++)if(e.charCodeAt(r)===10&&++n>t)return!0;return!1}function KHe(e){var r,s;const t=(s=(r=e.split(/[?#]/,1)[0])==null?void 0:r.split(".").pop())==null?void 0:s.toLowerCase();if(!t||t===e.toLowerCase()||t==="mermaid"||t==="mmd")return"text";const n=HHe[t]??t;return/^[\w+.#-]+$/.test(n)?n:"text"}function YHe(e,t){var s;const n=((s=t.match(/~{3,}/g))==null?void 0:s.reduce((i,o)=>Math.max(i,o.length),0))??0,r="~".repeat(Math.max(3,n+1));return`${r}${e}
${t}
${r}`}function Pz({tool:e}){const t=f.useMemo(()=>PHe(e),[e]),n=f.useMemo(()=>Jc(e)||"",[e]);return!t&&!n?null:c.jsx("div",{className:Gt.expandedEdit,children:t?c.jsx(Kqe,{diff:t}):c.jsx("pre",{className:Gt.expandedOutput,children:n})})}function iE({title:e,detail:t,children:n}){return c.jsxs("div",{className:Gt.expandedCard,children:[c.jsxs("div",{className:Gt.expandedCardHeader,children:[c.jsx("span",{className:Gt.expandedCardTitle,children:e}),t&&c.jsx("span",{className:Gt.expandedCardDetail,children:t})]}),n&&c.jsx("div",{className:Gt.expandedCardBody,children:n})]})}function XHe(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=Jc(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 QHe({tool:e,todos:t,expanded:n,title:r}){var o;const i=((o=f.useContext(Fj).get(e.callId))==null?void 0:o.events)??[];return n?c.jsx(iE,{title:r,children:c.jsx("div",{className:Gt.todoBody,children:c.jsx(Cre,{todos:t})})}):c.jsx("div",{className:Gt.todoBody,children:c.jsx(Sre,{todos:t,events:i})})}function JHe(e,t){var p,g;const n=rx(e.rawOutput),r=yj(e),s=fv(e),i=xj(e),o=ZHe(e),a=wj(e),l=((p=e.subTools)==null?void 0:p.length)||((g=n==null?void 0:n.toolCalls)==null?void 0:g.length)||0,u=n==null?void 0:n.executionSummary,d=u&&typeof u.totalDurationMs=="number"?xre(u.totalDurationMs):sx(e.startTime,e.endTime??(e.status==="in_progress"&&t?t:void 0)),h=n&&typeof n.tokenCount=="number"&&n.tokenCount>0?n.tokenCount:u&&typeof u.outputTokens=="number"&&u.outputTokens>0?u.outputTokens:0,m=h>0?vj(h):"";return{agentType:i,explicitAgentType:o,description:a,subToolCount:l,elapsed:d,tokens:m,status:s,reason:r}}function ZHe(e){var s;const t=rx(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 Oz(e){if(e.status==="completed")return!1;const t=e.toolName.toLowerCase();return!!(lc(e.toolName)||t==="write_file"||t==="writefile"||t==="edit"||t==="editfile"||Ga(t))}function eUe({tool:e}){const t=Jc(e)||"";return c.jsx("pre",{className:Gt.expandedOutput,children:t})}function tUe({tool:e}){var n;const t=Are(e)||(typeof((n=e.args)==null?void 0:n.args)=="string"&&e.args.args.trim()?e.args.args.trim():e.title??"");return c.jsx("pre",{className:Gt.expandedOutput,children:t})}function Are(e){var n,r;const t=(n=e.content)==null?void 0:n[0];return(t==null?void 0:t.type)!=="content"?"":typeof((r=t.content)==null?void 0:r.text)=="string"?t.content.text:""}function v3(e){const t=e.toolName.toLowerCase();return X4(e)?"agent":lc(e.toolName)?"ask":Ga(t)?"shell":Aj(t)?"fetch":Td(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 nUe({description:e,elapsed:t}){return c.jsxs(c.Fragment,{children:[e&&c.jsx("span",{className:Gt.lineArg,children:e}),t&&c.jsx("span",{className:Gt.lineElapsed,children:t})]})}function i4({info:e}){const{renderToolHeaderExtra:t}=ou(),n=t==null?void 0:t(e);return n?c.jsx(c.Fragment,{children:n}):c.jsx(nUe,{description:e.description,elapsed:e.elapsed})}function rUe(e){return e.length>zHe||e.includes(`
`)}function x3(e){return e==="in_progress"||e==="pending"||e==="running"}function Tj(e){return e.find(t=>x3(t.status))??e[e.length-1]}function sUe(e,t,n){if(Nre(e)){const s=Tj(e);return lc(s.toolName)?t("toolGroup.summary.provideInformation"):t("toolGroup.running",{name:hu(s.toolName,t),count:e.length,duration:n??""})}const r=aUe(e,t);return r||t("toolGroup.summary",{count:e.length})}function iUe(e,t,n){if(Td(e.toolName))return t("toolGroup.summary.updatedTodos",{count:1});if(lc(e.toolName))return x3(e.status)?t("toolGroup.summary.provideInformation"):t("toolGroup.summary.askedQuestions",{count:Mre(e)});const{displayName:r,description:s,hideDisplayName:i}=Ere(e,t,n);return[i?"":r,s].filter(Boolean).join(" ")}function Ere(e,t,n){const r=hu(e.toolName,t),s=Mi(dre(e,n),120);return{kind:v3(e),tool:e,displayName:r,description:s,elapsed:"",workspaceCwd:n,hideDisplayName:!!nBe(e)}}function oUe({tool:e,runningDuration:t,workspaceCwd:n}){const{t:r}=gt(),s=lc(e.toolName),i=!s&&x3(e.status)&&r("toolGroup.runningPrefix").trim();if(Td(e.toolName)||s)return c.jsxs(c.Fragment,{children:[i&&c.jsxs("span",{children:[i," "]}),iUe(e,r,n),t&&c.jsxs("span",{children:[" ",t]})]});const o=Ere(e,r,n);return c.jsxs(c.Fragment,{children:[i&&c.jsxs("span",{children:[i," "]}),c.jsxs("span",{className:Gt.chatSummaryInline,children:[!o.hideDisplayName&&c.jsx("span",{className:Gt.lineName,children:o.displayName}),c.jsx(i4,{info:o})]}),t&&c.jsxs("span",{children:[" ",t]})]})}function aUe(e,t){let n=0,r=0,s=0,i=0,o=0,a=0,l=0;for(const d of e){const h=d.toolName.toLowerCase();Ga(h)?r++:h==="edit"||h==="editfile"||h==="write"||h==="write_file"||h==="writefile"?n++:h==="read"||h==="read_file"||h==="readfile"?s++:h==="grep"||h==="grep_search"||h==="search"||h==="glob"||h==="web_search"||h==="websearch"?i++:Td(h)?o++:lc(h)?a+=Mre(d):l++}return[n?t("toolGroup.summary.editedFiles",{count:n}):"",r?t("toolGroup.summary.ranCommands",{count:r}):"",s?t("toolGroup.summary.readFiles",{count:s}):"",i?t("toolGroup.summary.searched",{count:i}):"",o?t("toolGroup.summary.updatedTodos",{count:o}):"",a?t("toolGroup.summary.askedQuestions",{count:a}):"",l?t("toolGroup.summary.otherTools",{count:l}):""].filter(Boolean).join(" ")}function Mre(e){var n;const t=(n=e.args)==null?void 0:n.questions;return Array.isArray(t)&&t.length>0?t.length:1}function Nre(e){return e.some(t=>x3(t.status))}function lUe(){return c.jsxs("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("path",{d:"M12 20h9"}),c.jsx("path",{d:"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function jre(){return c.jsxs("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","data-testid":"chat-summary-tool-icon","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.4",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M4.6 5.2 6 6.6 4.6 8",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M7.3 8.1h2.1",stroke:"currentColor",strokeWidth:"1.05",strokeLinecap:"round"})]})}function cUe(){return c.jsxs("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"5.5",stroke:"currentColor",strokeWidth:"1.25"}),c.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 uUe(){return c.jsxs("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"1.6",width:"10",height:"10.8",rx:"2.2",stroke:"currentColor",strokeWidth:"1.25"}),c.jsx("path",{d:"M4.5 5.2h5M4.5 7h5M4.5 8.8h5",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function dUe(){return c.jsx("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:c.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 hUe(){return c.jsx("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3.4 3.2h7.2c.7 0 1.25.55 1.25 1.25v3.4c0 .7-.55 1.25-1.25 1.25H7.5L4.5 11V9.1H3.4c-.7 0-1.25-.55-1.25-1.25v-3.4c0-.7.55-1.25 1.25-1.25Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function fUe(){return c.jsx("svg",{className:Gt.chatSummaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:c.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 mUe({tool:e}){const t=v3(e);return t==="agent"?c.jsx(fUe,{}):t==="ask"?c.jsx(hUe,{}):t==="edit"||t==="write"?c.jsx(lUe,{}):t==="fetch"?c.jsx(cUe,{}):t==="read"?c.jsx(uUe,{}):t==="todo"?c.jsx(dUe,{}):c.jsx(jre,{})}function Aj(e){const t=e.toLowerCase();return t==="web_fetch"||t==="webfetch"||t==="fetch"}const pUe=fv;function gUe({tools:e,workspaceCwd:t,isLocateFlashing:n=!1}){const{t:r}=gt(),s=Tj(e),i=hu(s.toolName,r),o=pUe(s),a=bj(s,t),l=Ga(s.toolName)||Aj(s.toolName)?"":sx(s.startTime,s.endTime);return c.jsxs("div",{className:`${Gt.compactGroup}${n?` ${lf.flash}`:""}`,children:[c.jsxs("div",{className:Gt.compactHeader,children:[c.jsx(ff,{status:o}),c.jsx("span",{className:Gt.lineName,children:i}),e.length>1&&c.jsxs("span",{className:Gt.compactCount,children:["× ",e.length]}),c.jsx(i4,{info:{kind:v3(s),tool:s,displayName:i,description:a,elapsed:l,workspaceCwd:t}})]}),c.jsx("div",{className:Gt.compactHint,children:r("compact.hint")})]})}function bUe(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.summaryOnly!==t.summaryOnly||e.forceExpanded!==t.forceExpanded||e.forceExpandable!==t.forceExpandable||e.hideHeader!==t.hideHeader||e.hideCollapsedOutput!==t.hideCollapsedOutput)return!1;const n=e.tool,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&&yUe(n.subTools,r.subTools)}function yUe(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 Bz=/\[([^\]]+)\]\(qwen-session:\/\/([^)]+)\)/g;function J6(e){if(!e||!e.includes("qwen-session://"))return e;const t=[];let n=0,r;for(Bz.lastIndex=0;(r=Bz.exec(e))!==null;){r.index>n&&t.push(e.slice(n,r.index));const s=r[2];t.push(c.jsx("a",{href:"#",role:"button",style:{textDecoration:"underline",cursor:"pointer"},onClick:i=>{i.preventDefault(),i.stopPropagation(),window.dispatchEvent(new CustomEvent("qwen:open-session",{detail:s}))},children:r[1]},r.index)),n=r.index+r[0].length}return n<e.length&&t.push(e.slice(n)),t.length===1?t[0]:c.jsx(c.Fragment,{children:t})}const oE=f.memo(function({tool:t,approval:n,workspaceCwd:r,summaryOnly:s=!1,forceExpanded:i=!1,forceExpandable:o=!1,hideHeader:a=!1,hideCollapsedOutput:l=!1}){const{t:u}=gt(),d=f.useContext(ip),[h,m]=f.useState(()=>i||!d&&Oz(t)),p=f.useRef(!1);f.useEffect(()=>{m(i||(d?!1:Oz(t))),p.current=!1},[d,i,t.callId,t.toolName]);const g=X4(t),b=n&&n.toolCallId===t.callId,x=!b&&(n==null?void 0:n.toolCallId)&&g&&nc(t,n.toolCallId),v=g&&t.status==="in_progress",y=Cj(v);if(f.useEffect(()=>{!i&&!g&&t.status==="completed"&&!p.current&&m(!1)},[i,g,t.status]),g){const oe=JHe(t,y),J=oe.explicitAgentType?`${u("agent.label")} (${oe.explicitAgentType})`:u("agent.label"),V=t.status==="completed"||t.status==="failed",Z=[t.status==="pending"?u("subagent.pending"):u("subagent.running"),oe.elapsed].filter(Boolean).join(" · "),X=[oe.subToolCount>0?u("subagent.toolsCount",{count:oe.subToolCount}):"",oe.elapsed,oe.tokens,oe.reason?Mi(oe.reason,80):""].filter(Boolean).join(" · "),te=i||h||!!b||!!x,ae=c.jsx(kj,{tool:t,hideHeader:!0,defaultExpanded:!0,inline:!0});return c.jsxs("div",{className:Gt.line,children:[!a&&c.jsxs("div",{className:`${Gt.lineMain} ${Gt.lineExpandable}`,onClick:()=>m(!h),children:[c.jsx(ff,{status:V?oe.status:t.status}),c.jsx("span",{className:Gt.lineName,children:J}),c.jsx(i4,{info:{kind:"agent",tool:t,displayName:J,description:oe.description?Mi(oe.description,60):"",elapsed:V?X:Z,workspaceCwd:r}}),c.jsx("span",{className:h?Gt.lineChevronDown:Gt.lineChevronRight,"aria-hidden":"true"})]}),te&&c.jsx("div",{className:Gt.lineDetail,children:a?c.jsx("div",{className:Gt.expandedAgentCard,children:ae}):ae})]})}const w=bj(t,r),k=rBe(t),S=s&&Ga(t.toolName)?dre(t,r):w,C=hu(t.toolName,u),_=Ga(t.toolName)||Aj(t.toolName)?"":sx(t.startTime,t.endTime),A=t.toolName.toLowerCase(),M=Td(A),L=M?_j(t):void 0,N=!!L&&L.length>0,O=L?L.filter(oe=>oe.status==="completed").length:0,B=Ga(A),$=A==="grep"||A==="grep_search"||A==="search"||A==="glob",P=A==="read"||A==="read_file"||A==="readfile",K=!M&&rUe(S),F=!i&&(o||(M?N:RHe(t)||K)),H=DHe(t),D=h&&K,Q=P,U=D&&!B&&!$&&!P,j=w,ie=!M&&h&&!H&&(D||k);return c.jsxs("div",{className:Gt.line,children:[!a&&c.jsxs("div",{className:`${Gt.lineMain} ${F?Gt.lineExpandable:""}`,title:F?u(h?"tool.collapseHint":"tool.expand"):void 0,"aria-expanded":F?h:void 0,role:F?"button":void 0,tabIndex:F?0:void 0,onClick:F?()=>{p.current=!0,m(oe=>!oe)}:void 0,onKeyDown:F?oe=>{oe.key!=="Enter"&&oe.key!==" "||(oe.preventDefault(),p.current=!0,m(J=>!J))}:void 0,children:[c.jsx(ff,{status:t.status}),c.jsx("span",{className:Gt.lineName,children:C}),M&&N&&c.jsxs("span",{className:Gt.todoProgress,children:[O,"/",L.length]}),c.jsx(i4,{info:{kind:v3(t),tool:t,displayName:C,description:M||U?"":S,elapsed:M?"":_,workspaceCwd:r}}),F&&c.jsx("span",{className:h?Gt.lineChevronDown:Gt.lineChevronRight,"aria-hidden":"true"})]}),(!s||h)&&M&&N&&c.jsx(QHe,{tool:t,todos:L,expanded:h,title:C}),(!s||h)&&M&&!N&&k&&c.jsx("div",{className:Gt.lineOutput,children:J6(k)}),ie&&c.jsx(iE,{title:C,detail:j,children:k&&c.jsx("div",{className:`${Gt.lineOutput} ${Gt.expandedLineOutput}`,children:J6(k)})}),!M&&!l&&k&&!ie&&(!h||!H)&&(!s||h)&&c.jsx("div",{className:h?`${Gt.lineOutput} ${Gt.expandedLineOutput}`:Gt.lineOutput,children:J6(k)}),!M&&h&&H&&c.jsx("div",{className:Q?`${Gt.lineDetail} ${Gt.markdownLineDetail}`:Gt.lineDetail,children:P?c.jsx(VHe,{tool:t}):c.jsxs(iE,{title:C,detail:j,children:[Ga(A)&&c.jsx(UHe,{tool:t}),(A==="write_file"||A==="writefile")&&c.jsx(Pz,{tool:t}),(A==="edit"||A==="write"||A==="editfile")&&c.jsx(Pz,{tool:t}),lc(t.toolName)&&c.jsx(eUe,{tool:t}),g3(A)&&c.jsx(tUe,{tool:t})]})})]})},bUe),vUe=f.memo(function({tools:t,pendingApproval:n,workspaceCwd:r,isLocateFlashing:s=!1}){const{t:i}=gt(),o=f.useContext(ip),[a,l]=f.useState(!1),u=Nre(t),d=t.some(w=>w.status==="failed"),h=t.length>0?Tj(t):void 0,m=t.length===1?t[0]:void 0,p=t[0]??h,g=f.useRef(Date.now()),b=Cj(u),x=(n==null?void 0:n.toolCallId)&&t.some(w=>nc(w,n.toolCallId)),v=o&&!x,y=u?wre(b-g.current):void 0;return f.useEffect(()=>{u&&(g.current=Date.now())},[u,h==null?void 0:h.callId]),v?c.jsx(gUe,{tools:t,workspaceCwd:r,isLocateFlashing:s}):x?c.jsx("div",{className:`${Gt.group}${s?` ${lf.flash}`:""}`,children:t.map(w=>c.jsx(oE,{tool:w,approval:n,workspaceCwd:r},w.callId))}):c.jsxs("div",{className:s?lf.flash:void 0,children:[c.jsxs("button",{type:"button",className:Gt.chatSummary,onClick:()=>l(w=>!w),"aria-expanded":a,title:i(a?"tool.collapseHint":"tool.expand"),children:[c.jsx("span",{className:Gt.chatSummaryIcon,"aria-hidden":"true",children:p?c.jsx(mUe,{tool:p}):c.jsx(jre,{})}),d&&c.jsx(ff,{status:"failed"}),c.jsx("span",{className:u?`${Gt.chatSummaryText} ${Gt.chatSummaryTextActive}`:Gt.chatSummaryText,children:m?c.jsx(oUe,{tool:m,runningDuration:u?y:void 0,workspaceCwd:r}):sUe(t,i,y)}),c.jsx("span",{className:a?Gt.chatChevronDown:Gt.chatChevronRight,"aria-hidden":"true"})]}),c.jsx("div",{className:a?Gt.chatSummaryContentClip:`${Gt.chatSummaryContentClip} ${Gt.chatSummaryContentCollapsed}`,children:c.jsx("div",{className:Gt.chatSummaryContentInner,children:c.jsx("div",{className:`${Gt.group} ${Gt.chatSummaryGroup}`,children:t.map(w=>c.jsx(oE,{tool:w,approval:n,workspaceCwd:r,summaryOnly:!m,forceExpanded:!!m,hideHeader:!!m},w.callId))})})})]})}),xUe="_message_kwepu_1",wUe="_header_kwepu_6",kUe="_chevron_kwepu_20",_Ue="_title_kwepu_26",SUe="_progress_kwepu_35",sb={message:xUe,header:wUe,chevron:kUe,title:_Ue,progress:SUe};function CUe({id:e,todos:t}){var s;const r=((s=f.useContext(Fj).get(e))==null?void 0:s.events)??[];return c.jsx(Sre,{todos:t,events:r})}const TUe=f.memo(function({id:t,todos:n,isLocateFlashing:r=!1}){const{t:s}=gt(),[i,o]=f.useState(!1);if(n.length===0)return null;const a=n.length,l=n.filter(u=>u.status==="completed").length;return c.jsxs("div",{className:`${sb.message}${r?` ${lf.flash}`:""}`,children:[c.jsxs("button",{type:"button",className:sb.header,onClick:()=>o(u=>!u),"aria-expanded":i,title:s(i?"todo.collapse":"todo.expand"),children:[c.jsx("span",{className:sb.chevron,"aria-hidden":"true",children:i?"▾":"▸"}),c.jsx("span",{className:sb.title,children:s("plan.title")}),c.jsxs("span",{className:sb.progress,children:[l,"/",a]})]}),i?c.jsx(Cre,{todos:n,numbered:!0}):c.jsx(CUe,{id:t,todos:n})]})}),AUe="_message_1abcu_1",EUe="_content_1abcu_11",MUe="_question_1abcu_17",NUe="_prefix_1abcu_24",jUe="_answer_1abcu_28",IUe="_pending_1abcu_32",RUe="_shortcuts_1abcu_36",tm={message:AUe,content:EUe,question:MUe,prefix:NUe,answer:jUe,pending:IUe,shortcuts:RUe},Ire=f.memo(function({question:t,answer:n,isPending:r}){const{t:s}=gt();return c.jsxs("div",{className:tm.message,children:[c.jsxs("div",{className:tm.content,children:[c.jsxs("div",{className:tm.question,children:[c.jsx("span",{className:tm.prefix,children:"/btw "}),c.jsx("span",{children:t})]}),c.jsx("div",{className:tm.answer,children:r?c.jsx("span",{className:tm.pending,children:s("btw.answering")}):c.jsx(Wm,{content:n})})]}),c.jsx("div",{className:tm.shortcuts,children:s(r?"btw.shortcuts.pending":"btw.shortcuts.done")})]})}),DUe="_message_1q4dw_1",LUe="_compact_1q4dw_16",PUe="_header_1q4dw_21",OUe="_status_1q4dw_30",BUe="_name_1q4dw_35",$Ue="_command_1q4dw_42",zUe="_output_1q4dw_51",FUe="_compactHint_1q4dw_62",Eu={message:DUe,compact:LUe,header:PUe,status:OUe,name:BUe,command:$Ue,output:zUe,compactHint:FUe},qUe=f.memo(function({command:t,output:n}){const r=f.useContext(ip),{t:s}=gt();return c.jsxs("div",{className:r?`${Eu.message} ${Eu.compact}`:Eu.message,children:[c.jsxs("div",{className:Eu.header,children:[c.jsx("span",{className:Eu.status,children:"✓"}),c.jsx("span",{className:Eu.name,children:s("shell.command")}),t&&c.jsx("span",{className:Eu.command,children:t})]}),r?c.jsx("div",{className:Eu.compactHint,children:s("compact.hint")}):n&&c.jsx("pre",{className:Eu.output,children:n})]})}),HUe="_progress_1j3ys_1",UUe="_spinner_1j3ys_12",VUe="_bar_1j3ys_19",WUe="_stage_1j3ys_25",GUe="_icon_1j3ys_29",KUe="_done_1j3ys_35",YUe="_error_1j3ys_43",XUe="_detail_1j3ys_51",QUe="_path_1j3ys_56",$i={progress:HUe,spinner:UUe,bar:VUe,stage:WUe,icon:GUe,done:KUe,error:YUe,detail:XUe,path:QUe},$z=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧"];function JUe({progress:e}){const{stage:t,progress:n,detail:r,isComplete:s,error:i}=e,[o,a]=f.useState(0),l=30,u=Math.round(n/100*l),d=l-u,h="█".repeat(Math.max(0,u))+"░".repeat(Math.max(0,d));return f.useEffect(()=>{if(s||i)return;const m=setInterval(()=>{a(p=>(p+1)%$z.length)},120);return()=>clearInterval(m)},[s,i]),i?c.jsxs("div",{className:`${$i.progress} ${$i.error}`,children:[c.jsx("span",{className:$i.icon,children:"✕"}),c.jsx("span",{className:$i.stage,children:t}),c.jsx("div",{className:$i.detail,children:i})]}):s?c.jsxs("div",{className:`${$i.progress} ${$i.done}`,children:[c.jsx("span",{className:$i.icon,children:"✓"}),c.jsx("span",{className:$i.stage,children:t})]}):c.jsxs("div",{className:$i.progress,children:[c.jsx("span",{className:$i.spinner,children:$z[o]}),c.jsx("span",{className:$i.bar,children:h}),c.jsxs("span",{className:$i.stage,children:[t,r?` (${r})`:""]})]})}function ZUe({path:e}){const{t}=gt();return c.jsxs("div",{className:`${$i.progress} ${$i.done}`,children:[c.jsx("span",{className:$i.icon,children:"✓"}),c.jsx("span",{className:$i.stage,children:t("insight.ready")}),c.jsx("span",{className:$i.path,children:e})]})}const eVe=f.memo(function({message:t,pendingApproval:n,onShowContextDetail:r,workspaceCwd:s,isLatest:i=!1,showRetryHint:o=!1,onRetryClick:a,onBranchSession:l,showAssistantActions:u=!1,showAssistantBranch:d=!1,isLocateFlashing:h=!1,assistantTurnFooterInfo:m,generateContent:p}){const{t:g}=gt(),b=(()=>{switch(t.role){case"user":return c.jsx(xMe,{content:t.content,images:t.images,inputAnnotations:t.inputAnnotations,isLocateFlashing:h});case"assistant":return c.jsx(hOe,{content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,onBranchSession:l,showFooterActions:u,showBranchAction:d,isLocateFlashing:h,customFooterInfo:m});case"thinking":return c.jsx(bOe,{messageId:t.id,content:t.content,isStreaming:t.isStreaming,timestamp:t.timestamp,isLocateFlashing:h,generateContent:p});case"tool_group":return c.jsx(vUe,{tools:t.tools,pendingApproval:n,workspaceCwd:s,isLocateFlashing:h});case"plan":return c.jsx(TUe,{id:t.id,todos:t.todos,isLocateFlashing:h});case"system":return c.jsx(kFe,{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 c.jsx(qUe,{command:t.command,output:t.output});case"btw":return c.jsx(Ire,{question:t.question,answer:t.answer,isPending:t.isPending});case"insight_progress":return c.jsx(JUe,{progress:{stage:t.stage,progress:t.progress,detail:t.detail}});case"insight_ready":return c.jsx(ZUe,{path:t.path});case"insight_error":return c.jsx("div",{style:{color:"var(--error-color, #e06c75)"},children:t.error});default:return null}})();if(b===null)return null;const x=c.jsx(ld,{label:`message:${t.role}`,resetKeys:[t],fallback:c.jsx(tVe,{align:t.role==="user"?"end":"start"}),children:b}),v=c.jsx("div",{"data-user-selectable":"true",style:{display:"contents"},children:x});return t.role==="assistant"?u?v:c.jsx(K8,{timestamp:t.timestamp,children:v}):t.role==="system"&&t.source==="prompt_cancelled"?v:c.jsx(K8,{timestamp:t.timestamp,chatMode:t.role==="user",copyText:t.role==="user"?t.content:void 0,copyTitle:g("common.copy"),children:v})},nVe);function tVe({align:e}){const{t}=gt();return c.jsx("div",{role:"alert",style:{display:"flex",justifyContent:e==="end"?"flex-end":"flex-start"},children:c.jsx("span",{style:{color:"var(--error-color, #e06c75)",fontSize:"0.85em",opacity:.85},children:t("message.renderError")})})}function nVe(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.isLocateFlashing!==t.isLocateFlashing||e.generateContent!==t.generateContent||!rVe(e.assistantTurnFooterInfo,t.assistantTurnFooterInfo)?!1:sVe(e.message,t.message)}function rVe(e,t){return e===t?!0:!e||!t?!1:e.turnId===t.turnId&&e.message.id===t.message.id&&e.message.content===t.message.content&&e.message.isStreaming===t.message.isStreaming&&e.message.timestamp===t.message.timestamp}function sVe(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&&aVe(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"&&iVe(e.todos,t.todos);case"tool_group":return t.role==="tool_group"&&e.tools.length===t.tools.length&&e.tools.every((n,r)=>Rre(n,t.tools[r]));default:return!1}}function iVe(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 Rre(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&&Jd(e.args)===Jd(t.args)&&Jd(e.rawOutput)===Jd(t.rawOutput)&&Jd(e.locations)===Jd(t.locations)&&Jd(e.content)===Jd(t.content)&&oVe(e.subTools,t.subTools):!1}function oVe(e,t){return!e&&!t?!0:!e||!t||e.length!==t.length?!1:e.every((n,r)=>Rre(n,t[r]))}const zz=new WeakMap;function aVe(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 Jd(e){if(e===void 0)return"";if(e!==null&&typeof e=="object"){let t=zz.get(e);if(t!==void 0)return t;try{t=JSON.stringify(e)}catch{t=String(e)}return zz.set(e,t),t}try{return JSON.stringify(e)}catch{return String(e)}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function lVe(e){const t=/^(\d{1,2}):(\d{2})$/.exec(e.trim());if(!t)return null;const n=Number(t[1]),r=Number(t[2]);return n<0||n>23||r<0||r>59?null:{hh:n,mm:r}}function o4(e){if(e.frequency==="custom"){const n=e.customCron.trim();return n.length>0?n:null}if(e.frequency==="minutes"){const n=Math.floor(e.minuteInterval);return!Number.isFinite(n)||n<1||n>30||60%n!==0?null:`*/${n} * * * *`}const t=lVe(e.time);if(!t)return null;switch(e.frequency){case"daily":return`${t.mm} ${t.hh} * * *`;case"weekdays":return`${t.mm} ${t.hh} * * 1-5`;case"weekly":return`${t.mm} ${t.hh} * * ${e.weekday}`;case"hourly":return`${t.mm} * * * *`;default:return null}}function pv(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return e;const[r,s,i,o,a]=n,l=d=>/^\d+$/.test(d),u=d=>d.padStart(2,"0");if(/^\*\/\d+$/.test(r)&&s==="*"&&i==="*"&&o==="*"&&a==="*"){const d=Number(r.slice(2));return Number.isInteger(d)&&d>=1&&d<=30&&60%d===0?t("scheduledTasks.human.everyMinutes",{n:d}):e}if(l(r)&&s==="*"&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.hourly",{min:u(r)});if(l(r)&&l(s)&&i==="*"&&o==="*"&&a==="*")return t("scheduledTasks.human.daily",{time:`${u(s)}:${u(r)}`});if(l(r)&&l(s)&&i==="*"&&o==="*"&&a==="1-5")return t("scheduledTasks.human.weekdays",{time:`${u(s)}:${u(r)}`});if(l(r)&&l(s)&&i==="*"&&o==="*"&&l(a)&&Number(a)>=0&&Number(a)<=7){const d=t("scheduledTasks.weekdayNames").split(","),h=Number(a)===7?0:Number(a),m=d[h]??a;return t("scheduledTasks.human.weekly",{day:m,time:`${u(s)}:${u(r)}`})}return e}const jc={frequency:"daily",time:"09:00",weekday:1,minuteInterval:30,customCron:"0 9 * * *"};function rh(e){const t=e.trim(),n={...jc,frequency:"custom",customCron:t.length>0?t:jc.customCron},r=t.split(/\s+/);if(r.length!==5)return n;const[s,i,o,a,l]=r,u=b=>/^\d+$/.test(b),d=b=>String(b).padStart(2,"0"),h=o==="*"&&a==="*";if(/^\*\/\d+$/.test(s)&&i==="*"&&h&&l==="*"){const b=Number(s.slice(2));return Number.isInteger(b)&&b>=1&&b<=30&&60%b===0?{...jc,frequency:"minutes",minuteInterval:b}:n}if(!u(s))return n;const m=Number(s);if(m>59)return n;if(i==="*"&&h&&l==="*")return{...jc,frequency:"hourly",time:`00:${d(m)}`};if(!u(i))return n;const p=Number(i);if(p>23)return n;const g=`${d(p)}:${d(m)}`;if(h&&l==="*")return{...jc,frequency:"daily",time:g};if(h&&l==="1-5")return{...jc,frequency:"weekdays",time:g};if(h&&u(l)){const b=Number(l);if(b>=0&&b<=7)return{...jc,frequency:"weekly",time:g,weekday:b===7?0:b}}return n}function cVe(e,t){if(e<=0)return t("scheduledTasks.dueNow");const n=Math.floor(e/1e3),r=Math.floor(n/86400),s=Math.floor(n%86400/3600),i=Math.floor(n%3600/60),o=n%60,a=(u,d)=>`${d}${t(`scheduledTasks.dur.${u}`)}`;let l;return r>0?l=s>0?[a("d",r),a("h",s)]:[a("d",r)]:s>0?l=i>0?[a("h",s),a("m",i)]:[a("h",s)]:i>0?l=o>0?[a("m",i),a("s",o)]:[a("m",i)]:l=[a("s",o)],l.join(" ")}function uVe(e,t){const n=e.createdAt-e.createdAt%6e4;if(e.lastFiredAt===null||e.lastFiredAt<=n)return t("scheduledTasks.never");let r;try{r=new Date(e.lastFiredAt).toLocaleString()}catch{return t("scheduledTasks.never")}return t("scheduledTasks.lastFired",{when:r})}function Dre(e){switch(e){case"html":return"HTML";case"pdf":return"PDF";case"notebook":return"Notebook";default:return e||"artifact"}}function Lre(e){return e===void 0?"":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function dVe(e){return e.workspacePath??e.url??e.managedId??""}function rp(e){const t=(e??"").replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,""),n=t.startsWith("/"),r=[];for(const i of t.split("/"))if(!(!i||i===".")){if(i===".."){r.length>0&&r.at(-1)!==".."?r.pop():n||r.push(i);continue}r.push(i)}const s=r.join("/");return n?`/${s}`:s}function aE(e,t){const n=rp(e),r=rp(t);if(!r)return n;if(n===r)return n.split("/").pop()??n;const s=`${r}/`;return n.startsWith(s)?n.slice(s.length):n}function Pre(e,t,n){const r=aE(e??"",n),s=aE(t??"",n);return!!r&&r===s}const Fz="default-src 'none'; base-uri 'none'; style-src 'unsafe-inline'; img-src data: blob:;";function hVe(e){if(typeof DOMParser>"u")return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${Fz}"></head><body>${fVe(e)}</body></html>`;const t=new DOMParser().parseFromString(e,"text/html");t.querySelectorAll('noscript, meta[http-equiv="refresh" i], meta[http-equiv="Content-Security-Policy" i]').forEach(r=>r.remove());const n=t.createElement("meta");return n.httpEquiv="Content-Security-Policy",n.content=Fz,t.head.prepend(n),`<!doctype html>${t.documentElement.outerHTML}`}function fVe(e){return e.replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?refresh["']?)[^>]*>/gi,"").replace(/<meta\b(?=[^>]*\bhttp-equiv\s*=\s*["']?Content-Security-Policy["']?)[^>]*>/gi,"")}function a4({additions:e,deletions:t,className:n,additionsClassName:r,deletionsClassName:s}){return e===void 0||t===void 0?null:c.jsxs("span",{className:n,children:[c.jsxs("span",{className:r,children:["+",e]}),c.jsxs("span",{className:s,children:["-",t]})]})}function Ore(e){if(!e.some(t=>t.additions===void 0||t.deletions===void 0))return e.reduce((t,n)=>({additions:t.additions+(n.additions??0),deletions:t.deletions+(n.deletions??0)}),{additions:0,deletions:0})}const mVe="_root_aths8_1",pVe="_card_aths8_7",gVe="_summary_aths8_14",bVe="_icon_aths8_22",yVe="_iconSvg_aths8_33",vVe="_title_aths8_39",xVe="_linkButton_aths8_46",wVe="_reviewButton_aths8_47",kVe="_showMoreButton_aths8_48",_Ve="_actions_aths8_79",SVe="_list_aths8_97",CVe="_fileRow_aths8_104",TVe="_path_aths8_124",AVe="_lineStats_aths8_133",EVe="_additions_aths8_142",MVe="_deletions_aths8_146",NVe="_chevronIcon_aths8_160",jVe="_chevronIconOpen_aths8_168",IVe="_artifactInfo_aths8_172",RVe="_artifactMeta_aths8_178",mr={root:mVe,card:pVe,summary:gVe,icon:bVe,iconSvg:yVe,title:vVe,linkButton:xVe,reviewButton:wVe,showMoreButton:kVe,actions:_Ve,list:SVe,fileRow:CVe,path:TVe,lineStats:AVe,additions:EVe,deletions:MVe,chevronIcon:NVe,chevronIconOpen:jVe,artifactInfo:IVe,artifactMeta:RVe},Bre=["file","artifact","scheduled_task"];function DVe({turnId:e,changes:t,artifacts:n,scheduledTasks:r,workspaceCwd:s,onOpenRequest:i,onReviewChanges:o,onOpenArtifact:a,onOpenScheduledTask:l}){const{t:u}=gt(),[d,h]=f.useState(!1);if(t.length===0&&n.length===0&&r.length===0)return null;const m=d?t:t.slice(0,3),p=t.length-3,g=Ore(t),b=y=>{if(i){i({id:"review",kind:"review",title:u("turnOutputs.review"),turnId:e,changes:t,...y?{selectedPath:y}:{}});return}o(t,y)},x=y=>{const w=FVe(y,t,s);if(i){i({id:`artifact:${y.id}`,kind:"artifact",title:y.title??"Artifact",turnId:e,artifactId:y.id,artifact:y,...w!==void 0?{previewContent:w}:{}});return}a(y.id,w)},v=y=>{if(i){i({id:`scheduled-task:${y.toolCallId}`,kind:"scheduled_task",title:u("scheduledTasks.title"),turnId:e,task:y});return}l(y)};return c.jsxs("div",{className:mr.root,children:[t.length>0&&c.jsxs("div",{className:mr.card,children:[c.jsxs("div",{className:mr.summary,children:[c.jsx("span",{className:mr.icon,"aria-hidden":"true",children:c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",focusable:"false",className:mr.iconSvg,children:[c.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),c.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsxs("div",{children:[c.jsx("div",{className:mr.title,children:u("turnOutputs.filesEdited",{count:t.length})}),c.jsx(a4,{additions:g==null?void 0:g.additions,deletions:g==null?void 0:g.deletions,className:mr.lineStats,additionsClassName:mr.additions,deletionsClassName:mr.deletions}),c.jsxs("button",{type:"button",className:mr.linkButton,onClick:()=>b(),children:[u("turnOutputs.viewChanges")," ↗"]})]}),c.jsx("div",{className:mr.actions,children:c.jsx("button",{type:"button",className:mr.reviewButton,onClick:()=>b(),children:u("turnOutputs.review")})})]}),c.jsxs("div",{className:mr.list,children:[m.map(y=>c.jsxs("button",{type:"button",className:mr.fileRow,onClick:()=>b(y.path),title:y.path,children:[c.jsx("span",{className:mr.path,children:Ej(y.path,s)}),c.jsx(a4,{additions:y.additions,deletions:y.deletions,className:mr.lineStats,additionsClassName:mr.additions,deletionsClassName:mr.deletions})]},`${y.toolCallId}:${y.path}`)),p>0&&c.jsxs("button",{type:"button",className:mr.showMoreButton,onClick:()=>h(y=>!y),children:[c.jsx("span",{children:d?u("turnOutputs.collapseFiles"):u("turnOutputs.showMoreFiles",{count:p})}),c.jsx($Ve,{open:d})]})]})]}),n.map(y=>c.jsx(LVe,{artifact:y,onOpen:()=>x(y)},y.id)),r.map(y=>c.jsx(PVe,{task:y,scheduleLabel:pv(y.cron,u),onOpen:()=>v(y)},y.toolCallId))]})}function LVe({artifact:e,onOpen:t}){const{t:n}=gt(),r=Lre(e.sizeBytes);return c.jsx("div",{className:mr.card,children:c.jsxs("div",{className:mr.summary,children:[c.jsx("span",{className:mr.icon,"aria-hidden":"true",children:c.jsx(OVe,{})}),c.jsxs("div",{className:mr.artifactInfo,children:[c.jsx("div",{className:mr.title,children:e.title}),c.jsx("div",{className:mr.artifactMeta,children:[Dre(e.kind),r].filter(Boolean).join(" · ")})]}),c.jsx("div",{className:mr.actions,children:c.jsx("button",{type:"button",className:mr.reviewButton,onClick:t,title:e.title,children:n("common.open")})})]})})}function PVe({task:e,scheduleLabel:t,onOpen:n}){const{t:r}=gt();return c.jsx("div",{className:mr.card,children:c.jsxs("div",{className:mr.summary,children:[c.jsx("span",{className:mr.icon,"aria-hidden":"true",children:c.jsx(BVe,{})}),c.jsxs("div",{className:mr.artifactInfo,children:[c.jsx("div",{className:mr.title,children:e.title}),c.jsx("div",{className:mr.artifactMeta,children:[t,e.recurring?r("scheduledTasks.repeats"):r("scheduledTasks.runsOnce")].filter(Boolean).join(" · ")})]}),c.jsx("div",{className:mr.actions,children:c.jsx("button",{type:"button",className:mr.reviewButton,onClick:n,title:e.title,children:r("common.open")})})]})})}function OVe(){return c.jsxs("svg",{className:mr.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[c.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),c.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function BVe(){return c.jsxs("svg",{className:mr.iconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[c.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),c.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $Ve({open:e}){return c.jsx("svg",{className:[mr.chevronIcon,e?mr.chevronIconOpen:""].filter(Boolean).join(" "),viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}const zVe=f.memo(DVe);function FVe(e,t,n){if(e.kind!=="html"||!e.workspacePath)return;const r=t.find(s=>Pre(s.path,e.workspacePath,n));if(r)for(let s=r.diffs.length-1;s>=0;s--){const i=r.diffs[s];if(i!=null&&i.fullContent)return i.newText}}function Ej(e,t){return aE(e,t)}const qVe="_wrap_bymxa_1",HVe="_summary_bymxa_5",UVe="_summaryTextActive_bymxa_27",VVe="_summaryIcon_bymxa_33",WVe="_summaryStatus_bymxa_47",GVe="_summaryToolIcon_bymxa_54",KVe="_summaryText_bymxa_27",YVe="_summaryDot_bymxa_96",XVe="_chevronRight_bymxa_100",QVe="_chevronDown_bymxa_101",JVe="_group_bymxa_161",ZVe="_list_bymxa_193",eWe="_row_bymxa_199",tWe="_rowStats_bymxa_213",nWe="_rowDesc_bymxa_221",rWe="_rowTool_bymxa_231",sWe="_detail_bymxa_235",iWe="_track_bymxa_241",oWe="_bar_bymxa_249",aWe="_barRunning_bymxa_257",lWe="_ruler_bymxa_296",cWe="_tick_bymxa_303",Os={wrap:qVe,summary:HVe,summaryTextActive:UVe,summaryIcon:VVe,summaryStatus:WVe,summaryToolIcon:GVe,summaryText:KVe,summaryDot:YVe,chevronRight:XVe,chevronDown:QVe,group:JVe,list:ZVe,row:eWe,rowStats:tWe,rowDesc:nWe,rowTool:rWe,detail:sWe,track:iWe,bar:oWe,barRunning:aWe,ruler:lWe,tick:cWe};function $re(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 uWe(e,t){if(e.length<2)return null;const n=[];for(const h of e){if(typeof h.startTime!="number")return null;n.push(h.startTime)}const r=e.map((h,m)=>h.status==="in_progress"?Math.max(t,n[m]):Math.max(h.endTime??n[m],n[m])),s=Math.min(...n),i=Math.max(...r)-s;if(i<1e3)return null;const o=new Map;e.forEach((h,m)=>{const p=Math.max((r[m]-n[m])/i,.02),g=Math.min((n[m]-s)/i,1-p);o.set(h.callId,{leftPct:g*100,widthPct:p*100,running:h.status==="in_progress"})});const a=Math.max(i/1e3/2.2,1),l=Math.pow(10,Math.floor(Math.log10(a))),u=[5,2,1].map(h=>h*l).find(h=>h<=a)??l,d=[];for(let h=0;d.length<4;h++){const m=h*u*1e3;if(m>i*.92)break;d.push({leftPct:m/i*100,label:$re(m)})}return{rows:o,ticks:d}}function dWe(e,t){const n=[],r=rx(e.rawOutput),s=r==null?void 0:r.executionSummary,i=s&&typeof s.totalDurationMs=="number"?$re(s.totalDurationMs):sx(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(vj(o));const a=yj(e);return a&&n.push(Mi(a,80)),n.join(" · ")}function hWe(){return c.jsx("svg",{className:Os.summaryToolIcon,width:"14",height:"14",viewBox:"0 0 1024 1024",fill:"currentColor","aria-hidden":"true",children:c.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 fWe({agents:e,pendingApproval:t}){const{t:n}=gt(),[r,s]=f.useState(!1),[i,o]=f.useState(null),[a,l]=f.useState(()=>Date.now()),u=f.useRef(Date.now()),d=e.some(y=>y.status==="in_progress");f.useEffect(()=>{d&&(u.current=Date.now(),l(Date.now()))},[d]),f.useEffect(()=>{if(!d)return;const y=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(y)},[d]);const h=d?wre(a-u.current):"",m=e.filter(y=>y.status==="completed"||y.status==="failed").length,p=e.length,g=t!=null&&t.toolCallId?e.find(y=>nc(y,t.toolCallId)):void 0,b=r||!!g,x=b?uWe(e,a):null,v=e.some(y=>fv(y)==="failed")?"failed":d?"in_progress":"completed";return c.jsxs("div",{className:Os.wrap,children:[c.jsxs("button",{type:"button",className:Os.summary,onClick:()=>s(y=>!y),"aria-expanded":b,title:n(b?"tool.collapseHint":"tool.expand"),children:[v==="failed"?c.jsx("span",{className:Os.summaryStatus,children:c.jsx(ff,{status:v})}):c.jsx("span",{className:Os.summaryIcon,"aria-hidden":"true",children:c.jsx(hWe,{})}),c.jsxs("span",{className:d?`${Os.summaryText} ${Os.summaryTextActive}`:Os.summaryText,children:[n("parallelAgents.title"),h&&c.jsxs(c.Fragment,{children:[" ",h]}),c.jsx("span",{className:Os.summaryDot,children:"·"}),n("parallelAgents.done",{done:m,total:p})]}),c.jsx("span",{className:b?Os.chevronDown:Os.chevronRight,"aria-hidden":"true"})]}),b&&c.jsxs("div",{className:Os.group,children:[c.jsx("div",{className:Os.list,children:e.map(y=>{const w=xj(y),k=wj(y),T=aBe(y,n),S=dWe(y,a),C=fv(y),_=i===y.callId,A=x==null?void 0:x.rows.get(y.callId);return c.jsxs("div",{children:[c.jsxs("div",{className:Os.row,onClick:()=>o(_?null:y.callId),children:[c.jsx(ff,{status:C}),c.jsxs("span",{className:Os.rowDesc,children:[Mi(k||w,50),T&&c.jsx("span",{className:Os.rowTool,children:` (${T})`})]}),S&&c.jsx("span",{className:Os.rowStats,children:S})]}),A&&c.jsx("div",{className:Os.track,"aria-hidden":"true",children:c.jsx("span",{className:A.running?`${Os.bar} ${Os.barRunning}`:Os.bar,style:{left:`${A.leftPct}%`,width:`${A.widthPct}%`}})}),_&&c.jsx("div",{className:Os.detail,children:c.jsx(kj,{tool:y,hideHeader:!0})})]},y.callId)})}),x&&x.ticks.length>=2&&c.jsx("div",{className:Os.ruler,"aria-hidden":"true",children:x.ticks.map(y=>c.jsx("span",{className:Os.tick,style:{left:`${y.leftPct}%`},children:y.label},y.label))})]})]})}const mWe="_collapseRow_d7f01_1",pWe="_collapseRowClickable_d7f01_14",gWe="_collapseLabel_d7f01_19",bWe="_processedLabel_d7f01_36",yWe="_processedMeta_d7f01_43",vWe="_hiddenMetrics_d7f01_47",xWe="_summaryMetrics_d7f01_51",wWe="_collapseIcon_d7f01_59",kWe="_chevronRight_d7f01_72",_We="_chevronDown_d7f01_73",Gl={collapseRow:mWe,collapseRowClickable:pWe,collapseLabel:gWe,processedLabel:bWe,processedMeta:yWe,hiddenMetrics:vWe,summaryMetrics:xWe,collapseIcon:wWe,chevronRight:kWe,chevronDown:_We},SWe="_list_15syv_1",CWe="_listWithWelcomeHeader_15syv_12",TWe="_virtualSizer_15syv_42",AWe="_virtualRow_15syv_51",EWe="_loadingSkeleton_15syv_61",MWe="_srOnly_15syv_69",NWe="_loadingSkeletonUserRow_15syv_81",jWe="_loadingSkeletonAssistantRow_15syv_87",IWe="_loadingSkeletonUserBubble_15syv_93",RWe="_loadingSkeletonUserBubbleCompact_15syv_94",DWe="_loadingSkeletonAssistantBlock_15syv_108",LWe="_loadingSkeletonLineWide_15syv_116",PWe="_loadingSkeletonLineMedium_15syv_117",OWe="_loadingSkeletonLineShort_15syv_118",BWe="_loadingSkeletonLineNarrow_15syv_119",$We="_turnStatusRow_15syv_159",zWe="_turnAnswerRow_15syv_160",FWe="_turnContentRow_15syv_171",qWe="_turnContentClip_15syv_175",HWe="_turnContentCollapsed_15syv_183",UWe="_turnContentInner_15syv_187",VWe="_sessionTimelineLayer_15syv_192",WWe="_sessionTimelinePanel_15syv_205",GWe="_sessionTimelineViewport_15syv_216",KWe="_sessionTimelineList_15syv_257",YWe="_sessionTimelineItem_15syv_267",XWe="_sessionTimelineButton_15syv_272",QWe="_sessionTimelineTick_15syv_291",JWe="_sessionTimelineButtonInRange_15syv_378",ZWe="_sessionTimelineButtonCurrent_15syv_382",eGe="_sessionTimelineDetails_15syv_393",tGe="_sessionTimelineDetailsTitle_15syv_427",nGe="_sessionTimelineDetailsIcon_15syv_434",rGe="_sessionTimelineDetailsTitleText_15syv_446",sGe="_sessionTimelineDetailsDetail_15syv_456",nr={list:SWe,listWithWelcomeHeader:CWe,virtualSizer:TWe,virtualRow:AWe,loadingSkeleton:EWe,srOnly:MWe,loadingSkeletonUserRow:NWe,loadingSkeletonAssistantRow:jWe,loadingSkeletonUserBubble:IWe,loadingSkeletonUserBubbleCompact:RWe,loadingSkeletonAssistantBlock:DWe,loadingSkeletonLineWide:LWe,loadingSkeletonLineMedium:PWe,loadingSkeletonLineShort:OWe,loadingSkeletonLineNarrow:BWe,turnStatusRow:$We,turnAnswerRow:zWe,turnContentRow:FWe,turnContentClip:qWe,turnContentCollapsed:HWe,turnContentInner:UWe,sessionTimelineLayer:VWe,sessionTimelinePanel:WWe,sessionTimelineViewport:GWe,sessionTimelineList:KWe,sessionTimelineItem:YWe,sessionTimelineButton:XWe,sessionTimelineTick:QWe,sessionTimelineButtonInRange:JWe,sessionTimelineButtonCurrent:ZWe,sessionTimelineDetails:eGe,sessionTimelineDetailsTitle:tGe,sessionTimelineDetailsIcon:nGe,sessionTimelineDetailsTitleText:rGe,sessionTimelineDetailsDetail:sGe},Z6=()=>{};function iGe(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 oGe(e){return e[e.length-1]}function aGe(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&wp(n))return n.id}return null}function qz(e){return e.role==="tool_group"&&e.tools.length===1&&X4(e.tools[0])}function eT(e){return e.role==="tool_group"&&e.tools.length===1&&NW(e.tools[0])}function Hz(e){return e.role==="thinking"}function Uz(e,t){return e.role!=="tool_group"?!1:!!(t!=null&&t.toolCallId&&e.tools.some(n=>nc(n,t.toolCallId)))}function Vz(e){return e.role==="thinking"}function lGe(e,t){const n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.role!=="tool_group"||Uz(s,t)){Vz(s)||n.push(s),r++;continue}const i=[s];let o=r,a=r+1;for(;a<e.length;){const u=e[a];if(Vz(u)){a++;continue}if(u.role==="tool_group"&&!Uz(u,t)){i.push(u),o=a,a++;continue}break}if(i.length===1){n.push(s),r++;continue}const l=i.flatMap(u=>u.role==="tool_group"?u.tools:[]);n.push({id:i[0].id,role:"tool_group",tools:l}),r=o+1}return n}function zre(e){const t=[];let n=0;for(;n<e.length;){if(eT(e[n])){const r=[];let s=n;for(;s<e.length;){const i=e[s];if(eT(i)){r.push(i),s++;continue}if(Hz(i)){let o=s+1;for(;o<e.length&&Hz(e[o]);)o++;if(o<e.length&&eT(e[o])){s=o;continue}}break}if(r.length>=2){t.push({type:"parallel_agents",key:`par-${r[0].id}`,turnId:r[0].id,agents:r.map(i=>i.tools[0]),timestamp:r[0].timestamp}),n=s;continue}}if(qz(e[n])){const r=n;for(;n<e.length&&qz(e[n]);)n++;if(n-r>=2){const s=e.slice(r,n);t.push({type:"parallel_agents",key:`par-${s[0].id}`,turnId: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 Wz(e){if(e.type==="parallel_agents")return`group:${e.key}`;if(e.type==="turn_outputs")return`outputs:${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 cGe(e,t,n,r,s){if((!n||n.size===0)&&(!r||r.size===0)&&(!s||s.size===0))return e;const i=[];let o=null;const a=(l,u)=>{if(u&&t||!l)return;const d=(n==null?void 0:n.get(l))??[],h=(r==null?void 0:r.get(l))??[],m=(s==null?void 0:s.get(l))??[];d.length===0&&h.length===0&&m.length===0||i.push({type:"turn_outputs",key:l,turnId:l,changes:d,artifacts:h,scheduledTasks:m})};for(const l of e)l.type==="message"&&wp(l.message)?(a(o,!1),o=l.message.id):!o&&l.type==="message"?o=l.message.id:!o&&l.type==="parallel_agents"&&(o=l.turnId),i.push(l);return a(o,!0),i}function uGe(e){return e.type==="message"&&e.message.role==="assistant"&&!!e.message.content&&e.message.content.trim().length>0}function Mj(e,t,n){let r=t;for(let s=n;s>t;s--)if(Fre(e[s])){r=s;break}for(let s=n;s>r;s--)if(uGe(e[s]))return s;return-1}function dGe(e,t){const n=[];for(let s=0;s<e.length;s++){const i=e[s];i.type==="message"&&wp(i.message)&&n.push(s)}const r=new Map;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=e[i],l=Mj(e,i,o);if(l<0)continue;const u=e[l];(a==null?void 0:a.type)==="message"&&u.type==="message"&&u.message.role==="assistant"&&r.set(u.message.id,a.message.id)}return r}function lE(e,t){if(e.type==="parallel_agents")return!0;if(e.type==="turn_outputs"||e.type==="turn_collapse")return!1;if(e.type==="turn_content")return e.items.some(n=>lE(n,t));switch(e.message.role){case"tool_group":case"plan":return!0;case"assistant":return!t;case"thinking":return!0;case"system":return Nj(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 Nj(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 hGe(e,t){if(e.type==="parallel_agents")return{kind:"agents",timestamp:e.timestamp,label:t?t("timeline.parallelAgents"):"Parallel agents"};if(e.type==="turn_outputs")return{kind:"none"};if(e.type!=="message")return{kind:"none"};const{message:n}=e;switch(n.role){case"thinking":return{kind:"thought",timestamp:n.timestamp,label:t?t("timeline.thinking"):"Thinking"};case"assistant":return e.turnCollapse?{kind:"none",timestamp:n.timestamp}:sp(n.content,1)?{kind:"commentary",timestamp:n.timestamp,label:t?t("timeline.assistantUpdate"):"Assistant update"}:{kind:"none",timestamp:n.timestamp};case"tool_group":{const r=n.tools.length;return{kind:"tool",timestamp:n.timestamp,label:t?t("timeline.toolCalls",{count:r}):`${r} tool call${r===1?"":"s"}`}}case"plan":return{kind:"plan",timestamp:n.timestamp,label:t?t("timeline.planUpdate"):"Plan update"};case"system":return Nj(n)?{kind:"status",timestamp:n.timestamp,label:t?t("timeline.statusUpdate"):"Status update"}:{kind:"none",timestamp:n.timestamp};case"user":case"user_shell":case"btw":case"insight_progress":case"insight_ready":case"insight_error":return{kind:"none",timestamp:n.timestamp};default:return{kind:"none"}}}function sp(e,t,n={}){const s=(n.stripMarkdown===!0?fGe(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 fGe(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=tT(r,"~~"),r=tT(r,"**"),r=tT(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 tT(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 mGe(e,t){const n=e.role==="user"?e.content:e.role==="user_shell"?e.command:"",r=sp(n,32);return r||(t?t("timeline.userTurn"):"User turn")}function pGe(e){return e.role==="user"&&(e.source==="cron"||e.source==="loop")}function wp(e){return e.role==="user"||e.role==="user_shell"}function gGe(e,t){switch(e.role){case"thinking":return t?t("timeline.kind.thought"):"thinking";case"assistant":return sp(e.content,120,{stripMarkdown:!0});case"tool_group":{const n=e.tools.length;return t?t("timeline.toolCalls",{count:n}):`${n} tool call${n===1?"":"s"}`}case"plan":return t?t("timeline.planDetail"):"plan update";case"system":return Nj(e)?sp(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 bGe(e,t){if(e.type==="parallel_agents"){const n=e.agents.length;return t?t("timeline.parallelAgentsDetail",{count:n}):`${n} parallel agent${n===1?"":"s"}`}return e.type==="turn_outputs"||e.type!=="message"?"":gGe(e.message,t)}function yGe(e,t){return t?t(`timeline.kind.${e}`):HGe[e]}function vGe(e,t,n,r){if(t!==null)for(const o of e){if(o.type!=="message")continue;const{message:a}=o;if(a.id!==t||a.role!=="assistant")continue;const l=sp(a.content,180,{stripMarkdown:!0});if(l)return l}const s=[];for(let o=0;o<e.length;o+=1){const a=e[o];if(a.type==="message"&&t!==null&&a.message.id===t)continue;const l=bGe(a,r);l&&s.push(l)}const i=sp(s.join(" · "),180);return i||(n.length>0?n.map(o=>yGe(o,r)).join(" · "):r?r("timeline.noActivity"):"No activity")}function xGe(e,t){const n=[];let r=null,s=[];const i=()=>{if(!r)return;const o=zre(s),a=Mj(o,-1,o.length-1),l=a>=0?o[a]:null,u=(l==null?void 0:l.type)==="message"&&l.message.role==="assistant"&&!l.message.isStreaming&&sp(l.message.content,1,{stripMarkdown:!0}).length>0?l.message.id:null,d=[];for(const h of o){if(h.type==="message"&&u!==null&&h.message.id===u)continue;const m=hGe(h,t);m.kind!=="none"&&!d.includes(m.kind)&&d.push(m.kind)}n.push({id:r.id,label:mGe(r,t),detail:vGe(o,u,d,t),timestamp:r.timestamp,nodeKinds:d,...pGe(r)?{isScheduledTask:!0}:{}})};for(const o of e){if(wp(o)){i(),r=o,s=[];continue}r&&s.push(o)}return i(),n}function wGe(){return c.jsxs("svg",{className:nr.sessionTimelineDetailsIcon,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6.25"}),c.jsx("path",{d:"M8 4.5v4l-2.5 2"})]})}function kGe(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 _Ge(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(kGe).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 Fre(e){return e.type==="parallel_agents"?!0:e.type==="turn_outputs"||e.type==="turn_collapse"?!1:e.type==="turn_content"?e.items.some(Fre):e.message.role==="tool_group"||e.message.role==="plan"}function Gz(e){return e==="pending"||e==="running"||e==="in_progress"}function qre(e){if(e.type==="turn_content"){for(let n=e.items.length-1;n>=0;n--){const r=qre(e.items[n]);if(r)return r}return null}if(e.type==="turn_outputs")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=>Gz(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=>Gz(n.status));return t.length===0?null:`tools:${e.message.id}:${t.map(n=>n.callId).join(",")}`}function SGe(e){for(let t=e.length-1;t>=0;t--){const n=qre(e[t]);if(n)return n}return null}function CGe(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 TGe(e){return e.type==="message"&&e.message.role==="system"&&e.message.source==="turn_error"}function AGe(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 EGe(e){return e.type==="message"&&e.message.role==="assistant"?e.message.usage:void 0}function Hre(e){return e.type==="parallel_agents"?e.agents.length:e.type==="turn_outputs"||e.type==="turn_collapse"?0:e.type==="turn_content"?e.items.reduce((t,n)=>t+Hre(n),0):e.message.role==="tool_group"?e.message.tools.length:0}function Ure(e,t){for(let n=Math.min(t,e.length-1);n>=0;n--){const r=e[n];if(r.type==="message"&&wp(r.message))return r.message.id}return null}function Vre(e){const t=[];let n=null;for(const r of e)r.type==="message"&&wp(r.message)&&(n=r.message.id),t.push(n);return t}function Kz(e,t,n,r){const s=r===void 0?Ure(e,t):r[t]??null;return s?n.get(s)??null:null}function MGe(e,t,n,r,s=Vre(e)){let i=Number.POSITIVE_INFINITY,o=-1;for(const l of t){if(l<0||l>=e.length)continue;const u=Kz(e,l,n,s);u!==null&&(i=Math.min(i,u),o=Math.max(o,u))}if(o<0)return null;const a=r==null?null:Kz(e,r,n,s);return{startIndex:i,endIndex:o,currentIndex:a!==null&&a>=i&&a<=o?a:o}}function NGe(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=>nc(o,r)))return!0}else if(i.type==="message"&&i.message.role==="tool_group"&&i.message.tools.some(o=>nc(o,r)))return!0}return!1}function jGe(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 u=e[l];u.type==="message"&&wp(u.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 u=o[l],d=(l+1<o.length?o[l+1]:e.length)-1,h=e[u],m=h.message.id,p=h.message.timestamp,g=l===o.length-1&&n,b=NGe(e,u,d,s),x=Mj(e,u,d);let v=0,y,w,k=0,T=0,S=0,C=0,_=0,A=!1,M=!1;for(let j=u+1;j<=d;j++){const ie=e[j];lE(ie,j===x)&&v++,TGe(ie)&&(M=!0),C+=Hre(ie),ie.type==="message"&&ie.message.role==="thinking"&&_++;const J=CGe(ie);J!==void 0&&(y=y===void 0?J:Math.max(y,J));const V=AGe(ie);V!==void 0&&(w=w===void 0?V:Math.max(w,V));const se=EGe(ie);se&&(k+=se.inputTokens,T+=se.outputTokens,S+=se.cachedTokens??0,A=!0)}const L=g?r??p??Date.now():void 0,N=y??w,O=p!==void 0&&N!==void 0&&N>=p?N-p:void 0;if(b||v===0&&!(A||O!==void 0||L!==void 0)){for(let j=u;j<=d;j++)a.push(e[j]);continue}const $=g||M||x<0,K=!(v===0?!0:t.has(m)?t.get(m):$);let F=0;const H=j=>{j.length!==0&&a.push({type:"turn_content",key:`${m}-content-${F++}`,turnId:m,collapsed:K,items:j})};a.push({type:"message",key:h.key,message:h.message});const D={turnId:m,collapsed:K,hiddenCount:v,...O!==void 0?{elapsedMs:O}:{},...A?{inputTokens:k,outputTokens:T}:{},...S>0?{cachedTokens:S}:{},...C>0?{toolCallCount:C}:{},..._>0?{thinkingCount:_}:{},...L!==void 0?{liveStartedAt:L}:{}};if(a.push({type:"turn_collapse",key:`tc-${m}`,turnCollapse:D}),!K){let j=[];for(let ie=u+1;ie<=d;ie++){const oe=e[ie];ie===x&&oe.type==="message"&&oe.message.role==="assistant"?(H(j),j=[],a.push({...oe,turnCollapse:D})):j.push(oe)}H(j);continue}const Q=[],U=[];for(let j=u+1;j<=d;j++){const ie=e[j];if(!(j===x&&g)){if(j===x&&ie.type==="message"&&ie.message.role==="assistant"){U.push({...ie,turnCollapse:D});continue}if(lE(ie,j===x)){Q.push(ie);continue}U.push(ie)}}H(Q),a.push(...U)}return a}function n2(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=>nc(i,n)))return r}else{if(s.type==="parallel_agents"&&n&&s.agents.some(i=>nc(i,n)))return r;if(s.type==="turn_content"&&n2(s.items,t,n)>=0)return r;if(s.type==="turn_outputs")continue}}return-1}function cE(e,t){if(!t)return!1;const n=t.callId;return e.type==="message"?e.message.id===t.messageId?!0:!!n&&e.message.role==="tool_group"&&e.message.tools.some(r=>nc(r,n)):e.type==="parallel_agents"?!!n&&e.agents.some(r=>nc(r,n)):e.type==="turn_content"?e.items.some(r=>cE(r,t)):(e.type==="turn_outputs",!1)}const nT=0,IGe=120,rT=80,RGe=32,DGe=240,sT=30,Wre=200,LGe=4;function PGe(e,t=Wre){return e>t}function OGe(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 iT(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:`${e}`}function BGe(e){return e!==void 0?OGe(e):""}function $Ge(e,t){if(e.inputTokens===void 0||e.outputTokens===void 0)return"";const n=e.cachedTokens??0,r=n>0&&e.inputTokens>0?` (${iT(n)} ${t("turn.cached")}, ${Math.round(n/e.inputTokens*100)}%)`:"";return`↑${iT(e.inputTokens)}${r} ↓${iT(e.outputTokens)}`}function Yz(e,t){const n=[],r=$Ge(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 zGe(e){return e.inputTokens!==void 0&&e.outputTokens!==void 0||e.toolCallCount!==void 0&&e.toolCallCount>0}const FGe=f.memo(function({turnCollapse:t,onToggleCollapse:n}){const{t:r}=gt(),s=t.hiddenCount>0,i=t.liveStartedAt,o=s||i!==void 0||zGe(t),a=Cj(i!==void 0&&o),l=f.useRef(0),u=f.useRef(i);u.current!==i&&(u.current=i,l.current=0);let d;i!==void 0&&o?(l.current=Math.max(l.current,Math.max(0,a-i)),d=l.current):o&&t.elapsedMs!==void 0?(l.current=0,d=t.elapsedMs):(l.current=0,d=void 0);const h=BGe(d),m=Yz(t,r),p=Yz(t,r),g=r(i!==void 0?"turn.processing":"turn.processed"),b=!!h&&o,x=!!m&&o,v=!!p&&o;if(!o)return null;const y=()=>{if(!s)return;const w=t.collapsed;n(t.turnId,w)};return c.jsxs("div",{className:s?`${Gl.collapseRow} ${Gl.collapseRowClickable}`:Gl.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?y:void 0,onKeyDown:s?w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),y())}:void 0,children:[c.jsxs("span",{className:Gl.collapseLabel,children:[c.jsxs("span",{className:Gl.processedLabel,children:[g,b&&c.jsxs("span",{className:Gl.processedMeta,children:[" ",h]})]}),v&&c.jsx("span",{className:Gl.summaryMetrics,children:p}),x&&c.jsx("span",{className:Gl.hiddenMetrics,children:m})]}),s&&c.jsx("span",{"data-testid":`toggle-${t.turnId}`,className:Gl.collapseIcon,onClick:w=>{w.stopPropagation(),y()},children:c.jsx("span",{className:t.collapsed?Gl.chevronRight:Gl.chevronDown,"aria-hidden":"true"})})]})});function Xz(e){if(e.type==="turn_collapse")return nr.turnStatusRow;if(e.type==="turn_outputs"||e.type==="turn_content")return nr.turnContentRow;if(e.type==="message"&&e.turnCollapse)return nr.turnAnswerRow}const qGe=f.memo(function({collapsed:t,children:n}){const r=l4(nr.turnContentClip,t?nr.turnContentCollapsed:void 0);return c.jsx("div",{className:r,"data-collapsed":t?"true":"false",children:c.jsx("div",{className:nr.turnContentInner,children:n})})}),HGe={thought:"thinking",commentary:"assistant update",tool:"tool calls",agents:"parallel agents",plan:"plan update",status:"status update",none:"turn"},UGe=["--background","--foreground","--muted-foreground","--border","--font-sans"],Qz="session-timeline-detail-tooltip",VGe=f.memo(function({entries:t,currentTurnId:n,currentRange:r,hidden:s,onSelect:i}){const o=yd(),{t:a}=gt(),l=f.useRef(null),u=f.useRef(null),d=f.useRef(null),h=f.useRef(!1),m=f.useRef(!1),p=f.useRef(null),g=f.useRef(null),[b,x]=f.useState(null),v=r!==null?r.currentIndex:t.findIndex(M=>M.id===n),y=f.useCallback(()=>x(null),[]),w=f.useCallback(()=>{h.current||m.current||y()},[y]),k=f.useCallback((M,L)=>{const N=l.current;if(!N)return null;const O=getComputedStyle(N),B=L.getBoundingClientRect();return{entry:M,top:B.top+B.height/2,left:B.right+8,clamped:!1,themeVars:Object.fromEntries(UGe.map($=>[$,O.getPropertyValue($)]))}},[]),T=f.useCallback(M=>{const L=u.current;if(!L)return null;const N=Array.from(L.querySelectorAll('[data-testid="session-timeline-entry"]')).find(O=>O.getAttribute("data-turn-id")===M.id);return(N==null?void 0:N.querySelector("button"))??null},[]),S=f.useCallback(M=>{const L=u.current;if(!L)return!1;const N=L.getBoundingClientRect(),O=M.getBoundingClientRect();return O.bottom>=N.top&&O.top<=N.bottom},[]),C=f.useCallback(()=>{x(M=>{if(!M)return null;const L=T(M.entry);return!L||!S(L)?null:k(M.entry,L)})},[k,T,S]),_=f.useCallback((M,L)=>{x(k(M,L))},[k]),A=f.useCallback(()=>{typeof window>"u"||(p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!0,p.current=window.requestAnimationFrame(()=>{p.current=null,m.current=!1,C()}),g.current=window.setTimeout(()=>{g.current=null,m.current=!1},100))},[C]);return f.useLayoutEffect(()=>{if(s)return;const M=u.current;if(!M||v<0)return;const L=M.querySelector(`[data-timeline-index="${v}"]`);if(!L)return;const N=L.offsetTop+L.offsetHeight/2,O=M.scrollHeight-M.clientHeight,B=Math.max(0,Math.min(N-M.clientHeight/2,O));if(M.scrollTop===B)return;h.current=!0,M.scrollTop=B;const $=window.requestAnimationFrame(()=>{h.current=!1,C()}),P=window.setTimeout(()=>{h.current=!1},100);return()=>{window.cancelAnimationFrame($),window.clearTimeout(P),h.current=!1}},[v,s,C]),f.useLayoutEffect(()=>{if(!(!b||typeof window>"u"))return window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)}},[C,b]),f.useLayoutEffect(()=>()=>{p.current!==null&&window.cancelAnimationFrame(p.current),g.current!==null&&window.clearTimeout(g.current),m.current=!1},[]),f.useLayoutEffect(()=>{if(!b||b.clamped)return;const M=l.current,L=d.current;if(!M||!L||typeof window>"u")return;const N=L.getBoundingClientRect(),O=12;let B=b.top;N.top<O?B+=O-N.top:N.bottom>window.innerHeight-O&&(B-=N.bottom-(window.innerHeight-O)),B!==b.top&&x($=>($==null?void 0:$.entry.id)===b.entry.id?{...$,top:B,clamped:!0}:$)},[b]),s||t.length===0?null:c.jsx("div",{className:nr.sessionTimelineLayer,"aria-hidden":"false",children:c.jsxs("nav",{ref:l,className:nr.sessionTimelinePanel,"aria-label":a("timeline.sessionTimeline"),"data-testid":"session-timeline",onMouseLeave:y,children:[c.jsx("div",{ref:u,className:nr.sessionTimelineViewport,"data-testid":"session-timeline-viewport",onScroll:w,children:c.jsx("ol",{className:nr.sessionTimelineList,children:t.map((M,L)=>{const N=r!==null&&L>=r.startIndex&&L<=r.endIndex,O=r!==null?L===r.currentIndex:M.id===n,B=M.nodeKinds.join(","),$=[`${a("timeline.turnPrefix",{index:L+1})}: ${M.label}`,O?a("timeline.currentTurn"):null].filter(Boolean).join(". "),P=H=>_(M,H.currentTarget),K=H=>{A(),_(M,H.currentTarget)},F=(b==null?void 0:b.entry.id)===M.id;return c.jsx("li",{className:nr.sessionTimelineItem,"data-testid":"session-timeline-entry","data-turn-id":M.id,"data-timeline-index":L,"data-node-kinds":B,"data-in-current-range":N?"true":void 0,children:c.jsx("button",{type:"button",className:l4(nr.sessionTimelineButton,N?nr.sessionTimelineButtonInRange:void 0,O?nr.sessionTimelineButtonCurrent:void 0),"aria-current":O?"step":void 0,"aria-describedby":F?Qz:void 0,"aria-label":$,onClick:()=>i(M.id),onFocus:K,onBlur:y,onMouseEnter:P,onMouseLeave:y,children:c.jsx("span",{className:nr.sessionTimelineTick})})},M.id)})})}),b&&typeof document<"u"&&rc.createPortal(c.jsxs("div",{ref:d,className:nr.sessionTimelineDetails,id:Qz,"data-testid":"session-timeline-detail","data-title":b.entry.label,"data-detail":b.entry.detail,"data-scheduled-task":b.entry.isScheduledTask?"true":void 0,role:"tooltip",style:{...b.themeVars,top:b.top,left:b.left},children:[c.jsxs("span",{className:nr.sessionTimelineDetailsTitle,children:[b.entry.isScheduledTask&&c.jsx(wGe,{}),c.jsx("span",{className:nr.sessionTimelineDetailsTitleText,children:b.entry.label})]}),c.jsx("span",{className:nr.sessionTimelineDetailsDetail,children:b.entry.detail})]}),o??document.body)]})})});function l4(...e){return e.filter(Boolean).join(" ")||void 0}const WGe=[];function GGe({label:e}){return c.jsxs(c.Fragment,{children:[c.jsx("div",{role:"status","aria-live":"polite",className:nr.srOnly,children:e}),c.jsxs("div",{className:nr.loadingSkeleton,"data-testid":"message-list-loading-skeleton","aria-hidden":"true",children:[c.jsx("div",{className:nr.loadingSkeletonUserRow,children:c.jsxs("div",{className:nr.loadingSkeletonUserBubble,children:[c.jsx("span",{className:nr.loadingSkeletonLineWide}),c.jsx("span",{className:nr.loadingSkeletonLineShort})]})}),c.jsx("div",{className:nr.loadingSkeletonAssistantRow,children:c.jsxs("div",{className:nr.loadingSkeletonAssistantBlock,children:[c.jsx("span",{className:nr.loadingSkeletonLineMedium}),c.jsx("span",{className:nr.loadingSkeletonLineWide}),c.jsx("span",{className:nr.loadingSkeletonLineNarrow})]})}),c.jsx("div",{className:nr.loadingSkeletonUserRow,children:c.jsx("div",{className:nr.loadingSkeletonUserBubbleCompact,children:c.jsx("span",{className:nr.loadingSkeletonLineMedium})})}),c.jsx("div",{className:nr.loadingSkeletonAssistantRow,children:c.jsxs("div",{className:nr.loadingSkeletonAssistantBlock,children:[c.jsx("span",{className:nr.loadingSkeletonLineWide}),c.jsx("span",{className:nr.loadingSkeletonLineMedium})]})})]})]})}const Gre=f.memo(f.forwardRef(function({messages:t,pendingApproval:n,onShowContextDetail:r,loadingTranscript:s,catchingUp:i,isResponding:o=!1,activeTurnStartedAt:a,welcomeHeader:l,centerWelcomeHeader:u=!1,workspaceCwd:d,tailContent:h,tailKey:m="tail",virtualScrollThreshold:p=Wre,autoScrollTailIntoView:g=!1,bottomOverlayInset:b=0,hideSessionTimeline:x=!1,showRetryHint:v=!1,onRetryClick:y,onBranchSession:w,onCanScrollToBottomChange:k,turnFileChanges:T,turnArtifacts:S,turnScheduledTasks:C,onReviewChanges:_,onOpenArtifact:A,onOpenScheduledTask:M,onTurnOutputOpen:L,generateContent:N},O){var Ls;const{t:B}=gt(),$=f.useContext(ip),P=f.useMemo(()=>$?lGe(t,n):t,[$,t,n]),K=f.useMemo(()=>cGe(zre(P),o,T,S,C),[P,o,T,S,C]),[F,H]=f.useState(!1),D=f.useRef(null),Q=f.useMemo(()=>{var st,Ct;if(!F)return WGe;const be=_Ge(P);return(((st=D.current)==null?void 0:st.signature)!==be||((Ct=D.current)==null?void 0:Ct.t)!==B)&&(D.current={signature:be,t:B,entries:xGe(P,B)}),D.current.entries},[F,P,B]),U=f.useMemo(()=>new Map(Q.map((be,st)=>[be.id,st])),[Q]),j=f.useMemo(()=>aGe(P),[P]),[ie,oe]=f.useState(null),J=ie!==null?((Ls=Q[ie.currentIndex])==null?void 0:Ls.id)??j:j,V=f.useMemo(()=>{var be;if(o)return null;for(let st=P.length-1;st>=0;st-=1){const Ct=P[st];if(Ct&&(Ct.role==="tool_group"||Ct.role==="plan"))return null;if((Ct==null?void 0:Ct.role)==="assistant"&&!Ct.isStreaming&&((be=Ct.content)!=null&&be.trim()))return Ct.id}return null},[o,P]),se=f.useMemo(()=>dGe(K,o),[K,o]),{collapseCompletedTurns:Z}=ou(),X=Z??!0,[te,ae]=f.useState(()=>new Map),xe=f.useRef(!0),Ae=f.useRef(!1),Ne=f.useRef(0),Le=f.useRef(0),ge=f.useRef(!1),Oe=f.useRef(0),Nt=f.useRef(null),Pe=f.useRef(null),Ce=f.useRef(!1),Zt=f.useRef(null),dt=f.useRef(!1),Ge=f.useRef(s),St=f.useRef(!!s),Y=f.useRef(void 0),je=f.useRef(void 0),We=f.useRef(b),Te=f.useRef(null),jt=f.useRef(i),zt=f.useRef(i),bn=f.useRef(!1),Pn=f.useRef(!1),qe=f.useRef(void 0),At=f.useRef(void 0),he=f.useRef(void 0);zt.current=i;const Be=f.useRef(null),Ie=f.useCallback(()=>{const be=Be.current,st=be?be.scrollHeight-be.scrollTop-be.clientHeight:0,Ct=!xe.current&&st>1;Pe.current!==Ct&&(Pe.current=Ct,k==null||k(Ct))},[k]),Ke=f.useCallback(()=>{he.current!==void 0&&window.cancelAnimationFrame(he.current),he.current=window.requestAnimationFrame(Ie)},[Ie]),ne=f.useCallback(be=>{xe.current!==be&&(xe.current=be,Ke())},[Ke]),De=f.useMemo(()=>jGe(K,{overrides:te,isResponding:o,activeTurnStartedAt:a,pendingApprovalCallId:(n==null?void 0:n.toolCallId)??null,enabled:X}),[K,te,o,a,n==null?void 0:n.toolCallId,X]),Dt=f.useMemo(()=>Vre(De),[De]),ze=Q.length>=LGe;f.useLayoutEffect(()=>{if(x){H(Bt=>Bt&&!1);return}const be=Be.current;if(!be)return;const st=()=>{const qt=be.getBoundingClientRect().width>=1160;H(tr=>tr===qt?tr:qt)};if(st(),typeof ResizeObserver>"u")return;const Ct=new ResizeObserver(st);return Ct.observe(be),()=>Ct.disconnect()},[x]);const Lt=h!=null,ke=!!s,Ot=!!l,fe=Ot?1:0,pt=fe+De.length,He=pt+(Lt?1:0),on=PGe(He,p),Ze=f.useCallback(()=>Be.current,[]),Et=f.useCallback(()=>{const be=Be.current;if(!be)return;const Ct=be.scrollHeight-be.scrollTop-be.clientHeight<sT;Ae.current=!Ct,ne(Ct),Ke()},[Ke,ne]),wn=f.useCallback(()=>{Ne.current=Date.now()+1e3},[]),qr=f.useCallback(()=>{Pn.current=!0,qe.current!==void 0&&window.cancelAnimationFrame(qe.current),At.current!==void 0&&window.clearTimeout(At.current),qe.current=window.requestAnimationFrame(Et),At.current=window.setTimeout(()=>{Pn.current=!1,qe.current=void 0,At.current=void 0,Et()},220)},[Et]);f.useEffect(()=>()=>{qe.current!==void 0&&window.cancelAnimationFrame(qe.current),At.current!==void 0&&window.clearTimeout(At.current),he.current!==void 0&&window.cancelAnimationFrame(he.current),Y.current!==void 0&&window.cancelAnimationFrame(Y.current),je.current!==void 0&&window.cancelAnimationFrame(je.current)},[]);const cr=f.useCallback((be,st)=>{const Ct=Be.current;(!Ct||Ct.scrollHeight>Ct.clientHeight+1)&&(Ae.current=!0,ne(!1)),qr(),ae(Bt=>{const qt=new Map(Bt);return qt.set(be,st),qt})},[qr,ne]),Jn=f.useCallback(be=>{const st=be.target;st instanceof HTMLElement&&st.closest("[aria-expanded]")&&(Ae.current=!0,ne(!1),qr())},[qr,ne]),Ft=f.useCallback(be=>{if(Ot&&be===nT)return"slot:header";if(Lt&&be===pt)return`slot:tail:${m}`;const st=De[be-fe];return st?Wz(st):`slot:row:${be}`},[Ot,Lt,pt,m,De,fe]),dn=f.useCallback((be="auto")=>{const st=Ze();if(!st||st.scrollHeight<=st.clientHeight)return;Oe.current+=1;const Ct=Oe.current;ge.current=!0,be==="smooth"?st.scrollTo({top:st.scrollHeight,behavior:be}):st.scrollTop=st.scrollHeight,Ke(),Le.current=Math.max(0,st.scrollHeight-st.clientHeight),Ie();const Bt=()=>{Oe.current===Ct&&(ge.current=!1)};be==="smooth"?setTimeout(Bt,350):requestAnimationFrame(Bt)},[Ze,Ie,Ke]),sr=f.useCallback((be="smooth")=>{Ae.current=!1,ne(!0),dn(be)},[dn,ne]),Rn=Dme({count:He,enabled:on,getScrollElement:Ze,getItemKey:Ft,estimateSize:be=>{if(Ot&&be===nT)return IGe;if(Lt&&be===pt)return DGe;const st=De[be-fe];return(st==null?void 0:st.type)==="turn_collapse"?RGe:(st==null?void 0:st.type)==="turn_content"?Math.max(rT,st.items.length*rT):rT},overscan:20,useFlushSync:!1,useAnimationFrameWithResizeObserver:!0}),Vn=Rn.getVirtualItems(),Zn=Rn.getTotalSize(),kn=f.useRef({entryIndexById:new Map,headerOffset:0,isVisible:!1,turnIdByDisplayIndex:[],visibleItems:[]});kn.current={entryIndexById:U,headerOffset:fe,isVisible:F,turnIdByDisplayIndex:Dt,visibleItems:De};const er=f.useCallback(()=>{const be=Ze(),st=kn.current;if(!be||!st.isVisible||st.entryIndexById.size===0){oe(An=>An===null?An:null);return}const Ct=be.getBoundingClientRect(),Bt=Ct.top,qt=Ct.bottom,tr=Bt+(qt-Bt)/2,Lr=[];let ss=null,Vr=Number.POSITIVE_INFINITY;be.querySelectorAll("[data-index]").forEach(An=>{const Er=An.dataset.index;if(Er===void 0)return;const Pr=Number(Er);if(!Number.isFinite(Pr))return;const de=Pr-st.headerOffset;if(de<0||de>=st.visibleItems.length)return;const Ee=An.getBoundingClientRect();if(Ee.bottom<Bt||Ee.top>qt)return;Lr.push(de);const rt=Ee.top+(Ee.bottom-Ee.top)/2,yt=Math.abs(rt-tr);yt<Vr&&(Vr=yt,ss=de)});const $n=MGe(st.visibleItems,Lr,st.entryIndexById,ss,st.turnIdByDisplayIndex);oe(An=>(An==null?void 0:An.startIndex)===($n==null?void 0:$n.startIndex)&&(An==null?void 0:An.endIndex)===($n==null?void 0:$n.endIndex)&&(An==null?void 0:An.currentIndex)===($n==null?void 0:$n.currentIndex)?An:$n)},[Ze]),Ms=f.useCallback(()=>{Nt.current!==null&&cancelAnimationFrame(Nt.current),Nt.current=requestAnimationFrame(()=>{Nt.current=null,er()})},[er]);f.useEffect(()=>()=>{Nt.current!==null&&(cancelAnimationFrame(Nt.current),Nt.current=null)},[]),f.useEffect(()=>{Ms()},[Ms,He,Zn,on,Vn.length,F]);const[Ss,Hr]=f.useState(null);f.useEffect(()=>{if(!Ss)return;const be=setTimeout(()=>Hr(null),1600);return()=>clearTimeout(be)},[Ss]);const rs=f.useCallback((be,st)=>{var Bt,qt;Ae.current=!0,ne(!1),Oe.current+=1;const Ct=Oe.current;ge.current=!0,on?Rn.scrollToIndex(be,{align:"center"}):(qt=(Bt=Be.current)==null?void 0:Bt.querySelector(`[data-index="${be}"]`))==null||qt.scrollIntoView({block:"center"}),setTimeout(()=>{Oe.current===Ct&&(ge.current=!1,Ms(),Ke())},150),Hr(null),requestAnimationFrame(()=>Hr(st))},[on,Rn,ne,Ms,Ke]),Hs=f.useRef({visibleItems:[],displayItems:[],headerOffset:0,performScrollToRow:()=>{}});Hs.current={visibleItems:De,displayItems:K,headerOffset:fe,performScrollToRow:rs};const Us=f.useRef(null),Ur=f.useCallback((be,st)=>{const{visibleItems:Ct,displayItems:Bt,headerOffset:qt,performScrollToRow:tr}=Hs.current,Lr=n2(Ct,be,st);if(Lr>=0){const $n=Ct[Lr];return($n==null?void 0:$n.type)==="turn_content"&&$n.collapsed?(Us.current={messageId:be,callId:st},ae(An=>{if(An.get($n.turnId)===!0)return An;const Er=new Map(An);return Er.set($n.turnId,!0),Er}),!0):(Us.current=null,tr(Lr+qt,{messageId:be,callId:st}),!0)}const ss=n2(Bt,be,st);if(ss<0)return!1;const Vr=Ure(Bt,ss);return Vr?(Us.current={messageId:be,callId:st},ae($n=>{if($n.get(Vr)===!0)return $n;const An=new Map($n);return An.set(Vr,!0),An}),!0):!1},[]);f.useImperativeHandle(O,()=>({scrollToMessage:Ur,scrollToBottom:sr}),[Ur,sr]),f.useEffect(()=>{const be=Us.current;if(!be)return;const st=n2(De,be.messageId,be.callId);st<0||(Us.current=null,rs(st+fe,be))},[De,fe,rs]);const Ar=f.useCallback(()=>{const be=Ze();if(!be)return;if(ge.current){Le.current=be.scrollTop;return}Ms();const st=Le.current,Ct=be.scrollTop;Le.current=Ct;const Bt=be.scrollHeight-Ct-be.clientHeight;if(Ke(),Ct<st-1){const qt=Bt<sT,tr=Date.now()<=Ne.current;qt?(Ae.current=!1,ne(!0)):tr?(Ae.current=!0,ne(!1)):Ae.current||ne(!1);return}Bt<sT&&(Ae.current=!1,ne(!0))},[Ze,Ke,Ms,ne]);f.useEffect(()=>{const be=Ze();if(be)return be.addEventListener("scroll",Ar,{passive:!0}),()=>be.removeEventListener("scroll",Ar)},[Ze,Ar]),f.useEffect(()=>{const be=Ze();if(!be)return;const st=Bt=>{const qt=be.getBoundingClientRect(),tr=20;(Bt.clientX>=qt.right-tr||Bt.clientY>=qt.bottom-tr)&&wn()},Ct=Bt=>{(Bt.key==="ArrowUp"||Bt.key==="ArrowDown"||Bt.key==="PageUp"||Bt.key==="PageDown"||Bt.key==="Home"||Bt.key==="End"||Bt.key===" ")&&wn()};return be.addEventListener("wheel",wn,{passive:!0}),be.addEventListener("touchstart",wn,{passive:!0}),be.addEventListener("pointerdown",st,{passive:!0}),be.addEventListener("keydown",Ct,{passive:!0}),()=>{be.removeEventListener("wheel",wn),be.removeEventListener("touchstart",wn),be.removeEventListener("pointerdown",st),be.removeEventListener("keydown",Ct)}},[Ze,wn]),f.useEffect(()=>{const be=Ze();if(!be||typeof ResizeObserver>"u")return;const st=new ResizeObserver(Ke);st.observe(be);for(const Bt of Array.from(be.children))st.observe(Bt);const Ct=new MutationObserver(Bt=>{for(const qt of Bt){for(const tr of Array.from(qt.addedNodes))tr instanceof HTMLElement&&st.observe(tr);for(const tr of Array.from(qt.removedNodes))tr instanceof HTMLElement&&st.unobserve(tr)}Ke()});return Ct.observe(be,{childList:!0}),Ke(),()=>{st.disconnect(),Ct.disconnect()}},[Ze,Ke]),f.useEffect(()=>{t.length===0&&(Ae.current=!1,ne(!0),Us.current=null,ae(be=>be.size?new Map:be))},[t.length,ne]),f.useEffect(()=>{const be=Be.current;if(!be)return;const st=new ResizeObserver(()=>{Ms(),!zt.current&&(Ae.current||(ne(!0),requestAnimationFrame(()=>{!zt.current&&!Ae.current&&dn()})))});return st.observe(be),()=>st.disconnect()},[dn,Ms,ne]),f.useLayoutEffect(()=>{const be=iGe(t);if(i||s||Ge.current){Zt.current=be,Ce.current=!0,dt.current=!1,Ge.current=s;return}if(Ge.current=s,!Ce.current){Zt.current=be,Ce.current=!0,dt.current=!1;return}const st=oGe(t);be&&(st==null?void 0:st.role)==="user"&&be!==Zt.current?(Ae.current=!1,ne(!0),Us.current=null,dt.current=!0):dt.current=!1,Zt.current=be},[t,i,s,ne]),f.useLayoutEffect(()=>{jt.current&&!i&&(Ae.current=!1,ne(!0),dn("auto")),jt.current=i},[i,dn,ne]),f.useLayoutEffect(()=>{if(s){St.current=!0;return}if(!St.current||i||t.length===0)return;St.current=!1,Ae.current=!1,ne(!0),Us.current=null,Y.current!==void 0&&window.cancelAnimationFrame(Y.current),je.current!==void 0&&window.cancelAnimationFrame(je.current);const be=()=>{zt.current||Ae.current||(ne(!0),dn("auto"))};Y.current=window.requestAnimationFrame(()=>{Y.current=void 0,be(),je.current=window.requestAnimationFrame(()=>{je.current=void 0,be()})})},[i,s,t.length,dn,ne]),f.useLayoutEffect(()=>{const be=We.current!==b;We.current=b,be&&(i||Ae.current||(ne(!0),requestAnimationFrame(()=>{!zt.current&&!Ae.current&&dn("auto")})))},[b,i,dn,ne]);const Un=f.useMemo(()=>SGe(De),[De]);f.useLayoutEffect(()=>{if(!i){if(!Un){Te.current=null;return}Un!==Te.current&&(Te.current=Un,(xe.current||!Ae.current)&&requestAnimationFrame(()=>{Ae.current||(ne(!0),dn())}))}},[i,Un,dn,ne]),f.useEffect(()=>{g&&Lt&&!bn.current&&(Ae.current=!1,ne(!0),requestAnimationFrame(()=>{Ae.current||dn()})),bn.current=Lt},[g,Lt,dn,ne]);const or=f.useCallback(be=>{const st=(qt,tr)=>{if(qt.type==="parallel_agents")return c.jsx(K8,{timestamp:qt.timestamp,children:c.jsx("div",{className:cE(qt,Ss)?lf.flash:void 0,children:c.jsx(fWe,{agents:qt.agents,pendingApproval:n})})});if(qt.type==="turn_outputs")return c.jsx(zVe,{changes:qt.changes,turnId:qt.turnId,artifacts:qt.artifacts,scheduledTasks:qt.scheduledTasks,workspaceCwd:d,onOpenRequest:L,onReviewChanges:_??Z6,onOpenArtifact:A??Z6,onOpenScheduledTask:M??Z6});if(qt.type==="turn_collapse")return c.jsx(FGe,{turnCollapse:qt.turnCollapse,onToggleCollapse:cr});if(qt.type==="turn_content")return c.jsx(qGe,{collapsed:qt.collapsed,children:qt.items.map(Vr=>c.jsx("div",{className:Xz(Vr),children:st(Vr,!1)},Wz(Vr)))});const Lr=qt.message.role==="assistant"?se.get(qt.message.id):void 0;let ss;return qt.message.role==="assistant"&&Lr&&(ss={turnId:Lr,message:{id:qt.message.id,content:qt.message.content,isStreaming:qt.message.isStreaming,timestamp:qt.message.timestamp}}),c.jsx(eVe,{message:qt.message,pendingApproval:n,onShowContextDetail:r,workspaceCwd:d,isLatest:tr,showRetryHint:v,onRetryClick:y,onBranchSession:w,showAssistantActions:qt.message.role==="assistant"&&se.has(qt.message.id),showAssistantBranch:qt.message.role==="assistant"&&qt.message.id===V,isLocateFlashing:cE(qt,Ss),assistantTurnFooterInfo:ss,generateContent:N})};if(Ot&&be===nT)return l;if(Lt&&be===pt)return h;const Ct=be-fe,Bt=De[Ct];return Bt?st(Bt,Ct===De.length-1):null},[Ot,l,Lt,h,pt,n,r,N,fe,De,Ss,se,V,d,v,y,w,cr,A,M,_,L]),Cs=f.useCallback(be=>be?Xz(be):void 0,[]);return f.useLayoutEffect(()=>{if(i)return;const be=dt.current;ge.current&&!be||Pn.current&&!be||(xe.current||be||!Ae.current)&&(Ae.current||ne(!0),dn(be?"smooth":"auto"),dt.current=!1)},[Zn,t,He,i,dn,ne]),f.useLayoutEffect(()=>{Ke()},[t,Ke,He,Zn]),c.jsxs("div",{ref:Be,className:l4(nr.list,Ot&&u?nr.listWithWelcomeHeader:void 0),"data-web-shell-message-list":!0,onClickCapture:Jn,children:[ke&&c.jsx(GGe,{label:B("editor.sessionLoading")}),c.jsx(VGe,{entries:Q,currentTurnId:J,currentRange:ie,hidden:!F||!ze,onSelect:Ur}),on?c.jsx("div",{className:nr.virtualSizer,style:{height:Zn},children:Vn.map(be=>c.jsx("div",{"data-index":be.index,ref:Rn.measureElement,className:l4(nr.virtualRow,Cs(De[be.index-fe])),"data-web-shell-message-row":!0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${be.start}px)`},children:or(be.index)},be.key))}):Array.from({length:He},(be,st)=>{const Ct=Ft(st),Bt=De[st-fe];return c.jsx("div",{"data-index":st,className:Cs(Bt),"data-web-shell-message-row":!0,children:or(st)},Ct)})]})}));/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */function KGe(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 Jz(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||!KGe(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}const YGe="_editorShell_1bwk2_1",XGe="_editorShellDropdownOpen_1bwk2_7",QGe="_container_1bwk2_11",JGe="_content_1bwk2_30",ZGe="_dacAura_1bwk2_46",eKe="_dacHalo_1bwk2_47",tKe="_atPortalLayer_1bwk2_188",nKe="_slashPanel_1bwk2_226",rKe="_slashPanelBody_1bwk2_235",sKe="_slashList_1bwk2_240",iKe="_slashEntry_1bwk2_267",oKe="_slashSection_1bwk2_273",aKe="_slashSectionHeader_1bwk2_279",lKe="_slashSectionCount_1bwk2_292",cKe="_slashItem_1bwk2_300",uKe="_slashItemActive_1bwk2_326",dKe="_slashCommand_1bwk2_330",hKe="_slashDetail_1bwk2_335",fKe="_slashDetailCommand_1bwk2_345",mKe="_slashDetailText_1bwk2_355",pKe="_slashDescription_1bwk2_375",gKe="_atPanel_1bwk2_386",bKe="_atPanelHeaderWrap_1bwk2_410",yKe="_atPanelHeader_1bwk2_410",vKe="_atBackButton_1bwk2_425",xKe="_atPanelTitle_1bwk2_447",wKe="_atTabsWrap_1bwk2_456",kKe="_atTabs_1bwk2_456",_Ke="_atTab_1bwk2_456",SKe="_atTabScrollButton_1bwk2_480",CKe="_atTabActive_1bwk2_512",TKe="_atSearchInput_1bwk2_523",AKe="_atList_1bwk2_542",EKe="_atItem_1bwk2_570",MKe="_atItemActive_1bwk2_592",NKe="_atItemSingleLine_1bwk2_596",jKe="_atItemMain_1bwk2_602",IKe="_atItemLeading_1bwk2_613",RKe="_atItemIcon_1bwk2_623",DKe="_atItemImageIcon_1bwk2_634",LKe="_atItemIconSpin_1bwk2_642",PKe="_atItemLabel_1bwk2_646",OKe="_atItemSubtitle_1bwk2_647",BKe="_atItemDescription_1bwk2_674",$Ke="_atItemTrailing_1bwk2_685",zKe="_atEmpty_1bwk2_692",FKe="_attachments_1bwk2_710",qKe="_tags_1bwk2_720",HKe="_tag_1bwk2_720",UKe="_tagContent_1bwk2_743",VKe="_tagTooltip_1bwk2_751",WKe="_tagLabel_1bwk2_775",GKe="_tagValue_1bwk2_776",KKe="_tagIcon_1bwk2_780",YKe="_tagRemove_1bwk2_815",XKe="_editorArea_1bwk2_835",QKe="_shellPrefix_1bwk2_863",JKe="_toolbar_1bwk2_901",ZKe="_toolbarLeading_1bwk2_911",eYe="_toolbarStart_1bwk2_912",tYe="_toolbarEnd_1bwk2_913",nYe="_toolbarLeft_1bwk2_914",rYe="_toolbarRight_1bwk2_915",sYe="_gitBranchChip_1bwk2_939",iYe="_gitBranchIcon_1bwk2_954",oYe="_gitBranchText_1bwk2_966",aYe="_workspaceChip_1bwk2_975",lYe="_workspaceChipAccented_1bwk2_994",cYe="_workspaceChipIcon_1bwk2_998",uYe="_workspaceChipText_1bwk2_1014",dYe="_toolbarRightCustom_1bwk2_1026",hYe="_toolbarMeasurements_1bwk2_1032",fYe="_dropdownWrapper_1bwk2_1043",mYe="_dropdownWrapperCompact_1bwk2_1047",pYe="_dropdownList_1bwk2_1052",gYe="_dropdownListConstrained_1bwk2_1062",bYe="_dropdownEmpty_1bwk2_1066",yYe="_dropdownItem_1bwk2_1073",vYe="_dropdownRich_1bwk2_1090",xYe="_dropdownCheck_1bwk2_1099",wYe="_dropdownItemActive_1bwk2_1111",kYe="_dropdownItemIcon_1bwk2_1116",_Ye="_dropdownItemCheck_1bwk2_1117",SYe="_dropdownItemContent_1bwk2_1134",CYe="_dropdownItemLabel_1bwk2_1141",TYe="_dropdownItemDesc_1bwk2_1151",AYe="_toolBtn_1bwk2_1165",EYe="_modeToolBtn_1bwk2_1183",MYe="_modelToolBtn_1bwk2_1184",NYe="_workspaceSelectTrigger_1bwk2_1193",jYe="_workspaceSelectTooltipTrigger_1bwk2_1211",IYe="_gitBranchChipCompact_1bwk2_1228",RYe="_workspaceChipCompact_1bwk2_1229",DYe="_workspaceSelectTriggerCompact_1bwk2_1230",LYe="_toolBtnCompact_1bwk2_1231",PYe="_workspaceSelectTooltipTriggerCompact_1bwk2_1241",OYe="_toolBtnText_1bwk2_1251",BYe="_toolBtnArrow_1bwk2_1252",$Ye="_toolBtnIcon_1bwk2_1279",zYe="_widthModeBtn_1bwk2_1295",FYe="_quickActionsBtn_1bwk2_1304",qYe="_toolBtnModeIcon_1bwk2_1313",HYe="_toolBtnModelIcon_1bwk2_1314",UYe="_quickActionsPanel_1bwk2_1360",VYe="_quickActionsHeader_1bwk2_1373",WYe="_quickActionsLayout_1bwk2_1380",GYe="_quickActionsGrid_1bwk2_1387",KYe="_quickAction_1bwk2_1304",YYe="_quickActionLabel_1bwk2_1418",XYe="_quickKeysGrid_1bwk2_1433",QYe="_quickKey_1bwk2_1433",JYe="_quickKeyLabel_1bwk2_1462",ZYe="_sendBtn_1bwk2_1475",eXe="_sendBtnRunning_1bwk2_1513",tXe="_sendIcon_1bwk2_1526",nXe="_stopIcon_1bwk2_1532",rXe="_loadingIcon_1bwk2_1539",sXe="_sendBtnArmed_1bwk2_1551",iXe="_escLabel_1bwk2_1619",oXe="_srOnly_1bwk2_1627",aXe="_images_1bwk2_1649",lXe="_imageThumb_1bwk2_1657",cXe="_imageRemove_1bwk2_1672",uXe="_searchPanel_1bwk2_1693",dXe="_searchBar_1bwk2_1710",hXe="_searchLabel_1bwk2_1718",fXe="_searchInput_1bwk2_1723",mXe="_searchResults_1bwk2_1737",pXe="_searchResult_1bwk2_1737",gXe="_searchResultActive_1bwk2_1770",bXe="_searchResultMarker_1bwk2_1775",yXe="_searchResultText_1bwk2_1780",vXe="_searchEmpty_1bwk2_1787",ye={editorShell:YGe,editorShellDropdownOpen:XGe,container:QGe,content:JGe,dacAura:ZGe,dacHalo:eKe,atPortalLayer:tKe,slashPanel:nKe,slashPanelBody:rKe,slashList:sKe,slashEntry:iKe,slashSection:oKe,slashSectionHeader:aKe,slashSectionCount:lKe,slashItem:cKe,slashItemActive:uKe,slashCommand:dKe,slashDetail:hKe,slashDetailCommand:fKe,slashDetailText:mKe,slashDescription:pKe,atPanel:gKe,atPanelHeaderWrap:bKe,atPanelHeader:yKe,atBackButton:vKe,atPanelTitle:xKe,atTabsWrap:wKe,atTabs:kKe,atTab:_Ke,atTabScrollButton:SKe,atTabActive:CKe,atSearchInput:TKe,atList:AKe,atItem:EKe,atItemActive:MKe,atItemSingleLine:NKe,atItemMain:jKe,atItemLeading:IKe,atItemIcon:RKe,atItemImageIcon:DKe,atItemIconSpin:LKe,atItemLabel:PKe,atItemSubtitle:OKe,atItemDescription:BKe,atItemTrailing:$Ke,atEmpty:zKe,attachments:FKe,tags:qKe,tag:HKe,tagContent:UKe,tagTooltip:VKe,tagLabel:WKe,tagValue:GKe,tagIcon:KKe,tagRemove:YKe,editorArea:XKe,shellPrefix:QKe,toolbar:JKe,toolbarLeading:ZKe,toolbarStart:eYe,toolbarEnd:tYe,toolbarLeft:nYe,toolbarRight:rYe,gitBranchChip:sYe,gitBranchIcon:iYe,gitBranchText:oYe,workspaceChip:aYe,workspaceChipAccented:lYe,workspaceChipIcon:cYe,workspaceChipText:uYe,toolbarRightCustom:dYe,toolbarMeasurements:hYe,dropdownWrapper:fYe,dropdownWrapperCompact:mYe,dropdownList:pYe,dropdownListConstrained:gYe,dropdownEmpty:bYe,dropdownItem:yYe,dropdownRich:vYe,dropdownCheck:xYe,dropdownItemActive:wYe,dropdownItemIcon:kYe,dropdownItemCheck:_Ye,dropdownItemContent:SYe,dropdownItemLabel:CYe,dropdownItemDesc:TYe,toolBtn:AYe,modeToolBtn:EYe,modelToolBtn:MYe,workspaceSelectTrigger:NYe,workspaceSelectTooltipTrigger:jYe,gitBranchChipCompact:IYe,workspaceChipCompact:RYe,workspaceSelectTriggerCompact:DYe,toolBtnCompact:LYe,workspaceSelectTooltipTriggerCompact:PYe,toolBtnText:OYe,toolBtnArrow:BYe,toolBtnIcon:$Ye,widthModeBtn:zYe,quickActionsBtn:FYe,toolBtnModeIcon:qYe,toolBtnModelIcon:HYe,quickActionsPanel:UYe,quickActionsHeader:VYe,quickActionsLayout:WYe,quickActionsGrid:GYe,quickAction:KYe,quickActionLabel:YYe,quickKeysGrid:XYe,quickKey:QYe,quickKeyLabel:JYe,sendBtn:ZYe,sendBtnRunning:eXe,sendIcon:tXe,stopIcon:nXe,loadingIcon:rXe,sendBtnArmed:sXe,escLabel:iXe,srOnly:oXe,images:aXe,imageThumb:lXe,imageRemove:cXe,searchPanel:uXe,searchBar:dXe,searchLabel:hXe,searchInput:fXe,searchResults:mXe,searchResult:pXe,searchResultActive:gXe,searchResultMarker:bXe,searchResultText:yXe,searchEmpty:vXe},xXe=["--chat-editor-accent-color","--chat-editor-text-primary","--accent","--background","--foreground","--muted-foreground","--chat-editor-border-color","--font-sans"];function wXe({menu:e,anchorRef:t,panelRef:n,onSelect:r,onAccept:s,onBack:i,onSearch:o,onSelectTab:a}){const l=yd(),{t:u}=gt(),d=f.useRef([]),h=f.useRef(null),m=f.useRef(null),[p,g]=f.useState(null),[b,x]=f.useState({});f.useEffect(()=>{var _;(_=d.current[e.selectedIndex])==null||_.scrollIntoView({block:"nearest"})},[e.level,e.selectedIndex]),f.useEffect(()=>{if(e.level!=="items"||e.inputMode!=="search"||document.activeElement===h.current)return;const _=()=>{var L;return(L=h.current)==null?void 0:L.focus()},A=window.requestAnimationFrame(_),M=window.setTimeout(_,0);return()=>{window.cancelAnimationFrame(A),window.clearTimeout(M)}},[e.inputMode,e.level,e.selectedProviderId]),f.useLayoutEffect(()=>{const _=t.current;if(!_)return;const A=getComputedStyle(_);x(Object.fromEntries(xXe.map(M=>[M,A.getPropertyValue(M)])))},[t]),f.useLayoutEffect(()=>{const _=t.current;if(!_)return;let A=null;const M=()=>{var H;const O=_.getBoundingClientRect(),B=((H=n.current)==null?void 0:H.offsetWidth)??360,$=getComputedStyle(_),P=Number.parseFloat($.getPropertyValue("--web-shell-popover-safe-top"))||48,K=Math.max(96,Math.min(300,O.top-P-8)),F={left:Math.max(12,Math.min(O.left+16,window.innerWidth-B-12)),bottom:window.innerHeight-O.top+8,width:O.width,maxHeight:K};g(D=>D&&D.left===F.left&&D.bottom===F.bottom&&D.width===F.width&&D.maxHeight===F.maxHeight?D:F)},L=()=>{A===null&&(A=window.requestAnimationFrame(()=>{A=null,M()}))};M();const N=new ResizeObserver(L);return N.observe(_),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0),()=>{A!==null&&window.cancelAnimationFrame(A),N.disconnect(),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}},[t,n]);const v=e.level==="categories"?e.providers.map(_=>({id:_.id,label:_.label,labelTitle:_.textValue,description:_.description,trailing:"›",provider:_})):e.items.map(_=>({id:_.id,label:_.label,labelTitle:_.label,subtitle:_.subtitle,description:e.selectedProviderId===Xi?void 0:_.description??_.detail,icon:_.icon,iconMode:_.iconMode,iconColor:_.iconColor,iconSpin:_.iconSpin,iconTooltip:_.iconTooltip,trailing:_.kind==="directory"||_.kind==="mcp-server"?"›":"",item:_}));if(f.useEffect(()=>{d.current.length=v.length},[v.length]),!p)return null;const y=e.providers.find(_=>_.id===e.selectedProviderId),w=e.itemMode==="mcpResources"&&e.mcpServerName?ys(e.mcpServerName)??"[invalid]":(y==null?void 0:y.label)??"",k=e.itemMode==="mcpResources"&&e.mcpServerName?ys(e.mcpServerName)??"[invalid]":(y==null?void 0:y.textValue)??"",T=e.level==="items"?(y==null?void 0:y.textValue)??u("at.menu"):u("at.menu"),S="at-mention-listbox",C=e.selectedIndex>=0&&e.selectedIndex<v.length?`at-mention-option-${e.selectedIndex}`:void 0;return rc.createPortal(c.jsx("div",{className:ye.atPortalLayer,style:b,children:c.jsxs("div",{ref:n,className:ye.atPanel,"data-at-mention-panel":"true",style:{...b,left:p.left,bottom:p.bottom,"--at-anchor-width":`${p.width}px`,"--at-panel-max-height":`${p.maxHeight}px`},role:"region","aria-label":T,onMouseDown:_=>{_.target instanceof HTMLInputElement||_.preventDefault()},children:[e.level==="items"&&c.jsxs("div",{className:ye.atPanelHeaderWrap,children:[c.jsxs("div",{className:ye.atPanelHeader,children:[c.jsx("button",{type:"button",className:ye.atBackButton,"aria-label":u("common.back"),onMouseDown:_=>{_.preventDefault(),_.stopPropagation()},onClick:_=>{_.preventDefault(),_.stopPropagation(),i()},children:"‹"}),c.jsx("span",{className:ye.atPanelTitle,title:k,children:w})]}),c.jsx("input",{ref:h,className:ye.atSearchInput,value:e.query,placeholder:u("common.search"),"aria-label":u("common.search"),"aria-controls":S,"aria-activedescendant":C,onMouseDown:_=>_.stopPropagation(),onClick:_=>_.stopPropagation(),onChange:_=>o(_.currentTarget.value),onKeyDown:_=>{if(!(_.nativeEvent.isComposing||_.nativeEvent.keyCode===229)){if(_.key==="Escape")_.preventDefault(),_.stopPropagation(),i();else if(_.key==="Enter")_.preventDefault(),_.stopPropagation(),s();else if(_.key==="Tab"&&!_.shiftKey&&!_.altKey&&!_.ctrlKey&&!_.metaKey)_.preventDefault(),_.stopPropagation(),s();else if(_.key==="ArrowUp"){if(_.preventDefault(),_.stopPropagation(),v.length===0)return;r(Math.max(0,e.selectedIndex-1))}else if(_.key==="ArrowDown"){if(_.preventDefault(),_.stopPropagation(),v.length===0)return;r(Math.min(v.length-1,e.selectedIndex+1))}}}}),e.tabs&&e.tabs.length>0&&c.jsxs("div",{className:ye.atTabsWrap,children:[c.jsx("button",{type:"button",className:ye.atTabScrollButton,"aria-label":"Previous tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),Zz(m.current,"previous")},children:"‹"}),c.jsx("div",{ref:m,className:ye.atTabs,role:"tablist",children:e.tabs.map(_=>{const A=_.id===e.selectedTabId,M=_.textValue??(typeof _.label=="string"?_.label:_.id);return c.jsx("button",{type:"button",role:"tab","aria-selected":A,disabled:_.disabled,className:`${ye.atTab} ${A?ye.atTabActive:""}`,title:M,onClick:L=>{L.preventDefault(),L.stopPropagation(),a(_.id)},children:_.label},_.id)})}),c.jsx("button",{type:"button",className:ye.atTabScrollButton,"aria-label":"Next tab",onClick:_=>{_.preventDefault(),_.stopPropagation(),Zz(m.current,"next")},children:"›"})]})]}),c.jsx("div",{id:S,className:ye.atList,role:v.length>0?"listbox":void 0,"aria-label":v.length>0?T:void 0,children:e.loading&&v.length===0?c.jsx("div",{className:ye.atEmpty,role:"status","aria-live":"polite",children:u("common.loading")}):v.length===0?c.jsx("div",{className:ye.atEmpty,role:"status","aria-live":"polite",children:u("common.noResults")}):v.map((_,A)=>{const M=A===e.selectedIndex,L="item"in _?y==null?void 0:y.provider:_.provider.provider;let N;if("item"in _&&(L!=null&&L.renderItem))try{N=L.renderItem({item:_.item,provider:L,selected:M})}catch(B){console.warn("[WebShell] at mention item render failed",B)}const O="icon"in _&&_.icon&&Jg(_.icon)?_.icon:void 0;return c.jsxs("button",{ref:B=>{d.current[A]=B},type:"button",id:`at-mention-option-${A}`,role:"option","aria-selected":M,className:`${ye.atItem} ${M?ye.atItemActive:""} ${_.description?"":ye.atItemSingleLine}`,style:{"--at-item-main-template":kXe(_Xe(_.label,_.labelTitle),"subtitle"in _?_.subtitle:void 0)},onMouseEnter:()=>r(A),onMouseDown:B=>{B.preventDefault(),B.stopPropagation()},onClick:B=>{B.preventDefault(),B.stopPropagation(),s(A)},children:[N??c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:ye.atItemMain,children:[c.jsxs("span",{className:ye.atItemLeading,children:["icon"in _&&O&&(_.iconMode==="image"?c.jsx("img",{className:ye.atItemImageIcon,src:O,title:_.iconTooltip,alt:"","aria-hidden":"true"}):c.jsx("span",{className:`${ye.atItemIcon} ${_.iconSpin?ye.atItemIconSpin:""}`,style:{...Th("--at-item-icon-url",O),color:_.iconColor},title:_.iconTooltip,"aria-hidden":"true"})),c.jsx("span",{className:ye.atItemLabel,title:_.labelTitle,children:_.label})]}),"subtitle"in _&&_.subtitle&&c.jsx("span",{className:ye.atItemSubtitle,title:_.subtitle,children:_.subtitle})]}),_.description&&c.jsx("span",{className:ye.atItemDescription,title:_.description,children:_.description})]}),_.trailing&&c.jsx("span",{className:ye.atItemTrailing,"aria-hidden":"true",children:_.trailing})]},_.id)})})]})}),l??document.body)}function Zz(e,t){if(!e)return;const n=Math.max(96,e.clientWidth*.75);e.scrollBy({left:t==="previous"?-n:n,behavior:"smooth"})}function kXe(e,t){if(!t)return"minmax(0, 1fr)";const n=eF(e);return eF(t)<=12?"minmax(0, 1fr) max-content":n<=18?"max-content minmax(0, 1fr)":"minmax(0, 3fr) minmax(0, 2fr)"}function _Xe(e,t){return typeof e=="string"?e:typeof e=="number"?String(e):t||""}function eF(e){return Array.from(e).reduce((t,n)=>t+(n.charCodeAt(0)>255?2:1),0)}const SXe="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",CXe="/assets/default-aEtf0G7-.svg",Kre="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",TXe="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",AXe="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",EXe="_icon_i7y0u_1",MXe={icon:EXe},NXe={auto:SXe,"auto-edit":Kre,default:CXe,plan:TXe,yolo:AXe};function Ab({mode:e}){const t=NXe[e];return t?c.jsx("span",{className:MXe.icon,style:Th("--mode-icon-url",t),"aria-hidden":"true"}):c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M6 18c.7-2.7 2.2-4 4.5-4H12M7 6h10M7 10h7M17.5 14.5l2 2-2 2",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function jXe(e,t){const n=new Map;if(t==="command")for(const s of e)s.section&&n.set(s.section,(n.get(s.section)??0)+1);let r;return e.map((s,i)=>{const o=s.section,a=t==="command"&&o!==void 0&&o!==r,l=a&&i>0;return r=o??r,{showHeader:a,showDivider:l,count:a&&o?n.get(o)??0:0}})}function Tm(e){return e.replace(/\([^()]+\)$/,"")}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const oT=16e3,IXe=4096,tF=6e4;function RXe(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 DXe="qwen-bearer.",LXe="qwen-ws";function PXe(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`${DXe}${r}`}function OXe(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 BXe(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 $Xe(e){const{baseUrl:t,token:n,onFinal:r,onError:s}=e,[i,o]=f.useState("idle"),[a,l]=f.useState(""),[u,d]=f.useState(0),[h,m]=f.useState(void 0),p=f.useRef({}),g=f.useRef(!0),b=f.useRef(0),x=f.useRef("idle"),v=f.useRef(r);v.current=r;const y=f.useRef(s);y.current=s;const w=f.useCallback(N=>{x.current=N,o(N)},[]),k=f.useCallback(()=>{const N=p.current;N.transcribeTimeout&&(clearTimeout(N.transcribeTimeout),N.transcribeTimeout=void 0)},[]),T=f.useCallback(()=>{var O;const N=p.current;N.processor&&(N.processor.onaudioprocess=null);for(const B of[N.processor,N.source,N.sink])try{B==null||B.disconnect()}catch{}(O=N.stream)==null||O.getTracks().forEach(B=>B.stop()),N.context&&N.context.state!=="closed"&&N.context.close().catch(()=>{}),N.processor=void 0,N.sink=void 0,N.source=void 0,N.stream=void 0,N.context=void 0},[]),S=f.useCallback(()=>{b.current++,T();const N=p.current;if(k(),N.ws){try{N.ws.onmessage=null,N.ws.onerror=null,N.ws.onclose=null,N.ws.close()}catch{}N.ws=void 0}},[T,k]),C=f.useCallback((N,O)=>{var B;!g.current||O!==void 0&&b.current!==O||(S(),w("error"),l(""),d(0),m(N),(B=y.current)==null||B.call(y,N))},[S,w]),_=f.useCallback((N,O)=>{O!==void 0&&b.current!==O||(S(),g.current&&(w("idle"),l(""),d(0),v.current(N)))},[S,w]),A=f.useCallback(()=>{if(x.current!=="idle"&&x.current!=="error")return;m(void 0),l(""),w("connecting");const N=++b.current,O=()=>!g.current||b.current!==N;(async()=>{var B;try{if(!((B=navigator.mediaDevices)!=null&&B.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 $;try{$=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}})}catch(Q){throw new Error(OXe(Q))}if(O()){$.getTracks().forEach(Q=>Q.stop());return}p.current.stream=$;const P=new AudioContext({sampleRate:oT});if(P.sampleRate!==oT)throw $.getTracks().forEach(Q=>Q.stop()),P.close().catch(()=>{}),new Error(`Browser audio rate ${P.sampleRate} Hz is not the required ${oT} Hz.`);if(p.current.context=P,P.state==="suspended"&&await P.resume(),O()){$.getTracks().forEach(Q=>Q.stop()),P.close().catch(()=>{});return}const K=P.createMediaStreamSource($),F=P.createScriptProcessor(IXe,1,1),H=P.createGain();H.gain.value=0,p.current.source=K,p.current.processor=F,p.current.sink=H;const D=new WebSocket(RXe(t),n?[LXe,PXe(n)]:void 0);D.binaryType="arraybuffer",p.current.ws=D,F.onaudioprocess=Q=>{const{pcm:U,level:j}=BXe(Q.inputBuffer.getChannelData(0));g.current&&d(j),D.readyState===WebSocket.OPEN&&D.send(U)},D.onopen=()=>{if(O()){F.onaudioprocess=null;for(const U of[F,K,H])try{U.disconnect()}catch{}$.getTracks().forEach(U=>U.stop()),P.state!=="closed"&&P.close().catch(()=>{});const Q=p.current;Q.ws===D&&(Q.ws=void 0),Q.processor===F&&(Q.processor=void 0),Q.source===K&&(Q.source=void 0),Q.sink===H&&(Q.sink=void 0),Q.stream===$&&(Q.stream=void 0),Q.context===P&&(Q.context=void 0);try{D.close()}catch{}return}D.send(JSON.stringify({type:"start"})),K.connect(F),F.connect(H),H.connect(P.destination),k(),p.current.transcribeTimeout=setTimeout(()=>{x.current==="recording"&&C("No response from server. Check that the voice model is running.",N)},tF),g.current&&w("recording")},D.onmessage=Q=>{(x.current==="connecting"||x.current==="recording")&&k();let U;try{U=JSON.parse(String(Q.data))}catch{return}U.type==="interim"?g.current&&l(U.text??""):U.type==="final"?_(U.text??"",N):U.type==="error"&&C(U.message??U.text??"Voice transcription failed.",N)},D.onerror=()=>{},D.onclose=Q=>{if(g.current&&(x.current==="recording"||x.current==="connecting"||x.current==="transcribing")){const U=Q.code||1006,j=Q.reason||"none";C(`Voice connection closed (code=${U}, reason=${j}).`,N)}}}catch($){C($ instanceof Error?$.message:String($),N)}})()},[t,n,C,_,w,k]),M=f.useCallback(()=>{const N=p.current.ws;if(!N||N.readyState!==WebSocket.OPEN){S(),w("idle");return}T(),d(0),w("transcribing");const O=b.current;try{N.send(JSON.stringify({type:"stop"})),k(),p.current.transcribeTimeout=setTimeout(()=>{x.current==="transcribing"&&C("Transcription timed out.",O)},tF)}catch{C("Failed to finalize voice transcription.",O)}},[S,T,C,w,k]),L=f.useCallback(()=>{const N=p.current.ws;if(N&&N.readyState===WebSocket.OPEN)try{N.send(JSON.stringify({type:"abort"}))}catch{}S(),w("idle"),l(""),d(0)},[S,w]);return f.useEffect(()=>(g.current=!0,()=>{g.current=!1,S()}),[S]),{status:i,interimText:a,audioLevel:u,errorMessage:h,start:A,stop:M,abort:L}}const zXe="_root_9hwm9_7",FXe="_iconBtn_9hwm9_14",qXe="_error_9hwm9_47",HXe="_connecting_9hwm9_51",UXe="_pill_9hwm9_56",VXe="_transcribing_9hwm9_75",WXe="_recDot_9hwm9_79",GXe="_wave_9hwm9_88",KXe="_bar_9hwm9_95",YXe="_time_9hwm9_103",XXe="_stop_9hwm9_111",QXe="_spinner_9hwm9_118",JXe="_interim_9hwm9_128",mo={root:zXe,iconBtn:FXe,error:qXe,connecting:HXe,pill:UXe,transcribing:VXe,recDot:WXe,wave:GXe,bar:KXe,time:YXe,stop:XXe,spinner:QXe,interim:JXe},ZXe="voice_transcribe",nF=16,eQe=()=>c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:[c.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3Z"}),c.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"})]}),tQe=()=>c.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24","aria-hidden":"true",fill:"currentColor",children:c.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})});function nQe(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=String(t%60).padStart(2,"0");return`${n}:${r}`}function rQe({onInsert:e,disabled:t}){var L;const n=pd(),{t:r}=gt(),s=((L=n.capabilities)==null?void 0:L.features)??[],[i,o]=f.useState(void 0),{status:a,interimText:l,audioLevel:u,errorMessage:d,start:h,stop:m,abort:p}=$Xe({baseUrl:n.baseUrl,token:n.token,onFinal:N=>{const O=N.trim();O?(o(void 0),e(O)):o(r("voice.noSpeech"))}}),g=a==="recording",[b,x]=f.useState(()=>new Array(nF).fill(0));f.useEffect(()=>{if(!g){x(new Array(nF).fill(0));return}x(N=>[...N.slice(1),Math.min(1,u*8)])},[u,g]);const[v,y]=f.useState(0);if(f.useEffect(()=>{if(!g){y(0);return}const N=performance.now(),O=setInterval(()=>y(performance.now()-N),200);return()=>clearInterval(O)},[g]),!s.includes(ZXe))return null;const w=a==="connecting",k=a==="transcribing",T=a==="error",S=!!i&&!T,C=g||w,_=g?r("voice.stopDictation"):k?r("voice.transcribing"):w?r("voice.starting"):T?r("voice.errorRetry",{message:d??""}):r(S?"voice.noSpeechRetry":"voice.startDictation");let A;if(g)A=c.jsxs("button",{type:"button",className:mo.pill,onClick:()=>m(),"aria-label":_,title:_,children:[c.jsx("span",{className:mo.recDot,"aria-hidden":"true"}),c.jsx("span",{className:mo.wave,"aria-hidden":"true",children:b.map((N,O)=>c.jsx("span",{className:mo.bar,style:{height:`${2+Math.round(N*14)}px`}},O))}),c.jsx("span",{className:mo.time,children:nQe(v)}),c.jsx("span",{className:mo.stop,"aria-hidden":"true",children:c.jsx(tQe,{})})]});else if(k)A=c.jsxs("span",{className:`${mo.pill} ${mo.transcribing}`,role:"status","aria-label":_,children:[c.jsx("span",{className:mo.spinner,"aria-hidden":"true"}),c.jsx("span",{className:mo.time,children:"…"})]});else{const N=[mo.iconBtn,T?mo.error:"",w?mo.connecting:""].filter(Boolean).join(" ");A=c.jsx("button",{type:"button",className:N,onClick:()=>{if(w)p();else{if(t)return;o(void 0),h()}},disabled:!!t&&!C,"aria-label":_,title:d??i??_,children:c.jsx(eQe,{})})}const M=g&&l||T||S;return c.jsxs("span",{className:mo.root,children:[A,M&&c.jsx("span",{role:"status","aria-live":"polite",className:`${mo.interim}${T?` ${mo.error}`:""}`,children:T?d||r("voice.error"):S?i:l})]})}function w3({delayDuration:e=0,...t}){return c.jsx(Fne,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function k3({...e}){return c.jsx(qne,{"data-slot":"tooltip",...e})}function _3({...e}){return c.jsx(Hne,{"data-slot":"tooltip-trigger",...e})}function S3({className:e,sideOffset:t=0,children:n,...r}){const s=yd();return c.jsx(Une,{container:s??void 0,children:c.jsxs(Vne,{"data-slot":"tooltip-content",sideOffset:t,className:tn("z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[n,c.jsx(HLe,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}function sQe(){return c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[c.jsx("circle",{cx:"6",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),c.jsx("circle",{cx:"18",cy:"6",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),c.jsx("circle",{cx:"6",cy:"19",r:"2.5",stroke:"currentColor",strokeWidth:"1.8"}),c.jsx("path",{d:"M6 7.5v9M8.5 12h3.25A6.25 6.25 0 0 0 18 5.75",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function iQe({branch:e,ariaLabel:t,compact:n=!1}){return c.jsx(w3,{delayDuration:300,children:c.jsxs(k3,{children:[c.jsx(_3,{asChild:!0,children:c.jsxs("output",{className:`${ye.gitBranchChip} ${n?ye.gitBranchChipCompact:""}`,"aria-label":t,"data-web-shell-git-branch":!0,children:[c.jsx("span",{className:ye.gitBranchIcon,children:c.jsx(sQe,{})}),c.jsx("span",{className:ye.gitBranchText,children:e})]})}),c.jsx(S3,{side:"top",children:e})]})})}const oQe="_red_179c6_21",aQe="_orange_179c6_24",lQe="_yellow_179c6_27",cQe="_green_179c6_30",uQe="_blue_179c6_33",dQe="_purple_179c6_36",jj={red:oQe,orange:aQe,yellow:lQe,green:cQe,blue:uQe,purple:dQe};function hQe(){return c.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 6.5A1.5 1.5 0 0 1 4.5 5h4l2 2h7A1.5 1.5 0 0 1 19 8.5v8A1.5 1.5 0 0 1 17.5 18h-13A1.5 1.5 0 0 1 3 16.5Z",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round"})})}function fQe({name:e,title:t,ariaLabel:n,color:r,compact:s=!1}){const i=[ye.workspaceChip,s?ye.workspaceChipCompact:"",r?jj[r]:"",r?ye.workspaceChipAccented:""].filter(Boolean).join(" ");return c.jsx(w3,{delayDuration:300,children:c.jsxs(k3,{children:[c.jsx(_3,{asChild:!0,children:c.jsxs("output",{className:i,"aria-label":n,"data-web-shell-workspace":!0,"data-web-shell-workspace-title":t,children:[c.jsx("span",{className:ye.workspaceChipIcon,children:c.jsx(hQe,{})}),c.jsx("span",{className:ye.workspaceChipText,children:e})]})}),c.jsx(S3,{side:"top",children:t})]})})}function C3({...e}){return c.jsx(Mte,{"data-slot":"select",...e})}function Ij({className:e,...t}){return c.jsx(Ute,{"data-slot":"select-group",className:tn("scroll-my-1 p-1",e),...t})}function T3({...e}){return c.jsx(Rte,{"data-slot":"select-value",...e})}const A3=f.forwardRef(function({className:t,size:n="default",children:r,...s},i){return c.jsxs(jte,{ref:i,"data-slot":"select-trigger","data-size":n,className:tn("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[r,c.jsx(Dte,{asChild:!0,children:c.jsx(vl,{className:"pointer-events-none size-4 text-muted-foreground"})})]})});function E3({className:e,children:t,position:n="item-aligned",align:r="center",...s}){const i=yd();return c.jsx(Pte,{container:i??void 0,children:c.jsxs(Ote,{"data-slot":"select-content","data-align-trigger":n==="item-aligned",className:tn("relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...s,children:[c.jsx(mQe,{}),c.jsx(qte,{"data-position":n,className:tn("data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)",n==="popper"&&""),children:t}),c.jsx(pQe,{})]})})}function Ig({className:e,children:t,...n}){return c.jsxs(Gte,{"data-slot":"select-item",className:tn("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[c.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:c.jsx(Xte,{children:c.jsx(ofe,{className:"pointer-events-none"})})}),c.jsx(Kte,{children:t})]})}function mQe({className:e,...t}){return c.jsx(Qte,{"data-slot":"select-scroll-up-button",className:tn("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:c.jsx(ufe,{})})}function pQe({className:e,...t}){return c.jsx(Jte,{"data-slot":"select-scroll-down-button",className:tn("z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:c.jsx(vl,{})})}const ga=f.forwardRef(function({className:t,type:n,...r},s){return c.jsx("input",{ref:s,type:n,"data-slot":"input",className:tn("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...r})});function gQe(e,t){const n=t.trim().toLocaleLowerCase();return n?e.filter(r=>`${r.label}
${r.searchText??""}`.toLocaleLowerCase().includes(n)):[...e]}function rF({availableWidth:e,items:t}){const n=Object.fromEntries(t.map(s=>[s.id,s.ready!==!1]));let r=t.reduce((s,i)=>s+(n[i.id]?i.expansionWidth:0),0);for(const s of t){if(r<=e)break;n[s.id]&&(n[s.id]=!1,r-=s.expansionWidth)}return n}function bQe({availableWidth:e,items:t,currentVisibility:n,expansionMargin:r}){const s=rF({availableWidth:e,items:t}),i=rF({availableWidth:Math.max(0,e-r),items:t});return Object.fromEntries(t.map(o=>[o.id,n[o.id]?s[o.id]:i[o.id]]))}function yQe({toolbarWidth:e,leadingWidth:t,rightWidth:n,currentExpansionWidth:r,gap:s}){const i=Math.max(0,t-r);return Math.max(0,e-n-i-s)}function vQe({currentModelLabel:e,lastConfirmedModelLabel:t}){const n=e||t;return{modelLabel:n,modelLabelReady:!!n,nextConfirmedModelLabel:n}}const xQe=["approvalMode","gitBranch","model","widthMode","voice","workspace"],wQe=new Set(xQe),kQe={"&":{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 sF(){return typeof window>"u"?!1:typeof navigator<"u"&&navigator.maxTouchPoints>0||typeof window.matchMedia=="function"&&window.matchMedia("(hover: none), (pointer: coarse)").matches}function _Qe({tag:e,content:t,tooltip:n,onActivate:r,onRemove:s}){const i=f.useRef(null),o=yd(),a=n!=null,l=c.jsx("span",{className:ye.tagContent,"data-web-shell-composer-tag-trigger":!0,role:r?"button":void 0,tabIndex:r||a?0:void 0,onClick:d=>{var h;r&&(d.stopPropagation(),r(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect()))},onKeyDown:d=>{var h;r&&(d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),r(((h=i.current)==null?void 0:h.getBoundingClientRect())??d.currentTarget.getBoundingClientRect())))},children:t}),u=c.jsxs("span",{ref:i,className:ye.tag,"data-web-shell-composer-tag":!0,children:[a?c.jsx(Hne,{asChild:!0,children:l}):l,s&&c.jsx("button",{type:"button",className:ye.tagRemove,"aria-label":`Remove ${AN(e)}`,onMouseDown:d=>d.preventDefault(),onClick:d=>{d.stopPropagation(),s()},onKeyDown:d=>{if(d.key==="Enter"||d.key===" "){d.stopPropagation();return}d.key!=="Backspace"&&d.key!=="Delete"||(d.preventDefault(),d.stopPropagation(),s())},children:"×"})]});return a?c.jsxs(qne,{disableHoverableContent:!1,children:[u,c.jsx(Une,{container:o??void 0,children:c.jsx(Vne,{className:ye.tagTooltip,"data-web-shell-composer-tag-tooltip":!0,sideOffset:6,collisionPadding:8,avoidCollisions:!0,children:n})})]}):u}function SQe(){return c.jsx("svg",{className:ye.sendIcon,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:c.jsx("path",{d:"M10 15.5v-11M5.5 9 10 4.5 14.5 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function CQe(){return c.jsx("span",{className:ye.stopIcon,"aria-hidden":"true"})}function TQe(){return c.jsx("span",{className:ye.loadingIcon,"aria-hidden":"true"})}function AQe(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[7,12,17].flatMap(e=>[7,12,17].map(t=>c.jsx("circle",{cx:t,cy:e,r:"1.35",fill:"currentColor"},`${t}-${e}`)))})}function EQe(e,t){let n,r,s,i,o=0,a=0;const l=(b,x)=>{e.style.setProperty("--dac-glow-on",b.toFixed(4)),e.style.setProperty("--dac-glow-pulse",x.toFixed(4))},u=b=>{n!==void 0&&window.cancelAnimationFrame(n);const x=o,v=b-x;if(Math.abs(v)<.001){o=b,l(b,a);return}const y=performance.now(),w=k=>{const T=Math.min((k-y)/220,1);o=x+v*(1-(1-T)**2),l(o,a),n=T<1?window.requestAnimationFrame(w):void 0};n=window.requestAnimationFrame(w)},d=()=>{r!==void 0&&window.cancelAnimationFrame(r);const b=a,x=performance.now(),v=y=>{const w=Math.min((y-x)/300,1);a=b*(1-w),l(o,a),r=w<1?window.requestAnimationFrame(v):void 0};r=window.requestAnimationFrame(v)},h=b=>{b?e.setAttribute("data-dac-typing",""):e.removeAttribute("data-dac-typing")},m=()=>u(1),p=()=>{u(0),h(!1),i!==void 0&&window.clearTimeout(i)},g=()=>{r!==void 0&&window.cancelAnimationFrame(r),s!==void 0&&window.clearTimeout(s),a=1,l(o,1),s=window.setTimeout(d,100),h(!0),i!==void 0&&window.clearTimeout(i),i=window.setTimeout(()=>h(!1),650)};return t.addEventListener("focus",m),t.addEventListener("blur",p),t.addEventListener("keydown",g),document.activeElement===t&&u(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",m),t.removeEventListener("blur",p),t.removeEventListener("keydown",g),l(0,0),h(!1)}}function MQe({mode:e}){return e==="wide"?c.jsxs("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:[c.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)"}),c.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)"})]}):c.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:c.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 aT(){return c.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[c.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"}),c.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 NQe(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 jQe=[{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 IQe(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"m3 8.3 3.1 3.1L13 4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function Yre(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 RQe(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]??Yre(e,t)}function iF({open:e,items:t,activeId:n,onOpenChange:r,onSelect:s,trigger:i,tooltip:o,showCheck:a=!1,searchable:l=!1,searchLabel:u,noResultsLabel:d}){const[h,m]=f.useState(""),[p,g]=f.useState(null),b=f.useRef(!1),x=f.useRef(!1),v=f.useRef(null),y=t.some(T=>T.description||T.icon),w=l?gQe(t,h):t;f.useEffect(()=>{e||m("")},[e]);const k=y||a;return c.jsxs(Z_,{open:e,onOpenChange:T=>{var S;T&&(b.current=!1,x.current=!1,g(((S=v.current)==null?void 0:S.closest("[data-web-shell-root]"))??null)),r(T)},children:[o?c.jsx(w3,{delayDuration:300,children:c.jsxs(k3,{children:[c.jsx(_3,{asChild:!0,children:c.jsx(XA,{ref:v,asChild:!0,children:i})}),c.jsx(S3,{side:"top",children:o})]})}):c.jsx(XA,{ref:v,asChild:!0,children:i}),c.jsxs(e4,{side:"top",align:"start",collisionPadding:8,collisionBoundary:p??void 0,"data-web-shell-toolbar-popover":!0,onClick:T=>T.stopPropagation(),onPointerDownOutside:T=>{const S=T.target;S instanceof Element&&S.closest("[data-web-shell-toolbar-popover-trigger]")&&(x.current=!0)},onCloseAutoFocus:T=>{if(x.current){T.preventDefault(),x.current=!1;return}if(document.activeElement instanceof HTMLElement&&document.activeElement.closest("[data-web-shell-toolbar-popover]")){T.preventDefault();return}b.current&&(T.preventDefault(),b.current=!1)},children:[l&&c.jsx(ga,{type:"search",value:h,"aria-label":u,placeholder:u,autoComplete:"off",onChange:T=>m(T.target.value)}),c.jsxs("div",{className:`${ye.dropdownList} ${y?ye.dropdownRich:a?ye.dropdownCheck:""} ${l?ye.dropdownListConstrained:""}`,children:[w.map(T=>c.jsx("button",{type:"button",className:`${ye.dropdownItem} ${T.id===n?ye.dropdownItemActive:""}`,onClick:()=>{b.current=!0,s(T.id)},children:k?c.jsxs(c.Fragment,{children:[y&&c.jsx("span",{className:ye.dropdownItemIcon,children:T.icon}),c.jsxs("span",{className:ye.dropdownItemContent,children:[c.jsx("span",{className:ye.dropdownItemLabel,children:T.label}),T.description&&c.jsx("span",{className:ye.dropdownItemDesc,children:T.description})]}),c.jsx("span",{className:ye.dropdownItemCheck,children:T.id===n?c.jsx(IQe,{}):null})]}):T.label},T.id)),w.length===0&&d&&c.jsx("div",{className:ye.dropdownEmpty,role:"status",children:d(h)})]})]})]})}function DQe({menu:e,anchorRef:t,panelRef:n,detailRef:r,onClose:s,onSelect:i,onAccept:o}){const a=f.useRef([]),l=f.useRef(null),[u,d]=f.useState(null),[h,m]=f.useState(null);f.useEffect(()=>{var y;(y=a.current[e.selectedIndex])==null||y.scrollIntoView({block:"nearest"})},[e.items,e.selectedIndex]),f.useEffect(()=>{m(null)},[e.items]),f.useLayoutEffect(()=>{var y;d(((y=t.current)==null?void 0:y.closest("[data-web-shell-root]"))??null)},[t]),f.useEffect(()=>{const y=w=>{w.key!=="Escape"||!w.isComposing&&w.keyCode!==229||(Object.defineProperty(w,"key",{configurable:!0,value:"Process"}),window.addEventListener("keydown",k=>{k===w&&Reflect.deleteProperty(w,"key")},{once:!0}))};return window.addEventListener("keydown",y,{capture:!0}),()=>{window.removeEventListener("keydown",y,{capture:!0})}},[]);const p=jXe(e.items,e.kind),g=Math.max(...e.items.map(y=>Array.from(y.label).length),0),b=Math.max(...e.items.map(y=>Array.from(y.detail??"").length),0),x=b>0,v={"--slash-command-col":`${Math.min(Math.max(g+1,10),24)}ch`,"--slash-desc-col":x?`${Math.min(Math.max(b+1,18),36)}ch`:"0px","--slash-column-gap":x?"2ch":"0px"};return c.jsxs(c.Fragment,{children:[c.jsxs(Z_,{open:!0,onOpenChange:y=>{y||s()},children:[c.jsx(xz,{virtualRef:t}),c.jsx(e4,{ref:n,side:"top",align:"start",alignOffset:16,sideOffset:8,collisionPadding:12,collisionBoundary:u??void 0,role:"listbox","data-web-shell-slash-menu":!0,style:v,onOpenAutoFocus:y=>y.preventDefault(),onCloseAutoFocus:y=>y.preventDefault(),onInteractOutside:y=>{var k,T;const w=y.target;w instanceof Node&&((k=t.current)!=null&&k.contains(w)||(T=r.current)!=null&&T.contains(w))&&y.preventDefault()},onMouseDown:y=>y.preventDefault(),onMouseLeave:y=>{var k;const w=y.relatedTarget;w instanceof Node&&((k=r.current)!=null&&k.contains(w))||m(null)},children:c.jsx("div",{className:ye.slashPanel,children:c.jsx("div",{className:ye.slashPanelBody,children:c.jsx("div",{className:ye.slashList,onScroll:()=>m(null),children:e.items.map((y,w)=>{const k=p[w];return c.jsxs("div",{className:ye.slashEntry,children:[k.showHeader&&c.jsxs(c.Fragment,{children:[k.showDivider&&c.jsx("div",{className:ye.slashSection}),c.jsxs("div",{className:ye.slashSectionHeader,children:[c.jsx("span",{children:y.section}),k.count>0?c.jsx("span",{className:ye.slashSectionCount,children:k.count}):null]})]}),c.jsxs("button",{ref:T=>{a.current[w]=T},type:"button",role:"option","aria-selected":w===e.selectedIndex,"data-has-description":y.detail?"":void 0,className:`${ye.slashItem} ${w===e.selectedIndex?ye.slashItemActive:""}`,onMouseEnter:T=>{if(i(w),!y.detail){m(null);return}l.current=T.currentTarget,m({label:y.label,detail:y.detail})},onMouseDown:T=>{T.preventDefault(),T.stopPropagation(),o(w)},children:[c.jsx("span",{className:ye.slashCommand,children:y.label}),y.detail&&c.jsx("span",{className:ye.slashDescription,children:y.detail})]})]},`${y.id}:${w}`)})})})})})]}),c.jsxs(Z_,{open:!!h,onOpenChange:y=>{y||m(null)},children:[c.jsx(xz,{virtualRef:l}),h&&c.jsx(e4,{ref:r,side:"right",align:"start",sideOffset:8,collisionPadding:12,collisionBoundary:u??void 0,"data-web-shell-slash-detail":!0,onOpenAutoFocus:y=>y.preventDefault(),onCloseAutoFocus:y=>y.preventDefault(),onMouseLeave:y=>{var k;const w=y.relatedTarget;w instanceof Node&&((k=n.current)!=null&&k.contains(w))||m(null)},children:c.jsxs("div",{className:ye.slashDetail,children:[c.jsx("div",{className:ye.slashDetailCommand,children:h.label}),c.jsx("div",{className:ye.slashDetailText,children:h.detail})]})})]})]})}function LQe({actions:e,onRun:t,onPressKey:n}){const{t:r}=gt();return c.jsxs("div",{className:ye.quickActionsPanel,onMouseDown:s=>s.stopPropagation(),onClick:s=>s.stopPropagation(),children:[c.jsx("div",{className:ye.quickActionsHeader,children:r("quickActions.title")}),c.jsxs("div",{className:ye.quickActionsLayout,children:[c.jsx("div",{className:ye.quickActionsGrid,children:e.map(s=>c.jsx("button",{type:"button",className:ye.quickAction,onClick:()=>t(s),children:c.jsx("span",{className:ye.quickActionLabel,children:s.label})},s.id))}),c.jsx("div",{className:ye.quickKeysGrid,children:jQe.map(s=>c.jsx("button",{type:"button",className:ye.quickKey,title:r(s.descriptionKey),onMouseDown:i=>i.preventDefault(),onClick:()=>n(s),children:c.jsx("span",{className:ye.quickKeyLabel,children:s.label})},s.id))})]})]})}const Xre=f.memo(f.forwardRef(function(t,n){const{onSubmit:r,onCycleMode:s,onToggleShortcuts:i,onCancel:o,isRunning:a=!1,isPreparing:l=!1,cancelArmed:u=!1,disabled:d=!1,placeholderText:h="Type a message...",commands:m,skills:p=[],slashCommandCategoryOrder:g,queuedMessages:b=[],onPopQueuedMessages:x,currentMode:v="default",currentModel:y="",gitBranch:w,workspaceName:k,workspaceTitle:T,workspaceColor:S,chatWidthMode:C="1000",showChatWidthToggle:_=!0,chatWidthToggleMin:A,visibleToolbarActions:M,availableModels:L=[],onSelectMode:N,onSelectModel:O,workspaces:B,selectedWorkspaceCwd:$,workspaceSelectionDisabled:P=!1,onSelectWorkspace:K,atWorkspaceCwd:F,onChatWidthModeChange:H,onFocusFooter:D,dialogOpen:Q=!1,followupState:U,onAcceptFollowup:j,onDismissFollowup:ie,sessionName:oe,composerInput:J,composerInputVersion:V,builtinAtProviders:se,atProviders:Z,composerTagIcons:X}=t,{renderComposerToolbarStart:te,renderComposerToolbarEnd:ae,renderComposerToolbarRight:xe,renderComposerTag:Ae,renderComposerTagTooltip:Ne,onComposerTagClick:Le}=ou(),ge=nMe({onSubmit:r,onCycleMode:s,onToggleShortcuts:i,disabled:d,placeholderText:h,commands:m,skills:p,slashCommandCategoryOrder:g,queuedMessages:b,onPopQueuedMessages:x,currentMode:v,onFocusFooter:D,dialogOpen:Q,followupState:U,onAcceptFollowup:j,onDismissFollowup:ie,sessionName:oe,composerInput:J,composerInputVersion:V,builtinAtProviders:se,atProviders:Z,atWorkspaceCwd:F,composerTagIcons:X,renderComposerTag:Ae,renderComposerTagTooltip:Ne,onComposerTagClick:Le,editorTheme:kQe}),{t:Oe}=gt();f.useImperativeHandle(n,()=>ge.handle,[ge.handle]);const[Nt,Pe]=f.useState(!1),[Ce,Zt]=f.useState(!1),[dt,Ge]=f.useState(!1),[St,Y]=f.useState(!1),[je,We]=f.useState(sF),Te=f.useRef(null),jt=f.useRef(null),zt=f.useRef(null),bn=f.useRef(null),Pn=f.useRef(null),qe=f.useRef(null),At=f.useRef(null),he=f.useRef(null),Be=f.useRef(null),Ie=f.useRef(null),Ke=f.useRef(null),ne=f.useRef(null),De=f.useRef(!1),Dt=f.useRef(!1),[ze,Lt]=f.useState(!1),[ke,Ot]=f.useState({workspaceSelect:!1,workspace:!1,gitBranch:!1,mode:!1,model:!1}),[fe,pt]=f.useState(""),He=ge.slashMenu,on=ge.closeSlashMenu,Ze=ge.atMenu,Et=ge.closeAtMenu,wn=!!He,qr=!!Ze,cr=ge.viewRef;f.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const we=window.matchMedia("(hover: none), (pointer: coarse)"),Pt=()=>We(sF());return Pt(),we.addEventListener("change",Pt),()=>we.removeEventListener("change",Pt)},[]),f.useEffect(()=>{je||Ge(!1)},[je]),f.useEffect(()=>{if(!wn&&!qr)return;const we=Pt=>{var Xn,Hn,Mr;const yn=Pt.target,zn=Te.current;yn instanceof Node&&zn&&!zn.contains(yn)&&!((Xn=jt.current)!=null&&Xn.contains(yn))&&!((Hn=zt.current)!=null&&Hn.contains(yn))&&!((Mr=bn.current)!=null&&Mr.contains(yn))&&(on(),Et())};return window.addEventListener("mousedown",we),window.addEventListener("touchstart",we),()=>{window.removeEventListener("mousedown",we),window.removeEventListener("touchstart",we)}},[qr,wn,Et,on]),f.useEffect(()=>{var yn;const we=Te.current,Pt=(yn=cr.current)==null?void 0:yn.contentDOM;if(!(!we||!Pt))return EQe(we,Pt)},[cr]),f.useEffect(()=>{const we=Te.current,Pt=A;if(!we||Pt===void 0){Lt(!1);return}const yn=()=>{Lt(we.getBoundingClientRect().width>=Pt-50)};yn();const zn=new ResizeObserver(yn);return zn.observe(we),()=>zn.disconnect()},[A]);const Jn=f.useMemo(()=>U4.map(we=>({id:we,label:RQe(we,Oe),description:Oe(`mode.desc.${we}`),icon:c.jsx(Ab,{mode:we})})),[Oe]),Ft=f.useMemo(()=>{if(!M)return null;const we=M.filter(Pt=>wQe.has(Pt));return new Set(we)},[M]),dn=we=>Ft?Ft.has(we):!0,sr=dn("approvalMode"),Rn=dn("model"),Vn=f.useMemo(()=>new Set(m.map(we=>we.name.replace(/^\/+/,""))),[m]),Zn=f.useCallback(we=>Vn.has(we),[Vn]),kn=f.useMemo(()=>[{id:"new",label:Oe("quickActions.new"),action:{type:"run",command:"/new"}},{id:"resume",label:Oe("quickActions.resume"),action:{type:"run",command:"/resume"}},{id:"delete",label:Oe("quickActions.delete"),action:{type:"run",command:"/delete"}},{id:"branch",label:Oe("quickActions.branch"),action:{type:"run",command:"/branch"}},{id:"rewind",label:Oe("quickActions.rewind"),action:{type:"run",command:"/rewind"}},{id:"history-search",label:Oe("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:Oe("quickActions.recap"),action:{type:"run",command:"/recap"}},{id:"stats",label:Oe("quickActions.stats"),action:{type:"run",command:"/stats"}},{id:"context",label:Oe("quickActions.context"),action:{type:"run",command:"/context"}},{id:"status",label:Oe("quickActions.status"),action:{type:"run",command:"/status"}},{id:"skills",label:Oe("quickActions.skills"),action:{type:"run",command:"/skills detail"}},{id:"tools",label:Oe("quickActions.tools"),action:{type:"run",command:"/tools desc"}},{id:"agents",label:Oe("quickActions.agents"),action:{type:"run",command:"/agents"}},{id:"mcp",label:Oe("quickActions.mcp"),action:{type:"run",command:"/mcp"}},{id:"memory",label:Oe("quickActions.memory"),action:{type:"run",command:"/memory"}},{id:"theme",label:Oe("quickActions.theme"),action:{type:"run",command:"/theme"}},{id:"shell",label:ge.shellMode?Oe("quickActions.exitShellMode"):Oe("quickActions.shellMode"),action:{type:"shell"}},{id:"goal",label:Oe("quickActions.setGoal"),action:{type:"insert",text:"/goal "}}].filter(we=>{const Pt=NQe(we);return!Pt||Zn(Pt)}),[ge.shellMode,Zn,Oe]),er=f.useMemo(()=>L.map(we=>({id:we.id,label:Tm(we.label||we.id),searchText:`${we.label??""}
${we.id}`})),[L]),Ms=f.useCallback(we=>{N==null||N(we),Pe(!1),ge.focus()},[N,ge]),Ss=f.useCallback(we=>{O==null||O(we),Zt(!1),ge.focus()},[O,ge]),Hr=f.useCallback(we=>{const Pt=ge.viewRef.current;Pt&&(Pt.focus(),Pt.contentDOM.dispatchEvent(new KeyboardEvent("keydown",{...we,bubbles:!0,cancelable:!0})))},[ge]),rs=f.useCallback(we=>{if(Ge(!1),Pe(!1),Zt(!1),ge.closeSlashMenu(),ge.closeAtMenu(),we.action.type==="insert"){ge.insertText(we.action.text,{mode:"replace"});return}if(we.action.type==="shell"){ge.toggleShellMode();return}if(we.action.type==="key"){Hr(we.action.item.event);return}r(we.action.command)},[ge,Hr,r]),Hs=f.useCallback(we=>{Hr(we.event),we.id==="ctrl-r"&&Ge(!1)},[Hr]),{searchMode:Us,searchQuery:Ur,searchMatches:Ar,searchActiveIndex:Un,searchInputRef:or,searchUiRef:Cs,closeSearch:Ls,handleSearchKeyDown:be,handleSearchInput:st,handleSearchCompositionEnd:Ct}=ge.searchState,Bt=we=>{const Pt=Ae==null?void 0:Ae({tag:we,placement:"composer",readonly:!1});if(Pt!=null)return Pt;const yn=$S(we),zn=zS(we),Xn=we.kind?"":yn,Hn=we.icon??hp(we.kind,X),Mr=Hn&&Jg(Hn)?Hn:void 0;return!Xn&&!zn?c.jsx("span",{className:ye.tagLabel,children:we.id}):c.jsxs(c.Fragment,{children:[Mr&&c.jsx("span",{className:ye.tagIcon,style:Th("--composer-tag-icon-url",Mr),"aria-hidden":"true"}),Xn&&c.jsx("span",{className:ye.tagLabel,children:Xn}),zn&&c.jsx("span",{className:ye.tagValue,children:zn})]})},qt=Yre(v,Oe),tr=y?Tm(y):"",{modelLabel:Lr,modelLabelReady:ss}=vQe({currentModelLabel:tr,lastConfirmedModelLabel:fe}),Vr=B==null?void 0:B.find(we=>$?we.cwd===$:we.primary),$n=Vr?`${Vr.label}${Vr.primary?` · ${Oe("sidebar.workspacePrimary")}`:""}`:"",An=!!(B&&B.length>1&&K),Er=!!(k&&dn("workspace")),Pr=!!(w&&dn("gitBranch"));f.useLayoutEffect(()=>{tr&&tr!==fe&&pt(tr)},[tr,fe]);const de=ke.workspaceSelect,Ee=ke.workspace,rt=ke.gitBranch,yt=ke.mode,wt=ke.model,mn=a&&!ge.hasContent;return f.useLayoutEffect(()=>{const we=Pn.current,Pt=qe.current,yn=At.current,zn=Ke.current;if(!we||!Pt||!yn||!zn)return;const Xn=()=>{const ve=nn=>{const ur=zn.querySelector(`[data-toolbar-measure="${nn}:collapsed"]`),Nr=zn.querySelector(`[data-toolbar-measure="${nn}:expanded"]`);return Math.max(0,Math.ceil((Nr==null?void 0:Nr.getBoundingClientRect().width)??0)-Math.ceil((ur==null?void 0:ur.getBoundingClientRect().width)??0))},Fe=[...An?[{id:"workspaceSelect",expansionWidth:ve("workspaceSelect")}]:[],...Er?[{id:"workspace",expansionWidth:ve("workspace")}]:[],...Pr?[{id:"gitBranch",expansionWidth:ve("gitBranch")}]:[],...sr?[{id:"mode",expansionWidth:ve("mode")}]:[],...Rn?[{id:"model",expansionWidth:ve("model"),ready:ss}]:[]],ot=Fe.reduce((nn,ur)=>nn+(ke[ur.id]?ur.expansionWidth:0),0),_n=Pt.scrollWidth,Yt=Math.ceil(Number.parseFloat(getComputedStyle(we).columnGap)||0),On=yQe({toolbarWidth:Math.floor(we.getBoundingClientRect().width),leadingWidth:_n,rightWidth:Math.ceil(yn.getBoundingClientRect().width),currentExpansionWidth:ot,gap:Yt}),Ye=bQe({availableWidth:On,items:Fe,currentVisibility:ke,expansionMargin:Fe.length}),Tn={workspaceSelect:Ye.workspaceSelect??!1,workspace:Ye.workspace??!1,gitBranch:Ye.gitBranch??!1,mode:Ye.mode??!1,model:Ye.model??!1};Ot(nn=>Object.keys(Tn).every(Nr=>nn[Nr]===Tn[Nr])?nn:Tn)};Xn();const Hn=new ResizeObserver(Xn);Hn.observe(we),Hn.observe(Pt),Hn.observe(yn);for(const ve of zn.children)Hn.observe(ve);const Mr=[he.current,Be.current,Ie.current].filter(ve=>ve!==null),is=()=>{for(const ve of Mr){Hn.observe(ve);for(const Fe of ve.children)Hn.observe(Fe)}};is();const ce=new MutationObserver(()=>{is(),Xn()});for(const ve of Mr)ce.observe(ve,{attributes:!0,characterData:!0,childList:!0,subtree:!0});return()=>{ce.disconnect(),Hn.disconnect()}},[ae,xe,te,d,w,Pr,a,Lr,ss,qt,oe,Rn,sr,ke,Er,k,An,$n]),c.jsxs("div",{className:`${ye.editorShell} ${Nt||Ce?ye.editorShellDropdownOpen:""}`,"data-composer":!0,"data-web-shell-composer":!0,children:[c.jsxs("div",{ref:Te,className:ye.container,"data-web-shell-composer-surface":!0,"data-dac-glow":!0,onClick:()=>{Pe(!1),Zt(!1),Ge(!1),ge.focus()},children:[c.jsx("div",{className:ye.dacAura,"aria-hidden":"true"}),c.jsx("div",{className:ye.dacHalo,"aria-hidden":"true"}),Us&&c.jsxs("div",{ref:Cs,className:ye.searchPanel,onMouseDown:we=>we.stopPropagation(),onClick:we=>we.stopPropagation(),children:[c.jsxs("div",{className:ye.searchBar,children:[c.jsx("span",{className:ye.searchLabel,children:Oe("editor.searchLabel")}),c.jsx("input",{ref:or,className:ye.searchInput,value:Ur,onChange:st,onCompositionEnd:Ct,onKeyDown:be,placeholder:Oe("editor.searchPlaceholder")})]}),Ar.length>0&&c.jsx("div",{className:ye.searchResults,children:Ar.map((we,Pt)=>c.jsxs("button",{type:"button",className:`${ye.searchResult} ${Pt===Un?ye.searchResultActive:""}`,onMouseDown:yn=>{yn.preventDefault(),ge.replaceEditorText(we),Ls(!1)},children:[c.jsx("span",{className:ye.searchResultMarker,children:Pt===Un?"›":""}),c.jsx("span",{className:ye.searchResultText,children:we})]},`${we}-${Pt}`))}),Ar.length===0&&c.jsx("div",{className:ye.searchEmpty,children:Oe("editor.noHistory")})]}),c.jsxs("div",{className:ye.content,children:[(ge.composerTags.length>0||ge.pastedImages.length>0)&&c.jsxs("div",{className:ye.attachments,"data-web-shell-composer-attachments":!0,children:[ge.composerTags.length>0&&c.jsx(Fne,{delayDuration:0,disableHoverableContent:!1,children:c.jsx("div",{className:ye.tags,children:ge.composerTags.map(we=>{const Pt={tag:we,placement:"composer",readonly:!1};let yn;try{yn=Ne==null?void 0:Ne(Pt)}catch(zn){console.warn("[WebShell] composer tag tooltip render failed",zn)}return c.jsx(_Qe,{tag:we,content:Bt(we),tooltip:yn,onActivate:Le?zn=>Le({...Pt,anchorRect:zn}):void 0,onRemove:we.removable!==!1?()=>{var zn;ge.removeTopTag(we.id),(zn=ge.viewRef.current)==null||zn.focus()}:void 0},we.id)})})}),ge.pastedImages.length>0&&c.jsx("div",{className:ye.images,children:ge.pastedImages.map((we,Pt)=>c.jsxs("div",{className:ye.imageThumb,children:[c.jsx("img",{src:`data:${we.media_type};base64,${we.data}`,alt:""}),c.jsx("button",{className:ye.imageRemove,onClick:yn=>{yn.stopPropagation(),ge.removeImage(Pt)},children:"×"})]},Pt))})]}),ge.slashMenu&&c.jsx(DQe,{menu:ge.slashMenu,anchorRef:Te,panelRef:jt,detailRef:zt,onClose:ge.closeSlashMenu,onSelect:ge.selectSlashCompletion,onAccept:ge.acceptSlashCompletion}),ge.atMenu&&c.jsx(wXe,{menu:ge.atMenu,anchorRef:Te,panelRef:bn,onSelect:ge.selectAtCompletion,onAccept:ge.acceptAtCompletion,onBack:()=>{const we=ge.backAtCategories();return we==="categories"&&window.setTimeout(()=>ge.focus(),0),!!we},onSearch:ge.updateAtSearch,onSelectTab:ge.selectAtTab}),c.jsxs("div",{className:ye.editorArea,children:[ge.shellMode&&c.jsx("span",{className:ye.shellPrefix,"aria-hidden":"true",children:"!"}),c.jsx("div",{ref:ge.containerRef,"data-web-shell-composer-editor":!0})]}),c.jsxs("div",{ref:Pn,className:ye.toolbar,children:[c.jsxs("div",{ref:qe,className:ye.toolbarLeading,children:[te&&c.jsx("div",{ref:he,className:ye.toolbarStart,children:c.jsx(te,{disabled:d,isRunning:a,currentMode:v,currentModel:y,sessionName:oe})}),c.jsxs("div",{className:ye.toolbarLeft,children:[An&&B&&K&&c.jsxs(C3,{value:Vr==null?void 0:Vr.id,disabled:P,onValueChange:we=>{const Pt=B.find(yn=>yn.id===we);Pt&&(K(Pt.primary?void 0:Pt.cwd),De.current=!0,Y(!1),requestAnimationFrame(()=>{var yn;(yn=ne.current)==null||yn.blur()}))},children:[c.jsx(w3,{delayDuration:300,children:c.jsxs(k3,{open:St,onOpenChange:we=>{we&&(De.current||!Dt.current)||Y(we)},children:[c.jsx(_3,{asChild:!0,children:c.jsx("span",{className:`${ye.workspaceSelectTooltipTrigger} ${de?"":ye.workspaceSelectTooltipTriggerCompact}`,onPointerEnter:()=>{Dt.current=!0},onPointerLeave:()=>{Dt.current=!1,De.current=!1},onBlur:()=>{Dt.current||(De.current=!1)},children:c.jsxs(A3,{ref:ne,size:"sm",className:`${ye.toolBtn} ${ye.workspaceSelectTrigger} ${de?"":ye.workspaceSelectTriggerCompact}`,"aria-label":Oe("sidebar.workspaceSelectLabel"),children:[c.jsx(jk,{size:16,strokeWidth:1.2}),c.jsx(T3,{})]})})}),c.jsx(S3,{side:"top",children:$n})]})}),c.jsx(E3,{position:"popper",align:"start",children:c.jsx(Ij,{children:B.map(we=>c.jsxs(Ig,{value:we.id,children:[we.label,we.primary?` · ${Oe("sidebar.workspacePrimary")}`:""]},we.id))})})]}),Er&&k&&c.jsx(fQe,{name:k,title:T??k,color:S,compact:!Ee,ariaLabel:Oe("workspace.paneLabel",{name:k})}),Pr&&w&&c.jsx(iQe,{branch:w,compact:!rt,ariaLabel:Oe("git.currentBranch",{branch:w})}),sr&&c.jsx("div",{className:`${ye.dropdownWrapper} ${yt?"":ye.dropdownWrapperCompact}`,children:c.jsx(iF,{open:Nt,items:Jn,activeId:v,onOpenChange:we=>{Pe(we),we&&Zt(!1)},onSelect:Ms,tooltip:qt,trigger:c.jsxs("button",{className:`${ye.toolBtn} ${ye.modeToolBtn} ${yt?"":ye.toolBtnCompact}`,"data-web-shell-mode-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:we=>{we.stopPropagation(),ge.closeSlashMenu(),ge.closeAtMenu(),Ge(!1)},"aria-label":Oe("status.mode"),children:[c.jsx("span",{className:ye.toolBtnModeIcon,children:c.jsx(Ab,{mode:v})}),yt&&c.jsx("span",{className:ye.toolBtnText,children:qt}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]})})}),Rn&&c.jsx("div",{className:`${ye.dropdownWrapper} ${wt?"":ye.dropdownWrapperCompact}`,children:c.jsx(iF,{open:Ce,items:er,activeId:y,onOpenChange:we=>{Zt(we),we&&Pe(!1)},onSelect:Ss,tooltip:Lr,showCheck:!0,searchable:!0,searchLabel:Oe("common.search"),noResultsLabel:we=>Oe("model.noMatch",{query:we}),trigger:c.jsxs("button",{className:`${ye.toolBtn} ${ye.modelToolBtn} ${wt?"":ye.toolBtnCompact}`,"data-web-shell-model-button":!0,"data-web-shell-toolbar-popover-trigger":!0,onClick:we=>{we.stopPropagation(),ge.closeSlashMenu(),ge.closeAtMenu(),Ge(!1)},"aria-label":Oe("model.select"),children:[c.jsx("span",{className:ye.toolBtnModelIcon,children:c.jsx(aT,{})}),wt&&c.jsx("span",{className:ye.toolBtnText,children:Lr}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]})})}),ae&&c.jsx("div",{ref:Be,className:ye.toolbarEnd,children:c.jsx(ae,{disabled:d,isRunning:a,currentMode:v,currentModel:y,sessionName:oe})})]})]}),c.jsxs("div",{ref:At,className:ye.toolbarRight,children:[je&&kn.length>0&&c.jsx("button",{className:`${ye.toolBtn} ${ye.quickActionsBtn}`,onClick:we=>{we.stopPropagation(),ge.closeSlashMenu(),ge.closeAtMenu(),Pe(!1),Zt(!1),Ge(Pt=>!Pt)},"aria-expanded":dt,"aria-label":Oe("quickActions.open"),title:Oe("quickActions.open"),"data-tooltip":Oe("quickActions.open"),children:c.jsx("span",{className:ye.toolBtnIcon,children:c.jsx(AQe,{})})}),xe&&c.jsx("div",{ref:Ie,className:ye.toolbarRightCustom,children:c.jsx(xe,{disabled:d,isRunning:a,currentMode:v,currentModel:y,sessionName:oe})}),_&&ze&&dn("widthMode")&&c.jsx("button",{className:`${ye.toolBtn} ${ye.widthModeBtn}`,onClick:we=>{we.stopPropagation(),H==null||H(C==="wide"?"1000":"wide")},disabled:!H,"aria-label":Oe(C==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),title:Oe(C==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),"data-tooltip":Oe(C==="wide"?"settings.option.ui.chatWidth.1000":"settings.option.ui.chatWidth.wide"),children:c.jsx("span",{className:ye.toolBtnIcon,children:c.jsx(MQe,{mode:C})})}),dn("voice")&&c.jsx(rQe,{disabled:d,onInsert:we=>{const Pt=ge.getText(),yn=Pt&&!/\s$/.test(Pt)?" ":"";ge.insertText(`${yn}${we} `),ge.focus()}}),c.jsx("button",{className:l||mn?`${ye.sendBtn} ${ye.sendBtnRunning}${u?` ${ye.sendBtnArmed}`:""}`:ye.sendBtn,disabled:l?!0:mn?!o:ge.disabled||!ge.hasContent,"data-web-shell-composer-submit":!0,onClick:we=>{if(we.stopPropagation(),!l){if(mn){o==null||o();return}ge.submitText()}},"aria-label":Oe(l?"common.loading":mn?u?"stream.cancelArmed":"stream.cancel":"editor.send"),title:a&&u?Oe("stream.cancelArmed"):void 0,children:l?c.jsx(TQe,{}):mn?u?c.jsx("span",{className:ye.escLabel,"aria-hidden":"true",children:"Esc"}):c.jsx(CQe,{}):c.jsx(SQe,{})}),c.jsx("span",{role:"status","aria-live":"polite",className:ye.srOnly,children:a&&u?Oe("stream.cancelArmed"):""})]})]}),c.jsxs("div",{ref:Ke,className:ye.toolbarMeasurements,"aria-hidden":"true",children:[An&&Vr&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{"data-toolbar-measure":"workspaceSelect:collapsed",className:`${ye.toolBtn} ${ye.workspaceSelectTrigger} ${ye.workspaceSelectTriggerCompact}`,children:[c.jsx(jk,{size:16,strokeWidth:1.2}),c.jsx("span",{className:ye.toolBtnText,children:$n}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]}),c.jsxs("span",{"data-toolbar-measure":"workspaceSelect:expanded",className:`${ye.toolBtn} ${ye.workspaceSelectTrigger}`,children:[c.jsx(jk,{size:16,strokeWidth:1.2}),c.jsx("span",{className:ye.toolBtnText,children:$n}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]})]}),Er&&k&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{"data-toolbar-measure":"workspace:collapsed",className:`${ye.workspaceChip} ${ye.workspaceChipCompact}`,children:[c.jsx("span",{className:ye.workspaceChipIcon}),c.jsx("span",{className:ye.workspaceChipText,children:k})]}),c.jsxs("span",{"data-toolbar-measure":"workspace:expanded",className:ye.workspaceChip,children:[c.jsx("span",{className:ye.workspaceChipIcon}),c.jsx("span",{className:ye.workspaceChipText,children:k})]})]}),Pr&&w&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{"data-toolbar-measure":"gitBranch:collapsed",className:`${ye.gitBranchChip} ${ye.gitBranchChipCompact}`,children:[c.jsx("span",{className:ye.gitBranchIcon}),c.jsx("span",{className:ye.gitBranchText,children:w})]}),c.jsxs("span",{"data-toolbar-measure":"gitBranch:expanded",className:ye.gitBranchChip,children:[c.jsx("span",{className:ye.gitBranchIcon}),c.jsx("span",{className:ye.gitBranchText,children:w})]})]}),c.jsxs("span",{"data-toolbar-measure":"mode:collapsed",className:`${ye.toolBtn} ${ye.modeToolBtn} ${ye.toolBtnCompact}`,children:[c.jsx("span",{className:ye.toolBtnModeIcon,children:c.jsx(Ab,{mode:v})}),c.jsx("span",{className:ye.toolBtnText,children:qt}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]}),c.jsxs("span",{"data-toolbar-measure":"mode:expanded",className:`${ye.toolBtn} ${ye.modeToolBtn}`,children:[c.jsx("span",{className:ye.toolBtnModeIcon,children:c.jsx(Ab,{mode:v})}),c.jsx("span",{className:ye.toolBtnText,children:qt}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]}),c.jsxs("span",{"data-toolbar-measure":"model:collapsed",className:`${ye.toolBtn} ${ye.modelToolBtn} ${ye.toolBtnCompact}`,children:[c.jsx("span",{className:ye.toolBtnModelIcon,children:c.jsx(aT,{})}),c.jsx("span",{className:ye.toolBtnText,children:Lr}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]}),c.jsxs("span",{"data-toolbar-measure":"model:expanded",className:`${ye.toolBtn} ${ye.modelToolBtn}`,children:[c.jsx("span",{className:ye.toolBtnModelIcon,children:c.jsx(aT,{})}),c.jsx("span",{className:ye.toolBtnText,children:Lr}),c.jsx("span",{className:ye.toolBtnArrow,children:c.jsx(vl,{})})]})]})]})]}),je&&dt&&kn.length>0&&c.jsx(LQe,{actions:kn,onRun:rs,onPressKey:Hs})]})})),PQe="_bar_agzxl_1",OQe="_left_agzxl_12",BQe="_right_agzxl_13",$Qe="_settingsButton_agzxl_23",zQe="_modeButton_agzxl_49",FQe="_modeHint_agzxl_62",qQe="_modeLabel_agzxl_67",HQe="_modeDefault_agzxl_71",UQe="_modePlan_agzxl_75",VQe="_modeAutoEdit_agzxl_79",WQe="_modeAuto_agzxl_79",GQe="_modeYolo_agzxl_87",KQe="_shortcutsButton_agzxl_96",YQe="_modelButton_agzxl_114",XQe="_model_agzxl_114",QQe="_contextButton_agzxl_138",JQe="_context_agzxl_138",ZQe="_goal_agzxl_161",eJe="_separator_agzxl_167",tJe="_taskPill_agzxl_171",di={bar:PQe,left:OQe,right:BQe,settingsButton:$Qe,modeButton:zQe,modeHint:FQe,modeLabel:qQe,modeDefault:HQe,modePlan:UQe,modeAutoEdit:VQe,modeAuto:WQe,modeYolo:GQe,shortcutsButton:KQe,modelButton:YQe,model:XQe,contextButton:QQe,context:JQe,goal:ZQe,separator:eJe,taskPill:tJe},nJe=1e3;function rJe(e,t){switch(e){case"default":return{label:t("mode.default"),className:di.modeDefault};case"plan":return{label:t("mode.plan"),className:di.modePlan};case"auto-edit":return{label:t("mode.auto-edit"),className:di.modeAutoEdit};case"auto":return{label:t("mode.auto"),className:di.modeAuto};case"yolo":return{label:t("mode.yolo"),className:di.modeYolo};default:return null}}function sJe(){return c.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:[c.jsx("circle",{cx:"12",cy:"12",r:"3"}),c.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 lT(e,t,n,r){return r(e===1?t:n,{count:e})}function iJe(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(lT(s.shell,"tasks.pill.shell","tasks.pill.shells",t)),s.agent>0&&i.push(lT(s.agent,"tasks.pill.agent","tasks.pill.agents",t)),s.monitor>0&&i.push(lT(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 oJe(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 aJe=f.forwardRef(function({onSelectMode:t,onSelectModel:n,onShowContext:r,onOpenSettings:s,onOpenTasks:i,onReturnToInput:o,tasks:a,activeGoal:l,hideSettings:u,onToggleShortcuts:d,compact:h=!1},m){const p=il(),g=p.status==="connected",b=p.currentModel??"",x=p.currentMode??"",v=p.tokenCount??0,y=p.contextWindow??0,{t:w}=gt(),T=(y>0?v/y*100:0).toFixed(1),S=rJe(x,w),[,C]=f.useState(0),_=f.useRef(null);f.useEffect(()=>{if(!l)return;const P=setInterval(()=>C(K=>(K+1)%1e6),nJe);return()=>clearInterval(P)},[l]);const A=f.useMemo(()=>iJe(a,w),[a,w]),M=!h&&(g||!!S),L=l?oJe(Date.now()-l.setAt):"",N=l?`◎ ${w("goal.statusActive")}${L?` (${L})`:""}`:"",O=!!A||!h,B=!h&&!!b||!h&&y>0&&v>0||!!N;if(f.useImperativeHandle(m,()=>({focusTaskPill(){var P;return A?((P=_.current)==null||P.focus({preventScroll:!0}),!0):!1}}),[A]),!O&&!B)return null;const $=P=>{if(P.key==="Enter"||P.key==="ArrowDown"||P.key==="n"&&P.ctrlKey){P.preventDefault(),P.stopPropagation(),i==null||i();return}if(P.key==="ArrowUp"||P.key==="Escape"||P.key==="p"&&P.ctrlKey){P.preventDefault(),P.stopPropagation(),o==null||o();return}P.key.length===1&&!P.metaKey&&!P.ctrlKey&&!P.altKey&&(P.preventDefault(),P.stopPropagation(),o==null||o(P.key))};return c.jsxs("div",{className:di.bar,children:[c.jsxs("div",{className:di.left,children:[g&&!u&&!h&&c.jsx("button",{type:"button",className:di.settingsButton,onClick:s,onMouseDown:P=>P.stopPropagation(),onTouchStart:P=>P.stopPropagation(),title:w("settings.title"),"aria-label":w("settings.title"),"aria-haspopup":"dialog",children:c.jsx(sJe,{})}),S&&!h&&c.jsxs("button",{type:"button",className:di.modeButton,onClick:t,onMouseDown:P=>P.stopPropagation(),onTouchStart:P=>P.stopPropagation(),title:w("mode.select"),"aria-haspopup":"listbox",children:[c.jsx("span",{className:`${di.modeLabel} ${S.className}`,children:S.label}),!h&&c.jsx("span",{className:di.modeHint,children:w("status.modeHint")})]}),!h&&c.jsx(c.Fragment,{children:d?c.jsx("button",{type:"button",className:di.shortcutsButton,onClick:d,onMouseDown:P=>P.stopPropagation(),onTouchStart:P=>P.stopPropagation(),"aria-haspopup":"dialog","aria-label":w("status.shortcuts"),children:w("status.shortcuts")}):c.jsx("span",{children:w("status.shortcuts")})}),A&&c.jsxs(c.Fragment,{children:[M&&c.jsx("span",{className:di.separator,children:"·"}),c.jsx("button",{ref:_,type:"button",className:di.taskPill,onClick:i,onKeyDown:$,disabled:!i,children:A})]})]}),c.jsxs("div",{className:di.right,children:[!h&&b&&c.jsx("button",{type:"button",className:di.modelButton,onClick:n,onMouseDown:P=>P.stopPropagation(),onTouchStart:P=>P.stopPropagation(),title:w("model.select"),"aria-haspopup":"listbox",children:c.jsx("span",{className:di.model,children:b})}),!h&&y>0&&v>0&&c.jsx("button",{type:"button",className:di.contextButton,onClick:r,title:w("contextUsage.title"),children:c.jsx("span",{className:di.context,children:w("status.contextUsed",{pct:T})})}),N&&c.jsx("span",{className:di.goal,title:l==null?void 0:l.condition,children:N})]})]})}),lJe=15e3,cJe=["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."],uJe=["正在努力搬砖，请稍候...","老板在身后，快加载啊！","头发掉光前，一定能加载完...","服务器正在深呼吸，准备放大招...","正在向服务器投喂咖啡...","正在赋能全链路，寻找关键抓手...","正在降本增效，优化加载路径...","正在打破部门壁垒，沉淀方法论...","正在拥抱变化，迭代核心价值...","正在对齐颗粒度，打磨底层逻辑...","大力出奇迹，正在强行加载...","只要我不写代码，代码就没有 Bug...","正在把 Bug 转化为 Feature...","只要我不尴尬，Bug 就追不上我...","正在试图理解去年的自己写了什么...","正在猿力觉醒中，请耐心等待...","正在询问产品经理：这需求是真的吗？","正在给产品经理画饼，请稍等...","每一行代码，都在努力让世界变得更好一点点...","每一个伟大的想法，都值得这份耐心的等待...","别急，美好的事物总是需要一点时间去酝酿...","愿你的代码永无 Bug，愿你的梦想终将成真...","哪怕只有 0.1% 的进度，也是在向目标靠近...","加载的是字节，承载的是对技术的热爱..."];function oF(e){return(e??(typeof navigator<"u"?navigator.language.toLowerCase():"")).toLowerCase().startsWith("zh")?uJe:cJe}function dJe(){const e=K4(),t=jv(),n=e!=="idle",r=f.useRef(0),s=f.useRef(0),[i,o]=f.useState({estimatedOutputTokens:0,isReceivingContent:!1}),a=f.useMemo(()=>{let u=0,d=0,h=!1;const m=new Set;let p=-1;for(let g=t.length-1;g>=0;g--)if(t[g].kind==="user"){p=g;break}for(let g=p+1;g<t.length;g++){const b=t[g];if(b.kind==="assistant"&&!b.parentToolCallId&&(u+=b.text.length,b.streaming&&(h=!0)),b.kind==="tool"&&!b.parentToolCallId){if(b.rawInput!==void 0)try{u+=JSON.stringify(b.rawInput).length}catch{}const x=hJe(b.rawOutput);x!==void 0&&!m.has(b.toolCallId)&&(d+=x,m.add(b.toolCallId))}}return{chars:u,agentTokens:d,isReceiving:h}},[t]),l=f.useRef(a);return l.current=a,a.chars<s.current&&(r.current=a.chars),s.current=a.chars,f.useEffect(()=>{if(!n){r.current=0,o({estimatedOutputTokens:0,isReceivingContent:!1});return}const u=setInterval(()=>{const{chars:d,agentTokens:h,isReceiving:m}=l.current;if(d<r.current){r.current=d,o({estimatedOutputTokens:h+Math.round(d/4),isReceivingContent:m});return}const p=d-r.current;if(p<=0){o(x=>{const v={estimatedOutputTokens:h+Math.round(r.current/4),isReceivingContent:m};return x.estimatedOutputTokens===v.estimatedOutputTokens&&x.isReceivingContent===v.isReceivingContent?x:v});return}let g;p<70?g=3:p<=200?g=Math.max(3,Math.round(p*.2)):g=50;const b=Math.min(r.current+g,d);r.current=b,o({estimatedOutputTokens:h+Math.round(b/4),isReceivingContent:m})},100);return()=>clearInterval(u)},[n]),i}function hJe(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 fJe(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}k`:`${Math.floor(e/1e3)}k`}function A0(e){const t=Math.round(e);return Math.abs(t)<1e6?t.toLocaleString():`${(t/1e6).toFixed(1)}M`}const mJe="_status_zld2v_1",pJe="_spinner_zld2v_11",gJe="_label_zld2v_15",bJe="_meta_zld2v_19",Qw={status:mJe,spinner:pJe,label:gJe,meta:bJe},cT=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function Qre({startedAt:e,showPhrase:t=!0}){const n=K4(),{estimatedOutputTokens:r,isReceivingContent:s}=dJe(),{language:i,t:o}=gt(),{loadingPhrases:a}=ou(),l=f.useRef(a);l.current=a;const u=f.useCallback(S=>{var C;try{return((C=l.current)==null?void 0:C.call(l,S))??oF(S)}catch(_){return console.warn("[web-shell] loadingPhrases resolver threw; using defaults",_),oF(S)}},[]),[d,h]=f.useState(0),m=f.useRef(Date.now()),[p,g]=f.useState(0),[b,x]=f.useState(()=>u(i)[0]??""),v=n!=="idle";if(f.useEffect(()=>{if(!v){h(0);return}m.current=e??Date.now(),h(aF(m.current));const S=setInterval(()=>{h(aF(m.current))},1e3);return()=>clearInterval(S)},[v,e]),f.useEffect(()=>{if(!t)return;if(n==="idle"){x(u(i)[0]??"");return}const S=()=>{const _=u(i),A=Math.floor(Math.random()*_.length);x(_[A]??"")};S();const C=setInterval(S,lJe);return()=>clearInterval(C)},[i,n,u,t]),f.useEffect(()=>{if(n==="idle")return;const S=setInterval(()=>{g(C=>(C+1)%cT.length)},250);return()=>clearInterval(S)},[n]),n==="idle")return null;const y=cT[p%cT.length],w=s?"↓":"↑",k=d<60?`${d}s`:yJe(d*1e3),T=r>0?` · ${w} ${o("stream.tokens",{count:fJe(r)})}`:"";return c.jsxs("div",{className:Qw.status,children:[c.jsx("span",{className:Qw.spinner,children:y}),t&&b&&c.jsx("span",{className:Qw.label,children:b}),c.jsxs("span",{className:Qw.meta,children:["(",k,T," · ",o("stream.cancel"),")"]})]})}function yJe(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 aF(e){return Math.max(0,Math.ceil((Date.now()-e)/1e3))}const vJe="_host_1scjy_1",xJe="_toast_1scjy_13",wJe="_message_1scjy_31",kJe="_close_1scjy_39",_Je="_info_1scjy_58",SJe="_success_1scjy_62",CJe="_warning_1scjy_66",TJe="_error_1scjy_70",Eb={host:vJe,toast:xJe,message:wJe,close:kJe,info:_Je,success:SJe,warning:CJe,error:TJe};function AJe({toasts:e,onDismiss:t,autoDismissMs:n=5e3}){return e.length===0?null:c.jsx("div",{className:Eb.host,role:"status","aria-live":"polite","data-web-shell-toast-host":!0,children:e.map(r=>c.jsx(EJe,{toast:r,onDismiss:t,autoDismissMs:n},r.id))})}function EJe({toast:e,onDismiss:t,autoDismissMs:n}){const{t:r}=gt();return f.useEffect(()=>{const s=window.setTimeout(()=>t(e.id),n);return()=>window.clearTimeout(s)},[n,t,e.id]),c.jsxs("div",{className:`${Eb.toast} ${Eb[e.tone]}`,"data-web-shell-toast":!0,"data-tone":e.tone,children:[c.jsx("div",{className:Eb.message,children:e.message}),c.jsx("button",{type:"button",className:Eb.close,onClick:()=>t(e.id),"aria-label":r("toast.dismiss"),title:r("toast.dismissShort"),children:"x"})]})}const MJe="_panel_n876c_1",NJe="_summary_n876c_10",jJe="_progressRing_n876c_27",IJe="_stepText_n876c_41",RJe="_statusSegmentWrap_n876c_48",DJe="_separator_n876c_55",LJe="_statusSegment_n876c_48",PJe="_statusSegmentButton_n876c_61",OJe="_fullText_n876c_83",BJe="_compactText_n876c_87",$Je="_detail_n876c_106",zJe="_item_n876c_138",FJe="_icon_n876c_148",qJe="_loadingIcon_n876c_156",HJe="_content_n876c_165",UJe="_completed_n876c_173",VJe="_inProgress_n876c_187",WJe="_pending_n876c_192",Bi={panel:MJe,summary:NJe,progressRing:jJe,stepText:IJe,statusSegmentWrap:RJe,separator:DJe,statusSegment:LJe,statusSegmentButton:PJe,fullText:OJe,compactText:BJe,detail:$Je,item:zJe,icon:FJe,loadingIcon:qJe,content:HJe,completed:UJe,inProgress:VJe,pending:WJe};function GJe(e){switch(e){case"completed":return Bi.completed;case"in_progress":return Bi.inProgress;case"pending":return Bi.pending}}const KJe=f.memo(function({todos:t,title:n,statusItems:r=[]}){const{t:s}=gt();if(t.length===0&&r.length===0)return null;const i=t.length,o=i>0,a=t.findIndex(p=>p.status==="in_progress"),l=a>=0?a:t.findIndex(p=>p.status==="pending"),u=o?l>=0?l+1:i:0,d=o?u/i:0,h=r.map(p=>p.ariaLabel??p.title??(typeof p.label=="string"?p.label:void 0)).filter(Boolean).join(", ")||void 0,m=o?s("todo.stepProgress",{current:u,total:i}):h;return c.jsxs("section",{className:Bi.panel,"aria-label":n??(o?s("todo.title"):h),tabIndex:0,children:[c.jsxs("div",{className:Bi.summary,"aria-label":m,children:[o&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Bi.progressRing,style:{"--todo-progress":String(d)},"aria-hidden":"true"}),c.jsxs("span",{className:Bi.stepText,children:[c.jsx("span",{className:Bi.fullText,children:s("todo.stepProgress",{current:u,total:i})}),c.jsx("span",{className:Bi.compactText,children:s("todo.stepFraction",{current:u,total:i})})]})]}),r.map((p,g)=>c.jsxs("span",{className:Bi.statusSegmentWrap,children:[(i>0||g>0)&&c.jsx("span",{className:Bi.separator,"aria-hidden":"true",children:"·"}),p.onClick?c.jsx("button",{type:"button",className:Bi.statusSegmentButton,title:p.title,"aria-label":p.ariaLabel,onClick:p.onClick,children:p.label}):c.jsx("span",{className:Bi.statusSegment,title:p.title,children:p.label})]},p.id))]}),i>0&&c.jsx("div",{className:Bi.detail,role:"tooltip",children:t.map((p,g)=>c.jsxs("div",{className:`${Bi.item} ${GJe(p.status)}`,children:[c.jsx("span",{className:Bi.icon,"aria-hidden":"true",children:p.status==="in_progress"?c.jsx("span",{className:Bi.loadingIcon}):r4(p.status)}),c.jsx("span",{className:Bi.content,title:p.content,children:p.content})]},`${p.id||g}:${p.content}`))})]})}),YJe="_header_leiy3_1",XJe="_titleRow_leiy3_11",QJe="_title_leiy3_11",JJe="_subtitle_leiy3_31",Jw={header:YJe,titleRow:XJe,title:QJe,subtitle:JJe};function ZJe(e){const{t}=gt();return c.jsxs("div",{className:Jw.header,children:[c.jsxs("div",{className:Jw.titleRow,children:[c.jsx("span",{children:t("welcome.titlePrefix")}),c.jsx("span",{className:Jw.title,children:"Qwen Code"})]}),c.jsx("div",{className:Jw.subtitle,children:t("welcome.prompt")})]})}function c4({...e}){return c.jsx(IN,{"data-slot":"dialog",...e})}function eZe({container:e,...t}){const n=yd();return c.jsx(DN,{"data-slot":"dialog-portal",container:e??n??void 0,...t})}function tZe({...e}){return c.jsx(o1,{"data-slot":"dialog-close",...e})}const nZe=f.forwardRef(function({className:t,...n},r){return c.jsx(LN,{ref:r,"data-slot":"dialog-overlay",className:tn("fixed inset-0 isolate z-[var(--web-shell-dialog-backdrop-z-index,50)] bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),u4=f.forwardRef(function({className:t,children:n,showCloseButton:r=!0,overlayProps:s,...i},o){return c.jsxs(eZe,{children:[c.jsx(nZe,{...s}),c.jsxs(PN,{ref:o,"data-slot":"dialog-content",className:tn("fixed top-1/2 left-1/2 z-[var(--web-shell-dialog-backdrop-z-index,50)] grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...i,children:[n,r&&c.jsx(o1,{"data-slot":"dialog-close",asChild:!0,children:c.jsxs(Fr,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm",children:[c.jsx(AW,{}),c.jsx("span",{className:"sr-only",children:"Close"})]})})]})]})});function d4({className:e,...t}){return c.jsx("div",{"data-slot":"dialog-header",className:tn("flex flex-col gap-2",e),...t})}function h4({className:e,showCloseButton:t=!1,children:n,...r}){return c.jsxs("div",{"data-slot":"dialog-footer",className:tn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...r,children:[n,t&&c.jsx(o1,{asChild:!0,children:c.jsx(Fr,{variant:"outline",children:"Close"})})]})}function f4({className:e,...t}){return c.jsx(ON,{"data-slot":"dialog-title",className:tn("text-base leading-none font-medium",e),...t})}function m4({className:e,...t}){return c.jsx(BN,{"data-slot":"dialog-description",className:tn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const rZe="_themeDark_1tp31_1",sZe="_themeLight_1tp31_25",lF={themeDark:rZe,themeLight:sZe},iZe={sm:"sm:max-w-[420px]",md:"sm:max-w-[560px]",lg:"sm:max-w-[720px]",xl:"sm:max-w-[900px]"},oZe=["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 cF(e){return e?Array.from(e.querySelectorAll(oZe)):[]}const E0=[],Jre=f.createContext(null);function uE(e){return e===null?!0:E0[E0.length-1]===e}function Qs({title:e,subtitle:t,size:n="md",allowFullscreen:r=!1,onClose:s,children:i}){const{t:o}=gt(),a=Hg(),[l,u]=f.useState(!1),d=f.useRef(null),h=f.useRef(s);h.current=s;const[m]=f.useState(()=>typeof document<"u"?document.activeElement:null),p=f.useRef(!1),g=f.useRef(!1),b=f.useRef(null);b.current===null&&(b.current={}),f.useEffect(()=>{const k=b.current;E0.push(k);const T=S=>{S.key!=="Escape"||!S.isComposing&&S.keyCode!==229||!uE(k)||(Object.defineProperty(S,"key",{configurable:!0,value:"Process"}),document.addEventListener("keydown",C=>{C===S&&Reflect.deleteProperty(S,"key")},{capture:!0,once:!0}))};return window.addEventListener("keydown",T,{capture:!0}),()=>{var M,L;window.removeEventListener("keydown",T,{capture:!0});const S=E0.indexOf(k);if(S>=0&&E0.splice(S,1),E0.length===0){(M=m==null?void 0:m.focus)==null||M.call(m);return}const C=Array.from(document.querySelectorAll("[data-keyboard-scope]")),_=C[C.length-1];(L=cF(_).find(N=>!N.hasAttribute("data-dialog-close"))??_)==null||L.focus()}},[m]);const x=k=>{p.current=k.target===k.currentTarget,g.current=!1},v=k=>{g.current=k.target===k.currentTarget},y=k=>{const T=p.current&&g.current&&k.target===k.currentTarget;p.current=!1,g.current=!1,T&&s()},w=a===As.Light?lF.themeLight:lF.themeDark;return c.jsx(c4,{open:!0,onOpenChange:k=>{k||s()},children:c.jsx(Jre.Provider,{value:b.current,children:c.jsxs(u4,{ref:d,showCloseButton:!1,overlayProps:{onMouseDown:x,onMouseUp:v,onClick:y},className:`${w} ${a===As.Dark?"dark":""} flex max-h-[min(80vh,calc(100vh-48px))] flex-col gap-0 overflow-hidden p-0 font-mono text-sm ${l?"h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] max-w-[calc(100vw-32px)] sm:max-w-[calc(100vw-32px)]":iZe[n]}`,"aria-label":e,"data-keyboard-scope":!0,"data-web-shell-dialog":!0,"data-web-shell-dialog-title":e,onPointerDownOutside:k=>k.preventDefault(),onEscapeKeyDown:k=>{k.defaultPrevented||k.isComposing||k.keyCode===229||uE(b.current)&&(k.preventDefault(),h.current())},onOpenAutoFocus:k=>{var S;k.preventDefault(),(S=cF(d.current).find(C=>!C.hasAttribute("data-dialog-close"))??d.current)==null||S.focus()},onCloseAutoFocus:k=>k.preventDefault(),children:[c.jsxs(d4,{className:"flex-row items-center gap-2 border-b px-4 py-2.5 text-left",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(f4,{children:e}),t&&c.jsx(m4,{className:"mt-0.5 text-xs",children:t})]}),r&&c.jsx(Fr,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>u(k=>!k),"aria-label":o(l?"common.exitFullscreen":"common.fullscreen"),"aria-pressed":l,title:o(l?"common.exitFullscreen":"common.fullscreen"),children:l?c.jsx(SW,{}):c.jsx(_W,{})}),c.jsx(tZe,{asChild:!0,children:c.jsx(Fr,{type:"button",variant:"ghost",size:"icon-sm","aria-label":o("common.close"),title:o("common.close"),"data-dialog-close":!0,children:c.jsx(AW,{})})})]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4","data-dialog-fullscreen":l?"":void 0,children:i})]})})})}function Zw(e,t){return t<=0||e<0?0:e>t-1?t-1:e}const aZe=new Set(["button","submit","reset"]),lZe=new Set(["checkbox","radio","button","submit","reset","range","color","file"]);function uF(){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 aZe.has(e.type);const n=e.getAttribute("role");return n==="button"||n==="link"||n==="menuitem"}function uT(){const e=typeof document<"u"?document.activeElement:null;if(!e)return!1;const t=e.tagName;return t==="TEXTAREA"?!0:t==="INPUT"?!lZe.has(e.type):e.isContentEditable===!0}function Nf({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r,enabled:s=!0}){const i=f.useContext(Jre),o=f.useRef({itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r});o.current={itemCount:e,activeIndex:t,onActiveIndexChange:n,onConfirm:r};const[a,l]=f.useState(!1);return f.useEffect(()=>{if(!s)return;const u=()=>l(!0),d=()=>l(!1),h=m=>{if(!uE(i)||m.defaultPrevented||m.isComposing||m.keyCode===229||m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;const{itemCount:p,activeIndex:g}=o.current;if(!(p<=0))switch(m.key){case"ArrowDown":m.preventDefault(),u(),o.current.onActiveIndexChange(Zw(g+1,p));break;case"ArrowUp":m.preventDefault(),u(),o.current.onActiveIndexChange(Zw(g-1,p));break;case"Home":if(uT())return;m.preventDefault(),u(),o.current.onActiveIndexChange(0);break;case"End":if(uT())return;m.preventDefault(),u(),o.current.onActiveIndexChange(p-1);break;case"Enter":{if(uF()||g<0)return;m.preventDefault(),o.current.onConfirm(Zw(g,p));break}case" ":{if(uF()||uT()||g<0)return;m.preventDefault(),o.current.onConfirm(Zw(g,p));break}}};return window.addEventListener("keydown",h),window.addEventListener("mousemove",d),()=>{window.removeEventListener("keydown",h),window.removeEventListener("mousemove",d)}},[i,s]),{keyboardMode:a}}const cZe="_picker_5cmbf_4",uZe="_selected_5cmbf_98",dZe="_disabled_5cmbf_114",hZe={picker:cZe,"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:uZe,"picker-keyboard-only":"_picker-keyboard-only_5cmbf_106",disabled:dZe,"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 Qt(...e){return e.filter(t=>!!t).map(t=>hZe[t]).filter(Boolean).join(" ")}const fZe="_list_jbgdx_1",mZe="_row_jbgdx_16",pZe="_selected_jbgdx_32",gZe="_keyboardOnly_jbgdx_39",bZe="_modeName_jbgdx_47",yZe="_modeIcon_jbgdx_51",vZe="_modeText_jbgdx_67",xZe="_modeDesc_jbgdx_83",Zd={list:fZe,row:mZe,selected:pZe,keyboardOnly:gZe,modeName:bZe,modeIcon:yZe,modeText:vZe,modeDesc:xZe};function wZe({currentMode:e,onSelect:t}){const{t:n}=gt(),r=f.useRef(null),s=U4.map(m=>({id:m,name:n(`mode.listLabel.${m}`),description:n(`mode.desc.${m}`)})),i=s.findIndex(m=>m.id===e),[o,a]=f.useState(i>=0?i:0),l=f.useRef(!1);f.useEffect(()=>{l.current||i<0||a(i)},[i]);const u=m=>{l.current=!0,a(m)},d=m=>{const p=s[m];p&&t(p.id)},{keyboardMode:h}=Nf({itemCount:s.length,activeIndex:o,onActiveIndexChange:u,onConfirm:d});return f.useEffect(()=>{var p;const m=(p=r.current)==null?void 0:p.children[o];m==null||m.scrollIntoView({block:"nearest"})},[o]),c.jsx("div",{className:`${Zd.list} ${h?Zd.keyboardOnly:""}`,ref:r,role:"listbox",tabIndex:0,"aria-activedescendant":s.length>0?`mode-opt-${o}`:void 0,"aria-label":n("mode.select"),"data-web-shell-approval-mode-dialog":!0,children:s.map((m,p)=>{const g=p===o,b=m.id===e;return c.jsxs("div",{id:`mode-opt-${p}`,role:"option","aria-selected":b,className:`${Zd.row} ${g?Zd.selected:""} ${b?Qt("dialog-current"):""}`,"data-web-shell-approval-mode-option":!0,"data-mode-id":m.id,onClick:()=>d(p),onMouseMove:()=>u(p),children:[c.jsx("span",{className:Zd.modeIcon,children:c.jsx(Ab,{mode:m.id})}),c.jsxs("span",{className:Zd.modeText,children:[c.jsx("span",{className:Zd.modeName,children:m.name}),c.jsx("span",{className:Zd.modeDesc,children:m.description})]})]},m.id)})})}function M3(e){const[t,n]=f.useState(""),[r,s]=f.useState(""),i=f.useRef(!1),o=f.useRef(""),a=f.useRef(e);a.current=e;const l=f.useCallback(m=>{var p;m!==o.current&&(o.current=m,s(m),(p=a.current)==null||p.call(a,m))},[]),u=f.useCallback(m=>{const p=m.target.value;n(p),i.current||l(p)},[l]),d=f.useCallback(()=>{i.current=!0},[]),h=f.useCallback(m=>{i.current=!1;const p=m.currentTarget.value;n(p),l(p)},[l]);return{filterValue:r,inputProps:{value:t,onChange:u,onCompositionStart:d,onCompositionEnd:h}}}function p4(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 Rj({session:e,active:t,current:n,confirmed:r,disabled:s,currentLabel:i,optionId:o,ariaSelected:a,leading:l,trailing:u,resumeSelector:d,onClick:h,onActivate:m}){const{t:p}=gt(),g=e.updatedAt||e.createdAt;return c.jsxs("div",{id:o,role:"option","aria-selected":a??n,"aria-current":n?"true":void 0,"aria-disabled":s||void 0,className:Qt("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,"data-web-shell-resume-session":d?"":void 0,"data-session-id":d?e.sessionId:void 0,onClick:h,onMouseMove:m,children:[c.jsxs("div",{className:Qt("picker-item-row"),children:[l,c.jsx("span",{className:Qt("picker-item-title"),children:e.displayName||e.sessionId.slice(0,8)}),u]}),c.jsxs("div",{className:Qt("picker-item-meta"),children:[c.jsx("span",{children:g&&p4(g,p)}),c.jsx("span",{className:Qt("picker-item-detail"),children:p("common.clients",{count:e.clientCount??0})}),e.hasActivePrompt&&c.jsx("span",{className:Qt("picker-item-detail"),children:p("resume.activePrompt")})]})]})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Ou=1e3,Dj="session_organization",g4="default";function ix(e,t={}){const{autoLoad:n=!1,enabled:r=!0,pageSize:s,archiveState:i,view:o,group:a}=t,l=Nk({autoLoad:n,enabled:r&&!e,pageSize:s,archiveState:i,view:o,group:a,sourceType:g4}),{reload:u,deleteSession:d,deleteSessions:h}=l,m=pd(),p=f.useRef(0),[g,b]=f.useState({sessions:[],loading:!1}),x=f.useCallback(async()=>{if(!e||!r)return[];const T=++p.current;b(S=>({cwd:e,sessions:S.cwd===e?S.sessions:[],loading:!0}));try{const C=(await m.client.workspaceByCwd(e).listWorkspaceSessions({pageSize:s,archiveState:i,view:o,group:a,sourceType:g4})).map(_=>({..._,workspaceCwd:e}));return p.current===T&&b({cwd:e,sessions:C,loading:!1}),C}catch(S){const C=S instanceof Error?S:new Error(String(S));throw p.current===T&&b({cwd:e,sessions:[],loading:!1,error:C}),C}},[i,r,a,s,o,m.client,e]);f.useEffect(()=>{if(e)return p.current+=1,b({cwd:e,sessions:[],loading:n&&r}),n&&r&&x().catch(()=>{}),()=>{p.current+=1}},[n,r,x,e]);const v=f.useCallback(()=>e?x():u(),[u,x,e]),y=f.useCallback(async T=>{if(!e)return h(T);const S=await m.client.workspaceByCwd(e).deleteSessionsData(T);return await x(),S},[h,x,m.client,e]),w=f.useCallback(async T=>{if(!e)return d(T);const S=await y([T]);if(S.errors.length>0)throw new Error(S.errors[0].error);return S.removed.length>0||S.notFound.length>0},[d,y,e]);if(!e)return l;const k=g.cwd===e?g:void 0;return{sessions:(k==null?void 0:k.sessions)??[],loading:(k==null?void 0:k.loading)??(n&&r),error:k==null?void 0:k.error,reload:v,deleteSession:w,deleteSessions:y,releaseSession:l.releaseSession}}const dE="resume-session-list",dF=e=>`${dE}-opt-${e}`;function kZe({onSelect:e,onClose:t,workspaceCwd:n}){const{t:r}=gt(),s=il(),{sessions:i,loading:o,error:a}=ix(n,{autoLoad:!0}),l=s.sessionId,[u,d]=f.useState(-1),{filterValue:h,inputProps:m}=M3(()=>d(-1)),p=f.useRef(null),g=f.useRef(null),b=h?i.filter(y=>{const w=h.toLowerCase();return(y.displayName||"").toLowerCase().includes(w)||y.sessionId.toLowerCase().includes(w)}):i;f.useEffect(()=>{u>=b.length&&b.length>0&&d(b.length-1)},[b.length,u]),f.useEffect(()=>{var w;const y=(w=p.current)==null?void 0:w.children[u];y==null||y.scrollIntoView({block:"nearest"})},[u]);const x=y=>{const w=b[y];w&&(e(w.sessionId),t())},{keyboardMode:v}=Nf({itemCount:b.length,activeIndex:u,onActiveIndexChange:d,onConfirm:x});return f.useEffect(()=>{var y;(y=g.current)==null||y.focus()},[]),c.jsxs("div",{className:Qt("picker","picker-in-shell"),"data-web-shell-resume-dialog":!0,children:[c.jsxs("div",{className:Qt("picker-search"),children:[c.jsxs("span",{className:Qt("picker-search-label"),children:[r("resume.search"),":"," "]}),c.jsx("input",{ref:g,className:Qt("picker-search-input"),"aria-label":r("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":dE,"aria-activedescendant":u>=0&&u<b.length?dF(u):void 0,...m,placeholder:""})]}),c.jsx("div",{className:Qt("picker-sep")}),c.jsxs("div",{id:dE,role:"listbox",className:Qt("picker-list",v?"picker-keyboard-only":void 0),ref:p,children:[o&&c.jsx("div",{className:Qt("picker-empty"),children:r("common.loading")}),!o&&a&&c.jsx("div",{className:Qt("picker-empty"),children:a.message||r("resume.failedToLoad")}),!o&&!a&&b.length===0&&c.jsx("div",{className:Qt("picker-empty"),children:h?r("resume.noMatch",{query:h}):r("resume.none")}),!o&&b.map((y,w)=>c.jsx(Rj,{session:y,optionId:dF(w),active:w===u,current:y.sessionId===l,currentLabel:r("resume.current"),resumeSelector:!0,onClick:()=>x(w),onActivate:()=>d(w)},y.sessionId))]})]})}const _Ze="_layout_1sigx_1",SZe="_list_1sigx_9",CZe="_row_1sigx_23",TZe="_selected_1sigx_39",AZe="_keyboardOnly_1sigx_46",EZe="_label_1sigx_54",MZe="_divider_1sigx_58",NZe="_number_1sigx_65",jZe="_provider_1sigx_71",IZe="_badge_1sigx_86",RZe="_detail_1sigx_92",DZe="_detailRow_1sigx_104",LZe="_detailLabel_1sigx_111",PZe="_detailValue_1sigx_117",OZe="_empty_1sigx_122",Ro={layout:_Ze,list:SZe,row:CZe,selected:TZe,keyboardOnly:AZe,label:EZe,divider:MZe,number:NZe,provider:jZe,badge:IZe,detail:RZe,detailRow:DZe,detailLabel:LZe,detailValue:PZe,empty:OZe};function BZe(e,t){return e?`${e.toLocaleString()} ${t("contextUsage.tokens")}`:t("model.contextWindow.unknown")}function $Ze(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 hF(e){if(e.authType)return e.authType;const t=e.id.match(/\(([^()]+)\)$/);return t==null?void 0:t[1]}function zZe(e){return e.label?e.label:e.baseModelId?e.baseModelId:e.id.replace(/\([^()]+\)$/,"")}function FZe(e){return[e.authType??"",e.id,e.baseUrl??"",e.envKey??""].join("\0")}function qZe(e,t){return t?e.baseModelId??e.id.replace(/\([^()]+\)$/,""):e.id}function ek({label:e,value:t}){return c.jsxs("div",{className:Ro.detailRow,children:[c.jsx("span",{className:Ro.detailLabel,children:e}),c.jsx("span",{className:Ro.detailValue,children:t})]})}function HZe({mode:e="main",onSelect:t,models:n,currentModelId:r}){const s=il(),i=r??s.currentModel??"",o=f.useMemo(()=>n??s.models??[],[n,s.models]),{t:a}=gt(),l=f.useRef(null),u=e==="fast",d=e==="voice",h=e==="vision",m=o.findIndex(k=>k.id===i),[p,g]=f.useState(m>=0?m:0),b=f.useRef(!1);f.useEffect(()=>{b.current||o.length===0||g(m>=0?m:0)},[o.length,m]);const x=k=>{b.current=!0,g(k)};f.useEffect(()=>{p>=o.length&&o.length>0&&g(o.length-1)},[o.length,p]);const v=o[p]??o[0],y=k=>{const T=o[k];T&&t(qZe(T,u))},{keyboardMode:w}=Nf({itemCount:o.length,activeIndex:p,onActiveIndexChange:x,onConfirm:y});return f.useEffect(()=>{var T;const k=(T=l.current)==null?void 0:T.children[p];k==null||k.scrollIntoView({block:"nearest"})},[p]),c.jsxs("div",{className:Ro.layout,children:[c.jsxs("div",{className:`${Ro.list} ${w?Ro.keyboardOnly:""}`,ref:l,role:"listbox",tabIndex:0,"aria-activedescendant":o.length>0?`model-opt-${p}`:void 0,"aria-label":a(u?"model.setFast":d?"model.setVoice":h?"model.setVision":"model.select"),"data-web-shell-model-dialog":!0,children:[o.length===0?c.jsx("div",{className:Ro.empty,children:a("model.none")}):null,o.map((k,T)=>{const S=T===p,C=T===m,_=hF(k);return c.jsxs("div",{id:`model-opt-${T}`,role:"option","aria-selected":C,className:`${Ro.row} ${S?Ro.selected:""} ${C?Qt("dialog-current"):""}`,"data-web-shell-model-option":!0,"data-model-id":k.id,onClick:()=>y(T),onMouseMove:()=>x(T),children:[c.jsxs("span",{className:Ro.number,children:[T+1,"."]}),_?c.jsxs("span",{className:Ro.provider,children:["[",_,"]"]}):null,c.jsx("span",{className:Ro.label,children:zZe(k)}),k.isRuntime?c.jsx("span",{className:Ro.badge,children:a("common.runtime")}):null]},FZe(k))})]}),v?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Ro.divider}),c.jsxs("div",{className:Ro.detail,children:[c.jsx(ek,{label:a("model.modality"),value:$Ze(v.modalities,a)}),c.jsx(ek,{label:a("model.contextWindow"),value:BZe(v.contextWindow,a)}),hF(v)!=="qwen-oauth"?c.jsxs(c.Fragment,{children:[c.jsx(ek,{label:a("model.baseUrl"),value:v.baseUrl??a("model.default")}),c.jsx(ek,{label:a("model.apiKey"),value:v.envKey??a("model.notSet")})]}):null]})]}):null]})}const UZe="_body_2kfet_1",VZe="_hint_2kfet_8",WZe="_list_2kfet_13",GZe="_empty_2kfet_21",KZe="_row_2kfet_27",YZe="_rowSelected_2kfet_51",XZe="_badge_2kfet_56",QZe="_label_2kfet_74",JZe="_footer_2kfet_78",ZZe="_count_2kfet_86",eet="_actions_2kfet_91",tet="_cancel_2kfet_96",net="_confirm_2kfet_97",Ia={body:UZe,hint:VZe,list:WZe,empty:GZe,row:KZe,rowSelected:YZe,badge:XZe,label:QZe,footer:JZe,count:ZZe,actions:eet,cancel:tet,confirm:net};function ret({models:e,current:t,max:n,onConfirm:r,onClose:s}){const{t:i}=gt(),[o,a]=f.useState(()=>{const d=new Set,h=[];for(const m of t){const p=m.trim();if(!(!p||d.has(p))&&(d.add(p),h.push(p),h.length>=n))break}return h}),l=f.useMemo(()=>{const d=new Set(e.map(m=>m.baseId)),h=o.filter(m=>!d.has(m)).map(m=>({baseId:m,label:m}));return[...e,...h]},[e,o]),u=d=>{a(h=>h.includes(d)?h.filter(m=>m!==d):h.length>=n?h:[...h,d])};return c.jsxs("div",{className:Ia.body,children:[c.jsx("div",{className:Ia.hint,children:i("settings.models.fallbacks.hint",{max:n})}),c.jsxs("div",{className:Ia.list,role:"group","aria-label":i("settings.models.fallbacks.title"),children:[l.length===0&&c.jsx("div",{className:Ia.empty,children:i("settings.models.fallbacks.empty")}),l.map(d=>{const h=o.indexOf(d.baseId),m=h>=0,p=o.length>=n&&!m;return c.jsxs("button",{type:"button","aria-pressed":m,className:`${Ia.row} ${m?Ia.rowSelected:""}`,"aria-disabled":p||void 0,title:p?i("settings.models.fallbacks.limitReached",{max:n}):void 0,onClick:()=>u(d.baseId),children:[c.jsx("span",{className:Ia.badge,children:m?h+1:""}),c.jsx("span",{className:Ia.label,children:d.label})]},d.baseId)})]}),c.jsxs("div",{className:Ia.footer,children:[c.jsxs("span",{className:Ia.count,children:[o.length,"/",n]}),c.jsxs("div",{className:Ia.actions,children:[c.jsx("button",{type:"button",className:Ia.cancel,onClick:s,children:i("settings.models.cancel")}),c.jsx("button",{type:"button",className:Ia.confirm,onClick:()=>r(o),children:i("settings.models.fallbacks.confirm")})]})]})]})}function pm(e){return e.replace(/[：:\s]+$/u,"")}const set="_panel_irhhk_1",iet="_embedded_irhhk_13",oet="_footer_irhhk_21",aet="_titleLine_irhhk_25",cet="_icon_irhhk_32",uet="_title_irhhk_25",det="_subtitle_irhhk_44",het="_text_irhhk_49",fet="_options_irhhk_55",met="_option_irhhk_55",pet="_optionActive_irhhk_77",get="_optionLabel_irhhk_81",bet="_optionIcon_irhhk_86",yet="_optionContent_irhhk_119",vet="_optionDesc_irhhk_129",xet="_badge_irhhk_135",wet="_toolDetail_irhhk_170",ket="_toolDetailTitle_irhhk_175",_et="_toolDetailBody_irhhk_180",Cet="_toolList_irhhk_181",Tet="_textInput_irhhk_193",Aet="_textArea_irhhk_211",Eet="_summary_irhhk_231",Met="_summaryRow_irhhk_238",Net="_summaryLabel_irhhk_244",jet="_summaryValue_irhhk_250",Iet="_summaryBlockTitle_irhhk_255",Ret="_summaryBlock_irhhk_255",Det="_manageList_irhhk_295",Let="_manageItem_irhhk_301",Pet="_manageItemExpanded_irhhk_307",Oet="_manageRow_irhhk_312",Bet="_manageRowActive_irhhk_329",$et="_manageIcon_irhhk_333",zet="_manageName_irhhk_362",Fet="_levelTag_irhhk_370",qet="_manageChevron_irhhk_380",Het="_manageChevronExpanded_irhhk_398",Uet="_manageDetail_irhhk_402",Vet="_manageDetailInner_irhhk_409",Wet="_manageDetailHeader_irhhk_419",Get="_manageActions_irhhk_426",Ket="_manageButton_irhhk_433",Yet="_dangerButton_irhhk_453",Xet="_deleteText_irhhk_457",Qet="_viewerRow_irhhk_487",Jet="_viewerLabel_irhhk_500",Zet="_viewerField_irhhk_507",ett="_viewerSectionTitle_irhhk_512",ttt="_viewerBlock_irhhk_518",ntt="_closed_irhhk_524",rtt="_closedText_irhhk_528",stt="_loading_irhhk_534",itt="_error_irhhk_539",ott="_createWizard_irhhk_545",att="_createSteps_irhhk_551",ltt="_createStepPill_irhhk_559",ctt="_createStepPillActive_irhhk_571",utt="_createStepPillDone_irhhk_576",dtt="_createStepNumber_irhhk_580",htt="_createStepLabel_irhhk_591",ftt="_createBody_irhhk_597",mtt="_createActions_irhhk_601",it={panel:set,embedded:iet,footer:oet,titleLine:aet,icon:cet,title:uet,subtitle:det,text:het,options:fet,option:met,optionActive:pet,optionLabel:get,optionIcon:bet,optionContent:yet,optionDesc:vet,badge:xet,toolDetail:wet,toolDetailTitle:ket,toolDetailBody:_et,toolList:Cet,textInput:Tet,textArea:Aet,summary:Eet,summaryRow:Met,summaryLabel:Net,summaryValue:jet,summaryBlockTitle:Iet,summaryBlock:Ret,manageList:Det,manageItem:Let,manageItemExpanded:Pet,manageRow:Oet,manageRowActive:Bet,manageIcon:$et,manageName:zet,levelTag:Fet,manageChevron:qet,manageChevronExpanded:Het,manageDetail:Uet,manageDetailInner:Vet,manageDetailHeader:Wet,manageActions:Get,manageButton:Ket,dangerButton:Yet,deleteText:Xet,viewerRow:Qet,viewerLabel:Jet,viewerField:Zet,viewerSectionTitle:ett,viewerBlock:ttt,closed:ntt,closedText:rtt,loading:stt,error:itt,createWizard:ott,createSteps:att,createStepPill:ltt,createStepPillActive:ctt,createStepPillDone:utt,createStepNumber:dtt,createStepLabel:htt,createBody:ftt,createActions:mtt};function Zre(e){if(e==="project")return"workspace";if(e==="user")return"global"}function ese(e){return Zre(e.level)!==void 0&&!e.isBuiltin&&e.level!=="extension"}function ptt(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 Bc=pm;function gtt(e){return e.displayName||e.name}function tse(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 nse(e){const t=e.toLowerCase();return["edit","write","delete","move","patch","replace","create"].some(n=>t.includes(n))}function rse(e){const t=e.toLowerCase();return["shell","exec","run","command","terminal","bash","spawn"].some(n=>t.includes(n))}function btt(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 ytt({mode:e,embedded:t=!1,onMessage:n,onClose:r}){const{t:s}=gt(),{agents:i,loading:o,reload:a,getAgent:l,createAgent:u,generateAgent:d,deleteAgent:h}=The({autoLoad:!0}),{tools:m}=bW({autoLoad:!0}),[p,g]=f.useState(!1),[b,x]=f.useState(()=>e==="manage"?"manage":e==="create"||e==="create-user"||e==="create-project"?"create":"menu"),[v,y]=f.useState(0),[w,k]=f.useState(0),[T,S]=f.useState(null),[C,_]=f.useState(null),[A,M]=f.useState(!1),[L,N]=f.useState(null),[O,B]=f.useState(1),[$,P]=f.useState(()=>e==="create-user"?"global":"workspace"),[K,F]=f.useState("manual"),[H,D]=f.useState(""),[Q,U]=f.useState(""),[j,ie]=f.useState(""),[oe,J]=f.useState([]),[V,se]=f.useState(0),[Z,X]=f.useState(!1),[te,ae]=f.useState(!1),xe=f.useRef(0),Ae=f.useCallback(()=>{g(!0),r()},[r]),Ne=f.useMemo(()=>{const dt=i.filter(je=>je.level==="project"),Ge=i.filter(je=>je.level==="user"),St=i.filter(je=>je.level==="builtin"),Y=i.filter(je=>je.level==="extension");return{project:dt,user:Ge,builtin:St,extension:Y}},[i]),Le=f.useMemo(()=>[...Ne.project,...Ne.user,...Ne.builtin,...Ne.extension],[Ne]),ge=f.useMemo(()=>{const dt=m.filter(je=>je.enabled).map(gtt).sort((je,We)=>je.localeCompare(We)),Ge=dt.filter(tse),St=dt.filter(nse),Y=dt.filter(rse);return[{id:"all",label:s("agent.create.tools.all"),tools:[]},{id:"read",label:s("agent.create.tools.readOnly"),tools:Ge},{id:"edit",label:s("agent.create.tools.readEdit"),tools:[...new Set([...Ge,...St])]},{id:"execute",label:s("agent.create.tools.readEditExecute"),tools:[...new Set([...Ge,...St,...Y])]}]},[s,m]);f.useEffect(()=>{if(b!=="manage")return;const dt=C!==null?Le[C]:void 0;dt&&l(dt.name).then(S).catch(Ge=>N(Ge instanceof Error?Ge.message:String(Ge)))},[b,Le,C,l]),f.useEffect(()=>{w>=Le.length&&Le.length>0&&k(Le.length-1),C!==null&&C>=Le.length&&_(null)},[C,Le.length,w]);const Oe=f.useCallback((dt=w)=>{const Ge=Le[dt];if(!Ge||!ese(Ge))return;const St=Zre(Ge.level);St&&(M(!0),h(Ge.name,St).then(()=>{n(s("agent.deleted",{name:Ge.name})),S(null),_(null),k(0),a()}).catch(Y=>N(Y instanceof Error?Y.message:String(Y))).finally(()=>M(!1)))},[Le,w,h,n,a,s]),Nt=f.useCallback(()=>{if(!H.trim()||!Q.trim()||!j.trim()){N(s("agent.create.required"));return}M(!0),u({name:H.trim(),description:Q.trim(),systemPrompt:j.trim(),scope:$,tools:oe}).then(dt=>{n(s("agent.created",{name:dt.agent.name})),Ae()}).catch(dt=>N(dt instanceof Error?dt.message:String(dt))).finally(()=>M(!1))},[H,Q,j,$,oe,u,n,Ae,s]),Pe=f.useCallback(async()=>{const dt=Q.trim();if(!dt||Z)return;const Ge=xe.current+1;xe.current=Ge,X(!0),ae(!1),N(null);try{const St=await d(dt);if(xe.current!==Ge)return;D(St.name),U(St.description),ie(St.systemPrompt),B(K==="manual"?6:4),se(0)}catch(St){if(xe.current!==Ge)return;N(s("agent.create.generateFailed",{error:St instanceof Error?St.message:String(St)})),ae(!0)}finally{xe.current===Ge&&X(!1)}},[Q,Z,K,d,s]),Ce=f.useCallback(dt=>{if(dt==="name"&&H.trim())B(4),ae(!0);else if(dt==="prompt"&&j.trim())B(5),ae(!0);else if(dt==="desc"&&Q.trim()){if(K==="qwen"){Pe();return}B(K==="manual"?6:4),se(0),ae(!1)}},[H,Q,j,K,Pe]);if(p)return c.jsx("div",{className:`${it.panel} ${t?it.embedded:""} ${it.closed}`,children:c.jsx("div",{className:it.closedText,children:s("agents.closed")})});if(o&&i.length===0)return c.jsxs("div",{className:`${it.panel} ${t?it.embedded:""}`,children:[c.jsxs("div",{className:it.titleLine,children:[c.jsx("span",{className:it.icon,children:"?"}),c.jsx("span",{className:it.title,children:s("agents.title")})]}),c.jsx("div",{className:it.loading,children:s("common.loading")})]});const Zt=s("agents.title");return c.jsxs("div",{className:`${it.panel} ${t?it.embedded:""}`,children:[!t&&b!=="create"&&c.jsxs("div",{className:it.titleLine,children:[c.jsx("span",{className:it.icon,children:"?"}),c.jsx("span",{className:it.title,children:Zt}),c.jsx("span",{className:it.subtitle,children:s("agent.count",{count:i.length})})]}),L&&c.jsx("div",{className:it.error,children:L}),b==="menu"&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.text,children:s("agent.selectAction")}),c.jsxs("div",{className:it.options,children:[c.jsx(gm,{idx:0,active:v===0,label:s("agent.manage"),desc:s("agent.manage.desc"),onClick:()=>{y(0),x("manage")},onHover:()=>y(0)}),c.jsx(gm,{idx:1,active:v===1,label:s("agent.create"),desc:s("agent.create.desc"),onClick:()=>{y(1),x("create")},onHover:()=>y(1)})]}),c.jsx("div",{className:it.footer,children:s("agent.footer.nav")})]}),b==="manage"&&c.jsx(vtt,{agents:Le,expandedAgentIdx:C,selectedAgent:T,busy:A,onToggleAgent:dt=>{k(dt),_(Ge=>Ge===dt?null:dt),S(null)},onDelete:dt=>{A||Oe(dt)},t:s}),b==="create"&&c.jsx(xtt,{step:O,method:K,scope:$,name:H,desc:Q,prompt:j,tools:oe,toolCategories:ge,selIdx:V,busy:A,generating:Z,inputFocused:te,onSetName:D,onSetDesc:U,onSetPrompt:ie,onInputNext:Ce,onInputFocus:()=>ae(!0),onInputBlur:()=>ae(!1),onSetStep:B,onSetSelectedIndex:se,onSelectLocation:dt=>{se(dt),P(dt===0?"workspace":"global")},onSelectMethod:dt=>{se(dt),F(dt===0?"qwen":"manual")},onSelectTools:dt=>{var Ge;se(dt),J(((Ge=ge[dt])==null?void 0:Ge.tools)??[])},onSave:()=>{A||Nt()},t:s})]})}function gm({idx:e,active:t,label:n,desc:r,badge:s,numbered:i=!1,onClick:o,onHover:a}){return c.jsxs("div",{className:`${it.option} ${t?it.optionActive:""}`,onClick:o,onMouseEnter:a,children:[c.jsx("span",{className:it.optionIcon,"aria-hidden":"true"}),c.jsxs("span",{className:it.optionContent,children:[c.jsxs("span",{className:it.optionLabel,children:[i?`${e+1}. `:"",n,s&&c.jsx("span",{className:it.badge,children:s})]}),r&&c.jsx("span",{className:it.optionDesc,children:r})]})]})}function vtt({agents:e,expandedAgentIdx:t,selectedAgent:n,busy:r,onToggleAgent:s,onDelete:i,t:o}){const[a,l]=f.useState(null),u=f.useMemo(()=>new Set(e.filter(d=>d.level==="project").map(d=>d.name)),[e]);return e.length===0?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.text,children:o("agent.empty")}),c.jsx("div",{className:it.text,children:o("agent.createFirstHint")})]}):c.jsx("div",{className:it.manageList,children:e.map((d,h)=>{const m=t===h,p=m&&(n==null?void 0:n.name)===d.name?n:null,g=ese(d),b=(p==null?void 0:p.tools)??[],x=b.length===0||b.includes("*")?o("agent.create.tools.all"):b.join(", ");return c.jsxs("div",{className:`${it.manageItem} ${m?it.manageItemExpanded:""}`,children:[c.jsxs("button",{type:"button",className:`${it.manageRow} ${m?it.manageRowActive:""}`,onClick:()=>{l(null),s(h)},children:[c.jsx("span",{className:it.manageIcon,"aria-hidden":"true"}),c.jsx("span",{className:it.manageName,children:d.name}),c.jsx("span",{className:it.levelTag,children:ptt(d.level,o)}),d.level==="user"&&u.has(d.name)?c.jsx("span",{className:it.levelTag,children:o("agent.overriddenBadge")}):null,c.jsx("span",{className:`${it.manageChevron} ${m?it.manageChevronExpanded:""}`})]}),m?c.jsx("div",{className:it.manageDetail,children:p?c.jsxs("div",{className:it.manageDetailInner,children:[c.jsx("div",{className:it.manageDetailHeader,children:g?c.jsx("div",{className:it.manageActions,children:a===h?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:it.deleteText,children:r?o("agent.delete.loading"):o("agent.delete.confirm",{name:d.name})}),c.jsx("button",{type:"button",className:it.manageButton,onClick:()=>l(null),disabled:r,children:o("common.cancel")}),c.jsx("button",{type:"button",className:`${it.manageButton} ${it.dangerButton}`,onClick:()=>i(h),disabled:r,children:o("agent.action.delete")})]}):c.jsx("button",{type:"button",className:`${it.manageButton} ${it.dangerButton}`,onClick:()=>l(h),disabled:r,children:o("agent.action.delete")})}):null}),c.jsxs("div",{className:it.viewerField,children:[c.jsx("div",{className:it.viewerSectionTitle,children:Bc(o("agent.toolsLabel"))}),c.jsx("div",{className:it.viewerBlock,children:x})]}),c.jsxs("div",{className:it.viewerField,children:[c.jsx("div",{className:it.viewerSectionTitle,children:Bc(o("agent.filePathLabel"))}),c.jsx("div",{className:it.viewerBlock,children:p.filePath||"—"})]}),p.model?c.jsxs("div",{className:it.viewerRow,children:[c.jsx("span",{className:it.viewerLabel,children:Bc(o("agent.modelLabel"))}),c.jsx("span",{children:p.model})]}):null,c.jsxs("div",{className:it.viewerField,children:[c.jsx("div",{className:it.viewerSectionTitle,children:Bc(o("agent.descriptionLabel"))}),c.jsx("div",{className:it.viewerBlock,children:p.description||"—"})]}),c.jsxs("div",{className:it.viewerField,children:[c.jsx("div",{className:it.viewerSectionTitle,children:Bc(o("agent.systemPromptLabel"))}),c.jsx("div",{className:it.viewerBlock,children:p.systemPrompt||"—"})]})]}):c.jsx("div",{className:it.loading,children:o("common.loading")})}):null]},`${d.level}:${d.name}`)})})}function xtt({step:e,method:t,scope:n,name:r,desc:s,prompt:i,tools:o,toolCategories:a,selIdx:l,busy:u,generating:d,inputFocused:h,onSetName:m,onSetDesc:p,onSetPrompt:g,onInputNext:b,onInputFocus:x,onInputBlur:v,onSetStep:y,onSetSelectedIndex:w,onSelectLocation:k,onSelectMethod:T,onSelectTools:S,onSave:C,t:_}){const A=f.useRef(null),M=f.useRef(null),L=f.useRef(null);f.useEffect(()=>{var Q,U,j,ie;h&&(t==="manual"?e===3?(Q=A.current)==null||Q.focus():e===4?(U=L.current)==null||U.focus():e===5&&((j=M.current)==null||j.focus()):e===3&&((ie=M.current)==null||ie.focus()))},[e,t,h]);const N=t==="manual"?6:4,O=N+1,B=t==="manual"?[_("agent.create.location"),_("agent.create.method"),_("agent.create.name"),_("agent.create.prompt"),_("agent.create.description"),_("agent.create.toolsSelection")]:[_("agent.create.location"),_("agent.create.method"),_("agent.create.describeAgent"),_("agent.create.toolsSelection")],$=Q=>Q===1?n==="workspace"?0:1:Q===2?t==="qwen"?0:1:Q===N?btt(a,o):0,P=Q=>{y(Q),w($(Q)),t==="manual"&&(Q===3||Q===4||Q===5)||t==="qwen"&&Q===3?x():v()},K=()=>{e<=1||d||P(e-1)},F=()=>{if(!d){if(e===1){P(2);return}if(e===2){P(3);return}if(t==="manual"&&e===3){b("name");return}if(t==="manual"&&e===4){b("prompt");return}if(t==="manual"&&e===5||t==="qwen"&&e===3){b("desc");return}e===N&&(S(l),P(O))}},H=d||t==="manual"&&e===3&&!r.trim()||t==="manual"&&e===4&&!i.trim()||t==="manual"&&e===5&&!s.trim()||t==="qwen"&&e===3&&!s.trim();let D=null;if(e===1&&(D=c.jsx(c.Fragment,{children:c.jsxs("div",{className:it.options,children:[c.jsx(gm,{idx:0,active:l===0,label:_("agent.create.project.cli"),numbered:!0,onClick:()=>k(0)}),c.jsx(gm,{idx:1,active:l===1,label:_("agent.create.user.cli"),numbered:!0,onClick:()=>k(1)})]})})),e===2&&(D=c.jsx(c.Fragment,{children:c.jsxs("div",{className:it.options,children:[c.jsx(gm,{idx:0,active:l===0,label:_("agent.create.method.qwen.recommended"),numbered:!0,onClick:()=>T(0)}),c.jsx(gm,{idx:1,active:l===1,label:_("agent.create.method.manual"),numbered:!0,onClick:()=>T(1)})]})})),t==="manual"&&e===3&&(D=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.text,children:_("agent.create.nameHelp")}),c.jsx("input",{ref:A,className:it.textInput,value:r,onChange:Q=>m(Q.target.value),onFocus:x,onBlur:v,placeholder:_("agent.create.namePlaceholder"),autoFocus:!0})]})),t==="manual"&&e===4&&(D=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.text,children:_("agent.create.promptHelp")}),c.jsx("textarea",{ref:L,className:it.textArea,value:i,onChange:Q=>g(Q.target.value),onFocus:x,onBlur:v,placeholder:_("agent.create.promptPlaceholder.cli"),autoFocus:!0})]})),t==="manual"&&e===5&&(D=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.text,children:_("agent.create.manualDescHelp")}),c.jsx("textarea",{ref:M,className:it.textArea,value:s,onChange:Q=>p(Q.target.value),onFocus:x,onBlur:v,placeholder:_("agent.create.manualDescPlaceholder"),autoFocus:!0})]})),t==="qwen"&&e===3&&(D=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.text,children:_("agent.create.qwenHint")}),d?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.text,children:_("agent.create.generatingConfig")}),c.jsx("div",{className:it.footer,children:_("agent.footer.generating")})]}):c.jsx(c.Fragment,{children:c.jsx("textarea",{ref:M,className:it.textArea,value:s,onChange:Q=>p(Q.target.value),onFocus:x,onBlur:v,placeholder:_("agent.create.qwenPlaceholder"),autoFocus:!0})})]})),e===N){const Q=a[l]??a[0],U=(Q==null?void 0:Q.tools)??[],j=(Q==null?void 0:Q.id)==="all"?_("agent.create.tools.allInfo"):U.length>0?U.join(", "):_("agent.create.tools.none"),ie=U.filter(tse),oe=U.filter(nse),J=U.filter(rse);D=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.options,children:a.map((V,se)=>c.jsx(gm,{idx:se,active:l===se,label:V.label,numbered:!0,onClick:()=>S(se)},V.id))}),c.jsx("div",{className:it.toolDetail,children:(Q==null?void 0:Q.id)==="all"?c.jsx("div",{className:it.toolDetailBody,children:j}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:it.toolDetailTitle,children:_("agent.create.tools.selected")}),c.jsx("div",{className:it.toolList,children:U.length===0?j:c.jsxs(c.Fragment,{children:[ie.length>0&&c.jsxs("div",{children:[_("agent.create.tools.readOnlyLabel")," ",ie.join(", ")]}),oe.length>0&&c.jsxs("div",{children:[_("agent.create.tools.editLabel")," ",oe.join(", ")]}),J.length>0&&c.jsxs("div",{children:[_("agent.create.tools.executionLabel")," ",J.join(", ")]})]})})]})})]})}if(e===O){const Q=o.length===0?"*":o.join(", ");D=c.jsx(c.Fragment,{children:c.jsxs("div",{className:it.summary,children:[c.jsxs("div",{className:it.summaryRow,children:[c.jsx("span",{className:it.summaryLabel,children:Bc(_("agent.create.name"))}),c.jsx("span",{className:it.summaryValue,children:r||"—"})]}),c.jsxs("div",{className:it.summaryRow,children:[c.jsx("span",{className:it.summaryLabel,children:Bc(_("agent.location"))}),c.jsx("span",{className:it.summaryValue,children:_(n==="workspace"?"agent.create.project.cli":"agent.create.user.cli")})]}),c.jsxs("div",{className:it.summaryRow,children:[c.jsx("span",{className:it.summaryLabel,children:Bc(_("agent.toolsLabel"))}),c.jsx("span",{className:it.summaryValue,children:Q})]}),c.jsx("div",{className:it.summaryBlockTitle,children:Bc(_("agent.descriptionLabel"))}),c.jsx("div",{className:it.summaryBlock,children:s||"—"}),c.jsx("div",{className:it.summaryBlockTitle,children:Bc(_("agent.systemPromptLabel"))}),c.jsx("div",{className:it.summaryBlock,children:i||"—"})]})})}return c.jsxs("div",{className:it.createWizard,children:[c.jsx("div",{className:it.createSteps,children:B.map((Q,U)=>{const j=U+1;return c.jsxs("div",{className:`${it.createStepPill} ${j===Math.min(e,N)?it.createStepPillActive:""} ${j<Math.min(e,N)?it.createStepPillDone:""}`,children:[c.jsx("span",{className:it.createStepNumber,children:j}),c.jsx("span",{className:it.createStepLabel,children:Q})]},`${j}:${Q}`)})}),c.jsx("div",{className:it.createBody,children:D}),c.jsxs("div",{className:it.createActions,children:[c.jsx("button",{type:"button",className:it.manageButton,onClick:K,disabled:e<=1||d||u,children:_("common.previous")}),e===O?c.jsx("button",{type:"button",className:it.manageButton,onClick:C,disabled:u,children:_(u?"agent.create.loading":"agent.create.save")}):c.jsx("button",{type:"button",className:it.manageButton,onClick:F,disabled:H,children:_("common.next")})]})]})}const wtt="_page_1np31_1",ktt="_tabs_1np31_11",_tt="_memoryCard_1np31_19",Stt="_memoryCardActive_1np31_35",Ctt="_memoryTitle_1np31_44",Ttt="_detailPath_1np31_48",Att="_status_1np31_49",Ett="_actionButton_1np31_54",Mtt="_primaryButton_1np31_55",Ntt="_secondaryButton_1np31_56",jtt="_detail_1np31_48",Itt="_detailHeader_1np31_79",Rtt="_detailTitleWrap_1np31_87",Dtt="_actions_1np31_91",Ltt="_content_1np31_105",Ptt="_editor_1np31_106",Ott="_editorFooter_1np31_127",Yi={page:wtt,tabs:ktt,memoryCard:_tt,memoryCardActive:Stt,memoryTitle:Ctt,detailPath:Ttt,status:Att,actionButton:Ett,primaryButton:Mtt,secondaryButton:Ntt,detail:jtt,detailHeader:Itt,detailTitleWrap:Rtt,actions:Dtt,content:Ltt,editor:Ptt,editorFooter:Ott};function fF(e,t){return e.find(n=>n.scope===t)}function mF(e,t){return t(e==="global"?"memory.global":"memory.project")}function Btt({refreshSignal:e=0,addSignal:t=0,addScope:n="workspace",onMessage:r}){var D,Q;const{t:s}=gt(),{files:i,loading:o,error:a,readFile:l,reload:u,writeMemory:d}=Ahe({autoLoad:!0}),h=f.useRef(null),m=f.useRef(0),[p,g]=f.useState("workspace"),[b,x]=f.useState("view"),[v,y]=f.useState(""),[w,k]=f.useState(""),[T,S]=f.useState(!1),[C,_]=f.useState(!1),[A,M]=f.useState(null),L=f.useRef(0),N=f.useMemo(()=>{const U=fF(i,"global"),j=fF(i,"workspace");return[{scope:"workspace",title:s("memory.project"),description:s("memory.project.desc"),fallbackPath:"QWEN.md",file:j},{scope:"global",title:s("memory.global"),description:s("memory.global.desc"),fallbackPath:"~/.qwen/QWEN.md",file:U}]},[i,s]),O=N.find(U=>U.scope===p)??N[0],B=f.useCallback((U,j)=>{const ie=++m.current;if(x(j),M(null),y(""),k(""),!(U!=null&&U.file)){j==="edit"&&requestAnimationFrame(()=>{var oe;return(oe=h.current)==null?void 0:oe.focus()});return}S(!0),l(U.file.path).then(oe=>{ie===m.current&&(y(oe.content),k(oe.content),oe.truncated&&M(s("memory.fileTruncated")),requestAnimationFrame(()=>{var J;return(J=h.current)==null?void 0:J.focus()}))}).catch(oe=>{if(ie!==m.current)return;const J=oe instanceof Error?oe.message:String(oe);M(J),U.scope!=="global"&&(r==null||r(J,"error"))}).finally(()=>{ie===m.current&&S(!1)})},[r,l,s]);f.useEffect(()=>{O&&B(O,b)},[(D=O==null?void 0:O.file)==null?void 0:D.path,O==null?void 0:O.scope]),f.useEffect(()=>{a&&M(a.message)},[a]),f.useEffect(()=>{e<=0||u().then(()=>M(s("memory.refreshed"))).catch(U=>{const j=U instanceof Error?U.message:String(U);M(j),r==null||r(j,"error")})},[r,e,u,s]),f.useEffect(()=>{if(t<=0||L.current===t)return;L.current=t;const U=n==="global"?"global":"workspace";g(U);const j=N.find(ie=>ie.scope===U);B(j,"edit")},[n,t,N,B]);const $=U=>{g(U.scope),B(U,"view")},P=()=>{O&&B(O,"edit")},K=()=>{if(O){if(!w.trim()){M(s("memory.contentEmpty"));return}_(!0),M(null),d({scope:O.scope,mode:"replace",content:w}).then(U=>{const j=s("memory.saved",{scope:mF(O.scope,s),bytes:U.bytesWritten,path:U.filePath});y(w),x("view"),M(j),r==null||r(j,"status"),u().catch(()=>{})}).catch(U=>{const j=U instanceof Error?U.message:String(U);M(j),r==null||r(j,"error")}).finally(()=>_(!1))}},F=((Q=O==null?void 0:O.file)==null?void 0:Q.path)??(O==null?void 0:O.fallbackPath)??"",H=A??(o?s("memory.loading"):null);return c.jsxs("div",{className:Yi.page,children:[c.jsx("nav",{className:Yi.tabs,"aria-label":s("memory.menu"),children:N.map(U=>{const j=U.scope===p;return c.jsx("button",{type:"button",className:`${Yi.memoryCard} ${j?Yi.memoryCardActive:""}`,onClick:()=>$(U),children:c.jsx("span",{className:Yi.memoryTitle,children:U.title})},U.scope)})}),c.jsxs("section",{className:Yi.detail,children:[c.jsxs("header",{className:Yi.detailHeader,children:[c.jsx("div",{className:Yi.detailTitleWrap,children:c.jsx("div",{className:Yi.detailPath,children:F})}),c.jsx("div",{className:Yi.actions,children:c.jsx("button",{type:"button",className:Yi.actionButton,onClick:P,children:s("settings.action.edit")})})]}),H&&c.jsx("div",{className:Yi.status,children:H}),b==="edit"?c.jsxs(c.Fragment,{children:[c.jsx("textarea",{ref:h,className:Yi.editor,value:w,disabled:C||T,onChange:U=>k(U.target.value),placeholder:s("memory.placeholder",{scope:O?mF(O.scope,s):""})}),c.jsxs("div",{className:Yi.editorFooter,children:[c.jsx("button",{type:"button",className:Yi.secondaryButton,disabled:C,onClick:()=>{k(v),x("view")},children:s("common.cancel")}),c.jsx("button",{type:"button",className:Yi.primaryButton,disabled:C||T,onClick:K,children:s(C?"memory.saving":"memory.save")})]})]}):c.jsx("pre",{className:Yi.content,children:T?s("memory.loadingFile"):v||s("memory.noFiles")})]})]})}const $tt="_panel_cxp6w_1",ztt="_steps_cxp6w_10",Ftt="_stepPill_cxp6w_18",qtt="_stepPillActive_cxp6w_29",Htt="_stepPillDone_cxp6w_34",Utt="_stepNumber_cxp6w_38",Vtt="_stepLabel_cxp6w_49",Wtt="_body_cxp6w_55",Gtt="_text_cxp6w_59",Ktt="_muted_cxp6w_64",Ytt="_options_cxp6w_68",Xtt="_option_cxp6w_68",Qtt="_optionActive_cxp6w_90",Jtt="_label_cxp6w_94",Ztt="_optionText_cxp6w_98",ent="_description_cxp6w_112",tnt="_input_cxp6w_119",nnt="_preview_cxp6w_135",rnt="_error_cxp6w_146",snt="_link_cxp6w_150",int="_terms_cxp6w_161",ont="_actions_cxp6w_169",ant="_actionButton_cxp6w_177",Kr={panel:$tt,steps:ztt,stepPill:Ftt,stepPillActive:qtt,stepPillDone:Htt,stepNumber:Utt,stepLabel:Vtt,body:Wtt,text:Gtt,muted:Ktt,options:Ytt,option:Xtt,optionActive:Qtt,label:Jtt,optionText:Ztt,description:ent,input:tnt,preview:nnt,error:rnt,link:snt,terms:int,actions:ont,actionButton:ant};function lnt(e){return[{value:"openai",label:e("auth.protocol.openai"),description:e("auth.protocol.openaiDesc")},{value:"anthropic",label:e("auth.protocol.anthropic"),description:e("auth.protocol.anthropicDesc")},{value:"gemini",label:e("auth.protocol.gemini"),description:e("auth.protocol.geminiDesc")}]}function ib(e){return e==="anthropic"?"https://api.anthropic.com/v1":e==="gemini"?"https://generativelanguage.googleapis.com":"https://api.openai.com/v1"}function pF(e){var t;return((t=e==null?void 0:e.models)==null?void 0:t.map(n=>n.id).join(", "))??""}function cnt(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 unt(e,t){const n=e.trim();return n?n.length<=6?"***":`${n.slice(0,3)}...${n.slice(-4)}`:t?t("auth.notSet"):"(not set)"}function dT(e){return[...new Set(e.split(",").map(t=>t.trim()).filter(t=>t.length>0))]}function dnt({onMessage:e,onClose:t}){const{t:n}=gt(),r=ko(),[s,i]=f.useState("groups"),[o,a]=f.useState(0),[l,u]=f.useState(0),[d,h]=f.useState("providers"),[m,p]=f.useState(0),[g,b]=f.useState(),[x,v]=f.useState("alibaba"),[y,w]=f.useState(null),[k,T]=f.useState("openai"),[S,C]=f.useState(""),[_,A]=f.useState(""),[M,L]=f.useState(""),[N,O]=f.useState(!1),[B,$]=f.useState(!1),[P,K]=f.useState(!0),[F,H]=f.useState(!0),[D,Q]=f.useState(!1),[U,j]=f.useState(!1),[ie,oe]=f.useState(""),[J,V]=f.useState(!0),[se,Z]=f.useState(!1),[X,te]=f.useState(null);f.useEffect(()=>{r.getAuthProviders().then(he=>{b(he),V(!1)}).catch(he=>{te(he instanceof Error?he.message:String(he)),V(!1)})},[r]);const ae=f.useMemo(()=>(g==null?void 0:g.groups)??[],[g]),xe=f.useMemo(()=>{var Be;return(((Be=ae.find(Ie=>Ie.id===x))==null?void 0:Be.providerIds)??[]).map(Ie=>g==null?void 0:g.providers.find(Ke=>Ke.id===Ie)).filter(Ie=>!!Ie)},[g,x,ae]),Ae=f.useMemo(()=>(y==null?void 0:y.steps)??[],[y==null?void 0:y.steps]),Ne=Ae[m],Le=(y==null?void 0:y.showAdvancedConfig)===!0,ge=f.useMemo(()=>B?["thinking","modality","image","video","audio","pdf","context"]:["thinking","modality","context"],[B]),Oe=ge.indexOf("context"),Nt=Ne==="apiKey"||Ne==="models"||Ne==="baseUrl"&&!Array.isArray(y==null?void 0:y.baseUrl),[Pe,Ce]=f.useState(0),Zt=f.useCallback((he,Be="providers")=>{var Ke,ne;w(he),h(Be);const Ie=((Ke=he.protocolOptions)==null?void 0:Ke[0])??he.protocol;T(Ie),typeof he.baseUrl=="string"?C(he.baseUrl):Array.isArray(he.baseUrl)?C(((ne=he.baseUrl[0])==null?void 0:ne.url)??""):C(ib(Ie)),A(""),L(pF(he)),O(!1),$(!1),K(!0),H(!0),Q(!1),j(!1),oe(""),p(0),Ce(0),te(null),i(he.steps.length>0?"step":"review")},[]),dt=f.useCallback(()=>{if(te(null),s==="groups"){t();return}if(s==="providers"){i("groups");return}if(s==="review"){if(Ae.length===0){i(d);return}i("step"),p(Math.max(0,Ae.length-1));return}if(m>0){p(he=>he-1),Ce(0);return}i(d)},[t,d,m,Ae.length,s]),Ge=f.useCallback(()=>{if(!y||se)return;Z(!0),te(null);const he=Number(ie);r.installAuthProvider({providerId:y.id,protocol:k,baseUrl:S,apiKey:_,modelIds:dT(M),advancedConfig:N||B||Number.isFinite(he)&&he>0?{...N?{enableThinking:!0}:{},...B?{multimodal:{...P?{image:!0}:{},...F?{video:!0}:{},...D?{audio:!0}:{},...U?{pdf:!0}:{}}}:{},...Number.isFinite(he)&&he>0?{contextWindowSize:he}:{}}:void 0}).then(Be=>{e(Be.message),t()}).catch(Be=>{const Ie=Be instanceof Error?Be.message:String(Be);te(Ie),e(Ie,"error")}).finally(()=>Z(!1))},[_,S,ie,B,D,P,U,F,M,t,e,k,y,se,N,r]),St=f.useCallback(()=>{if(y){if(Ne==="baseUrl"){const he=S.trim()||ib(k);if(!he){te(n("auth.baseUrlRequired"));return}if(!/^https?:\/\//i.test(he)){te(n("auth.baseUrlInvalid"));return}S.trim()||C(he)}if(Ne==="apiKey"&&_.trim().length===0){te(n("auth.apiKeyRequired"));return}if(Ne==="models"&&dT(M).length===0){te(n("auth.modelsRequired"));return}te(null),m>=Ae.length-1?Le?i("review"):Ge():(p(he=>he+1),Ce(0))}},[_,S,Ne,M,k,y,Ge,Le,m,Ae.length,n]),Y=f.useCallback(he=>{switch(he){case"thinking":O(Be=>!Be);return;case"modality":$(Be=>!Be);return;case"image":K(Be=>!Be);return;case"video":H(Be=>!Be);return;case"audio":Q(Be=>!Be);return;case"pdf":j(Be=>!Be);return;case"context":St();return;default:return}},[St]),je=f.useCallback(()=>{if(s==="groups"){const he=ae[o];if(!he)return;if(he.id==="custom"){const Be=he.providerIds.map(Ie=>g==null?void 0:g.providers.find(Ke=>Ke.id===Ie)).find(Ie=>!!Ie);Be&&Zt(Be,"groups");return}v(he.id),u(0),i("providers");return}if(s==="providers"){const he=xe[l];he&&Zt(he,"providers");return}if(s==="review"){Ge();return}if(!(!y||!Ne)){if(Ne==="protocol"){const he=(y.protocolOptions??[y.protocol])[Pe];he&&(T(he),y.baseUrl||C(ib(he))),St();return}if(Ne==="baseUrl"&&Array.isArray(y.baseUrl)){const he=y.baseUrl[Pe];he&&C(he.url),St();return}if(Ne==="advancedConfig"){Y(ge[Pe]);return}St()}},[Ne,g,St,o,ae,Pe,y,l,xe,Ge,Zt,s,Y,ge]),We=f.useCallback(he=>{if(s==="groups"){const Be=ae[he];if(!Be)return;if(Be.id==="custom"){const Ie=Be.providerIds.map(Ke=>g==null?void 0:g.providers.find(ne=>ne.id===Ke)).find(Ke=>!!Ke);Ie&&Zt(Ie,"groups");return}v(Be.id),u(0),i("providers");return}if(s==="providers"){const Be=xe[he];Be&&Zt(Be,"providers");return}if(!y||!Ne){s==="review"&&Ge();return}if(Ne==="protocol"){const Be=(y.protocolOptions??[y.protocol])[he];Be&&(T(Be),y.baseUrl||C(ib(Be))),St();return}if(Ne==="baseUrl"&&Array.isArray(y.baseUrl)){const Be=y.baseUrl[he];Be&&C(Be.url),St();return}Ne==="advancedConfig"&&Y(ge[he])},[Ne,g,St,ae,Y,ge,y,xe,Ge,Zt,s]),Te=(he,Be,Ie)=>c.jsx("div",{className:Kr.options,children:he.map((Ke,ne)=>c.jsx("button",{type:"button",className:`${Kr.option} ${Be===ne?Kr.optionActive:""}`,onClick:()=>{Ie(ne),We(ne)},children:c.jsxs("div",{className:Kr.optionText,children:[c.jsx("div",{className:Kr.label,children:Ke.label}),Ke.description&&c.jsx("div",{className:Kr.description,children:Ke.description})]})},Ke.value))}),jt=()=>{if(!y||!Ne)return null;if(Ne==="protocol"){const Ie=y.protocolOptions??[y.protocol];return Te(lnt(n).filter(Ke=>Ie.includes(Ke.value)),Pe,Ce)}if(Ne==="baseUrl")return Array.isArray(y.baseUrl)?Te(y.baseUrl.map(Ie=>({value:Ie.url,label:Ie.label,description:Ie.url})),Pe,Ce):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Kr.text,children:n("auth.baseUrlPrompt")}),c.jsx("input",{className:Kr.input,value:S,placeholder:ib(k),onChange:Ie=>{C(Ie.target.value),te(null)},onKeyDown:Ie=>{Ie.key==="Enter"&&(Ie.preventDefault(),Ie.stopPropagation(),St())},autoFocus:!0}),y.documentationUrl&&c.jsx("a",{className:Kr.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:n("auth.documentation")})]});if(Ne==="apiKey")return c.jsxs(c.Fragment,{children:[y.documentationUrl&&c.jsxs("a",{className:Kr.link,href:y.documentationUrl,target:"_blank",rel:"noreferrer",children:[n("auth.documentation"),": ",y.documentationUrl]}),c.jsx("input",{className:Kr.input,type:"password",value:_,placeholder:y.apiKeyPlaceholder??n("auth.apiKeyPlaceholder"),onChange:Ie=>{A(Ie.target.value),te(null)},onKeyDown:Ie=>{Ie.key==="Enter"&&(Ie.preventDefault(),Ie.stopPropagation(),St())},autoFocus:!0})]});if(Ne==="models"){const Ie=pF(y);return c.jsxs(c.Fragment,{children:[Ie&&c.jsx("div",{className:Kr.muted,children:n("auth.modelsPrompt",{modelIds:Ie})}),c.jsx("input",{className:Kr.input,value:M,placeholder:Ie||n("auth.modelsPlaceholder"),onChange:Ke=>{L(Ke.target.value),te(null)},onKeyDown:Ke=>{Ke.key==="Enter"&&(Ke.preventDefault(),Ke.stopPropagation(),St())},autoFocus:!0})]})}const he=Ie=>Ie?"◉":"○",Be=[{value:"thinking",label:`${he(N)} ${n("auth.advanced.thinking")}`,description:n("auth.advanced.thinkingDesc")},{value:"modality",label:`${he(B)} ${n("auth.advanced.modality")}`,description:n("auth.advanced.modalityDesc")}];return B&&Be.push({value:"image",label:`${he(P)} ${n("auth.advanced.modalityImage")}`},{value:"video",label:`${he(F)} ${n("auth.advanced.modalityVideo")}`},{value:"audio",label:`${he(D)} ${n("auth.advanced.modalityAudio")}`},{value:"pdf",label:`${he(U)} ${n("auth.advanced.modalityPdf")}`}),Be.push({value:"context",label:`${n("auth.advanced.contextWindow")}: ${ie||"auto"}`,description:n("auth.advanced.contextDesc")}),c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Kr.text,children:n("auth.advanced.prompt")}),Te(Be,Pe,Ce),c.jsx("input",{className:Kr.input,value:ie,placeholder:n("common.auto"),onChange:Ie=>oe(Ie.target.value.replace(/[^0-9]/g,"")),onFocus:()=>Ce(Oe),onKeyDown:Ie=>{Ie.key==="Enter"&&(Ie.preventDefault(),Ie.stopPropagation(),St())}})]})},zt=f.useMemo(()=>{if(!y)return"";const he=y.envKey??`${k.toUpperCase()}_API_KEY`,Be=dT(M),Ie={};if(N&&(Ie.extra_body={enable_thinking:!0}),B){const De={};P&&(De.image=!0),F&&(De.video=!0),D&&(De.audio=!0),U&&(De.pdf=!0),Object.keys(De).length>0&&(Ie.modalities=De)}const Ke=Number(ie);Number.isFinite(Ke)&&Ke>0&&(Ie.contextWindowSize=Ke);const ne=Object.keys(Ie).length>0;return JSON.stringify({env:{[he]:unt(_,n)},modelProviders:{[k]:Be.map(De=>({id:De,name:De,baseUrl:S.trim(),envKey:he,...ne?{generationConfig:Ie}:{}}))},security:{auth:{selectedType:k}},model:{name:Be[0]}},null,2)},[_,S,ie,B,D,P,U,F,M,k,y,n,N]),bn=f.useMemo(()=>{const he=[n("auth.step.group"),n("auth.step.provider")];return y&&(he.push(...Ae.map(Be=>cnt(Be,y,n))),Le&&he.push(n("auth.review"))),he},[y,Le,Ae,n]),Pn=f.useMemo(()=>s==="groups"?1:s==="providers"?2:s==="step"?Math.min(3+m,bn.length):bn.length,[m,bn.length,s]),qe=J?c.jsx("div",{className:Kr.muted,children:n("common.loading")}):s==="groups"?c.jsxs(c.Fragment,{children:[Te(ae.map(he=>({value:he.id,label:n(he.label),description:n(he.description)})),o,a),c.jsxs("div",{className:Kr.terms,children:[c.jsxs("div",{children:[n("auth.termsTitle"),":"]}),c.jsx("a",{className:Kr.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"?Te(xe.map(he=>({value:he.id,label:n(he.label),description:n(he.description)})),l,u):s==="step"?jt():c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Kr.text,children:n("auth.reviewText")}),c.jsx("div",{className:Kr.preview,children:zt})]}),At=()=>{if(s==="review"){Ge();return}if(Nt||Ne==="advancedConfig"){St();return}je()};return c.jsxs("div",{className:Kr.panel,children:[c.jsx("div",{className:Kr.steps,children:bn.map((he,Be)=>{const Ie=Be+1;return c.jsxs("div",{className:`${Kr.stepPill} ${Ie===Pn?Kr.stepPillActive:""} ${Ie<Pn?Kr.stepPillDone:""}`,children:[c.jsx("span",{className:Kr.stepNumber,children:Ie}),c.jsx("span",{className:Kr.stepLabel,children:he})]},`${Ie}:${he}`)})}),c.jsx("div",{className:Kr.body,children:qe}),X&&c.jsx("div",{className:Kr.error,children:X}),c.jsxs("div",{className:Kr.actions,children:[c.jsx("button",{type:"button",className:Kr.actionButton,onClick:dt,disabled:s==="groups"||J||se,children:n("common.previous")}),c.jsx("button",{type:"button",className:Kr.actionButton,onClick:At,disabled:J||se,children:n(s==="review"?se?"auth.saving":"auth.save":"common.next")})]})]})}function hnt(e){return e.displayName||e.name}const sse="tools-list",gF=e=>`${sse}-opt-${e}`;function fnt(){const{t:e}=gt(),{status:t,tools:n,loading:r,error:s}=bW({autoLoad:!0}),[i,o]=f.useState(0),[a,l]=f.useState(null),[u,d]=f.useState(()=>new Set),h=f.useRef(null);f.useEffect(()=>{var b,x;s?l(s.message):(x=(b=t==null?void 0:t.errors)==null?void 0:b[0])!=null&&x.error?l(t.errors[0].error):t&&l(null)},[t,s]);const m=f.useCallback(b=>{d(x=>x.has(b.name)?new Set:new Set([b.name]))},[]);f.useEffect(()=>{i>=n.length&&n.length>0&&o(n.length-1)},[i,n.length]),f.useEffect(()=>{var x;const b=(x=h.current)==null?void 0:x.children[i];b==null||b.scrollIntoView({block:"nearest"})},[i]);const{keyboardMode:p}=Nf({itemCount:n.length,activeIndex:i,onActiveIndexChange:o,onConfirm:b=>{const x=n[b];x!=null&&x.description&&m(x)}}),g=f.useMemo(()=>{if(!t)return"";const b=n.filter(x=>x.enabled).length;return e("tools.summary",{enabled:b,total:n.length})},[t,n,e]);return c.jsxs("div",{className:Qt("picker","picker-in-shell"),children:[g&&c.jsx("div",{className:Qt("picker-search"),children:c.jsx("span",{className:Qt("picker-search-hint"),children:g})}),(a||r)&&c.jsx("div",{className:Qt("picker-search"),children:c.jsx("span",{className:Qt("picker-search-hint"),children:a||e("tools.loading")})}),c.jsx("div",{className:Qt("picker-sep")}),c.jsxs("div",{id:sse,role:"listbox","aria-label":e("tools.title"),tabIndex:0,"aria-activedescendant":n.length>0?gF(i):void 0,className:Qt("picker-list",p?"picker-keyboard-only":void 0),ref:h,children:[!r&&n.length===0&&c.jsx("div",{className:Qt("picker-empty"),children:e("tools.empty")}),n.map((b,x)=>{const v=u.has(b.name),y=b.description??"";return c.jsxs("div",{id:gF(x),role:"option","aria-selected":!1,"aria-expanded":y?v:void 0,className:Qt("picker-item","picker-session-item","tools-picker-item",x===i?"selected":void 0,v?"tools-picker-item-expanded":void 0),onClick:()=>{o(x),b.description&&m(b)},onMouseMove:()=>o(x),children:[c.jsxs("div",{className:Qt("picker-item-row"),children:[c.jsx("span",{className:Qt("tools-item-icon"),"aria-hidden":"true"}),c.jsx("span",{className:Qt("picker-item-title"),children:hnt(b)}),c.jsx("span",{className:Qt("tools-status-badge",b.enabled?"tools-status-badge-enabled":"tools-status-badge-disabled"),children:b.enabled?e("tools.status.enabled"):e("tools.status.disabled")}),y?c.jsx("svg",{className:Qt("tools-item-chevron",v?"tools-item-chevron-expanded":void 0),viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),v&&y&&c.jsx("div",{className:Qt("tools-desc-expanded"),children:c.jsx("div",{className:Qt("tools-desc-body"),children:y})})]},b.name)})]})]})}const mnt="_chart_1xbk4_1",pnt="_plot_1xbk4_8",gnt="_svg_1xbk4_13",bnt="_cursor_1xbk4_30",ynt="_tooltip_1xbk4_40",vnt="_tooltipBelow_1xbk4_62",xnt="_tooltipTime_1xbk4_67",wnt="_tooltipRow_1xbk4_73",knt="_tooltipLabel_1xbk4_79",_nt="_tooltipValue_1xbk4_83",Snt="_axis_1xbk4_91",Cnt="_legend_1xbk4_96",Tnt="_legendItem_1xbk4_105",Ant="_swatch_1xbk4_112",Ent="_legendLabel_1xbk4_118",Mnt="_legendValue_1xbk4_123",Nnt="_peak_1xbk4_131",Li={chart:mnt,plot:pnt,svg:gnt,cursor:bnt,tooltip:ynt,tooltipBelow:vnt,tooltipTime:xnt,tooltipRow:wnt,tooltipLabel:knt,tooltipValue:_nt,axis:Snt,legend:Cnt,legendItem:Tnt,swatch:Ant,legendLabel:Ent,legendValue:Mnt,peak:Nnt},hE=320,Mb=64,ia=3,tk=hE-ia*2,nk=Mb-ia*2;function bF(e,t){return Number.isFinite(e)?e:t}const jnt=84;function Int(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll")return t;t=t.parentElement}return null}function Rnt(e){return new Date(e).toLocaleTimeString()}function ise({series:e,timestamps:t,format:n=a=>String(Math.round(a)),formatTime:r=Rnt,zeroBased:s=!0,ariaLabel:i,peakLabel:o="peak"}){const a=f.useRef(null),[l,u]=f.useState(null),[d,h]=f.useState(!1),m=f.useRef(void 0),{paths:p,maxV:g,maxLen:b,min:x,span:v}=f.useMemo(()=>{const M=e.reduce((K,F)=>Math.max(K,F.values.length),0);let L=0,N=s?0:Number.POSITIVE_INFINITY;for(const K of e)for(const F of K.values)Number.isFinite(F)&&(F>L&&(L=F),F<N&&(N=F));Number.isFinite(N)||(N=0);const O=L-N||1,B=K=>M<=1?ia+tk/2:ia+K/(M-1)*tk,$=K=>ia+nk-(bF(K,N)-N)/O*nk;return{paths:e.map(K=>{const F=K.values.map((Q,U)=>`${U===0?"M":"L"}${B(U).toFixed(1)},${$(Q).toFixed(1)}`).join(" "),H=K.values.length-1,D=H>=0?{cx:B(H),cy:$(K.values[H]),color:K.color}:void 0;return{key:K.label,d:F,color:K.color,dot:D}}),maxV:L,maxLen:M,min:N,span:O}},[e,s]),y=b>0,w=M=>b<=1?ia+tk/2:ia+M/(b-1)*tk,k=M=>ia+nk-(bF(M,x)-x)/v*nk,T=M=>{const L=a.current;if(!L||b===0)return;const N=L.getBoundingClientRect();if(N.width===0)return;const O=(M.clientX-N.left)/N.width,B=Math.max(0,Math.min(b-1,Math.round(O*(b-1))));u(B),m.current===void 0&&(m.current=Int(L));const $=m.current,P=$?$.getBoundingClientRect().top:0;h(N.top-P<jnt)},S=()=>u(null),C=l!=null&&l>=0&&l<b?l:null,_=C!=null?w(C):0,A=C!=null&&b>1?C/(b-1)*100:50;return c.jsxs("div",{className:Li.chart,children:[c.jsxs("div",{className:Li.plot,children:[c.jsxs("svg",{ref:a,viewBox:`0 0 ${hE} ${Mb}`,preserveAspectRatio:"none",role:"img","aria-label":i,className:Li.svg,onPointerMove:T,onPointerLeave:S,children:[c.jsx("line",{x1:ia,y1:Mb-ia,x2:hE-ia,y2:Mb-ia,className:Li.axis,vectorEffect:"non-scaling-stroke"}),p.map(M=>c.jsx("path",{d:M.d,fill:"none",stroke:M.color,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",vectorEffect:"non-scaling-stroke"},M.key)),C!=null&&c.jsxs(c.Fragment,{children:[c.jsx("line",{x1:_,y1:ia,x2:_,y2:Mb-ia,className:Li.cursor,vectorEffect:"non-scaling-stroke"}),e.map(M=>C<M.values.length?c.jsx("circle",{cx:_,cy:k(M.values[C]),r:2.5,fill:M.color,vectorEffect:"non-scaling-stroke"},`${M.label}-hover`):null)]}),C==null&&p.map(M=>M.dot?c.jsx("circle",{cx:M.dot.cx,cy:M.dot.cy,r:2,fill:M.dot.color,vectorEffect:"non-scaling-stroke"},`${M.key}-dot`):null)]}),C!=null&&c.jsxs("div",{className:`${Li.tooltip} ${d?Li.tooltipBelow:""}`,style:{left:`${A}%`},role:"tooltip",children:[t&&t[C]!=null&&c.jsx("div",{className:Li.tooltipTime,children:r(t[C])}),e.map(M=>C<M.values.length?c.jsxs("div",{className:Li.tooltipRow,children:[c.jsx("svg",{className:Li.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:c.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:M.color})}),c.jsx("span",{className:Li.tooltipLabel,children:M.label}),c.jsx("span",{className:Li.tooltipValue,children:n(M.values[C])})]},M.label):null)]})]}),c.jsxs("div",{className:Li.legend,children:[e.map(M=>{const L=M.values.length?M.values[M.values.length-1]:void 0;return c.jsxs("span",{className:Li.legendItem,children:[c.jsx("svg",{className:Li.swatch,viewBox:"0 0 8 8","aria-hidden":"true",children:c.jsx("rect",{width:"8",height:"8",rx:"1.5",fill:M.color})}),c.jsx("span",{className:Li.legendLabel,children:M.label}),L!==void 0&&c.jsx("span",{className:Li.legendValue,children:n(L)})]},M.label)}),y&&c.jsx("span",{className:Li.peak,children:`${o} ${n(g)}`})]})]})}const Dnt="_wrap_1icv6_1",Lnt="_tooltip_1icv6_11",Pnt="_legend_1icv6_27",Ont="_legendLabel_1icv6_35",Bnt="_scroll_1icv6_39",$nt="_grid_1icv6_44",znt="_month_1icv6_51",Fnt="_weekday_1icv6_59",qnt="_cell_1icv6_69",Hnt="_legendCell_1icv6_75",Unt="_lvl0_1icv6_82",Vnt="_lvl1_1icv6_85",Wnt="_lvl2_1icv6_88",Gnt="_lvl3_1icv6_91",Knt="_lvl4_1icv6_94",Ynt="_today_1icv6_98",Io={wrap:Dnt,tooltip:Lnt,legend:Pnt,legendLabel:Ont,scroll:Bnt,grid:$nt,month:znt,weekday:Fnt,cell:qnt,legendCell:Hnt,lvl0:Unt,lvl1:Vnt,lvl2:Wnt,lvl3:Gnt,lvl4:Knt,today:Ynt},hT=864e5,Xnt=4;function fT(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function yF(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function Qnt(e){const t=e.filter(r=>r>0).sort((r,s)=>r-s);if(t.length===0)return[0,0,0];const n=r=>t[Math.min(t.length-1,Math.floor(r*(t.length-1)))];return[n(.25),n(.5),n(.75)]}function Jnt(e,[t,n,r]){return e<=0?0:e<=t?1:e<=n?2:e<=r?3:Xnt}function Znt(e,t,n){const r=Math.max(1,Math.floor(t)),s=fT(Date.now()),i=fT(s.getTime()-(r-1)*hT),o=(i.getDay()+6)%7,a=fT(i.getTime()-o*hT),l=Math.round((s.getTime()-a.getTime())/hT)+1,u=[],d=[],h=yF(s),m=new Date(a.getTime());for(let w=0;w<l;w++){const k=yF(m),T=e[k],S=(T==null?void 0:T.tokens)??0;d.push(S),u.push({dateKey:k,tokens:S,cacheReadRate:(T==null?void 0:T.cacheReadRate)??0,isToday:k===h,weekday:w%7,week:Math.floor(w/7)}),m.setDate(m.getDate()+1)}const p=Qnt(d),g=u.map(w=>({...w,level:Jnt(w.tokens,p)})),b=Math.ceil(l/7),x=[];let v=-1;const y=new Date(a.getTime());for(let w=0;w<b;w++){const k=y.getMonth();k!==v&&(x.push({week:w,text:y.toLocaleDateString(n,{month:"short"})}),v=k),y.setDate(y.getDate()+7)}return{cells:g,months:x,weeks:b}}function ert({heatmap:e,days:t}){const{t:n,language:r}=gt(),s=f.useMemo(()=>Znt(e,t,r),[e,t,r]),i=f.useRef(null),[o,a]=f.useState(null),l={0:n("daemon.usage.dowMon"),2:n("daemon.usage.dowWed"),4:n("daemon.usage.dowFri")},u=d=>{const h=d.target.closest("[data-date]"),m=i.current;if(!h||!m)return;const p=h.dataset.date??"",g=Number(h.dataset.tokens??"0"),b=Number(h.dataset.cache??"0"),x=h.getBoundingClientRect(),v=m.getBoundingClientRect();a({left:x.left-v.left+x.width/2,top:x.top-v.top,text:n("daemon.usage.cellTokens",{date:p,tokens:A0(g),cache:Math.round(b*100)})})};return c.jsxs("div",{className:Io.wrap,ref:i,children:[c.jsxs("div",{className:Io.legend,children:[c.jsx("span",{className:Io.legendLabel,children:n("daemon.usage.low")}),[0,1,2,3,4].map(d=>c.jsx("span",{className:`${Io.cell} ${Io.legendCell} ${Io[`lvl${d}`]}`},d)),c.jsx("span",{className:Io.legendLabel,children:n("daemon.usage.high")})]}),c.jsx("div",{className:Io.scroll,onMouseOver:u,onMouseLeave:()=>a(null),children:c.jsxs("div",{className:Io.grid,role:"img","aria-label":n("daemon.usage.heatmapTitle"),style:{gridTemplateColumns:`auto repeat(${s.weeks}, var(--hm-cell))`},children:[s.months.map(d=>c.jsx("div",{className:Io.month,style:{gridColumn:d.week+2,gridRow:1},children:d.text},`m-${d.week}`)),[0,2,4].map(d=>c.jsx("div",{className:Io.weekday,style:{gridColumn:1,gridRow:d+2},children:l[d]},`wd-${d}`)),s.cells.map(d=>c.jsx("div",{className:`${Io.cell} ${Io[`lvl${d.level}`]} ${d.isToday?Io.today:""}`,style:{gridColumn:d.week+2,gridRow:d.weekday+2},"data-date":d.dateKey,"data-tokens":d.tokens,"data-cache":d.cacheReadRate},d.dateKey))]})}),o&&c.jsx("div",{className:Io.tooltip,style:{left:o.left,top:o.top},role:"status",children:o.text})]})}const trt="_usage_1kfmt_1",nrt="_toolbar_1kfmt_9",rrt="_segmented_1kfmt_14",srt="_segment_1kfmt_14",irt="_segmentActive_1kfmt_41",ort="_hero_1kfmt_48",art="_heroMain_1kfmt_59",lrt="_heroLabel_1kfmt_63",crt="_heroNumber_1kfmt_71",urt="_heroSub_1kfmt_82",drt="_refresh_1kfmt_87",hrt="_stats_1kfmt_109",frt="_stat_1kfmt_109",mrt="_statValue_1kfmt_121",prt="_statLabel_1kfmt_130",grt="_section_1kfmt_139",brt="_sectionTitle_1kfmt_145",yrt="_sectionSub_1kfmt_154",vrt="_breakdown_1kfmt_161",xrt="_metric_1kfmt_167",wrt="_metricHead_1kfmt_173",krt="_tick_1kfmt_179",_rt="_tick_input_1kfmt_186",Srt="_tick_output_1kfmt_190",Crt="_tick_cache_1kfmt_198",Trt="_metricLabel_1kfmt_202",Art="_metricValue_1kfmt_209",Ert="_metricHint_1kfmt_219",Mrt="_state_1kfmt_225",Nrt="_modelList_1kfmt_233",jrt="_modelRow_1kfmt_239",Irt="_modelHead_1kfmt_245",Rrt="_modelRank_1kfmt_251",Drt="_modelMeta_1kfmt_262",Lrt="_modelName_1kfmt_267",Prt="_modelSub_1kfmt_277",Ort="_modelShare_1kfmt_282",Brt="_modelTrack_1kfmt_289",$rt="_modelFill_1kfmt_296",zrt="_modelFillCache_1kfmt_303",Frt="_skillTable_1kfmt_310",qrt="_right_1kfmt_334",Hrt="_bars_1kfmt_339",Urt="_barsBody_1kfmt_345",Vrt="_barCol_1kfmt_352",Wrt="_bar_1kfmt_339",Grt="_barsCaption_1kfmt_371",gn={usage:trt,toolbar:nrt,segmented:rrt,segment:srt,segmentActive:irt,hero:ort,heroMain:art,heroLabel:lrt,heroNumber:crt,heroSub:urt,refresh:drt,stats:hrt,stat:frt,statValue:mrt,statLabel:prt,section:grt,sectionTitle:brt,sectionSub:yrt,breakdown:vrt,metric:xrt,metricHead:wrt,tick:krt,tick_input:_rt,tick_output:Srt,tick_cache:Crt,metricLabel:Trt,metricValue:Art,metricHint:Ert,state:Mrt,modelList:Nrt,modelRow:jrt,modelHead:Irt,modelRank:Rrt,modelMeta:Drt,modelName:Lrt,modelSub:Prt,modelShare:Ort,modelTrack:Brt,modelFill:$rt,modelFillCache:zrt,skillTable:Frt,right:qrt,bars:Hrt,barsBody:Urt,barCol:Vrt,bar:Wrt,barsCaption:Grt},ose=12,Krt=Math.round(ose*30.44),Yrt=["today","week","month"],Xrt={today:"daemon.usage.today",week:"daemon.usage.period7d",month:"daemon.usage.period30d"},Qrt={today:"daemon.usage.today",week:"daemon.usage.rangeWeek",month:"daemon.usage.rangeMonth"},Jrt={today:"daemon.usage.rangeWordToday",week:"daemon.usage.rangeWordWeek",month:"daemon.usage.rangeWordMonth"},vF=["#3b82f6","#14b8a6","#f59e0b","#ef4444","#8b5cf6","#22c55e","#06b6d4","#ec4899"];function Zrt(e){return new Date(`${e}T00:00:00`).getTime()}function mT(e,t){return new Date(`${e}T00:00:00`).toLocaleDateString(t,{month:"short",day:"numeric"})}function est(e,t){return new Date(e).toLocaleDateString(t,{month:"short",day:"numeric"})}function rk({label:e,value:t}){return c.jsxs("div",{className:gn.stat,children:[c.jsx("div",{className:gn.statValue,children:t.toLocaleString()}),c.jsx("div",{className:gn.statLabel,children:e})]})}function pT({accent:e,value:t,label:n,hint:r}){return c.jsxs("div",{className:gn.metric,children:[c.jsxs("div",{className:gn.metricHead,children:[c.jsx("span",{className:`${gn.tick} ${gn[`tick_${e}`]}`}),c.jsx("span",{className:gn.metricLabel,children:n})]}),c.jsx("div",{className:gn.metricValue,children:t}),c.jsx("div",{className:gn.metricHint,children:r})]})}function tst({rank:e,model:t,color:n}){const{t:r}=gt(),s=Math.max(0,Math.min(100,t.share*100)),i=Math.max(0,Math.min(100,t.cacheReadRate*100));return c.jsxs("div",{className:gn.modelRow,children:[c.jsxs("div",{className:gn.modelHead,children:[c.jsx("span",{className:gn.modelRank,style:{color:n},children:String(e).padStart(2,"0")}),c.jsxs("div",{className:gn.modelMeta,children:[c.jsx("div",{className:gn.modelName,children:t.model}),c.jsx("div",{className:gn.modelSub,children:r("daemon.usage.modelMeta",{tokens:A0(t.totalTokens),cache:Math.round(i)})})]}),c.jsxs("span",{className:gn.modelShare,style:{color:n},children:[Math.round(s),"%"]})]}),c.jsx("div",{className:gn.modelTrack,children:c.jsx("div",{className:gn.modelFill,style:{width:`${s}%`,background:n},children:c.jsx("div",{className:gn.modelFillCache,style:{width:`${i}%`}})})})]})}function nst({points:e,format:t,locale:n}){const r=Math.max(1,...e.map(s=>s.value));return c.jsxs("div",{className:gn.bars,children:[c.jsx("div",{className:gn.barsBody,children:e.map((s,i)=>c.jsx("div",{className:gn.barCol,title:`${mT(s.label,n)} · ${t(s.value)}`,children:c.jsx("div",{className:gn.bar,style:{height:`${s.value/r*100}%`}})},`${s.label}-${i}`))}),e.length>1&&c.jsxs("div",{className:gn.barsCaption,children:[c.jsx("span",{children:mT(e[0].label,n)}),c.jsx("span",{children:mT(e[e.length-1].label,n)})]})]})}function rst(){const{t:e,language:t}=gt(),[n,r]=f.useState("today"),{dashboard:s,loading:i,error:o,reload:a}=Ehe({range:n,heatmapDays:Krt,autoLoad:!0}),l=c.jsx("div",{className:gn.segmented,role:"group","aria-label":e("daemon.usage.rangeGroup"),children:Yrt.map(y=>c.jsx("button",{type:"button",className:`${gn.segment} ${y===n?gn.segmentActive:""}`,"aria-pressed":y===n,onClick:()=>r(y),children:e(Xrt[y])},y))});if(!s)return c.jsxs("div",{className:gn.usage,children:[c.jsx("div",{className:gn.toolbar,children:l}),i?c.jsx("div",{className:gn.state,children:e("daemon.usage.loading")}):o?c.jsxs("div",{className:gn.state,children:[e("daemon.usage.failed"),": ",o.message]}):c.jsx("div",{className:gn.state,children:e("daemon.usage.empty")})]});const{summary:u,models:d,skills:h,daily:m,heatmap:p,heatmapDays:g}=s,b=u.linesAdded+u.linesRemoved,x=u.totalTokens>0||Object.keys(p).length>0,v=e(Jrt[s.range]);return c.jsxs("div",{className:gn.usage,"aria-busy":i,children:[c.jsx("div",{className:gn.toolbar,children:l}),c.jsxs("header",{className:gn.hero,children:[c.jsxs("div",{className:gn.heroMain,children:[c.jsx("div",{className:gn.heroLabel,children:e(Qrt[s.range])}),c.jsx("div",{className:gn.heroNumber,children:A0(u.totalTokens)}),c.jsx("div",{className:gn.heroSub,children:e("daemon.usage.tokensConsumed")})]}),c.jsx("button",{type:"button",className:gn.refresh,onClick:()=>void a(),disabled:i,children:e("daemon.refresh")})]}),c.jsxs("div",{className:gn.stats,children:[c.jsx(rk,{label:e("daemon.usage.sessions"),value:u.sessions}),c.jsx(rk,{label:e("daemon.usage.requests"),value:u.requests}),c.jsx(rk,{label:e("daemon.usage.tools"),value:u.toolCalls}),c.jsx(rk,{label:e("daemon.usage.changes"),value:b})]}),c.jsxs("section",{className:gn.section,children:[c.jsx("h4",{className:gn.sectionTitle,children:e("daemon.usage.breakdownTitle")}),c.jsxs("div",{className:gn.breakdown,children:[c.jsx(pT,{accent:"input",value:A0(u.inputTokens),label:e("daemon.usage.inputTokens"),hint:e("daemon.usage.inputHint")}),c.jsx(pT,{accent:"output",value:A0(u.outputTokens+u.thoughtsTokens),label:e("daemon.usage.outputTokens"),hint:e("daemon.usage.outputHint")}),c.jsx(pT,{accent:"cache",value:`${Math.round(u.cacheReadRate*100)}%`,label:e("daemon.usage.cacheRead"),hint:e("daemon.usage.cacheHint")})]})]}),c.jsxs("section",{className:gn.section,children:[c.jsx("h4",{className:gn.sectionTitle,children:e("daemon.usage.heatmapTitle")}),c.jsx("div",{className:gn.sectionSub,children:e("daemon.usage.heatmapSub",{months:ose})}),x?c.jsx(ert,{heatmap:p,days:g}):c.jsx("div",{className:gn.state,children:e("daemon.usage.empty")})]}),d.length>0&&c.jsxs("section",{className:gn.section,children:[c.jsxs("h4",{className:gn.sectionTitle,children:[v," ",e("daemon.usage.modelShareTitle")]}),c.jsx("div",{className:gn.sectionSub,children:e("daemon.usage.modelShareSub")}),c.jsx("div",{className:gn.modelList,children:d.map((y,w)=>c.jsx(tst,{rank:w+1,model:y,color:vF[w%vF.length]},y.model))})]}),h.length>0&&c.jsxs("section",{className:gn.section,children:[c.jsxs("h4",{className:gn.sectionTitle,children:[v," ",e("daemon.usage.skillTitle")]}),c.jsx("div",{className:gn.sectionSub,children:e("daemon.usage.skillSub")}),c.jsxs("table",{className:gn.skillTable,children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("daemon.usage.skillName")}),c.jsx("th",{className:gn.right,children:e("daemon.usage.skillCount")})]})}),c.jsx("tbody",{children:h.map(y=>c.jsxs("tr",{children:[c.jsx("td",{children:y.name}),c.jsx("td",{className:gn.right,children:y.count.toLocaleString()})]},y.name))})]})]}),m.length>1&&c.jsxs("section",{className:gn.section,children:[c.jsxs("h4",{className:gn.sectionTitle,children:[v," ",e("daemon.usage.dailyTokensTitle")]}),c.jsx("div",{className:gn.sectionSub,children:e("daemon.usage.dailyTokensSub")}),c.jsx(ise,{series:[{label:e("daemon.usage.tokensConsumed"),values:m.map(y=>y.tokens),color:"var(--agent-blue-400)"}],timestamps:m.map(y=>Zrt(y.date)),format:A0,formatTime:y=>est(y,t),ariaLabel:e("daemon.usage.dailyTokensTitle"),peakLabel:e("daemon.charts.peak")})]}),m.length>1&&c.jsxs("section",{className:gn.section,children:[c.jsxs("h4",{className:gn.sectionTitle,children:[v," ",e("daemon.usage.dailySessionsTitle")]}),c.jsx("div",{className:gn.sectionSub,children:e("daemon.usage.dailySessionsSub")}),c.jsx(nst,{points:m.map(y=>({label:y.date,value:y.sessions})),format:y=>y.toLocaleString(),locale:t})]})]})}const sst="_dialog_lw868_4",ist="_toolbar_lw868_12",ost="_toolbarActions_lw868_19",ast="_updatedAt_lw868_26",lst="_refreshError_lw868_31",cst="_refreshButton_lw868_36",ust="_badge_lw868_51",dst="_levelOk_lw868_61",hst="_levelWarning_lw868_66",fst="_levelError_lw868_71",mst="_levelUnavailable_lw868_76",pst="_tabs_lw868_81",gst="_tab_lw868_81",bst="_tabActive_lw868_106",yst="_grid_lw868_114",vst="_chartsGrid_lw868_113",xst="_card_lw868_128",wst="_cardTitle_lw868_135",kst="_cardHeader_lw868_147",_st="_infoHint_lw868_162",Sst="_infoHintButton_lw868_168",Cst="_infoHintTip_lw868_197",Tst="_row_lw868_231",Ast="_rowLabel_lw868_240",Est="_rowValue_lw868_244",Mst="_pathRow_lw868_253",Nst="_pathValue_lw868_247",jst="_empty_lw868_274",Ist="_issueRow_lw868_279",Rst="_issueMessage_lw868_286",Dst="_featureChips_lw868_290",Lst="_featureChip_lw868_290",Pst="_summaryChip_lw868_311",Ost="_sessionRow_lw868_320",Bst="_sessionName_lw868_329",$st="_sessionMeta_lw868_335",zst="_activePrompt_lw868_344",Fst="_workspaceRow_lw868_348",qst="_workspaceRowHead_lw868_357",Hst="_workspaceName_lw868_363",Ust="_workspaceDuration_lw868_367",Vst="_workspaceError_lw868_374",Wst="_workspaceSummary_lw868_381",Gst="_workspaceCell_lw868_388",Kst="_workspaceCellLabel_lw868_397",Yst="_workspaceCellMessage_lw868_402",ln={dialog:sst,toolbar:ist,toolbarActions:ost,updatedAt:ast,refreshError:lst,refreshButton:cst,badge:ust,levelOk:dst,levelWarning:hst,levelError:fst,levelUnavailable:mst,tabs:pst,tab:gst,tabActive:bst,grid:yst,chartsGrid:vst,card:xst,cardTitle:wst,cardHeader:kst,infoHint:_st,infoHintButton:Sst,infoHintTip:Cst,row:Tst,rowLabel:Ast,rowValue:Est,pathRow:Mst,pathValue:Nst,empty:jst,issueRow:Ist,issueMessage:Rst,featureChips:Dst,featureChip:Lst,summaryChip:Pst,sessionRow:Ost,sessionName:Bst,sessionMeta:$st,activePrompt:zst,workspaceRow:Fst,workspaceRowHead:qst,workspaceName:Hst,workspaceDuration:Ust,workspaceError:Vst,workspaceSummary:Wst,workspaceCell:Gst,workspaceCellLabel:Kst,workspaceCellMessage:Yst},Xst=5e3,Wp=[{id:"overview",labelKey:"daemon.tab.overview"},{id:"usage",labelKey:"daemon.tab.usage"},{id:"metrics",labelKey:"daemon.tab.metrics"},{id:"diagnostics",labelKey:"daemon.tab.diagnostics"}];function ase(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),i=t%60;return n>0?`${n}d ${r}h ${s}m`:r>0?`${r}h ${s}m ${i}s`:s>0?`${s}m ${i}s`:`${i}s`}function Ah(e){return e=Math.max(0,e),e>=6e4?ase(e):e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}s`:`${e}ms`}function b4(e){const t=e/1024;if(t<1)return`${Math.round(e)} B`;const n=t/1024;return n<1?`${t.toFixed(t<10?1:0)} KB`:n>=1024?`${(n/1024).toFixed(2)} GB`:`${n.toFixed(1)} MB`}function ob(e){const t=Math.round(e);return t>=1e4?`${(t/1e3).toFixed(t%1e3===0?0:1)}k`:t.toLocaleString()}function Qst(e){return`${e.toFixed(e>=100||e===0?0:1)}%`}function Jst(e){return e.exitCode!=null?`${e.state} (exit ${e.exitCode})`:e.signal?`${e.state} (${e.signal})`:e.state}function xF(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Zst=["cells","servers","errors","skills","tools","providers","hooks","extensions","budgets"];function eit(e){if(!xF(e))return[];const t=[];for(const n of Zst){const r=e[n];if(Array.isArray(r))for(const s of r){if(!xF(s))continue;const i=s.status;if(i!=="warning"&&i!=="error")continue;const o=String(s.kind??s.name??s.serverName??n),a=typeof s.error=="string"?s.error:typeof s.hint=="string"?s.hint:void 0;t.push({label:o,status:i,message:a})}}return t}function fE(e){switch(e){case"ok":return ln.levelOk;case"warning":return ln.levelWarning;case"error":return ln.levelError;default:return ln.levelUnavailable}}function Yr({label:e,value:t}){return c.jsxs("div",{className:ln.row,children:[c.jsx("span",{className:ln.rowLabel,children:e}),c.jsx("span",{className:ln.rowValue,children:t})]})}function tit({text:e}){return c.jsxs("span",{className:ln.infoHint,children:[c.jsx("button",{type:"button",className:ln.infoHintButton,"aria-label":e,children:c.jsx("span",{"aria-hidden":"true",children:"ⓘ"})}),c.jsx("span",{"aria-hidden":"true",className:ln.infoHintTip,children:e})]})}function xl({title:e,help:t,children:n}){return c.jsxs("section",{className:ln.card,children:[t?c.jsxs("div",{className:ln.cardHeader,children:[c.jsx("h3",{className:ln.cardTitle,children:e}),c.jsx(tit,{text:t})]}):c.jsx("h3",{className:ln.cardTitle,children:e}),n]})}function nit({name:e,section:t}){const{t:n}=gt(),r=Object.entries(t.summary??{}),s=eit(t.data);return c.jsxs("div",{className:ln.workspaceRow,children:[c.jsxs("div",{className:ln.workspaceRowHead,children:[c.jsx("span",{className:`${ln.badge} ${fE(t.status)}`,children:n(`daemon.level.${t.status}`)}),c.jsx("span",{className:ln.workspaceName,children:e}),c.jsx("span",{className:ln.workspaceDuration,children:Ah(t.durationMs)})]}),t.error&&c.jsx("div",{className:ln.workspaceError,children:t.error.message}),s.map((i,o)=>c.jsxs("div",{className:ln.workspaceCell,children:[c.jsx("span",{className:`${ln.badge} ${fE(i.status)}`,children:n(`daemon.level.${i.status}`)}),c.jsx("span",{className:ln.workspaceCellLabel,children:i.label}),i.message&&c.jsx("span",{className:ln.workspaceCellMessage,children:i.message})]},`${i.label}-${o}`)),r.length>0&&c.jsx("div",{className:ln.workspaceSummary,children:r.map(([i,o])=>c.jsxs("span",{className:ln.summaryChip,children:[i,": ",o===null?n("common.na"):String(o)]},i))})]})}function rit({report:e}){const{t}=gt(),n=e.full;if(!n)return null;const r=Object.entries(n.workspace).sort(([s],[i])=>s.localeCompare(i));return c.jsxs(c.Fragment,{children:[c.jsx(xl,{title:t("daemon.full.sessions.title"),children:n.sessions.length===0?c.jsx("div",{className:ln.empty,children:t("daemon.full.sessions.empty")}):n.sessions.map(s=>c.jsxs("div",{className:ln.sessionRow,children:[c.jsx("div",{className:ln.sessionName,children:s.displayName||s.sessionId}),c.jsxs("div",{className:ln.sessionMeta,children:[c.jsx("span",{children:t("common.clients",{count:s.clientCount})}),c.jsx("span",{children:t("daemon.full.session.pendingPrompts",{count:s.pendingPromptCount})}),c.jsx("span",{children:t("daemon.full.session.pendingPermissions",{count:s.pendingPermissionCount})}),s.hasActivePrompt&&c.jsx("span",{className:ln.activePrompt,children:t("daemon.full.session.prompting")})]})]},s.sessionId))}),c.jsx(xl,{title:t("daemon.full.workspace.title"),children:r.length===0?c.jsx("div",{className:ln.empty,children:t("daemon.full.workspace.empty")}):r.map(([s,i])=>c.jsx(nit,{name:s,section:i},s))}),c.jsxs(xl,{title:t("daemon.full.auth.title"),children:[c.jsx(Yr,{label:t("daemon.full.auth.providers"),value:n.auth.supportedDeviceFlowProviders.join(", ")||t("daemon.none")}),c.jsx(Yr,{label:t("daemon.full.auth.pending"),value:n.auth.pendingDeviceFlowCount}),c.jsx(Yr,{label:t("daemon.full.acp.title"),value:n.acpConnections.length})]})]})}function sit({series:e}){const{t}=gt();if(e.length===0)return c.jsx(xl,{title:t("daemon.charts.title"),children:c.jsx("div",{className:ln.empty,children:t("daemon.charts.empty")})});const n=i=>e.map(i),r=e.map(i=>i.t),s=(i,o,a,l)=>c.jsx(xl,{title:t(i),help:t(l),children:c.jsx(ise,{series:a,timestamps:r,format:o,ariaLabel:t(i),peakLabel:t("daemon.charts.peak")})});return c.jsxs("div",{className:`${ln.grid} ${ln.chartsGrid}`,children:[s("daemon.charts.concurrency",ob,[{label:t("daemon.charts.activePrompts"),values:n(i=>i.activePrompts),color:"var(--primary)"},{label:t("daemon.charts.queuedPrompts"),values:n(i=>i.queuedPrompts),color:"var(--warning-color)"},{label:t("daemon.charts.activeSessions"),values:n(i=>i.activeSessions),color:"var(--muted-foreground)"}],"daemon.charts.concurrency.help"),s("daemon.charts.requests",ob,[{label:t("daemon.charts.reqTotal"),values:n(i=>i.requests),color:"var(--success-color)"},{label:t("daemon.charts.reqErrors"),values:n(i=>i.errors),color:"var(--error-color)"},{label:t("daemon.charts.reqRejected"),values:n(i=>i.rateLimitRejected),color:"var(--warning-color)"}],"daemon.charts.requests.help"),s("daemon.charts.apiLatency",Ah,[{label:"p50",values:n(i=>i.latencyP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.latencyP95Ms),color:"var(--warning-color)"}],"daemon.charts.apiLatency.help"),s("daemon.charts.llmLatency",Ah,[{label:"p50",values:n(i=>i.llmApiP50Ms),color:"var(--agent-blue-400)"},{label:"p95",values:n(i=>i.llmApiP95Ms),color:"var(--primary)"}],"daemon.charts.llmLatency.help"),s("daemon.charts.apiHealth",ob,[{label:t("daemon.charts.apiErrors"),values:n(i=>i.llmApiErrors??0),color:"var(--error-color)"},{label:t("daemon.charts.apiRetries"),values:n(i=>i.llmApiRetries??0),color:"var(--warning-color)"}],"daemon.charts.apiHealth.help"),s("daemon.charts.promptLatency",Ah,[{label:t("daemon.charts.queueWait"),values:n(i=>i.promptQueueWaitP95Ms),color:"var(--warning-color)"},{label:t("daemon.charts.promptDuration"),values:n(i=>i.promptDurationP95Ms),color:"var(--primary)"}],"daemon.charts.promptLatency.help"),s("daemon.charts.eventLoop",Ah,[{label:t("daemon.charts.eventLoopLag"),values:n(i=>i.eventLoopLagP99Ms),color:"var(--error-color)"}],"daemon.charts.eventLoop.help"),s("daemon.charts.cpu",Qst,[{label:t("daemon.charts.cpuDaemon"),values:n(i=>i.cpuPercent),color:"var(--muted-foreground)"},{label:t("daemon.charts.cpuChild"),values:n(i=>i.childCpuPercent),color:"var(--primary)"}],"daemon.charts.cpu.help"),s("daemon.charts.memory",b4,[{label:t("daemon.charts.rssDaemon"),values:n(i=>i.rssBytes),color:"var(--muted-foreground)"},{label:t("daemon.charts.heap"),values:n(i=>i.heapUsedBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.rssChild"),values:n(i=>i.childRssBytes),color:"var(--primary)"}],"daemon.charts.memory.help"),s("daemon.charts.pipe",b4,[{label:t("daemon.charts.pipeIn"),values:n(i=>i.pipeInBytes),color:"var(--agent-blue-400)"},{label:t("daemon.charts.pipeOut"),values:n(i=>i.pipeOutBytes),color:"var(--success-color)"}],"daemon.charts.pipe.help"),s("daemon.charts.connections",ob,[{label:"SSE",values:n(i=>i.sseConnections),color:"var(--primary)"},{label:"WS",values:n(i=>i.wsConnections),color:"var(--agent-blue-400)"},{label:"ACP",values:n(i=>i.acpConnections),color:"var(--muted-foreground)"}],"daemon.charts.connections.help"),s("daemon.charts.tokens",ob,[{label:t("daemon.charts.tokensIn"),values:n(i=>i.tokensIn),color:"var(--agent-blue-400)"},{label:t("daemon.charts.tokensOut"),values:n(i=>i.tokensOut),color:"var(--success-color)"}],"daemon.charts.tokens.help")]})}function iit(){var _;const{t:e}=gt(),[t,n]=f.useState("overview"),r=f.useRef([]),s=(A,M)=>{var N;let L;if(A.key==="ArrowRight"||A.key==="ArrowDown")L=(M+1)%Wp.length;else if(A.key==="ArrowLeft"||A.key==="ArrowUp")L=(M-1+Wp.length)%Wp.length;else if(A.key==="Home")L=0;else if(A.key==="End")L=Wp.length-1;else return;A.preventDefault(),n(Wp[L].id),(N=r.current[L])==null||N.focus()},i=H8({autoLoad:!0,detail:"summary"}),o=H8({autoLoad:!0,detail:"full"}),a=i.reload,l=o.reload,u=f.useRef(!1);f.useEffect(()=>{const A=window.setInterval(()=>{document.hidden||u.current||(u.current=!0,a().finally(()=>{u.current=!1}))},Xst);return()=>window.clearInterval(A)},[a]);const d=f.useCallback(()=>{a(),l()},[a,l]),h=i.report??o.report,m=o.report,p=i.loading||o.loading,g=i.error??o.error;if(!h)return c.jsx("div",{className:ln.dialog,children:c.jsx("div",{className:ln.empty,children:g?`${e("daemon.loadFailed")}: ${g.message}`:e("daemon.loading")})});const b=m??h,{daemon:x,runtime:v,security:y,limits:w,capabilities:k}=h,T=v.transport.acp,S=Object.values(v.rateLimit.rejectedSinceStart).reduce((A,M)=>A+M,0),C=A=>A===null?e("daemon.limits.unlimited"):A;return c.jsxs("div",{className:ln.dialog,children:[c.jsxs("div",{className:ln.toolbar,children:[c.jsx("span",{role:"status","aria-label":`${e("daemon.title")}: ${e(`daemon.level.${b.status}`)}`,className:`${ln.badge} ${fE(b.status)}`,children:e(`daemon.level.${b.status}`)}),c.jsx("span",{className:ln.updatedAt,children:e("daemon.updatedAt",{time:new Date(h.generatedAt).toLocaleTimeString()})}),i.error&&i.report&&c.jsx("span",{className:ln.refreshError,children:e("daemon.loadFailed")}),c.jsx("div",{className:ln.toolbarActions,children:c.jsx("button",{type:"button",className:ln.refreshButton,onClick:d,disabled:p,children:e("daemon.refresh")})})]}),b.issues.length>0&&c.jsx(xl,{title:e("daemon.issues.title"),children:b.issues.map((A,M)=>c.jsxs("div",{className:ln.issueRow,children:[c.jsx("span",{className:`${ln.badge} ${A.severity==="error"?ln.levelError:ln.levelWarning}`,children:A.severity==="error"?e("daemon.level.error"):e("daemon.level.warning")}),c.jsx("span",{className:ln.issueMessage,children:A.message})]},`${A.code}-${M}`))}),c.jsx("div",{className:ln.tabs,role:"tablist","aria-label":e("daemon.title"),children:Wp.map((A,M)=>c.jsx("button",{ref:L=>{r.current[M]=L},type:"button",role:"tab",id:`daemon-tab-${A.id}`,"aria-selected":A.id===t,"aria-controls":`daemon-tabpanel-${A.id}`,tabIndex:A.id===t?0:-1,className:`${ln.tab} ${A.id===t?ln.tabActive:""}`,onClick:()=>n(A.id),onKeyDown:L=>s(L,M),children:e(A.labelKey)},A.id))}),t==="overview"&&c.jsxs("div",{role:"tabpanel",id:"daemon-tabpanel-overview","aria-labelledby":"daemon-tab-overview",tabIndex:0,className:ln.grid,children:[c.jsxs(xl,{title:e("daemon.overview.title"),children:[x.qwenCodeVersion&&c.jsx(Yr,{label:e("daemon.overview.version"),value:x.qwenCodeVersion}),c.jsx(Yr,{label:e("daemon.overview.pid"),value:x.pid}),c.jsx(Yr,{label:e("daemon.overview.mode"),value:x.mode}),c.jsx(Yr,{label:e("daemon.overview.uptime"),value:ase(x.uptimeMs)}),c.jsxs("div",{className:ln.pathRow,children:[c.jsx("span",{className:ln.rowLabel,children:e("daemon.overview.workspace")}),c.jsx("span",{className:ln.pathValue,title:x.workspaceCwd,children:c.jsx("bdi",{children:x.workspaceCwd})})]})]}),c.jsxs(xl,{title:e("daemon.runtime.title"),children:[v.error?c.jsxs("div",{className:ln.workspaceError,children:[e("daemon.runtime.startFailed"),": ",v.error]}):v.loading?c.jsx("div",{className:ln.empty,children:e("daemon.runtime.startingUp")}):null,c.jsx(Yr,{label:e("daemon.runtime.activeSessions"),value:v.sessions.active}),v.activity&&c.jsxs(c.Fragment,{children:[c.jsx(Yr,{label:e("daemon.runtime.activePrompts"),value:v.activity.activePrompts}),c.jsx(Yr,{label:e("daemon.runtime.idle"),value:v.activity.idleSinceMs===null?e("daemon.runtime.noActivity"):Ah(v.activity.idleSinceMs)})]}),c.jsx(Yr,{label:e("daemon.runtime.pendingPermissions"),value:v.permissions.pending}),c.jsx(Yr,{label:e("daemon.runtime.permissionPolicy"),value:v.permissions.policy}),c.jsx(Yr,{label:e("daemon.runtime.channel"),value:v.channel.live?e("daemon.runtime.channelLive"):e("daemon.runtime.channelDown")}),v.channelWorker.enabled&&c.jsxs(c.Fragment,{children:[c.jsx(Yr,{label:e("daemon.runtime.channelWorker"),value:Jst(v.channelWorker)}),v.channelWorker.error&&c.jsx("div",{className:ln.workspaceError,children:v.channelWorker.error}),(v.channelWorker.restartCount??0)>0&&c.jsx(Yr,{label:e("daemon.runtime.channelWorkerRestarts"),value:v.channelWorker.restartCount})]}),c.jsx(Yr,{label:e("daemon.runtime.memory"),value:`${b4(v.process.rss)} / ${b4(v.process.heapUsed)}`})]}),c.jsxs(xl,{title:e("daemon.transport.title"),children:[c.jsx(Yr,{label:e("daemon.transport.restSse"),value:v.transport.restSseActive}),T.enabled?c.jsxs(c.Fragment,{children:[c.jsx(Yr,{label:e("daemon.transport.acpConnections"),value:T.connections}),c.jsx(Yr,{label:e("daemon.transport.acpStreams"),value:`${T.sessionStreams} / ${T.sseStreams} / ${T.wsStreams}`}),c.jsx(Yr,{label:e("daemon.transport.pendingRequests"),value:T.pendingClientRequests})]}):c.jsx("div",{className:ln.empty,children:e("daemon.transport.acpDisabled")}),c.jsx(Yr,{label:e("daemon.transport.rateLimitRejected"),value:v.rateLimit.enabled?S:e("common.disabled")})]}),c.jsxs(xl,{title:e("daemon.security.title"),children:[c.jsx(Yr,{label:e("daemon.security.token"),value:y.tokenConfigured?e("daemon.security.configured"):e("daemon.security.notConfigured")}),c.jsx(Yr,{label:e("daemon.security.requireAuth"),value:y.requireAuth?e("common.enabled"):e("common.disabled")}),c.jsx(Yr,{label:e("daemon.security.loopback"),value:y.loopbackBind?e("common.enabled"):e("common.disabled")}),c.jsx(Yr,{label:e("daemon.security.allowOrigin"),value:y.allowOriginMode}),c.jsx(Yr,{label:e("daemon.security.shell"),value:y.sessionShellCommandEnabled?e("common.enabled"):e("common.disabled")})]}),c.jsxs(xl,{title:e("daemon.limits.title"),children:[c.jsx(Yr,{label:e("daemon.limits.maxSessions"),value:C(w.maxSessions)}),c.jsx(Yr,{label:e("daemon.limits.maxPendingPrompts"),value:C(w.maxPendingPromptsPerSession)}),c.jsx(Yr,{label:e("daemon.limits.maxConnections"),value:C(w.listenerMaxConnections)}),c.jsx(Yr,{label:e("daemon.limits.eventRing"),value:w.eventRingSize}),c.jsx(Yr,{label:e("daemon.limits.promptDeadline"),value:w.promptDeadlineMs===null?e("daemon.limits.unlimited"):Ah(w.promptDeadlineMs)}),c.jsx(Yr,{label:e("daemon.limits.sessionIdle"),value:Ah(w.sessionIdleTimeoutMs)})]}),c.jsx(xl,{title:k.features.length?e("daemon.capabilities.titleCount",{count:k.features.length}):e("daemon.capabilities.title"),children:k.features.length===0?c.jsx("span",{className:ln.empty,children:e("daemon.none")}):c.jsx("div",{className:ln.featureChips,children:[...k.features].sort().map(A=>c.jsx("span",{className:ln.featureChip,children:A},A))})})]}),t==="usage"&&c.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-usage","aria-labelledby":"daemon-tab-usage",tabIndex:0,children:c.jsx(ld,{label:"daemon-usage",fallback:c.jsx("div",{className:ln.empty,children:e("daemon.usage.failed")}),children:c.jsx(rst,{})})}),t==="metrics"&&c.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-metrics","aria-labelledby":"daemon-tab-metrics",tabIndex:0,children:c.jsx(sit,{series:((_=h.runtime.metrics)==null?void 0:_.series)??[]})}),t==="diagnostics"&&c.jsx("div",{role:"tabpanel",id:"daemon-tabpanel-diagnostics","aria-labelledby":"daemon-tab-diagnostics",tabIndex:0,children:c.jsx(ld,{label:"daemon-status-detail",fallback:c.jsx("div",{className:ln.empty,children:e("daemon.details.failed")}),children:m!=null&&m.full?c.jsx(rit,{report:m}):o.loading?c.jsx("div",{className:ln.empty,children:e("daemon.details.loading")}):o.error?c.jsxs("div",{className:ln.empty,children:[e("daemon.details.failed"),": ",o.error.message]}):c.jsx("div",{className:ln.empty,children:e("daemon.details.failed")})})})]})}function oit(){const{t:e}=gt();return c.jsx(ld,{label:"daemon-status",fallback:t=>c.jsx("div",{className:ln.dialog,children:c.jsxs("div",{className:ln.empty,children:[e("daemon.loadFailed"),": ",t.message]})}),children:c.jsx(iit,{})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const lse="split",J0=6;function ait(e,t,n){const r=new URL(t);return r.pathname="/",r.searchParams.set(lse,e.join(",")),n&&(r.hash=new URLSearchParams({token:n}).toString()),r.toString()}function lit(e){const t=new URLSearchParams(e).get(lse);return t?t.split(",").map(n=>n.trim()).filter(Boolean):[]}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function y4(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function Lj(e){var t;return(((t=e==null?void 0:e.workspaces)==null?void 0:t.length)??0)>1}function cse(e,t){return!!e&&!!t&&e!==t}function use(e,t){if(t.length===0)return e;const n=new Map;for(const r of e)n.set(r.sessionId,r);for(const r of t)n.has(r.sessionId)||n.set(r.sessionId,r);return[...n.values()]}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const sk=[];function dse(e=!0){var l;const t=pd(),n=t.client,r=e?(((l=t.capabilities)==null?void 0:l.workspaces)??[]).filter(u=>!u.primary&&u.trusted).map(u=>u.cwd).join(`
`):"",[s,i]=f.useState(sk),o=f.useCallback(async()=>{const u=r?r.split(`
`):[];if(u.length===0)return sk;const d=await Promise.allSettled(u.map(m=>n.listWorkspaceSessions(m,{pageSize:Ou,archiveState:"active",sourceType:g4}))),h=[];return d.forEach((m,p)=>{m.status==="fulfilled"?h.push(...m.value):console.warn(`[useOtherWorkspaceSessions] failed to list sessions for ${u[p]}:`,m.reason)}),h.length===0?sk:h},[n,r]),a=f.useCallback(async()=>{r&&i(await o())},[r,o]);return f.useEffect(()=>{if(!r){i(d=>d.length===0?d:sk);return}let u=!1;return o().then(d=>{u||i(d)}),()=>{u=!0}},[r,o]),{sessions:s,reload:a}}function cit(){if(typeof window>"u")return"";const e=new URLSearchParams(window.location.search).get("daemon")||"";return e?mit(e):""}let Nb;const uit="qwen-daemon-auth",dit=2500;function hse(){return Nb||(typeof window>"u"?void 0:(Nb=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token")||new URLSearchParams(window.location.search).get("token")||void 0,Nb))}function hit(e=dit){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),Nb=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)!==uit)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 fit(){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 mit(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 pit="_panel_1s6rs_1",git="_toolbar_1s6rs_9",bit="_count_1s6rs_16",yit="_selectAll_1s6rs_21",vit="_actionButton_1s6rs_30",xit="_refreshButton_1s6rs_50",wit="_notice_1s6rs_61",kit="_grid_1s6rs_71",_it="_card_1s6rs_80",Sit="_cardCurrent_1s6rs_91",Cit="_cardTop_1s6rs_96",Tit="_cardCheckbox_1s6rs_103",Ait="_colorDot_1s6rs_108",Eit="_cardLabel_1s6rs_115",Mit="_currentBadge_1s6rs_135",Nit="_cardMeta_1s6rs_145",jit="_metaItem_1s6rs_153",Iit="_statusBadge_1s6rs_162",Rit="_statusApproval_1s6rs_172",Dit="_statusRunning_1s6rs_181",Lit="_statusIdle_1s6rs_190",Pit="_workspaceBadge_1s6rs_202",Oit="_workspaceBadgeOther_1s6rs_218",Bit="_empty_1s6rs_223",$it="_colorRed_1s6rs_231",zit="_colorOrange_1s6rs_234",Fit="_colorYellow_1s6rs_237",qit="_colorGreen_1s6rs_240",Hit="_colorBlue_1s6rs_243",Uit="_colorPurple_1s6rs_246",gr={panel:pit,toolbar:git,count:bit,selectAll:yit,actionButton:vit,refreshButton:xit,notice:wit,grid:kit,card:_it,cardCurrent:Sit,cardTop:Cit,cardCheckbox:Tit,colorDot:Ait,cardLabel:Eit,currentBadge:Mit,cardMeta:Nit,metaItem:jit,statusBadge:Iit,statusApproval:Rit,statusRunning:Dit,statusIdle:Lit,workspaceBadge:Pit,workspaceBadgeOther:Oit,empty:Bit,colorRed:$it,colorOrange:zit,colorYellow:Fit,colorGreen:qit,colorBlue:Hit,colorPurple:Uit},Vit=3e3,Wit=1e4,wF={needsApproval:0,running:1,idle:2};function Git(e,t,n,r){const s=new Map(t.map(o=>[o.sessionId,o])),i=e.map(o=>{var d;const a=s.get(o.sessionId),l=o.hasActivePrompt??(a==null?void 0:a.hasActivePrompt)??!1,u=((a==null?void 0:a.pendingPermissionCount)??0)>0;return{sessionId:o.sessionId,label:((d=o.displayName)==null?void 0:d.trim())||o.sessionId.slice(0,8),status:u?"needsApproval":l?"running":"idle",clientCount:o.clientCount??(a==null?void 0:a.clientCount)??0,model:a==null?void 0:a.currentModelId,updatedAt:o.updatedAt||o.createdAt,color:o.color,isCurrent:o.sessionId===n,workspaceCwd:o.workspaceCwd,isNonPrimary:cse(o.workspaceCwd,r)}});return i.sort((o,a)=>{const l=wF[o.status]-wF[a.status];return l!==0?l:(a.updatedAt??"").localeCompare(o.updatedAt??"")}),i}function ik(...e){return e.filter(Boolean).join(" ")}function Kit(e){switch(e){case"red":return gr.colorRed;case"orange":return gr.colorOrange;case"yellow":return gr.colorYellow;case"green":return gr.colorGreen;case"blue":return gr.colorBlue;case"purple":return gr.colorPurple;default:return}}function kF(e){switch(e){case"needsApproval":return gr.statusApproval;case"running":return gr.statusRunning;default:return gr.statusIdle}}function Yit({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:r}){var D,Q,U;const{t:s}=gt(),i=il(),o=i.sessionId,a=((Q=(D=i.capabilities)==null?void 0:D.features)==null?void 0:Q.includes(Dj))??!1,{sessions:l,loading:u,error:d,reload:h}=ix(r,{autoLoad:!0,pageSize:Ou,archiveState:"active",...a?{view:"organized",group:"all"}:{}}),{sessions:m,reload:p}=dse(n&&!r),g=f.useMemo(()=>use(l,m),[l,m]),b=!r&&n&&Lj(i.capabilities),x=H8({autoLoad:!0,detail:"full"}),v=x.reload,y=x.report,[w,k]=f.useState(()=>new Set),[T,S]=f.useState(!1),C=f.useRef(!1);f.useEffect(()=>{const j=window.setInterval(()=>{document.hidden||C.current||(C.current=!0,Promise.all([h(),p()]).finally(()=>{C.current=!1}))},Vit);return()=>window.clearInterval(j)},[h,p]);const _=f.useRef(!1);f.useEffect(()=>{const j=window.setInterval(()=>{document.hidden||_.current||(_.current=!0,v().finally(()=>{_.current=!1}))},Wit);return()=>window.clearInterval(j)},[v]);const A=(U=i.capabilities)==null?void 0:U.workspaceCwd,M=f.useMemo(()=>{var j;return Git(g,((j=y==null?void 0:y.full)==null?void 0:j.sessions)??[],o,A)},[g,y,o,A]),L=f.useCallback(j=>{k(ie=>{const oe=new Set(ie);return oe.has(j)?oe.delete(j):oe.add(j),oe})},[]),N=M.map(j=>j.sessionId).filter(j=>w.has(j)),O=N.length,B=M.length>0&&O===M.length,$=N.slice(0,J0),P=O>J0,K=f.useCallback(()=>{k(j=>{const ie=M.map(J=>J.sessionId);return ie.length>0&&ie.every(J=>j.has(J))?new Set:new Set(ie)})},[M]);f.useEffect(()=>{k(j=>{if(j.size===0)return j;const ie=new Set(M.map(V=>V.sessionId));let oe=!1;const J=new Set;for(const V of j)ie.has(V)?J.add(V):oe=!0;return oe?J:j})},[M]);const F=f.useCallback(()=>{if($.length===0)return;const j=ait($,window.location.href,hse()),ie=window.open(j,"_blank");ie&&(ie.opener=null,ie.focus()),S(!ie)},[$]),H=f.useCallback(()=>{h(),p(),v()},[h,p,v]);return M.length===0?c.jsx("div",{className:gr.panel,children:c.jsx("div",{className:gr.empty,children:u?s("sessionsOverview.loading"):d?`${s("sessionsOverview.loadFailed")}: ${d.message}`:s("sessionsOverview.empty")})}):c.jsxs("div",{className:gr.panel,children:[c.jsxs("div",{className:gr.toolbar,children:[c.jsx("span",{className:gr.count,children:s("sessionsOverview.count",{count:M.length})}),c.jsxs("label",{className:gr.selectAll,children:[c.jsx("input",{type:"checkbox",checked:B,onChange:K}),s("sessionsOverview.selectAll")]}),c.jsx("button",{type:"button",className:gr.actionButton,disabled:O===0,onClick:F,title:s("sessionsOverview.openInTabHint"),children:s("sessionsOverview.openInTab")}),t&&c.jsx("button",{type:"button",className:gr.actionButton,disabled:O===0,onClick:()=>t($),title:s("sessionsOverview.openInSplitHint"),children:s("sessionsOverview.openInSplit")}),c.jsx("button",{type:"button",className:gr.refreshButton,onClick:H,children:s("sessionsOverview.refresh")})]}),P&&c.jsx("div",{className:gr.notice,role:"status",children:s("sessionsOverview.splitCap",{max:J0})}),T&&c.jsx("div",{className:gr.notice,role:"alert",children:s("sessionsOverview.popupBlocked")}),d&&c.jsxs("div",{className:gr.notice,role:"alert",children:[s("sessionsOverview.loadFailed"),": ",d.message]}),c.jsx("ul",{className:gr.grid,children:M.map(j=>c.jsxs("li",{className:ik(gr.card,kF(j.status),j.isCurrent&&gr.cardCurrent),children:[c.jsxs("div",{className:gr.cardTop,children:[c.jsx("input",{type:"checkbox",className:gr.cardCheckbox,checked:w.has(j.sessionId),onChange:()=>L(j.sessionId),"aria-label":s("sessionsOverview.selectSession",{name:j.label})}),j.color&&c.jsx("span",{className:ik(gr.colorDot,Kit(j.color)),"aria-hidden":"true"}),c.jsx("button",{type:"button",className:gr.cardLabel,onClick:()=>e(j.sessionId),title:j.label,children:j.label}),j.isCurrent&&c.jsx("span",{className:gr.currentBadge,children:s("sessionsOverview.current")})]}),c.jsxs("div",{className:gr.cardMeta,children:[c.jsx("span",{className:ik(gr.statusBadge,kF(j.status)),children:s(`sessionsOverview.status.${j.status}`)}),b&&c.jsx("span",{className:ik(gr.workspaceBadge,j.isNonPrimary&&gr.workspaceBadgeOther),title:j.workspaceCwd,children:j.isNonPrimary?y4(j.workspaceCwd):s("sidebar.workspacePrimary")}),j.model&&c.jsx("span",{className:gr.metaItem,title:j.model,children:j.model}),j.clientCount>0&&c.jsx("span",{className:gr.metaItem,title:s("sessionsOverview.openElsewhere"),children:s("common.clients",{count:j.clientCount})}),j.updatedAt&&c.jsx("span",{className:gr.metaItem,children:p4(j.updatedAt,s)})]})]},j.sessionId))})]})}function Xit({onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n=!0,workspaceCwd:r}){const{t:s}=gt();return c.jsx(ld,{label:"session-overview",fallback:i=>c.jsx("div",{className:gr.panel,children:c.jsxs("div",{className:gr.empty,children:[s("sessionsOverview.loadFailed"),": ",i.message]})}),children:c.jsx(Yit,{onOpenSession:e,onOpenSplit:t,includeOtherWorkspaces:n,workspaceCwd:r})})}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Qit(e){return e.startsWith("language_changed (unrecognized daemon event):")||e.startsWith("Model switched: ")}function Jit(e,t){return e.errorKind==="model_stream_interrupted"||e.source==="turn_error"&&e.text.trim().toLowerCase()==="terminated"?(t==null?void 0:t.modelStreamInterrupted)??e.text:e.text}function Zit(e,t){return e===void 0?{}:t?{data:{...xo(e)??{value:e},errorKind:t}}:{data:e}}function eot(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 tot(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 not(e){const n=e.meta;return(n==null?void 0:n.source)==="background_notification"&&n.qwenDiscreteMessage===!0&&n.backgroundTask!==void 0}function rot(e){return not(e)||!e.text&&!e.usage?null:e}function _F(e){return e.text.length===0}function sot(e){const t=e.flatMap((n,r)=>{const s=xo(n),i=Oo(s,"content");return i?[{id:Oo(s,"id")??`plan-${r}`,content:i,status:uot(Oo(s,"status")),...(()=>{const a=dot(Oo(s,"priority"));return a?{priority:a}:{}})()}]:[]});return t.length>0?t:void 0}function SF(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 iot(e,t={}){var u,d,h;const n=[],r=((u=t.labels)==null?void 0:u.promptCancelled)??"Request cancelled.",s=new Map,i=new Map;let o=null,a=null,l=!1;for(let m=0;m<e.length;m++){const p=e[m],g=p.serverTimestamp??p.clientReceivedAt;switch(p.kind){case"user":{o=null,a=null,l=!1;const b=p,x=xo(b.meta),v=Oo(x,"source"),y=Array.isArray(x==null?void 0:x.inputAnnotations)?x.inputAnnotations:void 0,w={id:p.id,role:"user",content:b.text,timestamp:g,...v?{source:v}:{},...y?{inputAnnotations:y}:{}};b.images&&b.images.length>0&&(w.images=b.images.map(k=>({data:k.data,mimeType:k.mimeType||"image/*"}))),n.push(w);break}case"assistant":{const b=rot(p);if(!b)break;const x=b.parentToolCallId?s.get(b.parentToolCallId):void 0;if(x){CF(x,b.text);break}const v=Sot(b.text);if(v){let w=null,k=!1,T=0,S=0;for(const C of v)C.kind==="insight"?C.data.type==="insight_progress"?w=C.data:C.data.type==="insight_ready"?(k=!0,n.push({id:`${p.id}-ir-${T++}`,role:"insight_ready",path:C.data.path,timestamp:g})):C.data.type==="insight_error"&&(k=!0,n.push({id:`${p.id}-ie-${S++}`,role:"insight_error",error:C.data.error,timestamp:g})):(n.push({id:`${p.id}-t-${n.length}`,role:"assistant",content:C.text,timestamp:g}),o=n.length-1,a=null);w&&!k&&n.push({id:`${p.id}-ip`,role:"insight_progress",stage:w.stage,progress:w.progress,detail:w.detail,timestamp:g}),l=!0;break}const y=o!==null?n[o]:void 0;if(y&&y.role==="assistant"&&!l&&!_F(b)){const w=SF(y.usage,b.usage);n[o]={...y,content:y.content+b.text,isStreaming:b.streaming,...w?{usage:w}:{}},l=!1,a=null}else if(!_F(b))n.push({id:p.id,role:"assistant",content:b.text,isStreaming:b.streaming,timestamp:g,...b.usage?{usage:b.usage}:{}}),o=n.length-1,a=null,l=!1;else if(b.usage&&y&&y.role==="assistant"){const w=SF(y.usage,b.usage);n[o]={...y,...w?{usage:w}:{}}}break}case"thought":{const b=p,x=b.parentToolCallId?s.get(b.parentToolCallId):void 0;if(x){CF(x,b.text);break}const v=a!==null?n[a]:void 0;v&&v.role==="thinking"&&!l?(n[a]={...v,content:v.content+b.text,isStreaming:b.streaming},l=!1):(n.push({id:p.id,role:"thinking",content:b.text,isStreaming:b.streaming,timestamp:g}),a=n.length-1,l=!1),o=null;break}case"tool":{const x=hot(p),v=i.get(x.callId);v!=null&&v.title&&(x.title=v.title),!x.args&&(v!=null&&v.args)&&(x.args=v.args);const y=x.parentToolCallId?s.get(x.parentToolCallId):void 0,w=s.get(x.callId);if(w){TF(w,x);break}if(y){oot(y,x),s.set(x.callId,x);break}gT(n,p.id,x,g),s.set(x.callId,x),o=null,a=null,l=!0;break}case"shell":{const b=p,x=n[n.length-1];if(x&&x.role==="tool_group"){const v=aot(x.tools),y=x.tools[v];if(y){const w=typeof y.rawOutput=="string"?y.rawOutput:"",k={...y,rawOutput:w+b.text};n[n.length-1]={...x,tools:[...x.tools.slice(0,v),k,...x.tools.slice(v+1)]},s.get(y.callId)===y&&s.set(y.callId,k)}}else n.push({id:p.id,role:"tool_group",tools:[{callId:p.id,toolName:"shell",status:"completed",kind:"execute",rawOutput:b.text}],timestamp:g}),l=!0;break}case"user_shell":{const b=p;n.push({id:p.id,role:"user_shell",command:b.command,output:b.text,...b.cwd?{cwd:b.cwd}:{},timestamp:g}),l=!0;break}case"permission":{const b=p;mot(b,i);const x=fot(b);if(!x)break;const v=fse(x);if(!b.resolved)break;const y=s.get(x.callId);if(y){const w=y.status;x.toolName=y.toolName,b.resolved&&(bT(b.resolved)?x.status=v?x.status:"in_progress":(x.status="failed",x.endTime=b.updatedAt)),TF(y,x),b.resolved&&v&&bT(b.resolved)&&(y.status=w);break}if(b.resolved){bT(b.resolved)?(v||(x.status="in_progress"),gT(n,p.id,x,g),s.set(x.callId,x),l=!0):(x.status="failed",x.endTime=b.updatedAt,gT(n,p.id,x,g),s.set(x.callId,x),l=!0);break}break}case"status":case"debug":{const b=p,x=b.source==="session_branched"?eot(b.data):null,v=b.source==="mid_turn_message_injected"?tot(b.data):null,y=x&&((d=t.labels)!=null&&d.branchSuccess)?t.labels.branchSuccess(x):v&&((h=t.labels)!=null&&h.midTurnInserted)?t.labels.midTurnInserted(v):b.text;if(Qit(y))break;const w=cot(y);if(w){n.push({id:p.id,role:"plan",todos:w,timestamp:g}),l=!0;break}n.push({id:p.id,role:"system",content:y,variant:"info",timestamp:g,...b.source?{source:b.source}:{},...b.data!==void 0?{data:b.data}:{}}),l=!0;break}case"error":{const b=p,x=b.errorKind;n.push({id:p.id,role:"system",content:Jit(b,t.labels),variant:"error",retryable:b.source==="turn_error",timestamp:g,...b.source?{source:b.source}:{},...Zit(b.data,x)}),l=!0;break}case"prompt_cancelled":n.push({id:p.id,role:"system",content:r,variant:"info",source:"prompt_cancelled",timestamp:g}),l=!0;break}}return n}function oot(e,t){e.subTools||(e.subTools=[]),e.subTools.push(t)}function CF(e,t){e.subContent=(e.subContent||"")+t}function gT(e,t,n,r){const s=o=>fse(o)||Td(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 aot(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 TF(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 fse(e){var n;const t=e.toolName.toLowerCase();return t==="agent"||t==="task"||e.subTools||e.subContent||lot(e.rawOutput)?!0:!!((n=e.args)!=null&&n.subagent_type)}function lot(e){return!!e&&typeof e=="object"&&e.type==="task_execution"}function cot(e){const t=e.startsWith("plan: ")?e.slice(6):void 0;if(t)try{const n=JSON.parse(t),r=xo(n);return(r==null?void 0:r.sessionUpdate)!=="plan"||!Array.isArray(r.entries)?void 0:sot(r.entries)}catch{return}}function xo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}function Oo(e,t){const n=e==null?void 0:e[t];return typeof n=="string"&&n.length>0?n:void 0}function uot(e){return e==="completed"||e==="in_progress"||e==="pending"?e:"pending"}function dot(e){return e==="high"||e==="medium"||e==="low"?e:void 0}function hot(e){const t=got(e),n=pot(e,t),r=bot(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:pse(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 fot(e){const t=xo(e.toolCall);if(!t)return;const n=mse(t);if(Array.isArray(n==null?void 0:n.questions))return;const r=xo(t._meta),s=Oo(t,"kind"),i=Oo(r,"toolName")??Oo(t,"toolName")??Oo(t,"name")??(n!=null&&n.subagent_type?"agent":void 0)??(s==="fetch"?"web_fetch":s),o=Oo(t,"toolCallId")??Oo(t,"id");return!o||!i?void 0:{callId:o,toolName:i,title:Oo(t,"title")??e.title,status:"pending",kind:pse(i,s),args:n,startTime:e.createdAt}}function mot(e,t){const n=xo(e.toolCall),r=Oo(n,"toolCallId")??Oo(n,"id");if(!r)return;const s=Oo(n,"title")??e.title,i=n?mse(n):void 0;Array.isArray(i==null?void 0:i.questions)&&t.set(r,{...s?{title:s}:{},...i?{args:i}:{}})}function bT(e){const[t="",n=""]=e.toLowerCase().split(":",2);return AF(t)?!0:t!=="selected"?!1:AF(n.trim())}function AF(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 mse(e){return xo(e.rawInput)??xo(e.input)??xo(e.args)}function pot(e,t){var s;const n=(s=e.toolName)==null?void 0:s.toLowerCase();if(n!=="agent"&&n!=="task")return!1;const r=xo(t);return(r==null?void 0:r.status)==="background"}function got(e){return yot(e)&&e.status==="failed"?vot(e)??e.details??e.rawOutput:!xot(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 bot(e){if(!Array.isArray(e))return;const t=e.flatMap(n=>{const r=xo(n);if(!r)return[];const s=r.type;if(s==="content"){const i=xo(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 yot(e){if(!e.toolName)return!1;const t=e.toolName.toLowerCase();return t==="ask_user_question"||t==="askuserquestion"}function vot(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 xot(e){return e==="cancelled"||e==="canceled"}const wot=['"insight_progress":','"insight_ready":','"insight_error":'];function kot(e){try{const t=JSON.parse(e),n=xo(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=xo(t.insight_ready);if(r&&typeof r.path=="string")return{type:"insight_ready",path:r.path};const s=xo(t.insight_error);if(s&&typeof s.error=="string")return{type:"insight_error",error:s.error}}catch{}return null}function _ot(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 Sot(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(!wot.some(m=>a.startsWith(m))){r=o+1;continue}const u=_ot(e,o);if(!u){r=o+1;continue}const d=kot(u);if(!d){r=o+1;continue}s=!0;const h=e.slice(n,o).trim();h&&t.push({kind:"text",text:h}),t.push({kind:"insight",data:d}),n=o+u.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 pse(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 gse(e){const t=jv();return f.useMemo(()=>iot(t,{labels:{promptCancelled:e("request.cancelled"),branchSuccess:n=>e("branch.success",{name:n}),midTurnInserted:n=>e("midTurn.inserted",{message:n}),modelStreamInterrupted:e("error.modelStreamInterrupted")}}),[t,e])}const Cot="session_artifacts";function bse(){var T,S;const e=Fg(),t=il(),n=pW(),r=gd(),s=r==null?void 0:r.artifactsVersion,i=t.status==="connected",o=((S=(T=t.capabilities)==null?void 0:T.features)==null?void 0:S.includes(Cot))??!1,a=t.sessionId,[l,u]=f.useState([]),[d,h]=f.useState(!1),[m,p]=f.useState(null),g=f.useRef(0),b=f.useRef(void 0),x=f.useRef(n),v=f.useRef(s),y=f.useCallback(async()=>{const C=g.current+1;if(g.current=C,!a){b.current=void 0,u([]),p(null),h(!1);return}if(!i){b.current=void 0,u([]),p(null),h(!1);return}if(!o){b.current=void 0,u([]),p(null),h(!1);return}b.current!==void 0&&b.current!==a&&u([]),h(!0);try{const _=await e.loadArtifacts();if(g.current!==C)return;b.current=a,u(_.artifacts),p(null)}catch(_){if(g.current!==C)return;if(Tot(_)){p(null);return}p(_ instanceof Error?_.message:String(_))}finally{g.current===C&&h(!1)}},[e,i,a,o]),w=f.useRef(y);w.current=y,f.useEffect(()=>{y()},[y]),f.useEffect(()=>{const C=x.current;x.current=n,C!=="idle"&&n==="idle"&&w.current()},[n]),f.useEffect(()=>{const C=v.current;v.current=s,C!==void 0&&s!==void 0&&s!==C&&w.current()},[s]);const k=f.useMemo(()=>new Map(l.map(C=>[C.id,C])),[l]);return{artifacts:l,artifactById:k,loading:d,error:m,refresh:y}}function Tot(e){return(e instanceof Error?e.message:String(e)).includes("session is not connected")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function Aot(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(u=>u.text===a&&(!u.images||u.images.length===0));l>=0&&(s.splice(l,1),i=!0)}return i?s:null}function Eot(e,t,n,r){return e?!0:(r.append(t),!1)}function yse(e){const t=e.trimStart();return t.startsWith("/")||t.startsWith("!")}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Mot=100;function EF(e,t){return e.length!==t.length?!1:e.every((n,r)=>{var i,o,a,l;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)&&(((a=n.inputAnnotations)==null?void 0:a.length)??0)===(((l=s.inputAnnotations)==null?void 0:l.length)??0)})}function MF(e){if(!(!e||e.length===0))return e.map(t=>({data:t.data,mimeType:t.media_type||"image/*"}))}function vse({connected:e,sessionId:t,clientId:n,streamingState:r,sessionActions:s,store:i,editorRef:o,reportError:a,notifySuccess:l,t:u}){const[d,h]=f.useState([]),m=f.useRef([]),p=f.useRef(1),g=f.useRef(t),b=f.useRef(null),x=f.useRef(new Set),v=f.useRef(new Set),y=f.useRef(new Set),w=f.useRef(new Map),k=f.useRef(new Set),T=f.useRef([]),S=f.useRef(r),C=f.useRef(0);g.current=t,S.current=r;const _=f.useMemo(()=>d.map(Z=>Z.text),[d]);f.useEffect(()=>{m.current=d},[d]),f.useEffect(()=>{var Z;m.current=[],h([]),w.current.clear(),k.current.clear(),T.current=[];for(const X of x.current)X.abort();x.current.clear(),v.current.clear(),y.current.clear(),$.current=void 0,(Z=b.current)==null||Z.abort(),b.current=null},[t]);const A=f.useCallback((Z,X)=>{const te=m.current.filter(ae=>ae.serverPromptId?Z.some(xe=>xe.promptId===ae.serverPromptId):!0);for(const ae of Z){if(v.current.has(ae.promptId))continue;const xe=te.findIndex(Le=>Le.serverPromptId===ae.promptId),Ae=y.current.has(ae.promptId);if(xe!==-1){if(Ae){te.splice(xe,1);continue}te[xe]={...te[xe],text:ae.text,serverState:ae.state};continue}const Ne=te.filter(Le=>!Le.serverPromptId&&Le.serverState==="submitting"&&Le.text===ae.text);if(Ne.length===1){const Le=te.indexOf(Ne[0]);if(Ae){te.splice(Le,1);continue}te[Le]={...Ne[0],serverPromptId:ae.promptId,serverState:ae.state};continue}ae.state==="running"||Ae||te.push({id:p.current++,sessionId:X,text:ae.text,serverPromptId:ae.promptId,serverState:ae.state})}EF(m.current,te)||(m.current=te,h(te))},[]),M=f.useCallback(async(Z=t)=>{if(!e||!Z||g.current!==Z)return"skipped";const X=++C.current;try{const te=await s.getPendingPrompts({sessionId:Z});return X!==C.current?"superseded":g.current!==Z?"skipped":(A(te.pendingPrompts.filter(ae=>ae.state==="queued"||ae.state==="running"),Z),"refreshed")}catch(te){return console.warn("Failed to refresh pending prompts",te),"failed"}},[e,s,t,A]),L=f.useCallback(Z=>{const X=g.current,te=Z.filter(Ne=>Ne.sessionId===void 0||Ne.sessionId===X);if(te.length===0)return;const ae=new Set(m.current.map(Ne=>Ne.id)),xe=te.filter(Ne=>!ae.has(Ne.id));if(xe.length===0)return;const Ae=[...m.current,...xe].sort((Ne,Le)=>Ne.id-Le.id);m.current=Ae,h(Ae)},[]),N=f.useCallback((Z,X,te)=>{var Ae,Ne,Le,ge;if(te!==void 0&&g.current!==te)return;const ae=((Ae=o.current)==null?void 0:Ae.getText())??"",xe=ae.trim()?`${Z}
${ae}`:Z;(Ne=o.current)==null||Ne.setText(xe),X&&X.length>0&&((Le=o.current)==null||Le.restoreImages(X)),(ge=o.current)==null||ge.focus()},[o]),O=f.useSyncExternalStore(rhe,nhe),B=f.useRef(O),$=f.useRef(void 0);f.useEffect(()=>{if(!e||!t)return;const Z=B.current!==O;if(B.current=O,!Z){if(m.current.length>0||r==="idle"||$.current===t)return;$.current=t}M()},[O,e,t,r,M]);const P=f.useSyncExternalStore(she,QD,QD);f.useEffect(()=>{var X;if(!t||P.length===0)return;const Z=[];for(const te of P){if(te.data.sessionId!==t)continue;Z.push(te);const ae=te.data.promptId;if(ae){if(te.type==="pending_prompt_started"){if(v.current.has(ae))continue;if((te.originatorClientId===void 0||te.originatorClientId===n)&&!y.current.has(ae)){const Ae=typeof te.data.text=="string"?te.data.text:"",Ne=m.current.find(ge=>ge.serverPromptId===ae)??m.current.find(ge=>!ge.serverPromptId&&ge.serverState==="submitting"&&ge.text===Ae),Le=(Ne==null?void 0:Ne.text)??"";Le&&(y.current.add(ae),i.appendLocalUserMessage(Le,MF(Ne==null?void 0:Ne.images),(X=Ne==null?void 0:Ne.inputAnnotations)!=null&&X.length?{inputAnnotations:Ne.inputAnnotations}:void 0))}M()}else if(te.type==="turn_complete"){y.current.delete(ae);const xe=w.current.get(ae);if(w.current.delete(ae),xe)xe();else if(!k.current.has(ae))for(k.current.add(ae),T.current.push(ae);T.current.length>Mot;){const Ae=T.current.shift();Ae&&k.current.delete(Ae)}}else if(te.type==="turn_error"||te.type==="pending_prompt_completed"&&te.data.state==="removed"){y.current.delete(ae);const xe=w.current.get(ae);w.current.delete(ae),xe==null||xe(),k.current.delete(ae),T.current=T.current.filter(Ae=>Ae!==ae)}}}ohe(Z)},[P,t,n,i,M]);const K=f.useCallback((Z,X)=>{if(k.current.delete(Z)){T.current=T.current.filter(te=>te!==Z),X();return}w.current.set(Z,X)},[]),F=f.useCallback((Z,X,te,ae)=>{const xe=Z.trim();if(!xe)return!0;const Ae=p.current++,Ne=g.current,Le=new AbortController;x.current.add(Le);const ge=X?[...X]:void 0,Oe=ae?[...ae]:void 0,Nt={id:Ae,sessionId:Ne,text:xe,images:ge,inputAnnotations:Oe,onComplete:te,serverState:"submitting"};return m.current=[...m.current,Nt],h(m.current),s.submitPrompt(xe,{images:X,inputAnnotations:Oe,optimisticUserMessage:!1,sessionId:Ne,signal:Le.signal}).then(Pe=>{if(x.current.delete(Le),g.current!==Ne){s.removePendingPrompt(Pe.promptId,{sessionId:Ne}).catch(Ge=>{console.warn("[useQueuedPrompts] cleanup removePendingPrompt failed after session change",{targetSessionId:Ne,promptId:Pe.promptId,error:Ge})});return}if(S.current==="idle"){y.current.has(Pe.promptId)||(y.current.add(Pe.promptId),i.appendLocalUserMessage(xe,MF(ge),Oe!=null&&Oe.length?{inputAnnotations:Oe}:void 0));const Ge=m.current.filter(St=>St.id!==Ae);m.current=Ge,h(Ge),te&&K(Pe.promptId,te);return}const Ce=m.current,Zt=Ce.findIndex(Ge=>Ge.id===Ae);if(Zt===-1){s.removePendingPrompt(Pe.promptId,{sessionId:Ne}).then(Ge=>{Ge.removed||M(Ne)},()=>{M(Ne)});return}const dt=[...Ce];dt[Zt]={...dt[Zt],serverPromptId:Pe.promptId,serverState:"queued"},m.current=dt,h(dt),te&&K(Pe.promptId,te)}).catch(Pe=>{if(x.current.delete(Le),g.current!==Ne||!m.current.some(Zt=>Zt.id===Ae))return;const Ce=m.current.filter(Zt=>Zt.id!==Ae);m.current=Ce,h(Ce),N(xe,ge,Ne),a(Pe,u("queue.queueFailed"))}),!0},[M,a,N,s,K,i,u]);f.useEffect(()=>{if(r!=="idle")return;const Z=b.current;Z&&(Z.abort(),b.current=null)},[r]);const H=f.useCallback(Z=>{const X=m.current;if(X.length===0)return null;const te=Z===void 0?X.length-1:X.findIndex(Ae=>Ae.id===Z);if(te<0)return null;const ae=X[te],xe=X.filter((Ae,Ne)=>Ne!==te);return m.current=xe,h(xe),(ae==null?void 0:ae.text)??null},[]),D=f.useCallback((Z,X)=>{const te=m.current.map(ae=>ae.id===Z?{...ae,...X}:ae);EF(te,m.current)||(m.current=te,h(te))},[]),Q=f.useCallback(async(Z,X,te)=>{if(!Z.serverPromptId)return!0;if(Z.serverState!=="queued"||v.current.has(Z.serverPromptId))return!1;const ae=Z.sessionId;v.current.add(Z.serverPromptId),D(Z.id,X);try{const xe=await s.removePendingPrompt(Z.serverPromptId,{sessionId:ae});return v.current.delete(Z.serverPromptId),xe.removed?(w.current.delete(Z.serverPromptId),await M(ae)==="failed"&&(D(Z.id,{isEditing:!1,isRemoving:!1}),a(new Error("Queue changed but pending prompts could not refresh"),te)),!0):(D(Z.id,{isEditing:!1,isRemoving:!1}),await M(ae),a(new Error("Prompt could not be removed from queue"),te),!1)}catch(xe){return v.current.delete(Z.serverPromptId),D(Z.id,{isEditing:!1,isRemoving:!1}),await M(ae)!=="refreshed"&&L([Z]),a(xe,te),!1}},[M,a,L,s,D]),U=f.useCallback(Z=>{const X=m.current.find(te=>te.id===Z);if((X==null?void 0:X.serverState)!=="submitting"&&X){if(!X.serverPromptId){const te=m.current.filter(ae=>ae.id!==Z);m.current=te,h(te);return}Q(X,{isRemoving:!0},u("queue.deleteFailed"))}},[Q,u]),j=f.useCallback(async Z=>{var Ne;const X=m.current.find(Le=>Le.id===Z);if(!X||(((Ne=X.images)==null?void 0:Ne.length)??0)>0||X.serverState==="submitting"||X.isEditing||X.isRemoving||yse(X.text))return;const te=X.serverPromptId?X.onComplete??w.current.get(X.serverPromptId):void 0,ae=()=>{X.serverPromptId&&w.current.delete(X.serverPromptId),te==null||te()};if(X.serverPromptId&&!await Q(X,{isRemoving:!0},u("queue.insertFailed")))return;let xe=b.current;xe||(xe=new AbortController,b.current=xe);let Ae;try{Ae=await s.enqueueMidTurnMessage(X.text,{signal:xe.signal})}catch(Le){X.serverPromptId&&(N(X.text,X.images,X.sessionId),ae()),a(Le,u("queue.insertFailed"));return}if(!Ae.accepted){X.serverPromptId&&(N(X.text,X.images,X.sessionId),ae()),a(new Error("Queued message was not accepted for insertion"),u("queue.insertFailed"));return}if(ae(),!X.serverPromptId){const Le=m.current.filter(ge=>ge.id!==Z);m.current=Le,h(Le)}l(u("queue.inserted"))},[Q,l,a,N,s,u]),ie=f.useCallback(async Z=>{const X=m.current.find(ae=>ae.id===Z);if(!X||X.serverState==="submitting"||X.isEditing||X.isRemoving)return;if(X.serverPromptId){if(!await Q(X,{isEditing:!0},u("queue.editFailed")))return;N(X.text,X.images,X.sessionId);return}const te=H(Z);te&&N(te,X.images,X.sessionId)},[H,Q,N,u]),oe=f.useCallback(()=>{const Z=m.current;if(Z.length===0)return!1;const X=Z[Z.length-1];if(!X)return!1;if(X.serverState==="submitting"||X.isEditing||X.isRemoving)return!0;if(!X.serverPromptId){const te=H(X.id);return te?(N(te,X.images,X.sessionId),!0):!1}return X.serverState!=="queued"?!1:((async()=>{await Q(X,{isEditing:!0},u("queue.editFailed"))&&N(X.text,X.images,X.sessionId)})().catch(te=>{a(te,u("queue.editFailed"))}),!0)},[H,Q,a,N,u]),J=f.useCallback(()=>{if(m.current.length===0)return!1;const Z=g.current,X=m.current.filter(Le=>Le.serverState==="submitting"),te=m.current.filter(Le=>Le.serverState!=="submitting");for(const Le of[...X].reverse())N(Le.text,Le.images,Le.sessionId);for(const Le of x.current)Le.abort();const ae=te.filter(Le=>Le.serverPromptId);if(ae.length===0)return m.current=[],h([]),i.dispatch([{type:"status",text:u("queue.cleared")}]),!0;const xe=new Set(m.current.map(Le=>Le.id)),Ae=new Set(ae.map(Le=>Le.serverPromptId).filter(Le=>!!Le));for(const Le of Ae)v.current.add(Le);const Ne=m.current.filter(Le=>!xe.has(Le.id)).concat(ae.map(Le=>({...Le,isRemoving:!0})));return m.current=Ne,h(Ne),(async()=>{var Nt;const Le=[];if(await Promise.all(ae.map(async Pe=>{const Ce=Pe.serverPromptId;try{if((await s.removePendingPrompt(Ce,{sessionId:Pe.sessionId})).removed){w.current.delete(Ce);return}Le.push(Pe)}catch{Le.push(Pe)}finally{v.current.delete(Ce)}})),g.current!==Z)return;const ge=Le.map(Pe=>({...Pe,isRemoving:!1})),Oe=m.current.filter(Pe=>Pe.serverPromptId?!Ae.has(Pe.serverPromptId):!xe.has(Pe.id)).concat(ge);if(m.current=Oe,h(Oe),Le.length>0){a(new Error("Some prompts could not be removed from queue"),u("queue.deleteFailed")),M((Nt=Le[0])==null?void 0:Nt.sessionId);return}i.dispatch([{type:"status",text:u("queue.cleared")}])})(),!0},[M,a,N,i,u,s]),{batches:V,consume:se}=Rhe();return f.useEffect(()=>{if(!t||V.length===0)return;const Z=Aot(m.current,V,t,n);Z&&(m.current=Z,h(Z)),se(V.filter(X=>X.sessionId===t))},[V,t,n,se]),{queuedPrompts:d,queuedTexts:_,enqueuePrompt:F,removeQueuedPrompt:U,insertQueuedPrompt:j,editQueuedPrompt:ie,editLastQueuedPrompt:oe,clearQueuedPrompts:J}}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */function mE(e){var t;return!((t=e==null?void 0:e.rawInput)!=null&&t.questions)||!Array.isArray(e.rawInput.questions)?!1:e.toolName?lc(e.toolName):!0}const Not=3e4;function v4(e){return U4.includes(e)}async function jot({sessionActions:e,modelId:t,modeId:n,workspaceCwd:r,onSessionCreated:s,onSessionAllocated:i,getCurrentSessionId:o,warn:a=console.warn}){const l=n&&v4(n)?n:void 0,{sessionId:u}=await e.createSession({workspaceCwd:r,sourceType:g4,...l?{approvalMode:l}:{}});i==null||i(u);let d="prepare new session";try{if(s){d="run onSessionCreated";let p;try{await Promise.race([s(u),new Promise((g,b)=>{p=setTimeout(()=>b(new Error("onSessionCreated timed out")),Not)})])}finally{clearTimeout(p)}}d="verify session identity";const h=o();if(h!==void 0&&h!==u)throw new Error(`Session changed before attach: expected ${u}, found ${h}`);d="attach new session",await e.attachSession(),d="verify attached session";const m=o();if(m!==void 0&&m!==u)throw new Error(`Session changed while attaching: expected ${u}, found ${m}`)}catch(h){a(`[WebShell] failed to ${d}:`,h),await e.releaseSession(u).catch(p=>{a("[WebShell] failed to release unattached session:",p)});const m=o();throw m===void 0||m===u?await e.clearSession().catch(p=>{a("[WebShell] failed to clear unattached session:",p)}):a(`[WebShell] skipping clearSession: expected ${u}, found ${m}`),h}t&&await e.setModel(t).catch(h=>{a("[WebShell] failed to set model for new session:",h)})}/**
 * @license
 * Copyright 2025 Qwen
 * SPDX-License-Identifier: Apache-2.0
 */const Iot=new Set(["coder-model(qwen-oauth)"]);function jb(e){return!Iot.has(e.id)}/**
 * @license
 * Copyright 2026 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const pE=["blue","green","purple","orange","yellow","red"];for(const e of pE){if(jj[e])continue;const t=`WorkspaceAccent.module.css is missing a class for the "${e}" accent`;console.error(t)}function Rot(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function Dot(e,t){if(!e)return;const r=((t==null?void 0:t.workspaces)??[]).findIndex(i=>i.cwd===e),s=r>=0?r:Rot(e);return pE[s%pE.length]}function xse(e){return[{name:"help",description:e("local.help")},{name:"theme",description:e("local.theme"),argumentHint:"light|dark",subcommands:["light","dark"]},{name:"language",description:e("local.language"),argumentHint:"ui [en|zh-CN]",subcommands:["ui"]},{name:"plan",description:e("local.plan"),argumentHint:"<prompt>"},{name:"btw",description:e("local.btw"),argumentHint:"<your question>"},{name:"copy",description:e("local.copy"),argumentHint:"[code|<lang>|latex|inline-latex] [index]"},{name:"delete",description:e("local.delete")},{name:"release",description:e("local.release")},{name:"auth",description:e("local.auth")},{name:"approval-mode",description:e("local.approvalMode"),argumentHint:"<mode>"},{name:"model",description:e("local.model"),argumentHint:"[--fast|--voice|--vision] [<model>]"},{name:"mcp",description:e("local.mcp"),argumentHint:"desc|nodesc|schema"},{name:"skills",description:e("local.skills")},{name:"status",description:e("local.status")},{name:"stats",description:e("local.stats"),argumentHint:"[model|tools]",subcommands:["model","tools"]},{name:"tools",description:e("local.tools"),argumentHint:"[desc]"},{name:"memory",description:e("local.memory")},{name:"context",description:e("local.context"),argumentHint:"[detail]"},{name:"agents",description:e("local.agents"),argumentHint:"manage|create"},{name:"goal",description:e("local.goal"),argumentHint:"[<condition> | clear]"},{name:"tasks",description:e("local.tasks")},{name:"recap",description:e("local.recap")},{name:"rewind",description:e("local.rewind")},{name:"branch",description:e("local.branch"),argumentHint:"[<name>]"},{name:"fork",description:e("local.fork"),argumentHint:"<directive>"},{name:"clear",description:e("local.clear")},{name:"new",description:e("local.new")},{name:"reset",description:e("local.reset")},{name:"rename",description:e("local.rename"),argumentHint:"[--auto] [<name>]"},{name:"resume",description:e("local.resume"),argumentHint:"<session-id>"},{name:"settings",description:e("local.settings")},{name:"schedule",description:e("local.schedule")},{name:"extensions",description:e("local.extensions"),argumentHint:"manage|install <source>",subcommands:["manage","install"]}].map(n=>({...n,source:"builtin-command"}))}const Lot={bug:"local.bug",compress:"local.compress","compress-fast":"local.compressFast",config:"local.config",diff:"local.diff",directory:"local.directory",docs:"local.docs",doctor:"local.doctor",dream:"local.dream",effort:"local.effort",export:"local.export",forget:"local.forget",hooks:"local.hooks","import-config":"local.importConfig",init:"local.init",insight:"local.insight",lsp:"local.lsp",remember:"local.remember",summary:"local.summary",workflows:"local.workflows"},Pot={batch:"skilldesc.batch",dataviz:"skilldesc.dataviz","extension-creator":"skilldesc.extensionCreator",loop:"skilldesc.loop","new-app":"skilldesc.newApp","qc-helper":"skilldesc.qcHelper",review:"skilldesc.review",simplify:"skilldesc.simplify",stuck:"skilldesc.stuck","agent-reproduce-align":"skilldesc.agentReproduceAlign","agent-reproduce-feature":"skilldesc.agentReproduceFeature",autofix:"skilldesc.autofix",bugfix:"skilldesc.bugfix",codegraph:"skilldesc.codegraph","create-issue":"skilldesc.createIssue","desktop-pet":"skilldesc.desktopPet","docs-audit-and-refresh":"skilldesc.docsAuditAndRefresh","docs-update-from-diff":"skilldesc.docsUpdateFromDiff","e2e-testing":"skilldesc.e2eTesting","feat-dev":"skilldesc.featDev","memory-leak-debug":"skilldesc.memoryLeakDebug","openwork-desktop-sync":"skilldesc.openworkDesktopSync","prepare-pr":"skilldesc.preparePr","qwen-code-claw":"skilldesc.qwenCodeClaw","structured-debugging":"skilldesc.structuredDebugging","terminal-capture":"skilldesc.terminalCapture","tmux-real-user-testing":"skilldesc.tmuxRealUserTesting",triage:"skilldesc.triage"};function wse(e){return Pot[e]}function kse(e,t){return e.map(n=>{const r=Lot[n.name];return!r||n.source&&n.source!=="builtin-command"?n:{...n,description:t(r)}})}function _se(...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()]}const Oot="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",Bot="/assets/insert-DmRbh9Rv.svg",$ot="/assets/queue-DWpnpFgW.svg",zot="_app_at7n9_1",Fot="_appChat_at7n9_43",qot="_appChatEmpty_at7n9_49",Hot="_appShell_at7n9_54",Uot="_chatPane_at7n9_62",Vot="_artifactResizeHandle_at7n9_71",Wot="_chatPaneShowingPage_at7n9_91",Got="_fullPage_at7n9_97",Kot="_fullPageHeader_at7n9_106",Yot="_splitApprovalNotice_at7n9_116",Xot="_fullPageBack_at7n9_142",Qot="_fullPageTitle_at7n9_159",Jot="_fullPageBody_at7n9_164",Zot="_mobileDrawer_at7n9_171",eat="_mobileBackdrop_at7n9_175",tat="_mobileDrawerForced_at7n9_182",nat="_hamburgerButton_at7n9_210",rat="_mobileDrawerOpen_at7n9_255",sat="_hamburgerButtonFloating_at7n9_290",iat="_appWithSidebar_at7n9_298",oat="_themeDark_at7n9_334",aat="_themeLight_at7n9_402",lat="_content_at7n9_470",cat="_contentHasMessages_at7n9_478",uat="_missingSessionState_at7n9_487",dat="_missingSessionMessage_at7n9_500",hat="_missingSessionButton_at7n9_507",fat="_panelHost_at7n9_542",mat="_panelHeader_at7n9_550",pat="_panelBack_at7n9_560",gat="_panelTitle_at7n9_586",bat="_panelBody_at7n9_595",yat="_chatViewWrap_at7n9_607",vat="_chatViewHidden_at7n9_615",xat="_chatSubtree_at7n9_619",wat="_chatSubtreeHidden_at7n9_623",kat="_footer_at7n9_636",_at="_bottomPanels_at7n9_646",Sat="_approvalOverlay_at7n9_661",Cat="_scrollToBottomLayer_at7n9_675",Tat="_scrollToBottomLayerWithTodos_at7n9_686",Aat="_scrollToBottomButton_at7n9_693",Eat="_scrollToBottomIcon_at7n9_722",Mat="_btwPanel_at7n9_728",Nat="_composer_at7n9_735",jat="_composerHeader_at7n9_740",Iat="_customFooter_at7n9_744",Rat="_escClearStatus_at7n9_750",Dat="_emptyWelcomeFooter_at7n9_757",Lat="_mobileWelcomeFooterMiddle_at7n9_761",Pat="_mobileWelcomeGroup_at7n9_765",Oat="_chatPaneWithMobileComposerBottom_at7n9_770",Bat="_chatViewWithMobileComposerBottom_at7n9_775",$at="_chatViewWithWelcomeMiddle_at7n9_788",zat="_footerWithCustomFooter_at7n9_788",Fat="_desktopWelcomeFooter_at7n9_822",qat="_queuedPrompts_at7n9_831",Hat="_queuedPrompt_at7n9_831",Uat="_queuedPromptIcon_at7n9_861",Vat="_queuedPromptMaskIcon_at7n9_871",Wat="_queuedPromptActionIcon_at7n9_872",Gat="_queuedPromptText_at7n9_885",Kat="_queuedPromptState_at7n9_893",Yat="_queuedPromptSpinner_at7n9_901",Xat="_queuedPromptActions_at7n9_916",Qat="_queuedPromptAction_at7n9_872",Jat="_queuedHint_at7n9_961",Ut={app:zot,appChat:Fot,appChatEmpty:qot,appShell:Hot,chatPane:Uot,artifactResizeHandle:Vot,chatPaneShowingPage:Wot,fullPage:Got,fullPageHeader:Kot,splitApprovalNotice:Yot,fullPageBack:Xot,fullPageTitle:Qot,fullPageBody:Jot,mobileDrawer:Zot,mobileBackdrop:eat,mobileDrawerForced:tat,hamburgerButton:nat,mobileDrawerOpen:rat,hamburgerButtonFloating:sat,appWithSidebar:iat,themeDark:oat,themeLight:aat,content:lat,contentHasMessages:cat,missingSessionState:uat,missingSessionMessage:dat,missingSessionButton:hat,panelHost:fat,panelHeader:mat,panelBack:pat,panelTitle:gat,panelBody:bat,chatViewWrap:yat,chatViewHidden:vat,chatSubtree:xat,chatSubtreeHidden:wat,footer:kat,bottomPanels:_at,approvalOverlay:Sat,scrollToBottomLayer:Cat,scrollToBottomLayerWithTodos:Tat,scrollToBottomButton:Aat,scrollToBottomIcon:Eat,btwPanel:Mat,composer:Nat,composerHeader:jat,customFooter:Iat,escClearStatus:Rat,emptyWelcomeFooter:Dat,mobileWelcomeFooterMiddle:Lat,mobileWelcomeGroup:Pat,chatPaneWithMobileComposerBottom:Oat,chatViewWithMobileComposerBottom:Bat,chatViewWithWelcomeMiddle:$at,footerWithCustomFooter:zat,desktopWelcomeFooter:Fat,queuedPrompts:qat,queuedPrompt:Hat,queuedPromptIcon:Uat,queuedPromptMaskIcon:Vat,queuedPromptActionIcon:Wat,queuedPromptText:Gat,queuedPromptState:Kat,queuedPromptSpinner:Yat,queuedPromptActions:Xat,queuedPromptAction:Qat,queuedHint:Jat},NF=240;function Sse({prompts:e,t,onDelete:n,onInsert:r,onEdit:s}){return e.length===0?null:c.jsxs("div",{className:Ut.queuedPrompts,children:[e.map(i=>{var v;const o=i.text.replace(/\s+/g," ").trim(),a=o.length>NF?`${o.slice(0,NF)}...`:o,l=((v=i.images)==null?void 0:v.length)??0,u=yse(i.text),d=i.serverState==="submitting",h=i.serverState==="running",m=i.isRemoving===!0,p=d||h||i.isEditing===!0||m;let g=t("queue.insertTip");p?g=t("queue.submittingDisabled"):u&&(g=t("queue.insertCommandDisabled"));let b=t("queue.editTip");p&&(b=t("queue.submittingDisabled"));const x=t(p?"queue.submittingDisabled":"queue.deleteTip");return c.jsxs("div",{className:Ut.queuedPrompt,children:[c.jsx("span",{className:Ut.queuedPromptIcon,"aria-hidden":"true",children:c.jsx("span",{className:Ut.queuedPromptMaskIcon,style:Th("--queued-icon-url",$ot)})}),c.jsxs("span",{className:Ut.queuedPromptText,children:[a,l>0?` ${t("queue.imageCount",{count:l})}`:"",d||i.isEditing||m?c.jsxs("span",{className:Ut.queuedPromptState,children:[c.jsx("span",{className:Ut.queuedPromptSpinner}),m?t("queue.removing"):i.isEditing?t("queue.editing"):t("queue.submitting")]}):null]}),c.jsxs("span",{className:Ut.queuedPromptActions,children:[l===0&&c.jsxs("button",{type:"button",className:Ut.queuedPromptAction,onClick:()=>r(i.id),disabled:u||p,title:g,children:[c.jsx("span",{className:Ut.queuedPromptActionIcon,style:Th("--queued-icon-url",Bot),"aria-hidden":"true"}),t("queue.insert")]}),c.jsx("button",{type:"button",className:Ut.queuedPromptAction,onClick:()=>n(i.id),disabled:p,"aria-label":t("queue.delete"),title:x,children:c.jsx("span",{className:Ut.queuedPromptActionIcon,style:Th("--queued-icon-url",Oot),"aria-hidden":"true"})}),c.jsx("button",{type:"button",className:Ut.queuedPromptAction,onClick:()=>s(i.id),disabled:p,"aria-label":t("queue.edit"),title:b,children:c.jsx("span",{className:Ut.queuedPromptActionIcon,style:Th("--queued-icon-url",Kre),"aria-hidden":"true"})})]})]},i.id)}),c.jsx("div",{className:Ut.queuedHint,children:t("queue.footer")})]})}const Zat="_approval_j86la_1",elt="_floating_j86la_18",tlt="_header_j86la_31",nlt="_icon_j86la_41",rlt="_name_j86la_56",slt="_desc_j86la_67",ilt="_content_j86la_87",olt="_code_j86la_105",alt="_codeBlock_j86la_113",llt="_question_j86la_133",clt="_options_j86la_139",ult="_option_j86la_139",dlt="_optionPlain_j86la_167",hlt="_optionSecondary_j86la_177",flt="_optionPrimary_j86la_184",mlt="_optionActive_j86la_195",plt="_pointer_j86la_199",glt="_num_j86la_203",blt="_label_j86la_207",si={approval:Zat,floating:elt,header:tlt,icon:nlt,name:rlt,desc:slt,content:ilt,code:olt,codeBlock:alt,question:llt,options:clt,option:ult,optionPlain:dlt,optionSecondary:hlt,optionPrimary:flt,optionActive:mlt,pointer:plt,num:glt,label:blt};function ylt(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 vlt(e){const t=[];for(const n of e.content)n.type==="text"&&n.text&&t.push(n.text);return t.join(`
`)}function xlt(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 wlt(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 klt(e){var n;const t=(n=e.rawInput)==null?void 0:n.description;return typeof t=="string"&&t.trim()?t.trim():e.title}function jF(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 IF(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 ok(e){return e.map((t,n)=>({option:t,index:n})).sort((t,n)=>{const r=IF(t.option)-IF(n.option);return r===0?t.index-n.index:r}).map(({option:t})=>t)}function _lt(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 Slt(e){return e.kind==="allow_once"?si.optionPrimary:e.kind==="allow_always"?si.optionSecondary:e.kind==="reject_once"||e.kind==="reject_always"?si.optionPlain:si.optionSecondary}function Cse({request:e,onConfirm:t,variant:n="inline",keyboardActive:r=!0}){const{t:s}=gt(),i=f.useMemo(()=>ok(e.options),[e.options]),[o,a]=f.useState(()=>jF(ok(e.options))),l=f.useRef(e);l.current=e;const u=f.useRef(o),d=f.useRef(!1),h=f.useRef(!1);f.useEffect(()=>{const S=jF(ok(l.current.options));d.current=!1,h.current=!1,u.current=S,a(S)},[e.id]);const m=ylt(e.title),p=e.toolName||m.toolName||e.kind||"Tool",g=hu(p,s),b=klt(e),x=vlt(e),v=f.useCallback(S=>{d.current||(d.current=!0,t(l.current.id,S))},[t]),y=f.useCallback(S=>{if(S.defaultPrevented||Ag(S.target))return;const C=l.current,_=ok(C.options),A=_.length;if(S.key==="ArrowUp"||S.key==="k")S.preventDefault(),h.current=!0,a(M=>{const L=(M-1+A)%A;return u.current=L,L});else if(S.key==="ArrowDown"||S.key==="j")S.preventDefault(),h.current=!0,a(M=>{const L=(M+1)%A;return u.current=L,L});else if(S.key==="Enter"){if(S.preventDefault(),!h.current){h.current=!0;return}const M=_[u.current];M&&v(M.id)}else if(S.key==="Escape"){S.preventDefault();const M=C.options.find(L=>L.kind==="reject_once"||L.kind==="reject_always");M&&v(M.id)}else if(S.key>="1"&&S.key<="9"){const M=parseInt(S.key)-1;M<A&&(S.preventDefault(),h.current=!0,v(_[M].id))}},[v]);f.useEffect(()=>{if(!r)return;const S=setTimeout(()=>{window.addEventListener("keydown",y)},250);return()=>{clearTimeout(S),window.removeEventListener("keydown",y)}},[y,r]);const w=xlt(e),k=xce(e.toolName),T=wlt(e);return c.jsxs("div",{className:n==="floating"?`${si.approval} ${si.floating}`:si.approval,"data-web-shell-permission-panel":!0,children:[c.jsxs("div",{className:si.header,children:[c.jsx("span",{className:si.icon,children:"?"}),c.jsx("span",{className:si.name,children:g})]}),b&&c.jsx("div",{className:si.desc,title:b,children:b}),w&&T?c.jsx("div",{className:si.code,children:c.jsx("pre",{className:si.codeBlock,title:T,children:T})}):x&&x!==e.title?c.jsx("pre",{className:si.content,title:x,children:x}):null,c.jsx("div",{className:si.question,children:k?s("approval.launchAgentQuestion"):w?s("approval.execQuestion",{tool:g}):s("approval.changeQuestion")}),c.jsx("div",{className:si.options,children:i.map((S,C)=>{const _=C===o,A=_lt(S),M=A?s(A):S.label;return c.jsxs("div",{className:`${si.option} ${Slt(S)} ${_?si.optionActive:""}`,"data-web-shell-permission-option":!0,"data-option-id":S.id,onClick:()=>v(S.id),children:[c.jsx("span",{className:si.pointer,children:_?"›":" "}),c.jsxs("span",{className:si.num,children:[C+1,"."]}),c.jsx("span",{className:si.label,children:M})]},S.id)})})]})}const Clt="_question_14a07_1",Tlt="_floating_14a07_18",Alt="_titleLine_14a07_30",Elt="_icon_14a07_38",Mlt="_toolName_14a07_42",Nlt="_toolDesc_14a07_46",jlt="_tabs_14a07_53",Ilt="_topRight_14a07_63",Rlt="_collapseButton_14a07_70",Dlt="_collapseIcon_14a07_89",Llt="_collapseIconCollapsed_14a07_95",Plt="_collapsed_14a07_99",Olt="_tab_14a07_53",Blt="_tabActive_14a07_118",$lt="_text_14a07_135",zlt="_description_14a07_143",Flt="_multiHint_14a07_151",qlt="_options_14a07_157",Hlt="_option_14a07_157",Ult="_optionActive_14a07_179",Vlt="_optionSelected_14a07_180",Wlt="_optionLabel_14a07_185",Glt="_pointer_14a07_190",Klt="_optionNum_14a07_194",Ylt="_editIcon_14a07_211",Xlt="_optionContent_14a07_243",Qlt="_optionPlaceholder_14a07_259",Jlt="_optionDesc_14a07_264",Zlt="_customInput_14a07_271",ect="_actions_14a07_288",tct="_button_14a07_296",nct="_submitButton_14a07_322",rct="_ignoreButton_14a07_328",hr={question:Clt,floating:Tlt,titleLine:Alt,icon:Elt,toolName:Mlt,toolDesc:Nlt,tabs:jlt,topRight:Ilt,collapseButton:Rlt,collapseIcon:Dlt,collapseIconCollapsed:Llt,collapsed:Plt,tab:Olt,tabActive:Blt,text:$lt,description:zlt,multiHint:Flt,options:qlt,option:Hlt,optionActive:Ult,optionSelected:Vlt,optionLabel:Wlt,pointer:Glt,optionNum:Klt,editIcon:Ylt,optionContent:Xlt,optionPlaceholder:Qlt,optionDesc:Jlt,customInput:Zlt,actions:ect,button:tct,submitButton:nct,ignoreButton:rct};function Tse({request:e,onConfirm:t,variant:n="inline"}){const{t:r}=gt(),s=f.useMemo(()=>{var F;return Array.isArray((F=e.rawInput)==null?void 0:F.questions)?e.rawInput.questions:[]},[e.rawInput]),[i,o]=f.useState(0),[a,l]=f.useState(null),[u,d]=f.useState({}),[h,m]=f.useState({}),[p,g]=f.useState({}),[b,x]=f.useState(!1),[v,y]=f.useState(!1),w=f.useRef(!1);f.useEffect(()=>{const F=s[0];w.current=!1,y(!1),o(0),l(F!=null&&F.options.length?0:null),d(F&&!F.multiSelect&&F.options[0]?{0:F.options[0].label}:{}),m({}),g(F!=null&&F.multiSelect&&F.options[0]?{0:[F.options[0].label]}:{}),x(!1)},[s,e.id]);const k=s[i],T=(k==null?void 0:k.multiSelect)??!1,S=f.useCallback(()=>{const F={};for(let H=0;H<s.length;H++){const D=s[H];if(D)if(D.multiSelect){const Q=p[H]||[],U=h[H],j=U?[...Q,U]:Q;F[String(H)]=j.join(", ")}else F[String(H)]=u[H]||h[H]||""}return F},[s,p,h,u]),C=f.useCallback(()=>{if(w.current)return;const F=e.options.find(H=>H.kind==="allow_once");F&&(w.current=!0,t(e.id,F.id,S()))},[S,e,t]),_=f.useCallback(()=>{if(w.current)return;const F=e.options.find(H=>H.kind==="reject_once"||H.kind==="reject_always");F&&(w.current=!0,t(e.id,F.id,void 0))},[e,t]),A=f.useCallback(F=>{F!==void 0&&m(H=>({...H,[i]:F})),T||d(H=>{if(!(i in H))return H;const D={...H};return delete D[i],D}),x(!0)},[i,T]),M=f.useCallback(F=>{if(!k)return;if(F===k.options.length){A();return}const D=k.options[F].label;if(T){const Q=p[i]||[],U=Q.includes(D)?Q.filter(j=>j!==D):[...Q,D];g({...p,[i]:U})}else{const Q={...u,[i]:D};d(Q),m(U=>{if(!(i in U))return U;const j={...U};return delete j[i],j})}},[k,i,T,p,u,A]),L=f.useCallback(F=>{if(!k||!T)return;if(F===k.options.length){A();return}const H=k.options[F].label,D=p[i]||[],Q=D.includes(H)?D.filter(U=>U!==H):[...D,H];g({...p,[i]:Q})},[k,T,p,i,A]);if(s.length===0)return null;const N=F=>{const H=s[F];return H?H.multiSelect?(p[F]||[]).length>0||!!h[F]:!!u[F]||!!h[F]:!1},O=s.every((F,H)=>N(H)),B=Math.min(i,s.length-1),$=F=>{const H=s[F];if(o(F),x(!1),!(H!=null&&H.options.length)){l(null);return}if(l(0),H.multiSelect){g(D=>(D[F]||[]).length>0||h[F]?D:{...D,[F]:[H.options[0].label]});return}d(D=>D[F]||h[F]?D:{...D,[F]:H.options[0].label})},P=()=>{i<=0||$(i-1)},K=()=>{i>=s.length-1||$(i+1)};return c.jsxs("div",{className:`${hr.question} ${n==="floating"?hr.floating:""} ${v?hr.collapsed:""}`,children:[c.jsxs("div",{className:hr.titleLine,children:[c.jsx("span",{className:hr.icon,children:"?"}),c.jsx("span",{className:hr.toolName,children:hu("ask_user_question",r)}),c.jsx("span",{className:hr.toolDesc,children:r("askUser.progress",{current:B+1,total:s.length})}),c.jsxs("div",{className:hr.topRight,children:[c.jsx("div",{className:hr.tabs,children:s.map((F,H)=>c.jsx("span",{className:`${hr.tab} ${H===i?hr.tabActive:""}`,"aria-hidden":"true"},H))}),c.jsx("button",{type:"button",className:hr.collapseButton,onClick:()=>y(F=>!F),"aria-expanded":!v,"aria-label":r(v?"common.expand":"common.collapse"),title:r(v?"common.expand":"common.collapse"),children:c.jsx("svg",{viewBox:"0 0 16 16",className:`${hr.collapseIcon} ${v?hr.collapseIconCollapsed:""}`,children:c.jsx("path",{d:"M4 6l4 4 4-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})})]})]}),!v&&c.jsxs(c.Fragment,{children:[k?c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:hr.text,children:[k.question,T&&c.jsxs("span",{className:hr.multiHint,children:[" ","(",r("askUser.multiHint"),")"]})]}),c.jsx("p",{className:hr.description,children:r("askUser.selectAnswer")}),c.jsxs("div",{className:hr.options,onMouseLeave:()=>l(null),children:[k.options.map((F,H)=>{const D=H===a,Q=T?(p[i]||[]).includes(F.label):u[i]===F.label;return c.jsxs("div",{className:`${hr.option} ${D?hr.optionActive:""} ${Q?hr.optionSelected:""}`,onClick:()=>{l(H),T?L(H):M(H)},onMouseEnter:()=>l(H),children:[c.jsx("span",{className:hr.pointer,children:D?"›":" "}),c.jsx("span",{className:hr.optionNum,children:H+1}),c.jsxs("span",{className:hr.optionContent,children:[c.jsx("span",{className:hr.optionLabel,children:F.label}),F.description&&c.jsx("span",{className:hr.optionDesc,children:F.description})]})]},F.label)}),(()=>{const F=a===k.options.length,H=!!h[i];return c.jsxs("div",{className:`${hr.option} ${F?hr.optionActive:""} ${H?hr.optionSelected:""}`,onClick:()=>{l(k.options.length),A()},onMouseEnter:()=>l(k.options.length),children:[c.jsx("span",{className:hr.pointer,children:F?"›":" "}),c.jsx("span",{className:hr.editIcon,"aria-hidden":"true",children:c.jsx("svg",{viewBox:"0 0 16 16",children:c.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"})})}),b?c.jsx("input",{type:"text",className:hr.customInput,placeholder:r("askUser.typePlaceholder"),value:h[i]||"",onChange:D=>m({...h,[i]:D.target.value}),onBlur:()=>x(!1),autoFocus:!0}):c.jsx("span",{className:`${hr.optionLabel} ${h[i]?"":hr.optionPlaceholder}`,children:h[i]||r("askUser.typePlaceholder")})]})})()]})]}):null,c.jsxs("div",{className:hr.actions,children:[c.jsx("button",{type:"button",className:hr.ignoreButton,onClick:_,children:r("askUser.ignore")}),s.length>1&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:hr.button,disabled:i<=0,onClick:P,children:r("common.previous")}),c.jsx("button",{type:"button",className:hr.button,disabled:i>=s.length-1,onClick:K,children:r("common.next")})]}),c.jsx("button",{type:"button",className:`${hr.button} ${hr.submitButton}`,disabled:!O,onClick:C,children:r("askUser.submit")})]})]})]})}const sct=1e6;function Ase(e){const t=new Set;e.callId&&t.add(e.callId),e.parentToolCallId&&t.add(e.parentToolCallId);for(const n of e.subTools??[])for(const r of Ase(n))t.add(r);return Array.from(t)}function Ese(e,t,n){const r=new Map,s=[];let i=null;for(const a of e){if(a.role==="user"||a.role==="user_shell"){i=a.id;continue}if(i||(i=a.id),a.role==="tool_group")for(const l of a.tools){for(const u of Ase(l))r.set(u,i);Mse(l,i,s)}}const o=new Map;for(const a of t){const l=ict(s,a,n);if(l.size===0&&a.toolCallId){const u=r.get(a.toolCallId);u&&l.add(u)}for(const u of l){const d=o.get(u);d?d.some(h=>h.id===a.id)||d.push(a):o.set(u,[a])}}return o}function Mse(e,t,n){e.toolName.toLowerCase()==="record_artifact"&&n.push({turnId:t,workspacePath:Uu(e.args,"workspacePath"),managedId:Uu(e.args,"managedId"),url:Uu(e.args,"url")});for(const r of e.subTools??[])Mse(r,t,n)}function ict(e,t,n){const r=new Set;for(const s of e){if(s.workspacePath&&t.workspacePath&&Ose(s.workspacePath,t.workspacePath,n)){r.add(s.turnId);continue}if(s.managedId&&s.managedId===t.managedId){r.add(s.turnId);continue}s.url&&s.url===t.url&&r.add(s.turnId)}return r}function Nse(e,t,n){const r=new Map;let s=null;for(const i of e){if(i.role==="user"||i.role==="user_shell"){s=i.id;continue}if(s||(s=i.id),i.role!=="tool_group")continue;const o=new Set((t.get(s)??[]).map(a=>rp(a.workspacePath)).filter(a=>!!a));for(const a of i.tools)Rse(a,s,o,r,n)}return r}function jse(e){const t=new Map;let n=null;for(const r of e){if(r.role==="user"||r.role==="user_shell"){n=r.id;continue}if(n||(n=r.id),r.role==="tool_group")for(const s of r.tools)Ise(s,n,t)}return t}function Ise(e,t,n){const r=oct(e);if(r){const s=n.get(t);s?s.push(r):n.set(t,[r])}for(const s of e.subTools??[])Ise(s,t,n)}function oct(e){if(e.status!=="completed"||e.toolName.toLowerCase()!=="cron_create")return null;const t=Pj(e);if(t!=null&&t.error)return null;const n=Uu(e.args,"cron"),r=Uu(e.args,"prompt");if(!n||!r)return null;const s=Uu(t,"returnDisplay")??Uu(t,"llmContent")??(typeof e.rawOutput=="string"?e.rawOutput:void 0),i=s?Dse(s):void 0;return{id:s?hct(s)??e.callId:e.callId,toolCallId:e.callId,title:fct(r),cron:n,prompt:r,recurring:RF(e.args,"recurring")??!0,durable:RF(e.args,"durable")??!1,...i?{display:i}:{}}}function Rse(e,t,n,r,s){const i=act(e,n,s);if(i){const o=r.get(t);o?mct(o,i):r.set(t,[i])}for(const o of e.subTools??[])Rse(o,t,n,r,s)}function act(e,t,n){if(e.status!=="completed")return null;const r=e.toolName.toLowerCase();if(r!=="write_file"&&r!=="edit")return null;const s=lct(e);if(!s)return null;const i=rp(s),o=cct(e),a=dct(e),l=uct(a);return{path:s,status:o,toolCallId:e.callId,isArtifact:Array.from(t).some(u=>Ose(i,u,n)),...l?{additions:l.additions,deletions:l.deletions}:{},diffs:a}}function lct(e){var n,r;const t=r2(e.args,"file_path","filePath","path");if(t!==void 0&&t.length>0)return t;for(const s of e.content??[])if(s.path)return s.path;return(r=(n=e.locations)==null?void 0:n[0])==null?void 0:r.file}function Uu(e,...t){if(e)for(const n of t){const r=e[n];if(typeof r=="string"&&r.trim())return r}}function r2(e,...t){if(e)for(const n of t){const r=e[n];if(typeof r=="string")return r}}function cct(e){if(e.toolName.toLowerCase()==="write_file")return"created";const t=Pj(e),n=(Uu(t,"returnDisplay")??"").toLowerCase();return n.includes("created new file")||n.includes("successfully created")||n.includes("created and wrote")?"created":"modified"}function uct(e){const t=Lse(e);return t?Pse(t.oldText,t.newText):void 0}function dct(e){const t=Pj(e),n=r2(t,"originalContent"),r=r2(t,"newContent");if(n!==void 0||r!==void 0)return[{oldText:n??"",newText:r??"",fileDiff:Uu(t,"fileDiff"),fullContent:!0}];const s=[];for(const i of e.content??[])i.type==="diff"&&s.push({oldText:i.oldText??"",newText:i.newText??""});if(s.length>0)return s;if(e.toolName.toLowerCase()==="write_file"){const i=r2(e.args,"content");return i!==void 0?[{oldText:"",newText:i,fullContent:!0}]:[]}return[]}function Pj(e){return e.rawOutput&&typeof e.rawOutput=="object"?e.rawOutput:void 0}function RF(e,t){const n=e==null?void 0:e[t];return typeof n=="boolean"?n:void 0}function Dse(e){return e.split(/\r\n|\r|\n/).map(t=>t.trim()).find(Boolean)}function hct(e){const t=e.match(/\bScheduled\s+(?:(?:recurring job|one-shot task)\s+([a-z0-9_-]+)\b|([a-z0-9_-]+)\s*\()/i);return(t==null?void 0:t[1])??(t==null?void 0:t[2])}function fct(e){const t=Dse(e)??e.trim();return t.length>36?`${t.slice(0,36)}...`:t}function mct(e,t){const n=rp(t.path),r=e.findIndex(h=>rp(h.path)===n);if(r<0){e.push(t);return}const s=e[r],{additions:i,deletions:o,...a}=s,l=pct(s.diffs,t.diffs),u=Lse(l),d=u?Pse(u.oldText,u.newText):void 0;e[r]={...a,status:s.status==="created"||t.status==="created"?"created":"modified",isArtifact:s.isArtifact||t.isArtifact,...d?{additions:d.additions,deletions:d.deletions}:{},diffs:l}}function pct(e,t){const n=[...e,...t];if(!n.every(i=>i.fullContent))return n;const r=n[0],s=n.at(-1);return!r||!s?n:[{oldText:r.oldText,newText:s.newText,fullContent:!0}]}function Lse(e){const t=e.at(-1);return t!=null&&t.fullContent?t:void 0}function Pse(e,t){const n=DF(e),r=DF(t);if(n.length*r.length>sct)return;const s=gct(n,r);return{additions:r.length-s,deletions:n.length-s}}function DF(e){return e?e.replace(/\r?\n$/,"").split(/\r\n|\r|\n/):[]}function gct(e,t){const n=new Array(t.length+1).fill(0),r=new Array(t.length+1).fill(0);for(const s of e){for(let i=0;i<t.length;i++)r[i+1]=s===t[i]?n[i]+1:Math.max(n[i+1],r[i]);for(let i=0;i<r.length;i++)n[i]=r[i];r.fill(0)}return n[t.length]??0}function Ose(e,t,n){return Pre(e,t,n)}const bct="_pane_4s0kf_1",yct="_header_4s0kf_13",vct="_workspaceTag_4s0kf_36",xct="_workspaceTagDot_4s0kf_52",wct="_workspaceTagText_4s0kf_60",kct="_connectionError_4s0kf_69",_ct="_connectionErrorText_4s0kf_77",Sct="_title_4s0kf_84",Cct="_closeButton_4s0kf_95",Tct="_maximizeButton_4s0kf_96",Act="_body_4s0kf_124",Ect="_footer_4s0kf_132",Mct="_approval_4s0kf_138",na={pane:bct,header:yct,workspaceTag:vct,workspaceTagDot:xct,workspaceTagText:wct,connectionError:kct,connectionErrorText:_ct,title:Sct,closeButton:Cct,maximizeButton:Tct,body:Act,footer:Ect,approval:Mct},LF=["approvalMode","model","voice"];function Nct({title:e,workspaceCwd:t,onClose:n,onToggleMaximize:r,isMaximized:s=!1,onError:i,onRightPanelOpen:o,onPaneArtifactsChange:a,messageTurnOutputs:l}){var Y,je;const{t:u}=gt(),d=il(),h=Fg(),m=ko(),p=pd(),g=gse(u),b=jv(),x=G4(),v=K4(),{artifacts:y}=bse();f.useEffect(()=>{const We=d.sessionId;if(We)return a==null||a(We,y,m),()=>{a==null||a(We,[],m)}},[y,d.sessionId,a,m]);const w=f.useRef(v);w.current=v;const k=f.useRef(null),{followupState:T,onAcceptFollowup:S,onDismissFollowup:C,clear:_}=vW({onAccept:We=>{var Te;(Te=k.current)==null||Te.insertText(We)}}),A=f.useCallback((We,Te)=>{i?i(We,Te):console.error(Te,We)},[i]),M=f.useCallback(We=>x.dispatch([{type:"status",text:We}]),[x]),L=f.useMemo(()=>G8(b),[b]),N=mE(L),O=L&&!N?L:null,B=L&&N?L:null,$=f.useRef(O);$.current=O;const P=O!==null||B!==null,K=v!=="idle",F=f.useMemo(()=>Ese(g,y,d.workspaceCwd||""),[g,y,d.workspaceCwd]),H=f.useMemo(()=>Nse(g,F,d.workspaceCwd||""),[g,F,d.workspaceCwd]),D=f.useMemo(()=>jse(g),[g]),Q=f.useMemo(()=>new Set(l??Bre),[l]),{queuedPrompts:U,queuedTexts:j,enqueuePrompt:ie,removeQueuedPrompt:oe,insertQueuedPrompt:J,editQueuedPrompt:V,editLastQueuedPrompt:se,clearQueuedPrompts:Z}=vse({connected:d.status==="connected",sessionId:d.sessionId,clientId:d.clientId,streamingState:v,sessionActions:h,store:x,editorRef:k,reportError:A,notifySuccess:M,t:u}),X=f.useMemo(()=>{if(K)for(let We=g.length-1;We>=0;We--){const Te=g[We];if((Te==null?void 0:Te.role)==="user")return Te.timestamp}},[g,K]),te=f.useCallback((We,Te,jt,zt)=>{const bn=We.trim();if(!bn||d.status!=="connected")return!1;const Pn=zt==null?void 0:zt.inputAnnotations;return w.current==="idle"?(h.sendPrompt(bn,{...Te&&Te.length?{images:Te}:{},...Pn?{inputAnnotations:Pn}:{},onAdmitted:()=>{_(),jt==null||jt()}}).catch(qe=>A(qe,"Failed to send prompt")),!1):Pn?ie(bn,Te,void 0,Pn):ie(bn,Te)},[h,_,d.status,ie,A]),ae=f.useCallback((We,Te,jt)=>{h.submitPermission(We,Te,jt).catch(zt=>A(zt,"Failed to submit permission choice"))},[h,A]),xe=f.useCallback(()=>{h.cancel().catch(We=>A(We,"Failed to cancel request"))},[h,A]),Ae=f.useCallback(We=>{if(o){if(We.kind==="artifact"||We.kind==="scheduled_task"){o({...We,workspaceActions:m});return}o(We)}},[o,m]),Ne=f.useMemo(()=>kse(_se(d.commands??[],xse(u)),u).map(We=>{const Te=wse(We.name);return Te?{...We,displayCategory:"skill",description:u(Te)}:We}),[d.commands,u]),Le=f.useMemo(()=>(d.models??[]).filter(jb).map(We=>({id:We.id,label:Tm(We.label||We.id)})),[d.models]),ge=f.useCallback(We=>{if(!v4(We)){A(new Error(`Unsupported approval mode: ${We}`),"Failed to set approval mode");return}h.setApprovalMode(We).then(()=>{const Te=$.current;if(!Te||!(We==="yolo"||We==="auto-edit"&&Te.toolKind==="edit"))return;const zt=Te.options.find(bn=>bn.kind==="allow_once");zt&&h.submitPermission(Te.id,zt.id).catch(bn=>A(bn,"Failed to auto-approve tool call"))}).catch(Te=>A(Te,"Failed to set approval mode"))},[h,A]),Oe=f.useCallback(We=>{h.setModel(We).catch(Te=>A(Te,"Failed to switch model"))},[h,A]),Nt=e||d.displayName||((Y=d.sessionId)==null?void 0:Y.slice(0,8))||"",Pe=t??d.workspaceCwd,Ce=Lj(p.capabilities)&&!!Pe,Zt=f.useMemo(()=>Ce?[...LF,"workspace"]:LF,[Ce]),dt=Ce&&Pe?y4(Pe):void 0,Ge=Ce?Dot(Pe,p.capabilities):void 0,St=Ge?jj[Ge]:void 0;return c.jsxs("section",{className:na.pane,"data-testid":"chat-pane","aria-label":Nt,children:[c.jsxs("header",{className:`${na.header} ${St??""}`.trim(),children:[dt&&c.jsxs("span",{role:"img",className:na.workspaceTag,title:Pe,"aria-label":u("workspace.paneLabel",{name:dt}),"data-web-shell-pane-workspace":!0,children:[c.jsx("span",{className:na.workspaceTagDot,"aria-hidden":"true"}),c.jsx("span",{className:na.workspaceTagText,children:dt})]}),c.jsx("span",{className:na.title,title:Nt,children:Nt}),r&&c.jsx("button",{type:"button",className:na.maximizeButton,onClick:r,"aria-pressed":s,"aria-label":u(s?"splitView.restorePane":"splitView.maximizePane"),title:u(s?"splitView.restorePane":"splitView.maximizePane"),children:s?c.jsx(SW,{size:16,"aria-hidden":!0}):c.jsx(_W,{size:16,"aria-hidden":!0})}),n&&c.jsx("button",{type:"button",className:na.closeButton,onClick:n,"aria-label":u("splitView.closePane"),title:u("splitView.closePane"),children:c.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:c.jsx("path",{d:"M6 6l12 12M18 6L6 18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),d.error&&c.jsx("div",{className:na.connectionError,role:"alert",children:c.jsxs("span",{className:na.connectionErrorText,children:[u("splitView.paneConnectionError"),": ",d.error]})}),c.jsx("div",{className:na.body,children:c.jsx(Gre,{messages:g,pendingApproval:O,loadingTranscript:d.loadingTranscript,catchingUp:d.catchingUp,isResponding:K,workspaceCwd:d.workspaceCwd||"",hideSessionTimeline:!0,turnFileChanges:Q.has("file")?H:void 0,turnArtifacts:Q.has("artifact")?F:void 0,turnScheduledTasks:Q.has("scheduled_task")?D:void 0,onTurnOutputOpen:Ae,generateContent:(je=d.capabilities)!=null&&je.features.includes("session_generation")?h.generateSessionContent:void 0})}),c.jsxs("div",{className:na.footer,children:[O&&c.jsx("div",{className:na.approval,"data-testid":"pane-approval",children:c.jsx(Cse,{request:O,onConfirm:ae,variant:"floating",keyboardActive:!1})}),B&&c.jsx("div",{className:na.approval,"data-testid":"pane-approval",children:c.jsx(Tse,{request:B,onConfirm:ae,variant:"floating"})}),c.jsx(Qre,{startedAt:X,showPhrase:!1}),c.jsx(Sse,{prompts:U,t:u,onDelete:oe,onInsert:J,onEdit:V}),c.jsx(Xre,{ref:k,onSubmit:te,onCancel:xe,isRunning:K,commands:Ne,queuedMessages:j,onPopQueuedMessages:se,onClearQueuedMessages:Z,visibleToolbarActions:Zt,workspaceName:Ce&&Pe?y4(Pe):void 0,workspaceTitle:Pe,workspaceColor:Ge,currentMode:d.currentMode??"default",currentModel:d.currentModel??"",availableModels:Le,onSelectMode:ge,onSelectModel:Oe,dialogOpen:P,followupState:T,onAcceptFollowup:S,onDismissFollowup:C,placeholderText:u("splitView.composerPlaceholder")})]})]})}const jct="_split_99j2q_1",Ict="_toolbar_99j2q_9",Rct="_backButton_99j2q_18",Dct="_title_99j2q_35",Lct="_count_99j2q_40",Pct="_addWrap_99j2q_45",Oct="_addButton_99j2q_50",Bct="_picker_99j2q_70",$ct="_pickerItem_99j2q_87",zct="_pickerItemLabel_99j2q_102",Fct="_pickerItemWorkspace_99j2q_112",qct="_panes_99j2q_131",Hct="_paneSlot_99j2q_140",Uct="_empty_99j2q_153",Vct="_paneError_99j2q_162",Wct="_paneErrorTitle_99j2q_175",Gct="_paneErrorMessage_99j2q_180",Kct="_paneErrorClose_99j2q_185",Pi={split:jct,toolbar:Ict,backButton:Rct,title:Dct,count:Lct,addWrap:Pct,addButton:Oct,picker:Bct,pickerItem:$ct,pickerItemLabel:zct,pickerItemWorkspace:Fct,panes:qct,paneSlot:Hct,empty:Uct,paneError:Vct,paneErrorTitle:Wct,paneErrorMessage:Gct,paneErrorClose:Kct},yT=J0;function Yct({sessionIds:e,onPanesChange:t,onExit:n,onError:r,onRightPanelOpen:s,onPaneArtifactsChange:i,messageTurnOutputs:o,sessionListReloadToken:a,includeOtherWorkspaces:l=!0,workspaceCwd:u}){var V,se,Z;const{t:d}=gt(),h=il(),m=h.sessionId,p=((se=(V=h.capabilities)==null?void 0:V.features)==null?void 0:se.includes(Dj))??!1,{sessions:g,reload:b}=ix(u,{autoLoad:!0,pageSize:Ou,archiveState:"active",...p?{view:"organized",group:"all"}:{}}),{sessions:x,reload:v}=dse(l&&!u),y=f.useMemo(()=>use(g,x),[g,x]),w=!u&&l&&Lj(h.capabilities),k=!!u||w,T=(Z=h.capabilities)==null?void 0:Z.workspaceCwd,S=e!==void 0,C=f.useMemo(()=>Array.from(new Set((e??[]).filter(Boolean))).slice(0,yT),[e]),[_,A]=f.useState(()=>C.length>0?C:m?[m]:[]),[M,L]=f.useState(!1),[N,O]=f.useState(null),B=f.useRef(null),[$]=f.useState(()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2));f.useEffect(()=>{S&&A(X=>X.length===C.length&&X.every((te,ae)=>te===C[ae])?X:C)},[C,S]);const P=f.useRef(_);P.current=_,f.useEffect(()=>{if(!M)return;const X=ae=>{var xe;(xe=B.current)!=null&&xe.contains(ae.target)||L(!1)},te=ae=>{ae.key==="Escape"&&L(!1)};return document.addEventListener("mousedown",X),document.addEventListener("keydown",te),()=>{document.removeEventListener("mousedown",X),document.removeEventListener("keydown",te)}},[M]),f.useEffect(()=>{M&&(b(),v())},[M,b,v]);const K=f.useRef(a);f.useEffect(()=>{a!==void 0&&a!==K.current&&(K.current=a,b(),v())},[a,b,v]);const F=f.useMemo(()=>{var te;const X=new Map;for(const ae of y)X.set(ae.sessionId,((te=ae.displayName)==null?void 0:te.trim())||ae.sessionId.slice(0,8));return X},[y]),H=f.useMemo(()=>{const X=new Map;for(const te of y)X.set(te.sessionId,te.workspaceCwd);return m&&h.workspaceCwd&&!X.has(m)&&X.set(m,h.workspaceCwd),X},[y,m,h.workspaceCwd]),D=f.useCallback(X=>{const te=P.current;if(te.includes(X)||te.length>=yT){L(!1);return}const ae=[...te,X];O(null),S?t==null||t(ae):A(ae),L(!1)},[t,S]),Q=f.useRef(!1);f.useEffect(()=>{_.length>0?Q.current=!0:Q.current&&n()},[_,n]),f.useEffect(()=>{S||t==null||t(_)},[_,t,S]);const U=f.useCallback(X=>{const te=P.current;if(!te.includes(X))return;const ae=te.filter(xe=>xe!==X);S?t==null||t(ae):A(ae)},[t,S]),j=f.useCallback(X=>{O(te=>te===X?null:X)},[]);f.useEffect(()=>{N&&(_.length<2||!_.includes(N))&&O(null)},[_,N]),f.useEffect(()=>{if(!N)return;const X=te=>{te.key!=="Escape"||te.defaultPrevented||M||Ag(te.target)||O(null)};return document.addEventListener("keydown",X),()=>document.removeEventListener("keydown",X)},[N,M]);const ie=f.useMemo(()=>y.filter(X=>!_.includes(X.sessionId)),[y,_]),oe=_.length<yT&&ie.length>0,J=_.length>1;return c.jsxs("div",{className:Pi.split,"data-testid":"split-view",children:[c.jsxs("header",{className:Pi.toolbar,children:[c.jsx("button",{type:"button",className:Pi.backButton,onClick:n,"aria-label":d("common.back"),title:d("common.back"),children:c.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",children:c.jsx("path",{d:"M15 18l-6-6 6-6",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),c.jsx("span",{className:Pi.title,children:d("splitView.title")}),c.jsx("span",{className:Pi.count,children:d("splitView.count",{count:_.length})}),c.jsxs("div",{className:Pi.addWrap,ref:B,children:[c.jsxs("button",{type:"button",className:Pi.addButton,disabled:!oe,"aria-haspopup":"listbox","aria-expanded":M,onClick:()=>L(X=>!X),children:["+ ",d("splitView.addPane")]}),M&&ie.length>0&&c.jsx("ul",{className:Pi.picker,role:"listbox",children:ie.map(X=>c.jsx("li",{role:"option","aria-selected":"false",children:c.jsxs("button",{type:"button",className:Pi.pickerItem,onClick:()=>D(X.sessionId),children:[c.jsx("span",{className:Pi.pickerItemLabel,children:F.get(X.sessionId)??X.sessionId.slice(0,8)}),w&&c.jsx("span",{className:Pi.pickerItemWorkspace,title:X.workspaceCwd,children:cse(X.workspaceCwd,T)?y4(X.workspaceCwd):d("sidebar.workspacePrimary")})]})},X.sessionId))})]})]}),c.jsx("div",{className:Pi.panes,children:_.length===0?c.jsx("div",{className:Pi.empty,children:d("splitView.empty")}):_.map(X=>{const te=H.get(X),ae=N===X,xe=N!==null&&!ae;return c.jsx("div",{className:Pi.paneSlot,"data-pane-hidden":xe?"":void 0,children:c.jsx(ld,{label:`split-pane:${X}`,resetKeys:[X],fallback:Ae=>c.jsxs("div",{className:Pi.paneError,role:"alert",children:[c.jsx("div",{className:Pi.paneErrorTitle,children:F.get(X)??X.slice(0,8)}),c.jsxs("div",{className:Pi.paneErrorMessage,children:[d("splitView.paneError"),": ",Ae.message]}),c.jsx("button",{type:"button",className:Pi.paneErrorClose,onClick:()=>U(X),children:d("splitView.closePane")})]}),children:c.jsx(mW,{sessionId:X,workspaceCwd:k?te??u:void 0,clientId:`split-pane:${$}:${X}`,suppressOwnUserEcho:!0,children:c.jsx(Nct,{title:F.get(X),workspaceCwd:te,onClose:()=>U(X),onToggleMaximize:J?()=>j(X):void 0,isMaximized:ae,onError:r,onRightPanelOpen:s,onPaneArtifactsChange:i,messageTurnOutputs:o})})})},k?`${X}:${te??""}`:X)})})]})}const Xct="_root_12cvm_1",Qct="_intro_12cvm_8",Jct="_toolbar_12cvm_14",Zct="_count_12cvm_22",eut="_toolbarActions_12cvm_28",tut="_primaryButton_12cvm_34",nut="_secondaryButton_12cvm_35",rut="_formFields_12cvm_73",sut="_field_12cvm_79",iut="_fieldGrow_12cvm_86",out="_fieldLabel_12cvm_90",aut="_required_12cvm_96",lut="_input_12cvm_107",cut="_textarea_12cvm_108",uut="_select_12cvm_109",dut="_promptEditorWrap_12cvm_127",hut="_promptEditor_12cvm_127",fut="_promptPlaceholder_12cvm_159",mut="_promptTag_12cvm_173",put="_promptTagIcon_12cvm_189",gut="_promptTagValue_12cvm_200",but="_referencePopover_12cvm_210",yut="_referenceBar_12cvm_214",vut="_referenceButton_12cvm_221",xut="_referenceButtonActive_12cvm_238",wut="_referenceButtonIcon_12cvm_243",kut="_referencePicker_12cvm_253",_ut="_referenceItem_12cvm_265",Sut="_referenceItemLabel_12cvm_288",Cut="_referenceItemDescription_12cvm_289",Tut="_referenceEmpty_12cvm_306",Aut="_referenceError_12cvm_307",Eut="_scheduleRow_12cvm_317",Mut="_preview_12cvm_329",Nut="_previewLabel_12cvm_337",jut="_previewCron_12cvm_342",Iut="_previewInvalid_12cvm_352",Rut="_formError_12cvm_357",Dut="_loadError_12cvm_358",Lut="_formActions_12cvm_364",Put="_empty_12cvm_372",Out="_list_12cvm_379",But="_card_12cvm_387",$ut="_cardDisabled_12cvm_398",zut="_cardHeader_12cvm_402",Fut="_cardTitle_12cvm_408",qut="_cardMenu_12cvm_419",Hut="_iconAction_12cvm_426",Uut="_toggle_12cvm_452",Vut="_toggleOn_12cvm_471",Wut="_toggleKnob_12cvm_475",Gut="_cardPrompt_12cvm_490",Kut="_cardFooter_12cvm_503",Yut="_schedulePill_12cvm_512",Xut="_clockIcon_12cvm_524",Qut="_recurringTag_12cvm_529",Jut="_workspacePill_12cvm_537",Zut="_workspaceIcon_12cvm_554",edt="_countdown_12cvm_559",tdt="_hourglassIcon_12cvm_570",ndt="_lastFired_12cvm_575",rdt="_runsToggle_12cvm_583",sdt="_runsList_12cvm_600",idt="_runsItem_12cvm_614",Ue={root:Xct,intro:Qct,toolbar:Jct,count:Zct,toolbarActions:eut,primaryButton:tut,secondaryButton:nut,formFields:rut,field:sut,fieldGrow:iut,fieldLabel:out,required:aut,input:lut,textarea:cut,select:uut,promptEditorWrap:dut,promptEditor:hut,promptPlaceholder:fut,promptTag:mut,promptTagIcon:put,promptTagValue:gut,referencePopover:but,referenceBar:yut,referenceButton:vut,referenceButtonActive:xut,referenceButtonIcon:wut,referencePicker:kut,referenceItem:_ut,referenceItemLabel:Sut,referenceItemDescription:Cut,referenceEmpty:Tut,referenceError:Aut,scheduleRow:Eut,preview:Mut,previewLabel:Nut,previewCron:jut,previewInvalid:Iut,formError:Rut,loadError:Dut,formActions:Lut,empty:Put,list:Out,card:But,cardDisabled:$ut,cardHeader:zut,cardTitle:Fut,cardMenu:qut,iconAction:Hut,toggle:Uut,toggleOn:Vut,toggleKnob:Wut,cardPrompt:Gut,cardFooter:Kut,schedulePill:Yut,clockIcon:Xut,recurringTag:Qut,workspacePill:Jut,workspaceIcon:Zut,countdown:edt,hourglassIcon:tdt,lastFired:ndt,runsToggle:rdt,runsList:sdt,runsItem:idt},odt="_panel_1ycr0_1",adt="_header_1ycr0_11",ldt="_tabs_1ycr0_28",cdt="_tabItem_1ycr0_37",udt="_tab_1ycr0_28",ddt="_tabIcon_1ycr0_67",hdt="_tabIconSvg_1ycr0_77",fdt="_tabActive_1ycr0_84",mdt="_tabCloseButton_1ycr0_99",pdt="_tabCloseIcon_1ycr0_119",gdt="_iconButton_1ycr0_125",bdt="_iconButtonActive_1ycr0_143",ydt="_toolbarIcon_1ycr0_147",vdt="_body_1ycr0_153",xdt="_empty_1ycr0_160",wdt="_meta_1ycr0_198",kdt="_detail_1ycr0_203",_dt="_section_1ycr0_208",Sdt="_sectionTitle_1ycr0_213",Cdt="_description_1ycr0_220",Tdt="_actionsRow_1ycr0_224",Adt="_fieldGrid_1ycr0_231",Edt="_fieldLabel_1ycr0_238",Mdt="_fieldValue_1ycr0_247",Ndt="_link_1ycr0_252",jdt="_review_1ycr0_261",Idt="_reviewToolbar_1ycr0_268",Rdt="_reviewToolbarTitle_1ycr0_277",Ddt="_reviewToolbarActions_1ycr0_284",Ldt="_reviewTotalsButton_1ycr0_290",Pdt="_reviewContent_1ycr0_308",Odt="_reviewContentListOnly_1ycr0_318",Bdt="_reviewContentStacked_1ycr0_322",$dt="_reviewList_1ycr0_327",zdt="_reviewListWithExpanded_1ycr0_335",Fdt="_reviewSplitHandle_1ycr0_348",qdt="_reviewItem_1ycr0_363",Hdt="_reviewItemExpanded_1ycr0_368",Udt="_reviewRow_1ycr0_375",Vdt="_fileIcon_1ycr0_396",Wdt="_reviewPath_1ycr0_410",Gdt="_treeName_1ycr0_411",Kdt="_pathPrefix_1ycr0_427",Ydt="_pathFileName_1ycr0_433",Xdt="_lineStats_1ycr0_441",Qdt="_additions_1ycr0_450",Jdt="_deletions_1ycr0_454",Zdt="_chevron_1ycr0_458",eht="_chevronOpen_1ycr0_464",tht="_chevronIcon_1ycr0_468",nht="_diffPreview_1ycr0_474",rht="_codeMirrorDiff_1ycr0_484",sht="_codeMirrorDiffWrap_1ycr0_492",iht="_diffError_1ycr0_500",oht="_codeMirrorFile_1ycr0_525",aht="_diffEmpty_1ycr0_591",lht="_tree_1ycr0_411",cht="_treeNode_1ycr0_604",uht="_treeChildren_1ycr0_608",dht="_treeRow_1ycr0_622",hht="_treeFolder_1ycr0_655",fht="_treeFile_1ycr0_659",mht="_treeTwisty_1ycr0_668",pht="_treeChevronIcon_1ycr0_677",ght="_treeChevron_1ycr0_677",bht="_treeChevronClosed_1ycr0_688",yht="_treeContent_1ycr0_692",vht="_reviewBadge_1ycr0_715",xht="_htmlPreviewWrap_1ycr0_728",wht="_htmlPreview_1ycr0_728",kht="_previewError_1ycr0_744",_ht="_filePreviewWrap_1ycr0_750",et={panel:odt,header:adt,tabs:ldt,tabItem:cdt,tab:udt,tabIcon:ddt,tabIconSvg:hdt,tabActive:fdt,tabCloseButton:mdt,tabCloseIcon:pdt,iconButton:gdt,iconButtonActive:bdt,toolbarIcon:ydt,body:vdt,empty:xdt,meta:wdt,detail:kdt,section:_dt,sectionTitle:Sdt,description:Cdt,actionsRow:Tdt,fieldGrid:Adt,fieldLabel:Edt,fieldValue:Mdt,link:Ndt,review:jdt,reviewToolbar:Idt,reviewToolbarTitle:Rdt,reviewToolbarActions:Ddt,reviewTotalsButton:Ldt,reviewContent:Pdt,reviewContentListOnly:Odt,reviewContentStacked:Bdt,reviewList:$dt,reviewListWithExpanded:zdt,reviewSplitHandle:Fdt,reviewItem:qdt,reviewItemExpanded:Hdt,reviewRow:Udt,fileIcon:Vdt,reviewPath:Wdt,treeName:Gdt,pathPrefix:Kdt,pathFileName:Ydt,lineStats:Xdt,additions:Qdt,deletions:Jdt,chevron:Zdt,chevronOpen:eht,chevronIcon:tht,diffPreview:nht,codeMirrorDiff:rht,codeMirrorDiffWrap:sht,diffError:iht,codeMirrorFile:oht,diffEmpty:aht,tree:lht,treeNode:cht,treeChildren:uht,treeRow:dht,treeFolder:hht,treeFile:fht,treeTwisty:mht,treeChevronIcon:pht,treeChevron:ght,treeChevronClosed:bht,treeContent:yht,reviewBadge:vht,htmlPreviewWrap:xht,htmlPreview:wht,previewError:kht,filePreviewWrap:_ht},Sht=740,Cht=700,Tht=["daily","weekdays","weekly","hourly","minutes","custom"],Aht=[1,2,3,4,5,6,10,12,15,20,30];function Eht({artifacts:e,tabs:t,activeTabId:n,reviewChanges:r,selectedReviewPath:s,panelWidth:i,workspaceCwd:o,loading:a,error:l,onSelectTab:u,onCloseTab:d,onClose:h}){const m=t.find(b=>b.id===n)??t[0],p=ko(),g=(m==null?void 0:m.kind)==="artifact"||(m==null?void 0:m.kind)==="scheduled_task"?m.workspaceActions??p:p;return c.jsxs("aside",{className:et.panel,style:i?{flexBasis:i,width:i}:void 0,"aria-label":"Right panel",children:[c.jsxs("div",{className:et.header,children:[c.jsx("div",{className:et.tabs,role:"tablist","aria-label":"Right panel",children:t.map(b=>c.jsxs("div",{className:[et.tabItem,b.id===(m==null?void 0:m.id)?et.tabActive:""].filter(Boolean).join(" "),children:[c.jsxs("button",{type:"button",role:"tab","aria-selected":b.id===(m==null?void 0:m.id),className:et.tab,onClick:()=>u(b.id),title:b.title,children:[c.jsx("span",{className:et.tabIcon,"aria-hidden":"true",children:b.kind==="review"?c.jsx(Nht,{}):b.kind==="artifact"?c.jsx(jht,{}):c.jsx(Iht,{})}),b.title]}),c.jsx("button",{type:"button",className:et.tabCloseButton,onClick:()=>d(b.id),"aria-label":`Close ${b.title}`,title:"Close",children:c.jsx(Mht,{})})]},b.id))}),c.jsx("button",{type:"button",className:et.iconButton,onClick:h,"aria-label":"Close artifacts panel",title:"Close",children:"×"})]}),c.jsx("div",{className:et.body,children:m?m.kind==="review"?c.jsx(Lht,{changes:r,selectedPath:s,panelWidth:i,workspaceCwd:o}):m.kind==="artifact"?c.jsx(Rht,{artifacts:e,artifactId:m.artifactId,workspaceActions:g,previewContent:m.previewContent,loading:a,error:l}):c.jsx(Dht,{task:m.task,actions:g},m.id):c.jsx("div",{className:et.empty,children:"No panel selected."})})]})}function Mht(){return c.jsx("svg",{className:et.tabCloseIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"m4.5 4.5 7 7M11.5 4.5l-7 7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function Nht(){return c.jsxs("svg",{className:et.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[c.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"1.6"}),c.jsx("path",{d:"M9 9.5h6M12 6.5v6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("path",{d:"M9 16h6",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function jht(){return c.jsxs("svg",{className:et.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[c.jsx("rect",{x:"6",y:"4",width:"12",height:"16",rx:"2",stroke:"currentColor",strokeWidth:"1.8"}),c.jsx("path",{d:"M9 10h6M9 14h4",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})]})}function Iht(){return c.jsxs("svg",{className:et.tabIconSvg,viewBox:"0 0 24 24",fill:"none",focusable:"false",children:[c.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3",stroke:"currentColor",strokeWidth:"1.8"}),c.jsx("path",{d:"M12 8v4l3 2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Rht({artifacts:e,artifactId:t,workspaceActions:n,previewContent:r,loading:s,error:i}){const o=e.find(a=>a.id===t);return o?c.jsx(Ght,{artifact:o,workspaceActions:n,previewContent:r}):s?c.jsx("div",{className:et.empty,children:"Loading artifact..."}):i?c.jsx("div",{className:et.empty,children:i}):c.jsx("div",{className:et.empty,children:"Artifact not found."})}function Dht({task:e,actions:t}){const{t:n}=gt(),[r,s]=f.useState(null),[i,o]=f.useState(!0),[a,l]=f.useState(null),[u,d]=f.useState(""),[h,m]=f.useState(e.prompt),[p,g]=f.useState(()=>rh(e.cron)),[b,x]=f.useState(!1),[v,y]=f.useState(!1),[w,k]=f.useState(!1),[T,S]=f.useState(!1),[C,_]=f.useState(null),A=f.useCallback(async()=>{if(!e.durable){s(null),d(""),m(e.prompt),g(rh(e.cron)),l(null),o(!1);return}o(!0),l(null);try{const J=(await t.listScheduledTasks()).find(V=>V.id===e.id)??null;s(J),J?(d(J.name??""),m(J.prompt),g(rh(J.cron))):(d(""),m(e.prompt),g(rh(e.cron)))}catch(oe){l(oe instanceof Error?oe.message:String(oe))}finally{o(!1)}},[t,e.cron,e.durable,e.id,e.prompt]);f.useEffect(()=>{A()},[A]);const M=!e.durable,L=e.durable&&!i&&!a&&!r,N=!!r,O=(r==null?void 0:r.name)||(r==null?void 0:r.prompt)||e.title,B=(r==null?void 0:r.prompt)??e.prompt,$=(r==null?void 0:r.cron)??e.cron,P=(r==null?void 0:r.recurring)??e.recurring,K=r==null?void 0:r.enabled,F=f.useCallback(()=>{r&&(d(r.name??""),m(r.prompt),g(rh(r.cron)),_(null),x(!0))},[r]),H=f.useCallback(()=>{x(!1),_(null),r&&(d(r.name??""),m(r.prompt),g(rh(r.cron)))},[r]),D=f.useCallback(async()=>{if(!r)return;const oe=o4(p);if(!oe){_(n("scheduledTasks.error.invalidSchedule"));return}if(h.trim().length===0){_(n("scheduledTasks.error.emptyPrompt"));return}S(!0),_(null);try{const J=await t.updateScheduledTask(r.id,{cron:oe,prompt:h.trim(),name:u.trim()||null});s(J),d(J.name??""),m(J.prompt),g(rh(J.cron)),x(!1)}catch(J){_(J instanceof Error?J.message:String(J))}finally{S(!1)}},[t,p,r,u,h,n]),Q=f.useCallback(async()=>{if(r){k(!0),_(null);try{const oe=await t.updateScheduledTask(r.id,{enabled:!r.enabled});s(oe)}catch(oe){_(oe instanceof Error?oe.message:String(oe))}finally{k(!1)}}},[t,r]),U=f.useCallback(async()=>{if(r){k(!0),_(null);try{await t.deleteScheduledTask(r.id),s(null),y(!1)}catch(oe){_(oe instanceof Error?oe.message:String(oe))}finally{k(!1)}}},[t,r]),j=o4(p),ie=j?pv(j,n):null;return c.jsxs("div",{className:et.detail,children:[i&&c.jsx("div",{className:et.empty,children:n("scheduledTasks.loading")}),a&&c.jsx("div",{className:Ue.loadError,children:a}),L&&c.jsx("div",{className:et.empty,children:n("scheduledTasks.deletedSnapshot")}),M&&c.jsx("div",{className:et.empty,children:n("scheduledTasks.sessionScopedSnapshot")}),!L&&c.jsx("div",{className:et.section,children:c.jsxs("div",{className:et.fieldGrid,children:[c.jsx("span",{className:et.fieldLabel,children:n("scheduledTasks.name")}),c.jsx("span",{className:et.fieldValue,children:O}),c.jsx("span",{className:et.fieldLabel,children:n("scheduledTasks.taskId")}),c.jsx("span",{className:et.fieldValue,children:e.id}),c.jsx("span",{className:et.fieldLabel,children:n("scheduledTasks.schedule")}),c.jsx("span",{className:et.fieldValue,children:pv($,n)}),c.jsx("span",{className:et.fieldLabel,children:"Cron"}),c.jsx("span",{className:et.fieldValue,children:$}),c.jsx("span",{className:et.fieldLabel,children:n("scheduledTasks.type")}),c.jsx("span",{className:et.fieldValue,children:n(P?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),K!==void 0&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:et.fieldLabel,children:n("scheduledTasks.status")}),c.jsx("span",{className:et.fieldValue,children:n(K?"scheduledTasks.enable":"scheduledTasks.disable")})]})]})}),!L&&c.jsxs("div",{className:et.section,children:[c.jsx("div",{className:et.sectionTitle,children:"Prompt"}),c.jsx("div",{className:et.description,children:B})]}),C&&c.jsx("div",{className:Ue.formError,children:C}),c.jsxs("div",{className:et.actionsRow,children:[c.jsx("button",{type:"button",className:Ue.primaryButton,disabled:!N||w,onClick:F,children:n("scheduledTasks.edit")}),c.jsx("button",{type:"button",className:Ue.secondaryButton,disabled:!N||w,onClick:()=>void Q(),children:r!=null&&r.enabled?n("scheduledTasks.disable"):n("scheduledTasks.enable")}),c.jsx("button",{type:"button",className:Ue.secondaryButton,disabled:!N||w,onClick:()=>y(!0),children:n("scheduledTasks.delete")})]}),v&&r&&c.jsx(Qs,{title:n("scheduledTasks.deleteConfirmTitle"),size:"sm",onClose:()=>y(!1),children:c.jsxs("div",{className:Ue.formFields,children:[c.jsx("div",{className:et.description,children:n("scheduledTasks.deleteConfirm",{name:r.name||r.prompt})}),C&&c.jsx("div",{className:Ue.formError,children:C}),c.jsxs("div",{className:Ue.formActions,children:[c.jsx("button",{type:"button",className:Ue.secondaryButton,onClick:()=>y(!1),disabled:w,children:n("scheduledTasks.cancel")}),c.jsx("button",{type:"button",className:Ue.primaryButton,onClick:()=>void U(),disabled:w,children:n("scheduledTasks.delete")})]})]})}),b&&c.jsx(Qs,{title:n("scheduledTasks.editTitle"),size:"md",onClose:H,children:c.jsxs("div",{className:Ue.formFields,children:[c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:n("scheduledTasks.name")}),c.jsx("input",{className:Ue.input,type:"text",value:u,maxLength:200,placeholder:n("scheduledTasks.namePlaceholder"),onChange:oe=>d(oe.target.value)})]}),c.jsxs("label",{className:Ue.field,children:[c.jsxs("span",{className:Ue.fieldLabel,children:[n("scheduledTasks.prompt"),c.jsx("span",{className:Ue.required,children:"*"})]}),c.jsx("textarea",{className:Ue.textarea,value:h,rows:4,maxLength:1e5,placeholder:n("scheduledTasks.promptPlaceholder"),onChange:oe=>m(oe.target.value)})]}),c.jsxs("div",{className:Ue.scheduleRow,children:[c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:n("scheduledTasks.frequency")}),c.jsx("select",{className:Ue.select,value:p.frequency,onChange:oe=>{const J=oe.target.value;g(V=>({...V,frequency:J,...J==="hourly"?{time:"00:00"}:{}}))},children:Tht.map(oe=>c.jsx("option",{value:oe,children:n(`scheduledTasks.freq.${oe}`)},oe))})]}),(p.frequency==="daily"||p.frequency==="weekdays"||p.frequency==="weekly")&&c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:n("scheduledTasks.time")}),c.jsx("input",{className:Ue.input,type:"time",value:p.time,onChange:oe=>g(J=>({...J,time:oe.target.value}))})]}),p.frequency==="weekly"&&c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:n("scheduledTasks.weekday")}),c.jsx("select",{className:Ue.select,value:p.weekday,onChange:oe=>g(J=>({...J,weekday:Number(oe.target.value)})),children:n("scheduledTasks.weekdayNames").split(",").map((oe,J)=>c.jsx("option",{value:J,children:oe},J))})]}),p.frequency==="minutes"&&c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:n("scheduledTasks.interval")}),c.jsx("select",{className:Ue.select,value:p.minuteInterval,onChange:oe=>g(J=>({...J,minuteInterval:Number(oe.target.value)})),children:Aht.map(oe=>c.jsx("option",{value:oe,children:oe},oe))})]}),p.frequency==="custom"&&c.jsxs("label",{className:`${Ue.field} ${Ue.fieldGrow}`,children:[c.jsx("span",{className:Ue.fieldLabel,children:n("scheduledTasks.cron")}),c.jsx("input",{className:Ue.input,type:"text",value:p.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:oe=>g(J=>({...J,customCron:oe.target.value}))})]})]}),c.jsx("div",{className:Ue.preview,children:ie?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Ue.previewLabel,children:ie}),c.jsx("code",{className:Ue.previewCron,children:j})]}):c.jsx("span",{className:Ue.previewInvalid,children:n("scheduledTasks.error.invalidSchedule")})}),C&&c.jsx("div",{className:Ue.formError,children:C}),c.jsxs("div",{className:Ue.formActions,children:[c.jsx("button",{type:"button",className:Ue.secondaryButton,onClick:H,disabled:T,children:n("scheduledTasks.cancel")}),c.jsx("button",{type:"button",className:Ue.primaryButton,onClick:()=>void D(),disabled:T,children:n(T?"scheduledTasks.saving":"scheduledTasks.save")})]})]})})]})}function Lht({changes:e,selectedPath:t,panelWidth:n,workspaceCwd:r}){const{t:s}=gt(),[i,o]=f.useState(()=>!n||n>=Sht),[a,l]=f.useState(!0),[u,d]=f.useState(!1),[h,m]=f.useState(520),p=f.useRef(h),g=f.useRef(null),b=f.useRef(null),[x,v]=f.useState(null),y=i,w=f.useMemo(()=>Vht(e,r),[e,r]);f.useEffect(()=>{v(t)},[t]),f.useEffect(()=>{p.current=h},[h]),f.useEffect(()=>{const C=g.current;if(!C)return;const _=()=>{d(C.clientWidth<Cht)};_();const A=new ResizeObserver(_);return A.observe(C),()=>A.disconnect()},[a]),f.useEffect(()=>()=>{var C;return(C=b.current)==null?void 0:C.call(b)},[]);const k=f.useCallback(C=>{const _=g.current;if(!_)return;C.preventDefault();const A=C.currentTarget;A.setPointerCapture(C.pointerId);const M=C.clientX,L=p.current,N=_.getBoundingClientRect().width,O=Math.max(180,N-180),B=document.body.style.cursor,$=document.body.style.userSelect;let P=L,K=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const F=()=>{K=null,m(P)},H=U=>{P=Math.min(O,Math.max(180,L+(U.clientX-M))),K===null&&(K=window.requestAnimationFrame(F))};let D=()=>{};const Q=U=>{b.current=null,K!==null&&(window.cancelAnimationFrame(K),K=null),U&&m(P),A.hasPointerCapture(C.pointerId)&&A.releasePointerCapture(C.pointerId),document.body.style.cursor=B,document.body.style.userSelect=$,window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)};D=()=>Q(!0),b.current=()=>Q(!1),window.addEventListener("pointermove",H),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D)},[]);if(e.length===0)return c.jsx("div",{className:et.empty,children:"No file changes to review."});const T=Ore(e),S=C=>{v(_=>_===C?null:C)};return c.jsxs("div",{className:et.review,children:[c.jsxs("div",{className:et.reviewToolbar,children:[c.jsxs("div",{className:et.reviewToolbarTitle,children:[c.jsx("span",{children:s("turnOutputs.previousTurn")}),c.jsx(a4,{additions:T==null?void 0:T.additions,deletions:T==null?void 0:T.deletions,className:et.lineStats,additionsClassName:et.additions,deletionsClassName:et.deletions})]}),c.jsxs("div",{className:et.reviewToolbarActions,children:[c.jsxs("button",{type:"button",className:et.reviewTotalsButton,onClick:()=>l(C=>!C),"aria-expanded":a,children:[c.jsx("span",{children:s("turnOutputs.fileCount",{count:e.length})}),c.jsx("span",{className:[et.chevron,a?et.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:c.jsx(OF,{})})]}),c.jsx("button",{type:"button",className:[et.iconButton,i?et.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>o(C=>!C),"aria-label":s(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),title:s(i?"turnOutputs.closeFileTree":"turnOutputs.openFileTree"),children:i?c.jsx(Hht,{}):c.jsx(qht,{})})]})]}),a&&c.jsxs("div",{ref:g,className:[et.reviewContent,y?"":et.reviewContentListOnly,y&&u?et.reviewContentStacked:""].filter(Boolean).join(" "),style:{"--review-list-width":`${h}px`},children:[c.jsx("div",{className:[et.reviewList,x?et.reviewListWithExpanded:""].filter(Boolean).join(" "),children:e.map(C=>{const _=x===C.path;return c.jsxs("div",{className:[et.reviewItem,_?et.reviewItemExpanded:""].filter(Boolean).join(" "),children:[c.jsxs("button",{type:"button",className:et.reviewRow,"data-selected":C.path===t||void 0,onClick:()=>S(C.path),children:[c.jsx("span",{className:et.fileIcon,children:Fse(C.path)}),c.jsx($ht,{path:Ej(C.path,r),title:C.path}),c.jsx(a4,{additions:C.additions,deletions:C.deletions,className:et.lineStats,additionsClassName:et.additions,deletionsClassName:et.deletions}),c.jsx("span",{className:[et.chevron,_?et.chevronOpen:""].filter(Boolean).join(" "),"aria-hidden":"true",children:c.jsx(OF,{})})]}),_&&c.jsx(Pht,{change:C})]},`${C.toolCallId}:${C.path}`)})}),y&&!u&&c.jsx("div",{className:et.reviewSplitHandle,role:"separator","aria-orientation":"vertical",onPointerDown:k}),y&&c.jsx("div",{className:et.tree,children:w.children.map(C=>c.jsx(Bse,{node:C,depth:0,selectedPath:t},C.path))})]})]})}function Pht({change:e}){if(e.diffs.length===0)return c.jsx("div",{className:et.diffEmpty,children:"No diff available."});const t=Oht(e.diffs);return c.jsx("div",{className:et.diffPreview,children:t.map((n,r)=>c.jsx(Bht,{oldText:n.oldText,newText:n.newText},r))})}function Oht(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n!=null&&n.fullContent)return e.slice(t)}return e}function Bht({oldText:e,newText:t}){const n=f.useRef(null),[r,s]=f.useState(null),[i,o]=f.useState(null);return f.useEffect(()=>{const a=n.current;if(!a)return;const l=()=>s(a.clientWidth>=720);l();const u=new ResizeObserver(l);return u.observe(a),()=>u.disconnect()},[]),f.useEffect(()=>{const a=n.current;if(!a||r===null)return;a.replaceChildren(),o(null);let l=!1,u=null;const d=[VJ,It.editable.of(!1),Ir.readOnly.of(!0),It.lineWrapping],h={scanLimit:1e3,timeout:500},m={margin:3,minSize:8};return re(async()=>{const{MergeView:p,unifiedMergeView:g}=await import("./index-DhYuvi3j.js");return{MergeView:p,unifiedMergeView:g}},[]).then(({MergeView:p,unifiedMergeView:g})=>{if(!l)try{if(r){u=new p({a:{doc:e,extensions:d},b:{doc:t,extensions:d},parent:a,highlightChanges:!0,gutter:!0,revertControls:void 0,collapseUnchanged:m,diffConfig:h});return}u=new It({doc:t,extensions:[...d,g({original:e,highlightChanges:!0,gutter:!0,mergeControls:!1,allowInlineDiffs:!0,collapseUnchanged:m,diffConfig:h})],parent:a})}catch(b){l||o(b instanceof Error?b.message:String(b))}}).catch(p=>{l||o(p instanceof Error?p.message:String(p))}),()=>{l=!0,u==null||u.destroy()}},[r,t,e]),c.jsxs("div",{className:et.codeMirrorDiffWrap,children:[c.jsx("div",{ref:n,className:et.codeMirrorDiff}),i&&c.jsxs("div",{className:et.diffError,children:["Diff unavailable: ",i]})]})}function Bse({node:e,depth:t,selectedPath:n}){var d,h;const r=!!e.file,[s,i]=f.useState(!0),o=[et.treeRow,r?et.treeFile:et.treeFolder].filter(Boolean).join(" "),a={paddingLeft:10+t*18,"--tree-row-line-left":`${19+Math.max(0,t-1)*18}px`},l={"--tree-children-line-left":`${19+t*18}px`},u=c.jsxs(c.Fragment,{children:[c.jsx("span",{className:et.treeTwisty,children:!r&&c.jsx("span",{className:[et.treeChevron,s?"":et.treeChevronClosed].filter(Boolean).join(" "),children:c.jsx(Uht,{})})}),c.jsxs("span",{className:et.treeContent,children:[r&&c.jsx("span",{className:et.fileIcon,children:Fse(e.path)}),c.jsx("span",{className:et.treeName,children:e.name})]}),((d=e.file)==null?void 0:d.isArtifact)&&c.jsx("span",{className:et.reviewBadge,children:"artifact"})]});return c.jsxs("div",{className:et.treeNode,children:[r?c.jsx("div",{className:o,"data-selected":((h=e.file)==null?void 0:h.path)===n||void 0,"data-depth":t,style:a,title:e.path,children:u}):c.jsx("button",{type:"button",className:o,"data-depth":t,style:a,title:e.path,"aria-expanded":s,onClick:()=>i(m=>!m),children:u}),!r&&s&&e.children.length>0&&c.jsx("div",{className:et.treeChildren,style:l,children:e.children.map(m=>c.jsx(Bse,{node:m,depth:t+1,selectedPath:n},m.path))})]})}function $ht({path:e,title:t}){const n=f.useRef(null),[r,s]=f.useState(()=>$se(e));return f.useLayoutEffect(()=>{const i=n.current;if(!i)return;const o=()=>s(zht(e,i));o();const a=new ResizeObserver(o);return a.observe(i),()=>a.disconnect()},[e]),c.jsxs("span",{ref:n,className:et.reviewPath,title:t??e,children:[r.prefix&&c.jsx("span",{className:et.pathPrefix,children:r.prefix}),c.jsx("span",{className:et.pathFileName,children:r.leaf})]})}function $se(e){const t=e.lastIndexOf("/");return t<0?{prefix:"",leaf:e}:{prefix:e.slice(0,t+1),leaf:e.slice(t+1)}}let PF=null;function zht(e,t){const n=$se(e),r=t.clientWidth;if(r<=0)return n;const s=Fht(t);if(s(e)<=r)return n;const i=e.split("/").filter(Boolean),o=i.at(-1)??e,a=s(o);if(i.length<=1||a+s(".../")>r)return{prefix:"",leaf:o};let l=".../";for(let u=1;u<i.length;u++){const h=`.../${i.slice(i.length-1-u,-1).join("/")}/`;if(s(h)+a>r)break;l=h}return{prefix:l,leaf:o}}function Fht(e){PF??(PF=document.createElement("canvas"));const t=PF.getContext("2d"),n=window.getComputedStyle(e);return t&&(t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(" ")),r=>(t==null?void 0:t.measureText(r).width)??r.length*8}function qht(){return c.jsxs("svg",{className:et.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[c.jsx("path",{d:"M3.5 7.5h6l1.6 2h9.4v8.2a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2V7.5Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),c.jsx("path",{d:"M3.5 7.5V5.8a1.5 1.5 0 0 1 1.5-1.5h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.6",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function Hht(){return c.jsxs("svg",{className:et.toolbarIcon,viewBox:"0 0 24 24",fill:"none",focusable:"false","aria-hidden":"true",children:[c.jsx("path",{d:"M3.5 8.2V5.8A1.5 1.5 0 0 1 5 4.3h4l1.8 2.1h7.2a1.5 1.5 0 0 1 1.5 1.5v1.4",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),c.jsx("path",{d:"M4.8 19.7h12.9a2 2 0 0 0 1.9-1.4l2-7H6.4l-2.8 7.1a.9.9 0 0 0 1.2 1.3Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"})]})}function OF(){return c.jsx("svg",{className:et.chevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"m6 4 4 4-4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Uht(){return c.jsx("svg",{className:et.treeChevronIcon,viewBox:"0 0 16 16",fill:"none",focusable:"false","aria-hidden":"true",children:c.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vht(e,t){const n={name:"",path:"",children:[]};for(const r of e){const s=Ej(r.path,t).split("/").filter(Boolean);let i=n;for(let o=0;o<s.length;o++){const a=s[o],l=s.slice(0,o+1).join("/");let u=i.children.find(d=>d.name===a);u||(u={name:a,path:l,children:[]},i.children.push(u)),o===s.length-1&&(u.file=r),i=u}}return zse(n),n}function zse(e){e.children.sort((t,n)=>!!t.file!=!!n.file?t.file?1:-1:t.name.localeCompare(n.name));for(const t of e.children)zse(t)}function Wht(e){return rp(e).split("/").filter(Boolean).at(-1)??e}function Fse(e){var s;const t=Wht(e),n=t.includes(".")?(s=t.split(".").pop())==null?void 0:s.toLowerCase():"";return n?{css:"CSS",html:"HTML",js:"JS",json:"JSON",jsx:"JSX",md:"MD",ts:"TS",tsx:"TSX"}[n]??n.slice(0,3).toUpperCase():"FILE"}function Ght({artifact:e,workspaceActions:t,previewContent:n}){var l;const r=dVe(e),s=VY(e.url)?e.url:void 0,i=((l=e.metadata)==null?void 0:l.artifactType)==="automation_snapshot",o=e.storage==="workspace"&&!!e.workspacePath;return o&&e.workspacePath&&Kht(e)&&e.workspacePath?c.jsx(Yht,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t,previewContent:n}):o&&e.workspacePath?c.jsx(Xht,{workspacePath:e.workspacePath,artifactVersion:e.updatedAt,workspaceActions:t}):c.jsxs("div",{className:et.detail,children:[c.jsxs("div",{className:et.section,children:[c.jsx("div",{className:et.sectionTitle,children:i?"Automation Snapshot":"Artifact"}),c.jsxs("div",{className:et.fieldGrid,children:[c.jsx(Ac,{label:"Type",value:Dre(e.kind)}),c.jsx(Ac,{label:"Storage",value:e.storage}),c.jsx(Ac,{label:"Status",value:e.status}),c.jsx(Ac,{label:"Source",value:e.source}),c.jsx(Ac,{label:"Size",value:Lre(e.sizeBytes)}),c.jsx(Ac,{label:"Created",value:e.createdAt}),c.jsx(Ac,{label:"Updated",value:e.updatedAt}),e.toolName&&c.jsx(Ac,{label:"Tool",value:e.toolName}),e.toolCallId&&c.jsx(Ac,{label:"Tool call",value:e.toolCallId})]})]}),e.description&&c.jsxs("div",{className:et.section,children:[c.jsx("div",{className:et.sectionTitle,children:"Description"}),c.jsx("div",{className:et.description,children:e.description})]}),i&&e.metadata&&c.jsxs("div",{className:et.section,children:[c.jsx("div",{className:et.sectionTitle,children:"Details"}),c.jsxs("div",{className:et.fieldGrid,children:[Gp(e.metadata,"automationId","Automation ID"),Gp(e.metadata,"schedule","Schedule"),Gp(e.metadata,"timezone","Timezone"),Gp(e.metadata,"status","Status"),Gp(e.metadata,"nextRunAt","Next run"),Gp(e.metadata,"prompt","Prompt")]})]}),(r||s)&&c.jsxs("div",{className:et.section,children:[c.jsx("div",{className:et.sectionTitle,children:"Location"}),s?c.jsx("a",{className:et.link,href:s,target:"_blank",rel:"noreferrer",children:s}):c.jsx("div",{className:et.meta,children:r})]})]})}function Kht(e){var n;const t=((n=e.workspacePath)==null?void 0:n.toLowerCase())??"";return e.kind==="html"||t.endsWith(".html")||t.endsWith(".htm")}function Yht({workspacePath:e,artifactVersion:t,workspaceActions:n,previewContent:r}){const[s,i]=f.useState(r??null),[o,a]=f.useState(null);return f.useEffect(()=>{let l=!1;return i(r??null),a(null),n.readWorkspaceFile(e).then(u=>{l||(i(u.content),u.truncated&&a("Preview is truncated because the file is too large."))}).catch(u=>{l||a(u instanceof Error?u.message:String(u))}),()=>{l=!0}},[t,r,n,e]),c.jsxs("div",{className:et.htmlPreviewWrap,children:[s===null?c.jsx("div",{className:et.empty,children:"Loading preview..."}):c.jsx("iframe",{className:et.htmlPreview,referrerPolicy:"no-referrer",sandbox:"",srcDoc:hVe(s),title:`Preview ${e}`}),o&&c.jsx("div",{className:et.previewError,children:o})]})}function Xht({workspacePath:e,artifactVersion:t,workspaceActions:n}){const r=f.useRef(null),[s,i]=f.useState(null),[o,a]=f.useState(null);return f.useEffect(()=>{let l=!1;return i(null),a(null),n.readWorkspaceFile(e).then(u=>{l||(i(u.content),u.truncated&&a("File is truncated because it is too large."))}).catch(u=>{l||a(u instanceof Error?u.message:String(u))}),()=>{l=!0}},[t,n,e]),f.useEffect(()=>{const l=r.current;if(!l||s===null)return;l.replaceChildren();let u;try{u=new It({doc:s,extensions:[VJ,It.editable.of(!1),Ir.readOnly.of(!0),It.lineWrapping],parent:l})}catch(d){a(d instanceof Error?d.message:String(d));return}return()=>u.destroy()},[s]),c.jsxs("div",{className:et.filePreviewWrap,children:[s===null?c.jsx("div",{className:et.empty,children:"Loading file..."}):c.jsx("div",{ref:r,className:et.codeMirrorFile}),o&&c.jsx("div",{className:et.previewError,children:o})]})}function Ac({label:e,value:t}){return t?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:et.fieldLabel,children:e}),c.jsx("span",{className:et.fieldValue,children:t})]}):null}function Gp(e,t,n){const r=e[t];return r==null||r===""?null:c.jsx(Ac,{label:n,value:String(r)},t)}/**
 * @license
 * Copyright 2025 Qwen Team
 * SPDX-License-Identifier: Apache-2.0
 */const Qht="(min-width: 1024px)";function BF(e=Qht){const[t,n]=f.useState(()=>Jht(e));return f.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const r=window.matchMedia(e);n(r.matches);const s=i=>n(i.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}function Jht(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function qse(e){try{return new Date(e).toLocaleString()}catch{return String(e)}}function Zht(e,t){const n=e.kind==="catch-up"?` · ${t("scheduledTasks.runKind.catchUp")}`:e.kind==="manual"?` · ${t("scheduledTasks.runKind.manual")}`:"",r=e.withheld?` · ${t("scheduledTasks.runKind.withheld")}`:"";return`${qse(e.at)}${n}${r}`}function $F(e,t,n){const r=e.split(/[\\/]/).filter(Boolean),s=r[r.length-1]||e;return t?`${s} ${n("scheduledTasks.workspacePrimaryTag")}`:s}function eh(e){return`${e.workspaceId??""}:${e.id}`}const eft=["daily","weekdays","weekly","hourly","minutes","custom"],tft=[1,2,3,4,5,6,10,12,15,20,30],nft=2147483647,rft=3,sft=3e4,gv=1e5,ift=/[^\p{L}\p{N}_.-]/gu,zF=/(^|[\s])(@(?:ext|mcp):(?:\\.[^\s\\]*|[^\s\\])+|\/(?:\\.[^\s\\/]*|[^\s\\/])+)(?=$|\s)/gu,oft=["--background","--foreground","--muted","--muted-foreground","--border","--error-color","--font-mono"];function vT(e){return e.replace(ift,"\\$&")}function xT(e){return e.replace(/\\(.)/g,"$1")}function aft(e){if(e.startsWith("@ext:")){const t=xT(e.slice(5));return{id:`extension:${t}`,kind:"extension",label:t,insertText:e}}if(e.startsWith("@mcp:")){const t=xT(e.slice(5));return{id:`mcp:${t}`,kind:"mcp",label:t,insertText:e}}if(e.startsWith("/")){const t=xT(e.slice(1));return t?{id:`skill:${t}`,kind:"skill",label:t,insertText:e}:null}return null}function lft(e){return e.displayName&&e.displayName!==e.name?e.displayName:e.description}function cft(e){return e.description||e.argumentHint||e.level}function uft(e){return e.description||e.mcpStatus}function Hse(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";if(!(e instanceof HTMLElement))return"";const t=e.dataset.promptTagSerialized;if(t)return t;if(e.tagName==="BR")return`
`;let n="";return e.childNodes.forEach(r=>{n+=Hse(r)}),e.tagName==="DIV"||e.tagName==="P"?`${n}
`:n}function Use(e){let t="";return e.childNodes.forEach(n=>{t+=Hse(n)}),t}function Vse(e){return e.replace(/\u00a0/g," ").replace(/\n$/,"")}function N3(e){return Vse(Use(e))}function dft(e){return Vse(Use(e))}function Oj(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function wT(e,t){t&&e.appendChild(document.createTextNode(t))}function Wse(e,t){if(Oj(e),!t)return;t.split(`
`).forEach((r,s)=>{s>0&&e.appendChild(document.createElement("br")),hft(e,r)})}function FF(e){let t=N3(e);return t.length>gv?(t=t.slice(0,gv),Wse(e,t)):t.trim().length===0&&(Oj(e),t=""),t}function qF(e,t){const n=gv-N3(e).length;n<=0||document.execCommand("insertText",!1,t.slice(0,n))}function HF(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?{selection:t,text:dft(n.cloneContents())}:null}function Gse(e){const t=document.createElement("span");t.className=Ue.promptTag,t.contentEditable="false",t.dataset.promptTagSerialized=e.insertText.trim();const n=hp(e.kind);if(n){const s=document.createElement("span");s.className=Ue.promptTagIcon,s.style.setProperty("--composer-tag-icon-url",BS(n)),s.setAttribute("aria-hidden","true"),t.appendChild(s)}const r=document.createElement("span");return r.className=Ue.promptTagValue,r.textContent=e.label,t.appendChild(r),t}function hft(e,t){let n=0;zF.lastIndex=0;for(const r of t.matchAll(zF)){const[s,i,o]=r,a=r.index??0,l=aft(o);l&&(wT(e,t.slice(n,a)),wT(e,i),e.appendChild(Gse(l)),n=a+s.length)}wT(e,t.slice(n))}function fft(e,t){var a;const n=window.getSelection(),r=Gse(t),s=document.createTextNode(" ");N3(e).trim().length===0&&Oj(e);const i=((a=e.lastChild)==null?void 0:a.textContent)??"";e.childNodes.length>0&&!/\s$/.test(i)&&e.appendChild(document.createTextNode(" ")),e.appendChild(r),e.appendChild(s);const o=document.createRange();o.setStartAfter(s),o.collapse(!0),n==null||n.removeAllRanges(),n==null||n.addRange(o)}function mft({value:e,label:t,placeholder:n,onChange:r,insertItem:s,onInserted:i}){const o=f.useRef(null),a=f.useRef("");return f.useEffect(()=>{const l=o.current;l&&e!==a.current&&(Wse(l,e),a.current=e)},[e]),f.useEffect(()=>{const l=o.current;if(!l||!s)return;fft(l,s);const u=N3(l);a.current=u,r(u),l.focus(),i()},[s,r,i]),c.jsxs("div",{className:Ue.promptEditorWrap,children:[c.jsx("div",{ref:o,className:Ue.promptEditor,contentEditable:!0,role:"textbox","aria-label":t,"aria-multiline":"true","aria-placeholder":n,onInput:l=>{const u=FF(l.currentTarget);a.current=u,r(u)},onPaste:l=>{l.preventDefault(),qF(l.currentTarget,l.clipboardData.getData("text/plain"))},onDrop:l=>{l.preventDefault(),qF(l.currentTarget,l.dataTransfer.getData("text/plain"))},onCopy:l=>{const u=HF(l.currentTarget);u&&(l.preventDefault(),l.clipboardData.setData("text/plain",u.text))},onCut:l=>{const u=HF(l.currentTarget);if(!u)return;l.preventDefault(),l.clipboardData.setData("text/plain",u.text),u.selection.deleteFromDocument();const d=FF(l.currentTarget);a.current=d,r(d)}}),e.trim().length===0&&c.jsx("div",{className:Ue.promptPlaceholder,children:n})]})}function pft({onRunPrompt:e,onCreateViaChat:t,onOpenSession:n,workspaces:r,lockedWorkspace:s,onError:i}){const{t:o}=gt(),a=ko(),l=f.useMemo(()=>r??[],[r]),u=!s&&l.length>1,d=f.useMemo(()=>l.filter(ne=>ne.primary||ne.trusted),[l]),h=f.useCallback(ne=>ne.primary?void 0:ne.id,[]),m=s?h(s):void 0,[p,g]=f.useState(null),[b,x]=f.useState(null),[v,y]=f.useState(null),[w,k]=f.useState(null),[T,S]=f.useState(!1),[C,_]=f.useState(null),[A,M]=f.useState(m),[L,N]=f.useState(""),[O,B]=f.useState(""),[$,P]=f.useState(jc),[K,F]=f.useState(!1),[H,D]=f.useState(null),[Q,U]=f.useState(null),[j,ie]=f.useState([]),[oe,J]=f.useState(!1),[V,se]=f.useState(null),[Z,X]=f.useState(null),te=f.useRef(null),ae=f.useRef(null),[xe,Ae]=f.useState(null),[Ne,Le]=f.useState({}),[ge,Oe]=f.useState(null),[Nt,Pe]=f.useState(()=>Date.now()),Ce=f.useRef(!0),Zt=f.useRef(0),dt=f.useRef(0);f.useEffect(()=>(Ce.current=!0,()=>{Ce.current=!1}),[]);const Ge=f.useCallback(async()=>{const ne=++Zt.current;try{let De,Dt=null;if(s?De=(await a.listScheduledTasks(m)).map(Lt=>({...Lt,workspaceId:m,workspaceCwd:s.cwd})):u?De=(await Promise.all(d.map(async ke=>{try{return(await a.listScheduledTasks(h(ke))).map(fe=>({...fe,workspaceId:h(ke),workspaceCwd:ke.cwd}))}catch(Ot){return Dt||(Dt=Ot instanceof Error?Ot.message:String(Ot)),[]}}))).flat():De=await a.listScheduledTasks(),!Ce.current||ne!==Zt.current)return;const ze=[...De].sort((Lt,ke)=>ke.createdAt-Lt.createdAt);g(ze),x(Dt)}catch(De){if(!Ce.current||ne!==Zt.current)return;x(De instanceof Error?De.message:String(De)),g(Dt=>Dt??[])}},[a,u,s,m,d,h]);f.useEffect(()=>{Ge()},[Ge]);const St=!!(p!=null&&p.some(ne=>ne.nextRunAt!=null));f.useEffect(()=>{if(!St)return;const ne=window.setInterval(()=>Pe(Date.now()),1e3);return()=>window.clearInterval(ne)},[St]);const Y=f.useRef(0);f.useEffect(()=>{if(!p)return;let ne=1/0;for(const Lt of p)Lt.nextRunAt!=null&&Lt.nextRunAt<ne&&(ne=Lt.nextRunAt);if(!Number.isFinite(ne))return;const De=ne-Date.now();let Dt;De>0?(Y.current=0,Dt=Math.min(De+2e3,nft)):Dt=Y.current++<rft?1e3:sft;const ze=window.setTimeout(()=>void Ge(),Dt);return()=>window.clearTimeout(ze)},[p,Ge]);const je=o4($),We=je?pv(je,o):null,Te=f.useCallback(()=>{const ne=te.current;if(!ne){Ae(null);return}const De=getComputedStyle(ne);Le(Object.fromEntries(oft.map(fe=>[fe,De.getPropertyValue(fe)])));const Dt=ne.getBoundingClientRect(),ze=Math.min(420,window.innerWidth-24),Lt=Math.max(12,Math.min(Dt.left,window.innerWidth-ze-12)),ke=Dt.bottom+6,Ot=Math.max(140,Math.min(320,window.innerHeight-ke-12));Ae(fe=>{const pt={left:Lt,top:ke,width:ze,maxHeight:Ot};return fe&&fe.left===pt.left&&fe.top===pt.top&&fe.width===pt.width&&fe.maxHeight===pt.maxHeight?fe:pt})},[]),jt=f.useCallback(()=>{dt.current+=1,U(null),ie([]),J(!1),se(null),X(null),Ae(null),Le({})},[]),zt=f.useCallback(async ne=>{const De=++dt.current;if(Q===ne){jt();return}Te(),U(ne),J(!0),se(null),ie([]);try{let Dt;if(ne==="extension"?Dt=((await a.loadExtensionsStatus()).extensions??[]).filter(Lt=>Lt.isActive).map(Lt=>({id:Lt.id||Lt.name,kind:ne,label:Lt.name,description:lft(Lt),insertText:`@ext:${vT(Lt.name)} `})):ne==="skill"?Dt=((await a.loadSkillsStatus()).skills??[]).filter(Lt=>Lt.modelInvocable).map(Lt=>({id:Lt.name,kind:ne,label:Lt.name,description:cft(Lt),insertText:`/${vT(Lt.name)} `})):Dt=((await a.loadMcpStatus()).servers??[]).filter(Lt=>!Lt.disabled).map(Lt=>({id:Lt.name,kind:ne,label:Lt.name,description:uft(Lt),insertText:`@mcp:${vT(Lt.name)} `})),!Ce.current||De!==dt.current)return;ie(Dt)}catch(Dt){if(!Ce.current||De!==dt.current)return;se(Dt instanceof Error?Dt.message:String(Dt))}finally{Ce.current&&De===dt.current&&J(!1)}},[a,Q,jt,Te]);f.useEffect(()=>{if(!Q)return;Te();const ne=ze=>{const Lt=te.current,ke=ae.current;Lt!=null&&Lt.contains(ze.target)||ke!=null&&ke.contains(ze.target)||jt()},De=ze=>{ze.key==="Escape"&&(ze.preventDefault(),ze.stopPropagation(),jt())},Dt=()=>Te();return document.addEventListener("pointerdown",ne),document.addEventListener("keydown",De,!0),window.addEventListener("resize",Dt),window.addEventListener("scroll",Dt,!0),()=>{document.removeEventListener("pointerdown",ne),document.removeEventListener("keydown",De,!0),window.removeEventListener("resize",Dt),window.removeEventListener("scroll",Dt,!0)}},[Q,jt,Te]);const bn=f.useCallback(()=>{N(""),B(""),P(jc),D(null),S(!1),_(null),M(m),jt()},[m,jt]),Pn=f.useCallback(()=>{_(null),M(m),N(""),B(""),P(jc),D(null),jt(),S(!0)},[m,jt]),qe=f.useCallback(ne=>{_(ne.id),M(ne.workspaceId),N(ne.name??""),B(ne.prompt),P(rh(ne.cron)),D(null),jt(),S(!0)},[jt]),At=f.useCallback(async()=>{const ne=o4($);if(!ne){D(o("scheduledTasks.error.invalidSchedule"));return}if(O.trim().length===0){D(o("scheduledTasks.error.emptyPrompt"));return}if(O.length>gv){D(o("scheduledTasks.error.promptTooLong",{max:gv}));return}F(!0),D(null);try{if(C?await a.updateScheduledTask(C,{cron:ne,prompt:O.trim(),name:L.trim()||null},A):await a.createScheduledTask({cron:ne,prompt:O.trim(),name:L.trim()||null,recurring:!0,enabled:!0},A),!Ce.current)return;bn(),await Ge()}catch(De){if(!Ce.current)return;D(De instanceof Error?De.message:String(De))}finally{Ce.current&&F(!1)}},[a,$,C,A,L,O,Ge,bn,o]),he=f.useCallback(async ne=>{y(eh(ne));try{await a.updateScheduledTask(ne.id,{enabled:!ne.enabled},ne.workspaceId),await Ge()}catch(De){i(De,o("scheduledTasks.error.toggleFailed"))}finally{Ce.current&&y(null)}},[a,i,Ge,o]),Be=f.useCallback(async ne=>{if(!(!ne.enabled||w!==null)){k(ne.id);try{const De=(await a.listScheduledTasks(ne.workspaceId)).find(Dt=>Dt.id===ne.id);if(!De||!De.enabled){await Ge().catch(()=>{}),i(new Error("This task is no longer runnable."),o("scheduledTasks.error.runFailed"));return}if(De.recurring){await e(De.prompt,De.sessionId);try{await a.runScheduledTask(De.id,ne.workspaceId),await Ge()}catch(Dt){i(Dt,o("scheduledTasks.error.runFailed"))}}else{await a.runScheduledTask(De.id,ne.workspaceId),await Ge();try{await e(De.prompt,De.sessionId)}catch(Dt){i(Dt,o("scheduledTasks.error.oneShotConsumedButFailed"));return}}}catch(De){i(De,o("scheduledTasks.error.runFailed"))}finally{k(null)}}},[a,i,e,Ge,w,o]),Ie=f.useCallback(async ne=>{const De=ne.name||ne.prompt,Dt=De.length>60?`${De.slice(0,57)}…`:De;if(window.confirm(o("scheduledTasks.deleteConfirm",{name:Dt}))){y(eh(ne));try{await a.deleteScheduledTask(ne.id,ne.workspaceId),await Ge()}catch(ze){i(ze,o("scheduledTasks.error.deleteFailed"))}finally{Ce.current&&y(null)}}},[a,i,Ge,o]),Ke=Q&&xe?rc.createPortal(c.jsx("div",{ref:ae,className:Ue.referencePicker,role:"listbox","aria-label":o("scheduledTasks.referencePicker"),style:{...Ne,left:xe.left,top:xe.top,width:xe.width,maxHeight:xe.maxHeight},children:oe?c.jsx("div",{className:Ue.referenceEmpty,children:o("scheduledTasks.reference.loading")}):V?c.jsx("div",{className:Ue.referenceError,children:V}):j.length===0?c.jsx("div",{className:Ue.referenceEmpty,children:o("scheduledTasks.reference.empty")}):j.map(ne=>c.jsxs("button",{type:"button",className:Ue.referenceItem,role:"option","aria-selected":"false",onMouseDown:De=>De.preventDefault(),onClick:()=>{X(ne),U(null)},children:[c.jsx("span",{className:Ue.referenceItemLabel,children:ne.label}),ne.description&&c.jsx("span",{className:Ue.referenceItemDescription,children:ne.description})]},`${ne.kind}:${ne.id}`))}),document.body):null;return c.jsxs("div",{className:Ue.root,children:[c.jsx("div",{className:Ue.intro,children:o("scheduledTasks.subtitle")}),c.jsxs("div",{className:Ue.toolbar,children:[c.jsx("div",{className:Ue.count,children:p===null?o("scheduledTasks.loading"):o("scheduledTasks.count",{count:p.length})}),c.jsxs("div",{className:Ue.toolbarActions,children:[c.jsx("button",{type:"button",className:Ue.secondaryButton,onClick:()=>void Ge(),children:o("scheduledTasks.refresh")}),c.jsx("button",{type:"button",className:Ue.secondaryButton,onClick:t,children:o("scheduledTasks.createViaChat")}),c.jsx("button",{type:"button",className:Ue.primaryButton,onClick:Pn,children:o("scheduledTasks.new")})]})]}),T&&c.jsx(Qs,{title:o(C?"scheduledTasks.editTitle":"scheduledTasks.new"),size:"md",onClose:bn,children:c.jsxs("div",{className:Ue.formFields,children:[u&&c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:o("scheduledTasks.workspace")}),c.jsx("select",{className:Ue.select,value:A??"",disabled:!!C||d.length<=1,onChange:ne=>M(ne.target.value||void 0),children:d.map(ne=>c.jsx("option",{value:h(ne)??"",children:$F(ne.cwd,ne.primary,o)},ne.id))})]}),c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:o("scheduledTasks.name")}),c.jsx("input",{className:Ue.input,type:"text",value:L,maxLength:200,placeholder:o("scheduledTasks.namePlaceholder"),onChange:ne=>N(ne.target.value)})]}),c.jsxs("label",{className:Ue.field,children:[c.jsxs("span",{className:Ue.fieldLabel,children:[o("scheduledTasks.prompt"),c.jsx("span",{className:Ue.required,children:"*"})]}),c.jsx(mft,{value:O,label:o("scheduledTasks.prompt"),placeholder:o("scheduledTasks.promptPlaceholder"),onChange:B,insertItem:Z,onInserted:()=>X(null)})]}),c.jsx("div",{ref:te,className:Ue.referencePopover,children:c.jsx("div",{className:Ue.referenceBar,children:["extension","skill","mcp"].map(ne=>{const De=hp(ne);return c.jsxs("button",{type:"button",className:`${Ue.referenceButton} ${Q===ne?Ue.referenceButtonActive:""}`,"aria-expanded":Q===ne,onClick:()=>void zt(ne),children:[De&&c.jsx("span",{className:Ue.referenceButtonIcon,style:{"--composer-tag-icon-url":BS(De)},"aria-hidden":!0}),o(`scheduledTasks.reference.${ne}`)]},ne)})})}),c.jsxs("div",{className:Ue.scheduleRow,children:[c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:o("scheduledTasks.frequency")}),c.jsx("select",{className:Ue.select,value:$.frequency,onChange:ne=>{const De=ne.target.value;P(Dt=>({...Dt,frequency:De,...De==="hourly"?{time:"00:00"}:{}}))},children:eft.map(ne=>c.jsx("option",{value:ne,children:o(`scheduledTasks.freq.${ne}`)},ne))})]}),($.frequency==="daily"||$.frequency==="weekdays"||$.frequency==="weekly")&&c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:o("scheduledTasks.time")}),c.jsx("input",{className:Ue.input,type:"time",value:$.time,onChange:ne=>P(De=>({...De,time:ne.target.value}))})]}),$.frequency==="weekly"&&c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:o("scheduledTasks.weekday")}),c.jsx("select",{className:Ue.select,value:$.weekday,onChange:ne=>P(De=>({...De,weekday:Number(ne.target.value)})),children:o("scheduledTasks.weekdayNames").split(",").map((ne,De)=>c.jsx("option",{value:De,children:ne},De))})]}),$.frequency==="minutes"&&c.jsxs("label",{className:Ue.field,children:[c.jsx("span",{className:Ue.fieldLabel,children:o("scheduledTasks.interval")}),c.jsx("select",{className:Ue.select,value:$.minuteInterval,onChange:ne=>P(De=>({...De,minuteInterval:Number(ne.target.value)})),children:tft.map(ne=>c.jsx("option",{value:ne,children:ne},ne))})]}),$.frequency==="custom"&&c.jsxs("label",{className:`${Ue.field} ${Ue.fieldGrow}`,children:[c.jsx("span",{className:Ue.fieldLabel,children:o("scheduledTasks.cron")}),c.jsx("input",{className:Ue.input,type:"text",value:$.customCron,spellCheck:!1,placeholder:"0 9 * * 1-5",onChange:ne=>P(De=>({...De,customCron:ne.target.value}))})]})]}),c.jsx("div",{className:Ue.preview,children:We?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Ue.previewLabel,children:We}),c.jsx("code",{className:Ue.previewCron,children:je})]}):c.jsx("span",{className:Ue.previewInvalid,children:o("scheduledTasks.error.invalidSchedule")})}),H&&c.jsx("div",{className:Ue.formError,children:H}),c.jsxs("div",{className:Ue.formActions,children:[c.jsx("button",{type:"button",className:Ue.secondaryButton,onClick:bn,disabled:K,children:o("scheduledTasks.cancel")}),c.jsx("button",{type:"button",className:Ue.primaryButton,onClick:()=>void At(),disabled:K,children:o(K?C?"scheduledTasks.saving":"scheduledTasks.creating":C?"scheduledTasks.save":"scheduledTasks.create")})]})]})}),Ke,b&&c.jsx("div",{className:Ue.loadError,children:b}),p!==null&&p.length===0&&!b&&c.jsx("div",{className:Ue.empty,children:o("scheduledTasks.empty")}),c.jsx("div",{className:Ue.list,children:(p??[]).map(ne=>{const De=ne.name||ne.prompt,Dt=v===eh(ne);return c.jsxs("div",{className:`${Ue.card} ${ne.enabled?"":Ue.cardDisabled}`,children:[c.jsxs("div",{className:Ue.cardHeader,children:[c.jsx("button",{type:"button",role:"switch","aria-checked":ne.enabled,"aria-label":ne.enabled?o("scheduledTasks.disable"):o("scheduledTasks.enable"),className:`${Ue.toggle} ${ne.enabled?Ue.toggleOn:""}`,onClick:()=>void he(ne),disabled:Dt,children:c.jsx("span",{className:Ue.toggleKnob})}),c.jsx("div",{className:Ue.cardTitle,title:De,children:De}),c.jsxs("div",{className:Ue.cardMenu,children:[c.jsx("button",{type:"button",className:Ue.iconAction,onClick:()=>void Be(ne),disabled:!ne.enabled||w!==null,title:o("scheduledTasks.runNow"),"aria-label":o("scheduledTasks.runNow"),children:"▶"}),c.jsx("button",{type:"button",className:Ue.iconAction,onClick:()=>qe(ne),disabled:Dt,title:o("scheduledTasks.edit"),"aria-label":o("scheduledTasks.edit"),children:"✎"}),c.jsx("button",{type:"button",className:Ue.iconAction,onClick:()=>void Ie(ne),disabled:Dt,title:o("scheduledTasks.delete"),"aria-label":o("scheduledTasks.delete"),children:"✕"})]})]}),ne.name&&c.jsx("div",{className:Ue.cardPrompt,title:ne.prompt,children:ne.prompt}),c.jsxs("div",{className:Ue.cardFooter,children:[u&&ne.workspaceCwd&&c.jsxs("span",{className:Ue.workspacePill,title:ne.workspaceCwd,children:[c.jsx("span",{className:Ue.workspaceIcon,"aria-hidden":"true",children:"⌂"}),$F(ne.workspaceCwd,!ne.workspaceId,o)]}),c.jsxs("span",{className:Ue.schedulePill,children:[c.jsx("span",{className:Ue.clockIcon,"aria-hidden":"true",children:"◷"}),pv(ne.cron,o)]}),c.jsx("span",{className:Ue.recurringTag,children:o(ne.recurring?"scheduledTasks.repeats":"scheduledTasks.runsOnce")}),ne.nextRunAt!=null&&c.jsxs("span",{className:Ue.countdown,"data-testid":"scheduled-task-next-run",title:o("scheduledTasks.nextRunTooltip",{when:qse(ne.nextRunAt)}),children:[c.jsx("span",{className:Ue.hourglassIcon,"aria-hidden":"true",children:"⏳"}),cVe(ne.nextRunAt-Nt,o)]}),c.jsx("span",{className:Ue.lastFired,children:uVe(ne,o)}),ne.sessionId&&n?c.jsx("button",{type:"button",className:Ue.runsToggle,onClick:()=>n(ne.sessionId),title:o("scheduledTasks.viewHistoryHint"),children:ne.runs.length>0?o("scheduledTasks.viewHistory",{count:ne.runs.length}):o("scheduledTasks.viewHistoryEmpty")}):ne.runs.length>0&&c.jsx("button",{type:"button",className:Ue.runsToggle,"aria-expanded":ge===eh(ne),onClick:()=>Oe(ze=>ze===eh(ne)?null:eh(ne)),children:o("scheduledTasks.runHistory",{count:ne.runs.length})})]}),ge===eh(ne)&&ne.runs.length>0&&c.jsx("ul",{className:Ue.runsList,children:[...ne.runs].reverse().map((ze,Lt)=>c.jsx("li",{className:Ue.runsItem,children:Zht(ze,o)},`${ze.at}-${Lt}`))})]},eh(ne))})})]})}const gft="_extensionGrid_1aki4_1",bft={extensionGrid:gft};function yft(e,t){return e&&t.some(n=>n.name===e)?e:null}function vft(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>[r.name,r.displayName,r.description].filter(s=>!!s).some(s=>s.toLowerCase().includes(n))):[...e]}const xft=bp("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function la({className:e,variant:t,...n}){return c.jsx("div",{"data-slot":"alert",role:"alert",className:tn(xft({variant:t}),e),...n})}function bm({className:e,...t}){return c.jsx("div",{"data-slot":"alert-title",className:tn("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",e),...t})}function ca({className:e,...t}){return c.jsx("div",{"data-slot":"alert-description",className:tn("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),...t})}function UF({...e}){return c.jsx(uje,{"data-slot":"alert-dialog",...e})}function wft({container:e,...t}){const n=yd();return c.jsx(dje,{"data-slot":"alert-dialog-portal",container:e??n??void 0,...t})}const kft=f.forwardRef(function({className:t,...n},r){return c.jsx(hje,{ref:r,"data-slot":"alert-dialog-overlay",className:tn("fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",t),...n})}),VF=f.forwardRef(function({className:t,size:n="default",...r},s){return c.jsxs(wft,{children:[c.jsx(kft,{}),c.jsx(fje,{ref:s,"data-slot":"alert-dialog-content","data-size":n,className:tn("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none focus-visible:ring-3 focus-visible:ring-ring/50 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=middle]:max-w-[calc(100%-2rem)] data-[size=default]:sm:max-w-sm data-[size=middle]:sm:max-w-xl data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...r})]})});function WF({className:e,...t}){return c.jsx("div",{"data-slot":"alert-dialog-header",className:tn("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function GF({className:e,...t}){return c.jsx("div",{"data-slot":"alert-dialog-footer",className:tn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function KF({className:e,...t}){return c.jsx(gje,{"data-slot":"alert-dialog-title",className:tn("text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function YF({className:e,...t}){return c.jsx(bje,{"data-slot":"alert-dialog-description",className:tn("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function _ft({className:e,variant:t="default",size:n="default",...r}){return c.jsx(Fr,{variant:t,size:n,asChild:!0,children:c.jsx(mje,{"data-slot":"alert-dialog-action",className:tn(e),...r})})}function XF({className:e,variant:t="outline",size:n="default",...r}){return c.jsx(Fr,{variant:t,size:n,asChild:!0,children:c.jsx(pje,{"data-slot":"alert-dialog-cancel",className:tn(e),...r})})}const Sft=bp("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Kc({className:e,variant:t="default",asChild:n=!1,...r}){const s=n?MN:"span";return c.jsx(s,{"data-slot":"badge","data-variant":t,className:tn(Sft({variant:t}),e),...r})}function x4({className:e,...t}){return c.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:tn(e),...t})}function w4({className:e,...t}){return c.jsx("ol",{"data-slot":"breadcrumb-list",className:tn("flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground",e),...t})}function Ba({className:e,...t}){return c.jsx("li",{"data-slot":"breadcrumb-item",className:tn("inline-flex items-center gap-1",e),...t})}function M0({asChild:e,className:t,...n}){const r=e?MN:"a";return c.jsx(r,{"data-slot":"breadcrumb-link",className:tn("transition-colors hover:text-foreground",t),...n})}function Du({className:e,...t}){return c.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:tn("font-normal text-foreground",e),...t})}function N0({children:e,className:t,...n}){return c.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:tn("[&>svg]:size-3.5",t),...n,children:e??c.jsx(Y4,{})})}function Rc({className:e,size:t="default",...n}){return c.jsx("div",{"data-slot":"card","data-size":t,className:tn("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...n})}function Am({className:e,...t}){return c.jsx("div",{"data-slot":"card-header",className:tn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)",e),...t})}function Em({className:e,...t}){return c.jsx("div",{"data-slot":"card-title",className:tn("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",e),...t})}function j0({className:e,...t}){return c.jsx("div",{"data-slot":"card-description",className:tn("text-sm text-muted-foreground",e),...t})}function Cft({className:e,...t}){return c.jsx("div",{"data-slot":"card-action",className:tn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function Z0({className:e,...t}){return c.jsx("div",{"data-slot":"card-content",className:tn("px-(--card-spacing)",e),...t})}function my({...e}){return c.jsx(tDe,{"data-slot":"dropdown-menu",...e})}function Tft({container:e,...t}){const n=yd();return c.jsx(rDe,{"data-slot":"dropdown-menu-portal",container:e??n??void 0,...t})}function py({...e}){return c.jsx(nDe,{"data-slot":"dropdown-menu-trigger",...e})}function gy({className:e,align:t="start",sideOffset:n=4,...r}){return c.jsx(Tft,{children:c.jsx(sDe,{"data-slot":"dropdown-menu-content",sideOffset:n,align:t,className:tn("z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r})})}function bv({...e}){return c.jsx(iDe,{"data-slot":"dropdown-menu-group",...e})}function $a({className:e,inset:t,variant:n="default",...r}){return c.jsx(oDe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:tn("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function Aft({className:e,...t}){return c.jsx(aDe,{"data-slot":"dropdown-menu-separator",className:tn("-mx-1 my-1 h-px bg-border",e),...t})}function QF({...e}){return c.jsx(lDe,{"data-slot":"dropdown-menu-sub",...e})}function JF({className:e,inset:t,children:n,...r}){return c.jsxs(cDe,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:tn("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,c.jsx(Y4,{className:"ml-auto"})]})}function ZF({className:e,...t}){return c.jsx(uDe,{"data-slot":"dropdown-menu-sub-content",className:tn("z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...t})}function zh({className:e,...t}){return c.jsx("div",{"data-slot":"empty",className:tn("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...t})}function Fh({className:e,...t}){return c.jsx("div",{"data-slot":"empty-header",className:tn("flex max-w-sm flex-col items-center gap-2",e),...t})}const Eft=bp("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default"}});function qh({className:e,variant:t="default",...n}){return c.jsx("div",{"data-slot":"empty-icon","data-variant":t,className:tn(Eft({variant:t,className:e})),...n})}function Hh({className:e,...t}){return c.jsx("div",{"data-slot":"empty-title",className:tn("text-sm font-medium tracking-tight",e),...t})}function ox({className:e,...t}){return c.jsx("div",{"data-slot":"empty-description",className:tn("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Mft({className:e,...t}){return c.jsx("div",{"data-slot":"empty-content",className:tn("flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance",e),...t})}function Nft({className:e,...t}){return c.jsx(kte,{"data-slot":"radio-group",className:tn("grid w-full gap-2",e),...t})}function jft({className:e,...t}){return c.jsx(Cte,{"data-slot":"radio-group-item",className:tn("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary",e),...t,children:c.jsx(Ate,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:c.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}function Kse({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return c.jsx(fLe,{"data-slot":"separator",decorative:n,orientation:t,className:tn("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...r})}function Ka({className:e,...t}){return c.jsx(Lfe,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:tn("size-4 animate-spin",e),...t})}function j3({className:e,orientation:t="horizontal",...n}){return c.jsx(xLe,{orientation:t,"data-slot":"tabs","data-orientation":t,className:tn("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})}const Ift=bp("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function I3({className:e,variant:t="default",...n}){return c.jsx(wLe,{"data-slot":"tabs-list","data-variant":t,className:tn(Ift({variant:t}),e),...n})}function qa({className:e,...t}){return c.jsx(kLe,{"data-slot":"tabs-trigger",className:tn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function Xl({className:e,...t}){return c.jsx(_Le,{"data-slot":"tabs-content",className:tn("flex-1 text-sm outline-none",e),...t})}const eq="update available";function ab(e){return e.displayName||e.name}function kT(e,t){return e.isActive?t("extensions.manage.status.enabled"):t("extensions.manage.status.disabled")}function _T(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"updating":return t("extensions.manage.updating");case"updated":return t("extensions.manage.updateComplete");case"updated with warnings":return t("extensions.manage.updatedWithWarnings");case"updated, needs restart":return t("extensions.manage.restartRequired");case"error":return t("extensions.manage.updateError");case"unknown":case void 0:return t("extensions.manage.unknownUpdate")}}function ak(e,t,n){switch(e){case"enable":return n("extensions.manage.enabling",{name:t});case"disable":return n("extensions.manage.disabling",{name:t});case"uninstall":return n("extensions.manage.uninstalling",{name:t});case"update":return n("extensions.manage.updatingExtension",{name:t});default:return n("extensions.manage.queued",{name:t})}}function Rft(e,t,n){switch(e){case"enable":return n("extensions.manage.enabled",{name:t});case"disable":return n("extensions.manage.disabled",{name:t});case"uninstall":return n("extensions.manage.uninstalled",{name:t});case"update":return n("extensions.manage.updated",{name:t});default:return n("extensions.manage.queued",{name:t})}}function Mu({label:e,value:t}){return c.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[c.jsx("div",{className:"text-sm font-medium",children:pm(e)}),c.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function lb({items:e,empty:t,icon:n}){return e.length?c.jsx(Rc,{children:c.jsx(Z0,{className:"flex flex-col",children:e.map((r,s)=>c.jsxs("div",{children:[s>0?c.jsx(Kse,{}):null,c.jsxs("div",{className:"flex min-w-0 items-center gap-3 py-3 [contain-intrinsic-size:auto_44px] [content-visibility:auto]",children:[c.jsx(n,{className:"size-4 shrink-0 text-muted-foreground"}),c.jsx("span",{className:"min-w-0 break-words",children:r})]})]},r))})}):c.jsx(zh,{className:"border",children:c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:c.jsx(n,{})}),c.jsx(Hh,{children:t})]})})}function tq({pendingInteraction:e,submitting:t,selectedPlugin:n,interactionValue:r,setSelectedPlugin:s,setInteractionValue:i,submit:o,t:a}){return c.jsx(c4,{open:!!e,onOpenChange:l=>{!l&&e&&!t&&o({cancelled:!0})},children:c.jsxs(u4,{showCloseButton:!1,className:"max-h-[calc(100vh-2rem)] overflow-y-auto sm:max-w-3xl",children:[c.jsxs(d4,{className:"items-start px-3 text-left",children:[c.jsx(f4,{children:(e==null?void 0:e.interaction.kind)==="setting"?e.interaction.setting.name:a("extensions.manage.selectExtension")}),c.jsx(m4,{children:(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?a("extensions.manage.installSelectPluginDescription",{marketplace:e.interaction.marketplace.name}):e==null?void 0:e.interaction.setting.description})]}),(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?c.jsx(Nft,{"aria-label":a("extensions.manage.selectExtension"),value:n,onValueChange:s,className:"flex flex-col gap-2 px-3",children:e.interaction.plugins.map(l=>{var d;const u=`marketplace-plugin-${l.name}`;return c.jsxs("div",{className:"flex items-start gap-3 rounded-md border border-border p-3 has-data-[state=checked]:bg-accent/50",children:[c.jsx(jft,{id:u,value:l.name,disabled:t,className:"mt-0.5"}),c.jsxs("label",{htmlFor:u,className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-1",children:[c.jsx("span",{className:"font-medium",children:l.name}),c.jsx("span",{className:"text-sm text-muted-foreground",children:l.description??l.category??(l.source==="."||l.source==="./"?a("extensions.manage.marketplaceRoot"):l.source)??a("extensions.manage.noDescription")}),(d=l.tags)!=null&&d.length?c.jsx("span",{className:"text-xs text-muted-foreground",children:l.tags.join(" · ")}):null]})]},l.name)})}):null,(e==null?void 0:e.interaction.kind)==="marketplace_plugin"?c.jsxs(h4,{children:[c.jsx(Fr,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),c.jsxs(Fr,{disabled:t||!n,onClick:()=>o({pluginName:n}),children:[t?c.jsx(Ka,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]}):(e==null?void 0:e.interaction.kind)==="setting"?c.jsxs(c.Fragment,{children:[c.jsx(ga,{autoComplete:"off","aria-label":e.interaction.setting.name,type:e.interaction.setting.sensitive?"password":"text",value:r,onChange:l=>i(l.target.value),onKeyDown:l=>{l.key==="Enter"&&!t&&(l.preventDefault(),o({value:r}))}}),c.jsxs(h4,{children:[c.jsx(Fr,{variant:"outline",disabled:t,onClick:()=>o({cancelled:!0}),children:a("common.cancel")}),c.jsxs(Fr,{disabled:t,onClick:()=>o({value:r}),children:[t?c.jsx(Ka,{}):null,e.owner==="mutation"?a("extensions.manage.update"):a("extensions.manage.install")]})]})]}):null]})})}function Yse({onClose:e,initialFocusRef:t,embedded:n}){const{t:r}=gt(),s=il(),i=ko(),o=gd(),[a,l]=f.useState([]),[u,d]=f.useState(null),[h,m]=f.useState(""),[p,g]=f.useState({}),[b,x]=f.useState(!1),[v,y]=f.useState(null),[w,k]=f.useState(null),[T,S]=f.useState(null),[C,_]=f.useState(null),[A,M]=f.useState(!1),[L,N]=f.useState(null),[O,B]=f.useState(!1),[$,P]=f.useState(""),[K,F]=f.useState(!1),[H,D]=f.useState(null),[Q,U]=f.useState(null),j=f.useRef(null),[ie,oe]=f.useState(""),[J,V]=f.useState(""),[se,Z]=f.useState(!1),[X,te]=f.useState(!1),ae=f.useRef(!1),xe=f.useRef(null),Ae=f.useRef(null),Ne=f.useRef(new Map),Le=f.useRef(null),[ge,Oe]=f.useState(null),Nt=f.useCallback(qe=>{qe&&Ae.current!==qe||(Ae.current=null,j.current=null,U(null),oe(""),V(""))},[]),Pe=f.useCallback((qe,At,he)=>{j.current!==At.id&&(oe(""),V(""),j.current=At.id),Ae.current=qe,U({operationId:qe,interaction:At,owner:he})},[]),Ce=f.useCallback((qe=!1)=>(x(!0),i.loadExtensionsStatus().then(At=>{var Be,Ie;const he=At.extensions??[];l(Ke=>{const ne=xe.current;if(!ne||he.some(Dt=>Dt.name===ne))return he;const De=Ke.find(Dt=>Dt.name===ne);return De?[...he,De]:he}),qe||S(((Ie=(Be=At.errors)==null?void 0:Be[0])==null?void 0:Ie.error)??null),d(Ke=>Ke&&xe.current===Ke?Ke:yft(Ke,he))}).catch(At=>{S(At instanceof Error?At.message:String(At))}).finally(()=>x(!1))),[i]),Zt=f.useCallback(()=>i.checkExtensionUpdates(s.clientId).then(qe=>g(qe.states)).catch(qe=>{S(qe instanceof Error?qe.message:String(qe))}),[i,s.clientId]);f.useEffect(()=>{Ce()},[Ce]),f.useEffect(()=>{let qe=!1,At,he=2e3;const Be=async()=>{try{const{operations:Ie}=await i.activeExtensionOperations();if(qe)return;const Ke=Ie.filter(De=>De.operation==="install").sort((De,Dt)=>Dt.createdAt-De.createdAt)[0];Ke&&D(De=>De??{operationId:Ke.operationId,source:Ke.source??Ke.name??"extension"});const ne=Ie.find(De=>De.operation!=="install");ne&&(ae.current=!0,ne.operation==="uninstall"&&(xe.current=ne.name??"extension"),Oe(De=>De??{operationId:ne.operationId,name:ne.name??"extension",operation:ne.operation}),k(De=>De??ne.name??null)),_(null),te(!0)}catch(Ie){qe||(_(Ie instanceof Error?Ie.message:String(Ie)),At=setTimeout(()=>void Be(),he),he=Math.min(he*2,3e4))}};return Be(),()=>{qe=!0,At&&clearTimeout(At)}},[i]);const dt=f.useRef((o==null?void 0:o.extensionsVersion)??0);f.useEffect(()=>{const qe=(o==null?void 0:o.extensionsVersion)??0;qe!==dt.current&&(dt.current=qe,g({}),Ce(!0))},[Ce,o==null?void 0:o.extensionsVersion]),f.useEffect(()=>{a.length!==0&&Zt()},[Zt,a]),f.useEffect(()=>{if(!H)return;let qe=!1,At,he=1e3;const Be=async()=>{var Ie,Ke;try{const ne=await i.extensionOperationStatus(H.operationId);if(qe)return;if(he=1e3,ne.status==="waiting_for_input"){ne.interaction?(Pe(ne.operationId,ne.interaction,"install"),At=setTimeout(()=>void Be(),5e3)):(S(r("extensions.manage.operationFailed")),Nt(H.operationId),D(null));return}if(ne.status==="failed"){S(r("extensions.install.failed",{source:H.source,error:ne.error??""})),Nt(H.operationId),D(null);return}if(ne.status==="succeeded"||ne.status==="succeeded_with_refresh_error"){S(ne.status==="succeeded_with_refresh_error"?r("extensions.manage.refreshFailed",{error:((Ie=ne.result)==null?void 0:Ie.error)??""}):r("extensions.install.installed",{name:((Ke=ne.result)==null?void 0:Ke.name)??H.source})),Nt(H.operationId),D(null),Ce(!0);return}S(r("extensions.install.started",{source:H.source})),At=setTimeout(()=>void Be(),1e3)}catch(ne){if(qe)return;if(S(ne instanceof Error?ne.message:String(ne)),ne instanceof ec&&ne.status===404){Nt(H.operationId),D(null);return}At=setTimeout(()=>void Be(),he),he=Math.min(he*2,3e4)}};return Be(),()=>{qe=!0,At&&clearTimeout(At)}},[i,Nt,Ce,H,Pe,r]);const Ge=f.useCallback(qe=>{if(!Q)return;const At=Q.owner,he=()=>{At==="install"?D(Be=>Be&&{...Be}):Oe(Be=>Be&&{...Be})};Z(!0),i.respondToExtensionInteraction(Q.operationId,Q.interaction.id,qe,s.clientId).then(()=>{Nt(Q.operationId),he()}).catch(Be=>{S(Be instanceof Error?Be.message:String(Be)),Nt(Q.operationId),he()}).finally(()=>Z(!1))},[i,Nt,s.clientId,Q]);f.useEffect(()=>{if(!ge)return;let qe=!1,At,he=1e3;const Be=async()=>{var Ie;try{const Ke=await i.extensionOperationStatus(ge.operationId);if(qe)return;if(he=1e3,Ke.status==="waiting_for_input"){Ke.interaction?(Pe(Ke.operationId,Ke.interaction,"mutation"),At=setTimeout(()=>void Be(),5e3)):(S(r("extensions.manage.operationFailed")),Nt(ge.operationId),Oe(null),k(null),ae.current=!1,ge.operation==="uninstall"&&(xe.current=null,Ce(!0)));return}if(Ke.status==="failed"){S(Ke.error??r("extensions.manage.operationFailed")),Nt(ge.operationId),Oe(null),k(null),ae.current=!1,Ke.operation==="uninstall"&&(xe.current=null,Ce(!0));return}if(Ke.status==="succeeded"||Ke.status==="succeeded_with_refresh_error"){Ke.status==="succeeded_with_refresh_error"?S(r("extensions.manage.refreshFailed",{error:((Ie=Ke.result)==null?void 0:Ie.error)??""})):Ke.operation==="uninstall"?S(null):S(Rft(Ke.operation,ge.name,r)),Nt(ge.operationId),Oe(null),k(null),ae.current=!1,Ke.operation==="uninstall"&&(xe.current=null,d(null)),Ke.operation==="update"&&g(ne=>{const De={...ne};return delete De[ge.name],De}),Ce(!0);return}S(ak(Ke.operation,ge.name,r)),At=setTimeout(()=>void Be(),1e3)}catch(Ke){if(qe)return;if(S(Ke instanceof Error?Ke.message:String(Ke)),Ke instanceof ec&&Ke.status===404){Nt(ge.operationId),Oe(null),k(null),ae.current=!1,ge.operation==="uninstall"&&(xe.current=null,Ce(!0));return}At=setTimeout(()=>void Be(),he),he=Math.min(he*2,3e4)}};return Be(),()=>{qe=!0,At&&clearTimeout(At)}},[i,Nt,Ce,ge,Pe,r]);const St=f.useCallback(()=>{S(null),Ce()},[Ce]),Y=f.useCallback(qe=>{y(qe),S(null),g(At=>({...At,[qe]:"checking for updates"})),i.checkExtensionUpdates(s.clientId).then(At=>{g(At.states),S(_T(At.states[qe],r))}).catch(At=>{g(he=>({...he,[qe]:"error"})),S(At instanceof Error?At.message:String(At))}).finally(()=>y(null))},[i,s.clientId,r]),je=f.useCallback(()=>{const qe=$.trim(),At=s.clientId;!qe||!X||H||ge||ae.current||(F(!0),S(null),i.installExtension({source:qe,consent:!0},At).then(he=>{D({operationId:he.operationId,source:qe}),P(""),B(!1)}).catch(he=>{S(he instanceof Error?he.message:String(he))}).finally(()=>F(!1)))},[i,s.clientId,$,X,H,ge]),We=f.useCallback((qe,At,he={})=>{const Be=s.clientId;if(!X||H||ge||v||ae.current)return!1;ae.current=!0,he.operation==="uninstall"&&(xe.current=qe),k(qe),S(he.startMessage??null);let Ie=!1;return At(Be).then(Ke=>{const ne=Ke&&typeof Ke=="object"&&"operationId"in Ke&&typeof Ke.operationId=="string"?Ke.operationId:void 0;if(ne){Ie=!0,Oe({operationId:ne,name:qe,operation:he.operation});return}S(r("extensions.manage.queued",{name:qe}))}).catch(Ke=>{S(Ke instanceof Error?Ke.message:String(Ke))}).finally(()=>{Ie||(ae.current=!1,k(null),he.operation==="uninstall"&&(xe.current=null),Ce(!0))}),!0},[s.clientId,v,Ce,X,H,ge,r]),Te=f.useMemo(()=>a.find(qe=>qe.name===u),[a,u]);f.useEffect(()=>{n==null||n.onDetailChange(!!Te)},[n,Te]);const jt=f.useMemo(()=>vft(a,h),[a,h]),zt=f.useCallback(()=>{Le.current=u,d(null)},[u]);f.useEffect(()=>{var qe;u||!Le.current||((qe=Ne.current.get(Le.current))==null||qe.focus(),Le.current=null)},[u]);const bn=c.jsx(x4,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:c.jsxs(w4,{className:"text-base",children:[c.jsx(Ba,{children:c.jsx(Fr,{variant:"ghost",size:"icon",onClick:e,"aria-label":r("common.back"),children:c.jsx(wW,{})})}),c.jsx(Ba,{children:Te?c.jsx(M0,{asChild:!0,children:c.jsx("button",{type:"button",onClick:zt,children:r("extensions.manage.title")})}):c.jsx(Du,{children:r("extensions.manage.title")})}),Te?c.jsx(N0,{}):null,Te?c.jsx(Ba,{children:c.jsx(Du,{children:ab(Te)})}):null]})}),Pn=n?Te?c.jsx(x4,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:c.jsxs(w4,{className:"h-8 text-sm",children:[c.jsx(Ba,{children:c.jsx(M0,{asChild:!0,children:c.jsx("button",{type:"button",onClick:n.onRoot,children:r("extensions.manage.title")})})}),c.jsx(N0,{}),c.jsx(Ba,{children:c.jsx(Du,{children:ab(Te)})})]})}):null:bn;if(Te){const qe=Te.details,At=p[Te.name]??Te.updateState,he=!X||H!==null||w!==null||ge!==null,Be=v===Te.name,Ie=Te.isActive?"disable":"enable",Ke=ke=>We(Te.name,Ot=>Ie==="enable"?i.enableExtension(Te.name,{scope:ke},Ot):i.disableExtension(Te.name,{scope:ke},Ot),{operation:Ie,startMessage:ak(Ie,Te.name,r)}),ne=(qe==null?void 0:qe.commands)??[],De=(qe==null?void 0:qe.skills)??[],Dt=(qe==null?void 0:qe.agents)??[],ze=(qe==null?void 0:qe.mcpServers)??[],Lt=(qe==null?void 0:qe.contextFiles)??[];return c.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Pn,c.jsxs("div",{className:"flex w-full flex-col gap-6",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:c.jsx(aL,{})}),c.jsx("div",{className:"min-w-0 flex-1",children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("h1",{className:"break-words text-2xl font-semibold",children:ab(Te)}),c.jsxs(Kc,{variant:"outline",children:["v",Te.version]}),c.jsx(Kc,{variant:"secondary",className:Te.isActive?"bg-[var(--success-bg)] text-[var(--success-color)]":void 0,children:kT(Te,r)})]})}),c.jsxs(my,{open:A,onOpenChange:M,children:[c.jsx(py,{asChild:!0,children:c.jsx(Fr,{variant:"ghost",size:"icon",disabled:he||Be,"aria-label":r("extensions.manage.actions"),children:he||Be?c.jsx(Ka,{}):c.jsx(Xb,{})})}),c.jsxs(gy,{align:"end",children:[c.jsxs(bv,{children:[c.jsx($a,{disabled:he||v!==null,onSelect:()=>Y(Te.name),children:r("extensions.manage.checkUpdates")}),c.jsx($a,{disabled:he||Be||At!==eq,onSelect:()=>We(Te.name,ke=>i.updateExtension(Te.name,ke),{operation:"update",startMessage:ak("update",Te.name,r)}),children:r("extensions.manage.update")}),c.jsxs($a,{disabled:he||Be,onSelect:()=>Ke("user"),children:[r(Ie==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",r("settings.scope.user")]}),c.jsxs($a,{disabled:he||Be,onSelect:()=>Ke("workspace"),children:[r(Ie==="enable"?"extensions.manage.enable":"extensions.manage.disable"),"· ",r("settings.scope.workspace")]})]}),c.jsx(Aft,{}),c.jsx(bv,{children:c.jsx($a,{variant:"destructive",disabled:he||Be,onSelect:ke=>{ke.preventDefault(),M(!1),N(Te.name)},children:r("extensions.manage.uninstallAction")})})]})]})]}),T||C?c.jsxs(la,{children:[c.jsx(Nc,{}),c.jsx(ca,{className:"break-words",children:T??C})]}):null,c.jsxs(j3,{defaultValue:"overview",children:[c.jsxs(I3,{className:"max-w-full overflow-x-auto",children:[c.jsx(qa,{value:"overview",children:r("extensions.manage.overview")}),c.jsxs(qa,{value:"commands",children:[pm(r("extensions.manage.commands"))," ",ne.length]}),c.jsxs(qa,{value:"skills",children:[pm(r("extensions.manage.skills"))," ",De.length]}),c.jsxs(qa,{value:"agents",children:[pm(r("extensions.manage.agents"))," ",Dt.length]}),c.jsxs(qa,{value:"mcp",children:[pm(r("extensions.manage.mcpServers"))," ",ze.length]}),c.jsxs(qa,{value:"context",children:[pm(r("extensions.manage.contextFiles"))," ",Lt.length]})]}),c.jsx(Xl,{value:"overview",className:"pt-4",children:c.jsxs(Rc,{children:[c.jsxs(Am,{children:[c.jsx(Em,{children:r("extensions.manage.overview")}),Te.description?c.jsx(j0,{children:Te.description}):null]}),c.jsxs(Z0,{className:"grid gap-6 sm:grid-cols-2",children:[c.jsx(Mu,{label:r("extensions.manage.name"),value:Te.name}),c.jsx(Mu,{label:r("extensions.manage.version"),value:Te.version}),c.jsx(Mu,{label:r("extensions.manage.status"),value:kT(Te,r)}),c.jsx(Mu,{label:r("extensions.manage.source"),value:Te.source??"-"}),c.jsx(Mu,{label:r("extensions.manage.path"),value:Te.path}),c.jsx(Mu,{label:r("extensions.manage.updateStatus"),value:_T(At,r)}),c.jsx(Mu,{label:r("extensions.manage.installType"),value:Te.installType??"-"}),c.jsx(Mu,{label:r("extensions.manage.origin"),value:Te.originSource??"-"}),c.jsx(Mu,{label:r("extensions.manage.settings"),value:((qe==null?void 0:qe.settings)??[]).join(", ")||"-"})]})]})}),c.jsx(Xl,{value:"commands",className:"pt-4",children:c.jsx(lb,{items:ne,empty:r("extensions.manage.emptyCommands"),icon:pfe})}),c.jsx(Xl,{value:"skills",className:"pt-4",children:c.jsx(lb,{items:De,empty:r("extensions.manage.emptySkills"),icon:lme})}),c.jsx(Xl,{value:"agents",className:"pt-4",children:c.jsx(lb,{items:Dt,empty:r("extensions.manage.emptyAgents"),icon:kW})}),c.jsx(Xl,{value:"mcp",className:"pt-4",children:c.jsx(lb,{items:ze,empty:r("extensions.manage.emptyMcpServers"),icon:z0})}),c.jsx(Xl,{value:"context",className:"pt-4",children:c.jsx(lb,{items:Lt,empty:r("extensions.manage.emptyContextFiles"),icon:wfe})})]})]}),c.jsx(UF,{open:L===Te.name,onOpenChange:ke=>{ke||N(null)},children:c.jsxs(VF,{children:[c.jsxs(WF,{className:"place-items-start text-left",children:[c.jsx(KF,{children:r("extensions.manage.uninstallAction")}),c.jsx(YF,{children:r("extensions.manage.uninstallConfirm",{name:Te.name})})]}),c.jsxs(GF,{children:[c.jsx(XF,{children:r("common.cancel")}),c.jsx(_ft,{variant:"destructive",onClick:()=>{L&&We(L,ke=>i.uninstallExtension(L,ke),{operation:"uninstall",startMessage:ak("uninstall",L,r)})&&N(null)},children:r("extensions.manage.uninstallAction")})]})]})}),c.jsx(tq,{pendingInteraction:Q,submitting:se,selectedPlugin:J,interactionValue:ie,setSelectedPlugin:V,setInteractionValue:oe,submit:Ge,t:r})]})}return c.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Pn,c.jsxs("div",{className:"flex w-full flex-col gap-6",children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{ref:t,tabIndex:-1,className:"text-2xl font-semibold outline-none",children:r("extensions.manage.title")}),c.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r("extensions.manage.count",{count:a.length})})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsxs(Fr,{variant:"outline",disabled:b,onClick:St,children:[b?c.jsx(Ka,{}):c.jsx(Ik,{"data-icon":"inline-start"}),r("common.refresh")]}),c.jsxs(Fr,{disabled:!X||!!(H||ge||w),onClick:()=>B(!0),children:[c.jsx(U2,{"data-icon":"inline-start"}),r("extensions.manage.add")]})]})]}),T||C?c.jsxs(la,{children:[c.jsx(Nc,{}),c.jsx(ca,{className:"break-words",children:T??C})]}):null,c.jsxs("div",{className:"relative",children:[c.jsx(Um,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(ga,{name:"extension-search","aria-label":r("extensions.manage.search"),autoComplete:"off",value:h,onChange:qe=>m(qe.target.value),placeholder:r("extensions.manage.search"),className:"pl-9"})]}),jt.length?c.jsx("div",{className:bft.extensionGrid,"data-column-count":Math.min(jt.length,4),children:jt.map(qe=>{const At=p[qe.name]??qe.updateState;return c.jsx(Rc,{ref:he=>{he?Ne.current.set(qe.name,he):Ne.current.delete(qe.name)},size:"sm",role:"button",tabIndex:0,"aria-label":ab(qe),className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>d(qe.name),onKeyDown:he=>{(he.key==="Enter"||he.key===" ")&&(he.preventDefault(),d(qe.name))},children:c.jsx(Am,{className:"block",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(aL,{className:"size-5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[c.jsx(Em,{className:"min-w-0 truncate",children:ab(qe)}),c.jsx("div",{className:"flex shrink-0 justify-end",children:c.jsx(Kc,{variant:"secondary",className:qe.isActive?"bg-[var(--success-bg)] text-[10px] text-[var(--success-color)]":"text-[10px]",children:kT(qe,r)})})]}),At===eq?c.jsx("div",{className:"mt-1",children:c.jsx(Kc,{className:"text-[10px]",children:_T(At,r)})}):null,c.jsx(j0,{className:"mt-1 truncate text-xs",children:qe.description||r("extensions.manage.noDescription")})]})]})})},qe.id||qe.name)})}):c.jsx(zh,{className:"border",children:c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:h?c.jsx(Um,{}):c.jsx(nfe,{})}),c.jsx(Hh,{children:r(h?"extensions.manage.noMatches":"extensions.manage.empty")}),h?null:c.jsx(ox,{children:r("extensions.manage.emptyDescription")})]})})]}),c.jsx(UF,{open:O,onOpenChange:qe=>{(qe||!K)&&B(qe)},children:c.jsxs(VF,{size:"middle",children:[c.jsxs(WF,{className:"place-items-start text-left",children:[c.jsx(KF,{children:r("extensions.manage.add")}),c.jsx(YF,{children:r("extensions.manage.installDescription")})]}),c.jsx(ga,{id:"extension-source",name:"extension-source","aria-label":r("extensions.manage.installDescription"),autoComplete:"off",value:$,onChange:qe=>P(qe.target.value),placeholder:r("extensions.manage.sourcePlaceholder")}),c.jsxs(GF,{children:[c.jsx(XF,{disabled:K,children:r("common.cancel")}),c.jsxs(Fr,{disabled:K||!X||!!(H||ge||w)||!$.trim(),onClick:je,children:[K?c.jsx(Ka,{}):null,r("extensions.manage.install")]})]})]})}),c.jsx(tq,{pendingInteraction:Q,submitting:se,selectedPlugin:J,interactionValue:ie,setSelectedPlugin:V,setInteractionValue:oe,submit:Ge,t:r})]})}const Dft="_connectedBadge_1erz5_1",Lft="_serverGrid_1erz5_6",Xse={connectedBadge:Dft,serverGrid:Lft},Pft=bp("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),Qse=f.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function Oft({className:e,variant:t,size:n,spacing:r=2,orientation:s="horizontal",children:i,...o}){return c.jsx(hj,{orientation:s,"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":s,style:{"--gap":r},className:tn("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...o,children:c.jsx(Qse.Provider,{value:{variant:t,size:n,spacing:r,orientation:s},children:i})})}function Bft({className:e,children:t,variant:n="default",size:r="default",...s}){const i=f.useContext(Qse);return c.jsx(jne,{"data-slot":"toggle-group-item","data-variant":i.variant||n,"data-size":i.size||r,"data-spacing":i.spacing,className:tn("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",Pft({variant:i.variant||n,size:i.size||r}),e),...s,children:t})}function $ft({className:e,...t}){return c.jsx("textarea",{"data-slot":"textarea",className:tn("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}const lk=`{
  "command": "",
  "args": []
}`;function R3(e){if(e.configOrigin)return e.configOrigin;if(e.extensionName||e.source==="extension")return"extension";const t=e.source;return t==="project"&&e.removable===!1?"project_mcp_json":t==="workspace"||t==="project"?"workspace_settings":e.removable?"user_settings":void 0}function s2(e){const t=R3(e);return t==="workspace_settings"?"workspace":t==="extension"?"extension":"user"}function zft(e){const t=R3(e);return t==="extension"||t==="workspace_settings"||t==="user_settings"}function nq(e,t){const n=s2(e);return t(n==="workspace"?"mcp.source.workspace":n==="extension"?"mcp.source.extension":"mcp.source.user")}function rq(e,t){var r;const n=(r=e.settings.find(s=>s.key==="mcpServers"))==null?void 0:r.values[t];return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n))}function sq(e,t){return e.disabled?t("mcp.status.disabled"):e.approvalState==="pending"?t("mcp.status.needsApproval"):e.approvalState==="rejected"?t("mcp.status.rejected"):e.authenticationState==="pending"?t("mcp.status.authenticating"):e.mcpStatus==="connected"?t("mcp.status.connected"):e.mcpStatus==="connecting"?t("mcp.status.connecting"):t("mcp.status.disconnectedTitle")}function iq(e){return!e.disabled&&!e.approvalState&&e.mcpStatus==="connected"?Xse.connectedBadge:""}function Fft(e,t){var r;const n=e.config;return n!=null&&n.httpUrl?`${n.httpUrl} (http)`:n!=null&&n.url?`${n.url} (sse)`:n!=null&&n.command?`${n.command} ${((r=n.args)==null?void 0:r.join(" "))??""} (stdio)`.trim():e.transport?`(${e.transport})`:t("mcp.status.unknown")}function qft(e,t){const n=[],r=!!e.approvalState,s=R3(e);return(s==="user_settings"||s==="workspace_settings")&&n.push({id:"edit",label:t("mcp.action.edit")}),!e.disabled&&!r&&!e.requiresAuth&&e.mcpStatus==="disconnected"&&n.push({id:"reconnect",label:t("mcp.action.reconnect")}),!e.disabled&&r&&n.push({id:"approve",label:t("mcp.action.approve")}),(s!=="extension"||e.disabled)&&n.push({id:e.disabled?"enable":"disable",label:e.disabled?t("mcp.action.enable"):t("mcp.action.disable")}),!e.disabled&&!r&&(e.mcpStatus!=="disconnected"||e.requiresAuth)&&(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")})),e.removable&&n.push({id:"remove",label:t("mcp.action.remove")}),n}function ST(e,t,n){return[`${t("mcp.oauth.server")}: ${e}`,t("mcp.oauth.starting",{name:e}),n].filter(Boolean).join(`
`)}function Hft(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function Uft(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 Ha({label:e,value:t}){return c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("div",{className:"text-sm font-medium",children:e}),c.jsx("div",{className:"break-words text-sm text-muted-foreground",children:t})]})}function Vft({tool:e,t}){var i;const n=Uft(e,t),r=e.schema,s=(r==null?void 0:r.parametersJsonSchema)??(r==null?void 0:r.parameters)??r;return c.jsxs("div",{className:"flex flex-col gap-5",children:[e.isValid?null:c.jsxs(la,{variant:"destructive",children:[c.jsx(Nc,{}),c.jsx(bm,{children:t("mcp.invalidToolWarning")}),c.jsxs(ca,{children:[e.invalidReason||t("mcp.status.unknown"),c.jsx("span",{className:"mt-1 block",children:t("mcp.invalidToolHelp")})]})]}),c.jsx(Ha,{label:t("mcp.description"),value:((i=e.description)==null?void 0:i.trim())||t("mcp.noDescription")}),n?c.jsx(Ha,{label:t("mcp.annotations"),value:n}):null,c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("div",{className:"text-sm font-medium",children:t("mcp.inputSchema")}),s?c.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg bg-muted p-4 text-xs leading-relaxed",children:JSON.stringify(s,null,2)}):c.jsx("div",{className:"text-sm text-muted-foreground",children:t("mcp.noSchema")})]})]})}function Wft({resource:e,t}){const n=e.title||e.name||"";return c.jsxs("div",{className:"flex flex-col gap-5",children:[c.jsx(Ha,{label:t("mcp.resource.uriLabel"),value:e.uri}),n&&n!==e.uri?c.jsx(Ha,{label:t("mcp.resource.nameLabel"),value:n}):null,e.mimeType?c.jsx(Ha,{label:t("mcp.resource.mimeTypeLabel"),value:e.mimeType}):null,typeof e.size=="number"?c.jsx(Ha,{label:t("mcp.resource.sizeLabel"),value:t("mcp.resource.bytes",{count:e.size})}):null,e.description?c.jsx(Ha,{label:t("mcp.description"),value:e.description.trim()}):null]})}function Jse({message:e,onClose:t,embedded:n}){var ze,Lt,ke,Ot;const{t:r}=gt(),s=gW({autoLoad:!1}),i=yW({autoLoad:!1}),[o,a]=f.useState(e.status),[l,u]=f.useState(e.toolsByServer),[d,h]=f.useState(e.resourcesByServer??{}),[m,p]=f.useState(null),[g,b]=f.useState(null),[x,v]=f.useState(null),[y,w]=f.useState("overview"),[k,T]=f.useState(""),[S,C]=f.useState("all"),[_,A]=f.useState(null),[M,L]=f.useState(!1),[N,O]=f.useState(!1),[B,$]=f.useState(!1),[P,K]=f.useState(null),[F,H]=f.useState(""),[D,Q]=f.useState(""),[U,j]=f.useState("workspace"),[ie,oe]=f.useState(lk),[J,V]=f.useState(!1),[se,Z]=f.useState(null),[X,te]=f.useState(null),[ae,xe]=f.useState(null),[Ae,Ne]=f.useState({}),Le=f.useRef(e.status.discoveryState==="completed"),ge=f.useRef(!0);f.useEffect(()=>(ge.current=!0,()=>{ge.current=!1}),[]);const Oe=f.useCallback(async()=>(await new Promise(fe=>window.setTimeout(fe,1500)),ge.current),[]),Nt=f.useCallback(async(fe,pt=!0,He=!1)=>{var on;if(await(fe==="initialize"?s.initialize():s.reloadConfig()),!ge.current)return!1;for(let Ze=0;Ze<40;Ze+=1){if(!await Oe())return!1;const Et=await s.reload();if(!ge.current)return!1;if(Et){if((!He||Et.discoveryState==="completed")&&a(wn=>pt&&Et.servers.length===0&&wn.servers.length>0?{...Et,servers:wn.servers}:Et),(on=Et.errors)!=null&&on.length)return pt&&xe({text:Et.errors.map(wn=>wn.error||wn.hint||wn.kind).join(`
`),error:!0}),!1;if(Et.discoveryState==="completed")return pt&&xe(null),!0;if(Et.initialized&&Et.discoveryState==="not_started"&&Et.servers.length===0)return He&&a(Et),pt&&xe({text:r("mcp.discovery.empty")}),!0}}return pt&&xe({text:r("mcp.discovery.timeout"),error:!0}),!1},[s,r,Oe]);f.useEffect(()=>{Le.current||(Le.current=!0,L(!0),Nt("initialize").catch(fe=>{ge.current&&xe({text:sa(fe),error:!0})}).finally(()=>{ge.current&&L(!1)}))},[Nt]);const Pe=f.useMemo(()=>(o.servers??[]).filter(zft),[o.servers]),Ce=Pe.find(fe=>fe.name===m)??null,Zt=Ce?((ze=l[Ce.name])==null?void 0:ze.tools)??[]:[],dt=Ce?((Lt=d[Ce.name])==null?void 0:Lt.resources)??[]:[],Ge=Zt.find(fe=>fe.name===g)??null,St=dt.find(fe=>fe.uri===x)??null;f.useEffect(()=>{n==null||n.onDetailChange(!!Ce)},[n,Ce]);const Y=f.useMemo(()=>{const fe=k.trim().toLowerCase();return Pe.filter(pt=>{var Ze,Et;const He=S==="all"||s2(pt)===S,on=!fe||pt.name.toLowerCase().includes(fe)||((Ze=pt.description)==null?void 0:Ze.toLowerCase().includes(fe))||((Et=pt.extensionName)==null?void 0:Et.toLowerCase().includes(fe));return He&&!!on})},[k,Pe,S]),je=f.useCallback(async fe=>{const pt=[],[He,on]=await Promise.allSettled([s.loadTools(fe.name),fe.resourceCount?s.loadResources(fe.name):Promise.resolve(null)]);if(He.status==="fulfilled")u(Ze=>({...Ze,[fe.name]:He.value})),Ne(Ze=>({...Ze,[fe.name]:{...Ze[fe.name],tools:void 0}}));else{pt.push(He.reason);const Ze=sa(He.reason);Ne(Et=>({...Et,[fe.name]:{...Et[fe.name],tools:Ze}}))}if(on.status==="fulfilled"&&on.value!==null){const Ze=on.value;h(Et=>({...Et,[fe.name]:Ze})),Ne(Et=>({...Et,[fe.name]:{...Et[fe.name],resources:void 0}}))}else if(on.status==="rejected"){pt.push(on.reason);const Ze=sa(on.reason);Ne(Et=>({...Et,[fe.name]:{...Et[fe.name],resources:Ze}}))}else h(Ze=>{if(!(fe.name in Ze))return Ze;const Et={...Ze};return delete Et[fe.name],Et}),Ne(Ze=>({...Ze,[fe.name]:{...Ze[fe.name],resources:void 0}}));if(pt.length>0)throw new AggregateError(pt,`${fe.name}: ${pt.map(sa).join("; ")}`)},[s]),We=f.useCallback(async()=>{if(!N){O(!0),xe(null);try{const fe=await s.reload();if(!fe)return;a(fe)}catch(fe){xe({text:sa(fe),error:!0})}finally{O(!1)}}},[s,N]),Te=f.useCallback(async()=>{const fe=F.trim(),pt=P!==null;if(!fe){Z(r("mcp.add.nameRequired"));return}let He;try{const Ze=JSON.parse(ie);if(!Ze||typeof Ze!="object"||Array.isArray(Ze))throw new Error(r("mcp.add.configInvalid"));const Et=D.trim();He={...Ze,...Et?{description:Et}:{}}}catch(Ze){Z(sa(Ze));return}Z(null),V(!0);let on=!1;try{await i.setValue(U,"mcpServers",He,{mcpServerMutation:{operation:"set",name:fe}}),on=!0,xe(null);const Ze=await Nt("reload",!1).catch(()=>!1);xe({...pt?{serverName:fe}:{},text:Ze?r(pt?"mcp.edit.done":"mcp.add.done",{name:fe}):r("mcp.runtime.notUpdated"),error:!Ze}),$(!1),K(null),H(""),Q(""),oe(lk)}catch(Ze){on?(xe({...pt?{serverName:fe}:{},text:r("mcp.runtime.notUpdated"),error:!0}),$(!1),K(null),H(""),Q(""),oe(lk)):Z(sa(Ze))}finally{V(!1)}},[s,P,ie,D,F,U,i,Nt,r]),jt=f.useCallback(async()=>{if(!X)return;A(X.name);let fe=!1;try{const pt=await i.reload();if(!pt){xe({serverName:X.name,text:r("mcp.add.settingsUnavailable"),error:!0});return}const He=s2(X)==="workspace"?"workspace":"user",on=rq(pt,He);if(!(X.name in on)){xe({serverName:X.name,text:r("mcp.remove.notWorkspace"),error:!0});return}await i.setValue(He,"mcpServers",{},{mcpServerMutation:{operation:"remove",name:X.name}}),fe=!0,te(null),xe({serverName:X.name,text:r("mcp.action.running",{action:r("mcp.action.remove")})}),await Nt("reload",!1,!0).catch(()=>!1)?(p(null),b(null),v(null),xe(null)):xe({serverName:X.name,text:r("mcp.runtime.removeNotUpdated"),error:!0})}catch(pt){xe({serverName:X.name,text:fe?r("mcp.runtime.removeNotUpdated"):r("mcp.action.failed",{error:sa(pt)}),error:!0})}finally{A(null)}},[X,i,Nt,r]),zt=f.useCallback(async fe=>{if(_)return;const pt=R3(fe);if(pt!=="user_settings"&&pt!=="workspace_settings")return;const He=pt==="workspace_settings"?"workspace":"user";A(fe.name),xe(null);try{const on=await i.reload();if(!on)throw new Error(r("mcp.add.settingsUnavailable"));const Ze=rq(on,He)[fe.name];if(!Ze||typeof Ze!="object"||Array.isArray(Ze))throw new Error(r("mcp.edit.notFound"));const Et={...Ze},wn=Et.description;delete Et.description,K(fe),H(fe.name),j(He),Q(typeof wn=="string"?wn:""),oe(JSON.stringify(Et,null,2)),Z(null),$(!0)}catch(on){xe({serverName:fe.name,text:r("mcp.action.failed",{error:sa(on)}),error:!0})}finally{A(null)}},[_,i,r]),bn=f.useCallback(async(fe,pt)=>{var He,on,Ze,Et;if(!_){if(pt.id==="remove"){te(fe);return}if(pt.id==="edit"){await zt(fe);return}A(fe.name),xe({serverName:fe.name,text:pt.id==="authenticate"?ST(fe.name,r):r("mcp.action.running",{action:pt.label})});try{let wn="",qr,cr=!1;if(pt.id==="reconnect"){const Ft=await s.restartServer(fe.name);if(!ge.current)return;if("restarted"in Ft&&!Ft.restarted)throw Ft.reason==="authentication_required"?new Error(r("mcp.reconnect.authenticationRequired")):new Error(r("mcp.reconnect.skipped",{reason:Ft.reason}));if("entries"in Ft&&(Ft.entries.length===0||Ft.entries.every(dn=>!dn.restarted)))throw new Error(r("mcp.reconnect.skipped",{reason:Ft.entries.map(dn=>dn.reason).filter(Boolean).join(", ")||"not connected"}))}else{const Ft=await s.manageServer(fe.name,pt.id);if(!ge.current)return;qr=Ft.authUrl,wn=[...Ft.messages??[]].join(`
`),cr=pt.id==="authenticate"&&Ft.pending===!0,cr&&xe({serverName:fe.name,text:ST(fe.name,r,wn),...qr?{authUrl:qr}:{}})}let Jn;if(cr){for(let Ft=0;Ft<400;Ft+=1){if(!await Oe())return;const dn=await s.reload();if(!ge.current)return;if(!dn)continue;a(dn);const sr=(He=dn.errors)==null?void 0:He[0];if(sr)throw new Error(sr.error||sr.hint||r("mcp.oauth.statusFailed"));const Rn=(on=dn.servers)==null?void 0:on.find(Vn=>Vn.name===fe.name);if(!Rn)throw new Error(r("mcp.oauth.serverRemoved"));if(Rn.authenticationState==="failed")throw new Error(Rn.authenticationError||r("mcp.oauth.authenticationFailed"));if(Rn.authenticationState==="succeeded"||Rn.authenticationState===void 0&&Rn.mcpStatus==="connected"){Jn=dn;break}}if(!Jn)throw new Error(r("mcp.oauth.timeout"))}else{if(Jn=await s.reload(),!ge.current)return;for(let Ft=0;(Jn==null?void 0:Jn.discoveryState)!==void 0&&Jn.discoveryState!=="completed"&&!((Ze=Jn.errors)!=null&&Ze.length)&&Ft<40;Ft+=1){if(!await Oe())return;const dn=await s.reload();if(!ge.current)return;dn&&(Jn=dn,a(dn))}}if(Jn){a(Jn);const Ft=(Et=Jn.servers)==null?void 0:Et.find(dn=>dn.name===fe.name);if(Ft&&(Jn.discoveryState===void 0||Jn.discoveryState==="completed")){try{await je(Ft)}catch{}if(!ge.current)return}}xe({serverName:fe.name,text:cr?r("mcp.action.done",{action:pt.label}):pt.id==="authenticate"&&wn?ST(fe.name,r,wn):wn||r("mcp.action.done",{action:pt.label}),...!cr&&qr?{authUrl:qr}:{}})}catch(wn){ge.current&&xe({serverName:fe.name,text:r("mcp.action.failed",{error:sa(wn)}),error:!0})}finally{ge.current&&A(null)}}},[_,je,s,zt,r,Oe]),Pn=fe=>{p(fe.name),w("overview"),b(null),v(null),xe(null),!fe.approvalState&&je(fe).catch(pt=>{xe({serverName:fe.name,text:r("mcp.action.failed",{error:sa(pt)}),error:!0})})},qe=()=>{_===null&&(p(null),b(null),v(null),O(!0),s.reload().then(fe=>{fe&&a(fe)}).catch(fe=>{xe({text:sa(fe),error:!0})}).finally(()=>O(!1)))},At=()=>{b(null),v(null)},he=c.jsx(x4,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:c.jsxs(w4,{className:"text-base",children:[c.jsx(Ba,{children:c.jsx(Fr,{variant:"ghost",size:"icon",disabled:_!==null,onClick:t,"aria-label":r("common.back"),children:c.jsx(wW,{})})}),c.jsx(Ba,{children:Ce?c.jsx(M0,{asChild:!0,children:c.jsx("button",{type:"button",disabled:_!==null,onClick:qe,children:r("mcp.title")})}):c.jsx(Du,{children:r("mcp.title")})}),Ce?c.jsx(N0,{}):null,Ce?c.jsx(Ba,{children:Ge||St?c.jsx(M0,{asChild:!0,children:c.jsx("button",{type:"button",onClick:At,children:Ce.name})}):c.jsx(Du,{children:Ce.name})}):null,Ge||St?c.jsx(N0,{}):null,Ge?c.jsx(Ba,{children:c.jsx(Du,{children:Ge.name})}):null,St?c.jsx(Ba,{children:c.jsx(Du,{children:St.title||St.name||St.uri})}):null]})}),Be=Ge?Ge.name:St?St.title||St.name||St.uri:Ce==null?void 0:Ce.name,Ie=n?Ce?c.jsx(x4,{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:c.jsxs(w4,{className:"h-8 text-sm",children:[c.jsx(Ba,{children:c.jsx(M0,{asChild:!0,children:c.jsx("button",{type:"button",disabled:_!==null,onClick:qe,children:r("mcp.title")})})}),c.jsx(N0,{}),c.jsx(Ba,{children:Ge||St?c.jsx(M0,{asChild:!0,children:c.jsx("button",{type:"button",onClick:At,children:Ce.name})}):c.jsx(Du,{children:Ce.name})}),Ge||St?c.jsx(N0,{}):null,Ge||St?c.jsx(Ba,{children:c.jsx(Du,{children:Be})}):null]})}):null:he,Ke=c.jsx(c4,{open:X!==null,onOpenChange:fe=>!fe&&te(null),children:c.jsxs(u4,{showCloseButton:!1,children:[c.jsxs(d4,{children:[c.jsx(f4,{children:r("mcp.remove.title")}),c.jsx(m4,{children:r(X&&s2(X)==="workspace"?"mcp.remove.description":"mcp.remove.description.global",{name:(X==null?void 0:X.name)??""})})]}),c.jsxs(h4,{children:[c.jsx(Fr,{variant:"outline",onClick:()=>te(null),disabled:_!==null,children:r("common.cancel")}),c.jsxs(Fr,{variant:"destructive",onClick:()=>void jt(),disabled:_!==null,children:[_?c.jsx(Ka,{"data-icon":"inline-start"}):c.jsx(Qb,{"data-icon":"inline-start"}),r("mcp.action.remove")]})]})]})}),ne=c.jsx(c4,{open:B,onOpenChange:fe=>{J||($(fe),fe||K(null))},children:c.jsxs(u4,{className:"sm:max-w-lg",showCloseButton:!1,children:[c.jsxs(d4,{children:[c.jsx(f4,{children:r(P?"mcp.edit.title":"mcp.add.title")}),c.jsx(m4,{children:r(P?"mcp.edit.description":"mcp.add.description")})]}),c.jsxs("div",{className:"grid gap-4",children:[se?c.jsxs(la,{variant:"destructive",children:[c.jsx(Nc,{}),c.jsx(ca,{children:se})]}):null,c.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.name"),c.jsx(ga,{value:F,onChange:fe=>H(fe.target.value),placeholder:"my-mcp-server",disabled:J||P!==null})]}),c.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.serverDescription"),c.jsx(ga,{value:D,onChange:fe=>Q(fe.target.value),placeholder:r("mcp.add.serverDescriptionPlaceholder"),disabled:J})]}),c.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.scope"),c.jsxs(C3,{value:U,onValueChange:fe=>j(fe),disabled:J||P!==null,children:[c.jsx(A3,{className:"w-full",children:c.jsx(T3,{})}),c.jsxs(E3,{children:[c.jsx(Ig,{value:"workspace",children:r("settings.scope.workspace")}),c.jsx(Ig,{value:"user",children:r("mcp.add.scope.global")})]})]})]}),c.jsxs("label",{className:"grid gap-2 text-sm font-medium",children:[r("mcp.add.config"),c.jsx($ft,{className:"min-h-44 font-mono text-xs",value:ie,onChange:fe=>oe(fe.target.value),disabled:J})]})]}),c.jsxs(h4,{children:[c.jsx(Fr,{variant:"outline",onClick:()=>{$(!1),K(null)},disabled:J,children:r("common.cancel")}),c.jsxs(Fr,{onClick:()=>void Te(),disabled:J,children:[J?c.jsx(Ka,{"data-icon":"inline-start"}):null,r(J?P?"mcp.edit.saving":"mcp.add.adding":P?"mcp.edit.save":"mcp.add.button")]})]})]})});if(Ge&&Ce)return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Ie,c.jsxs("div",{className:"flex w-full flex-col gap-6",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:c.jsx(W8,{})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"break-words text-2xl font-semibold",children:Ge.name}),c.jsx("p",{className:"text-sm text-muted-foreground",children:Ge.serverToolName||Ce.name})]})]}),c.jsx(Rc,{children:c.jsx(Z0,{children:c.jsx(Vft,{tool:Ge,t:r})})})]})]}),ne]});if(St&&Ce)return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Ie,c.jsxs("div",{className:"flex w-full flex-col gap-6",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center rounded-xl bg-muted",children:c.jsx(U8,{})}),c.jsx("h1",{className:"min-w-0 break-words text-2xl font-semibold",children:St.title||St.name||St.uri})]}),c.jsx(Rc,{children:c.jsx(Z0,{children:c.jsx(Wft,{resource:St,t:r})})})]})]}),ne]});if(Ce){const fe=Zt,pt=dt,He=Ae[Ce.name],on=qft(Ce,r);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Ie,c.jsxs("div",{className:"flex w-full flex-col gap-6",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-xl bg-muted",children:c.jsx(z0,{})}),c.jsx("div",{className:"min-w-0 flex-1",children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("h1",{className:"break-words text-2xl font-semibold",children:Ce.name}),c.jsx(Kc,{variant:"secondary",className:iq(Ce),children:sq(Ce,r)}),c.jsx(Kc,{variant:"outline",children:nq(Ce,r)})]})}),c.jsxs(my,{children:[c.jsx(py,{asChild:!0,children:c.jsx(Fr,{variant:"ghost",size:"icon",disabled:_!==null,"aria-label":r("mcp.actions"),"data-testid":"mcp-server-actions",children:_===Ce.name?c.jsx(Ka,{}):c.jsx(Xb,{})})}),c.jsx(gy,{align:"end",onCloseAutoFocus:Ze=>Ze.preventDefault(),children:c.jsx(bv,{children:on.map(Ze=>c.jsx($a,{"data-testid":`mcp-server-action-${Ze.id}`,variant:Ze.id==="remove"?"destructive":"default",disabled:_!==null,onSelect:()=>void bn(Ce,Ze),children:Ze.label},Ze.id))})})]})]}),(ae==null?void 0:ae.serverName)===Ce.name?c.jsxs(la,{variant:ae.error?"destructive":"default",children:[ae.error?c.jsx(Nc,{}):c.jsx(V8,{}),c.jsxs(ca,{className:"whitespace-pre-wrap break-words",children:[c.jsx("p",{children:ae.text}),ae.authUrl&&Hft(ae.authUrl)?c.jsx("a",{className:"mt-2 inline-block underline underline-offset-3",href:ae.authUrl,target:"_blank",rel:"noreferrer",children:r("mcp.oauth.open")}):null]})]}):null,c.jsxs(j3,{value:y,onValueChange:w,children:[c.jsxs(I3,{children:[c.jsx(qa,{value:"overview",children:r("mcp.basicInfo")}),c.jsxs(qa,{value:"tools",children:[r("mcp.tools")," ",fe.length]}),c.jsxs(qa,{value:"resources",children:[r("mcp.resources")," ",Ce.resourceCount??pt.length]})]}),c.jsx(Xl,{value:"overview",className:"pt-4",children:c.jsxs(Rc,{children:[c.jsxs(Am,{children:[c.jsx(Em,{className:"text-sm",children:r("mcp.descriptionTitle")}),c.jsx(j0,{children:((ke=Ce.description)==null?void 0:ke.trim())||"-"})]}),c.jsxs(Z0,{className:"grid gap-6 sm:grid-cols-2",children:[c.jsx(Ha,{label:r("mcp.source"),value:nq(Ce,r)}),c.jsx(Ha,{label:r("mcp.transport"),value:Ce.transport}),c.jsx(Ha,{label:r("mcp.command"),value:Fft(Ce,r)}),c.jsx(Ha,{label:r("mcp.workingDirectory"),value:((Ot=Ce.config)==null?void 0:Ot.cwd)||o.workspaceCwd}),Ce.error?c.jsx(Ha,{label:r("mcp.invalidReasonLabel"),value:Ce.error}):null,Ce.hint?c.jsx(Ha,{label:r("mcp.description"),value:Ce.hint}):null]})]})}),c.jsx(Xl,{value:"tools",className:"pt-4",children:He!=null&&He.tools?c.jsxs(la,{variant:"destructive",children:[c.jsx(Nc,{}),c.jsx(bm,{children:r("mcp.loadingTools")}),c.jsx(ca,{children:He.tools})]}):fe.length?c.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:fe.map(Ze=>c.jsx(Rc,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>b(Ze.name),onKeyDown:Et=>{(Et.key==="Enter"||Et.key===" ")&&(Et.preventDefault(),b(Ze.name))},children:c.jsxs(Am,{children:[c.jsx(Em,{className:"break-words",children:Ze.name}),c.jsx(j0,{className:"line-clamp-2 text-xs",children:Ze.description||r("mcp.noDescription")}),Ze.isValid?null:c.jsx(Cft,{children:c.jsx(Kc,{variant:"destructive",children:r("mcp.status.blocked")})})]})},Ze.name))}):c.jsx(zh,{className:"rounded-xl border border-dashed",children:c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:c.jsx(W8,{})}),c.jsx(Hh,{children:r("mcp.emptyTools")})]})})}),c.jsx(Xl,{value:"resources",className:"pt-4",children:He!=null&&He.resources?c.jsxs(la,{variant:"destructive",children:[c.jsx(Nc,{}),c.jsx(bm,{children:r("mcp.resourcesUnavailable")}),c.jsx(ca,{children:He.resources})]}):pt.length?c.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:pt.map(Ze=>c.jsx(Rc,{size:"sm",role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-accent/50",onClick:()=>v(Ze.uri),onKeyDown:Et=>{(Et.key==="Enter"||Et.key===" ")&&(Et.preventDefault(),v(Ze.uri))},children:c.jsxs(Am,{children:[c.jsx(Em,{className:"break-words",children:Ze.title||Ze.name||Ze.uri}),c.jsx(j0,{className:"break-all",children:Ze.uri})]})},Ze.uri))}):c.jsx(zh,{className:"rounded-xl border border-dashed",children:c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:c.jsx(U8,{})}),c.jsx(Hh,{children:r("mcp.noResources")})]})})})]})]})]}),Ke,ne]})}const De=Pe.filter(fe=>!fe.disabled&&fe.mcpStatus==="connecting").length,Dt=[{value:"all",label:r("mcp.source.all")},{value:"user",label:r("mcp.source.user")},{value:"workspace",label:r("mcp.source.workspace")},{value:"extension",label:r("mcp.source.extension")}];return c.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8",children:[Ie,c.jsxs("div",{className:"flex w-full flex-col gap-6",children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-semibold text-balance",children:r("mcp.title")}),c.jsx("p",{className:"mt-1 text-sm text-muted-foreground tabular-nums",children:r("mcp.servers",{count:Pe.length})})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(Fr,{variant:"outline",onClick:()=>void We(),disabled:N,children:[N?c.jsx(Ka,{"data-icon":"inline-start"}):c.jsx(Ik,{"data-icon":"inline-start"}),r("common.refresh")]}),c.jsxs(Fr,{onClick:()=>{K(null),H(""),Q(""),j("workspace"),oe(lk),Z(null),$(!0)},disabled:J,children:[c.jsx(U2,{"data-icon":"inline-start"}),r("mcp.add.button")]})]})]}),M&&De===0?c.jsxs(la,{children:[c.jsx(Ik,{className:"animate-spin"}),c.jsx(bm,{children:r("mcp.discovery.initializing")}),c.jsx(ca,{children:r("mcp.startingNote")})]}):De>0?c.jsxs(la,{children:[c.jsx(Ik,{}),c.jsx(bm,{children:r("mcp.starting",{count:De})}),c.jsx(ca,{children:r("mcp.startingNote")})]}):null,ae&&!ae.serverName?c.jsxs(la,{variant:ae.error?"destructive":"default",children:[c.jsx(Nc,{}),c.jsx(ca,{children:ae.text})]}):null,(o.errors??[]).map((fe,pt)=>c.jsxs(la,{variant:"destructive",children:[c.jsx(Nc,{}),c.jsx(bm,{children:fe.kind}),c.jsx(ca,{children:fe.error||fe.hint||r("mcp.status.unknown")})]},`${fe.kind}-${pt}`)),o.budgetMode&&o.budgetMode!=="off"?c.jsxs(la,{children:[c.jsx(Nc,{}),c.jsx(ca,{children:r("mcp.clientBudget",{count:o.clientCount??0,budget:o.clientBudget??"∞"})})]}):null,c.jsxs("div",{className:"relative",children:[c.jsx(Um,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(ga,{className:"pl-9",value:k,onChange:fe=>T(fe.target.value),placeholder:`${r("common.search")} MCP…`})]}),c.jsx(Oft,{type:"single",value:S,onValueChange:fe=>{fe&&C(fe)},variant:"outline",size:"sm","aria-label":r("mcp.source"),children:Dt.map(fe=>c.jsx(Bft,{value:fe.value,children:fe.label},fe.value))}),Y.length?c.jsx("div",{className:Xse.serverGrid,"data-column-count":Math.min(Y.length,4),children:Y.map(fe=>{var pt;return c.jsx(Rc,{size:"sm",role:"button",tabIndex:0,"aria-label":fe.name,className:"cursor-pointer transition-colors hover:bg-accent/30 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-none",onClick:()=>Pn(fe),onKeyDown:He=>{(He.key==="Enter"||He.key===" ")&&(He.preventDefault(),Pn(fe))},children:c.jsx(Am,{className:"block",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(z0,{className:"size-5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-2",children:[c.jsx(Em,{className:"min-w-0 flex-1 truncate",children:fe.name}),c.jsx(Kc,{variant:"secondary",className:`${iq(fe)} shrink-0 text-[10px]`,children:sq(fe,r)})]}),c.jsx(j0,{className:"mt-1 truncate text-xs",children:((pt=fe.description)==null?void 0:pt.trim())||"-"})]})]})})},fe.name)})}):c.jsx(zh,{className:"border",children:c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:k||S!=="all"?c.jsx(Um,{}):c.jsx(z0,{})}),c.jsx(Hh,{children:r(k||S!=="all"?"mcp.noMatches":"mcp.empty")}),!k&&S==="all"?c.jsx(ox,{children:r("mcp.emptyDescription")}):null]})})]}),ne]})}function Gft({mcpMessage:e,loadMcpMessage:t,onClose:n,initialFocusRef:r}){const{t:s}=gt(),[i,o]=f.useState("extensions"),[a,l]=f.useState(!1),[u,d]=f.useState(0),[h,m]=f.useState(!1),[p,g]=f.useState(null),b=f.useCallback(()=>{m(!1),g(null),t().then(()=>m(!0)).catch(w=>{g(w instanceof Error?w.message:String(w))})},[t]),x=f.useCallback(()=>{l(!1),d(w=>w+1)},[]),v=f.useMemo(()=>({onRoot:x,onDetailChange:l}),[x]),y=w=>{const k=w;o(k),l(!1),d(T=>T+1),k==="mcp"&&b()};return c.jsxs(j3,{value:i,onValueChange:y,className:"w-full",children:[a?null:c.jsx("div",{className:"sticky -top-4 z-10 -mx-5 -mt-4 border-b bg-background px-5 py-3",children:c.jsxs(I3,{className:"h-8","aria-label":s("plugins.sections"),children:[c.jsx(qa,{ref:r,value:"extensions",children:s("plugins.extensions")}),c.jsx(qa,{value:"mcp",children:s("plugins.mcp")})]})}),c.jsx(Xl,{value:i,className:"mt-0",children:i==="extensions"?c.jsx(Yse,{onClose:n,embedded:v},`extensions-${u}`):p?c.jsxs(la,{variant:"destructive",className:"mt-4",children:[c.jsx(bm,{children:s("plugins.mcpLoadFailed")}),c.jsxs(ca,{className:"space-y-3",children:[c.jsx("p",{children:p}),c.jsx(Fr,{variant:"outline",size:"sm",onClick:b,children:s("common.retry")})]})]}):e&&h?c.jsx(Jse,{message:e,onClose:n,embedded:v},`mcp-${u}`):c.jsxs("div",{className:"flex w-full flex-col gap-6 pb-8 pt-4",children:[c.jsxs("div",{className:"relative",children:[c.jsx(Um,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(ga,{"aria-label":s("common.search"),readOnly:!0,className:"pl-9",placeholder:`${s("common.search")} MCP…`})]}),c.jsx(zh,{className:"border",children:c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:c.jsx(z0,{})}),c.jsx(Hh,{children:s("mcp.empty")}),c.jsx(ox,{children:s("mcp.emptyDescription")})]})})]})})]})}const Kft="_section_1ghly_1",Yft="_header_1ghly_12",Xft="_title_1ghly_19",Qft="_addButton_1ghly_24",Jft="_hint_1ghly_38",Zft="_empty_1ghly_39",emt="_provider_1ghly_45",tmt="_providerName_1ghly_51",nmt="_modelRow_1ghly_59",rmt="_modelInfo_1ghly_70",smt="_modelName_1ghly_78",imt="_modelBaseUrl_1ghly_84",omt="_currentBadge_1ghly_91",amt="_runtimeBadge_1ghly_99",lmt="_modelActions_1ghly_107",cmt="_actionButton_1ghly_114",umt="_deleteButton_1ghly_115",dmt="_confirmButton_1ghly_116",ui={section:Kft,header:Yft,title:Xft,addButton:Qft,hint:Jft,empty:Zft,provider:emt,providerName:tmt,modelRow:nmt,modelInfo:rmt,modelName:smt,modelBaseUrl:imt,currentBadge:omt,runtimeBadge:amt,modelActions:lmt,actionButton:cmt,deleteButton:umt,confirmButton:dmt};function i2(e,t){return`${e.authType}:${t.modelId}:${t.baseUrl??""}`}function hmt(e,t){const n=e.flatMap(s=>s.models.map(i=>({provider:s,model:i})));if(t){const s=n.find(({model:o})=>o.modelId===t);if(s)return i2(s.provider,s.model);const i=n.find(({model:o})=>o.baseModelId===t);return i?i2(i.provider,i.model):void 0}const r=n.find(({model:s})=>s.isCurrent);return r?i2(r.provider,r.model):void 0}function fmt({providers:e,currentModelId:t,loading:n,error:r,busy:s,onSelectModel:i,onDeleteModel:o,onAddModel:a}){const{t:l}=gt(),[u,d]=f.useState(null);f.useEffect(()=>{if(u===null)return;const p=g=>{g.key==="Escape"&&d(null)};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[u]);const h=e.some(p=>p.models.length>0),m=hmt(e,t);return c.jsxs("div",{className:ui.section,"data-testid":"model-management",children:[c.jsxs("div",{className:ui.header,children:[c.jsx("span",{className:ui.title,children:l("settings.models.title")}),c.jsx("button",{type:"button",className:ui.addButton,disabled:s,onClick:a,children:l("settings.models.add")})]}),r&&c.jsx("div",{className:ui.hint,children:r.message}),n&&!h&&c.jsx("div",{className:ui.hint,children:l("settings.models.loading")}),!n&&!h&&!r&&c.jsx("div",{className:ui.empty,children:l("settings.models.empty")}),e.map((p,g)=>p.models.length===0?null:c.jsxs("div",{className:ui.provider,children:[c.jsx("div",{className:ui.providerName,children:p.authType}),p.models.map(b=>{const x=i2(p,b),v=x===m,y=u===x,w=b.name||b.baseModelId;return c.jsxs("div",{className:ui.modelRow,children:[c.jsxs("div",{className:ui.modelInfo,children:[c.jsx("span",{className:ui.modelName,children:b.name||b.baseModelId}),v&&c.jsx("span",{className:ui.currentBadge,children:l("settings.models.current")}),b.isRuntime&&c.jsx("span",{className:ui.runtimeBadge,children:l("settings.models.runtime")}),b.baseUrl&&c.jsx("span",{className:ui.modelBaseUrl,children:b.baseUrl})]}),c.jsxs("div",{className:ui.modelActions,children:[!v&&c.jsx("button",{type:"button",className:ui.actionButton,disabled:s,"aria-label":`${l("settings.models.setCurrent")} ${w}`,onClick:()=>i(b.modelId),children:l("settings.models.setCurrent")}),!b.isRuntime&&(y?c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:ui.confirmButton,disabled:s,"aria-label":`${l("settings.models.confirmDelete")} ${w}`,onClick:()=>{d(null),o({authType:p.authType,modelId:b.baseModelId,...b.baseUrl?{baseUrl:b.baseUrl}:{}})},children:l("settings.models.confirmDelete")}),c.jsx("button",{type:"button",className:ui.actionButton,disabled:s,"aria-label":`${l("settings.models.cancel")} ${w}`,onClick:()=>d(null),children:l("settings.models.cancel")})]}):c.jsx("button",{type:"button",className:ui.deleteButton,disabled:s,"aria-label":`${l("settings.models.delete")} ${w}`,onClick:()=>d(x),children:l("settings.models.delete")}))]})]},x)})]},`${p.authType}:${g}`))]})}function mmt({className:e,...t}){return c.jsx(hDe,{"data-slot":"label",className:tn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function Bj({className:e,...t}){return c.jsx("div",{"data-slot":"field-group",className:tn("group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...t})}const pmt=bp("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function eg({className:e,orientation:t="vertical",...n}){return c.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:tn(pmt({orientation:t}),e),...n})}function Zse({className:e,...t}){return c.jsx("div",{"data-slot":"field-content",className:tn("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...t})}function by({className:e,...t}){return c.jsx(mmt,{"data-slot":"field-label",className:tn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function gmt({className:e,...t}){return c.jsx("div",{"data-slot":"field-label",className:tn("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",e),...t})}function gE({className:e,...t}){return c.jsx("p",{"data-slot":"field-description",className:tn("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function bmt({className:e,children:t,errors:n,...r}){const s=f.useMemo(()=>{var o;if(t)return t;if(!(n!=null&&n.length))return null;const i=[...new Map(n.map(a=>[a==null?void 0:a.message,a])).values()];return(i==null?void 0:i.length)==1?(o=i[0])==null?void 0:o.message:c.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((a,l)=>(a==null?void 0:a.message)&&c.jsx("li",{children:a.message},l))})},[t,n]);return s?c.jsx("div",{role:"alert","data-slot":"field-error",className:tn("text-sm font-normal text-destructive",e),...r,children:s}):null}function eie({className:e,size:t="default",...n}){return c.jsx(lne,{"data-slot":"switch","data-size":t,className:tn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:c.jsx(une,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}const ymt=new Set(["fastModel","visionModel","voiceModel","modelFallbacks"]),vmt=new Set(["ui.hideTips","ui.enableUserFeedback","ui.compactMode","ui.compactInline","mcpServers"]);function D3(e,t,n){const r=e(t);return r===t?n:r}function xmt(e,t){return D3(t,`settings.category.${e}`,e)}function Kp(e,t){return D3(t,`settings.label.${e.key}`,e.label)}function wmt(e,t){if(e.description)return D3(t,`settings.description.${e.key}`,e.description)}function tie(e,t,n,r){return D3(r,`settings.option.${e.key}.${String(t)}`,n)}function kmt(e,t,n){const r=rie(e,t);if(r==null)return"";if(e.key===ym){const i=H9(r,As.Dark);return n(`theme.${i}`)}if(e.key===W2){const i=z9(r);return i?F9(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?tie(e,i.value,i.label,n):String(r)}const s=String(r);return s.length>24?`${s.slice(0,21)}…`:s}function nie(e,t){return(t==="user"?e.values.user:e.values.workspace)!==void 0}function _mt(e,t){if(t==="workspace"?e.values.user!==void 0:e.values.workspace!==void 0)return nie(e,t)?"settings.alsoModifiedIn":"settings.modifiedIn"}function rie(e,t){const n=t==="user"?e.values.user:e.values.workspace;return n!==void 0?n:e.values.effective}function Smt(e){const t=new Map;for(const n of e){let r=t.get(n.category);r||(r=[],t.set(n.category,r)),r.push(n)}return Array.from(t.entries()).map(([n,r])=>({category:n,items:r}))}function oq({category:e}){const t=e.toLowerCase(),n=t.includes("ui")?qfe:t.includes("tool")?W8:t.includes("context")?U8:t.includes("privacy")?sme:t.includes("model")?kW:t.includes("daemon")?z0:t.includes("advanced")?ome:t.includes("experimental")?_fe:TW;return c.jsx(n,{"data-icon":"inline-start","aria-hidden":"true"})}function aq({title:e,description:t,metadata:n,control:r}){return c.jsxs(eg,{orientation:"responsive",className:"min-h-20 gap-6 px-5 py-4 max-md:px-4",children:[c.jsxs(Zse,{className:"min-w-0",children:[c.jsxs(gmt,{children:[e,n]}),t&&c.jsx(gE,{className:"max-w-3xl",children:t})]}),c.jsx("div",{className:"flex min-w-0 justify-end max-md:justify-start",children:r})]})}function Cmt({name:e,label:t,type:n,value:r,disabled:s,onCommit:i,onInvalid:o}){const a=String(r??""),[l,u]=f.useState(a);f.useEffect(()=>u(a),[a]);const d=()=>{if(n==="number"){const h=l.trim(),m=Number(h);if(!h||!Number.isFinite(m)){u(a),o();return}m!==r&&i(m);return}l!==a&&i(l)};return c.jsx(ga,{type:n,name:e,autoComplete:"off","aria-label":t,value:l,disabled:s,className:"w-[min(80px,50vw)] max-md:w-full",onChange:h=>u(h.target.value),onBlur:d,onKeyDown:h=>{h.key==="Enter"&&h.currentTarget.blur(),h.key==="Escape"&&(u(a),h.currentTarget.blur())}})}function Tmt({settingsState:e,onLanguageChange:t,onSubDialog:n,onThemeChange:r,chatWidthMode:s,onChatWidthModeChange:i,modelManagement:o,embedded:a=!1}){const{language:l,t:u}=gt(),d=Hg(),{status:h,settings:m,loading:p,error:g,reload:b,setValue:x}=e,[v,y]=f.useState("workspace"),[w,k]=f.useState(""),[T,S]=f.useState(null),[C,_]=f.useState(null),[A,M]=f.useState(!1),L=p&&!h,N=f.useMemo(()=>{const F=m.filter(U=>!vmt.has(U.key)),H=Smt(F).map(U=>({id:U.category,label:xmt(U.category,u),items:U.items.map(j=>({type:"setting",setting:j}))})),D={type:"local",localKey:"chatWidth"},Q=H.find(U=>U.items.some(j=>j.type==="setting"&&j.setting.key===ym));if(Q){const U=Q.items.findIndex(j=>j.type==="setting"&&j.setting.key===ym);Q.items.splice(U+1,0,D)}else H.push({id:u("settings.category.UI"),label:u("settings.category.UI"),items:[D]});return H},[m,u]);f.useEffect(()=>{N.length!==0&&(N.some(F=>F.id===w)||k(N[0].id))},[w,N]),f.useEffect(()=>{var F;g?_(g.message):(F=h==null?void 0:h.warnings)!=null&&F.length?_(h.warnings.map(H=>u("settings.corrupted",{recovered:H.recovered?"true":"false"})).join("; ")):m.length>0&&_(null)},[g,m,h,u]);const O=f.useCallback((F,H)=>{A||_(null),S(F),x(v,F,H).then(async D=>{try{await b()}catch{}D!=null&&D.requiresRestart&&F!==W2&&M(!0)}).catch(D=>{_(D instanceof Error?D.message:String(D))}).finally(()=>S(null))},[b,A,v,x]),B=N.find(F=>F.id===w)??N[0],$=B==null?void 0:B.items.some(F=>F.type==="setting"&&F.setting.category==="Model"),P=(F,H,D,Q,U=!1)=>c.jsxs(C3,{value:F,disabled:U,onValueChange:H,children:[c.jsx(A3,{size:"sm","aria-label":Q,className:"w-[min(160px,50vw)] bg-background max-md:w-full",children:c.jsx(T3,{})}),c.jsx(E3,{position:"popper",align:"end",children:c.jsx(Ij,{children:D.map(j=>c.jsx(Ig,{value:j.value,children:j.label},j.value))})})]}),K=F=>{var U;const H=rie(F,v),Q=T===F.key;if(F.key===ym)return P(H9(H)??d,j=>{const ie=j;r(ie),O(ym,BW(ie))},PW.map(j=>({value:j,label:u(`theme.${j}`)})),Kp(F,u),Q);if(F.key===W2)return P(z9(H)??l,j=>t(j,v),Pme.map(j=>({value:j,label:F9(j)})),Kp(F,u),Q);if(ymt.has(F.key))return c.jsx(Fr,{type:"button",variant:"outline",size:"sm",disabled:Q,className:"max-w-[260px] truncate",onClick:()=>n(F.key,v),children:kmt(F,v,u)||u("settings.action.select")});if(F.type==="boolean"){const j=H===!0;return c.jsx(eie,{checked:j,disabled:Q,onCheckedChange:ie=>O(F.key,ie),"aria-label":Kp(F,u)})}if(F.type==="enum"&&((U=F.options)!=null&&U.length)){const j=F.options.findIndex(ie=>ie.value===H);return P(j>=0?String(j):"",ie=>{var J;const oe=(J=F.options)==null?void 0:J[Number(ie)];oe&&O(F.key,oe.value)},F.options.map((ie,oe)=>({value:String(oe),label:tie(F,ie.value,ie.label,u)})),Kp(F,u),Q)}return c.jsx(Cmt,{name:F.key,label:Kp(F,u),type:F.type==="number"?"number":"text",value:H,disabled:Q,onCommit:j=>O(F.key,j),onInvalid:()=>_(u("settings.invalidNumber"))})};return c.jsxs("div",{className:a?"flex min-h-0 flex-1 flex-col text-sm text-foreground":"flex max-w-[min(var(--chat-regular-content-width,1000px),calc(100vw-64px))] flex-col overflow-hidden rounded-xl border border-border bg-background text-sm text-foreground","data-keyboard-scope":!0,children:[!a&&c.jsx("div",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-semibold text-balance",children:u("settings.title")}),c.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:u("settings.scope.workspace")})]})}),(C||L)&&c.jsxs(la,{className:"mx-4 mt-3 w-auto",children:[L&&c.jsx(Ka,{}),c.jsx(ca,{children:C||u("settings.loading")})]}),c.jsxs(j3,{value:v,className:"flex min-h-0 flex-1 flex-col gap-0",onValueChange:F=>{y(F)},children:[c.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-border px-3 py-2",children:[c.jsxs(I3,{className:"p-0",children:[c.jsx(qa,{value:"workspace",children:u("settings.scope.workspace")}),c.jsx(qa,{value:"user",children:u("settings.scope.user")})]}),A&&c.jsx(Kc,{variant:"secondary",children:u("settings.requiresRestart")})]}),c.jsxs(Xl,{value:v,forceMount:!0,className:"grid min-h-0 flex-1 grid-cols-[190px_minmax(0,1fr)] outline-none max-md:grid-cols-1",children:[c.jsx("nav",{className:"flex min-h-0 flex-col gap-1 overflow-y-auto border-r border-border bg-muted/20 p-3 max-md:flex-row max-md:overflow-x-auto max-md:border-r-0 max-md:border-b","aria-label":u("settings.title"),children:N.map(F=>c.jsxs(Fr,{type:"button",variant:F.id===w?"secondary":"ghost",size:"sm","aria-current":F.id===w?"page":void 0,className:"w-full justify-start gap-2 px-2.5 max-md:w-auto max-md:shrink-0",onClick:()=>k(F.id),children:[c.jsx(oq,{category:F.id}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:F.label}),c.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:F.items.length})]},F.id))}),c.jsxs("section",{className:"min-h-0 min-w-0 overflow-y-auto bg-background p-5 max-md:p-3",children:[!p&&!B&&c.jsx(zh,{className:"min-h-60",children:c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:c.jsx(TW,{})}),c.jsx(Hh,{children:u("settings.empty")}),c.jsx(ox,{children:u("settings.empty")})]})}),B&&c.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[c.jsxs(Rc,{children:[c.jsx(Am,{children:c.jsxs(Em,{className:"flex items-center gap-2",children:[c.jsx(oq,{category:B.id}),B.label]})}),c.jsx(Z0,{className:"-mb-(--card-spacing) p-0",children:c.jsx(Bj,{className:"gap-0",children:B.items.map((F,H)=>{const D=H>0&&c.jsx(Kse,{className:"mx-5 w-auto max-md:mx-4"});if(F.type==="local")return c.jsxs("div",{children:[D,c.jsx(aq,{title:u("settings.label.ui.chatWidth"),description:u("settings.description.ui.chatWidth"),control:P(s,J=>i(J),[{value:"1000",label:u("settings.option.ui.chatWidth.1000")},{value:"wide",label:u("settings.option.ui.chatWidth.wide")}],u("settings.label.ui.chatWidth"),!1)})]},F.localKey);const Q=F.setting,U=wmt(Q,u),j=_mt(Q,v),ie=nie(Q,v),oe=j?u(j,{scope:u(v==="workspace"?"settings.scope.user":"settings.scope.workspace")}):void 0;return c.jsxs("div",{children:[D,c.jsx(aq,{title:Kp(Q,u),description:[U,oe].filter(Boolean).join(" · ")||void 0,metadata:ie?c.jsx(Kc,{variant:"secondary",children:u(v==="workspace"?"settings.scope.workspace":"settings.scope.user")}):void 0,control:T===Q.key?c.jsx(Ka,{}):K(Q)})]},Q.key)})})})]}),$&&o&&c.jsx("div",{className:"mt-4",children:c.jsx(fmt,{...o})})]})]})]})]}),!a&&c.jsx("div",{className:"border-t border-border px-5 py-3 text-xs text-muted-foreground",children:u("settings.footer")})]})}const Amt="_dialog_1ymqd_1",Emt="_toolbar_1ymqd_12",Mmt="_tabs_1ymqd_21",Nmt="_tab_1ymqd_21",jmt="_tabActive_1ymqd_39",Imt="_search_1ymqd_48",Rmt="_general_1ymqd_60",Dmt="_shortcuts_1ymqd_67",Lmt="_shortcut_1ymqd_67",Pmt="_shortcutKey_1ymqd_87",Omt="_shortcutDesc_1ymqd_95",Bmt="_commandList_1ymqd_101",$mt="_commandCard_1ymqd_108",zmt="_commandCardExpanded_1ymqd_115",Fmt="_commandRow_1ymqd_119",qmt="_commandName_1ymqd_135",Hmt="_commandTag_1ymqd_142",Umt="_chevron_1ymqd_152",Vmt="_chevronExpanded_1ymqd_160",Wmt="_commandDetail_1ymqd_164",Gmt="_commandDescription_1ymqd_174",Kmt="_commandSubcommands_1ymqd_175",Ymt="_empty_1ymqd_182",Gs={dialog:Amt,toolbar:Emt,tabs:Mmt,tab:Nmt,tabActive:jmt,search:Imt,general:Rmt,shortcuts:Dmt,shortcut:Lmt,shortcutKey:Pmt,shortcutDesc:Omt,commandList:Bmt,commandCard:$mt,commandCardExpanded:zmt,commandRow:Fmt,commandName:qmt,commandTag:Hmt,chevron:Umt,chevronExpanded:Vmt,commandDetail:Wmt,commandDescription:Gmt,commandSubcommands:Kmt,empty:Ymt},Xmt=[{id:"general",labelKey:"help.tab.general"},{id:"commands",labelKey:"help.tab.commands"},{id:"custom-commands",labelKey:"help.tab.custom"}],Qmt=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"]),Jmt=[["@","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 Zmt(e){return[`/${e.name}`,e.argumentHint].filter(Boolean).join(" ")}function bE(e){return!Qmt.has(e.name)}function ept(e,t){return bE(e)?t("help.commandMeta.custom"):t("help.commandMeta.builtIn")}function tpt(e,t,n){const r=n.trim().toLowerCase();return e.filter(s=>s.name&&s.description!==void 0).filter(s=>t==="commands"?!bE(s):t==="custom-commands"?bE(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 npt(){const{t:e}=gt();return c.jsx("div",{className:Gs.general,children:c.jsx("div",{className:Gs.shortcuts,children:Jmt.map(([t,n])=>c.jsxs("div",{className:Gs.shortcut,children:[c.jsx("span",{className:Gs.shortcutDesc,children:e(n)}),c.jsx("span",{className:Gs.shortcutKey,children:t})]},t))})})}function rpt({commands:e,tab:t,query:n}){const{t:r}=gt(),[s,i]=f.useState(null),o=f.useMemo(()=>tpt(e,t,n),[e,n,t]);return o.length===0?c.jsx("div",{className:Gs.empty,children:r(t==="custom-commands"?"help.emptyCustom":"help.empty")}):c.jsx("div",{className:Gs.commandList,children:o.map(a=>{var u;const l=s===a.name;return c.jsxs("article",{className:`${Gs.commandCard} ${l?Gs.commandCardExpanded:""}`,children:[c.jsxs("button",{type:"button",className:Gs.commandRow,onClick:()=>i(l?null:a.name),"aria-expanded":l,children:[c.jsx("span",{className:Gs.commandName,children:Zmt(a)}),c.jsx("span",{className:Gs.commandTag,children:ept(a,r)}),c.jsx("svg",{className:`${Gs.chevron} ${l?Gs.chevronExpanded:""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M6 4.5 9.5 8 6 11.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})]}),l&&c.jsxs("div",{className:Gs.commandDetail,children:[a.description&&c.jsx("div",{className:Gs.commandDescription,children:a.description}),!!((u=a.subcommands)!=null&&u.length)&&c.jsxs("div",{className:Gs.commandSubcommands,children:[r("help.subcommands"),": ",a.subcommands.join(", ")]})]})]},a.name)})})}function spt({commands:e}){const{t}=gt(),[n,r]=f.useState("general"),{filterValue:s,inputProps:i}=M3(),o=n!=="general";return c.jsxs("div",{className:Gs.dialog,children:[c.jsxs("div",{className:Gs.toolbar,children:[c.jsx("div",{className:Gs.tabs,children:Xmt.map(a=>c.jsx("button",{type:"button",className:`${Gs.tab} ${a.id===n?Gs.tabActive:""}`,onClick:()=>r(a.id),children:t(a.labelKey)},a.id))}),o&&c.jsx("input",{className:Gs.search,...i,placeholder:t("help.search")})]}),n==="general"?c.jsx(npt,{}):c.jsx(rpt,{commands:e,tab:n,query:s})]})}function ipt({currentTheme:e,onSelect:t,onClose:n}){const{t:r}=gt(),s=PW.map(d=>({id:d,label:r(`theme.${d}`),description:r(`theme.${d}.desc`)})),[i,o]=f.useState(()=>{const d=s.findIndex(h=>h.id===e);return d>=0?d:0}),a=f.useRef(null),l=d=>{const h=s[d];h&&(t(h.id),n())},{keyboardMode:u}=Nf({itemCount:s.length,activeIndex:i,onActiveIndexChange:o,onConfirm:l});return f.useEffect(()=>{var h;const d=(h=a.current)==null?void 0:h.children[i];d==null||d.scrollIntoView({block:"nearest"})},[i]),c.jsx("div",{className:Qt("picker-list","picker-list-compact",u?"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,"data-web-shell-theme-dialog":!0,children:s.map((d,h)=>{const m=d.id===e;return c.jsxs("div",{id:`theme-opt-${h}`,role:"option","aria-selected":m,className:Qt("picker-item","picker-session-item",h===i?"selected":void 0,m?"dialog-current":void 0),"data-web-shell-theme-option":!0,"data-theme-id":d.id,onClick:()=>l(h),onMouseMove:()=>o(h),children:[c.jsx("div",{className:Qt("picker-item-row"),children:c.jsx("span",{className:Qt("picker-item-title"),children:d.label})}),c.jsx("div",{className:Qt("picker-item-meta"),children:d.description})]},d.id)})})}const yE="delete-session-list",lq=e=>`${yE}-opt-${e}`;function opt({onDeleted:e,onError:t,onClose:n,workspaceCwd:r}){const{t:s}=gt(),i=il(),{sessions:o,loading:a,error:l,deleteSession:u,deleteSessions:d}=ix(r,{autoLoad:!0}),h=i.sessionId,[m,p]=f.useState(!1),[g,b]=f.useState(-1),[x,v]=f.useState(new Set),{filterValue:y,inputProps:w}=M3(()=>{b(-1),v(new Set)}),[k,T]=f.useState(null),S=f.useRef(null),C=f.useRef(null);f.useEffect(()=>{l&&T(l.message)},[l]);const _=f.useMemo(()=>y?o.filter(B=>{const $=y.toLowerCase();return(B.displayName||"").toLowerCase().includes($)||B.sessionId.toLowerCase().includes($)}):o,[o,y]),A=f.useCallback(B=>{B!==h&&v($=>{const P=new Set($);return P.has(B)?P.delete(B):P.add(B),P})},[h]);f.useEffect(()=>{if(x.size===0)return;const B=new Set(_.map($=>$.sessionId));v($=>{const P=new Set([...$].filter(K=>B.has(K)));return P.size===$.size?$:P})},[_,x.size]),f.useEffect(()=>{g>=_.length&&_.length>0&&b(_.length-1)},[_.length,g]),f.useEffect(()=>{var $;const B=($=S.current)==null?void 0:$.children[g];B==null||B.scrollIntoView({block:"nearest"})},[g]),f.useEffect(()=>{var B;(B=C.current)==null||B.focus()},[]);const{keyboardMode:M}=Nf({itemCount:_.length,activeIndex:g,onActiveIndexChange:b,onConfirm:B=>{const $=_[B];$&&A($.sessionId)}}),L=f.useCallback(()=>{if(m)return;if(x.size>0){const $=new Set(_.map(K=>K.sessionId)),P=Array.from(x).filter(K=>$.has(K));if(P.length===0)return;p(!0),d(P).then(K=>{const F=K.removed.length+K.notFound.length,H=K.errors.length;if(H>0&&F>0){t(new Error(s("delete.partialFail",{removed:F,failed:H,detail:K.errors[0].error}))),n();return}if(H>0){T(s("delete.allFailed",{count:H,reason:K.errors[0].error})),p(!1),v(new Set);return}if(F===0){T(s("delete.nonRemoved")),p(!1),v(new Set);return}e([...K.removed,...K.notFound]),n()}).catch(K=>{t(K),p(!1)});return}const B=_[g];if(B){if(B.sessionId===h){T(s("delete.cannotCurrent"));return}p(!0),u(B.sessionId).then($=>{if(!$){T(s("delete.notFound")),p(!1);return}e([B.sessionId]),n()}).catch($=>{t($),p(!1)})}},[h,u,d,m,_,n,e,t,g,x,s]),N=x.size>0,O=!m&&!a&&N;return c.jsxs("div",{className:Qt("picker","picker-in-shell"),children:[c.jsxs("div",{className:Qt("picker-search"),children:[c.jsxs("span",{className:Qt("picker-search-label"),children:[s("resume.search"),":"," "]}),c.jsx("input",{ref:C,className:Qt("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":yE,"aria-activedescendant":g>=0&&g<_.length?lq(g):void 0,...w,placeholder:""}),c.jsx("span",{className:Qt("picker-search-hint"),children:k||(m?s("delete.deleting"):a?s("common.loading"):N?s("delete.selected",{count:x.size}):y?s("delete.matches",{count:_.length}):"")})]}),c.jsx("div",{className:Qt("picker-sep")}),c.jsxs("div",{id:yE,role:"listbox","aria-multiselectable":"true",className:Qt("picker-list",M?"picker-keyboard-only":void 0),ref:S,children:[a&&c.jsx("div",{className:Qt("picker-empty"),children:s("common.loading")}),!a&&l&&c.jsx("div",{className:Qt("picker-empty"),children:l.message}),!a&&!l&&_.length===0&&c.jsx("div",{className:Qt("picker-empty"),children:y?s("delete.noMatch",{query:y}):s("delete.none")}),!a&&_.map((B,$)=>{const P=B.sessionId===h,K=x.has(B.sessionId);return c.jsx(Rj,{session:B,optionId:lq($),active:$===g,ariaSelected:K,current:!1,disabled:P,leading:c.jsx("span",{className:Qt("picker-item-checkbox",K?"picker-item-checkbox-checked":void 0),children:K?"[x] ":"[ ] "}),trailing:P?c.jsx("span",{className:Qt("picker-item-badge"),children:s("resume.current")}):void 0,onClick:()=>{b($),P||A(B.sessionId)},onActivate:()=>b($)},B.sessionId)})]}),c.jsx("div",{className:Qt("picker-sep")}),c.jsxs("div",{className:Qt("dialog-footer-actions"),children:[c.jsx("button",{type:"button",className:Qt("dialog-inline-button"),onClick:n,disabled:m,children:s("common.cancel")}),c.jsx("button",{type:"button",className:Qt("dialog-danger-button"),onClick:L,disabled:!O,children:s(m?"delete.deleting":"delete.action")})]})]})}const vE="release-session-list",cq=e=>`${vE}-opt-${e}`;function apt({onReleased:e,onError:t,onClose:n,workspaceCwd:r}){const{t:s}=gt(),i=il(),{sessions:o,loading:a,error:l,releaseSession:u}=ix(r,{autoLoad:!0}),d=i.sessionId,[h,m]=f.useState(!1),[p,g]=f.useState(-1),[b,x]=f.useState(null),{filterValue:v,inputProps:y}=M3(()=>{g(-1),x(null)}),[w,k]=f.useState(null),T=f.useRef(null),S=f.useRef(null);f.useEffect(()=>{l&&k(l.message)},[l]);const C=v?o.filter(B=>{const $=v.toLowerCase();return(B.displayName||"").toLowerCase().includes($)||B.sessionId.toLowerCase().includes($)}):o,_=B=>{const $=C[B];if(!$)return;const P=$.sessionId===d,K=($.clientCount??0)>0||$.hasActivePrompt===!0;P||!K||(g(B),x($.sessionId))};f.useEffect(()=>{p>=C.length&&C.length>0&&g(C.length-1)},[C.length,p]),f.useEffect(()=>{var $;const B=($=T.current)==null?void 0:$.children[p];B==null||B.scrollIntoView({block:"nearest"})},[p]),f.useEffect(()=>{var B;(B=S.current)==null||B.focus()},[]);const{keyboardMode:A}=Nf({itemCount:C.length,activeIndex:p,onActiveIndexChange:g,onConfirm:_}),M=f.useCallback(B=>{const $=B??C.find(K=>K.sessionId===b)??void 0;if(!$||h)return;if(!(($.clientCount??0)>0||$.hasActivePrompt===!0)){k(s("release.inactive"));return}if($.sessionId===d){k(s("release.cannotCurrent"));return}u&&(m(!0),u($.sessionId).then(()=>{e($.sessionId),n()}).catch(K=>{t(K),m(!1)}))},[d,h,C,n,t,e,u,b,s]),L=C.find(B=>B.sessionId===b)??void 0,N=L&&((L.clientCount??0)>0||L.hasActivePrompt===!0),O=!h&&!a&&!!L&&L.sessionId!==d&&!!N;return c.jsxs("div",{className:Qt("picker","picker-in-shell"),children:[c.jsxs("div",{className:Qt("picker-search"),children:[c.jsxs("span",{className:Qt("picker-search-label"),children:[s("resume.search"),":"," "]}),c.jsx("input",{ref:S,className:Qt("picker-search-input"),"aria-label":s("resume.search"),role:"combobox","aria-autocomplete":"list","aria-expanded":"true","aria-controls":vE,"aria-activedescendant":p>=0&&p<C.length?cq(p):void 0,...y,placeholder:""}),c.jsx("span",{className:Qt("picker-search-hint"),children:w||(h?s("release.releasing"):a?s("common.loading"):v?s("release.matches",{count:C.length}):"")})]}),c.jsx("div",{className:Qt("picker-sep")}),c.jsxs("div",{id:vE,role:"listbox",className:Qt("picker-list",A?"picker-keyboard-only":void 0),ref:T,children:[a&&c.jsx("div",{className:Qt("picker-empty"),children:s("common.loading")}),!a&&C.length===0&&c.jsx("div",{className:Qt("picker-empty"),children:v?s("release.noMatch",{query:v}):s("release.none")}),!a&&C.map((B,$)=>{const P=B.sessionId===d,K=(B.clientCount??0)>0||B.hasActivePrompt===!0,F=P||!K;return c.jsx(Rj,{session:B,optionId:cq($),active:$===p,confirmed:B.sessionId===b,ariaSelected:B.sessionId===b,current:!1,disabled:F,trailing:P?c.jsx("span",{className:Qt("picker-item-badge"),children:s("resume.current")}):K?void 0:c.jsx("span",{className:Qt("picker-item-badge"),children:s("release.inactiveBadge")}),onClick:()=>_($),onActivate:()=>g($)},B.sessionId)})]}),c.jsx("div",{className:Qt("picker-sep")}),c.jsxs("div",{className:Qt("dialog-footer-actions"),children:[c.jsx("button",{type:"button",className:Qt("dialog-inline-button"),onClick:n,disabled:h,children:s("common.cancel")}),c.jsx("button",{type:"button",className:Qt("dialog-danger-button"),onClick:()=>M(),disabled:!O,children:s(h?"release.releasing":"release.action")})]})]})}const lpt="_root_ieg2d_1",cpt="_list_ieg2d_8",upt="_item_ieg2d_21",dpt="_itemCursor_ieg2d_42",hpt="_itemSelected_ieg2d_49",fpt="_prompt_ieg2d_61",mpt="_keyboardOnly_ieg2d_68",ppt="_itemDisabled_ieg2d_77",gpt="_turn_ieg2d_91",bpt="_time_ieg2d_96",ypt="_footer_ieg2d_102",vpt="_footerMessage_ieg2d_112",xpt="_dangerButton_ieg2d_118",Ra={root:lpt,list:cpt,item:upt,itemCursor:dpt,itemSelected:hpt,prompt:fpt,keyboardOnly:mpt,itemDisabled:ppt,turn:gpt,time:bpt,footer:ypt,footerMessage:vpt,dangerButton:xpt},wpt="rewind-snapshot-list",uq=e=>`${wpt}-opt-${e}`;function kpt(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 _pt(e){const t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString():e}function Spt({blocks:e,loadSnapshots:t,rewind:n,onError:r,onClose:s}){const{t:i}=gt(),[o,a]=f.useState([]),[l,u]=f.useState(!0),[d,h]=f.useState(null),[m,p]=f.useState(0),[g,b]=f.useState(null),[x,v]=f.useState(null);f.useEffect(()=>{let _=!0;return u(!0),t().then(A=>{_&&a(A.snapshots)}).catch(A=>{_&&r(A)}).finally(()=>{_&&u(!1)}),()=>{_=!1}},[t,r]);const y=f.useMemo(()=>o.map(_=>({snapshot:_,promptText:kpt(e,_.turnIndex)})).sort((_,A)=>_.snapshot.turnIndex-A.snapshot.turnIndex),[e,o]);f.useEffect(()=>{m>=y.length&&y.length>0&&p(y.length-1)},[y.length,m]);const w=f.useRef(null),k=d!==null,T=_=>{!_||d||(h(_),v(null),n(_).then(()=>{s()}).catch(A=>{r(A),v(i("rewind.failed",{reason:A instanceof Error?A.message:String(A)})),h(null)}))},S=_=>{const A=y[_];A&&(p(_),b(A.snapshot.promptId))},{keyboardMode:C}=Nf({itemCount:y.length,activeIndex:m,onActiveIndexChange:p,onConfirm:S,enabled:!k});return f.useEffect(()=>{var A;const _=(A=w.current)==null?void 0:A.children[m];_==null||_.scrollIntoView({block:"nearest"})},[m]),f.useEffect(()=>{var A;if(l||y.length===0)return;const _=document.activeElement;(_==null?void 0:_.getAttribute("role"))==="dialog"&&((A=w.current)==null||A.focus())},[l,y.length]),l?c.jsx("div",{className:Qt("picker-empty"),children:i("rewind.loading")}):y.length===0?c.jsx("div",{className:Qt("picker-empty"),children:i("rewind.empty")}):c.jsxs("div",{className:Ra.root,children:[c.jsx("div",{className:`${Ra.list} ${C?Ra.keyboardOnly:""}`,ref:w,role:"listbox","aria-label":i("rewind.title"),tabIndex:0,"aria-activedescendant":y.length>0?uq(m):void 0,children:y.map(({snapshot:_,promptText:A},M)=>{const L=M===m,N=g===_.promptId,O=A||i("rewind.promptFallback",{id:_.promptId.slice(-8)});return c.jsxs("div",{id:uq(M),role:"option","aria-selected":N,"aria-disabled":k||void 0,className:`${Ra.item} ${L?Ra.itemCursor:""} ${N?Ra.itemSelected:""} ${k?Ra.itemDisabled:""}`,onClick:()=>{k||S(M)},onMouseMove:()=>p(M),children:[c.jsxs("div",{className:Ra.prompt,title:O,children:[c.jsxs("span",{className:Ra.turn,children:["#",_.turnIndex+1]})," ",O]}),c.jsx("div",{className:Ra.time,children:_pt(_.timestamp)})]},_.promptId)})}),c.jsxs("div",{className:Ra.footer,children:[x&&c.jsx("span",{className:Ra.footerMessage,role:"alert",children:x}),c.jsx("button",{type:"button",className:Qt("dialog-inline-button"),onClick:s,disabled:d!==null,children:i("common.cancel")}),c.jsx("button",{type:"button",className:`${Qt("dialog-danger-button")} ${Ra.dangerButton}`,onClick:()=>T(g),disabled:!g||d!==null,children:i(d?"rewind.rewinding":"rewind.confirm")})]})]})}const CT="add-workspace-hint",dq="add-workspace-error";function Cpt({onClose:e,onAdd:t}){const{t:n}=gt(),[r,s]=f.useState(""),[i,o]=f.useState(null),[a,l]=f.useState(!1),[u,d]=f.useState(!0),h=f.useRef(null);f.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]);const m=f.useCallback(async p=>{p.preventDefault();const g=r.trim();if(g){if(!g.startsWith("/")&&!/^[A-Za-z]:[\\//]/.test(g)){o(n("sidebar.addWorkspaceAbsError"));return}o(null),l(!0);try{await t(g,u),e()}catch(b){o(b instanceof Error?b.message:n("sidebar.addWorkspaceError"))}finally{l(!1)}}},[r,u,t,e,n]);return c.jsx(Qs,{title:n("sidebar.addWorkspaceTitle"),size:"md",onClose:e,children:c.jsxs("form",{className:"flex flex-col gap-6",onSubmit:m,children:[c.jsxs(Bj,{children:[c.jsxs(eg,{"data-invalid":i?!0:void 0,children:[c.jsx(by,{htmlFor:"add-workspace-path",children:n("sidebar.addWorkspacePath")}),c.jsx(ga,{ref:h,id:"add-workspace-path",type:"text",placeholder:"/absolute/path/to/project",value:r,onChange:p=>{s(p.target.value),i&&o(null)},disabled:a,autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,"aria-describedby":i?`${dq} ${CT}`:CT,"aria-invalid":i?!0:void 0}),c.jsx(gE,{id:CT,children:n("sidebar.addWorkspaceHint")}),i&&c.jsx(bmt,{id:dq,children:i})]}),c.jsxs(eg,{orientation:"horizontal",children:[c.jsxs(Zse,{children:[c.jsx(by,{htmlFor:"add-workspace-persist",children:n("sidebar.addWorkspacePersist")}),c.jsx(gE,{children:n("sidebar.addWorkspacePersistHint")})]}),c.jsx(eie,{id:"add-workspace-persist",checked:u,onCheckedChange:d,disabled:a})]})]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(Fr,{type:"button",variant:"outline",onClick:e,disabled:a,children:n("sidebar.addWorkspaceCancel")}),c.jsx(Fr,{type:"submit",disabled:a||!r.trim(),children:n(a?"sidebar.addWorkspaceAdding":"sidebar.addWorkspaceRegister")})]})]})})}const sie="qwen-code-web-shell-collapsed-session-groups",ax="ws:";function hq(e){return!e.startsWith(ax)}function Tpt(e,t){return`${ax}${e}|group:${t}`}function iie(e){return`${ax}${e}|ungrouped`}function Apt(e,t){return t.startsWith(`${ax}${e}|`)}function $j(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(sie);if(!e)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(n=>typeof n=="string"&&n.trim().length>0)):new Set}catch{return new Set}}function Ept(e){try{window.localStorage.setItem(sie,JSON.stringify(Array.from(e).sort()))}catch{}}function oie(e,t){const n=$j(),r=new Set(Array.from(n).filter(s=>!t(s)));for(const s of e)r.add(s);Ept(r)}function Mpt(e){const t=$j(),n=new Set,r=`${ax}${e}|group:`,s=iie(e);for(const i of t)i===s?n.add("ungrouped"):i.startsWith(r)&&n.add(i.slice(r.length));return n}function Npt(e,t){const n=new Set;for(const r of t)n.add(r==="ungrouped"?iie(e):Tpt(e,r));oie(n,r=>Apt(e,r))}const jpt="_sidebar_m4krq_1",Ipt="_resizing_m4krq_20",Rpt="_collapsed_m4krq_24",Dpt="_newChatButton_m4krq_30",Lpt="_pluginButton_m4krq_31",Ppt="_footerButton_m4krq_32",Opt="_collapseButton_m4krq_33",Bpt="_projectRow_m4krq_34",$pt="_sessionRow_m4krq_35",zpt="_sessionGroupHeader_m4krq_36",Fpt="_sessionGroupActionButton_m4krq_37",qpt="_retry_m4krq_38",Hpt="_iconButton_m4krq_39",Upt="_projectIconButton_m4krq_40",Vpt="_sessionActionButton_m4krq_41",Wpt="_groupMenuItem_m4krq_42",Gpt="_secondaryButton_m4krq_43",Kpt="_dangerButton_m4krq_44",Ypt="_primaryNav_m4krq_80",Xpt="_navIcon_m4krq_129",Qpt="_topRow_m4krq_155",Jpt="_brandLogo_m4krq_170",Zpt="_brandName_m4krq_186",e0t="_workspacePicker_m4krq_206",t0t="_workspacePickerLabel_m4krq_213",n0t="_workspacePickerHeader_m4krq_220",r0t="_workspaceAddIconButton_m4krq_227",s0t="_workspaceList_m4krq_247",i0t="_workspaceSessionBody_m4krq_253",o0t="_projectsHeader_m4krq_257",a0t="_pinnedSessionList_m4krq_267",l0t="_projectsHeaderToggle_m4krq_275",c0t="_projectsHeaderAction_m4krq_276",u0t="_projectsHeaderActions_m4krq_284",d0t="_projectSearch_m4krq_335",h0t="_addWorkspaceButton_m4krq_357",f0t="_body_m4krq_377",m0t="_sectionTitle_m4krq_387",p0t="_projectRowExpanded_m4krq_402",g0t="_workspaceHeaderActions_m4krq_428",b0t="_workspaceHeaderAction_m4krq_428",y0t="_projectName_m4krq_471",v0t="_sessionText_m4krq_472",x0t="_projectHoverAction_m4krq_487",w0t="_sessionList_m4krq_496",k0t="_sessionGroupSection_m4krq_511",_0t="_sessionGroupHeaderRow_m4krq_517",S0t="_sessionGroupDot_m4krq_553",C0t="_sessionGroupDotMuted_m4krq_560",T0t="_sessionGroupTitle_m4krq_564",A0t="_sessionGroupCount_m4krq_571",E0t="_sessionGroupChevron_m4krq_576",M0t="_sessionGroupHeaderActions_m4krq_597",N0t="_sessionGroupList_m4krq_627",j0t="_currentSession_m4krq_645",I0t="_busySession_m4krq_650",R0t="_floatingTooltip_m4krq_655",D0t="_tooltipContent_m4krq_685",L0t="_tooltipTitle_m4krq_691",P0t="_tooltipTags_m4krq_698",O0t="_tooltipTag_m4krq_698",B0t="_tooltipTagRunning_m4krq_718",$0t="_tooltipTagNew_m4krq_723",z0t="_tooltipMeta_m4krq_728",F0t="_sessionStatusSlot_m4krq_743",q0t="_sessionStatusDot_m4krq_755",H0t="_sidebarPulse_m4krq_1",U0t="_sessionTitlePin_m4krq_765",V0t="_sessionMetaSlot_m4krq_797",W0t="_sessionAttention_m4krq_807",G0t="_sessionAttentionUserInput_m4krq_821",K0t="_sessionLoading_m4krq_826",Y0t="_sessionTime_m4krq_836",X0t="_sidebarSpin_m4krq_1",Q0t="_runningSession_m4krq_855",J0t="_sessionActions_m4krq_871",Z0t="_activeSessionActionButton_m4krq_937",egt="_searchInput_m4krq_956",tgt="_renameInput_m4krq_970",ngt="_dialogSelect_m4krq_976",rgt="_dialogInput_m4krq_986",sgt="_groupMenu_m4krq_42",igt="_groupMenuItemActive_m4krq_1028",ogt="_groupMenuName_m4krq_1034",agt="_groupMenuDot_m4krq_1042",lgt="_groupMenuEmptyDot_m4krq_1043",cgt="_groupMenuIcon_m4krq_1044",ugt="_groupMenuCheck_m4krq_1072",dgt="_groupMenuSeparator_m4krq_1079",hgt="_groupColorRed_m4krq_1085",fgt="_groupColorOrange_m4krq_1089",mgt="_groupColorYellow_m4krq_1093",pgt="_groupColorGreen_m4krq_1097",ggt="_groupColorBlue_m4krq_1101",bgt="_groupColorPurple_m4krq_1105",ygt="_groupColorCustom_m4krq_1109",vgt="_renameForm_m4krq_1119",xgt="_notice_m4krq_1135",wgt="_confirmContent_m4krq_1150",kgt="_confirmDescription_m4krq_1156",_gt="_workspaceRemovalActivityList_m4krq_1163",Sgt="_confirmActions_m4krq_1171",Cgt="_groupForm_m4krq_1177",Tgt="_fieldStack_m4krq_1184",Agt="_groupCustomColorRow_m4krq_1212",Egt="_groupColorPicker_m4krq_1219",Mgt="_groupHexField_m4krq_1229",Ngt="_groupColorError_m4krq_1239",jgt="_footer_m4krq_32",Igt="_footerPrimary_m4krq_1294",Rgt="_footerActions_m4krq_1295",Dgt="_footerButtonLabel_m4krq_1311",Lgt="_footerCompact_m4krq_1318",Pgt="_footerTight_m4krq_1319",Ogt="_version_m4krq_1354",Bgt="_resizeHandle_m4krq_1397",$gt="_sessionActionButtonActive_m4krq_1425",zgt="_menuActive_m4krq_1431",Fgt="_actionMenu_m4krq_1435",qgt="_actionMenuItem_m4krq_1452",Hgt="_actionMenuItemDanger_m4krq_1483",Ugt="_actionMenuIcon_m4krq_1493",Vgt="_actionMenuLabel_m4krq_1512",Wgt="_archivedSection_m4krq_1520",Ggt="_archivedHeader_m4krq_1527",Kgt="_archivedChevron_m4krq_1553",Ygt="_archivedTitle_m4krq_1572",Xgt="_archivedCount_m4krq_1581",Qgt="_archivedList_m4krq_1596",Jgt="_archivedRow_m4krq_1603",Zgt="_mobileOpen_m4krq_1612",Se={sidebar:jpt,resizing:Ipt,collapsed:Rpt,newChatButton:Dpt,pluginButton:Lpt,footerButton:Ppt,collapseButton:Opt,projectRow:Bpt,sessionRow:$pt,sessionGroupHeader:zpt,sessionGroupActionButton:Fpt,retry:qpt,iconButton:Hpt,projectIconButton:Upt,sessionActionButton:Vpt,groupMenuItem:Wpt,secondaryButton:Gpt,dangerButton:Kpt,primaryNav:Ypt,navIcon:Xpt,topRow:Qpt,brandLogo:Jpt,brandName:Zpt,workspacePicker:e0t,workspacePickerLabel:t0t,workspacePickerHeader:n0t,workspaceAddIconButton:r0t,workspaceList:s0t,workspaceSessionBody:i0t,projectsHeader:o0t,pinnedSessionList:a0t,projectsHeaderToggle:l0t,projectsHeaderAction:c0t,projectsHeaderActions:u0t,projectSearch:d0t,addWorkspaceButton:h0t,body:f0t,sectionTitle:m0t,projectRowExpanded:p0t,workspaceHeaderActions:g0t,workspaceHeaderAction:b0t,projectName:y0t,sessionText:v0t,projectHoverAction:x0t,sessionList:w0t,sessionGroupSection:k0t,sessionGroupHeaderRow:_0t,sessionGroupDot:S0t,sessionGroupDotMuted:C0t,sessionGroupTitle:T0t,sessionGroupCount:A0t,sessionGroupChevron:E0t,sessionGroupHeaderActions:M0t,sessionGroupList:N0t,currentSession:j0t,busySession:I0t,floatingTooltip:R0t,tooltipContent:D0t,tooltipTitle:L0t,tooltipTags:P0t,tooltipTag:O0t,tooltipTagRunning:B0t,tooltipTagNew:$0t,tooltipMeta:z0t,sessionStatusSlot:F0t,sessionStatusDot:q0t,sidebarPulse:H0t,sessionTitlePin:U0t,sessionMetaSlot:V0t,sessionAttention:W0t,sessionAttentionUserInput:G0t,sessionLoading:K0t,sessionTime:Y0t,sidebarSpin:X0t,runningSession:Q0t,sessionActions:J0t,activeSessionActionButton:Z0t,searchInput:egt,renameInput:tgt,dialogSelect:ngt,dialogInput:rgt,groupMenu:sgt,groupMenuItemActive:igt,groupMenuName:ogt,groupMenuDot:agt,groupMenuEmptyDot:lgt,groupMenuIcon:cgt,groupMenuCheck:ugt,groupMenuSeparator:dgt,groupColorRed:hgt,groupColorOrange:fgt,groupColorYellow:mgt,groupColorGreen:pgt,groupColorBlue:ggt,groupColorPurple:bgt,groupColorCustom:ygt,renameForm:vgt,notice:xgt,confirmContent:wgt,confirmDescription:kgt,workspaceRemovalActivityList:_gt,confirmActions:Sgt,groupForm:Cgt,fieldStack:Tgt,groupCustomColorRow:Agt,groupColorPicker:Egt,groupHexField:Mgt,groupColorError:Ngt,footer:jgt,footerPrimary:Igt,footerActions:Rgt,footerButtonLabel:Dgt,footerCompact:Lgt,footerTight:Pgt,version:Ogt,resizeHandle:Bgt,sessionActionButtonActive:$gt,menuActive:zgt,actionMenu:Fgt,actionMenuItem:qgt,actionMenuItemDanger:Hgt,actionMenuIcon:Ugt,actionMenuLabel:Vgt,archivedSection:Wgt,archivedHeader:Ggt,archivedChevron:Kgt,archivedTitle:Ygt,archivedCount:Xgt,archivedList:Qgt,archivedRow:Jgt,mobileOpen:Zgt};function xE({label:e,count:t,expanded:n,color:r,children:s,onToggle:i,onRename:o,onDelete:a,renameLabel:l,deleteLabel:u,actionsDisabled:d}){const h=r!=null&&r.startsWith("#")?Se.groupColorCustom:r?Se[`groupColor${r[0].toUpperCase()}${r.slice(1)}`]:Se.sessionGroupDotMuted,m=r!=null&&r.startsWith("#")?{"--session-group-custom-color":r}:void 0;return c.jsxs("section",{className:Se.sessionGroupSection,"aria-label":e,children:[c.jsxs("div",{className:Se.sessionGroupHeaderRow,children:[c.jsxs("button",{type:"button",className:Se.sessionGroupHeader,"aria-expanded":n,onClick:i,children:[c.jsx("span",{className:`${Se.sessionGroupDot} ${h}`,style:m,"aria-hidden":"true"}),c.jsx("span",{className:Se.sessionGroupTitle,children:e}),c.jsxs("span",{className:Se.sessionGroupCount,children:["· ",t]}),c.jsx("span",{className:Se.sessionGroupChevron,"aria-hidden":"true",children:n?c.jsx(vl,{}):c.jsx(Y4,{})})]}),(o||a)&&c.jsxs("div",{className:Se.sessionGroupHeaderActions,children:[o&&c.jsx("button",{className:Se.sessionGroupActionButton,type:"button",title:l,"aria-label":l,disabled:d,onClick:o,children:c.jsx(CW,{})}),a&&c.jsx("button",{className:Se.sessionGroupActionButton,type:"button",title:u,"aria-label":u,disabled:d,onClick:a,children:c.jsx(Qb,{})})]})]}),n&&c.jsx("div",{className:Se.sessionGroupList,children:s})]})}const e1t="_section_1sdfq_1",t1t="_headerRow_1sdfq_6",n1t="_header_1sdfq_6",r1t="_headerDisabled_1sdfq_34",s1t="_headerContent_1sdfq_42",i1t="_chevron_1sdfq_50",o1t="_folderIcon_1sdfq_55",a1t="_chevronOpen_1sdfq_59",l1t="_name_1sdfq_63",c1t="_badge_1sdfq_71",u1t="_sessions_1sdfq_81",d1t="_empty_1sdfq_88",h1t="_error_1sdfq_94",f1t="_sessionItemReadOnly_1sdfq_100",m1t="_sessionName_1sdfq_111",p1t="_sessionTime_1sdfq_118",Oi={section:e1t,headerRow:t1t,header:n1t,headerDisabled:r1t,headerContent:s1t,chevron:i1t,folderIcon:o1t,chevronOpen:a1t,name:l1t,badge:c1t,sessions:u1t,empty:d1t,error:h1t,sessionItemReadOnly:f1t,sessionName:m1t,sessionTime:p1t};function fq(...e){return e.filter(Boolean).join(" ")}function g1t(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function b1t(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function y1t({open:e}){const t=e?Efe:jk;return c.jsx(t,{className:Oi.folderIcon,size:16,strokeWidth:1.2,"aria-hidden":"true"})}function v1t({workspace:e,renderHeader:t,client:n,reloadToken:r,primaryLabel:s,untrustedLabel:i,readOnlyLabel:o,trustToOpenLabel:a,noSessionsLabel:l,loadErrorLabel:u,organizationEnabled:d,ungroupedLabel:h,formatTime:m,searchQuery:p="",expanded:g,autoExpandKey:b,onExpandedChange:x,renderSessions:v=!0,renderSession:y,headerActions:w,onRenameGroup:k,onDeleteGroup:T,renameGroupLabel:S,deleteGroupLabel:C,groupActionsDisabled:_,excludePinned:A=!1}){const[M,L]=f.useState([]),[N,O]=f.useState([]),[B,$]=f.useState(!1),[P,K]=f.useState(!1),[F,H]=f.useState(()=>Mpt(e.id)),[D,Q]=f.useState(!1),U=g??P,j=!e.primary&&!e.trusted,ie=e.primary&&!e.trusted;f.useEffect(()=>{g===void 0&&K(!1)},[g,e.id]),f.useEffect(()=>{Npt(e.id,F)},[F,e.id]),f.useEffect(()=>{g===void 0&&b&&K(!0)},[b,g]);const oe=f.useCallback(async()=>{if(!ie)try{const se=await n.workspaceByCwd(e.cwd).listWorkspaceSessions({pageSize:Ou,archiveState:"active",...d?{view:"organized",group:"all"}:{}});L(se),$(!1)}catch(se){console.warn("[WorkspaceSection] session poll failed:",se),$(!0)}},[n,ie,d,e.cwd]);f.useEffect(()=>{if(!v||ie||!d){O([]);return}let se=!1;return n.workspaceByCwd(e.cwd).listSessionGroups().then(Z=>{se||O(Z.groups)}).catch(Z=>{console.warn("[WorkspaceSection] group catalog load failed:",Z)}),()=>{se=!0}},[n,ie,d,r,v,e.cwd]),f.useEffect(()=>{if(!v||!U&&!p.trim()||(oe(),j))return;const se=setInterval(()=>void oe(),1e4);return()=>clearInterval(se)},[U,oe,j,r,v,p]);const J=f.useMemo(()=>{const se=p.trim().toLowerCase();return M.filter(Z=>A&&Z.isPinned?!1:se?(Z.displayName||"").toLowerCase().includes(se)||Z.sessionId.toLowerCase().includes(se):!0)},[A,p,M]),V=f.useMemo(()=>{if(!d||N.length===0)return null;const se=new Set;return{sections:N.map(X=>{const te=J.filter(ae=>ae.groupId===X.id);return te.forEach(ae=>se.add(ae.sessionId)),{group:X,sessions:te}}),ungrouped:J.filter(X=>!se.has(X.sessionId))}},[N,d,J]);return c.jsxs("div",{className:Oi.section,children:[c.jsxs("div",{className:fq(Oi.headerRow,ie&&Oi.headerDisabled),onMouseEnter:()=>Q(!0),onMouseLeave:()=>Q(!1),onFocus:()=>Q(!0),onBlur:se=>{se.currentTarget.contains(se.relatedTarget)||Q(!1)},children:[c.jsx("button",{className:Oi.header,type:"button",disabled:ie,"aria-expanded":U,onClick:()=>{const se=!U;K(se),x==null||x(se)},children:t?t(U):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:fq(Oi.chevron,U&&Oi.chevronOpen),children:c.jsx(y1t,{open:U})}),c.jsxs("span",{className:Oi.headerContent,children:[c.jsx("span",{className:Oi.name,children:g1t(e.cwd)}),e.primary&&s&&c.jsx("span",{className:Oi.badge,children:s})]}),!e.trusted&&c.jsx("span",{className:Oi.badge,children:i}),j&&c.jsx("span",{className:Oi.badge,children:o})]})}),w==null?void 0:w(D)]}),v&&(U||!!p.trim())&&!ie&&c.jsx("div",{className:Oi.sessions,children:B?c.jsx("div",{className:Oi.error,role:"status",children:u}):J.length===0?c.jsx("div",{className:Oi.empty,children:l}):V?c.jsxs(c.Fragment,{children:[V.sections.map(({group:se,sessions:Z})=>c.jsx(xE,{id:`group:${se.id}`,label:se.name,count:Z.length,color:se.color,expanded:!F.has(se.id),onToggle:()=>{H(X=>{const te=new Set(X);return te.has(se.id)?te.delete(se.id):te.add(se.id),te})},onRename:k?()=>k(se,e.cwd):void 0,onDelete:T?()=>T(se,e.cwd):void 0,renameLabel:S,deleteLabel:C,actionsDisabled:_,children:Z.map(X=>y(X))},se.id)),V.ungrouped.length>0&&c.jsx(xE,{id:"ungrouped",label:h,count:V.ungrouped.length,expanded:!F.has("ungrouped"),onToggle:()=>{H(se=>{const Z=new Set(se);return Z.has("ungrouped")?Z.delete("ungrouped"):Z.add("ungrouped"),Z})},children:V.ungrouped.map(se=>y(se))})]}):J.map(se=>{if(!j)return y(se);const Z=b1t(se),X=se.createdAt?m(se.createdAt):"";return c.jsxs("div",{className:Oi.sessionItemReadOnly,role:"note","aria-label":`${Z}${X?`, ${X}`:""}. ${a}`,children:[c.jsx("span",{className:Oi.sessionName,children:Z}),X&&c.jsx("span",{className:Oi.sessionTime,children:X})]},se.sessionId)})})]})}const aie="qwen-code-web-shell-sidebar-width",ck=260,x1t=220,lie=420,w1t=344,k1t=250,cie=200,_1t=56,mq=cie-_1t,S1t=2e3,C1t=3e4,pq=96,T1t="recent",TT=240,Yp=8,AT="__custom__",Xp="#416ef5";function nm(e,t){return`${t??""}\0${e}`}const A1t=["settings","version","theme","scheduledTasks","sessionsOverview","splitView","daemonStatus","collapse"],Qp=["red","orange","yellow","green","blue","purple"];function Da(...e){return e.filter(Boolean).join(" ")}function gq(e){return e instanceof DOMException&&e.name==="AbortError"}function E1t(e){return e?e.split(/[\\/]+/).filter(Boolean).at(-1)??e:""}function o2(e){var n;return((n=e.displayName)==null?void 0:n.trim())||e.sessionId.slice(0,8)}function M1t(e){const t=o2(e).replace(/\s+/g," ").trim();return t.length<=pq?t:`${t.slice(0,pq-3).trimEnd()}...`}function N1t(e){if(!e.createdAt)return 0;const t=Date.parse(e.createdAt);return Number.isFinite(t)?t:0}function uk(e){return e[0]??"blue"}function wE(e){const t=e.trim();if(/^#[0-9a-f]{6}$/i.test(t))return t.toLowerCase()}function bq(e,t){const n=e.trim();return t.includes(n)?n:wE(n)}function yq(e){if(e.startsWith("#"))return Se.groupColorCustom;switch(e){case"red":return Se.groupColorRed;case"orange":return Se.groupColorOrange;case"yellow":return Se.groupColorYellow;case"green":return Se.groupColorGreen;case"blue":return Se.groupColorBlue;case"purple":return Se.groupColorPurple}}function j1t(e){return e.startsWith("#")?{backgroundColor:e}:void 0}function k4(e){return Math.min(lie,Math.max(x1t,e))}function I1t(e){return Math.min(lie,Math.max(cie,e))}function R1t(){if(typeof window>"u")return ck;try{const e=window.localStorage.getItem(aie),t=e?Number(e):ck;return Number.isFinite(t)?k4(t):ck}catch{return ck}}function vq(e){try{window.localStorage.setItem(aie,String(k4(e)))}catch{}}function D1t(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M12 5v14M5 12h14"})})}function L1t(){return c.jsx("svg",{viewBox:"0 0 141.38 140","aria-hidden":"true",children:c.jsx("path",{fill:"#6D44E8",d:"m140.93 85-16.35-28.33-1.93-3.34 8.66-15a3.323 3.323 0 0 0 0-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33 3.33 0 0 0-2.89-1.67H51.43c-.59 0-1.17.16-1.66.45-.5.29-.92.71-1.22 1.22L32.19 29.98l-1.92 3.33H12.96c-.59 0-1.17.16-1.66.45-.5.29-.93.71-1.22 1.22L.45 51.66a3.323 3.323 0 0 0 0 3.34l18.28 31.67-8.66 15a3.32 3.32 0 0 0 0 3.34l9.62 16.67c.3.51.72.93 1.22 1.22s1.07.45 1.67.45h36.56l8.66 15a3.35 3.35 0 0 0 2.89 1.67h19.25a3.34 3.34 0 0 0 2.89-1.67l18.28-31.67h17.32c.6 0 1.17-.16 1.67-.45s.92-.71 1.22-1.22l9.62-16.67a3.323 3.323 0 0 0 0-3.34ZM51.44 3.33 61.07 20l-9.63 16.66h76.98l-9.62 16.66H45.67l-11.54-20zM57.21 120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62 16.67L68.78 100l-11.55 20Zm61.59-33.34-9.62-16.67-38.49 66.67-9.63-16.67 9.63-16.66 26.94-46.67h23.1l17.32 30z"})})}function xq({expanded:e}){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:e?c.jsx("path",{d:"m6 9 6 6 6-6"}):c.jsx("path",{d:"m9 6 6 6-6 6"})})}function P1t({collapsed:e,onCollapsedChange:t,onOpenSettings:n,onOpenPlugins:r,onOpenDaemonStatus:s,onOpenScheduledTasks:i,onOpenSessions:o,canOpenSessionsOverview:a,onOpenSplitView:l,canOpenSplitView:u,onNewSession:d,onLoadSession:h,onSelectCurrentSession:m,onError:p,theme:g,onThemeChange:b,mobileOpen:x,sessionListReloadToken:v,selectedWorkspaceCwd:y,onSelectWorkspace:w,workspaces:k,lockedWorkspaceCwd:T,lockedWorkspace:S,branding:C,footer:_}){var Id,Rd,Cp,Bf,Tp,dl,Ap,x1,ri,Qo,w1,co,Dd,bu;const{t:A}=gt(),M=il(),L=Fg(),N=ko(),O=pd(),B=f.useMemo(()=>new Set(_===!1?[]:(_==null?void 0:_.items)??A1t),[_]),$=C!==!1&&!(x&&((C==null?void 0:C.hideWhenCompact)??!0)),P=!!((Rd=(Id=M.capabilities)==null?void 0:Id.features)!=null&&Rd.includes(Dj)),K=!!((Bf=(Cp=M.capabilities)==null?void 0:Cp.features)!=null&&Bf.includes("session_archive")),F=!!((dl=(Tp=M.capabilities)==null?void 0:Tp.features)!=null&&dl.includes("workspace_qualified_rest_core")),H=f.useMemo(()=>{var G;return k??((G=O.capabilities)==null?void 0:G.workspaces)??[]},[k,(Ap=O.capabilities)==null?void 0:Ap.workspaces]),D=((x1=H.find(G=>G.primary))==null?void 0:x1.cwd)??((ri=O.capabilities)==null?void 0:ri.workspaceCwd)??M.workspaceCwd,Q=T?H.find(G=>G.cwd===T):void 0,U=!T||(Q==null?void 0:Q.primary)===!0,{sessions:j,loading:ie,error:oe,data:J,reload:V,deleteSession:se,exportSession:Z,archiveSession:X}=Nk({autoLoad:!0,enabled:U,pageSize:Ou,archiveState:"active",...P?{view:"organized",group:"all"}:{}}),te=!P||!U||J!==void 0,{sessions:ae,reload:xe}=Nk({autoLoad:P,enabled:P&&U,pageSize:Ou,archiveState:"active",view:"organized",group:"pinned"}),[Ae,Ne]=f.useState(!1),[Le,ge]=f.useState(!0),[Oe,Nt]=f.useState([]),{sessions:Pe,loading:Ce,error:Zt,reload:dt,deleteSession:Ge,unarchiveSession:St}=Nk({autoLoad:!0,enabled:K&&Ae&&U,pageSize:Ou,archiveState:"archived",...P?{view:"organized",group:"all"}:{}}),[Y,je]=f.useState([]),[We,Te]=f.useState(!1),[jt,zt]=f.useState(!1),[bn,Pn]=f.useState(0),[qe,At]=f.useState([]),[he,Be]=f.useState([]),[Ie,Ke]=f.useState([]),[ne,De]=f.useState(!1),[Dt,ze]=f.useState(null),[Lt,ke]=f.useState(""),[Ot,fe]=f.useState(()=>new Set),pt=f.useRef(new Set),[He,on]=f.useState(()=>new Set),Ze=f.useRef(new Set),[Et,wn]=f.useState(!1),qr=f.useRef(!1),[cr,Jn]=f.useState(null),[Ft,dn]=f.useState(null),[sr,Rn]=f.useState(null),[Vn,Zn]=f.useState(""),[kn,er]=f.useState("blue"),[Ms,Ss]=f.useState(Xp),[Hr,rs]=f.useState(null),[Hs,Us]=f.useState(()=>new Set(Array.from($j()).filter(hq))),Ur=f.useRef(new Set),Ar=f.useRef(!0),[Un,or]=f.useState(!P),[Cs,Ls]=f.useState(P);Cs!==P&&(Ls(P),or(!P));const[be,st]=f.useState(R1t),[Ct,Bt]=f.useState(!1),[qt,tr]=f.useState(!0),[Lr,ss]=f.useState(!1),[Vr,$n]=f.useState(!1),[An,Er]=f.useState(null),[Pr,de]=f.useState(null),[Ee,rt]=f.useState(!1),yt=f.useRef(!1),wt=f.useRef(!1),[mn,we]=f.useState(!1),[Pt,yn]=f.useState(0),[zn,Xn]=f.useState(null),Hn=f.useCallback(()=>{yn(G=>G+1)},[]);f.useEffect(()=>(yt.current=!0,()=>{yt.current=!1,wt.current=!0}),[]);const[Mr,is]=f.useState(""),[ce,ve]=f.useState(!1),[Fe,ot]=f.useState(()=>new Set),_n=f.useRef(null),Yt=f.useRef(!1),On=f.useRef(null),Ye=f.useRef(null),Tn=f.useRef(!1),nn=f.useRef(null),ur=M.sessionId,Nr=!!((w1=(Qo=M.capabilities)==null?void 0:Qo.features)!=null&&w1.includes("workspace_runtime_removal")),ti=((Dd=(co=M.capabilities)==null?void 0:co.features)==null?void 0:Dd.includes("session_export"))??!1,dr=ur?nm(ur,M.workspaceCwd):null,Yo=E1t(M.workspaceCwd)||A("sidebar.projectFallback"),cs=f.useMemo(()=>{const G=H.length>0?H:[{id:"primary",cwd:M.workspaceCwd||Yo,primary:!0,trusted:!0}];return T?G.filter(_e=>_e.cwd===T):G},[M.workspaceCwd,T,Yo,H]),Ns=f.useMemo(()=>{const G=new Map;for(const _e of[...U?ae:[],...Oe])G.set(nm(_e.sessionId,_e.workspaceCwd||D),_e);return[...G.values()]},[U,D,ae,Oe]),$e=f.useCallback(G=>{const _e=cs.find(Re=>Re.cwd===G.workspaceCwd);return!_e||_e.primary?N:O.client.workspaceByCwd(_e.cwd)},[cs,O.client,N]),ht=f.useCallback(G=>{var _e;return!G||((_e=cs.find(Re=>Re.cwd===G))==null?void 0:_e.primary)!==!1},[cs]),Tt=f.useCallback(G=>nm(G.sessionId,G.workspaceCwd||D),[D]),xn=f.useCallback(G=>dr===Tt(G),[dr,Tt]),Sn=f.useCallback(G=>{const _e=cs.find(Re=>Re.cwd===G.workspaceCwd);return(_e==null?void 0:_e.trusted)===!1?!1:K&&((_e==null?void 0:_e.primary)!==!1||F)},[cs,K,F]);f.useEffect(()=>{if(!P){Nt([]);return}const G=cs.filter(Re=>!Re.primary&&Re.trusted);let _e=!1;return Promise.allSettled(G.map(async Re=>(await O.client.workspaceByCwd(Re.cwd).listWorkspaceSessions({pageSize:Ou,archiveState:"active",view:"organized",group:"pinned"})).map(vt=>({...vt,workspaceCwd:Re.cwd})))).then(Re=>{_e||Nt(Re.flatMap(Qe=>Qe.status==="fulfilled"?Qe.value:[]))}),()=>{_e=!0}},[cs,P,O.client,Pt]);const En=f.useMemo(()=>{const G=new Map;for(const _e of[...U?Pe:[],...Y])G.set(Tt(_e),_e);return[...G.values()]},[Pe,Tt,U,Y]),pr=U&&Ce||We,yr=U&&!!Zt||jt;f.useEffect(()=>{if(!Ae)return;if(!K||!F){je([]),Te(!1),zt(!1);return}const G=cs.filter(Re=>!Re.primary&&Re.trusted);if(G.length===0){je([]),Te(!1),zt(!1);return}let _e=!1;return Te(!0),Promise.allSettled(G.map(async Re=>(await O.client.workspaceByCwd(Re.cwd).listWorkspaceSessions({pageSize:Ou,archiveState:"archived",...P?{view:"organized",group:"all"}:{}})).map(vt=>({...vt,workspaceCwd:Re.cwd})))).then(Re=>{if(_e)return;const Qe=Re.filter(vt=>vt.status==="rejected");je(Re.flatMap(vt=>vt.status==="fulfilled"?vt.value:[])),zt(Qe.length>0);for(const vt of Qe)console.warn("[WebShellSidebar] archived session load failed:",vt.reason)}).finally(()=>{_e||Te(!1)}),()=>{_e=!0}},[Ae,cs,P,bn,K,O.client,F,Pt]);const ps=((bu=M.capabilities)==null?void 0:bu.qwenCodeVersion)||"",Gi=ps?/^\d/.test(ps)?`v${ps}`:ps:"",Ca=!e&&be<w1t,To=!e&&be<k1t,Ta={"--web-shell-sidebar-width":`${be}px`},fu=Et;f.useEffect(()=>{var Re;if(!ur)return;const G=cs.find(Qe=>Qe.cwd===M.workspaceCwd)??(cs.length===1&&((Re=cs[0])!=null&&Re.primary)?cs[0]:void 0);if(!G)return;const _e=`session:${ur}:${G.id}`;Ye.current!==_e&&(Ye.current=_e,tr(!0),G.primary?Bt(!0):Xn({id:G.id,key:_e}))},[M.workspaceCwd,ur,cs]),f.useEffect(()=>{if(ur||y!==void 0||!O.capabilities)return;const G=H.find(Re=>Re.cwd===M.workspaceCwd),_e=`new:${(G==null?void 0:G.id)??"primary"}`;if(Ye.current!==_e){if(Ye.current=_e,tr(!0),G&&!G.primary){Bt(!1),Xn({id:G.id,key:_e}),w==null||w(G.cwd);return}Bt(!0)}},[M.workspaceCwd,ur,w,y,O.capabilities,H]);const Or=f.useCallback((G,_e,Re)=>{const Qe=nm(G,Re||D),vt=new Set(pt.current);_e?vt.add(Qe):vt.delete(Qe),pt.current=vt,fe(vt)},[D]),Xo=f.useCallback(async()=>{if(!P){At([]),Ke([]),or(!0);return}try{const G=await N.listSessionGroups();At(G.groups),Be(G.groups),Ke(G.colorOptions),or(!0)}catch(G){p(G,A("sidebar.groupsLoadFailed"))}},[p,P,A,N]);f.useEffect(()=>{if(!P){At([]),Ke([]),or(!0);return}or(!1),Xo()},[P,Xo]),f.useEffect(()=>{if(!Ft)return;const G=Re=>{var Qe;(Qe=_n.current)!=null&&Qe.contains(Re.target)||dn(null)},_e=Re=>{Re.key==="Escape"&&dn(null)};return document.addEventListener("mousedown",G),document.addEventListener("keydown",_e),()=>{document.removeEventListener("mousedown",G),document.removeEventListener("keydown",_e)}},[Ft]),f.useEffect(()=>{if(!Ft)return;const G=window.requestAnimationFrame(()=>{var Qe;const _e=Array.from(((Qe=_n.current)==null?void 0:Qe.querySelectorAll("button:not(:disabled)"))??[]),Re=_e.find(vt=>vt.getAttribute("aria-checked")==="true")??_e[0];Re==null||Re.focus()});return()=>window.cancelAnimationFrame(G)},[Ft]);const Ad=f.useCallback(G=>{var Dn,Mn;const _e=Array.from(((Dn=_n.current)==null?void 0:Dn.querySelectorAll("button:not(:disabled)"))??[]);if(_e.length===0)return;const Re=_e.indexOf(document.activeElement),Qe=Re>=0?Re:-1;let vt;if(G.key==="ArrowDown")vt=(Qe+1)%_e.length;else if(G.key==="ArrowUp")vt=(Qe-1+_e.length)%_e.length;else if(G.key==="Home")vt=0;else if(G.key==="End")vt=_e.length-1;else if(G.key==="Escape"){G.preventDefault(),dn(null);return}vt!==void 0&&(G.preventDefault(),(Mn=_e[vt])==null||Mn.focus())},[]);f.useEffect(()=>()=>{var G;(G=nn.current)==null||G.call(nn,!1)},[]),f.useEffect(()=>{e&&(Bt(!1),ss(!1),is(""))},[e]);const Ed=f.useMemo(()=>j.some(G=>G.hasActivePrompt),[j]);f.useEffect(()=>{if(!Ct&&!Ed)return;const G=Ed&&!oe?S1t:C1t,_e=window.setInterval(()=>{document.hidden||Tn.current||(Tn.current=!0,V().finally(()=>{Tn.current=!1}))},G);return()=>window.clearInterval(_e)},[oe,Ed,Ct,V]);const mu=f.useRef(v);f.useEffect(()=>{v!==void 0&&v!==mu.current&&!document.hidden&&!Tn.current&&(mu.current=v,Tn.current=!0,V().finally(()=>{Tn.current=!1}))},[v,V]),f.useEffect(()=>{const G=new Map(j.map(Re=>[Tt(Re),!!Re.hasActivePrompt])),_e=On.current;On.current=G,_e!==null&&ot(Re=>{const Qe=new Set(Re);let vt=!1;for(const[Dn,Mn]of _e){const Br=G.get(Dn);Mn&&Br===!1&&Dn!==dr&&!Qe.has(Dn)&&(Qe.add(Dn),vt=!0)}for(const Dn of Qe)(Dn===dr||!G.has(Dn)||G.get(Dn))&&(Qe.delete(Dn),vt=!0);return vt?Qe:Re})},[dr,Tt,j]);const pu=f.useCallback(async(G,_e)=>{var Qe;const Re=await N.addWorkspace(G,{persist:_e});if(_e&&Re.persisted!==!0)throw new Error(A("sidebar.addWorkspacePersistenceError"));try{await((Qe=O.refreshCapabilities)==null?void 0:Qe.call(O))}catch{}},[A,N,O]),ql=f.useCallback(async G=>{var _e;if(yt.current){y===G.cwd&&(w==null||w(void 0)),yn(Re=>Re+1);try{await((_e=O.refreshCapabilities)==null?void 0:_e.call(O))}catch{}yt.current&&(Er(null),de(null),we(!1),V().catch(()=>{}),dt().catch(()=>{}))}},[w,V,dt,y,O]),jf=f.useCallback(G=>{Ee||(wt.current=!1,de(null),we(!1),Er(G))},[Ee]),ni=f.useCallback(async()=>{const G=An;if(!G||Ee)return;const _e=Pr!==null;if(!(_e&&M.sessionId&&M.workspaceCwd===G.cwd)){rt(!0);try{await N.removeWorkspace(G.id,{force:_e}),await ql(G)}catch(Re){if(!yt.current)return;if(Re instanceof ec){const Qe=Re.body;if(Re.status===409&&(Qe==null?void 0:Qe.code)==="workspace_busy"&&Qe.activity){de(Qe.activity);return}if(Re.status===400&&(Qe==null?void 0:Qe.code)==="workspace_mismatch"){await ql(G);return}if(Re.status===409&&((Qe==null?void 0:Qe.code)==="workspace_removal_in_progress"||(Qe==null?void 0:Qe.code)==="workspace_registration_in_progress")){we(!0);let vt=Re,Dn=!0;for(let Mn=0;Mn<20;Mn++){if(!yt.current||wt.current||(await new Promise(Br=>window.setTimeout(Br,250)),!yt.current||wt.current))return;try{await N.removeWorkspace(G.id,{force:_e}),await ql(G);return}catch(Br){if(!yt.current)return;if(vt=Br,Br instanceof ec){const Qr=Br.body;if(Br.status===400&&(Qr==null?void 0:Qr.code)==="workspace_mismatch"){await ql(G);return}if(Br.status===409&&(Qr==null?void 0:Qr.code)==="workspace_busy"&&Qr.activity){we(!1),de(Qr.activity);return}if(Br.status===409&&((Qr==null?void 0:Qr.code)==="workspace_removal_in_progress"||(Qr==null?void 0:Qr.code)==="workspace_registration_in_progress"))continue}Dn=!1;break}}if(!yt.current||wt.current)return;we(!1),p(Dn?new Error("Workspace removal remained in progress after retries."):vt,A("sidebar.removeWorkspaceError"));return}}p(Re,A("sidebar.removeWorkspaceError"))}finally{yt.current&&rt(!1)}}},[M.sessionId,M.workspaceCwd,p,ql,A,N,Pr,An,Ee]),Md=f.useCallback(G=>{qr.current||(qr.current=!0,wn(!0),(async()=>{try{await d(G)&&(V().catch(()=>{}),Hn())}catch(_e){gq(_e)||p(_e,A("sidebar.newSessionFailed"))}finally{qr.current=!1,wn(!1)}})())},[Hn,p,d,V,A]),cl=f.useCallback((G,_e)=>{const Re=nm(G,_e||D);if(Re===dr){m==null||m();return}pt.current.has(Re)||(ot(Qe=>{if(!Qe.has(Re))return Qe;const vt=new Set(Qe);return vt.delete(Re),vt}),Or(G,!0,_e),(async()=>{try{await h(G,_e)}catch(Qe){gq(Qe)||p(Qe,A("sidebar.switchFailed"))}finally{Or(G,!1,_e)}})())},[dr,p,h,m,D,Or,A]),If=f.useCallback(G=>{ze(G.sessionId),ke(o2(G))},[]),cc=f.useCallback(()=>{ze(null),ke("")},[]),c1=f.useCallback(()=>{const G=Lt.trim();if(!G||Dt!==ur){cc();return}const _e=Dt;pt.current.has(nm(_e,M.workspaceCwd))||(Or(_e,!0,M.workspaceCwd),L.renameSession(G).then(()=>{cc(),V(),Hn()}).catch(Re=>{p(Re,A("sidebar.renameFailed")),cc()}).finally(()=>{Or(_e,!1,M.workspaceCwd)}))},[L,Hn,cc,M.workspaceCwd,ur,Lt,Dt,p,V,Or,A]),Rf=f.useCallback(G=>{xn(G)||Jn(G)},[xn]),Df=f.useCallback((G,_e,Re)=>{const Qe=nm(G,Re||D),vt=new Set(Ze.current);_e?vt.add(Qe):vt.delete(Qe),Ze.current=vt,on(vt)},[D]),u1=f.useCallback(G=>{const _e=G.sessionId,Re=Tt(G);!ti||Ze.current.has(Re)||(Df(_e,!0,G.workspaceCwd),(async()=>{try{const Qe=await Z(_e,"html"),vt=new Blob([Qe.content],{type:Qe.mimeType||"text/html"}),Dn=URL.createObjectURL(vt);try{const Mn=document.createElement("a");Mn.href=Dn,Mn.download=Qe.filename,document.body.appendChild(Mn),Mn.click(),Mn.remove()}finally{URL.revokeObjectURL(Dn)}}catch(Qe){p(Qe,A("sidebar.exportFailed"))}finally{Df(_e,!1,G.workspaceCwd)}})())},[ti,Z,Tt,p,Df,A]),d1=f.useCallback(()=>{if(!cr)return;const G=cr.sessionId,_e=Tt(cr);if(xn(cr)){Jn(null);return}const Re=!!cr.isArchived;if(Jn(null),pt.current.has(_e))return;Or(G,!0,cr.workspaceCwd),(ht(cr.workspaceCwd)?Re?Ge:se:vt=>O.client.workspaceByCwd(cr.workspaceCwd).deleteSessionsData([vt]))(G).then(()=>{V(),dt(),Hn()}).catch(vt=>p(vt,A("sidebar.deleteFailed"))).finally(()=>{Or(G,!1,cr.workspaceCwd)})},[Hn,Ge,cr,se,Tt,xn,ht,p,V,dt,Or,A,O.client]),kp=f.useCallback(G=>{xn(G)&&If(G)},[xn,If]),L3=f.useCallback(()=>{dn(null),Zn(""),er(uk(Ie)),Ss(Xp),Rn({mode:"create"})},[Ie]),P3=f.useCallback(G=>{(async()=>{try{const _e=await O.client.workspaceByCwd(G).listSessionGroups();dn(null),Zn(""),er(uk(_e.colorOptions)),Ss(Xp),Rn({mode:"create",workspaceCwd:G})}catch(_e){p(_e,A("sidebar.groupsLoadFailed"))}})()},[p,A,O.client]),O3=f.useCallback(G=>{dn(null),Zn(""),er(uk(Ie)),Ss(Xp),Rn({mode:"create",targetSession:G,workspaceCwd:G.workspaceCwd})},[Ie]),Lf=f.useCallback((G,_e)=>{Zn(G.name),er(G.color),Ss(wE(G.color)??Xp),Rn({mode:"edit",group:G,workspaceCwd:_e})},[]),h1=f.useCallback(()=>{ne||(Rn(null),Zn(""),er(uk(Ie)),Ss(Xp))},[Ie,ne]),lx=f.useCallback(()=>{if(!sr)return;const G=Vn.trim(),_e=bq(kn,Ie.length>0?Ie:Qp);!G||!_e||(async()=>{De(!0);try{const Re=ht(sr.workspaceCwd)?N:O.client.workspaceByCwd(sr.workspaceCwd),Qe=sr.mode==="create"?await Re.createSessionGroup({name:G,color:_e}):await Re.updateSessionGroup(sr.group.id,{name:G,color:_e});if(sr.mode==="create"&&sr.targetSession)try{await Re.updateSessionOrganization(sr.targetSession.sessionId,{groupId:Qe.id,color:null}),sr.workspaceCwd||V().catch(()=>{}),Hn()}catch(vt){Rn(null),Zn(""),sr.workspaceCwd||Xo().catch(()=>{}),p(vt,A("sidebar.groupAssignFailedAfterCreate"));return}Rn(null),Zn(""),sr.workspaceCwd?Hn():Xo().catch(()=>{})}catch(Re){p(Re,sr.mode==="create"?A("sidebar.groupCreateFailed"):A("sidebar.groupUpdateFailed"))}finally{De(!1)}})()},[Hn,Ie,kn,sr,Vn,ht,p,V,Xo,A,N,O.client]),Pf=f.useCallback((G,_e)=>{rs({group:G,workspaceCwd:_e})},[]),xi=f.useCallback(()=>{if(!Hr)return;De(!0),(ht(Hr.workspaceCwd)?N:O.client.workspaceByCwd(Hr.workspaceCwd)).deleteSessionGroup(Hr.group.id).then(()=>{rs(null),Hr.workspaceCwd?Hn():V().catch(()=>{})}).catch(_e=>p(_e,A("sidebar.groupDeleteFailed"))).then(()=>Hr.workspaceCwd?void 0:Xo().catch(()=>{})).finally(()=>De(!1))},[Hr,ht,p,V,Xo,A,Hn,O.client,N]),f1=f.useCallback(G=>{const _e=G.sessionId,Re=Tt(G);if(!P||pt.current.has(Re))return;Or(_e,!0,G.workspaceCwd),$e(G).updateSessionOrganization(_e,{isPinned:!G.isPinned}).then(()=>{V().catch(()=>{}),xe().catch(()=>{}),Hn()}).catch(vt=>p(vt,A("sidebar.organizationFailed"))).finally(()=>{Or(_e,!1,G.workspaceCwd)})},[Hn,Tt,$e,p,P,V,xe,Or,A]),m1=f.useCallback(G=>{const _e=G.sessionId,Re=Tt(G);!Sn(G)||xn(G)||pt.current.has(Re)||(Or(_e,!0,G.workspaceCwd),(async()=>{try{if(ht(G.workspaceCwd))await X(_e);else{const vt=(await O.client.workspaceByCwd(G.workspaceCwd).archiveSessionsData([_e])).errors.find(Dn=>Dn.sessionId===_e);vt&&p(new Error(vt.error),A("sidebar.archiveFailed"))}}catch(Qe){p(Qe,A("sidebar.archiveFailed"))}finally{V().catch(()=>{}),dt().catch(()=>{}),Hn(),Or(_e,!1,G.workspaceCwd)}})())},[X,Hn,Sn,Tt,ht,xn,p,V,dt,Or,A,O.client]),cx=f.useCallback(G=>{const _e=G.sessionId,Re=Tt(G);Sn(G)&&(pt.current.has(Re)||(Or(_e,!0,G.workspaceCwd),(async()=>{try{if(ht(G.workspaceCwd))await St(_e);else{const vt=(await O.client.workspaceByCwd(G.workspaceCwd).unarchiveSessionsData([_e])).errors.find(Dn=>Dn.sessionId===_e);vt&&p(new Error(vt.error),A("sidebar.unarchiveFailed"))}}catch(Qe){p(Qe,A("sidebar.unarchiveFailed"))}finally{V().catch(()=>{}),dt().catch(()=>{}),Hn(),Or(_e,!1,G.workspaceCwd)}})()))},[Hn,Sn,Tt,ht,p,V,dt,Or,A,St,O.client]),p1=f.useCallback(async(G,_e)=>{let Re=0;try{const Ao=await $e(_e).listSessionGroups();Be(Ao.groups),Ke(Ao.colorOptions),Re=Ao.groups.length}catch(Ao){p(Ao,A("sidebar.groupsLoadFailed"));return}if(!G.isConnected)return;const Qe=G.getBoundingClientRect(),vt=typeof window>"u"?Qe.right+TT:window.innerWidth,Dn=typeof window>"u"?Qe.top+320:window.innerHeight,Mn=Math.min(320,34*(Re+Qp.length+2)+25),Br=Qe.right+Yp+TT<=vt?Qe.right+Yp:Math.max(Yp,Qe.left-TT-Yp),Qr=Math.max(Yp,Math.min(Qe.top,Dn-Mn-Yp));dn({session:_e,top:Qr,left:Br})},[$e,p,A]),g1=f.useCallback((G,_e)=>{const Re=G.sessionId,Qe=Tt(G);if(!P||pt.current.has(Qe))return;dn(null),Or(Re,!0,G.workspaceCwd),$e(G).updateSessionOrganization(Re,{groupId:_e,color:null}).then(()=>{V().catch(()=>{}),Hn()}).catch(Dn=>p(Dn,A("sidebar.organizationFailed"))).finally(()=>{Or(Re,!1,G.workspaceCwd)})},[Hn,Tt,$e,p,P,V,Or,A]),ul=f.useCallback((G,_e)=>{const Re=G.sessionId,Qe=Tt(G);if(!P||pt.current.has(Qe))return;dn(null),Or(Re,!0,G.workspaceCwd),$e(G).updateSessionOrganization(Re,{color:_e,groupId:null}).then(()=>{V().catch(()=>{}),Hn()}).catch(Dn=>p(Dn,A("sidebar.organizationFailed"))).finally(()=>{Or(Re,!1,G.workspaceCwd)})},[Hn,Tt,$e,p,P,V,Or,A]),Nd=f.useMemo(()=>{const G=Mr.trim().toLowerCase(),_e=j.filter(vt=>!vt.isPinned),Re=G?_e.filter(vt=>o2(vt).toLowerCase().includes(G)||vt.sessionId.toLowerCase().includes(G)):_e.slice();if(P)return Re;const Qe=new Map(Re.map(vt=>[vt.sessionId,N1t(vt)]));return Re.sort((vt,Dn)=>(Qe.get(Dn.sessionId)??0)-(Qe.get(vt.sessionId)??0))},[P,Mr,j]),Hl=f.useMemo(()=>{if(!P)return[];const G=Mr.trim().length>0,_e=new Set(qe.map(Mn=>Mn.id)),Re=new Map,Qe=new Map;for(const Mn of qe)Qe.set(Mn.id,[]);const vt=[];for(const Mn of Nd){if(Mn.color&&Qp.includes(Mn.color)){const Qr=Re.get(Mn.color)??[];Qr.push(Mn),Re.set(Mn.color,Qr);continue}const Br=Mn.groupId&&_e.has(Mn.groupId)?Qe.get(Mn.groupId):void 0;Br?Br.push(Mn):vt.push(Mn)}const Dn=[];for(const Mn of Qp){const Br=Re.get(Mn);!Br||Br.length===0||Dn.push({id:`color:${Mn}`,kind:"color",label:A(`sidebar.groupColor.${Mn}`),countLabel:String(Br.length),color:Mn,sessions:Br})}for(const Mn of qe){const Br=Qe.get(Mn.id)??[];G&&Br.length===0||Dn.push({id:`group:${Mn.id}`,kind:"group",label:Mn.name,countLabel:String(Br.length),color:Mn.color,group:Mn,sessions:Br})}return vt.length>0&&Dn.length>0&&Dn.push({id:T1t,kind:"recent",label:A("sidebar.groupUngrouped"),countLabel:String(vt.length),sessions:vt}),Dn},[Nd,qe,P,Mr,A]);f.useEffect(()=>{if(!P||!Un||!te)return;const G=Hl.map(Re=>Re.id).filter(Re=>!Ur.current.has(Re));if(Ar.current){Ar.current=!1;for(const Re of G)Ur.current.add(Re);return}if(G.length!==0){for(const Re of G)Ur.current.add(Re);Us(Re=>{const Qe=new Set(Re);for(const vt of G)Qe.add(vt);return Qe})}},[Un,P,Hl,te]),f.useEffect(()=>{oie(Hs,hq)},[Hs]);const gu=f.useCallback(G=>{Us(_e=>{const Re=new Set(_e);return Re.has(G)?Re.delete(G):Re.add(G),Re})},[]),B3=f.useCallback(G=>{var Pd;if(e)return;G.preventDefault(),(Pd=nn.current)==null||Pd.call(nn,!0),ve(!0);const _e=G.clientX,Re=be,Qe=document.body.style.cursor,vt=document.body.style.userSelect;let Dn=!1,Mn=()=>{};document.body.style.cursor="col-resize",document.body.style.userSelect="none";try{G.currentTarget.setPointerCapture(G.pointerId)}catch{}function Br(Eo){return Re+Eo-_e}function Qr(){const Eo=k4(Re);st(Eo),vq(Eo)}function Ao(){Dn||(Dn=!0,Qr(),Mn(!0),t(!0))}function Ld(Eo){const uo=Br(Eo.clientX);if(uo<=mq){Ao();return}st(I1t(uo))}Mn=function(uo){document.body.style.cursor=Qe,document.body.style.userSelect=vt,window.removeEventListener("pointermove",Ld),window.removeEventListener("pointerup",wi),window.removeEventListener("pointercancel",$f),nn.current=null,uo&&ve(!1)};function wi(Eo){const uo=Br(Eo.clientX);if(uo<=mq){Ao();return}const $r=k4(uo);st($r),vq($r),Mn(!0)}function $f(){Mn(!0)}nn.current=Mn,window.addEventListener("pointermove",Ld),window.addEventListener("pointerup",wi,{once:!0}),window.addEventListener("pointercancel",$f,{once:!0})},[e,t,be]),ux=cr?M1t(cr):"",Of=Ft!=null&&Ft.session.color&&Qp.includes(Ft.session.color)?Ft.session.color:null,b1=!Of&&(Ft!=null&&Ft.session.groupId)&&he.some(G=>G.id===Ft.session.groupId)?Ft.session.groupId:null,$3=Ie.length>0?Ie:Qp,y1=b1===null&&Of===null,z3=(Hr==null?void 0:Hr.group.name)??"",_p=Ie.length>0?Ie:["blue"],Gr=bq(kn,_p),uc=!_p.includes(kn),v1=Vn.trim().length>0&&Gr!==void 0&&!ne,dx=(sr==null?void 0:sr.mode)==="create"?A("sidebar.groupCreate"):A("sidebar.groupRename"),Ul=f.useCallback((G,_e={})=>{const{isArchived:Re=!1,readOnly:Qe=!1}=_e,vt=Tt(G),Dn=o2(G),Mn=G.updatedAt||G.createdAt,Br=Mn?p4(Mn,A):"",Qr=Ot.has(vt),Ao=!xn(G)&&Fe.has(vt),Ld=c.jsxs("div",{className:Se.tooltipContent,children:[c.jsx("div",{className:Se.tooltipTitle,children:Dn}),c.jsxs("div",{className:Se.tooltipTags,children:[G.hasActivePrompt&&c.jsx("span",{className:Da(Se.tooltipTag,Se.tooltipTagRunning),children:A("sidebar.running")}),Ao&&c.jsx("span",{className:Da(Se.tooltipTag,Se.tooltipTagNew),children:A("sidebar.completedUnread")}),c.jsx("span",{className:Se.tooltipTag,children:A("sidebar.clients",{count:G.clientCount??0})})]}),c.jsx("div",{className:Se.tooltipMeta,children:G.sessionId})]});if(Re)return c.jsxs("div",{className:Da(Se.sessionRow,Se.archivedRow,Qr&&Se.busySession),children:[c.jsx("span",{className:Se.sessionText,children:Dn}),c.jsxs("div",{className:Se.sessionMetaSlot,children:[c.jsx("span",{className:Se.sessionTime,children:Br}),c.jsx("div",{className:Se.sessionActions,onClick:$r=>$r.stopPropagation(),onKeyDown:$r=>$r.stopPropagation(),children:c.jsxs(my,{children:[c.jsx(py,{asChild:!0,children:c.jsx("button",{className:Se.sessionActionButton,type:"button","aria-label":A("sidebar.moreActions"),title:A("sidebar.moreActions"),children:c.jsx(Xb,{})})}),c.jsx(gy,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Yt.current=!0},onCloseAutoFocus:$r=>{Yt.current&&(Yt.current=!1,$r.preventDefault())},children:c.jsxs(bv,{children:[c.jsxs(QF,{children:[c.jsxs(JF,{children:[c.jsx(V8,{}),A("sidebar.details")]}),c.jsx(ZF,{className:"min-w-64 p-3",children:Ld})]}),Sn(G)&&c.jsxs($a,{onSelect:()=>cx(G),children:[c.jsx(Yhe,{}),A("sidebar.unarchive")]}),c.jsxs($a,{variant:"destructive",onSelect:()=>Rf(G),children:[c.jsx(Qb,{}),A("sidebar.delete")]})]})})]})})]})]},vt);const wi=xn(G),$f=wi&&Dt===G.sessionId,Pd=He.has(vt),Eo=!G.isWaitingForPermission&&G.isWaitingForUserQuestion,uo=G.isWaitingForPermission?A("sidebar.waitingForApproval"):Eo?A("sidebar.userInputNeeded"):null;return c.jsx("div",{className:Da(Se.sessionRow,wi&&Se.currentSession,G.isPinned&&Se.pinnedSession,G.hasActivePrompt&&Se.runningSession,Qr&&Se.busySession),role:"button",tabIndex:0,"aria-current":wi?"page":void 0,onClick:()=>cl(G.sessionId,G.workspaceCwd),onDoubleClick:()=>{!Qe&&wi&&!e&&If(G)},onKeyDown:$r=>{$r.key==="Enter"&&cl(G.sessionId,G.workspaceCwd)},children:!e&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Se.sessionStatusSlot,children:Ao?c.jsx("span",{className:Se.sessionStatusDot,"aria-hidden":"true"}):null}),$f&&!Qe?c.jsx("form",{className:Se.renameForm,onClick:$r=>$r.stopPropagation(),onSubmit:$r=>{$r.preventDefault(),c1()},children:c.jsx("input",{autoFocus:!0,className:Se.renameInput,value:Lt,onChange:$r=>ke($r.target.value),onBlur:cc,onKeyDown:$r=>{$r.key==="Escape"&&($r.preventDefault(),cc())}})}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Se.sessionText,children:Dn}),c.jsxs("div",{className:Se.sessionMetaSlot,children:[uo&&c.jsx("span",{className:Da(Se.sessionAttention,Eo&&Se.sessionAttentionUserInput),"aria-label":uo,children:uo}),G.hasActivePrompt?c.jsx("span",{className:Se.sessionLoading,"aria-label":A("sidebar.running")}):uo?null:c.jsx("span",{className:Se.sessionTime,children:Br}),Qe&&Sn(G)&&c.jsx("div",{className:Se.sessionActions,onClick:$r=>$r.stopPropagation(),onKeyDown:$r=>$r.stopPropagation(),children:c.jsx("button",{className:Se.sessionActionButton,type:"button",disabled:Qr||wi,"aria-label":A("sidebar.archive"),title:A(wi?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>m1(G),children:c.jsx(oL,{})})}),!Qe&&c.jsxs("div",{className:Se.sessionActions,onClick:$r=>$r.stopPropagation(),onKeyDown:$r=>$r.stopPropagation(),children:[P&&c.jsx("button",{className:Da(Se.sessionActionButton,G.isPinned&&Se.activeSessionActionButton),type:"button",disabled:Qr,"aria-label":G.isPinned?A("sidebar.unpin"):A("sidebar.pin"),title:G.isPinned?A("sidebar.unpin"):A("sidebar.pin"),onClick:()=>f1(G),children:c.jsx(Yfe,{})}),Sn(G)&&c.jsx("button",{className:Se.sessionActionButton,type:"button",disabled:Qr||wi,"aria-label":A("sidebar.archive"),title:A(wi?"sidebar.archiveCurrentDisabled":"sidebar.archive"),onClick:()=>m1(G),children:c.jsx(oL,{})}),c.jsxs(my,{children:[c.jsx(py,{asChild:!0,children:c.jsx("button",{className:Se.sessionActionButton,type:"button","aria-label":A("sidebar.moreActions"),title:A("sidebar.moreActions"),children:c.jsx(Xb,{})})}),c.jsx(gy,{align:"end",className:"w-auto min-w-40",onPointerDownOutside:()=>{Yt.current=!0},onCloseAutoFocus:$r=>{Yt.current&&(Yt.current=!1,$r.preventDefault())},children:c.jsxs(bv,{children:[c.jsxs(QF,{children:[c.jsxs(JF,{children:[c.jsx(V8,{}),A("sidebar.details")]}),c.jsx(ZF,{className:"min-w-64 p-3",children:Ld})]}),c.jsxs($a,{disabled:!wi,title:wi?void 0:A("sidebar.renameCurrentOnly"),onSelect:()=>kp(G),children:[c.jsx(CW,{}),A("sidebar.rename")]}),P&&c.jsxs($a,{disabled:Qr,onSelect:$r=>p1($r.currentTarget,G),children:[c.jsx(Tfe,{}),A("sidebar.sessionGroup")]}),ti&&c.jsxs($a,{disabled:Pd,onSelect:()=>u1(G),children:[c.jsx(yfe,{}),A("sidebar.export")]}),c.jsxs($a,{variant:"destructive",disabled:wi,title:wi?A("sidebar.currentDeleteDisabled"):void 0,onSelect:()=>Rf(G),children:[c.jsx(Qb,{}),A("sidebar.delete")]})]})})]})]})]})]})]})},vt)},[Ot,Sn,ti,cc,e,Fe,Lt,Dt,He,Tt,m1,Rf,u1,cl,kp,f1,cx,xn,p1,P,c1,If,A]),jd=f.useMemo(()=>ie&&j.length===0?c.jsx("div",{className:Se.notice,children:A("sidebar.loadingSessions")}):oe&&j.length===0?c.jsx("button",{className:Se.retry,type:"button",onClick:V,children:A("sidebar.loadFailed")}):Nd.length===0&&(Mr.trim()||!P||Hl.length===0)?c.jsx("div",{className:Se.notice,children:A("sidebar.searchEmpty")}):P?Hl.length===0?Nd.map(G=>Ul(G)):Hl.map(G=>{const _e=!Hs.has(G.id),Re=G.group;return c.jsx(xE,{id:G.id,label:G.label,count:G.sessions.length,color:G.color,expanded:_e,onToggle:()=>gu(G.id),onRename:G.kind==="group"&&Re?()=>Lf(Re):void 0,onDelete:G.kind==="group"&&Re?()=>Pf(Re):void 0,renameLabel:A("sidebar.groupRename"),deleteLabel:A("sidebar.groupDelete"),actionsDisabled:ne,children:G.sessions.map(Qe=>Ul(Qe))},G.id)}):Nd.map(G=>Ul(G)),[Hs,oe,Nd,ne,Pf,Lf,ie,P,V,Ul,Mr,Hl,j.length,A,gu]),Sp=f.useMemo(()=>{if(!K||e||Mr.trim())return null;const G=c.jsxs("button",{type:"button",className:Se.archivedHeader,"aria-expanded":Ae,onClick:()=>Ne(Qe=>!Qe),children:[c.jsx("span",{className:Se.archivedTitle,style:{flex:"0 1 auto"},children:A("sidebar.archivedTitle")}),c.jsx("span",{className:Se.archivedChevron,"aria-hidden":"true",children:Ae?c.jsx(vl,{}):c.jsx(Y4,{})}),Ae&&En.length>0&&c.jsx("span",{className:Se.archivedCount,children:En.length})]});if(!Ae)return c.jsx("div",{className:Se.archivedSection,children:G});const _e=c.jsx("button",{className:Se.retry,type:"button",onClick:()=>{dt(),Pn(Qe=>Qe+1)},children:A("sidebar.loadFailed")});let Re;return pr&&En.length===0?Re=c.jsx("div",{className:Se.notice,children:A("sidebar.loadingSessions")}):yr&&En.length===0?Re=_e:En.length===0?Re=c.jsx("div",{className:Se.notice,children:A("sidebar.archivedEmpty")}):Re=c.jsxs(c.Fragment,{children:[En.map(Qe=>Ul(Qe,{isArchived:!0})),yr&&_e]}),c.jsxs("div",{className:Se.archivedSection,children:[G,c.jsx("div",{className:Se.archivedList,children:Re})]})},[Ae,En,e,yr,pr,dt,Ul,Mr,K,Pn,A]);return c.jsxs(c.Fragment,{children:[c.jsxs("aside",{className:Da(Se.sidebar,e&&Se.collapsed,ce&&Se.resizing,x&&Se.mobileOpen),"aria-label":A("sidebar.label"),style:Ta,children:[Ft&&c.jsxs("div",{ref:_n,className:Se.groupMenu,role:"menu","aria-label":A("sidebar.sessionGroup"),style:{top:Ft.top,left:Ft.left},onClick:G=>G.stopPropagation(),onKeyDown:Ad,onMouseDown:G=>G.stopPropagation(),children:[c.jsxs("button",{className:Da(Se.groupMenuItem,y1&&Se.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":y1,onClick:()=>g1(Ft.session,null),children:[c.jsx("span",{className:Se.groupMenuEmptyDot}),c.jsx("span",{className:Se.groupMenuName,children:A("sidebar.groupUngrouped")}),y1&&c.jsx("span",{className:Se.groupMenuCheck,children:"✓"})]}),$3.map(G=>{const _e=Of===G;return c.jsxs("button",{className:Da(Se.groupMenuItem,_e&&Se.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":_e,onClick:()=>ul(Ft.session,G),children:[c.jsx("span",{className:Da(Se.groupMenuDot,yq(G))}),c.jsx("span",{className:Se.groupMenuName,children:A(`sidebar.groupColor.${G}`)}),_e&&c.jsx("span",{className:Se.groupMenuCheck,children:"✓"})]},`color:${G}`)}),he.map(G=>{const _e=b1===G.id;return c.jsxs("button",{className:Da(Se.groupMenuItem,_e&&Se.groupMenuItemActive),type:"button",role:"menuitemradio","aria-checked":_e,onClick:()=>g1(Ft.session,G.id),children:[c.jsx("span",{className:Da(Se.groupMenuDot,yq(G.color)),style:j1t(G.color)}),c.jsx("span",{className:Se.groupMenuName,children:G.name}),_e&&c.jsx("span",{className:Se.groupMenuCheck,children:"✓"})]},G.id)}),c.jsx("div",{className:Se.groupMenuSeparator}),c.jsxs("button",{className:Se.groupMenuItem,type:"button",role:"menuitem",onClick:()=>O3(Ft.session),children:[c.jsx("span",{className:Se.groupMenuIcon,children:c.jsx(D1t,{})}),c.jsx("span",{className:Se.groupMenuName,children:A("sidebar.groupCreate")})]})]}),cr&&c.jsx(Qs,{title:A("delete.title"),size:"sm",onClose:()=>Jn(null),children:c.jsxs("div",{className:Se.confirmContent,children:[c.jsx("p",{className:Se.confirmDescription,children:A("sidebar.deleteConfirmDescription",{name:ux})}),c.jsxs("div",{className:Se.confirmActions,children:[c.jsx("button",{className:Se.secondaryButton,type:"button",onClick:()=>Jn(null),children:A("common.cancel")}),c.jsx("button",{className:Se.dangerButton,type:"button",onClick:d1,children:A("sidebar.delete")})]})]})}),An&&c.jsx(Qs,{title:A("sidebar.removeWorkspaceTitle"),size:"sm",onClose:()=>{(!Ee||mn)&&(wt.current=!0,Er(null),de(null),we(!1))},children:c.jsxs("div",{className:Se.confirmContent,children:[c.jsx("p",{className:Se.confirmDescription,children:Pr?A("sidebar.removeWorkspaceBusy",{name:An.cwd}):A("sidebar.removeWorkspaceConfirm",{name:An.cwd})}),Pr&&c.jsxs("ul",{className:Se.workspaceRemovalActivityList,children:[c.jsx("li",{children:A("sidebar.removeWorkspaceSessions",{count:Pr.sessions})}),c.jsx("li",{children:A("sidebar.removeWorkspacePrompts",{count:Pr.activePrompts})}),c.jsx("li",{children:A("sidebar.removeWorkspaceStarts",{count:Pr.pendingSessionStarts})}),c.jsx("li",{children:A("sidebar.removeWorkspaceConnections",{count:Pr.acpConnections})}),c.jsx("li",{children:A("sidebar.removeWorkspaceMemoryTasks",{count:Pr.memoryTasks})}),c.jsx("li",{children:A("sidebar.removeWorkspaceWorkers",{count:Pr.channelWorkers})}),c.jsx("li",{children:A("sidebar.removeWorkspaceVoiceSessions",{count:Pr.voiceSessions??0})})]}),Pr&&M.sessionId&&M.workspaceCwd===An.cwd&&c.jsx("p",{className:Se.confirmDescription,children:A("sidebar.removeWorkspaceCurrentSession")}),mn&&c.jsx("p",{className:Se.confirmDescription,children:A("sidebar.removeWorkspaceInProgress")}),c.jsxs("div",{className:Se.confirmActions,children:[c.jsx("button",{className:Se.secondaryButton,type:"button",disabled:Ee&&!mn,onClick:()=>{wt.current=!0,Er(null),de(null),we(!1)},children:A("common.cancel")}),c.jsx("button",{className:Se.dangerButton,type:"button",disabled:Ee||mn||Pr!==null&&!!M.sessionId&&M.workspaceCwd===An.cwd,onClick:()=>void ni(),children:A(Pr?"sidebar.forceRemoveWorkspace":"sidebar.removeWorkspace")})]})]})}),sr&&c.jsx(Qs,{title:dx,size:"sm",onClose:h1,children:c.jsxs("form",{className:"flex flex-col gap-6",onSubmit:G=>{G.preventDefault(),lx()},children:[c.jsxs(Bj,{children:[c.jsxs(eg,{children:[c.jsx(by,{htmlFor:"session-group-name",children:A("sidebar.groupNamePrompt")}),c.jsx(ga,{id:"session-group-name",value:Vn,autoFocus:!0,maxLength:64,onChange:G=>Zn(G.target.value)})]}),c.jsxs(eg,{children:[c.jsx(by,{htmlFor:"session-group-color",children:A("sidebar.groupColor")}),c.jsxs(C3,{value:uc?AT:kn,onValueChange:G=>{er(G===AT?Ms:G)},children:[c.jsx(A3,{id:"session-group-color",className:"w-full",children:c.jsx(T3,{})}),c.jsx(E3,{children:c.jsxs(Ij,{children:[_p.map(G=>c.jsx(Ig,{value:G,children:A(`sidebar.groupColor.${G}`)},G)),c.jsx(Ig,{value:AT,children:A("sidebar.groupColor.custom")})]})})]})]}),uc&&c.jsxs(eg,{children:[c.jsx(by,{htmlFor:"session-group-hex-color",children:A("sidebar.groupColor.hex")}),c.jsxs("div",{className:Se.groupCustomColorRow,children:[c.jsx(ga,{className:Se.groupColorPicker,type:"color",value:Ms,"aria-label":A("sidebar.groupColor.picker"),onChange:G=>{const _e=G.target.value.toLowerCase();Ss(_e),er(_e)}}),c.jsx(ga,{id:"session-group-hex-color",value:kn,maxLength:7,spellCheck:!1,"aria-invalid":Gr===void 0,onChange:G=>{const _e=G.target.value,Re=_e.trim(),Qe=Re&&!Re.startsWith("#")?`#${Re}`:_e;er(Qe);const vt=wE(Qe);vt&&Ss(vt)}})]}),Gr===void 0&&c.jsx("span",{className:Se.groupColorError,role:"alert",children:A("sidebar.groupColor.invalid")})]})]}),c.jsxs("div",{className:"flex justify-end gap-2",children:[c.jsx(Fr,{type:"button",variant:"outline",disabled:ne,onClick:h1,children:A("common.cancel")}),c.jsx(Fr,{type:"submit",disabled:!v1,children:A("common.save")})]})]})}),Hr&&c.jsx(Qs,{title:A("sidebar.groupDelete"),size:"sm",onClose:()=>{ne||rs(null)},children:c.jsxs("div",{className:Se.confirmContent,children:[c.jsx("p",{className:Se.confirmDescription,children:A("sidebar.groupDeleteConfirm",{name:z3})}),c.jsxs("div",{className:Se.confirmActions,children:[c.jsx("button",{className:Se.secondaryButton,type:"button",disabled:ne,onClick:()=>rs(null),children:A("common.cancel")}),c.jsx("button",{className:Se.dangerButton,type:"button",disabled:ne,onClick:xi,children:A("sidebar.groupDelete")})]})]})}),$&&c.jsx("div",{className:Se.topRow,children:C!=null&&C.render?C.render():c.jsxs(c.Fragment,{children:[c.jsx("span",{className:Se.brandLogo,"aria-hidden":"true",children:c.jsx(L1t,{})}),!e&&c.jsx("span",{className:Se.brandName,children:"Qwen Code"})]})}),c.jsxs("div",{className:Se.primaryNav,children:[c.jsxs("button",{className:Se.newChatButton,type:"button",title:A("sidebar.newTask"),"aria-label":A("sidebar.newTask"),disabled:fu,onClick:()=>Md(),children:[c.jsx("span",{className:Se.navIcon,children:c.jsx(lL,{size:16,strokeWidth:1.2})}),!e&&c.jsx("span",{children:A("sidebar.newTask")})]}),c.jsxs("button",{className:Se.pluginButton,type:"button",title:A("sidebar.plugins"),"aria-label":A("sidebar.plugins"),onClick:r,children:[c.jsx("span",{className:Se.navIcon,children:c.jsx(Zhe,{size:16,strokeWidth:1.2})}),!e&&c.jsx("span",{children:A("sidebar.plugins")})]}),B.has("scheduledTasks")&&c.jsxs("button",{className:Se.pluginButton,type:"button",title:A("sidebar.scheduledTasks"),"aria-label":A("sidebar.scheduledTasks"),onClick:i,children:[c.jsx("span",{className:Se.navIcon,children:c.jsx(sfe,{size:16,strokeWidth:1.2})}),!e&&c.jsx("span",{children:A("sidebar.scheduledTasks")})]})]}),c.jsx("div",{className:Se.body,children:c.jsxs("div",{className:Se.sessionList,children:[!e&&Ns.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Se.projectsHeader,children:c.jsxs("button",{className:Se.projectsHeaderToggle,type:"button","aria-expanded":Le,onClick:()=>ge(G=>!G),children:[c.jsx("span",{children:A("sidebar.pinnedSessions")}),c.jsx(xq,{expanded:Le})]})}),Le&&c.jsx("div",{className:Se.pinnedSessionList,children:Ns.map(G=>Ul(G))})]}),!e&&c.jsxs("div",{className:Se.projectsHeader,children:[c.jsxs("button",{className:Se.projectsHeaderToggle,type:"button","aria-expanded":qt,onClick:()=>tr(G=>!G),children:[c.jsx("span",{children:A("sidebar.project")}),c.jsx(xq,{expanded:qt})]}),c.jsxs("div",{className:Se.projectsHeaderActions,children:[c.jsx("button",{className:Se.projectsHeaderAction,type:"button",title:A("sidebar.search"),"aria-label":A("sidebar.search"),onClick:()=>{ss(G=>(G&&is(""),!G)),tr(!0)},children:c.jsx(Um,{})}),!T&&c.jsx("button",{className:Se.projectsHeaderAction,type:"button",title:A("sidebar.addWorkspace"),"aria-label":A("sidebar.addWorkspace"),onClick:()=>{$n(!0)},children:c.jsx(U2,{})})]})]}),Lr&&!e&&c.jsxs("div",{className:Se.projectSearch,children:[c.jsx(Um,{"aria-hidden":"true"}),c.jsx(ga,{value:Mr,placeholder:A("sidebar.searchPlaceholder"),"aria-label":A("sidebar.search"),autoFocus:!0,onChange:G=>is(G.target.value),onKeyDown:G=>{G.key==="Escape"&&(is(""),ss(!1))}})]}),(e||qt)&&c.jsx(c.Fragment,{children:!e&&c.jsx("div",{className:Se.workspacePicker,children:c.jsx("div",{className:Se.workspaceList,children:cs.map(G=>c.jsxs(f.Fragment,{children:[c.jsx(v1t,{workspace:G,renderHeader:T&&(S!=null&&S.render)?_e=>{var Re;return(Re=S.render)==null?void 0:Re.call(S,G,{expanded:_e})}:void 0,client:O.client,reloadToken:Pt,primaryLabel:cs.length>1?A("sidebar.workspacePrimary"):"",untrustedLabel:A("sidebar.workspaceUntrusted"),readOnlyLabel:A("sidebar.workspaceReadOnly"),trustToOpenLabel:A("sidebar.workspaceTrustToOpen"),noSessionsLabel:A("sidebar.noSessions"),loadErrorLabel:A("sidebar.loadFailed"),organizationEnabled:P,ungroupedLabel:A("sidebar.groupUngrouped"),onRenameGroup:Lf,onDeleteGroup:Pf,renameGroupLabel:A("sidebar.groupRename"),deleteGroupLabel:A("sidebar.groupDelete"),groupActionsDisabled:ne,excludePinned:!0,formatTime:_e=>p4(_e,A),searchQuery:Mr,expanded:G.primary?Ct:void 0,autoExpandKey:(zn==null?void 0:zn.id)===G.id?zn==null?void 0:zn.key:void 0,onExpandedChange:G.primary?Bt:void 0,renderSessions:!G.primary,renderSession:_e=>Ul({..._e,workspaceCwd:G.cwd},{readOnly:!G.primary}),headerActions:_e=>{if(T&&(S!=null&&S.render))return null;const Re=!T&&Nr&&!G.primary&&G.removable===!0;return!G.trusted&&!Re?null:c.jsxs("div",{className:Se.workspaceHeaderActions,style:{visibility:_e?"visible":"hidden"},children:[G.trusted&&c.jsxs(c.Fragment,{children:[c.jsx("button",{className:Se.workspaceHeaderAction,type:"button","aria-label":A("sidebar.groupCreate"),onClick:Qe=>{Qe.preventDefault(),Qe.stopPropagation(),G.primary?L3():P3(G.cwd)},children:c.jsx(U2,{size:16,strokeWidth:1.2})}),c.jsx("button",{className:Se.workspaceHeaderAction,type:"button",title:A("sidebar.newTask"),"aria-label":A("sidebar.newTask"),onClick:Qe=>{Qe.preventDefault(),Qe.stopPropagation(),Md(G.primary?void 0:G.cwd)},children:c.jsx(lL,{size:16,strokeWidth:1.2})})]}),Re&&c.jsxs(my,{children:[c.jsx(py,{asChild:!0,children:c.jsx("button",{className:Se.workspaceHeaderAction,type:"button","aria-label":A("sidebar.workspaceActions"),disabled:Ee&&(An==null?void 0:An.id)===G.id,children:c.jsx(Xb,{size:16,strokeWidth:1.2})})}),c.jsx(gy,{align:"end",children:c.jsxs($a,{variant:"destructive","aria-label":`${A("sidebar.removeWorkspace")}: ${G.cwd}`,onSelect:()=>jf(G),children:[c.jsx(Qb,{}),A("sidebar.removeWorkspace")]})})]})]})}}),G.primary&&(Ct||Mr.trim())?c.jsx("div",{className:Se.workspaceSessionBody,children:jd}):null]},G.id))})})}),Sp]})}),_!==!1&&c.jsxs("div",{className:Da(Se.footer,Ca&&Se.footerCompact,To&&Se.footerTight),children:[c.jsxs("div",{className:Se.footerPrimary,children:[B.has("settings")&&c.jsxs("button",{className:Se.footerButton,type:"button",title:A("sidebar.settings"),"aria-label":A("sidebar.settings"),onClick:n,children:[c.jsx("span",{className:`${Se.navIcon} ${Se.settingsIcon}`,children:c.jsx(nme,{size:16,strokeWidth:1.2})}),!e&&!Ca&&c.jsx("span",{className:Se.footerButtonLabel,children:A("sidebar.settings")})]}),!e&&!To&&Gi&&B.has("version")&&c.jsx("span",{className:Se.version,title:`Qwen Code ${Gi}`,children:Gi})]}),c.jsxs("div",{className:Se.footerActions,children:[B.has("theme")&&c.jsx("button",{className:Se.collapseButton,type:"button",title:g===As.Dark?A("sidebar.themeLight"):A("sidebar.themeDark"),"aria-label":g===As.Dark?A("sidebar.themeLight"):A("sidebar.themeDark"),onClick:()=>b(g===As.Dark?As.Light:As.Dark),children:g===As.Dark?c.jsx(dme,{size:16,strokeWidth:1.2}):c.jsx($fe,{size:16,strokeWidth:1.2})}),a&&B.has("sessionsOverview")&&c.jsx("button",{className:Se.collapseButton,type:"button",title:A("sidebar.sessionsOverview"),"aria-label":A("sidebar.sessionsOverview"),onClick:o,children:c.jsx(Rfe,{size:16,strokeWidth:1.2})}),u&&B.has("splitView")&&c.jsx("button",{className:Se.collapseButton,type:"button",title:A("sidebar.splitView"),"aria-label":A("sidebar.splitView"),onClick:l,children:c.jsx(ffe,{size:16,strokeWidth:1.2})}),B.has("daemonStatus")&&c.jsx("button",{className:Se.collapseButton,type:"button",title:A("sidebar.daemonStatus"),"aria-label":A("sidebar.daemonStatus"),onClick:s,children:c.jsx(Ghe,{size:16,strokeWidth:1.2})}),!x&&B.has("collapse")&&c.jsx("button",{className:Se.collapseButton,type:"button",title:A(e?"sidebar.expand":"sidebar.collapse"),"aria-label":A(e?"sidebar.expand":"sidebar.collapse"),onClick:()=>t(!e),children:e?c.jsx(Wfe,{size:16,strokeWidth:1.2}):c.jsx(Ufe,{size:16,strokeWidth:1.2})})]})]}),c.jsx("div",{className:Se.resizeHandle,role:"separator","aria-orientation":"vertical",onPointerDown:B3})]}),!T&&Vr&&c.jsx(Cpt,{onClose:()=>$n(!1),onAdd:pu})]})}function O1t(e){const[t,n]=f.useState(e);return f.useEffect(()=>{const r=window.requestAnimationFrame(()=>{n(e)});return()=>window.cancelAnimationFrame(r)},[e]),t}const B1t=3e3,$1t=2;function wq(e){return e.some(t=>t.status==="running"||t.status==="paused")}function z1t(e,t,n=0){const r=Fg(),[s,i]=f.useState([]),[o,a]=f.useState(!1),[l,u]=f.useState(!1),d=f.useRef(0),h=f.useRef(!1);f.useEffect(()=>{if(!t){i([]),a(!1),d.current=0;return}},[t]),f.useEffect(()=>{!t||!e||(d.current=0,a(!0))},[t,e]),f.useEffect(()=>{!t||n===0||(d.current=0,a(!0))},[t,n]),f.useEffect(()=>{if(l||!t||!o)return;let p=!1;const g=()=>{h.current||(h.current=!0,r.getTasks().then(x=>{if(!p){if(i(x.tasks),x.tasks.length===0){d.current+=1,d.current>=$1t&&a(!1);return}d.current=0,wq(x.tasks)||a(!1)}}).catch(x=>{p||console.warn("[web-shell] failed to refresh tasks:",x)}).finally(()=>{h.current=!1}))};g();const b=setInterval(g,B1t);return()=>{p=!0,clearInterval(b)}},[r,t,o,l]);const m=f.useRef(s);return m.current=s,f.useEffect(()=>{const p=g=>{const b=g.detail,x=(b==null?void 0:b.active)===!0;u(x),!x&&wq(m.current)&&a(!0)};return window.addEventListener(mv,p),()=>window.removeEventListener(mv,p)},[]),s}function F1t(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,u)=>l===a[u]):!1})}function q1t(e){const t=f.useRef(e);return F1t(t.current,e)||(t.current=e),t.current}function H1t(e,t){const n=f.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 Si={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"},kq=1024,U1t=new RegExp(String.raw`(?<![\w$])\$(?![\s\d$])(?=[^$\n]{1,${kq}}\S\$)([^$\n]{1,${kq}})\$(?![\w$])`,"g");function V1t(e){var u,d,h;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=new Map;let i=null,o=null,a=null,l=[];for(const m of n){const p=m.match(r);if(!i){if(p){if(i=p[1]??null,o=((d=(u=p[2])==null?void 0:u.trim().split(/\s+/)[0])==null?void 0:d.toLowerCase())||null,o){const g=(s.get(o)??0)+1;s.set(o,g),a=g}else a=null;l=[]}continue}if(p&&((h=p[1])!=null&&h.startsWith(i[0]??""))&&p[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(m)}return t}function W1t(e){var l;const t=[],n=e.split(/\r?\n/),r=/^ *(`{3,}|~{3,}) *([^`]*)$/,s=/^ *\$\$ *$/;let i=null,o=!1,a=[];for(const u of n){const d=u.match(r);if(i){d&&((l=d[1])!=null&&l.startsWith(i[0]??""))&&d[1].length>=i.length&&(i=null);continue}if(!o){if(d){i=d[1]??null;continue}s.test(u)&&(o=!0,a=[]);continue}if(s.test(u)){t.push({content:a.join(`
`),index:t.length+1}),o=!1,a=[];continue}a.push(u)}return t}function G1t(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 u=l.match(r);if(i){u&&((a=u[1])!=null&&a.startsWith(i[0]??""))&&u[1].length>=i.length&&(i=null);continue}if(o){s.test(l)&&(o=!1);continue}if(u){i=u[1]??null;continue}if(s.test(l)){o=!0;continue}for(const d of l.matchAll(U1t)){const h=d[1];h&&t.push({content:h,index:t.length+1})}}return t}function _q(e,t){return t&&e.langIndex!==null?`${t} code block ${e.langIndex}`:`Code block ${e.index}`}function K1t(e,t){var d;const n=t.trim().split(/\s+/).filter(Boolean),r=(d=n[0])==null?void 0:d.toLowerCase();if(!r)return;const s=V1t(e);if(s.length===0)return null;let i=null,o=null;const a=r==="code"?n.slice(1):n.map(h=>h);r!=="code"&&(i=r);for(const h of a)/^\d+$/.test(h)?o=Number(h):h.toLowerCase()!=="code"&&(i=h.toLowerCase());const l=i?s.filter(h=>h.lang===i):s;if(l.length===0)return null;if(o!==null){const h=i?l.find(m=>m.langIndex===o):s.find(m=>m.index===o);return h?{content:h.content,label:_q(h,i)}:null}const u=l[l.length-1];return u?{content:u.content,label:_q(u,i)}:null}function Sq(e,t){const n=G1t(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 Y1t(e,t){var u;const n=t.trim().split(/\s+/).filter(Boolean),r=(u=n[0])==null?void 0:u.toLowerCase();if(r!=="latex"&&r!=="math"&&r!=="inline-latex")return;if(r==="inline-latex")return Sq(e,n.slice(1));const s=n.slice(1),i=s.findIndex(d=>d.toLowerCase()==="inline");if(i!==-1)return Sq(e,s.filter((d,h)=>h!==i));const o=W1t(e);if(o.length===0)return null;let a=null;for(const d of s)/^\d+$/.test(d)&&(a=Number(d));const l=a!==null?o.find(d=>d.index===a):o[o.length-1];return l?{content:l.content,label:`LaTeX block ${l.index}`}:null}function X1t(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 Q1t(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 J1t(e,t,n=Q1t){const r=X1t(e);if(r===null)return{status:"info",message:Si.NO_OUTPUT};if(!r)return{status:"info",message:Si.NO_TEXT};try{const s=Y1t(r,t);if(s===null)return{status:"info",message:t.trim().split(/\s+/).some(l=>l==="inline")||t.trim().toLowerCase().startsWith("inline-latex")?Si.INLINE_LATEX_MISSING:Si.LATEX_MISSING};if(s!==void 0)return await n(s.content),{status:"info",message:`${s.label}${Si.COPIED_SUFFIX}`};const i=K1t(r,t);if(i===null)return{status:"info",message:Si.CODE_MISSING};const o=(i==null?void 0:i.content)??r;return await n(o),{status:"info",message:i?`${i.label}${Si.COPIED_SUFFIX}`:Si.OUTPUT_COPIED}}catch(s){const i=s instanceof Error?s.message:String(s);return{status:"error",message:`${Si.CLIPBOARD_PREFIX}${i}`}}}function Z1t(e){return typeof e=="object"&&e!==null}function uie(e){const t="Model switched: ";return e.startsWith(t)?e.slice(t.length).trim().replace(/\([^()]+\)$/,""):null}function zj(e){return e.role==="system"&&e.variant==="info"&&e.source==="model_switch_summary"}function ebt(e){if(!zj(e)||!Z1t(e.data))return null;const t=e.data.modelId;return typeof t=="string"&&t?t:null}function tbt(e){const t=new Set;for(const n of e){if(!zj(n))continue;const r=ebt(n);r&&t.add(r)}return t.size===0?[...e]:e.filter(n=>{if(n.role!=="system"||n.variant!=="info")return!0;const r=uie(n.content);return!r||!t.has(r)})}function nbt(e){return e.role!=="system"||e.variant!=="info"?!1:uie(e.content)!==null||zj(e)}function rbt(e){const t=e.findIndex(n=>!nbt(n));return t<0?[]:e.slice(t)}function Cq(e){return rbt(tbt(e))}function sbt(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 Tq(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 ibt(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?`${t[2]}:${t[1]}`:e}function Aq(e){const t=e.match(/^(.+)\(([^()]+)\)$/);return t?t[1]:e}function obt(e){const t=e.indexOf("\0"),n=t>=0?e.slice(0,t):e,r=n.indexOf(":");return r>0?`${n.slice(r+1)}(${n.slice(0,r)})`:n}function abt({catchingUp:e,pendingApproval:t,isPreparingPrompt:n}){return!!(e||t||n)}function die({catchingUp:e,isPreparingPrompt:t,isStreaming:n}){return e?"loading":t||n?"processing":"idle"}function lbt(e){switch(die(e)){case"loading":return"common.loading";case"processing":return"editor.processing";case"idle":return"editor.placeholder"}}function cbt({connectionStatus:e}){return e==="disconnected"||e==="error"}const ip=f.createContext(!1),Fj=f.createContext(new Map),hie=f.createContext(new Map);function ubt({timeline:e,details:t,children:n}){return c.jsx(Fj.Provider,{value:e,children:c.jsx(hie.Provider,{value:t,children:n})})}const cb=U4,ET=760,Jp=320,dk=500,dbt=20,hbt=3e4;function Eq(e){return(e.skills??[]).filter(t=>t.status==="ok").map(t=>({name:t.name,description:t.description??""})).sort((t,n)=>t.name.localeCompare(n.name))}const fbt="ui.compactMode",mbt="ui.hideTips",pbt={main:"model.select",fast:"model.setFast",voice:"model.setVoice",vision:"model.setVision"};function MT(e){return e.trim().replace(/^\/+/,"").toLowerCase()}const fie=new Set(["clear","stop","off","reset","none","cancel"]);function gbt(e){const t=e.replace(/^\/goal\b/i,"").trim().toLowerCase();return fie.has(t)}function bbt(e){const t=e;return t.source!=="goal"?null:n4(t.data)??n4(t.text)}function ybt(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.kind!=="status")continue;const r=bbt(n);if(r)return r.kind==="set"||r.kind==="checking"?{condition:r.condition,setAt:r.setAt??n.serverTimestamp??n.createdAt}:null}return null}const Mq={insertText:()=>{},setText:()=>{},addTags:()=>{},removeTag:()=>{},clear:()=>{},submit:()=>{}},vbt=[],mie=1e3,Nq=6,jq=40,pie="qwen-code-web-shell-chat-width",xbt=40,gie="qwen-code-web-shell-sidebar-collapsed";function wbt(e){return e===!0?{enabled:!0,defaultCollapsed:!1,showCompactToggle:!0}:e?{enabled:e.enabled??!0,defaultCollapsed:e.defaultCollapsed??!1,showCompactToggle:e.showCompactToggle??!0,branding:e.branding,footer:e.footer,lockedWorkspace:e.lockedWorkspace}:{enabled:!1,defaultCollapsed:!1,showCompactToggle:!0}}function kbt(e){if(typeof window>"u")return e;try{const t=window.localStorage.getItem(gie);if(t==="true")return!0;if(t==="false")return!1}catch{}return e}function _bt(e){try{window.localStorage.setItem(gie,String(e))}catch{}}function a2(){return`${mie}`}function Sbt(){if(typeof window>"u")return a2();try{return window.localStorage.getItem(pie)==="wide"?"wide":a2()}catch{return a2()}}function Cbt(e){try{window.localStorage.setItem(pie,e)}catch{}}function bie(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:mie}function Tbt(e,t){const n=`${bie(t)}px`,r=`calc(${n} + ${xbt}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 Iq(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function Rq(e,t){if(e){if(typeof e=="function"){e(t);return}e.current=t}}function Abt(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Ebt(){if(typeof window>"u")return"en";const e=new URLSearchParams(window.location.search);return Ku(e.get("language")??e.get("lang")??navigator.language)}function Mbt(e,t){return e instanceof Error?e.message:t}function NT(e){return e instanceof DOMException&&e.name==="AbortError"||e instanceof Error&&e.name==="AbortError"}function Zp(e){return typeof e=="object"&&e!==null&&e._alreadyDispatched===!0}function Nbt(e){return e.category==="validation"||e.category==="user_action"||e.category==="system"}function jbt(e){return e.severity==="warning"?"warning":e.severity==="info"?"info":"error"}function jT(e){return typeof e=="object"&&e!==null}function Ibt(e){if(!jT(e))return null;const t=e._meta;if(!jT(t))return null;const n=t.qwenModelSwitch;if(!jT(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 Rbt(e,t){return t("model.usingModel",{isRuntime:e.isRuntime?1:0,modelId:e.modelId})}function Dbt(e){return e.toolKind==="edit"}function Lbt(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 Pbt(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 Obt(e){const t=[];for(const n of e)if(n.role==="tool_group")for(const r of n.tools)(NW(r)||Pbt(r))&&t.push(`${r.callId}:${r.status}`);return t.join("|")}function Bbt(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 $bt(e,t){return e===Si.NO_OUTPUT?t("copy.noOutput"):e===Si.NO_TEXT?t("copy.noText"):e===Si.CODE_MISSING?t("copy.codeMissing"):e===Si.LATEX_MISSING?t("copy.latexMissing"):e===Si.INLINE_LATEX_MISSING?t("copy.inlineLatexMissing"):e===Si.OUTPUT_COPIED?t("copy.outputCopied"):e.startsWith(Si.CLIPBOARD_PREFIX)?`${t("copy.failedFallback")}. ${e.slice(Si.CLIPBOARD_PREFIX.length)}`:e.endsWith(Si.COPIED_SUFFIX)?t("copy.toClipboard",{label:e.slice(0,-Si.COPIED_SUFFIX.length)}):e}function hk(e,t,n){const r=e.find(s=>s.key===n);if(r)return t==="user"?r.values.user:r.values.workspace}function zbt({onSessionIdChange:e,onSessionCreated:t,theme:n,onThemeChange:r,language:s,onLanguageChange:i,className:o,style:a,onConnectionChange:l,onStreamingStateChange:u,onError:d,onBugReport:h,hiddenSlashCommands:m,slashCommandCategoryOrder:p,builtinAtProviders:g,atProviders:b,composerTagIcons:x,renderToolHeaderExtra:v,renderWelcomeHeader:y,renderWelcomeFooter:w,mobileWelcomeFooterMiddle:k=!1,parseUserMessageContent:T,renderUserMessageContent:S,renderComposerTag:C,renderComposerTagTooltip:_,onComposerTagClick:A,renderAssistantTurnFooter:M,renderComposerToolbarStart:L,renderComposerToolbarEnd:N,renderComposerToolbarRight:O,renderComposerHeader:B,renderFooter:$,bottomStatusItems:P,chatMaxWidth:K,sidebar:F,splitSessionIds:H,onSplitSessionIdsChange:D,onRightPanelOpen:Q,messageTurnOutputs:U,shellRef:j,composerToolbarActions:ie,composerPlaceholders:oe,compactThinking:J=!1,collapseCompletedTurns:V=!0,markdownTableMode:se="basic",virtualScrollThreshold:Z,markdown:X,loadingPhrases:te,onTranscriptChange:ae,onToast:xe,composerRef:Ae,onComposerReady:Ne,composerInput:Le,composerInputVersion:ge,onSessionChange:Oe,onSubmitBefore:Nt,lockedWorkspaceCwd:Pe,lockedWorkspaceCapability:Ce}={}){var $I,zI,FI,qI;const[Zt,dt]=f.useState(Sbt),[Ge,St]=f.useState(()=>s===void 0?Ebt():Ku(s)),Y=f.useMemo(()=>q9(Ge),[Ge]),je=f.useMemo(()=>wbt(F),[F]),[We,Te]=f.useState(()=>kbt(je.defaultCollapsed)),[jt,zt]=f.useState(null),[bn,Pn]=f.useState(!1),[qe,At]=f.useState(!1),he=f.useCallback(()=>{Pn(!1),At(!1)},[]),Be=BF(),Ie=BF("(min-width: 1200px)");f.useEffect(()=>{je.enabled||he()},[he,je.enabled]),f.useEffect(()=>{const I=window.matchMedia("(max-width: 760px)"),q=ee=>{ee.matches||he()};return I.addEventListener("change",q),()=>I.removeEventListener("change",q)},[he]),f.useEffect(()=>{if(!bn)return;const I=me=>{if(me.key!=="Escape"||pr.current)return;const Ve=me.target;Ag(Ve)&&!(Ve!=null&&Ve.closest("[data-sidebar-shell]"))||(me.stopPropagation(),me.preventDefault(),he())},q=document.body.style.overflow;document.body.style.overflow="hidden";const ee=me=>{const Ve=me.target;Ve!=null&&Ve.closest("[data-sidebar-shell]")&&!Ve.closest(`.${Ut.mobileBackdrop}`)||me.preventDefault()};return document.addEventListener("touchmove",ee,{passive:!1}),window.addEventListener("keydown",I,!0),()=>{document.body.style.overflow=q,document.removeEventListener("touchmove",ee),window.removeEventListener("keydown",I,!0)}},[bn,he]);const Ke=f.useCallback(I=>{Te(I),_bt(I)},[]),ne=f.useMemo(()=>({composerTagIcons:x,renderToolHeaderExtra:v,renderWelcomeHeader:y,renderWelcomeFooter:w,parseUserMessageContent:T,renderUserMessageContent:S,renderComposerTag:C,renderComposerTagTooltip:_,onComposerTagClick:A,renderAssistantTurnFooter:M,renderComposerToolbarStart:L,renderComposerToolbarEnd:N,renderComposerToolbarRight:O,renderComposerHeader:B,renderFooter:$,compactThinking:J,collapseCompletedTurns:V,markdownTableMode:se,markdown:X,loadingPhrases:te}),[x,v,y,w,T,S,C,_,A,M,L,N,O,B,$,J,V,se,X,te]),De=$,Dt=B,ze=G4(),Lt=jv(),ke=il(),Ot=pd(),fe=f.useMemo(()=>{var q;const I=((q=Ot.capabilities)==null?void 0:q.workspaces)??[];return Ce&&!I.some(ee=>ee.cwd===Ce.cwd)?[...I,Ce]:I},[Ce,($I=Ot.capabilities)==null?void 0:$I.workspaces]),pt=f.useMemo(()=>Pe?fe.filter(I=>I.cwd===Pe):fe,[Pe,fe]),He=Fg(),{notices:on,dismissNotice:Ze}=xhe(),Et=ko(),[wn,qr]=f.useState(void 0),cr=f.useRef(wn);cr.current=wn;const[Jn,Ft]=f.useState(void 0);f.useEffect(()=>{var me;if(ke.sessionId){Ft(void 0);return}const I=(me=fe.find(Ve=>Ve.primary))==null?void 0:me.cwd,q=Pe??wn??I;if(!q){Ft(void 0);return}let ee=!1;return Ft(void 0),Ot.client.workspaceByCwd(q).workspaceGit().then(Ve=>{ee||Ft(Ve.branch??void 0)}).catch(()=>{ee||Ft(void 0)}),()=>{ee=!0}},[ke.sessionId,Pe,wn,fe,Ot.client]);const dn=f.useRef(xe);dn.current=xe;const sr=f.useRef(0),[Rn,Vn]=f.useState([]),Zn=f.useCallback(I=>{Vn(q=>q.filter(ee=>ee.id!==I))},[]),kn=f.useCallback((I,q)=>{if(dn.current){dn.current(I,q);return}const ee={id:`web-shell-toast-${Date.now()}-${++sr.current}`,tone:I,message:q};Vn(me=>[...me.filter(bt=>bt.tone!==I||bt.message!==q),ee].slice(-4))},[]),er=gse(Y),Ms=f.useRef(er);Ms.current=er;const[Ss,Hr]=f.useState(null),[rs,Hs]=f.useState(null),Us=f.useRef(1),Ur=f.useRef(1),Ar=f.useRef(null),Un=f.useRef(null),or=f.useRef(ke.sessionId),Cs=f.useRef(void 0),Ls=f.useRef(void 0),be=f.useRef(void 0),st=f.useRef(ke.sessionId),Ct=f.useMemo(()=>{const I=[Ss].filter(ee=>ee!==null);if(I.length===0)return Cq(er);const q=[...er];for(const ee of I.sort((me,Ve)=>me.anchorIndex-Ve.anchorIndex)){const me=ee.anchorAfterId?q.findIndex(bt=>bt.id===ee.anchorAfterId):-1,Ve=me>=0?me+1:Math.min(ee.anchorIndex,q.length);q.splice(Ve,0,ee.message)}return Cq(q)},[er,Ss]),{artifacts:Bt,loading:qt,error:tr}=bse(),[Lr,ss]=f.useState([]),[Vr,$n]=f.useState(()=>new Map),[An,Er]=f.useState([]);f.useEffect(()=>{if(Lr.length===0||Bt.length===0)return;const I=new Set(Bt.map(ee=>ee.id)),q=new Set(An.filter(ee=>ee.kind==="artifact"&&ee.workspaceActions).map(ee=>ee.kind==="artifact"?ee.artifactId:""));ss(ee=>{const me=ee.filter(Ve=>!I.has(Ve.id)||q.has(Ve.id));return me.length===ee.length?ee:me})},[Bt,Lr.length,An]);const Pr=f.useMemo(()=>Array.from(Vr.values()).flatMap(I=>[...I.artifacts]),[Vr]),de=f.useMemo(()=>{if(Lr.length===0&&Pr.length===0)return Bt;const I=[...Bt];for(const q of[...Lr,...Pr])I.findIndex(me=>me.id===q.id)<0&&I.push(q);return I},[Bt,Lr,Pr]),Ee=f.useCallback((I,q,ee)=>{$n(Ve=>{const bt=Ve.get(I);if((bt==null?void 0:bt.workspaceActions)===ee&&bt.artifacts.length===q.length&&bt.artifacts.every((Wt,lt)=>{const at=q[lt];return(at==null?void 0:at.id)===Wt.id&&at.updatedAt===Wt.updatedAt&&at.sizeBytes===Wt.sizeBytes}))return Ve;const an=new Map(Ve);return q.length===0?an.delete(I):an.set(I,{artifacts:[...q],workspaceActions:ee}),an});const me=new Set(q.map(Ve=>Ve.id));Er(Ve=>{let bt=!1;const Nn=Ve.map(an=>{if(an.kind!=="artifact"||!me.has(an.artifactId))return an;const Wt={id:an.id,kind:"artifact",title:an.title,artifactId:an.artifactId,workspaceActions:an.workspaceActions??ee};return an.previewContent!==void 0&&(bt=!0),an.workspaceActions||(bt=!0),Wt});return bt?Nn:Ve})},[]),rt=f.useMemo(()=>Ese(Ct,Bt,ke.workspaceCwd||""),[Ct,Bt,ke.workspaceCwd]),yt=f.useMemo(()=>Nse(Ct,rt,ke.workspaceCwd||""),[Ct,rt,ke.workspaceCwd]),wt=f.useMemo(()=>jse(Ct),[Ct]),mn=f.useMemo(()=>new Set(U??Bre),[U]),[we,Pt]=f.useState(!1),yn=f.useRef(we);yn.current=we;const[zn,Xn]=f.useState(null),Hn=f.useRef(zn);Hn.current=zn;const[Mr,is]=f.useState([]),[ce,ve]=f.useState(null),[Fe,ot]=f.useState(ET),_n=f.useRef(null),Yt=f.useRef(null),On=f.useRef(new Map),Ye=f.useRef(ke.sessionId);Yt.current={open:we,tabs:An,activeTabId:zn,reviewChanges:Mr,selectedReviewPath:ce,extraArtifacts:Lr,width:Fe},f.useEffect(()=>{const I=Ye.current;if(I){const me=Yt.current;if(me&&(On.current.set(I,me),On.current.size>dbt)){const Ve=On.current.keys().next().value;Ve&&On.current.delete(Ve)}}const q=ke.sessionId;Ye.current=q;const ee=q?On.current.get(q):void 0;if(!ee){Pt(!1),Er([]),Xn(null),is([]),ve(null),ss([]),$n(new Map),ot(ET);return}Pt(ee.open),Er(ee.tabs),Xn(ee.activeTabId),is(ee.reviewChanges),ve(ee.selectedReviewPath),ss(ee.extraArtifacts),$n(new Map),ot(ee.width)},[ke.sessionId]);const Tn=f.useCallback(()=>{var q;const I=(q=Un.current)==null?void 0:q.getBoundingClientRect().width;return I?Math.max(Jp,Fe+I-dk):Math.max(Jp,window.innerWidth-dk)},[Fe]),nn=f.useCallback(()=>{var ee;const I=((ee=Un.current)==null?void 0:ee.getBoundingClientRect().width)??window.innerWidth,q=Math.max(Jp,I-dk);return Math.min(q,Math.max(ET,Math.round(I*.56)))},[]),ur=f.useCallback((I,q)=>{if(!I)return;const ee=de.find(Ve=>Ve.id===I),me={id:`artifact:${I}`,kind:"artifact",artifactId:I,title:(ee==null?void 0:ee.title)??"Artifact",...q!==void 0?{previewContent:q}:{}};Er(Ve=>Ve.some(bt=>bt.id===me.id)?Ve.map(bt=>bt.id===me.id?{...bt,...me}:bt):[...Ve,me]),Xn(me.id),ot(Ve=>yn.current?Ve:nn()),Pt(!0)},[de,nn]),Nr=f.useCallback((I,q)=>{const ee={id:"review",kind:"review",title:Y("turnOutputs.review")};Er(me=>me.some(Ve=>Ve.id===ee.id)?me:[ee,...me]),Xn(ee.id),is(I),ve(q??null),ot(me=>yn.current?me:nn()),Pt(!0)},[nn,Y]),ti=f.useCallback((I,q)=>{const ee={id:`scheduled-task:${I.toolCallId}`,kind:"scheduled_task",title:Y("scheduledTasks.title"),task:I,...q?{workspaceActions:q}:{}};Er(me=>me.some(Ve=>Ve.id===ee.id)?me.map(Ve=>Ve.id===ee.id?ee:Ve):[...me,ee]),Xn(ee.id),ot(me=>yn.current?me:nn()),Pt(!0)},[nn,Y]),dr=f.useCallback(I=>{if(Q){Q(I);return}if(I.kind==="review"){Nr(I.changes,I.selectedPath);return}if(I.kind==="scheduled_task"){ti(I.task,I.workspaceActions);return}I.workspaceActions||ss(ee=>{const me=ee.findIndex(bt=>bt.id===I.artifact.id);if(me<0)return[...ee,I.artifact];const Ve=[...ee];return Ve[me]=I.artifact,Ve});const q={id:I.id,kind:"artifact",title:I.title,artifactId:I.artifactId,...I.workspaceActions?{workspaceActions:I.workspaceActions}:{},...I.previewContent!==void 0?{previewContent:I.previewContent}:{}};Er(ee=>ee.some(me=>me.id===q.id)?ee.map(me=>me.id===q.id?{...me,...q}:me):[...ee,q]),Xn(q.id),ot(ee=>yn.current?ee:nn()),Pt(!0)},[nn,Q,Nr,ti]),Yo=f.useCallback(()=>{Pt(!1),Er([]),Xn(null),is([]),ve(null),ss([]),$n(new Map)},[]);f.useLayoutEffect(()=>{if(!we)return;const I=()=>{ot(me=>{var Nn;const Ve=((Nn=Un.current)==null?void 0:Nn.getBoundingClientRect().width)??window.innerWidth-me,bt=Math.max(Jp,me+Ve-dk);return Math.min(me,bt)})};I(),window.addEventListener("resize",I);const q=Un.current,ee=new ResizeObserver(I);return q&&ee.observe(q),()=>{window.removeEventListener("resize",I),ee.disconnect()}},[we]);const cs=f.useCallback(I=>{Er(q=>{const ee=q.filter(me=>me.id!==I);if(ee.length===0)return Pt(!1),Xn(null),is([]),ve(null),ss([]),$n(new Map),ee;if(Hn.current===I){const me=q.findIndex(bt=>bt.id===I),Ve=ee[Math.min(me,ee.length-1)]??ee[0];Xn(Ve.id)}return ee})},[]),Ns=f.useCallback(I=>{I.preventDefault();const q=I.currentTarget;q.setPointerCapture(I.pointerId);const ee=I.clientX,me=Fe,Ve=Tn(),bt=document.body.style.cursor,Nn=document.body.style.userSelect;let an=me,Wt=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const lt=()=>{Wt=null,ot(an)},at=us=>{an=Math.min(Ve,Math.max(Jp,me-(us.clientX-ee))),Wt===null&&(Wt=window.requestAnimationFrame(lt))};let Wn=()=>{};const Qn=us=>{_n.current=null,Wt!==null&&(window.cancelAnimationFrame(Wt),Wt=null),us&&ot(an),q.hasPointerCapture(I.pointerId)&&q.releasePointerCapture(I.pointerId),document.body.style.cursor=bt,document.body.style.userSelect=Nn,window.removeEventListener("pointermove",at),window.removeEventListener("pointerup",Wn),window.removeEventListener("pointercancel",Wn)};Wn=()=>Qn(!0),_n.current=()=>Qn(!1),window.addEventListener("pointermove",at),window.addEventListener("pointerup",Wn),window.addEventListener("pointercancel",Wn)},[Fe,Tn]);f.useEffect(()=>()=>{var I;return(I=_n.current)==null?void 0:I.call(_n)},[]);const $e=O1t(Lt),ht=f.useMemo(()=>G8($e),[$e]),Tt=q1t(ht),xn=!(ke.catchingUp&&jt!==null),Sn=mE(Tt)&&xn?Tt:null,En=Tt&&!mE(Tt)&&xn?Tt:null,pr=f.useRef(Tt);pr.current=xn?Tt:null;const yr=En!==null||Sn!==null,ps=f.useRef(yr);ps.current=yr||xn&&G8(Lt)!==null;const Gi=f.useMemo(()=>Jqe(er),[er]),Ca=f.useRef(null),To=f.useMemo(()=>{const I=eHe(er),q=Ca.current;if(q&&q.signature===I)return q.timeline;const ee=Zqe(er);return Ca.current={signature:I,timeline:ee},ee},[er]),Ta=f.useRef(null),fu=f.useMemo(()=>{const I=tHe(er),q=Ta.current;if(q&&q.signature===I)return q.details;const ee=aHe(er);return Ta.current={signature:I,details:ee},ee},[er]),Or=H1t(Gi.todos,I=>`${I.id}:${I.status}:${I.content}`),Xo=Gi.allCompleted,[Ad,Ed]=f.useState("hidden"),mu=ke.catchingUp||Or.length===0||Xo?"hidden":"active";mu!==Ad&&Ed(mu);const pu=mu!=="hidden",ql=P??vbt,jf=pu||ql.length>0,ni=f.useRef(null),Md=f.useRef(null),[cl,If]=f.useState(null),cc=f.useRef(new Set),c1=f.useRef(null),[Rf,Df]=f.useState(0),[u1,d1]=f.useState(0);f.useLayoutEffect(()=>{if(!jf){Df(0),d1(0);return}const I=c1.current;if(!I){Df(jq),d1(0);return}const q=()=>{const me=ni.current,Ve=I.getBoundingClientRect(),bt=me==null?void 0:me.getBoundingClientRect(),Nn=Math.ceil(Ve.height),an=bt?Math.max(0,bt.top-Ve.top):Nn+Nq;d1(Nn),Df(Math.max(jq,Math.ceil(an)))};if(q(),typeof ResizeObserver>"u")return;const ee=new ResizeObserver(q);return ee.observe(I),ni.current&&ee.observe(ni.current),()=>ee.disconnect()},[jf]);const kp=f.useMemo(()=>({"--web-shell-bottom-panel-inset":`${Rf}px`,"--web-shell-bottom-panel-height":`${u1}px`,"--web-shell-bottom-panel-gap":`${Nq}px`}),[u1,Rf]),L3=f.useMemo(()=>Obt(er),[er]),[P3,O3]=f.useState(0),Lf=z1t(L3,ke.status==="connected",P3),h1=f.useMemo(()=>$?Lf.map(Bbt):[],[Lf,$]),lx=f.useRef(null),Pf=f.useRef(null),xi=f.useRef(null),f1=f.useRef(null),[m1,cx]=f.useState(!1),p1=f.useRef(null),g1=f.useRef(!1),ul=f.useCallback((I="smooth")=>{requestAnimationFrame(()=>{var q;(q=Pf.current)==null||q.scrollToBottom(I),requestAnimationFrame(()=>{var ee;(ee=Pf.current)==null||ee.scrollToBottom(I)})})},[]),Nd=f.useCallback(I=>{xi.current=I,Iq(Ae,I??Mq),I&&f1.current!==I&&(f1.current=I,Ne==null||Ne(I))},[Ae,Ne]);f.useEffect(()=>{Iq(Ae,xi.current??Mq)},[Ae]);const[Hl,gu]=f.useState(null),[B3,ux]=f.useState(!1),Of=f.useRef(!1),b1=f.useRef(null);b1.current=Hl;const{followupState:$3,onAcceptFollowup:y1,onDismissFollowup:z3,clear:_p}=vW({onAccept:I=>{var q;(q=xi.current)==null||q.insertText(I)}}),Gr=K4(),uc=f.useRef(Gr),v1=f.useRef(Date.now()),dx=f.useRef(Gr);dx.current==="idle"&&Gr!=="idle"&&(v1.current=Date.now()),dx.current=Gr;const Ul=f.useMemo(()=>{if(Gr!=="idle"){for(let I=Ct.length-1;I>=0;I--){const q=Ct[I];if((q==null?void 0:q.role)==="user")return q.timestamp??v1.current}return v1.current}},[Ct,Gr]),jd=f.useRef(""),Sp=f.useRef(void 0),Id=f.useRef(null),Rd=f.useRef(null),[Cp,Bf]=f.useState(!1),Tp=f.useRef(Cp);Tp.current=Cp;const dl=ke.status==="connected",[Ap,x1]=f.useState([]);f.useEffect(()=>{dl&&Et.loadSkillsStatus().then(I=>{x1(Eq(I))}).catch(()=>{})},[dl,Et]);const[ri,Qo]=f.useState(null),w1=f.useRef(ri),[co,Dd]=f.useState("workspace"),[bu,G]=f.useState(!1),_e=f.useRef(bu),[Re,Qe]=f.useState([]),[vt,Dn]=f.useState(!1),[Mn,Br]=f.useState(!1),[Qr,Ao]=f.useState(!1),[Ld,wi]=f.useState(!1),[$f,Pd]=f.useState(!1),[Eo,uo]=f.useState(!1),[$r,F3]=f.useState(!1),[qj,Hj]=f.useState(!1),[Ri,Ki]=f.useState("chat"),[Ep,q3]=f.useState([]),H3=f.useRef(Ep);H3.current=Ep;const[hx,U3]=f.useState(null),[vr,Od]=f.useState(null),ho=f.useCallback(()=>Od(null),[]),Aa=f.useCallback(I=>{Ki("chat"),Od(I)},[]),wie=f.useCallback(async()=>{const I=await Et.loadMcpStatus();U3({status:I,toolsByServer:{},resourcesByServer:{},showDescriptions:!1,showSchema:!1,showTips:!1})},[Et]),V3=f.useCallback(()=>{Od(null),Ki("scheduledTasks")},[]),Uj=f.useCallback(()=>{je.enabled&&(Od(null),Ki("chat"),At(!0),Pn(!0))},[je.enabled]),Mp=f.useCallback(I=>{Od(null),q3(q=>{const ee=Array.from(new Set((I??[]).filter(Boolean))).slice(0,J0);return ee.length>0?ee:q.length>0?q:ke.sessionId?[ke.sessionId]:[]}),Ki("split")},[ke.sessionId]),W3=f.useMemo(()=>Array.from(new Set((H??[]).filter(Boolean))).slice(0,J0).join("\0"),[H]),Ea=H!==void 0,dc=f.useRef(D);dc.current=D;const Vj=f.useCallback(()=>{var q;if(!Ea){Mp();return}const I=Ep.length>0?Ep:ke.sessionId?[ke.sessionId]:[];(q=dc.current)==null||q.call(dc,I)},[ke.sessionId,Ea,Mp,Ep]);f.useEffect(()=>{if(!Ea)return;const I=W3?W3.split("\0"):[];q3(q=>Abt(q,I)?q:I),I.length>0?(Od(q=>q===null?q:null),Ki(q=>q==="split"?q:"split")):Ki(q=>q==="split"?"chat":q)},[Ea,W3]);const kie=f.useCallback(I=>{var q;Ea||q3(I),(q=dc.current)==null||q.call(dc,I)},[Ea]),fx=f.useCallback(()=>{var I;Ea&&((I=dc.current)==null||I.call(dc,[]))},[Ea]),_ie=f.useCallback(()=>{fx(),Aa("sessions")},[fx,Aa]);f.useEffect(()=>{const I=lit(window.location.search);if(I.length===0)return;const q=new URL(window.location.href);q.searchParams.delete("split"),window.history.replaceState(null,"",q),Ea||Mp(I)},[Ea,Mp]);const G3=f.useRef(!1),K3=f.useRef(!1);f.useEffect(()=>{if(Be){K3.current&&(K3.current=!1,!Ea&&H3.current.length>0&&Ki(I=>I==="chat"?"split":I));return}if(vr==="sessions"&&Od(null),Ri==="split"&&(fx(),Ki("chat"),G3.current=!0,!Ea)){K3.current=!0;const I=H3.current[0];I&&!or.current&&He.loadSession(I).catch(()=>{})}},[Be,vr,Ri,fx,Ea,He]),f.useEffect(()=>{var I;Ri!=="chat"||!G3.current||(G3.current=!1,!vr&&!yr&&((I=xi.current)==null||I.focus()))},[Ri,vr,yr]);const Wj=f.useRef(null),Gj=f.useRef(null),Kj=f.useRef(null),Yj=f.useRef(vr),Xj=f.useRef(yr);f.useEffect(()=>{var ee,me,Ve,bt,Nn;const I=Yj.current,q=Xj.current;if(Yj.current=vr,Xj.current=yr,vr){if(vr==="extensions"){(ee=Gj.current)==null||ee.focus();return}if(vr==="plugins"){(me=Kj.current)==null||me.focus();return}(Ve=Wj.current)==null||Ve.focus()}else I?yr||(bt=xi.current)==null||bt.focus():q&&!yr&&((Nn=xi.current)==null||Nn.focus())},[vr,yr]),f.useEffect(()=>{yr&&(vr&&Od(null),ri&&Qo(null),vt&&Dn(!1),Ri==="scheduledTasks"&&Ki("chat"))},[yr,vr,ri,vt,Ri]);const Y3=f.useRef(null),mx=En!==null&&!vr&&ri===null&&!vt&&Ri==="chat",Qj=f.useRef(mx);f.useEffect(()=>{var q;const I=Qj.current;Qj.current=mx,mx&&!I&&((q=Y3.current)==null||q.focus())},[mx]);const[Jj,Zj]=f.useState(!1),[zf,X3]=f.useState(!1),eI=f.useRef(zf),[Sie,Cie]=f.useState(0),[Tie,Aie]=f.useState(0),[Eie,tI]=f.useState(0),Mie=f.useCallback(()=>{let I=!1;return tI(q=>q+1),()=>{I||(I=!0,tI(q=>Math.max(0,q-1)))}},[]),Mo=gd(),nI=f.useRef((Mo==null?void 0:Mo.extensionsVersion)??0);f.useEffect(()=>{const I=(Mo==null?void 0:Mo.extensionsVersion)??0;if(I!==nI.current){nI.current=I;const q=Mo==null?void 0:Mo.lastExtensionChange;if((q==null?void 0:q.status)==="failed"){ze.dispatch([{type:"error",text:Y("extensions.action.failed",{name:q.name??"",source:q.source??"",error:q.error??Y("error.unknown")})}]);return}if((q==null?void 0:q.status)==="installed"){const ee=q.name??q.source??Y("extensions.label");ze.dispatch([{type:"status",text:q.version?Y("extensions.install.installedWithVersion",{name:ee,version:q.version}):Y("extensions.install.installed",{name:ee})}])}else if(q!=null&&q.status){const ee=q.name??q.source??Y("extensions.label"),me=q.status==="updated"&&q.version?"extensions.manage.updatedWithVersion":`extensions.manage.${q.status}`;ze.dispatch([{type:"status",text:Y(me,{name:ee,version:q.version??""})}])}He.refreshCommands().catch(()=>{ze.dispatch([{type:"error",text:Y("extensions.commands.refreshFailed")}])})}},[Mo==null?void 0:Mo.extensionsVersion,Mo==null?void 0:Mo.lastExtensionChange,He,ze,Y]);const[Nie,jie]=f.useState("workspace"),[k1,Q3]=f.useState(null),[Iie,rI]=f.useState(!1),[Rie,sI]=f.useState(!1),px=f.useRef(null),Np=f.useRef(null),[J3,gx]=f.useState(null),[Ff,Z3]=f.useState(n??As.Dark),[Bd,iI]=f.useState(""),bx=f.useRef(Bd);bx.current=Bd;const jp=f.useCallback(I=>{bx.current=I,iI(I)},[]),os=f.useRef(ke);os.current=ke;const Di=f.useCallback(()=>os.current.sessionId?!0:(kn("info",Y("localCommand.noSession")),!1),[kn,Y]),oI=ke.displayName,[hl,eC]=f.useState("default"),tC=f.useRef(hl);tC.current=hl;const _1=f.useCallback(I=>{tC.current=I,eC(I)},[]),[nC,qf]=f.useState(!1),S1=f.useRef(null),rC=f.useRef(null),aI=f.useRef(t);aI.current=t;const lI=f.useCallback(()=>{const I=os.current.sessionId;if(S1.current)return!I||I===rC.current?S1.current:Promise.resolve();if(I)return Promise.resolve();const q=(async()=>{var Nn;const me=bx.current||os.current.currentModel,Ve=tC.current||os.current.currentMode,bt=(Nn=fe.find(an=>an.primary))==null?void 0:Nn.cwd;await jot({sessionActions:He,modelId:me,modeId:Ve,workspaceCwd:Pe??cr.current??bt,onSessionCreated:aI.current,onSessionAllocated:an=>{rC.current=an},getCurrentSessionId:()=>os.current.sessionId}),qr(void 0)})();S1.current=q;const ee=()=>{S1.current===q&&(S1.current=null,rC.current=null)};return q.then(ee,ee),q},[Pe,He,fe]),yu=f.useRef(Nt);yu.current=Nt;const[cI,uI]=f.useState(0),C1=f.useRef(null);f.useEffect(()=>()=>{C1.current!==null&&clearTimeout(C1.current)},[]);const dI=f.useCallback(I=>{Oe==null||Oe(I),uI(q=>q+1)},[Oe]),fo=f.useRef(dI);fo.current=dI;const Jo=f.useCallback(async(I,q,ee)=>{var Qn,us;const me=!I.trimStart().startsWith("/"),Ve=jd.current,bt=Sp.current,Nn=Rd.current,an=Tp.current;!(ee!=null&&ee.retry)&&me&&(jd.current=I,Sp.current=q,Rd.current=null),Bf(!1);const Wt=!os.current.sessionId;if(yu.current){qf(!0);try{await yu.current({sessionId:os.current.sessionId,prompt:I})}catch(Ps){console.warn("[web-shell] onSubmitBefore rejected, prompt cancelled",Ps),qf(!1),jd.current=Ve,Sp.current=bt,Rd.current=Nn,Bf(an);return}Wt||qf(!1)}!yu.current&&Wt&&qf(!0),_p();try{await lI()}finally{Wt&&qf(!1)}const lt={images:q,inputAnnotations:ee==null?void 0:ee.inputAnnotations,optimisticUserMessage:ee==null?void 0:ee.optimisticUserMessage,retry:ee==null?void 0:ee.retry,...ee!=null&&ee.onAdmitted?{onAdmitted:ee.onAdmitted}:{}};ee!=null&&ee.commitComposerAccepted?ee.commitComposerAccepted():ee!=null&&ee.clearComposerOnPromptStart&&((Qn=xi.current)==null||Qn.clear());const at=os.current.sessionId;return at&&I.trim()&&((us=fo.current)==null||us.call(fo,{type:"submit",sessionId:at,prompt:I,queued:!1}),C1.current!==null&&clearTimeout(C1.current),C1.current=setTimeout(()=>{uI(Ps=>Ps+1)},2e3)),await He.sendPrompt(I,lt)},[_p,lI,He]),Die=f.useMemo(()=>(ke.models??[]).filter(jb).map(I=>({id:I.id,label:Tm(I.label||I.id)})),[ke.models]),vu=Mn||Qr||Ld||$f||Eo||$r||qj||ri!==null||vt||J3!==null||hx!==null||k1!==null||Jj||zf||Eie>0||vr!==null||Ri!=="chat",hn=f.useCallback((I,q)=>{if(NT(I)||$V(I)||Zp(I))return;const ee=Mbt(I,q);console.error("[web-shell]",ee,I),kn("error",ee)},[kn]),Lie=f.useCallback(I=>kn("success",I),[kn]),{queuedPrompts:Pie,queuedTexts:Oie,enqueuePrompt:sC,removeQueuedPrompt:Bie,insertQueuedPrompt:$ie,editQueuedPrompt:zie,editLastQueuedPrompt:Fie,clearQueuedPrompts:qie}=vse({connected:dl,sessionId:ke.sessionId,clientId:ke.clientId,streamingState:Gr,sessionActions:He,store:ze,editorRef:xi,reportError:hn,notifySuccess:Lie,t:Y}),Hf=f.useCallback((I,q,ee,me,Ve)=>{var an;if(yu.current)return yu.current({sessionId:os.current.sessionId,prompt:I}).then(()=>{var at,Wn;sC(I,q,ee,Ve)!==!1&&(me?me():(at=xi.current)==null||at.clear());const lt=os.current.sessionId;lt&&I.trim()&&((Wn=fo.current)==null||Wn.call(fo,{type:"submit",sessionId:lt,prompt:I,queued:!0}))}).catch(Wt=>{console.warn("[web-shell] onSubmitBefore rejected queued prompt, cancelled",Wt)}),!1;const bt=sC(I,q,ee,Ve),Nn=os.current.sessionId;return Nn&&I.trim()&&((an=fo.current)==null||an.call(fo,{type:"submit",sessionId:Nn,prompt:I,queued:!0})),bt},[sC]);f.useEffect(()=>{for(const I of on)Nbt(I)?kn(jbt(I),I.message):I.category!=="lifecycle"&&console.warn("[web-shell] daemon notice",I),Ze(I.id)},[Ze,on,kn]);const iC=f.useRef(h);iC.current=h,f.useEffect(()=>{var I;or.current=ke.sessionId,(I=Ar.current)==null||I.abort(),Ar.current=null,Hr(null),Hs(null),gx(null),_x.current=0},[ke.sessionId]);const hI=f.useCallback(()=>{var Ve;if(!Di())return;const I=`local-recap-${Us.current++}`,q=er.length,ee=(Ve=er.at(-1))==null?void 0:Ve.id,me=ke.sessionId;Hr({anchorAfterId:ee,anchorIndex:q,message:{id:I,role:"system",content:`※ ${Y("recap.label")}: ${Y("recap.loading")}`,variant:"info",source:"recap"}}),He.recapSession().then(bt=>{or.current===me&&Hr({anchorAfterId:ee,anchorIndex:q,message:{id:I,role:"system",content:bt.recap?`※ ${Y("recap.label")}: ${bt.recap}`:Y("recap.empty"),variant:"info",source:"recap"}})},bt=>{or.current===me&&(Hr(null),!NT(bt)&&!Zp(bt)&&console.warn("[web-shell] unhandled recap failure",bt))})},[ke.sessionId,er,Di,He,Y]),fI=f.useCallback(I=>{var bt;const q=I.trim();if(!q){kn("error",Y("btw.empty"));return}if(!Di())return;const ee=`local-btw-${Ur.current++}`,me=ke.sessionId;(bt=Ar.current)==null||bt.abort();const Ve=new AbortController;Ar.current=Ve,Hs({id:ee,role:"btw",question:q,answer:"",isPending:!0}),He.btwSession(q,{signal:Ve.signal}).then(Nn=>{or.current===me&&Ar.current===Ve&&(Ar.current=null,Hs({id:ee,role:"btw",question:q,answer:Nn.answer||Y("btw.emptyAnswer"),isPending:!1}))},Nn=>{or.current===me&&Ar.current===Ve&&(Ar.current=null,Hs(null),!NT(Nn)&&!Zp(Nn)&&console.warn("[web-shell] unhandled btw failure",Nn))})},[ke.sessionId,kn,Di,He,Y]),mI=f.useCallback(()=>{var I;(I=Ar.current)==null||I.abort(),Ar.current=null,Hs(null)},[]);f.useEffect(()=>{const I=q=>{var Nn;if(vu||Tt)return;const ee=rs;if(!ee||ee.role!=="btw")return;const me=q.key.toLowerCase(),Ve=q.key==="Escape"&&!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey,bt=q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(me==="c"||me==="d");if(ee.isPending){if(!Ve&&!bt)return}else{const an=((Nn=xi.current)==null?void 0:Nn.hasInput())??!1;if(!(!q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey&&(q.key==="Escape"||!an&&(q.key==="Enter"||q.key===" "))))return}q.preventDefault(),q.stopPropagation(),mI()};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[vu,rs,mI,Tt]);const hc=f.useCallback((I,q)=>Eot(uc.current!=="idle",I,q,{append:ee=>ze.appendLocalUserMessage(ee)}),[ze]),fc=f.useCallback(()=>(kn("error",Y("queue.commandBlocked")),!1),[kn,Y]),T1=f.useCallback(I=>{Z3(I),r==null||r(I)},[r]),Ip=f.useCallback(I=>{St(I),i==null||i(I)},[i]),pI=f.useCallback(()=>{uo(!0)},[]),gI=yW({autoLoad:!0}),yx=Mhe({autoLoad:!0}),vx=yx.reload,[Hie,xx]=f.useState(!1),{settings:$d,setValue:fl,reload:zd}=gI,Rp=$d.find(I=>I.key===ym),Dp=$d.find(I=>I.key===mbt),Lp=$d.find(I=>I.key===W2),Uie=(()=>{const I=hk($d,co,"voiceModel");return typeof I=="string"&&I.trim()?I.trim():void 0})(),Vie=(()=>{const I=hk($d,co,"visionModel");if(!(typeof I!="string"||!I.trim()))return obt(I.trim())})(),Wie=(()=>{const I=hk($d,co,"fastModel");return typeof I=="string"&&I.trim()?I.trim():void 0})(),Gie=f.useMemo(()=>{const I=hk($d,co,"modelFallbacks");return typeof I=="string"?I.split(",").map(q=>q.trim()).filter(Boolean):[]},[$d,co]),Kie=f.useMemo(()=>{const I=new Set,q=[];for(const ee of(ke.models??[]).filter(jb).filter(me=>!me.isRuntime)){const me=ee.baseModelId??Aq(ee.id);I.has(me)||(I.add(me),q.push({baseId:me,label:Tm(ee.label||ee.baseModelId||ee.id)}))}return q},[ke.models]),[wx,bI]=f.useState(!1),oC=f.useRef(wx);oC.current=wx,f.useEffect(()=>{if(n){Z3(n);return}const I=H9(Rp==null?void 0:Rp.values.effective);I&&Z3(I)},[n,Rp==null?void 0:Rp.values.effective]),f.useEffect(()=>{if(s!==void 0){St(Ku(s));return}const I=z9(Lp==null?void 0:Lp.values.effective);I&&St(I)},[s,Lp==null?void 0:Lp.values.effective]);const Yie=f.useCallback((I,q="user")=>{const ee=Ge,Ve=`/language ui ${I}${q==="workspace"?" --project":" --global"}`;Ip(I);const bt=()=>Promise.all([He.refreshCommands(),zd()]);if(uc.current!=="idle"){Ip(ee),fc();return}Jo(Ve,void 0).then(bt).catch(Nn=>{Ip(ee),hn(Nn,"Failed to sync /language command")})},[fc,Ip,zd,hn,Jo,Ge,He]),yI=f.useCallback(()=>{if(uc.current!=="idle"){ze.dispatch([{type:"status",text:Y("clear.blocked")}]);return}ze.reset()},[ze,Y]),vI=f.useCallback(()=>{const I=oC.current,q=!oC.current;bI(q),fl("workspace",fbt,q).catch(ee=>{bI(I),hn(ee,Y("compact.saveFailed"))})},[hn,fl,Y]),Fd=f.useCallback(I=>{if(!v4(I)){hn(new Error(`Unsupported approval mode: ${I}`),Y("local.approvalMode"));return}if(!os.current.sessionId){_1(I);return}He.setApprovalMode(I).then(q=>{const ee=q.mode||I;eC(ee);const me=pr.current;if(!me)return;if(I==="yolo"||I==="auto-edit"&&Dbt(me)){const bt=me.options.find(Nn=>Nn.kind==="allow_once");if(bt){const Nn=me.title||"";ze.dispatch([{type:"status",text:Y("mode.autoApproved",{tool:Nn})}]),He.submitPermission(me.id,bt.id).catch(an=>{hn(an,"Failed to auto-approve tool call")})}}}).catch(q=>{hn(q,Y("local.approvalMode"))})},[He,hn,ze,Y,_1]);f.useEffect(()=>{uc.current=Gr},[Gr]),f.useEffect(()=>{w1.current=ri,_e.current=bu,eI.current=zf},[ri,bu,zf]),f.useEffect(()=>{let I=null;for(let ee=Lt.length-1;ee>=0;ee--){const me=Lt[ee];if((me==null?void 0:me.kind)==="user")break;if((me==null?void 0:me.kind)==="error"&&me.source==="turn_error"){I=me.id;break}if((me==null?void 0:me.kind)!=="debug")break}const q=dl&&I!==null&&I!==Rd.current&&jd.current.length>0;Id.current=q?I:null,Bf(q)},[Lt,dl]),f.useEffect(()=>{u==null||u(Gr)},[Gr,u]);const xI=f.useRef(Gr),wI=f.useRef(void 0);f.useEffect(()=>{var q;const I=xI.current;if(xI.current=Gr,Gr!=="idle"&&(wI.current=os.current.sessionId),I!=="idle"&&Gr==="idle"){const ee=os.current.sessionId;if(!ee||ee!==wI.current)return;const me=Id.current!=null?new Error(`Turn error (block ${Id.current})`):void 0;(q=fo.current)==null||q.call(fo,{type:"turn_complete",sessionId:ee,error:me})}},[Gr]),f.useEffect(()=>{l==null||l(ke.status)},[ke.status,l]),f.useEffect(()=>{ae==null||ae(Lt)},[Lt,ae]),f.useEffect(()=>{if(ke.error){const I=new Error(ke.error);d==null||d(I)}},[ke.error,d]),f.useEffect(()=>{iI(ke.currentModel??"")},[ke.currentModel,ke.sessionId]),f.useEffect(()=>{eC(ke.currentMode??"default")},[ke.currentMode,ke.sessionId]),f.useEffect(()=>{const I=st.current;if(ke.sessionId&&ke.sessionId!==I&&gu(null),st.current=ke.sessionId,!ke.sessionId&&ke.missingSession){Cs.current=ke.sessionId,Ls.current=void 0,be.current=void 0;return}const q=fe.find(me=>me.cwd===ke.workspaceCwd);if(ke.sessionId&&!Ot.capabilities)return;const ee=q&&!q.primary?q.id:void 0;Cs.current===ke.sessionId&&Ls.current===ee&&be.current===ke.workspaceCwd||(Cs.current=ke.sessionId,Ls.current=ee,be.current=ke.workspaceCwd,e==null||e(ke.sessionId,ee,ke.workspaceCwd))},[ke.missingSession,ke.sessionId,ke.workspaceCwd,e,Ot.capabilities,fe]);const kI=f.useRef(void 0),aC=f.useRef(void 0);f.useEffect(()=>{var ee;const I=ke.sessionId,q=ke.displayName;if(!(!I||!q)){if(I!==kI.current){kI.current=I,aC.current=q;return}q!==aC.current&&(aC.current=q,(ee=fo.current)==null||ee.call(fo,{type:"rename",sessionId:I,newName:q}))}},[ke.sessionId,ke.displayName]),f.useEffect(()=>{const I=ybt(Lt);gu(q=>I?(q==null?void 0:q.condition)===I.condition&&q.setAt===I.setAt?q:I:q&&null)},[Lt]),f.useEffect(()=>{const I=q=>{const ee=q.detail;if(!(ee!=null&&ee.active)){gu(null);return}ee.condition&&gu({condition:ee.condition,setAt:ee.setAt??Date.now()})};return window.addEventListener(rE,I),()=>window.removeEventListener(rE,I)},[]);const kx=f.useRef(null),_x=f.useRef(0);f.useEffect(()=>{_x.current=0},[ke.sessionId]),f.useEffect(()=>{function ee(){if(document.hidden){kx.current===null&&(kx.current=Date.now());return}const me=kx.current;if(kx.current=null,me===null||Date.now()-me<18e4||uc.current!=="idle"||!ke.sessionId)return;const Ve=ze.getSnapshot().blocks.length;Ve-_x.current<4||(_x.current=Ve,He.recapSession().then(bt=>{bt.recap&&ze.dispatch([{type:"status",text:`※ ${Y("recap.label")}: ${bt.recap}`,source:"recap"}])},bt=>{console.error("[auto-recap] failed:",bt)}))}return document.addEventListener("visibilitychange",ee),()=>document.removeEventListener("visibilitychange",ee)},[ke.sessionId,He,ze,Y]);const lC=f.useCallback(()=>{const I=v4(hl)?cb.indexOf(hl):-1,q=cb[(I+1)%cb.length];Fd(q)},[hl,Fd]),A1=f.useCallback((I,q)=>{Di()&&(hc(I)||He.getContextUsage({detail:q}).then(ee=>{ze.dispatch([{type:"status",text:UOe(ee)}]),ul("smooth")}).catch(ee=>{hn(ee,"Failed to load context usage")}))},[hc,ze,Di,He,hn,ul]),Xie=f.useCallback(()=>{A1("/context detail",!0)},[A1]),Sx=f.useCallback(I=>{Di()&&He.branchSession(I||void 0).then(q=>{ze.dispatch([{type:"status",text:Y("branch.success",{name:q.displayName})}])}).catch(q=>{hn(q,Y("branch.failed"))})},[hn,Di,He,ze,Y]),Qie=f.useCallback(()=>{Sx()},[Sx]),E1=f.useRef(0),Cx=f.useCallback(I=>{const q=++E1.current;return window.setTimeout(()=>{var ee;q!==E1.current||ps.current||I!==void 0&&os.current.sessionId!==I||(ee=xi.current)==null||ee.focus()},0),q},[]),xu=f.useCallback(async I=>{const q=Pe??I;cr.current=q,qr(q),he(),ho(),Ki("chat");let ee;try{const me=He.clearSession();return ee=Cx(),await me,!0}catch(me){return E1.current===ee&&(E1.current+=1),hn(me,"Failed to start a new chat"),!1}},[he,ho,Pe,hn,Cx,He]),_I=f.useMemo(()=>({openSplitView:()=>{he(),Vj()},openSessionOverview:()=>{he(),Aa("sessions")},openSessionDrawer:Uj,createNewSession:()=>xu()}),[he,xu,Aa,Uj,Vj]);f.useEffect(()=>{Rq(j,_I)},[_I,j]),f.useEffect(()=>()=>{Rq(j,null)},[j]);const Jie=f.useCallback(async()=>{if(!Of.current){Of.current=!0,ux(!0);try{await xu()&&(e==null||e(void 0))}finally{Of.current=!1,ux(!1)}}},[xu,e]),Pp=f.useCallback(async(I,q)=>{E1.current+=1,zt(I),he(),ho();try{await He.loadSession(I,{workspaceCwd:q})}catch(ee){throw zt(me=>me===I?null:me),ee}},[he,ho,He]),cC=f.useCallback(I=>{Ki("chat"),Pp(I).catch(q=>{hn(q,"Failed to open session")})},[Pp,hn]);f.useEffect(()=>{const I=q=>{const ee=q.detail;typeof ee=="string"&&ee&&cC(ee)};return window.addEventListener("qwen:open-session",I),()=>window.removeEventListener("qwen:open-session",I)},[cC]),f.useEffect(()=>{jt!==null&&ke.sessionId===jt&&!ke.loadingTranscript&&!ke.catchingUp&&(zt(null),Cx(jt))},[ke.catchingUp,ke.loadingTranscript,ke.sessionId,Cx,jt]);const Uf=f.useRef(null),uC=f.useCallback(I=>{const q=Uf.current;q&&q.sessionId===I&&(clearTimeout(q.timer),Uf.current=null)},[]),Tx=f.useCallback(I=>new Promise((q,ee)=>{let me=!1;Jo(I,void 0,{onAdmitted:()=>{me||(me=!0,q())}}).then(()=>{me||ee(new Error("Run was cancelled before it started"))},bt=>{me||ee(bt)})}),[Jo]),Ax=f.useCallback(()=>{const I=Uf.current,q=os.current;!I||q.sessionId!==I.sessionId||q.loadingTranscript||q.catchingUp||(clearTimeout(I.timer),Uf.current=null,Tx(I.prompt).then(()=>I.resolve(),ee=>I.reject(ee)))},[Tx]),Zie=f.useCallback((I,q)=>{if(Ki("chat"),!q)return Tx(I);const ee=Uf.current;return ee&&(clearTimeout(ee.timer),Uf.current=null,ee.reject(new Error("superseded by another run"))),new Promise((me,Ve)=>{const bt=setTimeout(()=>{uC(q),Ve(new Error("Timed out switching to the task session"))},hbt);Uf.current={sessionId:q,prompt:I,resolve:me,reject:Ve,timer:bt},Pp(q).then(()=>Ax()).catch(Nn=>{uC(q),Ve(Nn)})})},[Tx,Pp,uC,Ax]);f.useEffect(()=>{Ax()},[ke.sessionId,ke.loadingTranscript,ke.catchingUp,Ax]);const dC=f.useCallback(()=>{Di()&&He.getTasks().then(I=>{gx({snapshot:I})}).catch(I=>{hn(I,"Failed to load tasks")})},[hn,Di,He]),SI=f.useCallback((I,q)=>{gu({condition:I,setAt:q}),ze.dispatch([{type:"status",text:Nz({kind:"set",condition:I,setAt:q})}])},[ze]),CI=f.useCallback(I=>{I&&(ze.dispatch([{type:"status",text:Nz({kind:"cleared",condition:I.condition,durationMs:Date.now()-I.setAt})}]),gu(null))},[ze]),Ex=f.useCallback(I=>Di()?(ze.appendLocalUserMessage(I),He.clearGoal().catch(q=>{hn(q,"Failed to clear /goal")}),!0):!1,[hn,Di,He,ze]),eoe=f.useCallback(()=>He.getRewindSnapshots(),[He]),toe=f.useCallback(I=>He.rewindSession(I,{rewindFiles:!1}).then(()=>{}),[He]),noe=f.useCallback(I=>{if(Zp(I))return;const q=I instanceof Error?I.message:String(I);kn("error",Y("rewind.failed",{reason:q}))},[kn,Y]),TI=f.useCallback((I,q,ee)=>{const me=I.replace(/^\/goal\b/i,"").trim(),Ve=me.toLowerCase(),bt=(ee==null?void 0:ee.sendToDaemon)??!0,Nn=()=>{const an=!!yu.current,Wt=!os.current.sessionId||an;return Jo(I,q,{clearComposerOnPromptStart:Wt,commitComposerAccepted:an?ee==null?void 0:ee.commitComposerAccepted:void 0}).catch(lt=>{hn(lt,"Failed to send /goal command")}),!Wt};return me&&fie.has(Ve)?bt?Ex(I):(ze.appendLocalUserMessage(I),CI(b1.current),!0):me?bt?Nn():(ze.appendLocalUserMessage(I),SI(me,Date.now()),!0):bt?Nn():(ze.appendLocalUserMessage(I),!0)},[CI,SI,Ex,hn,Jo,ze,os]),M1=f.useMemo(()=>new Set((m??[]).map(MT).filter(Boolean)),[m]),roe=M1.has("settings"),AI=f.useCallback((I,q,ee,me)=>{var Nn;if(os.current.loadingTranscript)return kn("warning",Y("editor.sessionLoading")),!1;if(cbt({connectionStatus:os.current.status}))return kn("warning",Y("editor.connectionDisconnected")),!1;const Ve=uc.current!=="idle",bt=(an,Wt,lt,at)=>{const Wn=!!yu.current,Qn=!os.current.sessionId||Wn;return Jo(an,Wt,{...at,clearComposerOnPromptStart:Qn,commitComposerAccepted:Wn?ee:void 0}).catch(us=>hn(us,lt)),!Qn};if(I.startsWith("/")){const an=I.match(/^\/([\w-]+)/);if(an){const Wt=an[1];if(M1.has(MT(Wt)))return Ve?Hf(I,q,void 0,ee,me==null?void 0:me.inputAnnotations):bt(I,q,"Failed to send hidden slash command",{inputAnnotations:me==null?void 0:me.inputAnnotations});if(Wt==="help")return uo(!0),!0;if(Wt==="tasks")return dC(),!0;if(Wt==="goal")return Ve?gbt(I)?Ex(I):fc():TI(I,q,{commitComposerAccepted:ee});if(Wt==="theme"){const lt=I.slice(an[0].length).trim().toLowerCase();return lt==="dark"||lt==="light"?T1(lt):lt?kn("error",Y("error.unsupportedTheme")):F3(!0),!0}if(Wt==="language"){const lt=I.slice(an[0].length).trim(),[at,Wn]=lt.split(/\s+/);if(!lt)return ze.dispatch([{type:"status",text:[Y("language.current",{language:F9(Ge)}),Y("language.usage"),Y("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;if((at==null?void 0:at.toLowerCase())==="ui"){if(!Wn)return ze.dispatch([{type:"status",text:[Y("language.set"),"",Y("language.usage"),"",Y("language.options"),"  - en: English","  - zh-CN: 中文"].join(`
`)}]),!0;const Qn=Wn.toLowerCase();if(!["en","zh","zh-cn","zh_cn"].includes(Qn))return kn("error",Y("language.invalid")),!0;const Ps=Ku(Wn);if(Ip(Ps),!Ve){const Ma=!!yu.current,mc=!os.current.sessionId||Ma;return Jo(`/language ui ${Ps}`,void 0,{clearComposerOnPromptStart:mc,commitComposerAccepted:Ma?ee:void 0}).then(()=>He.refreshCommands()).catch(pl=>{hn(pl,"Failed to sync /language command")}),!mc}return!0}}if(Wt==="copy"){const lt=I.slice(an[0].length).trim();return J1t(Ms.current,lt).then(at=>{ze.dispatch([{type:at.status==="error"?"error":"status",text:$bt(at.message,Y)}])}).catch(at=>{hn(at,Y("copy.failedFallback"))}),!0}if(Wt==="delete")return Ao(!0),!0;if(Wt==="release")return wi(!0),!0;if(Wt==="rewind")return Di()?(Pd(!0),!0):!1;if(Wt==="branch"){if(Ve)return fc();const lt=I.slice(an[0].length).trim();return Sx(lt||void 0),!0}if(Wt==="fork"){if(Ve)return fc();if(!Di())return!1;const lt=I.slice(an[0].length).trim();return lt?(He.forkSession(lt).then(at=>{if(!at.launched){kn("warning",Y("fork.notStarted"));return}O3(Wn=>Wn+1),kn("success",Y("fork.started",{name:at.description}))}).catch(at=>{const Wn=at instanceof Error?at.message:String(at);hn(at,Y("fork.failed",{reason:Wn}))}),!0):(kn("error",Y("fork.empty")),!0)}if(Wt==="auth")return X3(!0),!0;if(Wt==="model"){const lt=I.slice(an[0].length).trim();if(lt==="--fast")return Qo("fast"),!0;if(lt.startsWith("--fast "))return Ve?Hf(I,q,void 0,ee,me==null?void 0:me.inputAnnotations):bt(I,q,"Failed to send /model --fast",{inputAnnotations:me==null?void 0:me.inputAnnotations});if(lt==="--voice")return hc(I,q)||Et.loadProviders().then(at=>{Qe(Jz(at)),Qo("voice")}).catch(at=>hn(at,Y("model.setVoice"))),!0;if(lt.startsWith("--voice ")){const at=lt.replace(/^--voice\s+/,"");return fl("workspace","voiceModel",at).catch(Wn=>hn(Wn,Y("model.setVoice"))),!0}if(lt==="--vision")return Qo("vision"),!0;if(lt.startsWith("--vision ")){const at=lt.replace(/^--vision\s+/,"");return fl("workspace","visionModel",at).catch(Wn=>hn(Wn,Y("model.setVision"))),!0}if(lt){if(!os.current.sessionId)return jp(lt),!0;He.setModel(lt).then(()=>{jp(lt)}).catch(at=>{hn(at,Y("model.switch"))})}else Qo("main");return!0}if(Wt==="plan"){if(Ve)return fc();const lt=I.slice(an[0].length).trim();return os.current.sessionId?(lt&&qf(!0),He.setApprovalMode("plan").then(()=>{if(_1("plan"),lt)return Jo(lt,q,{clearComposerOnPromptStart:!0,inputAnnotations:me==null?void 0:me.inputAnnotations}).catch(at=>hn(at,"Failed to send plan prompt"))}).catch(at=>{hn(at,Y("mode.plan"))}).finally(()=>{lt&&qf(!1)}),!lt):(_1("plan"),lt?bt(lt,q,"Failed to send plan prompt",{inputAnnotations:me==null?void 0:me.inputAnnotations}):!0)}if(Wt==="approval-mode"){const lt=I.slice(an[0].length).trim();return lt?Fd(lt):Dn(!0),!0}if(Wt==="mcp"){const lt=I.slice(an[0].length).trim().toLowerCase();return Et.loadMcpStatus().then(at=>{U3({status:at,toolsByServer:{},resourcesByServer:{},showDescriptions:lt==="desc",showSchema:lt==="schema",showTips:!lt}),Aa("mcp")}).catch(at=>{hn(at,"Failed to load MCP status")}),!0}if(Wt==="skills")return I.slice(an[0].length).trim()?Ve?Hf(I,q,void 0,ee,me==null?void 0:me.inputAnnotations):bt(I,q,"Failed to send /skills command",{inputAnnotations:me==null?void 0:me.inputAnnotations}):(hc(I,q)||Et.loadSkillsStatus().then(at=>{const Wn=Eq(at);if(x1(Wn),Wn.length===0)ze.dispatch([{type:"status",text:Y("skills.none")}]);else{const Qn=Wn.map(us=>`- ${us.name}`).join(`
`);ze.dispatch([{type:"status",text:`${Y("skills.available")}

${Qn}`}])}ul("smooth")}).catch(at=>{hn(at,"Failed to load skills")}),!0);if(Wt==="tools"){const lt=I.slice(an[0].length).trim().toLowerCase();if(lt==="desc"||lt==="descriptions")Hj(!0);else{if(hc(I,q))return!0;Et.loadToolsStatus().then(at=>{const Wn=(at==null?void 0:at.tools)??[];if(Wn.length===0)ze.dispatch([{type:"status",text:Y("tools.none")}]);else{const Qn=Wn.map(us=>`- ${us.displayName||us.name}`).join(`
`);ze.dispatch([{type:"status",text:`${Y("tools.available")}

${Qn}`}])}ul("smooth")}).catch(at=>{hn(at,"Failed to load tools")})}return!0}if(Wt==="settings")return Aa("settings"),!0;if(Wt==="schedule")return V3(),!0;if(Wt==="context"){const lt=I.slice(an[0].length).trim().toLowerCase();if(lt===""||lt==="detail"||lt==="-d")return A1(I,lt==="detail"||lt==="-d"),!0}if(Wt==="memory"){const lt=I.slice(an[0].length).trim().toLowerCase();if(lt==="refresh")Cie(at=>at+1);else if(lt==="add"||lt.startsWith("add ")){const at=lt.slice(3).trim();jie(at==="user"||at==="global"?"global":"workspace"),Aie(Wn=>Wn+1)}return Zj(!0),!0}if(Wt==="agents"){const lt=I.slice(an[0].length).trim().toLowerCase();let at="menu";return lt==="create"?at="create":lt==="create user"||lt==="create global"?at="create-user":lt==="create project"||lt==="create workspace"?at="create-project":lt==="manage"&&(at="manage"),Q3(at),!0}if(Wt==="extensions"){const lt=I.slice(an[0].length).trim(),at=(Nn=lt.split(/\s+/)[0])==null?void 0:Nn.toLowerCase();if(!at||at==="manage")return Aa("extensions"),!0;if(at==="install"){if(Ve)return fc();const Wn=lt.slice(7).trim().split(/\s+/);let Qn="",us,Ps,Ma,mc,pl=null;for(let gl=0;gl<Wn.length;gl++){const No=Wn[gl];if(No)if(No==="--auto-update")Ma=!0;else if(No==="--pre-release"||No==="--allow-pre-release")mc=!0;else if(No==="--ref"||No==="--registry"){const Vf=Wn[gl+1];if(!Vf||Vf.startsWith("--")){pl=Y("extensions.install.missingOptionValue",{option:No});break}No==="--ref"?us=Vf:Ps=Vf,gl+=1}else if(No.startsWith("--")){pl=Y("extensions.install.unknownOption",{option:No});break}else if(!Qn)Qn=No;else{pl=Y("extensions.install.usage");break}}if(pl)return ze.appendLocalUserMessage(I),ze.dispatch([{type:"error",text:pl}]),!0;if(!Qn)return ze.appendLocalUserMessage(I),ze.dispatch([{type:"error",text:Y("extensions.install.usage")}]),!0;const pc=os.current.clientId;return pc?(ze.appendLocalUserMessage(I),ze.dispatch([{type:"status",text:Y("extensions.install.started",{source:Qn})}]),Et.installExtension({source:Qn,...us?{ref:us}:{},...Ps?{registry:Ps}:{},...Ma!==void 0?{autoUpdate:Ma}:{},...mc!==void 0?{allowPreRelease:mc}:{},consent:!0},pc).then(()=>{}).catch(gl=>{hn(gl,Y("extensions.install.requestFailed"))}),!0):(kn("warning",Y("extensions.install.waitForSession")),!0)}return hc(I,q)||ze.dispatch([{type:"error",text:Y("extensions.install.usage")}]),!0}if(Wt==="clear"||Wt==="new"||Wt==="reset")return xu(),!0;if(Wt==="rename"){const lt=Lbt(I.slice(an[0].length));if(lt.type==="auto"||lt.type==="delegate")return Ve?Hf(I,q,void 0,ee,me==null?void 0:me.inputAnnotations):bt(I,q,"Failed to send /rename command",{inputAnnotations:me==null?void 0:me.inputAnnotations});const at=lt.displayName;return at?Di()?(He.renameSession(at).then(()=>{ze.dispatch([{type:"status",text:Y("rename.success",{name:at})}])}).catch(Wn=>{hn(Wn,"Failed to rename session")}),!0):!1:(kn("error",Y("rename.empty")),!0)}if(Wt==="resume"){const lt=I.slice(an[0].length).trim();return lt?(he(),ho(),He.loadSession(lt).catch(at=>{hn(at,"Failed to load session")})):(he(),Br(!0)),!0}if(Wt==="recap")return hI(),!0;if(Wt==="btw")return fI(I.slice(an[0].length)),!0;if(Wt==="stats"){const lt=I.slice(an[0].length).trim().toLowerCase();let at="overview";return lt==="model"?at="model":lt==="tools"&&(at="tools"),Di()?(hc(I,q)||He.getStats().then(Wn=>{ze.dispatch([{type:"status",text:RBe(Wn,at)}]),ul("smooth")}).catch(()=>{}),!0):!1}if(Wt==="status"||Wt==="about")return hc(I,q)||Promise.all([Et.loadPreflight().catch(()=>null),Et.loadProviders().catch(()=>null),Et.loadEnv().catch(()=>null)]).then(([lt,at,Wn])=>{var Vf,HI,UI,VI,WI,GI;const Qn=Tq(lt,Wn);let us=Qn.authSource;!us&&((Vf=at==null?void 0:at.current)!=null&&Vf.authType)&&(us=at.current.authType);const Ps=[];Qn.nodeVersion&&Ps.push(`Node.js v${Qn.nodeVersion}`),Qn.npmVersion&&Ps.push(`npm ${Qn.npmVersion}`);let Ma="";us&&(us.startsWith("oauth")||us==="qwen-oauth"?Ma="Qwen OAuth":Ma=`API Key - ${us}`);const mc=`${Qn.platform} ${Qn.arch}`.trim(),pl=bx.current,pc=os.current,No={cliVersion:((HI=pc.capabilities)==null?void 0:HI.qwenCodeVersion)||"",runtime:Ps.join(" / "),platform:mc,auth:Ma,baseUrl:((UI=at==null?void 0:at.current)==null?void 0:UI.baseUrl)||"",model:pl||pc.currentModel||((VI=at==null?void 0:at.current)==null?void 0:VI.modelId)||"",fastModel:((WI=at==null?void 0:at.current)==null?void 0:WI.fastModelId)||pl||pc.currentModel||((GI=at==null?void 0:at.current)==null?void 0:GI.modelId)||"",sessionId:pc.sessionId||"",sandbox:Qn.sandbox,proxy:Qn.proxy,memoryUsage:Qn.memoryUsage};ze.dispatch([{type:"status",text:XBe(No)}]),ul("smooth")}),!0;if(Wt==="bug"){const lt=I.slice(an[0].length).trim();return hc(I,q)||Promise.all([Et.loadPreflight().catch(()=>null),Et.loadEnv().catch(()=>null)]).then(([at,Wn])=>{var Ma;const Qn=Tq(at,Wn),us=((Ma=os.current.capabilities)==null?void 0:Ma.qwenCodeVersion)||"",Ps={};if(us&&(Ps.cliVersion=us),Qn.nodeVersion&&(Ps.nodeVersion=Qn.nodeVersion),Qn.npmVersion&&(Ps.npmVersion=Qn.npmVersion),Qn.platform&&(Ps.platform=Qn.platform),Qn.arch&&(Ps.arch=Qn.arch),Qn.sandbox&&(Ps.sandbox=Qn.sandbox),Qn.memoryUsage&&(Ps.memoryUsage=Qn.memoryUsage),iC.current)iC.current({title:lt,systemInfo:Ps}),ze.dispatch([{type:"status",text:Y("bug.submitted")}]);else{const mc=Object.entries(Ps).filter(([,gl])=>gl).map(([gl,No])=>`${gl}: ${No}`).join(`
`),pl=`https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title=${encodeURIComponent(lt)}&info=${encodeURIComponent(`
`+mc+`
`)}`,pc=window.open(pl,"_blank");pc?(pc.opener=null,ze.dispatch([{type:"status",text:Y("bug.submitted")}])):kn("error",Y("bug.popupBlocked"))}}).catch(at=>{hn(at,Y("bug.failed"))}),!0}}return Ve?Hf(I,q,void 0,ee,me==null?void 0:me.inputAnnotations):bt(I,q,"Failed to send command",{inputAnnotations:me==null?void 0:me.inputAnnotations})}else if(I.startsWith("!")){if(Ve)return kn("error",Y("queue.shellBlocked")),!1;const an=I.slice(1).trim();return!an||!Di()?!1:(He.sendShellCommand(an).catch(Wt=>{hn(Wt,"Failed to execute shell command")}),!0)}else return Ve?Hf(I,q,void 0,ee,me==null?void 0:me.inputAnnotations):bt(I,q,"Failed to send message",{inputAnnotations:me==null?void 0:me.inputAnnotations})},[Jo,He,ze,Hf,hc,Sx,he,ho,Aa,V3,xu,Ex,TI,T1,Fd,Ip,fc,dC,M1,kn,hn,hI,fI,Di,ul,Ge,jp,_1,fl,A1,Y,Et]),soe=f.useCallback((I,q,ee,me)=>{const Ve=AI(I,q,ee,me);return Ve!==!1&&ul("smooth"),Ve},[AI,ul]),EI=f.useCallback((I,q,ee)=>{He.submitPermission(I,q,ee).catch(me=>{hn(me,"Failed to submit permission choice")})},[He,hn]),hC=f.useCallback(()=>{He.cancel().catch(I=>{hn(I,"Failed to cancel request")})},[He,hn]),ioe=f.useCallback(()=>{var I;return vu?!1:((I=lx.current)==null?void 0:I.focusTaskPill())??!1},[vu]),ooe=f.useCallback(I=>{var q,ee;if(I){(q=xi.current)==null||q.insertText(I);return}(ee=xi.current)==null||ee.focus()},[]),aoe=f.useCallback(I=>{cx(I)},[]),fC=f.useCallback(()=>{Tp.current&&dl&&uc.current==="idle"&&Id.current&&jd.current?(Rd.current=Id.current,Bf(!1),Jo(jd.current,Sp.current,{optimisticUserMessage:!1,retry:!0}).catch(I=>hn(I,"Failed to retry prompt"))):ze.dispatch([{type:"status",text:Y("retry.none")}])},[dl,Jo,hn,ze,Y]);f.useEffect(()=>{const I=q=>{if(!vu&&q.ctrlKey&&!q.metaKey&&!q.altKey&&!q.shiftKey){if(q.key==="l"){q.preventDefault(),yI();return}if(q.key==="o"){q.preventDefault(),vI();return}if(q.key==="y"){q.preventDefault(),fC();return}}};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[vu,yI,vI,fC,ze,Y]);const qd=f.useCallback(()=>{px.current=null,rI(!1),sI(!1),Np.current&&(clearTimeout(Np.current),Np.current=null)},[]),MI=f.useRef({streamingState:Gr,pendingApproval:Tt,interactionBlocked:vu,activePanel:vr,closePanel:ho,handleCancel:hC,handleCycleMode:lC});MI.current={streamingState:Gr,pendingApproval:Tt,interactionBlocked:vu,activePanel:vr,closePanel:ho,handleCancel:hC,handleCycleMode:lC};const loe=Gr!=="idle";f.useEffect(()=>{qd()},[loe,qd]),f.useEffect(()=>{const ee=(Ve,bt)=>{px.current=Ve,Ve==="cancel"?sI(!0):rI(!0),Np.current&&clearTimeout(Np.current),Np.current=setTimeout(qd,bt)},me=Ve=>{var an,Wt;if(Ve.defaultPrevented||Ve.isComposing)return;const bt=MI.current;if(Ve.key==="Escape"&&bt.activePanel){const lt=Ve.target;lt!=null&&lt.closest("[data-sidebar-shell]")||(Ve.preventDefault(),bt.closePanel());return}if(Ve.key!=="Escape"){px.current!==null&&qd(),Ve.key==="Tab"&&Ve.shiftKey&&!bt.interactionBlocked&&(Ve.preventDefault(),bt.handleCycleMode());return}const Nn=sbt({blocked:!!bt.pendingApproval||bt.interactionBlocked,streaming:bt.streamingState!=="idle",hasInput:!!((an=xi.current)!=null&&an.hasInput()),armed:px.current});if(Nn.kind!=="ignore")switch(Ve.preventDefault(),Nn.kind){case"cancel":bt.handleCancel(),qd();break;case"clear":(Wt=xi.current)==null||Wt.clear(),qd();break;case"arm":ee(Nn.action,Nn.action==="cancel"?2e3:500);break}};return window.addEventListener("keydown",me),()=>{window.removeEventListener("keydown",me),qd()}},[qd]);const NI=abt({catchingUp:!!ke.catchingUp,pendingApproval:Tt!==null,isPreparingPrompt:nC}),jI={catchingUp:!!ke.catchingUp,isPreparingPrompt:nC,isStreaming:Gr!=="idle"},coe=die(jI),Mx=oe==null?void 0:oe[coe],uoe=Mx!=null&&Mx.trim()?Mx:Y(lbt(jI)),N1=f.useCallback(I=>{if(!os.current.sessionId){jp(I);return}xx(!0),He.setModel(I).then(q=>{const ee=Ibt(q);jp((ee==null?void 0:ee.modelId)??I),ee&&ze.dispatch({type:"debug",text:Rbt(ee,Y),source:"model_switch_summary",data:ee})}).catch(q=>{hn(q,Y("model.switch"))}).finally(()=>xx(!1))},[He,ze,hn,Y,jp]),doe=f.useCallback(I=>{xx(!0),Et.deleteModel(I).then(q=>{q!=null&&q.requiresRestart&&ze.dispatch([{type:"status",text:Y("settings.requiresRestart")}]),vx().catch(ee=>{console.warn("[web-shell] failed to reload providers after delete",ee)}),zd().catch(ee=>{console.warn("[web-shell] failed to reload settings after delete",ee)})}).catch(q=>{hn(q,Y("settings.models.deleteFailed"))}).finally(()=>xx(!1))},[Et,vx,zd,hn,ze,Y]),II=f.useCallback(()=>{X3(!1),vx().catch(I=>{console.warn("[web-shell] failed to reload providers after auth dialog close",I)})},[vx]),hoe=f.useCallback(I=>{G(!1),fl(co,"modelFallbacks",I.join(",")).then(q=>{q!=null&&q.requiresRestart&&ze.dispatch([{type:"status",text:Y("settings.requiresRestart")}]),zd().catch(ee=>{console.warn("[web-shell] failed to reload settings after fallbacks save",ee)})}).catch(q=>hn(q,Y("settings.models.fallbacks.saveFailed")))},[co,fl,zd,hn,ze,Y]),foe=f.useCallback(I=>{if(Gr!=="idle"){fc();return}ho(),Jo(`/model --fast ${I}${co==="user"?" --global":" --project"}`).then(()=>{zd().catch(ee=>{console.warn("[web-shell] failed to reload workspace settings after fast-model switch",ee)})}).catch(ee=>{hn(ee,"Failed to switch fast model")})},[fc,ho,Jo,Gr,hn,zd,co]),moe=f.useCallback(I=>{const q=Aq(I);fl(co,"voiceModel",q).catch(ee=>hn(ee,Y("model.setVoice")))},[co,hn,fl,Y]),poe=f.useCallback(I=>{const q=ibt(I);fl(co,"visionModel",q).catch(ee=>hn(ee,Y("model.setVision")))},[co,hn,fl,Y]),goe={main:N1,fast:foe,voice:moe,vision:poe};f.useEffect(()=>{!ri&&!bu&&!zf&&Dd("workspace")},[ri,bu,zf]);const RI=f.useMemo(()=>kse(_se(ke.commands??[],xse(Y)),Y).filter(I=>!M1.has(MT(I.name))).map(I=>{const q=wse(I.name);return q?{...I,displayCategory:"skill",description:Y(q)}:I}),[ke.commands,M1,Y]),j1=f.useMemo(()=>{var I;return{version:((I=ke.capabilities)==null?void 0:I.qwenCodeVersion)||"",cwd:ke.workspaceCwd||"",currentModel:Bd,currentMode:hl,hideTips:(Dp==null?void 0:Dp.values.effective)===!0}},[(zI=ke.capabilities)==null?void 0:zI.qwenCodeVersion,ke.workspaceCwd,Bd,hl,Dp==null?void 0:Dp.values.effective]),boe=f.useMemo(()=>y?y(j1):c.jsx(ZJe,{...j1}),[y,j1]),Nx=f.useMemo(()=>w==null?void 0:w(j1),[w,j1]),ml=!ke.sessionId&&Ct.length===0&&!pu&&!Tt&&!rs,DI=ml&&k,I1=DI&&!!Nx,yoe=ml&&I1,mC=ml&&DI,LI=ke.status!=="connecting"&&!ke.sessionId&&ke.missingSession===!0&&!vr&&Ri==="chat",pC=ml?a2():Zt,voe=bie(K),PI=[Ut.app,Ut.appChat,ml?Ut.appChatEmpty:void 0,je.enabled?Ut.appWithSidebar:void 0,Ff===As.Light?Ut.themeLight:Ut.themeDark,Ff===As.Dark?"dark":void 0,o].filter(Boolean).join(" "),OI=f.useMemo(()=>({...a,...Tbt(pC,K)}),[K,pC,a]),BI=f.useCallback(I=>{dt(I),Cbt(I)},[]);return f.useLayoutEffect(()=>{const I=ni.current;if(!I)return;const q=p1.current,ee=g1.current,me=I.getBoundingClientRect();if(ee&&!ml&&q){const Ve=q.top-me.top;Math.abs(Ve)>1&&(I.style.transition="width 320ms ease",I.style.transform=`translateY(${Ve}px)`,requestAnimationFrame(()=>{I.style.transition="width 320ms ease, transform 280ms ease",I.style.transform=""}),window.setTimeout(()=>{I.style.transition=""},320))}p1.current=me,g1.current=ml},[ml]),f.useLayoutEffect(()=>{const I=document.createElement("div");return I.dataset.webShellPortalRoot="",I.dataset.webShellShadcn="",document.body.appendChild(I),If(I),()=>{I.remove(),If(null)}},[]),f.useLayoutEffect(()=>{const I=Md.current;if(!I||!cl)return;let q=null;const ee=()=>{q=null;const Nn=getComputedStyle(I),an=new Set;cl.dataset.webShellShadcn="",cl.classList.toggle("dark",Ff===As.Dark),cl.lang=Ge;for(let Wt=0;Wt<Nn.length;Wt+=1){const lt=Nn[Wt];lt.startsWith("--")&&(an.add(lt),cl.style.setProperty(lt,Nn.getPropertyValue(lt)))}for(const Wt of cc.current)an.has(Wt)||cl.style.removeProperty(Wt);cc.current=an},me=()=>{q===null&&(q=requestAnimationFrame(ee))};ee();const Ve=new MutationObserver(me);let bt=I;for(;bt;)Ve.observe(bt,{attributes:!0,attributeFilter:["class","style","data-theme","lang"]}),bt=bt.parentElement;return window.addEventListener("resize",me),()=>{Ve.disconnect(),window.removeEventListener("resize",me),q!==null&&cancelAnimationFrame(q)}},[PI,OI,cl,Ge,Ff]),c.jsx(spe,{value:Ff,children:c.jsx(zme,{language:Ge,children:c.jsx(RW.Provider,{value:cl,children:c.jsxs("div",{ref:Md,className:PI,style:OI,"data-web-shell-root":!0,"data-web-shell-shadcn":!0,lang:Ge,children:[!xe&&c.jsx(AJe,{toasts:Rn,onDismiss:Zn}),Mn&&c.jsx(Qs,{title:Y("resume.title"),size:"lg",onClose:()=>Br(!1),children:c.jsx(kZe,{workspaceCwd:Pe,onSelect:I=>{he(),ho(),He.loadSession(I).catch(q=>{hn(q,"Failed to load session")})},onClose:()=>Br(!1)})}),ri&&c.jsx(Qs,{title:Y(pbt[ri]),size:"lg",onClose:()=>Qo(null),children:c.jsx(HZe,{mode:ri,models:ri==="voice"?Re:void 0,currentModelId:ri==="voice"?Uie:ri==="vision"?Vie:ri==="fast"?Wie:void 0,onSelect:I=>{ri&&goe[ri](I),Qo(null)}})}),vt&&c.jsx(Qs,{title:Y("mode.select"),size:"sm",onClose:()=>Dn(!1),children:c.jsx(wZe,{currentMode:hl,onSelect:I=>{Fd(I),Dn(!1)}})}),qj&&c.jsx(Qs,{title:Y("tools.title"),size:"lg",onClose:()=>Hj(!1),children:c.jsx(fnt,{})}),J3&&c.jsx(Qs,{title:Y("tasks.title"),size:"lg",onClose:()=>gx(null),children:c.jsx(vre,{message:J3,embedded:!0,manageActiveEvent:!1,onClose:()=>gx(null)})}),k1&&c.jsx(Qs,{title:Y(k1==="manage"?"agent.manage":k1==="menu"?"agents.title":"agent.create"),size:"lg",onClose:()=>Q3(null),children:c.jsx(ytt,{mode:k1,embedded:!0,onMessage:I=>ze.dispatch([{type:"status",text:I}]),onClose:()=>Q3(null)})}),Jj&&c.jsx(Qs,{title:Y("memory.menu"),size:"lg",onClose:()=>Zj(!1),children:c.jsx(Btt,{refreshSignal:Sie,addSignal:Tie,addScope:Nie,onMessage:(I,q="status")=>{ze.dispatch([{type:q,text:I}])}})}),Eo&&c.jsx(Qs,{title:Y("help.title"),size:"md",onClose:()=>uo(!1),children:c.jsx(spt,{commands:RI})}),$r&&c.jsx(Qs,{title:Y("theme.title"),size:"sm",onClose:()=>F3(!1),children:c.jsx(ipt,{currentTheme:Ff,onSelect:T1,onClose:()=>F3(!1)})}),zf&&c.jsx(Qs,{title:Y("auth.title"),size:"lg",onClose:II,children:c.jsx(dnt,{onMessage:(I,q="status")=>{ze.dispatch([q==="error"?{type:"error",text:I}:{type:"status",text:I}])},onClose:II})}),bu&&c.jsx(Qs,{title:Y("settings.models.fallbacks.title"),size:"md",onClose:()=>G(!1),children:c.jsx(ret,{models:Kie,current:Gie,max:3,onConfirm:hoe,onClose:()=>G(!1)})}),Qr&&c.jsx(Qs,{title:Y("delete.title"),size:"lg",onClose:()=>Ao(!1),children:c.jsx(opt,{workspaceCwd:Pe,onDeleted:I=>{ze.dispatch([{type:"status",text:I.length===1?`${Y("delete.deleted")} (${I[0].slice(0,8)})`:Y("delete.deletedCount",{count:I.length})}])},onError:I=>{if(Zp(I))return;const q=I instanceof Error?I.message:String(I);kn("error",Y("delete.failed",{reason:q}))},onClose:()=>Ao(!1)})}),Ld&&c.jsx(Qs,{title:Y("release.title"),size:"lg",onClose:()=>wi(!1),children:c.jsx(apt,{workspaceCwd:Pe,onReleased:I=>{ze.dispatch([{type:"status",text:`${Y("release.released")} (${I.slice(0,8)})`}])},onError:I=>{if(Zp(I))return;const q=I instanceof Error?I.message:String(I);kn("error",Y("release.failed",{reason:q}))},onClose:()=>wi(!1)})}),$f&&c.jsx(Qs,{title:Y("rewind.title"),subtitle:Y("rewind.subtitle"),size:"lg",onClose:()=>Pd(!1),children:c.jsx(Spt,{blocks:Lt,loadSnapshots:eoe,rewind:toe,onError:noe,onClose:()=>Pd(!1)})}),c.jsxs("div",{className:Ut.appShell,children:[je.enabled&&c.jsxs("div",{"data-sidebar-shell":"",...bn?{role:"dialog","aria-modal":"true"}:{},"aria-label":Y("sidebar.label"),className:[Ut.mobileDrawer,bn?Ut.mobileDrawerOpen:void 0,qe?Ut.mobileDrawerForced:void 0].filter(Boolean).join(" "),children:[c.jsx("div",{className:Ut.mobileBackdrop,onClick:he,"aria-hidden":"true"}),c.jsx(P1t,{collapsed:(We||Ri==="split"&&!Ie)&&!bn,onCollapsedChange:Ke,onOpenSettings:()=>{he(),Aa("settings")},onOpenPlugins:()=>{he(),Aa("plugins")},onOpenDaemonStatus:()=>{he(),Aa("status")},onOpenScheduledTasks:()=>{he(),V3()},onOpenSessions:()=>{he(),Aa("sessions")},canOpenSessionsOverview:Be,onOpenSplitView:()=>{he(),Mp()},canOpenSplitView:Be,theme:Ff,onThemeChange:I=>{T1(I),fl("workspace",ym,BW(I))},onNewSession:I=>xu(I),onLoadSession:(I,q)=>(Ki("chat"),Pp(I,q)),onSelectCurrentSession:()=>{he(),Ki("chat"),ho()},onError:hn,mobileOpen:bn,sessionListReloadToken:cI,selectedWorkspaceCwd:wn,onSelectWorkspace:qr,workspaces:fe,lockedWorkspaceCwd:Pe,lockedWorkspace:je.lockedWorkspace,branding:je.branding,footer:je.footer})]}),c.jsxs("div",{ref:Un,className:[Ut.chatPane,Ri!=="chat"?Ut.chatPaneShowingPage:void 0,mC?Ut.chatPaneWithMobileComposerBottom:void 0].filter(Boolean).join(" "),children:[je.enabled&&je.showCompactToggle&&!vr&&Ri==="chat"&&c.jsx("button",{type:"button",className:[Ut.hamburgerButton,ml?Ut.hamburgerButtonFloating:void 0].filter(Boolean).join(" "),onClick:()=>{At(!1),Pn(I=>!I)},"aria-label":Y("sidebar.toggleMenu"),"aria-expanded":bn,children:c.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),c.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),c.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),vr&&c.jsxs("section",{className:Ut.panelHost,role:"region","data-testid":"inline-panel","aria-label":Y(vr==="settings"?"settings.title":vr==="status"?"daemon.title":vr==="extensions"?"extensions.manage.title":vr==="mcp"?"mcp.title":vr==="plugins"?"plugins.title":"sessionsOverview.title"),children:[vr!=="extensions"&&vr!=="mcp"&&vr!=="plugins"&&c.jsxs("div",{className:Ut.panelHeader,children:[c.jsx("button",{ref:Wj,type:"button",className:Ut.panelBack,"data-testid":"panel-back",onClick:ho,"aria-label":Y("common.back"),title:Y("common.back"),children:c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M15 5l-7 7 7 7",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),c.jsx("div",{className:Ut.panelTitle,children:Y(vr==="settings"?"settings.title":vr==="status"?"daemon.title":"sessionsOverview.title")})]}),c.jsx("div",{className:Ut.panelBody,children:vr==="settings"?c.jsx(Tmt,{settingsState:gI,embedded:!0,onLanguageChange:Yie,onThemeChange:T1,chatWidthMode:Zt,onChatWidthModeChange:BI,modelManagement:{providers:yx.providers,currentModelId:ke.currentModel??void 0,loading:yx.loading,error:yx.error,busy:Hie,onSelectModel:N1,onDeleteModel:doe,onAddModel:()=>X3(!0)},onSubDialog:(I,q)=>{I==="fastModel"?(Dd(q),Qo("fast")):I==="visionModel"?(Dd(q),Qo("vision")):I==="voiceModel"?Et.loadProviders().then(ee=>{Qe(Jz(ee)),w1.current===null&&!_e.current&&!eI.current&&(Dd(q),Qo("voice"))}).catch(ee=>hn(ee,Y("model.setVoice"))):I==="modelFallbacks"?(Dd(q),G(!0)):I==="tools.approvalMode"&&Dn(!0)}}):vr==="status"?c.jsx(oit,{}):vr==="extensions"?c.jsx(Yse,{onClose:ho,initialFocusRef:Gj}):vr==="mcp"&&hx?c.jsx(Jse,{message:hx,onClose:()=>{U3(null),ho()}}):vr==="plugins"?c.jsx(Gft,{mcpMessage:hx,loadMcpMessage:async()=>{try{await wie()}catch(I){throw hn(I,"Failed to load MCP status"),I}},onClose:ho,initialFocusRef:Kj}):c.jsx(Xit,{onOpenSession:cC,onOpenSplit:Mp,includeOtherWorkspaces:!Pe,workspaceCwd:Pe})},vr)]}),Ri==="scheduledTasks"&&c.jsxs("div",{className:Ut.fullPage,"data-testid":"scheduled-tasks-page",children:[c.jsxs("div",{className:Ut.fullPageHeader,children:[c.jsx("button",{type:"button",className:Ut.fullPageBack,onClick:()=>Ki("chat"),"aria-label":Y("common.back"),title:Y("common.back"),children:c.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:c.jsx("path",{d:"M15 18l-6-6 6-6"})})}),c.jsx("div",{className:Ut.fullPageTitle,children:Y("scheduledTasks.title")})]}),c.jsx("div",{className:Ut.fullPageBody,children:c.jsx(pft,{onRunPrompt:Zie,workspaces:Pe?pt:fe,lockedWorkspace:Ce,onCreateViaChat:()=>{xu().then(I=>{I&&(e==null||e(void 0),window.setTimeout(()=>{var q,ee;(q=xi.current)==null||q.insertText(Y("scheduledTasks.chatStarter"),{mode:"replace"}),(ee=xi.current)==null||ee.focus()},0))})},onOpenSession:I=>{Ki("chat"),Pp(I).catch(q=>{hn(q,"Failed to open session")})},onError:hn})})]}),Ri==="split"&&c.jsxs("div",{className:Ut.fullPage,"data-testid":"split-view-page",children:[yr&&c.jsxs("div",{className:Ut.splitApprovalNotice,role:"status","data-testid":"split-approval-notice",children:[c.jsx("span",{children:Y("splitView.outerApprovalPending")}),c.jsx("button",{type:"button",onClick:()=>Ki("chat"),children:Y("splitView.goToApproval")})]}),c.jsx(hL,{value:ne,children:c.jsx(ip.Provider,{value:wx,children:c.jsx(Yct,{sessionIds:Ep,onPanesChange:kie,sessionListReloadToken:cI,includeOtherWorkspaces:!Pe,workspaceCwd:Pe,onExit:_ie,onError:hn,onRightPanelOpen:dr,onPaneArtifactsChange:Ee,messageTurnOutputs:U})})})]}),c.jsxs("div",{className:[Ut.chatViewWrap,mC?Ut.chatViewWithMobileComposerBottom:void 0,yoe?Ut.chatViewWithWelcomeMiddle:void 0,vr||Ri!=="chat"?Ut.chatViewHidden:void 0].filter(Boolean).join(" "),"aria-hidden":vr||Ri!=="chat"?!0:void 0,children:[LI&&c.jsxs("div",{className:Ut.missingSessionState,children:[c.jsx("div",{className:Ut.missingSessionMessage,children:Y("session.missing")}),c.jsx("button",{type:"button",className:Ut.missingSessionButton,disabled:B3,onClick:Jie,children:Y("session.new")})]}),c.jsx("div",{className:LI?Ut.chatSubtreeHidden:Ut.chatSubtree,children:c.jsxs(hL,{value:ne,children:[c.jsx(ip.Provider,{value:wx,children:c.jsx(ubt,{timeline:To,details:fu,children:c.jsx(OY.Provider,{value:Mie,children:(()=>{var me;const I=[Ut.content,pu||Ct.length>0||Tt?Ut.contentHasMessages:void 0].filter(Boolean).join(" "),q=c.jsx(Gre,{ref:Pf,messages:Ct,pendingApproval:En,onShowContextDetail:Xie,loadingTranscript:ke.loadingTranscript,catchingUp:ke.catchingUp,isResponding:Gr!=="idle",activeTurnStartedAt:Ul,workspaceCwd:ke.workspaceCwd||"",hideSessionTimeline:pC==="wide",showRetryHint:Cp,onRetryClick:fC,onBranchSession:Qie,bottomOverlayInset:Rf,welcomeHeader:ml?boe:void 0,centerWelcomeHeader:I1||void 0,tailContent:void 0,tailKey:void 0,onCanScrollToBottomChange:aoe,virtualScrollThreshold:Z,turnFileChanges:mn.has("file")?yt:void 0,turnArtifacts:mn.has("artifact")?rt:void 0,turnScheduledTasks:mn.has("scheduled_task")?wt:void 0,onTurnOutputOpen:dr,onReviewChanges:Nr,onOpenArtifact:ur,onOpenScheduledTask:ti,generateContent:(me=ke.capabilities)!=null&&me.features.includes("session_generation")?He.generateSessionContent:void 0}),ee=!I1&&(rs==null?void 0:rs.role)==="btw"?c.jsx("div",{className:Ut.btwPanel,children:c.jsx(Ire,{question:rs.question,answer:rs.answer,isPending:rs.isPending})}):null;return I1?c.jsxs("div",{className:Ut.mobileWelcomeGroup,children:[c.jsxs("div",{style:kp,className:I,children:[q,ee]}),c.jsx("div",{className:Ut.mobileWelcomeFooterMiddle,children:Nx})]}):c.jsxs("div",{style:kp,className:I,children:[q,ee]})})()})})}),c.jsxs("div",{ref:ni,style:kp,className:De?`${Ut.footer} ${Ut.footerWithCustomFooter}`:Ut.footer,children:[m1&&c.jsx("div",{className:jf?`${Ut.scrollToBottomLayer} ${Ut.scrollToBottomLayerWithTodos}`:Ut.scrollToBottomLayer,children:c.jsx("button",{type:"button",className:Ut.scrollToBottomButton,"aria-label":Y("chat.scrollToBottom"),onClick:()=>ul("smooth"),children:c.jsx("svg",{className:Ut.scrollToBottomIcon,viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M12 5v13M6.5 12.5 12 18l5.5-5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})})}),jf&&c.jsx("div",{ref:c1,className:Ut.bottomPanels,children:c.jsx(KJe,{todos:pu?Or:[],statusItems:ql})}),En&&Ri==="chat"&&c.jsx("div",{ref:Y3,tabIndex:-1,"data-testid":"approval-overlay",className:Ut.approvalOverlay,children:c.jsx(Cse,{request:En,onConfirm:EI,variant:"floating"})}),Sn&&Ri==="chat"&&c.jsx("div",{ref:Y3,tabIndex:-1,"data-testid":"approval-overlay",className:Ut.approvalOverlay,children:c.jsx(Tse,{request:Sn,onConfirm:EI,variant:"floating"})}),c.jsxs("div",{className:Ut.composer,children:[c.jsx(Qre,{startedAt:Ul}),Iie&&Gr==="idle"&&c.jsx("div",{className:Ut.escClearStatus,role:"status",children:Y("editor.escClearHint")}),c.jsx(Sse,{prompts:Pie,t:Y,onDelete:Bie,onInsert:$ie,onEdit:zie}),Dt&&c.jsx("div",{className:Ut.composerHeader,children:c.jsx(Dt,{disabled:NI,isRunning:Gr!=="idle",currentMode:hl,currentModel:Bd,sessionName:oI})}),c.jsx(Xre,{ref:Nd,onSubmit:soe,onCycleMode:lC,onToggleShortcuts:pI,onCancel:hC,isRunning:Gr!=="idle",isPreparing:nC,cancelArmed:Rie,disabled:NI,commands:RI,skills:Ap,slashCommandCategoryOrder:p,builtinAtProviders:g,atProviders:b,composerTagIcons:x,queuedMessages:Oie,onFocusFooter:ioe,onPopQueuedMessages:Fie,onClearQueuedMessages:qie,currentMode:hl,currentModel:Bd,gitBranch:ke.sessionId?ke.gitBranch:Jn,chatWidthMode:Zt,showChatWidthToggle:!ml,chatWidthToggleMin:voe,visibleToolbarActions:ie,availableModels:Die,onSelectMode:Fd,onSelectModel:N1,workspaces:!Pe&&fe.length>1?fe.map(I=>({id:I.id,cwd:I.cwd,label:I.cwd.split(/[\\/]+/).filter(Boolean).at(-1)??I.cwd,primary:I.primary})):void 0,selectedWorkspaceCwd:ke.sessionId?(FI=fe.find(I=>I.cwd===ke.workspaceCwd))!=null&&FI.primary?void 0:ke.workspaceCwd:wn,workspaceSelectionDisabled:!!ke.sessionId,atWorkspaceCwd:Pe??(ke.sessionId?ke.workspaceCwd:wn??((qI=fe.find(I=>I.primary))==null?void 0:qI.cwd)),onSelectWorkspace:I=>{cr.current=I,qr(I)},onChatWidthModeChange:BI,sessionName:oI,dialogOpen:vu||yr,followupState:$3,onAcceptFollowup:y1,onDismissFollowup:z3,composerInput:Le,composerInputVersion:ge,placeholderText:uoe})]}),De?mC?c.jsx("div",{className:Ut.customFooter,children:c.jsx(De,{connected:dl,mode:hl,model:Bd,streamingState:Gr,contextUsageRatio:(ke.contextWindow??0)>0?(ke.tokenCount??0)/(ke.contextWindow??0):0,activeGoal:Hl,tasks:h1,availableModes:cb,availableModels:(ke.models??[]).filter(jb).map(I=>({id:I.id,label:Tm(I.label||I.id),contextWindow:I.contextWindow})),skills:Ap,onSelectMode:Fd,onSelectModel:N1})}):c.jsx(De,{connected:dl,mode:hl,model:Bd,streamingState:Gr,contextUsageRatio:(ke.contextWindow??0)>0?(ke.tokenCount??0)/(ke.contextWindow??0):0,activeGoal:Hl,tasks:h1,availableModes:cb,availableModels:(ke.models??[]).filter(jb).map(I=>({id:I.id,label:Tm(I.label||I.id),contextWindow:I.contextWindow})),skills:Ap,onSelectMode:Fd,onSelectModel:N1}):c.jsx(aJe,{onSelectMode:()=>Dn(I=>!I),onSelectModel:()=>Qo(I=>I?null:"main"),onShowContext:()=>A1("/context",!1),onOpenSettings:()=>Aa("settings"),ref:lx,onOpenTasks:()=>dC(),onReturnToInput:ooe,tasks:Lf,activeGoal:Hl,hideSettings:roe,onToggleShortcuts:pI,compact:!0}),ml&&Nx&&c.jsx("div",{className:[Ut.emptyWelcomeFooter,I1?Ut.desktopWelcomeFooter:void 0].filter(Boolean).join(" "),children:Nx})]})]})})]})]}),we&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:Ut.artifactResizeHandle,role:"separator","aria-orientation":"vertical","aria-valuemin":Jp,"aria-valuemax":Tn(),"aria-valuenow":Fe,onPointerDown:Ns}),c.jsx(Eht,{artifacts:de,tabs:An,activeTabId:zn,reviewChanges:Mr,selectedReviewPath:ce,panelWidth:Fe,workspaceCwd:ke.workspaceCwd||"",loading:qt,error:tr,onSelectTab:Xn,onCloseTab:cs,onClose:Yo})]})]})]})})})})}function IT({title:e,description:t,actionLabel:n,onAction:r,theme:s,icon:i}){return c.jsx("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-48 w-full items-center justify-center p-4 ${s==="dark"?"dark":""}`,children:c.jsxs(zh,{className:"border",children:[c.jsxs(Fh,{children:[c.jsx(qh,{variant:"icon",children:i??c.jsx(Nfe,{})}),c.jsx(Hh,{children:e}),c.jsx(ox,{children:t})]}),c.jsx(Mft,{children:c.jsx(Fr,{onClick:r,children:n})})]})})}function Fbt({sessionId:e,workspaceId:t,workspaceCwd:n,lockWorkspaceCwd:r,clientId:s,webShellProps:i}){var S,C,_,A;const o=pd(),a=ko(),[l,u]=f.useState(!1),[d,h]=f.useState(),[m,p]=f.useState(),g=f.useRef(void 0);f.useEffect(()=>u(!1),[e,r,n,t]);const b=l?void 0:e,x=l?void 0:r??n,v=x?void 0:t,y=f.useMemo(()=>{var L,N,O;const M=(N=(L=o.capabilities)==null?void 0:L.workspaces)==null?void 0:N.find(B=>B.cwd===x);if(M)return M;if(x&&x===((O=o.capabilities)==null?void 0:O.workspaceCwd))return{id:"primary",cwd:x,primary:!0,trusted:!0}},[x,(S=o.capabilities)==null?void 0:S.workspaceCwd,(C=o.capabilities)==null?void 0:C.workspaces]),w=r&&(d==null?void 0:d.requestedCwd)===r?d.workspace:void 0,k=x?y??w:(A=(_=o.capabilities)==null?void 0:_.workspaces)==null?void 0:A.find(M=>M.id===v),T=f.useMemo(()=>q9(Ku(i.language)),[i.language]);return f.useEffect(()=>{var L;if(!r||!o.capabilities||y||(d==null?void 0:d.requestedCwd)===r||m===r)return;((L=g.current)==null?void 0:L.cwd)!==r&&(g.current={cwd:r,promise:a.addWorkspace(r,{persist:!0}).then(N=>{if(N.persisted!==!0)throw new Error("Workspace registration was not persisted");return N})});let M=!1;return g.current.promise.then(async N=>{var O;if(!M){h({requestedCwd:r,workspace:N}),p(void 0);try{await((O=o.refreshCapabilities)==null?void 0:O.call(o))}catch{}}}).catch(()=>{M||p(r)}),()=>{M=!0}},[y,d,m,o,o.capabilities,o.refreshCapabilities,a,r]),(x||v)&&o.status==="error"?c.jsx(IT,{title:T("workspace.loadFailed"),description:T("workspace.loadFailedDescription"),actionLabel:T("common.retry"),theme:i.theme,icon:c.jsx(cL,{}),onAction:()=>{var M;(M=o.refreshCapabilities)==null||M.call(o).catch(()=>{})}}):(x||v)&&!o.capabilities?c.jsxs("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-32 w-full items-center justify-center gap-2 text-sm text-muted-foreground ${i.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[c.jsx(Ka,{}),c.jsx("span",{children:T("common.loading")})]}):r&&m===r?c.jsx(IT,{title:T("workspace.loadFailed"),description:T("workspace.loadFailedDescription"),actionLabel:T("common.retry"),theme:i.theme,icon:c.jsx(cL,{}),onAction:()=>{g.current=void 0,p(void 0)}}):r&&!k?c.jsxs("div",{"data-web-shell-root":!0,"data-web-shell-shadcn":!0,className:`flex min-h-32 w-full items-center justify-center gap-2 text-sm text-muted-foreground ${i.theme==="dark"?"dark":""}`,role:"status","aria-live":"polite",children:[c.jsx(Ka,{}),c.jsx("span",{children:T("common.loading")})]}):(x||v)&&!k?c.jsx(IT,{title:T("workspace.notFound"),description:T("workspace.notFoundDescription"),actionLabel:T("session.new"),theme:i.theme,onAction:()=>{var M;u(!0),(M=i.onSessionIdChange)==null||M.call(i,void 0,void 0)}}):c.jsx(mW,{sessionId:b,workspaceCwd:k==null?void 0:k.cwd,clientId:s,suppressOwnUserEcho:!0,children:c.jsx(zbt,{...i,lockedWorkspaceCwd:r?k==null?void 0:k.cwd:void 0,lockedWorkspaceCapability:r?k:void 0})},`${(k==null?void 0:k.id)??v??"primary"}:${b??"new"}`)}const qbt=cit(),yie="qwen-code-web-shell-language",vie="qwen-code-web-shell-theme";function xie(e){if(e===As.Dark||e===As.Light)return e}function Hbt(){const e=new URLSearchParams(window.location.search).get("theme");return xie(e)}function Ubt(){try{return xie(window.localStorage.getItem(vie))}catch{return}}function Vbt(e){try{window.localStorage.setItem(vie,e)}catch{}}function Wbt(){return Hbt()??Ubt()??As.Dark}function Gbt(){try{const e=window.localStorage.getItem(yie);return e?Ku(e):void 0}catch{return}}function Kbt(e){try{window.localStorage.setItem(yie,e)}catch{}}function Ybt(){const e=new URLSearchParams(window.location.search),t=e.get("language")??e.get("lang");return Ku(t||(Gbt()??navigator.language))}function Xbt(){const e=window.location.pathname.match(/\/session\/([^/]+)/);if(e)try{return decodeURIComponent(e[1])}catch{return}}function Qbt(){return new URLSearchParams(window.location.search).get("workspace")||void 0}function Jbt(e,t){const n=new URL(window.location.href);n.pathname=e?`/session/${encodeURIComponent(e)}`:"/",e&&t?n.searchParams.set("workspace",t):n.searchParams.delete("workspace"),n.searchParams.delete("theme"),n.searchParams.delete("language"),n.searchParams.delete("lang"),n.searchParams.delete("token"),n.searchParams.delete("daemon"),window.history.replaceState(null,"",n)}function Zbt({daemonToken:e}){const[t,n]=f.useState(()=>Wbt()),[r,s]=f.useState(()=>Ybt()),[i]=f.useState(()=>Xbt()),[o]=f.useState(()=>Qbt()),a=qbt||window.location.origin;f.useEffect(()=>{const h=document.documentElement;h.classList.remove("theme-dark","theme-light","dark"),h.classList.add(`theme-${t}`),h.classList.toggle("dark",t===As.Dark);const m=document.querySelector('meta[name="theme-color"]');m&&m.setAttribute("content",t==="light"?"#ffffff":"#0d0d0d")},[t]);const l=f.useCallback(h=>{n(h),Vbt(h)},[]),u=f.useCallback(h=>{s(h),Kbt(h)},[]),d=f.useCallback((h,m)=>{Jbt(h,m)},[]);return c.jsx(ld,{label:"web-shell-root",fallback:(h,m)=>c.jsx($he,{error:h,onRetry:m,language:r}),children:c.jsx(Wde,{baseUrl:a,token:e,children:c.jsx(Fbt,{sessionId:i,workspaceId:o,webShellProps:{theme:t,onThemeChange:l,language:r,onLanguageChange:u,onSessionIdChange:d,sidebar:!0,compactThinking:!0,markdownTableMode:"advanced"}})})})}async function eyt(){const e=hse()??await hit();fit(),yce.createRoot(document.getElementById("root")).render(c.jsx(Hq.StrictMode,{children:c.jsx(Zbt,{daemonToken:e})}))}eyt();export{gp as C,vn as D,It as E,sn as F,dd as G,vf as P,_r as R,lo as S,Wr as T,Fs as V,ll as W,re as _,Yn as a,Ir as b,Ti as c,ef as d,Zc as e,gyt as f,mTe as g,zTe as h,l2 as i,_4 as j,cyt as k,of as l};
